Repository: nineya/halo-theme-dream Branch: master Commit: 62c28dea8594 Files: 220 Total size: 3.6 MB Directory structure: gitextract_1x6ktdds/ ├── .eslintignore ├── .eslintrc.js ├── .github/ │ └── ISSUE_TEMPLATE/ │ ├── bug_report.yml │ ├── config.yml │ ├── custom_config.yml │ └── feature_request.yml ├── .gitignore ├── .npmignore ├── .npmrc ├── 404.ftl ├── 500.ftl ├── LICENSE ├── README.md ├── archives.ftl ├── categories.ftl ├── category.ftl ├── gulpfile.js ├── index.ftl ├── journals.ftl ├── links.ftl ├── mail_template/ │ ├── mail_notice.ftl │ └── mail_reply.ftl ├── package.json ├── photos.ftl ├── post.ftl ├── post_literature.ftl ├── post_password.ftl ├── search.ftl ├── settings.yaml ├── sheet.ftl ├── sheet_literature.ftl ├── source/ │ ├── cursor/ │ │ ├── OwO/ │ │ │ ├── arrow.cur │ │ │ └── hand.cur │ │ ├── UwU/ │ │ │ ├── arrow.cur │ │ │ └── hand.cur │ │ ├── black_cat/ │ │ │ ├── Alternative.cur │ │ │ ├── Escritura a Mano.cur │ │ │ ├── Move.cur │ │ │ ├── No_Disponible.cur │ │ │ ├── Ocupado.cur │ │ │ ├── ayuda.cur │ │ │ ├── diagonal resize 1.cur │ │ │ ├── diagonal resize 2.cur │ │ │ ├── horizontal.cur │ │ │ ├── normal.cur │ │ │ ├── precision.cur │ │ │ ├── texto.cur │ │ │ ├── vertical.cur │ │ │ └── work.cur │ │ ├── breeze/ │ │ │ ├── Arrow.cur │ │ │ ├── Cross.cur │ │ │ ├── Hand.cur │ │ │ ├── Handwriting.cur │ │ │ ├── Help.cur │ │ │ ├── IBeam.cur │ │ │ ├── NO.cur │ │ │ ├── SizeAll.cur │ │ │ ├── SizeNESW.cur │ │ │ ├── SizeNS.cur │ │ │ ├── SizeNWSE.cur │ │ │ ├── SizeWE.cur │ │ │ └── UpArrow.cur │ │ ├── debris/ │ │ │ ├── arrow.cur │ │ │ └── hand.cur │ │ ├── horse/ │ │ │ ├── arrow.cur │ │ │ └── hand.cur │ │ ├── marry/ │ │ │ ├── arrow.cur │ │ │ ├── beam.ani │ │ │ ├── beam.cur │ │ │ ├── busy.ani │ │ │ ├── ew.ani │ │ │ ├── move.cur │ │ │ ├── nesw.ani │ │ │ ├── ns.ani │ │ │ ├── nwse.ani │ │ │ └── working.ani │ │ ├── mellow/ │ │ │ ├── arrow.cur │ │ │ └── hand.cur │ │ ├── music_cat_01/ │ │ │ ├── arrow.cur │ │ │ └── hand.cur │ │ ├── music_cat_02/ │ │ │ ├── arrow.cur │ │ │ └── hand.cur │ │ ├── overwatch/ │ │ │ ├── alternate.cur │ │ │ ├── busy.ani │ │ │ ├── cross.cur │ │ │ ├── dgn1.cur │ │ │ ├── dgn2.cur │ │ │ ├── handwriting.cur │ │ │ ├── help.cur │ │ │ ├── horz.cur │ │ │ ├── link.cur │ │ │ ├── move.cur │ │ │ ├── person.cur │ │ │ ├── pin.cur │ │ │ ├── pointer.cur │ │ │ ├── text.cur │ │ │ ├── vert.cur │ │ │ └── work.ani │ │ ├── rainbow_rain/ │ │ │ ├── Alternative2.cur │ │ │ ├── Escritura a Mano.cur │ │ │ ├── Movee2.cur │ │ │ ├── No Disponible.cur │ │ │ ├── Ocupado.cur │ │ │ ├── ayuda.cur │ │ │ ├── diagonal resize 1.cur │ │ │ ├── diagonal resize 2.cur │ │ │ ├── horizontal.cur │ │ │ ├── link.ani │ │ │ ├── link.cur │ │ │ ├── normal.cur │ │ │ ├── precision.cur │ │ │ ├── texto.cur │ │ │ ├── trabajando en segundo plano.cur │ │ │ └── vertical1.cur │ │ ├── water_01/ │ │ │ ├── arrow.cur │ │ │ └── hand.cur │ │ └── water_02/ │ │ ├── arrow.cur │ │ └── hand.cur │ └── lib/ │ ├── halo-comment@1.1.7/ │ │ ├── demo.html │ │ └── halo-comment.js │ ├── highlightjs@11.5.1/ │ │ ├── LICENSE │ │ ├── README.md │ │ ├── es/ │ │ │ ├── core.js │ │ │ ├── highlight.js │ │ │ └── package.json │ │ ├── highlight.js │ │ └── package.json │ ├── jquery-pjax@2.0.1/ │ │ └── jquery.pjax.js │ ├── katex@0.12.0/ │ │ ├── README.md │ │ ├── contrib/ │ │ │ ├── auto-render.js │ │ │ ├── auto-render.mjs │ │ │ ├── copy-tex.css │ │ │ ├── copy-tex.js │ │ │ ├── copy-tex.mjs │ │ │ ├── mathtex-script-type.js │ │ │ ├── mathtex-script-type.mjs │ │ │ ├── mhchem.js │ │ │ ├── mhchem.mjs │ │ │ ├── render-a11y-string.js │ │ │ └── render-a11y-string.mjs │ │ ├── katex.css │ │ ├── katex.js │ │ └── katex.mjs │ ├── live2d@1.0.1/ │ │ └── waifu-tips.json │ └── swiper@8.4.6/ │ ├── swiper-bundle.css │ └── swiper-bundle.js ├── src/ │ ├── css/ │ │ ├── celebration.less │ │ ├── cursor.less │ │ ├── dshare.less │ │ ├── mew-custom.less │ │ ├── post.less │ │ ├── style.less │ │ └── theme.less │ └── js/ │ ├── autoload.js │ ├── btoc.js │ ├── common.js │ ├── cursor/ │ │ ├── click/ │ │ │ ├── firework.js │ │ │ ├── granule.js │ │ │ ├── heart.js │ │ │ └── prosperous.js │ │ └── move/ │ │ ├── bubbleCursor.js │ │ ├── emojiCursor.js │ │ ├── fairyDustCursor.js │ │ ├── followingDotCursor.js │ │ ├── ghostCursor.js │ │ ├── snowflakeCursor.js │ │ ├── springyEmojiCursor.js │ │ └── trailingCursor.js │ ├── dprogress.js │ ├── dshare.js │ ├── editor-options.js │ ├── effects/ │ │ ├── circleMagic.js │ │ ├── lantern.js │ │ ├── sakura.js │ │ ├── snowflake.js │ │ └── universe.js │ ├── journals.js │ ├── mew-custom.js │ ├── photos.js │ ├── pjax.js │ ├── post.js │ ├── settings.js │ ├── spark-input.js │ ├── sw.js │ └── utils.js ├── tag.ftl ├── tags.ftl ├── template/ │ ├── common/ │ │ ├── actions.ftl │ │ ├── banner.ftl │ │ ├── config.ftl │ │ ├── footer.ftl │ │ ├── head.ftl │ │ ├── navbar.ftl │ │ ├── scripts.ftl │ │ └── widget.ftl │ ├── errorpage.ftl │ ├── layout.ftl │ ├── layout_default.ftl │ ├── layout_pjax.ftl │ ├── main/ │ │ ├── admire.ftl │ │ ├── article.ftl │ │ ├── article_list.ftl │ │ ├── article_literature.ftl │ │ ├── comment.ftl │ │ ├── copyright.ftl │ │ └── pagination.ftl │ └── widget/ │ ├── ad_piece.ftl │ ├── categories.ftl │ ├── custom.ftl │ ├── links.ftl │ ├── love.ftl │ ├── music.ftl │ ├── notice.ftl │ ├── profile.ftl │ ├── recent_comments.ftl │ ├── recent_posts.ftl │ ├── tagcloud.ftl │ ├── tags.ftl │ └── toc.ftl └── theme.yaml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .eslintignore ================================================ source/ ================================================ FILE: .eslintrc.js ================================================ module.exports = { 'env': { 'browser': true, 'es2021': true }, 'extends': 'eslint:recommended', 'overrides': [], 'parserOptions': { 'ecmaVersion': 'latest', 'sourceType': 'module' }, 'rules': { 'indent': ['error', 2], 'linebreak-style': ['error', 'unix'], 'quotes': ['error', 'single'], 'semi': ['error', 'never'], 'no-undef': ['off'], 'no-unused-vars': ['off'], 'no-useless-escape': ['off'], 'no-mixed-spaces-and-tabs': ['off'], 'no-inner-declarations': ['off'] } } ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.yml ================================================ name: BUG 提交 description: 提交 Bug 反馈 title: 'bug:' labels: [bug] body: - type: markdown id: preface attributes: value: | 感谢你花时间填写此错误报告!在开始之前,我们非常推荐阅读一遍[《开源最佳实践》](https://github.com/LinuxSuRen/open-source-best-practice),这会在很大程度上提高我们彼此的效率。 - type: markdown id: environment attributes: value: "## 环境信息" - type: input id: halo-version validations: required: false attributes: label: "是什么 Halo 版本出现了此问题?" description: "可以在管理后台的关于页面中找到。" - type: input id: dream-version validations: required: false attributes: label: "使用的 Dream 版本是多少?" description: "可以在主题 `theme.yaml` 文件中找到。" - type: input id: site-url attributes: label: "在线博客地址" description: "如果可以的话,请提供你的博客地址。这可能会帮助我们更好的定位问题。" placeholder: "ex. https://blog.nineya.com" validations: required: false - type: markdown id: details attributes: value: "## 详细信息" - type: textarea id: what-happened attributes: label: "BUG 内容" description: "较详细的描述 BUG 导致了什么问题。" validations: required: true - type: textarea id: logs attributes: label: "相关 Console 日志输出" description: "浏览器界面按 `F12` 进入开发者工具,请复制并粘贴任何相关的控制台日志输出。 这将自动格式化为代码,因此无需反引号。" render: shell - type: textarea id: additional-information attributes: label: "附加信息" description: "如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。" ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: true contact_links: - name: 加入主题交流群 url: https://qm.qq.com/cgi-bin/qm/qr?k=X7p7Bs21cgtkQ0dRfzmBsuWqNNQc10hn&jump_from=webapi about: 如果问题描述起来较于复杂,欢迎加入 Dream 主题交流群进行提问。 ================================================ FILE: .github/ISSUE_TEMPLATE/custom_config.yml ================================================ name: 定制化配置 description: 提交定制化配置疑问 title: 'custom:' labels: [custom] body: - type: markdown id: preface attributes: value: "你好!感谢你为 Dream 提交定制化配置建议。在开始之前,我们非常推荐阅读一遍[《开源最佳实践》](https://github.com/LinuxSuRen/open-source-best-practice),这会在很大程度上提高我们彼此的效率。" - type: markdown id: environment attributes: value: "## 环境信息" - type: input id: dream-version validations: required: false attributes: label: "你当前使用的 Dream 版本" description: "可以在主题 `theme.yaml` 文件中找到。" - type: markdown id: details attributes: value: "## 详细信息" - type: textarea id: description attributes: label: "描述一下此定制化内容" validations: required: true - type: textarea id: additional-information attributes: label: "补充信息" description: "如果你还有其他需要提供的信息或解决思路,可以在这里填写。" ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.yml ================================================ name: 新特性建议 description: 提交新特性建议 title: 'feat:' body: - type: markdown id: preface attributes: value: "你好!感谢你为 Dream 提交新特性建议。在开始之前,我们非常推荐阅读一遍[《开源最佳实践》](https://github.com/LinuxSuRen/open-source-best-practice),这会在很大程度上提高我们彼此的效率。" - type: markdown id: environment attributes: value: "## 环境信息" - type: input id: halo-version validations: required: false attributes: label: "你当前使用的 Halo 版本" description: "可以在管理后台的关于页面中找到。" - type: input id: dream-version validations: required: false attributes: label: "你当前使用的 Dream 版本" description: "可以在主题 `theme.yaml` 文件中找到。" - type: markdown id: details attributes: value: "## 详细信息" - type: textarea id: description attributes: label: "描述一下此特性" validations: required: true - type: textarea id: additional-information attributes: label: "附加信息" description: "如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。" ================================================ FILE: .gitignore ================================================ *.iml .idea/ node_modules/ dist/ package-lock.json ================================================ FILE: .npmignore ================================================ /node_modules/* /.idea/* /.git/* /.github/* /dist ================================================ FILE: .npmrc ================================================ shamefully-hoist=true registry=https://registry.npmjs.org ================================================ FILE: 404.ftl ================================================ <#include "template/errorpage.ftl"> <@errorpage "找不到网页","无法找到该文章或分类,可能已被删除,去首页看看吧。","${status!}","${error!}","${message!}" /> ================================================ FILE: 500.ftl ================================================ <#include "template/errorpage.ftl"> <@errorpage "服务器繁忙","围观群众太过热情,服务器繁忙,请稍后访问。","${status!}","${error!}","${message!}" /> ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2021 Nineya 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. ================================================ FILE: README.md ================================================

halo-theme-dream

halo-theme-dream

releases license downloads size commits donate

主题已完成 `Halo 2.0` 适配,2.x 的主题不在当前仓库维护,详见:https://github.com/nineya/halo-theme-dream2.0 ## 一、预览 ![玖涯博客](https://cdn.jsdelivr.net/gh/nineya/halo-theme-dream@master/preview.png) 预览:[主题预览](https://github.com/nineya/halo-theme-dream/discussions/72) > 如果你有计划长期使用 `Dream` 主题,也来[这里](https://github.com/nineya/halo-theme-dream/discussions/72)留下你的博客链接吧。 ## 二、说明 梦之城,童话梦境,动漫类型博客主题。 关于主题使用上的一些问题可以参见 [主题使用手册-基础篇](https://blog.nineya.com/archives/94.html) 如有疑问,欢迎加入 Dream 主题交流群:638168592 个人博客交流,友链交换,欢迎加入 个人博客交流群:582535349 欢迎参与主题开发的一些问题探讨 欢迎关注微信公众号《玖涯菜菜子》,主题版本更新消息与要点说明将在公众号发布。 ![微信公众号](https://blog.nineya.com/upload/2025/03/%E7%8E%96%E6%B6%AF%E5%90%8E%E7%AB%AF%E7%AC%94%E8%AE%B0.png) ## 三、版本适配关系 | 主题版本 | 适配Halo-Plus版本 | 测试用Halo-Plus版本 | |----------|---------------|----------------| | xx-2.3.1 | 1.0.0 | 1.0.0 | | 3.0.0 | 1.0.1 | 1.0.1 | | 3.0.1 | 1.0.2 | 1.0.2 | 当前仓库为适配 `Halo-Plus` 的仓库,与 `Halo` 官方的博客系统不兼容。 - 兼容 `Halo 1.x` 的分支(存档,不再维护):https://github.com/nineya/halo-theme-dream/tree/halo - 兼容 `Haki 2.x` 的分支(维护中):https://github.com/nineya/halo-theme-dream2.0 ## 四、安装 & 更新 ### 4.1 安装包安装 & 更新 1. 进入主题 `Release` 界面:https://github.com/nineya/halo-theme-dream/releases 下载主题压缩包 `halo-theme-dream.zip` 压缩包文件; 2. 进入博客后台管理 `外观->主题->安装->本地上传`,选择下载的 `halo-theme-dream.zip` 安装包进行上传; 3. 等待安装完成; 4. 更新主题时同样前往主题 `Release` 界面下载主题安装包,然后通过 `外观->主题->Dream->更多->从主题包更新` 方法上传安装包进行更新。 ### 4.2 在线安装 & 更新 1. 复制主题仓库地址 `https://github.com/nineya/halo-theme-dream.git` 2. 进入博客后台管理 `外观->主题->安装->远程下载`,黏贴仓库地址进行安装; 3. 等待安装完成; 4. 在线更新主题时,通过 `外观->主题->Dream->更多->在线更新` 方法进行更新。 > 在线安装 & 更新的方式不推荐: > > 1. 因为由于 `GitHub` 的网络问题,很大几率会安装& 更新失败; > 2. 主题是经过源码编译的,直接从仓库下载包含了主题的源码以及开发所需的相关文件,这些文件并不是安装主题所需要的。 ## 五、参与主题开发 > 推荐使用 IDEA 进行主题开发,能够比较好的支持 FreeMarker。 1. 开发环境准备 - 安装 `nodejs` 版本需要在 `15+`; - 主题目录下执行 `npm i` 安装依赖; 2. npm 命令 - `npm run build` 执行主题打包操作,主题将被打包为压缩包文件存放在 `dist/` 目录下,同时 `source` 目录下的文件也将被更新。 - `npm run build --devel` 开发模式进行主题打包,`js` 和 `css` 不会被做压缩和混淆处理,方便排查问题。 - `npm run cdn --tag=$version` 创建 `FreeCDN` 清单文件,必须指定 `tag` 参数,值为本地代码将发布到 `GitHub` 仓库的版本标签。 - `npm run release --tag=$version` 发布模式执行主题打包操作,将自动更新主题中的版本号,并使用这个版本标签重新创建 `FreeCDN` 清单文件。 ## 六、打赏项目 感谢您对本项目的喜爱,您的打赏是对本项目最好的支持! ![打赏项目](https://blog.nineya.com/upload/2022/08/funding.png) ================================================ FILE: archives.ftl ================================================ <#include "template/layout.ftl"> <@layout title="归档 - ${blog_title!}" canonical="${archives_url!}"> <#if (archives)?? && archives?size gt 0> <#list archives as archive>
${archive.year?c}
<#list archive.posts as post> <#assign thumbnail = (post.thumbnail?? && post.thumbnail!='')?then(post.thumbnail!, (settings.default_thumbnail?? && settings.default_thumbnail!='')?then(settings.default_thumbnail + settings.default_thumbnail?contains('?')?then("&","?") + "postId=" + post.id?c, ''))>
<#if thumbnail!=''> ${post.title!}
${post.title!} <#if post.categories?? && post.categories?size gt 0>

<#list post.categories as category> ${category.name!} 

<#include "template/main/pagination.ftl"> <@pagination method="archives" datas=posts display="${settings.page_number!5}" /> <#else>
还没有发表过文章,回主页看看吧
================================================ FILE: categories.ftl ================================================ <#include "template/layout.ftl"> <#macro categoriesTree categories> <#list categories as category>
  • ${category.name} ${postCounts[category.id?c]!} <#if category.children?? && category.children?size gt 0>
  • <@layout title="分类 - ${blog_title!}" canonical="${categories_url!}"> <#assign postCounts = {}> <@categoryTag method="list"> <#list categories as category> <#assign postCounts += {category.id: category.postCount}> <@categoryTag method="tree"> <#if categories?? && categories?size gt 0>
    文章分类
    <#else>
    还没有创建过分类,回主页看看吧
    ================================================ FILE: category.ftl ================================================ <#include "template/layout.ftl"> <@layout title="分类:${category.name!} - ${blog_title!}" canonical="${category.fullPath!}"> <#if (posts.content)?? && posts.content?size gt 0>
    <#include "template/main/article_list.ftl"> <@article_list posts.content/> <#include "template/main/pagination.ftl"> <@pagination method="categoryPosts" datas=posts slug="${category.slug!}" display="${settings.page_number!5}" /> <#else>
    该分类下没有文章,回主页看看吧
    ================================================ FILE: gulpfile.js ================================================ const {src, dest, task, series, parallel} = require('gulp') const webpack = require('webpack-stream') const less = require('gulp-less') const autoprefix = require('gulp-autoprefixer') const uglify = require('gulp-uglify') const minifyCSS = require('gulp-csso') const zip = require('gulp-zip') const rename = require('gulp-rename') const clean = require('gulp-clean') const path = require('path') const execSync = require('child_process').execSync const fs = require('fs') const resolve = (name) => path.resolve(__dirname, name) const cssPath = './source/css' const jsPath = './source/js' const distPath = './dist' const devModel = process.env.npm_config_devel const version = process.env.npm_config_tag if (devModel) { console.log('> 开发模式') } version && console.log(`> 发布版本:${version}`) task('clean', () => { return src([cssPath, jsPath, distPath], { read: false, allowEmpty: true, }).pipe( clean({ force: true, }) ) }) task('version', (done) => { if (version == null) { console.log('[Version] No \'--tag\' parameters are specified') done() return } const themePath = 'theme.yaml' const packagePath = 'package.json' const themeData = fs.readFileSync(themePath, 'utf8') .replace(/^version:\s+[^\s]+$/m, 'version: ' + version) .replace(/^(editorOptions:.+mew=)[^\s]+$/m, '$1' + version) fs.writeFileSync(themePath, themeData) let packageData = fs.readFileSync(packagePath, 'utf8') .replace(/"version":\s*"[^"]+"/, `"version": "${version}"`) fs.writeFileSync(packagePath, packageData) done() }) task('css', () => { const ignoreFiles = [].map((file) => `./src/css/${file}.less`) let gw = src('./src/css/**/*.less', { ignore: ignoreFiles, }) .pipe(less()) .pipe( autoprefix({ overrideBrowserslist: ['> 2%', 'last 2 versions', 'not ie 6-9'], cascade: false, }) ) if (!devModel) { gw = gw.pipe(minifyCSS()) } return gw.pipe( rename({ suffix: '.min', }) ).pipe(dest(cssPath)) }) task('js', () => { const readFile = (prefix, dir, ignoreFiles) => { let result = {} let files = fs.readdirSync(dir, 'utf-8') files.forEach((file) => { let filePath = path.join(dir, file) let states = fs.statSync(filePath) if (states.isDirectory()) { Object.assign(result, readFile(path.join(prefix, file), filePath, ignoreFiles)) } else if (ignoreFiles.length ? /\.js$/.test(file) && !ignoreFiles.includes(path.join(prefix, file)) : /\.js$/.test(file)) { const fileName = file.replace(/.js$/, '') result[path.join(prefix, fileName)] = resolve(filePath) } }) return result } const getEntryData = () => { return readFile('', './src/js', []) } return webpack({ mode: devModel ? 'development' : 'production', entry: getEntryData(), module: { rules: [ { test: /\.js$/, loader: 'babel-loader', include: resolve('source'), exclude: resolve('node_modules'), options: { presets: ['@babel/preset-env'], plugins: ['@babel/plugin-transform-runtime'], }, }, ], }, stats: 'errors-only', output: { filename: '[name].min.js', }, }) .pipe(uglify()) .pipe(dest(jsPath)) }) task('zip', () => { const target = ['./source/**', './template/**', './mail_template/**', './*.ftl', './*.yaml', 'README.md', 'screenshot.png', 'LICENSE'] return src(target, {base: '.'}) .pipe(zip('halo-theme-dream.zip')) .pipe(dest(distPath)) }) task('publish', (done) => { // 需要将tag标签内容置为 latest process.env.npm_config_tag = 'latest' console.log(execSync('npm publish').toString()) done() }) // 默认模式 task('default', series('clean', parallel('css', 'js'), 'zip')) // release模式,需要使用--tag参数指定版本号 task('release', series('clean', 'version', parallel('css', 'js'), 'zip')) // push模式,需要使用--tag参数指定版本号 task('push', series('clean', 'version', parallel('css', 'js'), 'zip', 'publish')) ================================================ FILE: index.ftl ================================================ <#include "template/layout.ftl"> <#global is_first_index=(posts.number == 0) > <#macro model_build option> <#if !option??> <#return> <#local tag=((option.tag!'')?trim != '')?then('
    ${option.tag?trim}
    ', '')> <#local title=((option.title!'')?trim != '')?then('
    ${option.title?trim}
    ', '')> <#local target=((option.target!'')?trim != '')?then(' target="${option.target?trim}"', ' target="_blank"')> <#local imageUrl=((option.image!'')?trim != '')?then(' style="background-image: url(${option.image?trim})"', '')> <#local targetUrl=((option.url!'')?trim != '')?then(' href="${option.url?trim}"', '')> ${title}${tag} <@layout title="${blog_title!}" canonical="${blog_url!}"> <#if posts.content?? && posts.content?size gt 0> <#if is_first_index!false> <#assign carousel_content> <#list posts.content as post> <#if post.topPriority!=1> <#break> <#if !post.metas?? || (post.metas.index_carousel!'false')=='false'> <#continue> <#assign thumbnail = (post.thumbnail?? && post.thumbnail!='')?then(post.thumbnail!, (settings.default_thumbnail?? && settings.default_thumbnail!='')?then(settings.default_thumbnail + settings.default_thumbnail?contains('?')?then("&","?") + "postId=" + post.id?c, ''))> <#if thumbnail != ''>

    ${post.title!}

    <#if settings.sidebar_column=='module-left' || settings.sidebar_column=='module-right'>
    ${carousel_content}
    <#if settings.module_options?? && settings.module_options?size > 0> <#list 0..1 as i> <#if i < settings.module_options?size > <@model_build settings.module_options[i]/> <#else> <#list 0..1 as i> <#if i < posts.content?size > <#assign postOption=posts.content[i]> <@model_build {"tag": "推荐", "title": "${postOption.title!}", "url": "${postOption.fullPath}", "image": "${postOption.thumbnail}", "target": "_self"}/>
    <#if settings.module_options?? && settings.module_options?size > 2 && settings.module_options?size<=6>
    <#list 2..5 as i> <#if i < settings.module_options?size > <@model_build settings.module_options[i]/>
    <#assign is_carousel=true /> <#elseif carousel_content != ''>
    ${carousel_content}
    <#assign is_carousel=true /> <#if settings.index_inform?? && settings.index_inform != ''>
    ${settings.index_inform}
    <#include "template/main/article_list.ftl"> <@article_list posts.content/> <#include "template/main/pagination.ftl"> <@pagination method="index" datas=posts display="${settings.page_number!5}" /> <#else>
    还没有发表过文章
    ================================================ FILE: journals.ftl ================================================ <#include "template/layout.ftl"> <#include "template/main/comment.ftl"> <@layout title="${journals_title!'动态'} - ${blog_title!}" canonical="${journals_url!}"> <#if journals.content?? && journals.content?size gt 0> <#list journals.content as journal>

    ${journal.createTime?string('yyyy年MM月dd日 HH:mm:ss')}

    ${journal.content}
    <#if enable_comment> <#if journal.commentCount==0>评论<#else>${journal.commentCount} <#if enable_share>
    <#if enable_comment>
    <@comment journal.id?c, "journal" />
    <#include "template/main/pagination.ftl"> <@pagination method="journals" datas=journals display="${settings.page_number!5}" /> <#else>
    还没有发表过动态,回主页看看吧
    ================================================ FILE: links.ftl ================================================ <#include "template/layout.ftl"> <@layout title="${links_title!'友情链接'} - ${blog_title!}" canonical="${links_url!}">
    <#if settings.links_thumbnail?? && settings.links_thumbnail!=''>

    ${links_title!'友情链接'} - ${user.nickname!}的小伙伴们

    <@linkTag method="listTeams"> <#assign defaultAvatar= (settings.links_default_avatar?? && settings.links_default_avatar!='')?string(settings.links_default_avatar!, static + "/source/img/avatar.svg") /> <#list teams as item> <#if (settings.show_exchange_info!true) || (settings.links_info?? && settings.links_info != '')>
    <#if settings.show_exchange_info!true> 申请友链的方法: <#assign bloggerAvatar= (settings.links_blogger_avatar?? && settings.links_blogger_avatar!='')?string(settings.links_blogger_avatar!, user.avatar!) />
    ${settings.links_info!}
    <#if enable_comment>

    评论

    <#include "template/main/comment.ftl"> <@comment settings.link_comment_id, "sheet" />
    ================================================ FILE: mail_template/mail_notice.ftl ================================================ <#assign emojis={'呵呵':'hehe','哈哈':'haha','吐舌':'tushe','啊':'a','酷':'ku','怒':'nu','开心':'kaixin','汗':'han','泪':'lei','黑线':'heixian','鄙视':'bishi','不高兴':'bugaoxing','真棒':'zhenbang','钱':'qian','疑问':'yiwen','阴险':'yingxiang','吐':'tu','咦':'yi','委屈':'weiqu','花心':'huaxin','呼~':'hu','笑眼':'xiaoyan','冷':'len','太开心':'taikaixin','滑稽':'huaji','勉强':'mianqiang','狂汗':'kuanhan','乖':'guai','睡觉':'shuijiao','惊哭':'jingku','生气':'shengqi','惊讶':'jingya','喷':'pen','突然兴奋':'turanxingfen','挖鼻':'wabi','摊手':'tanshou','捂嘴笑':'wuzuixiao','喝酒':'hejiu','犀利':'xili','懒得理':'landeli','炸药':'zhayao','吃瓜':'chigua','小乖':'xiaoguai','你懂的':'nidongde','嘿嘿嘿':'heiheihei','欢呼':'huanhu','笑尿':'xiaoniao','酸爽':'suanshuang','紧张':'jinzhang','暗中观察':'anzhongguancha','小红脸':'xiaohonglian','呀咩爹':'yamiedie','微微一笑':'weiweiyixiao','what':'what','托腮':'tuosai','噗':'pu','困成狗':'kunchenggou','柯基暗中观察':'kejianzhongguancha','菜狗':'caigou','老虎':'laohu','嗷呜':'aowu','奥特曼':'aoteman','黑头高兴':'heitougaoxing','黑头瞪眼':'heitoudengyan','望远镜':'wangyuanjing','不听':'butin','干饭':'ganfan','大拇指':'damuzhi','胜利':'shengli','haha':'haha2','OK':'ok','红领巾':'honglingjin','爱心':'aixin','心碎':'xinsui','玫瑰':'meigui','礼物':'liwu','烟花':'yanhua','彩虹':'caihong','太阳':'taiyang','星星月亮':'xingxingyueliang','蛋糕':'dangao','茶杯':'chabei','香蕉':'xiangjiao','便便':'bianbian','药丸':'yaowan','钱币':'qianbi','蜡烛':'lazhu','沙发':'shafa','音乐':'yinyue','灯泡':'dengpao','手纸':'shouzhi'}> <#function rendered_html content> <#local content=content?replace('\\!\\[([^\\]]*)\\]\\(([^\\)]*)\\)', '$1', 'ri')> <#local content=content?replace('\\[([^\\]]*)\\]\\(([^\\)]*)\\)', '$1', 'ri')> <#local content=content?replace('^#+\\s+([^\\n]*)', '

    $1

    ', 'rmi')> <#local content=content?replace('```\\w*\\n([^`]*)\\n```', '
    $1
    ', 'ri')> <#local content=content?replace('`([^`]*)`', '$1', 'ri')> <#local content=content?replace('\\n+', '\n', 'ri')> <#list emojis?keys as key> <#local content=content?replace('\\[/${key}\\]','','ri')> <#return content>

    您的博客有新的评论啦!

    ================================================ FILE: mail_template/mail_reply.ftl ================================================ <#assign emojis={'呵呵':'hehe','哈哈':'haha','吐舌':'tushe','啊':'a','酷':'ku','怒':'nu','开心':'kaixin','汗':'han','泪':'lei','黑线':'heixian','鄙视':'bishi','不高兴':'bugaoxing','真棒':'zhenbang','钱':'qian','疑问':'yiwen','阴险':'yingxiang','吐':'tu','咦':'yi','委屈':'weiqu','花心':'huaxin','呼~':'hu','笑眼':'xiaoyan','冷':'len','太开心':'taikaixin','滑稽':'huaji','勉强':'mianqiang','狂汗':'kuanhan','乖':'guai','睡觉':'shuijiao','惊哭':'jingku','生气':'shengqi','惊讶':'jingya','喷':'pen','突然兴奋':'turanxingfen','挖鼻':'wabi','摊手':'tanshou','捂嘴笑':'wuzuixiao','喝酒':'hejiu','犀利':'xili','懒得理':'landeli','炸药':'zhayao','吃瓜':'chigua','小乖':'xiaoguai','你懂的':'nidongde','嘿嘿嘿':'heiheihei','欢呼':'huanhu','笑尿':'xiaoniao','酸爽':'suanshuang','紧张':'jinzhang','暗中观察':'anzhongguancha','小红脸':'xiaohonglian','呀咩爹':'yamiedie','微微一笑':'weiweiyixiao','what':'what','托腮':'tuosai','噗':'pu','困成狗':'kunchenggou','柯基暗中观察':'kejianzhongguancha','菜狗':'caigou','老虎':'laohu','嗷呜':'aowu','奥特曼':'aoteman','黑头高兴':'heitougaoxing','黑头瞪眼':'heitoudengyan','望远镜':'wangyuanjing','不听':'butin','干饭':'ganfan','大拇指':'damuzhi','胜利':'shengli','haha':'haha2','OK':'ok','红领巾':'honglingjin','爱心':'aixin','心碎':'xinsui','玫瑰':'meigui','礼物':'liwu','烟花':'yanhua','彩虹':'caihong','太阳':'taiyang','星星月亮':'xingxingyueliang','蛋糕':'dangao','茶杯':'chabei','香蕉':'xiangjiao','便便':'bianbian','药丸':'yaowan','钱币':'qianbi','蜡烛':'lazhu','沙发':'shafa','音乐':'yinyue','灯泡':'dengpao','手纸':'shouzhi'}> <#function rendered_html content> <#local content=content?replace('\\!\\[([^\\]]*)\\]\\(([^\\)]*)\\)', '$1', 'ri')> <#local content=content?replace('\\[([^\\]]*)\\]\\(([^\\)]*)\\)', '$1', 'ri')> <#local content=content?replace('^#+\\s+([^\\n]*)', '

    $1

    ', 'rmi')> <#local content=content?replace('```\\w*\\n([^`]*)\\n```', '
    $1
    ', 'ri')> <#local content=content?replace('`([^`]*)`', '$1', 'ri')> <#local content=content?replace('\\n+', '\n', 'ri')> <#list emojis?keys as key> <#local content=content?replace('\\[/${key}\\]','','ri')> <#return content>

    Dear, 您在 ${blog_title!} 上的评论有新的回复啦!

    ================================================ FILE: package.json ================================================ { "name": "halo-theme-dream", "version": "3.2.4", "description": "梦之城,童话梦境,动漫类型博客主题。", "main": "index.js", "author": "nineya", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "release": "eslint **/*.js && gulp release", "push": "eslint **/*.js && gulp push", "zip": "gulp zip", "build": "eslint **/*.js && gulp", "lint": "eslint **/*.js" }, "repository": { "type": "git", "url": "git+https://github.com/nineya/halo-theme-dream.git" }, "keywords": [ "halo", "dream", "nineya", "halo-theme", "halo-theme-dream" ], "license": "MIT", "bugs": { "url": "https://github.com/nineya/halo-theme-dream/issues" }, "homepage": "https://github.com/nineya/halo-theme-dream#readme", "devDependencies": { "@babel/core": "^7.15.5", "@babel/plugin-transform-runtime": "^7.15.0", "@babel/preset-env": "^7.15.6", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.3", "eslint": "^7.32.0", "gulp": "^4.0.2", "gulp-autoprefixer": "^8.0.0", "gulp-babel": "^8.0.0", "gulp-clean": "^0.4.0", "gulp-csso": "^4.0.1", "gulp-gzip": "^1.4.2", "gulp-less": "^5.0.0", "gulp-rename": "^2.0.0", "gulp-uglify": "^3.0.2", "gulp-zip": "^5.1.0", "webpack": "^5.68.0", "webpack-stream": "^7.0.0" }, "dependencies": { "html2canvas": "^1.4.1", "qrcode": "^1.5.1" } } ================================================ FILE: photos.ftl ================================================ <#include "template/layout.ftl"> <@layout title="${photos_title!'我的相册'} - ${blog_title!}" canonical="${photos_url!}"> <#if (photos.content)?? && photos.content?size gt 0>
    ${photos_title!'我的相册'}
    <#else>
    内容为空,回主页看看吧
    ================================================ FILE: post.ftl ================================================ <#include "template/layout.ftl"> <#include "template/main/article.ftl"> <@layout title="${post.title!} - ${blog_title!}" canonical="${post.fullPath!}"> <@article post,"post" /> ================================================ FILE: post_literature.ftl ================================================ <#include "template/layout.ftl"> <#include "template/main/article_literature.ftl"> <@layout title="${post.title!} - ${blog_title!}" canonical="${post.fullPath!}"> <@articleLiterature post,"post" /> ================================================ FILE: post_password.ftl ================================================ <#include "template/layout.ftl"> <#include "template/main/article.ftl"> <@layout title="私密内容访问 - ${blog_title!}" canonical="${blog_url!}">

    私密内容访问

    ${errorMsg!}
    ================================================ FILE: search.ftl ================================================ <#include "template/layout.ftl"> <@layout title="搜索:${keyword} - ${blog_title!}" canonical="${blog_url!}/search?keyword=${keyword}"> <#if (posts.content)?? && posts.content?size gt 0> <#include "template/main/article_list.ftl"> <@article_list posts.content/> <#include "template/main/pagination.ftl"> <@pagination method="search" datas=posts keyword="${keyword!}" display="${settings.page_number!5}" /> <#else>
    搜索结果为空,回主页看看吧
    ================================================ FILE: settings.yaml ================================================ basic_info: label: '基础信息' items: access_key: name: access_key label: '<必填> AccessKey' type: text default: dream placeholder: '请输入 Access Key' description: "需在博客 高级设置 中开启 API 服务,并使此处的 Access KeyAPI 设置中的保持一致。
    注:Access Key 用于主题中 Content API 校验,填写有误将导致接口报错。" small_title: name: small_title label: 网站副标题 type: text placeholder: '请输入网站副标题' document_hidden_title: name: document_hidden_title label: 离屏文案(离开) type: text placeholder: '请输入标题' description: '浏览器切换到其它标签或后台时页面标题展示的文字。' document_visible_title: name: document_visible_title label: 离屏文案(回来) type: text placeholder: '请输入标题' description: '浏览器返回到当前标签时页面标题展示的文字。' index_inform: name: index_inform label: 首页通知 type: text placeholder: 请输入通知内容 description: '在首页显示一条通知。' copy_explain: name: copy_explain label: 拷贝说明 type: textarea placeholder: 请输入说明内容 description: '当用户拷贝文本时,自动将该文本内容追加到最后面。' night_logo: name: night_logo label: '黑暗模式 Logo' type: attachment placeholder: '请输入/选择 Logo 路径' description: '在黑暗模式时显示的 Logo,放空默认为网站 Logo。' page_number: name: page_number label: 分页页码数量 type: number placeholder: '请输入数量数值' default: '5' record_number: name: record_number label: 备案号 type: text placeholder: 'XICP备XXXXXXXXXX号-X' record_number_ps: name: record_number_ps label: 公安部备案 type: text placeholder: 'X公网安备 XXXXXXXXXXXXXX号' website_time: name: website_time label: 建站时间 type: text placeholder: 'YYYY/MM/dd HH:mm:ss' description: '按 YYYY/MM/dd HH:mm:ss 格式输入时间进行倒计时,非时间格式则直接显示文本。' cloud_by_logo: name: cloud_by_logo label: '云服务提供商 Logo' type: attachment placeholder: '请输入/选择 Logo 路径' cloud_by_url: name: cloud_by_url label: '云服务提供商 URL' type: text placeholder: '请输入链接地址' basic_style: label: 基础样式 items: load_progress: name: load_progress label: 加载进度条 type: radio default: center options: - value: none label: 不显示 - value: left label: 左侧展开 - value: center label: 居中展开 drawer_toc: name: drawer_toc label: 侧边抽屉式目录 type: radio data-type: bool default: true description: "在非桌面设备上,显示展开侧边抽屉式目录的悬浮按钮。" options: - value: true label: 显示 - value: false label: 不显示 enable_image_bg: name: enable_image_bg label: 开启博客背景图 type: switch data-type: bool default: false description: '如果某个选项的背景图链接未指定,则不开启那个选项的背景图。' options: - value: true label: 开启 - value: false label: 关闭 background_pc: name: background_pc label: '明亮模式 PC 端背景图' type: attachment placeholder: '请输入/选择图片路径' background_mobile: name: background_mobile label: 明亮模式移动端背景图 type: attachment placeholder: '请输入/选择图片路径' night_background_pc: name: night_background_pc label: '黑暗模式 PC 端背景图' type: attachment placeholder: '请输入/选择图片路径' night_background_mobile: name: night_background_mobile label: 黑暗模式移动端背景图 type: attachment placeholder: '请输入/选择图片路径' enable_banner: name: enable_banner label: 开启博客横幅大图 type: switch data-type: bool default: false options: - value: true label: 开启 - value: false label: 关闭 banner_image: name: banner_image label: 横幅背景图 type: attachment placeholder: '请输入/选择图片路径' banner_description: name: banner_description label: 横幅文字描述 type: text placeholder: '请输入描述内容' theme_style: name: theme_style label: 主题风格 type: select default: 'default' description: '主题风格效果,不改变主题整体框架。' options: - value: 'default' label: 默认 - value: 'clean' label: 清爽 - value: 'celebration' label: 庆典 default_theme: name: default_theme label: 默认主题模式 type: select default: 'light' description: '未打开过博客的浏览器,首次打开博客时的默认主题模式。' options: - value: 'light' label: 明亮模式 - value: 'night' label: 黑暗模式 - value: 'system' label: 跟随系统 theme_color: name: theme_color label: 明亮模式主题色 type: color default: '#50bfff' night_theme_color: name: night_theme_color label: 黑暗模式主题色 type: color default: '#5d93db' web_font: name: web_font label: 博客字体 type: select default: 'default' options: - value: 'default' label: 默认字体 - value: 'WenCang.woff2' label: 问藏书房体 - value: 'AlimamaDaoLiTi.woff2' label: 阿里巴巴刀隶体 - value: 'custom' label: 自定义 custom_font: name: custom_font label: 自定义博客字体 type: attachment placeholder: '请输入/选择字体路径' description: '自定义博客字体,在 博客字体 选项为 自定义 时生效。支持 woff2/woff/ttf/eot/svg 格式的字体文件链接,建议使用 woff2 格式。' sidebar_column: name: sidebar_column label: 博客布局方式 type: select default: 'all' options: - value: 'all' label: 三列布局 - value: 'only-left' label: 仅显示左侧 - value: 'only-right' label: 仅显示右侧 - value: 'module-left' label: 模块化(左侧) - value: 'module-right' label: 模块化(右侧) left_sidebar_sticky: name: left_sidebar_sticky label: 左侧边栏悬浮 type: radio default: bottom options: - value: top label: 固定顶部 - value: bottom label: 固定底部 - value: none label: 不悬浮 right_sidebar_sticky: name: right_sidebar_sticky label: 右侧边栏悬浮 type: radio default: top options: - value: top label: 固定顶部 - value: bottom label: 固定底部 - value: none label: 不悬浮 module_options: name: module_options label: 模块化布局链接 type: repeater description: '可填写 1~6 个链接。' children: - name: tag label: 标签 type: text placeholder: '请输入标签内容' - name: title label: 标题 type: text placeholder: '请输入标题内容' - name: url label: 跳转地址 type: text placeholder: '请输入跳转地址' - name: image label: 背景图链接 type: attachment placeholder: '请输入图片地址' - name: target label: 打开方式 type: radio default: '_blank' options: - value: '_blank' label: 新窗口 - value: '_self' label: 原窗口 post: label: 文章设置 items: default_thumbnail: name: default_thumbnail label: 默认文章缩略图 type: attachment placeholder: '请输入/选择图片路径' description: "如果文章没有指定缩略图,则默认显示当前缩略图。" top_thumbnail_mode: name: top_thumbnail_mode label: 置顶文章列表缩略图模式 type: select default: back description: '置顶的文章在列表的缩略图模式,除网格布局外,如果文章元数据配置了 thumbnail_mode 项,则当前配置将被覆盖。
    注:设置网格布局后,非置顶文章也会变成网格布局。' options: - value: default label: 默认模式 - value: back label: 背景图模式 - value: small label: 小图模式(左侧) - value: small-right label: 小图模式(右侧) - value: small-alter label: 小图模式(交替) - value: fold label: 折叠模式 - value: grid label: 网格模式(强优先) thumbnail_mode: name: thumbnail_mode label: 文章列表缩略图模式 type: select default: default description: '文章列表缩略图模式,除网格布局外,如果文章元数据配置了 thumbnail_mode 项,则当前配置将被覆盖。' options: - value: default label: 默认模式 - value: back label: 背景图模式 - value: small label: 小图模式(左侧) - value: small-right label: 小图模式(右侧) - value: small-alter label: 小图模式(交替) - value: grid label: 网格模式(强优先) code_pretty: name: code_pretty label: 代码块高亮主题 type: select default: atom-one-light options: - value: a11y-dark label: A11y Dark - value: a11y-light label: A11y Light - value: agate label: Agate - value: an-old-hope label: An Old Hope - value: androidstudio label: Androidstudio - value: arduino-light label: Arduino Light - value: arta label: Arta - value: ascetic label: Ascetic - value: atom-one-dark label: Atom One Dark - value: atom-one-dark-reasonable label: Atom One Dark Reasonable - value: atom-one-light label: Atom One Light - value: brown-paper label: Brown Paper - value: brown-papersq label: Brown Papersq - value: codepen-embed label: Codepen Embed - value: color-brewer label: Color Brewer - value: dark label: Dark - value: default label: Default - value: devibeans label: Devibeans - value: docco label: Docco - value: far label: Far - value: foundation label: Foundation - value: github-dark-dimmed label: Github Dark Dimmed - value: github-dark label: Github Dark - value: github label: Github - value: gml label: Gml - value: googlecode label: Googlecode - value: gradient-dark label: Gradient Dark - value: gradient-light label: Gradient Light - value: grayscale label: Grayscale - value: hybrid label: Hybrid - value: idea label: Idea - value: ir-black label: Ir Black - value: isbl-editor-dark label: Isbl Editor Dark - value: isbl-editor-light label: Isbl Editor Light - value: kimbie-dark label: Kimbie Dark - value: kimbie-light label: Kimbie Light - value: lightfair label: Lightfair - value: lioshi label: Lioshi - value: magula label: Magula - value: mono-blue label: Mono Blue - value: monokai-sublime label: Monokai Sublime - value: monokai label: Monokai - value: night-owl label: Night Owl - value: nnfx-dark label: Nnfx dark - value: nnfx-light label: Nnfx Light - value: nord label: Nord - value: obsidian label: Obsidian - value: paraiso-dark label: Paraiso Dark - value: paraiso-light label: Paraiso Light - value: pojoaque label: Pojoaque - value: purebasic label: Purebasic - value: qtcreator-dark label: Qtcreator Dark - value: qtcreator-light label: Qtcreator Light - value: rainbow label: Rainbow - value: routeros label: Routeros - value: school-book label: School Book - value: shades-of-purple label: Shades Of Purple - value: srcery label: Srcery - value: stackoverflow-dark label: Stackoverflow Dark - value: stackoverflow-light label: Stackoverflow Light - value: sunburst label: Sunburst - value: tomorrow-night-blue label: Tomorrow Night Blue - value: tomorrow-night-bright label: Tomorrow Night Bright - value: vs label: Vs - value: vs2015 label: Vs 2015 - value: xcode label: Xcode - value: xt256 label: Xt 256 code_fold_line: name: code_fold_line label: 代码块折叠 type: number placeholder: '请输入代码行数数值' description: '代码行数超出指定行数后默认进行折叠,指定的行数需大于等于 20。' img_fold_height: name: img_fold_height label: 正文长图折叠 type: number placeholder: '请输入高度数值(px)' description: '图片高度超出指定高度(px)后默认进行折叠,指定的高度需大于等于 400px。' show_img_name: name: show_img_name label: 显示图片名称 type: radio data-type: bool default: true options: - value: true label: 开启 - value: false label: 关闭 invalid_tips_day: name: invalid_tips_day label: 文章失效提示 type: number default: 99999999 placeholder: '请输入时间(天)' description: '文章超过指定天数未进行更新,展示文章或图片可能失效的温馨提示。' enable_katex: name: enable_katex label: KaTeX 公式支持 type: radio data-type: bool default: false description: '博客通过 KaTeX 做数学公式渲染,如果文章或页面元数据配置了 enable_katex 项,则当前配置将被覆盖。' options: - value: true label: 默认开启 - value: false label: 默认关闭 enable_copyright: name: enable_copyright label: 开启文章版权声明 type: radio data-type: bool default: true description: '如果文章或页面元数据配置了 enable_copyright 项,则当前配置将被覆盖。' options: - value: true label: 默认开启 - value: false label: 默认关闭 enable_post_share: name: enable_post_share label: 开启文章分享 type: radio data-type: bool default: true description: '如果文章或页面元数据配置了 enable_share 项,则当前配置将被覆盖。' options: - value: true label: 默认开启 - value: false label: 默认关闭 enable_post_donate: name: enable_post_donate label: 开启文章打赏 type: radio data-type: bool default: true description: '如果文章或页面元数据配置了 enable_donate 项,则当前配置将被覆盖。' options: - value: true label: 默认开启 - value: false label: 默认关闭 donate_alipay: name: donate_alipay label: 支付宝捐赠二维码 type: attachment placeholder: '请输入/选择图片路径' donate_wechat: name: donate_wechat label: 微信捐赠二维码 type: attachment placeholder: '请输入/选择图片路径' comment: label: 评论区 items: enable_comment: name: enable_comment label: 开启评论功能 type: switch data-type: bool default: true description: "如果在进行网站备案,可通过此功能全局关闭评论区。" options: - value: true label: 开启 - value: false label: 关闭 enable_theme_comment: name: enable_theme_comment label: 启用主题内置评论区 type: switch data-type: bool default: true description: '开启后将使用主题内置的评论区模块,如果使用其他评论区模块以下评论区相关的配置可能不生效。' options: - value: true label: 开启 - value: false label: 关闭 anonymous_user_name: name: anonymous_user_name label: 匿名用户名 type: text placeholder: '请输入用户名' description: '填写后将允许用户匿名评论,并使用此名称做用户名。' avatar_loading: name: avatar_loading label: 头像加载动画 type: attachment placeholder: '请输入/选择图片路径' description: '加载用户头像时的加载动画。' default_avatar: name: default_avatar label: 默认评论头像 type: attachment placeholder: '请输入/选择图片路径' description: '如果用户头像加载失败,则显示默认头像。' enable_qq_info: name: enable_qq_info label: '获取 QQ 昵称和邮箱' type: switch data-type: bool default: false description: '评论时,访客在用户名处输入 QQ 号,自动通过 QQ 获取昵称和邮箱。' options: - value: true label: 开启 - value: false label: 关闭 priority_qq_avatar: name: priority_qq_avatar label: '优先显示 QQ 头像' type: switch data-type: bool default: false description: '如果是 QQ 邮箱,则优先使用 QQ 头像。' options: - value: true label: 开启 - value: false label: 关闭 enable_image_upload: name: enable_image_upload label: 开启图片上传 type: switch data-type: bool description: '开启评论区内置的图片上传功能。' default: false options: - value: true label: 开启 - value: false label: 关闭 image_upload_api: name: image_upload_api label: '图片上传 API' type: text placeholder: '请输入 API 地址' description: '评论区支持快捷上传图片到指定的 API 接口,搭建 API 规范要求见文档 halo-comment-dream。' enable_blogger_operation: name: enable_blogger_operation label: 开启博主操作 type: switch description: '如果在该浏览器博主已登录,允许博主直接在评论区上进行操作。' data-type: bool default: true options: - value: true label: 开启 - value: false label: 关闭 autoload_comment: name: autoload_comment label: 自动加载评论列表 type: switch data-type: bool default: true options: - value: true label: 开启 - value: false label: 关闭 comment_loading_style: name: comment_loading_style label: 评论加载样式 type: radio data-type: text default: default options: - value: default label: 默认 - value: circle label: 圆圈 - value: balls label: 小球 reply_desc_soft: name: reply_desc_soft label: 二级回复列表按时间降序 type: switch data-type: bool description: '评论中的二级回复列表按回复时间降序排序(默认为升序)。' default: false options: - value: true label: 开启 - value: false label: 关闭 unfold_reply_num: name: unfold_reply_num label: 默认展开的二级回复数量 type: number default: 6 placeholder: '请输入数量数值' show_comment_ua: name: show_comment_ua label: 显示评论的 UA 信息 type: switch data-type: bool default: true options: - value: true label: 开启 - value: false label: 关闭 enable_bullet_screen: name: enable_bullet_screen label: 开启评论弹幕 type: radio data-type: bool default: false description: '如果文章或页面元数据配置了 enable_bullet_screen 项,则当前配置将被覆盖。' options: - value: true label: 默认开启 - value: false label: 默认关闭 enable_comment_html: name: enable_comment_html label: '开启评论 HTML 内容' type: switch data-type: bool default: false description: '允许评论输入 HTML 内容,开启后有 用户注入恶意代码的风险(XSS),建议同时开启评论审核。' options: - value: true label: 开启 - value: false label: 关闭 sidebar_show: label: 侧边栏显示 items: sidebar_show: name: sidebar_show label: 侧边栏显示 type: repeater description: '配置主题左右侧边栏显示位置和顺序。三列布局时音乐模块不能在右侧显示。' default: - type: profile location: left hide: 'is-not-hidden' - type: toc location: right hide: 'is-hidden-not-desktop' - type: notice location: right hide: 'is-not-hidden' - type: recent_posts location: right hide: 'is-not-hidden' - type: recent_comments location: right hide: 'is-not-hidden' - type: categories location: left hide: 'is-not-hidden' - type: tags location: left hide: 'is-not-hidden' - type: links location: right hide: 'is-hidden-not-desktop' children: - name: type type: select label: 模块类型 default: profile options: - value: profile label: 信息模块 - value: toc label: 目录模块 - value: notice label: 公告模块 - value: love label: 恋爱墙模块 - value: music label: 音乐模块 - value: ad_piece label: 广告模块 - value: recent_posts label: 最近文章模块 - value: recent_comments label: 最近评论模块 - value: categories label: 文章分类模块 - value: tags label: 文章标签模块 - value: tagcloud label: 文章标签云模块 - value: links label: 友链模块 - value: custom label: 自定义模块 - name: location label: 模块位置 type: radio default: none options: - value: left label: 左侧 - value: right label: 右侧 - value: none label: 关闭 - name: hide label: 隐藏方式 type: select default: 'is-not-hidden' options: - value: 'is-hidden-mobile' label: 移动设备隐藏 - value: 'is-hidden-not-desktop' label: 移动、平板设备隐藏 - value: 'is-hidden-desktop' label: 桌面设备隐藏 - value: 'is-not-hidden' label: 不隐藏 - name: title label: 侧边栏标题 type: text placeholder: 请输入标题内容 description: "非必填,可覆盖默认侧边栏标题。" - name: icon label: 侧边栏图标 type: text placeholder: 请输入图标 class 内容 description: "非必填,可覆盖默认侧边栏图标。" - name: content label: 侧边栏内容 type: textarea placeholder: 请输入 HTML 内容 description: "非必填,仅在侧边栏类型为自定义时生效。" sidebar_config: label: 侧边栏配置 items: enable_color_character: name: enable_color_character label: 侧边栏信息-开启彩字切换 type: switch data-type: bool default: false options: - value: true label: 开启 - value: false label: 关闭 color_character: name: color_character label: 侧边栏信息-彩字内容 type: textarea placeholder: 请输入彩字内容 description: "按行输入彩字消息内容,一行一条。" profile_location: name: profile_location label: 侧边栏信息-地理位置 type: text placeholder: '请输入个人所在地' profile_theme_button: name: profile_theme_button label: 侧边栏信息-主题按钮 type: text placeholder: '按钮名称|按钮地址' description: '需要 按钮名称按钮地址 两个参数,参数间用 “|” 分隔,放空则不显示主题按钮。' social_github: name: social_github label: 侧边栏信息-Github type: text placeholder: '请输入 Github 用户名' social_qq: name: social_qq label: 侧边栏信息-QQ type: text placeholder: '请输入 QQ 号' social_weibo: name: social_weibo label: 侧边栏信息-微博 type: text placeholder: '请输入微博用户名' social_twitter: name: social_twitter label: 侧边栏信息-Twitter type: text placeholder: '请输入 Twitter 用户名' social_facebook: name: social_facebook label: 侧边栏信息-Facebook type: text placeholder: '请输入 Facebook 用户名' social_email: name: social_email label: '侧边栏信息-邮箱' type: text placeholder: '请输入邮箱地址' social_telegram: name: social_telegram label: 侧边栏信息-Telegram type: text placeholder: '请输入 Telegram 用户名' social_rss: name: social_rss label: '侧边栏信息-RSS 订阅' type: select data-type: bool default: true options: - value: true label: 开启 - value: false label: 关闭 custom_social_options: name: custom_social_options label: 侧边栏信息-自定义社交渠道选项 type: textarea placeholder: "名称|图标|链接地址" description: 一行表示一个社交渠道,每个社交渠道需要名称、图标和链接地址三个参数,参数之间使用 “|” 分隔,主题内置图标采用 RemixIcon 3.5.0'。 notice_content: name: notice_content label: 侧边栏公告-博客公告 type: textarea placeholder: 请输入公告内容 description: 公告内容支持 HTML 标签。 notice_show_mode: name: notice_show_mode label: 侧边栏公告-显示模式 type: radio default: index description: 当满足指定的条件时公告模块才会显示。 options: - value: none label: 无条件 - value: toc label: 目录模块不显示时 - value: index label: 仅首页 love_oneself_avatar: name: love_oneself_avatar label: 侧边栏恋爱墙-自己的头像 type: attachment placeholder: '请输入/选择图片路径' love_oneself_url: name: love_oneself_url label: 侧边栏恋爱墙-自己的主页 type: text placeholder: '请输入个人主页地址' love_opposite_avatar: name: love_opposite_avatar label: 侧边栏恋爱墙-对方的头像 type: attachment placeholder: '请输入/选择图片路径' love_opposite_url: name: love_opposite_url label: 侧边栏恋爱墙-对方的主页 type: text placeholder: '请输入个人主页地址' love_time: name: love_time label: 侧边栏恋爱墙-恋爱时间 type: text placeholder: 'YYYY/MM/dd HH:mm:ss' description: '按 YYYY/MM/dd HH:mm:ss 格式输入时间进行倒计时,非时间格式则直接显示文本。' meting_api: name: meting_api label: 侧边栏音乐-自建API type: text placeholder: '请输入 API 地址' description: '自建 API 方法见文档:Meting。' music_mode: name: music_mode label: 侧边栏音乐-音乐播放器配置方式 type: radio default: 'playlist' options: - value: 'playlist' label: '网易云歌单 ID' - value: 'config' label: 参数进阶配置 netease_playlist_id: name: netease_playlist_id label: '侧边栏音乐-网易云歌单 ID' type: text placeholder: '请输入歌单 ID' description: '填写网易云歌单的 ID。' music_config: name: music_config label: 侧边栏音乐-参数进阶配置 type: code placeholder: '请输入音乐参数配置' default: |- list-folded="true" server="netease" type="playlist" id="7355014621" description: '输入音乐参数配置(id / server / type必填),详细配置方式见官方文档:MetingJS 2.0。' show_ad_tag: name: show_ad_tag label: 侧边栏广告-显示“广告”标签 type: radio data-type: bool default: true options: - value: true label: 显示 - value: false label: 不显示 ad_tag_close: name: ad_tag_close label: 侧边栏广告-点击“广告”标签可关闭广告 type: radio data-type: bool default: true options: - value: true label: 是 - value: false label: 否 ad_mode: name: ad_mode label: 侧边栏广告-广告展示方法 type: radio data-type: bool default: true options: - value: true label: 图片+链接 - value: false label: 自定义广告代码 ad_target_url: name: ad_target_url label: 侧边栏广告-广告目标地址 type: text placeholder: '请输入链接地址' description: '填写广告跳转的目标路径。' ad_image: name: ad_image label: 侧边栏广告-广告图片链接 type: attachment placeholder: '请输入/选择图片路径' description: '图片+链接 模式时不能为空。' ad_custom_code: name: ad_custom_code label: 侧边栏广告-自定义广告代码 type: code placeholder: '请输入广告代码' description: '在这里黏贴广告联盟提供的广告代码,自定义广告代码 模式时不能为空。' recent_posts_num: name: recent_posts_num label: 侧边栏最近文章-展示文章数量 type: number placeholder: 请输入数量数值 default: 5 recent_comments_num: name: recent_comments_num label: 侧边栏最近评论-展示评论数量 type: number placeholder: 请输入数量数值 default: 5 categories_more: name: categories_more label: 侧边栏分类-显示”更多”按钮 type: radio data-type: bool default: true description: '超出展示的分类数量后是否显示 更多 按钮。' options: - value: true label: 显示 - value: false label: 不显示 categories_num: name: categories_num label: 侧边栏分类-展示分类数量 type: number placeholder: 请输入数量数值 default: 10 tags_more: name: tags_more label: 侧边栏标签-显示”更多”按钮 type: radio data-type: bool default: true description: '超出展示的标签数量后是否显示 更多 按钮。' options: - value: true label: 显示 - value: false label: 不显示 tags_num: name: tags_num label: 侧边栏标签-展示标签数量 type: number placeholder: 请输入数量数值 default: 18 enable_tags_color: name: enable_tag_color label: 侧边栏标签-开启标签颜色 type: switch data-type: bool default: false options: - value: true label: 开启 - value: false label: 关闭 tagcloud_more: name: tagcloud_more label: 侧边栏标签云-显示”更多”按钮 type: radio data-type: bool default: true description: '超出展示的标签数量后是否显示 更多 按钮。' options: - value: true label: 显示 - value: false label: 不显示 tagcloud_num: name: tagcloud_num label: 侧边栏标签云-展示标签数量 type: number placeholder: 请输入数量数值 default: 32 enable_tagcloud_color: name: enable_tagcloud_color label: 侧边栏标签云-开启标签颜色 type: switch data-type: bool default: false options: - value: true label: 开启 - value: false label: 关闭 links_more: name: links_more label: 侧边栏友链-显示”更多”按钮 type: radio data-type: bool default: true description: '超出展示的友链数量后是否显示 更多 按钮。' options: - value: true label: 显示 - value: false label: 不显示 links_num: name: links_num label: 侧边栏友链-展示友链数量 type: number placeholder: 请输入数量数值 default: 10 page_config: label: 页面设置 items: links_thumbnail: name: links_thumbnail label: 友链页面-缩略图 type: attachment placeholder: '请输入/选择图片路径' links_default_avatar: name: links_default_avatar label: '友链页面-默认 Logo' type: attachment placeholder: '请输入/选择 Logo 路径' description: "在加载用户 Logo 时、友链未设置 Logo 时、友链 Logo 加载失败时显示。" show_exchange_info: name: show_exchange_info label: 友链页面-显示友链交换信息 type: switch data-type: bool default: true options: - value: true label: 显示 - value: false label: 关闭 links_blogger_avatar: name: links_blogger_avatar label: '友链页面-交换信息自定义 Logo 链接' type: attachment placeholder: '请输入/选择 Logo 路径' description: '用于交换友链的 Logo 链接。' links_info: name: links_info label: 友链页面-补充信息 type: textarea placeholder: '请输入补充信息' description: '友链页面最低部的补充说明信息,支持 HTML 格式。' link_comment_id: name: link_comment_id label: 友链页面-评论区ID type: number placeholder: '请输入 ID' description: '友链页面没有 ID,需要指定一个自定义页面的 ID 用于评论,被指定的文章评论区将作为友链的评论区, 放空则不显示评论区。 ' journals_fold_height: name: journals_fold_height label: 日志页面-动态内容折叠 type: number placeholder: '请输入高度数值(px)' description: '动态内容高度超出指定高度后默认进行折叠,指定的高度需大于等于 260px。' enable_journals_comment: name: enable_journals_comment label: 日志页面-开启评论区 type: switch data-type: bool default: true options: - value: true label: 开启 - value: false label: 关闭 enable_journals_share: name: enable_journals_share label: 日志页面-开启日志分享 type: switch data-type: bool default: true options: - value: true label: 开启 - value: false label: 关闭 journals_share_image: name: journals_share_image label: 日志页面-日志分享背景图 type: attachment placeholder: '请输入/选择图片路径' enable_tags_tag_color: name: enable_tags_tag_color label: 标签页面-开启标签颜色 type: switch data-type: bool default: false options: - value: true label: 开启 - value: false label: 关闭 live2d: label: 看板娘 items: enable_live2d: name: enable_live2d label: 启用看板娘 type: switch data-type: bool default: true options: - value: true label: 开启 - value: false label: 关闭 live2d_model_url: name: live2d_model_url label: 模型地址 type: text default: 'https://unpkg.com/live2d-widget-model@1.0.1/' placeholder: '请输入 API 地址' description: "Live2D 模型 API 地址,可直接克隆 live2d-widget-model 模型仓库实现自建地址。" live2d_tips_url: name: live2d_tips_url label: 自定义提示语文件地址 type: attachment placeholder: '请输入/选择文件地址' description: '提示语 JSON 文件。' live2d_about_page: name: live2d_about_page label: “关于”按钮的 URL 地址 type: text placeholder: '请输入链接地址' description: '放空则不显示 关于 按钮。' live2d_model_id: name: live2d_model_id label: '默认模型 ID' type: number default: 0 placeholder: '请输入模型 ID' description: '默认模型 ID,参见 可用model列表。' live2d_model_textures_id: name: live2d_model_textures_id label: '默认材质 ID' type: number default: 0 placeholder: '请输入材质 ID' description: '默认材质 ID,参见 可用model列表。' live2d_waifu_size: name: live2d_waifu_size label: 看板娘大小 type: text default: '280x260' placeholder: '请输入宽度(px)x高度(px)' description: '看板娘的(宽度x高度),单位为px。' options: - value: '280x260' - value: '320x300' live2d_edge_side: name: live2d_edge_side label: 看板娘贴边方向与距离 type: text default: 'right:50' placeholder: '请输入位置:距离(px)' options: - value: 'right:50' - value: 'left:50' live2d_model_rand_mode: name: live2d_model_rand_mode label: 模型切换方式 type: radio default: switch options: - value: switch label: 顺序 - value: rand label: 随机 live2d_model_textures_rand_mode: name: live2d_model_textures_rand_mode label: 材质切换方式 type: radio default: rand options: - value: switch label: 顺序 - value: rand label: 随机 live2d_show_tool_menu: name: live2d_show_tool_menu label: 显示工具栏 type: switch data-type: bool default: true options: - value: true label: 显示 - value: false label: 关闭 live2d_tool_button: name: live2d_tool_button label: 显示工具栏按钮 type: checkbox default: - live2d_can_turn_to_home_page - live2d_can_switch_hitokoto - live2d_can_switch_model - live2d_can_switch_textures - live2d_can_take_screenshot - live2d_can_turn_to_about_page - live2d_can_close_live2d options: - value: live2d_can_turn_to_home_page label: 返回首页 - value: live2d_can_switch_hitokoto label: 一言 - value: live2d_can_switch_model label: 切换模型 - value: live2d_can_switch_textures label: 切换材质 - value: live2d_can_take_screenshot label: 截图 - value: live2d_can_turn_to_about_page label: 关于 - value: live2d_can_close_live2d label: 关闭看板娘 enhance: label: 增强功能 items: cursor_style: name: cursor_style label: 鼠标风格 type: select default: none options: - value: none label: 关闭 - value: OwO label: OwO - value: UwU label: UwU - value: breeze label: 清风(深色) - value: mellow label: 卡通圆润 - value: water_01 label: 彩虹水滴(一) - value: water_02 label: 彩虹水滴(二) - value: horse label: 彩虹小马 - value: debris label: 彩色碎片 - value: overwatch label: 守望先锋 - value: rainbow_rain label: 彩虹云雨 - value: marry label: 小樱茉莉 - value: black_cat label: 黑色小猫 - value: music_cat_01 label: 音乐小猫(一) - value: music_cat_02 label: 音乐小猫(二) cursor_move: name: cursor_move label: 鼠标移动特效 type: select default: none options: - value: none label: 关闭 - value: bubbleCursor label: 气泡跟随 - value: emojiCursor label: 表情包跟随 - value: springyEmojiCursor label: 弹性表情包跟随 - value: fairyDustCursor label: 仙女棒效果 - value: snowflakeCursor label: 雪花跟随 - value: followingDotCursor label: 圆点跟随 - value: ghostCursor label: 移动残影(疏) - value: trailingCursor label: 移动残影(密) cursor_click: name: cursor_click label: 鼠标点击特效 type: select default: none options: - value: none label: 关闭 - value: firework label: 烟花特效 - value: granule label: 粒子爆炸 - value: prosperous label: 富强民主 - value: heart label: 爱心特效 enable_busuanzi: name: enable_busuanzi label: 开启 busuanzi 访客统计 type: radio data-type: text default: show description: '隐藏时不显示统计信息,但依旧会请求 busuanzi 统计访客信息。' options: - value: none label: 关闭 - value: hide label: 隐藏 - value: show label: 显示 enable_compress: name: enable_compress label: "启用 HTML 压缩" type: radio data-type: text default: format options: - value: none label: 关闭 - value: format label: 压缩空格 - value: single label: 完全格式压缩 enable_sw: name: enable_sw label: "启用 Service Worker 优化" type: radio data-type: text default: "false" description: "需要在 Nginx 中添加 代理配置 方可启用,配置方法见 Dream 2.0.5起移除FreeCDN,以及SW配置方法" options: - value: "false" label: 关闭 - value: "&concurrent=true" label: 开启并发CDN请求 - value: "&cache=true" label: 开启全站离线 - value: "&concurrent=true&cache=true" label: 开启并发CDN与全站离线 - value: "uninstall" label: 卸载 sw_cdn_source: name: sw_cdn_source label: "Service Worker 并发 CDN 源" type: code default: |- https://unpkg.com https://cdn.jsdelivr.net/npm https://npm.elemecdn.com placeholder: 请输入 CDN 地址(一行一个) description: '填入可用的 NPM 公共开源 CDN 地址(一行一个),通过 “{CDN 地址}/{项目名}@{版本号}/${文件路径}” 可访问到文件,如:https://unpkg.com/halo-theme-dream@3.2.1/source/js/utils.min.js' effects_lantern_mode: name: effects_lantern_mode label: 喜庆灯笼特效显示模式 type: radio default: none options: - value: none label: 不显示 - value: day label: 明亮模式 - value: night label: 黑暗模式 - value: all label: 全模式 effects_sakura_mode: name: effects_sakura_mode label: 樱花飘落特效显示模式 type: radio default: day options: - value: none label: 不显示 - value: day label: 明亮模式 - value: night label: 黑暗模式 - value: all label: 全模式 effects_snowflake_mode: name: effects_snowflake_mode label: 雪花飘落特效显示模式 type: radio default: none options: - value: none label: 不显示 - value: day label: 明亮模式 - value: night label: 黑暗模式 - value: all label: 全模式 effects_universe_mode: name: effects_universe_mode label: 宇宙星空特效显示模式 type: radio default: night options: - value: none label: 不显示 - value: day label: 明亮模式 - value: night label: 黑暗模式 - value: all label: 全模式 effects_circle_magic_mode: name: effects_circle_magic_mode label: 上升圆点特效显示模式 type: radio default: night options: - value: none label: 不显示 - value: day label: 明亮模式 - value: night label: 黑暗模式 - value: all label: 全模式 enable_gray_mode: name: enable_gray_mode label: 灰色模式 type: switch data-type: bool default: false description: '向英雄致敬,愿精神长存!' options: - value: true label: 开启 - value: false label: 关闭 enable_baidu_push: name: enable_baidu_push label: 启用百度 URL 自动推送 type: switch data-type: bool default: false options: - value: true label: 开启 - value: false label: 关闭 enable_toutiao_push: name: enable_toutiao_push label: 启用头条搜索自动推送 type: switch data-type: bool default: false options: - value: true label: 开启 - value: false label: 关闭 enable_debug: name: enable_debug label: 开启 DEBUG 日志 type: switch data-type: bool default: false description: '开发和问题排查时开启日志。' options: - value: true label: 开启 - value: false label: 关闭 custom: label: 定制主题 items: external_css: name: external_css label: "外部 CSS 链接" type: text placeholder: 请输入 CSS 文件链接 description: "填入外部 CSS 链接,无需 link 标签,将插入 head 标签尾部。" inline_css: name: inline_css label: "内嵌 CSS" type: code placeholder: 请输入 CSS 样式内容 description: '填入 CSS 代码,无需 style 标签,将插入 head 标签尾部。' external_js_head: name: external_js_head label: "外部 JS 链接(head)" type: code placeholder: 请输入 script 标签 description: '填入外部 JS 链接,需要 script 标签,可按情况指定 asyncdefer 属性,将插入 head 标签尾部。' inline_js_head: name: inline_js_head label: "内嵌 JS(head)" type: code placeholder: 请输入 JS 代码内容 description: '填入 JS 代码,无需 script 标签,将插入 head 标签尾部。' external_js_body: name: external_js_body label: "外部 JS 链接(body)" type: code placeholder: 请输入 script 标签 description: '填入外部 JS 链接,需要 script 标签,可按情况指定 asyncdefer 属性,将插入 body 标签尾部。' inline_js_body: name: inline_js_body label: "内嵌JS(body)" type: code placeholder: 请输入 JS 代码内容 description: '填入 JS 代码,无需 script 标签,将插入 body 标签尾部。' ================================================ FILE: sheet.ftl ================================================ <#include "template/layout.ftl"> <#include "template/main/article.ftl"> <@layout title="${sheet.title} - ${blog_title!}" canonical="${sheet.fullPath!}"> <@article sheet,"sheet" /> ================================================ FILE: sheet_literature.ftl ================================================ <#include "template/layout.ftl"> <#include "template/main/article_literature.ftl"> <@layout title="${sheet.title} - ${blog_title!}" canonical="${sheet.fullPath!}"> <@articleLiterature sheet,"sheet" /> ================================================ FILE: source/lib/halo-comment@1.1.7/demo.html ================================================ halo-comment demo ================================================ FILE: source/lib/halo-comment@1.1.7/halo-comment.js ================================================ /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 6587: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AdminApiClient = void 0; const url_1 = __webpack_require__(6998); const clients_1 = __webpack_require__(6904); class AdminApiClient { constructor(client) { this.client = client.buildHttpClient(); this._attachment = new clients_1.AttachmentClient(this.client); this._backup = new clients_1.BackupClient(this.client); this._category = new clients_1.CategoryClient(this.client); this._installation = new clients_1.InstallationClient(this.client); this._journalComment = new clients_1.JournalCommentClient(this.client); this._journal = new clients_1.JournalClient(this.client); this._link = new clients_1.LinkClient(this.client); this._log = new clients_1.LogClient(this.client); this._mail = new clients_1.MailClient(this.client); this._menu = new clients_1.MenuClient(this.client); this._migration = new clients_1.MigrationClient(this.client); this._option = new clients_1.OptionClient(this.client); this._photo = new clients_1.PhotoClient(this.client); this._postComment = new clients_1.PostCommentClient(this.client); this._post = new clients_1.PostClient(this.client); this._sheetComment = new clients_1.SheetCommentClient(this.client); this._sheet = new clients_1.SheetClient(this.client); this._statistic = new clients_1.StatisticClient(this.client); this._tag = new clients_1.TagClient(this.client); this._theme = new clients_1.ThemeClient(this.client); this._user = new clients_1.UserClient(this.client); this._staticStorage = new clients_1.StaticStorageClient(this.client); this._comment = new clients_1.CommentClient(this.client); this._actuator = new clients_1.ActuatorClient(this.client); } get attachment() { return this._attachment; } get backup() { return this._backup; } get category() { return this._category; } get installation() { return this._installation; } get journalComment() { return this._journalComment; } get journal() { return this._journal; } get link() { return this._link; } get log() { return this._log; } get mail() { return this._mail; } get menu() { return this._menu; } get migration() { return this._migration; } get option() { return this._option; } get photo() { return this._photo; } get postComment() { return this._postComment; } get post() { return this._post; } get sheetComment() { return this._sheetComment; } get sheet() { return this._sheet; } get statistic() { return this._statistic; } get tag() { return this._tag; } get theme() { return this._theme; } get user() { return this._user; } get staticStorage() { return this._staticStorage; } get comment() { return this._comment; } get actuator() { return this._actuator; } getEnvironment() { const path = (0, url_1.buildPath)({ endpointName: 'environments', }); return this.client.get(path, {}); } getLogFile(lines) { const path = (0, url_1.buildPath)({ endpointName: 'halo/logfile', }); return this.client.get(path, { lines }); } isInstalled() { const path = (0, url_1.buildPath)({ endpointName: 'is_installed', }); return this.client.get(path, {}); } logout() { const path = (0, url_1.buildPath)({ endpointName: 'logout', }); return this.client.post(path, {}); } sendResetPasswordCode(params) { const path = (0, url_1.buildPath)({ endpointName: 'password/code', }); return this.client.post(path, params); } resetPassword(params) { const path = (0, url_1.buildPath)({ endpointName: 'password/reset', }); return this.client.put(path, params); } refreshToken(refreshToken) { const path = (0, url_1.buildPath)({ endpointName: `refresh/${refreshToken}`, }); return this.client.post(path, {}); } needMFACode(params) { const path = (0, url_1.buildPath)({ endpointName: 'login/precheck', }); return this.client.post(path, Object.assign({}, params)); } login(params) { const path = (0, url_1.buildPath)({ endpointName: 'login', }); return this.client.post(path, Object.assign({}, params)); } } exports.AdminApiClient = AdminApiClient; //# sourceMappingURL=AdminApiClient.js.map /***/ }), /***/ 6710: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AuthorizedClient = void 0; const url_1 = __webpack_require__(6998); const rest_api_client_1 = __webpack_require__(5040); class AuthorizedClient { constructor(baseUrl) { const requestConfigBuilder = new rest_api_client_1.HaloRequestConfigBuilder({ baseUrl: baseUrl, }); const responseHandler = new rest_api_client_1.HaloResponseHandler(); this.client = new rest_api_client_1.DefaultHttpClient({ responseHandler, requestConfigBuilder, }); } isInstalled() { const path = (0, url_1.buildPath)({ endpointName: 'is_installed', }); return this.client.get(path, {}); } sendResetPasswordCode(params) { const path = (0, url_1.buildPath)({ endpointName: 'password/code', }); return this.client.post(path, params); } resetPassword(params) { const path = (0, url_1.buildPath)({ endpointName: 'password/reset', }); return this.client.post(path, params); } refreshToken(refreshToken) { const path = (0, url_1.buildPath)({ endpointName: `refresh/${refreshToken}`, }); return this.client.post(path, {}); } login(params) { const path = (0, url_1.buildPath)({ endpointName: 'login', }); return this.client.post(path, Object.assign({}, params)); } needMFACode(params) { const path = (0, url_1.buildPath)({ endpointName: 'login/precheck', }); return this.client.post(path, Object.assign({}, params)); } } exports.AuthorizedClient = AuthorizedClient; //# sourceMappingURL=AuthorizedClient.js.map /***/ }), /***/ 6618: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ActuatorClient = void 0; const url_1 = __webpack_require__(6998); class ActuatorClient { constructor(client) { this.client = client; } getLogfile() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/logfile', }); return this.client.get(path, {}); } getEnv() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/env', }); return this.client.get(path, {}); } getSystemCpuCount() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/system.cpu.count', }); return this.client.get(path, {}); } getSystemCpuUsage() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/system.cpu.usage', }); return this.client.get(path, {}); } getProcessUptime() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/process.uptime', }); return this.client.get(path, {}); } getProcessStartTime() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/process.start.time', }); return this.client.get(path, {}); } getProcessCpuUsage() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/process.cpu.usage', }); return this.client.get(path, {}); } getJvmMemoryMax() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/jvm.memory.max', }); return this.client.get(path, {}); } getJvmMemoryCommitted() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/jvm.memory.committed', }); return this.client.get(path, {}); } getJvmMemoryUsed() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/jvm.memory.used', }); return this.client.get(path, {}); } getJvmGcPause() { const path = (0, url_1.buildPath)({ endpointName: 'actuator/metrics/jvm.gc.pause', }); return this.client.get(path, {}); } } exports.ActuatorClient = ActuatorClient; //# sourceMappingURL=ActuatorClient.js.map /***/ }), /***/ 399: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AttachmentClient = void 0; const rest_api_client_1 = __webpack_require__(5040); const url_1 = __webpack_require__(6998); class AttachmentClient { constructor(client) { this.client = client; } /** * Gets attachment detail by id. * * @param attachmentId attachment id * @returns Returns attachment detail response. */ get(attachmentId) { const path = (0, url_1.buildPath)({ endpointName: `attachments/${attachmentId}`, }); return this.client.get(path, {}); } /** * Page query attachment list. * * @param params attachment query parameter * @returns Returns attachment page response. */ list(params) { const path = (0, url_1.buildPath)({ endpointName: 'attachments', }); return this.client.get(path, Object.assign({}, params)); } /** * Batch delete attachment permanently by attachment ids. * * @param attachmentIds a collection of attachment id * @returns Returns attachments of deleted */ deleteInBatch(attachmentIds) { const path = (0, url_1.buildPath)({ endpointName: 'attachments', }); return this.client.delete(path, attachmentIds); } /** * Delete attachment permanently by attachment id. * * @param attachmentId attachment id * @returns Returns attachment detail of deleted */ delete(attachmentId) { const path = (0, url_1.buildPath)({ endpointName: `attachments/${attachmentId}`, }); return this.client.delete(path, {}); } /** * Update attachment name by id. * * @param attachmentId attachment id * @param name a new attachment name * @returns Returns an updated attachment response. */ update(attachmentId, name) { const path = (0, url_1.buildPath)({ endpointName: `attachments/${attachmentId}`, }); return this.client.put(path, { name }); } /** * List all of attachment media types. * * @returns Returns attachment media types response. */ listMediaTypes() { const path = (0, url_1.buildPath)({ endpointName: 'attachments/media_types', }); return this.client.get(path, {}); } /** * List all of attachment types. * * @returns Returns a response of attachment types. */ listTypes() { const path = (0, url_1.buildPath)({ endpointName: 'attachments/types', }); return this.client.get(path, {}); } /** * Upload a single attachment file. * * @param data attachment file object. * @param options other upload options. * @returns Returns a response of uploaded attachment */ upload(data, options) { const path = (0, url_1.buildPath)({ endpointName: 'attachments/upload', }); const formData = new rest_api_client_1.FormData(); formData.append('file', data); return this.client.post(path, formData, Object.assign({}, options)); } /** * Batch upload attachments. * * @param data attachment file object. * @param options other upload options. * @returns Returns a response of uploaded attachments. */ uploadInBatch(data, options) { const path = (0, url_1.buildPath)({ endpointName: 'attachments/uploads', }); const formData = new rest_api_client_1.FormData(); data.forEach((fileStream) => { formData.append('files', fileStream); }); return this.client.post(path, formData, Object.assign({}, options)); } } exports.AttachmentClient = AttachmentClient; //# sourceMappingURL=AttachmentClient.js.map /***/ }), /***/ 5260: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.BackupClient = void 0; const url_1 = __webpack_require__(6998); class BackupClient { constructor(client) { this.client = client; } getWorkdirBackup(filename) { const path = (0, url_1.buildPath)({ endpointName: `backups/work-dir/fetch?filename=${filename}`, }); return this.client.get(path, {}); } getDataBackup(filename) { const path = (0, url_1.buildPath)({ endpointName: `backups/data/fetch?filename=${filename}`, }); return this.client.get(path, {}); } getMarkdownBackup(filename) { const path = (0, url_1.buildPath)({ endpointName: `backups/markdown/fetch?filename=${filename}`, }); return this.client.get(path, {}); } backupWorkdir(options) { const path = (0, url_1.buildPath)({ endpointName: 'backups/work-dir', }); return this.client.post(path, options); } getWorkdirBackupOptions() { const path = (0, url_1.buildPath)({ endpointName: 'backups/work-dir/options', }); return this.client.get(path, {}); } listWorkdirBackups() { const path = (0, url_1.buildPath)({ endpointName: 'backups/work-dir', }); return this.client.get(path, {}); } deleteWorkdirBackup(filename) { const path = (0, url_1.buildPath)({ endpointName: `backups/work-dir`, }); return this.client.delete(path, { filename }); } backupData() { const path = (0, url_1.buildPath)({ endpointName: 'backups/data', }); return this.client.post(path, {}); } listDataBackups() { const path = (0, url_1.buildPath)({ endpointName: 'backups/data', }); return this.client.get(path, {}); } deleteDataBackup(filename) { const path = (0, url_1.buildPath)({ endpointName: `backups/data`, }); return this.client.delete(path, { filename }); } backupMarkdown(params) { const path = (0, url_1.buildPath)({ endpointName: 'backups/markdown/export', }); return this.client.post(path, params); } listMarkdownBackups() { const path = (0, url_1.buildPath)({ endpointName: 'backups/markdown/export', }); return this.client.get(path, {}); } deleteMarkdownBackup(filename) { const path = (0, url_1.buildPath)({ endpointName: `backups/markdown/export`, }); return this.client.delete(path, { filename }); } importMarkdown(data, options) { const path = (0, url_1.buildPath)({ endpointName: 'backups/markdown/import', }); const formData = new FormData(); formData.append('file', data); return this.client.post(path, formData, Object.assign({}, options)); } } exports.BackupClient = BackupClient; //# sourceMappingURL=BackupClient.js.map /***/ }), /***/ 6774: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CategoryClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class CategoryClient { constructor(client) { this.client = client; } /** * Lists all categories. * * @param params parameter for queries * @returns A response of all categories. */ list(params) { const path = (0, url_1.buildPath)({ endpointName: 'categories', }); return this.client.get(path, Object.assign({}, params)); } /** * List all categories as tree. * * @param sort sort option for queries, value is category field * @returns A response of all categories. */ listAsTree(sort) { const path = (0, url_1.buildPath)({ endpointName: 'categories/tree_view', }); return this.client.get(path, { sort }); } /** * Gets category detail by id. * * @param categoryId category id * @returns A response of category detail. */ get(categoryId) { const path = (0, url_1.buildPath)({ endpointName: `categories/${categoryId}`, }); return this.client.get(path, {}); } /** * Creates a category. * * @param params category parameter to create * @returns A response of created category. */ create(params) { const path = (0, url_1.buildPath)({ endpointName: 'categories', }); return this.client.post(path, Object.assign({}, params)); } /** * Updates category by id * * @param categoryId category id * @param params category update parameter * @returns A response of updated category. */ update(categoryId, params) { const path = (0, url_1.buildPath)({ endpointName: `categories/${categoryId}`, }); return this.client.put(path, Object.assign({}, params)); } /** * Updates category in batch * * @param params */ updateInBatch(params) { const path = (0, url_1.buildPath)({ endpointName: 'categories/batch', }); return this.client.put(path, [...params]); } /** * Deletes a category by id. * * @param categoryId category id */ delete(categoryId) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `categories/${categoryId}`, }); yield this.client.delete(path, {}); }); } } exports.CategoryClient = CategoryClient; //# sourceMappingURL=CategoryClient.js.map /***/ }), /***/ 8666: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CommentClient = void 0; const url_1 = __webpack_require__(6998); class CommentClient { constructor(client) { this.client = client; } list(target, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments`, }); return this.client.get(path, params); } latest(target, top, status) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments/latest`, }); return this.client.get(path, { top, status }); } listAsView(target, targetId, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments/${targetId}/list_view`, }); return this.client.get(path, params); } listAsTreeView(target, targetId, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments/${targetId}/tree_view`, }); return this.client.get(path, params); } get(target, commentId) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments/${commentId}`, }); return this.client.get(path, {}); } create(target, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments`, }); return this.client.post(path, params); } update(target, commentId, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments/${commentId}`, }); return this.client.get(path, params); } updateStatusById(target, commentId, status) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments/${commentId}/status/${status}`, }); return this.client.put(path, {}); } updateStatusInBatch(target, commentIds, status) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments/status/${status}`, }); return this.client.put(path, commentIds); } delete(target, commentId) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments/${commentId}`, }); return this.client.delete(path, {}); } deleteInBatch(target, postCommentIds) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments`, }); return this.client.delete(path, postCommentIds); } } exports.CommentClient = CommentClient; //# sourceMappingURL=CommentClient.js.map /***/ }), /***/ 8400: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.InstallationClient = void 0; const url_1 = __webpack_require__(6998); class InstallationClient { constructor(client) { this.client = client; } /** * Initializes the blog. * * @param params installation parameter * @returns A response of installation status message. */ install(params) { const path = (0, url_1.buildPath)({ endpointName: 'installations', }); return this.client.post(path, Object.assign({}, params)); } } exports.InstallationClient = InstallationClient; //# sourceMappingURL=InstallationClient.js.map /***/ }), /***/ 173: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.JournalClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class JournalClient { constructor(client) { this.client = client; } /** * Lists journals. * * @param params parameter for queries * @returns A page response of journals. */ list(params) { const path = (0, url_1.buildPath)({ endpointName: 'journals', }); return this.client.get(path, Object.assign({}, params)); } /** * Gets latest journals. * * @param top top option for queries * @returns A response of lastes journals. */ latest(top) { const path = (0, url_1.buildPath)({ endpointName: 'journals/latest', }); return this.client.get(path, { top }); } /** * Creates a journal. * * @param params parameter for creates * @returns A response of created journal. */ create(params) { const path = (0, url_1.buildPath)({ endpointName: 'journals', }); return this.client.post(path, Object.assign({}, params)); } /** * Updates a journal by id. * * @param journalId journal id * @param params parameter for updates * @returns A response of updated journal. */ update(journalId, params) { const path = (0, url_1.buildPath)({ endpointName: `journals/${journalId}`, }); return this.client.put(path, Object.assign({}, params)); } /** * Deletes a journal by id. * @param journalId journal id */ delete(journalId) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `journals/${journalId}`, }); yield this.client.delete(path, {}); }); } } exports.JournalClient = JournalClient; //# sourceMappingURL=JournalClient.js.map /***/ }), /***/ 5503: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.JournalCommentClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class JournalCommentClient { constructor(client) { this.client = client; } /** * Lists journal comments. * * @param params parameter for queries * @returns A page response of journals. */ list(params) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: 'journals/comments', }); return this.client.get(path, Object.assign({}, params)); }); } /** * Creates a journal comment. * * @param params comment parameter for creates * @returns A response of created journal comment. */ create(params) { const path = (0, url_1.buildPath)({ endpointName: 'journals/comments', }); return this.client.post(path, Object.assign({}, params)); } /** * Deletes a journal comment by id. * * @param commentId journal comment id. * @returns A response of deleted journal comment. */ delete(commentId) { const path = (0, url_1.buildPath)({ endpointName: `journals/comments/${commentId}`, }); return this.client.delete(path, {}); } /** * Updates journal comment status by id. * * @param commentId journal comment id * @param status comment status * @returns A response of updated journal comment. */ update(commentId, status) { const path = (0, url_1.buildPath)({ endpointName: `journals/comments/${commentId}/status/${status}`, }); return this.client.put(path, {}); } /** * Lists comment with list view. * * @param params parameter for queries * @returns A page response of journal comments. */ listAsView(params) { const path = (0, url_1.buildPath)({ endpointName: `journals/comments/${params.journalId}/list_view`, }); return this.client.get(path, Object.assign({}, params)); } /** * Lists comment with tree view. * * @param params parameter for queries * @returns A page response of journal comments tree. */ listAsTree(params) { const path = (0, url_1.buildPath)({ endpointName: `journals/comments/${params.journalId}/tree_view`, }); return this.client.get(path, Object.assign({}, params)); } /** * Lists latest journal comments. * * @param params parameter for queries * @returns A response of latest journal comments. */ latest(params) { const path = (0, url_1.buildPath)({ endpointName: 'journals/comments/latest', }); return this.client.get(path, Object.assign({}, params)); } } exports.JournalCommentClient = JournalCommentClient; //# sourceMappingURL=JournalCommentClient.js.map /***/ }), /***/ 9207: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LinkClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class LinkClient { constructor(client) { this.client = client; } list(sort) { const path = (0, url_1.buildPath)({ endpointName: 'links', }); return this.client.get(path, { sort }); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'links', }); return this.client.post(path, Object.assign({}, params)); } get(id) { const path = (0, url_1.buildPath)({ endpointName: `links/${id}`, }); return this.client.get(path, {}); } update(linkId, params) { const path = (0, url_1.buildPath)({ endpointName: `links/${linkId}`, }); return this.client.put(path, Object.assign({}, params)); } updateInBatch(params) { const path = (0, url_1.buildPath)({ endpointName: 'links/batch', }); return this.client.put(path, [...params]); } delete(id) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `links/${id}`, }); yield this.client.delete(path, {}); }); } listTeams() { const path = (0, url_1.buildPath)({ endpointName: 'links/teams', }); return this.client.get(path, {}); } } exports.LinkClient = LinkClient; //# sourceMappingURL=LinkClient.js.map /***/ }), /***/ 9842: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LogClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class LogClient { constructor(client) { this.client = client; } /** * List action logs by params. * * @param params */ list(params) { const path = (0, url_1.buildPath)({ endpointName: 'logs', }); return this.client.get(path, Object.assign({}, params)); } /** * Clear action logs */ clear() { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: 'logs/clear', }); yield this.client.get(path, {}); }); } /** * Get latest action logs * * @param top the number of logs to get */ latest(top) { const path = (0, url_1.buildPath)({ endpointName: 'logs/latest', }); return this.client.get(path, { top }); } } exports.LogClient = LogClient; //# sourceMappingURL=LogClient.js.map /***/ }), /***/ 7206: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.MailClient = void 0; const url_1 = __webpack_require__(6998); class MailClient { constructor(client) { this.client = client; } testSmtpService(params) { const path = (0, url_1.buildPath)({ endpointName: 'mails/test', }); return this.client.post(path, Object.assign({}, params)); } testConnect() { const path = (0, url_1.buildPath)({ endpointName: 'mails/test/connection', }); return this.client.post(path, {}); } } exports.MailClient = MailClient; //# sourceMappingURL=MailClient.js.map /***/ }), /***/ 7530: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.MenuClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class MenuClient { constructor(client) { this.client = client; } list() { const path = (0, url_1.buildPath)({ endpointName: 'menus', }); return this.client.get(path, {}); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'menus', }); return this.client.post(path, Object.assign({}, params)); } createInBatch(params) { const path = (0, url_1.buildPath)({ endpointName: 'menus/batch', }); return this.client.post(path, [...params]); } get(menuId) { const path = (0, url_1.buildPath)({ endpointName: `menus/${menuId}`, }); return this.client.post(path, {}); } update(menuId, params) { const path = (0, url_1.buildPath)({ endpointName: `menus/${menuId}`, }); return this.client.put(path, Object.assign({}, params)); } updateInBatch(params) { const path = (0, url_1.buildPath)({ endpointName: 'menus/batch', }); return this.client.put(path, [...params]); } delete(menuId) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `menus/${menuId}`, }); yield this.client.delete(path, {}); }); } deleteInBatch(menuIds) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: 'menus/batch', }); yield this.client.delete(path, [...menuIds]); }); } listTreeViewByTeam(team, sort) { const path = (0, url_1.buildPath)({ endpointName: 'menus/team/tree_view', }); return this.client.get(path, { team, sort }); } listTeams() { const path = (0, url_1.buildPath)({ endpointName: 'menus/teams', }); return this.client.get(path, {}); } listTreeView(sort) { const path = (0, url_1.buildPath)({ endpointName: 'menus/tree_view', }); return this.client.get(path, { sort }); } } exports.MenuClient = MenuClient; //# sourceMappingURL=MenuClient.js.map /***/ }), /***/ 9644: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.MigrationClient = void 0; const tslib_1 = __webpack_require__(655); const rest_api_client_1 = __webpack_require__(5040); const url_1 = __webpack_require__(6998); class MigrationClient { constructor(client) { this.client = client; } migrate(data, options) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: 'migrations/halo', }); const formData = new rest_api_client_1.FormData(); formData.append('file', data); yield this.client.post(path, formData, Object.assign({}, options)); }); } } exports.MigrationClient = MigrationClient; //# sourceMappingURL=MigrationClient.js.map /***/ }), /***/ 3913: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OptionClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class OptionClient { constructor(client) { this.client = client; } list() { const path = (0, url_1.buildPath)({ endpointName: 'options', }); return this.client.get(path, {}); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'options', }); return this.client.post(path, Object.assign({}, params)); } get(id) { const path = (0, url_1.buildPath)({ endpointName: `options/${id}`, }); return this.client.get(path, {}); } update(optionId, params) { const path = (0, url_1.buildPath)({ endpointName: `options/${optionId}`, }); return this.client.put(path, Object.assign({}, params)); } delete(optionId) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `options/${optionId}`, }); yield this.client.delete(path, {}); }); } listAsView(params) { const path = (0, url_1.buildPath)({ endpointName: 'options/list_view', }); return this.client.get(path, Object.assign({}, params)); } listAsMapView() { const path = (0, url_1.buildPath)({ endpointName: 'options/map_view', }); return this.client.get(path, {}); } listAsMapViewByKeys(params) { const path = (0, url_1.buildPath)({ endpointName: 'options/map_view/keys', }); return this.client.post(path, params); } saveMapView(params) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: 'options/map_view/saving', }); yield this.client.post(path, Object.assign({}, params)); }); } save(params) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: 'options/saving', }); yield this.client.post(path, [...params]); }); } } exports.OptionClient = OptionClient; //# sourceMappingURL=OptionClient.js.map /***/ }), /***/ 402: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PhotoClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class PhotoClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'photos', }); return this.client.get(path, Object.assign({}, params)); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'photos', }); return this.client.post(path, Object.assign({}, params)); } createInBatch(params) { const path = (0, url_1.buildPath)({ endpointName: 'photos/batch', }); return this.client.post(path, [...params]); } get(photoId) { const path = (0, url_1.buildPath)({ endpointName: `photos/${photoId}`, }); return this.client.get(path, {}); } update(photoId, params) { const path = (0, url_1.buildPath)({ endpointName: `photos/${photoId}`, }); return this.client.put(path, Object.assign({}, params)); } updateInBatch(params) { const path = (0, url_1.buildPath)({ endpointName: 'photos/batch', }); return this.client.put(path, [...params]); } delete(photoId) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `photos/${photoId}`, }); yield this.client.delete(path, {}); }); } deleteInBatch(photoIds) { const path = (0, url_1.buildPath)({ endpointName: 'photos/batch', }); return this.client.delete(path, photoIds); } latest(sort) { const path = (0, url_1.buildPath)({ endpointName: 'photos/latest', }); return this.client.get(path, { sort }); } listTeams() { const path = (0, url_1.buildPath)({ endpointName: 'photos/teams', }); return this.client.get(path, {}); } } exports.PhotoClient = PhotoClient; //# sourceMappingURL=PhotoClient.js.map /***/ }), /***/ 4682: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PostClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class PostClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'posts', }); return this.client.get(path, Object.assign({}, params)); } get(postId) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}`, }); return this.client.get(path, {}); } getPreviewLinkById(postId) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}/preview`, }); return this.client.get(path, {}); } latest(top) { const path = (0, url_1.buildPath)({ endpointName: 'posts/latest', }); return this.client.get(path, { top }); } listByStatus(status, query) { const path = (0, url_1.buildPath)({ endpointName: `posts/status/${status}`, }); return this.client.get(path, Object.assign({}, query)); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'posts', }); return this.client.post(path, Object.assign({}, params)); } update(postId, params) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}`, }); return this.client.put(path, Object.assign({}, params)); } updateStatusById(postId, status) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}/status/${status}`, }); return this.client.put(path, {}); } updateStatusInBatch(postIds, status) { const path = (0, url_1.buildPath)({ endpointName: `posts/status/${status}`, }); return this.client.put(path, postIds); } updateDraftById(postId, originalContent, content, keepRaw) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}/status/draft/content`, }); return this.client.put(path, { originalContent, content, keepRaw }); } like(postId) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}/likes`, }); yield this.client.put(path, {}); }); } delete(postId) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}`, }); return this.client.delete(path, {}); } deleteInBatch(postIds) { const path = (0, url_1.buildPath)({ endpointName: 'posts', }); return this.client.delete(path, postIds); } } exports.PostClient = PostClient; //# sourceMappingURL=PostClient.js.map /***/ }), /***/ 6494: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PostCommentClient = void 0; const url_1 = __webpack_require__(6998); class PostCommentClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'posts/comments', }); return this.client.get(path, Object.assign({}, params)); } listAsView(params) { const path = (0, url_1.buildPath)({ endpointName: `posts/comments/${params.postId}/list_view`, }); return this.client.get(path, Object.assign({}, params)); } listAsTreeView(params) { const path = (0, url_1.buildPath)({ endpointName: `posts/comments/${params.postId}/tree_view`, }); return this.client.get(path, Object.assign({}, params)); } latest(params) { const path = (0, url_1.buildPath)({ endpointName: 'posts/comments/latest', }); return this.client.get(path, Object.assign({}, params)); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'posts/comments', }); return this.client.post(path, Object.assign({}, params)); } update(commentId, params) { const path = (0, url_1.buildPath)({ endpointName: `posts/comments/${commentId}`, }); return this.client.get(path, Object.assign({}, params)); } updateStatusById(commentId, status) { const path = (0, url_1.buildPath)({ endpointName: `posts/comments/${commentId}/status/${status}`, }); return this.client.put(path, {}); } updateStatusInBatch(commentIds, status) { const path = (0, url_1.buildPath)({ endpointName: `posts/comments/status/${status}`, }); return this.client.put(path, commentIds); } delete(commentId) { const path = (0, url_1.buildPath)({ endpointName: `posts/comments/${commentId}`, }); return this.client.delete(path, {}); } deleteInBatch(postCommentIds) { const path = (0, url_1.buildPath)({ endpointName: 'posts/comments', }); return this.client.delete(path, postCommentIds); } } exports.PostCommentClient = PostCommentClient; //# sourceMappingURL=PostCommentClient.js.map /***/ }), /***/ 771: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SheetClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(6998); class SheetClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'sheets', }); return this.client.get(path, Object.assign({}, params)); } listIndependents() { const path = (0, url_1.buildPath)({ endpointName: 'sheets/independent', }); return this.client.get(path, {}); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'sheets', }); return this.client.post(path, Object.assign({}, params)); } get(sheetId) { const path = (0, url_1.buildPath)({ endpointName: `sheets/${sheetId}`, }); return this.client.get(path, {}); } getPreviewLinkById(sheetId) { const path = (0, url_1.buildPath)({ endpointName: `sheets/preview/${sheetId}`, }); return this.client.get(path, {}); } update(sheetId, params) { const path = (0, url_1.buildPath)({ endpointName: `sheets/${sheetId}`, }); return this.client.put(path, Object.assign({}, params)); } updateStatusById(sheetId, status) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `sheets/${sheetId}/${status}`, }); yield this.client.put(path, {}); }); } updateDraftById(sheetId, originalContent, content, keepRaw) { const path = (0, url_1.buildPath)({ endpointName: `sheets/${sheetId}/status/draft/content`, }); return this.client.put(path, { originalContent, content, keepRaw }); } delete(sheetId) { const path = (0, url_1.buildPath)({ endpointName: `sheets/${sheetId}`, }); return this.client.delete(path, {}); } } exports.SheetClient = SheetClient; //# sourceMappingURL=SheetClient.js.map /***/ }), /***/ 6094: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SheetCommentClient = void 0; const url_1 = __webpack_require__(6998); class SheetCommentClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'sheets/comments', }); return this.client.get(path, Object.assign({}, params)); } get(commentId) { const path = (0, url_1.buildPath)({ endpointName: `sheets/comments/${commentId}`, }); return this.client.get(path, {}); } listAsView(params) { const path = (0, url_1.buildPath)({ endpointName: `sheets/comments/${params.sheetId}/list_view`, }); return this.client.get(path, Object.assign({}, params)); } listAsTreeView(params) { const path = (0, url_1.buildPath)({ endpointName: `sheets/comments/${params.sheetId}/tree_view`, }); return this.client.get(path, Object.assign({}, params)); } latest(params) { const path = (0, url_1.buildPath)({ endpointName: 'sheets/comments/latest', }); return this.client.get(path, Object.assign({}, params)); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'sheets/comments', }); return this.client.post(path, Object.assign({}, params)); } update(commentId, params) { const path = (0, url_1.buildPath)({ endpointName: `sheets/comments/${commentId}`, }); return this.client.put(path, Object.assign({}, params)); } updateStatusById(commentId, status) { const path = (0, url_1.buildPath)({ endpointName: `sheets/comments/${commentId}/status/${status}`, }); return this.client.put(path, {}); } updateStatusInBatch(commentIds, status) { const path = (0, url_1.buildPath)({ endpointName: `sheets/comments/status/${status}`, }); return this.client.put(path, commentIds); } deleteInBatch(commentIds) { const path = (0, url_1.buildPath)({ endpointName: 'sheets/comments', }); return this.client.delete(path, commentIds); } delete(commentId) { const path = (0, url_1.buildPath)({ endpointName: `sheets/comments/${commentId}`, }); return this.client.delete(path, {}); } } exports.SheetCommentClient = SheetCommentClient; //# sourceMappingURL=SheetCommentClient.js.map /***/ }), /***/ 7742: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.StaticStorageClient = void 0; const rest_api_client_1 = __webpack_require__(5040); const url_1 = __webpack_require__(6998); class StaticStorageClient { constructor(client) { this.client = client; } list() { const path = (0, url_1.buildPath)({ endpointName: `statics`, }); return this.client.get(path, {}); } delete(filePath) { const path = (0, url_1.buildPath)({ endpointName: `statics`, }); return this.client.delete(path, { path: filePath, }); } createFolder(basePath, folderName) { const path = (0, url_1.buildPath)({ endpointName: `statics?basePath=${basePath}&folderName=${folderName}`, }); return this.client.post(path, {}); } upload(file, options, basePath) { const path = (0, url_1.buildPath)({ endpointName: `statics/upload?basePath=${basePath}`, }); const formData = new rest_api_client_1.FormData(); formData.append('file', file); return this.client.post(path, formData, Object.assign({}, options)); } rename(basePath, newName) { const path = (0, url_1.buildPath)({ endpointName: `statics/rename?basePath=${basePath}&newName=${newName}`, }); return this.client.post(path, {}); } saveContent(params) { const path = (0, url_1.buildPath)({ endpointName: `statics/files`, }); return this.client.put(path, params); } } exports.StaticStorageClient = StaticStorageClient; //# sourceMappingURL=StaticStorageClient.js.map /***/ }), /***/ 7922: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.StatisticClient = void 0; const url_1 = __webpack_require__(6998); class StatisticClient { constructor(client) { this.client = client; } statistics() { const path = (0, url_1.buildPath)({ endpointName: 'statistics', }); return this.client.get(path, {}); } statisticsWithUser() { const path = (0, url_1.buildPath)({ endpointName: 'statistics/user', }); return this.client.get(path, {}); } } exports.StatisticClient = StatisticClient; //# sourceMappingURL=StatisticClient.js.map /***/ }), /***/ 4898: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.TagClient = void 0; const url_1 = __webpack_require__(6998); class TagClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'tags', }); return this.client.get(path, Object.assign({}, params)); } create(params) { const path = (0, url_1.buildPath)({ endpointName: 'tags', }); return this.client.post(path, Object.assign({}, params)); } get(tagId) { const path = (0, url_1.buildPath)({ endpointName: `tags/${tagId}`, }); return this.client.get(path, {}); } update(tagId, params) { const path = (0, url_1.buildPath)({ endpointName: `tags/${tagId}`, }); return this.client.put(path, Object.assign({}, params)); } delete(tagId) { const path = (0, url_1.buildPath)({ endpointName: `tags/${tagId}`, }); return this.client.delete(path, {}); } } exports.TagClient = TagClient; //# sourceMappingURL=TagClient.js.map /***/ }), /***/ 8842: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ThemeClient = void 0; const tslib_1 = __webpack_require__(655); const rest_api_client_1 = __webpack_require__(5040); const url_1 = __webpack_require__(6998); class ThemeClient { constructor(client) { this.client = client; } /** * List all themes. * * @returns array of ThemeProperty */ list() { const path = (0, url_1.buildPath)({ endpointName: 'themes', }); return this.client.get(path, {}); } /** * Get theme property by themeId. * * @param themeId themeId * @returns ThemeProperty */ get(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}`, }); return this.client.get(path, {}); } /** * Delete theme by themeId. * * @param themeId themeId * @param deleteSettings whether to delete the theme settings at the same time. * @returns ThemeProperty */ delete(themeId, deleteSettings) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}`, }); return this.client.delete(path, { deleteSettings }); } /** * Active a theme. * * @param themeId themeId * @returns ThemeProperty */ active(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/activation`, }); return this.client.post(path, {}); } /** * Fetches theme configuration group names by theme id * * @param themeId theme id */ listConfigurationGroups(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/configurations/groups`, }); return this.client.get(path, {}); } /** * Fetches theme configuration group by theme id and group name * * @param themeId theme id * @param group group name */ listConfigurationsByGroup(themeId, group) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/configurations/groups/${group}`, }); return this.client.get(path, {}); } /** * List activated theme configurations. * * @returns array of configuration group. */ listActivatedConfigurations() { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation/configurations', }); return this.client.get(path, {}); } /** * List theme configurations by themeId. * * @param themeId themeId * @returns array of configuration group. */ listConfigurations(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/configurations`, }); return this.client.get(path, {}); } /** * List theme files by themeId. * * @param themeId themeId * @returns array of ThemeFile */ listFiles(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/files`, }); return this.client.get(path, {}); } /** * List activated theme files. * * @returns array of ThemeFile */ listActivatedFiles() { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation/files', }); return this.client.get(path, {}); } /** * Get activated template content by filepath. * * @param filepath filepath * @returns template content */ getActivatedTemplateContent(filepath) { const path = (0, url_1.buildPath)({ endpointName: 'themes/files/content', }); return this.client.get(path, { path: filepath }); } /** * Get template content by themeId and filepath. * * @param themeId themeId * @param filepath filepath * @returns template content */ getTemplateContent(themeId, filepath) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/files/content`, }); return this.client.get(path, { path: filepath }); } /** * Update theme template content by themeId. * * @param themeId themeId * @param params path, content */ updateTemplateContent(themeId, params) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/files/content`, }); yield this.client.put(path, Object.assign({}, params)); }); } /** * List theme settings by themeId. * * @param themeId themeId * @returns Record */ listSettings(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/settings`, }); return this.client.get(path, {}); } /** * List activated theme settings. * * @returns Record */ listActivatedSettings() { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation/settings', }); return this.client.get(path, {}); } /** * Lists theme settings by theme id and group name * * @param themeId theme id * @param group group name */ listSettingsByGroup(themeId, group) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/groups/${group}/settings`, }); return this.client.get(path, {}); } /** * Save settings by themeId. * * @param themeId themeId * @param settings settings */ saveSettings(themeId, settings) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/settings`, }); yield this.client.post(path, settings); }); } /** * Save activated theme settings. * * @param settings settings */ saveActivatedSettings(settings) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation/settings', }); yield this.client.post(path, settings); }); } /** * Get activated theme property. * * @returns ThemeProperty */ getActivatedTheme() { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation', }); return this.client.get(path, {}); } /** * List activated theme custom post templates. * * @returns array of template name. */ listCustomPostTemplates() { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation/template/custom/post', }); return this.client.get(path, {}); } /** * List activated theme custom sheet templates. * * @returns array of template name. */ listCustomSheetTemplates() { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation/template/custom/sheet', }); return this.client.get(path, {}); } /** * Check template exists * * @param template template name * @returns boolean */ exists(template) { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation/template/exists', }); return this.client.get(path, { template }); } /** * Fetch theme by uri * * @param uri uri * @returns void */ fetchTheme(uri) { const path = (0, url_1.buildPath)({ endpointName: `themes/fetching?uri=${uri}`, }); return this.client.post(path, {}); } /** * update theme by fetch. * * @param themeId themeId * @returns void */ updateThemeByFetching(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/fetching/${themeId}`, }); return this.client.put(path, {}); } /** * Update activated theme template content. * * @param params path, content * @returns void */ updateActivatedTemplateContent(params) { const path = (0, url_1.buildPath)({ endpointName: 'themes/files/content', }); return this.client.put(path, Object.assign({}, params)); } /** * Refresh theme list cache. * * @returns void */ reload() { const path = (0, url_1.buildPath)({ endpointName: 'themes/reload', }); return this.client.post(path, {}); } /** * Upload a theme. * * @param data data * @param options Upload options * @returns ThemeProperty */ upload(data, options) { const path = (0, url_1.buildPath)({ endpointName: 'themes/upload', }); const formData = new rest_api_client_1.FormData(); formData.append('file', data); return this.client.post(path, formData, Object.assign({}, options)); } /** * Update theme by upload. * * @param options upload options * @param themeId themeId * @param data data * @returns ThemeProperty */ updateByUpload(data, options, themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/upload/${themeId}`, }); const formData = new rest_api_client_1.FormData(); formData.append('file', data); return this.client.put(path, formData, Object.assign({}, options)); } } exports.ThemeClient = ThemeClient; //# sourceMappingURL=ThemeClient.js.map /***/ }), /***/ 5412: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UserClient = void 0; const url_1 = __webpack_require__(6998); class UserClient { constructor(client) { this.client = client; } /** * Get user profile */ getProfile() { const path = (0, url_1.buildPath)({ endpointName: 'users/profiles', }); return this.client.get(path, {}); } /** * Update user profile * * @param user {@link User} */ updateProfile(user) { const path = (0, url_1.buildPath)({ endpointName: 'users/profiles', }); return this.client.put(path, user); } updatePassword(params) { const path = (0, url_1.buildPath)({ endpointName: 'users/profiles/password', }); return this.client.put(path, Object.assign({}, params)); } generateMFAQrImage(params) { const path = (0, url_1.buildPath)({ endpointName: 'users/mfa/generate', }); return this.client.put(path, Object.assign({}, params)); } updateMFAuth(params) { const path = (0, url_1.buildPath)({ endpointName: 'users/mfa/update', }); return this.client.put(path, Object.assign({}, params)); } } exports.UserClient = UserClient; //# sourceMappingURL=UserClient.js.map /***/ }), /***/ 6904: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ActuatorClient = exports.CommentClient = exports.StaticStorageClient = exports.UserClient = exports.ThemeClient = exports.TagClient = exports.StatisticClient = exports.SheetClient = exports.SheetCommentClient = exports.PostClient = exports.PostCommentClient = exports.PhotoClient = exports.OptionClient = exports.MigrationClient = exports.MenuClient = exports.MailClient = exports.LogClient = exports.LinkClient = exports.JournalClient = exports.JournalCommentClient = exports.InstallationClient = exports.CategoryClient = exports.BackupClient = exports.AttachmentClient = void 0; var AttachmentClient_1 = __webpack_require__(399); Object.defineProperty(exports, "AttachmentClient", ({ enumerable: true, get: function () { return AttachmentClient_1.AttachmentClient; } })); var BackupClient_1 = __webpack_require__(5260); Object.defineProperty(exports, "BackupClient", ({ enumerable: true, get: function () { return BackupClient_1.BackupClient; } })); var CategoryClient_1 = __webpack_require__(6774); Object.defineProperty(exports, "CategoryClient", ({ enumerable: true, get: function () { return CategoryClient_1.CategoryClient; } })); var InstallationClient_1 = __webpack_require__(8400); Object.defineProperty(exports, "InstallationClient", ({ enumerable: true, get: function () { return InstallationClient_1.InstallationClient; } })); var JournalCommentClient_1 = __webpack_require__(5503); Object.defineProperty(exports, "JournalCommentClient", ({ enumerable: true, get: function () { return JournalCommentClient_1.JournalCommentClient; } })); var JournalClient_1 = __webpack_require__(173); Object.defineProperty(exports, "JournalClient", ({ enumerable: true, get: function () { return JournalClient_1.JournalClient; } })); var LinkClient_1 = __webpack_require__(9207); Object.defineProperty(exports, "LinkClient", ({ enumerable: true, get: function () { return LinkClient_1.LinkClient; } })); var LogClient_1 = __webpack_require__(9842); Object.defineProperty(exports, "LogClient", ({ enumerable: true, get: function () { return LogClient_1.LogClient; } })); var MailClient_1 = __webpack_require__(7206); Object.defineProperty(exports, "MailClient", ({ enumerable: true, get: function () { return MailClient_1.MailClient; } })); var MenuClient_1 = __webpack_require__(7530); Object.defineProperty(exports, "MenuClient", ({ enumerable: true, get: function () { return MenuClient_1.MenuClient; } })); var MigrationClient_1 = __webpack_require__(9644); Object.defineProperty(exports, "MigrationClient", ({ enumerable: true, get: function () { return MigrationClient_1.MigrationClient; } })); var OptionClient_1 = __webpack_require__(3913); Object.defineProperty(exports, "OptionClient", ({ enumerable: true, get: function () { return OptionClient_1.OptionClient; } })); var PhotoClient_1 = __webpack_require__(402); Object.defineProperty(exports, "PhotoClient", ({ enumerable: true, get: function () { return PhotoClient_1.PhotoClient; } })); var PostCommentClient_1 = __webpack_require__(6494); Object.defineProperty(exports, "PostCommentClient", ({ enumerable: true, get: function () { return PostCommentClient_1.PostCommentClient; } })); var PostClient_1 = __webpack_require__(4682); Object.defineProperty(exports, "PostClient", ({ enumerable: true, get: function () { return PostClient_1.PostClient; } })); var SheetCommentClient_1 = __webpack_require__(6094); Object.defineProperty(exports, "SheetCommentClient", ({ enumerable: true, get: function () { return SheetCommentClient_1.SheetCommentClient; } })); var SheetClient_1 = __webpack_require__(771); Object.defineProperty(exports, "SheetClient", ({ enumerable: true, get: function () { return SheetClient_1.SheetClient; } })); var StatisticClient_1 = __webpack_require__(7922); Object.defineProperty(exports, "StatisticClient", ({ enumerable: true, get: function () { return StatisticClient_1.StatisticClient; } })); var TagClient_1 = __webpack_require__(4898); Object.defineProperty(exports, "TagClient", ({ enumerable: true, get: function () { return TagClient_1.TagClient; } })); var ThemeClient_1 = __webpack_require__(8842); Object.defineProperty(exports, "ThemeClient", ({ enumerable: true, get: function () { return ThemeClient_1.ThemeClient; } })); var UserClient_1 = __webpack_require__(5412); Object.defineProperty(exports, "UserClient", ({ enumerable: true, get: function () { return UserClient_1.UserClient; } })); var StaticStorageClient_1 = __webpack_require__(7742); Object.defineProperty(exports, "StaticStorageClient", ({ enumerable: true, get: function () { return StaticStorageClient_1.StaticStorageClient; } })); var CommentClient_1 = __webpack_require__(8666); Object.defineProperty(exports, "CommentClient", ({ enumerable: true, get: function () { return CommentClient_1.CommentClient; } })); var ActuatorClient_1 = __webpack_require__(6618); Object.defineProperty(exports, "ActuatorClient", ({ enumerable: true, get: function () { return ActuatorClient_1.ActuatorClient; } })); //# sourceMappingURL=index.js.map /***/ }), /***/ 5597: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AuthorizedClient = exports.AdminApiClient = void 0; const tslib_1 = __webpack_require__(655); var AdminApiClient_1 = __webpack_require__(6587); Object.defineProperty(exports, "AdminApiClient", ({ enumerable: true, get: function () { return AdminApiClient_1.AdminApiClient; } })); var AuthorizedClient_1 = __webpack_require__(6710); Object.defineProperty(exports, "AuthorizedClient", ({ enumerable: true, get: function () { return AuthorizedClient_1.AuthorizedClient; } })); tslib_1.__exportStar(__webpack_require__(5040), exports); tslib_1.__exportStar(__webpack_require__(6904), exports); //# sourceMappingURL=index.js.map /***/ }), /***/ 6998: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.buildPath = void 0; const buildPath = (params) => { const { endpointName, scope } = params; const scopePath = scope !== undefined ? `${scope}` : 'admin'; return `/api/${scopePath}/${endpointName}`; }; exports.buildPath = buildPath; //# sourceMappingURL=url.js.map /***/ }), /***/ 9290: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HaloRequestConfigBuilder = void 0; const tslib_1 = __webpack_require__(655); const form_data_1 = tslib_1.__importDefault(__webpack_require__(6230)); const qs_1 = tslib_1.__importDefault(__webpack_require__(129)); const js_base64_1 = __webpack_require__(9575); const auth_1 = __webpack_require__(3622); const platform_1 = __webpack_require__(8384); const THRESHOLD_AVOID_REQUEST_URL_TOO_LARGE = 4096; class HaloRequestConfigBuilder { constructor({ baseUrl, auth, basicAuth, clientCertAuth, proxy, userAgent, }) { this.baseUrl = baseUrl; this.auth = auth; this.headers = this.buildHeaders({ basicAuth, userAgent }); this.clientCertAuth = clientCertAuth; this.proxy = proxy; this.requestToken = null; } build(method, path, params, options) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const requestConfig = Object.assign(Object.assign(Object.assign({ method, headers: this.headers, url: `${this.baseUrl}${path}` }, (options ? options : {})), platform_1.platformDeps.buildPlatformDependentConfig({ clientCertAuth: this.clientCertAuth, })), { proxy: this.proxy }); switch (method) { case 'get': { const requestUrl = this.buildRequestUrl(path, params); if (requestUrl.length > THRESHOLD_AVOID_REQUEST_URL_TOO_LARGE) { return Object.assign(Object.assign({}, requestConfig), { method: 'post', headers: Object.assign(Object.assign({}, this.headers), { 'X-HTTP-Method-Override': 'GET' }), data: yield this.buildData(params) }); } return Object.assign(Object.assign({}, requestConfig), { url: requestUrl }); } case 'post': { if (params instanceof form_data_1.default) { const formData = yield this.buildData(params); return Object.assign(Object.assign({}, requestConfig), { headers: // NOTE: formData.getHeaders does not exist in a browser environment. typeof formData.getHeaders === 'function' ? Object.assign(Object.assign({}, this.headers), formData.getHeaders()) : this.headers, data: formData }); } return Object.assign(Object.assign({}, requestConfig), { data: yield this.buildData(params) }); } case 'put': { return Object.assign(Object.assign({}, requestConfig), { data: yield this.buildData(params) }); } case 'delete': { if (params instanceof Array) { return Object.assign(Object.assign({}, requestConfig), { headers: this.headers, data: params }); } const requestUrl = this.buildRequestUrl(path, yield this.buildData(params)); return Object.assign(Object.assign({}, requestConfig), { url: requestUrl }); } default: { throw new Error(`${method} method is not supported`); } } }); } buildRequestUrl(path, params) { const requestUrl = `${this.baseUrl}${path}`; const query = qs_1.default.stringify(params, { indices: false }); return query ? `${requestUrl}?${query}` : requestUrl; } buildData(params) { return tslib_1.__awaiter(this, void 0, void 0, function* () { if (this.auth && this.auth.type === 'session') { const requestToken = yield this.getRequestToken(); if (params instanceof form_data_1.default) { params.append(auth_1.SESSION_TOKEN_KEY, requestToken); return params; } return Object.assign({ [auth_1.SESSION_TOKEN_KEY]: requestToken }, params); } return params; }); } buildHeaders(params) { const { basicAuth, userAgent } = params; const basicAuthHeaders = basicAuth ? { Authorization: `Basic ${js_base64_1.Base64.encode(`${basicAuth.username}:${basicAuth.password}`)}`, } : {}; const platformDepsHeaders = platform_1.platformDeps.buildHeaders({ userAgent }); const commonHeaders = Object.assign(Object.assign({}, platformDepsHeaders), basicAuthHeaders); if (!this.auth) { return {}; } switch (this.auth.type) { case 'password': { return Object.assign(Object.assign({}, commonHeaders), { Authorization: js_base64_1.Base64.encode(`${this.auth.username}:${this.auth.password}`) }); } case 'adminToken': { const adminToken = this.auth.adminToken; return Object.assign(Object.assign({}, commonHeaders), { 'Admin-Authorization': adminToken }); } case 'apiToken': { const apiToken = this.auth.apiToken; if (Array.isArray(apiToken)) { return Object.assign(Object.assign({}, commonHeaders), { 'API-Authorization': apiToken.join(',') }); } return Object.assign(Object.assign({}, commonHeaders), { 'API-Authorization': apiToken }); } case 'oAuthToken': { return Object.assign(Object.assign({}, commonHeaders), { Authorization: `Bearer ${this.auth.oAuthToken}` }); } case 'customizeAuth': { return Object.assign(Object.assign({}, commonHeaders), { [this.auth.authHeader]: this.auth.getToken() }); } default: { // https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest return Object.assign(Object.assign({}, commonHeaders), { 'X-Requested-With': 'XMLHttpRequest' }); } } } getRequestToken() { return tslib_1.__awaiter(this, void 0, void 0, function* () { if (this.requestToken === null) { this.requestToken = yield platform_1.platformDeps.getRequestToken(); } return this.requestToken; }); } } exports.HaloRequestConfigBuilder = HaloRequestConfigBuilder; //# sourceMappingURL=HaloRequestConfigBuilder.js.map /***/ }), /***/ 2862: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HaloResponseHandler = void 0; const tslib_1 = __webpack_require__(655); const HaloRestAPIError_1 = __webpack_require__(2284); class HaloResponseHandler { handle(response) { return response.then((res) => this.handleSuccessResponse(res), (error) => this.handleErrorResponse(error)); } handleSuccessResponse(response) { return response.data; } handleErrorResponse(error) { if (!error.response) { // FIXME: find a better way to handle this error if (/MAC address verify failure/.test(error.toString())) { throw new Error('invalid clientCertAuth setting'); } throw error; } const errorResponse = error.response; const { data } = errorResponse, rest = tslib_1.__rest(errorResponse, ["data"]); if (typeof data === 'string') { throw new Error(`${rest.status}: ${rest.statusText}`); } throw new HaloRestAPIError_1.HaloRestAPIError(Object.assign({ data }, rest)); } } exports.HaloResponseHandler = HaloResponseHandler; //# sourceMappingURL=HaloResponseHandler.js.map /***/ }), /***/ 3388: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HaloRestAPIClient = void 0; const http_1 = __webpack_require__(2992); const HaloRequestConfigBuilder_1 = __webpack_require__(9290); const HaloResponseHandler_1 = __webpack_require__(2862); const platform_1 = __webpack_require__(8384); const buildDiscriminatedAuth = (auth) => { if ('username' in auth) { return Object.assign({ type: 'password' }, auth); } if ('apiToken' in auth) { return Object.assign({ type: 'apiToken' }, auth); } if ('adminToken' in auth) { return Object.assign({ type: 'adminToken' }, auth); } if ('oAuthToken' in auth) { return Object.assign({ type: 'oAuthToken' }, auth); } if ('type' in auth && auth['type'] == 'customizeAuth') { return auth; } return undefined; }; class HaloRestAPIClient { constructor(options = {}) { var _a; this.baseUrl = platform_1.platformDeps.buildBaseUrl(options.baseUrl); const auth = buildDiscriminatedAuth((_a = options.auth) !== null && _a !== void 0 ? _a : {}); const requestConfigBuilder = new HaloRequestConfigBuilder_1.HaloRequestConfigBuilder(Object.assign(Object.assign({}, options), { baseUrl: this.baseUrl, auth })); const responseHandler = new HaloResponseHandler_1.HaloResponseHandler(); this.httpClient = new http_1.DefaultHttpClient({ responseHandler, requestConfigBuilder, }); this._interceptors = this.httpClient.interceptors; } static get version() { return platform_1.platformDeps.getVersion(); } get interceptors() { return this._interceptors; } getBaseUrl() { return this.baseUrl; } buildHttpClient() { return this.httpClient; } } exports.HaloRestAPIClient = HaloRestAPIClient; //# sourceMappingURL=HaloRestAPIClient.js.map /***/ }), /***/ 2284: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HaloRestAPIError = void 0; class HaloRestAPIError extends Error { constructor(error) { const { data } = HaloRestAPIError.buildErrorResponseDate(error); super(data.message); this.name = 'HaloRestAPIError'; this.data = data; this.status = data.status; this.headers = error.headers; this.message = `[${this.status}] ${this.message}`; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types // Maintains proper stack trace for where our error was thrown (only available on V8) if (Error.captureStackTrace) { Error.captureStackTrace(this, HaloRestAPIError); } // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work // Set the prototype explicitly. Object.setPrototypeOf(this, HaloRestAPIError.prototype); } static buildErrorResponseDate(error) { // improvable return { data: error.data }; } } exports.HaloRestAPIError = HaloRestAPIError; //# sourceMappingURL=HaloRestAPIError.js.map /***/ }), /***/ 1638: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AxiosClient = void 0; const tslib_1 = __webpack_require__(655); const axios_1 = tslib_1.__importDefault(__webpack_require__(9669)); const InterceptorManager_1 = __webpack_require__(6008); class AxiosClient { constructor({ responseHandler, requestConfigBuilder, }) { this.responseHandler = responseHandler; this.requestConfigBuilder = requestConfigBuilder; this.interceptors = { request: new InterceptorManager_1.RequestInterceptor(), response: new InterceptorManager_1.ResponseInterceptor(), }; } get(path, params) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('get', path, params); return this.sendRequest(requestConfig); }); } getData(path, params) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('get', path, params, { responseType: 'arraybuffer', }); return this.sendRequest(requestConfig); }); } post(path, params, options) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('post', path, params, options); return this.sendRequest(requestConfig); }); } postData(path, formData) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('post', path, formData); return this.sendRequest(requestConfig); }); } put(path, params, options) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('put', path, params, options); return this.sendRequest(requestConfig); }); } delete(path, params, options) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('delete', path, params, options); return this.sendRequest(requestConfig); }); } sendRequest(requestConfig) { return tslib_1.__awaiter(this, void 0, void 0, function* () { return this.responseHandler.handle( // eslint-disable-next-line new-cap (0, axios_1.default)(Object.assign(Object.assign({}, requestConfig), { // NOTE: For defining the max size of the http request content, `maxBodyLength` will be used after version 0.20.0. // `maxContentLength` will be still needed for defining the max size of the http response content. // ref: https://github.com/axios/axios/pull/2781/files // maxBodyLength: Infinity, maxContentLength: Infinity }))); }); } } exports.AxiosClient = AxiosClient; //# sourceMappingURL=AxiosClient.js.map /***/ }), /***/ 6008: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ResponseInterceptor = exports.RequestInterceptor = void 0; const tslib_1 = __webpack_require__(655); const axios_1 = tslib_1.__importDefault(__webpack_require__(9669)); class RequestInterceptor { use(resolved, rejected) { return axios_1.default.interceptors.request.use(resolved, rejected); } eject(id) { axios_1.default.interceptors.request.eject(id); } } exports.RequestInterceptor = RequestInterceptor; class ResponseInterceptor { use(resolved, rejected) { return axios_1.default.interceptors.response.use(resolved, rejected); } eject(id) { axios_1.default.interceptors.response.eject(id); } } exports.ResponseInterceptor = ResponseInterceptor; //# sourceMappingURL=InterceptorManager.js.map /***/ }), /***/ 2992: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DefaultHttpClient = void 0; var AxiosClient_1 = __webpack_require__(1638); Object.defineProperty(exports, "DefaultHttpClient", ({ enumerable: true, get: function () { return AxiosClient_1.AxiosClient; } })); //# sourceMappingURL=index.js.map /***/ }), /***/ 5040: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Axios = exports.FormData = exports.DefaultHttpClient = exports.HaloRequestConfigBuilder = exports.HaloResponseHandler = exports.HaloRestAPIClient = void 0; const tslib_1 = __webpack_require__(655); const platform_1 = __webpack_require__(8384); const browserDeps = tslib_1.__importStar(__webpack_require__(5792)); const form_data_1 = tslib_1.__importDefault(__webpack_require__(6230)); exports.FormData = form_data_1.default; const axios_1 = tslib_1.__importDefault(__webpack_require__(9669)); exports.Axios = axios_1.default; (0, platform_1.injectPlatformDeps)(browserDeps); var HaloRestAPIClient_1 = __webpack_require__(3388); Object.defineProperty(exports, "HaloRestAPIClient", ({ enumerable: true, get: function () { return HaloRestAPIClient_1.HaloRestAPIClient; } })); var HaloResponseHandler_1 = __webpack_require__(2862); Object.defineProperty(exports, "HaloResponseHandler", ({ enumerable: true, get: function () { return HaloResponseHandler_1.HaloResponseHandler; } })); var HaloRequestConfigBuilder_1 = __webpack_require__(9290); Object.defineProperty(exports, "HaloRequestConfigBuilder", ({ enumerable: true, get: function () { return HaloRequestConfigBuilder_1.HaloRequestConfigBuilder; } })); var http_1 = __webpack_require__(2992); Object.defineProperty(exports, "DefaultHttpClient", ({ enumerable: true, get: function () { return http_1.DefaultHttpClient; } })); //# sourceMappingURL=index.browser.js.map /***/ }), /***/ 6703: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UnsupportedPlatformError = void 0; class UnsupportedPlatformError extends Error { constructor(platform) { const message = `This function is not supported in ${platform} environment`; super(message); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types // Maintains proper stack trace for where our error was thrown (only available on V8) if (Error.captureStackTrace) { Error.captureStackTrace(this, UnsupportedPlatformError); } this.name = 'UnsupportedPlatformError'; this.platform = platform; // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work // Set the prototype explicitly. Object.setPrototypeOf(this, UnsupportedPlatformError.prototype); } } exports.UnsupportedPlatformError = UnsupportedPlatformError; //# sourceMappingURL=UnsupportedPlatformError.js.map /***/ }), /***/ 5792: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getVersion = exports.buildBaseUrl = exports.buildFormDataValue = exports.buildHeaders = exports.buildPlatformDependentConfig = exports.getDefaultAuth = exports.getRequestToken = exports.readFileFromPath = void 0; const tslib_1 = __webpack_require__(655); const UnsupportedPlatformError_1 = __webpack_require__(6703); const readFileFromPath = () => { throw new UnsupportedPlatformError_1.UnsupportedPlatformError('Browser'); }; exports.readFileFromPath = readFileFromPath; const getRequestToken = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { if (typeof halo === 'object' && halo !== null && typeof halo.getRequestToken === 'function') { return halo.getRequestToken(); } throw new Error('session authentication must specify a request token'); }); exports.getRequestToken = getRequestToken; const getDefaultAuth = () => { return { type: 'session', }; }; exports.getDefaultAuth = getDefaultAuth; const buildPlatformDependentConfig = () => { return {}; }; exports.buildPlatformDependentConfig = buildPlatformDependentConfig; const buildHeaders = () => { return {}; }; exports.buildHeaders = buildHeaders; const buildFormDataValue = (data) => { return new Blob([data]); }; exports.buildFormDataValue = buildFormDataValue; const buildBaseUrl = (baseUrl) => { if (typeof baseUrl === 'undefined') { throw new Error('in browser environment, baseUrl is required'); } return baseUrl; }; exports.buildBaseUrl = buildBaseUrl; const getVersion = () => { return PACKAGE_VERSION; }; exports.getVersion = getVersion; //# sourceMappingURL=browser.js.map /***/ }), /***/ 8384: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.injectPlatformDeps = exports.platformDeps = void 0; exports.platformDeps = { readFileFromPath: () => { throw new Error('not implemented'); }, getRequestToken: () => { throw new Error('not implemented'); }, getDefaultAuth: () => { throw new Error('not implemented'); }, buildPlatformDependentConfig: () => { throw new Error('not implemented'); }, buildHeaders: () => { throw new Error('not implemented'); }, buildFormDataValue: () => { throw new Error('not implemented'); }, buildBaseUrl: () => { throw new Error('not implemented'); }, getVersion: () => { throw new Error('not implemented'); }, }; const injectPlatformDeps = (deps) => { exports.platformDeps.readFileFromPath = deps.readFileFromPath; exports.platformDeps.getRequestToken = deps.getRequestToken; exports.platformDeps.getDefaultAuth = deps.getDefaultAuth; exports.platformDeps.buildPlatformDependentConfig = deps.buildPlatformDependentConfig; exports.platformDeps.buildHeaders = deps.buildHeaders; exports.platformDeps.buildFormDataValue = deps.buildFormDataValue; exports.platformDeps.buildBaseUrl = deps.buildBaseUrl; exports.platformDeps.getVersion = deps.getVersion; }; exports.injectPlatformDeps = injectPlatformDeps; //# sourceMappingURL=index.js.map /***/ }), /***/ 3622: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SESSION_TOKEN_KEY = void 0; exports.SESSION_TOKEN_KEY = '__REQUEST_TOKEN__'; //# sourceMappingURL=auth.js.map /***/ }), /***/ 6838: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ContentApiClient = void 0; const clients_1 = __webpack_require__(3891); class ContentApiClient { constructor(client) { this.client = client.buildHttpClient(); this._archive = new clients_1.ArchiveClient(this.client); this._category = new clients_1.CategoryClient(this.client); this._journal = new clients_1.JournalClient(this.client); this._link = new clients_1.LinkClient(this.client); this._menu = new clients_1.MenuClient(this.client); this._option = new clients_1.OptionClient(this.client); this._photo = new clients_1.PhotoClient(this.client); this._post = new clients_1.PostClient(this.client); this._sheet = new clients_1.SheetClient(this.client); this._statistic = new clients_1.StatisticClient(this.client); this._tag = new clients_1.TagClient(this.client); this._theme = new clients_1.ThemeClient(this.client); this._user = new clients_1.UserClient(this.client); this._comment = new clients_1.CommentClient(this.client); } get archive() { return this._archive; } get category() { return this._category; } get journal() { return this._journal; } get link() { return this._link; } get menu() { return this._menu; } get option() { return this._option; } get photo() { return this._photo; } get post() { return this._post; } get sheet() { return this._sheet; } get statistic() { return this._statistic; } get tag() { return this._tag; } get theme() { return this._theme; } get user() { return this._user; } get comment() { return this._comment; } } exports.ContentApiClient = ContentApiClient; //# sourceMappingURL=ContentApiClient.js.map /***/ }), /***/ 9619: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ArchiveClient = void 0; const url_1 = __webpack_require__(9489); class ArchiveClient { constructor(client) { this.client = client; } listYearArchives() { const path = (0, url_1.buildPath)({ endpointName: 'archives/years', }); return this.client.get(path, {}); } listMonthArchives() { const path = (0, url_1.buildPath)({ endpointName: 'archives/years', }); return this.client.get(path, {}); } } exports.ArchiveClient = ArchiveClient; //# sourceMappingURL=ArchiveClient.js.map /***/ }), /***/ 413: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CategoryClient = void 0; const url_1 = __webpack_require__(9489); class CategoryClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'categories', }); return this.client.get(path, Object.assign({}, params)); } listPostBySlug(params) { const path = (0, url_1.buildPath)({ endpointName: `categories/${params.slug}/posts`, }); return this.client.get(path, Object.assign({}, params)); } } exports.CategoryClient = CategoryClient; //# sourceMappingURL=CategoryClient.js.map /***/ }), /***/ 7929: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CommentClient = void 0; const url_1 = __webpack_require__(9489); class CommentClient { constructor(client) { this.client = client; } /** * Get top comments * * @param target posts, sheets, or journals * @param targetId the id of the target * @param params optional query params */ listTopComments(target, targetId, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/${targetId}/comments/top_view`, }); return this.client.get(path, Object.assign({}, params)); } /** * Get children comments * * @param target posts, sheets, or journals * @param targetId the id of the target * @param commentId the id of the top comment * @param params optional query params */ listChildren(target, targetId, commentId, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/${targetId}/comments/${commentId}/children`, }); return this.client.get(path, Object.assign({}, params)); } /** * Get comments as tree view * * @param target posts, sheets, or journals * @param targetId the id of the target * @param params optional query params */ listAsTreeView(target, targetId, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/${targetId}/comments/tree_view`, }); return this.client.get(path, Object.assign({}, params)); } /** * Get comments as list view * * @param target posts, sheets, or journals * @param targetId the id of the target * @param params optional query params */ listAsView(target, targetId, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/${targetId}/comments/list_view`, }); return this.client.get(path, Object.assign({}, params)); } /** * Create a comment * * @param target posts, sheets, or journals * @param params the comment params */ create(target, params) { const path = (0, url_1.buildPath)({ endpointName: `${target}/comments`, }); return this.client.post(path, params); } } exports.CommentClient = CommentClient; //# sourceMappingURL=CommentClient.js.map /***/ }), /***/ 3313: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.JournalClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(9489); class JournalClient { constructor(client) { this.client = client; } list() { const path = (0, url_1.buildPath)({ endpointName: 'journals', }); return this.client.get(path, {}); } get(journalId) { const path = (0, url_1.buildPath)({ endpointName: `journals/${journalId}`, }); return this.client.get(path, {}); } like(journalId) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `journals/${journalId}/likes`, }); yield this.client.post(path, {}); }); } } exports.JournalClient = JournalClient; //# sourceMappingURL=JournalClient.js.map /***/ }), /***/ 8241: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LinkClient = void 0; const url_1 = __webpack_require__(9489); class LinkClient { constructor(client) { this.client = client; } list(sort) { const path = (0, url_1.buildPath)({ endpointName: 'links', }); return this.client.get(path, { sort }); } listTeams(sort) { const path = (0, url_1.buildPath)({ endpointName: 'links/team_view', }); return this.client.get(path, { sort }); } } exports.LinkClient = LinkClient; //# sourceMappingURL=LinkClient.js.map /***/ }), /***/ 428: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.MenuClient = void 0; const url_1 = __webpack_require__(9489); class MenuClient { constructor(client) { this.client = client; } list(sort) { const path = (0, url_1.buildPath)({ endpointName: 'menus', }); return this.client.get(path, { sort }); } listAsTreeView(sort) { const path = (0, url_1.buildPath)({ endpointName: 'menus/tree_view', }); return this.client.get(path, { sort }); } } exports.MenuClient = MenuClient; //# sourceMappingURL=MenuClient.js.map /***/ }), /***/ 3664: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OptionClient = void 0; const url_1 = __webpack_require__(9489); class OptionClient { constructor(client) { this.client = client; } list() { const path = (0, url_1.buildPath)({ endpointName: 'options/list_view', }); return this.client.get(path, {}); } listAsMapView(key) { const path = (0, url_1.buildPath)({ endpointName: 'options/map_view', }); return this.client.get(path, { key }); } getByKey(key) { const path = (0, url_1.buildPath)({ endpointName: `options/keys/${key}`, }); return this.client.get(path, { key }); } comment() { const path = (0, url_1.buildPath)({ endpointName: 'options/comment', }); return this.client.get(path, {}); } } exports.OptionClient = OptionClient; //# sourceMappingURL=OptionClient.js.map /***/ }), /***/ 4353: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PhotoClient = void 0; const url_1 = __webpack_require__(9489); class PhotoClient { constructor(client) { this.client = client; } latest(sort) { const path = (0, url_1.buildPath)({ endpointName: 'photos/latest', }); return this.client.get(path, { sort }); } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'photos', }); return this.client.get(path, Object.assign({}, params)); } } exports.PhotoClient = PhotoClient; //# sourceMappingURL=PhotoClient.js.map /***/ }), /***/ 2312: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PostClient = void 0; const tslib_1 = __webpack_require__(655); const url_1 = __webpack_require__(9489); class PostClient { constructor(client) { this.client = client; } list(params, keyword, categoryId) { const path = (0, url_1.buildPath)({ endpointName: 'posts', }); return this.client.get(path, Object.assign({ keyword, categoryId }, params)); } search(keyword, pageQuery) { const path = (0, url_1.buildPath)({ endpointName: 'posts/search', }); return this.client.get(path, Object.assign({ keyword }, pageQuery)); } get(postId, params) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}`, }); return this.client.get(path, Object.assign({}, params)); } getBySlug(slug, params) { const path = (0, url_1.buildPath)({ endpointName: 'posts/slug', }); return this.client.get(path, Object.assign({ slug }, params)); } getPrevPostById(postId) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}/prev`, }); return this.client.get(path, {}); } getNextPostById(postId) { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}/next`, }); return this.client.get(path, {}); } like(postId) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const path = (0, url_1.buildPath)({ endpointName: `posts/${postId}/likes`, }); yield this.client.get(path, {}); }); } } exports.PostClient = PostClient; //# sourceMappingURL=PostClient.js.map /***/ }), /***/ 6490: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SheetClient = void 0; const url_1 = __webpack_require__(9489); class SheetClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'sheets', }); return this.client.get(path, Object.assign({}, params)); } get(sheetId, params) { const path = (0, url_1.buildPath)({ endpointName: `sheets/${sheetId}`, }); return this.client.get(path, Object.assign({}, params)); } getBySlug(slug, params) { const path = (0, url_1.buildPath)({ endpointName: 'sheets/slug', }); return this.client.get(path, Object.assign({ slug }, params)); } } exports.SheetClient = SheetClient; //# sourceMappingURL=SheetClient.js.map /***/ }), /***/ 8435: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.StatisticClient = void 0; const url_1 = __webpack_require__(9489); class StatisticClient { constructor(client) { this.client = client; } statistics() { const path = (0, url_1.buildPath)({ endpointName: 'statistics', }); return this.client.get(path, {}); } statisticsWithUser() { const path = (0, url_1.buildPath)({ endpointName: 'statistics/user', }); return this.client.get(path, {}); } } exports.StatisticClient = StatisticClient; //# sourceMappingURL=StatisticClient.js.map /***/ }), /***/ 2367: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.TagClient = void 0; const url_1 = __webpack_require__(9489); class TagClient { constructor(client) { this.client = client; } list(params) { const path = (0, url_1.buildPath)({ endpointName: 'tags', }); return this.client.get(path, Object.assign({}, params)); } listPostsBySlug(slug, params) { const path = (0, url_1.buildPath)({ endpointName: `tags/${slug}/posts`, }); return this.client.get(path, Object.assign({}, params)); } } exports.TagClient = TagClient; //# sourceMappingURL=TagClient.js.map /***/ }), /***/ 9895: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ThemeClient = void 0; const url_1 = __webpack_require__(9489); class ThemeClient { constructor(client) { this.client = client; } getProperty() { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation', }); return this.client.get(path, {}); } listSettings() { const path = (0, url_1.buildPath)({ endpointName: 'themes/activation/settings', }); return this.client.get(path, {}); } getPropertyById(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}`, }); return this.client.get(path, {}); } listSettingsById(themeId) { const path = (0, url_1.buildPath)({ endpointName: `themes/${themeId}/settings`, }); return this.client.get(path, {}); } } exports.ThemeClient = ThemeClient; //# sourceMappingURL=ThemeClient.js.map /***/ }), /***/ 2849: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UserClient = void 0; const url_1 = __webpack_require__(9489); class UserClient { constructor(client) { this.client = client; } getProfile() { const path = (0, url_1.buildPath)({ endpointName: 'users/profile', }); return this.client.get(path, {}); } } exports.UserClient = UserClient; //# sourceMappingURL=UserClient.js.map /***/ }), /***/ 3891: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CommentClient = exports.UserClient = exports.ThemeClient = exports.TagClient = exports.StatisticClient = exports.SheetClient = exports.PostClient = exports.PhotoClient = exports.OptionClient = exports.MenuClient = exports.LinkClient = exports.JournalClient = exports.CategoryClient = exports.ArchiveClient = void 0; var ArchiveClient_1 = __webpack_require__(9619); Object.defineProperty(exports, "ArchiveClient", ({ enumerable: true, get: function () { return ArchiveClient_1.ArchiveClient; } })); var CategoryClient_1 = __webpack_require__(413); Object.defineProperty(exports, "CategoryClient", ({ enumerable: true, get: function () { return CategoryClient_1.CategoryClient; } })); var JournalClient_1 = __webpack_require__(3313); Object.defineProperty(exports, "JournalClient", ({ enumerable: true, get: function () { return JournalClient_1.JournalClient; } })); var LinkClient_1 = __webpack_require__(8241); Object.defineProperty(exports, "LinkClient", ({ enumerable: true, get: function () { return LinkClient_1.LinkClient; } })); var MenuClient_1 = __webpack_require__(428); Object.defineProperty(exports, "MenuClient", ({ enumerable: true, get: function () { return MenuClient_1.MenuClient; } })); var OptionClient_1 = __webpack_require__(3664); Object.defineProperty(exports, "OptionClient", ({ enumerable: true, get: function () { return OptionClient_1.OptionClient; } })); var PhotoClient_1 = __webpack_require__(4353); Object.defineProperty(exports, "PhotoClient", ({ enumerable: true, get: function () { return PhotoClient_1.PhotoClient; } })); var PostClient_1 = __webpack_require__(2312); Object.defineProperty(exports, "PostClient", ({ enumerable: true, get: function () { return PostClient_1.PostClient; } })); var SheetClient_1 = __webpack_require__(6490); Object.defineProperty(exports, "SheetClient", ({ enumerable: true, get: function () { return SheetClient_1.SheetClient; } })); var StatisticClient_1 = __webpack_require__(8435); Object.defineProperty(exports, "StatisticClient", ({ enumerable: true, get: function () { return StatisticClient_1.StatisticClient; } })); var TagClient_1 = __webpack_require__(2367); Object.defineProperty(exports, "TagClient", ({ enumerable: true, get: function () { return TagClient_1.TagClient; } })); var ThemeClient_1 = __webpack_require__(9895); Object.defineProperty(exports, "ThemeClient", ({ enumerable: true, get: function () { return ThemeClient_1.ThemeClient; } })); var UserClient_1 = __webpack_require__(2849); Object.defineProperty(exports, "UserClient", ({ enumerable: true, get: function () { return UserClient_1.UserClient; } })); var CommentClient_1 = __webpack_require__(7929); Object.defineProperty(exports, "CommentClient", ({ enumerable: true, get: function () { return CommentClient_1.CommentClient; } })); //# sourceMappingURL=index.js.map /***/ }), /***/ 3977: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ContentApiClient = void 0; const tslib_1 = __webpack_require__(655); var ContentApiClient_1 = __webpack_require__(6838); Object.defineProperty(exports, "ContentApiClient", ({ enumerable: true, get: function () { return ContentApiClient_1.ContentApiClient; } })); (0, tslib_1.__exportStar)(__webpack_require__(920), exports); (0, tslib_1.__exportStar)(__webpack_require__(3356), exports); (0, tslib_1.__exportStar)(__webpack_require__(3891), exports); //# sourceMappingURL=index.js.map /***/ }), /***/ 3356: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); //# sourceMappingURL=index.js.map /***/ }), /***/ 9489: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.buildPath = void 0; const buildPath = (params) => { const { endpointName, scope } = params; const scopePath = scope !== undefined ? `${scope}` : 'content'; return `/api/${scopePath}/${endpointName}`; }; exports.buildPath = buildPath; //# sourceMappingURL=url.js.map /***/ }), /***/ 5668: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HaloRequestConfigBuilder = void 0; const tslib_1 = __webpack_require__(655); const form_data_1 = (0, tslib_1.__importDefault)(__webpack_require__(6230)); const qs_1 = (0, tslib_1.__importDefault)(__webpack_require__(129)); const js_base64_1 = __webpack_require__(9575); const auth_1 = __webpack_require__(3064); const platform_1 = __webpack_require__(6595); const THRESHOLD_AVOID_REQUEST_URL_TOO_LARGE = 4096; class HaloRequestConfigBuilder { constructor({ baseUrl, auth, basicAuth, clientCertAuth, proxy, userAgent, }) { this.baseUrl = baseUrl; this.auth = auth; this.headers = this.buildHeaders({ basicAuth, userAgent }); this.clientCertAuth = clientCertAuth; this.proxy = proxy; this.requestToken = null; } build(method, path, params, options) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const requestConfig = Object.assign(Object.assign(Object.assign({ method, headers: this.headers, url: `${this.baseUrl}${path}` }, (options ? options : {})), platform_1.platformDeps.buildPlatformDependentConfig({ clientCertAuth: this.clientCertAuth, })), { proxy: this.proxy }); switch (method) { case 'get': { const requestUrl = this.buildRequestUrl(path, params); if (requestUrl.length > THRESHOLD_AVOID_REQUEST_URL_TOO_LARGE) { return Object.assign(Object.assign({}, requestConfig), { method: 'post', headers: Object.assign(Object.assign({}, this.headers), { 'X-HTTP-Method-Override': 'GET' }), data: yield this.buildData(params) }); } return Object.assign(Object.assign({}, requestConfig), { url: requestUrl }); } case 'post': { if (params instanceof form_data_1.default) { const formData = yield this.buildData(params); return Object.assign(Object.assign({}, requestConfig), { headers: // NOTE: formData.getHeaders does not exist in a browser environment. typeof formData.getHeaders === 'function' ? Object.assign(Object.assign({}, this.headers), formData.getHeaders()) : this.headers, data: formData }); } return Object.assign(Object.assign({}, requestConfig), { data: yield this.buildData(params) }); } case 'put': { return Object.assign(Object.assign({}, requestConfig), { data: yield this.buildData(params) }); } case 'delete': { if (params instanceof Array) { return Object.assign(Object.assign({}, requestConfig), { headers: this.headers, data: params }); } const requestUrl = this.buildRequestUrl(path, yield this.buildData(params)); return Object.assign(Object.assign({}, requestConfig), { url: requestUrl }); } default: { throw new Error(`${method} method is not supported`); } } }); } buildRequestUrl(path, params) { const requestUrl = `${this.baseUrl}${path}`; const query = qs_1.default.stringify(params, { indices: false }); return query ? `${requestUrl}?${query}` : requestUrl; } buildData(params) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { if (this.auth && this.auth.type === 'session') { const requestToken = yield this.getRequestToken(); if (params instanceof form_data_1.default) { params.append(auth_1.SESSION_TOKEN_KEY, requestToken); return params; } return Object.assign({ [auth_1.SESSION_TOKEN_KEY]: requestToken }, params); } return params; }); } buildHeaders(params) { const { basicAuth, userAgent } = params; const basicAuthHeaders = basicAuth ? { Authorization: `Basic ${js_base64_1.Base64.encode(`${basicAuth.username}:${basicAuth.password}`)}`, } : {}; const platformDepsHeaders = platform_1.platformDeps.buildHeaders({ userAgent }); const commonHeaders = Object.assign(Object.assign({}, platformDepsHeaders), basicAuthHeaders); if (!this.auth) { return {}; } switch (this.auth.type) { case 'password': { return Object.assign(Object.assign({}, commonHeaders), { Authorization: js_base64_1.Base64.encode(`${this.auth.username}:${this.auth.password}`) }); } case 'adminToken': { const adminToken = this.auth.adminToken; return Object.assign(Object.assign({}, commonHeaders), { 'Admin-Authorization': adminToken }); } case 'apiToken': { const apiToken = this.auth.apiToken; if (Array.isArray(apiToken)) { return Object.assign(Object.assign({}, commonHeaders), { 'API-Authorization': apiToken.join(',') }); } return Object.assign(Object.assign({}, commonHeaders), { 'API-Authorization': apiToken }); } case 'oAuthToken': { return Object.assign(Object.assign({}, commonHeaders), { Authorization: `Bearer ${this.auth.oAuthToken}` }); } case 'customizeAuth': { return Object.assign(Object.assign({}, commonHeaders), { [this.auth.authHeader]: this.auth.getToken() }); } default: { // https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest return Object.assign(Object.assign({}, commonHeaders), { 'X-Requested-With': 'XMLHttpRequest' }); } } } getRequestToken() { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { if (this.requestToken === null) { this.requestToken = yield platform_1.platformDeps.getRequestToken(); } return this.requestToken; }); } } exports.HaloRequestConfigBuilder = HaloRequestConfigBuilder; //# sourceMappingURL=HaloRequestConfigBuilder.js.map /***/ }), /***/ 8867: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HaloResponseHandler = void 0; const tslib_1 = __webpack_require__(655); const HaloRestAPIError_1 = __webpack_require__(2203); class HaloResponseHandler { handle(response) { return response.then((res) => this.handleSuccessResponse(res), (error) => this.handleErrorResponse(error)); } handleSuccessResponse(response) { return response.data; } handleErrorResponse(error) { if (!error.response) { // FIXME: find a better way to handle this error if (/MAC address verify failure/.test(error.toString())) { throw new Error('invalid clientCertAuth setting'); } throw error; } const errorResponse = error.response; const { data } = errorResponse, rest = (0, tslib_1.__rest)(errorResponse, ["data"]); if (typeof data === 'string') { throw new Error(`${rest.status}: ${rest.statusText}`); } throw new HaloRestAPIError_1.HaloRestAPIError(Object.assign({ data }, rest)); } } exports.HaloResponseHandler = HaloResponseHandler; //# sourceMappingURL=HaloResponseHandler.js.map /***/ }), /***/ 9230: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HaloRestAPIClient = void 0; const http_1 = __webpack_require__(5208); const HaloRequestConfigBuilder_1 = __webpack_require__(5668); const HaloResponseHandler_1 = __webpack_require__(8867); const platform_1 = __webpack_require__(6595); const buildDiscriminatedAuth = (auth) => { if ('username' in auth) { return Object.assign({ type: 'password' }, auth); } if ('apiToken' in auth) { return Object.assign({ type: 'apiToken' }, auth); } if ('adminToken' in auth) { return Object.assign({ type: 'adminToken' }, auth); } if ('oAuthToken' in auth) { return Object.assign({ type: 'oAuthToken' }, auth); } if ('type' in auth && auth['type'] == 'customizeAuth') { return auth; } return undefined; }; class HaloRestAPIClient { constructor(options = {}) { var _a; this.baseUrl = platform_1.platformDeps.buildBaseUrl(options.baseUrl); const auth = buildDiscriminatedAuth((_a = options.auth) !== null && _a !== void 0 ? _a : {}); const requestConfigBuilder = new HaloRequestConfigBuilder_1.HaloRequestConfigBuilder(Object.assign(Object.assign({}, options), { baseUrl: this.baseUrl, auth })); const responseHandler = new HaloResponseHandler_1.HaloResponseHandler(); this.httpClient = new http_1.DefaultHttpClient({ responseHandler, requestConfigBuilder, }); this._interceptors = this.httpClient.interceptors; } static get version() { return platform_1.platformDeps.getVersion(); } get interceptors() { return this._interceptors; } getBaseUrl() { return this.baseUrl; } buildHttpClient() { return this.httpClient; } } exports.HaloRestAPIClient = HaloRestAPIClient; //# sourceMappingURL=HaloRestAPIClient.js.map /***/ }), /***/ 2203: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HaloRestAPIError = void 0; class HaloRestAPIError extends Error { constructor(error) { const { data } = HaloRestAPIError.buildErrorResponseDate(error); super(data.message); this.name = 'HaloRestAPIError'; this.data = data; this.status = data.status; this.headers = error.headers; this.message = `[${this.status}] ${this.message}`; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types // Maintains proper stack trace for where our error was thrown (only available on V8) if (Error.captureStackTrace) { Error.captureStackTrace(this, HaloRestAPIError); } // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work // Set the prototype explicitly. Object.setPrototypeOf(this, HaloRestAPIError.prototype); } static buildErrorResponseDate(error) { // improvable return { data: error.data }; } } exports.HaloRestAPIError = HaloRestAPIError; //# sourceMappingURL=HaloRestAPIError.js.map /***/ }), /***/ 7518: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AxiosClient = void 0; const tslib_1 = __webpack_require__(655); const axios_1 = (0, tslib_1.__importDefault)(__webpack_require__(9669)); const InterceptorManager_1 = __webpack_require__(1916); class AxiosClient { constructor({ responseHandler, requestConfigBuilder, }) { this.responseHandler = responseHandler; this.requestConfigBuilder = requestConfigBuilder; this.interceptors = { request: new InterceptorManager_1.RequestInterceptor(), response: new InterceptorManager_1.ResponseInterceptor(), }; } get(path, params) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('get', path, params); return this.sendRequest(requestConfig); }); } getData(path, params) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('get', path, params, { responseType: 'arraybuffer', }); return this.sendRequest(requestConfig); }); } post(path, params, options) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('post', path, params, options); return this.sendRequest(requestConfig); }); } postData(path, formData) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('post', path, formData); return this.sendRequest(requestConfig); }); } put(path, params, options) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('put', path, params, options); return this.sendRequest(requestConfig); }); } delete(path, params, options) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { const requestConfig = yield this.requestConfigBuilder.build('delete', path, params, options); return this.sendRequest(requestConfig); }); } sendRequest(requestConfig) { return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { return this.responseHandler.handle( // eslint-disable-next-line new-cap (0, axios_1.default)(Object.assign(Object.assign({}, requestConfig), { // NOTE: For defining the max size of the http request content, `maxBodyLength` will be used after version 0.20.0. // `maxContentLength` will be still needed for defining the max size of the http response content. // ref: https://github.com/axios/axios/pull/2781/files // maxBodyLength: Infinity, maxContentLength: Infinity }))); }); } } exports.AxiosClient = AxiosClient; //# sourceMappingURL=AxiosClient.js.map /***/ }), /***/ 1916: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ResponseInterceptor = exports.RequestInterceptor = void 0; const tslib_1 = __webpack_require__(655); const axios_1 = (0, tslib_1.__importDefault)(__webpack_require__(9669)); class RequestInterceptor { use(resolved, rejected) { return axios_1.default.interceptors.request.use(resolved, rejected); } eject(id) { axios_1.default.interceptors.request.eject(id); } } exports.RequestInterceptor = RequestInterceptor; class ResponseInterceptor { use(resolved, rejected) { return axios_1.default.interceptors.response.use(resolved, rejected); } eject(id) { axios_1.default.interceptors.response.eject(id); } } exports.ResponseInterceptor = ResponseInterceptor; //# sourceMappingURL=InterceptorManager.js.map /***/ }), /***/ 5208: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DefaultHttpClient = void 0; var AxiosClient_1 = __webpack_require__(7518); Object.defineProperty(exports, "DefaultHttpClient", ({ enumerable: true, get: function () { return AxiosClient_1.AxiosClient; } })); //# sourceMappingURL=index.js.map /***/ }), /***/ 920: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Axios = exports.FormData = exports.DefaultHttpClient = exports.HaloRequestConfigBuilder = exports.HaloResponseHandler = exports.HaloRestAPIClient = void 0; const tslib_1 = __webpack_require__(655); const platform_1 = __webpack_require__(6595); const browserDeps = (0, tslib_1.__importStar)(__webpack_require__(4014)); const form_data_1 = (0, tslib_1.__importDefault)(__webpack_require__(6230)); exports.FormData = form_data_1.default; const axios_1 = (0, tslib_1.__importDefault)(__webpack_require__(9669)); exports.Axios = axios_1.default; (0, platform_1.injectPlatformDeps)(browserDeps); var HaloRestAPIClient_1 = __webpack_require__(9230); Object.defineProperty(exports, "HaloRestAPIClient", ({ enumerable: true, get: function () { return HaloRestAPIClient_1.HaloRestAPIClient; } })); var HaloResponseHandler_1 = __webpack_require__(8867); Object.defineProperty(exports, "HaloResponseHandler", ({ enumerable: true, get: function () { return HaloResponseHandler_1.HaloResponseHandler; } })); var HaloRequestConfigBuilder_1 = __webpack_require__(5668); Object.defineProperty(exports, "HaloRequestConfigBuilder", ({ enumerable: true, get: function () { return HaloRequestConfigBuilder_1.HaloRequestConfigBuilder; } })); var http_1 = __webpack_require__(5208); Object.defineProperty(exports, "DefaultHttpClient", ({ enumerable: true, get: function () { return http_1.DefaultHttpClient; } })); //# sourceMappingURL=index.browser.js.map /***/ }), /***/ 8689: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UnsupportedPlatformError = void 0; class UnsupportedPlatformError extends Error { constructor(platform) { const message = `This function is not supported in ${platform} environment`; super(message); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types // Maintains proper stack trace for where our error was thrown (only available on V8) if (Error.captureStackTrace) { Error.captureStackTrace(this, UnsupportedPlatformError); } this.name = 'UnsupportedPlatformError'; this.platform = platform; // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work // Set the prototype explicitly. Object.setPrototypeOf(this, UnsupportedPlatformError.prototype); } } exports.UnsupportedPlatformError = UnsupportedPlatformError; //# sourceMappingURL=UnsupportedPlatformError.js.map /***/ }), /***/ 4014: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getVersion = exports.buildBaseUrl = exports.buildFormDataValue = exports.buildHeaders = exports.buildPlatformDependentConfig = exports.getDefaultAuth = exports.getRequestToken = exports.readFileFromPath = void 0; const tslib_1 = __webpack_require__(655); const UnsupportedPlatformError_1 = __webpack_require__(8689); const readFileFromPath = () => { throw new UnsupportedPlatformError_1.UnsupportedPlatformError('Browser'); }; exports.readFileFromPath = readFileFromPath; const getRequestToken = () => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { if (typeof halo === 'object' && halo !== null && typeof halo.getRequestToken === 'function') { return halo.getRequestToken(); } throw new Error('session authentication must specify a request token'); }); exports.getRequestToken = getRequestToken; const getDefaultAuth = () => { return { type: 'session', }; }; exports.getDefaultAuth = getDefaultAuth; const buildPlatformDependentConfig = () => { return {}; }; exports.buildPlatformDependentConfig = buildPlatformDependentConfig; const buildHeaders = () => { return {}; }; exports.buildHeaders = buildHeaders; const buildFormDataValue = (data) => { return new Blob([data]); }; exports.buildFormDataValue = buildFormDataValue; const buildBaseUrl = (baseUrl) => { if (typeof baseUrl === 'undefined') { throw new Error('in browser environment, baseUrl is required'); } return baseUrl; }; exports.buildBaseUrl = buildBaseUrl; const getVersion = () => { return PACKAGE_VERSION; }; exports.getVersion = getVersion; //# sourceMappingURL=browser.js.map /***/ }), /***/ 6595: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.injectPlatformDeps = exports.platformDeps = void 0; exports.platformDeps = { readFileFromPath: () => { throw new Error('not implemented'); }, getRequestToken: () => { throw new Error('not implemented'); }, getDefaultAuth: () => { throw new Error('not implemented'); }, buildPlatformDependentConfig: () => { throw new Error('not implemented'); }, buildHeaders: () => { throw new Error('not implemented'); }, buildFormDataValue: () => { throw new Error('not implemented'); }, buildBaseUrl: () => { throw new Error('not implemented'); }, getVersion: () => { throw new Error('not implemented'); }, }; const injectPlatformDeps = (deps) => { exports.platformDeps.readFileFromPath = deps.readFileFromPath; exports.platformDeps.getRequestToken = deps.getRequestToken; exports.platformDeps.getDefaultAuth = deps.getDefaultAuth; exports.platformDeps.buildPlatformDependentConfig = deps.buildPlatformDependentConfig; exports.platformDeps.buildHeaders = deps.buildHeaders; exports.platformDeps.buildFormDataValue = deps.buildFormDataValue; exports.platformDeps.buildBaseUrl = deps.buildBaseUrl; exports.platformDeps.getVersion = deps.getVersion; }; exports.injectPlatformDeps = injectPlatformDeps; //# sourceMappingURL=index.js.map /***/ }), /***/ 3064: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SESSION_TOKEN_KEY = void 0; exports.SESSION_TOKEN_KEY = '__REQUEST_TOKEN__'; //# sourceMappingURL=auth.js.map /***/ }), /***/ 7679: /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller // MIT license // source: https://github.com/amiller-gh/currentScript-polyfill // added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505 (function (root, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} }(typeof self !== 'undefined' ? self : this, function () { function getCurrentScript () { var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript') // for chrome if (!descriptor && 'currentScript' in document && document.currentScript) { return document.currentScript } // for other browsers with native support for currentScript if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) { return document.currentScript } // IE 8-10 support script readyState // IE 11+ & Firefox support stack trace try { throw new Error(); } catch (err) { // Find the second match for the "at" string to get file src url from stack. var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig, ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig, stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack), scriptLocation = (stackDetails && stackDetails[1]) || false, line = (stackDetails && stackDetails[2]) || false, currentLocation = document.location.href.replace(document.location.hash, ''), pageSource, inlineScriptSourceRegExp, inlineScriptSource, scripts = document.getElementsByTagName('script'); // Live NodeList collection if (scriptLocation === currentLocation) { pageSource = document.documentElement.outerHTML; inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]* ... ``` You can also [download KaTeX](https://github.com/KaTeX/KaTeX/releases) and host it yourself. For details on how to configure auto-render extension, refer to [the documentation](https://katex.org/docs/autorender.html). ### API Call `katex.render` to render a TeX expression directly into a DOM element. For example: ```js katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, { throwOnError: false }); ``` Call `katex.renderToString` to generate an HTML string of the rendered math, e.g., for server-side rendering. For example: ```js var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", { throwOnError: false }); // '...' ``` Make sure to include the CSS and font files in both cases. If you are doing all rendering on the server, there is no need to include the JavaScript on the client. The examples above use the `throwOnError: false` option, which renders invalid inputs as the TeX source code in red (by default), with the error message as hover text. For other available options, see the [API documentation](https://katex.org/docs/api.html), [options documentation](https://katex.org/docs/options.html), and [handling errors documentation](https://katex.org/docs/error.html). ## Demo and Documentation Learn more about using KaTeX [on the website](https://katex.org)! ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) ## License KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT). ================================================ FILE: source/lib/katex@0.12.0/contrib/auto-render.js ================================================ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("katex")); else if(typeof define === 'function' && define.amd) define(["katex"], factory); else if(typeof exports === 'object') exports["renderMathInElement"] = factory(require("katex")); else root["renderMathInElement"] = factory(root["katex"]); })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__0__; /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: external "katex" var external_katex_ = __webpack_require__(0); var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_); // CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js /* eslint no-constant-condition:0 */ var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) { // Adapted from // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx var index = startIndex; var braceLevel = 0; var delimLength = delimiter.length; while (index < text.length) { var character = text[index]; if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) { return index; } else if (character === "\\") { index++; } else if (character === "{") { braceLevel++; } else if (character === "}") { braceLevel--; } index++; } return -1; }; var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) { var finalData = []; for (var i = 0; i < startData.length; i++) { if (startData[i].type === "text") { var text = startData[i].data; var lookingForLeft = true; var currIndex = 0; var nextIndex = void 0; nextIndex = text.indexOf(leftDelim); if (nextIndex !== -1) { currIndex = nextIndex; finalData.push({ type: "text", data: text.slice(0, currIndex) }); lookingForLeft = false; } while (true) { if (lookingForLeft) { nextIndex = text.indexOf(leftDelim, currIndex); if (nextIndex === -1) { break; } finalData.push({ type: "text", data: text.slice(currIndex, nextIndex) }); currIndex = nextIndex; } else { nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length); if (nextIndex === -1) { break; } finalData.push({ type: "math", data: text.slice(currIndex + leftDelim.length, nextIndex), rawData: text.slice(currIndex, nextIndex + rightDelim.length), display: display }); currIndex = nextIndex + rightDelim.length; } lookingForLeft = !lookingForLeft; } finalData.push({ type: "text", data: text.slice(currIndex) }); } else { finalData.push(startData[i]); } } return finalData; }; /* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters); // CONCATENATED MODULE: ./contrib/auto-render/auto-render.js /* eslint no-console:0 */ var auto_render_splitWithDelimiters = function splitWithDelimiters(text, delimiters) { var data = [{ type: "text", data: text }]; for (var i = 0; i < delimiters.length; i++) { var delimiter = delimiters[i]; data = auto_render_splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false); } return data; }; /* Note: optionsCopy is mutated by this method. If it is ever exposed in the * API, we should copy it before mutating. */ var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) { var data = auto_render_splitWithDelimiters(text, optionsCopy.delimiters); if (data.length === 1 && data[0].type === 'text') { // There is no formula in the text. // Let's return null which means there is no need to replace // the current text node with a new one. return null; } var fragment = document.createDocumentFragment(); for (var i = 0; i < data.length; i++) { if (data[i].type === "text") { fragment.appendChild(document.createTextNode(data[i].data)); } else { var span = document.createElement("span"); var math = data[i].data; // Override any display mode defined in the settings with that // defined by the text itself optionsCopy.displayMode = data[i].display; try { if (optionsCopy.preProcess) { math = optionsCopy.preProcess(math); } external_katex_default.a.render(math, span, optionsCopy); } catch (e) { if (!(e instanceof external_katex_default.a.ParseError)) { throw e; } optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e); fragment.appendChild(document.createTextNode(data[i].rawData)); continue; } fragment.appendChild(span); } } return fragment; }; var renderElem = function renderElem(elem, optionsCopy) { for (var i = 0; i < elem.childNodes.length; i++) { var childNode = elem.childNodes[i]; if (childNode.nodeType === 3) { // Text node var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy); if (frag) { i += frag.childNodes.length - 1; elem.replaceChild(frag, childNode); } } else if (childNode.nodeType === 1) { (function () { // Element node var className = ' ' + childNode.className + ' '; var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) { return className.indexOf(' ' + x + ' ') === -1; }); if (shouldRender) { renderElem(childNode, optionsCopy); } })(); } // Otherwise, it's something else, and ignore it. } }; var renderMathInElement = function renderMathInElement(elem, options) { if (!elem) { throw new Error("No element provided to render"); } var optionsCopy = {}; // Object.assign(optionsCopy, option) for (var option in options) { if (options.hasOwnProperty(option)) { optionsCopy[option] = options[option]; } } // default options optionsCopy.delimiters = optionsCopy.delimiters || [{ left: "$$", right: "$$", display: true }, { left: "\\(", right: "\\)", display: false }, // LaTeX uses $…$, but it ruins the display of normal `$` in text: // {left: "$", right: "$", display: false}, // \[…\] must come last in this array. Otherwise, renderMathInElement // will search for \[ before it searches for $$ or \( // That makes it susceptible to finding a \\[0.3em] row delimiter and // treating it as if it were the start of a KaTeX math zone. { left: "\\[", right: "\\]", display: true }]; optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"]; optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || []; optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different // math elements within a single call to `renderMathInElement`. optionsCopy.macros = optionsCopy.macros || {}; renderElem(elem, optionsCopy); }; /* harmony default export */ var auto_render = __webpack_exports__["default"] = (renderMathInElement); /***/ }) /******/ ])["default"]; }); ================================================ FILE: source/lib/katex@0.12.0/contrib/auto-render.mjs ================================================ import katex from '../katex.mjs'; /* eslint no-constant-condition:0 */ const findEndOfMath = function findEndOfMath(delimiter, text, startIndex) { // Adapted from // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx let index = startIndex; let braceLevel = 0; const delimLength = delimiter.length; while (index < text.length) { const character = text[index]; if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) { return index; } else if (character === "\\") { index++; } else if (character === "{") { braceLevel++; } else if (character === "}") { braceLevel--; } index++; } return -1; }; const splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) { const finalData = []; for (let i = 0; i < startData.length; i++) { if (startData[i].type === "text") { const text = startData[i].data; let lookingForLeft = true; let currIndex = 0; let nextIndex; nextIndex = text.indexOf(leftDelim); if (nextIndex !== -1) { currIndex = nextIndex; finalData.push({ type: "text", data: text.slice(0, currIndex) }); lookingForLeft = false; } while (true) { if (lookingForLeft) { nextIndex = text.indexOf(leftDelim, currIndex); if (nextIndex === -1) { break; } finalData.push({ type: "text", data: text.slice(currIndex, nextIndex) }); currIndex = nextIndex; } else { nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length); if (nextIndex === -1) { break; } finalData.push({ type: "math", data: text.slice(currIndex + leftDelim.length, nextIndex), rawData: text.slice(currIndex, nextIndex + rightDelim.length), display: display }); currIndex = nextIndex + rightDelim.length; } lookingForLeft = !lookingForLeft; } finalData.push({ type: "text", data: text.slice(currIndex) }); } else { finalData.push(startData[i]); } } return finalData; }; /* eslint no-console:0 */ const splitWithDelimiters = function splitWithDelimiters(text, delimiters) { let data = [{ type: "text", data: text }]; for (let i = 0; i < delimiters.length; i++) { const delimiter = delimiters[i]; data = splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false); } return data; }; /* Note: optionsCopy is mutated by this method. If it is ever exposed in the * API, we should copy it before mutating. */ const renderMathInText = function renderMathInText(text, optionsCopy) { const data = splitWithDelimiters(text, optionsCopy.delimiters); if (data.length === 1 && data[0].type === 'text') { // There is no formula in the text. // Let's return null which means there is no need to replace // the current text node with a new one. return null; } const fragment = document.createDocumentFragment(); for (let i = 0; i < data.length; i++) { if (data[i].type === "text") { fragment.appendChild(document.createTextNode(data[i].data)); } else { const span = document.createElement("span"); let math = data[i].data; // Override any display mode defined in the settings with that // defined by the text itself optionsCopy.displayMode = data[i].display; try { if (optionsCopy.preProcess) { math = optionsCopy.preProcess(math); } katex.render(math, span, optionsCopy); } catch (e) { if (!(e instanceof katex.ParseError)) { throw e; } optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e); fragment.appendChild(document.createTextNode(data[i].rawData)); continue; } fragment.appendChild(span); } } return fragment; }; const renderElem = function renderElem(elem, optionsCopy) { for (let i = 0; i < elem.childNodes.length; i++) { const childNode = elem.childNodes[i]; if (childNode.nodeType === 3) { // Text node const frag = renderMathInText(childNode.textContent, optionsCopy); if (frag) { i += frag.childNodes.length - 1; elem.replaceChild(frag, childNode); } } else if (childNode.nodeType === 1) { // Element node const className = ' ' + childNode.className + ' '; const shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1); if (shouldRender) { renderElem(childNode, optionsCopy); } } // Otherwise, it's something else, and ignore it. } }; const renderMathInElement = function renderMathInElement(elem, options) { if (!elem) { throw new Error("No element provided to render"); } const optionsCopy = {}; // Object.assign(optionsCopy, option) for (const option in options) { if (options.hasOwnProperty(option)) { optionsCopy[option] = options[option]; } } // default options optionsCopy.delimiters = optionsCopy.delimiters || [{ left: "$$", right: "$$", display: true }, { left: "\\(", right: "\\)", display: false }, // LaTeX uses $…$, but it ruins the display of normal `$` in text: // {left: "$", right: "$", display: false}, // \[…\] must come last in this array. Otherwise, renderMathInElement // will search for \[ before it searches for $$ or \( // That makes it susceptible to finding a \\[0.3em] row delimiter and // treating it as if it were the start of a KaTeX math zone. { left: "\\[", right: "\\]", display: true }]; optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"]; optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || []; optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different // math elements within a single call to `renderMathInElement`. optionsCopy.macros = optionsCopy.macros || {}; renderElem(elem, optionsCopy); }; export default renderMathInElement; ================================================ FILE: source/lib/katex@0.12.0/contrib/copy-tex.css ================================================ /* Force selection of entire .katex/.katex-display blocks, so that we can * copy/paste the entire source code. If you omit this CSS, partial * selections of a formula will work, but will copy the ugly HTML * representation instead of the LaTeX source code. (Full selections will * still produce the LaTeX source code.) */ .katex, .katex-display { user-select: all; -moz-user-select: all; -webkit-user-select: all; -ms-user-select: all; } ================================================ FILE: source/lib/katex@0.12.0/contrib/copy-tex.js ================================================ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else { var a = factory(); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })((typeof self !== 'undefined' ? self : this), function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./contrib/copy-tex/copy-tex.css var copy_tex = __webpack_require__(0); // CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js // Set these to how you want inline and display math to be delimited. var defaultCopyDelimiters = { inline: ['$', '$'], // alternative: ['\(', '\)'] display: ['$$', '$$'] // alternative: ['\[', '\]'] }; // Replace .katex elements with their TeX source ( element). // Modifies fragment in-place. Useful for writing your own 'copy' handler, // as in copy-tex.js. var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters) { if (copyDelimiters === void 0) { copyDelimiters = defaultCopyDelimiters; } // Remove .katex-html blocks that are preceded by .katex-mathml blocks // (which will get replaced below). var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html'); for (var i = 0; i < katexHtml.length; i++) { var element = katexHtml[i]; if (element.remove) { element.remove(null); } else { element.parentNode.removeChild(element); } } // Replace .katex-mathml elements with their annotation (TeX source) // descendant, with inline delimiters. var katexMathml = fragment.querySelectorAll('.katex-mathml'); for (var _i = 0; _i < katexMathml.length; _i++) { var _element = katexMathml[_i]; var texSource = _element.querySelector('annotation'); if (texSource) { if (_element.replaceWith) { _element.replaceWith(texSource); } else { _element.parentNode.replaceChild(texSource, _element); } texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1]; } } // Switch display math to display delimiters. var displays = fragment.querySelectorAll('.katex-display annotation'); for (var _i2 = 0; _i2 < displays.length; _i2++) { var _element2 = displays[_i2]; _element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1]; } return fragment; }; /* harmony default export */ var katex2tex = (katexReplaceWithTex); // CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js // Global copy handler to modify behavior on .katex elements. document.addEventListener('copy', function (event) { var selection = window.getSelection(); if (selection.isCollapsed) { return; // default action OK if selection is empty } var fragment = selection.getRangeAt(0).cloneContents(); if (!fragment.querySelector('.katex-mathml')) { return; // default action OK if no .katex-mathml elements } // Preserve usual HTML copy/paste behavior. var html = []; for (var i = 0; i < fragment.childNodes.length; i++) { html.push(fragment.childNodes[i].outerHTML); } event.clipboardData.setData('text/html', html.join('')); // Rewrite plain-text version. event.clipboardData.setData('text/plain', katex2tex(fragment).textContent); // Prevent normal copy handling. event.preventDefault(); }); // CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.webpack.js /** * This is the webpack entry point for KaTeX. As ECMAScript doesn't support * CSS modules natively, a separate entry point is used. */ /***/ }) /******/ ])["default"]; }); ================================================ FILE: source/lib/katex@0.12.0/contrib/copy-tex.mjs ================================================ // Set these to how you want inline and display math to be delimited. const defaultCopyDelimiters = { inline: ['$', '$'], // alternative: ['\(', '\)'] display: ['$$', '$$'] // alternative: ['\[', '\]'] }; // Replace .katex elements with their TeX source ( element). // Modifies fragment in-place. Useful for writing your own 'copy' handler, // as in copy-tex.js. const katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters) { if (copyDelimiters === void 0) { copyDelimiters = defaultCopyDelimiters; } // Remove .katex-html blocks that are preceded by .katex-mathml blocks // (which will get replaced below). const katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html'); for (let i = 0; i < katexHtml.length; i++) { const element = katexHtml[i]; if (element.remove) { element.remove(null); } else { element.parentNode.removeChild(element); } } // Replace .katex-mathml elements with their annotation (TeX source) // descendant, with inline delimiters. const katexMathml = fragment.querySelectorAll('.katex-mathml'); for (let i = 0; i < katexMathml.length; i++) { const element = katexMathml[i]; const texSource = element.querySelector('annotation'); if (texSource) { if (element.replaceWith) { element.replaceWith(texSource); } else { element.parentNode.replaceChild(texSource, element); } texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1]; } } // Switch display math to display delimiters. const displays = fragment.querySelectorAll('.katex-display annotation'); for (let i = 0; i < displays.length; i++) { const element = displays[i]; element.innerHTML = copyDelimiters.display[0] + element.innerHTML.substr(copyDelimiters.inline[0].length, element.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1]; } return fragment; }; document.addEventListener('copy', function (event) { const selection = window.getSelection(); if (selection.isCollapsed) { return; // default action OK if selection is empty } const fragment = selection.getRangeAt(0).cloneContents(); if (!fragment.querySelector('.katex-mathml')) { return; // default action OK if no .katex-mathml elements } // Preserve usual HTML copy/paste behavior. const html = []; for (let i = 0; i < fragment.childNodes.length; i++) { html.push(fragment.childNodes[i].outerHTML); } event.clipboardData.setData('text/html', html.join('')); // Rewrite plain-text version. event.clipboardData.setData('text/plain', katexReplaceWithTex(fragment).textContent); // Prevent normal copy handling. event.preventDefault(); }); ================================================ FILE: source/lib/katex@0.12.0/contrib/mathtex-script-type.js ================================================ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("katex")); else if(typeof define === 'function' && define.amd) define(["katex"], factory); else { var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__0__; /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); var scripts = document.body.getElementsByTagName("script"); scripts = Array.prototype.slice.call(scripts); scripts.forEach(function (script) { if (!script.type || !script.type.match(/math\/tex/i)) { return -1; } var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null; var katexElement = document.createElement(display ? "div" : "span"); katexElement.setAttribute("class", display ? "equation" : "inline-equation"); try { katex__WEBPACK_IMPORTED_MODULE_0___default.a.render(script.text, katexElement, { displayMode: display }); } catch (err) { //console.error(err); linter doesn't like this katexElement.textContent = script.text; } script.parentNode.replaceChild(katexElement, script); }); /***/ }) /******/ ])["default"]; }); ================================================ FILE: source/lib/katex@0.12.0/contrib/mathtex-script-type.mjs ================================================ import katex from '../katex.mjs'; let scripts = document.body.getElementsByTagName("script"); scripts = Array.prototype.slice.call(scripts); scripts.forEach(function (script) { if (!script.type || !script.type.match(/math\/tex/i)) { return -1; } const display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null; const katexElement = document.createElement(display ? "div" : "span"); katexElement.setAttribute("class", display ? "equation" : "inline-equation"); try { katex.render(script.text, katexElement, { displayMode: display }); } catch (err) { //console.error(err); linter doesn't like this katexElement.textContent = script.text; } script.parentNode.replaceChild(katexElement, script); }); ================================================ FILE: source/lib/katex@0.12.0/contrib/mhchem.js ================================================ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("katex")); else if(typeof define === 'function' && define.amd) define(["katex"], factory); else { var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__0__; /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); /* eslint-disable */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * KaTeX mhchem.js * * This file implements a KaTeX version of mhchem version 3.3.0. * It is adapted from MathJax/extensions/TeX/mhchem.js * It differs from the MathJax version as follows: * 1. The interface is changed so that it can be called from KaTeX, not MathJax. * 2. \rlap and \llap are replaced with \mathrlap and \mathllap. * 3. Four lines of code are edited in order to use \raisebox instead of \raise. * 4. The reaction arrow code is simplified. All reaction arrows are rendered * using KaTeX extensible arrows instead of building non-extensible arrows. * 5. \tripledash vertical alignment is slightly adjusted. * * This code, as other KaTeX code, is released under the MIT license. * * /************************************************************* * * MathJax/extensions/TeX/mhchem.js * * Implements the \ce command for handling chemical formulas * from the mhchem LaTeX package. * * --------------------------------------------------------------------- * * Copyright (c) 2011-2015 The MathJax Consortium * Copyright (c) 2015-2018 Martin Hensel * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Coding Style // - use '' for identifiers that can by minified/uglified // - use "" for strings that need to stay untouched // version: "3.3.0" for MathJax and KaTeX // Add \ce, \pu, and \tripledash to the KaTeX macros. katex__WEBPACK_IMPORTED_MODULE_0___default.a.__defineMacro("\\ce", function (context) { return chemParse(context.consumeArgs(1)[0], "ce"); }); katex__WEBPACK_IMPORTED_MODULE_0___default.a.__defineMacro("\\pu", function (context) { return chemParse(context.consumeArgs(1)[0], "pu"); }); // Needed for \bond for the ~ forms // Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not // a mathematical minus, U+2212. So we need that extra 0.56. katex__WEBPACK_IMPORTED_MODULE_0___default.a.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}"); // // This is the main function for handing the \ce and \pu commands. // It takes the argument to \ce or \pu and returns the corresponding TeX string. // var chemParse = function chemParse(tokens, stateMachine) { // Recreate the argument string from KaTeX's array of tokens. var str = ""; var expectedLoc = tokens[tokens.length - 1].loc.start; for (var i = tokens.length - 1; i >= 0; i--) { if (tokens[i].loc.start > expectedLoc) { // context.consumeArgs has eaten a space. str += " "; expectedLoc = tokens[i].loc.start; } str += tokens[i].text; expectedLoc += tokens[i].text.length; } var tex = texify.go(mhchemParser.go(str, stateMachine)); return tex; }; // // Core parser for mhchem syntax (recursive) // /** @type {MhchemParser} */ var mhchemParser = { // // Parses mchem \ce syntax // // Call like // go("H2O"); // go: function go(input, stateMachine) { if (!input) { return []; } if (stateMachine === undefined) { stateMachine = 'ce'; } var state = '0'; // // String buffers for parsing: // // buffer.a == amount // buffer.o == element // buffer.b == left-side superscript // buffer.p == left-side subscript // buffer.q == right-side subscript // buffer.d == right-side superscript // // buffer.r == arrow // buffer.rdt == arrow, script above, type // buffer.rd == arrow, script above, content // buffer.rqt == arrow, script below, type // buffer.rq == arrow, script below, content // // buffer.text_ // buffer.rm // etc. // // buffer.parenthesisLevel == int, starting at 0 // buffer.sb == bool, space before // buffer.beginsWithBond == bool // // These letters are also used as state names. // // Other states: // 0 == begin of main part (arrow/operator unlikely) // 1 == next entity // 2 == next entity (arrow/operator unlikely) // 3 == next atom // c == macro // /** @type {Buffer} */ var buffer = {}; buffer['parenthesisLevel'] = 0; input = input.replace(/\n/g, " "); input = input.replace(/[\u2212\u2013\u2014\u2010]/g, "-"); input = input.replace(/[\u2026]/g, "..."); // // Looks through mhchemParser.transitions, to execute a matching action // (recursive) // var lastInput; var watchdog = 10; /** @type {ParserOutput[]} */ var output = []; while (true) { if (lastInput !== input) { watchdog = 10; lastInput = input; } else { watchdog--; } // // Find actions in transition table // var machine = mhchemParser.stateMachines[stateMachine]; var t = machine.transitions[state] || machine.transitions['*']; iterateTransitions: for (var i = 0; i < t.length; i++) { var matches = mhchemParser.patterns.match_(t[i].pattern, input); if (matches) { // // Execute actions // var task = t[i].task; for (var iA = 0; iA < task.action_.length; iA++) { var o; // // Find and execute action // if (machine.actions[task.action_[iA].type_]) { o = machine.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option); } else if (mhchemParser.actions[task.action_[iA].type_]) { o = mhchemParser.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option); } else { throw ["MhchemBugA", "mhchem bug A. Please report. (" + task.action_[iA].type_ + ")"]; // Trying to use non-existing action } // // Add output // mhchemParser.concatArray(output, o); } // // Set next state, // Shorten input, // Continue with next character // (= apply only one transition per position) // state = task.nextState || state; if (input.length > 0) { if (!task.revisit) { input = matches.remainder; } if (!task.toContinue) { break; } } else { return output; } } } // // Prevent infinite loop // if (watchdog <= 0) { throw ["MhchemBugU", "mhchem bug U. Please report."]; // Unexpected character } } }, concatArray: function concatArray(a, b) { if (b) { if (Array.isArray(b)) { for (var iB = 0; iB < b.length; iB++) { a.push(b[iB]); } } else { a.push(b); } } }, patterns: { // // Matching patterns // either regexps or function that return null or {match_:"a", remainder:"bc"} // patterns: { // property names must not look like integers ("2") for correct property traversal order, later on 'empty': /^$/, 'else': /^./, 'else2': /^./, 'space': /^\s/, 'space A': /^\s(?=[A-Z\\$])/, 'space$': /^\s$/, 'a-z': /^[a-z]/, 'x': /^x/, 'x$': /^x$/, 'i$': /^i$/, 'letters': /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/, '\\greek': /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/, 'one lowercase latin letter $': /^(?:([a-z])(?:$|[^a-zA-Z]))$/, '$one lowercase latin letter$ $': /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/, 'one lowercase greek letter $': /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/, 'digits': /^[0-9]+/, '-9.,9': /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/, '-9.,9 no missing 0': /^[+\-]?[0-9]+(?:[.,][0-9]+)?/, '(-)(9.,9)(e)(99)': function e99(input) { var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/); if (m && m[0]) { return { match_: m.splice(1), remainder: input.substr(m[0].length) }; } return null; }, '(-)(9)^(-9)': function _(input) { var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/); if (m && m[0]) { return { match_: m.splice(1), remainder: input.substr(m[0].length) }; } return null; }, 'state of aggregation $': function stateOfAggregation$(input) { // ... or crystal system var a = mhchemParser.patterns.findObserveGroups(input, "", /^\([a-z]{1,3}(?=[\),])/, ")", ""); // (aq), (aq,$\infty$), (aq, sat) if (a && a.remainder.match(/^($|[\s,;\)\]\}])/)) { return a; } // AND end of 'phrase' var m = input.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/); // OR crystal system ($o$) (\ca$c$) if (m) { return { match_: m[0], remainder: input.substr(m[0].length) }; } return null; }, '_{(state of aggregation)}$': /^_\{(\([a-z]{1,3}\))\}/, '{[(': /^(?:\\\{|\[|\()/, ')]}': /^(?:\)|\]|\\\})/, ', ': /^[,;]\s*/, ',': /^[,;]/, '.': /^[.]/, '. ': /^([.\u22C5\u00B7\u2022])\s*/, '...': /^\.\.\.(?=$|[^.])/, '* ': /^([*])\s*/, '^{(...)}': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "^{", "", "", "}"); }, '^($...$)': function $$(input) { return mhchemParser.patterns.findObserveGroups(input, "^", "$", "$", ""); }, '^a': /^\^([0-9]+|[^\\_])/, '^\\x{}{}': function x(input) { return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true); }, '^\\x{}': function x(input) { return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", ""); }, '^\\x': /^\^(\\[a-zA-Z]+)\s*/, '^(-1)': /^\^(-?\d+)/, '\'': /^'/, '_{(...)}': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "_{", "", "", "}"); }, '_($...$)': function _$$(input) { return mhchemParser.patterns.findObserveGroups(input, "_", "$", "$", ""); }, '_9': /^_([+\-]?[0-9]+|[^\\])/, '_\\x{}{}': function _X(input) { return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true); }, '_\\x{}': function _X(input) { return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", ""); }, '_\\x': /^_(\\[a-zA-Z]+)\s*/, '^_': /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/, '{}': /^\{\}/, '{...}': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "", "{", "}", ""); }, '{(...)}': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "{", "", "", "}"); }, '$...$': function $$(input) { return mhchemParser.patterns.findObserveGroups(input, "", "$", "$", ""); }, '${(...)}$': function $$(input) { return mhchemParser.patterns.findObserveGroups(input, "${", "", "", "}$"); }, '$(...)$': function $$(input) { return mhchemParser.patterns.findObserveGroups(input, "$", "", "", "$"); }, '=<>': /^[=<>]/, '#': /^[#\u2261]/, '+': /^\+/, '-$': /^-(?=[\s_},;\]/]|$|\([a-z]+\))/, // -space -, -; -] -/ -$ -state-of-aggregation '-9': /^-(?=[0-9])/, '- orbital overlap': /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/, '-': /^-/, 'pm-operator': /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/, 'operator': /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/, 'arrowUpDown': /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/, '\\bond{(...)}': function bond(input) { return mhchemParser.patterns.findObserveGroups(input, "\\bond{", "", "", "}"); }, '->': /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/, 'CMT': /^[CMT](?=\[)/, '[(...)]': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "[", "", "", "]"); }, '1st-level escape': /^(&|\\\\|\\hline)\s*/, '\\,': /^(?:\\[,\ ;:])/, // \\x - but output no space before '\\x{}{}': function x(input) { return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true); }, '\\x{}': function x(input) { return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", ""); }, '\\ca': /^\\ca(?:\s+|(?![a-zA-Z]))/, '\\x': /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/, 'orbital': /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/, // only those with numbers in front, because the others will be formatted correctly anyway 'others': /^[\/~|]/, '\\frac{(...)}': function frac(input) { return mhchemParser.patterns.findObserveGroups(input, "\\frac{", "", "", "}", "{", "", "", "}"); }, '\\overset{(...)}': function overset(input) { return mhchemParser.patterns.findObserveGroups(input, "\\overset{", "", "", "}", "{", "", "", "}"); }, "\\underset{(...)}": function underset(input) { return mhchemParser.patterns.findObserveGroups(input, "\\underset{", "", "", "}", "{", "", "", "}"); }, "\\underbrace{(...)}": function underbrace(input) { return mhchemParser.patterns.findObserveGroups(input, "\\underbrace{", "", "", "}_", "{", "", "", "}"); }, '\\color{(...)}0': function color0(input) { return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}"); }, '\\color{(...)}{(...)}1': function color1(input) { return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}", "{", "", "", "}"); }, '\\color(...){(...)}2': function color2(input) { return mhchemParser.patterns.findObserveGroups(input, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}"); }, '\\ce{(...)}': function ce(input) { return mhchemParser.patterns.findObserveGroups(input, "\\ce{", "", "", "}"); }, 'oxidation$': /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/, 'd-oxidation$': /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/, // 0 could be oxidation or charge 'roman numeral': /^[IVX]+/, '1/2$': /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/, 'amount': function amount(input) { var match; // e.g. 2, 0.5, 1/2, -2, n/2, +; $a$ could be added later in parsing match = input.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/); if (match) { return { match_: match[0], remainder: input.substr(match[0].length) }; } var a = mhchemParser.patterns.findObserveGroups(input, "", "$", "$", ""); if (a) { // e.g. $2n-1$, $-$ match = a.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/); if (match) { return { match_: match[0], remainder: input.substr(match[0].length) }; } } return null; }, 'amount2': function amount2(input) { return this['amount'](input); }, '(KV letters),': /^(?:[A-Z][a-z]{0,2}|i)(?=,)/, 'formula$': function formula$(input) { if (input.match(/^\([a-z]+\)$/)) { return null; } // state of aggregation = no formula var match = input.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/); if (match) { return { match_: match[0], remainder: input.substr(match[0].length) }; } return null; }, 'uprightEntities': /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/, '/': /^\s*(\/)\s*/, '//': /^\s*(\/\/)\s*/, '*': /^\s*[*.]\s*/ }, findObserveGroups: function findObserveGroups(input, begExcl, begIncl, endIncl, endExcl, beg2Excl, beg2Incl, end2Incl, end2Excl, combine) { /** @type {{(input: string, pattern: string | RegExp): string | string[] | null;}} */ var _match = function _match(input, pattern) { if (typeof pattern === "string") { if (input.indexOf(pattern) !== 0) { return null; } return pattern; } else { var match = input.match(pattern); if (!match) { return null; } return match[0]; } }; /** @type {{(input: string, i: number, endChars: string | RegExp): {endMatchBegin: number, endMatchEnd: number} | null;}} */ var _findObserveGroups = function _findObserveGroups(input, i, endChars) { var braces = 0; while (i < input.length) { var a = input.charAt(i); var match = _match(input.substr(i), endChars); if (match !== null && braces === 0) { return { endMatchBegin: i, endMatchEnd: i + match.length }; } else if (a === "{") { braces++; } else if (a === "}") { if (braces === 0) { throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"]; } else { braces--; } } i++; } if (braces > 0) { return null; } return null; }; var match = _match(input, begExcl); if (match === null) { return null; } input = input.substr(match.length); match = _match(input, begIncl); if (match === null) { return null; } var e = _findObserveGroups(input, match.length, endIncl || endExcl); if (e === null) { return null; } var match1 = input.substring(0, endIncl ? e.endMatchEnd : e.endMatchBegin); if (!(beg2Excl || beg2Incl)) { return { match_: match1, remainder: input.substr(e.endMatchEnd) }; } else { var group2 = this.findObserveGroups(input.substr(e.endMatchEnd), beg2Excl, beg2Incl, end2Incl, end2Excl); if (group2 === null) { return null; } /** @type {string[]} */ var matchRet = [match1, group2.match_]; return { match_: combine ? matchRet.join("") : matchRet, remainder: group2.remainder }; } }, // // Matching function // e.g. match("a", input) will look for the regexp called "a" and see if it matches // returns null or {match_:"a", remainder:"bc"} // match_: function match_(m, input) { var pattern = mhchemParser.patterns.patterns[m]; if (pattern === undefined) { throw ["MhchemBugP", "mhchem bug P. Please report. (" + m + ")"]; // Trying to use non-existing pattern } else if (typeof pattern === "function") { return mhchemParser.patterns.patterns[m](input); // cannot use cached var pattern here, because some pattern functions need this===mhchemParser } else { // RegExp var match = input.match(pattern); if (match) { var mm; if (match[2]) { mm = [match[1], match[2]]; } else if (match[1]) { mm = match[1]; } else { mm = match[0]; } return { match_: mm, remainder: input.substr(match[0].length) }; } return null; } } }, // // Generic state machine actions // actions: { 'a=': function a(buffer, m) { buffer.a = (buffer.a || "") + m; }, 'b=': function b(buffer, m) { buffer.b = (buffer.b || "") + m; }, 'p=': function p(buffer, m) { buffer.p = (buffer.p || "") + m; }, 'o=': function o(buffer, m) { buffer.o = (buffer.o || "") + m; }, 'q=': function q(buffer, m) { buffer.q = (buffer.q || "") + m; }, 'd=': function d(buffer, m) { buffer.d = (buffer.d || "") + m; }, 'rm=': function rm(buffer, m) { buffer.rm = (buffer.rm || "") + m; }, 'text=': function text(buffer, m) { buffer.text_ = (buffer.text_ || "") + m; }, 'insert': function insert(buffer, m, a) { return { type_: a }; }, 'insert+p1': function insertP1(buffer, m, a) { return { type_: a, p1: m }; }, 'insert+p1+p2': function insertP1P2(buffer, m, a) { return { type_: a, p1: m[0], p2: m[1] }; }, 'copy': function copy(buffer, m) { return m; }, 'rm': function rm(buffer, m) { return { type_: 'rm', p1: m || "" }; }, 'text': function text(buffer, m) { return mhchemParser.go(m, 'text'); }, '{text}': function text(buffer, m) { var ret = ["{"]; mhchemParser.concatArray(ret, mhchemParser.go(m, 'text')); ret.push("}"); return ret; }, 'tex-math': function texMath(buffer, m) { return mhchemParser.go(m, 'tex-math'); }, 'tex-math tight': function texMathTight(buffer, m) { return mhchemParser.go(m, 'tex-math tight'); }, 'bond': function bond(buffer, m, k) { return { type_: 'bond', kind_: k || m }; }, 'color0-output': function color0Output(buffer, m) { return { type_: 'color0', color: m[0] }; }, 'ce': function ce(buffer, m) { return mhchemParser.go(m); }, '1/2': function _(buffer, m) { /** @type {ParserOutput[]} */ var ret = []; if (m.match(/^[+\-]/)) { ret.push(m.substr(0, 1)); m = m.substr(1); } var n = m.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/); n[1] = n[1].replace(/\$/g, ""); ret.push({ type_: 'frac', p1: n[1], p2: n[2] }); if (n[3]) { n[3] = n[3].replace(/\$/g, ""); ret.push({ type_: 'tex-math', p1: n[3] }); } return ret; }, '9,9': function _(buffer, m) { return mhchemParser.go(m, '9,9'); } }, // // createTransitions // convert { 'letter': { 'state': { action_: 'output' } } } to { 'state' => [ { pattern: 'letter', task: { action_: [{type_: 'output'}] } } ] } // with expansion of 'a|b' to 'a' and 'b' (at 2 places) // createTransitions: function createTransitions(o) { var pattern, state; /** @type {string[]} */ var stateArray; var i; // // 1. Collect all states // /** @type {Transitions} */ var transitions = {}; for (pattern in o) { for (state in o[pattern]) { stateArray = state.split("|"); o[pattern][state].stateArray = stateArray; for (i = 0; i < stateArray.length; i++) { transitions[stateArray[i]] = []; } } } // // 2. Fill states // for (pattern in o) { for (state in o[pattern]) { stateArray = o[pattern][state].stateArray || []; for (i = 0; i < stateArray.length; i++) { // // 2a. Normalize actions into array: 'text=' ==> [{type_:'text='}] // (Note to myself: Resolving the function here would be problematic. It would need .bind (for *this*) and currying (for *option*).) // /** @type {any} */ var p = o[pattern][state]; if (p.action_) { p.action_ = [].concat(p.action_); for (var k = 0; k < p.action_.length; k++) { if (typeof p.action_[k] === "string") { p.action_[k] = { type_: p.action_[k] }; } } } else { p.action_ = []; } // // 2.b Multi-insert // var patternArray = pattern.split("|"); for (var j = 0; j < patternArray.length; j++) { if (stateArray[i] === '*') { // insert into all for (var t in transitions) { transitions[t].push({ pattern: patternArray[j], task: p }); } } else { transitions[stateArray[i]].push({ pattern: patternArray[j], task: p }); } } } } } return transitions; }, stateMachines: {} }; // // Definition of state machines // mhchemParser.stateMachines = { // // \ce state machines // //#region ce 'ce': { // main parser transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, 'else': { '0|1|2': { action_: 'beginsWithBond=false', revisit: true, toContinue: true } }, 'oxidation$': { '0': { action_: 'oxidation-output' } }, 'CMT': { 'r': { action_: 'rdt=', nextState: 'rt' }, 'rd': { action_: 'rqt=', nextState: 'rdt' } }, 'arrowUpDown': { '0|1|2|as': { action_: ['sb=false', 'output', 'operator'], nextState: '1' } }, 'uprightEntities': { '0|1|2': { action_: ['o=', 'output'], nextState: '1' } }, 'orbital': { '0|1|2|3': { action_: 'o=', nextState: 'o' } }, '->': { '0|1|2|3': { action_: 'r=', nextState: 'r' }, 'a|as': { action_: ['output', 'r='], nextState: 'r' }, '*': { action_: ['output', 'r='], nextState: 'r' } }, '+': { 'o': { action_: 'd= kv', nextState: 'd' }, 'd|D': { action_: 'd=', nextState: 'd' }, 'q': { action_: 'd=', nextState: 'qd' }, 'qd|qD': { action_: 'd=', nextState: 'qd' }, 'dq': { action_: ['output', 'd='], nextState: 'd' }, '3': { action_: ['sb=false', 'output', 'operator'], nextState: '0' } }, 'amount': { '0|2': { action_: 'a=', nextState: 'a' } }, 'pm-operator': { '0|1|2|a|as': { action_: ['sb=false', 'output', { type_: 'operator', option: '\\pm' }], nextState: '0' } }, 'operator': { '0|1|2|a|as': { action_: ['sb=false', 'output', 'operator'], nextState: '0' } }, '-$': { 'o|q': { action_: ['charge or bond', 'output'], nextState: 'qd' }, 'd': { action_: 'd=', nextState: 'd' }, 'D': { action_: ['output', { type_: 'bond', option: "-" }], nextState: '3' }, 'q': { action_: 'd=', nextState: 'qd' }, 'qd': { action_: 'd=', nextState: 'qd' }, 'qD|dq': { action_: ['output', { type_: 'bond', option: "-" }], nextState: '3' } }, '-9': { '3|o': { action_: ['output', { type_: 'insert', option: 'hyphen' }], nextState: '3' } }, '- orbital overlap': { 'o': { action_: ['output', { type_: 'insert', option: 'hyphen' }], nextState: '2' }, 'd': { action_: ['output', { type_: 'insert', option: 'hyphen' }], nextState: '2' } }, '-': { '0|1|2': { action_: [{ type_: 'output', option: 1 }, 'beginsWithBond=true', { type_: 'bond', option: "-" }], nextState: '3' }, '3': { action_: { type_: 'bond', option: "-" } }, 'a': { action_: ['output', { type_: 'insert', option: 'hyphen' }], nextState: '2' }, 'as': { action_: [{ type_: 'output', option: 2 }, { type_: 'bond', option: "-" }], nextState: '3' }, 'b': { action_: 'b=' }, 'o': { action_: { type_: '- after o/d', option: false }, nextState: '2' }, 'q': { action_: { type_: '- after o/d', option: false }, nextState: '2' }, 'd|qd|dq': { action_: { type_: '- after o/d', option: true }, nextState: '2' }, 'D|qD|p': { action_: ['output', { type_: 'bond', option: "-" }], nextState: '3' } }, 'amount2': { '1|3': { action_: 'a=', nextState: 'a' } }, 'letters': { '0|1|2|3|a|as|b|p|bp|o': { action_: 'o=', nextState: 'o' }, 'q|dq': { action_: ['output', 'o='], nextState: 'o' }, 'd|D|qd|qD': { action_: 'o after d', nextState: 'o' } }, 'digits': { 'o': { action_: 'q=', nextState: 'q' }, 'd|D': { action_: 'q=', nextState: 'dq' }, 'q': { action_: ['output', 'o='], nextState: 'o' }, 'a': { action_: 'o=', nextState: 'o' } }, 'space A': { 'b|p|bp': {} }, 'space': { 'a': { nextState: 'as' }, '0': { action_: 'sb=false' }, '1|2': { action_: 'sb=true' }, 'r|rt|rd|rdt|rdq': { action_: 'output', nextState: '0' }, '*': { action_: ['output', 'sb=true'], nextState: '1' } }, '1st-level escape': { '1|2': { action_: ['output', { type_: 'insert+p1', option: '1st-level escape' }] }, '*': { action_: ['output', { type_: 'insert+p1', option: '1st-level escape' }], nextState: '0' } }, '[(...)]': { 'r|rt': { action_: 'rd=', nextState: 'rd' }, 'rd|rdt': { action_: 'rq=', nextState: 'rdq' } }, '...': { 'o|d|D|dq|qd|qD': { action_: ['output', { type_: 'bond', option: "..." }], nextState: '3' }, '*': { action_: [{ type_: 'output', option: 1 }, { type_: 'insert', option: 'ellipsis' }], nextState: '1' } }, '. |* ': { '*': { action_: ['output', { type_: 'insert', option: 'addition compound' }], nextState: '1' } }, 'state of aggregation $': { '*': { action_: ['output', 'state of aggregation'], nextState: '1' } }, '{[(': { 'a|as|o': { action_: ['o=', 'output', 'parenthesisLevel++'], nextState: '2' }, '0|1|2|3': { action_: ['o=', 'output', 'parenthesisLevel++'], nextState: '2' }, '*': { action_: ['output', 'o=', 'output', 'parenthesisLevel++'], nextState: '2' } }, ')]}': { '0|1|2|3|b|p|bp|o': { action_: ['o=', 'parenthesisLevel--'], nextState: 'o' }, 'a|as|d|D|q|qd|qD|dq': { action_: ['output', 'o=', 'parenthesisLevel--'], nextState: 'o' } }, ', ': { '*': { action_: ['output', 'comma'], nextState: '0' } }, '^_': { // ^ and _ without a sensible argument '*': {} }, '^{(...)}|^($...$)': { '0|1|2|as': { action_: 'b=', nextState: 'b' }, 'p': { action_: 'b=', nextState: 'bp' }, '3|o': { action_: 'd= kv', nextState: 'D' }, 'q': { action_: 'd=', nextState: 'qD' }, 'd|D|qd|qD|dq': { action_: ['output', 'd='], nextState: 'D' } }, '^a|^\\x{}{}|^\\x{}|^\\x|\'': { '0|1|2|as': { action_: 'b=', nextState: 'b' }, 'p': { action_: 'b=', nextState: 'bp' }, '3|o': { action_: 'd= kv', nextState: 'd' }, 'q': { action_: 'd=', nextState: 'qd' }, 'd|qd|D|qD': { action_: 'd=' }, 'dq': { action_: ['output', 'd='], nextState: 'd' } }, '_{(state of aggregation)}$': { 'd|D|q|qd|qD|dq': { action_: ['output', 'q='], nextState: 'q' } }, '_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x': { '0|1|2|as': { action_: 'p=', nextState: 'p' }, 'b': { action_: 'p=', nextState: 'bp' }, '3|o': { action_: 'q=', nextState: 'q' }, 'd|D': { action_: 'q=', nextState: 'dq' }, 'q|qd|qD|dq': { action_: ['output', 'q='], nextState: 'q' } }, '=<>': { '0|1|2|3|a|as|o|q|d|D|qd|qD|dq': { action_: [{ type_: 'output', option: 2 }, 'bond'], nextState: '3' } }, '#': { '0|1|2|3|a|as|o': { action_: [{ type_: 'output', option: 2 }, { type_: 'bond', option: "#" }], nextState: '3' } }, '{}': { '*': { action_: { type_: 'output', option: 1 }, nextState: '1' } }, '{...}': { '0|1|2|3|a|as|b|p|bp': { action_: 'o=', nextState: 'o' }, 'o|d|D|q|qd|qD|dq': { action_: ['output', 'o='], nextState: 'o' } }, '$...$': { 'a': { action_: 'a=' }, // 2$n$ '0|1|2|3|as|b|p|bp|o': { action_: 'o=', nextState: 'o' }, // not 'amount' 'as|o': { action_: 'o=' }, 'q|d|D|qd|qD|dq': { action_: ['output', 'o='], nextState: 'o' } }, '\\bond{(...)}': { '*': { action_: [{ type_: 'output', option: 2 }, 'bond'], nextState: "3" } }, '\\frac{(...)}': { '*': { action_: [{ type_: 'output', option: 1 }, 'frac-output'], nextState: '3' } }, '\\overset{(...)}': { '*': { action_: [{ type_: 'output', option: 2 }, 'overset-output'], nextState: '3' } }, "\\underset{(...)}": { '*': { action_: [{ type_: 'output', option: 2 }, 'underset-output'], nextState: '3' } }, "\\underbrace{(...)}": { '*': { action_: [{ type_: 'output', option: 2 }, 'underbrace-output'], nextState: '3' } }, '\\color{(...)}{(...)}1|\\color(...){(...)}2': { '*': { action_: [{ type_: 'output', option: 2 }, 'color-output'], nextState: '3' } }, '\\color{(...)}0': { '*': { action_: [{ type_: 'output', option: 2 }, 'color0-output'] } }, '\\ce{(...)}': { '*': { action_: [{ type_: 'output', option: 2 }, 'ce'], nextState: '3' } }, '\\,': { '*': { action_: [{ type_: 'output', option: 1 }, 'copy'], nextState: '1' } }, '\\x{}{}|\\x{}|\\x': { '0|1|2|3|a|as|b|p|bp|o|c0': { action_: ['o=', 'output'], nextState: '3' }, '*': { action_: ['output', 'o=', 'output'], nextState: '3' } }, 'others': { '*': { action_: [{ type_: 'output', option: 1 }, 'copy'], nextState: '3' } }, 'else2': { 'a': { action_: 'a to o', nextState: 'o', revisit: true }, 'as': { action_: ['output', 'sb=true'], nextState: '1', revisit: true }, 'r|rt|rd|rdt|rdq': { action_: ['output'], nextState: '0', revisit: true }, '*': { action_: ['output', 'copy'], nextState: '3' } } }), actions: { 'o after d': function oAfterD(buffer, m) { var ret; if ((buffer.d || "").match(/^[0-9]+$/)) { var tmp = buffer.d; buffer.d = undefined; ret = this['output'](buffer); buffer.b = tmp; } else { ret = this['output'](buffer); } mhchemParser.actions['o='](buffer, m); return ret; }, 'd= kv': function dKv(buffer, m) { buffer.d = m; buffer.dType = 'kv'; }, 'charge or bond': function chargeOrBond(buffer, m) { if (buffer['beginsWithBond']) { /** @type {ParserOutput[]} */ var ret = []; mhchemParser.concatArray(ret, this['output'](buffer)); mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-")); return ret; } else { buffer.d = m; } }, '- after o/d': function afterOD(buffer, m, isAfterD) { var c1 = mhchemParser.patterns.match_('orbital', buffer.o || ""); var c2 = mhchemParser.patterns.match_('one lowercase greek letter $', buffer.o || ""); var c3 = mhchemParser.patterns.match_('one lowercase latin letter $', buffer.o || ""); var c4 = mhchemParser.patterns.match_('$one lowercase latin letter$ $', buffer.o || ""); var hyphenFollows = m === "-" && (c1 && c1.remainder === "" || c2 || c3 || c4); if (hyphenFollows && !buffer.a && !buffer.b && !buffer.p && !buffer.d && !buffer.q && !c1 && c3) { buffer.o = '$' + buffer.o + '$'; } /** @type {ParserOutput[]} */ var ret = []; if (hyphenFollows) { mhchemParser.concatArray(ret, this['output'](buffer)); ret.push({ type_: 'hyphen' }); } else { c1 = mhchemParser.patterns.match_('digits', buffer.d || ""); if (isAfterD && c1 && c1.remainder === '') { mhchemParser.concatArray(ret, mhchemParser.actions['d='](buffer, m)); mhchemParser.concatArray(ret, this['output'](buffer)); } else { mhchemParser.concatArray(ret, this['output'](buffer)); mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-")); } } return ret; }, 'a to o': function aToO(buffer) { buffer.o = buffer.a; buffer.a = undefined; }, 'sb=true': function sbTrue(buffer) { buffer.sb = true; }, 'sb=false': function sbFalse(buffer) { buffer.sb = false; }, 'beginsWithBond=true': function beginsWithBondTrue(buffer) { buffer['beginsWithBond'] = true; }, 'beginsWithBond=false': function beginsWithBondFalse(buffer) { buffer['beginsWithBond'] = false; }, 'parenthesisLevel++': function parenthesisLevel(buffer) { buffer['parenthesisLevel']++; }, 'parenthesisLevel--': function parenthesisLevel(buffer) { buffer['parenthesisLevel']--; }, 'state of aggregation': function stateOfAggregation(buffer, m) { return { type_: 'state of aggregation', p1: mhchemParser.go(m, 'o') }; }, 'comma': function comma(buffer, m) { var a = m.replace(/\s*$/, ''); var withSpace = a !== m; if (withSpace && buffer['parenthesisLevel'] === 0) { return { type_: 'comma enumeration L', p1: a }; } else { return { type_: 'comma enumeration M', p1: a }; } }, 'output': function output(buffer, m, entityFollows) { // entityFollows: // undefined = if we have nothing else to output, also ignore the just read space (buffer.sb) // 1 = an entity follows, never omit the space if there was one just read before (can only apply to state 1) // 2 = 1 + the entity can have an amount, so output a\, instead of converting it to o (can only apply to states a|as) /** @type {ParserOutput | ParserOutput[]} */ var ret; if (!buffer.r) { ret = []; if (!buffer.a && !buffer.b && !buffer.p && !buffer.o && !buffer.q && !buffer.d && !entityFollows) {//ret = []; } else { if (buffer.sb) { ret.push({ type_: 'entitySkip' }); } if (!buffer.o && !buffer.q && !buffer.d && !buffer.b && !buffer.p && entityFollows !== 2) { buffer.o = buffer.a; buffer.a = undefined; } else if (!buffer.o && !buffer.q && !buffer.d && (buffer.b || buffer.p)) { buffer.o = buffer.a; buffer.d = buffer.b; buffer.q = buffer.p; buffer.a = buffer.b = buffer.p = undefined; } else { if (buffer.o && buffer.dType === 'kv' && mhchemParser.patterns.match_('d-oxidation$', buffer.d || "")) { buffer.dType = 'oxidation'; } else if (buffer.o && buffer.dType === 'kv' && !buffer.q) { buffer.dType = undefined; } } ret.push({ type_: 'chemfive', a: mhchemParser.go(buffer.a, 'a'), b: mhchemParser.go(buffer.b, 'bd'), p: mhchemParser.go(buffer.p, 'pq'), o: mhchemParser.go(buffer.o, 'o'), q: mhchemParser.go(buffer.q, 'pq'), d: mhchemParser.go(buffer.d, buffer.dType === 'oxidation' ? 'oxidation' : 'bd'), dType: buffer.dType }); } } else { // r /** @type {ParserOutput[]} */ var rd; if (buffer.rdt === 'M') { rd = mhchemParser.go(buffer.rd, 'tex-math'); } else if (buffer.rdt === 'T') { rd = [{ type_: 'text', p1: buffer.rd || "" }]; } else { rd = mhchemParser.go(buffer.rd); } /** @type {ParserOutput[]} */ var rq; if (buffer.rqt === 'M') { rq = mhchemParser.go(buffer.rq, 'tex-math'); } else if (buffer.rqt === 'T') { rq = [{ type_: 'text', p1: buffer.rq || "" }]; } else { rq = mhchemParser.go(buffer.rq); } ret = { type_: 'arrow', r: buffer.r, rd: rd, rq: rq }; } for (var p in buffer) { if (p !== 'parenthesisLevel' && p !== 'beginsWithBond') { delete buffer[p]; } } return ret; }, 'oxidation-output': function oxidationOutput(buffer, m) { var ret = ["{"]; mhchemParser.concatArray(ret, mhchemParser.go(m, 'oxidation')); ret.push("}"); return ret; }, 'frac-output': function fracOutput(buffer, m) { return { type_: 'frac-ce', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; }, 'overset-output': function oversetOutput(buffer, m) { return { type_: 'overset', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; }, 'underset-output': function undersetOutput(buffer, m) { return { type_: 'underset', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; }, 'underbrace-output': function underbraceOutput(buffer, m) { return { type_: 'underbrace', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; }, 'color-output': function colorOutput(buffer, m) { return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1]) }; }, 'r=': function r(buffer, m) { buffer.r = m; }, 'rdt=': function rdt(buffer, m) { buffer.rdt = m; }, 'rd=': function rd(buffer, m) { buffer.rd = m; }, 'rqt=': function rqt(buffer, m) { buffer.rqt = m; }, 'rq=': function rq(buffer, m) { buffer.rq = m; }, 'operator': function operator(buffer, m, p1) { return { type_: 'operator', kind_: p1 || m }; } } }, 'a': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, '1/2$': { '0': { action_: '1/2' } }, 'else': { '0': { nextState: '1', revisit: true } }, '$(...)$': { '*': { action_: 'tex-math tight', nextState: '1' } }, ',': { '*': { action_: { type_: 'insert', option: 'commaDecimal' } } }, 'else2': { '*': { action_: 'copy' } } }), actions: {} }, 'o': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, '1/2$': { '0': { action_: '1/2' } }, 'else': { '0': { nextState: '1', revisit: true } }, 'letters': { '*': { action_: 'rm' } }, '\\ca': { '*': { action_: { type_: 'insert', option: 'circa' } } }, '\\x{}{}|\\x{}|\\x': { '*': { action_: 'copy' } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, '{(...)}': { '*': { action_: '{text}' } }, 'else2': { '*': { action_: 'copy' } } }), actions: {} }, 'text': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, '{...}': { '*': { action_: 'text=' } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, '\\greek': { '*': { action_: ['output', 'rm'] } }, '\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: ['output', 'copy'] } }, 'else': { '*': { action_: 'text=' } } }), actions: { 'output': function output(buffer) { if (buffer.text_) { /** @type {ParserOutput} */ var ret = { type_: 'text', p1: buffer.text_ }; for (var p in buffer) { delete buffer[p]; } return ret; } } } }, 'pq': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, 'state of aggregation $': { '*': { action_: 'state of aggregation' } }, 'i$': { '0': { nextState: '!f', revisit: true } }, '(KV letters),': { '0': { action_: 'rm', nextState: '0' } }, 'formula$': { '0': { nextState: 'f', revisit: true } }, '1/2$': { '0': { action_: '1/2' } }, 'else': { '0': { nextState: '!f', revisit: true } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, '{(...)}': { '*': { action_: 'text' } }, 'a-z': { 'f': { action_: 'tex-math' } }, 'letters': { '*': { action_: 'rm' } }, '-9.,9': { '*': { action_: '9,9' } }, ',': { '*': { action_: { type_: 'insert+p1', option: 'comma enumeration S' } } }, '\\color{(...)}{(...)}1|\\color(...){(...)}2': { '*': { action_: 'color-output' } }, '\\color{(...)}0': { '*': { action_: 'color0-output' } }, '\\ce{(...)}': { '*': { action_: 'ce' } }, '\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: 'copy' } }, 'else2': { '*': { action_: 'copy' } } }), actions: { 'state of aggregation': function stateOfAggregation(buffer, m) { return { type_: 'state of aggregation subscript', p1: mhchemParser.go(m, 'o') }; }, 'color-output': function colorOutput(buffer, m) { return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1], 'pq') }; } } }, 'bd': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, 'x$': { '0': { nextState: '!f', revisit: true } }, 'formula$': { '0': { nextState: 'f', revisit: true } }, 'else': { '0': { nextState: '!f', revisit: true } }, '-9.,9 no missing 0': { '*': { action_: '9,9' } }, '.': { '*': { action_: { type_: 'insert', option: 'electron dot' } } }, 'a-z': { 'f': { action_: 'tex-math' } }, 'x': { '*': { action_: { type_: 'insert', option: 'KV x' } } }, 'letters': { '*': { action_: 'rm' } }, '\'': { '*': { action_: { type_: 'insert', option: 'prime' } } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, '{(...)}': { '*': { action_: 'text' } }, '\\color{(...)}{(...)}1|\\color(...){(...)}2': { '*': { action_: 'color-output' } }, '\\color{(...)}0': { '*': { action_: 'color0-output' } }, '\\ce{(...)}': { '*': { action_: 'ce' } }, '\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: 'copy' } }, 'else2': { '*': { action_: 'copy' } } }), actions: { 'color-output': function colorOutput(buffer, m) { return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1], 'bd') }; } } }, 'oxidation': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, 'roman numeral': { '*': { action_: 'roman-numeral' } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, 'else': { '*': { action_: 'copy' } } }), actions: { 'roman-numeral': function romanNumeral(buffer, m) { return { type_: 'roman numeral', p1: m || "" }; } } }, 'tex-math': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, '\\ce{(...)}': { '*': { action_: ['output', 'ce'] } }, '{...}|\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: 'o=' } }, 'else': { '*': { action_: 'o=' } } }), actions: { 'output': function output(buffer) { if (buffer.o) { /** @type {ParserOutput} */ var ret = { type_: 'tex-math', p1: buffer.o }; for (var p in buffer) { delete buffer[p]; } return ret; } } } }, 'tex-math tight': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, '\\ce{(...)}': { '*': { action_: ['output', 'ce'] } }, '{...}|\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: 'o=' } }, '-|+': { '*': { action_: 'tight operator' } }, 'else': { '*': { action_: 'o=' } } }), actions: { 'tight operator': function tightOperator(buffer, m) { buffer.o = (buffer.o || "") + "{" + m + "}"; }, 'output': function output(buffer) { if (buffer.o) { /** @type {ParserOutput} */ var ret = { type_: 'tex-math', p1: buffer.o }; for (var p in buffer) { delete buffer[p]; } return ret; } } } }, '9,9': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, ',': { '*': { action_: 'comma' } }, 'else': { '*': { action_: 'copy' } } }), actions: { 'comma': function comma() { return { type_: 'commaDecimal' }; } } }, //#endregion // // \pu state machines // //#region pu 'pu': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, 'space$': { '*': { action_: ['output', 'space'] } }, '{[(|)]}': { '0|a': { action_: 'copy' } }, '(-)(9)^(-9)': { '0': { action_: 'number^', nextState: 'a' } }, '(-)(9.,9)(e)(99)': { '0': { action_: 'enumber', nextState: 'a' } }, 'space': { '0|a': {} }, 'pm-operator': { '0|a': { action_: { type_: 'operator', option: '\\pm' }, nextState: '0' } }, 'operator': { '0|a': { action_: 'copy', nextState: '0' } }, '//': { 'd': { action_: 'o=', nextState: '/' } }, '/': { 'd': { action_: 'o=', nextState: '/' } }, '{...}|else': { '0|d': { action_: 'd=', nextState: 'd' }, 'a': { action_: ['space', 'd='], nextState: 'd' }, '/|q': { action_: 'q=', nextState: 'q' } } }), actions: { 'enumber': function enumber(buffer, m) { /** @type {ParserOutput[]} */ var ret = []; if (m[0] === "+-" || m[0] === "+/-") { ret.push("\\pm "); } else if (m[0]) { ret.push(m[0]); } if (m[1]) { mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9')); if (m[2]) { if (m[2].match(/[,.]/)) { mhchemParser.concatArray(ret, mhchemParser.go(m[2], 'pu-9,9')); } else { ret.push(m[2]); } } m[3] = m[4] || m[3]; if (m[3]) { m[3] = m[3].trim(); if (m[3] === "e" || m[3].substr(0, 1) === "*") { ret.push({ type_: 'cdot' }); } else { ret.push({ type_: 'times' }); } } } if (m[3]) { ret.push("10^{" + m[5] + "}"); } return ret; }, 'number^': function number(buffer, m) { /** @type {ParserOutput[]} */ var ret = []; if (m[0] === "+-" || m[0] === "+/-") { ret.push("\\pm "); } else if (m[0]) { ret.push(m[0]); } mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9')); ret.push("^{" + m[2] + "}"); return ret; }, 'operator': function operator(buffer, m, p1) { return { type_: 'operator', kind_: p1 || m }; }, 'space': function space() { return { type_: 'pu-space-1' }; }, 'output': function output(buffer) { /** @type {ParserOutput | ParserOutput[]} */ var ret; var md = mhchemParser.patterns.match_('{(...)}', buffer.d || ""); if (md && md.remainder === '') { buffer.d = md.match_; } var mq = mhchemParser.patterns.match_('{(...)}', buffer.q || ""); if (mq && mq.remainder === '') { buffer.q = mq.match_; } if (buffer.d) { buffer.d = buffer.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"); buffer.d = buffer.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F"); } if (buffer.q) { // fraction buffer.q = buffer.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"); buffer.q = buffer.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F"); var b5 = { d: mhchemParser.go(buffer.d, 'pu'), q: mhchemParser.go(buffer.q, 'pu') }; if (buffer.o === '//') { ret = { type_: 'pu-frac', p1: b5.d, p2: b5.q }; } else { ret = b5.d; if (b5.d.length > 1 || b5.q.length > 1) { ret.push({ type_: ' / ' }); } else { ret.push({ type_: '/' }); } mhchemParser.concatArray(ret, b5.q); } } else { // no fraction ret = mhchemParser.go(buffer.d, 'pu-2'); } for (var p in buffer) { delete buffer[p]; } return ret; } } }, 'pu-2': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, '*': { '*': { action_: ['output', 'cdot'], nextState: '0' } }, '\\x': { '*': { action_: 'rm=' } }, 'space': { '*': { action_: ['output', 'space'], nextState: '0' } }, '^{(...)}|^(-1)': { '1': { action_: '^(-1)' } }, '-9.,9': { '0': { action_: 'rm=', nextState: '0' }, '1': { action_: '^(-1)', nextState: '0' } }, '{...}|else': { '*': { action_: 'rm=', nextState: '1' } } }), actions: { 'cdot': function cdot() { return { type_: 'tight cdot' }; }, '^(-1)': function _(buffer, m) { buffer.rm += "^{" + m + "}"; }, 'space': function space() { return { type_: 'pu-space-2' }; }, 'output': function output(buffer) { /** @type {ParserOutput | ParserOutput[]} */ var ret = []; if (buffer.rm) { var mrm = mhchemParser.patterns.match_('{(...)}', buffer.rm || ""); if (mrm && mrm.remainder === '') { ret = mhchemParser.go(mrm.match_, 'pu'); } else { ret = { type_: 'rm', p1: buffer.rm }; } } for (var p in buffer) { delete buffer[p]; } return ret; } } }, 'pu-9,9': { transitions: mhchemParser.createTransitions({ 'empty': { '0': { action_: 'output-0' }, 'o': { action_: 'output-o' } }, ',': { '0': { action_: ['output-0', 'comma'], nextState: 'o' } }, '.': { '0': { action_: ['output-0', 'copy'], nextState: 'o' } }, 'else': { '*': { action_: 'text=' } } }), actions: { 'comma': function comma() { return { type_: 'commaDecimal' }; }, 'output-0': function output0(buffer) { /** @type {ParserOutput[]} */ var ret = []; buffer.text_ = buffer.text_ || ""; if (buffer.text_.length > 4) { var a = buffer.text_.length % 3; if (a === 0) { a = 3; } for (var i = buffer.text_.length - 3; i > 0; i -= 3) { ret.push(buffer.text_.substr(i, 3)); ret.push({ type_: '1000 separator' }); } ret.push(buffer.text_.substr(0, a)); ret.reverse(); } else { ret.push(buffer.text_); } for (var p in buffer) { delete buffer[p]; } return ret; }, 'output-o': function outputO(buffer) { /** @type {ParserOutput[]} */ var ret = []; buffer.text_ = buffer.text_ || ""; if (buffer.text_.length > 4) { var a = buffer.text_.length - 3; for (var i = 0; i < a; i += 3) { ret.push(buffer.text_.substr(i, 3)); ret.push({ type_: '1000 separator' }); } ret.push(buffer.text_.substr(i)); } else { ret.push(buffer.text_); } for (var p in buffer) { delete buffer[p]; } return ret; } } //#endregion } }; // // texify: Take MhchemParser output and convert it to TeX // /** @type {Texify} */ var texify = { go: function go(input, isInner) { // (recursive, max 4 levels) if (!input) { return ""; } var res = ""; var cee = false; for (var i = 0; i < input.length; i++) { var inputi = input[i]; if (typeof inputi === "string") { res += inputi; } else { res += texify._go2(inputi); if (inputi.type_ === '1st-level escape') { cee = true; } } } if (!isInner && !cee && res) { res = "{" + res + "}"; } return res; }, _goInner: function _goInner(input) { if (!input) { return input; } return texify.go(input, true); }, _go2: function _go2(buf) { /** @type {undefined | string} */ var res; switch (buf.type_) { case 'chemfive': res = ""; var b5 = { a: texify._goInner(buf.a), b: texify._goInner(buf.b), p: texify._goInner(buf.p), o: texify._goInner(buf.o), q: texify._goInner(buf.q), d: texify._goInner(buf.d) }; // // a // if (b5.a) { if (b5.a.match(/^[+\-]/)) { b5.a = "{" + b5.a + "}"; } res += b5.a + "\\,"; } // // b and p // if (b5.b || b5.p) { res += "{\\vphantom{X}}"; res += "^{\\hphantom{" + (b5.b || "") + "}}_{\\hphantom{" + (b5.p || "") + "}}"; res += "{\\vphantom{X}}"; res += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (b5.b || "") + "}}"; res += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (b5.p || "") + "}}}"; } // // o // if (b5.o) { if (b5.o.match(/^[+\-]/)) { b5.o = "{" + b5.o + "}"; } res += b5.o; } // // q and d // if (buf.dType === 'kv') { if (b5.d || b5.q) { res += "{\\vphantom{X}}"; } if (b5.d) { res += "^{" + b5.d + "}"; } if (b5.q) { res += "_{\\smash[t]{" + b5.q + "}}"; } } else if (buf.dType === 'oxidation') { if (b5.d) { res += "{\\vphantom{X}}"; res += "^{" + b5.d + "}"; } if (b5.q) { res += "{\\vphantom{X}}"; res += "_{\\smash[t]{" + b5.q + "}}"; } } else { if (b5.q) { res += "{\\vphantom{X}}"; res += "_{\\smash[t]{" + b5.q + "}}"; } if (b5.d) { res += "{\\vphantom{X}}"; res += "^{" + b5.d + "}"; } } break; case 'rm': res = "\\mathrm{" + buf.p1 + "}"; break; case 'text': if (buf.p1.match(/[\^_]/)) { buf.p1 = buf.p1.replace(" ", "~").replace("-", "\\text{-}"); res = "\\mathrm{" + buf.p1 + "}"; } else { res = "\\text{" + buf.p1 + "}"; } break; case 'roman numeral': res = "\\mathrm{" + buf.p1 + "}"; break; case 'state of aggregation': res = "\\mskip2mu " + texify._goInner(buf.p1); break; case 'state of aggregation subscript': res = "\\mskip1mu " + texify._goInner(buf.p1); break; case 'bond': res = texify._getBond(buf.kind_); if (!res) { throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + buf.kind_ + ")"]; } break; case 'frac': var c = "\\frac{" + buf.p1 + "}{" + buf.p2 + "}"; res = "\\mathchoice{\\textstyle" + c + "}{" + c + "}{" + c + "}{" + c + "}"; break; case 'pu-frac': var d = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}"; res = "\\mathchoice{\\textstyle" + d + "}{" + d + "}{" + d + "}{" + d + "}"; break; case 'tex-math': res = buf.p1 + " "; break; case 'frac-ce': res = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}"; break; case 'overset': res = "\\overset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}"; break; case 'underset': res = "\\underset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}"; break; case 'underbrace': res = "\\underbrace{" + texify._goInner(buf.p1) + "}_{" + texify._goInner(buf.p2) + "}"; break; case 'color': res = "{\\color{" + buf.color1 + "}{" + texify._goInner(buf.color2) + "}}"; break; case 'color0': res = "\\color{" + buf.color + "}"; break; case 'arrow': var b6 = { rd: texify._goInner(buf.rd), rq: texify._goInner(buf.rq) }; var arrow = "\\x" + texify._getArrow(buf.r); if (b6.rq) { arrow += "[{" + b6.rq + "}]"; } if (b6.rd) { arrow += "{" + b6.rd + "}"; } else { arrow += "{}"; } res = arrow; break; case 'operator': res = texify._getOperator(buf.kind_); break; case '1st-level escape': res = buf.p1 + " "; // &, \\\\, \\hlin break; case 'space': res = " "; break; case 'entitySkip': res = "~"; break; case 'pu-space-1': res = "~"; break; case 'pu-space-2': res = "\\mkern3mu "; break; case '1000 separator': res = "\\mkern2mu "; break; case 'commaDecimal': res = "{,}"; break; case 'comma enumeration L': res = "{" + buf.p1 + "}\\mkern6mu "; break; case 'comma enumeration M': res = "{" + buf.p1 + "}\\mkern3mu "; break; case 'comma enumeration S': res = "{" + buf.p1 + "}\\mkern1mu "; break; case 'hyphen': res = "\\text{-}"; break; case 'addition compound': res = "\\,{\\cdot}\\,"; break; case 'electron dot': res = "\\mkern1mu \\bullet\\mkern1mu "; break; case 'KV x': res = "{\\times}"; break; case 'prime': res = "\\prime "; break; case 'cdot': res = "\\cdot "; break; case 'tight cdot': res = "\\mkern1mu{\\cdot}\\mkern1mu "; break; case 'times': res = "\\times "; break; case 'circa': res = "{\\sim}"; break; case '^': res = "uparrow"; break; case 'v': res = "downarrow"; break; case 'ellipsis': res = "\\ldots "; break; case '/': res = "/"; break; case ' / ': res = "\\,/\\,"; break; default: assertNever(buf); throw ["MhchemBugT", "mhchem bug T. Please report."]; // Missing texify rule or unknown MhchemParser output } assertString(res); return res; }, _getArrow: function _getArrow(a) { switch (a) { case "->": return "rightarrow"; case "\u2192": return "rightarrow"; case "\u27F6": return "rightarrow"; case "<-": return "leftarrow"; case "<->": return "leftrightarrow"; case "<-->": return "rightleftarrows"; case "<=>": return "rightleftharpoons"; case "\u21CC": return "rightleftharpoons"; case "<=>>": return "rightequilibrium"; case "<<=>": return "leftequilibrium"; default: assertNever(a); throw ["MhchemBugT", "mhchem bug T. Please report."]; } }, _getBond: function _getBond(a) { switch (a) { case "-": return "{-}"; case "1": return "{-}"; case "=": return "{=}"; case "2": return "{=}"; case "#": return "{\\equiv}"; case "3": return "{\\equiv}"; case "~": return "{\\tripledash}"; case "~-": return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}"; case "~=": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}"; case "~--": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}"; case "-~-": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}"; case "...": return "{{\\cdot}{\\cdot}{\\cdot}}"; case "....": return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}"; case "->": return "{\\rightarrow}"; case "<-": return "{\\leftarrow}"; case "<": return "{<}"; case ">": return "{>}"; default: assertNever(a); throw ["MhchemBugT", "mhchem bug T. Please report."]; } }, _getOperator: function _getOperator(a) { switch (a) { case "+": return " {}+{} "; case "-": return " {}-{} "; case "=": return " {}={} "; case "<": return " {}<{} "; case ">": return " {}>{} "; case "<<": return " {}\\ll{} "; case ">>": return " {}\\gg{} "; case "\\pm": return " {}\\pm{} "; case "\\approx": return " {}\\approx{} "; case "$\\approx$": return " {}\\approx{} "; case "v": return " \\downarrow{} "; case "(v)": return " \\downarrow{} "; case "^": return " \\uparrow{} "; case "(^)": return " \\uparrow{} "; default: assertNever(a); throw ["MhchemBugT", "mhchem bug T. Please report."]; } } }; // // Helpers for code anaylsis // Will show type error at calling position // /** @param {number} a */ function assertNever(a) {} /** @param {string} a */ function assertString(a) {} /***/ }) /******/ ])["default"]; }); ================================================ FILE: source/lib/katex@0.12.0/contrib/mhchem.mjs ================================================ import katex from '../katex.mjs'; /* eslint-disable */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * KaTeX mhchem.js * * This file implements a KaTeX version of mhchem version 3.3.0. * It is adapted from MathJax/extensions/TeX/mhchem.js * It differs from the MathJax version as follows: * 1. The interface is changed so that it can be called from KaTeX, not MathJax. * 2. \rlap and \llap are replaced with \mathrlap and \mathllap. * 3. Four lines of code are edited in order to use \raisebox instead of \raise. * 4. The reaction arrow code is simplified. All reaction arrows are rendered * using KaTeX extensible arrows instead of building non-extensible arrows. * 5. \tripledash vertical alignment is slightly adjusted. * * This code, as other KaTeX code, is released under the MIT license. * * /************************************************************* * * MathJax/extensions/TeX/mhchem.js * * Implements the \ce command for handling chemical formulas * from the mhchem LaTeX package. * * --------------------------------------------------------------------- * * Copyright (c) 2011-2015 The MathJax Consortium * Copyright (c) 2015-2018 Martin Hensel * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Coding Style // - use '' for identifiers that can by minified/uglified // - use "" for strings that need to stay untouched // version: "3.3.0" for MathJax and KaTeX // Add \ce, \pu, and \tripledash to the KaTeX macros. katex.__defineMacro("\\ce", function (context) { return chemParse(context.consumeArgs(1)[0], "ce"); }); katex.__defineMacro("\\pu", function (context) { return chemParse(context.consumeArgs(1)[0], "pu"); }); // Needed for \bond for the ~ forms // Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not // a mathematical minus, U+2212. So we need that extra 0.56. katex.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}"); // This is the main function for handing the \ce and \pu commands. // It takes the argument to \ce or \pu and returns the corresponding TeX string. // var chemParse = function chemParse(tokens, stateMachine) { // Recreate the argument string from KaTeX's array of tokens. var str = ""; var expectedLoc = tokens[tokens.length - 1].loc.start; for (var i = tokens.length - 1; i >= 0; i--) { if (tokens[i].loc.start > expectedLoc) { // context.consumeArgs has eaten a space. str += " "; expectedLoc = tokens[i].loc.start; } str += tokens[i].text; expectedLoc += tokens[i].text.length; } var tex = texify.go(mhchemParser.go(str, stateMachine)); return tex; }; // // Core parser for mhchem syntax (recursive) // /** @type {MhchemParser} */ var mhchemParser = { // // Parses mchem \ce syntax // // Call like // go("H2O"); // go: function go(input, stateMachine) { if (!input) { return []; } if (stateMachine === undefined) { stateMachine = 'ce'; } var state = '0'; // // String buffers for parsing: // // buffer.a == amount // buffer.o == element // buffer.b == left-side superscript // buffer.p == left-side subscript // buffer.q == right-side subscript // buffer.d == right-side superscript // // buffer.r == arrow // buffer.rdt == arrow, script above, type // buffer.rd == arrow, script above, content // buffer.rqt == arrow, script below, type // buffer.rq == arrow, script below, content // // buffer.text_ // buffer.rm // etc. // // buffer.parenthesisLevel == int, starting at 0 // buffer.sb == bool, space before // buffer.beginsWithBond == bool // // These letters are also used as state names. // // Other states: // 0 == begin of main part (arrow/operator unlikely) // 1 == next entity // 2 == next entity (arrow/operator unlikely) // 3 == next atom // c == macro // /** @type {Buffer} */ var buffer = {}; buffer['parenthesisLevel'] = 0; input = input.replace(/\n/g, " "); input = input.replace(/[\u2212\u2013\u2014\u2010]/g, "-"); input = input.replace(/[\u2026]/g, "..."); // // Looks through mhchemParser.transitions, to execute a matching action // (recursive) // var lastInput; var watchdog = 10; /** @type {ParserOutput[]} */ var output = []; while (true) { if (lastInput !== input) { watchdog = 10; lastInput = input; } else { watchdog--; } // // Find actions in transition table // var machine = mhchemParser.stateMachines[stateMachine]; var t = machine.transitions[state] || machine.transitions['*']; iterateTransitions: for (var i = 0; i < t.length; i++) { var matches = mhchemParser.patterns.match_(t[i].pattern, input); if (matches) { // // Execute actions // var task = t[i].task; for (var iA = 0; iA < task.action_.length; iA++) { var o; // // Find and execute action // if (machine.actions[task.action_[iA].type_]) { o = machine.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option); } else if (mhchemParser.actions[task.action_[iA].type_]) { o = mhchemParser.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option); } else { throw ["MhchemBugA", "mhchem bug A. Please report. (" + task.action_[iA].type_ + ")"]; // Trying to use non-existing action } // // Add output // mhchemParser.concatArray(output, o); } // // Set next state, // Shorten input, // Continue with next character // (= apply only one transition per position) // state = task.nextState || state; if (input.length > 0) { if (!task.revisit) { input = matches.remainder; } if (!task.toContinue) { break; } } else { return output; } } } // // Prevent infinite loop // if (watchdog <= 0) { throw ["MhchemBugU", "mhchem bug U. Please report."]; // Unexpected character } } }, concatArray: function concatArray(a, b) { if (b) { if (Array.isArray(b)) { for (var iB = 0; iB < b.length; iB++) { a.push(b[iB]); } } else { a.push(b); } } }, patterns: { // // Matching patterns // either regexps or function that return null or {match_:"a", remainder:"bc"} // patterns: { // property names must not look like integers ("2") for correct property traversal order, later on 'empty': /^$/, 'else': /^./, 'else2': /^./, 'space': /^\s/, 'space A': /^\s(?=[A-Z\\$])/, 'space$': /^\s$/, 'a-z': /^[a-z]/, 'x': /^x/, 'x$': /^x$/, 'i$': /^i$/, 'letters': /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/, '\\greek': /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/, 'one lowercase latin letter $': /^(?:([a-z])(?:$|[^a-zA-Z]))$/, '$one lowercase latin letter$ $': /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/, 'one lowercase greek letter $': /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/, 'digits': /^[0-9]+/, '-9.,9': /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/, '-9.,9 no missing 0': /^[+\-]?[0-9]+(?:[.,][0-9]+)?/, '(-)(9.,9)(e)(99)': function e99(input) { var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/); if (m && m[0]) { return { match_: m.splice(1), remainder: input.substr(m[0].length) }; } return null; }, '(-)(9)^(-9)': function _(input) { var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/); if (m && m[0]) { return { match_: m.splice(1), remainder: input.substr(m[0].length) }; } return null; }, 'state of aggregation $': function stateOfAggregation$(input) { // ... or crystal system var a = mhchemParser.patterns.findObserveGroups(input, "", /^\([a-z]{1,3}(?=[\),])/, ")", ""); // (aq), (aq,$\infty$), (aq, sat) if (a && a.remainder.match(/^($|[\s,;\)\]\}])/)) { return a; } // AND end of 'phrase' var m = input.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/); // OR crystal system ($o$) (\ca$c$) if (m) { return { match_: m[0], remainder: input.substr(m[0].length) }; } return null; }, '_{(state of aggregation)}$': /^_\{(\([a-z]{1,3}\))\}/, '{[(': /^(?:\\\{|\[|\()/, ')]}': /^(?:\)|\]|\\\})/, ', ': /^[,;]\s*/, ',': /^[,;]/, '.': /^[.]/, '. ': /^([.\u22C5\u00B7\u2022])\s*/, '...': /^\.\.\.(?=$|[^.])/, '* ': /^([*])\s*/, '^{(...)}': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "^{", "", "", "}"); }, '^($...$)': function $$(input) { return mhchemParser.patterns.findObserveGroups(input, "^", "$", "$", ""); }, '^a': /^\^([0-9]+|[^\\_])/, '^\\x{}{}': function x(input) { return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true); }, '^\\x{}': function x(input) { return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", ""); }, '^\\x': /^\^(\\[a-zA-Z]+)\s*/, '^(-1)': /^\^(-?\d+)/, '\'': /^'/, '_{(...)}': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "_{", "", "", "}"); }, '_($...$)': function _$$(input) { return mhchemParser.patterns.findObserveGroups(input, "_", "$", "$", ""); }, '_9': /^_([+\-]?[0-9]+|[^\\])/, '_\\x{}{}': function _X(input) { return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true); }, '_\\x{}': function _X(input) { return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", ""); }, '_\\x': /^_(\\[a-zA-Z]+)\s*/, '^_': /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/, '{}': /^\{\}/, '{...}': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "", "{", "}", ""); }, '{(...)}': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "{", "", "", "}"); }, '$...$': function $$(input) { return mhchemParser.patterns.findObserveGroups(input, "", "$", "$", ""); }, '${(...)}$': function $$(input) { return mhchemParser.patterns.findObserveGroups(input, "${", "", "", "}$"); }, '$(...)$': function $$(input) { return mhchemParser.patterns.findObserveGroups(input, "$", "", "", "$"); }, '=<>': /^[=<>]/, '#': /^[#\u2261]/, '+': /^\+/, '-$': /^-(?=[\s_},;\]/]|$|\([a-z]+\))/, // -space -, -; -] -/ -$ -state-of-aggregation '-9': /^-(?=[0-9])/, '- orbital overlap': /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/, '-': /^-/, 'pm-operator': /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/, 'operator': /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/, 'arrowUpDown': /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/, '\\bond{(...)}': function bond(input) { return mhchemParser.patterns.findObserveGroups(input, "\\bond{", "", "", "}"); }, '->': /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/, 'CMT': /^[CMT](?=\[)/, '[(...)]': function _(input) { return mhchemParser.patterns.findObserveGroups(input, "[", "", "", "]"); }, '1st-level escape': /^(&|\\\\|\\hline)\s*/, '\\,': /^(?:\\[,\ ;:])/, // \\x - but output no space before '\\x{}{}': function x(input) { return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true); }, '\\x{}': function x(input) { return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", ""); }, '\\ca': /^\\ca(?:\s+|(?![a-zA-Z]))/, '\\x': /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/, 'orbital': /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/, // only those with numbers in front, because the others will be formatted correctly anyway 'others': /^[\/~|]/, '\\frac{(...)}': function frac(input) { return mhchemParser.patterns.findObserveGroups(input, "\\frac{", "", "", "}", "{", "", "", "}"); }, '\\overset{(...)}': function overset(input) { return mhchemParser.patterns.findObserveGroups(input, "\\overset{", "", "", "}", "{", "", "", "}"); }, '\\underset{(...)}': function underset(input) { return mhchemParser.patterns.findObserveGroups(input, "\\underset{", "", "", "}", "{", "", "", "}"); }, '\\underbrace{(...)}': function underbrace(input) { return mhchemParser.patterns.findObserveGroups(input, "\\underbrace{", "", "", "}_", "{", "", "", "}"); }, '\\color{(...)}0': function color0(input) { return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}"); }, '\\color{(...)}{(...)}1': function color1(input) { return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}", "{", "", "", "}"); }, '\\color(...){(...)}2': function color2(input) { return mhchemParser.patterns.findObserveGroups(input, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}"); }, '\\ce{(...)}': function ce(input) { return mhchemParser.patterns.findObserveGroups(input, "\\ce{", "", "", "}"); }, 'oxidation$': /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/, 'd-oxidation$': /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/, // 0 could be oxidation or charge 'roman numeral': /^[IVX]+/, '1/2$': /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/, 'amount': function amount(input) { var match; // e.g. 2, 0.5, 1/2, -2, n/2, +; $a$ could be added later in parsing match = input.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/); if (match) { return { match_: match[0], remainder: input.substr(match[0].length) }; } var a = mhchemParser.patterns.findObserveGroups(input, "", "$", "$", ""); if (a) { // e.g. $2n-1$, $-$ match = a.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/); if (match) { return { match_: match[0], remainder: input.substr(match[0].length) }; } } return null; }, 'amount2': function amount2(input) { return this['amount'](input); }, '(KV letters),': /^(?:[A-Z][a-z]{0,2}|i)(?=,)/, 'formula$': function formula$(input) { if (input.match(/^\([a-z]+\)$/)) { return null; } // state of aggregation = no formula var match = input.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/); if (match) { return { match_: match[0], remainder: input.substr(match[0].length) }; } return null; }, 'uprightEntities': /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/, '/': /^\s*(\/)\s*/, '//': /^\s*(\/\/)\s*/, '*': /^\s*[*.]\s*/ }, findObserveGroups: function findObserveGroups(input, begExcl, begIncl, endIncl, endExcl, beg2Excl, beg2Incl, end2Incl, end2Excl, combine) { /** @type {{(input: string, pattern: string | RegExp): string | string[] | null;}} */ var _match = function _match(input, pattern) { if (typeof pattern === "string") { if (input.indexOf(pattern) !== 0) { return null; } return pattern; } else { var match = input.match(pattern); if (!match) { return null; } return match[0]; } }; /** @type {{(input: string, i: number, endChars: string | RegExp): {endMatchBegin: number, endMatchEnd: number} | null;}} */ var _findObserveGroups = function _findObserveGroups(input, i, endChars) { var braces = 0; while (i < input.length) { var a = input.charAt(i); var match = _match(input.substr(i), endChars); if (match !== null && braces === 0) { return { endMatchBegin: i, endMatchEnd: i + match.length }; } else if (a === "{") { braces++; } else if (a === "}") { if (braces === 0) { throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"]; } else { braces--; } } i++; } if (braces > 0) { return null; } return null; }; var match = _match(input, begExcl); if (match === null) { return null; } input = input.substr(match.length); match = _match(input, begIncl); if (match === null) { return null; } var e = _findObserveGroups(input, match.length, endIncl || endExcl); if (e === null) { return null; } var match1 = input.substring(0, endIncl ? e.endMatchEnd : e.endMatchBegin); if (!(beg2Excl || beg2Incl)) { return { match_: match1, remainder: input.substr(e.endMatchEnd) }; } else { var group2 = this.findObserveGroups(input.substr(e.endMatchEnd), beg2Excl, beg2Incl, end2Incl, end2Excl); if (group2 === null) { return null; } /** @type {string[]} */ var matchRet = [match1, group2.match_]; return { match_: combine ? matchRet.join("") : matchRet, remainder: group2.remainder }; } }, // // Matching function // e.g. match("a", input) will look for the regexp called "a" and see if it matches // returns null or {match_:"a", remainder:"bc"} // match_: function match_(m, input) { var pattern = mhchemParser.patterns.patterns[m]; if (pattern === undefined) { throw ["MhchemBugP", "mhchem bug P. Please report. (" + m + ")"]; // Trying to use non-existing pattern } else if (typeof pattern === "function") { return mhchemParser.patterns.patterns[m](input); // cannot use cached var pattern here, because some pattern functions need this===mhchemParser } else { // RegExp var match = input.match(pattern); if (match) { var mm; if (match[2]) { mm = [match[1], match[2]]; } else if (match[1]) { mm = match[1]; } else { mm = match[0]; } return { match_: mm, remainder: input.substr(match[0].length) }; } return null; } } }, // // Generic state machine actions // actions: { 'a=': function a(buffer, m) { buffer.a = (buffer.a || "") + m; }, 'b=': function b(buffer, m) { buffer.b = (buffer.b || "") + m; }, 'p=': function p(buffer, m) { buffer.p = (buffer.p || "") + m; }, 'o=': function o(buffer, m) { buffer.o = (buffer.o || "") + m; }, 'q=': function q(buffer, m) { buffer.q = (buffer.q || "") + m; }, 'd=': function d(buffer, m) { buffer.d = (buffer.d || "") + m; }, 'rm=': function rm(buffer, m) { buffer.rm = (buffer.rm || "") + m; }, 'text=': function text(buffer, m) { buffer.text_ = (buffer.text_ || "") + m; }, 'insert': function insert(buffer, m, a) { return { type_: a }; }, 'insert+p1': function insertP1(buffer, m, a) { return { type_: a, p1: m }; }, 'insert+p1+p2': function insertP1P2(buffer, m, a) { return { type_: a, p1: m[0], p2: m[1] }; }, 'copy': function copy(buffer, m) { return m; }, 'rm': function rm(buffer, m) { return { type_: 'rm', p1: m || "" }; }, 'text': function text(buffer, m) { return mhchemParser.go(m, 'text'); }, '{text}': function text(buffer, m) { var ret = ["{"]; mhchemParser.concatArray(ret, mhchemParser.go(m, 'text')); ret.push("}"); return ret; }, 'tex-math': function texMath(buffer, m) { return mhchemParser.go(m, 'tex-math'); }, 'tex-math tight': function texMathTight(buffer, m) { return mhchemParser.go(m, 'tex-math tight'); }, 'bond': function bond(buffer, m, k) { return { type_: 'bond', kind_: k || m }; }, 'color0-output': function color0Output(buffer, m) { return { type_: 'color0', color: m[0] }; }, 'ce': function ce(buffer, m) { return mhchemParser.go(m); }, '1/2': function _(buffer, m) { /** @type {ParserOutput[]} */ var ret = []; if (m.match(/^[+\-]/)) { ret.push(m.substr(0, 1)); m = m.substr(1); } var n = m.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/); n[1] = n[1].replace(/\$/g, ""); ret.push({ type_: 'frac', p1: n[1], p2: n[2] }); if (n[3]) { n[3] = n[3].replace(/\$/g, ""); ret.push({ type_: 'tex-math', p1: n[3] }); } return ret; }, '9,9': function _(buffer, m) { return mhchemParser.go(m, '9,9'); } }, // // createTransitions // convert { 'letter': { 'state': { action_: 'output' } } } to { 'state' => [ { pattern: 'letter', task: { action_: [{type_: 'output'}] } } ] } // with expansion of 'a|b' to 'a' and 'b' (at 2 places) // createTransitions: function createTransitions(o) { var pattern, state; /** @type {string[]} */ var stateArray; var i; // // 1. Collect all states // /** @type {Transitions} */ var transitions = {}; for (pattern in o) { for (state in o[pattern]) { stateArray = state.split("|"); o[pattern][state].stateArray = stateArray; for (i = 0; i < stateArray.length; i++) { transitions[stateArray[i]] = []; } } } // // 2. Fill states // for (pattern in o) { for (state in o[pattern]) { stateArray = o[pattern][state].stateArray || []; for (i = 0; i < stateArray.length; i++) { // // 2a. Normalize actions into array: 'text=' ==> [{type_:'text='}] // (Note to myself: Resolving the function here would be problematic. It would need .bind (for *this*) and currying (for *option*).) // /** @type {any} */ var p = o[pattern][state]; if (p.action_) { p.action_ = [].concat(p.action_); for (var k = 0; k < p.action_.length; k++) { if (typeof p.action_[k] === "string") { p.action_[k] = { type_: p.action_[k] }; } } } else { p.action_ = []; } // // 2.b Multi-insert // var patternArray = pattern.split("|"); for (var j = 0; j < patternArray.length; j++) { if (stateArray[i] === '*') { // insert into all for (var t in transitions) { transitions[t].push({ pattern: patternArray[j], task: p }); } } else { transitions[stateArray[i]].push({ pattern: patternArray[j], task: p }); } } } } } return transitions; }, stateMachines: {} }; // // Definition of state machines // mhchemParser.stateMachines = { // // \ce state machines // //#region ce 'ce': { // main parser transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, 'else': { '0|1|2': { action_: 'beginsWithBond=false', revisit: true, toContinue: true } }, 'oxidation$': { '0': { action_: 'oxidation-output' } }, 'CMT': { 'r': { action_: 'rdt=', nextState: 'rt' }, 'rd': { action_: 'rqt=', nextState: 'rdt' } }, 'arrowUpDown': { '0|1|2|as': { action_: ['sb=false', 'output', 'operator'], nextState: '1' } }, 'uprightEntities': { '0|1|2': { action_: ['o=', 'output'], nextState: '1' } }, 'orbital': { '0|1|2|3': { action_: 'o=', nextState: 'o' } }, '->': { '0|1|2|3': { action_: 'r=', nextState: 'r' }, 'a|as': { action_: ['output', 'r='], nextState: 'r' }, '*': { action_: ['output', 'r='], nextState: 'r' } }, '+': { 'o': { action_: 'd= kv', nextState: 'd' }, 'd|D': { action_: 'd=', nextState: 'd' }, 'q': { action_: 'd=', nextState: 'qd' }, 'qd|qD': { action_: 'd=', nextState: 'qd' }, 'dq': { action_: ['output', 'd='], nextState: 'd' }, '3': { action_: ['sb=false', 'output', 'operator'], nextState: '0' } }, 'amount': { '0|2': { action_: 'a=', nextState: 'a' } }, 'pm-operator': { '0|1|2|a|as': { action_: ['sb=false', 'output', { type_: 'operator', option: '\\pm' }], nextState: '0' } }, 'operator': { '0|1|2|a|as': { action_: ['sb=false', 'output', 'operator'], nextState: '0' } }, '-$': { 'o|q': { action_: ['charge or bond', 'output'], nextState: 'qd' }, 'd': { action_: 'd=', nextState: 'd' }, 'D': { action_: ['output', { type_: 'bond', option: "-" }], nextState: '3' }, 'q': { action_: 'd=', nextState: 'qd' }, 'qd': { action_: 'd=', nextState: 'qd' }, 'qD|dq': { action_: ['output', { type_: 'bond', option: "-" }], nextState: '3' } }, '-9': { '3|o': { action_: ['output', { type_: 'insert', option: 'hyphen' }], nextState: '3' } }, '- orbital overlap': { 'o': { action_: ['output', { type_: 'insert', option: 'hyphen' }], nextState: '2' }, 'd': { action_: ['output', { type_: 'insert', option: 'hyphen' }], nextState: '2' } }, '-': { '0|1|2': { action_: [{ type_: 'output', option: 1 }, 'beginsWithBond=true', { type_: 'bond', option: "-" }], nextState: '3' }, '3': { action_: { type_: 'bond', option: "-" } }, 'a': { action_: ['output', { type_: 'insert', option: 'hyphen' }], nextState: '2' }, 'as': { action_: [{ type_: 'output', option: 2 }, { type_: 'bond', option: "-" }], nextState: '3' }, 'b': { action_: 'b=' }, 'o': { action_: { type_: '- after o/d', option: false }, nextState: '2' }, 'q': { action_: { type_: '- after o/d', option: false }, nextState: '2' }, 'd|qd|dq': { action_: { type_: '- after o/d', option: true }, nextState: '2' }, 'D|qD|p': { action_: ['output', { type_: 'bond', option: "-" }], nextState: '3' } }, 'amount2': { '1|3': { action_: 'a=', nextState: 'a' } }, 'letters': { '0|1|2|3|a|as|b|p|bp|o': { action_: 'o=', nextState: 'o' }, 'q|dq': { action_: ['output', 'o='], nextState: 'o' }, 'd|D|qd|qD': { action_: 'o after d', nextState: 'o' } }, 'digits': { 'o': { action_: 'q=', nextState: 'q' }, 'd|D': { action_: 'q=', nextState: 'dq' }, 'q': { action_: ['output', 'o='], nextState: 'o' }, 'a': { action_: 'o=', nextState: 'o' } }, 'space A': { 'b|p|bp': {} }, 'space': { 'a': { nextState: 'as' }, '0': { action_: 'sb=false' }, '1|2': { action_: 'sb=true' }, 'r|rt|rd|rdt|rdq': { action_: 'output', nextState: '0' }, '*': { action_: ['output', 'sb=true'], nextState: '1' } }, '1st-level escape': { '1|2': { action_: ['output', { type_: 'insert+p1', option: '1st-level escape' }] }, '*': { action_: ['output', { type_: 'insert+p1', option: '1st-level escape' }], nextState: '0' } }, '[(...)]': { 'r|rt': { action_: 'rd=', nextState: 'rd' }, 'rd|rdt': { action_: 'rq=', nextState: 'rdq' } }, '...': { 'o|d|D|dq|qd|qD': { action_: ['output', { type_: 'bond', option: "..." }], nextState: '3' }, '*': { action_: [{ type_: 'output', option: 1 }, { type_: 'insert', option: 'ellipsis' }], nextState: '1' } }, '. |* ': { '*': { action_: ['output', { type_: 'insert', option: 'addition compound' }], nextState: '1' } }, 'state of aggregation $': { '*': { action_: ['output', 'state of aggregation'], nextState: '1' } }, '{[(': { 'a|as|o': { action_: ['o=', 'output', 'parenthesisLevel++'], nextState: '2' }, '0|1|2|3': { action_: ['o=', 'output', 'parenthesisLevel++'], nextState: '2' }, '*': { action_: ['output', 'o=', 'output', 'parenthesisLevel++'], nextState: '2' } }, ')]}': { '0|1|2|3|b|p|bp|o': { action_: ['o=', 'parenthesisLevel--'], nextState: 'o' }, 'a|as|d|D|q|qd|qD|dq': { action_: ['output', 'o=', 'parenthesisLevel--'], nextState: 'o' } }, ', ': { '*': { action_: ['output', 'comma'], nextState: '0' } }, '^_': { // ^ and _ without a sensible argument '*': {} }, '^{(...)}|^($...$)': { '0|1|2|as': { action_: 'b=', nextState: 'b' }, 'p': { action_: 'b=', nextState: 'bp' }, '3|o': { action_: 'd= kv', nextState: 'D' }, 'q': { action_: 'd=', nextState: 'qD' }, 'd|D|qd|qD|dq': { action_: ['output', 'd='], nextState: 'D' } }, '^a|^\\x{}{}|^\\x{}|^\\x|\'': { '0|1|2|as': { action_: 'b=', nextState: 'b' }, 'p': { action_: 'b=', nextState: 'bp' }, '3|o': { action_: 'd= kv', nextState: 'd' }, 'q': { action_: 'd=', nextState: 'qd' }, 'd|qd|D|qD': { action_: 'd=' }, 'dq': { action_: ['output', 'd='], nextState: 'd' } }, '_{(state of aggregation)}$': { 'd|D|q|qd|qD|dq': { action_: ['output', 'q='], nextState: 'q' } }, '_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x': { '0|1|2|as': { action_: 'p=', nextState: 'p' }, 'b': { action_: 'p=', nextState: 'bp' }, '3|o': { action_: 'q=', nextState: 'q' }, 'd|D': { action_: 'q=', nextState: 'dq' }, 'q|qd|qD|dq': { action_: ['output', 'q='], nextState: 'q' } }, '=<>': { '0|1|2|3|a|as|o|q|d|D|qd|qD|dq': { action_: [{ type_: 'output', option: 2 }, 'bond'], nextState: '3' } }, '#': { '0|1|2|3|a|as|o': { action_: [{ type_: 'output', option: 2 }, { type_: 'bond', option: "#" }], nextState: '3' } }, '{}': { '*': { action_: { type_: 'output', option: 1 }, nextState: '1' } }, '{...}': { '0|1|2|3|a|as|b|p|bp': { action_: 'o=', nextState: 'o' }, 'o|d|D|q|qd|qD|dq': { action_: ['output', 'o='], nextState: 'o' } }, '$...$': { 'a': { action_: 'a=' }, // 2$n$ '0|1|2|3|as|b|p|bp|o': { action_: 'o=', nextState: 'o' }, // not 'amount' 'as|o': { action_: 'o=' }, 'q|d|D|qd|qD|dq': { action_: ['output', 'o='], nextState: 'o' } }, '\\bond{(...)}': { '*': { action_: [{ type_: 'output', option: 2 }, 'bond'], nextState: "3" } }, '\\frac{(...)}': { '*': { action_: [{ type_: 'output', option: 1 }, 'frac-output'], nextState: '3' } }, '\\overset{(...)}': { '*': { action_: [{ type_: 'output', option: 2 }, 'overset-output'], nextState: '3' } }, '\\underset{(...)}': { '*': { action_: [{ type_: 'output', option: 2 }, 'underset-output'], nextState: '3' } }, '\\underbrace{(...)}': { '*': { action_: [{ type_: 'output', option: 2 }, 'underbrace-output'], nextState: '3' } }, '\\color{(...)}{(...)}1|\\color(...){(...)}2': { '*': { action_: [{ type_: 'output', option: 2 }, 'color-output'], nextState: '3' } }, '\\color{(...)}0': { '*': { action_: [{ type_: 'output', option: 2 }, 'color0-output'] } }, '\\ce{(...)}': { '*': { action_: [{ type_: 'output', option: 2 }, 'ce'], nextState: '3' } }, '\\,': { '*': { action_: [{ type_: 'output', option: 1 }, 'copy'], nextState: '1' } }, '\\x{}{}|\\x{}|\\x': { '0|1|2|3|a|as|b|p|bp|o|c0': { action_: ['o=', 'output'], nextState: '3' }, '*': { action_: ['output', 'o=', 'output'], nextState: '3' } }, 'others': { '*': { action_: [{ type_: 'output', option: 1 }, 'copy'], nextState: '3' } }, 'else2': { 'a': { action_: 'a to o', nextState: 'o', revisit: true }, 'as': { action_: ['output', 'sb=true'], nextState: '1', revisit: true }, 'r|rt|rd|rdt|rdq': { action_: ['output'], nextState: '0', revisit: true }, '*': { action_: ['output', 'copy'], nextState: '3' } } }), actions: { 'o after d': function oAfterD(buffer, m) { var ret; if ((buffer.d || "").match(/^[0-9]+$/)) { var tmp = buffer.d; buffer.d = undefined; ret = this['output'](buffer); buffer.b = tmp; } else { ret = this['output'](buffer); } mhchemParser.actions['o='](buffer, m); return ret; }, 'd= kv': function dKv(buffer, m) { buffer.d = m; buffer.dType = 'kv'; }, 'charge or bond': function chargeOrBond(buffer, m) { if (buffer['beginsWithBond']) { /** @type {ParserOutput[]} */ var ret = []; mhchemParser.concatArray(ret, this['output'](buffer)); mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-")); return ret; } else { buffer.d = m; } }, '- after o/d': function afterOD(buffer, m, isAfterD) { var c1 = mhchemParser.patterns.match_('orbital', buffer.o || ""); var c2 = mhchemParser.patterns.match_('one lowercase greek letter $', buffer.o || ""); var c3 = mhchemParser.patterns.match_('one lowercase latin letter $', buffer.o || ""); var c4 = mhchemParser.patterns.match_('$one lowercase latin letter$ $', buffer.o || ""); var hyphenFollows = m === "-" && (c1 && c1.remainder === "" || c2 || c3 || c4); if (hyphenFollows && !buffer.a && !buffer.b && !buffer.p && !buffer.d && !buffer.q && !c1 && c3) { buffer.o = '$' + buffer.o + '$'; } /** @type {ParserOutput[]} */ var ret = []; if (hyphenFollows) { mhchemParser.concatArray(ret, this['output'](buffer)); ret.push({ type_: 'hyphen' }); } else { c1 = mhchemParser.patterns.match_('digits', buffer.d || ""); if (isAfterD && c1 && c1.remainder === '') { mhchemParser.concatArray(ret, mhchemParser.actions['d='](buffer, m)); mhchemParser.concatArray(ret, this['output'](buffer)); } else { mhchemParser.concatArray(ret, this['output'](buffer)); mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-")); } } return ret; }, 'a to o': function aToO(buffer) { buffer.o = buffer.a; buffer.a = undefined; }, 'sb=true': function sbTrue(buffer) { buffer.sb = true; }, 'sb=false': function sbFalse(buffer) { buffer.sb = false; }, 'beginsWithBond=true': function beginsWithBondTrue(buffer) { buffer['beginsWithBond'] = true; }, 'beginsWithBond=false': function beginsWithBondFalse(buffer) { buffer['beginsWithBond'] = false; }, 'parenthesisLevel++': function parenthesisLevel(buffer) { buffer['parenthesisLevel']++; }, 'parenthesisLevel--': function parenthesisLevel(buffer) { buffer['parenthesisLevel']--; }, 'state of aggregation': function stateOfAggregation(buffer, m) { return { type_: 'state of aggregation', p1: mhchemParser.go(m, 'o') }; }, 'comma': function comma(buffer, m) { var a = m.replace(/\s*$/, ''); var withSpace = a !== m; if (withSpace && buffer['parenthesisLevel'] === 0) { return { type_: 'comma enumeration L', p1: a }; } else { return { type_: 'comma enumeration M', p1: a }; } }, 'output': function output(buffer, m, entityFollows) { // entityFollows: // undefined = if we have nothing else to output, also ignore the just read space (buffer.sb) // 1 = an entity follows, never omit the space if there was one just read before (can only apply to state 1) // 2 = 1 + the entity can have an amount, so output a\, instead of converting it to o (can only apply to states a|as) /** @type {ParserOutput | ParserOutput[]} */ var ret; if (!buffer.r) { ret = []; if (!buffer.a && !buffer.b && !buffer.p && !buffer.o && !buffer.q && !buffer.d && !entityFollows) ; else { if (buffer.sb) { ret.push({ type_: 'entitySkip' }); } if (!buffer.o && !buffer.q && !buffer.d && !buffer.b && !buffer.p && entityFollows !== 2) { buffer.o = buffer.a; buffer.a = undefined; } else if (!buffer.o && !buffer.q && !buffer.d && (buffer.b || buffer.p)) { buffer.o = buffer.a; buffer.d = buffer.b; buffer.q = buffer.p; buffer.a = buffer.b = buffer.p = undefined; } else { if (buffer.o && buffer.dType === 'kv' && mhchemParser.patterns.match_('d-oxidation$', buffer.d || "")) { buffer.dType = 'oxidation'; } else if (buffer.o && buffer.dType === 'kv' && !buffer.q) { buffer.dType = undefined; } } ret.push({ type_: 'chemfive', a: mhchemParser.go(buffer.a, 'a'), b: mhchemParser.go(buffer.b, 'bd'), p: mhchemParser.go(buffer.p, 'pq'), o: mhchemParser.go(buffer.o, 'o'), q: mhchemParser.go(buffer.q, 'pq'), d: mhchemParser.go(buffer.d, buffer.dType === 'oxidation' ? 'oxidation' : 'bd'), dType: buffer.dType }); } } else { // r /** @type {ParserOutput[]} */ var rd; if (buffer.rdt === 'M') { rd = mhchemParser.go(buffer.rd, 'tex-math'); } else if (buffer.rdt === 'T') { rd = [{ type_: 'text', p1: buffer.rd || "" }]; } else { rd = mhchemParser.go(buffer.rd); } /** @type {ParserOutput[]} */ var rq; if (buffer.rqt === 'M') { rq = mhchemParser.go(buffer.rq, 'tex-math'); } else if (buffer.rqt === 'T') { rq = [{ type_: 'text', p1: buffer.rq || "" }]; } else { rq = mhchemParser.go(buffer.rq); } ret = { type_: 'arrow', r: buffer.r, rd: rd, rq: rq }; } for (var p in buffer) { if (p !== 'parenthesisLevel' && p !== 'beginsWithBond') { delete buffer[p]; } } return ret; }, 'oxidation-output': function oxidationOutput(buffer, m) { var ret = ["{"]; mhchemParser.concatArray(ret, mhchemParser.go(m, 'oxidation')); ret.push("}"); return ret; }, 'frac-output': function fracOutput(buffer, m) { return { type_: 'frac-ce', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; }, 'overset-output': function oversetOutput(buffer, m) { return { type_: 'overset', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; }, 'underset-output': function undersetOutput(buffer, m) { return { type_: 'underset', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; }, 'underbrace-output': function underbraceOutput(buffer, m) { return { type_: 'underbrace', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; }, 'color-output': function colorOutput(buffer, m) { return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1]) }; }, 'r=': function r(buffer, m) { buffer.r = m; }, 'rdt=': function rdt(buffer, m) { buffer.rdt = m; }, 'rd=': function rd(buffer, m) { buffer.rd = m; }, 'rqt=': function rqt(buffer, m) { buffer.rqt = m; }, 'rq=': function rq(buffer, m) { buffer.rq = m; }, 'operator': function operator(buffer, m, p1) { return { type_: 'operator', kind_: p1 || m }; } } }, 'a': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, '1/2$': { '0': { action_: '1/2' } }, 'else': { '0': { nextState: '1', revisit: true } }, '$(...)$': { '*': { action_: 'tex-math tight', nextState: '1' } }, ',': { '*': { action_: { type_: 'insert', option: 'commaDecimal' } } }, 'else2': { '*': { action_: 'copy' } } }), actions: {} }, 'o': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, '1/2$': { '0': { action_: '1/2' } }, 'else': { '0': { nextState: '1', revisit: true } }, 'letters': { '*': { action_: 'rm' } }, '\\ca': { '*': { action_: { type_: 'insert', option: 'circa' } } }, '\\x{}{}|\\x{}|\\x': { '*': { action_: 'copy' } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, '{(...)}': { '*': { action_: '{text}' } }, 'else2': { '*': { action_: 'copy' } } }), actions: {} }, 'text': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, '{...}': { '*': { action_: 'text=' } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, '\\greek': { '*': { action_: ['output', 'rm'] } }, '\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: ['output', 'copy'] } }, 'else': { '*': { action_: 'text=' } } }), actions: { 'output': function output(buffer) { if (buffer.text_) { /** @type {ParserOutput} */ var ret = { type_: 'text', p1: buffer.text_ }; for (var p in buffer) { delete buffer[p]; } return ret; } } } }, 'pq': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, 'state of aggregation $': { '*': { action_: 'state of aggregation' } }, 'i$': { '0': { nextState: '!f', revisit: true } }, '(KV letters),': { '0': { action_: 'rm', nextState: '0' } }, 'formula$': { '0': { nextState: 'f', revisit: true } }, '1/2$': { '0': { action_: '1/2' } }, 'else': { '0': { nextState: '!f', revisit: true } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, '{(...)}': { '*': { action_: 'text' } }, 'a-z': { 'f': { action_: 'tex-math' } }, 'letters': { '*': { action_: 'rm' } }, '-9.,9': { '*': { action_: '9,9' } }, ',': { '*': { action_: { type_: 'insert+p1', option: 'comma enumeration S' } } }, '\\color{(...)}{(...)}1|\\color(...){(...)}2': { '*': { action_: 'color-output' } }, '\\color{(...)}0': { '*': { action_: 'color0-output' } }, '\\ce{(...)}': { '*': { action_: 'ce' } }, '\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: 'copy' } }, 'else2': { '*': { action_: 'copy' } } }), actions: { 'state of aggregation': function stateOfAggregation(buffer, m) { return { type_: 'state of aggregation subscript', p1: mhchemParser.go(m, 'o') }; }, 'color-output': function colorOutput(buffer, m) { return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1], 'pq') }; } } }, 'bd': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, 'x$': { '0': { nextState: '!f', revisit: true } }, 'formula$': { '0': { nextState: 'f', revisit: true } }, 'else': { '0': { nextState: '!f', revisit: true } }, '-9.,9 no missing 0': { '*': { action_: '9,9' } }, '.': { '*': { action_: { type_: 'insert', option: 'electron dot' } } }, 'a-z': { 'f': { action_: 'tex-math' } }, 'x': { '*': { action_: { type_: 'insert', option: 'KV x' } } }, 'letters': { '*': { action_: 'rm' } }, '\'': { '*': { action_: { type_: 'insert', option: 'prime' } } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, '{(...)}': { '*': { action_: 'text' } }, '\\color{(...)}{(...)}1|\\color(...){(...)}2': { '*': { action_: 'color-output' } }, '\\color{(...)}0': { '*': { action_: 'color0-output' } }, '\\ce{(...)}': { '*': { action_: 'ce' } }, '\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: 'copy' } }, 'else2': { '*': { action_: 'copy' } } }), actions: { 'color-output': function colorOutput(buffer, m) { return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1], 'bd') }; } } }, 'oxidation': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, 'roman numeral': { '*': { action_: 'roman-numeral' } }, '${(...)}$|$(...)$': { '*': { action_: 'tex-math' } }, 'else': { '*': { action_: 'copy' } } }), actions: { 'roman-numeral': function romanNumeral(buffer, m) { return { type_: 'roman numeral', p1: m || "" }; } } }, 'tex-math': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, '\\ce{(...)}': { '*': { action_: ['output', 'ce'] } }, '{...}|\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: 'o=' } }, 'else': { '*': { action_: 'o=' } } }), actions: { 'output': function output(buffer) { if (buffer.o) { /** @type {ParserOutput} */ var ret = { type_: 'tex-math', p1: buffer.o }; for (var p in buffer) { delete buffer[p]; } return ret; } } } }, 'tex-math tight': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, '\\ce{(...)}': { '*': { action_: ['output', 'ce'] } }, '{...}|\\,|\\x{}{}|\\x{}|\\x': { '*': { action_: 'o=' } }, '-|+': { '*': { action_: 'tight operator' } }, 'else': { '*': { action_: 'o=' } } }), actions: { 'tight operator': function tightOperator(buffer, m) { buffer.o = (buffer.o || "") + "{" + m + "}"; }, 'output': function output(buffer) { if (buffer.o) { /** @type {ParserOutput} */ var ret = { type_: 'tex-math', p1: buffer.o }; for (var p in buffer) { delete buffer[p]; } return ret; } } } }, '9,9': { transitions: mhchemParser.createTransitions({ 'empty': { '*': {} }, ',': { '*': { action_: 'comma' } }, 'else': { '*': { action_: 'copy' } } }), actions: { 'comma': function comma() { return { type_: 'commaDecimal' }; } } }, //#endregion // // \pu state machines // //#region pu 'pu': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, 'space$': { '*': { action_: ['output', 'space'] } }, '{[(|)]}': { '0|a': { action_: 'copy' } }, '(-)(9)^(-9)': { '0': { action_: 'number^', nextState: 'a' } }, '(-)(9.,9)(e)(99)': { '0': { action_: 'enumber', nextState: 'a' } }, 'space': { '0|a': {} }, 'pm-operator': { '0|a': { action_: { type_: 'operator', option: '\\pm' }, nextState: '0' } }, 'operator': { '0|a': { action_: 'copy', nextState: '0' } }, '//': { 'd': { action_: 'o=', nextState: '/' } }, '/': { 'd': { action_: 'o=', nextState: '/' } }, '{...}|else': { '0|d': { action_: 'd=', nextState: 'd' }, 'a': { action_: ['space', 'd='], nextState: 'd' }, '/|q': { action_: 'q=', nextState: 'q' } } }), actions: { 'enumber': function enumber(buffer, m) { /** @type {ParserOutput[]} */ var ret = []; if (m[0] === "+-" || m[0] === "+/-") { ret.push("\\pm "); } else if (m[0]) { ret.push(m[0]); } if (m[1]) { mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9')); if (m[2]) { if (m[2].match(/[,.]/)) { mhchemParser.concatArray(ret, mhchemParser.go(m[2], 'pu-9,9')); } else { ret.push(m[2]); } } m[3] = m[4] || m[3]; if (m[3]) { m[3] = m[3].trim(); if (m[3] === "e" || m[3].substr(0, 1) === "*") { ret.push({ type_: 'cdot' }); } else { ret.push({ type_: 'times' }); } } } if (m[3]) { ret.push("10^{" + m[5] + "}"); } return ret; }, 'number^': function number(buffer, m) { /** @type {ParserOutput[]} */ var ret = []; if (m[0] === "+-" || m[0] === "+/-") { ret.push("\\pm "); } else if (m[0]) { ret.push(m[0]); } mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9')); ret.push("^{" + m[2] + "}"); return ret; }, 'operator': function operator(buffer, m, p1) { return { type_: 'operator', kind_: p1 || m }; }, 'space': function space() { return { type_: 'pu-space-1' }; }, 'output': function output(buffer) { /** @type {ParserOutput | ParserOutput[]} */ var ret; var md = mhchemParser.patterns.match_('{(...)}', buffer.d || ""); if (md && md.remainder === '') { buffer.d = md.match_; } var mq = mhchemParser.patterns.match_('{(...)}', buffer.q || ""); if (mq && mq.remainder === '') { buffer.q = mq.match_; } if (buffer.d) { buffer.d = buffer.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"); buffer.d = buffer.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F"); } if (buffer.q) { // fraction buffer.q = buffer.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"); buffer.q = buffer.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F"); var b5 = { d: mhchemParser.go(buffer.d, 'pu'), q: mhchemParser.go(buffer.q, 'pu') }; if (buffer.o === '//') { ret = { type_: 'pu-frac', p1: b5.d, p2: b5.q }; } else { ret = b5.d; if (b5.d.length > 1 || b5.q.length > 1) { ret.push({ type_: ' / ' }); } else { ret.push({ type_: '/' }); } mhchemParser.concatArray(ret, b5.q); } } else { // no fraction ret = mhchemParser.go(buffer.d, 'pu-2'); } for (var p in buffer) { delete buffer[p]; } return ret; } } }, 'pu-2': { transitions: mhchemParser.createTransitions({ 'empty': { '*': { action_: 'output' } }, '*': { '*': { action_: ['output', 'cdot'], nextState: '0' } }, '\\x': { '*': { action_: 'rm=' } }, 'space': { '*': { action_: ['output', 'space'], nextState: '0' } }, '^{(...)}|^(-1)': { '1': { action_: '^(-1)' } }, '-9.,9': { '0': { action_: 'rm=', nextState: '0' }, '1': { action_: '^(-1)', nextState: '0' } }, '{...}|else': { '*': { action_: 'rm=', nextState: '1' } } }), actions: { 'cdot': function cdot() { return { type_: 'tight cdot' }; }, '^(-1)': function _(buffer, m) { buffer.rm += "^{" + m + "}"; }, 'space': function space() { return { type_: 'pu-space-2' }; }, 'output': function output(buffer) { /** @type {ParserOutput | ParserOutput[]} */ var ret = []; if (buffer.rm) { var mrm = mhchemParser.patterns.match_('{(...)}', buffer.rm || ""); if (mrm && mrm.remainder === '') { ret = mhchemParser.go(mrm.match_, 'pu'); } else { ret = { type_: 'rm', p1: buffer.rm }; } } for (var p in buffer) { delete buffer[p]; } return ret; } } }, 'pu-9,9': { transitions: mhchemParser.createTransitions({ 'empty': { '0': { action_: 'output-0' }, 'o': { action_: 'output-o' } }, ',': { '0': { action_: ['output-0', 'comma'], nextState: 'o' } }, '.': { '0': { action_: ['output-0', 'copy'], nextState: 'o' } }, 'else': { '*': { action_: 'text=' } } }), actions: { 'comma': function comma() { return { type_: 'commaDecimal' }; }, 'output-0': function output0(buffer) { /** @type {ParserOutput[]} */ var ret = []; buffer.text_ = buffer.text_ || ""; if (buffer.text_.length > 4) { var a = buffer.text_.length % 3; if (a === 0) { a = 3; } for (var i = buffer.text_.length - 3; i > 0; i -= 3) { ret.push(buffer.text_.substr(i, 3)); ret.push({ type_: '1000 separator' }); } ret.push(buffer.text_.substr(0, a)); ret.reverse(); } else { ret.push(buffer.text_); } for (var p in buffer) { delete buffer[p]; } return ret; }, 'output-o': function outputO(buffer) { /** @type {ParserOutput[]} */ var ret = []; buffer.text_ = buffer.text_ || ""; if (buffer.text_.length > 4) { var a = buffer.text_.length - 3; for (var i = 0; i < a; i += 3) { ret.push(buffer.text_.substr(i, 3)); ret.push({ type_: '1000 separator' }); } ret.push(buffer.text_.substr(i)); } else { ret.push(buffer.text_); } for (var p in buffer) { delete buffer[p]; } return ret; } } //#endregion } }; // // texify: Take MhchemParser output and convert it to TeX // /** @type {Texify} */ var texify = { go: function go(input, isInner) { // (recursive, max 4 levels) if (!input) { return ""; } var res = ""; var cee = false; for (var i = 0; i < input.length; i++) { var inputi = input[i]; if (typeof inputi === "string") { res += inputi; } else { res += texify._go2(inputi); if (inputi.type_ === '1st-level escape') { cee = true; } } } if (!isInner && !cee && res) { res = "{" + res + "}"; } return res; }, _goInner: function _goInner(input) { if (!input) { return input; } return texify.go(input, true); }, _go2: function _go2(buf) { /** @type {undefined | string} */ var res; switch (buf.type_) { case 'chemfive': res = ""; var b5 = { a: texify._goInner(buf.a), b: texify._goInner(buf.b), p: texify._goInner(buf.p), o: texify._goInner(buf.o), q: texify._goInner(buf.q), d: texify._goInner(buf.d) }; // // a // if (b5.a) { if (b5.a.match(/^[+\-]/)) { b5.a = "{" + b5.a + "}"; } res += b5.a + "\\,"; } // // b and p // if (b5.b || b5.p) { res += "{\\vphantom{X}}"; res += "^{\\hphantom{" + (b5.b || "") + "}}_{\\hphantom{" + (b5.p || "") + "}}"; res += "{\\vphantom{X}}"; res += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (b5.b || "") + "}}"; res += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (b5.p || "") + "}}}"; } // // o // if (b5.o) { if (b5.o.match(/^[+\-]/)) { b5.o = "{" + b5.o + "}"; } res += b5.o; } // // q and d // if (buf.dType === 'kv') { if (b5.d || b5.q) { res += "{\\vphantom{X}}"; } if (b5.d) { res += "^{" + b5.d + "}"; } if (b5.q) { res += "_{\\smash[t]{" + b5.q + "}}"; } } else if (buf.dType === 'oxidation') { if (b5.d) { res += "{\\vphantom{X}}"; res += "^{" + b5.d + "}"; } if (b5.q) { res += "{\\vphantom{X}}"; res += "_{\\smash[t]{" + b5.q + "}}"; } } else { if (b5.q) { res += "{\\vphantom{X}}"; res += "_{\\smash[t]{" + b5.q + "}}"; } if (b5.d) { res += "{\\vphantom{X}}"; res += "^{" + b5.d + "}"; } } break; case 'rm': res = "\\mathrm{" + buf.p1 + "}"; break; case 'text': if (buf.p1.match(/[\^_]/)) { buf.p1 = buf.p1.replace(" ", "~").replace("-", "\\text{-}"); res = "\\mathrm{" + buf.p1 + "}"; } else { res = "\\text{" + buf.p1 + "}"; } break; case 'roman numeral': res = "\\mathrm{" + buf.p1 + "}"; break; case 'state of aggregation': res = "\\mskip2mu " + texify._goInner(buf.p1); break; case 'state of aggregation subscript': res = "\\mskip1mu " + texify._goInner(buf.p1); break; case 'bond': res = texify._getBond(buf.kind_); if (!res) { throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + buf.kind_ + ")"]; } break; case 'frac': var c = "\\frac{" + buf.p1 + "}{" + buf.p2 + "}"; res = "\\mathchoice{\\textstyle" + c + "}{" + c + "}{" + c + "}{" + c + "}"; break; case 'pu-frac': var d = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}"; res = "\\mathchoice{\\textstyle" + d + "}{" + d + "}{" + d + "}{" + d + "}"; break; case 'tex-math': res = buf.p1 + " "; break; case 'frac-ce': res = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}"; break; case 'overset': res = "\\overset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}"; break; case 'underset': res = "\\underset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}"; break; case 'underbrace': res = "\\underbrace{" + texify._goInner(buf.p1) + "}_{" + texify._goInner(buf.p2) + "}"; break; case 'color': res = "{\\color{" + buf.color1 + "}{" + texify._goInner(buf.color2) + "}}"; break; case 'color0': res = "\\color{" + buf.color + "}"; break; case 'arrow': var b6 = { rd: texify._goInner(buf.rd), rq: texify._goInner(buf.rq) }; var arrow = "\\x" + texify._getArrow(buf.r); if (b6.rq) { arrow += "[{" + b6.rq + "}]"; } if (b6.rd) { arrow += "{" + b6.rd + "}"; } else { arrow += "{}"; } res = arrow; break; case 'operator': res = texify._getOperator(buf.kind_); break; case '1st-level escape': res = buf.p1 + " "; // &, \\\\, \\hlin break; case 'space': res = " "; break; case 'entitySkip': res = "~"; break; case 'pu-space-1': res = "~"; break; case 'pu-space-2': res = "\\mkern3mu "; break; case '1000 separator': res = "\\mkern2mu "; break; case 'commaDecimal': res = "{,}"; break; case 'comma enumeration L': res = "{" + buf.p1 + "}\\mkern6mu "; break; case 'comma enumeration M': res = "{" + buf.p1 + "}\\mkern3mu "; break; case 'comma enumeration S': res = "{" + buf.p1 + "}\\mkern1mu "; break; case 'hyphen': res = "\\text{-}"; break; case 'addition compound': res = "\\,{\\cdot}\\,"; break; case 'electron dot': res = "\\mkern1mu \\bullet\\mkern1mu "; break; case 'KV x': res = "{\\times}"; break; case 'prime': res = "\\prime "; break; case 'cdot': res = "\\cdot "; break; case 'tight cdot': res = "\\mkern1mu{\\cdot}\\mkern1mu "; break; case 'times': res = "\\times "; break; case 'circa': res = "{\\sim}"; break; case '^': res = "uparrow"; break; case 'v': res = "downarrow"; break; case 'ellipsis': res = "\\ldots "; break; case '/': res = "/"; break; case ' / ': res = "\\,/\\,"; break; default: throw ["MhchemBugT", "mhchem bug T. Please report."]; // Missing texify rule or unknown MhchemParser output } return res; }, _getArrow: function _getArrow(a) { switch (a) { case "->": return "rightarrow"; case "\u2192": return "rightarrow"; case "\u27F6": return "rightarrow"; case "<-": return "leftarrow"; case "<->": return "leftrightarrow"; case "<-->": return "rightleftarrows"; case "<=>": return "rightleftharpoons"; case "\u21CC": return "rightleftharpoons"; case "<=>>": return "rightequilibrium"; case "<<=>": return "leftequilibrium"; default: throw ["MhchemBugT", "mhchem bug T. Please report."]; } }, _getBond: function _getBond(a) { switch (a) { case "-": return "{-}"; case "1": return "{-}"; case "=": return "{=}"; case "2": return "{=}"; case "#": return "{\\equiv}"; case "3": return "{\\equiv}"; case "~": return "{\\tripledash}"; case "~-": return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}"; case "~=": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}"; case "~--": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}"; case "-~-": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}"; case "...": return "{{\\cdot}{\\cdot}{\\cdot}}"; case "....": return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}"; case "->": return "{\\rightarrow}"; case "<-": return "{\\leftarrow}"; case "<": return "{<}"; case ">": return "{>}"; default: throw ["MhchemBugT", "mhchem bug T. Please report."]; } }, _getOperator: function _getOperator(a) { switch (a) { case "+": return " {}+{} "; case "-": return " {}-{} "; case "=": return " {}={} "; case "<": return " {}<{} "; case ">": return " {}>{} "; case "<<": return " {}\\ll{} "; case ">>": return " {}\\gg{} "; case "\\pm": return " {}\\pm{} "; case "\\approx": return " {}\\approx{} "; case "$\\approx$": return " {}\\approx{} "; case "v": return " \\downarrow{} "; case "(v)": return " \\downarrow{} "; case "^": return " \\uparrow{} "; case "(^)": return " \\uparrow{} "; default: throw ["MhchemBugT", "mhchem bug T. Please report."]; } } }; // ================================================ FILE: source/lib/katex@0.12.0/contrib/render-a11y-string.js ================================================ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("katex")); else if(typeof define === 'function' && define.amd) define(["katex"], factory); else { var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__0__; /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); /** * renderA11yString returns a readable string. * * In some cases the string will have the proper semantic math * meaning,: * renderA11yString("\\frac{1}{2}"") * -> "start fraction, 1, divided by, 2, end fraction" * * However, other cases do not: * renderA11yString("f(x) = x^2") * -> "f, left parenthesis, x, right parenthesis, equals, x, squared" * * The commas in the string aim to increase ease of understanding * when read by a screenreader. */ // NOTE: since we're importing types here these files won't actually be // included in the build. // $FlowIgnore: we import the types directly anyways var stringMap = { "(": "left parenthesis", ")": "right parenthesis", "[": "open bracket", "]": "close bracket", "\\{": "left brace", "\\}": "right brace", "\\lvert": "open vertical bar", "\\rvert": "close vertical bar", "|": "vertical bar", "\\uparrow": "up arrow", "\\Uparrow": "up arrow", "\\downarrow": "down arrow", "\\Downarrow": "down arrow", "\\updownarrow": "up down arrow", "\\leftarrow": "left arrow", "\\Leftarrow": "left arrow", "\\rightarrow": "right arrow", "\\Rightarrow": "right arrow", "\\langle": "open angle", "\\rangle": "close angle", "\\lfloor": "open floor", "\\rfloor": "close floor", "\\int": "integral", "\\intop": "integral", "\\lim": "limit", "\\ln": "natural log", "\\log": "log", "\\sin": "sine", "\\cos": "cosine", "\\tan": "tangent", "\\cot": "cotangent", "\\sum": "sum", "/": "slash", ",": "comma", ".": "point", "-": "negative", "+": "plus", "~": "tilde", ":": "colon", "?": "question mark", "'": "apostrophe", "\\%": "percent", " ": "space", "\\ ": "space", "\\$": "dollar sign", "\\angle": "angle", "\\degree": "degree", "\\circ": "circle", "\\vec": "vector", "\\triangle": "triangle", "\\pi": "pi", "\\prime": "prime", "\\infty": "infinity", "\\alpha": "alpha", "\\beta": "beta", "\\gamma": "gamma", "\\omega": "omega", "\\theta": "theta", "\\sigma": "sigma", "\\lambda": "lambda", "\\tau": "tau", "\\Delta": "delta", "\\delta": "delta", "\\mu": "mu", "\\rho": "rho", "\\nabla": "del", "\\ell": "ell", "\\ldots": "dots", // TODO: add entries for all accents "\\hat": "hat", "\\acute": "acute" }; var powerMap = { "prime": "prime", "degree": "degrees", "circle": "degrees", "2": "squared", "3": "cubed" }; var openMap = { "|": "open vertical bar", ".": "" }; var closeMap = { "|": "close vertical bar", ".": "" }; var binMap = { "+": "plus", "-": "minus", "\\pm": "plus minus", "\\cdot": "dot", "*": "times", "/": "divided by", "\\times": "times", "\\div": "divided by", "\\circ": "circle", "\\bullet": "bullet" }; var relMap = { "=": "equals", "\\approx": "approximately equals", "≠": "does not equal", "\\geq": "is greater than or equal to", "\\ge": "is greater than or equal to", "\\leq": "is less than or equal to", "\\le": "is less than or equal to", ">": "is greater than", "<": "is less than", "\\leftarrow": "left arrow", "\\Leftarrow": "left arrow", "\\rightarrow": "right arrow", "\\Rightarrow": "right arrow", ":": "colon" }; var accentUnderMap = { "\\underleftarrow": "left arrow", "\\underrightarrow": "right arrow", "\\underleftrightarrow": "left-right arrow", "\\undergroup": "group", "\\underlinesegment": "line segment", "\\utilde": "tilde" }; var buildString = function buildString(str, type, a11yStrings) { if (!str) { return; } var ret; if (type === "open") { ret = str in openMap ? openMap[str] : stringMap[str] || str; } else if (type === "close") { ret = str in closeMap ? closeMap[str] : stringMap[str] || str; } else if (type === "bin") { ret = binMap[str] || str; } else if (type === "rel") { ret = relMap[str] || str; } else { ret = stringMap[str] || str; } // If the text to add is a number and there is already a string // in the list and the last string is a number then we should // combine them into a single number if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string // I think we might be able to drop the nested arrays, which would make // this easier to type - $FlowFixMe /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) { a11yStrings[a11yStrings.length - 1] += ret; } else if (ret) { a11yStrings.push(ret); } }; var buildRegion = function buildRegion(a11yStrings, callback) { var regionStrings = []; a11yStrings.push(regionStrings); callback(regionStrings); }; var handleObject = function handleObject(tree, a11yStrings, atomType) { // Everything else is assumed to be an object... switch (tree.type) { case "accent": { buildRegion(a11yStrings, function (a11yStrings) { buildA11yStrings(tree.base, a11yStrings, atomType); a11yStrings.push("with"); buildString(tree.label, "normal", a11yStrings); a11yStrings.push("on top"); }); break; } case "accentUnder": { buildRegion(a11yStrings, function (a11yStrings) { buildA11yStrings(tree.base, a11yStrings, atomType); a11yStrings.push("with"); buildString(accentUnderMap[tree.label], "normal", a11yStrings); a11yStrings.push("underneath"); }); break; } case "accent-token": { // Used internally by accent symbols. break; } case "atom": { var text = tree.text; switch (tree.family) { case "bin": { buildString(text, "bin", a11yStrings); break; } case "close": { buildString(text, "close", a11yStrings); break; } // TODO(kevinb): figure out what should be done for inner case "inner": { buildString(tree.text, "inner", a11yStrings); break; } case "open": { buildString(text, "open", a11yStrings); break; } case "punct": { buildString(text, "punct", a11yStrings); break; } case "rel": { buildString(text, "rel", a11yStrings); break; } default: { tree.family; throw new Error("\"" + tree.family + "\" is not a valid atom type"); } } break; } case "color": { var color = tree.color.replace(/katex-/, ""); buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start color " + color); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end color " + color); }); break; } case "color-token": { // Used by \color, \colorbox, and \fcolorbox but not directly rendered. // It's a leaf node and has no children so just break. break; } case "delimsizing": { if (tree.delim && tree.delim !== ".") { buildString(tree.delim, "normal", a11yStrings); } break; } case "genfrac": { buildRegion(a11yStrings, function (regionStrings) { // genfrac can have unbalanced delimiters var leftDelim = tree.leftDelim, rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption // hasBarLine true -> fraction, false -> binomial if (tree.hasBarLine) { regionStrings.push("start fraction"); leftDelim && buildString(leftDelim, "open", regionStrings); buildA11yStrings(tree.numer, regionStrings, atomType); regionStrings.push("divided by"); buildA11yStrings(tree.denom, regionStrings, atomType); rightDelim && buildString(rightDelim, "close", regionStrings); regionStrings.push("end fraction"); } else { regionStrings.push("start binomial"); leftDelim && buildString(leftDelim, "open", regionStrings); buildA11yStrings(tree.numer, regionStrings, atomType); regionStrings.push("over"); buildA11yStrings(tree.denom, regionStrings, atomType); rightDelim && buildString(rightDelim, "close", regionStrings); regionStrings.push("end binomial"); } }); break; } case "kern": { // No op: we don't attempt to present kerning information // to the screen reader. break; } case "leftright": { buildRegion(a11yStrings, function (regionStrings) { buildString(tree.left, "open", regionStrings); buildA11yStrings(tree.body, regionStrings, atomType); buildString(tree.right, "close", regionStrings); }); break; } case "leftright-right": { // TODO: double check that this is a no-op break; } case "lap": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "mathord": { buildString(tree.text, "normal", a11yStrings); break; } case "op": { var body = tree.body, name = tree.name; if (body) { buildA11yStrings(body, a11yStrings, atomType); } else if (name) { buildString(name, "normal", a11yStrings); } break; } case "op-token": { // Used internally by operator symbols. buildString(tree.text, atomType, a11yStrings); break; } case "ordgroup": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "overline": { buildRegion(a11yStrings, function (a11yStrings) { a11yStrings.push("start overline"); buildA11yStrings(tree.body, a11yStrings, atomType); a11yStrings.push("end overline"); }); break; } case "phantom": { a11yStrings.push("empty space"); break; } case "raisebox": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "rule": { a11yStrings.push("rectangle"); break; } case "sizing": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "spacing": { a11yStrings.push("space"); break; } case "styling": { // We ignore the styling and just pass through the contents buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "sqrt": { buildRegion(a11yStrings, function (regionStrings) { var body = tree.body, index = tree.index; if (index) { var indexString = flatten(buildA11yStrings(index, [], atomType)).join(","); if (indexString === "3") { regionStrings.push("cube root of"); buildA11yStrings(body, regionStrings, atomType); regionStrings.push("end cube root"); return; } regionStrings.push("root"); regionStrings.push("start index"); buildA11yStrings(index, regionStrings, atomType); regionStrings.push("end index"); return; } regionStrings.push("square root of"); buildA11yStrings(body, regionStrings, atomType); regionStrings.push("end square root"); }); break; } case "supsub": { var base = tree.base, sub = tree.sub, sup = tree.sup; var isLog = false; if (base) { buildA11yStrings(base, a11yStrings, atomType); isLog = base.type === "op" && base.name === "\\log"; } if (sub) { var regionName = isLog ? "base" : "subscript"; buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start " + regionName); buildA11yStrings(sub, regionStrings, atomType); regionStrings.push("end " + regionName); }); } if (sup) { buildRegion(a11yStrings, function (regionStrings) { var supString = flatten(buildA11yStrings(sup, [], atomType)).join(","); if (supString in powerMap) { regionStrings.push(powerMap[supString]); return; } regionStrings.push("start superscript"); buildA11yStrings(sup, regionStrings, atomType); regionStrings.push("end superscript"); }); } break; } case "text": { // TODO: handle other fonts if (tree.font === "\\textbf") { buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start bold text"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end bold text"); }); break; } buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start text"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end text"); }); break; } case "textord": { buildString(tree.text, atomType, a11yStrings); break; } case "smash": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "enclose": { // TODO: create a map for these. // TODO: differentiate between a body with a single atom, e.g. // "cancel a" instead of "start cancel, a, end cancel" if (/cancel/.test(tree.label)) { buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start cancel"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end cancel"); }); break; } else if (/box/.test(tree.label)) { buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start box"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end box"); }); break; } else if (/sout/.test(tree.label)) { buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start strikeout"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end strikeout"); }); break; } throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet"); } case "vphantom": { throw new Error("KaTeX-a11y: vphantom not implemented yet"); } case "hphantom": { throw new Error("KaTeX-a11y: hphantom not implemented yet"); } case "operatorname": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "array": { throw new Error("KaTeX-a11y: array not implemented yet"); } case "raw": { throw new Error("KaTeX-a11y: raw not implemented yet"); } case "size": { // Although there are nodes of type "size" in the parse tree, they have // no semantic meaning and should be ignored. break; } case "url": { throw new Error("KaTeX-a11y: url not implemented yet"); } case "tag": { throw new Error("KaTeX-a11y: tag not implemented yet"); } case "verb": { buildString("start verbatim", "normal", a11yStrings); buildString(tree.body, "normal", a11yStrings); buildString("end verbatim", "normal", a11yStrings); break; } case "environment": { throw new Error("KaTeX-a11y: environment not implemented yet"); } case "horizBrace": { buildString("start " + tree.label.slice(1), "normal", a11yStrings); buildA11yStrings(tree.base, a11yStrings, atomType); buildString("end " + tree.label.slice(1), "normal", a11yStrings); break; } case "infix": { // All infix nodes are replace with other nodes. break; } case "includegraphics": { throw new Error("KaTeX-a11y: includegraphics not implemented yet"); } case "font": { // TODO: callout the start/end of specific fonts // TODO: map \BBb{N} to "the naturals" or something like that buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "href": { throw new Error("KaTeX-a11y: href not implemented yet"); } case "cr": { // This is used by environments. throw new Error("KaTeX-a11y: cr not implemented yet"); } case "underline": { buildRegion(a11yStrings, function (a11yStrings) { a11yStrings.push("start underline"); buildA11yStrings(tree.body, a11yStrings, atomType); a11yStrings.push("end underline"); }); break; } case "xArrow": { throw new Error("KaTeX-a11y: xArrow not implemented yet"); } case "mclass": { // \neq and \ne are macros so we let "htmlmathml" render the mathmal // side of things and extract the text from that. var _atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass buildA11yStrings(tree.body, a11yStrings, _atomType); break; } case "mathchoice": { // TODO: track which which style we're using, e.g. dispaly, text, etc. // default to text style if even that may not be the correct style buildA11yStrings(tree.text, a11yStrings, atomType); break; } case "htmlmathml": { buildA11yStrings(tree.mathml, a11yStrings, atomType); break; } case "middle": { buildString(tree.delim, atomType, a11yStrings); break; } case "internal": { // internal nodes are never included in the parse tree break; } case "html": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } default: tree.type; throw new Error("KaTeX a11y un-recognized type: " + tree.type); } }; var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) { if (a11yStrings === void 0) { a11yStrings = []; } if (tree instanceof Array) { for (var i = 0; i < tree.length; i++) { buildA11yStrings(tree[i], a11yStrings, atomType); } } else { handleObject(tree, a11yStrings, atomType); } return a11yStrings; }; var flatten = function flatten(array) { var result = []; array.forEach(function (item) { if (item instanceof Array) { result = result.concat(flatten(item)); } else { result.push(item); } }); return result; }; var renderA11yString = function renderA11yString(text, settings) { var tree = katex__WEBPACK_IMPORTED_MODULE_0___default.a.__parse(text, settings); var a11yStrings = buildA11yStrings(tree, [], "normal"); return flatten(a11yStrings).join(", "); }; /* harmony default export */ __webpack_exports__["default"] = (renderA11yString); /***/ }) /******/ ])["default"]; }); ================================================ FILE: source/lib/katex@0.12.0/contrib/render-a11y-string.mjs ================================================ import katex from '../katex.mjs'; /** * renderA11yString returns a readable string. * * In some cases the string will have the proper semantic math * meaning,: * renderA11yString("\\frac{1}{2}"") * -> "start fraction, 1, divided by, 2, end fraction" * * However, other cases do not: * renderA11yString("f(x) = x^2") * -> "f, left parenthesis, x, right parenthesis, equals, x, squared" * * The commas in the string aim to increase ease of understanding * when read by a screenreader. */ const stringMap = { "(": "left parenthesis", ")": "right parenthesis", "[": "open bracket", "]": "close bracket", "\\{": "left brace", "\\}": "right brace", "\\lvert": "open vertical bar", "\\rvert": "close vertical bar", "|": "vertical bar", "\\uparrow": "up arrow", "\\Uparrow": "up arrow", "\\downarrow": "down arrow", "\\Downarrow": "down arrow", "\\updownarrow": "up down arrow", "\\leftarrow": "left arrow", "\\Leftarrow": "left arrow", "\\rightarrow": "right arrow", "\\Rightarrow": "right arrow", "\\langle": "open angle", "\\rangle": "close angle", "\\lfloor": "open floor", "\\rfloor": "close floor", "\\int": "integral", "\\intop": "integral", "\\lim": "limit", "\\ln": "natural log", "\\log": "log", "\\sin": "sine", "\\cos": "cosine", "\\tan": "tangent", "\\cot": "cotangent", "\\sum": "sum", "/": "slash", ",": "comma", ".": "point", "-": "negative", "+": "plus", "~": "tilde", ":": "colon", "?": "question mark", "'": "apostrophe", "\\%": "percent", " ": "space", "\\ ": "space", "\\$": "dollar sign", "\\angle": "angle", "\\degree": "degree", "\\circ": "circle", "\\vec": "vector", "\\triangle": "triangle", "\\pi": "pi", "\\prime": "prime", "\\infty": "infinity", "\\alpha": "alpha", "\\beta": "beta", "\\gamma": "gamma", "\\omega": "omega", "\\theta": "theta", "\\sigma": "sigma", "\\lambda": "lambda", "\\tau": "tau", "\\Delta": "delta", "\\delta": "delta", "\\mu": "mu", "\\rho": "rho", "\\nabla": "del", "\\ell": "ell", "\\ldots": "dots", // TODO: add entries for all accents "\\hat": "hat", "\\acute": "acute" }; const powerMap = { "prime": "prime", "degree": "degrees", "circle": "degrees", "2": "squared", "3": "cubed" }; const openMap = { "|": "open vertical bar", ".": "" }; const closeMap = { "|": "close vertical bar", ".": "" }; const binMap = { "+": "plus", "-": "minus", "\\pm": "plus minus", "\\cdot": "dot", "*": "times", "/": "divided by", "\\times": "times", "\\div": "divided by", "\\circ": "circle", "\\bullet": "bullet" }; const relMap = { "=": "equals", "\\approx": "approximately equals", "≠": "does not equal", "\\geq": "is greater than or equal to", "\\ge": "is greater than or equal to", "\\leq": "is less than or equal to", "\\le": "is less than or equal to", ">": "is greater than", "<": "is less than", "\\leftarrow": "left arrow", "\\Leftarrow": "left arrow", "\\rightarrow": "right arrow", "\\Rightarrow": "right arrow", ":": "colon" }; const accentUnderMap = { "\\underleftarrow": "left arrow", "\\underrightarrow": "right arrow", "\\underleftrightarrow": "left-right arrow", "\\undergroup": "group", "\\underlinesegment": "line segment", "\\utilde": "tilde" }; const buildString = (str, type, a11yStrings) => { if (!str) { return; } let ret; if (type === "open") { ret = str in openMap ? openMap[str] : stringMap[str] || str; } else if (type === "close") { ret = str in closeMap ? closeMap[str] : stringMap[str] || str; } else if (type === "bin") { ret = binMap[str] || str; } else if (type === "rel") { ret = relMap[str] || str; } else { ret = stringMap[str] || str; } // If the text to add is a number and there is already a string // in the list and the last string is a number then we should // combine them into a single number if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string // I think we might be able to drop the nested arrays, which would make // this easier to type - $FlowFixMe /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) { a11yStrings[a11yStrings.length - 1] += ret; } else if (ret) { a11yStrings.push(ret); } }; const buildRegion = (a11yStrings, callback) => { const regionStrings = []; a11yStrings.push(regionStrings); callback(regionStrings); }; const handleObject = (tree, a11yStrings, atomType) => { // Everything else is assumed to be an object... switch (tree.type) { case "accent": { buildRegion(a11yStrings, a11yStrings => { buildA11yStrings(tree.base, a11yStrings, atomType); a11yStrings.push("with"); buildString(tree.label, "normal", a11yStrings); a11yStrings.push("on top"); }); break; } case "accentUnder": { buildRegion(a11yStrings, a11yStrings => { buildA11yStrings(tree.base, a11yStrings, atomType); a11yStrings.push("with"); buildString(accentUnderMap[tree.label], "normal", a11yStrings); a11yStrings.push("underneath"); }); break; } case "accent-token": { // Used internally by accent symbols. break; } case "atom": { const text = tree.text; switch (tree.family) { case "bin": { buildString(text, "bin", a11yStrings); break; } case "close": { buildString(text, "close", a11yStrings); break; } // TODO(kevinb): figure out what should be done for inner case "inner": { buildString(tree.text, "inner", a11yStrings); break; } case "open": { buildString(text, "open", a11yStrings); break; } case "punct": { buildString(text, "punct", a11yStrings); break; } case "rel": { buildString(text, "rel", a11yStrings); break; } default: { tree.family; throw new Error(`"${tree.family}" is not a valid atom type`); } } break; } case "color": { const color = tree.color.replace(/katex-/, ""); buildRegion(a11yStrings, regionStrings => { regionStrings.push("start color " + color); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end color " + color); }); break; } case "color-token": { // Used by \color, \colorbox, and \fcolorbox but not directly rendered. // It's a leaf node and has no children so just break. break; } case "delimsizing": { if (tree.delim && tree.delim !== ".") { buildString(tree.delim, "normal", a11yStrings); } break; } case "genfrac": { buildRegion(a11yStrings, regionStrings => { // genfrac can have unbalanced delimiters const leftDelim = tree.leftDelim, rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption // hasBarLine true -> fraction, false -> binomial if (tree.hasBarLine) { regionStrings.push("start fraction"); leftDelim && buildString(leftDelim, "open", regionStrings); buildA11yStrings(tree.numer, regionStrings, atomType); regionStrings.push("divided by"); buildA11yStrings(tree.denom, regionStrings, atomType); rightDelim && buildString(rightDelim, "close", regionStrings); regionStrings.push("end fraction"); } else { regionStrings.push("start binomial"); leftDelim && buildString(leftDelim, "open", regionStrings); buildA11yStrings(tree.numer, regionStrings, atomType); regionStrings.push("over"); buildA11yStrings(tree.denom, regionStrings, atomType); rightDelim && buildString(rightDelim, "close", regionStrings); regionStrings.push("end binomial"); } }); break; } case "kern": { // No op: we don't attempt to present kerning information // to the screen reader. break; } case "leftright": { buildRegion(a11yStrings, regionStrings => { buildString(tree.left, "open", regionStrings); buildA11yStrings(tree.body, regionStrings, atomType); buildString(tree.right, "close", regionStrings); }); break; } case "leftright-right": { // TODO: double check that this is a no-op break; } case "lap": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "mathord": { buildString(tree.text, "normal", a11yStrings); break; } case "op": { const body = tree.body, name = tree.name; if (body) { buildA11yStrings(body, a11yStrings, atomType); } else if (name) { buildString(name, "normal", a11yStrings); } break; } case "op-token": { // Used internally by operator symbols. buildString(tree.text, atomType, a11yStrings); break; } case "ordgroup": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "overline": { buildRegion(a11yStrings, function (a11yStrings) { a11yStrings.push("start overline"); buildA11yStrings(tree.body, a11yStrings, atomType); a11yStrings.push("end overline"); }); break; } case "phantom": { a11yStrings.push("empty space"); break; } case "raisebox": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "rule": { a11yStrings.push("rectangle"); break; } case "sizing": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "spacing": { a11yStrings.push("space"); break; } case "styling": { // We ignore the styling and just pass through the contents buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "sqrt": { buildRegion(a11yStrings, regionStrings => { const body = tree.body, index = tree.index; if (index) { const indexString = flatten(buildA11yStrings(index, [], atomType)).join(","); if (indexString === "3") { regionStrings.push("cube root of"); buildA11yStrings(body, regionStrings, atomType); regionStrings.push("end cube root"); return; } regionStrings.push("root"); regionStrings.push("start index"); buildA11yStrings(index, regionStrings, atomType); regionStrings.push("end index"); return; } regionStrings.push("square root of"); buildA11yStrings(body, regionStrings, atomType); regionStrings.push("end square root"); }); break; } case "supsub": { const base = tree.base, sub = tree.sub, sup = tree.sup; let isLog = false; if (base) { buildA11yStrings(base, a11yStrings, atomType); isLog = base.type === "op" && base.name === "\\log"; } if (sub) { const regionName = isLog ? "base" : "subscript"; buildRegion(a11yStrings, function (regionStrings) { regionStrings.push(`start ${regionName}`); buildA11yStrings(sub, regionStrings, atomType); regionStrings.push(`end ${regionName}`); }); } if (sup) { buildRegion(a11yStrings, function (regionStrings) { const supString = flatten(buildA11yStrings(sup, [], atomType)).join(","); if (supString in powerMap) { regionStrings.push(powerMap[supString]); return; } regionStrings.push("start superscript"); buildA11yStrings(sup, regionStrings, atomType); regionStrings.push("end superscript"); }); } break; } case "text": { // TODO: handle other fonts if (tree.font === "\\textbf") { buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start bold text"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end bold text"); }); break; } buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start text"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end text"); }); break; } case "textord": { buildString(tree.text, atomType, a11yStrings); break; } case "smash": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "enclose": { // TODO: create a map for these. // TODO: differentiate between a body with a single atom, e.g. // "cancel a" instead of "start cancel, a, end cancel" if (/cancel/.test(tree.label)) { buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start cancel"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end cancel"); }); break; } else if (/box/.test(tree.label)) { buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start box"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end box"); }); break; } else if (/sout/.test(tree.label)) { buildRegion(a11yStrings, function (regionStrings) { regionStrings.push("start strikeout"); buildA11yStrings(tree.body, regionStrings, atomType); regionStrings.push("end strikeout"); }); break; } throw new Error(`KaTeX-a11y: enclose node with ${tree.label} not supported yet`); } case "vphantom": { throw new Error("KaTeX-a11y: vphantom not implemented yet"); } case "hphantom": { throw new Error("KaTeX-a11y: hphantom not implemented yet"); } case "operatorname": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "array": { throw new Error("KaTeX-a11y: array not implemented yet"); } case "raw": { throw new Error("KaTeX-a11y: raw not implemented yet"); } case "size": { // Although there are nodes of type "size" in the parse tree, they have // no semantic meaning and should be ignored. break; } case "url": { throw new Error("KaTeX-a11y: url not implemented yet"); } case "tag": { throw new Error("KaTeX-a11y: tag not implemented yet"); } case "verb": { buildString(`start verbatim`, "normal", a11yStrings); buildString(tree.body, "normal", a11yStrings); buildString(`end verbatim`, "normal", a11yStrings); break; } case "environment": { throw new Error("KaTeX-a11y: environment not implemented yet"); } case "horizBrace": { buildString(`start ${tree.label.slice(1)}`, "normal", a11yStrings); buildA11yStrings(tree.base, a11yStrings, atomType); buildString(`end ${tree.label.slice(1)}`, "normal", a11yStrings); break; } case "infix": { // All infix nodes are replace with other nodes. break; } case "includegraphics": { throw new Error("KaTeX-a11y: includegraphics not implemented yet"); } case "font": { // TODO: callout the start/end of specific fonts // TODO: map \BBb{N} to "the naturals" or something like that buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "href": { throw new Error("KaTeX-a11y: href not implemented yet"); } case "cr": { // This is used by environments. throw new Error("KaTeX-a11y: cr not implemented yet"); } case "underline": { buildRegion(a11yStrings, function (a11yStrings) { a11yStrings.push("start underline"); buildA11yStrings(tree.body, a11yStrings, atomType); a11yStrings.push("end underline"); }); break; } case "xArrow": { throw new Error("KaTeX-a11y: xArrow not implemented yet"); } case "mclass": { // \neq and \ne are macros so we let "htmlmathml" render the mathmal // side of things and extract the text from that. const atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass buildA11yStrings(tree.body, a11yStrings, atomType); break; } case "mathchoice": { // TODO: track which which style we're using, e.g. dispaly, text, etc. // default to text style if even that may not be the correct style buildA11yStrings(tree.text, a11yStrings, atomType); break; } case "htmlmathml": { buildA11yStrings(tree.mathml, a11yStrings, atomType); break; } case "middle": { buildString(tree.delim, atomType, a11yStrings); break; } case "internal": { // internal nodes are never included in the parse tree break; } case "html": { buildA11yStrings(tree.body, a11yStrings, atomType); break; } default: tree.type; throw new Error("KaTeX a11y un-recognized type: " + tree.type); } }; const buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) { if (a11yStrings === void 0) { a11yStrings = []; } if (tree instanceof Array) { for (let i = 0; i < tree.length; i++) { buildA11yStrings(tree[i], a11yStrings, atomType); } } else { handleObject(tree, a11yStrings, atomType); } return a11yStrings; }; const flatten = function flatten(array) { let result = []; array.forEach(function (item) { if (item instanceof Array) { result = result.concat(flatten(item)); } else { result.push(item); } }); return result; }; const renderA11yString = function renderA11yString(text, settings) { const tree = katex.__parse(text, settings); const a11yStrings = buildA11yStrings(tree, [], "normal"); return flatten(a11yStrings).join(", "); }; export default renderA11yString; ================================================ FILE: source/lib/katex@0.12.0/katex.css ================================================ /* stylelint-disable font-family-no-missing-generic-family-keyword */ @font-face { font-family: 'KaTeX_AMS'; src: url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'), url(fonts/KaTeX_AMS-Regular.woff) format('woff'), url(fonts/KaTeX_AMS-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Caligraphic'; src: url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'), url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'), url(fonts/KaTeX_Caligraphic-Bold.ttf) format('truetype'); font-weight: bold; font-style: normal; } @font-face { font-family: 'KaTeX_Caligraphic'; src: url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'), url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'), url(fonts/KaTeX_Caligraphic-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Fraktur'; src: url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'), url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'), url(fonts/KaTeX_Fraktur-Bold.ttf) format('truetype'); font-weight: bold; font-style: normal; } @font-face { font-family: 'KaTeX_Fraktur'; src: url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'), url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'), url(fonts/KaTeX_Fraktur-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Main'; src: url(fonts/KaTeX_Main-Bold.woff2) format('woff2'), url(fonts/KaTeX_Main-Bold.woff) format('woff'), url(fonts/KaTeX_Main-Bold.ttf) format('truetype'); font-weight: bold; font-style: normal; } @font-face { font-family: 'KaTeX_Main'; src: url(fonts/KaTeX_Main-BoldItalic.woff2) format('woff2'), url(fonts/KaTeX_Main-BoldItalic.woff) format('woff'), url(fonts/KaTeX_Main-BoldItalic.ttf) format('truetype'); font-weight: bold; font-style: italic; } @font-face { font-family: 'KaTeX_Main'; src: url(fonts/KaTeX_Main-Italic.woff2) format('woff2'), url(fonts/KaTeX_Main-Italic.woff) format('woff'), url(fonts/KaTeX_Main-Italic.ttf) format('truetype'); font-weight: normal; font-style: italic; } @font-face { font-family: 'KaTeX_Main'; src: url(fonts/KaTeX_Main-Regular.woff2) format('woff2'), url(fonts/KaTeX_Main-Regular.woff) format('woff'), url(fonts/KaTeX_Main-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Math'; src: url(fonts/KaTeX_Math-BoldItalic.woff2) format('woff2'), url(fonts/KaTeX_Math-BoldItalic.woff) format('woff'), url(fonts/KaTeX_Math-BoldItalic.ttf) format('truetype'); font-weight: bold; font-style: italic; } @font-face { font-family: 'KaTeX_Math'; src: url(fonts/KaTeX_Math-Italic.woff2) format('woff2'), url(fonts/KaTeX_Math-Italic.woff) format('woff'), url(fonts/KaTeX_Math-Italic.ttf) format('truetype'); font-weight: normal; font-style: italic; } @font-face { font-family: 'KaTeX_SansSerif'; src: url(fonts/KaTeX_SansSerif-Bold.woff2) format('woff2'), url(fonts/KaTeX_SansSerif-Bold.woff) format('woff'), url(fonts/KaTeX_SansSerif-Bold.ttf) format('truetype'); font-weight: bold; font-style: normal; } @font-face { font-family: 'KaTeX_SansSerif'; src: url(fonts/KaTeX_SansSerif-Italic.woff2) format('woff2'), url(fonts/KaTeX_SansSerif-Italic.woff) format('woff'), url(fonts/KaTeX_SansSerif-Italic.ttf) format('truetype'); font-weight: normal; font-style: italic; } @font-face { font-family: 'KaTeX_SansSerif'; src: url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'), url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'), url(fonts/KaTeX_SansSerif-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Script'; src: url(fonts/KaTeX_Script-Regular.woff2) format('woff2'), url(fonts/KaTeX_Script-Regular.woff) format('woff'), url(fonts/KaTeX_Script-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Size1'; src: url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'), url(fonts/KaTeX_Size1-Regular.woff) format('woff'), url(fonts/KaTeX_Size1-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Size2'; src: url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'), url(fonts/KaTeX_Size2-Regular.woff) format('woff'), url(fonts/KaTeX_Size2-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Size3'; src: url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'), url(fonts/KaTeX_Size3-Regular.woff) format('woff'), url(fonts/KaTeX_Size3-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Size4'; src: url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'), url(fonts/KaTeX_Size4-Regular.woff) format('woff'), url(fonts/KaTeX_Size4-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Typewriter'; src: url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'), url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'), url(fonts/KaTeX_Typewriter-Regular.ttf) format('truetype'); font-weight: normal; font-style: normal; } .katex { font: normal 1.21em KaTeX_Main, Times New Roman, serif; line-height: 1.2; text-indent: 0; text-rendering: auto; border-color: currentColor; } .katex * { -ms-high-contrast-adjust: none !important; } .katex .katex-version::after { content: "0.12.0"; } .katex .katex-mathml { position: absolute; clip: rect(1px, 1px, 1px, 1px); padding: 0; border: 0; height: 1px; width: 1px; overflow: hidden; } .katex .katex-html { /* \newline is an empty block at top level, between .base elements */ } .katex .katex-html > .newline { display: block; } .katex .base { position: relative; display: inline-block; white-space: nowrap; width: min-content; } .katex .strut { display: inline-block; } .katex .textbf { font-weight: bold; } .katex .textit { font-style: italic; } .katex .textrm { font-family: KaTeX_Main; } .katex .textsf { font-family: KaTeX_SansSerif; } .katex .texttt { font-family: KaTeX_Typewriter; } .katex .mathnormal { font-family: KaTeX_Math; font-style: italic; } .katex .mathit { font-family: KaTeX_Main; font-style: italic; } .katex .mathrm { font-style: normal; } .katex .mathbf { font-family: KaTeX_Main; font-weight: bold; } .katex .boldsymbol { font-family: KaTeX_Math; font-weight: bold; font-style: italic; } .katex .amsrm { font-family: KaTeX_AMS; } .katex .mathbb, .katex .textbb { font-family: KaTeX_AMS; } .katex .mathcal { font-family: KaTeX_Caligraphic; } .katex .mathfrak, .katex .textfrak { font-family: KaTeX_Fraktur; } .katex .mathtt { font-family: KaTeX_Typewriter; } .katex .mathscr, .katex .textscr { font-family: KaTeX_Script; } .katex .mathsf, .katex .textsf { font-family: KaTeX_SansSerif; } .katex .mathboldsf, .katex .textboldsf { font-family: KaTeX_SansSerif; font-weight: bold; } .katex .mathitsf, .katex .textitsf { font-family: KaTeX_SansSerif; font-style: italic; } .katex .mainrm { font-family: KaTeX_Main; font-style: normal; } .katex .vlist-t { display: inline-table; table-layout: fixed; border-collapse: collapse; } .katex .vlist-r { display: table-row; } .katex .vlist { display: table-cell; vertical-align: bottom; position: relative; } .katex .vlist > span { display: block; height: 0; position: relative; } .katex .vlist > span > span { display: inline-block; } .katex .vlist > span > .pstrut { overflow: hidden; width: 0; } .katex .vlist-t2 { margin-right: -2px; } .katex .vlist-s { display: table-cell; vertical-align: bottom; font-size: 1px; width: 2px; min-width: 2px; } .katex .vbox { display: -ms-inline-flexbox; display: inline-flex; -ms-flex-direction: column; flex-direction: column; align-items: baseline; } .katex .hbox { display: -ms-inline-flexbox; display: inline-flex; -ms-flex-direction: row; flex-direction: row; width: 100%; } .katex .thinbox { display: inline-flex; flex-direction: row; width: 0; max-width: 0; } .katex .msupsub { text-align: left; } .katex .mfrac > span > span { text-align: center; } .katex .mfrac .frac-line { display: inline-block; width: 100%; border-bottom-style: solid; } .katex .mfrac .frac-line, .katex .overline .overline-line, .katex .underline .underline-line, .katex .hline, .katex .hdashline, .katex .rule { min-height: 1px; } .katex .mspace { display: inline-block; } .katex .llap, .katex .rlap, .katex .clap { width: 0; position: relative; } .katex .llap > .inner, .katex .rlap > .inner, .katex .clap > .inner { position: absolute; } .katex .llap > .fix, .katex .rlap > .fix, .katex .clap > .fix { display: inline-block; } .katex .llap > .inner { right: 0; } .katex .rlap > .inner, .katex .clap > .inner { left: 0; } .katex .clap > .inner > span { margin-left: -50%; margin-right: 50%; } .katex .rule { display: inline-block; border: solid 0; position: relative; } .katex .overline .overline-line, .katex .underline .underline-line, .katex .hline { display: inline-block; width: 100%; border-bottom-style: solid; } .katex .hdashline { display: inline-block; width: 100%; border-bottom-style: dashed; } .katex .sqrt > .root { margin-left: 0.27777778em; margin-right: -0.55555556em; } .katex .sizing.reset-size1.size1, .katex .fontsize-ensurer.reset-size1.size1 { font-size: 1em; } .katex .sizing.reset-size1.size2, .katex .fontsize-ensurer.reset-size1.size2 { font-size: 1.2em; } .katex .sizing.reset-size1.size3, .katex .fontsize-ensurer.reset-size1.size3 { font-size: 1.4em; } .katex .sizing.reset-size1.size4, .katex .fontsize-ensurer.reset-size1.size4 { font-size: 1.6em; } .katex .sizing.reset-size1.size5, .katex .fontsize-ensurer.reset-size1.size5 { font-size: 1.8em; } .katex .sizing.reset-size1.size6, .katex .fontsize-ensurer.reset-size1.size6 { font-size: 2em; } .katex .sizing.reset-size1.size7, .katex .fontsize-ensurer.reset-size1.size7 { font-size: 2.4em; } .katex .sizing.reset-size1.size8, .katex .fontsize-ensurer.reset-size1.size8 { font-size: 2.88em; } .katex .sizing.reset-size1.size9, .katex .fontsize-ensurer.reset-size1.size9 { font-size: 3.456em; } .katex .sizing.reset-size1.size10, .katex .fontsize-ensurer.reset-size1.size10 { font-size: 4.148em; } .katex .sizing.reset-size1.size11, .katex .fontsize-ensurer.reset-size1.size11 { font-size: 4.976em; } .katex .sizing.reset-size2.size1, .katex .fontsize-ensurer.reset-size2.size1 { font-size: 0.83333333em; } .katex .sizing.reset-size2.size2, .katex .fontsize-ensurer.reset-size2.size2 { font-size: 1em; } .katex .sizing.reset-size2.size3, .katex .fontsize-ensurer.reset-size2.size3 { font-size: 1.16666667em; } .katex .sizing.reset-size2.size4, .katex .fontsize-ensurer.reset-size2.size4 { font-size: 1.33333333em; } .katex .sizing.reset-size2.size5, .katex .fontsize-ensurer.reset-size2.size5 { font-size: 1.5em; } .katex .sizing.reset-size2.size6, .katex .fontsize-ensurer.reset-size2.size6 { font-size: 1.66666667em; } .katex .sizing.reset-size2.size7, .katex .fontsize-ensurer.reset-size2.size7 { font-size: 2em; } .katex .sizing.reset-size2.size8, .katex .fontsize-ensurer.reset-size2.size8 { font-size: 2.4em; } .katex .sizing.reset-size2.size9, .katex .fontsize-ensurer.reset-size2.size9 { font-size: 2.88em; } .katex .sizing.reset-size2.size10, .katex .fontsize-ensurer.reset-size2.size10 { font-size: 3.45666667em; } .katex .sizing.reset-size2.size11, .katex .fontsize-ensurer.reset-size2.size11 { font-size: 4.14666667em; } .katex .sizing.reset-size3.size1, .katex .fontsize-ensurer.reset-size3.size1 { font-size: 0.71428571em; } .katex .sizing.reset-size3.size2, .katex .fontsize-ensurer.reset-size3.size2 { font-size: 0.85714286em; } .katex .sizing.reset-size3.size3, .katex .fontsize-ensurer.reset-size3.size3 { font-size: 1em; } .katex .sizing.reset-size3.size4, .katex .fontsize-ensurer.reset-size3.size4 { font-size: 1.14285714em; } .katex .sizing.reset-size3.size5, .katex .fontsize-ensurer.reset-size3.size5 { font-size: 1.28571429em; } .katex .sizing.reset-size3.size6, .katex .fontsize-ensurer.reset-size3.size6 { font-size: 1.42857143em; } .katex .sizing.reset-size3.size7, .katex .fontsize-ensurer.reset-size3.size7 { font-size: 1.71428571em; } .katex .sizing.reset-size3.size8, .katex .fontsize-ensurer.reset-size3.size8 { font-size: 2.05714286em; } .katex .sizing.reset-size3.size9, .katex .fontsize-ensurer.reset-size3.size9 { font-size: 2.46857143em; } .katex .sizing.reset-size3.size10, .katex .fontsize-ensurer.reset-size3.size10 { font-size: 2.96285714em; } .katex .sizing.reset-size3.size11, .katex .fontsize-ensurer.reset-size3.size11 { font-size: 3.55428571em; } .katex .sizing.reset-size4.size1, .katex .fontsize-ensurer.reset-size4.size1 { font-size: 0.625em; } .katex .sizing.reset-size4.size2, .katex .fontsize-ensurer.reset-size4.size2 { font-size: 0.75em; } .katex .sizing.reset-size4.size3, .katex .fontsize-ensurer.reset-size4.size3 { font-size: 0.875em; } .katex .sizing.reset-size4.size4, .katex .fontsize-ensurer.reset-size4.size4 { font-size: 1em; } .katex .sizing.reset-size4.size5, .katex .fontsize-ensurer.reset-size4.size5 { font-size: 1.125em; } .katex .sizing.reset-size4.size6, .katex .fontsize-ensurer.reset-size4.size6 { font-size: 1.25em; } .katex .sizing.reset-size4.size7, .katex .fontsize-ensurer.reset-size4.size7 { font-size: 1.5em; } .katex .sizing.reset-size4.size8, .katex .fontsize-ensurer.reset-size4.size8 { font-size: 1.8em; } .katex .sizing.reset-size4.size9, .katex .fontsize-ensurer.reset-size4.size9 { font-size: 2.16em; } .katex .sizing.reset-size4.size10, .katex .fontsize-ensurer.reset-size4.size10 { font-size: 2.5925em; } .katex .sizing.reset-size4.size11, .katex .fontsize-ensurer.reset-size4.size11 { font-size: 3.11em; } .katex .sizing.reset-size5.size1, .katex .fontsize-ensurer.reset-size5.size1 { font-size: 0.55555556em; } .katex .sizing.reset-size5.size2, .katex .fontsize-ensurer.reset-size5.size2 { font-size: 0.66666667em; } .katex .sizing.reset-size5.size3, .katex .fontsize-ensurer.reset-size5.size3 { font-size: 0.77777778em; } .katex .sizing.reset-size5.size4, .katex .fontsize-ensurer.reset-size5.size4 { font-size: 0.88888889em; } .katex .sizing.reset-size5.size5, .katex .fontsize-ensurer.reset-size5.size5 { font-size: 1em; } .katex .sizing.reset-size5.size6, .katex .fontsize-ensurer.reset-size5.size6 { font-size: 1.11111111em; } .katex .sizing.reset-size5.size7, .katex .fontsize-ensurer.reset-size5.size7 { font-size: 1.33333333em; } .katex .sizing.reset-size5.size8, .katex .fontsize-ensurer.reset-size5.size8 { font-size: 1.6em; } .katex .sizing.reset-size5.size9, .katex .fontsize-ensurer.reset-size5.size9 { font-size: 1.92em; } .katex .sizing.reset-size5.size10, .katex .fontsize-ensurer.reset-size5.size10 { font-size: 2.30444444em; } .katex .sizing.reset-size5.size11, .katex .fontsize-ensurer.reset-size5.size11 { font-size: 2.76444444em; } .katex .sizing.reset-size6.size1, .katex .fontsize-ensurer.reset-size6.size1 { font-size: 0.5em; } .katex .sizing.reset-size6.size2, .katex .fontsize-ensurer.reset-size6.size2 { font-size: 0.6em; } .katex .sizing.reset-size6.size3, .katex .fontsize-ensurer.reset-size6.size3 { font-size: 0.7em; } .katex .sizing.reset-size6.size4, .katex .fontsize-ensurer.reset-size6.size4 { font-size: 0.8em; } .katex .sizing.reset-size6.size5, .katex .fontsize-ensurer.reset-size6.size5 { font-size: 0.9em; } .katex .sizing.reset-size6.size6, .katex .fontsize-ensurer.reset-size6.size6 { font-size: 1em; } .katex .sizing.reset-size6.size7, .katex .fontsize-ensurer.reset-size6.size7 { font-size: 1.2em; } .katex .sizing.reset-size6.size8, .katex .fontsize-ensurer.reset-size6.size8 { font-size: 1.44em; } .katex .sizing.reset-size6.size9, .katex .fontsize-ensurer.reset-size6.size9 { font-size: 1.728em; } .katex .sizing.reset-size6.size10, .katex .fontsize-ensurer.reset-size6.size10 { font-size: 2.074em; } .katex .sizing.reset-size6.size11, .katex .fontsize-ensurer.reset-size6.size11 { font-size: 2.488em; } .katex .sizing.reset-size7.size1, .katex .fontsize-ensurer.reset-size7.size1 { font-size: 0.41666667em; } .katex .sizing.reset-size7.size2, .katex .fontsize-ensurer.reset-size7.size2 { font-size: 0.5em; } .katex .sizing.reset-size7.size3, .katex .fontsize-ensurer.reset-size7.size3 { font-size: 0.58333333em; } .katex .sizing.reset-size7.size4, .katex .fontsize-ensurer.reset-size7.size4 { font-size: 0.66666667em; } .katex .sizing.reset-size7.size5, .katex .fontsize-ensurer.reset-size7.size5 { font-size: 0.75em; } .katex .sizing.reset-size7.size6, .katex .fontsize-ensurer.reset-size7.size6 { font-size: 0.83333333em; } .katex .sizing.reset-size7.size7, .katex .fontsize-ensurer.reset-size7.size7 { font-size: 1em; } .katex .sizing.reset-size7.size8, .katex .fontsize-ensurer.reset-size7.size8 { font-size: 1.2em; } .katex .sizing.reset-size7.size9, .katex .fontsize-ensurer.reset-size7.size9 { font-size: 1.44em; } .katex .sizing.reset-size7.size10, .katex .fontsize-ensurer.reset-size7.size10 { font-size: 1.72833333em; } .katex .sizing.reset-size7.size11, .katex .fontsize-ensurer.reset-size7.size11 { font-size: 2.07333333em; } .katex .sizing.reset-size8.size1, .katex .fontsize-ensurer.reset-size8.size1 { font-size: 0.34722222em; } .katex .sizing.reset-size8.size2, .katex .fontsize-ensurer.reset-size8.size2 { font-size: 0.41666667em; } .katex .sizing.reset-size8.size3, .katex .fontsize-ensurer.reset-size8.size3 { font-size: 0.48611111em; } .katex .sizing.reset-size8.size4, .katex .fontsize-ensurer.reset-size8.size4 { font-size: 0.55555556em; } .katex .sizing.reset-size8.size5, .katex .fontsize-ensurer.reset-size8.size5 { font-size: 0.625em; } .katex .sizing.reset-size8.size6, .katex .fontsize-ensurer.reset-size8.size6 { font-size: 0.69444444em; } .katex .sizing.reset-size8.size7, .katex .fontsize-ensurer.reset-size8.size7 { font-size: 0.83333333em; } .katex .sizing.reset-size8.size8, .katex .fontsize-ensurer.reset-size8.size8 { font-size: 1em; } .katex .sizing.reset-size8.size9, .katex .fontsize-ensurer.reset-size8.size9 { font-size: 1.2em; } .katex .sizing.reset-size8.size10, .katex .fontsize-ensurer.reset-size8.size10 { font-size: 1.44027778em; } .katex .sizing.reset-size8.size11, .katex .fontsize-ensurer.reset-size8.size11 { font-size: 1.72777778em; } .katex .sizing.reset-size9.size1, .katex .fontsize-ensurer.reset-size9.size1 { font-size: 0.28935185em; } .katex .sizing.reset-size9.size2, .katex .fontsize-ensurer.reset-size9.size2 { font-size: 0.34722222em; } .katex .sizing.reset-size9.size3, .katex .fontsize-ensurer.reset-size9.size3 { font-size: 0.40509259em; } .katex .sizing.reset-size9.size4, .katex .fontsize-ensurer.reset-size9.size4 { font-size: 0.46296296em; } .katex .sizing.reset-size9.size5, .katex .fontsize-ensurer.reset-size9.size5 { font-size: 0.52083333em; } .katex .sizing.reset-size9.size6, .katex .fontsize-ensurer.reset-size9.size6 { font-size: 0.5787037em; } .katex .sizing.reset-size9.size7, .katex .fontsize-ensurer.reset-size9.size7 { font-size: 0.69444444em; } .katex .sizing.reset-size9.size8, .katex .fontsize-ensurer.reset-size9.size8 { font-size: 0.83333333em; } .katex .sizing.reset-size9.size9, .katex .fontsize-ensurer.reset-size9.size9 { font-size: 1em; } .katex .sizing.reset-size9.size10, .katex .fontsize-ensurer.reset-size9.size10 { font-size: 1.20023148em; } .katex .sizing.reset-size9.size11, .katex .fontsize-ensurer.reset-size9.size11 { font-size: 1.43981481em; } .katex .sizing.reset-size10.size1, .katex .fontsize-ensurer.reset-size10.size1 { font-size: 0.24108004em; } .katex .sizing.reset-size10.size2, .katex .fontsize-ensurer.reset-size10.size2 { font-size: 0.28929605em; } .katex .sizing.reset-size10.size3, .katex .fontsize-ensurer.reset-size10.size3 { font-size: 0.33751205em; } .katex .sizing.reset-size10.size4, .katex .fontsize-ensurer.reset-size10.size4 { font-size: 0.38572806em; } .katex .sizing.reset-size10.size5, .katex .fontsize-ensurer.reset-size10.size5 { font-size: 0.43394407em; } .katex .sizing.reset-size10.size6, .katex .fontsize-ensurer.reset-size10.size6 { font-size: 0.48216008em; } .katex .sizing.reset-size10.size7, .katex .fontsize-ensurer.reset-size10.size7 { font-size: 0.57859209em; } .katex .sizing.reset-size10.size8, .katex .fontsize-ensurer.reset-size10.size8 { font-size: 0.69431051em; } .katex .sizing.reset-size10.size9, .katex .fontsize-ensurer.reset-size10.size9 { font-size: 0.83317261em; } .katex .sizing.reset-size10.size10, .katex .fontsize-ensurer.reset-size10.size10 { font-size: 1em; } .katex .sizing.reset-size10.size11, .katex .fontsize-ensurer.reset-size10.size11 { font-size: 1.19961427em; } .katex .sizing.reset-size11.size1, .katex .fontsize-ensurer.reset-size11.size1 { font-size: 0.20096463em; } .katex .sizing.reset-size11.size2, .katex .fontsize-ensurer.reset-size11.size2 { font-size: 0.24115756em; } .katex .sizing.reset-size11.size3, .katex .fontsize-ensurer.reset-size11.size3 { font-size: 0.28135048em; } .katex .sizing.reset-size11.size4, .katex .fontsize-ensurer.reset-size11.size4 { font-size: 0.32154341em; } .katex .sizing.reset-size11.size5, .katex .fontsize-ensurer.reset-size11.size5 { font-size: 0.36173633em; } .katex .sizing.reset-size11.size6, .katex .fontsize-ensurer.reset-size11.size6 { font-size: 0.40192926em; } .katex .sizing.reset-size11.size7, .katex .fontsize-ensurer.reset-size11.size7 { font-size: 0.48231511em; } .katex .sizing.reset-size11.size8, .katex .fontsize-ensurer.reset-size11.size8 { font-size: 0.57877814em; } .katex .sizing.reset-size11.size9, .katex .fontsize-ensurer.reset-size11.size9 { font-size: 0.69453376em; } .katex .sizing.reset-size11.size10, .katex .fontsize-ensurer.reset-size11.size10 { font-size: 0.83360129em; } .katex .sizing.reset-size11.size11, .katex .fontsize-ensurer.reset-size11.size11 { font-size: 1em; } .katex .delimsizing.size1 { font-family: KaTeX_Size1; } .katex .delimsizing.size2 { font-family: KaTeX_Size2; } .katex .delimsizing.size3 { font-family: KaTeX_Size3; } .katex .delimsizing.size4 { font-family: KaTeX_Size4; } .katex .delimsizing.mult .delim-size1 > span { font-family: KaTeX_Size1; } .katex .delimsizing.mult .delim-size4 > span { font-family: KaTeX_Size4; } .katex .nulldelimiter { display: inline-block; width: 0.12em; } .katex .delimcenter { position: relative; } .katex .op-symbol { position: relative; } .katex .op-symbol.small-op { font-family: KaTeX_Size1; } .katex .op-symbol.large-op { font-family: KaTeX_Size2; } .katex .op-limits > .vlist-t { text-align: center; } .katex .accent > .vlist-t { text-align: center; } .katex .accent .accent-body { position: relative; } .katex .accent .accent-body:not(.accent-full) { width: 0; } .katex .overlay { display: block; } .katex .mtable .vertical-separator { display: inline-block; min-width: 1px; } .katex .mtable .arraycolsep { display: inline-block; } .katex .mtable .col-align-c > .vlist-t { text-align: center; } .katex .mtable .col-align-l > .vlist-t { text-align: left; } .katex .mtable .col-align-r > .vlist-t { text-align: right; } .katex .svg-align { text-align: left; } .katex svg { display: block; position: absolute; width: 100%; height: inherit; fill: currentColor; stroke: currentColor; fill-rule: nonzero; fill-opacity: 1; stroke-width: 1; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0; stroke-opacity: 1; } .katex svg path { stroke: none; } .katex img { border-style: none; min-width: 0; min-height: 0; max-width: none; max-height: none; } .katex .stretchy { width: 100%; display: block; position: relative; overflow: hidden; } .katex .stretchy::before, .katex .stretchy::after { content: ""; } .katex .hide-tail { width: 100%; position: relative; overflow: hidden; } .katex .halfarrow-left { position: absolute; left: 0; width: 50.2%; overflow: hidden; } .katex .halfarrow-right { position: absolute; right: 0; width: 50.2%; overflow: hidden; } .katex .brace-left { position: absolute; left: 0; width: 25.1%; overflow: hidden; } .katex .brace-center { position: absolute; left: 25%; width: 50%; overflow: hidden; } .katex .brace-right { position: absolute; right: 0; width: 25.1%; overflow: hidden; } .katex .x-arrow-pad { padding: 0 0.5em; } .katex .x-arrow, .katex .mover, .katex .munder { text-align: center; } .katex .boxpad { padding: 0 0.3em 0 0.3em; } .katex .fbox, .katex .fcolorbox { box-sizing: border-box; border: 0.04em solid; } .katex .cancel-pad { padding: 0 0.2em 0 0.2em; } .katex .cancel-lap { margin-left: -0.2em; margin-right: -0.2em; } .katex .sout { border-bottom-style: solid; border-bottom-width: 0.08em; } .katex-display { display: block; margin: 1em 0; text-align: center; } .katex-display > .katex { display: block; text-align: center; white-space: nowrap; } .katex-display > .katex > .katex-html { display: block; position: relative; } .katex-display > .katex > .katex-html > .tag { position: absolute; right: 0; } .katex-display.leqno > .katex > .katex-html > .tag { left: 0; right: auto; } .katex-display.fleqn > .katex { text-align: left; padding-left: 2em; } ================================================ FILE: source/lib/katex@0.12.0/katex.js ================================================ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["katex"] = factory(); else root["katex"] = factory(); })((typeof self !== 'undefined' ? self : this), function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./src/katex.less var katex = __webpack_require__(0); // CONCATENATED MODULE: ./src/SourceLocation.js /** * Lexing or parsing positional information for error reporting. * This object is immutable. */ var SourceLocation = /*#__PURE__*/ function () { // The + prefix indicates that these fields aren't writeable // Lexer holding the input string. // Start offset, zero-based inclusive. // End offset, zero-based exclusive. function SourceLocation(lexer, start, end) { this.lexer = void 0; this.start = void 0; this.end = void 0; this.lexer = lexer; this.start = start; this.end = end; } /** * Merges two `SourceLocation`s from location providers, given they are * provided in order of appearance. * - Returns the first one's location if only the first is provided. * - Returns a merged range of the first and the last if both are provided * and their lexers match. * - Otherwise, returns null. */ SourceLocation.range = function range(first, second) { if (!second) { return first && first.loc; } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) { return null; } else { return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end); } }; return SourceLocation; }(); // CONCATENATED MODULE: ./src/Token.js /** * Interface required to break circular dependency between Token, Lexer, and * ParseError. */ /** * The resulting token returned from `lex`. * * It consists of the token text plus some position information. * The position information is essentially a range in an input string, * but instead of referencing the bare input string, we refer to the lexer. * That way it is possible to attach extra metadata to the input string, * like for example a file name or similar. * * The position information is optional, so it is OK to construct synthetic * tokens if appropriate. Not providing available position information may * lead to degraded error reporting, though. */ var Token_Token = /*#__PURE__*/ function () { // don't expand the token // used in \noexpand function Token(text, // the text of this token loc) { this.text = void 0; this.loc = void 0; this.noexpand = void 0; this.treatAsRelax = void 0; this.text = text; this.loc = loc; } /** * Given a pair of tokens (this and endToken), compute a `Token` encompassing * the whole input range enclosed by these two. */ var _proto = Token.prototype; _proto.range = function range(endToken, // last token of the range, inclusive text) // the text of the newly constructed token { return new Token(text, SourceLocation.range(this, endToken)); }; return Token; }(); // CONCATENATED MODULE: ./src/ParseError.js /** * This is the ParseError class, which is the main error thrown by KaTeX * functions when something has gone wrong. This is used to distinguish internal * errors from errors in the expression that the user provided. * * If possible, a caller should provide a Token or ParseNode with information * about where in the source string the problem occurred. */ var ParseError = // Error position based on passed-in Token or ParseNode. function ParseError(message, // The error message token) // An object providing position information { this.position = void 0; var error = "KaTeX parse error: " + message; var start; var loc = token && token.loc; if (loc && loc.start <= loc.end) { // If we have the input and a position, make the error a bit fancier // Get the input var input = loc.lexer.input; // Prepend some information start = loc.start; var end = loc.end; if (start === input.length) { error += " at end of input: "; } else { error += " at position " + (start + 1) + ": "; } // Underline token in question using combining underscores var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); // Extract some context from the input and add it to the error var left; if (start > 15) { left = "…" + input.slice(start - 15, start); } else { left = input.slice(0, start); } var right; if (end + 15 < input.length) { right = input.slice(end, end + 15) + "…"; } else { right = input.slice(end); } error += left + underlined + right; } // Some hackery to make ParseError a prototype of Error // See http://stackoverflow.com/a/8460753 var self = new Error(error); self.name = "ParseError"; // $FlowFixMe self.__proto__ = ParseError.prototype; // $FlowFixMe self.position = start; return self; }; // $FlowFixMe More hackery ParseError.prototype.__proto__ = Error.prototype; /* harmony default export */ var src_ParseError = (ParseError); // CONCATENATED MODULE: ./src/utils.js /** * This file contains a list of utility functions which are useful in other * files. */ /** * Return whether an element is contained in a list */ var contains = function contains(list, elem) { return list.indexOf(elem) !== -1; }; /** * Provide a default value if a setting is undefined * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022. */ var deflt = function deflt(setting, defaultIfUndefined) { return setting === undefined ? defaultIfUndefined : setting; }; // hyphenate and escape adapted from Facebook's React under Apache 2 license var uppercase = /([A-Z])/g; var hyphenate = function hyphenate(str) { return str.replace(uppercase, "-$1").toLowerCase(); }; var ESCAPE_LOOKUP = { "&": "&", ">": ">", "<": "<", "\"": """, "'": "'" }; var ESCAPE_REGEX = /[&><"']/g; /** * Escapes text to prevent scripting attacks. */ function utils_escape(text) { return String(text).replace(ESCAPE_REGEX, function (match) { return ESCAPE_LOOKUP[match]; }); } /** * Sometimes we want to pull out the innermost element of a group. In most * cases, this will just be the group itself, but when ordgroups and colors have * a single element, we want to pull that out. */ var getBaseElem = function getBaseElem(group) { if (group.type === "ordgroup") { if (group.body.length === 1) { return getBaseElem(group.body[0]); } else { return group; } } else if (group.type === "color") { if (group.body.length === 1) { return getBaseElem(group.body[0]); } else { return group; } } else if (group.type === "font") { return getBaseElem(group.body); } else { return group; } }; /** * TeXbook algorithms often reference "character boxes", which are simply groups * with a single character in them. To decide if something is a character box, * we find its innermost group, and see if it is a single character. */ var utils_isCharacterBox = function isCharacterBox(group) { var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom"; }; var assert = function assert(value) { if (!value) { throw new Error('Expected non-null, but got ' + String(value)); } return value; }; /** * Return the protocol of a URL, or "_relative" if the URL does not specify a * protocol (and thus is relative). */ var protocolFromUrl = function protocolFromUrl(url) { var protocol = /^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(url); return protocol != null ? protocol[1] : "_relative"; }; /* harmony default export */ var utils = ({ contains: contains, deflt: deflt, escape: utils_escape, hyphenate: hyphenate, getBaseElem: getBaseElem, isCharacterBox: utils_isCharacterBox, protocolFromUrl: protocolFromUrl }); // CONCATENATED MODULE: ./src/Settings.js /* eslint no-console:0 */ /** * This is a module for storing settings passed into KaTeX. It correctly handles * default settings. */ /** * The main Settings object * * The current options stored are: * - displayMode: Whether the expression should be typeset as inline math * (false, the default), meaning that the math starts in * \textstyle and is placed in an inline-block); or as display * math (true), meaning that the math starts in \displaystyle * and is placed in a block with vertical margin. */ var Settings_Settings = /*#__PURE__*/ function () { function Settings(options) { this.displayMode = void 0; this.output = void 0; this.leqno = void 0; this.fleqn = void 0; this.throwOnError = void 0; this.errorColor = void 0; this.macros = void 0; this.minRuleThickness = void 0; this.colorIsTextColor = void 0; this.strict = void 0; this.trust = void 0; this.maxSize = void 0; this.maxExpand = void 0; this.globalGroup = void 0; // allow null options options = options || {}; this.displayMode = utils.deflt(options.displayMode, false); this.output = utils.deflt(options.output, "htmlAndMathml"); this.leqno = utils.deflt(options.leqno, false); this.fleqn = utils.deflt(options.fleqn, false); this.throwOnError = utils.deflt(options.throwOnError, true); this.errorColor = utils.deflt(options.errorColor, "#cc0000"); this.macros = options.macros || {}; this.minRuleThickness = Math.max(0, utils.deflt(options.minRuleThickness, 0)); this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false); this.strict = utils.deflt(options.strict, "warn"); this.trust = utils.deflt(options.trust, false); this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity)); this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000)); this.globalGroup = utils.deflt(options.globalGroup, false); } /** * Report nonstrict (non-LaTeX-compatible) input. * Can safely not be called if `this.strict` is false in JavaScript. */ var _proto = Settings.prototype; _proto.reportNonstrict = function reportNonstrict(errorCode, errorMsg, token) { var strict = this.strict; if (typeof strict === "function") { // Allow return value of strict function to be boolean or string // (or null/undefined, meaning no further processing). strict = strict(errorCode, errorMsg, token); } if (!strict || strict === "ignore") { } else if (strict === true || strict === "error") { throw new src_ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token); } else if (strict === "warn") { typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); } else { // won't happen in type-safe code typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); } } /** * Check whether to apply strict (LaTeX-adhering) behavior for unusual * input (like `\\`). Unlike `nonstrict`, will not throw an error; * instead, "error" translates to a return value of `true`, while "ignore" * translates to a return value of `false`. May still print a warning: * "warn" prints a warning and returns `false`. * This is for the second category of `errorCode`s listed in the README. */ ; _proto.useStrictBehavior = function useStrictBehavior(errorCode, errorMsg, token) { var strict = this.strict; if (typeof strict === "function") { // Allow return value of strict function to be boolean or string // (or null/undefined, meaning no further processing). // But catch any exceptions thrown by function, treating them // like "error". try { strict = strict(errorCode, errorMsg, token); } catch (error) { strict = "error"; } } if (!strict || strict === "ignore") { return false; } else if (strict === true || strict === "error") { return true; } else if (strict === "warn") { typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); return false; } else { // won't happen in type-safe code typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); return false; } } /** * Check whether to test potentially dangerous input, and return * `true` (trusted) or `false` (untrusted). The sole argument `context` * should be an object with `command` field specifying the relevant LaTeX * command (as a string starting with `\`), and any other arguments, etc. * If `context` has a `url` field, a `protocol` field will automatically * get added by this function (changing the specified object). */ ; _proto.isTrusted = function isTrusted(context) { if (context.url && !context.protocol) { context.protocol = utils.protocolFromUrl(context.url); } var trust = typeof this.trust === "function" ? this.trust(context) : this.trust; return Boolean(trust); }; return Settings; }(); // CONCATENATED MODULE: ./src/Style.js /** * This file contains information and classes for the various kinds of styles * used in TeX. It provides a generic `Style` class, which holds information * about a specific style. It then provides instances of all the different kinds * of styles possible, and provides functions to move between them and get * information about them. */ /** * The main style class. Contains a unique id for the style, a size (which is * the same for cramped and uncramped version of a style), and a cramped flag. */ var Style = /*#__PURE__*/ function () { function Style(id, size, cramped) { this.id = void 0; this.size = void 0; this.cramped = void 0; this.id = id; this.size = size; this.cramped = cramped; } /** * Get the style of a superscript given a base in the current style. */ var _proto = Style.prototype; _proto.sup = function sup() { return Style_styles[_sup[this.id]]; } /** * Get the style of a subscript given a base in the current style. */ ; _proto.sub = function sub() { return Style_styles[_sub[this.id]]; } /** * Get the style of a fraction numerator given the fraction in the current * style. */ ; _proto.fracNum = function fracNum() { return Style_styles[_fracNum[this.id]]; } /** * Get the style of a fraction denominator given the fraction in the current * style. */ ; _proto.fracDen = function fracDen() { return Style_styles[_fracDen[this.id]]; } /** * Get the cramped version of a style (in particular, cramping a cramped style * doesn't change the style). */ ; _proto.cramp = function cramp() { return Style_styles[_cramp[this.id]]; } /** * Get a text or display version of this style. */ ; _proto.text = function text() { return Style_styles[_text[this.id]]; } /** * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) */ ; _proto.isTight = function isTight() { return this.size >= 2; }; return Style; }(); // Export an interface for type checking, but don't expose the implementation. // This way, no more styles can be generated. // IDs of the different styles var D = 0; var Dc = 1; var T = 2; var Tc = 3; var S = 4; var Sc = 5; var SS = 6; var SSc = 7; // Instances of the different styles var Style_styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles. /* harmony default export */ var src_Style = ({ DISPLAY: Style_styles[D], TEXT: Style_styles[T], SCRIPT: Style_styles[S], SCRIPTSCRIPT: Style_styles[SS] }); // CONCATENATED MODULE: ./src/unicodeScripts.js /* * This file defines the Unicode scripts and script families that we * support. To add new scripts or families, just add a new entry to the * scriptData array below. Adding scripts to the scriptData array allows * characters from that script to appear in \text{} environments. */ /** * Each script or script family has a name and an array of blocks. * Each block is an array of two numbers which specify the start and * end points (inclusive) of a block of Unicode codepoints. */ /** * Unicode block data for the families of scripts we support in \text{}. * Scripts only need to appear here if they do not have font metrics. */ var scriptData = [{ // Latin characters beyond the Latin-1 characters we have metrics for. // Needed for Czech, Hungarian and Turkish text, for example. name: 'latin', blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B [0x0300, 0x036f]] }, { // The Cyrillic script used by Russian and related languages. // A Cyrillic subset used to be supported as explicitly defined // symbols in symbols.js name: 'cyrillic', blocks: [[0x0400, 0x04ff]] }, { // The Brahmic scripts of South and Southeast Asia // Devanagari (0900–097F) // Bengali (0980–09FF) // Gurmukhi (0A00–0A7F) // Gujarati (0A80–0AFF) // Oriya (0B00–0B7F) // Tamil (0B80–0BFF) // Telugu (0C00–0C7F) // Kannada (0C80–0CFF) // Malayalam (0D00–0D7F) // Sinhala (0D80–0DFF) // Thai (0E00–0E7F) // Lao (0E80–0EFF) // Tibetan (0F00–0FFF) // Myanmar (1000–109F) name: 'brahmic', blocks: [[0x0900, 0x109F]] }, { name: 'georgian', blocks: [[0x10A0, 0x10ff]] }, { // Chinese and Japanese. // The "k" in cjk is for Korean, but we've separated Korean out name: "cjk", blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana [0x4E00, 0x9FAF], // CJK ideograms [0xFF00, 0xFF60]] }, { // Korean name: 'hangul', blocks: [[0xAC00, 0xD7AF]] }]; /** * Given a codepoint, return the name of the script or script family * it is from, or null if it is not part of a known block */ function scriptFromCodepoint(codepoint) { for (var i = 0; i < scriptData.length; i++) { var script = scriptData[i]; for (var _i = 0; _i < script.blocks.length; _i++) { var block = script.blocks[_i]; if (codepoint >= block[0] && codepoint <= block[1]) { return script.name; } } } return null; } /** * A flattened version of all the supported blocks in a single array. * This is an optimization to make supportedCodepoint() fast. */ var allBlocks = []; scriptData.forEach(function (s) { return s.blocks.forEach(function (b) { return allBlocks.push.apply(allBlocks, b); }); }); /** * Given a codepoint, return true if it falls within one of the * scripts or script families defined above and false otherwise. * * Micro benchmarks shows that this is faster than * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test() * in Firefox, Chrome and Node. */ function supportedCodepoint(codepoint) { for (var i = 0; i < allBlocks.length; i += 2) { if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) { return true; } } return false; } // CONCATENATED MODULE: ./src/svgGeometry.js /** * This file provides support to domTree.js and delimiter.js. * It's a storehouse of path geometry for SVG images. */ // In all paths below, the viewBox-to-em scale is 1000:1. var hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping. // The viniculum of a \sqrt can be made thicker by a KaTeX rendering option. // Think of variable extraViniculum as two detours in the SVG path. // The detour begins at the lower left of the area labeled extraViniculum below. // The detour proceeds one extraViniculum distance up and slightly to the right, // displacing the radiused corner between surd and viniculum. The radius is // traversed as usual, then the detour resumes. It goes right, to the end of // the very long viniculumn, then down one extraViniculum distance, // after which it resumes regular path geometry for the radical. /* viniculum / /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraViniculum / █████████████████████←0.04em (40 unit) std viniculum thickness / / / / / /\ / / surd */ var sqrtMain = function sqrtMain(extraViniculum, hLinePad) { // sqrtMain path geometry is from glyph U221A in the font KaTeX Main return "M95," + (622 + extraViniculum + hLinePad) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraViniculum / 2.075 + " -" + extraViniculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraViniculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; var sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) { // size1 is from glyph U221A in the font KaTeX_Size1-Regular return "M263," + (601 + extraViniculum + hLinePad) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraViniculum / 2.084 + " -" + extraViniculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraViniculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; var sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) { // size2 is from glyph U221A in the font KaTeX_Size2-Regular return "M983 " + (10 + extraViniculum + hLinePad) + "\nl" + extraViniculum / 3.13 + " -" + extraViniculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraViniculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z"; }; var sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) { // size3 is from glyph U221A in the font KaTeX_Size3-Regular return "M424," + (2398 + extraViniculum + hLinePad) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraViniculum / 4.223 + " -" + extraViniculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraViniculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraViniculum) + " " + hLinePad + "\nh400000v" + (40 + extraViniculum) + "h-400000z"; }; var sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) { // size4 is from glyph U221A in the font KaTeX_Size4-Regular return "M473," + (2713 + extraViniculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraViniculum / 5.298 + " -" + extraViniculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraViniculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "H1017.7z"; }; var sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) { // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular // One path edge has a variable length. It runs vertically from the viniculumn // to a point near (14 units) the bottom of the surd. The viniculum // is normally 40 units thick. So the length of the line in question is: var vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum; return "M702 " + (extraViniculum + hLinePad) + "H400000" + (40 + extraViniculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad + "H400000v" + (40 + extraViniculum) + "H742z"; }; var sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) { extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox. var path = ""; switch (size) { case "sqrtMain": path = sqrtMain(extraViniculum, hLinePad); break; case "sqrtSize1": path = sqrtSize1(extraViniculum, hLinePad); break; case "sqrtSize2": path = sqrtSize2(extraViniculum, hLinePad); break; case "sqrtSize3": path = sqrtSize3(extraViniculum, hLinePad); break; case "sqrtSize4": path = sqrtSize4(extraViniculum, hLinePad); break; case "sqrtTall": path = sqrtTall(extraViniculum, hLinePad, viewBoxHeight); } return path; }; var svgGeometry_path = { // Two paths that cover gaps in built-up parentheses. leftParenInner: "M291 0 H417 V300 H291 z", rightParenInner: "M457 0 H583 V300 H457 z", // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z", // doublerightarrow is from glyph U+21D2 in font KaTeX Main doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z", // leftarrow is from glyph U+2190 in font KaTeX Main leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z", // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular leftbrace: "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z", leftbraceunder: "M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z", // overgroup is from the MnSymbol package (public domain) leftgroup: "M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z", leftgroupunder: "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z", // Harpoons are from glyph U+21BD in font KaTeX Main leftharpoon: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z", leftharpoonplus: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z", leftharpoondown: "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z", leftharpoondownplus: "M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z", // hook is from glyph U+21A9 in font KaTeX Main lefthook: "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z", leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z", leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z", // tofrom is from glyph U+21C4 in font KaTeX AMS Regular leftToFrom: "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z", longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z", midbrace: "M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z", midbraceunder: "M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z", oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z", oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z", oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z", oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z", rightarrow: "M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z", rightbrace: "M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z", rightbraceunder: "M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z", rightgroup: "M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z", rightgroupunder: "M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z", rightharpoon: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z", rightharpoonplus: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z", rightharpoondown: "M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z", rightharpoondownplus: "M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z", righthook: "M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z", rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z", rightToFrom: "M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z", // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular twoheadleftarrow: "M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z", twoheadrightarrow: "M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z", // tilde1 is a modified version of a glyph from the MnSymbol package tilde1: "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z", // ditto tilde2, tilde3, & tilde4 tilde2: "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z", tilde3: "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z", tilde4: "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z", // vec is from glyph U+20D7 in font KaTeX Main vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z", // widehat1 is a modified version of a glyph from the MnSymbol package widehat1: "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z", // ditto widehat2, widehat3, & widehat4 widehat2: "M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", widehat3: "M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", widehat4: "M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", // widecheck paths are all inverted versions of widehat widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z", widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", // The next ten paths support reaction arrows from the mhchem package. // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z", // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z", // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z", rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z", shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z", shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z" }; // CONCATENATED MODULE: ./src/tree.js /** * This node represents a document fragment, which contains elements, but when * placed into the DOM doesn't have any representation itself. It only contains * children and doesn't have any DOM node properties. */ var tree_DocumentFragment = /*#__PURE__*/ function () { // HtmlDomNode // Never used; needed for satisfying interface. function DocumentFragment(children) { this.children = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; this.children = children; this.classes = []; this.height = 0; this.depth = 0; this.maxFontSize = 0; this.style = {}; } var _proto = DocumentFragment.prototype; _proto.hasClass = function hasClass(className) { return utils.contains(this.classes, className); } /** Convert the fragment into a node. */ ; _proto.toNode = function toNode() { var frag = document.createDocumentFragment(); for (var i = 0; i < this.children.length; i++) { frag.appendChild(this.children[i].toNode()); } return frag; } /** Convert the fragment into HTML markup. */ ; _proto.toMarkup = function toMarkup() { var markup = ""; // Simply concatenate the markup for the children together. for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } return markup; } /** * Converts the math node into a string, similar to innerText. Applies to * MathDomNode's only. */ ; _proto.toText = function toText() { // To avoid this, we would subclass documentFragment separately for // MathML, but polyfills for subclassing is expensive per PR 1469. // $FlowFixMe: Only works for ChildType = MathDomNode. var toText = function toText(child) { return child.toText(); }; return this.children.map(toText).join(""); }; return DocumentFragment; }(); // CONCATENATED MODULE: ./src/domTree.js /** * These objects store the data about the DOM nodes we create, as well as some * extra data. They can then be transformed into real DOM nodes with the * `toNode` function or HTML markup using `toMarkup`. They are useful for both * storing extra properties on the nodes, as well as providing a way to easily * work with the DOM. * * Similar functions for working with MathML nodes exist in mathMLTree.js. * * TODO: refactor `span` and `anchor` into common superclass when * target environments support class inheritance */ /** * Create an HTML className based on a list of classes. In addition to joining * with spaces, we also remove empty classes. */ var createClass = function createClass(classes) { return classes.filter(function (cls) { return cls; }).join(" "); }; var initNode = function initNode(classes, options, style) { this.classes = classes || []; this.attributes = {}; this.height = 0; this.depth = 0; this.maxFontSize = 0; this.style = style || {}; if (options) { if (options.style.isTight()) { this.classes.push("mtight"); } var color = options.getColor(); if (color) { this.style.color = color; } } }; /** * Convert into an HTML node */ var _toNode = function toNode(tagName) { var node = document.createElement(tagName); // Apply the class node.className = createClass(this.classes); // Apply inline styles for (var style in this.style) { if (this.style.hasOwnProperty(style)) { // $FlowFixMe Flow doesn't seem to understand span.style's type. node.style[style] = this.style[style]; } } // Apply attributes for (var attr in this.attributes) { if (this.attributes.hasOwnProperty(attr)) { node.setAttribute(attr, this.attributes[attr]); } } // Append the children, also as HTML nodes for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; }; /** * Convert into an HTML markup string */ var _toMarkup = function toMarkup(tagName) { var markup = "<" + tagName; // Add the class if (this.classes.length) { markup += " class=\"" + utils.escape(createClass(this.classes)) + "\""; } var styles = ""; // Add the styles, after hyphenation for (var style in this.style) { if (this.style.hasOwnProperty(style)) { styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; } } if (styles) { markup += " style=\"" + utils.escape(styles) + "\""; } // Add the attributes for (var attr in this.attributes) { if (this.attributes.hasOwnProperty(attr)) { markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\""; } } markup += ">"; // Add the markup of the children, also as markup for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } markup += ""; return markup; }; // Making the type below exact with all optional fields doesn't work due to // - https://github.com/facebook/flow/issues/4582 // - https://github.com/facebook/flow/issues/5688 // However, since *all* fields are optional, $Shape<> works as suggested in 5688 // above. // This type does not include all CSS properties. Additional properties should // be added as needed. /** * This node represents a span node, with a className, a list of children, and * an inline style. It also contains information about its height, depth, and * maxFontSize. * * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan * otherwise. This typesafety is important when HTML builders access a span's * children. */ var domTree_Span = /*#__PURE__*/ function () { function Span(classes, children, options, style) { this.children = void 0; this.attributes = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.width = void 0; this.maxFontSize = void 0; this.style = void 0; initNode.call(this, classes, options, style); this.children = children || []; } /** * Sets an arbitrary attribute on the span. Warning: use this wisely. Not * all browsers support attributes the same, and having too many custom * attributes is probably bad. */ var _proto = Span.prototype; _proto.setAttribute = function setAttribute(attribute, value) { this.attributes[attribute] = value; }; _proto.hasClass = function hasClass(className) { return utils.contains(this.classes, className); }; _proto.toNode = function toNode() { return _toNode.call(this, "span"); }; _proto.toMarkup = function toMarkup() { return _toMarkup.call(this, "span"); }; return Span; }(); /** * This node represents an anchor () element with a hyperlink. See `span` * for further details. */ var domTree_Anchor = /*#__PURE__*/ function () { function Anchor(href, classes, children, options) { this.children = void 0; this.attributes = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; initNode.call(this, classes, options); this.children = children || []; this.setAttribute('href', href); } var _proto2 = Anchor.prototype; _proto2.setAttribute = function setAttribute(attribute, value) { this.attributes[attribute] = value; }; _proto2.hasClass = function hasClass(className) { return utils.contains(this.classes, className); }; _proto2.toNode = function toNode() { return _toNode.call(this, "a"); }; _proto2.toMarkup = function toMarkup() { return _toMarkup.call(this, "a"); }; return Anchor; }(); /** * This node represents an image embed () element. */ var domTree_Img = /*#__PURE__*/ function () { function Img(src, alt, style) { this.src = void 0; this.alt = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; this.alt = alt; this.src = src; this.classes = ["mord"]; this.style = style; } var _proto3 = Img.prototype; _proto3.hasClass = function hasClass(className) { return utils.contains(this.classes, className); }; _proto3.toNode = function toNode() { var node = document.createElement("img"); node.src = this.src; node.alt = this.alt; node.className = "mord"; // Apply inline styles for (var style in this.style) { if (this.style.hasOwnProperty(style)) { // $FlowFixMe node.style[style] = this.style[style]; } } return node; }; _proto3.toMarkup = function toMarkup() { var markup = "" + this.alt + " 0) { span = document.createElement("span"); span.style.marginRight = this.italic + "em"; } if (this.classes.length > 0) { span = span || document.createElement("span"); span.className = createClass(this.classes); } for (var style in this.style) { if (this.style.hasOwnProperty(style)) { span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type. span.style[style] = this.style[style]; } } if (span) { span.appendChild(node); return span; } else { return node; } } /** * Creates markup for a symbol node. */ ; _proto4.toMarkup = function toMarkup() { // TODO(alpert): More duplication than I'd like from // span.prototype.toMarkup and symbolNode.prototype.toNode... var needsSpan = false; var markup = " 0) { styles += "margin-right:" + this.italic + "em;"; } for (var style in this.style) { if (this.style.hasOwnProperty(style)) { styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; } } if (styles) { needsSpan = true; markup += " style=\"" + utils.escape(styles) + "\""; } var escaped = utils.escape(this.text); if (needsSpan) { markup += ">"; markup += escaped; markup += ""; return markup; } else { return escaped; } }; return SymbolNode; }(); /** * SVG nodes are used to render stretchy wide elements. */ var SvgNode = /*#__PURE__*/ function () { function SvgNode(children, attributes) { this.children = void 0; this.attributes = void 0; this.children = children || []; this.attributes = attributes || {}; } var _proto5 = SvgNode.prototype; _proto5.toNode = function toNode() { var svgNS = "http://www.w3.org/2000/svg"; var node = document.createElementNS(svgNS, "svg"); // Apply attributes for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; }; _proto5.toMarkup = function toMarkup() { var markup = ""; } else { return ""; } }; return PathNode; }(); var LineNode = /*#__PURE__*/ function () { function LineNode(attributes) { this.attributes = void 0; this.attributes = attributes || {}; } var _proto7 = LineNode.prototype; _proto7.toNode = function toNode() { var svgNS = "http://www.w3.org/2000/svg"; var node = document.createElementNS(svgNS, "line"); // Apply attributes for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } return node; }; _proto7.toMarkup = function toMarkup() { var markup = " but got " + String(group) + "."); } } // CONCATENATED MODULE: ./submodules/katex-fonts/fontMetricsData.js // This file is GENERATED by buildMetrics.sh. DO NOT MODIFY. /* harmony default export */ var fontMetricsData = ({ "AMS-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.68889, 0, 0, 0.72222], "66": [0, 0.68889, 0, 0, 0.66667], "67": [0, 0.68889, 0, 0, 0.72222], "68": [0, 0.68889, 0, 0, 0.72222], "69": [0, 0.68889, 0, 0, 0.66667], "70": [0, 0.68889, 0, 0, 0.61111], "71": [0, 0.68889, 0, 0, 0.77778], "72": [0, 0.68889, 0, 0, 0.77778], "73": [0, 0.68889, 0, 0, 0.38889], "74": [0.16667, 0.68889, 0, 0, 0.5], "75": [0, 0.68889, 0, 0, 0.77778], "76": [0, 0.68889, 0, 0, 0.66667], "77": [0, 0.68889, 0, 0, 0.94445], "78": [0, 0.68889, 0, 0, 0.72222], "79": [0.16667, 0.68889, 0, 0, 0.77778], "80": [0, 0.68889, 0, 0, 0.61111], "81": [0.16667, 0.68889, 0, 0, 0.77778], "82": [0, 0.68889, 0, 0, 0.72222], "83": [0, 0.68889, 0, 0, 0.55556], "84": [0, 0.68889, 0, 0, 0.66667], "85": [0, 0.68889, 0, 0, 0.72222], "86": [0, 0.68889, 0, 0, 0.72222], "87": [0, 0.68889, 0, 0, 1.0], "88": [0, 0.68889, 0, 0, 0.72222], "89": [0, 0.68889, 0, 0, 0.72222], "90": [0, 0.68889, 0, 0, 0.66667], "107": [0, 0.68889, 0, 0, 0.55556], "160": [0, 0, 0, 0, 0.25], "165": [0, 0.675, 0.025, 0, 0.75], "174": [0.15559, 0.69224, 0, 0, 0.94666], "240": [0, 0.68889, 0, 0, 0.55556], "295": [0, 0.68889, 0, 0, 0.54028], "710": [0, 0.825, 0, 0, 2.33334], "732": [0, 0.9, 0, 0, 2.33334], "770": [0, 0.825, 0, 0, 2.33334], "771": [0, 0.9, 0, 0, 2.33334], "989": [0.08167, 0.58167, 0, 0, 0.77778], "1008": [0, 0.43056, 0.04028, 0, 0.66667], "8245": [0, 0.54986, 0, 0, 0.275], "8463": [0, 0.68889, 0, 0, 0.54028], "8487": [0, 0.68889, 0, 0, 0.72222], "8498": [0, 0.68889, 0, 0, 0.55556], "8502": [0, 0.68889, 0, 0, 0.66667], "8503": [0, 0.68889, 0, 0, 0.44445], "8504": [0, 0.68889, 0, 0, 0.66667], "8513": [0, 0.68889, 0, 0, 0.63889], "8592": [-0.03598, 0.46402, 0, 0, 0.5], "8594": [-0.03598, 0.46402, 0, 0, 0.5], "8602": [-0.13313, 0.36687, 0, 0, 1.0], "8603": [-0.13313, 0.36687, 0, 0, 1.0], "8606": [0.01354, 0.52239, 0, 0, 1.0], "8608": [0.01354, 0.52239, 0, 0, 1.0], "8610": [0.01354, 0.52239, 0, 0, 1.11111], "8611": [0.01354, 0.52239, 0, 0, 1.11111], "8619": [0, 0.54986, 0, 0, 1.0], "8620": [0, 0.54986, 0, 0, 1.0], "8621": [-0.13313, 0.37788, 0, 0, 1.38889], "8622": [-0.13313, 0.36687, 0, 0, 1.0], "8624": [0, 0.69224, 0, 0, 0.5], "8625": [0, 0.69224, 0, 0, 0.5], "8630": [0, 0.43056, 0, 0, 1.0], "8631": [0, 0.43056, 0, 0, 1.0], "8634": [0.08198, 0.58198, 0, 0, 0.77778], "8635": [0.08198, 0.58198, 0, 0, 0.77778], "8638": [0.19444, 0.69224, 0, 0, 0.41667], "8639": [0.19444, 0.69224, 0, 0, 0.41667], "8642": [0.19444, 0.69224, 0, 0, 0.41667], "8643": [0.19444, 0.69224, 0, 0, 0.41667], "8644": [0.1808, 0.675, 0, 0, 1.0], "8646": [0.1808, 0.675, 0, 0, 1.0], "8647": [0.1808, 0.675, 0, 0, 1.0], "8648": [0.19444, 0.69224, 0, 0, 0.83334], "8649": [0.1808, 0.675, 0, 0, 1.0], "8650": [0.19444, 0.69224, 0, 0, 0.83334], "8651": [0.01354, 0.52239, 0, 0, 1.0], "8652": [0.01354, 0.52239, 0, 0, 1.0], "8653": [-0.13313, 0.36687, 0, 0, 1.0], "8654": [-0.13313, 0.36687, 0, 0, 1.0], "8655": [-0.13313, 0.36687, 0, 0, 1.0], "8666": [0.13667, 0.63667, 0, 0, 1.0], "8667": [0.13667, 0.63667, 0, 0, 1.0], "8669": [-0.13313, 0.37788, 0, 0, 1.0], "8672": [-0.064, 0.437, 0, 0, 1.334], "8674": [-0.064, 0.437, 0, 0, 1.334], "8705": [0, 0.825, 0, 0, 0.5], "8708": [0, 0.68889, 0, 0, 0.55556], "8709": [0.08167, 0.58167, 0, 0, 0.77778], "8717": [0, 0.43056, 0, 0, 0.42917], "8722": [-0.03598, 0.46402, 0, 0, 0.5], "8724": [0.08198, 0.69224, 0, 0, 0.77778], "8726": [0.08167, 0.58167, 0, 0, 0.77778], "8733": [0, 0.69224, 0, 0, 0.77778], "8736": [0, 0.69224, 0, 0, 0.72222], "8737": [0, 0.69224, 0, 0, 0.72222], "8738": [0.03517, 0.52239, 0, 0, 0.72222], "8739": [0.08167, 0.58167, 0, 0, 0.22222], "8740": [0.25142, 0.74111, 0, 0, 0.27778], "8741": [0.08167, 0.58167, 0, 0, 0.38889], "8742": [0.25142, 0.74111, 0, 0, 0.5], "8756": [0, 0.69224, 0, 0, 0.66667], "8757": [0, 0.69224, 0, 0, 0.66667], "8764": [-0.13313, 0.36687, 0, 0, 0.77778], "8765": [-0.13313, 0.37788, 0, 0, 0.77778], "8769": [-0.13313, 0.36687, 0, 0, 0.77778], "8770": [-0.03625, 0.46375, 0, 0, 0.77778], "8774": [0.30274, 0.79383, 0, 0, 0.77778], "8776": [-0.01688, 0.48312, 0, 0, 0.77778], "8778": [0.08167, 0.58167, 0, 0, 0.77778], "8782": [0.06062, 0.54986, 0, 0, 0.77778], "8783": [0.06062, 0.54986, 0, 0, 0.77778], "8785": [0.08198, 0.58198, 0, 0, 0.77778], "8786": [0.08198, 0.58198, 0, 0, 0.77778], "8787": [0.08198, 0.58198, 0, 0, 0.77778], "8790": [0, 0.69224, 0, 0, 0.77778], "8791": [0.22958, 0.72958, 0, 0, 0.77778], "8796": [0.08198, 0.91667, 0, 0, 0.77778], "8806": [0.25583, 0.75583, 0, 0, 0.77778], "8807": [0.25583, 0.75583, 0, 0, 0.77778], "8808": [0.25142, 0.75726, 0, 0, 0.77778], "8809": [0.25142, 0.75726, 0, 0, 0.77778], "8812": [0.25583, 0.75583, 0, 0, 0.5], "8814": [0.20576, 0.70576, 0, 0, 0.77778], "8815": [0.20576, 0.70576, 0, 0, 0.77778], "8816": [0.30274, 0.79383, 0, 0, 0.77778], "8817": [0.30274, 0.79383, 0, 0, 0.77778], "8818": [0.22958, 0.72958, 0, 0, 0.77778], "8819": [0.22958, 0.72958, 0, 0, 0.77778], "8822": [0.1808, 0.675, 0, 0, 0.77778], "8823": [0.1808, 0.675, 0, 0, 0.77778], "8828": [0.13667, 0.63667, 0, 0, 0.77778], "8829": [0.13667, 0.63667, 0, 0, 0.77778], "8830": [0.22958, 0.72958, 0, 0, 0.77778], "8831": [0.22958, 0.72958, 0, 0, 0.77778], "8832": [0.20576, 0.70576, 0, 0, 0.77778], "8833": [0.20576, 0.70576, 0, 0, 0.77778], "8840": [0.30274, 0.79383, 0, 0, 0.77778], "8841": [0.30274, 0.79383, 0, 0, 0.77778], "8842": [0.13597, 0.63597, 0, 0, 0.77778], "8843": [0.13597, 0.63597, 0, 0, 0.77778], "8847": [0.03517, 0.54986, 0, 0, 0.77778], "8848": [0.03517, 0.54986, 0, 0, 0.77778], "8858": [0.08198, 0.58198, 0, 0, 0.77778], "8859": [0.08198, 0.58198, 0, 0, 0.77778], "8861": [0.08198, 0.58198, 0, 0, 0.77778], "8862": [0, 0.675, 0, 0, 0.77778], "8863": [0, 0.675, 0, 0, 0.77778], "8864": [0, 0.675, 0, 0, 0.77778], "8865": [0, 0.675, 0, 0, 0.77778], "8872": [0, 0.69224, 0, 0, 0.61111], "8873": [0, 0.69224, 0, 0, 0.72222], "8874": [0, 0.69224, 0, 0, 0.88889], "8876": [0, 0.68889, 0, 0, 0.61111], "8877": [0, 0.68889, 0, 0, 0.61111], "8878": [0, 0.68889, 0, 0, 0.72222], "8879": [0, 0.68889, 0, 0, 0.72222], "8882": [0.03517, 0.54986, 0, 0, 0.77778], "8883": [0.03517, 0.54986, 0, 0, 0.77778], "8884": [0.13667, 0.63667, 0, 0, 0.77778], "8885": [0.13667, 0.63667, 0, 0, 0.77778], "8888": [0, 0.54986, 0, 0, 1.11111], "8890": [0.19444, 0.43056, 0, 0, 0.55556], "8891": [0.19444, 0.69224, 0, 0, 0.61111], "8892": [0.19444, 0.69224, 0, 0, 0.61111], "8901": [0, 0.54986, 0, 0, 0.27778], "8903": [0.08167, 0.58167, 0, 0, 0.77778], "8905": [0.08167, 0.58167, 0, 0, 0.77778], "8906": [0.08167, 0.58167, 0, 0, 0.77778], "8907": [0, 0.69224, 0, 0, 0.77778], "8908": [0, 0.69224, 0, 0, 0.77778], "8909": [-0.03598, 0.46402, 0, 0, 0.77778], "8910": [0, 0.54986, 0, 0, 0.76042], "8911": [0, 0.54986, 0, 0, 0.76042], "8912": [0.03517, 0.54986, 0, 0, 0.77778], "8913": [0.03517, 0.54986, 0, 0, 0.77778], "8914": [0, 0.54986, 0, 0, 0.66667], "8915": [0, 0.54986, 0, 0, 0.66667], "8916": [0, 0.69224, 0, 0, 0.66667], "8918": [0.0391, 0.5391, 0, 0, 0.77778], "8919": [0.0391, 0.5391, 0, 0, 0.77778], "8920": [0.03517, 0.54986, 0, 0, 1.33334], "8921": [0.03517, 0.54986, 0, 0, 1.33334], "8922": [0.38569, 0.88569, 0, 0, 0.77778], "8923": [0.38569, 0.88569, 0, 0, 0.77778], "8926": [0.13667, 0.63667, 0, 0, 0.77778], "8927": [0.13667, 0.63667, 0, 0, 0.77778], "8928": [0.30274, 0.79383, 0, 0, 0.77778], "8929": [0.30274, 0.79383, 0, 0, 0.77778], "8934": [0.23222, 0.74111, 0, 0, 0.77778], "8935": [0.23222, 0.74111, 0, 0, 0.77778], "8936": [0.23222, 0.74111, 0, 0, 0.77778], "8937": [0.23222, 0.74111, 0, 0, 0.77778], "8938": [0.20576, 0.70576, 0, 0, 0.77778], "8939": [0.20576, 0.70576, 0, 0, 0.77778], "8940": [0.30274, 0.79383, 0, 0, 0.77778], "8941": [0.30274, 0.79383, 0, 0, 0.77778], "8994": [0.19444, 0.69224, 0, 0, 0.77778], "8995": [0.19444, 0.69224, 0, 0, 0.77778], "9416": [0.15559, 0.69224, 0, 0, 0.90222], "9484": [0, 0.69224, 0, 0, 0.5], "9488": [0, 0.69224, 0, 0, 0.5], "9492": [0, 0.37788, 0, 0, 0.5], "9496": [0, 0.37788, 0, 0, 0.5], "9585": [0.19444, 0.68889, 0, 0, 0.88889], "9586": [0.19444, 0.74111, 0, 0, 0.88889], "9632": [0, 0.675, 0, 0, 0.77778], "9633": [0, 0.675, 0, 0, 0.77778], "9650": [0, 0.54986, 0, 0, 0.72222], "9651": [0, 0.54986, 0, 0, 0.72222], "9654": [0.03517, 0.54986, 0, 0, 0.77778], "9660": [0, 0.54986, 0, 0, 0.72222], "9661": [0, 0.54986, 0, 0, 0.72222], "9664": [0.03517, 0.54986, 0, 0, 0.77778], "9674": [0.11111, 0.69224, 0, 0, 0.66667], "9733": [0.19444, 0.69224, 0, 0, 0.94445], "10003": [0, 0.69224, 0, 0, 0.83334], "10016": [0, 0.69224, 0, 0, 0.83334], "10731": [0.11111, 0.69224, 0, 0, 0.66667], "10846": [0.19444, 0.75583, 0, 0, 0.61111], "10877": [0.13667, 0.63667, 0, 0, 0.77778], "10878": [0.13667, 0.63667, 0, 0, 0.77778], "10885": [0.25583, 0.75583, 0, 0, 0.77778], "10886": [0.25583, 0.75583, 0, 0, 0.77778], "10887": [0.13597, 0.63597, 0, 0, 0.77778], "10888": [0.13597, 0.63597, 0, 0, 0.77778], "10889": [0.26167, 0.75726, 0, 0, 0.77778], "10890": [0.26167, 0.75726, 0, 0, 0.77778], "10891": [0.48256, 0.98256, 0, 0, 0.77778], "10892": [0.48256, 0.98256, 0, 0, 0.77778], "10901": [0.13667, 0.63667, 0, 0, 0.77778], "10902": [0.13667, 0.63667, 0, 0, 0.77778], "10933": [0.25142, 0.75726, 0, 0, 0.77778], "10934": [0.25142, 0.75726, 0, 0, 0.77778], "10935": [0.26167, 0.75726, 0, 0, 0.77778], "10936": [0.26167, 0.75726, 0, 0, 0.77778], "10937": [0.26167, 0.75726, 0, 0, 0.77778], "10938": [0.26167, 0.75726, 0, 0, 0.77778], "10949": [0.25583, 0.75583, 0, 0, 0.77778], "10950": [0.25583, 0.75583, 0, 0, 0.77778], "10955": [0.28481, 0.79383, 0, 0, 0.77778], "10956": [0.28481, 0.79383, 0, 0, 0.77778], "57350": [0.08167, 0.58167, 0, 0, 0.22222], "57351": [0.08167, 0.58167, 0, 0, 0.38889], "57352": [0.08167, 0.58167, 0, 0, 0.77778], "57353": [0, 0.43056, 0.04028, 0, 0.66667], "57356": [0.25142, 0.75726, 0, 0, 0.77778], "57357": [0.25142, 0.75726, 0, 0, 0.77778], "57358": [0.41951, 0.91951, 0, 0, 0.77778], "57359": [0.30274, 0.79383, 0, 0, 0.77778], "57360": [0.30274, 0.79383, 0, 0, 0.77778], "57361": [0.41951, 0.91951, 0, 0, 0.77778], "57366": [0.25142, 0.75726, 0, 0, 0.77778], "57367": [0.25142, 0.75726, 0, 0, 0.77778], "57368": [0.25142, 0.75726, 0, 0, 0.77778], "57369": [0.25142, 0.75726, 0, 0, 0.77778], "57370": [0.13597, 0.63597, 0, 0, 0.77778], "57371": [0.13597, 0.63597, 0, 0, 0.77778] }, "Caligraphic-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.68333, 0, 0.19445, 0.79847], "66": [0, 0.68333, 0.03041, 0.13889, 0.65681], "67": [0, 0.68333, 0.05834, 0.13889, 0.52653], "68": [0, 0.68333, 0.02778, 0.08334, 0.77139], "69": [0, 0.68333, 0.08944, 0.11111, 0.52778], "70": [0, 0.68333, 0.09931, 0.11111, 0.71875], "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], "72": [0, 0.68333, 0.00965, 0.11111, 0.84452], "73": [0, 0.68333, 0.07382, 0, 0.54452], "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], "75": [0, 0.68333, 0.01445, 0.05556, 0.76195], "76": [0, 0.68333, 0, 0.13889, 0.68972], "77": [0, 0.68333, 0, 0.13889, 1.2009], "78": [0, 0.68333, 0.14736, 0.08334, 0.82049], "79": [0, 0.68333, 0.02778, 0.11111, 0.79611], "80": [0, 0.68333, 0.08222, 0.08334, 0.69556], "81": [0.09722, 0.68333, 0, 0.11111, 0.81667], "82": [0, 0.68333, 0, 0.08334, 0.8475], "83": [0, 0.68333, 0.075, 0.13889, 0.60556], "84": [0, 0.68333, 0.25417, 0, 0.54464], "85": [0, 0.68333, 0.09931, 0.08334, 0.62583], "86": [0, 0.68333, 0.08222, 0, 0.61278], "87": [0, 0.68333, 0.08222, 0.08334, 0.98778], "88": [0, 0.68333, 0.14643, 0.13889, 0.7133], "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], "90": [0, 0.68333, 0.07944, 0.13889, 0.72473], "160": [0, 0, 0, 0, 0.25] }, "Fraktur-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69141, 0, 0, 0.29574], "34": [0, 0.69141, 0, 0, 0.21471], "38": [0, 0.69141, 0, 0, 0.73786], "39": [0, 0.69141, 0, 0, 0.21201], "40": [0.24982, 0.74947, 0, 0, 0.38865], "41": [0.24982, 0.74947, 0, 0, 0.38865], "42": [0, 0.62119, 0, 0, 0.27764], "43": [0.08319, 0.58283, 0, 0, 0.75623], "44": [0, 0.10803, 0, 0, 0.27764], "45": [0.08319, 0.58283, 0, 0, 0.75623], "46": [0, 0.10803, 0, 0, 0.27764], "47": [0.24982, 0.74947, 0, 0, 0.50181], "48": [0, 0.47534, 0, 0, 0.50181], "49": [0, 0.47534, 0, 0, 0.50181], "50": [0, 0.47534, 0, 0, 0.50181], "51": [0.18906, 0.47534, 0, 0, 0.50181], "52": [0.18906, 0.47534, 0, 0, 0.50181], "53": [0.18906, 0.47534, 0, 0, 0.50181], "54": [0, 0.69141, 0, 0, 0.50181], "55": [0.18906, 0.47534, 0, 0, 0.50181], "56": [0, 0.69141, 0, 0, 0.50181], "57": [0.18906, 0.47534, 0, 0, 0.50181], "58": [0, 0.47534, 0, 0, 0.21606], "59": [0.12604, 0.47534, 0, 0, 0.21606], "61": [-0.13099, 0.36866, 0, 0, 0.75623], "63": [0, 0.69141, 0, 0, 0.36245], "65": [0, 0.69141, 0, 0, 0.7176], "66": [0, 0.69141, 0, 0, 0.88397], "67": [0, 0.69141, 0, 0, 0.61254], "68": [0, 0.69141, 0, 0, 0.83158], "69": [0, 0.69141, 0, 0, 0.66278], "70": [0.12604, 0.69141, 0, 0, 0.61119], "71": [0, 0.69141, 0, 0, 0.78539], "72": [0.06302, 0.69141, 0, 0, 0.7203], "73": [0, 0.69141, 0, 0, 0.55448], "74": [0.12604, 0.69141, 0, 0, 0.55231], "75": [0, 0.69141, 0, 0, 0.66845], "76": [0, 0.69141, 0, 0, 0.66602], "77": [0, 0.69141, 0, 0, 1.04953], "78": [0, 0.69141, 0, 0, 0.83212], "79": [0, 0.69141, 0, 0, 0.82699], "80": [0.18906, 0.69141, 0, 0, 0.82753], "81": [0.03781, 0.69141, 0, 0, 0.82699], "82": [0, 0.69141, 0, 0, 0.82807], "83": [0, 0.69141, 0, 0, 0.82861], "84": [0, 0.69141, 0, 0, 0.66899], "85": [0, 0.69141, 0, 0, 0.64576], "86": [0, 0.69141, 0, 0, 0.83131], "87": [0, 0.69141, 0, 0, 1.04602], "88": [0, 0.69141, 0, 0, 0.71922], "89": [0.18906, 0.69141, 0, 0, 0.83293], "90": [0.12604, 0.69141, 0, 0, 0.60201], "91": [0.24982, 0.74947, 0, 0, 0.27764], "93": [0.24982, 0.74947, 0, 0, 0.27764], "94": [0, 0.69141, 0, 0, 0.49965], "97": [0, 0.47534, 0, 0, 0.50046], "98": [0, 0.69141, 0, 0, 0.51315], "99": [0, 0.47534, 0, 0, 0.38946], "100": [0, 0.62119, 0, 0, 0.49857], "101": [0, 0.47534, 0, 0, 0.40053], "102": [0.18906, 0.69141, 0, 0, 0.32626], "103": [0.18906, 0.47534, 0, 0, 0.5037], "104": [0.18906, 0.69141, 0, 0, 0.52126], "105": [0, 0.69141, 0, 0, 0.27899], "106": [0, 0.69141, 0, 0, 0.28088], "107": [0, 0.69141, 0, 0, 0.38946], "108": [0, 0.69141, 0, 0, 0.27953], "109": [0, 0.47534, 0, 0, 0.76676], "110": [0, 0.47534, 0, 0, 0.52666], "111": [0, 0.47534, 0, 0, 0.48885], "112": [0.18906, 0.52396, 0, 0, 0.50046], "113": [0.18906, 0.47534, 0, 0, 0.48912], "114": [0, 0.47534, 0, 0, 0.38919], "115": [0, 0.47534, 0, 0, 0.44266], "116": [0, 0.62119, 0, 0, 0.33301], "117": [0, 0.47534, 0, 0, 0.5172], "118": [0, 0.52396, 0, 0, 0.5118], "119": [0, 0.52396, 0, 0, 0.77351], "120": [0.18906, 0.47534, 0, 0, 0.38865], "121": [0.18906, 0.47534, 0, 0, 0.49884], "122": [0.18906, 0.47534, 0, 0, 0.39054], "160": [0, 0, 0, 0, 0.25], "8216": [0, 0.69141, 0, 0, 0.21471], "8217": [0, 0.69141, 0, 0, 0.21471], "58112": [0, 0.62119, 0, 0, 0.49749], "58113": [0, 0.62119, 0, 0, 0.4983], "58114": [0.18906, 0.69141, 0, 0, 0.33328], "58115": [0.18906, 0.69141, 0, 0, 0.32923], "58116": [0.18906, 0.47534, 0, 0, 0.50343], "58117": [0, 0.69141, 0, 0, 0.33301], "58118": [0, 0.62119, 0, 0, 0.33409], "58119": [0, 0.47534, 0, 0, 0.50073] }, "Main-Bold": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.35], "34": [0, 0.69444, 0, 0, 0.60278], "35": [0.19444, 0.69444, 0, 0, 0.95833], "36": [0.05556, 0.75, 0, 0, 0.575], "37": [0.05556, 0.75, 0, 0, 0.95833], "38": [0, 0.69444, 0, 0, 0.89444], "39": [0, 0.69444, 0, 0, 0.31944], "40": [0.25, 0.75, 0, 0, 0.44722], "41": [0.25, 0.75, 0, 0, 0.44722], "42": [0, 0.75, 0, 0, 0.575], "43": [0.13333, 0.63333, 0, 0, 0.89444], "44": [0.19444, 0.15556, 0, 0, 0.31944], "45": [0, 0.44444, 0, 0, 0.38333], "46": [0, 0.15556, 0, 0, 0.31944], "47": [0.25, 0.75, 0, 0, 0.575], "48": [0, 0.64444, 0, 0, 0.575], "49": [0, 0.64444, 0, 0, 0.575], "50": [0, 0.64444, 0, 0, 0.575], "51": [0, 0.64444, 0, 0, 0.575], "52": [0, 0.64444, 0, 0, 0.575], "53": [0, 0.64444, 0, 0, 0.575], "54": [0, 0.64444, 0, 0, 0.575], "55": [0, 0.64444, 0, 0, 0.575], "56": [0, 0.64444, 0, 0, 0.575], "57": [0, 0.64444, 0, 0, 0.575], "58": [0, 0.44444, 0, 0, 0.31944], "59": [0.19444, 0.44444, 0, 0, 0.31944], "60": [0.08556, 0.58556, 0, 0, 0.89444], "61": [-0.10889, 0.39111, 0, 0, 0.89444], "62": [0.08556, 0.58556, 0, 0, 0.89444], "63": [0, 0.69444, 0, 0, 0.54305], "64": [0, 0.69444, 0, 0, 0.89444], "65": [0, 0.68611, 0, 0, 0.86944], "66": [0, 0.68611, 0, 0, 0.81805], "67": [0, 0.68611, 0, 0, 0.83055], "68": [0, 0.68611, 0, 0, 0.88194], "69": [0, 0.68611, 0, 0, 0.75555], "70": [0, 0.68611, 0, 0, 0.72361], "71": [0, 0.68611, 0, 0, 0.90416], "72": [0, 0.68611, 0, 0, 0.9], "73": [0, 0.68611, 0, 0, 0.43611], "74": [0, 0.68611, 0, 0, 0.59444], "75": [0, 0.68611, 0, 0, 0.90138], "76": [0, 0.68611, 0, 0, 0.69166], "77": [0, 0.68611, 0, 0, 1.09166], "78": [0, 0.68611, 0, 0, 0.9], "79": [0, 0.68611, 0, 0, 0.86388], "80": [0, 0.68611, 0, 0, 0.78611], "81": [0.19444, 0.68611, 0, 0, 0.86388], "82": [0, 0.68611, 0, 0, 0.8625], "83": [0, 0.68611, 0, 0, 0.63889], "84": [0, 0.68611, 0, 0, 0.8], "85": [0, 0.68611, 0, 0, 0.88472], "86": [0, 0.68611, 0.01597, 0, 0.86944], "87": [0, 0.68611, 0.01597, 0, 1.18888], "88": [0, 0.68611, 0, 0, 0.86944], "89": [0, 0.68611, 0.02875, 0, 0.86944], "90": [0, 0.68611, 0, 0, 0.70277], "91": [0.25, 0.75, 0, 0, 0.31944], "92": [0.25, 0.75, 0, 0, 0.575], "93": [0.25, 0.75, 0, 0, 0.31944], "94": [0, 0.69444, 0, 0, 0.575], "95": [0.31, 0.13444, 0.03194, 0, 0.575], "97": [0, 0.44444, 0, 0, 0.55902], "98": [0, 0.69444, 0, 0, 0.63889], "99": [0, 0.44444, 0, 0, 0.51111], "100": [0, 0.69444, 0, 0, 0.63889], "101": [0, 0.44444, 0, 0, 0.52708], "102": [0, 0.69444, 0.10903, 0, 0.35139], "103": [0.19444, 0.44444, 0.01597, 0, 0.575], "104": [0, 0.69444, 0, 0, 0.63889], "105": [0, 0.69444, 0, 0, 0.31944], "106": [0.19444, 0.69444, 0, 0, 0.35139], "107": [0, 0.69444, 0, 0, 0.60694], "108": [0, 0.69444, 0, 0, 0.31944], "109": [0, 0.44444, 0, 0, 0.95833], "110": [0, 0.44444, 0, 0, 0.63889], "111": [0, 0.44444, 0, 0, 0.575], "112": [0.19444, 0.44444, 0, 0, 0.63889], "113": [0.19444, 0.44444, 0, 0, 0.60694], "114": [0, 0.44444, 0, 0, 0.47361], "115": [0, 0.44444, 0, 0, 0.45361], "116": [0, 0.63492, 0, 0, 0.44722], "117": [0, 0.44444, 0, 0, 0.63889], "118": [0, 0.44444, 0.01597, 0, 0.60694], "119": [0, 0.44444, 0.01597, 0, 0.83055], "120": [0, 0.44444, 0, 0, 0.60694], "121": [0.19444, 0.44444, 0.01597, 0, 0.60694], "122": [0, 0.44444, 0, 0, 0.51111], "123": [0.25, 0.75, 0, 0, 0.575], "124": [0.25, 0.75, 0, 0, 0.31944], "125": [0.25, 0.75, 0, 0, 0.575], "126": [0.35, 0.34444, 0, 0, 0.575], "160": [0, 0, 0, 0, 0.25], "163": [0, 0.69444, 0, 0, 0.86853], "168": [0, 0.69444, 0, 0, 0.575], "172": [0, 0.44444, 0, 0, 0.76666], "176": [0, 0.69444, 0, 0, 0.86944], "177": [0.13333, 0.63333, 0, 0, 0.89444], "184": [0.17014, 0, 0, 0, 0.51111], "198": [0, 0.68611, 0, 0, 1.04166], "215": [0.13333, 0.63333, 0, 0, 0.89444], "216": [0.04861, 0.73472, 0, 0, 0.89444], "223": [0, 0.69444, 0, 0, 0.59722], "230": [0, 0.44444, 0, 0, 0.83055], "247": [0.13333, 0.63333, 0, 0, 0.89444], "248": [0.09722, 0.54167, 0, 0, 0.575], "305": [0, 0.44444, 0, 0, 0.31944], "338": [0, 0.68611, 0, 0, 1.16944], "339": [0, 0.44444, 0, 0, 0.89444], "567": [0.19444, 0.44444, 0, 0, 0.35139], "710": [0, 0.69444, 0, 0, 0.575], "711": [0, 0.63194, 0, 0, 0.575], "713": [0, 0.59611, 0, 0, 0.575], "714": [0, 0.69444, 0, 0, 0.575], "715": [0, 0.69444, 0, 0, 0.575], "728": [0, 0.69444, 0, 0, 0.575], "729": [0, 0.69444, 0, 0, 0.31944], "730": [0, 0.69444, 0, 0, 0.86944], "732": [0, 0.69444, 0, 0, 0.575], "733": [0, 0.69444, 0, 0, 0.575], "915": [0, 0.68611, 0, 0, 0.69166], "916": [0, 0.68611, 0, 0, 0.95833], "920": [0, 0.68611, 0, 0, 0.89444], "923": [0, 0.68611, 0, 0, 0.80555], "926": [0, 0.68611, 0, 0, 0.76666], "928": [0, 0.68611, 0, 0, 0.9], "931": [0, 0.68611, 0, 0, 0.83055], "933": [0, 0.68611, 0, 0, 0.89444], "934": [0, 0.68611, 0, 0, 0.83055], "936": [0, 0.68611, 0, 0, 0.89444], "937": [0, 0.68611, 0, 0, 0.83055], "8211": [0, 0.44444, 0.03194, 0, 0.575], "8212": [0, 0.44444, 0.03194, 0, 1.14999], "8216": [0, 0.69444, 0, 0, 0.31944], "8217": [0, 0.69444, 0, 0, 0.31944], "8220": [0, 0.69444, 0, 0, 0.60278], "8221": [0, 0.69444, 0, 0, 0.60278], "8224": [0.19444, 0.69444, 0, 0, 0.51111], "8225": [0.19444, 0.69444, 0, 0, 0.51111], "8242": [0, 0.55556, 0, 0, 0.34444], "8407": [0, 0.72444, 0.15486, 0, 0.575], "8463": [0, 0.69444, 0, 0, 0.66759], "8465": [0, 0.69444, 0, 0, 0.83055], "8467": [0, 0.69444, 0, 0, 0.47361], "8472": [0.19444, 0.44444, 0, 0, 0.74027], "8476": [0, 0.69444, 0, 0, 0.83055], "8501": [0, 0.69444, 0, 0, 0.70277], "8592": [-0.10889, 0.39111, 0, 0, 1.14999], "8593": [0.19444, 0.69444, 0, 0, 0.575], "8594": [-0.10889, 0.39111, 0, 0, 1.14999], "8595": [0.19444, 0.69444, 0, 0, 0.575], "8596": [-0.10889, 0.39111, 0, 0, 1.14999], "8597": [0.25, 0.75, 0, 0, 0.575], "8598": [0.19444, 0.69444, 0, 0, 1.14999], "8599": [0.19444, 0.69444, 0, 0, 1.14999], "8600": [0.19444, 0.69444, 0, 0, 1.14999], "8601": [0.19444, 0.69444, 0, 0, 1.14999], "8636": [-0.10889, 0.39111, 0, 0, 1.14999], "8637": [-0.10889, 0.39111, 0, 0, 1.14999], "8640": [-0.10889, 0.39111, 0, 0, 1.14999], "8641": [-0.10889, 0.39111, 0, 0, 1.14999], "8656": [-0.10889, 0.39111, 0, 0, 1.14999], "8657": [0.19444, 0.69444, 0, 0, 0.70277], "8658": [-0.10889, 0.39111, 0, 0, 1.14999], "8659": [0.19444, 0.69444, 0, 0, 0.70277], "8660": [-0.10889, 0.39111, 0, 0, 1.14999], "8661": [0.25, 0.75, 0, 0, 0.70277], "8704": [0, 0.69444, 0, 0, 0.63889], "8706": [0, 0.69444, 0.06389, 0, 0.62847], "8707": [0, 0.69444, 0, 0, 0.63889], "8709": [0.05556, 0.75, 0, 0, 0.575], "8711": [0, 0.68611, 0, 0, 0.95833], "8712": [0.08556, 0.58556, 0, 0, 0.76666], "8715": [0.08556, 0.58556, 0, 0, 0.76666], "8722": [0.13333, 0.63333, 0, 0, 0.89444], "8723": [0.13333, 0.63333, 0, 0, 0.89444], "8725": [0.25, 0.75, 0, 0, 0.575], "8726": [0.25, 0.75, 0, 0, 0.575], "8727": [-0.02778, 0.47222, 0, 0, 0.575], "8728": [-0.02639, 0.47361, 0, 0, 0.575], "8729": [-0.02639, 0.47361, 0, 0, 0.575], "8730": [0.18, 0.82, 0, 0, 0.95833], "8733": [0, 0.44444, 0, 0, 0.89444], "8734": [0, 0.44444, 0, 0, 1.14999], "8736": [0, 0.69224, 0, 0, 0.72222], "8739": [0.25, 0.75, 0, 0, 0.31944], "8741": [0.25, 0.75, 0, 0, 0.575], "8743": [0, 0.55556, 0, 0, 0.76666], "8744": [0, 0.55556, 0, 0, 0.76666], "8745": [0, 0.55556, 0, 0, 0.76666], "8746": [0, 0.55556, 0, 0, 0.76666], "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875], "8764": [-0.10889, 0.39111, 0, 0, 0.89444], "8768": [0.19444, 0.69444, 0, 0, 0.31944], "8771": [0.00222, 0.50222, 0, 0, 0.89444], "8776": [0.02444, 0.52444, 0, 0, 0.89444], "8781": [0.00222, 0.50222, 0, 0, 0.89444], "8801": [0.00222, 0.50222, 0, 0, 0.89444], "8804": [0.19667, 0.69667, 0, 0, 0.89444], "8805": [0.19667, 0.69667, 0, 0, 0.89444], "8810": [0.08556, 0.58556, 0, 0, 1.14999], "8811": [0.08556, 0.58556, 0, 0, 1.14999], "8826": [0.08556, 0.58556, 0, 0, 0.89444], "8827": [0.08556, 0.58556, 0, 0, 0.89444], "8834": [0.08556, 0.58556, 0, 0, 0.89444], "8835": [0.08556, 0.58556, 0, 0, 0.89444], "8838": [0.19667, 0.69667, 0, 0, 0.89444], "8839": [0.19667, 0.69667, 0, 0, 0.89444], "8846": [0, 0.55556, 0, 0, 0.76666], "8849": [0.19667, 0.69667, 0, 0, 0.89444], "8850": [0.19667, 0.69667, 0, 0, 0.89444], "8851": [0, 0.55556, 0, 0, 0.76666], "8852": [0, 0.55556, 0, 0, 0.76666], "8853": [0.13333, 0.63333, 0, 0, 0.89444], "8854": [0.13333, 0.63333, 0, 0, 0.89444], "8855": [0.13333, 0.63333, 0, 0, 0.89444], "8856": [0.13333, 0.63333, 0, 0, 0.89444], "8857": [0.13333, 0.63333, 0, 0, 0.89444], "8866": [0, 0.69444, 0, 0, 0.70277], "8867": [0, 0.69444, 0, 0, 0.70277], "8868": [0, 0.69444, 0, 0, 0.89444], "8869": [0, 0.69444, 0, 0, 0.89444], "8900": [-0.02639, 0.47361, 0, 0, 0.575], "8901": [-0.02639, 0.47361, 0, 0, 0.31944], "8902": [-0.02778, 0.47222, 0, 0, 0.575], "8968": [0.25, 0.75, 0, 0, 0.51111], "8969": [0.25, 0.75, 0, 0, 0.51111], "8970": [0.25, 0.75, 0, 0, 0.51111], "8971": [0.25, 0.75, 0, 0, 0.51111], "8994": [-0.13889, 0.36111, 0, 0, 1.14999], "8995": [-0.13889, 0.36111, 0, 0, 1.14999], "9651": [0.19444, 0.69444, 0, 0, 1.02222], "9657": [-0.02778, 0.47222, 0, 0, 0.575], "9661": [0.19444, 0.69444, 0, 0, 1.02222], "9667": [-0.02778, 0.47222, 0, 0, 0.575], "9711": [0.19444, 0.69444, 0, 0, 1.14999], "9824": [0.12963, 0.69444, 0, 0, 0.89444], "9825": [0.12963, 0.69444, 0, 0, 0.89444], "9826": [0.12963, 0.69444, 0, 0, 0.89444], "9827": [0.12963, 0.69444, 0, 0, 0.89444], "9837": [0, 0.75, 0, 0, 0.44722], "9838": [0.19444, 0.69444, 0, 0, 0.44722], "9839": [0.19444, 0.69444, 0, 0, 0.44722], "10216": [0.25, 0.75, 0, 0, 0.44722], "10217": [0.25, 0.75, 0, 0, 0.44722], "10815": [0, 0.68611, 0, 0, 0.9], "10927": [0.19667, 0.69667, 0, 0, 0.89444], "10928": [0.19667, 0.69667, 0, 0, 0.89444], "57376": [0.19444, 0.69444, 0, 0, 0] }, "Main-BoldItalic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.11417, 0, 0.38611], "34": [0, 0.69444, 0.07939, 0, 0.62055], "35": [0.19444, 0.69444, 0.06833, 0, 0.94444], "37": [0.05556, 0.75, 0.12861, 0, 0.94444], "38": [0, 0.69444, 0.08528, 0, 0.88555], "39": [0, 0.69444, 0.12945, 0, 0.35555], "40": [0.25, 0.75, 0.15806, 0, 0.47333], "41": [0.25, 0.75, 0.03306, 0, 0.47333], "42": [0, 0.75, 0.14333, 0, 0.59111], "43": [0.10333, 0.60333, 0.03306, 0, 0.88555], "44": [0.19444, 0.14722, 0, 0, 0.35555], "45": [0, 0.44444, 0.02611, 0, 0.41444], "46": [0, 0.14722, 0, 0, 0.35555], "47": [0.25, 0.75, 0.15806, 0, 0.59111], "48": [0, 0.64444, 0.13167, 0, 0.59111], "49": [0, 0.64444, 0.13167, 0, 0.59111], "50": [0, 0.64444, 0.13167, 0, 0.59111], "51": [0, 0.64444, 0.13167, 0, 0.59111], "52": [0.19444, 0.64444, 0.13167, 0, 0.59111], "53": [0, 0.64444, 0.13167, 0, 0.59111], "54": [0, 0.64444, 0.13167, 0, 0.59111], "55": [0.19444, 0.64444, 0.13167, 0, 0.59111], "56": [0, 0.64444, 0.13167, 0, 0.59111], "57": [0, 0.64444, 0.13167, 0, 0.59111], "58": [0, 0.44444, 0.06695, 0, 0.35555], "59": [0.19444, 0.44444, 0.06695, 0, 0.35555], "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555], "63": [0, 0.69444, 0.11472, 0, 0.59111], "64": [0, 0.69444, 0.09208, 0, 0.88555], "65": [0, 0.68611, 0, 0, 0.86555], "66": [0, 0.68611, 0.0992, 0, 0.81666], "67": [0, 0.68611, 0.14208, 0, 0.82666], "68": [0, 0.68611, 0.09062, 0, 0.87555], "69": [0, 0.68611, 0.11431, 0, 0.75666], "70": [0, 0.68611, 0.12903, 0, 0.72722], "71": [0, 0.68611, 0.07347, 0, 0.89527], "72": [0, 0.68611, 0.17208, 0, 0.8961], "73": [0, 0.68611, 0.15681, 0, 0.47166], "74": [0, 0.68611, 0.145, 0, 0.61055], "75": [0, 0.68611, 0.14208, 0, 0.89499], "76": [0, 0.68611, 0, 0, 0.69777], "77": [0, 0.68611, 0.17208, 0, 1.07277], "78": [0, 0.68611, 0.17208, 0, 0.8961], "79": [0, 0.68611, 0.09062, 0, 0.85499], "80": [0, 0.68611, 0.0992, 0, 0.78721], "81": [0.19444, 0.68611, 0.09062, 0, 0.85499], "82": [0, 0.68611, 0.02559, 0, 0.85944], "83": [0, 0.68611, 0.11264, 0, 0.64999], "84": [0, 0.68611, 0.12903, 0, 0.7961], "85": [0, 0.68611, 0.17208, 0, 0.88083], "86": [0, 0.68611, 0.18625, 0, 0.86555], "87": [0, 0.68611, 0.18625, 0, 1.15999], "88": [0, 0.68611, 0.15681, 0, 0.86555], "89": [0, 0.68611, 0.19803, 0, 0.86555], "90": [0, 0.68611, 0.14208, 0, 0.70888], "91": [0.25, 0.75, 0.1875, 0, 0.35611], "93": [0.25, 0.75, 0.09972, 0, 0.35611], "94": [0, 0.69444, 0.06709, 0, 0.59111], "95": [0.31, 0.13444, 0.09811, 0, 0.59111], "97": [0, 0.44444, 0.09426, 0, 0.59111], "98": [0, 0.69444, 0.07861, 0, 0.53222], "99": [0, 0.44444, 0.05222, 0, 0.53222], "100": [0, 0.69444, 0.10861, 0, 0.59111], "101": [0, 0.44444, 0.085, 0, 0.53222], "102": [0.19444, 0.69444, 0.21778, 0, 0.4], "103": [0.19444, 0.44444, 0.105, 0, 0.53222], "104": [0, 0.69444, 0.09426, 0, 0.59111], "105": [0, 0.69326, 0.11387, 0, 0.35555], "106": [0.19444, 0.69326, 0.1672, 0, 0.35555], "107": [0, 0.69444, 0.11111, 0, 0.53222], "108": [0, 0.69444, 0.10861, 0, 0.29666], "109": [0, 0.44444, 0.09426, 0, 0.94444], "110": [0, 0.44444, 0.09426, 0, 0.64999], "111": [0, 0.44444, 0.07861, 0, 0.59111], "112": [0.19444, 0.44444, 0.07861, 0, 0.59111], "113": [0.19444, 0.44444, 0.105, 0, 0.53222], "114": [0, 0.44444, 0.11111, 0, 0.50167], "115": [0, 0.44444, 0.08167, 0, 0.48694], "116": [0, 0.63492, 0.09639, 0, 0.385], "117": [0, 0.44444, 0.09426, 0, 0.62055], "118": [0, 0.44444, 0.11111, 0, 0.53222], "119": [0, 0.44444, 0.11111, 0, 0.76777], "120": [0, 0.44444, 0.12583, 0, 0.56055], "121": [0.19444, 0.44444, 0.105, 0, 0.56166], "122": [0, 0.44444, 0.13889, 0, 0.49055], "126": [0.35, 0.34444, 0.11472, 0, 0.59111], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.69444, 0.11473, 0, 0.59111], "176": [0, 0.69444, 0, 0, 0.94888], "184": [0.17014, 0, 0, 0, 0.53222], "198": [0, 0.68611, 0.11431, 0, 1.02277], "216": [0.04861, 0.73472, 0.09062, 0, 0.88555], "223": [0.19444, 0.69444, 0.09736, 0, 0.665], "230": [0, 0.44444, 0.085, 0, 0.82666], "248": [0.09722, 0.54167, 0.09458, 0, 0.59111], "305": [0, 0.44444, 0.09426, 0, 0.35555], "338": [0, 0.68611, 0.11431, 0, 1.14054], "339": [0, 0.44444, 0.085, 0, 0.82666], "567": [0.19444, 0.44444, 0.04611, 0, 0.385], "710": [0, 0.69444, 0.06709, 0, 0.59111], "711": [0, 0.63194, 0.08271, 0, 0.59111], "713": [0, 0.59444, 0.10444, 0, 0.59111], "714": [0, 0.69444, 0.08528, 0, 0.59111], "715": [0, 0.69444, 0, 0, 0.59111], "728": [0, 0.69444, 0.10333, 0, 0.59111], "729": [0, 0.69444, 0.12945, 0, 0.35555], "730": [0, 0.69444, 0, 0, 0.94888], "732": [0, 0.69444, 0.11472, 0, 0.59111], "733": [0, 0.69444, 0.11472, 0, 0.59111], "915": [0, 0.68611, 0.12903, 0, 0.69777], "916": [0, 0.68611, 0, 0, 0.94444], "920": [0, 0.68611, 0.09062, 0, 0.88555], "923": [0, 0.68611, 0, 0, 0.80666], "926": [0, 0.68611, 0.15092, 0, 0.76777], "928": [0, 0.68611, 0.17208, 0, 0.8961], "931": [0, 0.68611, 0.11431, 0, 0.82666], "933": [0, 0.68611, 0.10778, 0, 0.88555], "934": [0, 0.68611, 0.05632, 0, 0.82666], "936": [0, 0.68611, 0.10778, 0, 0.88555], "937": [0, 0.68611, 0.0992, 0, 0.82666], "8211": [0, 0.44444, 0.09811, 0, 0.59111], "8212": [0, 0.44444, 0.09811, 0, 1.18221], "8216": [0, 0.69444, 0.12945, 0, 0.35555], "8217": [0, 0.69444, 0.12945, 0, 0.35555], "8220": [0, 0.69444, 0.16772, 0, 0.62055], "8221": [0, 0.69444, 0.07939, 0, 0.62055] }, "Main-Italic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.12417, 0, 0.30667], "34": [0, 0.69444, 0.06961, 0, 0.51444], "35": [0.19444, 0.69444, 0.06616, 0, 0.81777], "37": [0.05556, 0.75, 0.13639, 0, 0.81777], "38": [0, 0.69444, 0.09694, 0, 0.76666], "39": [0, 0.69444, 0.12417, 0, 0.30667], "40": [0.25, 0.75, 0.16194, 0, 0.40889], "41": [0.25, 0.75, 0.03694, 0, 0.40889], "42": [0, 0.75, 0.14917, 0, 0.51111], "43": [0.05667, 0.56167, 0.03694, 0, 0.76666], "44": [0.19444, 0.10556, 0, 0, 0.30667], "45": [0, 0.43056, 0.02826, 0, 0.35778], "46": [0, 0.10556, 0, 0, 0.30667], "47": [0.25, 0.75, 0.16194, 0, 0.51111], "48": [0, 0.64444, 0.13556, 0, 0.51111], "49": [0, 0.64444, 0.13556, 0, 0.51111], "50": [0, 0.64444, 0.13556, 0, 0.51111], "51": [0, 0.64444, 0.13556, 0, 0.51111], "52": [0.19444, 0.64444, 0.13556, 0, 0.51111], "53": [0, 0.64444, 0.13556, 0, 0.51111], "54": [0, 0.64444, 0.13556, 0, 0.51111], "55": [0.19444, 0.64444, 0.13556, 0, 0.51111], "56": [0, 0.64444, 0.13556, 0, 0.51111], "57": [0, 0.64444, 0.13556, 0, 0.51111], "58": [0, 0.43056, 0.0582, 0, 0.30667], "59": [0.19444, 0.43056, 0.0582, 0, 0.30667], "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666], "63": [0, 0.69444, 0.1225, 0, 0.51111], "64": [0, 0.69444, 0.09597, 0, 0.76666], "65": [0, 0.68333, 0, 0, 0.74333], "66": [0, 0.68333, 0.10257, 0, 0.70389], "67": [0, 0.68333, 0.14528, 0, 0.71555], "68": [0, 0.68333, 0.09403, 0, 0.755], "69": [0, 0.68333, 0.12028, 0, 0.67833], "70": [0, 0.68333, 0.13305, 0, 0.65277], "71": [0, 0.68333, 0.08722, 0, 0.77361], "72": [0, 0.68333, 0.16389, 0, 0.74333], "73": [0, 0.68333, 0.15806, 0, 0.38555], "74": [0, 0.68333, 0.14028, 0, 0.525], "75": [0, 0.68333, 0.14528, 0, 0.76888], "76": [0, 0.68333, 0, 0, 0.62722], "77": [0, 0.68333, 0.16389, 0, 0.89666], "78": [0, 0.68333, 0.16389, 0, 0.74333], "79": [0, 0.68333, 0.09403, 0, 0.76666], "80": [0, 0.68333, 0.10257, 0, 0.67833], "81": [0.19444, 0.68333, 0.09403, 0, 0.76666], "82": [0, 0.68333, 0.03868, 0, 0.72944], "83": [0, 0.68333, 0.11972, 0, 0.56222], "84": [0, 0.68333, 0.13305, 0, 0.71555], "85": [0, 0.68333, 0.16389, 0, 0.74333], "86": [0, 0.68333, 0.18361, 0, 0.74333], "87": [0, 0.68333, 0.18361, 0, 0.99888], "88": [0, 0.68333, 0.15806, 0, 0.74333], "89": [0, 0.68333, 0.19383, 0, 0.74333], "90": [0, 0.68333, 0.14528, 0, 0.61333], "91": [0.25, 0.75, 0.1875, 0, 0.30667], "93": [0.25, 0.75, 0.10528, 0, 0.30667], "94": [0, 0.69444, 0.06646, 0, 0.51111], "95": [0.31, 0.12056, 0.09208, 0, 0.51111], "97": [0, 0.43056, 0.07671, 0, 0.51111], "98": [0, 0.69444, 0.06312, 0, 0.46], "99": [0, 0.43056, 0.05653, 0, 0.46], "100": [0, 0.69444, 0.10333, 0, 0.51111], "101": [0, 0.43056, 0.07514, 0, 0.46], "102": [0.19444, 0.69444, 0.21194, 0, 0.30667], "103": [0.19444, 0.43056, 0.08847, 0, 0.46], "104": [0, 0.69444, 0.07671, 0, 0.51111], "105": [0, 0.65536, 0.1019, 0, 0.30667], "106": [0.19444, 0.65536, 0.14467, 0, 0.30667], "107": [0, 0.69444, 0.10764, 0, 0.46], "108": [0, 0.69444, 0.10333, 0, 0.25555], "109": [0, 0.43056, 0.07671, 0, 0.81777], "110": [0, 0.43056, 0.07671, 0, 0.56222], "111": [0, 0.43056, 0.06312, 0, 0.51111], "112": [0.19444, 0.43056, 0.06312, 0, 0.51111], "113": [0.19444, 0.43056, 0.08847, 0, 0.46], "114": [0, 0.43056, 0.10764, 0, 0.42166], "115": [0, 0.43056, 0.08208, 0, 0.40889], "116": [0, 0.61508, 0.09486, 0, 0.33222], "117": [0, 0.43056, 0.07671, 0, 0.53666], "118": [0, 0.43056, 0.10764, 0, 0.46], "119": [0, 0.43056, 0.10764, 0, 0.66444], "120": [0, 0.43056, 0.12042, 0, 0.46389], "121": [0.19444, 0.43056, 0.08847, 0, 0.48555], "122": [0, 0.43056, 0.12292, 0, 0.40889], "126": [0.35, 0.31786, 0.11585, 0, 0.51111], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.66786, 0.10474, 0, 0.51111], "176": [0, 0.69444, 0, 0, 0.83129], "184": [0.17014, 0, 0, 0, 0.46], "198": [0, 0.68333, 0.12028, 0, 0.88277], "216": [0.04861, 0.73194, 0.09403, 0, 0.76666], "223": [0.19444, 0.69444, 0.10514, 0, 0.53666], "230": [0, 0.43056, 0.07514, 0, 0.71555], "248": [0.09722, 0.52778, 0.09194, 0, 0.51111], "338": [0, 0.68333, 0.12028, 0, 0.98499], "339": [0, 0.43056, 0.07514, 0, 0.71555], "710": [0, 0.69444, 0.06646, 0, 0.51111], "711": [0, 0.62847, 0.08295, 0, 0.51111], "713": [0, 0.56167, 0.10333, 0, 0.51111], "714": [0, 0.69444, 0.09694, 0, 0.51111], "715": [0, 0.69444, 0, 0, 0.51111], "728": [0, 0.69444, 0.10806, 0, 0.51111], "729": [0, 0.66786, 0.11752, 0, 0.30667], "730": [0, 0.69444, 0, 0, 0.83129], "732": [0, 0.66786, 0.11585, 0, 0.51111], "733": [0, 0.69444, 0.1225, 0, 0.51111], "915": [0, 0.68333, 0.13305, 0, 0.62722], "916": [0, 0.68333, 0, 0, 0.81777], "920": [0, 0.68333, 0.09403, 0, 0.76666], "923": [0, 0.68333, 0, 0, 0.69222], "926": [0, 0.68333, 0.15294, 0, 0.66444], "928": [0, 0.68333, 0.16389, 0, 0.74333], "931": [0, 0.68333, 0.12028, 0, 0.71555], "933": [0, 0.68333, 0.11111, 0, 0.76666], "934": [0, 0.68333, 0.05986, 0, 0.71555], "936": [0, 0.68333, 0.11111, 0, 0.76666], "937": [0, 0.68333, 0.10257, 0, 0.71555], "8211": [0, 0.43056, 0.09208, 0, 0.51111], "8212": [0, 0.43056, 0.09208, 0, 1.02222], "8216": [0, 0.69444, 0.12417, 0, 0.30667], "8217": [0, 0.69444, 0.12417, 0, 0.30667], "8220": [0, 0.69444, 0.1685, 0, 0.51444], "8221": [0, 0.69444, 0.06961, 0, 0.51444], "8463": [0, 0.68889, 0, 0, 0.54028] }, "Main-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.27778], "34": [0, 0.69444, 0, 0, 0.5], "35": [0.19444, 0.69444, 0, 0, 0.83334], "36": [0.05556, 0.75, 0, 0, 0.5], "37": [0.05556, 0.75, 0, 0, 0.83334], "38": [0, 0.69444, 0, 0, 0.77778], "39": [0, 0.69444, 0, 0, 0.27778], "40": [0.25, 0.75, 0, 0, 0.38889], "41": [0.25, 0.75, 0, 0, 0.38889], "42": [0, 0.75, 0, 0, 0.5], "43": [0.08333, 0.58333, 0, 0, 0.77778], "44": [0.19444, 0.10556, 0, 0, 0.27778], "45": [0, 0.43056, 0, 0, 0.33333], "46": [0, 0.10556, 0, 0, 0.27778], "47": [0.25, 0.75, 0, 0, 0.5], "48": [0, 0.64444, 0, 0, 0.5], "49": [0, 0.64444, 0, 0, 0.5], "50": [0, 0.64444, 0, 0, 0.5], "51": [0, 0.64444, 0, 0, 0.5], "52": [0, 0.64444, 0, 0, 0.5], "53": [0, 0.64444, 0, 0, 0.5], "54": [0, 0.64444, 0, 0, 0.5], "55": [0, 0.64444, 0, 0, 0.5], "56": [0, 0.64444, 0, 0, 0.5], "57": [0, 0.64444, 0, 0, 0.5], "58": [0, 0.43056, 0, 0, 0.27778], "59": [0.19444, 0.43056, 0, 0, 0.27778], "60": [0.0391, 0.5391, 0, 0, 0.77778], "61": [-0.13313, 0.36687, 0, 0, 0.77778], "62": [0.0391, 0.5391, 0, 0, 0.77778], "63": [0, 0.69444, 0, 0, 0.47222], "64": [0, 0.69444, 0, 0, 0.77778], "65": [0, 0.68333, 0, 0, 0.75], "66": [0, 0.68333, 0, 0, 0.70834], "67": [0, 0.68333, 0, 0, 0.72222], "68": [0, 0.68333, 0, 0, 0.76389], "69": [0, 0.68333, 0, 0, 0.68056], "70": [0, 0.68333, 0, 0, 0.65278], "71": [0, 0.68333, 0, 0, 0.78472], "72": [0, 0.68333, 0, 0, 0.75], "73": [0, 0.68333, 0, 0, 0.36111], "74": [0, 0.68333, 0, 0, 0.51389], "75": [0, 0.68333, 0, 0, 0.77778], "76": [0, 0.68333, 0, 0, 0.625], "77": [0, 0.68333, 0, 0, 0.91667], "78": [0, 0.68333, 0, 0, 0.75], "79": [0, 0.68333, 0, 0, 0.77778], "80": [0, 0.68333, 0, 0, 0.68056], "81": [0.19444, 0.68333, 0, 0, 0.77778], "82": [0, 0.68333, 0, 0, 0.73611], "83": [0, 0.68333, 0, 0, 0.55556], "84": [0, 0.68333, 0, 0, 0.72222], "85": [0, 0.68333, 0, 0, 0.75], "86": [0, 0.68333, 0.01389, 0, 0.75], "87": [0, 0.68333, 0.01389, 0, 1.02778], "88": [0, 0.68333, 0, 0, 0.75], "89": [0, 0.68333, 0.025, 0, 0.75], "90": [0, 0.68333, 0, 0, 0.61111], "91": [0.25, 0.75, 0, 0, 0.27778], "92": [0.25, 0.75, 0, 0, 0.5], "93": [0.25, 0.75, 0, 0, 0.27778], "94": [0, 0.69444, 0, 0, 0.5], "95": [0.31, 0.12056, 0.02778, 0, 0.5], "97": [0, 0.43056, 0, 0, 0.5], "98": [0, 0.69444, 0, 0, 0.55556], "99": [0, 0.43056, 0, 0, 0.44445], "100": [0, 0.69444, 0, 0, 0.55556], "101": [0, 0.43056, 0, 0, 0.44445], "102": [0, 0.69444, 0.07778, 0, 0.30556], "103": [0.19444, 0.43056, 0.01389, 0, 0.5], "104": [0, 0.69444, 0, 0, 0.55556], "105": [0, 0.66786, 0, 0, 0.27778], "106": [0.19444, 0.66786, 0, 0, 0.30556], "107": [0, 0.69444, 0, 0, 0.52778], "108": [0, 0.69444, 0, 0, 0.27778], "109": [0, 0.43056, 0, 0, 0.83334], "110": [0, 0.43056, 0, 0, 0.55556], "111": [0, 0.43056, 0, 0, 0.5], "112": [0.19444, 0.43056, 0, 0, 0.55556], "113": [0.19444, 0.43056, 0, 0, 0.52778], "114": [0, 0.43056, 0, 0, 0.39167], "115": [0, 0.43056, 0, 0, 0.39445], "116": [0, 0.61508, 0, 0, 0.38889], "117": [0, 0.43056, 0, 0, 0.55556], "118": [0, 0.43056, 0.01389, 0, 0.52778], "119": [0, 0.43056, 0.01389, 0, 0.72222], "120": [0, 0.43056, 0, 0, 0.52778], "121": [0.19444, 0.43056, 0.01389, 0, 0.52778], "122": [0, 0.43056, 0, 0, 0.44445], "123": [0.25, 0.75, 0, 0, 0.5], "124": [0.25, 0.75, 0, 0, 0.27778], "125": [0.25, 0.75, 0, 0, 0.5], "126": [0.35, 0.31786, 0, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "163": [0, 0.69444, 0, 0, 0.76909], "167": [0.19444, 0.69444, 0, 0, 0.44445], "168": [0, 0.66786, 0, 0, 0.5], "172": [0, 0.43056, 0, 0, 0.66667], "176": [0, 0.69444, 0, 0, 0.75], "177": [0.08333, 0.58333, 0, 0, 0.77778], "182": [0.19444, 0.69444, 0, 0, 0.61111], "184": [0.17014, 0, 0, 0, 0.44445], "198": [0, 0.68333, 0, 0, 0.90278], "215": [0.08333, 0.58333, 0, 0, 0.77778], "216": [0.04861, 0.73194, 0, 0, 0.77778], "223": [0, 0.69444, 0, 0, 0.5], "230": [0, 0.43056, 0, 0, 0.72222], "247": [0.08333, 0.58333, 0, 0, 0.77778], "248": [0.09722, 0.52778, 0, 0, 0.5], "305": [0, 0.43056, 0, 0, 0.27778], "338": [0, 0.68333, 0, 0, 1.01389], "339": [0, 0.43056, 0, 0, 0.77778], "567": [0.19444, 0.43056, 0, 0, 0.30556], "710": [0, 0.69444, 0, 0, 0.5], "711": [0, 0.62847, 0, 0, 0.5], "713": [0, 0.56778, 0, 0, 0.5], "714": [0, 0.69444, 0, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0, 0, 0.5], "729": [0, 0.66786, 0, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.75], "732": [0, 0.66786, 0, 0, 0.5], "733": [0, 0.69444, 0, 0, 0.5], "915": [0, 0.68333, 0, 0, 0.625], "916": [0, 0.68333, 0, 0, 0.83334], "920": [0, 0.68333, 0, 0, 0.77778], "923": [0, 0.68333, 0, 0, 0.69445], "926": [0, 0.68333, 0, 0, 0.66667], "928": [0, 0.68333, 0, 0, 0.75], "931": [0, 0.68333, 0, 0, 0.72222], "933": [0, 0.68333, 0, 0, 0.77778], "934": [0, 0.68333, 0, 0, 0.72222], "936": [0, 0.68333, 0, 0, 0.77778], "937": [0, 0.68333, 0, 0, 0.72222], "8211": [0, 0.43056, 0.02778, 0, 0.5], "8212": [0, 0.43056, 0.02778, 0, 1.0], "8216": [0, 0.69444, 0, 0, 0.27778], "8217": [0, 0.69444, 0, 0, 0.27778], "8220": [0, 0.69444, 0, 0, 0.5], "8221": [0, 0.69444, 0, 0, 0.5], "8224": [0.19444, 0.69444, 0, 0, 0.44445], "8225": [0.19444, 0.69444, 0, 0, 0.44445], "8230": [0, 0.12, 0, 0, 1.172], "8242": [0, 0.55556, 0, 0, 0.275], "8407": [0, 0.71444, 0.15382, 0, 0.5], "8463": [0, 0.68889, 0, 0, 0.54028], "8465": [0, 0.69444, 0, 0, 0.72222], "8467": [0, 0.69444, 0, 0.11111, 0.41667], "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646], "8476": [0, 0.69444, 0, 0, 0.72222], "8501": [0, 0.69444, 0, 0, 0.61111], "8592": [-0.13313, 0.36687, 0, 0, 1.0], "8593": [0.19444, 0.69444, 0, 0, 0.5], "8594": [-0.13313, 0.36687, 0, 0, 1.0], "8595": [0.19444, 0.69444, 0, 0, 0.5], "8596": [-0.13313, 0.36687, 0, 0, 1.0], "8597": [0.25, 0.75, 0, 0, 0.5], "8598": [0.19444, 0.69444, 0, 0, 1.0], "8599": [0.19444, 0.69444, 0, 0, 1.0], "8600": [0.19444, 0.69444, 0, 0, 1.0], "8601": [0.19444, 0.69444, 0, 0, 1.0], "8614": [0.011, 0.511, 0, 0, 1.0], "8617": [0.011, 0.511, 0, 0, 1.126], "8618": [0.011, 0.511, 0, 0, 1.126], "8636": [-0.13313, 0.36687, 0, 0, 1.0], "8637": [-0.13313, 0.36687, 0, 0, 1.0], "8640": [-0.13313, 0.36687, 0, 0, 1.0], "8641": [-0.13313, 0.36687, 0, 0, 1.0], "8652": [0.011, 0.671, 0, 0, 1.0], "8656": [-0.13313, 0.36687, 0, 0, 1.0], "8657": [0.19444, 0.69444, 0, 0, 0.61111], "8658": [-0.13313, 0.36687, 0, 0, 1.0], "8659": [0.19444, 0.69444, 0, 0, 0.61111], "8660": [-0.13313, 0.36687, 0, 0, 1.0], "8661": [0.25, 0.75, 0, 0, 0.61111], "8704": [0, 0.69444, 0, 0, 0.55556], "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309], "8707": [0, 0.69444, 0, 0, 0.55556], "8709": [0.05556, 0.75, 0, 0, 0.5], "8711": [0, 0.68333, 0, 0, 0.83334], "8712": [0.0391, 0.5391, 0, 0, 0.66667], "8715": [0.0391, 0.5391, 0, 0, 0.66667], "8722": [0.08333, 0.58333, 0, 0, 0.77778], "8723": [0.08333, 0.58333, 0, 0, 0.77778], "8725": [0.25, 0.75, 0, 0, 0.5], "8726": [0.25, 0.75, 0, 0, 0.5], "8727": [-0.03472, 0.46528, 0, 0, 0.5], "8728": [-0.05555, 0.44445, 0, 0, 0.5], "8729": [-0.05555, 0.44445, 0, 0, 0.5], "8730": [0.2, 0.8, 0, 0, 0.83334], "8733": [0, 0.43056, 0, 0, 0.77778], "8734": [0, 0.43056, 0, 0, 1.0], "8736": [0, 0.69224, 0, 0, 0.72222], "8739": [0.25, 0.75, 0, 0, 0.27778], "8741": [0.25, 0.75, 0, 0, 0.5], "8743": [0, 0.55556, 0, 0, 0.66667], "8744": [0, 0.55556, 0, 0, 0.66667], "8745": [0, 0.55556, 0, 0, 0.66667], "8746": [0, 0.55556, 0, 0, 0.66667], "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667], "8764": [-0.13313, 0.36687, 0, 0, 0.77778], "8768": [0.19444, 0.69444, 0, 0, 0.27778], "8771": [-0.03625, 0.46375, 0, 0, 0.77778], "8773": [-0.022, 0.589, 0, 0, 1.0], "8776": [-0.01688, 0.48312, 0, 0, 0.77778], "8781": [-0.03625, 0.46375, 0, 0, 0.77778], "8784": [-0.133, 0.67, 0, 0, 0.778], "8801": [-0.03625, 0.46375, 0, 0, 0.77778], "8804": [0.13597, 0.63597, 0, 0, 0.77778], "8805": [0.13597, 0.63597, 0, 0, 0.77778], "8810": [0.0391, 0.5391, 0, 0, 1.0], "8811": [0.0391, 0.5391, 0, 0, 1.0], "8826": [0.0391, 0.5391, 0, 0, 0.77778], "8827": [0.0391, 0.5391, 0, 0, 0.77778], "8834": [0.0391, 0.5391, 0, 0, 0.77778], "8835": [0.0391, 0.5391, 0, 0, 0.77778], "8838": [0.13597, 0.63597, 0, 0, 0.77778], "8839": [0.13597, 0.63597, 0, 0, 0.77778], "8846": [0, 0.55556, 0, 0, 0.66667], "8849": [0.13597, 0.63597, 0, 0, 0.77778], "8850": [0.13597, 0.63597, 0, 0, 0.77778], "8851": [0, 0.55556, 0, 0, 0.66667], "8852": [0, 0.55556, 0, 0, 0.66667], "8853": [0.08333, 0.58333, 0, 0, 0.77778], "8854": [0.08333, 0.58333, 0, 0, 0.77778], "8855": [0.08333, 0.58333, 0, 0, 0.77778], "8856": [0.08333, 0.58333, 0, 0, 0.77778], "8857": [0.08333, 0.58333, 0, 0, 0.77778], "8866": [0, 0.69444, 0, 0, 0.61111], "8867": [0, 0.69444, 0, 0, 0.61111], "8868": [0, 0.69444, 0, 0, 0.77778], "8869": [0, 0.69444, 0, 0, 0.77778], "8872": [0.249, 0.75, 0, 0, 0.867], "8900": [-0.05555, 0.44445, 0, 0, 0.5], "8901": [-0.05555, 0.44445, 0, 0, 0.27778], "8902": [-0.03472, 0.46528, 0, 0, 0.5], "8904": [0.005, 0.505, 0, 0, 0.9], "8942": [0.03, 0.9, 0, 0, 0.278], "8943": [-0.19, 0.31, 0, 0, 1.172], "8945": [-0.1, 0.82, 0, 0, 1.282], "8968": [0.25, 0.75, 0, 0, 0.44445], "8969": [0.25, 0.75, 0, 0, 0.44445], "8970": [0.25, 0.75, 0, 0, 0.44445], "8971": [0.25, 0.75, 0, 0, 0.44445], "8994": [-0.14236, 0.35764, 0, 0, 1.0], "8995": [-0.14236, 0.35764, 0, 0, 1.0], "9136": [0.244, 0.744, 0, 0, 0.412], "9137": [0.244, 0.744, 0, 0, 0.412], "9651": [0.19444, 0.69444, 0, 0, 0.88889], "9657": [-0.03472, 0.46528, 0, 0, 0.5], "9661": [0.19444, 0.69444, 0, 0, 0.88889], "9667": [-0.03472, 0.46528, 0, 0, 0.5], "9711": [0.19444, 0.69444, 0, 0, 1.0], "9824": [0.12963, 0.69444, 0, 0, 0.77778], "9825": [0.12963, 0.69444, 0, 0, 0.77778], "9826": [0.12963, 0.69444, 0, 0, 0.77778], "9827": [0.12963, 0.69444, 0, 0, 0.77778], "9837": [0, 0.75, 0, 0, 0.38889], "9838": [0.19444, 0.69444, 0, 0, 0.38889], "9839": [0.19444, 0.69444, 0, 0, 0.38889], "10216": [0.25, 0.75, 0, 0, 0.38889], "10217": [0.25, 0.75, 0, 0, 0.38889], "10222": [0.244, 0.744, 0, 0, 0.412], "10223": [0.244, 0.744, 0, 0, 0.412], "10229": [0.011, 0.511, 0, 0, 1.609], "10230": [0.011, 0.511, 0, 0, 1.638], "10231": [0.011, 0.511, 0, 0, 1.859], "10232": [0.024, 0.525, 0, 0, 1.609], "10233": [0.024, 0.525, 0, 0, 1.638], "10234": [0.024, 0.525, 0, 0, 1.858], "10236": [0.011, 0.511, 0, 0, 1.638], "10815": [0, 0.68333, 0, 0, 0.75], "10927": [0.13597, 0.63597, 0, 0, 0.77778], "10928": [0.13597, 0.63597, 0, 0, 0.77778], "57376": [0.19444, 0.69444, 0, 0, 0] }, "Math-BoldItalic": { "32": [0, 0, 0, 0, 0.25], "48": [0, 0.44444, 0, 0, 0.575], "49": [0, 0.44444, 0, 0, 0.575], "50": [0, 0.44444, 0, 0, 0.575], "51": [0.19444, 0.44444, 0, 0, 0.575], "52": [0.19444, 0.44444, 0, 0, 0.575], "53": [0.19444, 0.44444, 0, 0, 0.575], "54": [0, 0.64444, 0, 0, 0.575], "55": [0.19444, 0.44444, 0, 0, 0.575], "56": [0, 0.64444, 0, 0, 0.575], "57": [0.19444, 0.44444, 0, 0, 0.575], "65": [0, 0.68611, 0, 0, 0.86944], "66": [0, 0.68611, 0.04835, 0, 0.8664], "67": [0, 0.68611, 0.06979, 0, 0.81694], "68": [0, 0.68611, 0.03194, 0, 0.93812], "69": [0, 0.68611, 0.05451, 0, 0.81007], "70": [0, 0.68611, 0.15972, 0, 0.68889], "71": [0, 0.68611, 0, 0, 0.88673], "72": [0, 0.68611, 0.08229, 0, 0.98229], "73": [0, 0.68611, 0.07778, 0, 0.51111], "74": [0, 0.68611, 0.10069, 0, 0.63125], "75": [0, 0.68611, 0.06979, 0, 0.97118], "76": [0, 0.68611, 0, 0, 0.75555], "77": [0, 0.68611, 0.11424, 0, 1.14201], "78": [0, 0.68611, 0.11424, 0, 0.95034], "79": [0, 0.68611, 0.03194, 0, 0.83666], "80": [0, 0.68611, 0.15972, 0, 0.72309], "81": [0.19444, 0.68611, 0, 0, 0.86861], "82": [0, 0.68611, 0.00421, 0, 0.87235], "83": [0, 0.68611, 0.05382, 0, 0.69271], "84": [0, 0.68611, 0.15972, 0, 0.63663], "85": [0, 0.68611, 0.11424, 0, 0.80027], "86": [0, 0.68611, 0.25555, 0, 0.67778], "87": [0, 0.68611, 0.15972, 0, 1.09305], "88": [0, 0.68611, 0.07778, 0, 0.94722], "89": [0, 0.68611, 0.25555, 0, 0.67458], "90": [0, 0.68611, 0.06979, 0, 0.77257], "97": [0, 0.44444, 0, 0, 0.63287], "98": [0, 0.69444, 0, 0, 0.52083], "99": [0, 0.44444, 0, 0, 0.51342], "100": [0, 0.69444, 0, 0, 0.60972], "101": [0, 0.44444, 0, 0, 0.55361], "102": [0.19444, 0.69444, 0.11042, 0, 0.56806], "103": [0.19444, 0.44444, 0.03704, 0, 0.5449], "104": [0, 0.69444, 0, 0, 0.66759], "105": [0, 0.69326, 0, 0, 0.4048], "106": [0.19444, 0.69326, 0.0622, 0, 0.47083], "107": [0, 0.69444, 0.01852, 0, 0.6037], "108": [0, 0.69444, 0.0088, 0, 0.34815], "109": [0, 0.44444, 0, 0, 1.0324], "110": [0, 0.44444, 0, 0, 0.71296], "111": [0, 0.44444, 0, 0, 0.58472], "112": [0.19444, 0.44444, 0, 0, 0.60092], "113": [0.19444, 0.44444, 0.03704, 0, 0.54213], "114": [0, 0.44444, 0.03194, 0, 0.5287], "115": [0, 0.44444, 0, 0, 0.53125], "116": [0, 0.63492, 0, 0, 0.41528], "117": [0, 0.44444, 0, 0, 0.68102], "118": [0, 0.44444, 0.03704, 0, 0.56666], "119": [0, 0.44444, 0.02778, 0, 0.83148], "120": [0, 0.44444, 0, 0, 0.65903], "121": [0.19444, 0.44444, 0.03704, 0, 0.59028], "122": [0, 0.44444, 0.04213, 0, 0.55509], "160": [0, 0, 0, 0, 0.25], "915": [0, 0.68611, 0.15972, 0, 0.65694], "916": [0, 0.68611, 0, 0, 0.95833], "920": [0, 0.68611, 0.03194, 0, 0.86722], "923": [0, 0.68611, 0, 0, 0.80555], "926": [0, 0.68611, 0.07458, 0, 0.84125], "928": [0, 0.68611, 0.08229, 0, 0.98229], "931": [0, 0.68611, 0.05451, 0, 0.88507], "933": [0, 0.68611, 0.15972, 0, 0.67083], "934": [0, 0.68611, 0, 0, 0.76666], "936": [0, 0.68611, 0.11653, 0, 0.71402], "937": [0, 0.68611, 0.04835, 0, 0.8789], "945": [0, 0.44444, 0, 0, 0.76064], "946": [0.19444, 0.69444, 0.03403, 0, 0.65972], "947": [0.19444, 0.44444, 0.06389, 0, 0.59003], "948": [0, 0.69444, 0.03819, 0, 0.52222], "949": [0, 0.44444, 0, 0, 0.52882], "950": [0.19444, 0.69444, 0.06215, 0, 0.50833], "951": [0.19444, 0.44444, 0.03704, 0, 0.6], "952": [0, 0.69444, 0.03194, 0, 0.5618], "953": [0, 0.44444, 0, 0, 0.41204], "954": [0, 0.44444, 0, 0, 0.66759], "955": [0, 0.69444, 0, 0, 0.67083], "956": [0.19444, 0.44444, 0, 0, 0.70787], "957": [0, 0.44444, 0.06898, 0, 0.57685], "958": [0.19444, 0.69444, 0.03021, 0, 0.50833], "959": [0, 0.44444, 0, 0, 0.58472], "960": [0, 0.44444, 0.03704, 0, 0.68241], "961": [0.19444, 0.44444, 0, 0, 0.6118], "962": [0.09722, 0.44444, 0.07917, 0, 0.42361], "963": [0, 0.44444, 0.03704, 0, 0.68588], "964": [0, 0.44444, 0.13472, 0, 0.52083], "965": [0, 0.44444, 0.03704, 0, 0.63055], "966": [0.19444, 0.44444, 0, 0, 0.74722], "967": [0.19444, 0.44444, 0, 0, 0.71805], "968": [0.19444, 0.69444, 0.03704, 0, 0.75833], "969": [0, 0.44444, 0.03704, 0, 0.71782], "977": [0, 0.69444, 0, 0, 0.69155], "981": [0.19444, 0.69444, 0, 0, 0.7125], "982": [0, 0.44444, 0.03194, 0, 0.975], "1009": [0.19444, 0.44444, 0, 0, 0.6118], "1013": [0, 0.44444, 0, 0, 0.48333], "57649": [0, 0.44444, 0, 0, 0.39352], "57911": [0.19444, 0.44444, 0, 0, 0.43889] }, "Math-Italic": { "32": [0, 0, 0, 0, 0.25], "48": [0, 0.43056, 0, 0, 0.5], "49": [0, 0.43056, 0, 0, 0.5], "50": [0, 0.43056, 0, 0, 0.5], "51": [0.19444, 0.43056, 0, 0, 0.5], "52": [0.19444, 0.43056, 0, 0, 0.5], "53": [0.19444, 0.43056, 0, 0, 0.5], "54": [0, 0.64444, 0, 0, 0.5], "55": [0.19444, 0.43056, 0, 0, 0.5], "56": [0, 0.64444, 0, 0, 0.5], "57": [0.19444, 0.43056, 0, 0, 0.5], "65": [0, 0.68333, 0, 0.13889, 0.75], "66": [0, 0.68333, 0.05017, 0.08334, 0.75851], "67": [0, 0.68333, 0.07153, 0.08334, 0.71472], "68": [0, 0.68333, 0.02778, 0.05556, 0.82792], "69": [0, 0.68333, 0.05764, 0.08334, 0.7382], "70": [0, 0.68333, 0.13889, 0.08334, 0.64306], "71": [0, 0.68333, 0, 0.08334, 0.78625], "72": [0, 0.68333, 0.08125, 0.05556, 0.83125], "73": [0, 0.68333, 0.07847, 0.11111, 0.43958], "74": [0, 0.68333, 0.09618, 0.16667, 0.55451], "75": [0, 0.68333, 0.07153, 0.05556, 0.84931], "76": [0, 0.68333, 0, 0.02778, 0.68056], "77": [0, 0.68333, 0.10903, 0.08334, 0.97014], "78": [0, 0.68333, 0.10903, 0.08334, 0.80347], "79": [0, 0.68333, 0.02778, 0.08334, 0.76278], "80": [0, 0.68333, 0.13889, 0.08334, 0.64201], "81": [0.19444, 0.68333, 0, 0.08334, 0.79056], "82": [0, 0.68333, 0.00773, 0.08334, 0.75929], "83": [0, 0.68333, 0.05764, 0.08334, 0.6132], "84": [0, 0.68333, 0.13889, 0.08334, 0.58438], "85": [0, 0.68333, 0.10903, 0.02778, 0.68278], "86": [0, 0.68333, 0.22222, 0, 0.58333], "87": [0, 0.68333, 0.13889, 0, 0.94445], "88": [0, 0.68333, 0.07847, 0.08334, 0.82847], "89": [0, 0.68333, 0.22222, 0, 0.58056], "90": [0, 0.68333, 0.07153, 0.08334, 0.68264], "97": [0, 0.43056, 0, 0, 0.52859], "98": [0, 0.69444, 0, 0, 0.42917], "99": [0, 0.43056, 0, 0.05556, 0.43276], "100": [0, 0.69444, 0, 0.16667, 0.52049], "101": [0, 0.43056, 0, 0.05556, 0.46563], "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], "104": [0, 0.69444, 0, 0, 0.57616], "105": [0, 0.65952, 0, 0, 0.34451], "106": [0.19444, 0.65952, 0.05724, 0, 0.41181], "107": [0, 0.69444, 0.03148, 0, 0.5206], "108": [0, 0.69444, 0.01968, 0.08334, 0.29838], "109": [0, 0.43056, 0, 0, 0.87801], "110": [0, 0.43056, 0, 0, 0.60023], "111": [0, 0.43056, 0, 0.05556, 0.48472], "112": [0.19444, 0.43056, 0, 0.08334, 0.50313], "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], "114": [0, 0.43056, 0.02778, 0.05556, 0.45116], "115": [0, 0.43056, 0, 0.05556, 0.46875], "116": [0, 0.61508, 0, 0.08334, 0.36111], "117": [0, 0.43056, 0, 0.02778, 0.57246], "118": [0, 0.43056, 0.03588, 0.02778, 0.48472], "119": [0, 0.43056, 0.02691, 0.08334, 0.71592], "120": [0, 0.43056, 0, 0.02778, 0.57153], "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], "122": [0, 0.43056, 0.04398, 0.05556, 0.46505], "160": [0, 0, 0, 0, 0.25], "915": [0, 0.68333, 0.13889, 0.08334, 0.61528], "916": [0, 0.68333, 0, 0.16667, 0.83334], "920": [0, 0.68333, 0.02778, 0.08334, 0.76278], "923": [0, 0.68333, 0, 0.16667, 0.69445], "926": [0, 0.68333, 0.07569, 0.08334, 0.74236], "928": [0, 0.68333, 0.08125, 0.05556, 0.83125], "931": [0, 0.68333, 0.05764, 0.08334, 0.77986], "933": [0, 0.68333, 0.13889, 0.05556, 0.58333], "934": [0, 0.68333, 0, 0.08334, 0.66667], "936": [0, 0.68333, 0.11, 0.05556, 0.61222], "937": [0, 0.68333, 0.05017, 0.08334, 0.7724], "945": [0, 0.43056, 0.0037, 0.02778, 0.6397], "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], "947": [0.19444, 0.43056, 0.05556, 0, 0.51773], "948": [0, 0.69444, 0.03785, 0.05556, 0.44444], "949": [0, 0.43056, 0, 0.08334, 0.46632], "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], "952": [0, 0.69444, 0.02778, 0.08334, 0.46944], "953": [0, 0.43056, 0, 0.05556, 0.35394], "954": [0, 0.43056, 0, 0, 0.57616], "955": [0, 0.69444, 0, 0, 0.58334], "956": [0.19444, 0.43056, 0, 0.02778, 0.60255], "957": [0, 0.43056, 0.06366, 0.02778, 0.49398], "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], "959": [0, 0.43056, 0, 0.05556, 0.48472], "960": [0, 0.43056, 0.03588, 0, 0.57003], "961": [0.19444, 0.43056, 0, 0.08334, 0.51702], "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], "963": [0, 0.43056, 0.03588, 0, 0.57141], "964": [0, 0.43056, 0.1132, 0.02778, 0.43715], "965": [0, 0.43056, 0.03588, 0.02778, 0.54028], "966": [0.19444, 0.43056, 0, 0.08334, 0.65417], "967": [0.19444, 0.43056, 0, 0.05556, 0.62569], "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], "969": [0, 0.43056, 0.03588, 0, 0.62245], "977": [0, 0.69444, 0, 0.08334, 0.59144], "981": [0.19444, 0.69444, 0, 0.08334, 0.59583], "982": [0, 0.43056, 0.02778, 0, 0.82813], "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702], "1013": [0, 0.43056, 0, 0.05556, 0.4059], "57649": [0, 0.43056, 0, 0.02778, 0.32246], "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403] }, "SansSerif-Bold": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.36667], "34": [0, 0.69444, 0, 0, 0.55834], "35": [0.19444, 0.69444, 0, 0, 0.91667], "36": [0.05556, 0.75, 0, 0, 0.55], "37": [0.05556, 0.75, 0, 0, 1.02912], "38": [0, 0.69444, 0, 0, 0.83056], "39": [0, 0.69444, 0, 0, 0.30556], "40": [0.25, 0.75, 0, 0, 0.42778], "41": [0.25, 0.75, 0, 0, 0.42778], "42": [0, 0.75, 0, 0, 0.55], "43": [0.11667, 0.61667, 0, 0, 0.85556], "44": [0.10556, 0.13056, 0, 0, 0.30556], "45": [0, 0.45833, 0, 0, 0.36667], "46": [0, 0.13056, 0, 0, 0.30556], "47": [0.25, 0.75, 0, 0, 0.55], "48": [0, 0.69444, 0, 0, 0.55], "49": [0, 0.69444, 0, 0, 0.55], "50": [0, 0.69444, 0, 0, 0.55], "51": [0, 0.69444, 0, 0, 0.55], "52": [0, 0.69444, 0, 0, 0.55], "53": [0, 0.69444, 0, 0, 0.55], "54": [0, 0.69444, 0, 0, 0.55], "55": [0, 0.69444, 0, 0, 0.55], "56": [0, 0.69444, 0, 0, 0.55], "57": [0, 0.69444, 0, 0, 0.55], "58": [0, 0.45833, 0, 0, 0.30556], "59": [0.10556, 0.45833, 0, 0, 0.30556], "61": [-0.09375, 0.40625, 0, 0, 0.85556], "63": [0, 0.69444, 0, 0, 0.51945], "64": [0, 0.69444, 0, 0, 0.73334], "65": [0, 0.69444, 0, 0, 0.73334], "66": [0, 0.69444, 0, 0, 0.73334], "67": [0, 0.69444, 0, 0, 0.70278], "68": [0, 0.69444, 0, 0, 0.79445], "69": [0, 0.69444, 0, 0, 0.64167], "70": [0, 0.69444, 0, 0, 0.61111], "71": [0, 0.69444, 0, 0, 0.73334], "72": [0, 0.69444, 0, 0, 0.79445], "73": [0, 0.69444, 0, 0, 0.33056], "74": [0, 0.69444, 0, 0, 0.51945], "75": [0, 0.69444, 0, 0, 0.76389], "76": [0, 0.69444, 0, 0, 0.58056], "77": [0, 0.69444, 0, 0, 0.97778], "78": [0, 0.69444, 0, 0, 0.79445], "79": [0, 0.69444, 0, 0, 0.79445], "80": [0, 0.69444, 0, 0, 0.70278], "81": [0.10556, 0.69444, 0, 0, 0.79445], "82": [0, 0.69444, 0, 0, 0.70278], "83": [0, 0.69444, 0, 0, 0.61111], "84": [0, 0.69444, 0, 0, 0.73334], "85": [0, 0.69444, 0, 0, 0.76389], "86": [0, 0.69444, 0.01528, 0, 0.73334], "87": [0, 0.69444, 0.01528, 0, 1.03889], "88": [0, 0.69444, 0, 0, 0.73334], "89": [0, 0.69444, 0.0275, 0, 0.73334], "90": [0, 0.69444, 0, 0, 0.67223], "91": [0.25, 0.75, 0, 0, 0.34306], "93": [0.25, 0.75, 0, 0, 0.34306], "94": [0, 0.69444, 0, 0, 0.55], "95": [0.35, 0.10833, 0.03056, 0, 0.55], "97": [0, 0.45833, 0, 0, 0.525], "98": [0, 0.69444, 0, 0, 0.56111], "99": [0, 0.45833, 0, 0, 0.48889], "100": [0, 0.69444, 0, 0, 0.56111], "101": [0, 0.45833, 0, 0, 0.51111], "102": [0, 0.69444, 0.07639, 0, 0.33611], "103": [0.19444, 0.45833, 0.01528, 0, 0.55], "104": [0, 0.69444, 0, 0, 0.56111], "105": [0, 0.69444, 0, 0, 0.25556], "106": [0.19444, 0.69444, 0, 0, 0.28611], "107": [0, 0.69444, 0, 0, 0.53056], "108": [0, 0.69444, 0, 0, 0.25556], "109": [0, 0.45833, 0, 0, 0.86667], "110": [0, 0.45833, 0, 0, 0.56111], "111": [0, 0.45833, 0, 0, 0.55], "112": [0.19444, 0.45833, 0, 0, 0.56111], "113": [0.19444, 0.45833, 0, 0, 0.56111], "114": [0, 0.45833, 0.01528, 0, 0.37222], "115": [0, 0.45833, 0, 0, 0.42167], "116": [0, 0.58929, 0, 0, 0.40417], "117": [0, 0.45833, 0, 0, 0.56111], "118": [0, 0.45833, 0.01528, 0, 0.5], "119": [0, 0.45833, 0.01528, 0, 0.74445], "120": [0, 0.45833, 0, 0, 0.5], "121": [0.19444, 0.45833, 0.01528, 0, 0.5], "122": [0, 0.45833, 0, 0, 0.47639], "126": [0.35, 0.34444, 0, 0, 0.55], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.69444, 0, 0, 0.55], "176": [0, 0.69444, 0, 0, 0.73334], "180": [0, 0.69444, 0, 0, 0.55], "184": [0.17014, 0, 0, 0, 0.48889], "305": [0, 0.45833, 0, 0, 0.25556], "567": [0.19444, 0.45833, 0, 0, 0.28611], "710": [0, 0.69444, 0, 0, 0.55], "711": [0, 0.63542, 0, 0, 0.55], "713": [0, 0.63778, 0, 0, 0.55], "728": [0, 0.69444, 0, 0, 0.55], "729": [0, 0.69444, 0, 0, 0.30556], "730": [0, 0.69444, 0, 0, 0.73334], "732": [0, 0.69444, 0, 0, 0.55], "733": [0, 0.69444, 0, 0, 0.55], "915": [0, 0.69444, 0, 0, 0.58056], "916": [0, 0.69444, 0, 0, 0.91667], "920": [0, 0.69444, 0, 0, 0.85556], "923": [0, 0.69444, 0, 0, 0.67223], "926": [0, 0.69444, 0, 0, 0.73334], "928": [0, 0.69444, 0, 0, 0.79445], "931": [0, 0.69444, 0, 0, 0.79445], "933": [0, 0.69444, 0, 0, 0.85556], "934": [0, 0.69444, 0, 0, 0.79445], "936": [0, 0.69444, 0, 0, 0.85556], "937": [0, 0.69444, 0, 0, 0.79445], "8211": [0, 0.45833, 0.03056, 0, 0.55], "8212": [0, 0.45833, 0.03056, 0, 1.10001], "8216": [0, 0.69444, 0, 0, 0.30556], "8217": [0, 0.69444, 0, 0, 0.30556], "8220": [0, 0.69444, 0, 0, 0.55834], "8221": [0, 0.69444, 0, 0, 0.55834] }, "SansSerif-Italic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.05733, 0, 0.31945], "34": [0, 0.69444, 0.00316, 0, 0.5], "35": [0.19444, 0.69444, 0.05087, 0, 0.83334], "36": [0.05556, 0.75, 0.11156, 0, 0.5], "37": [0.05556, 0.75, 0.03126, 0, 0.83334], "38": [0, 0.69444, 0.03058, 0, 0.75834], "39": [0, 0.69444, 0.07816, 0, 0.27778], "40": [0.25, 0.75, 0.13164, 0, 0.38889], "41": [0.25, 0.75, 0.02536, 0, 0.38889], "42": [0, 0.75, 0.11775, 0, 0.5], "43": [0.08333, 0.58333, 0.02536, 0, 0.77778], "44": [0.125, 0.08333, 0, 0, 0.27778], "45": [0, 0.44444, 0.01946, 0, 0.33333], "46": [0, 0.08333, 0, 0, 0.27778], "47": [0.25, 0.75, 0.13164, 0, 0.5], "48": [0, 0.65556, 0.11156, 0, 0.5], "49": [0, 0.65556, 0.11156, 0, 0.5], "50": [0, 0.65556, 0.11156, 0, 0.5], "51": [0, 0.65556, 0.11156, 0, 0.5], "52": [0, 0.65556, 0.11156, 0, 0.5], "53": [0, 0.65556, 0.11156, 0, 0.5], "54": [0, 0.65556, 0.11156, 0, 0.5], "55": [0, 0.65556, 0.11156, 0, 0.5], "56": [0, 0.65556, 0.11156, 0, 0.5], "57": [0, 0.65556, 0.11156, 0, 0.5], "58": [0, 0.44444, 0.02502, 0, 0.27778], "59": [0.125, 0.44444, 0.02502, 0, 0.27778], "61": [-0.13, 0.37, 0.05087, 0, 0.77778], "63": [0, 0.69444, 0.11809, 0, 0.47222], "64": [0, 0.69444, 0.07555, 0, 0.66667], "65": [0, 0.69444, 0, 0, 0.66667], "66": [0, 0.69444, 0.08293, 0, 0.66667], "67": [0, 0.69444, 0.11983, 0, 0.63889], "68": [0, 0.69444, 0.07555, 0, 0.72223], "69": [0, 0.69444, 0.11983, 0, 0.59722], "70": [0, 0.69444, 0.13372, 0, 0.56945], "71": [0, 0.69444, 0.11983, 0, 0.66667], "72": [0, 0.69444, 0.08094, 0, 0.70834], "73": [0, 0.69444, 0.13372, 0, 0.27778], "74": [0, 0.69444, 0.08094, 0, 0.47222], "75": [0, 0.69444, 0.11983, 0, 0.69445], "76": [0, 0.69444, 0, 0, 0.54167], "77": [0, 0.69444, 0.08094, 0, 0.875], "78": [0, 0.69444, 0.08094, 0, 0.70834], "79": [0, 0.69444, 0.07555, 0, 0.73611], "80": [0, 0.69444, 0.08293, 0, 0.63889], "81": [0.125, 0.69444, 0.07555, 0, 0.73611], "82": [0, 0.69444, 0.08293, 0, 0.64584], "83": [0, 0.69444, 0.09205, 0, 0.55556], "84": [0, 0.69444, 0.13372, 0, 0.68056], "85": [0, 0.69444, 0.08094, 0, 0.6875], "86": [0, 0.69444, 0.1615, 0, 0.66667], "87": [0, 0.69444, 0.1615, 0, 0.94445], "88": [0, 0.69444, 0.13372, 0, 0.66667], "89": [0, 0.69444, 0.17261, 0, 0.66667], "90": [0, 0.69444, 0.11983, 0, 0.61111], "91": [0.25, 0.75, 0.15942, 0, 0.28889], "93": [0.25, 0.75, 0.08719, 0, 0.28889], "94": [0, 0.69444, 0.0799, 0, 0.5], "95": [0.35, 0.09444, 0.08616, 0, 0.5], "97": [0, 0.44444, 0.00981, 0, 0.48056], "98": [0, 0.69444, 0.03057, 0, 0.51667], "99": [0, 0.44444, 0.08336, 0, 0.44445], "100": [0, 0.69444, 0.09483, 0, 0.51667], "101": [0, 0.44444, 0.06778, 0, 0.44445], "102": [0, 0.69444, 0.21705, 0, 0.30556], "103": [0.19444, 0.44444, 0.10836, 0, 0.5], "104": [0, 0.69444, 0.01778, 0, 0.51667], "105": [0, 0.67937, 0.09718, 0, 0.23889], "106": [0.19444, 0.67937, 0.09162, 0, 0.26667], "107": [0, 0.69444, 0.08336, 0, 0.48889], "108": [0, 0.69444, 0.09483, 0, 0.23889], "109": [0, 0.44444, 0.01778, 0, 0.79445], "110": [0, 0.44444, 0.01778, 0, 0.51667], "111": [0, 0.44444, 0.06613, 0, 0.5], "112": [0.19444, 0.44444, 0.0389, 0, 0.51667], "113": [0.19444, 0.44444, 0.04169, 0, 0.51667], "114": [0, 0.44444, 0.10836, 0, 0.34167], "115": [0, 0.44444, 0.0778, 0, 0.38333], "116": [0, 0.57143, 0.07225, 0, 0.36111], "117": [0, 0.44444, 0.04169, 0, 0.51667], "118": [0, 0.44444, 0.10836, 0, 0.46111], "119": [0, 0.44444, 0.10836, 0, 0.68334], "120": [0, 0.44444, 0.09169, 0, 0.46111], "121": [0.19444, 0.44444, 0.10836, 0, 0.46111], "122": [0, 0.44444, 0.08752, 0, 0.43472], "126": [0.35, 0.32659, 0.08826, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.67937, 0.06385, 0, 0.5], "176": [0, 0.69444, 0, 0, 0.73752], "184": [0.17014, 0, 0, 0, 0.44445], "305": [0, 0.44444, 0.04169, 0, 0.23889], "567": [0.19444, 0.44444, 0.04169, 0, 0.26667], "710": [0, 0.69444, 0.0799, 0, 0.5], "711": [0, 0.63194, 0.08432, 0, 0.5], "713": [0, 0.60889, 0.08776, 0, 0.5], "714": [0, 0.69444, 0.09205, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0.09483, 0, 0.5], "729": [0, 0.67937, 0.07774, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.73752], "732": [0, 0.67659, 0.08826, 0, 0.5], "733": [0, 0.69444, 0.09205, 0, 0.5], "915": [0, 0.69444, 0.13372, 0, 0.54167], "916": [0, 0.69444, 0, 0, 0.83334], "920": [0, 0.69444, 0.07555, 0, 0.77778], "923": [0, 0.69444, 0, 0, 0.61111], "926": [0, 0.69444, 0.12816, 0, 0.66667], "928": [0, 0.69444, 0.08094, 0, 0.70834], "931": [0, 0.69444, 0.11983, 0, 0.72222], "933": [0, 0.69444, 0.09031, 0, 0.77778], "934": [0, 0.69444, 0.04603, 0, 0.72222], "936": [0, 0.69444, 0.09031, 0, 0.77778], "937": [0, 0.69444, 0.08293, 0, 0.72222], "8211": [0, 0.44444, 0.08616, 0, 0.5], "8212": [0, 0.44444, 0.08616, 0, 1.0], "8216": [0, 0.69444, 0.07816, 0, 0.27778], "8217": [0, 0.69444, 0.07816, 0, 0.27778], "8220": [0, 0.69444, 0.14205, 0, 0.5], "8221": [0, 0.69444, 0.00316, 0, 0.5] }, "SansSerif-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.31945], "34": [0, 0.69444, 0, 0, 0.5], "35": [0.19444, 0.69444, 0, 0, 0.83334], "36": [0.05556, 0.75, 0, 0, 0.5], "37": [0.05556, 0.75, 0, 0, 0.83334], "38": [0, 0.69444, 0, 0, 0.75834], "39": [0, 0.69444, 0, 0, 0.27778], "40": [0.25, 0.75, 0, 0, 0.38889], "41": [0.25, 0.75, 0, 0, 0.38889], "42": [0, 0.75, 0, 0, 0.5], "43": [0.08333, 0.58333, 0, 0, 0.77778], "44": [0.125, 0.08333, 0, 0, 0.27778], "45": [0, 0.44444, 0, 0, 0.33333], "46": [0, 0.08333, 0, 0, 0.27778], "47": [0.25, 0.75, 0, 0, 0.5], "48": [0, 0.65556, 0, 0, 0.5], "49": [0, 0.65556, 0, 0, 0.5], "50": [0, 0.65556, 0, 0, 0.5], "51": [0, 0.65556, 0, 0, 0.5], "52": [0, 0.65556, 0, 0, 0.5], "53": [0, 0.65556, 0, 0, 0.5], "54": [0, 0.65556, 0, 0, 0.5], "55": [0, 0.65556, 0, 0, 0.5], "56": [0, 0.65556, 0, 0, 0.5], "57": [0, 0.65556, 0, 0, 0.5], "58": [0, 0.44444, 0, 0, 0.27778], "59": [0.125, 0.44444, 0, 0, 0.27778], "61": [-0.13, 0.37, 0, 0, 0.77778], "63": [0, 0.69444, 0, 0, 0.47222], "64": [0, 0.69444, 0, 0, 0.66667], "65": [0, 0.69444, 0, 0, 0.66667], "66": [0, 0.69444, 0, 0, 0.66667], "67": [0, 0.69444, 0, 0, 0.63889], "68": [0, 0.69444, 0, 0, 0.72223], "69": [0, 0.69444, 0, 0, 0.59722], "70": [0, 0.69444, 0, 0, 0.56945], "71": [0, 0.69444, 0, 0, 0.66667], "72": [0, 0.69444, 0, 0, 0.70834], "73": [0, 0.69444, 0, 0, 0.27778], "74": [0, 0.69444, 0, 0, 0.47222], "75": [0, 0.69444, 0, 0, 0.69445], "76": [0, 0.69444, 0, 0, 0.54167], "77": [0, 0.69444, 0, 0, 0.875], "78": [0, 0.69444, 0, 0, 0.70834], "79": [0, 0.69444, 0, 0, 0.73611], "80": [0, 0.69444, 0, 0, 0.63889], "81": [0.125, 0.69444, 0, 0, 0.73611], "82": [0, 0.69444, 0, 0, 0.64584], "83": [0, 0.69444, 0, 0, 0.55556], "84": [0, 0.69444, 0, 0, 0.68056], "85": [0, 0.69444, 0, 0, 0.6875], "86": [0, 0.69444, 0.01389, 0, 0.66667], "87": [0, 0.69444, 0.01389, 0, 0.94445], "88": [0, 0.69444, 0, 0, 0.66667], "89": [0, 0.69444, 0.025, 0, 0.66667], "90": [0, 0.69444, 0, 0, 0.61111], "91": [0.25, 0.75, 0, 0, 0.28889], "93": [0.25, 0.75, 0, 0, 0.28889], "94": [0, 0.69444, 0, 0, 0.5], "95": [0.35, 0.09444, 0.02778, 0, 0.5], "97": [0, 0.44444, 0, 0, 0.48056], "98": [0, 0.69444, 0, 0, 0.51667], "99": [0, 0.44444, 0, 0, 0.44445], "100": [0, 0.69444, 0, 0, 0.51667], "101": [0, 0.44444, 0, 0, 0.44445], "102": [0, 0.69444, 0.06944, 0, 0.30556], "103": [0.19444, 0.44444, 0.01389, 0, 0.5], "104": [0, 0.69444, 0, 0, 0.51667], "105": [0, 0.67937, 0, 0, 0.23889], "106": [0.19444, 0.67937, 0, 0, 0.26667], "107": [0, 0.69444, 0, 0, 0.48889], "108": [0, 0.69444, 0, 0, 0.23889], "109": [0, 0.44444, 0, 0, 0.79445], "110": [0, 0.44444, 0, 0, 0.51667], "111": [0, 0.44444, 0, 0, 0.5], "112": [0.19444, 0.44444, 0, 0, 0.51667], "113": [0.19444, 0.44444, 0, 0, 0.51667], "114": [0, 0.44444, 0.01389, 0, 0.34167], "115": [0, 0.44444, 0, 0, 0.38333], "116": [0, 0.57143, 0, 0, 0.36111], "117": [0, 0.44444, 0, 0, 0.51667], "118": [0, 0.44444, 0.01389, 0, 0.46111], "119": [0, 0.44444, 0.01389, 0, 0.68334], "120": [0, 0.44444, 0, 0, 0.46111], "121": [0.19444, 0.44444, 0.01389, 0, 0.46111], "122": [0, 0.44444, 0, 0, 0.43472], "126": [0.35, 0.32659, 0, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.67937, 0, 0, 0.5], "176": [0, 0.69444, 0, 0, 0.66667], "184": [0.17014, 0, 0, 0, 0.44445], "305": [0, 0.44444, 0, 0, 0.23889], "567": [0.19444, 0.44444, 0, 0, 0.26667], "710": [0, 0.69444, 0, 0, 0.5], "711": [0, 0.63194, 0, 0, 0.5], "713": [0, 0.60889, 0, 0, 0.5], "714": [0, 0.69444, 0, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0, 0, 0.5], "729": [0, 0.67937, 0, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.66667], "732": [0, 0.67659, 0, 0, 0.5], "733": [0, 0.69444, 0, 0, 0.5], "915": [0, 0.69444, 0, 0, 0.54167], "916": [0, 0.69444, 0, 0, 0.83334], "920": [0, 0.69444, 0, 0, 0.77778], "923": [0, 0.69444, 0, 0, 0.61111], "926": [0, 0.69444, 0, 0, 0.66667], "928": [0, 0.69444, 0, 0, 0.70834], "931": [0, 0.69444, 0, 0, 0.72222], "933": [0, 0.69444, 0, 0, 0.77778], "934": [0, 0.69444, 0, 0, 0.72222], "936": [0, 0.69444, 0, 0, 0.77778], "937": [0, 0.69444, 0, 0, 0.72222], "8211": [0, 0.44444, 0.02778, 0, 0.5], "8212": [0, 0.44444, 0.02778, 0, 1.0], "8216": [0, 0.69444, 0, 0, 0.27778], "8217": [0, 0.69444, 0, 0, 0.27778], "8220": [0, 0.69444, 0, 0, 0.5], "8221": [0, 0.69444, 0, 0, 0.5] }, "Script-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.7, 0.22925, 0, 0.80253], "66": [0, 0.7, 0.04087, 0, 0.90757], "67": [0, 0.7, 0.1689, 0, 0.66619], "68": [0, 0.7, 0.09371, 0, 0.77443], "69": [0, 0.7, 0.18583, 0, 0.56162], "70": [0, 0.7, 0.13634, 0, 0.89544], "71": [0, 0.7, 0.17322, 0, 0.60961], "72": [0, 0.7, 0.29694, 0, 0.96919], "73": [0, 0.7, 0.19189, 0, 0.80907], "74": [0.27778, 0.7, 0.19189, 0, 1.05159], "75": [0, 0.7, 0.31259, 0, 0.91364], "76": [0, 0.7, 0.19189, 0, 0.87373], "77": [0, 0.7, 0.15981, 0, 1.08031], "78": [0, 0.7, 0.3525, 0, 0.9015], "79": [0, 0.7, 0.08078, 0, 0.73787], "80": [0, 0.7, 0.08078, 0, 1.01262], "81": [0, 0.7, 0.03305, 0, 0.88282], "82": [0, 0.7, 0.06259, 0, 0.85], "83": [0, 0.7, 0.19189, 0, 0.86767], "84": [0, 0.7, 0.29087, 0, 0.74697], "85": [0, 0.7, 0.25815, 0, 0.79996], "86": [0, 0.7, 0.27523, 0, 0.62204], "87": [0, 0.7, 0.27523, 0, 0.80532], "88": [0, 0.7, 0.26006, 0, 0.94445], "89": [0, 0.7, 0.2939, 0, 0.70961], "90": [0, 0.7, 0.24037, 0, 0.8212], "160": [0, 0, 0, 0, 0.25] }, "Size1-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.35001, 0.85, 0, 0, 0.45834], "41": [0.35001, 0.85, 0, 0, 0.45834], "47": [0.35001, 0.85, 0, 0, 0.57778], "91": [0.35001, 0.85, 0, 0, 0.41667], "92": [0.35001, 0.85, 0, 0, 0.57778], "93": [0.35001, 0.85, 0, 0, 0.41667], "123": [0.35001, 0.85, 0, 0, 0.58334], "125": [0.35001, 0.85, 0, 0, 0.58334], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.72222, 0, 0, 0.55556], "732": [0, 0.72222, 0, 0, 0.55556], "770": [0, 0.72222, 0, 0, 0.55556], "771": [0, 0.72222, 0, 0, 0.55556], "8214": [-0.00099, 0.601, 0, 0, 0.77778], "8593": [1e-05, 0.6, 0, 0, 0.66667], "8595": [1e-05, 0.6, 0, 0, 0.66667], "8657": [1e-05, 0.6, 0, 0, 0.77778], "8659": [1e-05, 0.6, 0, 0, 0.77778], "8719": [0.25001, 0.75, 0, 0, 0.94445], "8720": [0.25001, 0.75, 0, 0, 0.94445], "8721": [0.25001, 0.75, 0, 0, 1.05556], "8730": [0.35001, 0.85, 0, 0, 1.0], "8739": [-0.00599, 0.606, 0, 0, 0.33333], "8741": [-0.00599, 0.606, 0, 0, 0.55556], "8747": [0.30612, 0.805, 0.19445, 0, 0.47222], "8748": [0.306, 0.805, 0.19445, 0, 0.47222], "8749": [0.306, 0.805, 0.19445, 0, 0.47222], "8750": [0.30612, 0.805, 0.19445, 0, 0.47222], "8896": [0.25001, 0.75, 0, 0, 0.83334], "8897": [0.25001, 0.75, 0, 0, 0.83334], "8898": [0.25001, 0.75, 0, 0, 0.83334], "8899": [0.25001, 0.75, 0, 0, 0.83334], "8968": [0.35001, 0.85, 0, 0, 0.47222], "8969": [0.35001, 0.85, 0, 0, 0.47222], "8970": [0.35001, 0.85, 0, 0, 0.47222], "8971": [0.35001, 0.85, 0, 0, 0.47222], "9168": [-0.00099, 0.601, 0, 0, 0.66667], "10216": [0.35001, 0.85, 0, 0, 0.47222], "10217": [0.35001, 0.85, 0, 0, 0.47222], "10752": [0.25001, 0.75, 0, 0, 1.11111], "10753": [0.25001, 0.75, 0, 0, 1.11111], "10754": [0.25001, 0.75, 0, 0, 1.11111], "10756": [0.25001, 0.75, 0, 0, 0.83334], "10758": [0.25001, 0.75, 0, 0, 0.83334] }, "Size2-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.65002, 1.15, 0, 0, 0.59722], "41": [0.65002, 1.15, 0, 0, 0.59722], "47": [0.65002, 1.15, 0, 0, 0.81111], "91": [0.65002, 1.15, 0, 0, 0.47222], "92": [0.65002, 1.15, 0, 0, 0.81111], "93": [0.65002, 1.15, 0, 0, 0.47222], "123": [0.65002, 1.15, 0, 0, 0.66667], "125": [0.65002, 1.15, 0, 0, 0.66667], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.75, 0, 0, 1.0], "732": [0, 0.75, 0, 0, 1.0], "770": [0, 0.75, 0, 0, 1.0], "771": [0, 0.75, 0, 0, 1.0], "8719": [0.55001, 1.05, 0, 0, 1.27778], "8720": [0.55001, 1.05, 0, 0, 1.27778], "8721": [0.55001, 1.05, 0, 0, 1.44445], "8730": [0.65002, 1.15, 0, 0, 1.0], "8747": [0.86225, 1.36, 0.44445, 0, 0.55556], "8748": [0.862, 1.36, 0.44445, 0, 0.55556], "8749": [0.862, 1.36, 0.44445, 0, 0.55556], "8750": [0.86225, 1.36, 0.44445, 0, 0.55556], "8896": [0.55001, 1.05, 0, 0, 1.11111], "8897": [0.55001, 1.05, 0, 0, 1.11111], "8898": [0.55001, 1.05, 0, 0, 1.11111], "8899": [0.55001, 1.05, 0, 0, 1.11111], "8968": [0.65002, 1.15, 0, 0, 0.52778], "8969": [0.65002, 1.15, 0, 0, 0.52778], "8970": [0.65002, 1.15, 0, 0, 0.52778], "8971": [0.65002, 1.15, 0, 0, 0.52778], "10216": [0.65002, 1.15, 0, 0, 0.61111], "10217": [0.65002, 1.15, 0, 0, 0.61111], "10752": [0.55001, 1.05, 0, 0, 1.51112], "10753": [0.55001, 1.05, 0, 0, 1.51112], "10754": [0.55001, 1.05, 0, 0, 1.51112], "10756": [0.55001, 1.05, 0, 0, 1.11111], "10758": [0.55001, 1.05, 0, 0, 1.11111] }, "Size3-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.95003, 1.45, 0, 0, 0.73611], "41": [0.95003, 1.45, 0, 0, 0.73611], "47": [0.95003, 1.45, 0, 0, 1.04445], "91": [0.95003, 1.45, 0, 0, 0.52778], "92": [0.95003, 1.45, 0, 0, 1.04445], "93": [0.95003, 1.45, 0, 0, 0.52778], "123": [0.95003, 1.45, 0, 0, 0.75], "125": [0.95003, 1.45, 0, 0, 0.75], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.75, 0, 0, 1.44445], "732": [0, 0.75, 0, 0, 1.44445], "770": [0, 0.75, 0, 0, 1.44445], "771": [0, 0.75, 0, 0, 1.44445], "8730": [0.95003, 1.45, 0, 0, 1.0], "8968": [0.95003, 1.45, 0, 0, 0.58334], "8969": [0.95003, 1.45, 0, 0, 0.58334], "8970": [0.95003, 1.45, 0, 0, 0.58334], "8971": [0.95003, 1.45, 0, 0, 0.58334], "10216": [0.95003, 1.45, 0, 0, 0.75], "10217": [0.95003, 1.45, 0, 0, 0.75] }, "Size4-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [1.25003, 1.75, 0, 0, 0.79167], "41": [1.25003, 1.75, 0, 0, 0.79167], "47": [1.25003, 1.75, 0, 0, 1.27778], "91": [1.25003, 1.75, 0, 0, 0.58334], "92": [1.25003, 1.75, 0, 0, 1.27778], "93": [1.25003, 1.75, 0, 0, 0.58334], "123": [1.25003, 1.75, 0, 0, 0.80556], "125": [1.25003, 1.75, 0, 0, 0.80556], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.825, 0, 0, 1.8889], "732": [0, 0.825, 0, 0, 1.8889], "770": [0, 0.825, 0, 0, 1.8889], "771": [0, 0.825, 0, 0, 1.8889], "8730": [1.25003, 1.75, 0, 0, 1.0], "8968": [1.25003, 1.75, 0, 0, 0.63889], "8969": [1.25003, 1.75, 0, 0, 0.63889], "8970": [1.25003, 1.75, 0, 0, 0.63889], "8971": [1.25003, 1.75, 0, 0, 0.63889], "9115": [0.64502, 1.155, 0, 0, 0.875], "9116": [1e-05, 0.6, 0, 0, 0.875], "9117": [0.64502, 1.155, 0, 0, 0.875], "9118": [0.64502, 1.155, 0, 0, 0.875], "9119": [1e-05, 0.6, 0, 0, 0.875], "9120": [0.64502, 1.155, 0, 0, 0.875], "9121": [0.64502, 1.155, 0, 0, 0.66667], "9122": [-0.00099, 0.601, 0, 0, 0.66667], "9123": [0.64502, 1.155, 0, 0, 0.66667], "9124": [0.64502, 1.155, 0, 0, 0.66667], "9125": [-0.00099, 0.601, 0, 0, 0.66667], "9126": [0.64502, 1.155, 0, 0, 0.66667], "9127": [1e-05, 0.9, 0, 0, 0.88889], "9128": [0.65002, 1.15, 0, 0, 0.88889], "9129": [0.90001, 0, 0, 0, 0.88889], "9130": [0, 0.3, 0, 0, 0.88889], "9131": [1e-05, 0.9, 0, 0, 0.88889], "9132": [0.65002, 1.15, 0, 0, 0.88889], "9133": [0.90001, 0, 0, 0, 0.88889], "9143": [0.88502, 0.915, 0, 0, 1.05556], "10216": [1.25003, 1.75, 0, 0, 0.80556], "10217": [1.25003, 1.75, 0, 0, 0.80556], "57344": [-0.00499, 0.605, 0, 0, 1.05556], "57345": [-0.00499, 0.605, 0, 0, 1.05556], "57680": [0, 0.12, 0, 0, 0.45], "57681": [0, 0.12, 0, 0, 0.45], "57682": [0, 0.12, 0, 0, 0.45], "57683": [0, 0.12, 0, 0, 0.45] }, "Typewriter-Regular": { "32": [0, 0, 0, 0, 0.525], "33": [0, 0.61111, 0, 0, 0.525], "34": [0, 0.61111, 0, 0, 0.525], "35": [0, 0.61111, 0, 0, 0.525], "36": [0.08333, 0.69444, 0, 0, 0.525], "37": [0.08333, 0.69444, 0, 0, 0.525], "38": [0, 0.61111, 0, 0, 0.525], "39": [0, 0.61111, 0, 0, 0.525], "40": [0.08333, 0.69444, 0, 0, 0.525], "41": [0.08333, 0.69444, 0, 0, 0.525], "42": [0, 0.52083, 0, 0, 0.525], "43": [-0.08056, 0.53055, 0, 0, 0.525], "44": [0.13889, 0.125, 0, 0, 0.525], "45": [-0.08056, 0.53055, 0, 0, 0.525], "46": [0, 0.125, 0, 0, 0.525], "47": [0.08333, 0.69444, 0, 0, 0.525], "48": [0, 0.61111, 0, 0, 0.525], "49": [0, 0.61111, 0, 0, 0.525], "50": [0, 0.61111, 0, 0, 0.525], "51": [0, 0.61111, 0, 0, 0.525], "52": [0, 0.61111, 0, 0, 0.525], "53": [0, 0.61111, 0, 0, 0.525], "54": [0, 0.61111, 0, 0, 0.525], "55": [0, 0.61111, 0, 0, 0.525], "56": [0, 0.61111, 0, 0, 0.525], "57": [0, 0.61111, 0, 0, 0.525], "58": [0, 0.43056, 0, 0, 0.525], "59": [0.13889, 0.43056, 0, 0, 0.525], "60": [-0.05556, 0.55556, 0, 0, 0.525], "61": [-0.19549, 0.41562, 0, 0, 0.525], "62": [-0.05556, 0.55556, 0, 0, 0.525], "63": [0, 0.61111, 0, 0, 0.525], "64": [0, 0.61111, 0, 0, 0.525], "65": [0, 0.61111, 0, 0, 0.525], "66": [0, 0.61111, 0, 0, 0.525], "67": [0, 0.61111, 0, 0, 0.525], "68": [0, 0.61111, 0, 0, 0.525], "69": [0, 0.61111, 0, 0, 0.525], "70": [0, 0.61111, 0, 0, 0.525], "71": [0, 0.61111, 0, 0, 0.525], "72": [0, 0.61111, 0, 0, 0.525], "73": [0, 0.61111, 0, 0, 0.525], "74": [0, 0.61111, 0, 0, 0.525], "75": [0, 0.61111, 0, 0, 0.525], "76": [0, 0.61111, 0, 0, 0.525], "77": [0, 0.61111, 0, 0, 0.525], "78": [0, 0.61111, 0, 0, 0.525], "79": [0, 0.61111, 0, 0, 0.525], "80": [0, 0.61111, 0, 0, 0.525], "81": [0.13889, 0.61111, 0, 0, 0.525], "82": [0, 0.61111, 0, 0, 0.525], "83": [0, 0.61111, 0, 0, 0.525], "84": [0, 0.61111, 0, 0, 0.525], "85": [0, 0.61111, 0, 0, 0.525], "86": [0, 0.61111, 0, 0, 0.525], "87": [0, 0.61111, 0, 0, 0.525], "88": [0, 0.61111, 0, 0, 0.525], "89": [0, 0.61111, 0, 0, 0.525], "90": [0, 0.61111, 0, 0, 0.525], "91": [0.08333, 0.69444, 0, 0, 0.525], "92": [0.08333, 0.69444, 0, 0, 0.525], "93": [0.08333, 0.69444, 0, 0, 0.525], "94": [0, 0.61111, 0, 0, 0.525], "95": [0.09514, 0, 0, 0, 0.525], "96": [0, 0.61111, 0, 0, 0.525], "97": [0, 0.43056, 0, 0, 0.525], "98": [0, 0.61111, 0, 0, 0.525], "99": [0, 0.43056, 0, 0, 0.525], "100": [0, 0.61111, 0, 0, 0.525], "101": [0, 0.43056, 0, 0, 0.525], "102": [0, 0.61111, 0, 0, 0.525], "103": [0.22222, 0.43056, 0, 0, 0.525], "104": [0, 0.61111, 0, 0, 0.525], "105": [0, 0.61111, 0, 0, 0.525], "106": [0.22222, 0.61111, 0, 0, 0.525], "107": [0, 0.61111, 0, 0, 0.525], "108": [0, 0.61111, 0, 0, 0.525], "109": [0, 0.43056, 0, 0, 0.525], "110": [0, 0.43056, 0, 0, 0.525], "111": [0, 0.43056, 0, 0, 0.525], "112": [0.22222, 0.43056, 0, 0, 0.525], "113": [0.22222, 0.43056, 0, 0, 0.525], "114": [0, 0.43056, 0, 0, 0.525], "115": [0, 0.43056, 0, 0, 0.525], "116": [0, 0.55358, 0, 0, 0.525], "117": [0, 0.43056, 0, 0, 0.525], "118": [0, 0.43056, 0, 0, 0.525], "119": [0, 0.43056, 0, 0, 0.525], "120": [0, 0.43056, 0, 0, 0.525], "121": [0.22222, 0.43056, 0, 0, 0.525], "122": [0, 0.43056, 0, 0, 0.525], "123": [0.08333, 0.69444, 0, 0, 0.525], "124": [0.08333, 0.69444, 0, 0, 0.525], "125": [0.08333, 0.69444, 0, 0, 0.525], "126": [0, 0.61111, 0, 0, 0.525], "127": [0, 0.61111, 0, 0, 0.525], "160": [0, 0, 0, 0, 0.525], "176": [0, 0.61111, 0, 0, 0.525], "184": [0.19445, 0, 0, 0, 0.525], "305": [0, 0.43056, 0, 0, 0.525], "567": [0.22222, 0.43056, 0, 0, 0.525], "711": [0, 0.56597, 0, 0, 0.525], "713": [0, 0.56555, 0, 0, 0.525], "714": [0, 0.61111, 0, 0, 0.525], "715": [0, 0.61111, 0, 0, 0.525], "728": [0, 0.61111, 0, 0, 0.525], "730": [0, 0.61111, 0, 0, 0.525], "770": [0, 0.61111, 0, 0, 0.525], "771": [0, 0.61111, 0, 0, 0.525], "776": [0, 0.61111, 0, 0, 0.525], "915": [0, 0.61111, 0, 0, 0.525], "916": [0, 0.61111, 0, 0, 0.525], "920": [0, 0.61111, 0, 0, 0.525], "923": [0, 0.61111, 0, 0, 0.525], "926": [0, 0.61111, 0, 0, 0.525], "928": [0, 0.61111, 0, 0, 0.525], "931": [0, 0.61111, 0, 0, 0.525], "933": [0, 0.61111, 0, 0, 0.525], "934": [0, 0.61111, 0, 0, 0.525], "936": [0, 0.61111, 0, 0, 0.525], "937": [0, 0.61111, 0, 0, 0.525], "8216": [0, 0.61111, 0, 0, 0.525], "8217": [0, 0.61111, 0, 0, 0.525], "8242": [0, 0.61111, 0, 0, 0.525], "9251": [0.11111, 0.21944, 0, 0, 0.525] } }); // CONCATENATED MODULE: ./src/fontMetrics.js /** * This file contains metrics regarding fonts and individual symbols. The sigma * and xi variables, as well as the metricMap map contain data extracted from * TeX, TeX font metrics, and the TTF files. These data are then exposed via the * `metrics` variable and the getCharacterMetrics function. */ // In TeX, there are actually three sets of dimensions, one for each of // textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4: // 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are // provided in the the arrays below, in that order. // // The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively. // This was determined by running the following script: // // latex -interaction=nonstopmode \ // '\documentclass{article}\usepackage{amsmath}\begin{document}' \ // '$a$ \expandafter\show\the\textfont2' \ // '\expandafter\show\the\scriptfont2' \ // '\expandafter\show\the\scriptscriptfont2' \ // '\stop' // // The metrics themselves were retreived using the following commands: // // tftopl cmsy10 // tftopl cmsy7 // tftopl cmsy5 // // The output of each of these commands is quite lengthy. The only part we // care about is the FONTDIMEN section. Each value is measured in EMs. var sigmasAndXis = { slant: [0.250, 0.250, 0.250], // sigma1 space: [0.000, 0.000, 0.000], // sigma2 stretch: [0.000, 0.000, 0.000], // sigma3 shrink: [0.000, 0.000, 0.000], // sigma4 xHeight: [0.431, 0.431, 0.431], // sigma5 quad: [1.000, 1.171, 1.472], // sigma6 extraSpace: [0.000, 0.000, 0.000], // sigma7 num1: [0.677, 0.732, 0.925], // sigma8 num2: [0.394, 0.384, 0.387], // sigma9 num3: [0.444, 0.471, 0.504], // sigma10 denom1: [0.686, 0.752, 1.025], // sigma11 denom2: [0.345, 0.344, 0.532], // sigma12 sup1: [0.413, 0.503, 0.504], // sigma13 sup2: [0.363, 0.431, 0.404], // sigma14 sup3: [0.289, 0.286, 0.294], // sigma15 sub1: [0.150, 0.143, 0.200], // sigma16 sub2: [0.247, 0.286, 0.400], // sigma17 supDrop: [0.386, 0.353, 0.494], // sigma18 subDrop: [0.050, 0.071, 0.100], // sigma19 delim1: [2.390, 1.700, 1.980], // sigma20 delim2: [1.010, 1.157, 1.420], // sigma21 axisHeight: [0.250, 0.250, 0.250], // sigma22 // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; // they correspond to the font parameters of the extension fonts (family 3). // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to // match cmex7, we'd use cmex7.tfm values for script and scriptscript // values. defaultRuleThickness: [0.04, 0.049, 0.049], // xi8; cmex7: 0.049 bigOpSpacing1: [0.111, 0.111, 0.111], // xi9 bigOpSpacing2: [0.166, 0.166, 0.166], // xi10 bigOpSpacing3: [0.2, 0.2, 0.2], // xi11 bigOpSpacing4: [0.6, 0.611, 0.611], // xi12; cmex7: 0.611 bigOpSpacing5: [0.1, 0.143, 0.143], // xi13; cmex7: 0.143 // The \sqrt rule width is taken from the height of the surd character. // Since we use the same font at all sizes, this thickness doesn't scale. sqrtRuleThickness: [0.04, 0.04, 0.04], // This value determines how large a pt is, for metrics which are defined // in terms of pts. // This value is also used in katex.less; if you change it make sure the // values match. ptPerEm: [10.0, 10.0, 10.0], // The space between adjacent `|` columns in an array definition. From // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. doubleRuleSep: [0.2, 0.2, 0.2], // The width of separator lines in {array} environments. From // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm. arrayRuleWidth: [0.04, 0.04, 0.04], // Two values from LaTeX source2e: fboxsep: [0.3, 0.3, 0.3], // 3 pt / ptPerEm fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm }; // This map contains a mapping from font name and character code to character // metrics, including height, depth, italic correction, and skew (kern from the // character to the corresponding \skewchar) // This map is generated via `make metrics`. It should not be changed manually. // These are very rough approximations. We default to Times New Roman which // should have Latin-1 and Cyrillic characters, but may not depending on the // operating system. The metrics do not account for extra height from the // accents. In the case of Cyrillic characters which have both ascenders and // descenders we prefer approximations with ascenders, primarily to prevent // the fraction bar or root line from intersecting the glyph. // TODO(kevinb) allow union of multiple glyph metrics for better accuracy. var extraCharacterMap = { // Latin-1 'Å': 'A', 'Ç': 'C', 'Ð': 'D', 'Þ': 'o', 'å': 'a', 'ç': 'c', 'ð': 'd', 'þ': 'o', // Cyrillic 'А': 'A', 'Б': 'B', 'В': 'B', 'Г': 'F', 'Д': 'A', 'Е': 'E', 'Ж': 'K', 'З': '3', 'И': 'N', 'Й': 'N', 'К': 'K', 'Л': 'N', 'М': 'M', 'Н': 'H', 'О': 'O', 'П': 'N', 'Р': 'P', 'С': 'C', 'Т': 'T', 'У': 'y', 'Ф': 'O', 'Х': 'X', 'Ц': 'U', 'Ч': 'h', 'Ш': 'W', 'Щ': 'W', 'Ъ': 'B', 'Ы': 'X', 'Ь': 'B', 'Э': '3', 'Ю': 'X', 'Я': 'R', 'а': 'a', 'б': 'b', 'в': 'a', 'г': 'r', 'д': 'y', 'е': 'e', 'ж': 'm', 'з': 'e', 'и': 'n', 'й': 'n', 'к': 'n', 'л': 'n', 'м': 'm', 'н': 'n', 'о': 'o', 'п': 'n', 'р': 'p', 'с': 'c', 'т': 'o', 'у': 'y', 'ф': 'b', 'х': 'x', 'ц': 'n', 'ч': 'n', 'ш': 'w', 'щ': 'w', 'ъ': 'a', 'ы': 'm', 'ь': 'a', 'э': 'e', 'ю': 'm', 'я': 'r' }; /** * This function adds new font metrics to default metricMap * It can also override existing metrics */ function setFontMetrics(fontName, metrics) { fontMetricsData[fontName] = metrics; } /** * This function is a convenience function for looking up information in the * metricMap table. It takes a character as a string, and a font. * * Note: the `width` property may be undefined if fontMetricsData.js wasn't * built using `Make extended_metrics`. */ function getCharacterMetrics(character, font, mode) { if (!fontMetricsData[font]) { throw new Error("Font metrics not found for font: " + font + "."); } var ch = character.charCodeAt(0); var metrics = fontMetricsData[font][ch]; if (!metrics && character[0] in extraCharacterMap) { ch = extraCharacterMap[character[0]].charCodeAt(0); metrics = fontMetricsData[font][ch]; } if (!metrics && mode === 'text') { // We don't typically have font metrics for Asian scripts. // But since we support them in text mode, we need to return // some sort of metrics. // So if the character is in a script we support but we // don't have metrics for it, just use the metrics for // the Latin capital letter M. This is close enough because // we (currently) only care about the height of the glpyh // not its width. if (supportedCodepoint(ch)) { metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M' } } if (metrics) { return { depth: metrics[0], height: metrics[1], italic: metrics[2], skew: metrics[3], width: metrics[4] }; } } var fontMetricsBySizeIndex = {}; /** * Get the font metrics for a given size. */ function getGlobalMetrics(size) { var sizeIndex; if (size >= 5) { sizeIndex = 0; } else if (size >= 3) { sizeIndex = 1; } else { sizeIndex = 2; } if (!fontMetricsBySizeIndex[sizeIndex]) { var metrics = fontMetricsBySizeIndex[sizeIndex] = { cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 }; for (var key in sigmasAndXis) { if (sigmasAndXis.hasOwnProperty(key)) { metrics[key] = sigmasAndXis[key][sizeIndex]; } } } return fontMetricsBySizeIndex[sizeIndex]; } // CONCATENATED MODULE: ./src/symbols.js /** * This file holds a list of all no-argument functions and single-character * symbols (like 'a' or ';'). * * For each of the symbols, there are three properties they can have: * - font (required): the font to be used for this symbol. Either "main" (the normal font), or "ams" (the ams fonts). * - group (required): the ParseNode group type the symbol should have (i.e. "textord", "mathord", etc). See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types * - replace: the character that this symbol or function should be * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi * character in the main font). * * The outermost map in the table indicates what mode the symbols should be * accepted in (e.g. "math" or "text"). */ // Some of these have a "-token" suffix since these are also used as `ParseNode` // types for raw text tokens, and we want to avoid conflicts with higher-level // `ParseNode` types. These `ParseNode`s are constructed within `Parser` by // looking up the `symbols` map. var ATOMS = { "bin": 1, "close": 1, "inner": 1, "open": 1, "punct": 1, "rel": 1 }; var NON_ATOMS = { "accent-token": 1, "mathord": 1, "op-token": 1, "spacing": 1, "textord": 1 }; var symbols = { "math": {}, "text": {} }; /* harmony default export */ var src_symbols = (symbols); /** `acceptUnicodeChar = true` is only applicable if `replace` is set. */ function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { symbols[mode][name] = { font: font, group: group, replace: replace }; if (acceptUnicodeChar && replace) { symbols[mode][replace] = symbols[mode][name]; } } // Some abbreviations for commonly used strings. // This helps minify the code, and also spotting typos using jshint. // modes: var symbols_math = "math"; var symbols_text = "text"; // fonts: var main = "main"; var ams = "ams"; // groups: var symbols_accent = "accent-token"; var bin = "bin"; var symbols_close = "close"; var symbols_inner = "inner"; var mathord = "mathord"; var op = "op-token"; var symbols_open = "open"; var punct = "punct"; var rel = "rel"; var symbols_spacing = "spacing"; var symbols_textord = "textord"; // Now comes the symbol table // Relation Symbols defineSymbol(symbols_math, main, rel, "\u2261", "\\equiv", true); defineSymbol(symbols_math, main, rel, "\u227A", "\\prec", true); defineSymbol(symbols_math, main, rel, "\u227B", "\\succ", true); defineSymbol(symbols_math, main, rel, "\u223C", "\\sim", true); defineSymbol(symbols_math, main, rel, "\u22A5", "\\perp"); defineSymbol(symbols_math, main, rel, "\u2AAF", "\\preceq", true); defineSymbol(symbols_math, main, rel, "\u2AB0", "\\succeq", true); defineSymbol(symbols_math, main, rel, "\u2243", "\\simeq", true); defineSymbol(symbols_math, main, rel, "\u2223", "\\mid", true); defineSymbol(symbols_math, main, rel, "\u226A", "\\ll", true); defineSymbol(symbols_math, main, rel, "\u226B", "\\gg", true); defineSymbol(symbols_math, main, rel, "\u224D", "\\asymp", true); defineSymbol(symbols_math, main, rel, "\u2225", "\\parallel"); defineSymbol(symbols_math, main, rel, "\u22C8", "\\bowtie", true); defineSymbol(symbols_math, main, rel, "\u2323", "\\smile", true); defineSymbol(symbols_math, main, rel, "\u2291", "\\sqsubseteq", true); defineSymbol(symbols_math, main, rel, "\u2292", "\\sqsupseteq", true); defineSymbol(symbols_math, main, rel, "\u2250", "\\doteq", true); defineSymbol(symbols_math, main, rel, "\u2322", "\\frown", true); defineSymbol(symbols_math, main, rel, "\u220B", "\\ni", true); defineSymbol(symbols_math, main, rel, "\u221D", "\\propto", true); defineSymbol(symbols_math, main, rel, "\u22A2", "\\vdash", true); defineSymbol(symbols_math, main, rel, "\u22A3", "\\dashv", true); defineSymbol(symbols_math, main, rel, "\u220B", "\\owns"); // Punctuation defineSymbol(symbols_math, main, punct, ".", "\\ldotp"); defineSymbol(symbols_math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols defineSymbol(symbols_math, main, symbols_textord, "#", "\\#"); defineSymbol(symbols_text, main, symbols_textord, "#", "\\#"); defineSymbol(symbols_math, main, symbols_textord, "&", "\\&"); defineSymbol(symbols_text, main, symbols_textord, "&", "\\&"); defineSymbol(symbols_math, main, symbols_textord, "\u2135", "\\aleph", true); defineSymbol(symbols_math, main, symbols_textord, "\u2200", "\\forall", true); defineSymbol(symbols_math, main, symbols_textord, "\u210F", "\\hbar", true); defineSymbol(symbols_math, main, symbols_textord, "\u2203", "\\exists", true); defineSymbol(symbols_math, main, symbols_textord, "\u2207", "\\nabla", true); defineSymbol(symbols_math, main, symbols_textord, "\u266D", "\\flat", true); defineSymbol(symbols_math, main, symbols_textord, "\u2113", "\\ell", true); defineSymbol(symbols_math, main, symbols_textord, "\u266E", "\\natural", true); defineSymbol(symbols_math, main, symbols_textord, "\u2663", "\\clubsuit", true); defineSymbol(symbols_math, main, symbols_textord, "\u2118", "\\wp", true); defineSymbol(symbols_math, main, symbols_textord, "\u266F", "\\sharp", true); defineSymbol(symbols_math, main, symbols_textord, "\u2662", "\\diamondsuit", true); defineSymbol(symbols_math, main, symbols_textord, "\u211C", "\\Re", true); defineSymbol(symbols_math, main, symbols_textord, "\u2661", "\\heartsuit", true); defineSymbol(symbols_math, main, symbols_textord, "\u2111", "\\Im", true); defineSymbol(symbols_math, main, symbols_textord, "\u2660", "\\spadesuit", true); defineSymbol(symbols_text, main, symbols_textord, "\xA7", "\\S", true); defineSymbol(symbols_text, main, symbols_textord, "\xB6", "\\P", true); // Math and Text defineSymbol(symbols_math, main, symbols_textord, "\u2020", "\\dag"); defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\dag"); defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\textdagger"); defineSymbol(symbols_math, main, symbols_textord, "\u2021", "\\ddag"); defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\ddag"); defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters defineSymbol(symbols_math, main, symbols_close, "\u23B1", "\\rmoustache", true); defineSymbol(symbols_math, main, symbols_open, "\u23B0", "\\lmoustache", true); defineSymbol(symbols_math, main, symbols_close, "\u27EF", "\\rgroup", true); defineSymbol(symbols_math, main, symbols_open, "\u27EE", "\\lgroup", true); // Binary Operators defineSymbol(symbols_math, main, bin, "\u2213", "\\mp", true); defineSymbol(symbols_math, main, bin, "\u2296", "\\ominus", true); defineSymbol(symbols_math, main, bin, "\u228E", "\\uplus", true); defineSymbol(symbols_math, main, bin, "\u2293", "\\sqcap", true); defineSymbol(symbols_math, main, bin, "\u2217", "\\ast"); defineSymbol(symbols_math, main, bin, "\u2294", "\\sqcup", true); defineSymbol(symbols_math, main, bin, "\u25EF", "\\bigcirc"); defineSymbol(symbols_math, main, bin, "\u2219", "\\bullet"); defineSymbol(symbols_math, main, bin, "\u2021", "\\ddagger"); defineSymbol(symbols_math, main, bin, "\u2240", "\\wr", true); defineSymbol(symbols_math, main, bin, "\u2A3F", "\\amalg"); defineSymbol(symbols_math, main, bin, "&", "\\And"); // from amsmath // Arrow Symbols defineSymbol(symbols_math, main, rel, "\u27F5", "\\longleftarrow", true); defineSymbol(symbols_math, main, rel, "\u21D0", "\\Leftarrow", true); defineSymbol(symbols_math, main, rel, "\u27F8", "\\Longleftarrow", true); defineSymbol(symbols_math, main, rel, "\u27F6", "\\longrightarrow", true); defineSymbol(symbols_math, main, rel, "\u21D2", "\\Rightarrow", true); defineSymbol(symbols_math, main, rel, "\u27F9", "\\Longrightarrow", true); defineSymbol(symbols_math, main, rel, "\u2194", "\\leftrightarrow", true); defineSymbol(symbols_math, main, rel, "\u27F7", "\\longleftrightarrow", true); defineSymbol(symbols_math, main, rel, "\u21D4", "\\Leftrightarrow", true); defineSymbol(symbols_math, main, rel, "\u27FA", "\\Longleftrightarrow", true); defineSymbol(symbols_math, main, rel, "\u21A6", "\\mapsto", true); defineSymbol(symbols_math, main, rel, "\u27FC", "\\longmapsto", true); defineSymbol(symbols_math, main, rel, "\u2197", "\\nearrow", true); defineSymbol(symbols_math, main, rel, "\u21A9", "\\hookleftarrow", true); defineSymbol(symbols_math, main, rel, "\u21AA", "\\hookrightarrow", true); defineSymbol(symbols_math, main, rel, "\u2198", "\\searrow", true); defineSymbol(symbols_math, main, rel, "\u21BC", "\\leftharpoonup", true); defineSymbol(symbols_math, main, rel, "\u21C0", "\\rightharpoonup", true); defineSymbol(symbols_math, main, rel, "\u2199", "\\swarrow", true); defineSymbol(symbols_math, main, rel, "\u21BD", "\\leftharpoondown", true); defineSymbol(symbols_math, main, rel, "\u21C1", "\\rightharpoondown", true); defineSymbol(symbols_math, main, rel, "\u2196", "\\nwarrow", true); defineSymbol(symbols_math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations defineSymbol(symbols_math, ams, rel, "\u226E", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro. defineSymbol(symbols_math, ams, rel, "\uE010", "\\@nleqslant"); defineSymbol(symbols_math, ams, rel, "\uE011", "\\@nleqq"); defineSymbol(symbols_math, ams, rel, "\u2A87", "\\lneq", true); defineSymbol(symbols_math, ams, rel, "\u2268", "\\lneqq", true); defineSymbol(symbols_math, ams, rel, "\uE00C", "\\@lvertneqq"); defineSymbol(symbols_math, ams, rel, "\u22E6", "\\lnsim", true); defineSymbol(symbols_math, ams, rel, "\u2A89", "\\lnapprox", true); defineSymbol(symbols_math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u22E0", "\\npreceq", true); defineSymbol(symbols_math, ams, rel, "\u22E8", "\\precnsim", true); defineSymbol(symbols_math, ams, rel, "\u2AB9", "\\precnapprox", true); defineSymbol(symbols_math, ams, rel, "\u2241", "\\nsim", true); defineSymbol(symbols_math, ams, rel, "\uE006", "\\@nshortmid"); defineSymbol(symbols_math, ams, rel, "\u2224", "\\nmid", true); defineSymbol(symbols_math, ams, rel, "\u22AC", "\\nvdash", true); defineSymbol(symbols_math, ams, rel, "\u22AD", "\\nvDash", true); defineSymbol(symbols_math, ams, rel, "\u22EA", "\\ntriangleleft"); defineSymbol(symbols_math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); defineSymbol(symbols_math, ams, rel, "\u228A", "\\subsetneq", true); defineSymbol(symbols_math, ams, rel, "\uE01A", "\\@varsubsetneq"); defineSymbol(symbols_math, ams, rel, "\u2ACB", "\\subsetneqq", true); defineSymbol(symbols_math, ams, rel, "\uE017", "\\@varsubsetneqq"); defineSymbol(symbols_math, ams, rel, "\u226F", "\\ngtr", true); defineSymbol(symbols_math, ams, rel, "\uE00F", "\\@ngeqslant"); defineSymbol(symbols_math, ams, rel, "\uE00E", "\\@ngeqq"); defineSymbol(symbols_math, ams, rel, "\u2A88", "\\gneq", true); defineSymbol(symbols_math, ams, rel, "\u2269", "\\gneqq", true); defineSymbol(symbols_math, ams, rel, "\uE00D", "\\@gvertneqq"); defineSymbol(symbols_math, ams, rel, "\u22E7", "\\gnsim", true); defineSymbol(symbols_math, ams, rel, "\u2A8A", "\\gnapprox", true); defineSymbol(symbols_math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u22E1", "\\nsucceq", true); defineSymbol(symbols_math, ams, rel, "\u22E9", "\\succnsim", true); defineSymbol(symbols_math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u2246", "\\ncong", true); defineSymbol(symbols_math, ams, rel, "\uE007", "\\@nshortparallel"); defineSymbol(symbols_math, ams, rel, "\u2226", "\\nparallel", true); defineSymbol(symbols_math, ams, rel, "\u22AF", "\\nVDash", true); defineSymbol(symbols_math, ams, rel, "\u22EB", "\\ntriangleright"); defineSymbol(symbols_math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); defineSymbol(symbols_math, ams, rel, "\uE018", "\\@nsupseteqq"); defineSymbol(symbols_math, ams, rel, "\u228B", "\\supsetneq", true); defineSymbol(symbols_math, ams, rel, "\uE01B", "\\@varsupsetneq"); defineSymbol(symbols_math, ams, rel, "\u2ACC", "\\supsetneqq", true); defineSymbol(symbols_math, ams, rel, "\uE019", "\\@varsupsetneqq"); defineSymbol(symbols_math, ams, rel, "\u22AE", "\\nVdash", true); defineSymbol(symbols_math, ams, rel, "\u2AB5", "\\precneqq", true); defineSymbol(symbols_math, ams, rel, "\u2AB6", "\\succneqq", true); defineSymbol(symbols_math, ams, rel, "\uE016", "\\@nsubseteqq"); defineSymbol(symbols_math, ams, bin, "\u22B4", "\\unlhd"); defineSymbol(symbols_math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows defineSymbol(symbols_math, ams, rel, "\u219A", "\\nleftarrow", true); defineSymbol(symbols_math, ams, rel, "\u219B", "\\nrightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21CD", "\\nLeftarrow", true); defineSymbol(symbols_math, ams, rel, "\u21CF", "\\nRightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21AE", "\\nleftrightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc defineSymbol(symbols_math, ams, rel, "\u25B3", "\\vartriangle"); defineSymbol(symbols_math, ams, symbols_textord, "\u210F", "\\hslash"); defineSymbol(symbols_math, ams, symbols_textord, "\u25BD", "\\triangledown"); defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\lozenge"); defineSymbol(symbols_math, ams, symbols_textord, "\u24C8", "\\circledS"); defineSymbol(symbols_math, ams, symbols_textord, "\xAE", "\\circledR"); defineSymbol(symbols_text, ams, symbols_textord, "\xAE", "\\circledR"); defineSymbol(symbols_math, ams, symbols_textord, "\u2221", "\\measuredangle", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2204", "\\nexists"); defineSymbol(symbols_math, ams, symbols_textord, "\u2127", "\\mho"); defineSymbol(symbols_math, ams, symbols_textord, "\u2132", "\\Finv", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2141", "\\Game", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2035", "\\backprime"); defineSymbol(symbols_math, ams, symbols_textord, "\u25B2", "\\blacktriangle"); defineSymbol(symbols_math, ams, symbols_textord, "\u25BC", "\\blacktriangledown"); defineSymbol(symbols_math, ams, symbols_textord, "\u25A0", "\\blacksquare"); defineSymbol(symbols_math, ams, symbols_textord, "\u29EB", "\\blacklozenge"); defineSymbol(symbols_math, ams, symbols_textord, "\u2605", "\\bigstar"); defineSymbol(symbols_math, ams, symbols_textord, "\u2222", "\\sphericalangle", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 to \matheth. We map to AMS function \eth defineSymbol(symbols_math, ams, symbols_textord, "\xF0", "\\eth", true); defineSymbol(symbols_text, main, symbols_textord, "\xF0", "\xF0"); defineSymbol(symbols_math, ams, symbols_textord, "\u2571", "\\diagup"); defineSymbol(symbols_math, ams, symbols_textord, "\u2572", "\\diagdown"); defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\square"); defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\Box"); defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen defineSymbol(symbols_math, ams, symbols_textord, "\xA5", "\\yen", true); defineSymbol(symbols_text, ams, symbols_textord, "\xA5", "\\yen", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2713", "\\checkmark", true); defineSymbol(symbols_text, ams, symbols_textord, "\u2713", "\\checkmark"); // AMS Hebrew defineSymbol(symbols_math, ams, symbols_textord, "\u2136", "\\beth", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2138", "\\daleth", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2137", "\\gimel", true); // AMS Greek defineSymbol(symbols_math, ams, symbols_textord, "\u03DD", "\\digamma", true); defineSymbol(symbols_math, ams, symbols_textord, "\u03F0", "\\varkappa"); // AMS Delimiters defineSymbol(symbols_math, ams, symbols_open, "\u250C", "\\@ulcorner", true); defineSymbol(symbols_math, ams, symbols_close, "\u2510", "\\@urcorner", true); defineSymbol(symbols_math, ams, symbols_open, "\u2514", "\\@llcorner", true); defineSymbol(symbols_math, ams, symbols_close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations defineSymbol(symbols_math, ams, rel, "\u2266", "\\leqq", true); defineSymbol(symbols_math, ams, rel, "\u2A7D", "\\leqslant", true); defineSymbol(symbols_math, ams, rel, "\u2A95", "\\eqslantless", true); defineSymbol(symbols_math, ams, rel, "\u2272", "\\lesssim", true); defineSymbol(symbols_math, ams, rel, "\u2A85", "\\lessapprox", true); defineSymbol(symbols_math, ams, rel, "\u224A", "\\approxeq", true); defineSymbol(symbols_math, ams, bin, "\u22D6", "\\lessdot"); defineSymbol(symbols_math, ams, rel, "\u22D8", "\\lll", true); defineSymbol(symbols_math, ams, rel, "\u2276", "\\lessgtr", true); defineSymbol(symbols_math, ams, rel, "\u22DA", "\\lesseqgtr", true); defineSymbol(symbols_math, ams, rel, "\u2A8B", "\\lesseqqgtr", true); defineSymbol(symbols_math, ams, rel, "\u2251", "\\doteqdot"); defineSymbol(symbols_math, ams, rel, "\u2253", "\\risingdotseq", true); defineSymbol(symbols_math, ams, rel, "\u2252", "\\fallingdotseq", true); defineSymbol(symbols_math, ams, rel, "\u223D", "\\backsim", true); defineSymbol(symbols_math, ams, rel, "\u22CD", "\\backsimeq", true); defineSymbol(symbols_math, ams, rel, "\u2AC5", "\\subseteqq", true); defineSymbol(symbols_math, ams, rel, "\u22D0", "\\Subset", true); defineSymbol(symbols_math, ams, rel, "\u228F", "\\sqsubset", true); defineSymbol(symbols_math, ams, rel, "\u227C", "\\preccurlyeq", true); defineSymbol(symbols_math, ams, rel, "\u22DE", "\\curlyeqprec", true); defineSymbol(symbols_math, ams, rel, "\u227E", "\\precsim", true); defineSymbol(symbols_math, ams, rel, "\u2AB7", "\\precapprox", true); defineSymbol(symbols_math, ams, rel, "\u22B2", "\\vartriangleleft"); defineSymbol(symbols_math, ams, rel, "\u22B4", "\\trianglelefteq"); defineSymbol(symbols_math, ams, rel, "\u22A8", "\\vDash", true); defineSymbol(symbols_math, ams, rel, "\u22AA", "\\Vvdash", true); defineSymbol(symbols_math, ams, rel, "\u2323", "\\smallsmile"); defineSymbol(symbols_math, ams, rel, "\u2322", "\\smallfrown"); defineSymbol(symbols_math, ams, rel, "\u224F", "\\bumpeq", true); defineSymbol(symbols_math, ams, rel, "\u224E", "\\Bumpeq", true); defineSymbol(symbols_math, ams, rel, "\u2267", "\\geqq", true); defineSymbol(symbols_math, ams, rel, "\u2A7E", "\\geqslant", true); defineSymbol(symbols_math, ams, rel, "\u2A96", "\\eqslantgtr", true); defineSymbol(symbols_math, ams, rel, "\u2273", "\\gtrsim", true); defineSymbol(symbols_math, ams, rel, "\u2A86", "\\gtrapprox", true); defineSymbol(symbols_math, ams, bin, "\u22D7", "\\gtrdot"); defineSymbol(symbols_math, ams, rel, "\u22D9", "\\ggg", true); defineSymbol(symbols_math, ams, rel, "\u2277", "\\gtrless", true); defineSymbol(symbols_math, ams, rel, "\u22DB", "\\gtreqless", true); defineSymbol(symbols_math, ams, rel, "\u2A8C", "\\gtreqqless", true); defineSymbol(symbols_math, ams, rel, "\u2256", "\\eqcirc", true); defineSymbol(symbols_math, ams, rel, "\u2257", "\\circeq", true); defineSymbol(symbols_math, ams, rel, "\u225C", "\\triangleq", true); defineSymbol(symbols_math, ams, rel, "\u223C", "\\thicksim"); defineSymbol(symbols_math, ams, rel, "\u2248", "\\thickapprox"); defineSymbol(symbols_math, ams, rel, "\u2AC6", "\\supseteqq", true); defineSymbol(symbols_math, ams, rel, "\u22D1", "\\Supset", true); defineSymbol(symbols_math, ams, rel, "\u2290", "\\sqsupset", true); defineSymbol(symbols_math, ams, rel, "\u227D", "\\succcurlyeq", true); defineSymbol(symbols_math, ams, rel, "\u22DF", "\\curlyeqsucc", true); defineSymbol(symbols_math, ams, rel, "\u227F", "\\succsim", true); defineSymbol(symbols_math, ams, rel, "\u2AB8", "\\succapprox", true); defineSymbol(symbols_math, ams, rel, "\u22B3", "\\vartriangleright"); defineSymbol(symbols_math, ams, rel, "\u22B5", "\\trianglerighteq"); defineSymbol(symbols_math, ams, rel, "\u22A9", "\\Vdash", true); defineSymbol(symbols_math, ams, rel, "\u2223", "\\shortmid"); defineSymbol(symbols_math, ams, rel, "\u2225", "\\shortparallel"); defineSymbol(symbols_math, ams, rel, "\u226C", "\\between", true); defineSymbol(symbols_math, ams, rel, "\u22D4", "\\pitchfork", true); defineSymbol(symbols_math, ams, rel, "\u221D", "\\varpropto"); defineSymbol(symbols_math, ams, rel, "\u25C0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom. // We kept the amssymb atom type, which is rel. defineSymbol(symbols_math, ams, rel, "\u2234", "\\therefore", true); defineSymbol(symbols_math, ams, rel, "\u220D", "\\backepsilon"); defineSymbol(symbols_math, ams, rel, "\u25B6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom. // We kept the amssymb atom type, which is rel. defineSymbol(symbols_math, ams, rel, "\u2235", "\\because", true); defineSymbol(symbols_math, ams, rel, "\u22D8", "\\llless"); defineSymbol(symbols_math, ams, rel, "\u22D9", "\\gggtr"); defineSymbol(symbols_math, ams, bin, "\u22B2", "\\lhd"); defineSymbol(symbols_math, ams, bin, "\u22B3", "\\rhd"); defineSymbol(symbols_math, ams, rel, "\u2242", "\\eqsim", true); defineSymbol(symbols_math, main, rel, "\u22C8", "\\Join"); defineSymbol(symbols_math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators defineSymbol(symbols_math, ams, bin, "\u2214", "\\dotplus", true); defineSymbol(symbols_math, ams, bin, "\u2216", "\\smallsetminus"); defineSymbol(symbols_math, ams, bin, "\u22D2", "\\Cap", true); defineSymbol(symbols_math, ams, bin, "\u22D3", "\\Cup", true); defineSymbol(symbols_math, ams, bin, "\u2A5E", "\\doublebarwedge", true); defineSymbol(symbols_math, ams, bin, "\u229F", "\\boxminus", true); defineSymbol(symbols_math, ams, bin, "\u229E", "\\boxplus", true); defineSymbol(symbols_math, ams, bin, "\u22C7", "\\divideontimes", true); defineSymbol(symbols_math, ams, bin, "\u22C9", "\\ltimes", true); defineSymbol(symbols_math, ams, bin, "\u22CA", "\\rtimes", true); defineSymbol(symbols_math, ams, bin, "\u22CB", "\\leftthreetimes", true); defineSymbol(symbols_math, ams, bin, "\u22CC", "\\rightthreetimes", true); defineSymbol(symbols_math, ams, bin, "\u22CF", "\\curlywedge", true); defineSymbol(symbols_math, ams, bin, "\u22CE", "\\curlyvee", true); defineSymbol(symbols_math, ams, bin, "\u229D", "\\circleddash", true); defineSymbol(symbols_math, ams, bin, "\u229B", "\\circledast", true); defineSymbol(symbols_math, ams, bin, "\u22C5", "\\centerdot"); defineSymbol(symbols_math, ams, bin, "\u22BA", "\\intercal", true); defineSymbol(symbols_math, ams, bin, "\u22D2", "\\doublecap"); defineSymbol(symbols_math, ams, bin, "\u22D3", "\\doublecup"); defineSymbol(symbols_math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows // Note: unicode-math maps \u21e2 to their own function \rightdasharrow. // We'll map it to AMS function \dashrightarrow. It produces the same atom. defineSymbol(symbols_math, ams, rel, "\u21E2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u21E0", "\\dashleftarrow", true); defineSymbol(symbols_math, ams, rel, "\u21C7", "\\leftleftarrows", true); defineSymbol(symbols_math, ams, rel, "\u21C6", "\\leftrightarrows", true); defineSymbol(symbols_math, ams, rel, "\u21DA", "\\Lleftarrow", true); defineSymbol(symbols_math, ams, rel, "\u219E", "\\twoheadleftarrow", true); defineSymbol(symbols_math, ams, rel, "\u21A2", "\\leftarrowtail", true); defineSymbol(symbols_math, ams, rel, "\u21AB", "\\looparrowleft", true); defineSymbol(symbols_math, ams, rel, "\u21CB", "\\leftrightharpoons", true); defineSymbol(symbols_math, ams, rel, "\u21B6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u21BA", "\\circlearrowleft", true); defineSymbol(symbols_math, ams, rel, "\u21B0", "\\Lsh", true); defineSymbol(symbols_math, ams, rel, "\u21C8", "\\upuparrows", true); defineSymbol(symbols_math, ams, rel, "\u21BF", "\\upharpoonleft", true); defineSymbol(symbols_math, ams, rel, "\u21C3", "\\downharpoonleft", true); defineSymbol(symbols_math, ams, rel, "\u22B8", "\\multimap", true); defineSymbol(symbols_math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); defineSymbol(symbols_math, ams, rel, "\u21C9", "\\rightrightarrows", true); defineSymbol(symbols_math, ams, rel, "\u21C4", "\\rightleftarrows", true); defineSymbol(symbols_math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21A3", "\\rightarrowtail", true); defineSymbol(symbols_math, ams, rel, "\u21AC", "\\looparrowright", true); defineSymbol(symbols_math, ams, rel, "\u21B7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. defineSymbol(symbols_math, ams, rel, "\u21BB", "\\circlearrowright", true); defineSymbol(symbols_math, ams, rel, "\u21B1", "\\Rsh", true); defineSymbol(symbols_math, ams, rel, "\u21CA", "\\downdownarrows", true); defineSymbol(symbols_math, ams, rel, "\u21BE", "\\upharpoonright", true); defineSymbol(symbols_math, ams, rel, "\u21C2", "\\downharpoonright", true); defineSymbol(symbols_math, ams, rel, "\u21DD", "\\rightsquigarrow", true); defineSymbol(symbols_math, ams, rel, "\u21DD", "\\leadsto"); defineSymbol(symbols_math, ams, rel, "\u21DB", "\\Rrightarrow", true); defineSymbol(symbols_math, ams, rel, "\u21BE", "\\restriction"); defineSymbol(symbols_math, main, symbols_textord, "\u2018", "`"); defineSymbol(symbols_math, main, symbols_textord, "$", "\\$"); defineSymbol(symbols_text, main, symbols_textord, "$", "\\$"); defineSymbol(symbols_text, main, symbols_textord, "$", "\\textdollar"); defineSymbol(symbols_math, main, symbols_textord, "%", "\\%"); defineSymbol(symbols_text, main, symbols_textord, "%", "\\%"); defineSymbol(symbols_math, main, symbols_textord, "_", "\\_"); defineSymbol(symbols_text, main, symbols_textord, "_", "\\_"); defineSymbol(symbols_text, main, symbols_textord, "_", "\\textunderscore"); defineSymbol(symbols_math, main, symbols_textord, "\u2220", "\\angle", true); defineSymbol(symbols_math, main, symbols_textord, "\u221E", "\\infty", true); defineSymbol(symbols_math, main, symbols_textord, "\u2032", "\\prime"); defineSymbol(symbols_math, main, symbols_textord, "\u25B3", "\\triangle"); defineSymbol(symbols_math, main, symbols_textord, "\u0393", "\\Gamma", true); defineSymbol(symbols_math, main, symbols_textord, "\u0394", "\\Delta", true); defineSymbol(symbols_math, main, symbols_textord, "\u0398", "\\Theta", true); defineSymbol(symbols_math, main, symbols_textord, "\u039B", "\\Lambda", true); defineSymbol(symbols_math, main, symbols_textord, "\u039E", "\\Xi", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A0", "\\Pi", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A3", "\\Sigma", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A5", "\\Upsilon", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A6", "\\Phi", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A8", "\\Psi", true); defineSymbol(symbols_math, main, symbols_textord, "\u03A9", "\\Omega", true); defineSymbol(symbols_math, main, symbols_textord, "A", "\u0391"); defineSymbol(symbols_math, main, symbols_textord, "B", "\u0392"); defineSymbol(symbols_math, main, symbols_textord, "E", "\u0395"); defineSymbol(symbols_math, main, symbols_textord, "Z", "\u0396"); defineSymbol(symbols_math, main, symbols_textord, "H", "\u0397"); defineSymbol(symbols_math, main, symbols_textord, "I", "\u0399"); defineSymbol(symbols_math, main, symbols_textord, "K", "\u039A"); defineSymbol(symbols_math, main, symbols_textord, "M", "\u039C"); defineSymbol(symbols_math, main, symbols_textord, "N", "\u039D"); defineSymbol(symbols_math, main, symbols_textord, "O", "\u039F"); defineSymbol(symbols_math, main, symbols_textord, "P", "\u03A1"); defineSymbol(symbols_math, main, symbols_textord, "T", "\u03A4"); defineSymbol(symbols_math, main, symbols_textord, "X", "\u03A7"); defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\neg", true); defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\lnot"); defineSymbol(symbols_math, main, symbols_textord, "\u22A4", "\\top"); defineSymbol(symbols_math, main, symbols_textord, "\u22A5", "\\bot"); defineSymbol(symbols_math, main, symbols_textord, "\u2205", "\\emptyset"); defineSymbol(symbols_math, ams, symbols_textord, "\u2205", "\\varnothing"); defineSymbol(symbols_math, main, mathord, "\u03B1", "\\alpha", true); defineSymbol(symbols_math, main, mathord, "\u03B2", "\\beta", true); defineSymbol(symbols_math, main, mathord, "\u03B3", "\\gamma", true); defineSymbol(symbols_math, main, mathord, "\u03B4", "\\delta", true); defineSymbol(symbols_math, main, mathord, "\u03F5", "\\epsilon", true); defineSymbol(symbols_math, main, mathord, "\u03B6", "\\zeta", true); defineSymbol(symbols_math, main, mathord, "\u03B7", "\\eta", true); defineSymbol(symbols_math, main, mathord, "\u03B8", "\\theta", true); defineSymbol(symbols_math, main, mathord, "\u03B9", "\\iota", true); defineSymbol(symbols_math, main, mathord, "\u03BA", "\\kappa", true); defineSymbol(symbols_math, main, mathord, "\u03BB", "\\lambda", true); defineSymbol(symbols_math, main, mathord, "\u03BC", "\\mu", true); defineSymbol(symbols_math, main, mathord, "\u03BD", "\\nu", true); defineSymbol(symbols_math, main, mathord, "\u03BE", "\\xi", true); defineSymbol(symbols_math, main, mathord, "\u03BF", "\\omicron", true); defineSymbol(symbols_math, main, mathord, "\u03C0", "\\pi", true); defineSymbol(symbols_math, main, mathord, "\u03C1", "\\rho", true); defineSymbol(symbols_math, main, mathord, "\u03C3", "\\sigma", true); defineSymbol(symbols_math, main, mathord, "\u03C4", "\\tau", true); defineSymbol(symbols_math, main, mathord, "\u03C5", "\\upsilon", true); defineSymbol(symbols_math, main, mathord, "\u03D5", "\\phi", true); defineSymbol(symbols_math, main, mathord, "\u03C7", "\\chi", true); defineSymbol(symbols_math, main, mathord, "\u03C8", "\\psi", true); defineSymbol(symbols_math, main, mathord, "\u03C9", "\\omega", true); defineSymbol(symbols_math, main, mathord, "\u03B5", "\\varepsilon", true); defineSymbol(symbols_math, main, mathord, "\u03D1", "\\vartheta", true); defineSymbol(symbols_math, main, mathord, "\u03D6", "\\varpi", true); defineSymbol(symbols_math, main, mathord, "\u03F1", "\\varrho", true); defineSymbol(symbols_math, main, mathord, "\u03C2", "\\varsigma", true); defineSymbol(symbols_math, main, mathord, "\u03C6", "\\varphi", true); defineSymbol(symbols_math, main, bin, "\u2217", "*"); defineSymbol(symbols_math, main, bin, "+", "+"); defineSymbol(symbols_math, main, bin, "\u2212", "-"); defineSymbol(symbols_math, main, bin, "\u22C5", "\\cdot", true); defineSymbol(symbols_math, main, bin, "\u2218", "\\circ"); defineSymbol(symbols_math, main, bin, "\xF7", "\\div", true); defineSymbol(symbols_math, main, bin, "\xB1", "\\pm", true); defineSymbol(symbols_math, main, bin, "\xD7", "\\times", true); defineSymbol(symbols_math, main, bin, "\u2229", "\\cap", true); defineSymbol(symbols_math, main, bin, "\u222A", "\\cup", true); defineSymbol(symbols_math, main, bin, "\u2216", "\\setminus"); defineSymbol(symbols_math, main, bin, "\u2227", "\\land"); defineSymbol(symbols_math, main, bin, "\u2228", "\\lor"); defineSymbol(symbols_math, main, bin, "\u2227", "\\wedge", true); defineSymbol(symbols_math, main, bin, "\u2228", "\\vee", true); defineSymbol(symbols_math, main, symbols_textord, "\u221A", "\\surd"); defineSymbol(symbols_math, main, symbols_open, "\u27E8", "\\langle", true); defineSymbol(symbols_math, main, symbols_open, "\u2223", "\\lvert"); defineSymbol(symbols_math, main, symbols_open, "\u2225", "\\lVert"); defineSymbol(symbols_math, main, symbols_close, "?", "?"); defineSymbol(symbols_math, main, symbols_close, "!", "!"); defineSymbol(symbols_math, main, symbols_close, "\u27E9", "\\rangle", true); defineSymbol(symbols_math, main, symbols_close, "\u2223", "\\rvert"); defineSymbol(symbols_math, main, symbols_close, "\u2225", "\\rVert"); defineSymbol(symbols_math, main, rel, "=", "="); defineSymbol(symbols_math, main, rel, ":", ":"); defineSymbol(symbols_math, main, rel, "\u2248", "\\approx", true); defineSymbol(symbols_math, main, rel, "\u2245", "\\cong", true); defineSymbol(symbols_math, main, rel, "\u2265", "\\ge"); defineSymbol(symbols_math, main, rel, "\u2265", "\\geq", true); defineSymbol(symbols_math, main, rel, "\u2190", "\\gets"); defineSymbol(symbols_math, main, rel, ">", "\\gt", true); defineSymbol(symbols_math, main, rel, "\u2208", "\\in", true); defineSymbol(symbols_math, main, rel, "\uE020", "\\@not"); defineSymbol(symbols_math, main, rel, "\u2282", "\\subset", true); defineSymbol(symbols_math, main, rel, "\u2283", "\\supset", true); defineSymbol(symbols_math, main, rel, "\u2286", "\\subseteq", true); defineSymbol(symbols_math, main, rel, "\u2287", "\\supseteq", true); defineSymbol(symbols_math, ams, rel, "\u2288", "\\nsubseteq", true); defineSymbol(symbols_math, ams, rel, "\u2289", "\\nsupseteq", true); defineSymbol(symbols_math, main, rel, "\u22A8", "\\models"); defineSymbol(symbols_math, main, rel, "\u2190", "\\leftarrow", true); defineSymbol(symbols_math, main, rel, "\u2264", "\\le"); defineSymbol(symbols_math, main, rel, "\u2264", "\\leq", true); defineSymbol(symbols_math, main, rel, "<", "\\lt", true); defineSymbol(symbols_math, main, rel, "\u2192", "\\rightarrow", true); defineSymbol(symbols_math, main, rel, "\u2192", "\\to"); defineSymbol(symbols_math, ams, rel, "\u2271", "\\ngeq", true); defineSymbol(symbols_math, ams, rel, "\u2270", "\\nleq", true); defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\ "); defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "~"); defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{% defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\nobreakspace"); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\ "); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", " "); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "~"); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\space"); defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\nobreakspace"); defineSymbol(symbols_math, main, symbols_spacing, null, "\\nobreak"); defineSymbol(symbols_math, main, symbols_spacing, null, "\\allowbreak"); defineSymbol(symbols_math, main, punct, ",", ","); defineSymbol(symbols_math, main, punct, ";", ";"); defineSymbol(symbols_math, ams, bin, "\u22BC", "\\barwedge", true); defineSymbol(symbols_math, ams, bin, "\u22BB", "\\veebar", true); defineSymbol(symbols_math, main, bin, "\u2299", "\\odot", true); defineSymbol(symbols_math, main, bin, "\u2295", "\\oplus", true); defineSymbol(symbols_math, main, bin, "\u2297", "\\otimes", true); defineSymbol(symbols_math, main, symbols_textord, "\u2202", "\\partial", true); defineSymbol(symbols_math, main, bin, "\u2298", "\\oslash", true); defineSymbol(symbols_math, ams, bin, "\u229A", "\\circledcirc", true); defineSymbol(symbols_math, ams, bin, "\u22A1", "\\boxdot", true); defineSymbol(symbols_math, main, bin, "\u25B3", "\\bigtriangleup"); defineSymbol(symbols_math, main, bin, "\u25BD", "\\bigtriangledown"); defineSymbol(symbols_math, main, bin, "\u2020", "\\dagger"); defineSymbol(symbols_math, main, bin, "\u22C4", "\\diamond"); defineSymbol(symbols_math, main, bin, "\u22C6", "\\star"); defineSymbol(symbols_math, main, bin, "\u25C3", "\\triangleleft"); defineSymbol(symbols_math, main, bin, "\u25B9", "\\triangleright"); defineSymbol(symbols_math, main, symbols_open, "{", "\\{"); defineSymbol(symbols_text, main, symbols_textord, "{", "\\{"); defineSymbol(symbols_text, main, symbols_textord, "{", "\\textbraceleft"); defineSymbol(symbols_math, main, symbols_close, "}", "\\}"); defineSymbol(symbols_text, main, symbols_textord, "}", "\\}"); defineSymbol(symbols_text, main, symbols_textord, "}", "\\textbraceright"); defineSymbol(symbols_math, main, symbols_open, "{", "\\lbrace"); defineSymbol(symbols_math, main, symbols_close, "}", "\\rbrace"); defineSymbol(symbols_math, main, symbols_open, "[", "\\lbrack", true); defineSymbol(symbols_text, main, symbols_textord, "[", "\\lbrack", true); defineSymbol(symbols_math, main, symbols_close, "]", "\\rbrack", true); defineSymbol(symbols_text, main, symbols_textord, "]", "\\rbrack", true); defineSymbol(symbols_math, main, symbols_open, "(", "\\lparen", true); defineSymbol(symbols_math, main, symbols_close, ")", "\\rparen", true); defineSymbol(symbols_text, main, symbols_textord, "<", "\\textless", true); // in T1 fontenc defineSymbol(symbols_text, main, symbols_textord, ">", "\\textgreater", true); // in T1 fontenc defineSymbol(symbols_math, main, symbols_open, "\u230A", "\\lfloor", true); defineSymbol(symbols_math, main, symbols_close, "\u230B", "\\rfloor", true); defineSymbol(symbols_math, main, symbols_open, "\u2308", "\\lceil", true); defineSymbol(symbols_math, main, symbols_close, "\u2309", "\\rceil", true); defineSymbol(symbols_math, main, symbols_textord, "\\", "\\backslash"); defineSymbol(symbols_math, main, symbols_textord, "\u2223", "|"); defineSymbol(symbols_math, main, symbols_textord, "\u2223", "\\vert"); defineSymbol(symbols_text, main, symbols_textord, "|", "\\textbar", true); // in T1 fontenc defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\|"); defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\Vert"); defineSymbol(symbols_text, main, symbols_textord, "\u2225", "\\textbardbl"); defineSymbol(symbols_text, main, symbols_textord, "~", "\\textasciitilde"); defineSymbol(symbols_text, main, symbols_textord, "\\", "\\textbackslash"); defineSymbol(symbols_text, main, symbols_textord, "^", "\\textasciicircum"); defineSymbol(symbols_math, main, rel, "\u2191", "\\uparrow", true); defineSymbol(symbols_math, main, rel, "\u21D1", "\\Uparrow", true); defineSymbol(symbols_math, main, rel, "\u2193", "\\downarrow", true); defineSymbol(symbols_math, main, rel, "\u21D3", "\\Downarrow", true); defineSymbol(symbols_math, main, rel, "\u2195", "\\updownarrow", true); defineSymbol(symbols_math, main, rel, "\u21D5", "\\Updownarrow", true); defineSymbol(symbols_math, main, op, "\u2210", "\\coprod"); defineSymbol(symbols_math, main, op, "\u22C1", "\\bigvee"); defineSymbol(symbols_math, main, op, "\u22C0", "\\bigwedge"); defineSymbol(symbols_math, main, op, "\u2A04", "\\biguplus"); defineSymbol(symbols_math, main, op, "\u22C2", "\\bigcap"); defineSymbol(symbols_math, main, op, "\u22C3", "\\bigcup"); defineSymbol(symbols_math, main, op, "\u222B", "\\int"); defineSymbol(symbols_math, main, op, "\u222B", "\\intop"); defineSymbol(symbols_math, main, op, "\u222C", "\\iint"); defineSymbol(symbols_math, main, op, "\u222D", "\\iiint"); defineSymbol(symbols_math, main, op, "\u220F", "\\prod"); defineSymbol(symbols_math, main, op, "\u2211", "\\sum"); defineSymbol(symbols_math, main, op, "\u2A02", "\\bigotimes"); defineSymbol(symbols_math, main, op, "\u2A01", "\\bigoplus"); defineSymbol(symbols_math, main, op, "\u2A00", "\\bigodot"); defineSymbol(symbols_math, main, op, "\u222E", "\\oint"); defineSymbol(symbols_math, main, op, "\u2A06", "\\bigsqcup"); defineSymbol(symbols_math, main, op, "\u222B", "\\smallint"); defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\textellipsis"); defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\mathellipsis"); defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\ldots", true); defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\ldots", true); defineSymbol(symbols_math, main, symbols_inner, "\u22EF", "\\@cdots", true); defineSymbol(symbols_math, main, symbols_inner, "\u22F1", "\\ddots", true); defineSymbol(symbols_math, main, symbols_textord, "\u22EE", "\\varvdots"); // \vdots is a macro defineSymbol(symbols_math, main, symbols_accent, "\u02CA", "\\acute"); defineSymbol(symbols_math, main, symbols_accent, "\u02CB", "\\grave"); defineSymbol(symbols_math, main, symbols_accent, "\xA8", "\\ddot"); defineSymbol(symbols_math, main, symbols_accent, "~", "\\tilde"); defineSymbol(symbols_math, main, symbols_accent, "\u02C9", "\\bar"); defineSymbol(symbols_math, main, symbols_accent, "\u02D8", "\\breve"); defineSymbol(symbols_math, main, symbols_accent, "\u02C7", "\\check"); defineSymbol(symbols_math, main, symbols_accent, "^", "\\hat"); defineSymbol(symbols_math, main, symbols_accent, "\u20D7", "\\vec"); defineSymbol(symbols_math, main, symbols_accent, "\u02D9", "\\dot"); defineSymbol(symbols_math, main, symbols_accent, "\u02DA", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA defineSymbol(symbols_math, main, mathord, "\uE131", "\\@imath"); defineSymbol(symbols_math, main, mathord, "\uE237", "\\@jmath"); defineSymbol(symbols_math, main, symbols_textord, "\u0131", "\u0131"); defineSymbol(symbols_math, main, symbols_textord, "\u0237", "\u0237"); defineSymbol(symbols_text, main, symbols_textord, "\u0131", "\\i", true); defineSymbol(symbols_text, main, symbols_textord, "\u0237", "\\j", true); defineSymbol(symbols_text, main, symbols_textord, "\xDF", "\\ss", true); defineSymbol(symbols_text, main, symbols_textord, "\xE6", "\\ae", true); defineSymbol(symbols_text, main, symbols_textord, "\u0153", "\\oe", true); defineSymbol(symbols_text, main, symbols_textord, "\xF8", "\\o", true); defineSymbol(symbols_text, main, symbols_textord, "\xC6", "\\AE", true); defineSymbol(symbols_text, main, symbols_textord, "\u0152", "\\OE", true); defineSymbol(symbols_text, main, symbols_textord, "\xD8", "\\O", true); defineSymbol(symbols_text, main, symbols_accent, "\u02CA", "\\'"); // acute defineSymbol(symbols_text, main, symbols_accent, "\u02CB", "\\`"); // grave defineSymbol(symbols_text, main, symbols_accent, "\u02C6", "\\^"); // circumflex defineSymbol(symbols_text, main, symbols_accent, "\u02DC", "\\~"); // tilde defineSymbol(symbols_text, main, symbols_accent, "\u02C9", "\\="); // macron defineSymbol(symbols_text, main, symbols_accent, "\u02D8", "\\u"); // breve defineSymbol(symbols_text, main, symbols_accent, "\u02D9", "\\."); // dot above defineSymbol(symbols_text, main, symbols_accent, "\u02DA", "\\r"); // ring above defineSymbol(symbols_text, main, symbols_accent, "\u02C7", "\\v"); // caron defineSymbol(symbols_text, main, symbols_accent, "\xA8", '\\"'); // diaresis defineSymbol(symbols_text, main, symbols_accent, "\u02DD", "\\H"); // double acute defineSymbol(symbols_text, main, symbols_accent, "\u25EF", "\\textcircled"); // \bigcirc glyph // These ligatures are detected and created in Parser.js's `formLigatures`. var ligatures = { "--": true, "---": true, "``": true, "''": true }; defineSymbol(symbols_text, main, symbols_textord, "\u2013", "--", true); defineSymbol(symbols_text, main, symbols_textord, "\u2013", "\\textendash"); defineSymbol(symbols_text, main, symbols_textord, "\u2014", "---", true); defineSymbol(symbols_text, main, symbols_textord, "\u2014", "\\textemdash"); defineSymbol(symbols_text, main, symbols_textord, "\u2018", "`", true); defineSymbol(symbols_text, main, symbols_textord, "\u2018", "\\textquoteleft"); defineSymbol(symbols_text, main, symbols_textord, "\u2019", "'", true); defineSymbol(symbols_text, main, symbols_textord, "\u2019", "\\textquoteright"); defineSymbol(symbols_text, main, symbols_textord, "\u201C", "``", true); defineSymbol(symbols_text, main, symbols_textord, "\u201C", "\\textquotedblleft"); defineSymbol(symbols_text, main, symbols_textord, "\u201D", "''", true); defineSymbol(symbols_text, main, symbols_textord, "\u201D", "\\textquotedblright"); // \degree from gensymb package defineSymbol(symbols_math, main, symbols_textord, "\xB0", "\\degree", true); defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\degree"); // \textdegree from inputenc package defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math // mode, but among our fonts, only Main-Regular defines this character "163". defineSymbol(symbols_math, main, symbols_textord, "\xA3", "\\pounds"); defineSymbol(symbols_math, main, symbols_textord, "\xA3", "\\mathsterling", true); defineSymbol(symbols_text, main, symbols_textord, "\xA3", "\\pounds"); defineSymbol(symbols_text, main, symbols_textord, "\xA3", "\\textsterling", true); defineSymbol(symbols_math, ams, symbols_textord, "\u2720", "\\maltese"); defineSymbol(symbols_text, ams, symbols_textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards. // All of these are textords in math mode var mathTextSymbols = "0123456789/@.\""; for (var symbols_i = 0; symbols_i < mathTextSymbols.length; symbols_i++) { var symbols_ch = mathTextSymbols.charAt(symbols_i); defineSymbol(symbols_math, main, symbols_textord, symbols_ch, symbols_ch); } // All of these are textords in text mode var textSymbols = "0123456789!@*()-=+\";:?/.,"; for (var src_symbols_i = 0; src_symbols_i < textSymbols.length; src_symbols_i++) { var _ch = textSymbols.charAt(src_symbols_i); defineSymbol(symbols_text, main, symbols_textord, _ch, _ch); } // All of these are textords in text mode, and mathords in math mode var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (var symbols_i2 = 0; symbols_i2 < letters.length; symbols_i2++) { var _ch2 = letters.charAt(symbols_i2); defineSymbol(symbols_math, main, mathord, _ch2, _ch2); defineSymbol(symbols_text, main, symbols_textord, _ch2, _ch2); } // Blackboard bold and script letters in Unicode range defineSymbol(symbols_math, ams, symbols_textord, "C", "\u2102"); // blackboard bold defineSymbol(symbols_text, ams, symbols_textord, "C", "\u2102"); defineSymbol(symbols_math, ams, symbols_textord, "H", "\u210D"); defineSymbol(symbols_text, ams, symbols_textord, "H", "\u210D"); defineSymbol(symbols_math, ams, symbols_textord, "N", "\u2115"); defineSymbol(symbols_text, ams, symbols_textord, "N", "\u2115"); defineSymbol(symbols_math, ams, symbols_textord, "P", "\u2119"); defineSymbol(symbols_text, ams, symbols_textord, "P", "\u2119"); defineSymbol(symbols_math, ams, symbols_textord, "Q", "\u211A"); defineSymbol(symbols_text, ams, symbols_textord, "Q", "\u211A"); defineSymbol(symbols_math, ams, symbols_textord, "R", "\u211D"); defineSymbol(symbols_text, ams, symbols_textord, "R", "\u211D"); defineSymbol(symbols_math, ams, symbols_textord, "Z", "\u2124"); defineSymbol(symbols_text, ams, symbols_textord, "Z", "\u2124"); defineSymbol(symbols_math, main, mathord, "h", "\u210E"); // italic h, Planck constant defineSymbol(symbols_text, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters. // We support some letters in the Unicode range U+1D400 to U+1D7FF, // Mathematical Alphanumeric Symbols. // Some editors do not deal well with wide characters. So don't write the // string into this file. Instead, create the string from the surrogate pair. var symbols_wideChar = ""; for (var symbols_i3 = 0; symbols_i3 < letters.length; symbols_i3++) { var _ch3 = letters.charAt(symbols_i3); // The hex numbers in the next line are a surrogate pair. // 0xD835 is the high surrogate for all letters in the range we support. // 0xDC00 is the low surrogate for bold A. symbols_wideChar = String.fromCharCode(0xD835, 0xDC00 + symbols_i3); // A-Z a-z bold defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDC34 + symbols_i3); // A-Z a-z italic defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDC68 + symbols_i3); // A-Z a-z bold italic defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDD04 + symbols_i3); // A-Z a-z Fractur defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDDA0 + symbols_i3); // A-Z a-z sans-serif defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDDD4 + symbols_i3); // A-Z a-z sans bold defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDE08 + symbols_i3); // A-Z a-z sans italic defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDE70 + symbols_i3); // A-Z a-z monospace defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); if (symbols_i3 < 26) { // KaTeX fonts have only capital letters for blackboard bold and script. // See exception for k below. symbols_wideChar = String.fromCharCode(0xD835, 0xDD38 + symbols_i3); // A-Z double struck defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDC9C + symbols_i3); // A-Z script defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); } // TODO: Add bold script when it is supported by a KaTeX font. } // "k" is the only double struck lower case letter in the KaTeX fonts. symbols_wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck defineSymbol(symbols_math, main, mathord, "k", symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, "k", symbols_wideChar); // Next, some wide character numerals for (var symbols_i4 = 0; symbols_i4 < 10; symbols_i4++) { var _ch4 = symbols_i4.toString(); symbols_wideChar = String.fromCharCode(0xD835, 0xDFCE + symbols_i4); // 0-9 bold defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDFE2 + symbols_i4); // 0-9 sans serif defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDFEC + symbols_i4); // 0-9 bold sans defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); symbols_wideChar = String.fromCharCode(0xD835, 0xDFF6 + symbols_i4); // 0-9 monospace defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); } // We add these Latin-1 letters as symbols for backwards-compatibility, // but they are not actually in the font, nor are they supported by the // Unicode accent mechanism, so they fall back to Times font and look ugly. // TODO(edemaine): Fix this. var extraLatin = "\xC7\xD0\xDE\xE7\xFE"; for (var _i5 = 0; _i5 < extraLatin.length; _i5++) { var _ch5 = extraLatin.charAt(_i5); defineSymbol(symbols_math, main, mathord, _ch5, _ch5); defineSymbol(symbols_text, main, symbols_textord, _ch5, _ch5); } // CONCATENATED MODULE: ./src/wide-character.js /** * This file provides support for Unicode range U+1D400 to U+1D7FF, * Mathematical Alphanumeric Symbols. * * Function wideCharacterFont takes a wide character as input and returns * the font information necessary to render it properly. */ /** * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf * That document sorts characters into groups by font type, say bold or italic. * * In the arrays below, each subarray consists three elements: * * The CSS class of that group when in math mode. * * The CSS class of that group when in text mode. * * The font name, so that KaTeX can get font metrics. */ var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright ["mathbf", "textbf", "Main-Bold"], // a-z bold upright ["mathnormal", "textit", "Math-Italic"], // A-Z italic ["mathnormal", "textit", "Math-Italic"], // a-z italic ["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic ["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic // Map fancy A-Z letters to script, not calligraphic. // This aligns with unicode-math and math fonts (except Cambria Math). ["mathscr", "textscr", "Script-Regular"], // A-Z script ["", "", ""], // a-z script. No font ["", "", ""], // A-Z bold script. No font ["", "", ""], // a-z bold script. No font ["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur ["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur ["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck ["mathbb", "textbb", "AMS-Regular"], // k double-struck ["", "", ""], // A-Z bold Fraktur No font metrics ["", "", ""], // a-z bold Fraktur. No font. ["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif ["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif ["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif ["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif ["", "", ""], // A-Z bold italic sans. No font ["", "", ""], // a-z bold italic sans. No font ["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace ["mathtt", "texttt", "Typewriter-Regular"]]; var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold ["", "", ""], // 0-9 double-struck. No KaTeX font. ["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif ["mathtt", "texttt", "Typewriter-Regular"]]; var wide_character_wideCharacterFont = function wideCharacterFont(wideChar, mode) { // IE doesn't support codePointAt(). So work with the surrogate pair. var H = wideChar.charCodeAt(0); // high surrogate var L = wideChar.charCodeAt(1); // low surrogate var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000; var j = mode === "math" ? 0 : 1; // column index for CSS class. if (0x1D400 <= codePoint && codePoint < 0x1D6A4) { // wideLatinLetterData contains exactly 26 chars on each row. // So we can calculate the relevant row. No traverse necessary. var i = Math.floor((codePoint - 0x1D400) / 26); return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]]; } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) { // Numerals, ten per row. var _i = Math.floor((codePoint - 0x1D7CE) / 10); return [wideNumeralData[_i][2], wideNumeralData[_i][j]]; } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) { // dotless i or j return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]]; } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) { // Greek letters. Not supported, yet. return ["", ""]; } else { // We don't support any wide characters outside 1D400–1D7FF. throw new src_ParseError("Unsupported character: " + wideChar); } }; // CONCATENATED MODULE: ./src/Options.js /** * This file contains information about the options that the Parser carries * around with it while parsing. Data is held in an `Options` object, and when * recursing, a new `Options` object can be created with the `.with*` and * `.reset` functions. */ var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize]. // The size mappings are taken from TeX with \normalsize=10pt. [1, 1, 1], // size1: [5, 5, 5] \tiny [2, 1, 1], // size2: [6, 5, 5] [3, 1, 1], // size3: [7, 5, 5] \scriptsize [4, 2, 1], // size4: [8, 6, 5] \footnotesize [5, 2, 1], // size5: [9, 6, 5] \small [6, 3, 1], // size6: [10, 7, 5] \normalsize [7, 4, 2], // size7: [12, 8, 6] \large [8, 6, 3], // size8: [14.4, 10, 7] \Large [9, 7, 6], // size9: [17.28, 12, 10] \LARGE [10, 8, 7], // size10: [20.74, 14.4, 12] \huge [11, 10, 9]]; var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if // you change size indexes, change that function. 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; var sizeAtStyle = function sizeAtStyle(size, style) { return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; }; // In these types, "" (empty string) means "no change". /** * This is the main options class. It contains the current style, size, color, * and font. * * Options objects should not be modified. To create a new Options with * different properties, call a `.having*` method. */ var Options_Options = /*#__PURE__*/ function () { // A font family applies to a group of fonts (i.e. SansSerif), while a font // represents a specific font (i.e. SansSerif Bold). // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm /** * The base size index. */ function Options(data) { this.style = void 0; this.color = void 0; this.size = void 0; this.textSize = void 0; this.phantom = void 0; this.font = void 0; this.fontFamily = void 0; this.fontWeight = void 0; this.fontShape = void 0; this.sizeMultiplier = void 0; this.maxSize = void 0; this.minRuleThickness = void 0; this._fontMetrics = void 0; this.style = data.style; this.color = data.color; this.size = data.size || Options.BASESIZE; this.textSize = data.textSize || this.size; this.phantom = !!data.phantom; this.font = data.font || ""; this.fontFamily = data.fontFamily || ""; this.fontWeight = data.fontWeight || ''; this.fontShape = data.fontShape || ''; this.sizeMultiplier = sizeMultipliers[this.size - 1]; this.maxSize = data.maxSize; this.minRuleThickness = data.minRuleThickness; this._fontMetrics = undefined; } /** * Returns a new options object with the same properties as "this". Properties * from "extension" will be copied to the new options object. */ var _proto = Options.prototype; _proto.extend = function extend(extension) { var data = { style: this.style, size: this.size, textSize: this.textSize, color: this.color, phantom: this.phantom, font: this.font, fontFamily: this.fontFamily, fontWeight: this.fontWeight, fontShape: this.fontShape, maxSize: this.maxSize, minRuleThickness: this.minRuleThickness }; for (var key in extension) { if (extension.hasOwnProperty(key)) { data[key] = extension[key]; } } return new Options(data); } /** * Return an options object with the given style. If `this.style === style`, * returns `this`. */ ; _proto.havingStyle = function havingStyle(style) { if (this.style === style) { return this; } else { return this.extend({ style: style, size: sizeAtStyle(this.textSize, style) }); } } /** * Return an options object with a cramped version of the current style. If * the current style is cramped, returns `this`. */ ; _proto.havingCrampedStyle = function havingCrampedStyle() { return this.havingStyle(this.style.cramp()); } /** * Return an options object with the given size and in at least `\textstyle`. * Returns `this` if appropriate. */ ; _proto.havingSize = function havingSize(size) { if (this.size === size && this.textSize === size) { return this; } else { return this.extend({ style: this.style.text(), size: size, textSize: size, sizeMultiplier: sizeMultipliers[size - 1] }); } } /** * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, * changes to at least `\textstyle`. */ ; _proto.havingBaseStyle = function havingBaseStyle(style) { style = style || this.style.text(); var wantSize = sizeAtStyle(Options.BASESIZE, style); if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) { return this; } else { return this.extend({ style: style, size: wantSize }); } } /** * Remove the effect of sizing changes such as \Huge. * Keep the effect of the current style, such as \scriptstyle. */ ; _proto.havingBaseSizing = function havingBaseSizing() { var size; switch (this.style.id) { case 4: case 5: size = 3; // normalsize in scriptstyle break; case 6: case 7: size = 1; // normalsize in scriptscriptstyle break; default: size = 6; // normalsize in textstyle or displaystyle } return this.extend({ style: this.style.text(), size: size }); } /** * Create a new options object with the given color. */ ; _proto.withColor = function withColor(color) { return this.extend({ color: color }); } /** * Create a new options object with "phantom" set to true. */ ; _proto.withPhantom = function withPhantom() { return this.extend({ phantom: true }); } /** * Creates a new options object with the given math font or old text font. * @type {[type]} */ ; _proto.withFont = function withFont(font) { return this.extend({ font: font }); } /** * Create a new options objects with the given fontFamily. */ ; _proto.withTextFontFamily = function withTextFontFamily(fontFamily) { return this.extend({ fontFamily: fontFamily, font: "" }); } /** * Creates a new options object with the given font weight */ ; _proto.withTextFontWeight = function withTextFontWeight(fontWeight) { return this.extend({ fontWeight: fontWeight, font: "" }); } /** * Creates a new options object with the given font weight */ ; _proto.withTextFontShape = function withTextFontShape(fontShape) { return this.extend({ fontShape: fontShape, font: "" }); } /** * Return the CSS sizing classes required to switch from enclosing options * `oldOptions` to `this`. Returns an array of classes. */ ; _proto.sizingClasses = function sizingClasses(oldOptions) { if (oldOptions.size !== this.size) { return ["sizing", "reset-size" + oldOptions.size, "size" + this.size]; } else { return []; } } /** * Return the CSS sizing classes required to switch to the base size. Like * `this.havingSize(BASESIZE).sizingClasses(this)`. */ ; _proto.baseSizingClasses = function baseSizingClasses() { if (this.size !== Options.BASESIZE) { return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE]; } else { return []; } } /** * Return the font metrics for this size. */ ; _proto.fontMetrics = function fontMetrics() { if (!this._fontMetrics) { this._fontMetrics = getGlobalMetrics(this.size); } return this._fontMetrics; } /** * Gets the CSS color of the current options object */ ; _proto.getColor = function getColor() { if (this.phantom) { return "transparent"; } else { return this.color; } }; return Options; }(); Options_Options.BASESIZE = 6; /* harmony default export */ var src_Options = (Options_Options); // CONCATENATED MODULE: ./src/units.js /** * This file does conversion between units. In particular, it provides * calculateSize to convert other units into ems. */ // This table gives the number of TeX pts in one of each *absolute* TeX unit. // Thus, multiplying a length by this number converts the length from units // into pts. Dividing the result by ptPerEm gives the number of ems // *assuming* a font size of ptPerEm (normal size, normal style). var ptPerUnit = { // https://en.wikibooks.org/wiki/LaTeX/Lengths and // https://tex.stackexchange.com/a/8263 "pt": 1, // TeX point "mm": 7227 / 2540, // millimeter "cm": 7227 / 254, // centimeter "in": 72.27, // inch "bp": 803 / 800, // big (PostScript) points "pc": 12, // pica "dd": 1238 / 1157, // didot "cc": 14856 / 1157, // cicero (12 didot) "nd": 685 / 642, // new didot "nc": 1370 / 107, // new cicero (12 new didot) "sp": 1 / 65536, // scaled point (TeX's internal smallest unit) // https://tex.stackexchange.com/a/41371 "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX }; // Dictionary of relative units, for fast validity testing. var relativeUnit = { "ex": true, "em": true, "mu": true }; /** * Determine whether the specified unit (either a string defining the unit * or a "size" parse node containing a unit field) is valid. */ var validUnit = function validUnit(unit) { if (typeof unit !== "string") { unit = unit.unit; } return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; }; /* * Convert a "size" parse node (with numeric "number" and string "unit" fields, * as parsed by functions.js argType "size") into a CSS em value for the * current style/scale. `options` gives the current options. */ var units_calculateSize = function calculateSize(sizeValue, options) { var scale; if (sizeValue.unit in ptPerUnit) { // Absolute units scale = ptPerUnit[sizeValue.unit] // Convert unit to pt / options.fontMetrics().ptPerEm // Convert pt to CSS em / options.sizeMultiplier; // Unscale to make absolute units } else if (sizeValue.unit === "mu") { // `mu` units scale with scriptstyle/scriptscriptstyle. scale = options.fontMetrics().cssEmPerMu; } else { // Other relative units always refer to the *textstyle* font // in the current size. var unitOptions; if (options.style.isTight()) { // isTight() means current style is script/scriptscript. unitOptions = options.havingStyle(options.style.text()); } else { unitOptions = options; } // TODO: In TeX these units are relative to the quad of the current // *text* font, e.g. cmr10. KaTeX instead uses values from the // comparably-sized *Computer Modern symbol* font. At 10pt, these // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641; // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$. // TeX \showlists shows a kern of 1.13889 * fontsize; // KaTeX shows a kern of 1.171 * fontsize. if (sizeValue.unit === "ex") { scale = unitOptions.fontMetrics().xHeight; } else if (sizeValue.unit === "em") { scale = unitOptions.fontMetrics().quad; } else { throw new src_ParseError("Invalid unit: '" + sizeValue.unit + "'"); } if (unitOptions !== options) { scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; } } return Math.min(sizeValue.number * scale, options.maxSize); }; // CONCATENATED MODULE: ./src/buildCommon.js /* eslint no-console:0 */ /** * This module contains general functions that can be used for building * different kinds of domTree nodes in a consistent manner. */ /** * Looks up the given symbol in fontMetrics, after applying any symbol * replacements defined in symbol.js */ var buildCommon_lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. fontName, mode) { // Replace the value with its replaced value from symbol.js if (src_symbols[mode][value] && src_symbols[mode][value].replace) { value = src_symbols[mode][value].replace; } return { value: value, metrics: getCharacterMetrics(value, fontName, mode) }; }; /** * Makes a symbolNode after translation via the list of symbols in symbols.js. * Correctly pulls out metrics for the character, and optionally takes a list of * classes to be attached to the node. * * TODO: make argument order closer to makeSpan * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which * should if present come first in `classes`. * TODO(#953): Make `options` mandatory and always pass it in. */ var buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { var lookup = buildCommon_lookupSymbol(value, fontName, mode); var metrics = lookup.metrics; value = lookup.value; var symbolNode; if (metrics) { var italic = metrics.italic; if (mode === "text" || options && options.font === "mathit") { italic = 0; } symbolNode = new domTree_SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes); } else { // TODO(emily): Figure out a good way to only print this in development typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'")); symbolNode = new domTree_SymbolNode(value, 0, 0, 0, 0, 0, classes); } if (options) { symbolNode.maxFontSize = options.sizeMultiplier; if (options.style.isTight()) { symbolNode.classes.push("mtight"); } var color = options.getColor(); if (color) { symbolNode.style.color = color; } } return symbolNode; }; /** * Makes a symbol in Main-Regular or AMS-Regular. * Used for rel, bin, open, close, inner, and punct. */ var buildCommon_mathsym = function mathsym(value, mode, options, classes) { if (classes === void 0) { classes = []; } // Decide what font to render the symbol in by its entry in the symbols // table. // Have a special case for when the value = \ because the \ is used as a // textord in unsupported command errors but cannot be parsed as a regular // text ordinal and is therefore not present as a symbol in the symbols // table for text, as well as a special case for boldsymbol because it // can be used for bold + and - if (options.font === "boldsymbol" && buildCommon_lookupSymbol(value, "Main-Bold", mode).metrics) { return buildCommon_makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"])); } else if (value === "\\" || src_symbols[mode][value].font === "main") { return buildCommon_makeSymbol(value, "Main-Regular", mode, options, classes); } else { return buildCommon_makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); } }; /** * Determines which of the two font names (Main-Bold and Math-BoldItalic) and * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol", * depending on the symbol. Use this function instead of fontMap for font * "boldsymbol". */ var boldsymbol = function boldsymbol(value, mode, options, classes, type) { if (type !== "textord" && buildCommon_lookupSymbol(value, "Math-BoldItalic", mode).metrics) { return { fontName: "Math-BoldItalic", fontClass: "boldsymbol" }; } else { // Some glyphs do not exist in Math-BoldItalic so we need to use // Main-Bold instead. return { fontName: "Main-Bold", fontClass: "mathbf" }; } }; /** * Makes either a mathord or textord in the correct font and color. */ var buildCommon_makeOrd = function makeOrd(group, options, type) { var mode = group.mode; var text = group.text; var classes = ["mord"]; // Math mode or Old font (i.e. \rm) var isFont = mode === "math" || mode === "text" && options.font; var fontOrFamily = isFont ? options.font : options.fontFamily; if (text.charCodeAt(0) === 0xD835) { // surrogate pairs get special treatment var _wideCharacterFont = wide_character_wideCharacterFont(text, mode), wideFontName = _wideCharacterFont[0], wideFontClass = _wideCharacterFont[1]; return buildCommon_makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); } else if (fontOrFamily) { var fontName; var fontClasses; if (fontOrFamily === "boldsymbol") { var fontData = boldsymbol(text, mode, options, classes, type); fontName = fontData.fontName; fontClasses = [fontData.fontClass]; } else if (isFont) { fontName = fontMap[fontOrFamily].fontName; fontClasses = [fontOrFamily]; } else { fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape); fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; } if (buildCommon_lookupSymbol(text, fontName, mode).metrics) { return buildCommon_makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") { // Deconstruct ligatures in monospace fonts (\texttt, \tt). var parts = []; for (var i = 0; i < text.length; i++) { parts.push(buildCommon_makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); } return buildCommon_makeFragment(parts); } } // Makes a symbol in the default font for mathords and textords. if (type === "mathord") { return buildCommon_makeSymbol(text, "Math-Italic", mode, options, classes.concat(["mathnormal"])); } else if (type === "textord") { var font = src_symbols[mode][text] && src_symbols[mode][text].font; if (font === "ams") { var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); return buildCommon_makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); } else if (font === "main" || !font) { var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape); return buildCommon_makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape)); } else { // fonts added by plugins var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class return buildCommon_makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape)); } } else { throw new Error("unexpected type: " + type + " in makeOrd"); } }; /** * Returns true if subsequent symbolNodes have the same classes, skew, maxFont, * and styles. */ var buildCommon_canCombine = function canCombine(prev, next) { if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) { return false; } for (var style in prev.style) { if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { return false; } } for (var _style in next.style) { if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) { return false; } } return true; }; /** * Combine consequetive domTree.symbolNodes into a single symbolNode. * Note: this function mutates the argument. */ var buildCommon_tryCombineChars = function tryCombineChars(chars) { for (var i = 0; i < chars.length - 1; i++) { var prev = chars[i]; var next = chars[i + 1]; if (prev instanceof domTree_SymbolNode && next instanceof domTree_SymbolNode && buildCommon_canCombine(prev, next)) { prev.text += next.text; prev.height = Math.max(prev.height, next.height); prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use // it to add padding to the right of the span created from // the combined characters. prev.italic = next.italic; chars.splice(i + 1, 1); i--; } } return chars; }; /** * Calculate the height, depth, and maxFontSize of an element based on its * children. */ var sizeElementFromChildren = function sizeElementFromChildren(elem) { var height = 0; var depth = 0; var maxFontSize = 0; for (var i = 0; i < elem.children.length; i++) { var child = elem.children[i]; if (child.height > height) { height = child.height; } if (child.depth > depth) { depth = child.depth; } if (child.maxFontSize > maxFontSize) { maxFontSize = child.maxFontSize; } } elem.height = height; elem.depth = depth; elem.maxFontSize = maxFontSize; }; /** * Makes a span with the given list of classes, list of children, and options. * * TODO(#953): Ensure that `options` is always provided (currently some call * sites don't pass it) and make the type below mandatory. * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which * should if present come first in `classes`. */ var buildCommon_makeSpan = function makeSpan(classes, children, options, style) { var span = new domTree_Span(classes, children, options, style); sizeElementFromChildren(span); return span; }; // SVG one is simpler -- doesn't require height, depth, max-font setting. // This is also a separate method for typesafety. var buildCommon_makeSvgSpan = function makeSvgSpan(classes, children, options, style) { return new domTree_Span(classes, children, options, style); }; var makeLineSpan = function makeLineSpan(className, options, thickness) { var line = buildCommon_makeSpan([className], [], options); line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness); line.style.borderBottomWidth = line.height + "em"; line.maxFontSize = 1.0; return line; }; /** * Makes an anchor with the given href, list of classes, list of children, * and options. */ var buildCommon_makeAnchor = function makeAnchor(href, classes, children, options) { var anchor = new domTree_Anchor(href, classes, children, options); sizeElementFromChildren(anchor); return anchor; }; /** * Makes a document fragment with the given list of children. */ var buildCommon_makeFragment = function makeFragment(children) { var fragment = new tree_DocumentFragment(children); sizeElementFromChildren(fragment); return fragment; }; /** * Wraps group in a span if it's a document fragment, allowing to apply classes * and styles */ var buildCommon_wrapFragment = function wrapFragment(group, options) { if (group instanceof tree_DocumentFragment) { return buildCommon_makeSpan([], [group], options); } return group; }; // These are exact object types to catch typos in the names of the optional fields. // Computes the updated `children` list and the overall depth. // // This helper function for makeVList makes it easier to enforce type safety by // allowing early exits (returns) in the logic. var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { if (params.positionType === "individualShift") { var oldChildren = params.children; var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be // shifted to the correct specified shift var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; var currPos = _depth; for (var i = 1; i < oldChildren.length; i++) { var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); currPos = currPos + diff; children.push({ type: "kern", size: size }); children.push(oldChildren[i]); } return { children: children, depth: _depth }; } var depth; if (params.positionType === "top") { // We always start at the bottom, so calculate the bottom by adding up // all the sizes var bottom = params.positionData; for (var _i = 0; _i < params.children.length; _i++) { var child = params.children[_i]; bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; } depth = bottom; } else if (params.positionType === "bottom") { depth = -params.positionData; } else { var firstChild = params.children[0]; if (firstChild.type !== "elem") { throw new Error('First child must have type "elem".'); } if (params.positionType === "shift") { depth = -firstChild.elem.depth - params.positionData; } else if (params.positionType === "firstBaseline") { depth = -firstChild.elem.depth; } else { throw new Error("Invalid positionType " + params.positionType + "."); } } return { children: params.children, depth: depth }; }; /** * Makes a vertical list by stacking elements and kerns on top of each other. * Allows for many different ways of specifying the positioning method. * * See VListParam documentation above. */ var buildCommon_makeVList = function makeVList(params, options) { var _getVListChildrenAndD = getVListChildrenAndDepth(params), children = _getVListChildrenAndD.children, depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to // each item, where it will determine the item's baseline. Since it has // `overflow:hidden`, the strut's top edge will sit on the item's line box's // top edge and the strut's bottom edge will sit on the item's baseline, // with no additional line-height spacing. This allows the item baseline to // be positioned precisely without worrying about font ascent and // line-height. var pstrutSize = 0; for (var i = 0; i < children.length; i++) { var child = children[i]; if (child.type === "elem") { var elem = child.elem; pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); } } pstrutSize += 2; var pstrut = buildCommon_makeSpan(["pstrut"], []); pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets var realChildren = []; var minPos = depth; var maxPos = depth; var currPos = depth; for (var _i2 = 0; _i2 < children.length; _i2++) { var _child = children[_i2]; if (_child.type === "kern") { currPos += _child.size; } else { var _elem = _child.elem; var classes = _child.wrapperClasses || []; var style = _child.wrapperStyle || {}; var childWrap = buildCommon_makeSpan(classes, [pstrut, _elem], undefined, style); childWrap.style.top = -pstrutSize - currPos - _elem.depth + "em"; if (_child.marginLeft) { childWrap.style.marginLeft = _child.marginLeft; } if (_child.marginRight) { childWrap.style.marginRight = _child.marginRight; } realChildren.push(childWrap); currPos += _elem.height + _elem.depth; } minPos = Math.min(minPos, currPos); maxPos = Math.max(maxPos, currPos); } // The vlist contents go in a table-cell with `vertical-align:bottom`. // This cell's bottom edge will determine the containing table's baseline // without overly expanding the containing line-box. var vlist = buildCommon_makeSpan(["vlist"], realChildren); vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth. var rows; if (minPos < 0) { // We will define depth in an empty span with display: table-cell. // It should render with the height that we define. But Chrome, in // contenteditable mode only, treats that span as if it contains some // text content. And that min-height over-rides our desired height. // So we put another empty span inside the depth strut span. var emptySpan = buildCommon_makeSpan([], []); var depthStrut = buildCommon_makeSpan(["vlist"], [emptySpan]); depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it // puts the bottom of the *second* row on the baseline. var topStrut = buildCommon_makeSpan(["vlist-s"], [new domTree_SymbolNode("\u200B")]); rows = [buildCommon_makeSpan(["vlist-r"], [vlist, topStrut]), buildCommon_makeSpan(["vlist-r"], [depthStrut])]; } else { rows = [buildCommon_makeSpan(["vlist-r"], [vlist])]; } var vtable = buildCommon_makeSpan(["vlist-t"], rows); if (rows.length === 2) { vtable.classes.push("vlist-t2"); } vtable.height = maxPos; vtable.depth = -minPos; return vtable; }; // Glue is a concept from TeX which is a flexible space between elements in // either a vertical or horizontal list. In KaTeX, at least for now, it's // static space between elements in a horizontal layout. var buildCommon_makeGlue = function makeGlue(measurement, options) { // Make an empty span for the space var rule = buildCommon_makeSpan(["mspace"], [], options); var size = units_calculateSize(measurement, options); rule.style.marginRight = size + "em"; return rule; }; // Takes font options, and returns the appropriate fontLookup name var retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) { var baseFontName = ""; switch (fontFamily) { case "amsrm": baseFontName = "AMS"; break; case "textrm": baseFontName = "Main"; break; case "textsf": baseFontName = "SansSerif"; break; case "texttt": baseFontName = "Typewriter"; break; default: baseFontName = fontFamily; // use fonts added by a plugin } var fontStylesName; if (fontWeight === "textbf" && fontShape === "textit") { fontStylesName = "BoldItalic"; } else if (fontWeight === "textbf") { fontStylesName = "Bold"; } else if (fontWeight === "textit") { fontStylesName = "Italic"; } else { fontStylesName = "Regular"; } return baseFontName + "-" + fontStylesName; }; /** * Maps TeX font commands to objects containing: * - variant: string used for "mathvariant" attribute in buildMathML.js * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics */ // A map between tex font commands an MathML mathvariant attribute values var fontMap = { // styles "mathbf": { variant: "bold", fontName: "Main-Bold" }, "mathrm": { variant: "normal", fontName: "Main-Regular" }, "textit": { variant: "italic", fontName: "Main-Italic" }, "mathit": { variant: "italic", fontName: "Main-Italic" }, "mathnormal": { variant: "italic", fontName: "Math-Italic" }, // "boldsymbol" is missing because they require the use of multiple fonts: // Math-BoldItalic and Main-Bold. This is handled by a special case in // makeOrd which ends up calling boldsymbol. // families "mathbb": { variant: "double-struck", fontName: "AMS-Regular" }, "mathcal": { variant: "script", fontName: "Caligraphic-Regular" }, "mathfrak": { variant: "fraktur", fontName: "Fraktur-Regular" }, "mathscr": { variant: "script", fontName: "Script-Regular" }, "mathsf": { variant: "sans-serif", fontName: "SansSerif-Regular" }, "mathtt": { variant: "monospace", fontName: "Typewriter-Regular" } }; var svgData = { // path, width, height vec: ["vec", 0.471, 0.714], // values from the font glyph oiintSize1: ["oiintSize1", 0.957, 0.499], // oval to overlay the integrand oiintSize2: ["oiintSize2", 1.472, 0.659], oiiintSize1: ["oiiintSize1", 1.304, 0.499], oiiintSize2: ["oiiintSize2", 1.98, 0.659], leftParenInner: ["leftParenInner", 0.875, 0.3], rightParenInner: ["rightParenInner", 0.875, 0.3] }; var buildCommon_staticSvg = function staticSvg(value, options) { // Create a span with inline SVG for the element. var _svgData$value = svgData[value], pathName = _svgData$value[0], width = _svgData$value[1], height = _svgData$value[2]; var path = new domTree_PathNode(pathName); var svgNode = new SvgNode([path], { "width": width + "em", "height": height + "em", // Override CSS rule `.katex svg { width: 100% }` "style": "width:" + width + "em", "viewBox": "0 0 " + 1000 * width + " " + 1000 * height, "preserveAspectRatio": "xMinYMin" }); var span = buildCommon_makeSvgSpan(["overlay"], [svgNode], options); span.height = height; span.style.height = height + "em"; span.style.width = width + "em"; return span; }; /* harmony default export */ var buildCommon = ({ fontMap: fontMap, makeSymbol: buildCommon_makeSymbol, mathsym: buildCommon_mathsym, makeSpan: buildCommon_makeSpan, makeSvgSpan: buildCommon_makeSvgSpan, makeLineSpan: makeLineSpan, makeAnchor: buildCommon_makeAnchor, makeFragment: buildCommon_makeFragment, wrapFragment: buildCommon_wrapFragment, makeVList: buildCommon_makeVList, makeOrd: buildCommon_makeOrd, makeGlue: buildCommon_makeGlue, staticSvg: buildCommon_staticSvg, svgData: svgData, tryCombineChars: buildCommon_tryCombineChars }); // CONCATENATED MODULE: ./src/spacingData.js /** * Describes spaces between different classes of atoms. */ var thinspace = { number: 3, unit: "mu" }; var mediumspace = { number: 4, unit: "mu" }; var thickspace = { number: 5, unit: "mu" }; // Making the type below exact with all optional fields doesn't work due to // - https://github.com/facebook/flow/issues/4582 // - https://github.com/facebook/flow/issues/5688 // However, since *all* fields are optional, $Shape<> works as suggested in 5688 // above. // Spacing relationships for display and text styles var spacings = { mord: { mop: thinspace, mbin: mediumspace, mrel: thickspace, minner: thinspace }, mop: { mord: thinspace, mop: thinspace, mrel: thickspace, minner: thinspace }, mbin: { mord: mediumspace, mop: mediumspace, mopen: mediumspace, minner: mediumspace }, mrel: { mord: thickspace, mop: thickspace, mopen: thickspace, minner: thickspace }, mopen: {}, mclose: { mop: thinspace, mbin: mediumspace, mrel: thickspace, minner: thinspace }, mpunct: { mord: thinspace, mop: thinspace, mrel: thickspace, mopen: thinspace, mclose: thinspace, mpunct: thinspace, minner: thinspace }, minner: { mord: thinspace, mop: thinspace, mbin: mediumspace, mrel: thickspace, mopen: thinspace, mpunct: thinspace, minner: thinspace } }; // Spacing relationships for script and scriptscript styles var tightSpacings = { mord: { mop: thinspace }, mop: { mord: thinspace, mop: thinspace }, mbin: {}, mrel: {}, mopen: {}, mclose: { mop: thinspace }, mpunct: {}, minner: { mop: thinspace } }; // CONCATENATED MODULE: ./src/defineFunction.js /** Context provided to function handlers for error messages. */ // Note: reverse the order of the return type union will cause a flow error. // See https://github.com/facebook/flow/issues/3663. // More general version of `HtmlBuilder` for nodes (e.g. \sum, accent types) // whose presence impacts super/subscripting. In this case, ParseNode<"supsub"> // delegates its HTML building to the HtmlBuilder corresponding to these nodes. /** * Final function spec for use at parse time. * This is almost identical to `FunctionPropSpec`, except it * 1. includes the function handler, and * 2. requires all arguments except argTypes. * It is generated by `defineFunction()` below. */ /** * All registered functions. * `functions.js` just exports this same dictionary again and makes it public. * `Parser.js` requires this dictionary. */ var _functions = {}; /** * All HTML builders. Should be only used in the `define*` and the `build*ML` * functions. */ var _htmlGroupBuilders = {}; /** * All MathML builders. Should be only used in the `define*` and the `build*ML` * functions. */ var _mathmlGroupBuilders = {}; function defineFunction(_ref) { var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder; // Set default values of functions var data = { type: type, numArgs: props.numArgs, argTypes: props.argTypes, greediness: props.greediness === undefined ? 1 : props.greediness, allowedInText: !!props.allowedInText, allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, numOptionalArgs: props.numOptionalArgs || 0, infix: !!props.infix, handler: handler }; for (var i = 0; i < names.length; ++i) { _functions[names[i]] = data; } if (type) { if (htmlBuilder) { _htmlGroupBuilders[type] = htmlBuilder; } if (mathmlBuilder) { _mathmlGroupBuilders[type] = mathmlBuilder; } } } /** * Use this to register only the HTML and MathML builders for a function (e.g. * if the function's ParseNode is generated in Parser.js rather than via a * stand-alone handler provided to `defineFunction`). */ function defineFunctionBuilders(_ref2) { var type = _ref2.type, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder; defineFunction({ type: type, names: [], props: { numArgs: 0 }, handler: function handler() { throw new Error('Should never be called.'); }, htmlBuilder: htmlBuilder, mathmlBuilder: mathmlBuilder }); } // Since the corresponding buildHTML/buildMathML function expects a // list of elements, we normalize for different kinds of arguments var ordargument = function ordargument(arg) { return arg.type === "ordgroup" ? arg.body : [arg]; }; // CONCATENATED MODULE: ./src/buildHTML.js /** * This file does the main work of building a domTree structure from a parse * tree. The entry point is the `buildHTML` function, which takes a parse tree. * Then, the buildExpression, buildGroup, and various groupBuilders functions * are called, to produce a final HTML tree. */ var buildHTML_makeSpan = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) // depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6, // and the text before Rule 19. var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]; var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"]; var styleMap = { "display": src_Style.DISPLAY, "text": src_Style.TEXT, "script": src_Style.SCRIPT, "scriptscript": src_Style.SCRIPTSCRIPT }; var DomEnum = { mord: "mord", mop: "mop", mbin: "mbin", mrel: "mrel", mopen: "mopen", mclose: "mclose", mpunct: "mpunct", minner: "minner" }; /** * Take a list of nodes, build them in order, and return a list of the built * nodes. documentFragments are flattened into their contents, so the * returned list contains no fragments. `isRealGroup` is true if `expression` * is a real group (no atoms will be added on either side), as opposed to * a partial group (e.g. one created by \color). `surrounding` is an array * consisting type of nodes that will be added to the left and right. */ var buildHTML_buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) { if (surrounding === void 0) { surrounding = [null, null]; } // Parse expressions into `groups`. var groups = []; for (var i = 0; i < expression.length; i++) { var output = buildHTML_buildGroup(expression[i], options); if (output instanceof tree_DocumentFragment) { var children = output.children; groups.push.apply(groups, children); } else { groups.push(output); } } // If `expression` is a partial group, let the parent handle spacings // to avoid processing groups multiple times. if (!isRealGroup) { return groups; } var glueOptions = options; if (expression.length === 1) { var node = expression[0]; if (node.type === "sizing") { glueOptions = options.havingSize(node.size); } else if (node.type === "styling") { glueOptions = options.havingStyle(styleMap[node.style]); } } // Dummy spans for determining spacings between surrounding atoms. // If `expression` has no atoms on the left or right, class "leftmost" // or "rightmost", respectively, is used to indicate it. var dummyPrev = buildHTML_makeSpan([surrounding[0] || "leftmost"], [], options); var dummyNext = buildHTML_makeSpan([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element // of its `classes` array. A later cleanup should ensure this, for // instance by changing the signature of `makeSpan`. // Before determining what spaces to insert, perform bin cancellation. // Binary operators change to ordinary symbols in some contexts. var isRoot = isRealGroup === "root"; traverseNonSpaceNodes(groups, function (node, prev) { var prevType = prev.classes[0]; var type = node.classes[0]; if (prevType === "mbin" && utils.contains(binRightCanceller, type)) { prev.classes[0] = "mord"; } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) { node.classes[0] = "mord"; } }, { node: dummyPrev }, dummyNext, isRoot); traverseNonSpaceNodes(groups, function (node, prev) { var prevType = getTypeOfDomTree(prev); var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style. var space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null; if (space) { // Insert glue (spacing) after the `prev`. return buildCommon.makeGlue(space, glueOptions); } }, { node: dummyPrev }, dummyNext, isRoot); return groups; }; // Depth-first traverse non-space `nodes`, calling `callback` with the current and // previous node as arguments, optionally returning a node to insert after the // previous node. `prev` is an object with the previous node and `insertAfter` // function to insert after it. `next` is a node that will be added to the right. // Used for bin cancellation and inserting spacings. var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) { if (next) { // temporarily append the right node, if exists nodes.push(next); } var i = 0; for (; i < nodes.length; i++) { var node = nodes[i]; var partialGroup = buildHTML_checkPartialGroup(node); if (partialGroup) { // Recursive DFS // $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array traverseNonSpaceNodes(partialGroup.children, callback, prev, null, isRoot); continue; } // Ignore explicit spaces (e.g., \;, \,) when determining what implicit // spacing should go between atoms of different classes var nonspace = !node.hasClass("mspace"); if (nonspace) { var result = callback(node, prev.node); if (result) { if (prev.insertAfter) { prev.insertAfter(result); } else { // insert at front nodes.unshift(result); i++; } } } if (nonspace) { prev.node = node; } else if (isRoot && node.hasClass("newline")) { prev.node = buildHTML_makeSpan(["leftmost"]); // treat like beginning of line } prev.insertAfter = function (index) { return function (n) { nodes.splice(index + 1, 0, n); i++; }; }(i); } if (next) { nodes.pop(); } }; // Check if given node is a partial group, i.e., does not affect spacing around. var buildHTML_checkPartialGroup = function checkPartialGroup(node) { if (node instanceof tree_DocumentFragment || node instanceof domTree_Anchor || node instanceof domTree_Span && node.hasClass("enclosing")) { return node; } return null; }; // Return the outermost node of a domTree. var getOutermostNode = function getOutermostNode(node, side) { var partialGroup = buildHTML_checkPartialGroup(node); if (partialGroup) { var children = partialGroup.children; if (children.length) { if (side === "right") { return getOutermostNode(children[children.length - 1], "right"); } else if (side === "left") { return getOutermostNode(children[0], "left"); } } } return node; }; // Return math atom class (mclass) of a domTree. // If `side` is given, it will get the type of the outermost node at given side. var getTypeOfDomTree = function getTypeOfDomTree(node, side) { if (!node) { return null; } if (side) { node = getOutermostNode(node, side); } // This makes a lot of assumptions as to where the type of atom // appears. We should do a better job of enforcing this. return DomEnum[node.classes[0]] || null; }; var makeNullDelimiter = function makeNullDelimiter(options, classes) { var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); return buildHTML_makeSpan(classes.concat(moreClasses)); }; /** * buildGroup is the function that takes a group and calls the correct groupType * function for it. It also handles the interaction of size and style changes * between parents and children. */ var buildHTML_buildGroup = function buildGroup(group, options, baseOptions) { if (!group) { return buildHTML_makeSpan(); } if (_htmlGroupBuilders[group.type]) { // Call the groupBuilders function var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account // for that size difference. if (baseOptions && options.size !== baseOptions.size) { groupNode = buildHTML_makeSpan(options.sizingClasses(baseOptions), [groupNode], options); var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; groupNode.height *= multiplier; groupNode.depth *= multiplier; } return groupNode; } else { throw new src_ParseError("Got group of unknown type: '" + group.type + "'"); } }; /** * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`) * into an unbreakable HTML node of class .base, with proper struts to * guarantee correct vertical extent. `buildHTML` calls this repeatedly to * make up the entire expression as a sequence of unbreakable units. */ function buildHTMLUnbreakable(children, options) { // Compute height and depth of this chunk. var body = buildHTML_makeSpan(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at // the height of the expression, and the bottom of the HTML element // falls at the depth of the expression. var strut = buildHTML_makeSpan(["strut"]); strut.style.height = body.height + body.depth + "em"; strut.style.verticalAlign = -body.depth + "em"; body.children.unshift(strut); return body; } /** * Take an entire parse tree, and build it into an appropriate set of HTML * nodes. */ function buildHTML(tree, options) { // Strip off outer tag wrapper for processing below. var tag = null; if (tree.length === 1 && tree[0].type === "tag") { tag = tree[0].tag; tree = tree[0].body; } // Build the expression contained in the tree var expression = buildHTML_buildExpression(tree, options, "root"); var children = []; // Create one base node for each chunk between potential line breaks. // The TeXBook [p.173] says "A formula will be broken only after a // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary // operation symbol like $+$ or $-$ or $\times$, where the relation or // binary operation is on the ``outer level'' of the formula (i.e., not // enclosed in {...} and not part of an \over construction)." var parts = []; for (var i = 0; i < expression.length; i++) { parts.push(expression[i]); if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) { // Put any post-operator glue on same line as operator. // Watch for \nobreak along the way, and stop at \newline. var nobreak = false; while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) { i++; parts.push(expression[i]); if (expression[i].hasClass("nobreak")) { nobreak = true; } } // Don't allow break if \nobreak among the post-operator glue. if (!nobreak) { children.push(buildHTMLUnbreakable(parts, options)); parts = []; } } else if (expression[i].hasClass("newline")) { // Write the line except the newline parts.pop(); if (parts.length > 0) { children.push(buildHTMLUnbreakable(parts, options)); parts = []; } // Put the newline at the top level children.push(expression[i]); } } if (parts.length > 0) { children.push(buildHTMLUnbreakable(parts, options)); } // Now, if there was a tag, build it too and append it as a final child. var tagChild; if (tag) { tagChild = buildHTMLUnbreakable(buildHTML_buildExpression(tag, options, true)); tagChild.classes = ["tag"]; children.push(tagChild); } var htmlNode = buildHTML_makeSpan(["katex-html"], children); htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children // (the height of the enclosing htmlNode) for proper vertical alignment. if (tagChild) { var strut = tagChild.children[0]; strut.style.height = htmlNode.height + htmlNode.depth + "em"; strut.style.verticalAlign = -htmlNode.depth + "em"; } return htmlNode; } // CONCATENATED MODULE: ./src/mathMLTree.js /** * These objects store data about MathML nodes. This is the MathML equivalent * of the types in domTree.js. Since MathML handles its own rendering, and * since we're mainly using MathML to improve accessibility, we don't manage * any of the styling state that the plain DOM nodes do. * * The `toNode` and `toMarkup` functions work simlarly to how they do in * domTree.js, creating namespaced DOM nodes and HTML text markup respectively. */ function newDocumentFragment(children) { return new tree_DocumentFragment(children); } /** * This node represents a general purpose MathML node of any type. The * constructor requires the type of node to create (for example, `"mo"` or * `"mspace"`, corresponding to `` and `` tags). */ var mathMLTree_MathNode = /*#__PURE__*/ function () { function MathNode(type, children) { this.type = void 0; this.attributes = void 0; this.children = void 0; this.type = type; this.attributes = {}; this.children = children || []; } /** * Sets an attribute on a MathML node. MathML depends on attributes to convey a * semantic content, so this is used heavily. */ var _proto = MathNode.prototype; _proto.setAttribute = function setAttribute(name, value) { this.attributes[name] = value; } /** * Gets an attribute on a MathML node. */ ; _proto.getAttribute = function getAttribute(name) { return this.attributes[name]; } /** * Converts the math node into a MathML-namespaced DOM element. */ ; _proto.toNode = function toNode() { var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } for (var i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; } /** * Converts the math node into an HTML markup string. */ ; _proto.toMarkup = function toMarkup() { var markup = "<" + this.type; // Add the attributes for (var attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { markup += " " + attr + "=\""; markup += utils.escape(this.attributes[attr]); markup += "\""; } } markup += ">"; for (var i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } markup += ""; return markup; } /** * Converts the math node into a string, similar to innerText, but escaped. */ ; _proto.toText = function toText() { return this.children.map(function (child) { return child.toText(); }).join(""); }; return MathNode; }(); /** * This node represents a piece of text. */ var mathMLTree_TextNode = /*#__PURE__*/ function () { function TextNode(text) { this.text = void 0; this.text = text; } /** * Converts the text node into a DOM text node. */ var _proto2 = TextNode.prototype; _proto2.toNode = function toNode() { return document.createTextNode(this.text); } /** * Converts the text node into escaped HTML markup * (representing the text itself). */ ; _proto2.toMarkup = function toMarkup() { return utils.escape(this.toText()); } /** * Converts the text node into a string * (representing the text iteself). */ ; _proto2.toText = function toText() { return this.text; }; return TextNode; }(); /** * This node represents a space, but may render as or as text, * depending on the width. */ var SpaceNode = /*#__PURE__*/ function () { /** * Create a Space node with width given in CSS ems. */ function SpaceNode(width) { this.width = void 0; this.character = void 0; this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html // for a table of space-like characters. We use Unicode // representations instead of &LongNames; as it's not clear how to // make the latter via document.createTextNode. if (width >= 0.05555 && width <= 0.05556) { this.character = "\u200A"; //   } else if (width >= 0.1666 && width <= 0.1667) { this.character = "\u2009"; //   } else if (width >= 0.2222 && width <= 0.2223) { this.character = "\u2005"; //   } else if (width >= 0.2777 && width <= 0.2778) { this.character = "\u2005\u200A"; //    } else if (width >= -0.05556 && width <= -0.05555) { this.character = "\u200A\u2063"; // ​ } else if (width >= -0.1667 && width <= -0.1666) { this.character = "\u2009\u2063"; // ​ } else if (width >= -0.2223 && width <= -0.2222) { this.character = "\u205F\u2063"; // ​ } else if (width >= -0.2778 && width <= -0.2777) { this.character = "\u2005\u2063"; // ​ } else { this.character = null; } } /** * Converts the math node into a MathML-namespaced DOM element. */ var _proto3 = SpaceNode.prototype; _proto3.toNode = function toNode() { if (this.character) { return document.createTextNode(this.character); } else { var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); node.setAttribute("width", this.width + "em"); return node; } } /** * Converts the math node into an HTML markup string. */ ; _proto3.toMarkup = function toMarkup() { if (this.character) { return "" + this.character + ""; } else { return ""; } } /** * Converts the math node into a string, similar to innerText. */ ; _proto3.toText = function toText() { if (this.character) { return this.character; } else { return " "; } }; return SpaceNode; }(); /* harmony default export */ var mathMLTree = ({ MathNode: mathMLTree_MathNode, TextNode: mathMLTree_TextNode, SpaceNode: SpaceNode, newDocumentFragment: newDocumentFragment }); // CONCATENATED MODULE: ./src/buildMathML.js /** * This file converts a parse tree into a cooresponding MathML tree. The main * entry point is the `buildMathML` function, which takes a parse tree from the * parser. */ /** * Takes a symbol and converts it into a MathML text node after performing * optional replacement from symbols.js. */ var buildMathML_makeText = function makeText(text, mode, options) { if (src_symbols[mode][text] && src_symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) { text = src_symbols[mode][text].replace; } return new mathMLTree.TextNode(text); }; /** * Wrap the given array of nodes in an node if needed, i.e., * unless the array has length 1. Always returns a single node. */ var buildMathML_makeRow = function makeRow(body) { if (body.length === 1) { return body[0]; } else { return new mathMLTree.MathNode("mrow", body); } }; /** * Returns the math variant as a string or null if none is required. */ var buildMathML_getVariant = function getVariant(group, options) { // Handle \text... font specifiers as best we can. // MathML has a limited list of allowable mathvariant specifiers; see // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt if (options.fontFamily === "texttt") { return "monospace"; } else if (options.fontFamily === "textsf") { if (options.fontShape === "textit" && options.fontWeight === "textbf") { return "sans-serif-bold-italic"; } else if (options.fontShape === "textit") { return "sans-serif-italic"; } else if (options.fontWeight === "textbf") { return "bold-sans-serif"; } else { return "sans-serif"; } } else if (options.fontShape === "textit" && options.fontWeight === "textbf") { return "bold-italic"; } else if (options.fontShape === "textit") { return "italic"; } else if (options.fontWeight === "textbf") { return "bold"; } var font = options.font; if (!font || font === "mathnormal") { return null; } var mode = group.mode; if (font === "mathit") { return "italic"; } else if (font === "boldsymbol") { return group.type === "textord" ? "bold" : "bold-italic"; } else if (font === "mathbf") { return "bold"; } else if (font === "mathbb") { return "double-struck"; } else if (font === "mathfrak") { return "fraktur"; } else if (font === "mathscr" || font === "mathcal") { // MathML makes no distinction between script and caligrahpic return "script"; } else if (font === "mathsf") { return "sans-serif"; } else if (font === "mathtt") { return "monospace"; } var text = group.text; if (utils.contains(["\\imath", "\\jmath"], text)) { return null; } if (src_symbols[mode][text] && src_symbols[mode][text].replace) { text = src_symbols[mode][text].replace; } var fontName = buildCommon.fontMap[font].fontName; if (getCharacterMetrics(text, fontName, mode)) { return buildCommon.fontMap[font].variant; } return null; }; /** * Takes a list of nodes, builds them, and returns a list of the generated * MathML nodes. Also combine consecutive outputs into a single * tag. */ var buildMathML_buildExpression = function buildExpression(expression, options, isOrdgroup) { if (expression.length === 1) { var group = buildMathML_buildGroup(expression[0], options); if (isOrdgroup && group instanceof mathMLTree_MathNode && group.type === "mo") { // When TeX writers want to suppress spacing on an operator, // they often put the operator by itself inside braces. group.setAttribute("lspace", "0em"); group.setAttribute("rspace", "0em"); } return [group]; } var groups = []; var lastGroup; for (var i = 0; i < expression.length; i++) { var _group = buildMathML_buildGroup(expression[i], options); if (_group instanceof mathMLTree_MathNode && lastGroup instanceof mathMLTree_MathNode) { // Concatenate adjacent s if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) { var _lastGroup$children; (_lastGroup$children = lastGroup.children).push.apply(_lastGroup$children, _group.children); continue; // Concatenate adjacent s } else if (_group.type === 'mn' && lastGroup.type === 'mn') { var _lastGroup$children2; (_lastGroup$children2 = lastGroup.children).push.apply(_lastGroup$children2, _group.children); continue; // Concatenate ... followed by . } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') { var child = _group.children[0]; if (child instanceof mathMLTree_TextNode && child.text === '.') { var _lastGroup$children3; (_lastGroup$children3 = lastGroup.children).push.apply(_lastGroup$children3, _group.children); continue; } } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) { var lastChild = lastGroup.children[0]; if (lastChild instanceof mathMLTree_TextNode && lastChild.text === "\u0338" && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) { var _child = _group.children[0]; if (_child instanceof mathMLTree_TextNode && _child.text.length > 0) { // Overlay with combining character long solidus _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1); groups.pop(); } } } } groups.push(_group); lastGroup = _group; } return groups; }; /** * Equivalent to buildExpression, but wraps the elements in an * if there's more than one. Returns a single node instead of an array. */ var buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) { return buildMathML_makeRow(buildMathML_buildExpression(expression, options, isOrdgroup)); }; /** * Takes a group from the parser and calls the appropriate groupBuilders function * on it to produce a MathML node. */ var buildMathML_buildGroup = function buildGroup(group, options) { if (!group) { return new mathMLTree.MathNode("mrow"); } if (_mathmlGroupBuilders[group.type]) { // Call the groupBuilders function var result = _mathmlGroupBuilders[group.type](group, options); return result; } else { throw new src_ParseError("Got group of unknown type: '" + group.type + "'"); } }; /** * Takes a full parse tree and settings and builds a MathML representation of * it. In particular, we put the elements from building the parse tree into a * tag so we can also include that TeX source as an annotation. * * Note that we actually return a domTree element with a `` inside it so * we can do appropriate styling. */ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) { var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics // tag correctly, unless it's a single or . var wrapper; if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) { wrapper = expression[0]; } else { wrapper = new mathMLTree.MathNode("mrow", expression); } // Build a TeX annotation of the source var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]); annotation.setAttribute("encoding", "application/x-tex"); var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); var math = new mathMLTree.MathNode("math", [semantics]); math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"); if (isDisplayMode) { math.setAttribute("display", "block"); } // You can't style nodes, so we wrap the node in a span. // NOTE: The span class is not typed to have nodes as children, and // we don't want to make the children type more generic since the children // of span are expected to have more fields in `buildHtml` contexts. var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe return buildCommon.makeSpan([wrapperClass], [math]); } // CONCATENATED MODULE: ./src/buildTree.js var buildTree_optionsFromSettings = function optionsFromSettings(settings) { return new src_Options({ style: settings.displayMode ? src_Style.DISPLAY : src_Style.TEXT, maxSize: settings.maxSize, minRuleThickness: settings.minRuleThickness }); }; var buildTree_displayWrap = function displayWrap(node, settings) { if (settings.displayMode) { var classes = ["katex-display"]; if (settings.leqno) { classes.push("leqno"); } if (settings.fleqn) { classes.push("fleqn"); } node = buildCommon.makeSpan(classes, [node]); } return node; }; var buildTree_buildTree = function buildTree(tree, expression, settings) { var options = buildTree_optionsFromSettings(settings); var katexNode; if (settings.output === "mathml") { return buildMathML(tree, expression, options, settings.displayMode, true); } else if (settings.output === "html") { var htmlNode = buildHTML(tree, options); katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); } else { var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false); var _htmlNode = buildHTML(tree, options); katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]); } return buildTree_displayWrap(katexNode, settings); }; var buildTree_buildHTMLTree = function buildHTMLTree(tree, expression, settings) { var options = buildTree_optionsFromSettings(settings); var htmlNode = buildHTML(tree, options); var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); return buildTree_displayWrap(katexNode, settings); }; /* harmony default export */ var src_buildTree = (buildTree_buildTree); // CONCATENATED MODULE: ./src/stretchy.js /** * This file provides support to buildMathML.js and buildHTML.js * for stretchy wide elements rendered from SVG files * and other CSS trickery. */ var stretchyCodePoint = { widehat: "^", widecheck: "ˇ", widetilde: "~", utilde: "~", overleftarrow: "\u2190", underleftarrow: "\u2190", xleftarrow: "\u2190", overrightarrow: "\u2192", underrightarrow: "\u2192", xrightarrow: "\u2192", underbrace: "\u23DF", overbrace: "\u23DE", overgroup: "\u23E0", undergroup: "\u23E1", overleftrightarrow: "\u2194", underleftrightarrow: "\u2194", xleftrightarrow: "\u2194", Overrightarrow: "\u21D2", xRightarrow: "\u21D2", overleftharpoon: "\u21BC", xleftharpoonup: "\u21BC", overrightharpoon: "\u21C0", xrightharpoonup: "\u21C0", xLeftarrow: "\u21D0", xLeftrightarrow: "\u21D4", xhookleftarrow: "\u21A9", xhookrightarrow: "\u21AA", xmapsto: "\u21A6", xrightharpoondown: "\u21C1", xleftharpoondown: "\u21BD", xrightleftharpoons: "\u21CC", xleftrightharpoons: "\u21CB", xtwoheadleftarrow: "\u219E", xtwoheadrightarrow: "\u21A0", xlongequal: "=", xtofrom: "\u21C4", xrightleftarrows: "\u21C4", xrightequilibrium: "\u21CC", // Not a perfect match. xleftequilibrium: "\u21CB" // None better available. }; var stretchy_mathMLnode = function mathMLnode(label) { var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]); node.setAttribute("stretchy", "true"); return node; }; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. // Copyright (c) 2009-2010, Design Science, Inc. () // Copyright (c) 2014-2017 Khan Academy () // Licensed under the SIL Open Font License, Version 1.1. // See \nhttp://scripts.sil.org/OFL // Very Long SVGs // Many of the KaTeX stretchy wide elements use a long SVG image and an // overflow: hidden tactic to achieve a stretchy image while avoiding // distortion of arrowheads or brace corners. // The SVG typically contains a very long (400 em) arrow. // The SVG is in a container span that has overflow: hidden, so the span // acts like a window that exposes only part of the SVG. // The SVG always has a longer, thinner aspect ratio than the container span. // After the SVG fills 100% of the height of the container span, // there is a long arrow shaft left over. That left-over shaft is not shown. // Instead, it is sliced off because the span's CSS has overflow: hidden. // Thus, the reader sees an arrow that matches the subject matter width // without distortion. // Some functions, such as \cancel, need to vary their aspect ratio. These // functions do not get the overflow SVG treatment. // Second Brush Stroke // Low resolution monitors struggle to display images in fine detail. // So browsers apply anti-aliasing. A long straight arrow shaft therefore // will sometimes appear as if it has a blurred edge. // To mitigate this, these SVG files contain a second "brush-stroke" on the // arrow shafts. That is, a second long thin rectangular SVG path has been // written directly on top of each arrow shaft. This reinforcement causes // some of the screen pixels to display as black instead of the anti-aliased // gray pixel that a single path would generate. So we get arrow shafts // whose edges appear to be sharper. // In the katexImagesData object just below, the dimensions all // correspond to path geometry inside the relevant SVG. // For example, \overrightarrow uses the same arrowhead as glyph U+2192 // from the KaTeX Main font. The scaling factor is 1000. // That is, inside the font, that arrowhead is 522 units tall, which // corresponds to 0.522 em inside the document. var katexImagesData = { // path(s), minWidth, height, align overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], overgroup: [["leftgroup", "rightgroup"], 0.888, 342], undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], // The next three arrows are from the mhchem package. // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the // document as \xrightarrow or \xrightleftharpoons. Those have // min-length = 1.75em, so we set min-length on these next three to match. xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] }; var groupLength = function groupLength(arg) { if (arg.type === "ordgroup") { return arg.body.length; } else { return 1; } }; var stretchy_svgSpan = function svgSpan(group, options) { // Create a span with inline SVG for the element. function buildSvgSpan_() { var viewBoxWidth = 400000; // default var label = group.label.substr(1); if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) { // Each type in the `if` statement corresponds to one of the ParseNode // types below. This narrowing is required to access `grp.base`. var grp = group; // There are four SVG images available for each function. // Choose a taller image when there are more characters. var numChars = groupLength(grp.base); var viewBoxHeight; var pathName; var _height; if (numChars > 5) { if (label === "widehat" || label === "widecheck") { viewBoxHeight = 420; viewBoxWidth = 2364; _height = 0.42; pathName = label + "4"; } else { viewBoxHeight = 312; viewBoxWidth = 2340; _height = 0.34; pathName = "tilde4"; } } else { var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; if (label === "widehat" || label === "widecheck") { viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; pathName = label + imgIndex; } else { viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; pathName = "tilde" + imgIndex; } } var path = new domTree_PathNode(pathName); var svgNode = new SvgNode([path], { "width": "100%", "height": _height + "em", "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight, "preserveAspectRatio": "none" }); return { span: buildCommon.makeSvgSpan([], [svgNode], options), minWidth: 0, height: _height }; } else { var spans = []; var data = katexImagesData[label]; var paths = data[0], _minWidth = data[1], _viewBoxHeight = data[2]; var _height2 = _viewBoxHeight / 1000; var numSvgChildren = paths.length; var widthClasses; var aligns; if (numSvgChildren === 1) { // $FlowFixMe: All these cases must be of the 4-tuple type. var align1 = data[3]; widthClasses = ["hide-tail"]; aligns = [align1]; } else if (numSvgChildren === 2) { widthClasses = ["halfarrow-left", "halfarrow-right"]; aligns = ["xMinYMin", "xMaxYMin"]; } else if (numSvgChildren === 3) { widthClasses = ["brace-left", "brace-center", "brace-right"]; aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; } else { throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children."); } for (var i = 0; i < numSvgChildren; i++) { var _path = new domTree_PathNode(paths[i]); var _svgNode = new SvgNode([_path], { "width": "400em", "height": _height2 + "em", "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight, "preserveAspectRatio": aligns[i] + " slice" }); var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options); if (numSvgChildren === 1) { return { span: _span, minWidth: _minWidth, height: _height2 }; } else { _span.style.height = _height2 + "em"; spans.push(_span); } } return { span: buildCommon.makeSpan(["stretchy"], spans, options), minWidth: _minWidth, height: _height2 }; } } // buildSvgSpan_() var _buildSvgSpan_ = buildSvgSpan_(), span = _buildSvgSpan_.span, minWidth = _buildSvgSpan_.minWidth, height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0. // Any adjustments relative to the baseline must be done in buildHTML. span.height = height; span.style.height = height + "em"; if (minWidth > 0) { span.style.minWidth = minWidth + "em"; } return span; }; var stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) { // Return an image span for \cancel, \bcancel, \xcancel, or \fbox var img; var totalHeight = inner.height + inner.depth + 2 * pad; if (/fbox|color/.test(label)) { img = buildCommon.makeSpan(["stretchy", label], [], options); if (label === "fbox") { var color = options.color && options.getColor(); if (color) { img.style.borderColor = color; } } } else { // \cancel, \bcancel, or \xcancel // Since \cancel's SVG is inline and it omits the viewBox attribute, // its stroke-width will not vary with span area. var lines = []; if (/^[bx]cancel$/.test(label)) { lines.push(new LineNode({ "x1": "0", "y1": "0", "x2": "100%", "y2": "100%", "stroke-width": "0.046em" })); } if (/^x?cancel$/.test(label)) { lines.push(new LineNode({ "x1": "0", "y1": "100%", "x2": "100%", "y2": "0", "stroke-width": "0.046em" })); } var svgNode = new SvgNode(lines, { "width": "100%", "height": totalHeight + "em" }); img = buildCommon.makeSvgSpan([], [svgNode], options); } img.height = totalHeight; img.style.height = totalHeight + "em"; return img; }; /* harmony default export */ var stretchy = ({ encloseSpan: stretchy_encloseSpan, mathMLnode: stretchy_mathMLnode, svgSpan: stretchy_svgSpan }); // CONCATENATED MODULE: ./src/parseNode.js /** * Asserts that the node is of the given type and returns it with stricter * typing. Throws if the node's type does not match. */ function assertNodeType(node, type) { if (!node || node.type !== type) { throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node))); } return node; } /** * Returns the node more strictly typed iff it is of the given type. Otherwise, * returns null. */ function assertSymbolNodeType(node) { var typedNode = checkSymbolNodeType(node); if (!typedNode) { throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node))); } return typedNode; } /** * Returns the node more strictly typed iff it is of the given type. Otherwise, * returns null. */ function checkSymbolNodeType(node) { if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) { // $FlowFixMe return node; } return null; } // CONCATENATED MODULE: ./src/functions/accent.js // NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but var accent_htmlBuilder = function htmlBuilder(grp, options) { // Accents are handled in the TeXbook pg. 443, rule 12. var base; var group; var supSubGroup; if (grp && grp.type === "supsub") { // If our base is a character box, and we have superscripts and // subscripts, the supsub will defer to us. In particular, we want // to attach the superscripts and subscripts to the inner body (so // that the position of the superscripts and subscripts won't be // affected by the height of the accent). We accomplish this by // sticking the base of the accent into the base of the supsub, and // rendering that, while keeping track of where the accent is. // The real accent group is the base of the supsub group group = assertNodeType(grp.base, "accent"); // The character box is the base of the accent group base = group.base; // Stick the character box into the base of the supsub group grp.base = base; // Rerender the supsub group with its new base, and store that // result. supSubGroup = assertSpan(buildHTML_buildGroup(grp, options)); // reset original base grp.base = group; } else { group = assertNodeType(grp, "accent"); base = group.base; } // Build the base group var body = buildHTML_buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the // nucleus is not a single character, let s = 0; otherwise set s to the // kern amount for the nucleus followed by the \skewchar of its font." // Note that our skew metrics are just the kern between each character // and the skewchar. var skew = 0; if (mustShift) { // If the base is a character box, then we want the skew of the // innermost character. To do that, we find the innermost character: var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it var baseGroup = buildHTML_buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we // removed with getBaseElem might contain things like \color which // we can't get rid of. // TODO(emily): Find a better way to get the skew } // calculate the amount of space between the body and the accent var clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent var accentBody; if (!group.isStretchy) { var accent; var width; if (group.label === "\\vec") { // Before version 0.9, \vec used the combining font glyph U+20D7. // But browsers, especially Safari, are not consistent in how they // render combining characters when not preceded by a character. // So now we use an SVG. // If Safari reforms, we should consider reverting to the glyph. accent = buildCommon.staticSvg("vec", options); width = buildCommon.svgData.vec[1]; } else { accent = buildCommon.makeOrd({ mode: group.mode, text: group.label }, options, "textord"); accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to // shift the accent over to a place we don't want. accent.italic = 0; width = accent.width; } accentBody = buildCommon.makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be // at least the width of the accent, and overlap directly onto the // character without any vertical offset. var accentFull = group.label === "\\textcircled"; if (accentFull) { accentBody.classes.push('accent-full'); clearance = body.height; } // Shift the accent over by the skew. var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }` // so that the accent doesn't contribute to the bounding box. // We need to shift the character by its width (effectively half // its width) to compensate. if (!accentFull) { left -= width / 2; } accentBody.style.left = left + "em"; // \textcircled uses the \bigcirc glyph, so it needs some // vertical adjustment to match LaTeX. if (group.label === "\\textcircled") { accentBody.style.top = ".2em"; } accentBody = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "kern", size: -clearance }, { type: "elem", elem: accentBody }] }, options); } else { accentBody = stretchy.svgSpan(group, options); accentBody = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "elem", elem: accentBody, wrapperClasses: ["svg-align"], wrapperStyle: skew > 0 ? { width: "calc(100% - " + 2 * skew + "em)", marginLeft: 2 * skew + "em" } : undefined }] }, options); } var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options); if (supSubGroup) { // Here, we replace the "base" child of the supsub with our newly // generated accent. supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the // accent, we manually recalculate height. supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not. supSubGroup.classes[0] = "mord"; return supSubGroup; } else { return accentWrap; } }; var accent_mathmlBuilder = function mathmlBuilder(group, options) { var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [buildMathML_makeText(group.label, group.mode)]); var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.base, options), accentNode]); node.setAttribute("accent", "true"); return node; }; var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(function (accent) { return "\\" + accent; }).join("|")); // Accents defineFunction({ type: "accent", names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], props: { numArgs: 1 }, handler: function handler(context, args) { var base = args[0]; var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; return { type: "accent", mode: context.parser.mode, label: context.funcName, isStretchy: isStretchy, isShifty: isShifty, base: base }; }, htmlBuilder: accent_htmlBuilder, mathmlBuilder: accent_mathmlBuilder }); // Text-mode accents defineFunction({ type: "accent", names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v", "\\textcircled"], props: { numArgs: 1, allowedInText: true, allowedInMath: false }, handler: function handler(context, args) { var base = args[0]; return { type: "accent", mode: context.parser.mode, label: context.funcName, isStretchy: false, isShifty: true, base: base }; }, htmlBuilder: accent_htmlBuilder, mathmlBuilder: accent_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/accentunder.js // Horizontal overlap functions defineFunction({ type: "accentUnder", names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var base = args[0]; return { type: "accentUnder", mode: parser.mode, label: funcName, base: base }; }, htmlBuilder: function htmlBuilder(group, options) { // Treat under accents much like underlines. var innerGroup = buildHTML_buildGroup(group.base, options); var accentBody = stretchy.svgSpan(group, options); var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns var vlist = buildCommon.makeVList({ positionType: "top", positionData: innerGroup.height, children: [{ type: "elem", elem: accentBody, wrapperClasses: ["svg-align"] }, { type: "kern", size: kern }, { type: "elem", elem: innerGroup }] }, options); return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var accentNode = stretchy.mathMLnode(group.label); var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.base, options), accentNode]); node.setAttribute("accentunder", "true"); return node; } }); // CONCATENATED MODULE: ./src/functions/arrow.js // Helper function var arrow_paddedNode = function paddedNode(group) { var node = new mathMLTree.MathNode("mpadded", group ? [group] : []); node.setAttribute("width", "+0.6em"); node.setAttribute("lspace", "0.3em"); return node; }; // Stretchy arrows with an optional argument defineFunction({ type: "xArrow", names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension. // Direct use of these functions is discouraged and may break someday. "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"], props: { numArgs: 1, numOptionalArgs: 1 }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser, funcName = _ref.funcName; return { type: "xArrow", mode: parser.mode, label: funcName, body: args[0], below: optArgs[0] }; }, // Flow is unable to correctly infer the type of `group`, even though it's // unamibiguously determined from the passed-in `type` above. htmlBuilder: function htmlBuilder(group, options) { var style = options.style; // Build the argument groups in the appropriate style. // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% // Some groups can return document fragments. Handle those by wrapping // them in a span. var newOptions = options.havingStyle(style.sup()); var upperGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, newOptions, options), options); upperGroup.classes.push("x-arrow-pad"); var lowerGroup; if (group.below) { // Build the lower group newOptions = options.havingStyle(style.sub()); lowerGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.below, newOptions, options), options); lowerGroup.classes.push("x-arrow-pad"); } var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. // The point we want on the math axis is at 0.5 * arrowBody.height. var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") { upperShift -= upperGroup.depth; // shift up if depth encroaches } // Generate the vlist var vlist; if (lowerGroup) { var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; vlist = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }, { type: "elem", elem: lowerGroup, shift: lowerShift }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }] }, options); } // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[1].classes.push("svg-align"); return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var arrowNode = stretchy.mathMLnode(group.label); var node; if (group.body) { var upperNode = arrow_paddedNode(buildMathML_buildGroup(group.body, options)); if (group.below) { var lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options)); node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]); } else { node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); } } else if (group.below) { var _lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options)); node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]); } else { // This should never happen. // Parser.js throws an error if there is no argument. node = arrow_paddedNode(); node = new mathMLTree.MathNode("mover", [arrowNode, node]); } return node; } }); // CONCATENATED MODULE: ./src/functions/char.js // \@char is an internal function that takes a grouped decimal argument like // {123} and converts into symbol with code 123. It is used by the *macro* // \char defined in macros.js. defineFunction({ type: "textord", names: ["\\@char"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; var arg = assertNodeType(args[0], "ordgroup"); var group = arg.body; var number = ""; for (var i = 0; i < group.length; i++) { var node = assertNodeType(group[i], "textord"); number += node.text; } var code = parseInt(number); if (isNaN(code)) { throw new src_ParseError("\\@char has non-numeric argument " + number); } return { type: "textord", mode: parser.mode, text: String.fromCharCode(code) }; } }); // CONCATENATED MODULE: ./src/functions/color.js var color_htmlBuilder = function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. // To accomplish this, we wrap the results in a fragment, so the inner // elements will be able to directly interact with their neighbors. For // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` return buildCommon.makeFragment(elements); }; var color_mathmlBuilder = function mathmlBuilder(group, options) { var inner = buildMathML_buildExpression(group.body, options.withColor(group.color)); var node = new mathMLTree.MathNode("mstyle", inner); node.setAttribute("mathcolor", group.color); return node; }; defineFunction({ type: "color", names: ["\\textcolor"], props: { numArgs: 2, allowedInText: true, greediness: 3, argTypes: ["color", "original"] }, handler: function handler(_ref, args) { var parser = _ref.parser; var color = assertNodeType(args[0], "color-token").color; var body = args[1]; return { type: "color", mode: parser.mode, color: color, body: ordargument(body) }; }, htmlBuilder: color_htmlBuilder, mathmlBuilder: color_mathmlBuilder }); defineFunction({ type: "color", names: ["\\color"], props: { numArgs: 1, allowedInText: true, greediness: 3, argTypes: ["color"] }, handler: function handler(_ref2, args) { var parser = _ref2.parser, breakOnTokenText = _ref2.breakOnTokenText; var color = assertNodeType(args[0], "color-token").color; // Set macro \current@color in current namespace to store the current // color, mimicking the behavior of color.sty. // This is currently used just to correctly color a \right // that follows a \color command. parser.gullet.macros.set("\\current@color", color); // Parse out the implicit body that should be colored. var body = parser.parseExpression(true, breakOnTokenText); return { type: "color", mode: parser.mode, color: color, body: body }; }, htmlBuilder: color_htmlBuilder, mathmlBuilder: color_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/cr.js // Row breaks within tabular environments, and line breaks at top level // \\ is a macro mapping to either \cr or \newline. Because they have the // same signature, we implement them as one megafunction, with newRow // indicating whether we're in the \cr case, and newLine indicating whether // to break the line in the \newline case. defineFunction({ type: "cr", names: ["\\cr", "\\newline"], props: { numArgs: 0, numOptionalArgs: 1, argTypes: ["size"], allowedInText: true }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser, funcName = _ref.funcName; var size = optArgs[0]; var newRow = funcName === "\\cr"; var newLine = false; if (!newRow) { if (parser.settings.displayMode && parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode")) { newLine = false; } else { newLine = true; } } return { type: "cr", mode: parser.mode, newLine: newLine, newRow: newRow, size: size && assertNodeType(size, "size").value }; }, // The following builders are called only at the top level, // not within tabular/array environments. htmlBuilder: function htmlBuilder(group, options) { if (group.newRow) { throw new src_ParseError("\\cr valid only within a tabular/array environment"); } var span = buildCommon.makeSpan(["mspace"], [], options); if (group.newLine) { span.classes.push("newline"); if (group.size) { span.style.marginTop = units_calculateSize(group.size, options) + "em"; } } return span; }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mspace"); if (group.newLine) { node.setAttribute("linebreak", "newline"); if (group.size) { node.setAttribute("height", units_calculateSize(group.size, options) + "em"); } } return node; } }); // CONCATENATED MODULE: ./src/functions/def.js var globalMap = { "\\global": "\\global", "\\long": "\\\\globallong", "\\\\globallong": "\\\\globallong", "\\def": "\\gdef", "\\gdef": "\\gdef", "\\edef": "\\xdef", "\\xdef": "\\xdef", "\\let": "\\\\globallet", "\\futurelet": "\\\\globalfuture" }; var def_checkControlSequence = function checkControlSequence(tok) { var name = tok.text; if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { throw new src_ParseError("Expected a control sequence", tok); } return name; }; var getRHS = function getRHS(parser) { var tok = parser.gullet.popToken(); if (tok.text === "=") { // consume optional equals tok = parser.gullet.popToken(); if (tok.text === " ") { // consume one optional space tok = parser.gullet.popToken(); } } return tok; }; var letCommand = function letCommand(parser, name, tok, global) { var macro = parser.gullet.macros.get(tok.text); if (macro == null) { // don't expand it later even if a macro with the same name is defined // e.g., \let\foo=\frac \def\frac{\relax} \frac12 tok.noexpand = true; macro = { tokens: [tok], numArgs: 0, // reproduce the same behavior in expansion unexpandable: !parser.gullet.isExpandable(tok.text) }; } parser.gullet.macros.set(name, macro, global); }; // -> | // -> |\global // -> | // -> \global|\long|\outer defineFunction({ type: "internal", names: ["\\global", "\\long", "\\\\globallong"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref) { var parser = _ref.parser, funcName = _ref.funcName; parser.consumeSpaces(); var token = parser.fetch(); if (globalMap[token.text]) { // KaTeX doesn't have \par, so ignore \long if (funcName === "\\global" || funcName === "\\\\globallong") { token.text = globalMap[token.text]; } return assertNodeType(parser.parseFunction(), "internal"); } throw new src_ParseError("Invalid token after macro prefix", token); } }); // Basic support for macro definitions: \def, \gdef, \edef, \xdef // -> // -> \def|\gdef|\edef|\xdef // -> defineFunction({ type: "internal", names: ["\\def", "\\gdef", "\\edef", "\\xdef"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref2) { var parser = _ref2.parser, funcName = _ref2.funcName; var arg = parser.gullet.consumeArgs(1)[0]; if (arg.length !== 1) { throw new src_ParseError("\\gdef's first argument must be a macro name"); } var name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ... var numArgs = 0; arg = parser.gullet.consumeArgs(1)[0]; while (arg.length === 1 && arg[0].text === "#") { arg = parser.gullet.consumeArgs(1)[0]; if (arg.length !== 1) { throw new src_ParseError("Invalid argument number length \"" + arg.length + "\""); } if (!/^[1-9]$/.test(arg[0].text)) { throw new src_ParseError("Invalid argument number \"" + arg[0].text + "\""); } numArgs++; if (parseInt(arg[0].text) !== numArgs) { throw new src_ParseError("Argument number \"" + arg[0].text + "\" out of order"); } arg = parser.gullet.consumeArgs(1)[0]; } if (funcName === "\\edef" || funcName === "\\xdef") { arg = parser.gullet.expandTokens(arg); arg.reverse(); // to fit in with stack order } // Final arg is the expansion of the macro parser.gullet.macros.set(name, { tokens: arg, numArgs: numArgs }, funcName === globalMap[funcName]); return { type: "internal", mode: parser.mode }; } }); // -> // -> \futurelet // | \let // -> |= defineFunction({ type: "internal", names: ["\\let", "\\\\globallet"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref3) { var parser = _ref3.parser, funcName = _ref3.funcName; var name = def_checkControlSequence(parser.gullet.popToken()); parser.gullet.consumeSpaces(); var tok = getRHS(parser); letCommand(parser, name, tok, funcName === "\\\\globallet"); return { type: "internal", mode: parser.mode }; } }); // ref: https://www.tug.org/TUGboat/tb09-3/tb22bechtolsheim.pdf defineFunction({ type: "internal", names: ["\\futurelet", "\\\\globalfuture"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref4) { var parser = _ref4.parser, funcName = _ref4.funcName; var name = def_checkControlSequence(parser.gullet.popToken()); var middle = parser.gullet.popToken(); var tok = parser.gullet.popToken(); letCommand(parser, name, tok, funcName === "\\\\globalfuture"); parser.gullet.pushToken(tok); parser.gullet.pushToken(middle); return { type: "internal", mode: parser.mode }; } }); // CONCATENATED MODULE: ./src/delimiter.js /** * This file deals with creating delimiters of various sizes. The TeXbook * discusses these routines on page 441-442, in the "Another subroutine sets box * x to a specified variable delimiter" paragraph. * * There are three main routines here. `makeSmallDelim` makes a delimiter in the * normal font, but in either text, script, or scriptscript style. * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1, * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of * smaller pieces that are stacked on top of one another. * * The functions take a parameter `center`, which determines if the delimiter * should be centered around the axis. * * Then, there are three exposed functions. `sizedDelim` makes a delimiter in * one of the given sizes. This is used for things like `\bigl`. * `customSizedDelim` makes a delimiter with a given total height+depth. It is * called in places like `\sqrt`. `leftRightDelim` makes an appropriate * delimiter which surrounds an expression of a given height an depth. It is * used in `\left` and `\right`. */ /** * Get the metrics for a given symbol and font, after transformation (i.e. * after following replacement from symbols.js) */ var delimiter_getMetrics = function getMetrics(symbol, font, mode) { var replace = src_symbols.math[symbol] && src_symbols.math[symbol].replace; var metrics = getCharacterMetrics(replace || symbol, font, mode); if (!metrics) { throw new Error("Unsupported symbol " + symbol + " and font size " + font + "."); } return metrics; }; /** * Puts a delimiter span in a given style, and adds appropriate height, depth, * and maxFontSizes. */ var delimiter_styleWrap = function styleWrap(delim, toStyle, options, classes) { var newOptions = options.havingBaseStyle(toStyle); var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options); var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; span.height *= delimSizeMultiplier; span.depth *= delimSizeMultiplier; span.maxFontSize = newOptions.sizeMultiplier; return span; }; var centerSpan = function centerSpan(span, options, style) { var newOptions = options.havingBaseStyle(style); var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; span.classes.push("delimcenter"); span.style.top = shift + "em"; span.height -= shift; span.depth += shift; }; /** * Makes a small delimiter. This is a delimiter that comes in the Main-Regular * font, but is restyled to either be in textstyle, scriptstyle, or * scriptscriptstyle. */ var delimiter_makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); var span = delimiter_styleWrap(text, style, options, classes); if (center) { centerSpan(span, options, style); } return span; }; /** * Builds a symbol in the given font size (note size is an integer) */ var delimiter_mathrmSize = function mathrmSize(value, size, mode, options) { return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options); }; /** * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2, * Size3, or Size4 fonts. It is always rendered in textstyle. */ var delimiter_makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { var inner = delimiter_mathrmSize(delim, size, mode, options); var span = delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes); if (center) { centerSpan(span, options, src_Style.TEXT); } return span; }; /** * Make an inner span with the given offset and in the given font. This is used * in `makeStackedDelim` to make the stacking pieces for the delimiter. */ var delimiter_makeInner = function makeInner(symbol, font, mode) { var sizeClass; // Apply the correct CSS class to choose the right font. if (font === "Size1-Regular") { sizeClass = "delim-size1"; } else /* if (font === "Size4-Regular") */ { sizeClass = "delim-size4"; } var inner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element // in the appropriate tag that VList uses. return { type: "elem", elem: inner }; }; // Helper for makeStackedDelim var lap = { type: "kern", size: -0.005 }; /** * Make a stacked delimiter out of a given delimiter, with the total height at * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. */ var delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { // There are four parts, the top, an optional middle, a repeated part, and a // bottom. var top; var middle; var repeat; var bottom; top = repeat = bottom = delim; middle = null; // Also keep track of what font the delimiters are in var font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the // repeats of the arrows if (delim === "\\uparrow") { repeat = bottom = "\u23D0"; } else if (delim === "\\Uparrow") { repeat = bottom = "\u2016"; } else if (delim === "\\downarrow") { top = repeat = "\u23D0"; } else if (delim === "\\Downarrow") { top = repeat = "\u2016"; } else if (delim === "\\updownarrow") { top = "\\uparrow"; repeat = "\u23D0"; bottom = "\\downarrow"; } else if (delim === "\\Updownarrow") { top = "\\Uparrow"; repeat = "\u2016"; bottom = "\\Downarrow"; } else if (delim === "[" || delim === "\\lbrack") { top = "\u23A1"; repeat = "\u23A2"; bottom = "\u23A3"; font = "Size4-Regular"; } else if (delim === "]" || delim === "\\rbrack") { top = "\u23A4"; repeat = "\u23A5"; bottom = "\u23A6"; font = "Size4-Regular"; } else if (delim === "\\lfloor" || delim === "\u230A") { repeat = top = "\u23A2"; bottom = "\u23A3"; font = "Size4-Regular"; } else if (delim === "\\lceil" || delim === "\u2308") { top = "\u23A1"; repeat = bottom = "\u23A2"; font = "Size4-Regular"; } else if (delim === "\\rfloor" || delim === "\u230B") { repeat = top = "\u23A5"; bottom = "\u23A6"; font = "Size4-Regular"; } else if (delim === "\\rceil" || delim === "\u2309") { top = "\u23A4"; repeat = bottom = "\u23A5"; font = "Size4-Regular"; } else if (delim === "(" || delim === "\\lparen") { top = "\u239B"; repeat = "\u239C"; bottom = "\u239D"; font = "Size4-Regular"; } else if (delim === ")" || delim === "\\rparen") { top = "\u239E"; repeat = "\u239F"; bottom = "\u23A0"; font = "Size4-Regular"; } else if (delim === "\\{" || delim === "\\lbrace") { top = "\u23A7"; middle = "\u23A8"; bottom = "\u23A9"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\}" || delim === "\\rbrace") { top = "\u23AB"; middle = "\u23AC"; bottom = "\u23AD"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\lgroup" || delim === "\u27EE") { top = "\u23A7"; bottom = "\u23A9"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\rgroup" || delim === "\u27EF") { top = "\u23AB"; bottom = "\u23AD"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\lmoustache" || delim === "\u23B0") { top = "\u23A7"; bottom = "\u23AD"; repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\rmoustache" || delim === "\u23B1") { top = "\u23AB"; bottom = "\u23A9"; repeat = "\u23AA"; font = "Size4-Regular"; } // Get the metrics of the four sections var topMetrics = delimiter_getMetrics(top, font, mode); var topHeightTotal = topMetrics.height + topMetrics.depth; var repeatMetrics = delimiter_getMetrics(repeat, font, mode); var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; var bottomMetrics = delimiter_getMetrics(bottom, font, mode); var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; var middleHeightTotal = 0; var middleFactor = 1; if (middle !== null) { var middleMetrics = delimiter_getMetrics(middle, font, mode); middleHeightTotal = middleMetrics.height + middleMetrics.depth; middleFactor = 2; // repeat symmetrically above and below middle } // Calcuate the minimal height that the delimiter can have. // It is at least the size of the top, bottom, and optional middle combined. var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note // that in this context, "center" means that the delimiter should be // centered around the axis in the current style, while normally it is // centered around the axis in textstyle. var axisHeight = options.fontMetrics().axisHeight; if (center) { axisHeight *= options.sizeMultiplier; } // Calculate the depth var depth = realHeightTotal / 2 - axisHeight; // This function differs from the TeX procedure in one way. // We shift each repeat element downwards by 0.005em, to prevent a gap // due to browser floating point rounding error. // Then, at the last element-to element joint, we add one extra repeat // element to cover the gap created by the shifts. // Find the shift needed to align the upper end of the extra element at a point // 0.005em above the lower end of the top element. var shiftOfExtraElement = (repeatCount + 1) * 0.005 - repeatHeightTotal; // Now, we start building the pieces that will go into the vlist // Keep a list of the inner pieces var inners = []; // Add the bottom symbol inners.push(delimiter_makeInner(bottom, font, mode)); if (middle === null) { // Add that many symbols for (var i = 0; i < repeatCount; i++) { inners.push(lap); // overlap inners.push(delimiter_makeInner(repeat, font, mode)); } } else { // When there is a middle bit, we need the middle part and two repeated // sections for (var _i = 0; _i < repeatCount; _i++) { inners.push(lap); inners.push(delimiter_makeInner(repeat, font, mode)); } // Insert one extra repeat element. inners.push({ type: "kern", size: shiftOfExtraElement }); inners.push(delimiter_makeInner(repeat, font, mode)); inners.push(lap); // Now insert the middle of the brace. inners.push(delimiter_makeInner(middle, font, mode)); for (var _i2 = 0; _i2 < repeatCount; _i2++) { inners.push(lap); inners.push(delimiter_makeInner(repeat, font, mode)); } } // To cover the gap create by the overlaps, insert one more repeat element, // at a position that juts 0.005 above the bottom of the top element. if ((repeat === "\u239C" || repeat === "\u239F") && repeatCount === 0) { // Parentheses need a short repeat element in order to avoid an overrun. // We'll make a 0.3em tall element from a SVG. var overlap = buildCommon.svgData.leftParenInner[2] / 2; inners.push({ type: "kern", size: -overlap }); var pathName = repeat === "\u239C" ? "leftParenInner" : "rightParenInner"; var innerSpan = buildCommon.staticSvg(pathName, options); inners.push({ type: "elem", elem: innerSpan }); inners.push({ type: "kern", size: -overlap }); } else { inners.push({ type: "kern", size: shiftOfExtraElement }); inners.push(delimiter_makeInner(repeat, font, mode)); inners.push(lap); } // Add the top symbol inners.push(delimiter_makeInner(top, font, mode)); // Finally, build the vlist var newOptions = options.havingBaseStyle(src_Style.TEXT); var inner = buildCommon.makeVList({ positionType: "bottom", positionData: depth, children: inners }, newOptions); return delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes); }; // All surds have 0.08em padding above the viniculum inside the SVG. // That keeps browser span height rounding error from pinching the line. var vbPad = 80; // padding above the surd, measured inside the viewBox. var emPad = 0.08; // padding, in ems, measured in the document. var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) { var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight); var pathNode = new domTree_PathNode(sqrtName, path); var svg = new SvgNode([pathNode], { // Note: 1000:1 ratio of viewBox to document em width. "width": "400em", "height": height + "em", "viewBox": "0 0 400000 " + viewBoxHeight, "preserveAspectRatio": "xMinYMin slice" }); return buildCommon.makeSvgSpan(["hide-tail"], [svg], options); }; /** * Make a sqrt image of the given height, */ var makeSqrtImage = function makeSqrtImage(height, options) { // Define a newOptions that removes the effect of size changes such as \Huge. // We don't pick different a height surd for \Huge. For it, we scale up. var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds. var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); var sizeMultiplier = newOptions.sizeMultiplier; // default // The standard sqrt SVGs each have a 0.04em thick viniculum. // If Settings.minRuleThickness is larger than that, we add extraViniculum. var extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol. var span; var spanHeight = 0; var texHeight = 0; var viewBoxHeight = 0; var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd. // Then browser rounding error on the parent span height will not // encroach on the ink of the viniculum. But that padding is not // included in the TeX-like `height` used for calculation of // vertical alignment. So texHeight = span.height < span.style.height. if (delim.type === "small") { // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. // 1000 unit normal glyph height. viewBoxHeight = 1000 + 1000 * extraViniculum + vbPad; if (height < 1.0) { sizeMultiplier = 1.0; // mimic a \textfont radical } else if (height < 1.4) { sizeMultiplier = 0.7; // mimic a \scriptfont radical } spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier; texHeight = (1.00 + extraViniculum) / sizeMultiplier; span = delimiter_sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "0.853em"; advanceWidth = 0.833 / sizeMultiplier; // from the font. } else if (delim.type === "large") { // These SVGs come from fonts: KaTeX_Size1, _Size2, etc. viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier; spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier; span = delimiter_sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "1.02em"; advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font. } else { // Tall sqrt. In TeX, this would be stacked using multiple glyphs. // We'll use a single SVG to accomplish the same thing. spanHeight = height + extraViniculum + emPad; texHeight = height + extraViniculum; viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad; span = delimiter_sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "0.742em"; advanceWidth = 1.056; } span.height = texHeight; span.style.height = spanHeight + "em"; return { span: span, advanceWidth: advanceWidth, // Calculate the actual line width. // This actually should depend on the chosen font -- e.g. \boldmath // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and // have thicker rules. ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraViniculum) * sizeMultiplier }; }; // There are three kinds of delimiters, delimiters that stack when they become // too large var stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1"]; // and delimiters that never stack var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of // $\bigl| // \Bigl| \biggl| \Biggl| \showlists$ // Used to create stacked delimiters of appropriate sizes in makeSizedDelim. var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; /** * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. */ var delimiter_makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { // < and > turn into \langle and \rangle in delimiters if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { delim = "\\rangle"; } // Sized delimiters are never centered. if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) { return delimiter_makeLargeDelim(delim, size, false, options, mode, classes); } else if (utils.contains(stackAlwaysDelimiters, delim)) { return delimiter_makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); } else { throw new src_ParseError("Illegal delimiter: '" + delim + "'"); } }; /** * There are three different sequences of delimiter sizes that the delimiters * follow depending on the kind of delimiter. This is used when creating custom * sized delimiters to decide whether to create a small, large, or stacked * delimiter. * * In real TeX, these sequences aren't explicitly defined, but are instead * defined inside the font metrics. Since there are only three sequences that * are possible for the delimiters that TeX defines, it is easier to just encode * them explicitly here. */ // Delimiters that never stack try small delimiters and large delimiters only var stackNeverDelimiterSequence = [{ type: "small", style: src_Style.SCRIPTSCRIPT }, { type: "small", style: src_Style.SCRIPT }, { type: "small", style: src_Style.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }]; // Delimiters that always stack try the small delimiters first, then stack var stackAlwaysDelimiterSequence = [{ type: "small", style: src_Style.SCRIPTSCRIPT }, { type: "small", style: src_Style.SCRIPT }, { type: "small", style: src_Style.TEXT }, { type: "stack" }]; // Delimiters that stack when large try the small and then large delimiters, and // stack afterwards var stackLargeDelimiterSequence = [{ type: "small", style: src_Style.SCRIPTSCRIPT }, { type: "small", style: src_Style.SCRIPT }, { type: "small", style: src_Style.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }, { type: "stack" }]; /** * Get the font used in a delimiter based on what kind of delimiter it is. * TODO(#963) Use more specific font family return type once that is introduced. */ var delimTypeToFont = function delimTypeToFont(type) { if (type.type === "small") { return "Main-Regular"; } else if (type.type === "large") { return "Size" + type.size + "-Regular"; } else if (type.type === "stack") { return "Size4-Regular"; } else { throw new Error("Add support for delim type '" + type.type + "' here."); } }; /** * Traverse a sequence of types of delimiters to decide what kind of delimiter * should be used to create a delimiter of the given height+depth. */ var traverseSequence = function traverseSequence(delim, height, sequence, options) { // Here, we choose the index we should start at in the sequences. In smaller // sizes (which correspond to larger numbers in style.size) we start earlier // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2 var start = Math.min(2, 3 - options.style.size); for (var i = start; i < sequence.length; i++) { if (sequence[i].type === "stack") { // This is always the last delimiter, so we just break the loop now. break; } var metrics = delimiter_getMetrics(delim, delimTypeToFont(sequence[i]), "math"); var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we // account for the style change size. if (sequence[i].type === "small") { var newOptions = options.havingBaseStyle(sequence[i].style); heightDepth *= newOptions.sizeMultiplier; } // Check if the delimiter at this size works for the given height. if (heightDepth > height) { return sequence[i]; } } // If we reached the end of the sequence, return the last sequence element. return sequence[sequence.length - 1]; }; /** * Make a delimiter of a given height+depth, with optional centering. Here, we * traverse the sequences, and create a delimiter that the sequence tells us to. */ var delimiter_makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { delim = "\\rangle"; } // Decide what sequence to use var sequence; if (utils.contains(stackNeverDelimiters, delim)) { sequence = stackNeverDelimiterSequence; } else if (utils.contains(stackLargeDelimiters, delim)) { sequence = stackLargeDelimiterSequence; } else { sequence = stackAlwaysDelimiterSequence; } // Look through the sequence var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs. // Depending on the sequence element we decided on, call the // appropriate function. if (delimType.type === "small") { return delimiter_makeSmallDelim(delim, delimType.style, center, options, mode, classes); } else if (delimType.type === "large") { return delimiter_makeLargeDelim(delim, delimType.size, center, options, mode, classes); } else /* if (delimType.type === "stack") */ { return delimiter_makeStackedDelim(delim, height, center, options, mode, classes); } }; /** * Make a delimiter for use with `\left` and `\right`, given a height and depth * of an expression that the delimiters surround. */ var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { // We always center \left/\right delimiters, so the axis is always shifted var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right var delimiterFactor = 901; var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are // 65536 per pt, or 655360 per em. So, the division here truncates in // TeX but doesn't here, producing different results. If we wanted to // exactly match TeX's calculation, we could do // Math.floor(655360 * maxDistFromAxis / 500) * // delimiterFactor / 655360 // (To see the difference, compare // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} // in TeX and KaTeX) maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total // height return delimiter_makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); }; /* harmony default export */ var delimiter = ({ sqrtImage: makeSqrtImage, sizedDelim: delimiter_makeSizedDelim, customSizedDelim: delimiter_makeCustomSizedDelim, leftRightDelim: makeLeftRightDelim }); // CONCATENATED MODULE: ./src/functions/delimsizing.js // Extra data needed for the delimiter handler down below var delimiterSizes = { "\\bigl": { mclass: "mopen", size: 1 }, "\\Bigl": { mclass: "mopen", size: 2 }, "\\biggl": { mclass: "mopen", size: 3 }, "\\Biggl": { mclass: "mopen", size: 4 }, "\\bigr": { mclass: "mclose", size: 1 }, "\\Bigr": { mclass: "mclose", size: 2 }, "\\biggr": { mclass: "mclose", size: 3 }, "\\Biggr": { mclass: "mclose", size: 4 }, "\\bigm": { mclass: "mrel", size: 1 }, "\\Bigm": { mclass: "mrel", size: 2 }, "\\biggm": { mclass: "mrel", size: 3 }, "\\Biggm": { mclass: "mrel", size: 4 }, "\\big": { mclass: "mord", size: 1 }, "\\Big": { mclass: "mord", size: 2 }, "\\bigg": { mclass: "mord", size: 3 }, "\\Bigg": { mclass: "mord", size: 4 } }; var delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27E8", "\\rangle", "\u27E9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; // Delimiter functions function checkDelimiter(delim, context) { var symDelim = checkSymbolNodeType(delim); if (symDelim && utils.contains(delimiters, symDelim.text)) { return symDelim; } else if (symDelim) { throw new src_ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim); } else { throw new src_ParseError("Invalid delimiter type '" + delim.type + "'", delim); } } defineFunction({ type: "delimsizing", names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], props: { numArgs: 1 }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); return { type: "delimsizing", mode: context.parser.mode, size: delimiterSizes[context.funcName].size, mclass: delimiterSizes[context.funcName].mclass, delim: delim.text }; }, htmlBuilder: function htmlBuilder(group, options) { if (group.delim === ".") { // Empty delimiters still count as elements, even though they don't // show anything. return buildCommon.makeSpan([group.mclass]); } // Use delimiter.sizedDelim to generate the delimiter. return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]); }, mathmlBuilder: function mathmlBuilder(group) { var children = []; if (group.delim !== ".") { children.push(buildMathML_makeText(group.delim, group.mode)); } var node = new mathMLTree.MathNode("mo", children); if (group.mclass === "mopen" || group.mclass === "mclose") { // Only some of the delimsizing functions act as fences, and they // return "mopen" or "mclose" mclass. node.setAttribute("fence", "true"); } else { // Explicitly disable fencing if it's not a fence, to override the // defaults. node.setAttribute("fence", "false"); } return node; } }); function assertParsed(group) { if (!group.body) { throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); } } defineFunction({ type: "leftright-right", names: ["\\right"], props: { numArgs: 1 }, handler: function handler(context, args) { // \left case below triggers parsing of \right in // `const right = parser.parseFunction();` // uses this return value. var color = context.parser.gullet.macros.get("\\current@color"); if (color && typeof color !== "string") { throw new src_ParseError("\\current@color set to non-string in \\right"); } return { type: "leftright-right", mode: context.parser.mode, delim: checkDelimiter(args[0], context).text, color: color // undefined if not set via \color }; } }); defineFunction({ type: "leftright", names: ["\\left"], props: { numArgs: 1 }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); var parser = context.parser; // Parse out the implicit body ++parser.leftrightDepth; // parseExpression stops before '\\right' var body = parser.parseExpression(false); --parser.leftrightDepth; // Check the next token parser.expect("\\right", false); var right = assertNodeType(parser.parseFunction(), "leftright-right"); return { type: "leftright", mode: parser.mode, body: body, left: delim.text, right: right.delim, rightColor: right.color }; }, htmlBuilder: function htmlBuilder(group, options) { assertParsed(group); // Build the inner expression var inner = buildHTML_buildExpression(group.body, options, true, ["mopen", "mclose"]); var innerHeight = 0; var innerDepth = 0; var hadMiddle = false; // Calculate its height and depth for (var i = 0; i < inner.length; i++) { // Property `isMiddle` not defined on `span`. See comment in // "middle"'s htmlBuilder. // $FlowFixMe if (inner[i].isMiddle) { hadMiddle = true; } else { innerHeight = Math.max(inner[i].height, innerHeight); innerDepth = Math.max(inner[i].depth, innerDepth); } } // The size of delimiters is the same, regardless of what style we are // in. Thus, to correctly calculate the size of delimiter we need around // a group, we scale down the inner size based on the size. innerHeight *= options.sizeMultiplier; innerDepth *= options.sizeMultiplier; var leftDelim; if (group.left === ".") { // Empty delimiters in \left and \right make null delimiter spaces. leftDelim = makeNullDelimiter(options, ["mopen"]); } else { // Otherwise, use leftRightDelim to generate the correct sized // delimiter. leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]); } // Add it to the beginning of the expression inner.unshift(leftDelim); // Handle middle delimiters if (hadMiddle) { for (var _i = 1; _i < inner.length; _i++) { var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in // "middle"'s htmlBuilder. // $FlowFixMe var isMiddle = middleDelim.isMiddle; if (isMiddle) { // Apply the options that were active when \middle was called inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []); } } } var rightDelim; // Same for the right delimiter, but using color specified by \color if (group.right === ".") { rightDelim = makeNullDelimiter(options, ["mclose"]); } else { var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options; rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]); } // Add it to the end of the expression. inner.push(rightDelim); return buildCommon.makeSpan(["minner"], inner, options); }, mathmlBuilder: function mathmlBuilder(group, options) { assertParsed(group); var inner = buildMathML_buildExpression(group.body, options); if (group.left !== ".") { var leftNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.left, group.mode)]); leftNode.setAttribute("fence", "true"); inner.unshift(leftNode); } if (group.right !== ".") { var rightNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.right, group.mode)]); rightNode.setAttribute("fence", "true"); if (group.rightColor) { rightNode.setAttribute("mathcolor", group.rightColor); } inner.push(rightNode); } return buildMathML_makeRow(inner); } }); defineFunction({ type: "middle", names: ["\\middle"], props: { numArgs: 1 }, handler: function handler(context, args) { var delim = checkDelimiter(args[0], context); if (!context.parser.leftrightDepth) { throw new src_ParseError("\\middle without preceding \\left", delim); } return { type: "middle", mode: context.parser.mode, delim: delim.text }; }, htmlBuilder: function htmlBuilder(group, options) { var middleDelim; if (group.delim === ".") { middleDelim = makeNullDelimiter(options, []); } else { middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []); var isMiddle = { delim: group.delim, options: options }; // Property `isMiddle` not defined on `span`. It is only used in // this file above. // TODO: Fix this violation of the `span` type and possibly rename // things since `isMiddle` sounds like a boolean, but is a struct. // $FlowFixMe middleDelim.isMiddle = isMiddle; } return middleDelim; }, mathmlBuilder: function mathmlBuilder(group, options) { // A Firefox \middle will strech a character vertically only if it // is in the fence part of the operator dictionary at: // https://www.w3.org/TR/MathML3/appendixc.html. // So we need to avoid U+2223 and use plain "|" instead. var textNode = group.delim === "\\vert" || group.delim === "|" ? buildMathML_makeText("|", "text") : buildMathML_makeText(group.delim, group.mode); var middleNode = new mathMLTree.MathNode("mo", [textNode]); middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each element. // \middle should get delimiter spacing instead. middleNode.setAttribute("lspace", "0.05em"); middleNode.setAttribute("rspace", "0.05em"); return middleNode; } }); // CONCATENATED MODULE: ./src/functions/enclose.js var enclose_htmlBuilder = function htmlBuilder(group, options) { // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox // Some groups can return document fragments. Handle those by wrapping // them in a span. var inner = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, options), options); var label = group.label.substr(1); var scale = options.sizeMultiplier; var img; var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different // depending on whether the subject is wider than it is tall, or vice versa. // We don't know the width of a group, so as a proxy, we test if // the subject is a single character. This captures most of the // subjects that should get the "tall" treatment. var isSingleChar = utils.isCharacterBox(group.body); if (label === "sout") { img = buildCommon.makeSpan(["stretchy", "sout"]); img.height = options.fontMetrics().defaultRuleThickness / scale; imgShift = -0.5 * options.fontMetrics().xHeight; } else { // Add horizontal padding if (/cancel/.test(label)) { if (!isSingleChar) { inner.classes.push("cancel-pad"); } } else { inner.classes.push("boxpad"); } // Add vertical padding var vertPad = 0; var ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2" if (/box/.test(label)) { ruleThickness = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // User override. ); vertPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness); } else { vertPad = isSingleChar ? 0.2 : 0; } img = stretchy.encloseSpan(inner, label, vertPad, options); if (/fbox|boxed|fcolorbox/.test(label)) { img.style.borderStyle = "solid"; img.style.borderWidth = ruleThickness + "em"; } imgShift = inner.depth + vertPad; if (group.backgroundColor) { img.style.backgroundColor = group.backgroundColor; if (group.borderColor) { img.style.borderColor = group.borderColor; } } } var vlist; if (group.backgroundColor) { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [// Put the color background behind inner; { type: "elem", elem: img, shift: imgShift }, { type: "elem", elem: inner, shift: 0 }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [// Write the \cancel stroke on top of inner. { type: "elem", elem: inner, shift: 0 }, { type: "elem", elem: img, shift: imgShift, wrapperClasses: /cancel/.test(label) ? ["svg-align"] : [] }] }, options); } if (/cancel/.test(label)) { // The cancel package documentation says that cancel lines add their height // to the expression, but tests show that isn't how it actually works. vlist.height = inner.height; vlist.depth = inner.depth; } if (/cancel/.test(label) && !isSingleChar) { // cancel does not create horiz space for its line extension. return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options); } else { return buildCommon.makeSpan(["mord"], [vlist], options); } }; var enclose_mathmlBuilder = function mathmlBuilder(group, options) { var fboxsep = 0; var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildMathML_buildGroup(group.body, options)]); switch (group.label) { case "\\cancel": node.setAttribute("notation", "updiagonalstrike"); break; case "\\bcancel": node.setAttribute("notation", "downdiagonalstrike"); break; case "\\sout": node.setAttribute("notation", "horizontalstrike"); break; case "\\fbox": node.setAttribute("notation", "box"); break; case "\\fcolorbox": case "\\colorbox": // doesn't have a good notation option. So use // instead. Set some attributes that come included with . fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm; node.setAttribute("width", "+" + 2 * fboxsep + "pt"); node.setAttribute("height", "+" + 2 * fboxsep + "pt"); node.setAttribute("lspace", fboxsep + "pt"); // node.setAttribute("voffset", fboxsep + "pt"); if (group.label === "\\fcolorbox") { var thk = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // user override ); node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor)); } break; case "\\xcancel": node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); break; } if (group.backgroundColor) { node.setAttribute("mathbackground", group.backgroundColor); } return node; }; defineFunction({ type: "enclose", names: ["\\colorbox"], props: { numArgs: 2, allowedInText: true, greediness: 3, argTypes: ["color", "text"] }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser, funcName = _ref.funcName; var color = assertNodeType(args[0], "color-token").color; var body = args[1]; return { type: "enclose", mode: parser.mode, label: funcName, backgroundColor: color, body: body }; }, htmlBuilder: enclose_htmlBuilder, mathmlBuilder: enclose_mathmlBuilder }); defineFunction({ type: "enclose", names: ["\\fcolorbox"], props: { numArgs: 3, allowedInText: true, greediness: 3, argTypes: ["color", "color", "text"] }, handler: function handler(_ref2, args, optArgs) { var parser = _ref2.parser, funcName = _ref2.funcName; var borderColor = assertNodeType(args[0], "color-token").color; var backgroundColor = assertNodeType(args[1], "color-token").color; var body = args[2]; return { type: "enclose", mode: parser.mode, label: funcName, backgroundColor: backgroundColor, borderColor: borderColor, body: body }; }, htmlBuilder: enclose_htmlBuilder, mathmlBuilder: enclose_mathmlBuilder }); defineFunction({ type: "enclose", names: ["\\fbox"], props: { numArgs: 1, argTypes: ["hbox"], allowedInText: true }, handler: function handler(_ref3, args) { var parser = _ref3.parser; return { type: "enclose", mode: parser.mode, label: "\\fbox", body: args[0] }; } }); defineFunction({ type: "enclose", names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"], props: { numArgs: 1 }, handler: function handler(_ref4, args, optArgs) { var parser = _ref4.parser, funcName = _ref4.funcName; var body = args[0]; return { type: "enclose", mode: parser.mode, label: funcName, body: body }; }, htmlBuilder: enclose_htmlBuilder, mathmlBuilder: enclose_mathmlBuilder }); // CONCATENATED MODULE: ./src/defineEnvironment.js /** * All registered environments. * `environments.js` exports this same dictionary again and makes it public. * `Parser.js` requires this dictionary via `environments.js`. */ var _environments = {}; function defineEnvironment(_ref) { var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder; // Set default values of environments. var data = { type: type, numArgs: props.numArgs || 0, greediness: 1, allowedInText: false, numOptionalArgs: 0, handler: handler }; for (var i = 0; i < names.length; ++i) { // TODO: The value type of _environments should be a type union of all // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is // an existential type. // $FlowFixMe _environments[names[i]] = data; } if (htmlBuilder) { _htmlGroupBuilders[type] = htmlBuilder; } if (mathmlBuilder) { _mathmlGroupBuilders[type] = mathmlBuilder; } } // CONCATENATED MODULE: ./src/environments/array.js function getHLines(parser) { // Return an array. The array length = number of hlines. // Each element in the array tells if the line is dashed. var hlineInfo = []; parser.consumeSpaces(); var nxt = parser.fetch().text; while (nxt === "\\hline" || nxt === "\\hdashline") { parser.consume(); hlineInfo.push(nxt === "\\hdashline"); parser.consumeSpaces(); nxt = parser.fetch().text; } return hlineInfo; } /** * Parse the body of the environment, with rows delimited by \\ and * columns delimited by &, and create a nested list in row-major order * with one group per cell. If given an optional argument style * ("text", "display", etc.), then each cell is cast into that style. */ function parseArray(parser, _ref, style) { var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, colSeparationType = _ref.colSeparationType; // Parse body of array with \\ temporarily mapped to \cr parser.gullet.beginGroup(); parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment if (!arraystretch) { var stretch = parser.gullet.expandMacroAsText("\\arraystretch"); if (stretch == null) { // Default \arraystretch from lttab.dtx arraystretch = 1; } else { arraystretch = parseFloat(stretch); if (!arraystretch || arraystretch < 0) { throw new src_ParseError("Invalid \\arraystretch: " + stretch); } } } // Start group for first cell parser.gullet.beginGroup(); var row = []; var body = [row]; var rowGaps = []; var hLinesBeforeRow = []; // Test for \hline at the top of the array. hLinesBeforeRow.push(getHLines(parser)); while (true) { // eslint-disable-line no-constant-condition // Parse each cell in its own group (namespace) var cell = parser.parseExpression(false, "\\cr"); parser.gullet.endGroup(); parser.gullet.beginGroup(); cell = { type: "ordgroup", mode: parser.mode, body: cell }; if (style) { cell = { type: "styling", mode: parser.mode, style: style, body: [cell] }; } row.push(cell); var next = parser.fetch().text; if (next === "&") { parser.consume(); } else if (next === "\\end") { // Arrays terminate newlines with `\crcr` which consumes a `\cr` if // the last line is empty. // NOTE: Currently, `cell` is the last item added into `row`. if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0) { body.pop(); } if (hLinesBeforeRow.length < body.length + 1) { hLinesBeforeRow.push([]); } break; } else if (next === "\\cr") { var cr = assertNodeType(parser.parseFunction(), "cr"); rowGaps.push(cr.size); // check for \hline(s) following the row separator hLinesBeforeRow.push(getHLines(parser)); row = []; body.push(row); } else { throw new src_ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken); } } // End cell group parser.gullet.endGroup(); // End array group defining \\ parser.gullet.endGroup(); return { type: "array", mode: parser.mode, addJot: addJot, arraystretch: arraystretch, body: body, cols: cols, rowGaps: rowGaps, hskipBeforeAndAfter: hskipBeforeAndAfter, hLinesBeforeRow: hLinesBeforeRow, colSeparationType: colSeparationType }; } // Decides on a style for cells in an array according to whether the given // environment name starts with the letter 'd'. function dCellStyle(envName) { if (envName.substr(0, 1) === "d") { return "display"; } else { return "text"; } } var array_htmlBuilder = function htmlBuilder(group, options) { var r; var c; var nr = group.body.length; var hLinesBeforeRow = group.hLinesBeforeRow; var nc = 0; var body = new Array(nr); var hlines = []; var ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em. options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override. ); // Horizontal spacing var pt = 1 / options.fontMetrics().ptPerEm; var arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls if (group.colSeparationType && group.colSeparationType === "small") { // We're in a {smallmatrix}. Default column space is \thickspace, // i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}. // But that needs adjustment because LaTeX applies \scriptstyle to the // entire array, including the colspace, but this function applies // \scriptstyle only inside each element. var localMultiplier = options.havingStyle(src_Style.SCRIPT).sizeMultiplier; arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier); } // Vertical spacing var baselineskip = 12 * pt; // see size10.clo // Default \jot from ltmath.dtx // TODO(edemaine): allow overriding \jot via \setlength (#687) var jot = 3 * pt; var arrayskip = group.arraystretch * baselineskip; var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx var totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any. function setHLinePos(hlinesInGap) { for (var i = 0; i < hlinesInGap.length; ++i) { if (i > 0) { totalHeight += 0.25; } hlines.push({ pos: totalHeight, isDashed: hlinesInGap[i] }); } } setHLinePos(hLinesBeforeRow[0]); for (r = 0; r < group.body.length; ++r) { var inrow = group.body[r]; var height = arstrutHeight; // \@array adds an \@arstrut var depth = arstrutDepth; // to each tow (via the template) if (nc < inrow.length) { nc = inrow.length; } var outrow = new Array(inrow.length); for (c = 0; c < inrow.length; ++c) { var elt = buildHTML_buildGroup(inrow[c], options); if (depth < elt.depth) { depth = elt.depth; } if (height < elt.height) { height = elt.height; } outrow[c] = elt; } var rowGap = group.rowGaps[r]; var gap = 0; if (rowGap) { gap = units_calculateSize(rowGap, options); if (gap > 0) { // \@argarraycr gap += arstrutDepth; if (depth < gap) { depth = gap; // \@xargarraycr } gap = 0; } } // In AMS multiline environments such as aligned and gathered, rows // correspond to lines that have additional \jot added to the // \baselineskip via \openup. if (group.addJot) { depth += jot; } outrow.height = height; outrow.depth = depth; totalHeight += height; outrow.pos = totalHeight; totalHeight += depth + gap; // \@yargarraycr body[r] = outrow; // Set a position for \hline(s), if any. setHLinePos(hLinesBeforeRow[r + 1]); } var offset = totalHeight / 2 + options.fontMetrics().axisHeight; var colDescriptions = group.cols || []; var cols = []; var colSep; var colDescrNum; for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column // descriptions, so trailing separators don't get lost. c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) { var colDescr = colDescriptions[colDescrNum] || {}; var firstSeparator = true; while (colDescr.type === "separator") { // If there is more than one separator in a row, add a space // between them. if (!firstSeparator) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = options.fontMetrics().doubleRuleSep + "em"; cols.push(colSep); } if (colDescr.separator === "|" || colDescr.separator === ":") { var lineType = colDescr.separator === "|" ? "solid" : "dashed"; var separator = buildCommon.makeSpan(["vertical-separator"], [], options); separator.style.height = totalHeight + "em"; separator.style.borderRightWidth = ruleThickness + "em"; separator.style.borderRightStyle = lineType; separator.style.margin = "0 -" + ruleThickness / 2 + "em"; separator.style.verticalAlign = -(totalHeight - offset) + "em"; cols.push(separator); } else { throw new src_ParseError("Invalid separator type: " + colDescr.separator); } colDescrNum++; colDescr = colDescriptions[colDescrNum] || {}; firstSeparator = false; } if (c >= nc) { continue; } var sepwidth = void 0; if (c > 0 || group.hskipBeforeAndAfter) { sepwidth = utils.deflt(colDescr.pregap, arraycolsep); if (sepwidth !== 0) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = sepwidth + "em"; cols.push(colSep); } } var col = []; for (r = 0; r < nr; ++r) { var row = body[r]; var elem = row[c]; if (!elem) { continue; } var shift = row.pos - offset; elem.depth = row.depth; elem.height = row.height; col.push({ type: "elem", elem: elem, shift: shift }); } col = buildCommon.makeVList({ positionType: "individualShift", children: col }, options); col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]); cols.push(col); if (c < nc - 1 || group.hskipBeforeAndAfter) { sepwidth = utils.deflt(colDescr.postgap, arraycolsep); if (sepwidth !== 0) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = sepwidth + "em"; cols.push(colSep); } } } body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any. if (hlines.length > 0) { var line = buildCommon.makeLineSpan("hline", options, ruleThickness); var dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness); var vListElems = [{ type: "elem", elem: body, shift: 0 }]; while (hlines.length > 0) { var hline = hlines.pop(); var lineShift = hline.pos - offset; if (hline.isDashed) { vListElems.push({ type: "elem", elem: dashes, shift: lineShift }); } else { vListElems.push({ type: "elem", elem: line, shift: lineShift }); } } body = buildCommon.makeVList({ positionType: "individualShift", children: vListElems }, options); } return buildCommon.makeSpan(["mord"], [body], options); }; var alignMap = { c: "center ", l: "left ", r: "right " }; var array_mathmlBuilder = function mathmlBuilder(group, options) { var table = new mathMLTree.MathNode("mtable", group.body.map(function (row) { return new mathMLTree.MathNode("mtr", row.map(function (cell) { return new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(cell, options)]); })); })); // Set column alignment, row spacing, column spacing, and // array lines by setting attributes on the table element. // Set the row spacing. In MathML, we specify a gap distance. // We do not use rowGap[] because MathML automatically increases // cell height with the height/depth of the element content. // LaTeX \arraystretch multiplies the row baseline-to-baseline distance. // We simulate this by adding (arraystretch - 1)em to the gap. This // does a reasonable job of adjusting arrays containing 1 em tall content. // The 0.16 and 0.09 values are found emprically. They produce an array // similar to LaTeX and in which content does not interfere with \hines. var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray} : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0); table.setAttribute("rowspacing", gap + "em"); // MathML table lines go only between cells. // To place a line on an edge we'll use , if necessary. var menclose = ""; var align = ""; if (group.cols && group.cols.length > 0) { // Find column alignment, column spacing, and vertical lines. var cols = group.cols; var columnLines = ""; var prevTypeWasAlign = false; var iStart = 0; var iEnd = cols.length; if (cols[0].type === "separator") { menclose += "top "; iStart = 1; } if (cols[cols.length - 1].type === "separator") { menclose += "bottom "; iEnd -= 1; } for (var i = iStart; i < iEnd; i++) { if (cols[i].type === "align") { align += alignMap[cols[i].align]; if (prevTypeWasAlign) { columnLines += "none "; } prevTypeWasAlign = true; } else if (cols[i].type === "separator") { // MathML accepts only single lines between cells. // So we read only the first of consecutive separators. if (prevTypeWasAlign) { columnLines += cols[i].separator === "|" ? "solid " : "dashed "; prevTypeWasAlign = false; } } } table.setAttribute("columnalign", align.trim()); if (/[sd]/.test(columnLines)) { table.setAttribute("columnlines", columnLines.trim()); } } // Set column spacing. if (group.colSeparationType === "align") { var _cols = group.cols || []; var spacing = ""; for (var _i = 1; _i < _cols.length; _i++) { spacing += _i % 2 ? "0em " : "1em "; } table.setAttribute("columnspacing", spacing.trim()); } else if (group.colSeparationType === "alignat") { table.setAttribute("columnspacing", "0em"); } else if (group.colSeparationType === "small") { table.setAttribute("columnspacing", "0.2778em"); } else { table.setAttribute("columnspacing", "1em"); } // Address \hline and \hdashline var rowLines = ""; var hlines = group.hLinesBeforeRow; menclose += hlines[0].length > 0 ? "left " : ""; menclose += hlines[hlines.length - 1].length > 0 ? "right " : ""; for (var _i2 = 1; _i2 < hlines.length - 1; _i2++) { rowLines += hlines[_i2].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element. : hlines[_i2][0] ? "dashed " : "solid "; } if (/[sd]/.test(rowLines)) { table.setAttribute("rowlines", rowLines.trim()); } if (menclose !== "") { table = new mathMLTree.MathNode("menclose", [table]); table.setAttribute("notation", menclose.trim()); } if (group.arraystretch && group.arraystretch < 1) { // A small array. Wrap in scriptstyle so row gap is not too large. table = new mathMLTree.MathNode("mstyle", [table]); table.setAttribute("scriptlevel", "1"); } return table; }; // Convenience function for aligned and alignedat environments. var array_alignedHandler = function alignedHandler(context, args) { var cols = []; var res = parseArray(context.parser, { cols: cols, addJot: true }, "display"); // Determining number of columns. // 1. If the first argument is given, we use it as a number of columns, // and makes sure that each row doesn't exceed that number. // 2. Otherwise, just count number of columns = maximum number // of cells in each row ("aligned" mode -- isAligned will be true). // // At the same time, prepend empty group {} at beginning of every second // cell in each row (starting with second cell) so that operators become // binary. This behavior is implemented in amsmath's \start@aligned. var numMaths; var numCols = 0; var emptyGroup = { type: "ordgroup", mode: context.mode, body: [] }; if (args[0] && args[0].type === "ordgroup") { var arg0 = ""; for (var i = 0; i < args[0].body.length; i++) { var textord = assertNodeType(args[0].body[i], "textord"); arg0 += textord.text; } numMaths = Number(arg0); numCols = numMaths * 2; } var isAligned = !numCols; res.body.forEach(function (row) { for (var _i3 = 1; _i3 < row.length; _i3 += 2) { // Modify ordgroup node within styling node var styling = assertNodeType(row[_i3], "styling"); var ordgroup = assertNodeType(styling.body[0], "ordgroup"); ordgroup.body.unshift(emptyGroup); } if (!isAligned) { // Case 1 var curMaths = row.length / 2; if (numMaths < curMaths) { throw new src_ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]); } } else if (numCols < row.length) { // Case 2 numCols = row.length; } }); // Adjusting alignment. // In aligned mode, we add one \qquad between columns; // otherwise we add nothing. for (var _i4 = 0; _i4 < numCols; ++_i4) { var align = "r"; var pregap = 0; if (_i4 % 2 === 1) { align = "l"; } else if (_i4 > 0 && isAligned) { // "aligned" mode. pregap = 1; // add one \quad } cols[_i4] = { type: "align", align: align, pregap: pregap, postgap: 0 }; } res.colSeparationType = isAligned ? "align" : "alignat"; return res; }; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation // is part of the source2e.pdf file of LaTeX2e source documentation. // {darray} is an {array} environment where cells are set in \displaystyle, // as defined in nccmath.sty. defineEnvironment({ type: "array", names: ["array", "darray"], props: { numArgs: 1 }, handler: function handler(context, args) { // Since no types are specified above, the two possibilities are // - The argument is wrapped in {} or [], in which case Parser's // parseGroup() returns an "ordgroup" wrapping some symbol node. // - The argument is a bare symbol node. var symNode = checkSymbolNodeType(args[0]); var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; var cols = colalign.map(function (nde) { var node = assertSymbolNodeType(nde); var ca = node.text; if ("lcr".indexOf(ca) !== -1) { return { type: "align", align: ca }; } else if (ca === "|") { return { type: "separator", separator: "|" }; } else if (ca === ":") { return { type: "separator", separator: ":" }; } throw new src_ParseError("Unknown column alignment: " + ca, nde); }); var res = { cols: cols, hskipBeforeAndAfter: true // \@preamble in lttab.dtx }; return parseArray(context.parser, res, dCellStyle(context.envName)); }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // The matrix environments of amsmath builds on the array environment // of LaTeX, which is discussed above. defineEnvironment({ type: "array", names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], props: { numArgs: 0 }, handler: function handler(context) { var delimiters = { "matrix": null, "pmatrix": ["(", ")"], "bmatrix": ["[", "]"], "Bmatrix": ["\\{", "\\}"], "vmatrix": ["|", "|"], "Vmatrix": ["\\Vert", "\\Vert"] }[context.envName]; // \hskip -\arraycolsep in amsmath var payload = { hskipBeforeAndAfter: false }; var res = parseArray(context.parser, payload, dCellStyle(context.envName)); return delimiters ? { type: "leftright", mode: context.mode, body: [res], left: delimiters[0], right: delimiters[1], rightColor: undefined // \right uninfluenced by \color in array } : res; }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); defineEnvironment({ type: "array", names: ["smallmatrix"], props: { numArgs: 0 }, handler: function handler(context) { var payload = { arraystretch: 0.5 }; var res = parseArray(context.parser, payload, "script"); res.colSeparationType = "small"; return res; }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); defineEnvironment({ type: "array", names: ["subarray"], props: { numArgs: 1 }, handler: function handler(context, args) { // Parsing of {subarray} is similar to {array} var symNode = checkSymbolNodeType(args[0]); var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; var cols = colalign.map(function (nde) { var node = assertSymbolNodeType(nde); var ca = node.text; // {subarray} only recognizes "l" & "c" if ("lc".indexOf(ca) !== -1) { return { type: "align", align: ca }; } throw new src_ParseError("Unknown column alignment: " + ca, nde); }); if (cols.length > 1) { throw new src_ParseError("{subarray} can contain only one column"); } var res = { cols: cols, hskipBeforeAndAfter: false, arraystretch: 0.5 }; res = parseArray(context.parser, res, "script"); if (res.body.length > 0 && res.body[0].length > 1) { throw new src_ParseError("{subarray} can contain only one column"); } return res; }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // A cases environment (in amsmath.sty) is almost equivalent to // \def\arraystretch{1.2}% // \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. // {dcases} is a {cases} environment where cells are set in \displaystyle, // as defined in mathtools.sty. // {rcases} is another mathtools environment. It's brace is on the right side. defineEnvironment({ type: "array", names: ["cases", "dcases", "rcases", "drcases"], props: { numArgs: 0 }, handler: function handler(context) { var payload = { arraystretch: 1.2, cols: [{ type: "align", align: "l", pregap: 0, // TODO(kevinb) get the current style. // For now we use the metrics for TEXT style which is what we were // doing before. Before attempting to get the current style we // should look at TeX's behavior especially for \over and matrices. postgap: 1.0 /* 1em quad */ }, { type: "align", align: "l", pregap: 0, postgap: 0 }] }; var res = parseArray(context.parser, payload, dCellStyle(context.envName)); return { type: "leftright", mode: context.mode, body: [res], left: context.envName.indexOf("r") > -1 ? "." : "\\{", right: context.envName.indexOf("r") > -1 ? "\\}" : ".", rightColor: undefined }; }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // An aligned environment is like the align* environment // except it operates within math mode. // Note that we assume \nomallineskiplimit to be zero, // so that \strut@ is the same as \strut. defineEnvironment({ type: "array", names: ["aligned"], props: { numArgs: 0 }, handler: array_alignedHandler, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // A gathered environment is like an array environment with one centered // column, but where rows are considered lines so get \jot line spacing // and contents are set in \displaystyle. defineEnvironment({ type: "array", names: ["gathered"], props: { numArgs: 0 }, handler: function handler(context) { var res = { cols: [{ type: "align", align: "c" }], addJot: true }; return parseArray(context.parser, res, "display"); }, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // alignat environment is like an align environment, but one must explicitly // specify maximum number of columns in each row, and can adjust spacing between // each columns. defineEnvironment({ type: "array", names: ["alignedat"], // One for numbered and for unnumbered; // but, KaTeX doesn't supports math numbering yet, // they make no difference for now. props: { numArgs: 1 }, handler: array_alignedHandler, htmlBuilder: array_htmlBuilder, mathmlBuilder: array_mathmlBuilder }); // Catch \hline outside array environment defineFunction({ type: "text", // Doesn't matter what this is. names: ["\\hline", "\\hdashline"], props: { numArgs: 0, allowedInText: true, allowedInMath: true }, handler: function handler(context, args) { throw new src_ParseError(context.funcName + " valid only within array environment"); } }); // CONCATENATED MODULE: ./src/environments.js var environments = _environments; /* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below // CONCATENATED MODULE: ./src/functions/environment.js // Environment delimiters. HTML/MathML rendering is defined in the corresponding // defineEnvironment definitions. // $FlowFixMe, "environment" handler returns an environment ParseNode defineFunction({ type: "environment", names: ["\\begin", "\\end"], props: { numArgs: 1, argTypes: ["text"] }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var nameGroup = args[0]; if (nameGroup.type !== "ordgroup") { throw new src_ParseError("Invalid environment name", nameGroup); } var envName = ""; for (var i = 0; i < nameGroup.body.length; ++i) { envName += assertNodeType(nameGroup.body[i], "textord").text; } if (funcName === "\\begin") { // begin...end is similar to left...right if (!src_environments.hasOwnProperty(envName)) { throw new src_ParseError("No such environment: " + envName, nameGroup); } // Build the environment object. Arguments and other information will // be made available to the begin and end methods using properties. var env = src_environments[envName]; var _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env), _args = _parser$parseArgument.args, optArgs = _parser$parseArgument.optArgs; var context = { mode: parser.mode, envName: envName, parser: parser }; var result = env.handler(context, _args, optArgs); parser.expect("\\end", false); var endNameToken = parser.nextToken; var end = assertNodeType(parser.parseFunction(), "environment"); if (end.name !== envName) { throw new src_ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken); } return result; } return { type: "environment", mode: parser.mode, name: envName, nameGroup: nameGroup }; } }); // CONCATENATED MODULE: ./src/functions/mclass.js var mclass_makeSpan = buildCommon.makeSpan; function mclass_htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options, true); return mclass_makeSpan([group.mclass], elements, options); } function mclass_mathmlBuilder(group, options) { var node; var inner = buildMathML_buildExpression(group.body, options); if (group.mclass === "minner") { return mathMLTree.newDocumentFragment(inner); } else if (group.mclass === "mord") { if (group.isCharacterBox) { node = inner[0]; node.type = "mi"; } else { node = new mathMLTree.MathNode("mi", inner); } } else { if (group.isCharacterBox) { node = inner[0]; node.type = "mo"; } else { node = new mathMLTree.MathNode("mo", inner); } // Set spacing based on what is the most likely adjacent atom type. // See TeXbook p170. if (group.mclass === "mbin") { node.attributes.lspace = "0.22em"; // medium space node.attributes.rspace = "0.22em"; } else if (group.mclass === "mpunct") { node.attributes.lspace = "0em"; node.attributes.rspace = "0.17em"; // thinspace } else if (group.mclass === "mopen" || group.mclass === "mclose") { node.attributes.lspace = "0em"; node.attributes.rspace = "0em"; } // MathML default space is 5/18 em, so needs no action. // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo } return node; } // Math class commands except \mathop defineFunction({ type: "mclass", names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; return { type: "mclass", mode: parser.mode, mclass: "m" + funcName.substr(5), // TODO(kevinb): don't prefix with 'm' body: ordargument(body), isCharacterBox: utils.isCharacterBox(body) }; }, htmlBuilder: mclass_htmlBuilder, mathmlBuilder: mclass_mathmlBuilder }); var binrelClass = function binrelClass(arg) { // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument. // (by rendering separately and with {}s before and after, and measuring // the change in spacing). We'll do roughly the same by detecting the // atom type directly. var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) { return "m" + atom.family; } else { return "mord"; } }; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord. // This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX. defineFunction({ type: "mclass", names: ["\\@binrel"], props: { numArgs: 2 }, handler: function handler(_ref2, args) { var parser = _ref2.parser; return { type: "mclass", mode: parser.mode, mclass: binrelClass(args[0]), body: [args[1]], isCharacterBox: utils.isCharacterBox(args[1]) }; } }); // Build a relation or stacked op by placing one symbol on top of another defineFunction({ type: "mclass", names: ["\\stackrel", "\\overset", "\\underset"], props: { numArgs: 2 }, handler: function handler(_ref3, args) { var parser = _ref3.parser, funcName = _ref3.funcName; var baseArg = args[1]; var shiftedArg = args[0]; var mclass; if (funcName !== "\\stackrel") { // LaTeX applies \binrel spacing to \overset and \underset. mclass = binrelClass(baseArg); } else { mclass = "mrel"; // for \stackrel } var baseOp = { type: "op", mode: baseArg.mode, limits: true, alwaysHandleSupSub: true, parentIsSupSub: false, symbol: false, suppressBaseShift: funcName !== "\\stackrel", body: ordargument(baseArg) }; var supsub = { type: "supsub", mode: shiftedArg.mode, base: baseOp, sup: funcName === "\\underset" ? null : shiftedArg, sub: funcName === "\\underset" ? shiftedArg : null }; return { type: "mclass", mode: parser.mode, mclass: mclass, body: [supsub], isCharacterBox: utils.isCharacterBox(supsub) }; }, htmlBuilder: mclass_htmlBuilder, mathmlBuilder: mclass_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/font.js // TODO(kevinb): implement \\sl and \\sc var font_htmlBuilder = function htmlBuilder(group, options) { var font = group.font; var newOptions = options.withFont(font); return buildHTML_buildGroup(group.body, newOptions); }; var font_mathmlBuilder = function mathmlBuilder(group, options) { var font = group.font; var newOptions = options.withFont(font); return buildMathML_buildGroup(group.body, newOptions); }; var fontAliases = { "\\Bbb": "\\mathbb", "\\bold": "\\mathbf", "\\frak": "\\mathfrak", "\\bm": "\\boldsymbol" }; defineFunction({ type: "font", names: [// styles, except \boldsymbol defined below "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below "\\Bbb", "\\bold", "\\frak"], props: { numArgs: 1, greediness: 2 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; var func = funcName; if (func in fontAliases) { func = fontAliases[func]; } return { type: "font", mode: parser.mode, font: func.slice(1), body: body }; }, htmlBuilder: font_htmlBuilder, mathmlBuilder: font_mathmlBuilder }); defineFunction({ type: "mclass", names: ["\\boldsymbol", "\\bm"], props: { numArgs: 1, greediness: 2 }, handler: function handler(_ref2, args) { var parser = _ref2.parser; var body = args[0]; var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the // argument's bin|rel|ord status return { type: "mclass", mode: parser.mode, mclass: binrelClass(body), body: [{ type: "font", mode: parser.mode, font: "boldsymbol", body: body }], isCharacterBox: isCharacterBox }; } }); // Old font changing functions defineFunction({ type: "font", names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref3, args) { var parser = _ref3.parser, funcName = _ref3.funcName, breakOnTokenText = _ref3.breakOnTokenText; var mode = parser.mode; var body = parser.parseExpression(true, breakOnTokenText); var style = "math" + funcName.slice(1); return { type: "font", mode: mode, font: style, body: { type: "ordgroup", mode: parser.mode, body: body } }; }, htmlBuilder: font_htmlBuilder, mathmlBuilder: font_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/genfrac.js var genfrac_adjustStyle = function adjustStyle(size, originalStyle) { // Figure out what style this fraction should be in based on the // function used var style = originalStyle; if (size === "display") { // Get display style as a default. // If incoming style is sub/sup, use style.text() to get correct size. style = style.id >= src_Style.SCRIPT.id ? style.text() : src_Style.DISPLAY; } else if (size === "text" && style.size === src_Style.DISPLAY.size) { // We're in a \tfrac but incoming style is displaystyle, so: style = src_Style.TEXT; } else if (size === "script") { style = src_Style.SCRIPT; } else if (size === "scriptscript") { style = src_Style.SCRIPTSCRIPT; } return style; }; var genfrac_htmlBuilder = function htmlBuilder(group, options) { // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). var style = genfrac_adjustStyle(group.size, options.style); var nstyle = style.fracNum(); var dstyle = style.fracDen(); var newOptions; newOptions = options.havingStyle(nstyle); var numerm = buildHTML_buildGroup(group.numer, newOptions, options); if (group.continued) { // \cfrac inserts a \strut into the numerator. // Get \strut dimensions from TeXbook page 353. var hStrut = 8.5 / options.fontMetrics().ptPerEm; var dStrut = 3.5 / options.fontMetrics().ptPerEm; numerm.height = numerm.height < hStrut ? hStrut : numerm.height; numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; } newOptions = options.havingStyle(dstyle); var denomm = buildHTML_buildGroup(group.denom, newOptions, options); var rule; var ruleWidth; var ruleSpacing; if (group.hasBarLine) { if (group.barSize) { ruleWidth = units_calculateSize(group.barSize, options); rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth); } else { rule = buildCommon.makeLineSpan("frac-line", options); } ruleWidth = rule.height; ruleSpacing = rule.height; } else { rule = null; ruleWidth = 0; ruleSpacing = options.fontMetrics().defaultRuleThickness; } // Rule 15b var numShift; var clearance; var denomShift; if (style.size === src_Style.DISPLAY.size || group.size === "display") { numShift = options.fontMetrics().num1; if (ruleWidth > 0) { clearance = 3 * ruleSpacing; } else { clearance = 7 * ruleSpacing; } denomShift = options.fontMetrics().denom1; } else { if (ruleWidth > 0) { numShift = options.fontMetrics().num2; clearance = ruleSpacing; } else { numShift = options.fontMetrics().num3; clearance = 3 * ruleSpacing; } denomShift = options.fontMetrics().denom2; } var frac; if (!rule) { // Rule 15c var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); if (candidateClearance < clearance) { numShift += 0.5 * (clearance - candidateClearance); denomShift += 0.5 * (clearance - candidateClearance); } frac = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: numerm, shift: -numShift }] }, options); } else { // Rule 15d var axisHeight = options.fontMetrics().axisHeight; if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); } if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) { denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); } var midShift = -(axisHeight - 0.5 * ruleWidth); frac = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: rule, shift: midShift }, { type: "elem", elem: numerm, shift: -numShift }] }, options); } // Since we manually change the style sometimes (with \dfrac or \tfrac), // account for the possible size change here. newOptions = options.havingStyle(style); frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e var delimSize; if (style.size === src_Style.DISPLAY.size) { delimSize = options.fontMetrics().delim1; } else { delimSize = options.fontMetrics().delim2; } var leftDelim; var rightDelim; if (group.leftDelim == null) { leftDelim = makeNullDelimiter(options, ["mopen"]); } else { leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]); } if (group.continued) { rightDelim = buildCommon.makeSpan([]); // zero width for \cfrac } else if (group.rightDelim == null) { rightDelim = makeNullDelimiter(options, ["mclose"]); } else { rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]); } return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options); }; var genfrac_mathmlBuilder = function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mfrac", [buildMathML_buildGroup(group.numer, options), buildMathML_buildGroup(group.denom, options)]); if (!group.hasBarLine) { node.setAttribute("linethickness", "0px"); } else if (group.barSize) { var ruleWidth = units_calculateSize(group.barSize, options); node.setAttribute("linethickness", ruleWidth + "em"); } var style = genfrac_adjustStyle(group.size, options.style); if (style.size !== options.style.size) { node = new mathMLTree.MathNode("mstyle", [node]); var isDisplay = style.size === src_Style.DISPLAY.size ? "true" : "false"; node.setAttribute("displaystyle", isDisplay); node.setAttribute("scriptlevel", "0"); } if (group.leftDelim != null || group.rightDelim != null) { var withDelims = []; if (group.leftDelim != null) { var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]); leftOp.setAttribute("fence", "true"); withDelims.push(leftOp); } withDelims.push(node); if (group.rightDelim != null) { var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]); rightOp.setAttribute("fence", "true"); withDelims.push(rightOp); } return buildMathML_makeRow(withDelims); } return node; }; defineFunction({ type: "genfrac", names: ["\\cfrac", "\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly "\\\\bracefrac", "\\\\brackfrac"], props: { numArgs: 2, greediness: 2 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var numer = args[0]; var denom = args[1]; var hasBarLine; var leftDelim = null; var rightDelim = null; var size = "auto"; switch (funcName) { case "\\cfrac": case "\\dfrac": case "\\frac": case "\\tfrac": hasBarLine = true; break; case "\\\\atopfrac": hasBarLine = false; break; case "\\dbinom": case "\\binom": case "\\tbinom": hasBarLine = false; leftDelim = "("; rightDelim = ")"; break; case "\\\\bracefrac": hasBarLine = false; leftDelim = "\\{"; rightDelim = "\\}"; break; case "\\\\brackfrac": hasBarLine = false; leftDelim = "["; rightDelim = "]"; break; default: throw new Error("Unrecognized genfrac command"); } switch (funcName) { case "\\cfrac": case "\\dfrac": case "\\dbinom": size = "display"; break; case "\\tfrac": case "\\tbinom": size = "text"; break; } return { type: "genfrac", mode: parser.mode, continued: funcName === "\\cfrac", numer: numer, denom: denom, hasBarLine: hasBarLine, leftDelim: leftDelim, rightDelim: rightDelim, size: size, barSize: null }; }, htmlBuilder: genfrac_htmlBuilder, mathmlBuilder: genfrac_mathmlBuilder }); // Infix generalized fractions -- these are not rendered directly, but replaced // immediately by one of the variants above. defineFunction({ type: "infix", names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], props: { numArgs: 0, infix: true }, handler: function handler(_ref2) { var parser = _ref2.parser, funcName = _ref2.funcName, token = _ref2.token; var replaceWith; switch (funcName) { case "\\over": replaceWith = "\\frac"; break; case "\\choose": replaceWith = "\\binom"; break; case "\\atop": replaceWith = "\\\\atopfrac"; break; case "\\brace": replaceWith = "\\\\bracefrac"; break; case "\\brack": replaceWith = "\\\\brackfrac"; break; default: throw new Error("Unrecognized infix genfrac command"); } return { type: "infix", mode: parser.mode, replaceWith: replaceWith, token: token }; } }); var stylArray = ["display", "text", "script", "scriptscript"]; var delimFromValue = function delimFromValue(delimString) { var delim = null; if (delimString.length > 0) { delim = delimString; delim = delim === "." ? null : delim; } return delim; }; defineFunction({ type: "genfrac", names: ["\\genfrac"], props: { numArgs: 6, greediness: 6, argTypes: ["math", "math", "size", "text", "math", "math"] }, handler: function handler(_ref3, args) { var parser = _ref3.parser; var numer = args[4]; var denom = args[5]; // Look into the parse nodes to get the desired delimiters. var leftDelim = args[0].type === "atom" && args[0].family === "open" ? delimFromValue(args[0].text) : null; var rightDelim = args[1].type === "atom" && args[1].family === "close" ? delimFromValue(args[1].text) : null; var barNode = assertNodeType(args[2], "size"); var hasBarLine; var barSize = null; if (barNode.isBlank) { // \genfrac acts differently than \above. // \genfrac treats an empty size group as a signal to use a // standard bar size. \above would see size = 0 and omit the bar. hasBarLine = true; } else { barSize = barNode.value; hasBarLine = barSize.number > 0; } // Find out if we want displaystyle, textstyle, etc. var size = "auto"; var styl = args[3]; if (styl.type === "ordgroup") { if (styl.body.length > 0) { var textOrd = assertNodeType(styl.body[0], "textord"); size = stylArray[Number(textOrd.text)]; } } else { styl = assertNodeType(styl, "textord"); size = stylArray[Number(styl.text)]; } return { type: "genfrac", mode: parser.mode, numer: numer, denom: denom, continued: false, hasBarLine: hasBarLine, barSize: barSize, leftDelim: leftDelim, rightDelim: rightDelim, size: size }; }, htmlBuilder: genfrac_htmlBuilder, mathmlBuilder: genfrac_mathmlBuilder }); // \above is an infix fraction that also defines a fraction bar size. defineFunction({ type: "infix", names: ["\\above"], props: { numArgs: 1, argTypes: ["size"], infix: true }, handler: function handler(_ref4, args) { var parser = _ref4.parser, funcName = _ref4.funcName, token = _ref4.token; return { type: "infix", mode: parser.mode, replaceWith: "\\\\abovefrac", size: assertNodeType(args[0], "size").value, token: token }; } }); defineFunction({ type: "genfrac", names: ["\\\\abovefrac"], props: { numArgs: 3, argTypes: ["math", "size", "math"] }, handler: function handler(_ref5, args) { var parser = _ref5.parser, funcName = _ref5.funcName; var numer = args[0]; var barSize = assert(assertNodeType(args[1], "infix").size); var denom = args[2]; var hasBarLine = barSize.number > 0; return { type: "genfrac", mode: parser.mode, numer: numer, denom: denom, continued: false, hasBarLine: hasBarLine, barSize: barSize, leftDelim: null, rightDelim: null, size: "auto" }; }, htmlBuilder: genfrac_htmlBuilder, mathmlBuilder: genfrac_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/horizBrace.js // NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but var horizBrace_htmlBuilder = function htmlBuilder(grp, options) { var style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node. var supSubGroup; var group; if (grp.type === "supsub") { // Ref: LaTeX source2e: }}}}\limits} // i.e. LaTeX treats the brace similar to an op and passes it // with \limits, so we need to assign supsub style. supSubGroup = grp.sup ? buildHTML_buildGroup(grp.sup, options.havingStyle(style.sup()), options) : buildHTML_buildGroup(grp.sub, options.havingStyle(style.sub()), options); group = assertNodeType(grp.base, "horizBrace"); } else { group = assertNodeType(grp, "horizBrace"); } // Build the base group var body = buildHTML_buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ // This first vlist contains the content and the brace: equation var vlist; if (group.isOver) { vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "kern", size: 0.1 }, { type: "elem", elem: braceBody }] }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[1].classes.push("svg-align"); } else { vlist = buildCommon.makeVList({ positionType: "bottom", positionData: body.depth + 0.1 + braceBody.height, children: [{ type: "elem", elem: braceBody }, { type: "kern", size: 0.1 }, { type: "elem", elem: body }] }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[0].classes.push("svg-align"); } if (supSubGroup) { // To write the supsub, wrap the first vlist in another vlist: // They can't all go in the same vlist, because the note might be // wider than the equation. We want the equation to control the // brace width. // note long note long note // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓ // equation eqn eqn var vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); if (group.isOver) { vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: vSpan }, { type: "kern", size: 0.2 }, { type: "elem", elem: supSubGroup }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "bottom", positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth, children: [{ type: "elem", elem: supSubGroup }, { type: "kern", size: 0.2 }, { type: "elem", elem: vSpan }] }, options); } } return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); }; var horizBrace_mathmlBuilder = function mathmlBuilder(group, options) { var accentNode = stretchy.mathMLnode(group.label); return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildMathML_buildGroup(group.base, options), accentNode]); }; // Horizontal stretchy braces defineFunction({ type: "horizBrace", names: ["\\overbrace", "\\underbrace"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; return { type: "horizBrace", mode: parser.mode, label: funcName, isOver: /^\\over/.test(funcName), base: args[0] }; }, htmlBuilder: horizBrace_htmlBuilder, mathmlBuilder: horizBrace_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/href.js defineFunction({ type: "href", names: ["\\href"], props: { numArgs: 2, argTypes: ["url", "original"], allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; var body = args[1]; var href = assertNodeType(args[0], "url").url; if (!parser.settings.isTrusted({ command: "\\href", url: href })) { return parser.formatUnsupportedCmd("\\href"); } return { type: "href", mode: parser.mode, href: href, body: ordargument(body) }; }, htmlBuilder: function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options, false); return buildCommon.makeAnchor(group.href, [], elements, options); }, mathmlBuilder: function mathmlBuilder(group, options) { var math = buildExpressionRow(group.body, options); if (!(math instanceof mathMLTree_MathNode)) { math = new mathMLTree_MathNode("mrow", [math]); } math.setAttribute("href", group.href); return math; } }); defineFunction({ type: "href", names: ["\\url"], props: { numArgs: 1, argTypes: ["url"], allowedInText: true }, handler: function handler(_ref2, args) { var parser = _ref2.parser; var href = assertNodeType(args[0], "url").url; if (!parser.settings.isTrusted({ command: "\\url", url: href })) { return parser.formatUnsupportedCmd("\\url"); } var chars = []; for (var i = 0; i < href.length; i++) { var c = href[i]; if (c === "~") { c = "\\textasciitilde"; } chars.push({ type: "textord", mode: "text", text: c }); } var body = { type: "text", mode: parser.mode, font: "\\texttt", body: chars }; return { type: "href", mode: parser.mode, href: href, body: ordargument(body) }; } }); // CONCATENATED MODULE: ./src/functions/html.js defineFunction({ type: "html", names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], props: { numArgs: 2, argTypes: ["raw", "original"], allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName, token = _ref.token; var value = assertNodeType(args[0], "raw").string; var body = args[1]; if (parser.settings.strict) { parser.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode"); } var trustContext; var attributes = {}; switch (funcName) { case "\\htmlClass": attributes.class = value; trustContext = { command: "\\htmlClass", class: value }; break; case "\\htmlId": attributes.id = value; trustContext = { command: "\\htmlId", id: value }; break; case "\\htmlStyle": attributes.style = value; trustContext = { command: "\\htmlStyle", style: value }; break; case "\\htmlData": { var data = value.split(","); for (var i = 0; i < data.length; i++) { var keyVal = data[i].split("="); if (keyVal.length !== 2) { throw new src_ParseError("Error parsing key-value for \\htmlData"); } attributes["data-" + keyVal[0].trim()] = keyVal[1].trim(); } trustContext = { command: "\\htmlData", attributes: attributes }; break; } default: throw new Error("Unrecognized html command"); } if (!parser.settings.isTrusted(trustContext)) { return parser.formatUnsupportedCmd(funcName); } return { type: "html", mode: parser.mode, attributes: attributes, body: ordargument(body) }; }, htmlBuilder: function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options, false); var classes = ["enclosing"]; if (group.attributes.class) { classes.push.apply(classes, group.attributes.class.trim().split(/\s+/)); } var span = buildCommon.makeSpan(classes, elements, options); for (var attr in group.attributes) { if (attr !== "class" && group.attributes.hasOwnProperty(attr)) { span.setAttribute(attr, group.attributes[attr]); } } return span; }, mathmlBuilder: function mathmlBuilder(group, options) { return buildExpressionRow(group.body, options); } }); // CONCATENATED MODULE: ./src/functions/htmlmathml.js defineFunction({ type: "htmlmathml", names: ["\\html@mathml"], props: { numArgs: 2, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; return { type: "htmlmathml", mode: parser.mode, html: ordargument(args[0]), mathml: ordargument(args[1]) }; }, htmlBuilder: function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.html, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: function mathmlBuilder(group, options) { return buildExpressionRow(group.mathml, options); } }); // CONCATENATED MODULE: ./src/functions/includegraphics.js var includegraphics_sizeData = function sizeData(str) { if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) { // str is a number with no unit specified. // default unit is bp, per graphix package. return { number: +str, unit: "bp" }; } else { var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str); if (!match) { throw new src_ParseError("Invalid size: '" + str + "' in \\includegraphics"); } var data = { number: +(match[1] + match[2]), // sign + magnitude, cast to number unit: match[3] }; if (!validUnit(data)) { throw new src_ParseError("Invalid unit: '" + data.unit + "' in \\includegraphics."); } return data; } }; defineFunction({ type: "includegraphics", names: ["\\includegraphics"], props: { numArgs: 1, numOptionalArgs: 1, argTypes: ["raw", "url"], allowedInText: false }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser; var width = { number: 0, unit: "em" }; var height = { number: 0.9, unit: "em" }; // sorta character sized. var totalheight = { number: 0, unit: "em" }; var alt = ""; if (optArgs[0]) { var attributeStr = assertNodeType(optArgs[0], "raw").string; // Parser.js does not parse key/value pairs. We get a string. var attributes = attributeStr.split(","); for (var i = 0; i < attributes.length; i++) { var keyVal = attributes[i].split("="); if (keyVal.length === 2) { var str = keyVal[1].trim(); switch (keyVal[0].trim()) { case "alt": alt = str; break; case "width": width = includegraphics_sizeData(str); break; case "height": height = includegraphics_sizeData(str); break; case "totalheight": totalheight = includegraphics_sizeData(str); break; default: throw new src_ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics."); } } } } var src = assertNodeType(args[0], "url").url; if (alt === "") { // No alt given. Use the file name. Strip away the path. alt = src; alt = alt.replace(/^.*[\\/]/, ''); alt = alt.substring(0, alt.lastIndexOf('.')); } if (!parser.settings.isTrusted({ command: "\\includegraphics", url: src })) { return parser.formatUnsupportedCmd("\\includegraphics"); } return { type: "includegraphics", mode: parser.mode, alt: alt, width: width, height: height, totalheight: totalheight, src: src }; }, htmlBuilder: function htmlBuilder(group, options) { var height = units_calculateSize(group.height, options); var depth = 0; if (group.totalheight.number > 0) { depth = units_calculateSize(group.totalheight, options) - height; depth = Number(depth.toFixed(2)); } var width = 0; if (group.width.number > 0) { width = units_calculateSize(group.width, options); } var style = { height: height + depth + "em" }; if (width > 0) { style.width = width + "em"; } if (depth > 0) { style.verticalAlign = -depth + "em"; } var node = new domTree_Img(group.src, group.alt, style); node.height = height; node.depth = depth; return node; }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mglyph", []); node.setAttribute("alt", group.alt); var height = units_calculateSize(group.height, options); var depth = 0; if (group.totalheight.number > 0) { depth = units_calculateSize(group.totalheight, options) - height; depth = depth.toFixed(2); node.setAttribute("valign", "-" + depth + "em"); } node.setAttribute("height", height + depth + "em"); if (group.width.number > 0) { var width = units_calculateSize(group.width, options); node.setAttribute("width", width + "em"); } node.setAttribute("src", group.src); return node; } }); // CONCATENATED MODULE: ./src/functions/kern.js // Horizontal spacing commands // TODO: \hskip and \mskip should support plus and minus in lengths defineFunction({ type: "kern", names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], props: { numArgs: 1, argTypes: ["size"], allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var size = assertNodeType(args[0], "size"); if (parser.settings.strict) { var mathFunction = funcName[1] === 'm'; // \mkern, \mskip var muUnit = size.value.unit === 'mu'; if (mathFunction) { if (!muUnit) { parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units")); } if (parser.mode !== "math") { parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode"); } } else { // !mathFunction if (muUnit) { parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units"); } } } return { type: "kern", mode: parser.mode, dimension: size.value }; }, htmlBuilder: function htmlBuilder(group, options) { return buildCommon.makeGlue(group.dimension, options); }, mathmlBuilder: function mathmlBuilder(group, options) { var dimension = units_calculateSize(group.dimension, options); return new mathMLTree.SpaceNode(dimension); } }); // CONCATENATED MODULE: ./src/functions/lap.js // Horizontal overlap functions defineFunction({ type: "lap", names: ["\\mathllap", "\\mathrlap", "\\mathclap"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; return { type: "lap", mode: parser.mode, alignment: funcName.slice(5), body: body }; }, htmlBuilder: function htmlBuilder(group, options) { // mathllap, mathrlap, mathclap var inner; if (group.alignment === "clap") { // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ inner = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span inner = buildCommon.makeSpan(["inner"], [inner], options); } else { inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options)]); } var fix = buildCommon.makeSpan(["fix"], []); var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the // two items involved in the lap. // Next, use a strut to set the height of the HTML bounding box. // Otherwise, a tall argument may be misplaced. // This code resolved issue #1153 var strut = buildCommon.makeSpan(["strut"]); strut.style.height = node.height + node.depth + "em"; strut.style.verticalAlign = -node.depth + "em"; node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall. // This code resolves issue #1234 node = buildCommon.makeSpan(["thinbox"], [node], options); return buildCommon.makeSpan(["mord", "vbox"], [node], options); }, mathmlBuilder: function mathmlBuilder(group, options) { // mathllap, mathrlap, mathclap var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); if (group.alignment !== "rlap") { var offset = group.alignment === "llap" ? "-1" : "-0.5"; node.setAttribute("lspace", offset + "width"); } node.setAttribute("width", "0px"); return node; } }); // CONCATENATED MODULE: ./src/functions/math.js // Switching from text mode back to math mode defineFunction({ type: "styling", names: ["\\(", "$"], props: { numArgs: 0, allowedInText: true, allowedInMath: false }, handler: function handler(_ref, args) { var funcName = _ref.funcName, parser = _ref.parser; var outerMode = parser.mode; parser.switchMode("math"); var close = funcName === "\\(" ? "\\)" : "$"; var body = parser.parseExpression(false, close); parser.expect(close); parser.switchMode(outerMode); return { type: "styling", mode: parser.mode, style: "text", body: body }; } }); // Check for extra closing math delimiters defineFunction({ type: "text", // Doesn't matter what this is. names: ["\\)", "\\]"], props: { numArgs: 0, allowedInText: true, allowedInMath: false }, handler: function handler(context, args) { throw new src_ParseError("Mismatched " + context.funcName); } }); // CONCATENATED MODULE: ./src/functions/mathchoice.js var mathchoice_chooseMathStyle = function chooseMathStyle(group, options) { switch (options.style.size) { case src_Style.DISPLAY.size: return group.display; case src_Style.TEXT.size: return group.text; case src_Style.SCRIPT.size: return group.script; case src_Style.SCRIPTSCRIPT.size: return group.scriptscript; default: return group.text; } }; defineFunction({ type: "mathchoice", names: ["\\mathchoice"], props: { numArgs: 4 }, handler: function handler(_ref, args) { var parser = _ref.parser; return { type: "mathchoice", mode: parser.mode, display: ordargument(args[0]), text: ordargument(args[1]), script: ordargument(args[2]), scriptscript: ordargument(args[3]) }; }, htmlBuilder: function htmlBuilder(group, options) { var body = mathchoice_chooseMathStyle(group, options); var elements = buildHTML_buildExpression(body, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: function mathmlBuilder(group, options) { var body = mathchoice_chooseMathStyle(group, options); return buildExpressionRow(body, options); } }); // CONCATENATED MODULE: ./src/functions/utils/assembleSupSub.js // For an operator with limits, assemble the base, sup, and sub into a span. var assembleSupSub_assembleSupSub = function assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift) { base = buildCommon.makeSpan([], [base]); var sub; var sup; // We manually have to handle the superscripts and subscripts. This, // aside from the kern calculations, is copied from supsub. if (supGroup) { var elem = buildHTML_buildGroup(supGroup, options.havingStyle(style.sup()), options); sup = { elem: elem, kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) }; } if (subGroup) { var _elem = buildHTML_buildGroup(subGroup, options.havingStyle(style.sub()), options); sub = { elem: _elem, kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height) }; } // Build the final group as a vlist of the possible subscript, base, // and possible superscript. var finalGroup; if (sup && sub) { var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; finalGroup = buildCommon.makeVList({ positionType: "bottom", positionData: bottom, children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] }, options); } else if (sub) { var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note // that we are supposed to shift the limits by 1/2 of the slant, // but since we are centering the limits adding a full slant of // margin will shift by 1/2 that. finalGroup = buildCommon.makeVList({ positionType: "top", positionData: top, children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }] }, options); } else if (sup) { var _bottom = base.depth + baseShift; finalGroup = buildCommon.makeVList({ positionType: "bottom", positionData: _bottom, children: [{ type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] }, options); } else { // This case probably shouldn't occur (this would mean the // supsub was sending us a group with no superscript or // subscript) but be safe. return base; } return buildCommon.makeSpan(["mop", "op-limits"], [finalGroup], options); }; // CONCATENATED MODULE: ./src/functions/op.js // Limits, symbols // Most operators have a large successor symbol, but these don't. var noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also // "supsub" since some of them (like \int) can affect super/subscripting. var op_htmlBuilder = function htmlBuilder(grp, options) { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). var supGroup; var subGroup; var hasLimits = false; var group; if (grp.type === "supsub") { // If we have limits, supsub will pass us its group to handle. Pull // out the superscript and subscript and set the group to the op in // its base. supGroup = grp.sup; subGroup = grp.sub; group = assertNodeType(grp.base, "op"); hasLimits = true; } else { group = assertNodeType(grp, "op"); } var style = options.style; var large = false; if (style.size === src_Style.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) { // Most symbol operators get larger in displaystyle (rule 13) large = true; } var base; if (group.symbol) { // If this is a symbol, create the symbol. var fontName = large ? "Size2-Regular" : "Size1-Regular"; var stash = ""; if (group.name === "\\oiint" || group.name === "\\oiiint") { // No font glyphs yet, so use a glyph w/o the oval. // TODO: When font glyphs are available, delete this code. stash = group.name.substr(1); // $FlowFixMe group.name = stash === "oiint" ? "\\iint" : "\\iiint"; } base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]); if (stash.length > 0) { // We're in \oiint or \oiiint. Overlay the oval. // TODO: When font glyphs are available, delete this code. var italic = base.italic; var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options); base = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: base, shift: 0 }, { type: "elem", elem: oval, shift: large ? 0.08 : 0 }] }, options); // $FlowFixMe group.name = "\\" + stash; base.classes.unshift("mop"); // $FlowFixMe base.italic = italic; } } else if (group.body) { // If this is a list, compose that list. var inner = buildHTML_buildExpression(group.body, options, true); if (inner.length === 1 && inner[0] instanceof domTree_SymbolNode) { base = inner[0]; base.classes[0] = "mop"; // replace old mclass } else { base = buildCommon.makeSpan(["mop"], buildCommon.tryCombineChars(inner), options); } } else { // Otherwise, this is a text operator. Build the text from the // operator's name. // TODO(emily): Add a space in the middle of some of these // operators, like \limsup var output = []; for (var i = 1; i < group.name.length; i++) { output.push(buildCommon.mathsym(group.name[i], group.mode, options)); } base = buildCommon.makeSpan(["mop"], output, options); } // If content of op is a single symbol, shift it vertically. var baseShift = 0; var slant = 0; if ((base instanceof domTree_SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) { // We suppress the shift of the base of \overset and \underset. Otherwise, // shift the symbol so its center lies on the axis (rule 13). It // appears that our fonts have the centers of the symbols already // almost on the axis, so these numbers are very small. Note we // don't actually apply this here, but instead it is used either in // the vlist creation or separately when there are no limits. baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction. // $FlowFixMe slant = base.italic; } if (hasLimits) { return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift); } else { if (baseShift) { base.style.position = "relative"; base.style.top = baseShift + "em"; } return base; } }; var op_mathmlBuilder = function mathmlBuilder(group, options) { var node; if (group.symbol) { // This is a symbol. Just add the symbol. node = new mathMLTree_MathNode("mo", [buildMathML_makeText(group.name, group.mode)]); if (utils.contains(noSuccessor, group.name)) { node.setAttribute("largeop", "false"); } } else if (group.body) { // This is an operator with children. Add them. node = new mathMLTree_MathNode("mo", buildMathML_buildExpression(group.body, options)); } else { // This is a text operator. Add all of the characters from the // operator's name. node = new mathMLTree_MathNode("mi", [new mathMLTree_TextNode(group.name.slice(1))]); // Append an . // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 var operator = new mathMLTree_MathNode("mo", [buildMathML_makeText("\u2061", "text")]); if (group.parentIsSupSub) { node = new mathMLTree_MathNode("mo", [node, operator]); } else { node = newDocumentFragment([node, operator]); } } return node; }; var singleCharBigOps = { "\u220F": "\\prod", "\u2210": "\\coprod", "\u2211": "\\sum", "\u22C0": "\\bigwedge", "\u22C1": "\\bigvee", "\u22C2": "\\bigcap", "\u22C3": "\\bigcup", "\u2A00": "\\bigodot", "\u2A01": "\\bigoplus", "\u2A02": "\\bigotimes", "\u2A04": "\\biguplus", "\u2A06": "\\bigsqcup" }; defineFunction({ type: "op", names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22C0", "\u22C1", "\u22C2", "\u22C3", "\u2A00", "\u2A01", "\u2A02", "\u2A04", "\u2A06"], props: { numArgs: 0 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var fName = funcName; if (fName.length === 1) { fName = singleCharBigOps[fName]; } return { type: "op", mode: parser.mode, limits: true, parentIsSupSub: false, symbol: true, name: fName }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // Note: calling defineFunction with a type that's already been defined only // works because the same htmlBuilder and mathmlBuilder are being used. defineFunction({ type: "op", names: ["\\mathop"], props: { numArgs: 1 }, handler: function handler(_ref2, args) { var parser = _ref2.parser; var body = args[0]; return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: false, body: ordargument(body) }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // There are 2 flags for operators; whether they produce limits in // displaystyle, and whether they are symbols and should grow in // displaystyle. These four groups cover the four possible choices. var singleCharIntegrals = { "\u222B": "\\int", "\u222C": "\\iint", "\u222D": "\\iiint", "\u222E": "\\oint", "\u222F": "\\oiint", "\u2230": "\\oiiint" }; // No limits, not symbols defineFunction({ type: "op", names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], props: { numArgs: 0 }, handler: function handler(_ref3) { var parser = _ref3.parser, funcName = _ref3.funcName; return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: false, name: funcName }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // Limits, not symbols defineFunction({ type: "op", names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"], props: { numArgs: 0 }, handler: function handler(_ref4) { var parser = _ref4.parser, funcName = _ref4.funcName; return { type: "op", mode: parser.mode, limits: true, parentIsSupSub: false, symbol: false, name: funcName }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // No limits, symbols defineFunction({ type: "op", names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222B", "\u222C", "\u222D", "\u222E", "\u222F", "\u2230"], props: { numArgs: 0 }, handler: function handler(_ref5) { var parser = _ref5.parser, funcName = _ref5.funcName; var fName = funcName; if (fName.length === 1) { fName = singleCharIntegrals[fName]; } return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: true, name: fName }; }, htmlBuilder: op_htmlBuilder, mathmlBuilder: op_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/operatorname.js // NOTE: Unlike most `htmlBuilder`s, this one handles not only // "operatorname", but also "supsub" since \operatorname* can var operatorname_htmlBuilder = function htmlBuilder(grp, options) { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). var supGroup; var subGroup; var hasLimits = false; var group; if (grp.type === "supsub") { // If we have limits, supsub will pass us its group to handle. Pull // out the superscript and subscript and set the group to the op in // its base. supGroup = grp.sup; subGroup = grp.sub; group = assertNodeType(grp.base, "operatorname"); hasLimits = true; } else { group = assertNodeType(grp, "operatorname"); } var base; if (group.body.length > 0) { var body = group.body.map(function (child) { // $FlowFixMe: Check if the node has a string `text` property. var childText = child.text; if (typeof childText === "string") { return { type: "textord", mode: child.mode, text: childText }; } else { return child; } }); // Consolidate function names into symbol characters. var expression = buildHTML_buildExpression(body, options.withFont("mathrm"), true); for (var i = 0; i < expression.length; i++) { var child = expression[i]; if (child instanceof domTree_SymbolNode) { // Per amsopn package, // change minus to hyphen and \ast to asterisk child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); } } base = buildCommon.makeSpan(["mop"], expression, options); } else { base = buildCommon.makeSpan(["mop"], [], options); } if (hasLimits) { return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0); } else { return base; } }; var operatorname_mathmlBuilder = function mathmlBuilder(group, options) { // The steps taken here are similar to the html version. var expression = buildMathML_buildExpression(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction? var isAllString = true; // default for (var i = 0; i < expression.length; i++) { var node = expression[i]; if (node instanceof mathMLTree.SpaceNode) {// Do nothing } else if (node instanceof mathMLTree.MathNode) { switch (node.type) { case "mi": case "mn": case "ms": case "mspace": case "mtext": break; // Do nothing yet. case "mo": { var child = node.children[0]; if (node.children.length === 1 && child instanceof mathMLTree.TextNode) { child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); } else { isAllString = false; } break; } default: isAllString = false; } } else { isAllString = false; } } if (isAllString) { // Write a single TextNode instead of multiple nested tags. var word = expression.map(function (node) { return node.toText(); }).join(""); expression = [new mathMLTree.TextNode(word)]; } var identifier = new mathMLTree.MathNode("mi", expression); identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡ // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp var operator = new mathMLTree.MathNode("mo", [buildMathML_makeText("\u2061", "text")]); if (group.parentIsSupSub) { return new mathMLTree.MathNode("mo", [identifier, operator]); } else { return mathMLTree.newDocumentFragment([identifier, operator]); } }; // \operatorname // amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@ defineFunction({ type: "operatorname", names: ["\\operatorname", "\\operatorname*"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; return { type: "operatorname", mode: parser.mode, body: ordargument(body), alwaysHandleSupSub: funcName === "\\operatorname*", limits: false, parentIsSupSub: false }; }, htmlBuilder: operatorname_htmlBuilder, mathmlBuilder: operatorname_mathmlBuilder }); // CONCATENATED MODULE: ./src/functions/ordgroup.js defineFunctionBuilders({ type: "ordgroup", htmlBuilder: function htmlBuilder(group, options) { if (group.semisimple) { return buildCommon.makeFragment(buildHTML_buildExpression(group.body, options, false)); } return buildCommon.makeSpan(["mord"], buildHTML_buildExpression(group.body, options, true), options); }, mathmlBuilder: function mathmlBuilder(group, options) { return buildExpressionRow(group.body, options, true); } }); // CONCATENATED MODULE: ./src/functions/overline.js defineFunction({ type: "overline", names: ["\\overline"], props: { numArgs: 1 }, handler: function handler(_ref, args) { var parser = _ref.parser; var body = args[0]; return { type: "overline", mode: parser.mode, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { // Overlines are handled in the TeXbook pg 443, Rule 9. // Build the inner group in the cramped style. var innerGroup = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body var line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; var vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: innerGroup }, { type: "kern", size: 3 * defaultRuleThickness }, { type: "elem", elem: line }, { type: "kern", size: defaultRuleThickness }] }, options); return buildCommon.makeSpan(["mord", "overline"], [vlist], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]); operator.setAttribute("stretchy", "true"); var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.body, options), operator]); node.setAttribute("accent", "true"); return node; } }); // CONCATENATED MODULE: ./src/functions/phantom.js defineFunction({ type: "phantom", names: ["\\phantom"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; var body = args[0]; return { type: "phantom", mode: parser.mode, body: ordargument(body) }; }, htmlBuilder: function htmlBuilder(group, options) { var elements = buildHTML_buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. // See "color" for more details. return buildCommon.makeFragment(elements); }, mathmlBuilder: function mathmlBuilder(group, options) { var inner = buildMathML_buildExpression(group.body, options); return new mathMLTree.MathNode("mphantom", inner); } }); defineFunction({ type: "hphantom", names: ["\\hphantom"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref2, args) { var parser = _ref2.parser; var body = args[0]; return { type: "hphantom", mode: parser.mode, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options.withPhantom())]); node.height = 0; node.depth = 0; if (node.children) { for (var i = 0; i < node.children.length; i++) { node.children[i].height = 0; node.children[i].depth = 0; } } // See smash for comment re: use of makeVList node = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: node }] }, options); // For spacing, TeX treats \smash as a math group (same spacing as ord). return buildCommon.makeSpan(["mord"], [node], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var inner = buildMathML_buildExpression(ordargument(group.body), options); var phantom = new mathMLTree.MathNode("mphantom", inner); var node = new mathMLTree.MathNode("mpadded", [phantom]); node.setAttribute("height", "0px"); node.setAttribute("depth", "0px"); return node; } }); defineFunction({ type: "vphantom", names: ["\\vphantom"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref3, args) { var parser = _ref3.parser; var body = args[0]; return { type: "vphantom", mode: parser.mode, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { var inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options.withPhantom())]); var fix = buildCommon.makeSpan(["fix"], []); return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var inner = buildMathML_buildExpression(ordargument(group.body), options); var phantom = new mathMLTree.MathNode("mphantom", inner); var node = new mathMLTree.MathNode("mpadded", [phantom]); node.setAttribute("width", "0px"); return node; } }); // CONCATENATED MODULE: ./src/functions/raisebox.js // Box manipulation defineFunction({ type: "raisebox", names: ["\\raisebox"], props: { numArgs: 2, argTypes: ["size", "hbox"], allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; var amount = assertNodeType(args[0], "size").value; var body = args[1]; return { type: "raisebox", mode: parser.mode, dy: amount, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { var body = buildHTML_buildGroup(group.body, options); var dy = units_calculateSize(group.dy, options); return buildCommon.makeVList({ positionType: "shift", positionData: -dy, children: [{ type: "elem", elem: body }] }, options); }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); var dy = group.dy.number + group.dy.unit; node.setAttribute("voffset", dy); return node; } }); // CONCATENATED MODULE: ./src/functions/rule.js defineFunction({ type: "rule", names: ["\\rule"], props: { numArgs: 2, numOptionalArgs: 1, argTypes: ["size", "size", "size"] }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser; var shift = optArgs[0]; var width = assertNodeType(args[0], "size"); var height = assertNodeType(args[1], "size"); return { type: "rule", mode: parser.mode, shift: shift && assertNodeType(shift, "size").value, width: width.value, height: height.value }; }, htmlBuilder: function htmlBuilder(group, options) { // Make an empty span for the rule var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units var width = units_calculateSize(group.width, options); var height = units_calculateSize(group.height, options); var shift = group.shift ? units_calculateSize(group.shift, options) : 0; // Style the rule to the right size rule.style.borderRightWidth = width + "em"; rule.style.borderTopWidth = height + "em"; rule.style.bottom = shift + "em"; // Record the height and width rule.width = width; rule.height = height + shift; rule.depth = -shift; // Font size is the number large enough that the browser will // reserve at least `absHeight` space above the baseline. // The 1.125 factor was empirically determined rule.maxFontSize = height * 1.125 * options.sizeMultiplier; return rule; }, mathmlBuilder: function mathmlBuilder(group, options) { var width = units_calculateSize(group.width, options); var height = units_calculateSize(group.height, options); var shift = group.shift ? units_calculateSize(group.shift, options) : 0; var color = options.color && options.getColor() || "black"; var rule = new mathMLTree.MathNode("mspace"); rule.setAttribute("mathbackground", color); rule.setAttribute("width", width + "em"); rule.setAttribute("height", height + "em"); var wrapper = new mathMLTree.MathNode("mpadded", [rule]); if (shift >= 0) { wrapper.setAttribute("height", "+" + shift + "em"); } else { wrapper.setAttribute("height", shift + "em"); wrapper.setAttribute("depth", "+" + -shift + "em"); } wrapper.setAttribute("voffset", shift + "em"); return wrapper; } }); // CONCATENATED MODULE: ./src/functions/sizing.js function sizingGroup(value, options, baseOptions) { var inner = buildHTML_buildExpression(value, options, false); var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize // manually. Handle nested size changes. for (var i = 0; i < inner.length; i++) { var pos = inner[i].classes.indexOf("sizing"); if (pos < 0) { Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions)); } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { // This is a nested size change: e.g., inner[i] is the "b" in // `\Huge a \small b`. Override the old size (the `reset-` class) // but not the new size. inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; } inner[i].height *= multiplier; inner[i].depth *= multiplier; } return buildCommon.makeFragment(inner); } var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; var sizing_htmlBuilder = function htmlBuilder(group, options) { // Handle sizing operators like \Huge. Real TeX doesn't actually allow // these functions inside of math expressions, so we do some special // handling. var newOptions = options.havingSize(group.size); return sizingGroup(group.body, newOptions, options); }; defineFunction({ type: "sizing", names: sizeFuncs, props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref, args) { var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser; var body = parser.parseExpression(false, breakOnTokenText); return { type: "sizing", mode: parser.mode, // Figure out what size to use based on the list of functions above size: sizeFuncs.indexOf(funcName) + 1, body: body }; }, htmlBuilder: sizing_htmlBuilder, mathmlBuilder: function mathmlBuilder(group, options) { var newOptions = options.havingSize(group.size); var inner = buildMathML_buildExpression(group.body, newOptions); var node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size // changes, because we don't keep state of what style we're currently // in, so we can't reset the size to normal before changing it. Now // that we're passing an options parameter we should be able to fix // this. node.setAttribute("mathsize", newOptions.sizeMultiplier + "em"); return node; } }); // CONCATENATED MODULE: ./src/functions/smash.js // smash, with optional [tb], as in AMS defineFunction({ type: "smash", names: ["\\smash"], props: { numArgs: 1, numOptionalArgs: 1, allowedInText: true }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser; var smashHeight = false; var smashDepth = false; var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); if (tbArg) { // Optional [tb] argument is engaged. // ref: amsmath: \renewcommand{\smash}[1][tb]{% // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% var letter = ""; for (var i = 0; i < tbArg.body.length; ++i) { var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property. letter = node.text; if (letter === "t") { smashHeight = true; } else if (letter === "b") { smashDepth = true; } else { smashHeight = false; smashDepth = false; break; } } } else { smashHeight = true; smashDepth = true; } var body = args[0]; return { type: "smash", mode: parser.mode, body: body, smashHeight: smashHeight, smashDepth: smashDepth }; }, htmlBuilder: function htmlBuilder(group, options) { var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); if (!group.smashHeight && !group.smashDepth) { return node; } if (group.smashHeight) { node.height = 0; // In order to influence makeVList, we have to reset the children. if (node.children) { for (var i = 0; i < node.children.length; i++) { node.children[i].height = 0; } } } if (group.smashDepth) { node.depth = 0; if (node.children) { for (var _i = 0; _i < node.children.length; _i++) { node.children[_i].depth = 0; } } } // At this point, we've reset the TeX-like height and depth values. // But the span still has an HTML line height. // makeVList applies "display: table-cell", which prevents the browser // from acting on that line height. So we'll call makeVList now. var smashedNode = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: node }] }, options); // For spacing, TeX treats \hphantom as a math group (same spacing as ord). return buildCommon.makeSpan(["mord"], [smashedNode], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); if (group.smashHeight) { node.setAttribute("height", "0px"); } if (group.smashDepth) { node.setAttribute("depth", "0px"); } return node; } }); // CONCATENATED MODULE: ./src/functions/sqrt.js defineFunction({ type: "sqrt", names: ["\\sqrt"], props: { numArgs: 1, numOptionalArgs: 1 }, handler: function handler(_ref, args, optArgs) { var parser = _ref.parser; var index = optArgs[0]; var body = args[0]; return { type: "sqrt", mode: parser.mode, body: body, index: index }; }, htmlBuilder: function htmlBuilder(group, options) { // Square roots are handled in the TeXbook pg. 443, Rule 11. // First, we do the same steps as in overline to build the inner group // and line var inner = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); if (inner.height === 0) { // Render a small surd. inner.height = options.fontMetrics().xHeight; } // Some groups can return document fragments. Handle those by wrapping // them in a span. inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter var metrics = options.fontMetrics(); var theta = metrics.defaultRuleThickness; var phi = theta; if (options.style.id < src_Style.TEXT.id) { phi = options.fontMetrics().xHeight; } // Calculate the clearance between the body and line var lineClearance = theta + phi / 4; var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size var _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options), img = _delimiter$sqrtImage.span, ruleWidth = _delimiter$sqrtImage.ruleWidth, advanceWidth = _delimiter$sqrtImage.advanceWidth; var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size if (delimDepth > inner.height + inner.depth + lineClearance) { lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2; } // Shift the sqrt image var imgShift = img.height - inner.height - lineClearance - ruleWidth; inner.style.paddingLeft = advanceWidth + "em"; // Overlay the image and the argument. var body = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: inner, wrapperClasses: ["svg-align"] }, { type: "kern", size: -(inner.height + imgShift) }, { type: "elem", elem: img }, { type: "kern", size: ruleWidth }] }, options); if (!group.index) { return buildCommon.makeSpan(["mord", "sqrt"], [body], options); } else { // Handle the optional root index // The index is always in scriptscript style var newOptions = options.havingStyle(src_Style.SCRIPTSCRIPT); var rootm = buildHTML_buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX // source, in the definition of `\r@@t`. var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly var rootVList = buildCommon.makeVList({ positionType: "shift", positionData: -toShift, children: [{ type: "elem", elem: rootm }] }, options); // Add a class surrounding it so we can add on the appropriate // kerning var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options); } }, mathmlBuilder: function mathmlBuilder(group, options) { var body = group.body, index = group.index; return index ? new mathMLTree.MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new mathMLTree.MathNode("msqrt", [buildMathML_buildGroup(body, options)]); } }); // CONCATENATED MODULE: ./src/functions/styling.js var styling_styleMap = { "display": src_Style.DISPLAY, "text": src_Style.TEXT, "script": src_Style.SCRIPT, "scriptscript": src_Style.SCRIPTSCRIPT }; defineFunction({ type: "styling", names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], props: { numArgs: 0, allowedInText: true }, handler: function handler(_ref, args) { var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser; // parse out the implicit body var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g. // here and in buildHTML and de-dupe the enumeration of all the styles). // $FlowFixMe: The names above exactly match the styles. var style = funcName.slice(1, funcName.length - 5); return { type: "styling", mode: parser.mode, // Figure out what style to use by pulling out the style from // the function name style: style, body: body }; }, htmlBuilder: function htmlBuilder(group, options) { // Style changes are handled in the TeXbook on pg. 442, Rule 3. var newStyle = styling_styleMap[group.style]; var newOptions = options.havingStyle(newStyle).withFont(''); return sizingGroup(group.body, newOptions, options); }, mathmlBuilder: function mathmlBuilder(group, options) { // Figure out what style we're changing to. var newStyle = styling_styleMap[group.style]; var newOptions = options.havingStyle(newStyle); var inner = buildMathML_buildExpression(group.body, newOptions); var node = new mathMLTree.MathNode("mstyle", inner); var styleAttributes = { "display": ["0", "true"], "text": ["0", "false"], "script": ["1", "false"], "scriptscript": ["2", "false"] }; var attr = styleAttributes[group.style]; node.setAttribute("scriptlevel", attr[0]); node.setAttribute("displaystyle", attr[1]); return node; } }); // CONCATENATED MODULE: ./src/functions/supsub.js /** * Sometimes, groups perform special rules when they have superscripts or * subscripts attached to them. This function lets the `supsub` group know that * Sometimes, groups perform special rules when they have superscripts or * its inner element should handle the superscripts and subscripts instead of * handling them itself. */ var supsub_htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { var base = group.base; if (!base) { return null; } else if (base.type === "op") { // Operators handle supsubs differently when they have limits // (e.g. `\displaystyle\sum_2^3`) var delegate = base.limits && (options.style.size === src_Style.DISPLAY.size || base.alwaysHandleSupSub); return delegate ? op_htmlBuilder : null; } else if (base.type === "operatorname") { var _delegate = base.alwaysHandleSupSub && (options.style.size === src_Style.DISPLAY.size || base.limits); return _delegate ? operatorname_htmlBuilder : null; } else if (base.type === "accent") { return utils.isCharacterBox(base.base) ? accent_htmlBuilder : null; } else if (base.type === "horizBrace") { var isSup = !group.sub; return isSup === base.isOver ? horizBrace_htmlBuilder : null; } else { return null; } }; // Super scripts and subscripts, whose precise placement can depend on other // functions that precede them. defineFunctionBuilders({ type: "supsub", htmlBuilder: function htmlBuilder(group, options) { // Superscript and subscripts are handled in the TeXbook on page // 445-446, rules 18(a-f). // Here is where we defer to the inner group if it should handle // superscripts and subscripts itself. var builderDelegate = supsub_htmlBuilderDelegate(group, options); if (builderDelegate) { return builderDelegate(group, options); } var valueBase = group.base, valueSup = group.sup, valueSub = group.sub; var base = buildHTML_buildGroup(valueBase, options); var supm; var subm; var metrics = options.fontMetrics(); // Rule 18a var supShift = 0; var subShift = 0; var isCharacterBox = valueBase && utils.isCharacterBox(valueBase); if (valueSup) { var newOptions = options.havingStyle(options.style.sup()); supm = buildHTML_buildGroup(valueSup, newOptions, options); if (!isCharacterBox) { supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier; } } if (valueSub) { var _newOptions = options.havingStyle(options.style.sub()); subm = buildHTML_buildGroup(valueSub, _newOptions, options); if (!isCharacterBox) { subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier; } } // Rule 18c var minSupShift; if (options.style === src_Style.DISPLAY) { minSupShift = metrics.sup1; } else if (options.style.cramped) { minSupShift = metrics.sup3; } else { minSupShift = metrics.sup2; } // scriptspace is a font-size-independent size, so scale it // appropriately for use as the marginRight. var multiplier = options.sizeMultiplier; var marginRight = 0.5 / metrics.ptPerEm / multiplier + "em"; var marginLeft = null; if (subm) { // Subscripts shouldn't be shifted by the base's italic correction. // Account for that by shifting the subscript back the appropriate // amount. Note we only do this when the base is a single symbol. var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); if (base instanceof domTree_SymbolNode || isOiint) { // $FlowFixMe marginLeft = -base.italic + "em"; } } var supsub; if (supm && subm) { supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); subShift = Math.max(subShift, metrics.sub2); var ruleWidth = metrics.defaultRuleThickness; // Rule 18e var maxWidth = 4 * ruleWidth; if (supShift - supm.depth - (subm.height - subShift) < maxWidth) { subShift = maxWidth - (supShift - supm.depth) + subm.height; var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); if (psi > 0) { supShift += psi; subShift -= psi; } } var vlistElem = [{ type: "elem", elem: subm, shift: subShift, marginRight: marginRight, marginLeft: marginLeft }, { type: "elem", elem: supm, shift: -supShift, marginRight: marginRight }]; supsub = buildCommon.makeVList({ positionType: "individualShift", children: vlistElem }, options); } else if (subm) { // Rule 18b subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); var _vlistElem = [{ type: "elem", elem: subm, marginLeft: marginLeft, marginRight: marginRight }]; supsub = buildCommon.makeVList({ positionType: "shift", positionData: subShift, children: _vlistElem }, options); } else if (supm) { // Rule 18c, d supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); supsub = buildCommon.makeVList({ positionType: "shift", positionData: -supShift, children: [{ type: "elem", elem: supm, marginRight: marginRight }] }, options); } else { throw new Error("supsub must have either sup or sub."); } // Wrap the supsub vlist in a span.msupsub to reset text-align. var mclass = getTypeOfDomTree(base, "right") || "mord"; return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options); }, mathmlBuilder: function mathmlBuilder(group, options) { // Is the inner group a relevant horizonal brace? var isBrace = false; var isOver; var isSup; if (group.base && group.base.type === "horizBrace") { isSup = !!group.sup; if (isSup === group.base.isOver) { isBrace = true; isOver = group.base.isOver; } } if (group.base && (group.base.type === "op" || group.base.type === "operatorname")) { group.base.parentIsSupSub = true; } var children = [buildMathML_buildGroup(group.base, options)]; if (group.sub) { children.push(buildMathML_buildGroup(group.sub, options)); } if (group.sup) { children.push(buildMathML_buildGroup(group.sup, options)); } var nodeType; if (isBrace) { nodeType = isOver ? "mover" : "munder"; } else if (!group.sub) { var base = group.base; if (base && base.type === "op" && base.limits && (options.style === src_Style.DISPLAY || base.alwaysHandleSupSub)) { nodeType = "mover"; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === src_Style.DISPLAY)) { nodeType = "mover"; } else { nodeType = "msup"; } } else if (!group.sup) { var _base = group.base; if (_base && _base.type === "op" && _base.limits && (options.style === src_Style.DISPLAY || _base.alwaysHandleSupSub)) { nodeType = "munder"; } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options.style === src_Style.DISPLAY)) { nodeType = "munder"; } else { nodeType = "msub"; } } else { var _base2 = group.base; if (_base2 && _base2.type === "op" && _base2.limits && options.style === src_Style.DISPLAY) { nodeType = "munderover"; } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options.style === src_Style.DISPLAY || _base2.limits)) { nodeType = "munderover"; } else { nodeType = "msubsup"; } } var node = new mathMLTree.MathNode(nodeType, children); return node; } }); // CONCATENATED MODULE: ./src/functions/symbolsOp.js // Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js. defineFunctionBuilders({ type: "atom", htmlBuilder: function htmlBuilder(group, options) { return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]); }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.text, group.mode)]); if (group.family === "bin") { var variant = buildMathML_getVariant(group, options); if (variant === "bold-italic") { node.setAttribute("mathvariant", variant); } } else if (group.family === "punct") { node.setAttribute("separator", "true"); } else if (group.family === "open" || group.family === "close") { // Delims built here should not stretch vertically. // See delimsizing.js for stretchy delims. node.setAttribute("stretchy", "false"); } return node; } }); // CONCATENATED MODULE: ./src/functions/symbolsOrd.js // "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in var defaultVariant = { "mi": "italic", "mn": "normal", "mtext": "normal" }; defineFunctionBuilders({ type: "mathord", htmlBuilder: function htmlBuilder(group, options) { return buildCommon.makeOrd(group, options, "mathord"); }, mathmlBuilder: function mathmlBuilder(group, options) { var node = new mathMLTree.MathNode("mi", [buildMathML_makeText(group.text, group.mode, options)]); var variant = buildMathML_getVariant(group, options) || "italic"; if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); } return node; } }); defineFunctionBuilders({ type: "textord", htmlBuilder: function htmlBuilder(group, options) { return buildCommon.makeOrd(group, options, "textord"); }, mathmlBuilder: function mathmlBuilder(group, options) { var text = buildMathML_makeText(group.text, group.mode, options); var variant = buildMathML_getVariant(group, options) || "normal"; var node; if (group.mode === 'text') { node = new mathMLTree.MathNode("mtext", [text]); } else if (/[0-9]/.test(group.text)) { // TODO(kevinb) merge adjacent nodes // do it as a post processing step node = new mathMLTree.MathNode("mn", [text]); } else if (group.text === "\\prime") { node = new mathMLTree.MathNode("mo", [text]); } else { node = new mathMLTree.MathNode("mi", [text]); } if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); } return node; } }); // CONCATENATED MODULE: ./src/functions/symbolsSpacing.js // A map of CSS-based spacing functions to their CSS class. var cssSpace = { "\\nobreak": "nobreak", "\\allowbreak": "allowbreak" }; // A lookup table to determine whether a spacing function/symbol should be // treated like a regular space character. If a symbol or command is a key // in this table, then it should be a regular space character. Furthermore, // the associated value may have a `className` specifying an extra CSS class // to add to the created `span`. var regularSpace = { " ": {}, "\\ ": {}, "~": { className: "nobreak" }, "\\space": {}, "\\nobreakspace": { className: "nobreak" } }; // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in // src/symbols.js. defineFunctionBuilders({ type: "spacing", htmlBuilder: function htmlBuilder(group, options) { if (regularSpace.hasOwnProperty(group.text)) { var className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these // things has an entry in the symbols table, so these will be turned // into appropriate outputs. if (group.mode === "text") { var ord = buildCommon.makeOrd(group, options, "textord"); ord.classes.push(className); return ord; } else { return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options); } } else if (cssSpace.hasOwnProperty(group.text)) { // Spaces based on just a CSS class. return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options); } else { throw new src_ParseError("Unknown type of space \"" + group.text + "\""); } }, mathmlBuilder: function mathmlBuilder(group, options) { var node; if (regularSpace.hasOwnProperty(group.text)) { node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\xA0")]); } else if (cssSpace.hasOwnProperty(group.text)) { // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored return new mathMLTree.MathNode("mspace"); } else { throw new src_ParseError("Unknown type of space \"" + group.text + "\""); } return node; } }); // CONCATENATED MODULE: ./src/functions/tag.js var tag_pad = function pad() { var padNode = new mathMLTree.MathNode("mtd", []); padNode.setAttribute("width", "50%"); return padNode; }; defineFunctionBuilders({ type: "tag", mathmlBuilder: function mathmlBuilder(group, options) { var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]); table.setAttribute("width", "100%"); return table; // TODO: Left-aligned tags. // Currently, the group and options passed here do not contain // enough info to set tag alignment. `leqno` is in Settings but it is // not passed to Options. On the HTML side, leqno is // set by a CSS class applied in buildTree.js. That would have worked // in MathML if browsers supported . Since they don't, we // need to rewrite the way this function is called. } }); // CONCATENATED MODULE: ./src/functions/text.js // Non-mathy text, possibly in a font var textFontFamilies = { "\\text": undefined, "\\textrm": "textrm", "\\textsf": "textsf", "\\texttt": "texttt", "\\textnormal": "textrm" }; var textFontWeights = { "\\textbf": "textbf", "\\textmd": "textmd" }; var textFontShapes = { "\\textit": "textit", "\\textup": "textup" }; var optionsWithFont = function optionsWithFont(group, options) { var font = group.font; // Checks if the argument is a font family or a font style. if (!font) { return options; } else if (textFontFamilies[font]) { return options.withTextFontFamily(textFontFamilies[font]); } else if (textFontWeights[font]) { return options.withTextFontWeight(textFontWeights[font]); } else { return options.withTextFontShape(textFontShapes[font]); } }; defineFunction({ type: "text", names: [// Font families "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights "\\textbf", "\\textmd", // Font Shapes "\\textit", "\\textup"], props: { numArgs: 1, argTypes: ["text"], greediness: 2, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser, funcName = _ref.funcName; var body = args[0]; return { type: "text", mode: parser.mode, body: ordargument(body), font: funcName }; }, htmlBuilder: function htmlBuilder(group, options) { var newOptions = optionsWithFont(group, options); var inner = buildHTML_buildExpression(group.body, newOptions, true); return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions); }, mathmlBuilder: function mathmlBuilder(group, options) { var newOptions = optionsWithFont(group, options); return buildExpressionRow(group.body, newOptions); } }); // CONCATENATED MODULE: ./src/functions/underline.js defineFunction({ type: "underline", names: ["\\underline"], props: { numArgs: 1, allowedInText: true }, handler: function handler(_ref, args) { var parser = _ref.parser; return { type: "underline", mode: parser.mode, body: args[0] }; }, htmlBuilder: function htmlBuilder(group, options) { // Underlines are handled in the TeXbook pg 443, Rule 10. // Build the inner group. var innerGroup = buildHTML_buildGroup(group.body, options); // Create the line to go below the body var line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; var vlist = buildCommon.makeVList({ positionType: "top", positionData: innerGroup.height, children: [{ type: "kern", size: defaultRuleThickness }, { type: "elem", elem: line }, { type: "kern", size: 3 * defaultRuleThickness }, { type: "elem", elem: innerGroup }] }, options); return buildCommon.makeSpan(["mord", "underline"], [vlist], options); }, mathmlBuilder: function mathmlBuilder(group, options) { var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]); operator.setAttribute("stretchy", "true"); var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.body, options), operator]); node.setAttribute("accentunder", "true"); return node; } }); // CONCATENATED MODULE: ./src/functions/verb.js defineFunction({ type: "verb", names: ["\\verb"], props: { numArgs: 0, allowedInText: true }, handler: function handler(context, args, optArgs) { // \verb and \verb* are dealt with directly in Parser.js. // If we end up here, it's because of a failure to match the two delimiters // in the regex in Lexer.js. LaTeX raises the following error when \verb is // terminated by end of line (or file). throw new src_ParseError("\\verb ended by end of line instead of matching delimiter"); }, htmlBuilder: function htmlBuilder(group, options) { var text = makeVerb(group); var body = []; // \verb enters text mode and therefore is sized like \textstyle var newOptions = options.havingStyle(options.style.text()); for (var i = 0; i < text.length; i++) { var c = text[i]; if (c === '~') { c = '\\textasciitilde'; } body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"])); } return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions); }, mathmlBuilder: function mathmlBuilder(group, options) { var text = new mathMLTree.TextNode(makeVerb(group)); var node = new mathMLTree.MathNode("mtext", [text]); node.setAttribute("mathvariant", "monospace"); return node; } }); /** * Converts verb group into body string. * * \verb* replaces each space with an open box \u2423 * \verb replaces each space with a no-break space \xA0 */ var makeVerb = function makeVerb(group) { return group.body.replace(/ /g, group.star ? "\u2423" : '\xA0'); }; // CONCATENATED MODULE: ./src/functions.js /** Include this to ensure that all functions are defined. */ var functions = _functions; /* harmony default export */ var src_functions = (functions); // TODO(kevinb): have functions return an object and call defineFunction with // that object in this file instead of relying on side-effects. // CONCATENATED MODULE: ./src/Lexer.js /** * The Lexer class handles tokenizing the input in various ways. Since our * parser expects us to be able to backtrack, the lexer allows lexing from any * given starting point. * * Its main exposed function is the `lex` function, which takes a position to * lex from and a type of token to lex. It defers to the appropriate `_innerLex` * function. * * The various `_innerLex` functions perform the actual lexing of different * kinds. */ /* The following tokenRegex * - matches typical whitespace (but not NBSP etc.) using its first group * - does not match any control character \x00-\x1f except whitespace * - does not match a bare backslash * - matches any ASCII character except those just mentioned * - does not match the BMP private use area \uE000-\uF8FF * - does not match bare surrogate code units * - matches any BMP character except for those just described * - matches any valid Unicode surrogate pair * - matches a backslash followed by one or more letters * - matches a backslash followed by any BMP character, including newline * Just because the Lexer matches something doesn't mean it's valid input: * If there is no matching function or symbol definition, the Parser will * still reject the input. */ var spaceRegexString = "[ \r\n\t]"; var controlWordRegexString = "\\\\[a-zA-Z@]+"; var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; var controlWordWhitespaceRegexString = "" + controlWordRegexString + spaceRegexString + "*"; var controlWordWhitespaceRegex = new RegExp("^(" + controlWordRegexString + ")" + spaceRegexString + "*$"); var combiningDiacriticalMarkString = "[\u0300-\u036F]"; var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$"); var tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + ( // single codepoint combiningDiacriticalMarkString + "*") + // ...plus accents "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + ( // surrogate pair combiningDiacriticalMarkString + "*") + // ...plus accents "|\\\\verb\\*([^]).*?\\3" + // \verb* "|\\\\verb([^*a-zA-Z]).*?\\4" + // \verb unstarred "|\\\\operatorname\\*" + ( // \operatorname* "|" + controlWordWhitespaceRegexString) + ( // \macroName + spaces "|" + controlSymbolRegexString + ")"); // \\, \', etc. /** Main Lexer class */ var Lexer_Lexer = /*#__PURE__*/ function () { // category codes, only supports comment characters (14) for now function Lexer(input, settings) { this.input = void 0; this.settings = void 0; this.tokenRegex = void 0; this.catcodes = void 0; // Separate accents from characters this.input = input; this.settings = settings; this.tokenRegex = new RegExp(tokenRegexString, 'g'); this.catcodes = { "%": 14 // comment character }; } var _proto = Lexer.prototype; _proto.setCatcode = function setCatcode(char, code) { this.catcodes[char] = code; } /** * This function lexes a single token. */ ; _proto.lex = function lex() { var input = this.input; var pos = this.tokenRegex.lastIndex; if (pos === input.length) { return new Token_Token("EOF", new SourceLocation(this, pos, pos)); } var match = this.tokenRegex.exec(input); if (match === null || match.index !== pos) { throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token_Token(input[pos], new SourceLocation(this, pos, pos + 1))); } var text = match[2] || " "; if (this.catcodes[text] === 14) { // comment character var nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex); if (nlIndex === -1) { this.tokenRegex.lastIndex = input.length; // EOF this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)"); } else { this.tokenRegex.lastIndex = nlIndex + 1; } return this.lex(); } // Trim any trailing whitespace from control word match var controlMatch = text.match(controlWordWhitespaceRegex); if (controlMatch) { text = controlMatch[1]; } return new Token_Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex)); }; return Lexer; }(); // CONCATENATED MODULE: ./src/Namespace.js /** * A `Namespace` refers to a space of nameable things like macros or lengths, * which can be `set` either globally or local to a nested group, using an * undo stack similar to how TeX implements this functionality. * Performance-wise, `get` and local `set` take constant time, while global * `set` takes time proportional to the depth of group nesting. */ var Namespace_Namespace = /*#__PURE__*/ function () { /** * Both arguments are optional. The first argument is an object of * built-in mappings which never change. The second argument is an object * of initial (global-level) mappings, which will constantly change * according to any global/top-level `set`s done. */ function Namespace(builtins, globalMacros) { if (builtins === void 0) { builtins = {}; } if (globalMacros === void 0) { globalMacros = {}; } this.current = void 0; this.builtins = void 0; this.undefStack = void 0; this.current = globalMacros; this.builtins = builtins; this.undefStack = []; } /** * Start a new nested group, affecting future local `set`s. */ var _proto = Namespace.prototype; _proto.beginGroup = function beginGroup() { this.undefStack.push({}); } /** * End current nested group, restoring values before the group began. */ ; _proto.endGroup = function endGroup() { if (this.undefStack.length === 0) { throw new src_ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug"); } var undefs = this.undefStack.pop(); for (var undef in undefs) { if (undefs.hasOwnProperty(undef)) { if (undefs[undef] === undefined) { delete this.current[undef]; } else { this.current[undef] = undefs[undef]; } } } } /** * Detect whether `name` has a definition. Equivalent to * `get(name) != null`. */ ; _proto.has = function has(name) { return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name); } /** * Get the current value of a name, or `undefined` if there is no value. * * Note: Do not use `if (namespace.get(...))` to detect whether a macro * is defined, as the definition may be the empty string which evaluates * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or * `if (namespace.has(...))`. */ ; _proto.get = function get(name) { if (this.current.hasOwnProperty(name)) { return this.current[name]; } else { return this.builtins[name]; } } /** * Set the current value of a name, and optionally set it globally too. * Local set() sets the current value and (when appropriate) adds an undo * operation to the undo stack. Global set() may change the undo * operation at every level, so takes time linear in their number. */ ; _proto.set = function set(name, value, global) { if (global === void 0) { global = false; } if (global) { // Global set is equivalent to setting in all groups. Simulate this // by destroying any undos currently scheduled for this name, // and adding an undo with the *new* value (in case it later gets // locally reset within this environment). for (var i = 0; i < this.undefStack.length; i++) { delete this.undefStack[i][name]; } if (this.undefStack.length > 0) { this.undefStack[this.undefStack.length - 1][name] = value; } } else { // Undo this set at end of this group (possibly to `undefined`), // unless an undo is already in place, in which case that older // value is the correct one. var top = this.undefStack[this.undefStack.length - 1]; if (top && !top.hasOwnProperty(name)) { top[name] = this.current[name]; } } this.current[name] = value; }; return Namespace; }(); // CONCATENATED MODULE: ./src/macros.js /** * Predefined macros for KaTeX. * This can be used to define some commands in terms of others. */ var builtinMacros = {}; /* harmony default export */ var macros = (builtinMacros); // This function might one day accept an additional argument and do more things. function defineMacro(name, body) { builtinMacros[name] = body; } ////////////////////////////////////////////////////////////////////// // macro tools defineMacro("\\noexpand", function (context) { // The expansion is the token itself; but that token is interpreted // as if its meaning were ‘\relax’ if it is a control sequence that // would ordinarily be expanded by TeX’s expansion rules. var t = context.popToken(); if (context.isExpandable(t.text)) { t.noexpand = true; t.treatAsRelax = true; } return { tokens: [t], numArgs: 0 }; }); defineMacro("\\expandafter", function (context) { // TeX first reads the token that comes immediately after \expandafter, // without expanding it; let’s call this token t. Then TeX reads the // token that comes after t (and possibly more tokens, if that token // has an argument), replacing it by its expansion. Finally TeX puts // t back in front of that expansion. var t = context.popToken(); context.expandOnce(true); // expand only an expandable token return { tokens: [t], numArgs: 0 }; }); // LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2 // TeX source: \long\def\@firstoftwo#1#2{#1} defineMacro("\\@firstoftwo", function (context) { var args = context.consumeArgs(2); return { tokens: args[0], numArgs: 0 }; }); // LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1 // TeX source: \long\def\@secondoftwo#1#2{#2} defineMacro("\\@secondoftwo", function (context) { var args = context.consumeArgs(2); return { tokens: args[1], numArgs: 0 }; }); // LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded) // symbol that isn't a space, consuming any spaces but not consuming the // first nonspace character. If that nonspace character matches #1, then // the macro expands to #2; otherwise, it expands to #3. defineMacro("\\@ifnextchar", function (context) { var args = context.consumeArgs(3); // symbol, if, else context.consumeSpaces(); var nextToken = context.future(); if (args[0].length === 1 && args[0][0].text === nextToken.text) { return { tokens: args[1], numArgs: 0 }; } else { return { tokens: args[2], numArgs: 0 }; } }); // LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol. // If it is `*`, then it consumes the symbol, and the macro expands to #1; // otherwise, the macro expands to #2 (without consuming the symbol). // TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}} defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode defineMacro("\\TextOrMath", function (context) { var args = context.consumeArgs(2); if (context.mode === 'text') { return { tokens: args[0], numArgs: 0 }; } else { return { tokens: args[1], numArgs: 0 }; } }); // Lookup table for parsing numbers in base 8 through 16 var digitToNumber = { "0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "a": 10, "A": 10, "b": 11, "B": 11, "c": 12, "C": 12, "d": 13, "D": 13, "e": 14, "E": 14, "f": 15, "F": 15 }; // TeX \char makes a literal character (catcode 12) using the following forms: // (see The TeXBook, p. 43) // \char123 -- decimal // \char'123 -- octal // \char"123 -- hex // \char`x -- character that can be written (i.e. isn't active) // \char`\x -- character that cannot be written (e.g. %) // These all refer to characters from the font, so we turn them into special // calls to a function \@char dealt with in the Parser. defineMacro("\\char", function (context) { var token = context.popToken(); var base; var number = ''; if (token.text === "'") { base = 8; token = context.popToken(); } else if (token.text === '"') { base = 16; token = context.popToken(); } else if (token.text === "`") { token = context.popToken(); if (token.text[0] === "\\") { number = token.text.charCodeAt(1); } else if (token.text === "EOF") { throw new src_ParseError("\\char` missing argument"); } else { number = token.text.charCodeAt(0); } } else { base = 10; } if (base) { // Parse a number in the given base, starting with first `token`. number = digitToNumber[token.text]; if (number == null || number >= base) { throw new src_ParseError("Invalid base-" + base + " digit " + token.text); } var digit; while ((digit = digitToNumber[context.future().text]) != null && digit < base) { number *= base; number += digit; context.popToken(); } } return "\\@char{" + number + "}"; }); // \newcommand{\macro}[args]{definition} // \renewcommand{\macro}[args]{definition} // TODO: Optional arguments: \newcommand{\macro}[args][default]{definition} var macros_newcommand = function newcommand(context, existsOK, nonexistsOK) { var arg = context.consumeArgs(1)[0]; if (arg.length !== 1) { throw new src_ParseError("\\newcommand's first argument must be a macro name"); } var name = arg[0].text; var exists = context.isDefined(name); if (exists && !existsOK) { throw new src_ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand")); } if (!exists && !nonexistsOK) { throw new src_ParseError("\\renewcommand{" + name + "} when command " + name + " " + "does not yet exist; use \\newcommand"); } var numArgs = 0; arg = context.consumeArgs(1)[0]; if (arg.length === 1 && arg[0].text === "[") { var argText = ''; var token = context.expandNextToken(); while (token.text !== "]" && token.text !== "EOF") { // TODO: Should properly expand arg, e.g., ignore {}s argText += token.text; token = context.expandNextToken(); } if (!argText.match(/^\s*[0-9]+\s*$/)) { throw new src_ParseError("Invalid number of arguments: " + argText); } numArgs = parseInt(argText); arg = context.consumeArgs(1)[0]; } // Final arg is the expansion of the macro context.macros.set(name, { tokens: arg, numArgs: numArgs }); return ''; }; defineMacro("\\newcommand", function (context) { return macros_newcommand(context, false, true); }); defineMacro("\\renewcommand", function (context) { return macros_newcommand(context, true, false); }); defineMacro("\\providecommand", function (context) { return macros_newcommand(context, true, true); }); // terminal (console) tools defineMacro("\\message", function (context) { var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console console.log(arg.reverse().map(function (token) { return token.text; }).join("")); return ''; }); defineMacro("\\errmessage", function (context) { var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console console.error(arg.reverse().map(function (token) { return token.text; }).join("")); return ''; }); defineMacro("\\show", function (context) { var tok = context.popToken(); var name = tok.text; // eslint-disable-next-line no-console console.log(tok, context.macros.get(name), src_functions[name], src_symbols.math[name], src_symbols.text[name]); return ''; }); ////////////////////////////////////////////////////////////////////// // Grouping // \let\bgroup={ \let\egroup=} defineMacro("\\bgroup", "{"); defineMacro("\\egroup", "}"); // Symbols from latex.ltx: // \def\lq{`} // \def\rq{'} // \def \aa {\r a} // \def \AA {\r A} defineMacro("\\lq", "`"); defineMacro("\\rq", "'"); defineMacro("\\aa", "\\r a"); defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML. // \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}} // \DeclareTextCommandDefault{\textregistered}{\textcircled{% // \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}} // \DeclareRobustCommand{\copyright}{% // \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi} defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}"); defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"); defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Characters omitted from Unicode range 1D400–1D7FF defineMacro("\u212C", "\\mathscr{B}"); // script defineMacro("\u2130", "\\mathscr{E}"); defineMacro("\u2131", "\\mathscr{F}"); defineMacro("\u210B", "\\mathscr{H}"); defineMacro("\u2110", "\\mathscr{I}"); defineMacro("\u2112", "\\mathscr{L}"); defineMacro("\u2133", "\\mathscr{M}"); defineMacro("\u211B", "\\mathscr{R}"); defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur defineMacro("\u210C", "\\mathfrak{H}"); defineMacro("\u2128", "\\mathfrak{Z}"); // Define \Bbbk with a macro that works in both HTML and MathML. defineMacro("\\Bbbk", "\\Bbb{k}"); // Unicode middle dot // The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays // the dot at U+22C5 and gives it punct spacing. defineMacro("\xB7", "\\cdotp"); // \llap and \rlap render their contents in text mode defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fontmath.ltx via // \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36} // It's thus treated like a \mathrel, but defined by a symbol that has zero // width but extends to the right. We use \rlap to get that spacing. // For MathML we write U+0338 here. buildMathML.js will then do the overlay. defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); // Negated symbols from base/fontmath.ltx: // \def\neq{\not=} \let\ne=\neq // \DeclareRobustCommand // \notin{\mathrel{\m@th\mathpalette\c@ncel\in}} // \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}} defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"); defineMacro("\\ne", "\\neq"); defineMacro("\u2260", "\\neq"); defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + "{\\mathrel{\\char`∉}}"); defineMacro("\u2209", "\\notin"); // Unicode stacked relations defineMacro("\u2258", "\\html@mathml{" + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + "}{\\mathrel{\\char`\u2258}}"); defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}"); defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}"); defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + "{\\mathrel{\\char`\u225B}}"); defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + "{\\mathrel{\\char`\u225D}}"); defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + "{\\mathrel{\\char`\u225E}}"); defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); // Misc Unicode defineMacro("\u27C2", "\\perp"); defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}"); defineMacro("\u220C", "\\notni"); defineMacro("\u231C", "\\ulcorner"); defineMacro("\u231D", "\\urcorner"); defineMacro("\u231E", "\\llcorner"); defineMacro("\u231F", "\\lrcorner"); defineMacro("\xA9", "\\copyright"); defineMacro("\xAE", "\\textregistered"); defineMacro("\uFE0F", "\\textregistered"); // The KaTeX fonts have corners at codepoints that don't match Unicode. // For MathML purposes, use the Unicode code point. defineMacro("\\ulcorner", "\\html@mathml{\\@ulcorner}{\\mathop{\\char\"231c}}"); defineMacro("\\urcorner", "\\html@mathml{\\@urcorner}{\\mathop{\\char\"231d}}"); defineMacro("\\llcorner", "\\html@mathml{\\@llcorner}{\\mathop{\\char\"231e}}"); defineMacro("\\lrcorner", "\\html@mathml{\\@lrcorner}{\\mathop{\\char\"231f}}"); ////////////////////////////////////////////////////////////////////// // LaTeX_2ε // \vdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@ // \kern6\p@\hbox{.}\hbox{.}\hbox{.}}} // We'll call \varvdots, which gets a glyph from symbols.js. // The zero-width rule gets us an equivalent to the vertical 6pt kern. defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}"); defineMacro("\u22EE", "\\vdots"); ////////////////////////////////////////////////////////////////////// // amsmath.sty // http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf // Italic Greek capital letters. AMS defines these with \DeclareMathSymbol, // but they are equivalent to \mathit{\Letter}. defineMacro("\\varGamma", "\\mathit{\\Gamma}"); defineMacro("\\varDelta", "\\mathit{\\Delta}"); defineMacro("\\varTheta", "\\mathit{\\Theta}"); defineMacro("\\varLambda", "\\mathit{\\Lambda}"); defineMacro("\\varXi", "\\mathit{\\Xi}"); defineMacro("\\varPi", "\\mathit{\\Pi}"); defineMacro("\\varSigma", "\\mathit{\\Sigma}"); defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); defineMacro("\\varPhi", "\\mathit{\\Phi}"); defineMacro("\\varPsi", "\\mathit{\\Psi}"); defineMacro("\\varOmega", "\\mathit{\\Omega}"); //\newcommand{\substack}[1]{\subarray{c}#1\endsubarray} defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); // \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript // \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu"); // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Longleftrightarrow\;} // \def\implies{\DOTSB\;\Longrightarrow\;} // \def\impliedby{\DOTSB\;\Longleftarrow\;} defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro. var dotsByToken = { ',': '\\dotsc', '\\not': '\\dotsb', // \keybin@ checks for the following: '+': '\\dotsb', '=': '\\dotsb', '<': '\\dotsb', '>': '\\dotsb', '-': '\\dotsb', '*': '\\dotsb', ':': '\\dotsb', // Symbols whose definition starts with \DOTSB: '\\DOTSB': '\\dotsb', '\\coprod': '\\dotsb', '\\bigvee': '\\dotsb', '\\bigwedge': '\\dotsb', '\\biguplus': '\\dotsb', '\\bigcap': '\\dotsb', '\\bigcup': '\\dotsb', '\\prod': '\\dotsb', '\\sum': '\\dotsb', '\\bigotimes': '\\dotsb', '\\bigoplus': '\\dotsb', '\\bigodot': '\\dotsb', '\\bigsqcup': '\\dotsb', '\\And': '\\dotsb', '\\longrightarrow': '\\dotsb', '\\Longrightarrow': '\\dotsb', '\\longleftarrow': '\\dotsb', '\\Longleftarrow': '\\dotsb', '\\longleftrightarrow': '\\dotsb', '\\Longleftrightarrow': '\\dotsb', '\\mapsto': '\\dotsb', '\\longmapsto': '\\dotsb', '\\hookrightarrow': '\\dotsb', '\\doteq': '\\dotsb', // Symbols whose definition starts with \mathbin: '\\mathbin': '\\dotsb', // Symbols whose definition starts with \mathrel: '\\mathrel': '\\dotsb', '\\relbar': '\\dotsb', '\\Relbar': '\\dotsb', '\\xrightarrow': '\\dotsb', '\\xleftarrow': '\\dotsb', // Symbols whose definition starts with \DOTSI: '\\DOTSI': '\\dotsi', '\\int': '\\dotsi', '\\oint': '\\dotsi', '\\iint': '\\dotsi', '\\iiint': '\\dotsi', '\\iiiint': '\\dotsi', '\\idotsint': '\\dotsi', // Symbols whose definition starts with \DOTSX: '\\DOTSX': '\\dotsx' }; defineMacro("\\dots", function (context) { // TODO: If used in text mode, should expand to \textellipsis. // However, in KaTeX, \textellipsis and \ldots behave the same // (in text mode), and it's unlikely we'd see any of the math commands // that affect the behavior of \dots when in text mode. So fine for now // (until we support \ifmmode ... \else ... \fi). var thedots = '\\dotso'; var next = context.expandAfterFuture().text; if (next in dotsByToken) { thedots = dotsByToken[next]; } else if (next.substr(0, 4) === '\\not') { thedots = '\\dotsb'; } else if (next in src_symbols.math) { if (utils.contains(['bin', 'rel'], src_symbols.math[next].group)) { thedots = '\\dotsb'; } } return thedots; }); var spaceAfterDots = { // \rightdelim@ checks for the following: ')': true, ']': true, '\\rbrack': true, '\\}': true, '\\rbrace': true, '\\rangle': true, '\\rceil': true, '\\rfloor': true, '\\rgroup': true, '\\rmoustache': true, '\\right': true, '\\bigr': true, '\\biggr': true, '\\Bigr': true, '\\Biggr': true, // \extra@ also tests for the following: '$': true, // \extrap@ checks for the following: ';': true, '.': true, ',': true }; defineMacro("\\dotso", function (context) { var next = context.future().text; if (next in spaceAfterDots) { return "\\ldots\\,"; } else { return "\\ldots"; } }); defineMacro("\\dotsc", function (context) { var next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for // ';' and '.', but doesn't check for ','. if (next in spaceAfterDots && next !== ',') { return "\\ldots\\,"; } else { return "\\ldots"; } }); defineMacro("\\cdots", function (context) { var next = context.future().text; if (next in spaceAfterDots) { return "\\@cdots\\,"; } else { return "\\@cdots"; } }); defineMacro("\\dotsb", "\\cdots"); defineMacro("\\dotsm", "\\cdots"); defineMacro("\\dotsi", "\\!\\cdots"); // amsmath doesn't actually define \dotsx, but \dots followed by a macro // starting with \DOTSX implies \dotso, and then \extra@ detects this case // and forces the added `\,`. defineMacro("\\dotsx", "\\ldots\\,"); // \let\DOTSI\relax // \let\DOTSB\relax // \let\DOTSX\relax defineMacro("\\DOTSI", "\\relax"); defineMacro("\\DOTSB", "\\relax"); defineMacro("\\DOTSX", "\\relax"); // Spacing, based on amsmath.sty's override of LaTeX defaults // \DeclareRobustCommand{\tmspace}[3]{% // \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); // \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} // TODO: math mode should use \thinmuskip defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); // \let\thinspace\, defineMacro("\\thinspace", "\\,"); // \def\>{\mskip\medmuskip} // \renewcommand{\:}{\tmspace+\medmuskip{.2222em}} // TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu defineMacro("\\>", "\\mskip{4mu}"); defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); // \let\medspace\: defineMacro("\\medspace", "\\:"); // \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} // TODO: math mode should use \thickmuskip = 5mu plus 5mu defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); // \let\thickspace\; defineMacro("\\thickspace", "\\;"); // \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} // TODO: math mode should use \thinmuskip defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); // \let\negthinspace\! defineMacro("\\negthinspace", "\\!"); // \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} // TODO: math mode should use \medmuskip defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); // \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} // TODO: math mode should use \thickmuskip defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); // \def\enspace{\kern.5em } defineMacro("\\enspace", "\\kern.5em "); // \def\enskip{\hskip.5em\relax} defineMacro("\\enskip", "\\hskip.5em\\relax"); // \def\quad{\hskip1em\relax} defineMacro("\\quad", "\\hskip1em\\relax"); // \def\qquad{\hskip2em\relax} defineMacro("\\qquad", "\\hskip2em\\relax"); // \tag@in@display form of \tag defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); defineMacro("\\tag@literal", function (context) { if (context.macros.get("\\df@tag")) { throw new src_ParseError("Multiple \\tag"); } return "\\gdef\\df@tag{\\text{#1}}"; }); // \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin // {\operator@font mod}\penalty900 // \mkern5mu\nonscript\mskip-\medmuskip} // \newcommand{\pod}[1]{\allowbreak // \if@display\mkern18mu\else\mkern8mu\fi(#1)} // \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}} // \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu // \else\mkern12mu\fi{\operator@font mod}\,\,#1} // TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"); defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"); defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); // \pmb -- A simulation of bold. // The version in ambsy.sty works by typesetting three copies of the argument // with small offsets. We use two copies. We omit the vertical offset because // of rendering problems that makeVList encounters in Safari. defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); ////////////////////////////////////////////////////////////////////// // LaTeX source2e // \\ defaults to \newline, but changes to \cr within array environment defineMacro("\\\\", "\\newline"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} // TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't // support \@ yet, so that's omitted, and we add \text so that the result // doesn't look funny in math mode. defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + "}{TeX}}"); // \DeclareRobustCommand{\LaTeX}{L\kern-.36em% // {\sbox\z@ T% // \vbox to\ht\z@{\hbox{\check@mathfonts // \fontsize\sf@size\z@ // \math@fontsfalse\selectfont // A}% // \vss}% // }% // \kern-.15em% // \TeX} // This code aligns the top of the A with the T (from the perspective of TeX's // boxes, though visually the A appears to extend above slightly). // We compute the corresponding \raisebox when A is rendered in \normalsize // \scriptstyle, which has a scale factor of 0.7 (see Options.js). var latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1] + "em"; defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} // \def\@hspace#1{\hskip #1\relax} // \def\@hspacer#1{\vrule \@width\z@\nobreak // \hskip #1\hskip \z@skip} defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); defineMacro("\\@hspace", "\\hskip #1\\relax"); defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); ////////////////////////////////////////////////////////////////////// // mathtools.sty //\providecommand\ordinarycolon{:} defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}} //TODO(edemaine): Not yet centered. Fix via \raisebox or #726 defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon} defineMacro("\\dblcolon", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + "{\\mathop{\\char\"2237}}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=} defineMacro("\\coloneqq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2254}}"); // ≔ // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=} defineMacro("\\Coloneqq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2237\\char\"3d}}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}} defineMacro("\\coloneq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"3a\\char\"2212}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}} defineMacro("\\Coloneq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"2237\\char\"2212}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon} defineMacro("\\eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2255}}"); // ≕ // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon} defineMacro("\\Eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"3d\\char\"2237}}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon} defineMacro("\\eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2239}}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon} defineMacro("\\Eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"2212\\char\"2237}}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx} defineMacro("\\colonapprox", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"3a\\char\"2248}}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx} defineMacro("\\Colonapprox", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"2237\\char\"2248}}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim} defineMacro("\\colonsim", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"3a\\char\"223c}}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim} defineMacro("\\Colonsim", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"2237\\char\"223c}}"); // Some Unicode characters are implemented with macros to mathtools functions. defineMacro("\u2237", "\\dblcolon"); // :: defineMacro("\u2239", "\\eqcolon"); // -: defineMacro("\u2254", "\\coloneqq"); // := defineMacro("\u2255", "\\eqqcolon"); // =: defineMacro("\u2A74", "\\Coloneqq"); // ::= ////////////////////////////////////////////////////////////////////// // colonequals.sty // Alternate names for mathtools's macros: defineMacro("\\ratio", "\\vcentcolon"); defineMacro("\\coloncolon", "\\dblcolon"); defineMacro("\\colonequals", "\\coloneqq"); defineMacro("\\coloncolonequals", "\\Coloneqq"); defineMacro("\\equalscolon", "\\eqqcolon"); defineMacro("\\equalscoloncolon", "\\Eqqcolon"); defineMacro("\\colonminus", "\\coloneq"); defineMacro("\\coloncolonminus", "\\Coloneq"); defineMacro("\\minuscolon", "\\eqcolon"); defineMacro("\\minuscoloncolon", "\\Eqcolon"); // \colonapprox name is same in mathtools and colonequals. defineMacro("\\coloncolonapprox", "\\Colonapprox"); // \colonsim name is same in mathtools and colonequals. defineMacro("\\coloncolonsim", "\\Colonsim"); // Additional macros, implemented by analogy with mathtools definitions: defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"); defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // Present in newtxmath, pxfonts and txfonts defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); ////////////////////////////////////////////////////////////////////// // MathML alternates for KaTeX glyphs in the Unicode private area defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}"); defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}"); defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}"); defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}"); defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}"); defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}"); defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}"); defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}"); defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}"); defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}"); defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}"); defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}"); defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}"); defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}"); defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}"); defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}"); ////////////////////////////////////////////////////////////////////// // stmaryrd and semantic // The stmaryrd and semantic packages render the next four items by calling a // glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros. defineMacro("\\llbracket", "\\html@mathml{" + "\\mathopen{[\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u27E6}}"); defineMacro("\\rrbracket", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu]}}" + "{\\mathclose{\\char`\u27E7}}"); defineMacro("\u27E6", "\\llbracket"); // blackboard bold [ defineMacro("\u27E7", "\\rrbracket"); // blackboard bold ] defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}"); defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}"); defineMacro("\u2983", "\\lBrace"); // blackboard bold { defineMacro("\u2984", "\\rBrace"); // blackboard bold } // TODO: Create variable sized versions of the last two items. I believe that // will require new font glyphs. // The stmaryrd function `\minuso` provides a "Plimsoll" symbol that // superimposes the characters \circ and \mathminus. Used in chemistry. defineMacro("\\minuso", "\\mathbin{\\html@mathml{" + "{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}" + "{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}" + "{\\char`⦵}}"); defineMacro("⦵", "\\minuso"); ////////////////////////////////////////////////////////////////////// // texvc.sty // The texvc package contains macros available in mediawiki pages. // We omit the functions deprecated at // https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax // We also omit texvc's \O, which conflicts with \text{\O} defineMacro("\\darr", "\\downarrow"); defineMacro("\\dArr", "\\Downarrow"); defineMacro("\\Darr", "\\Downarrow"); defineMacro("\\lang", "\\langle"); defineMacro("\\rang", "\\rangle"); defineMacro("\\uarr", "\\uparrow"); defineMacro("\\uArr", "\\Uparrow"); defineMacro("\\Uarr", "\\Uparrow"); defineMacro("\\N", "\\mathbb{N}"); defineMacro("\\R", "\\mathbb{R}"); defineMacro("\\Z", "\\mathbb{Z}"); defineMacro("\\alef", "\\aleph"); defineMacro("\\alefsym", "\\aleph"); defineMacro("\\Alpha", "\\mathrm{A}"); defineMacro("\\Beta", "\\mathrm{B}"); defineMacro("\\bull", "\\bullet"); defineMacro("\\Chi", "\\mathrm{X}"); defineMacro("\\clubs", "\\clubsuit"); defineMacro("\\cnums", "\\mathbb{C}"); defineMacro("\\Complex", "\\mathbb{C}"); defineMacro("\\Dagger", "\\ddagger"); defineMacro("\\diamonds", "\\diamondsuit"); defineMacro("\\empty", "\\emptyset"); defineMacro("\\Epsilon", "\\mathrm{E}"); defineMacro("\\Eta", "\\mathrm{H}"); defineMacro("\\exist", "\\exists"); defineMacro("\\harr", "\\leftrightarrow"); defineMacro("\\hArr", "\\Leftrightarrow"); defineMacro("\\Harr", "\\Leftrightarrow"); defineMacro("\\hearts", "\\heartsuit"); defineMacro("\\image", "\\Im"); defineMacro("\\infin", "\\infty"); defineMacro("\\Iota", "\\mathrm{I}"); defineMacro("\\isin", "\\in"); defineMacro("\\Kappa", "\\mathrm{K}"); defineMacro("\\larr", "\\leftarrow"); defineMacro("\\lArr", "\\Leftarrow"); defineMacro("\\Larr", "\\Leftarrow"); defineMacro("\\lrarr", "\\leftrightarrow"); defineMacro("\\lrArr", "\\Leftrightarrow"); defineMacro("\\Lrarr", "\\Leftrightarrow"); defineMacro("\\Mu", "\\mathrm{M}"); defineMacro("\\natnums", "\\mathbb{N}"); defineMacro("\\Nu", "\\mathrm{N}"); defineMacro("\\Omicron", "\\mathrm{O}"); defineMacro("\\plusmn", "\\pm"); defineMacro("\\rarr", "\\rightarrow"); defineMacro("\\rArr", "\\Rightarrow"); defineMacro("\\Rarr", "\\Rightarrow"); defineMacro("\\real", "\\Re"); defineMacro("\\reals", "\\mathbb{R}"); defineMacro("\\Reals", "\\mathbb{R}"); defineMacro("\\Rho", "\\mathrm{P}"); defineMacro("\\sdot", "\\cdot"); defineMacro("\\sect", "\\S"); defineMacro("\\spades", "\\spadesuit"); defineMacro("\\sub", "\\subset"); defineMacro("\\sube", "\\subseteq"); defineMacro("\\supe", "\\supseteq"); defineMacro("\\Tau", "\\mathrm{T}"); defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}"); defineMacro("\\weierp", "\\wp"); defineMacro("\\Zeta", "\\mathrm{Z}"); ////////////////////////////////////////////////////////////////////// // statmath.sty // https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}"); defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}"); defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); ////////////////////////////////////////////////////////////////////// // braket.sty // http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); defineMacro("\\Bra", "\\left\\langle#1\\right|"); defineMacro("\\Ket", "\\left|#1\\right\\rangle"); // Custom Khan Academy colors, should be moved to an optional package defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); defineMacro("\\pink", "\\textcolor{##ff00af}{#1}"); defineMacro("\\red", "\\textcolor{##df0030}{#1}"); defineMacro("\\green", "\\textcolor{##28ae7b}{#1}"); defineMacro("\\gray", "\\textcolor{gray}{#1}"); defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}"); defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}"); defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}"); defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}"); defineMacro("\\blueD", "\\textcolor{##11accd}{#1}"); defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}"); defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}"); defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}"); defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}"); defineMacro("\\tealD", "\\textcolor{##01a995}{#1}"); defineMacro("\\tealE", "\\textcolor{##208170}{#1}"); defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}"); defineMacro("\\greenB", "\\textcolor{##8af281}{#1}"); defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}"); defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}"); defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}"); defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}"); defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}"); defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}"); defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}"); defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}"); defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}"); defineMacro("\\redB", "\\textcolor{##ff8482}{#1}"); defineMacro("\\redC", "\\textcolor{##f9685d}{#1}"); defineMacro("\\redD", "\\textcolor{##e84d39}{#1}"); defineMacro("\\redE", "\\textcolor{##bc2612}{#1}"); defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}"); defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}"); defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}"); defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}"); defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}"); defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}"); defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}"); defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}"); defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}"); defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}"); defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}"); defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}"); defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}"); defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}"); defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}"); defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}"); defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}"); defineMacro("\\grayE", "\\textcolor{##babec2}{#1}"); defineMacro("\\grayF", "\\textcolor{##888d93}{#1}"); defineMacro("\\grayG", "\\textcolor{##626569}{#1}"); defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}"); defineMacro("\\grayI", "\\textcolor{##21242c}{#1}"); defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}"); defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); // CONCATENATED MODULE: ./src/MacroExpander.js /** * This file contains the “gullet” where macros are expanded * until only non-macro tokens remain. */ // List of commands that act like macros but aren't defined as a macro, // function, or symbol. Used in `isDefined`. var implicitCommands = { "\\relax": true, // MacroExpander.js "^": true, // Parser.js "_": true, // Parser.js "\\limits": true, // Parser.js "\\nolimits": true // Parser.js }; var MacroExpander_MacroExpander = /*#__PURE__*/ function () { function MacroExpander(input, settings, mode) { this.settings = void 0; this.expansionCount = void 0; this.lexer = void 0; this.macros = void 0; this.stack = void 0; this.mode = void 0; this.settings = settings; this.expansionCount = 0; this.feed(input); // Make new global namespace this.macros = new Namespace_Namespace(macros, settings.macros); this.mode = mode; this.stack = []; // contains tokens in REVERSE order } /** * Feed a new input string to the same MacroExpander * (with existing macros etc.). */ var _proto = MacroExpander.prototype; _proto.feed = function feed(input) { this.lexer = new Lexer_Lexer(input, this.settings); } /** * Switches between "text" and "math" modes. */ ; _proto.switchMode = function switchMode(newMode) { this.mode = newMode; } /** * Start a new group nesting within all namespaces. */ ; _proto.beginGroup = function beginGroup() { this.macros.beginGroup(); } /** * End current group nesting within all namespaces. */ ; _proto.endGroup = function endGroup() { this.macros.endGroup(); } /** * Returns the topmost token on the stack, without expanding it. * Similar in behavior to TeX's `\futurelet`. */ ; _proto.future = function future() { if (this.stack.length === 0) { this.pushToken(this.lexer.lex()); } return this.stack[this.stack.length - 1]; } /** * Remove and return the next unexpanded token. */ ; _proto.popToken = function popToken() { this.future(); // ensure non-empty stack return this.stack.pop(); } /** * Add a given token to the token stack. In particular, this get be used * to put back a token returned from one of the other methods. */ ; _proto.pushToken = function pushToken(token) { this.stack.push(token); } /** * Append an array of tokens to the token stack. */ ; _proto.pushTokens = function pushTokens(tokens) { var _this$stack; (_this$stack = this.stack).push.apply(_this$stack, tokens); } /** * Consume all following space tokens, without expansion. */ ; _proto.consumeSpaces = function consumeSpaces() { for (;;) { var token = this.future(); if (token.text === " ") { this.stack.pop(); } else { break; } } } /** * Consume the specified number of arguments from the token stream, * and return the resulting array of arguments. */ ; _proto.consumeArgs = function consumeArgs(numArgs) { var args = []; // obtain arguments, either single token or balanced {…} group for (var i = 0; i < numArgs; ++i) { this.consumeSpaces(); // ignore spaces before each argument var startOfArg = this.popToken(); if (startOfArg.text === "{") { var arg = []; var depth = 1; while (depth !== 0) { var tok = this.popToken(); arg.push(tok); if (tok.text === "{") { ++depth; } else if (tok.text === "}") { --depth; } else if (tok.text === "EOF") { throw new src_ParseError("End of input in macro argument", startOfArg); } } arg.pop(); // remove last } arg.reverse(); // like above, to fit in with stack order args[i] = arg; } else if (startOfArg.text === "EOF") { throw new src_ParseError("End of input expecting macro argument"); } else { args[i] = [startOfArg]; } } return args; } /** * Expand the next token only once if possible. * * If the token is expanded, the resulting tokens will be pushed onto * the stack in reverse order and will be returned as an array, * also in reverse order. * * If not, the next token will be returned without removing it * from the stack. This case can be detected by a `Token` return value * instead of an `Array` return value. * * In either case, the next token will be on the top of the stack, * or the stack will be empty. * * Used to implement `expandAfterFuture` and `expandNextToken`. * * At the moment, macro expansion doesn't handle delimited macros, * i.e. things like those defined by \def\foo#1\end{…}. * See the TeX book page 202ff. for details on how those should behave. * * If expandableOnly, only expandable tokens are expanded and * an undefined control sequence results in an error. */ ; _proto.expandOnce = function expandOnce(expandableOnly) { var topToken = this.popToken(); var name = topToken.text; var expansion = !topToken.noexpand ? this._getExpansion(name) : null; if (expansion == null || expandableOnly && expansion.unexpandable) { if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) { throw new src_ParseError("Undefined control sequence: " + name); } this.pushToken(topToken); return topToken; } this.expansionCount++; if (this.expansionCount > this.settings.maxExpand) { throw new src_ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting"); } var tokens = expansion.tokens; if (expansion.numArgs) { var args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders tokens = tokens.slice(); // make a shallow copy for (var i = tokens.length - 1; i >= 0; --i) { var tok = tokens[i]; if (tok.text === "#") { if (i === 0) { throw new src_ParseError("Incomplete placeholder at end of macro body", tok); } tok = tokens[--i]; // next token on stack if (tok.text === "#") { // ## → # tokens.splice(i + 1, 1); // drop first # } else if (/^[1-9]$/.test(tok.text)) { var _tokens; // replace the placeholder with the indicated argument (_tokens = tokens).splice.apply(_tokens, [i, 2].concat(args[+tok.text - 1])); } else { throw new src_ParseError("Not a valid argument number", tok); } } } } // Concatenate expansion onto top of stack. this.pushTokens(tokens); return tokens; } /** * Expand the next token only once (if possible), and return the resulting * top token on the stack (without removing anything from the stack). * Similar in behavior to TeX's `\expandafter\futurelet`. * Equivalent to expandOnce() followed by future(). */ ; _proto.expandAfterFuture = function expandAfterFuture() { this.expandOnce(); return this.future(); } /** * Recursively expand first token, then return first non-expandable token. */ ; _proto.expandNextToken = function expandNextToken() { for (;;) { var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. if (expanded instanceof Token_Token) { // \relax stops the expansion, but shouldn't get returned (a // null return value couldn't get implemented as a function). // the token after \noexpand is interpreted as if its meaning // were ‘\relax’ if (expanded.text === "\\relax" || expanded.treatAsRelax) { this.stack.pop(); } else { return this.stack.pop(); // === expanded } } } // Flow unable to figure out that this pathway is impossible. // https://github.com/facebook/flow/issues/4808 throw new Error(); // eslint-disable-line no-unreachable } /** * Fully expand the given macro name and return the resulting list of * tokens, or return `undefined` if no such macro is defined. */ ; _proto.expandMacro = function expandMacro(name) { return this.macros.has(name) ? this.expandTokens([new Token_Token(name)]) : undefined; } /** * Fully expand the given token stream and return the resulting list of tokens */ ; _proto.expandTokens = function expandTokens(tokens) { var output = []; var oldStackLength = this.stack.length; this.pushTokens(tokens); while (this.stack.length > oldStackLength) { var expanded = this.expandOnce(true); // expand only expandable tokens // expandOnce returns Token if and only if it's fully expanded. if (expanded instanceof Token_Token) { if (expanded.treatAsRelax) { // the expansion of \noexpand is the token itself expanded.noexpand = false; expanded.treatAsRelax = false; } output.push(this.stack.pop()); } } return output; } /** * Fully expand the given macro name and return the result as a string, * or return `undefined` if no such macro is defined. */ ; _proto.expandMacroAsText = function expandMacroAsText(name) { var tokens = this.expandMacro(name); if (tokens) { return tokens.map(function (token) { return token.text; }).join(""); } else { return tokens; } } /** * Returns the expanded macro as a reversed array of tokens and a macro * argument count. Or returns `null` if no such macro. */ ; _proto._getExpansion = function _getExpansion(name) { var definition = this.macros.get(name); if (definition == null) { // mainly checking for undefined here return definition; } var expansion = typeof definition === "function" ? definition(this) : definition; if (typeof expansion === "string") { var numArgs = 0; if (expansion.indexOf("#") !== -1) { var stripped = expansion.replace(/##/g, ""); while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { ++numArgs; } } var bodyLexer = new Lexer_Lexer(expansion, this.settings); var tokens = []; var tok = bodyLexer.lex(); while (tok.text !== "EOF") { tokens.push(tok); tok = bodyLexer.lex(); } tokens.reverse(); // to fit in with stack using push and pop var expanded = { tokens: tokens, numArgs: numArgs }; return expanded; } return expansion; } /** * Determine whether a command is currently "defined" (has some * functionality), meaning that it's a macro (in the current group), * a function, a symbol, or one of the special commands listed in * `implicitCommands`. */ ; _proto.isDefined = function isDefined(name) { return this.macros.has(name) || src_functions.hasOwnProperty(name) || src_symbols.math.hasOwnProperty(name) || src_symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name); } /** * Determine whether a command is expandable. */ ; _proto.isExpandable = function isExpandable(name) { var macro = this.macros.get(name); return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable // TODO(ylem): #2085 : src_functions.hasOwnProperty(name) /* && !functions[name].primitive*/ ; }; return MacroExpander; }(); // CONCATENATED MODULE: ./src/Parser.js /* eslint no-constant-condition:0 */ // Pre-evaluate both modules as unicodeSymbols require String.normalize() var unicodeAccents = { "́": { "text": "\\'", "math": "\\acute" }, "̀": { "text": "\\`", "math": "\\grave" }, "̈": { "text": "\\\"", "math": "\\ddot" }, "̃": { "text": "\\~", "math": "\\tilde" }, "̄": { "text": "\\=", "math": "\\bar" }, "̆": { "text": "\\u", "math": "\\breve" }, "̌": { "text": "\\v", "math": "\\check" }, "̂": { "text": "\\^", "math": "\\hat" }, "̇": { "text": "\\.", "math": "\\dot" }, "̊": { "text": "\\r", "math": "\\mathring" }, "̋": { "text": "\\H" } }; var unicodeSymbols = { "á": "á", "à": "à", "ä": "ä", "ǟ": "ǟ", "ã": "ã", "ā": "ā", "ă": "ă", "ắ": "ắ", "ằ": "ằ", "ẵ": "ẵ", "ǎ": "ǎ", "â": "â", "ấ": "ấ", "ầ": "ầ", "ẫ": "ẫ", "ȧ": "ȧ", "ǡ": "ǡ", "å": "å", "ǻ": "ǻ", "ḃ": "ḃ", "ć": "ć", "č": "č", "ĉ": "ĉ", "ċ": "ċ", "ď": "ď", "ḋ": "ḋ", "é": "é", "è": "è", "ë": "ë", "ẽ": "ẽ", "ē": "ē", "ḗ": "ḗ", "ḕ": "ḕ", "ĕ": "ĕ", "ě": "ě", "ê": "ê", "ế": "ế", "ề": "ề", "ễ": "ễ", "ė": "ė", "ḟ": "ḟ", "ǵ": "ǵ", "ḡ": "ḡ", "ğ": "ğ", "ǧ": "ǧ", "ĝ": "ĝ", "ġ": "ġ", "ḧ": "ḧ", "ȟ": "ȟ", "ĥ": "ĥ", "ḣ": "ḣ", "í": "í", "ì": "ì", "ï": "ï", "ḯ": "ḯ", "ĩ": "ĩ", "ī": "ī", "ĭ": "ĭ", "ǐ": "ǐ", "î": "î", "ǰ": "ǰ", "ĵ": "ĵ", "ḱ": "ḱ", "ǩ": "ǩ", "ĺ": "ĺ", "ľ": "ľ", "ḿ": "ḿ", "ṁ": "ṁ", "ń": "ń", "ǹ": "ǹ", "ñ": "ñ", "ň": "ň", "ṅ": "ṅ", "ó": "ó", "ò": "ò", "ö": "ö", "ȫ": "ȫ", "õ": "õ", "ṍ": "ṍ", "ṏ": "ṏ", "ȭ": "ȭ", "ō": "ō", "ṓ": "ṓ", "ṑ": "ṑ", "ŏ": "ŏ", "ǒ": "ǒ", "ô": "ô", "ố": "ố", "ồ": "ồ", "ỗ": "ỗ", "ȯ": "ȯ", "ȱ": "ȱ", "ő": "ő", "ṕ": "ṕ", "ṗ": "ṗ", "ŕ": "ŕ", "ř": "ř", "ṙ": "ṙ", "ś": "ś", "ṥ": "ṥ", "š": "š", "ṧ": "ṧ", "ŝ": "ŝ", "ṡ": "ṡ", "ẗ": "ẗ", "ť": "ť", "ṫ": "ṫ", "ú": "ú", "ù": "ù", "ü": "ü", "ǘ": "ǘ", "ǜ": "ǜ", "ǖ": "ǖ", "ǚ": "ǚ", "ũ": "ũ", "ṹ": "ṹ", "ū": "ū", "ṻ": "ṻ", "ŭ": "ŭ", "ǔ": "ǔ", "û": "û", "ů": "ů", "ű": "ű", "ṽ": "ṽ", "ẃ": "ẃ", "ẁ": "ẁ", "ẅ": "ẅ", "ŵ": "ŵ", "ẇ": "ẇ", "ẘ": "ẘ", "ẍ": "ẍ", "ẋ": "ẋ", "ý": "ý", "ỳ": "ỳ", "ÿ": "ÿ", "ỹ": "ỹ", "ȳ": "ȳ", "ŷ": "ŷ", "ẏ": "ẏ", "ẙ": "ẙ", "ź": "ź", "ž": "ž", "ẑ": "ẑ", "ż": "ż", "Á": "Á", "À": "À", "Ä": "Ä", "Ǟ": "Ǟ", "Ã": "Ã", "Ā": "Ā", "Ă": "Ă", "Ắ": "Ắ", "Ằ": "Ằ", "Ẵ": "Ẵ", "Ǎ": "Ǎ", "Â": "Â", "Ấ": "Ấ", "Ầ": "Ầ", "Ẫ": "Ẫ", "Ȧ": "Ȧ", "Ǡ": "Ǡ", "Å": "Å", "Ǻ": "Ǻ", "Ḃ": "Ḃ", "Ć": "Ć", "Č": "Č", "Ĉ": "Ĉ", "Ċ": "Ċ", "Ď": "Ď", "Ḋ": "Ḋ", "É": "É", "È": "È", "Ë": "Ë", "Ẽ": "Ẽ", "Ē": "Ē", "Ḗ": "Ḗ", "Ḕ": "Ḕ", "Ĕ": "Ĕ", "Ě": "Ě", "Ê": "Ê", "Ế": "Ế", "Ề": "Ề", "Ễ": "Ễ", "Ė": "Ė", "Ḟ": "Ḟ", "Ǵ": "Ǵ", "Ḡ": "Ḡ", "Ğ": "Ğ", "Ǧ": "Ǧ", "Ĝ": "Ĝ", "Ġ": "Ġ", "Ḧ": "Ḧ", "Ȟ": "Ȟ", "Ĥ": "Ĥ", "Ḣ": "Ḣ", "Í": "Í", "Ì": "Ì", "Ï": "Ï", "Ḯ": "Ḯ", "Ĩ": "Ĩ", "Ī": "Ī", "Ĭ": "Ĭ", "Ǐ": "Ǐ", "Î": "Î", "İ": "İ", "Ĵ": "Ĵ", "Ḱ": "Ḱ", "Ǩ": "Ǩ", "Ĺ": "Ĺ", "Ľ": "Ľ", "Ḿ": "Ḿ", "Ṁ": "Ṁ", "Ń": "Ń", "Ǹ": "Ǹ", "Ñ": "Ñ", "Ň": "Ň", "Ṅ": "Ṅ", "Ó": "Ó", "Ò": "Ò", "Ö": "Ö", "Ȫ": "Ȫ", "Õ": "Õ", "Ṍ": "Ṍ", "Ṏ": "Ṏ", "Ȭ": "Ȭ", "Ō": "Ō", "Ṓ": "Ṓ", "Ṑ": "Ṑ", "Ŏ": "Ŏ", "Ǒ": "Ǒ", "Ô": "Ô", "Ố": "Ố", "Ồ": "Ồ", "Ỗ": "Ỗ", "Ȯ": "Ȯ", "Ȱ": "Ȱ", "Ő": "Ő", "Ṕ": "Ṕ", "Ṗ": "Ṗ", "Ŕ": "Ŕ", "Ř": "Ř", "Ṙ": "Ṙ", "Ś": "Ś", "Ṥ": "Ṥ", "Š": "Š", "Ṧ": "Ṧ", "Ŝ": "Ŝ", "Ṡ": "Ṡ", "Ť": "Ť", "Ṫ": "Ṫ", "Ú": "Ú", "Ù": "Ù", "Ü": "Ü", "Ǘ": "Ǘ", "Ǜ": "Ǜ", "Ǖ": "Ǖ", "Ǚ": "Ǚ", "Ũ": "Ũ", "Ṹ": "Ṹ", "Ū": "Ū", "Ṻ": "Ṻ", "Ŭ": "Ŭ", "Ǔ": "Ǔ", "Û": "Û", "Ů": "Ů", "Ű": "Ű", "Ṽ": "Ṽ", "Ẃ": "Ẃ", "Ẁ": "Ẁ", "Ẅ": "Ẅ", "Ŵ": "Ŵ", "Ẇ": "Ẇ", "Ẍ": "Ẍ", "Ẋ": "Ẋ", "Ý": "Ý", "Ỳ": "Ỳ", "Ÿ": "Ÿ", "Ỹ": "Ỹ", "Ȳ": "Ȳ", "Ŷ": "Ŷ", "Ẏ": "Ẏ", "Ź": "Ź", "Ž": "Ž", "Ẑ": "Ẑ", "Ż": "Ż", "ά": "ά", "ὰ": "ὰ", "ᾱ": "ᾱ", "ᾰ": "ᾰ", "έ": "έ", "ὲ": "ὲ", "ή": "ή", "ὴ": "ὴ", "ί": "ί", "ὶ": "ὶ", "ϊ": "ϊ", "ΐ": "ΐ", "ῒ": "ῒ", "ῑ": "ῑ", "ῐ": "ῐ", "ό": "ό", "ὸ": "ὸ", "ύ": "ύ", "ὺ": "ὺ", "ϋ": "ϋ", "ΰ": "ΰ", "ῢ": "ῢ", "ῡ": "ῡ", "ῠ": "ῠ", "ώ": "ώ", "ὼ": "ὼ", "Ύ": "Ύ", "Ὺ": "Ὺ", "Ϋ": "Ϋ", "Ῡ": "Ῡ", "Ῠ": "Ῠ", "Ώ": "Ώ", "Ὼ": "Ὼ" }; /** * This file contains the parser used to parse out a TeX expression from the * input. Since TeX isn't context-free, standard parsers don't work particularly * well. * * The strategy of this parser is as such: * * The main functions (the `.parse...` ones) take a position in the current * parse string to parse tokens from. The lexer (found in Lexer.js, stored at * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When * individual tokens are needed at a position, the lexer is called to pull out a * token, which is then used. * * The parser has a property called "mode" indicating the mode that * the parser is currently in. Currently it has to be one of "math" or * "text", which denotes whether the current environment is a math-y * one or a text-y one (e.g. inside \text). Currently, this serves to * limit the functions which can be used in text mode. * * The main functions then return an object which contains the useful data that * was parsed at its given point, and a new position at the end of the parsed * data. The main functions can call each other and continue the parsing by * using the returned position as a new starting point. * * There are also extra `.handle...` functions, which pull out some reused * functionality into self-contained functions. * * The functions return ParseNodes. */ var Parser_Parser = /*#__PURE__*/ function () { function Parser(input, settings) { this.mode = void 0; this.gullet = void 0; this.settings = void 0; this.leftrightDepth = void 0; this.nextToken = void 0; // Start in math mode this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a // new lexer (mouth) for this parser (stomach, in the language of TeX) this.gullet = new MacroExpander_MacroExpander(input, settings, this.mode); // Store the settings for use in parsing this.settings = settings; // Count leftright depth (for \middle errors) this.leftrightDepth = 0; } /** * Checks a result to make sure it has the right type, and throws an * appropriate error otherwise. */ var _proto = Parser.prototype; _proto.expect = function expect(text, consume) { if (consume === void 0) { consume = true; } if (this.fetch().text !== text) { throw new src_ParseError("Expected '" + text + "', got '" + this.fetch().text + "'", this.fetch()); } if (consume) { this.consume(); } } /** * Discards the current lookahead token, considering it consumed. */ ; _proto.consume = function consume() { this.nextToken = null; } /** * Return the current lookahead token, or if there isn't one (at the * beginning, or if the previous lookahead token was consume()d), * fetch the next token as the new lookahead token and return it. */ ; _proto.fetch = function fetch() { if (this.nextToken == null) { this.nextToken = this.gullet.expandNextToken(); } return this.nextToken; } /** * Switches between "text" and "math" modes. */ ; _proto.switchMode = function switchMode(newMode) { this.mode = newMode; this.gullet.switchMode(newMode); } /** * Main parsing function, which parses an entire input. */ ; _proto.parse = function parse() { if (!this.settings.globalGroup) { // Create a group namespace for the math expression. // (LaTeX creates a new group for every $...$, $$...$$, \[...\].) this.gullet.beginGroup(); } // Use old \color behavior (same as LaTeX's \textcolor) if requested. // We do this within the group for the math expression, so it doesn't // pollute settings.macros. if (this.settings.colorIsTextColor) { this.gullet.macros.set("\\color", "\\textcolor"); } // Try to parse the input var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end this.expect("EOF"); // End the group namespace for the expression if (!this.settings.globalGroup) { this.gullet.endGroup(); } return parse; }; _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) { var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either // we reached the end, a }, or a \right) while (true) { // Ignore spaces in math mode if (this.mode === "math") { this.consumeSpaces(); } var lex = this.fetch(); if (Parser.endOfExpression.indexOf(lex.text) !== -1) { break; } if (breakOnTokenText && lex.text === breakOnTokenText) { break; } if (breakOnInfix && src_functions[lex.text] && src_functions[lex.text].infix) { break; } var atom = this.parseAtom(breakOnTokenText); if (!atom) { break; } else if (atom.type === "internal") { continue; } body.push(atom); } if (this.mode === "text") { this.formLigatures(body); } return this.handleInfixNodes(body); } /** * Rewrites infix operators such as \over with corresponding commands such * as \frac. * * There can only be one infix operator per group. If there's more than one * then the expression is ambiguous. This can be resolved by adding {}. */ ; _proto.handleInfixNodes = function handleInfixNodes(body) { var overIndex = -1; var funcName; for (var i = 0; i < body.length; i++) { if (body[i].type === "infix") { if (overIndex !== -1) { throw new src_ParseError("only one infix operator per group", body[i].token); } overIndex = i; funcName = body[i].replaceWith; } } if (overIndex !== -1 && funcName) { var numerNode; var denomNode; var numerBody = body.slice(0, overIndex); var denomBody = body.slice(overIndex + 1); if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { numerNode = numerBody[0]; } else { numerNode = { type: "ordgroup", mode: this.mode, body: numerBody }; } if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { denomNode = denomBody[0]; } else { denomNode = { type: "ordgroup", mode: this.mode, body: denomBody }; } var node; if (funcName === "\\\\abovefrac") { node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []); } else { node = this.callFunction(funcName, [numerNode, denomNode], []); } return [node]; } else { return body; } } // The greediness of a superscript or subscript ; /** * Handle a subscript or superscript with nice errors. */ _proto.handleSupSubscript = function handleSupSubscript(name) { var symbolToken = this.fetch(); var symbol = symbolToken.text; this.consume(); var group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS, undefined, undefined, true); // ignore spaces before sup/subscript argument if (!group) { throw new src_ParseError("Expected group after '" + symbol + "'", symbolToken); } return group; } /** * Converts the textual input of an unsupported command into a text node * contained within a color node whose color is determined by errorColor */ ; _proto.formatUnsupportedCmd = function formatUnsupportedCmd(text) { var textordArray = []; for (var i = 0; i < text.length; i++) { textordArray.push({ type: "textord", mode: "text", text: text[i] }); } var textNode = { type: "text", mode: this.mode, body: textordArray }; var colorNode = { type: "color", mode: this.mode, color: this.settings.errorColor, body: [textNode] }; return colorNode; } /** * Parses a group with optional super/subscripts. */ ; _proto.parseAtom = function parseAtom(breakOnTokenText) { // The body of an atom is an implicit group, so that things like // \left(x\right)^2 work correctly. var base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts if (this.mode === "text") { return base; } // Note that base may be empty (i.e. null) at this point. var superscript; var subscript; while (true) { // Guaranteed in math mode, so eat any spaces first. this.consumeSpaces(); // Lex the first token var lex = this.fetch(); if (lex.text === "\\limits" || lex.text === "\\nolimits") { // We got a limit control if (base && base.type === "op") { var limits = lex.text === "\\limits"; base.limits = limits; base.alwaysHandleSupSub = true; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub) { var _limits = lex.text === "\\limits"; base.limits = _limits; } else { throw new src_ParseError("Limit controls must follow a math operator", lex); } this.consume(); } else if (lex.text === "^") { // We got a superscript start if (superscript) { throw new src_ParseError("Double superscript", lex); } superscript = this.handleSupSubscript("superscript"); } else if (lex.text === "_") { // We got a subscript start if (subscript) { throw new src_ParseError("Double subscript", lex); } subscript = this.handleSupSubscript("subscript"); } else if (lex.text === "'") { // We got a prime if (superscript) { throw new src_ParseError("Double superscript", lex); } var prime = { type: "textord", mode: this.mode, text: "\\prime" }; // Many primes can be grouped together, so we handle this here var primes = [prime]; this.consume(); // Keep lexing tokens until we get something that's not a prime while (this.fetch().text === "'") { // For each one, add another prime to the list primes.push(prime); this.consume(); } // If there's a superscript following the primes, combine that // superscript in with the primes. if (this.fetch().text === "^") { primes.push(this.handleSupSubscript("superscript")); } // Put everything into an ordgroup as the superscript superscript = { type: "ordgroup", mode: this.mode, body: primes }; } else { // If it wasn't ^, _, or ', stop parsing super/subscripts break; } } // Base must be set if superscript or subscript are set per logic above, // but need to check here for type check to pass. if (superscript || subscript) { // If we got either a superscript or subscript, create a supsub return { type: "supsub", mode: this.mode, base: base, sup: superscript, sub: subscript }; } else { // Otherwise return the original body return base; } } /** * Parses an entire function, including its base and all of its arguments. */ ; _proto.parseFunction = function parseFunction(breakOnTokenText, name, // For error reporting. greediness) { var token = this.fetch(); var func = token.text; var funcData = src_functions[func]; if (!funcData) { return null; } this.consume(); // consume command token if (greediness != null && funcData.greediness <= greediness) { throw new src_ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token); } else if (this.mode === "text" && !funcData.allowedInText) { throw new src_ParseError("Can't use function '" + func + "' in text mode", token); } else if (this.mode === "math" && funcData.allowedInMath === false) { throw new src_ParseError("Can't use function '" + func + "' in math mode", token); } var _this$parseArguments = this.parseArguments(func, funcData), args = _this$parseArguments.args, optArgs = _this$parseArguments.optArgs; return this.callFunction(func, args, optArgs, token, breakOnTokenText); } /** * Call a function handler with a suitable context and arguments. */ ; _proto.callFunction = function callFunction(name, args, optArgs, token, breakOnTokenText) { var context = { funcName: name, parser: this, token: token, breakOnTokenText: breakOnTokenText }; var func = src_functions[name]; if (func && func.handler) { return func.handler(context, args, optArgs); } else { throw new src_ParseError("No function handler for " + name); } } /** * Parses the arguments of a function or environment */ ; _proto.parseArguments = function parseArguments(func, // Should look like "\name" or "\begin{name}". funcData) { var totalArgs = funcData.numArgs + funcData.numOptionalArgs; if (totalArgs === 0) { return { args: [], optArgs: [] }; } var baseGreediness = funcData.greediness; var args = []; var optArgs = []; for (var i = 0; i < totalArgs; i++) { var argType = funcData.argTypes && funcData.argTypes[i]; var isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments. As the TeXbook says: // "After you have said ‘\def\row#1#2{...}’, you are allowed to // put spaces between the arguments (e.g., ‘\row x n’), because // TeX doesn’t use single spaces as undelimited arguments." var consumeSpaces = i > 0 && !isOptional || // Also consume leading spaces in math mode, as parseSymbol // won't know what to do with them. This can only happen with // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. // In LaTeX, the \foo's get treated as (blank) arguments. // In KaTeX, for now, both spaces will get consumed. // TODO(edemaine) i === 0 && !isOptional && this.mode === "math"; var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional, baseGreediness, consumeSpaces); if (!arg) { if (isOptional) { optArgs.push(null); continue; } throw new src_ParseError("Expected group after '" + func + "'", this.fetch()); } (isOptional ? optArgs : args).push(arg); } return { args: args, optArgs: optArgs }; } /** * Parses a group when the mode is changing. */ ; _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness, consumeSpaces) { switch (type) { case "color": if (consumeSpaces) { this.consumeSpaces(); } return this.parseColorGroup(optional); case "size": if (consumeSpaces) { this.consumeSpaces(); } return this.parseSizeGroup(optional); case "url": return this.parseUrlGroup(optional, consumeSpaces); case "math": case "text": return this.parseGroup(name, optional, greediness, undefined, type, consumeSpaces); case "hbox": { // hbox argument type wraps the argument in the equivalent of // \hbox, which is like \text but switching to \textstyle size. var group = this.parseGroup(name, optional, greediness, undefined, "text", consumeSpaces); if (!group) { return group; } var styledGroup = { type: "styling", mode: group.mode, body: [group], style: "text" // simulate \textstyle }; return styledGroup; } case "raw": { if (consumeSpaces) { this.consumeSpaces(); } if (optional && this.fetch().text === "{") { return null; } var token = this.parseStringGroup("raw", optional, true); if (token) { return { type: "raw", mode: "text", string: token.text }; } else { throw new src_ParseError("Expected raw group", this.fetch()); } } case "original": case null: case undefined: return this.parseGroup(name, optional, greediness, undefined, undefined, consumeSpaces); default: throw new src_ParseError("Unknown group type as " + name, this.fetch()); } } /** * Discard any space tokens, fetching the next non-space token. */ ; _proto.consumeSpaces = function consumeSpaces() { while (this.fetch().text === " ") { this.consume(); } } /** * Parses a group, essentially returning the string formed by the * brace-enclosed tokens plus some position information. */ ; _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages. optional, raw) { var groupBegin = optional ? "[" : "{"; var groupEnd = optional ? "]" : "}"; var beginToken = this.fetch(); if (beginToken.text !== groupBegin) { if (optional) { return null; } else if (raw && beginToken.text !== "EOF" && /[^{}[\]]/.test(beginToken.text)) { this.consume(); return beginToken; } } var outerMode = this.mode; this.mode = "text"; this.expect(groupBegin); var str = ""; var firstToken = this.fetch(); var nested = 0; // allow nested braces in raw string group var lastToken = firstToken; var nextToken; while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) { switch (nextToken.text) { case "EOF": throw new src_ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str)); case groupBegin: nested++; break; case groupEnd: nested--; break; } lastToken = nextToken; str += lastToken.text; this.consume(); } this.expect(groupEnd); this.mode = outerMode; return firstToken.range(lastToken, str); } /** * Parses a regex-delimited group: the largest sequence of tokens * whose concatenated strings match `regex`. Returns the string * formed by the tokens plus some position information. */ ; _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) { var outerMode = this.mode; this.mode = "text"; var firstToken = this.fetch(); var lastToken = firstToken; var str = ""; var nextToken; while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) { lastToken = nextToken; str += lastToken.text; this.consume(); } if (str === "") { throw new src_ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); } this.mode = outerMode; return firstToken.range(lastToken, str); } /** * Parses a color description. */ ; _proto.parseColorGroup = function parseColorGroup(optional) { var res = this.parseStringGroup("color", optional); if (!res) { return null; } var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); if (!match) { throw new src_ParseError("Invalid color: '" + res.text + "'", res); } var color = match[0]; if (/^[0-9a-f]{6}$/i.test(color)) { // We allow a 6-digit HTML color spec without a leading "#". // This follows the xcolor package's HTML color model. // Predefined color names are all missed by this RegEx pattern. color = "#" + color; } return { type: "color-token", mode: this.mode, color: color }; } /** * Parses a size specification, consisting of magnitude and unit. */ ; _proto.parseSizeGroup = function parseSizeGroup(optional) { var res; var isBlank = false; if (!optional && this.fetch().text !== "{") { res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); } else { res = this.parseStringGroup("size", optional); } if (!res) { return null; } if (!optional && res.text.length === 0) { // Because we've tested for what is !optional, this block won't // affect \kern, \hspace, etc. It will capture the mandatory arguments // to \genfrac and \above. res.text = "0pt"; // Enable \above{} isBlank = true; // This is here specifically for \genfrac } var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); if (!match) { throw new src_ParseError("Invalid size: '" + res.text + "'", res); } var data = { number: +(match[1] + match[2]), // sign + magnitude, cast to number unit: match[3] }; if (!validUnit(data)) { throw new src_ParseError("Invalid unit: '" + data.unit + "'", res); } return { type: "size", mode: this.mode, value: data, isBlank: isBlank }; } /** * Parses an URL, checking escaped letters and allowed protocols, * and setting the catcode of % as an active character (as in \hyperref). */ ; _proto.parseUrlGroup = function parseUrlGroup(optional, consumeSpaces) { this.gullet.lexer.setCatcode("%", 13); // active character var res = this.parseStringGroup("url", optional, true); // get raw string this.gullet.lexer.setCatcode("%", 14); // comment character if (!res) { return null; } // hyperref package allows backslashes alone in href, but doesn't // generate valid links in such cases; we interpret this as // "undefined" behaviour, and keep them as-is. Some browser will // replace backslashes with forward slashes. var url = res.text.replace(/\\([#$%&~_^{}])/g, '$1'); return { type: "url", mode: this.mode, url: url }; } /** * If `optional` is false or absent, this parses an ordinary group, * which is either a single nucleus (like "x") or an expression * in braces (like "{x+y}") or an implicit group, a group that starts * at the current position, and ends right before a higher explicit * group ends, or at EOF. * If `optional` is true, it parses either a bracket-delimited expression * (like "[x+y]") or returns null to indicate the absence of a * bracket-enclosed group. * If `mode` is present, switches to that mode while parsing the group, * and switches back after. */ ; _proto.parseGroup = function parseGroup(name, // For error reporting. optional, greediness, breakOnTokenText, mode, consumeSpaces) { // Switch to specified mode var outerMode = this.mode; if (mode) { this.switchMode(mode); } // Consume spaces if requested, crucially *after* we switch modes, // so that the next non-space token is parsed in the correct mode. if (consumeSpaces) { this.consumeSpaces(); } // Get first token var firstToken = this.fetch(); var text = firstToken.text; var result; // Try to parse an open brace or \begingroup if (optional ? text === "[" : text === "{" || text === "\\begingroup") { this.consume(); var groupEnd = Parser.endOfGroup[text]; // Start a new group namespace this.gullet.beginGroup(); // If we get a brace, parse an expression var expression = this.parseExpression(false, groupEnd); var lastToken = this.fetch(); // Check that we got a matching closing brace this.expect(groupEnd); // End group namespace this.gullet.endGroup(); result = { type: "ordgroup", mode: this.mode, loc: SourceLocation.range(firstToken, lastToken), body: expression, // A group formed by \begingroup...\endgroup is a semi-simple group // which doesn't affect spacing in math mode, i.e., is transparent. // https://tex.stackexchange.com/questions/1930/when-should-one- // use-begingroup-instead-of-bgroup semisimple: text === "\\begingroup" || undefined }; } else if (optional) { // Return nothing for an optional group result = null; } else { // If there exists a function with this name, parse the function. // Otherwise, just return a nucleus result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol(); if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) { if (this.settings.throwOnError) { throw new src_ParseError("Undefined control sequence: " + text, firstToken); } result = this.formatUnsupportedCmd(text); this.consume(); } } // Switch mode back if (mode) { this.switchMode(outerMode); } return result; } /** * Form ligature-like combinations of characters for text mode. * This includes inputs like "--", "---", "``" and "''". * The result will simply replace multiple textord nodes with a single * character in each value by a single textord node having multiple * characters in its value. The representation is still ASCII source. * The group will be modified in place. */ ; _proto.formLigatures = function formLigatures(group) { var n = group.length - 1; for (var i = 0; i < n; ++i) { var a = group[i]; // $FlowFixMe: Not every node type has a `text` property. var v = a.text; if (v === "-" && group[i + 1].text === "-") { if (i + 1 < n && group[i + 2].text === "-") { group.splice(i, 3, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 2]), text: "---" }); n -= 2; } else { group.splice(i, 2, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 1]), text: "--" }); n -= 1; } } if ((v === "'" || v === "`") && group[i + 1].text === v) { group.splice(i, 2, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 1]), text: v + v }); n -= 1; } } } /** * Parse a single symbol out of the string. Here, we handle single character * symbols and special functions like \verb. */ ; _proto.parseSymbol = function parseSymbol() { var nucleus = this.fetch(); var text = nucleus.text; if (/^\\verb[^a-zA-Z]/.test(text)) { this.consume(); var arg = text.slice(5); var star = arg.charAt(0) === "*"; if (star) { arg = arg.slice(1); } // Lexer's tokenRegex is constructed to always have matching // first/last characters. if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { throw new src_ParseError("\\verb assertion failed --\n please report what input caused this bug"); } arg = arg.slice(1, -1); // remove first and last char return { type: "verb", mode: "text", body: arg, star: star }; } // At this point, we should have a symbol, possibly with accents. // First expand any accented base symbol according to unicodeSymbols. if (unicodeSymbols.hasOwnProperty(text[0]) && !src_symbols[this.mode][text[0]]) { // This behavior is not strict (XeTeX-compatible) in math mode. if (this.settings.strict && this.mode === "math") { this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus); } text = unicodeSymbols[text[0]] + text.substr(1); } // Strip off any combining characters var match = combiningDiacriticalMarksEndRegex.exec(text); if (match) { text = text.substring(0, match.index); if (text === 'i') { text = "\u0131"; // dotless i, in math and text mode } else if (text === 'j') { text = "\u0237"; // dotless j, in math and text mode } } // Recognize base symbol var symbol; if (src_symbols[this.mode][text]) { if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) { this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus); } var group = src_symbols[this.mode][text].group; var loc = SourceLocation.range(nucleus); var s; if (ATOMS.hasOwnProperty(group)) { // $FlowFixMe var family = group; s = { type: "atom", mode: this.mode, family: family, loc: loc, text: text }; } else { // $FlowFixMe s = { type: group, mode: this.mode, loc: loc, text: text }; } symbol = s; } else if (text.charCodeAt(0) >= 0x80) { // no symbol for e.g. ^ if (this.settings.strict) { if (!supportedCodepoint(text.charCodeAt(0))) { this.settings.reportNonstrict("unknownSymbol", "Unrecognized Unicode character \"" + text[0] + "\"" + (" (" + text.charCodeAt(0) + ")"), nucleus); } else if (this.mode === "math") { this.settings.reportNonstrict("unicodeTextInMathMode", "Unicode text character \"" + text[0] + "\" used in math mode", nucleus); } } // All nonmathematical Unicode characters are rendered as if they // are in text mode (wrapped in \text) because that's what it // takes to render them in LaTeX. Setting `mode: this.mode` is // another natural choice (the user requested math mode), but // this makes it more difficult for getCharacterMetrics() to // distinguish Unicode characters without metrics and those for // which we want to simulate the letter M. symbol = { type: "textord", mode: "text", loc: SourceLocation.range(nucleus), text: text }; } else { return null; // EOF, ^, _, {, }, etc. } this.consume(); // Transform combining characters into accents if (match) { for (var i = 0; i < match[0].length; i++) { var accent = match[0][i]; if (!unicodeAccents[accent]) { throw new src_ParseError("Unknown accent ' " + accent + "'", nucleus); } var command = unicodeAccents[accent][this.mode]; if (!command) { throw new src_ParseError("Accent " + accent + " unsupported in " + this.mode + " mode", nucleus); } symbol = { type: "accent", mode: this.mode, loc: SourceLocation.range(nucleus), label: command, isStretchy: false, isShifty: true, base: symbol }; } } return symbol; }; return Parser; }(); Parser_Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; Parser_Parser.endOfGroup = { "[": "]", "{": "}", "\\begingroup": "\\endgroup" /** * Parses an "expression", which is a list of atoms. * * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This * happens when functions have higher precendence han infix * nodes in implicit parses. * * `breakOnTokenText`: The text of the token that the expression should end * with, or `null` if something else should end the * expression. */ }; Parser_Parser.SUPSUB_GREEDINESS = 1; // CONCATENATED MODULE: ./src/parseTree.js /** * Provides a single function for parsing an expression using a Parser * TODO(emily): Remove this */ /** * Parses an expression using a Parser, then returns the parsed result. */ var parseTree_parseTree = function parseTree(toParse, settings) { if (!(typeof toParse === 'string' || toParse instanceof String)) { throw new TypeError('KaTeX can only parse string typed expression'); } var parser = new Parser_Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors delete parser.gullet.macros.current["\\df@tag"]; var tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag. // In this case, we separately parse the tag and wrap the tree. if (parser.gullet.macros.get("\\df@tag")) { if (!settings.displayMode) { throw new src_ParseError("\\tag works only in display equations"); } parser.gullet.feed("\\df@tag"); tree = [{ type: "tag", mode: "text", body: tree, tag: parser.parse() }]; } return tree; }; /* harmony default export */ var src_parseTree = (parseTree_parseTree); // CONCATENATED MODULE: ./katex.js /* eslint no-console:0 */ /** * This is the main entry point for KaTeX. Here, we expose functions for * rendering expressions either to DOM nodes or to markup strings. * * We also expose the ParseError class to check if errors thrown from KaTeX are * errors in the expression, or errors in javascript handling. */ /** * Parse and build an expression, and place that expression in the DOM node * given. */ var katex_render = function render(expression, baseNode, options) { baseNode.textContent = ""; var node = katex_renderToDomTree(expression, options).toNode(); baseNode.appendChild(node); }; // KaTeX's styles don't work properly in quirks mode. Print out an error, and // disable rendering. if (typeof document !== "undefined") { if (document.compatMode !== "CSS1Compat") { typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype."); katex_render = function render() { throw new src_ParseError("KaTeX doesn't work in quirks mode."); }; } } /** * Parse and build an expression, and return the markup for that. */ var renderToString = function renderToString(expression, options) { var markup = katex_renderToDomTree(expression, options).toMarkup(); return markup; }; /** * Parse an expression and return the parse tree. */ var katex_generateParseTree = function generateParseTree(expression, options) { var settings = new Settings_Settings(options); return src_parseTree(expression, settings); }; /** * If the given error is a KaTeX ParseError and options.throwOnError is false, * renders the invalid LaTeX as a span with hover title giving the KaTeX * error message. Otherwise, simply throws the error. */ var katex_renderError = function renderError(error, expression, options) { if (options.throwOnError || !(error instanceof src_ParseError)) { throw error; } var node = buildCommon.makeSpan(["katex-error"], [new domTree_SymbolNode(expression)]); node.setAttribute("title", error.toString()); node.setAttribute("style", "color:" + options.errorColor); return node; }; /** * Generates and returns the katex build tree. This is used for advanced * use cases (like rendering to custom output). */ var katex_renderToDomTree = function renderToDomTree(expression, options) { var settings = new Settings_Settings(options); try { var tree = src_parseTree(expression, settings); return buildTree_buildTree(tree, expression, settings); } catch (error) { return katex_renderError(error, expression, settings); } }; /** * Generates and returns the katex build tree, with just HTML (no MathML). * This is used for advanced use cases (like rendering to custom output). */ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { var settings = new Settings_Settings(options); try { var tree = src_parseTree(expression, settings); return buildTree_buildHTMLTree(tree, expression, settings); } catch (error) { return katex_renderError(error, expression, settings); } }; /* harmony default export */ var katex_0 = ({ /** * Current KaTeX version */ version: "0.12.0", /** * Renders the given LaTeX into an HTML+MathML combination, and adds * it as a child to the specified DOM node. */ render: katex_render, /** * Renders the given LaTeX into an HTML+MathML combination string, * for sending to the client. */ renderToString: renderToString, /** * KaTeX error, usually during parsing. */ ParseError: src_ParseError, /** * Parses the given LaTeX into KaTeX's internal parse tree structure, * without rendering to HTML or MathML. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __parse: katex_generateParseTree, /** * Renders the given LaTeX into an HTML+MathML internal DOM tree * representation, without flattening that representation to a string. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __renderToDomTree: katex_renderToDomTree, /** * Renders the given LaTeX into an HTML internal DOM tree representation, * without MathML and without flattening that representation to a string. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __renderToHTMLTree: katex_renderToHTMLTree, /** * extends internal font metrics object with a new object * each key in the new object represents a font name */ __setFontMetrics: setFontMetrics, /** * adds a new symbol to builtin symbols table */ __defineSymbol: defineSymbol, /** * adds a new macro to builtin macro list */ __defineMacro: defineMacro, /** * Expose the dom tree node types, which can be useful for type checking nodes. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __domTree: { Span: domTree_Span, Anchor: domTree_Anchor, SymbolNode: domTree_SymbolNode, SvgNode: SvgNode, PathNode: domTree_PathNode, LineNode: LineNode } }); // CONCATENATED MODULE: ./katex.webpack.js /** * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2] * doesn't support CSS modules natively, a separate entry point is used and * it is not flowtyped. * * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef * [2] https://facebook.github.io/jest/docs/en/webpack.html */ /* harmony default export */ var katex_webpack = __webpack_exports__["default"] = (katex_0); /***/ }) /******/ ])["default"]; }); ================================================ FILE: source/lib/katex@0.12.0/katex.mjs ================================================ /** * Lexing or parsing positional information for error reporting. * This object is immutable. */ class SourceLocation { // The + prefix indicates that these fields aren't writeable // Lexer holding the input string. // Start offset, zero-based inclusive. // End offset, zero-based exclusive. constructor(lexer, start, end) { this.lexer = void 0; this.start = void 0; this.end = void 0; this.lexer = lexer; this.start = start; this.end = end; } /** * Merges two `SourceLocation`s from location providers, given they are * provided in order of appearance. * - Returns the first one's location if only the first is provided. * - Returns a merged range of the first and the last if both are provided * and their lexers match. * - Otherwise, returns null. */ static range(first, second) { if (!second) { return first && first.loc; } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) { return null; } else { return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end); } } } /** * Interface required to break circular dependency between Token, Lexer, and * ParseError. */ /** * The resulting token returned from `lex`. * * It consists of the token text plus some position information. * The position information is essentially a range in an input string, * but instead of referencing the bare input string, we refer to the lexer. * That way it is possible to attach extra metadata to the input string, * like for example a file name or similar. * * The position information is optional, so it is OK to construct synthetic * tokens if appropriate. Not providing available position information may * lead to degraded error reporting, though. */ class Token { // don't expand the token // used in \noexpand constructor(text, // the text of this token loc) { this.text = void 0; this.loc = void 0; this.noexpand = void 0; this.treatAsRelax = void 0; this.text = text; this.loc = loc; } /** * Given a pair of tokens (this and endToken), compute a `Token` encompassing * the whole input range enclosed by these two. */ range(endToken, // last token of the range, inclusive text) // the text of the newly constructed token { return new Token(text, SourceLocation.range(this, endToken)); } } /** * This is the ParseError class, which is the main error thrown by KaTeX * functions when something has gone wrong. This is used to distinguish internal * errors from errors in the expression that the user provided. * * If possible, a caller should provide a Token or ParseNode with information * about where in the source string the problem occurred. */ class ParseError { // Error position based on passed-in Token or ParseNode. constructor(message, // The error message token) // An object providing position information { this.position = void 0; let error = "KaTeX parse error: " + message; let start; const loc = token && token.loc; if (loc && loc.start <= loc.end) { // If we have the input and a position, make the error a bit fancier // Get the input const input = loc.lexer.input; // Prepend some information start = loc.start; const end = loc.end; if (start === input.length) { error += " at end of input: "; } else { error += " at position " + (start + 1) + ": "; } // Underline token in question using combining underscores const underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); // Extract some context from the input and add it to the error let left; if (start > 15) { left = "…" + input.slice(start - 15, start); } else { left = input.slice(0, start); } let right; if (end + 15 < input.length) { right = input.slice(end, end + 15) + "…"; } else { right = input.slice(end); } error += left + underlined + right; } // Some hackery to make ParseError a prototype of Error // See http://stackoverflow.com/a/8460753 const self = new Error(error); self.name = "ParseError"; // $FlowFixMe self.__proto__ = ParseError.prototype; // $FlowFixMe self.position = start; return self; } } // $FlowFixMe More hackery ParseError.prototype.__proto__ = Error.prototype; /** * This file contains a list of utility functions which are useful in other * files. */ /** * Return whether an element is contained in a list */ const contains = function contains(list, elem) { return list.indexOf(elem) !== -1; }; /** * Provide a default value if a setting is undefined * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022. */ const deflt = function deflt(setting, defaultIfUndefined) { return setting === undefined ? defaultIfUndefined : setting; }; // hyphenate and escape adapted from Facebook's React under Apache 2 license const uppercase = /([A-Z])/g; const hyphenate = function hyphenate(str) { return str.replace(uppercase, "-$1").toLowerCase(); }; const ESCAPE_LOOKUP = { "&": "&", ">": ">", "<": "<", "\"": """, "'": "'" }; const ESCAPE_REGEX = /[&><"']/g; /** * Escapes text to prevent scripting attacks. */ function escape(text) { return String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]); } /** * Sometimes we want to pull out the innermost element of a group. In most * cases, this will just be the group itself, but when ordgroups and colors have * a single element, we want to pull that out. */ const getBaseElem = function getBaseElem(group) { if (group.type === "ordgroup") { if (group.body.length === 1) { return getBaseElem(group.body[0]); } else { return group; } } else if (group.type === "color") { if (group.body.length === 1) { return getBaseElem(group.body[0]); } else { return group; } } else if (group.type === "font") { return getBaseElem(group.body); } else { return group; } }; /** * TeXbook algorithms often reference "character boxes", which are simply groups * with a single character in them. To decide if something is a character box, * we find its innermost group, and see if it is a single character. */ const isCharacterBox = function isCharacterBox(group) { const baseElem = getBaseElem(group); // These are all they types of groups which hold single characters return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom"; }; const assert = function assert(value) { if (!value) { throw new Error('Expected non-null, but got ' + String(value)); } return value; }; /** * Return the protocol of a URL, or "_relative" if the URL does not specify a * protocol (and thus is relative). */ const protocolFromUrl = function protocolFromUrl(url) { const protocol = /^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(url); return protocol != null ? protocol[1] : "_relative"; }; var utils = { contains, deflt, escape, hyphenate, getBaseElem, isCharacterBox, protocolFromUrl }; /* eslint no-console:0 */ /** * The main Settings object * * The current options stored are: * - displayMode: Whether the expression should be typeset as inline math * (false, the default), meaning that the math starts in * \textstyle and is placed in an inline-block); or as display * math (true), meaning that the math starts in \displaystyle * and is placed in a block with vertical margin. */ class Settings { constructor(options) { this.displayMode = void 0; this.output = void 0; this.leqno = void 0; this.fleqn = void 0; this.throwOnError = void 0; this.errorColor = void 0; this.macros = void 0; this.minRuleThickness = void 0; this.colorIsTextColor = void 0; this.strict = void 0; this.trust = void 0; this.maxSize = void 0; this.maxExpand = void 0; this.globalGroup = void 0; // allow null options options = options || {}; this.displayMode = utils.deflt(options.displayMode, false); this.output = utils.deflt(options.output, "htmlAndMathml"); this.leqno = utils.deflt(options.leqno, false); this.fleqn = utils.deflt(options.fleqn, false); this.throwOnError = utils.deflt(options.throwOnError, true); this.errorColor = utils.deflt(options.errorColor, "#cc0000"); this.macros = options.macros || {}; this.minRuleThickness = Math.max(0, utils.deflt(options.minRuleThickness, 0)); this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false); this.strict = utils.deflt(options.strict, "warn"); this.trust = utils.deflt(options.trust, false); this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity)); this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000)); this.globalGroup = utils.deflt(options.globalGroup, false); } /** * Report nonstrict (non-LaTeX-compatible) input. * Can safely not be called if `this.strict` is false in JavaScript. */ reportNonstrict(errorCode, errorMsg, token) { let strict = this.strict; if (typeof strict === "function") { // Allow return value of strict function to be boolean or string // (or null/undefined, meaning no further processing). strict = strict(errorCode, errorMsg, token); } if (!strict || strict === "ignore") { } else if (strict === true || strict === "error") { throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + `${errorMsg} [${errorCode}]`, token); } else if (strict === "warn") { typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + `${errorMsg} [${errorCode}]`); } else { // won't happen in type-safe code typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + `unrecognized '${strict}': ${errorMsg} [${errorCode}]`); } } /** * Check whether to apply strict (LaTeX-adhering) behavior for unusual * input (like `\\`). Unlike `nonstrict`, will not throw an error; * instead, "error" translates to a return value of `true`, while "ignore" * translates to a return value of `false`. May still print a warning: * "warn" prints a warning and returns `false`. * This is for the second category of `errorCode`s listed in the README. */ useStrictBehavior(errorCode, errorMsg, token) { let strict = this.strict; if (typeof strict === "function") { // Allow return value of strict function to be boolean or string // (or null/undefined, meaning no further processing). // But catch any exceptions thrown by function, treating them // like "error". try { strict = strict(errorCode, errorMsg, token); } catch (error) { strict = "error"; } } if (!strict || strict === "ignore") { return false; } else if (strict === true || strict === "error") { return true; } else if (strict === "warn") { typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + `${errorMsg} [${errorCode}]`); return false; } else { // won't happen in type-safe code typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + `unrecognized '${strict}': ${errorMsg} [${errorCode}]`); return false; } } /** * Check whether to test potentially dangerous input, and return * `true` (trusted) or `false` (untrusted). The sole argument `context` * should be an object with `command` field specifying the relevant LaTeX * command (as a string starting with `\`), and any other arguments, etc. * If `context` has a `url` field, a `protocol` field will automatically * get added by this function (changing the specified object). */ isTrusted(context) { if (context.url && !context.protocol) { context.protocol = utils.protocolFromUrl(context.url); } const trust = typeof this.trust === "function" ? this.trust(context) : this.trust; return Boolean(trust); } } /** * This file contains information and classes for the various kinds of styles * used in TeX. It provides a generic `Style` class, which holds information * about a specific style. It then provides instances of all the different kinds * of styles possible, and provides functions to move between them and get * information about them. */ /** * The main style class. Contains a unique id for the style, a size (which is * the same for cramped and uncramped version of a style), and a cramped flag. */ class Style { constructor(id, size, cramped) { this.id = void 0; this.size = void 0; this.cramped = void 0; this.id = id; this.size = size; this.cramped = cramped; } /** * Get the style of a superscript given a base in the current style. */ sup() { return styles[sup[this.id]]; } /** * Get the style of a subscript given a base in the current style. */ sub() { return styles[sub[this.id]]; } /** * Get the style of a fraction numerator given the fraction in the current * style. */ fracNum() { return styles[fracNum[this.id]]; } /** * Get the style of a fraction denominator given the fraction in the current * style. */ fracDen() { return styles[fracDen[this.id]]; } /** * Get the cramped version of a style (in particular, cramping a cramped style * doesn't change the style). */ cramp() { return styles[cramp[this.id]]; } /** * Get a text or display version of this style. */ text() { return styles[text[this.id]]; } /** * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) */ isTight() { return this.size >= 2; } } // Export an interface for type checking, but don't expose the implementation. // This way, no more styles can be generated. // IDs of the different styles const D = 0; const Dc = 1; const T = 2; const Tc = 3; const S = 4; const Sc = 5; const SS = 6; const SSc = 7; // Instances of the different styles const styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another const sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; const sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; const fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; const fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; const cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; const text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles. var Style$1 = { DISPLAY: styles[D], TEXT: styles[T], SCRIPT: styles[S], SCRIPTSCRIPT: styles[SS] }; /* * This file defines the Unicode scripts and script families that we * support. To add new scripts or families, just add a new entry to the * scriptData array below. Adding scripts to the scriptData array allows * characters from that script to appear in \text{} environments. */ /** * Each script or script family has a name and an array of blocks. * Each block is an array of two numbers which specify the start and * end points (inclusive) of a block of Unicode codepoints. */ /** * Unicode block data for the families of scripts we support in \text{}. * Scripts only need to appear here if they do not have font metrics. */ const scriptData = [{ // Latin characters beyond the Latin-1 characters we have metrics for. // Needed for Czech, Hungarian and Turkish text, for example. name: 'latin', blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B [0x0300, 0x036f]] }, { // The Cyrillic script used by Russian and related languages. // A Cyrillic subset used to be supported as explicitly defined // symbols in symbols.js name: 'cyrillic', blocks: [[0x0400, 0x04ff]] }, { // The Brahmic scripts of South and Southeast Asia // Devanagari (0900–097F) // Bengali (0980–09FF) // Gurmukhi (0A00–0A7F) // Gujarati (0A80–0AFF) // Oriya (0B00–0B7F) // Tamil (0B80–0BFF) // Telugu (0C00–0C7F) // Kannada (0C80–0CFF) // Malayalam (0D00–0D7F) // Sinhala (0D80–0DFF) // Thai (0E00–0E7F) // Lao (0E80–0EFF) // Tibetan (0F00–0FFF) // Myanmar (1000–109F) name: 'brahmic', blocks: [[0x0900, 0x109F]] }, { name: 'georgian', blocks: [[0x10A0, 0x10ff]] }, { // Chinese and Japanese. // The "k" in cjk is for Korean, but we've separated Korean out name: "cjk", blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana [0x4E00, 0x9FAF], // CJK ideograms [0xFF00, 0xFF60]] }, { // Korean name: 'hangul', blocks: [[0xAC00, 0xD7AF]] }]; /** * Given a codepoint, return the name of the script or script family * it is from, or null if it is not part of a known block */ function scriptFromCodepoint(codepoint) { for (let i = 0; i < scriptData.length; i++) { const script = scriptData[i]; for (let i = 0; i < script.blocks.length; i++) { const block = script.blocks[i]; if (codepoint >= block[0] && codepoint <= block[1]) { return script.name; } } } return null; } /** * A flattened version of all the supported blocks in a single array. * This is an optimization to make supportedCodepoint() fast. */ const allBlocks = []; scriptData.forEach(s => s.blocks.forEach(b => allBlocks.push(...b))); /** * Given a codepoint, return true if it falls within one of the * scripts or script families defined above and false otherwise. * * Micro benchmarks shows that this is faster than * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test() * in Firefox, Chrome and Node. */ function supportedCodepoint(codepoint) { for (let i = 0; i < allBlocks.length; i += 2) { if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) { return true; } } return false; } /** * This file provides support to domTree.js and delimiter.js. * It's a storehouse of path geometry for SVG images. */ // In all paths below, the viewBox-to-em scale is 1000:1. const hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping. // The viniculum of a \sqrt can be made thicker by a KaTeX rendering option. // Think of variable extraViniculum as two detours in the SVG path. // The detour begins at the lower left of the area labeled extraViniculum below. // The detour proceeds one extraViniculum distance up and slightly to the right, // displacing the radiused corner between surd and viniculum. The radius is // traversed as usual, then the detour resumes. It goes right, to the end of // the very long viniculumn, then down one extraViniculum distance, // after which it resumes regular path geometry for the radical. /* viniculum / /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraViniculum / █████████████████████←0.04em (40 unit) std viniculum thickness / / / / / /\ / / surd */ const sqrtMain = function sqrtMain(extraViniculum, hLinePad) { // sqrtMain path geometry is from glyph U221A in the font KaTeX Main return `M95,${622 + extraViniculum + hLinePad} c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 c69,-144,104.5,-217.7,106.5,-221 l${extraViniculum / 2.075} -${extraViniculum} c5.3,-9.3,12,-14,20,-14 H400000v${40 + extraViniculum}H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z M${834 + extraViniculum} ${hLinePad}h400000v${40 + extraViniculum}h-400000z`; }; const sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) { // size1 is from glyph U221A in the font KaTeX_Size1-Regular return `M263,${601 + extraViniculum + hLinePad}c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l${extraViniculum / 2.084} -${extraViniculum} c4.7,-7.3,11,-11,19,-11 H40000v${40 + extraViniculum}H1012.3 s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z M${1001 + extraViniculum} ${hLinePad}h400000v${40 + extraViniculum}h-400000z`; }; const sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) { // size2 is from glyph U221A in the font KaTeX_Size2-Regular return `M983 ${10 + extraViniculum + hLinePad} l${extraViniculum / 3.13} -${extraViniculum} c4,-6.7,10,-10,18,-10 H400000v${40 + extraViniculum} H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z M${1001 + extraViniculum} ${hLinePad}h400000v${40 + extraViniculum}h-400000z`; }; const sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) { // size3 is from glyph U221A in the font KaTeX_Size3-Regular return `M424,${2398 + extraViniculum + hLinePad} c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 l${extraViniculum / 4.223} -${extraViniculum}c4,-6.7,10,-10,18,-10 H400000 v${40 + extraViniculum}H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M${1001 + extraViniculum} ${hLinePad} h400000v${40 + extraViniculum}h-400000z`; }; const sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) { // size4 is from glyph U221A in the font KaTeX_Size4-Regular return `M473,${2713 + extraViniculum + hLinePad} c339.3,-1799.3,509.3,-2700,510,-2702 l${extraViniculum / 5.298} -${extraViniculum} c3.3,-7.3,9.3,-11,18,-11 H400000v${40 + extraViniculum}H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, 606zM${1001 + extraViniculum} ${hLinePad}h400000v${40 + extraViniculum}H1017.7z`; }; const sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) { // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular // One path edge has a variable length. It runs vertically from the viniculumn // to a point near (14 units) the bottom of the surd. The viniculum // is normally 40 units thick. So the length of the line in question is: const vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum; return `M702 ${extraViniculum + hLinePad}H400000${40 + extraViniculum} H742v${vertSegment}l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 219 661 l218 661zM702 ${hLinePad}H400000v${40 + extraViniculum}H742z`; }; const sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) { extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox. let path = ""; switch (size) { case "sqrtMain": path = sqrtMain(extraViniculum, hLinePad); break; case "sqrtSize1": path = sqrtSize1(extraViniculum, hLinePad); break; case "sqrtSize2": path = sqrtSize2(extraViniculum, hLinePad); break; case "sqrtSize3": path = sqrtSize3(extraViniculum, hLinePad); break; case "sqrtSize4": path = sqrtSize4(extraViniculum, hLinePad); break; case "sqrtTall": path = sqrtTall(extraViniculum, hLinePad, viewBoxHeight); } return path; }; const path = { // Two paths that cover gaps in built-up parentheses. leftParenInner: `M291 0 H417 V300 H291 z`, rightParenInner: `M457 0 H583 V300 H457 z`, // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main doubleleftarrow: `M262 157 l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 -86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 -2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z m8 0v40h399730v-40zm0 194v40h399730v-40z`, // doublerightarrow is from glyph U+21D2 in font KaTeX Main doublerightarrow: `M399738 392l -10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 -33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 -17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 -13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 -107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`, // leftarrow is from glyph U+2190 in font KaTeX Main leftarrow: `M400000 241H110l3-3c68.7-52.7 113.7-120 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 -5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 l-3-3h399890zM100 241v40h399900v-40z`, // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular leftbrace: `M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 -45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 5-6 9-10 13-.7 1-7.3 1-20 1H6z`, leftbraceunder: `M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 -331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`, // overgroup is from the MnSymbol package (public domain) leftgroup: `M400000 80 H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 435 0h399565z`, leftgroupunder: `M400000 262 H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 435 219h399565z`, // Harpoons are from glyph U+21BD in font KaTeX Main leftharpoon: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 -3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 -18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 -196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`, leftharpoonplus: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 -4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 -10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z m0 0v40h400000v-40z`, leftharpoondown: `M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 -152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`, leftharpoondownplus: `M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 -2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`, // hook is from glyph U+21A9 in font KaTeX Main lefthook: `M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 71.5 23h399859zM103 281v-40h399897v40z`, leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z M40 281 V428 H0 V94 H40 V241 H400000 v40z`, leftmapsto: `M40 281 V448H0V74H40V241H400000v40z M40 281 V448H0V74H40V241H400000v40z`, // tofrom is from glyph U+21C4 in font KaTeX AMS Regular leftToFrom: `M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`, longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z M0 50 h400000 v40H0z m0 194h40000v40H0z`, midbrace: `M200428 334 c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`, midbraceunder: `M199572 214 c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 -5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`, oiintSize1: `M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 -320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`, oiintSize2: `M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 -451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 c0 110 84 276 504 276s502.4-166 502.4-276z`, oiiintSize1: `M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 -480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`, oiiintSize2: `M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 -707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`, rightarrow: `M0 241v40h399891c-47.3 35.3-84 78-110 128 -16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 -40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 151.7 139 205zm0 0v40h399900v-40z`, rightbrace: `M400000 542l -6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`, rightbraceunder: `M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 -174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`, rightgroup: `M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 3-1 3-3v-38c-76-158-257-219-435-219H0z`, rightgroupunder: `M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`, rightharpoon: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 -3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 -10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5zm0 0v40h399900v-40z`, rightharpoonplus: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 -18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`, rightharpoondown: `M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 -7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 -27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`, rightharpoondownplus: `M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 -64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z m0-194v40h400000v-40zm0 0v40h400000v-40z`, righthook: `M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`, rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`, rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`, // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular twoheadleftarrow: `M0 167c68 40 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 -70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 -40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 -37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`, twoheadrightarrow: `M400000 167 c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 -19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`, // tilde1 is a modified version of a glyph from the MnSymbol package tilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 -68.267.847-113-73.952-191-73.952z`, // ditto tilde2, tilde3, & tilde4 tilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418 -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 181.476 676 181.476c-149 0-189-126.21-332-126.21z`, tilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 -338 0-409-156.573-744-156.573z`, tilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 -175.236-744-175.236z`, // vec is from glyph U+20D7 in font KaTeX Main vec: `M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 -1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 -7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 c-16-25.333-24-45-24-59z`, // widehat1 is a modified version of a glyph from the MnSymbol package widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`, // ditto widehat2, widehat3, & widehat4 widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, // widecheck paths are all inverted versions of widehat widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`, widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, // The next ten paths support reaction arrows from the mhchem package. // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`, // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main rightarrowabovebar: `M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 -27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 -84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 -119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`, // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em baraboveshortleftharpoon: `M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`, rightharpoonaboveshortbar: `M0,241 l0,40c399126,0,399993,0,399993,0 c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`, shortbaraboveleftharpoon: `M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, 1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, -152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`, shortrightharpoonabovebar: `M53,241l0,40c398570,0,399437,0,399437,0 c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z` }; /** * This node represents a document fragment, which contains elements, but when * placed into the DOM doesn't have any representation itself. It only contains * children and doesn't have any DOM node properties. */ class DocumentFragment { // HtmlDomNode // Never used; needed for satisfying interface. constructor(children) { this.children = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; this.children = children; this.classes = []; this.height = 0; this.depth = 0; this.maxFontSize = 0; this.style = {}; } hasClass(className) { return utils.contains(this.classes, className); } /** Convert the fragment into a node. */ toNode() { const frag = document.createDocumentFragment(); for (let i = 0; i < this.children.length; i++) { frag.appendChild(this.children[i].toNode()); } return frag; } /** Convert the fragment into HTML markup. */ toMarkup() { let markup = ""; // Simply concatenate the markup for the children together. for (let i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } return markup; } /** * Converts the math node into a string, similar to innerText. Applies to * MathDomNode's only. */ toText() { // To avoid this, we would subclass documentFragment separately for // MathML, but polyfills for subclassing is expensive per PR 1469. // $FlowFixMe: Only works for ChildType = MathDomNode. const toText = child => child.toText(); return this.children.map(toText).join(""); } } /** * These objects store the data about the DOM nodes we create, as well as some * extra data. They can then be transformed into real DOM nodes with the * `toNode` function or HTML markup using `toMarkup`. They are useful for both * storing extra properties on the nodes, as well as providing a way to easily * work with the DOM. * * Similar functions for working with MathML nodes exist in mathMLTree.js. * * TODO: refactor `span` and `anchor` into common superclass when * target environments support class inheritance */ /** * Create an HTML className based on a list of classes. In addition to joining * with spaces, we also remove empty classes. */ const createClass = function createClass(classes) { return classes.filter(cls => cls).join(" "); }; const initNode = function initNode(classes, options, style) { this.classes = classes || []; this.attributes = {}; this.height = 0; this.depth = 0; this.maxFontSize = 0; this.style = style || {}; if (options) { if (options.style.isTight()) { this.classes.push("mtight"); } const color = options.getColor(); if (color) { this.style.color = color; } } }; /** * Convert into an HTML node */ const toNode = function toNode(tagName) { const node = document.createElement(tagName); // Apply the class node.className = createClass(this.classes); // Apply inline styles for (const style in this.style) { if (this.style.hasOwnProperty(style)) { // $FlowFixMe Flow doesn't seem to understand span.style's type. node.style[style] = this.style[style]; } } // Apply attributes for (const attr in this.attributes) { if (this.attributes.hasOwnProperty(attr)) { node.setAttribute(attr, this.attributes[attr]); } } // Append the children, also as HTML nodes for (let i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; }; /** * Convert into an HTML markup string */ const toMarkup = function toMarkup(tagName) { let markup = `<${tagName}`; // Add the class if (this.classes.length) { markup += ` class="${utils.escape(createClass(this.classes))}"`; } let styles = ""; // Add the styles, after hyphenation for (const style in this.style) { if (this.style.hasOwnProperty(style)) { styles += `${utils.hyphenate(style)}:${this.style[style]};`; } } if (styles) { markup += ` style="${utils.escape(styles)}"`; } // Add the attributes for (const attr in this.attributes) { if (this.attributes.hasOwnProperty(attr)) { markup += ` ${attr}="${utils.escape(this.attributes[attr])}"`; } } markup += ">"; // Add the markup of the children, also as markup for (let i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } markup += ``; return markup; }; // Making the type below exact with all optional fields doesn't work due to // - https://github.com/facebook/flow/issues/4582 // - https://github.com/facebook/flow/issues/5688 // However, since *all* fields are optional, $Shape<> works as suggested in 5688 // above. // This type does not include all CSS properties. Additional properties should // be added as needed. /** * This node represents a span node, with a className, a list of children, and * an inline style. It also contains information about its height, depth, and * maxFontSize. * * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan * otherwise. This typesafety is important when HTML builders access a span's * children. */ class Span { constructor(classes, children, options, style) { this.children = void 0; this.attributes = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.width = void 0; this.maxFontSize = void 0; this.style = void 0; initNode.call(this, classes, options, style); this.children = children || []; } /** * Sets an arbitrary attribute on the span. Warning: use this wisely. Not * all browsers support attributes the same, and having too many custom * attributes is probably bad. */ setAttribute(attribute, value) { this.attributes[attribute] = value; } hasClass(className) { return utils.contains(this.classes, className); } toNode() { return toNode.call(this, "span"); } toMarkup() { return toMarkup.call(this, "span"); } } /** * This node represents an anchor () element with a hyperlink. See `span` * for further details. */ class Anchor { constructor(href, classes, children, options) { this.children = void 0; this.attributes = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; initNode.call(this, classes, options); this.children = children || []; this.setAttribute('href', href); } setAttribute(attribute, value) { this.attributes[attribute] = value; } hasClass(className) { return utils.contains(this.classes, className); } toNode() { return toNode.call(this, "a"); } toMarkup() { return toMarkup.call(this, "a"); } } /** * This node represents an image embed () element. */ class Img { constructor(src, alt, style) { this.src = void 0; this.alt = void 0; this.classes = void 0; this.height = void 0; this.depth = void 0; this.maxFontSize = void 0; this.style = void 0; this.alt = alt; this.src = src; this.classes = ["mord"]; this.style = style; } hasClass(className) { return utils.contains(this.classes, className); } toNode() { const node = document.createElement("img"); node.src = this.src; node.alt = this.alt; node.className = "mord"; // Apply inline styles for (const style in this.style) { if (this.style.hasOwnProperty(style)) { // $FlowFixMe node.style[style] = this.style[style]; } } return node; } toMarkup() { let markup = `${this.alt} 0) { span = document.createElement("span"); span.style.marginRight = this.italic + "em"; } if (this.classes.length > 0) { span = span || document.createElement("span"); span.className = createClass(this.classes); } for (const style in this.style) { if (this.style.hasOwnProperty(style)) { span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type. span.style[style] = this.style[style]; } } if (span) { span.appendChild(node); return span; } else { return node; } } /** * Creates markup for a symbol node. */ toMarkup() { // TODO(alpert): More duplication than I'd like from // span.prototype.toMarkup and symbolNode.prototype.toNode... let needsSpan = false; let markup = " 0) { styles += "margin-right:" + this.italic + "em;"; } for (const style in this.style) { if (this.style.hasOwnProperty(style)) { styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; } } if (styles) { needsSpan = true; markup += " style=\"" + utils.escape(styles) + "\""; } const escaped = utils.escape(this.text); if (needsSpan) { markup += ">"; markup += escaped; markup += ""; return markup; } else { return escaped; } } } /** * SVG nodes are used to render stretchy wide elements. */ class SvgNode { constructor(children, attributes) { this.children = void 0; this.attributes = void 0; this.children = children || []; this.attributes = attributes || {}; } toNode() { const svgNS = "http://www.w3.org/2000/svg"; const node = document.createElementNS(svgNS, "svg"); // Apply attributes for (const attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } for (let i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; } toMarkup() { let markup = "`; } else { return ``; } } } class LineNode { constructor(attributes) { this.attributes = void 0; this.attributes = attributes || {}; } toNode() { const svgNS = "http://www.w3.org/2000/svg"; const node = document.createElementNS(svgNS, "line"); // Apply attributes for (const attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } return node; } toMarkup() { let markup = " but got ${String(group)}.`); } } // This file is GENERATED by buildMetrics.sh. DO NOT MODIFY. var metricMap = { "AMS-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.68889, 0, 0, 0.72222], "66": [0, 0.68889, 0, 0, 0.66667], "67": [0, 0.68889, 0, 0, 0.72222], "68": [0, 0.68889, 0, 0, 0.72222], "69": [0, 0.68889, 0, 0, 0.66667], "70": [0, 0.68889, 0, 0, 0.61111], "71": [0, 0.68889, 0, 0, 0.77778], "72": [0, 0.68889, 0, 0, 0.77778], "73": [0, 0.68889, 0, 0, 0.38889], "74": [0.16667, 0.68889, 0, 0, 0.5], "75": [0, 0.68889, 0, 0, 0.77778], "76": [0, 0.68889, 0, 0, 0.66667], "77": [0, 0.68889, 0, 0, 0.94445], "78": [0, 0.68889, 0, 0, 0.72222], "79": [0.16667, 0.68889, 0, 0, 0.77778], "80": [0, 0.68889, 0, 0, 0.61111], "81": [0.16667, 0.68889, 0, 0, 0.77778], "82": [0, 0.68889, 0, 0, 0.72222], "83": [0, 0.68889, 0, 0, 0.55556], "84": [0, 0.68889, 0, 0, 0.66667], "85": [0, 0.68889, 0, 0, 0.72222], "86": [0, 0.68889, 0, 0, 0.72222], "87": [0, 0.68889, 0, 0, 1.0], "88": [0, 0.68889, 0, 0, 0.72222], "89": [0, 0.68889, 0, 0, 0.72222], "90": [0, 0.68889, 0, 0, 0.66667], "107": [0, 0.68889, 0, 0, 0.55556], "160": [0, 0, 0, 0, 0.25], "165": [0, 0.675, 0.025, 0, 0.75], "174": [0.15559, 0.69224, 0, 0, 0.94666], "240": [0, 0.68889, 0, 0, 0.55556], "295": [0, 0.68889, 0, 0, 0.54028], "710": [0, 0.825, 0, 0, 2.33334], "732": [0, 0.9, 0, 0, 2.33334], "770": [0, 0.825, 0, 0, 2.33334], "771": [0, 0.9, 0, 0, 2.33334], "989": [0.08167, 0.58167, 0, 0, 0.77778], "1008": [0, 0.43056, 0.04028, 0, 0.66667], "8245": [0, 0.54986, 0, 0, 0.275], "8463": [0, 0.68889, 0, 0, 0.54028], "8487": [0, 0.68889, 0, 0, 0.72222], "8498": [0, 0.68889, 0, 0, 0.55556], "8502": [0, 0.68889, 0, 0, 0.66667], "8503": [0, 0.68889, 0, 0, 0.44445], "8504": [0, 0.68889, 0, 0, 0.66667], "8513": [0, 0.68889, 0, 0, 0.63889], "8592": [-0.03598, 0.46402, 0, 0, 0.5], "8594": [-0.03598, 0.46402, 0, 0, 0.5], "8602": [-0.13313, 0.36687, 0, 0, 1.0], "8603": [-0.13313, 0.36687, 0, 0, 1.0], "8606": [0.01354, 0.52239, 0, 0, 1.0], "8608": [0.01354, 0.52239, 0, 0, 1.0], "8610": [0.01354, 0.52239, 0, 0, 1.11111], "8611": [0.01354, 0.52239, 0, 0, 1.11111], "8619": [0, 0.54986, 0, 0, 1.0], "8620": [0, 0.54986, 0, 0, 1.0], "8621": [-0.13313, 0.37788, 0, 0, 1.38889], "8622": [-0.13313, 0.36687, 0, 0, 1.0], "8624": [0, 0.69224, 0, 0, 0.5], "8625": [0, 0.69224, 0, 0, 0.5], "8630": [0, 0.43056, 0, 0, 1.0], "8631": [0, 0.43056, 0, 0, 1.0], "8634": [0.08198, 0.58198, 0, 0, 0.77778], "8635": [0.08198, 0.58198, 0, 0, 0.77778], "8638": [0.19444, 0.69224, 0, 0, 0.41667], "8639": [0.19444, 0.69224, 0, 0, 0.41667], "8642": [0.19444, 0.69224, 0, 0, 0.41667], "8643": [0.19444, 0.69224, 0, 0, 0.41667], "8644": [0.1808, 0.675, 0, 0, 1.0], "8646": [0.1808, 0.675, 0, 0, 1.0], "8647": [0.1808, 0.675, 0, 0, 1.0], "8648": [0.19444, 0.69224, 0, 0, 0.83334], "8649": [0.1808, 0.675, 0, 0, 1.0], "8650": [0.19444, 0.69224, 0, 0, 0.83334], "8651": [0.01354, 0.52239, 0, 0, 1.0], "8652": [0.01354, 0.52239, 0, 0, 1.0], "8653": [-0.13313, 0.36687, 0, 0, 1.0], "8654": [-0.13313, 0.36687, 0, 0, 1.0], "8655": [-0.13313, 0.36687, 0, 0, 1.0], "8666": [0.13667, 0.63667, 0, 0, 1.0], "8667": [0.13667, 0.63667, 0, 0, 1.0], "8669": [-0.13313, 0.37788, 0, 0, 1.0], "8672": [-0.064, 0.437, 0, 0, 1.334], "8674": [-0.064, 0.437, 0, 0, 1.334], "8705": [0, 0.825, 0, 0, 0.5], "8708": [0, 0.68889, 0, 0, 0.55556], "8709": [0.08167, 0.58167, 0, 0, 0.77778], "8717": [0, 0.43056, 0, 0, 0.42917], "8722": [-0.03598, 0.46402, 0, 0, 0.5], "8724": [0.08198, 0.69224, 0, 0, 0.77778], "8726": [0.08167, 0.58167, 0, 0, 0.77778], "8733": [0, 0.69224, 0, 0, 0.77778], "8736": [0, 0.69224, 0, 0, 0.72222], "8737": [0, 0.69224, 0, 0, 0.72222], "8738": [0.03517, 0.52239, 0, 0, 0.72222], "8739": [0.08167, 0.58167, 0, 0, 0.22222], "8740": [0.25142, 0.74111, 0, 0, 0.27778], "8741": [0.08167, 0.58167, 0, 0, 0.38889], "8742": [0.25142, 0.74111, 0, 0, 0.5], "8756": [0, 0.69224, 0, 0, 0.66667], "8757": [0, 0.69224, 0, 0, 0.66667], "8764": [-0.13313, 0.36687, 0, 0, 0.77778], "8765": [-0.13313, 0.37788, 0, 0, 0.77778], "8769": [-0.13313, 0.36687, 0, 0, 0.77778], "8770": [-0.03625, 0.46375, 0, 0, 0.77778], "8774": [0.30274, 0.79383, 0, 0, 0.77778], "8776": [-0.01688, 0.48312, 0, 0, 0.77778], "8778": [0.08167, 0.58167, 0, 0, 0.77778], "8782": [0.06062, 0.54986, 0, 0, 0.77778], "8783": [0.06062, 0.54986, 0, 0, 0.77778], "8785": [0.08198, 0.58198, 0, 0, 0.77778], "8786": [0.08198, 0.58198, 0, 0, 0.77778], "8787": [0.08198, 0.58198, 0, 0, 0.77778], "8790": [0, 0.69224, 0, 0, 0.77778], "8791": [0.22958, 0.72958, 0, 0, 0.77778], "8796": [0.08198, 0.91667, 0, 0, 0.77778], "8806": [0.25583, 0.75583, 0, 0, 0.77778], "8807": [0.25583, 0.75583, 0, 0, 0.77778], "8808": [0.25142, 0.75726, 0, 0, 0.77778], "8809": [0.25142, 0.75726, 0, 0, 0.77778], "8812": [0.25583, 0.75583, 0, 0, 0.5], "8814": [0.20576, 0.70576, 0, 0, 0.77778], "8815": [0.20576, 0.70576, 0, 0, 0.77778], "8816": [0.30274, 0.79383, 0, 0, 0.77778], "8817": [0.30274, 0.79383, 0, 0, 0.77778], "8818": [0.22958, 0.72958, 0, 0, 0.77778], "8819": [0.22958, 0.72958, 0, 0, 0.77778], "8822": [0.1808, 0.675, 0, 0, 0.77778], "8823": [0.1808, 0.675, 0, 0, 0.77778], "8828": [0.13667, 0.63667, 0, 0, 0.77778], "8829": [0.13667, 0.63667, 0, 0, 0.77778], "8830": [0.22958, 0.72958, 0, 0, 0.77778], "8831": [0.22958, 0.72958, 0, 0, 0.77778], "8832": [0.20576, 0.70576, 0, 0, 0.77778], "8833": [0.20576, 0.70576, 0, 0, 0.77778], "8840": [0.30274, 0.79383, 0, 0, 0.77778], "8841": [0.30274, 0.79383, 0, 0, 0.77778], "8842": [0.13597, 0.63597, 0, 0, 0.77778], "8843": [0.13597, 0.63597, 0, 0, 0.77778], "8847": [0.03517, 0.54986, 0, 0, 0.77778], "8848": [0.03517, 0.54986, 0, 0, 0.77778], "8858": [0.08198, 0.58198, 0, 0, 0.77778], "8859": [0.08198, 0.58198, 0, 0, 0.77778], "8861": [0.08198, 0.58198, 0, 0, 0.77778], "8862": [0, 0.675, 0, 0, 0.77778], "8863": [0, 0.675, 0, 0, 0.77778], "8864": [0, 0.675, 0, 0, 0.77778], "8865": [0, 0.675, 0, 0, 0.77778], "8872": [0, 0.69224, 0, 0, 0.61111], "8873": [0, 0.69224, 0, 0, 0.72222], "8874": [0, 0.69224, 0, 0, 0.88889], "8876": [0, 0.68889, 0, 0, 0.61111], "8877": [0, 0.68889, 0, 0, 0.61111], "8878": [0, 0.68889, 0, 0, 0.72222], "8879": [0, 0.68889, 0, 0, 0.72222], "8882": [0.03517, 0.54986, 0, 0, 0.77778], "8883": [0.03517, 0.54986, 0, 0, 0.77778], "8884": [0.13667, 0.63667, 0, 0, 0.77778], "8885": [0.13667, 0.63667, 0, 0, 0.77778], "8888": [0, 0.54986, 0, 0, 1.11111], "8890": [0.19444, 0.43056, 0, 0, 0.55556], "8891": [0.19444, 0.69224, 0, 0, 0.61111], "8892": [0.19444, 0.69224, 0, 0, 0.61111], "8901": [0, 0.54986, 0, 0, 0.27778], "8903": [0.08167, 0.58167, 0, 0, 0.77778], "8905": [0.08167, 0.58167, 0, 0, 0.77778], "8906": [0.08167, 0.58167, 0, 0, 0.77778], "8907": [0, 0.69224, 0, 0, 0.77778], "8908": [0, 0.69224, 0, 0, 0.77778], "8909": [-0.03598, 0.46402, 0, 0, 0.77778], "8910": [0, 0.54986, 0, 0, 0.76042], "8911": [0, 0.54986, 0, 0, 0.76042], "8912": [0.03517, 0.54986, 0, 0, 0.77778], "8913": [0.03517, 0.54986, 0, 0, 0.77778], "8914": [0, 0.54986, 0, 0, 0.66667], "8915": [0, 0.54986, 0, 0, 0.66667], "8916": [0, 0.69224, 0, 0, 0.66667], "8918": [0.0391, 0.5391, 0, 0, 0.77778], "8919": [0.0391, 0.5391, 0, 0, 0.77778], "8920": [0.03517, 0.54986, 0, 0, 1.33334], "8921": [0.03517, 0.54986, 0, 0, 1.33334], "8922": [0.38569, 0.88569, 0, 0, 0.77778], "8923": [0.38569, 0.88569, 0, 0, 0.77778], "8926": [0.13667, 0.63667, 0, 0, 0.77778], "8927": [0.13667, 0.63667, 0, 0, 0.77778], "8928": [0.30274, 0.79383, 0, 0, 0.77778], "8929": [0.30274, 0.79383, 0, 0, 0.77778], "8934": [0.23222, 0.74111, 0, 0, 0.77778], "8935": [0.23222, 0.74111, 0, 0, 0.77778], "8936": [0.23222, 0.74111, 0, 0, 0.77778], "8937": [0.23222, 0.74111, 0, 0, 0.77778], "8938": [0.20576, 0.70576, 0, 0, 0.77778], "8939": [0.20576, 0.70576, 0, 0, 0.77778], "8940": [0.30274, 0.79383, 0, 0, 0.77778], "8941": [0.30274, 0.79383, 0, 0, 0.77778], "8994": [0.19444, 0.69224, 0, 0, 0.77778], "8995": [0.19444, 0.69224, 0, 0, 0.77778], "9416": [0.15559, 0.69224, 0, 0, 0.90222], "9484": [0, 0.69224, 0, 0, 0.5], "9488": [0, 0.69224, 0, 0, 0.5], "9492": [0, 0.37788, 0, 0, 0.5], "9496": [0, 0.37788, 0, 0, 0.5], "9585": [0.19444, 0.68889, 0, 0, 0.88889], "9586": [0.19444, 0.74111, 0, 0, 0.88889], "9632": [0, 0.675, 0, 0, 0.77778], "9633": [0, 0.675, 0, 0, 0.77778], "9650": [0, 0.54986, 0, 0, 0.72222], "9651": [0, 0.54986, 0, 0, 0.72222], "9654": [0.03517, 0.54986, 0, 0, 0.77778], "9660": [0, 0.54986, 0, 0, 0.72222], "9661": [0, 0.54986, 0, 0, 0.72222], "9664": [0.03517, 0.54986, 0, 0, 0.77778], "9674": [0.11111, 0.69224, 0, 0, 0.66667], "9733": [0.19444, 0.69224, 0, 0, 0.94445], "10003": [0, 0.69224, 0, 0, 0.83334], "10016": [0, 0.69224, 0, 0, 0.83334], "10731": [0.11111, 0.69224, 0, 0, 0.66667], "10846": [0.19444, 0.75583, 0, 0, 0.61111], "10877": [0.13667, 0.63667, 0, 0, 0.77778], "10878": [0.13667, 0.63667, 0, 0, 0.77778], "10885": [0.25583, 0.75583, 0, 0, 0.77778], "10886": [0.25583, 0.75583, 0, 0, 0.77778], "10887": [0.13597, 0.63597, 0, 0, 0.77778], "10888": [0.13597, 0.63597, 0, 0, 0.77778], "10889": [0.26167, 0.75726, 0, 0, 0.77778], "10890": [0.26167, 0.75726, 0, 0, 0.77778], "10891": [0.48256, 0.98256, 0, 0, 0.77778], "10892": [0.48256, 0.98256, 0, 0, 0.77778], "10901": [0.13667, 0.63667, 0, 0, 0.77778], "10902": [0.13667, 0.63667, 0, 0, 0.77778], "10933": [0.25142, 0.75726, 0, 0, 0.77778], "10934": [0.25142, 0.75726, 0, 0, 0.77778], "10935": [0.26167, 0.75726, 0, 0, 0.77778], "10936": [0.26167, 0.75726, 0, 0, 0.77778], "10937": [0.26167, 0.75726, 0, 0, 0.77778], "10938": [0.26167, 0.75726, 0, 0, 0.77778], "10949": [0.25583, 0.75583, 0, 0, 0.77778], "10950": [0.25583, 0.75583, 0, 0, 0.77778], "10955": [0.28481, 0.79383, 0, 0, 0.77778], "10956": [0.28481, 0.79383, 0, 0, 0.77778], "57350": [0.08167, 0.58167, 0, 0, 0.22222], "57351": [0.08167, 0.58167, 0, 0, 0.38889], "57352": [0.08167, 0.58167, 0, 0, 0.77778], "57353": [0, 0.43056, 0.04028, 0, 0.66667], "57356": [0.25142, 0.75726, 0, 0, 0.77778], "57357": [0.25142, 0.75726, 0, 0, 0.77778], "57358": [0.41951, 0.91951, 0, 0, 0.77778], "57359": [0.30274, 0.79383, 0, 0, 0.77778], "57360": [0.30274, 0.79383, 0, 0, 0.77778], "57361": [0.41951, 0.91951, 0, 0, 0.77778], "57366": [0.25142, 0.75726, 0, 0, 0.77778], "57367": [0.25142, 0.75726, 0, 0, 0.77778], "57368": [0.25142, 0.75726, 0, 0, 0.77778], "57369": [0.25142, 0.75726, 0, 0, 0.77778], "57370": [0.13597, 0.63597, 0, 0, 0.77778], "57371": [0.13597, 0.63597, 0, 0, 0.77778] }, "Caligraphic-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.68333, 0, 0.19445, 0.79847], "66": [0, 0.68333, 0.03041, 0.13889, 0.65681], "67": [0, 0.68333, 0.05834, 0.13889, 0.52653], "68": [0, 0.68333, 0.02778, 0.08334, 0.77139], "69": [0, 0.68333, 0.08944, 0.11111, 0.52778], "70": [0, 0.68333, 0.09931, 0.11111, 0.71875], "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], "72": [0, 0.68333, 0.00965, 0.11111, 0.84452], "73": [0, 0.68333, 0.07382, 0, 0.54452], "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], "75": [0, 0.68333, 0.01445, 0.05556, 0.76195], "76": [0, 0.68333, 0, 0.13889, 0.68972], "77": [0, 0.68333, 0, 0.13889, 1.2009], "78": [0, 0.68333, 0.14736, 0.08334, 0.82049], "79": [0, 0.68333, 0.02778, 0.11111, 0.79611], "80": [0, 0.68333, 0.08222, 0.08334, 0.69556], "81": [0.09722, 0.68333, 0, 0.11111, 0.81667], "82": [0, 0.68333, 0, 0.08334, 0.8475], "83": [0, 0.68333, 0.075, 0.13889, 0.60556], "84": [0, 0.68333, 0.25417, 0, 0.54464], "85": [0, 0.68333, 0.09931, 0.08334, 0.62583], "86": [0, 0.68333, 0.08222, 0, 0.61278], "87": [0, 0.68333, 0.08222, 0.08334, 0.98778], "88": [0, 0.68333, 0.14643, 0.13889, 0.7133], "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], "90": [0, 0.68333, 0.07944, 0.13889, 0.72473], "160": [0, 0, 0, 0, 0.25] }, "Fraktur-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69141, 0, 0, 0.29574], "34": [0, 0.69141, 0, 0, 0.21471], "38": [0, 0.69141, 0, 0, 0.73786], "39": [0, 0.69141, 0, 0, 0.21201], "40": [0.24982, 0.74947, 0, 0, 0.38865], "41": [0.24982, 0.74947, 0, 0, 0.38865], "42": [0, 0.62119, 0, 0, 0.27764], "43": [0.08319, 0.58283, 0, 0, 0.75623], "44": [0, 0.10803, 0, 0, 0.27764], "45": [0.08319, 0.58283, 0, 0, 0.75623], "46": [0, 0.10803, 0, 0, 0.27764], "47": [0.24982, 0.74947, 0, 0, 0.50181], "48": [0, 0.47534, 0, 0, 0.50181], "49": [0, 0.47534, 0, 0, 0.50181], "50": [0, 0.47534, 0, 0, 0.50181], "51": [0.18906, 0.47534, 0, 0, 0.50181], "52": [0.18906, 0.47534, 0, 0, 0.50181], "53": [0.18906, 0.47534, 0, 0, 0.50181], "54": [0, 0.69141, 0, 0, 0.50181], "55": [0.18906, 0.47534, 0, 0, 0.50181], "56": [0, 0.69141, 0, 0, 0.50181], "57": [0.18906, 0.47534, 0, 0, 0.50181], "58": [0, 0.47534, 0, 0, 0.21606], "59": [0.12604, 0.47534, 0, 0, 0.21606], "61": [-0.13099, 0.36866, 0, 0, 0.75623], "63": [0, 0.69141, 0, 0, 0.36245], "65": [0, 0.69141, 0, 0, 0.7176], "66": [0, 0.69141, 0, 0, 0.88397], "67": [0, 0.69141, 0, 0, 0.61254], "68": [0, 0.69141, 0, 0, 0.83158], "69": [0, 0.69141, 0, 0, 0.66278], "70": [0.12604, 0.69141, 0, 0, 0.61119], "71": [0, 0.69141, 0, 0, 0.78539], "72": [0.06302, 0.69141, 0, 0, 0.7203], "73": [0, 0.69141, 0, 0, 0.55448], "74": [0.12604, 0.69141, 0, 0, 0.55231], "75": [0, 0.69141, 0, 0, 0.66845], "76": [0, 0.69141, 0, 0, 0.66602], "77": [0, 0.69141, 0, 0, 1.04953], "78": [0, 0.69141, 0, 0, 0.83212], "79": [0, 0.69141, 0, 0, 0.82699], "80": [0.18906, 0.69141, 0, 0, 0.82753], "81": [0.03781, 0.69141, 0, 0, 0.82699], "82": [0, 0.69141, 0, 0, 0.82807], "83": [0, 0.69141, 0, 0, 0.82861], "84": [0, 0.69141, 0, 0, 0.66899], "85": [0, 0.69141, 0, 0, 0.64576], "86": [0, 0.69141, 0, 0, 0.83131], "87": [0, 0.69141, 0, 0, 1.04602], "88": [0, 0.69141, 0, 0, 0.71922], "89": [0.18906, 0.69141, 0, 0, 0.83293], "90": [0.12604, 0.69141, 0, 0, 0.60201], "91": [0.24982, 0.74947, 0, 0, 0.27764], "93": [0.24982, 0.74947, 0, 0, 0.27764], "94": [0, 0.69141, 0, 0, 0.49965], "97": [0, 0.47534, 0, 0, 0.50046], "98": [0, 0.69141, 0, 0, 0.51315], "99": [0, 0.47534, 0, 0, 0.38946], "100": [0, 0.62119, 0, 0, 0.49857], "101": [0, 0.47534, 0, 0, 0.40053], "102": [0.18906, 0.69141, 0, 0, 0.32626], "103": [0.18906, 0.47534, 0, 0, 0.5037], "104": [0.18906, 0.69141, 0, 0, 0.52126], "105": [0, 0.69141, 0, 0, 0.27899], "106": [0, 0.69141, 0, 0, 0.28088], "107": [0, 0.69141, 0, 0, 0.38946], "108": [0, 0.69141, 0, 0, 0.27953], "109": [0, 0.47534, 0, 0, 0.76676], "110": [0, 0.47534, 0, 0, 0.52666], "111": [0, 0.47534, 0, 0, 0.48885], "112": [0.18906, 0.52396, 0, 0, 0.50046], "113": [0.18906, 0.47534, 0, 0, 0.48912], "114": [0, 0.47534, 0, 0, 0.38919], "115": [0, 0.47534, 0, 0, 0.44266], "116": [0, 0.62119, 0, 0, 0.33301], "117": [0, 0.47534, 0, 0, 0.5172], "118": [0, 0.52396, 0, 0, 0.5118], "119": [0, 0.52396, 0, 0, 0.77351], "120": [0.18906, 0.47534, 0, 0, 0.38865], "121": [0.18906, 0.47534, 0, 0, 0.49884], "122": [0.18906, 0.47534, 0, 0, 0.39054], "160": [0, 0, 0, 0, 0.25], "8216": [0, 0.69141, 0, 0, 0.21471], "8217": [0, 0.69141, 0, 0, 0.21471], "58112": [0, 0.62119, 0, 0, 0.49749], "58113": [0, 0.62119, 0, 0, 0.4983], "58114": [0.18906, 0.69141, 0, 0, 0.33328], "58115": [0.18906, 0.69141, 0, 0, 0.32923], "58116": [0.18906, 0.47534, 0, 0, 0.50343], "58117": [0, 0.69141, 0, 0, 0.33301], "58118": [0, 0.62119, 0, 0, 0.33409], "58119": [0, 0.47534, 0, 0, 0.50073] }, "Main-Bold": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.35], "34": [0, 0.69444, 0, 0, 0.60278], "35": [0.19444, 0.69444, 0, 0, 0.95833], "36": [0.05556, 0.75, 0, 0, 0.575], "37": [0.05556, 0.75, 0, 0, 0.95833], "38": [0, 0.69444, 0, 0, 0.89444], "39": [0, 0.69444, 0, 0, 0.31944], "40": [0.25, 0.75, 0, 0, 0.44722], "41": [0.25, 0.75, 0, 0, 0.44722], "42": [0, 0.75, 0, 0, 0.575], "43": [0.13333, 0.63333, 0, 0, 0.89444], "44": [0.19444, 0.15556, 0, 0, 0.31944], "45": [0, 0.44444, 0, 0, 0.38333], "46": [0, 0.15556, 0, 0, 0.31944], "47": [0.25, 0.75, 0, 0, 0.575], "48": [0, 0.64444, 0, 0, 0.575], "49": [0, 0.64444, 0, 0, 0.575], "50": [0, 0.64444, 0, 0, 0.575], "51": [0, 0.64444, 0, 0, 0.575], "52": [0, 0.64444, 0, 0, 0.575], "53": [0, 0.64444, 0, 0, 0.575], "54": [0, 0.64444, 0, 0, 0.575], "55": [0, 0.64444, 0, 0, 0.575], "56": [0, 0.64444, 0, 0, 0.575], "57": [0, 0.64444, 0, 0, 0.575], "58": [0, 0.44444, 0, 0, 0.31944], "59": [0.19444, 0.44444, 0, 0, 0.31944], "60": [0.08556, 0.58556, 0, 0, 0.89444], "61": [-0.10889, 0.39111, 0, 0, 0.89444], "62": [0.08556, 0.58556, 0, 0, 0.89444], "63": [0, 0.69444, 0, 0, 0.54305], "64": [0, 0.69444, 0, 0, 0.89444], "65": [0, 0.68611, 0, 0, 0.86944], "66": [0, 0.68611, 0, 0, 0.81805], "67": [0, 0.68611, 0, 0, 0.83055], "68": [0, 0.68611, 0, 0, 0.88194], "69": [0, 0.68611, 0, 0, 0.75555], "70": [0, 0.68611, 0, 0, 0.72361], "71": [0, 0.68611, 0, 0, 0.90416], "72": [0, 0.68611, 0, 0, 0.9], "73": [0, 0.68611, 0, 0, 0.43611], "74": [0, 0.68611, 0, 0, 0.59444], "75": [0, 0.68611, 0, 0, 0.90138], "76": [0, 0.68611, 0, 0, 0.69166], "77": [0, 0.68611, 0, 0, 1.09166], "78": [0, 0.68611, 0, 0, 0.9], "79": [0, 0.68611, 0, 0, 0.86388], "80": [0, 0.68611, 0, 0, 0.78611], "81": [0.19444, 0.68611, 0, 0, 0.86388], "82": [0, 0.68611, 0, 0, 0.8625], "83": [0, 0.68611, 0, 0, 0.63889], "84": [0, 0.68611, 0, 0, 0.8], "85": [0, 0.68611, 0, 0, 0.88472], "86": [0, 0.68611, 0.01597, 0, 0.86944], "87": [0, 0.68611, 0.01597, 0, 1.18888], "88": [0, 0.68611, 0, 0, 0.86944], "89": [0, 0.68611, 0.02875, 0, 0.86944], "90": [0, 0.68611, 0, 0, 0.70277], "91": [0.25, 0.75, 0, 0, 0.31944], "92": [0.25, 0.75, 0, 0, 0.575], "93": [0.25, 0.75, 0, 0, 0.31944], "94": [0, 0.69444, 0, 0, 0.575], "95": [0.31, 0.13444, 0.03194, 0, 0.575], "97": [0, 0.44444, 0, 0, 0.55902], "98": [0, 0.69444, 0, 0, 0.63889], "99": [0, 0.44444, 0, 0, 0.51111], "100": [0, 0.69444, 0, 0, 0.63889], "101": [0, 0.44444, 0, 0, 0.52708], "102": [0, 0.69444, 0.10903, 0, 0.35139], "103": [0.19444, 0.44444, 0.01597, 0, 0.575], "104": [0, 0.69444, 0, 0, 0.63889], "105": [0, 0.69444, 0, 0, 0.31944], "106": [0.19444, 0.69444, 0, 0, 0.35139], "107": [0, 0.69444, 0, 0, 0.60694], "108": [0, 0.69444, 0, 0, 0.31944], "109": [0, 0.44444, 0, 0, 0.95833], "110": [0, 0.44444, 0, 0, 0.63889], "111": [0, 0.44444, 0, 0, 0.575], "112": [0.19444, 0.44444, 0, 0, 0.63889], "113": [0.19444, 0.44444, 0, 0, 0.60694], "114": [0, 0.44444, 0, 0, 0.47361], "115": [0, 0.44444, 0, 0, 0.45361], "116": [0, 0.63492, 0, 0, 0.44722], "117": [0, 0.44444, 0, 0, 0.63889], "118": [0, 0.44444, 0.01597, 0, 0.60694], "119": [0, 0.44444, 0.01597, 0, 0.83055], "120": [0, 0.44444, 0, 0, 0.60694], "121": [0.19444, 0.44444, 0.01597, 0, 0.60694], "122": [0, 0.44444, 0, 0, 0.51111], "123": [0.25, 0.75, 0, 0, 0.575], "124": [0.25, 0.75, 0, 0, 0.31944], "125": [0.25, 0.75, 0, 0, 0.575], "126": [0.35, 0.34444, 0, 0, 0.575], "160": [0, 0, 0, 0, 0.25], "163": [0, 0.69444, 0, 0, 0.86853], "168": [0, 0.69444, 0, 0, 0.575], "172": [0, 0.44444, 0, 0, 0.76666], "176": [0, 0.69444, 0, 0, 0.86944], "177": [0.13333, 0.63333, 0, 0, 0.89444], "184": [0.17014, 0, 0, 0, 0.51111], "198": [0, 0.68611, 0, 0, 1.04166], "215": [0.13333, 0.63333, 0, 0, 0.89444], "216": [0.04861, 0.73472, 0, 0, 0.89444], "223": [0, 0.69444, 0, 0, 0.59722], "230": [0, 0.44444, 0, 0, 0.83055], "247": [0.13333, 0.63333, 0, 0, 0.89444], "248": [0.09722, 0.54167, 0, 0, 0.575], "305": [0, 0.44444, 0, 0, 0.31944], "338": [0, 0.68611, 0, 0, 1.16944], "339": [0, 0.44444, 0, 0, 0.89444], "567": [0.19444, 0.44444, 0, 0, 0.35139], "710": [0, 0.69444, 0, 0, 0.575], "711": [0, 0.63194, 0, 0, 0.575], "713": [0, 0.59611, 0, 0, 0.575], "714": [0, 0.69444, 0, 0, 0.575], "715": [0, 0.69444, 0, 0, 0.575], "728": [0, 0.69444, 0, 0, 0.575], "729": [0, 0.69444, 0, 0, 0.31944], "730": [0, 0.69444, 0, 0, 0.86944], "732": [0, 0.69444, 0, 0, 0.575], "733": [0, 0.69444, 0, 0, 0.575], "915": [0, 0.68611, 0, 0, 0.69166], "916": [0, 0.68611, 0, 0, 0.95833], "920": [0, 0.68611, 0, 0, 0.89444], "923": [0, 0.68611, 0, 0, 0.80555], "926": [0, 0.68611, 0, 0, 0.76666], "928": [0, 0.68611, 0, 0, 0.9], "931": [0, 0.68611, 0, 0, 0.83055], "933": [0, 0.68611, 0, 0, 0.89444], "934": [0, 0.68611, 0, 0, 0.83055], "936": [0, 0.68611, 0, 0, 0.89444], "937": [0, 0.68611, 0, 0, 0.83055], "8211": [0, 0.44444, 0.03194, 0, 0.575], "8212": [0, 0.44444, 0.03194, 0, 1.14999], "8216": [0, 0.69444, 0, 0, 0.31944], "8217": [0, 0.69444, 0, 0, 0.31944], "8220": [0, 0.69444, 0, 0, 0.60278], "8221": [0, 0.69444, 0, 0, 0.60278], "8224": [0.19444, 0.69444, 0, 0, 0.51111], "8225": [0.19444, 0.69444, 0, 0, 0.51111], "8242": [0, 0.55556, 0, 0, 0.34444], "8407": [0, 0.72444, 0.15486, 0, 0.575], "8463": [0, 0.69444, 0, 0, 0.66759], "8465": [0, 0.69444, 0, 0, 0.83055], "8467": [0, 0.69444, 0, 0, 0.47361], "8472": [0.19444, 0.44444, 0, 0, 0.74027], "8476": [0, 0.69444, 0, 0, 0.83055], "8501": [0, 0.69444, 0, 0, 0.70277], "8592": [-0.10889, 0.39111, 0, 0, 1.14999], "8593": [0.19444, 0.69444, 0, 0, 0.575], "8594": [-0.10889, 0.39111, 0, 0, 1.14999], "8595": [0.19444, 0.69444, 0, 0, 0.575], "8596": [-0.10889, 0.39111, 0, 0, 1.14999], "8597": [0.25, 0.75, 0, 0, 0.575], "8598": [0.19444, 0.69444, 0, 0, 1.14999], "8599": [0.19444, 0.69444, 0, 0, 1.14999], "8600": [0.19444, 0.69444, 0, 0, 1.14999], "8601": [0.19444, 0.69444, 0, 0, 1.14999], "8636": [-0.10889, 0.39111, 0, 0, 1.14999], "8637": [-0.10889, 0.39111, 0, 0, 1.14999], "8640": [-0.10889, 0.39111, 0, 0, 1.14999], "8641": [-0.10889, 0.39111, 0, 0, 1.14999], "8656": [-0.10889, 0.39111, 0, 0, 1.14999], "8657": [0.19444, 0.69444, 0, 0, 0.70277], "8658": [-0.10889, 0.39111, 0, 0, 1.14999], "8659": [0.19444, 0.69444, 0, 0, 0.70277], "8660": [-0.10889, 0.39111, 0, 0, 1.14999], "8661": [0.25, 0.75, 0, 0, 0.70277], "8704": [0, 0.69444, 0, 0, 0.63889], "8706": [0, 0.69444, 0.06389, 0, 0.62847], "8707": [0, 0.69444, 0, 0, 0.63889], "8709": [0.05556, 0.75, 0, 0, 0.575], "8711": [0, 0.68611, 0, 0, 0.95833], "8712": [0.08556, 0.58556, 0, 0, 0.76666], "8715": [0.08556, 0.58556, 0, 0, 0.76666], "8722": [0.13333, 0.63333, 0, 0, 0.89444], "8723": [0.13333, 0.63333, 0, 0, 0.89444], "8725": [0.25, 0.75, 0, 0, 0.575], "8726": [0.25, 0.75, 0, 0, 0.575], "8727": [-0.02778, 0.47222, 0, 0, 0.575], "8728": [-0.02639, 0.47361, 0, 0, 0.575], "8729": [-0.02639, 0.47361, 0, 0, 0.575], "8730": [0.18, 0.82, 0, 0, 0.95833], "8733": [0, 0.44444, 0, 0, 0.89444], "8734": [0, 0.44444, 0, 0, 1.14999], "8736": [0, 0.69224, 0, 0, 0.72222], "8739": [0.25, 0.75, 0, 0, 0.31944], "8741": [0.25, 0.75, 0, 0, 0.575], "8743": [0, 0.55556, 0, 0, 0.76666], "8744": [0, 0.55556, 0, 0, 0.76666], "8745": [0, 0.55556, 0, 0, 0.76666], "8746": [0, 0.55556, 0, 0, 0.76666], "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875], "8764": [-0.10889, 0.39111, 0, 0, 0.89444], "8768": [0.19444, 0.69444, 0, 0, 0.31944], "8771": [0.00222, 0.50222, 0, 0, 0.89444], "8776": [0.02444, 0.52444, 0, 0, 0.89444], "8781": [0.00222, 0.50222, 0, 0, 0.89444], "8801": [0.00222, 0.50222, 0, 0, 0.89444], "8804": [0.19667, 0.69667, 0, 0, 0.89444], "8805": [0.19667, 0.69667, 0, 0, 0.89444], "8810": [0.08556, 0.58556, 0, 0, 1.14999], "8811": [0.08556, 0.58556, 0, 0, 1.14999], "8826": [0.08556, 0.58556, 0, 0, 0.89444], "8827": [0.08556, 0.58556, 0, 0, 0.89444], "8834": [0.08556, 0.58556, 0, 0, 0.89444], "8835": [0.08556, 0.58556, 0, 0, 0.89444], "8838": [0.19667, 0.69667, 0, 0, 0.89444], "8839": [0.19667, 0.69667, 0, 0, 0.89444], "8846": [0, 0.55556, 0, 0, 0.76666], "8849": [0.19667, 0.69667, 0, 0, 0.89444], "8850": [0.19667, 0.69667, 0, 0, 0.89444], "8851": [0, 0.55556, 0, 0, 0.76666], "8852": [0, 0.55556, 0, 0, 0.76666], "8853": [0.13333, 0.63333, 0, 0, 0.89444], "8854": [0.13333, 0.63333, 0, 0, 0.89444], "8855": [0.13333, 0.63333, 0, 0, 0.89444], "8856": [0.13333, 0.63333, 0, 0, 0.89444], "8857": [0.13333, 0.63333, 0, 0, 0.89444], "8866": [0, 0.69444, 0, 0, 0.70277], "8867": [0, 0.69444, 0, 0, 0.70277], "8868": [0, 0.69444, 0, 0, 0.89444], "8869": [0, 0.69444, 0, 0, 0.89444], "8900": [-0.02639, 0.47361, 0, 0, 0.575], "8901": [-0.02639, 0.47361, 0, 0, 0.31944], "8902": [-0.02778, 0.47222, 0, 0, 0.575], "8968": [0.25, 0.75, 0, 0, 0.51111], "8969": [0.25, 0.75, 0, 0, 0.51111], "8970": [0.25, 0.75, 0, 0, 0.51111], "8971": [0.25, 0.75, 0, 0, 0.51111], "8994": [-0.13889, 0.36111, 0, 0, 1.14999], "8995": [-0.13889, 0.36111, 0, 0, 1.14999], "9651": [0.19444, 0.69444, 0, 0, 1.02222], "9657": [-0.02778, 0.47222, 0, 0, 0.575], "9661": [0.19444, 0.69444, 0, 0, 1.02222], "9667": [-0.02778, 0.47222, 0, 0, 0.575], "9711": [0.19444, 0.69444, 0, 0, 1.14999], "9824": [0.12963, 0.69444, 0, 0, 0.89444], "9825": [0.12963, 0.69444, 0, 0, 0.89444], "9826": [0.12963, 0.69444, 0, 0, 0.89444], "9827": [0.12963, 0.69444, 0, 0, 0.89444], "9837": [0, 0.75, 0, 0, 0.44722], "9838": [0.19444, 0.69444, 0, 0, 0.44722], "9839": [0.19444, 0.69444, 0, 0, 0.44722], "10216": [0.25, 0.75, 0, 0, 0.44722], "10217": [0.25, 0.75, 0, 0, 0.44722], "10815": [0, 0.68611, 0, 0, 0.9], "10927": [0.19667, 0.69667, 0, 0, 0.89444], "10928": [0.19667, 0.69667, 0, 0, 0.89444], "57376": [0.19444, 0.69444, 0, 0, 0] }, "Main-BoldItalic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.11417, 0, 0.38611], "34": [0, 0.69444, 0.07939, 0, 0.62055], "35": [0.19444, 0.69444, 0.06833, 0, 0.94444], "37": [0.05556, 0.75, 0.12861, 0, 0.94444], "38": [0, 0.69444, 0.08528, 0, 0.88555], "39": [0, 0.69444, 0.12945, 0, 0.35555], "40": [0.25, 0.75, 0.15806, 0, 0.47333], "41": [0.25, 0.75, 0.03306, 0, 0.47333], "42": [0, 0.75, 0.14333, 0, 0.59111], "43": [0.10333, 0.60333, 0.03306, 0, 0.88555], "44": [0.19444, 0.14722, 0, 0, 0.35555], "45": [0, 0.44444, 0.02611, 0, 0.41444], "46": [0, 0.14722, 0, 0, 0.35555], "47": [0.25, 0.75, 0.15806, 0, 0.59111], "48": [0, 0.64444, 0.13167, 0, 0.59111], "49": [0, 0.64444, 0.13167, 0, 0.59111], "50": [0, 0.64444, 0.13167, 0, 0.59111], "51": [0, 0.64444, 0.13167, 0, 0.59111], "52": [0.19444, 0.64444, 0.13167, 0, 0.59111], "53": [0, 0.64444, 0.13167, 0, 0.59111], "54": [0, 0.64444, 0.13167, 0, 0.59111], "55": [0.19444, 0.64444, 0.13167, 0, 0.59111], "56": [0, 0.64444, 0.13167, 0, 0.59111], "57": [0, 0.64444, 0.13167, 0, 0.59111], "58": [0, 0.44444, 0.06695, 0, 0.35555], "59": [0.19444, 0.44444, 0.06695, 0, 0.35555], "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555], "63": [0, 0.69444, 0.11472, 0, 0.59111], "64": [0, 0.69444, 0.09208, 0, 0.88555], "65": [0, 0.68611, 0, 0, 0.86555], "66": [0, 0.68611, 0.0992, 0, 0.81666], "67": [0, 0.68611, 0.14208, 0, 0.82666], "68": [0, 0.68611, 0.09062, 0, 0.87555], "69": [0, 0.68611, 0.11431, 0, 0.75666], "70": [0, 0.68611, 0.12903, 0, 0.72722], "71": [0, 0.68611, 0.07347, 0, 0.89527], "72": [0, 0.68611, 0.17208, 0, 0.8961], "73": [0, 0.68611, 0.15681, 0, 0.47166], "74": [0, 0.68611, 0.145, 0, 0.61055], "75": [0, 0.68611, 0.14208, 0, 0.89499], "76": [0, 0.68611, 0, 0, 0.69777], "77": [0, 0.68611, 0.17208, 0, 1.07277], "78": [0, 0.68611, 0.17208, 0, 0.8961], "79": [0, 0.68611, 0.09062, 0, 0.85499], "80": [0, 0.68611, 0.0992, 0, 0.78721], "81": [0.19444, 0.68611, 0.09062, 0, 0.85499], "82": [0, 0.68611, 0.02559, 0, 0.85944], "83": [0, 0.68611, 0.11264, 0, 0.64999], "84": [0, 0.68611, 0.12903, 0, 0.7961], "85": [0, 0.68611, 0.17208, 0, 0.88083], "86": [0, 0.68611, 0.18625, 0, 0.86555], "87": [0, 0.68611, 0.18625, 0, 1.15999], "88": [0, 0.68611, 0.15681, 0, 0.86555], "89": [0, 0.68611, 0.19803, 0, 0.86555], "90": [0, 0.68611, 0.14208, 0, 0.70888], "91": [0.25, 0.75, 0.1875, 0, 0.35611], "93": [0.25, 0.75, 0.09972, 0, 0.35611], "94": [0, 0.69444, 0.06709, 0, 0.59111], "95": [0.31, 0.13444, 0.09811, 0, 0.59111], "97": [0, 0.44444, 0.09426, 0, 0.59111], "98": [0, 0.69444, 0.07861, 0, 0.53222], "99": [0, 0.44444, 0.05222, 0, 0.53222], "100": [0, 0.69444, 0.10861, 0, 0.59111], "101": [0, 0.44444, 0.085, 0, 0.53222], "102": [0.19444, 0.69444, 0.21778, 0, 0.4], "103": [0.19444, 0.44444, 0.105, 0, 0.53222], "104": [0, 0.69444, 0.09426, 0, 0.59111], "105": [0, 0.69326, 0.11387, 0, 0.35555], "106": [0.19444, 0.69326, 0.1672, 0, 0.35555], "107": [0, 0.69444, 0.11111, 0, 0.53222], "108": [0, 0.69444, 0.10861, 0, 0.29666], "109": [0, 0.44444, 0.09426, 0, 0.94444], "110": [0, 0.44444, 0.09426, 0, 0.64999], "111": [0, 0.44444, 0.07861, 0, 0.59111], "112": [0.19444, 0.44444, 0.07861, 0, 0.59111], "113": [0.19444, 0.44444, 0.105, 0, 0.53222], "114": [0, 0.44444, 0.11111, 0, 0.50167], "115": [0, 0.44444, 0.08167, 0, 0.48694], "116": [0, 0.63492, 0.09639, 0, 0.385], "117": [0, 0.44444, 0.09426, 0, 0.62055], "118": [0, 0.44444, 0.11111, 0, 0.53222], "119": [0, 0.44444, 0.11111, 0, 0.76777], "120": [0, 0.44444, 0.12583, 0, 0.56055], "121": [0.19444, 0.44444, 0.105, 0, 0.56166], "122": [0, 0.44444, 0.13889, 0, 0.49055], "126": [0.35, 0.34444, 0.11472, 0, 0.59111], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.69444, 0.11473, 0, 0.59111], "176": [0, 0.69444, 0, 0, 0.94888], "184": [0.17014, 0, 0, 0, 0.53222], "198": [0, 0.68611, 0.11431, 0, 1.02277], "216": [0.04861, 0.73472, 0.09062, 0, 0.88555], "223": [0.19444, 0.69444, 0.09736, 0, 0.665], "230": [0, 0.44444, 0.085, 0, 0.82666], "248": [0.09722, 0.54167, 0.09458, 0, 0.59111], "305": [0, 0.44444, 0.09426, 0, 0.35555], "338": [0, 0.68611, 0.11431, 0, 1.14054], "339": [0, 0.44444, 0.085, 0, 0.82666], "567": [0.19444, 0.44444, 0.04611, 0, 0.385], "710": [0, 0.69444, 0.06709, 0, 0.59111], "711": [0, 0.63194, 0.08271, 0, 0.59111], "713": [0, 0.59444, 0.10444, 0, 0.59111], "714": [0, 0.69444, 0.08528, 0, 0.59111], "715": [0, 0.69444, 0, 0, 0.59111], "728": [0, 0.69444, 0.10333, 0, 0.59111], "729": [0, 0.69444, 0.12945, 0, 0.35555], "730": [0, 0.69444, 0, 0, 0.94888], "732": [0, 0.69444, 0.11472, 0, 0.59111], "733": [0, 0.69444, 0.11472, 0, 0.59111], "915": [0, 0.68611, 0.12903, 0, 0.69777], "916": [0, 0.68611, 0, 0, 0.94444], "920": [0, 0.68611, 0.09062, 0, 0.88555], "923": [0, 0.68611, 0, 0, 0.80666], "926": [0, 0.68611, 0.15092, 0, 0.76777], "928": [0, 0.68611, 0.17208, 0, 0.8961], "931": [0, 0.68611, 0.11431, 0, 0.82666], "933": [0, 0.68611, 0.10778, 0, 0.88555], "934": [0, 0.68611, 0.05632, 0, 0.82666], "936": [0, 0.68611, 0.10778, 0, 0.88555], "937": [0, 0.68611, 0.0992, 0, 0.82666], "8211": [0, 0.44444, 0.09811, 0, 0.59111], "8212": [0, 0.44444, 0.09811, 0, 1.18221], "8216": [0, 0.69444, 0.12945, 0, 0.35555], "8217": [0, 0.69444, 0.12945, 0, 0.35555], "8220": [0, 0.69444, 0.16772, 0, 0.62055], "8221": [0, 0.69444, 0.07939, 0, 0.62055] }, "Main-Italic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.12417, 0, 0.30667], "34": [0, 0.69444, 0.06961, 0, 0.51444], "35": [0.19444, 0.69444, 0.06616, 0, 0.81777], "37": [0.05556, 0.75, 0.13639, 0, 0.81777], "38": [0, 0.69444, 0.09694, 0, 0.76666], "39": [0, 0.69444, 0.12417, 0, 0.30667], "40": [0.25, 0.75, 0.16194, 0, 0.40889], "41": [0.25, 0.75, 0.03694, 0, 0.40889], "42": [0, 0.75, 0.14917, 0, 0.51111], "43": [0.05667, 0.56167, 0.03694, 0, 0.76666], "44": [0.19444, 0.10556, 0, 0, 0.30667], "45": [0, 0.43056, 0.02826, 0, 0.35778], "46": [0, 0.10556, 0, 0, 0.30667], "47": [0.25, 0.75, 0.16194, 0, 0.51111], "48": [0, 0.64444, 0.13556, 0, 0.51111], "49": [0, 0.64444, 0.13556, 0, 0.51111], "50": [0, 0.64444, 0.13556, 0, 0.51111], "51": [0, 0.64444, 0.13556, 0, 0.51111], "52": [0.19444, 0.64444, 0.13556, 0, 0.51111], "53": [0, 0.64444, 0.13556, 0, 0.51111], "54": [0, 0.64444, 0.13556, 0, 0.51111], "55": [0.19444, 0.64444, 0.13556, 0, 0.51111], "56": [0, 0.64444, 0.13556, 0, 0.51111], "57": [0, 0.64444, 0.13556, 0, 0.51111], "58": [0, 0.43056, 0.0582, 0, 0.30667], "59": [0.19444, 0.43056, 0.0582, 0, 0.30667], "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666], "63": [0, 0.69444, 0.1225, 0, 0.51111], "64": [0, 0.69444, 0.09597, 0, 0.76666], "65": [0, 0.68333, 0, 0, 0.74333], "66": [0, 0.68333, 0.10257, 0, 0.70389], "67": [0, 0.68333, 0.14528, 0, 0.71555], "68": [0, 0.68333, 0.09403, 0, 0.755], "69": [0, 0.68333, 0.12028, 0, 0.67833], "70": [0, 0.68333, 0.13305, 0, 0.65277], "71": [0, 0.68333, 0.08722, 0, 0.77361], "72": [0, 0.68333, 0.16389, 0, 0.74333], "73": [0, 0.68333, 0.15806, 0, 0.38555], "74": [0, 0.68333, 0.14028, 0, 0.525], "75": [0, 0.68333, 0.14528, 0, 0.76888], "76": [0, 0.68333, 0, 0, 0.62722], "77": [0, 0.68333, 0.16389, 0, 0.89666], "78": [0, 0.68333, 0.16389, 0, 0.74333], "79": [0, 0.68333, 0.09403, 0, 0.76666], "80": [0, 0.68333, 0.10257, 0, 0.67833], "81": [0.19444, 0.68333, 0.09403, 0, 0.76666], "82": [0, 0.68333, 0.03868, 0, 0.72944], "83": [0, 0.68333, 0.11972, 0, 0.56222], "84": [0, 0.68333, 0.13305, 0, 0.71555], "85": [0, 0.68333, 0.16389, 0, 0.74333], "86": [0, 0.68333, 0.18361, 0, 0.74333], "87": [0, 0.68333, 0.18361, 0, 0.99888], "88": [0, 0.68333, 0.15806, 0, 0.74333], "89": [0, 0.68333, 0.19383, 0, 0.74333], "90": [0, 0.68333, 0.14528, 0, 0.61333], "91": [0.25, 0.75, 0.1875, 0, 0.30667], "93": [0.25, 0.75, 0.10528, 0, 0.30667], "94": [0, 0.69444, 0.06646, 0, 0.51111], "95": [0.31, 0.12056, 0.09208, 0, 0.51111], "97": [0, 0.43056, 0.07671, 0, 0.51111], "98": [0, 0.69444, 0.06312, 0, 0.46], "99": [0, 0.43056, 0.05653, 0, 0.46], "100": [0, 0.69444, 0.10333, 0, 0.51111], "101": [0, 0.43056, 0.07514, 0, 0.46], "102": [0.19444, 0.69444, 0.21194, 0, 0.30667], "103": [0.19444, 0.43056, 0.08847, 0, 0.46], "104": [0, 0.69444, 0.07671, 0, 0.51111], "105": [0, 0.65536, 0.1019, 0, 0.30667], "106": [0.19444, 0.65536, 0.14467, 0, 0.30667], "107": [0, 0.69444, 0.10764, 0, 0.46], "108": [0, 0.69444, 0.10333, 0, 0.25555], "109": [0, 0.43056, 0.07671, 0, 0.81777], "110": [0, 0.43056, 0.07671, 0, 0.56222], "111": [0, 0.43056, 0.06312, 0, 0.51111], "112": [0.19444, 0.43056, 0.06312, 0, 0.51111], "113": [0.19444, 0.43056, 0.08847, 0, 0.46], "114": [0, 0.43056, 0.10764, 0, 0.42166], "115": [0, 0.43056, 0.08208, 0, 0.40889], "116": [0, 0.61508, 0.09486, 0, 0.33222], "117": [0, 0.43056, 0.07671, 0, 0.53666], "118": [0, 0.43056, 0.10764, 0, 0.46], "119": [0, 0.43056, 0.10764, 0, 0.66444], "120": [0, 0.43056, 0.12042, 0, 0.46389], "121": [0.19444, 0.43056, 0.08847, 0, 0.48555], "122": [0, 0.43056, 0.12292, 0, 0.40889], "126": [0.35, 0.31786, 0.11585, 0, 0.51111], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.66786, 0.10474, 0, 0.51111], "176": [0, 0.69444, 0, 0, 0.83129], "184": [0.17014, 0, 0, 0, 0.46], "198": [0, 0.68333, 0.12028, 0, 0.88277], "216": [0.04861, 0.73194, 0.09403, 0, 0.76666], "223": [0.19444, 0.69444, 0.10514, 0, 0.53666], "230": [0, 0.43056, 0.07514, 0, 0.71555], "248": [0.09722, 0.52778, 0.09194, 0, 0.51111], "338": [0, 0.68333, 0.12028, 0, 0.98499], "339": [0, 0.43056, 0.07514, 0, 0.71555], "710": [0, 0.69444, 0.06646, 0, 0.51111], "711": [0, 0.62847, 0.08295, 0, 0.51111], "713": [0, 0.56167, 0.10333, 0, 0.51111], "714": [0, 0.69444, 0.09694, 0, 0.51111], "715": [0, 0.69444, 0, 0, 0.51111], "728": [0, 0.69444, 0.10806, 0, 0.51111], "729": [0, 0.66786, 0.11752, 0, 0.30667], "730": [0, 0.69444, 0, 0, 0.83129], "732": [0, 0.66786, 0.11585, 0, 0.51111], "733": [0, 0.69444, 0.1225, 0, 0.51111], "915": [0, 0.68333, 0.13305, 0, 0.62722], "916": [0, 0.68333, 0, 0, 0.81777], "920": [0, 0.68333, 0.09403, 0, 0.76666], "923": [0, 0.68333, 0, 0, 0.69222], "926": [0, 0.68333, 0.15294, 0, 0.66444], "928": [0, 0.68333, 0.16389, 0, 0.74333], "931": [0, 0.68333, 0.12028, 0, 0.71555], "933": [0, 0.68333, 0.11111, 0, 0.76666], "934": [0, 0.68333, 0.05986, 0, 0.71555], "936": [0, 0.68333, 0.11111, 0, 0.76666], "937": [0, 0.68333, 0.10257, 0, 0.71555], "8211": [0, 0.43056, 0.09208, 0, 0.51111], "8212": [0, 0.43056, 0.09208, 0, 1.02222], "8216": [0, 0.69444, 0.12417, 0, 0.30667], "8217": [0, 0.69444, 0.12417, 0, 0.30667], "8220": [0, 0.69444, 0.1685, 0, 0.51444], "8221": [0, 0.69444, 0.06961, 0, 0.51444], "8463": [0, 0.68889, 0, 0, 0.54028] }, "Main-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.27778], "34": [0, 0.69444, 0, 0, 0.5], "35": [0.19444, 0.69444, 0, 0, 0.83334], "36": [0.05556, 0.75, 0, 0, 0.5], "37": [0.05556, 0.75, 0, 0, 0.83334], "38": [0, 0.69444, 0, 0, 0.77778], "39": [0, 0.69444, 0, 0, 0.27778], "40": [0.25, 0.75, 0, 0, 0.38889], "41": [0.25, 0.75, 0, 0, 0.38889], "42": [0, 0.75, 0, 0, 0.5], "43": [0.08333, 0.58333, 0, 0, 0.77778], "44": [0.19444, 0.10556, 0, 0, 0.27778], "45": [0, 0.43056, 0, 0, 0.33333], "46": [0, 0.10556, 0, 0, 0.27778], "47": [0.25, 0.75, 0, 0, 0.5], "48": [0, 0.64444, 0, 0, 0.5], "49": [0, 0.64444, 0, 0, 0.5], "50": [0, 0.64444, 0, 0, 0.5], "51": [0, 0.64444, 0, 0, 0.5], "52": [0, 0.64444, 0, 0, 0.5], "53": [0, 0.64444, 0, 0, 0.5], "54": [0, 0.64444, 0, 0, 0.5], "55": [0, 0.64444, 0, 0, 0.5], "56": [0, 0.64444, 0, 0, 0.5], "57": [0, 0.64444, 0, 0, 0.5], "58": [0, 0.43056, 0, 0, 0.27778], "59": [0.19444, 0.43056, 0, 0, 0.27778], "60": [0.0391, 0.5391, 0, 0, 0.77778], "61": [-0.13313, 0.36687, 0, 0, 0.77778], "62": [0.0391, 0.5391, 0, 0, 0.77778], "63": [0, 0.69444, 0, 0, 0.47222], "64": [0, 0.69444, 0, 0, 0.77778], "65": [0, 0.68333, 0, 0, 0.75], "66": [0, 0.68333, 0, 0, 0.70834], "67": [0, 0.68333, 0, 0, 0.72222], "68": [0, 0.68333, 0, 0, 0.76389], "69": [0, 0.68333, 0, 0, 0.68056], "70": [0, 0.68333, 0, 0, 0.65278], "71": [0, 0.68333, 0, 0, 0.78472], "72": [0, 0.68333, 0, 0, 0.75], "73": [0, 0.68333, 0, 0, 0.36111], "74": [0, 0.68333, 0, 0, 0.51389], "75": [0, 0.68333, 0, 0, 0.77778], "76": [0, 0.68333, 0, 0, 0.625], "77": [0, 0.68333, 0, 0, 0.91667], "78": [0, 0.68333, 0, 0, 0.75], "79": [0, 0.68333, 0, 0, 0.77778], "80": [0, 0.68333, 0, 0, 0.68056], "81": [0.19444, 0.68333, 0, 0, 0.77778], "82": [0, 0.68333, 0, 0, 0.73611], "83": [0, 0.68333, 0, 0, 0.55556], "84": [0, 0.68333, 0, 0, 0.72222], "85": [0, 0.68333, 0, 0, 0.75], "86": [0, 0.68333, 0.01389, 0, 0.75], "87": [0, 0.68333, 0.01389, 0, 1.02778], "88": [0, 0.68333, 0, 0, 0.75], "89": [0, 0.68333, 0.025, 0, 0.75], "90": [0, 0.68333, 0, 0, 0.61111], "91": [0.25, 0.75, 0, 0, 0.27778], "92": [0.25, 0.75, 0, 0, 0.5], "93": [0.25, 0.75, 0, 0, 0.27778], "94": [0, 0.69444, 0, 0, 0.5], "95": [0.31, 0.12056, 0.02778, 0, 0.5], "97": [0, 0.43056, 0, 0, 0.5], "98": [0, 0.69444, 0, 0, 0.55556], "99": [0, 0.43056, 0, 0, 0.44445], "100": [0, 0.69444, 0, 0, 0.55556], "101": [0, 0.43056, 0, 0, 0.44445], "102": [0, 0.69444, 0.07778, 0, 0.30556], "103": [0.19444, 0.43056, 0.01389, 0, 0.5], "104": [0, 0.69444, 0, 0, 0.55556], "105": [0, 0.66786, 0, 0, 0.27778], "106": [0.19444, 0.66786, 0, 0, 0.30556], "107": [0, 0.69444, 0, 0, 0.52778], "108": [0, 0.69444, 0, 0, 0.27778], "109": [0, 0.43056, 0, 0, 0.83334], "110": [0, 0.43056, 0, 0, 0.55556], "111": [0, 0.43056, 0, 0, 0.5], "112": [0.19444, 0.43056, 0, 0, 0.55556], "113": [0.19444, 0.43056, 0, 0, 0.52778], "114": [0, 0.43056, 0, 0, 0.39167], "115": [0, 0.43056, 0, 0, 0.39445], "116": [0, 0.61508, 0, 0, 0.38889], "117": [0, 0.43056, 0, 0, 0.55556], "118": [0, 0.43056, 0.01389, 0, 0.52778], "119": [0, 0.43056, 0.01389, 0, 0.72222], "120": [0, 0.43056, 0, 0, 0.52778], "121": [0.19444, 0.43056, 0.01389, 0, 0.52778], "122": [0, 0.43056, 0, 0, 0.44445], "123": [0.25, 0.75, 0, 0, 0.5], "124": [0.25, 0.75, 0, 0, 0.27778], "125": [0.25, 0.75, 0, 0, 0.5], "126": [0.35, 0.31786, 0, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "163": [0, 0.69444, 0, 0, 0.76909], "167": [0.19444, 0.69444, 0, 0, 0.44445], "168": [0, 0.66786, 0, 0, 0.5], "172": [0, 0.43056, 0, 0, 0.66667], "176": [0, 0.69444, 0, 0, 0.75], "177": [0.08333, 0.58333, 0, 0, 0.77778], "182": [0.19444, 0.69444, 0, 0, 0.61111], "184": [0.17014, 0, 0, 0, 0.44445], "198": [0, 0.68333, 0, 0, 0.90278], "215": [0.08333, 0.58333, 0, 0, 0.77778], "216": [0.04861, 0.73194, 0, 0, 0.77778], "223": [0, 0.69444, 0, 0, 0.5], "230": [0, 0.43056, 0, 0, 0.72222], "247": [0.08333, 0.58333, 0, 0, 0.77778], "248": [0.09722, 0.52778, 0, 0, 0.5], "305": [0, 0.43056, 0, 0, 0.27778], "338": [0, 0.68333, 0, 0, 1.01389], "339": [0, 0.43056, 0, 0, 0.77778], "567": [0.19444, 0.43056, 0, 0, 0.30556], "710": [0, 0.69444, 0, 0, 0.5], "711": [0, 0.62847, 0, 0, 0.5], "713": [0, 0.56778, 0, 0, 0.5], "714": [0, 0.69444, 0, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0, 0, 0.5], "729": [0, 0.66786, 0, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.75], "732": [0, 0.66786, 0, 0, 0.5], "733": [0, 0.69444, 0, 0, 0.5], "915": [0, 0.68333, 0, 0, 0.625], "916": [0, 0.68333, 0, 0, 0.83334], "920": [0, 0.68333, 0, 0, 0.77778], "923": [0, 0.68333, 0, 0, 0.69445], "926": [0, 0.68333, 0, 0, 0.66667], "928": [0, 0.68333, 0, 0, 0.75], "931": [0, 0.68333, 0, 0, 0.72222], "933": [0, 0.68333, 0, 0, 0.77778], "934": [0, 0.68333, 0, 0, 0.72222], "936": [0, 0.68333, 0, 0, 0.77778], "937": [0, 0.68333, 0, 0, 0.72222], "8211": [0, 0.43056, 0.02778, 0, 0.5], "8212": [0, 0.43056, 0.02778, 0, 1.0], "8216": [0, 0.69444, 0, 0, 0.27778], "8217": [0, 0.69444, 0, 0, 0.27778], "8220": [0, 0.69444, 0, 0, 0.5], "8221": [0, 0.69444, 0, 0, 0.5], "8224": [0.19444, 0.69444, 0, 0, 0.44445], "8225": [0.19444, 0.69444, 0, 0, 0.44445], "8230": [0, 0.12, 0, 0, 1.172], "8242": [0, 0.55556, 0, 0, 0.275], "8407": [0, 0.71444, 0.15382, 0, 0.5], "8463": [0, 0.68889, 0, 0, 0.54028], "8465": [0, 0.69444, 0, 0, 0.72222], "8467": [0, 0.69444, 0, 0.11111, 0.41667], "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646], "8476": [0, 0.69444, 0, 0, 0.72222], "8501": [0, 0.69444, 0, 0, 0.61111], "8592": [-0.13313, 0.36687, 0, 0, 1.0], "8593": [0.19444, 0.69444, 0, 0, 0.5], "8594": [-0.13313, 0.36687, 0, 0, 1.0], "8595": [0.19444, 0.69444, 0, 0, 0.5], "8596": [-0.13313, 0.36687, 0, 0, 1.0], "8597": [0.25, 0.75, 0, 0, 0.5], "8598": [0.19444, 0.69444, 0, 0, 1.0], "8599": [0.19444, 0.69444, 0, 0, 1.0], "8600": [0.19444, 0.69444, 0, 0, 1.0], "8601": [0.19444, 0.69444, 0, 0, 1.0], "8614": [0.011, 0.511, 0, 0, 1.0], "8617": [0.011, 0.511, 0, 0, 1.126], "8618": [0.011, 0.511, 0, 0, 1.126], "8636": [-0.13313, 0.36687, 0, 0, 1.0], "8637": [-0.13313, 0.36687, 0, 0, 1.0], "8640": [-0.13313, 0.36687, 0, 0, 1.0], "8641": [-0.13313, 0.36687, 0, 0, 1.0], "8652": [0.011, 0.671, 0, 0, 1.0], "8656": [-0.13313, 0.36687, 0, 0, 1.0], "8657": [0.19444, 0.69444, 0, 0, 0.61111], "8658": [-0.13313, 0.36687, 0, 0, 1.0], "8659": [0.19444, 0.69444, 0, 0, 0.61111], "8660": [-0.13313, 0.36687, 0, 0, 1.0], "8661": [0.25, 0.75, 0, 0, 0.61111], "8704": [0, 0.69444, 0, 0, 0.55556], "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309], "8707": [0, 0.69444, 0, 0, 0.55556], "8709": [0.05556, 0.75, 0, 0, 0.5], "8711": [0, 0.68333, 0, 0, 0.83334], "8712": [0.0391, 0.5391, 0, 0, 0.66667], "8715": [0.0391, 0.5391, 0, 0, 0.66667], "8722": [0.08333, 0.58333, 0, 0, 0.77778], "8723": [0.08333, 0.58333, 0, 0, 0.77778], "8725": [0.25, 0.75, 0, 0, 0.5], "8726": [0.25, 0.75, 0, 0, 0.5], "8727": [-0.03472, 0.46528, 0, 0, 0.5], "8728": [-0.05555, 0.44445, 0, 0, 0.5], "8729": [-0.05555, 0.44445, 0, 0, 0.5], "8730": [0.2, 0.8, 0, 0, 0.83334], "8733": [0, 0.43056, 0, 0, 0.77778], "8734": [0, 0.43056, 0, 0, 1.0], "8736": [0, 0.69224, 0, 0, 0.72222], "8739": [0.25, 0.75, 0, 0, 0.27778], "8741": [0.25, 0.75, 0, 0, 0.5], "8743": [0, 0.55556, 0, 0, 0.66667], "8744": [0, 0.55556, 0, 0, 0.66667], "8745": [0, 0.55556, 0, 0, 0.66667], "8746": [0, 0.55556, 0, 0, 0.66667], "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667], "8764": [-0.13313, 0.36687, 0, 0, 0.77778], "8768": [0.19444, 0.69444, 0, 0, 0.27778], "8771": [-0.03625, 0.46375, 0, 0, 0.77778], "8773": [-0.022, 0.589, 0, 0, 1.0], "8776": [-0.01688, 0.48312, 0, 0, 0.77778], "8781": [-0.03625, 0.46375, 0, 0, 0.77778], "8784": [-0.133, 0.67, 0, 0, 0.778], "8801": [-0.03625, 0.46375, 0, 0, 0.77778], "8804": [0.13597, 0.63597, 0, 0, 0.77778], "8805": [0.13597, 0.63597, 0, 0, 0.77778], "8810": [0.0391, 0.5391, 0, 0, 1.0], "8811": [0.0391, 0.5391, 0, 0, 1.0], "8826": [0.0391, 0.5391, 0, 0, 0.77778], "8827": [0.0391, 0.5391, 0, 0, 0.77778], "8834": [0.0391, 0.5391, 0, 0, 0.77778], "8835": [0.0391, 0.5391, 0, 0, 0.77778], "8838": [0.13597, 0.63597, 0, 0, 0.77778], "8839": [0.13597, 0.63597, 0, 0, 0.77778], "8846": [0, 0.55556, 0, 0, 0.66667], "8849": [0.13597, 0.63597, 0, 0, 0.77778], "8850": [0.13597, 0.63597, 0, 0, 0.77778], "8851": [0, 0.55556, 0, 0, 0.66667], "8852": [0, 0.55556, 0, 0, 0.66667], "8853": [0.08333, 0.58333, 0, 0, 0.77778], "8854": [0.08333, 0.58333, 0, 0, 0.77778], "8855": [0.08333, 0.58333, 0, 0, 0.77778], "8856": [0.08333, 0.58333, 0, 0, 0.77778], "8857": [0.08333, 0.58333, 0, 0, 0.77778], "8866": [0, 0.69444, 0, 0, 0.61111], "8867": [0, 0.69444, 0, 0, 0.61111], "8868": [0, 0.69444, 0, 0, 0.77778], "8869": [0, 0.69444, 0, 0, 0.77778], "8872": [0.249, 0.75, 0, 0, 0.867], "8900": [-0.05555, 0.44445, 0, 0, 0.5], "8901": [-0.05555, 0.44445, 0, 0, 0.27778], "8902": [-0.03472, 0.46528, 0, 0, 0.5], "8904": [0.005, 0.505, 0, 0, 0.9], "8942": [0.03, 0.9, 0, 0, 0.278], "8943": [-0.19, 0.31, 0, 0, 1.172], "8945": [-0.1, 0.82, 0, 0, 1.282], "8968": [0.25, 0.75, 0, 0, 0.44445], "8969": [0.25, 0.75, 0, 0, 0.44445], "8970": [0.25, 0.75, 0, 0, 0.44445], "8971": [0.25, 0.75, 0, 0, 0.44445], "8994": [-0.14236, 0.35764, 0, 0, 1.0], "8995": [-0.14236, 0.35764, 0, 0, 1.0], "9136": [0.244, 0.744, 0, 0, 0.412], "9137": [0.244, 0.744, 0, 0, 0.412], "9651": [0.19444, 0.69444, 0, 0, 0.88889], "9657": [-0.03472, 0.46528, 0, 0, 0.5], "9661": [0.19444, 0.69444, 0, 0, 0.88889], "9667": [-0.03472, 0.46528, 0, 0, 0.5], "9711": [0.19444, 0.69444, 0, 0, 1.0], "9824": [0.12963, 0.69444, 0, 0, 0.77778], "9825": [0.12963, 0.69444, 0, 0, 0.77778], "9826": [0.12963, 0.69444, 0, 0, 0.77778], "9827": [0.12963, 0.69444, 0, 0, 0.77778], "9837": [0, 0.75, 0, 0, 0.38889], "9838": [0.19444, 0.69444, 0, 0, 0.38889], "9839": [0.19444, 0.69444, 0, 0, 0.38889], "10216": [0.25, 0.75, 0, 0, 0.38889], "10217": [0.25, 0.75, 0, 0, 0.38889], "10222": [0.244, 0.744, 0, 0, 0.412], "10223": [0.244, 0.744, 0, 0, 0.412], "10229": [0.011, 0.511, 0, 0, 1.609], "10230": [0.011, 0.511, 0, 0, 1.638], "10231": [0.011, 0.511, 0, 0, 1.859], "10232": [0.024, 0.525, 0, 0, 1.609], "10233": [0.024, 0.525, 0, 0, 1.638], "10234": [0.024, 0.525, 0, 0, 1.858], "10236": [0.011, 0.511, 0, 0, 1.638], "10815": [0, 0.68333, 0, 0, 0.75], "10927": [0.13597, 0.63597, 0, 0, 0.77778], "10928": [0.13597, 0.63597, 0, 0, 0.77778], "57376": [0.19444, 0.69444, 0, 0, 0] }, "Math-BoldItalic": { "32": [0, 0, 0, 0, 0.25], "48": [0, 0.44444, 0, 0, 0.575], "49": [0, 0.44444, 0, 0, 0.575], "50": [0, 0.44444, 0, 0, 0.575], "51": [0.19444, 0.44444, 0, 0, 0.575], "52": [0.19444, 0.44444, 0, 0, 0.575], "53": [0.19444, 0.44444, 0, 0, 0.575], "54": [0, 0.64444, 0, 0, 0.575], "55": [0.19444, 0.44444, 0, 0, 0.575], "56": [0, 0.64444, 0, 0, 0.575], "57": [0.19444, 0.44444, 0, 0, 0.575], "65": [0, 0.68611, 0, 0, 0.86944], "66": [0, 0.68611, 0.04835, 0, 0.8664], "67": [0, 0.68611, 0.06979, 0, 0.81694], "68": [0, 0.68611, 0.03194, 0, 0.93812], "69": [0, 0.68611, 0.05451, 0, 0.81007], "70": [0, 0.68611, 0.15972, 0, 0.68889], "71": [0, 0.68611, 0, 0, 0.88673], "72": [0, 0.68611, 0.08229, 0, 0.98229], "73": [0, 0.68611, 0.07778, 0, 0.51111], "74": [0, 0.68611, 0.10069, 0, 0.63125], "75": [0, 0.68611, 0.06979, 0, 0.97118], "76": [0, 0.68611, 0, 0, 0.75555], "77": [0, 0.68611, 0.11424, 0, 1.14201], "78": [0, 0.68611, 0.11424, 0, 0.95034], "79": [0, 0.68611, 0.03194, 0, 0.83666], "80": [0, 0.68611, 0.15972, 0, 0.72309], "81": [0.19444, 0.68611, 0, 0, 0.86861], "82": [0, 0.68611, 0.00421, 0, 0.87235], "83": [0, 0.68611, 0.05382, 0, 0.69271], "84": [0, 0.68611, 0.15972, 0, 0.63663], "85": [0, 0.68611, 0.11424, 0, 0.80027], "86": [0, 0.68611, 0.25555, 0, 0.67778], "87": [0, 0.68611, 0.15972, 0, 1.09305], "88": [0, 0.68611, 0.07778, 0, 0.94722], "89": [0, 0.68611, 0.25555, 0, 0.67458], "90": [0, 0.68611, 0.06979, 0, 0.77257], "97": [0, 0.44444, 0, 0, 0.63287], "98": [0, 0.69444, 0, 0, 0.52083], "99": [0, 0.44444, 0, 0, 0.51342], "100": [0, 0.69444, 0, 0, 0.60972], "101": [0, 0.44444, 0, 0, 0.55361], "102": [0.19444, 0.69444, 0.11042, 0, 0.56806], "103": [0.19444, 0.44444, 0.03704, 0, 0.5449], "104": [0, 0.69444, 0, 0, 0.66759], "105": [0, 0.69326, 0, 0, 0.4048], "106": [0.19444, 0.69326, 0.0622, 0, 0.47083], "107": [0, 0.69444, 0.01852, 0, 0.6037], "108": [0, 0.69444, 0.0088, 0, 0.34815], "109": [0, 0.44444, 0, 0, 1.0324], "110": [0, 0.44444, 0, 0, 0.71296], "111": [0, 0.44444, 0, 0, 0.58472], "112": [0.19444, 0.44444, 0, 0, 0.60092], "113": [0.19444, 0.44444, 0.03704, 0, 0.54213], "114": [0, 0.44444, 0.03194, 0, 0.5287], "115": [0, 0.44444, 0, 0, 0.53125], "116": [0, 0.63492, 0, 0, 0.41528], "117": [0, 0.44444, 0, 0, 0.68102], "118": [0, 0.44444, 0.03704, 0, 0.56666], "119": [0, 0.44444, 0.02778, 0, 0.83148], "120": [0, 0.44444, 0, 0, 0.65903], "121": [0.19444, 0.44444, 0.03704, 0, 0.59028], "122": [0, 0.44444, 0.04213, 0, 0.55509], "160": [0, 0, 0, 0, 0.25], "915": [0, 0.68611, 0.15972, 0, 0.65694], "916": [0, 0.68611, 0, 0, 0.95833], "920": [0, 0.68611, 0.03194, 0, 0.86722], "923": [0, 0.68611, 0, 0, 0.80555], "926": [0, 0.68611, 0.07458, 0, 0.84125], "928": [0, 0.68611, 0.08229, 0, 0.98229], "931": [0, 0.68611, 0.05451, 0, 0.88507], "933": [0, 0.68611, 0.15972, 0, 0.67083], "934": [0, 0.68611, 0, 0, 0.76666], "936": [0, 0.68611, 0.11653, 0, 0.71402], "937": [0, 0.68611, 0.04835, 0, 0.8789], "945": [0, 0.44444, 0, 0, 0.76064], "946": [0.19444, 0.69444, 0.03403, 0, 0.65972], "947": [0.19444, 0.44444, 0.06389, 0, 0.59003], "948": [0, 0.69444, 0.03819, 0, 0.52222], "949": [0, 0.44444, 0, 0, 0.52882], "950": [0.19444, 0.69444, 0.06215, 0, 0.50833], "951": [0.19444, 0.44444, 0.03704, 0, 0.6], "952": [0, 0.69444, 0.03194, 0, 0.5618], "953": [0, 0.44444, 0, 0, 0.41204], "954": [0, 0.44444, 0, 0, 0.66759], "955": [0, 0.69444, 0, 0, 0.67083], "956": [0.19444, 0.44444, 0, 0, 0.70787], "957": [0, 0.44444, 0.06898, 0, 0.57685], "958": [0.19444, 0.69444, 0.03021, 0, 0.50833], "959": [0, 0.44444, 0, 0, 0.58472], "960": [0, 0.44444, 0.03704, 0, 0.68241], "961": [0.19444, 0.44444, 0, 0, 0.6118], "962": [0.09722, 0.44444, 0.07917, 0, 0.42361], "963": [0, 0.44444, 0.03704, 0, 0.68588], "964": [0, 0.44444, 0.13472, 0, 0.52083], "965": [0, 0.44444, 0.03704, 0, 0.63055], "966": [0.19444, 0.44444, 0, 0, 0.74722], "967": [0.19444, 0.44444, 0, 0, 0.71805], "968": [0.19444, 0.69444, 0.03704, 0, 0.75833], "969": [0, 0.44444, 0.03704, 0, 0.71782], "977": [0, 0.69444, 0, 0, 0.69155], "981": [0.19444, 0.69444, 0, 0, 0.7125], "982": [0, 0.44444, 0.03194, 0, 0.975], "1009": [0.19444, 0.44444, 0, 0, 0.6118], "1013": [0, 0.44444, 0, 0, 0.48333], "57649": [0, 0.44444, 0, 0, 0.39352], "57911": [0.19444, 0.44444, 0, 0, 0.43889] }, "Math-Italic": { "32": [0, 0, 0, 0, 0.25], "48": [0, 0.43056, 0, 0, 0.5], "49": [0, 0.43056, 0, 0, 0.5], "50": [0, 0.43056, 0, 0, 0.5], "51": [0.19444, 0.43056, 0, 0, 0.5], "52": [0.19444, 0.43056, 0, 0, 0.5], "53": [0.19444, 0.43056, 0, 0, 0.5], "54": [0, 0.64444, 0, 0, 0.5], "55": [0.19444, 0.43056, 0, 0, 0.5], "56": [0, 0.64444, 0, 0, 0.5], "57": [0.19444, 0.43056, 0, 0, 0.5], "65": [0, 0.68333, 0, 0.13889, 0.75], "66": [0, 0.68333, 0.05017, 0.08334, 0.75851], "67": [0, 0.68333, 0.07153, 0.08334, 0.71472], "68": [0, 0.68333, 0.02778, 0.05556, 0.82792], "69": [0, 0.68333, 0.05764, 0.08334, 0.7382], "70": [0, 0.68333, 0.13889, 0.08334, 0.64306], "71": [0, 0.68333, 0, 0.08334, 0.78625], "72": [0, 0.68333, 0.08125, 0.05556, 0.83125], "73": [0, 0.68333, 0.07847, 0.11111, 0.43958], "74": [0, 0.68333, 0.09618, 0.16667, 0.55451], "75": [0, 0.68333, 0.07153, 0.05556, 0.84931], "76": [0, 0.68333, 0, 0.02778, 0.68056], "77": [0, 0.68333, 0.10903, 0.08334, 0.97014], "78": [0, 0.68333, 0.10903, 0.08334, 0.80347], "79": [0, 0.68333, 0.02778, 0.08334, 0.76278], "80": [0, 0.68333, 0.13889, 0.08334, 0.64201], "81": [0.19444, 0.68333, 0, 0.08334, 0.79056], "82": [0, 0.68333, 0.00773, 0.08334, 0.75929], "83": [0, 0.68333, 0.05764, 0.08334, 0.6132], "84": [0, 0.68333, 0.13889, 0.08334, 0.58438], "85": [0, 0.68333, 0.10903, 0.02778, 0.68278], "86": [0, 0.68333, 0.22222, 0, 0.58333], "87": [0, 0.68333, 0.13889, 0, 0.94445], "88": [0, 0.68333, 0.07847, 0.08334, 0.82847], "89": [0, 0.68333, 0.22222, 0, 0.58056], "90": [0, 0.68333, 0.07153, 0.08334, 0.68264], "97": [0, 0.43056, 0, 0, 0.52859], "98": [0, 0.69444, 0, 0, 0.42917], "99": [0, 0.43056, 0, 0.05556, 0.43276], "100": [0, 0.69444, 0, 0.16667, 0.52049], "101": [0, 0.43056, 0, 0.05556, 0.46563], "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], "104": [0, 0.69444, 0, 0, 0.57616], "105": [0, 0.65952, 0, 0, 0.34451], "106": [0.19444, 0.65952, 0.05724, 0, 0.41181], "107": [0, 0.69444, 0.03148, 0, 0.5206], "108": [0, 0.69444, 0.01968, 0.08334, 0.29838], "109": [0, 0.43056, 0, 0, 0.87801], "110": [0, 0.43056, 0, 0, 0.60023], "111": [0, 0.43056, 0, 0.05556, 0.48472], "112": [0.19444, 0.43056, 0, 0.08334, 0.50313], "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], "114": [0, 0.43056, 0.02778, 0.05556, 0.45116], "115": [0, 0.43056, 0, 0.05556, 0.46875], "116": [0, 0.61508, 0, 0.08334, 0.36111], "117": [0, 0.43056, 0, 0.02778, 0.57246], "118": [0, 0.43056, 0.03588, 0.02778, 0.48472], "119": [0, 0.43056, 0.02691, 0.08334, 0.71592], "120": [0, 0.43056, 0, 0.02778, 0.57153], "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], "122": [0, 0.43056, 0.04398, 0.05556, 0.46505], "160": [0, 0, 0, 0, 0.25], "915": [0, 0.68333, 0.13889, 0.08334, 0.61528], "916": [0, 0.68333, 0, 0.16667, 0.83334], "920": [0, 0.68333, 0.02778, 0.08334, 0.76278], "923": [0, 0.68333, 0, 0.16667, 0.69445], "926": [0, 0.68333, 0.07569, 0.08334, 0.74236], "928": [0, 0.68333, 0.08125, 0.05556, 0.83125], "931": [0, 0.68333, 0.05764, 0.08334, 0.77986], "933": [0, 0.68333, 0.13889, 0.05556, 0.58333], "934": [0, 0.68333, 0, 0.08334, 0.66667], "936": [0, 0.68333, 0.11, 0.05556, 0.61222], "937": [0, 0.68333, 0.05017, 0.08334, 0.7724], "945": [0, 0.43056, 0.0037, 0.02778, 0.6397], "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], "947": [0.19444, 0.43056, 0.05556, 0, 0.51773], "948": [0, 0.69444, 0.03785, 0.05556, 0.44444], "949": [0, 0.43056, 0, 0.08334, 0.46632], "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], "952": [0, 0.69444, 0.02778, 0.08334, 0.46944], "953": [0, 0.43056, 0, 0.05556, 0.35394], "954": [0, 0.43056, 0, 0, 0.57616], "955": [0, 0.69444, 0, 0, 0.58334], "956": [0.19444, 0.43056, 0, 0.02778, 0.60255], "957": [0, 0.43056, 0.06366, 0.02778, 0.49398], "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], "959": [0, 0.43056, 0, 0.05556, 0.48472], "960": [0, 0.43056, 0.03588, 0, 0.57003], "961": [0.19444, 0.43056, 0, 0.08334, 0.51702], "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], "963": [0, 0.43056, 0.03588, 0, 0.57141], "964": [0, 0.43056, 0.1132, 0.02778, 0.43715], "965": [0, 0.43056, 0.03588, 0.02778, 0.54028], "966": [0.19444, 0.43056, 0, 0.08334, 0.65417], "967": [0.19444, 0.43056, 0, 0.05556, 0.62569], "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], "969": [0, 0.43056, 0.03588, 0, 0.62245], "977": [0, 0.69444, 0, 0.08334, 0.59144], "981": [0.19444, 0.69444, 0, 0.08334, 0.59583], "982": [0, 0.43056, 0.02778, 0, 0.82813], "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702], "1013": [0, 0.43056, 0, 0.05556, 0.4059], "57649": [0, 0.43056, 0, 0.02778, 0.32246], "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403] }, "SansSerif-Bold": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.36667], "34": [0, 0.69444, 0, 0, 0.55834], "35": [0.19444, 0.69444, 0, 0, 0.91667], "36": [0.05556, 0.75, 0, 0, 0.55], "37": [0.05556, 0.75, 0, 0, 1.02912], "38": [0, 0.69444, 0, 0, 0.83056], "39": [0, 0.69444, 0, 0, 0.30556], "40": [0.25, 0.75, 0, 0, 0.42778], "41": [0.25, 0.75, 0, 0, 0.42778], "42": [0, 0.75, 0, 0, 0.55], "43": [0.11667, 0.61667, 0, 0, 0.85556], "44": [0.10556, 0.13056, 0, 0, 0.30556], "45": [0, 0.45833, 0, 0, 0.36667], "46": [0, 0.13056, 0, 0, 0.30556], "47": [0.25, 0.75, 0, 0, 0.55], "48": [0, 0.69444, 0, 0, 0.55], "49": [0, 0.69444, 0, 0, 0.55], "50": [0, 0.69444, 0, 0, 0.55], "51": [0, 0.69444, 0, 0, 0.55], "52": [0, 0.69444, 0, 0, 0.55], "53": [0, 0.69444, 0, 0, 0.55], "54": [0, 0.69444, 0, 0, 0.55], "55": [0, 0.69444, 0, 0, 0.55], "56": [0, 0.69444, 0, 0, 0.55], "57": [0, 0.69444, 0, 0, 0.55], "58": [0, 0.45833, 0, 0, 0.30556], "59": [0.10556, 0.45833, 0, 0, 0.30556], "61": [-0.09375, 0.40625, 0, 0, 0.85556], "63": [0, 0.69444, 0, 0, 0.51945], "64": [0, 0.69444, 0, 0, 0.73334], "65": [0, 0.69444, 0, 0, 0.73334], "66": [0, 0.69444, 0, 0, 0.73334], "67": [0, 0.69444, 0, 0, 0.70278], "68": [0, 0.69444, 0, 0, 0.79445], "69": [0, 0.69444, 0, 0, 0.64167], "70": [0, 0.69444, 0, 0, 0.61111], "71": [0, 0.69444, 0, 0, 0.73334], "72": [0, 0.69444, 0, 0, 0.79445], "73": [0, 0.69444, 0, 0, 0.33056], "74": [0, 0.69444, 0, 0, 0.51945], "75": [0, 0.69444, 0, 0, 0.76389], "76": [0, 0.69444, 0, 0, 0.58056], "77": [0, 0.69444, 0, 0, 0.97778], "78": [0, 0.69444, 0, 0, 0.79445], "79": [0, 0.69444, 0, 0, 0.79445], "80": [0, 0.69444, 0, 0, 0.70278], "81": [0.10556, 0.69444, 0, 0, 0.79445], "82": [0, 0.69444, 0, 0, 0.70278], "83": [0, 0.69444, 0, 0, 0.61111], "84": [0, 0.69444, 0, 0, 0.73334], "85": [0, 0.69444, 0, 0, 0.76389], "86": [0, 0.69444, 0.01528, 0, 0.73334], "87": [0, 0.69444, 0.01528, 0, 1.03889], "88": [0, 0.69444, 0, 0, 0.73334], "89": [0, 0.69444, 0.0275, 0, 0.73334], "90": [0, 0.69444, 0, 0, 0.67223], "91": [0.25, 0.75, 0, 0, 0.34306], "93": [0.25, 0.75, 0, 0, 0.34306], "94": [0, 0.69444, 0, 0, 0.55], "95": [0.35, 0.10833, 0.03056, 0, 0.55], "97": [0, 0.45833, 0, 0, 0.525], "98": [0, 0.69444, 0, 0, 0.56111], "99": [0, 0.45833, 0, 0, 0.48889], "100": [0, 0.69444, 0, 0, 0.56111], "101": [0, 0.45833, 0, 0, 0.51111], "102": [0, 0.69444, 0.07639, 0, 0.33611], "103": [0.19444, 0.45833, 0.01528, 0, 0.55], "104": [0, 0.69444, 0, 0, 0.56111], "105": [0, 0.69444, 0, 0, 0.25556], "106": [0.19444, 0.69444, 0, 0, 0.28611], "107": [0, 0.69444, 0, 0, 0.53056], "108": [0, 0.69444, 0, 0, 0.25556], "109": [0, 0.45833, 0, 0, 0.86667], "110": [0, 0.45833, 0, 0, 0.56111], "111": [0, 0.45833, 0, 0, 0.55], "112": [0.19444, 0.45833, 0, 0, 0.56111], "113": [0.19444, 0.45833, 0, 0, 0.56111], "114": [0, 0.45833, 0.01528, 0, 0.37222], "115": [0, 0.45833, 0, 0, 0.42167], "116": [0, 0.58929, 0, 0, 0.40417], "117": [0, 0.45833, 0, 0, 0.56111], "118": [0, 0.45833, 0.01528, 0, 0.5], "119": [0, 0.45833, 0.01528, 0, 0.74445], "120": [0, 0.45833, 0, 0, 0.5], "121": [0.19444, 0.45833, 0.01528, 0, 0.5], "122": [0, 0.45833, 0, 0, 0.47639], "126": [0.35, 0.34444, 0, 0, 0.55], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.69444, 0, 0, 0.55], "176": [0, 0.69444, 0, 0, 0.73334], "180": [0, 0.69444, 0, 0, 0.55], "184": [0.17014, 0, 0, 0, 0.48889], "305": [0, 0.45833, 0, 0, 0.25556], "567": [0.19444, 0.45833, 0, 0, 0.28611], "710": [0, 0.69444, 0, 0, 0.55], "711": [0, 0.63542, 0, 0, 0.55], "713": [0, 0.63778, 0, 0, 0.55], "728": [0, 0.69444, 0, 0, 0.55], "729": [0, 0.69444, 0, 0, 0.30556], "730": [0, 0.69444, 0, 0, 0.73334], "732": [0, 0.69444, 0, 0, 0.55], "733": [0, 0.69444, 0, 0, 0.55], "915": [0, 0.69444, 0, 0, 0.58056], "916": [0, 0.69444, 0, 0, 0.91667], "920": [0, 0.69444, 0, 0, 0.85556], "923": [0, 0.69444, 0, 0, 0.67223], "926": [0, 0.69444, 0, 0, 0.73334], "928": [0, 0.69444, 0, 0, 0.79445], "931": [0, 0.69444, 0, 0, 0.79445], "933": [0, 0.69444, 0, 0, 0.85556], "934": [0, 0.69444, 0, 0, 0.79445], "936": [0, 0.69444, 0, 0, 0.85556], "937": [0, 0.69444, 0, 0, 0.79445], "8211": [0, 0.45833, 0.03056, 0, 0.55], "8212": [0, 0.45833, 0.03056, 0, 1.10001], "8216": [0, 0.69444, 0, 0, 0.30556], "8217": [0, 0.69444, 0, 0, 0.30556], "8220": [0, 0.69444, 0, 0, 0.55834], "8221": [0, 0.69444, 0, 0, 0.55834] }, "SansSerif-Italic": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0.05733, 0, 0.31945], "34": [0, 0.69444, 0.00316, 0, 0.5], "35": [0.19444, 0.69444, 0.05087, 0, 0.83334], "36": [0.05556, 0.75, 0.11156, 0, 0.5], "37": [0.05556, 0.75, 0.03126, 0, 0.83334], "38": [0, 0.69444, 0.03058, 0, 0.75834], "39": [0, 0.69444, 0.07816, 0, 0.27778], "40": [0.25, 0.75, 0.13164, 0, 0.38889], "41": [0.25, 0.75, 0.02536, 0, 0.38889], "42": [0, 0.75, 0.11775, 0, 0.5], "43": [0.08333, 0.58333, 0.02536, 0, 0.77778], "44": [0.125, 0.08333, 0, 0, 0.27778], "45": [0, 0.44444, 0.01946, 0, 0.33333], "46": [0, 0.08333, 0, 0, 0.27778], "47": [0.25, 0.75, 0.13164, 0, 0.5], "48": [0, 0.65556, 0.11156, 0, 0.5], "49": [0, 0.65556, 0.11156, 0, 0.5], "50": [0, 0.65556, 0.11156, 0, 0.5], "51": [0, 0.65556, 0.11156, 0, 0.5], "52": [0, 0.65556, 0.11156, 0, 0.5], "53": [0, 0.65556, 0.11156, 0, 0.5], "54": [0, 0.65556, 0.11156, 0, 0.5], "55": [0, 0.65556, 0.11156, 0, 0.5], "56": [0, 0.65556, 0.11156, 0, 0.5], "57": [0, 0.65556, 0.11156, 0, 0.5], "58": [0, 0.44444, 0.02502, 0, 0.27778], "59": [0.125, 0.44444, 0.02502, 0, 0.27778], "61": [-0.13, 0.37, 0.05087, 0, 0.77778], "63": [0, 0.69444, 0.11809, 0, 0.47222], "64": [0, 0.69444, 0.07555, 0, 0.66667], "65": [0, 0.69444, 0, 0, 0.66667], "66": [0, 0.69444, 0.08293, 0, 0.66667], "67": [0, 0.69444, 0.11983, 0, 0.63889], "68": [0, 0.69444, 0.07555, 0, 0.72223], "69": [0, 0.69444, 0.11983, 0, 0.59722], "70": [0, 0.69444, 0.13372, 0, 0.56945], "71": [0, 0.69444, 0.11983, 0, 0.66667], "72": [0, 0.69444, 0.08094, 0, 0.70834], "73": [0, 0.69444, 0.13372, 0, 0.27778], "74": [0, 0.69444, 0.08094, 0, 0.47222], "75": [0, 0.69444, 0.11983, 0, 0.69445], "76": [0, 0.69444, 0, 0, 0.54167], "77": [0, 0.69444, 0.08094, 0, 0.875], "78": [0, 0.69444, 0.08094, 0, 0.70834], "79": [0, 0.69444, 0.07555, 0, 0.73611], "80": [0, 0.69444, 0.08293, 0, 0.63889], "81": [0.125, 0.69444, 0.07555, 0, 0.73611], "82": [0, 0.69444, 0.08293, 0, 0.64584], "83": [0, 0.69444, 0.09205, 0, 0.55556], "84": [0, 0.69444, 0.13372, 0, 0.68056], "85": [0, 0.69444, 0.08094, 0, 0.6875], "86": [0, 0.69444, 0.1615, 0, 0.66667], "87": [0, 0.69444, 0.1615, 0, 0.94445], "88": [0, 0.69444, 0.13372, 0, 0.66667], "89": [0, 0.69444, 0.17261, 0, 0.66667], "90": [0, 0.69444, 0.11983, 0, 0.61111], "91": [0.25, 0.75, 0.15942, 0, 0.28889], "93": [0.25, 0.75, 0.08719, 0, 0.28889], "94": [0, 0.69444, 0.0799, 0, 0.5], "95": [0.35, 0.09444, 0.08616, 0, 0.5], "97": [0, 0.44444, 0.00981, 0, 0.48056], "98": [0, 0.69444, 0.03057, 0, 0.51667], "99": [0, 0.44444, 0.08336, 0, 0.44445], "100": [0, 0.69444, 0.09483, 0, 0.51667], "101": [0, 0.44444, 0.06778, 0, 0.44445], "102": [0, 0.69444, 0.21705, 0, 0.30556], "103": [0.19444, 0.44444, 0.10836, 0, 0.5], "104": [0, 0.69444, 0.01778, 0, 0.51667], "105": [0, 0.67937, 0.09718, 0, 0.23889], "106": [0.19444, 0.67937, 0.09162, 0, 0.26667], "107": [0, 0.69444, 0.08336, 0, 0.48889], "108": [0, 0.69444, 0.09483, 0, 0.23889], "109": [0, 0.44444, 0.01778, 0, 0.79445], "110": [0, 0.44444, 0.01778, 0, 0.51667], "111": [0, 0.44444, 0.06613, 0, 0.5], "112": [0.19444, 0.44444, 0.0389, 0, 0.51667], "113": [0.19444, 0.44444, 0.04169, 0, 0.51667], "114": [0, 0.44444, 0.10836, 0, 0.34167], "115": [0, 0.44444, 0.0778, 0, 0.38333], "116": [0, 0.57143, 0.07225, 0, 0.36111], "117": [0, 0.44444, 0.04169, 0, 0.51667], "118": [0, 0.44444, 0.10836, 0, 0.46111], "119": [0, 0.44444, 0.10836, 0, 0.68334], "120": [0, 0.44444, 0.09169, 0, 0.46111], "121": [0.19444, 0.44444, 0.10836, 0, 0.46111], "122": [0, 0.44444, 0.08752, 0, 0.43472], "126": [0.35, 0.32659, 0.08826, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.67937, 0.06385, 0, 0.5], "176": [0, 0.69444, 0, 0, 0.73752], "184": [0.17014, 0, 0, 0, 0.44445], "305": [0, 0.44444, 0.04169, 0, 0.23889], "567": [0.19444, 0.44444, 0.04169, 0, 0.26667], "710": [0, 0.69444, 0.0799, 0, 0.5], "711": [0, 0.63194, 0.08432, 0, 0.5], "713": [0, 0.60889, 0.08776, 0, 0.5], "714": [0, 0.69444, 0.09205, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0.09483, 0, 0.5], "729": [0, 0.67937, 0.07774, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.73752], "732": [0, 0.67659, 0.08826, 0, 0.5], "733": [0, 0.69444, 0.09205, 0, 0.5], "915": [0, 0.69444, 0.13372, 0, 0.54167], "916": [0, 0.69444, 0, 0, 0.83334], "920": [0, 0.69444, 0.07555, 0, 0.77778], "923": [0, 0.69444, 0, 0, 0.61111], "926": [0, 0.69444, 0.12816, 0, 0.66667], "928": [0, 0.69444, 0.08094, 0, 0.70834], "931": [0, 0.69444, 0.11983, 0, 0.72222], "933": [0, 0.69444, 0.09031, 0, 0.77778], "934": [0, 0.69444, 0.04603, 0, 0.72222], "936": [0, 0.69444, 0.09031, 0, 0.77778], "937": [0, 0.69444, 0.08293, 0, 0.72222], "8211": [0, 0.44444, 0.08616, 0, 0.5], "8212": [0, 0.44444, 0.08616, 0, 1.0], "8216": [0, 0.69444, 0.07816, 0, 0.27778], "8217": [0, 0.69444, 0.07816, 0, 0.27778], "8220": [0, 0.69444, 0.14205, 0, 0.5], "8221": [0, 0.69444, 0.00316, 0, 0.5] }, "SansSerif-Regular": { "32": [0, 0, 0, 0, 0.25], "33": [0, 0.69444, 0, 0, 0.31945], "34": [0, 0.69444, 0, 0, 0.5], "35": [0.19444, 0.69444, 0, 0, 0.83334], "36": [0.05556, 0.75, 0, 0, 0.5], "37": [0.05556, 0.75, 0, 0, 0.83334], "38": [0, 0.69444, 0, 0, 0.75834], "39": [0, 0.69444, 0, 0, 0.27778], "40": [0.25, 0.75, 0, 0, 0.38889], "41": [0.25, 0.75, 0, 0, 0.38889], "42": [0, 0.75, 0, 0, 0.5], "43": [0.08333, 0.58333, 0, 0, 0.77778], "44": [0.125, 0.08333, 0, 0, 0.27778], "45": [0, 0.44444, 0, 0, 0.33333], "46": [0, 0.08333, 0, 0, 0.27778], "47": [0.25, 0.75, 0, 0, 0.5], "48": [0, 0.65556, 0, 0, 0.5], "49": [0, 0.65556, 0, 0, 0.5], "50": [0, 0.65556, 0, 0, 0.5], "51": [0, 0.65556, 0, 0, 0.5], "52": [0, 0.65556, 0, 0, 0.5], "53": [0, 0.65556, 0, 0, 0.5], "54": [0, 0.65556, 0, 0, 0.5], "55": [0, 0.65556, 0, 0, 0.5], "56": [0, 0.65556, 0, 0, 0.5], "57": [0, 0.65556, 0, 0, 0.5], "58": [0, 0.44444, 0, 0, 0.27778], "59": [0.125, 0.44444, 0, 0, 0.27778], "61": [-0.13, 0.37, 0, 0, 0.77778], "63": [0, 0.69444, 0, 0, 0.47222], "64": [0, 0.69444, 0, 0, 0.66667], "65": [0, 0.69444, 0, 0, 0.66667], "66": [0, 0.69444, 0, 0, 0.66667], "67": [0, 0.69444, 0, 0, 0.63889], "68": [0, 0.69444, 0, 0, 0.72223], "69": [0, 0.69444, 0, 0, 0.59722], "70": [0, 0.69444, 0, 0, 0.56945], "71": [0, 0.69444, 0, 0, 0.66667], "72": [0, 0.69444, 0, 0, 0.70834], "73": [0, 0.69444, 0, 0, 0.27778], "74": [0, 0.69444, 0, 0, 0.47222], "75": [0, 0.69444, 0, 0, 0.69445], "76": [0, 0.69444, 0, 0, 0.54167], "77": [0, 0.69444, 0, 0, 0.875], "78": [0, 0.69444, 0, 0, 0.70834], "79": [0, 0.69444, 0, 0, 0.73611], "80": [0, 0.69444, 0, 0, 0.63889], "81": [0.125, 0.69444, 0, 0, 0.73611], "82": [0, 0.69444, 0, 0, 0.64584], "83": [0, 0.69444, 0, 0, 0.55556], "84": [0, 0.69444, 0, 0, 0.68056], "85": [0, 0.69444, 0, 0, 0.6875], "86": [0, 0.69444, 0.01389, 0, 0.66667], "87": [0, 0.69444, 0.01389, 0, 0.94445], "88": [0, 0.69444, 0, 0, 0.66667], "89": [0, 0.69444, 0.025, 0, 0.66667], "90": [0, 0.69444, 0, 0, 0.61111], "91": [0.25, 0.75, 0, 0, 0.28889], "93": [0.25, 0.75, 0, 0, 0.28889], "94": [0, 0.69444, 0, 0, 0.5], "95": [0.35, 0.09444, 0.02778, 0, 0.5], "97": [0, 0.44444, 0, 0, 0.48056], "98": [0, 0.69444, 0, 0, 0.51667], "99": [0, 0.44444, 0, 0, 0.44445], "100": [0, 0.69444, 0, 0, 0.51667], "101": [0, 0.44444, 0, 0, 0.44445], "102": [0, 0.69444, 0.06944, 0, 0.30556], "103": [0.19444, 0.44444, 0.01389, 0, 0.5], "104": [0, 0.69444, 0, 0, 0.51667], "105": [0, 0.67937, 0, 0, 0.23889], "106": [0.19444, 0.67937, 0, 0, 0.26667], "107": [0, 0.69444, 0, 0, 0.48889], "108": [0, 0.69444, 0, 0, 0.23889], "109": [0, 0.44444, 0, 0, 0.79445], "110": [0, 0.44444, 0, 0, 0.51667], "111": [0, 0.44444, 0, 0, 0.5], "112": [0.19444, 0.44444, 0, 0, 0.51667], "113": [0.19444, 0.44444, 0, 0, 0.51667], "114": [0, 0.44444, 0.01389, 0, 0.34167], "115": [0, 0.44444, 0, 0, 0.38333], "116": [0, 0.57143, 0, 0, 0.36111], "117": [0, 0.44444, 0, 0, 0.51667], "118": [0, 0.44444, 0.01389, 0, 0.46111], "119": [0, 0.44444, 0.01389, 0, 0.68334], "120": [0, 0.44444, 0, 0, 0.46111], "121": [0.19444, 0.44444, 0.01389, 0, 0.46111], "122": [0, 0.44444, 0, 0, 0.43472], "126": [0.35, 0.32659, 0, 0, 0.5], "160": [0, 0, 0, 0, 0.25], "168": [0, 0.67937, 0, 0, 0.5], "176": [0, 0.69444, 0, 0, 0.66667], "184": [0.17014, 0, 0, 0, 0.44445], "305": [0, 0.44444, 0, 0, 0.23889], "567": [0.19444, 0.44444, 0, 0, 0.26667], "710": [0, 0.69444, 0, 0, 0.5], "711": [0, 0.63194, 0, 0, 0.5], "713": [0, 0.60889, 0, 0, 0.5], "714": [0, 0.69444, 0, 0, 0.5], "715": [0, 0.69444, 0, 0, 0.5], "728": [0, 0.69444, 0, 0, 0.5], "729": [0, 0.67937, 0, 0, 0.27778], "730": [0, 0.69444, 0, 0, 0.66667], "732": [0, 0.67659, 0, 0, 0.5], "733": [0, 0.69444, 0, 0, 0.5], "915": [0, 0.69444, 0, 0, 0.54167], "916": [0, 0.69444, 0, 0, 0.83334], "920": [0, 0.69444, 0, 0, 0.77778], "923": [0, 0.69444, 0, 0, 0.61111], "926": [0, 0.69444, 0, 0, 0.66667], "928": [0, 0.69444, 0, 0, 0.70834], "931": [0, 0.69444, 0, 0, 0.72222], "933": [0, 0.69444, 0, 0, 0.77778], "934": [0, 0.69444, 0, 0, 0.72222], "936": [0, 0.69444, 0, 0, 0.77778], "937": [0, 0.69444, 0, 0, 0.72222], "8211": [0, 0.44444, 0.02778, 0, 0.5], "8212": [0, 0.44444, 0.02778, 0, 1.0], "8216": [0, 0.69444, 0, 0, 0.27778], "8217": [0, 0.69444, 0, 0, 0.27778], "8220": [0, 0.69444, 0, 0, 0.5], "8221": [0, 0.69444, 0, 0, 0.5] }, "Script-Regular": { "32": [0, 0, 0, 0, 0.25], "65": [0, 0.7, 0.22925, 0, 0.80253], "66": [0, 0.7, 0.04087, 0, 0.90757], "67": [0, 0.7, 0.1689, 0, 0.66619], "68": [0, 0.7, 0.09371, 0, 0.77443], "69": [0, 0.7, 0.18583, 0, 0.56162], "70": [0, 0.7, 0.13634, 0, 0.89544], "71": [0, 0.7, 0.17322, 0, 0.60961], "72": [0, 0.7, 0.29694, 0, 0.96919], "73": [0, 0.7, 0.19189, 0, 0.80907], "74": [0.27778, 0.7, 0.19189, 0, 1.05159], "75": [0, 0.7, 0.31259, 0, 0.91364], "76": [0, 0.7, 0.19189, 0, 0.87373], "77": [0, 0.7, 0.15981, 0, 1.08031], "78": [0, 0.7, 0.3525, 0, 0.9015], "79": [0, 0.7, 0.08078, 0, 0.73787], "80": [0, 0.7, 0.08078, 0, 1.01262], "81": [0, 0.7, 0.03305, 0, 0.88282], "82": [0, 0.7, 0.06259, 0, 0.85], "83": [0, 0.7, 0.19189, 0, 0.86767], "84": [0, 0.7, 0.29087, 0, 0.74697], "85": [0, 0.7, 0.25815, 0, 0.79996], "86": [0, 0.7, 0.27523, 0, 0.62204], "87": [0, 0.7, 0.27523, 0, 0.80532], "88": [0, 0.7, 0.26006, 0, 0.94445], "89": [0, 0.7, 0.2939, 0, 0.70961], "90": [0, 0.7, 0.24037, 0, 0.8212], "160": [0, 0, 0, 0, 0.25] }, "Size1-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.35001, 0.85, 0, 0, 0.45834], "41": [0.35001, 0.85, 0, 0, 0.45834], "47": [0.35001, 0.85, 0, 0, 0.57778], "91": [0.35001, 0.85, 0, 0, 0.41667], "92": [0.35001, 0.85, 0, 0, 0.57778], "93": [0.35001, 0.85, 0, 0, 0.41667], "123": [0.35001, 0.85, 0, 0, 0.58334], "125": [0.35001, 0.85, 0, 0, 0.58334], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.72222, 0, 0, 0.55556], "732": [0, 0.72222, 0, 0, 0.55556], "770": [0, 0.72222, 0, 0, 0.55556], "771": [0, 0.72222, 0, 0, 0.55556], "8214": [-0.00099, 0.601, 0, 0, 0.77778], "8593": [1e-05, 0.6, 0, 0, 0.66667], "8595": [1e-05, 0.6, 0, 0, 0.66667], "8657": [1e-05, 0.6, 0, 0, 0.77778], "8659": [1e-05, 0.6, 0, 0, 0.77778], "8719": [0.25001, 0.75, 0, 0, 0.94445], "8720": [0.25001, 0.75, 0, 0, 0.94445], "8721": [0.25001, 0.75, 0, 0, 1.05556], "8730": [0.35001, 0.85, 0, 0, 1.0], "8739": [-0.00599, 0.606, 0, 0, 0.33333], "8741": [-0.00599, 0.606, 0, 0, 0.55556], "8747": [0.30612, 0.805, 0.19445, 0, 0.47222], "8748": [0.306, 0.805, 0.19445, 0, 0.47222], "8749": [0.306, 0.805, 0.19445, 0, 0.47222], "8750": [0.30612, 0.805, 0.19445, 0, 0.47222], "8896": [0.25001, 0.75, 0, 0, 0.83334], "8897": [0.25001, 0.75, 0, 0, 0.83334], "8898": [0.25001, 0.75, 0, 0, 0.83334], "8899": [0.25001, 0.75, 0, 0, 0.83334], "8968": [0.35001, 0.85, 0, 0, 0.47222], "8969": [0.35001, 0.85, 0, 0, 0.47222], "8970": [0.35001, 0.85, 0, 0, 0.47222], "8971": [0.35001, 0.85, 0, 0, 0.47222], "9168": [-0.00099, 0.601, 0, 0, 0.66667], "10216": [0.35001, 0.85, 0, 0, 0.47222], "10217": [0.35001, 0.85, 0, 0, 0.47222], "10752": [0.25001, 0.75, 0, 0, 1.11111], "10753": [0.25001, 0.75, 0, 0, 1.11111], "10754": [0.25001, 0.75, 0, 0, 1.11111], "10756": [0.25001, 0.75, 0, 0, 0.83334], "10758": [0.25001, 0.75, 0, 0, 0.83334] }, "Size2-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.65002, 1.15, 0, 0, 0.59722], "41": [0.65002, 1.15, 0, 0, 0.59722], "47": [0.65002, 1.15, 0, 0, 0.81111], "91": [0.65002, 1.15, 0, 0, 0.47222], "92": [0.65002, 1.15, 0, 0, 0.81111], "93": [0.65002, 1.15, 0, 0, 0.47222], "123": [0.65002, 1.15, 0, 0, 0.66667], "125": [0.65002, 1.15, 0, 0, 0.66667], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.75, 0, 0, 1.0], "732": [0, 0.75, 0, 0, 1.0], "770": [0, 0.75, 0, 0, 1.0], "771": [0, 0.75, 0, 0, 1.0], "8719": [0.55001, 1.05, 0, 0, 1.27778], "8720": [0.55001, 1.05, 0, 0, 1.27778], "8721": [0.55001, 1.05, 0, 0, 1.44445], "8730": [0.65002, 1.15, 0, 0, 1.0], "8747": [0.86225, 1.36, 0.44445, 0, 0.55556], "8748": [0.862, 1.36, 0.44445, 0, 0.55556], "8749": [0.862, 1.36, 0.44445, 0, 0.55556], "8750": [0.86225, 1.36, 0.44445, 0, 0.55556], "8896": [0.55001, 1.05, 0, 0, 1.11111], "8897": [0.55001, 1.05, 0, 0, 1.11111], "8898": [0.55001, 1.05, 0, 0, 1.11111], "8899": [0.55001, 1.05, 0, 0, 1.11111], "8968": [0.65002, 1.15, 0, 0, 0.52778], "8969": [0.65002, 1.15, 0, 0, 0.52778], "8970": [0.65002, 1.15, 0, 0, 0.52778], "8971": [0.65002, 1.15, 0, 0, 0.52778], "10216": [0.65002, 1.15, 0, 0, 0.61111], "10217": [0.65002, 1.15, 0, 0, 0.61111], "10752": [0.55001, 1.05, 0, 0, 1.51112], "10753": [0.55001, 1.05, 0, 0, 1.51112], "10754": [0.55001, 1.05, 0, 0, 1.51112], "10756": [0.55001, 1.05, 0, 0, 1.11111], "10758": [0.55001, 1.05, 0, 0, 1.11111] }, "Size3-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [0.95003, 1.45, 0, 0, 0.73611], "41": [0.95003, 1.45, 0, 0, 0.73611], "47": [0.95003, 1.45, 0, 0, 1.04445], "91": [0.95003, 1.45, 0, 0, 0.52778], "92": [0.95003, 1.45, 0, 0, 1.04445], "93": [0.95003, 1.45, 0, 0, 0.52778], "123": [0.95003, 1.45, 0, 0, 0.75], "125": [0.95003, 1.45, 0, 0, 0.75], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.75, 0, 0, 1.44445], "732": [0, 0.75, 0, 0, 1.44445], "770": [0, 0.75, 0, 0, 1.44445], "771": [0, 0.75, 0, 0, 1.44445], "8730": [0.95003, 1.45, 0, 0, 1.0], "8968": [0.95003, 1.45, 0, 0, 0.58334], "8969": [0.95003, 1.45, 0, 0, 0.58334], "8970": [0.95003, 1.45, 0, 0, 0.58334], "8971": [0.95003, 1.45, 0, 0, 0.58334], "10216": [0.95003, 1.45, 0, 0, 0.75], "10217": [0.95003, 1.45, 0, 0, 0.75] }, "Size4-Regular": { "32": [0, 0, 0, 0, 0.25], "40": [1.25003, 1.75, 0, 0, 0.79167], "41": [1.25003, 1.75, 0, 0, 0.79167], "47": [1.25003, 1.75, 0, 0, 1.27778], "91": [1.25003, 1.75, 0, 0, 0.58334], "92": [1.25003, 1.75, 0, 0, 1.27778], "93": [1.25003, 1.75, 0, 0, 0.58334], "123": [1.25003, 1.75, 0, 0, 0.80556], "125": [1.25003, 1.75, 0, 0, 0.80556], "160": [0, 0, 0, 0, 0.25], "710": [0, 0.825, 0, 0, 1.8889], "732": [0, 0.825, 0, 0, 1.8889], "770": [0, 0.825, 0, 0, 1.8889], "771": [0, 0.825, 0, 0, 1.8889], "8730": [1.25003, 1.75, 0, 0, 1.0], "8968": [1.25003, 1.75, 0, 0, 0.63889], "8969": [1.25003, 1.75, 0, 0, 0.63889], "8970": [1.25003, 1.75, 0, 0, 0.63889], "8971": [1.25003, 1.75, 0, 0, 0.63889], "9115": [0.64502, 1.155, 0, 0, 0.875], "9116": [1e-05, 0.6, 0, 0, 0.875], "9117": [0.64502, 1.155, 0, 0, 0.875], "9118": [0.64502, 1.155, 0, 0, 0.875], "9119": [1e-05, 0.6, 0, 0, 0.875], "9120": [0.64502, 1.155, 0, 0, 0.875], "9121": [0.64502, 1.155, 0, 0, 0.66667], "9122": [-0.00099, 0.601, 0, 0, 0.66667], "9123": [0.64502, 1.155, 0, 0, 0.66667], "9124": [0.64502, 1.155, 0, 0, 0.66667], "9125": [-0.00099, 0.601, 0, 0, 0.66667], "9126": [0.64502, 1.155, 0, 0, 0.66667], "9127": [1e-05, 0.9, 0, 0, 0.88889], "9128": [0.65002, 1.15, 0, 0, 0.88889], "9129": [0.90001, 0, 0, 0, 0.88889], "9130": [0, 0.3, 0, 0, 0.88889], "9131": [1e-05, 0.9, 0, 0, 0.88889], "9132": [0.65002, 1.15, 0, 0, 0.88889], "9133": [0.90001, 0, 0, 0, 0.88889], "9143": [0.88502, 0.915, 0, 0, 1.05556], "10216": [1.25003, 1.75, 0, 0, 0.80556], "10217": [1.25003, 1.75, 0, 0, 0.80556], "57344": [-0.00499, 0.605, 0, 0, 1.05556], "57345": [-0.00499, 0.605, 0, 0, 1.05556], "57680": [0, 0.12, 0, 0, 0.45], "57681": [0, 0.12, 0, 0, 0.45], "57682": [0, 0.12, 0, 0, 0.45], "57683": [0, 0.12, 0, 0, 0.45] }, "Typewriter-Regular": { "32": [0, 0, 0, 0, 0.525], "33": [0, 0.61111, 0, 0, 0.525], "34": [0, 0.61111, 0, 0, 0.525], "35": [0, 0.61111, 0, 0, 0.525], "36": [0.08333, 0.69444, 0, 0, 0.525], "37": [0.08333, 0.69444, 0, 0, 0.525], "38": [0, 0.61111, 0, 0, 0.525], "39": [0, 0.61111, 0, 0, 0.525], "40": [0.08333, 0.69444, 0, 0, 0.525], "41": [0.08333, 0.69444, 0, 0, 0.525], "42": [0, 0.52083, 0, 0, 0.525], "43": [-0.08056, 0.53055, 0, 0, 0.525], "44": [0.13889, 0.125, 0, 0, 0.525], "45": [-0.08056, 0.53055, 0, 0, 0.525], "46": [0, 0.125, 0, 0, 0.525], "47": [0.08333, 0.69444, 0, 0, 0.525], "48": [0, 0.61111, 0, 0, 0.525], "49": [0, 0.61111, 0, 0, 0.525], "50": [0, 0.61111, 0, 0, 0.525], "51": [0, 0.61111, 0, 0, 0.525], "52": [0, 0.61111, 0, 0, 0.525], "53": [0, 0.61111, 0, 0, 0.525], "54": [0, 0.61111, 0, 0, 0.525], "55": [0, 0.61111, 0, 0, 0.525], "56": [0, 0.61111, 0, 0, 0.525], "57": [0, 0.61111, 0, 0, 0.525], "58": [0, 0.43056, 0, 0, 0.525], "59": [0.13889, 0.43056, 0, 0, 0.525], "60": [-0.05556, 0.55556, 0, 0, 0.525], "61": [-0.19549, 0.41562, 0, 0, 0.525], "62": [-0.05556, 0.55556, 0, 0, 0.525], "63": [0, 0.61111, 0, 0, 0.525], "64": [0, 0.61111, 0, 0, 0.525], "65": [0, 0.61111, 0, 0, 0.525], "66": [0, 0.61111, 0, 0, 0.525], "67": [0, 0.61111, 0, 0, 0.525], "68": [0, 0.61111, 0, 0, 0.525], "69": [0, 0.61111, 0, 0, 0.525], "70": [0, 0.61111, 0, 0, 0.525], "71": [0, 0.61111, 0, 0, 0.525], "72": [0, 0.61111, 0, 0, 0.525], "73": [0, 0.61111, 0, 0, 0.525], "74": [0, 0.61111, 0, 0, 0.525], "75": [0, 0.61111, 0, 0, 0.525], "76": [0, 0.61111, 0, 0, 0.525], "77": [0, 0.61111, 0, 0, 0.525], "78": [0, 0.61111, 0, 0, 0.525], "79": [0, 0.61111, 0, 0, 0.525], "80": [0, 0.61111, 0, 0, 0.525], "81": [0.13889, 0.61111, 0, 0, 0.525], "82": [0, 0.61111, 0, 0, 0.525], "83": [0, 0.61111, 0, 0, 0.525], "84": [0, 0.61111, 0, 0, 0.525], "85": [0, 0.61111, 0, 0, 0.525], "86": [0, 0.61111, 0, 0, 0.525], "87": [0, 0.61111, 0, 0, 0.525], "88": [0, 0.61111, 0, 0, 0.525], "89": [0, 0.61111, 0, 0, 0.525], "90": [0, 0.61111, 0, 0, 0.525], "91": [0.08333, 0.69444, 0, 0, 0.525], "92": [0.08333, 0.69444, 0, 0, 0.525], "93": [0.08333, 0.69444, 0, 0, 0.525], "94": [0, 0.61111, 0, 0, 0.525], "95": [0.09514, 0, 0, 0, 0.525], "96": [0, 0.61111, 0, 0, 0.525], "97": [0, 0.43056, 0, 0, 0.525], "98": [0, 0.61111, 0, 0, 0.525], "99": [0, 0.43056, 0, 0, 0.525], "100": [0, 0.61111, 0, 0, 0.525], "101": [0, 0.43056, 0, 0, 0.525], "102": [0, 0.61111, 0, 0, 0.525], "103": [0.22222, 0.43056, 0, 0, 0.525], "104": [0, 0.61111, 0, 0, 0.525], "105": [0, 0.61111, 0, 0, 0.525], "106": [0.22222, 0.61111, 0, 0, 0.525], "107": [0, 0.61111, 0, 0, 0.525], "108": [0, 0.61111, 0, 0, 0.525], "109": [0, 0.43056, 0, 0, 0.525], "110": [0, 0.43056, 0, 0, 0.525], "111": [0, 0.43056, 0, 0, 0.525], "112": [0.22222, 0.43056, 0, 0, 0.525], "113": [0.22222, 0.43056, 0, 0, 0.525], "114": [0, 0.43056, 0, 0, 0.525], "115": [0, 0.43056, 0, 0, 0.525], "116": [0, 0.55358, 0, 0, 0.525], "117": [0, 0.43056, 0, 0, 0.525], "118": [0, 0.43056, 0, 0, 0.525], "119": [0, 0.43056, 0, 0, 0.525], "120": [0, 0.43056, 0, 0, 0.525], "121": [0.22222, 0.43056, 0, 0, 0.525], "122": [0, 0.43056, 0, 0, 0.525], "123": [0.08333, 0.69444, 0, 0, 0.525], "124": [0.08333, 0.69444, 0, 0, 0.525], "125": [0.08333, 0.69444, 0, 0, 0.525], "126": [0, 0.61111, 0, 0, 0.525], "127": [0, 0.61111, 0, 0, 0.525], "160": [0, 0, 0, 0, 0.525], "176": [0, 0.61111, 0, 0, 0.525], "184": [0.19445, 0, 0, 0, 0.525], "305": [0, 0.43056, 0, 0, 0.525], "567": [0.22222, 0.43056, 0, 0, 0.525], "711": [0, 0.56597, 0, 0, 0.525], "713": [0, 0.56555, 0, 0, 0.525], "714": [0, 0.61111, 0, 0, 0.525], "715": [0, 0.61111, 0, 0, 0.525], "728": [0, 0.61111, 0, 0, 0.525], "730": [0, 0.61111, 0, 0, 0.525], "770": [0, 0.61111, 0, 0, 0.525], "771": [0, 0.61111, 0, 0, 0.525], "776": [0, 0.61111, 0, 0, 0.525], "915": [0, 0.61111, 0, 0, 0.525], "916": [0, 0.61111, 0, 0, 0.525], "920": [0, 0.61111, 0, 0, 0.525], "923": [0, 0.61111, 0, 0, 0.525], "926": [0, 0.61111, 0, 0, 0.525], "928": [0, 0.61111, 0, 0, 0.525], "931": [0, 0.61111, 0, 0, 0.525], "933": [0, 0.61111, 0, 0, 0.525], "934": [0, 0.61111, 0, 0, 0.525], "936": [0, 0.61111, 0, 0, 0.525], "937": [0, 0.61111, 0, 0, 0.525], "8216": [0, 0.61111, 0, 0, 0.525], "8217": [0, 0.61111, 0, 0, 0.525], "8242": [0, 0.61111, 0, 0, 0.525], "9251": [0.11111, 0.21944, 0, 0, 0.525] } }; /** * This file contains metrics regarding fonts and individual symbols. The sigma * and xi variables, as well as the metricMap map contain data extracted from * TeX, TeX font metrics, and the TTF files. These data are then exposed via the * `metrics` variable and the getCharacterMetrics function. */ // In TeX, there are actually three sets of dimensions, one for each of // textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4: // 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are // provided in the the arrays below, in that order. // // The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively. // This was determined by running the following script: // // latex -interaction=nonstopmode \ // '\documentclass{article}\usepackage{amsmath}\begin{document}' \ // '$a$ \expandafter\show\the\textfont2' \ // '\expandafter\show\the\scriptfont2' \ // '\expandafter\show\the\scriptscriptfont2' \ // '\stop' // // The metrics themselves were retreived using the following commands: // // tftopl cmsy10 // tftopl cmsy7 // tftopl cmsy5 // // The output of each of these commands is quite lengthy. The only part we // care about is the FONTDIMEN section. Each value is measured in EMs. const sigmasAndXis = { slant: [0.250, 0.250, 0.250], // sigma1 space: [0.000, 0.000, 0.000], // sigma2 stretch: [0.000, 0.000, 0.000], // sigma3 shrink: [0.000, 0.000, 0.000], // sigma4 xHeight: [0.431, 0.431, 0.431], // sigma5 quad: [1.000, 1.171, 1.472], // sigma6 extraSpace: [0.000, 0.000, 0.000], // sigma7 num1: [0.677, 0.732, 0.925], // sigma8 num2: [0.394, 0.384, 0.387], // sigma9 num3: [0.444, 0.471, 0.504], // sigma10 denom1: [0.686, 0.752, 1.025], // sigma11 denom2: [0.345, 0.344, 0.532], // sigma12 sup1: [0.413, 0.503, 0.504], // sigma13 sup2: [0.363, 0.431, 0.404], // sigma14 sup3: [0.289, 0.286, 0.294], // sigma15 sub1: [0.150, 0.143, 0.200], // sigma16 sub2: [0.247, 0.286, 0.400], // sigma17 supDrop: [0.386, 0.353, 0.494], // sigma18 subDrop: [0.050, 0.071, 0.100], // sigma19 delim1: [2.390, 1.700, 1.980], // sigma20 delim2: [1.010, 1.157, 1.420], // sigma21 axisHeight: [0.250, 0.250, 0.250], // sigma22 // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; // they correspond to the font parameters of the extension fonts (family 3). // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to // match cmex7, we'd use cmex7.tfm values for script and scriptscript // values. defaultRuleThickness: [0.04, 0.049, 0.049], // xi8; cmex7: 0.049 bigOpSpacing1: [0.111, 0.111, 0.111], // xi9 bigOpSpacing2: [0.166, 0.166, 0.166], // xi10 bigOpSpacing3: [0.2, 0.2, 0.2], // xi11 bigOpSpacing4: [0.6, 0.611, 0.611], // xi12; cmex7: 0.611 bigOpSpacing5: [0.1, 0.143, 0.143], // xi13; cmex7: 0.143 // The \sqrt rule width is taken from the height of the surd character. // Since we use the same font at all sizes, this thickness doesn't scale. sqrtRuleThickness: [0.04, 0.04, 0.04], // This value determines how large a pt is, for metrics which are defined // in terms of pts. // This value is also used in katex.less; if you change it make sure the // values match. ptPerEm: [10.0, 10.0, 10.0], // The space between adjacent `|` columns in an array definition. From // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. doubleRuleSep: [0.2, 0.2, 0.2], // The width of separator lines in {array} environments. From // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm. arrayRuleWidth: [0.04, 0.04, 0.04], // Two values from LaTeX source2e: fboxsep: [0.3, 0.3, 0.3], // 3 pt / ptPerEm fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm }; // This map contains a mapping from font name and character code to character // should have Latin-1 and Cyrillic characters, but may not depending on the // operating system. The metrics do not account for extra height from the // accents. In the case of Cyrillic characters which have both ascenders and // descenders we prefer approximations with ascenders, primarily to prevent // the fraction bar or root line from intersecting the glyph. // TODO(kevinb) allow union of multiple glyph metrics for better accuracy. const extraCharacterMap = { // Latin-1 'Å': 'A', 'Ç': 'C', 'Ð': 'D', 'Þ': 'o', 'å': 'a', 'ç': 'c', 'ð': 'd', 'þ': 'o', // Cyrillic 'А': 'A', 'Б': 'B', 'В': 'B', 'Г': 'F', 'Д': 'A', 'Е': 'E', 'Ж': 'K', 'З': '3', 'И': 'N', 'Й': 'N', 'К': 'K', 'Л': 'N', 'М': 'M', 'Н': 'H', 'О': 'O', 'П': 'N', 'Р': 'P', 'С': 'C', 'Т': 'T', 'У': 'y', 'Ф': 'O', 'Х': 'X', 'Ц': 'U', 'Ч': 'h', 'Ш': 'W', 'Щ': 'W', 'Ъ': 'B', 'Ы': 'X', 'Ь': 'B', 'Э': '3', 'Ю': 'X', 'Я': 'R', 'а': 'a', 'б': 'b', 'в': 'a', 'г': 'r', 'д': 'y', 'е': 'e', 'ж': 'm', 'з': 'e', 'и': 'n', 'й': 'n', 'к': 'n', 'л': 'n', 'м': 'm', 'н': 'n', 'о': 'o', 'п': 'n', 'р': 'p', 'с': 'c', 'т': 'o', 'у': 'y', 'ф': 'b', 'х': 'x', 'ц': 'n', 'ч': 'n', 'ш': 'w', 'щ': 'w', 'ъ': 'a', 'ы': 'm', 'ь': 'a', 'э': 'e', 'ю': 'm', 'я': 'r' }; /** * This function adds new font metrics to default metricMap * It can also override existing metrics */ function setFontMetrics(fontName, metrics) { metricMap[fontName] = metrics; } /** * This function is a convenience function for looking up information in the * metricMap table. It takes a character as a string, and a font. * * Note: the `width` property may be undefined if fontMetricsData.js wasn't * built using `Make extended_metrics`. */ function getCharacterMetrics(character, font, mode) { if (!metricMap[font]) { throw new Error(`Font metrics not found for font: ${font}.`); } let ch = character.charCodeAt(0); let metrics = metricMap[font][ch]; if (!metrics && character[0] in extraCharacterMap) { ch = extraCharacterMap[character[0]].charCodeAt(0); metrics = metricMap[font][ch]; } if (!metrics && mode === 'text') { // We don't typically have font metrics for Asian scripts. // But since we support them in text mode, we need to return // some sort of metrics. // So if the character is in a script we support but we // don't have metrics for it, just use the metrics for // the Latin capital letter M. This is close enough because // we (currently) only care about the height of the glpyh // not its width. if (supportedCodepoint(ch)) { metrics = metricMap[font][77]; // 77 is the charcode for 'M' } } if (metrics) { return { depth: metrics[0], height: metrics[1], italic: metrics[2], skew: metrics[3], width: metrics[4] }; } } const fontMetricsBySizeIndex = {}; /** * Get the font metrics for a given size. */ function getGlobalMetrics(size) { let sizeIndex; if (size >= 5) { sizeIndex = 0; } else if (size >= 3) { sizeIndex = 1; } else { sizeIndex = 2; } if (!fontMetricsBySizeIndex[sizeIndex]) { const metrics = fontMetricsBySizeIndex[sizeIndex] = { cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 }; for (const key in sigmasAndXis) { if (sigmasAndXis.hasOwnProperty(key)) { metrics[key] = sigmasAndXis[key][sizeIndex]; } } } return fontMetricsBySizeIndex[sizeIndex]; } /** * This file holds a list of all no-argument functions and single-character * symbols (like 'a' or ';'). * * For each of the symbols, there are three properties they can have: * - font (required): the font to be used for this symbol. Either "main" (the normal font), or "ams" (the ams fonts). * - group (required): the ParseNode group type the symbol should have (i.e. "textord", "mathord", etc). See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types * - replace: the character that this symbol or function should be * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi * character in the main font). * * The outermost map in the table indicates what mode the symbols should be * accepted in (e.g. "math" or "text"). */ // Some of these have a "-token" suffix since these are also used as `ParseNode` // types for raw text tokens, and we want to avoid conflicts with higher-level // `ParseNode` types. These `ParseNode`s are constructed within `Parser` by // looking up the `symbols` map. const ATOMS = { "bin": 1, "close": 1, "inner": 1, "open": 1, "punct": 1, "rel": 1 }; const NON_ATOMS = { "accent-token": 1, "mathord": 1, "op-token": 1, "spacing": 1, "textord": 1 }; const symbols = { "math": {}, "text": {} }; /** `acceptUnicodeChar = true` is only applicable if `replace` is set. */ function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { symbols[mode][name] = { font, group, replace }; if (acceptUnicodeChar && replace) { symbols[mode][replace] = symbols[mode][name]; } } // Some abbreviations for commonly used strings. // This helps minify the code, and also spotting typos using jshint. // modes: const math = "math"; const text$1 = "text"; // fonts: const main = "main"; const ams = "ams"; // groups: const accent = "accent-token"; const bin = "bin"; const close = "close"; const inner = "inner"; const mathord = "mathord"; const op = "op-token"; const open = "open"; const punct = "punct"; const rel = "rel"; const spacing = "spacing"; const textord = "textord"; // Now comes the symbol table // Relation Symbols defineSymbol(math, main, rel, "\u2261", "\\equiv", true); defineSymbol(math, main, rel, "\u227a", "\\prec", true); defineSymbol(math, main, rel, "\u227b", "\\succ", true); defineSymbol(math, main, rel, "\u223c", "\\sim", true); defineSymbol(math, main, rel, "\u22a5", "\\perp"); defineSymbol(math, main, rel, "\u2aaf", "\\preceq", true); defineSymbol(math, main, rel, "\u2ab0", "\\succeq", true); defineSymbol(math, main, rel, "\u2243", "\\simeq", true); defineSymbol(math, main, rel, "\u2223", "\\mid", true); defineSymbol(math, main, rel, "\u226a", "\\ll", true); defineSymbol(math, main, rel, "\u226b", "\\gg", true); defineSymbol(math, main, rel, "\u224d", "\\asymp", true); defineSymbol(math, main, rel, "\u2225", "\\parallel"); defineSymbol(math, main, rel, "\u22c8", "\\bowtie", true); defineSymbol(math, main, rel, "\u2323", "\\smile", true); defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true); defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true); defineSymbol(math, main, rel, "\u2250", "\\doteq", true); defineSymbol(math, main, rel, "\u2322", "\\frown", true); defineSymbol(math, main, rel, "\u220b", "\\ni", true); defineSymbol(math, main, rel, "\u221d", "\\propto", true); defineSymbol(math, main, rel, "\u22a2", "\\vdash", true); defineSymbol(math, main, rel, "\u22a3", "\\dashv", true); defineSymbol(math, main, rel, "\u220b", "\\owns"); // Punctuation defineSymbol(math, main, punct, "\u002e", "\\ldotp"); defineSymbol(math, main, punct, "\u22c5", "\\cdotp"); // Misc Symbols defineSymbol(math, main, textord, "\u0023", "\\#"); defineSymbol(text$1, main, textord, "\u0023", "\\#"); defineSymbol(math, main, textord, "\u0026", "\\&"); defineSymbol(text$1, main, textord, "\u0026", "\\&"); defineSymbol(math, main, textord, "\u2135", "\\aleph", true); defineSymbol(math, main, textord, "\u2200", "\\forall", true); defineSymbol(math, main, textord, "\u210f", "\\hbar", true); defineSymbol(math, main, textord, "\u2203", "\\exists", true); defineSymbol(math, main, textord, "\u2207", "\\nabla", true); defineSymbol(math, main, textord, "\u266d", "\\flat", true); defineSymbol(math, main, textord, "\u2113", "\\ell", true); defineSymbol(math, main, textord, "\u266e", "\\natural", true); defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true); defineSymbol(math, main, textord, "\u2118", "\\wp", true); defineSymbol(math, main, textord, "\u266f", "\\sharp", true); defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true); defineSymbol(math, main, textord, "\u211c", "\\Re", true); defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true); defineSymbol(math, main, textord, "\u2111", "\\Im", true); defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true); defineSymbol(text$1, main, textord, "\u00a7", "\\S", true); defineSymbol(text$1, main, textord, "\u00b6", "\\P", true); // Math and Text defineSymbol(math, main, textord, "\u2020", "\\dag"); defineSymbol(text$1, main, textord, "\u2020", "\\dag"); defineSymbol(text$1, main, textord, "\u2020", "\\textdagger"); defineSymbol(math, main, textord, "\u2021", "\\ddag"); defineSymbol(text$1, main, textord, "\u2021", "\\ddag"); defineSymbol(text$1, main, textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters defineSymbol(math, main, close, "\u23b1", "\\rmoustache", true); defineSymbol(math, main, open, "\u23b0", "\\lmoustache", true); defineSymbol(math, main, close, "\u27ef", "\\rgroup", true); defineSymbol(math, main, open, "\u27ee", "\\lgroup", true); // Binary Operators defineSymbol(math, main, bin, "\u2213", "\\mp", true); defineSymbol(math, main, bin, "\u2296", "\\ominus", true); defineSymbol(math, main, bin, "\u228e", "\\uplus", true); defineSymbol(math, main, bin, "\u2293", "\\sqcap", true); defineSymbol(math, main, bin, "\u2217", "\\ast"); defineSymbol(math, main, bin, "\u2294", "\\sqcup", true); defineSymbol(math, main, bin, "\u25ef", "\\bigcirc"); defineSymbol(math, main, bin, "\u2219", "\\bullet"); defineSymbol(math, main, bin, "\u2021", "\\ddagger"); defineSymbol(math, main, bin, "\u2240", "\\wr", true); defineSymbol(math, main, bin, "\u2a3f", "\\amalg"); defineSymbol(math, main, bin, "\u0026", "\\And"); // from amsmath // Arrow Symbols defineSymbol(math, main, rel, "\u27f5", "\\longleftarrow", true); defineSymbol(math, main, rel, "\u21d0", "\\Leftarrow", true); defineSymbol(math, main, rel, "\u27f8", "\\Longleftarrow", true); defineSymbol(math, main, rel, "\u27f6", "\\longrightarrow", true); defineSymbol(math, main, rel, "\u21d2", "\\Rightarrow", true); defineSymbol(math, main, rel, "\u27f9", "\\Longrightarrow", true); defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true); defineSymbol(math, main, rel, "\u27f7", "\\longleftrightarrow", true); defineSymbol(math, main, rel, "\u21d4", "\\Leftrightarrow", true); defineSymbol(math, main, rel, "\u27fa", "\\Longleftrightarrow", true); defineSymbol(math, main, rel, "\u21a6", "\\mapsto", true); defineSymbol(math, main, rel, "\u27fc", "\\longmapsto", true); defineSymbol(math, main, rel, "\u2197", "\\nearrow", true); defineSymbol(math, main, rel, "\u21a9", "\\hookleftarrow", true); defineSymbol(math, main, rel, "\u21aa", "\\hookrightarrow", true); defineSymbol(math, main, rel, "\u2198", "\\searrow", true); defineSymbol(math, main, rel, "\u21bc", "\\leftharpoonup", true); defineSymbol(math, main, rel, "\u21c0", "\\rightharpoonup", true); defineSymbol(math, main, rel, "\u2199", "\\swarrow", true); defineSymbol(math, main, rel, "\u21bd", "\\leftharpoondown", true); defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown", true); defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true); defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons", true); // AMS Negated Binary Relations defineSymbol(math, ams, rel, "\u226e", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro. defineSymbol(math, ams, rel, "\ue010", "\\@nleqslant"); defineSymbol(math, ams, rel, "\ue011", "\\@nleqq"); defineSymbol(math, ams, rel, "\u2a87", "\\lneq", true); defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true); defineSymbol(math, ams, rel, "\ue00c", "\\@lvertneqq"); defineSymbol(math, ams, rel, "\u22e6", "\\lnsim", true); defineSymbol(math, ams, rel, "\u2a89", "\\lnapprox", true); defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. defineSymbol(math, ams, rel, "\u22e0", "\\npreceq", true); defineSymbol(math, ams, rel, "\u22e8", "\\precnsim", true); defineSymbol(math, ams, rel, "\u2ab9", "\\precnapprox", true); defineSymbol(math, ams, rel, "\u2241", "\\nsim", true); defineSymbol(math, ams, rel, "\ue006", "\\@nshortmid"); defineSymbol(math, ams, rel, "\u2224", "\\nmid", true); defineSymbol(math, ams, rel, "\u22ac", "\\nvdash", true); defineSymbol(math, ams, rel, "\u22ad", "\\nvDash", true); defineSymbol(math, ams, rel, "\u22ea", "\\ntriangleleft"); defineSymbol(math, ams, rel, "\u22ec", "\\ntrianglelefteq", true); defineSymbol(math, ams, rel, "\u228a", "\\subsetneq", true); defineSymbol(math, ams, rel, "\ue01a", "\\@varsubsetneq"); defineSymbol(math, ams, rel, "\u2acb", "\\subsetneqq", true); defineSymbol(math, ams, rel, "\ue017", "\\@varsubsetneqq"); defineSymbol(math, ams, rel, "\u226f", "\\ngtr", true); defineSymbol(math, ams, rel, "\ue00f", "\\@ngeqslant"); defineSymbol(math, ams, rel, "\ue00e", "\\@ngeqq"); defineSymbol(math, ams, rel, "\u2a88", "\\gneq", true); defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true); defineSymbol(math, ams, rel, "\ue00d", "\\@gvertneqq"); defineSymbol(math, ams, rel, "\u22e7", "\\gnsim", true); defineSymbol(math, ams, rel, "\u2a8a", "\\gnapprox", true); defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. defineSymbol(math, ams, rel, "\u22e1", "\\nsucceq", true); defineSymbol(math, ams, rel, "\u22e9", "\\succnsim", true); defineSymbol(math, ams, rel, "\u2aba", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. defineSymbol(math, ams, rel, "\u2246", "\\ncong", true); defineSymbol(math, ams, rel, "\ue007", "\\@nshortparallel"); defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true); defineSymbol(math, ams, rel, "\u22af", "\\nVDash", true); defineSymbol(math, ams, rel, "\u22eb", "\\ntriangleright"); defineSymbol(math, ams, rel, "\u22ed", "\\ntrianglerighteq", true); defineSymbol(math, ams, rel, "\ue018", "\\@nsupseteqq"); defineSymbol(math, ams, rel, "\u228b", "\\supsetneq", true); defineSymbol(math, ams, rel, "\ue01b", "\\@varsupsetneq"); defineSymbol(math, ams, rel, "\u2acc", "\\supsetneqq", true); defineSymbol(math, ams, rel, "\ue019", "\\@varsupsetneqq"); defineSymbol(math, ams, rel, "\u22ae", "\\nVdash", true); defineSymbol(math, ams, rel, "\u2ab5", "\\precneqq", true); defineSymbol(math, ams, rel, "\u2ab6", "\\succneqq", true); defineSymbol(math, ams, rel, "\ue016", "\\@nsubseteqq"); defineSymbol(math, ams, bin, "\u22b4", "\\unlhd"); defineSymbol(math, ams, bin, "\u22b5", "\\unrhd"); // AMS Negated Arrows defineSymbol(math, ams, rel, "\u219a", "\\nleftarrow", true); defineSymbol(math, ams, rel, "\u219b", "\\nrightarrow", true); defineSymbol(math, ams, rel, "\u21cd", "\\nLeftarrow", true); defineSymbol(math, ams, rel, "\u21cf", "\\nRightarrow", true); defineSymbol(math, ams, rel, "\u21ae", "\\nleftrightarrow", true); defineSymbol(math, ams, rel, "\u21ce", "\\nLeftrightarrow", true); // AMS Misc defineSymbol(math, ams, rel, "\u25b3", "\\vartriangle"); defineSymbol(math, ams, textord, "\u210f", "\\hslash"); defineSymbol(math, ams, textord, "\u25bd", "\\triangledown"); defineSymbol(math, ams, textord, "\u25ca", "\\lozenge"); defineSymbol(math, ams, textord, "\u24c8", "\\circledS"); defineSymbol(math, ams, textord, "\u00ae", "\\circledR"); defineSymbol(text$1, ams, textord, "\u00ae", "\\circledR"); defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true); defineSymbol(math, ams, textord, "\u2204", "\\nexists"); defineSymbol(math, ams, textord, "\u2127", "\\mho"); defineSymbol(math, ams, textord, "\u2132", "\\Finv", true); defineSymbol(math, ams, textord, "\u2141", "\\Game", true); defineSymbol(math, ams, textord, "\u2035", "\\backprime"); defineSymbol(math, ams, textord, "\u25b2", "\\blacktriangle"); defineSymbol(math, ams, textord, "\u25bc", "\\blacktriangledown"); defineSymbol(math, ams, textord, "\u25a0", "\\blacksquare"); defineSymbol(math, ams, textord, "\u29eb", "\\blacklozenge"); defineSymbol(math, ams, textord, "\u2605", "\\bigstar"); defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true); defineSymbol(math, ams, textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 to \matheth. We map to AMS function \eth defineSymbol(math, ams, textord, "\u00f0", "\\eth", true); defineSymbol(text$1, main, textord, "\u00f0", "\u00f0"); defineSymbol(math, ams, textord, "\u2571", "\\diagup"); defineSymbol(math, ams, textord, "\u2572", "\\diagdown"); defineSymbol(math, ams, textord, "\u25a1", "\\square"); defineSymbol(math, ams, textord, "\u25a1", "\\Box"); defineSymbol(math, ams, textord, "\u25ca", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen defineSymbol(math, ams, textord, "\u00a5", "\\yen", true); defineSymbol(text$1, ams, textord, "\u00a5", "\\yen", true); defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true); defineSymbol(text$1, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew defineSymbol(math, ams, textord, "\u2136", "\\beth", true); defineSymbol(math, ams, textord, "\u2138", "\\daleth", true); defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); // AMS Greek defineSymbol(math, ams, textord, "\u03dd", "\\digamma", true); defineSymbol(math, ams, textord, "\u03f0", "\\varkappa"); // AMS Delimiters defineSymbol(math, ams, open, "\u250c", "\\@ulcorner", true); defineSymbol(math, ams, close, "\u2510", "\\@urcorner", true); defineSymbol(math, ams, open, "\u2514", "\\@llcorner", true); defineSymbol(math, ams, close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations defineSymbol(math, ams, rel, "\u2266", "\\leqq", true); defineSymbol(math, ams, rel, "\u2a7d", "\\leqslant", true); defineSymbol(math, ams, rel, "\u2a95", "\\eqslantless", true); defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true); defineSymbol(math, ams, rel, "\u2a85", "\\lessapprox", true); defineSymbol(math, ams, rel, "\u224a", "\\approxeq", true); defineSymbol(math, ams, bin, "\u22d6", "\\lessdot"); defineSymbol(math, ams, rel, "\u22d8", "\\lll", true); defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true); defineSymbol(math, ams, rel, "\u22da", "\\lesseqgtr", true); defineSymbol(math, ams, rel, "\u2a8b", "\\lesseqqgtr", true); defineSymbol(math, ams, rel, "\u2251", "\\doteqdot"); defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true); defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true); defineSymbol(math, ams, rel, "\u223d", "\\backsim", true); defineSymbol(math, ams, rel, "\u22cd", "\\backsimeq", true); defineSymbol(math, ams, rel, "\u2ac5", "\\subseteqq", true); defineSymbol(math, ams, rel, "\u22d0", "\\Subset", true); defineSymbol(math, ams, rel, "\u228f", "\\sqsubset", true); defineSymbol(math, ams, rel, "\u227c", "\\preccurlyeq", true); defineSymbol(math, ams, rel, "\u22de", "\\curlyeqprec", true); defineSymbol(math, ams, rel, "\u227e", "\\precsim", true); defineSymbol(math, ams, rel, "\u2ab7", "\\precapprox", true); defineSymbol(math, ams, rel, "\u22b2", "\\vartriangleleft"); defineSymbol(math, ams, rel, "\u22b4", "\\trianglelefteq"); defineSymbol(math, ams, rel, "\u22a8", "\\vDash", true); defineSymbol(math, ams, rel, "\u22aa", "\\Vvdash", true); defineSymbol(math, ams, rel, "\u2323", "\\smallsmile"); defineSymbol(math, ams, rel, "\u2322", "\\smallfrown"); defineSymbol(math, ams, rel, "\u224f", "\\bumpeq", true); defineSymbol(math, ams, rel, "\u224e", "\\Bumpeq", true); defineSymbol(math, ams, rel, "\u2267", "\\geqq", true); defineSymbol(math, ams, rel, "\u2a7e", "\\geqslant", true); defineSymbol(math, ams, rel, "\u2a96", "\\eqslantgtr", true); defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true); defineSymbol(math, ams, rel, "\u2a86", "\\gtrapprox", true); defineSymbol(math, ams, bin, "\u22d7", "\\gtrdot"); defineSymbol(math, ams, rel, "\u22d9", "\\ggg", true); defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true); defineSymbol(math, ams, rel, "\u22db", "\\gtreqless", true); defineSymbol(math, ams, rel, "\u2a8c", "\\gtreqqless", true); defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true); defineSymbol(math, ams, rel, "\u2257", "\\circeq", true); defineSymbol(math, ams, rel, "\u225c", "\\triangleq", true); defineSymbol(math, ams, rel, "\u223c", "\\thicksim"); defineSymbol(math, ams, rel, "\u2248", "\\thickapprox"); defineSymbol(math, ams, rel, "\u2ac6", "\\supseteqq", true); defineSymbol(math, ams, rel, "\u22d1", "\\Supset", true); defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true); defineSymbol(math, ams, rel, "\u227d", "\\succcurlyeq", true); defineSymbol(math, ams, rel, "\u22df", "\\curlyeqsucc", true); defineSymbol(math, ams, rel, "\u227f", "\\succsim", true); defineSymbol(math, ams, rel, "\u2ab8", "\\succapprox", true); defineSymbol(math, ams, rel, "\u22b3", "\\vartriangleright"); defineSymbol(math, ams, rel, "\u22b5", "\\trianglerighteq"); defineSymbol(math, ams, rel, "\u22a9", "\\Vdash", true); defineSymbol(math, ams, rel, "\u2223", "\\shortmid"); defineSymbol(math, ams, rel, "\u2225", "\\shortparallel"); defineSymbol(math, ams, rel, "\u226c", "\\between", true); defineSymbol(math, ams, rel, "\u22d4", "\\pitchfork", true); defineSymbol(math, ams, rel, "\u221d", "\\varpropto"); defineSymbol(math, ams, rel, "\u25c0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom. // We kept the amssymb atom type, which is rel. defineSymbol(math, ams, rel, "\u2234", "\\therefore", true); defineSymbol(math, ams, rel, "\u220d", "\\backepsilon"); defineSymbol(math, ams, rel, "\u25b6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom. // We kept the amssymb atom type, which is rel. defineSymbol(math, ams, rel, "\u2235", "\\because", true); defineSymbol(math, ams, rel, "\u22d8", "\\llless"); defineSymbol(math, ams, rel, "\u22d9", "\\gggtr"); defineSymbol(math, ams, bin, "\u22b2", "\\lhd"); defineSymbol(math, ams, bin, "\u22b3", "\\rhd"); defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true); defineSymbol(math, main, rel, "\u22c8", "\\Join"); defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true); defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus"); defineSymbol(math, ams, bin, "\u22d2", "\\Cap", true); defineSymbol(math, ams, bin, "\u22d3", "\\Cup", true); defineSymbol(math, ams, bin, "\u2a5e", "\\doublebarwedge", true); defineSymbol(math, ams, bin, "\u229f", "\\boxminus", true); defineSymbol(math, ams, bin, "\u229e", "\\boxplus", true); defineSymbol(math, ams, bin, "\u22c7", "\\divideontimes", true); defineSymbol(math, ams, bin, "\u22c9", "\\ltimes", true); defineSymbol(math, ams, bin, "\u22ca", "\\rtimes", true); defineSymbol(math, ams, bin, "\u22cb", "\\leftthreetimes", true); defineSymbol(math, ams, bin, "\u22cc", "\\rightthreetimes", true); defineSymbol(math, ams, bin, "\u22cf", "\\curlywedge", true); defineSymbol(math, ams, bin, "\u22ce", "\\curlyvee", true); defineSymbol(math, ams, bin, "\u229d", "\\circleddash", true); defineSymbol(math, ams, bin, "\u229b", "\\circledast", true); defineSymbol(math, ams, bin, "\u22c5", "\\centerdot"); defineSymbol(math, ams, bin, "\u22ba", "\\intercal", true); defineSymbol(math, ams, bin, "\u22d2", "\\doublecap"); defineSymbol(math, ams, bin, "\u22d3", "\\doublecup"); defineSymbol(math, ams, bin, "\u22a0", "\\boxtimes", true); // AMS Arrows // Note: unicode-math maps \u21e2 to their own function \rightdasharrow. // We'll map it to AMS function \dashrightarrow. It produces the same atom. defineSymbol(math, ams, rel, "\u21e2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. defineSymbol(math, ams, rel, "\u21e0", "\\dashleftarrow", true); defineSymbol(math, ams, rel, "\u21c7", "\\leftleftarrows", true); defineSymbol(math, ams, rel, "\u21c6", "\\leftrightarrows", true); defineSymbol(math, ams, rel, "\u21da", "\\Lleftarrow", true); defineSymbol(math, ams, rel, "\u219e", "\\twoheadleftarrow", true); defineSymbol(math, ams, rel, "\u21a2", "\\leftarrowtail", true); defineSymbol(math, ams, rel, "\u21ab", "\\looparrowleft", true); defineSymbol(math, ams, rel, "\u21cb", "\\leftrightharpoons", true); defineSymbol(math, ams, rel, "\u21b6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. defineSymbol(math, ams, rel, "\u21ba", "\\circlearrowleft", true); defineSymbol(math, ams, rel, "\u21b0", "\\Lsh", true); defineSymbol(math, ams, rel, "\u21c8", "\\upuparrows", true); defineSymbol(math, ams, rel, "\u21bf", "\\upharpoonleft", true); defineSymbol(math, ams, rel, "\u21c3", "\\downharpoonleft", true); defineSymbol(math, ams, rel, "\u22b8", "\\multimap", true); defineSymbol(math, ams, rel, "\u21ad", "\\leftrightsquigarrow", true); defineSymbol(math, ams, rel, "\u21c9", "\\rightrightarrows", true); defineSymbol(math, ams, rel, "\u21c4", "\\rightleftarrows", true); defineSymbol(math, ams, rel, "\u21a0", "\\twoheadrightarrow", true); defineSymbol(math, ams, rel, "\u21a3", "\\rightarrowtail", true); defineSymbol(math, ams, rel, "\u21ac", "\\looparrowright", true); defineSymbol(math, ams, rel, "\u21b7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. defineSymbol(math, ams, rel, "\u21bb", "\\circlearrowright", true); defineSymbol(math, ams, rel, "\u21b1", "\\Rsh", true); defineSymbol(math, ams, rel, "\u21ca", "\\downdownarrows", true); defineSymbol(math, ams, rel, "\u21be", "\\upharpoonright", true); defineSymbol(math, ams, rel, "\u21c2", "\\downharpoonright", true); defineSymbol(math, ams, rel, "\u21dd", "\\rightsquigarrow", true); defineSymbol(math, ams, rel, "\u21dd", "\\leadsto"); defineSymbol(math, ams, rel, "\u21db", "\\Rrightarrow", true); defineSymbol(math, ams, rel, "\u21be", "\\restriction"); defineSymbol(math, main, textord, "\u2018", "`"); defineSymbol(math, main, textord, "$", "\\$"); defineSymbol(text$1, main, textord, "$", "\\$"); defineSymbol(text$1, main, textord, "$", "\\textdollar"); defineSymbol(math, main, textord, "%", "\\%"); defineSymbol(text$1, main, textord, "%", "\\%"); defineSymbol(math, main, textord, "_", "\\_"); defineSymbol(text$1, main, textord, "_", "\\_"); defineSymbol(text$1, main, textord, "_", "\\textunderscore"); defineSymbol(math, main, textord, "\u2220", "\\angle", true); defineSymbol(math, main, textord, "\u221e", "\\infty", true); defineSymbol(math, main, textord, "\u2032", "\\prime"); defineSymbol(math, main, textord, "\u25b3", "\\triangle"); defineSymbol(math, main, textord, "\u0393", "\\Gamma", true); defineSymbol(math, main, textord, "\u0394", "\\Delta", true); defineSymbol(math, main, textord, "\u0398", "\\Theta", true); defineSymbol(math, main, textord, "\u039b", "\\Lambda", true); defineSymbol(math, main, textord, "\u039e", "\\Xi", true); defineSymbol(math, main, textord, "\u03a0", "\\Pi", true); defineSymbol(math, main, textord, "\u03a3", "\\Sigma", true); defineSymbol(math, main, textord, "\u03a5", "\\Upsilon", true); defineSymbol(math, main, textord, "\u03a6", "\\Phi", true); defineSymbol(math, main, textord, "\u03a8", "\\Psi", true); defineSymbol(math, main, textord, "\u03a9", "\\Omega", true); defineSymbol(math, main, textord, "A", "\u0391"); defineSymbol(math, main, textord, "B", "\u0392"); defineSymbol(math, main, textord, "E", "\u0395"); defineSymbol(math, main, textord, "Z", "\u0396"); defineSymbol(math, main, textord, "H", "\u0397"); defineSymbol(math, main, textord, "I", "\u0399"); defineSymbol(math, main, textord, "K", "\u039A"); defineSymbol(math, main, textord, "M", "\u039C"); defineSymbol(math, main, textord, "N", "\u039D"); defineSymbol(math, main, textord, "O", "\u039F"); defineSymbol(math, main, textord, "P", "\u03A1"); defineSymbol(math, main, textord, "T", "\u03A4"); defineSymbol(math, main, textord, "X", "\u03A7"); defineSymbol(math, main, textord, "\u00ac", "\\neg", true); defineSymbol(math, main, textord, "\u00ac", "\\lnot"); defineSymbol(math, main, textord, "\u22a4", "\\top"); defineSymbol(math, main, textord, "\u22a5", "\\bot"); defineSymbol(math, main, textord, "\u2205", "\\emptyset"); defineSymbol(math, ams, textord, "\u2205", "\\varnothing"); defineSymbol(math, main, mathord, "\u03b1", "\\alpha", true); defineSymbol(math, main, mathord, "\u03b2", "\\beta", true); defineSymbol(math, main, mathord, "\u03b3", "\\gamma", true); defineSymbol(math, main, mathord, "\u03b4", "\\delta", true); defineSymbol(math, main, mathord, "\u03f5", "\\epsilon", true); defineSymbol(math, main, mathord, "\u03b6", "\\zeta", true); defineSymbol(math, main, mathord, "\u03b7", "\\eta", true); defineSymbol(math, main, mathord, "\u03b8", "\\theta", true); defineSymbol(math, main, mathord, "\u03b9", "\\iota", true); defineSymbol(math, main, mathord, "\u03ba", "\\kappa", true); defineSymbol(math, main, mathord, "\u03bb", "\\lambda", true); defineSymbol(math, main, mathord, "\u03bc", "\\mu", true); defineSymbol(math, main, mathord, "\u03bd", "\\nu", true); defineSymbol(math, main, mathord, "\u03be", "\\xi", true); defineSymbol(math, main, mathord, "\u03bf", "\\omicron", true); defineSymbol(math, main, mathord, "\u03c0", "\\pi", true); defineSymbol(math, main, mathord, "\u03c1", "\\rho", true); defineSymbol(math, main, mathord, "\u03c3", "\\sigma", true); defineSymbol(math, main, mathord, "\u03c4", "\\tau", true); defineSymbol(math, main, mathord, "\u03c5", "\\upsilon", true); defineSymbol(math, main, mathord, "\u03d5", "\\phi", true); defineSymbol(math, main, mathord, "\u03c7", "\\chi", true); defineSymbol(math, main, mathord, "\u03c8", "\\psi", true); defineSymbol(math, main, mathord, "\u03c9", "\\omega", true); defineSymbol(math, main, mathord, "\u03b5", "\\varepsilon", true); defineSymbol(math, main, mathord, "\u03d1", "\\vartheta", true); defineSymbol(math, main, mathord, "\u03d6", "\\varpi", true); defineSymbol(math, main, mathord, "\u03f1", "\\varrho", true); defineSymbol(math, main, mathord, "\u03c2", "\\varsigma", true); defineSymbol(math, main, mathord, "\u03c6", "\\varphi", true); defineSymbol(math, main, bin, "\u2217", "*"); defineSymbol(math, main, bin, "+", "+"); defineSymbol(math, main, bin, "\u2212", "-"); defineSymbol(math, main, bin, "\u22c5", "\\cdot", true); defineSymbol(math, main, bin, "\u2218", "\\circ"); defineSymbol(math, main, bin, "\u00f7", "\\div", true); defineSymbol(math, main, bin, "\u00b1", "\\pm", true); defineSymbol(math, main, bin, "\u00d7", "\\times", true); defineSymbol(math, main, bin, "\u2229", "\\cap", true); defineSymbol(math, main, bin, "\u222a", "\\cup", true); defineSymbol(math, main, bin, "\u2216", "\\setminus"); defineSymbol(math, main, bin, "\u2227", "\\land"); defineSymbol(math, main, bin, "\u2228", "\\lor"); defineSymbol(math, main, bin, "\u2227", "\\wedge", true); defineSymbol(math, main, bin, "\u2228", "\\vee", true); defineSymbol(math, main, textord, "\u221a", "\\surd"); defineSymbol(math, main, open, "\u27e8", "\\langle", true); defineSymbol(math, main, open, "\u2223", "\\lvert"); defineSymbol(math, main, open, "\u2225", "\\lVert"); defineSymbol(math, main, close, "?", "?"); defineSymbol(math, main, close, "!", "!"); defineSymbol(math, main, close, "\u27e9", "\\rangle", true); defineSymbol(math, main, close, "\u2223", "\\rvert"); defineSymbol(math, main, close, "\u2225", "\\rVert"); defineSymbol(math, main, rel, "=", "="); defineSymbol(math, main, rel, ":", ":"); defineSymbol(math, main, rel, "\u2248", "\\approx", true); defineSymbol(math, main, rel, "\u2245", "\\cong", true); defineSymbol(math, main, rel, "\u2265", "\\ge"); defineSymbol(math, main, rel, "\u2265", "\\geq", true); defineSymbol(math, main, rel, "\u2190", "\\gets"); defineSymbol(math, main, rel, ">", "\\gt", true); defineSymbol(math, main, rel, "\u2208", "\\in", true); defineSymbol(math, main, rel, "\ue020", "\\@not"); defineSymbol(math, main, rel, "\u2282", "\\subset", true); defineSymbol(math, main, rel, "\u2283", "\\supset", true); defineSymbol(math, main, rel, "\u2286", "\\subseteq", true); defineSymbol(math, main, rel, "\u2287", "\\supseteq", true); defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true); defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true); defineSymbol(math, main, rel, "\u22a8", "\\models"); defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true); defineSymbol(math, main, rel, "\u2264", "\\le"); defineSymbol(math, main, rel, "\u2264", "\\leq", true); defineSymbol(math, main, rel, "<", "\\lt", true); defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true); defineSymbol(math, main, rel, "\u2192", "\\to"); defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true); defineSymbol(math, ams, rel, "\u2270", "\\nleq", true); defineSymbol(math, main, spacing, "\u00a0", "\\ "); defineSymbol(math, main, spacing, "\u00a0", "~"); defineSymbol(math, main, spacing, "\u00a0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{% defineSymbol(math, main, spacing, "\u00a0", "\\nobreakspace"); defineSymbol(text$1, main, spacing, "\u00a0", "\\ "); defineSymbol(text$1, main, spacing, "\u00a0", " "); defineSymbol(text$1, main, spacing, "\u00a0", "~"); defineSymbol(text$1, main, spacing, "\u00a0", "\\space"); defineSymbol(text$1, main, spacing, "\u00a0", "\\nobreakspace"); defineSymbol(math, main, spacing, null, "\\nobreak"); defineSymbol(math, main, spacing, null, "\\allowbreak"); defineSymbol(math, main, punct, ",", ","); defineSymbol(math, main, punct, ";", ";"); defineSymbol(math, ams, bin, "\u22bc", "\\barwedge", true); defineSymbol(math, ams, bin, "\u22bb", "\\veebar", true); defineSymbol(math, main, bin, "\u2299", "\\odot", true); defineSymbol(math, main, bin, "\u2295", "\\oplus", true); defineSymbol(math, main, bin, "\u2297", "\\otimes", true); defineSymbol(math, main, textord, "\u2202", "\\partial", true); defineSymbol(math, main, bin, "\u2298", "\\oslash", true); defineSymbol(math, ams, bin, "\u229a", "\\circledcirc", true); defineSymbol(math, ams, bin, "\u22a1", "\\boxdot", true); defineSymbol(math, main, bin, "\u25b3", "\\bigtriangleup"); defineSymbol(math, main, bin, "\u25bd", "\\bigtriangledown"); defineSymbol(math, main, bin, "\u2020", "\\dagger"); defineSymbol(math, main, bin, "\u22c4", "\\diamond"); defineSymbol(math, main, bin, "\u22c6", "\\star"); defineSymbol(math, main, bin, "\u25c3", "\\triangleleft"); defineSymbol(math, main, bin, "\u25b9", "\\triangleright"); defineSymbol(math, main, open, "{", "\\{"); defineSymbol(text$1, main, textord, "{", "\\{"); defineSymbol(text$1, main, textord, "{", "\\textbraceleft"); defineSymbol(math, main, close, "}", "\\}"); defineSymbol(text$1, main, textord, "}", "\\}"); defineSymbol(text$1, main, textord, "}", "\\textbraceright"); defineSymbol(math, main, open, "{", "\\lbrace"); defineSymbol(math, main, close, "}", "\\rbrace"); defineSymbol(math, main, open, "[", "\\lbrack", true); defineSymbol(text$1, main, textord, "[", "\\lbrack", true); defineSymbol(math, main, close, "]", "\\rbrack", true); defineSymbol(text$1, main, textord, "]", "\\rbrack", true); defineSymbol(math, main, open, "(", "\\lparen", true); defineSymbol(math, main, close, ")", "\\rparen", true); defineSymbol(text$1, main, textord, "<", "\\textless", true); // in T1 fontenc defineSymbol(text$1, main, textord, ">", "\\textgreater", true); // in T1 fontenc defineSymbol(math, main, open, "\u230a", "\\lfloor", true); defineSymbol(math, main, close, "\u230b", "\\rfloor", true); defineSymbol(math, main, open, "\u2308", "\\lceil", true); defineSymbol(math, main, close, "\u2309", "\\rceil", true); defineSymbol(math, main, textord, "\\", "\\backslash"); defineSymbol(math, main, textord, "\u2223", "|"); defineSymbol(math, main, textord, "\u2223", "\\vert"); defineSymbol(text$1, main, textord, "|", "\\textbar", true); // in T1 fontenc defineSymbol(math, main, textord, "\u2225", "\\|"); defineSymbol(math, main, textord, "\u2225", "\\Vert"); defineSymbol(text$1, main, textord, "\u2225", "\\textbardbl"); defineSymbol(text$1, main, textord, "~", "\\textasciitilde"); defineSymbol(text$1, main, textord, "\\", "\\textbackslash"); defineSymbol(text$1, main, textord, "^", "\\textasciicircum"); defineSymbol(math, main, rel, "\u2191", "\\uparrow", true); defineSymbol(math, main, rel, "\u21d1", "\\Uparrow", true); defineSymbol(math, main, rel, "\u2193", "\\downarrow", true); defineSymbol(math, main, rel, "\u21d3", "\\Downarrow", true); defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true); defineSymbol(math, main, rel, "\u21d5", "\\Updownarrow", true); defineSymbol(math, main, op, "\u2210", "\\coprod"); defineSymbol(math, main, op, "\u22c1", "\\bigvee"); defineSymbol(math, main, op, "\u22c0", "\\bigwedge"); defineSymbol(math, main, op, "\u2a04", "\\biguplus"); defineSymbol(math, main, op, "\u22c2", "\\bigcap"); defineSymbol(math, main, op, "\u22c3", "\\bigcup"); defineSymbol(math, main, op, "\u222b", "\\int"); defineSymbol(math, main, op, "\u222b", "\\intop"); defineSymbol(math, main, op, "\u222c", "\\iint"); defineSymbol(math, main, op, "\u222d", "\\iiint"); defineSymbol(math, main, op, "\u220f", "\\prod"); defineSymbol(math, main, op, "\u2211", "\\sum"); defineSymbol(math, main, op, "\u2a02", "\\bigotimes"); defineSymbol(math, main, op, "\u2a01", "\\bigoplus"); defineSymbol(math, main, op, "\u2a00", "\\bigodot"); defineSymbol(math, main, op, "\u222e", "\\oint"); defineSymbol(math, main, op, "\u2a06", "\\bigsqcup"); defineSymbol(math, main, op, "\u222b", "\\smallint"); defineSymbol(text$1, main, inner, "\u2026", "\\textellipsis"); defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); defineSymbol(text$1, main, inner, "\u2026", "\\ldots", true); defineSymbol(math, main, inner, "\u2026", "\\ldots", true); defineSymbol(math, main, inner, "\u22ef", "\\@cdots", true); defineSymbol(math, main, inner, "\u22f1", "\\ddots", true); defineSymbol(math, main, textord, "\u22ee", "\\varvdots"); // \vdots is a macro defineSymbol(math, main, accent, "\u02ca", "\\acute"); defineSymbol(math, main, accent, "\u02cb", "\\grave"); defineSymbol(math, main, accent, "\u00a8", "\\ddot"); defineSymbol(math, main, accent, "\u007e", "\\tilde"); defineSymbol(math, main, accent, "\u02c9", "\\bar"); defineSymbol(math, main, accent, "\u02d8", "\\breve"); defineSymbol(math, main, accent, "\u02c7", "\\check"); defineSymbol(math, main, accent, "\u005e", "\\hat"); defineSymbol(math, main, accent, "\u20d7", "\\vec"); defineSymbol(math, main, accent, "\u02d9", "\\dot"); defineSymbol(math, main, accent, "\u02da", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA defineSymbol(math, main, mathord, "\ue131", "\\@imath"); defineSymbol(math, main, mathord, "\ue237", "\\@jmath"); defineSymbol(math, main, textord, "\u0131", "\u0131"); defineSymbol(math, main, textord, "\u0237", "\u0237"); defineSymbol(text$1, main, textord, "\u0131", "\\i", true); defineSymbol(text$1, main, textord, "\u0237", "\\j", true); defineSymbol(text$1, main, textord, "\u00df", "\\ss", true); defineSymbol(text$1, main, textord, "\u00e6", "\\ae", true); defineSymbol(text$1, main, textord, "\u0153", "\\oe", true); defineSymbol(text$1, main, textord, "\u00f8", "\\o", true); defineSymbol(text$1, main, textord, "\u00c6", "\\AE", true); defineSymbol(text$1, main, textord, "\u0152", "\\OE", true); defineSymbol(text$1, main, textord, "\u00d8", "\\O", true); defineSymbol(text$1, main, accent, "\u02ca", "\\'"); // acute defineSymbol(text$1, main, accent, "\u02cb", "\\`"); // grave defineSymbol(text$1, main, accent, "\u02c6", "\\^"); // circumflex defineSymbol(text$1, main, accent, "\u02dc", "\\~"); // tilde defineSymbol(text$1, main, accent, "\u02c9", "\\="); // macron defineSymbol(text$1, main, accent, "\u02d8", "\\u"); // breve defineSymbol(text$1, main, accent, "\u02d9", "\\."); // dot above defineSymbol(text$1, main, accent, "\u02da", "\\r"); // ring above defineSymbol(text$1, main, accent, "\u02c7", "\\v"); // caron defineSymbol(text$1, main, accent, "\u00a8", '\\"'); // diaresis defineSymbol(text$1, main, accent, "\u02dd", "\\H"); // double acute defineSymbol(text$1, main, accent, "\u25ef", "\\textcircled"); // \bigcirc glyph // These ligatures are detected and created in Parser.js's `formLigatures`. const ligatures = { "--": true, "---": true, "``": true, "''": true }; defineSymbol(text$1, main, textord, "\u2013", "--", true); defineSymbol(text$1, main, textord, "\u2013", "\\textendash"); defineSymbol(text$1, main, textord, "\u2014", "---", true); defineSymbol(text$1, main, textord, "\u2014", "\\textemdash"); defineSymbol(text$1, main, textord, "\u2018", "`", true); defineSymbol(text$1, main, textord, "\u2018", "\\textquoteleft"); defineSymbol(text$1, main, textord, "\u2019", "'", true); defineSymbol(text$1, main, textord, "\u2019", "\\textquoteright"); defineSymbol(text$1, main, textord, "\u201c", "``", true); defineSymbol(text$1, main, textord, "\u201c", "\\textquotedblleft"); defineSymbol(text$1, main, textord, "\u201d", "''", true); defineSymbol(text$1, main, textord, "\u201d", "\\textquotedblright"); // \degree from gensymb package defineSymbol(math, main, textord, "\u00b0", "\\degree", true); defineSymbol(text$1, main, textord, "\u00b0", "\\degree"); // \textdegree from inputenc package defineSymbol(text$1, main, textord, "\u00b0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math // mode, but among our fonts, only Main-Regular defines this character "163". defineSymbol(math, main, textord, "\u00a3", "\\pounds"); defineSymbol(math, main, textord, "\u00a3", "\\mathsterling", true); defineSymbol(text$1, main, textord, "\u00a3", "\\pounds"); defineSymbol(text$1, main, textord, "\u00a3", "\\textsterling", true); defineSymbol(math, ams, textord, "\u2720", "\\maltese"); defineSymbol(text$1, ams, textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards. // All of these are textords in math mode const mathTextSymbols = "0123456789/@.\""; for (let i = 0; i < mathTextSymbols.length; i++) { const ch = mathTextSymbols.charAt(i); defineSymbol(math, main, textord, ch, ch); } // All of these are textords in text mode const textSymbols = "0123456789!@*()-=+\";:?/.,"; for (let i = 0; i < textSymbols.length; i++) { const ch = textSymbols.charAt(i); defineSymbol(text$1, main, textord, ch, ch); } // All of these are textords in text mode, and mathords in math mode const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (let i = 0; i < letters.length; i++) { const ch = letters.charAt(i); defineSymbol(math, main, mathord, ch, ch); defineSymbol(text$1, main, textord, ch, ch); } // Blackboard bold and script letters in Unicode range defineSymbol(math, ams, textord, "C", "\u2102"); // blackboard bold defineSymbol(text$1, ams, textord, "C", "\u2102"); defineSymbol(math, ams, textord, "H", "\u210D"); defineSymbol(text$1, ams, textord, "H", "\u210D"); defineSymbol(math, ams, textord, "N", "\u2115"); defineSymbol(text$1, ams, textord, "N", "\u2115"); defineSymbol(math, ams, textord, "P", "\u2119"); defineSymbol(text$1, ams, textord, "P", "\u2119"); defineSymbol(math, ams, textord, "Q", "\u211A"); defineSymbol(text$1, ams, textord, "Q", "\u211A"); defineSymbol(math, ams, textord, "R", "\u211D"); defineSymbol(text$1, ams, textord, "R", "\u211D"); defineSymbol(math, ams, textord, "Z", "\u2124"); defineSymbol(text$1, ams, textord, "Z", "\u2124"); defineSymbol(math, main, mathord, "h", "\u210E"); // italic h, Planck constant defineSymbol(text$1, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters. // We support some letters in the Unicode range U+1D400 to U+1D7FF, // Mathematical Alphanumeric Symbols. // Some editors do not deal well with wide characters. So don't write the // string into this file. Instead, create the string from the surrogate pair. let wideChar = ""; for (let i = 0; i < letters.length; i++) { const ch = letters.charAt(i); // The hex numbers in the next line are a surrogate pair. // 0xD835 is the high surrogate for all letters in the range we support. // 0xDC00 is the low surrogate for bold A. wideChar = String.fromCharCode(0xD835, 0xDC00 + i); // A-Z a-z bold defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDC34 + i); // A-Z a-z italic defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDC68 + i); // A-Z a-z bold italic defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDD04 + i); // A-Z a-z Fractur defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDDA0 + i); // A-Z a-z sans-serif defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDDD4 + i); // A-Z a-z sans bold defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDE08 + i); // A-Z a-z sans italic defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDE70 + i); // A-Z a-z monospace defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); if (i < 26) { // KaTeX fonts have only capital letters for blackboard bold and script. // See exception for k below. wideChar = String.fromCharCode(0xD835, 0xDD38 + i); // A-Z double struck defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDC9C + i); // A-Z script defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); } // TODO: Add bold script when it is supported by a KaTeX font. } // "k" is the only double struck lower case letter in the KaTeX fonts. wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck defineSymbol(math, main, mathord, "k", wideChar); defineSymbol(text$1, main, textord, "k", wideChar); // Next, some wide character numerals for (let i = 0; i < 10; i++) { const ch = i.toString(); wideChar = String.fromCharCode(0xD835, 0xDFCE + i); // 0-9 bold defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDFE2 + i); // 0-9 sans serif defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDFEC + i); // 0-9 bold sans defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); wideChar = String.fromCharCode(0xD835, 0xDFF6 + i); // 0-9 monospace defineSymbol(math, main, mathord, ch, wideChar); defineSymbol(text$1, main, textord, ch, wideChar); } // We add these Latin-1 letters as symbols for backwards-compatibility, // but they are not actually in the font, nor are they supported by the // Unicode accent mechanism, so they fall back to Times font and look ugly. // TODO(edemaine): Fix this. const extraLatin = "\u00c7\u00d0\u00de\u00e7\u00fe"; for (let i = 0; i < extraLatin.length; i++) { const ch = extraLatin.charAt(i); defineSymbol(math, main, mathord, ch, ch); defineSymbol(text$1, main, textord, ch, ch); } /** * This file provides support for Unicode range U+1D400 to U+1D7FF, * Mathematical Alphanumeric Symbols. * * Function wideCharacterFont takes a wide character as input and returns * the font information necessary to render it properly. */ /** * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf * That document sorts characters into groups by font type, say bold or italic. * * In the arrays below, each subarray consists three elements: * * The CSS class of that group when in math mode. * * The CSS class of that group when in text mode. * * The font name, so that KaTeX can get font metrics. */ const wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright ["mathbf", "textbf", "Main-Bold"], // a-z bold upright ["mathnormal", "textit", "Math-Italic"], // A-Z italic ["mathnormal", "textit", "Math-Italic"], // a-z italic ["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic ["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic // Map fancy A-Z letters to script, not calligraphic. // This aligns with unicode-math and math fonts (except Cambria Math). ["mathscr", "textscr", "Script-Regular"], // A-Z script ["", "", ""], // a-z script. No font ["", "", ""], // A-Z bold script. No font ["", "", ""], // a-z bold script. No font ["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur ["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur ["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck ["mathbb", "textbb", "AMS-Regular"], // k double-struck ["", "", ""], // A-Z bold Fraktur No font metrics ["", "", ""], // a-z bold Fraktur. No font. ["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif ["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif ["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif ["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif ["", "", ""], // A-Z bold italic sans. No font ["", "", ""], // a-z bold italic sans. No font ["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace ["mathtt", "texttt", "Typewriter-Regular"]]; const wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold ["", "", ""], // 0-9 double-struck. No KaTeX font. ["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif ["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif ["mathtt", "texttt", "Typewriter-Regular"]]; const wideCharacterFont = function wideCharacterFont(wideChar, mode) { // IE doesn't support codePointAt(). So work with the surrogate pair. const H = wideChar.charCodeAt(0); // high surrogate const L = wideChar.charCodeAt(1); // low surrogate const codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000; const j = mode === "math" ? 0 : 1; // column index for CSS class. if (0x1D400 <= codePoint && codePoint < 0x1D6A4) { // wideLatinLetterData contains exactly 26 chars on each row. // So we can calculate the relevant row. No traverse necessary. const i = Math.floor((codePoint - 0x1D400) / 26); return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]]; } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) { // Numerals, ten per row. const i = Math.floor((codePoint - 0x1D7CE) / 10); return [wideNumeralData[i][2], wideNumeralData[i][j]]; } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) { // dotless i or j return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]]; } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) { // Greek letters. Not supported, yet. return ["", ""]; } else { // We don't support any wide characters outside 1D400–1D7FF. throw new ParseError("Unsupported character: " + wideChar); } }; /** * This file contains information about the options that the Parser carries * around with it while parsing. Data is held in an `Options` object, and when * recursing, a new `Options` object can be created with the `.with*` and * `.reset` functions. */ const sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize]. // The size mappings are taken from TeX with \normalsize=10pt. [1, 1, 1], // size1: [5, 5, 5] \tiny [2, 1, 1], // size2: [6, 5, 5] [3, 1, 1], // size3: [7, 5, 5] \scriptsize [4, 2, 1], // size4: [8, 6, 5] \footnotesize [5, 2, 1], // size5: [9, 6, 5] \small [6, 3, 1], // size6: [10, 7, 5] \normalsize [7, 4, 2], // size7: [12, 8, 6] \large [8, 6, 3], // size8: [14.4, 10, 7] \Large [9, 7, 6], // size9: [17.28, 12, 10] \LARGE [10, 8, 7], // size10: [20.74, 14.4, 12] \huge [11, 10, 9]]; const sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if // you change size indexes, change that function. 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; const sizeAtStyle = function sizeAtStyle(size, style) { return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; }; // In these types, "" (empty string) means "no change". /** * This is the main options class. It contains the current style, size, color, * and font. * * Options objects should not be modified. To create a new Options with * different properties, call a `.having*` method. */ class Options { // A font family applies to a group of fonts (i.e. SansSerif), while a font // represents a specific font (i.e. SansSerif Bold). // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm /** * The base size index. */ constructor(data) { this.style = void 0; this.color = void 0; this.size = void 0; this.textSize = void 0; this.phantom = void 0; this.font = void 0; this.fontFamily = void 0; this.fontWeight = void 0; this.fontShape = void 0; this.sizeMultiplier = void 0; this.maxSize = void 0; this.minRuleThickness = void 0; this._fontMetrics = void 0; this.style = data.style; this.color = data.color; this.size = data.size || Options.BASESIZE; this.textSize = data.textSize || this.size; this.phantom = !!data.phantom; this.font = data.font || ""; this.fontFamily = data.fontFamily || ""; this.fontWeight = data.fontWeight || ''; this.fontShape = data.fontShape || ''; this.sizeMultiplier = sizeMultipliers[this.size - 1]; this.maxSize = data.maxSize; this.minRuleThickness = data.minRuleThickness; this._fontMetrics = undefined; } /** * Returns a new options object with the same properties as "this". Properties * from "extension" will be copied to the new options object. */ extend(extension) { const data = { style: this.style, size: this.size, textSize: this.textSize, color: this.color, phantom: this.phantom, font: this.font, fontFamily: this.fontFamily, fontWeight: this.fontWeight, fontShape: this.fontShape, maxSize: this.maxSize, minRuleThickness: this.minRuleThickness }; for (const key in extension) { if (extension.hasOwnProperty(key)) { data[key] = extension[key]; } } return new Options(data); } /** * Return an options object with the given style. If `this.style === style`, * returns `this`. */ havingStyle(style) { if (this.style === style) { return this; } else { return this.extend({ style: style, size: sizeAtStyle(this.textSize, style) }); } } /** * Return an options object with a cramped version of the current style. If * the current style is cramped, returns `this`. */ havingCrampedStyle() { return this.havingStyle(this.style.cramp()); } /** * Return an options object with the given size and in at least `\textstyle`. * Returns `this` if appropriate. */ havingSize(size) { if (this.size === size && this.textSize === size) { return this; } else { return this.extend({ style: this.style.text(), size: size, textSize: size, sizeMultiplier: sizeMultipliers[size - 1] }); } } /** * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, * changes to at least `\textstyle`. */ havingBaseStyle(style) { style = style || this.style.text(); const wantSize = sizeAtStyle(Options.BASESIZE, style); if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) { return this; } else { return this.extend({ style: style, size: wantSize }); } } /** * Remove the effect of sizing changes such as \Huge. * Keep the effect of the current style, such as \scriptstyle. */ havingBaseSizing() { let size; switch (this.style.id) { case 4: case 5: size = 3; // normalsize in scriptstyle break; case 6: case 7: size = 1; // normalsize in scriptscriptstyle break; default: size = 6; // normalsize in textstyle or displaystyle } return this.extend({ style: this.style.text(), size: size }); } /** * Create a new options object with the given color. */ withColor(color) { return this.extend({ color: color }); } /** * Create a new options object with "phantom" set to true. */ withPhantom() { return this.extend({ phantom: true }); } /** * Creates a new options object with the given math font or old text font. * @type {[type]} */ withFont(font) { return this.extend({ font }); } /** * Create a new options objects with the given fontFamily. */ withTextFontFamily(fontFamily) { return this.extend({ fontFamily, font: "" }); } /** * Creates a new options object with the given font weight */ withTextFontWeight(fontWeight) { return this.extend({ fontWeight, font: "" }); } /** * Creates a new options object with the given font weight */ withTextFontShape(fontShape) { return this.extend({ fontShape, font: "" }); } /** * Return the CSS sizing classes required to switch from enclosing options * `oldOptions` to `this`. Returns an array of classes. */ sizingClasses(oldOptions) { if (oldOptions.size !== this.size) { return ["sizing", "reset-size" + oldOptions.size, "size" + this.size]; } else { return []; } } /** * Return the CSS sizing classes required to switch to the base size. Like * `this.havingSize(BASESIZE).sizingClasses(this)`. */ baseSizingClasses() { if (this.size !== Options.BASESIZE) { return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE]; } else { return []; } } /** * Return the font metrics for this size. */ fontMetrics() { if (!this._fontMetrics) { this._fontMetrics = getGlobalMetrics(this.size); } return this._fontMetrics; } /** * Gets the CSS color of the current options object */ getColor() { if (this.phantom) { return "transparent"; } else { return this.color; } } } Options.BASESIZE = 6; /** * This file does conversion between units. In particular, it provides * calculateSize to convert other units into ems. */ // Thus, multiplying a length by this number converts the length from units // into pts. Dividing the result by ptPerEm gives the number of ems // *assuming* a font size of ptPerEm (normal size, normal style). const ptPerUnit = { // https://en.wikibooks.org/wiki/LaTeX/Lengths and // https://tex.stackexchange.com/a/8263 "pt": 1, // TeX point "mm": 7227 / 2540, // millimeter "cm": 7227 / 254, // centimeter "in": 72.27, // inch "bp": 803 / 800, // big (PostScript) points "pc": 12, // pica "dd": 1238 / 1157, // didot "cc": 14856 / 1157, // cicero (12 didot) "nd": 685 / 642, // new didot "nc": 1370 / 107, // new cicero (12 new didot) "sp": 1 / 65536, // scaled point (TeX's internal smallest unit) // https://tex.stackexchange.com/a/41371 "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX }; // Dictionary of relative units, for fast validity testing. const relativeUnit = { "ex": true, "em": true, "mu": true }; /** * Determine whether the specified unit (either a string defining the unit * or a "size" parse node containing a unit field) is valid. */ const validUnit = function validUnit(unit) { if (typeof unit !== "string") { unit = unit.unit; } return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; }; /* * Convert a "size" parse node (with numeric "number" and string "unit" fields, * as parsed by functions.js argType "size") into a CSS em value for the * current style/scale. `options` gives the current options. */ const calculateSize = function calculateSize(sizeValue, options) { let scale; if (sizeValue.unit in ptPerUnit) { // Absolute units scale = ptPerUnit[sizeValue.unit] // Convert unit to pt / options.fontMetrics().ptPerEm // Convert pt to CSS em / options.sizeMultiplier; // Unscale to make absolute units } else if (sizeValue.unit === "mu") { // `mu` units scale with scriptstyle/scriptscriptstyle. scale = options.fontMetrics().cssEmPerMu; } else { // Other relative units always refer to the *textstyle* font // in the current size. let unitOptions; if (options.style.isTight()) { // isTight() means current style is script/scriptscript. unitOptions = options.havingStyle(options.style.text()); } else { unitOptions = options; } // TODO: In TeX these units are relative to the quad of the current // *text* font, e.g. cmr10. KaTeX instead uses values from the // comparably-sized *Computer Modern symbol* font. At 10pt, these // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641; // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$. // TeX \showlists shows a kern of 1.13889 * fontsize; // KaTeX shows a kern of 1.171 * fontsize. if (sizeValue.unit === "ex") { scale = unitOptions.fontMetrics().xHeight; } else if (sizeValue.unit === "em") { scale = unitOptions.fontMetrics().quad; } else { throw new ParseError("Invalid unit: '" + sizeValue.unit + "'"); } if (unitOptions !== options) { scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; } } return Math.min(sizeValue.number * scale, options.maxSize); }; /* eslint no-console:0 */ /** * Looks up the given symbol in fontMetrics, after applying any symbol * replacements defined in symbol.js */ const lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. fontName, mode) { // Replace the value with its replaced value from symbol.js if (symbols[mode][value] && symbols[mode][value].replace) { value = symbols[mode][value].replace; } return { value: value, metrics: getCharacterMetrics(value, fontName, mode) }; }; /** * Makes a symbolNode after translation via the list of symbols in symbols.js. * Correctly pulls out metrics for the character, and optionally takes a list of * classes to be attached to the node. * * TODO: make argument order closer to makeSpan * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which * should if present come first in `classes`. * TODO(#953): Make `options` mandatory and always pass it in. */ const makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { const lookup = lookupSymbol(value, fontName, mode); const metrics = lookup.metrics; value = lookup.value; let symbolNode; if (metrics) { let italic = metrics.italic; if (mode === "text" || options && options.font === "mathit") { italic = 0; } symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes); } else { // TODO(emily): Figure out a good way to only print this in development typeof console !== "undefined" && console.warn("No character metrics " + `for '${value}' in style '${fontName}' and mode '${mode}'`); symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes); } if (options) { symbolNode.maxFontSize = options.sizeMultiplier; if (options.style.isTight()) { symbolNode.classes.push("mtight"); } const color = options.getColor(); if (color) { symbolNode.style.color = color; } } return symbolNode; }; /** * Makes a symbol in Main-Regular or AMS-Regular. * Used for rel, bin, open, close, inner, and punct. */ const mathsym = function mathsym(value, mode, options, classes) { if (classes === void 0) { classes = []; } // Decide what font to render the symbol in by its entry in the symbols // table. // Have a special case for when the value = \ because the \ is used as a // textord in unsupported command errors but cannot be parsed as a regular // text ordinal and is therefore not present as a symbol in the symbols // table for text, as well as a special case for boldsymbol because it // can be used for bold + and - if (options.font === "boldsymbol" && lookupSymbol(value, "Main-Bold", mode).metrics) { return makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"])); } else if (value === "\\" || symbols[mode][value].font === "main") { return makeSymbol(value, "Main-Regular", mode, options, classes); } else { return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); } }; /** * Determines which of the two font names (Main-Bold and Math-BoldItalic) and * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol", * depending on the symbol. Use this function instead of fontMap for font * "boldsymbol". */ const boldsymbol = function boldsymbol(value, mode, options, classes, type) { if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) { return { fontName: "Math-BoldItalic", fontClass: "boldsymbol" }; } else { // Some glyphs do not exist in Math-BoldItalic so we need to use // Main-Bold instead. return { fontName: "Main-Bold", fontClass: "mathbf" }; } }; /** * Makes either a mathord or textord in the correct font and color. */ const makeOrd = function makeOrd(group, options, type) { const mode = group.mode; const text = group.text; const classes = ["mord"]; // Math mode or Old font (i.e. \rm) const isFont = mode === "math" || mode === "text" && options.font; const fontOrFamily = isFont ? options.font : options.fontFamily; if (text.charCodeAt(0) === 0xD835) { // surrogate pairs get special treatment const _wideCharacterFont = wideCharacterFont(text, mode), wideFontName = _wideCharacterFont[0], wideFontClass = _wideCharacterFont[1]; return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); } else if (fontOrFamily) { let fontName; let fontClasses; if (fontOrFamily === "boldsymbol") { const fontData = boldsymbol(text, mode, options, classes, type); fontName = fontData.fontName; fontClasses = [fontData.fontClass]; } else if (isFont) { fontName = fontMap[fontOrFamily].fontName; fontClasses = [fontOrFamily]; } else { fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape); fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; } if (lookupSymbol(text, fontName, mode).metrics) { return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") { // Deconstruct ligatures in monospace fonts (\texttt, \tt). const parts = []; for (let i = 0; i < text.length; i++) { parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); } return makeFragment(parts); } } // Makes a symbol in the default font for mathords and textords. if (type === "mathord") { return makeSymbol(text, "Math-Italic", mode, options, classes.concat(["mathnormal"])); } else if (type === "textord") { const font = symbols[mode][text] && symbols[mode][text].font; if (font === "ams") { const fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); return makeSymbol(text, fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); } else if (font === "main" || !font) { const fontName = retrieveTextFontName("textrm", options.fontWeight, options.fontShape); return makeSymbol(text, fontName, mode, options, classes.concat(options.fontWeight, options.fontShape)); } else { // fonts added by plugins const fontName = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class return makeSymbol(text, fontName, mode, options, classes.concat(fontName, options.fontWeight, options.fontShape)); } } else { throw new Error("unexpected type: " + type + " in makeOrd"); } }; /** * Returns true if subsequent symbolNodes have the same classes, skew, maxFont, * and styles. */ const canCombine = (prev, next) => { if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) { return false; } for (const style in prev.style) { if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { return false; } } for (const style in next.style) { if (next.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { return false; } } return true; }; /** * Combine consequetive domTree.symbolNodes into a single symbolNode. * Note: this function mutates the argument. */ const tryCombineChars = chars => { for (let i = 0; i < chars.length - 1; i++) { const prev = chars[i]; const next = chars[i + 1]; if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) { prev.text += next.text; prev.height = Math.max(prev.height, next.height); prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use // it to add padding to the right of the span created from // the combined characters. prev.italic = next.italic; chars.splice(i + 1, 1); i--; } } return chars; }; /** * Calculate the height, depth, and maxFontSize of an element based on its * children. */ const sizeElementFromChildren = function sizeElementFromChildren(elem) { let height = 0; let depth = 0; let maxFontSize = 0; for (let i = 0; i < elem.children.length; i++) { const child = elem.children[i]; if (child.height > height) { height = child.height; } if (child.depth > depth) { depth = child.depth; } if (child.maxFontSize > maxFontSize) { maxFontSize = child.maxFontSize; } } elem.height = height; elem.depth = depth; elem.maxFontSize = maxFontSize; }; /** * Makes a span with the given list of classes, list of children, and options. * * TODO(#953): Ensure that `options` is always provided (currently some call * sites don't pass it) and make the type below mandatory. * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which * should if present come first in `classes`. */ const makeSpan = function makeSpan(classes, children, options, style) { const span = new Span(classes, children, options, style); sizeElementFromChildren(span); return span; }; // SVG one is simpler -- doesn't require height, depth, max-font setting. // This is also a separate method for typesafety. const makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style); const makeLineSpan = function makeLineSpan(className, options, thickness) { const line = makeSpan([className], [], options); line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness); line.style.borderBottomWidth = line.height + "em"; line.maxFontSize = 1.0; return line; }; /** * Makes an anchor with the given href, list of classes, list of children, * and options. */ const makeAnchor = function makeAnchor(href, classes, children, options) { const anchor = new Anchor(href, classes, children, options); sizeElementFromChildren(anchor); return anchor; }; /** * Makes a document fragment with the given list of children. */ const makeFragment = function makeFragment(children) { const fragment = new DocumentFragment(children); sizeElementFromChildren(fragment); return fragment; }; /** * Wraps group in a span if it's a document fragment, allowing to apply classes * and styles */ const wrapFragment = function wrapFragment(group, options) { if (group instanceof DocumentFragment) { return makeSpan([], [group], options); } return group; }; // These are exact object types to catch typos in the names of the optional fields. // Computes the updated `children` list and the overall depth. // // This helper function for makeVList makes it easier to enforce type safety by // allowing early exits (returns) in the logic. const getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { if (params.positionType === "individualShift") { const oldChildren = params.children; const children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be // shifted to the correct specified shift const depth = -oldChildren[0].shift - oldChildren[0].elem.depth; let currPos = depth; for (let i = 1; i < oldChildren.length; i++) { const diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; const size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); currPos = currPos + diff; children.push({ type: "kern", size }); children.push(oldChildren[i]); } return { children, depth }; } let depth; if (params.positionType === "top") { // We always start at the bottom, so calculate the bottom by adding up // all the sizes let bottom = params.positionData; for (let i = 0; i < params.children.length; i++) { const child = params.children[i]; bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; } depth = bottom; } else if (params.positionType === "bottom") { depth = -params.positionData; } else { const firstChild = params.children[0]; if (firstChild.type !== "elem") { throw new Error('First child must have type "elem".'); } if (params.positionType === "shift") { depth = -firstChild.elem.depth - params.positionData; } else if (params.positionType === "firstBaseline") { depth = -firstChild.elem.depth; } else { throw new Error(`Invalid positionType ${params.positionType}.`); } } return { children: params.children, depth }; }; /** * Makes a vertical list by stacking elements and kerns on top of each other. * Allows for many different ways of specifying the positioning method. * * See VListParam documentation above. */ const makeVList = function makeVList(params, options) { const _getVListChildrenAndD = getVListChildrenAndDepth(params), children = _getVListChildrenAndD.children, depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to // each item, where it will determine the item's baseline. Since it has // `overflow:hidden`, the strut's top edge will sit on the item's line box's // top edge and the strut's bottom edge will sit on the item's baseline, // with no additional line-height spacing. This allows the item baseline to // be positioned precisely without worrying about font ascent and // line-height. let pstrutSize = 0; for (let i = 0; i < children.length; i++) { const child = children[i]; if (child.type === "elem") { const elem = child.elem; pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); } } pstrutSize += 2; const pstrut = makeSpan(["pstrut"], []); pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets const realChildren = []; let minPos = depth; let maxPos = depth; let currPos = depth; for (let i = 0; i < children.length; i++) { const child = children[i]; if (child.type === "kern") { currPos += child.size; } else { const elem = child.elem; const classes = child.wrapperClasses || []; const style = child.wrapperStyle || {}; const childWrap = makeSpan(classes, [pstrut, elem], undefined, style); childWrap.style.top = -pstrutSize - currPos - elem.depth + "em"; if (child.marginLeft) { childWrap.style.marginLeft = child.marginLeft; } if (child.marginRight) { childWrap.style.marginRight = child.marginRight; } realChildren.push(childWrap); currPos += elem.height + elem.depth; } minPos = Math.min(minPos, currPos); maxPos = Math.max(maxPos, currPos); } // The vlist contents go in a table-cell with `vertical-align:bottom`. // This cell's bottom edge will determine the containing table's baseline // without overly expanding the containing line-box. const vlist = makeSpan(["vlist"], realChildren); vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth. let rows; if (minPos < 0) { // We will define depth in an empty span with display: table-cell. // It should render with the height that we define. But Chrome, in // contenteditable mode only, treats that span as if it contains some // text content. And that min-height over-rides our desired height. // So we put another empty span inside the depth strut span. const emptySpan = makeSpan([], []); const depthStrut = makeSpan(["vlist"], [emptySpan]); depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it // puts the bottom of the *second* row on the baseline. const topStrut = makeSpan(["vlist-s"], [new SymbolNode("\u200b")]); rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])]; } else { rows = [makeSpan(["vlist-r"], [vlist])]; } const vtable = makeSpan(["vlist-t"], rows); if (rows.length === 2) { vtable.classes.push("vlist-t2"); } vtable.height = maxPos; vtable.depth = -minPos; return vtable; }; // Glue is a concept from TeX which is a flexible space between elements in // either a vertical or horizontal list. In KaTeX, at least for now, it's // static space between elements in a horizontal layout. const makeGlue = (measurement, options) => { // Make an empty span for the space const rule = makeSpan(["mspace"], [], options); const size = calculateSize(measurement, options); rule.style.marginRight = `${size}em`; return rule; }; // Takes font options, and returns the appropriate fontLookup name const retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) { let baseFontName = ""; switch (fontFamily) { case "amsrm": baseFontName = "AMS"; break; case "textrm": baseFontName = "Main"; break; case "textsf": baseFontName = "SansSerif"; break; case "texttt": baseFontName = "Typewriter"; break; default: baseFontName = fontFamily; // use fonts added by a plugin } let fontStylesName; if (fontWeight === "textbf" && fontShape === "textit") { fontStylesName = "BoldItalic"; } else if (fontWeight === "textbf") { fontStylesName = "Bold"; } else if (fontWeight === "textit") { fontStylesName = "Italic"; } else { fontStylesName = "Regular"; } return `${baseFontName}-${fontStylesName}`; }; /** * Maps TeX font commands to objects containing: * - variant: string used for "mathvariant" attribute in buildMathML.js * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics */ // A map between tex font commands an MathML mathvariant attribute values const fontMap = { // styles "mathbf": { variant: "bold", fontName: "Main-Bold" }, "mathrm": { variant: "normal", fontName: "Main-Regular" }, "textit": { variant: "italic", fontName: "Main-Italic" }, "mathit": { variant: "italic", fontName: "Main-Italic" }, "mathnormal": { variant: "italic", fontName: "Math-Italic" }, // "boldsymbol" is missing because they require the use of multiple fonts: // Math-BoldItalic and Main-Bold. This is handled by a special case in // makeOrd which ends up calling boldsymbol. // families "mathbb": { variant: "double-struck", fontName: "AMS-Regular" }, "mathcal": { variant: "script", fontName: "Caligraphic-Regular" }, "mathfrak": { variant: "fraktur", fontName: "Fraktur-Regular" }, "mathscr": { variant: "script", fontName: "Script-Regular" }, "mathsf": { variant: "sans-serif", fontName: "SansSerif-Regular" }, "mathtt": { variant: "monospace", fontName: "Typewriter-Regular" } }; const svgData = { // path, width, height vec: ["vec", 0.471, 0.714], // values from the font glyph oiintSize1: ["oiintSize1", 0.957, 0.499], // oval to overlay the integrand oiintSize2: ["oiintSize2", 1.472, 0.659], oiiintSize1: ["oiiintSize1", 1.304, 0.499], oiiintSize2: ["oiiintSize2", 1.98, 0.659], leftParenInner: ["leftParenInner", 0.875, 0.3], rightParenInner: ["rightParenInner", 0.875, 0.3] }; const staticSvg = function staticSvg(value, options) { // Create a span with inline SVG for the element. const _svgData$value = svgData[value], pathName = _svgData$value[0], width = _svgData$value[1], height = _svgData$value[2]; const path = new PathNode(pathName); const svgNode = new SvgNode([path], { "width": width + "em", "height": height + "em", // Override CSS rule `.katex svg { width: 100% }` "style": "width:" + width + "em", "viewBox": "0 0 " + 1000 * width + " " + 1000 * height, "preserveAspectRatio": "xMinYMin" }); const span = makeSvgSpan(["overlay"], [svgNode], options); span.height = height; span.style.height = height + "em"; span.style.width = width + "em"; return span; }; var buildCommon = { fontMap, makeSymbol, mathsym, makeSpan, makeSvgSpan, makeLineSpan, makeAnchor, makeFragment, wrapFragment, makeVList, makeOrd, makeGlue, staticSvg, svgData, tryCombineChars }; /** * Describes spaces between different classes of atoms. */ const thinspace = { number: 3, unit: "mu" }; const mediumspace = { number: 4, unit: "mu" }; const thickspace = { number: 5, unit: "mu" }; // Making the type below exact with all optional fields doesn't work due to // - https://github.com/facebook/flow/issues/4582 // - https://github.com/facebook/flow/issues/5688 // However, since *all* fields are optional, $Shape<> works as suggested in 5688 // above. // Spacing relationships for display and text styles const spacings = { mord: { mop: thinspace, mbin: mediumspace, mrel: thickspace, minner: thinspace }, mop: { mord: thinspace, mop: thinspace, mrel: thickspace, minner: thinspace }, mbin: { mord: mediumspace, mop: mediumspace, mopen: mediumspace, minner: mediumspace }, mrel: { mord: thickspace, mop: thickspace, mopen: thickspace, minner: thickspace }, mopen: {}, mclose: { mop: thinspace, mbin: mediumspace, mrel: thickspace, minner: thinspace }, mpunct: { mord: thinspace, mop: thinspace, mrel: thickspace, mopen: thinspace, mclose: thinspace, mpunct: thinspace, minner: thinspace }, minner: { mord: thinspace, mop: thinspace, mbin: mediumspace, mrel: thickspace, mopen: thinspace, mpunct: thinspace, minner: thinspace } }; // Spacing relationships for script and scriptscript styles const tightSpacings = { mord: { mop: thinspace }, mop: { mord: thinspace, mop: thinspace }, mbin: {}, mrel: {}, mopen: {}, mclose: { mop: thinspace }, mpunct: {}, minner: { mop: thinspace } }; /** Context provided to function handlers for error messages. */ // Note: reverse the order of the return type union will cause a flow error. // See https://github.com/facebook/flow/issues/3663. // More general version of `HtmlBuilder` for nodes (e.g. \sum, accent types) // whose presence impacts super/subscripting. In this case, ParseNode<"supsub"> // delegates its HTML building to the HtmlBuilder corresponding to these nodes. /** * Final function spec for use at parse time. * This is almost identical to `FunctionPropSpec`, except it * 1. includes the function handler, and * 2. requires all arguments except argTypes. * It is generated by `defineFunction()` below. */ /** * All registered functions. * `functions.js` just exports this same dictionary again and makes it public. * `Parser.js` requires this dictionary. */ const _functions = {}; /** * All HTML builders. Should be only used in the `define*` and the `build*ML` * functions. */ const _htmlGroupBuilders = {}; /** * All MathML builders. Should be only used in the `define*` and the `build*ML` * functions. */ const _mathmlGroupBuilders = {}; function defineFunction(_ref) { let type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder; // Set default values of functions const data = { type, numArgs: props.numArgs, argTypes: props.argTypes, greediness: props.greediness === undefined ? 1 : props.greediness, allowedInText: !!props.allowedInText, allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, numOptionalArgs: props.numOptionalArgs || 0, infix: !!props.infix, handler: handler }; for (let i = 0; i < names.length; ++i) { _functions[names[i]] = data; } if (type) { if (htmlBuilder) { _htmlGroupBuilders[type] = htmlBuilder; } if (mathmlBuilder) { _mathmlGroupBuilders[type] = mathmlBuilder; } } } /** * Use this to register only the HTML and MathML builders for a function (e.g. * if the function's ParseNode is generated in Parser.js rather than via a * stand-alone handler provided to `defineFunction`). */ function defineFunctionBuilders(_ref2) { let type = _ref2.type, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder; defineFunction({ type, names: [], props: { numArgs: 0 }, handler() { throw new Error('Should never be called.'); }, htmlBuilder, mathmlBuilder }); } // Since the corresponding buildHTML/buildMathML function expects a // list of elements, we normalize for different kinds of arguments const ordargument = function ordargument(arg) { return arg.type === "ordgroup" ? arg.body : [arg]; }; /** * This file does the main work of building a domTree structure from a parse * tree. The entry point is the `buildHTML` function, which takes a parse tree. * Then, the buildExpression, buildGroup, and various groupBuilders functions * are called, to produce a final HTML tree. */ const makeSpan$1 = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) // depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6, // and the text before Rule 19. const binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]; const binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"]; const styleMap = { "display": Style$1.DISPLAY, "text": Style$1.TEXT, "script": Style$1.SCRIPT, "scriptscript": Style$1.SCRIPTSCRIPT }; const DomEnum = { mord: "mord", mop: "mop", mbin: "mbin", mrel: "mrel", mopen: "mopen", mclose: "mclose", mpunct: "mpunct", minner: "minner" }; /** * Take a list of nodes, build them in order, and return a list of the built * nodes. documentFragments are flattened into their contents, so the * returned list contains no fragments. `isRealGroup` is true if `expression` * is a real group (no atoms will be added on either side), as opposed to * a partial group (e.g. one created by \color). `surrounding` is an array * consisting type of nodes that will be added to the left and right. */ const buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) { if (surrounding === void 0) { surrounding = [null, null]; } // Parse expressions into `groups`. const groups = []; for (let i = 0; i < expression.length; i++) { const output = buildGroup(expression[i], options); if (output instanceof DocumentFragment) { const children = output.children; groups.push(...children); } else { groups.push(output); } } // If `expression` is a partial group, let the parent handle spacings // to avoid processing groups multiple times. if (!isRealGroup) { return groups; } let glueOptions = options; if (expression.length === 1) { const node = expression[0]; if (node.type === "sizing") { glueOptions = options.havingSize(node.size); } else if (node.type === "styling") { glueOptions = options.havingStyle(styleMap[node.style]); } } // Dummy spans for determining spacings between surrounding atoms. // If `expression` has no atoms on the left or right, class "leftmost" // or "rightmost", respectively, is used to indicate it. const dummyPrev = makeSpan$1([surrounding[0] || "leftmost"], [], options); const dummyNext = makeSpan$1([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element // of its `classes` array. A later cleanup should ensure this, for // instance by changing the signature of `makeSpan`. // Before determining what spaces to insert, perform bin cancellation. // Binary operators change to ordinary symbols in some contexts. const isRoot = isRealGroup === "root"; traverseNonSpaceNodes(groups, (node, prev) => { const prevType = prev.classes[0]; const type = node.classes[0]; if (prevType === "mbin" && utils.contains(binRightCanceller, type)) { prev.classes[0] = "mord"; } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) { node.classes[0] = "mord"; } }, { node: dummyPrev }, dummyNext, isRoot); traverseNonSpaceNodes(groups, (node, prev) => { const prevType = getTypeOfDomTree(prev); const type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style. const space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null; if (space) { // Insert glue (spacing) after the `prev`. return buildCommon.makeGlue(space, glueOptions); } }, { node: dummyPrev }, dummyNext, isRoot); return groups; }; // Depth-first traverse non-space `nodes`, calling `callback` with the current and // previous node as arguments, optionally returning a node to insert after the // previous node. `prev` is an object with the previous node and `insertAfter` // function to insert after it. `next` is a node that will be added to the right. // Used for bin cancellation and inserting spacings. const traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) { if (next) { // temporarily append the right node, if exists nodes.push(next); } let i = 0; for (; i < nodes.length; i++) { const node = nodes[i]; const partialGroup = checkPartialGroup(node); if (partialGroup) { // Recursive DFS // $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array traverseNonSpaceNodes(partialGroup.children, callback, prev, null, isRoot); continue; } // Ignore explicit spaces (e.g., \;, \,) when determining what implicit // spacing should go between atoms of different classes const nonspace = !node.hasClass("mspace"); if (nonspace) { const result = callback(node, prev.node); if (result) { if (prev.insertAfter) { prev.insertAfter(result); } else { // insert at front nodes.unshift(result); i++; } } } if (nonspace) { prev.node = node; } else if (isRoot && node.hasClass("newline")) { prev.node = makeSpan$1(["leftmost"]); // treat like beginning of line } prev.insertAfter = (index => n => { nodes.splice(index + 1, 0, n); i++; })(i); } if (next) { nodes.pop(); } }; // Check if given node is a partial group, i.e., does not affect spacing around. const checkPartialGroup = function checkPartialGroup(node) { if (node instanceof DocumentFragment || node instanceof Anchor || node instanceof Span && node.hasClass("enclosing")) { return node; } return null; }; // Return the outermost node of a domTree. const getOutermostNode = function getOutermostNode(node, side) { const partialGroup = checkPartialGroup(node); if (partialGroup) { const children = partialGroup.children; if (children.length) { if (side === "right") { return getOutermostNode(children[children.length - 1], "right"); } else if (side === "left") { return getOutermostNode(children[0], "left"); } } } return node; }; // Return math atom class (mclass) of a domTree. // If `side` is given, it will get the type of the outermost node at given side. const getTypeOfDomTree = function getTypeOfDomTree(node, side) { if (!node) { return null; } if (side) { node = getOutermostNode(node, side); } // This makes a lot of assumptions as to where the type of atom // appears. We should do a better job of enforcing this. return DomEnum[node.classes[0]] || null; }; const makeNullDelimiter = function makeNullDelimiter(options, classes) { const moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); return makeSpan$1(classes.concat(moreClasses)); }; /** * buildGroup is the function that takes a group and calls the correct groupType * function for it. It also handles the interaction of size and style changes * between parents and children. */ const buildGroup = function buildGroup(group, options, baseOptions) { if (!group) { return makeSpan$1(); } if (_htmlGroupBuilders[group.type]) { // Call the groupBuilders function let groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account // for that size difference. if (baseOptions && options.size !== baseOptions.size) { groupNode = makeSpan$1(options.sizingClasses(baseOptions), [groupNode], options); const multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; groupNode.height *= multiplier; groupNode.depth *= multiplier; } return groupNode; } else { throw new ParseError("Got group of unknown type: '" + group.type + "'"); } }; /** * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`) * into an unbreakable HTML node of class .base, with proper struts to * guarantee correct vertical extent. `buildHTML` calls this repeatedly to * make up the entire expression as a sequence of unbreakable units. */ function buildHTMLUnbreakable(children, options) { // Compute height and depth of this chunk. const body = makeSpan$1(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at // the height of the expression, and the bottom of the HTML element // falls at the depth of the expression. const strut = makeSpan$1(["strut"]); strut.style.height = body.height + body.depth + "em"; strut.style.verticalAlign = -body.depth + "em"; body.children.unshift(strut); return body; } /** * Take an entire parse tree, and build it into an appropriate set of HTML * nodes. */ function buildHTML(tree, options) { // Strip off outer tag wrapper for processing below. let tag = null; if (tree.length === 1 && tree[0].type === "tag") { tag = tree[0].tag; tree = tree[0].body; } // Build the expression contained in the tree const expression = buildExpression(tree, options, "root"); const children = []; // Create one base node for each chunk between potential line breaks. // The TeXBook [p.173] says "A formula will be broken only after a // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary // operation symbol like $+$ or $-$ or $\times$, where the relation or // binary operation is on the ``outer level'' of the formula (i.e., not // enclosed in {...} and not part of an \over construction)." let parts = []; for (let i = 0; i < expression.length; i++) { parts.push(expression[i]); if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) { // Put any post-operator glue on same line as operator. // Watch for \nobreak along the way, and stop at \newline. let nobreak = false; while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) { i++; parts.push(expression[i]); if (expression[i].hasClass("nobreak")) { nobreak = true; } } // Don't allow break if \nobreak among the post-operator glue. if (!nobreak) { children.push(buildHTMLUnbreakable(parts, options)); parts = []; } } else if (expression[i].hasClass("newline")) { // Write the line except the newline parts.pop(); if (parts.length > 0) { children.push(buildHTMLUnbreakable(parts, options)); parts = []; } // Put the newline at the top level children.push(expression[i]); } } if (parts.length > 0) { children.push(buildHTMLUnbreakable(parts, options)); } // Now, if there was a tag, build it too and append it as a final child. let tagChild; if (tag) { tagChild = buildHTMLUnbreakable(buildExpression(tag, options, true)); tagChild.classes = ["tag"]; children.push(tagChild); } const htmlNode = makeSpan$1(["katex-html"], children); htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children // (the height of the enclosing htmlNode) for proper vertical alignment. if (tagChild) { const strut = tagChild.children[0]; strut.style.height = htmlNode.height + htmlNode.depth + "em"; strut.style.verticalAlign = -htmlNode.depth + "em"; } return htmlNode; } /** * These objects store data about MathML nodes. This is the MathML equivalent * of the types in domTree.js. Since MathML handles its own rendering, and * since we're mainly using MathML to improve accessibility, we don't manage * any of the styling state that the plain DOM nodes do. * * The `toNode` and `toMarkup` functions work simlarly to how they do in * domTree.js, creating namespaced DOM nodes and HTML text markup respectively. */ function newDocumentFragment(children) { return new DocumentFragment(children); } /** * This node represents a general purpose MathML node of any type. The * constructor requires the type of node to create (for example, `"mo"` or * `"mspace"`, corresponding to `` and `` tags). */ class MathNode { constructor(type, children) { this.type = void 0; this.attributes = void 0; this.children = void 0; this.type = type; this.attributes = {}; this.children = children || []; } /** * Sets an attribute on a MathML node. MathML depends on attributes to convey a * semantic content, so this is used heavily. */ setAttribute(name, value) { this.attributes[name] = value; } /** * Gets an attribute on a MathML node. */ getAttribute(name) { return this.attributes[name]; } /** * Converts the math node into a MathML-namespaced DOM element. */ toNode() { const node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); for (const attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { node.setAttribute(attr, this.attributes[attr]); } } for (let i = 0; i < this.children.length; i++) { node.appendChild(this.children[i].toNode()); } return node; } /** * Converts the math node into an HTML markup string. */ toMarkup() { let markup = "<" + this.type; // Add the attributes for (const attr in this.attributes) { if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { markup += " " + attr + "=\""; markup += utils.escape(this.attributes[attr]); markup += "\""; } } markup += ">"; for (let i = 0; i < this.children.length; i++) { markup += this.children[i].toMarkup(); } markup += ""; return markup; } /** * Converts the math node into a string, similar to innerText, but escaped. */ toText() { return this.children.map(child => child.toText()).join(""); } } /** * This node represents a piece of text. */ class TextNode { constructor(text) { this.text = void 0; this.text = text; } /** * Converts the text node into a DOM text node. */ toNode() { return document.createTextNode(this.text); } /** * Converts the text node into escaped HTML markup * (representing the text itself). */ toMarkup() { return utils.escape(this.toText()); } /** * Converts the text node into a string * (representing the text iteself). */ toText() { return this.text; } } /** * This node represents a space, but may render as or as text, * depending on the width. */ class SpaceNode { /** * Create a Space node with width given in CSS ems. */ constructor(width) { this.width = void 0; this.character = void 0; this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html // for a table of space-like characters. We use Unicode // representations instead of &LongNames; as it's not clear how to // make the latter via document.createTextNode. if (width >= 0.05555 && width <= 0.05556) { this.character = "\u200a"; //   } else if (width >= 0.1666 && width <= 0.1667) { this.character = "\u2009"; //   } else if (width >= 0.2222 && width <= 0.2223) { this.character = "\u2005"; //   } else if (width >= 0.2777 && width <= 0.2778) { this.character = "\u2005\u200a"; //    } else if (width >= -0.05556 && width <= -0.05555) { this.character = "\u200a\u2063"; // ​ } else if (width >= -0.1667 && width <= -0.1666) { this.character = "\u2009\u2063"; // ​ } else if (width >= -0.2223 && width <= -0.2222) { this.character = "\u205f\u2063"; // ​ } else if (width >= -0.2778 && width <= -0.2777) { this.character = "\u2005\u2063"; // ​ } else { this.character = null; } } /** * Converts the math node into a MathML-namespaced DOM element. */ toNode() { if (this.character) { return document.createTextNode(this.character); } else { const node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); node.setAttribute("width", this.width + "em"); return node; } } /** * Converts the math node into an HTML markup string. */ toMarkup() { if (this.character) { return `${this.character}`; } else { return ``; } } /** * Converts the math node into a string, similar to innerText. */ toText() { if (this.character) { return this.character; } else { return " "; } } } var mathMLTree = { MathNode, TextNode, SpaceNode, newDocumentFragment }; /** * This file converts a parse tree into a cooresponding MathML tree. The main * entry point is the `buildMathML` function, which takes a parse tree from the * parser. */ /** * Takes a symbol and converts it into a MathML text node after performing * optional replacement from symbols.js. */ const makeText = function makeText(text, mode, options) { if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) { text = symbols[mode][text].replace; } return new mathMLTree.TextNode(text); }; /** * Wrap the given array of nodes in an node if needed, i.e., * unless the array has length 1. Always returns a single node. */ const makeRow = function makeRow(body) { if (body.length === 1) { return body[0]; } else { return new mathMLTree.MathNode("mrow", body); } }; /** * Returns the math variant as a string or null if none is required. */ const getVariant = function getVariant(group, options) { // Handle \text... font specifiers as best we can. // MathML has a limited list of allowable mathvariant specifiers; see // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt if (options.fontFamily === "texttt") { return "monospace"; } else if (options.fontFamily === "textsf") { if (options.fontShape === "textit" && options.fontWeight === "textbf") { return "sans-serif-bold-italic"; } else if (options.fontShape === "textit") { return "sans-serif-italic"; } else if (options.fontWeight === "textbf") { return "bold-sans-serif"; } else { return "sans-serif"; } } else if (options.fontShape === "textit" && options.fontWeight === "textbf") { return "bold-italic"; } else if (options.fontShape === "textit") { return "italic"; } else if (options.fontWeight === "textbf") { return "bold"; } const font = options.font; if (!font || font === "mathnormal") { return null; } const mode = group.mode; if (font === "mathit") { return "italic"; } else if (font === "boldsymbol") { return group.type === "textord" ? "bold" : "bold-italic"; } else if (font === "mathbf") { return "bold"; } else if (font === "mathbb") { return "double-struck"; } else if (font === "mathfrak") { return "fraktur"; } else if (font === "mathscr" || font === "mathcal") { // MathML makes no distinction between script and caligrahpic return "script"; } else if (font === "mathsf") { return "sans-serif"; } else if (font === "mathtt") { return "monospace"; } let text = group.text; if (utils.contains(["\\imath", "\\jmath"], text)) { return null; } if (symbols[mode][text] && symbols[mode][text].replace) { text = symbols[mode][text].replace; } const fontName = buildCommon.fontMap[font].fontName; if (getCharacterMetrics(text, fontName, mode)) { return buildCommon.fontMap[font].variant; } return null; }; /** * Takes a list of nodes, builds them, and returns a list of the generated * MathML nodes. Also combine consecutive outputs into a single * tag. */ const buildExpression$1 = function buildExpression(expression, options, isOrdgroup) { if (expression.length === 1) { const group = buildGroup$1(expression[0], options); if (isOrdgroup && group instanceof MathNode && group.type === "mo") { // When TeX writers want to suppress spacing on an operator, // they often put the operator by itself inside braces. group.setAttribute("lspace", "0em"); group.setAttribute("rspace", "0em"); } return [group]; } const groups = []; let lastGroup; for (let i = 0; i < expression.length; i++) { const group = buildGroup$1(expression[i], options); if (group instanceof MathNode && lastGroup instanceof MathNode) { // Concatenate adjacent s if (group.type === 'mtext' && lastGroup.type === 'mtext' && group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) { lastGroup.children.push(...group.children); continue; // Concatenate adjacent s } else if (group.type === 'mn' && lastGroup.type === 'mn') { lastGroup.children.push(...group.children); continue; // Concatenate ... followed by . } else if (group.type === 'mi' && group.children.length === 1 && lastGroup.type === 'mn') { const child = group.children[0]; if (child instanceof TextNode && child.text === '.') { lastGroup.children.push(...group.children); continue; } } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) { const lastChild = lastGroup.children[0]; if (lastChild instanceof TextNode && lastChild.text === '\u0338' && (group.type === 'mo' || group.type === 'mi' || group.type === 'mn')) { const child = group.children[0]; if (child instanceof TextNode && child.text.length > 0) { // Overlay with combining character long solidus child.text = child.text.slice(0, 1) + "\u0338" + child.text.slice(1); groups.pop(); } } } } groups.push(group); lastGroup = group; } return groups; }; /** * Equivalent to buildExpression, but wraps the elements in an * if there's more than one. Returns a single node instead of an array. */ const buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) { return makeRow(buildExpression$1(expression, options, isOrdgroup)); }; /** * Takes a group from the parser and calls the appropriate groupBuilders function * on it to produce a MathML node. */ const buildGroup$1 = function buildGroup(group, options) { if (!group) { return new mathMLTree.MathNode("mrow"); } if (_mathmlGroupBuilders[group.type]) { // Call the groupBuilders function const result = _mathmlGroupBuilders[group.type](group, options); return result; } else { throw new ParseError("Got group of unknown type: '" + group.type + "'"); } }; /** * Takes a full parse tree and settings and builds a MathML representation of * it. In particular, we put the elements from building the parse tree into a * tag so we can also include that TeX source as an annotation. * * Note that we actually return a domTree element with a `` inside it so * we can do appropriate styling. */ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) { const expression = buildExpression$1(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics // tag correctly, unless it's a single or . let wrapper; if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) { wrapper = expression[0]; } else { wrapper = new mathMLTree.MathNode("mrow", expression); } // Build a TeX annotation of the source const annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]); annotation.setAttribute("encoding", "application/x-tex"); const semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); const math = new mathMLTree.MathNode("math", [semantics]); math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"); if (isDisplayMode) { math.setAttribute("display", "block"); } // You can't style nodes, so we wrap the node in a span. // NOTE: The span class is not typed to have nodes as children, and // we don't want to make the children type more generic since the children // of span are expected to have more fields in `buildHtml` contexts. const wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe return buildCommon.makeSpan([wrapperClass], [math]); } const optionsFromSettings = function optionsFromSettings(settings) { return new Options({ style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT, maxSize: settings.maxSize, minRuleThickness: settings.minRuleThickness }); }; const displayWrap = function displayWrap(node, settings) { if (settings.displayMode) { const classes = ["katex-display"]; if (settings.leqno) { classes.push("leqno"); } if (settings.fleqn) { classes.push("fleqn"); } node = buildCommon.makeSpan(classes, [node]); } return node; }; const buildTree = function buildTree(tree, expression, settings) { const options = optionsFromSettings(settings); let katexNode; if (settings.output === "mathml") { return buildMathML(tree, expression, options, settings.displayMode, true); } else if (settings.output === "html") { const htmlNode = buildHTML(tree, options); katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); } else { const mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false); const htmlNode = buildHTML(tree, options); katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, htmlNode]); } return displayWrap(katexNode, settings); }; const buildHTMLTree = function buildHTMLTree(tree, expression, settings) { const options = optionsFromSettings(settings); const htmlNode = buildHTML(tree, options); const katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); return displayWrap(katexNode, settings); }; /** * This file provides support to buildMathML.js and buildHTML.js * for stretchy wide elements rendered from SVG files * and other CSS trickery. */ const stretchyCodePoint = { widehat: "^", widecheck: "ˇ", widetilde: "~", utilde: "~", overleftarrow: "\u2190", underleftarrow: "\u2190", xleftarrow: "\u2190", overrightarrow: "\u2192", underrightarrow: "\u2192", xrightarrow: "\u2192", underbrace: "\u23df", overbrace: "\u23de", overgroup: "\u23e0", undergroup: "\u23e1", overleftrightarrow: "\u2194", underleftrightarrow: "\u2194", xleftrightarrow: "\u2194", Overrightarrow: "\u21d2", xRightarrow: "\u21d2", overleftharpoon: "\u21bc", xleftharpoonup: "\u21bc", overrightharpoon: "\u21c0", xrightharpoonup: "\u21c0", xLeftarrow: "\u21d0", xLeftrightarrow: "\u21d4", xhookleftarrow: "\u21a9", xhookrightarrow: "\u21aa", xmapsto: "\u21a6", xrightharpoondown: "\u21c1", xleftharpoondown: "\u21bd", xrightleftharpoons: "\u21cc", xleftrightharpoons: "\u21cb", xtwoheadleftarrow: "\u219e", xtwoheadrightarrow: "\u21a0", xlongequal: "=", xtofrom: "\u21c4", xrightleftarrows: "\u21c4", xrightequilibrium: "\u21cc", // Not a perfect match. xleftequilibrium: "\u21cb" // None better available. }; const mathMLnode = function mathMLnode(label) { const node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]); node.setAttribute("stretchy", "true"); return node; }; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. // Copyright (c) 2009-2010, Design Science, Inc. () // Copyright (c) 2014-2017 Khan Academy () // Licensed under the SIL Open Font License, Version 1.1. // See \nhttp://scripts.sil.org/OFL // Very Long SVGs // Many of the KaTeX stretchy wide elements use a long SVG image and an // overflow: hidden tactic to achieve a stretchy image while avoiding // distortion of arrowheads or brace corners. // The SVG typically contains a very long (400 em) arrow. // The SVG is in a container span that has overflow: hidden, so the span // acts like a window that exposes only part of the SVG. // The SVG always has a longer, thinner aspect ratio than the container span. // After the SVG fills 100% of the height of the container span, // there is a long arrow shaft left over. That left-over shaft is not shown. // Instead, it is sliced off because the span's CSS has overflow: hidden. // Thus, the reader sees an arrow that matches the subject matter width // without distortion. // Some functions, such as \cancel, need to vary their aspect ratio. These // functions do not get the overflow SVG treatment. // Second Brush Stroke // Low resolution monitors struggle to display images in fine detail. // So browsers apply anti-aliasing. A long straight arrow shaft therefore // will sometimes appear as if it has a blurred edge. // To mitigate this, these SVG files contain a second "brush-stroke" on the // arrow shafts. That is, a second long thin rectangular SVG path has been // written directly on top of each arrow shaft. This reinforcement causes // some of the screen pixels to display as black instead of the anti-aliased // gray pixel that a single path would generate. So we get arrow shafts // whose edges appear to be sharper. // In the katexImagesData object just below, the dimensions all // correspond to path geometry inside the relevant SVG. // For example, \overrightarrow uses the same arrowhead as glyph U+2192 // from the KaTeX Main font. The scaling factor is 1000. // That is, inside the font, that arrowhead is 522 units tall, which // corresponds to 0.522 em inside the document. const katexImagesData = { // path(s), minWidth, height, align overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], overgroup: [["leftgroup", "rightgroup"], 0.888, 342], undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], // The next three arrows are from the mhchem package. // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the // document as \xrightarrow or \xrightleftharpoons. Those have // min-length = 1.75em, so we set min-length on these next three to match. xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] }; const groupLength = function groupLength(arg) { if (arg.type === "ordgroup") { return arg.body.length; } else { return 1; } }; const svgSpan = function svgSpan(group, options) { // Create a span with inline SVG for the element. function buildSvgSpan_() { let viewBoxWidth = 400000; // default const label = group.label.substr(1); if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) { // Each type in the `if` statement corresponds to one of the ParseNode // types below. This narrowing is required to access `grp.base`. const grp = group; // There are four SVG images available for each function. // Choose a taller image when there are more characters. const numChars = groupLength(grp.base); let viewBoxHeight; let pathName; let height; if (numChars > 5) { if (label === "widehat" || label === "widecheck") { viewBoxHeight = 420; viewBoxWidth = 2364; height = 0.42; pathName = label + "4"; } else { viewBoxHeight = 312; viewBoxWidth = 2340; height = 0.34; pathName = "tilde4"; } } else { const imgIndex = [1, 1, 2, 2, 3, 3][numChars]; if (label === "widehat" || label === "widecheck") { viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; pathName = label + imgIndex; } else { viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; pathName = "tilde" + imgIndex; } } const path = new PathNode(pathName); const svgNode = new SvgNode([path], { "width": "100%", "height": height + "em", "viewBox": `0 0 ${viewBoxWidth} ${viewBoxHeight}`, "preserveAspectRatio": "none" }); return { span: buildCommon.makeSvgSpan([], [svgNode], options), minWidth: 0, height }; } else { const spans = []; const data = katexImagesData[label]; const paths = data[0], minWidth = data[1], viewBoxHeight = data[2]; const height = viewBoxHeight / 1000; const numSvgChildren = paths.length; let widthClasses; let aligns; if (numSvgChildren === 1) { // $FlowFixMe: All these cases must be of the 4-tuple type. const align1 = data[3]; widthClasses = ["hide-tail"]; aligns = [align1]; } else if (numSvgChildren === 2) { widthClasses = ["halfarrow-left", "halfarrow-right"]; aligns = ["xMinYMin", "xMaxYMin"]; } else if (numSvgChildren === 3) { widthClasses = ["brace-left", "brace-center", "brace-right"]; aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; } else { throw new Error(`Correct katexImagesData or update code here to support ${numSvgChildren} children.`); } for (let i = 0; i < numSvgChildren; i++) { const path = new PathNode(paths[i]); const svgNode = new SvgNode([path], { "width": "400em", "height": height + "em", "viewBox": `0 0 ${viewBoxWidth} ${viewBoxHeight}`, "preserveAspectRatio": aligns[i] + " slice" }); const span = buildCommon.makeSvgSpan([widthClasses[i]], [svgNode], options); if (numSvgChildren === 1) { return { span, minWidth, height }; } else { span.style.height = height + "em"; spans.push(span); } } return { span: buildCommon.makeSpan(["stretchy"], spans, options), minWidth, height }; } } // buildSvgSpan_() const _buildSvgSpan_ = buildSvgSpan_(), span = _buildSvgSpan_.span, minWidth = _buildSvgSpan_.minWidth, height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0. // Any adjustments relative to the baseline must be done in buildHTML. span.height = height; span.style.height = height + "em"; if (minWidth > 0) { span.style.minWidth = minWidth + "em"; } return span; }; const encloseSpan = function encloseSpan(inner, label, pad, options) { // Return an image span for \cancel, \bcancel, \xcancel, or \fbox let img; const totalHeight = inner.height + inner.depth + 2 * pad; if (/fbox|color/.test(label)) { img = buildCommon.makeSpan(["stretchy", label], [], options); if (label === "fbox") { const color = options.color && options.getColor(); if (color) { img.style.borderColor = color; } } } else { // \cancel, \bcancel, or \xcancel // Since \cancel's SVG is inline and it omits the viewBox attribute, // its stroke-width will not vary with span area. const lines = []; if (/^[bx]cancel$/.test(label)) { lines.push(new LineNode({ "x1": "0", "y1": "0", "x2": "100%", "y2": "100%", "stroke-width": "0.046em" })); } if (/^x?cancel$/.test(label)) { lines.push(new LineNode({ "x1": "0", "y1": "100%", "x2": "100%", "y2": "0", "stroke-width": "0.046em" })); } const svgNode = new SvgNode(lines, { "width": "100%", "height": totalHeight + "em" }); img = buildCommon.makeSvgSpan([], [svgNode], options); } img.height = totalHeight; img.style.height = totalHeight + "em"; return img; }; var stretchy = { encloseSpan, mathMLnode, svgSpan }; /** * Asserts that the node is of the given type and returns it with stricter * typing. Throws if the node's type does not match. */ function assertNodeType(node, type) { if (!node || node.type !== type) { throw new Error(`Expected node of type ${type}, but got ` + (node ? `node of type ${node.type}` : String(node))); } return node; } /** * Returns the node more strictly typed iff it is of the given type. Otherwise, * returns null. */ function assertSymbolNodeType(node) { const typedNode = checkSymbolNodeType(node); if (!typedNode) { throw new Error(`Expected node of symbol group type, but got ` + (node ? `node of type ${node.type}` : String(node))); } return typedNode; } /** * Returns the node more strictly typed iff it is of the given type. Otherwise, * returns null. */ function checkSymbolNodeType(node) { if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) { // $FlowFixMe return node; } return null; } // NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but const htmlBuilder = (grp, options) => { // Accents are handled in the TeXbook pg. 443, rule 12. let base; let group; let supSubGroup; if (grp && grp.type === "supsub") { // If our base is a character box, and we have superscripts and // subscripts, the supsub will defer to us. In particular, we want // to attach the superscripts and subscripts to the inner body (so // that the position of the superscripts and subscripts won't be // affected by the height of the accent). We accomplish this by // sticking the base of the accent into the base of the supsub, and // rendering that, while keeping track of where the accent is. // The real accent group is the base of the supsub group group = assertNodeType(grp.base, "accent"); // The character box is the base of the accent group base = group.base; // Stick the character box into the base of the supsub group grp.base = base; // Rerender the supsub group with its new base, and store that // result. supSubGroup = assertSpan(buildGroup(grp, options)); // reset original base grp.base = group; } else { group = assertNodeType(grp, "accent"); base = group.base; } // Build the base group const body = buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? const mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the // nucleus is not a single character, let s = 0; otherwise set s to the // kern amount for the nucleus followed by the \skewchar of its font." // Note that our skew metrics are just the kern between each character // and the skewchar. let skew = 0; if (mustShift) { // If the base is a character box, then we want the skew of the // innermost character. To do that, we find the innermost character: const baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it const baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we // removed with getBaseElem might contain things like \color which // we can't get rid of. // TODO(emily): Find a better way to get the skew } // calculate the amount of space between the body and the accent let clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent let accentBody; if (!group.isStretchy) { let accent; let width; if (group.label === "\\vec") { // Before version 0.9, \vec used the combining font glyph U+20D7. // But browsers, especially Safari, are not consistent in how they // render combining characters when not preceded by a character. // So now we use an SVG. // If Safari reforms, we should consider reverting to the glyph. accent = buildCommon.staticSvg("vec", options); width = buildCommon.svgData.vec[1]; } else { accent = buildCommon.makeOrd({ mode: group.mode, text: group.label }, options, "textord"); accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to // shift the accent over to a place we don't want. accent.italic = 0; width = accent.width; } accentBody = buildCommon.makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be // at least the width of the accent, and overlap directly onto the // character without any vertical offset. const accentFull = group.label === "\\textcircled"; if (accentFull) { accentBody.classes.push('accent-full'); clearance = body.height; } // Shift the accent over by the skew. let left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }` // so that the accent doesn't contribute to the bounding box. // We need to shift the character by its width (effectively half // its width) to compensate. if (!accentFull) { left -= width / 2; } accentBody.style.left = left + "em"; // \textcircled uses the \bigcirc glyph, so it needs some // vertical adjustment to match LaTeX. if (group.label === "\\textcircled") { accentBody.style.top = ".2em"; } accentBody = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "kern", size: -clearance }, { type: "elem", elem: accentBody }] }, options); } else { accentBody = stretchy.svgSpan(group, options); accentBody = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "elem", elem: accentBody, wrapperClasses: ["svg-align"], wrapperStyle: skew > 0 ? { width: `calc(100% - ${2 * skew}em)`, marginLeft: `${2 * skew}em` } : undefined }] }, options); } const accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options); if (supSubGroup) { // Here, we replace the "base" child of the supsub with our newly // generated accent. supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the // accent, we manually recalculate height. supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not. supSubGroup.classes[0] = "mord"; return supSubGroup; } else { return accentWrap; } }; const mathmlBuilder = (group, options) => { const accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]); const node = new mathMLTree.MathNode("mover", [buildGroup$1(group.base, options), accentNode]); node.setAttribute("accent", "true"); return node; }; const NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(accent => `\\${accent}`).join("|")); // Accents defineFunction({ type: "accent", names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], props: { numArgs: 1 }, handler: (context, args) => { const base = args[0]; const isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); const isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; return { type: "accent", mode: context.parser.mode, label: context.funcName, isStretchy: isStretchy, isShifty: isShifty, base: base }; }, htmlBuilder, mathmlBuilder }); // Text-mode accents defineFunction({ type: "accent", names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v", "\\textcircled"], props: { numArgs: 1, allowedInText: true, allowedInMath: false }, handler: (context, args) => { const base = args[0]; return { type: "accent", mode: context.parser.mode, label: context.funcName, isStretchy: false, isShifty: true, base: base }; }, htmlBuilder, mathmlBuilder }); // Horizontal overlap functions defineFunction({ type: "accentUnder", names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], props: { numArgs: 1 }, handler: (_ref, args) => { let parser = _ref.parser, funcName = _ref.funcName; const base = args[0]; return { type: "accentUnder", mode: parser.mode, label: funcName, base: base }; }, htmlBuilder: (group, options) => { // Treat under accents much like underlines. const innerGroup = buildGroup(group.base, options); const accentBody = stretchy.svgSpan(group, options); const kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns const vlist = buildCommon.makeVList({ positionType: "top", positionData: innerGroup.height, children: [{ type: "elem", elem: accentBody, wrapperClasses: ["svg-align"] }, { type: "kern", size: kern }, { type: "elem", elem: innerGroup }] }, options); return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options); }, mathmlBuilder: (group, options) => { const accentNode = stretchy.mathMLnode(group.label); const node = new mathMLTree.MathNode("munder", [buildGroup$1(group.base, options), accentNode]); node.setAttribute("accentunder", "true"); return node; } }); // Helper function const paddedNode = group => { const node = new mathMLTree.MathNode("mpadded", group ? [group] : []); node.setAttribute("width", "+0.6em"); node.setAttribute("lspace", "0.3em"); return node; }; // Stretchy arrows with an optional argument defineFunction({ type: "xArrow", names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension. // Direct use of these functions is discouraged and may break someday. "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"], props: { numArgs: 1, numOptionalArgs: 1 }, handler(_ref, args, optArgs) { let parser = _ref.parser, funcName = _ref.funcName; return { type: "xArrow", mode: parser.mode, label: funcName, body: args[0], below: optArgs[0] }; }, // Flow is unable to correctly infer the type of `group`, even though it's // unamibiguously determined from the passed-in `type` above. htmlBuilder(group, options) { const style = options.style; // Build the argument groups in the appropriate style. // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% // Some groups can return document fragments. Handle those by wrapping // them in a span. let newOptions = options.havingStyle(style.sup()); const upperGroup = buildCommon.wrapFragment(buildGroup(group.body, newOptions, options), options); upperGroup.classes.push("x-arrow-pad"); let lowerGroup; if (group.below) { // Build the lower group newOptions = options.havingStyle(style.sub()); lowerGroup = buildCommon.wrapFragment(buildGroup(group.below, newOptions, options), options); lowerGroup.classes.push("x-arrow-pad"); } const arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. // The point we want on the math axis is at 0.5 * arrowBody.height. const arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi let upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") { upperShift -= upperGroup.depth; // shift up if depth encroaches } // Generate the vlist let vlist; if (lowerGroup) { const lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; vlist = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }, { type: "elem", elem: lowerGroup, shift: lowerShift }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }] }, options); } // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[1].classes.push("svg-align"); return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options); }, mathmlBuilder(group, options) { const arrowNode = stretchy.mathMLnode(group.label); let node; if (group.body) { const upperNode = paddedNode(buildGroup$1(group.body, options)); if (group.below) { const lowerNode = paddedNode(buildGroup$1(group.below, options)); node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]); } else { node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); } } else if (group.below) { const lowerNode = paddedNode(buildGroup$1(group.below, options)); node = new mathMLTree.MathNode("munder", [arrowNode, lowerNode]); } else { // This should never happen. // Parser.js throws an error if there is no argument. node = paddedNode(); node = new mathMLTree.MathNode("mover", [arrowNode, node]); } return node; } }); // {123} and converts into symbol with code 123. It is used by the *macro* // \char defined in macros.js. defineFunction({ type: "textord", names: ["\\@char"], props: { numArgs: 1, allowedInText: true }, handler(_ref, args) { let parser = _ref.parser; const arg = assertNodeType(args[0], "ordgroup"); const group = arg.body; let number = ""; for (let i = 0; i < group.length; i++) { const node = assertNodeType(group[i], "textord"); number += node.text; } const code = parseInt(number); if (isNaN(code)) { throw new ParseError(`\\@char has non-numeric argument ${number}`); } return { type: "textord", mode: parser.mode, text: String.fromCharCode(code) }; } }); const htmlBuilder$1 = (group, options) => { const elements = buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. // To accomplish this, we wrap the results in a fragment, so the inner // elements will be able to directly interact with their neighbors. For // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` return buildCommon.makeFragment(elements); }; const mathmlBuilder$1 = (group, options) => { const inner = buildExpression$1(group.body, options.withColor(group.color)); const node = new mathMLTree.MathNode("mstyle", inner); node.setAttribute("mathcolor", group.color); return node; }; defineFunction({ type: "color", names: ["\\textcolor"], props: { numArgs: 2, allowedInText: true, greediness: 3, argTypes: ["color", "original"] }, handler(_ref, args) { let parser = _ref.parser; const color = assertNodeType(args[0], "color-token").color; const body = args[1]; return { type: "color", mode: parser.mode, color, body: ordargument(body) }; }, htmlBuilder: htmlBuilder$1, mathmlBuilder: mathmlBuilder$1 }); defineFunction({ type: "color", names: ["\\color"], props: { numArgs: 1, allowedInText: true, greediness: 3, argTypes: ["color"] }, handler(_ref2, args) { let parser = _ref2.parser, breakOnTokenText = _ref2.breakOnTokenText; const color = assertNodeType(args[0], "color-token").color; // Set macro \current@color in current namespace to store the current // color, mimicking the behavior of color.sty. // This is currently used just to correctly color a \right // that follows a \color command. parser.gullet.macros.set("\\current@color", color); // Parse out the implicit body that should be colored. const body = parser.parseExpression(true, breakOnTokenText); return { type: "color", mode: parser.mode, color, body }; }, htmlBuilder: htmlBuilder$1, mathmlBuilder: mathmlBuilder$1 }); // Row breaks within tabular environments, and line breaks at top level // same signature, we implement them as one megafunction, with newRow // indicating whether we're in the \cr case, and newLine indicating whether // to break the line in the \newline case. defineFunction({ type: "cr", names: ["\\cr", "\\newline"], props: { numArgs: 0, numOptionalArgs: 1, argTypes: ["size"], allowedInText: true }, handler(_ref, args, optArgs) { let parser = _ref.parser, funcName = _ref.funcName; const size = optArgs[0]; const newRow = funcName === "\\cr"; let newLine = false; if (!newRow) { if (parser.settings.displayMode && parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode")) { newLine = false; } else { newLine = true; } } return { type: "cr", mode: parser.mode, newLine, newRow, size: size && assertNodeType(size, "size").value }; }, // The following builders are called only at the top level, // not within tabular/array environments. htmlBuilder(group, options) { if (group.newRow) { throw new ParseError("\\cr valid only within a tabular/array environment"); } const span = buildCommon.makeSpan(["mspace"], [], options); if (group.newLine) { span.classes.push("newline"); if (group.size) { span.style.marginTop = calculateSize(group.size, options) + "em"; } } return span; }, mathmlBuilder(group, options) { const node = new mathMLTree.MathNode("mspace"); if (group.newLine) { node.setAttribute("linebreak", "newline"); if (group.size) { node.setAttribute("height", calculateSize(group.size, options) + "em"); } } return node; } }); const globalMap = { "\\global": "\\global", "\\long": "\\\\globallong", "\\\\globallong": "\\\\globallong", "\\def": "\\gdef", "\\gdef": "\\gdef", "\\edef": "\\xdef", "\\xdef": "\\xdef", "\\let": "\\\\globallet", "\\futurelet": "\\\\globalfuture" }; const checkControlSequence = tok => { const name = tok.text; if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { throw new ParseError("Expected a control sequence", tok); } return name; }; const getRHS = parser => { let tok = parser.gullet.popToken(); if (tok.text === "=") { // consume optional equals tok = parser.gullet.popToken(); if (tok.text === " ") { // consume one optional space tok = parser.gullet.popToken(); } } return tok; }; const letCommand = (parser, name, tok, global) => { let macro = parser.gullet.macros.get(tok.text); if (macro == null) { // don't expand it later even if a macro with the same name is defined // e.g., \let\foo=\frac \def\frac{\relax} \frac12 tok.noexpand = true; macro = { tokens: [tok], numArgs: 0, // reproduce the same behavior in expansion unexpandable: !parser.gullet.isExpandable(tok.text) }; } parser.gullet.macros.set(name, macro, global); }; // -> | // -> |\global // -> | // -> \global|\long|\outer defineFunction({ type: "internal", names: ["\\global", "\\long", "\\\\globallong"], props: { numArgs: 0, allowedInText: true }, handler(_ref) { let parser = _ref.parser, funcName = _ref.funcName; parser.consumeSpaces(); const token = parser.fetch(); if (globalMap[token.text]) { // KaTeX doesn't have \par, so ignore \long if (funcName === "\\global" || funcName === "\\\\globallong") { token.text = globalMap[token.text]; } return assertNodeType(parser.parseFunction(), "internal"); } throw new ParseError(`Invalid token after macro prefix`, token); } }); // Basic support for macro definitions: \def, \gdef, \edef, \xdef // -> // -> \def|\gdef|\edef|\xdef // -> defineFunction({ type: "internal", names: ["\\def", "\\gdef", "\\edef", "\\xdef"], props: { numArgs: 0, allowedInText: true }, handler(_ref2) { let parser = _ref2.parser, funcName = _ref2.funcName; let arg = parser.gullet.consumeArgs(1)[0]; if (arg.length !== 1) { throw new ParseError("\\gdef's first argument must be a macro name"); } const name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ... let numArgs = 0; arg = parser.gullet.consumeArgs(1)[0]; while (arg.length === 1 && arg[0].text === "#") { arg = parser.gullet.consumeArgs(1)[0]; if (arg.length !== 1) { throw new ParseError(`Invalid argument number length "${arg.length}"`); } if (!/^[1-9]$/.test(arg[0].text)) { throw new ParseError(`Invalid argument number "${arg[0].text}"`); } numArgs++; if (parseInt(arg[0].text) !== numArgs) { throw new ParseError(`Argument number "${arg[0].text}" out of order`); } arg = parser.gullet.consumeArgs(1)[0]; } if (funcName === "\\edef" || funcName === "\\xdef") { arg = parser.gullet.expandTokens(arg); arg.reverse(); // to fit in with stack order } // Final arg is the expansion of the macro parser.gullet.macros.set(name, { tokens: arg, numArgs }, funcName === globalMap[funcName]); return { type: "internal", mode: parser.mode }; } }); // -> // -> \futurelet // | \let // -> |= defineFunction({ type: "internal", names: ["\\let", "\\\\globallet"], props: { numArgs: 0, allowedInText: true }, handler(_ref3) { let parser = _ref3.parser, funcName = _ref3.funcName; const name = checkControlSequence(parser.gullet.popToken()); parser.gullet.consumeSpaces(); const tok = getRHS(parser); letCommand(parser, name, tok, funcName === "\\\\globallet"); return { type: "internal", mode: parser.mode }; } }); // ref: https://www.tug.org/TUGboat/tb09-3/tb22bechtolsheim.pdf defineFunction({ type: "internal", names: ["\\futurelet", "\\\\globalfuture"], props: { numArgs: 0, allowedInText: true }, handler(_ref4) { let parser = _ref4.parser, funcName = _ref4.funcName; const name = checkControlSequence(parser.gullet.popToken()); const middle = parser.gullet.popToken(); const tok = parser.gullet.popToken(); letCommand(parser, name, tok, funcName === "\\\\globalfuture"); parser.gullet.pushToken(tok); parser.gullet.pushToken(middle); return { type: "internal", mode: parser.mode }; } }); /** * This file deals with creating delimiters of various sizes. The TeXbook * discusses these routines on page 441-442, in the "Another subroutine sets box * x to a specified variable delimiter" paragraph. * * There are three main routines here. `makeSmallDelim` makes a delimiter in the * normal font, but in either text, script, or scriptscript style. * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1, * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of * smaller pieces that are stacked on top of one another. * * The functions take a parameter `center`, which determines if the delimiter * should be centered around the axis. * * Then, there are three exposed functions. `sizedDelim` makes a delimiter in * one of the given sizes. This is used for things like `\bigl`. * `customSizedDelim` makes a delimiter with a given total height+depth. It is * called in places like `\sqrt`. `leftRightDelim` makes an appropriate * delimiter which surrounds an expression of a given height an depth. It is * used in `\left` and `\right`. */ /** * Get the metrics for a given symbol and font, after transformation (i.e. * after following replacement from symbols.js) */ const getMetrics = function getMetrics(symbol, font, mode) { const replace = symbols.math[symbol] && symbols.math[symbol].replace; const metrics = getCharacterMetrics(replace || symbol, font, mode); if (!metrics) { throw new Error(`Unsupported symbol ${symbol} and font size ${font}.`); } return metrics; }; /** * Puts a delimiter span in a given style, and adds appropriate height, depth, * and maxFontSizes. */ const styleWrap = function styleWrap(delim, toStyle, options, classes) { const newOptions = options.havingBaseStyle(toStyle); const span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options); const delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; span.height *= delimSizeMultiplier; span.depth *= delimSizeMultiplier; span.maxFontSize = newOptions.sizeMultiplier; return span; }; const centerSpan = function centerSpan(span, options, style) { const newOptions = options.havingBaseStyle(style); const shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; span.classes.push("delimcenter"); span.style.top = shift + "em"; span.height -= shift; span.depth += shift; }; /** * Makes a small delimiter. This is a delimiter that comes in the Main-Regular * font, but is restyled to either be in textstyle, scriptstyle, or * scriptscriptstyle. */ const makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { const text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); const span = styleWrap(text, style, options, classes); if (center) { centerSpan(span, options, style); } return span; }; /** * Builds a symbol in the given font size (note size is an integer) */ const mathrmSize = function mathrmSize(value, size, mode, options) { return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options); }; /** * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2, * Size3, or Size4 fonts. It is always rendered in textstyle. */ const makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { const inner = mathrmSize(delim, size, mode, options); const span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), Style$1.TEXT, options, classes); if (center) { centerSpan(span, options, Style$1.TEXT); } return span; }; /** * Make an inner span with the given offset and in the given font. This is used * in `makeStackedDelim` to make the stacking pieces for the delimiter. */ const makeInner = function makeInner(symbol, font, mode) { let sizeClass; // Apply the correct CSS class to choose the right font. if (font === "Size1-Regular") { sizeClass = "delim-size1"; } else /* if (font === "Size4-Regular") */ { sizeClass = "delim-size4"; } const inner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element // in the appropriate tag that VList uses. return { type: "elem", elem: inner }; }; // Helper for makeStackedDelim const lap = { type: "kern", size: -0.005 }; /** * Make a stacked delimiter out of a given delimiter, with the total height at * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. */ const makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { // There are four parts, the top, an optional middle, a repeated part, and a // bottom. let top; let middle; let repeat; let bottom; top = repeat = bottom = delim; middle = null; // Also keep track of what font the delimiters are in let font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the // repeats of the arrows if (delim === "\\uparrow") { repeat = bottom = "\u23d0"; } else if (delim === "\\Uparrow") { repeat = bottom = "\u2016"; } else if (delim === "\\downarrow") { top = repeat = "\u23d0"; } else if (delim === "\\Downarrow") { top = repeat = "\u2016"; } else if (delim === "\\updownarrow") { top = "\\uparrow"; repeat = "\u23d0"; bottom = "\\downarrow"; } else if (delim === "\\Updownarrow") { top = "\\Uparrow"; repeat = "\u2016"; bottom = "\\Downarrow"; } else if (delim === "[" || delim === "\\lbrack") { top = "\u23a1"; repeat = "\u23a2"; bottom = "\u23a3"; font = "Size4-Regular"; } else if (delim === "]" || delim === "\\rbrack") { top = "\u23a4"; repeat = "\u23a5"; bottom = "\u23a6"; font = "Size4-Regular"; } else if (delim === "\\lfloor" || delim === "\u230a") { repeat = top = "\u23a2"; bottom = "\u23a3"; font = "Size4-Regular"; } else if (delim === "\\lceil" || delim === "\u2308") { top = "\u23a1"; repeat = bottom = "\u23a2"; font = "Size4-Regular"; } else if (delim === "\\rfloor" || delim === "\u230b") { repeat = top = "\u23a5"; bottom = "\u23a6"; font = "Size4-Regular"; } else if (delim === "\\rceil" || delim === "\u2309") { top = "\u23a4"; repeat = bottom = "\u23a5"; font = "Size4-Regular"; } else if (delim === "(" || delim === "\\lparen") { top = "\u239b"; repeat = "\u239c"; bottom = "\u239d"; font = "Size4-Regular"; } else if (delim === ")" || delim === "\\rparen") { top = "\u239e"; repeat = "\u239f"; bottom = "\u23a0"; font = "Size4-Regular"; } else if (delim === "\\{" || delim === "\\lbrace") { top = "\u23a7"; middle = "\u23a8"; bottom = "\u23a9"; repeat = "\u23aa"; font = "Size4-Regular"; } else if (delim === "\\}" || delim === "\\rbrace") { top = "\u23ab"; middle = "\u23ac"; bottom = "\u23ad"; repeat = "\u23aa"; font = "Size4-Regular"; } else if (delim === "\\lgroup" || delim === "\u27ee") { top = "\u23a7"; bottom = "\u23a9"; repeat = "\u23aa"; font = "Size4-Regular"; } else if (delim === "\\rgroup" || delim === "\u27ef") { top = "\u23ab"; bottom = "\u23ad"; repeat = "\u23aa"; font = "Size4-Regular"; } else if (delim === "\\lmoustache" || delim === "\u23b0") { top = "\u23a7"; bottom = "\u23ad"; repeat = "\u23aa"; font = "Size4-Regular"; } else if (delim === "\\rmoustache" || delim === "\u23b1") { top = "\u23ab"; bottom = "\u23a9"; repeat = "\u23aa"; font = "Size4-Regular"; } // Get the metrics of the four sections const topMetrics = getMetrics(top, font, mode); const topHeightTotal = topMetrics.height + topMetrics.depth; const repeatMetrics = getMetrics(repeat, font, mode); const repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; const bottomMetrics = getMetrics(bottom, font, mode); const bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; let middleHeightTotal = 0; let middleFactor = 1; if (middle !== null) { const middleMetrics = getMetrics(middle, font, mode); middleHeightTotal = middleMetrics.height + middleMetrics.depth; middleFactor = 2; // repeat symmetrically above and below middle } // Calcuate the minimal height that the delimiter can have. // It is at least the size of the top, bottom, and optional middle combined. const minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need const repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols const realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note // that in this context, "center" means that the delimiter should be // centered around the axis in the current style, while normally it is // centered around the axis in textstyle. let axisHeight = options.fontMetrics().axisHeight; if (center) { axisHeight *= options.sizeMultiplier; } // Calculate the depth const depth = realHeightTotal / 2 - axisHeight; // This function differs from the TeX procedure in one way. // We shift each repeat element downwards by 0.005em, to prevent a gap // due to browser floating point rounding error. // Then, at the last element-to element joint, we add one extra repeat // element to cover the gap created by the shifts. // Find the shift needed to align the upper end of the extra element at a point // 0.005em above the lower end of the top element. const shiftOfExtraElement = (repeatCount + 1) * 0.005 - repeatHeightTotal; // Now, we start building the pieces that will go into the vlist // Keep a list of the inner pieces const inners = []; // Add the bottom symbol inners.push(makeInner(bottom, font, mode)); if (middle === null) { // Add that many symbols for (let i = 0; i < repeatCount; i++) { inners.push(lap); // overlap inners.push(makeInner(repeat, font, mode)); } } else { // When there is a middle bit, we need the middle part and two repeated // sections for (let i = 0; i < repeatCount; i++) { inners.push(lap); inners.push(makeInner(repeat, font, mode)); } // Insert one extra repeat element. inners.push({ type: "kern", size: shiftOfExtraElement }); inners.push(makeInner(repeat, font, mode)); inners.push(lap); // Now insert the middle of the brace. inners.push(makeInner(middle, font, mode)); for (let i = 0; i < repeatCount; i++) { inners.push(lap); inners.push(makeInner(repeat, font, mode)); } } // To cover the gap create by the overlaps, insert one more repeat element, // at a position that juts 0.005 above the bottom of the top element. if ((repeat === "\u239c" || repeat === "\u239f") && repeatCount === 0) { // Parentheses need a short repeat element in order to avoid an overrun. // We'll make a 0.3em tall element from a SVG. const overlap = buildCommon.svgData.leftParenInner[2] / 2; inners.push({ type: "kern", size: -overlap }); const pathName = repeat === "\u239c" ? "leftParenInner" : "rightParenInner"; const innerSpan = buildCommon.staticSvg(pathName, options); inners.push({ type: "elem", elem: innerSpan }); inners.push({ type: "kern", size: -overlap }); } else { inners.push({ type: "kern", size: shiftOfExtraElement }); inners.push(makeInner(repeat, font, mode)); inners.push(lap); } // Add the top symbol inners.push(makeInner(top, font, mode)); // Finally, build the vlist const newOptions = options.havingBaseStyle(Style$1.TEXT); const inner = buildCommon.makeVList({ positionType: "bottom", positionData: depth, children: inners }, newOptions); return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), Style$1.TEXT, options, classes); }; // All surds have 0.08em padding above the viniculum inside the SVG. // That keeps browser span height rounding error from pinching the line. const vbPad = 80; // padding above the surd, measured inside the viewBox. const emPad = 0.08; // padding, in ems, measured in the document. const sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) { const path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight); const pathNode = new PathNode(sqrtName, path); const svg = new SvgNode([pathNode], { // Note: 1000:1 ratio of viewBox to document em width. "width": "400em", "height": height + "em", "viewBox": "0 0 400000 " + viewBoxHeight, "preserveAspectRatio": "xMinYMin slice" }); return buildCommon.makeSvgSpan(["hide-tail"], [svg], options); }; /** * Make a sqrt image of the given height, */ const makeSqrtImage = function makeSqrtImage(height, options) { // Define a newOptions that removes the effect of size changes such as \Huge. // We don't pick different a height surd for \Huge. For it, we scale up. const newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds. const delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); let sizeMultiplier = newOptions.sizeMultiplier; // default // The standard sqrt SVGs each have a 0.04em thick viniculum. // If Settings.minRuleThickness is larger than that, we add extraViniculum. const extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol. let span; let spanHeight = 0; let texHeight = 0; let viewBoxHeight = 0; let advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd. // Then browser rounding error on the parent span height will not // encroach on the ink of the viniculum. But that padding is not // included in the TeX-like `height` used for calculation of // vertical alignment. So texHeight = span.height < span.style.height. if (delim.type === "small") { // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. // 1000 unit normal glyph height. viewBoxHeight = 1000 + 1000 * extraViniculum + vbPad; if (height < 1.0) { sizeMultiplier = 1.0; // mimic a \textfont radical } else if (height < 1.4) { sizeMultiplier = 0.7; // mimic a \scriptfont radical } spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier; texHeight = (1.00 + extraViniculum) / sizeMultiplier; span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "0.853em"; advanceWidth = 0.833 / sizeMultiplier; // from the font. } else if (delim.type === "large") { // These SVGs come from fonts: KaTeX_Size1, _Size2, etc. viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier; spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier; span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "1.02em"; advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font. } else { // Tall sqrt. In TeX, this would be stacked using multiple glyphs. // We'll use a single SVG to accomplish the same thing. spanHeight = height + extraViniculum + emPad; texHeight = height + extraViniculum; viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad; span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options); span.style.minWidth = "0.742em"; advanceWidth = 1.056; } span.height = texHeight; span.style.height = spanHeight + "em"; return { span, advanceWidth, // Calculate the actual line width. // This actually should depend on the chosen font -- e.g. \boldmath // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and // have thicker rules. ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraViniculum) * sizeMultiplier }; }; // There are three kinds of delimiters, delimiters that stack when they become // too large const stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack const stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1"]; // and delimiters that never stack const stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of // $\bigl| // \Bigl| \biggl| \Biggl| \showlists$ // Used to create stacked delimiters of appropriate sizes in makeSizedDelim. const sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; /** * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. */ const makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { // < and > turn into \langle and \rangle in delimiters if (delim === "<" || delim === "\\lt" || delim === "\u27e8") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt" || delim === "\u27e9") { delim = "\\rangle"; } // Sized delimiters are never centered. if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) { return makeLargeDelim(delim, size, false, options, mode, classes); } else if (utils.contains(stackAlwaysDelimiters, delim)) { return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); } else { throw new ParseError("Illegal delimiter: '" + delim + "'"); } }; /** * There are three different sequences of delimiter sizes that the delimiters * follow depending on the kind of delimiter. This is used when creating custom * sized delimiters to decide whether to create a small, large, or stacked * delimiter. * * In real TeX, these sequences aren't explicitly defined, but are instead * defined inside the font metrics. Since there are only three sequences that * are possible for the delimiters that TeX defines, it is easier to just encode * them explicitly here. */ // Delimiters that never stack try small delimiters and large delimiters only const stackNeverDelimiterSequence = [{ type: "small", style: Style$1.SCRIPTSCRIPT }, { type: "small", style: Style$1.SCRIPT }, { type: "small", style: Style$1.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }]; // Delimiters that always stack try the small delimiters first, then stack const stackAlwaysDelimiterSequence = [{ type: "small", style: Style$1.SCRIPTSCRIPT }, { type: "small", style: Style$1.SCRIPT }, { type: "small", style: Style$1.TEXT }, { type: "stack" }]; // Delimiters that stack when large try the small and then large delimiters, and // stack afterwards const stackLargeDelimiterSequence = [{ type: "small", style: Style$1.SCRIPTSCRIPT }, { type: "small", style: Style$1.SCRIPT }, { type: "small", style: Style$1.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }, { type: "stack" }]; /** * Get the font used in a delimiter based on what kind of delimiter it is. * TODO(#963) Use more specific font family return type once that is introduced. */ const delimTypeToFont = function delimTypeToFont(type) { if (type.type === "small") { return "Main-Regular"; } else if (type.type === "large") { return "Size" + type.size + "-Regular"; } else if (type.type === "stack") { return "Size4-Regular"; } else { throw new Error(`Add support for delim type '${type.type}' here.`); } }; /** * Traverse a sequence of types of delimiters to decide what kind of delimiter * should be used to create a delimiter of the given height+depth. */ const traverseSequence = function traverseSequence(delim, height, sequence, options) { // Here, we choose the index we should start at in the sequences. In smaller // sizes (which correspond to larger numbers in style.size) we start earlier // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2 const start = Math.min(2, 3 - options.style.size); for (let i = start; i < sequence.length; i++) { if (sequence[i].type === "stack") { // This is always the last delimiter, so we just break the loop now. break; } const metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math"); let heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we // account for the style change size. if (sequence[i].type === "small") { const newOptions = options.havingBaseStyle(sequence[i].style); heightDepth *= newOptions.sizeMultiplier; } // Check if the delimiter at this size works for the given height. if (heightDepth > height) { return sequence[i]; } } // If we reached the end of the sequence, return the last sequence element. return sequence[sequence.length - 1]; }; /** * Make a delimiter of a given height+depth, with optional centering. Here, we * traverse the sequences, and create a delimiter that the sequence tells us to. */ const makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { if (delim === "<" || delim === "\\lt" || delim === "\u27e8") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt" || delim === "\u27e9") { delim = "\\rangle"; } // Decide what sequence to use let sequence; if (utils.contains(stackNeverDelimiters, delim)) { sequence = stackNeverDelimiterSequence; } else if (utils.contains(stackLargeDelimiters, delim)) { sequence = stackLargeDelimiterSequence; } else { sequence = stackAlwaysDelimiterSequence; } // Look through the sequence const delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs. // Depending on the sequence element we decided on, call the // appropriate function. if (delimType.type === "small") { return makeSmallDelim(delim, delimType.style, center, options, mode, classes); } else if (delimType.type === "large") { return makeLargeDelim(delim, delimType.size, center, options, mode, classes); } else /* if (delimType.type === "stack") */ { return makeStackedDelim(delim, height, center, options, mode, classes); } }; /** * Make a delimiter for use with `\left` and `\right`, given a height and depth * of an expression that the delimiters surround. */ const makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { // We always center \left/\right delimiters, so the axis is always shifted const axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right const delimiterFactor = 901; const delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; const maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); const totalHeight = Math.max( // In real TeX, calculations are done using integral values which are // 65536 per pt, or 655360 per em. So, the division here truncates in // TeX but doesn't here, producing different results. If we wanted to // exactly match TeX's calculation, we could do // Math.floor(655360 * maxDistFromAxis / 500) * // delimiterFactor / 655360 // (To see the difference, compare // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} // in TeX and KaTeX) maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total // height return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); }; var delimiter = { sqrtImage: makeSqrtImage, sizedDelim: makeSizedDelim, customSizedDelim: makeCustomSizedDelim, leftRightDelim: makeLeftRightDelim }; // Extra data needed for the delimiter handler down below const delimiterSizes = { "\\bigl": { mclass: "mopen", size: 1 }, "\\Bigl": { mclass: "mopen", size: 2 }, "\\biggl": { mclass: "mopen", size: 3 }, "\\Biggl": { mclass: "mopen", size: 4 }, "\\bigr": { mclass: "mclose", size: 1 }, "\\Bigr": { mclass: "mclose", size: 2 }, "\\biggr": { mclass: "mclose", size: 3 }, "\\Biggr": { mclass: "mclose", size: 4 }, "\\bigm": { mclass: "mrel", size: 1 }, "\\Bigm": { mclass: "mrel", size: 2 }, "\\biggm": { mclass: "mrel", size: 3 }, "\\Biggm": { mclass: "mrel", size: 4 }, "\\big": { mclass: "mord", size: 1 }, "\\Big": { mclass: "mord", size: 2 }, "\\bigg": { mclass: "mord", size: 3 }, "\\Bigg": { mclass: "mord", size: 4 } }; const delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27e8", "\\rangle", "\u27e9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; // Delimiter functions function checkDelimiter(delim, context) { const symDelim = checkSymbolNodeType(delim); if (symDelim && utils.contains(delimiters, symDelim.text)) { return symDelim; } else if (symDelim) { throw new ParseError(`Invalid delimiter '${symDelim.text}' after '${context.funcName}'`, delim); } else { throw new ParseError(`Invalid delimiter type '${delim.type}'`, delim); } } defineFunction({ type: "delimsizing", names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], props: { numArgs: 1 }, handler: (context, args) => { const delim = checkDelimiter(args[0], context); return { type: "delimsizing", mode: context.parser.mode, size: delimiterSizes[context.funcName].size, mclass: delimiterSizes[context.funcName].mclass, delim: delim.text }; }, htmlBuilder: (group, options) => { if (group.delim === ".") { // Empty delimiters still count as elements, even though they don't // show anything. return buildCommon.makeSpan([group.mclass]); } // Use delimiter.sizedDelim to generate the delimiter. return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]); }, mathmlBuilder: group => { const children = []; if (group.delim !== ".") { children.push(makeText(group.delim, group.mode)); } const node = new mathMLTree.MathNode("mo", children); if (group.mclass === "mopen" || group.mclass === "mclose") { // Only some of the delimsizing functions act as fences, and they // return "mopen" or "mclose" mclass. node.setAttribute("fence", "true"); } else { // Explicitly disable fencing if it's not a fence, to override the // defaults. node.setAttribute("fence", "false"); } return node; } }); function assertParsed(group) { if (!group.body) { throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); } } defineFunction({ type: "leftright-right", names: ["\\right"], props: { numArgs: 1 }, handler: (context, args) => { // \left case below triggers parsing of \right in // `const right = parser.parseFunction();` // uses this return value. const color = context.parser.gullet.macros.get("\\current@color"); if (color && typeof color !== "string") { throw new ParseError("\\current@color set to non-string in \\right"); } return { type: "leftright-right", mode: context.parser.mode, delim: checkDelimiter(args[0], context).text, color // undefined if not set via \color }; } }); defineFunction({ type: "leftright", names: ["\\left"], props: { numArgs: 1 }, handler: (context, args) => { const delim = checkDelimiter(args[0], context); const parser = context.parser; // Parse out the implicit body ++parser.leftrightDepth; // parseExpression stops before '\\right' const body = parser.parseExpression(false); --parser.leftrightDepth; // Check the next token parser.expect("\\right", false); const right = assertNodeType(parser.parseFunction(), "leftright-right"); return { type: "leftright", mode: parser.mode, body, left: delim.text, right: right.delim, rightColor: right.color }; }, htmlBuilder: (group, options) => { assertParsed(group); // Build the inner expression const inner = buildExpression(group.body, options, true, ["mopen", "mclose"]); let innerHeight = 0; let innerDepth = 0; let hadMiddle = false; // Calculate its height and depth for (let i = 0; i < inner.length; i++) { // Property `isMiddle` not defined on `span`. See comment in // "middle"'s htmlBuilder. // $FlowFixMe if (inner[i].isMiddle) { hadMiddle = true; } else { innerHeight = Math.max(inner[i].height, innerHeight); innerDepth = Math.max(inner[i].depth, innerDepth); } } // The size of delimiters is the same, regardless of what style we are // in. Thus, to correctly calculate the size of delimiter we need around // a group, we scale down the inner size based on the size. innerHeight *= options.sizeMultiplier; innerDepth *= options.sizeMultiplier; let leftDelim; if (group.left === ".") { // Empty delimiters in \left and \right make null delimiter spaces. leftDelim = makeNullDelimiter(options, ["mopen"]); } else { // Otherwise, use leftRightDelim to generate the correct sized // delimiter. leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]); } // Add it to the beginning of the expression inner.unshift(leftDelim); // Handle middle delimiters if (hadMiddle) { for (let i = 1; i < inner.length; i++) { const middleDelim = inner[i]; // Property `isMiddle` not defined on `span`. See comment in // "middle"'s htmlBuilder. // $FlowFixMe const isMiddle = middleDelim.isMiddle; if (isMiddle) { // Apply the options that were active when \middle was called inner[i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []); } } } let rightDelim; // Same for the right delimiter, but using color specified by \color if (group.right === ".") { rightDelim = makeNullDelimiter(options, ["mclose"]); } else { const colorOptions = group.rightColor ? options.withColor(group.rightColor) : options; rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]); } // Add it to the end of the expression. inner.push(rightDelim); return buildCommon.makeSpan(["minner"], inner, options); }, mathmlBuilder: (group, options) => { assertParsed(group); const inner = buildExpression$1(group.body, options); if (group.left !== ".") { const leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]); leftNode.setAttribute("fence", "true"); inner.unshift(leftNode); } if (group.right !== ".") { const rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]); rightNode.setAttribute("fence", "true"); if (group.rightColor) { rightNode.setAttribute("mathcolor", group.rightColor); } inner.push(rightNode); } return makeRow(inner); } }); defineFunction({ type: "middle", names: ["\\middle"], props: { numArgs: 1 }, handler: (context, args) => { const delim = checkDelimiter(args[0], context); if (!context.parser.leftrightDepth) { throw new ParseError("\\middle without preceding \\left", delim); } return { type: "middle", mode: context.parser.mode, delim: delim.text }; }, htmlBuilder: (group, options) => { let middleDelim; if (group.delim === ".") { middleDelim = makeNullDelimiter(options, []); } else { middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []); const isMiddle = { delim: group.delim, options }; // Property `isMiddle` not defined on `span`. It is only used in // this file above. // TODO: Fix this violation of the `span` type and possibly rename // things since `isMiddle` sounds like a boolean, but is a struct. // $FlowFixMe middleDelim.isMiddle = isMiddle; } return middleDelim; }, mathmlBuilder: (group, options) => { // A Firefox \middle will strech a character vertically only if it // is in the fence part of the operator dictionary at: // https://www.w3.org/TR/MathML3/appendixc.html. // So we need to avoid U+2223 and use plain "|" instead. const textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode); const middleNode = new mathMLTree.MathNode("mo", [textNode]); middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each element. // \middle should get delimiter spacing instead. middleNode.setAttribute("lspace", "0.05em"); middleNode.setAttribute("rspace", "0.05em"); return middleNode; } }); const htmlBuilder$2 = (group, options) => { // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox // Some groups can return document fragments. Handle those by wrapping // them in a span. const inner = buildCommon.wrapFragment(buildGroup(group.body, options), options); const label = group.label.substr(1); const scale = options.sizeMultiplier; let img; let imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different // depending on whether the subject is wider than it is tall, or vice versa. // We don't know the width of a group, so as a proxy, we test if // the subject is a single character. This captures most of the // subjects that should get the "tall" treatment. const isSingleChar = utils.isCharacterBox(group.body); if (label === "sout") { img = buildCommon.makeSpan(["stretchy", "sout"]); img.height = options.fontMetrics().defaultRuleThickness / scale; imgShift = -0.5 * options.fontMetrics().xHeight; } else { // Add horizontal padding if (/cancel/.test(label)) { if (!isSingleChar) { inner.classes.push("cancel-pad"); } } else { inner.classes.push("boxpad"); } // Add vertical padding let vertPad = 0; let ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2" if (/box/.test(label)) { ruleThickness = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // User override. ); vertPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness); } else { vertPad = isSingleChar ? 0.2 : 0; } img = stretchy.encloseSpan(inner, label, vertPad, options); if (/fbox|boxed|fcolorbox/.test(label)) { img.style.borderStyle = "solid"; img.style.borderWidth = `${ruleThickness}em`; } imgShift = inner.depth + vertPad; if (group.backgroundColor) { img.style.backgroundColor = group.backgroundColor; if (group.borderColor) { img.style.borderColor = group.borderColor; } } } let vlist; if (group.backgroundColor) { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [// Put the color background behind inner; { type: "elem", elem: img, shift: imgShift }, { type: "elem", elem: inner, shift: 0 }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "individualShift", children: [// Write the \cancel stroke on top of inner. { type: "elem", elem: inner, shift: 0 }, { type: "elem", elem: img, shift: imgShift, wrapperClasses: /cancel/.test(label) ? ["svg-align"] : [] }] }, options); } if (/cancel/.test(label)) { // The cancel package documentation says that cancel lines add their height // to the expression, but tests show that isn't how it actually works. vlist.height = inner.height; vlist.depth = inner.depth; } if (/cancel/.test(label) && !isSingleChar) { // cancel does not create horiz space for its line extension. return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options); } else { return buildCommon.makeSpan(["mord"], [vlist], options); } }; const mathmlBuilder$2 = (group, options) => { let fboxsep = 0; const node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup$1(group.body, options)]); switch (group.label) { case "\\cancel": node.setAttribute("notation", "updiagonalstrike"); break; case "\\bcancel": node.setAttribute("notation", "downdiagonalstrike"); break; case "\\sout": node.setAttribute("notation", "horizontalstrike"); break; case "\\fbox": node.setAttribute("notation", "box"); break; case "\\fcolorbox": case "\\colorbox": // doesn't have a good notation option. So use // instead. Set some attributes that come included with . fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm; node.setAttribute("width", `+${2 * fboxsep}pt`); node.setAttribute("height", `+${2 * fboxsep}pt`); node.setAttribute("lspace", `${fboxsep}pt`); // node.setAttribute("voffset", `${fboxsep}pt`); if (group.label === "\\fcolorbox") { const thk = Math.max(options.fontMetrics().fboxrule, // default options.minRuleThickness // user override ); node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor)); } break; case "\\xcancel": node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); break; } if (group.backgroundColor) { node.setAttribute("mathbackground", group.backgroundColor); } return node; }; defineFunction({ type: "enclose", names: ["\\colorbox"], props: { numArgs: 2, allowedInText: true, greediness: 3, argTypes: ["color", "text"] }, handler(_ref, args, optArgs) { let parser = _ref.parser, funcName = _ref.funcName; const color = assertNodeType(args[0], "color-token").color; const body = args[1]; return { type: "enclose", mode: parser.mode, label: funcName, backgroundColor: color, body }; }, htmlBuilder: htmlBuilder$2, mathmlBuilder: mathmlBuilder$2 }); defineFunction({ type: "enclose", names: ["\\fcolorbox"], props: { numArgs: 3, allowedInText: true, greediness: 3, argTypes: ["color", "color", "text"] }, handler(_ref2, args, optArgs) { let parser = _ref2.parser, funcName = _ref2.funcName; const borderColor = assertNodeType(args[0], "color-token").color; const backgroundColor = assertNodeType(args[1], "color-token").color; const body = args[2]; return { type: "enclose", mode: parser.mode, label: funcName, backgroundColor, borderColor, body }; }, htmlBuilder: htmlBuilder$2, mathmlBuilder: mathmlBuilder$2 }); defineFunction({ type: "enclose", names: ["\\fbox"], props: { numArgs: 1, argTypes: ["hbox"], allowedInText: true }, handler(_ref3, args) { let parser = _ref3.parser; return { type: "enclose", mode: parser.mode, label: "\\fbox", body: args[0] }; } }); defineFunction({ type: "enclose", names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"], props: { numArgs: 1 }, handler(_ref4, args, optArgs) { let parser = _ref4.parser, funcName = _ref4.funcName; const body = args[0]; return { type: "enclose", mode: parser.mode, label: funcName, body }; }, htmlBuilder: htmlBuilder$2, mathmlBuilder: mathmlBuilder$2 }); /** * All registered environments. * `environments.js` exports this same dictionary again and makes it public. * `Parser.js` requires this dictionary via `environments.js`. */ const _environments = {}; function defineEnvironment(_ref) { let type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder; // Set default values of environments. const data = { type, numArgs: props.numArgs || 0, greediness: 1, allowedInText: false, numOptionalArgs: 0, handler }; for (let i = 0; i < names.length; ++i) { // TODO: The value type of _environments should be a type union of all // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is // an existential type. // $FlowFixMe _environments[names[i]] = data; } if (htmlBuilder) { _htmlGroupBuilders[type] = htmlBuilder; } if (mathmlBuilder) { _mathmlGroupBuilders[type] = mathmlBuilder; } } function getHLines(parser) { // Return an array. The array length = number of hlines. // Each element in the array tells if the line is dashed. const hlineInfo = []; parser.consumeSpaces(); let nxt = parser.fetch().text; while (nxt === "\\hline" || nxt === "\\hdashline") { parser.consume(); hlineInfo.push(nxt === "\\hdashline"); parser.consumeSpaces(); nxt = parser.fetch().text; } return hlineInfo; } /** * Parse the body of the environment, with rows delimited by \\ and * columns delimited by &, and create a nested list in row-major order * with one group per cell. If given an optional argument style * ("text", "display", etc.), then each cell is cast into that style. */ function parseArray(parser, _ref, style) { let hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, colSeparationType = _ref.colSeparationType; // Parse body of array with \\ temporarily mapped to \cr parser.gullet.beginGroup(); parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment if (!arraystretch) { const stretch = parser.gullet.expandMacroAsText("\\arraystretch"); if (stretch == null) { // Default \arraystretch from lttab.dtx arraystretch = 1; } else { arraystretch = parseFloat(stretch); if (!arraystretch || arraystretch < 0) { throw new ParseError(`Invalid \\arraystretch: ${stretch}`); } } } // Start group for first cell parser.gullet.beginGroup(); let row = []; const body = [row]; const rowGaps = []; const hLinesBeforeRow = []; // Test for \hline at the top of the array. hLinesBeforeRow.push(getHLines(parser)); while (true) { // eslint-disable-line no-constant-condition // Parse each cell in its own group (namespace) let cell = parser.parseExpression(false, "\\cr"); parser.gullet.endGroup(); parser.gullet.beginGroup(); cell = { type: "ordgroup", mode: parser.mode, body: cell }; if (style) { cell = { type: "styling", mode: parser.mode, style, body: [cell] }; } row.push(cell); const next = parser.fetch().text; if (next === "&") { parser.consume(); } else if (next === "\\end") { // Arrays terminate newlines with `\crcr` which consumes a `\cr` if // the last line is empty. // NOTE: Currently, `cell` is the last item added into `row`. if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0) { body.pop(); } if (hLinesBeforeRow.length < body.length + 1) { hLinesBeforeRow.push([]); } break; } else if (next === "\\cr") { const cr = assertNodeType(parser.parseFunction(), "cr"); rowGaps.push(cr.size); // check for \hline(s) following the row separator hLinesBeforeRow.push(getHLines(parser)); row = []; body.push(row); } else { throw new ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken); } } // End cell group parser.gullet.endGroup(); // End array group defining \\ parser.gullet.endGroup(); return { type: "array", mode: parser.mode, addJot, arraystretch, body, cols, rowGaps, hskipBeforeAndAfter, hLinesBeforeRow, colSeparationType }; } // Decides on a style for cells in an array according to whether the given // environment name starts with the letter 'd'. function dCellStyle(envName) { if (envName.substr(0, 1) === "d") { return "display"; } else { return "text"; } } const htmlBuilder$3 = function htmlBuilder(group, options) { let r; let c; const nr = group.body.length; const hLinesBeforeRow = group.hLinesBeforeRow; let nc = 0; let body = new Array(nr); const hlines = []; const ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em. options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override. ); // Horizontal spacing const pt = 1 / options.fontMetrics().ptPerEm; let arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls if (group.colSeparationType && group.colSeparationType === "small") { // We're in a {smallmatrix}. Default column space is \thickspace, // i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}. // But that needs adjustment because LaTeX applies \scriptstyle to the // entire array, including the colspace, but this function applies // \scriptstyle only inside each element. const localMultiplier = options.havingStyle(Style$1.SCRIPT).sizeMultiplier; arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier); } // Vertical spacing const baselineskip = 12 * pt; // see size10.clo // Default \jot from ltmath.dtx // TODO(edemaine): allow overriding \jot via \setlength (#687) const jot = 3 * pt; const arrayskip = group.arraystretch * baselineskip; const arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and const arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx let totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any. function setHLinePos(hlinesInGap) { for (let i = 0; i < hlinesInGap.length; ++i) { if (i > 0) { totalHeight += 0.25; } hlines.push({ pos: totalHeight, isDashed: hlinesInGap[i] }); } } setHLinePos(hLinesBeforeRow[0]); for (r = 0; r < group.body.length; ++r) { const inrow = group.body[r]; let height = arstrutHeight; // \@array adds an \@arstrut let depth = arstrutDepth; // to each tow (via the template) if (nc < inrow.length) { nc = inrow.length; } const outrow = new Array(inrow.length); for (c = 0; c < inrow.length; ++c) { const elt = buildGroup(inrow[c], options); if (depth < elt.depth) { depth = elt.depth; } if (height < elt.height) { height = elt.height; } outrow[c] = elt; } const rowGap = group.rowGaps[r]; let gap = 0; if (rowGap) { gap = calculateSize(rowGap, options); if (gap > 0) { // \@argarraycr gap += arstrutDepth; if (depth < gap) { depth = gap; // \@xargarraycr } gap = 0; } } // In AMS multiline environments such as aligned and gathered, rows // correspond to lines that have additional \jot added to the // \baselineskip via \openup. if (group.addJot) { depth += jot; } outrow.height = height; outrow.depth = depth; totalHeight += height; outrow.pos = totalHeight; totalHeight += depth + gap; // \@yargarraycr body[r] = outrow; // Set a position for \hline(s), if any. setHLinePos(hLinesBeforeRow[r + 1]); } const offset = totalHeight / 2 + options.fontMetrics().axisHeight; const colDescriptions = group.cols || []; const cols = []; let colSep; let colDescrNum; for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column // descriptions, so trailing separators don't get lost. c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) { let colDescr = colDescriptions[colDescrNum] || {}; let firstSeparator = true; while (colDescr.type === "separator") { // If there is more than one separator in a row, add a space // between them. if (!firstSeparator) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = options.fontMetrics().doubleRuleSep + "em"; cols.push(colSep); } if (colDescr.separator === "|" || colDescr.separator === ":") { const lineType = colDescr.separator === "|" ? "solid" : "dashed"; const separator = buildCommon.makeSpan(["vertical-separator"], [], options); separator.style.height = totalHeight + "em"; separator.style.borderRightWidth = `${ruleThickness}em`; separator.style.borderRightStyle = lineType; separator.style.margin = `0 -${ruleThickness / 2}em`; separator.style.verticalAlign = -(totalHeight - offset) + "em"; cols.push(separator); } else { throw new ParseError("Invalid separator type: " + colDescr.separator); } colDescrNum++; colDescr = colDescriptions[colDescrNum] || {}; firstSeparator = false; } if (c >= nc) { continue; } let sepwidth; if (c > 0 || group.hskipBeforeAndAfter) { sepwidth = utils.deflt(colDescr.pregap, arraycolsep); if (sepwidth !== 0) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = sepwidth + "em"; cols.push(colSep); } } let col = []; for (r = 0; r < nr; ++r) { const row = body[r]; const elem = row[c]; if (!elem) { continue; } const shift = row.pos - offset; elem.depth = row.depth; elem.height = row.height; col.push({ type: "elem", elem: elem, shift: shift }); } col = buildCommon.makeVList({ positionType: "individualShift", children: col }, options); col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]); cols.push(col); if (c < nc - 1 || group.hskipBeforeAndAfter) { sepwidth = utils.deflt(colDescr.postgap, arraycolsep); if (sepwidth !== 0) { colSep = buildCommon.makeSpan(["arraycolsep"], []); colSep.style.width = sepwidth + "em"; cols.push(colSep); } } } body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any. if (hlines.length > 0) { const line = buildCommon.makeLineSpan("hline", options, ruleThickness); const dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness); const vListElems = [{ type: "elem", elem: body, shift: 0 }]; while (hlines.length > 0) { const hline = hlines.pop(); const lineShift = hline.pos - offset; if (hline.isDashed) { vListElems.push({ type: "elem", elem: dashes, shift: lineShift }); } else { vListElems.push({ type: "elem", elem: line, shift: lineShift }); } } body = buildCommon.makeVList({ positionType: "individualShift", children: vListElems }, options); } return buildCommon.makeSpan(["mord"], [body], options); }; const alignMap = { c: "center ", l: "left ", r: "right " }; const mathmlBuilder$3 = function mathmlBuilder(group, options) { let table = new mathMLTree.MathNode("mtable", group.body.map(function (row) { return new mathMLTree.MathNode("mtr", row.map(function (cell) { return new mathMLTree.MathNode("mtd", [buildGroup$1(cell, options)]); })); })); // Set column alignment, row spacing, column spacing, and // array lines by setting attributes on the table element. // Set the row spacing. In MathML, we specify a gap distance. // We do not use rowGap[] because MathML automatically increases // cell height with the height/depth of the element content. // LaTeX \arraystretch multiplies the row baseline-to-baseline distance. // We simulate this by adding (arraystretch - 1)em to the gap. This // does a reasonable job of adjusting arrays containing 1 em tall content. // The 0.16 and 0.09 values are found emprically. They produce an array // similar to LaTeX and in which content does not interfere with \hines. const gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray} : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0); table.setAttribute("rowspacing", gap + "em"); // MathML table lines go only between cells. // To place a line on an edge we'll use , if necessary. let menclose = ""; let align = ""; if (group.cols && group.cols.length > 0) { // Find column alignment, column spacing, and vertical lines. const cols = group.cols; let columnLines = ""; let prevTypeWasAlign = false; let iStart = 0; let iEnd = cols.length; if (cols[0].type === "separator") { menclose += "top "; iStart = 1; } if (cols[cols.length - 1].type === "separator") { menclose += "bottom "; iEnd -= 1; } for (let i = iStart; i < iEnd; i++) { if (cols[i].type === "align") { align += alignMap[cols[i].align]; if (prevTypeWasAlign) { columnLines += "none "; } prevTypeWasAlign = true; } else if (cols[i].type === "separator") { // MathML accepts only single lines between cells. // So we read only the first of consecutive separators. if (prevTypeWasAlign) { columnLines += cols[i].separator === "|" ? "solid " : "dashed "; prevTypeWasAlign = false; } } } table.setAttribute("columnalign", align.trim()); if (/[sd]/.test(columnLines)) { table.setAttribute("columnlines", columnLines.trim()); } } // Set column spacing. if (group.colSeparationType === "align") { const cols = group.cols || []; let spacing = ""; for (let i = 1; i < cols.length; i++) { spacing += i % 2 ? "0em " : "1em "; } table.setAttribute("columnspacing", spacing.trim()); } else if (group.colSeparationType === "alignat") { table.setAttribute("columnspacing", "0em"); } else if (group.colSeparationType === "small") { table.setAttribute("columnspacing", "0.2778em"); } else { table.setAttribute("columnspacing", "1em"); } // Address \hline and \hdashline let rowLines = ""; const hlines = group.hLinesBeforeRow; menclose += hlines[0].length > 0 ? "left " : ""; menclose += hlines[hlines.length - 1].length > 0 ? "right " : ""; for (let i = 1; i < hlines.length - 1; i++) { rowLines += hlines[i].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element. : hlines[i][0] ? "dashed " : "solid "; } if (/[sd]/.test(rowLines)) { table.setAttribute("rowlines", rowLines.trim()); } if (menclose !== "") { table = new mathMLTree.MathNode("menclose", [table]); table.setAttribute("notation", menclose.trim()); } if (group.arraystretch && group.arraystretch < 1) { // A small array. Wrap in scriptstyle so row gap is not too large. table = new mathMLTree.MathNode("mstyle", [table]); table.setAttribute("scriptlevel", "1"); } return table; }; // Convenience function for aligned and alignedat environments. const alignedHandler = function alignedHandler(context, args) { const cols = []; const res = parseArray(context.parser, { cols, addJot: true }, "display"); // Determining number of columns. // 1. If the first argument is given, we use it as a number of columns, // and makes sure that each row doesn't exceed that number. // 2. Otherwise, just count number of columns = maximum number // of cells in each row ("aligned" mode -- isAligned will be true). // // At the same time, prepend empty group {} at beginning of every second // cell in each row (starting with second cell) so that operators become // binary. This behavior is implemented in amsmath's \start@aligned. let numMaths; let numCols = 0; const emptyGroup = { type: "ordgroup", mode: context.mode, body: [] }; if (args[0] && args[0].type === "ordgroup") { let arg0 = ""; for (let i = 0; i < args[0].body.length; i++) { const textord = assertNodeType(args[0].body[i], "textord"); arg0 += textord.text; } numMaths = Number(arg0); numCols = numMaths * 2; } const isAligned = !numCols; res.body.forEach(function (row) { for (let i = 1; i < row.length; i += 2) { // Modify ordgroup node within styling node const styling = assertNodeType(row[i], "styling"); const ordgroup = assertNodeType(styling.body[0], "ordgroup"); ordgroup.body.unshift(emptyGroup); } if (!isAligned) { // Case 1 const curMaths = row.length / 2; if (numMaths < curMaths) { throw new ParseError("Too many math in a row: " + `expected ${numMaths}, but got ${curMaths}`, row[0]); } } else if (numCols < row.length) { // Case 2 numCols = row.length; } }); // Adjusting alignment. // In aligned mode, we add one \qquad between columns; // otherwise we add nothing. for (let i = 0; i < numCols; ++i) { let align = "r"; let pregap = 0; if (i % 2 === 1) { align = "l"; } else if (i > 0 && isAligned) { // "aligned" mode. pregap = 1; // add one \quad } cols[i] = { type: "align", align: align, pregap: pregap, postgap: 0 }; } res.colSeparationType = isAligned ? "align" : "alignat"; return res; }; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation // is part of the source2e.pdf file of LaTeX2e source documentation. // {darray} is an {array} environment where cells are set in \displaystyle, // as defined in nccmath.sty. defineEnvironment({ type: "array", names: ["array", "darray"], props: { numArgs: 1 }, handler(context, args) { // Since no types are specified above, the two possibilities are // - The argument is wrapped in {} or [], in which case Parser's // parseGroup() returns an "ordgroup" wrapping some symbol node. // - The argument is a bare symbol node. const symNode = checkSymbolNodeType(args[0]); const colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; const cols = colalign.map(function (nde) { const node = assertSymbolNodeType(nde); const ca = node.text; if ("lcr".indexOf(ca) !== -1) { return { type: "align", align: ca }; } else if (ca === "|") { return { type: "separator", separator: "|" }; } else if (ca === ":") { return { type: "separator", separator: ":" }; } throw new ParseError("Unknown column alignment: " + ca, nde); }); const res = { cols, hskipBeforeAndAfter: true // \@preamble in lttab.dtx }; return parseArray(context.parser, res, dCellStyle(context.envName)); }, htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); // The matrix environments of amsmath builds on the array environment // of LaTeX, which is discussed above. defineEnvironment({ type: "array", names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], props: { numArgs: 0 }, handler(context) { const delimiters = { "matrix": null, "pmatrix": ["(", ")"], "bmatrix": ["[", "]"], "Bmatrix": ["\\{", "\\}"], "vmatrix": ["|", "|"], "Vmatrix": ["\\Vert", "\\Vert"] }[context.envName]; // \hskip -\arraycolsep in amsmath const payload = { hskipBeforeAndAfter: false }; const res = parseArray(context.parser, payload, dCellStyle(context.envName)); return delimiters ? { type: "leftright", mode: context.mode, body: [res], left: delimiters[0], right: delimiters[1], rightColor: undefined // \right uninfluenced by \color in array } : res; }, htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); defineEnvironment({ type: "array", names: ["smallmatrix"], props: { numArgs: 0 }, handler(context) { const payload = { arraystretch: 0.5 }; const res = parseArray(context.parser, payload, "script"); res.colSeparationType = "small"; return res; }, htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); defineEnvironment({ type: "array", names: ["subarray"], props: { numArgs: 1 }, handler(context, args) { // Parsing of {subarray} is similar to {array} const symNode = checkSymbolNodeType(args[0]); const colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; const cols = colalign.map(function (nde) { const node = assertSymbolNodeType(nde); const ca = node.text; // {subarray} only recognizes "l" & "c" if ("lc".indexOf(ca) !== -1) { return { type: "align", align: ca }; } throw new ParseError("Unknown column alignment: " + ca, nde); }); if (cols.length > 1) { throw new ParseError("{subarray} can contain only one column"); } let res = { cols, hskipBeforeAndAfter: false, arraystretch: 0.5 }; res = parseArray(context.parser, res, "script"); if (res.body.length > 0 && res.body[0].length > 1) { throw new ParseError("{subarray} can contain only one column"); } return res; }, htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); // A cases environment (in amsmath.sty) is almost equivalent to // \def\arraystretch{1.2}% // \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. // {dcases} is a {cases} environment where cells are set in \displaystyle, // as defined in mathtools.sty. // {rcases} is another mathtools environment. It's brace is on the right side. defineEnvironment({ type: "array", names: ["cases", "dcases", "rcases", "drcases"], props: { numArgs: 0 }, handler(context) { const payload = { arraystretch: 1.2, cols: [{ type: "align", align: "l", pregap: 0, // TODO(kevinb) get the current style. // For now we use the metrics for TEXT style which is what we were // doing before. Before attempting to get the current style we // should look at TeX's behavior especially for \over and matrices. postgap: 1.0 /* 1em quad */ }, { type: "align", align: "l", pregap: 0, postgap: 0 }] }; const res = parseArray(context.parser, payload, dCellStyle(context.envName)); return { type: "leftright", mode: context.mode, body: [res], left: context.envName.indexOf("r") > -1 ? "." : "\\{", right: context.envName.indexOf("r") > -1 ? "\\}" : ".", rightColor: undefined }; }, htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); // An aligned environment is like the align* environment // except it operates within math mode. // Note that we assume \nomallineskiplimit to be zero, // so that \strut@ is the same as \strut. defineEnvironment({ type: "array", names: ["aligned"], props: { numArgs: 0 }, handler: alignedHandler, htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); // A gathered environment is like an array environment with one centered // column, but where rows are considered lines so get \jot line spacing // and contents are set in \displaystyle. defineEnvironment({ type: "array", names: ["gathered"], props: { numArgs: 0 }, handler(context) { const res = { cols: [{ type: "align", align: "c" }], addJot: true }; return parseArray(context.parser, res, "display"); }, htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); // alignat environment is like an align environment, but one must explicitly // specify maximum number of columns in each row, and can adjust spacing between // each columns. defineEnvironment({ type: "array", names: ["alignedat"], // One for numbered and for unnumbered; // but, KaTeX doesn't supports math numbering yet, // they make no difference for now. props: { numArgs: 1 }, handler: alignedHandler, htmlBuilder: htmlBuilder$3, mathmlBuilder: mathmlBuilder$3 }); // Catch \hline outside array environment defineFunction({ type: "text", // Doesn't matter what this is. names: ["\\hline", "\\hdashline"], props: { numArgs: 0, allowedInText: true, allowedInMath: true }, handler(context, args) { throw new ParseError(`${context.funcName} valid only within array environment`); } }); const environments = _environments; // defineEnvironment definitions. // $FlowFixMe, "environment" handler returns an environment ParseNode defineFunction({ type: "environment", names: ["\\begin", "\\end"], props: { numArgs: 1, argTypes: ["text"] }, handler(_ref, args) { let parser = _ref.parser, funcName = _ref.funcName; const nameGroup = args[0]; if (nameGroup.type !== "ordgroup") { throw new ParseError("Invalid environment name", nameGroup); } let envName = ""; for (let i = 0; i < nameGroup.body.length; ++i) { envName += assertNodeType(nameGroup.body[i], "textord").text; } if (funcName === "\\begin") { // begin...end is similar to left...right if (!environments.hasOwnProperty(envName)) { throw new ParseError("No such environment: " + envName, nameGroup); } // Build the environment object. Arguments and other information will // be made available to the begin and end methods using properties. const env = environments[envName]; const _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env), args = _parser$parseArgument.args, optArgs = _parser$parseArgument.optArgs; const context = { mode: parser.mode, envName, parser }; const result = env.handler(context, args, optArgs); parser.expect("\\end", false); const endNameToken = parser.nextToken; const end = assertNodeType(parser.parseFunction(), "environment"); if (end.name !== envName) { throw new ParseError(`Mismatch: \\begin{${envName}} matched by \\end{${end.name}}`, endNameToken); } return result; } return { type: "environment", mode: parser.mode, name: envName, nameGroup }; } }); const makeSpan$2 = buildCommon.makeSpan; function htmlBuilder$4(group, options) { const elements = buildExpression(group.body, options, true); return makeSpan$2([group.mclass], elements, options); } function mathmlBuilder$4(group, options) { let node; const inner = buildExpression$1(group.body, options); if (group.mclass === "minner") { return mathMLTree.newDocumentFragment(inner); } else if (group.mclass === "mord") { if (group.isCharacterBox) { node = inner[0]; node.type = "mi"; } else { node = new mathMLTree.MathNode("mi", inner); } } else { if (group.isCharacterBox) { node = inner[0]; node.type = "mo"; } else { node = new mathMLTree.MathNode("mo", inner); } // Set spacing based on what is the most likely adjacent atom type. // See TeXbook p170. if (group.mclass === "mbin") { node.attributes.lspace = "0.22em"; // medium space node.attributes.rspace = "0.22em"; } else if (group.mclass === "mpunct") { node.attributes.lspace = "0em"; node.attributes.rspace = "0.17em"; // thinspace } else if (group.mclass === "mopen" || group.mclass === "mclose") { node.attributes.lspace = "0em"; node.attributes.rspace = "0em"; } // MathML default space is 5/18 em, so needs no action. // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo } return node; } // Math class commands except \mathop defineFunction({ type: "mclass", names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], props: { numArgs: 1 }, handler(_ref, args) { let parser = _ref.parser, funcName = _ref.funcName; const body = args[0]; return { type: "mclass", mode: parser.mode, mclass: "m" + funcName.substr(5), // TODO(kevinb): don't prefix with 'm' body: ordargument(body), isCharacterBox: utils.isCharacterBox(body) }; }, htmlBuilder: htmlBuilder$4, mathmlBuilder: mathmlBuilder$4 }); const binrelClass = arg => { // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument. // (by rendering separately and with {}s before and after, and measuring // the change in spacing). We'll do roughly the same by detecting the // atom type directly. const atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) { return "m" + atom.family; } else { return "mord"; } }; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord. // This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX. defineFunction({ type: "mclass", names: ["\\@binrel"], props: { numArgs: 2 }, handler(_ref2, args) { let parser = _ref2.parser; return { type: "mclass", mode: parser.mode, mclass: binrelClass(args[0]), body: [args[1]], isCharacterBox: utils.isCharacterBox(args[1]) }; } }); // Build a relation or stacked op by placing one symbol on top of another defineFunction({ type: "mclass", names: ["\\stackrel", "\\overset", "\\underset"], props: { numArgs: 2 }, handler(_ref3, args) { let parser = _ref3.parser, funcName = _ref3.funcName; const baseArg = args[1]; const shiftedArg = args[0]; let mclass; if (funcName !== "\\stackrel") { // LaTeX applies \binrel spacing to \overset and \underset. mclass = binrelClass(baseArg); } else { mclass = "mrel"; // for \stackrel } const baseOp = { type: "op", mode: baseArg.mode, limits: true, alwaysHandleSupSub: true, parentIsSupSub: false, symbol: false, suppressBaseShift: funcName !== "\\stackrel", body: ordargument(baseArg) }; const supsub = { type: "supsub", mode: shiftedArg.mode, base: baseOp, sup: funcName === "\\underset" ? null : shiftedArg, sub: funcName === "\\underset" ? shiftedArg : null }; return { type: "mclass", mode: parser.mode, mclass, body: [supsub], isCharacterBox: utils.isCharacterBox(supsub) }; }, htmlBuilder: htmlBuilder$4, mathmlBuilder: mathmlBuilder$4 }); // TODO(kevinb): implement \\sl and \\sc const htmlBuilder$5 = (group, options) => { const font = group.font; const newOptions = options.withFont(font); return buildGroup(group.body, newOptions); }; const mathmlBuilder$5 = (group, options) => { const font = group.font; const newOptions = options.withFont(font); return buildGroup$1(group.body, newOptions); }; const fontAliases = { "\\Bbb": "\\mathbb", "\\bold": "\\mathbf", "\\frak": "\\mathfrak", "\\bm": "\\boldsymbol" }; defineFunction({ type: "font", names: [// styles, except \boldsymbol defined below "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below "\\Bbb", "\\bold", "\\frak"], props: { numArgs: 1, greediness: 2 }, handler: (_ref, args) => { let parser = _ref.parser, funcName = _ref.funcName; const body = args[0]; let func = funcName; if (func in fontAliases) { func = fontAliases[func]; } return { type: "font", mode: parser.mode, font: func.slice(1), body }; }, htmlBuilder: htmlBuilder$5, mathmlBuilder: mathmlBuilder$5 }); defineFunction({ type: "mclass", names: ["\\boldsymbol", "\\bm"], props: { numArgs: 1, greediness: 2 }, handler: (_ref2, args) => { let parser = _ref2.parser; const body = args[0]; const isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the // argument's bin|rel|ord status return { type: "mclass", mode: parser.mode, mclass: binrelClass(body), body: [{ type: "font", mode: parser.mode, font: "boldsymbol", body }], isCharacterBox: isCharacterBox }; } }); // Old font changing functions defineFunction({ type: "font", names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"], props: { numArgs: 0, allowedInText: true }, handler: (_ref3, args) => { let parser = _ref3.parser, funcName = _ref3.funcName, breakOnTokenText = _ref3.breakOnTokenText; const mode = parser.mode; const body = parser.parseExpression(true, breakOnTokenText); const style = `math${funcName.slice(1)}`; return { type: "font", mode: mode, font: style, body: { type: "ordgroup", mode: parser.mode, body } }; }, htmlBuilder: htmlBuilder$5, mathmlBuilder: mathmlBuilder$5 }); const adjustStyle = (size, originalStyle) => { // Figure out what style this fraction should be in based on the // function used let style = originalStyle; if (size === "display") { // Get display style as a default. // If incoming style is sub/sup, use style.text() to get correct size. style = style.id >= Style$1.SCRIPT.id ? style.text() : Style$1.DISPLAY; } else if (size === "text" && style.size === Style$1.DISPLAY.size) { // We're in a \tfrac but incoming style is displaystyle, so: style = Style$1.TEXT; } else if (size === "script") { style = Style$1.SCRIPT; } else if (size === "scriptscript") { style = Style$1.SCRIPTSCRIPT; } return style; }; const htmlBuilder$6 = (group, options) => { // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). const style = adjustStyle(group.size, options.style); const nstyle = style.fracNum(); const dstyle = style.fracDen(); let newOptions; newOptions = options.havingStyle(nstyle); const numerm = buildGroup(group.numer, newOptions, options); if (group.continued) { // \cfrac inserts a \strut into the numerator. // Get \strut dimensions from TeXbook page 353. const hStrut = 8.5 / options.fontMetrics().ptPerEm; const dStrut = 3.5 / options.fontMetrics().ptPerEm; numerm.height = numerm.height < hStrut ? hStrut : numerm.height; numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; } newOptions = options.havingStyle(dstyle); const denomm = buildGroup(group.denom, newOptions, options); let rule; let ruleWidth; let ruleSpacing; if (group.hasBarLine) { if (group.barSize) { ruleWidth = calculateSize(group.barSize, options); rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth); } else { rule = buildCommon.makeLineSpan("frac-line", options); } ruleWidth = rule.height; ruleSpacing = rule.height; } else { rule = null; ruleWidth = 0; ruleSpacing = options.fontMetrics().defaultRuleThickness; } // Rule 15b let numShift; let clearance; let denomShift; if (style.size === Style$1.DISPLAY.size || group.size === "display") { numShift = options.fontMetrics().num1; if (ruleWidth > 0) { clearance = 3 * ruleSpacing; } else { clearance = 7 * ruleSpacing; } denomShift = options.fontMetrics().denom1; } else { if (ruleWidth > 0) { numShift = options.fontMetrics().num2; clearance = ruleSpacing; } else { numShift = options.fontMetrics().num3; clearance = 3 * ruleSpacing; } denomShift = options.fontMetrics().denom2; } let frac; if (!rule) { // Rule 15c const candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); if (candidateClearance < clearance) { numShift += 0.5 * (clearance - candidateClearance); denomShift += 0.5 * (clearance - candidateClearance); } frac = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: numerm, shift: -numShift }] }, options); } else { // Rule 15d const axisHeight = options.fontMetrics().axisHeight; if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); } if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) { denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); } const midShift = -(axisHeight - 0.5 * ruleWidth); frac = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: rule, shift: midShift }, { type: "elem", elem: numerm, shift: -numShift }] }, options); } // Since we manually change the style sometimes (with \dfrac or \tfrac), // account for the possible size change here. newOptions = options.havingStyle(style); frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e let delimSize; if (style.size === Style$1.DISPLAY.size) { delimSize = options.fontMetrics().delim1; } else { delimSize = options.fontMetrics().delim2; } let leftDelim; let rightDelim; if (group.leftDelim == null) { leftDelim = makeNullDelimiter(options, ["mopen"]); } else { leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]); } if (group.continued) { rightDelim = buildCommon.makeSpan([]); // zero width for \cfrac } else if (group.rightDelim == null) { rightDelim = makeNullDelimiter(options, ["mclose"]); } else { rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]); } return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options); }; const mathmlBuilder$6 = (group, options) => { let node = new mathMLTree.MathNode("mfrac", [buildGroup$1(group.numer, options), buildGroup$1(group.denom, options)]); if (!group.hasBarLine) { node.setAttribute("linethickness", "0px"); } else if (group.barSize) { const ruleWidth = calculateSize(group.barSize, options); node.setAttribute("linethickness", ruleWidth + "em"); } const style = adjustStyle(group.size, options.style); if (style.size !== options.style.size) { node = new mathMLTree.MathNode("mstyle", [node]); const isDisplay = style.size === Style$1.DISPLAY.size ? "true" : "false"; node.setAttribute("displaystyle", isDisplay); node.setAttribute("scriptlevel", "0"); } if (group.leftDelim != null || group.rightDelim != null) { const withDelims = []; if (group.leftDelim != null) { const leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]); leftOp.setAttribute("fence", "true"); withDelims.push(leftOp); } withDelims.push(node); if (group.rightDelim != null) { const rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]); rightOp.setAttribute("fence", "true"); withDelims.push(rightOp); } return makeRow(withDelims); } return node; }; defineFunction({ type: "genfrac", names: ["\\cfrac", "\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly "\\\\bracefrac", "\\\\brackfrac"], props: { numArgs: 2, greediness: 2 }, handler: (_ref, args) => { let parser = _ref.parser, funcName = _ref.funcName; const numer = args[0]; const denom = args[1]; let hasBarLine; let leftDelim = null; let rightDelim = null; let size = "auto"; switch (funcName) { case "\\cfrac": case "\\dfrac": case "\\frac": case "\\tfrac": hasBarLine = true; break; case "\\\\atopfrac": hasBarLine = false; break; case "\\dbinom": case "\\binom": case "\\tbinom": hasBarLine = false; leftDelim = "("; rightDelim = ")"; break; case "\\\\bracefrac": hasBarLine = false; leftDelim = "\\{"; rightDelim = "\\}"; break; case "\\\\brackfrac": hasBarLine = false; leftDelim = "["; rightDelim = "]"; break; default: throw new Error("Unrecognized genfrac command"); } switch (funcName) { case "\\cfrac": case "\\dfrac": case "\\dbinom": size = "display"; break; case "\\tfrac": case "\\tbinom": size = "text"; break; } return { type: "genfrac", mode: parser.mode, continued: funcName === "\\cfrac", numer, denom, hasBarLine, leftDelim, rightDelim, size, barSize: null }; }, htmlBuilder: htmlBuilder$6, mathmlBuilder: mathmlBuilder$6 }); // Infix generalized fractions -- these are not rendered directly, but replaced // immediately by one of the variants above. defineFunction({ type: "infix", names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], props: { numArgs: 0, infix: true }, handler(_ref2) { let parser = _ref2.parser, funcName = _ref2.funcName, token = _ref2.token; let replaceWith; switch (funcName) { case "\\over": replaceWith = "\\frac"; break; case "\\choose": replaceWith = "\\binom"; break; case "\\atop": replaceWith = "\\\\atopfrac"; break; case "\\brace": replaceWith = "\\\\bracefrac"; break; case "\\brack": replaceWith = "\\\\brackfrac"; break; default: throw new Error("Unrecognized infix genfrac command"); } return { type: "infix", mode: parser.mode, replaceWith, token }; } }); const stylArray = ["display", "text", "script", "scriptscript"]; const delimFromValue = function delimFromValue(delimString) { let delim = null; if (delimString.length > 0) { delim = delimString; delim = delim === "." ? null : delim; } return delim; }; defineFunction({ type: "genfrac", names: ["\\genfrac"], props: { numArgs: 6, greediness: 6, argTypes: ["math", "math", "size", "text", "math", "math"] }, handler(_ref3, args) { let parser = _ref3.parser; const numer = args[4]; const denom = args[5]; // Look into the parse nodes to get the desired delimiters. const leftDelim = args[0].type === "atom" && args[0].family === "open" ? delimFromValue(args[0].text) : null; const rightDelim = args[1].type === "atom" && args[1].family === "close" ? delimFromValue(args[1].text) : null; const barNode = assertNodeType(args[2], "size"); let hasBarLine; let barSize = null; if (barNode.isBlank) { // \genfrac acts differently than \above. // \genfrac treats an empty size group as a signal to use a // standard bar size. \above would see size = 0 and omit the bar. hasBarLine = true; } else { barSize = barNode.value; hasBarLine = barSize.number > 0; } // Find out if we want displaystyle, textstyle, etc. let size = "auto"; let styl = args[3]; if (styl.type === "ordgroup") { if (styl.body.length > 0) { const textOrd = assertNodeType(styl.body[0], "textord"); size = stylArray[Number(textOrd.text)]; } } else { styl = assertNodeType(styl, "textord"); size = stylArray[Number(styl.text)]; } return { type: "genfrac", mode: parser.mode, numer, denom, continued: false, hasBarLine, barSize, leftDelim, rightDelim, size }; }, htmlBuilder: htmlBuilder$6, mathmlBuilder: mathmlBuilder$6 }); // \above is an infix fraction that also defines a fraction bar size. defineFunction({ type: "infix", names: ["\\above"], props: { numArgs: 1, argTypes: ["size"], infix: true }, handler(_ref4, args) { let parser = _ref4.parser, funcName = _ref4.funcName, token = _ref4.token; return { type: "infix", mode: parser.mode, replaceWith: "\\\\abovefrac", size: assertNodeType(args[0], "size").value, token }; } }); defineFunction({ type: "genfrac", names: ["\\\\abovefrac"], props: { numArgs: 3, argTypes: ["math", "size", "math"] }, handler: (_ref5, args) => { let parser = _ref5.parser, funcName = _ref5.funcName; const numer = args[0]; const barSize = assert(assertNodeType(args[1], "infix").size); const denom = args[2]; const hasBarLine = barSize.number > 0; return { type: "genfrac", mode: parser.mode, numer, denom, continued: false, hasBarLine, barSize, leftDelim: null, rightDelim: null, size: "auto" }; }, htmlBuilder: htmlBuilder$6, mathmlBuilder: mathmlBuilder$6 }); // NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but const htmlBuilder$7 = (grp, options) => { const style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node. let supSubGroup; let group; if (grp.type === "supsub") { // Ref: LaTeX source2e: }}}}\limits} // i.e. LaTeX treats the brace similar to an op and passes it // with \limits, so we need to assign supsub style. supSubGroup = grp.sup ? buildGroup(grp.sup, options.havingStyle(style.sup()), options) : buildGroup(grp.sub, options.havingStyle(style.sub()), options); group = assertNodeType(grp.base, "horizBrace"); } else { group = assertNodeType(grp, "horizBrace"); } // Build the base group const body = buildGroup(group.base, options.havingBaseStyle(Style$1.DISPLAY)); // Create the stretchy element const braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ // This first vlist contains the content and the brace: equation let vlist; if (group.isOver) { vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: body }, { type: "kern", size: 0.1 }, { type: "elem", elem: braceBody }] }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[1].classes.push("svg-align"); } else { vlist = buildCommon.makeVList({ positionType: "bottom", positionData: body.depth + 0.1 + braceBody.height, children: [{ type: "elem", elem: braceBody }, { type: "kern", size: 0.1 }, { type: "elem", elem: body }] }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. vlist.children[0].children[0].children[0].classes.push("svg-align"); } if (supSubGroup) { // To write the supsub, wrap the first vlist in another vlist: // They can't all go in the same vlist, because the note might be // wider than the equation. We want the equation to control the // brace width. // note long note long note // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓ // equation eqn eqn const vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); if (group.isOver) { vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: vSpan }, { type: "kern", size: 0.2 }, { type: "elem", elem: supSubGroup }] }, options); } else { vlist = buildCommon.makeVList({ positionType: "bottom", positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth, children: [{ type: "elem", elem: supSubGroup }, { type: "kern", size: 0.2 }, { type: "elem", elem: vSpan }] }, options); } } return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); }; const mathmlBuilder$7 = (group, options) => { const accentNode = stretchy.mathMLnode(group.label); return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildGroup$1(group.base, options), accentNode]); }; // Horizontal stretchy braces defineFunction({ type: "horizBrace", names: ["\\overbrace", "\\underbrace"], props: { numArgs: 1 }, handler(_ref, args) { let parser = _ref.parser, funcName = _ref.funcName; return { type: "horizBrace", mode: parser.mode, label: funcName, isOver: /^\\over/.test(funcName), base: args[0] }; }, htmlBuilder: htmlBuilder$7, mathmlBuilder: mathmlBuilder$7 }); defineFunction({ type: "href", names: ["\\href"], props: { numArgs: 2, argTypes: ["url", "original"], allowedInText: true }, handler: (_ref, args) => { let parser = _ref.parser; const body = args[1]; const href = assertNodeType(args[0], "url").url; if (!parser.settings.isTrusted({ command: "\\href", url: href })) { return parser.formatUnsupportedCmd("\\href"); } return { type: "href", mode: parser.mode, href, body: ordargument(body) }; }, htmlBuilder: (group, options) => { const elements = buildExpression(group.body, options, false); return buildCommon.makeAnchor(group.href, [], elements, options); }, mathmlBuilder: (group, options) => { let math = buildExpressionRow(group.body, options); if (!(math instanceof MathNode)) { math = new MathNode("mrow", [math]); } math.setAttribute("href", group.href); return math; } }); defineFunction({ type: "href", names: ["\\url"], props: { numArgs: 1, argTypes: ["url"], allowedInText: true }, handler: (_ref2, args) => { let parser = _ref2.parser; const href = assertNodeType(args[0], "url").url; if (!parser.settings.isTrusted({ command: "\\url", url: href })) { return parser.formatUnsupportedCmd("\\url"); } const chars = []; for (let i = 0; i < href.length; i++) { let c = href[i]; if (c === "~") { c = "\\textasciitilde"; } chars.push({ type: "textord", mode: "text", text: c }); } const body = { type: "text", mode: parser.mode, font: "\\texttt", body: chars }; return { type: "href", mode: parser.mode, href, body: ordargument(body) }; } }); defineFunction({ type: "html", names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], props: { numArgs: 2, argTypes: ["raw", "original"], allowedInText: true }, handler: (_ref, args) => { let parser = _ref.parser, funcName = _ref.funcName, token = _ref.token; const value = assertNodeType(args[0], "raw").string; const body = args[1]; if (parser.settings.strict) { parser.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode"); } let trustContext; const attributes = {}; switch (funcName) { case "\\htmlClass": attributes.class = value; trustContext = { command: "\\htmlClass", class: value }; break; case "\\htmlId": attributes.id = value; trustContext = { command: "\\htmlId", id: value }; break; case "\\htmlStyle": attributes.style = value; trustContext = { command: "\\htmlStyle", style: value }; break; case "\\htmlData": { const data = value.split(","); for (let i = 0; i < data.length; i++) { const keyVal = data[i].split("="); if (keyVal.length !== 2) { throw new ParseError("Error parsing key-value for \\htmlData"); } attributes["data-" + keyVal[0].trim()] = keyVal[1].trim(); } trustContext = { command: "\\htmlData", attributes }; break; } default: throw new Error("Unrecognized html command"); } if (!parser.settings.isTrusted(trustContext)) { return parser.formatUnsupportedCmd(funcName); } return { type: "html", mode: parser.mode, attributes, body: ordargument(body) }; }, htmlBuilder: (group, options) => { const elements = buildExpression(group.body, options, false); const classes = ["enclosing"]; if (group.attributes.class) { classes.push(...group.attributes.class.trim().split(/\s+/)); } const span = buildCommon.makeSpan(classes, elements, options); for (const attr in group.attributes) { if (attr !== "class" && group.attributes.hasOwnProperty(attr)) { span.setAttribute(attr, group.attributes[attr]); } } return span; }, mathmlBuilder: (group, options) => { return buildExpressionRow(group.body, options); } }); defineFunction({ type: "htmlmathml", names: ["\\html@mathml"], props: { numArgs: 2, allowedInText: true }, handler: (_ref, args) => { let parser = _ref.parser; return { type: "htmlmathml", mode: parser.mode, html: ordargument(args[0]), mathml: ordargument(args[1]) }; }, htmlBuilder: (group, options) => { const elements = buildExpression(group.html, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: (group, options) => { return buildExpressionRow(group.mathml, options); } }); const sizeData = function sizeData(str) { if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) { // str is a number with no unit specified. // default unit is bp, per graphix package. return { number: +str, unit: "bp" }; } else { const match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str); if (!match) { throw new ParseError("Invalid size: '" + str + "' in \\includegraphics"); } const data = { number: +(match[1] + match[2]), // sign + magnitude, cast to number unit: match[3] }; if (!validUnit(data)) { throw new ParseError("Invalid unit: '" + data.unit + "' in \\includegraphics."); } return data; } }; defineFunction({ type: "includegraphics", names: ["\\includegraphics"], props: { numArgs: 1, numOptionalArgs: 1, argTypes: ["raw", "url"], allowedInText: false }, handler: (_ref, args, optArgs) => { let parser = _ref.parser; let width = { number: 0, unit: "em" }; let height = { number: 0.9, unit: "em" }; // sorta character sized. let totalheight = { number: 0, unit: "em" }; let alt = ""; if (optArgs[0]) { const attributeStr = assertNodeType(optArgs[0], "raw").string; // Parser.js does not parse key/value pairs. We get a string. const attributes = attributeStr.split(","); for (let i = 0; i < attributes.length; i++) { const keyVal = attributes[i].split("="); if (keyVal.length === 2) { const str = keyVal[1].trim(); switch (keyVal[0].trim()) { case "alt": alt = str; break; case "width": width = sizeData(str); break; case "height": height = sizeData(str); break; case "totalheight": totalheight = sizeData(str); break; default: throw new ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics."); } } } } const src = assertNodeType(args[0], "url").url; if (alt === "") { // No alt given. Use the file name. Strip away the path. alt = src; alt = alt.replace(/^.*[\\/]/, ''); alt = alt.substring(0, alt.lastIndexOf('.')); } if (!parser.settings.isTrusted({ command: "\\includegraphics", url: src })) { return parser.formatUnsupportedCmd("\\includegraphics"); } return { type: "includegraphics", mode: parser.mode, alt: alt, width: width, height: height, totalheight: totalheight, src: src }; }, htmlBuilder: (group, options) => { const height = calculateSize(group.height, options); let depth = 0; if (group.totalheight.number > 0) { depth = calculateSize(group.totalheight, options) - height; depth = Number(depth.toFixed(2)); } let width = 0; if (group.width.number > 0) { width = calculateSize(group.width, options); } const style = { height: height + depth + "em" }; if (width > 0) { style.width = width + "em"; } if (depth > 0) { style.verticalAlign = -depth + "em"; } const node = new Img(group.src, group.alt, style); node.height = height; node.depth = depth; return node; }, mathmlBuilder: (group, options) => { const node = new mathMLTree.MathNode("mglyph", []); node.setAttribute("alt", group.alt); const height = calculateSize(group.height, options); let depth = 0; if (group.totalheight.number > 0) { depth = calculateSize(group.totalheight, options) - height; depth = depth.toFixed(2); node.setAttribute("valign", "-" + depth + "em"); } node.setAttribute("height", height + depth + "em"); if (group.width.number > 0) { const width = calculateSize(group.width, options); node.setAttribute("width", width + "em"); } node.setAttribute("src", group.src); return node; } }); // Horizontal spacing commands defineFunction({ type: "kern", names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], props: { numArgs: 1, argTypes: ["size"], allowedInText: true }, handler(_ref, args) { let parser = _ref.parser, funcName = _ref.funcName; const size = assertNodeType(args[0], "size"); if (parser.settings.strict) { const mathFunction = funcName[1] === 'm'; // \mkern, \mskip const muUnit = size.value.unit === 'mu'; if (mathFunction) { if (!muUnit) { parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} supports only mu units, ` + `not ${size.value.unit} units`); } if (parser.mode !== "math") { parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} works only in math mode`); } } else { // !mathFunction if (muUnit) { parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} doesn't support mu units`); } } } return { type: "kern", mode: parser.mode, dimension: size.value }; }, htmlBuilder(group, options) { return buildCommon.makeGlue(group.dimension, options); }, mathmlBuilder(group, options) { const dimension = calculateSize(group.dimension, options); return new mathMLTree.SpaceNode(dimension); } }); // Horizontal overlap functions defineFunction({ type: "lap", names: ["\\mathllap", "\\mathrlap", "\\mathclap"], props: { numArgs: 1, allowedInText: true }, handler: (_ref, args) => { let parser = _ref.parser, funcName = _ref.funcName; const body = args[0]; return { type: "lap", mode: parser.mode, alignment: funcName.slice(5), body }; }, htmlBuilder: (group, options) => { // mathllap, mathrlap, mathclap let inner; if (group.alignment === "clap") { // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ inner = buildCommon.makeSpan([], [buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span inner = buildCommon.makeSpan(["inner"], [inner], options); } else { inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options)]); } const fix = buildCommon.makeSpan(["fix"], []); let node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the // two items involved in the lap. // Next, use a strut to set the height of the HTML bounding box. // Otherwise, a tall argument may be misplaced. // This code resolved issue #1153 const strut = buildCommon.makeSpan(["strut"]); strut.style.height = node.height + node.depth + "em"; strut.style.verticalAlign = -node.depth + "em"; node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall. // This code resolves issue #1234 node = buildCommon.makeSpan(["thinbox"], [node], options); return buildCommon.makeSpan(["mord", "vbox"], [node], options); }, mathmlBuilder: (group, options) => { // mathllap, mathrlap, mathclap const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); if (group.alignment !== "rlap") { const offset = group.alignment === "llap" ? "-1" : "-0.5"; node.setAttribute("lspace", offset + "width"); } node.setAttribute("width", "0px"); return node; } }); defineFunction({ type: "styling", names: ["\\(", "$"], props: { numArgs: 0, allowedInText: true, allowedInMath: false }, handler(_ref, args) { let funcName = _ref.funcName, parser = _ref.parser; const outerMode = parser.mode; parser.switchMode("math"); const close = funcName === "\\(" ? "\\)" : "$"; const body = parser.parseExpression(false, close); parser.expect(close); parser.switchMode(outerMode); return { type: "styling", mode: parser.mode, style: "text", body }; } }); // Check for extra closing math delimiters defineFunction({ type: "text", // Doesn't matter what this is. names: ["\\)", "\\]"], props: { numArgs: 0, allowedInText: true, allowedInMath: false }, handler(context, args) { throw new ParseError(`Mismatched ${context.funcName}`); } }); const chooseMathStyle = (group, options) => { switch (options.style.size) { case Style$1.DISPLAY.size: return group.display; case Style$1.TEXT.size: return group.text; case Style$1.SCRIPT.size: return group.script; case Style$1.SCRIPTSCRIPT.size: return group.scriptscript; default: return group.text; } }; defineFunction({ type: "mathchoice", names: ["\\mathchoice"], props: { numArgs: 4 }, handler: (_ref, args) => { let parser = _ref.parser; return { type: "mathchoice", mode: parser.mode, display: ordargument(args[0]), text: ordargument(args[1]), script: ordargument(args[2]), scriptscript: ordargument(args[3]) }; }, htmlBuilder: (group, options) => { const body = chooseMathStyle(group, options); const elements = buildExpression(body, options, false); return buildCommon.makeFragment(elements); }, mathmlBuilder: (group, options) => { const body = chooseMathStyle(group, options); return buildExpressionRow(body, options); } }); // For an operator with limits, assemble the base, sup, and sub into a span. const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => { base = buildCommon.makeSpan([], [base]); let sub; let sup; // We manually have to handle the superscripts and subscripts. This, // aside from the kern calculations, is copied from supsub. if (supGroup) { const elem = buildGroup(supGroup, options.havingStyle(style.sup()), options); sup = { elem, kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) }; } if (subGroup) { const elem = buildGroup(subGroup, options.havingStyle(style.sub()), options); sub = { elem, kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - elem.height) }; } // Build the final group as a vlist of the possible subscript, base, // and possible superscript. let finalGroup; if (sup && sub) { const bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; finalGroup = buildCommon.makeVList({ positionType: "bottom", positionData: bottom, children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] }, options); } else if (sub) { const top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note // that we are supposed to shift the limits by 1/2 of the slant, // but since we are centering the limits adding a full slant of // margin will shift by 1/2 that. finalGroup = buildCommon.makeVList({ positionType: "top", positionData: top, children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }] }, options); } else if (sup) { const bottom = base.depth + baseShift; finalGroup = buildCommon.makeVList({ positionType: "bottom", positionData: bottom, children: [{ type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] }, options); } else { // This case probably shouldn't occur (this would mean the // supsub was sending us a group with no superscript or // subscript) but be safe. return base; } return buildCommon.makeSpan(["mop", "op-limits"], [finalGroup], options); }; // Limits, symbols // Most operators have a large successor symbol, but these don't. const noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also // "supsub" since some of them (like \int) can affect super/subscripting. const htmlBuilder$8 = (grp, options) => { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). let supGroup; let subGroup; let hasLimits = false; let group; if (grp.type === "supsub") { // If we have limits, supsub will pass us its group to handle. Pull // out the superscript and subscript and set the group to the op in // its base. supGroup = grp.sup; subGroup = grp.sub; group = assertNodeType(grp.base, "op"); hasLimits = true; } else { group = assertNodeType(grp, "op"); } const style = options.style; let large = false; if (style.size === Style$1.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) { // Most symbol operators get larger in displaystyle (rule 13) large = true; } let base; if (group.symbol) { // If this is a symbol, create the symbol. const fontName = large ? "Size2-Regular" : "Size1-Regular"; let stash = ""; if (group.name === "\\oiint" || group.name === "\\oiiint") { // No font glyphs yet, so use a glyph w/o the oval. // TODO: When font glyphs are available, delete this code. stash = group.name.substr(1); // $FlowFixMe group.name = stash === "oiint" ? "\\iint" : "\\iiint"; } base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]); if (stash.length > 0) { // We're in \oiint or \oiiint. Overlay the oval. // TODO: When font glyphs are available, delete this code. const italic = base.italic; const oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options); base = buildCommon.makeVList({ positionType: "individualShift", children: [{ type: "elem", elem: base, shift: 0 }, { type: "elem", elem: oval, shift: large ? 0.08 : 0 }] }, options); // $FlowFixMe group.name = "\\" + stash; base.classes.unshift("mop"); // $FlowFixMe base.italic = italic; } } else if (group.body) { // If this is a list, compose that list. const inner = buildExpression(group.body, options, true); if (inner.length === 1 && inner[0] instanceof SymbolNode) { base = inner[0]; base.classes[0] = "mop"; // replace old mclass } else { base = buildCommon.makeSpan(["mop"], buildCommon.tryCombineChars(inner), options); } } else { // Otherwise, this is a text operator. Build the text from the // operator's name. // TODO(emily): Add a space in the middle of some of these // operators, like \limsup const output = []; for (let i = 1; i < group.name.length; i++) { output.push(buildCommon.mathsym(group.name[i], group.mode, options)); } base = buildCommon.makeSpan(["mop"], output, options); } // If content of op is a single symbol, shift it vertically. let baseShift = 0; let slant = 0; if ((base instanceof SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) { // We suppress the shift of the base of \overset and \underset. Otherwise, // shift the symbol so its center lies on the axis (rule 13). It // appears that our fonts have the centers of the symbols already // almost on the axis, so these numbers are very small. Note we // don't actually apply this here, but instead it is used either in // the vlist creation or separately when there are no limits. baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction. // $FlowFixMe slant = base.italic; } if (hasLimits) { return assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift); } else { if (baseShift) { base.style.position = "relative"; base.style.top = baseShift + "em"; } return base; } }; const mathmlBuilder$8 = (group, options) => { let node; if (group.symbol) { // This is a symbol. Just add the symbol. node = new MathNode("mo", [makeText(group.name, group.mode)]); if (utils.contains(noSuccessor, group.name)) { node.setAttribute("largeop", "false"); } } else if (group.body) { // This is an operator with children. Add them. node = new MathNode("mo", buildExpression$1(group.body, options)); } else { // This is a text operator. Add all of the characters from the // operator's name. node = new MathNode("mi", [new TextNode(group.name.slice(1))]); // Append an . // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 const operator = new MathNode("mo", [makeText("\u2061", "text")]); if (group.parentIsSupSub) { node = new MathNode("mo", [node, operator]); } else { node = newDocumentFragment([node, operator]); } } return node; }; const singleCharBigOps = { "\u220F": "\\prod", "\u2210": "\\coprod", "\u2211": "\\sum", "\u22c0": "\\bigwedge", "\u22c1": "\\bigvee", "\u22c2": "\\bigcap", "\u22c3": "\\bigcup", "\u2a00": "\\bigodot", "\u2a01": "\\bigoplus", "\u2a02": "\\bigotimes", "\u2a04": "\\biguplus", "\u2a06": "\\bigsqcup" }; defineFunction({ type: "op", names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22c0", "\u22c1", "\u22c2", "\u22c3", "\u2a00", "\u2a01", "\u2a02", "\u2a04", "\u2a06"], props: { numArgs: 0 }, handler: (_ref, args) => { let parser = _ref.parser, funcName = _ref.funcName; let fName = funcName; if (fName.length === 1) { fName = singleCharBigOps[fName]; } return { type: "op", mode: parser.mode, limits: true, parentIsSupSub: false, symbol: true, name: fName }; }, htmlBuilder: htmlBuilder$8, mathmlBuilder: mathmlBuilder$8 }); // Note: calling defineFunction with a type that's already been defined only // works because the same htmlBuilder and mathmlBuilder are being used. defineFunction({ type: "op", names: ["\\mathop"], props: { numArgs: 1 }, handler: (_ref2, args) => { let parser = _ref2.parser; const body = args[0]; return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: false, body: ordargument(body) }; }, htmlBuilder: htmlBuilder$8, mathmlBuilder: mathmlBuilder$8 }); // There are 2 flags for operators; whether they produce limits in // displaystyle, and whether they are symbols and should grow in // displaystyle. These four groups cover the four possible choices. const singleCharIntegrals = { "\u222b": "\\int", "\u222c": "\\iint", "\u222d": "\\iiint", "\u222e": "\\oint", "\u222f": "\\oiint", "\u2230": "\\oiiint" }; // No limits, not symbols defineFunction({ type: "op", names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], props: { numArgs: 0 }, handler(_ref3) { let parser = _ref3.parser, funcName = _ref3.funcName; return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: false, name: funcName }; }, htmlBuilder: htmlBuilder$8, mathmlBuilder: mathmlBuilder$8 }); // Limits, not symbols defineFunction({ type: "op", names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"], props: { numArgs: 0 }, handler(_ref4) { let parser = _ref4.parser, funcName = _ref4.funcName; return { type: "op", mode: parser.mode, limits: true, parentIsSupSub: false, symbol: false, name: funcName }; }, htmlBuilder: htmlBuilder$8, mathmlBuilder: mathmlBuilder$8 }); // No limits, symbols defineFunction({ type: "op", names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222b", "\u222c", "\u222d", "\u222e", "\u222f", "\u2230"], props: { numArgs: 0 }, handler(_ref5) { let parser = _ref5.parser, funcName = _ref5.funcName; let fName = funcName; if (fName.length === 1) { fName = singleCharIntegrals[fName]; } return { type: "op", mode: parser.mode, limits: false, parentIsSupSub: false, symbol: true, name: fName }; }, htmlBuilder: htmlBuilder$8, mathmlBuilder: mathmlBuilder$8 }); // NOTE: Unlike most `htmlBuilder`s, this one handles not only // "operatorname", but also "supsub" since \operatorname* can const htmlBuilder$9 = (grp, options) => { // Operators are handled in the TeXbook pg. 443-444, rule 13(a). let supGroup; let subGroup; let hasLimits = false; let group; if (grp.type === "supsub") { // If we have limits, supsub will pass us its group to handle. Pull // out the superscript and subscript and set the group to the op in // its base. supGroup = grp.sup; subGroup = grp.sub; group = assertNodeType(grp.base, "operatorname"); hasLimits = true; } else { group = assertNodeType(grp, "operatorname"); } let base; if (group.body.length > 0) { const body = group.body.map(child => { // $FlowFixMe: Check if the node has a string `text` property. const childText = child.text; if (typeof childText === "string") { return { type: "textord", mode: child.mode, text: childText }; } else { return child; } }); // Consolidate function names into symbol characters. const expression = buildExpression(body, options.withFont("mathrm"), true); for (let i = 0; i < expression.length; i++) { const child = expression[i]; if (child instanceof SymbolNode) { // Per amsopn package, // change minus to hyphen and \ast to asterisk child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); } } base = buildCommon.makeSpan(["mop"], expression, options); } else { base = buildCommon.makeSpan(["mop"], [], options); } if (hasLimits) { return assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0); } else { return base; } }; const mathmlBuilder$9 = (group, options) => { // The steps taken here are similar to the html version. let expression = buildExpression$1(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction? let isAllString = true; // default for (let i = 0; i < expression.length; i++) { const node = expression[i]; if (node instanceof mathMLTree.SpaceNode) ; else if (node instanceof mathMLTree.MathNode) { switch (node.type) { case "mi": case "mn": case "ms": case "mspace": case "mtext": break; // Do nothing yet. case "mo": { const child = node.children[0]; if (node.children.length === 1 && child instanceof mathMLTree.TextNode) { child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); } else { isAllString = false; } break; } default: isAllString = false; } } else { isAllString = false; } } if (isAllString) { // Write a single TextNode instead of multiple nested tags. const word = expression.map(node => node.toText()).join(""); expression = [new mathMLTree.TextNode(word)]; } const identifier = new mathMLTree.MathNode("mi", expression); identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡ // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]); if (group.parentIsSupSub) { return new mathMLTree.MathNode("mo", [identifier, operator]); } else { return mathMLTree.newDocumentFragment([identifier, operator]); } }; // \operatorname // amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@ defineFunction({ type: "operatorname", names: ["\\operatorname", "\\operatorname*"], props: { numArgs: 1 }, handler: (_ref, args) => { let parser = _ref.parser, funcName = _ref.funcName; const body = args[0]; return { type: "operatorname", mode: parser.mode, body: ordargument(body), alwaysHandleSupSub: funcName === "\\operatorname*", limits: false, parentIsSupSub: false }; }, htmlBuilder: htmlBuilder$9, mathmlBuilder: mathmlBuilder$9 }); defineFunctionBuilders({ type: "ordgroup", htmlBuilder(group, options) { if (group.semisimple) { return buildCommon.makeFragment(buildExpression(group.body, options, false)); } return buildCommon.makeSpan(["mord"], buildExpression(group.body, options, true), options); }, mathmlBuilder(group, options) { return buildExpressionRow(group.body, options, true); } }); defineFunction({ type: "overline", names: ["\\overline"], props: { numArgs: 1 }, handler(_ref, args) { let parser = _ref.parser; const body = args[0]; return { type: "overline", mode: parser.mode, body }; }, htmlBuilder(group, options) { // Overlines are handled in the TeXbook pg 443, Rule 9. // Build the inner group in the cramped style. const innerGroup = buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body const line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns const defaultRuleThickness = options.fontMetrics().defaultRuleThickness; const vlist = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: innerGroup }, { type: "kern", size: 3 * defaultRuleThickness }, { type: "elem", elem: line }, { type: "kern", size: defaultRuleThickness }] }, options); return buildCommon.makeSpan(["mord", "overline"], [vlist], options); }, mathmlBuilder(group, options) { const operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203e")]); operator.setAttribute("stretchy", "true"); const node = new mathMLTree.MathNode("mover", [buildGroup$1(group.body, options), operator]); node.setAttribute("accent", "true"); return node; } }); defineFunction({ type: "phantom", names: ["\\phantom"], props: { numArgs: 1, allowedInText: true }, handler: (_ref, args) => { let parser = _ref.parser; const body = args[0]; return { type: "phantom", mode: parser.mode, body: ordargument(body) }; }, htmlBuilder: (group, options) => { const elements = buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. // See "color" for more details. return buildCommon.makeFragment(elements); }, mathmlBuilder: (group, options) => { const inner = buildExpression$1(group.body, options); return new mathMLTree.MathNode("mphantom", inner); } }); defineFunction({ type: "hphantom", names: ["\\hphantom"], props: { numArgs: 1, allowedInText: true }, handler: (_ref2, args) => { let parser = _ref2.parser; const body = args[0]; return { type: "hphantom", mode: parser.mode, body }; }, htmlBuilder: (group, options) => { let node = buildCommon.makeSpan([], [buildGroup(group.body, options.withPhantom())]); node.height = 0; node.depth = 0; if (node.children) { for (let i = 0; i < node.children.length; i++) { node.children[i].height = 0; node.children[i].depth = 0; } } // See smash for comment re: use of makeVList node = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: node }] }, options); // For spacing, TeX treats \smash as a math group (same spacing as ord). return buildCommon.makeSpan(["mord"], [node], options); }, mathmlBuilder: (group, options) => { const inner = buildExpression$1(ordargument(group.body), options); const phantom = new mathMLTree.MathNode("mphantom", inner); const node = new mathMLTree.MathNode("mpadded", [phantom]); node.setAttribute("height", "0px"); node.setAttribute("depth", "0px"); return node; } }); defineFunction({ type: "vphantom", names: ["\\vphantom"], props: { numArgs: 1, allowedInText: true }, handler: (_ref3, args) => { let parser = _ref3.parser; const body = args[0]; return { type: "vphantom", mode: parser.mode, body }; }, htmlBuilder: (group, options) => { const inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]); const fix = buildCommon.makeSpan(["fix"], []); return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); }, mathmlBuilder: (group, options) => { const inner = buildExpression$1(ordargument(group.body), options); const phantom = new mathMLTree.MathNode("mphantom", inner); const node = new mathMLTree.MathNode("mpadded", [phantom]); node.setAttribute("width", "0px"); return node; } }); defineFunction({ type: "raisebox", names: ["\\raisebox"], props: { numArgs: 2, argTypes: ["size", "hbox"], allowedInText: true }, handler(_ref, args) { let parser = _ref.parser; const amount = assertNodeType(args[0], "size").value; const body = args[1]; return { type: "raisebox", mode: parser.mode, dy: amount, body }; }, htmlBuilder(group, options) { const body = buildGroup(group.body, options); const dy = calculateSize(group.dy, options); return buildCommon.makeVList({ positionType: "shift", positionData: -dy, children: [{ type: "elem", elem: body }] }, options); }, mathmlBuilder(group, options) { const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); const dy = group.dy.number + group.dy.unit; node.setAttribute("voffset", dy); return node; } }); defineFunction({ type: "rule", names: ["\\rule"], props: { numArgs: 2, numOptionalArgs: 1, argTypes: ["size", "size", "size"] }, handler(_ref, args, optArgs) { let parser = _ref.parser; const shift = optArgs[0]; const width = assertNodeType(args[0], "size"); const height = assertNodeType(args[1], "size"); return { type: "rule", mode: parser.mode, shift: shift && assertNodeType(shift, "size").value, width: width.value, height: height.value }; }, htmlBuilder(group, options) { // Make an empty span for the rule const rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units const width = calculateSize(group.width, options); const height = calculateSize(group.height, options); const shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size rule.style.borderRightWidth = width + "em"; rule.style.borderTopWidth = height + "em"; rule.style.bottom = shift + "em"; // Record the height and width rule.width = width; rule.height = height + shift; rule.depth = -shift; // Font size is the number large enough that the browser will // reserve at least `absHeight` space above the baseline. // The 1.125 factor was empirically determined rule.maxFontSize = height * 1.125 * options.sizeMultiplier; return rule; }, mathmlBuilder(group, options) { const width = calculateSize(group.width, options); const height = calculateSize(group.height, options); const shift = group.shift ? calculateSize(group.shift, options) : 0; const color = options.color && options.getColor() || "black"; const rule = new mathMLTree.MathNode("mspace"); rule.setAttribute("mathbackground", color); rule.setAttribute("width", width + "em"); rule.setAttribute("height", height + "em"); const wrapper = new mathMLTree.MathNode("mpadded", [rule]); if (shift >= 0) { wrapper.setAttribute("height", "+" + shift + "em"); } else { wrapper.setAttribute("height", shift + "em"); wrapper.setAttribute("depth", "+" + -shift + "em"); } wrapper.setAttribute("voffset", shift + "em"); return wrapper; } }); function sizingGroup(value, options, baseOptions) { const inner = buildExpression(value, options, false); const multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize // manually. Handle nested size changes. for (let i = 0; i < inner.length; i++) { const pos = inner[i].classes.indexOf("sizing"); if (pos < 0) { Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions)); } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { // This is a nested size change: e.g., inner[i] is the "b" in // `\Huge a \small b`. Override the old size (the `reset-` class) // but not the new size. inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; } inner[i].height *= multiplier; inner[i].depth *= multiplier; } return buildCommon.makeFragment(inner); } const sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; const htmlBuilder$a = (group, options) => { // Handle sizing operators like \Huge. Real TeX doesn't actually allow // these functions inside of math expressions, so we do some special // handling. const newOptions = options.havingSize(group.size); return sizingGroup(group.body, newOptions, options); }; defineFunction({ type: "sizing", names: sizeFuncs, props: { numArgs: 0, allowedInText: true }, handler: (_ref, args) => { let breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser; const body = parser.parseExpression(false, breakOnTokenText); return { type: "sizing", mode: parser.mode, // Figure out what size to use based on the list of functions above size: sizeFuncs.indexOf(funcName) + 1, body }; }, htmlBuilder: htmlBuilder$a, mathmlBuilder: (group, options) => { const newOptions = options.havingSize(group.size); const inner = buildExpression$1(group.body, newOptions); const node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size // changes, because we don't keep state of what style we're currently // in, so we can't reset the size to normal before changing it. Now // that we're passing an options parameter we should be able to fix // this. node.setAttribute("mathsize", newOptions.sizeMultiplier + "em"); return node; } }); // smash, with optional [tb], as in AMS defineFunction({ type: "smash", names: ["\\smash"], props: { numArgs: 1, numOptionalArgs: 1, allowedInText: true }, handler: (_ref, args, optArgs) => { let parser = _ref.parser; let smashHeight = false; let smashDepth = false; const tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); if (tbArg) { // Optional [tb] argument is engaged. // ref: amsmath: \renewcommand{\smash}[1][tb]{% // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% let letter = ""; for (let i = 0; i < tbArg.body.length; ++i) { const node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property. letter = node.text; if (letter === "t") { smashHeight = true; } else if (letter === "b") { smashDepth = true; } else { smashHeight = false; smashDepth = false; break; } } } else { smashHeight = true; smashDepth = true; } const body = args[0]; return { type: "smash", mode: parser.mode, body, smashHeight, smashDepth }; }, htmlBuilder: (group, options) => { const node = buildCommon.makeSpan([], [buildGroup(group.body, options)]); if (!group.smashHeight && !group.smashDepth) { return node; } if (group.smashHeight) { node.height = 0; // In order to influence makeVList, we have to reset the children. if (node.children) { for (let i = 0; i < node.children.length; i++) { node.children[i].height = 0; } } } if (group.smashDepth) { node.depth = 0; if (node.children) { for (let i = 0; i < node.children.length; i++) { node.children[i].depth = 0; } } } // At this point, we've reset the TeX-like height and depth values. // But the span still has an HTML line height. // makeVList applies "display: table-cell", which prevents the browser // from acting on that line height. So we'll call makeVList now. const smashedNode = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: node }] }, options); // For spacing, TeX treats \hphantom as a math group (same spacing as ord). return buildCommon.makeSpan(["mord"], [smashedNode], options); }, mathmlBuilder: (group, options) => { const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); if (group.smashHeight) { node.setAttribute("height", "0px"); } if (group.smashDepth) { node.setAttribute("depth", "0px"); } return node; } }); defineFunction({ type: "sqrt", names: ["\\sqrt"], props: { numArgs: 1, numOptionalArgs: 1 }, handler(_ref, args, optArgs) { let parser = _ref.parser; const index = optArgs[0]; const body = args[0]; return { type: "sqrt", mode: parser.mode, body, index }; }, htmlBuilder(group, options) { // Square roots are handled in the TeXbook pg. 443, Rule 11. // First, we do the same steps as in overline to build the inner group // and line let inner = buildGroup(group.body, options.havingCrampedStyle()); if (inner.height === 0) { // Render a small surd. inner.height = options.fontMetrics().xHeight; } // Some groups can return document fragments. Handle those by wrapping // them in a span. inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter const metrics = options.fontMetrics(); const theta = metrics.defaultRuleThickness; let phi = theta; if (options.style.id < Style$1.TEXT.id) { phi = options.fontMetrics().xHeight; } // Calculate the clearance between the body and line let lineClearance = theta + phi / 4; const minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size const _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options), img = _delimiter$sqrtImage.span, ruleWidth = _delimiter$sqrtImage.ruleWidth, advanceWidth = _delimiter$sqrtImage.advanceWidth; const delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size if (delimDepth > inner.height + inner.depth + lineClearance) { lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2; } // Shift the sqrt image const imgShift = img.height - inner.height - lineClearance - ruleWidth; inner.style.paddingLeft = advanceWidth + "em"; // Overlay the image and the argument. const body = buildCommon.makeVList({ positionType: "firstBaseline", children: [{ type: "elem", elem: inner, wrapperClasses: ["svg-align"] }, { type: "kern", size: -(inner.height + imgShift) }, { type: "elem", elem: img }, { type: "kern", size: ruleWidth }] }, options); if (!group.index) { return buildCommon.makeSpan(["mord", "sqrt"], [body], options); } else { // Handle the optional root index // The index is always in scriptscript style const newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT); const rootm = buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX // source, in the definition of `\r@@t`. const toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly const rootVList = buildCommon.makeVList({ positionType: "shift", positionData: -toShift, children: [{ type: "elem", elem: rootm }] }, options); // Add a class surrounding it so we can add on the appropriate // kerning const rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options); } }, mathmlBuilder(group, options) { const body = group.body, index = group.index; return index ? new mathMLTree.MathNode("mroot", [buildGroup$1(body, options), buildGroup$1(index, options)]) : new mathMLTree.MathNode("msqrt", [buildGroup$1(body, options)]); } }); const styleMap$1 = { "display": Style$1.DISPLAY, "text": Style$1.TEXT, "script": Style$1.SCRIPT, "scriptscript": Style$1.SCRIPTSCRIPT }; defineFunction({ type: "styling", names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], props: { numArgs: 0, allowedInText: true }, handler(_ref, args) { let breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser; // parse out the implicit body const body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g. // here and in buildHTML and de-dupe the enumeration of all the styles). // $FlowFixMe: The names above exactly match the styles. const style = funcName.slice(1, funcName.length - 5); return { type: "styling", mode: parser.mode, // Figure out what style to use by pulling out the style from // the function name style, body }; }, htmlBuilder(group, options) { // Style changes are handled in the TeXbook on pg. 442, Rule 3. const newStyle = styleMap$1[group.style]; const newOptions = options.havingStyle(newStyle).withFont(''); return sizingGroup(group.body, newOptions, options); }, mathmlBuilder(group, options) { // Figure out what style we're changing to. const newStyle = styleMap$1[group.style]; const newOptions = options.havingStyle(newStyle); const inner = buildExpression$1(group.body, newOptions); const node = new mathMLTree.MathNode("mstyle", inner); const styleAttributes = { "display": ["0", "true"], "text": ["0", "false"], "script": ["1", "false"], "scriptscript": ["2", "false"] }; const attr = styleAttributes[group.style]; node.setAttribute("scriptlevel", attr[0]); node.setAttribute("displaystyle", attr[1]); return node; } }); /** * Sometimes, groups perform special rules when they have superscripts or * subscripts attached to them. This function lets the `supsub` group know that * Sometimes, groups perform special rules when they have superscripts or * its inner element should handle the superscripts and subscripts instead of * handling them itself. */ const htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { const base = group.base; if (!base) { return null; } else if (base.type === "op") { // Operators handle supsubs differently when they have limits // (e.g. `\displaystyle\sum_2^3`) const delegate = base.limits && (options.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub); return delegate ? htmlBuilder$8 : null; } else if (base.type === "operatorname") { const delegate = base.alwaysHandleSupSub && (options.style.size === Style$1.DISPLAY.size || base.limits); return delegate ? htmlBuilder$9 : null; } else if (base.type === "accent") { return utils.isCharacterBox(base.base) ? htmlBuilder : null; } else if (base.type === "horizBrace") { const isSup = !group.sub; return isSup === base.isOver ? htmlBuilder$7 : null; } else { return null; } }; // Super scripts and subscripts, whose precise placement can depend on other // functions that precede them. defineFunctionBuilders({ type: "supsub", htmlBuilder(group, options) { // Superscript and subscripts are handled in the TeXbook on page // 445-446, rules 18(a-f). // Here is where we defer to the inner group if it should handle // superscripts and subscripts itself. const builderDelegate = htmlBuilderDelegate(group, options); if (builderDelegate) { return builderDelegate(group, options); } const valueBase = group.base, valueSup = group.sup, valueSub = group.sub; const base = buildGroup(valueBase, options); let supm; let subm; const metrics = options.fontMetrics(); // Rule 18a let supShift = 0; let subShift = 0; const isCharacterBox = valueBase && utils.isCharacterBox(valueBase); if (valueSup) { const newOptions = options.havingStyle(options.style.sup()); supm = buildGroup(valueSup, newOptions, options); if (!isCharacterBox) { supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier; } } if (valueSub) { const newOptions = options.havingStyle(options.style.sub()); subm = buildGroup(valueSub, newOptions, options); if (!isCharacterBox) { subShift = base.depth + newOptions.fontMetrics().subDrop * newOptions.sizeMultiplier / options.sizeMultiplier; } } // Rule 18c let minSupShift; if (options.style === Style$1.DISPLAY) { minSupShift = metrics.sup1; } else if (options.style.cramped) { minSupShift = metrics.sup3; } else { minSupShift = metrics.sup2; } // scriptspace is a font-size-independent size, so scale it // appropriately for use as the marginRight. const multiplier = options.sizeMultiplier; const marginRight = 0.5 / metrics.ptPerEm / multiplier + "em"; let marginLeft = null; if (subm) { // Subscripts shouldn't be shifted by the base's italic correction. // Account for that by shifting the subscript back the appropriate // amount. Note we only do this when the base is a single symbol. const isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); if (base instanceof SymbolNode || isOiint) { // $FlowFixMe marginLeft = -base.italic + "em"; } } let supsub; if (supm && subm) { supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); subShift = Math.max(subShift, metrics.sub2); const ruleWidth = metrics.defaultRuleThickness; // Rule 18e const maxWidth = 4 * ruleWidth; if (supShift - supm.depth - (subm.height - subShift) < maxWidth) { subShift = maxWidth - (supShift - supm.depth) + subm.height; const psi = 0.8 * metrics.xHeight - (supShift - supm.depth); if (psi > 0) { supShift += psi; subShift -= psi; } } const vlistElem = [{ type: "elem", elem: subm, shift: subShift, marginRight, marginLeft }, { type: "elem", elem: supm, shift: -supShift, marginRight }]; supsub = buildCommon.makeVList({ positionType: "individualShift", children: vlistElem }, options); } else if (subm) { // Rule 18b subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); const vlistElem = [{ type: "elem", elem: subm, marginLeft, marginRight }]; supsub = buildCommon.makeVList({ positionType: "shift", positionData: subShift, children: vlistElem }, options); } else if (supm) { // Rule 18c, d supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); supsub = buildCommon.makeVList({ positionType: "shift", positionData: -supShift, children: [{ type: "elem", elem: supm, marginRight }] }, options); } else { throw new Error("supsub must have either sup or sub."); } // Wrap the supsub vlist in a span.msupsub to reset text-align. const mclass = getTypeOfDomTree(base, "right") || "mord"; return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options); }, mathmlBuilder(group, options) { // Is the inner group a relevant horizonal brace? let isBrace = false; let isOver; let isSup; if (group.base && group.base.type === "horizBrace") { isSup = !!group.sup; if (isSup === group.base.isOver) { isBrace = true; isOver = group.base.isOver; } } if (group.base && (group.base.type === "op" || group.base.type === "operatorname")) { group.base.parentIsSupSub = true; } const children = [buildGroup$1(group.base, options)]; if (group.sub) { children.push(buildGroup$1(group.sub, options)); } if (group.sup) { children.push(buildGroup$1(group.sup, options)); } let nodeType; if (isBrace) { nodeType = isOver ? "mover" : "munder"; } else if (!group.sub) { const base = group.base; if (base && base.type === "op" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) { nodeType = "mover"; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === Style$1.DISPLAY)) { nodeType = "mover"; } else { nodeType = "msup"; } } else if (!group.sup) { const base = group.base; if (base && base.type === "op" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) { nodeType = "munder"; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === Style$1.DISPLAY)) { nodeType = "munder"; } else { nodeType = "msub"; } } else { const base = group.base; if (base && base.type === "op" && base.limits && options.style === Style$1.DISPLAY) { nodeType = "munderover"; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (options.style === Style$1.DISPLAY || base.limits)) { nodeType = "munderover"; } else { nodeType = "msubsup"; } } const node = new mathMLTree.MathNode(nodeType, children); return node; } }); defineFunctionBuilders({ type: "atom", htmlBuilder(group, options) { return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]); }, mathmlBuilder(group, options) { const node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]); if (group.family === "bin") { const variant = getVariant(group, options); if (variant === "bold-italic") { node.setAttribute("mathvariant", variant); } } else if (group.family === "punct") { node.setAttribute("separator", "true"); } else if (group.family === "open" || group.family === "close") { // Delims built here should not stretch vertically. // See delimsizing.js for stretchy delims. node.setAttribute("stretchy", "false"); } return node; } }); // "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in const defaultVariant = { "mi": "italic", "mn": "normal", "mtext": "normal" }; defineFunctionBuilders({ type: "mathord", htmlBuilder(group, options) { return buildCommon.makeOrd(group, options, "mathord"); }, mathmlBuilder(group, options) { const node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]); const variant = getVariant(group, options) || "italic"; if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); } return node; } }); defineFunctionBuilders({ type: "textord", htmlBuilder(group, options) { return buildCommon.makeOrd(group, options, "textord"); }, mathmlBuilder(group, options) { const text = makeText(group.text, group.mode, options); const variant = getVariant(group, options) || "normal"; let node; if (group.mode === 'text') { node = new mathMLTree.MathNode("mtext", [text]); } else if (/[0-9]/.test(group.text)) { // TODO(kevinb) merge adjacent nodes // do it as a post processing step node = new mathMLTree.MathNode("mn", [text]); } else if (group.text === "\\prime") { node = new mathMLTree.MathNode("mo", [text]); } else { node = new mathMLTree.MathNode("mi", [text]); } if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); } return node; } }); const cssSpace = { "\\nobreak": "nobreak", "\\allowbreak": "allowbreak" }; // A lookup table to determine whether a spacing function/symbol should be // treated like a regular space character. If a symbol or command is a key // in this table, then it should be a regular space character. Furthermore, // the associated value may have a `className` specifying an extra CSS class // to add to the created `span`. const regularSpace = { " ": {}, "\\ ": {}, "~": { className: "nobreak" }, "\\space": {}, "\\nobreakspace": { className: "nobreak" } }; // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in // src/symbols.js. defineFunctionBuilders({ type: "spacing", htmlBuilder(group, options) { if (regularSpace.hasOwnProperty(group.text)) { const className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these // things has an entry in the symbols table, so these will be turned // into appropriate outputs. if (group.mode === "text") { const ord = buildCommon.makeOrd(group, options, "textord"); ord.classes.push(className); return ord; } else { return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options); } } else if (cssSpace.hasOwnProperty(group.text)) { // Spaces based on just a CSS class. return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options); } else { throw new ParseError(`Unknown type of space "${group.text}"`); } }, mathmlBuilder(group, options) { let node; if (regularSpace.hasOwnProperty(group.text)) { node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\u00a0")]); } else if (cssSpace.hasOwnProperty(group.text)) { // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored return new mathMLTree.MathNode("mspace"); } else { throw new ParseError(`Unknown type of space "${group.text}"`); } return node; } }); const pad = () => { const padNode = new mathMLTree.MathNode("mtd", []); padNode.setAttribute("width", "50%"); return padNode; }; defineFunctionBuilders({ type: "tag", mathmlBuilder(group, options) { const table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]); table.setAttribute("width", "100%"); return table; // TODO: Left-aligned tags. // Currently, the group and options passed here do not contain // enough info to set tag alignment. `leqno` is in Settings but it is // not passed to Options. On the HTML side, leqno is // set by a CSS class applied in buildTree.js. That would have worked // in MathML if browsers supported . Since they don't, we // need to rewrite the way this function is called. } }); const textFontFamilies = { "\\text": undefined, "\\textrm": "textrm", "\\textsf": "textsf", "\\texttt": "texttt", "\\textnormal": "textrm" }; const textFontWeights = { "\\textbf": "textbf", "\\textmd": "textmd" }; const textFontShapes = { "\\textit": "textit", "\\textup": "textup" }; const optionsWithFont = (group, options) => { const font = group.font; // Checks if the argument is a font family or a font style. if (!font) { return options; } else if (textFontFamilies[font]) { return options.withTextFontFamily(textFontFamilies[font]); } else if (textFontWeights[font]) { return options.withTextFontWeight(textFontWeights[font]); } else { return options.withTextFontShape(textFontShapes[font]); } }; defineFunction({ type: "text", names: [// Font families "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights "\\textbf", "\\textmd", // Font Shapes "\\textit", "\\textup"], props: { numArgs: 1, argTypes: ["text"], greediness: 2, allowedInText: true }, handler(_ref, args) { let parser = _ref.parser, funcName = _ref.funcName; const body = args[0]; return { type: "text", mode: parser.mode, body: ordargument(body), font: funcName }; }, htmlBuilder(group, options) { const newOptions = optionsWithFont(group, options); const inner = buildExpression(group.body, newOptions, true); return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions); }, mathmlBuilder(group, options) { const newOptions = optionsWithFont(group, options); return buildExpressionRow(group.body, newOptions); } }); defineFunction({ type: "underline", names: ["\\underline"], props: { numArgs: 1, allowedInText: true }, handler(_ref, args) { let parser = _ref.parser; return { type: "underline", mode: parser.mode, body: args[0] }; }, htmlBuilder(group, options) { // Underlines are handled in the TeXbook pg 443, Rule 10. // Build the inner group. const innerGroup = buildGroup(group.body, options); // Create the line to go below the body const line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns const defaultRuleThickness = options.fontMetrics().defaultRuleThickness; const vlist = buildCommon.makeVList({ positionType: "top", positionData: innerGroup.height, children: [{ type: "kern", size: defaultRuleThickness }, { type: "elem", elem: line }, { type: "kern", size: 3 * defaultRuleThickness }, { type: "elem", elem: innerGroup }] }, options); return buildCommon.makeSpan(["mord", "underline"], [vlist], options); }, mathmlBuilder(group, options) { const operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203e")]); operator.setAttribute("stretchy", "true"); const node = new mathMLTree.MathNode("munder", [buildGroup$1(group.body, options), operator]); node.setAttribute("accentunder", "true"); return node; } }); defineFunction({ type: "verb", names: ["\\verb"], props: { numArgs: 0, allowedInText: true }, handler(context, args, optArgs) { // \verb and \verb* are dealt with directly in Parser.js. // If we end up here, it's because of a failure to match the two delimiters // in the regex in Lexer.js. LaTeX raises the following error when \verb is // terminated by end of line (or file). throw new ParseError("\\verb ended by end of line instead of matching delimiter"); }, htmlBuilder(group, options) { const text = makeVerb(group); const body = []; // \verb enters text mode and therefore is sized like \textstyle const newOptions = options.havingStyle(options.style.text()); for (let i = 0; i < text.length; i++) { let c = text[i]; if (c === '~') { c = '\\textasciitilde'; } body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"])); } return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions); }, mathmlBuilder(group, options) { const text = new mathMLTree.TextNode(makeVerb(group)); const node = new mathMLTree.MathNode("mtext", [text]); node.setAttribute("mathvariant", "monospace"); return node; } }); /** * Converts verb group into body string. * * \verb* replaces each space with an open box \u2423 * \verb replaces each space with a no-break space \xA0 */ const makeVerb = group => group.body.replace(/ /g, group.star ? '\u2423' : '\xA0'); /** Include this to ensure that all functions are defined. */ const functions = _functions; /** * The Lexer class handles tokenizing the input in various ways. Since our * parser expects us to be able to backtrack, the lexer allows lexing from any * given starting point. * * Its main exposed function is the `lex` function, which takes a position to * lex from and a type of token to lex. It defers to the appropriate `_innerLex` * function. * * The various `_innerLex` functions perform the actual lexing of different * kinds. */ /* The following tokenRegex * - matches typical whitespace (but not NBSP etc.) using its first group * - does not match any control character \x00-\x1f except whitespace * - does not match a bare backslash * - matches any ASCII character except those just mentioned * - does not match the BMP private use area \uE000-\uF8FF * - does not match bare surrogate code units * - matches any BMP character except for those just described * - matches any valid Unicode surrogate pair * - matches a backslash followed by one or more letters * - matches a backslash followed by any BMP character, including newline * Just because the Lexer matches something doesn't mean it's valid input: * If there is no matching function or symbol definition, the Parser will * still reject the input. */ const spaceRegexString = "[ \r\n\t]"; const controlWordRegexString = "\\\\[a-zA-Z@]+"; const controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; const controlWordWhitespaceRegexString = `${controlWordRegexString}${spaceRegexString}*`; const controlWordWhitespaceRegex = new RegExp(`^(${controlWordRegexString})${spaceRegexString}*$`); const combiningDiacriticalMarkString = "[\u0300-\u036f]"; const combiningDiacriticalMarksEndRegex = new RegExp(`${combiningDiacriticalMarkString}+$`); const tokenRegexString = `(${spaceRegexString}+)|` + // whitespace "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint `${combiningDiacriticalMarkString}*` + // ...plus accents "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair `${combiningDiacriticalMarkString}*` + // ...plus accents "|\\\\verb\\*([^]).*?\\3" + // \verb* "|\\\\verb([^*a-zA-Z]).*?\\4" + // \verb unstarred "|\\\\operatorname\\*" + // \operatorname* `|${controlWordWhitespaceRegexString}` + // \macroName + spaces `|${controlSymbolRegexString})`; // \\, \', etc. /** Main Lexer class */ class Lexer { // category codes, only supports comment characters (14) for now constructor(input, settings) { this.input = void 0; this.settings = void 0; this.tokenRegex = void 0; this.catcodes = void 0; // Separate accents from characters this.input = input; this.settings = settings; this.tokenRegex = new RegExp(tokenRegexString, 'g'); this.catcodes = { "%": 14 // comment character }; } setCatcode(char, code) { this.catcodes[char] = code; } /** * This function lexes a single token. */ lex() { const input = this.input; const pos = this.tokenRegex.lastIndex; if (pos === input.length) { return new Token("EOF", new SourceLocation(this, pos, pos)); } const match = this.tokenRegex.exec(input); if (match === null || match.index !== pos) { throw new ParseError(`Unexpected character: '${input[pos]}'`, new Token(input[pos], new SourceLocation(this, pos, pos + 1))); } let text = match[2] || " "; if (this.catcodes[text] === 14) { // comment character const nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex); if (nlIndex === -1) { this.tokenRegex.lastIndex = input.length; // EOF this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)"); } else { this.tokenRegex.lastIndex = nlIndex + 1; } return this.lex(); } // Trim any trailing whitespace from control word match const controlMatch = text.match(controlWordWhitespaceRegex); if (controlMatch) { text = controlMatch[1]; } return new Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex)); } } /** * A `Namespace` refers to a space of nameable things like macros or lengths, * which can be `set` either globally or local to a nested group, using an * undo stack similar to how TeX implements this functionality. * Performance-wise, `get` and local `set` take constant time, while global * `set` takes time proportional to the depth of group nesting. */ class Namespace { /** * Both arguments are optional. The first argument is an object of * built-in mappings which never change. The second argument is an object * of initial (global-level) mappings, which will constantly change * according to any global/top-level `set`s done. */ constructor(builtins, globalMacros) { if (builtins === void 0) { builtins = {}; } if (globalMacros === void 0) { globalMacros = {}; } this.current = void 0; this.builtins = void 0; this.undefStack = void 0; this.current = globalMacros; this.builtins = builtins; this.undefStack = []; } /** * Start a new nested group, affecting future local `set`s. */ beginGroup() { this.undefStack.push({}); } /** * End current nested group, restoring values before the group began. */ endGroup() { if (this.undefStack.length === 0) { throw new ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug"); } const undefs = this.undefStack.pop(); for (const undef in undefs) { if (undefs.hasOwnProperty(undef)) { if (undefs[undef] === undefined) { delete this.current[undef]; } else { this.current[undef] = undefs[undef]; } } } } /** * Detect whether `name` has a definition. Equivalent to * `get(name) != null`. */ has(name) { return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name); } /** * Get the current value of a name, or `undefined` if there is no value. * * Note: Do not use `if (namespace.get(...))` to detect whether a macro * is defined, as the definition may be the empty string which evaluates * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or * `if (namespace.has(...))`. */ get(name) { if (this.current.hasOwnProperty(name)) { return this.current[name]; } else { return this.builtins[name]; } } /** * Set the current value of a name, and optionally set it globally too. * Local set() sets the current value and (when appropriate) adds an undo * operation to the undo stack. Global set() may change the undo * operation at every level, so takes time linear in their number. */ set(name, value, global) { if (global === void 0) { global = false; } if (global) { // Global set is equivalent to setting in all groups. Simulate this // by destroying any undos currently scheduled for this name, // and adding an undo with the *new* value (in case it later gets // locally reset within this environment). for (let i = 0; i < this.undefStack.length; i++) { delete this.undefStack[i][name]; } if (this.undefStack.length > 0) { this.undefStack[this.undefStack.length - 1][name] = value; } } else { // Undo this set at end of this group (possibly to `undefined`), // unless an undo is already in place, in which case that older // value is the correct one. const top = this.undefStack[this.undefStack.length - 1]; if (top && !top.hasOwnProperty(name)) { top[name] = this.current[name]; } } this.current[name] = value; } } /** * Predefined macros for KaTeX. * This can be used to define some commands in terms of others. */ const builtinMacros = {}; function defineMacro(name, body) { builtinMacros[name] = body; } ////////////////////////////////////////////////////////////////////// // macro tools defineMacro("\\noexpand", function (context) { // The expansion is the token itself; but that token is interpreted // as if its meaning were ‘\relax’ if it is a control sequence that // would ordinarily be expanded by TeX’s expansion rules. const t = context.popToken(); if (context.isExpandable(t.text)) { t.noexpand = true; t.treatAsRelax = true; } return { tokens: [t], numArgs: 0 }; }); defineMacro("\\expandafter", function (context) { // TeX first reads the token that comes immediately after \expandafter, // without expanding it; let’s call this token t. Then TeX reads the // token that comes after t (and possibly more tokens, if that token // has an argument), replacing it by its expansion. Finally TeX puts // t back in front of that expansion. const t = context.popToken(); context.expandOnce(true); // expand only an expandable token return { tokens: [t], numArgs: 0 }; }); // LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2 // TeX source: \long\def\@firstoftwo#1#2{#1} defineMacro("\\@firstoftwo", function (context) { const args = context.consumeArgs(2); return { tokens: args[0], numArgs: 0 }; }); // LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1 // TeX source: \long\def\@secondoftwo#1#2{#2} defineMacro("\\@secondoftwo", function (context) { const args = context.consumeArgs(2); return { tokens: args[1], numArgs: 0 }; }); // LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded) // symbol that isn't a space, consuming any spaces but not consuming the // first nonspace character. If that nonspace character matches #1, then // the macro expands to #2; otherwise, it expands to #3. defineMacro("\\@ifnextchar", function (context) { const args = context.consumeArgs(3); // symbol, if, else context.consumeSpaces(); const nextToken = context.future(); if (args[0].length === 1 && args[0][0].text === nextToken.text) { return { tokens: args[1], numArgs: 0 }; } else { return { tokens: args[2], numArgs: 0 }; } }); // LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol. // If it is `*`, then it consumes the symbol, and the macro expands to #1; // otherwise, the macro expands to #2 (without consuming the symbol). // TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}} defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode defineMacro("\\TextOrMath", function (context) { const args = context.consumeArgs(2); if (context.mode === 'text') { return { tokens: args[0], numArgs: 0 }; } else { return { tokens: args[1], numArgs: 0 }; } }); // Lookup table for parsing numbers in base 8 through 16 const digitToNumber = { "0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "a": 10, "A": 10, "b": 11, "B": 11, "c": 12, "C": 12, "d": 13, "D": 13, "e": 14, "E": 14, "f": 15, "F": 15 }; // TeX \char makes a literal character (catcode 12) using the following forms: // (see The TeXBook, p. 43) // \char123 -- decimal // \char'123 -- octal // \char"123 -- hex // \char`x -- character that can be written (i.e. isn't active) // \char`\x -- character that cannot be written (e.g. %) // These all refer to characters from the font, so we turn them into special // calls to a function \@char dealt with in the Parser. defineMacro("\\char", function (context) { let token = context.popToken(); let base; let number = ''; if (token.text === "'") { base = 8; token = context.popToken(); } else if (token.text === '"') { base = 16; token = context.popToken(); } else if (token.text === "`") { token = context.popToken(); if (token.text[0] === "\\") { number = token.text.charCodeAt(1); } else if (token.text === "EOF") { throw new ParseError("\\char` missing argument"); } else { number = token.text.charCodeAt(0); } } else { base = 10; } if (base) { // Parse a number in the given base, starting with first `token`. number = digitToNumber[token.text]; if (number == null || number >= base) { throw new ParseError(`Invalid base-${base} digit ${token.text}`); } let digit; while ((digit = digitToNumber[context.future().text]) != null && digit < base) { number *= base; number += digit; context.popToken(); } } return `\\@char{${number}}`; }); // \newcommand{\macro}[args]{definition} // \renewcommand{\macro}[args]{definition} // TODO: Optional arguments: \newcommand{\macro}[args][default]{definition} const newcommand = (context, existsOK, nonexistsOK) => { let arg = context.consumeArgs(1)[0]; if (arg.length !== 1) { throw new ParseError("\\newcommand's first argument must be a macro name"); } const name = arg[0].text; const exists = context.isDefined(name); if (exists && !existsOK) { throw new ParseError(`\\newcommand{${name}} attempting to redefine ` + `${name}; use \\renewcommand`); } if (!exists && !nonexistsOK) { throw new ParseError(`\\renewcommand{${name}} when command ${name} ` + `does not yet exist; use \\newcommand`); } let numArgs = 0; arg = context.consumeArgs(1)[0]; if (arg.length === 1 && arg[0].text === "[") { let argText = ''; let token = context.expandNextToken(); while (token.text !== "]" && token.text !== "EOF") { // TODO: Should properly expand arg, e.g., ignore {}s argText += token.text; token = context.expandNextToken(); } if (!argText.match(/^\s*[0-9]+\s*$/)) { throw new ParseError(`Invalid number of arguments: ${argText}`); } numArgs = parseInt(argText); arg = context.consumeArgs(1)[0]; } // Final arg is the expansion of the macro context.macros.set(name, { tokens: arg, numArgs }); return ''; }; defineMacro("\\newcommand", context => newcommand(context, false, true)); defineMacro("\\renewcommand", context => newcommand(context, true, false)); defineMacro("\\providecommand", context => newcommand(context, true, true)); // terminal (console) tools defineMacro("\\message", context => { const arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console console.log(arg.reverse().map(token => token.text).join("")); return ''; }); defineMacro("\\errmessage", context => { const arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console console.error(arg.reverse().map(token => token.text).join("")); return ''; }); defineMacro("\\show", context => { const tok = context.popToken(); const name = tok.text; // eslint-disable-next-line no-console console.log(tok, context.macros.get(name), functions[name], symbols.math[name], symbols.text[name]); return ''; }); ////////////////////////////////////////////////////////////////////// // Grouping // \let\bgroup={ \let\egroup=} defineMacro("\\bgroup", "{"); defineMacro("\\egroup", "}"); // Symbols from latex.ltx: // \def\lq{`} // \def\rq{'} // \def \aa {\r a} // \def \AA {\r A} defineMacro("\\lq", "`"); defineMacro("\\rq", "'"); defineMacro("\\aa", "\\r a"); defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML. // \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}} // \DeclareTextCommandDefault{\textregistered}{\textcircled{% // \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}} // \DeclareRobustCommand{\copyright}{% // \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi} defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}"); defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"); defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Characters omitted from Unicode range 1D400–1D7FF defineMacro("\u212C", "\\mathscr{B}"); // script defineMacro("\u2130", "\\mathscr{E}"); defineMacro("\u2131", "\\mathscr{F}"); defineMacro("\u210B", "\\mathscr{H}"); defineMacro("\u2110", "\\mathscr{I}"); defineMacro("\u2112", "\\mathscr{L}"); defineMacro("\u2133", "\\mathscr{M}"); defineMacro("\u211B", "\\mathscr{R}"); defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur defineMacro("\u210C", "\\mathfrak{H}"); defineMacro("\u2128", "\\mathfrak{Z}"); // Define \Bbbk with a macro that works in both HTML and MathML. defineMacro("\\Bbbk", "\\Bbb{k}"); // Unicode middle dot // The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays // the dot at U+22C5 and gives it punct spacing. defineMacro("\u00b7", "\\cdotp"); // \llap and \rlap render their contents in text mode defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fontmath.ltx via // \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36} // It's thus treated like a \mathrel, but defined by a symbol that has zero // width but extends to the right. We use \rlap to get that spacing. // For MathML we write U+0338 here. buildMathML.js will then do the overlay. defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); // Negated symbols from base/fontmath.ltx: // \def\neq{\not=} \let\ne=\neq // \DeclareRobustCommand // \notin{\mathrel{\m@th\mathpalette\c@ncel\in}} // \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}} defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"); defineMacro("\\ne", "\\neq"); defineMacro("\u2260", "\\neq"); defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + "{\\mathrel{\\char`∉}}"); defineMacro("\u2209", "\\notin"); // Unicode stacked relations defineMacro("\u2258", "\\html@mathml{" + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + "}{\\mathrel{\\char`\u2258}}"); defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}"); defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}"); defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + "{\\mathrel{\\char`\u225B}}"); defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + "{\\mathrel{\\char`\u225D}}"); defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + "{\\mathrel{\\char`\u225E}}"); defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); // Misc Unicode defineMacro("\u27C2", "\\perp"); defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}"); defineMacro("\u220C", "\\notni"); defineMacro("\u231C", "\\ulcorner"); defineMacro("\u231D", "\\urcorner"); defineMacro("\u231E", "\\llcorner"); defineMacro("\u231F", "\\lrcorner"); defineMacro("\u00A9", "\\copyright"); defineMacro("\u00AE", "\\textregistered"); defineMacro("\uFE0F", "\\textregistered"); // The KaTeX fonts have corners at codepoints that don't match Unicode. // For MathML purposes, use the Unicode code point. defineMacro("\\ulcorner", "\\html@mathml{\\@ulcorner}{\\mathop{\\char\"231c}}"); defineMacro("\\urcorner", "\\html@mathml{\\@urcorner}{\\mathop{\\char\"231d}}"); defineMacro("\\llcorner", "\\html@mathml{\\@llcorner}{\\mathop{\\char\"231e}}"); defineMacro("\\lrcorner", "\\html@mathml{\\@lrcorner}{\\mathop{\\char\"231f}}"); ////////////////////////////////////////////////////////////////////// // LaTeX_2ε // \vdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@ // \kern6\p@\hbox{.}\hbox{.}\hbox{.}}} // We'll call \varvdots, which gets a glyph from symbols.js. // The zero-width rule gets us an equivalent to the vertical 6pt kern. defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}"); defineMacro("\u22ee", "\\vdots"); ////////////////////////////////////////////////////////////////////// // amsmath.sty // http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf // Italic Greek capital letters. AMS defines these with \DeclareMathSymbol, // but they are equivalent to \mathit{\Letter}. defineMacro("\\varGamma", "\\mathit{\\Gamma}"); defineMacro("\\varDelta", "\\mathit{\\Delta}"); defineMacro("\\varTheta", "\\mathit{\\Theta}"); defineMacro("\\varLambda", "\\mathit{\\Lambda}"); defineMacro("\\varXi", "\\mathit{\\Xi}"); defineMacro("\\varPi", "\\mathit{\\Pi}"); defineMacro("\\varSigma", "\\mathit{\\Sigma}"); defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); defineMacro("\\varPhi", "\\mathit{\\Phi}"); defineMacro("\\varPsi", "\\mathit{\\Psi}"); defineMacro("\\varOmega", "\\mathit{\\Omega}"); //\newcommand{\substack}[1]{\subarray{c}#1\endsubarray} defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); // \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript // \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu"); // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Longleftrightarrow\;} // \def\implies{\DOTSB\;\Longrightarrow\;} // \def\impliedby{\DOTSB\;\Longleftarrow\;} defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro. const dotsByToken = { ',': '\\dotsc', '\\not': '\\dotsb', // \keybin@ checks for the following: '+': '\\dotsb', '=': '\\dotsb', '<': '\\dotsb', '>': '\\dotsb', '-': '\\dotsb', '*': '\\dotsb', ':': '\\dotsb', // Symbols whose definition starts with \DOTSB: '\\DOTSB': '\\dotsb', '\\coprod': '\\dotsb', '\\bigvee': '\\dotsb', '\\bigwedge': '\\dotsb', '\\biguplus': '\\dotsb', '\\bigcap': '\\dotsb', '\\bigcup': '\\dotsb', '\\prod': '\\dotsb', '\\sum': '\\dotsb', '\\bigotimes': '\\dotsb', '\\bigoplus': '\\dotsb', '\\bigodot': '\\dotsb', '\\bigsqcup': '\\dotsb', '\\And': '\\dotsb', '\\longrightarrow': '\\dotsb', '\\Longrightarrow': '\\dotsb', '\\longleftarrow': '\\dotsb', '\\Longleftarrow': '\\dotsb', '\\longleftrightarrow': '\\dotsb', '\\Longleftrightarrow': '\\dotsb', '\\mapsto': '\\dotsb', '\\longmapsto': '\\dotsb', '\\hookrightarrow': '\\dotsb', '\\doteq': '\\dotsb', // Symbols whose definition starts with \mathbin: '\\mathbin': '\\dotsb', // Symbols whose definition starts with \mathrel: '\\mathrel': '\\dotsb', '\\relbar': '\\dotsb', '\\Relbar': '\\dotsb', '\\xrightarrow': '\\dotsb', '\\xleftarrow': '\\dotsb', // Symbols whose definition starts with \DOTSI: '\\DOTSI': '\\dotsi', '\\int': '\\dotsi', '\\oint': '\\dotsi', '\\iint': '\\dotsi', '\\iiint': '\\dotsi', '\\iiiint': '\\dotsi', '\\idotsint': '\\dotsi', // Symbols whose definition starts with \DOTSX: '\\DOTSX': '\\dotsx' }; defineMacro("\\dots", function (context) { // TODO: If used in text mode, should expand to \textellipsis. // However, in KaTeX, \textellipsis and \ldots behave the same // (in text mode), and it's unlikely we'd see any of the math commands // that affect the behavior of \dots when in text mode. So fine for now // (until we support \ifmmode ... \else ... \fi). let thedots = '\\dotso'; const next = context.expandAfterFuture().text; if (next in dotsByToken) { thedots = dotsByToken[next]; } else if (next.substr(0, 4) === '\\not') { thedots = '\\dotsb'; } else if (next in symbols.math) { if (utils.contains(['bin', 'rel'], symbols.math[next].group)) { thedots = '\\dotsb'; } } return thedots; }); const spaceAfterDots = { // \rightdelim@ checks for the following: ')': true, ']': true, '\\rbrack': true, '\\}': true, '\\rbrace': true, '\\rangle': true, '\\rceil': true, '\\rfloor': true, '\\rgroup': true, '\\rmoustache': true, '\\right': true, '\\bigr': true, '\\biggr': true, '\\Bigr': true, '\\Biggr': true, // \extra@ also tests for the following: '$': true, // \extrap@ checks for the following: ';': true, '.': true, ',': true }; defineMacro("\\dotso", function (context) { const next = context.future().text; if (next in spaceAfterDots) { return "\\ldots\\,"; } else { return "\\ldots"; } }); defineMacro("\\dotsc", function (context) { const next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for // ';' and '.', but doesn't check for ','. if (next in spaceAfterDots && next !== ',') { return "\\ldots\\,"; } else { return "\\ldots"; } }); defineMacro("\\cdots", function (context) { const next = context.future().text; if (next in spaceAfterDots) { return "\\@cdots\\,"; } else { return "\\@cdots"; } }); defineMacro("\\dotsb", "\\cdots"); defineMacro("\\dotsm", "\\cdots"); defineMacro("\\dotsi", "\\!\\cdots"); // amsmath doesn't actually define \dotsx, but \dots followed by a macro // starting with \DOTSX implies \dotso, and then \extra@ detects this case // and forces the added `\,`. defineMacro("\\dotsx", "\\ldots\\,"); // \let\DOTSI\relax // \let\DOTSB\relax // \let\DOTSX\relax defineMacro("\\DOTSI", "\\relax"); defineMacro("\\DOTSB", "\\relax"); defineMacro("\\DOTSX", "\\relax"); // Spacing, based on amsmath.sty's override of LaTeX defaults // \DeclareRobustCommand{\tmspace}[3]{% // \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); // \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} // TODO: math mode should use \thinmuskip defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); // \let\thinspace\, defineMacro("\\thinspace", "\\,"); // \def\>{\mskip\medmuskip} // \renewcommand{\:}{\tmspace+\medmuskip{.2222em}} // TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu defineMacro("\\>", "\\mskip{4mu}"); defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); // \let\medspace\: defineMacro("\\medspace", "\\:"); // \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} // TODO: math mode should use \thickmuskip = 5mu plus 5mu defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); // \let\thickspace\; defineMacro("\\thickspace", "\\;"); // \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} // TODO: math mode should use \thinmuskip defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); // \let\negthinspace\! defineMacro("\\negthinspace", "\\!"); // \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} // TODO: math mode should use \medmuskip defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); // \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} // TODO: math mode should use \thickmuskip defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); // \def\enspace{\kern.5em } defineMacro("\\enspace", "\\kern.5em "); // \def\enskip{\hskip.5em\relax} defineMacro("\\enskip", "\\hskip.5em\\relax"); // \def\quad{\hskip1em\relax} defineMacro("\\quad", "\\hskip1em\\relax"); // \def\qquad{\hskip2em\relax} defineMacro("\\qquad", "\\hskip2em\\relax"); // \tag@in@display form of \tag defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); defineMacro("\\tag@literal", context => { if (context.macros.get("\\df@tag")) { throw new ParseError("Multiple \\tag"); } return "\\gdef\\df@tag{\\text{#1}}"; }); // \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin // {\operator@font mod}\penalty900 // \mkern5mu\nonscript\mskip-\medmuskip} // \newcommand{\pod}[1]{\allowbreak // \if@display\mkern18mu\else\mkern8mu\fi(#1)} // \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}} // \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu // \else\mkern12mu\fi{\operator@font mod}\,\,#1} // TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"); defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"); defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); // \pmb -- A simulation of bold. // The version in ambsy.sty works by typesetting three copies of the argument // with small offsets. We use two copies. We omit the vertical offset because // of rendering problems that makeVList encounters in Safari. defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); ////////////////////////////////////////////////////////////////////// // LaTeX source2e // \\ defaults to \newline, but changes to \cr within array environment defineMacro("\\\\", "\\newline"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} // TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't // support \@ yet, so that's omitted, and we add \text so that the result // doesn't look funny in math mode. defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + "}{TeX}}"); // \DeclareRobustCommand{\LaTeX}{L\kern-.36em% // {\sbox\z@ T% // \vbox to\ht\z@{\hbox{\check@mathfonts // \fontsize\sf@size\z@ // \math@fontsfalse\selectfont // A}% // \vss}% // }% // \kern-.15em% // \TeX} // This code aligns the top of the A with the T (from the perspective of TeX's // boxes, though visually the A appears to extend above slightly). // We compute the corresponding \raisebox when A is rendered in \normalsize // \scriptstyle, which has a scale factor of 0.7 (see Options.js). const latexRaiseA = metricMap['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * metricMap['Main-Regular']["A".charCodeAt(0)][1] + "em"; defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + `L\\kern-.36em\\raisebox{${latexRaiseA}}{\\scriptstyle A}` + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + `K\\kern-.17em\\raisebox{${latexRaiseA}}{\\scriptstyle A}` + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} // \def\@hspace#1{\hskip #1\relax} // \def\@hspacer#1{\vrule \@width\z@\nobreak // \hskip #1\hskip \z@skip} defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); defineMacro("\\@hspace", "\\hskip #1\\relax"); defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); ////////////////////////////////////////////////////////////////////// // mathtools.sty //\providecommand\ordinarycolon{:} defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}} //TODO(edemaine): Not yet centered. Fix via \raisebox or #726 defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon} defineMacro("\\dblcolon", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + "{\\mathop{\\char\"2237}}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=} defineMacro("\\coloneqq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2254}}"); // ≔ // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=} defineMacro("\\Coloneqq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2237\\char\"3d}}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}} defineMacro("\\coloneq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"3a\\char\"2212}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}} defineMacro("\\Coloneq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"2237\\char\"2212}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon} defineMacro("\\eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2255}}"); // ≕ // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon} defineMacro("\\Eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"3d\\char\"2237}}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon} defineMacro("\\eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2239}}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon} defineMacro("\\Eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"2212\\char\"2237}}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx} defineMacro("\\colonapprox", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"3a\\char\"2248}}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx} defineMacro("\\Colonapprox", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"2237\\char\"2248}}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim} defineMacro("\\colonsim", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"3a\\char\"223c}}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim} defineMacro("\\Colonsim", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"2237\\char\"223c}}"); // Some Unicode characters are implemented with macros to mathtools functions. defineMacro("\u2237", "\\dblcolon"); // :: defineMacro("\u2239", "\\eqcolon"); // -: defineMacro("\u2254", "\\coloneqq"); // := defineMacro("\u2255", "\\eqqcolon"); // =: defineMacro("\u2A74", "\\Coloneqq"); // ::= ////////////////////////////////////////////////////////////////////// // colonequals.sty // Alternate names for mathtools's macros: defineMacro("\\ratio", "\\vcentcolon"); defineMacro("\\coloncolon", "\\dblcolon"); defineMacro("\\colonequals", "\\coloneqq"); defineMacro("\\coloncolonequals", "\\Coloneqq"); defineMacro("\\equalscolon", "\\eqqcolon"); defineMacro("\\equalscoloncolon", "\\Eqqcolon"); defineMacro("\\colonminus", "\\coloneq"); defineMacro("\\coloncolonminus", "\\Coloneq"); defineMacro("\\minuscolon", "\\eqcolon"); defineMacro("\\minuscoloncolon", "\\Eqcolon"); // \colonapprox name is same in mathtools and colonequals. defineMacro("\\coloncolonapprox", "\\Colonapprox"); // \colonsim name is same in mathtools and colonequals. defineMacro("\\coloncolonsim", "\\Colonsim"); // Additional macros, implemented by analogy with mathtools definitions: defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"); defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // Present in newtxmath, pxfonts and txfonts defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); ////////////////////////////////////////////////////////////////////// // MathML alternates for KaTeX glyphs in the Unicode private area defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}"); defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}"); defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}"); defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}"); defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}"); defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}"); defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}"); defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}"); defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}"); defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}"); defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}"); defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}"); defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}"); defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}"); defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}"); defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}"); ////////////////////////////////////////////////////////////////////// // stmaryrd and semantic // The stmaryrd and semantic packages render the next four items by calling a // glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros. defineMacro("\\llbracket", "\\html@mathml{" + "\\mathopen{[\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u27e6}}"); defineMacro("\\rrbracket", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu]}}" + "{\\mathclose{\\char`\u27e7}}"); defineMacro("\u27e6", "\\llbracket"); // blackboard bold [ defineMacro("\u27e7", "\\rrbracket"); // blackboard bold ] defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}"); defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}"); defineMacro("\u2983", "\\lBrace"); // blackboard bold { defineMacro("\u2984", "\\rBrace"); // blackboard bold } // TODO: Create variable sized versions of the last two items. I believe that // will require new font glyphs. // The stmaryrd function `\minuso` provides a "Plimsoll" symbol that // superimposes the characters \circ and \mathminus. Used in chemistry. defineMacro("\\minuso", "\\mathbin{\\html@mathml{" + "{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}" + "{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}" + "{\\char`⦵}}"); defineMacro("⦵", "\\minuso"); ////////////////////////////////////////////////////////////////////// // texvc.sty // The texvc package contains macros available in mediawiki pages. // We omit the functions deprecated at // https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax // We also omit texvc's \O, which conflicts with \text{\O} defineMacro("\\darr", "\\downarrow"); defineMacro("\\dArr", "\\Downarrow"); defineMacro("\\Darr", "\\Downarrow"); defineMacro("\\lang", "\\langle"); defineMacro("\\rang", "\\rangle"); defineMacro("\\uarr", "\\uparrow"); defineMacro("\\uArr", "\\Uparrow"); defineMacro("\\Uarr", "\\Uparrow"); defineMacro("\\N", "\\mathbb{N}"); defineMacro("\\R", "\\mathbb{R}"); defineMacro("\\Z", "\\mathbb{Z}"); defineMacro("\\alef", "\\aleph"); defineMacro("\\alefsym", "\\aleph"); defineMacro("\\Alpha", "\\mathrm{A}"); defineMacro("\\Beta", "\\mathrm{B}"); defineMacro("\\bull", "\\bullet"); defineMacro("\\Chi", "\\mathrm{X}"); defineMacro("\\clubs", "\\clubsuit"); defineMacro("\\cnums", "\\mathbb{C}"); defineMacro("\\Complex", "\\mathbb{C}"); defineMacro("\\Dagger", "\\ddagger"); defineMacro("\\diamonds", "\\diamondsuit"); defineMacro("\\empty", "\\emptyset"); defineMacro("\\Epsilon", "\\mathrm{E}"); defineMacro("\\Eta", "\\mathrm{H}"); defineMacro("\\exist", "\\exists"); defineMacro("\\harr", "\\leftrightarrow"); defineMacro("\\hArr", "\\Leftrightarrow"); defineMacro("\\Harr", "\\Leftrightarrow"); defineMacro("\\hearts", "\\heartsuit"); defineMacro("\\image", "\\Im"); defineMacro("\\infin", "\\infty"); defineMacro("\\Iota", "\\mathrm{I}"); defineMacro("\\isin", "\\in"); defineMacro("\\Kappa", "\\mathrm{K}"); defineMacro("\\larr", "\\leftarrow"); defineMacro("\\lArr", "\\Leftarrow"); defineMacro("\\Larr", "\\Leftarrow"); defineMacro("\\lrarr", "\\leftrightarrow"); defineMacro("\\lrArr", "\\Leftrightarrow"); defineMacro("\\Lrarr", "\\Leftrightarrow"); defineMacro("\\Mu", "\\mathrm{M}"); defineMacro("\\natnums", "\\mathbb{N}"); defineMacro("\\Nu", "\\mathrm{N}"); defineMacro("\\Omicron", "\\mathrm{O}"); defineMacro("\\plusmn", "\\pm"); defineMacro("\\rarr", "\\rightarrow"); defineMacro("\\rArr", "\\Rightarrow"); defineMacro("\\Rarr", "\\Rightarrow"); defineMacro("\\real", "\\Re"); defineMacro("\\reals", "\\mathbb{R}"); defineMacro("\\Reals", "\\mathbb{R}"); defineMacro("\\Rho", "\\mathrm{P}"); defineMacro("\\sdot", "\\cdot"); defineMacro("\\sect", "\\S"); defineMacro("\\spades", "\\spadesuit"); defineMacro("\\sub", "\\subset"); defineMacro("\\sube", "\\subseteq"); defineMacro("\\supe", "\\supseteq"); defineMacro("\\Tau", "\\mathrm{T}"); defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}"); defineMacro("\\weierp", "\\wp"); defineMacro("\\Zeta", "\\mathrm{Z}"); ////////////////////////////////////////////////////////////////////// // statmath.sty // https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}"); defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}"); defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); ////////////////////////////////////////////////////////////////////// // braket.sty // http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); defineMacro("\\Bra", "\\left\\langle#1\\right|"); defineMacro("\\Ket", "\\left|#1\\right\\rangle"); // Custom Khan Academy colors, should be moved to an optional package defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); defineMacro("\\pink", "\\textcolor{##ff00af}{#1}"); defineMacro("\\red", "\\textcolor{##df0030}{#1}"); defineMacro("\\green", "\\textcolor{##28ae7b}{#1}"); defineMacro("\\gray", "\\textcolor{gray}{#1}"); defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}"); defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}"); defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}"); defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}"); defineMacro("\\blueD", "\\textcolor{##11accd}{#1}"); defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}"); defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}"); defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}"); defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}"); defineMacro("\\tealD", "\\textcolor{##01a995}{#1}"); defineMacro("\\tealE", "\\textcolor{##208170}{#1}"); defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}"); defineMacro("\\greenB", "\\textcolor{##8af281}{#1}"); defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}"); defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}"); defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}"); defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}"); defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}"); defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}"); defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}"); defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}"); defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}"); defineMacro("\\redB", "\\textcolor{##ff8482}{#1}"); defineMacro("\\redC", "\\textcolor{##f9685d}{#1}"); defineMacro("\\redD", "\\textcolor{##e84d39}{#1}"); defineMacro("\\redE", "\\textcolor{##bc2612}{#1}"); defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}"); defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}"); defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}"); defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}"); defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}"); defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}"); defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}"); defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}"); defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}"); defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}"); defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}"); defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}"); defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}"); defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}"); defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}"); defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}"); defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}"); defineMacro("\\grayE", "\\textcolor{##babec2}{#1}"); defineMacro("\\grayF", "\\textcolor{##888d93}{#1}"); defineMacro("\\grayG", "\\textcolor{##626569}{#1}"); defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}"); defineMacro("\\grayI", "\\textcolor{##21242c}{#1}"); defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}"); defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); /** * This file contains the “gullet” where macros are expanded * until only non-macro tokens remain. */ // List of commands that act like macros but aren't defined as a macro, // function, or symbol. Used in `isDefined`. const implicitCommands = { "\\relax": true, // MacroExpander.js "^": true, // Parser.js "_": true, // Parser.js "\\limits": true, // Parser.js "\\nolimits": true // Parser.js }; class MacroExpander { constructor(input, settings, mode) { this.settings = void 0; this.expansionCount = void 0; this.lexer = void 0; this.macros = void 0; this.stack = void 0; this.mode = void 0; this.settings = settings; this.expansionCount = 0; this.feed(input); // Make new global namespace this.macros = new Namespace(builtinMacros, settings.macros); this.mode = mode; this.stack = []; // contains tokens in REVERSE order } /** * Feed a new input string to the same MacroExpander * (with existing macros etc.). */ feed(input) { this.lexer = new Lexer(input, this.settings); } /** * Switches between "text" and "math" modes. */ switchMode(newMode) { this.mode = newMode; } /** * Start a new group nesting within all namespaces. */ beginGroup() { this.macros.beginGroup(); } /** * End current group nesting within all namespaces. */ endGroup() { this.macros.endGroup(); } /** * Returns the topmost token on the stack, without expanding it. * Similar in behavior to TeX's `\futurelet`. */ future() { if (this.stack.length === 0) { this.pushToken(this.lexer.lex()); } return this.stack[this.stack.length - 1]; } /** * Remove and return the next unexpanded token. */ popToken() { this.future(); // ensure non-empty stack return this.stack.pop(); } /** * Add a given token to the token stack. In particular, this get be used * to put back a token returned from one of the other methods. */ pushToken(token) { this.stack.push(token); } /** * Append an array of tokens to the token stack. */ pushTokens(tokens) { this.stack.push(...tokens); } /** * Consume all following space tokens, without expansion. */ consumeSpaces() { for (;;) { const token = this.future(); if (token.text === " ") { this.stack.pop(); } else { break; } } } /** * Consume the specified number of arguments from the token stream, * and return the resulting array of arguments. */ consumeArgs(numArgs) { const args = []; // obtain arguments, either single token or balanced {…} group for (let i = 0; i < numArgs; ++i) { this.consumeSpaces(); // ignore spaces before each argument const startOfArg = this.popToken(); if (startOfArg.text === "{") { const arg = []; let depth = 1; while (depth !== 0) { const tok = this.popToken(); arg.push(tok); if (tok.text === "{") { ++depth; } else if (tok.text === "}") { --depth; } else if (tok.text === "EOF") { throw new ParseError("End of input in macro argument", startOfArg); } } arg.pop(); // remove last } arg.reverse(); // like above, to fit in with stack order args[i] = arg; } else if (startOfArg.text === "EOF") { throw new ParseError("End of input expecting macro argument"); } else { args[i] = [startOfArg]; } } return args; } /** * Expand the next token only once if possible. * * If the token is expanded, the resulting tokens will be pushed onto * the stack in reverse order and will be returned as an array, * also in reverse order. * * If not, the next token will be returned without removing it * from the stack. This case can be detected by a `Token` return value * instead of an `Array` return value. * * In either case, the next token will be on the top of the stack, * or the stack will be empty. * * Used to implement `expandAfterFuture` and `expandNextToken`. * * At the moment, macro expansion doesn't handle delimited macros, * i.e. things like those defined by \def\foo#1\end{…}. * See the TeX book page 202ff. for details on how those should behave. * * If expandableOnly, only expandable tokens are expanded and * an undefined control sequence results in an error. */ expandOnce(expandableOnly) { const topToken = this.popToken(); const name = topToken.text; const expansion = !topToken.noexpand ? this._getExpansion(name) : null; if (expansion == null || expandableOnly && expansion.unexpandable) { if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) { throw new ParseError("Undefined control sequence: " + name); } this.pushToken(topToken); return topToken; } this.expansionCount++; if (this.expansionCount > this.settings.maxExpand) { throw new ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting"); } let tokens = expansion.tokens; if (expansion.numArgs) { const args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders tokens = tokens.slice(); // make a shallow copy for (let i = tokens.length - 1; i >= 0; --i) { let tok = tokens[i]; if (tok.text === "#") { if (i === 0) { throw new ParseError("Incomplete placeholder at end of macro body", tok); } tok = tokens[--i]; // next token on stack if (tok.text === "#") { // ## → # tokens.splice(i + 1, 1); // drop first # } else if (/^[1-9]$/.test(tok.text)) { // replace the placeholder with the indicated argument tokens.splice(i, 2, ...args[+tok.text - 1]); } else { throw new ParseError("Not a valid argument number", tok); } } } } // Concatenate expansion onto top of stack. this.pushTokens(tokens); return tokens; } /** * Expand the next token only once (if possible), and return the resulting * top token on the stack (without removing anything from the stack). * Similar in behavior to TeX's `\expandafter\futurelet`. * Equivalent to expandOnce() followed by future(). */ expandAfterFuture() { this.expandOnce(); return this.future(); } /** * Recursively expand first token, then return first non-expandable token. */ expandNextToken() { for (;;) { const expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. if (expanded instanceof Token) { // \relax stops the expansion, but shouldn't get returned (a // null return value couldn't get implemented as a function). // the token after \noexpand is interpreted as if its meaning // were ‘\relax’ if (expanded.text === "\\relax" || expanded.treatAsRelax) { this.stack.pop(); } else { return this.stack.pop(); // === expanded } } } // Flow unable to figure out that this pathway is impossible. // https://github.com/facebook/flow/issues/4808 throw new Error(); // eslint-disable-line no-unreachable } /** * Fully expand the given macro name and return the resulting list of * tokens, or return `undefined` if no such macro is defined. */ expandMacro(name) { return this.macros.has(name) ? this.expandTokens([new Token(name)]) : undefined; } /** * Fully expand the given token stream and return the resulting list of tokens */ expandTokens(tokens) { const output = []; const oldStackLength = this.stack.length; this.pushTokens(tokens); while (this.stack.length > oldStackLength) { const expanded = this.expandOnce(true); // expand only expandable tokens // expandOnce returns Token if and only if it's fully expanded. if (expanded instanceof Token) { if (expanded.treatAsRelax) { // the expansion of \noexpand is the token itself expanded.noexpand = false; expanded.treatAsRelax = false; } output.push(this.stack.pop()); } } return output; } /** * Fully expand the given macro name and return the result as a string, * or return `undefined` if no such macro is defined. */ expandMacroAsText(name) { const tokens = this.expandMacro(name); if (tokens) { return tokens.map(token => token.text).join(""); } else { return tokens; } } /** * Returns the expanded macro as a reversed array of tokens and a macro * argument count. Or returns `null` if no such macro. */ _getExpansion(name) { const definition = this.macros.get(name); if (definition == null) { // mainly checking for undefined here return definition; } const expansion = typeof definition === "function" ? definition(this) : definition; if (typeof expansion === "string") { let numArgs = 0; if (expansion.indexOf("#") !== -1) { const stripped = expansion.replace(/##/g, ""); while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { ++numArgs; } } const bodyLexer = new Lexer(expansion, this.settings); const tokens = []; let tok = bodyLexer.lex(); while (tok.text !== "EOF") { tokens.push(tok); tok = bodyLexer.lex(); } tokens.reverse(); // to fit in with stack using push and pop const expanded = { tokens, numArgs }; return expanded; } return expansion; } /** * Determine whether a command is currently "defined" (has some * functionality), meaning that it's a macro (in the current group), * a function, a symbol, or one of the special commands listed in * `implicitCommands`. */ isDefined(name) { return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name); } /** * Determine whether a command is expandable. */ isExpandable(name) { const macro = this.macros.get(name); return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable // TODO(ylem): #2085 : functions.hasOwnProperty(name) /* && !functions[name].primitive*/ ; } } /* eslint no-constant-condition:0 */ const unicodeAccents = { "́": { "text": "\\'", "math": "\\acute" }, "̀": { "text": "\\`", "math": "\\grave" }, "̈": { "text": "\\\"", "math": "\\ddot" }, "̃": { "text": "\\~", "math": "\\tilde" }, "̄": { "text": "\\=", "math": "\\bar" }, "̆": { "text": "\\u", "math": "\\breve" }, "̌": { "text": "\\v", "math": "\\check" }, "̂": { "text": "\\^", "math": "\\hat" }, "̇": { "text": "\\.", "math": "\\dot" }, "̊": { "text": "\\r", "math": "\\mathring" }, "̋": { "text": "\\H" } }; const unicodeSymbols = { "á": "á", "à": "à", "ä": "ä", "ǟ": "ǟ", "ã": "ã", "ā": "ā", "ă": "ă", "ắ": "ắ", "ằ": "ằ", "ẵ": "ẵ", "ǎ": "ǎ", "â": "â", "ấ": "ấ", "ầ": "ầ", "ẫ": "ẫ", "ȧ": "ȧ", "ǡ": "ǡ", "å": "å", "ǻ": "ǻ", "ḃ": "ḃ", "ć": "ć", "č": "č", "ĉ": "ĉ", "ċ": "ċ", "ď": "ď", "ḋ": "ḋ", "é": "é", "è": "è", "ë": "ë", "ẽ": "ẽ", "ē": "ē", "ḗ": "ḗ", "ḕ": "ḕ", "ĕ": "ĕ", "ě": "ě", "ê": "ê", "ế": "ế", "ề": "ề", "ễ": "ễ", "ė": "ė", "ḟ": "ḟ", "ǵ": "ǵ", "ḡ": "ḡ", "ğ": "ğ", "ǧ": "ǧ", "ĝ": "ĝ", "ġ": "ġ", "ḧ": "ḧ", "ȟ": "ȟ", "ĥ": "ĥ", "ḣ": "ḣ", "í": "í", "ì": "ì", "ï": "ï", "ḯ": "ḯ", "ĩ": "ĩ", "ī": "ī", "ĭ": "ĭ", "ǐ": "ǐ", "î": "î", "ǰ": "ǰ", "ĵ": "ĵ", "ḱ": "ḱ", "ǩ": "ǩ", "ĺ": "ĺ", "ľ": "ľ", "ḿ": "ḿ", "ṁ": "ṁ", "ń": "ń", "ǹ": "ǹ", "ñ": "ñ", "ň": "ň", "ṅ": "ṅ", "ó": "ó", "ò": "ò", "ö": "ö", "ȫ": "ȫ", "õ": "õ", "ṍ": "ṍ", "ṏ": "ṏ", "ȭ": "ȭ", "ō": "ō", "ṓ": "ṓ", "ṑ": "ṑ", "ŏ": "ŏ", "ǒ": "ǒ", "ô": "ô", "ố": "ố", "ồ": "ồ", "ỗ": "ỗ", "ȯ": "ȯ", "ȱ": "ȱ", "ő": "ő", "ṕ": "ṕ", "ṗ": "ṗ", "ŕ": "ŕ", "ř": "ř", "ṙ": "ṙ", "ś": "ś", "ṥ": "ṥ", "š": "š", "ṧ": "ṧ", "ŝ": "ŝ", "ṡ": "ṡ", "ẗ": "ẗ", "ť": "ť", "ṫ": "ṫ", "ú": "ú", "ù": "ù", "ü": "ü", "ǘ": "ǘ", "ǜ": "ǜ", "ǖ": "ǖ", "ǚ": "ǚ", "ũ": "ũ", "ṹ": "ṹ", "ū": "ū", "ṻ": "ṻ", "ŭ": "ŭ", "ǔ": "ǔ", "û": "û", "ů": "ů", "ű": "ű", "ṽ": "ṽ", "ẃ": "ẃ", "ẁ": "ẁ", "ẅ": "ẅ", "ŵ": "ŵ", "ẇ": "ẇ", "ẘ": "ẘ", "ẍ": "ẍ", "ẋ": "ẋ", "ý": "ý", "ỳ": "ỳ", "ÿ": "ÿ", "ỹ": "ỹ", "ȳ": "ȳ", "ŷ": "ŷ", "ẏ": "ẏ", "ẙ": "ẙ", "ź": "ź", "ž": "ž", "ẑ": "ẑ", "ż": "ż", "Á": "Á", "À": "À", "Ä": "Ä", "Ǟ": "Ǟ", "Ã": "Ã", "Ā": "Ā", "Ă": "Ă", "Ắ": "Ắ", "Ằ": "Ằ", "Ẵ": "Ẵ", "Ǎ": "Ǎ", "Â": "Â", "Ấ": "Ấ", "Ầ": "Ầ", "Ẫ": "Ẫ", "Ȧ": "Ȧ", "Ǡ": "Ǡ", "Å": "Å", "Ǻ": "Ǻ", "Ḃ": "Ḃ", "Ć": "Ć", "Č": "Č", "Ĉ": "Ĉ", "Ċ": "Ċ", "Ď": "Ď", "Ḋ": "Ḋ", "É": "É", "È": "È", "Ë": "Ë", "Ẽ": "Ẽ", "Ē": "Ē", "Ḗ": "Ḗ", "Ḕ": "Ḕ", "Ĕ": "Ĕ", "Ě": "Ě", "Ê": "Ê", "Ế": "Ế", "Ề": "Ề", "Ễ": "Ễ", "Ė": "Ė", "Ḟ": "Ḟ", "Ǵ": "Ǵ", "Ḡ": "Ḡ", "Ğ": "Ğ", "Ǧ": "Ǧ", "Ĝ": "Ĝ", "Ġ": "Ġ", "Ḧ": "Ḧ", "Ȟ": "Ȟ", "Ĥ": "Ĥ", "Ḣ": "Ḣ", "Í": "Í", "Ì": "Ì", "Ï": "Ï", "Ḯ": "Ḯ", "Ĩ": "Ĩ", "Ī": "Ī", "Ĭ": "Ĭ", "Ǐ": "Ǐ", "Î": "Î", "İ": "İ", "Ĵ": "Ĵ", "Ḱ": "Ḱ", "Ǩ": "Ǩ", "Ĺ": "Ĺ", "Ľ": "Ľ", "Ḿ": "Ḿ", "Ṁ": "Ṁ", "Ń": "Ń", "Ǹ": "Ǹ", "Ñ": "Ñ", "Ň": "Ň", "Ṅ": "Ṅ", "Ó": "Ó", "Ò": "Ò", "Ö": "Ö", "Ȫ": "Ȫ", "Õ": "Õ", "Ṍ": "Ṍ", "Ṏ": "Ṏ", "Ȭ": "Ȭ", "Ō": "Ō", "Ṓ": "Ṓ", "Ṑ": "Ṑ", "Ŏ": "Ŏ", "Ǒ": "Ǒ", "Ô": "Ô", "Ố": "Ố", "Ồ": "Ồ", "Ỗ": "Ỗ", "Ȯ": "Ȯ", "Ȱ": "Ȱ", "Ő": "Ő", "Ṕ": "Ṕ", "Ṗ": "Ṗ", "Ŕ": "Ŕ", "Ř": "Ř", "Ṙ": "Ṙ", "Ś": "Ś", "Ṥ": "Ṥ", "Š": "Š", "Ṧ": "Ṧ", "Ŝ": "Ŝ", "Ṡ": "Ṡ", "Ť": "Ť", "Ṫ": "Ṫ", "Ú": "Ú", "Ù": "Ù", "Ü": "Ü", "Ǘ": "Ǘ", "Ǜ": "Ǜ", "Ǖ": "Ǖ", "Ǚ": "Ǚ", "Ũ": "Ũ", "Ṹ": "Ṹ", "Ū": "Ū", "Ṻ": "Ṻ", "Ŭ": "Ŭ", "Ǔ": "Ǔ", "Û": "Û", "Ů": "Ů", "Ű": "Ű", "Ṽ": "Ṽ", "Ẃ": "Ẃ", "Ẁ": "Ẁ", "Ẅ": "Ẅ", "Ŵ": "Ŵ", "Ẇ": "Ẇ", "Ẍ": "Ẍ", "Ẋ": "Ẋ", "Ý": "Ý", "Ỳ": "Ỳ", "Ÿ": "Ÿ", "Ỹ": "Ỹ", "Ȳ": "Ȳ", "Ŷ": "Ŷ", "Ẏ": "Ẏ", "Ź": "Ź", "Ž": "Ž", "Ẑ": "Ẑ", "Ż": "Ż", "ά": "ά", "ὰ": "ὰ", "ᾱ": "ᾱ", "ᾰ": "ᾰ", "έ": "έ", "ὲ": "ὲ", "ή": "ή", "ὴ": "ὴ", "ί": "ί", "ὶ": "ὶ", "ϊ": "ϊ", "ΐ": "ΐ", "ῒ": "ῒ", "ῑ": "ῑ", "ῐ": "ῐ", "ό": "ό", "ὸ": "ὸ", "ύ": "ύ", "ὺ": "ὺ", "ϋ": "ϋ", "ΰ": "ΰ", "ῢ": "ῢ", "ῡ": "ῡ", "ῠ": "ῠ", "ώ": "ώ", "ὼ": "ὼ", "Ύ": "Ύ", "Ὺ": "Ὺ", "Ϋ": "Ϋ", "Ῡ": "Ῡ", "Ῠ": "Ῠ", "Ώ": "Ώ", "Ὼ": "Ὼ" }; /** * This file contains the parser used to parse out a TeX expression from the * input. Since TeX isn't context-free, standard parsers don't work particularly * well. * * The strategy of this parser is as such: * * The main functions (the `.parse...` ones) take a position in the current * parse string to parse tokens from. The lexer (found in Lexer.js, stored at * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When * individual tokens are needed at a position, the lexer is called to pull out a * token, which is then used. * * The parser has a property called "mode" indicating the mode that * the parser is currently in. Currently it has to be one of "math" or * "text", which denotes whether the current environment is a math-y * one or a text-y one (e.g. inside \text). Currently, this serves to * limit the functions which can be used in text mode. * * The main functions then return an object which contains the useful data that * was parsed at its given point, and a new position at the end of the parsed * data. The main functions can call each other and continue the parsing by * using the returned position as a new starting point. * * There are also extra `.handle...` functions, which pull out some reused * functionality into self-contained functions. * * The functions return ParseNodes. */ class Parser { constructor(input, settings) { this.mode = void 0; this.gullet = void 0; this.settings = void 0; this.leftrightDepth = void 0; this.nextToken = void 0; // Start in math mode this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a // new lexer (mouth) for this parser (stomach, in the language of TeX) this.gullet = new MacroExpander(input, settings, this.mode); // Store the settings for use in parsing this.settings = settings; // Count leftright depth (for \middle errors) this.leftrightDepth = 0; } /** * Checks a result to make sure it has the right type, and throws an * appropriate error otherwise. */ expect(text, consume) { if (consume === void 0) { consume = true; } if (this.fetch().text !== text) { throw new ParseError(`Expected '${text}', got '${this.fetch().text}'`, this.fetch()); } if (consume) { this.consume(); } } /** * Discards the current lookahead token, considering it consumed. */ consume() { this.nextToken = null; } /** * Return the current lookahead token, or if there isn't one (at the * beginning, or if the previous lookahead token was consume()d), * fetch the next token as the new lookahead token and return it. */ fetch() { if (this.nextToken == null) { this.nextToken = this.gullet.expandNextToken(); } return this.nextToken; } /** * Switches between "text" and "math" modes. */ switchMode(newMode) { this.mode = newMode; this.gullet.switchMode(newMode); } /** * Main parsing function, which parses an entire input. */ parse() { if (!this.settings.globalGroup) { // Create a group namespace for the math expression. // (LaTeX creates a new group for every $...$, $$...$$, \[...\].) this.gullet.beginGroup(); } // Use old \color behavior (same as LaTeX's \textcolor) if requested. // We do this within the group for the math expression, so it doesn't // pollute settings.macros. if (this.settings.colorIsTextColor) { this.gullet.macros.set("\\color", "\\textcolor"); } // Try to parse the input const parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end this.expect("EOF"); // End the group namespace for the expression if (!this.settings.globalGroup) { this.gullet.endGroup(); } return parse; } parseExpression(breakOnInfix, breakOnTokenText) { const body = []; // Keep adding atoms to the body until we can't parse any more atoms (either // we reached the end, a }, or a \right) while (true) { // Ignore spaces in math mode if (this.mode === "math") { this.consumeSpaces(); } const lex = this.fetch(); if (Parser.endOfExpression.indexOf(lex.text) !== -1) { break; } if (breakOnTokenText && lex.text === breakOnTokenText) { break; } if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) { break; } const atom = this.parseAtom(breakOnTokenText); if (!atom) { break; } else if (atom.type === "internal") { continue; } body.push(atom); } if (this.mode === "text") { this.formLigatures(body); } return this.handleInfixNodes(body); } /** * Rewrites infix operators such as \over with corresponding commands such * as \frac. * * There can only be one infix operator per group. If there's more than one * then the expression is ambiguous. This can be resolved by adding {}. */ handleInfixNodes(body) { let overIndex = -1; let funcName; for (let i = 0; i < body.length; i++) { if (body[i].type === "infix") { if (overIndex !== -1) { throw new ParseError("only one infix operator per group", body[i].token); } overIndex = i; funcName = body[i].replaceWith; } } if (overIndex !== -1 && funcName) { let numerNode; let denomNode; const numerBody = body.slice(0, overIndex); const denomBody = body.slice(overIndex + 1); if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { numerNode = numerBody[0]; } else { numerNode = { type: "ordgroup", mode: this.mode, body: numerBody }; } if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { denomNode = denomBody[0]; } else { denomNode = { type: "ordgroup", mode: this.mode, body: denomBody }; } let node; if (funcName === "\\\\abovefrac") { node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []); } else { node = this.callFunction(funcName, [numerNode, denomNode], []); } return [node]; } else { return body; } } // The greediness of a superscript or subscript /** * Handle a subscript or superscript with nice errors. */ handleSupSubscript(name) { const symbolToken = this.fetch(); const symbol = symbolToken.text; this.consume(); const group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS, undefined, undefined, true); // ignore spaces before sup/subscript argument if (!group) { throw new ParseError("Expected group after '" + symbol + "'", symbolToken); } return group; } /** * Converts the textual input of an unsupported command into a text node * contained within a color node whose color is determined by errorColor */ formatUnsupportedCmd(text) { const textordArray = []; for (let i = 0; i < text.length; i++) { textordArray.push({ type: "textord", mode: "text", text: text[i] }); } const textNode = { type: "text", mode: this.mode, body: textordArray }; const colorNode = { type: "color", mode: this.mode, color: this.settings.errorColor, body: [textNode] }; return colorNode; } /** * Parses a group with optional super/subscripts. */ parseAtom(breakOnTokenText) { // The body of an atom is an implicit group, so that things like // \left(x\right)^2 work correctly. const base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts if (this.mode === "text") { return base; } // Note that base may be empty (i.e. null) at this point. let superscript; let subscript; while (true) { // Guaranteed in math mode, so eat any spaces first. this.consumeSpaces(); // Lex the first token const lex = this.fetch(); if (lex.text === "\\limits" || lex.text === "\\nolimits") { // We got a limit control if (base && base.type === "op") { const limits = lex.text === "\\limits"; base.limits = limits; base.alwaysHandleSupSub = true; } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub) { const limits = lex.text === "\\limits"; base.limits = limits; } else { throw new ParseError("Limit controls must follow a math operator", lex); } this.consume(); } else if (lex.text === "^") { // We got a superscript start if (superscript) { throw new ParseError("Double superscript", lex); } superscript = this.handleSupSubscript("superscript"); } else if (lex.text === "_") { // We got a subscript start if (subscript) { throw new ParseError("Double subscript", lex); } subscript = this.handleSupSubscript("subscript"); } else if (lex.text === "'") { // We got a prime if (superscript) { throw new ParseError("Double superscript", lex); } const prime = { type: "textord", mode: this.mode, text: "\\prime" }; // Many primes can be grouped together, so we handle this here const primes = [prime]; this.consume(); // Keep lexing tokens until we get something that's not a prime while (this.fetch().text === "'") { // For each one, add another prime to the list primes.push(prime); this.consume(); } // If there's a superscript following the primes, combine that // superscript in with the primes. if (this.fetch().text === "^") { primes.push(this.handleSupSubscript("superscript")); } // Put everything into an ordgroup as the superscript superscript = { type: "ordgroup", mode: this.mode, body: primes }; } else { // If it wasn't ^, _, or ', stop parsing super/subscripts break; } } // Base must be set if superscript or subscript are set per logic above, // but need to check here for type check to pass. if (superscript || subscript) { // If we got either a superscript or subscript, create a supsub return { type: "supsub", mode: this.mode, base: base, sup: superscript, sub: subscript }; } else { // Otherwise return the original body return base; } } /** * Parses an entire function, including its base and all of its arguments. */ parseFunction(breakOnTokenText, name, // For error reporting. greediness) { const token = this.fetch(); const func = token.text; const funcData = functions[func]; if (!funcData) { return null; } this.consume(); // consume command token if (greediness != null && funcData.greediness <= greediness) { throw new ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token); } else if (this.mode === "text" && !funcData.allowedInText) { throw new ParseError("Can't use function '" + func + "' in text mode", token); } else if (this.mode === "math" && funcData.allowedInMath === false) { throw new ParseError("Can't use function '" + func + "' in math mode", token); } const _this$parseArguments = this.parseArguments(func, funcData), args = _this$parseArguments.args, optArgs = _this$parseArguments.optArgs; return this.callFunction(func, args, optArgs, token, breakOnTokenText); } /** * Call a function handler with a suitable context and arguments. */ callFunction(name, args, optArgs, token, breakOnTokenText) { const context = { funcName: name, parser: this, token, breakOnTokenText }; const func = functions[name]; if (func && func.handler) { return func.handler(context, args, optArgs); } else { throw new ParseError(`No function handler for ${name}`); } } /** * Parses the arguments of a function or environment */ parseArguments(func, // Should look like "\name" or "\begin{name}". funcData) { const totalArgs = funcData.numArgs + funcData.numOptionalArgs; if (totalArgs === 0) { return { args: [], optArgs: [] }; } const baseGreediness = funcData.greediness; const args = []; const optArgs = []; for (let i = 0; i < totalArgs; i++) { const argType = funcData.argTypes && funcData.argTypes[i]; const isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments. As the TeXbook says: // "After you have said ‘\def\row#1#2{...}’, you are allowed to // put spaces between the arguments (e.g., ‘\row x n’), because // TeX doesn’t use single spaces as undelimited arguments." const consumeSpaces = i > 0 && !isOptional || // Also consume leading spaces in math mode, as parseSymbol // won't know what to do with them. This can only happen with // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. // In LaTeX, the \foo's get treated as (blank) arguments. // In KaTeX, for now, both spaces will get consumed. // TODO(edemaine) i === 0 && !isOptional && this.mode === "math"; const arg = this.parseGroupOfType(`argument to '${func}'`, argType, isOptional, baseGreediness, consumeSpaces); if (!arg) { if (isOptional) { optArgs.push(null); continue; } throw new ParseError(`Expected group after '${func}'`, this.fetch()); } (isOptional ? optArgs : args).push(arg); } return { args, optArgs }; } /** * Parses a group when the mode is changing. */ parseGroupOfType(name, type, optional, greediness, consumeSpaces) { switch (type) { case "color": if (consumeSpaces) { this.consumeSpaces(); } return this.parseColorGroup(optional); case "size": if (consumeSpaces) { this.consumeSpaces(); } return this.parseSizeGroup(optional); case "url": return this.parseUrlGroup(optional, consumeSpaces); case "math": case "text": return this.parseGroup(name, optional, greediness, undefined, type, consumeSpaces); case "hbox": { // hbox argument type wraps the argument in the equivalent of // \hbox, which is like \text but switching to \textstyle size. const group = this.parseGroup(name, optional, greediness, undefined, "text", consumeSpaces); if (!group) { return group; } const styledGroup = { type: "styling", mode: group.mode, body: [group], style: "text" // simulate \textstyle }; return styledGroup; } case "raw": { if (consumeSpaces) { this.consumeSpaces(); } if (optional && this.fetch().text === "{") { return null; } const token = this.parseStringGroup("raw", optional, true); if (token) { return { type: "raw", mode: "text", string: token.text }; } else { throw new ParseError("Expected raw group", this.fetch()); } } case "original": case null: case undefined: return this.parseGroup(name, optional, greediness, undefined, undefined, consumeSpaces); default: throw new ParseError("Unknown group type as " + name, this.fetch()); } } /** * Discard any space tokens, fetching the next non-space token. */ consumeSpaces() { while (this.fetch().text === " ") { this.consume(); } } /** * Parses a group, essentially returning the string formed by the * brace-enclosed tokens plus some position information. */ parseStringGroup(modeName, // Used to describe the mode in error messages. optional, raw) { const groupBegin = optional ? "[" : "{"; const groupEnd = optional ? "]" : "}"; const beginToken = this.fetch(); if (beginToken.text !== groupBegin) { if (optional) { return null; } else if (raw && beginToken.text !== "EOF" && /[^{}[\]]/.test(beginToken.text)) { this.consume(); return beginToken; } } const outerMode = this.mode; this.mode = "text"; this.expect(groupBegin); let str = ""; const firstToken = this.fetch(); let nested = 0; // allow nested braces in raw string group let lastToken = firstToken; let nextToken; while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) { switch (nextToken.text) { case "EOF": throw new ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str)); case groupBegin: nested++; break; case groupEnd: nested--; break; } lastToken = nextToken; str += lastToken.text; this.consume(); } this.expect(groupEnd); this.mode = outerMode; return firstToken.range(lastToken, str); } /** * Parses a regex-delimited group: the largest sequence of tokens * whose concatenated strings match `regex`. Returns the string * formed by the tokens plus some position information. */ parseRegexGroup(regex, modeName) { const outerMode = this.mode; this.mode = "text"; const firstToken = this.fetch(); let lastToken = firstToken; let str = ""; let nextToken; while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) { lastToken = nextToken; str += lastToken.text; this.consume(); } if (str === "") { throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); } this.mode = outerMode; return firstToken.range(lastToken, str); } /** * Parses a color description. */ parseColorGroup(optional) { const res = this.parseStringGroup("color", optional); if (!res) { return null; } const match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); if (!match) { throw new ParseError("Invalid color: '" + res.text + "'", res); } let color = match[0]; if (/^[0-9a-f]{6}$/i.test(color)) { // We allow a 6-digit HTML color spec without a leading "#". // This follows the xcolor package's HTML color model. // Predefined color names are all missed by this RegEx pattern. color = "#" + color; } return { type: "color-token", mode: this.mode, color }; } /** * Parses a size specification, consisting of magnitude and unit. */ parseSizeGroup(optional) { let res; let isBlank = false; if (!optional && this.fetch().text !== "{") { res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); } else { res = this.parseStringGroup("size", optional); } if (!res) { return null; } if (!optional && res.text.length === 0) { // Because we've tested for what is !optional, this block won't // affect \kern, \hspace, etc. It will capture the mandatory arguments // to \genfrac and \above. res.text = "0pt"; // Enable \above{} isBlank = true; // This is here specifically for \genfrac } const match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); if (!match) { throw new ParseError("Invalid size: '" + res.text + "'", res); } const data = { number: +(match[1] + match[2]), // sign + magnitude, cast to number unit: match[3] }; if (!validUnit(data)) { throw new ParseError("Invalid unit: '" + data.unit + "'", res); } return { type: "size", mode: this.mode, value: data, isBlank }; } /** * Parses an URL, checking escaped letters and allowed protocols, * and setting the catcode of % as an active character (as in \hyperref). */ parseUrlGroup(optional, consumeSpaces) { this.gullet.lexer.setCatcode("%", 13); // active character const res = this.parseStringGroup("url", optional, true); // get raw string this.gullet.lexer.setCatcode("%", 14); // comment character if (!res) { return null; } // hyperref package allows backslashes alone in href, but doesn't // generate valid links in such cases; we interpret this as // "undefined" behaviour, and keep them as-is. Some browser will // replace backslashes with forward slashes. const url = res.text.replace(/\\([#$%&~_^{}])/g, '$1'); return { type: "url", mode: this.mode, url }; } /** * If `optional` is false or absent, this parses an ordinary group, * which is either a single nucleus (like "x") or an expression * in braces (like "{x+y}") or an implicit group, a group that starts * at the current position, and ends right before a higher explicit * group ends, or at EOF. * If `optional` is true, it parses either a bracket-delimited expression * (like "[x+y]") or returns null to indicate the absence of a * bracket-enclosed group. * If `mode` is present, switches to that mode while parsing the group, * and switches back after. */ parseGroup(name, // For error reporting. optional, greediness, breakOnTokenText, mode, consumeSpaces) { // Switch to specified mode const outerMode = this.mode; if (mode) { this.switchMode(mode); } // Consume spaces if requested, crucially *after* we switch modes, // so that the next non-space token is parsed in the correct mode. if (consumeSpaces) { this.consumeSpaces(); } // Get first token const firstToken = this.fetch(); const text = firstToken.text; let result; // Try to parse an open brace or \begingroup if (optional ? text === "[" : text === "{" || text === "\\begingroup") { this.consume(); const groupEnd = Parser.endOfGroup[text]; // Start a new group namespace this.gullet.beginGroup(); // If we get a brace, parse an expression const expression = this.parseExpression(false, groupEnd); const lastToken = this.fetch(); // Check that we got a matching closing brace this.expect(groupEnd); // End group namespace this.gullet.endGroup(); result = { type: "ordgroup", mode: this.mode, loc: SourceLocation.range(firstToken, lastToken), body: expression, // A group formed by \begingroup...\endgroup is a semi-simple group // which doesn't affect spacing in math mode, i.e., is transparent. // https://tex.stackexchange.com/questions/1930/when-should-one- // use-begingroup-instead-of-bgroup semisimple: text === "\\begingroup" || undefined }; } else if (optional) { // Return nothing for an optional group result = null; } else { // If there exists a function with this name, parse the function. // Otherwise, just return a nucleus result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol(); if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) { if (this.settings.throwOnError) { throw new ParseError("Undefined control sequence: " + text, firstToken); } result = this.formatUnsupportedCmd(text); this.consume(); } } // Switch mode back if (mode) { this.switchMode(outerMode); } return result; } /** * Form ligature-like combinations of characters for text mode. * This includes inputs like "--", "---", "``" and "''". * The result will simply replace multiple textord nodes with a single * character in each value by a single textord node having multiple * characters in its value. The representation is still ASCII source. * The group will be modified in place. */ formLigatures(group) { let n = group.length - 1; for (let i = 0; i < n; ++i) { const a = group[i]; // $FlowFixMe: Not every node type has a `text` property. const v = a.text; if (v === "-" && group[i + 1].text === "-") { if (i + 1 < n && group[i + 2].text === "-") { group.splice(i, 3, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 2]), text: "---" }); n -= 2; } else { group.splice(i, 2, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 1]), text: "--" }); n -= 1; } } if ((v === "'" || v === "`") && group[i + 1].text === v) { group.splice(i, 2, { type: "textord", mode: "text", loc: SourceLocation.range(a, group[i + 1]), text: v + v }); n -= 1; } } } /** * Parse a single symbol out of the string. Here, we handle single character * symbols and special functions like \verb. */ parseSymbol() { const nucleus = this.fetch(); let text = nucleus.text; if (/^\\verb[^a-zA-Z]/.test(text)) { this.consume(); let arg = text.slice(5); const star = arg.charAt(0) === "*"; if (star) { arg = arg.slice(1); } // Lexer's tokenRegex is constructed to always have matching // first/last characters. if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { throw new ParseError(`\\verb assertion failed -- please report what input caused this bug`); } arg = arg.slice(1, -1); // remove first and last char return { type: "verb", mode: "text", body: arg, star }; } // At this point, we should have a symbol, possibly with accents. // First expand any accented base symbol according to unicodeSymbols. if (unicodeSymbols.hasOwnProperty(text[0]) && !symbols[this.mode][text[0]]) { // This behavior is not strict (XeTeX-compatible) in math mode. if (this.settings.strict && this.mode === "math") { this.settings.reportNonstrict("unicodeTextInMathMode", `Accented Unicode text character "${text[0]}" used in ` + `math mode`, nucleus); } text = unicodeSymbols[text[0]] + text.substr(1); } // Strip off any combining characters const match = combiningDiacriticalMarksEndRegex.exec(text); if (match) { text = text.substring(0, match.index); if (text === 'i') { text = '\u0131'; // dotless i, in math and text mode } else if (text === 'j') { text = '\u0237'; // dotless j, in math and text mode } } // Recognize base symbol let symbol; if (symbols[this.mode][text]) { if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) { this.settings.reportNonstrict("unicodeTextInMathMode", `Latin-1/Unicode text character "${text[0]}" used in ` + `math mode`, nucleus); } const group = symbols[this.mode][text].group; const loc = SourceLocation.range(nucleus); let s; if (ATOMS.hasOwnProperty(group)) { // $FlowFixMe const family = group; s = { type: "atom", mode: this.mode, family, loc, text }; } else { // $FlowFixMe s = { type: group, mode: this.mode, loc, text }; } symbol = s; } else if (text.charCodeAt(0) >= 0x80) { // no symbol for e.g. ^ if (this.settings.strict) { if (!supportedCodepoint(text.charCodeAt(0))) { this.settings.reportNonstrict("unknownSymbol", `Unrecognized Unicode character "${text[0]}"` + ` (${text.charCodeAt(0)})`, nucleus); } else if (this.mode === "math") { this.settings.reportNonstrict("unicodeTextInMathMode", `Unicode text character "${text[0]}" used in math mode`, nucleus); } } // All nonmathematical Unicode characters are rendered as if they // are in text mode (wrapped in \text) because that's what it // takes to render them in LaTeX. Setting `mode: this.mode` is // another natural choice (the user requested math mode), but // this makes it more difficult for getCharacterMetrics() to // distinguish Unicode characters without metrics and those for // which we want to simulate the letter M. symbol = { type: "textord", mode: "text", loc: SourceLocation.range(nucleus), text }; } else { return null; // EOF, ^, _, {, }, etc. } this.consume(); // Transform combining characters into accents if (match) { for (let i = 0; i < match[0].length; i++) { const accent = match[0][i]; if (!unicodeAccents[accent]) { throw new ParseError(`Unknown accent ' ${accent}'`, nucleus); } const command = unicodeAccents[accent][this.mode]; if (!command) { throw new ParseError(`Accent ${accent} unsupported in ${this.mode} mode`, nucleus); } symbol = { type: "accent", mode: this.mode, loc: SourceLocation.range(nucleus), label: command, isStretchy: false, isShifty: true, base: symbol }; } } return symbol; } } Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; Parser.endOfGroup = { "[": "]", "{": "}", "\\begingroup": "\\endgroup" /** * Parses an "expression", which is a list of atoms. * * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This * happens when functions have higher precendence han infix * nodes in implicit parses. * * `breakOnTokenText`: The text of the token that the expression should end * with, or `null` if something else should end the * expression. */ }; Parser.SUPSUB_GREEDINESS = 1; /** * Provides a single function for parsing an expression using a Parser * TODO(emily): Remove this */ /** * Parses an expression using a Parser, then returns the parsed result. */ const parseTree = function parseTree(toParse, settings) { if (!(typeof toParse === 'string' || toParse instanceof String)) { throw new TypeError('KaTeX can only parse string typed expression'); } const parser = new Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors delete parser.gullet.macros.current["\\df@tag"]; let tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag. // In this case, we separately parse the tag and wrap the tree. if (parser.gullet.macros.get("\\df@tag")) { if (!settings.displayMode) { throw new ParseError("\\tag works only in display equations"); } parser.gullet.feed("\\df@tag"); tree = [{ type: "tag", mode: "text", body: tree, tag: parser.parse() }]; } return tree; }; /* eslint no-console:0 */ /** * Parse and build an expression, and place that expression in the DOM node * given. */ let render = function render(expression, baseNode, options) { baseNode.textContent = ""; const node = renderToDomTree(expression, options).toNode(); baseNode.appendChild(node); }; // KaTeX's styles don't work properly in quirks mode. Print out an error, and // disable rendering. if (typeof document !== "undefined") { if (document.compatMode !== "CSS1Compat") { typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype."); render = function render() { throw new ParseError("KaTeX doesn't work in quirks mode."); }; } } /** * Parse and build an expression, and return the markup for that. */ const renderToString = function renderToString(expression, options) { const markup = renderToDomTree(expression, options).toMarkup(); return markup; }; /** * Parse an expression and return the parse tree. */ const generateParseTree = function generateParseTree(expression, options) { const settings = new Settings(options); return parseTree(expression, settings); }; /** * If the given error is a KaTeX ParseError and options.throwOnError is false, * renders the invalid LaTeX as a span with hover title giving the KaTeX * error message. Otherwise, simply throws the error. */ const renderError = function renderError(error, expression, options) { if (options.throwOnError || !(error instanceof ParseError)) { throw error; } const node = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]); node.setAttribute("title", error.toString()); node.setAttribute("style", `color:${options.errorColor}`); return node; }; /** * Generates and returns the katex build tree. This is used for advanced * use cases (like rendering to custom output). */ const renderToDomTree = function renderToDomTree(expression, options) { const settings = new Settings(options); try { const tree = parseTree(expression, settings); return buildTree(tree, expression, settings); } catch (error) { return renderError(error, expression, settings); } }; /** * Generates and returns the katex build tree, with just HTML (no MathML). * This is used for advanced use cases (like rendering to custom output). */ const renderToHTMLTree = function renderToHTMLTree(expression, options) { const settings = new Settings(options); try { const tree = parseTree(expression, settings); return buildHTMLTree(tree, expression, settings); } catch (error) { return renderError(error, expression, settings); } }; var katex = { /** * Current KaTeX version */ version: "0.12.0", /** * Renders the given LaTeX into an HTML+MathML combination, and adds * it as a child to the specified DOM node. */ render, /** * Renders the given LaTeX into an HTML+MathML combination string, * for sending to the client. */ renderToString, /** * KaTeX error, usually during parsing. */ ParseError, /** * Parses the given LaTeX into KaTeX's internal parse tree structure, * without rendering to HTML or MathML. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __parse: generateParseTree, /** * Renders the given LaTeX into an HTML+MathML internal DOM tree * representation, without flattening that representation to a string. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __renderToDomTree: renderToDomTree, /** * Renders the given LaTeX into an HTML internal DOM tree representation, * without MathML and without flattening that representation to a string. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __renderToHTMLTree: renderToHTMLTree, /** * extends internal font metrics object with a new object * each key in the new object represents a font name */ __setFontMetrics: setFontMetrics, /** * adds a new symbol to builtin symbols table */ __defineSymbol: defineSymbol, /** * adds a new macro to builtin macro list */ __defineMacro: defineMacro, /** * Expose the dom tree node types, which can be useful for type checking nodes. * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __domTree: { Span, Anchor, SymbolNode, SvgNode, PathNode, LineNode } }; export default katex; ================================================ FILE: source/lib/live2d@1.0.1/waifu-tips.json ================================================ { "waifu": { "console_open_msg": ["哈哈,你打开了控制台,是想要看看我的秘密吗?"], "copy_message": ["你都复制了些什么呀,转载要记得加上出处哦"], "screenshot_message": ["照好了嘛,是不是很可爱呢?"], "hidden_message": ["我们还能再见面的吧…"], "load_rand_textures": ["我还没有其他衣服呢", "我的新衣服好看嘛"], "hour_tips": { "t5-7": ["早上好!一日之计在于晨,美好的一天就要开始了"], "t7-11": ["上午好!工作顺利嘛,不要久坐,多起来走动走动哦!"], "t11-14": ["中午了,工作了一个上午,现在是午餐时间!"], "t14-17": ["午后很容易犯困呢,今天的运动目标完成了吗?"], "t17-19": ["傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~"], "t19-21": ["晚上好,今天过得怎么样?"], "t21-23": ["已经这么晚了呀,早点休息吧,晚安~"], "t23-5": ["你是夜猫子呀?这么晚还不睡觉,明天起的来嘛"], "default": ["嗨~ 快来逗我玩吧!"] }, "referrer_message": { "localhost": ["欢迎阅读『", "』", " - "], "baidu": ["Hello! 来自 百度搜索 的朋友
    你是搜索 ", " 找到的我吗?"], "so": ["Hello! 来自 360搜索 的朋友
    你是搜索 ", " 找到的我吗?"], "google": ["Hello! 来自 谷歌搜索 的朋友
    欢迎阅读『", "』", " - "], "default": ["Hello! 来自 ", " 的朋友"], "none": ["欢迎阅读『", "』", " - "] }, "referrer_hostname": { "blog.nineya.com": ["玖涯博客"], "www.fghrsh.net": ["FGHRSH 的博客"] }, "model_message": { "1": ["来自 Potion Maker 的 Pio 酱 ~"], "2": ["来自 Potion Maker 的 Tia 酱 ~"] }, "hitokoto_api_message": { "lwl12.com": ["这句一言来自 『{source}』", ",是 {creator} 投稿的", "。"], "fghrsh.net": ["这句一言出处是 『{source}』,是 FGHRSH 在 {date} 收藏的!"], "jinrishici.com": ["这句诗词出自 《{title}》,是 {dynasty}诗人 {author} 创作的!"], "hitokoto.cn": ["这句一言来自 『{source}』,是 {creator} 在 hitokoto.cn 投稿的。"] } }, "mouseover": [ { "selector": ".fui-home", "text": ["点击前往首页,想回到上一页可以使用浏览器的后退功能哦"] }, { "selector": ".fui-chat", "text": ["一言一语,一颦一笑。一字一句,一颗赛艇。"] }, { "selector": ".fui-eye", "text": ["嗯··· 要切换 看板娘 吗?"] }, { "selector": ".fui-user", "text": ["喜欢换装 Play 吗?"] }, { "selector": ".fui-photo", "text": ["要拍张纪念照片吗?"] }, { "selector": ".fui-info-circle", "text": ["这里有关于我的信息呢"] }, { "selector": ".fui-cross", "text": ["你不喜欢我了吗..."] }, { "selector": ".has-link-black-ter", "text": ["要看看 {text} 么?"] }, { "selector": ".widget.toc", "text": ["翻页比较麻烦吗,点击可以显示这篇文章的目录呢"] }, { "selector": "#night-nav", "text": ["深夜时要爱护眼睛呀"] }, { "selector": "#comment-wrapper", "text": ["要吐槽些什么呢"] }, { "selector": "#back-to-top", "text": ["回到开始的地方吧"] }, { "selector": ".widget.links", "text": ["想要和我交个朋友吗?"] }, { "selector": ".widget.love", "text": ["你也期待烂漫不渝的爱情嘛?"] }, { "selector": ".widget.music", "text": ["一起来听音乐吧!"] }, { "selector": ".widget.notice", "text": ["看看博主又发了什么公告"] }, { "selector": ".widget.profile", "text": ["该怎么称呼你呢"] }, { "selector": ".widget.recent-comments", "text": ["想要去评论些什么吗?"] }, { "selector": ".widget.recent-posts", "text": ["博主又新发了什么文章"] }, { "selector": ".actions .bullet-screen", "text": ["关闭/开启评论弹幕试试"] }, { "selector": ".pagination-previous", "text": ["去上一页看看吧"] }, { "selector": ".pagination-next", "text": ["去下一页看看吧"] }, { "selector": ".gallery-item", "text": ["点击图片可以放大呢"] }, { "selector": "input[name=keyword]", "text": ["找不到想看的内容?搜索看看吧"] }, { "selector": ".btn-clipboard", "text": ["点击快速复制代码"] }, { "selector": ".waifu #live2d", "text": ["干嘛呢你,快把手拿开", "鼠…鼠标放错地方了!"] } ], "click": [ { "selector": ".waifu #live2d", "text": [ "是…是不小心碰到了吧", "萝莉控是什么呀", "你看到我的小熊了吗", "再摸的话我可要报警了!⌇●﹏●⌇", "110吗,这里有个变态一直在摸我(ó﹏ò。)" ] } ], "seasons": [ { "date": "01/01", "text": ["元旦了呢,新的一年又开始了,今年是{year}年~"] }, { "date": "02/14", "text": ["又是一年情人节,{year}年找到对象了嘛~"] }, { "date": "03/08", "text": ["今天是妇女节!"] }, { "date": "03/12", "text": ["今天是植树节,要保护环境呀"] }, { "date": "04/01", "text": ["悄悄告诉你一个秘密~今天是愚人节,不要被骗了哦~"] }, { "date": "05/01", "text": ["今天是五一劳动节,计划好假期去哪里了吗~"] }, { "date": "06/01", "text": ["儿童节了呢,快活的时光总是短暂,要是永远长不大该多好啊…"] }, { "date": "09/03", "text": ["中国人民抗日战争胜利纪念日,铭记历史、缅怀先烈、珍爱和平、开创未来。"] }, { "date": "09/10", "text": ["教师节,在学校要给老师问声好呀~"] }, { "date": "10/01", "text": ["国庆节,新中国已经成立69年了呢"] }, { "date": "11/05-11/12", "text": ["今年的双十一是和谁一起过的呢~"] }, { "date": "12/20-12/31", "text": ["这几天是圣诞节,主人肯定又去剁手买买买了~"] } ] } ================================================ FILE: source/lib/swiper@8.4.6/swiper-bundle.css ================================================ /** * Swiper 8.4.6 * Most modern mobile touch slider and framework with hardware accelerated transitions * https://swiperjs.com * * Copyright 2014-2023 Vladimir Kharlampidi * * Released under the MIT License * * Released on: January 17, 2023 */ @font-face { font-family: 'swiper-icons'; src: url('data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA'); font-weight: 400; font-style: normal; } :root { --swiper-theme-color: #007aff; } .swiper { margin-left: auto; margin-right: auto; position: relative; overflow: hidden; list-style: none; padding: 0; /* Fix of Webkit flickering */ z-index: 1; } .swiper-vertical > .swiper-wrapper { flex-direction: column; } .swiper-wrapper { position: relative; width: 100%; height: 100%; z-index: 1; display: flex; transition-property: transform; box-sizing: content-box; } .swiper-android .swiper-slide, .swiper-wrapper { transform: translate3d(0px, 0, 0); } .swiper-pointer-events { touch-action: pan-y; } .swiper-pointer-events.swiper-vertical { touch-action: pan-x; } .swiper-slide { flex-shrink: 0; width: 100%; height: 100%; position: relative; transition-property: transform; } .swiper-slide-invisible-blank { visibility: hidden; } /* Auto Height */ .swiper-autoheight, .swiper-autoheight .swiper-slide { height: auto; } .swiper-autoheight .swiper-wrapper { align-items: flex-start; transition-property: transform, height; } .swiper-backface-hidden .swiper-slide { transform: translateZ(0); -webkit-backface-visibility: hidden; backface-visibility: hidden; } /* 3D Effects */ .swiper-3d, .swiper-3d.swiper-css-mode .swiper-wrapper { perspective: 1200px; } .swiper-3d .swiper-wrapper, .swiper-3d .swiper-slide, .swiper-3d .swiper-slide-shadow, .swiper-3d .swiper-slide-shadow-left, .swiper-3d .swiper-slide-shadow-right, .swiper-3d .swiper-slide-shadow-top, .swiper-3d .swiper-slide-shadow-bottom, .swiper-3d .swiper-cube-shadow { transform-style: preserve-3d; } .swiper-3d .swiper-slide-shadow, .swiper-3d .swiper-slide-shadow-left, .swiper-3d .swiper-slide-shadow-right, .swiper-3d .swiper-slide-shadow-top, .swiper-3d .swiper-slide-shadow-bottom { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; } .swiper-3d .swiper-slide-shadow { background: rgba(0, 0, 0, 0.15); } .swiper-3d .swiper-slide-shadow-left { background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); } .swiper-3d .swiper-slide-shadow-right { background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); } .swiper-3d .swiper-slide-shadow-top { background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); } .swiper-3d .swiper-slide-shadow-bottom { background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); } /* CSS Mode */ .swiper-css-mode > .swiper-wrapper { overflow: auto; scrollbar-width: none; /* For Firefox */ -ms-overflow-style: none; /* For Internet Explorer and Edge */ } .swiper-css-mode > .swiper-wrapper::-webkit-scrollbar { display: none; } .swiper-css-mode > .swiper-wrapper > .swiper-slide { scroll-snap-align: start start; } .swiper-horizontal.swiper-css-mode > .swiper-wrapper { scroll-snap-type: x mandatory; } .swiper-vertical.swiper-css-mode > .swiper-wrapper { scroll-snap-type: y mandatory; } .swiper-centered > .swiper-wrapper::before { content: ''; flex-shrink: 0; order: 9999; } .swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child { margin-inline-start: var(--swiper-centered-offset-before); } .swiper-centered.swiper-horizontal > .swiper-wrapper::before { height: 100%; min-height: 1px; width: var(--swiper-centered-offset-after); } .swiper-centered.swiper-vertical > .swiper-wrapper > .swiper-slide:first-child { margin-block-start: var(--swiper-centered-offset-before); } .swiper-centered.swiper-vertical > .swiper-wrapper::before { width: 100%; min-width: 1px; height: var(--swiper-centered-offset-after); } .swiper-centered > .swiper-wrapper > .swiper-slide { scroll-snap-align: center center; scroll-snap-stop: always; } .swiper-virtual .swiper-slide { -webkit-backface-visibility: hidden; transform: translateZ(0); } .swiper-virtual.swiper-css-mode .swiper-wrapper::after { content: ''; position: absolute; left: 0; top: 0; pointer-events: none; } .swiper-virtual.swiper-css-mode.swiper-horizontal .swiper-wrapper::after { height: 1px; width: var(--swiper-virtual-size); } .swiper-virtual.swiper-css-mode.swiper-vertical .swiper-wrapper::after { width: 1px; height: var(--swiper-virtual-size); } :root { --swiper-navigation-size: 44px; /* --swiper-navigation-color: var(--swiper-theme-color); */ } .swiper-button-prev, .swiper-button-next { position: absolute; top: 50%; width: calc(var(--swiper-navigation-size) / 44 * 27); height: var(--swiper-navigation-size); margin-top: calc(0px - (var(--swiper-navigation-size) / 2)); z-index: 10; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--swiper-navigation-color, var(--swiper-theme-color)); } .swiper-button-prev.swiper-button-disabled, .swiper-button-next.swiper-button-disabled { opacity: 0.35; cursor: auto; pointer-events: none; } .swiper-button-prev.swiper-button-hidden, .swiper-button-next.swiper-button-hidden { opacity: 0; cursor: auto; pointer-events: none; } .swiper-navigation-disabled .swiper-button-prev, .swiper-navigation-disabled .swiper-button-next { display: none !important; } .swiper-button-prev:after, .swiper-button-next:after { font-family: swiper-icons; font-size: var(--swiper-navigation-size); text-transform: none !important; letter-spacing: 0; font-variant: initial; line-height: 1; } .swiper-button-prev, .swiper-rtl .swiper-button-next { left: 10px; right: auto; } .swiper-button-prev:after, .swiper-rtl .swiper-button-next:after { content: 'prev'; } .swiper-button-next, .swiper-rtl .swiper-button-prev { right: 10px; left: auto; } .swiper-button-next:after, .swiper-rtl .swiper-button-prev:after { content: 'next'; } .swiper-button-lock { display: none; } :root { /* --swiper-pagination-color: var(--swiper-theme-color); --swiper-pagination-bullet-size: 8px; --swiper-pagination-bullet-width: 8px; --swiper-pagination-bullet-height: 8px; --swiper-pagination-bullet-inactive-color: #000; --swiper-pagination-bullet-inactive-opacity: 0.2; --swiper-pagination-bullet-opacity: 1; --swiper-pagination-bullet-horizontal-gap: 4px; --swiper-pagination-bullet-vertical-gap: 6px; */ } .swiper-pagination { position: absolute; text-align: center; transition: 300ms opacity; transform: translate3d(0, 0, 0); z-index: 10; } .swiper-pagination.swiper-pagination-hidden { opacity: 0; } .swiper-pagination-disabled > .swiper-pagination, .swiper-pagination.swiper-pagination-disabled { display: none !important; } /* Common Styles */ .swiper-pagination-fraction, .swiper-pagination-custom, .swiper-horizontal > .swiper-pagination-bullets, .swiper-pagination-bullets.swiper-pagination-horizontal { bottom: 10px; left: 0; width: 100%; } /* Bullets */ .swiper-pagination-bullets-dynamic { overflow: hidden; font-size: 0; } .swiper-pagination-bullets-dynamic .swiper-pagination-bullet { transform: scale(0.33); position: relative; } .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active { transform: scale(1); } .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main { transform: scale(1); } .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev { transform: scale(0.66); } .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev { transform: scale(0.33); } .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next { transform: scale(0.66); } .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next { transform: scale(0.33); } .swiper-pagination-bullet { width: var(--swiper-pagination-bullet-width, var(--swiper-pagination-bullet-size, 8px)); height: var(--swiper-pagination-bullet-height, var(--swiper-pagination-bullet-size, 8px)); display: inline-block; border-radius: 50%; background: var(--swiper-pagination-bullet-inactive-color, #000); opacity: var(--swiper-pagination-bullet-inactive-opacity, 0.2); } button.swiper-pagination-bullet { border: none; margin: 0; padding: 0; box-shadow: none; -webkit-appearance: none; appearance: none; } .swiper-pagination-clickable .swiper-pagination-bullet { cursor: pointer; } .swiper-pagination-bullet:only-child { display: none !important; } .swiper-pagination-bullet-active { opacity: var(--swiper-pagination-bullet-opacity, 1); background: var(--swiper-pagination-color, var(--swiper-theme-color)); } .swiper-vertical > .swiper-pagination-bullets, .swiper-pagination-vertical.swiper-pagination-bullets { right: 10px; top: 50%; transform: translate3d(0px, -50%, 0); } .swiper-vertical > .swiper-pagination-bullets .swiper-pagination-bullet, .swiper-pagination-vertical.swiper-pagination-bullets .swiper-pagination-bullet { margin: var(--swiper-pagination-bullet-vertical-gap, 6px) 0; display: block; } .swiper-vertical > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic, .swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic { top: 50%; transform: translateY(-50%); width: 8px; } .swiper-vertical > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet, .swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet { display: inline-block; transition: 200ms transform, 200ms top; } .swiper-horizontal > .swiper-pagination-bullets .swiper-pagination-bullet, .swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet { margin: 0 var(--swiper-pagination-bullet-horizontal-gap, 4px); } .swiper-horizontal > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic, .swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic { left: 50%; transform: translateX(-50%); white-space: nowrap; } .swiper-horizontal > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet, .swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet { transition: 200ms transform, 200ms left; } .swiper-horizontal.swiper-rtl > .swiper-pagination-bullets-dynamic .swiper-pagination-bullet { transition: 200ms transform, 200ms right; } /* Progress */ .swiper-pagination-progressbar { background: rgba(0, 0, 0, 0.25); position: absolute; } .swiper-pagination-progressbar .swiper-pagination-progressbar-fill { background: var(--swiper-pagination-color, var(--swiper-theme-color)); position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform: scale(0); transform-origin: left top; } .swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill { transform-origin: right top; } .swiper-horizontal > .swiper-pagination-progressbar, .swiper-pagination-progressbar.swiper-pagination-horizontal, .swiper-vertical > .swiper-pagination-progressbar.swiper-pagination-progressbar-opposite, .swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite { width: 100%; height: 4px; left: 0; top: 0; } .swiper-vertical > .swiper-pagination-progressbar, .swiper-pagination-progressbar.swiper-pagination-vertical, .swiper-horizontal > .swiper-pagination-progressbar.swiper-pagination-progressbar-opposite, .swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite { width: 4px; height: 100%; left: 0; top: 0; } .swiper-pagination-lock { display: none; } /* Scrollbar */ .swiper-scrollbar { border-radius: 10px; position: relative; -ms-touch-action: none; background: rgba(0, 0, 0, 0.1); } .swiper-scrollbar-disabled > .swiper-scrollbar, .swiper-scrollbar.swiper-scrollbar-disabled { display: none !important; } .swiper-horizontal > .swiper-scrollbar, .swiper-scrollbar.swiper-scrollbar-horizontal { position: absolute; left: 1%; bottom: 3px; z-index: 50; height: 5px; width: 98%; } .swiper-vertical > .swiper-scrollbar, .swiper-scrollbar.swiper-scrollbar-vertical { position: absolute; right: 3px; top: 1%; z-index: 50; width: 5px; height: 98%; } .swiper-scrollbar-drag { height: 100%; width: 100%; position: relative; background: rgba(0, 0, 0, 0.5); border-radius: 10px; left: 0; top: 0; } .swiper-scrollbar-cursor-drag { cursor: move; } .swiper-scrollbar-lock { display: none; } .swiper-zoom-container { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; text-align: center; } .swiper-zoom-container > img, .swiper-zoom-container > svg, .swiper-zoom-container > canvas { max-width: 100%; max-height: 100%; object-fit: contain; } .swiper-slide-zoomed { cursor: move; } /* Preloader */ :root { /* --swiper-preloader-color: var(--swiper-theme-color); */ } .swiper-lazy-preloader { width: 42px; height: 42px; position: absolute; left: 50%; top: 50%; margin-left: -21px; margin-top: -21px; z-index: 10; transform-origin: 50%; box-sizing: border-box; border: 4px solid var(--swiper-preloader-color, var(--swiper-theme-color)); border-radius: 50%; border-top-color: transparent; } .swiper:not(.swiper-watch-progress) .swiper-lazy-preloader, .swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader { animation: swiper-preloader-spin 1s infinite linear; } .swiper-lazy-preloader-white { --swiper-preloader-color: #fff; } .swiper-lazy-preloader-black { --swiper-preloader-color: #000; } @keyframes swiper-preloader-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } /* a11y */ .swiper .swiper-notification { position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0; z-index: -1000; } .swiper-free-mode > .swiper-wrapper { transition-timing-function: ease-out; margin: 0 auto; } .swiper-grid > .swiper-wrapper { flex-wrap: wrap; } .swiper-grid-column > .swiper-wrapper { flex-wrap: wrap; flex-direction: column; } .swiper-fade.swiper-free-mode .swiper-slide { transition-timing-function: ease-out; } .swiper-fade .swiper-slide { pointer-events: none; transition-property: opacity; } .swiper-fade .swiper-slide .swiper-slide { pointer-events: none; } .swiper-fade .swiper-slide-active, .swiper-fade .swiper-slide-active .swiper-slide-active { pointer-events: auto; } .swiper-cube { overflow: visible; } .swiper-cube .swiper-slide { pointer-events: none; -webkit-backface-visibility: hidden; backface-visibility: hidden; z-index: 1; visibility: hidden; transform-origin: 0 0; width: 100%; height: 100%; } .swiper-cube .swiper-slide .swiper-slide { pointer-events: none; } .swiper-cube.swiper-rtl .swiper-slide { transform-origin: 100% 0; } .swiper-cube .swiper-slide-active, .swiper-cube .swiper-slide-active .swiper-slide-active { pointer-events: auto; } .swiper-cube .swiper-slide-active, .swiper-cube .swiper-slide-next, .swiper-cube .swiper-slide-prev, .swiper-cube .swiper-slide-next + .swiper-slide { pointer-events: auto; visibility: visible; } .swiper-cube .swiper-slide-shadow-top, .swiper-cube .swiper-slide-shadow-bottom, .swiper-cube .swiper-slide-shadow-left, .swiper-cube .swiper-slide-shadow-right { z-index: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; } .swiper-cube .swiper-cube-shadow { position: absolute; left: 0; bottom: 0px; width: 100%; height: 100%; opacity: 0.6; z-index: 0; } .swiper-cube .swiper-cube-shadow:before { content: ''; background: #000; position: absolute; left: 0; top: 0; bottom: 0; right: 0; filter: blur(50px); } .swiper-flip { overflow: visible; } .swiper-flip .swiper-slide { pointer-events: none; -webkit-backface-visibility: hidden; backface-visibility: hidden; z-index: 1; } .swiper-flip .swiper-slide .swiper-slide { pointer-events: none; } .swiper-flip .swiper-slide-active, .swiper-flip .swiper-slide-active .swiper-slide-active { pointer-events: auto; } .swiper-flip .swiper-slide-shadow-top, .swiper-flip .swiper-slide-shadow-bottom, .swiper-flip .swiper-slide-shadow-left, .swiper-flip .swiper-slide-shadow-right { z-index: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; } .swiper-creative .swiper-slide { -webkit-backface-visibility: hidden; backface-visibility: hidden; overflow: hidden; transition-property: transform, opacity, height; } .swiper-cards { overflow: visible; } .swiper-cards .swiper-slide { transform-origin: center bottom; -webkit-backface-visibility: hidden; backface-visibility: hidden; overflow: hidden; } ================================================ FILE: source/lib/swiper@8.4.6/swiper-bundle.js ================================================ /** * Swiper 8.4.6 * Most modern mobile touch slider and framework with hardware accelerated transitions * https://swiperjs.com * * Copyright 2014-2023 Vladimir Kharlampidi * * Released under the MIT License * * Released on: January 17, 2023 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Swiper = factory()); })(this, (function () { 'use strict'; /** * SSR Window 4.0.2 * Better handling for window object in SSR environment * https://github.com/nolimits4web/ssr-window * * Copyright 2021, Vladimir Kharlampidi * * Licensed under MIT * * Released on: December 13, 2021 */ /* eslint-disable no-param-reassign */ function isObject$1(obj) { return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object; } function extend$1(target, src) { if (target === void 0) { target = {}; } if (src === void 0) { src = {}; } Object.keys(src).forEach(key => { if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) { extend$1(target[key], src[key]); } }); } const ssrDocument = { body: {}, addEventListener() {}, removeEventListener() {}, activeElement: { blur() {}, nodeName: '' }, querySelector() { return null; }, querySelectorAll() { return []; }, getElementById() { return null; }, createEvent() { return { initEvent() {} }; }, createElement() { return { children: [], childNodes: [], style: {}, setAttribute() {}, getElementsByTagName() { return []; } }; }, createElementNS() { return {}; }, importNode() { return null; }, location: { hash: '', host: '', hostname: '', href: '', origin: '', pathname: '', protocol: '', search: '' } }; function getDocument() { const doc = typeof document !== 'undefined' ? document : {}; extend$1(doc, ssrDocument); return doc; } const ssrWindow = { document: ssrDocument, navigator: { userAgent: '' }, location: { hash: '', host: '', hostname: '', href: '', origin: '', pathname: '', protocol: '', search: '' }, history: { replaceState() {}, pushState() {}, go() {}, back() {} }, CustomEvent: function CustomEvent() { return this; }, addEventListener() {}, removeEventListener() {}, getComputedStyle() { return { getPropertyValue() { return ''; } }; }, Image() {}, Date() {}, screen: {}, setTimeout() {}, clearTimeout() {}, matchMedia() { return {}; }, requestAnimationFrame(callback) { if (typeof setTimeout === 'undefined') { callback(); return null; } return setTimeout(callback, 0); }, cancelAnimationFrame(id) { if (typeof setTimeout === 'undefined') { return; } clearTimeout(id); } }; function getWindow() { const win = typeof window !== 'undefined' ? window : {}; extend$1(win, ssrWindow); return win; } /** * Dom7 4.0.4 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API * https://framework7.io/docs/dom7.html * * Copyright 2022, Vladimir Kharlampidi * * Licensed under MIT * * Released on: January 11, 2022 */ /* eslint-disable no-proto */ function makeReactive(obj) { const proto = obj.__proto__; Object.defineProperty(obj, '__proto__', { get() { return proto; }, set(value) { proto.__proto__ = value; } }); } class Dom7 extends Array { constructor(items) { if (typeof items === 'number') { super(items); } else { super(...(items || [])); makeReactive(this); } } } function arrayFlat(arr) { if (arr === void 0) { arr = []; } const res = []; arr.forEach(el => { if (Array.isArray(el)) { res.push(...arrayFlat(el)); } else { res.push(el); } }); return res; } function arrayFilter(arr, callback) { return Array.prototype.filter.call(arr, callback); } function arrayUnique(arr) { const uniqueArray = []; for (let i = 0; i < arr.length; i += 1) { if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]); } return uniqueArray; } function qsa(selector, context) { if (typeof selector !== 'string') { return [selector]; } const a = []; const res = context.querySelectorAll(selector); for (let i = 0; i < res.length; i += 1) { a.push(res[i]); } return a; } function $(selector, context) { const window = getWindow(); const document = getDocument(); let arr = []; if (!context && selector instanceof Dom7) { return selector; } if (!selector) { return new Dom7(arr); } if (typeof selector === 'string') { const html = selector.trim(); if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) { let toCreate = 'div'; if (html.indexOf(' c.split(' '))); this.forEach(el => { el.classList.add(...classNames); }); return this; } function removeClass() { for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { classes[_key2] = arguments[_key2]; } const classNames = arrayFlat(classes.map(c => c.split(' '))); this.forEach(el => { el.classList.remove(...classNames); }); return this; } function toggleClass() { for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { classes[_key3] = arguments[_key3]; } const classNames = arrayFlat(classes.map(c => c.split(' '))); this.forEach(el => { classNames.forEach(className => { el.classList.toggle(className); }); }); } function hasClass() { for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { classes[_key4] = arguments[_key4]; } const classNames = arrayFlat(classes.map(c => c.split(' '))); return arrayFilter(this, el => { return classNames.filter(className => el.classList.contains(className)).length > 0; }).length > 0; } function attr(attrs, value) { if (arguments.length === 1 && typeof attrs === 'string') { // Get attr if (this[0]) return this[0].getAttribute(attrs); return undefined; } // Set attrs for (let i = 0; i < this.length; i += 1) { if (arguments.length === 2) { // String this[i].setAttribute(attrs, value); } else { // Object for (const attrName in attrs) { this[i][attrName] = attrs[attrName]; this[i].setAttribute(attrName, attrs[attrName]); } } } return this; } function removeAttr(attr) { for (let i = 0; i < this.length; i += 1) { this[i].removeAttribute(attr); } return this; } function transform(transform) { for (let i = 0; i < this.length; i += 1) { this[i].style.transform = transform; } return this; } function transition$1(duration) { for (let i = 0; i < this.length; i += 1) { this[i].style.transitionDuration = typeof duration !== 'string' ? `${duration}ms` : duration; } return this; } function on() { for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { args[_key5] = arguments[_key5]; } let [eventType, targetSelector, listener, capture] = args; if (typeof args[1] === 'function') { [eventType, listener, capture] = args; targetSelector = undefined; } if (!capture) capture = false; function handleLiveEvent(e) { const target = e.target; if (!target) return; const eventData = e.target.dom7EventData || []; if (eventData.indexOf(e) < 0) { eventData.unshift(e); } if ($(target).is(targetSelector)) listener.apply(target, eventData);else { const parents = $(target).parents(); // eslint-disable-line for (let k = 0; k < parents.length; k += 1) { if ($(parents[k]).is(targetSelector)) listener.apply(parents[k], eventData); } } } function handleEvent(e) { const eventData = e && e.target ? e.target.dom7EventData || [] : []; if (eventData.indexOf(e) < 0) { eventData.unshift(e); } listener.apply(this, eventData); } const events = eventType.split(' '); let j; for (let i = 0; i < this.length; i += 1) { const el = this[i]; if (!targetSelector) { for (j = 0; j < events.length; j += 1) { const event = events[j]; if (!el.dom7Listeners) el.dom7Listeners = {}; if (!el.dom7Listeners[event]) el.dom7Listeners[event] = []; el.dom7Listeners[event].push({ listener, proxyListener: handleEvent }); el.addEventListener(event, handleEvent, capture); } } else { // Live events for (j = 0; j < events.length; j += 1) { const event = events[j]; if (!el.dom7LiveListeners) el.dom7LiveListeners = {}; if (!el.dom7LiveListeners[event]) el.dom7LiveListeners[event] = []; el.dom7LiveListeners[event].push({ listener, proxyListener: handleLiveEvent }); el.addEventListener(event, handleLiveEvent, capture); } } } return this; } function off() { for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { args[_key6] = arguments[_key6]; } let [eventType, targetSelector, listener, capture] = args; if (typeof args[1] === 'function') { [eventType, listener, capture] = args; targetSelector = undefined; } if (!capture) capture = false; const events = eventType.split(' '); for (let i = 0; i < events.length; i += 1) { const event = events[i]; for (let j = 0; j < this.length; j += 1) { const el = this[j]; let handlers; if (!targetSelector && el.dom7Listeners) { handlers = el.dom7Listeners[event]; } else if (targetSelector && el.dom7LiveListeners) { handlers = el.dom7LiveListeners[event]; } if (handlers && handlers.length) { for (let k = handlers.length - 1; k >= 0; k -= 1) { const handler = handlers[k]; if (listener && handler.listener === listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } else if (!listener) { el.removeEventListener(event, handler.proxyListener, capture); handlers.splice(k, 1); } } } } } return this; } function trigger() { const window = getWindow(); for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { args[_key9] = arguments[_key9]; } const events = args[0].split(' '); const eventData = args[1]; for (let i = 0; i < events.length; i += 1) { const event = events[i]; for (let j = 0; j < this.length; j += 1) { const el = this[j]; if (window.CustomEvent) { const evt = new window.CustomEvent(event, { detail: eventData, bubbles: true, cancelable: true }); el.dom7EventData = args.filter((data, dataIndex) => dataIndex > 0); el.dispatchEvent(evt); el.dom7EventData = []; delete el.dom7EventData; } } } return this; } function transitionEnd$1(callback) { const dom = this; function fireCallBack(e) { if (e.target !== this) return; callback.call(this, e); dom.off('transitionend', fireCallBack); } if (callback) { dom.on('transitionend', fireCallBack); } return this; } function outerWidth(includeMargins) { if (this.length > 0) { if (includeMargins) { const styles = this.styles(); return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left')); } return this[0].offsetWidth; } return null; } function outerHeight(includeMargins) { if (this.length > 0) { if (includeMargins) { const styles = this.styles(); return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom')); } return this[0].offsetHeight; } return null; } function offset() { if (this.length > 0) { const window = getWindow(); const document = getDocument(); const el = this[0]; const box = el.getBoundingClientRect(); const body = document.body; const clientTop = el.clientTop || body.clientTop || 0; const clientLeft = el.clientLeft || body.clientLeft || 0; const scrollTop = el === window ? window.scrollY : el.scrollTop; const scrollLeft = el === window ? window.scrollX : el.scrollLeft; return { top: box.top + scrollTop - clientTop, left: box.left + scrollLeft - clientLeft }; } return null; } function styles() { const window = getWindow(); if (this[0]) return window.getComputedStyle(this[0], null); return {}; } function css(props, value) { const window = getWindow(); let i; if (arguments.length === 1) { if (typeof props === 'string') { // .css('width') if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props); } else { // .css({ width: '100px' }) for (i = 0; i < this.length; i += 1) { for (const prop in props) { this[i].style[prop] = props[prop]; } } return this; } } if (arguments.length === 2 && typeof props === 'string') { // .css('width', '100px') for (i = 0; i < this.length; i += 1) { this[i].style[props] = value; } return this; } return this; } function each(callback) { if (!callback) return this; this.forEach((el, index) => { callback.apply(el, [el, index]); }); return this; } function filter(callback) { const result = arrayFilter(this, callback); return $(result); } function html(html) { if (typeof html === 'undefined') { return this[0] ? this[0].innerHTML : null; } for (let i = 0; i < this.length; i += 1) { this[i].innerHTML = html; } return this; } function text(text) { if (typeof text === 'undefined') { return this[0] ? this[0].textContent.trim() : null; } for (let i = 0; i < this.length; i += 1) { this[i].textContent = text; } return this; } function is(selector) { const window = getWindow(); const document = getDocument(); const el = this[0]; let compareWith; let i; if (!el || typeof selector === 'undefined') return false; if (typeof selector === 'string') { if (el.matches) return el.matches(selector); if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector); if (el.msMatchesSelector) return el.msMatchesSelector(selector); compareWith = $(selector); for (i = 0; i < compareWith.length; i += 1) { if (compareWith[i] === el) return true; } return false; } if (selector === document) { return el === document; } if (selector === window) { return el === window; } if (selector.nodeType || selector instanceof Dom7) { compareWith = selector.nodeType ? [selector] : selector; for (i = 0; i < compareWith.length; i += 1) { if (compareWith[i] === el) return true; } return false; } return false; } function index() { let child = this[0]; let i; if (child) { i = 0; // eslint-disable-next-line while ((child = child.previousSibling) !== null) { if (child.nodeType === 1) i += 1; } return i; } return undefined; } function eq(index) { if (typeof index === 'undefined') return this; const length = this.length; if (index > length - 1) { return $([]); } if (index < 0) { const returnIndex = length + index; if (returnIndex < 0) return $([]); return $([this[returnIndex]]); } return $([this[index]]); } function append() { let newChild; const document = getDocument(); for (let k = 0; k < arguments.length; k += 1) { newChild = k < 0 || arguments.length <= k ? undefined : arguments[k]; for (let i = 0; i < this.length; i += 1) { if (typeof newChild === 'string') { const tempDiv = document.createElement('div'); tempDiv.innerHTML = newChild; while (tempDiv.firstChild) { this[i].appendChild(tempDiv.firstChild); } } else if (newChild instanceof Dom7) { for (let j = 0; j < newChild.length; j += 1) { this[i].appendChild(newChild[j]); } } else { this[i].appendChild(newChild); } } } return this; } function prepend(newChild) { const document = getDocument(); let i; let j; for (i = 0; i < this.length; i += 1) { if (typeof newChild === 'string') { const tempDiv = document.createElement('div'); tempDiv.innerHTML = newChild; for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) { this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]); } } else if (newChild instanceof Dom7) { for (j = 0; j < newChild.length; j += 1) { this[i].insertBefore(newChild[j], this[i].childNodes[0]); } } else { this[i].insertBefore(newChild, this[i].childNodes[0]); } } return this; } function next(selector) { if (this.length > 0) { if (selector) { if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) { return $([this[0].nextElementSibling]); } return $([]); } if (this[0].nextElementSibling) return $([this[0].nextElementSibling]); return $([]); } return $([]); } function nextAll(selector) { const nextEls = []; let el = this[0]; if (!el) return $([]); while (el.nextElementSibling) { const next = el.nextElementSibling; // eslint-disable-line if (selector) { if ($(next).is(selector)) nextEls.push(next); } else nextEls.push(next); el = next; } return $(nextEls); } function prev(selector) { if (this.length > 0) { const el = this[0]; if (selector) { if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) { return $([el.previousElementSibling]); } return $([]); } if (el.previousElementSibling) return $([el.previousElementSibling]); return $([]); } return $([]); } function prevAll(selector) { const prevEls = []; let el = this[0]; if (!el) return $([]); while (el.previousElementSibling) { const prev = el.previousElementSibling; // eslint-disable-line if (selector) { if ($(prev).is(selector)) prevEls.push(prev); } else prevEls.push(prev); el = prev; } return $(prevEls); } function parent(selector) { const parents = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { if (this[i].parentNode !== null) { if (selector) { if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode); } else { parents.push(this[i].parentNode); } } } return $(parents); } function parents(selector) { const parents = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { let parent = this[i].parentNode; // eslint-disable-line while (parent) { if (selector) { if ($(parent).is(selector)) parents.push(parent); } else { parents.push(parent); } parent = parent.parentNode; } } return $(parents); } function closest(selector) { let closest = this; // eslint-disable-line if (typeof selector === 'undefined') { return $([]); } if (!closest.is(selector)) { closest = closest.parents(selector).eq(0); } return closest; } function find(selector) { const foundElements = []; for (let i = 0; i < this.length; i += 1) { const found = this[i].querySelectorAll(selector); for (let j = 0; j < found.length; j += 1) { foundElements.push(found[j]); } } return $(foundElements); } function children(selector) { const children = []; // eslint-disable-line for (let i = 0; i < this.length; i += 1) { const childNodes = this[i].children; for (let j = 0; j < childNodes.length; j += 1) { if (!selector || $(childNodes[j]).is(selector)) { children.push(childNodes[j]); } } } return $(children); } function remove() { for (let i = 0; i < this.length; i += 1) { if (this[i].parentNode) this[i].parentNode.removeChild(this[i]); } return this; } const Methods = { addClass, removeClass, hasClass, toggleClass, attr, removeAttr, transform, transition: transition$1, on, off, trigger, transitionEnd: transitionEnd$1, outerWidth, outerHeight, styles, offset, css, each, html, text, is, index, eq, append, prepend, next, nextAll, prev, prevAll, parent, parents, closest, find, children, filter, remove }; Object.keys(Methods).forEach(methodName => { Object.defineProperty($.fn, methodName, { value: Methods[methodName], writable: true }); }); function deleteProps(obj) { const object = obj; Object.keys(object).forEach(key => { try { object[key] = null; } catch (e) {// no getter for object } try { delete object[key]; } catch (e) {// something got wrong } }); } function nextTick(callback, delay) { if (delay === void 0) { delay = 0; } return setTimeout(callback, delay); } function now() { return Date.now(); } function getComputedStyle$1(el) { const window = getWindow(); let style; if (window.getComputedStyle) { style = window.getComputedStyle(el, null); } if (!style && el.currentStyle) { style = el.currentStyle; } if (!style) { style = el.style; } return style; } function getTranslate(el, axis) { if (axis === void 0) { axis = 'x'; } const window = getWindow(); let matrix; let curTransform; let transformMatrix; const curStyle = getComputedStyle$1(el); if (window.WebKitCSSMatrix) { curTransform = curStyle.transform || curStyle.webkitTransform; if (curTransform.split(',').length > 6) { curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); } // Some old versions of Webkit choke when 'none' is passed; pass // empty string instead in this case transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); } else { transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); matrix = transformMatrix.toString().split(','); } if (axis === 'x') { // Latest Chrome and webkits Fix if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers else curTransform = parseFloat(matrix[4]); } if (axis === 'y') { // Latest Chrome and webkits Fix if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers else curTransform = parseFloat(matrix[5]); } return curTransform || 0; } function isObject(o) { return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; } function isNode(node) { // eslint-disable-next-line if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { return node instanceof HTMLElement; } return node && (node.nodeType === 1 || node.nodeType === 11); } function extend() { const to = Object(arguments.length <= 0 ? undefined : arguments[0]); const noExtend = ['__proto__', 'constructor', 'prototype']; for (let i = 1; i < arguments.length; i += 1) { const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i]; if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0); for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { const nextKey = keysArray[nextIndex]; const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); if (desc !== undefined && desc.enumerable) { if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { if (nextSource[nextKey].__swiper__) { to[nextKey] = nextSource[nextKey]; } else { extend(to[nextKey], nextSource[nextKey]); } } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { to[nextKey] = {}; if (nextSource[nextKey].__swiper__) { to[nextKey] = nextSource[nextKey]; } else { extend(to[nextKey], nextSource[nextKey]); } } else { to[nextKey] = nextSource[nextKey]; } } } } } return to; } function setCSSProperty(el, varName, varValue) { el.style.setProperty(varName, varValue); } function animateCSSModeScroll(_ref) { let { swiper, targetPosition, side } = _ref; const window = getWindow(); const startPosition = -swiper.translate; let startTime = null; let time; const duration = swiper.params.speed; swiper.wrapperEl.style.scrollSnapType = 'none'; window.cancelAnimationFrame(swiper.cssModeFrameID); const dir = targetPosition > startPosition ? 'next' : 'prev'; const isOutOfBound = (current, target) => { return dir === 'next' && current >= target || dir === 'prev' && current <= target; }; const animate = () => { time = new Date().getTime(); if (startTime === null) { startTime = time; } const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2; let currentPosition = startPosition + easeProgress * (targetPosition - startPosition); if (isOutOfBound(currentPosition, targetPosition)) { currentPosition = targetPosition; } swiper.wrapperEl.scrollTo({ [side]: currentPosition }); if (isOutOfBound(currentPosition, targetPosition)) { swiper.wrapperEl.style.overflow = 'hidden'; swiper.wrapperEl.style.scrollSnapType = ''; setTimeout(() => { swiper.wrapperEl.style.overflow = ''; swiper.wrapperEl.scrollTo({ [side]: currentPosition }); }); window.cancelAnimationFrame(swiper.cssModeFrameID); return; } swiper.cssModeFrameID = window.requestAnimationFrame(animate); }; animate(); } let support; function calcSupport() { const window = getWindow(); const document = getDocument(); return { smoothScroll: document.documentElement && 'scrollBehavior' in document.documentElement.style, touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch), passiveListener: function checkPassiveListener() { let supportsPassive = false; try { const opts = Object.defineProperty({}, 'passive', { // eslint-disable-next-line get() { supportsPassive = true; } }); window.addEventListener('testPassiveListener', null, opts); } catch (e) {// No support } return supportsPassive; }(), gestures: function checkGestures() { return 'ongesturestart' in window; }() }; } function getSupport() { if (!support) { support = calcSupport(); } return support; } let deviceCached; function calcDevice(_temp) { let { userAgent } = _temp === void 0 ? {} : _temp; const support = getSupport(); const window = getWindow(); const platform = window.navigator.platform; const ua = userAgent || window.navigator.userAgent; const device = { ios: false, android: false }; const screenWidth = window.screen.width; const screenHeight = window.screen.height; const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line let ipad = ua.match(/(iPad).*OS\s([\d_]+)/); const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); const windows = platform === 'Win32'; let macos = platform === 'MacIntel'; // iPadOs 13 fix const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) { ipad = ua.match(/(Version)\/([\d.]+)/); if (!ipad) ipad = [0, 1, '13_0_0']; macos = false; } // Android if (android && !windows) { device.os = 'android'; device.android = true; } if (ipad || iphone || ipod) { device.os = 'ios'; device.ios = true; } // Export object return device; } function getDevice(overrides) { if (overrides === void 0) { overrides = {}; } if (!deviceCached) { deviceCached = calcDevice(overrides); } return deviceCached; } let browser; function calcBrowser() { const window = getWindow(); function isSafari() { const ua = window.navigator.userAgent.toLowerCase(); return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; } return { isSafari: isSafari(), isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent) }; } function getBrowser() { if (!browser) { browser = calcBrowser(); } return browser; } function Resize(_ref) { let { swiper, on, emit } = _ref; const window = getWindow(); let observer = null; let animationFrame = null; const resizeHandler = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; emit('beforeResize'); emit('resize'); }; const createObserver = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; observer = new ResizeObserver(entries => { animationFrame = window.requestAnimationFrame(() => { const { width, height } = swiper; let newWidth = width; let newHeight = height; entries.forEach(_ref2 => { let { contentBoxSize, contentRect, target } = _ref2; if (target && target !== swiper.el) return; newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; }); if (newWidth !== width || newHeight !== height) { resizeHandler(); } }); }); observer.observe(swiper.el); }; const removeObserver = () => { if (animationFrame) { window.cancelAnimationFrame(animationFrame); } if (observer && observer.unobserve && swiper.el) { observer.unobserve(swiper.el); observer = null; } }; const orientationChangeHandler = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; emit('orientationchange'); }; on('init', () => { if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { createObserver(); return; } window.addEventListener('resize', resizeHandler); window.addEventListener('orientationchange', orientationChangeHandler); }); on('destroy', () => { removeObserver(); window.removeEventListener('resize', resizeHandler); window.removeEventListener('orientationchange', orientationChangeHandler); }); } function Observer(_ref) { let { swiper, extendParams, on, emit } = _ref; const observers = []; const window = getWindow(); const attach = function (target, options) { if (options === void 0) { options = {}; } const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; const observer = new ObserverFunc(mutations => { // The observerUpdate event should only be triggered // once despite the number of mutations. Additional // triggers are redundant and are very costly if (mutations.length === 1) { emit('observerUpdate', mutations[0]); return; } const observerUpdate = function observerUpdate() { emit('observerUpdate', mutations[0]); }; if (window.requestAnimationFrame) { window.requestAnimationFrame(observerUpdate); } else { window.setTimeout(observerUpdate, 0); } }); observer.observe(target, { attributes: typeof options.attributes === 'undefined' ? true : options.attributes, childList: typeof options.childList === 'undefined' ? true : options.childList, characterData: typeof options.characterData === 'undefined' ? true : options.characterData }); observers.push(observer); }; const init = () => { if (!swiper.params.observer) return; if (swiper.params.observeParents) { const containerParents = swiper.$el.parents(); for (let i = 0; i < containerParents.length; i += 1) { attach(containerParents[i]); } } // Observe container attach(swiper.$el[0], { childList: swiper.params.observeSlideChildren }); // Observe wrapper attach(swiper.$wrapperEl[0], { attributes: false }); }; const destroy = () => { observers.forEach(observer => { observer.disconnect(); }); observers.splice(0, observers.length); }; extendParams({ observer: false, observeParents: false, observeSlideChildren: false }); on('init', init); on('destroy', destroy); } /* eslint-disable no-underscore-dangle */ var eventsEmitter = { on(events, handler, priority) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (typeof handler !== 'function') return self; const method = priority ? 'unshift' : 'push'; events.split(' ').forEach(event => { if (!self.eventsListeners[event]) self.eventsListeners[event] = []; self.eventsListeners[event][method](handler); }); return self; }, once(events, handler, priority) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (typeof handler !== 'function') return self; function onceHandler() { self.off(events, onceHandler); if (onceHandler.__emitterProxy) { delete onceHandler.__emitterProxy; } for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } handler.apply(self, args); } onceHandler.__emitterProxy = handler; return self.on(events, onceHandler, priority); }, onAny(handler, priority) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (typeof handler !== 'function') return self; const method = priority ? 'unshift' : 'push'; if (self.eventsAnyListeners.indexOf(handler) < 0) { self.eventsAnyListeners[method](handler); } return self; }, offAny(handler) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (!self.eventsAnyListeners) return self; const index = self.eventsAnyListeners.indexOf(handler); if (index >= 0) { self.eventsAnyListeners.splice(index, 1); } return self; }, off(events, handler) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (!self.eventsListeners) return self; events.split(' ').forEach(event => { if (typeof handler === 'undefined') { self.eventsListeners[event] = []; } else if (self.eventsListeners[event]) { self.eventsListeners[event].forEach((eventHandler, index) => { if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { self.eventsListeners[event].splice(index, 1); } }); } }); return self; }, emit() { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (!self.eventsListeners) return self; let events; let data; let context; for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } if (typeof args[0] === 'string' || Array.isArray(args[0])) { events = args[0]; data = args.slice(1, args.length); context = self; } else { events = args[0].events; data = args[0].data; context = args[0].context || self; } data.unshift(context); const eventsArray = Array.isArray(events) ? events : events.split(' '); eventsArray.forEach(event => { if (self.eventsAnyListeners && self.eventsAnyListeners.length) { self.eventsAnyListeners.forEach(eventHandler => { eventHandler.apply(context, [event, ...data]); }); } if (self.eventsListeners && self.eventsListeners[event]) { self.eventsListeners[event].forEach(eventHandler => { eventHandler.apply(context, data); }); } }); return self; } }; function updateSize() { const swiper = this; let width; let height; const $el = swiper.$el; if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { width = swiper.params.width; } else { width = $el[0].clientWidth; } if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { height = swiper.params.height; } else { height = $el[0].clientHeight; } if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { return; } // Subtract paddings width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10); height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10); if (Number.isNaN(width)) width = 0; if (Number.isNaN(height)) height = 0; Object.assign(swiper, { width, height, size: swiper.isHorizontal() ? width : height }); } function updateSlides() { const swiper = this; function getDirectionLabel(property) { if (swiper.isHorizontal()) { return property; } // prettier-ignore return { 'width': 'height', 'margin-top': 'margin-left', 'margin-bottom ': 'margin-right', 'margin-left': 'margin-top', 'margin-right': 'margin-bottom', 'padding-left': 'padding-top', 'padding-right': 'padding-bottom', 'marginRight': 'marginBottom' }[property]; } function getDirectionPropertyValue(node, label) { return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0); } const params = swiper.params; const { $wrapperEl, size: swiperSize, rtlTranslate: rtl, wrongRTL } = swiper; const isVirtual = swiper.virtual && params.virtual.enabled; const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; const slides = $wrapperEl.children(`.${swiper.params.slideClass}`); const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; let snapGrid = []; const slidesGrid = []; const slidesSizesGrid = []; let offsetBefore = params.slidesOffsetBefore; if (typeof offsetBefore === 'function') { offsetBefore = params.slidesOffsetBefore.call(swiper); } let offsetAfter = params.slidesOffsetAfter; if (typeof offsetAfter === 'function') { offsetAfter = params.slidesOffsetAfter.call(swiper); } const previousSnapGridLength = swiper.snapGrid.length; const previousSlidesGridLength = swiper.slidesGrid.length; let spaceBetween = params.spaceBetween; let slidePosition = -offsetBefore; let prevSlideSize = 0; let index = 0; if (typeof swiperSize === 'undefined') { return; } if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; } swiper.virtualSize = -spaceBetween; // reset margins if (rtl) slides.css({ marginLeft: '', marginBottom: '', marginTop: '' });else slides.css({ marginRight: '', marginBottom: '', marginTop: '' }); // reset cssMode offsets if (params.centeredSlides && params.cssMode) { setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', ''); setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', ''); } const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; if (gridEnabled) { swiper.grid.initSlides(slidesLength); } // Calc slides let slideSize; const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => { return typeof params.breakpoints[key].slidesPerView !== 'undefined'; }).length > 0; for (let i = 0; i < slidesLength; i += 1) { slideSize = 0; const slide = slides.eq(i); if (gridEnabled) { swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel); } if (slide.css('display') === 'none') continue; // eslint-disable-line if (params.slidesPerView === 'auto') { if (shouldResetSlideSize) { slides[i].style[getDirectionLabel('width')] = ``; } const slideStyles = getComputedStyle(slide[0]); const currentTransform = slide[0].style.transform; const currentWebKitTransform = slide[0].style.webkitTransform; if (currentTransform) { slide[0].style.transform = 'none'; } if (currentWebKitTransform) { slide[0].style.webkitTransform = 'none'; } if (params.roundLengths) { slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true); } else { // eslint-disable-next-line const width = getDirectionPropertyValue(slideStyles, 'width'); const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); const boxSizing = slideStyles.getPropertyValue('box-sizing'); if (boxSizing && boxSizing === 'border-box') { slideSize = width + marginLeft + marginRight; } else { const { clientWidth, offsetWidth } = slide[0]; slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); } } if (currentTransform) { slide[0].style.transform = currentTransform; } if (currentWebKitTransform) { slide[0].style.webkitTransform = currentWebKitTransform; } if (params.roundLengths) slideSize = Math.floor(slideSize); } else { slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; if (params.roundLengths) slideSize = Math.floor(slideSize); if (slides[i]) { slides[i].style[getDirectionLabel('width')] = `${slideSize}px`; } } if (slides[i]) { slides[i].swiperSlideSize = slideSize; } slidesSizesGrid.push(slideSize); if (params.centeredSlides) { slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; if (params.roundLengths) slidePosition = Math.floor(slidePosition); if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); slidesGrid.push(slidePosition); } else { if (params.roundLengths) slidePosition = Math.floor(slidePosition); if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); slidesGrid.push(slidePosition); slidePosition = slidePosition + slideSize + spaceBetween; } swiper.virtualSize += slideSize + spaceBetween; prevSlideSize = slideSize; index += 1; } swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { $wrapperEl.css({ width: `${swiper.virtualSize + params.spaceBetween}px` }); } if (params.setWrapperSize) { $wrapperEl.css({ [getDirectionLabel('width')]: `${swiper.virtualSize + params.spaceBetween}px` }); } if (gridEnabled) { swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel); } // Remove last grid elements depending on width if (!params.centeredSlides) { const newSlidesGrid = []; for (let i = 0; i < snapGrid.length; i += 1) { let slidesGridItem = snapGrid[i]; if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); if (snapGrid[i] <= swiper.virtualSize - swiperSize) { newSlidesGrid.push(slidesGridItem); } } snapGrid = newSlidesGrid; if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { snapGrid.push(swiper.virtualSize - swiperSize); } } if (snapGrid.length === 0) snapGrid = [0]; if (params.spaceBetween !== 0) { const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight'); slides.filter((_, slideIndex) => { if (!params.cssMode) return true; if (slideIndex === slides.length - 1) { return false; } return true; }).css({ [key]: `${spaceBetween}px` }); } if (params.centeredSlides && params.centeredSlidesBounds) { let allSlidesSize = 0; slidesSizesGrid.forEach(slideSizeValue => { allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); }); allSlidesSize -= params.spaceBetween; const maxSnap = allSlidesSize - swiperSize; snapGrid = snapGrid.map(snap => { if (snap < 0) return -offsetBefore; if (snap > maxSnap) return maxSnap + offsetAfter; return snap; }); } if (params.centerInsufficientSlides) { let allSlidesSize = 0; slidesSizesGrid.forEach(slideSizeValue => { allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); }); allSlidesSize -= params.spaceBetween; if (allSlidesSize < swiperSize) { const allSlidesOffset = (swiperSize - allSlidesSize) / 2; snapGrid.forEach((snap, snapIndex) => { snapGrid[snapIndex] = snap - allSlidesOffset; }); slidesGrid.forEach((snap, snapIndex) => { slidesGrid[snapIndex] = snap + allSlidesOffset; }); } } Object.assign(swiper, { slides, snapGrid, slidesGrid, slidesSizesGrid }); if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`); setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); const addToSnapGrid = -swiper.snapGrid[0]; const addToSlidesGrid = -swiper.slidesGrid[0]; swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid); swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid); } if (slidesLength !== previousSlidesLength) { swiper.emit('slidesLengthChange'); } if (snapGrid.length !== previousSnapGridLength) { if (swiper.params.watchOverflow) swiper.checkOverflow(); swiper.emit('snapGridLengthChange'); } if (slidesGrid.length !== previousSlidesGridLength) { swiper.emit('slidesGridLengthChange'); } if (params.watchSlidesProgress) { swiper.updateSlidesOffset(); } if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) { const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`; const hasClassBackfaceClassAdded = swiper.$el.hasClass(backFaceHiddenClass); if (slidesLength <= params.maxBackfaceHiddenSlides) { if (!hasClassBackfaceClassAdded) swiper.$el.addClass(backFaceHiddenClass); } else if (hasClassBackfaceClassAdded) { swiper.$el.removeClass(backFaceHiddenClass); } } } function updateAutoHeight(speed) { const swiper = this; const activeSlides = []; const isVirtual = swiper.virtual && swiper.params.virtual.enabled; let newHeight = 0; let i; if (typeof speed === 'number') { swiper.setTransition(speed); } else if (speed === true) { swiper.setTransition(swiper.params.speed); } const getSlideByIndex = index => { if (isVirtual) { return swiper.slides.filter(el => parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index)[0]; } return swiper.slides.eq(index)[0]; }; // Find slides currently in view if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { if (swiper.params.centeredSlides) { (swiper.visibleSlides || $([])).each(slide => { activeSlides.push(slide); }); } else { for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { const index = swiper.activeIndex + i; if (index > swiper.slides.length && !isVirtual) break; activeSlides.push(getSlideByIndex(index)); } } } else { activeSlides.push(getSlideByIndex(swiper.activeIndex)); } // Find new height from highest slide in view for (i = 0; i < activeSlides.length; i += 1) { if (typeof activeSlides[i] !== 'undefined') { const height = activeSlides[i].offsetHeight; newHeight = height > newHeight ? height : newHeight; } } // Update Height if (newHeight || newHeight === 0) swiper.$wrapperEl.css('height', `${newHeight}px`); } function updateSlidesOffset() { const swiper = this; const slides = swiper.slides; for (let i = 0; i < slides.length; i += 1) { slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop; } } function updateSlidesProgress(translate) { if (translate === void 0) { translate = this && this.translate || 0; } const swiper = this; const params = swiper.params; const { slides, rtlTranslate: rtl, snapGrid } = swiper; if (slides.length === 0) return; if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); let offsetCenter = -translate; if (rtl) offsetCenter = translate; // Visible Slides slides.removeClass(params.slideVisibleClass); swiper.visibleSlidesIndexes = []; swiper.visibleSlides = []; for (let i = 0; i < slides.length; i += 1) { const slide = slides[i]; let slideOffset = slide.swiperSlideOffset; if (params.cssMode && params.centeredSlides) { slideOffset -= slides[0].swiperSlideOffset; } const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween); const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween); const slideBefore = -(offsetCenter - slideOffset); const slideAfter = slideBefore + swiper.slidesSizesGrid[i]; const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; if (isVisible) { swiper.visibleSlides.push(slide); swiper.visibleSlidesIndexes.push(i); slides.eq(i).addClass(params.slideVisibleClass); } slide.progress = rtl ? -slideProgress : slideProgress; slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; } swiper.visibleSlides = $(swiper.visibleSlides); } function updateProgress(translate) { const swiper = this; if (typeof translate === 'undefined') { const multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line translate = swiper && swiper.translate && swiper.translate * multiplier || 0; } const params = swiper.params; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); let { progress, isBeginning, isEnd } = swiper; const wasBeginning = isBeginning; const wasEnd = isEnd; if (translatesDiff === 0) { progress = 0; isBeginning = true; isEnd = true; } else { progress = (translate - swiper.minTranslate()) / translatesDiff; isBeginning = progress <= 0; isEnd = progress >= 1; } Object.assign(swiper, { progress, isBeginning, isEnd }); if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); if (isBeginning && !wasBeginning) { swiper.emit('reachBeginning toEdge'); } if (isEnd && !wasEnd) { swiper.emit('reachEnd toEdge'); } if (wasBeginning && !isBeginning || wasEnd && !isEnd) { swiper.emit('fromEdge'); } swiper.emit('progress', progress); } function updateSlidesClasses() { const swiper = this; const { slides, params, $wrapperEl, activeIndex, realIndex } = swiper; const isVirtual = swiper.virtual && params.virtual.enabled; slides.removeClass(`${params.slideActiveClass} ${params.slideNextClass} ${params.slidePrevClass} ${params.slideDuplicateActiveClass} ${params.slideDuplicateNextClass} ${params.slideDuplicatePrevClass}`); let activeSlide; if (isVirtual) { activeSlide = swiper.$wrapperEl.find(`.${params.slideClass}[data-swiper-slide-index="${activeIndex}"]`); } else { activeSlide = slides.eq(activeIndex); } // Active classes activeSlide.addClass(params.slideActiveClass); if (params.loop) { // Duplicate to all looped slides if (activeSlide.hasClass(params.slideDuplicateClass)) { $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass); } else { $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass); } } // Next Slide let nextSlide = activeSlide.nextAll(`.${params.slideClass}`).eq(0).addClass(params.slideNextClass); if (params.loop && nextSlide.length === 0) { nextSlide = slides.eq(0); nextSlide.addClass(params.slideNextClass); } // Prev Slide let prevSlide = activeSlide.prevAll(`.${params.slideClass}`).eq(0).addClass(params.slidePrevClass); if (params.loop && prevSlide.length === 0) { prevSlide = slides.eq(-1); prevSlide.addClass(params.slidePrevClass); } if (params.loop) { // Duplicate to all looped slides if (nextSlide.hasClass(params.slideDuplicateClass)) { $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass); } else { $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass); } if (prevSlide.hasClass(params.slideDuplicateClass)) { $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass); } else { $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass); } } swiper.emitSlidesClasses(); } function updateActiveIndex(newActiveIndex) { const swiper = this; const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; const { slidesGrid, snapGrid, params, activeIndex: previousIndex, realIndex: previousRealIndex, snapIndex: previousSnapIndex } = swiper; let activeIndex = newActiveIndex; let snapIndex; if (typeof activeIndex === 'undefined') { for (let i = 0; i < slidesGrid.length; i += 1) { if (typeof slidesGrid[i + 1] !== 'undefined') { if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) { activeIndex = i; } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { activeIndex = i + 1; } } else if (translate >= slidesGrid[i]) { activeIndex = i; } } // Normalize slideIndex if (params.normalizeSlideIndex) { if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; } } if (snapGrid.indexOf(translate) >= 0) { snapIndex = snapGrid.indexOf(translate); } else { const skip = Math.min(params.slidesPerGroupSkip, activeIndex); snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); } if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; if (activeIndex === previousIndex) { if (snapIndex !== previousSnapIndex) { swiper.snapIndex = snapIndex; swiper.emit('snapIndexChange'); } return; } // Get real index const realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10); Object.assign(swiper, { snapIndex, realIndex, previousIndex, activeIndex }); swiper.emit('activeIndexChange'); swiper.emit('snapIndexChange'); if (previousRealIndex !== realIndex) { swiper.emit('realIndexChange'); } if (swiper.initialized || swiper.params.runCallbacksOnInit) { swiper.emit('slideChange'); } } function updateClickedSlide(e) { const swiper = this; const params = swiper.params; const slide = $(e).closest(`.${params.slideClass}`)[0]; let slideFound = false; let slideIndex; if (slide) { for (let i = 0; i < swiper.slides.length; i += 1) { if (swiper.slides[i] === slide) { slideFound = true; slideIndex = i; break; } } } if (slide && slideFound) { swiper.clickedSlide = slide; if (swiper.virtual && swiper.params.virtual.enabled) { swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10); } else { swiper.clickedIndex = slideIndex; } } else { swiper.clickedSlide = undefined; swiper.clickedIndex = undefined; return; } if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { swiper.slideToClickedSlide(); } } var update = { updateSize, updateSlides, updateAutoHeight, updateSlidesOffset, updateSlidesProgress, updateProgress, updateSlidesClasses, updateActiveIndex, updateClickedSlide }; function getSwiperTranslate(axis) { if (axis === void 0) { axis = this.isHorizontal() ? 'x' : 'y'; } const swiper = this; const { params, rtlTranslate: rtl, translate, $wrapperEl } = swiper; if (params.virtualTranslate) { return rtl ? -translate : translate; } if (params.cssMode) { return translate; } let currentTranslate = getTranslate($wrapperEl[0], axis); if (rtl) currentTranslate = -currentTranslate; return currentTranslate || 0; } function setTranslate(translate, byController) { const swiper = this; const { rtlTranslate: rtl, params, $wrapperEl, wrapperEl, progress } = swiper; let x = 0; let y = 0; const z = 0; if (swiper.isHorizontal()) { x = rtl ? -translate : translate; } else { y = translate; } if (params.roundLengths) { x = Math.floor(x); y = Math.floor(y); } if (params.cssMode) { wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; } else if (!params.virtualTranslate) { $wrapperEl.transform(`translate3d(${x}px, ${y}px, ${z}px)`); } swiper.previousTranslate = swiper.translate; swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress let newProgress; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); if (translatesDiff === 0) { newProgress = 0; } else { newProgress = (translate - swiper.minTranslate()) / translatesDiff; } if (newProgress !== progress) { swiper.updateProgress(translate); } swiper.emit('setTranslate', swiper.translate, byController); } function minTranslate() { return -this.snapGrid[0]; } function maxTranslate() { return -this.snapGrid[this.snapGrid.length - 1]; } function translateTo(translate, speed, runCallbacks, translateBounds, internal) { if (translate === void 0) { translate = 0; } if (speed === void 0) { speed = this.params.speed; } if (runCallbacks === void 0) { runCallbacks = true; } if (translateBounds === void 0) { translateBounds = true; } const swiper = this; const { params, wrapperEl } = swiper; if (swiper.animating && params.preventInteractionOnTransition) { return false; } const minTranslate = swiper.minTranslate(); const maxTranslate = swiper.maxTranslate(); let newTranslate; if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress swiper.updateProgress(newTranslate); if (params.cssMode) { const isH = swiper.isHorizontal(); if (speed === 0) { wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; } else { if (!swiper.support.smoothScroll) { animateCSSModeScroll({ swiper, targetPosition: -newTranslate, side: isH ? 'left' : 'top' }); return true; } wrapperEl.scrollTo({ [isH ? 'left' : 'top']: -newTranslate, behavior: 'smooth' }); } return true; } if (speed === 0) { swiper.setTransition(0); swiper.setTranslate(newTranslate); if (runCallbacks) { swiper.emit('beforeTransitionStart', speed, internal); swiper.emit('transitionEnd'); } } else { swiper.setTransition(speed); swiper.setTranslate(newTranslate); if (runCallbacks) { swiper.emit('beforeTransitionStart', speed, internal); swiper.emit('transitionStart'); } if (!swiper.animating) { swiper.animating = true; if (!swiper.onTranslateToWrapperTransitionEnd) { swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { if (!swiper || swiper.destroyed) return; if (e.target !== this) return; swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); swiper.onTranslateToWrapperTransitionEnd = null; delete swiper.onTranslateToWrapperTransitionEnd; if (runCallbacks) { swiper.emit('transitionEnd'); } }; } swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); } } return true; } var translate = { getTranslate: getSwiperTranslate, setTranslate, minTranslate, maxTranslate, translateTo }; function setTransition(duration, byController) { const swiper = this; if (!swiper.params.cssMode) { swiper.$wrapperEl.transition(duration); } swiper.emit('setTransition', duration, byController); } function transitionEmit(_ref) { let { swiper, runCallbacks, direction, step } = _ref; const { activeIndex, previousIndex } = swiper; let dir = direction; if (!dir) { if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; } swiper.emit(`transition${step}`); if (runCallbacks && activeIndex !== previousIndex) { if (dir === 'reset') { swiper.emit(`slideResetTransition${step}`); return; } swiper.emit(`slideChangeTransition${step}`); if (dir === 'next') { swiper.emit(`slideNextTransition${step}`); } else { swiper.emit(`slidePrevTransition${step}`); } } } function transitionStart(runCallbacks, direction) { if (runCallbacks === void 0) { runCallbacks = true; } const swiper = this; const { params } = swiper; if (params.cssMode) return; if (params.autoHeight) { swiper.updateAutoHeight(); } transitionEmit({ swiper, runCallbacks, direction, step: 'Start' }); } function transitionEnd(runCallbacks, direction) { if (runCallbacks === void 0) { runCallbacks = true; } const swiper = this; const { params } = swiper; swiper.animating = false; if (params.cssMode) return; swiper.setTransition(0); transitionEmit({ swiper, runCallbacks, direction, step: 'End' }); } var transition = { setTransition, transitionStart, transitionEnd }; function slideTo(index, speed, runCallbacks, internal, initial) { if (index === void 0) { index = 0; } if (speed === void 0) { speed = this.params.speed; } if (runCallbacks === void 0) { runCallbacks = true; } if (typeof index !== 'number' && typeof index !== 'string') { throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof index}] given.`); } if (typeof index === 'string') { /** * The `index` argument converted from `string` to `number`. * @type {number} */ const indexAsNumber = parseInt(index, 10); /** * Determines whether the `index` argument is a valid `number` * after being converted from the `string` type. * @type {boolean} */ const isValidNumber = isFinite(indexAsNumber); if (!isValidNumber) { throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`); } // Knowing that the converted `index` is a valid number, // we can update the original argument's value. index = indexAsNumber; } const swiper = this; let slideIndex = index; if (slideIndex < 0) slideIndex = 0; const { params, snapGrid, slidesGrid, previousIndex, activeIndex, rtlTranslate: rtl, wrapperEl, enabled } = swiper; if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) { return false; } const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; const translate = -snapGrid[snapIndex]; // Normalize slideIndex if (params.normalizeSlideIndex) { for (let i = 0; i < slidesGrid.length; i += 1) { const normalizedTranslate = -Math.floor(translate * 100); const normalizedGrid = Math.floor(slidesGrid[i] * 100); const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); if (typeof slidesGrid[i + 1] !== 'undefined') { if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { slideIndex = i; } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { slideIndex = i + 1; } } else if (normalizedTranslate >= normalizedGrid) { slideIndex = i; } } } // Directions locks if (swiper.initialized && slideIndex !== activeIndex) { if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) { return false; } if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { if ((activeIndex || 0) !== slideIndex) return false; } } if (slideIndex !== (previousIndex || 0) && runCallbacks) { swiper.emit('beforeSlideChangeStart'); } // Update progress swiper.updateProgress(translate); let direction; if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) { swiper.updateActiveIndex(slideIndex); // Update Height if (params.autoHeight) { swiper.updateAutoHeight(); } swiper.updateSlidesClasses(); if (params.effect !== 'slide') { swiper.setTranslate(translate); } if (direction !== 'reset') { swiper.transitionStart(runCallbacks, direction); swiper.transitionEnd(runCallbacks, direction); } return false; } if (params.cssMode) { const isH = swiper.isHorizontal(); const t = rtl ? translate : -translate; if (speed === 0) { const isVirtual = swiper.virtual && swiper.params.virtual.enabled; if (isVirtual) { swiper.wrapperEl.style.scrollSnapType = 'none'; swiper._immediateVirtual = true; } wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; if (isVirtual) { requestAnimationFrame(() => { swiper.wrapperEl.style.scrollSnapType = ''; swiper._swiperImmediateVirtual = false; }); } } else { if (!swiper.support.smoothScroll) { animateCSSModeScroll({ swiper, targetPosition: t, side: isH ? 'left' : 'top' }); return true; } wrapperEl.scrollTo({ [isH ? 'left' : 'top']: t, behavior: 'smooth' }); } return true; } swiper.setTransition(speed); swiper.setTranslate(translate); swiper.updateActiveIndex(slideIndex); swiper.updateSlidesClasses(); swiper.emit('beforeTransitionStart', speed, internal); swiper.transitionStart(runCallbacks, direction); if (speed === 0) { swiper.transitionEnd(runCallbacks, direction); } else if (!swiper.animating) { swiper.animating = true; if (!swiper.onSlideToWrapperTransitionEnd) { swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { if (!swiper || swiper.destroyed) return; if (e.target !== this) return; swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); swiper.onSlideToWrapperTransitionEnd = null; delete swiper.onSlideToWrapperTransitionEnd; swiper.transitionEnd(runCallbacks, direction); }; } swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); } return true; } function slideToLoop(index, speed, runCallbacks, internal) { if (index === void 0) { index = 0; } if (speed === void 0) { speed = this.params.speed; } if (runCallbacks === void 0) { runCallbacks = true; } if (typeof index === 'string') { /** * The `index` argument converted from `string` to `number`. * @type {number} */ const indexAsNumber = parseInt(index, 10); /** * Determines whether the `index` argument is a valid `number` * after being converted from the `string` type. * @type {boolean} */ const isValidNumber = isFinite(indexAsNumber); if (!isValidNumber) { throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`); } // Knowing that the converted `index` is a valid number, // we can update the original argument's value. index = indexAsNumber; } const swiper = this; let newIndex = index; if (swiper.params.loop) { newIndex += swiper.loopedSlides; } return swiper.slideTo(newIndex, speed, runCallbacks, internal); } /* eslint no-unused-vars: "off" */ function slideNext(speed, runCallbacks, internal) { if (speed === void 0) { speed = this.params.speed; } if (runCallbacks === void 0) { runCallbacks = true; } const swiper = this; const { animating, enabled, params } = swiper; if (!enabled) return swiper; let perGroup = params.slidesPerGroup; if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); } const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; if (params.loop) { if (animating && params.loopPreventsSlide) return false; swiper.loopFix(); // eslint-disable-next-line swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; } if (params.rewind && swiper.isEnd) { return swiper.slideTo(0, speed, runCallbacks, internal); } return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); } /* eslint no-unused-vars: "off" */ function slidePrev(speed, runCallbacks, internal) { if (speed === void 0) { speed = this.params.speed; } if (runCallbacks === void 0) { runCallbacks = true; } const swiper = this; const { params, animating, snapGrid, slidesGrid, rtlTranslate, enabled } = swiper; if (!enabled) return swiper; if (params.loop) { if (animating && params.loopPreventsSlide) return false; swiper.loopFix(); // eslint-disable-next-line swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; } const translate = rtlTranslate ? swiper.translate : -swiper.translate; function normalize(val) { if (val < 0) return -Math.floor(Math.abs(val)); return Math.floor(val); } const normalizedTranslate = normalize(translate); const normalizedSnapGrid = snapGrid.map(val => normalize(val)); let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; if (typeof prevSnap === 'undefined' && params.cssMode) { let prevSnapIndex; snapGrid.forEach((snap, snapIndex) => { if (normalizedTranslate >= snap) { // prevSnap = snap; prevSnapIndex = snapIndex; } }); if (typeof prevSnapIndex !== 'undefined') { prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; } } let prevIndex = 0; if (typeof prevSnap !== 'undefined') { prevIndex = slidesGrid.indexOf(prevSnap); if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; prevIndex = Math.max(prevIndex, 0); } } if (params.rewind && swiper.isBeginning) { const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; return swiper.slideTo(lastIndex, speed, runCallbacks, internal); } return swiper.slideTo(prevIndex, speed, runCallbacks, internal); } /* eslint no-unused-vars: "off" */ function slideReset(speed, runCallbacks, internal) { if (speed === void 0) { speed = this.params.speed; } if (runCallbacks === void 0) { runCallbacks = true; } const swiper = this; return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); } /* eslint no-unused-vars: "off" */ function slideToClosest(speed, runCallbacks, internal, threshold) { if (speed === void 0) { speed = this.params.speed; } if (runCallbacks === void 0) { runCallbacks = true; } if (threshold === void 0) { threshold = 0.5; } const swiper = this; let index = swiper.activeIndex; const skip = Math.min(swiper.params.slidesPerGroupSkip, index); const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; if (translate >= swiper.snapGrid[snapIndex]) { // The current translate is on or after the current snap index, so the choice // is between the current index and the one after it. const currentSnap = swiper.snapGrid[snapIndex]; const nextSnap = swiper.snapGrid[snapIndex + 1]; if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { index += swiper.params.slidesPerGroup; } } else { // The current translate is before the current snap index, so the choice // is between the current index and the one before it. const prevSnap = swiper.snapGrid[snapIndex - 1]; const currentSnap = swiper.snapGrid[snapIndex]; if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) { index -= swiper.params.slidesPerGroup; } } index = Math.max(index, 0); index = Math.min(index, swiper.slidesGrid.length - 1); return swiper.slideTo(index, speed, runCallbacks, internal); } function slideToClickedSlide() { const swiper = this; const { params, $wrapperEl } = swiper; const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; let slideToIndex = swiper.clickedIndex; let realIndex; if (params.loop) { if (swiper.animating) return; realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10); if (params.centeredSlides) { if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) { swiper.loopFix(); slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index(); nextTick(() => { swiper.slideTo(slideToIndex); }); } else { swiper.slideTo(slideToIndex); } } else if (slideToIndex > swiper.slides.length - slidesPerView) { swiper.loopFix(); slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index(); nextTick(() => { swiper.slideTo(slideToIndex); }); } else { swiper.slideTo(slideToIndex); } } else { swiper.slideTo(slideToIndex); } } var slide = { slideTo, slideToLoop, slideNext, slidePrev, slideReset, slideToClosest, slideToClickedSlide }; function loopCreate() { const swiper = this; const document = getDocument(); const { params, $wrapperEl } = swiper; // Remove duplicated slides const $selector = $wrapperEl.children().length > 0 ? $($wrapperEl.children()[0].parentNode) : $wrapperEl; $selector.children(`.${params.slideClass}.${params.slideDuplicateClass}`).remove(); let slides = $selector.children(`.${params.slideClass}`); if (params.loopFillGroupWithBlank) { const blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup; if (blankSlidesNum !== params.slidesPerGroup) { for (let i = 0; i < blankSlidesNum; i += 1) { const blankNode = $(document.createElement('div')).addClass(`${params.slideClass} ${params.slideBlankClass}`); $selector.append(blankNode); } slides = $selector.children(`.${params.slideClass}`); } } if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length; swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10)); swiper.loopedSlides += params.loopAdditionalSlides; if (swiper.loopedSlides > slides.length && swiper.params.loopedSlidesLimit) { swiper.loopedSlides = slides.length; } const prependSlides = []; const appendSlides = []; slides.each((el, index) => { const slide = $(el); slide.attr('data-swiper-slide-index', index); }); for (let i = 0; i < swiper.loopedSlides; i += 1) { const index = i - Math.floor(i / slides.length) * slides.length; appendSlides.push(slides.eq(index)[0]); prependSlides.unshift(slides.eq(slides.length - index - 1)[0]); } for (let i = 0; i < appendSlides.length; i += 1) { $selector.append($(appendSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass)); } for (let i = prependSlides.length - 1; i >= 0; i -= 1) { $selector.prepend($(prependSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass)); } } function loopFix() { const swiper = this; swiper.emit('beforeLoopFix'); const { activeIndex, slides, loopedSlides, allowSlidePrev, allowSlideNext, snapGrid, rtlTranslate: rtl } = swiper; let newIndex; swiper.allowSlidePrev = true; swiper.allowSlideNext = true; const snapTranslate = -snapGrid[activeIndex]; const diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding if (activeIndex < loopedSlides) { newIndex = slides.length - loopedSlides * 3 + activeIndex; newIndex += loopedSlides; const slideChanged = swiper.slideTo(newIndex, 0, false, true); if (slideChanged && diff !== 0) { swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); } } else if (activeIndex >= slides.length - loopedSlides) { // Fix For Positive Oversliding newIndex = -slides.length + activeIndex + loopedSlides; newIndex += loopedSlides; const slideChanged = swiper.slideTo(newIndex, 0, false, true); if (slideChanged && diff !== 0) { swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); } } swiper.allowSlidePrev = allowSlidePrev; swiper.allowSlideNext = allowSlideNext; swiper.emit('loopFix'); } function loopDestroy() { const swiper = this; const { $wrapperEl, params, slides } = swiper; $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass},.${params.slideClass}.${params.slideBlankClass}`).remove(); slides.removeAttr('data-swiper-slide-index'); } var loop = { loopCreate, loopFix, loopDestroy }; function setGrabCursor(moving) { const swiper = this; if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; el.style.cursor = 'move'; el.style.cursor = moving ? 'grabbing' : 'grab'; } function unsetGrabCursor() { const swiper = this; if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { return; } swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; } var grabCursor = { setGrabCursor, unsetGrabCursor }; function closestElement(selector, base) { if (base === void 0) { base = this; } function __closestFrom(el) { if (!el || el === getDocument() || el === getWindow()) return null; if (el.assignedSlot) el = el.assignedSlot; const found = el.closest(selector); if (!found && !el.getRootNode) { return null; } return found || __closestFrom(el.getRootNode().host); } return __closestFrom(base); } function onTouchStart(event) { const swiper = this; const document = getDocument(); const window = getWindow(); const data = swiper.touchEventsData; const { params, touches, enabled } = swiper; if (!enabled) return; if (swiper.animating && params.preventInteractionOnTransition) { return; } if (!swiper.animating && params.cssMode && params.loop) { swiper.loopFix(); } let e = event; if (e.originalEvent) e = e.originalEvent; let $targetEl = $(e.target); if (params.touchEventsTarget === 'wrapper') { if (!$targetEl.closest(swiper.wrapperEl).length) return; } data.isTouchEvent = e.type === 'touchstart'; if (!data.isTouchEvent && 'which' in e && e.which === 3) return; if (!data.isTouchEvent && 'button' in e && e.button > 0) return; if (data.isTouched && data.isMoved) return; // change target el for shadow root component const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; // eslint-disable-next-line const eventPath = event.composedPath ? event.composedPath() : event.path; if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) { $targetEl = $(eventPath[0]); } const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; const isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, $targetEl[0]) : $targetEl.closest(noSwipingSelector)[0])) { swiper.allowClick = true; return; } if (params.swipeHandler) { if (!$targetEl.closest(params.swipeHandler)[0]) return; } touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; const startX = touches.currentX; const startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection; const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold; if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { if (edgeSwipeDetection === 'prevent') { event.preventDefault(); } else { return; } } Object.assign(data, { isTouched: true, isMoved: false, allowTouchCallbacks: true, isScrolling: undefined, startMoving: undefined }); touches.startX = startX; touches.startY = startY; data.touchStartTime = now(); swiper.allowClick = true; swiper.updateSize(); swiper.swipeDirection = undefined; if (params.threshold > 0) data.allowThresholdMove = false; if (e.type !== 'touchstart') { let preventDefault = true; if ($targetEl.is(data.focusableElements)) { preventDefault = false; if ($targetEl[0].nodeName === 'SELECT') { data.isTouched = false; } } if (document.activeElement && $(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) { document.activeElement.blur(); } const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) { e.preventDefault(); } } if (swiper.params.freeMode && swiper.params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) { swiper.freeMode.onTouchStart(); } swiper.emit('touchStart', e); } function onTouchMove(event) { const document = getDocument(); const swiper = this; const data = swiper.touchEventsData; const { params, touches, rtlTranslate: rtl, enabled } = swiper; if (!enabled) return; let e = event; if (e.originalEvent) e = e.originalEvent; if (!data.isTouched) { if (data.startMoving && data.isScrolling) { swiper.emit('touchMoveOpposite', e); } return; } if (data.isTouchEvent && e.type !== 'touchmove') return; const targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]); const pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX; const pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY; if (e.preventedByNestedSwiper) { touches.startX = pageX; touches.startY = pageY; return; } if (!swiper.allowTouchMove) { if (!$(e.target).is(data.focusableElements)) { swiper.allowClick = false; } if (data.isTouched) { Object.assign(touches, { startX: pageX, startY: pageY, currentX: pageX, currentY: pageY }); data.touchStartTime = now(); } return; } if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) { if (swiper.isVertical()) { // Vertical if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { data.isTouched = false; data.isMoved = false; return; } } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) { return; } } if (data.isTouchEvent && document.activeElement) { if (e.target === document.activeElement && $(e.target).is(data.focusableElements)) { data.isMoved = true; swiper.allowClick = false; return; } } if (data.allowTouchCallbacks) { swiper.emit('touchMove', e); } if (e.targetTouches && e.targetTouches.length > 1) return; touches.currentX = pageX; touches.currentY = pageY; const diffX = touches.currentX - touches.startX; const diffY = touches.currentY - touches.startY; if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; if (typeof data.isScrolling === 'undefined') { let touchAngle; if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { data.isScrolling = false; } else { // eslint-disable-next-line if (diffX * diffX + diffY * diffY >= 25) { touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; } } } if (data.isScrolling) { swiper.emit('touchMoveOpposite', e); } if (typeof data.startMoving === 'undefined') { if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { data.startMoving = true; } } if (data.isScrolling) { data.isTouched = false; return; } if (!data.startMoving) { return; } swiper.allowClick = false; if (!params.cssMode && e.cancelable) { e.preventDefault(); } if (params.touchMoveStopPropagation && !params.nested) { e.stopPropagation(); } if (!data.isMoved) { if (params.loop && !params.cssMode) { swiper.loopFix(); } data.startTranslate = swiper.getTranslate(); swiper.setTransition(0); if (swiper.animating) { swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend'); } data.allowMomentumBounce = false; // Grab Cursor if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { swiper.setGrabCursor(true); } swiper.emit('sliderFirstMove', e); } swiper.emit('sliderMove', e); data.isMoved = true; let diff = swiper.isHorizontal() ? diffX : diffY; touches.diff = diff; diff *= params.touchRatio; if (rtl) diff = -diff; swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; data.currentTranslate = diff + data.startTranslate; let disableParentSwiper = true; let resistanceRatio = params.resistanceRatio; if (params.touchReleaseOnEdges) { resistanceRatio = 0; } if (diff > 0 && data.currentTranslate > swiper.minTranslate()) { disableParentSwiper = false; if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio; } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) { disableParentSwiper = false; if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio; } if (disableParentSwiper) { e.preventedByNestedSwiper = true; } // Directions locks if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { data.currentTranslate = data.startTranslate; } if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { data.currentTranslate = data.startTranslate; } if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { data.currentTranslate = data.startTranslate; } // Threshold if (params.threshold > 0) { if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { if (!data.allowThresholdMove) { data.allowThresholdMove = true; touches.startX = touches.currentX; touches.startY = touches.currentY; data.currentTranslate = data.startTranslate; touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; return; } } else { data.currentTranslate = data.startTranslate; return; } } if (!params.followFinger || params.cssMode) return; // Update active index in free mode if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) { swiper.freeMode.onTouchMove(); } // Update progress swiper.updateProgress(data.currentTranslate); // Update translate swiper.setTranslate(data.currentTranslate); } function onTouchEnd(event) { const swiper = this; const data = swiper.touchEventsData; const { params, touches, rtlTranslate: rtl, slidesGrid, enabled } = swiper; if (!enabled) return; let e = event; if (e.originalEvent) e = e.originalEvent; if (data.allowTouchCallbacks) { swiper.emit('touchEnd', e); } data.allowTouchCallbacks = false; if (!data.isTouched) { if (data.isMoved && params.grabCursor) { swiper.setGrabCursor(false); } data.isMoved = false; data.startMoving = false; return; } // Return Grab Cursor if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { swiper.setGrabCursor(false); } // Time diff const touchEndTime = now(); const timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click if (swiper.allowClick) { const pathTree = e.path || e.composedPath && e.composedPath(); swiper.updateClickedSlide(pathTree && pathTree[0] || e.target); swiper.emit('tap click', e); if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { swiper.emit('doubleTap doubleClick', e); } } data.lastClickTime = now(); nextTick(() => { if (!swiper.destroyed) swiper.allowClick = true; }); if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) { data.isTouched = false; data.isMoved = false; data.startMoving = false; return; } data.isTouched = false; data.isMoved = false; data.startMoving = false; let currentPos; if (params.followFinger) { currentPos = rtl ? swiper.translate : -swiper.translate; } else { currentPos = -data.currentTranslate; } if (params.cssMode) { return; } if (swiper.params.freeMode && params.freeMode.enabled) { swiper.freeMode.onTouchEnd({ currentPos }); return; } // Find current slide let stopIndex = 0; let groupSize = swiper.slidesSizesGrid[0]; for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; if (typeof slidesGrid[i + increment] !== 'undefined') { if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) { stopIndex = i; groupSize = slidesGrid[i + increment] - slidesGrid[i]; } } else if (currentPos >= slidesGrid[i]) { stopIndex = i; groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; } } let rewindFirstIndex = null; let rewindLastIndex = null; if (params.rewind) { if (swiper.isBeginning) { rewindLastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; } else if (swiper.isEnd) { rewindFirstIndex = 0; } } // Find current slide size const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; if (timeDiff > params.longSwipesMs) { // Long touches if (!params.longSwipes) { swiper.slideTo(swiper.activeIndex); return; } if (swiper.swipeDirection === 'next') { if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex); } if (swiper.swipeDirection === 'prev') { if (ratio > 1 - params.longSwipesRatio) { swiper.slideTo(stopIndex + increment); } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) { swiper.slideTo(rewindLastIndex); } else { swiper.slideTo(stopIndex); } } } else { // Short swipes if (!params.shortSwipes) { swiper.slideTo(swiper.activeIndex); return; } const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); if (!isNavButtonTarget) { if (swiper.swipeDirection === 'next') { swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); } if (swiper.swipeDirection === 'prev') { swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); } } else if (e.target === swiper.navigation.nextEl) { swiper.slideTo(stopIndex + increment); } else { swiper.slideTo(stopIndex); } } } function onResize() { const swiper = this; const { params, el } = swiper; if (el && el.offsetWidth === 0) return; // Breakpoints if (params.breakpoints) { swiper.setBreakpoint(); } // Save locks const { allowSlideNext, allowSlidePrev, snapGrid } = swiper; // Disable locks on resize swiper.allowSlideNext = true; swiper.allowSlidePrev = true; swiper.updateSize(); swiper.updateSlides(); swiper.updateSlidesClasses(); if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) { swiper.slideTo(swiper.slides.length - 1, 0, false, true); } else { swiper.slideTo(swiper.activeIndex, 0, false, true); } if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { swiper.autoplay.run(); } // Return locks after resize swiper.allowSlidePrev = allowSlidePrev; swiper.allowSlideNext = allowSlideNext; if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { swiper.checkOverflow(); } } function onClick(e) { const swiper = this; if (!swiper.enabled) return; if (!swiper.allowClick) { if (swiper.params.preventClicks) e.preventDefault(); if (swiper.params.preventClicksPropagation && swiper.animating) { e.stopPropagation(); e.stopImmediatePropagation(); } } } function onScroll() { const swiper = this; const { wrapperEl, rtlTranslate, enabled } = swiper; if (!enabled) return; swiper.previousTranslate = swiper.translate; if (swiper.isHorizontal()) { swiper.translate = -wrapperEl.scrollLeft; } else { swiper.translate = -wrapperEl.scrollTop; } // eslint-disable-next-line if (swiper.translate === 0) swiper.translate = 0; swiper.updateActiveIndex(); swiper.updateSlidesClasses(); let newProgress; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); if (translatesDiff === 0) { newProgress = 0; } else { newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; } if (newProgress !== swiper.progress) { swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); } swiper.emit('setTranslate', swiper.translate, false); } let dummyEventAttached = false; function dummyEventListener() {} const events = (swiper, method) => { const document = getDocument(); const { params, touchEvents, el, wrapperEl, device, support } = swiper; const capture = !!params.nested; const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; const swiperMethod = method; // Touch Events if (!support.touch) { el[domMethod](touchEvents.start, swiper.onTouchStart, false); document[domMethod](touchEvents.move, swiper.onTouchMove, capture); document[domMethod](touchEvents.end, swiper.onTouchEnd, false); } else { const passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener); el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? { passive: false, capture } : capture); el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener); if (touchEvents.cancel) { el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener); } } // Prevent Links Clicks if (params.preventClicks || params.preventClicksPropagation) { el[domMethod]('click', swiper.onClick, true); } if (params.cssMode) { wrapperEl[domMethod]('scroll', swiper.onScroll); } // Resize handler if (params.updateOnWindowResize) { swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); } else { swiper[swiperMethod]('observerUpdate', onResize, true); } }; function attachEvents() { const swiper = this; const document = getDocument(); const { params, support } = swiper; swiper.onTouchStart = onTouchStart.bind(swiper); swiper.onTouchMove = onTouchMove.bind(swiper); swiper.onTouchEnd = onTouchEnd.bind(swiper); if (params.cssMode) { swiper.onScroll = onScroll.bind(swiper); } swiper.onClick = onClick.bind(swiper); if (support.touch && !dummyEventAttached) { document.addEventListener('touchstart', dummyEventListener); dummyEventAttached = true; } events(swiper, 'on'); } function detachEvents() { const swiper = this; events(swiper, 'off'); } var events$1 = { attachEvents, detachEvents }; const isGridEnabled = (swiper, params) => { return swiper.grid && params.grid && params.grid.rows > 1; }; function setBreakpoint() { const swiper = this; const { activeIndex, initialized, loopedSlides = 0, params, $el } = swiper; const breakpoints = params.breakpoints; if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el); if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; const breakpointParams = breakpointOnlyParams || swiper.originalParams; const wasMultiRow = isGridEnabled(swiper, params); const isMultiRow = isGridEnabled(swiper, breakpointParams); const wasEnabled = params.enabled; if (wasMultiRow && !isMultiRow) { $el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`); swiper.emitContainerClasses(); } else if (!wasMultiRow && isMultiRow) { $el.addClass(`${params.containerModifierClass}grid`); if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { $el.addClass(`${params.containerModifierClass}grid-column`); } swiper.emitContainerClasses(); } // Toggle navigation, pagination, scrollbar ['navigation', 'pagination', 'scrollbar'].forEach(prop => { const wasModuleEnabled = params[prop] && params[prop].enabled; const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; if (wasModuleEnabled && !isModuleEnabled) { swiper[prop].disable(); } if (!wasModuleEnabled && isModuleEnabled) { swiper[prop].enable(); } }); const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); if (directionChanged && initialized) { swiper.changeDirection(); } extend(swiper.params, breakpointParams); const isEnabled = swiper.params.enabled; Object.assign(swiper, { allowTouchMove: swiper.params.allowTouchMove, allowSlideNext: swiper.params.allowSlideNext, allowSlidePrev: swiper.params.allowSlidePrev }); if (wasEnabled && !isEnabled) { swiper.disable(); } else if (!wasEnabled && isEnabled) { swiper.enable(); } swiper.currentBreakpoint = breakpoint; swiper.emit('_beforeBreakpoint', breakpointParams); if (needsReLoop && initialized) { swiper.loopDestroy(); swiper.loopCreate(); swiper.updateSlides(); swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false); } swiper.emit('breakpoint', breakpointParams); } function getBreakpoint(breakpoints, base, containerEl) { if (base === void 0) { base = 'window'; } if (!breakpoints || base === 'container' && !containerEl) return undefined; let breakpoint = false; const window = getWindow(); const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; const points = Object.keys(breakpoints).map(point => { if (typeof point === 'string' && point.indexOf('@') === 0) { const minRatio = parseFloat(point.substr(1)); const value = currentHeight * minRatio; return { value, point }; } return { value: point, point }; }); points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10)); for (let i = 0; i < points.length; i += 1) { const { point, value } = points[i]; if (base === 'window') { if (window.matchMedia(`(min-width: ${value}px)`).matches) { breakpoint = point; } } else if (value <= containerEl.clientWidth) { breakpoint = point; } } return breakpoint || 'max'; } var breakpoints = { setBreakpoint, getBreakpoint }; function prepareClasses(entries, prefix) { const resultClasses = []; entries.forEach(item => { if (typeof item === 'object') { Object.keys(item).forEach(classNames => { if (item[classNames]) { resultClasses.push(prefix + classNames); } }); } else if (typeof item === 'string') { resultClasses.push(prefix + item); } }); return resultClasses; } function addClasses() { const swiper = this; const { classNames, params, rtl, $el, device, support } = swiper; // prettier-ignore const suffixes = prepareClasses(['initialized', params.direction, { 'pointer-events': !support.touch }, { 'free-mode': swiper.params.freeMode && params.freeMode.enabled }, { 'autoheight': params.autoHeight }, { 'rtl': rtl }, { 'grid': params.grid && params.grid.rows > 1 }, { 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' }, { 'android': device.android }, { 'ios': device.ios }, { 'css-mode': params.cssMode }, { 'centered': params.cssMode && params.centeredSlides }, { 'watch-progress': params.watchSlidesProgress }], params.containerModifierClass); classNames.push(...suffixes); $el.addClass([...classNames].join(' ')); swiper.emitContainerClasses(); } function removeClasses() { const swiper = this; const { $el, classNames } = swiper; $el.removeClass(classNames.join(' ')); swiper.emitContainerClasses(); } var classes = { addClasses, removeClasses }; function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) { const window = getWindow(); let image; function onReady() { if (callback) callback(); } const isPicture = $(imageEl).parent('picture')[0]; if (!isPicture && (!imageEl.complete || !checkForComplete)) { if (src) { image = new window.Image(); image.onload = onReady; image.onerror = onReady; if (sizes) { image.sizes = sizes; } if (srcset) { image.srcset = srcset; } if (src) { image.src = src; } } else { onReady(); } } else { // image already loaded... onReady(); } } function preloadImages() { const swiper = this; swiper.imagesToLoad = swiper.$el.find('img'); function onReady() { if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return; if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1; if (swiper.imagesLoaded === swiper.imagesToLoad.length) { if (swiper.params.updateOnImagesReady) swiper.update(); swiper.emit('imagesReady'); } } for (let i = 0; i < swiper.imagesToLoad.length; i += 1) { const imageEl = swiper.imagesToLoad[i]; swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady); } } var images = { loadImage, preloadImages }; function checkOverflow() { const swiper = this; const { isLocked: wasLocked, params } = swiper; const { slidesOffsetBefore } = params; if (slidesOffsetBefore) { const lastSlideIndex = swiper.slides.length - 1; const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; swiper.isLocked = swiper.size > lastSlideRightEdge; } else { swiper.isLocked = swiper.snapGrid.length === 1; } if (params.allowSlideNext === true) { swiper.allowSlideNext = !swiper.isLocked; } if (params.allowSlidePrev === true) { swiper.allowSlidePrev = !swiper.isLocked; } if (wasLocked && wasLocked !== swiper.isLocked) { swiper.isEnd = false; } if (wasLocked !== swiper.isLocked) { swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); } } var checkOverflow$1 = { checkOverflow }; var defaults = { init: true, direction: 'horizontal', touchEventsTarget: 'wrapper', initialSlide: 0, speed: 300, cssMode: false, updateOnWindowResize: true, resizeObserver: true, nested: false, createElements: false, enabled: true, focusableElements: 'input, select, option, textarea, button, video, label', // Overrides width: null, height: null, // preventInteractionOnTransition: false, // ssr userAgent: null, url: null, // To support iOS's swipe-to-go-back gesture (when being used in-app). edgeSwipeDetection: false, edgeSwipeThreshold: 20, // Autoheight autoHeight: false, // Set wrapper width setWrapperSize: false, // Virtual Translate virtualTranslate: false, // Effects effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' // Breakpoints breakpoints: undefined, breakpointsBase: 'window', // Slides grid spaceBetween: 0, slidesPerView: 1, slidesPerGroup: 1, slidesPerGroupSkip: 0, slidesPerGroupAuto: false, centeredSlides: false, centeredSlidesBounds: false, slidesOffsetBefore: 0, // in px slidesOffsetAfter: 0, // in px normalizeSlideIndex: true, centerInsufficientSlides: false, // Disable swiper and hide navigation when container not overflow watchOverflow: true, // Round length roundLengths: false, // Touches touchRatio: 1, touchAngle: 45, simulateTouch: true, shortSwipes: true, longSwipes: true, longSwipesRatio: 0.5, longSwipesMs: 300, followFinger: true, allowTouchMove: true, threshold: 0, touchMoveStopPropagation: false, touchStartPreventDefault: true, touchStartForcePreventDefault: false, touchReleaseOnEdges: false, // Unique Navigation Elements uniqueNavElements: true, // Resistance resistance: true, resistanceRatio: 0.85, // Progress watchSlidesProgress: false, // Cursor grabCursor: false, // Clicks preventClicks: true, preventClicksPropagation: true, slideToClickedSlide: false, // Images preloadImages: true, updateOnImagesReady: true, // loop loop: false, loopAdditionalSlides: 0, loopedSlides: null, loopedSlidesLimit: true, loopFillGroupWithBlank: false, loopPreventsSlide: true, // rewind rewind: false, // Swiping/no swiping allowSlidePrev: true, allowSlideNext: true, swipeHandler: null, // '.swipe-handler', noSwiping: true, noSwipingClass: 'swiper-no-swiping', noSwipingSelector: null, // Passive Listeners passiveListeners: true, maxBackfaceHiddenSlides: 10, // NS containerModifierClass: 'swiper-', // NEW slideClass: 'swiper-slide', slideBlankClass: 'swiper-slide-invisible-blank', slideActiveClass: 'swiper-slide-active', slideDuplicateActiveClass: 'swiper-slide-duplicate-active', slideVisibleClass: 'swiper-slide-visible', slideDuplicateClass: 'swiper-slide-duplicate', slideNextClass: 'swiper-slide-next', slideDuplicateNextClass: 'swiper-slide-duplicate-next', slidePrevClass: 'swiper-slide-prev', slideDuplicatePrevClass: 'swiper-slide-duplicate-prev', wrapperClass: 'swiper-wrapper', // Callbacks runCallbacksOnInit: true, // Internals _emitClasses: false }; function moduleExtendParams(params, allModulesParams) { return function extendParams(obj) { if (obj === void 0) { obj = {}; } const moduleParamName = Object.keys(obj)[0]; const moduleParams = obj[moduleParamName]; if (typeof moduleParams !== 'object' || moduleParams === null) { extend(allModulesParams, obj); return; } if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) { params[moduleParamName] = { auto: true }; } if (!(moduleParamName in params && 'enabled' in moduleParams)) { extend(allModulesParams, obj); return; } if (params[moduleParamName] === true) { params[moduleParamName] = { enabled: true }; } if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) { params[moduleParamName].enabled = true; } if (!params[moduleParamName]) params[moduleParamName] = { enabled: false }; extend(allModulesParams, obj); }; } /* eslint no-param-reassign: "off" */ const prototypes = { eventsEmitter, update, translate, transition, slide, loop, grabCursor, events: events$1, breakpoints, checkOverflow: checkOverflow$1, classes, images }; const extendedDefaults = {}; class Swiper { constructor() { let el; let params; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { params = args[0]; } else { [el, params] = args; } if (!params) params = {}; params = extend({}, params); if (el && !params.el) params.el = el; if (params.el && $(params.el).length > 1) { const swipers = []; $(params.el).each(containerEl => { const newParams = extend({}, params, { el: containerEl }); swipers.push(new Swiper(newParams)); }); // eslint-disable-next-line no-constructor-return return swipers; } // Swiper Instance const swiper = this; swiper.__swiper__ = true; swiper.support = getSupport(); swiper.device = getDevice({ userAgent: params.userAgent }); swiper.browser = getBrowser(); swiper.eventsListeners = {}; swiper.eventsAnyListeners = []; swiper.modules = [...swiper.__modules__]; if (params.modules && Array.isArray(params.modules)) { swiper.modules.push(...params.modules); } const allModulesParams = {}; swiper.modules.forEach(mod => { mod({ swiper, extendParams: moduleExtendParams(params, allModulesParams), on: swiper.on.bind(swiper), once: swiper.once.bind(swiper), off: swiper.off.bind(swiper), emit: swiper.emit.bind(swiper) }); }); // Extend defaults with modules params const swiperParams = extend({}, defaults, allModulesParams); // Extend defaults with passed params swiper.params = extend({}, swiperParams, extendedDefaults, params); swiper.originalParams = extend({}, swiper.params); swiper.passedParams = extend({}, params); // add event listeners if (swiper.params && swiper.params.on) { Object.keys(swiper.params.on).forEach(eventName => { swiper.on(eventName, swiper.params.on[eventName]); }); } if (swiper.params && swiper.params.onAny) { swiper.onAny(swiper.params.onAny); } // Save Dom lib swiper.$ = $; // Extend Swiper Object.assign(swiper, { enabled: swiper.params.enabled, el, // Classes classNames: [], // Slides slides: $(), slidesGrid: [], snapGrid: [], slidesSizesGrid: [], // isDirection isHorizontal() { return swiper.params.direction === 'horizontal'; }, isVertical() { return swiper.params.direction === 'vertical'; }, // Indexes activeIndex: 0, realIndex: 0, // isBeginning: true, isEnd: false, // Props translate: 0, previousTranslate: 0, progress: 0, velocity: 0, animating: false, // Locks allowSlideNext: swiper.params.allowSlideNext, allowSlidePrev: swiper.params.allowSlidePrev, // Touch Events touchEvents: function touchEvents() { const touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel']; const desktop = ['pointerdown', 'pointermove', 'pointerup']; swiper.touchEventsTouch = { start: touch[0], move: touch[1], end: touch[2], cancel: touch[3] }; swiper.touchEventsDesktop = { start: desktop[0], move: desktop[1], end: desktop[2] }; return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop; }(), touchEventsData: { isTouched: undefined, isMoved: undefined, allowTouchCallbacks: undefined, touchStartTime: undefined, isScrolling: undefined, currentTranslate: undefined, startTranslate: undefined, allowThresholdMove: undefined, // Form elements to match focusableElements: swiper.params.focusableElements, // Last click time lastClickTime: now(), clickTimeout: undefined, // Velocities velocities: [], allowMomentumBounce: undefined, isTouchEvent: undefined, startMoving: undefined }, // Clicks allowClick: true, // Touches allowTouchMove: swiper.params.allowTouchMove, touches: { startX: 0, startY: 0, currentX: 0, currentY: 0, diff: 0 }, // Images imagesToLoad: [], imagesLoaded: 0 }); swiper.emit('_swiper'); // Init if (swiper.params.init) { swiper.init(); } // Return app instance // eslint-disable-next-line no-constructor-return return swiper; } enable() { const swiper = this; if (swiper.enabled) return; swiper.enabled = true; if (swiper.params.grabCursor) { swiper.setGrabCursor(); } swiper.emit('enable'); } disable() { const swiper = this; if (!swiper.enabled) return; swiper.enabled = false; if (swiper.params.grabCursor) { swiper.unsetGrabCursor(); } swiper.emit('disable'); } setProgress(progress, speed) { const swiper = this; progress = Math.min(Math.max(progress, 0), 1); const min = swiper.minTranslate(); const max = swiper.maxTranslate(); const current = (max - min) * progress + min; swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } emitContainerClasses() { const swiper = this; if (!swiper.params._emitClasses || !swiper.el) return; const cls = swiper.el.className.split(' ').filter(className => { return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; }); swiper.emit('_containerClasses', cls.join(' ')); } getSlideClasses(slideEl) { const swiper = this; if (swiper.destroyed) return ''; return slideEl.className.split(' ').filter(className => { return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; }).join(' '); } emitSlidesClasses() { const swiper = this; if (!swiper.params._emitClasses || !swiper.el) return; const updates = []; swiper.slides.each(slideEl => { const classNames = swiper.getSlideClasses(slideEl); updates.push({ slideEl, classNames }); swiper.emit('_slideClass', slideEl, classNames); }); swiper.emit('_slideClasses', updates); } slidesPerViewDynamic(view, exact) { if (view === void 0) { view = 'current'; } if (exact === void 0) { exact = false; } const swiper = this; const { params, slides, slidesGrid, slidesSizesGrid, size: swiperSize, activeIndex } = swiper; let spv = 1; if (params.centeredSlides) { let slideSize = slides[activeIndex].swiperSlideSize; let breakLoop; for (let i = activeIndex + 1; i < slides.length; i += 1) { if (slides[i] && !breakLoop) { slideSize += slides[i].swiperSlideSize; spv += 1; if (slideSize > swiperSize) breakLoop = true; } } for (let i = activeIndex - 1; i >= 0; i -= 1) { if (slides[i] && !breakLoop) { slideSize += slides[i].swiperSlideSize; spv += 1; if (slideSize > swiperSize) breakLoop = true; } } } else { // eslint-disable-next-line if (view === 'current') { for (let i = activeIndex + 1; i < slides.length; i += 1) { const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; if (slideInView) { spv += 1; } } } else { // previous for (let i = activeIndex - 1; i >= 0; i -= 1) { const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; if (slideInView) { spv += 1; } } } } return spv; } update() { const swiper = this; if (!swiper || swiper.destroyed) return; const { snapGrid, params } = swiper; // Breakpoints if (params.breakpoints) { swiper.setBreakpoint(); } swiper.updateSize(); swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); function setTranslate() { const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); swiper.setTranslate(newTranslate); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } let translated; if (swiper.params.freeMode && swiper.params.freeMode.enabled) { setTranslate(); if (swiper.params.autoHeight) { swiper.updateAutoHeight(); } } else { if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) { translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true); } else { translated = swiper.slideTo(swiper.activeIndex, 0, false, true); } if (!translated) { setTranslate(); } } if (params.watchOverflow && snapGrid !== swiper.snapGrid) { swiper.checkOverflow(); } swiper.emit('update'); } changeDirection(newDirection, needUpdate) { if (needUpdate === void 0) { needUpdate = true; } const swiper = this; const currentDirection = swiper.params.direction; if (!newDirection) { // eslint-disable-next-line newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; } if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { return swiper; } swiper.$el.removeClass(`${swiper.params.containerModifierClass}${currentDirection}`).addClass(`${swiper.params.containerModifierClass}${newDirection}`); swiper.emitContainerClasses(); swiper.params.direction = newDirection; swiper.slides.each(slideEl => { if (newDirection === 'vertical') { slideEl.style.width = ''; } else { slideEl.style.height = ''; } }); swiper.emit('changeDirection'); if (needUpdate) swiper.update(); return swiper; } changeLanguageDirection(direction) { const swiper = this; if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; swiper.rtl = direction === 'rtl'; swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; if (swiper.rtl) { swiper.$el.addClass(`${swiper.params.containerModifierClass}rtl`); swiper.el.dir = 'rtl'; } else { swiper.$el.removeClass(`${swiper.params.containerModifierClass}rtl`); swiper.el.dir = 'ltr'; } swiper.update(); } mount(el) { const swiper = this; if (swiper.mounted) return true; // Find el const $el = $(el || swiper.params.el); el = $el[0]; if (!el) { return false; } el.swiper = swiper; const getWrapperSelector = () => { return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; }; const getWrapper = () => { if (el && el.shadowRoot && el.shadowRoot.querySelector) { const res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items res.children = options => $el.children(options); return res; } if (!$el.children) { return $($el).children(getWrapperSelector()); } return $el.children(getWrapperSelector()); }; // Find Wrapper let $wrapperEl = getWrapper(); if ($wrapperEl.length === 0 && swiper.params.createElements) { const document = getDocument(); const wrapper = document.createElement('div'); $wrapperEl = $(wrapper); wrapper.className = swiper.params.wrapperClass; $el.append(wrapper); $el.children(`.${swiper.params.slideClass}`).each(slideEl => { $wrapperEl.append(slideEl); }); } Object.assign(swiper, { $el, el, $wrapperEl, wrapperEl: $wrapperEl[0], mounted: true, // RTL rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl', rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'), wrongRTL: $wrapperEl.css('display') === '-webkit-box' }); return true; } init(el) { const swiper = this; if (swiper.initialized) return swiper; const mounted = swiper.mount(el); if (mounted === false) return swiper; swiper.emit('beforeInit'); // Set breakpoint if (swiper.params.breakpoints) { swiper.setBreakpoint(); } // Add Classes swiper.addClasses(); // Create loop if (swiper.params.loop) { swiper.loopCreate(); } // Update size swiper.updateSize(); // Update slides swiper.updateSlides(); if (swiper.params.watchOverflow) { swiper.checkOverflow(); } // Set Grab Cursor if (swiper.params.grabCursor && swiper.enabled) { swiper.setGrabCursor(); } if (swiper.params.preloadImages) { swiper.preloadImages(); } // Slide To Initial Slide if (swiper.params.loop) { swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true); } else { swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); } // Attach events swiper.attachEvents(); // Init Flag swiper.initialized = true; // Emit swiper.emit('init'); swiper.emit('afterInit'); return swiper; } destroy(deleteInstance, cleanStyles) { if (deleteInstance === void 0) { deleteInstance = true; } if (cleanStyles === void 0) { cleanStyles = true; } const swiper = this; const { params, $el, $wrapperEl, slides } = swiper; if (typeof swiper.params === 'undefined' || swiper.destroyed) { return null; } swiper.emit('beforeDestroy'); // Init Flag swiper.initialized = false; // Detach events swiper.detachEvents(); // Destroy loop if (params.loop) { swiper.loopDestroy(); } // Cleanup styles if (cleanStyles) { swiper.removeClasses(); $el.removeAttr('style'); $wrapperEl.removeAttr('style'); if (slides && slides.length) { slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index'); } } swiper.emit('destroy'); // Detach emitter events Object.keys(swiper.eventsListeners).forEach(eventName => { swiper.off(eventName); }); if (deleteInstance !== false) { swiper.$el[0].swiper = null; deleteProps(swiper); } swiper.destroyed = true; return null; } static extendDefaults(newDefaults) { extend(extendedDefaults, newDefaults); } static get extendedDefaults() { return extendedDefaults; } static get defaults() { return defaults; } static installModule(mod) { if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; const modules = Swiper.prototype.__modules__; if (typeof mod === 'function' && modules.indexOf(mod) < 0) { modules.push(mod); } } static use(module) { if (Array.isArray(module)) { module.forEach(m => Swiper.installModule(m)); return Swiper; } Swiper.installModule(module); return Swiper; } } Object.keys(prototypes).forEach(prototypeGroup => { Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => { Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; }); }); Swiper.use([Resize, Observer]); function Virtual(_ref) { let { swiper, extendParams, on, emit } = _ref; extendParams({ virtual: { enabled: false, slides: [], cache: true, renderSlide: null, renderExternal: null, renderExternalUpdate: true, addSlidesBefore: 0, addSlidesAfter: 0 } }); let cssModeTimeout; swiper.virtual = { cache: {}, from: undefined, to: undefined, slides: [], offset: 0, slidesGrid: [] }; function renderSlide(slide, index) { const params = swiper.params.virtual; if (params.cache && swiper.virtual.cache[index]) { return swiper.virtual.cache[index]; } const $slideEl = params.renderSlide ? $(params.renderSlide.call(swiper, slide, index)) : $(`
    ${slide}
    `); if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index); if (params.cache) swiper.virtual.cache[index] = $slideEl; return $slideEl; } function update(force) { const { slidesPerView, slidesPerGroup, centeredSlides } = swiper.params; const { addSlidesBefore, addSlidesAfter } = swiper.params.virtual; const { from: previousFrom, to: previousTo, slides, slidesGrid: previousSlidesGrid, offset: previousOffset } = swiper.virtual; if (!swiper.params.cssMode) { swiper.updateActiveIndex(); } const activeIndex = swiper.activeIndex || 0; let offsetProp; if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; let slidesAfter; let slidesBefore; if (centeredSlides) { slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; } else { slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; slidesBefore = slidesPerGroup + addSlidesBefore; } const from = Math.max((activeIndex || 0) - slidesBefore, 0); const to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1); const offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); Object.assign(swiper.virtual, { from, to, offset, slidesGrid: swiper.slidesGrid }); function onRendered() { swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); if (swiper.lazy && swiper.params.lazy.enabled) { swiper.lazy.load(); } emit('virtualUpdate'); } if (previousFrom === from && previousTo === to && !force) { if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { swiper.slides.css(offsetProp, `${offset}px`); } swiper.updateProgress(); emit('virtualUpdate'); return; } if (swiper.params.virtual.renderExternal) { swiper.params.virtual.renderExternal.call(swiper, { offset, from, to, slides: function getSlides() { const slidesToRender = []; for (let i = from; i <= to; i += 1) { slidesToRender.push(slides[i]); } return slidesToRender; }() }); if (swiper.params.virtual.renderExternalUpdate) { onRendered(); } else { emit('virtualUpdate'); } return; } const prependIndexes = []; const appendIndexes = []; if (force) { swiper.$wrapperEl.find(`.${swiper.params.slideClass}`).remove(); } else { for (let i = previousFrom; i <= previousTo; i += 1) { if (i < from || i > to) { swiper.$wrapperEl.find(`.${swiper.params.slideClass}[data-swiper-slide-index="${i}"]`).remove(); } } } for (let i = 0; i < slides.length; i += 1) { if (i >= from && i <= to) { if (typeof previousTo === 'undefined' || force) { appendIndexes.push(i); } else { if (i > previousTo) appendIndexes.push(i); if (i < previousFrom) prependIndexes.push(i); } } } appendIndexes.forEach(index => { swiper.$wrapperEl.append(renderSlide(slides[index], index)); }); prependIndexes.sort((a, b) => b - a).forEach(index => { swiper.$wrapperEl.prepend(renderSlide(slides[index], index)); }); swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, `${offset}px`); onRendered(); } function appendSlide(slides) { if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) swiper.virtual.slides.push(slides[i]); } } else { swiper.virtual.slides.push(slides); } update(true); } function prependSlide(slides) { const activeIndex = swiper.activeIndex; let newActiveIndex = activeIndex + 1; let numberOfNewSlides = 1; if (Array.isArray(slides)) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) swiper.virtual.slides.unshift(slides[i]); } newActiveIndex = activeIndex + slides.length; numberOfNewSlides = slides.length; } else { swiper.virtual.slides.unshift(slides); } if (swiper.params.virtual.cache) { const cache = swiper.virtual.cache; const newCache = {}; Object.keys(cache).forEach(cachedIndex => { const $cachedEl = cache[cachedIndex]; const cachedElIndex = $cachedEl.attr('data-swiper-slide-index'); if (cachedElIndex) { $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); } newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl; }); swiper.virtual.cache = newCache; } update(true); swiper.slideTo(newActiveIndex, 0); } function removeSlide(slidesIndexes) { if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; let activeIndex = swiper.activeIndex; if (Array.isArray(slidesIndexes)) { for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) { swiper.virtual.slides.splice(slidesIndexes[i], 1); if (swiper.params.virtual.cache) { delete swiper.virtual.cache[slidesIndexes[i]]; } if (slidesIndexes[i] < activeIndex) activeIndex -= 1; activeIndex = Math.max(activeIndex, 0); } } else { swiper.virtual.slides.splice(slidesIndexes, 1); if (swiper.params.virtual.cache) { delete swiper.virtual.cache[slidesIndexes]; } if (slidesIndexes < activeIndex) activeIndex -= 1; activeIndex = Math.max(activeIndex, 0); } update(true); swiper.slideTo(activeIndex, 0); } function removeAllSlides() { swiper.virtual.slides = []; if (swiper.params.virtual.cache) { swiper.virtual.cache = {}; } update(true); swiper.slideTo(0, 0); } on('beforeInit', () => { if (!swiper.params.virtual.enabled) return; swiper.virtual.slides = swiper.params.virtual.slides; swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`); swiper.params.watchSlidesProgress = true; swiper.originalParams.watchSlidesProgress = true; if (!swiper.params.initialSlide) { update(); } }); on('setTranslate', () => { if (!swiper.params.virtual.enabled) return; if (swiper.params.cssMode && !swiper._immediateVirtual) { clearTimeout(cssModeTimeout); cssModeTimeout = setTimeout(() => { update(); }, 100); } else { update(); } }); on('init update resize', () => { if (!swiper.params.virtual.enabled) return; if (swiper.params.cssMode) { setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`); } }); Object.assign(swiper.virtual, { appendSlide, prependSlide, removeSlide, removeAllSlides, update }); } /* eslint-disable consistent-return */ function Keyboard(_ref) { let { swiper, extendParams, on, emit } = _ref; const document = getDocument(); const window = getWindow(); swiper.keyboard = { enabled: false }; extendParams({ keyboard: { enabled: false, onlyInViewport: true, pageUpDown: true } }); function handle(event) { if (!swiper.enabled) return; const { rtlTranslate: rtl } = swiper; let e = event; if (e.originalEvent) e = e.originalEvent; // jquery fix const kc = e.keyCode || e.charCode; const pageUpDown = swiper.params.keyboard.pageUpDown; const isPageUp = pageUpDown && kc === 33; const isPageDown = pageUpDown && kc === 34; const isArrowLeft = kc === 37; const isArrowRight = kc === 39; const isArrowUp = kc === 38; const isArrowDown = kc === 40; // Directions locks if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { return false; } if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { return false; } if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { return undefined; } if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { return undefined; } if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { let inView = false; // Check that swiper should be inside of visible area of window if (swiper.$el.parents(`.${swiper.params.slideClass}`).length > 0 && swiper.$el.parents(`.${swiper.params.slideActiveClass}`).length === 0) { return undefined; } const $el = swiper.$el; const swiperWidth = $el[0].clientWidth; const swiperHeight = $el[0].clientHeight; const windowWidth = window.innerWidth; const windowHeight = window.innerHeight; const swiperOffset = swiper.$el.offset(); if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; for (let i = 0; i < swiperCoord.length; i += 1) { const point = swiperCoord[i]; if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line inView = true; } } if (!inView) return undefined; } if (swiper.isHorizontal()) { if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { if (e.preventDefault) e.preventDefault();else e.returnValue = false; } if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); } else { if (isPageUp || isPageDown || isArrowUp || isArrowDown) { if (e.preventDefault) e.preventDefault();else e.returnValue = false; } if (isPageDown || isArrowDown) swiper.slideNext(); if (isPageUp || isArrowUp) swiper.slidePrev(); } emit('keyPress', kc); return undefined; } function enable() { if (swiper.keyboard.enabled) return; $(document).on('keydown', handle); swiper.keyboard.enabled = true; } function disable() { if (!swiper.keyboard.enabled) return; $(document).off('keydown', handle); swiper.keyboard.enabled = false; } on('init', () => { if (swiper.params.keyboard.enabled) { enable(); } }); on('destroy', () => { if (swiper.keyboard.enabled) { disable(); } }); Object.assign(swiper.keyboard, { enable, disable }); } /* eslint-disable consistent-return */ function Mousewheel(_ref) { let { swiper, extendParams, on, emit } = _ref; const window = getWindow(); extendParams({ mousewheel: { enabled: false, releaseOnEdges: false, invert: false, forceToAxis: false, sensitivity: 1, eventsTarget: 'container', thresholdDelta: null, thresholdTime: null } }); swiper.mousewheel = { enabled: false }; let timeout; let lastScrollTime = now(); let lastEventBeforeSnap; const recentWheelEvents = []; function normalize(e) { // Reasonable defaults const PIXEL_STEP = 10; const LINE_HEIGHT = 40; const PAGE_HEIGHT = 800; let sX = 0; let sY = 0; // spinX, spinY let pX = 0; let pY = 0; // pixelX, pixelY // Legacy if ('detail' in e) { sY = e.detail; } if ('wheelDelta' in e) { sY = -e.wheelDelta / 120; } if ('wheelDeltaY' in e) { sY = -e.wheelDeltaY / 120; } if ('wheelDeltaX' in e) { sX = -e.wheelDeltaX / 120; } // side scrolling on FF with DOMMouseScroll if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in e) { pY = e.deltaY; } if ('deltaX' in e) { pX = e.deltaX; } if (e.shiftKey && !pX) { // if user scrolls with shift he wants horizontal scroll pX = pY; pY = 0; } if ((pX || pY) && e.deltaMode) { if (e.deltaMode === 1) { // delta in LINE units pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { // delta in PAGE units pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } // Fall-back if spin cannot be determined if (pX && !sX) { sX = pX < 1 ? -1 : 1; } if (pY && !sY) { sY = pY < 1 ? -1 : 1; } return { spinX: sX, spinY: sY, pixelX: pX, pixelY: pY }; } function handleMouseEnter() { if (!swiper.enabled) return; swiper.mouseEntered = true; } function handleMouseLeave() { if (!swiper.enabled) return; swiper.mouseEntered = false; } function animateSlider(newEvent) { if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { // Prevent if delta of wheel scroll delta is below configured threshold return false; } if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { // Prevent if time between scrolls is below configured threshold return false; } // If the movement is NOT big enough and // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): // Don't go any further (avoid insignificant scroll movement). if (newEvent.delta >= 6 && now() - lastScrollTime < 60) { // Return false as a default return true; } // If user is scrolling towards the end: // If the slider hasn't hit the latest slide or // if the slider is a loop and // if the slider isn't moving right now: // Go to next slide and // emit a scroll event. // Else (the user is scrolling towards the beginning) and // if the slider hasn't hit the first slide or // if the slider is a loop and // if the slider isn't moving right now: // Go to prev slide and // emit a scroll event. if (newEvent.direction < 0) { if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { swiper.slideNext(); emit('scroll', newEvent.raw); } } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { swiper.slidePrev(); emit('scroll', newEvent.raw); } // If you got here is because an animation has been triggered so store the current time lastScrollTime = new window.Date().getTime(); // Return false as a default return false; } function releaseScroll(newEvent) { const params = swiper.params.mousewheel; if (newEvent.direction < 0) { if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { // Return true to animate scroll on edges return true; } } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { // Return true to animate scroll on edges return true; } return false; } function handle(event) { let e = event; let disableParentSwiper = true; if (!swiper.enabled) return; const params = swiper.params.mousewheel; if (swiper.params.cssMode) { e.preventDefault(); } let target = swiper.$el; if (swiper.params.mousewheel.eventsTarget !== 'container') { target = $(swiper.params.mousewheel.eventsTarget); } if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true; if (e.originalEvent) e = e.originalEvent; // jquery fix let delta = 0; const rtlFactor = swiper.rtlTranslate ? -1 : 1; const data = normalize(e); if (params.forceToAxis) { if (swiper.isHorizontal()) { if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; } else { delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; } if (delta === 0) return true; if (params.invert) delta = -delta; // Get the scroll positions let positions = swiper.getTranslate() + delta * params.sensitivity; if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); // When loop is true: // the disableParentSwiper will be true. // When loop is false: // if the scroll positions is not on edge, // then the disableParentSwiper will be true. // if the scroll on edge positions, // then the disableParentSwiper will be false. disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { // Register the new event in a variable which stores the relevant data const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta), raw: event }; // Keep the most recent events if (recentWheelEvents.length >= 2) { recentWheelEvents.shift(); // only store the last N events } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; recentWheelEvents.push(newEvent); // If there is at least one previous recorded event: // If direction has changed or // if the scroll is quicker than the previous one: // Animate the slider. // Else (this is the first time the wheel is moved): // Animate the slider. if (prevEvent) { if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { animateSlider(newEvent); } } else { animateSlider(newEvent); } // If it's time to release the scroll: // Return now so you don't hit the preventDefault. if (releaseScroll(newEvent)) { return true; } } else { // Freemode or scrollContainer: // If we recently snapped after a momentum scroll, then ignore wheel events // to give time for the deceleration to finish. Stop ignoring after 500 msecs // or if it's a new scroll (larger delta or inverse sign as last event before // an end-of-momentum snap). const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta) }; const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; if (!ignoreWheelEvents) { lastEventBeforeSnap = undefined; if (swiper.params.loop) { swiper.loopFix(); } let position = swiper.getTranslate() + delta * params.sensitivity; const wasBeginning = swiper.isBeginning; const wasEnd = swiper.isEnd; if (position >= swiper.minTranslate()) position = swiper.minTranslate(); if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); swiper.setTransition(0); swiper.setTranslate(position); swiper.updateProgress(); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { swiper.updateSlidesClasses(); } if (swiper.params.freeMode.sticky) { // When wheel scrolling starts with sticky (aka snap) enabled, then detect // the end of a momentum scroll by storing recent (N=15?) wheel events. // 1. do all N events have decreasing or same (absolute value) delta? // 2. did all N events arrive in the last M (M=500?) msecs? // 3. does the earliest event have an (absolute value) delta that's // at least P (P=1?) larger than the most recent event's delta? // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. // Snap immediately and ignore remaining wheel events in this scroll. // See comment above for "remaining wheel events in this scroll" determination. // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. clearTimeout(timeout); timeout = undefined; if (recentWheelEvents.length >= 15) { recentWheelEvents.shift(); // only store the last N events } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; const firstEvent = recentWheelEvents[0]; recentWheelEvents.push(newEvent); if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. recentWheelEvents.splice(0); } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { // We're at the end of the deceleration of a momentum scroll, so there's no need // to wait for more events. Snap ASAP on the next tick. // Also, because there's some remaining momentum we'll bias the snap in the // direction of the ongoing scroll because it's better UX for the scroll to snap // in the same direction as the scroll instead of reversing to snap. Therefore, // if it's already scrolled more than 20% in the current direction, keep going. const snapToThreshold = delta > 0 ? 0.8 : 0.2; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); timeout = nextTick(() => { swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 0); // no delay; move on next tick } if (!timeout) { // if we get here, then we haven't detected the end of a momentum scroll, so // we'll consider a scroll "complete" when there haven't been any wheel events // for 500ms. timeout = nextTick(() => { const snapToThreshold = 0.5; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 500); } } // Emit event if (!ignoreWheelEvents) emit('scroll', e); // Stop autoplay if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true; } } if (e.preventDefault) e.preventDefault();else e.returnValue = false; return false; } function events(method) { let target = swiper.$el; if (swiper.params.mousewheel.eventsTarget !== 'container') { target = $(swiper.params.mousewheel.eventsTarget); } target[method]('mouseenter', handleMouseEnter); target[method]('mouseleave', handleMouseLeave); target[method]('wheel', handle); } function enable() { if (swiper.params.cssMode) { swiper.wrapperEl.removeEventListener('wheel', handle); return true; } if (swiper.mousewheel.enabled) return false; events('on'); swiper.mousewheel.enabled = true; return true; } function disable() { if (swiper.params.cssMode) { swiper.wrapperEl.addEventListener(event, handle); return true; } if (!swiper.mousewheel.enabled) return false; events('off'); swiper.mousewheel.enabled = false; return true; } on('init', () => { if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { disable(); } if (swiper.params.mousewheel.enabled) enable(); }); on('destroy', () => { if (swiper.params.cssMode) { enable(); } if (swiper.mousewheel.enabled) disable(); }); Object.assign(swiper.mousewheel, { enable, disable }); } function createElementIfNotDefined(swiper, originalParams, params, checkProps) { const document = getDocument(); if (swiper.params.createElements) { Object.keys(checkProps).forEach(key => { if (!params[key] && params.auto === true) { let element = swiper.$el.children(`.${checkProps[key]}`)[0]; if (!element) { element = document.createElement('div'); element.className = checkProps[key]; swiper.$el.append(element); } params[key] = element; originalParams[key] = element; } }); } return params; } function Navigation(_ref) { let { swiper, extendParams, on, emit } = _ref; extendParams({ navigation: { nextEl: null, prevEl: null, hideOnClick: false, disabledClass: 'swiper-button-disabled', hiddenClass: 'swiper-button-hidden', lockClass: 'swiper-button-lock', navigationDisabledClass: 'swiper-navigation-disabled' } }); swiper.navigation = { nextEl: null, $nextEl: null, prevEl: null, $prevEl: null }; function getEl(el) { let $el; if (el) { $el = $(el); if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) { $el = swiper.$el.find(el); } } return $el; } function toggleEl($el, disabled) { const params = swiper.params.navigation; if ($el && $el.length > 0) { $el[disabled ? 'addClass' : 'removeClass'](params.disabledClass); if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled; if (swiper.params.watchOverflow && swiper.enabled) { $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); } } } function update() { // Update Navigation Buttons if (swiper.params.loop) return; const { $nextEl, $prevEl } = swiper.navigation; toggleEl($prevEl, swiper.isBeginning && !swiper.params.rewind); toggleEl($nextEl, swiper.isEnd && !swiper.params.rewind); } function onPrevClick(e) { e.preventDefault(); if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; swiper.slidePrev(); emit('navigationPrev'); } function onNextClick(e) { e.preventDefault(); if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; swiper.slideNext(); emit('navigationNext'); } function init() { const params = swiper.params.navigation; swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { nextEl: 'swiper-button-next', prevEl: 'swiper-button-prev' }); if (!(params.nextEl || params.prevEl)) return; const $nextEl = getEl(params.nextEl); const $prevEl = getEl(params.prevEl); if ($nextEl && $nextEl.length > 0) { $nextEl.on('click', onNextClick); } if ($prevEl && $prevEl.length > 0) { $prevEl.on('click', onPrevClick); } Object.assign(swiper.navigation, { $nextEl, nextEl: $nextEl && $nextEl[0], $prevEl, prevEl: $prevEl && $prevEl[0] }); if (!swiper.enabled) { if ($nextEl) $nextEl.addClass(params.lockClass); if ($prevEl) $prevEl.addClass(params.lockClass); } } function destroy() { const { $nextEl, $prevEl } = swiper.navigation; if ($nextEl && $nextEl.length) { $nextEl.off('click', onNextClick); $nextEl.removeClass(swiper.params.navigation.disabledClass); } if ($prevEl && $prevEl.length) { $prevEl.off('click', onPrevClick); $prevEl.removeClass(swiper.params.navigation.disabledClass); } } on('init', () => { if (swiper.params.navigation.enabled === false) { // eslint-disable-next-line disable(); } else { init(); update(); } }); on('toEdge fromEdge lock unlock', () => { update(); }); on('destroy', () => { destroy(); }); on('enable disable', () => { const { $nextEl, $prevEl } = swiper.navigation; if ($nextEl) { $nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); } if ($prevEl) { $prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); } }); on('click', (_s, e) => { const { $nextEl, $prevEl } = swiper.navigation; const targetEl = e.target; if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) { if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; let isHidden; if ($nextEl) { isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass); } else if ($prevEl) { isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass); } if (isHidden === true) { emit('navigationShow'); } else { emit('navigationHide'); } if ($nextEl) { $nextEl.toggleClass(swiper.params.navigation.hiddenClass); } if ($prevEl) { $prevEl.toggleClass(swiper.params.navigation.hiddenClass); } } }); const enable = () => { swiper.$el.removeClass(swiper.params.navigation.navigationDisabledClass); init(); update(); }; const disable = () => { swiper.$el.addClass(swiper.params.navigation.navigationDisabledClass); destroy(); }; Object.assign(swiper.navigation, { enable, disable, update, init, destroy }); } function classesToSelector(classes) { if (classes === void 0) { classes = ''; } return `.${classes.trim().replace(/([\.:!\/])/g, '\\$1') // eslint-disable-line .replace(/ /g, '.')}`; } function Pagination(_ref) { let { swiper, extendParams, on, emit } = _ref; const pfx = 'swiper-pagination'; extendParams({ pagination: { el: null, bulletElement: 'span', clickable: false, hideOnClick: false, renderBullet: null, renderProgressbar: null, renderFraction: null, renderCustom: null, progressbarOpposite: false, type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom' dynamicBullets: false, dynamicMainBullets: 1, formatFractionCurrent: number => number, formatFractionTotal: number => number, bulletClass: `${pfx}-bullet`, bulletActiveClass: `${pfx}-bullet-active`, modifierClass: `${pfx}-`, currentClass: `${pfx}-current`, totalClass: `${pfx}-total`, hiddenClass: `${pfx}-hidden`, progressbarFillClass: `${pfx}-progressbar-fill`, progressbarOppositeClass: `${pfx}-progressbar-opposite`, clickableClass: `${pfx}-clickable`, lockClass: `${pfx}-lock`, horizontalClass: `${pfx}-horizontal`, verticalClass: `${pfx}-vertical`, paginationDisabledClass: `${pfx}-disabled` } }); swiper.pagination = { el: null, $el: null, bullets: [] }; let bulletSize; let dynamicBulletIndex = 0; function isPaginationDisabled() { return !swiper.params.pagination.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0; } function setSideBullets($bulletEl, position) { const { bulletActiveClass } = swiper.params.pagination; $bulletEl[position]().addClass(`${bulletActiveClass}-${position}`)[position]().addClass(`${bulletActiveClass}-${position}-${position}`); } function update() { // Render || Update Pagination bullets/items const rtl = swiper.rtl; const params = swiper.params.pagination; if (isPaginationDisabled()) return; const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; const $el = swiper.pagination.$el; // Current/Total let current; const total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; if (swiper.params.loop) { current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup); if (current > slidesLength - 1 - swiper.loopedSlides * 2) { current -= slidesLength - swiper.loopedSlides * 2; } if (current > total - 1) current -= total; if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current; } else if (typeof swiper.snapIndex !== 'undefined') { current = swiper.snapIndex; } else { current = swiper.activeIndex || 0; } // Types if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { const bullets = swiper.pagination.bullets; let firstIndex; let lastIndex; let midIndex; if (params.dynamicBullets) { bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true); $el.css(swiper.isHorizontal() ? 'width' : 'height', `${bulletSize * (params.dynamicMainBullets + 4)}px`); if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) { dynamicBulletIndex += current - (swiper.previousIndex - swiper.loopedSlides || 0); if (dynamicBulletIndex > params.dynamicMainBullets - 1) { dynamicBulletIndex = params.dynamicMainBullets - 1; } else if (dynamicBulletIndex < 0) { dynamicBulletIndex = 0; } } firstIndex = Math.max(current - dynamicBulletIndex, 0); lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); midIndex = (lastIndex + firstIndex) / 2; } bullets.removeClass(['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`).join(' ')); if ($el.length > 1) { bullets.each(bullet => { const $bullet = $(bullet); const bulletIndex = $bullet.index(); if (bulletIndex === current) { $bullet.addClass(params.bulletActiveClass); } if (params.dynamicBullets) { if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { $bullet.addClass(`${params.bulletActiveClass}-main`); } if (bulletIndex === firstIndex) { setSideBullets($bullet, 'prev'); } if (bulletIndex === lastIndex) { setSideBullets($bullet, 'next'); } } }); } else { const $bullet = bullets.eq(current); const bulletIndex = $bullet.index(); $bullet.addClass(params.bulletActiveClass); if (params.dynamicBullets) { const $firstDisplayedBullet = bullets.eq(firstIndex); const $lastDisplayedBullet = bullets.eq(lastIndex); for (let i = firstIndex; i <= lastIndex; i += 1) { bullets.eq(i).addClass(`${params.bulletActiveClass}-main`); } if (swiper.params.loop) { if (bulletIndex >= bullets.length) { for (let i = params.dynamicMainBullets; i >= 0; i -= 1) { bullets.eq(bullets.length - i).addClass(`${params.bulletActiveClass}-main`); } bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(`${params.bulletActiveClass}-prev`); } else { setSideBullets($firstDisplayedBullet, 'prev'); setSideBullets($lastDisplayedBullet, 'next'); } } else { setSideBullets($firstDisplayedBullet, 'prev'); setSideBullets($lastDisplayedBullet, 'next'); } } } if (params.dynamicBullets) { const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; const offsetProp = rtl ? 'right' : 'left'; bullets.css(swiper.isHorizontal() ? offsetProp : 'top', `${bulletsOffset}px`); } } if (params.type === 'fraction') { $el.find(classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1)); $el.find(classesToSelector(params.totalClass)).text(params.formatFractionTotal(total)); } if (params.type === 'progressbar') { let progressbarDirection; if (params.progressbarOpposite) { progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; } else { progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; } const scale = (current + 1) / total; let scaleX = 1; let scaleY = 1; if (progressbarDirection === 'horizontal') { scaleX = scale; } else { scaleY = scale; } $el.find(classesToSelector(params.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`).transition(swiper.params.speed); } if (params.type === 'custom' && params.renderCustom) { $el.html(params.renderCustom(swiper, current + 1, total)); emit('paginationRender', $el[0]); } else { emit('paginationUpdate', $el[0]); } if (swiper.params.watchOverflow && swiper.enabled) { $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); } } function render() { // Render Container const params = swiper.params.pagination; if (isPaginationDisabled()) return; const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; const $el = swiper.pagination.$el; let paginationHTML = ''; if (params.type === 'bullets') { let numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.loop && numberOfBullets > slidesLength) { numberOfBullets = slidesLength; } for (let i = 0; i < numberOfBullets; i += 1) { if (params.renderBullet) { paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); } else { paginationHTML += `<${params.bulletElement} class="${params.bulletClass}">`; } } $el.html(paginationHTML); swiper.pagination.bullets = $el.find(classesToSelector(params.bulletClass)); } if (params.type === 'fraction') { if (params.renderFraction) { paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); } else { paginationHTML = `` + ' / ' + ``; } $el.html(paginationHTML); } if (params.type === 'progressbar') { if (params.renderProgressbar) { paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); } else { paginationHTML = ``; } $el.html(paginationHTML); } if (params.type !== 'custom') { emit('paginationRender', swiper.pagination.$el[0]); } } function init() { swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { el: 'swiper-pagination' }); const params = swiper.params.pagination; if (!params.el) return; let $el = $(params.el); if ($el.length === 0) return; if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) { $el = swiper.$el.find(params.el); // check if it belongs to another nested Swiper if ($el.length > 1) { $el = $el.filter(el => { if ($(el).parents('.swiper')[0] !== swiper.el) return false; return true; }); } } if (params.type === 'bullets' && params.clickable) { $el.addClass(params.clickableClass); } $el.addClass(params.modifierClass + params.type); $el.addClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); if (params.type === 'bullets' && params.dynamicBullets) { $el.addClass(`${params.modifierClass}${params.type}-dynamic`); dynamicBulletIndex = 0; if (params.dynamicMainBullets < 1) { params.dynamicMainBullets = 1; } } if (params.type === 'progressbar' && params.progressbarOpposite) { $el.addClass(params.progressbarOppositeClass); } if (params.clickable) { $el.on('click', classesToSelector(params.bulletClass), function onClick(e) { e.preventDefault(); let index = $(this).index() * swiper.params.slidesPerGroup; if (swiper.params.loop) index += swiper.loopedSlides; swiper.slideTo(index); }); } Object.assign(swiper.pagination, { $el, el: $el[0] }); if (!swiper.enabled) { $el.addClass(params.lockClass); } } function destroy() { const params = swiper.params.pagination; if (isPaginationDisabled()) return; const $el = swiper.pagination.$el; $el.removeClass(params.hiddenClass); $el.removeClass(params.modifierClass + params.type); $el.removeClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); if (swiper.pagination.bullets && swiper.pagination.bullets.removeClass) swiper.pagination.bullets.removeClass(params.bulletActiveClass); if (params.clickable) { $el.off('click', classesToSelector(params.bulletClass)); } } on('init', () => { if (swiper.params.pagination.enabled === false) { // eslint-disable-next-line disable(); } else { init(); render(); update(); } }); on('activeIndexChange', () => { if (swiper.params.loop) { update(); } else if (typeof swiper.snapIndex === 'undefined') { update(); } }); on('snapIndexChange', () => { if (!swiper.params.loop) { update(); } }); on('slidesLengthChange', () => { if (swiper.params.loop) { render(); update(); } }); on('snapGridLengthChange', () => { if (!swiper.params.loop) { render(); update(); } }); on('destroy', () => { destroy(); }); on('enable disable', () => { const { $el } = swiper.pagination; if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.pagination.lockClass); } }); on('lock unlock', () => { update(); }); on('click', (_s, e) => { const targetEl = e.target; const { $el } = swiper.pagination; if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && $el && $el.length > 0 && !$(targetEl).hasClass(swiper.params.pagination.bulletClass)) { if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; const isHidden = $el.hasClass(swiper.params.pagination.hiddenClass); if (isHidden === true) { emit('paginationShow'); } else { emit('paginationHide'); } $el.toggleClass(swiper.params.pagination.hiddenClass); } }); const enable = () => { swiper.$el.removeClass(swiper.params.pagination.paginationDisabledClass); if (swiper.pagination.$el) { swiper.pagination.$el.removeClass(swiper.params.pagination.paginationDisabledClass); } init(); render(); update(); }; const disable = () => { swiper.$el.addClass(swiper.params.pagination.paginationDisabledClass); if (swiper.pagination.$el) { swiper.pagination.$el.addClass(swiper.params.pagination.paginationDisabledClass); } destroy(); }; Object.assign(swiper.pagination, { enable, disable, render, update, init, destroy }); } function Scrollbar(_ref) { let { swiper, extendParams, on, emit } = _ref; const document = getDocument(); let isTouched = false; let timeout = null; let dragTimeout = null; let dragStartPos; let dragSize; let trackSize; let divider; extendParams({ scrollbar: { el: null, dragSize: 'auto', hide: false, draggable: false, snapOnRelease: true, lockClass: 'swiper-scrollbar-lock', dragClass: 'swiper-scrollbar-drag', scrollbarDisabledClass: 'swiper-scrollbar-disabled', horizontalClass: `swiper-scrollbar-horizontal`, verticalClass: `swiper-scrollbar-vertical` } }); swiper.scrollbar = { el: null, dragEl: null, $el: null, $dragEl: null }; function setTranslate() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; const { scrollbar, rtlTranslate: rtl, progress } = swiper; const { $dragEl, $el } = scrollbar; const params = swiper.params.scrollbar; let newSize = dragSize; let newPos = (trackSize - dragSize) * progress; if (rtl) { newPos = -newPos; if (newPos > 0) { newSize = dragSize - newPos; newPos = 0; } else if (-newPos + dragSize > trackSize) { newSize = trackSize + newPos; } } else if (newPos < 0) { newSize = dragSize + newPos; newPos = 0; } else if (newPos + dragSize > trackSize) { newSize = trackSize - newPos; } if (swiper.isHorizontal()) { $dragEl.transform(`translate3d(${newPos}px, 0, 0)`); $dragEl[0].style.width = `${newSize}px`; } else { $dragEl.transform(`translate3d(0px, ${newPos}px, 0)`); $dragEl[0].style.height = `${newSize}px`; } if (params.hide) { clearTimeout(timeout); $el[0].style.opacity = 1; timeout = setTimeout(() => { $el[0].style.opacity = 0; $el.transition(400); }, 1000); } } function setTransition(duration) { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; swiper.scrollbar.$dragEl.transition(duration); } function updateSize() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; const { scrollbar } = swiper; const { $dragEl, $el } = scrollbar; $dragEl[0].style.width = ''; $dragEl[0].style.height = ''; trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight; divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); if (swiper.params.scrollbar.dragSize === 'auto') { dragSize = trackSize * divider; } else { dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); } if (swiper.isHorizontal()) { $dragEl[0].style.width = `${dragSize}px`; } else { $dragEl[0].style.height = `${dragSize}px`; } if (divider >= 1) { $el[0].style.display = 'none'; } else { $el[0].style.display = ''; } if (swiper.params.scrollbar.hide) { $el[0].style.opacity = 0; } if (swiper.params.watchOverflow && swiper.enabled) { scrollbar.$el[swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass); } } function getPointerPosition(e) { if (swiper.isHorizontal()) { return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX; } return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY; } function setDragPosition(e) { const { scrollbar, rtlTranslate: rtl } = swiper; const { $el } = scrollbar; let positionRatio; positionRatio = (getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); positionRatio = Math.max(Math.min(positionRatio, 1), 0); if (rtl) { positionRatio = 1 - positionRatio; } const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; swiper.updateProgress(position); swiper.setTranslate(position); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } function onDragStart(e) { const params = swiper.params.scrollbar; const { scrollbar, $wrapperEl } = swiper; const { $el, $dragEl } = scrollbar; isTouched = true; dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; e.preventDefault(); e.stopPropagation(); $wrapperEl.transition(100); $dragEl.transition(100); setDragPosition(e); clearTimeout(dragTimeout); $el.transition(0); if (params.hide) { $el.css('opacity', 1); } if (swiper.params.cssMode) { swiper.$wrapperEl.css('scroll-snap-type', 'none'); } emit('scrollbarDragStart', e); } function onDragMove(e) { const { scrollbar, $wrapperEl } = swiper; const { $el, $dragEl } = scrollbar; if (!isTouched) return; if (e.preventDefault) e.preventDefault();else e.returnValue = false; setDragPosition(e); $wrapperEl.transition(0); $el.transition(0); $dragEl.transition(0); emit('scrollbarDragMove', e); } function onDragEnd(e) { const params = swiper.params.scrollbar; const { scrollbar, $wrapperEl } = swiper; const { $el } = scrollbar; if (!isTouched) return; isTouched = false; if (swiper.params.cssMode) { swiper.$wrapperEl.css('scroll-snap-type', ''); $wrapperEl.transition(''); } if (params.hide) { clearTimeout(dragTimeout); dragTimeout = nextTick(() => { $el.css('opacity', 0); $el.transition(400); }, 1000); } emit('scrollbarDragEnd', e); if (params.snapOnRelease) { swiper.slideToClosest(); } } function events(method) { const { scrollbar, touchEventsTouch, touchEventsDesktop, params, support } = swiper; const $el = scrollbar.$el; if (!$el) return; const target = $el[0]; const activeListener = support.passiveListener && params.passiveListeners ? { passive: false, capture: false } : false; const passiveListener = support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; if (!target) return; const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; if (!support.touch) { target[eventMethod](touchEventsDesktop.start, onDragStart, activeListener); document[eventMethod](touchEventsDesktop.move, onDragMove, activeListener); document[eventMethod](touchEventsDesktop.end, onDragEnd, passiveListener); } else { target[eventMethod](touchEventsTouch.start, onDragStart, activeListener); target[eventMethod](touchEventsTouch.move, onDragMove, activeListener); target[eventMethod](touchEventsTouch.end, onDragEnd, passiveListener); } } function enableDraggable() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; events('on'); } function disableDraggable() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; events('off'); } function init() { const { scrollbar, $el: $swiperEl } = swiper; swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { el: 'swiper-scrollbar' }); const params = swiper.params.scrollbar; if (!params.el) return; let $el = $(params.el); if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) { $el = $swiperEl.find(params.el); } $el.addClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); let $dragEl = $el.find(`.${swiper.params.scrollbar.dragClass}`); if ($dragEl.length === 0) { $dragEl = $(`
    `); $el.append($dragEl); } Object.assign(scrollbar, { $el, el: $el[0], $dragEl, dragEl: $dragEl[0] }); if (params.draggable) { enableDraggable(); } if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); } } function destroy() { const params = swiper.params.scrollbar; const $el = swiper.scrollbar.$el; if ($el) { $el.removeClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); } disableDraggable(); } on('init', () => { if (swiper.params.scrollbar.enabled === false) { // eslint-disable-next-line disable(); } else { init(); updateSize(); setTranslate(); } }); on('update resize observerUpdate lock unlock', () => { updateSize(); }); on('setTranslate', () => { setTranslate(); }); on('setTransition', (_s, duration) => { setTransition(duration); }); on('enable disable', () => { const { $el } = swiper.scrollbar; if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); } }); on('destroy', () => { destroy(); }); const enable = () => { swiper.$el.removeClass(swiper.params.scrollbar.scrollbarDisabledClass); if (swiper.scrollbar.$el) { swiper.scrollbar.$el.removeClass(swiper.params.scrollbar.scrollbarDisabledClass); } init(); updateSize(); setTranslate(); }; const disable = () => { swiper.$el.addClass(swiper.params.scrollbar.scrollbarDisabledClass); if (swiper.scrollbar.$el) { swiper.scrollbar.$el.addClass(swiper.params.scrollbar.scrollbarDisabledClass); } destroy(); }; Object.assign(swiper.scrollbar, { enable, disable, updateSize, setTranslate, init, destroy }); } function Parallax(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ parallax: { enabled: false } }); const setTransform = (el, progress) => { const { rtl } = swiper; const $el = $(el); const rtlFactor = rtl ? -1 : 1; const p = $el.attr('data-swiper-parallax') || '0'; let x = $el.attr('data-swiper-parallax-x'); let y = $el.attr('data-swiper-parallax-y'); const scale = $el.attr('data-swiper-parallax-scale'); const opacity = $el.attr('data-swiper-parallax-opacity'); if (x || y) { x = x || '0'; y = y || '0'; } else if (swiper.isHorizontal()) { x = p; y = '0'; } else { y = p; x = '0'; } if (x.indexOf('%') >= 0) { x = `${parseInt(x, 10) * progress * rtlFactor}%`; } else { x = `${x * progress * rtlFactor}px`; } if (y.indexOf('%') >= 0) { y = `${parseInt(y, 10) * progress}%`; } else { y = `${y * progress}px`; } if (typeof opacity !== 'undefined' && opacity !== null) { const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress)); $el[0].style.opacity = currentOpacity; } if (typeof scale === 'undefined' || scale === null) { $el.transform(`translate3d(${x}, ${y}, 0px)`); } else { const currentScale = scale - (scale - 1) * (1 - Math.abs(progress)); $el.transform(`translate3d(${x}, ${y}, 0px) scale(${currentScale})`); } }; const setTranslate = () => { const { $el, slides, progress, snapGrid } = swiper; $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(el => { setTransform(el, progress); }); slides.each((slideEl, slideIndex) => { let slideProgress = slideEl.progress; if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') { slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1); } slideProgress = Math.min(Math.max(slideProgress, -1), 1); $(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(el => { setTransform(el, slideProgress); }); }); }; const setTransition = function (duration) { if (duration === void 0) { duration = swiper.params.speed; } const { $el } = swiper; $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(parallaxEl => { const $parallaxEl = $(parallaxEl); let parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration; if (duration === 0) parallaxDuration = 0; $parallaxEl.transition(parallaxDuration); }); }; on('beforeInit', () => { if (!swiper.params.parallax.enabled) return; swiper.params.watchSlidesProgress = true; swiper.originalParams.watchSlidesProgress = true; }); on('init', () => { if (!swiper.params.parallax.enabled) return; setTranslate(); }); on('setTranslate', () => { if (!swiper.params.parallax.enabled) return; setTranslate(); }); on('setTransition', (_swiper, duration) => { if (!swiper.params.parallax.enabled) return; setTransition(duration); }); } function Zoom(_ref) { let { swiper, extendParams, on, emit } = _ref; const window = getWindow(); extendParams({ zoom: { enabled: false, maxRatio: 3, minRatio: 1, toggle: true, containerClass: 'swiper-zoom-container', zoomedSlideClass: 'swiper-slide-zoomed' } }); swiper.zoom = { enabled: false }; let currentScale = 1; let isScaling = false; let gesturesEnabled; let fakeGestureTouched; let fakeGestureMoved; const gesture = { $slideEl: undefined, slideWidth: undefined, slideHeight: undefined, $imageEl: undefined, $imageWrapEl: undefined, maxRatio: 3 }; const image = { isTouched: undefined, isMoved: undefined, currentX: undefined, currentY: undefined, minX: undefined, minY: undefined, maxX: undefined, maxY: undefined, width: undefined, height: undefined, startX: undefined, startY: undefined, touchesStart: {}, touchesCurrent: {} }; const velocity = { x: undefined, y: undefined, prevPositionX: undefined, prevPositionY: undefined, prevTime: undefined }; let scale = 1; Object.defineProperty(swiper.zoom, 'scale', { get() { return scale; }, set(value) { if (scale !== value) { const imageEl = gesture.$imageEl ? gesture.$imageEl[0] : undefined; const slideEl = gesture.$slideEl ? gesture.$slideEl[0] : undefined; emit('zoomChange', value, imageEl, slideEl); } scale = value; } }); function getDistanceBetweenTouches(e) { if (e.targetTouches.length < 2) return 1; const x1 = e.targetTouches[0].pageX; const y1 = e.targetTouches[0].pageY; const x2 = e.targetTouches[1].pageX; const y2 = e.targetTouches[1].pageY; const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2); return distance; } // Events function onGestureStart(e) { const support = swiper.support; const params = swiper.params.zoom; fakeGestureTouched = false; fakeGestureMoved = false; if (!support.gestures) { if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) { return; } fakeGestureTouched = true; gesture.scaleStart = getDistanceBetweenTouches(e); } if (!gesture.$slideEl || !gesture.$slideEl.length) { gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`); if (gesture.$slideEl.length === 0) gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; if (gesture.$imageWrapEl.length === 0) { gesture.$imageEl = undefined; return; } } if (gesture.$imageEl) { gesture.$imageEl.transition(0); } isScaling = true; } function onGestureChange(e) { const support = swiper.support; const params = swiper.params.zoom; const zoom = swiper.zoom; if (!support.gestures) { if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) { return; } fakeGestureMoved = true; gesture.scaleMove = getDistanceBetweenTouches(e); } if (!gesture.$imageEl || gesture.$imageEl.length === 0) { if (e.type === 'gesturechange') onGestureStart(e); return; } if (support.gestures) { zoom.scale = e.scale * currentScale; } else { zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale; } if (zoom.scale > gesture.maxRatio) { zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5; } if (zoom.scale < params.minRatio) { zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5; } gesture.$imageEl.transform(`translate3d(0,0,0) scale(${zoom.scale})`); } function onGestureEnd(e) { const device = swiper.device; const support = swiper.support; const params = swiper.params.zoom; const zoom = swiper.zoom; if (!support.gestures) { if (!fakeGestureTouched || !fakeGestureMoved) { return; } if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2 && !device.android) { return; } fakeGestureTouched = false; fakeGestureMoved = false; } if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); gesture.$imageEl.transition(swiper.params.speed).transform(`translate3d(0,0,0) scale(${zoom.scale})`); currentScale = zoom.scale; isScaling = false; if (zoom.scale === 1) gesture.$slideEl = undefined; } function onTouchStart(e) { const device = swiper.device; if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; if (image.isTouched) return; if (device.android && e.cancelable) e.preventDefault(); image.isTouched = true; image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; } function onTouchMove(e) { const zoom = swiper.zoom; if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; swiper.allowClick = false; if (!image.isTouched || !gesture.$slideEl) return; if (!image.isMoved) { image.width = gesture.$imageEl[0].offsetWidth; image.height = gesture.$imageEl[0].offsetHeight; image.startX = getTranslate(gesture.$imageWrapEl[0], 'x') || 0; image.startY = getTranslate(gesture.$imageWrapEl[0], 'y') || 0; gesture.slideWidth = gesture.$slideEl[0].offsetWidth; gesture.slideHeight = gesture.$slideEl[0].offsetHeight; gesture.$imageWrapEl.transition(0); } // Define if we need image drag const scaledWidth = image.width * zoom.scale; const scaledHeight = image.height * zoom.scale; if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return; image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); image.maxX = -image.minX; image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); image.maxY = -image.minY; image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; if (!image.isMoved && !isScaling) { if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) { image.isTouched = false; return; } if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) { image.isTouched = false; return; } } if (e.cancelable) { e.preventDefault(); } e.stopPropagation(); image.isMoved = true; image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX; image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY; if (image.currentX < image.minX) { image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8; } if (image.currentX > image.maxX) { image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8; } if (image.currentY < image.minY) { image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8; } if (image.currentY > image.maxY) { image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8; } // Velocity if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x; if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y; if (!velocity.prevTime) velocity.prevTime = Date.now(); velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0; if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0; velocity.prevPositionX = image.touchesCurrent.x; velocity.prevPositionY = image.touchesCurrent.y; velocity.prevTime = Date.now(); gesture.$imageWrapEl.transform(`translate3d(${image.currentX}px, ${image.currentY}px,0)`); } function onTouchEnd() { const zoom = swiper.zoom; if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; if (!image.isTouched || !image.isMoved) { image.isTouched = false; image.isMoved = false; return; } image.isTouched = false; image.isMoved = false; let momentumDurationX = 300; let momentumDurationY = 300; const momentumDistanceX = velocity.x * momentumDurationX; const newPositionX = image.currentX + momentumDistanceX; const momentumDistanceY = velocity.y * momentumDurationY; const newPositionY = image.currentY + momentumDistanceY; // Fix duration if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); const momentumDuration = Math.max(momentumDurationX, momentumDurationY); image.currentX = newPositionX; image.currentY = newPositionY; // Define if we need image drag const scaledWidth = image.width * zoom.scale; const scaledHeight = image.height * zoom.scale; image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); image.maxX = -image.minX; image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); image.maxY = -image.minY; image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); gesture.$imageWrapEl.transition(momentumDuration).transform(`translate3d(${image.currentX}px, ${image.currentY}px,0)`); } function onTransitionEnd() { const zoom = swiper.zoom; if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) { if (gesture.$imageEl) { gesture.$imageEl.transform('translate3d(0,0,0) scale(1)'); } if (gesture.$imageWrapEl) { gesture.$imageWrapEl.transform('translate3d(0,0,0)'); } zoom.scale = 1; currentScale = 1; gesture.$slideEl = undefined; gesture.$imageEl = undefined; gesture.$imageWrapEl = undefined; } } function zoomIn(e) { const zoom = swiper.zoom; const params = swiper.params.zoom; if (!gesture.$slideEl) { if (e && e.target) { gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`); } if (!gesture.$slideEl) { if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { gesture.$slideEl = swiper.$wrapperEl.children(`.${swiper.params.slideActiveClass}`); } else { gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); } } gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); } if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return; if (swiper.params.cssMode) { swiper.wrapperEl.style.overflow = 'hidden'; swiper.wrapperEl.style.touchAction = 'none'; } gesture.$slideEl.addClass(`${params.zoomedSlideClass}`); let touchX; let touchY; let offsetX; let offsetY; let diffX; let diffY; let translateX; let translateY; let imageWidth; let imageHeight; let scaledWidth; let scaledHeight; let translateMinX; let translateMinY; let translateMaxX; let translateMaxY; let slideWidth; let slideHeight; if (typeof image.touchesStart.x === 'undefined' && e) { touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX; touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY; } else { touchX = image.touchesStart.x; touchY = image.touchesStart.y; } zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; if (e) { slideWidth = gesture.$slideEl[0].offsetWidth; slideHeight = gesture.$slideEl[0].offsetHeight; offsetX = gesture.$slideEl.offset().left + window.scrollX; offsetY = gesture.$slideEl.offset().top + window.scrollY; diffX = offsetX + slideWidth / 2 - touchX; diffY = offsetY + slideHeight / 2 - touchY; imageWidth = gesture.$imageEl[0].offsetWidth; imageHeight = gesture.$imageEl[0].offsetHeight; scaledWidth = imageWidth * zoom.scale; scaledHeight = imageHeight * zoom.scale; translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); translateMaxX = -translateMinX; translateMaxY = -translateMinY; translateX = diffX * zoom.scale; translateY = diffY * zoom.scale; if (translateX < translateMinX) { translateX = translateMinX; } if (translateX > translateMaxX) { translateX = translateMaxX; } if (translateY < translateMinY) { translateY = translateMinY; } if (translateY > translateMaxY) { translateY = translateMaxY; } } else { translateX = 0; translateY = 0; } gesture.$imageWrapEl.transition(300).transform(`translate3d(${translateX}px, ${translateY}px,0)`); gesture.$imageEl.transition(300).transform(`translate3d(0,0,0) scale(${zoom.scale})`); } function zoomOut() { const zoom = swiper.zoom; const params = swiper.params.zoom; if (!gesture.$slideEl) { if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { gesture.$slideEl = swiper.$wrapperEl.children(`.${swiper.params.slideActiveClass}`); } else { gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); } gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); } if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return; if (swiper.params.cssMode) { swiper.wrapperEl.style.overflow = ''; swiper.wrapperEl.style.touchAction = ''; } zoom.scale = 1; currentScale = 1; gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)'); gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)'); gesture.$slideEl.removeClass(`${params.zoomedSlideClass}`); gesture.$slideEl = undefined; } // Toggle Zoom function zoomToggle(e) { const zoom = swiper.zoom; if (zoom.scale && zoom.scale !== 1) { // Zoom Out zoomOut(); } else { // Zoom In zoomIn(e); } } function getListeners() { const support = swiper.support; const passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? { passive: true, capture: false } : false; const activeListenerWithCapture = support.passiveListener ? { passive: false, capture: true } : true; return { passiveListener, activeListenerWithCapture }; } function getSlideSelector() { return `.${swiper.params.slideClass}`; } function toggleGestures(method) { const { passiveListener } = getListeners(); const slideSelector = getSlideSelector(); swiper.$wrapperEl[method]('gesturestart', slideSelector, onGestureStart, passiveListener); swiper.$wrapperEl[method]('gesturechange', slideSelector, onGestureChange, passiveListener); swiper.$wrapperEl[method]('gestureend', slideSelector, onGestureEnd, passiveListener); } function enableGestures() { if (gesturesEnabled) return; gesturesEnabled = true; toggleGestures('on'); } function disableGestures() { if (!gesturesEnabled) return; gesturesEnabled = false; toggleGestures('off'); } // Attach/Detach Events function enable() { const zoom = swiper.zoom; if (zoom.enabled) return; zoom.enabled = true; const support = swiper.support; const { passiveListener, activeListenerWithCapture } = getListeners(); const slideSelector = getSlideSelector(); // Scale image if (support.gestures) { swiper.$wrapperEl.on(swiper.touchEvents.start, enableGestures, passiveListener); swiper.$wrapperEl.on(swiper.touchEvents.end, disableGestures, passiveListener); } else if (swiper.touchEvents.start === 'touchstart') { swiper.$wrapperEl.on(swiper.touchEvents.start, slideSelector, onGestureStart, passiveListener); swiper.$wrapperEl.on(swiper.touchEvents.move, slideSelector, onGestureChange, activeListenerWithCapture); swiper.$wrapperEl.on(swiper.touchEvents.end, slideSelector, onGestureEnd, passiveListener); if (swiper.touchEvents.cancel) { swiper.$wrapperEl.on(swiper.touchEvents.cancel, slideSelector, onGestureEnd, passiveListener); } } // Move image swiper.$wrapperEl.on(swiper.touchEvents.move, `.${swiper.params.zoom.containerClass}`, onTouchMove, activeListenerWithCapture); } function disable() { const zoom = swiper.zoom; if (!zoom.enabled) return; const support = swiper.support; zoom.enabled = false; const { passiveListener, activeListenerWithCapture } = getListeners(); const slideSelector = getSlideSelector(); // Scale image if (support.gestures) { swiper.$wrapperEl.off(swiper.touchEvents.start, enableGestures, passiveListener); swiper.$wrapperEl.off(swiper.touchEvents.end, disableGestures, passiveListener); } else if (swiper.touchEvents.start === 'touchstart') { swiper.$wrapperEl.off(swiper.touchEvents.start, slideSelector, onGestureStart, passiveListener); swiper.$wrapperEl.off(swiper.touchEvents.move, slideSelector, onGestureChange, activeListenerWithCapture); swiper.$wrapperEl.off(swiper.touchEvents.end, slideSelector, onGestureEnd, passiveListener); if (swiper.touchEvents.cancel) { swiper.$wrapperEl.off(swiper.touchEvents.cancel, slideSelector, onGestureEnd, passiveListener); } } // Move image swiper.$wrapperEl.off(swiper.touchEvents.move, `.${swiper.params.zoom.containerClass}`, onTouchMove, activeListenerWithCapture); } on('init', () => { if (swiper.params.zoom.enabled) { enable(); } }); on('destroy', () => { disable(); }); on('touchStart', (_s, e) => { if (!swiper.zoom.enabled) return; onTouchStart(e); }); on('touchEnd', (_s, e) => { if (!swiper.zoom.enabled) return; onTouchEnd(); }); on('doubleTap', (_s, e) => { if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) { zoomToggle(e); } }); on('transitionEnd', () => { if (swiper.zoom.enabled && swiper.params.zoom.enabled) { onTransitionEnd(); } }); on('slideChange', () => { if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) { onTransitionEnd(); } }); Object.assign(swiper.zoom, { enable, disable, in: zoomIn, out: zoomOut, toggle: zoomToggle }); } function Lazy(_ref) { let { swiper, extendParams, on, emit } = _ref; extendParams({ lazy: { checkInView: false, enabled: false, loadPrevNext: false, loadPrevNextAmount: 1, loadOnTransitionStart: false, scrollingElement: '', elementClass: 'swiper-lazy', loadingClass: 'swiper-lazy-loading', loadedClass: 'swiper-lazy-loaded', preloaderClass: 'swiper-lazy-preloader' } }); swiper.lazy = {}; let scrollHandlerAttached = false; let initialImageLoaded = false; function loadInSlide(index, loadInDuplicate) { if (loadInDuplicate === void 0) { loadInDuplicate = true; } const params = swiper.params.lazy; if (typeof index === 'undefined') return; if (swiper.slides.length === 0) return; const isVirtual = swiper.virtual && swiper.params.virtual.enabled; const $slideEl = isVirtual ? swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-swiper-slide-index="${index}"]`) : swiper.slides.eq(index); const $images = $slideEl.find(`.${params.elementClass}:not(.${params.loadedClass}):not(.${params.loadingClass})`); if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) { $images.push($slideEl[0]); } if ($images.length === 0) return; $images.each(imageEl => { const $imageEl = $(imageEl); $imageEl.addClass(params.loadingClass); const background = $imageEl.attr('data-background'); const src = $imageEl.attr('data-src'); const srcset = $imageEl.attr('data-srcset'); const sizes = $imageEl.attr('data-sizes'); const $pictureEl = $imageEl.parent('picture'); swiper.loadImage($imageEl[0], src || background, srcset, sizes, false, () => { if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper && !swiper.params || swiper.destroyed) return; if (background) { $imageEl.css('background-image', `url("${background}")`); $imageEl.removeAttr('data-background'); } else { if (srcset) { $imageEl.attr('srcset', srcset); $imageEl.removeAttr('data-srcset'); } if (sizes) { $imageEl.attr('sizes', sizes); $imageEl.removeAttr('data-sizes'); } if ($pictureEl.length) { $pictureEl.children('source').each(sourceEl => { const $source = $(sourceEl); if ($source.attr('data-srcset')) { $source.attr('srcset', $source.attr('data-srcset')); $source.removeAttr('data-srcset'); } }); } if (src) { $imageEl.attr('src', src); $imageEl.removeAttr('data-src'); } } $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass); $slideEl.find(`.${params.preloaderClass}`).remove(); if (swiper.params.loop && loadInDuplicate) { const slideOriginalIndex = $slideEl.attr('data-swiper-slide-index'); if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) { const originalSlide = swiper.$wrapperEl.children(`[data-swiper-slide-index="${slideOriginalIndex}"]:not(.${swiper.params.slideDuplicateClass})`); loadInSlide(originalSlide.index(), false); } else { const duplicatedSlide = swiper.$wrapperEl.children(`.${swiper.params.slideDuplicateClass}[data-swiper-slide-index="${slideOriginalIndex}"]`); loadInSlide(duplicatedSlide.index(), false); } } emit('lazyImageReady', $slideEl[0], $imageEl[0]); if (swiper.params.autoHeight) { swiper.updateAutoHeight(); } }); emit('lazyImageLoad', $slideEl[0], $imageEl[0]); }); } function load() { const { $wrapperEl, params: swiperParams, slides, activeIndex } = swiper; const isVirtual = swiper.virtual && swiperParams.virtual.enabled; const params = swiperParams.lazy; let slidesPerView = swiperParams.slidesPerView; if (slidesPerView === 'auto') { slidesPerView = 0; } function slideExist(index) { if (isVirtual) { if ($wrapperEl.children(`.${swiperParams.slideClass}[data-swiper-slide-index="${index}"]`).length) { return true; } } else if (slides[index]) return true; return false; } function slideIndex(slideEl) { if (isVirtual) { return $(slideEl).attr('data-swiper-slide-index'); } return $(slideEl).index(); } if (!initialImageLoaded) initialImageLoaded = true; if (swiper.params.watchSlidesProgress) { $wrapperEl.children(`.${swiperParams.slideVisibleClass}`).each(slideEl => { const index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index(); loadInSlide(index); }); } else if (slidesPerView > 1) { for (let i = activeIndex; i < activeIndex + slidesPerView; i += 1) { if (slideExist(i)) loadInSlide(i); } } else { loadInSlide(activeIndex); } if (params.loadPrevNext) { if (slidesPerView > 1 || params.loadPrevNextAmount && params.loadPrevNextAmount > 1) { const amount = params.loadPrevNextAmount; const spv = Math.ceil(slidesPerView); const maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length); const minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); // Next Slides for (let i = activeIndex + spv; i < maxIndex; i += 1) { if (slideExist(i)) loadInSlide(i); } // Prev Slides for (let i = minIndex; i < activeIndex; i += 1) { if (slideExist(i)) loadInSlide(i); } } else { const nextSlide = $wrapperEl.children(`.${swiperParams.slideNextClass}`); if (nextSlide.length > 0) loadInSlide(slideIndex(nextSlide)); const prevSlide = $wrapperEl.children(`.${swiperParams.slidePrevClass}`); if (prevSlide.length > 0) loadInSlide(slideIndex(prevSlide)); } } } function checkInViewOnLoad() { const window = getWindow(); if (!swiper || swiper.destroyed) return; const $scrollElement = swiper.params.lazy.scrollingElement ? $(swiper.params.lazy.scrollingElement) : $(window); const isWindow = $scrollElement[0] === window; const scrollElementWidth = isWindow ? window.innerWidth : $scrollElement[0].offsetWidth; const scrollElementHeight = isWindow ? window.innerHeight : $scrollElement[0].offsetHeight; const swiperOffset = swiper.$el.offset(); const { rtlTranslate: rtl } = swiper; let inView = false; if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiper.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiper.height], [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height]]; for (let i = 0; i < swiperCoord.length; i += 1) { const point = swiperCoord[i]; if (point[0] >= 0 && point[0] <= scrollElementWidth && point[1] >= 0 && point[1] <= scrollElementHeight) { if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line inView = true; } } const passiveListener = swiper.touchEvents.start === 'touchstart' && swiper.support.passiveListener && swiper.params.passiveListeners ? { passive: true, capture: false } : false; if (inView) { load(); $scrollElement.off('scroll', checkInViewOnLoad, passiveListener); } else if (!scrollHandlerAttached) { scrollHandlerAttached = true; $scrollElement.on('scroll', checkInViewOnLoad, passiveListener); } } on('beforeInit', () => { if (swiper.params.lazy.enabled && swiper.params.preloadImages) { swiper.params.preloadImages = false; } }); on('init', () => { if (swiper.params.lazy.enabled) { if (swiper.params.lazy.checkInView) { checkInViewOnLoad(); } else { load(); } } }); on('scroll', () => { if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.freeMode.sticky) { load(); } }); on('scrollbarDragMove resize _freeModeNoMomentumRelease', () => { if (swiper.params.lazy.enabled) { if (swiper.params.lazy.checkInView) { checkInViewOnLoad(); } else { load(); } } }); on('transitionStart', () => { if (swiper.params.lazy.enabled) { if (swiper.params.lazy.loadOnTransitionStart || !swiper.params.lazy.loadOnTransitionStart && !initialImageLoaded) { if (swiper.params.lazy.checkInView) { checkInViewOnLoad(); } else { load(); } } } }); on('transitionEnd', () => { if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) { if (swiper.params.lazy.checkInView) { checkInViewOnLoad(); } else { load(); } } }); on('slideChange', () => { const { lazy, cssMode, watchSlidesProgress, touchReleaseOnEdges, resistanceRatio } = swiper.params; if (lazy.enabled && (cssMode || watchSlidesProgress && (touchReleaseOnEdges || resistanceRatio === 0))) { load(); } }); on('destroy', () => { if (!swiper.$el) return; swiper.$el.find(`.${swiper.params.lazy.loadingClass}`).removeClass(swiper.params.lazy.loadingClass); }); Object.assign(swiper.lazy, { load, loadInSlide }); } /* eslint no-bitwise: ["error", { "allow": [">>"] }] */ function Controller(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ controller: { control: undefined, inverse: false, by: 'slide' // or 'container' } }); swiper.controller = { control: undefined }; function LinearSpline(x, y) { const binarySearch = function search() { let maxIndex; let minIndex; let guess; return (array, val) => { minIndex = -1; maxIndex = array.length; while (maxIndex - minIndex > 1) { guess = maxIndex + minIndex >> 1; if (array[guess] <= val) { minIndex = guess; } else { maxIndex = guess; } } return maxIndex; }; }(); this.x = x; this.y = y; this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value: // (x1,y1) is the known point before given value, // (x3,y3) is the known point after given value. let i1; let i3; this.interpolate = function interpolate(x2) { if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2): i3 = binarySearch(this.x, x2); i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already: // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1 return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1]; }; return this; } // xxx: for now i will just save one spline function to to function getInterpolateFunction(c) { if (!swiper.controller.spline) { swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid); } } function setTranslate(_t, byController) { const controlled = swiper.controller.control; let multiplier; let controlledTranslate; const Swiper = swiper.constructor; function setControlledTranslate(c) { // this will create an Interpolate function based on the snapGrids // x is the Grid of the scrolled scroller and y will be the controlled scroller // it makes sense to create this only once and recall it for the interpolation // the function does a lot of value caching for performance const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; if (swiper.params.controller.by === 'slide') { getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid // but it did not work out controlledTranslate = -swiper.controller.spline.interpolate(-translate); } if (!controlledTranslate || swiper.params.controller.by === 'container') { multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate(); } if (swiper.params.controller.inverse) { controlledTranslate = c.maxTranslate() - controlledTranslate; } c.updateProgress(controlledTranslate); c.setTranslate(controlledTranslate, swiper); c.updateActiveIndex(); c.updateSlidesClasses(); } if (Array.isArray(controlled)) { for (let i = 0; i < controlled.length; i += 1) { if (controlled[i] !== byController && controlled[i] instanceof Swiper) { setControlledTranslate(controlled[i]); } } } else if (controlled instanceof Swiper && byController !== controlled) { setControlledTranslate(controlled); } } function setTransition(duration, byController) { const Swiper = swiper.constructor; const controlled = swiper.controller.control; let i; function setControlledTransition(c) { c.setTransition(duration, swiper); if (duration !== 0) { c.transitionStart(); if (c.params.autoHeight) { nextTick(() => { c.updateAutoHeight(); }); } c.$wrapperEl.transitionEnd(() => { if (!controlled) return; if (c.params.loop && swiper.params.controller.by === 'slide') { c.loopFix(); } c.transitionEnd(); }); } } if (Array.isArray(controlled)) { for (i = 0; i < controlled.length; i += 1) { if (controlled[i] !== byController && controlled[i] instanceof Swiper) { setControlledTransition(controlled[i]); } } } else if (controlled instanceof Swiper && byController !== controlled) { setControlledTransition(controlled); } } function removeSpline() { if (!swiper.controller.control) return; if (swiper.controller.spline) { swiper.controller.spline = undefined; delete swiper.controller.spline; } } on('beforeInit', () => { swiper.controller.control = swiper.params.controller.control; }); on('update', () => { removeSpline(); }); on('resize', () => { removeSpline(); }); on('observerUpdate', () => { removeSpline(); }); on('setTranslate', (_s, translate, byController) => { if (!swiper.controller.control) return; swiper.controller.setTranslate(translate, byController); }); on('setTransition', (_s, duration, byController) => { if (!swiper.controller.control) return; swiper.controller.setTransition(duration, byController); }); Object.assign(swiper.controller, { setTranslate, setTransition }); } function A11y(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ a11y: { enabled: true, notificationClass: 'swiper-notification', prevSlideMessage: 'Previous slide', nextSlideMessage: 'Next slide', firstSlideMessage: 'This is the first slide', lastSlideMessage: 'This is the last slide', paginationBulletMessage: 'Go to slide {{index}}', slideLabelMessage: '{{index}} / {{slidesLength}}', containerMessage: null, containerRoleDescriptionMessage: null, itemRoleDescriptionMessage: null, slideRole: 'group', id: null } }); swiper.a11y = { clicked: false }; let liveRegion = null; function notify(message) { const notification = liveRegion; if (notification.length === 0) return; notification.html(''); notification.html(message); } function getRandomNumber(size) { if (size === void 0) { size = 16; } const randomChar = () => Math.round(16 * Math.random()).toString(16); return 'x'.repeat(size).replace(/x/g, randomChar); } function makeElFocusable($el) { $el.attr('tabIndex', '0'); } function makeElNotFocusable($el) { $el.attr('tabIndex', '-1'); } function addElRole($el, role) { $el.attr('role', role); } function addElRoleDescription($el, description) { $el.attr('aria-roledescription', description); } function addElControls($el, controls) { $el.attr('aria-controls', controls); } function addElLabel($el, label) { $el.attr('aria-label', label); } function addElId($el, id) { $el.attr('id', id); } function addElLive($el, live) { $el.attr('aria-live', live); } function disableEl($el) { $el.attr('aria-disabled', true); } function enableEl($el) { $el.attr('aria-disabled', false); } function onEnterOrSpaceKey(e) { if (e.keyCode !== 13 && e.keyCode !== 32) return; const params = swiper.params.a11y; const $targetEl = $(e.target); if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) { if (!(swiper.isEnd && !swiper.params.loop)) { swiper.slideNext(); } if (swiper.isEnd) { notify(params.lastSlideMessage); } else { notify(params.nextSlideMessage); } } if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) { if (!(swiper.isBeginning && !swiper.params.loop)) { swiper.slidePrev(); } if (swiper.isBeginning) { notify(params.firstSlideMessage); } else { notify(params.prevSlideMessage); } } if (swiper.pagination && $targetEl.is(classesToSelector(swiper.params.pagination.bulletClass))) { $targetEl[0].click(); } } function updateNavigation() { if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return; const { $nextEl, $prevEl } = swiper.navigation; if ($prevEl && $prevEl.length > 0) { if (swiper.isBeginning) { disableEl($prevEl); makeElNotFocusable($prevEl); } else { enableEl($prevEl); makeElFocusable($prevEl); } } if ($nextEl && $nextEl.length > 0) { if (swiper.isEnd) { disableEl($nextEl); makeElNotFocusable($nextEl); } else { enableEl($nextEl); makeElFocusable($nextEl); } } } function hasPagination() { return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length; } function hasClickablePagination() { return hasPagination() && swiper.params.pagination.clickable; } function updatePagination() { const params = swiper.params.a11y; if (!hasPagination()) return; swiper.pagination.bullets.each(bulletEl => { const $bulletEl = $(bulletEl); if (swiper.params.pagination.clickable) { makeElFocusable($bulletEl); if (!swiper.params.pagination.renderBullet) { addElRole($bulletEl, 'button'); addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1)); } } if ($bulletEl.is(`.${swiper.params.pagination.bulletActiveClass}`)) { $bulletEl.attr('aria-current', 'true'); } else { $bulletEl.removeAttr('aria-current'); } }); } const initNavEl = ($el, wrapperId, message) => { makeElFocusable($el); if ($el[0].tagName !== 'BUTTON') { addElRole($el, 'button'); $el.on('keydown', onEnterOrSpaceKey); } addElLabel($el, message); addElControls($el, wrapperId); }; const handlePointerDown = () => { swiper.a11y.clicked = true; }; const handlePointerUp = () => { requestAnimationFrame(() => { requestAnimationFrame(() => { if (!swiper.destroyed) { swiper.a11y.clicked = false; } }); }); }; const handleFocus = e => { if (swiper.a11y.clicked) return; const slideEl = e.target.closest(`.${swiper.params.slideClass}`); if (!slideEl || !swiper.slides.includes(slideEl)) return; const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex; const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl); if (isActive || isVisible) return; if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return; if (swiper.isHorizontal()) { swiper.el.scrollLeft = 0; } else { swiper.el.scrollTop = 0; } swiper.slideTo(swiper.slides.indexOf(slideEl), 0); }; const initSlides = () => { const params = swiper.params.a11y; if (params.itemRoleDescriptionMessage) { addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage); } if (params.slideRole) { addElRole($(swiper.slides), params.slideRole); } const slidesLength = swiper.params.loop ? swiper.slides.filter(el => !el.classList.contains(swiper.params.slideDuplicateClass)).length : swiper.slides.length; if (params.slideLabelMessage) { swiper.slides.each((slideEl, index) => { const $slideEl = $(slideEl); const slideIndex = swiper.params.loop ? parseInt($slideEl.attr('data-swiper-slide-index'), 10) : index; const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength); addElLabel($slideEl, ariaLabelMessage); }); } }; const init = () => { const params = swiper.params.a11y; swiper.$el.append(liveRegion); // Container const $containerEl = swiper.$el; if (params.containerRoleDescriptionMessage) { addElRoleDescription($containerEl, params.containerRoleDescriptionMessage); } if (params.containerMessage) { addElLabel($containerEl, params.containerMessage); } // Wrapper const $wrapperEl = swiper.$wrapperEl; const wrapperId = params.id || $wrapperEl.attr('id') || `swiper-wrapper-${getRandomNumber(16)}`; const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite'; addElId($wrapperEl, wrapperId); addElLive($wrapperEl, live); // Slide initSlides(); // Navigation let $nextEl; let $prevEl; if (swiper.navigation && swiper.navigation.$nextEl) { $nextEl = swiper.navigation.$nextEl; } if (swiper.navigation && swiper.navigation.$prevEl) { $prevEl = swiper.navigation.$prevEl; } if ($nextEl && $nextEl.length) { initNavEl($nextEl, wrapperId, params.nextSlideMessage); } if ($prevEl && $prevEl.length) { initNavEl($prevEl, wrapperId, params.prevSlideMessage); } // Pagination if (hasClickablePagination()) { swiper.pagination.$el.on('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey); } // Tab focus swiper.$el.on('focus', handleFocus, true); swiper.$el.on('pointerdown', handlePointerDown, true); swiper.$el.on('pointerup', handlePointerUp, true); }; function destroy() { if (liveRegion && liveRegion.length > 0) liveRegion.remove(); let $nextEl; let $prevEl; if (swiper.navigation && swiper.navigation.$nextEl) { $nextEl = swiper.navigation.$nextEl; } if (swiper.navigation && swiper.navigation.$prevEl) { $prevEl = swiper.navigation.$prevEl; } if ($nextEl) { $nextEl.off('keydown', onEnterOrSpaceKey); } if ($prevEl) { $prevEl.off('keydown', onEnterOrSpaceKey); } // Pagination if (hasClickablePagination()) { swiper.pagination.$el.off('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey); } // Tab focus swiper.$el.off('focus', handleFocus, true); swiper.$el.off('pointerdown', handlePointerDown, true); swiper.$el.off('pointerup', handlePointerUp, true); } on('beforeInit', () => { liveRegion = $(``); }); on('afterInit', () => { if (!swiper.params.a11y.enabled) return; init(); }); on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => { if (!swiper.params.a11y.enabled) return; initSlides(); }); on('fromEdge toEdge afterInit lock unlock', () => { if (!swiper.params.a11y.enabled) return; updateNavigation(); }); on('paginationUpdate', () => { if (!swiper.params.a11y.enabled) return; updatePagination(); }); on('destroy', () => { if (!swiper.params.a11y.enabled) return; destroy(); }); } function History(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ history: { enabled: false, root: '', replaceState: false, key: 'slides', keepQuery: false } }); let initialized = false; let paths = {}; const slugify = text => { return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, ''); }; const getPathValues = urlOverride => { const window = getWindow(); let location; if (urlOverride) { location = new URL(urlOverride); } else { location = window.location; } const pathArray = location.pathname.slice(1).split('/').filter(part => part !== ''); const total = pathArray.length; const key = pathArray[total - 2]; const value = pathArray[total - 1]; return { key, value }; }; const setHistory = (key, index) => { const window = getWindow(); if (!initialized || !swiper.params.history.enabled) return; let location; if (swiper.params.url) { location = new URL(swiper.params.url); } else { location = window.location; } const slide = swiper.slides.eq(index); let value = slugify(slide.attr('data-history')); if (swiper.params.history.root.length > 0) { let root = swiper.params.history.root; if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); value = `${root}/${key}/${value}`; } else if (!location.pathname.includes(key)) { value = `${key}/${value}`; } if (swiper.params.history.keepQuery) { value += location.search; } const currentState = window.history.state; if (currentState && currentState.value === value) { return; } if (swiper.params.history.replaceState) { window.history.replaceState({ value }, null, value); } else { window.history.pushState({ value }, null, value); } }; const scrollToSlide = (speed, value, runCallbacks) => { if (value) { for (let i = 0, length = swiper.slides.length; i < length; i += 1) { const slide = swiper.slides.eq(i); const slideHistory = slugify(slide.attr('data-history')); if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) { const index = slide.index(); swiper.slideTo(index, speed, runCallbacks); } } } else { swiper.slideTo(0, speed, runCallbacks); } }; const setHistoryPopState = () => { paths = getPathValues(swiper.params.url); scrollToSlide(swiper.params.speed, paths.value, false); }; const init = () => { const window = getWindow(); if (!swiper.params.history) return; if (!window.history || !window.history.pushState) { swiper.params.history.enabled = false; swiper.params.hashNavigation.enabled = true; return; } initialized = true; paths = getPathValues(swiper.params.url); if (!paths.key && !paths.value) return; scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit); if (!swiper.params.history.replaceState) { window.addEventListener('popstate', setHistoryPopState); } }; const destroy = () => { const window = getWindow(); if (!swiper.params.history.replaceState) { window.removeEventListener('popstate', setHistoryPopState); } }; on('init', () => { if (swiper.params.history.enabled) { init(); } }); on('destroy', () => { if (swiper.params.history.enabled) { destroy(); } }); on('transitionEnd _freeModeNoMomentumRelease', () => { if (initialized) { setHistory(swiper.params.history.key, swiper.activeIndex); } }); on('slideChange', () => { if (initialized && swiper.params.cssMode) { setHistory(swiper.params.history.key, swiper.activeIndex); } }); } function HashNavigation(_ref) { let { swiper, extendParams, emit, on } = _ref; let initialized = false; const document = getDocument(); const window = getWindow(); extendParams({ hashNavigation: { enabled: false, replaceState: false, watchState: false } }); const onHashChange = () => { emit('hashChange'); const newHash = document.location.hash.replace('#', ''); const activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash'); if (newHash !== activeSlideHash) { const newIndex = swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-hash="${newHash}"]`).index(); if (typeof newIndex === 'undefined') return; swiper.slideTo(newIndex); } }; const setHash = () => { if (!initialized || !swiper.params.hashNavigation.enabled) return; if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { window.history.replaceState(null, null, `#${swiper.slides.eq(swiper.activeIndex).attr('data-hash')}` || ''); emit('hashSet'); } else { const slide = swiper.slides.eq(swiper.activeIndex); const hash = slide.attr('data-hash') || slide.attr('data-history'); document.location.hash = hash || ''; emit('hashSet'); } }; const init = () => { if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return; initialized = true; const hash = document.location.hash.replace('#', ''); if (hash) { const speed = 0; for (let i = 0, length = swiper.slides.length; i < length; i += 1) { const slide = swiper.slides.eq(i); const slideHash = slide.attr('data-hash') || slide.attr('data-history'); if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) { const index = slide.index(); swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true); } } } if (swiper.params.hashNavigation.watchState) { $(window).on('hashchange', onHashChange); } }; const destroy = () => { if (swiper.params.hashNavigation.watchState) { $(window).off('hashchange', onHashChange); } }; on('init', () => { if (swiper.params.hashNavigation.enabled) { init(); } }); on('destroy', () => { if (swiper.params.hashNavigation.enabled) { destroy(); } }); on('transitionEnd _freeModeNoMomentumRelease', () => { if (initialized) { setHash(); } }); on('slideChange', () => { if (initialized && swiper.params.cssMode) { setHash(); } }); } /* eslint no-underscore-dangle: "off" */ function Autoplay(_ref) { let { swiper, extendParams, on, emit } = _ref; let timeout; swiper.autoplay = { running: false, paused: false }; extendParams({ autoplay: { enabled: false, delay: 3000, waitForTransition: true, disableOnInteraction: true, stopOnLastSlide: false, reverseDirection: false, pauseOnMouseEnter: false } }); function run() { if (!swiper.size) { swiper.autoplay.running = false; swiper.autoplay.paused = false; return; } const $activeSlideEl = swiper.slides.eq(swiper.activeIndex); let delay = swiper.params.autoplay.delay; if ($activeSlideEl.attr('data-swiper-autoplay')) { delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay; } clearTimeout(timeout); timeout = nextTick(() => { let autoplayResult; if (swiper.params.autoplay.reverseDirection) { if (swiper.params.loop) { swiper.loopFix(); autoplayResult = swiper.slidePrev(swiper.params.speed, true, true); emit('autoplay'); } else if (!swiper.isBeginning) { autoplayResult = swiper.slidePrev(swiper.params.speed, true, true); emit('autoplay'); } else if (!swiper.params.autoplay.stopOnLastSlide) { autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true); emit('autoplay'); } else { stop(); } } else if (swiper.params.loop) { swiper.loopFix(); autoplayResult = swiper.slideNext(swiper.params.speed, true, true); emit('autoplay'); } else if (!swiper.isEnd) { autoplayResult = swiper.slideNext(swiper.params.speed, true, true); emit('autoplay'); } else if (!swiper.params.autoplay.stopOnLastSlide) { autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true); emit('autoplay'); } else { stop(); } if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) { run(); } }, delay); } function start() { if (typeof timeout !== 'undefined') return false; if (swiper.autoplay.running) return false; swiper.autoplay.running = true; emit('autoplayStart'); run(); return true; } function stop() { if (!swiper.autoplay.running) return false; if (typeof timeout === 'undefined') return false; if (timeout) { clearTimeout(timeout); timeout = undefined; } swiper.autoplay.running = false; emit('autoplayStop'); return true; } function pause(speed) { if (!swiper.autoplay.running) return; if (swiper.autoplay.paused) return; if (timeout) clearTimeout(timeout); swiper.autoplay.paused = true; if (speed === 0 || !swiper.params.autoplay.waitForTransition) { swiper.autoplay.paused = false; run(); } else { ['transitionend', 'webkitTransitionEnd'].forEach(event => { swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd); }); } } function onVisibilityChange() { const document = getDocument(); if (document.visibilityState === 'hidden' && swiper.autoplay.running) { pause(); } if (document.visibilityState === 'visible' && swiper.autoplay.paused) { run(); swiper.autoplay.paused = false; } } function onTransitionEnd(e) { if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return; if (e.target !== swiper.$wrapperEl[0]) return; ['transitionend', 'webkitTransitionEnd'].forEach(event => { swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd); }); swiper.autoplay.paused = false; if (!swiper.autoplay.running) { stop(); } else { run(); } } function onMouseEnter() { if (swiper.params.autoplay.disableOnInteraction) { stop(); } else { emit('autoplayPause'); pause(); } ['transitionend', 'webkitTransitionEnd'].forEach(event => { swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd); }); } function onMouseLeave() { if (swiper.params.autoplay.disableOnInteraction) { return; } swiper.autoplay.paused = false; emit('autoplayResume'); run(); } function attachMouseEvents() { if (swiper.params.autoplay.pauseOnMouseEnter) { swiper.$el.on('mouseenter', onMouseEnter); swiper.$el.on('mouseleave', onMouseLeave); } } function detachMouseEvents() { swiper.$el.off('mouseenter', onMouseEnter); swiper.$el.off('mouseleave', onMouseLeave); } on('init', () => { if (swiper.params.autoplay.enabled) { start(); const document = getDocument(); document.addEventListener('visibilitychange', onVisibilityChange); attachMouseEvents(); } }); on('beforeTransitionStart', (_s, speed, internal) => { if (swiper.autoplay.running) { if (internal || !swiper.params.autoplay.disableOnInteraction) { swiper.autoplay.pause(speed); } else { stop(); } } }); on('sliderFirstMove', () => { if (swiper.autoplay.running) { if (swiper.params.autoplay.disableOnInteraction) { stop(); } else { pause(); } } }); on('touchEnd', () => { if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) { run(); } }); on('destroy', () => { detachMouseEvents(); if (swiper.autoplay.running) { stop(); } const document = getDocument(); document.removeEventListener('visibilitychange', onVisibilityChange); }); Object.assign(swiper.autoplay, { pause, run, start, stop }); } function Thumb(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ thumbs: { swiper: null, multipleActiveThumbs: true, autoScrollOffset: 0, slideThumbActiveClass: 'swiper-slide-thumb-active', thumbsContainerClass: 'swiper-thumbs' } }); let initialized = false; let swiperCreated = false; swiper.thumbs = { swiper: null }; function onThumbClick() { const thumbsSwiper = swiper.thumbs.swiper; if (!thumbsSwiper || thumbsSwiper.destroyed) return; const clickedIndex = thumbsSwiper.clickedIndex; const clickedSlide = thumbsSwiper.clickedSlide; if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return; if (typeof clickedIndex === 'undefined' || clickedIndex === null) return; let slideToIndex; if (thumbsSwiper.params.loop) { slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10); } else { slideToIndex = clickedIndex; } if (swiper.params.loop) { let currentIndex = swiper.activeIndex; if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) { swiper.loopFix(); // eslint-disable-next-line swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; currentIndex = swiper.activeIndex; } const prevIndex = swiper.slides.eq(currentIndex).prevAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index(); const nextIndex = swiper.slides.eq(currentIndex).nextAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index(); if (typeof prevIndex === 'undefined') slideToIndex = nextIndex;else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex;else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex;else slideToIndex = prevIndex; } swiper.slideTo(slideToIndex); } function init() { const { thumbs: thumbsParams } = swiper.params; if (initialized) return false; initialized = true; const SwiperClass = swiper.constructor; if (thumbsParams.swiper instanceof SwiperClass) { swiper.thumbs.swiper = thumbsParams.swiper; Object.assign(swiper.thumbs.swiper.originalParams, { watchSlidesProgress: true, slideToClickedSlide: false }); Object.assign(swiper.thumbs.swiper.params, { watchSlidesProgress: true, slideToClickedSlide: false }); } else if (isObject(thumbsParams.swiper)) { const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper); Object.assign(thumbsSwiperParams, { watchSlidesProgress: true, slideToClickedSlide: false }); swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams); swiperCreated = true; } swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass); swiper.thumbs.swiper.on('tap', onThumbClick); return true; } function update(initial) { const thumbsSwiper = swiper.thumbs.swiper; if (!thumbsSwiper || thumbsSwiper.destroyed) return; const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; // Activate thumbs let thumbsToActivate = 1; const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) { thumbsToActivate = swiper.params.slidesPerView; } if (!swiper.params.thumbs.multipleActiveThumbs) { thumbsToActivate = 1; } thumbsToActivate = Math.floor(thumbsToActivate); thumbsSwiper.slides.removeClass(thumbActiveClass); if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) { for (let i = 0; i < thumbsToActivate; i += 1) { thumbsSwiper.$wrapperEl.children(`[data-swiper-slide-index="${swiper.realIndex + i}"]`).addClass(thumbActiveClass); } } else { for (let i = 0; i < thumbsToActivate; i += 1) { thumbsSwiper.slides.eq(swiper.realIndex + i).addClass(thumbActiveClass); } } const autoScrollOffset = swiper.params.thumbs.autoScrollOffset; const useOffset = autoScrollOffset && !thumbsSwiper.params.loop; if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) { let currentThumbsIndex = thumbsSwiper.activeIndex; let newThumbsIndex; let direction; if (thumbsSwiper.params.loop) { if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) { thumbsSwiper.loopFix(); // eslint-disable-next-line thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft; currentThumbsIndex = thumbsSwiper.activeIndex; } // Find actual thumbs index to slide to const prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index(); const nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index(); if (typeof prevThumbsIndex === 'undefined') { newThumbsIndex = nextThumbsIndex; } else if (typeof nextThumbsIndex === 'undefined') { newThumbsIndex = prevThumbsIndex; } else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) { newThumbsIndex = thumbsSwiper.params.slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex; } else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) { newThumbsIndex = nextThumbsIndex; } else { newThumbsIndex = prevThumbsIndex; } direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev'; } else { newThumbsIndex = swiper.realIndex; direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev'; } if (useOffset) { newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset; } if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { if (thumbsSwiper.params.centeredSlides) { if (newThumbsIndex > currentThumbsIndex) { newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; } else { newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; } } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ; thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined); } } } on('beforeInit', () => { const { thumbs } = swiper.params; if (!thumbs || !thumbs.swiper) return; init(); update(true); }); on('slideChange update resize observerUpdate', () => { update(); }); on('setTransition', (_s, duration) => { const thumbsSwiper = swiper.thumbs.swiper; if (!thumbsSwiper || thumbsSwiper.destroyed) return; thumbsSwiper.setTransition(duration); }); on('beforeDestroy', () => { const thumbsSwiper = swiper.thumbs.swiper; if (!thumbsSwiper || thumbsSwiper.destroyed) return; if (swiperCreated) { thumbsSwiper.destroy(); } }); Object.assign(swiper.thumbs, { init, update }); } function freeMode(_ref) { let { swiper, extendParams, emit, once } = _ref; extendParams({ freeMode: { enabled: false, momentum: true, momentumRatio: 1, momentumBounce: true, momentumBounceRatio: 1, momentumVelocityRatio: 1, sticky: false, minimumVelocity: 0.02 } }); function onTouchStart() { const translate = swiper.getTranslate(); swiper.setTranslate(translate); swiper.setTransition(0); swiper.touchEventsData.velocities.length = 0; swiper.freeMode.onTouchEnd({ currentPos: swiper.rtl ? swiper.translate : -swiper.translate }); } function onTouchMove() { const { touchEventsData: data, touches } = swiper; // Velocity if (data.velocities.length === 0) { data.velocities.push({ position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], time: data.touchStartTime }); } data.velocities.push({ position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], time: now() }); } function onTouchEnd(_ref2) { let { currentPos } = _ref2; const { params, $wrapperEl, rtlTranslate: rtl, snapGrid, touchEventsData: data } = swiper; // Time diff const touchEndTime = now(); const timeDiff = touchEndTime - data.touchStartTime; if (currentPos < -swiper.minTranslate()) { swiper.slideTo(swiper.activeIndex); return; } if (currentPos > -swiper.maxTranslate()) { if (swiper.slides.length < snapGrid.length) { swiper.slideTo(snapGrid.length - 1); } else { swiper.slideTo(swiper.slides.length - 1); } return; } if (params.freeMode.momentum) { if (data.velocities.length > 1) { const lastMoveEvent = data.velocities.pop(); const velocityEvent = data.velocities.pop(); const distance = lastMoveEvent.position - velocityEvent.position; const time = lastMoveEvent.time - velocityEvent.time; swiper.velocity = distance / time; swiper.velocity /= 2; if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) { swiper.velocity = 0; } // this implies that the user stopped moving a finger then released. // There would be no events with distance zero, so the last event is stale. if (time > 150 || now() - lastMoveEvent.time > 300) { swiper.velocity = 0; } } else { swiper.velocity = 0; } swiper.velocity *= params.freeMode.momentumVelocityRatio; data.velocities.length = 0; let momentumDuration = 1000 * params.freeMode.momentumRatio; const momentumDistance = swiper.velocity * momentumDuration; let newPosition = swiper.translate + momentumDistance; if (rtl) newPosition = -newPosition; let doBounce = false; let afterBouncePosition; const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio; let needsLoopFix; if (newPosition < swiper.maxTranslate()) { if (params.freeMode.momentumBounce) { if (newPosition + swiper.maxTranslate() < -bounceAmount) { newPosition = swiper.maxTranslate() - bounceAmount; } afterBouncePosition = swiper.maxTranslate(); doBounce = true; data.allowMomentumBounce = true; } else { newPosition = swiper.maxTranslate(); } if (params.loop && params.centeredSlides) needsLoopFix = true; } else if (newPosition > swiper.minTranslate()) { if (params.freeMode.momentumBounce) { if (newPosition - swiper.minTranslate() > bounceAmount) { newPosition = swiper.minTranslate() + bounceAmount; } afterBouncePosition = swiper.minTranslate(); doBounce = true; data.allowMomentumBounce = true; } else { newPosition = swiper.minTranslate(); } if (params.loop && params.centeredSlides) needsLoopFix = true; } else if (params.freeMode.sticky) { let nextSlide; for (let j = 0; j < snapGrid.length; j += 1) { if (snapGrid[j] > -newPosition) { nextSlide = j; break; } } if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') { newPosition = snapGrid[nextSlide]; } else { newPosition = snapGrid[nextSlide - 1]; } newPosition = -newPosition; } if (needsLoopFix) { once('transitionEnd', () => { swiper.loopFix(); }); } // Fix duration if (swiper.velocity !== 0) { if (rtl) { momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); } else { momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); } if (params.freeMode.sticky) { // If freeMode.sticky is active and the user ends a swipe with a slow-velocity // event, then durations can be 20+ seconds to slide one (or zero!) slides. // It's easy to see this when simulating touch with mouse events. To fix this, // limit single-slide swipes to the default slide duration. This also has the // nice side effect of matching slide speed if the user stopped moving before // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. // For faster swipes, also apply limits (albeit higher ones). const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; if (moveDistance < currentSlideSize) { momentumDuration = params.speed; } else if (moveDistance < 2 * currentSlideSize) { momentumDuration = params.speed * 1.5; } else { momentumDuration = params.speed * 2.5; } } } else if (params.freeMode.sticky) { swiper.slideToClosest(); return; } if (params.freeMode.momentumBounce && doBounce) { swiper.updateProgress(afterBouncePosition); swiper.setTransition(momentumDuration); swiper.setTranslate(newPosition); swiper.transitionStart(true, swiper.swipeDirection); swiper.animating = true; $wrapperEl.transitionEnd(() => { if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return; emit('momentumBounce'); swiper.setTransition(params.speed); setTimeout(() => { swiper.setTranslate(afterBouncePosition); $wrapperEl.transitionEnd(() => { if (!swiper || swiper.destroyed) return; swiper.transitionEnd(); }); }, 0); }); } else if (swiper.velocity) { emit('_freeModeNoMomentumRelease'); swiper.updateProgress(newPosition); swiper.setTransition(momentumDuration); swiper.setTranslate(newPosition); swiper.transitionStart(true, swiper.swipeDirection); if (!swiper.animating) { swiper.animating = true; $wrapperEl.transitionEnd(() => { if (!swiper || swiper.destroyed) return; swiper.transitionEnd(); }); } } else { swiper.updateProgress(newPosition); } swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } else if (params.freeMode.sticky) { swiper.slideToClosest(); return; } else if (params.freeMode) { emit('_freeModeNoMomentumRelease'); } if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) { swiper.updateProgress(); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } } Object.assign(swiper, { freeMode: { onTouchStart, onTouchMove, onTouchEnd } }); } function Grid(_ref) { let { swiper, extendParams } = _ref; extendParams({ grid: { rows: 1, fill: 'column' } }); let slidesNumberEvenToRows; let slidesPerRow; let numFullColumns; const initSlides = slidesLength => { const { slidesPerView } = swiper.params; const { rows, fill } = swiper.params.grid; slidesPerRow = slidesNumberEvenToRows / rows; numFullColumns = Math.floor(slidesLength / rows); if (Math.floor(slidesLength / rows) === slidesLength / rows) { slidesNumberEvenToRows = slidesLength; } else { slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows; } if (slidesPerView !== 'auto' && fill === 'row') { slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows); } }; const updateSlide = (i, slide, slidesLength, getDirectionLabel) => { const { slidesPerGroup, spaceBetween } = swiper.params; const { rows, fill } = swiper.params.grid; // Set slides order let newSlideOrderIndex; let column; let row; if (fill === 'row' && slidesPerGroup > 1) { const groupIndex = Math.floor(i / (slidesPerGroup * rows)); const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex; const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup); row = Math.floor(slideIndexInGroup / columnsInGroup); column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup; newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows; slide.css({ '-webkit-order': newSlideOrderIndex, order: newSlideOrderIndex }); } else if (fill === 'column') { column = Math.floor(i / rows); row = i - column * rows; if (column > numFullColumns || column === numFullColumns && row === rows - 1) { row += 1; if (row >= rows) { row = 0; column += 1; } } } else { row = Math.floor(i / slidesPerRow); column = i - row * slidesPerRow; } slide.css(getDirectionLabel('margin-top'), row !== 0 ? spaceBetween && `${spaceBetween}px` : ''); }; const updateWrapperSize = (slideSize, snapGrid, getDirectionLabel) => { const { spaceBetween, centeredSlides, roundLengths } = swiper.params; const { rows } = swiper.params.grid; swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows; swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween; swiper.$wrapperEl.css({ [getDirectionLabel('width')]: `${swiper.virtualSize + spaceBetween}px` }); if (centeredSlides) { snapGrid.splice(0, snapGrid.length); const newSlidesGrid = []; for (let i = 0; i < snapGrid.length; i += 1) { let slidesGridItem = snapGrid[i]; if (roundLengths) slidesGridItem = Math.floor(slidesGridItem); if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem); } snapGrid.push(...newSlidesGrid); } }; swiper.grid = { initSlides, updateSlide, updateWrapperSize }; } function appendSlide(slides) { const swiper = this; const { $wrapperEl, params } = swiper; if (params.loop) { swiper.loopDestroy(); } if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) $wrapperEl.append(slides[i]); } } else { $wrapperEl.append(slides); } if (params.loop) { swiper.loopCreate(); } if (!params.observer) { swiper.update(); } } function prependSlide(slides) { const swiper = this; const { params, $wrapperEl, activeIndex } = swiper; if (params.loop) { swiper.loopDestroy(); } let newActiveIndex = activeIndex + 1; if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) $wrapperEl.prepend(slides[i]); } newActiveIndex = activeIndex + slides.length; } else { $wrapperEl.prepend(slides); } if (params.loop) { swiper.loopCreate(); } if (!params.observer) { swiper.update(); } swiper.slideTo(newActiveIndex, 0, false); } function addSlide(index, slides) { const swiper = this; const { $wrapperEl, params, activeIndex } = swiper; let activeIndexBuffer = activeIndex; if (params.loop) { activeIndexBuffer -= swiper.loopedSlides; swiper.loopDestroy(); swiper.slides = $wrapperEl.children(`.${params.slideClass}`); } const baseLength = swiper.slides.length; if (index <= 0) { swiper.prependSlide(slides); return; } if (index >= baseLength) { swiper.appendSlide(slides); return; } let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer; const slidesBuffer = []; for (let i = baseLength - 1; i >= index; i -= 1) { const currentSlide = swiper.slides.eq(i); currentSlide.remove(); slidesBuffer.unshift(currentSlide); } if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) $wrapperEl.append(slides[i]); } newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer; } else { $wrapperEl.append(slides); } for (let i = 0; i < slidesBuffer.length; i += 1) { $wrapperEl.append(slidesBuffer[i]); } if (params.loop) { swiper.loopCreate(); } if (!params.observer) { swiper.update(); } if (params.loop) { swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); } else { swiper.slideTo(newActiveIndex, 0, false); } } function removeSlide(slidesIndexes) { const swiper = this; const { params, $wrapperEl, activeIndex } = swiper; let activeIndexBuffer = activeIndex; if (params.loop) { activeIndexBuffer -= swiper.loopedSlides; swiper.loopDestroy(); swiper.slides = $wrapperEl.children(`.${params.slideClass}`); } let newActiveIndex = activeIndexBuffer; let indexToRemove; if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) { for (let i = 0; i < slidesIndexes.length; i += 1) { indexToRemove = slidesIndexes[i]; if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove(); if (indexToRemove < newActiveIndex) newActiveIndex -= 1; } newActiveIndex = Math.max(newActiveIndex, 0); } else { indexToRemove = slidesIndexes; if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove(); if (indexToRemove < newActiveIndex) newActiveIndex -= 1; newActiveIndex = Math.max(newActiveIndex, 0); } if (params.loop) { swiper.loopCreate(); } if (!params.observer) { swiper.update(); } if (params.loop) { swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); } else { swiper.slideTo(newActiveIndex, 0, false); } } function removeAllSlides() { const swiper = this; const slidesIndexes = []; for (let i = 0; i < swiper.slides.length; i += 1) { slidesIndexes.push(i); } swiper.removeSlide(slidesIndexes); } function Manipulation(_ref) { let { swiper } = _ref; Object.assign(swiper, { appendSlide: appendSlide.bind(swiper), prependSlide: prependSlide.bind(swiper), addSlide: addSlide.bind(swiper), removeSlide: removeSlide.bind(swiper), removeAllSlides: removeAllSlides.bind(swiper) }); } function effectInit(params) { const { effect, swiper, on, setTranslate, setTransition, overwriteParams, perspective, recreateShadows, getEffectParams } = params; on('beforeInit', () => { if (swiper.params.effect !== effect) return; swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`); if (perspective && perspective()) { swiper.classNames.push(`${swiper.params.containerModifierClass}3d`); } const overwriteParamsResult = overwriteParams ? overwriteParams() : {}; Object.assign(swiper.params, overwriteParamsResult); Object.assign(swiper.originalParams, overwriteParamsResult); }); on('setTranslate', () => { if (swiper.params.effect !== effect) return; setTranslate(); }); on('setTransition', (_s, duration) => { if (swiper.params.effect !== effect) return; setTransition(duration); }); on('transitionEnd', () => { if (swiper.params.effect !== effect) return; if (recreateShadows) { if (!getEffectParams || !getEffectParams().slideShadows) return; // remove shadows swiper.slides.each(slideEl => { const $slideEl = swiper.$(slideEl); $slideEl.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').remove(); }); // create new one recreateShadows(); } }); let requireUpdateOnVirtual; on('virtualUpdate', () => { if (swiper.params.effect !== effect) return; if (!swiper.slides.length) { requireUpdateOnVirtual = true; } requestAnimationFrame(() => { if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) { setTranslate(); requireUpdateOnVirtual = false; } }); }); } function effectTarget(effectParams, $slideEl) { if (effectParams.transformEl) { return $slideEl.find(effectParams.transformEl).css({ 'backface-visibility': 'hidden', '-webkit-backface-visibility': 'hidden' }); } return $slideEl; } function effectVirtualTransitionEnd(_ref) { let { swiper, duration, transformEl, allSlides } = _ref; const { slides, activeIndex, $wrapperEl } = swiper; if (swiper.params.virtualTranslate && duration !== 0) { let eventTriggered = false; let $transitionEndTarget; if (allSlides) { $transitionEndTarget = transformEl ? slides.find(transformEl) : slides; } else { $transitionEndTarget = transformEl ? slides.eq(activeIndex).find(transformEl) : slides.eq(activeIndex); } $transitionEndTarget.transitionEnd(() => { if (eventTriggered) return; if (!swiper || swiper.destroyed) return; eventTriggered = true; swiper.animating = false; const triggerEvents = ['webkitTransitionEnd', 'transitionend']; for (let i = 0; i < triggerEvents.length; i += 1) { $wrapperEl.trigger(triggerEvents[i]); } }); } } function EffectFade(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ fadeEffect: { crossFade: false, transformEl: null } }); const setTranslate = () => { const { slides } = swiper; const params = swiper.params.fadeEffect; for (let i = 0; i < slides.length; i += 1) { const $slideEl = swiper.slides.eq(i); const offset = $slideEl[0].swiperSlideOffset; let tx = -offset; if (!swiper.params.virtualTranslate) tx -= swiper.translate; let ty = 0; if (!swiper.isHorizontal()) { ty = tx; tx = 0; } const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0); const $targetEl = effectTarget(params, $slideEl); $targetEl.css({ opacity: slideOpacity }).transform(`translate3d(${tx}px, ${ty}px, 0px)`); } }; const setTransition = duration => { const { transformEl } = swiper.params.fadeEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration); effectVirtualTransitionEnd({ swiper, duration, transformEl, allSlides: true }); }; effectInit({ effect: 'fade', swiper, on, setTranslate, setTransition, overwriteParams: () => ({ slidesPerView: 1, slidesPerGroup: 1, watchSlidesProgress: true, spaceBetween: 0, virtualTranslate: !swiper.params.cssMode }) }); } function EffectCube(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ cubeEffect: { slideShadows: true, shadow: true, shadowOffset: 20, shadowScale: 0.94 } }); const createSlideShadows = ($slideEl, progress, isHorizontal) => { let shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); let shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); if (shadowBefore.length === 0) { shadowBefore = $(`
    `); $slideEl.append(shadowBefore); } if (shadowAfter.length === 0) { shadowAfter = $(`
    `); $slideEl.append(shadowAfter); } if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); }; const recreateShadows = () => { // create new ones const isHorizontal = swiper.isHorizontal(); swiper.slides.each(slideEl => { const progress = Math.max(Math.min(slideEl.progress, 1), -1); createSlideShadows($(slideEl), progress, isHorizontal); }); }; const setTranslate = () => { const { $el, $wrapperEl, slides, width: swiperWidth, height: swiperHeight, rtlTranslate: rtl, size: swiperSize, browser } = swiper; const params = swiper.params.cubeEffect; const isHorizontal = swiper.isHorizontal(); const isVirtual = swiper.virtual && swiper.params.virtual.enabled; let wrapperRotate = 0; let $cubeShadowEl; if (params.shadow) { if (isHorizontal) { $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow'); if ($cubeShadowEl.length === 0) { $cubeShadowEl = $('
    '); $wrapperEl.append($cubeShadowEl); } $cubeShadowEl.css({ height: `${swiperWidth}px` }); } else { $cubeShadowEl = $el.find('.swiper-cube-shadow'); if ($cubeShadowEl.length === 0) { $cubeShadowEl = $('
    '); $el.append($cubeShadowEl); } } } for (let i = 0; i < slides.length; i += 1) { const $slideEl = slides.eq(i); let slideIndex = i; if (isVirtual) { slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10); } let slideAngle = slideIndex * 90; let round = Math.floor(slideAngle / 360); if (rtl) { slideAngle = -slideAngle; round = Math.floor(-slideAngle / 360); } const progress = Math.max(Math.min($slideEl[0].progress, 1), -1); let tx = 0; let ty = 0; let tz = 0; if (slideIndex % 4 === 0) { tx = -round * 4 * swiperSize; tz = 0; } else if ((slideIndex - 1) % 4 === 0) { tx = 0; tz = -round * 4 * swiperSize; } else if ((slideIndex - 2) % 4 === 0) { tx = swiperSize + round * 4 * swiperSize; tz = swiperSize; } else if ((slideIndex - 3) % 4 === 0) { tx = -swiperSize; tz = 3 * swiperSize + swiperSize * 4 * round; } if (rtl) { tx = -tx; } if (!isHorizontal) { ty = tx; tx = 0; } const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`; if (progress <= 1 && progress > -1) { wrapperRotate = slideIndex * 90 + progress * 90; if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90; } $slideEl.transform(transform); if (params.slideShadows) { createSlideShadows($slideEl, progress, isHorizontal); } } $wrapperEl.css({ '-webkit-transform-origin': `50% 50% -${swiperSize / 2}px`, 'transform-origin': `50% 50% -${swiperSize / 2}px` }); if (params.shadow) { if (isHorizontal) { $cubeShadowEl.transform(`translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`); } else { const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); const scale1 = params.shadowScale; const scale2 = params.shadowScale / multiplier; const offset = params.shadowOffset; $cubeShadowEl.transform(`scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`); } } const zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0; $wrapperEl.transform(`translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`); $wrapperEl[0].style.setProperty('--swiper-cube-translate-z', `${zFactor}px`); }; const setTransition = duration => { const { $el, slides } = swiper; slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) { $el.find('.swiper-cube-shadow').transition(duration); } }; effectInit({ effect: 'cube', swiper, on, setTranslate, setTransition, recreateShadows, getEffectParams: () => swiper.params.cubeEffect, perspective: () => true, overwriteParams: () => ({ slidesPerView: 1, slidesPerGroup: 1, watchSlidesProgress: true, resistanceRatio: 0, spaceBetween: 0, centeredSlides: false, virtualTranslate: true }) }); } function createShadow(params, $slideEl, side) { const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}`; const $shadowContainer = params.transformEl ? $slideEl.find(params.transformEl) : $slideEl; let $shadowEl = $shadowContainer.children(`.${shadowClass}`); if (!$shadowEl.length) { $shadowEl = $(`
    `); $shadowContainer.append($shadowEl); } return $shadowEl; } function EffectFlip(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ flipEffect: { slideShadows: true, limitRotation: true, transformEl: null } }); const createSlideShadows = ($slideEl, progress, params) => { let shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); let shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); if (shadowBefore.length === 0) { shadowBefore = createShadow(params, $slideEl, swiper.isHorizontal() ? 'left' : 'top'); } if (shadowAfter.length === 0) { shadowAfter = createShadow(params, $slideEl, swiper.isHorizontal() ? 'right' : 'bottom'); } if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); }; const recreateShadows = () => { // Set shadows const params = swiper.params.flipEffect; swiper.slides.each(slideEl => { const $slideEl = $(slideEl); let progress = $slideEl[0].progress; if (swiper.params.flipEffect.limitRotation) { progress = Math.max(Math.min(slideEl.progress, 1), -1); } createSlideShadows($slideEl, progress, params); }); }; const setTranslate = () => { const { slides, rtlTranslate: rtl } = swiper; const params = swiper.params.flipEffect; for (let i = 0; i < slides.length; i += 1) { const $slideEl = slides.eq(i); let progress = $slideEl[0].progress; if (swiper.params.flipEffect.limitRotation) { progress = Math.max(Math.min($slideEl[0].progress, 1), -1); } const offset = $slideEl[0].swiperSlideOffset; const rotate = -180 * progress; let rotateY = rotate; let rotateX = 0; let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset; let ty = 0; if (!swiper.isHorizontal()) { ty = tx; tx = 0; rotateX = -rotateY; rotateY = 0; } else if (rtl) { rotateY = -rotateY; } $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length; if (params.slideShadows) { createSlideShadows($slideEl, progress, params); } const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`; const $targetEl = effectTarget(params, $slideEl); $targetEl.transform(transform); } }; const setTransition = duration => { const { transformEl } = swiper.params.flipEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); effectVirtualTransitionEnd({ swiper, duration, transformEl }); }; effectInit({ effect: 'flip', swiper, on, setTranslate, setTransition, recreateShadows, getEffectParams: () => swiper.params.flipEffect, perspective: () => true, overwriteParams: () => ({ slidesPerView: 1, slidesPerGroup: 1, watchSlidesProgress: true, spaceBetween: 0, virtualTranslate: !swiper.params.cssMode }) }); } function EffectCoverflow(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ coverflowEffect: { rotate: 50, stretch: 0, depth: 100, scale: 1, modifier: 1, slideShadows: true, transformEl: null } }); const setTranslate = () => { const { width: swiperWidth, height: swiperHeight, slides, slidesSizesGrid } = swiper; const params = swiper.params.coverflowEffect; const isHorizontal = swiper.isHorizontal(); const transform = swiper.translate; const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2; const rotate = isHorizontal ? params.rotate : -params.rotate; const translate = params.depth; // Each slide offset from center for (let i = 0, length = slides.length; i < length; i += 1) { const $slideEl = slides.eq(i); const slideSize = slidesSizesGrid[i]; const slideOffset = $slideEl[0].swiperSlideOffset; const centerOffset = (center - slideOffset - slideSize / 2) / slideSize; const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier; let rotateY = isHorizontal ? rotate * offsetMultiplier : 0; let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0 let translateZ = -translate * Math.abs(offsetMultiplier); let stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) { stretch = parseFloat(params.stretch) / 100 * slideSize; } let translateY = isHorizontal ? 0 : stretch * offsetMultiplier; let translateX = isHorizontal ? stretch * offsetMultiplier : 0; let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values if (Math.abs(translateX) < 0.001) translateX = 0; if (Math.abs(translateY) < 0.001) translateY = 0; if (Math.abs(translateZ) < 0.001) translateZ = 0; if (Math.abs(rotateY) < 0.001) rotateY = 0; if (Math.abs(rotateX) < 0.001) rotateX = 0; if (Math.abs(scale) < 0.001) scale = 0; const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`; const $targetEl = effectTarget(params, $slideEl); $targetEl.transform(slideTransform); $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; if (params.slideShadows) { // Set shadows let $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); let $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); if ($shadowBeforeEl.length === 0) { $shadowBeforeEl = createShadow(params, $slideEl, isHorizontal ? 'left' : 'top'); } if ($shadowAfterEl.length === 0) { $shadowAfterEl = createShadow(params, $slideEl, isHorizontal ? 'right' : 'bottom'); } if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0; } } }; const setTransition = duration => { const { transformEl } = swiper.params.coverflowEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); }; effectInit({ effect: 'coverflow', swiper, on, setTranslate, setTransition, perspective: () => true, overwriteParams: () => ({ watchSlidesProgress: true }) }); } function EffectCreative(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ creativeEffect: { transformEl: null, limitProgress: 1, shadowPerProgress: false, progressMultiplier: 1, perspective: true, prev: { translate: [0, 0, 0], rotate: [0, 0, 0], opacity: 1, scale: 1 }, next: { translate: [0, 0, 0], rotate: [0, 0, 0], opacity: 1, scale: 1 } } }); const getTranslateValue = value => { if (typeof value === 'string') return value; return `${value}px`; }; const setTranslate = () => { const { slides, $wrapperEl, slidesSizesGrid } = swiper; const params = swiper.params.creativeEffect; const { progressMultiplier: multiplier } = params; const isCenteredSlides = swiper.params.centeredSlides; if (isCenteredSlides) { const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0; $wrapperEl.transform(`translateX(calc(50% - ${margin}px))`); } for (let i = 0; i < slides.length; i += 1) { const $slideEl = slides.eq(i); const slideProgress = $slideEl[0].progress; const progress = Math.min(Math.max($slideEl[0].progress, -params.limitProgress), params.limitProgress); let originalProgress = progress; if (!isCenteredSlides) { originalProgress = Math.min(Math.max($slideEl[0].originalProgress, -params.limitProgress), params.limitProgress); } const offset = $slideEl[0].swiperSlideOffset; const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0]; const r = [0, 0, 0]; let custom = false; if (!swiper.isHorizontal()) { t[1] = t[0]; t[0] = 0; } let data = { translate: [0, 0, 0], rotate: [0, 0, 0], scale: 1, opacity: 1 }; if (progress < 0) { data = params.next; custom = true; } else if (progress > 0) { data = params.prev; custom = true; } // set translate t.forEach((value, index) => { t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`; }); // set rotates r.forEach((value, index) => { r[index] = data.rotate[index] * Math.abs(progress * multiplier); }); $slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; const translateString = t.join(', '); const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`; const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`; const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier; const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; // Set shadows if (custom && data.shadow || !custom) { let $shadowEl = $slideEl.children('.swiper-slide-shadow'); if ($shadowEl.length === 0 && data.shadow) { $shadowEl = createShadow(params, $slideEl); } if ($shadowEl.length) { const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress; $shadowEl[0].style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1); } } const $targetEl = effectTarget(params, $slideEl); $targetEl.transform(transform).css({ opacity: opacityString }); if (data.origin) { $targetEl.css('transform-origin', data.origin); } } }; const setTransition = duration => { const { transformEl } = swiper.params.creativeEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration); effectVirtualTransitionEnd({ swiper, duration, transformEl, allSlides: true }); }; effectInit({ effect: 'creative', swiper, on, setTranslate, setTransition, perspective: () => swiper.params.creativeEffect.perspective, overwriteParams: () => ({ watchSlidesProgress: true, virtualTranslate: !swiper.params.cssMode }) }); } function EffectCards(_ref) { let { swiper, extendParams, on } = _ref; extendParams({ cardsEffect: { slideShadows: true, transformEl: null, rotate: true, perSlideRotate: 2, perSlideOffset: 8 } }); const setTranslate = () => { const { slides, activeIndex } = swiper; const params = swiper.params.cardsEffect; const { startTranslate, isTouched } = swiper.touchEventsData; const currentTranslate = swiper.translate; for (let i = 0; i < slides.length; i += 1) { const $slideEl = slides.eq(i); const slideProgress = $slideEl[0].progress; const progress = Math.min(Math.max(slideProgress, -4), 4); let offset = $slideEl[0].swiperSlideOffset; if (swiper.params.centeredSlides && !swiper.params.cssMode) { swiper.$wrapperEl.transform(`translateX(${swiper.minTranslate()}px)`); } if (swiper.params.centeredSlides && swiper.params.cssMode) { offset -= slides[0].swiperSlideOffset; } let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset; let tY = 0; const tZ = -100 * Math.abs(progress); let scale = 1; let rotate = -params.perSlideRotate * progress; let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75; const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i; const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate; const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate; if (isSwipeToNext || isSwipeToPrev) { const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5; rotate += -28 * progress * subProgress; scale += -0.5 * subProgress; tXAdd += 96 * subProgress; tY = `${-25 * subProgress * Math.abs(progress)}%`; } if (progress < 0) { // next tX = `calc(${tX}px + (${tXAdd * Math.abs(progress)}%))`; } else if (progress > 0) { // prev tX = `calc(${tX}px + (-${tXAdd * Math.abs(progress)}%))`; } else { tX = `${tX}px`; } if (!swiper.isHorizontal()) { const prevY = tY; tY = tX; tX = prevY; } const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`; const transform = ` translate3d(${tX}, ${tY}, ${tZ}px) rotateZ(${params.rotate ? rotate : 0}deg) scale(${scaleString}) `; if (params.slideShadows) { // Set shadows let $shadowEl = $slideEl.find('.swiper-slide-shadow'); if ($shadowEl.length === 0) { $shadowEl = createShadow(params, $slideEl); } if ($shadowEl.length) $shadowEl[0].style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1); } $slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; const $targetEl = effectTarget(params, $slideEl); $targetEl.transform(transform); } }; const setTransition = duration => { const { transformEl } = swiper.params.cardsEffect; const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; $transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration); effectVirtualTransitionEnd({ swiper, duration, transformEl }); }; effectInit({ effect: 'cards', swiper, on, setTranslate, setTransition, perspective: () => true, overwriteParams: () => ({ watchSlidesProgress: true, virtualTranslate: !swiper.params.cssMode }) }); } // Swiper Class const modules = [Virtual, Keyboard, Mousewheel, Navigation, Pagination, Scrollbar, Parallax, Zoom, Lazy, Controller, A11y, History, HashNavigation, Autoplay, Thumb, freeMode, Grid, Manipulation, EffectFade, EffectCube, EffectFlip, EffectCoverflow, EffectCreative, EffectCards]; Swiper.use(modules); return Swiper; })); //# sourceMappingURL=swiper-bundle.js.map ================================================ FILE: src/css/celebration.less ================================================ html.celebration { --main: hsla(0, 0%, 100%, 0.9); --theme: #ff3b3b!important; --background: rgba(201, 57, 58, 0.95); --title: #fff; --light-a: #fff; --light-b: #f13a3a; --light-c: #dcdcdc; --light-d: #f13a3a; --dark-a: #eee; --dark-b: #eee; --dark-c: #fff; --dark-d: #e4e4e4; --dark-e: #e4e4e4; --color-a: #f13a3a; --bg-a: hsla(0,0%,100%,.102); --bg-b: #ec9494; --bg-c: #ea5454; --bg-d: rgba(189, 13, 14, 0.8); --bg-e: #f13a3a; --bg-g: #ec9494; --bg-j: hsla(0, 0%, 100%, 0.102); --bg-k: hsla(0, 0%, 100%, 0.102); --bg-l: rgb(239 107 107 / 80%); --bg-h: hsl(0deg 68% 53% / 80%); --box-shadow: 1px 1px 3px 1px #cb0b0b; --comm-color-a: #eee; --comm-color-c: #eee; --comm-color-b: #eee; --comm-color-d: #bbb; --comm-color-f: #eee; --comm-color-i: #ddd; --comm-bg-a: rgb(181 51 51 / 80%); --comm-bg-b: rgb(204 78 78 / 90%); --comm-bg-h: rgb(204 78 78 / 90%); background-color: #ec9494; body { background: rgb(145 11 11 / 90%); } .banner .banner-waves { fill: #b81213; } .navbar .navbar-search .input, .navbar .navbar-search-mobile .input { &:focus { background: var(--bg-a); } &::placeholder { color: #ec9494; } } .navbar-slideout { background: rgb(145, 11, 11); } .navbar-slideout-menu { background: var(--background); } .banner:before { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFHGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDIzLTExLTAzVDAwOjMxOjMwKzA4OjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAyMy0xMS0wM1QwMDo0OTozMSswODowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAyMy0xMS0wM1QwMDo0OTozMSswODowMCIgZGM6Zm9ybWF0PSJpbWFnZS9wbmciIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDplMjE4OTA3NS1hNzI0LWJmNGItOTFjYS01YTJiMTU3N2U1ZTciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ZTIxODkwNzUtYTcyNC1iZjRiLTkxY2EtNWEyYjE1NzdlNWU3IiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6ZTIxODkwNzUtYTcyNC1iZjRiLTkxY2EtNWEyYjE1NzdlNWU3Ij4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDplMjE4OTA3NS1hNzI0LWJmNGItOTFjYS01YTJiMTU3N2U1ZTciIHN0RXZ0OndoZW49IjIwMjMtMTEtMDNUMDA6MzE6MzArMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4LH1UYAAAAHklEQVQIHWP4LyhoCMR+UNqQAZkDEzBEwn7IAmCVAPCsFZXLivthAAAAAElFTkSuQmCC); } .card { border-radius: 0; &:hover { background: #b81213; } } .hljs { color: hsla(0, 25%, 94%, 0.9); background: hsl(0deg 68% 53% / 80%); } .main-content { .note { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAoCAYAAAA/tpB3AAAAFUlEQVQImWMY7ODr16//CbmRgYEBAJG+A9/jkW/TAAAAAElFTkSuQmCC); } figure { pre>ul, figcaption { color: #eebfbf; background: rgb(255 132 132 / 40%); } pre code { color: hsla(0, 25%, 94%, 0.9); } } .pwd { background: var(--bg-g); color: var(--bg-g); } } .tips { background-color: rgb(253 237 237 / 90%)!important; } .widget.profile .address { color: #e4e4e4; } .links:not(.widget) .link-desc { color: #e4e4e4; } .aplayer .aplayer-info .aplayer-music .aplayer-author, .aplayer .aplayer-lrc p, .aplayer .aplayer-info .aplayer-controller .aplayer-time, .aplayer .aplayer-list ol li .aplayer-list-author, .aplayer .aplayer-list ol li .aplayer-list-index { color: #ddd; } .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon path { fill: #ddd; } } ================================================ FILE: src/css/cursor.less ================================================ @default: var(--cursor-default); @pointer: var(--cursor-pointer); @text: var(--cursor-text); @zoom-in: var(--cursor-zoom-in); body { cursor: @default; } a, button, .expand-done, .navbar-above .navbar-nav .item, .navbar-slideicon, .navbar-searchicon, .widget .ad-tag .click-close, .actions > div, .main-content figure > figcaption div, .photos .picture-details { cursor: @pointer; } .aplayer .aplayer-pic, .aplayer .aplayer-music, .aplayer .aplayer-bar-wrap, .aplayer .aplayer-icon { cursor: @pointer !important; } .main-content :not(.jg-entry)>img:not([class]) { cursor: @zoom-in; } p, input[type=text], blockquote, th, td, code, h1, h2, h3, h4, h5, h6, hr, li, textarea { cursor: @text; } ================================================ FILE: src/css/dshare.less ================================================ @charset "utf-8"; /* CSS Document */ @font-face { font-family: "dshare"; src: url("../font/dshare.woff2") format("woff2") } .dshare { &-container { font-family: "dshare" !important; .dshare-icon { width: 32px; height: 32px; margin: 4px; font-size: 20px; line-height: 32px; border: 1px solid; text-align: center; vertical-align: middle; display: inline-block; border-radius: 50%; transition: background 0.6s ease-out 0s; &:hover { color: #fff; } } .icon-qq { color: #56b6e7; border-color: #56b6e7; &:before { content: '\f01a'; } &:hover { background: #56b6e7; } } .icon-qzone { color: #FDBE3D; border-color: #FDBE3D; &:before { content: '\f02a'; } &:hover { background: #FDBE3D; } } .icon-wechat { position: relative; color: #7bc549; border-color: #7bc549; &:before { content: '\f03a'; } &:hover { background: #7bc549; .wechat-qrcode { opacity: 1; transform: translateY(-15px); } } } .icon-weibo { color: #ff763b; border-color: #ff763b; &:before { content: '\f04a'; } &:hover { background: #ff763b; } } .icon-douban { color: #33b045; border-color: #33b045; &:before { content: '\f05a'; } &:hover { background: #33b045; } } .icon-linkedin { color: #0077B5; border-color: #0077B5; &:before { content: '\f06a'; } &:hover { background: #0077B5; } } .icon-facebook { color: #44619D; border-color: #44619D; &:before { content: '\f07a'; } &:hover { background: #44619D; } } .icon-twitter { color: #55acee; border-color: #55acee; &:before { content: '\f08a'; } &:hover { background: #55acee; } } .icon-google { color: #db4437; border-color: #db4437; &:before { content: '\f09a'; } &:hover { background: #db4437; } } .icon-link { color: var(--theme); border-color: var(--theme); &:before { content: '\f10a'; } &:hover { background: var(--theme); } } .icon-poster { color: var(--theme); border-color: var(--theme); &:before { content: '\f11a'; } &:hover { background: var(--theme); } } .wechat-qrcode { opacity: 0; position: absolute; height: 165px; width: 140px; top: -150px; left: -54px; font-size: 12px; border: 1px solid #eee; border-radius: 5px; background: #fff; box-shadow: 0 2px 10px #aaa; pointer-events: none; transition: all 0.3s; &:after { content: ''; position: absolute; left: 50%; margin-left: -8px; bottom: -13px; width: 0; height: 0; border-width: 8px 8px 6px 8px; border-style: solid; border-color: #fff transparent transparent transparent; } h4 { margin: 0; padding: 0; height: 25px; line-height: 25px; color: #777; background-color: #f3f3f3; } img { width: 100%; } } } &-poster { left: 0; top: 0; height: 100%; width: 100%; position: fixed; z-index: 99999; transition: all 0.3s; background: rgba(0, 0, 0, 0.3); &.close-animation { opacity: 0; .dshare-poster-container > * { transform: scale(0.4); } } &-container { top: 50%; left: 50%; display: grid; position: absolute; width: 360px; max-width: 90%; transform: translate(-50%, -50%); } &-download { width: 50px; height: 50px; margin-top: 20px; line-height: 50px; font-size: 24px; cursor: pointer; background: var(--theme); border-radius: 50%; color: #fff; text-align: center; transition: all 0.3s; justify-self: center; } &-crad { overflow: hidden; background: #fff; border-radius: 6px; user-select: none; transition: all 0.3s; font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } &-cover { position: relative; margin-bottom: -68px; &:after { content: ''; position: absolute; left: 0; bottom: -1px; width: 100%; height: 140px; background: linear-gradient(180deg,transparent,#fff); } img{ width: 100%; min-height: 180px; max-height: 340px; object-fit: cover; } } &-content { padding: 10px; } &-title { color: #333; position: relative; margin-top: 8px; padding-bottom: 14px; font-size: 18px; &:before { content: ''; position: absolute; width: 20%; height: 2px; left: 0; bottom: 8px; border-radius: 5px; background: var(--theme); } &:after { content: ''; position: absolute; width: 63%; height: 2px; left: 0; bottom: 1px; border-radius: 5px; background: var(--theme); } } &-desc { margin-top: 12px; text-indent: 2em; color: var(--main); line-height: 1.6em; } &-footer { margin-top: 28px; border: 1px #ccc dashed; border-radius: 5px; display: flex; } &-qrcode { width: 70px; &-info { margin: auto 0 auto 8px; } &-site { font-size: 16px; } &-msg { margin-top: 4px; color: #999; } } } } ================================================ FILE: src/css/mew-custom.less ================================================ @charset "utf-8"; /* CSS Document */ mew-hide { display: block; cursor: pointer; overflow: hidden; position: relative; height: 4em; margin-bottom: 14px; border-radius: var(--radius-wrap); &:before { content: '隐藏内容,评论后可见'; position: absolute; top: 0; bottom: 0; left: 0; right: 0; line-height: 4em; text-align: center; padding: 0 12px; background: repeating-linear-gradient(135deg, var(--light-b), var(--light-b) 1rem, var(--background) 0, var(--background) 2rem); } } mew-subtitle { display: flex; justify-content: center; margin: 14px 0; & > span { position: relative; color: var(--main); padding: 0 47px; &:hover { &::before { left: 12px; } &::after { right: 12px; } } &::before { content: ""; position: absolute; top: 50%; left: 0; width: 20px; height: 1px; background: var(--theme); transition: all .35s; } &::after { content: ""; position: absolute; top: 50%; right: 0; width: 20px; height: 1px; background: var(--theme); transition: all .35s; } } } mew-music { display: block; background-color: var(--bg-d) !important; max-width: 620px; margin: auto auto 14px auto!important; &:not(.aplayer) { padding: 10px 20px; font-size: 1.1em; border: 1px solid var(--light-b); border-radius: 5px; &:before { content: "\ef83"; font-family: 'remixicon'; color: var(--theme); margin-right: 10px; } } .aplayer-list ol li { border-top: 1px solid rgba(180, 180, 180, 0.2) !important; &.aplayer-list-light { background: rgba(200, 200, 200, 0.2) !important; } &:hover { background: rgba(200, 200, 200, 0.2) !important; } } &.aplayer-withlist .aplayer-info { border-bottom: none; } .aplayer-lrc { &:before { background: linear-gradient(180deg, #c5c5c52b 0, hsla(0, 0%, 100%, 0)) !important; } &:after { background: linear-gradient(180deg, hsl(0deg 0% 100% / 0%) 0, hsl(0deg 0% 100% / 23%)) !important; } } } mew-bilibili { display: block; position: relative; margin-bottom: 14px; & > iframe { position: absolute; height: 100%; top: 0; bottom: 0; left: 50%; right: 0; transform: translateX(-50%); border-radius: var(--radius-inner); } } mew-tabs { width: 100%; overflow: hidden; display: block; background: var(--bg-d); border: 1px solid var(--light-b); border-radius: var(--radius-inner); line-height: 26px; margin-bottom: 14px; .tabs-head { width: 100%; overflow-x: auto; overflow-y: hidden; display: flex; background: var(--bg-h); & > div { position: relative; padding: 0 14px; line-height: 40px; height: 40px; color: var(--dark-b); cursor: pointer; transition: color .5s; white-space: nowrap; font-size: 1em; &::after { content: ""; position: absolute; background: var(--theme); bottom: 0; left: 14px; right: 14px; height: 2px; opacity: 0; border-radius: 2px; transform: scaleX(.5); transition: opacity .25s, transform .25s; } &.active { color: var(--theme); &::after { opacity: 1; transform: scaleX(1); } } } } .tabs-body { padding: 12px 14px; & > div { display: none; &.active { display: block; } } } } mew-cloud { display: flex; align-items: center; padding: 10px; overflow: hidden; border: 1px solid var(--light-b); border-radius: var(--radius-inner); box-shadow: 1px 1px 5px 0 var(--bg-b); background: var(--background); margin-bottom: 14px; .mew-cloud-logo { flex-shrink: 0; width: 2.4em; height: 2.4em; margin-right: 10px; background-size: 100% 100%; &.type-default { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNjUyMTY1ODk4NzQ2IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjcyNjYiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PGRlZnM+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5AZm9udC1mYWNlIHsgZm9udC1mYW1pbHk6IGZlZWRiYWNrLWljb25mb250OyBzcmM6IHVybCgiLy9hdC5hbGljZG4uY29tL3QvZm9udF8xMDMxMTU4X3U2OXc4eWh4ZHUud29mZjI/dD0xNjMwMDMzNzU5OTQ0IikgZm9ybWF0KCJ3b2ZmMiIpLCB1cmwoIi8vYXQuYWxpY2RuLmNvbS90L2ZvbnRfMTAzMTE1OF91Njl3OHloeGR1LndvZmY/dD0xNjMwMDMzNzU5OTQ0IikgZm9ybWF0KCJ3b2ZmIiksIHVybCgiLy9hdC5hbGljZG4uY29tL3QvZm9udF8xMDMxMTU4X3U2OXc4eWh4ZHUudHRmP3Q9MTYzMDAzMzc1OTk0NCIpIGZvcm1hdCgidHJ1ZXR5cGUiKTsgfQo8L3N0eWxlPjwvZGVmcz48cGF0aCBkPSJNMTkwLjU3MTQyODMyIDI1NC44NTcxNDI0OGg2NDIuODU3MTQzMzZjMTkuMjg1NzE0MTYgMCAzMi4xNDI4NTc1MiAxMi44NTcxNDI0OCAzMi4xNDI4NTY2NCAzMi4xNDI4NTc1MnY0ODIuMTQyODU3NTJIMTU4LjQyODU3MTY4VjI4N2MwLTE5LjI4NTcxNDE2IDEyLjg1NzE0MjQ4LTMyLjE0Mjg1NzUyIDMyLjE0Mjg1NjY0LTMyLjE0Mjg1NzUyeiIgZmlsbD0iIzkxRDVGRiIgcC1pZD0iNzI2NyI+PC9wYXRoPjxwYXRoIGQ9Ik0yMjUuOTI4NTcxNjggMTI2LjI4NTcxNDE2aDU0MGMxOS4yODU3MTQxNiAwIDM1LjM1NzE0MjQ4IDE2LjA3MTQyODMyIDM1LjM1NzE0MjQ4IDMyLjE0Mjg1NzUycy0xNi4wNzE0MjgzMiAzMi4xNDI4NTc1Mi0zNS4zNTcxNDI0OCAzMi4xNDI4NTY2NEgyMjUuOTI4NTcxNjhDMjA2LjY0Mjg1NzUyIDE5MC41NzE0MjgzMiAxOTAuNTcxNDI4MzIgMTc0LjUgMTkwLjU3MTQyODMyIDE1OC40Mjg1NzE2OHMxNi4wNzE0MjgzMi0zMi4xNDI4NTc1MiAzNS4zNTcxNDMzNi0zMi4xNDI4NTc1MnoiIGZpbGw9IiNCQUU3RkYiIHAtaWQ9IjcyNjgiPjwvcGF0aD48cGF0aCBkPSJNMTEwLjIxNDI4NTg0IDQ3OS44NTcxNDI0OGgyMDIuNWw2MS4wNzE0MjgzMiAxNDEuNDI4NTcxNjhoMjczLjIxNDI4NTg0bDczLjkyODU3MTY4LTE0MS40Mjg1NzE2OGgxOTIuODU3MTQyNDhjMjUuNzE0Mjg1ODQgMCA0OC4yMTQyODU4NCAyMi41IDQ4LjIxNDI4NTg0IDQ4LjIxNDI4NTg0djM4NS43MTQyODU4NGMwIDI1LjcxNDI4NTg0LTIyLjUgNDguMjE0Mjg1ODQtNDguMjE0Mjg1ODQgNDguMjE0Mjg1ODRoLTgwMy41NzE0MjgzMkM4NC41IDk2MiA2MiA5MzkuNSA2MiA5MTMuNzg1NzE0MTZ2LTM4NS43MTQyODU4NGMzLjIxNDI4NTg0LTI1LjcxNDI4NTg0IDIyLjUtNDguMjE0Mjg1ODQgNDguMjE0Mjg1ODQtNDguMjE0Mjg1ODR6IiBmaWxsPSIjNDBBOUZGIiBwLWlkPSI3MjY5Ij48L3BhdGg+PHBhdGggZD0iTTI4NyA3NjkuMTQyODU3NTJoNDUwYzE5LjI4NTcxNDE2IDAgMzIuMTQyODU3NTIgMTIuODU3MTQyNDggMzIuMTQyODU3NTIgMzIuMTQyODU2NjRzLTEyLjg1NzE0MjQ4IDMyLjE0Mjg1NzUyLTMyLjE0Mjg1NzUyIDMyLjE0Mjg1NzUySDI4N2MtMTkuMjg1NzE0MTYgMC0zMi4xNDI4NTc1Mi0xMi44NTcxNDI0OC0zMi4xNDI4NTc1Mi0zMi4xNDI4NTc1MnMxMi44NTcxNDI0OC0zMi4xNDI4NTc1MiAzMi4xNDI4NTc1Mi0zMi4xNDI4NTY2NHoiIGZpbGw9IiNCQUU3RkYiIHAtaWQ9IjcyNzAiPjwvcGF0aD48L3N2Zz4="); } &.type-360 { background-image: url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjIiIGhlaWdodD0iMjIiPjxwYXRoIGQ9Ik04NDMuMjk0IDg3MS45MDZjMC00OS42OTQgNDAuNjU5LTkwLjM1MyA5MC4zNTMtOTAuMzUzUzEwMjQgODIyLjIxMiAxMDI0IDg3MS45MDZzLTQwLjY1OSA5MC4zNTMtOTAuMzUzIDkwLjM1My05MC4zNTMtNDAuNjU5LTkwLjM1My05MC4zNTN6IiBmaWxsPSIjRkY5OTMyIi8+PHBhdGggZD0iTTg0NC44IDY4Ni42ODJsLTEzMS4wMTItNTIuNzA2Yy0xMC41NC00LjUxNy0xMC41NC0xMi4wNDctNi4wMjMtMjIuNTg4IDEyLjA0Ny0zMS42MjMgMTguMDctNjYuMjU5IDE4LjA3LTEwMC44OTQgMC0xNDcuNTc2LTEyNC45ODgtMjc0LjA3LTI3NC4wNy0yNzQuMDdzLTI3NC4wNyAxMjYuNDk0LTI3NC4wNyAyNzQuMDdjMCAzNC42MzUgOS4wMzQgNzAuNzc3IDIxLjA4MSAxMDIuNCAzLjAxMiA2LjAyNCAzLjAxMiAxMy41NTMgMCAxOS41NzctMy4wMTEgNC41MTctNi4wMjMgMC0xMC41NCAxLjUwNUw1NS43MTcgNjc3LjY0N2MtMS41MDYgMS41MDYtNC41MTggMS41MDYtNi4wMjQgMS41MDYtOS4wMzUgMC0xNS4wNTktNC41MTgtMTguMDctMTMuNTUzQzEyLjA0NyA2MTQuNCAxLjUwNiA1NjMuMiAxLjUwNiA1MTAuNDk0IDEuNTA2IDI2My41MyAyMDQuOCA2MC4yMzUgNDUzLjI3IDYwLjIzNXM0NTAuMjU4IDIwMS43ODkgNDUwLjI1OCA0NDguNzUzYzAgNTguNzMtMTAuNTQgMTE0LjQ0Ny0zMS42MjMgMTY3LjE1My0xLjUwNiA0LjUxOC02LjAyNCA5LjAzNS0xMi4wNDcgMTAuNTQxLTMuMDEyIDEuNTA2LTQuNTE4IDEuNTA2LTcuNTMgMS41MDZzLTQuNTE3IDAtNy41MjktMS41MDZ6IiBmaWxsPSIjMEZCMjY0Ii8+PHBhdGggZD0iTTUxLjIgNzE4LjMwNmMtNy41My0xNS4wNTktMTMuNTUzLTMxLjYyNC0xOS41NzYtNDYuNjgyLTMuMDEyLTcuNTMtMy4wMTItMTMuNTUzLTMuMDEyLTE2LjU2NSAwLTQ5LjY5NCA0MC42NTktODguODQ3IDkxLjg1OS04OC44NDcgMzcuNjQ3IDAgNjkuMjcgMjIuNTg4IDg0LjMyOSA1NS43MTcgMS41MDYgMy4wMTIgNi4wMjQgMTIuMDQ3IDkuMDM1IDE2LjU2NSA0Ni42ODMgODguODQ3IDEzOC41NDEgMTQ2LjA3IDIzOS40MzYgMTQ2LjA3IDk5LjM4OCAwIDE4OS43NC01NS43MTcgMjM3LjkyOS0xNDEuNTUyIDQuNTE4LTkuMDM2IDE2LjU2NS0zMC4xMTggMTguMDctMzEuNjI0IDE1LjA2LTMwLjExNyA0My42NzEtNDUuMTc2IDc2LjgtNDUuMTc2IDUxLjIgMCA5MS44NiA0MC42NTkgOTEuODYgODguODQ3IDAgNi4wMjMgMCAxMy41NTMtNC41MTggMjIuNTg4bC05LjAzNiAyMi41ODh2MS41MDZjLTEuNTA1IDQuNTE4LTMuMDExIDcuNTMtNi4wMjMgMTIuMDQ3LTc2LjggMTUzLjYtMjMxLjkwNiAyNDguNDctNDAzLjU3NyAyNDguNDdTMTI5LjUwNiA4NjguODk1IDUxLjIgNzE4LjMwN3oiIGZpbGw9IiNGRjk5MzIiLz48L3N2Zz4=); } &.type-bd { background-image: url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PHBhdGggZD0iTTI3MS4zOCA0MjkuNjM3YTI0NS41IDI0NS41IDAgMCAxLTMuMzk1LTQwLjc3N2MwLTEzNC42OCAxMDkuMTgtMjQzLjg2IDI0My44Ni0yNDMuODZzMjQzLjg2IDEwOS4xOCAyNDMuODYgMjQzLjg2YTI0NS41IDI0NS41IDAgMCAxLTMuMzk0IDQwLjc3NkM4NzUuOTY3IDQzMC4zMTIgOTc2IDUzMC43NjMgOTc2IDY1NC41NzhjMCAxMjQuMjM1LTEwMC43MTIgMjI0Ljk0Ny0yMjQuOTQ2IDIyNC45NDctNjIuNzQzIDAtMTE5LjQ4Ni0yNS42ODgtMTYwLjI4Ny02Ny4xMmwuMDAzLS4wMDRjLTIxLjQ0LTIxLjgyMi0yMS4zMjItNTYuODkzLjM1NC03OC41NyAyMS43OTYtMjEuNzk1IDU3LjEzMy0yMS43OTUgNzguOTI4IDAgLjY5My42OTQgMS4zNjUgMS40IDIuMDE0IDIuMTIgMjAuNDI3IDE5Ljg3IDQ4LjMxNyAzMi4xMDggNzkuMDY1IDMyLjEwOCA2Mi42MzEgMCAxMTMuNDA0LTUwLjc3MiAxMTMuNDA0LTExMy40MDMgMC02Mi42MzEtNTAuNzczLTExMy40MDMtMTEzLjQwNC0xMTMuNDAzLTI4LjczOSAwLTU0Ljk4MSAxMC42OS03NC45NjcgMjguMzExbC0uMDk2LS4wOTYtMS44ODYgMS44ODZjLTIuMiAyLjAzMy00LjMyIDQuMTUyLTYuMzUzIDYuMzUzbC00LjMwNiA0LjMwNS4wNzYuMDc3LTIyOS44NzYgMjI5Ljg3Ni0uMDMtLjAzYy00MC44MzMgNDEuNzA4LTk3Ljc2NyA2Ny41OS0xNjAuNzQ3IDY3LjU5QzE0OC43MTIgODc5LjUyNSA0OCA3NzguODEzIDQ4IDY1NC41NzhjMC0xMjMuNzExIDk5Ljg2Ni0yMjQuMDk4IDIyMy4zOC0yMjQuOTR6bTEuNjQ0IDMzOC40MjJjNjIuNjMgMCAxMTMuNDAzLTUwLjc3MiAxMTMuNDAzLTExMy40MDMgMC02Mi42MzEtNTAuNzcyLTExMy40MDMtMTEzLjQwMy0xMTMuNDAzLTYyLjYzMSAwLTExMy40MDQgNTAuNzcyLTExMy40MDQgMTEzLjQwMyAwIDYyLjYzIDUwLjc3MyAxMTMuNDAzIDExMy40MDQgMTEzLjQwM3pNNTExLjg0NSA1MjEuMWM3My4wMzQgMCAxMzIuMjQtNTkuMjA2IDEzMi4yNC0xMzIuMjQgMC03My4wMzMtNTkuMjA2LTEzMi4yMzktMTMyLjI0LTEzMi4yMzlzLTEzMi4yNCA1OS4yMDYtMTMyLjI0IDEzMi4yNGMwIDczLjAzMyA1OS4yMDYgMTMyLjIzOSAxMzIuMjQgMTMyLjIzOXoiIGZpbGw9IiMwNkE3RkYiLz48cGF0aCBkPSJNNjQzLjM1MSA0MDIuODY4YTU2Ljk2NiA1Ni45NjYgMCAwIDEtLjM1Mi02LjMzNGMwLTMxLjEyMyAyNS4yMy01Ni4zNTMgNTYuMzUzLTU2LjM1M3M1Ni4zNTMgMjUuMjMgNTYuMzUzIDU2LjM1M2MwIDIuMzktLjE1IDQuNzQ1LS40MzggNy4wNTctNy42MTYgMTI3LjgyLTExMy42ODggMjI5LjEyOC0yNDMuNDIyIDIyOS4xMjgtMTI5LjczNCAwLTIzNS44MDYtMTAxLjMwNy0yNDMuNDIyLTIyOS4xMjhhNTYuOTA4IDU2LjkwOCAwIDAgMS0uNDM4LTcuMDU3YzAtMzEuMTIzIDI1LjIzLTU2LjM1MyA1Ni4zNTMtNTYuMzUzczU2LjM1MyAyNS4yMyA1Ni4zNTMgNTYuMzUzYzAgMi4xNDEtLjEyIDQuMjU1LS4zNTIgNi4zMzQgNi45OTYgNjYuNDQ4IDYzLjIwNCAxMTguMjMgMTMxLjUwNiAxMTguMjMgNjguMzAyIDAgMTI0LjUxLTUxLjc4MiAxMzEuNTA2LTExOC4yM3oiIGZpbGw9IiNGRjQzNkEiLz48L3N2Zz4=); } &.type-wy { background-image: url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjIiIGhlaWdodD0iMjIiPjxwYXRoIGQ9Ik04ODAuMyA2MzEuOWMtMy40IDAtNi45LS42LTEwLjItMS44LTE2LjEtNS43LTI0LjUtMjMuMy0xOC45LTM5LjQgNi40LTE4LjEgOS42LTM3LjEgOS42LTU2LjUgMC05My4zLTc1LjktMTY5LjItMTY5LjEtMTY5LjItNzcuNiAwLTE0NS4xIDUyLjQtMTY0IDEyNy41LTQuMiAxNi41LTIwLjggMjYuNi0zNy41IDIyLjQtMTYuNS00LjItMjYuNS0yMS0yMi40LTM3LjUgMjUuOS0xMDIuNSAxMTgtMTc0LjEgMjIzLjktMTc0LjEgMTI3LjMgMCAyMzAuOCAxMDMuNiAyMzAuOCAyMzAuOSAwIDI2LjQtNC40IDUyLjMtMTMuMSA3Ny00LjUgMTIuNy0xNi40IDIwLjctMjkuMSAyMC43eiIgZmlsbD0iIzA5RiIvPjxwYXRoIGQ9Ik00NDcuNCA3ODMuM0gzMzIuNmMtMTI3LjMgMC0yMzAuOS05Ny41LTIzMC45LTIxNy4zIDAtOTQuOSA2NS45LTE3OC4zIDE2MC0yMDYuOCAxMC4yLTExNy45IDEwOS41LTIxMC43IDIzMC0yMTAuNyAxMDcuMSAwIDIwMS44IDc1LjggMjI1LjMgMTgwLjEgMy43IDE2LjYtNi44IDMzLjEtMjMuNCAzNi45LTE2LjcgMy45LTMzLjItNi43LTM2LjktMjMuMy0xNy4xLTc2LjQtODYuNS0xMzEuOS0xNjUtMTMxLjktOTMuMyAwLTE2OS4yIDc1LjktMTY5LjIgMTY5LjEgMS43IDguMS4zIDE1LjQtNC40IDIyLjMtNC42IDYuOS0xMS43IDEwLjQtMTkuOSAxMi03OC4yIDE0LjgtMTM0LjkgNzguOS0xMzQuOSAxNTIuNCAwIDg1LjggNzUuOSAxNTUuNiAxNjkuMiAxNTUuNmgxMTQuOGMxNyAwIDMwLjkgMTMuOCAzMC45IDMwLjlzLTEzLjggMzAuNy0zMC44IDMwLjd6bTExMi43LTMxYy04LjIgMC0xNi4zLTMuMi0yMi40LTkuNi0xMS43LTEyLjQtMTEuMy0zMS45IDEuMS00My42bDEyNi43LTEyMC40YzExLjgtMTEuMyAzMC41LTExLjMgNDIuNSAwTDgzNC44IDY5OWMxMi40IDExLjcgMTIuOSAzMS4zIDEuMSA0My42LTExLjcgMTIuMy0zMS4zIDEyLjktNDMuNiAxLjFMNjg2LjggNjQzLjYgNTgxLjMgNzQzLjhjLTUuOSA1LjctMTMuNiA4LjUtMjEuMiA4LjV6IiBmaWxsPSIjMDlGIi8+PHBhdGggZD0iTTY4Ni44IDg3OWMtMTcgMC0zMC45LTEzLjgtMzAuOS0zMC45VjYwMWMwLTE3IDEzLjktMzAuOSAzMC45LTMwLjlzMzAuOSAxMy44IDMwLjkgMzAuOXYyNDcuMWMwIDE3LjEtMTMuOSAzMC45LTMwLjkgMzAuOXoiIGZpbGw9IiMwOUYiLz48L3N2Zz4=); } &.type-ali { background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIyLjAzNSAxMy44MDZhLjUyNy41MjcgMCAwMS0uMzg0LS42MTdjMS4yMjctNS42MzItMi4yLTExLjMxLTcuODQ1LTEyLjgxN0M4LTEuMTc4IDIuMDA4IDIuMjYuNDM4IDguMDM5bC0uMDAyLjAxLS4wMDUuMDE2Yy0uOTU1IDMuNTgzLS4zMTUgNy4zMzggMS44MTMgMTAuNDRhMTIuNjU5IDEyLjY1OSAwIDAwNi4wODYgNC43MTNjNi44ODcgMi41MDggMTQuMzAzLTEuMjUgMTYuNDk1LTcuOTY4YS42NDMuNjQzIDAgMDAtLjQ0OC0uODE5bC0yLjM0My0uNjI1em0tMTEuNDQgNS40NTdBOC4xMjcgOC4xMjcgMCAwMTUuNjIgMTUuNDZhOC4wODMgOC4wODMgMCAwMS0uODItNi4xODdjLjkzNS0zLjQ0MSA0LjUwMi01LjQ5IDcuOTYtNC41NjYgMy4yODUuODc3IDUuMzA5IDQuMTIxIDQuNzIgNy4zOTdhLjYuNiAwIDAwLjQzNC42OWwyLjIwNi41ODljLjI4LjA3NS40MzcuMzcuMzQ0LjY0Mi0xLjM4IDQuMDI1LTUuNjkgNi4zNTYtOS44NyA1LjI0eiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyKSIvPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhciIgeDE9IjAiIHkxPSIwIiB4Mj0iMjYuMzY2IiB5Mj0iMjIuMjA4IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agc3RvcC1jb2xvcj0iIzQ0NkRGRiIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzYzN0RGRiIgc3RvcC1vcGFjaXR5PSIuNzUiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48L3N2Zz4="); } &.type-github { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNjUyMTY0NzM0OTg3IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjQ2OTUiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PGRlZnM+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5AZm9udC1mYWNlIHsgZm9udC1mYW1pbHk6IGZlZWRiYWNrLWljb25mb250OyBzcmM6IHVybCgiLy9hdC5hbGljZG4uY29tL3QvZm9udF8xMDMxMTU4X3U2OXc4eWh4ZHUud29mZjI/dD0xNjMwMDMzNzU5OTQ0IikgZm9ybWF0KCJ3b2ZmMiIpLCB1cmwoIi8vYXQuYWxpY2RuLmNvbS90L2ZvbnRfMTAzMTE1OF91Njl3OHloeGR1LndvZmY/dD0xNjMwMDMzNzU5OTQ0IikgZm9ybWF0KCJ3b2ZmIiksIHVybCgiLy9hdC5hbGljZG4uY29tL3QvZm9udF8xMDMxMTU4X3U2OXc4eWh4ZHUudHRmP3Q9MTYzMDAzMzc1OTk0NCIpIGZvcm1hdCgidHJ1ZXR5cGUiKTsgfQo8L3N0eWxlPjwvZGVmcz48cGF0aCBkPSJNNTEyIDg1LjMzMzMzM0MyNzYuMjY2NjY3IDg1LjMzMzMzMyA4NS4zMzMzMzMgMjc2LjI2NjY2NyA4NS4zMzMzMzMgNTEyYTQyNi40MTA2NjcgNDI2LjQxMDY2NyAwIDAgMCAyOTEuNzU0NjY3IDQwNC44MjEzMzNjMjEuMzMzMzMzIDMuNzEyIDI5LjMxMi05LjA4OCAyOS4zMTItMjAuMzA5MzMzIDAtMTAuMTEyLTAuNTU0NjY3LTQzLjY5MDY2Ny0wLjU1NDY2Ny03OS40NDUzMzMtMTA3LjE3ODY2NyAxOS43NTQ2NjctMTM0LjkxMi0yNi4xMTItMTQzLjQ0NTMzMy01MC4xMzMzMzQtNC44MjEzMzMtMTIuMjg4LTI1LjYtNTAuMTMzMzMzLTQzLjczMzMzMy02MC4yODgtMTQuOTMzMzMzLTcuOTc4NjY3LTM2LjI2NjY2Ny0yNy43MzMzMzMtMC41NTQ2NjctMjguMjQ1MzMzIDMzLjYyMTMzMy0wLjU1NDY2NyA1Ny42IDMwLjkzMzMzMyA2NS42MjEzMzMgNDMuNzMzMzMzIDM4LjQgNjQuNTEyIDk5Ljc1NDY2NyA0Ni4zNzg2NjcgMTI0LjI0NTMzNCAzNS4yIDMuNzU0NjY3LTI3LjczMzMzMyAxNC45MzMzMzMtNDYuMzc4NjY3IDI3LjIyMTMzMy01Ny4wNDUzMzMtOTQuOTMzMzMzLTEwLjY2NjY2Ny0xOTQuMTMzMzMzLTQ3LjQ4OC0xOTQuMTMzMzMzLTIxMC42ODggMC00Ni40MjEzMzMgMTYuNTEyLTg0Ljc3ODY2NyA0My43MzMzMzMtMTE0LjY4OC00LjI2NjY2Ny0xMC42NjY2NjctMTkuMi01NC40IDQuMjY2NjY3LTExMy4wNjY2NjcgMCAwIDM1LjcxMi0xMS4xNzg2NjcgMTE3LjMzMzMzMyA0My43NzZhMzk1Ljk0NjY2NyAzOTUuOTQ2NjY3IDAgMCAxIDEwNi42NjY2NjctMTQuNDIxMzMzYzM2LjI2NjY2NyAwIDcyLjUzMzMzMyA0Ljc3ODY2NyAxMDYuNjY2NjY2IDE0LjM3ODY2NyA4MS41Nzg2NjctNTUuNDY2NjY3IDExNy4zMzMzMzMtNDMuNjkwNjY3IDExNy4zMzMzMzQtNDMuNjkwNjY3IDIzLjQ2NjY2NyA1OC42NjY2NjcgOC41MzMzMzMgMTAyLjQgNC4yNjY2NjYgMTEzLjA2NjY2NyAyNy4xNzg2NjcgMjkuODY2NjY3IDQzLjczMzMzMyA2Ny43MTIgNDMuNzMzMzM0IDExNC42NDUzMzMgMCAxNjMuNzU0NjY3LTk5LjcxMiAyMDAuMDIxMzMzLTE5NC42NDUzMzQgMjEwLjY4OCAxNS40NDUzMzMgMTMuMzEyIDI4LjggMzguOTEyIDI4LjggNzguOTMzMzMzIDAgNTcuMDQ1MzMzLTAuNTU0NjY3IDEwMi45MTItMC41NTQ2NjYgMTE3LjMzMzMzNCAwIDExLjE3ODY2NyA4LjAyMTMzMyAyNC40OTA2NjcgMjkuMzU0NjY2IDIwLjIyNEE0MjcuMzQ5MzMzIDQyNy4zNDkzMzMgMCAwIDAgOTM4LjY2NjY2NyA1MTJjMC0yMzUuNzMzMzMzLTE5MC45MzMzMzMtNDI2LjY2NjY2Ny00MjYuNjY2NjY3LTQyNi42NjY2Njd6IiBmaWxsPSIjMDAwMDAwIiBwLWlkPSI0Njk2Ij48L3BhdGg+PC9zdmc+"); } &.type-gitee { background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNjUyMTY1NjgxOTQ2IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjQ4NjYiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PGRlZnM+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5AZm9udC1mYWNlIHsgZm9udC1mYW1pbHk6IGZlZWRiYWNrLWljb25mb250OyBzcmM6IHVybCgiLy9hdC5hbGljZG4uY29tL3QvZm9udF8xMDMxMTU4X3U2OXc4eWh4ZHUud29mZjI/dD0xNjMwMDMzNzU5OTQ0IikgZm9ybWF0KCJ3b2ZmMiIpLCB1cmwoIi8vYXQuYWxpY2RuLmNvbS90L2ZvbnRfMTAzMTE1OF91Njl3OHloeGR1LndvZmY/dD0xNjMwMDMzNzU5OTQ0IikgZm9ybWF0KCJ3b2ZmIiksIHVybCgiLy9hdC5hbGljZG4uY29tL3QvZm9udF8xMDMxMTU4X3U2OXc4eWh4ZHUudHRmP3Q9MTYzMDAzMzc1OTk0NCIpIGZvcm1hdCgidHJ1ZXR5cGUiKTsgfQo8L3N0eWxlPjwvZGVmcz48cGF0aCBkPSJNNTEyIDEwMjRDMjI5LjIyMiAxMDI0IDAgNzk0Ljc3OCAwIDUxMlMyMjkuMjIyIDAgNTEyIDBzNTEyIDIyOS4yMjIgNTEyIDUxMi0yMjkuMjIyIDUxMi01MTIgNTEyeiBtMjU5LjE0OS01NjguODgzaC0yOTAuNzRhMjUuMjkzIDI1LjI5MyAwIDAgMC0yNS4yOTIgMjUuMjkzbC0wLjAyNiA2My4yMDZjMCAxMy45NTIgMTEuMzE1IDI1LjI5MyAyNS4yNjcgMjUuMjkzaDE3Ny4wMjRjMTMuOTc4IDAgMjUuMjkzIDExLjMxNSAyNS4yOTMgMjUuMjY3djEyLjY0NmE3NS44NTMgNzUuODUzIDAgMCAxLTc1Ljg1MyA3NS44NTNoLTI0MC4yM2EyNS4yOTMgMjUuMjkzIDAgMCAxLTI1LjI2Ny0yNS4yOTNWNDE3LjIwM2E3NS44NTMgNzUuODUzIDAgMCAxIDc1LjgyNy03NS44NTNoMzUzLjk0NmEyNS4yOTMgMjUuMjkzIDAgMCAwIDI1LjI2Ny0yNS4yOTJsMC4wNzctNjMuMjA3YTI1LjI5MyAyNS4yOTMgMCAwIDAtMjUuMjY4LTI1LjI5M0g0MTcuMTUyYTE4OS42MiAxODkuNjIgMCAwIDAtMTg5LjYyIDE4OS42NDVWNzcxLjE1YzAgMTMuOTc3IDExLjMxNiAyNS4yOTMgMjUuMjk0IDI1LjI5M2gzNzIuOTRhMTcwLjY1IDE3MC42NSAwIDAgMCAxNzAuNjUtMTcwLjY1VjQ4MC4zODRhMjUuMjkzIDI1LjI5MyAwIDAgMC0yNS4yOTMtMjUuMjY3eiIgZmlsbD0iI0M3MUQyMyIgcC1pZD0iNDg2NyI+PC9wYXRoPjwvc3ZnPg==); } &.type-lz { background-image: url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjIiIGhlaWdodD0iMjIiPjxwYXRoIGQ9Ik02NzguNjQgNTE0LjAwN2ExNjguNDQ4IDE2OC40NDggMCAxIDAtMTY4LjQ0NyAxNjcuNzA2QTE2OC4wNyAxNjguMDcgMCAwIDAgNjc4LjY0IDUxNC4wMDd6IiBmaWxsPSIjRjRDQTFDIi8+PHBhdGggZD0iTTk4My4wNCA2MDMuNDEyYTI0Mi40ODggMjQyLjQ4OCAwIDAgMC0yODAuMzkyLTIzOC40MDdBMjUzLjMyMiAyNTMuMzIyIDAgMCAwIDI1Ni4yMiAyODcuMThhMjQ5LjEzNCAyNDkuMTM0IDAgMCAwLTQ4Ljk1NyAxNTMuMzg1QTIwMy4zOTcgMjAzLjM5NyAwIDAgMCAyNDAuMTg5IDg0NC44aDUyNy43NzVhMzEuOTkgMzEuOTkgMCAwIDAgMTQuNzUtMy43MTcgMjQyLjAzOCAyNDIuMDM4IDAgMCAwIDIwMC4zMjYtMjM3LjY3ek03NDAuNjA4IDc4MC43MTNIMjQwLjE4OWExMzkuMzg3IDEzOS4zODcgMCAxIDEgMC0yNzguNzY5IDMxLjk3IDMxLjk3IDAgMCAwIDguNzA0LTEuMzQxIDMxLjk2NCAzMS45NjQgMCAwIDAgMjQuODQ4LTM1Ljk5OSAxODcuODEyIDE4Ny44MTIgMCAwIDEgMTU3Ljc0Mi0yMTQuMDE2IDE4OC40NjIgMTg4LjQ2MiAwIDAgMSAyMDkuNTQxIDEzMi44MzkgMjQxLjYyOCAyNDEuNjI4IDAgMCAwLTE0Mi44NDggMjE5Ljk4NSAzMi4xOCAzMi4xOCAwIDAgMCA2NC4zNTggMCAxNzguMDY4IDE3OC4wNjggMCAxIDEgMTc4LjA3NCAxNzcuMzAxeiIgZmlsbD0iIzU5NUJCMyIvPjwvc3ZnPg=="); } } .mew-cloud-desc { line-height: normal; flex: 1; overflow: hidden; &-title { color: var(--theme); margin-bottom: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } &-type { font-size: 0.8em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } } .mew-cloud-link { flex-shrink: 0; margin-left: auto; background: var(--theme); color: #fff; width: 2em; height: 2em; line-height: 2em; border-radius: 50%; text-align: center; } } mew-progress { display: flex; align-items: center; margin-bottom: 14px; .mew-progress-bar { height: 10px; border-radius: 5px; overflow: hidden; background: var(--light-b); width: 0; min-width: 0; flex: 1; margin-right: 5px; &-inner { height: 100%; overflow: hidden; border-radius: 5px; &:before { content: ''; display: block; height: 100%; background-size: 30px 30px; animation: progress 750ms linear infinite; background-image: linear-gradient(135deg, rgb(255 255 255 / 40%) 25%, transparent 25%, transparent 50%, rgb(255 255 255 / 40%) 50%, rgb(255 255 255 / 40%) 75%, transparent 75%, transparent 100%); } } } .mew-progress-value { width: 38px; color: var(--main); } } mew-panel { display: block; overflow: hidden; border-radius: var(--radius-inner); margin-bottom: 14px; .mew-panel-title { color: #FFF; padding: 6px 12px; font-weight: 400; } .mew-panel-body { background: rgb(255 255 255 / 88%); padding: 12px 18px; position: relative; } } mew-message { display: block; padding: 10px; border-radius: var(--radius-inner); margin-bottom: 14px; &::before { font: normal normal normal 1.1em/1 remixicon; margin-right: 8px; } &[type=error] { color: #f46c6b; background-color: rgb(255 228 226 / 90%); &::before { content: '\eb97'; } } &[type=warning] { color: #FEC008; background-color: rgb(255 243 215 / 90%); &::before { content: '\eca1'; } } &[type=info] { color: #1B72F3; background-color: rgb(232 240 255 / 90%); &::before { content: '\ee59'; } } &[type=success] { color: #2bde3f; background-color: rgb(225 255 228 / 90%); &::before { content: '\eb81'; } } } mew-hr { display: block; height: 4px; background-size: 50px 4px; margin: 14px 0; } mew-timeline { display: block; border-left: 1px solid var(--light-b); margin-bottom: 14px; & > div { position: relative; padding-left: 1.2em; &::before { content: ''; position: absolute; border-radius: 50%; top: 0.1em; } & + .mew-timeline-title { margin-top: 16px; } } .mew-timeline-title { color: var(--dark-c); font-weight: 500; padding-bottom: 5px; &::before { background-color: #50bfff; box-shadow: 0 0 0 0.4em rgb(80 191 255 / 25%); left: -0.32em; height: 0.6em; width: 0.6em; } &-elem { position: relative; top: -0.4em; } } .mew-timeline-item { font-size: 0.95em; &::before { background-color: var(--light-a); border: 2px solid #50bfff; left: -5px; height: 5px; width: 5px; } &:not(:last-child) { padding-bottom: 16px; } &-title { display: block; line-height: 1em; margin-bottom: 2px; font-weight: 400; position: relative; top: -0.1em; } &-content { padding: 8px 12px; overflow: hidden; border-radius: 0 6px 6px 6px; background-color: var(--bg-a); position: relative; * { margin: 0 !important; } } } .info { &.mew-timeline-title { color: #1b72f3; &::before { background-color: #73a3eb; box-shadow: 0 0 0 0.4em rgb(115 163 235 / 25%); } } &.mew-timeline-item::before { border-color: #73a3eb; } .mew-timeline-item-content { color: #1b72f3; background-color: #ecf3ff; } } .warning { &.mew-timeline-title { color: #fec008; &::before { background-color: #ffd350; box-shadow: 0 0 0 0.4em rgb(255 211 80 / 25%); } } &.mew-timeline-item::before { border-color: #ffd350; } .mew-timeline-item-content { color: #fec008; background-color: #fdf6e6; } } .success { &.mew-timeline-title { color: #2bde3f; &::before { background-color: #6de37a; box-shadow: 0 0 0 0.4em rgb(109 227 122 / 25%); } } &.mew-timeline-item::before { border-color: #6de37a; } .mew-timeline-item-content { color: #2bde3f; background-color: #e9fbeb; } } .error { &.mew-timeline-title { color: #f46c6b; &::before { background-color: #ff7776; box-shadow: 0 0 0 0.4em rgb(255 119 118 / 25%); } } &.mew-timeline-item::before { border-color: #ff7776; } .mew-timeline-item-content { color: #f46c6b; background-color: #ffeeed; } } } mew-btn { display: inline-block; margin-bottom: 14px; & > .mew-btn { color: #fff; line-height: 1em; padding: 0.5em 12px; font-weight: 400; display: inline-block; background: var(--theme); border-radius: var(--radius-inner); &:hover { color: #fff; filter: opacity(.8); box-shadow: 0 4px 15px -4px rgb(41 45 52 / 30%); } & > i { margin-right: 6px; } } } mew-quote { display: flex; margin: 0 18px 14px 18px; .mew-quote { display: flex; margin: 0 auto; padding: 10px; &:before { content: '“'; color: var(--theme); font-size: 2.8em; font-family: fantasy; line-height: 1; margin-right: 14px; margin-top: -10px; } &:after { content: '”'; color: var(--theme); font-size: 2.8em; font-family: fantasy; line-height: 1; align-self: flex-end; margin-left: 14px; margin-bottom: calc(-0.5em - 10px); } } .quote-container { display: flex; align-items: flex-start; } .mew-quote-href { padding: 4px; display: inline-block; background: var(--bg-a); transition: transform 2s; margin-right: 8px; flex-shrink: 0; &:hover { transform: rotate(360deg); } &, .quote-avatar-hexagon { clip-path: polygon(40% 7.67949%, 43.1596% 6.20615%, 46.52704% 5.30384%, 50% 5%, 53.47296% 5.30384%, 56.8404% 6.20615%, 60% 7.67949%, 81.65064% 20.17949%, 84.50639% 22.17911%, 86.97152% 24.64425%, 88.97114% 27.5%, 90.44449% 30.6596%, 91.34679% 34.02704%, 91.65064% 37.5%, 91.65064% 62.5%, 91.34679% 65.97296%, 90.44449% 69.3404%, 88.97114% 72.5%, 86.97152% 75.35575%, 84.50639% 77.82089%, 81.65064% 79.82051%, 60% 92.32051%, 56.8404% 93.79385%, 53.47296% 94.69616%, 50% 95%, 46.52704% 94.69616%, 43.1596% 93.79385%, 40% 92.32051%, 18.34936% 79.82051%, 15.49361% 77.82089%, 13.02848% 75.35575%, 11.02886% 72.5%, 9.55551% 69.3404%, 8.65321% 65.97296%, 8.34936% 62.5%, 8.34936% 37.5%, 8.65321% 34.02704%, 9.55551% 30.6596%, 11.02886% 27.5%, 13.02848% 24.64425%, 15.49361% 22.17911%, 18.34936% 20.17949%); } } .mew-quote-info { display: flex; justify-content: center; flex-direction: column; } .mew-quote-content { margin-bottom: 8px; line-height: 1.5em; } .mew-quote-name { color: var(--dark-c); align-self: self-end; font-size: 0.9em; font-style: italic; font-weight: 400; &:before { content: ''; width: 2.8em; height: 1px; background: var(--dark-c); margin-right: 4px; display: inline-block; margin-bottom: 0.3em; } } .quote-avatar-hexagon { height: 5em; width: 5em; object-fit: cover; } } mew-link { margin-bottom: 14px; .mew-link { display: flex; margin: auto; max-width: 420px; background: var(--bg-l); padding: 12px 12px 9px 12px; border-radius: 8px; overflow: hidden; } .mew-link-info { flex-grow: 1; display: flex; justify-content: center; flex-direction: column; } .info-title { margin-bottom: 6px; color: var(--dark-c); line-height: 1.3em; display: -webkit-box; text-overflow: ellipsis; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; } .info-desc { font-size: 0.9em; line-height: 1.3em; height: 1.3em; color: var(--dark-d); word-break: break-all; display: -webkit-box; text-overflow: ellipsis; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 1; &:before { content: '\eeb8'; font-family: 'remixicon'; margin-right: 4px; } } .mew-link-image { background-color: var(--bg-l); position: relative; display: block; width: 60px; height: 60px; margin-left: 16px; border-radius: 4px; overflow: hidden; flex-shrink: 0; } .link-image { width: 100%; height: 100%; object-fit: cover; } } mew-video { display: block; text-align: center; margin-bottom: 14px; video { max-width: 100%; border-radius: var(--radius-inner); } } mew-photos { display: block; width: 100%; position: relative; overflow: hidden; margin-bottom: 14px; & > div { position: absolute; display: inline-block; overflow: hidden; opacity: 0.1; margin: 0; padding: 0; border-radius: 8px; cursor: pointer; & > img { position: absolute; transition: opacity 500ms ease-in; top: 50%; left: 50%; margin: 0; padding: 0; border: none; opacity: 0; } & > .jg-caption { opacity: 0; position: absolute; bottom: 0; padding: 5px; background-color: #000000; left: 0; right: 0; margin: 0; color: white; font-size: 0.85em; font-weight: 300; font-family: sans-serif; transition: opacity 300ms ease-in; &.jg-caption-visible { opacity: 0.7; } } } & > .jg-entry-visible { opacity: 1; background: none; & > img { opacity: 1; } } } mew-raw { display: block; margin-bottom: 14px; } mew-hide, mew-btn, mew-timeline, mew-quote, mew-link, mew-photos, mew-raw { &:not([draw]) { display: none; } } mew-bilibili, mew-cloud, mew-tabs, mew-panel, mew-video { &:not([draw]) { display: block; overflow: hidden; position: relative; height: 2.4em; border: 1px solid var(--light-b); border-radius: var(--radius-inner); box-shadow: 1px 1px 5px 0 var(--bg-b); &:before { content: '加载中...'; position: absolute; top: 0; bottom: 0; left: 0; right: 0; line-height: 2.4em; text-align: left; padding-left: 12px; background: var(--light-a); } } } html.night { .mew-cloud-logo, .mew-cloud-link, .mew-progress-bar-inner, mew-panel, mew-message, mew-hr, mew-timeline, mew-btn { filter: brightness(.8); } } @keyframes progress { 0% { background-position: 0 0 } to { background-position: 30px 0 } } @media (max-width: 1023px) { mew-quote .quote-avatar-hexagon { height: 3.6em; width: 3.6em; object-fit: cover; } } @media (max-width: 511px) { mew-quote { margin: 0; .quote-container { flex-direction: column; align-items: center; } .mew-quote-avatar { text-align: center; } .quote-avatar-hexagon { height: 3.2em; width: 3.2em; } } mew-bilibili { padding: calc(30%) 0px !important; } mew-bilibili iframe, mew-video video { width: 100% !important; } } ================================================ FILE: src/css/post.less ================================================ @charset "utf-8"; /* CSS Document */ .admire { margin: 30px 0 18px 0; text-align: center; &-content { user-select: none; margin-bottom: 15px; button { border-radius: 50px; padding: 8px 18px; border: none; color: var(--light-a); box-shadow: 0 2px 10px rgb(0 0 0 / 10%); i { margin-right: 5px; } } .donate { background: #c0a46b; transition: all 0.2s ease-in-out; position: relative; margin-right: 10px; &-list { position: absolute; bottom: 40px; right: 50%; border-radius: 5px; background: var(--background); box-shadow: var(--box-shadow); padding: 12px; transition: all 0.5s; pointer-events: none; opacity: 0; ol { border-radius: 5px; overflow: hidden; display: flex; } img { max-width: 200px; max-height: 260px; object-fit: cover; } } &:hover { i { animation: dong ease 0.5s 0.2s infinite alternate; } .donate-list { transform: translateX(50%); pointer-events: unset; opacity: 1; } } } .agree { background: #cf4750; i { font-size: 1.2em; } span > span { margin-left: 3px; } &.like { background: var(--background); color: var(--dark-e); &:hover { i { animation: shake-little ease-in-out 4s infinite; } } } &:not(.like) i:before { content: '\f206'; } } } & > span { color: var(--dark-d); font-size: 0.9em; } } .article-operation { margin: 18px 0; display: flex; .level-item { flex-shrink: 1 !important; justify-content: left !important; overflow-x: auto; &::-webkit-scrollbar { display: none; } } a { color: var(--dark-b); font-size: 0.9em; background: var(--bg-b); border: 1px solid var(--bg-b); position: relative; padding: 0 8px 0 29px; height: 26px; line-height: 24px; border-radius: 13px; max-width: 125px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 10px; flex-shrink: 0; &:before { content: ""; position: absolute; top: 0; left: 0; width: 24px; height: 24px; background: var(--background); border-radius: 50%; } &:after { content: '\eae5'; position: absolute; font-family: 'remixicon'; top: 50%; left: 12px; font-size: 1.2em; color: var(--theme); transform: translate(-50%, -50%); } &:hover { color: var(--main); border: 1px solid var(--light-b); } } } .copyright { margin: 18px 0; position: relative; background: var(--bg-h); overflow: hidden; border-radius: 6px; display: block; padding: 17px; &:after { position: absolute; right: -70px; top: -70px; content: '\ebf4'; font-size: 240px; font-family: 'remixicon'; color: var(--theme); opacity: 0.1; } .copyright-title { line-height: 1.2; margin-bottom: 14px; *:not(:last-child) { margin-bottom: 0.25em; } a { font-size: 0.85em; color: var(--dark-d); } } .copyright-meta { display: flex; justify-content: flex-start; flex-wrap: wrap; .icon { width: 1.2em; height: 1.2em; } .level-item { margin-right: 1.4em !important; display: block; h6 { margin: 0; } p, a { color: var(--dark-e); } } } } @media (max-width: 520px) { .admire .donate-list ol { flex-wrap: wrap; img { width: 200px; } } } @keyframes dong { 0% { transform: translateY(3px) scaleY(0.95); } 100% { transform: translateY(-3px) scaleY(1); } } @keyframes shake-little { 0% { transform: translate(0, 0) } 2% { transform: translate(-1px, 1px) } 4% { transform: translate(-1px, -1px) } 6% { transform: translate(0, 0) } 8% { transform: translate(1px, 1px) } 10% { transform: translate(1px, -1px) } 12% { transform: translate(0, 0) } 14% { transform: translate(-1px, 1px) } 16% { transform: translate(-1px, -1px) } 18% { transform: translate(0, 0) } 20% { transform: translate(1px, 1px) } 22% { transform: translate(1px, -1px) } 24% { transform: translate(0, 0) } 26% { transform: translate(-1px, 1px) } 28% { transform: translate(-1px, -1px) } 30% { transform: translate(0, 0) } 32% { transform: translate(1px, 1px) } 34% { transform: translate(1px, -1px) } 36% { transform: translate(0, 0) } 38% { transform: translate(-1px, 1px) } 40% { transform: translate(-1px, -1px) } 42% { transform: translate(0, 0) } 44% { transform: translate(1px, 1px) } 46% { transform: translate(1px, -1px) } 48% { transform: translate(0, 0) } 50% { transform: translate(-1px, 1px) } 52% { transform: translate(-1px, -1px) } 54% { transform: translate(0, 0) } 56% { transform: translate(1px, 1px) } 58% { transform: translate(1px, -1px) } 60% { transform: translate(0, 0) } 62% { transform: translate(-1px, 1px) } 64% { transform: translate(-1px, -1px) } 66% { transform: translate(0, 0) } 68% { transform: translate(1px, 1px) } 70% { transform: translate(1px, -1px) } 72% { transform: translate(0, 0) } 74% { transform: translate(-1px, 1px) } 76% { transform: translate(-1px, -1px) } 78% { transform: translate(0, 0) } 80% { transform: translate(1px, 1px) } 82% { transform: translate(1px, -1px) } 84% { transform: translate(0, 0) } 86% { transform: translate(-1px, 1px) } 88% { transform: translate(-1px, -1px) } 90% { transform: translate(0, 0) } 92% { transform: translate(1px, 1px) } 94% { transform: translate(1px, -1px) } 96% { transform: translate(0, 0) } 98% { transform: translate(-1px, 1px) } 100% { transform: translate(-1px, -1px) } } ================================================ FILE: src/css/style.less ================================================ @charset "utf-8"; /* CSS Document */ // 移动设备最大宽度 @mobile-max-width: 768px; // 平板最小宽度 @table-min-width: 769px; // 笔记本电脑最小宽度 @laptop-min-width: 1024px; // 桌面设备最小宽度 @desktop-min-width: 1216px; // 显示器最小宽度 @display-min-width: 1700px; // 宽屏设备最小宽度 @widescreen-min-width: 2200px; * { margin: 0; padding: 0; box-sizing: border-box; outline: 0; -webkit-tap-highlight-color: transparent; } body > .footer, body > .navbar, body > .section { opacity: 0; transition: opacity 0.3s ease-out, transform 0.3s ease-out; } .navbar-above { transform: translateY(-100%); } .load-block { transition: opacity 0.3s ease-out, transform 0.3s ease-out; } .card, .load-block { opacity: 0; transform: scale(0.8); transform-origin: center top; } .tips { margin-bottom: -0.6rem; background-color: rgb(221 234 255 / 90%) !important; padding: 0.8rem; border: none !important; color: var(--theme) !important; font-size: 1.15em; &::before { content: "\f2a2"; font: normal normal normal 14px/1 remixicon; margin-right: 0.5rem; font-size: 1.2em; } .click-close { margin-left: 5px; cursor: pointer; font-size: 18px; line-height: 1.2em; float: right; &:hover { color: #333; } } } html { box-sizing: border-box; font-size: 14px; background-color: var(--bg-f); -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; min-width: 300px; text-rendering: optimizeLegibility; text-size-adjust: 100%; &.loaded { body > .footer, body > .navbar, body > .section { opacity: 1; } .navbar-above { transform: translateY(0); } .card, .load-block { opacity: 1; transform: none; } } &.pjax-loading .column-main .card, &.pjax-loading .load-block { opacity: 0.8; transform: scale(0.8); transform-origin: center top; } &.disable-scroll { overflow: hidden } &:not(.disable-scroll) { body.move-up .navbar-above { transform: translate3d(0, -100%, 0); } .actions.show { right: 16px; } } &.clean { background-color: var(--style-a); .card { box-shadow: none; border: 1px solid var(--light-b); background: none; &:hover { background: none; } } .footer { backdrop-filter: none; &:before { content: none; } } .pagination-link:not(.is-current), .pagination-previous, .pagination-next { box-shadow: none; border: 1px solid var(--light-b); } } } body { margin: 0 !important; justify-content: space-between; -webkit-box-orient: vertical; -ms-flex-direction: column; flex-direction: column; min-height: 100vh; display: flex; font-size: 1em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; padding-bottom: env(safe-area-inset-bottom); scroll-behavior: smooth; overflow-x: hidden; overflow-y: overlay; &::-webkit-scrollbar-thumb { background: var(--theme); background-image: -webkit-linear-gradient(45deg, hsla(0, 0%, 100%, 0.4) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, 0.4) 0, hsla(0, 0%, 100%, 0.4) 75%, transparent 0, transparent); } &:before { content: ''; position: fixed; z-index: -1; top: 0; right: 0; bottom: 0; left: 0; transition: opacity 1s; background-size: cover !important; } &:after { content: ""; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: -10; pointer-events: none } } ::-webkit-scrollbar { height: 8px; width: 8px; } ::-webkit-scrollbar-thumb { background: rgba(160, 160, 160, .2); border-radius: 2em; } ::-webkit-scrollbar-track { background: 0 0; border-radius: 2em; } ::-moz-selection { color: #fff; background: var(--theme) } ::selection { color: #fff; background: var(--theme) } input[type=text] { -webkit-appearance: none; border-radius: 0; font-size: 13px; font-weight: 500 } iframe { display: block; border: 0; margin: 0 auto } textarea { font-size: 14px; resize: none; -webkit-appearance: none } li, ol, ul { list-style: none } img { border: 0; vertical-align: middle; } img:not([src]), img[src=""] { border: 0; opacity: 0 } canvas, svg { vertical-align: middle } button { cursor: pointer; -webkit-appearance: none; font-size: 13px } table { border-collapse: collapse; border-spacing: 0 } blockquote, body, dd, dl, dt, fieldset, figure, h1, h2, h3, h4, h5, h6, hr, html, iframe, legend, li, ol, p, pre, textarea, ul { margin: 0; padding: 0; } h1, h2, h3, h4, h5, h6 { font-size: 100%; font-weight: 500; margin-bottom: 10px; } button, input, select { margin: 0; } audio { max-width: 100%; } body, button, input, select, textarea { font-family: "Dream Font", BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } code, pre { -moz-osx-font-smoothing: auto; font-family: monospace; } section { flex: 1; } a { color: var(--theme); cursor: pointer; text-decoration: none; word-break: break-all; &:hover { color: var(--dark-c); } } code { background-color: #f5f5f5; color: #ff3860; font-size: .875em; font-weight: 400; padding: .25em .5em; } hr { background-color: var(--light-b); border: none; display: block; height: 1px; margin: 11.2px 0; } input[type=checkbox], input[type=radio] { vertical-align: baseline; } small { font-size: .875em; } span { font-style: inherit; font-weight: inherit; } strong { font-weight: 700; } fieldset { border: none; } pre { -webkit-overflow-scrolling: touch; background-color: #f5f5f5; color: var(--main); font-size: .875em; overflow-x: auto; white-space: pre; word-wrap: normal; padding: 1.25rem 1.5rem; code { background-color: transparent; color: currentColor; font-size: 1em; padding: 0; } } table td, table th { vertical-align: top; } .container { flex-grow: 1; margin: 0 auto; position: relative; width: auto; } .canvas_effects { position: fixed; margin: 0; padding: 0; border: 0; outline: 0; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; &.universe { background: radial-gradient(1600px at 70% 120%, #212750 10%, #020409 100%); } &.night { display: none; } } /** 通用样式 开始 */ .tag { align-items: center; background-color: var(--bg-c); border-radius: 4px; color: var(--dark-c); display: inline-flex; font-size: .75em; height: 2em; justify-content: center; line-height: 1.5; padding-left: 0.75em; padding-right: 0.75em; white-space: nowrap; } .button { -moz-appearance: none; -webkit-appearance: none; align-items: center; border: 1px solid transparent; border-radius: 4px; box-shadow: none; display: inline-flex; font-size: 1rem; height: 2.25em; justify-content: flex-start; line-height: 1.5; padding: calc(.375em - 1px) calc(.625em - 1px); position: relative; vertical-align: top; &.is-link { border-color: transparent; color: #fff; background-color: var(--theme); &:hover { opacity: 0.8; } } &.is-rounded { border-radius: 290486px; padding-left: 1em; padding-right: 1em; } &.is-transparent { background: 0 0; border-color: transparent; color: var(--dark-c); &.is-hovered, &:hover { background-color: var(--bg-c); } } &.is-large { font-size: 1.5rem; } } .level { align-items: center; justify-content: space-between; &-item { display: flex; flex-basis: auto; flex-grow: 0; flex-shrink: 0; justify-content: center; } } .title { color: var(--dark-c); font-size: 1.6rem; font-weight: 400; line-height: 1.25; .top { background-image: -webkit-linear-gradient(0deg, rgb(57 169 255 / 80%) 0, rgb(155 79 255 / 80%) 100%); border-radius: 2px 6px; color: #fff; padding: 0 6px; font-size: 12px; line-height: 20px; vertical-align: 3px; margin-right: 5px; display: inline-block; user-select: none; } } .is-invisible { visibility: hidden !important; } .image { display: block; position: relative; } .breadcrumb { display: flex; align-items: center; justify-content: flex-start; font-size: 0.8rem; flex-shrink: 0; li { i { margin-right: 3px; } &:not(:first-child)::before { content: "/"; color: var(--light-d); padding: 0 5px; } } } .has-link-grey { line-height: 1.85rem; color: var(--theme); background-image: linear-gradient(transparent calc(100% - 1px), var(--theme) 1px); background-repeat: no-repeat; background-size: 0 100%; transition: all .35s ease-in-out; &:hover { color: var(--theme) !important; background-size: 100% 100%; } } .is-hidden-all { display: none !important; } .card:not(.is-hidden-all) ~ .card { margin-top: 1.4rem !important; } .indent { text-indent: 2em; } .dream-emoji { width: 1.4em; height: 1.4em; margin: auto 1px; vertical-align: text-bottom; } .menu-list { line-height: 1.25; a { border-radius: 2px; color: var(--main); display: block; padding: 0.5em 0.75em; &:hover { background-color: var(--bg-c); } &.level { display: flex; } &.is-active { background-color: var(--bg-e); color: var(--light-a); } } i { margin-right: 0.5em; } li ul { margin: 0.5em 0 0.75em 0.75em; padding-left: 0.5em; border-left: 1px solid var(--light-c); } & > li > a:not(.is-active) + .menu-list { display: none; } } .expand-done { background: var(--bg-k); position: absolute; bottom: 0; left: 0; right: 0; text-align: center; height: 1.8rem; cursor: pointer; i { display: inline-block; color: var(--dark-b); font-size: 1.6rem; animation: code-expand 2.4s infinite; text-shadow: 0 -1px 5px var(--light-d); transition: all 0.3s; } } .fold { max-height: 320px; .expand-done { background: linear-gradient(180deg, rgba(0, 0, 0, 0.0), rgb(77 77 77 / 40%)); i { transform: rotatex(180deg); } } } .loading::after { content: ''; display: block; width: 70px; height: 70px; margin: 12px auto; background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTciIGhlaWdodD0iNTciIHZpZXdCb3g9IjAgMCA1NyA1NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBzdHJva2U9IiM0MDllZmYiPg0KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+DQogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiIHN0cm9rZS13aWR0aD0iMiI+DQogICAgICAgICAgICA8Y2lyY2xlIGN4PSI1IiBjeT0iNTAiIHI9IjUiPg0KICAgICAgICAgICAgICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9ImN5Ig0KICAgICAgICAgICAgICAgICAgICAgYmVnaW49IjBzIiBkdXI9IjIuMnMiDQogICAgICAgICAgICAgICAgICAgICB2YWx1ZXM9IjUwOzU7NTA7NTAiDQogICAgICAgICAgICAgICAgICAgICBjYWxjTW9kZT0ibGluZWFyIg0KICAgICAgICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+DQogICAgICAgICAgICAgICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iY3giDQogICAgICAgICAgICAgICAgICAgICBiZWdpbj0iMHMiIGR1cj0iMi4ycyINCiAgICAgICAgICAgICAgICAgICAgIHZhbHVlcz0iNTsyNzs0OTs1Ig0KICAgICAgICAgICAgICAgICAgICAgY2FsY01vZGU9ImxpbmVhciINCiAgICAgICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPg0KICAgICAgICAgICAgPC9jaXJjbGU+DQogICAgICAgICAgICA8Y2lyY2xlIGN4PSIyNyIgY3k9IjUiIHI9IjUiPg0KICAgICAgICAgICAgICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9ImN5Ig0KICAgICAgICAgICAgICAgICAgICAgYmVnaW49IjBzIiBkdXI9IjIuMnMiDQogICAgICAgICAgICAgICAgICAgICBmcm9tPSI1IiB0bz0iNSINCiAgICAgICAgICAgICAgICAgICAgIHZhbHVlcz0iNTs1MDs1MDs1Ig0KICAgICAgICAgICAgICAgICAgICAgY2FsY01vZGU9ImxpbmVhciINCiAgICAgICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPg0KICAgICAgICAgICAgICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9ImN4Ig0KICAgICAgICAgICAgICAgICAgICAgYmVnaW49IjBzIiBkdXI9IjIuMnMiDQogICAgICAgICAgICAgICAgICAgICBmcm9tPSIyNyIgdG89IjI3Ig0KICAgICAgICAgICAgICAgICAgICAgdmFsdWVzPSIyNzs0OTs1OzI3Ig0KICAgICAgICAgICAgICAgICAgICAgY2FsY01vZGU9ImxpbmVhciINCiAgICAgICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPg0KICAgICAgICAgICAgPC9jaXJjbGU+DQogICAgICAgICAgICA8Y2lyY2xlIGN4PSI0OSIgY3k9IjUwIiByPSI1Ij4NCiAgICAgICAgICAgICAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJjeSINCiAgICAgICAgICAgICAgICAgICAgIGJlZ2luPSIwcyIgZHVyPSIyLjJzIg0KICAgICAgICAgICAgICAgICAgICAgdmFsdWVzPSI1MDs1MDs1OzUwIg0KICAgICAgICAgICAgICAgICAgICAgY2FsY01vZGU9ImxpbmVhciINCiAgICAgICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPg0KICAgICAgICAgICAgICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9ImN4Ig0KICAgICAgICAgICAgICAgICAgICAgZnJvbT0iNDkiIHRvPSI0OSINCiAgICAgICAgICAgICAgICAgICAgIGJlZ2luPSIwcyIgZHVyPSIyLjJzIg0KICAgICAgICAgICAgICAgICAgICAgdmFsdWVzPSI0OTs1OzI3OzQ5Ig0KICAgICAgICAgICAgICAgICAgICAgY2FsY01vZGU9ImxpbmVhciINCiAgICAgICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPg0KICAgICAgICAgICAgPC9jaXJjbGU+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4=); background-repeat: no-repeat; background-size: 100% 100%; } .bg-shadow:before { content: ''; display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.05)); } /** 通用样式 结束 */ #dprogress { pointer-events: none; user-select: none; z-index: 2000; position: fixed; top: 0; left: 0; right: 0; width: 100%; height: 2px; .bar { background: var(--theme); box-shadow: 0 0 10px 1px var(--theme); height: 100%; } } .logo-title { font-size: 1.5em; color: var(--theme) !important; img { max-height: 2rem; } } .logo-img-dark { display: none; } .navbar { &-above { position: fixed; top: 0; z-index: 6; width: 100%; background-color: var(--background); transition: all 0.5s; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05), 0 0 1px rgba(0, 0, 0, 0.1); .container { display: flex; align-items: center; } .navbar-item { display: flex; align-items: center; padding-right: 0.75rem; flex-grow: 0; flex-shrink: 0; color: #4a4a4a; line-height: 1.5; position: relative; } .navbar-nav { display: flex; align-items: center; .item { cursor: pointer; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; position: relative; height: 3.5rem; line-height: 3.5rem; font-size: 15px; padding: 0 8px; margin-right: 10px; user-select: none; white-space: nowrap; color: var(--title); transition: color 0.35s; > i { display: inline-block; margin-right: 4px; font-size: 18px; transition: transform 0.5s; } &:last-child { margin-right: 0; } &::after { opacity: 0; position: absolute; bottom: 0; left: 6px; right: 6px; content: ""; height: 3px; transform: scaleX(0.25); background: var(--theme); border-radius: 6px 6px 0 0; transition: opacity 0.5s, transform 0.5s; } &.current { color: var(--theme); &::after { opacity: 1; transform: scaleX(1); } &:hover::after { opacity: 1; transform: scaleX(1); } } &:hover { color: var(--theme); &::after { opacity: 0.3; transform: scaleX(0.7); } & + .joe-icon-arrow-down { color: var(--theme) !important; } } } &.active-shadow { .item.current { text-shadow: 0 4px 20px var(--theme); } } &.active-animate { .item:hover .m-icon { animation: dung 0.3s 0.12s ease; } } .item-dropdown { margin-right: 15px; &-link { a { height: 50px; line-height: 50px; font-size: 15px; padding-left: 8px; padding-right: 3px; transition: color 0.35s; white-space: nowrap; color: var(--main); } } &-menu { min-width: 90px; max-width: 200px; text-align: center; a { display: block; height: 34px; margin-right: 0; line-height: 34px; color: var(--main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 15px; transition: color 0.35s, background 0.35s; &::after { display: none; } &:hover, &.current { color: var(--theme); background: var(--bg-a); } } } .item:hover:after { display: none; } &.active { .item-dropdown-link { a, i { color: var(--theme) !important; &::after { display: none; } } } } } .item-sub-li { position: relative; height: 34px; &:hover { .item-sub { visibility: visible; opacity: 1; transform: translateX(0) perspective(600px) rotateY(0); } } } .item-sub { visibility: hidden; z-index: 10; transform-origin: top; opacity: 0; position: relative; left: 100%; top: -34px; padding-left: 7px; box-shadow: 7px 3px 8px 0px rgba(0, 0, 0, 0.15); border-radius: 0 var(--radius-inner) var(--radius-inner) 0; transform: translateX(-20%) perspective(600px) rotateY(-45deg); transition: opacity 0.35s, visibility 0.35s, transform 0.35s; &::before { position: absolute; top: 10px; left: 0; content: ""; transform: translateX(-50%); width: 0; height: 0; border: 7px solid transparent; border-right-color: var(--theme); } &::after { position: absolute; top: 0; left: 7px; content: ""; width: 2px; height: 100%; background: var(--theme); } li { background: var(--bg-d); } } } &.solid { backdrop-filter: unset; box-shadow: unset; border-bottom: 1px solid var(--light-b); } } .navbar-search { .submit { width: 50px; } &-mobile .submit { width: 80px; } .result { position: absolute; z-index: 2; top: 55px; left: 0; right: 0; user-select: none; visibility: hidden; overflow: hidden; opacity: 0; background: var(--bg-d); box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); border-radius: var(--radius-inner); transition: visibility 0.35s, opacity 0.35s, transform 0.35s; transform: translate3d(0, 15px, 0); &.active { transform: translate3d(0, 0, 0); opacity: 1; visibility: visible; } .item { height: 40px; line-height: 40px; display: flex; align-items: center; overflow: hidden; padding: 0 10px; border-bottom: 1px solid var(--light-b); transition: background 0.35s; &:last-child { border-bottom: none; } &:nth-child(1) .sort { background: #fe2d46; } &:nth-child(2) .sort { background: #f60; } &:nth-child(3) .sort { background: #faa90e; } &:hover { background: var(--bg-a); } .sort { color: #fff; background: #7f7f8c; width: 18px; height: 18px; line-height: 18px; border-radius: 2px; text-align: center; margin-right: 8px; font-weight: 500; } .text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dark-a); font-size: 12px; } .views { color: var(--seat); font-size: 12px; margin-left: 5px; } } } } .navbar-search, .navbar-search-mobile { position: relative; margin-left: auto; display: flex; align-items: center; .input { background: var(--bg-a); width: 170px; height: 34px; border: 1px solid transparent; padding: 0 14px 0 16px; color: var(--dark-a); transition: width 0.35s, border-color 0.35s, padding-right 0.35s; border-radius: 17px 0 0 17px; &:focus { background: var(--light-a); border-color: var(--theme); padding-right: 28px; width: 170px; ~ .icon { transform: translate3d(0, -50%, 0) rotateY(180deg); } } } @keyframes swag { 0% { transform: rotate(-10deg); } 50% { transform: rotate(0deg); } 100% { transform: rotate(10deg); } } .submit { position: relative; z-index: 1; height: 34px; color: #fff; border: none; background: var(--theme); border-radius: 0 17px 17px 0; i { transform-origin: right bottom; font-size: 18px; } &:hover i { animation: swag 0.3s ease infinite alternate; } } .icon { position: absolute; top: 50%; right: 44px; width: 28px; height: 38px; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAmCAYAAADX7PtfAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAHKElEQVRYw93Xe3DNdxrH8ecXiSK7i1qWFWW3rekiE2x3VEemtkkVVbWy4jY6atma2YpS6rJoozvbpRF1qW1EEYIk5xZE5EKE3CQi0SB30VwEIeeWnDi3nPf+kUNTE1R3mNn945n5nZkz8zrP53y/39/3EUCeZsn/HCgi80Rky1MDn/H2vjB6SpBVRMb9V6CI+InIBhE58bOez5b9xm9E0wu//0NTr/4+9SKyX0TGicjiP320kpBd+xCRv/0kUFEUf49OnfJGBwWzWn3UcfCGSa8xO1zxFoi3gLbJyZb8S/QeOIhRb0/hiA1GvjkREfF9bFBEQv0C3ySyrIaEO5DjaCXFYkdttKEyWFEbrKiNNjRmBztLrrIqVsfAYb507tJVryjKi48FisiK8Qs/IL4FVEYbOTY7l3FSjJNCp4PDpnZoOzi+BSKKq+j3wostiqK8/KPBv27+6pja9H03uXYHl3FwyeWgGCcFTscPwXalMdnZU1VPn4GDTCLS90eB2ibHHpXRhtpgRWWwkmqxU4yTEpwcvaUno7kZ7f1dtitds4tVcYcRkZMiskhRlCEPBdUG2/a7oNpoQ2Oyc8zUwrsp+QREp7CxpA6N0YbaaENtvBtrW2lMdsIy8xn00u/4aPly9h04QEBgICKy+oGgymiNUBltaN2xflxwlUmqdArKvyX0RBZf1ejbge5y/zi10cbg4SO4Ul3N8dRUqmprcQETJ01CUZQxHXdotH+jMtpYdLact9RniMzOxX6rDAzlrEzOIKLO+EPMXRqTnbCs88yePQuA18aOpWuPXuyIiKCouBgROfQA0Bq1tqiGsPRsMFbiaigBfQXoy1mZnMnOa6YOMBsHb7ewKbuAWTNnAhAQGEjPPn3JyMmh2W5HUZScDkGd0b5/RuoFqmtLiNj8GSLCxcwEMFTw95RM/l1ruBepxtTW2YKMYiYdPouuycHg4SOpqa8nTqPhclkZDuBcYSEiEtMxaLZHByXmU1qUiYeHByLCsZhIMFayPfMs/yy9TrzZQZzByqeX6pigzSLqbB5z4k+jNTvYcCqbvj4++i/Cwi7kFZxvidq/3+UzYAAi8l6HYLzZfiAoIZfoiHBEBBGhNDcZ9BXkln5LoCaLoMR8punOsCM7j8b6EjBWsDjxDHtuNKE1O9h95RrT14QyJngm01at48u8IkTktPtg6da9e/dffb8PTXbVVG0mqRva4pw8PgBMV6CxHBrLuVhZRMO1Ypw3LrPt8zXYrl8CfTmrUzL5ut2C0jY50TW3om1yEm+B/oNf0rvBYfPff//59pEefUd9BtKPU5oQS+vtMmgsx3W7DJf7GfNV5kyfgoiQpNoNxko+Tsog8u6Cuu8wiLfAb/2Gt7hBRUR6tAdTpmozQV/etjrbYXfBxspzKEpb3MU5x8FYwUxdOirDfXvTvT+1TU569vt17YP+w+RJ0ae4WdUWlcsdJfqKtmd9BWcSDiIijHvdH8xVVFdfYmpiPjqznQP1BmIamu6dRBqTnfCcQkQkukPQPyZdNToqzfZWaLKzuvwiGCpoLcrAnqS917G1/iKfL5iLMUkH3xWiK8hnWX4Vhy0uJi9ayqpYHRqzo+1stbgIePc9u4i83iE4O7128cvRp1mRZ2Hy+qRWQ25aW2d1RW0x3+04/zScTITcNJYmZxFxzcj+2lsM8vUjrrHlXrRR1Q107tLlYodnqaIo2iHDhlp8g+bzaSkcqbO0xiXn80boCdbtOkXuuUJuVRdjqbuI42YxNXmpLFkwh6FvTOCoDdeYP09nVazOpWtuRW20oWtu5Z0PlyMiwR2CIrJbG7WNyPD1DBrxCoEh61snhEYwcc1WXvnLelffgOX6gcE7VN1+3sM2cuwfEU9PRCRtftgWQnbupVf/AQSvXMta3TE0ZgeHbprx7tGz6oGvJxHx8vDyOr35sxWYrp4n8VAEsZGbiNsVTvy+7TzXr0+j+3sHRkx4G1GUnc90885bGhWDh4dHlqIo10Xk9oqDanQWF/M3bUVEPnjo+/CTEkJeXbgOX9+h/GPlIrR7t3I8difHYiLp3evZanf03iIyQkR6iKcXnl6dTymK0lVRFD8RmTpj7XqO2mDIq/6ISM+HgicbnPM+r4TVhS1M26IhYNlGxixcg4hiFpHnOrjd/fL+z8P8XyPmtoVOXl6Zj7xinLrpnLux3EXaDQff1ED4dxD8ZRwisvYxbuHquf8KR0Q2PRJcdcm5JL3BwR2blRablVZg1KhRLkVRej8GOFg6dUJEFj0S3F3NYpPVRrPNSovDweGEBERkx0+YNWYoivL8I8E7Tue8O04nFrsdBzDG3x8R8Xli01NISMiSrdu2kZGTzd7oaERk7xMd12ZFJC0b/8nX9Brsh4ikiUj3Jwpes/Ph3qzLeHb7RbGIeD7xgfRIQsIyH5/+RkVR+j+VCXjkyJHdFEXx/r+b8f8DZyW8Jd6/P38AAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDItMjBUMTE6NTI6MjQrMDA6MDA4bfPmAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTAyLTIwVDExOjUyOjI0KzAwOjAwSTBLWgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAASUVORK5CYII=); background-size: 100% 100%; transition: transform 0.35s; transform: translate3d(100%, -50%, 0) rotateY(180deg); } } .navbar-search-mobile { input { flex: 1; width: 100%; } } &-slideicon { display: none; cursor: pointer; font-size: 23px !important; color: var(--main); } &-searchicon { display: none; cursor: pointer; font-size: 23px !important; color: var(--main); margin-left: auto; } &-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 4; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px); opacity: 0; visibility: hidden; transition: visibility 0.35s, opacity 0.35s; &.active { visibility: visible; opacity: 1; } &.slideout { z-index: 6; } } &-slideout { visibility: hidden; position: fixed; top: 0; bottom: 0; left: 0; z-index: 120; width: 78%; max-width: 480px; background: var(--bg-b); transform: translate3d(-100%, 0, 0); transition: transform 0.35s, visibility 0.35s; &-wrap { position: relative; padding: 35px 15px 15px; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; &::-webkit-scrollbar { display: none; } } &.active { visibility: visible; transform: translate3d(0, 0, 0); } &-image { position: absolute; top: 0; left: 0; width: 100%; height: 150px; object-fit: cover; z-index: -1; } &-author { margin-bottom: 15px; .avatar { width: 50px; height: 50px; margin: 10px auto; display: block; border-radius: var(--radius-inner); } .info { overflow: hidden; line-height: 25px; text-align: center; display: block; .level { height: 23px; margin-left: 2px; } .link, .motto { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .link { display: block; font-size: 15px; font-weight: 500; color: var(--main); } .motto { font-size: 12px; color: var(--main); } } } &-menu { background: var(--light-a); padding: 10px 15px; border-radius: var(--radius-wrap); overflow: hidden; box-shadow: var(--box-shadow); &:not(:last-child) { margin-bottom: 15px; } &.is-toc { display: none; } .menu-list > li > a:not(.is-active) + .menu-list { display: block; } .item { display: flex; align-items: center; color: var(--main); padding: 5px 0; i { color: var(--main); margin-right: 5px; } strong { font-weight: 500; color: var(--theme); } } .link { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; color: var(--main); transition: color 0.15s; a { transition: color 0.15s; color: var(--main); } i { color: var(--dark-b); transition: transform 0.15s, fill 0.15s; } &.in { color: var(--theme); a { color: var(--theme); } i { color: var(--theme); transform: rotate(90deg); } } } .current { a { color: var(--theme); font-weight: 500; font-size: 15px; } } .slides { display: none; border-left: 1px solid var(--light-b); padding-left: 15px; .link { color: var(--main); } .current { color: var(--theme); font-weight: 500; font-size: 15px; } } } &.slideout-toc { .not-toc { display: none; } .is-toc { display: block; } } } &-searchout { position: fixed; top: 3.5rem; left: 0; right: 0; z-index: 5; background: var(--background); transform: translate3d(0, -100%, 0); transition: transform 0.35s, visibility 0.35s; visibility: hidden; .search-container { padding: 10px 15px !important; flex-direction: row; } &.active { visibility: visible; transform: translate3d(0, 0, 0); } &-inner { padding: 15px 0; width: 100%; .search { width: 100%; display: flex; align-items: center; input { flex: 1; height: 36px; padding: 0 10px; border: 1px solid var(--light-b); border-right: none; border-radius: 2px 0 0 2px; color: var(--main); background: var(--bg-a); } button { padding: 0 16px; height: 36px; border: none; background: var(--theme); color: #fff; border-radius: 0 2px 2px 0; } } .tag-search { color: var(--main); padding: 14px 0 10px; font-size: 14px; display: flex; align-items: center; i { margin-right: 5px; } } .cloud { display: flex; flex-wrap: wrap; margin: 0 -5px -5px; max-height: 250px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; .item { padding: 4px; a { display: block; padding: 0 10px; height: 24px; line-height: 24px; border-radius: 2px; font-size: 12px; color: #fff; } } } } } } .swiper { border: none !important; &-initialized { &:hover { .swiper-button-next { opacity: 1; right: 10px; } .swiper-button-prev { opacity: 1; left: 10px; } } } } .swiper-vertical > .swiper-wrapper { flex-direction: column; } .swiper-wrapper { position: relative; width: 100%; height: 100%; display: flex; transition-property: transform; box-sizing: content-box; } .swiper-android .swiper-slide, .swiper-wrapper { transform: translate3d(0px, 0, 0); } .swiper-pointer-events { touch-action: pan-y; &.swiper-vertical { touch-action: pan-x; } } .swiper-slide { flex-shrink: 0; position: relative; padding-bottom: 40%; overflow: hidden; transition: none !important; &-details { width: 100%; position: absolute; bottom: 15%; padding: 0 50px; color: #f5f5f5; &-title { text-align: center; font-size: 1.5rem; font-weight: 600; text-shadow: 0 0 5px rgba(0, 0, 0, 0.3); line-height: 1.5; word-break: break-all; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } .breadcrumb { font-size: 1rem; justify-content: center; } } } .swiper-slide-invisible-blank { visibility: hidden; } /* Auto Height */ .swiper-autoheight, .swiper-autoheight .swiper-slide { height: auto; } .swiper-autoheight .swiper-wrapper { align-items: flex-start; transition-property: transform, height; } .swiper-css-mode > .swiper-wrapper { overflow: auto; scrollbar-width: none; -ms-overflow-style: none; &::-webkit-scrollbar { display: none; } & > .swiper-slide { scroll-snap-align: start start; } } .swiper-horizontal.swiper-css-mode > .swiper-wrapper { scroll-snap-type: x mandatory; } .swiper-vertical.swiper-css-mode > .swiper-wrapper { scroll-snap-type: y mandatory; } .swiper-centered > .swiper-wrapper::before { content: ''; flex-shrink: 0; order: 9999; } .swiper-centered > .swiper-wrapper > .swiper-slide { scroll-snap-align: center center; } .swiper-virtual.swiper-css-mode .swiper-wrapper::after { content: ''; position: absolute; left: 0; top: 0; pointer-events: none; } .swiper-button-prev, .swiper-button-next { position: absolute; top: 50%; width: 27px; height: 44px; margin-top: -22px; cursor: pointer; text-align: center; color: #fff; background: rgba(0, 0, 0, .1); border-radius: 2px; opacity: 0; overflow: hidden; transition: all 0.3s; &:after { font-family: remixicon; font-size: 36px; margin-left: -4px; letter-spacing: 0; text-transform: none; font-variant: initial; line-height: 44px; } &:hover { background: rgba(0, 0, 0, .3); } &.swiper-button-disabled { opacity: 0.35; cursor: auto; pointer-events: none; } } .swiper-button-prev, .swiper-rtl .swiper-button-next { left: -15px; right: auto; &:after { content: '\ea64'; } } .swiper-button-next, .swiper-rtl .swiper-button-prev { right: -15px; left: auto; &:after { content: '\ea6e'; } } .swiper-button-lock { display: none; } .swiper-pagination { position: absolute; text-align: center; transition: 300ms opacity; transform: translate3d(0, 0, 0); &.swiper-pagination-hidden { opacity: 0; } } /* Common Styles */ .swiper-pagination-fraction, .swiper-pagination-custom, .swiper-horizontal > .swiper-pagination-bullets, .swiper-pagination-bullets.swiper-pagination-horizontal { bottom: 10px; left: 0; width: 100%; } /* Bullets */ .swiper-pagination-bullets-dynamic { overflow: hidden; font-size: 0; .swiper-pagination-bullet { transform: scale(0.33); position: relative; } .swiper-pagination-bullet-active { transform: scale(1); } .swiper-pagination-bullet-active-main { transform: scale(1); } .swiper-pagination-bullet-active-prev { transform: scale(0.66); } .swiper-pagination-bullet-active-prev-prev { transform: scale(0.33); } .swiper-pagination-bullet-active-next { transform: scale(0.66); } .swiper-pagination-bullet-active-next-next { transform: scale(0.33); } } .swiper-pagination-bullet { width: 15px; height: 6px; display: inline-block; border-radius: 8px; background: #f6f6f6; opacity: 0.2; transition: all 0.3s; &:only-child { display: none !important; } &-active { width: 30px; opacity: 1; background: #fff; } } button.swiper-pagination-bullet { border: none; margin: 0; padding: 0; box-shadow: none; -webkit-appearance: none; appearance: none; } .swiper-pagination-clickable .swiper-pagination-bullet { cursor: pointer; } .swiper-vertical > .swiper-pagination-bullets, .swiper-pagination-vertical.swiper-pagination-bullets { right: 10px; top: 50%; transform: translate3d(0px, -50%, 0); } .swiper-vertical > .swiper-pagination-bullets .swiper-pagination-bullet, .swiper-pagination-vertical.swiper-pagination-bullets .swiper-pagination-bullet { margin: var(--swiper-pagination-bullet-vertical-gap, 6px) 0; display: block; } .swiper-vertical > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic, .swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic { top: 50%; transform: translateY(-50%); width: 8px; } .swiper-vertical > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet, .swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet { display: inline-block; transition: 200ms transform, 200ms top; } .swiper-horizontal > .swiper-pagination-bullets .swiper-pagination-bullet, .swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet { margin: 0 var(--swiper-pagination-bullet-horizontal-gap, 4px); } .swiper-horizontal > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic, .swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic { left: 50%; transform: translateX(-50%); white-space: nowrap; } .swiper-horizontal > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet, .swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet { transition: 200ms transform, 200ms left; } .swiper-horizontal.swiper-rtl > .swiper-pagination-bullets-dynamic .swiper-pagination-bullet { transition: 200ms transform, 200ms right; } /* Progress */ .swiper-pagination-progressbar { background: rgba(0, 0, 0, 0.25); position: absolute; .swiper-pagination-progressbar-fill { background: var(--theme); position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform: scale(0); transform-origin: left top; } } .swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill { transform-origin: right top; } .swiper-horizontal > .swiper-pagination-progressbar, .swiper-pagination-progressbar.swiper-pagination-horizontal, .swiper-vertical > .swiper-pagination-progressbar.swiper-pagination-progressbar-opposite, .swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite { width: 100%; height: 4px; left: 0; top: 0; } .swiper-vertical > .swiper-pagination-progressbar, .swiper-pagination-progressbar.swiper-pagination-vertical, .swiper-horizontal > .swiper-pagination-progressbar.swiper-pagination-progressbar-opposite, .swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite { width: 4px; height: 100%; left: 0; top: 0; } .swiper-pagination-lock { display: none; } /* Scrollbar */ .swiper-scrollbar { border-radius: 10px; position: relative; -ms-touch-action: none; background: rgba(0, 0, 0, 0.1); } .swiper-horizontal > .swiper-scrollbar { position: absolute; left: 1%; bottom: 3px; z-index: 50; height: 5px; width: 98%; } .swiper-vertical > .swiper-scrollbar { position: absolute; right: 3px; top: 1%; z-index: 50; width: 5px; height: 98%; } .swiper-scrollbar-drag { height: 100%; width: 100%; position: relative; background: rgba(0, 0, 0, 0.5); border-radius: 10px; left: 0; top: 0; } .swiper-scrollbar-cursor-drag { cursor: move; } .swiper-scrollbar-lock { display: none; } .swiper-zoom-container { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; text-align: center; } .swiper-zoom-container > img, .swiper-zoom-container > svg, .swiper-zoom-container > canvas { max-width: 100%; max-height: 100%; object-fit: contain; } .swiper-slide-zoomed { cursor: move; } .swiper-lazy-preloader { width: 42px; height: 42px; position: absolute; left: 50%; top: 50%; margin-left: -21px; margin-top: -21px; z-index: 10; transform-origin: 50%; animation: swiper-preloader-spin 1s infinite linear; box-sizing: border-box; border: 4px solid var(--theme); border-radius: 50%; border-top-color: transparent; } .swiper-lazy-preloader-white { --swiper-preloader-color: #fff; } .swiper-lazy-preloader-black { --swiper-preloader-color: #000; } @keyframes swiper-preloader-spin { 100% { transform: rotate(360deg); } } /* a11y */ .swiper .swiper-notification { position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0; z-index: -1000; } .swiper-free-mode > .swiper-wrapper { transition-timing-function: ease-out; margin: 0 auto; } .swiper-grid > .swiper-wrapper { flex-wrap: wrap; } .swiper-grid-column > .swiper-wrapper { flex-wrap: wrap; flex-direction: column; } .swiper-fade.swiper-free-mode .swiper-slide { transition-timing-function: ease-out; } .swiper-fade .swiper-slide { pointer-events: none; transition-property: opacity; } .swiper-fade .swiper-slide .swiper-slide { pointer-events: none; } .swiper-fade .swiper-slide-active, .swiper-fade .swiper-slide-active .swiper-slide-active { pointer-events: auto; } .swiper-cube { overflow: visible; } .swiper-cube .swiper-slide { pointer-events: none; -webkit-backface-visibility: hidden; backface-visibility: hidden; z-index: 1; visibility: hidden; transform-origin: 0 0; width: 100%; height: 100%; } .swiper-cube .swiper-slide .swiper-slide { pointer-events: none; } .swiper-cube.swiper-rtl .swiper-slide { transform-origin: 100% 0; } .swiper-cube .swiper-slide-active, .swiper-cube .swiper-slide-active .swiper-slide-active { pointer-events: auto; } .swiper-cube .swiper-slide-active, .swiper-cube .swiper-slide-next, .swiper-cube .swiper-slide-prev, .swiper-cube .swiper-slide-next + .swiper-slide { pointer-events: auto; visibility: visible; } .swiper-cube .swiper-slide-shadow-top, .swiper-cube .swiper-slide-shadow-bottom, .swiper-cube .swiper-slide-shadow-left, .swiper-cube .swiper-slide-shadow-right { z-index: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; } .swiper-cube .swiper-cube-shadow { position: absolute; left: 0; bottom: 0px; width: 100%; height: 100%; opacity: 0.6; z-index: 0; } .swiper-cube .swiper-cube-shadow:before { content: ''; background: #000; position: absolute; left: 0; top: 0; bottom: 0; right: 0; filter: blur(50px); } .swiper-flip { overflow: visible; } .swiper-flip .swiper-slide { pointer-events: none; -webkit-backface-visibility: hidden; backface-visibility: hidden; z-index: 1; } .swiper-flip .swiper-slide .swiper-slide { pointer-events: none; } .swiper-flip .swiper-slide-active, .swiper-flip .swiper-slide-active .swiper-slide-active { pointer-events: auto; } .swiper-flip .swiper-slide-shadow-top, .swiper-flip .swiper-slide-shadow-bottom, .swiper-flip .swiper-slide-shadow-left, .swiper-flip .swiper-slide-shadow-right { z-index: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; } .swiper-creative .swiper-slide { -webkit-backface-visibility: hidden; backface-visibility: hidden; overflow: hidden; transition-property: transform, opacity, height; } .swiper-cards { overflow: visible; } .swiper-cards .swiper-slide { transform-origin: center bottom; -webkit-backface-visibility: hidden; backface-visibility: hidden; overflow: hidden; } .banner { width: 100%; height: 54vh; position: relative; margin-bottom: -4rem; background-position: center; background-size: cover; display: flex; justify-content: center; align-items: center; &:before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAKUlEQVQImU3IMREAIAgAwJfNkQCEsH8cijjpMf6vnXlQaIiJFx+omEBfmqIEZLe2jzcAAAAASUVORK5CYII=); } .banner-info { position: absolute; color: #fff; text-align: center; margin: 0 18px; &-title { font-size: 2.4rem; font-weight: bold; line-height: 2; letter-spacing: 0.6rem; text-shadow: rgb(28 31 33) -3px 2px 6px; } &-desc { font-size: 1.4rem; line-height: 1.4; max-width: 600px; &:after { content: '_'; margin-left: 0.3rem; animation: flicker 1s steps(2, jump-none) infinite; } } } .banner-waves { width: 100%; height: 4rem; position: absolute; left: 0; bottom: 0; fill: var(--background); .parallax > use { animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite; &:first-child { animation-delay: -2s; animation-duration: 7s; opacity: 0.9; } &:nth-child(2) { animation-delay: -3s; animation-duration: 10s; opacity: 0.8; } &:nth-child(3) { animation-delay: -4s; animation-duration: 13s; opacity: 0.9; } &:nth-child(4) { animation-delay: -5s; animation-duration: 20s; } } } } .item-dropdown { position: relative; &-link { display: flex; align-items: center; &-icon { transition: transform 0.35s; margin-left: -10px; } } &-menu { position: absolute; left: 50%; visibility: hidden; z-index: 5; border-top: 3px solid var(--theme); transform-origin: top; background: var(--bg-d); box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); border-radius: 0 0 var(--radius-inner) var(--radius-inner); padding: 10px 0; opacity: 0; transform: translateX(-50%) perspective(600px) rotateX(-45deg); transition: opacity 0.35s, visibility 0.35s, transform 0.35s; &::before { content: ""; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid var(--theme); } } &.active { .item-dropdown-link-icon { transform: rotate(-180deg); } .item-dropdown-menu { visibility: visible; opacity: 1; transform: translateX(-50%) perspective(600px) rotateX(0); } } } .model { display: flex; gap: 1rem; .card.widget { flex-grow: 1; min-height: 140px; position: relative; background-position: 50% 50% !important; background-size: cover !important; & + .card.widget { margin-top: 0 !important; } &[style] { border: 0; } &:hover { .tag { transform: translateX(10px); } } .title { width: 100%; position: absolute; bottom: 10px; color: #f6f6f6; font-size: 1.15rem; font-weight: 600; text-shadow: 0 0 5px rgba(0, 0, 0, 0.2); padding: 0 5px; word-break: break-all; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } .tag { position: absolute; top: 10px; left: 0; color: #f6f6f6; font-size: 1rem; padding: 2px 12px; background: var(--theme); transform: translateX(-105%); transition: transform 0.2s; height: unset; line-height: normal; } } &-index { display: flex; max-width: 100%; margin-bottom: 1rem; .swiper { width: 70%; &-slide { height: 100%; } } &-side { width: 30%; flex-direction: column; } } &-attach { display: grid; gap: 1rem; margin-bottom: 1rem; align-items: unset; &-2 { grid-template-columns: repeat(2, 1fr); } &-3 { grid-template-columns: repeat(3, 1fr); } &-4 { grid-template-columns: repeat(4, 1fr); } } } .section { padding: 6rem 0.75rem 3rem 0.75rem; .container > .tips { margin-bottom: 1rem; } .card { transition: background-color 0.5s ease, opacity 0.3s ease-out, transform 0.3s ease-out, backdrop-filter 0.3s ease-out; color: var(--dark-c); max-width: 100%; position: relative; word-wrap: break-word; word-break: break-all; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05), 0 0 1px rgba(0, 0, 0, 0.1); background-color: var(--background); border-radius: var(--radius-wrap); &:hover { background-color: var(--background-hover); .thumbnail-image, &.card-cover .cover-image, .small-image { transform: scale(1.1); filter: brightness(0.9); } } & + .column-right-shadow { margin-top: 1.4rem; } &[style="height: 0px;"] { display: none; } &.card-transparent { box-shadow: none !important; background: 0 0 !important; backdrop-filter: none !important; border: none !important; } &-image { border-radius: var(--radius-wrap) var(--radius-wrap) 0 0; } &-tab { height: 52px; border-bottom: 1px solid var(--light-b); margin-bottom: 15px; div { position: absolute; top: 15px; left: -10px; background: var(--theme); color: #fff; padding: 0 12px; height: 30px; line-height: 30px; font-size: 1.1rem; font-weight: 500; border-radius: 2px 2px 2px 0; box-shadow: 2px 5px 10px rgb(49 58 70 / 15%); user-select: none; &::before { content: ''; position: absolute; bottom: -10px; left: -10px; border-style: solid; border-width: 10px; border-color: var(--theme) transparent transparent; transform: rotate(90deg); } } } &-title { font-size: 15.4px; text-transform: uppercase; font-weight: 500; border-bottom: 1px solid var(--light-b); align-items: center; height: 45px; line-height: 45px; padding: 0 15px; display: flex; .card-title-label { margin-right: 5px; font-size: 1.2em; color: var(--theme); } span { flex: 1; } .card-more { font-size: 0.9em; font-weight: 400; color: var(--dark-b); i { font-size: 1.1em; } &:hover { color: var(--theme); i { color: var(--theme); } } } } &-content { padding: 0.6rem 1rem 1rem 1rem; &.main-title { padding: 0.75rem 1.2rem; font-size: 1.3rem; .breadcrumb { font-size: 0.9em; } } } &-empty { text-align: center; font-size: 1.2em; padding: 60px 0; color: var(--dark-d); i { display: block; font-size: 7em; } } .thumbnail { display: block; overflow: hidden; &-image { min-height: 280px; width: 100%; margin: auto; display: block; background-position: 50% 50%; background-size: cover; transition: all 0.5s; } } .cover-image { min-height: 360px; width: 100%; margin: auto; position: relative; display: block; background-position: 50% 50%; background-size: cover; transition: all 0.5s; } &.card-cover, .cover-image { .category { position: absolute; font-size: 0.85rem; right: 0.7em; top: 10px; a { color: #fff; background: rgba(0, 0, 0, 0.3); padding: 4px 10px; border-radius: var(--radius-inner); &:hover { color: var(--theme); } } } .details { position: absolute; width: 100%; bottom: 0; top: auto; color: #fff; background-image: linear-gradient(0deg, rgba(29, 41, 49, .5), rgba(255, 255, 255, 0)); padding: 2em 15px 15px; } .title { color: inherit; position: relative; padding-bottom: 8px; &:hover:before { width: 60px; } &:before { content: ''; position: absolute; width: 40px; height: 3px; top: auto; left: 0; bottom: 3px; transition: 0.4s; border-radius: 5px; background: var(--theme); box-shadow: 1px 1px 3px -1px var(--theme); } } } &-fold { display: flex; padding: 0.5em 0.75em; justify-content: space-between; margin-bottom: -0.7rem; border: 1px solid var(--background); &:hover { border: 1px solid var(--theme); } .title { margin: 0; font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; p { display: inline; } } & > p { color: var(--dark-b); font-size: .8rem; min-width: 60px; text-align: end; align-self: center; flex-shrink: 0; } } &-small { display: flex; & > a { width: 34%; overflow: hidden; &:first-child { clip-path: polygon(0 0, 90% 0, 100% 100%, 0 100%) } &:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 10% 100%); } } .small-image { height: 100%; width: 100%; margin: auto; background-position: 50% 50%; background-size: cover; transition: all 0.5s; } .card-content { width: 66%; } .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; word-break: break-word; } .main-content { -webkit-line-clamp: 2 !important; min-height: 2.5em; max-height: 3.3em; } } .title a { color: inherit; } .meta { display: flex; align-items: center; justify-content: space-between; color: var(--dark-b); font-size: .8rem; overflow-x: auto; &::-webkit-scrollbar { display: none; } .level-item a { color: inherit; &:hover { color: var(--theme); } } } .main { padding-top: 1.5rem; } .post-navigation { padding-top: 1rem; justify-content: space-around; flex-wrap: wrap; a { flex-shrink: 1; color: var(--main); &:last-child { text-align: right; } &:hover { color: var(--theme) } i { font-size: 1.3em; margin: 0 0.5rem; } } } .comment-title { margin-top: 6px; font-size: 1.3em; font-weight: 700; &:before { content: "\ef46"; font-family: 'remixicon'; margin-right: 4px; color: var(--theme); font-weight: 400; font-size: 1.15em; } } } .columns { justify-content: center; margin: -0.75rem; .column { padding: 0.75rem; display: block; &-left { order: 1; } &-main { order: 2; &-grid { margin: 1rem 0 1.4rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(260px, 100%/4)), 1fr)); gap: 1rem; &:first-child { margin-top: 0; } .breadcrumb { margin: 15px 0 0 0; color: var(--dark-b); overflow-x: auto; &::-webkit-scrollbar { display: none; } li { flex-shrink: 0; } } .card { padding: 10px; &.widget + .card.widget { margin-top: 0 !important; } } .thumbnail { border-radius: var(--radius-img); } .title { margin: 8px 0 0 0; font-size: 1.3rem; line-height: 1.8rem; word-break: break-all; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } } } &-right { order: 3; } } } } .widget { overflow: hidden !important; &.card { .card-empty { font-size: 1em; font-style: italic; user-select: none; padding: 24px 0; background-color: var(--bg-a); } .main .main-content { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; text-indent: 1.5em; line-height: 1.5em; } } &.profile { figure { width: 98px; height: 98px; padding: 4px; border-radius: 50%; background: var(--light-b); margin: 2em auto 0.5em auto; .avatar { transition: all 2s; height: 100%; width: 100%; border-radius: 50%; &:hover { transform: rotate(-360deg); } } } .nickname { font-size: 1.5rem; margin-bottom: 5px; } .motto { font-size: 1rem; line-height: 1.4; } .address { color: #7a7a7a; display: flex; justify-content: center; font-size: 1rem; align-items: center; i { margin-right: 0.25em; } } .level { display: flex; &-item { flex-grow: 1; flex-shrink: 1; flex: 1; margin: 0 !important; text-align: center !important; .heading { display: block; font-size: 11px; letter-spacing: 1px; margin-bottom: 5px; text-transform: uppercase; } .value { color: var(--dark-c); font-size: 2rem; line-height: 1.125; margin-bottom: 0; font-weight: 400 !important; } } &:not(:first-child):not(:empty) { margin-top: 1.5rem; } } .button i { font-size: 16px; } } .ad-tag { position: absolute; top: 6px; right: 6px; background: rgba(0, 0, 0, .25); color: #ebebeb; padding: 2px 5px; border-radius: 2px; font-size: 12px; line-height: 16px; user-select: none; .click-close { height: 15px; width: 15px; stroke: #ebebeb; fill: #ebebeb; stroke-width: 1.25; margin-right: -4px; vertical-align: bottom; cursor: pointer; &:hover { stroke: var(--theme); stroke-width: 1.5; } } } .aplayer { background: #00000000; box-shadow: none; padding: 0.5rem 0; margin: 5px 0 0 5px; .aplayer-list ol li { border-top: 1px solid rgba(180, 180, 180, 0.2) !important; &.aplayer-list-light { background: rgba(200, 200, 200, 0.2); } &:hover { background: rgba(200, 200, 200, 0.2); } } &.aplayer-withlist .aplayer-info { border-bottom: none; } .aplayer-lrc { &:before { background: linear-gradient(180deg, #c5c5c52b 0, hsla(0, 0%, 100%, 0)) !important; } &:after { background: linear-gradient(180deg, hsl(0deg 0% 100% / 0%) 0, hsl(0deg 0% 100% / 23%)) !important; } } } &.recent-comments { li:not(:last-child) { margin-bottom: 10px; border-bottom: 1px dashed var(--light-b); padding-bottom: 10px; } .user { display: flex; margin-bottom: 8px; & > img { width: 40px; height: 40px; min-width: 40px; min-height: 40px; margin-right: 8px; border-radius: 50%; border: 1px solid var(--light-d); padding: 3px; } .info { display: flex; flex-direction: column; justify-content: space-between; .author { max-width: 150px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--main); } .date { font-size: 12px; color: var(--dark-b); } } } .reply { position: relative; padding: 5px 10px; background: var(--bg-a); border-radius: 6px; &::before { content: ""; width: 0; height: 0; border-bottom: 6px solid var(--bg-a); border-left: 6px solid transparent; border-right: 6px solid transparent; position: absolute; left: 15px; bottom: 100%; } .link { display: -webkit-box; -webkit-line-clamp: 2; /*! autoprefixer: ignore next */ -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; word-break: break-word; color: var(--dark-b); font-size: 13px; font-weight: 500; line-height: 24px; transition: all 0.35s; max-height: 48px; &:hover { color: var(--theme); } } } } &.recent-posts .card-content { .list { padding-top: 1px; .item { margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between; line-height: 20px; i { color: var(--main); transition: transform 0.3s; } &:hover { .link { color: var(--theme); &:after { opacity: 1; transform: scaleX(1); } } i { transform: rotate(+225deg); color: var(--theme); } } &:last-child { margin-bottom: 0; } .link { display: inline-block; position: relative; color: var(--main); max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; &:after { content: ""; position: absolute; bottom: 2px; left: 0; width: 100%; height: 1px; background: var(--theme); opacity: 0; transform: scaleX(0.25); transition: all 0.35s; } } } } } &.tags .card-content { font-size: 0; a { width: unset; margin: 4px; line-height: 1.2; overflow: unset; text-overflow: unset; white-space: unset; text-align: left; display: inline-block; padding: 5px; font-size: 13px; color: var(--dark-b); text-decoration: none; background: var(--bg-d); border: 1px solid var(--light-c); border-radius: 3px; &:hover { color: var(--theme) !important; border-color: var(--theme) !important; } } } &.tagcloud .card-content a:hover { color: var(--dark-c) !important; } &.love { position: relative; color: #fff; background: none !important; &:before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: -1; transition: all 0.3s ease-out; background-image: linear-gradient(to right, rgb(255 209 218 / 94%), rgb(255 162 178 / 94%)); } &:after { content: 'LOVE'; position: absolute; left: 0; top: 0; bottom: 0; z-index: -1; color: #ffe0e5; font-size: 84px; line-height: 84px; text-align: center; font-weight: 600; white-space: nowrap; transform: rotate(90deg) translateY(75%); transition: all 0.3s ease-out; } &:hover { &:before { background-image: linear-gradient(to right, #ffd1da, #ffa2b2); } &:after { transform: rotate(90deg) translateY(60%); } } .card-title { border-bottom: 1px solid rgb(255 209 218 / 94%); } .love-content { display: flex; margin: 16px 0; justify-content: center; } .level { flex: auto; display: flex; max-width: 520px; &-item { flex-grow: 1; } } svg { width: 36px; filter: none; } .avatar { width: 84px; height: 84px; padding: 4px; display: block; border-radius: 50%; background: #ffd6de; &-image { transition: all 2s; height: 100%; width: 100%; border-radius: 50%; &:hover { transform: rotate(-360deg); } } } .love-time { font-size: 1.1em; text-align: center; font-weight: 600; height: 1.4em; line-height: 1.4em; } } } .main-content { word-break: break-word; color: var(--main); font-size: 1.1rem; font-weight: 300; &.article { padding-bottom: 30px; } *:not(pre) > code { font-size: 0.9em; color: var(--color-a); margin: 0 3px; padding: 3px 6px; white-space: normal; vertical-align: baseline; word-break: break-word; background: var(--bg-g); border-radius: var(--radius-inner); } h1, h2, h3, h4, h5, h6 { color: var(--dark-c); margin-bottom: 18px; transition: all 0.2s ease-out; } h1, h2 { display: inline; background: linear-gradient(to bottom, transparent 60%, var(--bg-g) 0); &:before, &:after { content: ''; display: block; } &:before { margin-top: 30px; } &:after { margin-bottom: 20px; } } h1 { font-size: 1.45em; font-weight: 700; } h2 { font-size: 1.25em; font-weight: 600; } h3, h4, h5 { position: relative; padding-left: 12px; &:before { content: ''; position: absolute; top: 10%; bottom: 10%; left: 0; width: 4px; border-radius: 2px; background: var(--theme); } &:hover { padding-left: 16px; } } h3 { margin: 25px 0 18px 0; font-size: 1.2em; font-weight: 600; } h4 { font-size: 1.1em; } h5, h6 { font-size: 1em; } h6 { &:before, &:after { color: var(--theme); font-weight: 600; transition: all 0.2s ease-out; } &:before { content: '「'; margin-right: 5px; } &:after { content: '」'; margin-left: 5px; } &:hover { &:before { margin-left: -3px; margin-right: 8px; } &:after { margin-left: 8px; } } } p { line-height: 1.7em; margin-bottom: 14px; } .pwd { color: var(--main); border-radius: 2px; transition: all .3s; background: var(--main); font-family: Ubuntu, sans-serif; &:hover { color: #FFF; } } .note { text-indent: 2em; background: url(../img/wordline.webp); background-size: auto 2.5rem; line-height: 2.5rem; } blockquote { line-height: 1.7em; margin-bottom: 14px; padding: 8px 15px; color: var(--dark-b); background: var(--bg-h); border-left: 5px solid var(--theme); border-radius: var(--radius-inner); & > :not(:last-child) { margin-bottom: 4px !important; } & > :last-child { margin: 0 !important; } } a:not([class]) { line-height: 1.7em; color: var(--theme); background-image: linear-gradient(transparent calc(100% - 1px), var(--theme) 1px); background-repeat: no-repeat; background-size: 0 100%; transition: all .35s ease-in-out; &:hover { color: var(--theme); background-size: 100% 100%; } } ol, ul { margin-bottom: 14px; padding-left: 16px; li { line-height: 1.6em; margin-bottom: 4px; &.task-list-item { list-style: none; input { position: relative; top: 1px; } } } } ol:not([class]):not([style]) { &[start] { padding-left: 34px; & > li:not([class]):not([style]) { list-style: decimal; &::marker { font-weight: 400; color: var(--theme); transition: all .5s; } &:hover::marker { color: #e67700; } } } &:not([start]) { counter-reset: li; & > li:not([class]):not([style]) { list-style: none; position: relative; padding-left: 1.2em; &:before { position: absolute; width: max-content; right: calc(100% - 1em); content: counter(li) '.'; counter-increment: li; text-align: center; font-weight: 400; color: var(--theme); transition: all .5s; } &:hover:before { transform: rotate(360deg); color: #e67700; font-size: 1.1em; } } } } ul:not([class]):not([style]) > li:not([class]):not([style]) { list-style: none; position: relative; padding-left: 1.2em; &:before { content: ""; width: 0.5em; height: 0.5em; left: 0; top: 0.5em; position: absolute; border: 1px solid var(--theme); background: 0 0; transition: all .5s; transform: rotateZ(45deg); } &:hover:before { transform: rotate(360deg); border-color: #e67700; } } table { width: 100%; max-width: 100%; border-collapse: unset; background: var(--bg-d); margin-bottom: 14px; overflow: hidden; font-size: 0.95em; border: 1px solid var(--light-b); border-radius: var(--radius-inner); td, th { padding: 8px; border-right: 1px solid var(--light-b); border-bottom: 1px solid var(--light-b); } thead { th { font-weight: 500; background: var(--bg-h); &:last-child { border-right: none; } } } tbody { tr { transition: background 0.35s; &:nth-child(2n) { background: var(--bg-j); } &:last-child td { border-bottom: none; } &:hover { background: rgb(179 179 179 / 15%); } td:last-child { border-right: none; } } } } figure { margin: 18px 0; padding: 0; border-radius: var(--radius-inner); overflow: hidden; position: relative; & > figcaption { display: flex; background: rgb(153 153 153 / 8%); padding: 0; height: 2.2em; line-height: 2.2em; user-select: none; font-size: 0.95em; font-weight: 400; &:before { content: ''; display: inline-block; margin: auto 44px auto 8px; border-radius: 50%; background: #ff0800 no-repeat 10px 10px; width: 12px; height: 12px; box-shadow: 18px 0 #fdbc40, 36px 0 #35cd4b; } div { margin-left: auto !important; display: inline-block; cursor: pointer; text-align: center; i { transition: all 0.25s; margin-right: 10px !important; &.ri-arrow-down-s-line { display: inline-block; font-size: 1.2em; } &:hover { opacity: 0.5; } &.close { transform: rotate(90deg); } } } } pre { margin: 0; display: flex; overflow-y: hidden; overflow-x: auto; padding: 0; border: none; color: inherit !important; background: transparent !important; font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: 1em; & > ul { margin: 0; padding: 0 8px; user-select: none; background: rgb(153 153 153 / 8%); li { list-style: none; line-height: 1.5em; padding: 0 !important; margin: 0 !important; &:before { content: none !important; } &.code-select:after { content: ''; width: 100%; height: 1.5em; left: 0; background: rgba(151, 151, 151, 0.08); position: absolute; pointer-events: none; } } } li + li { margin-top: 0; } code { padding: 0 0 7px 5px; line-height: 1.5em; overflow-y: hidden; font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; width: 100%; &:not(:last-child) { margin-bottom: 1.8em; } } } .expand-done i { color: inherit !important; } &:not(.fold) .expand-done { background: rgb(153 153 153 / 8%); } } .gallery-item { text-align: center; & > div { position: relative; overflow: hidden; display: inline-block; } & > p { text-align: center; color: var(--dark-d); line-height: 1em; font-size: 0.9em; } .fold { border-radius: var(--radius-img); } } :not(.jg-entry) > img { max-width: 100%; &:not([class]) { transition: all 0.35s; margin: 5px 0; border-radius: var(--radius-img); cursor: zoom-in; &:hover { transform: translateY(-5px); box-shadow: 0 34px 20px -24px rgb(136 161 206 / 30%); } } } .emoji { width: 1.4em; height: 1.4em; vertical-align: sub; } .mermaid { text-align: center; margin-bottom: 12px; & > svg { border-radius: var(--radius-inner); background: #FFF; transition: all .35s; border: 1px solid var(--light-b); &:hover { transform: translateY(-5px); box-shadow: 0 34px 20px -24px rgb(136 161 206 / 30%); } } } .katex { line-height: 1.4; display: inline-flex; overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: 0 2px; } &.literature-content { font-size: 1.3em; .note { line-height: 40px; background-size: auto; } } } .pagination { font-size: 1rem; margin: -.25rem; &, &-list { align-items: center; display: flex; justify-content: center; text-align: center; } &-link.is-current { background-color: var(--bg-e); border: 0; color: #fff; } .pagination .pagination-list { -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-ordinal-group: 3; -ms-flex-order: 2; order: 2; flex-grow: 1; flex-shrink: 1; } &-link:not(.is-current), .pagination-previous, .pagination-next { background: var(--background); border: none; } &-link, &-next, &-previous { color: var(--dark-c); min-width: 2.25em; font-size: 1em; justify-content: center; margin: .25rem; text-align: center; padding: calc(.375em - 1px) .5em; position: relative; vertical-align: top; align-items: center; border-radius: 4px; line-height: 1.5; height: 2.25em; box-shadow: 0 4px 10px rgb(0 0 0 / 5%); display: inline-flex; } &-ellipsis { color: var(--dark-d); margin: 0.25rem; padding: 0 0.5em; } } .actions { position: fixed; right: -48px; bottom: 40px; z-index: 200; transition: all 0.5s; opacity: 0.9; & > div { display: block; margin-bottom: 5px; width: 35px; height: 35px; border-radius: 5px; background-color: var(--theme); color: #fff; text-align: center; font-size: 20px; line-height: 32px; border: none; cursor: pointer; } & > .bullet-screen span { display: inline-block; line-height: 1; font-weight: 600; font-family: ui-serif, serif !important; } & > .stop-bullet-screen span { background-image: linear-gradient(45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%); } } .footer { background-color: transparent; backdrop-filter: blur(10px); padding: 1.5rem; position: relative; &:before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--background); } &-container { .logo-title { margin: 15px 15px 15px 0; display: block; } & > li { display: inline-block; vertical-align: middle; padding: 0 5px; color: var(--dark-b); line-height: 1.6em; & > p:not(:first-child) { font-size: 0.9em; } &:last-child { float: right; } } .icon-spot { &:first-child > *:not(:first-child):before { content: "·"; margin: 0 0.3em; display: inline-block; } &:not(:first-child) > *:not(:first-child):before { content: ""; width: 4px; height: 4px; margin: 0 0.4em; border-radius: 50%; display: inline-block; background: var(--dark-b); opacity: .3; vertical-align: 0.2em; } i { font-size: 1.1em; } } a:not([class]) { color: var(--dark-b); &:hover { color: var(--theme); } } .stand { color: var(--theme); margin: 0 4px; } .powered { color: var(--theme); font-weight: 600; } .cloud-driven { margin: 0 3px; img { height: 16px; vertical-align: text-bottom; } } } } @media (max-width: (@desktop-min-width - 1)) { .navbar { .navbar-search .input { width: 100px; } } .container:not(.two-column) .column-right { display: none !important; } .is-hidden-not-desktop { display: none !important; } .card:not(.is-hidden-not-desktop):not(.is-hidden-all) ~ .card { margin-top: 1.4rem !important; } } @media (max-width: (@desktop-min-width - 1)) { .navbar-above .navbar-nav .item .m-icon { display: none !important; } } @media (max-width: (@laptop-min-width - 1)) { .section .card { .cover-image { min-height: 24vw; } .thumbnail-image { min-height: 20vw; } } .model { &-index { flex-direction: column; .swiper { width: 100%; } &-side { width: 100%; flex-direction: row; } } &-attach-4 { grid-template-columns: repeat(2, 1fr); } } .swiper-slide-details { &-title { font-size: 1.3rem; } .breadcrumb { display: none; } } .swiper-pagination-bullet { width: 8px; height: 4px; &-active { width: 20px; } } .navbar .container { padding: 0 0.75rem; .navbar-searchicon { display: block; } .navbar-search { display: none; } } } @media (max-width: @mobile-max-width) { .title { font-size: 1.3rem !important; } .container { .column-side, .column-main { flex: none; width: 100%; } } .model-attach-3 { grid-template-columns: none; } .navbar .container { -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; padding: 0 1.5rem; min-height: 3.5rem; .navbar-slideicon { display: block; } .navbar-nav { display: none; } .navbar-searchicon { margin-left: 0; } } .swiper-button-prev, .swiper-button-next { display: none !important; } .is-hidden-mobile { display: none !important; } .card:not(.is-hidden-mobile):not(.is-hidden-all) ~ .card { margin-top: 1.4rem !important; } .pagination-next, .pagination-previous { flex-grow: 1; flex-shrink: 1; } .section { padding-top: 5rem; .container > .tips { margin-left: -0.25rem; margin-right: -0.25rem; max-width: none; } .columns .column { padding: 0.5rem; } .card { .cover-image { height: 40vw; min-height: 130px; } .thumbnail-image { height: 32vw; min-height: 95px; } } } .footer-container { text-align: center; & > li { display: block; &:last-child { float: none; } .footer-truncation { display: block; &:before { content: none !important; } } } } html:not(.disable-scroll) .actions.show { right: 8px; } } @media (max-width: 520px) { .model { &-index-side { flex-direction: column; } &-attach { display: none; } } } @media (min-width: @table-min-width) { .container { .column { &-side { flex: none; width: 33%; } &-main { flex: none; width: 67%; } } .columns, .level { display: flex; } .column-left, .column-right { transition: all 0.5s; &.top-sticky { align-self: flex-start; position: sticky; top: 5rem; } &.bottom-sticky { align-self: flex-end; position: sticky; bottom: 1rem; } } .pagination .pagination-previous { order: 1; } .pagination .pagination-list { flex-grow: 1; flex-shrink: 1; justify-content: center; order: 2; } .pagination .pagination-next { order: 3; } } body.move-up { .container { .column-left.top-sticky, .column-right.top-sticky { top: 1rem; } } } } @media (min-width: @laptop-min-width) { .section .card { .cover-image { min-height: 250px; } .thumbnail-image { min-height: 195px; } } .container { max-width: 960px; .column { &-side { flex: none; width: 28%; } &-main { flex: none; width: 72%; } } } } @media (min-width: @desktop-min-width) { .section .card { .cover-image { min-height: 240px; } .thumbnail-image { min-height: 185px; } } .container { max-width: 1152px; .column { &-side { flex: none; width: 25%; } &-main { flex: none; width: 50%; } } } &.two-column { .column { &-side { flex: none; width: 26%; } &-main { flex: none; width: 74%; } } } .is-hidden-desktop { display: none !important; } .card:not(.is-hidden-desktop):not(.is-hidden-all) ~ .card { margin-top: 1.4rem !important; } } @media (min-width: 1408px) { .section .card { &-small .main-content { -webkit-line-clamp: 3 !important; min-height: 4em; max-height: 4.8em; } .cover-image { min-height: 260px; } .thumbnail-image { min-height: 210px; } } .container { max-width: 1344px; .column { &-side { flex: none; width: 22%; } &-main { flex: none; width: 56%; } } &.two-column { .column { &-side { flex: none; width: 25%; } &-main { flex: none; width: 75%; } } } } } @media (min-width: @display-min-width) { .section .card { .cover-image { min-height: 320px; } .thumbnail-image { min-height: 240px; } } .container { max-width: 1600px; .column { &-side { flex: none; width: 20%; } &-main { flex: none; width: 60%; } } &.two-column { max-width: 1400px; .column { &-side { flex: none; width: 24%; } &-main { flex: none; width: 76%; } } } } } @media (min-width: @widescreen-min-width) { html { font-size: 15px; } .section .card { .cover-image { min-height: 340px; } .thumbnail-image { min-height: 260px; } } .container { max-width: 1800px; .column { &-side { flex: none; width: 18%; } &-main { flex: none; width: 64%; } } &.two-column { max-width: 1500px; .column { &-side { flex: none; width: 22%; } &-main { flex: none; width: 78%; } } } } } @keyframes move-forever { 0% { transform: translate3d(-90px, 0, 0); } to { transform: translate3d(85px, 0, 0); } } @keyframes flicker { 0% { opacity: 1; } 100% { opacity: 0; } } @keyframes code-expand { 0% { opacity: 0.8; } 50% { opacity: 0.1; } 100% { opacity: 0.8; } } @keyframes dung { 0% { -webkit-transform: translateY(0); transform: translateY(0); } 30% { -webkit-transform: translateY(-2px); transform: translateY(-2px); } 60% { -webkit-transform: translateY(2px); transform: translateY(2px); } 80% { -webkit-transform: translateY(-1px); transform: translateY(-1px); } 90% { -webkit-transform: translateY(1px); transform: translateY(1px); } 100% { -webkit-transform: translateY(0); transform: translateY(0); } } /* 时间戳界面 */ .timeline { margin-left: 16px; padding-left: 24px; padding-top: 16px; border-left: 1px solid var(--light-b); &-title { background: var(--bg-e); color: var(--light-a); display: inline-flex; font-size: 0.75em; height: 2em; padding: 0 8px; align-items: center; white-space: nowrap; border-radius: var(--radius-inner); margin-bottom: 0; } .media { position: relative; display: flex; border: none; &:not(:last-child) { margin-bottom: 21px; } & + .media { padding-top: 14px; margin-top: 0; } &-content { time { font-size: 0.85em; display: block; color: var(--dark-b); } .title { color: var(--dark-c); font-size: 1.1em !important; } p a { font-size: 0.9em; color: var(--dark-e); } } &-left { margin-right: 14px; img { height: 64px; width: 64px; object-fit: cover; } } &:before { width: 9px; height: 9px; top: 18px; background: var(--light-d); border-radius: 50%; } &:before, &:last-child:after { content: ''; display: block; position: absolute; left: -29px; } &:first-child:before { top: 4px; } &:first-child:last-child:after { top: 11px; } &:last-child:after { top: 27px; width: 9px; bottom: 0; background: var(--bg-b); } } } /* 日志界面 */ .journal { em { font-style: normal; } &-date { line-height: 34px; color: var(--dark-c); i { margin-right: 4px; font-size: 16px; } } &-content { padding: 10px 12px; overflow: hidden; border-radius: 0 6px 6px 6px; background-color: var(--bg-c); position: relative; .main-content { :last-child { margin-bottom: 0; } } &.fold { max-height: 240px; } &.unfold { padding: 10px 12px 40px 12px; } } &-operation { padding: 12px 0 2px 0; &-item { margin-left: 10px; transition: all 0.2s; user-select: none; color: var(--main); a { color: var(--main); i { margin-right: 5px; font-size: 1.2em; } &:hover { color: var(--theme); i { transform: scale(1.1); } } &:not(.like) .ri-heart-3-line { color: #f55448; transform: none; &:before { content: '\ee0a'; } } } } } &-comment { padding: 12px 0 2px 0; display: none; } } /* 友链界面 */ .links:not(.widget) { margin-bottom: 20px; .link-title { margin-bottom: 10px; } ul { margin: 0; list-style: none; padding: 0; width: 100%; display: inline-block; li { width: 32%; float: left; border: 1px solid var(--light-b); padding: 10px 30px; margin: 4px; position: relative; overflow: hidden; transition: all .3s; border-radius: 10px; height: 100px; box-sizing: border-box; background: var(--bg-d); &:hover { border: 1px solid var(--theme); &:before { width: 180%; } img { transform: rotate(360deg); } .link-name { opacity: 0.9; } .link-desc { opacity: 0.6; } } &:before { content: ""; background-color: var(--theme); transform: skew(45deg, 0); width: 0; height: 100%; position: absolute; top: 0; left: -60px; transition: all .5s; opacity: 0.2; } img { float: right; box-shadow: inset 0 0 10px var(--theme); opacity: 1; transform: rotate(0deg); transition: all ease 1s; margin-top: 5px; width: 65px; height: 65px; padding: 2px; border-radius: 100%; } } } .link-name { color: var(--theme); padding-bottom: 6px; display: block; transition: all .3s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap } .link-desc { color: #949494; font-size: 13px; border-top: 1px dashed var(--light-d); line-height: 25px; transition: all .5s; text-indent: 1em; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } } @media (max-width: 630px) { .links:not(.widget) ul li { width: 100% !important } } @media (max-width: 768px) { .links:not(.widget) ul li:before { display: none } } @media (max-width: 1600px) { .links:not(.widget) ul li { width: 48% } } /* 相册界面 */ .photos { &-teams { display: grid; gap: 15px; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); .item { user-select: none; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; background: var(--bg-b); height: 28px; line-height: 28px; border-radius: 14px; cursor: pointer; color: var(--main); font-size: 12px; padding: 0 15px; text-align: center; transition: color 0.35s, background 0.35s, box-shadow 0.35s, transform 0.35s; &.active { transform: translateY(-2px); color: #fff; background: var(--theme); box-shadow: 0 5px 5px rgb(0 0 0 / 5%); } } } &-gallery { display: block; width: 100%; position: relative; margin-top: 12px; &.loading { margin-bottom: 80px; &:empty { height: 0 !important; } &:after { width: 100%; position: absolute; bottom: -80px; } } & > div { position: absolute; display: inline-block; overflow: hidden; opacity: 0.1; margin: 0; padding: 0; border-radius: 8px; cursor: pointer; & > img { position: absolute; transition: transform 1s ease; top: 50%; left: 50%; margin: 0; padding: 0; border: none; opacity: 0; } & > .jg-caption { opacity: 0; position: absolute; bottom: 0; padding: 5px; background-color: #000000; left: 0; right: 0; margin: 0; color: white; font-size: 0.85em; font-weight: 300; font-family: sans-serif; transition: opacity 300ms ease-in; &.jg-caption-visible { opacity: 0.7; } } .info { position: absolute; right: 0; bottom: 0; left: 0; color: #fff; padding: 20px; max-height: 100%; transform: translateY(calc(100% - 45px)); transition: transform 0.35s ease-in; background: linear-gradient(0deg, #151515cc, transparent 100%); svg { width: 1.3em; height: 1.3em; fill: #fff; vertical-align: text-bottom; stroke-width: 40; stroke: #fff; margin-right: 6px; float: left; } & > :not(:first-child) { margin-top: 5px; } & > div:first-child { margin-left: -16px; transition: all 0.35s ease-in; svg { width: 0; transition: all 0.35s ease-in; } p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } } } &:hover { img { transform: scale(1.2); } .info { overflow-y: scroll; transform: translateY(0); & > div:first-child { margin-left: 0; svg { width: 1.3em; } p { overflow: inherit; white-space: inherit; text-overflow: inherit; } } } } } & > .jg-entry-visible { opacity: 1; background: none; & > img { opacity: 1; } } } } /* 标签界面 */ .tags-field { display: flex; flex-wrap: wrap; justify-content: center; font-size: 1.3em; .tags { display: flex; &:not(:last-child) { margin: 0 0.75rem 0.75rem 0; } .tag { &:not(.is-grey) { border-bottom-right-radius: 0; border-top-right-radius: 0; } &.is-grey { background: var(--bg-e); color: rgb(255 255 255 / 80%); border-bottom-left-radius: 0; border-top-left-radius: 0; } } } } ================================================ FILE: src/css/theme.less ================================================ @charset "utf-8"; /* CSS Document */ // 全局CSS变量 html { --theme: #50bfff; --main: #606266; --title: #444; --background: rgba(255, 255, 255, 0.94); --background-hover: #fff; --style-a: #fff; --light-a: #ffffff; --light-b: #ebeef5; --light-c: #dcdcdc; --light-d: #c0c4cc; --dark-a: #4a4a4a; --dark-b: #909399; --dark-c: #333; --dark-d: #9a9a9a; --dark-e: #7a7a7a; --color-a: #409eff; --bg-a: rgb(242 246 252 / 80%); --bg-b: #f2f6fc; --bg-c: #f5f5f5; --bg-d: rgba(255, 255, 255, 0.8); --bg-e: var(--theme); --bg-f: #f7f7f7; --bg-g: #e8f3ff; --bg-h: rgb(237 244 253 / 75%); --bg-i: #50bfff; --bg-j: rgb(243 244 245 / 25%); --bg-k: rgb(250 250 250 / 80%); --bg-l: rgb(243 243 243 / 80%); --radius-wrap: 8px; --radius-inner: 4px; --radius-img: 5px; --box-shadow: 0 0px 10px -5px #949494; &.night { --theme: #5d93db; --main: #999; --title: #c4c4c4; --background: rgba(40, 44, 52, .6); --background-hover: rgba(40, 44, 52, 0.8); --style-a: #080c28; --light-a: #232323; --light-b: #414243; --light-c: #303030; --light-d: #666; --dark-a: #888; --dark-b: #777; --dark-c: silver; --dark-d: #aaa; --dark-e: #c0c0c0; --color-a: #cbba7d; --bg-a: rgb(65 66 67 / 80%); --bg-b: #303030; --bg-c: #373d48; --bg-d: rgba(40, 44, 52, .8); --bg-e: #434a56; --bg-f: #080c28; --bg-g: rgba(210, 210, 210, 0.2); --bg-h: rgb(65 68 74 / 60%);; --bg-i: #276b92; --bg-j: rgb(36 36 36 / 15%); --bg-k: rgb(30 33 41 / 80%); --bg-l: rgb(63 65 75 / 80%); --box-shadow: 1px 1px 3px 1px #1b1b1b; body::before { filter: brightness(.3); } .logo-img { display: none; &-dark { display: inline-block; } } .waifu, iframe, img, video, svg, .thumbnail-image, .cover-image, .small-image, .aplayer-pic, .brightness { filter: brightness(.8); } .canvas_effects { &.night { display: block; } &.day { display: none; } } .main-content { figure { color: var(--main); background: var(--bg-k); pre code { color: var(--color-a); background: 0 0; } } } } } ================================================ FILE: src/js/autoload.js ================================================ try { ($('').attr({href: '/themes/dream/source/lib/live2d@1.0.1/waifu.min.css', rel: 'stylesheet', type: 'text/css'}).appendTo('head'), $('body').append('
    '), $.ajax({url: '/themes/dream/source/lib/live2d@1.0.1/waifu-tips.min.js', dataType:'script', cache: true, success: function() { $.ajax({url: '/themes/dream/source/lib/live2d@1.0.1/live2d.min.js', dataType:'script', cache: true, success: function() { live2d_settings['hitokotoAPI'] = 'hitokoto.cn' // 一言 API live2d_settings['modelId'] = DreamConfig['live2d_model_id'] // 默认模型 ID live2d_settings['modelTexturesId'] = DreamConfig['live2d_model_textures_id'] // 默认材质 ID live2d_settings['waifuSize'] = DreamConfig['live2d_waifu_size'], live2d_settings['waifuTipsSize'] = '230x75', live2d_settings['waifuFontSize'] = '16px', live2d_settings['waifuToolFont'] = '16px', live2d_settings['waifuToolLine'] = '26px', live2d_settings['waifuEdgeSide'] = DreamConfig['live2d_edge_side'], live2d_settings['homePageUrl'] = '/' live2d_settings['modelCdnUrl'] = DreamConfig['live2d_model_url'] live2d_settings['showToolMenu'] = DreamConfig['live2d_show_tool_menu'] live2d_settings['canTurnToHomePage'] = DreamConfig['live2d_can_turn_to_home_page'] live2d_settings['canSwitchHitokoto'] = DreamConfig['live2d_can_switch_hitokoto'] live2d_settings['canSwitchModel'] = DreamConfig['live2d_can_switch_model'] live2d_settings['canSwitchTextures'] = DreamConfig['live2d_can_switch_textures'] live2d_settings['canTakeScreenshot'] = DreamConfig['live2d_can_take_screenshot'] if (DreamConfig['live2d_about_page']) { live2d_settings['canTurnToAboutPage'] = DreamConfig['live2d_can_turn_to_about_page'] live2d_settings['aboutPageUrl'] = DreamConfig['live2d_about_page'] } else { live2d_settings['canTurnToAboutPage'] = false } live2d_settings['canCloseLive2d'] = DreamConfig['live2d_can_close_live2d'] live2d_settings['modelRandMode'] = DreamConfig['live2d_model_rand_mode'] live2d_settings['modelTexturesRandMode'] = DreamConfig['live2d_model_textures_rand_mode'] /* 在 initModel 前添加 */ initModel(DreamConfig['live2d_tips_url']) }}) }})) } catch(err) { console.log('[Error] JQuery is not defined.') } ================================================ FILE: src/js/btoc.js ================================================ function Btoc(tocList, contentElement) { this.tocList = tocList this.elementList = getChild(contentElement, this.tocList) // 当前解析到第几个标签 this.eIndex = 0 /** * 递归读取目标标签中所有的符合要求的标签 * @param element * @param tocList * @returns {any[]|null} */ function getChild(element, tocList) { if (element == null) { return null } // 获取所有子元素 var child = element.children if (child.length === 0) { return null } var childs = [] for (var i = 0; i < child.length; i++) { var elem = child[i] if (tocList.indexOf(elem.tagName) !== -1) { childs.push(elem) } childs.push.apply(childs, getChild(elem, tocList)) } return childs } /** * 生成目录 */ this.build = function () { if (this.elementList == null || this.elementList.length === 0) { return '' } // 解析获取到的标签元素为目录 // 设置当前元素的最小度为-1表示当前元素为最外层目录元素,防止后续出现比当前元素序号更小的标签 return this.analysis(-1, this.tocList.indexOf(this.elementList[this.eIndex].tagName)) } /** * 解析目录 * @param last 最小的标签(即上级目录的标签) * @param depth 当前标签 * @returns {string} 解析的目录内容 */ this.analysis = function (last, depth) { var tocStr = '
      ' while (this.eIndex < this.elementList.length) { var elem = this.elementList[this.eIndex] // 取得当前元素在标签列表中所属的位置 var n = this.tocList.indexOf(elem.tagName) // 当级别大于最大级别,小于当前级别时,就当做当前级别来处理,并将新的级别设置为新级别 if (n > last && n <= depth) { depth = n var id = elem.id var text = elem.innerText // 标签不存在id,设置id if (id == null || id === '') { id = text + '_' + this.eIndex elem.setAttribute('id', id) } tocStr += `
    • ${text}` this.eIndex++ if (this.eIndex >= this.elementList.length) { tocStr += '
    • ' break } n = this.tocList.indexOf(this.elementList[this.eIndex].tagName) // 如果下一个元素的序号大于当前元素的序号,那么元素为子元素,需要递归获取 if (n > depth) { tocStr += this.analysis(depth, n) } tocStr += '' } else if (n <= last) { // 如果这个元素的序号已经小于最小序号了,那说明这个元素已经外面一层的元素了 break } } return tocStr + '
    ' } } const observers = [] function register($toc) { // toc滚动时间和偏移量 const time = 20 const headingsOffset = 50 const currentInView = new Set() const headingToMenu = new Map() const $menus = Array.from($toc.querySelectorAll('.menu-list > li > a')) for (const $menu of $menus) { const elementId = $menu.getAttribute('data-id').trim().slice(1) const $heading = document.getElementById(elementId) if ($heading) { headingToMenu.set($heading, $menu) } } const $headings = Array.from(headingToMenu.keys()) const callback = (entries) => { for (const entry of entries) { if (entry.isIntersecting) { currentInView.add(entry.target) } else { currentInView.delete(entry.target) } } let $heading if (currentInView.size) { // heading is the first in-view heading $heading = [...currentInView].sort(($el1, $el2) => $el1.offsetTop - $el2.offsetTop)[0] } else if ($headings.length) { // heading is the closest heading above the viewport top $heading = $headings .filter(($heading) => $heading.offsetTop < window.scrollY) .sort(($el1, $el2) => $el2.offsetTop - $el1.offsetTop)[0] } if ($heading && headingToMenu.has($heading)) { $menus.forEach(($menu) => $menu.classList.remove('is-active')) const $menu = headingToMenu.get($heading) $menu.classList.add('is-active') let $menuList = $menu.parentElement.parentElement while ( $menuList.classList.contains('menu-list') && $menuList.parentElement.tagName.toLowerCase() === 'li' ) { $menuList.parentElement.children[0].classList.add('is-active') $menuList = $menuList.parentElement.parentElement } } } const observer = new IntersectionObserver(callback, { threshold: 0 }) for (const $heading of $headings) { observer.observe($heading) // smooth scroll to the heading if (headingToMenu.has($heading)) { const $menu = headingToMenu.get($heading) $menu.addEventListener('click', () => { var element = document.getElementById($menu.getAttribute('data-id').substring(1)) let rect = element.getBoundingClientRect() let currentY = window.pageYOffset let targetY = currentY + rect.top - headingsOffset let speed = (targetY - currentY) / time let offset = currentY > targetY ? -1 : 1 let requestId function step(timestamp) { currentY+=speed if(currentY * offset < targetY * offset){ window.scrollTo(0,currentY) requestId=window.requestAnimationFrame(step) }else{ window.scrollTo(0,targetY) window.cancelAnimationFrame(requestId) } } window.requestAnimationFrame(step) }) } if (headingToMenu.has($heading)) { $heading.style.scrollMargin = '1em' } } observers.push(observer) } Btoc.init = function (params) { const tocList = params['tocList'] const contentElement = params['contentElement'] const tocSelect = params['tocElement'] if (tocList == null || tocList.length === 0 || contentElement == null) { $(tocSelect).children().remove() return false } for (var i = 0; i < tocList.length; i++) { tocList[i] = tocList[i].toUpperCase() } let tocContent = new Btoc(tocList, contentElement).build() $(tocSelect).html(tocContent) } window.tocPjax = function () { observers.forEach(observer => { observer.disconnect() }) observers.splice(0) Btoc.init({ tocList: ['h1', 'h2', 'h3', 'h4', 'h5'], contentElement: $('.main-content:not(.not-toc)')[0], tocElement: '.toc-content' }) if (typeof window.IntersectionObserver === 'undefined') { return } document.querySelectorAll('.toc-content').forEach(register) } ================================================ FILE: src/js/common.js ================================================ window.encrypt = (str) => window.btoa(unescape(encodeURIComponent(str))) window.decrypt = (str) => decodeURIComponent(escape(window.atob(str))) const commonContext = { /* 初始化widget */ initWidget() { const $columnRight = $('.columns .column-right') const $columnRightShadow = $('.columns .column-right-shadow') $('.widget.recent-comments .reply .link').html((i, html) => Utils.renderedEmojiHtml(html)) // 实现将右边widget拷贝的左边 if ($columnRight.length && $columnRightShadow.length && !$columnRightShadow[0].children.length) { for (const child of $columnRight[0].children) { $columnRightShadow[0].append(child.cloneNode(true)) } } }, /* 初始化悬浮操作按钮 */ initActions() { const $bulletScreen = $('.actions>.bullet-screen') if (localStorage.getItem('stop-bullet-screen') === 'true') { $bulletScreen.addClass('stop-bullet-screen') } if ($('halo-comment[bullet-screen]').length !== 0) { $bulletScreen.removeClass('is-hidden-all') } const applyStopBulletScreen = (stopBulletScreenValue) => { $('halo-comment[bullet-screen]').each(function () { const shadowDom = this.shadowRoot.getElementById('halo-comment') if (stopBulletScreenValue) { $(shadowDom).attr('stop-bullet-screen', 'true') } else { $(shadowDom).removeAttr('stop-bullet-screen') } }) if (stopBulletScreenValue) { $bulletScreen.addClass('stop-bullet-screen') } else { $bulletScreen.removeClass('stop-bullet-screen') } localStorage.setItem('stop-bullet-screen', stopBulletScreenValue) } $bulletScreen.on('click', () => { let stopBulletScreen = localStorage.getItem('stop-bullet-screen') || false applyStopBulletScreen(stopBulletScreen.toString() !== 'true') }) }, /* 初始化目录和公告模块 */ initTocAndNotice() { const {pathname} = location window.tocPjax && window.tocPjax() let hideToc = $('.widget.toc .card-content ul').length === 0 let hideNotice = (DreamConfig.notice_show_mode === 'toc' && !hideToc) || (DreamConfig.notice_show_mode === 'index' && pathname !== '/') if (hideToc) { $('.widget.toc,.action-toc').addClass('is-hidden-all') } else { $('.widget.toc,.action-toc').removeClass('is-hidden-all') } if (hideNotice) { $('.widget.notice').addClass('is-hidden-all') } else { $('.widget.notice').removeClass('is-hidden-all') } }, /* 更新横幅大图的文字描述 */ initBanner() { const $bannerInfoDesc = $('.banner-info-desc') if ($bannerInfoDesc.length === 0) return const bannerDesc = $bannerInfoDesc.text() $bannerInfoDesc.text('') let currentBannerDesc = '' let isWrite = true let id const updateDesc = function () { let num = currentBannerDesc.length if (isWrite && num < bannerDesc.length) { currentBannerDesc += bannerDesc.charAt(num) $bannerInfoDesc.text(currentBannerDesc) } else if (!isWrite && num > 0) { currentBannerDesc = currentBannerDesc.slice(0, num - 1) $bannerInfoDesc.text(currentBannerDesc) } else { clearInterval(id) isWrite = !isWrite id = setInterval(updateDesc, isWrite ? 500 : 80) } } id = setInterval(updateDesc, isWrite ? 500 : 80) }, /* 激活图片预览功能 */ initGallery() { // 用链接和标题包装图像 $('.main-content img:not(.not-gallery,.emoji)').each(function () { if ($(this).parents('[data-fancybox],mew-photos').length === 0) { $(this).wrap(``) } }) }, /* 初始化主题模式(仅用户模式) */ initMode() { let isNight = localStorage.getItem('night') || false const applyNight = (isNightValue) => { if (isNightValue) { document.documentElement.classList.add('night') } else { document.documentElement.classList.remove('night') } $('halo-comment').each(function () { const shadowDom = this.shadowRoot.getElementById('halo-comment') $(shadowDom)[`${isNightValue ? 'add' : 'remove'}Class`]('night') }) localStorage.setItem('night', isNightValue) isNight = isNightValue } $('#toggle-mode').on('click', () => applyNight(isNight.toString() !== 'true')) if (DreamConfig.default_theme === 'system') { window.matchMedia('(prefers-color-scheme: dark)') .addListener((event) => applyNight(event.matches)) } }, /* 导航条高亮 */ initNavbar() { const $nav_menus = $('.navbar-nav a') const $nav_side_menus = $('.panel-side-menu .link') let activeIndex = 0 const {href, pathname} = location if (pathname && pathname !== '/') { for (let i = 0; i < $nav_menus.length; i++) { const cur_href = $nav_menus[i].getAttribute('href') if (pathname.includes(cur_href) || href.includes(cur_href)) { activeIndex = i if (pathname === cur_href || href === cur_href) break } } } // 高亮PC端 const $curMenu = $nav_menus.eq(activeIndex) $curMenu.addClass('current') if ($curMenu.parents('.item-dropdown').length) { $curMenu .parents('.item-dropdown') .find('.item-dropdown-link a') .addClass('current') } // 高亮移动端 $nav_side_menus.eq(activeIndex).addClass('current') }, /* 激活导航栏全局下拉框功能 */ initDropMenu() { $('.item-dropdown').each(function (index, item) { const menu = $(this).find('.item-dropdown-menu') const trigger = $(item).attr('trigger') || 'click' const placement = $(item).attr('placement') || $(this).height() || 0 menu.css('top', placement) if (trigger === 'hover') { $(this).hover( () => $(this).addClass('active'), () => $(this).removeClass('active') ) } else { $(this).on('click', function (e) { e.stopPropagation() $(this).toggleClass('active') $(document).one('click', () => $(this).removeClass('active')) e.stopPropagation() }) menu.on('click', (e) => e.stopPropagation()) } }) }, /* 处理滚动 */ initScroll() { window.initTop = 0 // true:上划,false:下滑 function scrollDirection(currentTop) { const result = currentTop > window.initTop window.initTop = currentTop return result } const handleScroll = () => { const scrollTop = $(document).scrollTop() const direction = scrollDirection(scrollTop) const $body = $('body') const $actions = $('.actions') if (scrollTop > 50 && direction) { $body.addClass('move-up') } else { $body.removeClass('move-up') } if (scrollTop > 100) { $actions.addClass('show') } else { $actions.removeClass('show') } } document.addEventListener('scroll', handleScroll) }, /* 搜索框弹窗 */ searchDialog() { const $result = $('.navbar-search .result') $('.navbar-search .input').on('click', function (e) { e.stopPropagation() $result.addClass('active') }) $(document).on('click', function () { $result.removeClass('active') }) }, /* 小屏幕伸缩侧边栏,包含导航或者目录 */ drawerMobile() { $('.navbar-slideicon').on('click', function (e) { e.stopPropagation() /* 关闭搜索框 */ $('.navbar-searchout').removeClass('active') /* 处理开启关闭状态 */ const $html = $('html') const $mask = $('.navbar-mask') const $slide_out = $('.navbar-slideout') if ($slide_out.hasClass('active')) { $html.removeClass('disable-scroll') $mask.removeClass('active slideout') $slide_out.removeClass('active') } else { $html.addClass('disable-scroll') $mask.addClass('active slideout') $slide_out.addClass('active') } }) $('.action-toc').on('click', function (e) { e.stopPropagation() /* 关闭搜索框 */ $('.navbar-searchout').removeClass('active') /* 处理开启关闭状态 */ const $html = $('html') const $mask = $('.navbar-mask') const $slide_out = $('.navbar-slideout') if ($slide_out.hasClass('active')) { $html.removeClass('disable-scroll') $mask.removeClass('active slideout') $slide_out.removeClass('active slideout-toc') } else { $html.addClass('disable-scroll') $mask.addClass('active slideout') $slide_out.addClass('active slideout-toc') } }) }, /* 激活全局返回顶部功能 */ back2Top() { $('#back-to-top').on('click', function () { $('body, html').animate({scrollTop: 0}, 400) }) }, /* 小屏幕搜索框 */ searchMobile() { $('.navbar-searchicon').on('click', function (e) { e.stopPropagation() /* 关闭侧边栏 */ $('.navbar-slideout').removeClass('active') /* 处理开启关闭状态 */ const $html = $('html') const $mask = $('.navbar-mask') const $above = $('.navbar-above') const $search_out = $('.navbar-searchout') if ($search_out.hasClass('active')) { $html.removeClass('disable-scroll') $mask.removeClass('active slideout') $search_out.removeClass('active') $above.removeClass('solid') } else { $html.addClass('disable-scroll') $mask.addClass('active') $above.addClass('solid') $search_out.addClass('active') } }) }, /* 点击遮罩层关闭 */ maskClose() { $('.navbar-mask') .on('click', function (e) { e.stopPropagation() $('html').removeClass('disable-scroll') $('.navbar-mask').removeClass('active slideout') $('.navbar-searchout').removeClass('active') $('.navbar-slideout').removeClass('active slideout-toc') $('.navbar-above').removeClass('solid') }) .on('touchmove', (e) => e.preventDefault) $('.navbar .toc-content') .on('click', function (e) { e.stopPropagation() $('html').removeClass('disable-scroll') $('.navbar-mask').removeClass('active slideout') $('.navbar-slideout').removeClass('active slideout-toc') }) }, /* 移动端侧边栏菜单手风琴 */ sideMenuMobile() { $('.navbar-slideout-menu .current') .parents('.panel-body') .show() .siblings('.panel') .addClass('in') $('.navbar-slideout-menu .panel').on('click', function (e) { e.stopPropagation() const $this = $(this) const panelBox = $this.parent().parent() /* 清除全部内容 */ panelBox.find('.panel').not($this).removeClass('in') panelBox .find('.panel-body') .not($this.siblings('.panel-body')) .stop() .hide('fast') /* 激活当前的内容 */ $this.toggleClass('in').siblings('.panel-body').stop().toggle('fast') }) }, /* 初始化事件 */ initEvent() { let $body = $('body') function closeSelect(elem) { let $elem = $(elem) const closeSelect = $elem.attr('data-close') return closeSelect && closeSelect.trim() !== '' ? $elem.closest(closeSelect.trim()) : $elem } $body.on('click', '.click-close', function (e) { e.stopPropagation() closeSelect(this).remove() }) $body.on('click', '.click-animation-close', function (e) { e.stopPropagation() let selectElem = closeSelect(this) selectElem.addClass('close-animation') setTimeout(() => selectElem.remove(), 300) }) }, /* 离屏提示 */ offscreenTip() { if (Utils.isMobile() || (!DreamConfig.document_hidden_title && !DreamConfig.document_visible_title)) return let originTitle = document.title let timer = null document.addEventListener('visibilitychange', function () { if (document.hidden) { if(!DreamConfig.document_visible_title || document.title !== DreamConfig.document_visible_title) { originTitle = document.title } DreamConfig.document_hidden_title && (document.title = DreamConfig.document_hidden_title) clearTimeout(timer) } else { document.title = DreamConfig.document_visible_title || originTitle DreamConfig.document_visible_title && (timer = setTimeout(function () { if(document.title === DreamConfig.document_visible_title){ document.title = originTitle } document.title = originTitle }, 2000)) } }) }, /** 初始化轮播 **/ initCarousel() { window.Swiper && new Swiper('.swiper', { loop: true, parallax: true, effect: 'slide', spaceBetween: 10, speed: 600, autoplay: { delay: 3000, disableOnInteraction: false, pauseOnMouseEnter: true, }, pagination: { el: '.swiper-pagination', clickable: true, }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }) }, /* 个人信息界面打印彩字 */ sparkInput() { const sparkInputContent = DreamConfig.spark_input_content && DreamConfig.spark_input_content.filter(s => s.length > 0) if (sparkInputContent && sparkInputContent.length > 0) { Utils.cachedScript(`${DreamConfig.theme_base}/source/js/spark-input.min.js?mew=${DreamConfig.theme_version}`, function () { $('.spark-input').each((index, domEle) => sparkInput(domEle, sparkInputContent)) }) } }, /* 恋爱墙倒计时 */ loveTime() { let $elem = $('.love .love-time') if ($elem.length === 0) return let loveTime = $elem.attr('data-time') if (!/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/.test(loveTime)) { $elem.html(loveTime) return } const now = new Date() const grt = new Date(loveTime) setInterval(function () { now.setTime(now.getTime() + 1000) let difference = parseInt((now - grt) / 1000) let seconds = difference % 60 difference = parseInt(difference / 60) let minutes = difference % 60 difference = parseInt(difference / 60) let hours = difference % 24 let days = parseInt(difference / 24) let year = 0 let grtYear = grt.getFullYear() let nowYear = now.getFullYear() while (grtYear < nowYear) { if ((grtYear % 4 === 0 && grtYear % 100 !== 0) || grtYear % 400 === 0) { // 闰年366天 if (days < 366) break days -= 366 year += 1 grtYear += 1 } else { // 平年365天 if (days < 365) break days -= 365 year += 1 grtYear += 1 } } if (year !== 0) { $elem.html(`${year} 年 ${days} 天 ${hours} 时 ${minutes} 分 ${seconds} 秒`) } else { $elem.html(`${days} 天 ${hours} 时 ${minutes} 分 ${seconds} 秒`) } }, 1000) }, /* 激活建站倒计时功能 */ websiteTime() { if (!DreamConfig.website_time) { return } const websiteDate = document.getElementById('websiteDate') if (!/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/.test(DreamConfig.website_time)) { websiteDate.innerText = DreamConfig.website_time return } const now = new Date() const grt = new Date(DreamConfig.website_time) setInterval(function () { now.setTime(now.getTime() + 1000) let difference = parseInt((now - grt) / 1000) let seconds = difference % 60 if (String(seconds).length === 1) { seconds = '0' + seconds } difference = parseInt(difference / 60) let minutes = difference % 60 if (String(minutes).length === 1) { minutes = '0' + minutes } difference = parseInt(difference / 60) let hours = difference % 24 if (String(hours).length === 1) { hours = '0' + hours } let days = parseInt(difference / 24) websiteDate.innerHTML = `建站${days}${hours}${minutes}${seconds}秒` }, 1000) }, /* 初始化特效,只需要初始化一次,移动端设备不初始化 */ initEffects() { if (Utils.isMobile()) return DreamConfig.cursor_move && Utils.cachedScript(`${DreamConfig.theme_base}/source/js/cursor/move/${DreamConfig.cursor_move}.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.cursor_click && Utils.cachedScript(`${DreamConfig.theme_base}/source/js/cursor/click/${DreamConfig.cursor_click}.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.enable_live2d && Utils.cachedScript(`${DreamConfig.theme_base}/source/js/autoload.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.effects_lantern_mode && Utils.cachedScript(`${DreamConfig.theme_base}/source/js/effects/lantern.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.effects_sakura_mode && Utils.cachedScript(`${DreamConfig.theme_base}/source/js/effects/sakura.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.effects_snowflake_mode && Utils.cachedScript(`${DreamConfig.theme_base}/source/js/effects/snowflake.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.effects_universe_mode && Utils.cachedScript(`${DreamConfig.theme_base}/source/js/effects/universe.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.effects_circle_magic_mode && Utils.cachedScript(`${DreamConfig.theme_base}/source/js/effects/circleMagic.min.js?mew=${DreamConfig.theme_version}`) }, /* 加载主动推送、统计脚本等参数 */ loadMaintain() { DreamConfig.enable_baidu_push && Utils.baiduPush() DreamConfig.enable_toutiao_push && Utils.toutiaoPush() }, /* 显示主题版本信息 */ showThemeVersion() { window.logger(`%c页面加载耗时:${Math.round(performance.now())}ms | Theme By Dream ${DreamConfig.theme_version}`, 'color:#fff; background: linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3); padding: 8px 15px; border-radius: 0 15px 0 15px') } } window.commonContext = commonContext !(function () { const loads = ['initCarousel', 'sparkInput', 'websiteTime'] const omits = ['initEffects', 'loadMaintain', 'showThemeVersion'] Object.keys(commonContext).forEach( (c) => !loads.includes(c) && !omits.includes(c) && commonContext[c]() ) // 当前html加载完执行 document.addEventListener('DOMContentLoaded', function () { $('html').addClass('loaded') loads.forEach((c) => commonContext[c] && commonContext[c]()) }) // 所有内容加载完执行 window.addEventListener('load', function () { omits.forEach((c) => commonContext[c] && commonContext[c]()) $('html').addClass('ready') }) })() ================================================ FILE: src/js/cursor/click/firework.js ================================================ /**************** 光标渲染 *******************/ class Circle { constructor({ origin, speed, color, angle, context }) { this.origin = origin this.position = { ...this.origin } this.color = color this.speed = speed this.angle = angle this.context = context this.renderCount = 0 } draw() { this.context.fillStyle = this.color this.context.beginPath() this.context.arc(this.position.x, this.position.y, 2, 0, Math.PI * 2) this.context.fill() } move() { this.position.x = (Math.sin(this.angle) * this.speed) + this.position.x this.position.y = (Math.cos(this.angle) * this.speed) + this.position.y + (this.renderCount * 0.3) this.renderCount++ } } class Boom { constructor({ origin, context, circleCount = 10, area }) { this.origin = origin this.context = context this.circleCount = circleCount this.area = area this.stop = false this.circles = [] } randomArray(range) { const length = range.length const randomIndex = Math.floor(length * Math.random()) return range[randomIndex] } randomColor() { const range = ['8', '9', 'A', 'B', 'C', 'D', 'E', 'F'] return '#' + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) } randomRange(start, end) { return (end - start) * Math.random() + start } init() { for (let i = 0; i < this.circleCount; i++) { const circle = new Circle({ context: this.context, origin: this.origin, color: this.randomColor(), angle: this.randomRange(Math.PI - 1, Math.PI + 1), speed: this.randomRange(1, 6) }) this.circles.push(circle) } } move() { this.circles.forEach((circle, index) => { if (circle.position.x > this.area.width || circle.position.y > this.area.height) { return this.circles.splice(index, 1) } circle.move() }) if (this.circles.length == 0) { this.stop = true } } draw() { this.circles.forEach(circle => circle.draw()) } } class CursorSpecialEffects { constructor() { this.computerCanvas = document.createElement('canvas') this.renderCanvas = document.createElement('canvas') this.computerContext = this.computerCanvas.getContext('2d') this.renderContext = this.renderCanvas.getContext('2d') this.globalWidth = window.innerWidth this.globalHeight = window.innerHeight this.booms = [] this.running = false } handleMouseDown(e) { const boom = new Boom({ origin: { x: e.clientX, y: e.clientY }, context: this.computerContext, area: { width: this.globalWidth, height: this.globalHeight } }) boom.init() this.booms.push(boom) this.running || this.run() } handlePageHide() { this.booms = [] this.running = false } init() { const style = this.renderCanvas.style style.position = 'fixed' style.top = style.left = 0 style.zIndex = '999999999999999999999999999999999999999999' style.pointerEvents = 'none' style.width = this.renderCanvas.width = this.computerCanvas.width = this.globalWidth style.height = this.renderCanvas.height = this.computerCanvas.height = this.globalHeight document.body.append(this.renderCanvas) window.addEventListener('mousedown', this.handleMouseDown.bind(this)) window.addEventListener('pagehide', this.handlePageHide.bind(this)) } run() { this.running = true if (this.booms.length == 0) { return this.running = false } requestAnimationFrame(this.run.bind(this)) this.computerContext.clearRect(0, 0, this.globalWidth, this.globalHeight) this.renderContext.clearRect(0, 0, this.globalWidth, this.globalHeight) this.booms.forEach((boom, index) => { if (boom.stop) { return this.booms.splice(index, 1) } boom.move() boom.draw() }) this.renderContext.drawImage(this.computerCanvas, 0, 0, this.globalWidth, this.globalHeight) } } const cursorSpecialEffects = new CursorSpecialEffects() cursorSpecialEffects.init() ================================================ FILE: src/js/cursor/click/granule.js ================================================ $(function () { let t = function () { 'use strict' function t(t) { return '[object Array]' === Object.prototype.toString.call(t) } function e(t) { return 'function' == typeof t } function n(t) { return 'number' == typeof t } function i(t) { return 'string' == typeof t } function o(t) { return b[t] || String.fromCharCode(t) } function r(t, e, n) { for (var i in e) // eslint-disable-next-line no-prototype-builtins (n || !t.hasOwnProperty(i)) && (t[i] = e[i]) return t } function a(t, e) { return function () { t.apply(e, arguments) } } function c(t) { var n = {} for (var i in t) n[i] = e(t[i]) ? a(t[i], t) : t[i] return n } function s(t) { function n(n) { e(n) && n.apply(t, [].splice.call(arguments, 1)) } function a(t) { for (_ = 0; _ < $.length; _++) D = $[_], i(D) ? O[(t ? 'add' : 'remove') + 'EventListener'].call(O, D, A, !1) : e(D) ? A = D : O = D } function s() { S(N), N = k(s), U || (n(t.setup), U = e(t.setup), n(t.resize)), t.running && !M && (t.dt = (B = +new Date) - t.now, t.millis += t.dt, t.now = B, n(t.update), t.autoclear && K && t.clear(), n(t.draw)), M = ++M % t.interval } function u() { O = j ? t.style : t.canvas, W = j ? 'px' : '', t.fullscreen && (t.height = w.innerHeight, t.width = w.innerWidth), O.height = t.height + W, O.width = t.width + W, t.retina && K && Y && (O.height = t.height * Y, O.width = t.width * Y, O.style.height = t.height + 'px', O.style.width = t.width + 'px', t.scale(Y, Y)), U && n(t.resize) } function l(t, e) { return R = e.getBoundingClientRect(), t.x = t.pageX - R.left - w.scrollX, t.y = t.pageY - R.top - w.scrollY, t } function h(e, n) { return l(e, t.element), n = n || {}, n.ox = n.x || e.x, n.oy = n.y || e.y, n.x = e.x, n.y = e.y, n.dx = n.x - n.ox, n.dy = n.y - n.oy, n } function d(t) { if (t.preventDefault(), F = c(t), F.originalEvent = t, F.touches) for (Q.length = F.touches.length, _ = 0; _ < F.touches.length; _++) Q[_] = h(F.touches[_], Q[_]) else Q.length = 0, Q[0] = h(F, V) return r(V, Q[0], !0), F } function f(e) { for (e = d(e), X = (q = $.indexOf(G = e.type)) - 1, t.dragging = !!/down|start/.test(G) || !/up|end/.test(G) && t.dragging; X; ) i($[X]) ? n(t[$[X--]], e) : i($[q]) ? n(t[$[q++]], e) : X = 0 } function p(e) { z = e.keyCode, H = 'keyup' == e.type, J[z] = J[o(z)] = !H, n(t[e.type], e) } function m(e) { t.autopause && ('blur' == e.type ? C : E)(), n(t[e.type], e) } function E() { t.now = +new Date, t.running = !0 } function C() { t.running = !1 } function P() { (t.running ? C : E)() } function T() { K && t.clearRect(0, 0, t.width, t.height) } function I() { L = t.element.parentNode, _ = x.indexOf(t), L && L.removeChild(t.element), ~_ && x.splice(_, 1), a(!1), C() } var N, A, O, L, R, _, W, B, D, F, G, z, H, X, q, M = 0, Q = [], U = !1, Y = w.devicePixelRatio, j = t.type == y, K = t.type == g, V = { x: 0, y: 0, ox: 0, oy: 0, dx: 0, dy: 0 }, $ = [t.element, f, 'mousedown', 'touchstart', f, 'mousemove', 'touchmove', f, 'mouseup', 'touchend', f, 'click', v, p, 'keydown', 'keyup', w, m, 'focus', 'blur', u, 'resize'], J = {} for (z in b) J[b[z]] = !1 return r(t, { touches: Q, mouse: V, keys: J, dragging: !1, running: !1, millis: 0, now: NaN, dt: NaN, destroy: I, toggle: P, clear: T, start: E, stop: C }), x.push(t), t.autostart && E(), a(!0), u(), s(), t } let u = document.createElement('div') u.setAttribute('id', 'clickCanvas'), u.style.cssText = 'position:fixed;left:0;top:0;z-index:1000;pointer-events:none;', document.body.appendChild(u) for (var l, h, d = 'E LN10 LN2 LOG2E LOG10E PI SQRT1_2 SQRT2 abs acos asin atan ceil cos exp floor log round sin sqrt tan atan2 pow max min'.split(' '), f = '__hasSketch', p = Math, g = 'canvas', m = 'webgl', y = 'dom', v = document, w = window, x = [], E = { fullscreen: !0, autostart: !0, autoclear: !0, autopause: !0, container: v.body, interval: 1, globals: !0, retina: !1, type: g }, b = { 8: 'BACKSPACE', 9: 'TAB', 13: 'ENTER', 16: 'SHIFT', 27: 'ESCAPE', 32: 'SPACE', 37: 'LEFT', 38: 'UP', 39: 'RIGHT', 40: 'DOWN' }, C = { CANVAS: g, WEB_GL: m, WEBGL: m, DOM: y, instances: x, install: function (e) { if (!e[f]) { for (var i = 0; i < d.length; i++) e[d[i]] = p[d[i]] r(e, { TWO_PI: 2 * p.PI, HALF_PI: p.PI / 2, QUATER_PI: p.PI / 4, random: function (e, i) { return t(e) ? e[~~(p.random() * e.length)] : (n(i) || (i = e || 1, e = 0), e + p.random() * (i - e)) }, lerp: function (t, e, n) { return t + n * (e - t) }, map: function (t, e, n, i, o) { return (t - e) / (n - e) * (o - i) + i } }), e[f] = !0 } }, create: function (t) { return t = r(t || {}, E), t.globals && C.install(self), l = t.element = t.element || v.createElement(t.type === y ? 'div' : 'canvas'), h = t.context = t.context || function () { switch (t.type) { case g: return l.getContext('2d', t) case m: return l.getContext('webgl', t) || l.getContext('experimental-webgl', t) case y: return l.canvas = l } } (), t.container.appendChild(l), C.augment(h, t) }, augment: function (t, e) { return e = r(e || {}, E), e.element = t.canvas || t, e.element.className += ' sketch', r(t, e, !0), s(t) } }, P = ['ms', 'moz', 'webkit', 'o'], T = self, I = 0, N = 'AnimationFrame', A = 'request' + N, O = 'cancel' + N, k = T[A], S = T[O], L = 0; L < P.length && !k; L++) k = T[P[L] + 'Request' + N], S = T[P[L] + 'Cancel' + A] return T[A] = k = k || function (t) { var e = +new Date, n = p.max(0, 16 - (e - I)), i = setTimeout(function () { t(e + n) }, n) return I = e + n, i }, T[O] = S = S || function (t) { clearTimeout(t) }, C }() if (document.getElementById('clickCanvas')) { function e(t, e, n) { this.init(t, e, n) } e.prototype = { init: function (t, e, n) { this.alive = !0, this.radius = n || 10, this.wander = .15, this.theta = random(TWO_PI), this.drag = .92, this.color = '#ffeb3b', this.x = t || 0, this.y = e || 0, this.vx = 0, this.vy = 0 }, move: function () { this.x += this.vx, this.y += this.vy, this.vx *= this.drag, this.vy *= this.drag, this.theta += random( - .5, .5) * this.wander, this.vx += .1 * sin(this.theta), this.vy += .1 * cos(this.theta), this.radius *= .96, this.alive = this.radius > .5 }, draw: function (t) { t.beginPath(), t.arc(this.x, this.y, this.radius, 0, TWO_PI), t.fillStyle = this.color, t.fill() } } var n = 50, i = ['#5ee4ff', '#f44033', '#ffeb3b', '#F38630', '#FA6900', '#f403e8', '#F9D423'], o = [], r = [], a = t.create({ container: document.getElementById('clickCanvas') }) a.spawn = function (t, a) { o.length >= n && r.push(o.shift()), particle = r.length ? r.pop() : new e, particle.init(t, a, random(5, 20)), particle.wander = random(.5, 2), particle.color = random(i), particle.drag = random(.9, .99), theta = random(TWO_PI), force = random(1, 5), particle.vx = sin(theta) * force, particle.vy = cos(theta) * force, o.push(particle) }, a.update = function () { var t, e for (t = o.length - 1; t >= 0; t--) e = o[t], e.alive ? e.move() : r.push(o.splice(t, 1)[0]) }, a.draw = function () { a.globalCompositeOperation = 'lighter' for (var t = o.length - 1; t >= 0; t--) o[t].draw(a) }, document.addEventListener('mousedown', function (t) { var e, n 'TEXTAREA' !== t.target.nodeName && 'INPUT' !== t.target.nodeName && 'A' !== t.target.nodeName && 'I' !== t.target.nodeName && 'IMG' !== t.target.nodeName && function () { for (e = random(15, 20), n = 0; n < e; n++) a.spawn(t.clientX, t.clientY) } () }) } }) ================================================ FILE: src/js/cursor/click/heart.js ================================================ !function (e, t, a) { function r() { for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[ e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = 'left:' + s[e].x + 'px;top:' + s[e].y + 'px;opacity:' + s[e].alpha + ';transform:scale(' + s[e].scale + ',' + s[e].scale + ') rotate(45deg);background:' + s[e].color + ';z-index:99999') requestAnimationFrame(r) } function n() { var t = 'function' == typeof e.onclick && e.onclick e.onclick = function (e) { t && t(), o(e) } } function o(e) { var a = t.createElement('div') a.className = 'heart', s.push({ el: a, x: e.clientX - 5, y: e.clientY - 5, scale: 1, alpha: 1, color: c() }), t.body.appendChild(a) } function i(e) { var a = t.createElement('style') a.type = 'text/css' try { a.appendChild(t.createTextNode(e)) } catch (t) { a.styleSheet.cssText = e } t.getElementsByTagName('head')[0].appendChild(a) } function c() { return 'rgb(' + ~~(255 * Math.random()) + ',' + ~~(255 * Math.random()) + ',' + ~~(255 * Math .random()) + ')' } var s = [] e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e .mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) { setTimeout(e, 1e3 / 60) }, i( '.heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: \'\';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}' ), n(), r() }(window, document) ================================================ FILE: src/js/cursor/click/prosperous.js ================================================ var a_idx = 0 jQuery(document).ready(function ($) { $('body').click(function (e) { var a = ['富强', '民主', '文明', '和谐', '自由', '平等', '公正', '法治', '爱国', '敬业', '诚信', '友善'] var $i = $('').text(a[a_idx]) a_idx = (a_idx + 1) % a.length var x = e.pageX, y = e.pageY let scrolly = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop y = y - scrolly $i.css({ 'z-index': 999, 'top': y - 20, 'left': x, 'position': 'fixed', 'font-weight': 'bold', 'color': /*"#ff6651" 随机颜色写法:*/ 'rgb(' + ~~(255 * Math.random()) + ',' + ~~(255 * Math.random()) + ',' + ~~(255 * Math.random()) + ')' }) $('body').append($i) $i.animate({'top': y - 180, 'opacity': 0}, 1500, function () { $i.remove() }) }) }) ================================================ FILE: src/js/cursor/move/bubbleCursor.js ================================================ function bubbleCursor(options) { let hasWrapperEl = options && options.element let element = hasWrapperEl || document.body let width = window.innerWidth let height = window.innerHeight let cursor = { x: width / 2, y: width / 2 } let particles = [] let canvas, context let canvImages = [] function init(wrapperEl) { canvas = document.createElement('canvas') context = canvas.getContext('2d') canvas.style.top = '0px' canvas.style.left = '0px' canvas.style.pointerEvents = 'none' if (hasWrapperEl) { canvas.style.position = 'absolute' element.appendChild(canvas) canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.style.position = 'fixed' document.body.appendChild(canvas) canvas.width = width canvas.height = height } bindEvents() loop() } // Bind events that are needed function bindEvents() { element.addEventListener('mousemove', onMouseMove) element.addEventListener('touchmove', onTouchMove, { passive: true }) element.addEventListener('touchstart', onTouchMove, { passive: true }) window.addEventListener('resize', onWindowResize) } function onWindowResize(e) { width = window.innerWidth height = window.innerHeight if (hasWrapperEl) { canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.width = width canvas.height = height } } function onTouchMove(e) { if (e.touches.length > 0) { for (let i = 0; i < e.touches.length; i++) { addParticle( e.touches[i].clientX, e.touches[i].clientY, canvImages[Math.floor(Math.random() * canvImages.length)] ) } } } function onMouseMove(e) { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.clientX - boundingRect.left cursor.y = e.clientY - boundingRect.top } else { cursor.x = e.clientX cursor.y = e.clientY } addParticle(cursor.x, cursor.y) } function addParticle(x, y, img) { particles.push(new Particle(x, y, img)) } function updateParticles() { context.clearRect(0, 0, width, height) // Update for (let i = 0; i < particles.length; i++) { particles[i].update(context) } // Remove dead particles for (let i = particles.length - 1; i >= 0; i--) { if (particles[i].lifeSpan < 0) { particles.splice(i, 1) } } } function loop() { updateParticles() requestAnimationFrame(loop) } function Particle(x, y, canvasItem) { const lifeSpan = Math.floor(Math.random() * 60 + 60) this.initialLifeSpan = lifeSpan // this.lifeSpan = lifeSpan //ms this.velocity = { x: (Math.random() < 0.5 ? -1 : 1) * (Math.random() / 10), y: -0.4 + Math.random() * -1, } this.position = { x: x, y: y } this.canv = canvasItem this.baseDimension = 4 this.update = function(context) { this.position.x += this.velocity.x this.position.y += this.velocity.y this.velocity.x += ((Math.random() < 0.5 ? -1 : 1) * 2) / 75 this.velocity.y -= Math.random() / 600 this.lifeSpan-- const scale = 0.2 + (this.initialLifeSpan - this.lifeSpan) / this.initialLifeSpan context.fillStyle = '#e6f1f7' context.strokeStyle = '#3a92c5' context.beginPath() context.arc( this.position.x - (this.baseDimension / 2) * scale, this.position.y - this.baseDimension / 2, this.baseDimension * scale, 0, 2 * Math.PI ) context.stroke() context.fill() context.closePath() } } init() } new bubbleCursor() ================================================ FILE: src/js/cursor/move/emojiCursor.js ================================================ function emojiCursor(options) { const possibleEmoji = (options && options.emoji) || ['😀', '😂', '😆', '😊'] let hasWrapperEl = options && options.element let element = hasWrapperEl || document.body let width = window.innerWidth let height = window.innerHeight const cursor = { x: width / 2, y: width / 2 } const lastPos = { x: width / 2, y: width / 2 } let lastTimestamp = 0 const particles = [] const canvImages = [] let canvas, context function init() { canvas = document.createElement('canvas') context = canvas.getContext('2d') canvas.style.top = '0px' canvas.style.left = '0px' canvas.style.pointerEvents = 'none' if (hasWrapperEl) { canvas.style.position = 'absolute' element.appendChild(canvas) canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.style.position = 'fixed' document.body.appendChild(canvas) canvas.width = width canvas.height = height } context.font = '21px serif' context.textBaseline = 'middle' context.textAlign = 'center' possibleEmoji.forEach((emoji) => { let measurements = context.measureText(emoji) let bgCanvas = document.createElement('canvas') let bgContext = bgCanvas.getContext('2d') bgCanvas.width = measurements.width bgCanvas.height = measurements.actualBoundingBoxAscent * 2 bgContext.textAlign = 'center' bgContext.font = '21px serif' bgContext.textBaseline = 'middle' bgContext.fillText( emoji, bgCanvas.width / 2, measurements.actualBoundingBoxAscent ) canvImages.push(bgCanvas) }) bindEvents() loop() } // Bind events that are needed function bindEvents() { element.addEventListener('mousemove', onMouseMove, { passive: true }) element.addEventListener('touchmove', onTouchMove, { passive: true }) element.addEventListener('touchstart', onTouchMove, { passive: true }) window.addEventListener('resize', onWindowResize) } function onWindowResize(e) { width = window.innerWidth height = window.innerHeight if (hasWrapperEl) { canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.width = width canvas.height = height } } function onTouchMove(e) { if (e.touches.length > 0) { for (let i = 0; i < e.touches.length; i++) { addParticle( e.touches[i].clientX, e.touches[i].clientY, canvImages[Math.floor(Math.random() * canvImages.length)] ) } } } function onMouseMove(e) { // Dont run too fast if (e.timeStamp - lastTimestamp < 16) { return } window.requestAnimationFrame(() => { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.clientX - boundingRect.left cursor.y = e.clientY - boundingRect.top } else { cursor.x = e.clientX cursor.y = e.clientY } const distBetweenPoints = Math.hypot( cursor.x - lastPos.x, cursor.y - lastPos.y ) if (distBetweenPoints > 1) { addParticle( cursor.x, cursor.y, canvImages[Math.floor(Math.random() * possibleEmoji.length)] ) lastPos.x = cursor.x lastPos.y = cursor.y lastTimestamp = e.timeStamp } }) } function addParticle(x, y, img) { particles.push(new Particle(x, y, img)) } function updateParticles() { context.clearRect(0, 0, width, height) // Update for (let i = 0; i < particles.length; i++) { particles[i].update(context) } // Remove dead particles for (let i = particles.length - 1; i >= 0; i--) { if (particles[i].lifeSpan < 0) { particles.splice(i, 1) } } } function loop() { updateParticles() requestAnimationFrame(loop) } /** * Particles */ function Particle(x, y, canvasItem) { const lifeSpan = Math.floor(Math.random() * 60 + 80) this.initialLifeSpan = lifeSpan // this.lifeSpan = lifeSpan //ms this.velocity = { x: (Math.random() < 0.5 ? -1 : 1) * (Math.random() / 2), y: Math.random() * 0.4 + 0.8, } this.position = { x: x, y: y } this.canv = canvasItem this.update = function(context) { this.position.x += this.velocity.x this.position.y += this.velocity.y this.lifeSpan-- this.velocity.y += 0.05 const scale = Math.max(this.lifeSpan / this.initialLifeSpan, 0) context.drawImage( this.canv, this.position.x - (this.canv.width / 2) * scale, this.position.y - this.canv.height / 2, this.canv.width * scale, this.canv.height * scale ) } } init() } new emojiCursor() ================================================ FILE: src/js/cursor/move/fairyDustCursor.js ================================================ function fairyDustCursor(options) { let possibleColors = (options && options.colors) || [ '#D61C59', '#E7D84B', '#1B8798', ] let hasWrapperEl = options && options.element let element = hasWrapperEl || document.body let width = window.innerWidth let height = window.innerHeight const cursor = { x: width / 2, y: width / 2 } const lastPos = { x: width / 2, y: width / 2 } const particles = [] const canvImages = [] let canvas, context const char = '*' function init() { canvas = document.createElement('canvas') context = canvas.getContext('2d') canvas.style.top = '0px' canvas.style.left = '0px' canvas.style.pointerEvents = 'none' if (hasWrapperEl) { canvas.style.position = 'absolute' element.appendChild(canvas) canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.style.position = 'fixed' element.appendChild(canvas) canvas.width = width canvas.height = height } context.font = '21px serif' context.textBaseline = 'middle' context.textAlign = 'center' possibleColors.forEach((color) => { let measurements = context.measureText(char) let bgCanvas = document.createElement('canvas') let bgContext = bgCanvas.getContext('2d') bgCanvas.width = measurements.width bgCanvas.height = measurements.actualBoundingBoxAscent + measurements.actualBoundingBoxDescent bgContext.fillStyle = color bgContext.textAlign = 'center' bgContext.font = '21px serif' bgContext.textBaseline = 'middle' bgContext.fillText( char, bgCanvas.width / 2, measurements.actualBoundingBoxAscent ) canvImages.push(bgCanvas) }) bindEvents() loop() } // Bind events that are needed function bindEvents() { element.addEventListener('mousemove', onMouseMove) element.addEventListener('touchmove', onTouchMove, { passive: true }) element.addEventListener('touchstart', onTouchMove, { passive: true }) window.addEventListener('resize', onWindowResize) } function onWindowResize(e) { width = window.innerWidth height = window.innerHeight if (hasWrapperEl) { canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.width = width canvas.height = height } } function onTouchMove(e) { if (e.touches.length > 0) { for (let i = 0; i < e.touches.length; i++) { addParticle( e.touches[i].clientX, e.touches[i].clientY, canvImages[Math.floor(Math.random() * canvImages.length)] ) } } } function onMouseMove(e) { window.requestAnimationFrame(() => { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.clientX - boundingRect.left cursor.y = e.clientY - boundingRect.top } else { cursor.x = e.clientX cursor.y = e.clientY } const distBetweenPoints = Math.hypot( cursor.x - lastPos.x, cursor.y - lastPos.y ) if (distBetweenPoints > 1.5) { addParticle( cursor.x, cursor.y, canvImages[Math.floor(Math.random() * possibleColors.length)] ) lastPos.x = cursor.x lastPos.y = cursor.y } }) } function addParticle(x, y, color) { particles.push(new Particle(x, y, color)) } function updateParticles() { context.clearRect(0, 0, width, height) // Update for (let i = 0; i < particles.length; i++) { particles[i].update(context) } // Remove dead particles for (let i = particles.length - 1; i >= 0; i--) { if (particles[i].lifeSpan < 0) { particles.splice(i, 1) } } } function loop() { updateParticles() requestAnimationFrame(loop) } function Particle(x, y, canvasItem) { const lifeSpan = Math.floor(Math.random() * 30 + 60) this.initialLifeSpan = lifeSpan // this.lifeSpan = lifeSpan //ms this.velocity = { x: (Math.random() < 0.5 ? -1 : 1) * (Math.random() / 2), y: Math.random() * 0.7 + 0.9, } this.position = { x: x, y: y } this.canv = canvasItem this.update = function (context) { this.position.x += this.velocity.x this.position.y += this.velocity.y this.lifeSpan-- this.velocity.y += 0.02 const scale = Math.max(this.lifeSpan / this.initialLifeSpan, 0) context.drawImage( this.canv, this.position.x - (this.canv.width / 2) * scale, this.position.y - this.canv.height / 2, this.canv.width * scale, this.canv.height * scale ) } } init() } new fairyDustCursor() ================================================ FILE: src/js/cursor/move/followingDotCursor.js ================================================ function followingDotCursor(options) { let hasWrapperEl = options && options.element let element = hasWrapperEl || document.body let width = window.innerWidth let height = window.innerHeight let cursor = { x: width / 2, y: width / 2 } let dot = new Dot(width / 2, height / 2, 10, 10) let canvas, context function init() { canvas = document.createElement('canvas') context = canvas.getContext('2d') canvas.style.top = '0px' canvas.style.left = '0px' canvas.style.pointerEvents = 'none' if (hasWrapperEl) { canvas.style.position = 'absolute' element.appendChild(canvas) canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.style.position = 'fixed' document.body.appendChild(canvas) canvas.width = width canvas.height = height } bindEvents() loop() } // Bind events that are needed function bindEvents() { element.addEventListener('mousemove', onMouseMove) window.addEventListener('resize', onWindowResize) } function onWindowResize(e) { width = window.innerWidth height = window.innerHeight if (hasWrapperEl) { canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.width = width canvas.height = height } } function onMouseMove(e) { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.clientX - boundingRect.left cursor.y = e.clientY - boundingRect.top } else { cursor.x = e.clientX cursor.y = e.clientY } } function updateDot() { context.clearRect(0, 0, width, height) dot.moveTowards(cursor.x, cursor.y, context) } function loop() { updateDot() requestAnimationFrame(loop) } function Dot(x, y, width, lag) { this.position = { x: x, y: y } this.width = width this.lag = lag this.moveTowards = function (x, y, context) { this.position.x += (x - this.position.x) / this.lag this.position.y += (y - this.position.y) / this.lag context.fillStyle = 'rgba(50, 50, 50, 0.65)' context.beginPath() context.arc(this.position.x, this.position.y, this.width, 0, 2 * Math.PI) context.fill() context.closePath() } } init() } new followingDotCursor() ================================================ FILE: src/js/cursor/move/ghostCursor.js ================================================ function ghostCursor(options) { let hasWrapperEl = options && options.element let element = hasWrapperEl || document.body let width = window.innerWidth let height = window.innerHeight let cursor = { x: width / 2, y: width / 2 } let particles = [] let canvas, context let baseImage = new Image() baseImage.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAATCAYAAACk9eypAAAAAXNSR0IArs4c6QAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAEgAAAABAAAASAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAAEwAAAAAChpcNAAAACXBIWXMAAAsTAAALEwEAmpwYAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAABqElEQVQoFY3SPUvDQBgH8BREpRHExYiDgmLFl6WC+AYmWeyLg4i7buJX8DMpOujgyxGvUYeCgzhUQUSKKLUS0+ZyptXh8Z5Ti621ekPyJHl+uftfomhaf9Ei5JyxXKfynyEA6EYcLHpwyflT958GAQ7DTABNHd8EbtDbEH2BD5QEQmi2mM8P/Iq+A0SzszEg+3sPjDnDdVEtQKQbMUidHD3xVzf6A9UDEmEm+8h9KTqTVUjT+vB53aHrCbAPiceYq1dQI1Aqv4EhMll0jzv+Y0yiRgCnLRSYyDQHVoqUXe4uKL9l+L7GXC4vkMhE6eW/AOJs9k583ORDUyXMZ8F5SVHVVnllmPNKSFagAJ5DofaqGXw/gHBYg51dIldkmknY3tguv3jOtHR4+MqAzaraJXbEhqHhcQlwGSOi5pytVQHZLN5s0WNe8HPrLYlFsO20RPHkImxsbmHdLJFI76th7Z4SeuF53hTeFLvhRCJRCTKZKxgdnRDbW+iozFJbBMw14/ElwGYc0egMBMFzT21f5Rog33Z7dX02GBm7WV5ZfT5Nn5bE3zuCDe9UxdTpNvK+5AAAAABJRU5ErkJggg==' function init() { canvas = document.createElement('canvas') context = canvas.getContext('2d') canvas.style.top = '0px' canvas.style.left = '0px' canvas.style.pointerEvents = 'none' if (hasWrapperEl) { canvas.style.position = 'absolute' element.appendChild(canvas) canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.style.position = 'fixed' document.body.appendChild(canvas) canvas.width = width canvas.height = height } bindEvents() loop() } // Bind events that are needed function bindEvents() { element.addEventListener('mousemove', onMouseMove) element.addEventListener('touchmove', onTouchMove, { passive: true }) element.addEventListener('touchstart', onTouchMove, { passive: true }) window.addEventListener('resize', onWindowResize) } function onWindowResize(e) { width = window.innerWidth height = window.innerHeight if (hasWrapperEl) { canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.width = width canvas.height = height } } function onTouchMove(e) { if (e.touches.length > 0) { for (let i = 0; i < e.touches.length; i++) { addParticle(e.touches[i].clientX, e.touches[i].clientY, baseImage) } } } function onMouseMove(e) { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.clientX - boundingRect.left cursor.y = e.clientY - boundingRect.top } else { cursor.x = e.clientX cursor.y = e.clientY } addParticle(cursor.x, cursor.y, baseImage) } function addParticle(x, y, image) { particles.push(new Particle(x, y, image)) } function updateParticles() { context.clearRect(0, 0, width, height) // Update for (let i = 0; i < particles.length; i++) { particles[i].update(context) } // Remove dead particles for (let i = particles.length - 1; i >= 0; i--) { if (particles[i].lifeSpan < 0) { particles.splice(i, 1) } } } function loop() { updateParticles() requestAnimationFrame(loop) } /** * Particles */ function Particle(x, y, image) { const lifeSpan = 40 this.initialLifeSpan = lifeSpan //ms this.lifeSpan = lifeSpan //ms this.position = { x: x, y: y } this.image = image this.update = function (context) { this.lifeSpan-- const opacity = Math.max(this.lifeSpan / this.initialLifeSpan, 0) context.globalAlpha = opacity context.drawImage( this.image, this.position.x, // - (this.canv.width / 2) * scale, this.position.y //- this.canv.height / 2, ) } } init() } new ghostCursor() ================================================ FILE: src/js/cursor/move/snowflakeCursor.js ================================================ function snowflakeCursor(options) { let hasWrapperEl = options && options.element let element = hasWrapperEl || document.body let possibleEmoji = ['❄️'] let width = window.innerWidth let height = window.innerHeight let cursor = { x: width / 2, y: width / 2 } let particles = [] let canvas, context let canvImages = [] function init() { canvas = document.createElement('canvas') context = canvas.getContext('2d') canvas.style.top = '0px' canvas.style.left = '0px' canvas.style.pointerEvents = 'none' if (hasWrapperEl) { canvas.style.position = 'absolute' element.appendChild(canvas) canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.style.position = 'fixed' document.body.appendChild(canvas) canvas.width = width canvas.height = height } context.font = '12px serif' context.textBaseline = 'middle' context.textAlign = 'center' possibleEmoji.forEach((emoji) => { let measurements = context.measureText(emoji) let bgCanvas = document.createElement('canvas') let bgContext = bgCanvas.getContext('2d') bgCanvas.width = measurements.width bgCanvas.height = measurements.actualBoundingBoxAscent * 2 bgContext.textAlign = 'center' bgContext.font = '12px serif' bgContext.textBaseline = 'middle' bgContext.fillText( emoji, bgCanvas.width / 2, measurements.actualBoundingBoxAscent ) canvImages.push(bgCanvas) }) bindEvents() loop() } // Bind events that are needed function bindEvents() { element.addEventListener('mousemove', onMouseMove) element.addEventListener('touchmove', onTouchMove, { passive: true }) element.addEventListener('touchstart', onTouchMove, { passive: true }) window.addEventListener('resize', onWindowResize) } function onWindowResize(e) { width = window.innerWidth height = window.innerHeight if (hasWrapperEl) { canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.width = width canvas.height = height } } function onTouchMove(e) { if (e.touches.length > 0) { for (let i = 0; i < e.touches.length; i++) { addParticle( e.touches[i].clientX, e.touches[i].clientY, canvImages[Math.floor(Math.random() * canvImages.length)] ) } } } function onMouseMove(e) { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.clientX - boundingRect.left cursor.y = e.clientY - boundingRect.top } else { cursor.x = e.clientX cursor.y = e.clientY } addParticle( cursor.x, cursor.y, canvImages[Math.floor(Math.random() * possibleEmoji.length)] ) } function addParticle(x, y, img) { particles.push(new Particle(x, y, img)) } function updateParticles() { context.clearRect(0, 0, width, height) // Update for (let i = 0; i < particles.length; i++) { particles[i].update(context) } // Remove dead particles for (let i = particles.length - 1; i >= 0; i--) { if (particles[i].lifeSpan < 0) { particles.splice(i, 1) } } } function loop() { updateParticles() requestAnimationFrame(loop) } /** * Particles */ function Particle(x, y, canvasItem) { const lifeSpan = Math.floor(Math.random() * 60 + 80) this.initialLifeSpan = lifeSpan // this.lifeSpan = lifeSpan //ms this.velocity = { x: (Math.random() < 0.5 ? -1 : 1) * (Math.random() / 2), y: 1 + Math.random(), } this.position = { x: x, y: y } this.canv = canvasItem this.update = function(context) { this.position.x += this.velocity.x this.position.y += this.velocity.y this.lifeSpan-- this.velocity.x += ((Math.random() < 0.5 ? -1 : 1) * 2) / 75 this.velocity.y -= Math.random() / 300 const scale = Math.max(this.lifeSpan / this.initialLifeSpan, 0) const degrees = 2 * this.lifeSpan const radians = degrees * 0.0174533 // not perfect but close enough context.translate(this.position.x, this.position.y) context.rotate(radians) context.drawImage( this.canv, (-this.canv.width / 2) * scale, -this.canv.height / 2, this.canv.width * scale, this.canv.height * scale ) context.rotate(-radians) context.translate(-this.position.x, -this.position.y) } } init() } new snowflakeCursor() ================================================ FILE: src/js/cursor/move/springyEmojiCursor.js ================================================ // The springy emoji effect has been translated over from this old // code, to modern js & canvas // - http://www.yaldex.com/FSMessages/ElasticBullets.htm function springyEmojiCursor(options) { let emoji = (options && options.emoji) || '🤪' let hasWrapperEl = options && options.element let element = hasWrapperEl || document.body let nDots = 7 let DELTAT = 0.01 let SEGLEN = 10 let SPRINGK = 10 let MASS = 1 let GRAVITY = 50 let RESISTANCE = 10 let STOPVEL = 0.1 let STOPACC = 0.1 let DOTSIZE = 11 let BOUNCE = 0.7 let width = window.innerWidth let height = window.innerHeight let cursor = { x: width / 2, y: width / 2 } let particles = [] let canvas, context let emojiAsImage function init() { canvas = document.createElement('canvas') context = canvas.getContext('2d') canvas.style.top = '0px' canvas.style.left = '0px' canvas.style.pointerEvents = 'none' if (hasWrapperEl) { canvas.style.position = 'absolute' element.appendChild(canvas) canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.style.position = 'fixed' document.body.appendChild(canvas) canvas.width = width canvas.height = height } // Save emoji as an image for performance context.font = '16px serif' context.textBaseline = 'middle' context.textAlign = 'center' let measurements = context.measureText(emoji) let bgCanvas = document.createElement('canvas') let bgContext = bgCanvas.getContext('2d') bgCanvas.width = measurements.width bgCanvas.height = measurements.actualBoundingBoxAscent * 2 bgContext.textAlign = 'center' bgContext.font = '16px serif' bgContext.textBaseline = 'middle' bgContext.fillText( emoji, bgCanvas.width / 2, measurements.actualBoundingBoxAscent ) emojiAsImage = bgCanvas let i = 0 for (i = 0; i < nDots; i++) { particles[i] = new Particle(emojiAsImage) } bindEvents() loop() } // Bind events that are needed function bindEvents() { element.addEventListener('mousemove', onMouseMove) element.addEventListener('touchmove', onTouchMove, { passive: true }) element.addEventListener('touchstart', onTouchMove, { passive: true }) window.addEventListener('resize', onWindowResize) } function onWindowResize(e) { width = window.innerWidth height = window.innerHeight if (hasWrapperEl) { canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.width = width canvas.height = height } } function onTouchMove(e) { if (e.touches.length > 0) { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.touches[0].clientX - boundingRect.left cursor.y = e.touches[0].clientY - boundingRect.top } else { cursor.x = e.touches[0].clientX cursor.y = e.touches[0].clientY } } } function onMouseMove(e) { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.clientX - boundingRect.left cursor.y = e.clientY - boundingRect.top } else { cursor.x = e.clientX cursor.y = e.clientY } } function updateParticles() { // eslint-disable-next-line no-self-assign canvas.width = canvas.width // follow mouse particles[0].position.x = cursor.x particles[0].position.y = cursor.y // Start from 2nd dot for (i = 1; i < nDots; i++) { let spring = new vec(0, 0) if (i > 0) { springForce(i - 1, i, spring) } if (i < nDots - 1) { springForce(i + 1, i, spring) } let resist = new vec( -particles[i].velocity.x * RESISTANCE, -particles[i].velocity.y * RESISTANCE ) let accel = new vec( (spring.X + resist.X) / MASS, (spring.Y + resist.Y) / MASS + GRAVITY ) particles[i].velocity.x += DELTAT * accel.X particles[i].velocity.y += DELTAT * accel.Y if ( Math.abs(particles[i].velocity.x) < STOPVEL && Math.abs(particles[i].velocity.y) < STOPVEL && Math.abs(accel.X) < STOPACC && Math.abs(accel.Y) < STOPACC ) { particles[i].velocity.x = 0 particles[i].velocity.y = 0 } particles[i].position.x += particles[i].velocity.x particles[i].position.y += particles[i].velocity.y let height, width height = canvas.clientHeight width = canvas.clientWidth if (particles[i].position.y >= height - DOTSIZE - 1) { if (particles[i].velocity.y > 0) { particles[i].velocity.y = BOUNCE * -particles[i].velocity.y } particles[i].position.y = height - DOTSIZE - 1 } if (particles[i].position.x >= width - DOTSIZE) { if (particles[i].velocity.x > 0) { particles[i].velocity.x = BOUNCE * -particles[i].velocity.x } particles[i].position.x = width - DOTSIZE - 1 } if (particles[i].position.x < 0) { if (particles[i].velocity.x < 0) { particles[i].velocity.x = BOUNCE * -particles[i].velocity.x } particles[i].position.x = 0 } particles[i].draw(context) } } function loop() { updateParticles() requestAnimationFrame(loop) } function vec(X, Y) { this.X = X this.Y = Y } function springForce(i, j, spring) { let dx = particles[i].position.x - particles[j].position.x let dy = particles[i].position.y - particles[j].position.y let len = Math.sqrt(dx * dx + dy * dy) if (len > SEGLEN) { let springF = SPRINGK * (len - SEGLEN) spring.X += (dx / len) * springF spring.Y += (dy / len) * springF } } function Particle(canvasItem) { this.position = { x: cursor.x, y: cursor.y } this.velocity = { x: 0, y: 0, } this.canv = canvasItem this.draw = function(context) { context.drawImage( this.canv, this.position.x - this.canv.width / 2, this.position.y - this.canv.height / 2, this.canv.width, this.canv.height ) } } init() } new springyEmojiCursor() ================================================ FILE: src/js/cursor/move/trailingCursor.js ================================================ // The trailing cursor's easing has bene pulled from this demo // - https://codepen.io/jakedeakin/full/MWKQVxX function trailingCursor(options) { let hasWrapperEl = options && options.element let element = hasWrapperEl || document.body let width = window.innerWidth let height = window.innerHeight let cursor = { x: width / 2, y: width / 2 } let particles = [] let canvas, context const totalParticles = options.particles || 15 let cursorsInitted = false let baseImage = new Image() baseImage.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAATCAYAAACk9eypAAAAAXNSR0IArs4c6QAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAEgAAAABAAAASAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAAEwAAAAAChpcNAAAACXBIWXMAAAsTAAALEwEAmpwYAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAABqElEQVQoFY3SPUvDQBgH8BREpRHExYiDgmLFl6WC+AYmWeyLg4i7buJX8DMpOujgyxGvUYeCgzhUQUSKKLUS0+ZyptXh8Z5Ti621ekPyJHl+uftfomhaf9Ei5JyxXKfynyEA6EYcLHpwyflT958GAQ7DTABNHd8EbtDbEH2BD5QEQmi2mM8P/Iq+A0SzszEg+3sPjDnDdVEtQKQbMUidHD3xVzf6A9UDEmEm+8h9KTqTVUjT+vB53aHrCbAPiceYq1dQI1Aqv4EhMll0jzv+Y0yiRgCnLRSYyDQHVoqUXe4uKL9l+L7GXC4vkMhE6eW/AOJs9k583ORDUyXMZ8F5SVHVVnllmPNKSFagAJ5DofaqGXw/gHBYg51dIldkmknY3tguv3jOtHR4+MqAzaraJXbEhqHhcQlwGSOi5pytVQHZLN5s0WNe8HPrLYlFsO20RPHkImxsbmHdLJFI76th7Z4SeuF53hTeFLvhRCJRCTKZKxgdnRDbW+iozFJbBMw14/ElwGYc0egMBMFzT21f5Rog33Z7dX02GBm7WV5ZfT5Nn5bE3zuCDe9UxdTpNvK+5AAAAABJRU5ErkJggg==' function init() { canvas = document.createElement('canvas') context = canvas.getContext('2d') canvas.style.top = '0px' canvas.style.left = '0px' canvas.style.pointerEvents = 'none' if (hasWrapperEl) { canvas.style.position = 'absolute' element.appendChild(canvas) canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.style.position = 'fixed' document.body.appendChild(canvas) canvas.width = width canvas.height = height } bindEvents() loop() } // Bind events that are needed function bindEvents() { element.addEventListener('mousemove', onMouseMove) window.addEventListener('resize', onWindowResize) } function onWindowResize(e) { width = window.innerWidth height = window.innerHeight if (hasWrapperEl) { canvas.width = element.clientWidth canvas.height = element.clientHeight } else { canvas.width = width canvas.height = height } } function onMouseMove(e) { if (hasWrapperEl) { const boundingRect = element.getBoundingClientRect() cursor.x = e.clientX - boundingRect.left cursor.y = e.clientY - boundingRect.top } else { cursor.x = e.clientX cursor.y = e.clientY } if (cursorsInitted === false) { cursorsInitted = true for (let i = 0; i < totalParticles; i++) { addParticle(cursor.x, cursor.y, baseImage) } } } function addParticle(x, y, image) { particles.push(new Particle(x, y, image)) } function updateParticles() { context.clearRect(0, 0, width, height) let x = cursor.x let y = cursor.y particles.forEach(function (particle, index, particles) { let nextParticle = particles[index + 1] || particles[0] particle.position.x = x particle.position.y = y particle.move(context) x += (nextParticle.position.x - particle.position.x) * 0.4 y += (nextParticle.position.y - particle.position.y) * 0.4 }) } function loop() { updateParticles() requestAnimationFrame(loop) } /** * Particles */ function Particle(x, y, image) { this.position = { x: x, y: y } this.image = image this.move = function (context) { context.drawImage( this.image, this.position.x, // - (this.canv.width / 2) * scale, this.position.y //- this.canv.height / 2, ) } } init() } new trailingCursor() ================================================ FILE: src/js/dprogress.js ================================================ (function() { var DProgress = {} var Settings = DProgress.settings = { minimum: 0.08, // 最小值 easing: 'linear', // 动画规律 speed: 400, // 动画速度 trickle: true, // 开启自动增量 trickleSpeed: 200, // 缓慢增量 parent: 'body', template: '
    ' } /** * Updates configuration. * * DProgress.configure({ * minimum: 0.1 * }); */ DProgress.configure = function(options) { var key, value for (key in options) { value = options[key] // eslint-disable-next-line no-prototype-builtins if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value } return this } /** * 进度状态,0-1 */ DProgress.status = null function clamp(n, min, max) { if (n < min) return min if (n > max) return max return n } /** * 开始进度条 * * DProgress.start(); * */ DProgress.start = function() { if (!DProgress.status) DProgress.set(0) $('#dprogress').show() var work = function() { setTimeout(function() { if (!DProgress.status ||DProgress.status === 1) return DProgress.trickle() work() }, Settings.trickleSpeed) } if (Settings.trickle) work() return this } /** * 缓慢增量 * @returns {undefined} */ DProgress.trickle = function() { return DProgress.inc() } /** * 增量 */ DProgress.inc = function(amount) { var n = DProgress.status if (!n) { return DProgress.start() // eslint-disable-next-line no-empty } else if(n >= 1) { } else { if (typeof amount !== 'number') { if (n >= 0 && n < 0.2) { amount = 0.1 } else if (n >= 0.2 && n < 0.5) { amount = 0.04 } else if (n >= 0.5 && n < 0.8) { amount = 0.02 } else if (n >= 0.8 && n < 0.98) { amount = 0.005 } else { amount = 0 } } n = clamp(n + amount, 0, 0.98) return DProgress.set(n) } } /** * 设置进度状态 `0.0` to `1.0`. * * DProgress.set(0.4); * DProgress.set(1.0); */ DProgress.set = function(n) { DProgress.status = clamp(n, Settings.minimum, 1) var progress = document.getElementById('dprogress') if (!progress) { progress = document.createElement('div') progress.id = 'dprogress' progress.innerHTML = Settings.template var bar = $(progress.querySelector('.bar')) bar.css('transition', `all ${Settings.speed}ms ${Settings.easing}`) if (DreamConfig.load_progress === 'center') { bar.css('margin', 'auto') } $(Settings.parent).prepend(progress) } progress.querySelector('.bar').style.width = `${n * 100}%` return this } /** * 进度条是否已经开始 * @returns {boolean} */ DProgress.isStarted = function() { return typeof DProgress.status === 'number' } /** * 完成进度条 * @param force * @returns {DProgress|*} */ DProgress.done = function() { DProgress.inc(0.3 + 0.5 * Math.random()).set(1) setTimeout(function() { $('#dprogress').hide() DProgress.status = undefined }, Settings.speed) return this } /** * 检查进度条是否显示 */ DProgress.isRendered = function() { return !!document.getElementById('dprogress') } window.DProgress = DProgress })() ================================================ FILE: src/js/dshare.js ================================================ import QRCode from 'qrcode' import html2canvas from 'html2canvas' const channels = { qq: { name: 'QQ', template: 'http://connect.qq.com/widget/shareqq/index.html?url={{URL}}&title={{TITLE}}&source={{SOURCE}}&desc={{DESCRIPTION}}&pics={{IMAGE}}&summary={{SUMMARY}}' }, qzone: { name: 'QQ空间', template: 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={{URL}}&title={{TITLE}}&desc={{DESCRIPTION}}&summary={{SUMMARY}}&site={{SOURCE}}&pics={{IMAGE}}' }, wechat: { name: '微信' }, weibo: { name: '新浪微博', template: 'https://service.weibo.com/share/share.php?url={{URL}}&title={{TITLE}}&pic={{IMAGE}}&appkey={{KEY}}' }, douban: { name: '豆瓣', template: 'http://shuo.douban.com/!service/share?href={{URL}}&name={{TITLE}}&text={{DESCRIPTION}}&image={{IMAGE}}&starid=0&aid=0&style=11' }, linkedin: { name: 'Linkedin', template: 'http://www.linkedin.com/shareArticle?mini=true&ro=true&title={{TITLE}}&url={{URL}}&summary={{SUMMARY}}&source={{SOURCE}}&armin=armin' }, facebook: { name: 'FaceBook', template: 'https://www.facebook.com/sharer/sharer.php?u={{URL}}' }, twitter: { name: 'Twitter', template: 'https://twitter.com/intent/tweet?text={{TITLE}}&url={{URL}}&via={{ORIGIN}}' }, google: { name: 'Google', template: 'https://plus.google.com/share?url={{URL}}' }, link: { name: '复制链接' }, poster: { name: '海报' } } function defaultConfig() { return { url: location.href, origin: location.origin, source: getMetaContentByName('site') || getMetaContentByName('Site') || document.title, title: getMetaContentByName('title') || getMetaContentByName('Title') || document.title, description: getMetaContentByName('description') || getMetaContentByName('Description') || '', // 图片url image: undefined, // 图片或者图片所在的容器的选择器 imageSelector: undefined, weiboKey: '', sites: ['qq', 'qzone', 'wechat', 'weibo', 'douban', 'linkedin', 'facebook', 'twitter', 'google', 'link', 'poster'] } } let linkCopy window.DShare = { create(element, options) { const $body = $('body') $body.off('click', '.icon-poster') linkCopy && linkCopy.destroy() const config = buildConfig(options) element = $(element) element.addClass('dshare-container') for (let site of config.sites) { let clazz = 'icon-' + site element.append(``) } config.sites.indexOf('wechat') !== -1 && createWechatShare(config, element) if(config.sites.indexOf('link') !== -1){ linkCopy = new ClipboardJS('.icon-link', {text: () => config.url}) .on('error', () => Qmsg.error('您的浏览器不支持复制')) .on('success', () => Qmsg.success('链接复制成功')) } config.sites.indexOf('poster') !== -1 && $body.on('click', '.icon-poster', () => triggerPosterShare(config)) }, /** * 海报方式分享 * @param options */ sharePoster(options) { triggerPosterShare(buildConfig(options)) } } /** * 创建微信分享 * @param config 配置 * @param element 实体 */ function createWechatShare(config, element) { QRCode.toDataURL(config.url, { width: 140}) .then(data => { element.find('.icon-wechat').append(`

    微信扫一扫:分享

    微信分享
    `) }) } /** * 触发海报方式分享 */ function triggerPosterShare(config) { QRCode.toDataURL(config.url) .then(data => { $('body').append(`
    ${ config.image ? `
    ${config.title}封面
    ` : '' }${config.title !== '' ? `

    ${config.title}

    ` : '' }

    ${config.description}

    `) let $posterCrad = $('.dshare-poster-crad') $posterCrad.click(e => e.stopPropagation()) $('.dshare-poster-download').click(e => { e.stopPropagation() let divWidth = $posterCrad.outerWidth() let divHeight =$posterCrad.outerHeight() html2canvas($posterCrad[0], {height: divHeight, width: divWidth, useCORS: true, scale: 2, onclone(doc){ doc.getElementsByClassName('dshare-poster-crad')[0].style['transform'] = 'none' doc.getElementsByClassName('dshare-poster-crad')[0].style['border-radius'] = 0 }}) .then((canvas) => { let a = document.createElement('a') a.href= canvas.toDataURL('image/png') a.download = `share-${new Date().getTime()}.png` a.click() $('.dshare-poster').click() }) }) } ) } /** * 创建配置 * @param options * @returns {*} */ function buildConfig(options) { const config = Object.assign(defaultConfig(), options) if (!config.summary) { config.summary = config.description } if (!config.image && config.imageSelector) { let selector = $(config.imageSelector) config.image = selector.filter('img[src]').first().attr('src') || selector.find('img[src]').first().attr('src') } if (config.image) { if (config.image.substring(0, 2) === '//') { config.image = location.protocol + config.image } else if (config.image.substring(0, 1) === '/') { config.image = location.origin + config.image } } return config } /** * 获取元元素内容值 * * @param {String} name * * @returns {String|*} */ function getMetaContentByName(name) { return (document.getElementsByName(name)[0] || 0).content } /** * 创建网站的url * * @param {String} site * @param {Object} config * * @returns {String} */ function makeUrl(site, config) { let channel = channels[site] return channel.template.replace(/\{\{(\w)(\w*)\}\}/g, function (m, fix, key) { let nameKey = site + fix + key.toLowerCase() key = (fix + key).toLowerCase() return encodeURIComponent((config[nameKey] === undefined ? config[key] : config[nameKey]) || '') }) } ================================================ FILE: src/js/editor-options.js ================================================ (function () { const customElement = [ { value: '$副标题', html: 'mew-subtitle | 副标题' }, { value: '', html: 'mew-music | 网易云单曲' }, { value: '', html: 'mew-music | 网易云歌单' }, { value: '', html: 'mew-music | 自定义单曲' }, { value: '', html: 'mew-bilibili | bilibili视频' }, { value: '\n' + '\n' + '$第一页内容\n' + '\n' + '\n' + '$第二页内容\n' + '\n' + '', html: 'mew-tabs | 标签页' }, { value: '$文件资源描述说明', html: 'mew-cloud | 网盘链接' }, { value: '', html: 'mew-progress | 进度条' }, { value: '\n' + '$面板内容\n' + '', html: 'mew-panel | 面板' }, { value: '$消息内容', html: 'mew-message | 消息' }, { value: '', html: 'mew-hr | 信封分割线' }, { value: '\n' + ' $时间标题\n' + ' $时间子项1具体内容\n' + ' $时间子项2具体内容\n' + '', html: 'mew-timeline | 时间线' }, { value: '打开博客 ', html: 'mew-btn | 按钮' }, { value: '$引言内容', html: 'mew-quote | 引言' }, { value: '$网页摘要说明', html: 'mew-link | 外部链接' }, { value: '', html: 'mew-link | 博客文章/页面链接' }, { value: '', html: 'mew-video | 视频播放器' }, { value: '\n' + ' $图1描述\n' + ' $图2描述\n' + '', html: 'mew-photos | 画廊' }, { value: '\n' + '$被隔离的内容\n' + '', html: 'mew-raw | 样式隔离' }, { value: '\n' + '$评论后可见的内容\n' + '', html: 'mew-hide | 评论后可见' } ] window.handleEditorOptions = (editorComponent) => { handleCustomElement() return { hint: { emoji: handleEmojiImg(), extend: [ { key: ' { return customElement.filter(item => item.value.indexOf(key.toLocaleLowerCase()) > -1) } } ] } } } function handleCustomElement() { let cssText = Array.from( new Set(customElement .map(item => item.html) .map(html => html.substring(0, html.indexOf(' '))) ) ).map(item => `${item} { position: relative; display: block; width: 100%; height: 48px; overflow: hidden; user-select: none; } ${item}:before { content: '${item} 自定义元素'; position: absolute; display: block; background: #eee; border-radius: 8px; height: 48px; padding: 10px; width: 100%; text-align: center; font-family: monospace; color: #999; }`) .join('\n') const style = document.createElement('style') style.appendChild(document.createTextNode(cssText)) document.getElementById('vditor').before(style) } function handleEmojiImg() { let emojiList = ['hehe', 'haha', 'tushe', 'a', 'ku', 'nu', 'kaixin', 'han', 'lei', 'heixian', 'bishi', 'bugaoxing', 'zhenbang', 'qian', 'yiwen', 'yingxiang', 'tu', 'yi', 'weiqu', 'huaxin', 'hu', 'xiaoyan', 'len', 'taikaixin', 'huaji', 'mianqiang', 'kuanhan', 'guai', 'shuijiao', 'jingku', 'shengqi', 'jingya', 'pen', 'turanxingfen', 'wabi', 'tanshou', 'wuzuixiao', 'hejiu', 'xili', 'landeli', 'zhayao', 'chigua', 'xiaoguai', 'nidongde', 'heiheihei', 'huanhu', 'xiaoniao', 'suanshuang', 'jinzhang', 'anzhongguancha', 'xiaohonglian', 'yamiedie', 'weiweiyixiao', 'what', 'tuosai', 'pu', 'kunchenggou', 'kejianzhongguancha', 'caigou', 'laohu', 'aowu', 'aoteman', 'heitougaoxing', 'heitoudengyan', 'wangyuanjing', 'butin', 'ganfan', 'damuzhi', 'shengli', 'haha2', 'ok', 'honglingjin', 'aixin', 'xinsui', 'meigui', 'liwu', 'yanhua', 'caihong', 'taiyang', 'xingxingyueliang', 'dangao', 'chabei', 'xiangjiao', 'bianbian', 'yaowan', 'qianbi', 'lazhu', 'shafa', 'yinyue', 'dengpao', 'shouzhi'] let emojis = {} emojiList.forEach(key => { emojis[key] = `/themes/dream/source/img/emoji/${key}.png` }) return emojis } })() ================================================ FILE: src/js/effects/circleMagic.js ================================================ (function ($) { $.fn.circleMagic = function (options) { let width, height, canvas, ctx, animateHeader = true const circles = [] const settings = $.extend({ color: 'rgba(255,255,255,.5)', radius: 10, density: 0.3, clearOffset: 0.2, mode: 'all' }, options) // Main var container = this['0'] initContainer() addListeners() function initContainer() { width = window.innerWidth height = window.innerHeight // create canvas element canvas = initCanvas() canvas.width = width canvas.height = height ctx = canvas.getContext('2d') // create circles for (let x = 0; x < width * settings.density; x++) { const c = new Circle() circles.push(c) } animate() } //Init canvas element function initCanvas() { const canvasElement = document.createElement('canvas') canvasElement.setAttribute('class', `canvas_effects ${settings.mode}`) container.prepend(canvasElement) return canvasElement } // Event handling function addListeners() { window.addEventListener('scroll', scrollCheck, false) window.addEventListener('resize', resize, false) } function scrollCheck() { if (document.body.scrollTop > height) { animateHeader = false } else { animateHeader = true } } function resize() { width = window.innerWidth height = window.innerHeight canvas.width = width canvas.height = height } function animate() { const isNight = document.documentElement.classList.contains('night') if (settings.mode === 'all' || (settings.mode === 'day' && !isNight) || (settings.mode === 'night' && isNight)) { if (animateHeader) { ctx.clearRect(0, 0, width, height) for (const i in circles) { circles[i].draw() } } } requestAnimationFrame(animate) } function randomColor() { var r = Math.floor(Math.random() * 255) var g = Math.floor(Math.random() * 255) var b = Math.floor(Math.random() * 255) var alpha = Math.random().toPrecision(2) return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + alpha + ')' } // Canvas manipulation function Circle() { var that = this; // constructor (function () { that.pos = {} init() })() function init() { that.pos.x = Math.random() * width that.pos.y = height + Math.random() * 100 that.alpha = 0.1 + Math.random() * settings.clearOffset that.scale = 0.1 + Math.random() * 0.3 that.speed = Math.random() if (settings.color === 'random') { that.color = randomColor() } else { that.color = settings.color } } this.draw = function () { if (that.alpha <= 0) { init() } that.pos.y -= that.speed that.alpha -= 0.0005 ctx.beginPath() ctx.arc(that.pos.x, that.pos.y, that.scale * settings.radius, 0, 2 * Math.PI, false) ctx.fillStyle = that.color ctx.fill() ctx.closePath() } } } $('body').circleMagic({ radius: 35, density: 0.3, color: 'rgba(255,255,255, .4)', //color: 'random', clearOffset: 0.3, mode: DreamConfig.effects_circle_magic_mode }) })(jQuery) ================================================ FILE: src/js/effects/lantern.js ================================================ (function (factory) { typeof define === 'function' && define.amd ? define(factory) : factory() }((function () { 'use strict' const mode = DreamConfig.effects_lantern_mode function styleInject(css, ref) { if ( ref === void 0 ) ref = {} var insertAt = ref.insertAt if (!css || typeof document === 'undefined') { return } var head = document.head || document.getElementsByTagName('head')[0] var style = document.createElement('style') style.type = 'text/css' if (insertAt === 'top') { if (head.firstChild) { head.insertBefore(style, head.firstChild) } else { head.appendChild(style) } } else { head.appendChild(style) } if (style.styleSheet) { style.styleSheet.cssText = css } else { style.appendChild(document.createTextNode(css)) } } let mode_css = mode === 'day' ? '.night .j-china-lantern {display: none}' : mode === 'night' ? '.j-china-lantern {display: none}.night .j-china-lantern {display: block}' : '' var css_248z = '@charset "UTF-8";.lantern__warpper{position:fixed;top:12px;left:40px;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:999}.lantern__warpper.lantern__secondary{left:calc(100% - 130px)}.lantern__warpper.lantern__secondary .lantern__box{-webkit-animation-duration:3s;animation-duration:3s}.lantern__box{position:relative;display:inline-block;width:90px;height:70px;background:rgba(216,0,15,.8);border-radius:50% 50%;animation:lantern-swing 3s ease-in-out infinite alternate-reverse;-webkit-transform-origin:50% -70px;-ms-transform-origin:50% -70px;transform-origin:50% -70px;-webkit-box-shadow:-5px 5px 50px 4px #fa6c00;box-shadow:-5px 5px 50px 4px #fa6c00}.lantern__box:after,.lantern__box:before{content:"";position:absolute;height:8px;width:45px;left:50%;border:1px solid #dc8f03;background:-webkit-gradient(linear,left top,right top,from(#dc8f03),color-stop(orange),color-stop(#dc8f03),color-stop(orange),to(#dc8f03));background:-o-linear-gradient(left,#dc8f03,orange,#dc8f03,orange,#dc8f03);background:linear-gradient(90deg,#dc8f03,orange,#dc8f03,orange,#dc8f03)}.lantern__box:before{top:0;border-radius:5px 5px 0 0;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.lantern__box:after{bottom:0;border-radius:0 0 5px 5px;-webkit-transform:translate(-50%,50%);-ms-transform:translate(-50%,50%);transform:translate(-50%,50%)}.lantern__line{position:absolute;width:2px;height:12px;top:0;left:50%;-webkit-transform:translate(-50%,-100%);-ms-transform:translate(-50%,-100%);transform:translate(-50%,-100%);background:#dc8f03}.lantern__circle{width:80%;-webkit-box-sizing:border-box;box-sizing:border-box}.lantern__circle,.lantern__circle .lantern__ellipse{height:100%;margin:0 auto;border-radius:50%;border:2px solid #dc8f03}.lantern__circle .lantern__ellipse{width:50%}.lantern__circle .lantern__text{font-family:华文行楷,Microsoft YaHei,sans-serif;font-size:24.3px;color:#dc8f03;font-weight:700;line-height:66px;text-align:center}.lantern__tail{position:relative;width:4px;height:12px;margin:0 auto;animation:lantern-swing 4s ease-in-out infinite alternate-reverse;background:orange;border-radius:0 0 5px 5px}.lantern__tail .lantern__junction{position:absolute;top:0;left:50%;width:8px;height:8px;-webkit-transform:translate(-50%,8.4px);-ms-transform:translate(-50%,8.4px);transform:translate(-50%,8.4px);background:#e69603;border-radius:50%}.lantern__tail .lantern__rect{position:absolute;top:0;left:50%;-webkit-transform:translate(-50%,10.8px);-ms-transform:translate(-50%,10.8px);transform:translate(-50%,10.8px);width:8px;height:24px;background:orange;border-radius:5px 5px 0 5px}@-webkit-keyframes lantern-swing{0%{-webkit-transform:rotate(-8deg);transform:rotate(-8deg)}to{-webkit-transform:rotate(8deg);transform:rotate(8deg)}}@keyframes lantern-swing{0%{-webkit-transform:rotate(-8deg);transform:rotate(-8deg)}to{-webkit-transform:rotate(8deg);transform:rotate(8deg)}}@media (max-width:460px){.lantern__warpper{top:8px;left:30px}.lantern__warpper.lantern__secondary{left:calc(100% - 80px)}.lantern__box{width:50px;height:40px;-webkit-transform-origin:50% -40px;-ms-transform-origin:50% -40px;transform-origin:50% -40px;-webkit-box-shadow:-5px 5px 50px -1px #fa6c00;box-shadow:-5px 5px 50px -1px #fa6c00}.lantern__box:after,.lantern__box:before{height:4px;width:25px}.lantern__line{width:2px;height:8px}.lantern__circle .lantern__text{font-size:13.5px;line-height:38px}.lantern__tail{width:4px;height:8px}.lantern__tail .lantern__junction{width:8px;height:8px;-webkit-transform:translate(-50%,5.6px);-ms-transform:translate(-50%,5.6px);transform:translate(-50%,5.6px)}.lantern__tail .lantern__rect{-webkit-transform:translate(-50%,7.2px);-ms-transform:translate(-50%,7.2px);transform:translate(-50%,7.2px);width:8px;height:16px}}' + mode_css styleInject(css_248z) var content = '
    ' function createElement() { var div = document.createElement('div') div.className = 'j-china-lantern' div.innerHTML = content document.body.appendChild(div) } createElement() }))) ================================================ FILE: src/js/effects/sakura.js ================================================ (function () { let stop, staticx const mode = DreamConfig.effects_sakura_mode const canvas = document.createElement('canvas') const img = new Image() img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAAEwCAYAAADVZeifAAAACXBIWXMAAACYAAAAmAGiyIKYAAAHG2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBSaWdodHM9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9yaWdodHMvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtcFJpZ2h0czpNYXJrZWQ9IkZhbHNlIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6NDFDMjQxQjYyNjIwNjgxMTgwODNEMjE2MDAzOTU1NDQiIHhtcE1NOkRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDozNDVjOWViOC04NDc4LTFkNDctOGRjMi0yZDkyOGNhYTYxZWQiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6YjAzN2ZiMGItNTU5Mi0xYjRkLWJjZGQtOWU4NGExMDJiMGM2IiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDQyAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE4LTA1LTA5VDE0OjQ5OjM3KzA4OjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAxOC0wNS0wOVQxNDo1MToyNSswODowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxOC0wNS0wOVQxNDo1MToyNSswODowMCIgZGM6Zm9ybWF0PSJpbWFnZS9wbmciIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjEyMjVlZWE3LTEyY2QtMTY0NC04ZDAzLWFjOTE2ZTAxZDQ1YyIgc3RSZWY6ZG9jdW1lbnRJRD0idXVpZDoxRDIwNUFGNjZCRDlFNTExOUM5REMwMzg2RjlEQjFGNyIvPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDphYmMzNjIzMy1hOWNkLWNiNDQtODViYi0zZTgyMjEwYmIxMjYiIHN0RXZ0OndoZW49IjIwMTgtMDUtMDlUMTQ6NTE6MjUrMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE4IChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YjAzN2ZiMGItNTU5Mi0xYjRkLWJjZGQtOWU4NGExMDJiMGM2IiBzdEV2dDp3aGVuPSIyMDE4LTA1LTA5VDE0OjUxOjI1KzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+XCpBoAAApBxJREFUeNrs/cmSI8u2LIipLnMHosnc59Z7jyxhjSg1oggn/EWO+SP8B34JhRyWCItk1at7786MBnBbWoNlZm4OOLrIvc8+t45bCjIQjibQuKuvTlUpCdva1ra2ta3zZdtHsK1tbWtbG0Bua1vb2tYGkNva1ra2tQHktra1rW1tALmtbW1rWxtAbmtb29rWBpDb2ta2trUB5La2ta1tbQC5rW1ta1sbQG5rW9va1gaQ29rWtra1AeS2trWtbW1rA8htbWtb29oAclvb2ta2NoDc1ra2ta0NILe1rW1tawPIbW1rW9vaAHJb29rWtjaA3Na2trWtDSC3ta1tbWsDyG1ta1vb2gByW9va1rY2gNzWtra1rW1tALmtbW1rWxtAbmtb29rWBpDb2ta2trUB5La2ta1tbQC5rW1ta1sbQG5rW9va1gaQ29rWtra1AeS2trWtbW0Aua1tbWtbG0Bua1vb2tY/3xr+o7+Bf/2//z/+1OfPAIgJErGbMj7M8fue+O1A7LLjcxyw+5hwZMbgQnLgKIftRsgMyYUjBYNhOn6AADiMOGDCyIQBCflwwNEdw24HHA5AzhjHJxyQwZTADLgmHJPhDRnfjo6PlPHbNOJDGZgEZsIgOAHPR/yPwxv+28MONOBghIEAiXce8LkzuAG/vRP7o+EzAcMRyNlxoJByxj4T/8su4+UgPE3A++jg5yfe/lvD73/b4eVfM17/zfE//y3h6UjsJ8f/9N8m/Of/Cnz/d0cegHES/t///Q7HHfG/+/8JT0fABGQTzIEkYMyGf/0vBh8N3/99wv/rP/1/sDs6/i//+t8DZhCATOFwzPj4/R3/MhkOmPBz/47dB+CY8LZ/w/NnQh4cu88dppSRU4abQwbQCRPhdDx/PCGbI9f7JLXbRfHpYw+n4MOkPAAUSacBmfv30f/rf+f+8m+GpyPw8Zrhl0IMAmK5KgAOWCY4Ib6r8pO+/hiV/5c/LyyVe6g8TnH5P/3f/q8bwv2zA+TfZ7HtvKbY4ScCOxCU4EaYE04hxb0hOYgEATAJTsGYkP2IQQBocAkkAGMBQcdgA47HA3aMg0cQkhmOGRhEZAMoIpdDhiREQYzXJQBDSQwygFGLdwET2/3c2luLx9fXzjhKk4hs8QTmsd2OAiHkIR4wZmFKxNMRGI7C5xPxt3+Lv+0GvL47/r/fBgBCJpAcYPwVAICbsPsE/v0VSJl49if8+/C/IEMwCIQBcCQLUBeBlOOFi4K5wanyGcgAiPEe5XSApInJsllCQkAVQNFStpTcUjoakxtNZqJIwtIx2XigpUyaG2xSdvPj9/+aPy3zoORuorKVD7OCoZfLxAUgMhegrEBYf1p8x2pYdxUKITVEXIBhewFit21bG0D+HWoQDgJwiERSAF622CFNgpsh5YypHPck4S7YEEcjQQhAsoRj/ixARHiBOVpAhsthNkCKPZwCvNvTB1Ugi7/dnpunr9mQYJjoGGWLOooVUAcDbAWV6CleN9sxJwzOeE/lczgakQ4OkzCNhBuwOwo/n+M+u4Pwsbd4dQLciJefwvR/CLDsgyWVP+SMxx0HgSCe8h7/037CwY7YY1cPeyQzwAxe3j9FeBKSwOf3p7Q7cuQ7d0oYCbPkifvDnqaULNvOhAE0c7p2ACEbTBwIjhCMYIJhAJggWICsMuQTnEdCB7m/7f6rv2XLb2781ITP6bdpSgcrgNhFhTqJChnv9eGosILijKAnCIvlxQsQbwC5AeTfM4IkACdhHtHUlBTxjYSjEYMATxHGEQyQK5GFlZ3daOWsLxgjyiphYAMVJIv9XsIC9xgHg4HIDFBzUxyM5QCUShxBYifDwYSXErlkCkmEkaAcEDFRERUKmCxA0ARMiIN5EHBIcT2JkapPgmVhShHRjZOQU5xExqPw43uNQCOqffp0iEAegDShe9Nz4DUcK6Aa9nmACLylT+ynXYlwC4CbYWLGHoTJzFxj8rTfH8ZnE14pfqP4Ctke0EBoEG0gMJLcK3J2Lx9XIrFz2kjBIhSvpx9NgI6QPgR/B/Qu6YNIo8kHTpYcU0IWcRw+NJ9HIoAjIAroTja/FhWeRIblUoGQHShSZV9J3A7bDSD/jil2xHQgiOTCNJRoToISW9rYsi2tnMZZ7ieHwSINhSJyYyBc7N8J7hmkAS7IAhgFYRRxNGFww2SOEQm5/e2IVZ3AToY3HiEMEfGWtJkIQGRJgfsIEuU1wAzKGUmEM0oHgwMYo3aWJuG4B3IidlNJlQnYFJ/JNMxvfXcUxqNw2AHjJxalgPbpuDAchePOsJsGJAz4Mb7jPx2/zyUAAPsUibbD0+v77nlwvEJ4pfEbHN9o9h20AEnoWcQe5FgvRrIU6wSjCRzNbIRAQBmug9wPcv+A9A66RR4vp7vk7hIyQTc3pckwCjo+C26atIj3r4PhalSIdSBswFeAsAEiojyjRGAgfGQ5LRBRTdjWBpB/F2ic910i9r1oHnQ1vpoml9splFSZ7XkC/AxZ7V5wCAMY4ZviEDMLgByGVEDTYSQkxyji04BnByY49khz8bBEgBkBkP9ucSBaV9+K9DRenxuQLeqC9TnqfZ3AWHJit7IBBmYgHQU8AXkE+AGYRxS5c4AufO6Ap/d4CB14+hA+98Tr74LXskWLeuNV7Y7A5154+knsfI8fw0d/WjIAw+uwG7lLT7T8QscLhb8B/AbxVcI30r6J/E7yReArpReSexhHGEeAVivEIBNrBUWYIP/UlN/o/i53wN3hzHBM5UWCJheY4cwwy0lJOEKi++dTdqUOIS80TuZwv1z3C1FhD4g1KjQ0AFyAoZWovfyhRYq/rQ0g/z4gyZq/IpXTfyYxOqJpYRGZycqODUDuYBoiNS6NmkSDKyOVWqXkAIeIIl1wd1hKyIdPjGNt1EQEeSwR5E8DkgyfzC2lriktSp1y5ylSWyqaQl2xoDaacgHI9h47gFRJ+02R0gNAAiEwABJAHuMPDpOQzcBJSBn4fDK8/MzwFK/l5V34t78ZYHMzCTWYKwXO3Qfw/h349jux0w7/y+7f4HASHEzpaWB64WivML0y41mO7yC+B0DiheR3AN9p9h3CK4QXCi8AX5H4DHJHlWoHlAMUNcl1gPs7MsiELKNzQgaZReS4rwQgR9GYmcQEV3bQkTnZu3Y05fyEI7y8rXujQs2NHdQSiUWKrH0PhoASAwgLxrfnyIiGliKjadu3tQHk32upprGtURN1O2SWRg1hU9QFkUsTptQRo/tNTCU6nKYJYzl8MoQdAJiBk8PlGC1hUmnBqEal0egZakMFbMEHu2OwrgSDIeqMQ9c3NtROdjwyW3SAWdPs2jcuzzeUjj0AmBMTiXSIDnNOhEod8rADcIiGy/ue+M/lL7oRr2+O//9/SS3qHnwZmTuF/Yfwb/9ZSJ7sv3x8p/yZlnZ7s+HVYP9C2t8A+4aBz3A8EfwO4G8k/ybhO8hvAL4B/BvEVwLfALwAeIH4VEJ2h3SE6x3SO+QfpFPQEbIRwo6uSWY7yI9AGgmMyvkIcgA50JjgHEEOFAY6Bk5INJl2BubrjRMuosI5Rdae0EmKXKcJILXHm6sBKaVF/RGurUGzAeRfC5Nexm/MgamOwCgiqADN2qgpoz4EvKS50ahJLXIKkPNlJ7uApTpYLt2Z+LvluKpZcWaN8ro8vkSVgwxHCs9eRnvK7cYAdbQ6ZAC+swSjJYIUHENJ6VVGdI5G2NEjrR5YGjXA23O82vEg/PitSzMNeH4XpgRMI8AM7HNL4xlRnWhZ9t/9D3gaNDz/H//tvzxZGp990Ctov8HSfwbtPwH2G42vAJ8B/Bbb8DfIvpN4AfgC4hniC4AR4gBglJQgOOSfdP0EPcN9kvMIMtFsiHOBEpgGAiZnYsTAiZCJTIASYANMBnmCmQmeIA12QMInjWU0oQGXz40zJEI7LFPkRMhWokKP/SoATw1UI9LUIgI9LQWBceLa1gaQf5dlAHKNwkr9Owk4lu4t5ZBx0XwgCLjXqnzbgdkQyBsaqTRqWhWfAZju5a/WbYzu+ABiStGVzgwQy2T721agdSfDkRkx+CNMc5INenRUss3znZlzJ9tLFJmc8DKuZCIwGGzKSEchjwZPMf9Yu7fjUTiOpVFTXs/uIPvb756ePmT7AwgyARgH8WV0vg6y1+T2Yjb8liz9N0rDd5l9S7TfSuT4n0H7TzT7DeQLYDsAz2B6BflMYF/qi0NpeZeOdE1bBbgTriTCYJYAGKUksv6eKCVQJiiRGkQNoCUQA+GDkBLgAwYlMg0gkkEDMAwpY0xHHc2RwZPGyVh+TwgwPI0Kc9lHSorMRdSpeZi8gqHmUiYsTlK5wLkb4WkDyA0g/6JKpJMYSif7EzO4tC5wqQVaS7GWjRqQIC1mHjG0TraBoAWo9o0aszEaNXUApetk77Ih07HDUEqkpQ1T7r9TwrtN8KlEjCxRbN+oKSMp9HJQ1eiSbI0aMUoHqZQOWDrZ2gF5IMZPlXonbJxg338XRRikJHBH4uX//P/ML0jpGbRXks8mfjOkvxntO5L9zWz4jTb8N0zpPyGlb6Q9C/YK8jst/Q3kd4A7gClCdMb+a8b5xNNNcdaB+DZuVUYFDAMcCcYBsARggDSUKsYAVyIxKvuRRESgwAhwonGQ5QGZOwAThR2TJhsxjsDgUx4+/xs7+rNpngo4AcNpJSos6fHNqLAAbE4xUuY2/+zvvKXZG0D+5SuVs/rMDomzd40ya51IcsASpEIFhJCY4HKk0qxwCKmM4sEFV4z6ZJ+Q0q7UIR1GQ9aEQYZPAs9u+BimBYbXCHIisHNDLiwTw3mjxrpO9pBxdlT27JpMRK1UMaRtk0MJOOwN40e2//SveXg62n50e/6XH3pS4p4Yni3ba5L9C2m/Uek3Mr0AfKHZNzL9C8jfMNg32PAd5DeZ/UZL30R7htmOiXvQ9rUBTVr5cNkiqPa61b3D2qwGoUhLCXII0NOoqCPumHiUcwQ0wG1E0g7EBGCMuiMGug2QBrmPzDiIHAAMoAYyJQMSpGEEh4MVNmUuJZK+cdJHhX2N8hQMLU5W2UpU2IGhuomFuRYJMKul3zWT2dYGkH/n+LFSDlm6hsJkjPGW0pCwfEo5VJthrBGb0TB5xoCumUMAaaYcjmnAYTqU7nZEmQMNDmAsqbFhnXJYj46xDMNlRM0UXce6drLFZSe7giJKpgpUiuPcyXYDhk/x+aenl5++e/7g0+j2bEzfEu03o73S+ULwBbDvNPsbLf2NKX2D2Uu5vIL2HcbfmIZvMPuGZM8wvsDsqTRFDMlIszLmwnlWc65ZtGHyGh/DS4W2lTe8zICnAe4DrKTMZgniyKwjqAGmJNcAq80YT8hIck9wGSkTUjIyRVVYKSJaJINScqTxmBNM2bwUiqUrUWFEhEolRbY5TZZhmSarn4EszRmfh9G9AGpO1kB1WxtA/l0B0k872Q5MKcI18wDI4QhMiWXULiiHaEPlbNxqz3OjRpVewplyyDQuKIf9wWU6jfQ0N2G610sQA6JRM2ruZLNUJU872T3l0MrQuiNqnUcDMsRxorl24/P/7Pv//f/ozyBeYOnV0vDNLP1Gpt9g9g3kE2ivMH6Dpd8wDL8hpW80vsLsGcZXpHJfS68kn2C2gzHBzFCH560Dxu4zmqPIOts0b2ojRLWhYdZ6IDGFj1ZzFDxF+J4S5ImUyd1gTCUFTyQTzJMcieSAXMBRiQGSyaCo/KWjp0xnPVedNk6WtcIZDE+jwqhNFhAsoFgJNW6lLpwMuYIp59Es1Kh1WxtA/r1hMvrOAZCpKNO0up/ZYgh6QTnEspONQuhgNyvMtoPPB39POWx8aUUkN1mkzo16eEI5FImxNGqoITrPIeew6GT3jZqpNmoATCUqHR1042hmuwTuTXjmgO9M9s2Mr6R9o9k3DMN3JPtOS99APsPSC82+I9lvGNJvsPQdZi+MKDHqkSk9wzjAaCyt/Dpu1MqK5Gl42803laICT0QjyvuPOcHCdnJHNGAsmjXuibJSK1WCEF1rIkE00VNoXdAgJgJJ8ZEnSoOSBiolSQNTSiYNhog+RUxrjZOzFPk0KtQ8XF6jQt+xpNlzvVGljlxPoOYqDR6169vaAPLvn2KjU7tx4DCUtFkq2++jHAIGyWFIFyiHgplFo4ZWGjVapxxS2LcBoNJDL42avQw/LEMeZYHcQX0cUGyNGpsbNZRcTjBDu72npxeMLzbaa4omyyuZvtHsN5KvoL0i2SstfUeyfynp8zONLyC/YUi/IdlvTOkVtBeQe5IDzAYYU4sEO3BbhLu12cE5bZ5BspxMvBuuNLaTT2OXKNJsmgFSIpkUnE6L35XgSKIMYoJ8IBlda5bGTulNCxpgliANMB8BO0ApUT6kbImUvX/nQgptnmOMhgxPokIZMaWICltkyXlf6zvcdMHc599PwXDLrjeA/CtX7SgndTxkYQZPLaXRYh4yaIOlxRCMGnfQUmvUNMqhA64TyqELSoKRIYsm4pPAixsOKeOpoxzWRk1QDhMmO8QsZn2Na5TDMr5EIhk5PCENL459Srvn0exvTOk7LX1jslcwvdL4Cto3pBI9WnSckdJvNLZaI81eo76YvpEstcX409FgYddUWUZXC0mcpuZhC5qINPPHu43dvFUB0FrQcxjkA+QDwSRwgJDgSjAOFEYJRzgToKF0vaPLHcdLuc4EMoE0kAOMiWZmE5MdkXiEcYTbpEXjRIz6YB4rGJ5EhZjrln1UOF/O+lEzAHtXm9wCyA0g/8pGDYqSD4r02Th1jRpFo6YBkgtMaKl4pRxmTaVRE3VHcACNsCy4hJQGTIcPjIzmjVI0ZhzCrlAOq7pPTzn0bvRo9FSkttY72RBwHIRjgo0TxidPz8PA55TshUwvNHvlkH4zS39DgF13YYhDmH2LdDkAEuQ3kC8lWnyC2UjaGKjcNVWkReS4TJuxLKrWcSl2qKD+ffeqOZ0ihs/RKI0xhOU0CKkOiUseMmcOA5noPihAb4CYKCaZDYAKmHpEvuIAs5Hyg8xGmI3GNI5HH3cfPn1KftwRXrQsaxe6jwpbp9sjyrWabnfzszqNCl2LSLQ1fFhS+cEi1t3WBpB/9+ixUuhOKYclovREpOM8OmOIiI9cUg5DG/LQmimqrBkGBFbKobyqPtY0PFg2qaMcLnDg5LhIMRY+Uw5rdAtgkNnLgUP6tOF5sv3A9C1Z+s3S8MqUXkh7jXqifceQvsMsmixM30C+wvgK8htSeiH5rTRkvpfbngAOJAmjtWix6zjXmmKNaJvAQz803wPpXFxdnrUUz9X6NewjzWXXO05UMsBGSCNcx4gUbQS0g/sEcgI5wmyEYwS1I5QV23cwTnBOJOu2PYEsINNsGvKQn96P+Zjgb//ZcprYGicBgL6MCCsl9TRF1gyGfVSo0vDRYJGKr4z/bGsDyL8kgmxipyVKi8ZGZUIE5TD4yx3l0NXogbVRQ1oLlAgid5TDFg0VdsxMOZxfR22keO2Ol0ZNTzms0dUow4GOZw9Gt4MmID35sN8d+ZxqpJjSb0zjbxxS7TTXkZzfmNJvsPQadcUWQb7C7HvUIUtaXSLGYJ90tUXyvLi4YIYQ6IByrvXqvKjGC8U2dpVilU+tpuOpfFjugJkRGuW+gyHTLUueg96ECVImmSXlKNsyI2jzU8AzXULcJmSILjED5jRNyZV3U/KXn9nfPvRBufrGyXpUWHjWJ3xqWVAR887K6A9XGz3WcbzNN7GKDSD/Qpis4rlDbdSMNX32og15QjnUFcqhO5g4n/g519tUBqPdc6TSRRuyNnJqJzsJmOgYZI1y6F1cupPhwyYgJ9t5SkTaJeNLYnrhzl4taojfYKk0VNILaS8FAF+R7BtS+h6pdNlGey2/RzptfCK5g1lapMEATnL7lQinn6w/AfhirXAeWhXw8/qZnQBph43tk6c3ewtAA4CnUqrNJF1kjujRIoRXqPqAnGBWwNK9gOZUznnRYyMdNAc9w+B0aH9E/tu/Kr+9+lEzvT5q0bk0V3yuJsRMZKTHbkXG7OQz6wGwB0V2Cj7asusNIP/SGiTqzFmk1VWlJmlGBCLP0l41XSwNnBrZWaEcsnwNHkUwGAsYJsHSCeUQYQDmcOwq5XAyTCaMLYWtaucRNO2VeKQncngelJ5pw0tKqTZXXsg5GsQwfGdKtab4DNoLkn2D2d+i3sgy5M3XEjGGlBhhTXGjfUxcDfRaCl3nWQwz0J1OVGu2mJgbTDYDXzoJx9RHp/GZN8ohu46GEZANkO9Bc8AzaBOoDMKjIMiQOKsgWPkwpIPI7ScoEi4iB5Aym5lrUt7/nqfPQZ6TJssnUWGaxSrWUmSqsLRWokSsRKGN+SRujewNIP8xVqMclpojywFAzLYF9QCt9UMWyqEVyqEtKIcxGM1JrZOd8xEp7Zp1A0lkBaPm3YBnGY6cFplnsXYwN/LZx6fvenrGwG9mwWYpIFi6z/bCxG+gvZYI8ltJoV9gfIbFSA8s7kOzVwD7Uo9LbXrbeAEI+0YLunpi1502Ow8S+yutR8MFcAo6p6csOj5YgCWWQEkQO6iLBJeXDGACmRURY+hE1u3ABDBqlrIR1A7gRNok00TDbsx+fHrD9Pbd8uGbCcLVFPmeqLAHwrO3j3Ppu21tAPn3jyJLSpQ0Uw73uQjjJoKFctgyJPcYncMsLZaYcPTphHLIpk6e5dilAdPxs1EOM4SRhiOEQdEdPaUcgjAmSwlpN5JPNvAbad9Ya4fkK0qUWBoqLzD7VmqPpRljESEanyP9DjsDGF/Aop7DhQrHEhA5lyPmkIjz9M5ippHLuqL6dPvk9xMcpDpFJMxNn/aArs6rOvJTRY2NkGigxgB8ZJBHEDuQE8Bo3AQY7kBWwAwbB3CkcZRzB+IIsylE5tNIYGfExGncPR95PE4+fRimlNF8jf6IqLCnltJLXdznz2VbG0D+3VfrZFfRB5872dGoCSOq44Jy6G2HtmLb2iiH5T5tjLu5HAo0a5TDM7DWMtjyoBymIY27RD6b2XMRh/ge9D/7RvKlpcelpkizVyS8wtIrLH2PWUeWYW97QeJrqHenl7Au6LLeKsWGrhlzFsydjuU02t9y8PviGel2e7Y1d7qm1VyILN+DV0Xuyl2y+DKlAbCR9AFmO8EngCMzR1kBQnEEeJRspDTCtFPSERk7Jkwi9nTPgE/FnWeitMPAPDqm17fJkVxTQvC0L0WF5ReufA5trLOPOisYllFPT8S027jYG0D+hRFk7UnX6mFSiOdWl8PJUjBeOINH72zXLLZoHeT2CuE8mRMMgOUJIFXKYTYVN0Ifnrh/5pBezNIrYw7xpUSKdfzmhbRvAF9h+AZLLzP9j9+Q0jekcjvtOSJIfgP4XCInsAcq8nK9se9anwAie5Ds0+/TGuXiOVdS9v6uNtcYAwwLCFbZotoeVjdyZARgpuwjyD2gieSoKB9kyjKArLBoyCHxWy5uOWZ2zEuLusSGWWB8KXSHAb4/mPBD+v27Phor9EpU2INhBULT/Bm7ET6iSfp6whmne1sbQP5lKXbTdsRMOawuh30kdY/LoVpbZ6Yc1vk+L3ax7jlYN61+WcRzRXyY8zXvxmEYnxKGV6bgPAP2EmISjHojUBkwpdGCOvQdQ93G11DcwbfClnkR8EyzZwCpAZCwmk7fcWa5L2rsgXIBnKdpNpflxh5IF4SbWUC2DlbLrEz1lNCLGmC2j06ZZkNqoa8IYhYYK3VKQTPfvmj4EIGMQax2Mnki8+5Af/7wfNj7wa14KXaZQANC74oTVgBwDBEUH9CJU8yPpUfcSg9bXubtWN0A8q9OtcNhCUlx1OXSlGlJX601VkrfCeXQgRn8aAvKIYvFgmvuZI/DALqCUUMiy/HkRgC7JxueacMrWSLASKVfCLwUEPxeosbCcLHXoqzzjU2CLH6PemM0aEjuEPqHJ5HahaLgSTFiFehqHH62eQU8yfWI8fLZa/X5iE4+7EShe+Z7awQoSF7a3oI89HRi3CdH8E8HmNs2WgYxgdrDFHOVhuICzgnME4H9IOSnT005MWvQlKYKvWWkp6j0TEPRgExdQ6ebHaMDqdIKs5rqz2nJZVsbQP7ljRp0LoFT8WcxlEaNF23Iely7Qna/iUlUvvU55TDm9RS86zRgmt6DEyNvquAC0rNsHDi8KKUXtHlG+4ZQ2SlyZEV2DGVMJwa7X1qjxkKyDAwhW6SWUu/CyuDkzZ+2y09T7AZyXZTG7raODdNG4XtBitOU+xqAXsJmXkEKzlqYsBApDqYTCShSbbMM+QSzHeWThGPpWGcQI2g70CeQR5K7YNRogjiCGgnsREwghpmVo3Fw2+0/NHFPPz7Da91QaaW7XaPJrPaTroUv9ql5Ysdu3w7UDSD/ARo1JUK00smuHO1shOXiKV2sCrIcAzsPmEI5nK5RDov9gjT7ljhE0tLTsHsysxdZegHthWTrQkcEaOHqx0inafY9utB8IdMrUv97F0HGY8e+C3yxccKVSG8BZNbV/dCJTixT7kXz5ioYnozqXIs411g4beZydu/pRTMQJcORKHVIcoK4I3UUORGYRI4gpnafUIkbFaLrE4gjYBOJUcQuuuOaSB5Ndtxljdkx/XiVW52uLN40lmd1cKtakDinIZ6CIRfSaZw52tvaAPKvadQAPeWQjqa6bRKOZhgVZl81nawmXrXmGOm01ZnFmG9slMMyDK04gIOAEY8fPA1DGp4xpG9geo5h79qd5rfSkAnQrCl2cKWDAYMuqmSpSSa+lLnIpwhh1wDn2jYsGttL5e9+5OYEKC81b26B5KXXsjA/6wbDy3fULILMolzRasZR02AEvSlAkVMBvSOAEcQYGj3sxoBahLiDFCNAsB2gwtu2oCiaRkA7unKk2j69f/rEo2T5clS4PA9xtlhozZslGHpRIs+77TjdAPIvhsnwoTEM7kgSDmVqBPKmvFNtEFpXeiYglqeZgbBu9drAqdqQlXKYM4dhGJiGZ6ThG9MQqTLw2mqIQKH/pVdCRZiWryC+weqYj9VI8VsnYPuKiJjGRbh1Jz4uDmNqCZK6kvOuNG/OQPJiyn3ltdWZSz9piplDnfBDWFUUcKwkd6cBGIE6D1l+kkeA8zbDEc49SC8d7glmR7jvC1jGdsOEzBxtlJwJ5HGCf/s3Tp9ppiGupchtTrIAYT84HgrlgO/QLBrax7YVIjeA/MtrkF0SlzyuT12jpkrg991GnVAORcDKrGOl0Dm8MWrC5RBIw2gwjmm3e0EaXsPyFKW22NLpnh/9ihpVlq513IbXIlz7isqeIZ9o3M8E8T5BXQO2C+IRutSn0QozRg8UDnUmc3b6Gshz5K6iwejEMNpAO3UuylsRMpBogHEHVaaMjgj2UDBsGj2RXpo3s8BFNHWmMvw6hdhF5XnT4XTA8tM7nvKLNCUdZyAErPiYz4IVRbNzDMk7txNBI3UfE+fHbGsDyH8YxKw87GzAmJeS/wvKoQNMbJRDVZdDz0iaxXNHFGUeF9xz2j+/7DkML7DU6IEgvoP2CvC5a768wvgbwDnt7uuLxhgIJ56RUhkI53DWjOkaKOuh2uXq7Hz1iv9oHyZWoLKV5s1a9ElejmJ5GuWrWGRrZtAUqbgFolQQrq8h1G1HsIBidKy9ux68a1dwtWdwzIXYlGH0xuUuEmmwlAFOnPLOsk37g46UT5aL9m+JCqN5M4/znEaFvTf2ormDUoPcIsgNIP8hokiiyEfkuVGTo5OtRNh0QjksNgs95dBgOGqmHNYok8k4piGNaffEIYU2YwhEvBZ/6W9zlMiQJwNLBGnfQMQ22jPIb0ypmGgFU4ZRb9xdjgZXLFV5IfVt7L5LIzxYkaY5AUlcS+d5IejklUbOaWNmQVcJ/ndhOHXacUFBdAPoBtoOVqTOqAKMjPEdZybtKPqudLOjgSMbI/G1ifQRxCgxapXhwR12ssQ4HDlOxun9VUesRYX9V2KnJwGe8LUFTw4fHJ62Ls0GkH/xuko5LC6HScCxWTkXymE5SGfKYSqUQzTKoQAmS6Ol4cnSEGM4xm8QX4uvdIkWESk2AijJ2pCxlmaTpcaYwiYhHmv7JiPUj+rwJBLkJYZMB0Z+oeh1rX64FkneYh1eUgVae23dnUktM/MEMBtkRYzYS0Rpc/rPVIRFpKRozIwkByQOoQKkncyOSBopHlWoiNHZxgjwACAFKGIs9d0MsyPkExIzpMnc9uNR+Z3KVDHOxAkrBh3rprxEN4cPOQCxgqI5VBwqt7UB5F8eQVbKocpIT4BhoRy645gGjNVfmlpoQ85DJmod61nFkUZyZ2l8YhpeYYVPXaJFNh41OhC0l07l+3uxO4gh8Jpip3AgLAerLWt8p9YHvCOFxUK/sfeROcNE/YlfxAIQT8d65hdXbW6logvpAOhBpIkRn/iubCZ8SiRlIwyjpFAYN02QTRCiW610hLiDFOmzsBMsQ17qjZhozIJN8LyL+iUUabjnQZaf35Q/XvUZNPK5BinTDIJddOjmjcpawkeYE2lKSNmQctoO0g0g//oUu8magUgufFaXQyxrQ+oyO501GaJjrXAZtKe026dhfMUwvIDptYsOq5rOa6UPkqWDDb5Eio0XgK80fgfTS5Esey2jQK+IjqytR3q4PHR9rdzYOtUn4KhL5lFdmn2JSrhIv3kHOHYAeVKTa7NYrnn+0dTKruEu2LhN85sTUeZ+UmvYBKI6pEwhS6UWaa66Pc50RY08OtlBIqSKOvnMxAndJ+T9IU3TPk+fTz7l8bgAxUVUWJg35gZza2AYF2sSaNvaAPIfDC1nl8PcXA6FUNPyNlAemKBqP9odlobJJ9sPL3sbdt8xDNFpZhn2BkrXGt/mSBKRTgNl3KfYrLINfL8Go4ZhhQDu7qJYPCJ4cDev+s7nuxXFrgnytlopz9N/aT5bEUAimHMrj7S/Ue7DaqpVO9tWJ/stIkSVOmTxD8SsQp5BTbWjXTrWRR4t5iIJTTI7AspwTlDVkfRxEHYvH3b8/PbpP//24Smz2MTaIipM2WCeELfPJYaqi6lSQyU3Js0GkP8gUWQ9GBvlMAG7Y2nUcHY5TPVYlYNIRcNHcDjHYZfM0pMNu1em4RuQvgF4IYpeIxAdaFhEiOQrYK+lKfNalL1fmSK1jm53BUd7KjJlt6PC0/usCVGcguKicX1aT7wkNtEB1K0Zx9XIdm2SWkuwXESf9W/5PPKjlaiVWvjoFM1IIIulNDGRnBRd6bEoHO1ozPI2EjQWDvskaRfzkxoBG2m+A+woaAyQ1L4qmSdhennf+TTiMOSkNFmLFNE1Ymrnmtap02MDxQ0g/wHXrMVYhFClMOwCYS54MlhxOURxOcwusKj/JIHZOI7j/gnD+NpYL80Eq7BegjIY+o1FiKIo8lR71dqMCRuEVLQcgeewL30AHO850IRVIIxSAWbb1VvqPfdEoLzyurjyuk/GgNqoUKcRWcewUJoz9Jmb3eYnuYxKCaSgH2Iq4rpTaL+HwjiJ4GQXaTQVNXJAuejdldS6EAhpcRYtRWk69fJjh/Ew6v3Fj2U4do4KEeImVUVq/QvhSclhWxtA/oURZNOGZIx5mxcwLLWtnIjxEATdefylb9SkYbd7Kt4v6SXmF/FcGDABkORzEY94otkTyKcSMbYLw02w3GbxO7CH2XBTBecRYDytPV7CO115XKvx6f5UfK0Jsxjb6cDx7KEl6gqD8Koc0qjYdQ4ovpvz+ZpOAZMQRgjPBCXWVgpV/gjn1L4PaRWhKFQKoYlMZZzLqRD0cKeihjhm+XGStOPxelTIJpnXAPehesa2NoD8O8BkjUas1CEnq6M/wpGz3L/OFBmQOKQnDOMzhCeATySfQAS4oV7nHrQnxvYKkPvycwZN4xOMzzTW+4wXI8YzrcV7osaTIfCT6FG6cL9rKfc5nK2MDHH9PRjvfOm9M4SKnWy4UM7q5mi2XI1N0/4O+lpkgrAvJkNFOBcOMxQdSQ/JTjljLAGKAcYio1Z/0ilJpEOMmiTcQU6JmJ4n5o8xu6g8fwbF5eK0KYXzkQFtEeQGkP9INci6i6aCG9mAsUnrn1AOBcidwzDuOe6foPwE8Bmw8jOiRViAJsBnEjVafAIQ95nB8gnWRZSw5wBVcE2k9zoonk6F6xzoFpHfnbJkZ2bQddDpWk59X6Tb61JcfHg/62mITlpPOaxeNdWeQZ2orrMMlQcmKhwc90ghmkshy92RKmumMGrkEySnNAEaIeygdJS0AzxHJ5zHYOxwB6RQ/Uk8DoZx0DRNzA4mXYoKtdgHefVr2dYGkH8tWrLrZBeAJBQuh4U1MzqQzEhLe9rwBOkJwhNoBfgUUWMAYWyjngtQ7su2JxBPjIhxD+Kp+FI/wdI+6HEFfR4p3J+msTrpYtwY2VlV4lmjFN5VCL0PHMmVSPNarVKlzGEsNgy589U+oRuiu94MvwofUCKdOxknJAsZNGmibFRSKP84dtGx1g7QEdIEYEdogjBJOsIVohhmpeONEQyfmx0sS8c8UVMnhHceHZ7Ul0UCmyfNBpD/eFFk7WTXRk0Rz7WgHGYL+4RkaWTa7WGpRIn2BHBPtNR5P6fZ2JWO6K7wgvfRNcUeZjuQeyQr221fHPkSfrWj2RcT9Ug4ogduuqNzdNqEIdfvwJO6JK5Ekb14BZfgR2cwbIQyN1ll0Agli3YMPRRGwpU7xHGFidKk0CuZypjPBCiLHt3qiCqPMWBuE6ESbTK3pg6UBTlhnkTfHZWnYXJPJedfqKDXRlPvrU1shoYbQP5DrUWjxkPZJxo1oTnoyTAegUMyaBjsWWnEYPui2B3gZngqPtO7th0FCAMw42K19lhA0Qpg0vaI+44Pz3vwxhjP4x/I1Vrlw6+HNyJHPlBH7SNNI5AtZrl7S9iyrbf3jT5LQBeLwK6QEsE9oMzEo2A7Vt9sY0bmBHkmkVXqklFv9OhsU2WbHJSzno0IIZkAaaDpRaY3TJ9ucNkMiMBS1acGwEmcDb62tQHkXx1BqmvUpFKHPDTKoTAl1mkSM3EH2r6lywX4iC6tZkmnWaLLmGOMNLs1ZSy61i215nOJLtOXQOgWOJ42YLQEPOlK3fIesLr4Oy6o93AdPM/ENFaA1oN2qJo+O8NeFyp9EsyptJe5SYtZRJrHXCQtABNMwLAHsoMUphDlgXtUMkXCS2fdPQDQoj2DuJQPrzPPiYF2FWEnH5h8T/rbqEOmWn/cOjBMiJ+zS/hWhNwA8h8sxe4ph+ooh3Wa91nDSKUn0BrYRW3RajpdfscTWNwEaxMm/GXKOE9cgmfNSifcL5TA7wXEe1LtVXC8kguf1h9P/bFPX9OqVezaS+f1qPEaTbKl1/PraWZZsJB2rNlA0eFkituoMEqbtccK/yk63gS0K6QpaHAieNBOZJfMm64d4YAcromQwz1LyARzKJBjAjDBUAbQ46fRxh25m3TMWT6NMMw0bJW2uWMqFh0bOG4A+Y8Jlc3EK3bQyYB9Lmf03TBEGpyekCLyK9HiC/uZxuIjQ5b7lJlHptLEKVFjzDxiX67vL36XjwDjGUPm/gNt0aC59LgL5cPrjZcr4HitVolrf6uOJ6JjzljURtrrLypFVjjZjjbqQ5TRxdo9T6RgI1xOYBI0gtgh40hpJ8dU5idHACPoY2nYjNGw0RDbWTxtNACFpWMYAe6MnF6AacoH/7Sjq8WJzfyj+alb+betDSD/gaLIGiSx2bzmcsMoJRuG6FqHx/QeQp1ZrHXIaNCgNF/M9rUpQ2tD37sKiESpTQJj0Nh+sSuzNrt4mlqfDHpLK4+/ixlza9ToCqrySgR670fApYDunKYzxnhaYDin2oTHPKOV8aRUHucRFNKYxDQAGEmNiu9lh6yJxhHwSW4jgVHCDtIx5lQ1wRXsHARoAtgXm/QJQBYwkbYbwEnK0xEfbkEuREKCgTAWWKRFOcA2gNwA8h9uFRMvX7gccnSOGNK+RHq7SKWxh7iLg0HRfY665J5QgGMZEI/HcNcAFK2bXZ+TFwGHJ3XBa3XFS2m0n9NjzqJFfaEBczNy5PUI9FdKCD0tEaUeWecdK+HFBPqsGxnzkQZZGbQxQVMZFzKBwgCkndwnShOYJtAnuU9AyjTV2ccJ0qRo0ITIBZSLj01QEUNQPsMQXW6ji/DBzJ+y54Hm7MBQRrgx9jnDNii+AeQ/VgRZlRwr5TA5cEwCmEYwBZhJT3O0aE8kS7OmMGWMzzGAXJkxFg2ZiBqfYfZEoDZnngt4jlebFOgpkV9Io3+VR32j5ngznb4FhsbHQbOfyyzAyPJcKu6SoXbGAnzsZiDLeUIxRM5kwc7xQsFh3pE2KTxpJpBOs6yoPZbh8RjnobsQoz+5FDWn+KrowfVGBjGRFkBpdHLIrwccPwb/zKlojZ7MqVrYr29rA8h/pBX5mpMYSh1yhCUbUpl3tKdCHXwGbE+zfakxPjcWTEodMNY6oz0h8Zm0+b7RvHmOOtVpGZRXE1VV0PA75hUvAKBuWbHeDZzCXfOPi0j4D4gmyeUQfN9EKr6vKCK66lPwWoP00GhsdcrUE4VSAn1PegYti8pw7MOIQxPEDCGLmMpw+B4qTRpoV8QsolZp2JE8hlsiM82OSBjT8Lwz/8xZ05QU6XUCYcUJc2NibwD5D1uDrCuJ6bc87Gcwq6wYhsJOFaGoTZiIEJ9BvsR1vlZzLsaIT+lWl851FPQXbBleAged9DUvpcXSn/8p3RMxPqrecylKvHeUqXc3NBYaYh+SYaZJ1qaNGaDcGY7NlgiiDTGwr0ziKCuRI0LlB9KR4C5Sa2RJRxA7gsX3JgbNy8B51CeNGYk7GDOGNO0nTfspTMSKTBAiDFULcv+2HZobQP4joqUIe9W4DwFbe4Y6Yy3wmSygSQT4mT0jxTaWn61RY71ARTBuYqRnNq3mIynyqUDF2u8rXtX3l2EvRJe90RTvONvwESfFC6/hEkieqpV396vU0LaN8/OEgpu6Jk83azlbnoM0KnMEfQKwD+Xx4q0tZbhCNDcEdZ3QMcCwptUMMI1tU6TXlklGqk1mI48ZyO/5cOizBj74UW1rA8i/WxSplmYPg7E0WIT9TBG0ffhP2x7GPRP3SGkP2B5WWDRmu5kxgx1phWbIXYx9cFd1rXhvSrkGDg/nYV9kwdxMq08Ebe8N0/mYoMWq4O7C0kHLKLcqkPcMG6F0h1WMvkpXuzZ15s+WHNIAZ4jhSjlSawWLxqIG2eYeiX00aJABHEuDLsNKoyaAMaLICp5mu2Q22dtxIgsNkdVJZwPIDSD/QWHSgDSkFNEfuINxT7MdaDskq6M6e7JQDYNPvWNKMzAad4TtQOwa3xqoNMT0JWB8NI3mWp2yalpWa9o7sbM1jHkZ9b4kqvGF2gdPJsd7kKzvuc5F0os1RklcC1cb5mGlES5fpbFTHW87NQ6zEcl3yB4ptWOS5xj1gaLOGJeJqKM+2CG8tUcE72AE609O7THSjsbjmIYj5Idea4PaAHIDyH/ICBI2wHahqMOSInMPS/saHbLOMtZo0orARAx+72gFOIsoBYAAV+OeKEIUD4Kh1sDxFqjpNNqcQ0498jwXwYz3RYf31BxvDoavxKsNEM/rlqTmURmvwGjFilWAF3YNZtpigNMchRYBIIMwyriDa4JppDBA5SdUZlgxgRyg8MsGkOKnxhJRhpd28HkSFD8lDQOYMBWieP06pPVG2rY2gPwLAZID0xApdNrDsGcKYIyOtdWZxT0shWdJ4pw+G4eWRofwRJ193MGwK+A43AuKvxRN9pqPq/Pj/PMaOuSvF9F4DnoXn/I0Cu4iTJKhCVlR1LumjSMUfur8pDSfRBbVAhvoGgAfBA7wAnQqP6kBYgrwU4rvWAlCApliOl2p/NUymEQrKrwGJpMmyiep6vVK2PrYG0D+dWDYFeQ1p4+WjCMtjUgWF9oA4xjgZ9XgaYQVsCMHoPwkRgL19qHwqseiCj4ATOCJOu8jlcNTJsw15syqWvgVHvYlZfJTIy3cEQF+iRXz+G1nJdhe7d0Qw9+Nb118bNgJ1KYaPWJm13hRK2/lhyInTiQYE91NNKNkCoBLpS5DiEbQQFLu1kqJhEVxWzMwtt9BDoNp+jT/OPjSqGxLsjeA/ItCxWkAfIwJm927h0iumTGlAWkYkAL0aBxBG2EcCyAmsl5HEUrFDiw83SpQgHJbjHiMxa41PRoU6FKkeEuxZxVBrmznZdsE3hzVeSCVvicNP7mdVx4X5ly87o1TGzRFeYRC4WHrZHCcMQ95irphY2nyGFLkbOBgIK2oYaQicGyAjMYKoFYiyfgJDfU+BVwHGBOGXfJ0mEArehobOG4A+ffAQi41Wi0BBziOuwQfDGkqFLUJhHGHZDukQhlkAb6oHwXgFQHccmmWoQCLKG67rT52BLhjPP7XyLVfzrhOGjN3p7+88Tt+mT5+Czx5x99r7oY1NWi+NCuCwU1jt+hEOtbl1RbMzBBPA0vKzAJ6YJrBjgXwPLaLA6VB7kOAoyLLqD+BYU7R02jD7pjH4VgkNFone1sbQP6xZS9eEK3uliGMPlnECmQkiB1SKkK3KOM5AXyo3OngU4/dyM6+AiKJuRaJrvZYQZNXmGPSdSy8Gj1ekDKTfg18O8vXuQTY6UX20mP1g+8z8YfNxPA1K9sSPXZVxw4IOxvbM+/sApSmog1ZIshqs7MAyJgcJ5hgSJJGOo6CD6XGOBY7hgG0AEFogDCQHKTSqFFr0ARARkaRICUKw8jBIHn0kTaA3ADyF6PC0+t34UBT6FeR+AM0kLQ0YEi7ovK9Y9QNd4sLuSOxn9PnqsbD9jgQI8wWAEnw60o9a3XDi8PfXALm4ml0OQLVSV5+Zs71B5y57gXpC1Yt7L+8CyB5cUeRgn0IzN40laZoRPBYeuoiAjQbP5qIaNEHuI2UDjAkRmNmiGgSg4SBYhJLFGnZICa6EsTQxJ3rltaiUiE5xAFmyDmMa7VpQm4A+WCK/Idkc4rOJeUNA0amMcAxOtBRY8S+ixR3MIvtZmNLrc0GgANrysSqB9jqlQPjerr5JrsDXGu3XRwKPwFFnYeDelS+rOLkNQXwRdj+i8C49hx1XOfK61sC64qxWKs9ls0dSBKaQdDURYroxn2slzwiYEmUQSpjOrWu6AmA0d0AJXoy0Q1uBriF900YLcDNBI/naPVLkEZzIWE6HsGNib0B5B8YFX6lIkcBYwYSaGZWO9Q90M21ImAgNLRu9HzbSNYuNUMgFYxmjWEHcQcrvtbXIqCLDZcLmo6n97klcnsRhGrNYaWux2vK4Q8yYK7dfmV+kvfc/+SxrWnTK483OmEAYz0zUjOaVnzkqUZmD7gSaR6gFl3qBJcBiapGN9HxNkZDx1TVMQxW5KJsblGrXI+fTAkKVd+tgb0BZPcG/s7voA5Q2OQYLaV5DKcAnjCC6tPkWdKs2ioUx0IBT5T2MDyXbVXt5xnEc6k73QRD3QOO9wLrCtjpUpf3KjCuRYg36H+PjOzcy0rUHRRGnYIkTmwjsBCl6BBxlkqrVUyd2EzMNxlESgrZHclAFRsuWknkQ1ySMe6D2sQJDmupenO5LVL0xGFIPljxscWfGyVsALmta2l2MgJmI20oplpVrYcBbGG+9QyEYo9gz6xKPuQLwBfAXsr9Q9ACKD419sx4vuER0NaltHuOYG7XKq+A5EMp96Wi4C997idAJ6yn7F9J17lSp23beSKHdgKcpuUMJbCsSc7fA+GWSJnkBi+D34YEZyJkmoEwle//jDnTmjRAbeiUcR8bOOwM8jAP29YGkH8JPgoY05CQdk+0IaTLtJAvewaKbmOA5p5W1Xj4VMy1omFjnJXBg01T2DYcFuhSDzZeBrbFMf4IFXAVYR8tcXwBCPkFIHs0erw3vV7ch3NTB7boSuuEU77obosnNcyz8wVb53nuQg8dGI5lznEGR2ko87ED5P32erFGPwQGmiVNPgnaypAbQP5lywDbFwHbJ0j7rimzbyl1a9hUr+syMA6OIV6BodALB7BrzLDOx50cuZcGtE/51l8uHOhO1HxQoeLB2uHN7V9t6twKaO00NT4X0uBC/af8Ts5Ne52re/cKPyUljrEdMIGNUhiRYwVQ1rlJWLGGteiEy0p3qBhzK81VH4cEunubpNrWBpB/fs2x1sRn/2VDSkEFlAojJlgysZPTQCaalaYNE2gh+wwayaCRkWUouLgvRWXKVg9jPhjp3dJxvJom8wFQvXHbvdasX603XhCiWE3L7wFldrYUXAHW03lNzEDZmuF9CHmqOVlmuCkyOtp1XKcMjKr8XHzdbShTi9NhdCPLrJkXnrhhom/1xw0g/xQoLPtVB4ZsvvJRfspAolk545ezeJjKtR29zqhJhBnLfYNeRrGMZ3B+DIJjrQKY/Bpj5o8f7tAV7NXt9NpOo7A/MJ0mb9+NvBtYr95+OrzOlQ+9NHfOt+NUBINoTyMJjIFa95i3JCGSgYrtxCyYAe5xCoV1NWUS8jKWK8BlFGgubVXIDSB/JSyctbhXgFAUvOxh6lhoMXRBErQQFKgRISsoVtCLCFFIhWdbo8WhCBeMUTdSAi0Vb5lyPz02p3Ft0Plsu9aBULeB8XrN8YKT4iPp8D3p9DVg5BfHh8g7ouprn/MMknM0WbnoPI9mibC89Fbu5Dw42g2kspyxFyk1SroNwj24CiqD6xIJYcj4k60zNoD8326KjCUYegHDyhI79XCqwNiuG81gg1TmG9l3EzH0Iz8QhmL6XpV5BoEDIzVPqCl4KbwTLFqAN470K6Hi8qYbPtdn2++tN57pg11Opx+NGB+sL/KR57p3jrSf1TxLtbl8rtNJgf57WB/SVzG/nOV2GkUHlPt8ShYgiY3DqFhF7LFPe+IOwxA6P0cD8nFLszeAvJYir0eFqiUbroBff8x3B5PIJmYwZJjYgGyUOHKuPRZJMo6k1WHwrkPJgf2wONBJoDVhitvptc4P8NU5yNUBcF4AO8xNilMwuUgb5IoSz+m2B6M6PQBsuNF3+cqUEU8+5C+m6GcBec+o0QnALd/n7DfLk+InSRpNDkIl3fYyLG5R1yYH2n4H7HdhR7utDSAjQ12PCtu5+VJUuJDbZwFPzqDYgSMgmhfmy6z8XJkzvTx+6jrTPasmGjhWbouIMYEYCKujGnb3kXcPg+ZWqtiGn3GiIM4rEavujE7u6SzrHHAeALaH8O+ujjgvn4luTBEsyjenJ63ZZpYldSak+GmVHWOxzRHy5aDRRLkZVIbHi2aajISMoUOJMmAOg5HcDxS5dbE3gIx1HJcp8mlxmheiQnRAqH57N6ZBAKmoSJvLQvCspdKJxjTLWC3GdEpUiQSL+iNtTqeL1NUQ4MiQ14/n5FVQPEv3tLR17g/GPqpbOYjPUsirh5TuRCWtp6fXRn7uif5Wosi7qYRfHiBf4VaudbYXpmOYudv9/qTF37NyojR6EG+KmTUZ0kAsjyNoRnoR5ymm1yajF+YNW/sw6pIpmaaJG9dwA8h5t+VJinwSlaxFhOJJSFBEpM0FK/oDptn8aKKQHBYAaKns5DHH2BTBm0J4iRyt/R56joWvzSJYYZzT686p8CwK5LVj90KD4ZKd66Vo8lFfmVtAdJVeyMfCwXsbMw9NJz0CIPfRLBdNlr5hc16LtK4OWZy2C32QNBiIXFzDWFNoI1yRSjsMFg1Bqj4WRiKBljrtoW1tANkD5bWocN7RKcA8GomnQMgTycIWLAikONCsT5lDXKLWGFvKXRR4qPn2XsgCqhYLJaLkWNRZ/rjT/urICW/PP+pe2s0VsLiHT303mF3zkuHjdcIvf8KXBukxa1+e1mD7z9JOuYow0AymBIGwAoSOUPThDHwwhTQakYSSkgtGIUGWGIrk/aiZxQGwoeQGkADyMNxMkXsgbNRZ4YxxIK6DTXIlkDtBA6WhjeXM4DgCGJt0mTQuQJClo92zZsCui91Jml0DKd4ZMX7l2OdKREqe1wm/0rj4EhXxzsfoDpDmpajwkVoq7wRPXa5Hxv5pkKWoM2IeFu91Ho0JXsbGWHxoiKo8Ps/gAjXKjG2EGcyU86Z5tgFkLLdo+FEFDNEBoS5HhdeODXV1S/OJgAXIteaMauQ3G2+BdXsFvXkUqHa40XFv5/pjHBiXAO6s06uLL5h9HXIBdDitgy2FFewKcNyTxv5BPOqz90RexMA/Bowvdfj5hcc/9Ak08kDQCWmwwqxRFwkGOLL9nEE0tVTd0bTtY04SxLSN+WwAWdbT8Twq7Hdd8fZxeP1go4E2AJYgjFKbf0yd5mPqQHFu0MxjPgvQnB/TUnTe9QJ1JeO7dbgu5pD14AdxAzOkP/6AvJZeX3xdj6TVp/Oc94Kj7svAL/9ZFuZURH8qHOsZFFmHvsvJrvpWnEvhVtXezuZVBhzp3AByA8go7+jBqPCBIEcAYSmBqZgkoShCl2gxmi61ez2Uxk0vPNHVK2v90cYSPVbHwvRYoKIl6i/k9blus3Dtg5BWZiVX/rBuRGePguRaNLvaqeb1RtXNCPfRbvUDe8c1kY+T5vb8aTbB21rADAa2Y/4ioxvOLpVe/7wXX3yVIaLlTTN3A8gvR4VXoKAOkTvisiMY9aLqIseRxgp01dq1gKLNzZdeJTy8sUvE2SLHoUuV+Hj6ttJ51pXHPDIzeZaW4yaQPYota4rjIq+PJf5qTfOPqH8uPi9bfkDsPzeenzSk5dxEhIg1mmQbEq9CAIboXMeJKWYd1aXntTZZapJSMYkQaLOq77b+2QHyUTCsd6+kLqEMl+O81O6CJXBUrTHS0gx0HNFqiJyFTsnOxlPWakPzdjuPDPRARrfWkOHSJfAMYO7kG6/1Gppg7B0D6GvVQi6UkC5yp+8Gx2sR62ogrMeemFfS7TUOum7UPU6mCBimg31qXT4dUqYY41EXPc71x46euGDicI5LCZqBoHKeNnTbAPL+qFAnoLh22NTj2CTICIrE1DyNizhplSsDQJiExFm6qqn7FJv5viBfo0VbKPl8hRN3j0DFPbKNq7YC10B2BZTWbBZOwfFugDulOGKdHdlTIi+Bl+6oT34Jmb9Yt7l8X56dmYoMRciZuYAOMpuquc+WOL04iMXsubtv6LYB5BIHBCBzmSpfih+s7VMsx7Ha9O5hHLH7PMIMJlZA88Q4PacuEizyZEyFDdFGNQTYkqfdUqOTbXdENLoNkjc72NeA9e763BdrjJcaLpcYPmtR4d0iu3du/MPTdD12xz7gLkXI9rpcVRCX89kr2DSEF7k5XiiJOpMl2++f8wZvG0DiwPuiwqYt1YFhm4sIBYD2oB/jC/afR+Pk0b1m6DRKlbFQ5xlhbGl3qz+WGqSlpbshRzCUxFl52v1efrXWt5L7drOLPB3z+VLEswaouCNqvAaMV8DxV0aD+IvRIHm5pnpt21dwUme/Fi72EiVrs3px0psp3IRbFH1IwJqlrOYsoLowpqZfsa0NIJG7E2kfFTatUVRAzFHJlhpAzjvtfDCYVIWaDY4EFukyVNWdWaWH4A7V55rdIDg4kph9sVGvY8fZ7XBYrQmsAcDpAX1Bv1H3pOE9uko3gOYXOtO883638OxeaiAfiHLXOvlfiW4vPXYxd7oMgVnGcjo6Q1ghigyd8bIne7FwDXL36Q67/GvdmE8VDMKWYm8ACQCJpylyiQyltl/VfUtLg86L2LH/PNBypQpyrBauNNsBCN8Zsxn8gF340mBPYA8rBlzEvt2/XcceAay8O51ezEKuN1x0K6I5HeW5ysZZYc18RYX7RmPmLNW8P2e+oXN2B1heGsDnF+rBa6UA6kQhafESy47JdTk6dc2Y5rsQE0FyoRfJbT/bexDhkvKWYW8ACWDHY4sKy+n0fjA8jagAOA1Pb5+jkPYweyqgtouLdqAVUNSumHPtYWHa1UWHBTzbTGQqqfUsiXb+p3EzT66jPLpR/bo1C4k7WTtfSalv1R1X73sniN2FXbz/5hO5u19aC7C7cPJZloytT3xQxyCFogXZCeqqbicj2jx5N2xpE2snG1sXewPISIn95NDnHQWibla3tmbUthHwofKrq64j4/cdemZMa7hYKIWH7Fk1dK/d6jR3wUHQbrdpz7rJt7UJL+LqqljFhbGgPxg077ZD+EPAsRmAX3+AVj7TSxMBX0fL5d9YNsy4SAeqsk+Z/xG7HZlGmLMIWbCNCVVVn8rL6XdgiUyJrfa0rX9ugLwnKqyKugsgXMPMODCsqPDOIraVI1tNucjEBnizswhqx7tuJQkjgyXGfrznygtYi8wYrnUV1E4aCGemh6fNnUuKPmu/X/0cb0WCvI1n/IWvc7XWqMdS6z9zXfp8z8evoj8YquBVAr9IniHEcOmEifQQk2qRI0m6OH/tZKMq1hkgS3bUBpAbQK4dOeJ5VHjxroxR7sL+EoHkIkWr6Uox5uIcAVZV6AKYpBGsoz7N9rUOlbPnZkc0ao+hRnnRlRxxqi94r+nUQxHiHSn4nZj5kMTZ3f7W/PPB8F7q5EWlcb/6RkPbWTXUbj41JZCs8va92s/SETMAc75NRUKNSjAzsw0gN4AEil8WT/jJK5hZTszhT3MlvpEPQNsxh9nUvamGJ4KpU+cJebPmca2hVwwXMYRgbk3NT10L7ykJ4Ob4SK1irT7naqNGjxUF76xD8lfS1EugxDsB/HbH506Au6d+eSGj5ok82pmKSnUshAXf2sIopPqlCwZ4YV3V7QrFHyBhJiWksu/V/bPN6BJIiXMLfFv/zBGk22pUWCNC8Xqoo05SyzwTk1LImFnQC10JVpwIyQHSKGKg2PxoNDsczp1vFWEKYWw+NPPA+OMBcg9w0nWsWHMrvGrt+ovRxq1o6+8WzDyozMNTEMPFsaKeP64awbMpRMzbVofyT9TGVeTJWKiq3tLrsAaGJdDjpAwZScqQiklXCnJse5FF+kzsMpxC5trWPz1AeloqiF88dDh7setCWsmMZMIoFFuEohAuYmR0pkvDxsIywZpi+FjmHMcmacbF3GQ19Upf1hpcUwk/w6EiknVmWK91Tve90dZpFHTP4PZXx2UeCvluhXRrz3+RmnM9Ib7y++WXd6kmiSpO0UWDpc7YG7abAgtZOoq0SN2tRJ3ejQN1zSe5/lCB+g0g/0MHkHYeFTb/64f8i5ico2wItR40t8KRVbexeV1rDMmz4o+96GxjBsTwu65GX8MsWVP3ZrsJemcH1+nBfNKNXoBk+1M8twZYmkrcD9r3sGp+ZWD8y3NB9848Pj46JF0GHOmKZ40uRKuVPCNCQYid3dfqV7XouGmefGDYxrJeiRfnZUaoDEIKWZuazwaQAGRcgOJXFiWkyQdkjS2VXgjhdhcV/nWzcsWsCr6sVyY2znb5yXs7rTeYHbr1qD461B0NnBuva9EMwtd1H/jAjOKXc3R+3ZPrSpAprZ1QrnwYZ/Jz5xlAU7qdwbDTV5EroNJBeCGUFnkBOtpj58fEdUqkMnxDyA0gC0A+CIarx9Qhl0J4a7DM4MYGfkvAi/GfVFKg0rjp71drRqj374I3XbVhvr3tRm2xDZX/icfJWnPmq6K6X8mwLz7HtRT8yoe+ep7glRrnLbDvgHQ5dtPoL6IVcJMHJs5A18bIPdKOyLBNwYf1yBZK7LiY9fKA0G1tAPkYEK6AjaQoZwtUdqNZmVMMYCRP/ENYZcpi7ILhIpfa0DiUoBjtERkD5EAq3iI3lLmvHP2L8Z4HdB1PZ/CEO8ED66rdX60xfukxl17PtaBXD551eAEd/6D5yiage8auEYxOD8LgLGWG6heLMuRaxAHiu6dFbAkxvA1rfbkSyIwCo7W9rQ0gr4Ph6X4uzYopXUOYkBmQZEWZp3aohehYg0Mx6Jq71IV6qHAzLE0dVvrhrt2XqmwcnqdmvP6ia71SVw74K6r/NzFHVw78O2uHD2XFd4/x3F95uIbv94ejK9+Fvo6JF6PJWXNzKT61vNYjnpbbOz4tIYii0ZVLHRJFCy2I2FsMuQHkBXAsALgAwwXIsDPOJDD5oBCcGKHCsxYHUDGmEw2bHRoQYoxokWnuWvdpOVhqk0Nzp2slpu6o46zAcl/080gKvlK7/MU0+tJLeIhSeEkJ/I8Aopugtian/EAn/JGywZlljU7UfSpItp99XdEhOUOYJzTGQcHhkBykg/BIyymaMkSX3CHP0M2hjm3900SQfh4VLk++TWm5sGYsrrNofrvMjrl4zqgyYJoPMecmTKUZ2syWQSKZYDSYRb3RYqCcjVVTa5RXOrvU3Zh4KVLUtcaO/mDQ6UDhvDFzi5r4R7sfXgLGW2NMt8YGTk5e7GuJuuN0sVbWaFe8NVoIDyJpAT15Ab8KkswQPBo0AY4MSy8XrQBmbexQ8vi52XZtABm73NSFhyWLlYWoaBsaZ9fpLjtq7f2Zy5jdJBqNQ6EEhgCFWYBfAGKwaKzUG60waqqALjqmDdmeo/jXnKo3rId7l2qEPHEt/DNt4R8Yy7kYOf4ZPtlr970YMfL8hgVWfkWk4/og+fl31mcK3UmbnKNHwaFIjVnEywCbz/i19lhri8FOjG3mdQBIceYPnxBCFElY2tBtA0hAA5dRYZWw73ZslsEIkxfR3Dk1H4/ZPCPNEV9REDdLsOJIWMd2mnpPsX61JmjRHAvZ0xKtWTA8UFC748B9NG3mFzLIlVnGi6rgizHDP7E9cFfPhdcdHk8/mBrxrvgG19nHanFwxqY5+6iW85Y6He5fUnYCAJtu5On303X01LFkmoFXgceS6TSHQ0shZDEMG7ptAAnk3XBWj6Q7rIBgD4YrxwddiLTainyZMQFWALPUGclEa4yH1HnP9I6GBhYvGslmjZ8yyc47wFEXNuoLNcVrA8w3QeNPSodvFjEfuvH6+76HT306m7j4CHgGlGvguZpWN5nGc0AlyXK9eln3dq48uZw6Gp46YgZQxnhQsfqSYJTn6c/MMzaA/I+yzL2BYAXEi4d+BUvNdi4MSleCGZGSlf26SpOxjfbADLQibmZF4ac4fs3PVpV/ak5vV6zfrwDjg/7WX6kl6ko6eepw2PHVV7FngREX5NOuzUBeba58QXziUvR8IRXnH6L9+Gi9YAmG0upkeedSLM0/1f+eQTgc0bmWe9bkRz9s4LgBJDBMvgqEqNFjtzuKgFI0ZzwRzMJwFGXNuJ3hXMim5QgjaVX+DAajFVwttcnZxpWzrWvXwb5w1FxNlS+RrU9mGr0eSbrjWDxt2PDOKOtGtHaNYXPL+6XXS7yKhV+YublBtebf2dRqEXESKjaGcSEcKqZJUgE9eeEhZoV2Wq6/g20UPDMaOJqfR06XzLZJyA0g16LCCoala+1V79FWSnBGkyE1KalZt7E2WWIQPDKZ2qFOMzCWbjaaDuRyW7BoLqerp34li1rUyTykLoAkihL12X1XuqlnSHEqvou7vF5KRe48FD0zqlrDuC+6BT4KiLgs/vvXCjm0dnjpSiNDyCRdXoASZZyn3E5Et1qUR+OGFUgFg+hwGRyCi5JMGLYmzQaQsbsJSCFt5la71idgWDvWJSmJpo2DjgTHrBzulWddtqnxsZv4RPzUiFD8GcLQCyOBHVS8a6CxGHqlS+DYWXqeBHo9YPIc4NZEc9GJVKxg4GVOMK9ni8Kyr3B3VFnPUmvOgCcozF8MY3mlhoq/Nmq88AF5ix5Jh6uY0eCEl12iwlJX1GJESJWTXW5D7YoLDplxS683gIw1PdnZuRmO0qRpu9GZcTZJ45SHxpqpA+DCDqoApzDoUpEuqw6Gdai8SpyRO5jV7btuqJxtwucKW0+6lnrzel2yA7MFSN6Vyt9Rs1yJKolbKuG8An4XwPFXxn0Wf/NaevsPkvOwgOL8ZblqxNgAsESKrdZYLl6hsNYiG4hW+HRgA8gNIMuyTt+kgeGlslV/3TXAa8SHoA5WjUez6kg4CtzNWpDYlVnHIYCzsmwwRByLENlVEca90qOYfy8Ubd0ztHwFxNaz4a+B4yob8E7zrlVWyVdMsW4p5VyLcpdpfnzW1040f2cAVQXBGk0uBI57hk2fKFVQVJ8WqEalNS1nliH9uSIlG0D+BwLIw4V9fKV7qTIjScDsU4OEwrFuQrdBIZRi7AelPknFthiwTC0F78cupNLcOTHl6pBxrWcxzwI/AGjSdcuFtZrlnRxo4lFJssvAdFY6uPakq32Yex0KT3FVN17jX5thY71bXSPFHiAdkAvKi/ucAmywbkJ6xSUdPzd03ADyQgbaWS+0znWvE0GAWUxZqUmYVfMttmZNdZAraj5tdIctWLE2lF7+ryOPDYV5T6S0ihu6JFfzgHzZmar4bYxo9gFNE4G3Azud1DfuPTRPRojuxq4HS5ZcZcTcW9/kymvm+kjT/ZWLXtOxASJJV4seC2smrCyjBVc711oAqkhIEEhTONeEqt7GpNkAcg4+yNnW+oa5VN3FZXUEh8V/2KqBfMhH22JbBURidjhsQEhyHuSdx35mhmFpTlzPovs0esXLpAeUX6UbCqtU5dP65UWgXO1IzyW2i5YHa6B4ExzvFLa45Fe2qgauO2qla5kIV/je95zxzj6HCoTxzITgJbKMlGJu2BTAZFE4mzUi6/6nOssbFgyWaC/fsXGxN4AEAORhvTOpAmxVtb6Zc5FIx0N/pHGOJGcv64UWZBGdYGXNWFUUX3Cwa0pe+dxnB+Tj/RLhTyNDXO35PKD/eM94zb12rldT+A7R7xkf5Z0fwrXONtd8ePQ1YDx/iVzJCrrh8YrGoRYpNJvXer/Um71LKrNsAty3GuQGkCtgeGLepc6wqqMsIOUc9UMVIy0plfQ6LFzFkVzImI0hfMulCVf1p0Hrco/F9vVB58Lbhlz3HXwnXexbPlX31h5PRR74SO6LFVWha6LAN/723X+aVyLHa4B/h7/u2gd699mvKegu+dWz2+HyzlqJn7VA1tK1DkVy5UnyjI1luAFkiSCHhZxir+NiVcG+bScsHxOFQUxhzmWMBg05NqtXY2ynjZ1d6wD2ornVpIvVqKuyZ9KXHP1upmZ/wD5/BShVHOlPr68Cxa2Gyj0WOLwRYd4Lwv0A/NX0erVDhou2C3fVQ0+sFO4CyVY+7LQgq9CtuvGdnlqIbvynXTKADMil+AnPDmaBxy3F3gByXuatldzA8HTyo2mgOA2OAMcqU2YYGghajR41G3KxRpJVvWc25wqFn6oPaamfRr7lVKC7rBF+ATR1AZUu1etuiWjw2vNfaQRdA527mjT3AKge17ZY6+4/7AqxpkPKi1+I1M0uFoADCl2QhU4YIz25aD2WrjVDIDfmHHOhFQqkk3A4Y5Yynn9bG0DGGl0LMKwsOy/FbHG+mDuHrEEqijxmiUXDMWiEmPUeOdcbuRDJpVWNSLYOeDP3Cmner568V0HyJDzWSqSyBpT3AOwvWRXgPGy/9MRnKTrP8/9HP7Rbc673ft6/XN956ENXAFvpYFfuC+BBNSwjO0AuXe4MZ24CFV7AUl0nXLEKrDozvXIUtrUBJICiNlophuyzHi2yGicBVxOZYDRkAtwC9NhGdyoQVlfCyr+e5x+LU6FCO7JSEzmrq50yZVaZMxfrdHfWLO+OLrl+261ZSF5Lp7+wbS3l5bUX9PUD/SKD5lpK/+hJozfbuvn9UXFqK5FhAFzhxhRlcK/pNWfjrn4+cp4pnS0aamqefaXTvq1/aoCcxhUwRG3YpKYs7pbw/O9vJkcqQ91prh0yNdtWIYGyMjgeArhAgntEmVbuAyWhCO2q528vpHqv49rdncYb4HnLoEuXcYf4RRvWR2urWukc64Fojn/Sa730XGs1kdNm0lod9MJ3q8aG6QAOHVGQlYKoZYtG1air/ITUWjas/pwSubVnNoA83elood5DK9dt7mq3QmVEj8xuIge4AhSNEQUCBlNv1Tor/Aizko8asNaa5BD1TMRjtHKQ3Eu/u1cX8lqAtsrHvvYUus2e+fIXc6mm6RdA8o/A5Dv9cPilJ7+vPnHxxNc1XNTnNn2jpt5NfnZ78bDpeKnqTbw8IeeKrAReN3zbAPK4f17OPCJGeSw7UnaknJGmHDHl5ElQbbQEGNbmTHSyB6KCXlwEVMAs9ymKPlG/HNs8pJgekoshz4Vp7wHD01T8zwgX/ki8PIu0LoS1d81T/kGvlV8BxItpwFKeTteUiWs6XJ5IRf9xaQMroNYdUW+fa44sgOheFYEESSSzAGXiLo3mbf0TRZBpygGIU0bKcd2yN53IMh9JuEZZkSkjB0ZKPDQPmRi+XUaJqBJo9fZmuVAFKazjZl8cX1mrP9JOJc/0ZcDTFx94V/T4q0fbaf2SvAGOXwPGu2qOvFAGeMhojJdnO9ttJyZfVTGcFOSzOk/cEh1rMFwN4wWFhSuQQTojN3e4qud1GfOBE8hyd/Pso4JUswHkBpAAgO//9XfQQ0GqORcWwdxc0m2RGPKUMJWxHfWeMq12WFJpW6TXxblw3lYEdTtzruZbczP6wGXxmzYhYl1StSaa+1X5skejPq78fknz4dG5x7UH6aSW92DOzWszVbzzS3gkqlwTO16tvS46hl2HujZelAlkkRnS1EZ9oAyyiudOAiZIE8AM+YT4/SjpCPcJ0zTR5WmDxg0gT5enqEF6cTaUnbFqOExT1BFDFDeRNszq4JzBLrrSQwd6qabfkUJzjjgDHOuw+Fm4yFu83e7IimboykjPpZy1YUh5vPqaol2sNfaRJq8XJ5cv/StjRLhQsjtr62NF8fw+pfObUeMtcPy1guf8Xio/+vR9zL8L0gQhLsAE6AjgWMEO0BHSJ6BPCAdIB7gfJB0W24RPAAep3N/9U56Pmw7kBpBn6/N5V8Z6Ouvp6iBXJiaSaMhIcnXWrR0DRphTbHbWC5I1a9e5822ts02VIfGiAHTxOOSN/PESV/tC6NYrj2vpvXzRAqcDR+JP8q2+67n460/+iGXtrzZ/bllE9Ldbdz+enJ0CAD/ni39C+IR0EPAZQKcDgOMMhDoIOEA6QjjGNi9A6cfYrsmPH0cKXns3y5Lmtv7pI0ieNv1avhoTteMEQ5ZBSOGuXmYbGyMmhCoC+MxiqpJW9Mti7CfMvGqqXeXMbP6dC/y6HwC0PPZ0MvG+Kvx4uwN+Sh3s7yNqFThXwXM1urtEmH5Ad5G8DwH5YFr95b955+23yhur340yoINchwKUBziOkI4Cjg0AI4KcCosmrkeEeQQ0xQUZqCm3H5F9gmtyuf6hdC83gPxHya+nJdB0sSSL6i2nCXKVKI8sAtPs6ooGyESLMdvCnAn716Z3ZiFs1plzwdgcEBe7Ja8Firfz1DVRh0td7K6Lekmu7OxPLWjTN1Ju3vGaz6hM/ZnrEhCtjUDdoP3xVs1xBVx5AzBugaIe9ONZ/biUpVJDjPQ6n4BhLtzqqQDjcVl3RI0gSyqOCcIBjklTPiq7B3izjKJzyRHf1j93BBm7fyphXS/qbaBPpI6mascKVS51ifysPICh6GOFXNhRChu1cGbYVMphUBOvna7/iP1UuANwq9/TnxlFXJqvXKM96vbnwQs58BprZzERsMK86V8L+cd+Cfc2xtbv5129sUSBOqIBZr1eAbBFluU6Jni77xTCFIhmDe0IV+Y06E8tjWwA+R/5DewaLC4Py6IFQBBmiUkGs6glwlIBvQRjpNxxfYDZwFJr7JoxVawilH5Y1H/QzL7srvTwLBOdN8z9in7kh3MkpjVgPBe3OB8Uv8D+uLc+95UaHq+lsHdIgvfOiLiXOscLAPzFyLHVFXnh9fFyTXK5vUSGNRrUsVi7TiLL9ZY+RxcbFp1qVb9sOMQM2kQoKyLO2gnPs5Yf54SHG0JuAAmUjq1m/v6CgABQMMgGmIZIk+sMYxhxhVgFxhn0GLeBxaWQI2A7Ll0NRwgjDDuBA8+Q5AaqrPKku0ZNa750Q8jU8qkXIz9d46YdLbqetp4Fg3/Pxs2tz+ce1L6Rkv8KdfHa/fq51btAUiWCRIztCA4pg3AKLiKAkJyNtyr4sSn/eB0sb4o9ksuzABN3dr1EvK1/4hRbhw4QV+gYk3bhXsgKbvsW+Tl2gu9oFo6FYe+6EzAGS6YAIYsd7GzutWuD5JLNDgR6DGS0fgTyNMjsGzYtEjw14ekroBfGxq+U+/5UyuEquGkh6r4uxssruHnFW/tekYq7rWk4s/vOhgp4rbutEiF2M5DwOuuodjZvdciq8uMtNZcyXBOEEjnWGiYmuB/L/TZg3ADynmii832lwImGSaEEHkA3NPdCFf40rQJgGfvRQHIsjJo2ChSUQwxFQbyojyOtkwt5O5o5HwX5wwqUuizLvdJE4e0I8tLg+MMv9RI3vYt8r7m96s/1uOYVcA2QrDXOcu/bMk25gV/Vd4wGTC51xwx5BceoOTqOqg0cV03LJ6l0wFVS8ZyPcB1Xm39bdr0B5LwzOLBmMwAQ8koJ7PjVTSh3gCGxCU8ggRqIVBV+hqb4Y8WPJlg0s1iunU5kn5hA8cGj80QBTCHPdn6nvra2oMmpzULqFBG1gjx6QBrrHpB8uD/EyyDOL6TYpzXCO6LHBeDeaMbEzY+MXilDiFGeiPxqB/ooV5lrxBHAAW1YHLEtRoLiAh2IyprBAfADPB9KpLkB4gaQ144xLVTsZ784gblZI6SZBYNZARyc5x2jITOL387zjbNj4Rny8TKN95Fh5j6i7A5A1oSbV+TOzM6HxtdA5M+wbBBuj0BeVde5p9N9y5EQWHSuLzFneB4RXkHBGyB5T8hfZhmhI6WD6vA3yhwkcADL8HcbDkdcJw4ga9c7AJM8wOwT1AHOg1zThowbQN4+Zo9+pmxTsILR3yMQBl02k51bRmkhhCJBFBT+muxTvarAZ12bmTBoFsa9O4q5lXp2L77ZxBKPmRt2jBpdYuA8gOSr7JtLwPhQLru2gV3aryvnlNPz1Bci9lvfw33FyUv1R5V5x0MBwwnEAWAZCMeR0FHAAeBnA8w6FK4aXepQR4BU0233I7IfQ/FnWxtA3lrela8SIYtJR5tITAC85pHNpIlN1eLU0zqGOsKooabS89xk6lR76vULGKjHQfJXapEXvLLnuchr4eMXClhflR27aMTFk4hSq0pIt/8Q74oeH4rsV0C0Rp/qJwn6OmTImB1r9Cfw2FEDD5COoo7I/Sxk/BS81h5z2+YFGKUM9ymix21tAHnHmp5tNtEsO6iMGKaWFs8WCbX2uFDgYQKtn28cFiZdYacwLoBxlkI7H3r80qjJuhdNSP2t1yhX5yEbuGAxF4k+ab/kRHiFw/046OHBjrG+9rn17+dGzZH8ol/3F3fLuaGiaKaoRoCaShMmQBMdtXBmzFQ+dtQdm6iFPkE/gnRcqoX+qUKhG0D+x0uxGxIYNBAaEmzK4O/HBC+qPNXHGp3mo5V65Oxa2AlVWCqPi+ZObdY0cV2kk+r+18HxztrX5XR6pTOs00YOznnZJy94bcxHXS0U96bY10SLeC+6PoDEQjfMfQFD/whwPPluVuuQsTHP7BgdJU2AH1rq3FJobw2bkl4fCnDOQhVz5/oQXG4/UDqSRR1yA8MNIG9m2P/yBCUL9xgLkLTfD8Z8nO0QwKrzWGTNMIamY4sYUxHQ7VkzKTyx63gPYjyIHGkc54mTC/WwK/XBy+BymiqfRJFroSR5/lwL1sytdvP8vIKfgKQW/7OPNM+e9nQuU3cOfK+NIC0fG091Wk/l8iRB/lpq/YVT8wUgnapkWSjx1NpidKhVa40hThE1ygqkrgPcPwF8tqaNynX3A7IfJc/96OO2NoC8DpAvI+gCJgc/DrBDRvr0iBrnwe5xjiKDNUOWuciwTRhZwK88prJoBiJuh3EE4iLQVjUW7vE86UGSF0DS9QdFl10auqAiXjrQuYDE9UHNa/7aK3OMp0ZXZySfJjF0Ho3dq6t5Lzj+Skp96TtYbnLUMZ1FswXdxQ9wfZbmzOcCBOvYT02tu2gSWdGcsQ20NoB85A38D/8OfE7g0YHsIMDENEppBH0IlkxLjWcGTFAKi/0C+tpkNzepoUu1E8LzOqlxr3/BEfCa9estwYc1ZF1THL9rtId3bzsFVi6iyRUAxBVAuUXJPgPHr0WIJP+4euMaSHIRaJdutA4xx1ilygIcBR0A1qixgWE3+jMB7H+v85OTTlkz29oA8q599t8/owZFADsLWbNPTyWtTmLpTLPYLKjVHYuTdtlmtZEDxM9WvCpajyQIqgqlrUUmq5HOSs3vhjXoldLXjed/JOK8ZC7FO4qHfv46pMv12EdOII/WKq/InvGesscXQXJm1rTPzkMBPOqMRei21h472bKm6Vhpg5U6WH7XVOwWqlnXBOUMuD801L+tDSABQE+AzOdR7p8Oz8aUShIb1AeDe5U2qxaILKDImW1HFo/rGVADNGtUWQaJuFJ7vDcauzD0rXPtxjMR3a8cCSuzj6dNFy3437r776h52dt5in32UxfqpZfqkXH/q6XMS4ybZkXxdxukVtAFC9AFIHq7XoEweNmOxqmO29Ru96roE11s6AgqhsWJfNd5jjGYts2QbwAZ+8fYMWlcUFbxufZwJwwxiWK0pdqdHgQNFBOoAeIQu5UGVK8a1e42xy7FTgLTZQ1WXQfFh87+OteluJU2L+p7p1zhy2wc/uLU90WhC30xijw7d+gKB/sXgHDNTuEyr3plu/qQulAJe6FbNb8ZoSmGH4DwlEFr4hQrhZqeS5+oPjSeP5w6inTzrnRSVZ9Wrm9R5AaQ8/rwaGqENgpxQKKQJCay2LqiORmGKZercK2VIFaLhSFAUXVGcqYbNuXxe3yveSMdPh2KPk2/1WWwhQ/Dk71+ofBz5WiQ7gYs3YVmOolBr8mN3UiDr4HdWtR5+r7Iy+aH1/72XUo/V0zTVssXytVgC+EvcwDwgeo1IxzCg8Y/IXwUIIzbomP9WWqTnw08VYCSJQW3IhRuOPc105ZebwB5aR1yJxYKs1DlMULWjLbAct2smGwt2DOFk113NyupuZFWZMlbQbI89pLU1o3h6F4cQpcOyEK36+mGF0HukqXCrwDjtZok78K3i0D9R5pprX3+Z6rjayDbvS/eqAPfx1/PDfDAg1TNuEqK3CJBHdq2efwnhCeqkddML2zNHicOcq/8rg0MN4B88PjYpWIZQ+h9osGMZgGG8bNAYbFTICqNkFCxU5hBswJlZd70kaQBNJWk8r6o6BQwa4SkyzVJab2DrTVbgxtH8AUK4sWIUWsAchkbr2pIfgkAeWWKp4++2U6Kp+BIu3Oy4FID55pa+Mn3QFKdKs8B0JHAUdAB1AFZnxA+BR3n7nR1KVRv2rWgHAa1sNYfuek9/oXrP/5U1VCGxAkYzSwlo6UARzPCaDQbWP1larOFtNJdKOztav2qjk0j621g1SQreG6itboHC1e72Fcz87mBXpvo9USwvD8Xdal7S6C3DbqW7pAzcF95Dt4Z6Z3dd4XqeGYbcAKOa899z+zjLTsCPiRZ52iug40Rc+y8rzu2jFehimmejSxdbyH418BRxdpVjOfiowXbbW0R5GJ/noeqabPBVqMNkhiaf3UFvgZ6TGHAhRkIK0ebSoD14hQ2d7BPIhDeAkDdTotuNGIemty50f2+Wm/kWjSJs7opT8PLR3yyeKUksSpSwfO/swJyXxPTvTUuheVY1vw3pBCQ6CPCT6mly58I+uAnpA84Ptp24UPuH4DeIb1DeoPwJukNQFyID6hEj18hCmxrA8ioALGzn0HiYkRH0XWOIydBMJhSeFyjDkMYYSGHZquqDXNnhAUNLx6kl6hzuA2ci6jt/HZdtH29kAKe3E/35GcPNdv78Z5H6oQrH8ZVcsyJ7uMjij28hwaq2/jZK4mH7miNHN8AvTdQA94hvEF8A/QzruMNqMCnN7h+SqiP+QnpHe5v3e8/RXwQyDorpWyR5AaQj9YISmWQgvBujECvHA0x1xguIE3PkUXh8VTNwcpQXwPC0sohTw4VnnVZT6lz4mMAtKo5oJUMfsUTu0/2TgFWt+qND65+hKgYpXE1Pb6vJPv1tOGOv8c7OfLkzVrjSUQvAJOkn5AC9GoECL0HYOoNKj/h76iA6HiD9EZ43Dc62u+IjvcH5B8wfbqUU+Xiw0+G0re11SAfeQOjKhmQ5iEkXgbCOxvMDjAZDtddPaoU+3oFBNVHVVXxohP5F64FOAqL5o5OwFEXwFG4Lr4rLS/9trPS6ok6kK6UXqWV7dc78NIDYIYV64SvAO09tcuQYQ4gdA9wE94h/4AUaTP8A23Mp4AfFD/JD8A+AH5A5feUPgB/B/wT7tOlevS2tgjy8eUejnNOIlUXhSJ+Ww2zSYJi8cCu7JhozvTjP8G/jtojS42y1SA5T6DxzrraJXaNVmh+K4igs872pchTqym67qp96jYo87bqeFNh77UddeGxp9niPaOKq5xqfp3SSN4HoEtBTi8jPB8N+CI6/ATxAcc7xAJ++oiIEnGRYpvwEdFliRxj+zukDxmOm074BpB/bGDlpY491Q61J8CMTAFqrOITTICZiBggD6HcuG5NC9KKFmTtdtuSt80rMv93AOMaUtyTOpEX0+cz6bPFoHlnvXBt8PkaWJ4qZuMEBNs7rf7cK7XFS1x1YkXYdqX2yAuAZleix2up9SXVJV07kckrmKkAGsh3ZH+H9CZXSaXL71FvfIN7pOLSm2qt0fM7XFFzdH9TAOYn2H1zveRdzWm2PHsDyC+VoyiCKr4zMbsowVjtEjiP+LAOhluNIrs5x4gqZ/fCGDInybToSNwyiLp48K0wYarp2ClbRmwaiE3af20o8XTOcUHW+QPSMq3YR3AJwOu89BsnkrvA8Zyb/VAK/QeehiH/gONN8gA+6CdcPyF/l1rNMYDP9Q55qUe2CPK9dK1r1PkO+bsT7xA+KeW6P9RznJ3tTBtAbjXIB1eMQBKQzeM6kpGaf2+K4epmHzmgDYNXhg0NZrUTXofF7aRpcxIlnhgeXioZ9ffXlRLTyuwfr3XNeULA7eqMKv/W6466UHO8o1Z5Mde/M429qWbUg7Ju1GN/5ex663cCgVWfMaaD2oSpqfFHuV4aMnqLWqMHILoq3fBdro8ATr3D/UM5vyvnGP2xEKKoPILZbk1BvpI2gNwiyK+tLECi8WhWhCZK5NdTCGuNsVi8miWYxb5IskWYNGNr5sQgOSsPe+m4ff3AWmRml0xl1hof511qnd7WR6OnNUi/0JTB/dTDPybgwhckzf6A+15K7R+pPfKstnssM43vgn8E6KmvKb61mqTrQ7W+qDL60yLKOvIzjwQ58GHHnH0/gtnL2y2ptGEx4hOd7K1Rs0WQD67jETge3NxlkKKK46TUUwRVj436e+FVlzaO5u0z5bAdTWnOJHkCPKdRzUno5Vh4dp8Blq7dXp9jJbo7BcdyEe7oFusLYHdl8FxnrXPdPzT+iHNhrz7eRfEXu9e3GDQ8id65EtGTxxIhvrX0GfgJcZ5vjJ8/44J3BjjW1PoNLPOR1BtYZiapN98PH++/PU88PfHxsn3atjaAfHj5JOggImdTdsKzQTlOtyqgCYQEmkpxL/LcLjJUE4xSO02HZqTQuSOdjbzocqqoS2i0NhZz/pyX/tQS8C50qa9R8dYuX4kQv3THP8or5gbS33p9vCsTmKK7vIz6ECM7AXQqg+JCzDRKb0LMOqJ2rt3fJY8aJfEO9w8of+YxrFv9SmQrbiC5AeSvLgrMgLwbfBQICXKVESBhYdAndpW5vpvKJh8ewCrd7d7HOw/CP6qetsJlJjqhonrAmS0jqEsK3PeMy/CLaHrJgkF64D12G8R1Tva15763AxzPmbtU+r3VGBstMK6rRYv1PmWER/goM5LvAD5IvoN8h/guw7uOPNokwQBPFlJ9Z4SDRRW6jfJudcgNIB88/gikKtJTJa5ttqhqyi+n6SB7qdEGtkvQYC/c3wHNnRHRvSC5Ej2uRn+4Ehl2f5S40e3lg+K2N0BmOSzOE2bQg3YJV+9zp9cOcbtBdPnG3KLEOs4DvSkaLrUL/dkaNXUAPABznnFUHSDHu0okiZzfAXwSzMxB2vKUYO49RyFeSWfcJt7xWW5rA8jVlRIwGpjI6MWUoXAyBnjO9qzS9tZZTlrDMHUeo7Ng7mkN8mIYdhKOXaoHXuxac0XI5o6pagIrhc3zlPwSM+ZLafalfP0atfHe/PfGbRfnOu8E49XoVCgqOx+l5hjgOA9zl3S6zkKiRZiS3gqn+h3yMgbkP+X5J6b8A+4/M/yD7i4jMAmUkAcDszdR5DrzSADe8c8JfVGMY1u/sv7jM2liONrU8WZa8wWsLJly16L1KAbdcEYiNiyZc1ScbLsgvnriQb0Y51lTAF/h+J5ZItTOJc5x/OIws84juq+C3yUguSD2wLvsBbsrtxTDcf4R34yebjVobj6FVMDxDfKYcQxw/AnXDyiEJgog/oTjB+Q/4rpmsQn3H5B+RNRZnsfw5gnHnM3TMUfGMzlMQh7SPMta369da9RsILkB5EMlSAKfYbsgiEwdvUJ9Os1uCLFFUiyD4pwLW7Bm3FVG0Ll2ILcDt5tR40oqiAuRyuUM+3Kt7rSxc0JF1L0K45dR6E5NxTVw1PVa5dnn9Wggecfj7vXCPt+US9r8E0K9/IDwBsdPAD8A/Kwd6xjlUWxz/JACTDE3c4qQhf+E4S27Dlac0VTyEjpgckxp2KqKW4r9J69cGjJQHRarTZYiXrEQngj71joCpBZ3WgNSluexahlLnnWJ761D3lX7uqPk14PnJaD8cubKXwxO+Pgb1Ree+uxl8/bzaeVktbzvVGqLP+D6HfAf8ADEAnw/5yjR30u6HR3sOv5TfWXcP8t85CfcP+D6nAY7tsriaTk7x0nFjcVlg2ejsmJfW8ZfwCLaAPI/9nIRZkXXkT0DhnX4u9QQa2ExBsIjJS/WC6hMmTmSZFP8Ifo5yLV5vYV4Lq+ne9eOet6BCuq0AQn0g3NdjaEDvI5tc0tNG7g843lhpEiLB1xRnXj0hHIt8taF8alrQeb6ZJBDOMCLaERT39FneMtoeUEMg9f7QPhQ3d5Ue0qNkniX/CDJK/CRpa5YXBobQCYD3We1+PJ2rXy6vDcD2dYGkGd7OEGYrMWJ5FxHjNpeiR/JYrOADi1mVKkPIM87D+R94HgWld0h338m6DC3vmdcK1YLaymqnUSAXMQb654r9wPIDaA/tV040zm7O0y+aE62EABeRozShWbQtRGfudMeNUfXrKgTUV+hA84NmK6TXSJHfy/36+qO+Sfcf8L9DdJPAB8yxSC4ca5AWBSWZQCn0skeEpDnTjZ7c7fynS8ph1sUuQHk/YkoNbkBTnXGmKzRYMz5GJeodaoBybBqqGk4ToHyesTXBZv95TrAnIg8cA3oeN6fuCcK/NrnONcReSMn/qXZzpPbSPyhmeNdTfLarcY74D+hqriD2ph5gwrQlYvq/GNjx+hNtYsNvEN8g6U30GIkSMikgYoZx9J7gYyooMkMJHl0st07e1+0gqVOPvStk70B5MOZl1zwRhdEh1JmcyiGTkT3RNeR61JlhZpd65ZLYOseuwqIJ4B5GVxuq49L1248j5CaSMUlAHwgQvylIuqvPt1qFPmF5z2NzoVjRIb+BqFEg0EPVFUEb8IUqOK25bp/tBlHKFTA5R/w/KHp+CHPn2JRdSSBMuMYjWrBYfE2LFJsSvCUzt/3RjncAPIPCRi8ZsblrIszQNIqKM2gSZBkY2dYBbfZWJnSzRrbH/aGdBkle842dBEcV8HzHjXxvt54bVbykijvpec7y77PueTShTRdv/h5n08fZMg/y4B3SZ/xIeld7nONcRageJd7Fad4g4f2o9zf4TlmH7MH2Hp+B3Xsx7dYRniEWa2nLyUyR7vQr4w9nVEOaRtybQB55zoqZnGiLzMPeVcz5T56YJuVLFhqs5xEISgWemEcsmHO5NCJ5tYciT6W8nDFovWe6PHUH+VujxldzzsvgeGlF3UPk0b3Fjh1JoQhXXpDDzB/TlXMe+R1TQUQ30rNMcRt5TWlDvWdSKd/yovTYMw//oDrp2YR3JmnTfz0Ib37uD9erEU06ueMjgRgFSBtTscXZpHqObLEZgO7AeRjAYLDzcyN5hbAJRBeZLSLZVf5GfZdBfSUS5XfEfSy+rNen+I6w+kGd47CXKgR8pf4zLhguX0D+BaR4wX9x1vRrHTX61k3BtPV6HMtlZb6AFPr0W0HyFf/7nJNQR8s9UYvIBhD30X8Vm8BhB6R4SyO+wHXZ6k3vjUnwsawwYfIg8xcZ8xUgvIGfIYY60FNs6cASh+sdLVPKIf9x0M8wEja1gaQAGwwYKCnZBlpyDTzADVmMMCOPQCKGWAG6304hRETc4AnM4CJLPcBpgKSCwAkVyKER42jLo2+XFLjuWigdVp35P3SZmusRN1ZAtAdkeQCqE/BeaHu2+4jrQhc6EJN9aa1LsKmNUZ15igRKhzpTunb9Q7XAdLHnG4rdB7dSwpeZh2hz6g96gOuA13zFFlPvyKbGIU6gKQEGYGswqgZViiHRXD+jHJoWxS5AeSd6297IZkwJGcyhzHDLCMxIzEAk8yxnZlEhtEL+DkIESXqLL93qbaXUXL1ALgAxzWdwQs867Mo8gwEsNB8bJjgK3OIHYjoatPmMqhejeZugvraTXdYqN4TnV56mHTfizk/OR0h/4TrE9BB0kGuzxIV1p8fkH9I+lDW7EQo/4gaZJmBLGk5XG/K/ib4Z4SI8YGq1AfFckomy4xjd64ojcXWqIHDh6KQe8vwbFt/1/W/AS42wNEUUz5ymEUdklSJ/HxpS1CPtHafAohAScnLVMbZYOEVSfH7cmStCs9qBdhW7kssGzVrUdtdwPRrn/Wa7sfNeutdKHuDSviQCrnmGnQogr/VrrMcVVSiKn6/V0ZMqIN7UA0jlf4Jb9TB+RJqPT8BfgDKoGBCqetwmRe3Rk2dcdQ8EF4ph1mYjI99NZuJ1xZB3rNSNFBcYW9Y8jNUoEMDQqOzryfOCFLqi5yTPLFr2sDBUJs8K0Je4hzfm9reAi1dF4XVNfHdS4/lvUCIx/Uj7xXhvZKmX/wsHrFomM8yUwPAqDf+CBEKdHXIMvvYQLCK4OoNjiqAW71oYvzH/d2NH27IrcVcxniunRh63Y2+M9062daBad/qWaMcbin2BpD3LC+QBlekyiUKXKTFkT4rmNmmqD+W5s0MhHMtnK2gpy5M+3NP19Klwt7y570isdcGynkB1G4BH3gvOAF/5kem0/Jkb/LVPoupsF7eivNgY8QA6IVw3+dZyMaqeYtUus44+kfrXHuRQSNOOtY+T4OdfMAsr61RDjHbuC4phwn0UptcHKEb5XADyC+urAxPLOGiz23OVtlWG+VhPZpUDFxqtBldAV+0SFndFq60Lh5KcXgBRHCZecIVpZxuO/GgB/Q9UeDVx+m6OPA9jJ+rTKDzcoO0UpPjIoxee4oc3OgARnnpOlePai/daXmdaZy3ZY/aosclHuM/4flDefp5HPWWTYca6WklRFQnX0edpNknAFkph4bQhkTOS8oh+vnJmXJIbpTDrQZ5T4oNAAPhR4c0t0mLRtnpkLg6l/v+4ic/T7ZHj/LhmvkagNbi/cV60ppm5Eq0wAtg+0cHFhcrCnw8/b33j63RyGsN1ri8w+ksqtS8ZKRSa5QqMP4EUMRt53lHSD/Ue10DP+G58Kz1A/I3UD8s4f34mvLwE7JjV0tsFey5UWPwWeezNGrcEpQjKslkixaZBZPDhwS+H+DsReRYGDinX/wGjhtA3pVtCTA45C4t0uwKbn0K3YMgVmW6aspeAbaELl9qKJ4U0tuvbe/v0Ixcj4guRUq/8DrujhoX4Mj1TH9VUJfXhTmuojAuK6iTp9W808/pGPxo/9HADwpNR+n39rtQ5Mv0E9CPEJmYwbKJUKjOTeIHdukdUh6Ojjwadp8hfHsuoza/NnURZE85NJSmzKR4jslBL/40p+c8u3VC2dLsLcW+cUwHQzBpRV6i1BKrZkWvAhG5SnBkej2wQFj0nMVL9beHDLB0FxCtR6C8opDWh1u8et+HI17Nf6UfTSSuKRf9QnDDe7af/4FSNTkUlsu/F7HbuGT8gPRDRd9RGbVR81YEcd+lYtG6cC3UR2HKvOeRnx8vYyaANDl8mP3cVKVHGefUlj6fjHv1lEOcUA5j3qJSDnlOOVzOjne75BZFbhHkrXUsvVySCmEIsXEAixN2LXLPdgitey1SpArDhg6DszZyULZJ3gpB/AP0DB8LkW9H0Lce8NVxkL7Wx5XuKW+96Fuf1ZpP9cmsaf/zNLKcf53g/lFA7iM8YYpxFqraTp1txCeAz9Kk+ZzdCKvJlj4BfhQ/mg+RH0opO0KJxyYsmyirpQ6767Ot3jONcjgCnggrg+W9cVeVOjtRWdkQbAPIG/vZVMtTcpbmi6KWXUFPEMpgeO1el6FwwIN2TZURtgqGHo+J+iNmCqL9KfulLgeOa4IUd9c7vxKOr26+y7bggc/lcqjIi+wirpQdyoSCilBtdRrU7C6oar7V7uPFbMs/VOuQdS7SS0oNvMv1k8QHyANLnqGi/B0dZ658Fyp86qU6eFXVozzAVcVviJ30WaUcpoQ0Zagq/Ih1unI29+D8vUhbPXJLsa8daglggpDkytmVsxDlSBWKWeVe1+tFhEIVJINmWOmIXABijkHgBbiup5aXMGAtnb7Kb75jRrDLd4kVAP2Kx/aFtJ9r9cCzzwCXZdxuybudamFeCrp1Qv+J1+WzbFkRlYhB8PeuW915WfsbXD/k/lOOyr3+aPcN+bM3SD+ZWCxaJRZfdU9Fe9mBnEqE11sfLb4zw8LUrVEOraMcYh7rqZTDMTjZ6j++Zskw5+ebeO4WQd4XfNlchnLPbp6DbghOgDKkCoAV+KYOEOMS95nm3wtQCoWfXbncF1q6p+oxrY50ClacIwC/rHq93lPR12vyPZf7nojuDBx5G/i/ElryQRBffl4TgEM0Vprg7ZsiAnxrArgqzZg6BB4iE8WZsEaOsU3AG4U3GN58sAOP7vQYnTWPzvNAwrLDR4CTlzN0y4O7TnZUdyqfukWQyQoYxvNJDli4HFKOnIrRQk9H3TBwiyC/DJDeJhjdhawpT8hyZA+Ac8Ul1HscLofcIWa4XFXRRyWylDug3M9PwiXJPQbScdua4BSI7klRydvD2LqVm19Jvy8yay7wyNeC0UfB8cuzerfkzZQhHcps4zty2CGERqPeI5Jsw95vcP8os40/y0zkT7iX2qT/lMKilZ5/wvATAz4Bzco8EswVKjwk0hSdbPjcqFmQVde8W9lHnJztF8pRSAfMHTI713+89iltjZotgrwOkG3P9AxkTtmJKVNDFrKYTHAINJcj0+QQwycWdIgudy+iFg7BFQpABSgX6fac2N47GHlv1Cfdi4o3tv9CzVHL6FEP4dhXm1eX3tvFJ4oh8JpGR3f6DTVyjFnHn5VFI/Bns0qIFPpH+92L1Bnwg8BPGd5IHQVTSJTNSt/MQB4JJSJlx+feFm9dYi8n2kQr1r7/3m2it5+xDGCHuUHDpbd6S7P1lR1sW/+UANkFehLl2U3MdDM6RZeQSTocGSYXlANLmcGUIU0gs6RM9wxahinLPRfJs5BNE7KgieTw8LH+0H11G5BOjpJWrP/VY4W38e/+iIX333TmS3OpfIEM4KOkxAUcy5xim3FU52GNLv1W8bfWLEQBvcHwRuGHkr1DfigsK5CKkZsughQYnexjRH26MM5F1dmCK5RDF5jmRg1JYBKwDxOvwb0Nkfe1axXjpHaS3gbHN4C8ttwzOv0v1zFnuKZkyInIQIp0OiHTzUG5DJnQrA3pNsGKQC5V65BRl3SV26KmKSgTSHcNX+vO0HIBbCVpaxYSOhe2YH+AXHD3uxqVXgetGj3yEZC7J3q84Fixqux1/lxTmU382YRuZ6Otny0iFH4KnSBFb7bVvKzxBvINxDtyflPiu5NHy9D6CUmojRqRSCWV9mEeyVHv7KEKoHOmUdXCm5qP65xymGfK4fBxBNLQTogxdB73g9Rqm3Fy3MBxA8iLmWme6dXumZMmZWTCMpyTgRNTngBkGSfCj4DtRE6ET6BNMGUIk8gj3ScwTQAmSZnABPEIqDRxlEHaXEj6hWjtCpNGrXZ4AqjX1Hr0x4EjHq09nukYLihDJ2k4V84fa42gdj1D+Kwd5qKwMxtnodgfFOMtAFXpe770s5BVscc9ZM6YjrXmSHX+2pxBLchVQLYASHNHHgg76Ezfk00kykBM867SUw5RTLzKiE9POczJQFejHDbxXGCjHG4A+diajgd0jn0OQ/YjciYzwcmNE8mJ5BFAAKLziIQBwgRognyCpwxqAnmMtBtHiEcQA6QxHssD5AOEATBC/EKbawXg1uwTqu5GL6rr54+V9Dg4XnBgXELZjZriqngElhxEXg4Hr0aMy+cN/2pVCbKmwlNVed6KKviboDamM/Os8R4ca48UO1LwN8rfNNibMg6QO8y6z25W766ZQhvvsfAotwnw0cCPE8ohZ1M19ba9RTy3Ug5dQBIw1fJIMuDoMfaThlURjF8vdG/rnw4gzRZ0PGmfJ590yBNHJhtt4tGSHUCONBwhDBCPkI0AjqCOAI+AHyAbQB4AjIAGyA8SR9KOAA4QBpAHAWODxms776P7bXMrvGBw9WhkeAscb9EX7wTXu/Jr3ik8fFpzlA6RVntnoOU/OyCMlBuqArc/CpMm6o3Bjvkp9+BdQz9p/Jl3fPdkx+E9O0rNUJ2orcqsoTMhwVua7QmAEcPk+HxKJ5TDYol0Sjk8E8/FarQcICwgoQ2UgyelmGX1eZGmb2sDyAuRDBoL0J45Zddxes8H5mnAYMndBjM7SjywGDRAGgsYDpAGkAnAIGAg9AlxgHEAeICQQAzl80rxWE8xwMbLc5CLTOi0qP4nrgcPGOICz/rasPvddUlewNabfyfog9K7QmXnR5ldLDVIvEUUqR9t3rEOgwMlWvTCtVZT9SHxU4O9fb7sj8PxqDrAjVbuY9WVj2jQorACCZaFvLPSqPEis3fpZHiDcthVG3rKISeAY7gcRn2zcLlKOYaru9CWZv9pAdh/+DewE1K9jILtTPbEo2M65Hw8ep6O7joKOkA6AjoKfoR0UMjxHyOS5IT+d7BeP8TvmK8HsB5XkY68EWndXVy96Xx6H2hxeVnW9hav9Rwc7zEi++qs41XKTy7gWFXA30ok+Napfhf2TBG/rRYKYAXDD4jvIN5IvtP4DvJDg30AOnoaJM6RGlek406rsfQiB2VETVyaQ+FJFtDEKZqHdbNgby6HKtQDL40XpEI5lEod0mef9laHnMVza+OG3FLsLYK8BJCpYEkGPAvKDj8o03T0KR91nBIGH5X9aGYHSiOFI4QjpAPIMdJnpRpFImQmR8RITzq59BGnQRgf4yD7eQTQF6pCzRJAl14tfscJ64ZzLZKo6hVepkHqK6u0SpaTIvu5RV1Jh2+D4/XokUtq4JXoEfPrlz6B2ljB+wyIeINY6o8VKFEB8Ue5/hPgG4gfIH7WrjeMPwG8H16fDvvf38TSfcZCvduiRrj2VqoCngIUU6lJaiAsX+hkd99ri0wLi0rGkDkDoxmTyzYPCQAfEniY4ENnhV6637WTvcxKtihyA8iVdfjXDGXN7T0SNML2Non8lMs854E+JAgGcCincisgsgBARofaQCWI6ew+PTiiXpddract0m2WQeJaY7JFYwAxagSSptlOrB9U7529Cs+8DLVLXuKc3LjmTWuVA8g9yD2APaChhSc4bcqcyqytRJb31ijXujGXGzK50QCln3L9LDTBt6bLCP8RIz6oVMEy0tPMtspjUPQfY0DczT7pONYBbHOHm0HV0be4DKq6EGq2Kop0NywVzDEzanJ0soejA4PNJz7TiXhu7mTOLGqcRfvRpGj8TA4kgx0AEzANtkpG2GBwA8gHMzWGN3ayIPUbIxJIzPjUp78refaU3JO7zKCBgsV7ZwI4BFjIACVAKSLHiCzZgBEJ1Bg1SSUJicYR8AGw3dVUmVgfAm9KE5ogHYv81iel4H6H104uKtkZkiTl0ryYWgtbqHYRtUyQy8FlAeTcw7gH+AzwFeALyCcQewDDdeuGK1Ei76k13tGQYetUf0D+U1Fv/H0xx+h6E/QDrh9w/xHRZXEYRBkUlxqLRmUwnEN6d/BTxEQA9OBD2+SYdgYZYHUWsSspFJ3Qs8idLuQhIs90dBzGVKLO2dyItVZYT3onI1DMGcAAR0SiTfCi/jl3KA3wByiH2jrZG0Cuptjf9pF6LJolpYa0t6zJP3VUgmsgMDD0ACvoDaIOhA0tfa7ptXAAkQQNEAZSR8A+y30MwqCsAw0DTLHttFmzLGkt/a4jXfPC3vgJ11sHDB+QH1EiGwUYTp2fDjplovnZGq9czqAWDTQ8AfYMyGFGgAYpomdjKscoF2lhjVz6aPLOmirvUe9ZRpEO4VDYMT/lTQn8Z2nKvKt0sQtjpjBlqiJ47WZjBkjgJ4kfMLzJcFBKGR5eB5wETwabMrDfwQ1IXVNr1k9WSSQc6shT5mU0x4poRerg6UR9aEE5vFCFRU0iFpRDL51smymHuEQ55Jcac9v6Z4kgB1sAUJy5rSqoCHtOBA5yHwAfIA2CDoRGQEeAB0BjRJI4SBjoOoA+QBzhPIJIcR0DoAMMQzRrcAA4wnEAtUcvaHi6w57vvI4A65n2xtaJrV3ZrAakcrhrBlZ1zyx0JmRepoIMxJPAEZBTRZ0I6iTdpBq+8bS5dNpx1u365FVw7G+z9n1lQMezUZ0yjlOYMe9AU+uZARKa02vgJ4g3gIVVo59I9gboE9PkTLtSqiPoGT6OSJ8HCPsyilNqf2ym6K3eSHZ+MKWTfUo5dLsAfxdcDufMogfXQjms2pB7BKMmd5TD2lnvKIdq8nnb4PgGkGsRi1tzf8NaFjvQkXDIP6fRjuloKR1gNpZ0NhoujkNJsweYjoKOhB0hHICIsiR8Ej6AVuYkIxKNmUgNBWCHs3BKOrtetFRj+Jkh66+Z8fEB4gPSm6KbPgNffX/qxsNVwdFP7Wn34cwIsdjeloPSu6ZNGSDpEO4kCsc1Pch7ZiIv39cBHIoXTAXEt9aAKWM9wZrBO+roDvGjCEzUBs0PkOUEwzfQfmiwt2k3fI5vH4Ln9kLUWCvBhAGii131GC9mqDZ/f32jZihA6olItenTzaxSpXBDCwZr525I96h5rlIOUTrZCePxABXKYYXTnnJYB9pZ/G62tQHkCUAuR1eYYoSbsye2IOT8Nh3S5KOmHLONZCIYg+J1OFyqTZjobMfnM0I6lo72saTfE9i0I48gpjjgpbMuBMtZ3xcQfmwK1+UnAySrVcA7xA9An6hOjcX7W65KqSmhTGgVBTi2sGSAcQToJIv/d/sZYVGUJcLkjFgR/+UFtYpbNcdbne2aVhd6YIkANfOq39rMY40U222In8TP0s0uQFnGfKSfID60Hw4AhcHiG+v/fKfAba6QFzOfy8EkziiHmC0Q5OXrLN1vy8GdTodZPJeLv1XnIXPX2C5D6ClB2ZuJV6UcIntQDocl5bBXUfPVD3aLHjeAPN0tdqUx05lWRZBVSPwl1dZOx3z0Q8p5sJSOlEZAJRpkoRKiCueWmh+DfghGk4Q2FXAs98FEFn62MJXmzrr4I5u69CR5HVWpcv9lmLnS6BCG9q4PSBnRVS3FS69SMdXb+6SqxRhqJ6NSujh+OrfHCq88rYrdYsTgJEU8bbZqmZYT551qFF510P/CnnUxyhOGWZFye40UP0paHXxqcjbZCguFNyS+6+ifcDmSNWYMWh2v/J4DGC1neLJS/zuRsOsGBqwCZG3ANMqhIU3RtOGHN8qhRNA6Xn1/7llQDlvTO1L7QjnksbB5Unqw7bI1ajaAPEt/xjib+orlaOXFZgmkO3zyacpMadKQJqoAG1QUyDFVdXEBmVGnm4qyT1XyqeCYQWQFMB5Zt0F2rrPYdtpJ0EfxPnmr3imK0ZYPyD/g+pD0AffPApClm918vxEeOt6n2HMySFlMIDW8U/vXW+vx3CTgOjhqCXr3oOip8Va8+ENT1AHepeoRow4gUeuRc+RYa47Ez8Ke+YFasyR/YkhvMBx4cEd2YEgxYkOGBnJKc+/JVTrZGXkYI62t84lpSTmsqkmt2VLFcwvlMGXH8ckWlMP60bI1as6jb0qXe1maTbxmyiHOND82yuEGkDeXuoo/JMC9zEWWSwWKRAeR8zRNtJQ5DBMteYyX20RoghjRYWhEltEbjiFcoQmOCYYMx7HIo0XKHduPEAdQyyhyBjCH/Aj3zwAJHOI6jnAcIP8soy7zBfgEkeGiFh1s1zzis5CwHnFufUsYCGOxsS0lx4U/1q+6D14Ax6VKei7g+BOuH6pzi637rJ9FiOJHAcffw6O6Ct2q8KvrAHi5zfAG4kNDOgRGZKA0OVSEJeABmDV6s5zhYwCk2DdqOhGQEjGq6Yp1e1wG8o5RyzwI+jLlcAY+Wkc5ZEifcQfkZEhZpY7pG+VwA8gHAfJjmsGwP6MaYh6y7vxGgD5pOh5Rx2ZQABA6llriLrZzQti6TwxFn7HcfpRwJNsYUKTmWGyfAI1L5BAgHBWNoUMwRQIAJX0A/gHwE/JP1RSy1iIhL2XIiALdl+5VLK0AcQfaGKM8wMyjYU2t48JWo43Kvp0i3cnrfuj44xJAa70xhtirXNnvcP8x0wabX8xPQFGLDL717xB+LzXKSiX8CeB3CD9g/ImU3ny0I4UJU1HVMQDZ54jKDJxyeTcsTRBH3o8Y8zHuZ5hZLJojyNZUOzFSYxHPdSt0pVKTpE4LFbPLYSCgt1vYpM/KEHpJgpL3LodRpxwOEzSkGX85C2pYBXP55nK4AeTKymVEpR4cNVA6H1sRyMxRUUfMPinrSOoIV+hDUtGYCWm0yr3eYeZi95exu89A4oiafsfn2u+lh9AtxGLGr4i+Ric7+MY/Cbwp0swfxcY0NxLbPPtYjr5m1r2DcZg1/1mSLgOMmgGSABm+3/H4akaW1hHwktzPnQrgdXB9LikEt1repchebA/0ozVq4vI7gN9Lal3qjfoB8HcQP0F+YLCJoGTBSHEi6tFTLko8hTSg6SS99VIWDgBzsxhwXH8PbVMbxVE03dyIVBsuAzEUyuEseTajpWNp4qUTERMDka1SDg3M8R7yYOBneW8tID2hHK4IaG5rA8gIlHbDuRDDSgBED7NM7McJH9MROY+Y8hGDHeE8MJWONVrqXDrWOrYmTnVFjJbk1KJOICwboqFTHRRTY8nUCGhWtn6H8NbAEDPfWHNkVTyclVXVc+WnHRmV1zy07nR0q3P3OryAoXfujj43bOgPCWFcGxi3xWs71uaJvNNndMwzjkABxTLb6K1J86PMQv5YcK6JMNUCPpDdgx6IODlWsLESqVWhh3RBtrw0biog1fT2EuWw8amLTmdQDuMNh4kXMR6LFlTLm7UQzwVzVxuO59eYutGdSjlEa9R42iiHG0D+ykp2BoS1P8PTZoERGpn96Ee6T0l5gg8ZVtTD59pjdKZh4UnjPsGsNHSaN01YNsiatazMQ8k8ut+pdLc/AH9XE3rFB1zvUjG5b+rX+igp+EfUH3UohvdBG3QthsPLAVMc6QvQRZLnnD28Z7/vGRgdzdq2ejTyel62EAe/aVZWxSaqNFk1yXqfU+ei0hP1xbkO2TNoajodohPxeOOHxnTgMftcuuCi9qdSYaAXsKqpfp07VKnzlREfmzKmfWqUQxWAPKMcVt58bb64kAtBNWUVyuFUSsGCnKX6cVKH7CJHypdVyp5y6EByx1Q72Xf0XjbK4QaQ50FL7vt4Xe2rCH7Hzt6lhYmuwbI+pknZM7JPNGVQM0gCAXJh3jXBLFPdOI8x6pOzp3ZElsIkKJNe/G5wAPSpaL58QvqE+6GrRZbtOAj6BPDZcbIPAA6Kn3O9Mfo0zpD82UXdlLk5MJJFqIIdOCqHg6NUPL8FFnYO6Lfw8TprZsGn9tnKAL8rao0/Oz71T0F1249gyhTmzMJjBm+AfofxB8AfSPah/XBQknOSN+pdEZeNHcFQI0oC0OTBISqdbBR+c2tnucOHGPUBh0hXq/oQTymHkR7n7sSQPGorbVzoaR2e5k725Q+1dZ87yiERjRokwJv02brLITfK4QaQF49dCwHTFimw7uhrgU6Zud7R/ZOZk6Y0eFbyicaSNndAozrmozmKpAplD1O5Tx0Uz+Wxk4BjKZfPHWvUDjU+55/4LKM+8wXNV6WaS310w+KuSPEowwhYIpBnsAt/bzFUfCgKJhUQDNAUlja31bwsuu+PpdTz6E6uYhOaVXZ+j1qjfkgFNGv6XKLIOWLELFVGVJCs4PgOw6RkChHG3Im4FWfAEjkyR9SIMmyNrlGD0ghplMPs8GFAOh6j4dJRDtFFczEwXoyra6m2mnjBADPYMV7TLcqhmnJT9yF3lMO54VKAfsJMOZxCZGONctgAeKMcbgB5tvvt0gUFLp1V2VvzZs+MT59wKPau7i63ifQsWKZhAkszh8yQjiJHBqOmzDsiSzoyxnxi7CduOzanGLX6Y+vUqgLBzDn+0Qm+/ixMkd9jkBo/QHyUlBjK2RESgns4ExjIyVpjnIfAvTRswtHRTrbV6DLKZd7Cpjlpn+UGaxf3koxZiAp/FKGJ9yYiESD4e0mr3zuLhBjVAWJ+EfwJlt/lbyCjeUP8REqf8d69dXx7Be7WZVbt/Hp8LAUgiVLXMwOmYwMmGcFjSbFr57qnHPqVWsMFyqF5NGpS73K4VLmbO+Id5dDkcFoTz50ph1ZMvKKTzUOGRps79AvKYc2hNsrhBpBn3cWVUZQKhqdSU01CUcIuTZ6niXk6YmIAHYYcpl08wD0sF5SGYtwVHWvHAEMRy2W1Ykhh5KVqYwdUybKQH/sA8KNZlM4Uux+dkX0Flx+ztmGZDXSflCfAS1ods5klnGqgV2uKGVBudUir21BMySxHw6bVJ+N1XhAP77FzRtCYHyifyRukH/LOWjXkx36H63dVemDxse7UeCqVcAZM4A3UTyR+Kg1HTkVBApESR/eim0usxmaOiK5qt9oIHLzR9Joobi803I9ZqzZqfNEpPqUckieUQy9RI1kA0pA+Qhl80divDl2wEuTPlEPUIfaMVcohFaUASk3xeKMcbgD5QIrNfuZuPhBUpmLWbVLlO8uY0oGTUsqeYNmC2yVKSkQTzo04qyFumzCMU7Xq3krCdSyUippuF1TGISJJ/WTzbW6c4zcFYLzP+ocxHK1Cs5PxSNIElY51bbjAyRK5ogAhkUurqgNA5jbqE6XZHC3WmadNzpI+yz7MWdpddSc/K+BJ/vv/2t7V9cax5cYiT/eMfDfJBkHy/39dkJcAC3sszUf3YeWBPB89GvlugnvzsixA8FiS7RlrupqHxSoGoU9rEXgZ/cZpZ4yP7rz3XTKNJBUfUL1S+BDSq96m/hrGnOvsG+///08/fx2WQizq5Bk/iIPlMAQZ3Q22SI899g7F85bDIFLRbjlUA+oSBBmWwxNdPe9LvCbLoak6TwLDclgNWF5ZDj1nSo1DqPmFhvZKrkkkQaKPBxq+3hkt4ndpUUDj11Iql+2G6wZsFsPmpqDGEmThRIQa/R7x012vKoxN4TR7+GUaPcpYfTDNDm9xzLyOAAbeYjD6NoQMu4K80uwGq1cAV57XTXZZoVKc5NQAWAx7N8NwRVs3JTEjOX+dJPr8Y1MT/HXKU8P2FytZW0TbdeyLsZhZ7MnfXlG2FastqWfYBb1iVLkA+BDgnaVcAdxRZIeFVfATC0xZHLOzZc4vKuLVZMt3rwasxas+CcIs2v8az3Ms0Lqjrs1y2KyJOinZrfrjYYhcjdjFe+DLbth+myyHc4RjE2qeHTXyYn/kcyfD3HJobfaxizKvCsW0HCZBPl83ez0SoQioJVw0BZzdNNPFRhJyWkxE7/W6sWzWqMT85h9bjdkrEvd5kQS15+cEBT4AKiXcLl5hHYePSAuXzS1UaxdlYnNfe0yzCKkIoixyExoJlilwAuI9xzbw7aM6GiM77NXiUAlcufavuSjQxoIYqvgUCnm4+jgJUN4q8JCJUKLtfQgyuLIn8OAC8scQXPARARN+/FZXp+23012u24baQziexItJkCEH2fW5HnbxhdpixIIhnx01Zu5IibOqVvtsOexHW/RVsEP2OFoO2xIvqleQVHmhVj/VeS+Ku5nUDpZDhPC0ArUULO21Vet/UbcKpOUwCfLl225Z/UijGsO4+qnv+Kqq7BfVIrWe17vKJrRKmAxnTjteGemOFJVICFKhRWQLbiB9tUGM4ThB0qZ8xpb0TQA76eM/MPuA8RKpPje2QWnwHcL3el5udtLtdDMxKEEbA96zfRBzlYgh3LSESM+FRA+s8IO2QKWZjeWT88gvvBrq+w3Ala5EX7oThu33/MlWKbog03qNP4AgSeEVIu/xcbWl3Ki6q6o3NHaO2Ju+2AqHRO3WK8Qs1Ng0ky8K2A6WEGr2I0Fir2OHdRChnRec6uNoOayfhKjPwjBjDKeF58aXrUgfu+F0j2qWQ0YfclgO4zXE0bptOSzmHm/Z/a3HpUDuD1hZnDw5LIe+uoHdcpijPkmQk4r99kSA/GX7hc9dGnomOJflbtedhUZYrVAYqfTVWVJBMRh9pKZWUmSL0KuWzK2hKVaANxg2F0u8XoWItbWzMGwC3tiO24Ir4Z5sAW5U3MWw72fd67nwdDcV9ZyJXoeQU1+UfuXFDhoRicfxIVLiPFdi1YL0ZWQq/v3H814kfbvy3N0ubXwn5htjedYlfNM/ew/Sj9Q/AX73X+VdRK4+siMPQva6ngiaB9c+Dft3IWR2kUQMJosc2ojHcFrpfTyoeGgFJ6FmJo0DmYzB8e40AL+wHHJYDqOK9C2HEtmQ7qhheTr+t2AgUShsshzGjKYWYJ8sh5t1JbtZGeX6dAOLYzf06bzyOccu8Q/bg/zFnZJPup6EAaU/ji/6amOpOJW7VewKbKA9hHaVqu9c8AbRM0ROEC7i1sNCgRn4gKAKpIrRKKgg7lTuVLGISNtgMAEqBcYTSBEDsSuxoaJSQVsLuVU73WEQwXo3qBd7AmGBShEnQlfRPWjCfy+d6BQaBDk+BCoqUAmCDEIUFVXt1xRaxWi3WHz1AzWGvSPxuy/OQh/2bip080239O8LIBcUuXBd7lyXB24P27XgZEatFbUUoO5dRBlhYd7K9dZGWAaDxA5K+izUEE60XagJD3azHKq+Prq3SqwarCnXk4BztBxOS7xCQW/ZkKu45dBWgdyj1/nKctie+7TCQo2oImN0pz0/lUmo0S/lmEQS5K858unN0lVGweFeKl+pfu34pGImYjBUtfrx+Ouy1DeV8w+LQCtTCtRUhQUGwSaGXSopoNgqShGiyGZCEwK607VlFewnH1zU4tPc2OkFSVwoPBV3FN5DXTVC72yySqvyIomik2OrFqNtJfPnYqshopJEGStrpUh77K2BD4A3GtwSSbuA/N5aAGOZFhpBjrEl4OLH6e6Z/gmRDyzLhwgeti7GtxXl+hjzgI0IdgKrfp5vfnXfo40fpE7HAE6WQ5Wj5bDGUgyVrkuN+HlfvcBSUMywLQqW2HLYwiAOlsMnJZuecWGL/7taif1cAO5dqHm2HPZcyTajo3EzkC8shxzP0eaAi5eNzPlhUmcSJHx2bEQPEvKLa4y/w7JT0opJBfZvpW7/suB8uaOqop78QrKpiJmb7BYXZ7t4ugVMSDH67pwWEdFOzO1ardPOZSVsWfvFqY9NYaZh5ShRUpW2Lwf49DF2eRMFisXX14qvtKX4LKeKq9KMpCGzdxg+YHyH2QXghd5vfA8xZqxCYFuLwAtELhBcAPmA4Iql3LmWh/37P9vyX9/pA9xy3H562CLYKj4OkjN87vtZOwoH6cgQasYbQnr1JxKWw1PshVF30HBZRkFYrYfn4rxENJm0UKRPlkNBHNnj2at5cjJVvILU1yM2Q8l+rvtGn/Ol5TDeG1jgA+M2hWZgCDTWyBXyxShC4h+SIFfhJ/L7P7enZYQSUIH1suP2b+sYreDrcpWRUi3H5MBR6XzlzJBXcfxAXRcnWLe9KSoH8am2x4uvbVUF4NWg+lEbbX2tf659X/HSSAjVHYKrLweLY7XZO5vNUXiF4gcMPwD8iNTuadCbF0gE2raUndPyjmp3nIuhokZuJbAUSBvbKXGEfCJIXy/g7pZP7ZMuOERKz3xE/sJyqHv07GbLoWpXgH3PY/Qhd4O9LVgeDxBvo1+5W6/WPlsOx/NTa1sOFcqwHJZZ5JmbkOwC07PlUF5ZDs3XDckOyJuH5667jVbCZDls/09Hy2EiRZo/thzt7zuKYLmbX5fFL7rf5dev9CF5+vqwUhxegZi5lxiGcucQwQmgLCJFWzJ4FLzhq9CwGWqp0wykQWQXwQbRe5TYG0R/Ts/Jwn5yR5EPMdypvIPyAcN3KP8mJt+hbcOgfGDRd8B+Anpl0TvWcofIXv/jX/fyn/9NOStwoxNM9Tgv2asfWZcC2W2IHOY3I4ldLNhqDzzvQk3zWE+OGivlF5ZDBWzzJZMHyyE+Ww7Fd1tX1ch5xPD1/96baxKODpZDErUIFmMfJejH85jR9JavHSyHQLh5wmreXjeLTEJNgT521LX45kMMy6HJk0STFWQS5J8KAXQjJOL1deexx8OD+vMkVeJpNUFcwMaRTwgee00x2lKqoLxXsEjkGRZj0U0hdxRViBYAqhJVZJ+BkeqhGSKxfOzDY6tbD5LFa1R7RJL61lPVgQcgV4CbgBvBW/ijf2DVd+pyheABq5vsVqnrg0UqBGQp3j7YK3BagccDKAWyAdirE+SHzxxy8WAHU0GJ3poVhVY77jfvQkbbRTCtJujOmaiedAgm3ntUHFZJWFgO8cJy+LzE0ax7sjvxfmU5bCERfLIc7m45xM1dPAfLYQ+tkGPLtVWLbW9OO8Yz5h73seXwuGsd3XKIlG+SIP8/SLG3hMSDC8rdUM+C9d2DA+bj0fNBRuaRPBkdJxeMpy13h0GMoYwKFpSq4D+th0xCCDZ5e3vH9e6rIlQegNwiJ/HUeosCFgrWMQYpTvEiuwA7jBU0Tz5XqVQxz7zEQ8gHRYzW9kxpRdG7lWXzz1TI3cTKAn77jVIfwOMeJ/wgw/MJ8uMGfIs9zlsFz6u/4r3C1oLCR8SGEQrDJotXmqclqJ5jsL/aMB+Hkv3Zcng8wf7SctjCLvhiy2FUk7YoqNUPExyTjJhWkwvaCE6zHPp4jy/xIrZVIB8Vgs+WQ4G5UDO3VVQh+94th4XA3m6ecap3JVv+l5bDRBLkH6/6RNq0Xz/lWrF/8/FGCcVSnm7iLUdwVIife0DsjXrBPPHB3oeU+HFwJHPP1slS9kjeeUDlHYIikMWrRHfVmKgRpkrxIXbFAyoGwmBEPa9ENUqt7DtppqdoywKaQR97PAeOPSo+s+clU/WAhd4BEIFsO/i2An+zsfpiq+Bfzi6YVAPfTsOhMis0babv7zkWPlsOD5+fxmPMWyMC+HF/Le6FboPZZTlYDlkKyl7dctiFmhgRmpRsQkevr/chg9BCqHmc9XjT5bGC/Luqu2fLYcuGjNxLfrUZsSf7JJIg/4SGpr/xgrgUWD4qHn9dQd1iWZN6ehifK85hESZfVKXyC7HmUAJ98bzMIKoGFdJtP9N2Kb9eawxc624vpXxfAuVN//CAHKJ6JBTduTqW6SYAVU90a1sCp2Oo7BX2l2/HP7jXQx7jc0jnEGqmER3j1JrAi7nFZ8thzOabQYovAmeJf09jT1FkQTpxayjZ6NKvVoOd/PhPOY9tiC8sh17sz8/JCbJbDreIO/tqkSEm0n1auCvTCaVbDsMB6q4dwBbFEq0A1OEzbJkYmlfxH3uoZFqSEolE4ssDZSKRSCSSIBOJRCIJMpFIJJIgE4lEIgkykUgkkiATiUQiCTKRSCSSIBOJRCIJMpFIJJIgE4lEIgkykUgkkiATiUQikQSZSCQSSZCJRCKRBJlIJBJJkIlEIpEEmUgkEkmQiUQikQSZSCQSSZCJRCKRBJlIJBJJkIlEIpEEmUgkEokkyEQikUiCTCQSiSTIRCKRSIJMJBKJJMhEIpFIgkwkEokkyEQikUiCTCQSiSTIRCKRSIJMJBKJJMhEIpFIJEEmEolEEmQikUgkQSYSiUQSZCKRSPzZ+B+GrlwhibMxxQAAAABJRU5ErkJggg==' function Sakura(x, y, s, r, fn) { this.x = x this.y = y this.s = s this.r = r this.fn = fn } Sakura.prototype.draw = function (cxt) { cxt.save() var xc = 40 * this.s / 4 cxt.translate(this.x, this.y) cxt.rotate(this.r) cxt.drawImage(img, 0, 0, 40 * this.s, 40 * this.s) cxt.restore() } Sakura.prototype.update = function () { this.x = this.fn.x(this.x, this.y) this.y = this.fn.y(this.y, this.y) this.r = this.fn.r(this.r) if (this.x > window.innerWidth || this.x < 0 || this.y > window.innerHeight || this.y < 0) { this.r = getRandom('fnr') if (Math.random() > 0.4) { this.x = getRandom('x') this.y = 0 this.s = getRandom('s') this.r = getRandom('r') } else { this.x = window.innerWidth this.y = getRandom('y') this.s = getRandom('s') this.r = getRandom('r') } } } SakuraList = function () { this.list = [] } SakuraList.prototype.push = function (sakura) { this.list.push(sakura) } SakuraList.prototype.update = function () { for (var i = 0, len = this.list.length; i < len; i++) { this.list[i].update() } } SakuraList.prototype.draw = function (cxt) { for (var i = 0, len = this.list.length; i < len; i++) { this.list[i].draw(cxt) } } SakuraList.prototype.get = function (i) { return this.list[i] } SakuraList.prototype.size = function () { return this.list.length } function getRandom(option) { var ret, random switch (option) { case 'x': ret = Math.random() * window.innerWidth break case 'y': ret = Math.random() * window.innerHeight break case 's': ret = Math.random() break case 'r': ret = Math.random() * 6 break case 'fnx': random = -0.5 + Math.random() * 1 ret = function (x, y) { return x + 0.5 * random - 1.7 } break case 'fny': random = 1.5 + Math.random() * 0.7 ret = function (x, y) { return y + random } break case 'fnr': random = Math.random() * 0.03 ret = function (r) { return r + random } break } return ret } function startSakura() { let requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame staticx = true canvas.height = window.innerHeight canvas.width = window.innerWidth canvas.setAttribute('class', `canvas_effects ${mode}`) document.getElementsByTagName('body')[0].appendChild(canvas) const cxt = canvas.getContext('2d') const sakuraList = new SakuraList() for (var i = 0; i < 50; i++) { var sakura, randomX, randomY, randomS, randomR, randomFnx, randomFny randomX = getRandom('x') randomY = getRandom('y') randomR = getRandom('r') randomS = getRandom('s') randomFnx = getRandom('fnx') randomFny = getRandom('fny') randomFnR = getRandom('fnr') sakura = new Sakura(randomX, randomY, randomS, randomR, {x: randomFnx, y: randomFny, r: randomFnR}) sakura.draw(cxt) sakuraList.push(sakura) } stop = requestAnimationFrame(function () { const isNight = document.documentElement.classList.contains('night') if (mode === 'all' || (mode === 'day' && !isNight) || (mode === 'night' && isNight)) { cxt.clearRect(0, 0, canvas.width, canvas.height) sakuraList.update() sakuraList.draw(cxt) } stop = requestAnimationFrame(arguments.callee) }) } window.onresize = function () { canvas.height = window.innerHeight canvas.width = window.innerWidth } img.onload = function () { startSakura() } function stopp() { if (staticx) { canvas.parentNode.removeChild(canvas) window.cancelAnimationFrame(stop) staticx = false } else { startSakura() } } }()) ================================================ FILE: src/js/effects/snowflake.js ================================================ /* 控制下雪 */ function snowFall(snow) { /* 可配置属性 */ snow = snow || {} this.maxFlake = snow.maxFlake || 10 /* 最多片数 */ this.flakeSize = snow.flakeSize || 10 /* 雪花形状 */ this.fallSpeed = snow.fallSpeed || 1 /* 坠落速度 */ } const mode = DreamConfig.effects_snowflake_mode /* 兼容写法 */ let requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function(callback) { setTimeout(callback, 1000 / 60) } let cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame || window.oCancelAnimationFrame /* 开始下雪 */ snowFall.prototype.start = function(){ /* 创建画布 */ snowCanvas.apply(this) /* 创建雪花形状 */ createFlakes.apply(this) /* 画雪 */ drawSnow.apply(this) } /* 创建画布 */ function snowCanvas() { /* 添加Dom结点 */ var snowcanvas = document.createElement('canvas') snowcanvas.id = 'snowfall' snowcanvas.width = document.body.offsetWidth snowcanvas.height = window.innerHeight snowcanvas.setAttribute('class', `canvas_effects ${mode}`) snowcanvas.setAttribute('style', 'z-index: 9999;') document.getElementsByTagName('body')[0].appendChild(snowcanvas) this.canvas = snowcanvas this.ctx = snowcanvas.getContext('2d') /* 窗口大小改变的处理 */ window.onresize = function() { snowcanvas.width = document.body.offsetWidth snowcanvas.height = window.innerHeight } } /* 雪运动对象 */ function flakeMove(canvasWidth, canvasHeight, flakeSize, fallSpeed) { this.x = Math.floor(Math.random() * canvasWidth) /* x坐标 */ this.y = Math.floor(Math.random() * canvasHeight) /* y坐标 */ this.size = Math.random() * flakeSize + 2 /* 形状 */ this.maxSize = flakeSize /* 最大形状 */ this.speed = Math.random() * 1 + fallSpeed /* 坠落速度 */ this.fallSpeed = fallSpeed /* 坠落速度 */ this.velY = this.speed /* Y方向速度 */ this.velX = 0 /* X方向速度 */ this.stepSize = Math.random() / 30 /* 步长 */ this.step = 0 /* 步数 */ } flakeMove.prototype.update = function() { var x = this.x, y = this.y /* 左右摆动(余弦) */ this.velX *= 0.98 if (this.velY <= this.speed) { this.velY = this.speed } this.velX += Math.cos(this.step += .05) * this.stepSize this.y += this.velY this.x += this.velX /* 飞出边界的处理 */ if (this.x >= canvas.width || this.x <= 0 || this.y >= canvas.height || this.y <= 0) { this.reset(canvas.width, canvas.height) } } /* 飞出边界-放置最顶端继续坠落 */ flakeMove.prototype.reset = function(width, height) { this.x = Math.floor(Math.random() * width) this.y = 0 this.size = Math.random() * this.maxSize + 2 this.speed = Math.random() * 1 + this.fallSpeed this.velY = this.speed this.velX = 0 } // 渲染雪花-随机形状(此处可修改雪花颜色!!!) flakeMove.prototype.render = function(ctx) { var snowFlake = ctx.createRadialGradient(this.x, this.y, 0, this.x, this.y, this.size) snowFlake.addColorStop(0, 'rgba(255, 255, 255, 0.9)') /* 此处是雪花颜色,默认是白色 */ snowFlake.addColorStop(.5, 'rgba(255, 255, 255, 0.5)') /* 若要改为其他颜色,请自行查 */ snowFlake.addColorStop(1, 'rgba(255, 255, 255, 0)') /* 找16进制的RGB 颜色代码。 */ ctx.save() ctx.fillStyle = snowFlake ctx.beginPath() ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2) ctx.fill() ctx.restore() } /* 创建雪花-定义形状 */ function createFlakes() { var maxFlake = this.maxFlake, flakes = this.flakes = [], canvas = this.canvas for (var i = 0; i < maxFlake; i++) { flakes.push(new flakeMove(canvas.width, canvas.height, this.flakeSize, this.fallSpeed)) } } /* 画雪 */ function drawSnow() { const isNight = document.documentElement.classList.contains('night') if (mode === 'all' || (mode === 'day' && !isNight) || (mode === 'night' && isNight)) { var maxFlake = this.maxFlake, flakes = this.flakes ctx = this.ctx, canvas = this.canvas /* 清空雪花 */ ctx.clearRect(0, 0, canvas.width, canvas.height) for (var e = 0; e < maxFlake; e++) { flakes[e].update() flakes[e].render(ctx) } } that = this /* 一帧一帧的画 */ this.loop = requestAnimationFrame(function() { drawSnow.apply(that) }) } /* 调用及控制方法 */ var snow = new snowFall({maxFlake:150}) snow.start() ================================================ FILE: src/js/effects/universe.js ================================================ /** * created by lvfan * 2018-09-04 */ (function drawBg() { window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame // const const starDensity = 0.216 const speedCoeff = 0.05 const mode = DreamConfig.effects_universe_mode const canvas = document.createElement('canvas') // let let width let height let starCount /* no-unused-vars */ // let circleRadius; // let circleCenter; let first = true const giantColor = '180,184,240' const starColor = '226,225,142' const cometColor = '226,225,224' const stars = [] let universe windowResizeHandler() window.addEventListener('resize', windowResizeHandler, false) function windowResizeHandler() { width = window.innerWidth height = window.innerHeight starCount = width * starDensity // circleRadius = (width > height ? height / 2 : width / 2); // circleCenter = { // x: width / 2, // y: height / 2 // }; canvas.setAttribute('width', width) canvas.setAttribute('height', height) canvas.setAttribute('class', `canvas_effects ${mode}`) document.body.insertBefore(canvas, document.body.firstChild) } createUniverse() function createUniverse() { universe = canvas.getContext('2d') for (var i = 0; i < starCount; i++) { stars[i] = new Star() stars[i].reset() } draw() } function draw() { universe.clearRect(0, 0, width, height) var starsLength = stars.length for (var i = 0; i < starsLength; i++) { var star = stars[i] star.move() star.fadeIn() star.fadeOut() star.draw() } } function Star() { this.reset = function () { this.giant = getProbability(3) this.comet = this.giant || first ? false : getProbability(10) this.x = getRandInterval(0, width - 10) this.y = getRandInterval(0, height) this.r = getRandInterval(1.1, 2.6) this.dx = getRandInterval(speedCoeff, 6 * speedCoeff) + (this.comet + 1 - 1) * speedCoeff * getRandInterval(50, 120) + speedCoeff * 2 this.dy = -getRandInterval(speedCoeff, 6 * speedCoeff) - (this.comet + 1 - 1) * speedCoeff * getRandInterval(50, 120) this.fadingOut = null this.fadingIn = true this.opacity = 0 this.opacityTresh = getRandInterval(0.2, 1 - (this.comet + 1 - 1) * 0.4) this.do = getRandInterval(0.0005, 0.002) + (this.comet + 1 - 1) * 0.001 } this.fadeIn = function () { if (this.fadingIn) { this.fadingIn = !(this.opacity > this.opacityTresh) this.opacity += this.do } } this.fadeOut = function () { if (this.fadingOut) { this.fadingOut = !(this.opacity < 0) this.opacity -= this.do / 2 if (this.x > width || this.y < 0) { this.fadingOut = false this.reset() } } } this.draw = function () { universe.beginPath() if (this.giant) { universe.fillStyle = 'rgba(' + giantColor + ',' + this.opacity + ')' universe.arc(this.x, this.y, 2, 0, 2 * Math.PI, false) } else if (this.comet) { universe.fillStyle = 'rgba(' + cometColor + ',' + this.opacity + ')' universe.arc(this.x, this.y, 1.5, 0, 2 * Math.PI, false) // comet tail for (var i = 0; i < 30; i++) { universe.fillStyle = 'rgba(' + cometColor + ',' + (this.opacity - (this.opacity / 20) * i) + ')' universe.rect(this.x - this.dx / 4 * i, this.y - this.dy / 4 * i - 2, 2, 2) universe.fill() } } else { universe.fillStyle = 'rgba(' + starColor + ',' + this.opacity + ')' universe.rect(this.x, this.y, this.r, this.r) } universe.closePath() universe.fill() } this.move = function () { this.x += this.dx this.y += this.dy if (this.fadingOut === false) { this.reset() } if (this.x > width - (width / 4) || this.y < 0) { this.fadingOut = true } }; (function () { setTimeout(function () { first = false }, 50) })() } function getProbability(percents) { return ((Math.floor(Math.random() * 1000) + 1) < percents * 10) } function getRandInterval(min, max) { return (Math.random() * (max - min) + min) } (function drawIfNeeded() { const isNight = document.documentElement.classList.contains('night') if (canvas.classList.contains('all') || (canvas.classList.contains('day') && !isNight) || (canvas.classList.contains('night') && isNight)) { draw() } window.requestAnimationFrame(drawIfNeeded) })() }()) ================================================ FILE: src/js/journals.js ================================================ let journalContextInitial = false const journalContext = { /* 初始化事件 */ initEvent() { if (journalContextInitial) return let $body = $('body') // 展开和关闭评论区事件 $body.on('click', '.journal .comment', function () { $(this).parent().parent().siblings('.journal-comment').stop().slideToggle(200) }) // 折叠日志区域 $body.on('click', '.journal-content>.expand-done', function () { Utils.foldBlock($(this).parent()) }) $body.on('click', '.journal-operation-item>.share', function () { let $journal = $(this).parents('.journal') let title = '动态: ' + $journal.find('.journal-date>em').text() let desc = $journal.children('.journal-content').children('.main-content').text() DShare.sharePoster({ image: DreamConfig.journals_share_image, title: title, description: desc.length > 220 ? desc.substring(0, 220) + '...' :desc }) }) Utils.initLikeEvent('.journal .like', 'journals', ($elem) => $elem.find('em')) journalContextInitial = true }, /* 点赞 */ initLike() { Utils.initLikeButton('.journal .like', 'journals') }, /* 折叠日志区域 */ foldJournals() { const $journals = $('.journal .journal-content') $journals.each(function () { const $this = $(this) if (this.scrollHeight >= DreamConfig.journals_fold_height) { $this.append('
    ') } else { $this.removeClass('fold') } }) }, } window.journalPjax = function (serialNumber) { if ($('.card.journal').length === 0) return Object.keys(journalContext).forEach( (c) => window.pjaxSerialNumber === serialNumber && journalContext[c]() ) } !(function () { !window.pjaxSerialNumber && journalContext.initEvent() !window.pjaxSerialNumber && journalContext.initLike() document.addEventListener('DOMContentLoaded', function () { !window.pjaxSerialNumber && journalContext.foldJournals() }) })() ================================================ FILE: src/js/mew-custom.js ================================================ class MewElement extends HTMLElement { constructor() { super() if (this.hasAttribute('draw')) return this.init() } drawComplete() { this.setAttribute('draw', true) } } document.addEventListener('DOMContentLoaded', () => { customElements.define( 'mew-hide', class MewHide extends MewElement { init() { let $this = $(this) const $mainContent = $this.closest('.main-content') this.options = { target: $mainContent.attr('data-target'), id: $mainContent.attr('data-id') } if (this.options.target && this.options.id) { let commentIds = localStorage.getItem(window.encrypt('mew-hide-' + this.options.target)) commentIds = commentIds ? JSON.parse(window.decrypt(commentIds)) : [] if (commentIds.includes(this.options.id)) { $this.before(this.innerHTML) $this.remove() } else { let isToc = $this.find('h1,h2,h3,h4,h5').length !== 0 this.setAttribute('hide', window.encrypt(this.innerHTML)) this.innerHTML = '' if(isToc) { this.setAttribute('toc', true) commonContext.initTocAndNotice() } this.onclick = function () { let $haloComment = $(`halo-comment[id='${this.options.id}'][type='${this.options.target.substring(0, this.options.target.length - 1)}']`) if ($haloComment.length === 0 || $haloComment.is(':hidden')) { return } Utils.animateScroll($haloComment[0], 20, (window.innerHeight || document.documentElement.clientHeight) / 4) } } } this.drawComplete() } } ) customElements.define( 'mew-subtitle', class MewSubtitle extends MewElement { init() { this.innerHTML = `${this.innerText || '默认标题'}` this.drawComplete() } } ) customElements.define( 'mew-music', class MewMusic extends HTMLElement { constructor() { super() this.innerHTML = '音乐播放器加载中...' this.options = { container: this, theme: this.getAttribute('theme') || 'var(--theme)', loop: this.getAttribute('loop') || 'all', autoplay: this.hasAttribute('autoplay') && this.getAttribute('autoplay') !== 'false', lrcType: 3, } if (!('APlayer' in window)) { if (!MewMusic.prototype.load) { MewMusic.prototype.load = true MewMusic.prototype.await = [] new Promise((resolve) => { const $head = $('head') $head.append('') Utils.cachedScript('https://unpkg.com/aplayer@1.10.1/dist/APlayer.min.js') .done(() => resolve()) .fail(() => resolve()) }).then(() => { this.render() MewMusic.prototype.await && MewMusic.prototype.await.forEach(n => n()) }) } else { MewMusic.prototype.await.push(() => this.render()) } } else { this.render() } } render() { if (!('APlayer' in window)) { this.innerHTML = '未开启音乐播放器!' return } // eslint-disable-next-line no-async-promise-executor new Promise(async (resolve) => { if (this.hasAttribute('song')) { this.options.audio = await fetch( 'https://api.i-meto.com/meting/api?server=netease&type=song&id=' + this.getAttribute('song') ).then((response) => response.json()) } else if (this.hasAttribute('playlist')) { this.options.listFolded = this.getAttribute('fold') this.options.order = this.getAttribute('order') this.options.audio = await fetch( 'https://api.i-meto.com/meting/api?server=netease&type=playlist&id=' + this.getAttribute('playlist') ).then((response) => response.json()) } else if (this.hasAttribute('url')) { this.options.audio = [{ name: this.getAttribute('name') || '音乐', url: this.getAttribute('url'), artist: this.getAttribute('artist') || '未知歌手', cover: this.getAttribute('cover'), lrc: this.getAttribute('lrc') || (this.options.lrcType = undefined), }] } else { this.innerHTML = '未指定播放的音乐!' return resolve() } this.aplayer = new APlayer(this.options) resolve() }) } disconnectedCallback() { this.aplayer && this.aplayer.destroy() } } ) customElements.define( 'mew-bilibili', class MewBilibili extends MewElement { init() { this.options = { bvid: this.getAttribute('bvid'), width: /^\d{1,3}%$/.test(this.getAttribute('width')) ? this.getAttribute('width') : '100%', } if (this.options.bvid) { this.style.padding = `calc(${this.options.width} * 0.3) 0` this.innerHTML = `` } else this.innerHTML = 'bvid未填写!' this.drawComplete() } } ) customElements.define( 'mew-tabs', class MewTabs extends MewElement { init() { const $tabPage = $(this).children('mew-tab-page') if ($tabPage.length === 0) { this.innerHTML = '没有标签页!' this.drawComplete() return } let navs = '' let contents = '' let active = false $tabPage.each((index, elem) => { let title = elem.getAttribute('title') || '默认标签' let id = `${index}-${new Date().getTime()}` if (!active && elem.hasAttribute('active')) { active = true navs += `
    ${title}
    ` contents += `
    ${elem.innerHTML}
    ` } else { navs += `
    ${title}
    ` contents += `
    ${elem.innerHTML}
    ` } }) this.innerHTML = `
    ${navs}
    ${contents}
    ` !active && $(this).find('div>div:first-child').addClass('active') this.drawComplete() } connectedCallback() { $(this).find('.tabs-head').on('click', 'div:not(.active)', function () { const $container = $(this).parent().parent() $container.find('.active').removeClass('active') $(this).addClass('active') $container.find($(this).attr('data-id')).addClass('active') }) } } ) customElements.define( 'mew-cloud', class MewCloud extends MewElement { init() { this.options = { type: this.getAttribute('type') || 'default', title: this.innerText || '资源文件分享', url: this.getAttribute('url'), password: this.getAttribute('password'), } const type = { default: '网络来源', 360: '360云盘', bd: '百度网盘', wy: '微云', ali: '阿里云盘', github: 'Github仓库', gitee: 'Gitee仓库', lz: '蓝奏云网盘', } this.innerHTML = `
    ${this.options.title}
    来源:${type[this.options.type] || '网络来源'}${this.options.password ? ' | 提取码:' + this.options.password : ''}
    ` this.drawComplete() } } ) customElements.define( 'mew-progress', class MewProgress extends MewElement { init() { this.options = { value: /^\d{1,3}%$/.test(this.getAttribute('value')) ? this.getAttribute('value') : '50%', color: this.getAttribute('color') || 'var(--theme)', } this.innerHTML = `
    ${this.options.value}
    ` this.drawComplete() } }) customElements.define( 'mew-panel', class MewPanel extends MewElement { init() { this.options = { title: this.getAttribute('title') || '', color: this.getAttribute('color') || 'var(--theme)', } this.innerHTML = `
    ${this.options.title}
    ${this.innerHTML}
    ` this.style.background = this.options.color this.style.color = this.options.color this.drawComplete() } }) customElements.define( 'mew-message', class MewMessage extends MewElement { init() { this.options = { type: /^(success|info|warning|error)$/.test( this.getAttribute('type') ) ? this.getAttribute('type') : 'info', content: this.innerHTML || '消息内容', } this.innerHTML = this.options.content this.setAttribute('type', this.options.type) this.drawComplete() } }) customElements.define( 'mew-hr', class MewHr extends MewElement { init() { this.startColor = this.getAttribute('startColor') || '#01d0ff' this.endColor = this.getAttribute('endColor') || '#fc3e85' this.style.backgroundImage = `repeating-linear-gradient(-45deg, ${this.startColor} 0,${this.startColor} 20%, transparent 0,transparent 35%, ${this.endColor} 0,${this.endColor} 65%, transparent 0,transparent 80%, ${this.startColor} 0,${this.startColor} 100%)` this.drawComplete() } }) customElements.define( 'mew-timeline', class MewTimeline extends MewElement { init() { let content = '' let child = this.firstChild while (child) { if (child.tagName === 'MEW-TIMELINE-TITLE') { content += `
    ${child.innerHTML}
    ` } else if (child.tagName === 'MEW-TIMELINE-ITEM') { const type = child.getAttribute('type') || '' const title = child.getAttribute('title') ? `${child.getAttribute('title')}` : '' content += `
    ${title}
    ${child.innerHTML}
    ` } child = child.nextElementSibling } this.innerHTML = content this.drawComplete() } } ) customElements.define( 'mew-btn', class MewBtn extends MewElement { init() { this.options = { color: this.getAttribute('color') || 'var(--theme)', href: this.getAttribute('href'), target: this.getAttribute('target') || '_blank', icon: this.getAttribute('icon'), } this.innerHTML = `${this.options.icon ? `` : ''}${this.innerHTML}` const btn = this.querySelector('a.mew-btn') this.options.href && (btn.href = this.options.href, btn.target = this.options.target) this.drawComplete() } }) customElements.define( 'mew-quote', class MewQuote extends MewElement { init() { this.options = { avatar: this.getAttribute('avatar'), href: this.getAttribute('href'), name: this.getAttribute('name'), } const avatarElem = this.options.avatar ? `` : '' const nameElem = this.options.name ? `${this.options.name}` : '' this.innerHTML = `
    ${avatarElem}

    ${this.innerHTML}

    ${nameElem}
    ` this.drawComplete() } }) customElements.define( 'mew-link', class MewLink extends MewElement { async init() { this.options = { img: this.getAttribute('img'), href: this.getAttribute('href') || '', title: this.getAttribute('title'), slug: this.getAttribute('slug'), id: this.getAttribute('id'), type: this.getAttribute('type') || 'post', desc: this.innerHTML } if (this.options.id || this.options.slug) { await Utils.request({ url: this.options.id? `/api/content/${this.options.type}s/${this.options.id}` : `/api/content/${this.options.type}s/slug?slug=${this.options.slug}`, method: 'GET', }) .then(res=>{ this.options.img = this.options.img || res.thumbnail this.options.href = this.options.title || res.fullPath this.options.title = this.options.title || res.title this.options.desc = this.options.desc || res.summary }) .catch(error => { this.options.desc = `Error: ${error}` }) } const imageElem = this.options.img ? `` : '' const descElem = this.options.desc ? `${this.options.desc}` : `${this.options.href}` this.innerHTML = `

    ${this.options.title || '我分享了一个网站'}

    ${descElem}
    ${imageElem}
    ` this.drawComplete() } }) customElements.define( 'mew-video', class MewVideo extends MewElement { init() { this.options = { src: this.getAttribute('src'), type: this.getAttribute('type'), autoplay: this.hasAttribute('autoplay') && this.getAttribute('autoplay') !== 'false', controls: this.getAttribute('controls') !== 'false', loop: this.hasAttribute('loop') && this.getAttribute('loop') !== 'false', muted: this.hasAttribute('muted') && this.getAttribute('muted') !== 'false', // 静音播放 preload: this.hasAttribute('preload') && this.getAttribute('preload') !== 'false', poster: this.getAttribute('poster'), // 加载图片 width: /^\d{1,3}%$/.test(this.getAttribute('width')) ? this.getAttribute('width') : '100%', } this.innerHTML = `` this.drawComplete() } }) customElements.define( 'mew-photos', class MewPhotos extends MewElement { init() { if (!($.fn.justifiedGallery)) { if (!MewPhotos.prototype.load) { MewPhotos.prototype.load = true MewPhotos.prototype.await = [] new Promise((resolve) => { Utils.cachedScript('https://unpkg.com/justifiedGallery@3.8.1/dist/js/jquery.justifiedGallery.min.js') .done(() => resolve()) .fail(() => resolve()) }).then(() => { this.render() MewPhotos.prototype.await && MewPhotos.prototype.await.forEach(n => n()) }) } else { MewPhotos.prototype.await.push(() => this.render()) } } else { this.render() } } render() { this.options = { captions: this.hasAttribute('captions') && this.getAttribute('captions') !== 'false', margins: this.getAttribute('margins') || '4' } $(this).find('img').each((i, elem) => { $(elem).wrap(`
    `) }) $(this).justifiedGallery({captions: this.options.captions, margins: this.options.margins}) this.drawComplete() } }) customElements.define( 'mew-raw', class MewRaw extends MewElement { init() { let html = this.innerHTML this.innerHTML = '' const shadowRoot = this.attachShadow({ mode: 'closed' }) shadowRoot.innerHTML = html this.drawComplete() } } ) }) ================================================ FILE: src/js/photos.js ================================================ let photoContextInitial = false let dataPromise = {} let isLoading = false let isEnd = false let queryParams = { page: 0, size: 15, sort: 'createTime,desc', } // 渲染与设置画廊 const renderPhotos = ($photosGallery, data) => { const photosHtml = data.reduce((result, item, index) => { return `${result}
    ${item.name || ''
    }

    ${item.name}

    ${ item.location ? `

    ${item.location}

    ` : '' }

    ${Utils.formatDate(item.takeTime) }

    ${item.description ? `

    ${item.description}

    ` : ''}
    ` }, '') $photosGallery.append(photosHtml) $photosGallery .justifiedGallery({ rowHeight: 200, maxRowHeight: false, maxRowsCount: 0, sizeRangeSuffixes: {}, lastRow: 'nojustify', captions: false, waitThumbnailsLoad: true, //等待图片加载完,这样就可以根据图片比例展示,如果为false,则都是统一比例 margins: 10, extension: /\.(jpe?g|png|gif|bmp|webp)$/, cssAnimation: false, }) } /* 获取相册数据 */ const getData = ($photosGallery, param) => { isLoading = true $photosGallery.addClass('loading') param && param.team && (param.team = param.team.substring(2)) const params = {...queryParams, ...(param || {})} dataPromise.promise = new Promise((resolve, reject) => { dataPromise.abort = reject Utils.request({ url: '/api/content/photos', method: 'GET', data: params, }) .then((res) => resolve(res)) .catch((err) => reject(err)) }) .then((res) => { const photoContents = res.content || [] if (photoContents.length !== 0) { renderPhotos($photosGallery, photoContents) isEnd = res.isLast } else { isEnd = true } }) .catch((err) => console.log(err)) .finally(() => { $photosGallery.removeClass('loading') dataPromise = {} isLoading = false }) } // 重置列表 const reset = async ($photosGallery, param) => { if (dataPromise) { dataPromise.abort && dataPromise.abort('abort') await dataPromise.promise } $photosGallery.empty() isEnd = false isLoading = false queryParams.page = 0 location.hash = param.team getData($photosGallery, param) } const photoContext = { /* 初始化事件 */ initEvent() { if (photoContextInitial) return // 分组过滤 $('body').on('click', '.photos-teams .item', function (e) { e.stopPropagation() const $this = $(this) if ($this.hasClass('active')) return $this.addClass('active').siblings('li').removeClass('active') reset($('.photos-gallery'), {team: $this.attr('data-team')}) }) // 滚动加载 window.addEventListener( 'scroll', function () { let $photosGallery = $('.photos-gallery') if ($photosGallery.length !== 0 && $(window).scrollTop() + $(window).height() >= $photosGallery.height()) { if (isLoading || isEnd) return queryParams.page++ getData($photosGallery,{ team: $('.photos-teams li.active').attr('data-team') }) } } ) photoContextInitial = true }, /* 初始化相册列表 */ initPhotos() { const $photosGallery = $('.photos-gallery') // 从新初始化参数 dataPromise = {} isLoading = false isEnd = false queryParams = { page: 0, size: 15, sort: 'createTime,desc', } // 读取变量 if (location.hash) { let team = decodeURI(location.hash.substring(1)) let teamElem = $('.photos-teams li[data-team=' + team + ']') teamElem.length > 0 ? teamElem.click() : $('.photos-teams li:not([data-team])').addClass('active') && getData($photosGallery) } else { $('.photos-teams li:not([data-team])').addClass('active') getData($photosGallery) } }, } window.photoPjax = function (serialNumber) { if ($('.photos-gallery').length === 0) return Object.keys(photoContext).forEach( (c) => window.pjaxSerialNumber === serialNumber && photoContext[c]() ) } !(function () { !window.pjaxSerialNumber && photoContext.initEvent() !window.pjaxSerialNumber && photoContext.initPhotos() })() ================================================ FILE: src/js/pjax.js ================================================ const cssLoadCompletes = new Set($('link[href*=".css"]').map((i, item) => $(item).attr('href')).get()) const jsLoadCompletes = new Set($('script[src*=".js"]').map((i, item) => $(item).attr('src')).get()) // 为pjax请求创建一个序列号 const createSerialNumber = () => { const serialNumber = new Date().getTime() window.pjaxSerialNumber = serialNumber console.log(`sn = ${serialNumber}`) return serialNumber } const $bulletScreen = $('.actions>.bullet-screen') // pjax请求时进行界面预处理 const initPjax = () => { /* 重新加载悬浮导航按钮 */ if ($('halo-comment[bullet-screen]').length === 0) { $bulletScreen.addClass('is-hidden-all') } else { $bulletScreen.removeClass('is-hidden-all') } } const computeScrollTop = (target) => { // 当前为横幅大图模式,处理滚动 if (target.pathname !== '/' && $('.banner').length !== 0) { // 避免跳转时顶部导航栏收缩 window.initTop = 99999999 return window.innerHeight / 4 } return 0 } const syncLoadScripts = ($scripts, i, resolve) => { if (i >= $scripts.length) { resolve && resolve() return } let src = $($scripts[i]).attr('src') if (jsLoadCompletes.has(src)) { syncLoadScripts($scripts, i + 1, resolve) return } console.log((resolve ? '同步' : '异步') + '顺序加载js ' + src) Utils.cachedScript(src) .done(function () { console.log((resolve ? '同步' : '异步') + '顺序加载js完成 ' + src) jsLoadCompletes.add(src) window.DProgress && DProgress.inc() syncLoadScripts($scripts, i + 1, resolve) }) .fail(function () { console.log((resolve ? '同步' : '异步') + '顺序加载js失败 ' + src) syncLoadScripts($scripts, i + 1, resolve) }) } /** * 第二个参数是容器,即将被替换的内容 * fragment:是加载的文本中被选中的目标内容 */ $(document).on('click', 'a[target!=_blank][href]:not(data-not-pjax)', (event) => { $.pjax.click(event, '.column-main', { scrollTo: computeScrollTop(event.currentTarget), fragment: '.column-main', serialNumber: createSerialNumber(), timeout: 8000, }) }) $(document).on('submit', 'form[data-pjax]', function (event) { $.pjax.submit(event, '.column-main', { scrollTo: 0, fragment: '.column-main', serialNumber: createSerialNumber(), timeout: 8000, }) }) $(document).on('pjax:click', function (event, options) { console.log('------------------------') console.log(`pjax:click sn = ${options.serialNumber}`) }) $(document).on('pjax:beforeSend', function (event, xhr, options) { console.log(`pjax:beforeSend sn = ${options.serialNumber}`) $('html').addClass('pjax-loading') }) $(document).on('pjax:start', function (event, xhr, options) { console.log(`pjax:start sn = ${options.serialNumber}`) window.DProgress && DProgress.start() $('.pjax-close').remove() }) $(document).on('pjax:send', function (event, xhr, options) { console.log(`pjax:send sn = ${options.serialNumber}`) }) $(document).on('pjax:clicked', function (event, options) { console.log(`pjax:clicked sn = ${options.serialNumber}`) }) /** * pjax加载和浏览器前进后退都会触发的事件 * 在此处需要进行一些未进行pjax也需要执行的程序 */ $(document).on('pjax:beforeReplace', function (event, contents, options) { console.log(`pjax:beforeReplace sn = ${options.serialNumber}`) /* 重新初始化导航条高亮 */ $('.navbar-nav .current,.panel-side-menu .current').removeClass('current') commonContext.initNavbar() /* 移动端关闭抽屉弹窗 */ $('html.disable-scroll').length > 0 && $('.navbar-mask').trigger('click') }) /** * pjax 替换内容成功之后 * 浏览器前进后退时不会执行 */ $(document).on('pjax:success', async function (event, data, status, xhr, options) { const serialNumber = options.serialNumber console.log(`pjax:success sn = ${serialNumber}`) if (window.pjaxSerialNumber !== serialNumber) return /* 重新激活图片预览功能 */ commonContext.initGallery() /* 重新加载目录和公告 */ commonContext.initTocAndNotice() /* 初始化pjax加载 */ initPjax() /* 已经完成页面渲染 */ $('html').removeClass('pjax-loading') const $currentTarget = $($.parseHTML(data, document, true)) const $head = $('head') $head.find('meta').remove() $head.append($currentTarget.filter('meta')) $currentTarget.filter('link[data-pjax]').each(function () { let href = $(this).attr('href') if (!cssLoadCompletes.has(href)) { $head.append($(this)) console.log('加载css ' + $(this).attr('href')) this.onload = function () { cssLoadCompletes.add(href) window.DProgress && DProgress.inc() console.log('加载css完成 ' + $(this).attr('href')) } } }) let $scripts = $currentTarget.filter('script[data-pjax]') if ($scripts.length > 0) { $scripts.filter('[async]').each(function () { let src = $(this).attr('src') if (jsLoadCompletes.has(src)) { return } console.log('异步无序加载js ' + src) Utils.cachedScript(src) .done(function () { console.log('异步无序js完成 ' + src) window.DProgress && DProgress.inc() jsLoadCompletes.add(src) }) .fail(function () { console.log('异步无序js失败 ' + src) }) }) new Promise(() => { syncLoadScripts($scripts.filter('[defer]'), 0) }) let $syncScripts = $scripts.filter(':not([async]):not([defer])') $syncScripts.length > 0 && await new Promise((resolve) => { syncLoadScripts($syncScripts, 0, resolve) }) } console.log('全部处理完成') if (window.pjaxSerialNumber !== serialNumber) return /* 初始化日志界面 */ window.journalPjax && window.journalPjax(serialNumber) /* 初始化文章界面 */ window.postPjax && window.postPjax(serialNumber) /* 初始化相册界面 */ window.photoPjax && window.photoPjax(serialNumber) /* 初始化轮播 */ commonContext.initCarousel() /* 加载主动推送或统计脚本 */ commonContext.loadMaintain() window.DProgress && DProgress.done() }) $(document).on('pjax:timeout', function (event, xhr, options) { console.log(`pjax:timeout sn = ${options.serialNumber}`) }) $(document).on('pjax:error', function (event, xhr, textStatus, error, options) { console.log(`pjax:error sn = ${options.serialNumber} error ${error}`) }) // pjax结束 $(document).on('pjax:complete', function (event, xhr, textStatus, options) { console.log(`pjax:complete sn = ${options.serialNumber}`) }) /** * pjax结束,无论是pjax加载还是浏览器前进后退都会被调用 * 浏览器前进后退时,唯一一个在渲染后被调用的方法 */ $(document).on('pjax:end', function (event, xhr, options) { console.log(`pjax:end sn = ${options.serialNumber}`) // 如果是浏览器前进后退 if (xhr == null) { /* 重新加载目录和公告 */ commonContext.initTocAndNotice() /* 初始化pjax加载 */ initPjax() /* 初始化轮播 */ commonContext.initCarousel() window.DProgress && DProgress.done() // 应该是由于浏览器缓存失效,有时候浏览器前后退还是会执行pjax:beforeSend $('html').removeClass('pjax-loading') } }) $(document).on('pjax:popstate', function () { console.log('pjax:popstate') }) ================================================ FILE: src/js/post.js ================================================ let postContextInitial = false const postContext = { /* 初始化代码块 */ initCodeBlock() { const $code = $('*:not(figure) > pre > code') if ($code.length === 0) return $code.each(function (index) { const $pre = $(this).parent() let clazz = $(this).attr('class') // 通过class初始化代码块标题和是否默认关闭 let title = '' let lines = false let isClose = false if (clazz != null) { let str1 = clazz.match(/[|<](.*)$/) let str2 = clazz.match(/:select/) if (str1 || str2) { let num = 0 if (str2) { num = str2.index if (str1) { if (str1[1].endsWith(str2[0])) { str1[1] = str1[1].substring(0, str1[1].length - str2[0].length) } } else { title = clazz.substring(9, str2.index) } lines = true } if (str1) { num = str1.index < num ? str1.index : num if (str1[0][0] === '<') { isClose = true } title = str1[1] } $(this).attr('class', clazz.substring(0, num)) if (!title) title = clazz.substring(9, num) } else { title = clazz.substring(9) } } // 生成行号 let codes = $(this).text().split('\n') || [] let nums = codes.length - 1 let lineDigit = String(nums).length if (lineDigit === 1) lineDigit = 2 let lis = '' for (var i = 0; i < nums; i++) { lis += `
  • ${String(i + 1).padStart(lineDigit, 0)}
  • ` } if (lines) { $(this).text($(this).text().replace(/(^\s*)\|\+\s/gm,'$1')) } // 代码块的id,用于代码块复制和折叠 let id = `codeBlock${index}-${new Date().getTime()}` let close = '' if (isClose) { close = ' close' $(this).parent().hide() } // 生成标题栏的按钮 let titleButton = `
    ` // 组装代码块 $(this).attr('id', id) $pre.prepend(`
      ${lis}
    `) if (nums > DreamConfig.code_fold_line) { $pre.wrap('
    ').append('
    ') } else { $pre.wrap('
    ') } $pre.parent().prepend(`
    ${title}${titleButton}
    `) }) }, /* 初始化文艺模式 */ initLiterature() { $('.literature-content>p:not([class]),.literature-content>mew-hide>p:not([class])').each(function () { if ($(this).children(':not(code,a,strong,em,ins,b,s,br,span.pwd,img[class=emoji])').length === 0) { $(this).addClass('note') } }) }, /* 初始化喜欢功能 */ /* 点赞 */ initLike() { Utils.initLikeButton('.admire .agree.like', 'posts') }, /* 代码块高亮 */ initHighlighting() { // 初始化代码块高亮工具 hljs.initHighlightingOnLoad() }, /** * 初始化分享 */ initShare() { if (!window.DShare) return let imageUrl = $('.cover-image').css('background-image') imageUrl && (imageUrl = imageUrl.substring(5, imageUrl.length - 2)) DShare.create('.dshare', {image: imageUrl, imageSelector: '.main-content'}) }, /* 代码块复制 */ initClipboard() { if (window.clipboard) { return } // 初始化代码块复制插件,一个界面仅需初始化一次 window.clipboard = new ClipboardJS('.btn-clipboard') clipboard.on('error', function (e) { e.clearSelection() Qmsg.error('您的浏览器不支持复制') }) clipboard.on('success', function () { Qmsg.success('复制成功') }) }, /* 初始化图片折叠 */ foldImage() { if (!DreamConfig.img_fold_height) return const $galleryList = $('.article .gallery-item>[data-fancybox]>img') $galleryList.parent().addClass('fold') $galleryList.each(function () { const $gallery = $(this).parent() if (this.complete) { if (this.scrollHeight >= DreamConfig.img_fold_height) { $gallery.append('
    ') } else { $gallery.removeClass('fold') } } else { this.onload = function () { if (this.scrollHeight >= DreamConfig.img_fold_height) { $gallery.append('
    ') } else { $gallery.removeClass('fold') } } } }) }, /* 初始化事件 */ initEvent() { if (postContextInitial) return let $body = $('body') // 代码块展开和关闭点击事件 $body.on('click', 'figure>figcaption .ri-arrow-down-s-line', function () { let $this = $(this) if ($this.is('.close')) { $($this.attr('data-code')).parent().slideDown(200) $this.removeClass('close') } else { $($this.attr('data-code')).parent().slideUp(200) $this.addClass('close') } }) // 代码内容块展开和折叠点击事件 $body.on('click', 'figure > pre > .expand-done', function () { Utils.foldBlock($(this).parent().parent()) }) // 图片的展开和折叠事件 $body.on('click', '.gallery-item .expand-done', function (e) { e.stopPropagation() Utils.foldBlock($(this).parent()) }) // 喜欢 Utils.initLikeEvent('.admire .agree.like', 'posts', ($elem) => $elem.find('span').find('span')) // 隐藏内容 window.onCommentSuccessEvent = (comment, target) => { let name = encrypt('mew-hide-' + target) let commentIds = localStorage.getItem(name) commentIds = commentIds ? JSON.parse(decrypt(commentIds)) : [] let id = String(comment.postId) if (commentIds.includes(id)) { return } commentIds.push(id) $(`.main-content[data-target='${target}'][data-id='${id}'] mew-hide[hide]`) .each(function () { $(this).before(decrypt(this.getAttribute('hide'))) $(this).remove() commonContext.initGallery() postContext.initCodeBlock() postContext.initLiterature() postContext.initHighlighting() if (this.getAttribute('toc') === 'true') commonContext.initTocAndNotice() }) localStorage.setItem(name, encrypt(JSON.stringify(commentIds))) } postContextInitial = true }, } window.postPjax = function (serialNumber) { if ($('.main-content').length === 0) return Object.keys(postContext).forEach( (c) => window.pjaxSerialNumber === serialNumber && postContext[c]() ) } !(function () { const advances = ['initCodeBlock', 'initLiterature', 'initLike', 'foldImage', 'initEvent'] Object.keys(postContext).forEach( (c) => !window.pjaxSerialNumber && advances.includes(c) && postContext[c]() ) document.addEventListener('DOMContentLoaded', function () { Object.keys(postContext).forEach( (c) => !window.pjaxSerialNumber && !advances.includes(c) && postContext[c]() ) }) })() ================================================ FILE: src/js/settings.js ================================================ (function () { if (!window.initDreamSettings) { const styleContent = ` .dream-option { display: block; position: fixed; width: 50px; height: 50px; z-index: 1000; right: 30px; border-radius: 50%; background: #50bfff; padding: 10px; } .dream-option svg { width: 32px; height: 32px; stroke-width: 10; animation: zy 2.5s .15s linear infinite; -moz-animation: zy 2.5s .15s linear infinite; /* Firefox */ -webkit-animation: zy 2.5s .15s linear infinite; /* Safari and Chrome */ -o-animation: zy 2.5s .15s linear infinite; /* Opera */ } .dream-option path { stroke-width: 30; stroke: #fff; fill: #fff; } .dream-option:after { content: ''; border-radius: 50%; transition: all 0.4s; } .dream-option:hover:after { text-align: center; line-height: 1em; white-space: pre; display: grid; align-items: center; font-size: 12px; color: #FFF; font-weight: 600; position: absolute; width: 100%; height: 100%; left: 0; top: 0; background: rgb(29 98 156 / 30%); } .dream-option:hover .option-cover { opacity: 1; right: 0; } .option-cover { position: absolute; opacity: 0; width: 360px; max-width: 80vw; right: -400px; bottom: 60px; border-radius: 8px; transition: all .5s; } .official-account { bottom: 120px; } .official-account:hover:after { content: '微信\\A公众号'; } .customer { bottom: 60px; } .customer:hover:after { content: 'DREAM\\A交流'; } @-webkit-keyframes zy{ 10% { transform: rotate(15deg); } 20% { transform: rotate(-10deg); } 30% { transform: rotate(5deg); } 40% { transform: rotate(-5deg); } 50%,100% { transform: rotate(0deg); } }` const style = document.createElement('style') style.appendChild(document.createTextNode(styleContent)) document.getElementsByTagName('head')[0].appendChild(style) window.initDreamSettings = true } const officialAccountSvg = '' const customerSvg = '' const officialAccountText = `` const customerText = `${customerSvg}` function parse2dom(str){ const div = document.createElement('div') div.innerHTML = str return div.childNodes[0] } if (document.getElementsByClassName('dream-option').length === 0) { const contentElem = document.getElementsByClassName('content')[0] let tabsElems = contentElem.getElementsByClassName('ant-tabs-content') for(let elem of tabsElems) { elem.classList.add('dream-bg') } contentElem.appendChild(parse2dom(officialAccountText)) contentElem.appendChild(parse2dom(customerText)) } })() ================================================ FILE: src/js/spark-input.js ================================================ const sparkInput = function(element, list) { function randomColor() { return colors[Math.floor(Math.random() * colors.length)] } function randomCode() { return String.fromCharCode(94 * Math.random() + 33) } function buildFragment(r) { for (var fragment = document.createDocumentFragment(), i = 0; r > i; i++) { var span = document.createElement('span') span.textContent = randomCode(), span.style.color = randomColor(), fragment.appendChild(span) } return fragment } function start() { var msg = messages[entry.skillI] if(entry.step) { entry.step-- } else { entry.step = step if(entry.prefixP < message.length) { (entry.prefixP >= 0 && (entry.text += message[entry.prefixP]), entry.prefixP++) } else { if('forward' === entry.direction) { if(entry.skillP < msg.length) { (entry.text += msg[entry.skillP], entry.skillP++) } else { if(entry.delay){ entry.delay-- } else { entry.direction = 'backward' entry.delay = delay } } }else{ if(entry.skillP > 0) { entry.text = entry.text.slice(0, -1) entry.skillP-- } else { entry.skillI = (entry.skillI + 1) % messages.length entry.direction = 'forward' } } } } element.textContent = entry.text, element.appendChild(buildFragment(entry.prefixP < message.length ? Math.min(prefixP, prefixP + entry.prefixP) : Math.min(prefixP, msg.length - entry.skillP))), setTimeout(start, sleep) } var message = '', messages = list.map(function (s) { return s + '' }), delay = 2, // 彩字显示需要的步骤 step = 1, // 乱码最大长度 prefixP = 5, // 时间间隔 sleep = 75, colors = ['rgb(110,64,170)', 'rgb(150,61,179)', 'rgb(191,60,175)', 'rgb(228,65,157)', 'rgb(254,75,131)', 'rgb(255,94,99)', 'rgb(255,120,71)', 'rgb(251,150,51)', 'rgb(226,183,47)', 'rgb(198,214,60)', 'rgb(175,240,91)', 'rgb(127,246,88)', 'rgb(82,246,103)', 'rgb(48,239,130)', 'rgb(29,223,163)', 'rgb(26,199,194)', 'rgb(35,171,216)', 'rgb(54,140,225)', 'rgb(76,110,219)', 'rgb(96,84,200)'], entry = { text: '', prefixP: -prefixP, skillI: 0, skillP: 0, direction: 'forward', delay: delay, step: step } start() } window.sparkInput = sparkInput ================================================ FILE: src/js/sw.js ================================================ (function () { if (self.document) { const currentScriptUrl = document.currentScript.src const uninstall = new URLSearchParams(currentScriptUrl.split('?')[1]).get('uninstall') if (uninstall) { console.log('uninstall service worker.') navigator.serviceWorker.getRegistrations().then(function (registrations) { for (let registration of registrations) { registration.active && registration.active.scriptURL && registration.active.scriptURL.indexOf('/sw.min.js') !== -1 && registration.unregister() } }) window.caches && caches.keys && caches.keys().then(function (keys) { keys.forEach(function (key) { console.log('delete cache', key) caches.delete(key) }) }) } else { navigator.serviceWorker.register(document.currentScript.src) .catch(function (error) { console.log('cache failed with ' + error) // registration failed }) } } else { //可以进行版本修改,删除缓存 const version = '1.0.0' // 取得缓存名称 const cacheName = `Dream-${version}` // 取得请求参数 const envParams = new URLSearchParams(location.href.split('?')[1]) // 是否开启多cdn源并发请求 const isCdnConcurrentRequest = envParams.get('concurrent') // 是否开启全站缓存 const isGlobalCache = envParams.get('cache') // 主题路径 const themePath = location.origin + '/themes/dream' // cdn源站点,一行一个 const cdnSource = envParams.get('cdn').split(',').filter(item => item.length > 0 && item.indexOf('http') === 0) // 禁止被处理(优先级别最高) // 后端 api 不进行缓存 const notHandleList = [ location.origin + '/api', ] // 需要走cdn和缓存的请求(cdn优先于缓存) const cdnAndCacheList = [ themePath, ...cdnSource ] //对这里面的请求只会走缓存,先缓存后下载 // jsdeliver cdn 不稳定,只走缓存 const onlyCacheList = [ location.origin + '/upload', 'https://cdn.jsdelivr.net/' ] const cdnHandle = { theme: { handleRequest: url => { if (url.indexOf(themePath) !== 0) return const path = url.substring(themePath.length) const version = new URLSearchParams(url.split('?')[1]).get('mew') || 'latest' return [ url, ...cdnSource.map(value => `${value}/halo-theme-dream@${version}${path}`) ] }, }, npm: { handleRequest: url => { for (let index in cdnSource) { if (url.indexOf(cdnSource[index]) === 0) { const path = url.substring(cdnSource[index].length) return cdnSource.map(value => value + path) } } } }, } /** * 判断ur是否符合list列表中的要求 * * @param list * @param url * @returns {boolean} */ function isExitInUrlList(list, url) { return list.some(function (value) { return url.indexOf(value) === 0 }) } /** * 判断两个url是否属于同一个请求,过滤掉部分参数 * * @param urla * @param urlb * @returns {boolean} */ function isSameRequest(urla, urlb) { // 除了这这些参数,其它的查询参数必须要一致,才认为是同一个请求 const white_query = new Set([ 'mew', // 自定义的版本号 'v', 'version', 't', 'time', 'ts', 'timestamp' ]) const a_url = urla.split('?') const b_url = urlb.split('?') if (a_url[0] !== b_url[0]) { return false } const a_params = new URLSearchParams('?' + a_url[1]) const b_params = new URLSearchParams('?' + b_url[1]) // 显示所有的键 for (const key of a_params.keys()) { if (white_query.has(key)) {//对于版本号的key 忽略 continue } if (a_params.get(key) !== b_params.get(key)) {//其它key的值必须相等,比如type=POST 这种 return false } } return true } //添加缓存 self.addEventListener('install', function (event) { console.log('install service worker.') event.waitUntil(self.skipWaiting()) //这样会触发activate事件 }) // 激活 self.addEventListener('activate', function (event) { console.log('service worker activate.') const mainCache = [cacheName] event.waitUntil( caches.keys().then(function (cacheNames) { return Promise.all( cacheNames.map(function (cacheName) { if (mainCache.indexOf(cacheName) === -1) {//没有找到该版本号下面的缓存 // When it doesn't match any condition, delete it. console.info('version changed, clean the cache, SW: deleting ' + cacheName) return caches.delete(cacheName) } }) ) }) ) return self.clients.claim() }) // 拦截请求使用缓存的内容 self.addEventListener('fetch', function (event) { // 非 get 请求不处理,被禁止处理的地址不处理 if (event.request.method !== 'GET' || isExitInUrlList(notHandleList, event.request.url)) { return false } const isCdnAndCache = isExitInUrlList(cdnAndCacheList, event.request.url) const isOnlyCacheList = isExitInUrlList(onlyCacheList, event.request.url) // cdn并发请求未开启 或 请求没有被任何路由命中 if (!isCdnConcurrentRequest || !(isCdnAndCache || isOnlyCacheList)) { // 不需要全站离线 if (!isGlobalCache) { return false } // 先发起请求,如果请求失败则读取离线缓存 event.respondWith(caches.open(cacheName) .then(cache => { return fetch(event.request) .then((response) => { if (response.status === 200) cache.put(event.request, response.clone()) return response }) .catch(() => cache.match(event.request)) }) ) return true } // 劫持 HTTP Request event.respondWith( caches.open(cacheName).then(function (cache) { // 查找缓存 return cache.match(event.request).then(function (cacheResponse) { // 直接返回缓存 if (cacheResponse) return cacheResponse return handleRequest(event.request, isCdnAndCache) .then((response) => { const responseClone = response.clone() // ignoreSearch 忽略请求参数进行查找,用于匹配不同版本 cache.matchAll(event.request, {'ignoreSearch': true}) .then(function (cache_response_list) { // 删除旧版本的缓存文件 if (cache_response_list) { for (const cache_response of cache_response_list) { const responseUrl = cache_response.url || cache_response.headers.get('service-worker-origin') if (isSameRequest(responseUrl, event.request.url)) { cache.delete(responseUrl) } } } cache.put(event.request, responseClone) }) return response }) .catch(error => { console.error(error) return cache.matchAll(event.request, {'ignoreSearch': true}) .then(function (cache_response_list) { // 从缓存中取得历史版本的文件 if (cache_response_list) { for (const cache_response of cache_response_list) { if (isSameRequest(cache_response.url || cache_response.headers.get('service-worker-origin'), event.request.url)) { return cache_response } } } }) }) }) }) ) }) /** * 处理匹配的请求 * @param req * @param isCdnAndCache * @returns {Promise|*} */ function handleRequest(req, isCdnAndCache) { // 不是cdn缓存或者未开启cdn并发,直接进行查询并返回 if (!isCdnAndCache || !isCdnConcurrentRequest) return fetch(req) // 匹配 cdn for (const type in cdnHandle) { const urls = cdnHandle[type].handleRequest(req.url) if (urls) return fetchAny(req.url, urls) } // 没有匹配到url,直接发起请求 return fetch(req) } // Promise.any 的 polyfill function createPromiseAny() { Promise.any = function (promises) { return new Promise((resolve, reject) => { promises = Array.isArray(promises) ? promises : [] let len = promises.length let errs = [] if (len === 0) return reject(new AggregateError('All promises were rejected')) promises.forEach((p) => { if (!(p instanceof Promise)) return reject(p) p.then( (res) => resolve(res), (err) => { len-- errs.push(err) if (len === 0) reject(new AggregateError(errs)) } ) }) }) } } // 发送所有请求 function fetchAny(originUrl, urls) { // 中断一个或多个请求 const controller = new AbortController() const signal = controller.signal // 遍历将所有的请求地址转换为promise const PromiseAll = urls.map((url) => { // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve, reject) => { fetch(url, {signal}) .then(async res => { // 重新封装响应 const newHeaders = new Headers(res.headers) newHeaders.set('service-worker-origin', originUrl) return new Response(await res.arrayBuffer(), { status: res.status, headers: newHeaders, }) }) .then((res) => { if (res.status !== 200) { reject(res) return } controller.abort() // 中断 resolve(res) }) .catch(() => reject(null)) // 去除中断的错误信息 }) }) // 判断浏览器是否支持 Promise.any if (!Promise.any) createPromiseAny() // 谁先返回"成功状态"则返回谁的内容 return Promise.any(PromiseAll) } } })() ================================================ FILE: src/js/utils.js ================================================ class Emoji { constructor(name, fileName) { this.name = name this.fileName = fileName } } const emojiData = [ new Emoji('呵呵', 'hehe'), new Emoji('哈哈', 'haha'), new Emoji('吐舌', 'tushe'), new Emoji('啊', 'a'), new Emoji('酷', 'ku'), new Emoji('怒', 'nu'), new Emoji('开心', 'kaixin'), new Emoji('汗', 'han'), new Emoji('泪', 'lei'), new Emoji('黑线', 'heixian'), new Emoji('鄙视', 'bishi'), new Emoji('不高兴', 'bugaoxing'), new Emoji('真棒', 'zhenbang'), new Emoji('钱', 'qian'), new Emoji('疑问', 'yiwen'), new Emoji('阴险', 'yingxiang'), new Emoji('吐', 'tu'), new Emoji('咦', 'yi'), new Emoji('委屈', 'weiqu'), new Emoji('花心', 'huaxin'), new Emoji('呼~', 'hu'), new Emoji('笑眼', 'xiaoyan'), new Emoji('冷', 'len'), new Emoji('太开心', 'taikaixin'), new Emoji('滑稽', 'huaji'), new Emoji('勉强', 'mianqiang'), new Emoji('狂汗', 'kuanhan'), new Emoji('乖', 'guai'), new Emoji('睡觉', 'shuijiao'), new Emoji('惊哭', 'jingku'), new Emoji('生气', 'shengqi'), new Emoji('惊讶', 'jingya'), new Emoji('喷', 'pen'), new Emoji('突然兴奋', 'turanxingfen'), new Emoji('挖鼻', 'wabi'), new Emoji('摊手', 'tanshou'), new Emoji('捂嘴笑', 'wuzuixiao'), new Emoji('喝酒', 'hejiu'), new Emoji('犀利', 'xili'), new Emoji('懒得理', 'landeli'), new Emoji('炸药', 'zhayao'), new Emoji('吃瓜', 'chigua'), new Emoji('小乖', 'xiaoguai'), new Emoji('你懂的', 'nidongde'), new Emoji('嘿嘿嘿', 'heiheihei'), new Emoji('欢呼', 'huanhu'), new Emoji('笑尿', 'xiaoniao'), new Emoji('酸爽', 'suanshuang'), new Emoji('紧张', 'jinzhang'), new Emoji('暗中观察', 'anzhongguancha'), new Emoji('小红脸', 'xiaohonglian'), new Emoji('呀咩爹', 'yamiedie'), new Emoji('微微一笑', 'weiweiyixiao'), new Emoji('what', 'what'), new Emoji('托腮', 'tuosai'), new Emoji('噗', 'pu'), new Emoji('困成狗', 'kunchenggou'), new Emoji('柯基暗中观察', 'kejianzhongguancha'), new Emoji('菜狗', 'caigou'), new Emoji('老虎', 'laohu'), new Emoji('嗷呜', 'aowu'), new Emoji('奥特曼', 'aoteman'), new Emoji('黑头高兴', 'heitougaoxing'), new Emoji('黑头瞪眼', 'heitoudengyan'), new Emoji('望远镜', 'wangyuanjing'), new Emoji('不听', 'butin'), new Emoji('干饭', 'ganfan'), new Emoji('大拇指', 'damuzhi'), new Emoji('胜利', 'shengli'), new Emoji('haha', 'haha2'), new Emoji('OK', 'ok'), new Emoji('红领巾', 'honglingjin'), new Emoji('爱心', 'aixin'), new Emoji('心碎', 'xinsui'), new Emoji('玫瑰', 'meigui'), new Emoji('礼物', 'liwu'), new Emoji('烟花', 'yanhua'), new Emoji('彩虹', 'caihong'), new Emoji('太阳', 'taiyang'), new Emoji('星星月亮', 'xingxingyueliang'), new Emoji('蛋糕', 'dangao'), new Emoji('茶杯', 'chabei'), new Emoji('香蕉', 'xiangjiao'), new Emoji('便便', 'bianbian'), new Emoji('药丸', 'yaowan'), new Emoji('钱币', 'qianbi'), new Emoji('蜡烛', 'lazhu'), new Emoji('沙发', 'shafa'), new Emoji('音乐', 'yinyue'), new Emoji('灯泡', 'dengpao'), new Emoji('手纸', 'shouzhi') ] const Utils = { /** * 是否移动设备 */ isMobile() { if ( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ) return true return false }, /** * 有缓存的方式加载js */ cachedScript(url, callback) { return $.ajax(jQuery.extend({ url: url, type: 'get', dataType: 'script', cache: true, success: callback }, $.isPlainObject(url) && url)) }, /** * 时间格式化 * @param {*} time */ formatDate(date, fmt = 'yyyy-MM-dd') { date = new Date(date) if (/(y+)/.test(fmt)) { fmt = fmt.replace( RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length) ) } let o = { 'M+': date.getMonth() + 1, 'd+': date.getDate(), 'h+': date.getHours(), 'm+': date.getMinutes(), 's+': date.getSeconds(), } for (let k in o) { if (new RegExp(`(${k})`).test(fmt)) { let str = o[k] + '' fmt = fmt.replace( RegExp.$1, RegExp.$1.length === 1 ? str : str.padStart(2, '0') ) } } return fmt }, /* 获取URL中带的链接参数 * @param search 链接后缀 * @return {{}} 对象 */ getUrlParams() { var search = location.search // 判断是否为字符串类型 if (typeof search !== 'string') { search = search.toString() } var paramsSplit = search.replace(/^[^\?]*\?/i, '').split(/&/) var params = {} // 数据为空 if (paramsSplit.length < 1) { return params } if (Array.isArray(paramsSplit)) { paramsSplit.forEach(function (item) { // 数据为空, 退出方法 if (!item) { return false } var itemSplit = item.split(/=/) // 判断字符串中是否有多个= if (itemSplit.length >= 2) { // 是 var key = itemSplit.splice(0, 1) params[key] = itemSplit.join('=') } }) } return params }, /* 随机颜色 */ randomColor(factor) { const colors = ['#F8D800', '#0396FF', '#EA5455', '#7367F0', '#32CCBC', '#F6416C', '#28C76F', '#9F44D3', '#F55555', '#736EFE', '#E96D71', '#DE4313', '#D939CD', '#4C83FF', '#F072B6', '#C346C2', '#5961F9', '#FD6585', '#465EFB', '#FFC600', '#FA742B', '#5151E5', '#BB4E75', '#FF52E5', '#49C628', '#00EAFF', '#F067B4', '#F067B4', '#ff9a9e', '#00f2fe', '#4facfe', '#f093fb', '#6fa3ef', '#bc99c4', '#46c47c', '#f9bb3c', '#e8583d', '#f68e5f'] return colors[factor % colors.length] }, /* 请求封装 */ request({ url = '', method = 'GET', data, headers = {}, timeout = 10000, returnRaw = false, }) { return new Promise((resolve, reject) => { method = method.toUpperCase() $.ajax({ url, type: method, headers: { 'API-Authorization': DreamConfig.access_key || 'dream', ...headers, }, async: true, dataType: 'json', timeout, data, success(res) { if (returnRaw) { resolve(res) } else { if (res.status === 200) { resolve(res.data || '') } else { reject(res) } } }, error(err) { const errMsg = err ? err.responseJSON ? err.responseJSON.message : '请求失败' : '请求失败' Qmsg.error(errMsg) reject(errMsg) }, }) }) }, /** * 初始化喜欢按钮 * @param buttonSelect 喜欢按钮的选择器 * @param type 喜欢的类型 */ initLikeButton(buttonSelect, type) { const name = encrypt('agree-' + type) let agrees = localStorage.getItem(name) agrees = agrees ? JSON.parse(decrypt(agrees)) : [] $(buttonSelect).each(function () { let $this = $(this) let id = $this.attr('data-id') // 已经喜欢过了 agrees.includes(id) && $this.removeClass('like') }) }, /** * 初始化喜欢按钮点击事件 */ initLikeEvent(buttonSelect, type, likeNumFunc) { let name = encrypt('agree-' + type) $('body').on('click', buttonSelect, function (e) { e.stopPropagation() let $this = $(this) let id = $this.attr('data-id') Utils.request({ url: '/api/content/' + type + '/' + id + '/likes', method: 'POST', }) .then((_res) => { let agrees = localStorage.getItem(name) agrees = agrees ? JSON.parse(decrypt(agrees)) : [] let likes = +($this.attr('data-likes') || 0) + 1 agrees.push(id) $this.removeClass('like') const val = encrypt(JSON.stringify(agrees)) localStorage.setItem(name, val) // $this.off('click'); likeNumFunc($this).html(likes) Qmsg.success('点赞成功') }) }) }, /* 百度自动推送 */ baiduPush() { let bp = document.createElement('script') let curProtocol = window.location.protocol.split(':')[0] if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js' } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js' } $(`script[src="${bp.src}"]`).remove() let s = document.getElementsByTagName('script')[0] s.parentNode.insertBefore(bp, s) }, toutiaoPush() { let el = document.createElement('script') el.src = 'https://lf1-cdn-tos.bytegoofy.com/goofy/ttzz/push.js?0fbcfbb1ed642c21419d5be02d56ade7d6ee5372ca221d12ba35df110760b2a830632485602430134f60bc55ca391050b680e2741bf7233a8f1da9902314a3fa' el.id = 'ttzz' $(`script[src="${el.src}"]`).remove() let s = document.getElementsByTagName('script')[0] s.parentNode.insertBefore(el, s) }, /* sleep */ sleep(ms = 250) { return new Promise((resolve) => setTimeout(resolve, ms)) }, /* 折叠代码块或者日志块 */ foldBlock($container) { const oldHeight = $container.height() if ($container.is('.fold')) { $container.removeClass('fold').addClass('unfold') } else { const oldScrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset $container.addClass('fold').removeClass('unfold') // 跳转位置,保证折叠后没有过大的位置偏移 $('body,html').scrollTop(oldScrollTop - oldHeight + $container.height()) } }, /** * 删除元素的 class,可根据前缀来删除 * @param {*} el 需要删除的 dom 元素 * @param {*} prefix 需要删除的 class,可以仅为前缀 */ removeClassByPrefix(el, prefix) { const classes = el.className.split(' ').filter(function (c) { return c.lastIndexOf(prefix, 0) !== 0 }) el.className = classes.join(' ').trim() }, /** * 滚动到指定控件 * @param element 需要被跳转到的控件 * @param time 跳转时间 * @param headingsOffset 控件距离页面顶部的距离 * @param callback 跳转完成后执行的函数 */ animateScroll(element, time, headingsOffset, callback) { let rect = element.getBoundingClientRect() let currentY = window.scrollY let targetY = currentY + rect.top - headingsOffset let speed = (targetY - currentY) / time let offset = currentY > targetY ? -1 : 1 let requestId function step() { currentY += speed if (currentY * offset < targetY * offset) { window.scrollTo(0, currentY) requestId = window.requestAnimationFrame(step) } else { window.scrollTo(0, targetY) window.cancelAnimationFrame(requestId) callback && callback() } } requestId = window.requestAnimationFrame(step) }, /** * 表情替换 * @param html * @returns {*} */ renderedEmojiHtml(html) { for (let emoji of emojiData) { let name = emoji.name let img = `${name}` html = html.replace(new RegExp(`\\[/${name}\\]`, 'gm'), img) } return html.replace(/\!\[[^\]]*\]\([^)]*\)/g, '[图片内容]') .replace(/```\w*\n[^`]*\n```/g, '[代码块内容]') .replace(/`([^`]*)`/g, '$1') .replace(/\[([^\]]*)\]\([^)]*\)/g, '$1') .replace(/^#+\s+([^\n]*)/gm, '$1') .replace('\n', ' ') } } window.Utils = Utils ================================================ FILE: tag.ftl ================================================ <#include "template/layout.ftl"> <@layout title="标签:${tag.name!} - ${blog_title!}" canonical="${tag.fullPath!}"> <#if (posts.content)?? && posts.content?size gt 0>
    <#include "template/main/article_list.ftl"> <@article_list posts.content/> <#include "template/main/pagination.ftl"> <@pagination method="tagPosts" datas=posts slug="${tag.slug!}" display="${settings.page_number!5}" /> <#else>
    该标签下没有文章,回主页看看吧
    ================================================ FILE: tags.ftl ================================================ <#include "template/layout.ftl"> <@layout title="标签 - ${blog_title!}" canonical="${tags_url!}"> <@tagTag method="list"> <#if tags?? && tags?size gt 0> <#else>
    还没有创建过标签,回主页看看吧
    ================================================ FILE: template/common/actions.ftl ================================================
    <#if settings.drawer_toc!true>
    ================================================ FILE: template/common/banner.ftl ================================================ ================================================ FILE: template/common/config.ftl ================================================ ================================================ FILE: template/common/footer.ftl ================================================
    ================================================ FILE: template/common/head.ftl ================================================ ${title!}<#if settings.small_title?? && settings.small_title!=''>|${settings.small_title!}</#if> <#if settings.enable_sw?? && settings.enable_sw != "false"> <#assign description=(post??)?then(post.summary!, meta_description!)!user.description!> <@global.head /> <#if settings.theme_style?? && settings.theme_style=='celebration'> <#if post?? || is_journals?? || is_error??> <#assign enable_katex = (metas?? && metas.enable_katex?? && metas.enable_katex?trim!='')?then(metas.enable_katex?trim, (settings.enable_katex!false)?c)> <#if enable_katex=='true'> <#assign enable_share = (post?? && (metas?? && metas.enable_share?? && metas.enable_share?trim!='')?then(metas.enable_share?trim, (settings.enable_post_share!true)?c) == 'true') || (is_journals?? && settings.enable_journals_share!true)> <#if enable_share> <#if is_post?? || is_sheet?? || is_photos?? || is_journals??> <#if settings.cursor_style?? && settings.cursor_style!='none'> <#include "config.ftl"> <#if settings.external_css?? && settings.external_css!=''> <#if settings.inline_css?? && settings.inline_css!=''> ${settings.external_js_head!} <#if settings.inline_js_head?? && settings.inline_js_head!=''> ================================================ FILE: template/common/navbar.ftl ================================================ <#macro navbar> ================================================ FILE: template/common/scripts.ftl ================================================ <#if (sidebar_toc!false) || settings.drawer_toc!true> <#if is_carousel??> <#if post?? || is_journals?? || is_error??> <#if enable_share> <#if is_journals??> <#if is_photos??> <#if enable_comment> <#if settings.load_progress?? && settings.load_progress != 'none'> <#if post?? || is_photos?? || is_journals?? > <#if sidebar_music!false> <#if settings.enable_busuanzi?? && settings.enable_busuanzi!='none'> ${settings.external_js_body!} <#if settings.inline_js_body?? && settings.inline_js_body!=''> <@global.statistics /> ================================================ FILE: template/common/widget.ftl ================================================ <#macro widget position> ================================================ FILE: template/errorpage.ftl ================================================ <#include "layout.ftl"> <#include "main/article_list.ftl"> <#global is_error = true> <#macro errorpage etitle,desc,status,content,message> <@layout title="${status!}错误 - ${blog_title!}" canonical="${blog_url!}/${status!}">
    ${status!}错误 - ${etitle!}
    ${status!}

    ${desc!}

    ${content!}: ${message!}
    <@postTag method="latest" top="6"> <#if posts?? && posts?size gt 0>
    最新文章推荐
    <@article_list posts /> ================================================ FILE: template/layout.ftl ================================================ <#macro layout0 title,canonical> <#if RequestParameters?? && RequestParameters._pjax?? > <#global is_pjax=RequestParameters._pjax> <#include "layout_pjax.ftl"> <@layout_pjax title,canonical><#nested /> <#else> <#include "layout_default.ftl"> <@layout_default title,canonical><#nested /> <#macro layout title,canonical> <#assign enable_comment = (settings.enable_comment!true) && ((post?? && (!post.disallowComment!false)) || (is_journals?? && settings.enable_journals_comment!true) || (is_links?? && settings.link_comment_id?? && settings.link_comment_id!=''))> <#if post?? || is_journals?? || is_error?? || (settings.enable_compress!'none')=='none'> <@layout0 title,canonical><#nested /> <#elseif settings.enable_compress == 'format'> <@compress> <@layout0 title,canonical><#nested /> <#elseif settings.enable_compress == 'single'> <@compress single_line=true> <@layout0 title,canonical><#nested /> ================================================ FILE: template/layout_default.ftl ================================================ <#macro layout_default title,canonical> <#include "common/widget.ftl"> <#import "common/navbar.ftl" as nav> <#include "common/head.ftl"> <@nav.navbar/> <#if settings.enable_banner!false ><#include "common/banner.ftl">
    <#nested />
    <#if !settings.sidebar_column?? || (settings.sidebar_column!='only-right' && settings.sidebar_column!='module-left')> <@widget 'left' /> <#if !settings.sidebar_column?? || (settings.sidebar_column!='only-left' && settings.sidebar_column!='module-right')> <@widget 'right' />
    <#include "common/actions.ftl"> <#include "common/footer.ftl"> <#include "common/scripts.ftl"> ================================================ FILE: template/layout_pjax.ftl ================================================ <#macro layout_pjax title,canonical> <#include "common/head.ftl">
    <#nested />
    <#include "common/scripts.ftl"> ================================================ FILE: template/main/admire.ftl ================================================ <#assign donate = ((metas?? && metas.enable_donate?? && metas.enable_donate?trim!='')?then(metas.enable_donate?trim == 'true', (settings.enable_post_donate!true))) && ((settings.donate_alipay?? && settings.donate_alipay!='') || (settings.donate_wechat?? && settings.donate_wechat!='')) /> <#if donate || !is_sheet??>
    <#if donate> <#if !is_sheet??>
    如果觉得文章对你有用,请随意赞赏
    ================================================ FILE: template/main/article.ftl ================================================ <#macro article post,commentType> <#local thumbnail = (post.thumbnail?? && post.thumbnail!='')?then(post.thumbnail!, (settings.default_thumbnail?? && settings.default_thumbnail!='')?then(settings.default_thumbnail + settings.default_thumbnail?contains('?')?then("&","?") + "postId=" + post.id?c, ''))> <#if thumbnail!=''>
    <#if categories?? && categories?size gt 0>
    <#list categories as category> ${category.name!}

    ${post.title!}

    <#assign updateInterval = ((.now?long - post.updateTime?long)/86400000)?floor > <#if updateInterval gt (settings.invalid_tips_day!'99999999')?number >
    本文最后更新于 ${post.updateTime?string('yyyy-MM-dd')},距今已有 ${updateInterval} 天,若文章内容或图片链接失效,请留言反馈。
    <#if (metas?? && metas.tips?? && metas.tips!='')>
    ${metas.tips}
    <#if thumbnail==''>

    ${post.title!}

    <#if post.categories?? && post.categories?size gt 0>
    <#list post.categories as category> ${category.name!} 

    ${post.formatContent!}
    <#include "admire.ftl"> <#if tags?? && (tags?size gt 0)>
    <#list tags as tag> ${tag.name!} 
    <#assign enable_copyright = (metas?? && metas.enable_copyright?? && metas.enable_copyright?trim!='')?then(metas.enable_copyright?trim, (settings.enable_copyright!true)?c)> <#if enable_copyright == 'true' || enable_share>
    <#if enable_copyright == 'true'> <#include "copyright.ftl"> <#if enable_share>
    <#if nextPost?? || prevPost??>
    <#if prevPost??> ${prevPost.title!} <#if nextPost??> ${nextPost.title!}
    <#if enable_comment>

    评论

    <#include "comment.ftl"> <@comment post.id?c, commentType />
    ================================================ FILE: template/main/article_list.ftl ================================================ <#macro article_list posts> <#list posts as post> <#local thumbnail = (post.thumbnail?? && post.thumbnail!='')?then(post.thumbnail!, (settings.default_thumbnail?? && settings.default_thumbnail!='')?then(settings.default_thumbnail + settings.default_thumbnail?contains('?')?then("&","?") + "postId=" + post.id?c, ''))> <#if is_first_index?? && thumbnail != '' && !(post.topPriority!=1 || !post.metas?? || (post.metas.index_carousel!'false')=='false')> <#continue> <#local thumbnail_mode = ((settings.top_thumbnail_mode!'default')=='grid' || (post.topPriority==0 && (settings.thumbnail_mode!'default')=='grid'))?then( 'grid', (post.metas?? && (post.metas.thumbnail_mode!'')?trim!='')?then(post.metas.thumbnail_mode?trim, (post.topPriority==1)?then(settings.top_thumbnail_mode!'back', settings.thumbnail_mode!'default')))> <#if thumbnail != '' && thumbnail_mode == "back"> <#elseif thumbnail != '' && (thumbnail_mode == "small" || (thumbnail_mode == "small-alter" && post_index%2 == 0))>

    <#if post.topPriority==1>置顶${post.title!}

    ${post.summary!}

    <#if post.categories?? && post.categories?size gt 0>
    <#list post.categories as category> ${category.name!} 
    <#elseif thumbnail != '' && (thumbnail_mode == "small-right" || (thumbnail_mode == "small-alter" && post_index%2 == 1))>

    <#if post.topPriority==1>置顶${post.title!}

    ${post.summary!}

    <#if post.categories?? && post.categories?size gt 0>
    <#list post.categories as category> ${category.name!} 
    <#elseif post.topPriority==1 && thumbnail_mode == "fold">

    置顶

    ${post.title!}

    <@global.timeline datetime=post.createTime/>

    <#elseif thumbnail_mode == "grid">
    <#list post_index..(posts?size-1) as i> <#local gradPost=posts[i]> <#local thumbnail = (gradPost.thumbnail?? && gradPost.thumbnail!='')?then(gradPost.thumbnail!, (settings.default_thumbnail?? && settings.default_thumbnail!='')?then(settings.default_thumbnail + settings.default_thumbnail?contains('?')?then("&","?") + "postId=" + gradPost.id?c, ''))> <#if is_first_index?? && thumbnail != '' && !(gradPost.topPriority!=1 || !gradPost.metas?? || (gradPost.metas.index_carousel!'false')=='false')> <#continue>

    <#if gradPost.topPriority==1>置顶${gradPost.title!}

    <#break/> <#else>
    <#if thumbnail?? && thumbnail!=''>

    <#if post.topPriority==1>置顶${post.title!}

    <#if post.categories?? && post.categories?size gt 0>
    <#list post.categories as category> ${category.name!} 

    ${post.summary!}
    ================================================ FILE: template/main/article_literature.ftl ================================================ <#macro articleLiterature post,commentType> <#if post.thumbnail?? && post.thumbnail!=''>
    <#if categories?? && categories?size gt 0>
    <#list categories as category> ${category.name!}

    ${post.title!}

    <#assign updateInterval = ((.now?long - post.updateTime?long)/86400000)?floor > <#if updateInterval gt (settings.invalid_tips_day!'99999999')?number >
    本文最后更新于 ${post.updateTime?string('yyyy-MM-dd')},距今已有 ${updateInterval} 天,若文章内容或图片链接失效,请留言反馈。
    <#if (metas?? && metas.tips?? && metas.tips!='')>
    ${metas.tips}
    <#if !post.thumbnail?? || post.thumbnail==''>

    ${post.title!}

    <#if post.categories?? && post.categories?size gt 0>
    <#list post.categories as category> ${category.name!} 

    ${post.formatContent!}
    <#include "admire.ftl"> <#if tags?? && (tags?size gt 0)>
    <#list tags as tag> ${tag.name!} 
    <#assign enable_copyright = (metas?? && metas.enable_copyright?? && metas.enable_copyright?trim!='')?then(metas.enable_copyright?trim, (settings.enable_copyright!true)?c)> <#if enable_copyright == 'true' || enable_share>
    <#if enable_copyright == 'true'> <#include "copyright.ftl"> <#if enable_share>
    <#if nextPost?? || prevPost??>
    <#if prevPost??> ${prevPost.title!} <#if nextPost??> ${nextPost.title!}
    <#if (!post.disallowComment!false) && settings.enable_comment!true>

    评论

    <#include "comment.ftl"> <@comment post.id?c, commentType />
    ================================================ FILE: template/main/comment.ftl ================================================ <#macro comment id,type> <#assign imageUploadApi = (settings.image_upload_api?? && settings.image_upload_api!='')?then(', "imageUploadApi": "${settings.image_upload_api!}"', '') > <#assign avatarLoading = (settings.avatar_loading?? && settings.avatar_loading!='')?then(', "avatarLoading": "${settings.avatar_loading!}"', '') > <#assign defaultAvatar = (settings.default_avatar?? && settings.default_avatar!='')?then(', "defaultAvatar": "${settings.default_avatar!}"', '') > <#assign anonymousUserName = (settings.anonymous_user_name?? && settings.anonymous_user_name!='')?then(', "anonymousUserName": "${settings.anonymous_user_name!}"', '') > <#assign enableBulletScreen = (is_journals??)?then("false", (metas?? && metas.enable_bullet_screen?? && metas.enable_bullet_screen?trim!="")?then(metas.enable_bullet_screen?trim, (settings.enable_bullet_screen!false)?c))> <#assign configs= '{"autoLoad": ${(settings.autoload_comment!true)?c }, "showUserAgent": ${(settings.show_comment_ua!true)?c }, "priorityQQAvatar": ${(settings.priority_qq_avatar!false)?c }, "getQQInfo": ${(settings.enable_qq_info!false)?c }, "commentHtml": ${(settings.enable_comment_html!false)?c }, "loadingStyle": "${settings.comment_loading_style!"default" }", "unfoldReplyNum": ${settings.unfold_reply_num!6 }, "replyDescSoft": ${(settings.reply_desc_soft!false)?c }, "enableImageUpload": ${(settings.enable_image_upload!false)?c }, "enableBulletScreen": ${enableBulletScreen }${imageUploadApi! }${anonymousUserName! }, "enableBloggerOperation": ${(settings.enable_blogger_operation!true)?c }${avatarLoading! }${defaultAvatar! }}'> ================================================ FILE: template/main/copyright.ftl ================================================ ================================================ FILE: template/main/pagination.ftl ================================================ <#macro pagination method,datas,slug="",keyword="",display="5"> <#if datas.getTotalPages() gt 1>
    ================================================ FILE: template/widget/ad_piece.ftl ================================================ <#assign ad_show=(settings.ad_mode!true)?then(settings.ad_image?? && settings.ad_image != '', settings.ad_custom_code?? && settings.ad_custom_code!='')> <#if ad_show>
    <#if settings.ad_mode!true> <#if settings.ad_target_url?? && settings.ad_target_url!=''> 广告 <#else> 广告 <#else> ${settings.ad_custom_code!} <#if settings.show_ad_tag!true> 广告 <#if settings.ad_tag_close!true>
    ================================================ FILE: template/widget/categories.ftl ================================================ <#macro categoriesTree categories> <#list categories as category>
  • ${category.name} ${postCounts[category.id?c]!} <#assign num=num?number-1/> <#if num?number gt 0 && category.children?? && category.children?size gt 0>
      <@categoriesTree category.children/>
  • <#if num?number = 0> <#break> <#assign num= settings.categories_num!10 />
    <#assign postCounts = {}> <@categoryTag method="list">
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "分类")} <#if settings.categories_more?? && settings.categories_more== true && categories?size gt num?number> 更多
    <#list categories as category> <#assign postCounts += {category.id: category.postCount}> <@categoryTag method="tree"> <#if categories?? && categories?size gt 0>
    <#else>
    暂无分类
    ================================================ FILE: template/widget/custom.ftl ================================================
    <#if sidebar.title?? && sidebar.title != '' && sidebar.icon?? && sidebar.icon != ''>
    ${sidebar.title}
    ${sidebar.content!}
    ================================================ FILE: template/widget/links.ftl ================================================ <#assign num= settings.links_num!10 /> ================================================ FILE: template/widget/love.ftl ================================================
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "恋爱墙")}
    ================================================ FILE: template/widget/music.ftl ================================================ <#if ((settings.music_mode!'playlist') == 'playlist' && settings.netease_playlist_id?? && settings.netease_playlist_id!='') || (settings.music_mode! == 'config' && settings.music_config?? && settings.music_config!='')> <#assign sidebar_music = true>
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "音乐")}
    <#if (settings.music_mode!'playlist') == 'playlist'> <#elseif settings.music_mode! == 'config'>
    ================================================ FILE: template/widget/notice.ftl ================================================
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "公告")}
    ${settings.notice_content!'

      欢迎来访${blog_title!},博主还没有发布任何公告!

    '}
    ================================================ FILE: template/widget/profile.ftl ================================================
    <#if settings.profile_theme_button?? && settings.profile_theme_button!=''> <#assign profile_theme_button=settings.profile_theme_button?split('|')>
    <#if settings.social_github?? && settings.social_github!=''> <#if settings.social_qq?? && settings.social_qq!=''> <#if settings.social_weibo?? && settings.social_weibo!=''> <#if settings.social_twitter?? && settings.social_twitter!=''> <#if settings.social_facebook?? && settings.social_facebook!=''> <#if settings.social_email?? && settings.social_email!=''> <#if settings.social_telegram?? && settings.social_telegram!=''> <#if settings.custom_social_options?? && settings.custom_social_options!=''> <#assign custom_social_options=settings.custom_social_options?split('\n')> <#list custom_social_options as custom_social_option> <#assign social_option=custom_social_option?split('|')> <#assign social_name=(social_option[0]?? && social_option[0]?trim!='')?then(social_option[0]?trim,'')> <#assign social_logo=(social_option[1]?? && social_option[1]?trim!='')?then(social_option[1]?trim,'')> <#assign social_link=(social_option[2]?? && social_option[2]?trim!='')?then(social_option[2]?trim,'')> <#if social_name!='' || social_logo!='' || social_link!=''> <#if settings.social_rss!true >
    ================================================ FILE: template/widget/recent_comments.ftl ================================================
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "最新评论")}
    <@commentTag method="latest" top="${settings.recent_comments_num!5}"> <#if comments.content?size gt 0>
      <#list comments.content as comment>
    • ${comment.author!}
      ${comment.author!}
      ${comment.createTime?string("yyyy-MM-dd")}
    <#else>
    暂无评论
    ================================================ FILE: template/widget/recent_posts.ftl ================================================
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "最新文章")}
    <@postTag method="latest" top="${settings.recent_posts_num!5}"> <#if posts?size gt 0>
    <#else>
    暂无文章
    ================================================ FILE: template/widget/tagcloud.ftl ================================================ <#assign num= settings.tagcloud_num!32 />
    <@tagTag method="list">
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "标签云")} <#if settings.tagcloud_more?? && settings.tagcloud_more== true && tags?size gt num?number> 更多
    <#if tags?? && tags?size gt 0>
    <#assign size= (tags?size > num?number)?string(num, tags?size)?number - 1 /> <#list 0..size as i> <#assign tag= tags[i] /> <#assign size= tag.name?length + tag.slug?length + tag.postCount /> ${tag.name!}
    <#else>
    暂无标签
    ================================================ FILE: template/widget/tags.ftl ================================================ <#assign num= settings.tags_num!18 />
    <@tagTag method="list">
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "标签")} <#if settings.tags_more?? && settings.tags_more== true && tags?size gt num?number> 更多
    <#if tags?? && tags?size gt 0>
    <#assign size= (tags?size > num?number)?string(num, tags?size)?number - 1 /> <#list 0..size as i> <#assign tag= tags[i] /> style="color: ${tag.color}; border-color: ${tag.color}; background: ${tag.color!}20" >${tag.name!}
    <#else>
    暂无标签
    ================================================ FILE: template/widget/toc.ftl ================================================ <#assign sidebar_toc = true>
    ${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "目录")}
    ================================================ FILE: theme.yaml ================================================ # 主题id,唯一 id: dream # 主题名称 name: Dream author: # 作者名称 name: nineya # 作者网址 website: https://www.nineya.com # 主题描述 description: '梦之城,童话梦境' # 主题logo地址 logo: https://q1.qlogo.cn/g?b=qq&nk=361654768&s=640 # 主题地址 website: https://blog.nineya.com # 主题github开源地址 repo: https://github.com/nineya/halo-theme-dream # 版本号 version: 3.2.4 # 最低支持的 Halo-Plus 版本 require: 1.1.0 # 编辑器配置参数 editorOptions: /themes/dream/source/js/editor-options.min.js?mew=3.2.4 # 文章页 meta 变量 postMetaField: - enable_copyright - thumbnail_mode - tips - enable_katex - enable_share - enable_bullet_screen - index_carousel - enable_donate # 自定义页 meta 变量 sheetMetaField: - enable_copyright - tips - enable_katex - enable_share - enable_bullet_screen - enable_donate