diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..45202c0c6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +name: Go + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + outputs: + tag: ${{ steps.git.outputs.tag }} + strategy: + fail-fast: false + matrix: + config: + - { + name: "Windows Latest MSVC", + artifact: "windows", + os: windows-latest + } + - { + name: "Ubuntu Latest GCC", + artifact: "linux", + os: ubuntu-latest + } + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.18 + + - name: Build + run: | + go mod tidy + go build -v + + # - name: Test + # run: go test -v ./... + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + path: | + conf/**/* + static/**/* + views/**/* + mindoc.* + name: mindoc-${{ matrix.config.artifact }}-${{ steps.git.outputs.tag }}.7z diff --git a/Dockerfile b/Dockerfile index e13982c17..98bf9a95c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,14 +36,25 @@ FROM ubuntu:focal # 切换默认shell为bash SHELL ["/bin/bash", "-c"] -COPY --from=build /usr/share/fonts/win/simsun.ttc /usr/share/fonts/win/ -COPY --from=build /go/src/github.com/mindoc-org/mindoc /mindoc WORKDIR /mindoc + +# 文件复制 +COPY --from=build /usr/share/fonts/win/simsun.ttc /usr/share/fonts/win/ +COPY --from=build /go/src/github.com/mindoc-org/mindoc/mindoc_linux_amd64 /mindoc/ +COPY --from=build /go/src/github.com/mindoc-org/mindoc/start.sh /mindoc/ +COPY --from=build /go/src/github.com/mindoc-org/mindoc/LICENSE.md /mindoc/ +# 文件夹复制 +COPY --from=build /go/src/github.com/mindoc-org/mindoc/lib /mindoc/lib +COPY --from=build /go/src/github.com/mindoc-org/mindoc/conf /mindoc/__default_assets__/conf +COPY --from=build /go/src/github.com/mindoc-org/mindoc/static /mindoc/__default_assets__/static +COPY --from=build /go/src/github.com/mindoc-org/mindoc/views /mindoc/__default_assets__/views +COPY --from=build /go/src/github.com/mindoc-org/mindoc/uploads /mindoc/__default_assets__/uploads + RUN chmod a+r /usr/share/fonts/win/simsun.ttc # 备份原有源 RUN mv /etc/apt/sources.list /etc/apt/sources.list-backup -# 最小化源,缩短apt update时间(ca-certificates必须先安装才支持换tsinghua源) +# 最小化源,缩短apt update时间(ca-certificates必须先安装才支持换aliyun源) RUN echo 'deb http://archive.ubuntu.com/ubuntu/ focal main restricted' > /etc/apt/sources.list RUN apt-get update RUN apt install -y ca-certificates @@ -88,18 +99,14 @@ RUN update-locale LANG=zh_CN.UTF-8 ENV LANG=zh_CN.UTF-8 ENV LANGUAGE=zh_CN:en ENV LC_ALL=zh_CN.UTF-8 + # 安装-calibre # RUN apt-get install -y calibre # 此种方式安装省事,但会安装很多额外不需要的软件包,导致体积过大 RUN mkdir -p /tmp/calibre-cache -# 获取最新版本号 -RUN curl -s http://code.calibre-ebook.com/latest>/tmp/calibre-cache/version -# 下载最新版本 -# RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c https://download.calibre-ebook.com/`cat /tmp/calibre-cache/version`/calibre-`cat /tmp/calibre-cache/version`-x86_64.txz -# 使用 ghproxy.com 替换 github 实现加速 -# RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c https://ghproxy.com/https://github.com/kovidgoyal/calibre/releases/download/v`cat /tmp/calibre-cache/version`/calibre-`cat /tmp/calibre-cache/version`-x86_64.txz -RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c https://github.com/kovidgoyal/calibre/releases/download/v`cat /tmp/calibre-cache/version`/calibre-`cat /tmp/calibre-cache/version`-x86_64.txz -# 注: 调试阶段,下载alibre-5.22.1-x86_64.txz到本地(使用 python -m http.server),加速构建 -# RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c http://10.96.8.252:8000/calibre-5.22.1-x86_64.txz +# 强制使用 5.44.0 版本(5.x的最新版本) +RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c https://download.calibre-ebook.com/5.44.0/calibre-5.44.0-x86_64.txz +# 注: 调试阶段,下载alibre-5.44.0-x86_64.txz到本地(使用 python -m http.server),加速构建 +# RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c http://10.96.8.252:8000/calibre-5.44.0-x86_64.txz # 解压 RUN mkdir -p /opt/calibre # RUN tar --extract --file=/tmp/calibre-cache/calibre-x86_64.txz --directory /opt/calibre @@ -114,23 +121,19 @@ RUN ebook-convert --version RUN rm -rf /tmp/calibre-cache # refer: https://docs.docker.com/engine/reference/builder/#volume -# 数据同步目录 -VOLUME /mindoc-sync-host +VOLUME ["/mindoc/conf","/mindoc/static","/mindoc/views","/mindoc/uploads","/mindoc/runtime","/mindoc/database"] # refer: https://docs.docker.com/engine/reference/builder/#expose EXPOSE 8181/tcp -# 如果配置文件不存在就复制 -RUN cp --no-clobber /mindoc/conf/app.conf.example /mindoc/conf/app.conf - ENV ZONEINFO=/mindoc/lib/time/zoneinfo.zip RUN chmod +x /mindoc/start.sh ENTRYPOINT ["/bin/bash", "/mindoc/start.sh"] # https://docs.docker.com/engine/reference/commandline/build/#options -# docker build --progress plain --rm --build-arg TAG=2.0.1 --tag gsw945/mindoc:2.0.1 . +# docker build --progress plain --rm --build-arg TAG=2.1 --tag gsw945/mindoc:2.1 . # https://docs.docker.com/engine/reference/commandline/run/#options # set MINDOC=//d/mindoc # windows # export MINDOC=/home/ubuntu/mindoc-docker # linux -# docker run --rm -it -p 8181:8181 -v "%MINDOC%":"/mindoc-sync-host" --name mindoc -e MINDOC_ENABLE_EXPORT=true -d gsw945/mindoc:2.0.1 +# docker run --rm -it -p 8181:8181 -v "%MINDOC%":"/mindoc-sync-host" --name mindoc -e MINDOC_ENABLE_EXPORT=true -d gsw945/mindoc:2.1 diff --git a/README.md b/README.md index 7c9fd5733..97f01280c 100644 --- a/README.md +++ b/README.md @@ -19,23 +19,24 @@ MinDoc 的前身是 [SmartWiki](https://github.com/lifei6671/SmartWiki) 文档 ### 开发&维护&使用 悉知 -感谢作者 [lifei6671](https://github.com/lifei6671) 创造了MinDoc,并持续维护了很久。 - -作者因工作等原因,精力有限,无法花费足够的时间来持续维护mindoc,已于北京时间2021年3月23日将mindoc交给社区(github组织[mindoc-org](https://github.com/mindoc-org))维护,期待热心开发者加入[mindoc-org](https://github.com/mindoc-org)一起来维护MinDoc。 - -遇到问题请提 [Issues](https://github.com/mindoc-org/mindoc/issues ),欢迎使用者和贡献者加入QQ群 `1051164153` +- 感谢作者 [lifei6671](https://github.com/lifei6671) 创造了MinDoc,并持续维护了很久。 +- 作者因工作等原因,精力有限,无法花费足够的时间来持续维护mindoc,已于北京时间2021年3月23日将mindoc交给社区(github组织[mindoc-org](https://github.com/mindoc-org))维护,期待热心开发者加入[mindoc-org](https://github.com/mindoc-org)一起来维护MinDoc。 +- 遇到问题请提 [Issues](https://github.com/mindoc-org/mindoc/issues ),欢迎使用者和贡献者加入QQ群 `1051164153` MinDoc使用&开发交流群 - -对开发感兴趣请关注 [Development](https://github.com/mindoc-org/mindoc/projects/1): -- [Todo List](https://github.com/mindoc-org/mindoc/projects/1#column-13554511) -- [Work in progress](https://github.com/mindoc-org/mindoc/projects/1#column-13554512) -- [Review in progress](https://github.com/mindoc-org/mindoc/projects/1#column-13554513) +- 对开发感兴趣请关注 [Development](https://github.com/mindoc-org/mindoc/projects/1): + - [Todo List](https://github.com/mindoc-org/mindoc/projects/1#column-13554511) + - [Work in progress](https://github.com/mindoc-org/mindoc/projects/1#column-13554512) + - [Review in progress](https://github.com/mindoc-org/mindoc/projects/1#column-13554513) +- Mindoc基于 [beeego](https://github.com/beego/beego) 开发,beego文档地址: https://github.com/beego/beego-doc/tree/main/docs/zh +- :warning: **特别声明**: + - 原作者 [lifei6671](https://github.com/lifei6671) 已于 2021-08-06 删除了个人捐赠信息,参见: [1a179179c1fe4d0d4db95e0b757d863aee5bf395](https://github.com/mindoc-org/mindoc/commit/1a179179c1fe4d0d4db95e0b757d863aee5bf395) + - 截止目前(2023-03-27),[mindoc-org](https://github.com/mindoc-org) 暂未发布任何捐赠信息,请勿轻信 --- # 安装与使用 -**如果你的服务器上没有安装golang程序请手动设置一个环境变量如下:键名为 ZONEINFO,值为MinDoc跟目录下的/lib/time/zoneinfo.zip 。** +~~如果你的服务器上没有安装golang程序请手动设置一个环境变量如下:键名为 ZONEINFO,值为MinDoc跟目录下的/lib/time/zoneinfo.zip 。~~ 更多信息请查看手册: [MinDoc 使用手册](https://www.iminho.me/wiki/docs/mindoc/mindoc-summary.md) @@ -72,7 +73,7 @@ MinDoc 如果使用MySQL储存数据,则编码必须是`utf8mb4_general_ci`。 ### 安装 musl-gcc ```bash -wget -c http://www.musl-libc.org/releases/musl-1.2.2.tar.gz +wget -c http://musl.libc.org/releases/musl-1.2.2.tar.gz tar -xvf musl-1.2.2.tar.gz cd musl-1.2.2 ./configure @@ -93,6 +94,9 @@ go build -v -o mindoc_linux_musl_amd64 -ldflags="-linkmode external -extldflags ./mindoc_linux_musl_amd64 version ``` +## Windows 上后台运行 + 使用 [mindoc-daemon](https://github.com/mindoc-org/mindoc-daemon) + ```ini #邮件配置-示例 @@ -132,13 +136,13 @@ MINDOC_ENABLE_EXPORT 开启导出(默认为false) ##### Windows ```bash set MINDOC=//d/mindoc -docker run -it --name=mindoc --restart=always -v "%MINDOC%":"/mindoc-sync-host" -p 8181:8181 -e MINDOC_ENABLE_EXPORT=true -d registry.cn-hangzhou.aliyuncs.com/mindoc-org/mindoc:v2.1-beta.6 +docker run -it --name=mindoc --restart=always -v "%MINDOC%/conf":"/mindoc/conf" -p 8181:8181 -e MINDOC_ENABLE_EXPORT=true -d registry.cn-hangzhou.aliyuncs.com/mindoc-org/mindoc:v2.1 ``` ##### Linux、Mac ```bash export MINDOC=/home/ubuntu/mindoc-docker -docker run -it --name=mindoc --restart=always -v "${MINDOC}":"/mindoc-sync-host" -p 8181:8181 -e MINDOC_ENABLE_EXPORT=true -d registry.cn-hangzhou.aliyuncs.com/mindoc-org/mindoc:v2.1-beta.6 +docker run -it --name=mindoc --restart=always -v "${MINDOC}/conf":"/mindoc/conf" -p 8181:8181 -e MINDOC_ENABLE_EXPORT=true -d registry.cn-hangzhou.aliyuncs.com/mindoc-org/mindoc:v2.1 ``` ##### 举个栗子-更多环境变量示例(镜像已过期,仅供参考,请以当前镜像为准) diff --git a/commands/command.go b/commands/command.go index a35393310..63a01a2a7 100644 --- a/commands/command.go +++ b/commands/command.go @@ -20,12 +20,12 @@ import ( beegoCache "github.com/beego/beego/v2/client/cache" _ "github.com/beego/beego/v2/client/cache/memcache" "github.com/beego/beego/v2/client/cache/redis" - _ "github.com/beego/beego/v2/client/cache/redis" "github.com/beego/beego/v2/client/orm" "github.com/beego/beego/v2/core/logs" "github.com/beego/beego/v2/server/web" "github.com/beego/i18n" "github.com/howeyc/fsnotify" + _ "github.com/lib/pq" "github.com/lifei6671/gocaptcha" "github.com/mindoc-org/mindoc/cache" "github.com/mindoc-org/mindoc/conf" @@ -84,6 +84,30 @@ func RegisterDataBase() { if err != nil { logs.Error("注册默认数据库失败->", err) } + } else if strings.EqualFold(dbadapter, "postgres") { + host, _ := web.AppConfig.String("db_host") + database, _ := web.AppConfig.String("db_database") + username, _ := web.AppConfig.String("db_username") + password, _ := web.AppConfig.String("db_password") + sslmode, _ := web.AppConfig.String("db_sslmode") + + timezone, _ := web.AppConfig.String("timezone") + location, err := time.LoadLocation(timezone) + if err == nil { + orm.DefaultTimeLoc = location + } else { + logs.Error("加载时区配置信息失败,请检查是否存在 ZONEINFO 环境变量->", err) + } + + port, _ := web.AppConfig.String("db_port") + + dataSource := fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=%s", username, password, host, port, database, sslmode) + + if err := orm.RegisterDataBase("default", "postgres", dataSource); err != nil { + logs.Error("注册默认数据库失败->", err) + os.Exit(1) + } + } else { logs.Error("不支持的数据库类型.") os.Exit(1) @@ -111,8 +135,9 @@ func RegisterModel() { new(models.TeamMember), new(models.TeamRelationship), new(models.Itemsets), - new(models.Comment), - new(models.WorkWeixinAccount), + new(models.Comment), + new(models.WorkWeixinAccount), + new(models.DingTalkAccount), ) gob.Register(models.Blog{}) gob.Register(models.Document{}) @@ -123,6 +148,7 @@ func RegisterModel() { // RegisterLogger 注册日志 func RegisterLogger(log string) { + logs.Reset() logs.SetLogFuncCall(true) _ = logs.SetLogger("console") logs.EnableFuncCallDepth(true) @@ -207,7 +233,7 @@ func RegisterCommand() { } -//注册模板函数 +// 注册模板函数 func RegisterFunction() { err := web.AddFuncMap("config", models.GetOptionValue) @@ -294,7 +320,7 @@ func RegisterFunction() { } } -//解析命令 +// 解析命令 func ResolveCommand(args []string) { flagSet := flag.NewFlagSet("MinDoc command: ", flag.ExitOnError) flagSet.StringVar(&conf.ConfigurationFile, "config", "", "MinDoc configuration file.") @@ -343,6 +369,10 @@ func ResolveCommand(args []string) { web.BConfig.WebConfig.StaticDir["/uploads"] = uploads web.BConfig.WebConfig.ViewsPath = conf.WorkingDir("views") web.BConfig.WebConfig.Session.SessionCookieSameSite = http.SameSiteDefaultMode + var upload_file_size = conf.GetUploadFileSize() + if upload_file_size > web.BConfig.MaxUploadSize { + web.BConfig.MaxUploadSize = upload_file_size + } fonts := conf.WorkingDir("static", "fonts") @@ -362,7 +392,7 @@ func ResolveCommand(args []string) { } -//注册缓存管道 +// 注册缓存管道 func RegisterCache() { isOpenCache := web.AppConfig.DefaultBool("cache", false) if !isOpenCache { @@ -461,7 +491,7 @@ func RegisterCache() { logs.Info("缓存初始化完成.") } -//自动加载配置文件.修改了监听端口号和数据库配置无法自动生效. +// 自动加载配置文件.修改了监听端口号和数据库配置无法自动生效. func RegisterAutoLoadConfig() { if conf.AutoLoadDelay > 0 { @@ -502,7 +532,7 @@ func RegisterAutoLoadConfig() { } } -//注册错误处理方法. +// 注册错误处理方法. func RegisterError() { web.ErrorHandler("404", func(writer http.ResponseWriter, request *http.Request) { var buf bytes.Buffer diff --git a/conf/app.conf.example b/conf/app.conf.example index 70e70018d..aaffcb448 100644 --- a/conf/app.conf.example +++ b/conf/app.conf.example @@ -50,16 +50,20 @@ sessiongcmaxlifetime="${MINDOC_SESSION_MAX_LIFETIME||3600}" #时区设置 timezone = Asia/Shanghai - - ####################MySQL 数据库配置########################### -#支持MySQL和sqlite3两种数据库,如果是sqlite3 则 db_database 标识数据库的物理目录 +#支持MySQL,sqlite3,postgres三种数据库,如果是sqlite3 则 db_database 标识数据库的物理目录 db_adapter="${MINDOC_DB_ADAPTER||sqlite3}" db_host="${MINDOC_DB_HOST||127.0.0.1}" db_port="${MINDOC_DB_PORT||3306}" db_database="${MINDOC_DB_DATABASE||./database/mindoc.db}" db_username="${MINDOC_DB_USERNAME||root}" db_password="${MINDOC_DB_PASSWORD||123456}" +#是否使用SSL,支持posgres,可选的值有: +#disable - No SSL +#require - Always SSL (skip verification) +#verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA) +#verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate) +db_sslmode="${MINDOC_DB_SSLMODE||disable}" ####################sqlite3 数据库配置########################### #db_adapter=sqlite3 @@ -77,7 +81,9 @@ token_size=12 #上传文件的后缀,如果不限制后缀可以设置为 * upload_file_ext=txt|doc|docx|xls|xlsx|ppt|pptx|pdf|7z|rar|jpg|jpeg|png|gif -#上传的文件大小限制,如果不填写,默认不限制,单位可以是 GB KB MB +#上传的文件大小限制 +# - 如果不填写, 则默认1GB,如果希望超过1GB,必须带单位 +# - 如果填写,单位可以是 TB、GB、MB、KB,不带单位表示字节 upload_file_size=10MB ####################邮件配置###################### @@ -119,23 +125,27 @@ baidumapkey= ################Active Directory/LDAP################ #是否启用ldap -ldap_enable=false +ldap_enable=${MINDOC_LDAP_ENABLE||false} +#ldap协议(ldap/ldaps) +ldap_scheme="${MINDOC_LDAP_SCHEME||ldap}" #ldap主机名 -ldap_host=ad.example.com +ldap_host="${MINDOC_LDAP_HOST||127.0.0.1}" #ldap端口 -ldap_port=3268 +ldap_port=${MINDOC_LDAP_PORT||389} #ldap内哪个属性作为用户名 -ldap_attribute=sAMAccountName +ldap_attribute="${MINDOC_LDAP_ATTRIBUTE||sAMAccountName}" +#ldap内哪个属性作为邮箱 +ldap_mail="${MINDOC_LDAP_MAIL||mail}" #搜索范围 -ldap_base=DC=example,DC=com +ldap_base="${MINDOC_LDAP_BASE||dc=example,dc=com}" #第一次绑定ldap用户dn -ldap_user=CN=ldap helper,OU=example.com,DC=example,DC=com +ldap_user="${MINDOC_LDAP_USER||cn=ldap helper,ou=example.com,dc=example,dc=com}" #第一次绑定ldap用户密码 -ldap_password=superSecret +ldap_password="${MINDOC_LDAP_PASSWORD||xxx}" #自动注册用户角色:0 超级管理员 /1 管理员/ 2 普通用户 -ldap_user_role=2 +ldap_user_role=${MINDOC_LDAP_USER_ROLE||2} #ldap搜索filter规则,AD服务器: objectClass=User, openldap服务器: objectClass=posixAccount ,也可以定义为其他属性,如: title=mindoc -ldap_filter=objectClass=posixAccount +ldap_filter="${MINDOC_LDAP_FILTER||objectClass=posixAccount}" ############# HTTP自定义接口登录 ################ http_login_url= @@ -222,15 +232,6 @@ dingtalk_app_key="${MINDOC_DINGTALK_APPKEY}" # 钉钉AppSecret dingtalk_app_secret="${MINDOC_DINGTALK_APPSECRET}" -# 钉钉登录默认只读账号 -dingtalk_tmp_reader="${MINDOC_DINGTALK_READER}" - -# 钉钉扫码登录Key -dingtalk_qr_key="${MINDOC_DINGTALK_QRKEY}" - -# 钉钉扫码登录Secret -dingtalk_qr_secret="${MINDOC_DINGTALK_QRSECRET}" - ########企业微信登录配置############## # 企业ID @@ -242,8 +243,5 @@ workweixin_agentid="${MINDOC_WORKWEIXIN_AGENTID}" # 应用密钥 workweixin_secret="${MINDOC_WORKWEIXIN_SECRET}" -# 通讯录密钥 -workweixin_contact_secret="${MINDOC_WORKWEIXIN_CONTACT_SECRET}" - # i18n config default_lang="zh-cn" diff --git a/conf/enumerate.go b/conf/enumerate.go index 507f564ad..c4a986b06 100644 --- a/conf/enumerate.go +++ b/conf/enumerate.go @@ -19,7 +19,7 @@ const CaptchaSessionName = "__captcha__" const RegexpEmail = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" -//允许用户名中出现点号 +// 允许用户名中出现点号 const RegexpAccount = `^[a-zA-Z0-9][a-zA-Z0-9\.-]{2,50}$` // PageSize 默认分页条数. @@ -35,7 +35,7 @@ const ( MemberGeneralRole ) -//系统角色 +// 系统角色 type SystemRole int const ( @@ -51,7 +51,7 @@ const ( BookRoleNoSpecific ) -//项目角色 +// 项目角色 type BookRole int const ( @@ -90,23 +90,23 @@ func GetDatabasePrefix() string { return web.AppConfig.DefaultString("db_prefix", "md_") } -//获取默认头像 +// 获取默认头像 func GetDefaultAvatar() string { return URLForWithCdnImage(web.AppConfig.DefaultString("avatar", "/static/images/headimgurl.jpg")) } -//获取阅读令牌长度. +// 获取阅读令牌长度. func GetTokenSize() int { return web.AppConfig.DefaultInt("token_size", 12) } -//获取默认文档封面. +// 获取默认文档封面. func GetDefaultCover() string { return URLForWithCdnImage(web.AppConfig.DefaultString("cover", "/static/images/book.jpg")) } -//获取允许的商城文件的类型. +// 获取允许的商城文件的类型. func GetUploadFileExt() []string { ext := web.AppConfig.DefaultString("upload_file_ext", "png|jpg|jpeg|gif|txt|doc|docx|pdf") @@ -128,9 +128,9 @@ func GetUploadFileExt() []string { func GetUploadFileSize() int64 { size := web.AppConfig.DefaultString("upload_file_size", "0") - if strings.HasSuffix(size, "MB") { + if strings.HasSuffix(size, "TB") { if s, e := strconv.ParseInt(size[0:len(size)-2], 10, 64); e == nil { - return s * 1024 * 1024 + return s * 1024 * 1024 * 1024 * 1024 } } if strings.HasSuffix(size, "GB") { @@ -138,28 +138,33 @@ func GetUploadFileSize() int64 { return s * 1024 * 1024 * 1024 } } + if strings.HasSuffix(size, "MB") { + if s, e := strconv.ParseInt(size[0:len(size)-2], 10, 64); e == nil { + return s * 1024 * 1024 + } + } if strings.HasSuffix(size, "KB") { if s, e := strconv.ParseInt(size[0:len(size)-2], 10, 64); e == nil { return s * 1024 } } if s, e := strconv.ParseInt(size, 10, 64); e == nil { - return s * 1024 + return s } return 0 } -//是否启用导出 +// 是否启用导出 func GetEnableExport() bool { return web.AppConfig.DefaultBool("enable_export", true) } -//是否启用iframe +// 是否启用iframe func GetEnableIframe() bool { return web.AppConfig.DefaultBool("enable_iframe", false) } -//同一项目导出线程的并发数 +// 同一项目导出线程的并发数 func GetExportProcessNum() int { exportProcessNum := web.AppConfig.DefaultInt("export_process_num", 1) @@ -169,7 +174,7 @@ func GetExportProcessNum() int { return exportProcessNum } -//导出项目队列的并发数量 +// 导出项目队列的并发数量 func GetExportLimitNum() int { exportLimitNum := web.AppConfig.DefaultInt("export_limit_num", 1) @@ -179,7 +184,7 @@ func GetExportLimitNum() int { return exportLimitNum } -//等待导出队列的长度 +// 等待导出队列的长度 func GetExportQueueLimitNum() int { exportQueueLimitNum := web.AppConfig.DefaultInt("export_queue_limit_num", 10) @@ -189,14 +194,14 @@ func GetExportQueueLimitNum() int { return exportQueueLimitNum } -//默认导出项目的缓存目录 +// 默认导出项目的缓存目录 func GetExportOutputPath() string { exportOutputPath := filepath.Join(web.AppConfig.DefaultString("export_output_path", filepath.Join(WorkingDirectory, "cache")), "books") return exportOutputPath } -//判断是否是允许商城的文件类型. +// 判断是否是允许商城的文件类型. func IsAllowUploadFileExt(ext string) bool { if strings.HasPrefix(ext, ".") { @@ -215,7 +220,7 @@ func IsAllowUploadFileExt(ext string) bool { return false } -//读取配置文件值 +// 读取配置文件值 func CONF(key string, value ...string) string { defaultValue := "" if len(value) > 0 { @@ -224,7 +229,7 @@ func CONF(key string, value ...string) string { return web.AppConfig.DefaultString(key, defaultValue) } -//重写生成URL的方法,加上完整的域名 +// 重写生成URL的方法,加上完整的域名 func URLFor(endpoint string, values ...interface{}) string { baseUrl := web.AppConfig.DefaultString("baseurl", "") pathUrl := web.URLFor(endpoint, values...) diff --git a/conf/lang/en-us.ini b/conf/lang/en-us.ini index a09a76302..c6a7b715a 100644 --- a/conf/lang/en-us.ini +++ b/conf/lang/en-us.ini @@ -22,7 +22,9 @@ captcha = Captcha keep_login = Stay signed in forgot_password = Forgot password? register = Create New Account -dingtalk_login = DingTalk QrCode login +third_party_login = Third Party Login +dingtalk_login = DingTalk Login +wecom_login = WeCom Login account_recovery = Account recovery new_password = New password confirm_password = Confirm password @@ -313,7 +315,7 @@ prev = prev next = next no = no edit_title = Edit Blog -private_blog_tips = Private blog is accessible only to author and administrator +private_blog_tips = Private blog, please enter password to access [doc] modify_doc = Modify Document @@ -365,6 +367,7 @@ gfm_task = GFM task attachment = attachment json_to_table = Json converted to table template = template +draw = draw close_preview = disable preview modify_history = modify history sidebar = sidebar diff --git a/conf/lang/zh-cn.ini b/conf/lang/zh-cn.ini index eb2522f5c..f08944bf1 100644 --- a/conf/lang/zh-cn.ini +++ b/conf/lang/zh-cn.ini @@ -22,7 +22,9 @@ captcha = 验证码 keep_login = 保持登录 forgot_password = 忘记密码? register = 立即注册 -dingtalk_login = 扫码登录 +third_party_login = 第三方登录 +dingtalk_login = 钉钉登录 +wecom_login = 企业微信登录 account_recovery = 找回密码 new_password = 新密码 confirm_password = 确认密码 @@ -313,7 +315,7 @@ prev = 上一篇 next = 下一篇 no = 无 edit_title = 编辑文章 -private_blog_tips = 加密文章,仅作者和管理员可访问 +private_blog_tips = 加密文章,请输入密码访问 [doc] modify_doc = 修改文档 @@ -365,6 +367,7 @@ gfm_task = GFM 任务列表 attachment = 附件 json_to_table = Json转换为表格 template = 模板 +draw = 画图 close_preview = 关闭实时预览 modify_history = 修改历史 sidebar = 边栏 diff --git a/conf/workweixin.go b/conf/workweixin.go index bae128f7a..36f4da035 100644 --- a/conf/workweixin.go +++ b/conf/workweixin.go @@ -1,27 +1,27 @@ package conf import ( - "github.com/beego/beego/v2/server/web" + "github.com/beego/beego/v2/server/web" ) type WorkWeixinConf struct { - CorpId string // 企业ID - AgentId string // 应用ID - Secret string // 应用密钥 - ContactSecret string // 通讯录密钥 + CorpId string // 企业ID + AgentId string // 应用ID + Secret string // 应用密钥 + // ContactSecret string // 通讯录密钥 } func GetWorkWeixinConfig() *WorkWeixinConf { - corpid, _ := web.AppConfig.String("workweixin_corpid") - agentid, _ := web.AppConfig.String("workweixin_agentid") - secret, _ := web.AppConfig.String("workweixin_secret") - contact_secret, _ := web.AppConfig.String("workweixin_contact_secret") + corpid, _ := web.AppConfig.String("workweixin_corpid") + agentid, _ := web.AppConfig.String("workweixin_agentid") + secret, _ := web.AppConfig.String("workweixin_secret") + // contact_secret, _ := web.AppConfig.String("workweixin_contact_secret") - c := &WorkWeixinConf{ - CorpId: corpid, - AgentId: agentid, - Secret: secret, - ContactSecret: contact_secret, - } - return c + c := &WorkWeixinConf{ + CorpId: corpid, + AgentId: agentid, + Secret: secret, + // ContactSecret: contact_secret, + } + return c } diff --git a/controllers/AccountController.go b/controllers/AccountController.go index cb59b1346..57c9bcbbe 100644 --- a/controllers/AccountController.go +++ b/controllers/AccountController.go @@ -1,14 +1,18 @@ package controllers import ( + "context" "encoding/json" - "fmt" + "errors" + "github.com/mindoc-org/mindoc/cache" + "github.com/mindoc-org/mindoc/utils/auth2" + "github.com/mindoc-org/mindoc/utils/auth2/dingtalk" + "github.com/mindoc-org/mindoc/utils/auth2/wecom" "html/template" "math/rand" + "net/http" "net/url" - "reflect" "regexp" - "strconv" "strings" "time" @@ -21,14 +25,11 @@ import ( "github.com/mindoc-org/mindoc/mail" "github.com/mindoc-org/mindoc/models" "github.com/mindoc-org/mindoc/utils" - "github.com/mindoc-org/mindoc/utils/dingtalk" - "github.com/mindoc-org/mindoc/utils/workweixin" ) const ( - WorkWeixin_AuthorizeUrlBase = "https://open.weixin.qq.com/connect/oauth2/authorize" - WorkWeixin_QRConnectUrlBase = "https://open.work.weixin.qq.com/wwopen/sso/qrConnect" - SessionUserInfoKey = "session-user-info-key" + SessionUserInfoKey = "session-user-info-key" + AccessTokenCacheKey = "access-token-cache-key" ) var src = rand.New(rand.NewSource(time.Now().UnixNano())) @@ -46,7 +47,7 @@ func (c *AccountController) referer() string { return u } -func (c *AccountController) IsInWorkWeixin() (is_in_workweixin bool) { +func (c *AccountController) IsInWorkWeixin() bool { ua := c.Ctx.Input.UserAgent() var wechatRule = regexp.MustCompile(`\bMicroMessenger\/\d+(\.\d+)*\b`) var wxworkRule = regexp.MustCompile(`\bwxwork\/\d+(\.\d+)*\b`) @@ -58,15 +59,8 @@ func (c *AccountController) Prepare() { c.EnableXSRF = web.AppConfig.DefaultBool("enablexsrf", true) c.Data["xsrfdata"] = template.HTML(c.XSRFFormHTML()) - c.Data["CanLoginWorkWeixin"] = len(web.AppConfig.DefaultString("workweixin_corpid", "")) > 0 - - c.Data["corpID"], _ = web.AppConfig.String("dingtalk_corpid") - c.Data["CanLoginDingTalk"] = len(web.AppConfig.DefaultString("dingtalk_corpid", "")) > 0 - if reflect.ValueOf(c.Data["CanLoginDingTalk"]).Bool() { - c.Data["ENABLE_QR_DINGTALK"] = true - } - c.Data["dingtalk_qr_key"], _ = web.AppConfig.String("dingtalk_qr_key") + c.Data["CanLoginDingTalk"] = len(web.AppConfig.DefaultString("dingtalk_app_key", "")) > 0 if !c.EnableXSRF { return @@ -163,196 +157,175 @@ func (c *AccountController) Login() { logs.Error("用户登录 ->", err) c.JsonResult(500, i18n.Tr(c.Lang, "message.wrong_account_password"), nil) } + return + } + + referer := c.referer() + u := c.GetString("url") + if u == "" { + u = referer + if u == "" { + u = conf.BaseUrl + } } else { - // 默认登录方式 - login_method := "AccountController.Login" - var redirect_uri string - // 企业微信登录检查 - canLoginWorkWeixin := reflect.ValueOf(c.Data["CanLoginWorkWeixin"]).Bool() - referer := c.referer() - if canLoginWorkWeixin { - // 企业微信登录方式 - login_method = "AccountController.WorkWeixinLogin" - u := c.GetString("url") - if u == "" { - u = referer - if u == "" { - u = conf.BaseUrl - } - } else { - var schemaRule = regexp.MustCompile(`^https?\:\/\/`) - if !schemaRule.MatchString(u) { - u = conf.BaseUrl + u - } - } - redirect_uri = conf.URLFor(login_method, "url", url.PathEscape(u)) - // 是否在企业微信内部打开 - isInWorkWeixin := c.IsInWorkWeixin() - c.Data["IsInWorkWeixin"] = isInWorkWeixin - if isInWorkWeixin { - // 客户端拥有微信标识和企业微信标识 - c.Redirect(redirect_uri, 302) - return - } else { - c.Data["workweixin_login_url"] = redirect_uri - } + var schemaRule = regexp.MustCompile(`^https?\:\/\/`) + if !schemaRule.MatchString(u) { + u = conf.BaseUrl + u } - c.Data["url"] = referer } -} + c.Data["url"] = referer -// 钉钉登录 -func (c *AccountController) DingTalkLogin() { - code := c.GetString("dingtalk_code") - if code == "" { - c.JsonResult(500, i18n.Tr(c.Lang, "message.failed_obtain_user_info"), nil) + auth2Redirect := "AccountController.Auth2Redirect" + if can, _ := c.Data["CanLoginWorkWeixin"].(bool); can { + c.Data["workweixin_login_url"] = conf.URLFor(auth2Redirect, ":app", wecom.AppName, "url", url.PathEscape(u)) } - appKey, _ := web.AppConfig.String("dingtalk_app_key") - appSecret, _ := web.AppConfig.String("dingtalk_app_secret") - tmpReader, _ := web.AppConfig.String("dingtalk_tmp_reader") + if can, _ := c.Data["CanLoginDingTalk"].(bool); can { + c.Data["dingtalk_login_url"] = conf.URLFor(auth2Redirect, ":app", dingtalk.AppName, "url", url.PathEscape(u)) - if appKey == "" || appSecret == "" || tmpReader == "" { - c.JsonResult(500, i18n.Tr(c.Lang, "message.dingtalk_auto_login_not_enable"), nil) - c.StopRun() } + return +} - dingtalkAgent := dingtalk.NewDingTalkAgent(appSecret, appKey) - err := dingtalkAgent.GetAccesstoken() - if err != nil { - logs.Warn("获取钉钉临时Token失败 ->", err) - c.JsonResult(500, i18n.Tr(c.Lang, "message.failed_auto_login"), nil) - c.StopRun() - } +/* +Auth2.0 第三方对接思路: +1. Auth2Redirect: 点击相应第三方接口,路由重定向至第三方提供的Auth2.0地址 +2. Auth2Callback: 第三方回调处理,接收回调的授权码,并获取用户信息 + 已绑定: 则读取用户信息,直接登录 + 未绑定: 则弹窗提示(需要敏感信息) + a) Auth2BindAccount: 绑定已有账户(用户名+密码) + b) Auth2AutoAccount: 自动创建账户,以第三方用户ID作为用户名,密码123456。 + 用该方式创建的账户,无法使用账号密码登录,需要修改一次密码后才可以进行账号密码登录。 +*/ - userid, err := dingtalkAgent.GetUserIDByCode(code) - if err != nil { - logs.Warn("获取钉钉用户ID失败 ->", err) - c.JsonResult(500, i18n.Tr(c.Lang, "message.failed_auto_login"), nil) - c.StopRun() +func (c *AccountController) getAuth2Client() (auth2.Client, error) { + app := c.Ctx.Input.Param(":app") + var client auth2.Client + tokenKey := AccessTokenCacheKey + "-" + app + + switch app { + case wecom.AppName: + if can, _ := c.Data["CanLoginWorkWeixin"].(bool); !can { + return nil, errors.New("auth2.client.wecom.disabled") + } + corpId, _ := web.AppConfig.String("workweixin_corpid") + agentId, _ := web.AppConfig.String("workweixin_agentid") + secret, _ := web.AppConfig.String("workweixin_secret") + client = wecom.NewClient(corpId, agentId, secret) + + case dingtalk.AppName: + if can, _ := c.Data["CanLoginDingTalk"].(bool); !can { + return nil, errors.New("auth2.client.dingtalk.disabled") + } + + appKey, _ := web.AppConfig.String("dingtalk_app_key") + appSecret, _ := web.AppConfig.String("dingtalk_app_secret") + client = dingtalk.NewClient(appSecret, appKey) + + default: + return nil, errors.New("auth2.client.notsupported") } - username, avatar, err := dingtalkAgent.GetUserNameAndAvatarByUserID(userid) + var tokenCache auth2.AccessTokenCache + err := cache.Get(tokenKey, &tokenCache) if err != nil { - logs.Warn("获取钉钉用户信息失败 ->", err) - c.JsonResult(500, i18n.Tr(c.Lang, "message.failed_auto_login"), nil) - c.StopRun() + logs.Info("AccessToken从缓存读取失败") + token, err := client.GetAccessToken(context.Background()) + if err != nil { + return client, nil + } + tokenCache = auth2.NewAccessToken(token) + cache.Put(tokenKey, tokenCache, tokenCache.GetExpireIn()) } - member, err := models.NewMember().TmpLogin(tmpReader) - if err == nil { - member.LastLoginTime = time.Now() - _ = member.Update("last_login_time") - member.Account = username - if avatar != "" { - member.Avatar = avatar + // 处理过期Token + if tokenCache.IsExpired() { + token, err := client.GetAccessToken(context.Background()) + if err != nil { + return client, nil } + tokenCache = auth2.NewAccessToken(token) + cache.Put(tokenKey, tokenCache, tokenCache.GetExpireIn()) + } + + client.SetAccessToken(tokenCache) + return client, nil +} - c.SetMember(*member) +func (c *AccountController) parseAuth2CallbackParam() (code, state string) { + switch c.Ctx.Input.Param(":app") { + case wecom.AppName: + code = c.GetString("code") + state = c.GetString("state") + case dingtalk.AppName: + code = c.GetString("authCode") + state = c.GetString("state") } - c.JsonResult(0, "ok", username) + + logs.Debug("code: ", code) + logs.Debug("state: ", state) + return } -// WorkWeixinLogin 用户企业微信登录 -func (c *AccountController) WorkWeixinLogin() { - logs.Info("UserAgent: ", c.Ctx.Input.UserAgent()) // debug +func (c *AccountController) getAuth2Account() (models.Auth2Account, error) { + switch c.Ctx.Input.Param(":app") { + case wecom.AppName: + return models.NewWorkWeixinAccount(), nil - if member, ok := c.GetSession(conf.LoginSessionName).(models.Member); ok && member.MemberId > 0 { - u := c.GetString("url") - if u == "" { - u = c.Ctx.Request.Header.Get("Referer") - if u == "" { - u = conf.URLFor("HomeController.Index") - } - } - // session自动登录时刷新session内容 - member, err := models.NewMember().Find(member.MemberId) - if err != nil { - c.DelSession(conf.LoginSessionName) - c.SetMember(models.Member{}) - c.SetSecureCookie(conf.GetAppKey(), "login", "", -3600) - } else { - c.SetMember(*member) - } - c.Redirect(u, 302) + case dingtalk.AppName: + return models.NewDingTalkAccount(), nil } - var remember CookieRemember - // 如果 Cookie 中存在登录信息 - if cookie, ok := c.GetSecureCookie(conf.GetAppKey(), "login"); ok { - if err := utils.Decode(cookie, &remember); err == nil { - if member, err := models.NewMember().Find(remember.MemberId); err == nil { - c.SetMember(*member) - c.LoggedIn(false) - c.StopRun() - } - } + + return nil, errors.New("auth2.account.notsupported") +} + +// Auth2Redirect 第三方auth2.0登录: 钉钉、企业微信 +func (c *AccountController) Auth2Redirect() { + client, err := c.getAuth2Client() + if err != nil { + c.DelSession(conf.LoginSessionName) + c.SetMember(models.Member{}) + c.SetSecureCookie(conf.GetAppKey(), "login", "", -3600) + c.StopRun() + return } - if c.Ctx.Input.IsPost() { - // account := c.GetString("account") - // password := c.GetString("password") - // captcha := c.GetString("code") - // isRemember := c.GetString("is_remember") - c.JsonResult(400, "request method not allowed", nil) - } else { - var callback_u string - u := c.GetString("url") - if u == "" { - u = c.referer() - } - if u != "" { - var schemaRule = regexp.MustCompile(`^https?\:\/\/`) - if !schemaRule.MatchString(u) { - u = strings.TrimRight(conf.BaseUrl, "/") + strings.TrimLeft(u, "/") - } - } - if u == "" { - callback_u = conf.URLFor("AccountController.WorkWeixinLoginCallback") - } else { - callback_u = conf.URLFor("AccountController.WorkWeixinLoginCallback", "url", url.PathEscape(u)) - } - logs.Info("callback_u: ", callback_u) // debug - - state := "mindoc" - workweixinConf := conf.GetWorkWeixinConfig() - appid := workweixinConf.CorpId - agentid := workweixinConf.AgentId - var redirect_uri string - - isInWorkWeixin := c.IsInWorkWeixin() - c.Data["IsInWorkWeixin"] = isInWorkWeixin - if isInWorkWeixin { - // 企业微信内-网页授权登录 - urlFmt := "%s?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=%s#wechat_redirect" - redirect_uri = fmt.Sprintf(urlFmt, WorkWeixin_AuthorizeUrlBase, appid, url.PathEscape(callback_u), state) - } else { - // 浏览器内-扫码授权登录 - urlFmt := "%s?appid=%s&agentid=%s&redirect_uri=%s&state=%s" - redirect_uri = fmt.Sprintf(urlFmt, WorkWeixin_QRConnectUrlBase, appid, agentid, url.PathEscape(callback_u), state) + app := c.Ctx.Input.Param(":app") + var isAppBrowser bool + switch app { + case wecom.AppName: + isAppBrowser = c.IsInWorkWeixin() + } + + var callback string + u := c.GetString("url") + if u == "" { + u = c.referer() + callback = conf.URLFor("AccountController.Auth2Callback", ":app", app) + } + if u != "" { + var schemaRule = regexp.MustCompile(`^https?\:\/\/`) + if !schemaRule.MatchString(u) { + u = strings.TrimRight(conf.BaseUrl, "/") + strings.TrimLeft(u, "/") } - logs.Info("redirect_uri: ", redirect_uri) // debug - c.Redirect(redirect_uri, 302) + callback = conf.URLFor("AccountController.Auth2Callback", ":app", app, "url", url.PathEscape(u)) } -} -/* -思路: -1. 浏览器打开 - 用户名+密码 登录 与企业微信没有交集 - 手机企业微信登录->扫码页面->扫码后获取用户信息, 判断是否绑定了企业微信 - 已绑定,则读取用户信息,直接登录 - 未绑定,则弹窗提示[未绑定企业微信,请先在企业微信中打开,完成绑定] -2. 企业微信打开->自动登录->判断是否绑定了企业微信 - 已绑定,则读取用户信息,直接登录 - 未绑定,则弹窗提示 - 是否已有账户(用户名+密码方式) - 有: 弹窗输入[用户名+密码+验证码]校验 - 无: 直接以企业UserId作为用户名(小写),创建随机密码 -*/ + logs.Debug("callback: ", callback) // debug + c.Redirect(client.BuildURL(callback, isAppBrowser), http.StatusFound) +} -// WorkWeixinLoginCallback 用户企业微信登录-回调 -func (c *AccountController) WorkWeixinLoginCallback() { - c.TplName = "account/workweixin-login-callback.tpl" +// Auth2Callback 第三方auth2.0回调 +func (c *AccountController) Auth2Callback() { + client, err := c.getAuth2Client() + if err != nil { + c.DelSession(conf.LoginSessionName) + c.SetMember(models.Member{}) + c.SetSecureCookie(conf.GetAppKey(), "login", "", -3600) + c.StopRun() + logs.Error(err) + return + } if member, ok := c.GetSession(conf.LoginSessionName).(models.Member); ok && member.MemberId > 0 { u := c.GetString("url") @@ -385,356 +358,782 @@ func (c *AccountController) WorkWeixinLoginCallback() { } } + c.TplName = "account/auth2_callback.tpl" + bindExisted := "false" + errMsg := "" + userInfoJson := "{}" + defer func() { + c.Data["bind_existed"] = template.JS(bindExisted) + logs.Debug("bind_existed: ", bindExisted) + c.Data["error_msg"] = template.JS(errMsg) + c.Data["user_info_json"] = template.JS(userInfoJson) + c.Data["app"] = template.JS(c.Ctx.Input.Param(":app")) + }() + // 请求参数获取 - req_code := c.GetString("code") - logs.Warning("req_code: ", req_code) - req_state := c.GetString("state") - logs.Warning("req_state: ", req_state) - var user_info_json string - var error_msg string - var bind_existed string - if len(req_code) > 0 && req_state == "mindoc" { - // 获取当前应用的access_token - access_token, ok := workweixin.GetAccessToken(false) - if ok { - logs.Warning("access_token: ", access_token) - // 获取当前请求的userid - user_id, ok := workweixin.RequestUserId(access_token, req_code) - if ok { - logs.Warning("user_id: ", user_id) - // 获取通讯录应用的access_token - contact_access_token, ok := workweixin.GetAccessToken(true) - if ok { - logs.Warning("contact_access_token: ", contact_access_token) - user_info, err_msg, ok := workweixin.RequestUserInfo(contact_access_token, user_id) - if ok { - // [-------所有字段-Debug---------- - // user_info.UserId - // user_info.Name - // user_info.HideMobile - // user_info.Mobile - // user_info.Department - // user_info.Email - // user_info.IsLeaderInDept - // user_info.IsLeader - // user_info.Avatar - // user_info.Alias - // user_info.Status - // user_info.MainDepartment - // -----------------------------] - // logs.Debug("user_info.UserId: ", user_info.UserId) - // logs.Debug("user_info.Name: ", user_info.Name) - json_info, _ := json.Marshal(user_info) - user_info_json = string(json_info) - // 查询系统现有数据,是否绑定了当前请求用户的企业微信 - member, err := models.NewWorkWeixinAccount().ExistedMember(user_info.UserId) - if err == nil { - member.LastLoginTime = time.Now() - _ = member.Update("last_login_time") - - c.SetMember(*member) - - var remember CookieRemember - remember.MemberId = member.MemberId - remember.Account = member.Account - remember.Time = time.Now() - v, err := utils.Encode(remember) - if err == nil { - c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) - } - bind_existed = "true" - error_msg = "" - u := c.GetString("url") - if u == "" { - u = conf.URLFor("HomeController.Index") - } - c.Redirect(u, 302) - } else { - if err == orm.ErrNoRows { - c.SetSession(SessionUserInfoKey, user_info) - bind_existed = "false" - error_msg = "" - } else { - logs.Error("Error: ", err) - error_msg = "数据库错误: " + err.Error() - } - } - // - } else { - error_msg = "获取用户信息失败: " + err_msg - } - } else { - error_msg = "通讯录访问凭据获取失败: " + contact_access_token - } + code, state := c.parseAuth2CallbackParam() + if err := client.ValidateCallback(state); err != nil { + c.DelSession(conf.LoginSessionName) + c.SetMember(models.Member{}) + c.SetSecureCookie(conf.GetAppKey(), "login", "", -3600) + errMsg = err.Error() + logs.Error(err) + return + } + + userInfo, err := client.GetUserInfo(context.Background(), code) + if err != nil { + c.DelSession(conf.LoginSessionName) + c.SetMember(models.Member{}) + c.SetSecureCookie(conf.GetAppKey(), "login", "", -3600) + errMsg = err.Error() + logs.Error(err) + return + } + + account, err := c.getAuth2Account() + if err != nil { + logs.Error("获取Auth2用户失败 ->", err) + c.JsonResult(500, "不支持的第三方用户", nil) + return + } + + member, err := account.ExistedMember(userInfo.UserId) + if err != nil { + if err == orm.ErrNoRows { + if userInfo.Mobile == "" { + errMsg = "请到应用浏览器中登录,并授权获取敏感信息。" } else { - error_msg = "获取用户Id失败: " + user_id + jsonInfo, _ := json.Marshal(userInfo) + userInfoJson = string(jsonInfo) + errMsg = "" + c.SetSession(SessionUserInfoKey, userInfo) } } else { - error_msg = "应用凭据获取失败: " + access_token + logs.Error("Error: ", err) + errMsg = "登录错误: " + err.Error() } - } else { - error_msg = "参数错误" - } - if user_info_json == "" { - user_info_json = "{}" - } - if bind_existed == "" { - bind_existed = "null" - } - // refer & doc: - // - https://golang.org/pkg/html/template/#HTML - // - https://stackoverflow.com/questions/24411880/go-html-templates-can-i-stop-the-templates-package-inserting-quotes-around-stri - // - https://stackoverflow.com/questions/38035176/insert-javascript-snippet-inside-template-with-beego-golang - c.Data["bind_existed"] = template.JS(bind_existed) - logs.Debug("bind_existed: ", bind_existed) - c.Data["error_msg"] = template.JS(error_msg) - c.Data["user_info_json"] = template.JS(user_info_json) - /* - // 调试: 显示源码 - result, err := c.RenderString() - if err != nil { - logs.Error(err) - } else { - logs.Warning(result) - } - */ -} + return + } -// WorkWeixinLoginBind 用户企业微信登录-绑定 -func (c *AccountController) WorkWeixinLoginBind() { - if user_info, ok := c.GetSession(SessionUserInfoKey).(workweixin.WorkWeixinUserInfo); ok && len(user_info.UserId) > 0 { - req_account := c.GetString("account") - req_password := c.GetString("password") - if req_account == "" || req_password == "" { - c.JsonResult(400, "账号或密码不能为空") - } else { - member, err := models.NewMember().Login(req_account, req_password) - if err == nil { - account := models.NewWorkWeixinAccount() - account.MemberId = member.MemberId - account.WorkWeixin_UserId = user_info.UserId - member.CreateAt = 0 - ormer := orm.NewOrm() - o, err := ormer.Begin() - if err != nil { - logs.Error("开启事物时出错 -> ", err) - c.JsonResult(500, "开启事物时出错: ", err.Error()) - } - if err := account.AddBind(ormer); err != nil { - o.Rollback() - c.JsonResult(500, "绑定失败,数据库错误: "+err.Error()) - } else { - member.LastLoginTime = time.Now() - member.RealName = user_info.Name - member.Avatar = user_info.Avatar - if len(member.Avatar) < 1 { - member.Avatar = conf.GetDefaultAvatar() - } - member.Email = user_info.Email - member.Phone = user_info.Mobile - if _, err := ormer.Update(member, "last_login_time", "real_name", "avatar", "email", "phone"); err != nil { - o.Rollback() - logs.Error("保存用户信息失败=>", err) - c.JsonResult(500, "绑定失败,现有账户信息更新失败: "+err.Error()) - } else { - if err := o.Commit(); err != nil { - logs.Error("提交事物时出错 -> ", err) - c.JsonResult(500, "提交事物时出错: ", err.Error()) - } else { - c.DelSession(SessionUserInfoKey) - c.SetMember(*member) - - var remember CookieRemember - remember.MemberId = member.MemberId - remember.Account = member.Account - remember.Time = time.Now() - v, err := utils.Encode(remember) - if err == nil { - c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) - c.JsonResult(0, "绑定成功", nil) - } else { - c.JsonResult(500, "绑定成功, 但自动登录失败, 请返回首页重新登录", nil) - } - } - } + bindExisted = "true" + errMsg = "" - } + member.LastLoginTime = time.Now() + _ = member.Update("last_login_time") - } else { - logs.Error("用户登录 ->", err) - c.JsonResult(500, "账号或密码错误", nil) - } - c.JsonResult(500, "TODO: 绑定以后账号功能开发中") - } - } else { - if ok { - c.DelSession(SessionUserInfoKey) - } - c.JsonResult(400, "请求错误, 请从首页重新登录") + c.SetMember(*member) + remember.MemberId = member.MemberId + remember.Account = member.Account + remember.Time = time.Now() + v, err := utils.Encode(remember) + if err == nil { + c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) } + u := c.GetString("url") + if u == "" { + u = conf.URLFor("HomeController.Index") + } + c.Redirect(u, 302) } -// WorkWeixinLoginIgnore 用户企业微信登录-忽略 -func (c *AccountController) WorkWeixinLoginIgnore() { - if user_info, ok := c.GetSession(SessionUserInfoKey).(workweixin.WorkWeixinUserInfo); ok && len(user_info.UserId) > 0 { +// Auth2BindAccount 第三方auth2.0绑定已有账号 +func (c *AccountController) Auth2BindAccount() { + userInfo, ok := c.GetSession(SessionUserInfoKey).(auth2.UserInfo) + if !ok || len(userInfo.UserId) <= 0 { c.DelSession(SessionUserInfoKey) - member := models.NewMember() + c.JsonResult(400, "请求错误, 请从首页重新登录") + return + } - if _, err := member.FindByAccount(user_info.UserId); err == nil && member.MemberId > 0 { - c.JsonResult(400, "账号已存在") - } + account := c.GetString("account") + password := c.GetString("password") + if account == "" || password == "" { + c.JsonResult(400, "账号或密码不能为空") + return + } - ormer := orm.NewOrm() - o, err := ormer.Begin() - if err != nil { - logs.Error("开启事物时出错 -> ", err) - c.JsonResult(500, "开启事物时出错: ", err.Error()) - } + member, err := models.NewMember().Login(account, password) + if err != nil { + logs.Error("用户登录 ->", err) + c.JsonResult(500, "账号或密码错误", nil) + return + } - member.Account = user_info.UserId - member.RealName = user_info.Name - var rnd = rand.New(src) - // fmt.Sprintf("%x", rnd.Uint64()) - // strconv.FormatUint(rnd.Uint64(), 16) - member.Password = user_info.UserId + strconv.FormatUint(rnd.Uint64(), 16) - member.Password = "pathea.2020" // 强制设置默认密码,不然无法修改密码(因为目前修改密码需要知道当前密码) - hash, err := utils.PasswordHash(member.Password) - if err != nil { - logs.Error("加密用户密码失败 =>", err) - c.JsonResult(500, "加密用户密码失败"+err.Error()) - } else { - logs.Error("member.Password: ", member.Password) - logs.Error("hash: ", hash) - member.Password = hash - } - member.Role = conf.MemberGeneralRole - member.Avatar = user_info.Avatar - if len(member.Avatar) < 1 { - member.Avatar = conf.GetDefaultAvatar() - } - member.CreateAt = 0 - member.Email = user_info.Email - member.Phone = user_info.Mobile - member.Status = 0 - if _, err = ormer.Insert(member); err != nil { - o.Rollback() - c.JsonResult(500, "注册失败,数据库错误: "+err.Error()) - } else { - account := models.NewWorkWeixinAccount() - account.MemberId = member.MemberId - account.WorkWeixin_UserId = user_info.UserId - member.CreateAt = 0 - if err := account.AddBind(ormer); err != nil { - o.Rollback() - c.JsonResult(500, "注册失败,数据库错误: "+err.Error()) - } else { - if err := o.Commit(); err != nil { - logs.Error("提交事物时出错 -> ", err) - c.JsonResult(500, "提交事物时出错: ", err.Error()) - } else { - member.LastLoginTime = time.Now() - _ = member.Update("last_login_time") - - c.SetMember(*member) - - var remember CookieRemember - remember.MemberId = member.MemberId - remember.Account = member.Account - remember.Time = time.Now() - v, err := utils.Encode(remember) - if err == nil { - c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) - c.JsonResult(0, "绑定成功", nil) - } else { - c.JsonResult(500, "绑定成功, 但自动登录失败, 请返回首页重新登录", nil) - } - } - } - } - } else { - if ok { - c.DelSession(SessionUserInfoKey) - } - c.JsonResult(400, "请求错误, 请从首页重新登录") + bindAccount, err := c.getAuth2Account() + if err != nil { + logs.Error("获取Auth2用户失败 ->", err) + c.JsonResult(500, "不支持的第三方用户", nil) + return + } + + member.CreateAt = 0 + ormer := orm.NewOrm() + o, err := ormer.Begin() + if err != nil { + logs.Error("开启事务时出错 -> ", err) + c.JsonResult(500, "开启事务时出错: ", err.Error()) + return + } + if err := bindAccount.AddBind(ormer, userInfo, member); err != nil { + logs.Error(err) + o.Rollback() + c.JsonResult(500, "绑定失败,数据库错误: "+err.Error()) + return } + + // 绑定成功之后修改用户信息 + member.LastLoginTime = time.Now() + //member.RealName = user_info.Name + //member.Avatar = user_info.Avatar + if len(member.Avatar) < 1 { + member.Avatar = conf.GetDefaultAvatar() + } + //member.Email = user_info.Email + //member.Phone = user_info.Mobile + if _, err := ormer.Update(member, "last_login_time", "real_name", "avatar", "email", "phone"); err != nil { + o.Rollback() + logs.Error("保存用户信息失败=>", err) + c.JsonResult(500, "绑定失败,现有账户信息更新失败: "+err.Error()) + return + + } + + if err := o.Commit(); err != nil { + logs.Error("开启事务时出错 -> ", err) + c.JsonResult(500, "开启事务时出错: ", err.Error()) + return + } + + c.DelSession(SessionUserInfoKey) + c.SetMember(*member) + + var remember CookieRemember + remember.MemberId = member.MemberId + remember.Account = member.Account + remember.Time = time.Now() + v, err := utils.Encode(remember) + if err != nil { + c.JsonResult(500, "绑定成功, 但自动登录失败, 请返回首页重新登录", nil) + return + } + + c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) + c.JsonResult(0, "绑定成功", nil) } -// QR二维码登录 -func (c *AccountController) QRLogin() { - appName := c.Ctx.Input.Param(":app") - - switch appName { - // 钉钉扫码登录 - case "dingtalk": - code := c.GetString("code") - state := c.GetString("state") - if state != "1" || code == "" { - c.Redirect(conf.URLFor("AccountController.Login"), 302) - c.StopRun() - } - appKey, _ := web.AppConfig.String("dingtalk_qr_key") - appSecret, _ := web.AppConfig.String("dingtalk_qr_secret") +// Auth2AutoAccount auth2.0自动创建账号 +func (c *AccountController) Auth2AutoAccount() { + app := c.Ctx.Input.Param(":app") + logs.Debug("app: ", app) - qrDingtalk := dingtalk.NewDingtalkQRLogin(appSecret, appKey) - unionID, err := qrDingtalk.GetUnionIDByCode(code) - if err != nil { - logs.Warn("获取钉钉临时UnionID失败 ->", err) - c.Redirect(conf.URLFor("AccountController.Login"), 302) - c.StopRun() - } + userInfo, ok := c.GetSession(SessionUserInfoKey).(auth2.UserInfo) + if !ok || len(userInfo.UserId) <= 0 { + c.DelSession(SessionUserInfoKey) + c.JsonResult(400, "请求错误, 请从首页重新登录") + return + } - appKey, _ = web.AppConfig.String("dingtalk_app_key") - appSecret, _ = web.AppConfig.String("dingtalk_app_secret") - tmpReader, _ := web.AppConfig.String("dingtalk_tmp_reader") + c.DelSession(SessionUserInfoKey) + member := models.NewMember() - dingtalkAgent := dingtalk.NewDingTalkAgent(appSecret, appKey) - err = dingtalkAgent.GetAccesstoken() - if err != nil { - logs.Warn("获取钉钉临时Token失败 ->", err) - c.Redirect(conf.URLFor("AccountController.Login"), 302) - c.StopRun() - } + if _, err := member.FindByAccount(userInfo.UserId); err == nil && member.MemberId > 0 { + c.JsonResult(400, "账号已存在") + return + } - userid, err := dingtalkAgent.GetUserIDByUnionID(unionID) - if err != nil { - logs.Warn("获取钉钉用户ID失败 ->", err) - c.Redirect(conf.URLFor("AccountController.Login"), 302) - c.StopRun() - } + ormer := orm.NewOrm() + o, err := ormer.Begin() + if err != nil { + logs.Error("开启事务时出错 -> ", err) + c.JsonResult(500, "开启事务时出错: ", err.Error()) + return + } - username, avatar, err := dingtalkAgent.GetUserNameAndAvatarByUserID(userid) - if err != nil { - logs.Warn("获取钉钉用户信息失败 ->", err) - c.Redirect(conf.URLFor("AccountController.Login"), 302) - c.StopRun() - } + member.Account = userInfo.UserId + member.RealName = userInfo.Name + member.Password = "123456" // 强制设置默认密码,需修改一次密码后,才可以进行账号密码登录 + hash, err := utils.PasswordHash(member.Password) - member, err := models.NewMember().TmpLogin(tmpReader) - if err == nil { - member.LastLoginTime = time.Now() - _ = member.Update("last_login_time") - member.Account = username - if avatar != "" { - member.Avatar = avatar - } + if err != nil { + logs.Error("加密用户密码失败 =>", err) + c.JsonResult(500, "加密用户密码失败"+err.Error()) + return + } - c.SetMember(*member) - c.LoggedIn(false) - c.StopRun() - } - c.Redirect(conf.URLFor("AccountController.Login"), 302) + logs.Debug("member.Password: ", member.Password) + logs.Debug("hash: ", hash) + member.Password = hash - // 企业微信扫码登录 - case "workweixin": - // + member.Role = conf.MemberGeneralRole + member.Avatar = userInfo.Avatar + if len(member.Avatar) < 1 { + member.Avatar = conf.GetDefaultAvatar() + } + member.CreateAt = 0 + member.Email = userInfo.Mail + member.Phone = userInfo.Mobile + member.Status = 0 + if _, err = ormer.Insert(member); err != nil { + o.Rollback() + c.JsonResult(500, "注册失败,数据库错误: "+err.Error()) + return + } - default: - c.Redirect(conf.URLFor("AccountController.Login"), 302) - c.StopRun() + account, err := c.getAuth2Account() + if err != nil { + logs.Error("获取Auth2用户失败 ->", err) + c.JsonResult(500, "不支持的第三方用户", nil) + return + } + + member.CreateAt = 0 + if err := account.AddBind(ormer, userInfo, member); err != nil { + logs.Error(err) + o.Rollback() + c.JsonResult(500, "注册失败,数据库错误: "+err.Error()) + return + } + + if err := o.Commit(); err != nil { + logs.Error("提交事务时出错 -> ", err) + c.JsonResult(500, "提交事务时出错: ", err.Error()) + return } + + member.LastLoginTime = time.Now() + _ = member.Update("last_login_time") + + c.SetMember(*member) + + var remember CookieRemember + remember.MemberId = member.MemberId + remember.Account = member.Account + remember.Time = time.Now() + v, err := utils.Encode(remember) + if err != nil { + c.JsonResult(500, "绑定成功, 但自动登录失败, 请返回首页重新登录", nil) + return + } + + c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) + c.JsonResult(0, "绑定成功", nil) } +// 钉钉登录 +//func (c *AccountController) DingTalkLogin() { +// code := c.GetString("dingtalk_code") +// if code == "" { +// c.JsonResult(500, i18n.Tr(c.Lang, "message.failed_obtain_user_info"), nil) +// } +// +// appKey, _ := web.AppConfig.String("dingtalk_app_key") +// appSecret, _ := web.AppConfig.String("dingtalk_app_secret") +// tmpReader, _ := web.AppConfig.String("dingtalk_tmp_reader") +// +// if appKey == "" || appSecret == "" || tmpReader == "" { +// c.JsonResult(500, i18n.Tr(c.Lang, "message.dingtalk_auto_login_not_enable"), nil) +// c.StopRun() +// } +// +// dingtalkAgent := dingtalk.NewDingTalkAgent(appSecret, appKey) +// err := dingtalkAgent.GetAccesstoken() +// if err != nil { +// logs.Warn("获取钉钉临时Token失败 ->", err) +// c.JsonResult(500, i18n.Tr(c.Lang, "message.failed_auto_login"), nil) +// c.StopRun() +// } +// +// userid, err := dingtalkAgent.GetUserIDByCode(code) +// if err != nil { +// logs.Warn("获取钉钉用户ID失败 ->", err) +// c.JsonResult(500, i18n.Tr(c.Lang, "message.failed_auto_login"), nil) +// c.StopRun() +// } +// +// username, avatar, err := dingtalkAgent.GetUserNameAndAvatarByUserID(userid) +// if err != nil { +// logs.Warn("获取钉钉用户信息失败 ->", err) +// c.JsonResult(500, i18n.Tr(c.Lang, "message.failed_auto_login"), nil) +// c.StopRun() +// } +// +// member, err := models.NewMember().TmpLogin(tmpReader) +// if err == nil { +// member.LastLoginTime = time.Now() +// _ = member.Update("last_login_time") +// member.Account = username +// if avatar != "" { +// member.Avatar = avatar +// } +// +// c.SetMember(*member) +// } +// c.JsonResult(0, "ok", username) +//} + +// WorkWeixinLogin 用户企业微信登录 +//func (c *AccountController) WorkWeixinLogin() { +// logs.Info("UserAgent: ", c.Ctx.Input.UserAgent()) // debug +// +// if member, ok := c.GetSession(conf.LoginSessionName).(models.Member); ok && member.MemberId > 0 { +// u := c.GetString("url") +// if u == "" { +// u = c.Ctx.Request.Header.Get("Referer") +// if u == "" { +// u = conf.URLFor("HomeController.Index") +// } +// } +// // session自动登录时刷新session内容 +// member, err := models.NewMember().Find(member.MemberId) +// if err != nil { +// c.DelSession(conf.LoginSessionName) +// c.SetMember(models.Member{}) +// c.SetSecureCookie(conf.GetAppKey(), "login", "", -3600) +// } else { +// c.SetMember(*member) +// } +// c.Redirect(u, 302) +// } +// var remember CookieRemember +// // 如果 Cookie 中存在登录信息 +// if cookie, ok := c.GetSecureCookie(conf.GetAppKey(), "login"); ok { +// if err := utils.Decode(cookie, &remember); err == nil { +// if member, err := models.NewMember().Find(remember.MemberId); err == nil { +// c.SetMember(*member) +// c.LoggedIn(false) +// c.StopRun() +// } +// } +// } +// +// if c.Ctx.Input.IsPost() { +// // account := c.GetString("account") +// // password := c.GetString("password") +// // captcha := c.GetString("code") +// // isRemember := c.GetString("is_remember") +// c.JsonResult(400, "request method not allowed", nil) +// } else { +// var callback_u string +// u := c.GetString("url") +// if u == "" { +// u = c.referer() +// } +// if u != "" { +// var schemaRule = regexp.MustCompile(`^https?\:\/\/`) +// if !schemaRule.MatchString(u) { +// u = strings.TrimRight(conf.BaseUrl, "/") + strings.TrimLeft(u, "/") +// } +// } +// if u == "" { +// callback_u = conf.URLFor("AccountController.WorkWeixinLoginCallback") +// } else { +// callback_u = conf.URLFor("AccountController.WorkWeixinLoginCallback", "url", url.PathEscape(u)) +// } +// logs.Info("callback_u: ", callback_u) // debug +// +// state := "mindoc" +// workweixinConf := conf.GetWorkWeixinConfig() +// appid := workweixinConf.CorpId +// agentid := workweixinConf.AgentId +// var redirect_uri string +// +// isInWorkWeixin := c.IsInWorkWeixin() +// c.Data["IsInWorkWeixin"] = isInWorkWeixin +// if isInWorkWeixin { +// // 企业微信内-网页授权登录 +// urlFmt := "%s?appid=%s&agentid=%s&redirect_uri=%s&response_type=code&scope=snsapi_privateinfo&state=%s#wechat_redirect" +// redirect_uri = fmt.Sprintf(urlFmt, WorkWeixin_AuthorizeUrlBase, appid, agentid, url.PathEscape(callback_u), state) +// } else { +// // 浏览器内-扫码授权登录 +// urlFmt := "%s?login_type=CorpApp&appid=%s&agentid=%s&redirect_uri=%s&state=%s" +// redirect_uri = fmt.Sprintf(urlFmt, WorkWeixin_QRConnectUrlBase, appid, agentid, url.PathEscape(callback_u), state) +// } +// logs.Info("redirect_uri: ", redirect_uri) // debug +// c.Redirect(redirect_uri, 302) +// } +//} + +/* +思路: +1. 浏览器打开 + 用户名+密码 登录 与企业微信没有交集 + 手机企业微信登录->扫码页面->扫码后获取用户信息, 判断是否绑定了企业微信 + 已绑定,则读取用户信息,直接登录 + 未绑定,则弹窗提示[未绑定企业微信,请先在企业微信中打开,完成绑定] +2. 企业微信打开->自动登录->判断是否绑定了企业微信 + 已绑定,则读取用户信息,直接登录 + 未绑定,则弹窗提示 + 是否已有账户(用户名+密码方式) + 有: 弹窗输入[用户名+密码+验证码]校验 + 无: 直接以企业UserId作为用户名(小写),创建随机密码 +*/ + +// WorkWeixinLoginCallback 用户企业微信登录-回调 +//func (c *AccountController) WorkWeixinLoginCallback() { +// c.TplName = "account/auth2_callback.tpl" +// +// if member, ok := c.GetSession(conf.LoginSessionName).(models.Member); ok && member.MemberId > 0 { +// u := c.GetString("url") +// if u == "" { +// u = c.Ctx.Request.Header.Get("Referer") +// } +// if u == "" { +// u = conf.URLFor("HomeController.Index") +// } +// member, err := models.NewMember().Find(member.MemberId) +// if err != nil { +// c.DelSession(conf.LoginSessionName) +// c.SetMember(models.Member{}) +// c.SetSecureCookie(conf.GetAppKey(), "login", "", -3600) +// } else { +// c.SetMember(*member) +// } +// c.Redirect(u, 302) +// } +// +// var remember CookieRemember +// // 如果 Cookie 中存在登录信息 +// if cookie, ok := c.GetSecureCookie(conf.GetAppKey(), "login"); ok { +// if err := utils.Decode(cookie, &remember); err == nil { +// if member, err := models.NewMember().Find(remember.MemberId); err == nil { +// c.SetMember(*member) +// c.LoggedIn(false) +// c.StopRun() +// } +// } +// } +// +// // 请求参数获取 +// req_code := c.GetString("code") +// logs.Warning("req_code: ", req_code) +// req_state := c.GetString("state") +// logs.Warning("req_state: ", req_state) +// var user_info_json string +// var error_msg string +// var bind_existed string +// if len(req_code) > 0 && req_state == "mindoc" { +// // 获取当前应用的access_token +// access_token, ok := workweixin.GetAccessToken() +// if ok { +// logs.Warning("access_token: ", access_token) +// // 获取当前请求的userid +// user_id, ticket, ok := workweixin.RequestUserId(access_token, req_code) +// if ok { +// logs.Warning("user_id: ", user_id) +// // 查询系统现有数据,是否绑定了当前请求用户的企业微信 +// member, err := models.NewWorkWeixinAccount().ExistedMember(user_id) +// if err == nil { +// member.LastLoginTime = time.Now() +// _ = member.Update("last_login_time") +// +// c.SetMember(*member) +// +// var remember CookieRemember +// remember.MemberId = member.MemberId +// remember.Account = member.Account +// remember.Time = time.Now() +// v, err := utils.Encode(remember) +// if err == nil { +// c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) +// } +// bind_existed = "true" +// error_msg = "" +// u := c.GetString("url") +// if u == "" { +// u = conf.URLFor("HomeController.Index") +// } +// c.Redirect(u, 302) +// } else if err == orm.ErrNoRows { +// bind_existed = "false" +// if ticket == "" { +// error_msg = "请到企业微信中登录,并授权获取敏感信息。" +// } else { +// user_info, err := workweixin.RequestUserPrivateInfo(access_token, user_id, ticket) +// if err != nil { +// error_msg = "获取敏感信息错误: " + err.Error() +// } else { +// json_info, _ := json.Marshal(user_info) +// user_info_json = string(json_info) +// error_msg = "" +// c.SetSession(SessionUserInfoKey, user_info) +// } +// } +// } else { +// logs.Error("Error: ", err) +// error_msg = "登录错误: " + err.Error() +// } +// } else { +// error_msg = "获取用户Id失败: " + user_id +// } +// } else { +// error_msg = "应用凭据获取失败: " + access_token +// } +// } else { +// error_msg = "参数错误" +// } +// if user_info_json == "" { +// user_info_json = "{}" +// } +// if bind_existed == "" { +// bind_existed = "null" +// } +// // refer & doc: +// // - https://golang.org/pkg/html/template/#HTML +// // - https://stackoverflow.com/questions/24411880/go-html-templates-can-i-stop-the-templates-package-inserting-quotes-around-stri +// // - https://stackoverflow.com/questions/38035176/insert-javascript-snippet-inside-template-with-beego-golang +// c.Data["bind_existed"] = template.JS(bind_existed) +// logs.Debug("bind_existed: ", bind_existed) +// c.Data["error_msg"] = template.JS(error_msg) +// c.Data["user_info_json"] = template.JS(user_info_json) +// /* +// // 调试: 显示源码 +// result, err := c.RenderString() +// if err != nil { +// logs.Error(err) +// } else { +// logs.Warning(result) +// } +// */ +//} + +// WorkWeixinLoginBind 用户企业微信登录-绑定 +//func (c *AccountController) WorkWeixinLoginBind() { +// if user_info, ok := c.GetSession(SessionUserInfoKey).(workweixin.WorkWeixinUserPrivateInfo); ok && len(user_info.UserId) > 0 { +// req_account := c.GetString("account") +// req_password := c.GetString("password") +// if req_account == "" || req_password == "" { +// c.JsonResult(400, "账号或密码不能为空") +// } else { +// member, err := models.NewMember().Login(req_account, req_password) +// if err == nil { +// account := models.NewWorkWeixinAccount() +// account.MemberId = member.MemberId +// account.WorkWeixin_UserId = user_info.UserId +// member.CreateAt = 0 +// ormer := orm.NewOrm() +// o, err := ormer.Begin() +// if err != nil { +// logs.Error("开启事务时出错 -> ", err) +// c.JsonResult(500, "开启事务时出错: ", err.Error()) +// } +// if err := account.AddBind(ormer); err != nil { +// o.Rollback() +// c.JsonResult(500, "绑定失败,数据库错误: "+err.Error()) +// } else { +// // 绑定成功之后修改用户信息 +// member.LastLoginTime = time.Now() +// //member.RealName = user_info.Name +// //member.Avatar = user_info.Avatar +// if len(member.Avatar) < 1 { +// member.Avatar = conf.GetDefaultAvatar() +// } +// //member.Email = user_info.Email +// //member.Phone = user_info.Mobile +// if _, err := ormer.Update(member, "last_login_time", "real_name", "avatar", "email", "phone"); err != nil { +// o.Rollback() +// logs.Error("保存用户信息失败=>", err) +// c.JsonResult(500, "绑定失败,现有账户信息更新失败: "+err.Error()) +// } else { +// if err := o.Commit(); err != nil { +// logs.Error("开启事务时出错 -> ", err) +// c.JsonResult(500, "开启事务时出错: ", err.Error()) +// } else { +// c.DelSession(SessionUserInfoKey) +// c.SetMember(*member) +// +// var remember CookieRemember +// remember.MemberId = member.MemberId +// remember.Account = member.Account +// remember.Time = time.Now() +// v, err := utils.Encode(remember) +// if err == nil { +// c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) +// c.JsonResult(0, "绑定成功", nil) +// } else { +// c.JsonResult(500, "绑定成功, 但自动登录失败, 请返回首页重新登录", nil) +// } +// } +// } +// +// } +// +// } else { +// logs.Error("用户登录 ->", err) +// c.JsonResult(500, "账号或密码错误", nil) +// } +// c.JsonResult(500, "TODO: 绑定以后账号功能开发中") +// } +// } else { +// if ok { +// c.DelSession(SessionUserInfoKey) +// } +// c.JsonResult(400, "请求错误, 请从首页重新登录") +// } +// +//} + +// WorkWeixinLoginIgnore 用户企业微信登录-忽略 +//func (c *AccountController) WorkWeixinLoginIgnore() { +// if user_info, ok := c.GetSession(SessionUserInfoKey).(workweixin.WorkWeixinUserPrivateInfo); ok && len(user_info.UserId) > 0 { +// c.DelSession(SessionUserInfoKey) +// member := models.NewMember() +// +// if _, err := member.FindByAccount(user_info.UserId); err == nil && member.MemberId > 0 { +// c.JsonResult(400, "账号已存在") +// } +// +// ormer := orm.NewOrm() +// o, err := ormer.Begin() +// if err != nil { +// logs.Error("开启事务时出错 -> ", err) +// c.JsonResult(500, "开启事务时出错: ", err.Error()) +// } +// +// member.Account = user_info.UserId +// member.RealName = user_info.Name +// var rnd = rand.New(src) +// // fmt.Sprintf("%x", rnd.Uint64()) +// // strconv.FormatUint(rnd.Uint64(), 16) +// member.Password = user_info.UserId + strconv.FormatUint(rnd.Uint64(), 16) +// member.Password = "123456" // 强制设置默认密码,需修改一次密码后,才可以进行账号密码登录 +// hash, err := utils.PasswordHash(member.Password) +// if err != nil { +// logs.Error("加密用户密码失败 =>", err) +// c.JsonResult(500, "加密用户密码失败"+err.Error()) +// } else { +// logs.Error("member.Password: ", member.Password) +// logs.Error("hash: ", hash) +// member.Password = hash +// } +// member.Role = conf.MemberGeneralRole +// member.Avatar = user_info.Avatar +// if len(member.Avatar) < 1 { +// member.Avatar = conf.GetDefaultAvatar() +// } +// member.CreateAt = 0 +// member.Email = user_info.BizMail +// member.Phone = user_info.Mobile +// member.Status = 0 +// if _, err = ormer.Insert(member); err != nil { +// o.Rollback() +// c.JsonResult(500, "注册失败,数据库错误: "+err.Error()) +// } else { +// account := models.NewWorkWeixinAccount() +// account.MemberId = member.MemberId +// account.WorkWeixin_UserId = user_info.UserId +// member.CreateAt = 0 +// if err := account.AddBind(ormer); err != nil { +// o.Rollback() +// c.JsonResult(500, "注册失败,数据库错误: "+err.Error()) +// } else { +// if err := o.Commit(); err != nil { +// logs.Error("提交事务时出错 -> ", err) +// c.JsonResult(500, "提交事务时出错: ", err.Error()) +// } else { +// member.LastLoginTime = time.Now() +// _ = member.Update("last_login_time") +// +// c.SetMember(*member) +// +// var remember CookieRemember +// remember.MemberId = member.MemberId +// remember.Account = member.Account +// remember.Time = time.Now() +// v, err := utils.Encode(remember) +// if err == nil { +// c.SetSecureCookie(conf.GetAppKey(), "login", v, time.Now().Add(time.Hour*24*30*5).Unix()) +// c.JsonResult(0, "绑定成功", nil) +// } else { +// c.JsonResult(500, "绑定成功, 但自动登录失败, 请返回首页重新登录", nil) +// } +// } +// } +// } +// } else { +// if ok { +// c.DelSession(SessionUserInfoKey) +// } +// c.JsonResult(400, "请求错误, 请从首页重新登录") +// } +//} + +// QR二维码登录 +//func (c *AccountController) QRLogin() { +// appName := c.Ctx.Input.Param(":app") +// +// switch appName { +// // 钉钉扫码登录 +// case "dingtalk": +// code := c.GetString("code") +// state := c.GetString("state") +// if state != "1" || code == "" { +// c.Redirect(conf.URLFor("AccountController.Login"), 302) +// c.StopRun() +// } +// appKey, _ := web.AppConfig.String("dingtalk_qr_key") +// appSecret, _ := web.AppConfig.String("dingtalk_qr_secret") +// +// qrDingtalk := dingtalk.NewDingtalkQRLogin(appSecret, appKey) +// unionID, err := qrDingtalk.GetUnionIDByCode(code) +// if err != nil { +// logs.Warn("获取钉钉临时UnionID失败 ->", err) +// c.Redirect(conf.URLFor("AccountController.Login"), 302) +// c.StopRun() +// } +// +// appKey, _ = web.AppConfig.String("dingtalk_app_key") +// appSecret, _ = web.AppConfig.String("dingtalk_app_secret") +// tmpReader, _ := web.AppConfig.String("dingtalk_tmp_reader") +// +// dingtalkAgent := dingtalk.NewDingTalkAgent(appSecret, appKey) +// err = dingtalkAgent.GetAccesstoken() +// if err != nil { +// logs.Warn("获取钉钉临时Token失败 ->", err) +// c.Redirect(conf.URLFor("AccountController.Login"), 302) +// c.StopRun() +// } +// +// userid, err := dingtalkAgent.GetUserIDByUnionID(unionID) +// if err != nil { +// logs.Warn("获取钉钉用户ID失败 ->", err) +// c.Redirect(conf.URLFor("AccountController.Login"), 302) +// c.StopRun() +// } +// +// username, avatar, err := dingtalkAgent.GetUserNameAndAvatarByUserID(userid) +// if err != nil { +// logs.Warn("获取钉钉用户信息失败 ->", err) +// c.Redirect(conf.URLFor("AccountController.Login"), 302) +// c.StopRun() +// } +// +// member, err := models.NewMember().TmpLogin(tmpReader) +// if err == nil { +// member.LastLoginTime = time.Now() +// _ = member.Update("last_login_time") +// member.Account = username +// if avatar != "" { +// member.Avatar = avatar +// } +// +// c.SetMember(*member) +// c.LoggedIn(false) +// c.StopRun() +// } +// c.Redirect(conf.URLFor("AccountController.Login"), 302) +// +// // 企业微信扫码登录 +// case "workweixin": +// // +// +// default: +// c.Redirect(conf.URLFor("AccountController.Login"), 302) +// c.StopRun() +// } +//} + // 登录成功后的操作,如重定向到原始请求页面 func (c *AccountController) LoggedIn(isPost bool) interface{} { diff --git a/controllers/BlogController.go b/controllers/BlogController.go index 008492f96..c40ff0e17 100644 --- a/controllers/BlogController.go +++ b/controllers/BlogController.go @@ -34,7 +34,7 @@ func (c *BlogController) Prepare() { } } -//文章阅读 +// 文章阅读 func (c *BlogController) Index() { c.Prepare() c.TplName = "blog/index.tpl" @@ -56,23 +56,14 @@ func (c *BlogController) Index() { if blog.BlogStatus == "password" && password != blog.Password { c.JsonResult(6001, i18n.Tr(c.Lang, "message.blog_pwd_incorrect")) } else if blog.BlogStatus == "password" && password == blog.Password { - // If the password is correct, then determine whether the user is correct - if c.Member != nil && (blog.MemberId == c.Member.MemberId || c.Member.IsAdministrator()) { - /* Private blog is accessible only to author and administrator. - Anonymous users are not allowed access. */ - // Store the session value - _ = c.CruSession.Set(context.TODO(), blogReadSession, blogId) - c.JsonResult(0, "OK") - } else { - c.JsonResult(6002, i18n.Tr(c.Lang, "blog.private_blog_tips")) - } + // Store the session value for the next GET request. + _ = c.CruSession.Set(context.TODO(), blogReadSession, blogId) + c.JsonResult(0, "OK") } else { c.JsonResult(0, "OK") } - } else if blog.BlogStatus == "password" && - (c.CruSession.Get(context.TODO(), blogReadSession) == nil || // Read session doesn't exist - c.Member == nil || // Anonymous, Not Allow - (blog.MemberId != c.Member.MemberId && !c.Member.IsAdministrator())) { // User isn't author or administrator + } else if blog.BlogStatus == "password" && c.CruSession.Get(context.TODO(), blogReadSession) == nil && // Read session doesn't exist + (c.Member == nil || (blog.MemberId != c.Member.MemberId && !c.Member.IsAdministrator())) { // User isn't author or administrator //如果不存在已输入密码的标记 c.TplName = "blog/index_password.tpl" } @@ -98,7 +89,7 @@ func (c *BlogController) Index() { } } -//文章列表 +// 文章列表 func (c *BlogController) List() { c.Prepare() c.TplName = "blog/list.tpl" @@ -130,7 +121,7 @@ func (c *BlogController) List() { c.Data["Lists"] = blogList } -//管理后台文章列表 +// 管理后台文章列表 func (c *BlogController) ManageList() { c.Prepare() c.TplName = "blog/manage_list.tpl" @@ -153,7 +144,7 @@ func (c *BlogController) ManageList() { } -//文章设置 +// 文章设置 func (c *BlogController) ManageSetting() { c.Prepare() c.TplName = "blog/manage_setting.tpl" @@ -290,7 +281,7 @@ func (c *BlogController) ManageSetting() { } } -//文章创建或编辑 +// 文章创建或编辑 func (c *BlogController) ManageEdit() { c.Prepare() c.TplName = "blog/manage_edit.tpl" @@ -403,7 +394,7 @@ func (c *BlogController) ManageEdit() { c.Data["Model"] = blog } -//删除文章 +// 删除文章 func (c *BlogController) ManageDelete() { c.Prepare() blogId, _ := c.GetInt("blog_id", 0) @@ -624,7 +615,7 @@ func (c *BlogController) RemoveAttachment() { c.JsonResult(0, "ok", attach) } -//下载附件 +// 下载附件 func (c *BlogController) Download() { c.Prepare() diff --git a/controllers/BookController.go b/controllers/BookController.go index 23ddd6665..0a4b2860d 100644 --- a/controllers/BookController.go +++ b/controllers/BookController.go @@ -126,7 +126,7 @@ func (c *BookController) Setting() { } -//保存项目信息 +// 保存项目信息 func (c *BookController) SaveBook() { bookResult, err := c.IsPermission() @@ -164,8 +164,8 @@ func (c *BookController) SaveBook() { if !models.NewItemsets().Exist(itemId) { c.JsonResult(6006, i18n.Tr(c.Lang, "message.project_space_not_exist")) } - if editor != "markdown" && editor != "html" && editor != "new_html" { - editor = "markdown" + if editor != EditorMarkdown && editor != EditorCherryMarkdown && editor != EditorHtml && editor != EditorNewHtml { + editor = EditorMarkdown } book.BookName = bookName @@ -174,6 +174,9 @@ func (c *BookController) SaveBook() { book.Publisher = publisher //book.Label = tag book.Editor = editor + if editor == EditorCherryMarkdown { + book.Theme = "cherry" + } book.HistoryCount = historyCount book.IsDownload = 0 book.BookPassword = strings.TrimSpace(c.GetString("bPassword")) @@ -216,7 +219,7 @@ func (c *BookController) SaveBook() { c.JsonResult(0, "ok", bookResult) } -//设置项目私有状态. +// 设置项目私有状态. func (c *BookController) PrivatelyOwned() { status := c.GetString("status") @@ -296,7 +299,7 @@ func (c *BookController) Transfer() { c.JsonResult(0, "ok") } -//上传项目封面. +// 上传项目封面. func (c *BookController) UploadCover() { bookResult, err := c.IsPermission() @@ -544,7 +547,7 @@ func (c *BookController) Create() { c.JsonResult(6001, "error") } -//复制项目 +// 复制项目 func (c *BookController) Copy() { if c.Ctx.Input.IsPost() { //检查是否有复制项目的权限 @@ -622,6 +625,9 @@ func (c *BookController) Import() { tempPath = filepath.Join(tempPath, moreFile.Filename) err = c.SaveToFile("import-file", tempPath) + if err != nil { + c.JsonResult(6004, i18n.Tr(c.Lang, "message.upload_failed")) + } book := models.NewBook() @@ -724,7 +730,7 @@ func (c *BookController) Delete() { c.JsonResult(0, "ok") } -//发布项目. +// 发布项目. func (c *BookController) Release() { c.Prepare() @@ -763,7 +769,7 @@ func (c *BookController) Release() { c.JsonResult(0, i18n.Tr(c.Lang, "message.publish_to_queue")) } -//文档排序. +// 文档排序. func (c *BookController) SaveSort() { c.Prepare() @@ -924,7 +930,7 @@ func (c *BookController) TeamAdd() { c.JsonResult(0, "OK", teamRel) } -//删除项目的团队. +// 删除项目的团队. func (c *BookController) TeamDelete() { c.Prepare() @@ -955,7 +961,7 @@ func (c *BookController) TeamDelete() { c.JsonResult(0, "OK") } -//团队搜索. +// 团队搜索. func (c *BookController) TeamSearch() { c.Prepare() @@ -976,7 +982,7 @@ func (c *BookController) TeamSearch() { } -//项目空间搜索. +// 项目空间搜索. func (c *BookController) ItemsetsSearch() { c.Prepare() diff --git a/controllers/CommentController.go b/controllers/CommentController.go index 487c855bf..352af04ea 100644 --- a/controllers/CommentController.go +++ b/controllers/CommentController.go @@ -22,8 +22,8 @@ func (c *CommentController) Lists() { page := pagination.PageUtil(int(count), pageIndex, conf.PageSize, comments) var data struct { - DocId int `json:"doc_id"` - Page pagination.Page `json:"page"` + DocId int `json:"doc_id"` + Page pagination.Page `json:"page"` } data.DocId = docid data.Page = page @@ -43,6 +43,9 @@ func (c *CommentController) Create() { m := models.NewComment() m.DocumentId = id + if c.Member == nil { + c.JsonResult(1, "请先登录,再评论") + } if len(c.Member.RealName) != 0 { m.Author = c.Member.RealName } else { @@ -56,7 +59,7 @@ func (c *CommentController) Create() { m.Insert() var data struct { - DocId int `json:"doc_id"` + DocId int `json:"doc_id"` } data.DocId = id diff --git a/controllers/DocumentController.go b/controllers/DocumentController.go index 6339b5a94..4483ddcac 100644 --- a/controllers/DocumentController.go +++ b/controllers/DocumentController.go @@ -65,8 +65,12 @@ func (c *DocumentController) Index() { selected = doc.DocumentId c.Data["Title"] = doc.DocumentName c.Data["Content"] = template.HTML(doc.Release) - c.Data["Description"] = utils.AutoSummary(doc.Release, 120) + c.Data["FoldSetting"] = "first" + + if bookResult.Editor == EditorCherryMarkdown { + c.Data["MarkdownTheme"] = doc.MarkdownTheme + } if bookResult.IsDisplayComment { // 获取评论、分页 @@ -78,6 +82,7 @@ func (c *DocumentController) Index() { } else { c.Data["Title"] = i18n.Tr(c.Lang, "blog.summary") c.Data["Content"] = template.HTML(blackfriday.Run([]byte(bookResult.Description))) + c.Data["FoldSetting"] = "closed" } tree, err := models.NewDocument().CreateDocumentTreeForHtml(bookResult.BookId, selected) @@ -187,13 +192,15 @@ func (c *DocumentController) Read() { if c.IsAjax() { var data struct { - DocId int `json:"doc_id"` - DocIdentify string `json:"doc_identify"` - DocTitle string `json:"doc_title"` - Body string `json:"body"` - Title string `json:"title"` - Version int64 `json:"version"` - ViewCount int `json:"view_count"` + DocId int `json:"doc_id"` + DocIdentify string `json:"doc_identify"` + DocTitle string `json:"doc_title"` + Body string `json:"body"` + Title string `json:"title"` + Version int64 `json:"version"` + ViewCount int `json:"view_count"` + MarkdownTheme string `json:"markdown_theme"` + IsMarkdown bool `json:"is_markdown"` } data.DocId = doc.DocumentId data.DocIdentify = doc.Identify @@ -202,7 +209,10 @@ func (c *DocumentController) Read() { data.Title = doc.DocumentName + " - Powered by MinDoc" data.Version = doc.Version data.ViewCount = doc.ViewCount - + data.MarkdownTheme = doc.MarkdownTheme + if bookResult.Editor == EditorCherryMarkdown { + data.IsMarkdown = true + } c.JsonResult(0, "ok", data) } else { c.Data["DocumentId"] = doc.DocumentId @@ -230,6 +240,15 @@ func (c *DocumentController) Read() { c.Data["Title"] = doc.DocumentName c.Data["Content"] = template.HTML(doc.Release) c.Data["ViewCount"] = doc.ViewCount + c.Data["FoldSetting"] = "closed" + if bookResult.Editor == EditorCherryMarkdown { + c.Data["MarkdownTheme"] = doc.MarkdownTheme + } + if doc.IsOpen == 1 { + c.Data["FoldSetting"] = "open" + } else if doc.IsOpen == 2 { + c.Data["FoldSetting"] = "empty" + } } // 编辑文档 @@ -269,16 +288,7 @@ func (c *DocumentController) Edit() { } } - // 根据不同编辑器类型加载编辑器 - if bookResult.Editor == "markdown" { - c.TplName = "document/markdown_edit_template.tpl" - } else if bookResult.Editor == "html" { - c.TplName = "document/html_edit_template.tpl" - } else if bookResult.Editor == "new_html" { - c.TplName = "document/new_html_edit_template.tpl" - } else { - c.TplName = "document/" + bookResult.Editor + "_edit_template.tpl" - } + c.TplName = fmt.Sprintf("document/%s_edit_template.tpl", bookResult.Editor) c.Data["Model"] = bookResult @@ -767,6 +777,7 @@ func (c *DocumentController) Content() { if c.Ctx.Input.IsPost() { markdown := strings.TrimSpace(c.GetString("markdown", "")) content := c.GetString("html") + markdownTheme := c.GetString("markdown_theme", "theme__light") version, _ := c.GetInt64("version", 0) isCover := c.GetString("cover") @@ -801,6 +812,7 @@ func (c *DocumentController) Content() { doc.Markdown = content } else { doc.Markdown = markdown + doc.MarkdownTheme = markdownTheme } doc.Version = time.Now().Unix() @@ -895,8 +907,8 @@ func (c *DocumentController) Export() { bookResult.Cover = conf.URLForWithCdnImage(bookResult.Cover) } - if output == "markdown" { - if bookResult.Editor != "markdown" { + if output == Markdown { + if bookResult.Editor != EditorMarkdown && bookResult.Editor != EditorCherryMarkdown { c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.cur_project_not_support_md")) } p, err := bookResult.ExportMarkdown(c.CruSession.SessionID(context.TODO())) @@ -1148,7 +1160,7 @@ func (c *DocumentController) DeleteHistory() { c.JsonResult(0, "ok") } -//通过文档历史恢复文档 +// 通过文档历史恢复文档 func (c *DocumentController) RestoreHistory() { c.Prepare() @@ -1215,7 +1227,7 @@ func (c *DocumentController) Compare() { identify := c.Ctx.Input.Param(":key") bookId := 0 - editor := "markdown" + editor := EditorMarkdown // 如果是超级管理员则忽略权限判断 if c.Member.IsAdministrator() { @@ -1261,7 +1273,7 @@ func (c *DocumentController) Compare() { c.Data["HistoryId"] = historyId c.Data["DocumentId"] = doc.DocumentId - if editor == "markdown" { + if editor == EditorMarkdown || editor == EditorCherryMarkdown { c.Data["HistoryContent"] = history.Markdown c.Data["Content"] = doc.Markdown } else { diff --git a/controllers/ItemsetsController.go b/controllers/ItemsetsController.go index ef129111b..e9625d49b 100644 --- a/controllers/ItemsetsController.go +++ b/controllers/ItemsetsController.go @@ -1,6 +1,8 @@ package controllers import ( + "math" + "github.com/beego/beego/v2/client/orm" "github.com/beego/beego/v2/core/logs" "github.com/mindoc-org/mindoc/conf" @@ -24,7 +26,7 @@ func (c *ItemsetsController) Prepare() { func (c *ItemsetsController) Index() { c.Prepare() c.TplName = "items/index.tpl" - pageSize := 18 + pageSize := 16 pageIndex, _ := c.GetInt("page", 0) @@ -33,7 +35,6 @@ func (c *ItemsetsController) Index() { if err != nil && err != orm.ErrNoRows { c.ShowErrorPage(500, err.Error()) } - c.Data["TotalPages"] = pageIndex if err == orm.ErrNoRows || len(items) <= 0 { c.Data["Lists"] = items c.Data["PageHtml"] = "" @@ -46,7 +47,7 @@ func (c *ItemsetsController) Index() { } else { c.Data["PageHtml"] = "" } - + c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(pageSize))) c.Data["Lists"] = items } @@ -85,6 +86,7 @@ func (c *ItemsetsController) List() { } else { c.Data["PageHtml"] = "" } + c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(pageSize))) c.Data["Lists"] = searchResult c.Data["Model"] = item diff --git a/controllers/SettingController.go b/controllers/SettingController.go index 762af330f..b79204047 100644 --- a/controllers/SettingController.go +++ b/controllers/SettingController.go @@ -79,6 +79,9 @@ func (c *SettingController) Password() { c.JsonResult(6007, i18n.Tr(c.Lang, "message.pwd_encrypt_failed")) } c.Member.Password = pwd + if c.Member.AuthMethod == "" { + c.Member.AuthMethod = "local" + } if err := c.Member.Update(); err != nil { c.JsonResult(6008, err.Error()) } diff --git a/controllers/const.go b/controllers/const.go new file mode 100644 index 000000000..83b664e35 --- /dev/null +++ b/controllers/const.go @@ -0,0 +1,9 @@ +package controllers + +const ( + Markdown = "markdown" + EditorMarkdown = "markdown" + EditorCherryMarkdown = "cherry_markdown" + EditorHtml = "html" + EditorNewHtml = "new_html" +) diff --git a/dev-win-build.cmd b/dev-win-build.cmd new file mode 100644 index 000000000..5dcb191f7 --- /dev/null +++ b/dev-win-build.cmd @@ -0,0 +1 @@ +go build -v -ldflags "-linkmode external -extldflags '-static' -w" -o mindoc_windows_amd64.exe main.go \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index a46c4f197..e5877aa59 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,19 @@ version: "3" services: mindoc: - image: registry.cn-hangzhou.aliyuncs.com/mindoc-org/mindoc:v2.1-beta.6 + image: registry.cn-hangzhou.aliyuncs.com/mindoc-org/mindoc:v2.1 container_name: mindoc privileged: false restart: always ports: - 8181:8181 volumes: - - /var/www/mindoc://mindoc-sync-host + - /var/www/mindoc/conf://mindoc/conf + - /var/www/mindoc/static://mindoc/static + - /var/www/mindoc/views://mindoc/views + - /var/www/mindoc/uploads://mindoc/uploads + - /var/www/mindoc/runtime://mindoc/runtime + - /var/www/mindoc/database://mindoc/database environment: - MINDOC_RUN_MODE=prod - MINDOC_DB_ADAPTER=sqlite3 diff --git a/go.mod b/go.mod index 3418db85c..d1698fdeb 100644 --- a/go.mod +++ b/go.mod @@ -3,28 +3,51 @@ module github.com/mindoc-org/mindoc go 1.18 require ( - github.com/PuerkitoBio/goquery v1.4.1 - github.com/beego/beego/v2 v2.0.2-0.20210322114547-10ea897525a5 + github.com/PuerkitoBio/goquery v1.8.0 + github.com/beego/beego/v2 v2.0.5 github.com/beego/i18n v0.0.0-20161101132742-e9308947f407 - github.com/boombuler/barcode v1.0.0 + github.com/boombuler/barcode v1.0.1 + github.com/go-ldap/ldap/v3 v3.4.4 github.com/howeyc/fsnotify v0.9.0 - github.com/kardianos/service v1.1.0 - github.com/lifei6671/gocaptcha v0.1.1 + github.com/kardianos/service v1.2.1 + github.com/lib/pq v1.10.5 + github.com/lifei6671/gocaptcha v0.2.0 github.com/mattn/go-runewidth v0.0.13 - github.com/mattn/go-sqlite3 v2.0.3+incompatible + github.com/mattn/go-sqlite3 v1.14.15 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/russross/blackfriday/v2 v2.1.0 - gopkg.in/ldap.v2 v2.5.1 ) require ( - github.com/Unknwon/goconfig v0.0.0-20200908083735-df7de6a44db8 // indirect - github.com/andybalholm/cascadia v1.2.0 // indirect - github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect - github.com/lib/pq v1.7.0 // indirect - github.com/smartystreets/goconvey v1.6.4 // indirect - gopkg.in/asn1-ber.v1 v1.0.0-00010101000000-000000000000 // indirect - gopkg.in/yaml.v2 v2.3.0 // indirect + github.com/Azure/go-ntlmssp v0.0.0-20220621081337-cb9428e4ac1e // indirect + github.com/Unknwon/goconfig v1.0.0 // indirect + github.com/andybalholm/cascadia v1.3.1 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect + github.com/go-redis/redis/v7 v7.4.1 // indirect + github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/gomodule/redigo v2.0.0+incompatible // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.13.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect + github.com/rivo/uniseg v0.3.4 // indirect + github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect + github.com/smartystreets/goconvey v1.7.2 // indirect + golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d // indirect + golang.org/x/image v0.5.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace gopkg.in/asn1-ber.v1 => github.com/go-asn1-ber/asn1-ber v1.5.0 diff --git a/go.sum b/go.sum index 3eca66958..524b4168b 100644 --- a/go.sum +++ b/go.sum @@ -1,158 +1,218 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/go-ntlmssp v0.0.0-20220621081337-cb9428e4ac1e h1:NeAW1fUYUEWhft7pkxDf6WoUvEZJ/uOKsvtpjLnn8MU= +github.com/Azure/go-ntlmssp v0.0.0-20220621081337-cb9428e4ac1e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/PuerkitoBio/goquery v1.4.1 h1:smcIRGdYm/w7JSbcdeLHEMzxmsBQvl8lhf0dSw2nzMI= -github.com/PuerkitoBio/goquery v1.4.1/go.mod h1:T9ezsOHcCrDCgA8aF1Cqr3sSYbO/xgdy8/R/XiIMAhA= -github.com/Unknwon/goconfig v0.0.0-20200908083735-df7de6a44db8 h1:1TrMV1HmBApBbM+Hy7RCKZD6UlYWYIPPfoeXomG7+zE= -github.com/Unknwon/goconfig v0.0.0-20200908083735-df7de6a44db8/go.mod h1:wngxua9XCNjvHjDiTiV26DaKDT+0c63QR6H5hjVUUxw= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U= +github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI= +github.com/Unknwon/goconfig v1.0.0 h1:9IAu/BYbSLQi8puFjUQApZTxIHqSwrj5d8vpP8vTq4A= +github.com/Unknwon/goconfig v1.0.0/go.mod h1:wngxua9XCNjvHjDiTiV26DaKDT+0c63QR6H5hjVUUxw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= -github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE= -github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= -github.com/beego/beego/v2 v2.0.2-0.20210322114547-10ea897525a5 h1:i0swsv6hmoF6pkeG2S/dvOWwOKFPGDKhrmTlWH6I1nM= -github.com/beego/beego/v2 v2.0.2-0.20210322114547-10ea897525a5/go.mod h1:JlRUJ/NVNygorqjyt7/lQ8R++KSE0qXvxeIfbnIUd7Q= -github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= +github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= +github.com/beego/beego/v2 v2.0.5 h1:fa2TBWfKGDs35Ck9an9SVnpS0zM8sRTXlW8rFjpeYlE= +github.com/beego/beego/v2 v2.0.5/go.mod h1:CH2/JIaB4ceGYVQlYqTAFft4pVk/ol1ZkakUrUvAyns= github.com/beego/i18n v0.0.0-20161101132742-e9308947f407 h1:WtJfx5HqASTQp7HfiZldnin8KQV2futplF3duGp5PGc= github.com/beego/i18n v0.0.0-20161101132742-e9308947f407/go.mod h1:KLeFCpAMq2+50NkXC8iiJxLLiiTfTqrGtKEVm+2fk7s= -github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/boombuler/barcode v1.0.0 h1:s1TvRnXwL2xJRaccrdcBQMZxq6X7DvsMogtmJeHDdrc= -github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= -github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pOvUGt1D1lA5KjYhPBAN/3iWdP7xeFS9F0= -github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= -github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE= +github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs= +github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d h1:pVrfxiGfwelyab6n21ZBkbkmbevaf+WvMIiR7sr97hw= +github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= -github.com/coreos/etcd v3.3.25+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/couchbase/go-couchbase v0.0.0-20210126152612-8e416c37c8ef/go.mod h1:+/bddYDxXsf9qt0xpDUtRR47A2GjaXmGGAqQ/k3GJ8A= -github.com/couchbase/gomemcached v0.1.2-0.20210126151728-840240974836/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo= -github.com/couchbase/goutils v0.0.0-20201030094643-5e82bb967e67/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= -github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI= -github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw= -github.com/go-asn1-ber/asn1-ber v1.5.0 h1:/S4hO/AO6tLMlPX0oftGSOcdGJJN/MuYzfgWRMn199E= -github.com/go-asn1-ber/asn1-ber v1.5.0/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= +github.com/go-asn1-ber/asn1-ber v1.5.4 h1:vXT6d/FNDiELJnLb6hGNa309LMsrCoYFvpwHDF0+Y1A= +github.com/go-asn1-ber/asn1-ber v1.5.4/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-ldap/ldap/v3 v3.4.4 h1:qPjipEpt+qDa6SI/h1fzuGWoRUY+qqQ9sOZq67/PYUs= +github.com/go-ldap/ldap/v3 v3.4.4/go.mod h1:fe1MsuN5eJJ1FeLT/LEBVdWfNWKh459R7aXgXtJC+aI= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-redis/redis v6.14.2+incompatible h1:UE9pLhzmWf+xHNmZsoccjXosPicuiNaInPgym8nzfg0= -github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= -github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-redis/redis/v7 v7.4.1 h1:PASvf36gyUpr2zdOUS/9Zqc80GbM+9BDyiJSJDDOrTI= +github.com/go-redis/redis/v7 v7.4.1/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/howeyc/fsnotify v0.9.0 h1:0gtV5JmOKH4A8SsFxG2BczSeXWWPvcMT0euZt5gDAxY= github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kardianos/service v1.1.0 h1:QV2SiEeWK42P0aEmGcsAgjApw/lRxkwopvT+Gu6t1/0= -github.com/kardianos/service v1.1.0/go.mod h1:RrJI2xn5vve/r32U5suTbeaSGoMU6GbNPoj36CVYcHc= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kardianos/service v1.2.1 h1:AYndMsehS+ywIS6RB9KOlcXzteWUzxgMgBymJD7+BYk= +github.com/kardianos/service v1.2.1/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY= -github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lifei6671/gocaptcha v0.1.1 h1:5cvU3w0bK8eJm1P6AiQoPuicoZVAgKKpREBxXF9IaHo= -github.com/lifei6671/gocaptcha v0.1.1/go.mod h1:6QlTU2WzFhzqylAJWSo3OANfKCraGccJwbK01P5fFmI= +github.com/lib/pq v1.10.5 h1:J+gdV2cUmX7ZqL2B0lFcW0m+egaHC2V3lpO8nWxyYiQ= +github.com/lib/pq v1.10.5/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lifei6671/gocaptcha v0.2.0 h1:CwMjGitq5MsYtWODQhlphdl7WhDdD243y1O2d3l8yFU= +github.com/lifei6671/gocaptcha v0.2.0/go.mod h1:mcUWn1eB+kHOBHLQdmWAQ83bhEGrFTnGMqRCY7sFgUc= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= -github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI= +github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= -github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= -github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -161,164 +221,367 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U= -github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= +github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.3.4 h1:3Z3Eu6FGHZWSfNKJTOUiPatWwfc7DzJRU04jFUqJODw= +github.com/rivo/uniseg v0.3.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= -github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= -github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= -github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= -github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= +github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 h1:DAYUYH5869yV94zvCES9F51oYtN5oGlwjxJJz7ZCnik= +github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= +github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= +github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= +github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -go.etcd.io/etcd v3.3.25+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d h1:3qF+Z8Hkrw9sOhrFHti9TlB1Hkac1x+DNRkv0XQiFjo= +golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 h1:KYGJGHOQy8oSi1fDlSpcZF0+juKwk/hEMv5SiwHogR0= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI= +golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ldap.v2 v2.5.1 h1:wiu0okdNfjlBzg6UWvd1Hn8Y+Ux17/u/4nlk4CQr6tU= -gopkg.in/ldap.v2 v2.5.1/go.mod h1:oI0cpe/D7HRtBQl8aTg+ZmzFUAvu4lsv3eLXMLGFxWk= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/main.go b/main.go index abdbf6736..0edfe0162 100644 --- a/main.go +++ b/main.go @@ -2,8 +2,12 @@ package main import ( "fmt" + "io/ioutil" "log" "os" + "path/filepath" + "runtime" + "strings" _ "github.com/beego/beego/v2/server/web/session/memcache" _ "github.com/beego/beego/v2/server/web/session/mysql" @@ -15,6 +19,21 @@ import ( _ "github.com/mindoc-org/mindoc/routers" ) +func isViaDaemonUnix() bool { + parentPid := os.Getppid() + + cmdLineBytes, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cmdline", parentPid)) + if err != nil { + return false + } + + cmdLine := string(cmdLineBytes) + executable := strings.Split(cmdLine, " ")[0] + fmt.Printf("Parent executable: %s\n", executable) + filename := filepath.Base(executable) + return strings.Contains(filename, "mindoc-daemon") +} + func main() { if len(os.Args) >= 3 && os.Args[1] == "service" { @@ -30,14 +49,19 @@ func main() { d := daemon.NewDaemon() - s, err := service.New(d, d.Config()) + if runtime.GOOS != "windows" && !isViaDaemonUnix() { + s, err := service.New(d, d.Config()) - if err != nil { - fmt.Println("Create service error => ", err) - os.Exit(1) - } + if err != nil { + fmt.Println("Create service error => ", err) + os.Exit(1) + } - if err := s.Run(); err != nil { - log.Fatal("启动程序失败 ->", err) + if err := s.Run(); err != nil { + log.Fatal("启动程序失败 ->", err) + } + } else { + d.Run() } + } diff --git a/models/AttachmentModel.go b/models/AttachmentModel.go index eaf882864..8e2d45ce9 100644 --- a/models/AttachmentModel.go +++ b/models/AttachmentModel.go @@ -17,18 +17,18 @@ import ( // Attachment struct . type Attachment struct { AttachmentId int `orm:"column(attachment_id);pk;auto;unique" json:"attachment_id"` - BookId int `orm:"column(book_id);type(int)" json:"book_id"` - DocumentId int `orm:"column(document_id);type(int);null" json:"doc_id"` - FileName string `orm:"column(file_name);size(255)" json:"file_name"` - FilePath string `orm:"column(file_path);size(2000)" json:"file_path"` - FileSize float64 `orm:"column(file_size);type(float)" json:"file_size"` - HttpPath string `orm:"column(http_path);size(2000)" json:"http_path"` - FileExt string `orm:"column(file_ext);size(50)" json:"file_ext"` - CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` - CreateAt int `orm:"column(create_at);type(int)" json:"create_at"` + BookId int `orm:"column(book_id);type(int);description(所属book id)" json:"book_id"` + DocumentId int `orm:"column(document_id);type(int);null;description(所属文档id)" json:"doc_id"` + FileName string `orm:"column(file_name);size(255);description(文件名称)" json:"file_name"` + FilePath string `orm:"column(file_path);size(2000);description(文件路径)" json:"file_path"` + FileSize float64 `orm:"column(file_size);type(float);description(文件大小 字节)" json:"file_size"` + HttpPath string `orm:"column(http_path);size(2000);description(文件路径)" json:"http_path"` + FileExt string `orm:"column(file_ext);size(50);description(文件后缀)" json:"file_ext"` + CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add;description(创建时间)" json:"create_time"` + CreateAt int `orm:"column(create_at);type(int);description(创建人id)" json:"create_at"` } -// TableName 获取对应数据库表名. +// TableName 获取对应上传附件数据库表名. func (m *Attachment) TableName() string { return "attachment" } diff --git a/models/Auth2Account.go b/models/Auth2Account.go new file mode 100644 index 000000000..a5ff751e7 --- /dev/null +++ b/models/Auth2Account.go @@ -0,0 +1,185 @@ +// Package models . +package models + +import ( + "errors" + "github.com/mindoc-org/mindoc/utils/auth2" + "time" + + "github.com/beego/beego/v2/client/orm" + "github.com/beego/beego/v2/core/logs" + "github.com/mindoc-org/mindoc/conf" +) + +var ( + _ Auth2Account = (*WorkWeixinAccount)(nil) + _ Auth2Account = (*DingTalkAccount)(nil) +) + +type Auth2Account interface { + ExistedMember(id string) (*Member, error) + AddBind(o orm.Ormer, userInfo auth2.UserInfo, member *Member) error +} + +func NewWorkWeixinAccount() *WorkWeixinAccount { + return &WorkWeixinAccount{} +} + +type WorkWeixinAccount struct { + MemberId int `orm:"column(member_id);type(int);default(-1);index" json:"member_id"` + UserDbId int `orm:"pk;auto;unique;column(user_db_id)" json:"user_db_id"` + WorkWeixin_UserId string `orm:"size(100);unique;column(workweixin_user_id)" json:"workweixin_user_id"` + // WorkWeixin_Name string `orm:"size(255);column(workweixin_name)" json:"workweixin_name"` + // WorkWeixin_Phone string `orm:"size(25);column(workweixin_phone)" json:"workweixin_phone"` + // WorkWeixin_Email string `orm:"size(255);column(workweixin_email)" json:"workweixin_email"` + // WorkWeixin_Status int `orm:"type(int);column(status)" json:"status"` + // WorkWeixin_Avatar string `orm:"size(1024);column(avatar)" json:"avatar"` + CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` + CreateAt int `orm:"type(int);column(create_at)" json:"create_at"` + LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null" json:"last_login_time"` +} + +// TableName 获取对应数据库表名. +func (m *WorkWeixinAccount) TableName() string { + return "workweixin_accounts" +} + +// TableEngine 获取数据使用的引擎. +func (m *WorkWeixinAccount) TableEngine() string { + return "INNODB" +} + +func (m *WorkWeixinAccount) TableNameWithPrefix() string { + return conf.GetDatabasePrefix() + m.TableName() +} + +func (m *WorkWeixinAccount) ExistedMember(workweixin_user_id string) (*Member, error) { + o := orm.NewOrm() + account := NewWorkWeixinAccount() + member := NewMember() + err := o.QueryTable(m.TableNameWithPrefix()).Filter("workweixin_user_id", workweixin_user_id).One(account) + if err != nil { + return member, err + } + + member, err = member.Find(account.MemberId) + if err != nil { + return member, err + } + + if member.Status != 0 { + return member, errors.New("receive_account_disabled") + } + + return member, nil + +} + +// AddBind 添加一个用户. +func (m *WorkWeixinAccount) AddBind(o orm.Ormer, userInfo auth2.UserInfo, member *Member) error { + tmpM := NewWorkWeixinAccount() + err := o.QueryTable(m.TableNameWithPrefix()).Filter("workweixin_user_id", userInfo.UserId).One(tmpM) + if err == nil { + tmpM.MemberId = member.MemberId + _, err = o.Update(tmpM) + if err != nil { + logs.Error("保存用户数据到数据时失败 =>", err) + return errors.New("用户信息绑定失败, 数据库错误") + } + return nil + } + + m.MemberId = member.MemberId + m.WorkWeixin_UserId = userInfo.UserId + + if c, err := o.QueryTable(m.TableNameWithPrefix()).Filter("member_id", m.MemberId).Count(); err == nil && c > 0 { + return errors.New("已绑定,不可重复绑定") + } + + _, err = o.Insert(m) + if err != nil { + logs.Error("保存用户数据到数据时失败 =>", err) + return errors.New("用户信息绑定失败, 数据库错误") + } + + return nil +} + +func NewDingTalkAccount() *DingTalkAccount { + return &DingTalkAccount{} +} + +type DingTalkAccount struct { + MemberId int `orm:"column(member_id);type(int);default(-1);index" json:"member_id"` + UserDbId int `orm:"pk;auto;unique;column(user_db_id)" json:"user_db_id"` + Dingtalk_UserId string `orm:"size(100);unique;column(dingtalk_user_id)" json:"dingtalk_user_id"` + CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` + CreateAt int `orm:"type(int);column(create_at)" json:"create_at"` + LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null" json:"last_login_time"` +} + +// TableName 获取对应数据库表名. +func (m *DingTalkAccount) TableName() string { + return "dingtalk_accounts" +} + +// TableEngine 获取数据使用的引擎. +func (m *DingTalkAccount) TableEngine() string { + return "INNODB" +} + +func (m *DingTalkAccount) TableNameWithPrefix() string { + return conf.GetDatabasePrefix() + m.TableName() +} + +func (m *DingTalkAccount) ExistedMember(userid string) (*Member, error) { + o := orm.NewOrm() + account := NewDingTalkAccount() + member := NewMember() + err := o.QueryTable(m.TableNameWithPrefix()).Filter("dingtalk_user_id", userid).One(account) + if err != nil { + return member, err + } + + member, err = member.Find(account.MemberId) + if err != nil { + return member, err + } + + if member.Status != 0 { + return member, errors.New("receive_account_disabled") + } + + return member, nil + +} + +// AddBind 添加一个用户. +func (m *DingTalkAccount) AddBind(o orm.Ormer, userInfo auth2.UserInfo, member *Member) error { + tmpM := NewDingTalkAccount() + err := o.QueryTable(m.TableNameWithPrefix()).Filter("dingtalk_user_id", userInfo.UserId).One(tmpM) + if err == nil { + tmpM.MemberId = member.MemberId + _, err = o.Update(tmpM) + if err != nil { + logs.Error("保存用户数据到数据时失败 =>", err) + return errors.New("用户信息绑定失败, 数据库错误") + } + return nil + } + + m.Dingtalk_UserId = userInfo.UserId + m.MemberId = member.MemberId + + if c, err := o.QueryTable(m.TableNameWithPrefix()).Filter("member_id", m.MemberId).Count(); err == nil && c > 0 { + return errors.New("已绑定,不可重复绑定") + } + + _, err = o.Insert(m) + if err != nil { + logs.Error("保存用户数据到数据时失败 =>", err) + return errors.New("用户信息绑定失败, 数据库错误") + } + + return nil +} diff --git a/models/Blog.go b/models/Blog.go index 7e8e5d191..679d56946 100644 --- a/models/Blog.go +++ b/models/Blog.go @@ -19,19 +19,19 @@ import ( type Blog struct { BlogId int `orm:"pk;auto;unique;column(blog_id)" json:"blog_id"` //文章标题 - BlogTitle string `orm:"column(blog_title);size(500)" json:"blog_title"` + BlogTitle string `orm:"column(blog_title);size(500);description(文章标题)" json:"blog_title"` //文章标识 - BlogIdentify string `orm:"column(blog_identify);size(100);unique" json:"blog_identify"` + BlogIdentify string `orm:"column(blog_identify);size(100);unique;description(文章标识)" json:"blog_identify"` //排序序号 - OrderIndex int `orm:"column(order_index);type(int);default(0)" json:"order_index"` + OrderIndex int `orm:"column(order_index);type(int);default(0);description(排序序号)" json:"order_index"` //所属用户 - MemberId int `orm:"column(member_id);type(int);default(0);index" json:"member_id"` + MemberId int `orm:"column(member_id);type(int);default(0);index;description(所属用户)" json:"member_id"` //用户头像 MemberAvatar string `orm:"-" json:"member_avatar"` //文章类型:0 普通文章/1 链接文章 - BlogType int `orm:"column(blog_type);type(int);default(0)" json:"blog_type"` + BlogType int `orm:"column(blog_type);type(int);default(0);description(文章类型: 0普通文章/1 链接文章)" json:"blog_type"` //链接到的项目中的文档ID - DocumentId int `orm:"column(document_id);type(int);default(0)" json:"document_id"` + DocumentId int `orm:"column(document_id);type(int);default(0);description(链接到的项目中的文档ID)" json:"document_id"` //文章的标识 DocumentIdentify string `orm:"-" json:"document_identify"` //关联文档的项目标识 @@ -39,25 +39,25 @@ type Blog struct { //关联文档的项目ID BookId int `orm:"-" json:"book_id"` //文章摘要 - BlogExcerpt string `orm:"column(blog_excerpt);size(1500)" json:"blog_excerpt"` + BlogExcerpt string `orm:"column(blog_excerpt);size(1500);description(文章摘要)" json:"blog_excerpt"` //文章内容 - BlogContent string `orm:"column(blog_content);type(text);null" json:"blog_content"` + BlogContent string `orm:"column(blog_content);type(text);null;description(文章内容)" json:"blog_content"` //发布后的文章内容 - BlogRelease string `orm:"column(blog_release);type(text);null" json:"blog_release"` + BlogRelease string `orm:"column(blog_release);type(text);null;description(发布后的文章内容)" json:"blog_release"` //文章当前的状态,枚举enum(’publish’,’draft’,’password’)值,publish为已 发表,draft为草稿,password 为私人内容(不会被公开) 。默认为publish。 - BlogStatus string `orm:"column(blog_status);size(100);default(publish)" json:"blog_status"` + BlogStatus string `orm:"column(blog_status);size(100);default(publish);description(状态:publish为已发表-默认,draft:草稿,password :私人内容-不会被公开)" json:"blog_status"` //文章密码,varchar(100)值。文章编辑才可为文章设定一个密码,凭这个密码才能对文章进行重新强加或修改。 - Password string `orm:"column(password);size(100)" json:"-"` + Password string `orm:"column(password);size(100);description(文章密码)" json:"-"` //最后修改时间 - Modified time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"` + Modified time.Time `orm:"column(modify_time);type(datetime);auto_now;description(最后修改时间)" json:"modify_time"` //修改人id - ModifyAt int `orm:"column(modify_at);type(int)" json:"-"` + ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"-"` ModifyRealName string `orm:"-" json:"modify_real_name"` //创建时间 - Created time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` + Created time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` CreateName string `orm:"-" json:"create_name"` //版本号 - Version int64 `orm:"type(bigint);column(version)" json:"version"` + Version int64 `orm:"type(bigint);column(version);description(版本号)" json:"version"` //附件列表 AttachList []*Attachment `orm:"-" json:"attach_list"` } diff --git a/models/BookModel.go b/models/BookModel.go index 8d8aee472..d46d2ff5c 100644 --- a/models/BookModel.go +++ b/models/BookModel.go @@ -36,53 +36,53 @@ var once = sync.Once{} type Book struct { BookId int `orm:"pk;auto;unique;column(book_id)" json:"book_id"` // BookName 项目名称. - BookName string `orm:"column(book_name);size(500)" json:"book_name"` + BookName string `orm:"column(book_name);size(500);description(名称)" json:"book_name"` //所属项目空间 - ItemId int `orm:"column(item_id);type(int);default(1)" json:"item_id"` + ItemId int `orm:"column(item_id);type(int);default(1);description(所属项目空间id)" json:"item_id"` // Identify 项目唯一标识. - Identify string `orm:"column(identify);size(100);unique" json:"identify"` + Identify string `orm:"column(identify);size(100);unique;description(唯一标识)" json:"identify"` //是否是自动发布 0 否/1 是 - AutoRelease int `orm:"column(auto_release);type(int);default(0)" json:"auto_release"` + AutoRelease int `orm:"column(auto_release);type(int);default(0);description(是否是自动发布 0 否/1 是)" json:"auto_release"` //是否开启下载功能 0 是/1 否 - IsDownload int `orm:"column(is_download);type(int);default(0)" json:"is_download"` - OrderIndex int `orm:"column(order_index);type(int);default(0)" json:"order_index"` + IsDownload int `orm:"column(is_download);type(int);default(0);description(是否开启下载功能 0 是/1 否)" json:"is_download"` + OrderIndex int `orm:"column(order_index);type(int);default(0);description(排序)" json:"order_index"` // Description 项目描述. - Description string `orm:"column(description);size(2000)" json:"description"` + Description string `orm:"column(description);size(2000);description(项目描述)" json:"description"` //发行公司 - Publisher string `orm:"column(publisher);size(500)" json:"publisher"` - Label string `orm:"column(label);size(500)" json:"label"` + Publisher string `orm:"column(publisher);size(500);description(发行公司)" json:"publisher"` + Label string `orm:"column(label);size(500);description(所属标签)" json:"label"` // PrivatelyOwned 项目私有: 0 公开/ 1 私有 - PrivatelyOwned int `orm:"column(privately_owned);type(int);default(0)" json:"privately_owned"` + PrivatelyOwned int `orm:"column(privately_owned);type(int);default(0);description(项目私有: 0 公开/ 1 私有)" json:"privately_owned"` // 当项目是私有时的访问Token. - PrivateToken string `orm:"column(private_token);size(500);null" json:"private_token"` + PrivateToken string `orm:"column(private_token);size(500);null;description(当项目是私有时的访问Token)" json:"private_token"` //访问密码. - BookPassword string `orm:"column(book_password);size(500);null" json:"book_password"` + BookPassword string `orm:"column(book_password);size(500);null;description(访问密码)" json:"book_password"` //状态:0 正常/1 已删除 - Status int `orm:"column(status);type(int);default(0)" json:"status"` + Status int `orm:"column(status);type(int);default(0);description(状态:0 正常/1 已删除)" json:"status"` //默认的编辑器. - Editor string `orm:"column(editor);size(50)" json:"editor"` + Editor string `orm:"column(editor);size(50);description(默认的编辑器 markdown/html)" json:"editor"` // DocCount 包含文档数量. - DocCount int `orm:"column(doc_count);type(int)" json:"doc_count"` + DocCount int `orm:"column(doc_count);type(int);description(包含文档数量)" json:"doc_count"` // CommentStatus 评论设置的状态:open 为允许所有人评论,closed 为不允许评论, group_only 仅允许参与者评论 ,registered_only 仅允许注册者评论. - CommentStatus string `orm:"column(comment_status);size(20);default(open)" json:"comment_status"` - CommentCount int `orm:"column(comment_count);type(int)" json:"comment_count"` + CommentStatus string `orm:"column(comment_status);size(20);default(open);description(评论设置的状态:open 为允许所有人评论,closed 为不允许评论, group_only 仅允许参与者评论 ,registered_only 仅允许注册者评论.)" json:"comment_status"` + CommentCount int `orm:"column(comment_count);type(int);description(评论数量)" json:"comment_count"` //封面地址 - Cover string `orm:"column(cover);size(1000)" json:"cover"` + Cover string `orm:"column(cover);size(1000);description(封面地址)" json:"cover"` //主题风格 - Theme string `orm:"column(theme);size(255);default(default)" json:"theme"` + Theme string `orm:"column(theme);size(255);default(default);description(主题风格)" json:"theme"` // CreateTime 创建时间 . - CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` + CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add;description(创建时间)" json:"create_time"` //每个文档保存的历史记录数量,0 为不限制 - HistoryCount int `orm:"column(history_count);type(int);default(0)" json:"history_count"` + HistoryCount int `orm:"column(history_count);type(int);default(0);description(每个文档保存的历史记录数量,0 为不限制)" json:"history_count"` //是否启用分享,0启用/1不启用 - IsEnableShare int `orm:"column(is_enable_share);type(int);default(0)" json:"is_enable_share"` - MemberId int `orm:"column(member_id);size(100)" json:"member_id"` - ModifyTime time.Time `orm:"type(datetime);column(modify_time);null;auto_now" json:"modify_time"` - Version int64 `orm:"type(bigint);column(version)" json:"version"` + IsEnableShare int `orm:"column(is_enable_share);type(int);default(0);description(是否启用分享,0启用/1不启用)" json:"is_enable_share"` + MemberId int `orm:"column(member_id);size(100);description(作者id)" json:"member_id"` + ModifyTime time.Time `orm:"type(datetime);column(modify_time);null;auto_now;description(修改时间)" json:"modify_time"` + Version int64 `orm:"type(bigint);column(version);description(版本)" json:"version"` //是否使用第一篇文章项目为默认首页,0 否/1 是 - IsUseFirstDocument int `orm:"column(is_use_first_document);type(int);default(0)" json:"is_use_first_document"` + IsUseFirstDocument int `orm:"column(is_use_first_document);type(int);default(0);description(是否使用第一篇文章项目为默认首页,0 否/1 是)" json:"is_use_first_document"` //是否开启自动保存:0 否/1 是 - AutoSave int `orm:"column(auto_save);type(tinyint);default(0)" json:"auto_save"` + AutoSave int `orm:"column(auto_save);type(tinyint);default(0);description(是否开启自动保存:0 否/1 是)" json:"auto_save"` } func (book *Book) String() string { @@ -115,7 +115,7 @@ func NewBook() *Book { return &Book{} } -//添加一个项目 +// 添加一个项目 func (book *Book) Insert(lang string) error { o := orm.NewOrm() // o.Begin() @@ -167,7 +167,7 @@ func (book *Book) Find(id int, cols ...string) (*Book, error) { return book, err } -//更新一个项目 +// 更新一个项目 func (book *Book) Update(cols ...string) error { o := orm.NewOrm() @@ -188,7 +188,7 @@ func (book *Book) Update(cols ...string) error { return err } -//复制项目 +// 复制项目 func (book *Book) Copy(identify string) error { o := orm.NewOrm() @@ -290,7 +290,7 @@ func (book *Book) Copy(identify string) error { return nil } -//递归的复制文档 +// 递归的复制文档 func recursiveInsertDocument(docs []*Document, o orm.TxOrmer, bookId int, parentId int) error { for _, doc := range docs { @@ -333,7 +333,7 @@ func recursiveInsertDocument(docs []*Document, o orm.TxOrmer, bookId int, parent return nil } -//根据指定字段查询结果集. +// 根据指定字段查询结果集. func (book *Book) FindByField(field string, value interface{}, cols ...string) ([]*Book, error) { o := orm.NewOrm() @@ -343,7 +343,7 @@ func (book *Book) FindByField(field string, value interface{}, cols ...string) ( return books, err } -//根据指定字段查询一个结果. +// 根据指定字段查询一个结果. func (book *Book) FindByFieldFirst(field string, value interface{}) (*Book, error) { o := orm.NewOrm() @@ -353,7 +353,7 @@ func (book *Book) FindByFieldFirst(field string, value interface{}) (*Book, erro } -//根据项目标识查询项目 +// 根据项目标识查询项目 func (book *Book) FindByIdentify(identify string, cols ...string) (*Book, error) { o := orm.NewOrm() @@ -362,7 +362,7 @@ func (book *Book) FindByIdentify(identify string, cols ...string) (*Book, error) return book, err } -//分页查询指定用户的项目 +// 分页查询指定用户的项目 func (book *Book) FindToPager(pageIndex, pageSize, memberId int, lang string) (books []*BookResult, totalCount int, err error) { o := orm.NewOrm() @@ -393,7 +393,7 @@ FROM md_books AS book // " LEFT JOIN " + relationship.TableNameWithPrefix() + " AS rel ON book.book_id=rel.book_id AND rel.member_id = ?" + // " LEFT JOIN " + relationship.TableNameWithPrefix() + " AS rel1 ON book.book_id=rel1.book_id AND rel1.role_id=0" + // " LEFT JOIN " + NewMember().TableNameWithPrefix() + " AS m ON rel1.member_id=m.member_id " + - // " WHERE rel.relationship_id > 0 ORDER BY book.order_index DESC,book.book_id DESC LIMIT " + fmt.Sprintf("%d,%d", offset, pageSize) + // " WHERE rel.relationship_id > 0 ORDER BY book.order_index DESC,book.book_id DESC LIMIT " + fmt.Sprintf("%d,%d", pageSize, offset) sql2 := `SELECT book.*, @@ -410,9 +410,9 @@ FROM md_books AS book LEFT JOIN md_relationship AS rel1 ON book.book_id = rel1.book_id AND rel1.role_id = 0 LEFT JOIN md_members AS m ON rel1.member_id = m.member_id WHERE rel.role_id >= 0 or team.role_id >= 0 -ORDER BY book.order_index, book.book_id DESC limit ?,?` +ORDER BY book.order_index, book.book_id DESC limit ? offset ?` - _, err = o.Raw(sql2, memberId, memberId, offset, pageSize).QueryRows(&books) + _, err = o.Raw(sql2, memberId, memberId, pageSize, offset).QueryRows(&books) if err != nil { logs.Error("分页查询项目列表 => ", err) return @@ -521,7 +521,7 @@ func (book *Book) ThoroughDeleteBook(id int) error { } -//分页查找系统首页数据. +// 分页查找系统首页数据. func (book *Book) FindForHomeToPager(pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error) { o := orm.NewOrm() @@ -550,9 +550,9 @@ WHERE book.privately_owned = 0 or rel.role_id >=0 or team.role_id >=0` as t group by book_id) as team on team.book_id=book.book_id LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0 LEFT JOIN md_members AS mdmb ON rel1.member_id = mdmb.member_id -WHERE book.privately_owned = 0 or rel.role_id >=0 or team.role_id >=0 ORDER BY order_index desc,book.book_id DESC LIMIT ?,?` +WHERE book.privately_owned = 0 or rel.role_id >=0 or team.role_id >=0 ORDER BY order_index desc,book.book_id DESC limit ? offset ?` - _, err = o.Raw(sql2, memberId, memberId, offset, pageSize).QueryRows(&books) + _, err = o.Raw(sql2, memberId, memberId, pageSize, offset).QueryRows(&books) } else { count, err1 := o.QueryTable(book.TableNameWithPrefix()).Filter("privately_owned", 0).Count() @@ -566,15 +566,15 @@ WHERE book.privately_owned = 0 or rel.role_id >=0 or team.role_id >=0 ORDER BY o sql := `SELECT book.*,rel.*,mdmb.account AS create_name,mdmb.real_name FROM md_books AS book LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.role_id = 0 LEFT JOIN md_members AS mdmb ON rel.member_id = mdmb.member_id - WHERE book.privately_owned = 0 ORDER BY order_index DESC ,book.book_id DESC LIMIT ?,?` + WHERE book.privately_owned = 0 ORDER BY order_index DESC ,book.book_id DESC limit ? offset ?` - _, err = o.Raw(sql, offset, pageSize).QueryRows(&books) + _, err = o.Raw(sql, pageSize, offset).QueryRows(&books) } return } -//分页全局搜索. +// 分页全局搜索. func (book *Book) FindForLabelToPager(keyword string, pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error) { o := orm.NewOrm() @@ -604,9 +604,9 @@ WHERE (relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0 LEFT JOIN md_members AS mdmb ON rel1.member_id = mdmb.member_id WHERE (rel.relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > 0) - AND book.label LIKE ? ORDER BY order_index DESC ,book.book_id DESC LIMIT ?,?` + AND book.label LIKE ? ORDER BY order_index DESC ,book.book_id DESC limit ? offset ?` - _, err = o.Raw(sql2, memberId, memberId, keyword, offset, pageSize).QueryRows(&books) + _, err = o.Raw(sql2, memberId, memberId, keyword, pageSize, offset).QueryRows(&books) return @@ -622,9 +622,9 @@ WHERE (relationship_id > 0 OR book.privately_owned = 0 or team.team_member_id > sql := `SELECT book.*,rel.*,mdmb.account AS create_name FROM md_books AS book LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.role_id = 0 LEFT JOIN md_members AS mdmb ON rel.member_id = mdmb.member_id - WHERE book.privately_owned = 0 AND book.label LIKE ? ORDER BY order_index DESC ,book.book_id DESC LIMIT ?,?` + WHERE book.privately_owned = 0 AND book.label LIKE ? ORDER BY order_index DESC ,book.book_id DESC limit ? offset ?` - _, err = o.Raw(sql, keyword, offset, pageSize).QueryRows(&books) + _, err = o.Raw(sql, keyword, pageSize, offset).QueryRows(&books) return @@ -665,7 +665,7 @@ func (book *Book) ReleaseContent(bookId int, lang string) { }) } -//重置文档数量 +// 重置文档数量 func (book *Book) ResetDocumentNumber(bookId int) { o := orm.NewOrm() @@ -1038,8 +1038,6 @@ func (book *Book) ImportWordBook(docxPath string, lang string) (err error) { doc.DocumentName = strings.TrimSpace(docName) - doc.DocumentId = book.MemberId - if err := doc.InsertOrUpdate("document_name", "book_id", "markdown", "content"); err != nil { logs.Error(doc.DocumentId, err) } diff --git a/models/BookResult.go b/models/BookResult.go index 9647f6e33..0ea535bcb 100644 --- a/models/BookResult.go +++ b/models/BookResult.go @@ -176,16 +176,16 @@ func (m *BookResult) FindToPager(pageIndex, pageSize int) (books []*BookResult, FROM md_books AS book LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.role_id = 0 LEFT JOIN md_members AS m ON rel.member_id = m.member_id - ORDER BY book.order_index DESC ,book.book_id DESC LIMIT ?,?` + ORDER BY book.order_index DESC ,book.book_id DESC limit ? offset ?` offset := (pageIndex - 1) * pageSize - _, err = o.Raw(sql, offset, pageSize).QueryRows(&books) + _, err = o.Raw(sql, pageSize, offset).QueryRows(&books) return } -//实体转换 +// 实体转换 func (m *BookResult) ToBookResult(book Book) *BookResult { m.BookId = book.BookId @@ -214,6 +214,7 @@ func (m *BookResult) ToBookResult(book Book) *BookResult { m.IsDownload = book.IsDownload == 0 m.AutoSave = book.AutoSave == 1 m.ItemId = book.ItemId + m.RoleId = conf.BookRoleNoSpecific if book.Theme == "" { m.Theme = "default" @@ -249,12 +250,13 @@ func (m *BookResult) ToBookResult(book Book) *BookResult { } else if m.CommentStatus == "group_only" { // todo } else { - m.IsDisplayComment = false; + m.IsDisplayComment = false } + return m } -//后台转换 +// 后台转换 func BackgroundConvert(sessionId string, bookResult *BookResult) error { if err := converter.CheckConvertCommand(); err != nil { @@ -274,7 +276,7 @@ func BackgroundConvert(sessionId string, bookResult *BookResult) error { return nil } -//导出PDF、word等格式 +// 导出PDF、word等格式 func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) { convertBookResult := ConvertBookResult{} @@ -521,7 +523,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) { return convertBookResult, nil } -//导出Markdown原始文件 +// 导出Markdown原始文件 func (m *BookResult) ExportMarkdown(sessionId string) (string, error) { outputPath := filepath.Join(conf.WorkingDirectory, "uploads", "books", strconv.Itoa(m.BookId), "book.zip") @@ -546,7 +548,7 @@ func (m *BookResult) ExportMarkdown(sessionId string) (string, error) { return outputPath, nil } -//递归导出Markdown文档 +// 递归导出Markdown文档 func exportMarkdown(p string, parentId int, bookId int, baseDir string, bookUrl string) error { o := orm.NewOrm() @@ -709,7 +711,7 @@ func recursiveJoinDocumentIdentify(parentDocId int, identify string) string { return identify } -//查询项目的第一篇文档 +// 查询项目的第一篇文档 func (m *BookResult) FindFirstDocumentByBookId(bookId int) (*Document, error) { o := orm.NewOrm() diff --git a/models/DocumentHistory.go b/models/DocumentHistory.go index 5f3c7b2b8..1d026e1c5 100644 --- a/models/DocumentHistory.go +++ b/models/DocumentHistory.go @@ -10,18 +10,18 @@ import ( type DocumentHistory struct { HistoryId int `orm:"column(history_id);pk;auto;unique" json:"history_id"` - Action string `orm:"column(action);size(255)" json:"action"` - ActionName string `orm:"column(action_name);size(255)" json:"action_name"` - DocumentId int `orm:"column(document_id);type(int);index" json:"doc_id"` - DocumentName string `orm:"column(document_name);size(500)" json:"doc_name"` - ParentId int `orm:"column(parent_id);type(int);index;default(0)" json:"parent_id"` - Markdown string `orm:"column(markdown);type(text);null" json:"markdown"` - Content string `orm:"column(content);type(text);null" json:"content"` - MemberId int `orm:"column(member_id);type(int)" json:"member_id"` - ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"` - ModifyAt int `orm:"column(modify_at);type(int)" json:"-"` - Version int64 `orm:"type(bigint);column(version)" json:"version"` - IsOpen int `orm:"column(is_open);type(int);default(0)" json:"is_open"` + Action string `orm:"column(action);size(255);description(modify)" json:"action"` + ActionName string `orm:"column(action_name);size(255);description(修改文档)" json:"action_name"` + DocumentId int `orm:"column(document_id);type(int);index;description(关联文档id)" json:"doc_id"` + DocumentName string `orm:"column(document_name);size(500);description(关联文档id)" json:"doc_name"` + ParentId int `orm:"column(parent_id);type(int);index;default(0);description(父级文档id)" json:"parent_id"` + Markdown string `orm:"column(markdown);type(text);null;description(文档内容)" json:"markdown"` + Content string `orm:"column(content);type(text);null;description(文档内容)" json:"content"` + MemberId int `orm:"column(member_id);type(int);description(作者id)" json:"member_id"` + ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now;description(修改时间)" json:"modify_time"` + ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"-"` + Version int64 `orm:"type(bigint);column(version);description(版本)" json:"version"` + IsOpen int `orm:"column(is_open);type(int);default(0);description(是否展开子目录 0:阅读时关闭节点 1:阅读时展开节点 2:空目录 单击时会展开下级节点)" json:"is_open"` } type DocumentHistorySimpleResult struct { @@ -165,9 +165,9 @@ func (m *DocumentHistory) FindToPager(docId, pageIndex, pageSize int) (docs []*D FROM md_document_history AS history LEFT JOIN md_members AS m1 ON history.member_id = m1.member_id LEFT JOIN md_members AS m2 ON history.modify_at = m2.member_id -WHERE history.document_id = ? ORDER BY history.history_id DESC LIMIT ?,?;` +WHERE history.document_id = ? ORDER BY history.history_id DESC limit ? offset ?;` - _, err = o.Raw(sql, docId, offset, pageSize).QueryRows(&docs) + _, err = o.Raw(sql, docId, pageSize, offset).QueryRows(&docs) if err != nil { return diff --git a/models/DocumentModel.go b/models/DocumentModel.go index f0ed549cc..58a9ff098 100644 --- a/models/DocumentModel.go +++ b/models/DocumentModel.go @@ -24,37 +24,31 @@ import ( // Document struct. type Document struct { - DocumentId int `orm:"pk;auto;unique;column(document_id)" json:"doc_id"` - DocumentName string `orm:"column(document_name);size(500)" json:"doc_name"` - // Identify 文档唯一标识 - Identify string `orm:"column(identify);size(100);index;null;default(null)" json:"identify"` - BookId int `orm:"column(book_id);type(int);index" json:"book_id"` - ParentId int `orm:"column(parent_id);type(int);index;default(0)" json:"parent_id"` - OrderSort int `orm:"column(order_sort);default(0);type(int);index" json:"order_sort"` - // Markdown markdown格式文档. - Markdown string `orm:"column(markdown);type(text);null" json:"markdown"` - // Release 发布后的Html格式内容. - Release string `orm:"column(release);type(text);null" json:"release"` - // Content 未发布的 Html 格式内容. - Content string `orm:"column(content);type(text);null" json:"content"` - CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` - MemberId int `orm:"column(member_id);type(int)" json:"member_id"` - ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"` - ModifyAt int `orm:"column(modify_at);type(int)" json:"-"` - Version int64 `orm:"column(version);type(bigint);" json:"version"` - //是否展开子目录:0 否/1 是 /2 空间节点,单击时展开下一级 - IsOpen int `orm:"column(is_open);type(int);default(0)" json:"is_open"` - ViewCount int `orm:"column(view_count);type(int)" json:"view_count"` - AttachList []*Attachment `orm:"-" json:"attach"` + DocumentId int `orm:"pk;auto;unique;column(document_id)" json:"doc_id"` + DocumentName string `orm:"column(document_name);size(500);description(文档名称)" json:"doc_name"` + Identify string `orm:"column(identify);size(100);index;null;default(null);description(唯一标识)" json:"identify"` // Identify 文档唯一标识 + BookId int `orm:"column(book_id);type(int);index;description(关联bools表主键)" json:"book_id"` + ParentId int `orm:"column(parent_id);type(int);index;default(0);description(父级文档)" json:"parent_id"` + OrderSort int `orm:"column(order_sort);default(0);type(int);index;description(排序从小到大排序)" json:"order_sort"` + Markdown string `orm:"column(markdown);type(text);null;description(markdown内容)" json:"markdown"` // Markdown markdown格式文档. + MarkdownTheme string `orm:"column(markdown_theme);size(50);default(theme__light);description(markdown主题)" json:"markdown_theme"` + Release string `orm:"column(release);type(text);null;description(文章内容)" json:"release"` // Release 发布后的Html格式内容. + Content string `orm:"column(content);type(text);null;description(文章内容)" json:"content"` // Content 未发布的 Html 格式内容. + CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` + MemberId int `orm:"column(member_id);type(int);description(关系用户id)" json:"member_id"` + ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now;description(修改时间)" json:"modify_time"` + ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"-"` + Version int64 `orm:"column(version);type(bigint);description(版本,关联历史文档里的version)" json:"version"` + IsOpen int `orm:"column(is_open);type(int);default(0);description(是否展开子目录 0:阅读时关闭节点 1:阅读时展开节点 2:空目录 单击时会展开下级节点)" json:"is_open"` //是否展开子目录:0 否/1 是 /2 空间节点,单击时展开下一级 + ViewCount int `orm:"column(view_count);type(int);description(浏览量)" json:"view_count"` + AttachList []*Attachment `orm:"-" json:"attach"` //i18n Lang string `orm:"-"` } // 多字段唯一键 func (item *Document) TableUnique() [][]string { - return [][]string{ - []string{"book_id", "identify"}, - } + return [][]string{{"book_id", "identify"}} } // TableName 获取对应数据库表名. @@ -77,7 +71,7 @@ func NewDocument() *Document { } } -//根据文档ID查询指定文档. +// 根据文档ID查询指定文档. func (item *Document) Find(id int) (*Document, error) { if id <= 0 { return item, ErrInvalidParameter @@ -94,7 +88,7 @@ func (item *Document) Find(id int) (*Document, error) { return item, nil } -//插入和更新文档. +// 插入和更新文档. func (item *Document) InsertOrUpdate(cols ...string) error { o := orm.NewOrm() item.DocumentName = utils.StripTags(item.DocumentName) @@ -126,7 +120,7 @@ func (item *Document) InsertOrUpdate(cols ...string) error { return nil } -//根据文档识别编号和项目id获取一篇文档 +// 根据文档识别编号和项目id获取一篇文档 func (item *Document) FindByIdentityFirst(identify string, bookId int) (*Document, error) { o := orm.NewOrm() @@ -135,7 +129,7 @@ func (item *Document) FindByIdentityFirst(identify string, bookId int) (*Documen return item, err } -//递归删除一个文档. +// 递归删除一个文档. func (item *Document) RecursiveDocument(docId int) error { o := orm.NewOrm() @@ -163,7 +157,7 @@ func (item *Document) RecursiveDocument(docId int) error { return nil } -//将文档写入缓存 +// 将文档写入缓存 func (item *Document) PutToCache() { go func(m Document) { @@ -181,7 +175,7 @@ func (item *Document) PutToCache() { }(*item) } -//清除缓存 +// 清除缓存 func (item *Document) RemoveCache() { go func(m Document) { cache.Put("Document.Id."+strconv.Itoa(m.DocumentId), m, time.Second*3600) @@ -192,7 +186,7 @@ func (item *Document) RemoveCache() { }(*item) } -//从缓存获取 +// 从缓存获取 func (item *Document) FromCacheById(id int) (*Document, error) { if err := cache.Get("Document.Id."+strconv.Itoa(id), &item); err == nil && item.DocumentId > 0 { @@ -211,7 +205,7 @@ func (item *Document) FromCacheById(id int) (*Document, error) { return item, err } -//根据文档标识从缓存中查询文档 +// 根据文档标识从缓存中查询文档 func (item *Document) FromCacheByIdentify(identify string, bookId int) (*Document, error) { key := fmt.Sprintf("Document.BookId.%d.Identify.%s", bookId, identify) @@ -229,7 +223,7 @@ func (item *Document) FromCacheByIdentify(identify string, bookId int) (*Documen return item.FindByIdentityFirst(identify, bookId) } -//根据项目ID查询文档列表. +// 根据项目ID查询文档列表. func (item *Document) FindListByBookId(bookId int) (docs []*Document, err error) { o := orm.NewOrm() @@ -238,14 +232,14 @@ func (item *Document) FindListByBookId(bookId int) (docs []*Document, err error) return } -//判断文章是否存在 +// 判断文章是否存在 func (item *Document) IsExist(documentId int) bool { o := orm.NewOrm() return o.QueryTable(item.TableNameWithPrefix()).Filter("document_id", documentId).Exist() } -//发布单篇文档 +// 发布单篇文档 func (item *Document) ReleaseContent() error { item.Release = strings.TrimSpace(item.Content) @@ -267,127 +261,136 @@ func (item *Document) ReleaseContent() error { return nil } -//处理文档的外链,附件,底部编辑信息等. +// Processor 调用位置两处: +// 1. 项目发布和文档发布: 处理文档的外链,附件,底部编辑信息等; +// 2. 文档阅读:可以修复存在问题的文档,使其能正常显示附件下载和文档作者信息等。 func (item *Document) Processor() *Document { if item.Release != "" { item.Release = utils.SafetyProcessor(item.Release) + } else { + // Release内容为空,直接赋值文档标签,保证附件下载正常 + item.Release = "
" + } - //安全过滤,移除危险标签和属性 - if docQuery, err := goquery.NewDocumentFromReader(bytes.NewBufferString(item.Release)); err == nil { + // Next: 生成文档的一些附加信息 + if docQuery, err := goquery.NewDocumentFromReader(bytes.NewBufferString(item.Release)); err == nil { + //处理附件 + if selector := docQuery.Find("div.attach-list").First(); selector.Size() <= 0 { //处理附件 - if selector := docQuery.Find("div.attach-list").First(); selector.Size() <= 0 { - //处理附件 - attachList, err := NewAttachment().FindListByDocumentId(item.DocumentId) - if err == nil && len(attachList) > 0 { - content := bytes.NewBufferString("
" + i18n.Tr(item.Lang, "doc.attachment") + "
") + if docQuery == nil { + docQuery, err = goquery.NewDocumentFromReader(content) + if err != nil { + logs.Error("goquery->NewDocumentFromReader err:%+v", err) + } + } else { + if selector := docQuery.Find("div.wiki-bottom").First(); selector.Size() > 0 { + selector.BeforeHtml(content.String()) //This branch should be a compatible branch. + } else if selector := docQuery.Find("div.markdown-article").First(); selector.Size() > 0 { + selector.AppendHtml(content.String()) //The document produced by the editor of Markdown will have this tag.class. + } else if selector := docQuery.Find("div.whole-article-wrap").First(); selector.Size() > 0 { + selector.AppendHtml(content.String()) //All documents should have this tag. } } } + } - //处理了文档底部信息 - if selector := docQuery.Find("div.wiki-bottom").First(); selector.Size() <= 0 && item.MemberId > 0 { - //处理文档结尾信息 - docCreator, err := NewMember().Find(item.MemberId, "real_name", "account") - release := "
" + //处理了文档底部信息 + if selector := docQuery.Find("div.wiki-bottom").First(); selector.Size() <= 0 && item.MemberId > 0 { + //处理文档结尾信息 + docCreator, err := NewMember().Find(item.MemberId, "real_name", "account") + release := "
" + + release += i18n.Tr(item.Lang, "doc.ft_author") + if err == nil && docCreator != nil { + if docCreator.RealName != "" { + release += docCreator.RealName + } else { + release += docCreator.Account + } + } + release += "  " + i18n.Tr(item.Lang, "doc.ft_create_time") + item.CreateTime.Local().Format("2006-01-02 15:04") + "
" - release += i18n.Tr(item.Lang, "doc.ft_author") - if err == nil && docCreator != nil { - if docCreator.RealName != "" { - release += docCreator.RealName + if item.ModifyAt > 0 { + docModify, err := NewMember().Find(item.ModifyAt, "real_name", "account") + if err == nil { + if docModify.RealName != "" { + release += i18n.Tr(item.Lang, "doc.ft_last_editor") + docModify.RealName } else { - release += docCreator.Account + release += i18n.Tr(item.Lang, "doc.ft_last_editor") + docModify.Account } } - release += "  " + i18n.Tr(item.Lang, "doc.ft_create_time") + item.CreateTime.Local().Format("2006-01-02 15:04") + "
" - - if item.ModifyAt > 0 { - docModify, err := NewMember().Find(item.ModifyAt, "real_name", "account") - if err == nil { - if docModify.RealName != "" { - release += i18n.Tr(item.Lang, "doc.ft_last_editor") + docModify.RealName - } else { - release += i18n.Tr(item.Lang, "doc.ft_last_editor") + docModify.Account - } - } - } - release += "  " + i18n.Tr(item.Lang, "doc.ft_update_time") + item.ModifyTime.Local().Format("2006-01-02 15:04") + "
" - release += "
" + } + release += "  " + i18n.Tr(item.Lang, "doc.ft_update_time") + item.ModifyTime.Local().Format("2006-01-02 15:04") + "
" + release += "
" - if selector := docQuery.Find("div.markdown-article").First(); selector.Size() > 0 { - selector.AppendHtml(release) - } else if selector := docQuery.Find("article.markdown-article-inner").First(); selector.Size() > 0 { - selector.First().AppendHtml(release) - } + if selector := docQuery.Find("div.markdown-article").First(); selector.Size() > 0 { + selector.AppendHtml(release) + } else if selector := docQuery.Find("div.whole-article-wrap").First(); selector.Size() > 0 { + selector.AppendHtml(release) } - cdnimg, _ := web.AppConfig.String("cdnimg") + } + cdnimg, _ := web.AppConfig.String("cdnimg") - docQuery.Find("img").Each(func(i int, selection *goquery.Selection) { + docQuery.Find("img").Each(func(i int, selection *goquery.Selection) { - if src, ok := selection.Attr("src"); ok { - src = strings.TrimSpace(strings.ToLower(src)) - //过滤掉没有链接的图片标签 - if src == "" || strings.HasPrefix(src, "data:text/html") { - selection.Remove() - return - } + if src, ok := selection.Attr("src"); ok { + src = strings.TrimSpace(strings.ToLower(src)) + //过滤掉没有链接的图片标签 + if src == "" || strings.HasPrefix(src, "data:text/html") { + selection.Remove() + return + } - //设置图片为CDN地址 - if cdnimg != "" && strings.HasPrefix(src, "/uploads/") { - selection.SetAttr("src", utils.JoinURI(cdnimg, src)) - } + //设置图片为CDN地址 + if cdnimg != "" && strings.HasPrefix(src, "/uploads/") { + selection.SetAttr("src", utils.JoinURI(cdnimg, src)) + } + } + selection.RemoveAttr("onerror").RemoveAttr("onload") + }) + //过滤A标签的非法连接 + docQuery.Find("a").Each(func(i int, selection *goquery.Selection) { + if val, exists := selection.Attr("href"); exists { + if val == "" { + selection.SetAttr("href", "#") + return } - selection.RemoveAttr("onerror").RemoveAttr("onload") - }) - //过滤A标签的非法连接 - docQuery.Find("a").Each(func(i int, selection *goquery.Selection) { - if val, exists := selection.Attr("href"); exists { - if val == "" { - selection.SetAttr("href", "#") - return - } - val = strings.Replace(strings.ToLower(val), " ", "", -1) - //移除危险脚本链接 - if strings.HasPrefix(val, "data:text/html") || - strings.HasPrefix(val, "vbscript:") || - strings.HasPrefix(val, "javascript:") || - strings.HasPrefix(val, "javascript:") { - selection.SetAttr("href", "#") - } + val = strings.Replace(strings.ToLower(val), " ", "", -1) + //移除危险脚本链接 + if strings.HasPrefix(val, "data:text/html") || + strings.HasPrefix(val, "vbscript:") || + strings.HasPrefix(val, "javascript:") || + strings.HasPrefix(val, "javascript:") { + selection.SetAttr("href", "#") } - //移除所有 onerror 属性 - selection.RemoveAttr("onerror").RemoveAttr("onload").RemoveAttr("onclick") - }) + } + //移除所有 onerror 属性 + selection.RemoveAttr("onerror").RemoveAttr("onload").RemoveAttr("onclick") + }) - docQuery.Find("script").Remove() - docQuery.Find("link").Remove() - docQuery.Find("vbscript").Remove() + docQuery.Find("script").Remove() + docQuery.Find("link").Remove() + docQuery.Find("vbscript").Remove() - if html, err := docQuery.Html(); err == nil { - item.Release = strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(html), ""), "") - } + if html, err := docQuery.Html(); err == nil { + item.Release = strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(html), ""), "") } } + return item } diff --git a/models/DocumentSearchResult.go b/models/DocumentSearchResult.go index afb751de6..5be74055c 100644 --- a/models/DocumentSearchResult.go +++ b/models/DocumentSearchResult.go @@ -96,7 +96,7 @@ WHERE book.privately_owned = 0 AND (book.book_name LIKE ? OR book.description LI WHERE blog.blog_status = 'public' AND (blog.blog_release LIKE ? OR blog.blog_title LIKE ?) ) AS union_table ORDER BY create_time DESC -LIMIT ?, ?;` +LIMIT ? OFFSET ?;` err = o.Raw(sql1, keyword, keyword).QueryRow(&totalCount) if err != nil { @@ -128,7 +128,7 @@ WHERE book.privately_owned = 0 AND (book.book_name LIKE ? OR book.description LI totalCount += c - _, err = o.Raw(sql2, keyword, keyword, keyword, keyword, keyword, keyword, offset, pageSize).QueryRows(&searchResult) + _, err = o.Raw(sql2, keyword, keyword, keyword, keyword, keyword, keyword, pageSize, offset).QueryRows(&searchResult) if err != nil { logs.Error("查询搜索结果失败 -> ", err) return @@ -224,7 +224,7 @@ FROM ( (blog.blog_release LIKE ? OR blog.blog_title LIKE ?) ) AS union_table ORDER BY create_time DESC -LIMIT ?, ?;` +LIMIT ? OFFSET ?;` err = o.Raw(sql1, memberId, memberId, keyword, keyword).QueryRow(&totalCount) if err != nil { @@ -262,7 +262,7 @@ WHERE (book.privately_owned = 0 OR rel1.relationship_id > 0 or team.team_member_ totalCount += c - _, err = o.Raw(sql2, memberId, memberId, keyword, keyword, memberId, memberId, keyword, keyword, memberId, keyword, keyword, offset, pageSize).QueryRows(&searchResult) + _, err = o.Raw(sql2, memberId, memberId, keyword, keyword, memberId, memberId, keyword, keyword, memberId, keyword, keyword, pageSize, offset).QueryRows(&searchResult) if err != nil { return } diff --git a/models/Itemsets.go b/models/Itemsets.go index 07b8894f2..fe0531575 100644 --- a/models/Itemsets.go +++ b/models/Itemsets.go @@ -15,13 +15,13 @@ import ( //项目空间 type Itemsets struct { ItemId int `orm:"column(item_id);pk;auto;unique" json:"item_id"` - ItemName string `orm:"column(item_name);size(500)" json:"item_name"` - ItemKey string `orm:"column(item_key);size(100);unique" json:"item_key"` - Description string `orm:"column(description);type(text);null" json:"description"` - MemberId int `orm:"column(member_id);size(100)" json:"member_id"` - CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` - ModifyTime time.Time `orm:"column(modify_time);type(datetime);null;auto_now" json:"modify_time"` - ModifyAt int `orm:"column(modify_at);type(int)" json:"modify_at"` + ItemName string `orm:"column(item_name);size(500);description(项目空间名称)" json:"item_name"` + ItemKey string `orm:"column(item_key);size(100);unique;description(项目空间标识)" json:"item_key"` + Description string `orm:"column(description);type(text);null;description(描述)" json:"description"` + MemberId int `orm:"column(member_id);size(100);description(所属用户)" json:"member_id"` + CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` + ModifyTime time.Time `orm:"column(modify_time);type(datetime);null;auto_now;description(修改时间)" json:"modify_time"` + ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"modify_at"` BookNumber int `orm:"-" json:"book_number"` CreateTimeString string `orm:"-" json:"create_time_string"` @@ -246,9 +246,9 @@ as t group by book_id) as team LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0 LEFT JOIN md_members AS mdmb ON rel1.member_id = mdmb.member_id WHERE book.item_id = ? AND (book.privately_owned = 0 or rel.role_id >= 0 or team.role_id >= 0) - ORDER BY order_index desc,book.book_id DESC LIMIT ?,?` + ORDER BY order_index desc,book.book_id DESC limit ? offset ?` - _, err = o.Raw(sql2, memberId, memberId, item.ItemId, offset, pageSize).QueryRows(&books) + _, err = o.Raw(sql2, memberId, memberId, item.ItemId, pageSize, offset).QueryRows(&books) return @@ -264,9 +264,9 @@ as t group by book_id) as team sql := `SELECT book.*,rel.*,mdmb.account AS create_name FROM md_books AS book LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.role_id = 0 LEFT JOIN md_members AS mdmb ON rel.member_id = mdmb.member_id - WHERE book.item_id = ? AND book.privately_owned = 0 ORDER BY order_index desc,book.book_id DESC LIMIT ?,?` + WHERE book.item_id = ? AND book.privately_owned = 0 ORDER BY order_index desc,book.book_id DESC limit ? offset ?` - _, err = o.Raw(sql, item.ItemId, offset, pageSize).QueryRows(&books) + _, err = o.Raw(sql, item.ItemId, pageSize, offset).QueryRows(&books) return diff --git a/models/LabelModel.go b/models/LabelModel.go index 49a8ebf81..9645b62a7 100644 --- a/models/LabelModel.go +++ b/models/LabelModel.go @@ -9,9 +9,9 @@ import ( ) type Label struct { - LabelId int `orm:"column(label_id);pk;auto;unique;" json:"label_id"` - LabelName string `orm:"column(label_name);size(50);unique" json:"label_name"` - BookNumber int `orm:"column(book_number)" json:"book_number"` + LabelId int `orm:"column(label_id);pk;auto;unique;description(项目标签id)" json:"label_id"` + LabelName string `orm:"column(label_name);size(50);unique;description(项目标签名称)" json:"label_name"` + BookNumber int `orm:"column(book_number);description(包涵项目数量)" json:"book_number"` } // TableName 获取对应数据库表名. diff --git a/models/Member.go b/models/Member.go index 49916e242..d217cd720 100644 --- a/models/Member.go +++ b/models/Member.go @@ -3,11 +3,13 @@ package models import ( "crypto/md5" + "crypto/tls" "encoding/hex" "encoding/json" "errors" "fmt" "io/ioutil" + "net" "net/http" "net/url" "regexp" @@ -15,7 +17,7 @@ import ( "strings" "time" - "gopkg.in/ldap.v2" + "github.com/go-ldap/ldap/v3" "math" @@ -27,24 +29,26 @@ import ( "github.com/mindoc-org/mindoc/utils" ) +var LdapDefaultTimeout = 8 * time.Second + type Member struct { MemberId int `orm:"pk;auto;unique;column(member_id)" json:"member_id"` - Account string `orm:"size(100);unique;column(account)" json:"account"` - RealName string `orm:"size(255);column(real_name)" json:"real_name"` - Password string `orm:"size(1000);column(password)" json:"-"` + Account string `orm:"size(100);unique;column(account);description(登录名)" json:"account"` + RealName string `orm:"size(255);column(real_name);description(真实姓名)" json:"real_name"` + Password string `orm:"size(1000);column(password);description(密码)" json:"-"` //认证方式: local 本地数据库 /ldap LDAP - AuthMethod string `orm:"column(auth_method);default(local);size(50);" json:"auth_method"` - Description string `orm:"column(description);size(2000)" json:"description"` - Email string `orm:"size(100);column(email);unique" json:"email"` - Phone string `orm:"size(255);column(phone);null;default(null)" json:"phone"` - Avatar string `orm:"size(1000);column(avatar)" json:"avatar"` + AuthMethod string `orm:"column(auth_method);default(local);size(50);description(授权方式 local:本地校验 ldap:LDAP用户校验)" json:"auth_method"` + Description string `orm:"column(description);size(2000);description(描述)" json:"description"` + Email string `orm:"size(100);column(email);unique;description(邮箱)" json:"email"` + Phone string `orm:"size(255);column(phone);null;default(null);description(手机)" json:"phone"` + Avatar string `orm:"size(1000);column(avatar);description(头像)" json:"avatar"` //用户角色:0 超级管理员 /1 管理员/ 2 普通用户 . - Role conf.SystemRole `orm:"column(role);type(int);default(1);index" json:"role"` + Role conf.SystemRole `orm:"column(role);type(int);default(1);index;description(用户角色: 0:超级管理员 1:管理员 2:普通用户)" json:"role"` RoleName string `orm:"-" json:"role_name"` - Status int `orm:"column(status);type(int);default(0)" json:"status"` //用户状态:0 正常/1 禁用 - CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` - CreateAt int `orm:"type(int);column(create_at)" json:"create_at"` - LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null" json:"last_login_time"` + Status int `orm:"column(status);type(int);default(0);description(状态 0:启用 1:禁用)" json:"status"` //用户状态:0 正常/1 禁用 + CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add;description(创建时间)" json:"create_time"` + CreateAt int `orm:"type(int);column(create_at);description(创建人id)" json:"create_at"` + LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null;description(最后登录时间)" json:"last_login_time"` //i18n Lang string `orm:"-"` } @@ -90,7 +94,6 @@ func (m *Member) Login(account string, password string) (*Member, error) { } switch member.AuthMethod { - case "": case "local": ok, err := utils.PasswordVerify(member.Password, password) if ok && err == nil { @@ -109,24 +112,34 @@ func (m *Member) Login(account string, password string) (*Member, error) { } // TmpLogin 用于钉钉临时登录 -func (m *Member) TmpLogin(account string) (*Member, error) { - o := orm.NewOrm() - member := &Member{} - err := o.Raw("select * from md_members where account = ? and status = 0 limit 1;", account).QueryRow(member) - if err != nil { - return member, ErrorMemberPasswordError - } - return member, nil -} - -//ldapLogin 通过LDAP登陆 +//func (m *Member) TmpLogin(account string) (*Member, error) { +// o := orm.NewOrm() +// member := &Member{} +// err := o.Raw("select * from md_members where account = ? and status = 0 limit 1;", account).QueryRow(member) +// if err != nil { +// return member, ErrorMemberPasswordError +// } +// return member, nil +//} + +// ldapLogin 通过LDAP登陆 func (m *Member) ldapLogin(account string, password string) (*Member, error) { if !web.AppConfig.DefaultBool("ldap_enable", false) { return m, ErrMemberAuthMethodInvalid } var err error - ldaphost, _ := web.AppConfig.String("ldap_host") - lc, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", ldaphost, web.AppConfig.DefaultInt("ldap_port", 3268))) + var ldapOpt ldap.DialOpt + ldap_scheme := web.AppConfig.DefaultString("ldap_scheme", "ldap") + dialer := net.Dialer{Timeout: LdapDefaultTimeout} + if ldap_scheme == "ldaps" { + ldapOpt = ldap.DialWithTLSDialer(&tls.Config{InsecureSkipVerify: true}, &dialer) + } else { + ldapOpt = ldap.DialWithDialer(&dialer) + } + ldap_host, _ := web.AppConfig.String("ldap_host") + ldap_port := web.AppConfig.DefaultInt("ldap_port", 3268) + ldap_url := fmt.Sprintf("%s://%s:%d", ldap_scheme, ldap_host, ldap_port) + lc, err := ldap.DialURL(ldap_url, ldapOpt) if err != nil { logs.Error("绑定 LDAP 用户失败 ->", err) return m, ErrLDAPConnect @@ -141,13 +154,23 @@ func (m *Member) ldapLogin(account string, password string) (*Member, error) { } ldapbase, _ := web.AppConfig.String("ldap_base") ldapfilter, _ := web.AppConfig.String("ldap_filter") - ldapattr, _ := web.AppConfig.String("ldap_attribute") + ldapaccount, _ := web.AppConfig.String("ldap_account") + ldapmail, _ := web.AppConfig.String("ldap_mail") + // 判断account是否是email + isEmail := false + var email string + ldapattr := ldapaccount + if ok, err := regexp.MatchString(conf.RegexpEmail, account); ok && err == nil { + isEmail = true + email = account + ldapattr = ldapmail + } searchRequest := ldap.NewSearchRequest( ldapbase, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, - //修改objectClass通过配置文件获取值 + // 修改objectClass通过配置文件获取值 fmt.Sprintf("(&(%s)(%s=%s))", ldapfilter, ldapattr, account), - []string{"dn", "mail"}, + []string{"dn", "mail", "cn", "ou", "sAMAccountName"}, nil, ) searchResult, err := lc.Search(searchRequest) @@ -164,10 +187,33 @@ func (m *Member) ldapLogin(account string, password string) (*Member, error) { logs.Error("绑定 LDAP 用户失败 ->", err) return m, ErrorMemberPasswordError } + + ldap_cn := searchResult.Entries[0].GetAttributeValue("cn") + ldap_mail := searchResult.Entries[0].GetAttributeValue(ldapmail) // "mail" + ldap_account := searchResult.Entries[0].GetAttributeValue(ldapaccount) // "sAMAccountName" + + m.RealName = ldap_cn + m.Account = ldap_account + m.AuthMethod = "ldap" + // 如果ldap配置了email + if len(ldap_mail) > 0 && strings.Contains(ldap_mail, "@") { + // 如果member已配置email + if len(m.Email) > 0 { + // 如果member配置的email和ldap配置的email不同 + if m.Email != ldap_mail { + return m, fmt.Errorf("ldap配置的email(%s)与数据库中已有email({%s})不同, 请联系管理员修改", ldap_mail, m.Email) + } + } else { + // 如果member未配置email,则用ldap的email配置 + m.Email = ldap_mail + } + } else { + // 如果ldap未配置email,则直接绑定到member + if isEmail { + m.Email = email + } + } if m.MemberId <= 0 { - m.Account = account - m.Email = searchResult.Entries[0].GetAttributeValue("mail") - m.AuthMethod = "ldap" m.Avatar = "/static/images/headimgurl.jpg" m.Role = conf.SystemRole(web.AppConfig.DefaultInt("ldap_user_role", 2)) m.CreateTime = time.Now() @@ -178,6 +224,14 @@ func (m *Member) ldapLogin(account string, password string) (*Member, error) { return m, ErrorMemberPasswordError } m.ResolveRoleName() + } else { + // 更新ldap信息 + err = m.Update("account", "real_name", "email", "auth_method") + if err != nil { + logs.Error("LDAP更新用户信息失败", err) + return m, errors.New("LDAP更新用户信息失败") + } + m.ResolveRoleName() } return m, nil } @@ -338,7 +392,7 @@ func (m *Member) ResolveRoleName() { } } -//根据账号查找用户. +// 根据账号查找用户. func (m *Member) FindByAccount(account string) (*Member, error) { o := orm.NewOrm() @@ -350,7 +404,7 @@ func (m *Member) FindByAccount(account string) (*Member, error) { return m, err } -//批量查询用户 +// 批量查询用户 func (m *Member) FindByAccountList(accounts ...string) ([]*Member, error) { o := orm.NewOrm() @@ -365,7 +419,7 @@ func (m *Member) FindByAccountList(accounts ...string) ([]*Member, error) { return members, err } -//分页查找用户. +// 分页查找用户. func (m *Member) FindToPager(pageIndex, pageSize int) ([]*Member, int, error) { o := orm.NewOrm() @@ -399,7 +453,7 @@ func (m *Member) IsAdministrator() bool { return m.Role == 0 || m.Role == 1 } -//根据指定字段查找用户. +// 根据指定字段查找用户. func (m *Member) FindByFieldFirst(field string, value interface{}) (*Member, error) { o := orm.NewOrm() @@ -408,7 +462,7 @@ func (m *Member) FindByFieldFirst(field string, value interface{}) (*Member, err return m, err } -//校验用户. +// 校验用户. func (m *Member) Valid(is_hash_password bool) error { //邮箱不能为空 @@ -464,22 +518,31 @@ func (m *Member) Valid(is_hash_password bool) error { return nil } -//删除一个用户. +// 删除一个用户. func (m *Member) Delete(oldId int, newId int) error { ormer := orm.NewOrm() o, err := ormer.Begin() - if err != nil { return err } + _, err = o.Raw("DELETE FROM md_dingtalk_accounts WHERE member_id = ?", oldId).Exec() + if err != nil { + o.Rollback() + return err + } + _, err = o.Raw("DELETE FROM md_workweixin_accounts WHERE member_id = ?", oldId).Exec() + if err != nil { + o.Rollback() + return err + } _, err = o.Raw("DELETE FROM md_members WHERE member_id = ?", oldId).Exec() if err != nil { o.Rollback() return err } - _, err = o.Raw("UPDATE md_attachment SET `create_at` = ? WHERE `create_at` = ?", newId, oldId).Exec() + _, err = o.Raw("UPDATE md_attachment SET create_at = ? WHERE create_at = ?", newId, oldId).Exec() if err != nil { o.Rollback() diff --git a/models/MemberResult.go b/models/MemberResult.go index 3926ae0ae..8688e85b2 100644 --- a/models/MemberResult.go +++ b/models/MemberResult.go @@ -72,7 +72,7 @@ func (m *MemberRelationshipResult) FindForUsersByBookId(lang string, bookId, pag var members []*MemberRelationshipResult - sql1 := "SELECT * FROM md_relationship AS rel LEFT JOIN md_members as mdmb ON rel.member_id = mdmb.member_id WHERE rel.book_id = ? ORDER BY rel.relationship_id DESC LIMIT ?,?" + sql1 := "SELECT * FROM md_relationship AS rel LEFT JOIN md_members as mdmb ON rel.member_id = mdmb.member_id WHERE rel.book_id = ? ORDER BY rel.relationship_id DESC limit ? offset ?" sql2 := "SELECT count(*) AS total_count FROM md_relationship AS rel LEFT JOIN md_members as mdmb ON rel.member_id = mdmb.member_id WHERE rel.book_id = ?" @@ -86,7 +86,7 @@ func (m *MemberRelationshipResult) FindForUsersByBookId(lang string, bookId, pag offset := (pageIndex - 1) * pageSize - _, err = o.Raw(sql1, bookId, offset, pageSize).QueryRows(&members) + _, err = o.Raw(sql1, bookId, pageSize, offset).QueryRows(&members) if err != nil { return members, 0, err diff --git a/models/Relationship.go b/models/Relationship.go index 7f9fe801f..8de89c334 100644 --- a/models/Relationship.go +++ b/models/Relationship.go @@ -10,13 +10,13 @@ import ( type Relationship struct { RelationshipId int `orm:"pk;auto;unique;column(relationship_id)" json:"relationship_id"` - MemberId int `orm:"column(member_id);type(int)" json:"member_id"` - BookId int `orm:"column(book_id);type(int)" json:"book_id"` + MemberId int `orm:"column(member_id);type(int);description(作者id)" json:"member_id"` + BookId int `orm:"column(book_id);type(int);description(所属项目id)" json:"book_id"` // RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者 - RoleId conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"` + RoleId conf.BookRole `orm:"column(role_id);type(int);description(角色-配置文件里写死:0 创始人-不能被移除 / 1 管理员/2 编辑者/3 观察者)" json:"role_id"` } -// TableName 获取对应数据库表名. +// TableName 获取对应数据库表名. 用户和项目的关联表 func (m *Relationship) TableName() string { return "relationship" } diff --git a/models/Team.go b/models/Team.go index c7226d761..a980376e9 100644 --- a/models/Team.go +++ b/models/Team.go @@ -12,10 +12,10 @@ import ( //团队. type Team struct { TeamId int `orm:"column(team_id);pk;auto;unique;" json:"team_id"` - TeamName string `orm:"column(team_name);size(255)" json:"team_name"` - MemberId int `orm:"column(member_id);type(int);" json:"member_id"` - IsDelete bool `orm:"column(is_delete);default(0)" json:"is_delete"` - CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` + TeamName string `orm:"column(team_name);size(255);description(团队名称)" json:"team_name"` + MemberId int `orm:"column(member_id);type(int);description(创建人id)" json:"member_id"` + IsDelete bool `orm:"column(is_delete);default(false);description(是否删除 false:否 true:是)" json:"is_delete"` + CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` MemberCount int `orm:"-" json:"member_count"` BookCount int `orm:"-" json:"book_count"` MemberName string `orm:"-" json:"member_name"` diff --git a/models/TeamMember.go b/models/TeamMember.go index 4243638c7..acfe4a867 100644 --- a/models/TeamMember.go +++ b/models/TeamMember.go @@ -11,10 +11,10 @@ import ( type TeamMember struct { TeamMemberId int `orm:"column(team_member_id);pk;auto;unique;" json:"team_member_id"` - TeamId int `orm:"column(team_id);type(int)" json:"team_id"` - MemberId int `orm:"column(member_id);type(int)" json:"member_id"` + TeamId int `orm:"column(team_id);type(int);description(团队id)" json:"team_id"` + MemberId int `orm:"column(member_id);type(int);description(成员id)" json:"member_id"` // RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者 - RoleId conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"` + RoleId conf.BookRole `orm:"column(role_id);type(int);description(RoleId 角色:0 创始人-创始人不能被移除 / 1 管理员/2 编辑者/3 观察者)" json:"role_id"` RoleName string `orm:"-" json:"role_name"` Account string `orm:"-" json:"account"` RealName string `orm:"-" json:"real_name"` diff --git a/models/TeamRelationship.go b/models/TeamRelationship.go index e6e82a7f4..90fd57884 100644 --- a/models/TeamRelationship.go +++ b/models/TeamRelationship.go @@ -11,9 +11,9 @@ import ( type TeamRelationship struct { TeamRelationshipId int `orm:"column(team_relationship_id);pk;auto;unique;" json:"team_relationship_id"` - BookId int `orm:"column(book_id)" json:"book_id"` - TeamId int `orm:"column(team_id)" json:"team_id"` - CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` + BookId int `orm:"column(book_id);description(项目id)" json:"book_id"` + TeamId int `orm:"column(team_id);description(团队id)" json:"team_id"` + CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` TeamName string `orm:"-" json:"team_name"` MemberCount int `orm:"-" json:"member_count"` BookMemberId int `orm:"-" json:"book_member_id"` diff --git a/models/WorkWeixinAccount.go b/models/WorkWeixinAccount.go deleted file mode 100644 index 8e3b04ce6..000000000 --- a/models/WorkWeixinAccount.go +++ /dev/null @@ -1,74 +0,0 @@ -// Package models . -package models - -import ( - "errors" - "time" - - "github.com/beego/beego/v2/client/orm" - "github.com/beego/beego/v2/core/logs" - "github.com/mindoc-org/mindoc/conf" -) - -type WorkWeixinAccount struct { - MemberId int `orm:"column(member_id);type(int);default(-1);index" json:"member_id"` - UserDbId int `orm:"pk;auto;unique;column(user_db_id)" json:"user_db_id"` - WorkWeixin_UserId string `orm:"size(100);unique;column(workweixin_user_id)" json:"workweixin_user_id"` - // WorkWeixin_Name string `orm:"size(255);column(workweixin_name)" json:"workweixin_name"` - // WorkWeixin_Phone string `orm:"size(25);column(workweixin_phone)" json:"workweixin_phone"` - // WorkWeixin_Email string `orm:"size(255);column(workweixin_email)" json:"workweixin_email"` - // WorkWeixin_Status int `orm:"type(int);column(status)" json:"status"` - // WorkWeixin_Avatar string `orm:"size(1024);column(avatar)" json:"avatar"` - CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` - CreateAt int `orm:"type(int);column(create_at)" json:"create_at"` - LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null" json:"last_login_time"` -} - -// TableName 获取对应数据库表名. -func (m *WorkWeixinAccount) TableName() string { - return "workweixin_accounts" -} - -// TableEngine 获取数据使用的引擎. -func (m *WorkWeixinAccount) TableEngine() string { - return "INNODB" -} - -func (m *WorkWeixinAccount) TableNameWithPrefix() string { - return conf.GetDatabasePrefix() + m.TableName() -} - -func NewWorkWeixinAccount() *WorkWeixinAccount { - return &WorkWeixinAccount{} -} - -func (a *WorkWeixinAccount) ExistedMember(workweixin_user_id string) (*Member, error) { - o := orm.NewOrm() - account := NewWorkWeixinAccount() - member := NewMember() - err := o.QueryTable(a.TableNameWithPrefix()).Filter("workweixin_user_id", workweixin_user_id).One(account) - if err == nil { - if member, err = member.Find(account.MemberId); err == nil { - return member, nil - } else { - return member, err - } - } else { - return member, err - } -} - -// Add 添加一个用户. -func (a *WorkWeixinAccount) AddBind(o orm.Ormer) error { - if c, err := o.QueryTable(a.TableNameWithPrefix()).Filter("member_id", a.MemberId).Count(); err == nil && c > 0 { - return errors.New("已绑定,不可重复绑定") - } - - _, err := o.Insert(a) - if err != nil { - logs.Error("保存用户数据到数据时失败 =>", err) - return errors.New("用户信息绑定失败, 数据库错误") - } - - return nil -} diff --git a/routers/router.go b/routers/router.go index f30c8593f..a69961806 100644 --- a/routers/router.go +++ b/routers/router.go @@ -123,12 +123,13 @@ func init() { web.Router("/", &controllers.HomeController{}, "*:Index") web.Router("/login", &controllers.AccountController{}, "*:Login") - web.Router("/dingtalk_login", &controllers.AccountController{}, "*:DingTalkLogin") - web.Router("/workweixin-login", &controllers.AccountController{}, "*:WorkWeixinLogin") - web.Router("/workweixin-callback", &controllers.AccountController{}, "*:WorkWeixinLoginCallback") - web.Router("/workweixin-bind", &controllers.AccountController{}, "*:WorkWeixinLoginBind") - web.Router("/workweixin-ignore", &controllers.AccountController{}, "*:WorkWeixinLoginIgnore") - web.Router("/qrlogin/:app", &controllers.AccountController{}, "*:QRLogin") + web.Router("/auth2/redirect/:app", &controllers.AccountController{}, "*:Auth2Redirect") + web.Router("/auth2/callback/:app", &controllers.AccountController{}, "*:Auth2Callback") + web.Router("/auth2/account/bind/:app", &controllers.AccountController{}, "*:Auth2BindAccount") + web.Router("/auth2/account/auto/:app", &controllers.AccountController{}, "*:Auth2AutoAccount") + + //web.Router("/dingtalk_login", &controllers.AccountController{}, "*:DingTalkLogin") + //web.Router("/qrlogin/:app", &controllers.AccountController{}, "*:QRLogin") web.Router("/logout", &controllers.AccountController{}, "*:Logout") web.Router("/register", &controllers.AccountController{}, "*:Register") web.Router("/find_password", &controllers.AccountController{}, "*:FindPassword") diff --git a/start.sh b/start.sh index 0a9533945..98b4fc7c0 100644 --- a/start.sh +++ b/start.sh @@ -1,36 +1,31 @@ #!/bin/bash set -eux +# 默认资源 +if [ ! -d "/mindoc/conf" ]; then mkdir -p "/mindoc/conf" ; fi +if [[ -z "$(ls -A -- "/mindoc/conf")" ]] ; then cp -r "/mindoc/__default_assets__/conf" "/mindoc/" ; fi + +if [ ! -d "/mindoc/static" ]; then mkdir -p "/mindoc/static" ; fi +if [[ -z "$(ls -A -- "/mindoc/static")" ]] ; then cp -r "/mindoc/__default_assets__/static" "/mindoc/" ; fi + +if [ ! -d "/mindoc/views" ]; then mkdir -p "/mindoc/views" ; fi +if [[ -z "$(ls -A -- "/mindoc/views")" ]] ; then cp -r "/mindoc/__default_assets__/views" "/mindoc/" ; fi + +if [ ! -d "/mindoc/uploads" ]; then mkdir -p "/mindoc/uploads" ; fi +if [[ -z "$(ls -A -- "/mindoc/uploads")" ]] ; then cp -r "/mindoc/__default_assets__/uploads" "/mindoc/" ; fi + +# 如果配置文件不存在就复制 +cp --no-clobber /mindoc/conf/app.conf.example /mindoc/conf/app.conf + # 数据库等初始化 /mindoc/mindoc_linux_amd64 install -# 导出同步检查 -mkdir -p /mindoc-sync-host -if ! [ -f "/mindoc-sync-host/sync.sh" ]; then - # 同步方向: docker->HOST 或 HOST -> docker - # echo "export MINDOC_SYNC=" >> /mindoc-sync-host/sync.sh # 不同步 - echo "export MINDOC_SYNC=docker2host" >> /mindoc-sync-host/sync.sh # 默认 docker->HOST - - # 同步内容 - # conf: 配置 - # database: sqlite方式数据库 - # runtime: 运行时数据(日志等) - # static: 静态文件 - # uploads: 上传文件 - # views: 页面视图 - # echo "export SYNC_LIST='conf;database;runtime;static;uploads;views'" >> /mindoc-sync-host/sync.sh # 同步所有内容 - # echo "export SYNC_LIST=" >> /mindoc-sync-host/sync.sh # 不同步任何内容 - echo "export SYNC_LIST='conf;database;uploads'" >> /mindoc-sync-host/sync.sh # 同步conf、database、uploads - - # 同步操作(sync/copy/sync --dry-run 等,具体参考rclone文档,host2docker务必谨慎操作) - # echo "export SYNC_ACTION=sync --dry-run" >> /mindoc-sync-host/sync.sh # 无操作且仅显示同步文件信息(--dry-run) - echo "export SYNC_ACTION=sync" >> /mindoc-sync-host/sync.sh # 默认同步 - - # 同步脚本 - echo "source /mindoc/sync_host.sh" >> /mindoc-sync-host/sync.sh -fi -# 同步操作 -source /mindoc-sync-host/sync.sh - # 运行 -/mindoc/mindoc_linux_amd64 \ No newline at end of file +/mindoc/mindoc_linux_amd64 + +# # Debug Dockerfile +# while [ 1 ] +# do +# echo "log ..." +# sleep 5s +# done \ No newline at end of file diff --git a/static/cherry/addons/cherry-code-block-mermaid-plugin.d.ts b/static/cherry/addons/cherry-code-block-mermaid-plugin.d.ts new file mode 100644 index 000000000..0c17a69ca --- /dev/null +++ b/static/cherry/addons/cherry-code-block-mermaid-plugin.d.ts @@ -0,0 +1,31 @@ +export default class MermaidCodeEngine { + static TYPE: string; + static install(cherryOptions: any, ...args: any[]): void; + constructor(mermaidOptions?: {}); + mermaidAPIRefs: any; + options: { + theme: string; + altFontFamily: string; + fontFamily: string; + themeCSS: string; + flowchart: { + useMaxWidth: boolean; + }; + sequence: { + useMaxWidth: boolean; + }; + startOnLoad: boolean; + logLevel: number; + }; + dom: any; + mermaidCanvas: any; + mountMermaidCanvas($engine: any): void; + /** + * 转换svg为img,如果出错则直出svg + * @param {string} svgCode + * @param {string} graphId + * @returns {string} + */ + convertMermaidSvgToImg(svgCode: string, graphId: string): string; + render(src: any, sign: any, $engine: any): boolean; +} diff --git a/static/cherry/addons/cherry-code-block-mermaid-plugin.js b/static/cherry/addons/cherry-code-block-mermaid-plugin.js new file mode 100644 index 000000000..dc24e6b8e --- /dev/null +++ b/static/cherry/addons/cherry-code-block-mermaid-plugin.js @@ -0,0 +1 @@ +!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t=t||self).CherryCodeBlockMermaidPlugin=r()}(this,(function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,r){return t(r={exports:{}},r.exports),r.exports}var n,o,i=function(t){return t&&t.Math==Math&&t},a=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof t&&t)||function(){return this}()||Function("return this")(),u=function(t){try{return!!t()}catch(t){return!0}},c=!u((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),f=Function.prototype,s=f.apply,l=f.call,p="object"==typeof Reflect&&Reflect.apply||(c?l.bind(s):function(){return l.apply(s,arguments)}),v=Function.prototype,y=v.bind,d=v.call,h=c&&y.bind(d,d),b=c?function(t){return t&&h(t)}:function(t){return t&&function(){return d.apply(t,arguments)}},m=function(t){return"function"==typeof t},g=!u((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=Function.prototype.call,_=c?w.bind(w):function(){return w.apply(w,arguments)},O={}.propertyIsEnumerable,j=Object.getOwnPropertyDescriptor,S={f:j&&!O.call({1:2},1)?function(t){var r=j(this,t);return!!r&&r.enumerable}:O},P=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}},x=b({}.toString),A=b("".slice),T=function(t){return A(x(t),8,-1)},E=a.Object,F=b("".split),M=u((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==T(t)?F(t,""):E(t)}:E,I=a.TypeError,L=function(t){if(null==t)throw I("Can't call method on "+t);return t},C=function(t){return M(L(t))},k=function(t){return"object"==typeof t?null!==t:m(t)},R={},z=function(t){return m(t)?t:void 0},D=function(t,r){return arguments.length<2?z(R[t])||z(a[t]):R[t]&&R[t][r]||a[t]&&a[t][r]},B=b({}.isPrototypeOf),N=D("navigator","userAgent")||"",G=a.process,U=a.Deno,V=G&&G.versions||U&&U.version,$=V&&V.v8;$&&(o=(n=$.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&N&&(!(n=N.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=N.match(/Chrome\/(\d+)/))&&(o=+n[1]);var W=o,q=!!Object.getOwnPropertySymbols&&!u((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&W&&W<41})),H=q&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=a.Object,J=H?function(t){return"symbol"==typeof t}:function(t){var r=D("Symbol");return m(r)&&B(r.prototype,Y(t))},X=a.String,K=function(t){try{return X(t)}catch(t){return"Object"}},Q=a.TypeError,Z=function(t){if(m(t))return t;throw Q(K(t)+" is not a function")},tt=a.TypeError,rt=Object.defineProperty,et=a["__core-js_shared__"]||function(t,r){try{rt(a,t,{value:r,configurable:!0,writable:!0})}catch(e){a[t]=r}return r}("__core-js_shared__",{}),nt=e((function(t){(t.exports=function(t,r){return et[t]||(et[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.22.6",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.22.6/LICENSE",source:"https://github.com/zloirock/core-js"})})),ot=a.Object,it=function(t){return ot(L(t))},at=b({}.hasOwnProperty),ut=Object.hasOwn||function(t,r){return at(it(t),r)},ct=0,ft=Math.random(),st=b(1..toString),lt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+st(++ct+ft,36)},pt=nt("wks"),vt=a.Symbol,yt=vt&&vt.for,dt=H?vt:vt&&vt.withoutSetter||lt,ht=function(t){if(!ut(pt,t)||!q&&"string"!=typeof pt[t]){var r="Symbol."+t;q&&ut(vt,t)?pt[t]=vt[t]:pt[t]=H&&yt?yt(r):dt(r)}return pt[t]},bt=a.TypeError,mt=ht("toPrimitive"),gt=function(t,r){if(!k(t)||J(t))return t;var e,n,o=null==(e=t[mt])?void 0:Z(e);if(o){if(void 0===r&&(r="default"),n=_(o,t,r),!k(n)||J(n))return n;throw bt("Can't convert object to primitive value")}return void 0===r&&(r="number"),function(t,r){var e,n;if("string"===r&&m(e=t.toString)&&!k(n=_(e,t)))return n;if(m(e=t.valueOf)&&!k(n=_(e,t)))return n;if("string"!==r&&m(e=t.toString)&&!k(n=_(e,t)))return n;throw tt("Can't convert object to primitive value")}(t,r)},wt=function(t){var r=gt(t,"string");return J(r)?r:r+""},_t=a.document,Ot=k(_t)&&k(_t.createElement),jt=function(t){return Ot?_t.createElement(t):{}},St=!g&&!u((function(){return 7!=Object.defineProperty(jt("div"),"a",{get:function(){return 7}}).a})),Pt=Object.getOwnPropertyDescriptor,xt={f:g?Pt:function(t,r){if(t=C(t),r=wt(r),St)try{return Pt(t,r)}catch(t){}if(ut(t,r))return P(!_(S.f,t,r),t[r])}},At=/#|\.prototype\./,Tt=function(t,r){var e=Ft[Et(t)];return e==It||e!=Mt&&(m(r)?u(r):!!r)},Et=Tt.normalize=function(t){return String(t).replace(At,".").toLowerCase()},Ft=Tt.data={},Mt=Tt.NATIVE="N",It=Tt.POLYFILL="P",Lt=Tt,Ct=b(b.bind),kt=function(t,r){return Z(t),void 0===r?t:c?Ct(t,r):function(){return t.apply(r,arguments)}},Rt=g&&u((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),zt=a.String,Dt=a.TypeError,Bt=function(t){if(k(t))return t;throw Dt(zt(t)+" is not an object")},Nt=a.TypeError,Gt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,Vt={f:g?Rt?function(t,r,e){if(Bt(t),r=wt(r),Bt(e),"function"==typeof t&&"prototype"===r&&"value"in e&&"writable"in e&&!e.writable){var n=Ut(t,r);n&&n.writable&&(t[r]=e.value,e={configurable:"configurable"in e?e.configurable:n.configurable,enumerable:"enumerable"in e?e.enumerable:n.enumerable,writable:!1})}return Gt(t,r,e)}:Gt:function(t,r,e){if(Bt(t),r=wt(r),Bt(e),St)try{return Gt(t,r,e)}catch(t){}if("get"in e||"set"in e)throw Nt("Accessors not supported");return"value"in e&&(t[r]=e.value),t}},$t=g?function(t,r,e){return Vt.f(t,r,P(1,e))}:function(t,r,e){return t[r]=e,t},Wt=xt.f,qt=function(t){var r=function(e,n,o){if(this instanceof r){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,o)}return p(t,this,arguments)};return r.prototype=t.prototype,r},Ht=function(t,r){var e,n,o,i,u,c,f,s,l=t.target,p=t.global,v=t.stat,y=t.proto,d=p?a:v?a[l]:(a[l]||{}).prototype,h=p?R:R[l]||$t(R,l,{})[l],g=h.prototype;for(o in r)e=!Lt(p?o:l+(v?".":"#")+o,t.forced)&&d&&ut(d,o),u=h[o],e&&(c=t.dontCallGetSet?(s=Wt(d,o))&&s.value:d[o]),i=e&&c?c:r[o],e&&typeof u==typeof i||(f=t.bind&&e?kt(i,a):t.wrap&&e?qt(i):y&&m(i)?b(i):i,(t.sham||i&&i.sham||u&&u.sham)&&$t(f,"sham",!0),$t(h,o,f),y&&(ut(R,n=l+"Prototype")||$t(R,n,{}),$t(R[n],o,i),t.real&&g&&!g[o]&&$t(g,o,i)))},Yt=Math.ceil,Jt=Math.floor,Xt=Math.trunc||function(t){var r=+t;return(r>0?Jt:Yt)(r)},Kt=function(t){var r=+t;return r!=r||0===r?0:Xt(r)},Qt=Math.max,Zt=Math.min,tr=function(t,r){var e=Kt(t);return e<0?Qt(e+r,0):Zt(e,r)},rr=Math.min,er=function(t){return(r=t.length)>0?rr(Kt(r),9007199254740991):0;var r},nr=function(t){return function(r,e,n){var o,i=C(r),a=er(i),u=tr(n,a);if(t&&e!=e){for(;a>u;)if((o=i[u++])!=o)return!0}else for(;a>u;u++)if((t||u in i)&&i[u]===e)return t||u||0;return!t&&-1}},or={includes:nr(!0),indexOf:nr(!1)},ir={},ar=or.indexOf,ur=b([].push),cr=function(t,r){var e,n=C(t),o=0,i=[];for(e in n)!ut(ir,e)&&ut(n,e)&&ur(i,e);for(;r.length>o;)ut(n,e=r[o++])&&(~ar(i,e)||ur(i,e));return i},fr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],sr=Object.keys||function(t){return cr(t,fr)},lr=u((function(){sr(1)}));Ht({target:"Object",stat:!0,forced:lr},{keys:function(t){return sr(it(t))}});var pr=R.Object.keys,vr={};vr[ht("toStringTag")]="z";var yr,dr="[object z]"===String(vr),hr=ht("toStringTag"),br=a.Object,mr="Arguments"==T(function(){return arguments}()),gr=dr?T:function(t){var r,e,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,r){try{return t[r]}catch(t){}}(r=br(t),hr))?e:mr?T(r):"Object"==(n=T(r))&&m(r.callee)?"Arguments":n},wr=a.String,_r=function(t){if("Symbol"===gr(t))throw TypeError("Cannot convert a Symbol value to a string");return wr(t)},Or={f:g&&!Rt?Object.defineProperties:function(t,r){Bt(t);for(var e,n=C(r),o=sr(r),i=o.length,a=0;i>a;)Vt.f(t,e=o[a++],n[e]);return t}},jr=D("document","documentElement"),Sr=nt("keys"),Pr=function(t){return Sr[t]||(Sr[t]=lt(t))},xr=Pr("IE_PROTO"),Ar=function(){},Tr=function(t){return"`. + this.sequenceIndex = Number(c === CharCodes.Lt); + } + } + stateCDATASequence(c) { + if (c === Sequences.Cdata[this.sequenceIndex]) { + if (++this.sequenceIndex === Sequences.Cdata.length) { + this.state = State$2.InCommentLike; + this.currentSequence = Sequences.CdataEnd; + this.sequenceIndex = 0; + this.sectionStart = this.index + 1; + } + } + else { + this.sequenceIndex = 0; + this.state = State$2.InDeclaration; + this.stateInDeclaration(c); // Reconsume the character + } + } + /** + * When we wait for one specific character, we can speed things up + * by skipping through the buffer until we find it. + * + * @returns Whether the character was found. + */ + fastForwardTo(c) { + while (++this.index < this.buffer.length + this.offset) { + if (this.buffer.charCodeAt(this.index - this.offset) === c) { + return true; + } + } + /* + * We increment the index at the end of the `parse` loop, + * so set it to `buffer.length - 1` here. + * + * TODO: Refactor `parse` to increment index before calling states. + */ + this.index = this.buffer.length + this.offset - 1; + return false; + } + /** + * Comments and CDATA end with `-->` and `]]>`. + * + * Their common qualities are: + * - Their end sequences have a distinct character they start with. + * - That character is then repeated, so we have to check multiple repeats. + * - All characters but the start character of the sequence can be skipped. + */ + stateInCommentLike(c) { + if (c === this.currentSequence[this.sequenceIndex]) { + if (++this.sequenceIndex === this.currentSequence.length) { + if (this.currentSequence === Sequences.CdataEnd) { + this.cbs.oncdata(this.sectionStart, this.index, 2); + } + else { + this.cbs.oncomment(this.sectionStart, this.index, 2); + } + this.sequenceIndex = 0; + this.sectionStart = this.index + 1; + this.state = State$2.Text; + } + } + else if (this.sequenceIndex === 0) { + // Fast-forward to the first character of the sequence + if (this.fastForwardTo(this.currentSequence[0])) { + this.sequenceIndex = 1; + } + } + else if (c !== this.currentSequence[this.sequenceIndex - 1]) { + // Allow long sequences, eg. --->, ]]]> + this.sequenceIndex = 0; + } + } + /** + * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name. + * + * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar). + * We allow anything that wouldn't end the tag. + */ + isTagStartChar(c) { + return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c); + } + startSpecial(sequence, offset) { + this.isSpecial = true; + this.currentSequence = sequence; + this.sequenceIndex = offset; + this.state = State$2.SpecialStartSequence; + } + stateBeforeTagName(c) { + if (c === CharCodes.ExclamationMark) { + this.state = State$2.BeforeDeclaration; + this.sectionStart = this.index + 1; + } + else if (c === CharCodes.Questionmark) { + this.state = State$2.InProcessingInstruction; + this.sectionStart = this.index + 1; + } + else if (this.isTagStartChar(c)) { + const lower = c | 0x20; + this.sectionStart = this.index; + if (!this.xmlMode && lower === Sequences.TitleEnd[2]) { + this.startSpecial(Sequences.TitleEnd, 3); + } + else { + this.state = + !this.xmlMode && lower === Sequences.ScriptEnd[2] + ? State$2.BeforeSpecialS + : State$2.InTagName; + } + } + else if (c === CharCodes.Slash) { + this.state = State$2.BeforeClosingTagName; + } + else { + this.state = State$2.Text; + this.stateText(c); + } + } + stateInTagName(c) { + if (isEndOfTagSection(c)) { + this.cbs.onopentagname(this.sectionStart, this.index); + this.sectionStart = -1; + this.state = State$2.BeforeAttributeName; + this.stateBeforeAttributeName(c); + } + } + stateBeforeClosingTagName(c) { + if (isWhitespace$2(c)) ; + else if (c === CharCodes.Gt) { + this.state = State$2.Text; + } + else { + this.state = this.isTagStartChar(c) + ? State$2.InClosingTagName + : State$2.InSpecialComment; + this.sectionStart = this.index; + } + } + stateInClosingTagName(c) { + if (c === CharCodes.Gt || isWhitespace$2(c)) { + this.cbs.onclosetag(this.sectionStart, this.index); + this.sectionStart = -1; + this.state = State$2.AfterClosingTagName; + this.stateAfterClosingTagName(c); + } + } + stateAfterClosingTagName(c) { + // Skip everything until ">" + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.state = State$2.Text; + this.sectionStart = this.index + 1; + } + } + stateBeforeAttributeName(c) { + if (c === CharCodes.Gt) { + this.cbs.onopentagend(this.index); + if (this.isSpecial) { + this.state = State$2.InSpecialTag; + this.sequenceIndex = 0; + } + else { + this.state = State$2.Text; + } + this.baseState = this.state; + this.sectionStart = this.index + 1; + } + else if (c === CharCodes.Slash) { + this.state = State$2.InSelfClosingTag; + } + else if (!isWhitespace$2(c)) { + this.state = State$2.InAttributeName; + this.sectionStart = this.index; + } + } + stateInSelfClosingTag(c) { + if (c === CharCodes.Gt) { + this.cbs.onselfclosingtag(this.index); + this.state = State$2.Text; + this.baseState = State$2.Text; + this.sectionStart = this.index + 1; + this.isSpecial = false; // Reset special state, in case of self-closing special tags + } + else if (!isWhitespace$2(c)) { + this.state = State$2.BeforeAttributeName; + this.stateBeforeAttributeName(c); + } + } + stateInAttributeName(c) { + if (c === CharCodes.Eq || isEndOfTagSection(c)) { + this.cbs.onattribname(this.sectionStart, this.index); + this.sectionStart = -1; + this.state = State$2.AfterAttributeName; + this.stateAfterAttributeName(c); + } + } + stateAfterAttributeName(c) { + if (c === CharCodes.Eq) { + this.state = State$2.BeforeAttributeValue; + } + else if (c === CharCodes.Slash || c === CharCodes.Gt) { + this.cbs.onattribend(QuoteType.NoValue, this.index); + this.state = State$2.BeforeAttributeName; + this.stateBeforeAttributeName(c); + } + else if (!isWhitespace$2(c)) { + this.cbs.onattribend(QuoteType.NoValue, this.index); + this.state = State$2.InAttributeName; + this.sectionStart = this.index; + } + } + stateBeforeAttributeValue(c) { + if (c === CharCodes.DoubleQuote) { + this.state = State$2.InAttributeValueDq; + this.sectionStart = this.index + 1; + } + else if (c === CharCodes.SingleQuote) { + this.state = State$2.InAttributeValueSq; + this.sectionStart = this.index + 1; + } + else if (!isWhitespace$2(c)) { + this.sectionStart = this.index; + this.state = State$2.InAttributeValueNq; + this.stateInAttributeValueNoQuotes(c); // Reconsume token + } + } + handleInAttributeValue(c, quote) { + if (c === quote || + (!this.decodeEntities && this.fastForwardTo(quote))) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = -1; + this.cbs.onattribend(quote === CharCodes.DoubleQuote + ? QuoteType.Double + : QuoteType.Single, this.index); + this.state = State$2.BeforeAttributeName; + } + else if (this.decodeEntities && c === CharCodes.Amp) { + this.baseState = this.state; + this.state = State$2.BeforeEntity; + } + } + stateInAttributeValueDoubleQuotes(c) { + this.handleInAttributeValue(c, CharCodes.DoubleQuote); + } + stateInAttributeValueSingleQuotes(c) { + this.handleInAttributeValue(c, CharCodes.SingleQuote); + } + stateInAttributeValueNoQuotes(c) { + if (isWhitespace$2(c) || c === CharCodes.Gt) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = -1; + this.cbs.onattribend(QuoteType.Unquoted, this.index); + this.state = State$2.BeforeAttributeName; + this.stateBeforeAttributeName(c); + } + else if (this.decodeEntities && c === CharCodes.Amp) { + this.baseState = this.state; + this.state = State$2.BeforeEntity; + } + } + stateBeforeDeclaration(c) { + if (c === CharCodes.OpeningSquareBracket) { + this.state = State$2.CDATASequence; + this.sequenceIndex = 0; + } + else { + this.state = + c === CharCodes.Dash + ? State$2.BeforeComment + : State$2.InDeclaration; + } + } + stateInDeclaration(c) { + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.ondeclaration(this.sectionStart, this.index); + this.state = State$2.Text; + this.sectionStart = this.index + 1; + } + } + stateInProcessingInstruction(c) { + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.onprocessinginstruction(this.sectionStart, this.index); + this.state = State$2.Text; + this.sectionStart = this.index + 1; + } + } + stateBeforeComment(c) { + if (c === CharCodes.Dash) { + this.state = State$2.InCommentLike; + this.currentSequence = Sequences.CommentEnd; + // Allow short comments (eg. ) + this.sequenceIndex = 2; + this.sectionStart = this.index + 1; + } + else { + this.state = State$2.InDeclaration; + } + } + stateInSpecialComment(c) { + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.oncomment(this.sectionStart, this.index, 0); + this.state = State$2.Text; + this.sectionStart = this.index + 1; + } + } + stateBeforeSpecialS(c) { + const lower = c | 0x20; + if (lower === Sequences.ScriptEnd[3]) { + this.startSpecial(Sequences.ScriptEnd, 4); + } + else if (lower === Sequences.StyleEnd[3]) { + this.startSpecial(Sequences.StyleEnd, 4); + } + else { + this.state = State$2.InTagName; + this.stateInTagName(c); // Consume the token again + } + } + stateBeforeEntity(c) { + // Start excess with 1 to include the '&' + this.entityExcess = 1; + this.entityResult = 0; + if (c === CharCodes.Num) { + this.state = State$2.BeforeNumericEntity; + } + else if (c === CharCodes.Amp) ; + else { + this.trieIndex = 0; + this.trieCurrent = this.entityTrie[0]; + this.state = State$2.InNamedEntity; + this.stateInNamedEntity(c); + } + } + stateInNamedEntity(c) { + this.entityExcess += 1; + this.trieIndex = decode_4(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c); + if (this.trieIndex < 0) { + this.emitNamedEntity(); + this.index--; + return; + } + this.trieCurrent = this.entityTrie[this.trieIndex]; + const masked = this.trieCurrent & decode_5.VALUE_LENGTH; + // If the branch is a value, store it and continue + if (masked) { + // The mask is the number of bytes of the value, including the current byte. + const valueLength = (masked >> 14) - 1; + // If we have a legacy entity while parsing strictly, just skip the number of bytes + if (!this.allowLegacyEntity() && c !== CharCodes.Semi) { + this.trieIndex += valueLength; + } + else { + // Add 1 as we have already incremented the excess + const entityStart = this.index - this.entityExcess + 1; + if (entityStart > this.sectionStart) { + this.emitPartial(this.sectionStart, entityStart); + } + // If this is a surrogate pair, consume the next two bytes + this.entityResult = this.trieIndex; + this.trieIndex += valueLength; + this.entityExcess = 0; + this.sectionStart = this.index + 1; + if (valueLength === 0) { + this.emitNamedEntity(); + } + } + } + } + emitNamedEntity() { + this.state = this.baseState; + if (this.entityResult === 0) { + return; + } + const valueLength = (this.entityTrie[this.entityResult] & decode_5.VALUE_LENGTH) >> + 14; + switch (valueLength) { + case 1: + this.emitCodePoint(this.entityTrie[this.entityResult] & + ~decode_5.VALUE_LENGTH); + break; + case 2: + this.emitCodePoint(this.entityTrie[this.entityResult + 1]); + break; + case 3: { + this.emitCodePoint(this.entityTrie[this.entityResult + 1]); + this.emitCodePoint(this.entityTrie[this.entityResult + 2]); + } + } + } + stateBeforeNumericEntity(c) { + if ((c | 0x20) === CharCodes.LowerX) { + this.entityExcess++; + this.state = State$2.InHexEntity; + } + else { + this.state = State$2.InNumericEntity; + this.stateInNumericEntity(c); + } + } + emitNumericEntity(strict) { + const entityStart = this.index - this.entityExcess - 1; + const numberStart = entityStart + 2 + Number(this.state === State$2.InHexEntity); + if (numberStart !== this.index) { + // Emit leading data if any + if (entityStart > this.sectionStart) { + this.emitPartial(this.sectionStart, entityStart); + } + this.sectionStart = this.index + Number(strict); + this.emitCodePoint(decode_7(this.entityResult)); + } + this.state = this.baseState; + } + stateInNumericEntity(c) { + if (c === CharCodes.Semi) { + this.emitNumericEntity(true); + } + else if (isNumber$1(c)) { + this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero); + this.entityExcess++; + } + else { + if (this.allowLegacyEntity()) { + this.emitNumericEntity(false); + } + else { + this.state = this.baseState; + } + this.index--; + } + } + stateInHexEntity(c) { + if (c === CharCodes.Semi) { + this.emitNumericEntity(true); + } + else if (isNumber$1(c)) { + this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero); + this.entityExcess++; + } + else if (isHexDigit(c)) { + this.entityResult = + this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10); + this.entityExcess++; + } + else { + if (this.allowLegacyEntity()) { + this.emitNumericEntity(false); + } + else { + this.state = this.baseState; + } + this.index--; + } + } + allowLegacyEntity() { + return (!this.xmlMode && + (this.baseState === State$2.Text || + this.baseState === State$2.InSpecialTag)); + } + /** + * Remove data that has already been consumed from the buffer. + */ + cleanup() { + // If we are inside of text or attributes, emit what we already have. + if (this.running && this.sectionStart !== this.index) { + if (this.state === State$2.Text || + (this.state === State$2.InSpecialTag && this.sequenceIndex === 0)) { + this.cbs.ontext(this.sectionStart, this.index); + this.sectionStart = this.index; + } + else if (this.state === State$2.InAttributeValueDq || + this.state === State$2.InAttributeValueSq || + this.state === State$2.InAttributeValueNq) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = this.index; + } + } + } + shouldContinue() { + return this.index < this.buffer.length + this.offset && this.running; + } + /** + * Iterates through the buffer, calling the function corresponding to the current state. + * + * States that are more likely to be hit are higher up, as a performance improvement. + */ + parse() { + while (this.shouldContinue()) { + const c = this.buffer.charCodeAt(this.index - this.offset); + if (this.state === State$2.Text) { + this.stateText(c); + } + else if (this.state === State$2.SpecialStartSequence) { + this.stateSpecialStartSequence(c); + } + else if (this.state === State$2.InSpecialTag) { + this.stateInSpecialTag(c); + } + else if (this.state === State$2.CDATASequence) { + this.stateCDATASequence(c); + } + else if (this.state === State$2.InAttributeValueDq) { + this.stateInAttributeValueDoubleQuotes(c); + } + else if (this.state === State$2.InAttributeName) { + this.stateInAttributeName(c); + } + else if (this.state === State$2.InCommentLike) { + this.stateInCommentLike(c); + } + else if (this.state === State$2.InSpecialComment) { + this.stateInSpecialComment(c); + } + else if (this.state === State$2.BeforeAttributeName) { + this.stateBeforeAttributeName(c); + } + else if (this.state === State$2.InTagName) { + this.stateInTagName(c); + } + else if (this.state === State$2.InClosingTagName) { + this.stateInClosingTagName(c); + } + else if (this.state === State$2.BeforeTagName) { + this.stateBeforeTagName(c); + } + else if (this.state === State$2.AfterAttributeName) { + this.stateAfterAttributeName(c); + } + else if (this.state === State$2.InAttributeValueSq) { + this.stateInAttributeValueSingleQuotes(c); + } + else if (this.state === State$2.BeforeAttributeValue) { + this.stateBeforeAttributeValue(c); + } + else if (this.state === State$2.BeforeClosingTagName) { + this.stateBeforeClosingTagName(c); + } + else if (this.state === State$2.AfterClosingTagName) { + this.stateAfterClosingTagName(c); + } + else if (this.state === State$2.BeforeSpecialS) { + this.stateBeforeSpecialS(c); + } + else if (this.state === State$2.InAttributeValueNq) { + this.stateInAttributeValueNoQuotes(c); + } + else if (this.state === State$2.InSelfClosingTag) { + this.stateInSelfClosingTag(c); + } + else if (this.state === State$2.InDeclaration) { + this.stateInDeclaration(c); + } + else if (this.state === State$2.BeforeDeclaration) { + this.stateBeforeDeclaration(c); + } + else if (this.state === State$2.BeforeComment) { + this.stateBeforeComment(c); + } + else if (this.state === State$2.InProcessingInstruction) { + this.stateInProcessingInstruction(c); + } + else if (this.state === State$2.InNamedEntity) { + this.stateInNamedEntity(c); + } + else if (this.state === State$2.BeforeEntity) { + this.stateBeforeEntity(c); + } + else if (this.state === State$2.InHexEntity) { + this.stateInHexEntity(c); + } + else if (this.state === State$2.InNumericEntity) { + this.stateInNumericEntity(c); + } + else { + // `this._state === State.BeforeNumericEntity` + this.stateBeforeNumericEntity(c); + } + this.index++; + } + this.cleanup(); + } + finish() { + if (this.state === State$2.InNamedEntity) { + this.emitNamedEntity(); + } + // If there is remaining data, emit it in a reasonable way + if (this.sectionStart < this.index) { + this.handleTrailingData(); + } + this.cbs.onend(); + } + /** Handle any trailing data. */ + handleTrailingData() { + const endIndex = this.buffer.length + this.offset; + if (this.state === State$2.InCommentLike) { + if (this.currentSequence === Sequences.CdataEnd) { + this.cbs.oncdata(this.sectionStart, endIndex, 0); + } + else { + this.cbs.oncomment(this.sectionStart, endIndex, 0); + } + } + else if (this.state === State$2.InNumericEntity && + this.allowLegacyEntity()) { + this.emitNumericEntity(false); + // All trailing data will have been consumed + } + else if (this.state === State$2.InHexEntity && + this.allowLegacyEntity()) { + this.emitNumericEntity(false); + // All trailing data will have been consumed + } + else if (this.state === State$2.InTagName || + this.state === State$2.BeforeAttributeName || + this.state === State$2.BeforeAttributeValue || + this.state === State$2.AfterAttributeName || + this.state === State$2.InAttributeName || + this.state === State$2.InAttributeValueSq || + this.state === State$2.InAttributeValueDq || + this.state === State$2.InAttributeValueNq || + this.state === State$2.InClosingTagName) ; + else { + this.cbs.ontext(this.sectionStart, endIndex); + } + } + emitPartial(start, endIndex) { + if (this.baseState !== State$2.Text && + this.baseState !== State$2.InSpecialTag) { + this.cbs.onattribdata(start, endIndex); + } + else { + this.cbs.ontext(start, endIndex); + } + } + emitCodePoint(cp) { + if (this.baseState !== State$2.Text && + this.baseState !== State$2.InSpecialTag) { + this.cbs.onattribentity(cp); + } + else { + this.cbs.ontextentity(cp); + } + } + } + + const formTags = new Set([ + "input", + "option", + "optgroup", + "select", + "button", + "datalist", + "textarea", + ]); + const pTag = new Set(["p"]); + const tableSectionTags = new Set(["thead", "tbody"]); + const ddtTags = new Set(["dd", "dt"]); + const rtpTags = new Set(["rt", "rp"]); + const openImpliesClose = new Map([ + ["tr", new Set(["tr", "th", "td"])], + ["th", new Set(["th"])], + ["td", new Set(["thead", "th", "td"])], + ["body", new Set(["head", "link", "script"])], + ["li", new Set(["li"])], + ["p", pTag], + ["h1", pTag], + ["h2", pTag], + ["h3", pTag], + ["h4", pTag], + ["h5", pTag], + ["h6", pTag], + ["select", formTags], + ["input", formTags], + ["output", formTags], + ["button", formTags], + ["datalist", formTags], + ["textarea", formTags], + ["option", new Set(["option"])], + ["optgroup", new Set(["optgroup", "option"])], + ["dd", ddtTags], + ["dt", ddtTags], + ["address", pTag], + ["article", pTag], + ["aside", pTag], + ["blockquote", pTag], + ["details", pTag], + ["div", pTag], + ["dl", pTag], + ["fieldset", pTag], + ["figcaption", pTag], + ["figure", pTag], + ["footer", pTag], + ["form", pTag], + ["header", pTag], + ["hr", pTag], + ["main", pTag], + ["nav", pTag], + ["ol", pTag], + ["pre", pTag], + ["section", pTag], + ["table", pTag], + ["ul", pTag], + ["rt", rtpTags], + ["rp", rtpTags], + ["tbody", tableSectionTags], + ["tfoot", tableSectionTags], + ]); + const voidElements = new Set([ + "area", + "base", + "basefont", + "br", + "col", + "command", + "embed", + "frame", + "hr", + "img", + "input", + "isindex", + "keygen", + "link", + "meta", + "param", + "source", + "track", + "wbr", + ]); + const foreignContextElements = new Set(["math", "svg"]); + const htmlIntegrationElements = new Set([ + "mi", + "mo", + "mn", + "ms", + "mtext", + "annotation-xml", + "foreignobject", + "desc", + "title", + ]); + const reNameEnd = /\s|\//; + class Parser$1 { + constructor(cbs, options = {}) { + var _a, _b, _c, _d, _e; + this.options = options; + /** The start index of the last event. */ + this.startIndex = 0; + /** The end index of the last event. */ + this.endIndex = 0; + /** + * Store the start index of the current open tag, + * so we can update the start index for attributes. + */ + this.openTagStart = 0; + this.tagname = ""; + this.attribname = ""; + this.attribvalue = ""; + this.attribs = null; + this.stack = []; + this.foreignContext = []; + this.buffers = []; + this.bufferOffset = 0; + /** The index of the last written buffer. Used when resuming after a `pause()`. */ + this.writeIndex = 0; + /** Indicates whether the parser has finished running / `.end` has been called. */ + this.ended = false; + this.cbs = cbs !== null && cbs !== void 0 ? cbs : {}; + this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode; + this.lowerCaseAttributeNames = + (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode; + this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer$1)(this.options, this); + (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this); + } + // Tokenizer event handlers + /** @internal */ + ontext(start, endIndex) { + var _a, _b; + const data = this.getSlice(start, endIndex); + this.endIndex = endIndex - 1; + (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data); + this.startIndex = endIndex; + } + /** @internal */ + ontextentity(cp) { + var _a, _b; + /* + * Entities can be emitted on the character, or directly after. + * We use the section start here to get accurate indices. + */ + const idx = this.tokenizer.getSectionStart(); + this.endIndex = idx - 1; + (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, decode_6(cp)); + this.startIndex = idx; + } + isVoidElement(name) { + return !this.options.xmlMode && voidElements.has(name); + } + /** @internal */ + onopentagname(start, endIndex) { + this.endIndex = endIndex; + let name = this.getSlice(start, endIndex); + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); + } + this.emitOpenTag(name); + } + emitOpenTag(name) { + var _a, _b, _c, _d; + this.openTagStart = this.startIndex; + this.tagname = name; + const impliesClose = !this.options.xmlMode && openImpliesClose.get(name); + if (impliesClose) { + while (this.stack.length > 0 && + impliesClose.has(this.stack[this.stack.length - 1])) { + const el = this.stack.pop(); + (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, el, true); + } + } + if (!this.isVoidElement(name)) { + this.stack.push(name); + if (foreignContextElements.has(name)) { + this.foreignContext.push(true); + } + else if (htmlIntegrationElements.has(name)) { + this.foreignContext.push(false); + } + } + (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name); + if (this.cbs.onopentag) + this.attribs = {}; + } + endOpenTag(isImplied) { + var _a, _b; + this.startIndex = this.openTagStart; + if (this.attribs) { + (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs, isImplied); + this.attribs = null; + } + if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) { + this.cbs.onclosetag(this.tagname, true); + } + this.tagname = ""; + } + /** @internal */ + onopentagend(endIndex) { + this.endIndex = endIndex; + this.endOpenTag(false); + // Set `startIndex` for next node + this.startIndex = endIndex + 1; + } + /** @internal */ + onclosetag(start, endIndex) { + var _a, _b, _c, _d, _e, _f; + this.endIndex = endIndex; + let name = this.getSlice(start, endIndex); + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); + } + if (foreignContextElements.has(name) || + htmlIntegrationElements.has(name)) { + this.foreignContext.pop(); + } + if (!this.isVoidElement(name)) { + const pos = this.stack.lastIndexOf(name); + if (pos !== -1) { + if (this.cbs.onclosetag) { + let count = this.stack.length - pos; + while (count--) { + // We know the stack has sufficient elements. + this.cbs.onclosetag(this.stack.pop(), count !== 0); + } + } + else + this.stack.length = pos; + } + else if (!this.options.xmlMode && name === "p") { + // Implicit open before close + this.emitOpenTag("p"); + this.closeCurrentTag(true); + } + } + else if (!this.options.xmlMode && name === "br") { + // We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed. + (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, "br"); + (_d = (_c = this.cbs).onopentag) === null || _d === void 0 ? void 0 : _d.call(_c, "br", {}, true); + (_f = (_e = this.cbs).onclosetag) === null || _f === void 0 ? void 0 : _f.call(_e, "br", false); + } + // Set `startIndex` for next node + this.startIndex = endIndex + 1; + } + /** @internal */ + onselfclosingtag(endIndex) { + this.endIndex = endIndex; + if (this.options.xmlMode || + this.options.recognizeSelfClosing || + this.foreignContext[this.foreignContext.length - 1]) { + this.closeCurrentTag(false); + // Set `startIndex` for next node + this.startIndex = endIndex + 1; + } + else { + // Ignore the fact that the tag is self-closing. + this.onopentagend(endIndex); + } + } + closeCurrentTag(isOpenImplied) { + var _a, _b; + const name = this.tagname; + this.endOpenTag(isOpenImplied); + // Self-closing tags will be on the top of the stack + if (this.stack[this.stack.length - 1] === name) { + // If the opening tag isn't implied, the closing tag has to be implied. + (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name, !isOpenImplied); + this.stack.pop(); + } + } + /** @internal */ + onattribname(start, endIndex) { + this.startIndex = start; + const name = this.getSlice(start, endIndex); + this.attribname = this.lowerCaseAttributeNames + ? name.toLowerCase() + : name; + } + /** @internal */ + onattribdata(start, endIndex) { + this.attribvalue += this.getSlice(start, endIndex); + } + /** @internal */ + onattribentity(cp) { + this.attribvalue += decode_6(cp); + } + /** @internal */ + onattribend(quote, endIndex) { + var _a, _b; + this.endIndex = endIndex; + (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote === QuoteType.Double + ? '"' + : quote === QuoteType.Single + ? "'" + : quote === QuoteType.NoValue + ? undefined + : null); + if (this.attribs && + !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) { + this.attribs[this.attribname] = this.attribvalue; + } + this.attribvalue = ""; + } + getInstructionName(value) { + const idx = value.search(reNameEnd); + let name = idx < 0 ? value : value.substr(0, idx); + if (this.lowerCaseTagNames) { + name = name.toLowerCase(); + } + return name; + } + /** @internal */ + ondeclaration(start, endIndex) { + this.endIndex = endIndex; + const value = this.getSlice(start, endIndex); + if (this.cbs.onprocessinginstruction) { + const name = this.getInstructionName(value); + this.cbs.onprocessinginstruction(`!${name}`, `!${value}`); + } + // Set `startIndex` for next node + this.startIndex = endIndex + 1; + } + /** @internal */ + onprocessinginstruction(start, endIndex) { + this.endIndex = endIndex; + const value = this.getSlice(start, endIndex); + if (this.cbs.onprocessinginstruction) { + const name = this.getInstructionName(value); + this.cbs.onprocessinginstruction(`?${name}`, `?${value}`); + } + // Set `startIndex` for next node + this.startIndex = endIndex + 1; + } + /** @internal */ + oncomment(start, endIndex, offset) { + var _a, _b, _c, _d; + this.endIndex = endIndex; + (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, this.getSlice(start, endIndex - offset)); + (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c); + // Set `startIndex` for next node + this.startIndex = endIndex + 1; + } + /** @internal */ + oncdata(start, endIndex, offset) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + this.endIndex = endIndex; + const value = this.getSlice(start, endIndex - offset); + if (this.options.xmlMode || this.options.recognizeCDATA) { + (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a); + (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value); + (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e); + } + else { + (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`); + (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j); + } + // Set `startIndex` for next node + this.startIndex = endIndex + 1; + } + /** @internal */ + onend() { + var _a, _b; + if (this.cbs.onclosetag) { + // Set the end index for all remaining tags + this.endIndex = this.startIndex; + for (let i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i], true)) + ; + } + (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a); + } + /** + * Resets the parser to a blank state, ready to parse a new HTML document + */ + reset() { + var _a, _b, _c, _d; + (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a); + this.tokenizer.reset(); + this.tagname = ""; + this.attribname = ""; + this.attribs = null; + this.stack.length = 0; + this.startIndex = 0; + this.endIndex = 0; + (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this); + this.buffers.length = 0; + this.bufferOffset = 0; + this.writeIndex = 0; + this.ended = false; + } + /** + * Resets the parser, then parses a complete document and + * pushes it to the handler. + * + * @param data Document to parse. + */ + parseComplete(data) { + this.reset(); + this.end(data); + } + getSlice(start, end) { + while (start - this.bufferOffset >= this.buffers[0].length) { + this.shiftBuffer(); + } + let str = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset); + while (end - this.bufferOffset > this.buffers[0].length) { + this.shiftBuffer(); + str += this.buffers[0].slice(0, end - this.bufferOffset); + } + return str; + } + shiftBuffer() { + this.bufferOffset += this.buffers[0].length; + this.writeIndex--; + this.buffers.shift(); + } + /** + * Parses a chunk of data and calls the corresponding callbacks. + * + * @param chunk Chunk to parse. + */ + write(chunk) { + var _a, _b; + if (this.ended) { + (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(".write() after done!")); + return; + } + this.buffers.push(chunk); + if (this.tokenizer.running) { + this.tokenizer.write(chunk); + this.writeIndex++; + } + } + /** + * Parses the end of the buffer and clears the stack, calls onend. + * + * @param chunk Optional final chunk to parse. + */ + end(chunk) { + var _a, _b; + if (this.ended) { + (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, Error(".end() after done!")); + return; + } + if (chunk) + this.write(chunk); + this.ended = true; + this.tokenizer.end(); + } + /** + * Pauses parsing. The parser won't emit events until `resume` is called. + */ + pause() { + this.tokenizer.pause(); + } + /** + * Resumes parsing after `pause` was called. + */ + resume() { + this.tokenizer.resume(); + while (this.tokenizer.running && + this.writeIndex < this.buffers.length) { + this.tokenizer.write(this.buffers[this.writeIndex++]); + } + if (this.ended) + this.tokenizer.end(); + } + /** + * Alias of `write`, for backwards compatibility. + * + * @param chunk Chunk to parse. + * @deprecated + */ + parseChunk(chunk) { + this.write(chunk); + } + /** + * Alias of `end`, for backwards compatibility. + * + * @param chunk Optional final chunk to parse. + * @deprecated + */ + done(chunk) { + this.end(chunk); + } + } + + // Helper methods + /** + * Parses the data, returns the resulting document. + * + * @param data The data that should be parsed. + * @param options Optional options for the parser and DOM builder. + */ + function parseDocument(data, options) { + const handler = new DomHandler(undefined, options); + new Parser$1(handler, options).end(data); + return handler.root; + } + + /** + * Types used in signatures of Cheerio methods. + * + * @category Cheerio + */ + const parse$4 = getParse((content, options, isDocument, context) => options.xmlMode || options._useHtmlParser2 + ? parseDocument(content, options) + : parseWithParse5(content, options, isDocument, context)); + // Duplicate docs due to https://github.com/TypeStrong/typedoc/issues/1616 + /** + * Create a querying function, bound to a document created from the provided markup. + * + * Note that similar to web browser contexts, this operation may introduce + * ``, ``, and `` elements; set `isDocument` to `false` to + * switch to fragment mode and disable this. + * + * @param content - Markup to be loaded. + * @param options - Options for the created instance. + * @param isDocument - Allows parser to be switched to fragment mode. + * @returns The loaded document. + * @see {@link https://cheerio.js.org#loading} for additional usage information. + */ + const load = getLoad(parse$4, (dom, options) => options.xmlMode || options._useHtmlParser2 + ? render(dom, options) + : renderWithParse5(dom)); + /** + * The default cheerio instance. + * + * @deprecated Use the function returned by `load` instead. + */ + var cheerio = load([]); + + var debug_1 = createCommonjsModule(function (module, exports) { + exports = module.exports = debug; + + function debug(label) { + return _debug.bind(null, label); + } + + function _debug(label) { + var args = [].slice.call(arguments, 1); + args.unshift('[' + label + ']'); + process.stderr.write(args.join(' ') + '\n'); + } + }); + + var lexer = createCommonjsModule(function (module, exports) { + + var debug = debug_1('lex'); + + exports = module.exports = lex; + + /** + * Convert a CSS string into an array of lexical tokens. + * + * @param {String} css CSS + * @returns {Array} lexical tokens + */ + function lex(css) { + + var buffer = ''; // Character accumulator + var ch; // Current character + var column = 0; // Current source column number + var cursor = -1; // Current source cursor position + var depth = 0; // Current nesting depth + var line = 1; // Current source line number + var state = 'before-selector'; // Current state + var stack = [state]; // State stack + var token = {}; // Current token + var tokens = []; // Token accumulator + + // Supported @-rules, in roughly descending order of usage probability. + var atRules = [ + 'media', + 'keyframes', + { name: '-webkit-keyframes', type: 'keyframes', prefix: '-webkit-' }, + { name: '-moz-keyframes', type: 'keyframes', prefix: '-moz-' }, + { name: '-ms-keyframes', type: 'keyframes', prefix: '-ms-' }, + { name: '-o-keyframes', type: 'keyframes', prefix: '-o-' }, + 'font-face', + { name: 'import', state: 'before-at-value' }, + { name: 'charset', state: 'before-at-value' }, + 'supports', + 'viewport', + { name: 'namespace', state: 'before-at-value' }, + 'document', + { name: '-moz-document', type: 'document', prefix: '-moz-' }, + 'page' + ]; + + // -- Functions ------------------------------------------------------------ + + /** + * Advance the character cursor and return the next character. + * + * @returns {String} The next character. + */ + function getCh() { + skip(); + return css[cursor]; + } + + /** + * Return the state at the given index in the stack. + * The stack is LIFO so indexing is from the right. + * + * @param {Number} [index=0] Index to return. + * @returns {String} state + */ + function getState(index) { + return index ? stack[stack.length - 1 - index] : state; + } + + /** + * Look ahead for a string beginning from the next position. The string + * being looked for must start at the next position. + * + * @param {String} str The string to look for. + * @returns {Boolean} Whether the string was found. + */ + function isNextString(str) { + var start = cursor + 1; + return (str === css.slice(start, start + str.length)); + } + + /** + * Find the start position of a substring beginning from the next + * position. The string being looked for may begin anywhere. + * + * @param {String} str The substring to look for. + * @returns {Number|false} The position, or `false` if not found. + */ + function find(str) { + var pos = css.slice(cursor).indexOf(str); + + return pos > 0 ? pos : false; + } + + /** + * Determine whether a character is next. + * + * @param {String} ch Character. + * @returns {Boolean} Whether the character is next. + */ + function isNextChar(ch) { + return ch === peek(1); + } + + /** + * Return the character at the given cursor offset. The offset is relative + * to the cursor, so negative values move backwards. + * + * @param {Number} [offset=1] Cursor offset. + * @returns {String} Character. + */ + function peek(offset) { + return css[cursor + (offset || 1)]; + } + + /** + * Remove the current state from the stack and set the new current state. + * + * @returns {String} The removed state. + */ + function popState() { + var removed = stack.pop(); + state = stack[stack.length - 1]; + + return removed; + } + + /** + * Set the current state and add it to the stack. + * + * @param {String} newState The new state. + * @returns {Number} The new stack length. + */ + function pushState(newState) { + state = newState; + stack.push(state); + + return stack.length; + } + + /** + * Replace the current state with a new state. + * + * @param {String} newState The new state. + * @returns {String} The replaced state. + */ + function replaceState(newState) { + var previousState = state; + stack[stack.length - 1] = state = newState; + + return previousState; + } + + /** + * Move the character cursor. Positive numbers move the cursor forward. + * Negative numbers are not supported! + * + * @param {Number} [n=1] Number of characters to skip. + */ + function skip(n) { + if ((n || 1) == 1) { + if (css[cursor] == '\n') { + line++; + column = 1; + } else { + column++; + } + cursor++; + } else { + var skipStr = css.slice(cursor, cursor + n).split('\n'); + if (skipStr.length > 1) { + line += skipStr.length - 1; + column = 1; + } + column += skipStr[skipStr.length - 1].length; + cursor = cursor + n; + } + } + + /** + * Add the current token to the pile and reset the buffer. + */ + function addToken() { + token.end = { + line: line, + col: column + }; + + tokens.push(token); + + buffer = ''; + token = {}; + } + + /** + * Set the current token. + * + * @param {String} type Token type. + */ + function initializeToken(type) { + token = { + type: type, + start: { + line: line, + col : column + } + }; + } + + while (ch = getCh()) { + + // column += 1; + + switch (ch) { + // Space + case ' ': + switch (getState()) { + case 'selector': + case 'value': + case 'value-paren': + case 'at-group': + case 'at-value': + case 'comment': + case 'double-string': + case 'single-string': + buffer += ch; + break; + } + break; + + // Newline or tab + case '\n': + case '\t': + case '\r': + case '\f': + switch (getState()) { + case 'value': + case 'value-paren': + case 'at-group': + case 'comment': + case 'single-string': + case 'double-string': + case 'selector': + buffer += ch; + break; + + case 'at-value': + // Tokenize an @-rule if a semi-colon was omitted. + if ('\n' === ch) { + token.value = buffer.trim(); + addToken(); + popState(); + } + break; + } + + // if ('\n' === ch) { + // column = 0; + // line += 1; + // } + break; + + case ':': + switch (getState()) { + case 'name': + token.name = buffer.trim(); + buffer = ''; + + replaceState('before-value'); + break; + + case 'before-selector': + buffer += ch; + + initializeToken('selector'); + pushState('selector'); + break; + + case 'before-value': + replaceState('value'); + buffer += ch; + break; + + default: + buffer += ch; + break; + } + break; + + case ';': + switch (getState()) { + case 'name': + case 'before-value': + case 'value': + // Tokenize a declaration + // if value is empty skip the declaration + if (buffer.trim().length > 0) { + token.value = buffer.trim(), + addToken(); + } + replaceState('before-name'); + break; + + case 'value-paren': + // Insignificant semi-colon + buffer += ch; + break; + + case 'at-value': + // Tokenize an @-rule + token.value = buffer.trim(); + addToken(); + popState(); + break; + + case 'before-name': + // Extraneous semi-colon + break; + + default: + buffer += ch; + break; + } + break; + + case '{': + switch (getState()) { + case 'selector': + // If the sequence is `\{` then assume that the brace should be escaped. + if (peek(-1) === '\\') { + buffer += ch; + break; + } + + // Tokenize a selector + token.text = buffer.trim(); + addToken(); + replaceState('before-name'); + depth = depth + 1; + break; + + case 'at-group': + // Tokenize an @-group + token.name = buffer.trim(); + + // XXX: @-rules are starting to get hairy + switch (token.type) { + case 'font-face': + case 'viewport' : + case 'page' : + pushState('before-name'); + break; + + default: + pushState('before-selector'); + } + + addToken(); + depth = depth + 1; + break; + + case 'name': + case 'at-rule': + // Tokenize a declaration or an @-rule + token.name = buffer.trim(); + addToken(); + pushState('before-name'); + depth = depth + 1; + break; + + case 'comment': + case 'double-string': + case 'single-string': + // Ignore braces in comments and strings + buffer += ch; + break; + case 'before-value': + replaceState('value'); + buffer += ch; + break; + } + + break; + + case '}': + switch (getState()) { + case 'before-name': + case 'name': + case 'before-value': + case 'value': + // If the buffer contains anything, it is a value + if (buffer) { + token.value = buffer.trim(); + } + + // If the current token has a name and a value it should be tokenized. + if (token.name && token.value) { + addToken(); + } + + // Leave the block + initializeToken('end'); + addToken(); + popState(); + + // We might need to leave again. + // XXX: What about 3 levels deep? + if ('at-group' === getState()) { + initializeToken('at-group-end'); + addToken(); + popState(); + } + + if (depth > 0) { + depth = depth - 1; + } + + break; + + case 'at-group': + case 'before-selector': + case 'selector': + // If the sequence is `\}` then assume that the brace should be escaped. + if (peek(-1) === '\\') { + buffer += ch; + break; + } + + if (depth > 0) { + // Leave block if in an at-group + if ('at-group' === getState(1)) { + initializeToken('at-group-end'); + addToken(); + } + } + + if (depth > 1) { + popState(); + } + + if (depth > 0) { + depth = depth - 1; + } + break; + + case 'double-string': + case 'single-string': + case 'comment': + // Ignore braces in comments and strings. + buffer += ch; + break; + } + + break; + + // Strings + case '"': + case "'": + switch (getState()) { + case 'double-string': + if ('"' === ch && '\\' !== peek(-1)) { + popState(); + } + break; + + case 'single-string': + if ("'" === ch && '\\' !== peek(-1)) { + popState(); + } + break; + + case 'before-at-value': + replaceState('at-value'); + pushState('"' === ch ? 'double-string' : 'single-string'); + break; + + case 'before-value': + replaceState('value'); + pushState('"' === ch ? 'double-string' : 'single-string'); + break; + + case 'comment': + // Ignore strings within comments. + break; + + default: + if ('\\' !== peek(-1)) { + pushState('"' === ch ? 'double-string' : 'single-string'); + } + } + + buffer += ch; + break; + + // Comments + case '/': + switch (getState()) { + case 'comment': + case 'double-string': + case 'single-string': + // Ignore + buffer += ch; + break; + + case 'before-value': + case 'selector': + case 'name': + case 'value': + if (isNextChar('*')) { + // Ignore comments in selectors, properties and values. They are + // difficult to represent in the AST. + var pos = find('*/'); + + if (pos) { + skip(pos + 1); + } + } else { + if (getState() == 'before-value') replaceState('value'); + buffer += ch; + } + break; + + default: + if (isNextChar('*')) { + // Create a comment token + initializeToken('comment'); + pushState('comment'); + skip(); + } + else { + buffer += ch; + } + break; + } + break; + + // Comment end or universal selector + case '*': + switch (getState()) { + case 'comment': + if (isNextChar('/')) { + // Tokenize a comment + token.text = buffer; // Don't trim()! + skip(); + addToken(); + popState(); + } + else { + buffer += ch; + } + break; + + case 'before-selector': + buffer += ch; + initializeToken('selector'); + pushState('selector'); + break; + + case 'before-value': + replaceState('value'); + buffer += ch; + break; + + default: + buffer += ch; + } + break; + + // @-rules + case '@': + switch (getState()) { + case 'comment': + case 'double-string': + case 'single-string': + buffer += ch; + break; + case 'before-value': + replaceState('value'); + buffer += ch; + break; + + default: + // Iterate over the supported @-rules and attempt to tokenize one. + var tokenized = false; + var name; + var rule; + + for (var j = 0, len = atRules.length; !tokenized && j < len; ++j) { + rule = atRules[j]; + name = rule.name || rule; + + if (!isNextString(name)) { continue; } + + tokenized = true; + + initializeToken(name); + pushState(rule.state || 'at-group'); + skip(name.length); + + if (rule.prefix) { + token.prefix = rule.prefix; + } + + if (rule.type) { + token.type = rule.type; + } + } + + if (!tokenized) { + // Keep on truckin' America! + buffer += ch; + } + break; + } + break; + + // Parentheses are tracked to disambiguate semi-colons, such as within a + // data URI. + case '(': + switch (getState()) { + case 'value': + pushState('value-paren'); + break; + case 'before-value': + replaceState('value'); + break; + } + + buffer += ch; + break; + + case ')': + switch (getState()) { + case 'value-paren': + popState(); + break; + case 'before-value': + replaceState('value'); + break; + } + + buffer += ch; + break; + + default: + switch (getState()) { + case 'before-selector': + initializeToken('selector'); + pushState('selector'); + break; + + case 'before-name': + initializeToken('property'); + replaceState('name'); + break; + + case 'before-value': + replaceState('value'); + break; + + case 'before-at-value': + replaceState('at-value'); + break; + } + + buffer += ch; + break; + } + } + + return tokens; + } + }); + + var parser = createCommonjsModule(function (module, exports) { + + var debug = debug_1('parse'); + + + exports = module.exports = parse; + + var _comments; // Whether comments are allowed. + var _depth; // Current block nesting depth. + var _position; // Whether to include line/column position. + var _tokens; // Array of lexical tokens. + + /** + * Convert a CSS string or array of lexical tokens into a `stringify`-able AST. + * + * @param {String} css CSS string or array of lexical token + * @param {Object} [options] + * @param {Boolean} [options.comments=false] allow comment nodes in the AST + * @returns {Object} `stringify`-able AST + */ + function parse(css, options) { + + options || (options = {}); + _comments = !!options.comments; + _position = !!options.position; + + _depth = 0; + + // Operate on a copy of the given tokens, or the lex()'d CSS string. + _tokens = Array.isArray(css) ? css.slice() : lexer(css); + + var rule; + var rules = []; + var token; + + while ((token = next())) { + rule = parseToken(token); + rule && rules.push(rule); + } + + return { + type: "stylesheet", + stylesheet: { + rules: rules + } + }; + } + + // -- Functions -------------------------------------------------------------- + + /** + * Build an AST node from a lexical token. + * + * @param {Object} token lexical token + * @param {Object} [override] object hash of properties that override those + * already in the token, or that will be added to the token. + * @returns {Object} AST node + */ + function astNode(token, override) { + override || (override = {}); + + var key; + var keys = ['type', 'name', 'value']; + var node = {}; + + // Avoiding [].forEach for performance reasons. + for (var i = 0; i < keys.length; ++i) { + key = keys[i]; + + if (token[key]) { + node[key] = override[key] || token[key]; + } + } + + keys = Object.keys(override); + + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + + if (!node[key]) { + node[key] = override[key]; + } + } + + if (_position) { + node.position = { + start: token.start, + end: token.end + }; + } + + return node; + } + + /** + * Remove a lexical token from the stack and return the removed token. + * + * @returns {Object} lexical token + */ + function next() { + var token = _tokens.shift(); + return token; + } + + // -- Parse* Functions --------------------------------------------------------- + + /** + * Convert an @-group lexical token to an AST node. + * + * @param {Object} token @-group lexical token + * @returns {Object} @-group AST node + */ + function parseAtGroup(token) { + _depth = _depth + 1; + + // As the @-group token is assembled, relevant token values are captured here + // temporarily. They will later be used as `tokenize()` overrides. + var overrides = {}; + + switch (token.type) { + case 'font-face': + case 'viewport' : + overrides.declarations = parseDeclarations(); + break; + + case 'page': + overrides.prefix = token.prefix; + overrides.declarations = parseDeclarations(); + break; + + default: + overrides.prefix = token.prefix; + overrides.rules = parseRules(); + } + + return astNode(token, overrides); + } + + /** + * Convert an @import lexical token to an AST node. + * + * @param {Object} token @import lexical token + * @returns {Object} @import AST node + */ + function parseAtImport(token) { + return astNode(token); + } + + /** + * Convert an @charset token to an AST node. + * + * @param {Object} token @charset lexical token + * @returns {Object} @charset node + */ + function parseCharset(token) { + return astNode(token); + } + + /** + * Convert a comment token to an AST Node. + * + * @param {Object} token comment lexical token + * @returns {Object} comment node + */ + function parseComment(token) { + return astNode(token, {text: token.text}); + } + + function parseNamespace(token) { + return astNode(token); + } + + /** + * Convert a property lexical token to a property AST node. + * + * @returns {Object} property node + */ + function parseProperty(token) { + return astNode(token); + } + + /** + * Convert a selector lexical token to a selector AST node. + * + * @param {Object} token selector lexical token + * @returns {Object} selector node + */ + function parseSelector(token) { + function trim(str) { + return str.trim(); + } + + return astNode(token, { + type: 'rule', + selectors: token.text.split(',').map(trim), + declarations: parseDeclarations() + }); + } + + /** + * Convert a lexical token to an AST node. + * + * @returns {Object|undefined} AST node + */ + function parseToken(token) { + switch (token.type) { + // Cases are listed in roughly descending order of probability. + case 'property': return parseProperty(token); + + case 'selector': return parseSelector(token); + + case 'at-group-end': _depth = _depth - 1; return; + + case 'media' : + case 'keyframes' :return parseAtGroup(token); + + case 'comment': if (_comments) { return parseComment(token); } break; + + case 'charset': return parseCharset(token); + case 'import': return parseAtImport(token); + + case 'namespace': return parseNamespace(token); + + case 'font-face': + case 'supports' : + case 'viewport' : + case 'document' : + case 'page' : return parseAtGroup(token); + } + } + + // -- Parse Helper Functions --------------------------------------------------- + + /** + * Iteratively parses lexical tokens from the stack into AST nodes until a + * conditional function returns `false`, at which point iteration terminates + * and any AST nodes collected are returned. + * + * @param {Function} conditionFn + * @param {Object} token the lexical token being parsed + * @returns {Boolean} `true` if the token should be parsed, `false` otherwise + * @return {Array} AST nodes + */ + function parseTokensWhile(conditionFn) { + var node; + var nodes = []; + var token; + + while ((token = next()) && (conditionFn && conditionFn(token))) { + node = parseToken(token); + node && nodes.push(node); + } + + // Place an unused non-`end` lexical token back onto the stack. + if (token && token.type !== 'end') { + _tokens.unshift(token); + } + + return nodes; + } + + /** + * Convert a series of tokens into a sequence of declaration AST nodes. + * + * @returns {Array} declaration nodes + */ + function parseDeclarations() { + return parseTokensWhile(function (token) { + return (token.type === 'property' || token.type === 'comment'); + }); + } + + /** + * Convert a series of tokens into a sequence of rule nodes. + * + * @returns {Array} rule nodes + */ + function parseRules() { + return parseTokensWhile(function () { return _depth; }); + } + }); + + var stringify_1 = createCommonjsModule(function (module, exports) { + + var debug = debug_1('stringify'); + + var _comments; // Whether comments are allowed in the stringified CSS. + var _compress; // Whether the stringified CSS should be compressed. + var _indentation; // Indentation option value. + var _level; // Current indentation level. + var _n; // Compression-aware newline character. + var _s; // Compression-aware space character. + + exports = module.exports = stringify; + + /** + * Convert a `stringify`-able AST into a CSS string. + * + * @param {Object} `stringify`-able AST + * @param {Object} [options] + * @param {Boolean} [options.comments=false] allow comments in the CSS + * @param {Boolean} [options.compress=false] compress whitespace + * @param {String} [options.indentation=''] indentation sequence + * @returns {String} CSS + */ + function stringify(ast, options) { + + options || (options = {}); + _indentation = options.indentation || ''; + _compress = !!options.compress; + _comments = !!options.comments; + _level = 1; + + if (_compress) { + _n = _s = ''; + } else { + _n = '\n'; + _s = ' '; + } + + var css = reduce(ast.stylesheet.rules, stringifyNode).join('\n').trim(); + + return css; + } + + // -- Functions -------------------------------------------------------------- + + /** + * Modify the indentation level, or return a compression-aware sequence of + * spaces equal to the current indentation level. + * + * @param {Number} [level=undefined] indentation level modifier + * @returns {String} sequence of spaces + */ + function indent(level) { + if (level) { + _level += level; + return; + } + + if (_compress) { return ''; } + + return Array(_level).join(_indentation || ''); + } + + // -- Stringify Functions ------------------------------------------------------ + + /** + * Stringify an @-rule AST node. + * + * Use `stringifyAtGroup()` when dealing with @-groups that may contain blocks + * such as @media. + * + * @param {String} type @-rule type. E.g., import, charset + * @returns {String} Stringified @-rule + */ + function stringifyAtRule(node) { + return '@' + node.type + ' ' + node.value + ';' + _n; + } + + /** + * Stringify an @-group AST node. + * + * Use `stringifyAtRule()` when dealing with @-rules that may not contain blocks + * such as @import. + * + * @param {Object} node @-group AST node + * @returns {String} + */ + function stringifyAtGroup(node) { + var label = ''; + var prefix = node.prefix || ''; + + if (node.name) { + label = ' ' + node.name; + } + + // FIXME: @-rule conditional logic is leaking everywhere. + var chomp = node.type !== 'page'; + + return '@' + prefix + node.type + label + _s + stringifyBlock(node, chomp) + _n; + } + + /** + * Stringify a comment AST node. + * + * @param {Object} node comment AST node + * @returns {String} + */ + function stringifyComment(node) { + if (!_comments) { return ''; } + + return '/*' + (node.text || '') + '*/' + _n; + } + + /** + * Stringify a rule AST node. + * + * @param {Object} node rule AST node + * @returns {String} + */ + function stringifyRule(node) { + var label; + + if (node.selectors) { + label = node.selectors.join(',' + _n); + } else { + label = '@' + node.type; + label += node.name ? ' ' + node.name : ''; + } + + return indent() + label + _s + stringifyBlock(node) + _n; + } + + + // -- Stringify Helper Functions ----------------------------------------------- + + /** + * Reduce an array by applying a function to each item and retaining the truthy + * results. + * + * When `item.type` is `'comment'` `stringifyComment` will be applied instead. + * + * @param {Array} items array to reduce + * @param {Function} fn function to call for each item in the array + * @returns {Mixed} Truthy values will be retained, falsy values omitted + * @returns {Array} retained results + */ + function reduce(items, fn) { + return items.reduce(function (results, item) { + var result = (item.type === 'comment') ? stringifyComment(item) : fn(item); + result && results.push(result); + return results; + }, []); + } + + /** + * Stringify an AST node with the assumption that it represents a block of + * declarations or other @-group contents. + * + * @param {Object} node AST node + * @returns {String} + */ + // FIXME: chomp should not be a magic boolean parameter + function stringifyBlock(node, chomp) { + var children = node.declarations; + var fn = stringifyDeclaration; + + if (node.rules) { + children = node.rules; + fn = stringifyRule; + } + + children = stringifyChildren(children, fn); + children && (children = _n + children + (chomp ? '' : _n)); + + return '{' + children + indent() + '}'; + } + + /** + * Stringify an array of child AST nodes by calling the given stringify function + * once for each child, and concatenating the results. + * + * @param {Array} children `node.rules` or `node.declarations` + * @param {Function} fn stringify function + * @returns {String} + */ + function stringifyChildren(children, fn) { + if (!children) { return ''; } + + indent(1); + var results = reduce(children, fn); + indent(-1); + + if (!results.length) { return ''; } + + return results.join(_n); + } + + /** + * Stringify a declaration AST node. + * + * @param {Object} node declaration AST node + * @returns {String} + */ + function stringifyDeclaration(node) { + if (node.type === 'property') { + return stringifyProperty(node); + } + } + + /** + * Stringify an AST node. + * + * @param {Object} node AST node + * @returns {String} + */ + function stringifyNode(node) { + switch (node.type) { + // Cases are listed in roughly descending order of probability. + case 'rule': return stringifyRule(node); + + case 'media' : + case 'keyframes': return stringifyAtGroup(node); + + case 'comment': return stringifyComment(node); + + case 'import' : + case 'charset' : + case 'namespace': return stringifyAtRule(node); + + case 'font-face': + case 'supports' : + case 'viewport' : + case 'document' : + case 'page' : return stringifyAtGroup(node); + } + } + + /** + * Stringify an AST property node. + * + * @param {Object} node AST property node + * @returns {String} + */ + function stringifyProperty(node) { + var name = node.name ? node.name + ':' + _s : ''; + + return indent() + name + node.value + ';'; + } + }); + + var mensch = { + lex : lexer, + parse: parser, + stringify: stringify_1 + }; + + // Notable changes from Slick.Parser 1.0.x + + // The parser now uses 2 classes: Expressions and Expression + // `new Expressions` produces an array-like object containing a list of Expression objects + // - Expressions::toString() produces a cleaned up expressions string + // `new Expression` produces an array-like object + // - Expression::toString() produces a cleaned up expression string + // The only exposed method is parse, which produces a (cached) `new Expressions` instance + // parsed.raw is no longer present, use .toString() + // parsed.expression is now useless, just use the indices + // parsed.reverse() has been removed for now, due to its apparent uselessness + // Other changes in the Expressions object: + // - classNames are now unique, and save both escaped and unescaped values + // - attributes now save both escaped and unescaped values + // - pseudos now save both escaped and unescaped values + + var escapeRe = /([-.*+?^${}()|[\]\/\\])/g, + unescapeRe = /\\/g; + + var escape$1 = function(string){ + // XRegExp v2.0.0-beta-3 + // « https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js + return (string + "").replace(escapeRe, '\\$1') + }; + + var unescape$1 = function(string){ + return (string + "").replace(unescapeRe, '') + }; + + var slickRe = RegExp( + /* + #!/usr/bin/env ruby + puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'') + __END__ + "(?x)^(?:\ + \\s* ( , ) \\s* # Separator \n\ + | \\s* ( + ) \\s* # Combinator \n\ + | ( \\s+ ) # CombinatorChildren \n\ + | ( + | \\* ) # Tag \n\ + | \\# ( + ) # ID \n\ + | \\. ( + ) # ClassName \n\ + | # Attribute \n\ + \\[ \ + \\s* (+) (?: \ + \\s* ([*^$!~|]?=) (?: \ + \\s* (?:\ + ([\"']?)(.*?)\\9 \ + )\ + ) \ + )? \\s* \ + \\](?!\\]) \n\ + | :+ ( + )(?:\ + \\( (?:\ + (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\ + ) \\)\ + )?\ + )" + */ + "^(?:\\s*(,)\\s*|\\s*(+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)" + .replace(//, '[' + escape$1(">+~`!@$%^&={}\\;/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') + .replace(//g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') + ); + + // Part + + var Part = function Part(combinator){ + this.combinator = combinator || " "; + this.tag = "*"; + }; + + Part.prototype.toString = function(){ + + if (!this.raw){ + + var xpr = "", k, part; + + xpr += this.tag || "*"; + if (this.id) xpr += "#" + this.id; + if (this.classes) xpr += "." + this.classList.join("."); + if (this.attributes) for (k = 0; part = this.attributes[k++];){ + xpr += "[" + part.name + (part.operator ? part.operator + '"' + part.value + '"' : '') + "]"; + } + if (this.pseudos) for (k = 0; part = this.pseudos[k++];){ + xpr += ":" + part.name; + if (part.value) xpr += "(" + part.value + ")"; + } + + this.raw = xpr; + + } + + return this.raw + }; + + // Expression + + var Expression = function Expression(){ + this.length = 0; + }; + + Expression.prototype.toString = function(){ + + if (!this.raw){ + + var xpr = ""; + + for (var j = 0, bit; bit = this[j++];){ + if (j !== 1) xpr += " "; + if (bit.combinator !== " ") xpr += bit.combinator + " "; + xpr += bit; + } + + this.raw = xpr; + + } + + return this.raw + }; + + var replacer$1 = function( + rawMatch, + + separator, + combinator, + combinatorChildren, + + tagName, + id, + className, + + attributeKey, + attributeOperator, + attributeQuote, + attributeValue, + + pseudoMarker, + pseudoClass, + pseudoQuote, + pseudoClassQuotedValue, + pseudoClassValue + ){ + + var expression, current; + + if (separator || !this.length){ + expression = this[this.length++] = new Expression; + if (separator) return '' + } + + if (!expression) expression = this[this.length - 1]; + + if (combinator || combinatorChildren || !expression.length){ + current = expression[expression.length++] = new Part(combinator); + } + + if (!current) current = expression[expression.length - 1]; + + if (tagName){ + + current.tag = unescape$1(tagName); + + } else if (id){ + + current.id = unescape$1(id); + + } else if (className){ + + var unescaped = unescape$1(className); + + var classes = current.classes || (current.classes = {}); + if (!classes[unescaped]){ + classes[unescaped] = escape$1(className); + var classList = current.classList || (current.classList = []); + classList.push(unescaped); + classList.sort(); + } + + } else if (pseudoClass){ + + pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue + + ;(current.pseudos || (current.pseudos = [])).push({ + type : pseudoMarker.length == 1 ? 'class' : 'element', + name : unescape$1(pseudoClass), + escapedName : escape$1(pseudoClass), + value : pseudoClassValue ? unescape$1(pseudoClassValue) : null, + escapedValue : pseudoClassValue ? escape$1(pseudoClassValue) : null + }); + + } else if (attributeKey){ + + attributeValue = attributeValue ? escape$1(attributeValue) : null + + ;(current.attributes || (current.attributes = [])).push({ + operator : attributeOperator, + name : unescape$1(attributeKey), + escapedName : escape$1(attributeKey), + value : attributeValue ? unescape$1(attributeValue) : null, + escapedValue : attributeValue ? escape$1(attributeValue) : null + }); + + } + + return '' + + }; + + // Expressions + + var Expressions = function Expressions(expression){ + this.length = 0; + + var self = this; + + var original = expression, replaced; + + while (expression){ + replaced = expression.replace(slickRe, function(){ + return replacer$1.apply(self, arguments) + }); + if (replaced === expression) throw new Error(original + ' is an invalid expression') + expression = replaced; + } + }; + + Expressions.prototype.toString = function(){ + if (!this.raw){ + var expressions = []; + for (var i = 0, expression; expression = this[i++];) expressions.push(expression); + this.raw = expressions.join(", "); + } + + return this.raw + }; + + var cache = {}; + + var parse$5 = function(expression){ + if (expression == null) return null + expression = ('' + expression).replace(/^\s+|\s+$/g, ''); + return cache[expression] || (cache[expression] = new Expressions(expression)) + }; + + var parser$1 = parse$5; + + var selector = createCommonjsModule(function (module, exports) { + + + + module.exports = exports = Selector; + + /** + * CSS selector constructor. + * + * @param {String} selector text + * @param {Array} optionally, precalculated specificity + * @api public + */ + + function Selector(text, styleAttribute) { + this.text = text; + this.spec = undefined; + this.styleAttribute = styleAttribute || false; + } + + /** + * Get parsed selector. + * + * @api public + */ + + Selector.prototype.parsed = function() { + if (!this.tokens) { this.tokens = parse(this.text); } + return this.tokens; + }; + + /** + * Lazy specificity getter + * + * @api public + */ + + Selector.prototype.specificity = function() { + var styleAttribute = this.styleAttribute; + if (!this.spec) { this.spec = specificity(this.text, this.parsed()); } + return this.spec; + + function specificity(text, parsed) { + var expressions = parsed || parse(text); + var spec = [styleAttribute ? 1 : 0, 0, 0, 0]; + var nots = []; + + for (var i = 0; i < expressions.length; i++) { + var expression = expressions[i]; + var pseudos = expression.pseudos; + + // id awards a point in the second column + if (expression.id) { spec[1]++; } + + // classes and attributes award a point each in the third column + if (expression.attributes) { spec[2] += expression.attributes.length; } + if (expression.classList) { spec[2] += expression.classList.length; } + + // tag awards a point in the fourth column + if (expression.tag && expression.tag !== '*') { spec[3]++; } + + // pseudos award a point each in the fourth column + if (pseudos) { + spec[3] += pseudos.length; + + for (var p = 0; p < pseudos.length; p++) { + if (pseudos[p].name === 'not') { + nots.push(pseudos[p].value); + spec[3]--; + } + } + } + } + + for (var ii = nots.length; ii--;) { + var not = specificity(nots[ii]); + for (var jj = 4; jj--;) { spec[jj] += not[jj]; } + } + + return spec; + } + }; + + /** + * Parses a selector and returns the tokens. + * + * @param {String} selector + * @api private. + */ + + function parse(text) { + try { + return parser$1(text)[0]; + } catch (e) { + return []; + } + } + }); + + var property = createCommonjsModule(function (module, exports) { + + module.exports = exports = Property; + + /** + * Module dependencies. + */ + + + + /** + * CSS property constructor. + * + * @param {String} property + * @param {String} value + * @param {Selector} selector the property originates from + * @param {Integer} priority 0 for normal properties, 2 for !important properties. + * @param {Array} additional array of integers representing more detailed priorities (sorting) + * @api public + */ + + function Property(prop, value, selector, priority, additionalPriority) { + this.prop = prop; + this.value = value; + this.selector = selector; + this.priority = priority || 0; + this.additionalPriority = additionalPriority || []; + } + + /** + * Compares with another Property based on Selector#specificity. + * + * @api public + */ + + Property.prototype.compareFunc = function(property) { + var a = []; + a.push.apply(a, this.selector.specificity()); + a.push.apply(a, this.additionalPriority); + a[0] += this.priority; + var b = []; + b.push.apply(b, property.selector.specificity()); + b.push.apply(b, property.additionalPriority); + b[0] += property.priority; + return utils$1.compareFunc(a, b); + }; + + Property.prototype.compare = function(property) { + var winner = this.compareFunc(property); + if (winner === 1) { + return this; + } + return property; + }; + + + /** + * Returns CSS property + * + * @api public + */ + + Property.prototype.toString = function() { + return this.prop + ': ' + this.value.replace(/['"]+/g, '') + ';'; + }; + }); + + var utils$1 = createCommonjsModule(function (module, exports) { + + /** + * Module dependencies. + */ + + + + + + exports.Selector = selector; + exports.Property = property; + + /** + * Returns an array of the selectors. + * + * @license Sizzle CSS Selector Engine - MIT + * @param {String} selectorText from mensch + * @api public + */ + + exports.extract = function extract(selectorText) { + var attr = 0; + var sels = []; + var sel = ''; + + for (var i = 0, l = selectorText.length; i < l; i++) { + var c = selectorText.charAt(i); + + if (attr) { + if (']' === c || ')' === c) { attr--; } + sel += c; + } else { + if (',' === c) { + sels.push(sel); + sel = ''; + } else { + if ('[' === c || '(' === c) { attr++; } + if (sel.length || (c !== ',' && c !== '\n' && c !== ' ')) { sel += c; } + } + } + } + + if (sel.length) { + sels.push(sel); + } + + return sels; + }; + + /** + * Returns a parse tree for a CSS source. + * If it encounters multiple selectors separated by a comma, it splits the + * tree. + * + * @param {String} css source + * @api public + */ + + exports.parseCSS = function(css) { + var parsed = mensch.parse(css, {position: true, comments: true}); + var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : []; + var ret = []; + + for (var i = 0, l = rules.length; i < l; i++) { + if (rules[i].type == 'rule') { + var rule = rules[i]; + var selectors = rule.selectors; + + for (var ii = 0, ll = selectors.length; ii < ll; ii++) { + ret.push([selectors[ii], rule.declarations]); + } + } + } + + return ret; + }; + + /** + * Returns preserved text for a CSS source. + * + * @param {String} css source + * @param {Object} options + * @api public + */ + + exports.getPreservedText = function(css, options, ignoredPseudos) { + var parsed = mensch.parse(css, {position: true, comments: true}); + var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : []; + var preserved = []; + var lastStart = null; + + for (var i = rules.length - 1; i >= 0; i--) { + if ((options.fontFaces && rules[i].type === 'font-face') || + (options.mediaQueries && rules[i].type === 'media') || + (options.keyFrames && rules[i].type === 'keyframes') || + (options.pseudos && rules[i].selectors && this.matchesPseudo(rules[i].selectors[0], ignoredPseudos))) { + preserved.unshift( + mensch.stringify( + { stylesheet: { rules: [ rules[i] ] }}, + { comments: false, indentation: ' ' } + ) + ); + } + lastStart = rules[i].position.start; + } + + if (preserved.length === 0) { + return false; + } + return '\n' + preserved.join('\n') + '\n'; + }; + + exports.normalizeLineEndings = function(text) { + return text.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n'); + }; + + exports.matchesPseudo = function(needle, haystack) { + return haystack.find(function (element) { + return needle.indexOf(element) > -1; + }) + }; + + /** + * Compares two specificity vectors, returning the winning one. + * + * @param {Array} vector a + * @param {Array} vector b + * @return {Array} + * @api public + */ + + exports.compareFunc = function(a, b) { + var min = Math.min(a.length, b.length); + for (var i = 0; i < min; i++) { + if (a[i] === b[i]) { continue; } + if (a[i] > b[i]) { return 1; } + return -1; + } + + return a.length - b.length; + }; + + exports.compare = function(a, b) { + return exports.compareFunc(a, b) == 1 ? a : b; + }; + + exports.getDefaultOptions = function(options) { + var result = Object.assign({ + extraCss: '', + insertPreservedExtraCss: true, + applyStyleTags: true, + removeStyleTags: true, + preserveMediaQueries: true, + preserveFontFaces: true, + preserveKeyFrames: true, + preservePseudos: true, + applyWidthAttributes: true, + applyHeightAttributes: true, + applyAttributesTableElements: true, + url: '' + }, options); + + result.webResources = result.webResources || {}; + + return result; + }; + }); + var utils_1 = utils$1.Selector; + var utils_2 = utils$1.Property; + var utils_3 = utils$1.extract; + var utils_4 = utils$1.parseCSS; + var utils_5 = utils$1.getPreservedText; + var utils_6 = utils$1.normalizeLineEndings; + var utils_7 = utils$1.matchesPseudo; + var utils_8 = utils$1.compareFunc; + var utils_9 = utils$1.compare; + var utils_10 = utils$1.getDefaultOptions; + + var cheerio_1 = createCommonjsModule(function (module) { + + /** + * Module dependencies. + */ + + + + var cheerioLoad = function(html, options, encodeEntities) { + options = Object.assign({decodeEntities: false, _useHtmlParser2:true}, options); + html = encodeEntities(html); + return cheerio.load(html, options); + }; + + var createEntityConverters = function () { + var codeBlockLookup = []; + + var encodeCodeBlocks = function(html) { + var blocks = module.exports.codeBlocks; + Object.keys(blocks).forEach(function(key) { + var re = new RegExp(blocks[key].start + '([\\S\\s]*?)' + blocks[key].end, 'g'); + html = html.replace(re, function(match, subMatch) { + codeBlockLookup.push(match); + return 'JUICE_CODE_BLOCK_' + (codeBlockLookup.length - 1) + '_'; + }); + }); + return html; + }; + + var decodeCodeBlocks = function(html) { + for(var index = 0; index < codeBlockLookup.length; index++) { + var re = new RegExp('JUICE_CODE_BLOCK_' + index + '_(="")?', 'gi'); + html = html.replace(re, function() { + return codeBlockLookup[index]; + }); + } + return html; + }; + + return { + encodeEntities: encodeCodeBlocks, + decodeEntities: decodeCodeBlocks, + }; + }; + + /** + * Parses the input, calls the callback on the parsed DOM, and generates the output + * + * @param {String} html input html to be processed + * @param {Object} options for the parser + * @param {Function} callback to be invoked on the DOM + * @param {Array} callbackExtraArguments to be passed to the callback + * @return {String} resulting html + */ + module.exports = function(html, options, callback, callbackExtraArguments) { + var entityConverters = createEntityConverters(); + + var $ = cheerioLoad(html, options, entityConverters.encodeEntities); + var args = [ $ ]; + args.push.apply(args, callbackExtraArguments); + var doc = callback.apply(undefined, args) || $; + + if (options && options.xmlMode) { + return entityConverters.decodeEntities(doc.xml()); + } + return entityConverters.decodeEntities(doc.html()); + }; + + module.exports.codeBlocks = { + EJS: { start: '<%', end: '%>' }, + HBS: { start: '{{', end: '}}' } + }; + }); + var cheerio_2 = cheerio_1.codeBlocks; + + /** + * Converts a decimal number to roman numeral. + * https://stackoverflow.com/questions/9083037/convert-a-number-into-a-roman-numeral-in-javascript + * + * @param {Number} number + * @api private. + */ + var romanize = function(num) { + if (isNaN(num)) + return NaN; + var digits = String(+num).split(""), + key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM", + "","X","XX","XXX","XL","L","LX","LXX","LXXX","XC", + "","I","II","III","IV","V","VI","VII","VIII","IX"], + roman = "", + i = 3; + while (i--) + roman = (key[+digits.pop() + (i * 10)] || "") + roman; + return Array(+digits.join("") + 1).join("M") + roman; + }; + + /** + * Converts a decimal number to alphanumeric numeral. + * https://stackoverflow.com/questions/45787459/convert-number-to-alphabet-string-javascript + * + * @param {Number} number + * @api private. + */ + var alphanumeric = function(num) { + var s = '', t; + + while (num > 0) { + t = (num - 1) % 26; + s = String.fromCharCode(65 + t) + s; + num = (num - t)/26 | 0; + } + return s || undefined; + }; + + var numbers = { + romanize: romanize, + alphanumeric: alphanumeric + }; + + var inline = function makeJuiceClient(juiceClient) { + + juiceClient.ignoredPseudos = ['hover', 'active', 'focus', 'visited', 'link']; + juiceClient.widthElements = ['TABLE', 'TD', 'TH', 'IMG']; + juiceClient.heightElements = ['TABLE', 'TD', 'TH', 'IMG']; + juiceClient.tableElements = ['TABLE', 'TH', 'TR', 'TD', 'CAPTION', 'COLGROUP', 'COL', 'THEAD', 'TBODY', 'TFOOT']; + juiceClient.nonVisualElements = [ 'HEAD', 'TITLE', 'BASE', 'LINK', 'STYLE', 'META', 'SCRIPT', 'NOSCRIPT' ]; + juiceClient.styleToAttribute = { + 'background-color': 'bgcolor', + 'background-image': 'background', + 'text-align': 'align', + 'vertical-align': 'valign' + }; + juiceClient.excludedProperties = []; + + juiceClient.juiceDocument = juiceDocument; + juiceClient.inlineDocument = inlineDocument; + + function inlineDocument($, css, options) { + + options = options || {}; + var rules = utils$1.parseCSS(css); + var editedElements = []; + var styleAttributeName = 'style'; + var counters = {}; + + if (options.styleAttributeName) { + styleAttributeName = options.styleAttributeName; + } + + rules.forEach(handleRule); + editedElements.forEach(setStyleAttrs); + + if (options.inlinePseudoElements) { + editedElements.forEach(inlinePseudoElements); + } + + if (options.applyWidthAttributes) { + editedElements.forEach(function(el) { + setDimensionAttrs(el, 'width'); + }); + } + + if (options.applyHeightAttributes) { + editedElements.forEach(function(el) { + setDimensionAttrs(el, 'height'); + }); + } + + if (options.applyAttributesTableElements) { + editedElements.forEach(setAttributesOnTableElements); + } + + if (options.insertPreservedExtraCss && options.extraCss) { + var preservedText = utils$1.getPreservedText(options.extraCss, { + mediaQueries: options.preserveMediaQueries, + fontFaces: options.preserveFontFaces, + keyFrames: options.preserveKeyFrames + }); + if (preservedText) { + var $appendTo = null; + if (options.insertPreservedExtraCss !== true) { + $appendTo = $(options.insertPreservedExtraCss); + } else { + $appendTo = $('head'); + if (!$appendTo.length) { $appendTo = $('body'); } + if (!$appendTo.length) { $appendTo = $.root(); } + } + + $appendTo.first().append(''); + } + } + + function handleRule(rule) { + var sel = rule[0]; + var style = rule[1]; + var selector = new utils$1.Selector(sel); + var parsedSelector = selector.parsed(); + + if (!parsedSelector) { + return; + } + + var pseudoElementType = getPseudoElementType(parsedSelector); + + // skip rule if the selector has any pseudos which are ignored + for (var i = 0; i < parsedSelector.length; ++i) { + var subSel = parsedSelector[i]; + if (subSel.pseudos) { + for (var j = 0; j < subSel.pseudos.length; ++j) { + var subSelPseudo = subSel.pseudos[j]; + if (juiceClient.ignoredPseudos.indexOf(subSelPseudo.name) >= 0) { + return; + } + } + } + } + + if (pseudoElementType) { + var last = parsedSelector[parsedSelector.length - 1]; + var pseudos = last.pseudos; + last.pseudos = filterElementPseudos(last.pseudos); + sel = parsedSelector.toString(); + last.pseudos = pseudos; + } + + var els; + try { + els = $(sel); + } catch (err) { + // skip invalid selector + return; + } + + els.each(function() { + var el = this; + + if (el.name && juiceClient.nonVisualElements.indexOf(el.name.toUpperCase()) >= 0) { + return; + } + + if (pseudoElementType) { + var pseudoElPropName = 'pseudo' + pseudoElementType; + var pseudoEl = el[pseudoElPropName]; + if (!pseudoEl) { + pseudoEl = el[pseudoElPropName] = $('').get(0); + pseudoEl.pseudoElementType = pseudoElementType; + pseudoEl.pseudoElementParent = el; + pseudoEl.counterProps = el.counterProps; + el[pseudoElPropName] = pseudoEl; + } + el = pseudoEl; + } + + if (!el.styleProps) { + el.styleProps = {}; + + // if the element has inline styles, fake selector with topmost specificity + if ($(el).attr(styleAttributeName)) { + var cssText = '* { ' + $(el).attr(styleAttributeName) + ' } '; + addProps(utils$1.parseCSS(cssText)[0][1], new utils$1.Selector('"); + } + }, { + key: "computeStyle", + value: function computeStyle() { + // 计算需要append进富文本的style + var mathStyle = this.getStyleFromSheets('mjx-container'); + var cherryStyle = this.getStyleFromSheets('cherry'); + var echartStyle = ''; + return { + mathStyle: mathStyle, + echartStyle: echartStyle, + cherryStyle: cherryStyle + }; + } + /** + * 由于复制操作会随着预览区域的内容增加而耗时变长,所以需要增加“正在复制”的状态回显 + * 同时该状态也用于限频 + */ + + }, { + key: "toggleLoading", + value: function toggleLoading() { + // 切换loading状态 + if (this.isLoading) { + var loadingButton = document.querySelector('.icon-loading'); + loadingButton.outerHTML = ""); + } else { + var copyButton = document.querySelector('.ch-icon-copy'); + copyButton.outerHTML = '
'; + } + + this.isLoading = !this.isLoading; + } + /** + * 响应点击事件 + * 该按钮不会引发编辑区域的内容改动,所以不用处理用户在编辑区域的选中内容 + * @param {Event} e 点击事件 + */ + + }, { + key: "onClick", + value: function onClick(e) { + var _this2 = this; + + this.toggleLoading(); + var inlineCodeTheme = document.querySelector('.cherry').getAttribute('data-inline-code-theme'); + var codeBlockTheme = document.querySelector('.cherry').getAttribute('data-code-block-theme'); + + var _this$computeStyle = this.computeStyle(), + mathStyle = _this$computeStyle.mathStyle, + echartStyle = _this$computeStyle.echartStyle, + cherryStyle = _this$computeStyle.cherryStyle; + + var html = this.previewer.isPreviewerHidden() ? this.previewer.options.previewerCache.html : this.previewer.getValue(); // 将css样式以行内样式的形式插入到html内容里 + + this.adaptWechat(html).then(function (html) { + var _context7, _context8, _context9; + + copyToClip(client(concat$5(_context7 = concat$5(_context8 = concat$5(_context9 = "
\n
")).call(_context8, html, "
\n
")).call(_context7, mathStyle + echartStyle + cherryStyle))); + + _this2.toggleLoading(); + }); + } + }]); + + return Copy; + }(MenuBase); + + function convertImgToBase64(url, callback, outputFormat) { + return new promise$7(function (resolve) { + var canvas = + /** @type {HTMLCanvasElement}*/ + document.createElement('CANVAS'); + var ctx = canvas.getContext('2d'); + var img = new Image(); + img.crossOrigin = 'Anonymous'; + + img.onload = function () { + canvas.height = img.height; + canvas.width = img.width; + ctx.drawImage(img, 0, 0); + var dataURL = canvas.toDataURL(outputFormat || 'image/png'); + resolve(dataURL); + canvas = null; + }; + + img.src = url; + }); + } + + function _createSuper$1k(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1k(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1k() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + /** + * 插入面板 + */ + + var Panel$1 = /*#__PURE__*/function (_MenuBase) { + _inherits(Panel, _MenuBase); + + var _super = _createSuper$1k(Panel); + + function Panel($cherry) { + var _context, _context2, _context3, _context4, _context5; + + var _this; + + _classCallCheck(this, Panel); + + _this = _super.call(this, $cherry); + + _this.setName('panel', 'tips'); + + _this.panelRule = getPanelRule().reg; + _this.subMenuConfig = [{ + iconName: 'tips', + name: 'tips', + onclick: bind$5(_context = _this.bindSubClick).call(_context, _assertThisInitialized(_this), 'primary') + }, { + iconName: 'info', + name: 'info', + onclick: bind$5(_context2 = _this.bindSubClick).call(_context2, _assertThisInitialized(_this), 'info') + }, { + iconName: 'warning', + name: 'warning', + onclick: bind$5(_context3 = _this.bindSubClick).call(_context3, _assertThisInitialized(_this), 'warning') + }, { + iconName: 'danger', + name: 'danger', + onclick: bind$5(_context4 = _this.bindSubClick).call(_context4, _assertThisInitialized(_this), 'danger') + }, { + iconName: 'success', + name: 'success', + onclick: bind$5(_context5 = _this.bindSubClick).call(_context5, _assertThisInitialized(_this), 'success') + }]; + return _this; + } + /** + * 从字符串中找打面板的name + * @param {string} str + * @returns {string | false} + */ + + + _createClass(Panel, [{ + key: "$getNameFromStr", + value: function $getNameFromStr(str) { + var ret = false; + this.panelRule.lastIndex = 0; + str.replace(this.panelRule, function (match, preLines, name, content) { + var $name = /\s/.test(trim$3(name).call(name)) ? trim$3(name).call(name).replace(/\s.*$/, '') : name; + ret = $name ? trim$3($name).call($name).toLowerCase() : ''; + return match; + }); + return ret; + } + }, { + key: "$getTitle", + value: function $getTitle(str) { + this.panelRule.lastIndex = 0; + str.replace(this.panelRule, function (match, preLines, name, content) { + var $name = trim$3(name).call(name); + + return /\s/.test($name) ? $name.replace(/[^\s]+\s/, '') : ''; + }); + return ''; + } + /** + * 响应点击事件 + * @param {string} selection 被用户选中的文本内容 + * @param {string} shortKey 快捷键参数 + * @returns {string} 回填到编辑器光标位置/选中文本区域的内容 + */ + + }, { + key: "onClick", + value: function onClick(selection) { + var _this2 = this, + _context9, + _context10; + + var shortKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var $selection = getSelection(this.editor.editor, selection, 'line', true) || '内容'; + var currentName = this.$getNameFromStr($selection); + var title = this.$getTitle($selection); + + if (currentName === false) { + // 如果没有命中面板语法,则尝试扩大选区 + this.getMoreSelection('::: ', '\n', function () { + var newSelection = _this2.editor.editor.getSelection(); + + var isMatch = _this2.$getNameFromStr(newSelection); + + if (isMatch !== false) { + $selection = newSelection; + currentName = isMatch; + title = _this2.$getTitle(newSelection); + } + + return isMatch !== false; + }); + } + + if (currentName !== false) { + // 如果命中了面板语法,则尝试去掉语法或者变更语法 + if (currentName === shortKey) { + // 去掉面板语法 + this.panelRule.lastIndex = 0; + return $selection.replace(this.panelRule, function (match, preLines, name, content) { + var _context6; + + var $name = trim$3(name).call(name); + + var $title = /\s/.test($name) ? $name.replace(/[^\s]+\s/, '') : ''; + return concat$5(_context6 = "".concat($title, "\n")).call(_context6, content); + }); + } // 修改name + + + this.registerAfterClickCb(function () { + _this2.setLessSelection('::: ', '\n'); + }); + this.panelRule.lastIndex = 0; + return $selection.replace(this.panelRule, function (match, preLines, name, content) { + var _context7, _context8; + + var $name = trim$3(name).call(name); + + var $title = /\s/.test($name) ? $name.replace(/[^\s]+\s/, '') : ''; + return concat$5(_context7 = concat$5(_context8 = "::: ".concat(shortKey, " ")).call(_context8, $title, "\n")).call(_context7, content.replace(/\n+$/, ''), "\n:::"); + }); + } + + this.registerAfterClickCb(function () { + _this2.setLessSelection('::: ', '\n'); + }); + $selection = $selection.replace(/^\n+/, ''); + + if (/\n/.test($selection)) { + if (!title) { + title = $selection.replace(/\n[\w\W]+$/, ''); + $selection = $selection.replace(/^[^\n]+\n/, ''); + } + } else { + title = title ? title : '标题'; + } + + return concat$5(_context9 = concat$5(_context10 = "::: ".concat(shortKey, " ")).call(_context10, title, "\n")).call(_context9, $selection, "\n:::").replace(/\n{2,}:::/g, '\n:::'); + } + }]); + + return Panel; + }(MenuBase); + + function _createSuper$1l(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1l(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1l() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + /** + * 插入对齐方式 + */ + + var Justify = /*#__PURE__*/function (_Panel) { + _inherits(Justify, _Panel); + + var _super = _createSuper$1l(Justify); + + function Justify($cherry) { + var _context, _context2, _context3; + + var _this; + + _classCallCheck(this, Justify); + + _this = _super.call(this, $cherry); + + _this.setName('justify', 'justify'); + + _this.panelRule = getPanelRule().reg; + _this.subMenuConfig = [{ + iconName: 'justifyLeft', + name: '左对齐', + onclick: bind$5(_context = _this.bindSubClick).call(_context, _assertThisInitialized(_this), 'left') + }, { + iconName: 'justifyCenter', + name: '居中', + onclick: bind$5(_context2 = _this.bindSubClick).call(_context2, _assertThisInitialized(_this), 'center') + }, { + iconName: 'justifyRight', + name: '右对齐', + onclick: bind$5(_context3 = _this.bindSubClick).call(_context3, _assertThisInitialized(_this), 'right') + }]; + return _this; + } + + _createClass(Justify, [{ + key: "$getTitle", + value: function $getTitle() { + return ' '; + } + }]); + + return Justify; + }(Panel$1); + + function _createSuper$1m(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1m(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1m() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + /** + * 插入手风琴 + */ + + var Detail$1 = /*#__PURE__*/function (_MenuBase) { + _inherits(Detail, _MenuBase); + + var _super = _createSuper$1m(Detail); + + function Detail($cherry) { + var _this; + + _classCallCheck(this, Detail); + + _this = _super.call(this, $cherry); + + _this.setName('detail', 'insertFlow'); + + _this.detailRule = getDetailRule().reg; + return _this; + } + /** + * 响应点击事件 + * @param {string} selection 被用户选中的文本内容 + * @returns {string} 回填到编辑器光标位置/选中文本区域的内容 + */ + + + _createClass(Detail, [{ + key: "onClick", + value: function onClick(selection) { + var _this2 = this; + + var $selection = getSelection(this.editor.editor, selection, 'line', true) || '点击展开更多\n内容\n++- 默认展开\n内容\n++ 默认收起\n内容'; + this.detailRule.lastIndex = 0; + + if (!this.detailRule.test($selection)) { + // 如果没有命中手风琴语法,则尝试扩大选区 + this.getMoreSelection('+++ ', '\n', function () { + var newSelection = _this2.editor.editor.getSelection(); + + _this2.detailRule.lastIndex = 0; + + var isMatch = _this2.detailRule.test(newSelection); + + if (isMatch !== false) { + $selection = newSelection; + } + + return isMatch !== false; + }); + } + + this.detailRule.lastIndex = 0; + + if (this.detailRule.test($selection)) { + // 如果命中了手风琴语法,则去掉手风琴语法 + this.detailRule.lastIndex = 0; + return $selection.replace(this.detailRule, function (match, preLines, isOpen, title, content) { + var _context; + + return concat$5(_context = "".concat(title, "\n")).call(_context, content); + }); + } // 去掉开头的空格 + + + $selection = $selection.replace(/^\s+/, ''); // 如果选中的内容不包含换行,则强制增加一个换行 + + if (!/\n/.test($selection)) { + var _context2; + + $selection = concat$5(_context2 = "".concat($selection, "\n")).call(_context2, $selection); + } + + this.registerAfterClickCb(function () { + _this2.setLessSelection('+++ ', '\n'); + }); + return "+++ ".concat($selection, "\n+++").replace(/\n{2,}\+\+\+/g, '\n+++'); + } + }]); + + return Detail; + }(MenuBase); + + function _createSuper$1n(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1n(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1n() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + /** + * 打开draw.io画图对话框,点击确定后向编辑器插入图片语法 + */ + + var DrawIo = /*#__PURE__*/function (_MenuBase) { + _inherits(DrawIo, _MenuBase); + + var _super = _createSuper$1n(DrawIo); + + function DrawIo($cherry) { + var _this; + + _classCallCheck(this, DrawIo); + + _this = _super.call(this, $cherry); + + _this.setName('draw.io', 'draw.io'); + + _this.noIcon = true; + _this.drawioIframeUrl = $cherry.options.drawioIframeUrl; + return _this; + } + /** + * 响应点击事件 + * @param {string} selection 被用户选中的文本内容 + * @param {string} shortKey 快捷键参数,本函数不处理这个参数 + * @returns {string} 回填到编辑器光标位置/选中文本区域的内容 + */ + + + _createClass(DrawIo, [{ + key: "onClick", + value: function onClick(selection) { + var _this2 = this; + + if (!this.drawioIframeUrl) { + // 如果没有配置drawio的编辑页URL,则直接失效 + return selection; + } + + if (this.hasCacheOnce()) { + var _context; + + // @ts-ignore + var _this$getAndCleanCach = this.getAndCleanCacheOnce(), + xmlData = _this$getAndCleanCach.xmlData, + base64 = _this$getAndCleanCach.base64; + + var begin = '!['; + + var end = concat$5(_context = "](".concat(base64, "){data-type=drawio data-xml=")).call(_context, encodeURI(xmlData), "}"); + + this.registerAfterClickCb(function () { + _this2.setLessSelection(begin, end); + }); + return "".concat(begin, "\u5728\u9884\u89C8\u533A\u70B9\u51FB\u56FE\u7247\u91CD\u65B0\u7F16\u8F91draw.io").concat(end); + } // 插入图片,调用上传文件逻辑 + + + drawioDialog(this.drawioIframeUrl, '', function (data) { + _this2.setCacheOnce(data); + + _this2.fire(null); + }); + this.updateMarkdown = false; + return selection; + } + }]); + + return DrawIo; + }(MenuBase); + + // 目前不支持按需动态加载 + // 如果对CherryMarkdown构建后的文件大小有比较严格的要求,可以根据实际情况删减hook + + var HookList = { + bold: Bold, + italic: Italic, + '|': Split, + strikethrough: Strikethrough$1, + sub: Sub$1, + sup: Sup$1, + header: Header$1, + insert: Insert, + list: List$1, + ol: Ol, + ul: Ul, + checklist: Checklist, + graph: Graph, + size: Size$1, + h1: H1, + h2: H2, + h3: H3, + color: Color$1, + quote: Quote, + quickTable: QuickTable, + togglePreview: TogglePreview, + code: Code, + codeTheme: CodeTheme, + "export": Export, + settings: Settings, + fullScreen: FullScreen, + mobilePreview: MobilePreview, + copy: Copy, + undo: Undo, + redo: Redo, + underline: Underline$1, + switchModel: SwitchModel, + image: Image$2, + audio: Audio, + video: Video, + br: Br$1, + hr: Hr$1, + formula: Formula, + link: Link$1, + table: Table$1, + toc: Toc$1, + lineTable: LineTable, + barTable: BrTable, + pdf: Pdf, + word: Word, + ruby: Ruby$1, + theme: Theme, + file: File, + panel: Panel$1, + justify: Justify, + detail: Detail$1, + drawIo: DrawIo, + chatgpt: ChatGpt + }; + + var HookCenter$1 = /*#__PURE__*/function () { + function HookCenter(toolbar) { + _classCallCheck(this, HookCenter); + + this.toolbar = toolbar; + /** + * @type {{[key: string]: import('@/toolbars/MenuBase').default}} 保存所有菜单实例 + */ + + this.hooks = {}; + /** + * @type {string[]} 所有注册的菜单名称 + */ + + this.allMenusName = []; + /** + * @type {string[]} 一级菜单的名称 + */ + + this.level1MenusName = []; + /** + * @type {{ [parentName: string]: string[]}} 二级菜单的名称, e.g. {一级菜单名称: [二级菜单名称1, 二级菜单名称2]} + */ + + this.level2MenusName = {}; + this.init(); + } + + _createClass(HookCenter, [{ + key: "$newMenu", + value: function $newMenu(name) { + if (this.hooks[name]) { + return; + } + + var _this$toolbar$options = this.toolbar.options, + $cherry = _this$toolbar$options.$cherry, + customMenu = _this$toolbar$options.customMenu; + + if (HookList[name]) { + this.allMenusName.push(name); + this.hooks[name] = new HookList[name]($cherry); + } else if (customMenu !== undefined && customMenu !== null && customMenu[name]) { + this.allMenusName.push(name); // 如果是自定义菜单,传参兼容旧版 + + this.hooks[name] = new customMenu[name]($cherry); + } + } + /** + * 根据配置动态渲染、绑定工具栏 + * @returns + */ + + }, { + key: "init", + value: function init() { + var _this = this; + + var buttonConfig = this.toolbar.options.buttonConfig; + + forEach$3(buttonConfig).call(buttonConfig, function (item) { + if (typeof item === 'string') { + _this.level1MenusName.push(item); + + _this.$newMenu(item); + } else if (_typeof(item) === 'object') { + var keys = keys$3(item); + + if (keys.length === 1) { + var _context; + + // 只接受形如{ name: [ subMenu ] }的参数 + var _keys = _slicedToArray(keys, 1), + name = _keys[0]; + + _this.level1MenusName.push(name); + + _this.$newMenu(name); + + _this.level2MenusName[name] = item[name]; + + forEach$3(_context = item[name]).call(_context, function (subItem) { + _this.$newMenu(subItem); + }); + } + } + }); + } + }]); + + return HookCenter; + }(); + + var Toolbar = /*#__PURE__*/function () { + /** + * @type {Record} 外部获取 toolbarHandler + */ + function Toolbar(options) { + _classCallCheck(this, Toolbar); + + _defineProperty(this, "toolbarHandlers", {}); + + // 存储所有菜单的实例 + this.menus = {}; // 存储所有快捷键的影射 {快捷键: 菜单名称} + + this.shortcutKeyMap = {}; // 存储所有二级菜单面板 + + this.subMenus = {}; // 默认的菜单配置 + + this.options = { + dom: document.createElement('div'), + buttonConfig: ['bold'], + customMenu: [], + buttonRightConfig: [] + }; + + assign$2(this.options, options); + + this.$cherry = this.options.$cherry; + this.instanceId = this.$cherry.instanceId; + this.menus = new HookCenter$1(this); + this.drawMenus(); + this.init(); + } + + _createClass(Toolbar, [{ + key: "init", + value: function init() { + var _this = this; + + this.collectShortcutKey(); + this.collectToolbarHandler(); + Event$1.on(this.instanceId, Event$1.Events.cleanAllSubMenus, function () { + return _this.hideAllSubMenu(); + }); + } + }, { + key: "previewOnly", + value: function previewOnly() { + this.options.dom.classList.add('preview-only'); + Event$1.emit(this.instanceId, Event$1.Events.toolbarHide); + } + }, { + key: "showToolbar", + value: function showToolbar() { + this.options.dom.classList.remove('preview-only'); + Event$1.emit(this.instanceId, Event$1.Events.toolbarShow); + } + }, { + key: "isHasLevel2Menu", + value: function isHasLevel2Menu(name) { + // FIXME: return boolean + return this.menus.level2MenusName[name]; + } + }, { + key: "isHasConfigMenu", + value: function isHasConfigMenu(name) { + // FIXME: return boolean + return this.menus.hooks[name].subMenuConfig || []; + } + /** + * 判断是否有子菜单,目前有两种子菜单配置方式:1、通过`subMenuConfig`属性 2、通过`buttonConfig`配置属性 + * @param {string} name + * @returns {boolean} 是否有子菜单 + */ + + }, { + key: "isHasSubMenu", + value: function isHasSubMenu(name) { + return Boolean(this.isHasLevel2Menu(name) || this.isHasConfigMenu(name).length > 0); + } + /** + * 根据配置画出来一级工具栏 + */ + + }, { + key: "drawMenus", + value: function drawMenus() { + var _context, + _this2 = this, + _this$options$buttonR; + + var fragLeft = document.createDocumentFragment(); + var toolbarLeft = createElement('div', 'toolbar-left'); + + forEach$3(_context = this.menus.level1MenusName).call(_context, function (name) { + var btn = _this2.menus.hooks[name].createBtn(); + + btn.addEventListener('click', function (event) { + _this2.onClick(event, name); + }, false); + + if (_this2.isHasSubMenu(name)) { + btn.classList.add('cherry-toolbar-dropdown'); + } + + fragLeft.appendChild(btn); + }); + + toolbarLeft.appendChild(fragLeft); + this.options.dom.appendChild(toolbarLeft); + (_this$options$buttonR = this.options.buttonRightConfig) !== null && _this$options$buttonR !== void 0 && _this$options$buttonR.length ? this.drawRightMenus(this.options.buttonRightConfig) : null; + } + /** + * 根据配置画出来右侧一级工具栏 + */ + + }, { + key: "drawRightMenus", + value: function drawRightMenus(buttonRightConfig) { + var _context2; + + var toolbarRight = createElement('div', 'toolbar-right'); + var fragRight = document.createDocumentFragment(); + var rightOptions = { + options: { + $cherry: this.$cherry, + buttonConfig: buttonRightConfig, + customMenu: [] + } + }; + var rightMenus = new HookCenter$1(rightOptions); + + forEach$3(_context2 = rightMenus.level1MenusName).call(_context2, function (name) { + var btn = rightMenus.hooks[name].createBtn(); + btn.addEventListener('click', function (event) { + console.log('第一次点击'); + rightMenus.hooks[name].fire(event, name); + }, false); + fragRight.appendChild(btn); + }); + + toolbarRight.appendChild(fragRight); + this.options.dom.appendChild(toolbarRight); + } + }, { + key: "setSubMenuPosition", + value: function setSubMenuPosition(menuObj, subMenuObj) { + var pos = menuObj.getMenuPosition(); + subMenuObj.style.left = "".concat(pos.left + pos.width / 2, "px"); + subMenuObj.style.top = "".concat(pos.top + pos.height, "px"); + subMenuObj.style.position = menuObj.positionModel; + } + }, { + key: "drawSubMenus", + value: function drawSubMenus(name) { + var _this3 = this; + + this.subMenus[name] = createElement('div', 'cherry-dropdown', { + name: name + }); + this.setSubMenuPosition(this.menus.hooks[name], this.subMenus[name]); // 如果有配置的二级菜单 + + var level2MenusName = this.isHasLevel2Menu(name); + + if (level2MenusName) { + forEach$3(level2MenusName).call(level2MenusName, function (level2Name) { + var subMenu = _this3.menus.hooks[level2Name]; + + if (subMenu !== undefined && typeof subMenu.createBtn === 'function') { + var btn = subMenu.createBtn(true); // 二级菜单的dom认定为一级菜单的 + + subMenu.dom = subMenu.dom ? subMenu.dom : _this3.menus.hooks[name].dom; + btn.addEventListener('click', function (event) { + return _this3.onClick(event, level2Name, true); + }, false); + + _this3.subMenus[name].appendChild(btn); + } + }); + } // 兼容旧版本配置的二级菜单 + + + var subMenuConfig = this.isHasConfigMenu(name); + + if (subMenuConfig.length > 0) { + forEach$3(subMenuConfig).call(subMenuConfig, function (config) { + var btn = _this3.menus.hooks[name].createSubBtnByConfig(config); + + btn.addEventListener('click', function () { + return _this3.hideAllSubMenu(); + }, false); + + _this3.subMenus[name].appendChild(btn); + }); + } + + this.$cherry.wrapperDom.appendChild(this.subMenus[name]); + } + /** + * 处理点击事件 + */ + + }, { + key: "onClick", + value: function onClick(event, name) { + var focusEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var menu = this.menus.hooks[name]; + + if (!menu) { + return; + } + + if (this.isHasSubMenu(name) && !focusEvent) { + this.toggleSubMenu(name); + } else { + this.hideAllSubMenu(); + menu.fire(event, name); + } + } + /** + * 展开/收起二级菜单 + */ + + }, { + key: "toggleSubMenu", + value: function toggleSubMenu(name) { + if (!this.subMenus[name]) { + // 如果没有二级菜单,则先画出来,然后再显示 + this.hideAllSubMenu(); + this.drawSubMenus(name); + this.subMenus[name].style.display = 'block'; + return; + } + + if (this.subMenus[name].style.display === 'none') { + // 如果是隐藏的,则先隐藏所有二级菜单,再显示当前二级菜单 + this.hideAllSubMenu(); + this.subMenus[name].style.display = 'block'; + this.setSubMenuPosition(this.menus.hooks[name], this.subMenus[name]); + } else { + // 如果是显示的,则隐藏当前二级菜单 + this.subMenus[name].style.display = 'none'; + } + } + /** + * 隐藏所有的二级菜单 + */ + + }, { + key: "hideAllSubMenu", + value: function hideAllSubMenu() { + var _context3; + + forEach$3(_context3 = this.$cherry.wrapperDom.querySelectorAll('.cherry-dropdown')).call(_context3, function (dom) { + dom.style.display = 'none'; + }); + } + /** + * 收集快捷键 + */ + + }, { + key: "collectShortcutKey", + value: function collectShortcutKey() { + var _context4, + _this4 = this; + + forEach$3(_context4 = this.menus.allMenusName).call(_context4, function (name) { + var _this4$menus$hooks$na; + + (_this4$menus$hooks$na = _this4.menus.hooks[name].shortcutKeys) === null || _this4$menus$hooks$na === void 0 ? void 0 : forEach$3(_this4$menus$hooks$na).call(_this4$menus$hooks$na, function (key) { + _this4.shortcutKeyMap[key] = name; + }); + }); + } + }, { + key: "collectToolbarHandler", + value: function collectToolbarHandler() { + var _context5, + _this5 = this; + + this.toolbarHandlers = reduce$3(_context5 = this.menus.allMenusName).call(_context5, function (handlerMap, name) { + var menuHook = _this5.menus.hooks[name]; + + if (!menuHook) { + return handlerMap; + } + + handlerMap[name] = function (shortcut, _callback) { + if (typeof _callback === 'function') { + Logger.warn('MenuBase#onClick param callback is no longer supported. Please register the callback via MenuBase#registerAfterClickCb instead.'); + } + + menuHook.fire.call(menuHook, undefined, shortcut); + }; + + return handlerMap; + }, {}); + } + /** + * 监测是否有对应的快捷键 + * @param {KeyboardEvent} evt keydown 事件 + * @returns {boolean} 是否有对应的快捷键 + */ + + }, { + key: "matchShortcutKey", + value: function matchShortcutKey(evt) { + return !!this.shortcutKeyMap[this.getCurrentKey(evt)]; + } + /** + * 触发对应快捷键的事件 + * @param {KeyboardEvent} evt + */ + + }, { + key: "fireShortcutKey", + value: function fireShortcutKey(evt) { + var _this$menus$hooks$thi; + + var currentKey = this.getCurrentKey(evt); + (_this$menus$hooks$thi = this.menus.hooks[this.shortcutKeyMap[currentKey]]) === null || _this$menus$hooks$thi === void 0 ? void 0 : _this$menus$hooks$thi.fire(evt, currentKey); + } + /** + * 格式化当前按键,mac下的command按键转换为ctrl + * @param {KeyboardEvent} event + * @returns + */ + + }, { + key: "getCurrentKey", + value: function getCurrentKey(event) { + var key = ''; + + if (event.ctrlKey) { + key += 'Ctrl-'; + } + + if (event.altKey) { + key += 'Alt-'; + } + + if (event.metaKey && mac) { + key += 'Ctrl-'; + } // 如果存在shift键 + + + if (event.shiftKey) { + key += "Shift-"; + } // 如果还有第三个键 且不是 shift键 + + + if (event.key && event.key.toLowerCase() !== 'shift') { + key += event.key.toLowerCase(); + } + + return key; + } + }]); + + return Toolbar; + }(); + + function _createSuper$1o(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1o(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1o() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + /** + * 在编辑区域选中文本时浮现的bubble工具栏 + */ + + var Bubble = /*#__PURE__*/function (_Toolbar) { + _inherits(Bubble, _Toolbar); + + var _super = _createSuper$1o(Bubble); + + function Bubble() { + _classCallCheck(this, Bubble); + + return _super.apply(this, arguments); + } + + _createClass(Bubble, [{ + key: "visible", + get: function get() { + var bubbleStyle = window.getComputedStyle(this.bubbleDom); + return bubbleStyle.display !== 'none' && bubbleStyle.visibility !== 'hidden'; + }, + set: + /** + * @type {'flex' | 'block'} + */ + // constructor(options) { + // super(options); + // } + function set(visible) { + var bubbleStyle = window.getComputedStyle(this.bubbleDom); + + if (visible) { + bubbleStyle.display === 'none' && (this.bubbleDom.style.display = Bubble.displayType); // bubbleStyle.visibility !== 'visible' && (this.bubbleBottom.style.visibility = 'visible'); + } else { + bubbleStyle.display !== 'none' && (this.bubbleDom.style.display = 'none'); // bubbleStyle.visibility !== 'hidden' && (this.bubbleBottom.style.visibility = 'hidden'); + } + } + }, { + key: "init", + value: function init() { + this.options.editor = this.$cherry.editor; + this.addSelectionChangeListener(); + this.bubbleDom = this.options.dom; + this.editorDom = this.options.editor.getEditorDom(); + this.initBubbleDom(); + this.editorDom.querySelector('.CodeMirror').appendChild(this.bubbleDom); + } + /** + * 计算编辑区域的偏移量 + * @returns {number} 编辑区域的滚动区域 + */ + + }, { + key: "getScrollTop", + value: function getScrollTop() { + return this.options.editor.editor.getScrollInfo().top; + } + /** + * 当编辑区域滚动的时候自动隐藏bubble工具栏和子工具栏 + */ + + }, { + key: "updatePositionWhenScroll", + value: function updatePositionWhenScroll() { + if (this.bubbleDom.style.display === Bubble.displayType) { + this.bubbleDom.style.marginTop = "".concat(_parseFloat$2(this.bubbleDom.dataset.scrollTop) - this.getScrollTop(), "px"); + } + } + /** + * 根据高度计算bubble工具栏出现的位置的高度 + * 根据宽度计算bubble工具栏出现的位置的left值,以及bubble工具栏三角箭头的left值 + * @param {number} top 高度 + * @param {number} width 选中文本内容的宽度 + */ + + }, { + key: "showBubble", + value: function showBubble(top, width) { + if (!this.visible) { + this.visible = true; + this.bubbleDom.style.marginTop = '0'; + this.bubbleDom.dataset.scrollTop = String(this.getScrollTop()); + } + + var positionLimit = this.editorDom.querySelector('.CodeMirror-lines').firstChild.getBoundingClientRect(); + var editorPosition = this.editorDom.getBoundingClientRect(); + var minLeft = positionLimit.left - editorPosition.left; + var maxLeft = positionLimit.width + minLeft; + var minTop = this.bubbleDom.offsetHeight * 2; + var $top = top; + + if ($top < minTop) { + // 如果高度小于编辑器的顶部,则让bubble工具栏出现在选中文本的下放 + $top += this.bubbleDom.offsetHeight - this.bubbleTop.getBoundingClientRect().height; + this.bubbleTop.style.display = 'block'; + this.bubbleBottom.style.display = 'none'; + } else { + // 反之出现在选中文本内容的上方 + $top -= this.bubbleDom.offsetHeight + 2 * this.bubbleBottom.getBoundingClientRect().height; + this.bubbleTop.style.display = 'none'; + this.bubbleBottom.style.display = 'block'; + } + + this.bubbleDom.style.top = "".concat($top, "px"); + var left = width - this.bubbleDom.offsetWidth / 2; + + if (left < minLeft) { + // 如果位置超过了编辑器的最左边,则控制bubble工具栏不超出编辑器最左边 + // 同时bubble工具栏上的箭头尽量指向选中文本内容的中间位置 + left = minLeft; + this.$setBubbleCursorPosition("".concat(width - minLeft, "px")); + } else if (left + this.bubbleDom.offsetWidth > maxLeft) { + // 如果位置超过了编辑器的最右边,则控制bubble工具栏不超出编辑器最右边 + // 同时bubble工具栏上的箭头尽量指向选中文本内容的中间位置 + left = maxLeft - this.bubbleDom.offsetWidth; + this.$setBubbleCursorPosition("".concat(width - left, "px")); + } else { + // 让bubble工具栏的箭头处于工具栏的中间位置 + this.$setBubbleCursorPosition('50%'); + } // 安全边距 20px + + + this.bubbleDom.style.left = "".concat(Math.max(20, left), "px"); + } + }, { + key: "hideBubble", + value: function hideBubble() { + this.visible = false; + } + /** + * 控制bubble工具栏的箭头的位置 + * @param {string} left 左偏移量 + */ + + }, { + key: "$setBubbleCursorPosition", + value: function $setBubbleCursorPosition() { + var left = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '50%'; + + if (left === '50%') { + this.bubbleTop.style.left = '50%'; + this.bubbleBottom.style.left = '50%'; + } else { + var $left = _parseFloat$2(left) < 10 ? '10px' : left; + this.bubbleTop.style.left = $left; + this.bubbleBottom.style.left = $left; + } + } + }, { + key: "initBubbleDom", + value: function initBubbleDom() { + var top = document.createElement('div'); + top.className = 'cherry-bubble-top'; + var bottom = document.createElement('div'); + bottom.className = 'cherry-bubble-bottom'; + this.bubbleTop = top; + this.bubbleBottom = bottom; + this.bubbleDom.appendChild(top); + this.bubbleDom.appendChild(bottom); // 默认不可见 + + this.visible = false; + } + }, { + key: "getBubbleDom", + value: function getBubbleDom() { + return this.bubbleDom; + } + }, { + key: "addSelectionChangeListener", + value: function addSelectionChangeListener() { + var _this = this; + + this.options.editor.addListener('change', function (codemirror) { + // 当编辑区内容变更时自动隐藏bubble工具栏 + _this.hideBubble(); + }); + this.options.editor.addListener('refresh', function (codemirror) { + // 当编辑区内容刷新时自动隐藏bubble工具栏 + _this.hideBubble(); + }); + this.options.editor.addListener('scroll', function (codemirror) { + // 当编辑区滚动时,需要实时同步bubble工具栏的位置 + _this.updatePositionWhenScroll(); + }); + this.options.editor.addListener('beforeSelectionChange', function (codemirror, info) { + // 当编辑区选中内容改变时,需要展示/隐藏bubble工具栏,并计算工具栏位置 + if (info.origin !== '*mouse' && (info.origin !== null || typeof info.origin === 'undefined')) { + return true; + } + + if (!info.ranges[0]) { + return true; + } + + var anchor = info.ranges[0].anchor.line * 1000000 + info.ranges[0].anchor.ch; + var head = info.ranges[0].head.line * 1000000 + info.ranges[0].head.ch; + var direction = 'asc'; + + if (anchor > head) { + direction = 'desc'; + } + + setTimeout$3(function () { + var selections = codemirror.getSelections(); + + if (selections.join('').length <= 0) { + _this.hideBubble(); + + return; + } + + var selectedObjs = codemirror.getWrapperElement().getElementsByClassName('CodeMirror-selected'); + + var editorPosition = _this.editorDom.getBoundingClientRect(); + + var width = 0; + var top = 0; + + if (_typeof(selectedObjs) !== 'object' || selectedObjs.length <= 0) { + _this.hideBubble(); + + return; + } + + for (var key = 0; key < selectedObjs.length; key++) { + var one = selectedObjs[key]; + var position = one.getBoundingClientRect(); + var targetTop = position.top - editorPosition.top; + + if (direction === 'asc') { + if (targetTop >= top) { + top = targetTop; + width = position.left - editorPosition.left + position.width / 2; + } + } else { + if (targetTop <= top || top <= 0) { + top = targetTop; + width = position.left - editorPosition.left + position.width / 2; + } + } + } + + _this.showBubble(top, width); + }, 10); + }); + } + }]); + + return Bubble; + }(Toolbar); + + _defineProperty(Bubble, "displayType", 'flex'); + + function _createSuper$1p(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1p(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1p() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + /** + * 当光标处于编辑器新行起始位置时出现的浮动工具栏 + */ + + var FloatMenu = /*#__PURE__*/function (_Toolbar) { + _inherits(FloatMenu, _Toolbar); + + var _super = _createSuper$1p(FloatMenu); + + function FloatMenu() { + _classCallCheck(this, FloatMenu); + + return _super.apply(this, arguments); + } + + _createClass(FloatMenu, [{ + key: "init", + value: // constructor(options) { + // super(options); + // } + function init() { + this.editor = this.$cherry.editor; + this.editorDom = this.editor.getEditorDom(); + this.editorDom.querySelector('.CodeMirror-scroll').appendChild(this.options.dom); + this.initAction(); + } + }, { + key: "initAction", + value: function initAction() { + var self = this; + this.editor.addListener('cursorActivity', function (codemirror, evt) { + // 当编辑区光标位置改变时触发 + self.cursorActivity(evt, codemirror); + }); + this.editor.addListener('update', function (codemirror, evt) { + // 当编辑区内容改变时触发 + self.cursorActivity(evt, codemirror); + }); + this.editor.addListener('refresh', function (codemirror, evt) { + // 当编辑器刷新时触发 + setTimeout$3(function () { + self.cursorActivity(evt, codemirror); + }, 0); + }); + } + }, { + key: "update", + value: function update(evt, codeMirror) { + var pos = codeMirror.getCursor(); + + if (this.isHidden(pos.line, codeMirror)) { + this.options.dom.style.display = 'none'; + return false; + } + + this.options.dom.style.display = 'inline-block'; + } + /** + * 当光标激活时触发,当光标处于行起始位置时展示float工具栏;反之隐藏 + * @param {Event} evt + * @param {CodeMirror.Editor} codeMirror + * @returns + */ + + }, { + key: "cursorActivity", + value: function cursorActivity(evt, codeMirror) { + var pos = codeMirror.getCursor(); + var codeMirrorLines = document.querySelector('.cherry-editor .CodeMirror-lines'); + + if (!codeMirrorLines) { + return false; + } + + var computedLinesStyle = getComputedStyle(codeMirrorLines); + + var codeWrapPaddingLeft = _parseFloat$2(computedLinesStyle.paddingLeft); + + var codeWrapPaddingTop = _parseFloat$2(computedLinesStyle.paddingTop); // const cursorHandle = codeMirror.getLineHandle(pos.line); + // const verticalMiddle = cursorHandle.height * 1 / 2; + + + if (this.isHidden(pos.line, codeMirror)) { + this.options.dom.style.display = 'none'; + return false; + } + + this.options.dom.style.display = 'inline-block'; + this.options.dom.style.left = "".concat(codeWrapPaddingLeft, "px"); + this.options.dom.style.top = "".concat(this.getLineHeight(pos.line, codeMirror) + codeWrapPaddingTop, "px"); + } + /** + * 判断是否需要隐藏Float工具栏 + * 有选中内容,或者光标所在行有内容时隐藏float 工具栏 + * @param {number} line + * @param {CodeMirror.Editor} codeMirror + * @returns {boolean} 是否需要隐藏float工具栏,true:需要隐藏 + */ + + }, { + key: "isHidden", + value: function isHidden(line, codeMirror) { + var selections = codeMirror.getSelections(); + + if (selections.length > 1) { + return true; + } + + var selection = codeMirror.getSelection(); + + if (selection.length > 0) { + return true; + } + + if (codeMirror.getLine(line)) { + return true; + } + + return false; + } + /** + * 获取对应行的行高度,用来让float 工具栏在该行保持垂直居中 + * @param {number} line + * @param {CodeMirror.Editor} codeMirror + * @returns + */ + + }, { + key: "getLineHeight", + value: function getLineHeight(line, codeMirror) { + var height = 0; + codeMirror.getDoc().eachLine(0, line, function (line) { + height += line.height; + }); + return height; + } + }]); + + return FloatMenu; + }(Toolbar); + + function _createSuper$1q(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1q(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1q() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + /** + * 预览区域右侧悬浮的工具栏 + * 推荐放置跟编辑区域完全无关的工具栏 + * 比如复制预览区域内容、修改预览区域主题等 + */ + + var Sidebar = /*#__PURE__*/function (_Toolbar) { + _inherits(Sidebar, _Toolbar); + + var _super = _createSuper$1q(Sidebar); + + function Sidebar() { + _classCallCheck(this, Sidebar); + + return _super.apply(this, arguments); + } + + return _createClass(Sidebar); + }(Toolbar); + + /** + * This library modifies the diff-patch-match library by Neil Fraser + * by removing the patch and match functionality and certain advanced + * options in the diff function. The original license is as follows: + * + * === + * + * Diff Match and Patch + * + * Copyright 2006 Google Inc. + * http://code.google.com/p/google-diff-match-patch/ + * + * 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. + */ + + + /** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ + var DIFF_DELETE = -1; + var DIFF_INSERT = 1; + var DIFF_EQUAL = 0; + + + /** + * Find the differences between two texts. Simplifies the problem by stripping + * any common prefix or suffix off the texts before diffing. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info + * @return {Array} Array of diff tuples. + */ + function diff_main(text1, text2, cursor_pos, _fix_unicode) { + // Check for equality + if (text1 === text2) { + if (text1) { + return [[DIFF_EQUAL, text1]]; + } + return []; + } + + if (cursor_pos != null) { + var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos); + if (editdiff) { + return editdiff; + } + } + + // Trim off common prefix (speedup). + var commonlength = diff_commonPrefix(text1, text2); + var commonprefix = text1.substring(0, commonlength); + text1 = text1.substring(commonlength); + text2 = text2.substring(commonlength); + + // Trim off common suffix (speedup). + commonlength = diff_commonSuffix(text1, text2); + var commonsuffix = text1.substring(text1.length - commonlength); + text1 = text1.substring(0, text1.length - commonlength); + text2 = text2.substring(0, text2.length - commonlength); + + // Compute the diff on the middle block. + var diffs = diff_compute_(text1, text2); + + // Restore the prefix and suffix. + if (commonprefix) { + diffs.unshift([DIFF_EQUAL, commonprefix]); + } + if (commonsuffix) { + diffs.push([DIFF_EQUAL, commonsuffix]); + } + diff_cleanupMerge(diffs, _fix_unicode); + return diffs; + } + + /** + * Find the differences between two texts. Assumes that the texts do not + * have any common prefix or suffix. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @return {Array} Array of diff tuples. + */ + function diff_compute_(text1, text2) { + var diffs; + + if (!text1) { + // Just add some text (speedup). + return [[DIFF_INSERT, text2]]; + } + + if (!text2) { + // Just delete some text (speedup). + return [[DIFF_DELETE, text1]]; + } + + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + var i = longtext.indexOf(shorttext); + if (i !== -1) { + // Shorter text is inside the longer text (speedup). + diffs = [ + [DIFF_INSERT, longtext.substring(0, i)], + [DIFF_EQUAL, shorttext], + [DIFF_INSERT, longtext.substring(i + shorttext.length)] + ]; + // Swap insertions for deletions if diff is reversed. + if (text1.length > text2.length) { + diffs[0][0] = diffs[2][0] = DIFF_DELETE; + } + return diffs; + } + + if (shorttext.length === 1) { + // Single character string. + // After the previous speedup, the character can't be an equality. + return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; + } + + // Check to see if the problem can be split in two. + var hm = diff_halfMatch_(text1, text2); + if (hm) { + // A half-match was found, sort out the return data. + var text1_a = hm[0]; + var text1_b = hm[1]; + var text2_a = hm[2]; + var text2_b = hm[3]; + var mid_common = hm[4]; + // Send both pairs off for separate processing. + var diffs_a = diff_main(text1_a, text2_a); + var diffs_b = diff_main(text1_b, text2_b); + // Merge the results. + return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b); + } + + return diff_bisect_(text1, text2); + } + + /** + * Find the 'middle snake' of a diff, split the problem in two + * and return the recursively constructed diff. + * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @return {Array} Array of diff tuples. + * @private + */ + function diff_bisect_(text1, text2) { + // Cache the text lengths to prevent multiple calls. + var text1_length = text1.length; + var text2_length = text2.length; + var max_d = Math.ceil((text1_length + text2_length) / 2); + var v_offset = max_d; + var v_length = 2 * max_d; + var v1 = new Array(v_length); + var v2 = new Array(v_length); + // Setting all elements to -1 is faster in Chrome & Firefox than mixing + // integers and undefined. + for (var x = 0; x < v_length; x++) { + v1[x] = -1; + v2[x] = -1; + } + v1[v_offset + 1] = 0; + v2[v_offset + 1] = 0; + var delta = text1_length - text2_length; + // If the total number of characters is odd, then the front path will collide + // with the reverse path. + var front = (delta % 2 !== 0); + // Offsets for start and end of k loop. + // Prevents mapping of space beyond the grid. + var k1start = 0; + var k1end = 0; + var k2start = 0; + var k2end = 0; + for (var d = 0; d < max_d; d++) { + // Walk the front path one step. + for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) { + var k1_offset = v_offset + k1; + var x1; + if (k1 === -d || (k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])) { + x1 = v1[k1_offset + 1]; + } else { + x1 = v1[k1_offset - 1] + 1; + } + var y1 = x1 - k1; + while ( + x1 < text1_length && y1 < text2_length && + text1.charAt(x1) === text2.charAt(y1) + ) { + x1++; + y1++; + } + v1[k1_offset] = x1; + if (x1 > text1_length) { + // Ran off the right of the graph. + k1end += 2; + } else if (y1 > text2_length) { + // Ran off the bottom of the graph. + k1start += 2; + } else if (front) { + var k2_offset = v_offset + delta - k1; + if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) { + // Mirror x2 onto top-left coordinate system. + var x2 = text1_length - v2[k2_offset]; + if (x1 >= x2) { + // Overlap detected. + return diff_bisectSplit_(text1, text2, x1, y1); + } + } + } + } + + // Walk the reverse path one step. + for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) { + var k2_offset = v_offset + k2; + var x2; + if (k2 === -d || (k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])) { + x2 = v2[k2_offset + 1]; + } else { + x2 = v2[k2_offset - 1] + 1; + } + var y2 = x2 - k2; + while ( + x2 < text1_length && y2 < text2_length && + text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1) + ) { + x2++; + y2++; + } + v2[k2_offset] = x2; + if (x2 > text1_length) { + // Ran off the left of the graph. + k2end += 2; + } else if (y2 > text2_length) { + // Ran off the top of the graph. + k2start += 2; + } else if (!front) { + var k1_offset = v_offset + delta - k2; + if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) { + var x1 = v1[k1_offset]; + var y1 = v_offset + x1 - k1_offset; + // Mirror x2 onto top-left coordinate system. + x2 = text1_length - x2; + if (x1 >= x2) { + // Overlap detected. + return diff_bisectSplit_(text1, text2, x1, y1); + } + } + } + } + } + // Diff took too long and hit the deadline or + // number of diffs equals number of characters, no commonality at all. + return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; + } + + /** + * Given the location of the 'middle snake', split the diff in two parts + * and recurse. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} x Index of split point in text1. + * @param {number} y Index of split point in text2. + * @return {Array} Array of diff tuples. + */ + function diff_bisectSplit_(text1, text2, x, y) { + var text1a = text1.substring(0, x); + var text2a = text2.substring(0, y); + var text1b = text1.substring(x); + var text2b = text2.substring(y); + + // Compute both diffs serially. + var diffs = diff_main(text1a, text2a); + var diffsb = diff_main(text1b, text2b); + + return diffs.concat(diffsb); + } + + /** + * Determine the common prefix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the start of each + * string. + */ + function diff_commonPrefix(text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) { + return 0; + } + // Binary search. + // Performance analysis: http://neil.fraser.name/news/2007/10/09/ + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerstart = 0; + while (pointermin < pointermid) { + if ( + text1.substring(pointerstart, pointermid) == + text2.substring(pointerstart, pointermid) + ) { + pointermin = pointermid; + pointerstart = pointermin; + } else { + pointermax = pointermid; + } + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + + if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) { + pointermid--; + } + + return pointermid; + } + + /** + * Determine the common suffix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of each string. + */ + function diff_commonSuffix(text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) { + return 0; + } + // Binary search. + // Performance analysis: http://neil.fraser.name/news/2007/10/09/ + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerend = 0; + while (pointermin < pointermid) { + if ( + text1.substring(text1.length - pointermid, text1.length - pointerend) == + text2.substring(text2.length - pointermid, text2.length - pointerend) + ) { + pointermin = pointermid; + pointerend = pointermin; + } else { + pointermax = pointermid; + } + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + + if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) { + pointermid--; + } + + return pointermid; + } + + /** + * Do the two texts share a substring which is at least half the length of the + * longer text? + * This speedup can produce non-minimal diffs. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {Array.} Five element Array, containing the prefix of + * text1, the suffix of text1, the prefix of text2, the suffix of + * text2 and the common middle. Or null if there was no match. + */ + function diff_halfMatch_(text1, text2) { + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + if (longtext.length < 4 || shorttext.length * 2 < longtext.length) { + return null; // Pointless. + } + + /** + * Does a substring of shorttext exist within longtext such that the substring + * is at least half the length of longtext? + * Closure, but does not reference any external variables. + * @param {string} longtext Longer string. + * @param {string} shorttext Shorter string. + * @param {number} i Start index of quarter length substring within longtext. + * @return {Array.} Five element Array, containing the prefix of + * longtext, the suffix of longtext, the prefix of shorttext, the suffix + * of shorttext and the common middle. Or null if there was no match. + * @private + */ + function diff_halfMatchI_(longtext, shorttext, i) { + // Start with a 1/4 length substring at position i as a seed. + var seed = longtext.substring(i, i + Math.floor(longtext.length / 4)); + var j = -1; + var best_common = ''; + var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b; + while ((j = shorttext.indexOf(seed, j + 1)) !== -1) { + var prefixLength = diff_commonPrefix( + longtext.substring(i), shorttext.substring(j)); + var suffixLength = diff_commonSuffix( + longtext.substring(0, i), shorttext.substring(0, j)); + if (best_common.length < suffixLength + prefixLength) { + best_common = shorttext.substring( + j - suffixLength, j) + shorttext.substring(j, j + prefixLength); + best_longtext_a = longtext.substring(0, i - suffixLength); + best_longtext_b = longtext.substring(i + prefixLength); + best_shorttext_a = shorttext.substring(0, j - suffixLength); + best_shorttext_b = shorttext.substring(j + prefixLength); + } + } + if (best_common.length * 2 >= longtext.length) { + return [ + best_longtext_a, best_longtext_b, + best_shorttext_a, best_shorttext_b, best_common + ]; + } else { + return null; + } + } + + // First check if the second quarter is the seed for a half-match. + var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4)); + // Check again based on the third quarter. + var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2)); + var hm; + if (!hm1 && !hm2) { + return null; + } else if (!hm2) { + hm = hm1; + } else if (!hm1) { + hm = hm2; + } else { + // Both matched. Select the longest. + hm = hm1[4].length > hm2[4].length ? hm1 : hm2; + } + + // A half-match was found, sort out the return data. + var text1_a, text1_b, text2_a, text2_b; + if (text1.length > text2.length) { + text1_a = hm[0]; + text1_b = hm[1]; + text2_a = hm[2]; + text2_b = hm[3]; + } else { + text2_a = hm[0]; + text2_b = hm[1]; + text1_a = hm[2]; + text1_b = hm[3]; + } + var mid_common = hm[4]; + return [text1_a, text1_b, text2_a, text2_b, mid_common]; + } + + /** + * Reorder and merge like edit sections. Merge equalities. + * Any edit section can move as long as it doesn't cross an equality. + * @param {Array} diffs Array of diff tuples. + * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff + */ + function diff_cleanupMerge(diffs, fix_unicode) { + diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end. + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ''; + var text_insert = ''; + var commonlength; + while (pointer < diffs.length) { + if (pointer < diffs.length - 1 && !diffs[pointer][1]) { + diffs.splice(pointer, 1); + continue; + } + switch (diffs[pointer][0]) { + case DIFF_INSERT: + + count_insert++; + text_insert += diffs[pointer][1]; + pointer++; + break; + case DIFF_DELETE: + count_delete++; + text_delete += diffs[pointer][1]; + pointer++; + break; + case DIFF_EQUAL: + var previous_equality = pointer - count_insert - count_delete - 1; + if (fix_unicode) { + // prevent splitting of unicode surrogate pairs. when fix_unicode is true, + // we assume that the old and new text in the diff are complete and correct + // unicode-encoded JS strings, but the tuple boundaries may fall between + // surrogate pairs. we fix this by shaving off stray surrogates from the end + // of the previous equality and the beginning of this equality. this may create + // empty equalities or a common prefix or suffix. for example, if AB and AC are + // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and + // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this + // particular case, both equalities go away, we absorb any previous inequalities, + // and we keep scanning for the next equality before rewriting the tuples. + if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) { + var stray = diffs[previous_equality][1].slice(-1); + diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1); + text_delete = stray + text_delete; + text_insert = stray + text_insert; + if (!diffs[previous_equality][1]) { + // emptied out previous equality, so delete it and include previous delete/insert + diffs.splice(previous_equality, 1); + pointer--; + var k = previous_equality - 1; + if (diffs[k] && diffs[k][0] === DIFF_INSERT) { + count_insert++; + text_insert = diffs[k][1] + text_insert; + k--; + } + if (diffs[k] && diffs[k][0] === DIFF_DELETE) { + count_delete++; + text_delete = diffs[k][1] + text_delete; + k--; + } + previous_equality = k; + } + } + if (starts_with_pair_end(diffs[pointer][1])) { + var stray = diffs[pointer][1].charAt(0); + diffs[pointer][1] = diffs[pointer][1].slice(1); + text_delete += stray; + text_insert += stray; + } + } + if (pointer < diffs.length - 1 && !diffs[pointer][1]) { + // for empty equality not at end, wait for next equality + diffs.splice(pointer, 1); + break; + } + if (text_delete.length > 0 || text_insert.length > 0) { + // note that diff_commonPrefix and diff_commonSuffix are unicode-aware + if (text_delete.length > 0 && text_insert.length > 0) { + // Factor out any common prefixes. + commonlength = diff_commonPrefix(text_insert, text_delete); + if (commonlength !== 0) { + if (previous_equality >= 0) { + diffs[previous_equality][1] += text_insert.substring(0, commonlength); + } else { + diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]); + pointer++; + } + text_insert = text_insert.substring(commonlength); + text_delete = text_delete.substring(commonlength); + } + // Factor out any common suffixes. + commonlength = diff_commonSuffix(text_insert, text_delete); + if (commonlength !== 0) { + diffs[pointer][1] = + text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1]; + text_insert = text_insert.substring(0, text_insert.length - commonlength); + text_delete = text_delete.substring(0, text_delete.length - commonlength); + } + } + // Delete the offending records and add the merged ones. + var n = count_insert + count_delete; + if (text_delete.length === 0 && text_insert.length === 0) { + diffs.splice(pointer - n, n); + pointer = pointer - n; + } else if (text_delete.length === 0) { + diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]); + pointer = pointer - n + 1; + } else if (text_insert.length === 0) { + diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]); + pointer = pointer - n + 1; + } else { + diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]); + pointer = pointer - n + 2; + } + } + if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) { + // Merge this equality with the previous one. + diffs[pointer - 1][1] += diffs[pointer][1]; + diffs.splice(pointer, 1); + } else { + pointer++; + } + count_insert = 0; + count_delete = 0; + text_delete = ''; + text_insert = ''; + break; + } + } + if (diffs[diffs.length - 1][1] === '') { + diffs.pop(); // Remove the dummy entry at the end. + } + + // Second pass: look for single edits surrounded on both sides by equalities + // which can be shifted sideways to eliminate an equality. + // e.g: ABAC -> ABAC + var changes = false; + pointer = 1; + // Intentionally ignore the first and last element (don't need checking). + while (pointer < diffs.length - 1) { + if (diffs[pointer - 1][0] === DIFF_EQUAL && + diffs[pointer + 1][0] === DIFF_EQUAL) { + // This is a single edit surrounded by equalities. + if (diffs[pointer][1].substring(diffs[pointer][1].length - + diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) { + // Shift the edit over the previous equality. + diffs[pointer][1] = diffs[pointer - 1][1] + + diffs[pointer][1].substring(0, diffs[pointer][1].length - + diffs[pointer - 1][1].length); + diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; + diffs.splice(pointer - 1, 1); + changes = true; + } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == + diffs[pointer + 1][1]) { + // Shift the edit over the next equality. + diffs[pointer - 1][1] += diffs[pointer + 1][1]; + diffs[pointer][1] = + diffs[pointer][1].substring(diffs[pointer + 1][1].length) + + diffs[pointer + 1][1]; + diffs.splice(pointer + 1, 1); + changes = true; + } + } + pointer++; + } + // If shifts were made, the diff needs reordering and another shift sweep. + if (changes) { + diff_cleanupMerge(diffs, fix_unicode); + } + } + function is_surrogate_pair_start(charCode) { + return charCode >= 0xD800 && charCode <= 0xDBFF; + } + + function is_surrogate_pair_end(charCode) { + return charCode >= 0xDC00 && charCode <= 0xDFFF; + } + + function starts_with_pair_end(str) { + return is_surrogate_pair_end(str.charCodeAt(0)); + } + + function ends_with_pair_start(str) { + return is_surrogate_pair_start(str.charCodeAt(str.length - 1)); + } + + function remove_empty_tuples(tuples) { + var ret = []; + for (var i = 0; i < tuples.length; i++) { + if (tuples[i][1].length > 0) { + ret.push(tuples[i]); + } + } + return ret; + } + + function make_edit_splice(before, oldMiddle, newMiddle, after) { + if (ends_with_pair_start(before) || starts_with_pair_end(after)) { + return null; + } + return remove_empty_tuples([ + [DIFF_EQUAL, before], + [DIFF_DELETE, oldMiddle], + [DIFF_INSERT, newMiddle], + [DIFF_EQUAL, after] + ]); + } + + function find_cursor_edit_diff(oldText, newText, cursor_pos) { + // note: this runs after equality check has ruled out exact equality + var oldRange = typeof cursor_pos === 'number' ? + { index: cursor_pos, length: 0 } : cursor_pos.oldRange; + var newRange = typeof cursor_pos === 'number' ? + null : cursor_pos.newRange; + // take into account the old and new selection to generate the best diff + // possible for a text edit. for example, a text change from "xxx" to "xx" + // could be a delete or forwards-delete of any one of the x's, or the + // result of selecting two of the x's and typing "x". + var oldLength = oldText.length; + var newLength = newText.length; + if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) { + // see if we have an insert or delete before or after cursor + var oldCursor = oldRange.index; + var oldBefore = oldText.slice(0, oldCursor); + var oldAfter = oldText.slice(oldCursor); + var maybeNewCursor = newRange ? newRange.index : null; + editBefore: { + // is this an insert or delete right before oldCursor? + var newCursor = oldCursor + newLength - oldLength; + if (maybeNewCursor !== null && maybeNewCursor !== newCursor) { + break editBefore; + } + if (newCursor < 0 || newCursor > newLength) { + break editBefore; + } + var newBefore = newText.slice(0, newCursor); + var newAfter = newText.slice(newCursor); + if (newAfter !== oldAfter) { + break editBefore; + } + var prefixLength = Math.min(oldCursor, newCursor); + var oldPrefix = oldBefore.slice(0, prefixLength); + var newPrefix = newBefore.slice(0, prefixLength); + if (oldPrefix !== newPrefix) { + break editBefore; + } + var oldMiddle = oldBefore.slice(prefixLength); + var newMiddle = newBefore.slice(prefixLength); + return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter); + } + editAfter: { + // is this an insert or delete right after oldCursor? + if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) { + break editAfter; + } + var cursor = oldCursor; + var newBefore = newText.slice(0, cursor); + var newAfter = newText.slice(cursor); + if (newBefore !== oldBefore) { + break editAfter; + } + var suffixLength = Math.min(oldLength - cursor, newLength - cursor); + var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength); + var newSuffix = newAfter.slice(newAfter.length - suffixLength); + if (oldSuffix !== newSuffix) { + break editAfter; + } + var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength); + var newMiddle = newAfter.slice(0, newAfter.length - suffixLength); + return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix); + } + } + if (oldRange.length > 0 && newRange && newRange.length === 0) { + replaceRange: { + // see if diff could be a splice of the old selection range + var oldPrefix = oldText.slice(0, oldRange.index); + var oldSuffix = oldText.slice(oldRange.index + oldRange.length); + var prefixLength = oldPrefix.length; + var suffixLength = oldSuffix.length; + if (newLength < prefixLength + suffixLength) { + break replaceRange; + } + var newPrefix = newText.slice(0, prefixLength); + var newSuffix = newText.slice(newLength - suffixLength); + if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) { + break replaceRange; + } + var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength); + var newMiddle = newText.slice(prefixLength, newLength - suffixLength); + return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix); + } + } + + return null; + } + + function diff$1(text1, text2, cursor_pos) { + // only pass fix_unicode=true at the top level, not when diff_main is + // recursively invoked + return diff_main(text1, text2, cursor_pos, true); + } + + diff$1.INSERT = DIFF_INSERT; + diff$1.DELETE = DIFF_DELETE; + diff$1.EQUAL = DIFF_EQUAL; + + var diff_1$2 = diff$1; + + /** + * Copyright (C) 2021 THL A29 Limited, a Tencent company. + * + * 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. + */ + /** + * 更新内容时保持光标不变 + * @param {Number} pos 光标相对文档开头的偏移量 + * @param {String} oldContent 变更前的内容 + * @param {String} newContent 变更后的内容 + * @returns {Number} newPos 新的光标偏移量 + */ + + function getPosBydiffs(pos, oldContent, newContent) { + var diffs = diff_1$2(oldContent, newContent); + var newPos = pos; + var tmpPos = pos; + + for (var i = 0; i < diffs.length; i++) { + var val = diffs[i]; + + if (tmpPos <= 0) { + return newPos; + } + + var opType = val[0]; + var opLength = val[1].length; + + switch (opType) { + // 没有改变的内容 + case diff_1$2.EQUAL: + if (tmpPos <= opLength) { + return newPos; + } + + tmpPos -= opLength; + break; + // 删除的内容 + + case diff_1$2.DELETE: + if (tmpPos <= opLength) { + return newPos - opLength + tmpPos; + } + + tmpPos -= opLength; + newPos -= opLength; + break; + // 新增的内容 + + case diff_1$2.INSERT: + newPos += opLength; + break; + } + } + + return newPos; + } + + /** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEach(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; + } + + var _arrayEach = arrayEach; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeKeys = _overArg(Object.keys, Object); + + var _nativeKeys = nativeKeys; + + /** Used for built-in method references. */ + var objectProto$b = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty$a = objectProto$b.hasOwnProperty; + + /** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeys(object) { + if (!_isPrototype(object)) { + return _nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty$a.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; + } + + var _baseKeys = baseKeys; + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + function keys$8(object) { + return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object); + } + + var keys_1 = keys$8; + + /** + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return object && _copyObject(source, keys_1(source), object); + } + + var _baseAssign = baseAssign; + + /** + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssignIn(object, source) { + return object && _copyObject(source, keysIn_1(source), object); + } + + var _baseAssignIn = baseAssignIn; + + /** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; + } + + var _arrayFilter = arrayFilter; + + /** + * This method returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ + function stubArray() { + return []; + } + + var stubArray_1 = stubArray; + + /** Used for built-in method references. */ + var objectProto$c = Object.prototype; + + /** Built-in value references. */ + var propertyIsEnumerable$2 = objectProto$c.propertyIsEnumerable; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeGetSymbols = Object.getOwnPropertySymbols; + + /** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return _arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable$2.call(object, symbol); + }); + }; + + var _getSymbols = getSymbols; + + /** + * Copies own symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbols(source, object) { + return _copyObject(source, _getSymbols(source), object); + } + + var _copySymbols = copySymbols; + + /** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ + function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; + } + + var _arrayPush = arrayPush; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeGetSymbols$1 = Object.getOwnPropertySymbols; + + /** + * Creates an array of the own and inherited enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbolsIn = !nativeGetSymbols$1 ? stubArray_1 : function(object) { + var result = []; + while (object) { + _arrayPush(result, _getSymbols(object)); + object = _getPrototype(object); + } + return result; + }; + + var _getSymbolsIn = getSymbolsIn; + + /** + * Copies own and inherited symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbolsIn(source, object) { + return _copyObject(source, _getSymbolsIn(source), object); + } + + var _copySymbolsIn = copySymbolsIn; + + /** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object)); + } + + var _baseGetAllKeys = baseGetAllKeys; + + /** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeys(object) { + return _baseGetAllKeys(object, keys_1, _getSymbols); + } + + var _getAllKeys = getAllKeys; + + /** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeysIn(object) { + return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn); + } + + var _getAllKeysIn = getAllKeysIn; + + /* Built-in method references that are verified to be native. */ + var DataView$1 = _getNative(_root, 'DataView'); + + var _DataView = DataView$1; + + /* Built-in method references that are verified to be native. */ + var Promise$2 = _getNative(_root, 'Promise'); + + var _Promise = Promise$2; + + /* Built-in method references that are verified to be native. */ + var Set$1 = _getNative(_root, 'Set'); + + var _Set = Set$1; + + /* Built-in method references that are verified to be native. */ + var WeakMap$2 = _getNative(_root, 'WeakMap'); + + var _WeakMap = WeakMap$2; + + /** `Object#toString` result references. */ + var mapTag$1 = '[object Map]', + objectTag$2 = '[object Object]', + promiseTag = '[object Promise]', + setTag$1 = '[object Set]', + weakMapTag$1 = '[object WeakMap]'; + + var dataViewTag$1 = '[object DataView]'; + + /** Used to detect maps, sets, and weakmaps. */ + var dataViewCtorString = _toSource(_DataView), + mapCtorString = _toSource(_Map), + promiseCtorString = _toSource(_Promise), + setCtorString = _toSource(_Set), + weakMapCtorString = _toSource(_WeakMap); + + /** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + var getTag = _baseGetTag; + + // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. + if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$1) || + (_Map && getTag(new _Map) != mapTag$1) || + (_Promise && getTag(_Promise.resolve()) != promiseTag) || + (_Set && getTag(new _Set) != setTag$1) || + (_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) { + getTag = function(value) { + var result = _baseGetTag(value), + Ctor = result == objectTag$2 ? value.constructor : undefined, + ctorString = Ctor ? _toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag$1; + case mapCtorString: return mapTag$1; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag$1; + case weakMapCtorString: return weakMapTag$1; + } + } + return result; + }; + } + + var _getTag = getTag; + + /** Used for built-in method references. */ + var objectProto$d = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty$b = objectProto$d.hasOwnProperty; + + /** + * Initializes an array clone. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the initialized clone. + */ + function initCloneArray(array) { + var length = array.length, + result = new array.constructor(length); + + // Add properties assigned by `RegExp#exec`. + if (length && typeof array[0] == 'string' && hasOwnProperty$b.call(array, 'index')) { + result.index = array.index; + result.input = array.input; + } + return result; + } + + var _initCloneArray = initCloneArray; + + /** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + + var _cloneDataView = cloneDataView; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** + * Creates a clone of `regexp`. + * + * @private + * @param {Object} regexp The regexp to clone. + * @returns {Object} Returns the cloned regexp. + */ + function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + + var _cloneRegExp = cloneRegExp; + + /** Used to convert symbols to primitives and strings. */ + var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined, + symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined; + + /** + * Creates a clone of the `symbol` object. + * + * @private + * @param {Object} symbol The symbol object to clone. + * @returns {Object} Returns the cloned symbol object. + */ + function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + } + + var _cloneSymbol = cloneSymbol; + + /** `Object#toString` result references. */ + var boolTag$1 = '[object Boolean]', + dateTag$1 = '[object Date]', + mapTag$2 = '[object Map]', + numberTag$1 = '[object Number]', + regexpTag$1 = '[object RegExp]', + setTag$2 = '[object Set]', + stringTag$1 = '[object String]', + symbolTag$1 = '[object Symbol]'; + + var arrayBufferTag$1 = '[object ArrayBuffer]', + dataViewTag$2 = '[object DataView]', + float32Tag$1 = '[object Float32Array]', + float64Tag$1 = '[object Float64Array]', + int8Tag$1 = '[object Int8Array]', + int16Tag$1 = '[object Int16Array]', + int32Tag$1 = '[object Int32Array]', + uint8Tag$1 = '[object Uint8Array]', + uint8ClampedTag$1 = '[object Uint8ClampedArray]', + uint16Tag$1 = '[object Uint16Array]', + uint32Tag$1 = '[object Uint32Array]'; + + /** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. + * + * @private + * @param {Object} object The object to clone. + * @param {string} tag The `toStringTag` of the object to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneByTag(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag$1: + return _cloneArrayBuffer(object); + + case boolTag$1: + case dateTag$1: + return new Ctor(+object); + + case dataViewTag$2: + return _cloneDataView(object, isDeep); + + case float32Tag$1: case float64Tag$1: + case int8Tag$1: case int16Tag$1: case int32Tag$1: + case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1: + return _cloneTypedArray(object, isDeep); + + case mapTag$2: + return new Ctor; + + case numberTag$1: + case stringTag$1: + return new Ctor(object); + + case regexpTag$1: + return _cloneRegExp(object); + + case setTag$2: + return new Ctor; + + case symbolTag$1: + return _cloneSymbol(object); + } + } + + var _initCloneByTag = initCloneByTag; + + /** `Object#toString` result references. */ + var mapTag$3 = '[object Map]'; + + /** + * The base implementation of `_.isMap` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + */ + function baseIsMap(value) { + return isObjectLike_1(value) && _getTag(value) == mapTag$3; + } + + var _baseIsMap = baseIsMap; + + /* Node.js helper references. */ + var nodeIsMap = _nodeUtil && _nodeUtil.isMap; + + /** + * Checks if `value` is classified as a `Map` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + * @example + * + * _.isMap(new Map); + * // => true + * + * _.isMap(new WeakMap); + * // => false + */ + var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap; + + var isMap_1 = isMap; + + /** `Object#toString` result references. */ + var setTag$3 = '[object Set]'; + + /** + * The base implementation of `_.isSet` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + */ + function baseIsSet(value) { + return isObjectLike_1(value) && _getTag(value) == setTag$3; + } + + var _baseIsSet = baseIsSet; + + /* Node.js helper references. */ + var nodeIsSet = _nodeUtil && _nodeUtil.isSet; + + /** + * Checks if `value` is classified as a `Set` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + * @example + * + * _.isSet(new Set); + * // => true + * + * _.isSet(new WeakSet); + * // => false + */ + var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet; + + var isSet_1 = isSet; + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + + /** `Object#toString` result references. */ + var argsTag$2 = '[object Arguments]', + arrayTag$1 = '[object Array]', + boolTag$2 = '[object Boolean]', + dateTag$2 = '[object Date]', + errorTag$1 = '[object Error]', + funcTag$2 = '[object Function]', + genTag$1 = '[object GeneratorFunction]', + mapTag$4 = '[object Map]', + numberTag$2 = '[object Number]', + objectTag$3 = '[object Object]', + regexpTag$2 = '[object RegExp]', + setTag$4 = '[object Set]', + stringTag$2 = '[object String]', + symbolTag$2 = '[object Symbol]', + weakMapTag$2 = '[object WeakMap]'; + + var arrayBufferTag$2 = '[object ArrayBuffer]', + dataViewTag$3 = '[object DataView]', + float32Tag$2 = '[object Float32Array]', + float64Tag$2 = '[object Float64Array]', + int8Tag$2 = '[object Int8Array]', + int16Tag$2 = '[object Int16Array]', + int32Tag$2 = '[object Int32Array]', + uint8Tag$2 = '[object Uint8Array]', + uint8ClampedTag$2 = '[object Uint8ClampedArray]', + uint16Tag$2 = '[object Uint16Array]', + uint32Tag$2 = '[object Uint32Array]'; + + /** Used to identify `toStringTag` values supported by `_.clone`. */ + var cloneableTags = {}; + cloneableTags[argsTag$2] = cloneableTags[arrayTag$1] = + cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] = + cloneableTags[boolTag$2] = cloneableTags[dateTag$2] = + cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] = + cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] = + cloneableTags[int32Tag$2] = cloneableTags[mapTag$4] = + cloneableTags[numberTag$2] = cloneableTags[objectTag$3] = + cloneableTags[regexpTag$2] = cloneableTags[setTag$4] = + cloneableTags[stringTag$2] = cloneableTags[symbolTag$2] = + cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] = + cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true; + cloneableTags[errorTag$1] = cloneableTags[funcTag$2] = + cloneableTags[weakMapTag$2] = false; + + /** + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, bitmask, customizer, key, object, stack) { + var result, + isDeep = bitmask & CLONE_DEEP_FLAG, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + if (customizer) { + result = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject_1(value)) { + return value; + } + var isArr = isArray_1(value); + if (isArr) { + result = _initCloneArray(value); + if (!isDeep) { + return _copyArray(value, result); + } + } else { + var tag = _getTag(value), + isFunc = tag == funcTag$2 || tag == genTag$1; + + if (isBuffer_1(value)) { + return _cloneBuffer(value, isDeep); + } + if (tag == objectTag$3 || tag == argsTag$2 || (isFunc && !object)) { + result = (isFlat || isFunc) ? {} : _initCloneObject(value); + if (!isDeep) { + return isFlat + ? _copySymbolsIn(value, _baseAssignIn(result, value)) + : _copySymbols(value, _baseAssign(result, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = _initCloneByTag(value, tag, isDeep); + } + } + // Check for circular references and return its corresponding clone. + stack || (stack = new _Stack); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); + + if (isSet_1(value)) { + value.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); + } else if (isMap_1(value)) { + value.forEach(function(subValue, key) { + result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + } + + var keysFunc = isFull + ? (isFlat ? _getAllKeysIn : _getAllKeys) + : (isFlat ? keysIn_1 : keys_1); + + var props = isArr ? undefined : keysFunc(value); + _arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + // Recursively populate clone (susceptible to call stack limits). + _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; + } + + var _baseClone = baseClone; + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG$1 = 1, + CLONE_SYMBOLS_FLAG$1 = 4; + + /** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @see _.clone + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */ + function cloneDeep(value) { + return _baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1); + } + + var cloneDeep_1 = cloneDeep; + + /** + * Copyright (C) 2021 THL A29 Limited, a Tencent company. + * + * 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. + */ + var callbacks = { + /** + * 全局的URL处理器 + * @param {string} url 来源url + * @param {'image'|'audio'|'video'|'autolink'|'link'} srcType 来源类型 + * @returns + */ + urlProcessor: function urlProcessor(url, srcType) { + return url; + }, + fileUpload: function fileUpload(file, callback) { + if (/video/i.test(file.type)) { + callback('images/demo-dog.png', { + name: "".concat(file.name.replace(/\.[^.]+$/, '')), + poster: 'images/demo-dog.png?poster=true', + isBorder: true, + isShadow: true, + isRadius: true + }); + } else { + callback('images/demo-dog.png', { + name: "".concat(file.name.replace(/\.[^.]+$/, '')), + isShadow: true + }); + } + }, + afterChange: function afterChange(text, html) {}, + afterInit: function afterInit(text, html) {}, + beforeImageMounted: function beforeImageMounted(srcProp, src) { + return { + srcProp: srcProp, + src: src + }; + }, + onClickPreview: function onClickPreview(event) {}, + onCopyCode: function onCopyCode(event, code) { + // 阻止默认的粘贴事件 + // return false; + // 对复制内容进行额外处理 + return code; + }, + // 获取中文的拼音 + changeString2Pinyin: function changeString2Pinyin(string) { + /** + * 推荐使用这个组件:https://github.com/liu11hao11/pinyin_js + * + * 可以在 ../scripts/pinyin/pinyin_dist.js 里直接引用 + */ + return string; + } + }; + /** @type {Partial} */ + + var defaultConfig = { + // 第三方包 + externals: {// externals + }, + // chatGpt的openai配置 + openai: { + apiKey: '', + // apiKey + // proxy: { + // host: '127.0.0.1', + // port: '7890', + // }, // http & https代理配置 + ignoreError: false // 是否忽略请求失败,默认忽略 + + }, + // 解析引擎配置 + engine: { + // 全局配置 + global: { + // 是否启用经典换行逻辑 + // true:一个换行会被忽略,两个以上连续换行会分割成段落, + // false: 一个换行会转成
,两个连续换行会分割成段落,三个以上连续换行会转成
并分割段落 + classicBr: false, + + /** + * 全局的URL处理器 + * @param {string} url 来源url + * @param {'image'|'audio'|'video'|'autolink'|'link'} srcType 来源类型 + * @returns + */ + urlProcessor: callbacks.urlProcessor, + + /** + * 额外允许渲染的html标签 + * 标签以英文竖线分隔,如:htmlWhiteList: 'iframe|script|style' + * 默认为空,默认允许渲染的html见src/utils/sanitize.js whiteList 属性 + * 需要注意: + * - 启用iframe、script等标签后,会产生xss注入,请根据实际场景判断是否需要启用 + * - 一般编辑权限可控的场景(如api文档系统)可以允许iframe、script等标签 + */ + htmlWhiteList: '' + }, + // 内置语法配置 + syntax: { + // 语法开关 + // 'hookName': false, + // 语法配置 + // 'hookName': { + // + // } + link: { + /** 生成的标签追加target属性的默认值 空:在标签里不会追加target属性, _blank:在标签里追加target="_blank"属性 */ + target: '', + + /** 生成的标签追加rel属性的默认值 空:在标签里不会追加rel属性, nofollow:在标签里追加rel="nofollow:在"属性*/ + rel: '' + }, + autoLink: { + /** 生成的标签追加target属性的默认值 空:在标签里不会追加target属性, _blank:在标签里追加target="_blank"属性 */ + target: '', + + /** 生成的标签追加rel属性的默认值 空:在标签里不会追加rel属性, nofollow:在标签里追加rel="nofollow:在"属性*/ + rel: '', + + /** 是否开启短链接 */ + enableShortLink: true, + + /** 短链接长度 */ + shortLinkLength: 20 + }, + list: { + listNested: false, + // 同级列表类型转换后变为子级 + indentSpace: 2 // 默认2个空格缩进 + + }, + table: { + enableChart: false // chartRenderEngine: EChartsTableEngine, + // externals: ['echarts'], + + }, + inlineCode: { + theme: 'red' + }, + codeBlock: { + theme: 'dark', + // 默认为深色主题 + wrap: true, + // 超出长度是否换行,false则显示滚动条 + lineNumber: true, + // 默认显示行号 + copyCode: true, + // 是否显示“复制”按钮 + customRenderer: {// 自定义语法渲染器 + }, + mermaid: { + svg2img: false // 是否将mermaid生成的画图变成img格式 + + }, + + /** + * indentedCodeBlock是缩进代码块是否启用的开关 + * + * 在6.X之前的版本中默认不支持该语法。 + * 因为cherry的开发团队认为该语法太丑了(容易误触) + * 开发团队希望用```代码块语法来彻底取代该语法 + * 但在后续的沟通中,开发团队发现在某些场景下该语法有更好的显示效果 + * 因此开发团队在6.X版本中才引入了该语法 + * 已经引用6.x以下版本的业务如果想做到用户无感知升级,可以去掉该语法: + * indentedCodeBlock:false + */ + indentedCodeBlock: true + }, + emoji: { + useUnicode: true // 是否使用unicode进行渲染 + + }, + fontEmphasis: { + /** + * 是否允许首尾空格 + * 首尾、前后的定义: 语法前**语法首+内容+语法尾**语法后 + * 例: + * true: + * __ hello __ ====> hello + * __hello__ ====> hello + * false: + * __ hello __ ====> _ hello _ + * __hello__ ====> hello + */ + allowWhitespace: false + }, + strikethrough: { + /** + * 是否必须有前后空格 + * 首尾、前后的定义: 语法前**语法首+内容+语法尾**语法后 + * 例: + * true: + * hello wor~~l~~d ====> hello wor~~l~~d + * hello wor ~~l~~ d ====> hello wor l d + * false: + * hello wor~~l~~d ====> hello world + * hello wor ~~l~~ d ====> hello wor l d + */ + needWhitespace: false + }, + mathBlock: { + engine: 'MathJax', + // katex或MathJax + src: '', + plugins: true // 默认加载插件 + + }, + inlineMath: { + engine: 'MathJax', + // katex或MathJax + src: '' + }, + toc: { + /** 默认只渲染一个目录 */ + allowMultiToc: false + }, + header: { + /** + * 标题的样式: + * - default 默认样式,标题前面有锚点 + * - autonumber 标题前面有自增序号锚点 + * - none 标题没有锚点 + */ + anchorStyle: 'default' + } + } + }, + editor: { + id: 'code', + // textarea 的id属性值 + name: 'code', + // textarea 的name属性值 + autoSave2Textarea: false, + // 是否自动将编辑区的内容回写到textarea里 + theme: 'default', + // depend on codemirror theme name: https://codemirror.net/demo/theme.htm + // 编辑器的高度,默认100%,如果挂载点存在内联设置的height则以内联样式为主 + height: '100%', + // defaultModel 编辑器初始化后的默认模式,一共有三种模式:1、双栏编辑预览模式;2、纯编辑模式;3、预览模式 + // edit&preview: 双栏编辑预览模式 + // editOnly: 纯编辑模式(没有预览,可通过toolbar切换成双栏或预览模式) + // previewOnly: 预览模式(没有编辑框,toolbar只显示“返回编辑”按钮,可通过toolbar切换成编辑模式) + defaultModel: 'edit&preview', + // 粘贴时是否自动将html转成markdown + convertWhenPaste: true, + codemirror: { + // 是否自动focus 默认为true + autofocus: true + }, + writingStyle: 'normal' // 书写风格,normal 普通 | typewriter 打字机 | focus 专注,默认normal + + }, + toolbars: { + theme: 'dark', + // light or dark + showToolbar: true, + // false:不展示顶部工具栏; true:展示工具栏; toolbars.showToolbar=false 与 toolbars.toolbar=false 等效 + toolbar: ['bold', 'italic', 'strikethrough', '|', 'color', 'header', 'ruby', '|', 'list', 'panel', // 'justify', // 对齐方式,默认不推荐这么“复杂”的样式要求 + 'detail', { + insert: ['image', 'audio', 'video', 'link', 'hr', 'br', 'code', 'formula', 'toc', 'table', 'line-table', 'bar-table', 'pdf', 'word'] + }, 'graph', 'settings'], + toolbarRight: [], + sidebar: [], + bubble: ['bold', 'italic', 'underline', 'strikethrough', 'sub', 'sup', 'quote', '|', 'size', 'color'], + // array or false + "float": ['h1', 'h2', 'h3', '|', 'checklist', 'quote', 'table', 'code'] // array or false + + }, + // 打开draw.io编辑页的url,如果为空则drawio按钮失效 + drawioIframeUrl: '', + // 上传文件的回调 + fileUpload: callbacks.fileUpload, + + /** + * 上传文件的时候用来指定文件类型 + */ + fileTypeLimitMap: { + video: 'video/*', + audio: 'audio/*', + image: 'image/*', + word: '.doc,.docx', + pdf: '.pdf', + file: '*' + }, + callback: { + afterChange: callbacks.afterChange, + afterInit: callbacks.afterInit, + beforeImageMounted: callbacks.beforeImageMounted, + // 预览区域点击事件,previewer.enablePreviewerBubble = true 时生效 + onClickPreview: callbacks.onClickPreview, + // 复制代码块代码时的回调 + onCopyCode: callbacks.onCopyCode, + // 把中文变成拼音的回调,当然也可以把中文变成英文、英文变成中文 + changeString2Pinyin: callbacks.changeString2Pinyin + }, + previewer: { + dom: false, + className: 'cherry-markdown', + // 是否启用预览区域编辑能力(目前支持编辑图片尺寸、编辑表格内容) + enablePreviewerBubble: true, + + /** + * 配置图片懒加载的逻辑 + * - 如果不希望图片懒加载,可配置成 lazyLoadImg = {noLoadImgNum: -1} + * - 如果希望所有图片都无脑懒加载,可配置成 lazyLoadImg = {noLoadImgNum: 0, autoLoadImgNum: -1} + * - 如果一共有15张图片,希望: + * 1、前5张图片(1~5)直接加载; + * 2、后5张图片(6~10)不论在不在视区内,都无脑懒加载; + * 3、其他图片(11~15)在视区内时,进行懒加载; + * 则配置应该为:lazyLoadImg = {noLoadImgNum: 5, autoLoadImgNum: 5} + */ + lazyLoadImg: { + // 加载图片时如果需要展示loading图,则配置loading图的地址 + loadingImgPath: '', + // 同一时间最多有几个图片请求,最大同时加载6张图片 + maxNumPerTime: 2, + // 不进行懒加载处理的图片数量,如果为0,即所有图片都进行懒加载处理, 如果设置为-1,则所有图片都不进行懒加载处理 + noLoadImgNum: 5, + // 首次自动加载几张图片(不论图片是否滚动到视野内),autoLoadImgNum = -1 表示会自动加载完所有图片 + autoLoadImgNum: 5, + // 针对加载失败的图片 或 beforeLoadOneImgCallback 返回false 的图片,最多尝试加载几次,为了防止死循环,最多5次。以图片的src为纬度统计重试次数 + maxTryTimesPerSrc: 2, + // 加载一张图片之前的回调函数,函数return false 会终止加载操作 + beforeLoadOneImgCallback: function beforeLoadOneImgCallback(img) { + return true; + }, + // 加载一张图片失败之后的回调函数 + failLoadOneImgCallback: function failLoadOneImgCallback(img) {}, + // 加载一张图片之后的回调函数,如果图片加载失败,则不会回调该函数 + afterLoadOneImgCallback: function afterLoadOneImgCallback(img) {}, + // 加载完所有图片后调用的回调函数 + afterLoadAllImgCallback: function afterLoadAllImgCallback() {} + } + }, + + /** + * 配置主题,第三方可以自行扩展主题 + */ + theme: [{ + className: 'default', + label: '默认' + }, { + className: 'dark', + label: '暗黑' + }, { + className: 'light', + label: '明亮' + }, { + className: 'green', + label: '清新' + }, { + className: 'red', + label: '热情' + }, { + className: 'violet', + label: '淡雅' + }, { + className: 'blue', + label: '清幽' + }], + // 预览页面不需要绑定事件 + isPreviewOnly: false, + // 预览区域跟随编辑器光标自动滚动 + autoScrollByCursor: true, + // 外层容器不存在时,是否强制输出到body上 + forceAppend: true, + // The locale Cherry is going to use. Locales live in /src/locales/ + locale: 'zh_CN' + }; + var defaultConfig$1 = cloneDeep_1(defaultConfig); + + /** + * Copyright (C) 2021 THL A29 Limited, a Tencent company. + * + * 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. + */ + var zhCn = { + bold: '加粗', + // 加粗 + code: '代码', + // 代码 + graph: '画图', + // 画图 + h1: '一级标题', + // 一级标题 + h2: '二级标题', + // 二级标题 + h3: '三级标题', + // 三级标题 + h4: '四级标题', + // 四级标题 + h5: '五级标题', + // 五级标题 + header: '标题', + // 标题 + insert: '插入', + // 插入 + italic: '斜体', + // 斜体 + list: '列表', + // 列表 + quickTable: '表格', + // 表格 + quote: '引用', + // 引用 + size: '大小', + // 大小 + color: '文字颜色&背景', + // 文字颜色&背景 + strikethrough: '删除线', + // 删除线 + sub: '下标', + // 下标 + sup: '上标', + // 上标 + togglePreview: '预览', + // 预览 + fullScreen: '全屏', + // 全屏 + image: '图片', + // 图片 + audio: '音频', + // 音频 + video: '视频', + // 视频 + link: '超链接', + // 超链接 + hr: '分隔线', + // 分隔线 + br: '换行', + // 换行 + toc: '目录', + // 目录 + pdf: 'pdf', + // pdf + word: 'word', + // word + table: '表格', + // 表格 + 'line-table': '折线表格', + // 折线表格 + 'bar-table': '柱状表格', + // 柱状表格 + formula: '公式', + // 公式 + insertFormula: '公式', + // 公式 + insertFlow: '流程图', + // 流程图 + insertSeq: '时序图', + // 时序图 + insertState: '状态图', + // 状态图 + insertClass: '类图', + // 类图 + insertPie: '饼图', + // 饼图 + insertGantt: '甘特图', + // 甘特图 + checklist: '清单', + // 清单 + ol: '有序列表', + // 有序列表 + ul: '无序列表', + // 无序列表 + undo: '撤销', + // 撤销 + redo: '恢复', + // 恢复 + previewClose: '关闭预览', + // 关闭预览 + codeTheme: '代码主题', + // 代码主题 + switchModel: '模式切换', + // 模式切换 + switchPreview: '预览', + // 预览 + switchEdit: '返回编辑', + // 返回编辑 + classicBr: '经典换行', + // 经典换行 + normalBr: '常规换行', + // 常规换行 + settings: '设置', + // 设置 + mobilePreview: '移动端预览', + // 移动端预览 + copy: '复制内容', + // 复制内容 + "export": '导出', + // 导出PDF、长图 + underline: '下划线', + // 下划线 + pinyin: '拼音', + // 拼音 + file: '文件', + pastePlain: '粘贴为纯文本格式', + // 粘贴为纯文本格式 + pasteMarkdown: '粘贴为markdown格式', + // 粘贴为markdown格式 + hide: '隐藏(ctrl+0)', + // 隐藏(ctrl+0) + exportToPdf: '导出PDF', + // 导出PDF + exportScreenshot: '导出长图', + // 导出长图 + exportMarkdownFile: '导出markdown', + // 导出markdown文件 + exportHTMLFile: '导出html', + // 导出预览区html文件 + theme: '主题', + // 导出长图 + panel: '面板', + // 导出长图 + detail: '手风琴', + // 手风琴 + 'H1 Heading': 'H1 一级标题', + 'H2 Heading': 'H2 二级标题', + 'H3 Heading': 'H3 三级标题', + complement: '续写', + summary: '总结', + save: '保存', + release: '发布', + back: '返回', + }; + + /** + * Copyright (C) 2021 THL A29 Limited, a Tencent company. + * + * 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. + */ + var enUs = { + bold: 'Bold', + code: 'Code', + graph: 'Graph', + h1: 'Heading 1', + h2: 'Heading 2', + h3: 'Heading 3', + h4: 'Heading 4', + h5: 'Heading 5', + header: 'Header', + insert: 'Insert', + italic: 'Italic', + list: 'List', + quickTable: 'Quick Table', + quote: 'Quote', + size: 'Size', + color: 'Text Color & Background', + strikethrough: 'Strikethrough', + sub: 'Sub', + sup: 'Sup', + togglePreview: 'Toggle Preview', + fullScreen: 'Full Screen', + image: 'Image', + audio: 'Audio', + video: 'Video', + link: 'Link', + hr: 'Horizontal Rule', + br: 'New Line', + toc: 'Table Of Content', + pdf: 'PDF', + word: 'Word', + table: 'Table', + 'line-table': 'Line Table', + 'bar-table': 'Bar Table', + formula: 'Formula', + insertFormula: 'Insert Formula', + insertFlow: 'Insert Flow', + insertSeq: 'Insert Seq', + insertState: 'Insert State', + insertClass: 'Insert Class', + insertPie: 'Insert Pie', + insertGantt: 'Insert Gantt', + checklist: 'Checklist', + ol: 'Ordered List', + ul: 'Unordered List', + undo: 'Undo', + redo: 'Redo', + previewClose: 'Preview Close', + codeTheme: 'Code Theme', + switchModel: 'Switch Model', + switchPreview: 'Switch Preview', + switchEdit: 'Switch Edit', + classicBr: 'Classic New Line', + normalBr: 'Normal New Line', + settings: 'Settings', + mobilePreview: 'Mobile Preview', + copy: 'Copy', + "export": 'Export', + underline: 'Underline', + pinyin: 'Pinyin', + pastePlain: 'Paste as Plain Text', + pasteMarkdown: 'Paste as Markdown', + hide: 'Hide (ctrl+0)', + exportToPdf: 'Export to PDF', + exportScreenshot: 'Screenshot', + exportMarkdownFile: 'Export Markdown File', + exportHTMLFile: 'Export preview HTML File', + 'H1 Heading': 'H1 Heading', + 'H2 Heading': 'H1 Heading', + 'H3 Heading': 'H1 Heading', + complement: 'Complement', + summary: 'Summary', + save: 'Save', + release: 'Release', + back: 'Back', + }; + + /** + * Copyright (C) 2021 THL A29 Limited, a Tencent company. + * + * 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. + */ + var locales = { + zh_CN: zhCn, + en_US: enUs + }; + + function _createSuper$1r(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1r(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1r() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + function filterOptions(options, whiteList, propTypes) { + var _context; + + var filteredOptions = {}; + + forEach$3(_context = keys$3(options)).call(_context, function (key) { + if (indexOf$8(whiteList).call(whiteList, key) === -1) { + return; + } + + if (_typeof(propTypes) === 'object') { + if (typeof propTypes[key] === 'string') { + if (_typeof(options[key]) === propTypes[key]) { + filteredOptions[key] = options[key]; + } + } else { + if (options[key] instanceof propTypes[key]) { + filteredOptions[key] = options[key]; + } + } + } else if (typeof propTypes === 'string') { + if (_typeof(options[key]) === propTypes) { + filteredOptions[key] = options[key]; + } + } + }); + + return filteredOptions; + } + + function createSyntaxHook(name, type, options) { + var _class; + + var BaseClass = type === HOOKS_TYPE_LIST.PAR ? ParagraphBase : SyntaxBase; + var optionsWhiteList = ['beforeMakeHtml', 'makeHtml', 'afterMakeHtml', 'rule', 'test']; + var filteredOptions = filterOptions(options, optionsWhiteList, 'function'); + var paragraphConfig = { + needCache: options.needCache, + defaultCache: options.defaultCache + }; + return _class = /*#__PURE__*/function (_BaseClass) { + _inherits(CustomSyntax, _BaseClass); + + var _super = _createSuper$1r(CustomSyntax); + + function CustomSyntax() { + var _this; + + var editorConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _classCallCheck(this, CustomSyntax); + + if (type === HOOKS_TYPE_LIST.PAR) { + _this = _super.call(this, { + needCache: !!paragraphConfig.needCache, + defaultCache: paragraphConfig.defaultCache + }); + } else { + _this = _super.call(this); + } + + _this.config = editorConfig.config; + return _possibleConstructorReturn(_this); + } + + _createClass(CustomSyntax, [{ + key: "beforeMakeHtml", + value: function beforeMakeHtml() { + var _get2, _context2; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (filteredOptions.beforeMakeHtml) { + return filteredOptions.beforeMakeHtml.apply(this, args); + } + + return (_get2 = _get(_getPrototypeOf(CustomSyntax.prototype), "beforeMakeHtml", this)).call.apply(_get2, concat$5(_context2 = [this]).call(_context2, args)); + } + }, { + key: "makeHtml", + value: function makeHtml() { + var _get3, _context3; + + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + if (filteredOptions.makeHtml) { + return filteredOptions.makeHtml.apply(this, args); + } + + return (_get3 = _get(_getPrototypeOf(CustomSyntax.prototype), "makeHtml", this)).call.apply(_get3, concat$5(_context3 = [this]).call(_context3, args)); + } + }, { + key: "afterMakeHtml", + value: function afterMakeHtml() { + var _get4, _context4; + + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + if (filteredOptions.afterMakeHtml) { + return filteredOptions.afterMakeHtml.apply(this, args); + } + + return (_get4 = _get(_getPrototypeOf(CustomSyntax.prototype), "afterMakeHtml", this)).call.apply(_get4, concat$5(_context4 = [this]).call(_context4, args)); + } + }, { + key: "test", + value: function test() { + var _get5, _context5; + + for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + + if (filteredOptions.test) { + return filteredOptions.test.apply(this, args); + } + + return (_get5 = _get(_getPrototypeOf(CustomSyntax.prototype), "test", this)).call.apply(_get5, concat$5(_context5 = [this]).call(_context5, args)); + } + }, { + key: "rule", + value: function rule() { + var _get6, _context6; + + for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + args[_key5] = arguments[_key5]; + } + + if (filteredOptions.rule) { + return filteredOptions.rule.apply(this, args); + } + + return (_get6 = _get(_getPrototypeOf(CustomSyntax.prototype), "rule", this)).call.apply(_get6, concat$5(_context6 = [this]).call(_context6, args)); + } + }]); + + return CustomSyntax; + }(BaseClass), _defineProperty(_class, "HOOK_NAME", name), _class; + } + function createMenuHook(name, options) { + var optionsWhiteList = ['subMenuConfig', 'id', 'onClick', 'shortcutKeys', 'iconName']; + var propTypes = { + subMenuConfig: Array, + onClick: 'function', + shortcutKeys: Array, + id: 'string', + iconName: 'string' + }; + var filteredOptions = filterOptions(options, optionsWhiteList, propTypes); + return /*#__PURE__*/function (_MenuBase) { + _inherits(CustomMenu, _MenuBase); + + var _super2 = _createSuper$1r(CustomMenu); + + function CustomMenu(editorInstance) { + var _this2; + + _classCallCheck(this, CustomMenu); + + _this2 = _super2.call(this, editorInstance); + + if (!filteredOptions.iconName) { + _this2.noIcon = true; + } + + _this2.setName(name, filteredOptions.iconName); + _this2.setId(filteredOptions.id); + + _this2.subMenuConfig = filteredOptions.subMenuConfig || []; + return _this2; + } + + _createClass(CustomMenu, [{ + key: "onClick", + value: function onClick() { + var _get7, _context7; + + for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + args[_key6] = arguments[_key6]; + } + + if (filteredOptions.onClick) { + return filteredOptions.onClick.apply(this, args); + } + + return (_get7 = _get(_getPrototypeOf(CustomMenu.prototype), "onClick", this)).call.apply(_get7, concat$5(_context7 = [this]).call(_context7, args)); + } + }, { + key: "shortcutKeys", + get: function get() { + if (filteredOptions.shortcutKeys) { + return filteredOptions.shortcutKeys; + } + + return []; + } + }]); + + return CustomMenu; + }(MenuBase); + } + + var constants = { + HOOKS_TYPE_LIST: HOOKS_TYPE_LIST + }; + var nodeIgnorePlugin = []; + + if (!isBrowser()) { + forEach$3(nodeIgnorePlugin).call(nodeIgnorePlugin, function (key) { + }); + } + + var VERSION$1 = "0.8.21-4b60dd76"; + var CherryStatic = /*#__PURE__*/function () { + function CherryStatic() { + _classCallCheck(this, CherryStatic); + } + + _createClass(CherryStatic, null, [{ + key: "usePlugin", + value: + /** + * @this {typeof import('./Cherry').default | typeof CherryStatic} + * @param {{ install: (defaultConfig: any, ...args: any[]) => void }} PluginClass 插件Class + * @param {...any} args 初始化插件的参数 + * @returns + */ + function usePlugin(PluginClass) { + var _context; + + if (this === CherryStatic) { + throw new Error('`usePlugin` is not allowed to called through CherryStatic class.'); + } // @ts-ignore + + + if (this.initialized) { + throw new Error('The function `usePlugin` should be called before Cherry is instantiated.'); + } // @ts-ignore + + + if (PluginClass.$cherry$mounted === true) { + return; + } // @ts-ignore + + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + PluginClass.install.apply(PluginClass, concat$5(_context = [this.config.defaults]).call(_context, args)); // @ts-ignore + + PluginClass.$cherry$mounted = true; + } + }]); + + return CherryStatic; + }(); + + _defineProperty(CherryStatic, "createSyntaxHook", createSyntaxHook); + + _defineProperty(CherryStatic, "createMenuHook", createMenuHook); + + _defineProperty(CherryStatic, "constants", constants); + + _defineProperty(CherryStatic, "VERSION", VERSION$1); + + function ownKeys$9(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); enumerableOnly && (symbols = filter$3(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } + + function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? forEach$3(_context5 = ownKeys$9(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : getOwnPropertyDescriptors$2 ? defineProperties$2(target, getOwnPropertyDescriptors$2(source)) : forEach$3(_context6 = ownKeys$9(Object(source))).call(_context6, function (key) { defineProperty$5(target, key, getOwnPropertyDescriptor$3(source, key)); }); } return target; } + + function _createSuper$1s(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1s(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + + function _isNativeReflectConstruct$1s() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + /** @typedef {import('~types/cherry').CherryOptions} CherryOptions */ + + var Cherry = /*#__PURE__*/function (_CherryStatic) { + _inherits(Cherry, _CherryStatic); + + var _super = _createSuper$1s(Cherry); + + /** + * @protected + */ + + /** + * @readonly + */ + + /** + * @param {Partial} options + */ + function Cherry(options) { + var _context; + + var _this; + + _classCallCheck(this, Cherry); + + _this = _super.call(this); + Cherry.initialized = true; + var defaultConfigCopy = cloneDeep_1(Cherry.config.defaults); + _this.defaultToolbar = defaultConfigCopy.toolbars.toolbar; + $expectTarget(options, Object); + /** + * @property + * @type {Partial} + */ + + _this.options = mergeWith_1({}, defaultConfigCopy, options, customizer); // loading the locale + + _this.locale = locales[_this.options.locale]; + + if (typeof _this.options.engine.global.urlProcessor === 'function') { + _this.options.engine.global.urlProcessor = urlProcessorProxy(_this.options.engine.global.urlProcessor); + } + + _this.status = { + toolbar: 'show', + previewer: 'show', + editor: 'show' + }; + + if (_this.options.isPreviewOnly || _this.options.editor.defaultModel === 'previewOnly') { + _this.options.toolbars.showToolbar = false; + _this.options.editor.defaultModel = 'previewOnly'; + _this.status.editor = 'hide'; + _this.status.toolbar = 'hide'; + } + /** + * @property + * @type {string} 实例ID + */ + + + _this.instanceId = concat$5(_context = "cherry-".concat(new Date().getTime())).call(_context, Math.random()); + _this.options.instanceId = _this.instanceId; + /** + * @private + * @type {Engine} + */ + + _this.engine = new Engine(_this.options, _assertThisInitialized(_this)); + + _this.init(); + + return _this; + } + /** + * 初始化工具栏、编辑区、预览区等 + * @private + */ + + + _createClass(Cherry, [{ + key: "init", + value: function init() { + var _context2, + _this2 = this; + + var mountEl = this.options.id ? document.getElementById(this.options.id) : this.options.el; + + if (!mountEl) { + if (!this.options.forceAppend) { + return false; + } + + mountEl = document.createElement('div'); + mountEl.id = this.options.id || 'cherry-markdown'; + document.body.appendChild(mountEl); + } + + if (!mountEl.style.height) { + mountEl.style.height = this.options.editor.height; + } + + this.cherryDom = mountEl; // 蒙层dom,用来拖拽编辑区&预览区宽度时展示蒙层 + + var wrapperDom = this.createWrapper(); // 创建编辑区 + + var editor = this.createEditor(); // 创建预览区 + + var previewer = this.createPreviewer(); + + if (this.options.toolbars.showToolbar === false || this.options.toolbars.toolbar === false) { + // 即便配置了不展示工具栏,也要让工具栏加载对应的语法hook + wrapperDom.classList.add('cherry--no-toolbar'); + this.options.toolbars.toolbar = this.defaultToolbar; + } + + $expectTarget(this.options.toolbars.toolbar, Array); // 创建顶部工具栏 + + this.toolbar = this.createToolbar(); + var wrapperFragment = document.createDocumentFragment(); + wrapperFragment.appendChild(this.toolbar.options.dom); + wrapperFragment.appendChild(editor.options.editorDom); // 创建预览区域的侧边工具栏 + + this.createSidebar(wrapperFragment); + + if (!this.options.previewer.dom) { + wrapperFragment.appendChild(previewer.options.previewerDom); + } + + wrapperFragment.appendChild(previewer.options.virtualDragLineDom); + wrapperFragment.appendChild(previewer.options.editorMaskDom); + wrapperFragment.appendChild(previewer.options.previewerMaskDom); + wrapperDom.appendChild(wrapperFragment); + mountEl.appendChild(wrapperDom); + editor.init(previewer); // 创建bubble工具栏,所谓bubble工具栏,是指在编辑区选中文本时悬浮出现的工具栏 + + this.createBubble(); // 创建float工具栏,所谓float工具栏,是指当编辑区光标处于新行时,在行内联想出的工具栏 + + this.createFloatMenu(); + previewer.init(editor); + previewer.registerAfterUpdate(bind$5(_context2 = this.engine.mounted).call(_context2, this.engine)); // default value init + + this.initText(editor.editor); // 切换模式,有纯预览模式、纯编辑模式、双栏编辑模式 + + this.switchModel(this.options.editor.defaultModel); + Event$1.on(this.instanceId, Event$1.Events.toolbarHide, function () { + _this2.status.toolbar = 'hide'; + }); + Event$1.on(this.instanceId, Event$1.Events.toolbarShow, function () { + _this2.status.toolbar = 'show'; + }); + Event$1.on(this.instanceId, Event$1.Events.previewerClose, function () { + _this2.status.previewer = 'hide'; + }); + Event$1.on(this.instanceId, Event$1.Events.previewerOpen, function () { + _this2.status.previewer = 'show'; + }); + Event$1.on(this.instanceId, Event$1.Events.editorClose, function () { + _this2.status.editor = 'hide'; // 关闭编辑区时,需要清除所有高亮 + + _this2.previewer.highlightLine(0); + }); + Event$1.on(this.instanceId, Event$1.Events.editorOpen, function () { + _this2.status.editor = 'show'; + }); + } + /** + * 切换编辑模式 + * @param {'edit&preview'|'editOnly'|'previewOnly'} model 模式类型 + * 一般纯预览模式和纯编辑模式适合在屏幕较小的终端使用,比如手机移动端 + * + * @returns + */ + + }, { + key: "switchModel", + value: function switchModel() { + var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'edit&preview'; + + switch (model) { + case 'edit&preview': + if (this.previewer) { + this.previewer.editOnly(true); + this.previewer.recoverPreviewer(); + } + + if (this.toolbar) { + this.toolbar.showToolbar(); + } + + break; + + case 'editOnly': + if (!this.previewer.isPreviewerHidden()) { + this.previewer.editOnly(true); + } + + if (this.toolbar) { + this.toolbar.showToolbar(); + } + + break; + + case 'previewOnly': + this.previewer.previewOnly(); + this.toolbar && this.toolbar.previewOnly(); + break; + } + } + /** + * 获取实例id + * @returns {string} + * @public + */ + + }, { + key: "getInstanceId", + value: function getInstanceId() { + return this.instanceId; + } + /** + * 获取编辑器状态 + * @returns {Object} + */ + + }, { + key: "getStatus", + value: function getStatus() { + return this.status; + } + /** + * 获取编辑区内的markdown源码内容 + * @returns markdown源码内容 + */ + + }, { + key: "getValue", + value: function getValue() { + return this.editor.editor.getValue(); + } + /** + * 获取编辑区内的markdown源码内容 + * @returns markdown源码内容 + */ + + }, { + key: "getMarkdown", + value: function getMarkdown() { + return this.getValue(); + } + /** + * 获取CodeMirror实例 + * @returns CodeMirror实例 + */ + + }, { + key: "getCodeMirror", + value: function getCodeMirror() { + return this.editor.editor; + } + /** + * 获取预览区内的html内容 + * @param {boolean} wrapTheme 是否在外层包裹主题class + * @returns html内容 + */ + + }, { + key: "getHtml", + value: function getHtml() { + var wrapTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + return this.previewer.getValue(wrapTheme); + } + }, { + key: "getPreviewer", + value: function getPreviewer() { + return this.previewer; + } + /** + * 获取目录,目录由head1~6组成 + * @returns 标题head数组 + */ + }, { + key: "getTheme", + value: function getTheme() { + return getThemeFromLocal(true) + } + }, { + key: "setTheme", + value: function setTheme(theme) { + changeTheme(this, theme) + } + }, { + key: "getToc", + value: function getToc() { + var str = this.getHtml(); + /** @type {({level: number;id: string;text: string})[]} */ + + var headerList = []; + var headerRegex = /(.+?)<\/h[0-6]>/g; + str.replace(headerRegex, function (match, level, id, text) { + headerList.push({ + level: +level, + id: id, + text: text + }); + return match; + }); + return headerList; + } + /** + * 覆盖编辑区的内容 + * @param {string} content markdown内容 + * @param {boolean} keepCursor 是否保持光标位置 + * @returns + */ + + }, { + key: "setValue", + value: function setValue(content) { + var keepCursor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (keepCursor === false) { + return this.editor.editor.setValue(content); + } + + var codemirror = this.editor.editor; + var old = this.getValue(); + var pos = codemirror.getDoc().indexFromPos(codemirror.getCursor()); + var newPos = getPosBydiffs(pos, old, content); + var ret = codemirror.setValue(content); + var cursor = codemirror.getDoc().posFromIndex(newPos); + codemirror.setCursor(cursor); + return ret; + } + /** + * 在光标处或者指定行+偏移量插入内容 + * @param {string} content 被插入的文本 + * @param {boolean} [isSelect=false] 是否选中刚插入的内容 + * @param {[number, number]|false} [anchor=false] [x,y] 代表x+1行,y+1字符偏移量,默认false 会从光标处插入 + * @param {boolean} [focus=true] 保持编辑器处于focus状态 + * @returns + */ + + }, { + key: "insert", + value: function insert(content) { + var isSelect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var anchor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var focus = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + + if (anchor) { + this.editor.editor.setSelection({ + line: anchor[0], + ch: anchor[1] + }, { + line: anchor[0], + ch: anchor[1] + }); + } + + var ret = this.editor.editor.replaceSelection(content, isSelect ? 'around' : 'end'); + focus && this.editor.editor.focus(); + return ret; + } + /** + * 在光标处或者指定行+偏移量插入内容 + * @param {string} content 被插入的文本 + * @param {boolean} [isSelect=false] 是否选中刚插入的内容 + * @param {[number, number]|false} [anchor=false] [x,y] 代表x+1行,y+1字符偏移量,默认false 会从光标处插入 + * @param {boolean} [focus=true] 保持编辑器处于focus状态 + * @returns + */ + + }, { + key: "insertValue", + value: function insertValue(content) { + var isSelect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var anchor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var focus = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + return this.insert(content, isSelect, anchor, focus); + } + /** + * 强制重新渲染预览区域 + */ + + }, { + key: "refreshPreviewer", + value: function refreshPreviewer() { + try { + var markdownText = this.getValue(); + var html = this.engine.makeHtml(markdownText); + this.previewer.refresh(html); + } catch (e) { + throw new NestedError(e); + } + } + /** + * 覆盖编辑区的内容 + * @param {string} content markdown内容 + * @param {boolean} keepCursor 是否保持光标位置 + * @returns + */ + + }, { + key: "setMarkdown", + value: function setMarkdown(content) { + var keepCursor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + return this.setValue(content, keepCursor); + } + /** + * @private + * @returns + */ + + }, { + key: "createWrapper", + value: function createWrapper() { + var toolbarTheme = this.options.toolbars.theme === 'dark' ? 'dark' : ''; // TODO: 完善类型 + + var inlineCodeTheme = + /** @type {{theme?: string;}} */ + this.options.engine.syntax.inlineCode.theme; + var codeBlockTheme = + /** @type {{theme?: string;}} */ + this.options.engine.syntax.codeBlock.theme; + if (codeBlockTheme === 'dark') codeBlockTheme = 'tomorrow-night';else if (codeBlockTheme === 'light') codeBlockTheme = 'solarized-light'; + var wrapperDom = createElement('div', ['cherry', 'clearfix', getThemeFromLocal(true)].join(' '), { + 'data-toolbarTheme': toolbarTheme, + 'data-inlineCodeTheme': inlineCodeTheme, + 'data-codeBlockTheme': codeBlockTheme + }); + this.wrapperDom = wrapperDom; + return wrapperDom; + } + /** + * @private + * @returns {Toolbar} + */ + + }, { + key: "createToolbar", + value: function createToolbar() { + var dom = createElement('div', 'cherry-toolbar'); + this.toolbar = new Toolbar({ + dom: dom, + $cherry: this, + buttonRightConfig: this.options.toolbars.toolbarRight, + buttonConfig: this.options.toolbars.toolbar, + customMenu: this.options.toolbars.customMenu + }); + return this.toolbar; + } + /** + * @private + * @returns + */ + + }, { + key: "createSidebar", + value: function createSidebar(wrapperFragment) { + if (this.options.toolbars.sidebar) { + $expectTarget(this.options.toolbars.sidebar, Array); + var externalClass = this.options.toolbars.theme === 'dark' ? 'dark' : ''; + var dom = createElement('div', "cherry-sidebar ".concat(externalClass)); + this.sidebar = new Sidebar({ + dom: dom, + $cherry: this, + buttonConfig: this.options.toolbars.sidebar, + customMenu: this.options.toolbars.customMenu + }); + wrapperFragment.appendChild(this.sidebar.options.dom); + } + } + /** + * @private + * @returns + */ + + }, { + key: "createFloatMenu", + value: function createFloatMenu() { + if (this.options.toolbars["float"]) { + var dom = createElement('div', 'cherry-floatmenu'); + $expectTarget(this.options.toolbars["float"], Array); + this.floatMenu = new FloatMenu({ + dom: dom, + $cherry: this, + buttonConfig: this.options.toolbars["float"], + customMenu: this.options.toolbars.customMenu + }); + } + } + /** + * @private + * @returns + */ + + }, { + key: "createBubble", + value: function createBubble() { + if (this.options.toolbars.bubble) { + var dom = createElement('div', 'cherry-bubble'); + $expectTarget(this.options.toolbars.bubble, Array); + this.bubble = new Bubble({ + dom: dom, + $cherry: this, + buttonConfig: this.options.toolbars.bubble, + customMenu: this.options.toolbars.customMenu, + engine: this.engine + }); + } + } + /** + * @private + * @returns {import('@/Editor').default} + */ + + }, { + key: "createEditor", + value: function createEditor() { + var _this$options$editor$, _this$options$editor$2, _context3, _context4; + + var textArea = createElement('textarea', '', { + id: (_this$options$editor$ = this.options.editor.id) !== null && _this$options$editor$ !== void 0 ? _this$options$editor$ : 'code', + name: (_this$options$editor$2 = this.options.editor.name) !== null && _this$options$editor$2 !== void 0 ? _this$options$editor$2 : 'code' + }); + textArea.textContent = this.options.value; + var editor = createElement('div', 'cherry-editor'); + editor.appendChild(textArea); + this.editor = new Editor(_objectSpread$8({ + $cherry: this, + editorDom: editor, + wrapperDom: this.wrapperDom, + value: this.options.value, + onKeydown: bind$5(_context3 = this.fireShortcutKey).call(_context3, this), + onChange: bind$5(_context4 = this.editText).call(_context4, this), + toolbars: this.options.toolbars, + fileUpload: this.options.fileUpload, + autoScrollByCursor: this.options.autoScrollByCursor + }, this.options.editor)); + return this.editor; + } + /** + * @private + * @returns {import('@/Previewer').default} + */ + + }, { + key: "createPreviewer", + value: function createPreviewer() { + /** @type {HTMLDivElement} */ + var previewer; + var anchorStyle = this.options.engine.syntax.header && this.options.engine.syntax.header.anchorStyle || 'default'; + var autonumberClass = anchorStyle === 'autonumber' ? ' head-num' : ''; + var _this$options$preview = this.options.previewer, + className = _this$options$preview.className, + dom = _this$options$preview.dom, + enablePreviewerBubble = _this$options$preview.enablePreviewerBubble; + var previewerClassName = ['cherry-previewer cherry-markdown', className || '', autonumberClass, getThemeFromLocal(true)].join(' '); + + if (dom) { + previewer = dom; + previewer.className += " ".concat(previewerClassName); + } else { + previewer = createElement('div', previewerClassName); + } + + var virtualDragLine = createElement('div', 'cherry-drag'); + var editorMask = createElement('div', 'cherry-editor-mask'); + var previewerMask = createElement('div', 'cherry-previewer-mask'); + this.previewer = new Previewer({ + $cherry: this, + virtualDragLineDom: virtualDragLine, + editorMaskDom: editorMask, + previewerMaskDom: previewerMask, + previewerDom: previewer, + value: this.options.value, + isPreviewOnly: this.options.isPreviewOnly, + enablePreviewerBubble: enablePreviewerBubble, + lazyLoadImg: this.options.previewer.lazyLoadImg + }); + return this.previewer; + } + /** + * @private + * @param {import('codemirror').Editor} codemirror + */ + + }, { + key: "initText", + value: function initText(codemirror) { + try { + var markdownText = codemirror.getValue(); + var html = this.engine.makeHtml(markdownText); + this.previewer.update(html); + + if (this.options.callback.afterInit) { + this.options.callback.afterInit(markdownText, html); + } + } catch (e) { + throw new NestedError(e); + } + } + /** + * @private + * @param {Event} _evt + * @param {import('codemirror').Editor} codemirror + */ + + }, { + key: "editText", + value: function editText(_evt, codemirror) { + var _this3 = this; + + try { + if (this.timer) { + clearTimeout(this.timer); + this.timer = null; + } + + this.timer = setTimeout$3(function () { + var markdownText = codemirror.getValue(); + + var html = _this3.engine.makeHtml(markdownText); + + _this3.previewer.update(html); + + if (_this3.options.callback.afterChange) { + _this3.options.callback.afterChange(markdownText, html); + } // 强制每次编辑(包括undo、redo)编辑器都会自动滚动到光标位置 + + + codemirror.scrollIntoView(null); + }, 50); + } catch (e) { + throw new NestedError(e); + } + } + /** + * @private + * @param {any} cb + */ + + }, { + key: "onChange", + value: function onChange(cb) { + this.editor.editor.on('change', function (codeMirror) { + cb({ + markdown: codeMirror.getValue() // 后续可以按需增加html或其他状态 + + }); + }); + } + /** + * @private + * @param {*} evt + */ + + }, { + key: "fireShortcutKey", + value: function fireShortcutKey(evt) { + if (this.toolbar.matchShortcutKey(evt)) { + // 快捷键 + evt.preventDefault(); + this.toolbar.fireShortcutKey(evt); + } + } + /** + * 导出预览区域内容 + * @public + * @param {String} type 'pdf':导出成pdf文件; 'img':导出成图片 + * @param {String} fileName 导出文件名 + */ + + }, { + key: "export", + value: function _export() { + var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'pdf'; + var fileName = arguments.length > 1 ? arguments[1] : undefined; + this.previewer["export"](type, fileName); + } + /** + * 修改主题 + * @param {string} theme option.theme里的className + */ + + }, { + key: "setTheme", + value: function setTheme() { + var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default'; + changeTheme(this, theme); + } + /** + * 修改书写风格 + * @param {string} writingStyle normal 普通 | typewriter 打字机 | focus 专注 + */ + + }, { + key: "setWritingStyle", + value: function setWritingStyle(writingStyle) { + this.editor.setWritingStyle(writingStyle); + } + }]); + + return Cherry; + }(CherryStatic); + + _defineProperty(Cherry, "initialized", false); + + _defineProperty(Cherry, "config", { + /** @type {Partial} */ + defaults: defaultConfig$1 + }); + + /** + * Copyright (C) 2021 THL A29 Limited, a Tencent company. + * + * 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. + */ + + if (window) { + // @ts-ignore + window.Cherry = Cherry; + } + + function ownKeys$a(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); enumerableOnly && (symbols = filter$3(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } + + function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? forEach$3(_context4 = ownKeys$a(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : getOwnPropertyDescriptors$2 ? defineProperties$2(target, getOwnPropertyDescriptors$2(source)) : forEach$3(_context5 = ownKeys$a(Object(source))).call(_context5, function (key) { defineProperty$5(target, key, getOwnPropertyDescriptor$3(source, key)); }); } return target; } + var DEFAULT_OPTIONS = { + // TODO: themes + theme: 'default', + altFontFamily: 'sans-serif', + fontFamily: 'sans-serif', + themeCSS: '.label foreignObject { font-size: 90%; overflow: visible; } .label { font-family: sans-serif; }', + flowchart: { + useMaxWidth: false + }, + sequence: { + useMaxWidth: false + }, + startOnLoad: false, + logLevel: 5 // fontFamily: 'Arial, monospace' + + }; + + var MermaidCodeEngine = /*#__PURE__*/function () { + function MermaidCodeEngine() { + var mermaidOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _classCallCheck(this, MermaidCodeEngine); + + _defineProperty(this, "mermaidAPIRefs", null); + + _defineProperty(this, "options", DEFAULT_OPTIONS); + + _defineProperty(this, "dom", null); + + _defineProperty(this, "mermaidCanvas", null); + + var mermaid = mermaidOptions.mermaid, + mermaidAPI = mermaidOptions.mermaidAPI; + + if (!mermaidAPI && !window.mermaidAPI && (!mermaid || !mermaid.mermaidAPI) && (!window.mermaid || !window.mermaid.mermaidAPI)) { + throw new Error('code-block-mermaid-plugin[init]: Package mermaid or mermaidAPI not found.'); + } + + this.options = _objectSpread$9(_objectSpread$9({}, DEFAULT_OPTIONS), mermaidOptions || {}); + this.mermaidAPIRefs = mermaidAPI || window.mermaidAPI || mermaid.mermaidAPI || window.mermaid.mermaidAPI; + delete this.options.mermaid; + delete this.options.mermaidAPI; + this.mermaidAPIRefs.initialize(this.options); + } + + _createClass(MermaidCodeEngine, [{ + key: "mountMermaidCanvas", + value: function mountMermaidCanvas($engine) { + if (this.mermaidCanvas && document.body.contains(this.mermaidCanvas)) { + return; + } + + this.mermaidCanvas = document.createElement('div'); + this.mermaidCanvas.style = 'width:1024px;opacity:0;position:fixed;top:100%;'; + var container = $engine.$cherry.wrapperDom || document.body; + container.appendChild(this.mermaidCanvas); + } + /** + * 转换svg为img,如果出错则直出svg + * @param {string} svgCode + * @param {string} graphId + * @returns {string} + */ + + }, { + key: "convertMermaidSvgToImg", + value: function convertMermaidSvgToImg(svgCode, graphId) { + var domParser = new DOMParser(); + var svgHtml; + + var injectSvgFallback = function injectSvgFallback(svg) { + return svg.replace('"); + } + } else { + svgHtml = injectSvgFallback(svgCode); + } + } catch (e) { + svgHtml = injectSvgFallback(svgCode); + } + + return svgHtml; + } + }, { + key: "render", + value: function render(src, sign, $engine) { + var _context3, + _config$svg2img, + _this = this; + + var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + var $sign = sign; + + if (!$sign) { + $sign = Math.round(Math.random() * 100000000); + } + + this.mountMermaidCanvas($engine); + var html; // 多实例的情况下相同的内容ID相同会导致mermaid渲染异常 + // 需要通过添加时间戳使得多次渲染相同内容的图像ID唯一 + // 图像渲染节流在CodeBlock Hook内部控制 + + var graphId = concat$5(_context3 = "mermaid-".concat($sign, "-")).call(_context3, new Date().getTime()); + + this.svg2img = (_config$svg2img = config === null || config === void 0 ? void 0 : config.svg2img) !== null && _config$svg2img !== void 0 ? _config$svg2img : false; + + try { + this.mermaidAPIRefs.render(graphId, src, function (svgCode) { + var fixedSvg = svgCode.replace(/\s*markerUnits="0"/g, '').replace(/\s*x="NaN"/g, '').replace(/
/g, '
'); + html = _this.convertMermaidSvgToImg(fixedSvg, graphId); + }, this.mermaidCanvas); + } catch (e) { + return e === null || e === void 0 ? void 0 : e.str; + } + + return html; + } + }], [{ + key: "install", + value: function install(cherryOptions) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + mergeWith_1(cherryOptions, { + engine: { + syntax: { + codeBlock: { + customRenderer: { + mermaid: _construct(MermaidCodeEngine, args) + } + } + } + } + }); + } + }]); + + return MermaidCodeEngine; + }(); + + _defineProperty(MermaidCodeEngine, "TYPE", 'figure'); + + // @ts-nocheck + + /* + * $Id: rawdeflate.js,v 0.3 2009/03/01 19:05:05 dankogai Exp dankogai $ + * + * Original: + * http://www.onicos.com/staff/iz/amuse/javascript/expert/deflate.txt + */ + // if run as a web worker, respond to messages by deflating them + var deflate = function () { + /* Copyright (C) 1999 Masanao Izumo + * Version: 1.0.1 + * LastModified: Dec 25 1999 + */ + + /* Interface: + * data = deflate(src); + */ + + /* constant parameters */ + var zip_WSIZE = 32768; // Sliding Window size + + var zip_STORED_BLOCK = 0; + var zip_STATIC_TREES = 1; + var zip_DYN_TREES = 2; + /* for deflate */ + + var zip_DEFAULT_LEVEL = 6; + var zip_INBUFSIZ = 32768; // Input buffer size + + var zip_INBUF_EXTRA = 64; // Extra buffer + + var zip_OUTBUFSIZ = 1024 * 8; + var zip_window_size = 2 * zip_WSIZE; + var zip_MIN_MATCH = 3; + var zip_MAX_MATCH = 258; + var zip_BITS = 16; // for SMALL_MEM + + var zip_LIT_BUFSIZE = 0x2000; + var zip_HASH_BITS = 13; // for MEDIUM_MEM + // var zip_LIT_BUFSIZE = 0x4000; + // var zip_HASH_BITS = 14; + // for BIG_MEM + // var zip_LIT_BUFSIZE = 0x8000; + // var zip_HASH_BITS = 15; + // if(zip_LIT_BUFSIZE > zip_INBUFSIZ) + // alert("error: zip_INBUFSIZ is too small"); + // if((zip_WSIZE<<1) > (1< zip_BITS-1) + // alert("error: zip_HASH_BITS is too large"); + // if(zip_HASH_BITS < 8 || zip_MAX_MATCH != 258) + // alert("error: Code too clever"); + + var zip_DIST_BUFSIZE = zip_LIT_BUFSIZE; + var zip_HASH_SIZE = 1 << zip_HASH_BITS; + var zip_HASH_MASK = zip_HASH_SIZE - 1; + var zip_WMASK = zip_WSIZE - 1; + var zip_NIL = 0; // Tail of hash chains + + var zip_TOO_FAR = 4096; + var zip_MIN_LOOKAHEAD = zip_MAX_MATCH + zip_MIN_MATCH + 1; + var zip_MAX_DIST = zip_WSIZE - zip_MIN_LOOKAHEAD; + var zip_SMALLEST = 1; + var zip_MAX_BITS = 15; + var zip_MAX_BL_BITS = 7; + var zip_LENGTH_CODES = 29; + var zip_LITERALS = 256; + var zip_END_BLOCK = 256; + var zip_L_CODES = zip_LITERALS + 1 + zip_LENGTH_CODES; + var zip_D_CODES = 30; + var zip_BL_CODES = 19; + var zip_REP_3_6 = 16; + var zip_REPZ_3_10 = 17; + var zip_REPZ_11_138 = 18; + var zip_HEAP_SIZE = 2 * zip_L_CODES + 1; + + var zip_H_SHIFT = _parseInt$2((zip_HASH_BITS + zip_MIN_MATCH - 1) / zip_MIN_MATCH); + /* variables */ + + + var zip_free_queue; + var zip_qhead; + var zip_qtail; + var zip_initflag; + var zip_outbuf = null; + var zip_outcnt; + var zip_outoff; + var zip_complete; + var zip_window; + var zip_d_buf; + var zip_l_buf; + var zip_prev; + var zip_bi_buf; + var zip_bi_valid; + var zip_block_start; + var zip_ins_h; + var zip_hash_head; + var zip_prev_match; + var zip_match_available; + var zip_match_length; + var zip_prev_length; + var zip_strstart; + var zip_match_start; + var zip_eofile; + var zip_lookahead; + var zip_max_chain_length; + var zip_max_lazy_match; + var zip_compr_level; + var zip_good_match; + var zip_dyn_ltree; + var zip_dyn_dtree; + var zip_static_ltree; + var zip_static_dtree; + var zip_bl_tree; + var zip_l_desc; + var zip_d_desc; + var zip_bl_desc; + var zip_bl_count; + var zip_heap; + var zip_heap_len; + var zip_heap_max; + var zip_depth; + var zip_length_code; + var zip_dist_code; + var zip_base_length; + var zip_base_dist; + var zip_flag_buf; + var zip_last_lit; + var zip_last_dist; + var zip_last_flags; + var zip_flags; + var zip_flag_bit; + var zip_opt_len; + var zip_static_len; + var zip_deflate_data; + var zip_deflate_pos; + /* objects (deflate) */ + + function zip_DeflateCT() { + this.fc = 0; // frequency count or bit string + + this.dl = 0; // father node in Huffman tree or length of bit string + } + + function zip_DeflateTreeDesc() { + this.dyn_tree = null; // the dynamic tree + + this.static_tree = null; // corresponding static tree or NULL + + this.extra_bits = null; // extra bits for each code or NULL + + this.extra_base = 0; // base index for extra_bits + + this.elems = 0; // max number of elements in the tree + + this.max_length = 0; // max bit length for the codes + + this.max_code = 0; // largest code with non zero frequency + } + /* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ + + + function zip_DeflateConfiguration(a, b, c, d) { + this.good_length = a; // reduce lazy search above this match length + + this.max_lazy = b; // do not perform lazy search above this match length + + this.nice_length = c; // quit search above this match length + + this.max_chain = d; + } + + function zip_DeflateBuffer() { + this.next = null; + this.len = 0; + this.ptr = new Array(zip_OUTBUFSIZ); + this.off = 0; + } + /* constant tables */ + + + var zip_extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]; + var zip_extra_dbits = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]; + var zip_extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]; + var zip_bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; + var zip_configuration_table = [new zip_DeflateConfiguration(0, 0, 0, 0), new zip_DeflateConfiguration(4, 4, 8, 4), new zip_DeflateConfiguration(4, 5, 16, 8), new zip_DeflateConfiguration(4, 6, 32, 32), new zip_DeflateConfiguration(4, 4, 16, 16), new zip_DeflateConfiguration(8, 16, 32, 32), new zip_DeflateConfiguration(8, 16, 128, 128), new zip_DeflateConfiguration(8, 32, 128, 256), new zip_DeflateConfiguration(32, 128, 258, 1024), new zip_DeflateConfiguration(32, 258, 258, 4096)]; + /* routines (deflate) */ + + function zip_deflate_start(level) { + var i; + if (!level) level = zip_DEFAULT_LEVEL;else if (level < 1) level = 1;else if (level > 9) level = 9; + zip_compr_level = level; + zip_initflag = false; + zip_eofile = false; + if (zip_outbuf != null) return; + zip_free_queue = zip_qhead = zip_qtail = null; + zip_outbuf = new Array(zip_OUTBUFSIZ); + zip_window = new Array(zip_window_size); + zip_d_buf = new Array(zip_DIST_BUFSIZE); + zip_l_buf = new Array(zip_INBUFSIZ + zip_INBUF_EXTRA); + zip_prev = new Array(1 << zip_BITS); + zip_dyn_ltree = new Array(zip_HEAP_SIZE); + + for (i = 0; i < zip_HEAP_SIZE; i++) { + zip_dyn_ltree[i] = new zip_DeflateCT(); + } + + zip_dyn_dtree = new Array(2 * zip_D_CODES + 1); + + for (i = 0; i < 2 * zip_D_CODES + 1; i++) { + zip_dyn_dtree[i] = new zip_DeflateCT(); + } + + zip_static_ltree = new Array(zip_L_CODES + 2); + + for (i = 0; i < zip_L_CODES + 2; i++) { + zip_static_ltree[i] = new zip_DeflateCT(); + } + + zip_static_dtree = new Array(zip_D_CODES); + + for (i = 0; i < zip_D_CODES; i++) { + zip_static_dtree[i] = new zip_DeflateCT(); + } + + zip_bl_tree = new Array(2 * zip_BL_CODES + 1); + + for (i = 0; i < 2 * zip_BL_CODES + 1; i++) { + zip_bl_tree[i] = new zip_DeflateCT(); + } + + zip_l_desc = new zip_DeflateTreeDesc(); + zip_d_desc = new zip_DeflateTreeDesc(); + zip_bl_desc = new zip_DeflateTreeDesc(); + zip_bl_count = new Array(zip_MAX_BITS + 1); + zip_heap = new Array(2 * zip_L_CODES + 1); + zip_depth = new Array(2 * zip_L_CODES + 1); + zip_length_code = new Array(zip_MAX_MATCH - zip_MIN_MATCH + 1); + zip_dist_code = new Array(512); + zip_base_length = new Array(zip_LENGTH_CODES); + zip_base_dist = new Array(zip_D_CODES); + zip_flag_buf = new Array(_parseInt$2(zip_LIT_BUFSIZE / 8)); + } + + function zip_reuse_queue(p) { + p.next = zip_free_queue; + zip_free_queue = p; + } + + function zip_new_queue() { + var p; + + if (zip_free_queue != null) { + p = zip_free_queue; + zip_free_queue = zip_free_queue.next; + } else p = new zip_DeflateBuffer(); + + p.next = null; + p.len = p.off = 0; + return p; + } + + function zip_head1(i) { + return zip_prev[zip_WSIZE + i]; + } + + function zip_head2(i, val) { + return zip_prev[zip_WSIZE + i] = val; + } + /* put_byte is used for the compressed output, put_ubyte for the + * uncompressed output. However unlzw() uses window for its + * suffix table instead of its output buffer, so it does not use put_ubyte + * (to be cleaned up). + */ + + + function zip_put_byte(c) { + zip_outbuf[zip_outoff + zip_outcnt++] = c; + if (zip_outoff + zip_outcnt == zip_OUTBUFSIZ) zip_qoutbuf(); + } + /* Output a 16 bit value, lsb first */ + + + function zip_put_short(w) { + w &= 0xffff; + + if (zip_outoff + zip_outcnt < zip_OUTBUFSIZ - 2) { + zip_outbuf[zip_outoff + zip_outcnt++] = w & 0xff; + zip_outbuf[zip_outoff + zip_outcnt++] = w >>> 8; + } else { + zip_put_byte(w & 0xff); + zip_put_byte(w >>> 8); + } + } + /* ========================================================================== + * Insert string s in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of s are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ + + + function zip_INSERT_STRING() { + zip_ins_h = (zip_ins_h << zip_H_SHIFT ^ zip_window[zip_strstart + zip_MIN_MATCH - 1] & 0xff) & zip_HASH_MASK; + zip_hash_head = zip_head1(zip_ins_h); + zip_prev[zip_strstart & zip_WMASK] = zip_hash_head; + zip_head2(zip_ins_h, zip_strstart); + } + /* Send a code of the given tree. c and tree must not have side effects */ + + + function zip_SEND_CODE(c, tree) { + zip_send_bits(tree[c].fc, tree[c].dl); + } + /* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. dist_code[256] and dist_code[257] are never + * used. + */ + + + function zip_D_CODE(dist) { + return (dist < 256 ? zip_dist_code[dist] : zip_dist_code[256 + (dist >> 7)]) & 0xff; + } + /* ========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ + + + function zip_SMALLER(tree, n, m) { + return tree[n].fc < tree[m].fc || tree[n].fc == tree[m].fc && zip_depth[n] <= zip_depth[m]; + } + /* ========================================================================== + * read string data + */ + + + function zip_read_buff(buff, offset, n) { + var i; + + for (i = 0; i < n && zip_deflate_pos < zip_deflate_data.length; i++) { + buff[offset + i] = zip_deflate_data.charCodeAt(zip_deflate_pos++) & 0xff; + } + + return i; + } + /* ========================================================================== + * Initialize the "longest match" routines for a new file + */ + + + function zip_lm_init() { + var j; + /* Initialize the hash table. */ + + for (j = 0; j < zip_HASH_SIZE; j++) { + // zip_head2(j, zip_NIL); + zip_prev[zip_WSIZE + j] = 0; + } + /* prev will be initialized on the fly */ + + /* Set the default configuration parameters: + */ + + + zip_max_lazy_match = zip_configuration_table[zip_compr_level].max_lazy; + zip_good_match = zip_configuration_table[zip_compr_level].good_length; + zip_max_chain_length = zip_configuration_table[zip_compr_level].max_chain; + zip_strstart = 0; + zip_block_start = 0; + zip_lookahead = zip_read_buff(zip_window, 0, 2 * zip_WSIZE); + + if (zip_lookahead <= 0) { + zip_eofile = true; + zip_lookahead = 0; + return; + } + + zip_eofile = false; + /* Make sure that we always have enough lookahead. This is important + * if input comes from a device such as a tty. + */ + + while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) { + zip_fill_window(); + } + /* If lookahead < MIN_MATCH, ins_h is garbage, but this is + * not important since only literal bytes will be emitted. + */ + + + zip_ins_h = 0; + + for (j = 0; j < zip_MIN_MATCH - 1; j++) { + // UPDATE_HASH(ins_h, window[j]); + zip_ins_h = (zip_ins_h << zip_H_SHIFT ^ zip_window[j] & 0xff) & zip_HASH_MASK; + } + } + /* ========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + */ + + + function zip_longest_match(cur_match) { + var chain_length = zip_max_chain_length; // max hash chain length + + var scanp = zip_strstart; // current string + + var matchp; // matched string + + var len; // length of current match + + var best_len = zip_prev_length; // best match length so far + + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + + var limit = zip_strstart > zip_MAX_DIST ? zip_strstart - zip_MAX_DIST : zip_NIL; + var strendp = zip_strstart + zip_MAX_MATCH; + var scan_end1 = zip_window[scanp + best_len - 1]; + var scan_end = zip_window[scanp + best_len]; + /* Do not waste too much time if we already have a good match: */ + + if (zip_prev_length >= zip_good_match) chain_length >>= 2; // Assert(encoder->strstart <= window_size-MIN_LOOKAHEAD, "insufficient lookahead"); + + do { + // Assert(cur_match < encoder->strstart, "no future"); + matchp = cur_match; + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2: + */ + + if (zip_window[matchp + best_len] != scan_end || zip_window[matchp + best_len - 1] != scan_end1 || zip_window[matchp] != zip_window[scanp] || zip_window[++matchp] != zip_window[scanp + 1]) { + continue; + } + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + + + scanp += 2; + matchp++; + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + + do {} while (zip_window[++scanp] == zip_window[++matchp] && zip_window[++scanp] == zip_window[++matchp] && zip_window[++scanp] == zip_window[++matchp] && zip_window[++scanp] == zip_window[++matchp] && zip_window[++scanp] == zip_window[++matchp] && zip_window[++scanp] == zip_window[++matchp] && zip_window[++scanp] == zip_window[++matchp] && zip_window[++scanp] == zip_window[++matchp] && scanp < strendp); + + len = zip_MAX_MATCH - (strendp - scanp); + scanp = strendp - zip_MAX_MATCH; + + if (len > best_len) { + zip_match_start = cur_match; + best_len = len; + + { + if (len >= zip_MAX_MATCH) break; + } + + scan_end1 = zip_window[scanp + best_len - 1]; + scan_end = zip_window[scanp + best_len]; + } + } while ((cur_match = zip_prev[cur_match & zip_WMASK]) > limit && --chain_length != 0); + + return best_len; + } + /* ========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead, and sets eofile if end of input file. + * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0 + * OUT assertions: at least one byte has been read, or eofile is set; + * file reads are performed for at least two bytes (required for the + * translate_eol option). + */ + + + function zip_fill_window() { + var n; + var m; // Amount of free space at the end of the window. + + var more = zip_window_size - zip_lookahead - zip_strstart; + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + + if (more == -1) { + /* Very unlikely, but possible on 16 bit machine if strstart == 0 + * and lookahead == 1 (input done one byte at time) + */ + more--; + } else if (zip_strstart >= zip_WSIZE + zip_MAX_DIST) { + /* By the IN assertion, the window is not empty so we can't confuse + * more == 0 with more == 64K on a 16 bit machine. + */ + // Assert(window_size == (ulg)2*WSIZE, "no sliding with BIG_MEM"); + // System.arraycopy(window, WSIZE, window, 0, WSIZE); + for (n = 0; n < zip_WSIZE; n++) { + zip_window[n] = zip_window[n + zip_WSIZE]; + } + + zip_match_start -= zip_WSIZE; + zip_strstart -= zip_WSIZE; + /* we now have strstart >= MAX_DIST: */ + + zip_block_start -= zip_WSIZE; + + for (n = 0; n < zip_HASH_SIZE; n++) { + m = zip_head1(n); + zip_head2(n, m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL); + } + + for (n = 0; n < zip_WSIZE; n++) { + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + m = zip_prev[n]; + zip_prev[n] = m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL; + } + + more += zip_WSIZE; + } // At this point, more >= 2 + + + if (!zip_eofile) { + n = zip_read_buff(zip_window, zip_strstart + zip_lookahead, more); + if (n <= 0) zip_eofile = true;else zip_lookahead += n; + } + } + /* ========================================================================== + * Processes a new input file and return its compressed length. This + * function does not perform lazy evaluationof matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ + + + function zip_deflate_fast() { + while (zip_lookahead != 0 && zip_qhead == null) { + var flush; // set if current block must be flushed + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + + zip_INSERT_STRING(); + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + + if (zip_hash_head != zip_NIL && zip_strstart - zip_hash_head <= zip_MAX_DIST) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + zip_match_length = zip_longest_match(zip_hash_head); + /* longest_match() sets match_start */ + + if (zip_match_length > zip_lookahead) zip_match_length = zip_lookahead; + } + + if (zip_match_length >= zip_MIN_MATCH) { + // check_match(strstart, match_start, match_length); + flush = zip_ct_tally(zip_strstart - zip_match_start, zip_match_length - zip_MIN_MATCH); + zip_lookahead -= zip_match_length; + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ + + if (zip_match_length <= zip_max_lazy_match) { + zip_match_length--; // string at strstart already in hash table + + do { + zip_strstart++; + zip_INSERT_STRING(); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH + * these bytes are garbage, but it does not matter since + * the next lookahead bytes will be emitted as literals. + */ + } while (--zip_match_length != 0); + + zip_strstart++; + } else { + zip_strstart += zip_match_length; + zip_match_length = 0; + zip_ins_h = zip_window[zip_strstart] & 0xff; // UPDATE_HASH(ins_h, window[strstart + 1]); + + zip_ins_h = (zip_ins_h << zip_H_SHIFT ^ zip_window[zip_strstart + 1] & 0xff) & zip_HASH_MASK; // #if MIN_MATCH != 3 + // Call UPDATE_HASH() MIN_MATCH-3 more times + // #endif + } + } else { + /* No match, output a literal byte */ + flush = zip_ct_tally(0, zip_window[zip_strstart] & 0xff); + zip_lookahead--; + zip_strstart++; + } + + if (flush) { + zip_flush_block(0); + zip_block_start = zip_strstart; + } + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + + + while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) { + zip_fill_window(); + } + } + } + + function zip_deflate_better() { + /* Process the input block. */ + while (zip_lookahead != 0 && zip_qhead == null) { + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + zip_INSERT_STRING(); + /* Find the longest match, discarding those <= prev_length. + */ + + zip_prev_length = zip_match_length; + zip_prev_match = zip_match_start; + zip_match_length = zip_MIN_MATCH - 1; + + if (zip_hash_head != zip_NIL && zip_prev_length < zip_max_lazy_match && zip_strstart - zip_hash_head <= zip_MAX_DIST) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + zip_match_length = zip_longest_match(zip_hash_head); + /* longest_match() sets match_start */ + + if (zip_match_length > zip_lookahead) zip_match_length = zip_lookahead; + /* Ignore a length 3 match if it is too distant: */ + + if (zip_match_length == zip_MIN_MATCH && zip_strstart - zip_match_start > zip_TOO_FAR) { + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + zip_match_length--; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + + + if (zip_prev_length >= zip_MIN_MATCH && zip_match_length <= zip_prev_length) { + var flush; // set if current block must be flushed + // check_match(strstart - 1, prev_match, prev_length); + + flush = zip_ct_tally(zip_strstart - 1 - zip_prev_match, zip_prev_length - zip_MIN_MATCH); + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. + */ + + zip_lookahead -= zip_prev_length - 1; + zip_prev_length -= 2; + + do { + zip_strstart++; + zip_INSERT_STRING(); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH + * these bytes are garbage, but it does not matter since the + * next lookahead bytes will always be emitted as literals. + */ + } while (--zip_prev_length != 0); + + zip_match_available = 0; + zip_match_length = zip_MIN_MATCH - 1; + zip_strstart++; + + if (flush) { + zip_flush_block(0); + zip_block_start = zip_strstart; + } + } else if (zip_match_available != 0) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + if (zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff)) { + zip_flush_block(0); + zip_block_start = zip_strstart; + } + + zip_strstart++; + zip_lookahead--; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + zip_match_available = 1; + zip_strstart++; + zip_lookahead--; + } + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + + + while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) { + zip_fill_window(); + } + } + } + + function zip_init_deflate() { + if (zip_eofile) return; + zip_bi_buf = 0; + zip_bi_valid = 0; + zip_ct_init(); + zip_lm_init(); + zip_qhead = null; + zip_outcnt = 0; + zip_outoff = 0; + + if (zip_compr_level <= 3) { + zip_prev_length = zip_MIN_MATCH - 1; + zip_match_length = 0; + } else { + zip_match_length = zip_MIN_MATCH - 1; + zip_match_available = 0; + } + + zip_complete = false; + } + /* ========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ + + + function zip_deflate_internal(buff, off, buff_size) { + var n; + + if (!zip_initflag) { + zip_init_deflate(); + zip_initflag = true; + + if (zip_lookahead == 0) { + // empty + zip_complete = true; + return 0; + } + } + + if ((n = zip_qcopy(buff, off, buff_size)) == buff_size) return buff_size; + if (zip_complete) return n; + if (zip_compr_level <= 3) // optimized for speed + zip_deflate_fast();else zip_deflate_better(); + + if (zip_lookahead == 0) { + if (zip_match_available != 0) zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff); + zip_flush_block(1); + zip_complete = true; + } + + return n + zip_qcopy(buff, n + off, buff_size - n); + } + + function zip_qcopy(buff, off, buff_size) { + var n; + var i; + var j; + n = 0; + + while (zip_qhead != null && n < buff_size) { + i = buff_size - n; + if (i > zip_qhead.len) i = zip_qhead.len; // System.arraycopy(qhead.ptr, qhead.off, buff, off + n, i); + + for (j = 0; j < i; j++) { + buff[off + n + j] = zip_qhead.ptr[zip_qhead.off + j]; + } + + zip_qhead.off += i; + zip_qhead.len -= i; + n += i; + + if (zip_qhead.len == 0) { + var p; + p = zip_qhead; + zip_qhead = zip_qhead.next; + zip_reuse_queue(p); + } + } + + if (n == buff_size) return n; + + if (zip_outoff < zip_outcnt) { + i = buff_size - n; + if (i > zip_outcnt - zip_outoff) i = zip_outcnt - zip_outoff; // System.arraycopy(outbuf, outoff, buff, off + n, i); + + for (j = 0; j < i; j++) { + buff[off + n + j] = zip_outbuf[zip_outoff + j]; + } + + zip_outoff += i; + n += i; + if (zip_outcnt == zip_outoff) zip_outcnt = zip_outoff = 0; + } + + return n; + } + /* ========================================================================== + * Allocate the match buffer, initialize the various tables and save the + * location of the internal file attribute (ascii/binary) and method + * (DEFLATE/STORE). + */ + + + function zip_ct_init() { + var n; // iterates over tree elements + + var bits; // bit counter + + var length; // length value + + var code; // code value + + var dist; // distance index + + if (zip_static_dtree[0].dl != 0) return; // ct_init already called + + zip_l_desc.dyn_tree = zip_dyn_ltree; + zip_l_desc.static_tree = zip_static_ltree; + zip_l_desc.extra_bits = zip_extra_lbits; + zip_l_desc.extra_base = zip_LITERALS + 1; + zip_l_desc.elems = zip_L_CODES; + zip_l_desc.max_length = zip_MAX_BITS; + zip_l_desc.max_code = 0; + zip_d_desc.dyn_tree = zip_dyn_dtree; + zip_d_desc.static_tree = zip_static_dtree; + zip_d_desc.extra_bits = zip_extra_dbits; + zip_d_desc.extra_base = 0; + zip_d_desc.elems = zip_D_CODES; + zip_d_desc.max_length = zip_MAX_BITS; + zip_d_desc.max_code = 0; + zip_bl_desc.dyn_tree = zip_bl_tree; + zip_bl_desc.static_tree = null; + zip_bl_desc.extra_bits = zip_extra_blbits; + zip_bl_desc.extra_base = 0; + zip_bl_desc.elems = zip_BL_CODES; + zip_bl_desc.max_length = zip_MAX_BL_BITS; + zip_bl_desc.max_code = 0; // Initialize the mapping length (0..255) -> length code (0..28) + + length = 0; + + for (code = 0; code < zip_LENGTH_CODES - 1; code++) { + zip_base_length[code] = length; + + for (n = 0; n < 1 << zip_extra_lbits[code]; n++) { + zip_length_code[length++] = code; + } + } // Assert (length == 256, "ct_init: length != 256"); + + /* Note that the length 255 (match length 258) can be represented + * in two different ways: code 284 + 5 bits or code 285, so we + * overwrite length_code[255] to use the best encoding: + */ + + + zip_length_code[length - 1] = code; + /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ + + dist = 0; + + for (code = 0; code < 16; code++) { + zip_base_dist[code] = dist; + + for (n = 0; n < 1 << zip_extra_dbits[code]; n++) { + zip_dist_code[dist++] = code; + } + } // Assert (dist == 256, "ct_init: dist != 256"); + + + dist >>= 7; // from now on, all distances are divided by 128 + + for (; code < zip_D_CODES; code++) { + zip_base_dist[code] = dist << 7; + + for (n = 0; n < 1 << zip_extra_dbits[code] - 7; n++) { + zip_dist_code[256 + dist++] = code; + } + } // Assert (dist == 256, "ct_init: 256+dist != 512"); + // Construct the codes of the static literal tree + + + for (bits = 0; bits <= zip_MAX_BITS; bits++) { + zip_bl_count[bits] = 0; + } + + n = 0; + + while (n <= 143) { + zip_static_ltree[n++].dl = 8; + zip_bl_count[8]++; + } + + while (n <= 255) { + zip_static_ltree[n++].dl = 9; + zip_bl_count[9]++; + } + + while (n <= 279) { + zip_static_ltree[n++].dl = 7; + zip_bl_count[7]++; + } + + while (n <= 287) { + zip_static_ltree[n++].dl = 8; + zip_bl_count[8]++; + } + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + + + zip_gen_codes(zip_static_ltree, zip_L_CODES + 1); + /* The static distance tree is trivial: */ + + for (n = 0; n < zip_D_CODES; n++) { + zip_static_dtree[n].dl = 5; + zip_static_dtree[n].fc = zip_bi_reverse(n, 5); + } // Initialize the first block of the first file: + + + zip_init_block(); + } + /* ========================================================================== + * Initialize a new block. + */ + + + function zip_init_block() { + var n; // iterates over tree elements + // Initialize the trees. + + for (n = 0; n < zip_L_CODES; n++) { + zip_dyn_ltree[n].fc = 0; + } + + for (n = 0; n < zip_D_CODES; n++) { + zip_dyn_dtree[n].fc = 0; + } + + for (n = 0; n < zip_BL_CODES; n++) { + zip_bl_tree[n].fc = 0; + } + + zip_dyn_ltree[zip_END_BLOCK].fc = 1; + zip_opt_len = zip_static_len = 0; + zip_last_lit = zip_last_dist = zip_last_flags = 0; + zip_flags = 0; + zip_flag_bit = 1; + } + /* ========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ + + + function zip_pqdownheap(tree, // the tree to restore + k) { + // node to move down + var v = zip_heap[k]; + var j = k << 1; // left son of k + + while (j <= zip_heap_len) { + // Set j to the smallest of the two sons: + if (j < zip_heap_len && zip_SMALLER(tree, zip_heap[j + 1], zip_heap[j])) j++; // Exit if v is smaller than both sons + + if (zip_SMALLER(tree, v, zip_heap[j])) break; // Exchange v with the smallest son + + zip_heap[k] = zip_heap[j]; + k = j; // And continue down the tree, setting j to the left son of k + + j <<= 1; + } + + zip_heap[k] = v; + } + /* ========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ + + + function zip_gen_bitlen(desc) { + // the tree descriptor + var tree = desc.dyn_tree; + var extra = desc.extra_bits; + var base = desc.extra_base; + var max_code = desc.max_code; + var max_length = desc.max_length; + var stree = desc.static_tree; + var h; // heap index + + var n; + var m; // iterate over the tree elements + + var bits; // bit length + + var xbits; // extra bits + + var f; // frequency + + var overflow = 0; // number of elements with bit length too large + + for (bits = 0; bits <= zip_MAX_BITS; bits++) { + zip_bl_count[bits] = 0; + } + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + + + tree[zip_heap[zip_heap_max]].dl = 0; // root of the heap + + for (h = zip_heap_max + 1; h < zip_HEAP_SIZE; h++) { + n = zip_heap[h]; + bits = tree[tree[n].dl].dl + 1; + + if (bits > max_length) { + bits = max_length; + overflow++; + } + + tree[n].dl = bits; // We overwrite tree[n].dl which is no longer needed + + if (n > max_code) continue; // not a leaf node + + zip_bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n - base]; + f = tree[n].fc; + zip_opt_len += f * (bits + xbits); + if (stree != null) zip_static_len += f * (stree[n].dl + xbits); + } + + if (overflow == 0) return; // This happens for example on obj2 and pic of the Calgary corpus + // Find the first bit length which could increase: + + do { + bits = max_length - 1; + + while (zip_bl_count[bits] == 0) { + bits--; + } + + zip_bl_count[bits]--; // move one leaf down the tree + + zip_bl_count[bits + 1] += 2; // move one overflow item as its brother + + zip_bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + + overflow -= 2; + } while (overflow > 0); + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + + + for (bits = max_length; bits != 0; bits--) { + n = zip_bl_count[bits]; + + while (n != 0) { + m = zip_heap[--h]; + if (m > max_code) continue; + + if (tree[m].dl != bits) { + zip_opt_len += (bits - tree[m].dl) * tree[m].fc; + tree[m].fc = bits; + } + + n--; + } + } + } + /* ========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ + + + function zip_gen_codes(tree, // the tree to decorate + max_code) { + // largest code with non zero frequency + var next_code = new Array(zip_MAX_BITS + 1); // next code value for each bit length + + var code = 0; // running code value + + var bits; // bit index + + var n; // code index + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + + for (bits = 1; bits <= zip_MAX_BITS; bits++) { + code = code + zip_bl_count[bits - 1] << 1; + next_code[bits] = code; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + // Assert (code + encoder->bl_count[MAX_BITS]-1 == (1<> 1; n >= 1; n--) { + zip_pqdownheap(tree, n); + } + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + + + do { + n = zip_heap[zip_SMALLEST]; + zip_heap[zip_SMALLEST] = zip_heap[zip_heap_len--]; + zip_pqdownheap(tree, zip_SMALLEST); + m = zip_heap[zip_SMALLEST]; // m = node of next least frequency + // keep the nodes sorted by frequency + + zip_heap[--zip_heap_max] = n; + zip_heap[--zip_heap_max] = m; // Create a new node father of n and m + + tree[node].fc = tree[n].fc + tree[m].fc; // depth[node] = (char)(MAX(depth[n], depth[m]) + 1); + + if (zip_depth[n] > zip_depth[m] + 1) zip_depth[node] = zip_depth[n];else zip_depth[node] = zip_depth[m] + 1; + tree[n].dl = tree[m].dl = node; // and insert the new node in the heap + + zip_heap[zip_SMALLEST] = node++; + zip_pqdownheap(tree, zip_SMALLEST); + } while (zip_heap_len >= 2); + + zip_heap[--zip_heap_max] = zip_heap[zip_SMALLEST]; + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + + zip_gen_bitlen(desc); // The field len is now set, we can generate the bit codes + + zip_gen_codes(tree, max_code); + } + /* ========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. Updates opt_len to take into account the repeat + * counts. (The contribution of the bit length codes will be added later + * during the construction of bl_tree.) + */ + + + function zip_scan_tree(tree, // the tree to be scanned + max_code) { + // and its largest code of non zero frequency + var n; // iterates over all tree elements + + var prevlen = -1; // last emitted length + + var curlen; // length of current code + + var nextlen = tree[0].dl; // length of next code + + var count = 0; // repeat count of the current code + + var max_count = 7; // max repeat count + + var min_count = 4; // min repeat count + + if (nextlen == 0) { + max_count = 138; + min_count = 3; + } + + tree[max_code + 1].dl = 0xffff; // guard + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[n + 1].dl; + if (++count < max_count && curlen == nextlen) continue;else if (count < min_count) zip_bl_tree[curlen].fc += count;else if (curlen != 0) { + if (curlen != prevlen) zip_bl_tree[curlen].fc++; + zip_bl_tree[zip_REP_3_6].fc++; + } else if (count <= 10) zip_bl_tree[zip_REPZ_3_10].fc++;else zip_bl_tree[zip_REPZ_11_138].fc++; + count = 0; + prevlen = curlen; + + if (nextlen == 0) { + max_count = 138; + min_count = 3; + } else if (curlen == nextlen) { + max_count = 6; + min_count = 3; + } else { + max_count = 7; + min_count = 4; + } + } + } + /* ========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ + + + function zip_send_tree(tree, // the tree to be scanned + max_code) { + // and its largest code of non zero frequency + var n; // iterates over all tree elements + + var prevlen = -1; // last emitted length + + var curlen; // length of current code + + var nextlen = tree[0].dl; // length of next code + + var count = 0; // repeat count of the current code + + var max_count = 7; // max repeat count + + var min_count = 4; + /* guard already set */ + // min repeat count + + /* tree[max_code+1].dl = -1; */ + + if (nextlen == 0) { + max_count = 138; + min_count = 3; + } + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[n + 1].dl; + + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { + zip_SEND_CODE(curlen, zip_bl_tree); + } while (--count != 0); + } else if (curlen != 0) { + if (curlen != prevlen) { + zip_SEND_CODE(curlen, zip_bl_tree); + count--; + } // Assert(count >= 3 && count <= 6, " 3_6?"); + + + zip_SEND_CODE(zip_REP_3_6, zip_bl_tree); + zip_send_bits(count - 3, 2); + } else if (count <= 10) { + zip_SEND_CODE(zip_REPZ_3_10, zip_bl_tree); + zip_send_bits(count - 3, 3); + } else { + zip_SEND_CODE(zip_REPZ_11_138, zip_bl_tree); + zip_send_bits(count - 11, 7); + } + + count = 0; + prevlen = curlen; + + if (nextlen == 0) { + max_count = 138; + min_count = 3; + } else if (curlen == nextlen) { + max_count = 6; + min_count = 3; + } else { + max_count = 7; + min_count = 4; + } + } + } + /* ========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ + + + function zip_build_bl_tree() { + var max_blindex; // index of last bit length code of non zero freq + // Determine the bit length frequencies for literal and distance trees + + zip_scan_tree(zip_dyn_ltree, zip_l_desc.max_code); + zip_scan_tree(zip_dyn_dtree, zip_d_desc.max_code); // Build the bit length tree: + + zip_build_tree(zip_bl_desc); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + + for (max_blindex = zip_BL_CODES - 1; max_blindex >= 3; max_blindex--) { + if (zip_bl_tree[zip_bl_order[max_blindex]].dl != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + + + zip_opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; // Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + // encoder->opt_len, encoder->static_len)); + + return max_blindex; + } + /* ========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ + + + function zip_send_all_trees(lcodes, dcodes, blcodes) { + // number of codes for each tree + var rank; // index in bl_order + // Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + // Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + // "too many codes"); + // Tracev((stderr, "\nbl counts: ")); + + zip_send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt + + zip_send_bits(dcodes - 1, 5); + zip_send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt + + for (rank = 0; rank < blcodes; rank++) { + // Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + zip_send_bits(zip_bl_tree[zip_bl_order[rank]].dl, 3); + } // send the literal tree + + + zip_send_tree(zip_dyn_ltree, lcodes - 1); // send the distance tree + + zip_send_tree(zip_dyn_dtree, dcodes - 1); + } + /* ========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ + + + function zip_flush_block(eof) { + // true if this is the last block for a file + var opt_lenb; + var static_lenb; // opt_len and static_len in bytes + + var max_blindex; // index of last bit length code of non zero freq + + var stored_len; // length of input block + + stored_len = zip_strstart - zip_block_start; + zip_flag_buf[zip_last_flags] = zip_flags; // Save the flags for the last 8 items + // Construct the literal and distance trees + + zip_build_tree(zip_l_desc); // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", + // encoder->opt_len, encoder->static_len)); + + zip_build_tree(zip_d_desc); // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", + // encoder->opt_len, encoder->static_len)); + + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + + max_blindex = zip_build_bl_tree(); // Determine the best encoding. Compute first the block length in bytes + + opt_lenb = zip_opt_len + 3 + 7 >> 3; + static_lenb = zip_static_len + 3 + 7 >> 3; // Trace((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ", + // opt_lenb, encoder->opt_len, + // static_lenb, encoder->static_len, stored_len, + // encoder->last_lit, encoder->last_dist)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + if (stored_len + 4 <= opt_lenb && // 4: two words for the lengths + zip_block_start >= 0) { + var i; + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + + zip_send_bits((zip_STORED_BLOCK << 1) + eof, 3); + /* send block type */ + + zip_bi_windup(); + /* align on byte boundary */ + + zip_put_short(stored_len); + zip_put_short(~stored_len); // copy block + + /* + p = &window[block_start]; + for(i = 0; i < stored_len; i++) + put_byte(p[i]); + */ + + for (i = 0; i < stored_len; i++) { + zip_put_byte(zip_window[zip_block_start + i]); + } + } else if (static_lenb == opt_lenb) { + zip_send_bits((zip_STATIC_TREES << 1) + eof, 3); + zip_compress_block(zip_static_ltree, zip_static_dtree); + } else { + zip_send_bits((zip_DYN_TREES << 1) + eof, 3); + zip_send_all_trees(zip_l_desc.max_code + 1, zip_d_desc.max_code + 1, max_blindex + 1); + zip_compress_block(zip_dyn_ltree, zip_dyn_dtree); + } + + zip_init_block(); + if (eof != 0) zip_bi_windup(); + } + /* ========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ + + + function zip_ct_tally(dist, // distance of matched string + lc) { + // match length-MIN_MATCH or unmatched char (if dist==0) + zip_l_buf[zip_last_lit++] = lc; + + if (dist == 0) { + // lc is the unmatched char + zip_dyn_ltree[lc].fc++; + } else { + // Here, lc is the match length - MIN_MATCH + dist--; // dist = match distance - 1 + // Assert((ush)dist < (ush)MAX_DIST && + // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + // (ush)D_CODE(dist) < (ush)D_CODES, "ct_tally: bad match"); + + zip_dyn_ltree[zip_length_code[lc] + zip_LITERALS + 1].fc++; + zip_dyn_dtree[zip_D_CODE(dist)].fc++; + zip_d_buf[zip_last_dist++] = dist; + zip_flags |= zip_flag_bit; + } + + zip_flag_bit <<= 1; // Output the flags if they fill a byte + + if ((zip_last_lit & 7) == 0) { + zip_flag_buf[zip_last_flags++] = zip_flags; + zip_flags = 0; + zip_flag_bit = 1; + } // Try to guess if it is profitable to stop the current block here + + + if (zip_compr_level > 2 && (zip_last_lit & 0xfff) == 0) { + // Compute an upper bound for the compressed length + var out_length = zip_last_lit * 8; + var in_length = zip_strstart - zip_block_start; + var dcode; + + for (dcode = 0; dcode < zip_D_CODES; dcode++) { + out_length += zip_dyn_dtree[dcode].fc * (5 + zip_extra_dbits[dcode]); + } + + out_length >>= 3; // Trace((stderr,"\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ", + // encoder->last_lit, encoder->last_dist, in_length, out_length, + // 100L - out_length*100L/in_length)); + + if (zip_last_dist < _parseInt$2(zip_last_lit / 2) && out_length < _parseInt$2(in_length / 2)) return true; + } + + return zip_last_lit == zip_LIT_BUFSIZE - 1 || zip_last_dist == zip_DIST_BUFSIZE; + /* We avoid equality with LIT_BUFSIZE because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ + } + /* ========================================================================== + * Send the block data compressed using the given Huffman trees + */ + + + function zip_compress_block(ltree, // literal tree + dtree) { + // distance tree + var dist; // distance of matched string + + var lc; // match length or unmatched char (if dist == 0) + + var lx = 0; // running index in l_buf + + var dx = 0; // running index in d_buf + + var fx = 0; // running index in flag_buf + + var flag = 0; // current flags + + var code; // the code to send + + var extra; // number of extra bits to send + + if (zip_last_lit != 0) do { + if ((lx & 7) == 0) flag = zip_flag_buf[fx++]; + lc = zip_l_buf[lx++] & 0xff; + + if ((flag & 1) == 0) { + zip_SEND_CODE(lc, ltree); + /* send a literal byte */ + // Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + // Here, lc is the match length - MIN_MATCH + code = zip_length_code[lc]; + zip_SEND_CODE(code + zip_LITERALS + 1, ltree); // send the length code + + extra = zip_extra_lbits[code]; + + if (extra != 0) { + lc -= zip_base_length[code]; + zip_send_bits(lc, extra); // send the extra length bits + } + + dist = zip_d_buf[dx++]; // Here, dist is the match distance - 1 + + code = zip_D_CODE(dist); // Assert (code < D_CODES, "bad d_code"); + + zip_SEND_CODE(code, dtree); // send the distance code + + extra = zip_extra_dbits[code]; + + if (extra != 0) { + dist -= zip_base_dist[code]; + zip_send_bits(dist, extra); // send the extra distance bits + } + } // literal or match pair ? + + + flag >>= 1; + } while (lx < zip_last_lit); + zip_SEND_CODE(zip_END_BLOCK, ltree); + } + /* ========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ + + + var zip_Buf_size = 16; // bit size of bi_buf + + function zip_send_bits(value, // value to send + length) { + // number of bits + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (zip_bi_valid > zip_Buf_size - length) { + zip_bi_buf |= value << zip_bi_valid; + zip_put_short(zip_bi_buf); + zip_bi_buf = value >> zip_Buf_size - zip_bi_valid; + zip_bi_valid += length - zip_Buf_size; + } else { + zip_bi_buf |= value << zip_bi_valid; + zip_bi_valid += length; + } + } + /* ========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ + + + function zip_bi_reverse(code, // the value to invert + len) { + // its bit length + var res = 0; + + do { + res |= code & 1; + code >>= 1; + res <<= 1; + } while (--len > 0); + + return res >> 1; + } + /* ========================================================================== + * Write out any remaining bits in an incomplete byte. + */ + + + function zip_bi_windup() { + if (zip_bi_valid > 8) { + zip_put_short(zip_bi_buf); + } else if (zip_bi_valid > 0) { + zip_put_byte(zip_bi_buf); + } + + zip_bi_buf = 0; + zip_bi_valid = 0; + } + + function zip_qoutbuf() { + if (zip_outcnt != 0) { + var q; + var i; + q = zip_new_queue(); + if (zip_qhead == null) zip_qhead = zip_qtail = q;else zip_qtail = zip_qtail.next = q; + q.len = zip_outcnt - zip_outoff; // System.arraycopy(zip_outbuf, zip_outoff, q.ptr, 0, q.len); + + for (i = 0; i < q.len; i++) { + q.ptr[i] = zip_outbuf[zip_outoff + i]; + } + + zip_outcnt = zip_outoff = 0; + } + } + + return function deflate(str, level) { + var i; + var j; + zip_deflate_data = str; + zip_deflate_pos = 0; + if (typeof level === 'undefined') level = zip_DEFAULT_LEVEL; + zip_deflate_start(level); + var buff = new Array(1024); + var aout = []; + + while ((i = zip_deflate_internal(buff, 0, buff.length)) > 0) { + var cbuf = new Array(i); + + for (j = 0; j < i; j++) { + cbuf[j] = String.fromCharCode(buff[j]); + } + + aout[aout.length] = cbuf.join(''); + } + + zip_deflate_data = null; // G.C. + + return aout.join(''); + }; + }(); + + function ownKeys$b(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); enumerableOnly && (symbols = filter$3(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } + + function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? forEach$3(_context4 = ownKeys$b(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : getOwnPropertyDescriptors$2 ? defineProperties$2(target, getOwnPropertyDescriptors$2(source)) : forEach$3(_context5 = ownKeys$b(Object(source))).call(_context5, function (key) { defineProperty$5(target, key, getOwnPropertyDescriptor$3(source, key)); }); } return target; } + + function encode64(data) { + var r = ''; + + for (var i = 0; i < data.length; i += 3) { + if (i + 2 === data.length) { + r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0); + } else if (i + 1 === data.length) { + r += append3bytes(data.charCodeAt(i), 0, 0); + } else { + r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), data.charCodeAt(i + 2)); + } + } + + return r; + } + + function append3bytes(b1, b2, b3) { + var c1 = b1 >> 2; + var c2 = (b1 & 0x3) << 4 | b2 >> 4; + var c3 = (b2 & 0xf) << 2 | b3 >> 6; + var c4 = b3 & 0x3f; + var r = ''; + r += encode6bit(c1 & 0x3f); + r += encode6bit(c2 & 0x3f); + r += encode6bit(c3 & 0x3f); + r += encode6bit(c4 & 0x3f); + return r; + } + + function encode6bit(b1) { + var b = b1; + + if (b < 10) { + return String.fromCharCode(48 + b); + } + + b -= 10; + + if (b < 26) { + return String.fromCharCode(65 + b); + } + + b -= 26; + + if (b < 26) { + return String.fromCharCode(97 + b); + } + + b -= 26; + + if (b === 0) { + return '-'; + } + + if (b === 1) { + return '_'; + } + + return '?'; + } + + function compress(s1, url) { + var _context; + + var s = unescape(encodeURIComponent(s1)); + return concat$5(_context = "".concat(url, "/svg/")).call(_context, encode64(deflate(s, 9))); + } + + var PlantUMLCodeEngine = /*#__PURE__*/function () { + function PlantUMLCodeEngine() { + var _plantUMLOptions$base; + + var plantUMLOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _classCallCheck(this, PlantUMLCodeEngine); + + var defaultUrl = 'http://www.plantuml.com/plantuml'; + this.baseUrl = (_plantUMLOptions$base = plantUMLOptions.baseUrl) !== null && _plantUMLOptions$base !== void 0 ? _plantUMLOptions$base : defaultUrl; + } + + _createClass(PlantUMLCodeEngine, [{ + key: "render", + value: function render(src, sign) { + var _context2, _context3; + + var $sign = sign; + + if (!$sign) { + $sign = Math.round(Math.random() * 100000000); + } + + var graphId = concat$5(_context2 = "plantuml-".concat($sign, "-")).call(_context2, new Date().getTime()); + + return concat$5(_context3 = ""); + } + }], [{ + key: "install", + value: function install(cherryOptions, args) { + var _cherryOptions$engine; + + mergeWith_1(cherryOptions, { + engine: { + syntax: { + codeBlock: { + customRenderer: { + plantuml: new PlantUMLCodeEngine(_objectSpread$a(_objectSpread$a({}, args), (_cherryOptions$engine = cherryOptions.engine.syntax.plantuml) !== null && _cherryOptions$engine !== void 0 ? _cherryOptions$engine : {})) + } + } + } + } + }); + } + }]); + + return PlantUMLCodeEngine; + }(); + + /*! For license information please see mermaid.esm.min.mjs.LICENSE.txt */ + var t={2536:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,6],n=[1,7],r=[1,8],i=[1,9],a=[1,16],o=[1,11],s=[1,12],l=[1,13],u=[1,14],h=[1,15],f=[1,27],d=[1,33],p=[1,34],g=[1,35],y=[1,36],m=[1,37],b=[1,72],v=[1,73],_=[1,74],x=[1,75],k=[1,76],w=[1,77],T=[1,78],E=[1,38],C=[1,39],S=[1,40],A=[1,41],M=[1,42],N=[1,43],O=[1,44],D=[1,45],B=[1,46],L=[1,47],I=[1,48],F=[1,49],R=[1,50],P=[1,51],j=[1,52],z=[1,53],Y=[1,54],U=[1,55],$=[1,56],W=[1,57],q=[1,59],H=[1,60],V=[1,61],G=[1,62],X=[1,63],Z=[1,64],Q=[1,65],K=[1,66],J=[1,67],tt=[1,68],et=[1,69],nt=[24,52],rt=[24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],it=[15,24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],at=[1,94],ot=[1,95],st=[1,96],ct=[1,97],lt=[15,24,52],ut=[7,8,9,10,18,22,25,26,27,28],ht=[15,24,43,52],ft=[15,24,43,52,86,87,89,90],dt=[15,43],pt=[44,46,47,48,49,50,51,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],gt={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,directive:6,direction_tb:7,direction_bt:8,direction_rl:9,direction_lr:10,graphConfig:11,openDirective:12,typeDirective:13,closeDirective:14,NEWLINE:15,":":16,argDirective:17,open_directive:18,type_directive:19,arg_directive:20,close_directive:21,C4_CONTEXT:22,statements:23,EOF:24,C4_CONTAINER:25,C4_COMPONENT:26,C4_DYNAMIC:27,C4_DEPLOYMENT:28,otherStatements:29,diagramStatements:30,otherStatement:31,title:32,accDescription:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,boundaryStatement:39,boundaryStartStatement:40,boundaryStopStatement:41,boundaryStart:42,LBRACE:43,ENTERPRISE_BOUNDARY:44,attributes:45,SYSTEM_BOUNDARY:46,BOUNDARY:47,CONTAINER_BOUNDARY:48,NODE:49,NODE_L:50,NODE_R:51,RBRACE:52,diagramStatement:53,PERSON:54,PERSON_EXT:55,SYSTEM:56,SYSTEM_DB:57,SYSTEM_QUEUE:58,SYSTEM_EXT:59,SYSTEM_EXT_DB:60,SYSTEM_EXT_QUEUE:61,CONTAINER:62,CONTAINER_DB:63,CONTAINER_QUEUE:64,CONTAINER_EXT:65,CONTAINER_EXT_DB:66,CONTAINER_EXT_QUEUE:67,COMPONENT:68,COMPONENT_DB:69,COMPONENT_QUEUE:70,COMPONENT_EXT:71,COMPONENT_EXT_DB:72,COMPONENT_EXT_QUEUE:73,REL:74,BIREL:75,REL_U:76,REL_D:77,REL_L:78,REL_R:79,REL_B:80,REL_INDEX:81,UPDATE_EL_STYLE:82,UPDATE_REL_STYLE:83,UPDATE_LAYOUT_CONFIG:84,attribute:85,STR:86,STR_KEY:87,STR_VALUE:88,ATTRIBUTE:89,ATTRIBUTE_EMPTY:90,$accept:0,$end:1},terminals_:{2:"error",7:"direction_tb",8:"direction_bt",9:"direction_rl",10:"direction_lr",15:"NEWLINE",16:":",18:"open_directive",19:"type_directive",20:"arg_directive",21:"close_directive",22:"C4_CONTEXT",24:"EOF",25:"C4_CONTAINER",26:"C4_COMPONENT",27:"C4_DYNAMIC",28:"C4_DEPLOYMENT",32:"title",33:"accDescription",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",43:"LBRACE",44:"ENTERPRISE_BOUNDARY",46:"SYSTEM_BOUNDARY",47:"BOUNDARY",48:"CONTAINER_BOUNDARY",49:"NODE",50:"NODE_L",51:"NODE_R",52:"RBRACE",54:"PERSON",55:"PERSON_EXT",56:"SYSTEM",57:"SYSTEM_DB",58:"SYSTEM_QUEUE",59:"SYSTEM_EXT",60:"SYSTEM_EXT_DB",61:"SYSTEM_EXT_QUEUE",62:"CONTAINER",63:"CONTAINER_DB",64:"CONTAINER_QUEUE",65:"CONTAINER_EXT",66:"CONTAINER_EXT_DB",67:"CONTAINER_EXT_QUEUE",68:"COMPONENT",69:"COMPONENT_DB",70:"COMPONENT_QUEUE",71:"COMPONENT_EXT",72:"COMPONENT_EXT_DB",73:"COMPONENT_EXT_QUEUE",74:"REL",75:"BIREL",76:"REL_U",77:"REL_D",78:"REL_L",79:"REL_R",80:"REL_B",81:"REL_INDEX",82:"UPDATE_EL_STYLE",83:"UPDATE_REL_STYLE",84:"UPDATE_LAYOUT_CONFIG",86:"STR",87:"STR_KEY",88:"STR_VALUE",89:"ATTRIBUTE",90:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[11,4],[11,4],[11,4],[11,4],[23,1],[23,1],[23,2],[29,1],[29,2],[29,3],[31,1],[31,1],[31,2],[31,2],[31,1],[39,3],[40,3],[40,3],[40,4],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[41,1],[30,1],[30,2],[30,3],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,1],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[45,1],[45,2],[85,1],[85,2],[85,1],[85,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:r.setDirection("TB");break;case 5:r.setDirection("BT");break;case 6:r.setDirection("RL");break;case 7:r.setDirection("LR");break;case 11:console.log("open_directive: ",a[s]),r.parseDirective("%%{","open_directive");break;case 12:break;case 13:a[s]=a[s].trim().replace(/'/g,'"'),console.log("arg_directive: ",a[s]),r.parseDirective(a[s],"arg_directive");break;case 14:console.log("close_directive: ",a[s]),r.parseDirective("}%%","close_directive","c4Context");break;case 15:case 16:case 17:case 18:case 19:r.setC4Type(a[s-3]);break;case 26:r.setTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 27:r.setAccDescription(a[s].substring(15)),this.$=a[s].substring(15);break;case 28:this.$=a[s].trim(),r.setTitle(this.$);break;case 29:case 30:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:case 36:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(2,0,"ENTERPRISE"),r.addPersonOrSystemBoundary(...a[s]),this.$=a[s];break;case 37:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystemBoundary(...a[s]),this.$=a[s];break;case 38:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(2,0,"CONTAINER"),r.addContainerBoundary(...a[s]),this.$=a[s];break;case 39:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode("node",...a[s]),this.$=a[s];break;case 40:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode("nodeL",...a[s]),this.$=a[s];break;case 41:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode("nodeR",...a[s]),this.$=a[s];break;case 42:r.popBoundaryParseStack();break;case 46:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem("person",...a[s]),this.$=a[s];break;case 47:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem("external_person",...a[s]),this.$=a[s];break;case 48:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem("system",...a[s]),this.$=a[s];break;case 49:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem("system_db",...a[s]),this.$=a[s];break;case 50:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem("system_queue",...a[s]),this.$=a[s];break;case 51:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem("external_system",...a[s]),this.$=a[s];break;case 52:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem("external_system_db",...a[s]),this.$=a[s];break;case 53:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem("external_system_queue",...a[s]),this.$=a[s];break;case 54:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer("container",...a[s]),this.$=a[s];break;case 55:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer("container_db",...a[s]),this.$=a[s];break;case 56:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer("container_queue",...a[s]),this.$=a[s];break;case 57:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer("external_container",...a[s]),this.$=a[s];break;case 58:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer("external_container_db",...a[s]),this.$=a[s];break;case 59:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer("external_container_queue",...a[s]),this.$=a[s];break;case 60:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent("component",...a[s]),this.$=a[s];break;case 61:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent("component_db",...a[s]),this.$=a[s];break;case 62:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent("component_queue",...a[s]),this.$=a[s];break;case 63:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent("external_component",...a[s]),this.$=a[s];break;case 64:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent("external_component_db",...a[s]),this.$=a[s];break;case 65:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent("external_component_queue",...a[s]),this.$=a[s];break;case 67:console.log(a[s-1],JSON.stringify(a[s])),r.addRel("rel",...a[s]),this.$=a[s];break;case 68:console.log(a[s-1],JSON.stringify(a[s])),r.addRel("birel",...a[s]),this.$=a[s];break;case 69:console.log(a[s-1],JSON.stringify(a[s])),r.addRel("rel_u",...a[s]),this.$=a[s];break;case 70:console.log(a[s-1],JSON.stringify(a[s])),r.addRel("rel_d",...a[s]),this.$=a[s];break;case 71:console.log(a[s-1],JSON.stringify(a[s])),r.addRel("rel_l",...a[s]),this.$=a[s];break;case 72:console.log(a[s-1],JSON.stringify(a[s])),r.addRel("rel_r",...a[s]),this.$=a[s];break;case 73:console.log(a[s-1],JSON.stringify(a[s])),r.addRel("rel_b",...a[s]),this.$=a[s];break;case 74:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(0,1),r.addRel("rel",...a[s]),this.$=a[s];break;case 75:console.log(a[s-1],JSON.stringify(a[s])),r.updateElStyle("update_el_style",...a[s]),this.$=a[s];break;case 76:console.log(a[s-1],JSON.stringify(a[s])),r.updateRelStyle("update_rel_style",...a[s]),this.$=a[s];break;case 77:console.log(a[s-1],JSON.stringify(a[s])),r.updateLayoutConfig("update_layout_config",...a[s]),this.$=a[s];break;case 78:console.log("PUSH ATTRIBUTE: ",a[s]),this.$=[a[s]];break;case 79:console.log("PUSH ATTRIBUTE: ",a[s-1]),a[s].unshift(a[s-1]),this.$=a[s];break;case 80:case 82:this.$=a[s].trim();break;case 81:console.log("kv: ",a[s-1],a[s]);let t={};t[a[s-1].trim()]=a[s].trim(),this.$=t;break;case 83:this.$="";}},table:[{3:1,4:2,5:3,6:4,7:e,8:n,9:r,10:i,11:5,12:10,18:a,22:o,25:s,26:l,27:u,28:h},{1:[3]},{1:[2,1]},{1:[2,2]},{3:17,4:2,5:3,6:4,7:e,8:n,9:r,10:i,11:5,12:10,18:a,22:o,25:s,26:l,27:u,28:h},{1:[2,8]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{1:[2,7]},{13:18,19:[1,19]},{15:[1,20]},{15:[1,21]},{15:[1,22]},{15:[1,23]},{15:[1,24]},{19:[2,11]},{1:[2,3]},{14:25,16:[1,26],21:f},t([16,21],[2,12]),{23:28,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:79,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:80,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:81,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:82,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{15:[1,83]},{17:84,20:[1,85]},{15:[2,14]},{24:[1,86]},t(nt,[2,20],{53:32,39:58,40:70,42:71,30:87,44:b,46:v,47:_,48:x,49:k,50:w,51:T,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et}),t(nt,[2,21]),t(rt,[2,23],{15:[1,88]}),t(nt,[2,43],{15:[1,89]}),t(it,[2,26]),t(it,[2,27]),{35:[1,90]},{37:[1,91]},t(it,[2,30]),{45:92,85:93,86:at,87:ot,89:st,90:ct},{45:98,85:93,86:at,87:ot,89:st,90:ct},{45:99,85:93,86:at,87:ot,89:st,90:ct},{45:100,85:93,86:at,87:ot,89:st,90:ct},{45:101,85:93,86:at,87:ot,89:st,90:ct},{45:102,85:93,86:at,87:ot,89:st,90:ct},{45:103,85:93,86:at,87:ot,89:st,90:ct},{45:104,85:93,86:at,87:ot,89:st,90:ct},{45:105,85:93,86:at,87:ot,89:st,90:ct},{45:106,85:93,86:at,87:ot,89:st,90:ct},{45:107,85:93,86:at,87:ot,89:st,90:ct},{45:108,85:93,86:at,87:ot,89:st,90:ct},{45:109,85:93,86:at,87:ot,89:st,90:ct},{45:110,85:93,86:at,87:ot,89:st,90:ct},{45:111,85:93,86:at,87:ot,89:st,90:ct},{45:112,85:93,86:at,87:ot,89:st,90:ct},{45:113,85:93,86:at,87:ot,89:st,90:ct},{45:114,85:93,86:at,87:ot,89:st,90:ct},{45:115,85:93,86:at,87:ot,89:st,90:ct},{45:116,85:93,86:at,87:ot,89:st,90:ct},t(lt,[2,66]),{45:117,85:93,86:at,87:ot,89:st,90:ct},{45:118,85:93,86:at,87:ot,89:st,90:ct},{45:119,85:93,86:at,87:ot,89:st,90:ct},{45:120,85:93,86:at,87:ot,89:st,90:ct},{45:121,85:93,86:at,87:ot,89:st,90:ct},{45:122,85:93,86:at,87:ot,89:st,90:ct},{45:123,85:93,86:at,87:ot,89:st,90:ct},{45:124,85:93,86:at,87:ot,89:st,90:ct},{45:125,85:93,86:at,87:ot,89:st,90:ct},{45:126,85:93,86:at,87:ot,89:st,90:ct},{45:127,85:93,86:at,87:ot,89:st,90:ct},{30:128,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{15:[1,130],43:[1,129]},{45:131,85:93,86:at,87:ot,89:st,90:ct},{45:132,85:93,86:at,87:ot,89:st,90:ct},{45:133,85:93,86:at,87:ot,89:st,90:ct},{45:134,85:93,86:at,87:ot,89:st,90:ct},{45:135,85:93,86:at,87:ot,89:st,90:ct},{45:136,85:93,86:at,87:ot,89:st,90:ct},{45:137,85:93,86:at,87:ot,89:st,90:ct},{24:[1,138]},{24:[1,139]},{24:[1,140]},{24:[1,141]},t(ut,[2,9]),{14:142,21:f},{21:[2,13]},{1:[2,15]},t(nt,[2,22]),t(rt,[2,24],{31:31,29:143,32:d,33:p,34:g,36:y,38:m}),t(nt,[2,44],{29:29,30:30,31:31,53:32,39:58,40:70,42:71,23:144,32:d,33:p,34:g,36:y,38:m,44:b,46:v,47:_,48:x,49:k,50:w,51:T,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et}),t(it,[2,28]),t(it,[2,29]),t(lt,[2,46]),t(ht,[2,78],{85:93,45:145,86:at,87:ot,89:st,90:ct}),t(ft,[2,80]),{88:[1,146]},t(ft,[2,82]),t(ft,[2,83]),t(lt,[2,47]),t(lt,[2,48]),t(lt,[2,49]),t(lt,[2,50]),t(lt,[2,51]),t(lt,[2,52]),t(lt,[2,53]),t(lt,[2,54]),t(lt,[2,55]),t(lt,[2,56]),t(lt,[2,57]),t(lt,[2,58]),t(lt,[2,59]),t(lt,[2,60]),t(lt,[2,61]),t(lt,[2,62]),t(lt,[2,63]),t(lt,[2,64]),t(lt,[2,65]),t(lt,[2,67]),t(lt,[2,68]),t(lt,[2,69]),t(lt,[2,70]),t(lt,[2,71]),t(lt,[2,72]),t(lt,[2,73]),t(lt,[2,74]),t(lt,[2,75]),t(lt,[2,76]),t(lt,[2,77]),{41:147,52:[1,148]},{15:[1,149]},{43:[1,150]},t(dt,[2,35]),t(dt,[2,36]),t(dt,[2,37]),t(dt,[2,38]),t(dt,[2,39]),t(dt,[2,40]),t(dt,[2,41]),{1:[2,16]},{1:[2,17]},{1:[2,18]},{1:[2,19]},{15:[1,151]},t(rt,[2,25]),t(nt,[2,45]),t(ht,[2,79]),t(ft,[2,81]),t(lt,[2,31]),t(lt,[2,42]),t(pt,[2,32]),t(pt,[2,33],{15:[1,152]}),t(ut,[2,10]),t(pt,[2,34])],defaultActions:{2:[2,1],3:[2,2],5:[2,8],6:[2,4],7:[2,5],8:[2,6],9:[2,7],16:[2,11],17:[2,3],27:[2,14],85:[2,13],86:[2,15],138:[2,16],139:[2,17],140:[2,18],141:[2,19]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},yt={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),18;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 10;case 5:return this.begin("type_directive"),19;case 6:return this.popState(),this.begin("arg_directive"),16;case 7:return this.popState(),this.popState(),21;case 8:return 20;case 9:return 32;case 10:return 33;case 11:return this.begin("acc_title"),34;case 12:return this.popState(),"acc_title_value";case 13:return this.begin("acc_descr"),36;case 14:return this.popState(),"acc_descr_value";case 15:this.begin("acc_descr_multiline");break;case 16:this.popState();break;case 17:return "acc_descr_multiline_value";case 18:case 21:break;case 19:c;break;case 20:return 15;case 22:return 22;case 23:return 25;case 24:return 26;case 25:return 27;case 26:return 28;case 27:return this.begin("person_ext"),console.log("begin person_ext"),55;case 28:return this.begin("person"),console.log("begin person"),54;case 29:return this.begin("system_ext_queue"),console.log("begin system_ext_queue"),61;case 30:return this.begin("system_ext_db"),console.log("begin system_ext_db"),60;case 31:return this.begin("system_ext"),console.log("begin system_ext"),59;case 32:return this.begin("system_queue"),console.log("begin system_queue"),58;case 33:return this.begin("system_db"),console.log("begin system_db"),57;case 34:return this.begin("system"),console.log("begin system"),56;case 35:return this.begin("boundary"),console.log("begin boundary"),47;case 36:return this.begin("enterprise_boundary"),console.log("begin enterprise_boundary"),44;case 37:return this.begin("system_boundary"),console.log("begin system_boundary"),46;case 38:return this.begin("container_ext_queue"),console.log("begin container_ext_queue"),67;case 39:return this.begin("container_ext_db"),console.log("begin container_ext_db"),66;case 40:return this.begin("container_ext"),console.log("begin container_ext"),65;case 41:return this.begin("container_queue"),console.log("begin container_queue"),64;case 42:return this.begin("container_db"),console.log("begin container_db"),63;case 43:return this.begin("container"),console.log("begin container"),62;case 44:return this.begin("container_boundary"),console.log("begin container_boundary"),48;case 45:return this.begin("component_ext_queue"),console.log("begin component_ext_queue"),73;case 46:return this.begin("component_ext_db"),console.log("begin component_ext_db"),72;case 47:return this.begin("component_ext"),console.log("begin component_ext"),71;case 48:return this.begin("component_queue"),console.log("begin component_queue"),70;case 49:return this.begin("component_db"),console.log("begin component_db"),69;case 50:return this.begin("component"),console.log("begin component"),68;case 51:case 52:return this.begin("node"),console.log("begin node"),49;case 53:return this.begin("node_l"),console.log("begin node_l"),50;case 54:return this.begin("node_r"),console.log("begin node_r"),51;case 55:return this.begin("rel"),console.log("begin rel"),74;case 56:return this.begin("birel"),console.log("begin birel"),75;case 57:case 58:return this.begin("rel_u"),console.log("begin rel_u"),76;case 59:case 60:return this.begin("rel_d"),console.log("begin rel_d"),77;case 61:case 62:return this.begin("rel_l"),console.log("begin rel_l"),78;case 63:case 64:return this.begin("rel_r"),console.log("begin rel_r"),79;case 65:return this.begin("rel_b"),console.log("begin rel_b"),80;case 66:return this.begin("rel_index"),console.log("begin rel_index"),81;case 67:return this.begin("update_el_style"),console.log("begin update_el_style"),82;case 68:return this.begin("update_rel_style"),console.log("begin update_rel_style"),83;case 69:return this.begin("update_layout_config"),console.log("begin update_layout_config"),84;case 70:return "EOF_IN_STRUCT";case 71:return console.log("begin attribute with ATTRIBUTE_EMPTY"),this.begin("attribute"),"ATTRIBUTE_EMPTY";case 72:console.log("begin attribute"),this.begin("attribute");break;case 73:console.log("STOP attribute"),this.popState(),console.log("STOP diagram"),this.popState();break;case 74:return console.log(",,"),90;case 75:console.log(",");break;case 76:return console.log("ATTRIBUTE_EMPTY"),90;case 77:console.log("begin string"),this.begin("string");break;case 78:console.log("STOP string"),this.popState();break;case 79:return console.log("STR"),"STR";case 80:console.log("begin string_kv"),this.begin("string_kv");break;case 81:return console.log("STR_KEY"),this.begin("string_kv_key"),"STR_KEY";case 82:console.log("begin string_kv_value"),this.popState(),this.begin("string_kv_value");break;case 83:return console.log("STR_VALUE"),"STR_VALUE";case 84:console.log("STOP string_kv_value"),this.popState(),this.popState();break;case 85:return console.log("not STR"),"STR";case 86:return console.log("begin boundary block"),"LBRACE";case 87:return console.log("STOP boundary block"),"RBRACE";case 88:return "SPACE";case 89:return "EOL";case 90:return 24}},rules:[/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},string_kv_value:{rules:[83,84],inclusive:!1},string_kv_key:{rules:[82],inclusive:!1},string_kv:{rules:[81],inclusive:!1},string:{rules:[78,79],inclusive:!1},attribute:{rules:[73,74,75,76,77,80,85],inclusive:!1},update_layout_config:{rules:[70,71,72,73],inclusive:!1},update_rel_style:{rules:[70,71,72,73],inclusive:!1},update_el_style:{rules:[70,71,72,73],inclusive:!1},rel_b:{rules:[70,71,72,73],inclusive:!1},rel_r:{rules:[70,71,72,73],inclusive:!1},rel_l:{rules:[70,71,72,73],inclusive:!1},rel_d:{rules:[70,71,72,73],inclusive:!1},rel_u:{rules:[70,71,72,73],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[70,71,72,73],inclusive:!1},node_r:{rules:[70,71,72,73],inclusive:!1},node_l:{rules:[70,71,72,73],inclusive:!1},node:{rules:[70,71,72,73],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[70,71,72,73],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[70,71,72,73],inclusive:!1},component_ext:{rules:[70,71,72,73],inclusive:!1},component_queue:{rules:[70,71,72,73],inclusive:!1},component_db:{rules:[70,71,72,73],inclusive:!1},component:{rules:[70,71,72,73],inclusive:!1},container_boundary:{rules:[70,71,72,73],inclusive:!1},container_ext_queue:{rules:[],inclusive:!1},container_ext_db:{rules:[70,71,72,73],inclusive:!1},container_ext:{rules:[70,71,72,73],inclusive:!1},container_queue:{rules:[70,71,72,73],inclusive:!1},container_db:{rules:[70,71,72,73],inclusive:!1},container:{rules:[70,71,72,73],inclusive:!1},birel:{rules:[70,71,72,73],inclusive:!1},system_boundary:{rules:[70,71,72,73],inclusive:!1},enterprise_boundary:{rules:[70,71,72,73],inclusive:!1},boundary:{rules:[70,71,72,73],inclusive:!1},system_ext_queue:{rules:[70,71,72,73],inclusive:!1},system_ext_db:{rules:[70,71,72,73],inclusive:!1},system_ext:{rules:[70,71,72,73],inclusive:!1},system_queue:{rules:[70,71,72,73],inclusive:!1},system_db:{rules:[70,71,72,73],inclusive:!1},system:{rules:[70,71,72,73],inclusive:!1},person_ext:{rules:[70,71,72,73],inclusive:!1},person:{rules:[70,71,72,73],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,86,87,88,89,90],inclusive:!0}}};function mt(){this.yy={};}return gt.lexer=yt,mt.prototype=gt,gt.Parser=mt,new mt}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(555).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},1362:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,7],r=[1,8],i=[1,9],a=[1,10],o=[1,13],s=[1,12],c=[1,16,25],l=[1,20],u=[1,31],h=[1,32],f=[1,33],d=[1,35],p=[1,38],g=[1,36],y=[1,37],m=[1,39],b=[1,40],v=[1,41],_=[1,42],x=[1,45],k=[1,46],w=[1,47],T=[1,48],E=[16,25],C=[1,62],S=[1,63],A=[1,64],M=[1,65],N=[1,66],O=[1,67],D=[1,68],B=[16,25,32,44,45,53,56,57,58,59,60,61,62,67,69],L=[16,25,30,32,44,45,49,53,56,57,58,59,60,61,62,67,69,84,85,86,87],I=[5,8,9,10,11,16,19,23,25],F=[53,84,85,86,87],R=[53,61,62,84,85,86,87],P=[53,56,57,58,59,60,84,85,86,87],j=[16,25,32],z=[1,100],Y={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statments:5,direction:6,directive:7,direction_tb:8,direction_bt:9,direction_rl:10,direction_lr:11,graphConfig:12,openDirective:13,typeDirective:14,closeDirective:15,NEWLINE:16,":":17,argDirective:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,CLASS_DIAGRAM:23,statements:24,EOF:25,statement:26,className:27,alphaNumToken:28,classLiteralName:29,GENERICTYPE:30,relationStatement:31,LABEL:32,classStatement:33,methodStatement:34,annotationStatement:35,clickStatement:36,cssClassStatement:37,acc_title:38,acc_title_value:39,acc_descr:40,acc_descr_value:41,acc_descr_multiline_value:42,CLASS:43,STYLE_SEPARATOR:44,STRUCT_START:45,members:46,STRUCT_STOP:47,ANNOTATION_START:48,ANNOTATION_END:49,MEMBER:50,SEPARATOR:51,relation:52,STR:53,relationType:54,lineType:55,AGGREGATION:56,EXTENSION:57,COMPOSITION:58,DEPENDENCY:59,LOLLIPOP:60,LINE:61,DOTTED_LINE:62,CALLBACK:63,LINK:64,LINK_TARGET:65,CLICK:66,CALLBACK_NAME:67,CALLBACK_ARGS:68,HREF:69,CSSCLASS:70,commentToken:71,textToken:72,graphCodeTokens:73,textNoTagsToken:74,TAGSTART:75,TAGEND:76,"==":77,"--":78,PCT:79,DEFAULT:80,SPACE:81,MINUS:82,keywords:83,UNICODE_TEXT:84,NUM:85,ALPHA:86,BQUOTE_STR:87,$accept:0,$end:1},terminals_:{2:"error",5:"statments",8:"direction_tb",9:"direction_bt",10:"direction_rl",11:"direction_lr",16:"NEWLINE",17:":",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",23:"CLASS_DIAGRAM",25:"EOF",30:"GENERICTYPE",32:"LABEL",38:"acc_title",39:"acc_title_value",40:"acc_descr",41:"acc_descr_value",42:"acc_descr_multiline_value",43:"CLASS",44:"STYLE_SEPARATOR",45:"STRUCT_START",47:"STRUCT_STOP",48:"ANNOTATION_START",49:"ANNOTATION_END",50:"MEMBER",51:"SEPARATOR",53:"STR",56:"AGGREGATION",57:"EXTENSION",58:"COMPOSITION",59:"DEPENDENCY",60:"LOLLIPOP",61:"LINE",62:"DOTTED_LINE",63:"CALLBACK",64:"LINK",65:"LINK_TARGET",66:"CLICK",67:"CALLBACK_NAME",68:"CALLBACK_ARGS",69:"HREF",70:"CSSCLASS",73:"graphCodeTokens",75:"TAGSTART",76:"TAGEND",77:"==",78:"--",79:"PCT",80:"DEFAULT",81:"SPACE",82:"MINUS",83:"keywords",84:"UNICODE_TEXT",85:"NUM",86:"ALPHA",87:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[3,1],[3,2],[6,1],[6,1],[6,1],[6,1],[4,1],[7,4],[7,6],[13,1],[14,1],[18,1],[15,1],[12,4],[24,1],[24,2],[24,3],[27,1],[27,1],[27,2],[27,2],[27,2],[26,1],[26,2],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,2],[26,2],[26,1],[33,2],[33,4],[33,5],[33,7],[35,4],[46,1],[46,2],[34,1],[34,2],[34,1],[34,1],[31,3],[31,4],[31,4],[31,5],[52,3],[52,2],[52,2],[52,1],[54,1],[54,1],[54,1],[54,1],[54,1],[55,1],[55,1],[36,3],[36,4],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[37,3],[71,1],[71,1],[72,1],[72,1],[72,1],[72,1],[72,1],[72,1],[72,1],[74,1],[74,1],[74,1],[74,1],[28,1],[28,1],[28,1],[29,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setDirection("TB");break;case 6:r.setDirection("BT");break;case 7:r.setDirection("RL");break;case 8:r.setDirection("LR");break;case 12:r.parseDirective("%%{","open_directive");break;case 13:r.parseDirective(a[s],"type_directive");break;case 14:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 15:r.parseDirective("}%%","close_directive","class");break;case 20:case 21:this.$=a[s];break;case 22:this.$=a[s-1]+a[s];break;case 23:case 24:this.$=a[s-1]+"~"+a[s];break;case 25:r.addRelation(a[s]);break;case 26:a[s-1].title=r.cleanupLabel(a[s]),r.addRelation(a[s-1]);break;case 34:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 35:case 36:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 37:r.addClass(a[s]);break;case 38:r.addClass(a[s-2]),r.setCssClass(a[s-2],a[s]);break;case 39:r.addClass(a[s-3]),r.addMembers(a[s-3],a[s-1]);break;case 40:r.addClass(a[s-5]),r.setCssClass(a[s-5],a[s-3]),r.addMembers(a[s-5],a[s-1]);break;case 41:r.addAnnotation(a[s],a[s-2]);break;case 42:this.$=[a[s]];break;case 43:a[s].push(a[s-1]),this.$=a[s];break;case 44:case 46:case 47:break;case 45:r.addMember(a[s-1],r.cleanupLabel(a[s]));break;case 48:this.$={id1:a[s-2],id2:a[s],relation:a[s-1],relationTitle1:"none",relationTitle2:"none"};break;case 49:this.$={id1:a[s-3],id2:a[s],relation:a[s-1],relationTitle1:a[s-2],relationTitle2:"none"};break;case 50:this.$={id1:a[s-3],id2:a[s],relation:a[s-2],relationTitle1:"none",relationTitle2:a[s-1]};break;case 51:this.$={id1:a[s-4],id2:a[s],relation:a[s-2],relationTitle1:a[s-3],relationTitle2:a[s-1]};break;case 52:this.$={type1:a[s-2],type2:a[s],lineType:a[s-1]};break;case 53:this.$={type1:"none",type2:a[s],lineType:a[s-1]};break;case 54:this.$={type1:a[s-1],type2:"none",lineType:a[s]};break;case 55:this.$={type1:"none",type2:"none",lineType:a[s]};break;case 56:this.$=r.relationType.AGGREGATION;break;case 57:this.$=r.relationType.EXTENSION;break;case 58:this.$=r.relationType.COMPOSITION;break;case 59:this.$=r.relationType.DEPENDENCY;break;case 60:this.$=r.relationType.LOLLIPOP;break;case 61:this.$=r.lineType.LINE;break;case 62:this.$=r.lineType.DOTTED_LINE;break;case 63:case 69:this.$=a[s-2],r.setClickEvent(a[s-1],a[s]);break;case 64:case 70:this.$=a[s-3],r.setClickEvent(a[s-2],a[s-1]),r.setTooltip(a[s-2],a[s]);break;case 65:case 73:this.$=a[s-2],r.setLink(a[s-1],a[s]);break;case 66:case 74:this.$=a[s-3],r.setLink(a[s-2],a[s-1],a[s]);break;case 67:case 75:this.$=a[s-3],r.setLink(a[s-2],a[s-1]),r.setTooltip(a[s-2],a[s]);break;case 68:case 76:this.$=a[s-4],r.setLink(a[s-3],a[s-2],a[s]),r.setTooltip(a[s-3],a[s-1]);break;case 71:this.$=a[s-3],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 72:this.$=a[s-4],r.setClickEvent(a[s-3],a[s-2],a[s-1]),r.setTooltip(a[s-3],a[s]);break;case 77:r.setCssClass(a[s-1],a[s]);}},table:[{3:1,4:2,5:e,6:4,7:5,8:n,9:r,10:i,11:a,12:6,13:11,19:o,23:s},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{3:14,4:2,5:e,6:4,7:5,8:n,9:r,10:i,11:a,12:6,13:11,19:o,23:s},{1:[2,9]},t(c,[2,5]),t(c,[2,6]),t(c,[2,7]),t(c,[2,8]),{14:15,20:[1,16]},{16:[1,17]},{20:[2,12]},{1:[2,4]},{15:18,17:[1,19],22:l},t([17,22],[2,13]),{6:30,7:29,8:n,9:r,10:i,11:a,13:11,19:o,24:21,26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:u,40:h,42:f,43:d,48:p,50:g,51:y,63:m,64:b,66:v,70:_,84:x,85:k,86:w,87:T},{16:[1,49]},{18:50,21:[1,51]},{16:[2,15]},{25:[1,52]},{16:[1,53],25:[2,17]},t(E,[2,25],{32:[1,54]}),t(E,[2,27]),t(E,[2,28]),t(E,[2,29]),t(E,[2,30]),t(E,[2,31]),t(E,[2,32]),t(E,[2,33]),{39:[1,55]},{41:[1,56]},t(E,[2,36]),t(E,[2,44],{52:57,54:60,55:61,32:[1,59],53:[1,58],56:C,57:S,58:A,59:M,60:N,61:O,62:D}),{27:69,28:43,29:44,84:x,85:k,86:w,87:T},t(E,[2,46]),t(E,[2,47]),{28:70,84:x,85:k,86:w},{27:71,28:43,29:44,84:x,85:k,86:w,87:T},{27:72,28:43,29:44,84:x,85:k,86:w,87:T},{27:73,28:43,29:44,84:x,85:k,86:w,87:T},{53:[1,74]},t(B,[2,20],{28:43,29:44,27:75,30:[1,76],84:x,85:k,86:w,87:T}),t(B,[2,21],{30:[1,77]}),t(L,[2,91]),t(L,[2,92]),t(L,[2,93]),t([16,25,30,32,44,45,53,56,57,58,59,60,61,62,67,69],[2,94]),t(I,[2,10]),{15:78,22:l},{22:[2,14]},{1:[2,16]},{6:30,7:29,8:n,9:r,10:i,11:a,13:11,19:o,24:79,25:[2,18],26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:u,40:h,42:f,43:d,48:p,50:g,51:y,63:m,64:b,66:v,70:_,84:x,85:k,86:w,87:T},t(E,[2,26]),t(E,[2,34]),t(E,[2,35]),{27:80,28:43,29:44,53:[1,81],84:x,85:k,86:w,87:T},{52:82,54:60,55:61,56:C,57:S,58:A,59:M,60:N,61:O,62:D},t(E,[2,45]),{55:83,61:O,62:D},t(F,[2,55],{54:84,56:C,57:S,58:A,59:M,60:N}),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,59]),t(R,[2,60]),t(P,[2,61]),t(P,[2,62]),t(E,[2,37],{44:[1,85],45:[1,86]}),{49:[1,87]},{53:[1,88]},{53:[1,89]},{67:[1,90],69:[1,91]},{28:92,84:x,85:k,86:w},t(B,[2,22]),t(B,[2,23]),t(B,[2,24]),{16:[1,93]},{25:[2,19]},t(j,[2,48]),{27:94,28:43,29:44,84:x,85:k,86:w,87:T},{27:95,28:43,29:44,53:[1,96],84:x,85:k,86:w,87:T},t(F,[2,54],{54:97,56:C,57:S,58:A,59:M,60:N}),t(F,[2,53]),{28:98,84:x,85:k,86:w},{46:99,50:z},{27:101,28:43,29:44,84:x,85:k,86:w,87:T},t(E,[2,63],{53:[1,102]}),t(E,[2,65],{53:[1,104],65:[1,103]}),t(E,[2,69],{53:[1,105],68:[1,106]}),t(E,[2,73],{53:[1,108],65:[1,107]}),t(E,[2,77]),t(I,[2,11]),t(j,[2,50]),t(j,[2,49]),{27:109,28:43,29:44,84:x,85:k,86:w,87:T},t(F,[2,52]),t(E,[2,38],{45:[1,110]}),{47:[1,111]},{46:112,47:[2,42],50:z},t(E,[2,41]),t(E,[2,64]),t(E,[2,66]),t(E,[2,67],{65:[1,113]}),t(E,[2,70]),t(E,[2,71],{53:[1,114]}),t(E,[2,74]),t(E,[2,75],{65:[1,115]}),t(j,[2,51]),{46:116,50:z},t(E,[2,39]),{47:[2,43]},t(E,[2,68]),t(E,[2,72]),t(E,[2,76]),{47:[1,117]},t(E,[2,40])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],6:[2,9],13:[2,12],14:[2,4],20:[2,15],51:[2,14],52:[2,16],79:[2,19],112:[2,43]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},U={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),19;case 1:return 8;case 2:return 9;case 3:return 10;case 4:return 11;case 5:return this.begin("type_directive"),20;case 6:return this.popState(),this.begin("arg_directive"),17;case 7:return this.popState(),this.popState(),22;case 8:return 21;case 9:case 10:case 19:case 27:break;case 11:return this.begin("acc_title"),38;case 12:return this.popState(),"acc_title_value";case 13:return this.begin("acc_descr"),40;case 14:return this.popState(),"acc_descr_value";case 15:this.begin("acc_descr_multiline");break;case 16:case 37:case 40:case 43:case 46:case 49:case 52:this.popState();break;case 17:return "acc_descr_multiline_value";case 18:return 16;case 20:case 21:return 23;case 22:return this.begin("struct"),45;case 23:return "EDGE_STATE";case 24:return "EOF_IN_STRUCT";case 25:return "OPEN_IN_STRUCT";case 26:return this.popState(),47;case 28:return "MEMBER";case 29:return 43;case 30:return 70;case 31:return 63;case 32:return 64;case 33:return 66;case 34:return 48;case 35:return 49;case 36:this.begin("generic");break;case 38:return "GENERICTYPE";case 39:this.begin("string");break;case 41:return "STR";case 42:this.begin("bqstring");break;case 44:return "BQUOTE_STR";case 45:this.begin("href");break;case 47:return 69;case 48:this.begin("callback_name");break;case 50:this.popState(),this.begin("callback_args");break;case 51:return 67;case 53:return 68;case 54:case 55:case 56:case 57:return 65;case 58:case 59:return 57;case 60:case 61:return 59;case 62:return 58;case 63:return 56;case 64:return 60;case 65:return 61;case 66:return 62;case 67:return 32;case 68:return 44;case 69:return 82;case 70:return "DOT";case 71:return "PLUS";case 72:return 79;case 73:case 74:return "EQUALS";case 75:return 86;case 76:return "PUNCTUATION";case 77:return 85;case 78:return 84;case 79:return 81;case 80:return 25}},rules:[/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:[{])/,/^(?:\[\*\])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:class\b)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},callback_args:{rules:[52,53],inclusive:!1},callback_name:{rules:[49,50,51],inclusive:!1},href:{rules:[46,47],inclusive:!1},struct:{rules:[23,24,25,26,27,28],inclusive:!1},generic:{rules:[37,38],inclusive:!1},bqstring:{rules:[43,44],inclusive:!1},string:{rules:[40,41],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,29,30,31,32,33,34,35,36,39,42,45,48,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80],inclusive:!0}}};function $(){this.yy={};}return Y.lexer=U,$.prototype=Y,Y.Parser=$,new $}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(8218).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},5890:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,5],r=[6,9,11,23,25,27,29,30,49],i=[1,17],a=[1,18],o=[1,19],s=[1,20],c=[1,21],l=[1,24],u=[1,29],h=[1,30],f=[1,31],d=[1,32],p=[6,9,11,15,20,23,25,27,29,30,42,43,44,45,49],g=[1,45],y=[30,46,47],m=[4,6,9,11,23,25,27,29,30,49],b=[42,43,44,45],v=[22,37],_=[1,64],x={trace:function(){},yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,entityName:17,relSpec:18,role:19,BLOCK_START:20,attributes:21,BLOCK_STOP:22,title:23,title_value:24,acc_title:25,acc_title_value:26,acc_descr:27,acc_descr_value:28,acc_descr_multiline_value:29,ALPHANUM:30,".":31,attribute:32,attributeType:33,attributeName:34,attributeKeyType:35,attributeComment:36,ATTRIBUTE_WORD:37,ATTRIBUTE_KEY:38,COMMENT:39,cardinality:40,relType:41,ZERO_OR_ONE:42,ZERO_OR_MORE:43,ONE_OR_MORE:44,ONLY_ONE:45,NON_IDENTIFYING:46,IDENTIFYING:47,WORD:48,open_directive:49,type_directive:50,arg_directive:51,close_directive:52,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",20:"BLOCK_START",22:"BLOCK_STOP",23:"title",24:"title_value",25:"acc_title",26:"acc_title_value",27:"acc_descr",28:"acc_descr_value",29:"acc_descr_multiline_value",30:"ALPHANUM",31:".",37:"ATTRIBUTE_WORD",38:"ATTRIBUTE_KEY",39:"COMMENT",42:"ZERO_OR_ONE",43:"ZERO_OR_MORE",44:"ONE_OR_MORE",45:"ONLY_ONE",46:"NON_IDENTIFYING",47:"IDENTIFYING",48:"WORD",49:"open_directive",50:"type_directive",51:"arg_directive",52:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[10,4],[10,3],[10,1],[10,2],[10,2],[10,2],[10,1],[17,1],[17,3],[21,1],[21,2],[32,2],[32,3],[32,3],[32,4],[33,1],[34,1],[35,1],[36,1],[18,3],[40,1],[40,1],[40,1],[40,1],[41,1],[41,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:break;case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:case 20:case 28:case 29:case 30:case 40:this.$=a[s];break;case 12:r.addEntity(a[s-4]),r.addEntity(a[s-2]),r.addRelationship(a[s-4],a[s],a[s-2],a[s-3]);break;case 13:r.addEntity(a[s-3]),r.addAttributes(a[s-3],a[s-1]);break;case 14:r.addEntity(a[s-2]);break;case 15:r.addEntity(a[s]);break;case 16:case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 21:this.$=a[s-2]+a[s-1]+a[s];break;case 22:this.$=[a[s]];break;case 23:a[s].push(a[s-1]),this.$=a[s];break;case 24:this.$={attributeType:a[s-1],attributeName:a[s]};break;case 25:this.$={attributeType:a[s-2],attributeName:a[s-1],attributeKeyType:a[s]};break;case 26:this.$={attributeType:a[s-2],attributeName:a[s-1],attributeComment:a[s]};break;case 27:this.$={attributeType:a[s-3],attributeName:a[s-2],attributeKeyType:a[s-1],attributeComment:a[s]};break;case 31:case 39:this.$=a[s].replace(/"/g,"");break;case 32:this.$={cardA:a[s],relType:a[s-1],cardB:a[s-2]};break;case 33:this.$=r.Cardinality.ZERO_OR_ONE;break;case 34:this.$=r.Cardinality.ZERO_OR_MORE;break;case 35:this.$=r.Cardinality.ONE_OR_MORE;break;case 36:this.$=r.Cardinality.ONLY_ONE;break;case 37:this.$=r.Identification.NON_IDENTIFYING;break;case 38:this.$=r.Identification.IDENTIFYING;break;case 41:r.parseDirective("%%{","open_directive");break;case 42:r.parseDirective(a[s],"type_directive");break;case 43:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 44:r.parseDirective("}%%","close_directive","er");}},table:[{3:1,4:e,7:3,12:4,49:n},{1:[3]},t(r,[2,3],{5:6}),{3:7,4:e,7:3,12:4,49:n},{13:8,50:[1,9]},{50:[2,41]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:i,25:a,27:o,29:s,30:c,49:n},{1:[2,2]},{14:22,15:[1,23],52:l},t([15,52],[2,42]),t(r,[2,8],{1:[2,1]}),t(r,[2,4]),{7:15,10:25,12:4,17:16,23:i,25:a,27:o,29:s,30:c,49:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,11]),t(r,[2,15],{18:26,40:28,20:[1,27],42:u,43:h,44:f,45:d}),{24:[1,33]},{26:[1,34]},{28:[1,35]},t(r,[2,19]),t(p,[2,20],{31:[1,36]}),{11:[1,37]},{16:38,51:[1,39]},{11:[2,44]},t(r,[2,5]),{17:40,30:c},{21:41,22:[1,42],32:43,33:44,37:g},{41:46,46:[1,47],47:[1,48]},t(y,[2,33]),t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(r,[2,16]),t(r,[2,17]),t(r,[2,18]),{17:49,30:c},t(m,[2,9]),{14:50,52:l},{52:[2,43]},{15:[1,51]},{22:[1,52]},t(r,[2,14]),{21:53,22:[2,22],32:43,33:44,37:g},{34:54,37:[1,55]},{37:[2,28]},{40:56,42:u,43:h,44:f,45:d},t(b,[2,37]),t(b,[2,38]),t(p,[2,21]),{11:[1,57]},{19:58,30:[1,60],48:[1,59]},t(r,[2,13]),{22:[2,23]},t(v,[2,24],{35:61,36:62,38:[1,63],39:_}),t([22,37,38,39],[2,29]),{30:[2,32]},t(m,[2,10]),t(r,[2,12]),t(r,[2,39]),t(r,[2,40]),t(v,[2,25],{36:65,39:_}),t(v,[2,26]),t([22,37,39],[2,30]),t(v,[2,31]),t(v,[2,27])],defaultActions:{5:[2,41],7:[2,2],24:[2,44],39:[2,43],45:[2,28],53:[2,23],56:[2,32]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},k={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("acc_title"),25;case 1:return this.popState(),"acc_title_value";case 2:return this.begin("acc_descr"),27;case 3:return this.popState(),"acc_descr_value";case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return "acc_descr_multiline_value";case 7:return this.begin("open_directive"),49;case 8:return this.begin("type_directive"),50;case 9:return this.popState(),this.begin("arg_directive"),15;case 10:return this.popState(),this.popState(),52;case 11:return 51;case 12:case 13:case 15:case 20:case 25:break;case 14:return 11;case 16:return 9;case 17:return 48;case 18:return 4;case 19:return this.begin("block"),20;case 21:return 38;case 22:case 23:return 37;case 24:return 39;case 26:return this.popState(),22;case 27:case 40:return e.yytext[0];case 28:case 32:return 42;case 29:case 33:return 43;case 30:case 34:return 44;case 31:return 45;case 35:case 37:case 38:return 46;case 36:return 47;case 39:return 30;case 41:return 6}},rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK))\b)/i,/^(?:(.*?)[~](.*?)*[~])/i,/^(?:[A-Za-z][A-Za-z0-9\-_\[\]]*)/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\|o\b)/i,/^(?:\}o\b)/i,/^(?:\}\|)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:[A-Za-z][A-Za-z0-9\-_]*)/i,/^(?:.)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},open_directive:{rules:[8],inclusive:!1},type_directive:{rules:[9,10],inclusive:!1},arg_directive:{rules:[10,11],inclusive:!1},block:{rules:[20,21,22,23,24,25,26,27],inclusive:!1},INITIAL:{rules:[0,2,4,7,12,13,14,15,16,17,18,19,28,29,30,31,32,33,34,35,36,37,38,39,40,41],inclusive:!0}}};function w(){this.yy={};}return x.lexer=k,w.prototype=x,x.Parser=w,new w}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(8009).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},3602:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,9],n=[1,7],r=[1,6],i=[1,8],a=[1,20,21,22,23,38,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],o=[2,10],s=[1,20],c=[1,21],l=[1,22],u=[1,23],h=[1,30],f=[1,32],d=[1,33],p=[1,34],g=[1,62],y=[1,48],m=[1,52],b=[1,36],v=[1,37],_=[1,38],x=[1,39],k=[1,40],w=[1,56],T=[1,63],E=[1,51],C=[1,53],S=[1,55],A=[1,59],M=[1,60],N=[1,41],O=[1,42],D=[1,43],B=[1,44],L=[1,61],I=[1,50],F=[1,54],R=[1,57],P=[1,58],j=[1,49],z=[1,66],Y=[1,71],U=[1,20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$=[1,75],W=[1,74],q=[1,76],H=[20,21,23,81,82],V=[1,99],G=[1,104],X=[1,107],Z=[1,108],Q=[1,101],K=[1,106],J=[1,109],tt=[1,102],et=[1,114],nt=[1,113],rt=[1,103],it=[1,105],at=[1,110],ot=[1,111],st=[1,112],ct=[1,115],lt=[20,21,22,23,81,82],ut=[20,21,22,23,53,81,82],ht=[20,21,22,23,40,52,53,55,57,59,61,63,65,66,67,69,71,73,74,76,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],ft=[20,21,23],dt=[20,21,23,52,66,67,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],pt=[1,12,20,21,22,23,24,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],gt=[52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],yt=[1,149],mt=[1,157],bt=[1,158],vt=[1,159],_t=[1,160],xt=[1,144],kt=[1,145],wt=[1,141],Tt=[1,152],Et=[1,153],Ct=[1,154],St=[1,155],At=[1,156],Mt=[1,161],Nt=[1,162],Ot=[1,147],Dt=[1,150],Bt=[1,146],Lt=[1,143],It=[20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],Ft=[1,165],Rt=[20,21,22,23,26,52,66,67,91,105,106,109,111,112,122,123,124,125,126,127],Pt=[20,21,22,23,24,26,38,40,41,42,52,56,58,60,62,64,66,67,68,70,72,73,75,77,81,82,86,87,88,89,90,91,92,95,105,106,109,111,112,113,114,122,123,124,125,126,127],jt=[12,21,22,24],zt=[22,106],Yt=[1,250],Ut=[1,245],$t=[1,246],Wt=[1,254],qt=[1,251],Ht=[1,248],Vt=[1,247],Gt=[1,249],Xt=[1,252],Zt=[1,253],Qt=[1,255],Kt=[1,273],Jt=[20,21,23,106],te=[20,21,22,23,66,67,86,102,105,106,109,110,111,112,113],ee={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,directive:5,openDirective:6,typeDirective:7,closeDirective:8,separator:9,":":10,argDirective:11,open_directive:12,type_directive:13,arg_directive:14,close_directive:15,graphConfig:16,document:17,line:18,statement:19,SEMI:20,NEWLINE:21,SPACE:22,EOF:23,GRAPH:24,NODIR:25,DIR:26,FirstStmtSeperator:27,ending:28,endToken:29,spaceList:30,spaceListNewline:31,verticeStatement:32,styleStatement:33,linkStyleStatement:34,classDefStatement:35,classStatement:36,clickStatement:37,subgraph:38,text:39,SQS:40,SQE:41,end:42,direction:43,acc_title:44,acc_title_value:45,acc_descr:46,acc_descr_value:47,acc_descr_multiline_value:48,link:49,node:50,vertex:51,AMP:52,STYLE_SEPARATOR:53,idString:54,DOUBLECIRCLESTART:55,DOUBLECIRCLEEND:56,PS:57,PE:58,"(-":59,"-)":60,STADIUMSTART:61,STADIUMEND:62,SUBROUTINESTART:63,SUBROUTINEEND:64,VERTEX_WITH_PROPS_START:65,ALPHA:66,COLON:67,PIPE:68,CYLINDERSTART:69,CYLINDEREND:70,DIAMOND_START:71,DIAMOND_STOP:72,TAGEND:73,TRAPSTART:74,TRAPEND:75,INVTRAPSTART:76,INVTRAPEND:77,linkStatement:78,arrowText:79,TESTSTR:80,START_LINK:81,LINK:82,textToken:83,STR:84,keywords:85,STYLE:86,LINKSTYLE:87,CLASSDEF:88,CLASS:89,CLICK:90,DOWN:91,UP:92,textNoTags:93,textNoTagsToken:94,DEFAULT:95,stylesOpt:96,alphaNum:97,CALLBACKNAME:98,CALLBACKARGS:99,HREF:100,LINK_TARGET:101,HEX:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,MINUS:109,UNIT:110,BRKT:111,DOT:112,PCT:113,TAGSTART:114,alphaNumToken:115,idStringToken:116,alphaNumStatement:117,direction_tb:118,direction_bt:119,direction_rl:120,direction_lr:121,PUNCTUATION:122,UNICODE_TEXT:123,PLUS:124,EQUALS:125,MULT:126,UNDERSCORE:127,graphCodeTokens:128,ARROW_CROSS:129,ARROW_POINT:130,ARROW_CIRCLE:131,ARROW_OPEN:132,QUOTE:133,$accept:0,$end:1},terminals_:{2:"error",10:":",12:"open_directive",13:"type_directive",14:"arg_directive",15:"close_directive",20:"SEMI",21:"NEWLINE",22:"SPACE",23:"EOF",24:"GRAPH",25:"NODIR",26:"DIR",38:"subgraph",40:"SQS",41:"SQE",42:"end",44:"acc_title",45:"acc_title_value",46:"acc_descr",47:"acc_descr_value",48:"acc_descr_multiline_value",52:"AMP",53:"STYLE_SEPARATOR",55:"DOUBLECIRCLESTART",56:"DOUBLECIRCLEEND",57:"PS",58:"PE",59:"(-",60:"-)",61:"STADIUMSTART",62:"STADIUMEND",63:"SUBROUTINESTART",64:"SUBROUTINEEND",65:"VERTEX_WITH_PROPS_START",66:"ALPHA",67:"COLON",68:"PIPE",69:"CYLINDERSTART",70:"CYLINDEREND",71:"DIAMOND_START",72:"DIAMOND_STOP",73:"TAGEND",74:"TRAPSTART",75:"TRAPEND",76:"INVTRAPSTART",77:"INVTRAPEND",80:"TESTSTR",81:"START_LINK",82:"LINK",84:"STR",86:"STYLE",87:"LINKSTYLE",88:"CLASSDEF",89:"CLASS",90:"CLICK",91:"DOWN",92:"UP",95:"DEFAULT",98:"CALLBACKNAME",99:"CALLBACKARGS",100:"HREF",101:"LINK_TARGET",102:"HEX",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"MINUS",110:"UNIT",111:"BRKT",112:"DOT",113:"PCT",114:"TAGSTART",118:"direction_tb",119:"direction_bt",120:"direction_rl",121:"direction_lr",122:"PUNCTUATION",123:"UNICODE_TEXT",124:"PLUS",125:"EQUALS",126:"MULT",127:"UNDERSCORE",129:"ARROW_CROSS",130:"ARROW_POINT",131:"ARROW_CIRCLE",132:"ARROW_OPEN",133:"QUOTE"},productions_:[0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[19,1],[19,2],[19,2],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[50,1],[50,5],[50,3],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,8],[51,4],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,4],[51,4],[51,1],[49,2],[49,3],[49,3],[49,1],[49,3],[78,1],[79,3],[39,1],[39,2],[39,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[93,1],[93,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[103,1],[103,3],[96,1],[96,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[94,1],[94,1],[94,1],[94,1],[54,1],[54,2],[97,1],[97,2],[117,1],[117,1],[117,1],[117,1],[43,1],[43,1],[43,1],[43,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.parseDirective("%%{","open_directive");break;case 6:r.parseDirective(a[s],"type_directive");break;case 7:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 8:r.parseDirective("}%%","close_directive","flowchart");break;case 10:case 36:case 37:case 38:case 39:case 40:this.$=[];break;case 11:a[s]!==[]&&a[s-1].push(a[s]),this.$=a[s-1];break;case 12:case 82:case 84:case 96:case 152:case 154:case 155:case 78:case 150:this.$=a[s];break;case 19:r.setDirection("TB"),this.$="TB";break;case 20:r.setDirection(a[s-1]),this.$=a[s-1];break;case 35:this.$=a[s-1].nodes;break;case 41:this.$=r.addSubGraph(a[s-6],a[s-1],a[s-4]);break;case 42:this.$=r.addSubGraph(a[s-3],a[s-1],a[s-3]);break;case 43:this.$=r.addSubGraph(void 0,a[s-1],void 0);break;case 45:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 46:case 47:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 51:r.addLink(a[s-2].stmt,a[s],a[s-1]),this.$={stmt:a[s],nodes:a[s].concat(a[s-2].nodes)};break;case 52:r.addLink(a[s-3].stmt,a[s-1],a[s-2]),this.$={stmt:a[s-1],nodes:a[s-1].concat(a[s-3].nodes)};break;case 53:this.$={stmt:a[s-1],nodes:a[s-1]};break;case 54:this.$={stmt:a[s],nodes:a[s]};break;case 55:case 123:case 125:this.$=[a[s]];break;case 56:this.$=a[s-4].concat(a[s]);break;case 57:this.$=[a[s-2]],r.setClass(a[s-2],a[s]);break;case 58:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"square");break;case 59:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"doublecircle");break;case 60:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],"circle");break;case 61:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"ellipse");break;case 62:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"stadium");break;case 63:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"subroutine");break;case 64:this.$=a[s-7],r.addVertex(a[s-7],a[s-1],"rect",void 0,void 0,void 0,Object.fromEntries([[a[s-5],a[s-3]]]));break;case 65:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"cylinder");break;case 66:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"round");break;case 67:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"diamond");break;case 68:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],"hexagon");break;case 69:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"odd");break;case 70:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"trapezoid");break;case 71:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"inv_trapezoid");break;case 72:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"lean_right");break;case 73:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],"lean_left");break;case 74:this.$=a[s],r.addVertex(a[s]);break;case 75:a[s-1].text=a[s],this.$=a[s-1];break;case 76:case 77:a[s-2].text=a[s-1],this.$=a[s-2];break;case 79:var c=r.destructLink(a[s],a[s-2]);this.$={type:c.type,stroke:c.stroke,length:c.length,text:a[s-1]};break;case 80:c=r.destructLink(a[s]),this.$={type:c.type,stroke:c.stroke,length:c.length};break;case 81:this.$=a[s-1];break;case 83:case 97:case 153:case 151:this.$=a[s-1]+""+a[s];break;case 98:case 99:this.$=a[s-4],r.addClass(a[s-2],a[s]);break;case 100:this.$=a[s-4],r.setClass(a[s-2],a[s]);break;case 101:case 109:this.$=a[s-1],r.setClickEvent(a[s-1],a[s]);break;case 102:case 110:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 103:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 104:this.$=a[s-4],r.setClickEvent(a[s-4],a[s-3],a[s-2]),r.setTooltip(a[s-4],a[s]);break;case 105:case 111:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 106:case 112:this.$=a[s-3],r.setLink(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 107:case 113:this.$=a[s-3],r.setLink(a[s-3],a[s-2],a[s]);break;case 108:case 114:this.$=a[s-5],r.setLink(a[s-5],a[s-4],a[s]),r.setTooltip(a[s-5],a[s-2]);break;case 115:this.$=a[s-4],r.addVertex(a[s-2],void 0,void 0,a[s]);break;case 116:case 118:this.$=a[s-4],r.updateLink(a[s-2],a[s]);break;case 117:this.$=a[s-4],r.updateLink([a[s-2]],a[s]);break;case 119:this.$=a[s-8],r.updateLinkInterpolate([a[s-6]],a[s-2]),r.updateLink([a[s-6]],a[s]);break;case 120:this.$=a[s-8],r.updateLinkInterpolate(a[s-6],a[s-2]),r.updateLink(a[s-6],a[s]);break;case 121:this.$=a[s-6],r.updateLinkInterpolate([a[s-4]],a[s]);break;case 122:this.$=a[s-6],r.updateLinkInterpolate(a[s-4],a[s]);break;case 124:case 126:a[s-2].push(a[s]),this.$=a[s-2];break;case 128:this.$=a[s-1]+a[s];break;case 156:this.$="v";break;case 157:this.$="-";break;case 158:this.$={stmt:"dir",value:"TB"};break;case 159:this.$={stmt:"dir",value:"BT"};break;case 160:this.$={stmt:"dir",value:"RL"};break;case 161:this.$={stmt:"dir",value:"LR"};}},table:[{3:1,4:2,5:3,6:5,12:e,16:4,21:n,22:r,24:i},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:e,16:4,21:n,22:r,24:i},t(a,o,{17:11}),{7:12,13:[1,13]},{16:14,21:n,22:r,24:i},{16:15,21:n,22:r,24:i},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{8:64,10:[1,65],15:z},t([10,15],[2,6]),t(a,[2,17]),t(a,[2,18]),t(a,[2,19]),{20:[1,68],21:[1,69],22:Y,27:67,30:70},t(U,[2,11]),t(U,[2,12]),t(U,[2,13]),t(U,[2,14]),t(U,[2,15]),t(U,[2,16]),{9:72,20:$,21:W,23:q,49:73,78:77,81:[1,78],82:[1,79]},{9:80,20:$,21:W,23:q},{9:81,20:$,21:W,23:q},{9:82,20:$,21:W,23:q},{9:83,20:$,21:W,23:q},{9:84,20:$,21:W,23:q},{9:86,20:$,21:W,22:[1,85],23:q},t(U,[2,44]),{45:[1,87]},{47:[1,88]},t(U,[2,47]),t(H,[2,54],{30:89,22:Y}),{22:[1,90]},{22:[1,91]},{22:[1,92]},{22:[1,93]},{26:V,52:G,66:X,67:Z,84:[1,97],91:Q,97:96,98:[1,94],100:[1,95],105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(U,[2,158]),t(U,[2,159]),t(U,[2,160]),t(U,[2,161]),t(lt,[2,55],{53:[1,116]}),t(ut,[2,74],{116:129,40:[1,117],52:g,55:[1,118],57:[1,119],59:[1,120],61:[1,121],63:[1,122],65:[1,123],66:y,67:m,69:[1,124],71:[1,125],73:[1,126],74:[1,127],76:[1,128],91:w,95:T,105:E,106:C,109:S,111:A,112:M,122:L,123:I,124:F,125:R,126:P,127:j}),t(ht,[2,150]),t(ht,[2,175]),t(ht,[2,176]),t(ht,[2,177]),t(ht,[2,178]),t(ht,[2,179]),t(ht,[2,180]),t(ht,[2,181]),t(ht,[2,182]),t(ht,[2,183]),t(ht,[2,184]),t(ht,[2,185]),t(ht,[2,186]),t(ht,[2,187]),t(ht,[2,188]),t(ht,[2,189]),t(ht,[2,190]),{9:130,20:$,21:W,23:q},{11:131,14:[1,132]},t(ft,[2,8]),t(a,[2,20]),t(a,[2,26]),t(a,[2,27]),{21:[1,133]},t(dt,[2,34],{30:134,22:Y}),t(U,[2,35]),{50:135,51:45,52:g,54:46,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},t(pt,[2,48]),t(pt,[2,49]),t(pt,[2,50]),t(gt,[2,78],{79:136,68:[1,138],80:[1,137]}),{22:yt,24:mt,26:bt,38:vt,39:139,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t([52,66,67,68,80,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,80]),t(U,[2,36]),t(U,[2,37]),t(U,[2,38]),t(U,[2,39]),t(U,[2,40]),{22:yt,24:mt,26:bt,38:vt,39:163,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(It,o,{17:164}),t(U,[2,45]),t(U,[2,46]),t(H,[2,53],{52:Ft}),{26:V,52:G,66:X,67:Z,91:Q,97:166,102:[1,167],105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{95:[1,168],103:169,105:[1,170]},{26:V,52:G,66:X,67:Z,91:Q,95:[1,171],97:172,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{26:V,52:G,66:X,67:Z,91:Q,97:173,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,101],{22:[1,174],99:[1,175]}),t(ft,[2,105],{22:[1,176]}),t(ft,[2,109],{115:100,117:178,22:[1,177],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,111],{22:[1,179]}),t(Rt,[2,152]),t(Rt,[2,154]),t(Rt,[2,155]),t(Rt,[2,156]),t(Rt,[2,157]),t(Pt,[2,162]),t(Pt,[2,163]),t(Pt,[2,164]),t(Pt,[2,165]),t(Pt,[2,166]),t(Pt,[2,167]),t(Pt,[2,168]),t(Pt,[2,169]),t(Pt,[2,170]),t(Pt,[2,171]),t(Pt,[2,172]),t(Pt,[2,173]),t(Pt,[2,174]),{52:g,54:180,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},{22:yt,24:mt,26:bt,38:vt,39:181,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:182,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:184,42:_t,52:G,57:[1,183],66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:185,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:186,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:187,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{66:[1,188]},{22:yt,24:mt,26:bt,38:vt,39:189,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:190,42:_t,52:G,66:X,67:Z,71:[1,191],73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:192,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:193,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:194,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ht,[2,151]),t(jt,[2,3]),{8:195,15:z},{15:[2,7]},t(a,[2,28]),t(dt,[2,33]),t(H,[2,51],{30:196,22:Y}),t(gt,[2,75],{22:[1,197]}),{22:[1,198]},{22:yt,24:mt,26:bt,38:vt,39:199,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,81:kt,82:[1,200],83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(Pt,[2,82]),t(Pt,[2,84]),t(Pt,[2,140]),t(Pt,[2,141]),t(Pt,[2,142]),t(Pt,[2,143]),t(Pt,[2,144]),t(Pt,[2,145]),t(Pt,[2,146]),t(Pt,[2,147]),t(Pt,[2,148]),t(Pt,[2,149]),t(Pt,[2,85]),t(Pt,[2,86]),t(Pt,[2,87]),t(Pt,[2,88]),t(Pt,[2,89]),t(Pt,[2,90]),t(Pt,[2,91]),t(Pt,[2,92]),t(Pt,[2,93]),t(Pt,[2,94]),t(Pt,[2,95]),{9:203,20:$,21:W,22:yt,23:q,24:mt,26:bt,38:vt,40:[1,202],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,204],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{22:Y,30:205},{22:[1,206],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:[1,207]},{22:[1,208]},{22:[1,209],106:[1,210]},t(zt,[2,123]),{22:[1,211]},{22:[1,212],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:[1,213],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{84:[1,214]},t(ft,[2,103],{22:[1,215]}),{84:[1,216],101:[1,217]},{84:[1,218]},t(Rt,[2,153]),{84:[1,219],101:[1,220]},t(lt,[2,57],{116:129,52:g,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,122:L,123:I,124:F,125:R,126:P,127:j}),{22:yt,24:mt,26:bt,38:vt,41:[1,221],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,56:[1,222],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:223,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,58:[1,224],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,60:[1,225],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,62:[1,226],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,64:[1,227],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{67:[1,228]},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,70:[1,229],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,72:[1,230],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:231,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,41:[1,232],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,75:[1,233],77:[1,234],81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,75:[1,236],77:[1,235],81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{9:237,20:$,21:W,23:q},t(H,[2,52],{52:Ft}),t(gt,[2,77]),t(gt,[2,76]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,68:[1,238],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(gt,[2,79]),t(Pt,[2,83]),{22:yt,24:mt,26:bt,38:vt,39:239,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(It,o,{17:240}),t(U,[2,43]),{51:241,52:g,54:46,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},{22:Yt,66:Ut,67:$t,86:Wt,96:242,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:256,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:257,102:qt,104:[1,258],105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:259,102:qt,104:[1,260],105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{105:[1,261]},{22:Yt,66:Ut,67:$t,86:Wt,96:262,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:263,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{26:V,52:G,66:X,67:Z,91:Q,97:264,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,102]),{84:[1,265]},t(ft,[2,106],{22:[1,266]}),t(ft,[2,107]),t(ft,[2,110]),t(ft,[2,112],{22:[1,267]}),t(ft,[2,113]),t(ut,[2,58]),t(ut,[2,59]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,58:[1,268],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,66]),t(ut,[2,61]),t(ut,[2,62]),t(ut,[2,63]),{66:[1,269]},t(ut,[2,65]),t(ut,[2,67]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,72:[1,270],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,69]),t(ut,[2,70]),t(ut,[2,72]),t(ut,[2,71]),t(ut,[2,73]),t(jt,[2,4]),t([22,52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,81]),{22:yt,24:mt,26:bt,38:vt,41:[1,271],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,272],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},t(lt,[2,56]),t(ft,[2,115],{106:Kt}),t(Jt,[2,125],{108:274,22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt}),t(te,[2,127]),t(te,[2,129]),t(te,[2,130]),t(te,[2,131]),t(te,[2,132]),t(te,[2,133]),t(te,[2,134]),t(te,[2,135]),t(te,[2,136]),t(te,[2,137]),t(te,[2,138]),t(te,[2,139]),t(ft,[2,116],{106:Kt}),t(ft,[2,117],{106:Kt}),{22:[1,275]},t(ft,[2,118],{106:Kt}),{22:[1,276]},t(zt,[2,124]),t(ft,[2,98],{106:Kt}),t(ft,[2,99],{106:Kt}),t(ft,[2,100],{115:100,117:178,26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,104]),{101:[1,277]},{101:[1,278]},{58:[1,279]},{68:[1,280]},{72:[1,281]},{9:282,20:$,21:W,23:q},t(U,[2,42]),{22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,107:283,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},t(te,[2,128]),{26:V,52:G,66:X,67:Z,91:Q,97:284,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{26:V,52:G,66:X,67:Z,91:Q,97:285,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,108]),t(ft,[2,114]),t(ut,[2,60]),{22:yt,24:mt,26:bt,38:vt,39:286,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,68]),t(It,o,{17:287}),t(Jt,[2,126],{108:274,22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt}),t(ft,[2,121],{115:100,117:178,22:[1,288],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,122],{115:100,117:178,22:[1,289],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),{22:yt,24:mt,26:bt,38:vt,41:[1,290],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,291],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{22:Yt,66:Ut,67:$t,86:Wt,96:292,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:293,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},t(ut,[2,64]),t(U,[2,41]),t(ft,[2,119],{106:Kt}),t(ft,[2,120],{106:Kt})],defaultActions:{2:[2,1],9:[2,5],10:[2,2],132:[2,7]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},ne={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),12;case 1:return this.begin("type_directive"),13;case 2:return this.popState(),this.begin("arg_directive"),10;case 3:return this.popState(),this.popState(),15;case 4:return 14;case 5:case 6:break;case 7:return this.begin("acc_title"),44;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),46;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:case 15:case 24:case 27:case 30:case 33:this.popState();break;case 13:return "acc_descr_multiline_value";case 14:this.begin("string");break;case 16:return "STR";case 17:return 86;case 18:return 95;case 19:return 87;case 20:return 104;case 21:return 88;case 22:return 89;case 23:this.begin("href");break;case 25:return 100;case 26:this.begin("callbackname");break;case 28:this.popState(),this.begin("callbackargs");break;case 29:return 98;case 31:return 99;case 32:this.begin("click");break;case 34:return 90;case 35:case 36:return t.lex.firstGraph()&&this.begin("dir"),24;case 37:return 38;case 38:return 42;case 39:case 40:case 41:case 42:return 101;case 43:return this.popState(),25;case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:return this.popState(),26;case 54:return 118;case 55:return 119;case 56:return 120;case 57:return 121;case 58:return 105;case 59:return 111;case 60:return 53;case 61:return 67;case 62:return 52;case 63:return 20;case 64:return 106;case 65:return 126;case 66:case 67:case 68:return 82;case 69:case 70:case 71:return 81;case 72:return 59;case 73:return 60;case 74:return 61;case 75:return 62;case 76:return 63;case 77:return 64;case 78:return 65;case 79:return 69;case 80:return 70;case 81:return 55;case 82:return 56;case 83:return 109;case 84:return 112;case 85:return 127;case 86:return 124;case 87:return 113;case 88:case 89:return 125;case 90:return 114;case 91:return 73;case 92:return 92;case 93:return "SEP";case 94:return 91;case 95:return 66;case 96:return 75;case 97:return 74;case 98:return 77;case 99:return 76;case 100:return 122;case 101:return 123;case 102:return 68;case 103:return 57;case 104:return 58;case 105:return 40;case 106:return 41;case 107:return 71;case 108:return 72;case 109:return 133;case 110:return 21;case 111:return 22;case 112:return 23}},rules:[/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[^\}]%%[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\[)/,/^(?:\]\))/,/^(?:\[\[)/,/^(?:\]\])/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\])/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:-)/,/^(?:\.)/,/^(?:[\_])/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\])/,/^(?:\[\/)/,/^(?:\/\])/,/^(?:\[\\)/,/^(?:[!"#$%&'*+,-.`?\\_/])/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[30,31],inclusive:!1},callbackname:{rules:[27,28,29],inclusive:!1},href:{rules:[24,25],inclusive:!1},click:{rules:[33,34],inclusive:!1},vertex:{rules:[],inclusive:!1},dir:{rules:[43,44,45,46,47,48,49,50,51,52,53],inclusive:!1},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},string:{rules:[15,16],inclusive:!1},INITIAL:{rules:[0,5,6,7,9,11,14,17,18,19,20,21,22,23,26,32,35,36,37,38,39,40,41,42,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],inclusive:!0}}};function re(){this.yy={};}return ee.lexer=ne,re.prototype=ee,ee.Parser=re,new re}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(5354).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},9959:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,5],r=[7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39],i=[1,15],a=[1,16],o=[1,17],s=[1,18],c=[1,19],l=[1,20],u=[1,21],h=[1,22],f=[1,23],d=[1,24],p=[1,25],g=[1,26],y=[1,28],m=[1,30],b=[1,33],v=[5,7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39],_={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,gantt:5,document:6,EOF:7,line:8,SPACE:9,statement:10,NL:11,dateFormat:12,inclusiveEndDates:13,topAxis:14,axisFormat:15,excludes:16,includes:17,todayMarker:18,title:19,acc_title:20,acc_title_value:21,acc_descr:22,acc_descr_value:23,acc_descr_multiline_value:24,section:25,clickStatement:26,taskTxt:27,taskData:28,openDirective:29,typeDirective:30,closeDirective:31,":":32,argDirective:33,click:34,callbackname:35,callbackargs:36,href:37,clickStatementDebug:38,open_directive:39,type_directive:40,arg_directive:41,close_directive:42,$accept:0,$end:1},terminals_:{2:"error",5:"gantt",7:"EOF",9:"SPACE",11:"NL",12:"dateFormat",13:"inclusiveEndDates",14:"topAxis",15:"axisFormat",16:"excludes",17:"includes",18:"todayMarker",19:"title",20:"acc_title",21:"acc_title_value",22:"acc_descr",23:"acc_descr_value",24:"acc_descr_multiline_value",25:"section",27:"taskTxt",28:"taskData",32:":",34:"click",35:"callbackname",36:"callbackargs",37:"href",39:"open_directive",40:"type_directive",41:"arg_directive",42:"close_directive"},productions_:[0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[26,2],[26,3],[26,3],[26,4],[26,3],[26,4],[26,2],[38,2],[38,3],[38,3],[38,4],[38,3],[38,4],[38,2],[29,1],[30,1],[33,1],[31,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 2:return a[s-1];case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:this.$=a[s];break;case 9:r.setDateFormat(a[s].substr(11)),this.$=a[s].substr(11);break;case 10:r.enableInclusiveEndDates(),this.$=a[s].substr(18);break;case 11:r.TopAxis(),this.$=a[s].substr(8);break;case 12:r.setAxisFormat(a[s].substr(11)),this.$=a[s].substr(11);break;case 13:r.setExcludes(a[s].substr(9)),this.$=a[s].substr(9);break;case 14:r.setIncludes(a[s].substr(9)),this.$=a[s].substr(9);break;case 15:r.setTodayMarker(a[s].substr(12)),this.$=a[s].substr(12);break;case 16:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 20:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 22:r.addTask(a[s-1],a[s]),this.$="task";break;case 26:this.$=a[s-1],r.setClickEvent(a[s-1],a[s],null);break;case 27:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 28:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],null),r.setLink(a[s-2],a[s]);break;case 29:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2],a[s-1]),r.setLink(a[s-3],a[s]);break;case 30:this.$=a[s-2],r.setClickEvent(a[s-2],a[s],null),r.setLink(a[s-2],a[s-1]);break;case 31:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-1],a[s]),r.setLink(a[s-3],a[s-2]);break;case 32:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 33:case 39:this.$=a[s-1]+" "+a[s];break;case 34:case 35:case 37:this.$=a[s-2]+" "+a[s-1]+" "+a[s];break;case 36:case 38:this.$=a[s-3]+" "+a[s-2]+" "+a[s-1]+" "+a[s];break;case 40:r.parseDirective("%%{","open_directive");break;case 41:r.parseDirective(a[s],"type_directive");break;case 42:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 43:r.parseDirective("}%%","close_directive","gantt");}},table:[{3:1,4:2,5:e,29:4,39:n},{1:[3]},{3:6,4:2,5:e,29:4,39:n},t(r,[2,3],{6:7}),{30:8,40:[1,9]},{40:[2,40]},{1:[2,1]},{4:29,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:i,13:a,14:o,15:s,16:c,17:l,18:u,19:h,20:f,22:d,24:p,25:g,26:27,27:y,29:4,34:m,39:n},{31:31,32:[1,32],42:b},t([32,42],[2,41]),t(r,[2,8],{1:[2,2]}),t(r,[2,4]),{4:29,10:34,12:i,13:a,14:o,15:s,16:c,17:l,18:u,19:h,20:f,22:d,24:p,25:g,26:27,27:y,29:4,34:m,39:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,9]),t(r,[2,10]),t(r,[2,11]),t(r,[2,12]),t(r,[2,13]),t(r,[2,14]),t(r,[2,15]),t(r,[2,16]),{21:[1,35]},{23:[1,36]},t(r,[2,19]),t(r,[2,20]),t(r,[2,21]),{28:[1,37]},t(r,[2,23]),{35:[1,38],37:[1,39]},{11:[1,40]},{33:41,41:[1,42]},{11:[2,43]},t(r,[2,5]),t(r,[2,17]),t(r,[2,18]),t(r,[2,22]),t(r,[2,26],{36:[1,43],37:[1,44]}),t(r,[2,32],{35:[1,45]}),t(v,[2,24]),{31:46,42:b},{42:[2,42]},t(r,[2,27],{37:[1,47]}),t(r,[2,28]),t(r,[2,30],{36:[1,48]}),{11:[1,49]},t(r,[2,29]),t(r,[2,31]),t(v,[2,25])],defaultActions:{5:[2,40],6:[2,1],33:[2,43],42:[2,42]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},x={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),39;case 1:return this.begin("type_directive"),40;case 2:return this.popState(),this.begin("arg_directive"),32;case 3:return this.popState(),this.popState(),42;case 4:return 41;case 5:return this.begin("acc_title"),20;case 6:return this.popState(),"acc_title_value";case 7:return this.begin("acc_descr"),22;case 8:return this.popState(),"acc_descr_value";case 9:this.begin("acc_descr_multiline");break;case 10:case 20:case 23:case 26:case 29:this.popState();break;case 11:return "acc_descr_multiline_value";case 12:case 13:case 14:case 16:case 17:case 18:break;case 15:return 11;case 19:this.begin("href");break;case 21:return 37;case 22:this.begin("callbackname");break;case 24:this.popState(),this.begin("callbackargs");break;case 25:return 35;case 27:return 36;case 28:this.begin("click");break;case 30:return 34;case 31:return 5;case 32:return 12;case 33:return 13;case 34:return 14;case 35:return 15;case 36:return 17;case 37:return 16;case 38:return 18;case 39:return "date";case 40:return 19;case 41:return "accDescription";case 42:return 25;case 43:return 27;case 44:return 28;case 45:return 32;case 46:return 7;case 47:return "INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[26,27],inclusive:!1},callbackname:{rules:[23,24,25],inclusive:!1},href:{rules:[20,21],inclusive:!1},click:{rules:[29,30],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,22,28,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],inclusive:!0}}};function k(){this.yy={};}return _.lexer=x,k.prototype=_,_.Parser=k,new k}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(6878).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},2553:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,4],n=[1,7],r=[1,5],i=[1,9],a=[1,6],o=[2,6],s=[1,16],c=[6,8,14,20,22,24,25,27,29,32,35,39,49,53],l=[8,14,20,22,24,25,27,29,32,35,39],u=[8,13,14,20,22,24,25,27,29,32,35,39],h=[1,26],f=[6,8,14,49,53],d=[8,14,53],p=[1,64],g=[1,65],y=[1,66],m=[8,14,33,38,41,53],b={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,GG:6,document:7,EOF:8,":":9,DIR:10,options:11,body:12,OPT:13,NL:14,line:15,statement:16,commitStatement:17,mergeStatement:18,cherryPickStatement:19,acc_title:20,acc_title_value:21,acc_descr:22,acc_descr_value:23,acc_descr_multiline_value:24,section:25,branchStatement:26,CHECKOUT:27,ID:28,BRANCH:29,ORDER:30,NUM:31,CHERRY_PICK:32,COMMIT_ID:33,STR:34,MERGE:35,COMMIT_TYPE:36,commitType:37,COMMIT_TAG:38,COMMIT:39,commit_arg:40,COMMIT_MSG:41,NORMAL:42,REVERSE:43,HIGHLIGHT:44,openDirective:45,typeDirective:46,closeDirective:47,argDirective:48,open_directive:49,type_directive:50,arg_directive:51,close_directive:52,";":53,$accept:0,$end:1},terminals_:{2:"error",6:"GG",8:"EOF",9:":",10:"DIR",13:"OPT",14:"NL",20:"acc_title",21:"acc_title_value",22:"acc_descr",23:"acc_descr_value",24:"acc_descr_multiline_value",25:"section",27:"CHECKOUT",28:"ID",29:"BRANCH",30:"ORDER",31:"NUM",32:"CHERRY_PICK",33:"COMMIT_ID",34:"STR",35:"MERGE",36:"COMMIT_TYPE",38:"COMMIT_TAG",39:"COMMIT",41:"COMMIT_MSG",42:"NORMAL",43:"REVERSE",44:"HIGHLIGHT",49:"open_directive",50:"type_directive",51:"arg_directive",52:"close_directive",53:";"},productions_:[0,[3,2],[3,2],[3,3],[3,4],[3,5],[7,0],[7,2],[11,2],[11,1],[12,0],[12,2],[15,2],[15,1],[16,1],[16,1],[16,1],[16,2],[16,2],[16,1],[16,1],[16,1],[16,2],[26,2],[26,4],[19,3],[18,2],[18,4],[18,4],[18,4],[18,6],[18,6],[18,6],[18,6],[18,6],[18,6],[18,8],[18,8],[18,8],[18,8],[18,8],[18,8],[17,2],[17,3],[17,3],[17,5],[17,5],[17,3],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,3],[17,5],[17,5],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[40,0],[40,1],[37,1],[37,1],[37,1],[5,3],[5,5],[45,1],[46,1],[48,1],[47,1],[4,1],[4,1],[4,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return a[s];case 4:return a[s-1];case 5:return r.setDirection(a[s-3]),a[s-1];case 7:r.setOptions(a[s-1]),this.$=a[s];break;case 8:a[s-1]+=a[s],this.$=a[s-1];break;case 10:this.$=[];break;case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 12:this.$=a[s-1];break;case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 20:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 22:r.checkout(a[s]);break;case 23:r.branch(a[s]);break;case 24:r.branch(a[s-2],a[s]);break;case 25:r.cherryPick(a[s]);break;case 26:r.merge(a[s],"","","");break;case 27:r.merge(a[s-2],a[s],"","");break;case 28:r.merge(a[s-2],"",a[s],"");break;case 29:r.merge(a[s-2],"","",a[s]);break;case 30:r.merge(a[s-4],a[s],"",a[s-2]);break;case 31:r.merge(a[s-4],"",a[s],a[s-2]);break;case 32:r.merge(a[s-4],"",a[s-2],a[s]);break;case 33:r.merge(a[s-4],a[s-2],a[s],"");break;case 34:r.merge(a[s-4],a[s-2],"",a[s]);break;case 35:r.merge(a[s-4],a[s],a[s-2],"");break;case 36:r.merge(a[s-6],a[s-4],a[s-2],a[s]);break;case 37:r.merge(a[s-6],a[s],a[s-4],a[s-2]);break;case 38:r.merge(a[s-6],a[s-4],a[s],a[s-2]);break;case 39:r.merge(a[s-6],a[s-2],a[s-4],a[s]);break;case 40:r.merge(a[s-6],a[s],a[s-2],a[s-4]);break;case 41:r.merge(a[s-6],a[s-2],a[s],a[s-4]);break;case 42:r.commit(a[s]);break;case 43:r.commit("","",r.commitType.NORMAL,a[s]);break;case 44:r.commit("","",a[s],"");break;case 45:r.commit("","",a[s],a[s-2]);break;case 46:r.commit("","",a[s-2],a[s]);break;case 47:r.commit("",a[s],r.commitType.NORMAL,"");break;case 48:r.commit("",a[s-2],r.commitType.NORMAL,a[s]);break;case 49:r.commit("",a[s],r.commitType.NORMAL,a[s-2]);break;case 50:r.commit("",a[s-2],a[s],"");break;case 51:r.commit("",a[s],a[s-2],"");break;case 52:r.commit("",a[s-4],a[s-2],a[s]);break;case 53:r.commit("",a[s-4],a[s],a[s-2]);break;case 54:r.commit("",a[s-2],a[s-4],a[s]);break;case 55:r.commit("",a[s],a[s-4],a[s-2]);break;case 56:r.commit("",a[s],a[s-2],a[s-4]);break;case 57:r.commit("",a[s-2],a[s],a[s-4]);break;case 58:r.commit(a[s],"",r.commitType.NORMAL,"");break;case 59:r.commit(a[s],"",r.commitType.NORMAL,a[s-2]);break;case 60:r.commit(a[s-2],"",r.commitType.NORMAL,a[s]);break;case 61:r.commit(a[s-2],"",a[s],"");break;case 62:r.commit(a[s],"",a[s-2],"");break;case 63:r.commit(a[s],a[s-2],r.commitType.NORMAL,"");break;case 64:r.commit(a[s-2],a[s],r.commitType.NORMAL,"");break;case 65:r.commit(a[s-4],"",a[s-2],a[s]);break;case 66:r.commit(a[s-4],"",a[s],a[s-2]);break;case 67:r.commit(a[s-2],"",a[s-4],a[s]);break;case 68:r.commit(a[s],"",a[s-4],a[s-2]);break;case 69:r.commit(a[s],"",a[s-2],a[s-4]);break;case 70:r.commit(a[s-2],"",a[s],a[s-4]);break;case 71:r.commit(a[s-4],a[s],a[s-2],"");break;case 72:r.commit(a[s-4],a[s-2],a[s],"");break;case 73:r.commit(a[s-2],a[s],a[s-4],"");break;case 74:r.commit(a[s],a[s-2],a[s-4],"");break;case 75:r.commit(a[s],a[s-4],a[s-2],"");break;case 76:r.commit(a[s-2],a[s-4],a[s],"");break;case 77:r.commit(a[s-4],a[s],r.commitType.NORMAL,a[s-2]);break;case 78:r.commit(a[s-4],a[s-2],r.commitType.NORMAL,a[s]);break;case 79:r.commit(a[s-2],a[s],r.commitType.NORMAL,a[s-4]);break;case 80:r.commit(a[s],a[s-2],r.commitType.NORMAL,a[s-4]);break;case 81:r.commit(a[s],a[s-4],r.commitType.NORMAL,a[s-2]);break;case 82:r.commit(a[s-2],a[s-4],r.commitType.NORMAL,a[s]);break;case 83:r.commit(a[s-6],a[s-4],a[s-2],a[s]);break;case 84:r.commit(a[s-6],a[s-4],a[s],a[s-2]);break;case 85:r.commit(a[s-6],a[s-2],a[s-4],a[s]);break;case 86:r.commit(a[s-6],a[s],a[s-4],a[s-2]);break;case 87:r.commit(a[s-6],a[s-2],a[s],a[s-4]);break;case 88:r.commit(a[s-6],a[s],a[s-2],a[s-4]);break;case 89:r.commit(a[s-4],a[s-6],a[s-2],a[s]);break;case 90:r.commit(a[s-4],a[s-6],a[s],a[s-2]);break;case 91:r.commit(a[s-2],a[s-6],a[s-4],a[s]);break;case 92:r.commit(a[s],a[s-6],a[s-4],a[s-2]);break;case 93:r.commit(a[s-2],a[s-6],a[s],a[s-4]);break;case 94:r.commit(a[s],a[s-6],a[s-2],a[s-4]);break;case 95:r.commit(a[s],a[s-4],a[s-2],a[s-6]);break;case 96:r.commit(a[s-2],a[s-4],a[s],a[s-6]);break;case 97:r.commit(a[s],a[s-2],a[s-4],a[s-6]);break;case 98:r.commit(a[s-2],a[s],a[s-4],a[s-6]);break;case 99:r.commit(a[s-4],a[s-2],a[s],a[s-6]);break;case 100:r.commit(a[s-4],a[s],a[s-2],a[s-6]);break;case 101:r.commit(a[s-2],a[s-4],a[s-6],a[s]);break;case 102:r.commit(a[s],a[s-4],a[s-6],a[s-2]);break;case 103:r.commit(a[s-2],a[s],a[s-6],a[s-4]);break;case 104:r.commit(a[s],a[s-2],a[s-6],a[s-4]);break;case 105:r.commit(a[s-4],a[s-2],a[s-6],a[s]);break;case 106:r.commit(a[s-4],a[s],a[s-6],a[s-2]);break;case 107:this.$="";break;case 108:this.$=a[s];break;case 109:this.$=r.commitType.NORMAL;break;case 110:this.$=r.commitType.REVERSE;break;case 111:this.$=r.commitType.HIGHLIGHT;break;case 114:r.parseDirective("%%{","open_directive");break;case 115:r.parseDirective(a[s],"type_directive");break;case 116:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 117:r.parseDirective("}%%","close_directive","gitGraph");}},table:[{3:1,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{1:[3]},{3:10,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{3:11,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{7:12,8:o,9:[1,13],10:[1,14],11:15,14:s},t(c,[2,118]),t(c,[2,119]),t(c,[2,120]),{46:17,50:[1,18]},{50:[2,114]},{1:[2,1]},{1:[2,2]},{8:[1,19]},{7:20,8:o,11:15,14:s},{9:[1,21]},t(l,[2,10],{12:22,13:[1,23]}),t(u,[2,9]),{9:[1,25],47:24,52:h},t([9,52],[2,115]),{1:[2,3]},{8:[1,27]},{7:28,8:o,11:15,14:s},{8:[2,7],14:[1,31],15:29,16:30,17:32,18:33,19:34,20:[1,35],22:[1,36],24:[1,37],25:[1,38],26:39,27:[1,40],29:[1,44],32:[1,43],35:[1,42],39:[1,41]},t(u,[2,8]),t(f,[2,112]),{48:45,51:[1,46]},t(f,[2,117]),{1:[2,4]},{8:[1,47]},t(l,[2,11]),{4:48,8:n,14:r,53:a},t(l,[2,13]),t(d,[2,14]),t(d,[2,15]),t(d,[2,16]),{21:[1,49]},{23:[1,50]},t(d,[2,19]),t(d,[2,20]),t(d,[2,21]),{28:[1,51]},t(d,[2,107],{40:52,33:[1,55],34:[1,57],36:[1,54],38:[1,53],41:[1,56]}),{28:[1,58]},{33:[1,59]},{28:[1,60]},{47:61,52:h},{52:[2,116]},{1:[2,5]},t(l,[2,12]),t(d,[2,17]),t(d,[2,18]),t(d,[2,22]),t(d,[2,42]),{34:[1,62]},{37:63,42:p,43:g,44:y},{34:[1,67]},{34:[1,68]},t(d,[2,108]),t(d,[2,26],{33:[1,69],36:[1,70],38:[1,71]}),{34:[1,72]},t(d,[2,23],{30:[1,73]}),t(f,[2,113]),t(d,[2,43],{33:[1,75],36:[1,74],41:[1,76]}),t(d,[2,44],{33:[1,78],38:[1,77],41:[1,79]}),t(m,[2,109]),t(m,[2,110]),t(m,[2,111]),t(d,[2,47],{36:[1,81],38:[1,80],41:[1,82]}),t(d,[2,58],{33:[1,85],36:[1,84],38:[1,83]}),{34:[1,86]},{37:87,42:p,43:g,44:y},{34:[1,88]},t(d,[2,25]),{31:[1,89]},{37:90,42:p,43:g,44:y},{34:[1,91]},{34:[1,92]},{34:[1,93]},{34:[1,94]},{34:[1,95]},{34:[1,96]},{37:97,42:p,43:g,44:y},{34:[1,98]},{34:[1,99]},{37:100,42:p,43:g,44:y},{34:[1,101]},t(d,[2,27],{36:[1,102],38:[1,103]}),t(d,[2,28],{33:[1,105],38:[1,104]}),t(d,[2,29],{33:[1,106],36:[1,107]}),t(d,[2,24]),t(d,[2,45],{33:[1,108],41:[1,109]}),t(d,[2,49],{36:[1,110],41:[1,111]}),t(d,[2,59],{33:[1,113],36:[1,112]}),t(d,[2,46],{33:[1,114],41:[1,115]}),t(d,[2,51],{38:[1,116],41:[1,117]}),t(d,[2,62],{33:[1,119],38:[1,118]}),t(d,[2,48],{36:[1,120],41:[1,121]}),t(d,[2,50],{38:[1,122],41:[1,123]}),t(d,[2,63],{36:[1,124],38:[1,125]}),t(d,[2,60],{33:[1,127],36:[1,126]}),t(d,[2,61],{33:[1,129],38:[1,128]}),t(d,[2,64],{36:[1,130],38:[1,131]}),{37:132,42:p,43:g,44:y},{34:[1,133]},{34:[1,134]},{34:[1,135]},{34:[1,136]},{37:137,42:p,43:g,44:y},{34:[1,138]},{34:[1,139]},{37:140,42:p,43:g,44:y},{34:[1,141]},{37:142,42:p,43:g,44:y},{34:[1,143]},{34:[1,144]},{34:[1,145]},{34:[1,146]},{34:[1,147]},{34:[1,148]},{34:[1,149]},{37:150,42:p,43:g,44:y},{34:[1,151]},{34:[1,152]},{34:[1,153]},{37:154,42:p,43:g,44:y},{34:[1,155]},{37:156,42:p,43:g,44:y},{34:[1,157]},{34:[1,158]},{34:[1,159]},{37:160,42:p,43:g,44:y},{34:[1,161]},t(d,[2,33],{38:[1,162]}),t(d,[2,34],{36:[1,163]}),t(d,[2,32],{33:[1,164]}),t(d,[2,35],{38:[1,165]}),t(d,[2,30],{36:[1,166]}),t(d,[2,31],{33:[1,167]}),t(d,[2,56],{41:[1,168]}),t(d,[2,69],{33:[1,169]}),t(d,[2,57],{41:[1,170]}),t(d,[2,80],{36:[1,171]}),t(d,[2,70],{33:[1,172]}),t(d,[2,79],{36:[1,173]}),t(d,[2,55],{41:[1,174]}),t(d,[2,68],{33:[1,175]}),t(d,[2,54],{41:[1,176]}),t(d,[2,74],{38:[1,177]}),t(d,[2,67],{33:[1,178]}),t(d,[2,73],{38:[1,179]}),t(d,[2,53],{41:[1,180]}),t(d,[2,81],{36:[1,181]}),t(d,[2,52],{41:[1,182]}),t(d,[2,75],{38:[1,183]}),t(d,[2,76],{38:[1,184]}),t(d,[2,82],{36:[1,185]}),t(d,[2,66],{33:[1,186]}),t(d,[2,77],{36:[1,187]}),t(d,[2,65],{33:[1,188]}),t(d,[2,71],{38:[1,189]}),t(d,[2,72],{38:[1,190]}),t(d,[2,78],{36:[1,191]}),{34:[1,192]},{37:193,42:p,43:g,44:y},{34:[1,194]},{34:[1,195]},{37:196,42:p,43:g,44:y},{34:[1,197]},{34:[1,198]},{34:[1,199]},{34:[1,200]},{37:201,42:p,43:g,44:y},{34:[1,202]},{37:203,42:p,43:g,44:y},{34:[1,204]},{34:[1,205]},{34:[1,206]},{34:[1,207]},{34:[1,208]},{34:[1,209]},{34:[1,210]},{37:211,42:p,43:g,44:y},{34:[1,212]},{34:[1,213]},{34:[1,214]},{37:215,42:p,43:g,44:y},{34:[1,216]},{37:217,42:p,43:g,44:y},{34:[1,218]},{34:[1,219]},{34:[1,220]},{37:221,42:p,43:g,44:y},t(d,[2,36]),t(d,[2,38]),t(d,[2,37]),t(d,[2,39]),t(d,[2,41]),t(d,[2,40]),t(d,[2,97]),t(d,[2,98]),t(d,[2,95]),t(d,[2,96]),t(d,[2,100]),t(d,[2,99]),t(d,[2,104]),t(d,[2,103]),t(d,[2,102]),t(d,[2,101]),t(d,[2,106]),t(d,[2,105]),t(d,[2,94]),t(d,[2,93]),t(d,[2,92]),t(d,[2,91]),t(d,[2,89]),t(d,[2,90]),t(d,[2,88]),t(d,[2,87]),t(d,[2,86]),t(d,[2,85]),t(d,[2,83]),t(d,[2,84])],defaultActions:{9:[2,114],10:[2,1],11:[2,2],19:[2,3],27:[2,4],46:[2,116],47:[2,5]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},v={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),49;case 1:return this.begin("type_directive"),50;case 2:return this.popState(),this.begin("arg_directive"),9;case 3:return this.popState(),this.popState(),52;case 4:return 51;case 5:return this.begin("acc_title"),20;case 6:return this.popState(),"acc_title_value";case 7:return this.begin("acc_descr"),22;case 8:return this.popState(),"acc_descr_value";case 9:this.begin("acc_descr_multiline");break;case 10:case 35:case 38:this.popState();break;case 11:return "acc_descr_multiline_value";case 12:return 14;case 13:case 14:case 15:break;case 16:return 6;case 17:return 39;case 18:return 33;case 19:return 36;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 38;case 25:return 29;case 26:return 30;case 27:return 35;case 28:return 32;case 29:return 27;case 30:case 31:return 10;case 32:return 9;case 33:return "CARET";case 34:this.begin("options");break;case 36:return 13;case 37:this.begin("string");break;case 39:return 34;case 40:return 31;case 41:return 28;case 42:return 8}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gitGraph\b)/i,/^(?:commit\b)/i,/^(?:id:)/i,/^(?:type:)/i,/^(?:msg:)/i,/^(?:NORMAL\b)/i,/^(?:REVERSE\b)/i,/^(?:HIGHLIGHT\b)/i,/^(?:tag:)/i,/^(?:branch\b)/i,/^(?:order:)/i,/^(?:merge\b)/i,/^(?:cherry-pick\b)/i,/^(?:checkout\b)/i,/^(?:LR\b)/i,/^(?:BT\b)/i,/^(?::)/i,/^(?:\^)/i,/^(?:options\r?\n)/i,/^(?:[ \r\n\t]+end\b)/i,/^(?:[\s\S]+(?=[ \r\n\t]+end))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[0-9]+)/i,/^(?:[a-zA-Z][-_\./a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},options:{rules:[35,36],inclusive:!1},string:{rules:[38,39],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,37,40,41,42],inclusive:!0}}};function _(){this.yy={};}return b.lexer=v,_.prototype=b,b.Parser=_,new _}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(8183).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},6765:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[6,9,10],n={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,r,i,a,o){switch(a.length,i){case 1:return r;case 4:break;case 6:r.setInfo(!0);}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},t(e,[2,3]),t(e,[2,4]),t(e,[2,5]),t(e,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},r={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return 4;case 1:return 9;case 2:return "space";case 3:return 10;case 4:return 6;case 5:return "TXT"}},rules:[/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5],inclusive:!0}}};function i(){this.yy={};}return n.lexer=r,i.prototype=n,n.Parser=i,new i}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(1428).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},7062:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,4],n=[1,5],r=[1,6],i=[1,7],a=[1,9],o=[1,11,13,15,17,19,20,26,27,28,29],s=[2,5],c=[1,6,11,13,15,17,19,20,26,27,28,29],l=[26,27,28],u=[2,8],h=[1,18],f=[1,19],d=[1,20],p=[1,21],g=[1,22],y=[1,23],m=[1,28],b=[6,26,27,28,29],v={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,PIE:6,document:7,showData:8,line:9,statement:10,txt:11,value:12,title:13,title_value:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,openDirective:21,typeDirective:22,closeDirective:23,":":24,argDirective:25,NEWLINE:26,";":27,EOF:28,open_directive:29,type_directive:30,arg_directive:31,close_directive:32,$accept:0,$end:1},terminals_:{2:"error",6:"PIE",8:"showData",11:"txt",12:"value",13:"title",14:"title_value",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",24:":",26:"NEWLINE",27:";",28:"EOF",29:"open_directive",30:"type_directive",31:"arg_directive",32:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[21,1],[22,1],[25,1],[23,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:r.setShowData(!0);break;case 7:this.$=a[s-1];break;case 9:r.addSection(a[s-1],r.cleanupValue(a[s]));break;case 10:this.$=a[s].trim(),r.setDiagramTitle(this.$);break;case 11:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 12:case 13:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 14:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 21:r.parseDirective("%%{","open_directive");break;case 22:r.parseDirective(a[s],"type_directive");break;case 23:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 24:r.parseDirective("}%%","close_directive","pie");}},table:[{3:1,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},{1:[3]},{3:10,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},{3:11,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},t(o,s,{7:12,8:[1,13]}),t(c,[2,18]),t(c,[2,19]),t(c,[2,20]),{22:14,30:[1,15]},{30:[2,21]},{1:[2,1]},{1:[2,2]},t(l,u,{21:8,9:16,10:17,5:24,1:[2,3],11:h,13:f,15:d,17:p,19:g,20:y,29:a}),t(o,s,{7:25}),{23:26,24:[1,27],32:m},t([24,32],[2,22]),t(o,[2,6]),{4:29,26:n,27:r,28:i},{12:[1,30]},{14:[1,31]},{16:[1,32]},{18:[1,33]},t(l,[2,13]),t(l,[2,14]),t(l,[2,15]),t(l,u,{21:8,9:16,10:17,5:24,1:[2,4],11:h,13:f,15:d,17:p,19:g,20:y,29:a}),t(b,[2,16]),{25:34,31:[1,35]},t(b,[2,24]),t(o,[2,7]),t(l,[2,9]),t(l,[2,10]),t(l,[2,11]),t(l,[2,12]),{23:36,32:m},{32:[2,23]},t(b,[2,17])],defaultActions:{9:[2,21],10:[2,1],11:[2,2],35:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},_={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),29;case 1:return this.begin("type_directive"),30;case 2:return this.popState(),this.begin("arg_directive"),24;case 3:return this.popState(),this.popState(),32;case 4:return 31;case 5:case 6:case 8:case 9:break;case 7:return 26;case 10:return this.begin("title"),13;case 11:return this.popState(),"title_value";case 12:return this.begin("acc_title"),15;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),17;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:case 20:this.popState();break;case 18:return "acc_descr_multiline_value";case 19:this.begin("string");break;case 21:return "txt";case 22:return 6;case 23:return 8;case 24:return "value";case 25:return 28}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[\s]+)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:pie\b)/i,/^(?:showData\b)/i,/^(?::[\s]*[\d]+(?:\.[\d]+)?)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},title:{rules:[11],inclusive:!1},string:{rules:[20,21],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,12,14,16,19,22,23,24,25],inclusive:!0}}};function x(){this.yy={};}return v.lexer=_,x.prototype=v,v.Parser=x,new x}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(4551).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},3176:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,5],r=[1,6],i=[1,7],a=[1,8],o=[5,6,8,14,16,18,19,40,41,42,43,44,45,53,71,72],s=[1,22],c=[2,13],l=[1,26],u=[1,27],h=[1,28],f=[1,29],d=[1,30],p=[1,31],g=[1,24],y=[1,32],m=[1,33],b=[1,36],v=[71,72],_=[5,8,14,16,18,19,40,41,42,43,44,45,53,60,62,71,72],x=[1,56],k=[1,57],w=[1,58],T=[1,59],E=[1,60],C=[1,61],S=[1,62],A=[62,63],M=[1,74],N=[1,70],O=[1,71],D=[1,72],B=[1,73],L=[1,75],I=[1,79],F=[1,80],R=[1,77],P=[1,78],j=[5,8,14,16,18,19,40,41,42,43,44,45,53,71,72],z={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,openDirective:9,typeDirective:10,closeDirective:11,":":12,argDirective:13,acc_title:14,acc_title_value:15,acc_descr:16,acc_descr_value:17,acc_descr_multiline_value:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,requirementDef:23,elementDef:24,relationshipDef:25,requirementType:26,requirementName:27,STRUCT_START:28,requirementBody:29,ID:30,COLONSEP:31,id:32,TEXT:33,text:34,RISK:35,riskLevel:36,VERIFYMTHD:37,verifyType:38,STRUCT_STOP:39,REQUIREMENT:40,FUNCTIONAL_REQUIREMENT:41,INTERFACE_REQUIREMENT:42,PERFORMANCE_REQUIREMENT:43,PHYSICAL_REQUIREMENT:44,DESIGN_CONSTRAINT:45,LOW_RISK:46,MED_RISK:47,HIGH_RISK:48,VERIFY_ANALYSIS:49,VERIFY_DEMONSTRATION:50,VERIFY_INSPECTION:51,VERIFY_TEST:52,ELEMENT:53,elementName:54,elementBody:55,TYPE:56,type:57,DOCREF:58,ref:59,END_ARROW_L:60,relationship:61,LINE:62,END_ARROW_R:63,CONTAINS:64,COPIES:65,DERIVES:66,SATISFIES:67,VERIFIES:68,REFINES:69,TRACES:70,unqString:71,qString:72,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",12:":",14:"acc_title",15:"acc_title_value",16:"acc_descr",17:"acc_descr_value",18:"acc_descr_multiline_value",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",28:"STRUCT_START",30:"ID",31:"COLONSEP",33:"TEXT",35:"RISK",37:"VERIFYMTHD",39:"STRUCT_STOP",40:"REQUIREMENT",41:"FUNCTIONAL_REQUIREMENT",42:"INTERFACE_REQUIREMENT",43:"PERFORMANCE_REQUIREMENT",44:"PHYSICAL_REQUIREMENT",45:"DESIGN_CONSTRAINT",46:"LOW_RISK",47:"MED_RISK",48:"HIGH_RISK",49:"VERIFY_ANALYSIS",50:"VERIFY_DEMONSTRATION",51:"VERIFY_INSPECTION",52:"VERIFY_TEST",53:"ELEMENT",56:"TYPE",58:"DOCREF",60:"END_ARROW_L",62:"LINE",63:"END_ARROW_R",64:"CONTAINS",65:"COPIES",66:"DERIVES",67:"SATISFIES",68:"VERIFIES",69:"REFINES",70:"TRACES",71:"unqString",72:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,3],[4,5],[4,2],[4,2],[4,1],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[23,5],[29,5],[29,5],[29,5],[29,5],[29,2],[29,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[36,1],[36,1],[36,1],[38,1],[38,1],[38,1],[38,1],[24,5],[55,5],[55,5],[55,2],[55,1],[25,5],[25,5],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[27,1],[27,1],[32,1],[32,1],[34,1],[34,1],[54,1],[54,1],[57,1],[57,1],[59,1],[59,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 6:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 7:case 8:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 9:r.parseDirective("%%{","open_directive");break;case 10:r.parseDirective(a[s],"type_directive");break;case 11:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 12:r.parseDirective("}%%","close_directive","pie");break;case 13:this.$=[];break;case 19:r.addRequirement(a[s-3],a[s-4]);break;case 20:r.setNewReqId(a[s-2]);break;case 21:r.setNewReqText(a[s-2]);break;case 22:r.setNewReqRisk(a[s-2]);break;case 23:r.setNewReqVerifyMethod(a[s-2]);break;case 26:this.$=r.RequirementType.REQUIREMENT;break;case 27:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 28:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 29:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 30:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 32:this.$=r.RiskLevel.LOW_RISK;break;case 33:this.$=r.RiskLevel.MED_RISK;break;case 34:this.$=r.RiskLevel.HIGH_RISK;break;case 35:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 36:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 37:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 38:this.$=r.VerifyType.VERIFY_TEST;break;case 39:r.addElement(a[s-3]);break;case 40:r.setNewElementType(a[s-2]);break;case 41:r.setNewElementDocRef(a[s-2]);break;case 44:r.addRelationship(a[s-2],a[s],a[s-4]);break;case 45:r.addRelationship(a[s-2],a[s-4],a[s]);break;case 46:this.$=r.Relationships.CONTAINS;break;case 47:this.$=r.Relationships.COPIES;break;case 48:this.$=r.Relationships.DERIVES;break;case 49:this.$=r.Relationships.SATISFIES;break;case 50:this.$=r.Relationships.VERIFIES;break;case 51:this.$=r.Relationships.REFINES;break;case 52:this.$=r.Relationships.TRACES;}},table:[{3:1,4:2,6:e,9:4,14:n,16:r,18:i,19:a},{1:[3]},{3:10,4:2,5:[1,9],6:e,9:4,14:n,16:r,18:i,19:a},{5:[1,11]},{10:12,20:[1,13]},{15:[1,14]},{17:[1,15]},t(o,[2,8]),{20:[2,9]},{3:16,4:2,6:e,9:4,14:n,16:r,18:i,19:a},{1:[2,2]},{4:21,5:s,7:17,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{11:34,12:[1,35],22:b},t([12,22],[2,10]),t(o,[2,6]),t(o,[2,7]),{1:[2,1]},{8:[1,37]},{4:21,5:s,7:38,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:39,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:40,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:41,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:42,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{27:43,71:[1,44],72:[1,45]},{54:46,71:[1,47],72:[1,48]},{60:[1,49],62:[1,50]},t(v,[2,26]),t(v,[2,27]),t(v,[2,28]),t(v,[2,29]),t(v,[2,30]),t(v,[2,31]),t(_,[2,55]),t(_,[2,56]),t(o,[2,4]),{13:51,21:[1,52]},t(o,[2,12]),{1:[2,3]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{8:[2,17]},{8:[2,18]},{28:[1,53]},{28:[2,53]},{28:[2,54]},{28:[1,54]},{28:[2,59]},{28:[2,60]},{61:55,64:x,65:k,66:w,67:T,68:E,69:C,70:S},{61:63,64:x,65:k,66:w,67:T,68:E,69:C,70:S},{11:64,22:b},{22:[2,11]},{5:[1,65]},{5:[1,66]},{62:[1,67]},t(A,[2,46]),t(A,[2,47]),t(A,[2,48]),t(A,[2,49]),t(A,[2,50]),t(A,[2,51]),t(A,[2,52]),{63:[1,68]},t(o,[2,5]),{5:M,29:69,30:N,33:O,35:D,37:B,39:L},{5:I,39:F,55:76,56:R,58:P},{32:81,71:y,72:m},{32:82,71:y,72:m},t(j,[2,19]),{31:[1,83]},{31:[1,84]},{31:[1,85]},{31:[1,86]},{5:M,29:87,30:N,33:O,35:D,37:B,39:L},t(j,[2,25]),t(j,[2,39]),{31:[1,88]},{31:[1,89]},{5:I,39:F,55:90,56:R,58:P},t(j,[2,43]),t(j,[2,44]),t(j,[2,45]),{32:91,71:y,72:m},{34:92,71:[1,93],72:[1,94]},{36:95,46:[1,96],47:[1,97],48:[1,98]},{38:99,49:[1,100],50:[1,101],51:[1,102],52:[1,103]},t(j,[2,24]),{57:104,71:[1,105],72:[1,106]},{59:107,71:[1,108],72:[1,109]},t(j,[2,42]),{5:[1,110]},{5:[1,111]},{5:[2,57]},{5:[2,58]},{5:[1,112]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[1,113]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[2,38]},{5:[1,114]},{5:[2,61]},{5:[2,62]},{5:[1,115]},{5:[2,63]},{5:[2,64]},{5:M,29:116,30:N,33:O,35:D,37:B,39:L},{5:M,29:117,30:N,33:O,35:D,37:B,39:L},{5:M,29:118,30:N,33:O,35:D,37:B,39:L},{5:M,29:119,30:N,33:O,35:D,37:B,39:L},{5:I,39:F,55:120,56:R,58:P},{5:I,39:F,55:121,56:R,58:P},t(j,[2,20]),t(j,[2,21]),t(j,[2,22]),t(j,[2,23]),t(j,[2,40]),t(j,[2,41])],defaultActions:{8:[2,9],10:[2,2],16:[2,1],37:[2,3],38:[2,14],39:[2,15],40:[2,16],41:[2,17],42:[2,18],44:[2,53],45:[2,54],47:[2,59],48:[2,60],52:[2,11],93:[2,57],94:[2,58],96:[2,32],97:[2,33],98:[2,34],100:[2,35],101:[2,36],102:[2,37],103:[2,38],105:[2,61],106:[2,62],108:[2,63],109:[2,64]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},Y={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),19;case 1:return this.begin("type_directive"),20;case 2:return this.popState(),this.begin("arg_directive"),12;case 3:return this.popState(),this.popState(),22;case 4:return 21;case 5:return "title";case 6:return this.begin("acc_title"),14;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),16;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 53:this.popState();break;case 12:return "acc_descr_multiline_value";case 13:return 5;case 14:case 15:case 16:break;case 17:return 8;case 18:return 6;case 19:return 28;case 20:return 39;case 21:return 31;case 22:return 30;case 23:return 33;case 24:return 35;case 25:return 37;case 26:return 40;case 27:return 41;case 28:return 42;case 29:return 43;case 30:return 44;case 31:return 45;case 32:return 46;case 33:return 47;case 34:return 48;case 35:return 49;case 36:return 50;case 37:return 51;case 38:return 52;case 39:return 53;case 40:return 64;case 41:return 65;case 42:return 66;case 43:return 67;case 44:return 68;case 45:return 69;case 46:return 70;case 47:return 56;case 48:return 58;case 49:return 60;case 50:return 63;case 51:return 62;case 52:this.begin("string");break;case 54:return "qString";case 55:return e.yytext=e.yytext.trim(),71}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^\r\n\{\<\>\-\=]*)/i],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},unqString:{rules:[],inclusive:!1},token:{rules:[],inclusive:!1},string:{rules:[53,54],inclusive:!1},INITIAL:{rules:[0,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55],inclusive:!0}}};function U(){this.yy={};}return z.lexer=Y,U.prototype=z,z.Parser=U,new U}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(8800).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},6876:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,3],r=[1,5],i=[1,7],a=[2,5],o=[1,15],s=[1,17],c=[1,18],l=[1,19],u=[1,21],h=[1,22],f=[1,23],d=[1,29],p=[1,30],g=[1,31],y=[1,32],m=[1,33],b=[1,34],v=[1,35],_=[1,36],x=[1,37],k=[1,38],w=[1,39],T=[1,40],E=[1,43],C=[1,44],S=[1,45],A=[1,46],M=[1,47],N=[1,48],O=[1,51],D=[1,4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79],B=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,53,58,59,60,61,69,79],L=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,52,53,58,59,60,61,69,79],I=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,51,53,58,59,60,61,69,79],F=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,53,58,59,60,61,69,79],R=[67,68,69],P=[1,121],j=[1,4,5,7,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79],z={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,directive:6,SD:7,document:8,line:9,statement:10,openDirective:11,typeDirective:12,closeDirective:13,":":14,argDirective:15,participant:16,actor:17,AS:18,restOfLine:19,participant_actor:20,signal:21,autonumber:22,NUM:23,off:24,activate:25,deactivate:26,note_statement:27,links_statement:28,link_statement:29,properties_statement:30,details_statement:31,title:32,legacy_title:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,loop:39,end:40,rect:41,opt:42,alt:43,else_sections:44,par:45,par_sections:46,critical:47,option_sections:48,break:49,option:50,and:51,else:52,note:53,placement:54,text2:55,over:56,actor_pair:57,links:58,link:59,properties:60,details:61,spaceList:62,",":63,left_of:64,right_of:65,signaltype:66,"+":67,"-":68,ACTOR:69,SOLID_OPEN_ARROW:70,DOTTED_OPEN_ARROW:71,SOLID_ARROW:72,DOTTED_ARROW:73,SOLID_CROSS:74,DOTTED_CROSS:75,SOLID_POINT:76,DOTTED_POINT:77,TXT:78,open_directive:79,type_directive:80,arg_directive:81,close_directive:82,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",7:"SD",14:":",16:"participant",18:"AS",19:"restOfLine",20:"participant_actor",22:"autonumber",23:"NUM",24:"off",25:"activate",26:"deactivate",32:"title",33:"legacy_title",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",39:"loop",40:"end",41:"rect",42:"opt",43:"alt",45:"par",47:"critical",49:"break",50:"option",51:"and",52:"else",53:"note",56:"over",58:"links",59:"link",60:"properties",61:"details",63:",",64:"left_of",65:"right_of",67:"+",68:"-",69:"ACTOR",70:"SOLID_OPEN_ARROW",71:"DOTTED_OPEN_ARROW",72:"SOLID_ARROW",73:"DOTTED_ARROW",74:"SOLID_CROSS",75:"DOTTED_CROSS",76:"SOLID_POINT",77:"DOTTED_POINT",78:"TXT",79:"open_directive",80:"type_directive",81:"arg_directive",82:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[6,4],[6,6],[10,5],[10,3],[10,5],[10,3],[10,2],[10,4],[10,3],[10,3],[10,2],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,2],[10,2],[10,1],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[48,1],[48,4],[46,1],[46,4],[44,1],[44,4],[27,4],[27,4],[28,3],[29,3],[30,3],[31,3],[62,2],[62,1],[57,3],[57,1],[54,1],[54,1],[21,5],[21,5],[21,4],[17,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[55,1],[11,1],[12,1],[15,1],[13,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:return r.apply(a[s]),a[s];case 5:case 9:this.$=[];break;case 6:a[s-1].push(a[s]),this.$=a[s-1];break;case 7:case 8:case 56:this.$=a[s];break;case 12:a[s-3].type="addParticipant",a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 13:a[s-1].type="addParticipant",this.$=a[s-1];break;case 14:a[s-3].type="addActor",a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 15:a[s-1].type="addActor",this.$=a[s-1];break;case 17:this.$={type:"sequenceIndex",sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 18:this.$={type:"sequenceIndex",sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 19:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"activeStart",signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1]};break;case 22:this.$={type:"activeEnd",signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1]};break;case 28:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 29:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 30:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 31:case 32:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 33:a[s-1].unshift({type:"loopStart",loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:"loopEnd",loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 34:a[s-1].unshift({type:"rectStart",color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:"rectEnd",color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 35:a[s-1].unshift({type:"optStart",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:"optEnd",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:"altStart",altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:"altEnd",signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:"parStart",parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:"parEnd",signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:"criticalStart",criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:"criticalEnd",signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:"breakStart",breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:"breakEnd",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 42:this.$=a[s-3].concat([{type:"option",optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 44:this.$=a[s-3].concat([{type:"and",parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 46:this.$=a[s-3].concat([{type:"else",altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 47:this.$=[a[s-1],{type:"addNote",placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 48:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:"addNote",placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 49:this.$=[a[s-1],{type:"addLinks",actor:a[s-1].actor,text:a[s]}];break;case 50:this.$=[a[s-1],{type:"addALink",actor:a[s-1].actor,text:a[s]}];break;case 51:this.$=[a[s-1],{type:"addProperties",actor:a[s-1].actor,text:a[s]}];break;case 52:this.$=[a[s-1],{type:"addDetails",actor:a[s-1].actor,text:a[s]}];break;case 55:this.$=[a[s-2],a[s]];break;case 57:this.$=r.PLACEMENT.LEFTOF;break;case 58:this.$=r.PLACEMENT.RIGHTOF;break;case 59:this.$=[a[s-4],a[s-1],{type:"addMessage",from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:"activeStart",signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1]}];break;case 60:this.$=[a[s-4],a[s-1],{type:"addMessage",from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:"activeEnd",signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4]}];break;case 61:this.$=[a[s-3],a[s-1],{type:"addMessage",from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 62:this.$={type:"addParticipant",actor:a[s]};break;case 63:this.$=r.LINETYPE.SOLID_OPEN;break;case 64:this.$=r.LINETYPE.DOTTED_OPEN;break;case 65:this.$=r.LINETYPE.SOLID;break;case 66:this.$=r.LINETYPE.DOTTED;break;case 67:this.$=r.LINETYPE.SOLID_CROSS;break;case 68:this.$=r.LINETYPE.DOTTED_CROSS;break;case 69:this.$=r.LINETYPE.SOLID_POINT;break;case 70:this.$=r.LINETYPE.DOTTED_POINT;break;case 71:this.$=r.parseMessage(a[s].trim().substring(1));break;case 72:r.parseDirective("%%{","open_directive");break;case 73:r.parseDirective(a[s],"type_directive");break;case 74:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 75:r.parseDirective("}%%","close_directive","sequence");}},table:[{3:1,4:e,5:n,6:4,7:r,11:6,79:i},{1:[3]},{3:8,4:e,5:n,6:4,7:r,11:6,79:i},{3:9,4:e,5:n,6:4,7:r,11:6,79:i},{3:10,4:e,5:n,6:4,7:r,11:6,79:i},t([1,4,5,16,20,22,25,26,32,33,34,36,38,39,41,42,43,45,47,49,53,58,59,60,61,69,79],a,{8:11}),{12:12,80:[1,13]},{80:[2,72]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{13:49,14:[1,50],82:O},t([14,82],[2,73]),t(D,[2,6]),{6:41,10:52,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},t(D,[2,8]),t(D,[2,9]),{17:53,69:N},{17:54,69:N},{5:[1,55]},{5:[1,58],23:[1,56],24:[1,57]},{17:59,69:N},{17:60,69:N},{5:[1,61]},{5:[1,62]},{5:[1,63]},{5:[1,64]},{5:[1,65]},t(D,[2,28]),t(D,[2,29]),{35:[1,66]},{37:[1,67]},t(D,[2,32]),{19:[1,68]},{19:[1,69]},{19:[1,70]},{19:[1,71]},{19:[1,72]},{19:[1,73]},{19:[1,74]},t(D,[2,40]),{66:75,70:[1,76],71:[1,77],72:[1,78],73:[1,79],74:[1,80],75:[1,81],76:[1,82],77:[1,83]},{54:84,56:[1,85],64:[1,86],65:[1,87]},{17:88,69:N},{17:89,69:N},{17:90,69:N},{17:91,69:N},t([5,18,63,70,71,72,73,74,75,76,77,78],[2,62]),{5:[1,92]},{15:93,81:[1,94]},{5:[2,75]},t(D,[2,7]),{5:[1,96],18:[1,95]},{5:[1,98],18:[1,97]},t(D,[2,16]),{5:[1,100],23:[1,99]},{5:[1,101]},t(D,[2,20]),{5:[1,102]},{5:[1,103]},t(D,[2,23]),t(D,[2,24]),t(D,[2,25]),t(D,[2,26]),t(D,[2,27]),t(D,[2,30]),t(D,[2,31]),t(B,a,{8:104}),t(B,a,{8:105}),t(B,a,{8:106}),t(L,a,{44:107,8:108}),t(I,a,{46:109,8:110}),t(F,a,{48:111,8:112}),t(B,a,{8:113}),{17:116,67:[1,114],68:[1,115],69:N},t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{17:117,69:N},{17:119,57:118,69:N},{69:[2,57]},{69:[2,58]},{55:120,78:P},{55:122,78:P},{55:123,78:P},{55:124,78:P},t(j,[2,10]),{13:125,82:O},{82:[2,74]},{19:[1,126]},t(D,[2,13]),{19:[1,127]},t(D,[2,15]),{5:[1,128]},t(D,[2,18]),t(D,[2,19]),t(D,[2,21]),t(D,[2,22]),{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,129],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,130],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,131],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,132]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,45],41:v,42:_,43:x,45:k,47:w,49:T,52:[1,133],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,134]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,43],41:v,42:_,43:x,45:k,47:w,49:T,51:[1,135],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,136]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,41],41:v,42:_,43:x,45:k,47:w,49:T,50:[1,137],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,138],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{17:139,69:N},{17:140,69:N},{55:141,78:P},{55:142,78:P},{55:143,78:P},{63:[1,144],78:[2,56]},{5:[2,49]},{5:[2,71]},{5:[2,50]},{5:[2,51]},{5:[2,52]},{5:[1,145]},{5:[1,146]},{5:[1,147]},t(D,[2,17]),t(D,[2,33]),t(D,[2,34]),t(D,[2,35]),t(D,[2,36]),{19:[1,148]},t(D,[2,37]),{19:[1,149]},t(D,[2,38]),{19:[1,150]},t(D,[2,39]),{55:151,78:P},{55:152,78:P},{5:[2,61]},{5:[2,47]},{5:[2,48]},{17:153,69:N},t(j,[2,11]),t(D,[2,12]),t(D,[2,14]),t(L,a,{8:108,44:154}),t(I,a,{8:110,46:155}),t(F,a,{8:112,48:156}),{5:[2,59]},{5:[2,60]},{78:[2,55]},{40:[2,46]},{40:[2,44]},{40:[2,42]}],defaultActions:{7:[2,72],8:[2,1],9:[2,2],10:[2,3],51:[2,75],86:[2,57],87:[2,58],94:[2,74],120:[2,49],121:[2,71],122:[2,50],123:[2,51],124:[2,52],141:[2,61],142:[2,47],143:[2,48],151:[2,59],152:[2,60],153:[2,55],154:[2,46],155:[2,44],156:[2,42]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},Y={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),79;case 1:return this.begin("type_directive"),80;case 2:return this.popState(),this.begin("arg_directive"),14;case 3:return this.popState(),this.popState(),82;case 4:return 81;case 5:case 52:case 65:return 5;case 6:case 7:case 8:case 9:case 10:break;case 11:return 23;case 12:return this.begin("ID"),16;case 13:return this.begin("ID"),20;case 14:return e.yytext=e.yytext.trim(),this.begin("ALIAS"),69;case 15:return this.popState(),this.popState(),this.begin("LINE"),18;case 16:return this.popState(),this.popState(),5;case 17:return this.begin("LINE"),39;case 18:return this.begin("LINE"),41;case 19:return this.begin("LINE"),42;case 20:return this.begin("LINE"),43;case 21:return this.begin("LINE"),52;case 22:return this.begin("LINE"),45;case 23:return this.begin("LINE"),51;case 24:return this.begin("LINE"),47;case 25:return this.begin("LINE"),50;case 26:return this.begin("LINE"),49;case 27:return this.popState(),19;case 28:return 40;case 29:return 64;case 30:return 65;case 31:return 58;case 32:return 59;case 33:return 60;case 34:return 61;case 35:return 56;case 36:return 53;case 37:return this.begin("ID"),25;case 38:return this.begin("ID"),26;case 39:return 32;case 40:return 33;case 41:return this.begin("acc_title"),34;case 42:return this.popState(),"acc_title_value";case 43:return this.begin("acc_descr"),36;case 44:return this.popState(),"acc_descr_value";case 45:this.begin("acc_descr_multiline");break;case 46:this.popState();break;case 47:return "acc_descr_multiline_value";case 48:return 7;case 49:return 22;case 50:return 24;case 51:return 63;case 53:return e.yytext=e.yytext.trim(),69;case 54:return 72;case 55:return 73;case 56:return 70;case 57:return 71;case 58:return 74;case 59:return 75;case 60:return 76;case 61:return 77;case 62:return 78;case 63:return 67;case 64:return 68;case 66:return "INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:[^\->:\n,;]+?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]+)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[46,47],inclusive:!1},acc_descr:{rules:[44],inclusive:!1},acc_title:{rules:[42],inclusive:!1},open_directive:{rules:[1,8],inclusive:!1},type_directive:{rules:[2,3,8],inclusive:!1},arg_directive:{rules:[3,4,8],inclusive:!1},ID:{rules:[7,8,14],inclusive:!1},ALIAS:{rules:[7,8,15,16],inclusive:!1},LINE:{rules:[7,8,27],inclusive:!1},INITIAL:{rules:[0,5,6,8,9,10,11,12,13,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,45,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66],inclusive:!0}}};function U(){this.yy={};}return z.lexer=Y,U.prototype=z,z.Parser=U,new U}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(1993).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},3584:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,3],r=[1,5],i=[1,7],a=[2,5],o=[1,15],s=[1,17],c=[1,19],l=[1,20],u=[1,21],h=[1,22],f=[1,33],d=[1,23],p=[1,24],g=[1,25],y=[1,26],m=[1,27],b=[1,30],v=[1,31],_=[1,32],x=[1,35],k=[1,36],w=[1,37],T=[1,38],E=[1,34],C=[1,41],S=[1,4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],A=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],M=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],N=[4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],O={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,directive:6,SD:7,document:8,line:9,statement:10,idStatement:11,DESCR:12,"--\x3e":13,HIDE_EMPTY:14,scale:15,WIDTH:16,COMPOSIT_STATE:17,STRUCT_START:18,STRUCT_STOP:19,STATE_DESCR:20,AS:21,ID:22,FORK:23,JOIN:24,CHOICE:25,CONCURRENT:26,note:27,notePosition:28,NOTE_TEXT:29,direction:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,openDirective:36,typeDirective:37,closeDirective:38,":":39,argDirective:40,direction_tb:41,direction_bt:42,direction_rl:43,direction_lr:44,eol:45,";":46,EDGE_STATE:47,left_of:48,right_of:49,open_directive:50,type_directive:51,arg_directive:52,close_directive:53,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",7:"SD",12:"DESCR",13:"--\x3e",14:"HIDE_EMPTY",15:"scale",16:"WIDTH",17:"COMPOSIT_STATE",18:"STRUCT_START",19:"STRUCT_STOP",20:"STATE_DESCR",21:"AS",22:"ID",23:"FORK",24:"JOIN",25:"CHOICE",26:"CONCURRENT",27:"note",29:"NOTE_TEXT",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",39:":",41:"direction_tb",42:"direction_bt",43:"direction_rl",44:"direction_lr",46:";",47:"EDGE_STATE",48:"left_of",49:"right_of",50:"open_directive",51:"type_directive",52:"arg_directive",53:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[10,1],[10,2],[10,2],[10,1],[6,3],[6,5],[30,1],[30,1],[30,1],[30,1],[45,1],[45,1],[11,1],[11,1],[28,1],[28,1],[36,1],[37,1],[40,1],[38,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:return r.setRootDoc(a[s]),a[s];case 5:this.$=[];break;case 6:"nl"!=a[s]&&(a[s-1].push(a[s]),this.$=a[s-1]);break;case 7:case 8:case 39:case 40:this.$=a[s];break;case 9:this.$="nl";break;case 10:this.$={stmt:"state",id:a[s],type:"default",description:""};break;case 11:this.$={stmt:"state",id:a[s-1],type:"default",description:r.trimColon(a[s])};break;case 12:this.$={stmt:"relation",state1:{stmt:"state",id:a[s-2],type:"default",description:""},state2:{stmt:"state",id:a[s],type:"default",description:""}};break;case 13:this.$={stmt:"relation",state1:{stmt:"state",id:a[s-3],type:"default",description:""},state2:{stmt:"state",id:a[s-1],type:"default",description:""},description:a[s].substr(1).trim()};break;case 17:this.$={stmt:"state",id:a[s-3],type:"default",description:"",doc:a[s-1]};break;case 18:var c=a[s],l=a[s-2].trim();if(a[s].match(":")){var u=a[s].split(":");c=u[0],l=[l,u[1]];}this.$={stmt:"state",id:c,type:"default",description:l};break;case 19:this.$={stmt:"state",id:a[s-3],type:"default",description:a[s-5],doc:a[s-1]};break;case 20:this.$={stmt:"state",id:a[s],type:"fork"};break;case 21:this.$={stmt:"state",id:a[s],type:"join"};break;case 22:this.$={stmt:"state",id:a[s],type:"choice"};break;case 23:this.$={stmt:"state",id:r.getDividerId(),type:"divider"};break;case 24:this.$={stmt:"state",id:a[s-1].trim(),note:{position:a[s-2].trim(),text:a[s].trim()}};break;case 28:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 29:case 30:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 33:r.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 34:r.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 35:r.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 36:r.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 43:r.parseDirective("%%{","open_directive");break;case 44:r.parseDirective(a[s],"type_directive");break;case 45:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 46:r.parseDirective("}%%","close_directive","state");}},table:[{3:1,4:e,5:n,6:4,7:r,36:6,50:i},{1:[3]},{3:8,4:e,5:n,6:4,7:r,36:6,50:i},{3:9,4:e,5:n,6:4,7:r,36:6,50:i},{3:10,4:e,5:n,6:4,7:r,36:6,50:i},t([1,4,5,14,15,17,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],a,{8:11}),{37:12,51:[1,13]},{51:[2,43]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},{38:39,39:[1,40],53:C},t([39,53],[2,44]),t(S,[2,6]),{6:28,10:42,11:18,14:c,15:l,17:u,20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,8]),t(S,[2,9]),t(S,[2,10],{12:[1,43],13:[1,44]}),t(S,[2,14]),{16:[1,45]},t(S,[2,16],{18:[1,46]}),{21:[1,47]},t(S,[2,20]),t(S,[2,21]),t(S,[2,22]),t(S,[2,23]),{28:48,29:[1,49],48:[1,50],49:[1,51]},t(S,[2,26]),t(S,[2,27]),{32:[1,52]},{34:[1,53]},t(S,[2,30]),t(A,[2,39]),t(A,[2,40]),t(S,[2,33]),t(S,[2,34]),t(S,[2,35]),t(S,[2,36]),t(M,[2,31]),{40:54,52:[1,55]},t(M,[2,46]),t(S,[2,7]),t(S,[2,11]),{11:56,22:f,47:E},t(S,[2,15]),t(N,a,{8:57}),{22:[1,58]},{22:[1,59]},{21:[1,60]},{22:[2,41]},{22:[2,42]},t(S,[2,28]),t(S,[2,29]),{38:61,53:C},{53:[2,45]},t(S,[2,12],{12:[1,62]}),{4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,19:[1,63],20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,18],{18:[1,64]}),{29:[1,65]},{22:[1,66]},t(M,[2,32]),t(S,[2,13]),t(S,[2,17]),t(N,a,{8:67}),t(S,[2,24]),t(S,[2,25]),{4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,19:[1,68],20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,19])],defaultActions:{7:[2,43],8:[2,1],9:[2,2],10:[2,3],50:[2,41],51:[2,42],55:[2,45]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},D={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:case 33:return 41;case 1:case 34:return 42;case 2:case 35:return 43;case 3:case 36:return 44;case 4:return this.begin("open_directive"),50;case 5:return this.begin("type_directive"),51;case 6:return this.popState(),this.begin("arg_directive"),39;case 7:return this.popState(),this.popState(),53;case 8:return 52;case 9:case 10:case 12:case 13:case 14:case 15:case 46:case 52:break;case 11:case 66:return 5;case 16:return this.pushState("SCALE"),15;case 17:return 16;case 18:case 24:case 40:case 43:this.popState();break;case 19:return this.begin("acc_title"),31;case 20:return this.popState(),"acc_title_value";case 21:return this.begin("acc_descr"),33;case 22:return this.popState(),"acc_descr_value";case 23:this.begin("acc_descr_multiline");break;case 25:return "acc_descr_multiline_value";case 26:this.pushState("STATE");break;case 27:case 30:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),23;case 28:case 31:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),24;case 29:case 32:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),25;case 37:this.begin("STATE_STRING");break;case 38:return this.popState(),this.pushState("STATE_ID"),"AS";case 39:case 54:return this.popState(),"ID";case 41:return "STATE_DESCR";case 42:return 17;case 44:return this.popState(),this.pushState("struct"),18;case 45:return this.popState(),19;case 47:return this.begin("NOTE"),27;case 48:return this.popState(),this.pushState("NOTE_ID"),48;case 49:return this.popState(),this.pushState("NOTE_ID"),49;case 50:this.popState(),this.pushState("FLOATING_NOTE");break;case 51:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 53:return "NOTE_TEXT";case 55:return this.popState(),this.pushState("NOTE_TEXT"),22;case 56:return this.popState(),e.yytext=e.yytext.substr(2).trim(),29;case 57:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),29;case 58:case 59:return 7;case 60:return 14;case 61:return 47;case 62:return 22;case 63:return e.yytext=e.yytext.trim(),12;case 64:return 13;case 65:return 26;case 67:return "INVALID"}},rules:[/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[13,14],inclusive:!1},close_directive:{rules:[13,14],inclusive:!1},arg_directive:{rules:[7,8,13,14],inclusive:!1},type_directive:{rules:[6,7,13,14],inclusive:!1},open_directive:{rules:[5,13,14],inclusive:!1},struct:{rules:[13,14,26,33,34,35,36,45,46,47,61,62,63,64,65],inclusive:!1},FLOATING_NOTE_ID:{rules:[54],inclusive:!1},FLOATING_NOTE:{rules:[51,52,53],inclusive:!1},NOTE_TEXT:{rules:[56,57],inclusive:!1},NOTE_ID:{rules:[55],inclusive:!1},NOTE:{rules:[48,49,50],inclusive:!1},acc_descr_multiline:{rules:[24,25],inclusive:!1},acc_descr:{rules:[22],inclusive:!1},acc_title:{rules:[20],inclusive:!1},SCALE:{rules:[17,18],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[39],inclusive:!1},STATE_STRING:{rules:[40,41],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[13,14,27,28,29,30,31,32,37,38,42,43,44],inclusive:!1},ID:{rules:[13,14],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,12,14,15,16,19,21,23,26,44,47,58,59,60,61,62,63,64,66,67],inclusive:!0}}};function B(){this.yy={};}return O.lexer=D,B.prototype=O,O.Parser=B,new B}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(3069).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},9763:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,5],r=[6,9,11,17,18,20,22,23,24,26],i=[1,15],a=[1,16],o=[1,17],s=[1,18],c=[1,19],l=[1,20],u=[1,24],h=[4,6,9,11,17,18,20,22,23,24,26],f={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,title:17,acc_title:18,acc_title_value:19,acc_descr:20,acc_descr_value:21,acc_descr_multiline_value:22,section:23,taskName:24,taskData:25,open_directive:26,type_directive:27,arg_directive:28,close_directive:29,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"acc_title",19:"acc_title_value",20:"acc_descr",21:"acc_descr_value",22:"acc_descr_multiline_value",23:"section",24:"taskName",25:"taskData",26:"open_directive",27:"type_directive",28:"arg_directive",29:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:this.$=a[s];break;case 11:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 12:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 13:case 14:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 15:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 16:r.addTask(a[s-1],a[s]),this.$="task";break;case 18:r.parseDirective("%%{","open_directive");break;case 19:r.parseDirective(a[s],"type_directive");break;case 20:a[s]=a[s].trim().replace(/'/g,'"'),r.parseDirective(a[s],"arg_directive");break;case 21:r.parseDirective("}%%","close_directive","journey");}},table:[{3:1,4:e,7:3,12:4,26:n},{1:[3]},t(r,[2,3],{5:6}),{3:7,4:e,7:3,12:4,26:n},{13:8,27:[1,9]},{27:[2,18]},{6:[1,10],7:21,8:11,9:[1,12],10:13,11:[1,14],12:4,17:i,18:a,20:o,22:s,23:c,24:l,26:n},{1:[2,2]},{14:22,15:[1,23],29:u},t([15,29],[2,19]),t(r,[2,8],{1:[2,1]}),t(r,[2,4]),{7:21,10:25,12:4,17:i,18:a,20:o,22:s,23:c,24:l,26:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,11]),{19:[1,26]},{21:[1,27]},t(r,[2,14]),t(r,[2,15]),{25:[1,28]},t(r,[2,17]),{11:[1,29]},{16:30,28:[1,31]},{11:[2,21]},t(r,[2,5]),t(r,[2,12]),t(r,[2,13]),t(r,[2,16]),t(h,[2,9]),{14:32,29:u},{29:[2,20]},{11:[1,33]},t(h,[2,10])],defaultActions:{5:[2,18],7:[2,2],24:[2,21],31:[2,20]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return "number"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N="";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push("'"+this.terminals_[E]+"'");N=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(_==f?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A});}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return !0}}return !0}},d={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return !1}return !1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return !1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),26;case 1:return this.begin("type_directive"),27;case 2:return this.popState(),this.begin("arg_directive"),15;case 3:return this.popState(),this.popState(),29;case 4:return 28;case 5:case 6:case 8:case 9:break;case 7:return 11;case 10:return 4;case 11:return 17;case 12:return this.begin("acc_title"),18;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),20;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:this.popState();break;case 18:return "acc_descr_multiline_value";case 19:return 23;case 20:return 24;case 21:return 25;case 22:return 15;case 23:return 6;case 24:return "INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],inclusive:!0}}};function p(){this.yy={};}return f.lexer=d,p.prototype=f,f.Parser=p,new p}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var r=n(9143).readFileSync(n(6470).normalize(t[1]),"utf8");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1));},7967:(t,e)=>{e.N=void 0;var n=/^([^\w]*)(javascript|data|vbscript)/im,r=/&#(\w+)(^\w|;)?/g,i=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,a=/^([^:]+):/gm,o=[".","/"];e.N=function(t){var e,s=(e=t||"",e.replace(r,(function(t,e){return String.fromCharCode(e)}))).replace(i,"").trim();if(!s)return "about:blank";if(function(t){return o.indexOf(t[0])>-1}(s))return s;var c=s.match(a);if(!c)return s;var l=c[0];return n.test(l)?"about:blank":s};},3841:t=>{t.exports=function(t,e){return t.intersect(e)};},6187:(t,e,n)=>{n.d(e,{Z:()=>fu});var r=n(1941),i=n.n(r),a={debug:1,info:2,warn:3,error:4,fatal:5},o={debug:function(){},info:function(){},warn:function(){},error:function(){},fatal:function(){}},s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"fatal";isNaN(t)&&(t=t.toLowerCase(),void 0!==a[t]&&(t=a[t])),o.trace=function(){},o.debug=function(){},o.info=function(){},o.warn=function(){},o.error=function(){},o.fatal=function(){},t<=a.fatal&&(o.fatal=console.error?console.error.bind(console,c("FATAL"),"color: orange"):console.log.bind(console,"",c("FATAL"))),t<=a.error&&(o.error=console.error?console.error.bind(console,c("ERROR"),"color: orange"):console.log.bind(console,"",c("ERROR"))),t<=a.warn&&(o.warn=console.warn?console.warn.bind(console,c("WARN"),"color: orange"):console.log.bind(console,"",c("WARN"))),t<=a.info&&(o.info=console.info?console.info.bind(console,c("INFO"),"color: lightblue"):console.log.bind(console,"",c("INFO"))),t<=a.debug&&(o.debug=console.debug?console.debug.bind(console,c("DEBUG"),"color: lightgreen"):console.log.bind(console,"",c("DEBUG")));},c=function(t){var e=i()().format("ss.SSS");return "%c".concat(e," : ").concat(t," : ")},l=n(7543),u="comm",h="rule",f="decl",d=Math.abs,p=String.fromCharCode;function g(t){return t.trim()}function y(t,e,n){return t.replace(e,n)}function m(t,e){return t.indexOf(e)}function b(t,e){return 0|t.charCodeAt(e)}function v(t,e,n){return t.slice(e,n)}function _(t){return t.length}function x(t){return t.length}function k(t,e){return e.push(t),t}function w(t,e){for(var n="",r=x(t),i=0;i0?b(N,--A):0,C--,10===M&&(C=1,E--),M}function B(){return M=A2||R(M)>3?"":" "}function z(t,e){for(;--e&&B()&&!(M<48||M>102||M>57&&M<65||M>70&&M<97););return F(t,I()+(e<6&&32==L()&&32==B()))}function Y(t){for(;B();)switch(M){case t:return A;case 34:case 39:34!==t&&39!==t&&Y(M);break;case 40:41===t&&Y(t);break;case 92:B();}return A}function U(t,e){for(;B()&&t+M!==57&&(t+M!==84||47!==L()););return "/*"+F(e,A-1)+"*"+p(47===t?t:B())}function $(t){for(;!R(L());)B();return F(t,A)}function W(t){return function(t){return N="",t}(q("",null,null,null,[""],t=function(t){return E=C=1,S=_(N=t),A=0,[]}(t),0,[0],t))}function q(t,e,n,r,i,a,o,s,c){for(var l=0,u=0,h=o,f=0,d=0,g=0,b=1,v=1,x=1,w=0,T="",E=i,C=a,S=r,A=T;v;)switch(g=w,w=B()){case 40:if(108!=g&&58==A.charCodeAt(h-1)){-1!=m(A+=y(P(w),"&","&\f"),"&\f")&&(x=-1);break}case 34:case 39:case 91:A+=P(w);break;case 9:case 10:case 13:case 32:A+=j(g);break;case 92:A+=z(I()-1,7);continue;case 47:switch(L()){case 42:case 47:k(V(U(B(),I()),e,n),c);break;default:A+="/";}break;case 123*b:s[l++]=_(A)*x;case 125*b:case 59:case 0:switch(w){case 0:case 125:v=0;case 59+u:d>0&&_(A)-h&&k(d>32?G(A+";",r,n,h-1):G(y(A," ","")+";",r,n,h-2),c);break;case 59:A+=";";default:if(k(S=H(A,e,n,l,u,i,s,T,E=[],C=[],h),a),123===w)if(0===u)q(A,e,S,S,E,a,h,s,C);else switch(f){case 100:case 109:case 115:q(t,S,S,r&&k(H(t,S,S,0,0,i,s,T,i,E=[],h),C),i,C,h,s,r?E:C);break;default:q(A,S,S,S,[""],C,0,s,C);}}l=u=d=0,b=x=1,T=A="",h=o;break;case 58:h=1+_(A),d=g;default:if(b<1)if(123==w)--b;else if(125==w&&0==b++&&125==D())continue;switch(A+=p(w),w*b){case 38:x=u>0?1:(A+="\f",-1);break;case 44:s[l++]=(_(A)-1)*x,x=1;break;case 64:45===L()&&(A+=P(B())),f=L(),u=h=_(T=A+=$(I())),w++;break;case 45:45===g&&2==_(A)&&(b=0);}}return a}function H(t,e,n,r,i,a,o,s,c,l,u){for(var f=i-1,p=0===i?a:[""],m=x(p),b=0,_=0,k=0;b0?p[w]+" "+T:y(T,/&\f/g,p[w])))&&(c[k++]=E);return O(t,e,n,0===i?h:s,c,l,u)}function V(t,e,n){return O(t,e,n,u,p(M),v(t,2,-2),0)}function G(t,e,n,r){return O(t,e,n,f,v(t,0,r),v(t,r+1,-1),r)}const X="9.1.7";function Z(t){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(t)}const Q=function t(e,n,r){var i=Object.assign({depth:2,clobber:!1},r),a=i.depth,o=i.clobber;return Array.isArray(n)&&!Array.isArray(e)?(n.forEach((function(n){return t(e,n,r)})),e):Array.isArray(n)&&Array.isArray(e)?(n.forEach((function(t){-1===e.indexOf(t)&&e.push(t);})),e):void 0===e||a<=0?null!=e&&"object"===Z(e)&&"object"===Z(n)?Object.assign(e,n):n:(void 0!==n&&"object"===Z(e)&&"object"===Z(n)&&Object.keys(n).forEach((function(r){"object"!==Z(n[r])||void 0!==e[r]&&"object"!==Z(e[r])?(o||"object"!==Z(e[r])&&"object"!==Z(n[r]))&&(e[r]=n[r]):(void 0===e[r]&&(e[r]=Array.isArray(n[r])?[]:{}),e[r]=t(e[r],n[r],{depth:a-1,clobber:o}));})),e)},K={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},r)=>{if(!e)return 2.55*n;t/=360,e/=100;const i=(n/=100)<.5?n*(1+e):n+e-n*e,a=2*n-i;switch(r){case"r":return 255*K.hue2rgb(a,i,t+1/3);case"g":return 255*K.hue2rgb(a,i,t);case"b":return 255*K.hue2rgb(a,i,t-1/3)}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),a=Math.min(t,e,n),o=(i+a)/2;if("l"===r)return 100*o;if(i===a)return 0;const s=i-a;if("s"===r)return 100*(o>.5?s/(2-i-a):s/(i+a));switch(i){case t:return 60*((e-n)/s+(ee>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(1e10*t)/1e10},unit:{dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}}},tt={};for(let t=0;t<=255;t++)tt[t]=J.unit.dec2hex(t);const et=new class{constructor(t,e){this.color=e,this.changed=!1,this.data=t,this.type=new class{constructor(){this.type=0;}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t;}reset(){this.type=0;}is(t){return this.type===t}};}set(t,e){return this.color=e,this.changed=!1,this.data=t,this.type.type=0,this}_ensureHSL(){const t=this.data,{h:e,s:n,l:r}=t;void 0===e&&(t.h=J.channel.rgb2hsl(t,"h")),void 0===n&&(t.s=J.channel.rgb2hsl(t,"s")),void 0===r&&(t.l=J.channel.rgb2hsl(t,"l"));}_ensureRGB(){const t=this.data,{r:e,g:n,b:r}=t;void 0===e&&(t.r=J.channel.hsl2rgb(t,"r")),void 0===n&&(t.g=J.channel.hsl2rgb(t,"g")),void 0===r&&(t.b=J.channel.hsl2rgb(t,"b"));}get r(){const t=this.data,e=t.r;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,"r")):e}get g(){const t=this.data,e=t.g;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,"g")):e}get b(){const t=this.data,e=t.b;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,"b")):e}get h(){const t=this.data,e=t.h;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,"h")):e}get s(){const t=this.data,e=t.s;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,"s")):e}get l(){const t=this.data,e=t.l;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,"l")):e}get a(){return this.data.a}set r(t){this.type.set(1),this.changed=!0,this.data.r=t;}set g(t){this.type.set(1),this.changed=!0,this.data.g=t;}set b(t){this.type.set(1),this.changed=!0,this.data.b=t;}set h(t){this.type.set(2),this.changed=!0,this.data.h=t;}set s(t){this.type.set(2),this.changed=!0,this.data.s=t;}set l(t){this.type.set(2),this.changed=!0,this.data.l=t;}set a(t){this.changed=!0,this.data.a=t;}}({r:0,g:0,b:0,a:0},"transparent"),nt={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(35!==t.charCodeAt(0))return;const e=t.match(nt.re);if(!e)return;const n=e[1],r=parseInt(n,16),i=n.length,a=i%4==0,o=i>4,s=o?1:17,c=o?8:4,l=a?0:-1,u=o?255:15;return et.set({r:(r>>c*(l+3)&u)*s,g:(r>>c*(l+2)&u)*s,b:(r>>c*(l+1)&u)*s,a:a?(r&u)*s/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${tt[Math.round(e)]}${tt[Math.round(n)]}${tt[Math.round(r)]}${tt[Math.round(255*i)]}`:`#${tt[Math.round(e)]}${tt[Math.round(n)]}${tt[Math.round(r)]}`}},rt=nt,it={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(it.hueRe);if(e){const[,t,n]=e;switch(n){case"grad":return J.channel.clamp.h(.9*parseFloat(t));case"rad":return J.channel.clamp.h(180*parseFloat(t)/Math.PI);case"turn":return J.channel.clamp.h(360*parseFloat(t))}}return J.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(104!==e&&72!==e)return;const n=t.match(it.re);if(!n)return;const[,r,i,a,o,s]=n;return et.set({h:it._hue2deg(r),s:J.channel.clamp.s(parseFloat(i)),l:J.channel.clamp.l(parseFloat(a)),a:o?J.channel.clamp.a(s?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${J.lang.round(e)}, ${J.lang.round(n)}%, ${J.lang.round(r)}%, ${i})`:`hsl(${J.lang.round(e)}, ${J.lang.round(n)}%, ${J.lang.round(r)}%)`}},at=it,ot={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=ot.colors[t];if(e)return rt.parse(e)},stringify:t=>{const e=rt.stringify(t);for(const t in ot.colors)if(ot.colors[t]===e)return t}},st=ot,ct={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(114!==e&&82!==e)return;const n=t.match(ct.re);if(!n)return;const[,r,i,a,o,s,c,l,u]=n;return et.set({r:J.channel.clamp.r(i?2.55*parseFloat(r):parseFloat(r)),g:J.channel.clamp.g(o?2.55*parseFloat(a):parseFloat(a)),b:J.channel.clamp.b(c?2.55*parseFloat(s):parseFloat(s)),a:l?J.channel.clamp.a(u?parseFloat(l)/100:parseFloat(l)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${J.lang.round(e)}, ${J.lang.round(n)}, ${J.lang.round(r)}, ${J.lang.round(i)})`:`rgb(${J.lang.round(e)}, ${J.lang.round(n)}, ${J.lang.round(r)})`}},lt=ct,ut={format:{keyword:st,hex:rt,rgb:lt,rgba:lt,hsl:at,hsla:at},parse:t=>{if("string"!=typeof t)return t;const e=rt.parse(t)||lt.parse(t)||at.parse(t)||st.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(2)||void 0===t.data.r?at.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?lt.stringify(t):rt.stringify(t)},ht=(t,e)=>{const n=ut.parse(t);for(const t in e)n[t]=J.channel.clamp[t](e[t]);return ut.stringify(n)},ft=(t,e)=>{const n=ut.parse(t),r={};for(const t in e)e[t]&&(r[t]=n[t]+e[t]);return ht(t,r)},dt=(t,e,n=0,r=1)=>{if("number"!=typeof t)return ht(t,{a:e});const i=et.set({r:J.channel.clamp.r(t),g:J.channel.clamp.g(e),b:J.channel.clamp.b(n),a:J.channel.clamp.a(r)});return ut.stringify(i)},pt=(t,e=100)=>{const n=ut.parse(t);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,((t,e,n=50)=>{const{r,g:i,b:a,a:o}=ut.parse(t),{r:s,g:c,b:l,a:u}=ut.parse(e),h=n/100,f=2*h-1,d=o-u,p=((f*d==-1?f:(f+d)/(1+f*d))+1)/2,g=1-p;return dt(r*p+s*g,i*p+c*g,a*p+l*g,o*h+u*(1-h))})(n,t,e)},gt=(t,e,n)=>{const r=ut.parse(t),i=r[e],a=J.channel.clamp[e](i+n);return i!==a&&(r[e]=a),ut.stringify(r)},yt=(t,e)=>gt(t,"l",-e),mt=(t,e)=>gt(t,"l",e);var bt=function(t,e){return ft(t,e?{s:-40,l:10}:{s:-40,l:-10})};function vt(t){return vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vt(t)}function _t(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:"";return Object.keys(e).reduce((function(r,i){return Array.isArray(e[i])?r:"object"===Rt(e[i])&&null!==e[i]?[].concat(It(r),[n+i],It(t(e[i],""))):[].concat(It(r),[n+i])}),[])}(Pt,"");const zt=Pt;function Yt(t){return Yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yt(t)}var Ut,$t=Object.freeze(zt),Wt=Q({},$t),qt=[],Ht=Q({},$t),Vt=function(t,e){for(var n=Q({},t),r={},i=0;i-1||e[n].indexOf(">")>-1||e[n].indexOf("url(data:")>-1)&&delete e[n],"object"===Yt(e[n])&&t(e[n]);}));},Qt=function(t){t.fontFamily&&(t.themeVariables&&t.themeVariables.fontFamily||(t.themeVariables={fontFamily:t.fontFamily})),qt.push(t),Vt(Wt,qt);},Kt=function(){Vt(Wt,qt=[]);},Jt=n(7856),te=n.n(Jt),ee=function(t){var e=t.replace(/\\u[\dA-F]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\u/g,""),16))}));return e=(e=(e=e.replace(/\\x([0-9a-f]{2})/gi,(function(t,e){return String.fromCharCode(parseInt(e,16))}))).replace(/\\[\d\d\d]{3}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\/g,""),8))}))).replace(/\\[\d\d\d]{2}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\/g,""),8))}))},ne=function(t){for(var e="",n=0;n>=0;){if(!((n=t.indexOf("=0)){e+=t,n=-1;break}e+=t.substr(0,n),(n=(t=t.substr(n+1)).indexOf("<\/script>"))>=0&&(n+=9,t=t.substr(n));}var r=ee(e);return (r=(r=(r=(r=r.replace(/script>/gi,"#")).replace(/javascript:/gi,"#")).replace(/javascript&colon/gi,"#")).replace(/onerror=/gi,"onerror:")).replace(/');}else "loose"!==s.securityLevel&&(M=te().sanitize(M,{ADD_TAGS:["foreignobject"],ADD_ATTR:["dominant-baseline"]}));if(void 0!==n)switch(b){case"flowchart":case"flowchart-v2":n(M,la.bindFunctions);break;case"gantt":n(M,go.bindFunctions);break;case"class":case"classDiagram":n(M,fr.bindFunctions);break;default:n(M);}else o.debug("CB = undefined!");vs.forEach((function(t){t();})),vs=[];var D="sandbox"===s.securityLevel?"#i"+t:"#d"+t,B=(0, l.select)(D).node();if(null!==B&&"function"==typeof B.remove&&(0, l.select)(D).node().remove(),u)throw u;return M},parse:function(t,e){ru||(Vl(),ru=!0);var n=!1;try{var r=e||new Ql(t);return r.db.clear(),r.parse(t)}catch(t){if(n=!0,!fu.parseError)throw t;null!=t.str?fu.parseError(t.str,t.hash):fu.parseError(t);}return !n},parseDirective:function(t,e,n,r){try{if(void 0!==e)switch(e=e.trim(),n){case"open_directive":au={};break;case"type_directive":au.type=e.toLowerCase();break;case"arg_directive":au.args=JSON.parse(e);break;case"close_directive":(function(t,e,n){switch(o.debug("Directive type=".concat(e.type," with args:"),e.args),e.type){case"init":case"initialize":["config"].forEach((function(t){void 0!==e.args[t]&&("flowchart-v2"===n&&(n="flowchart"),e.args[n]=e.args[t],delete e.args[t]);})),o.debug("sanitize in handleDirective",e.args),Cn(e.args),o.debug("sanitize in handleDirective (done)",e.args),Qt(e.args);break;case"wrap":case"nowrap":t&&t.setWrap&&t.setWrap("wrap"===e.type);break;case"themeCss":o.warn("themeCss encountered");break;default:o.warn("Unhandled directive: source: '%%{".concat(e.type,": ").concat(JSON.stringify(e.args?e.args:{}),"}%%"),e);}})(t,au,r),au=null;}}catch(t){o.error("Error while rendering sequenceDiagram directive: ".concat(e," jison context: ").concat(n)),o.error(t.message);}},initialize:function(t){var e;null!=t&&t.fontFamily&&(null!==(e=t.themeVariables)&&void 0!==e&&e.fontFamily||(t.themeVariables={fontFamily:t.fontFamily})),function(t){Ut=Q({},t);}(t),null!=t&&t.theme&&Lt[t.theme]?t.themeVariables=Lt[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Lt.default.getThemeVariables(t.themeVariables));var n="object"===nu(t)?function(t){return Wt=Q({},$t),Wt=Q(Wt,t),t.theme&&Lt[t.theme]&&(Wt.themeVariables=Lt[t.theme].getThemeVariables(t.themeVariables)),Ht=Vt(Wt,qt),Wt}(t):Gt();ou(n),s(n.logLevel),ru||(Vl(),ru=!0);},getConfig:Xt,setConfig:function(t){return Q(Ht,t),Xt()},getSiteConfig:Gt,updateSiteConfig:function(t){return Wt=Q(Wt,t),Vt(Wt,qt),Wt},reset:function(){Kt();},globalReset:function(){Kt(),ou(Xt());},defaultConfig:$t});s(Xt().logLevel),Kt(Xt());const cu=su;var lu=function(){var t,e,n=cu.getConfig();arguments.length>=2?(void 0!==arguments[0]&&(hu.sequenceConfig=arguments[0]),t=arguments[1]):t=arguments[0],"function"==typeof arguments[arguments.length-1]?(e=arguments[arguments.length-1],o.debug("Callback function found")):void 0!==n.mermaid&&("function"==typeof n.mermaid.callback?(e=n.mermaid.callback,o.debug("Callback function found")):o.debug("No Callback function found")),t=void 0===t?document.querySelectorAll(".mermaid"):"string"==typeof t?document.querySelectorAll(t):t instanceof window.Node?[t]:t,o.debug("Start On Load before: "+hu.startOnLoad),void 0!==hu.startOnLoad&&(o.debug("Start On Load inner: "+hu.startOnLoad),cu.updateSiteConfig({startOnLoad:hu.startOnLoad})),void 0!==hu.ganttConfig&&cu.updateSiteConfig({gantt:hu.ganttConfig});for(var r,i=new An.initIdGenerator(n.deterministicIds,n.deterministicIDSeed),a=[],s=function(n){o.info("Rendering diagram: "+t[n].id,n);var s=t[n];if(s.getAttribute("data-processed"))return "continue";s.setAttribute("data-processed",!0);var c="mermaid-".concat(i.next());r=s.innerHTML,r=An.entityDecode(r).trim().replace(//gi,"
");var l=An.detectInit(r);l&&o.debug("Detected early reinit: ",l);try{cu.render(c,r,(function(t,n){s.innerHTML=t,void 0!==e&&e(c),n&&n(s);}),s);}catch(t){o.warn("Catching Error (bootstrap)",t),"function"==typeof hu.parseError&&hu.parseError({error:t,str:t.str,hash:t.hash,message:t.str}),a.push({error:t,str:t.str,hash:t.hash,message:t.str});}},c=0;c0)throw a[0]},uu=function(){hu.startOnLoad?cu.getConfig().startOnLoad&&hu.init():void 0===hu.startOnLoad&&(o.debug("In start, no config"),cu.getConfig().startOnLoad&&hu.init());};"undefined"!=typeof document&&window.addEventListener("load",(function(){uu();}),!1);var hu={startOnLoad:!0,htmlLabels:!0,diagrams:{},mermaidAPI:cu,parse:null!=cu?cu.parse:null,render:null!=cu?cu.render:null,init:function(){try{lu.apply(void 0,arguments);}catch(t){o.warn("Syntax Error rendering"),o.warn(t.str);}},initThrowsErrors:lu,initialize:function(t){void 0!==t.mermaid&&(void 0!==t.mermaid.startOnLoad&&(hu.startOnLoad=t.mermaid.startOnLoad),void 0!==t.mermaid.htmlLabels&&(hu.htmlLabels="false"!==t.mermaid.htmlLabels&&!1!==t.mermaid.htmlLabels)),cu.initialize(t);},contentLoaded:uu,setParseErrorHandler:function(t){hu.parseError=t;}};const fu=hu;},4949:(t,e,n)=>{t.exports={graphlib:n(6614),dagre:n(6478),intersect:n(8114),render:n(5787),util:n(8355),version:n(5689)};},9144:(t,e,n)=>{var r=n(8355);function i(t,e,n,i){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");r.applyStyle(a,n[i+"Style"]),n[i+"Class"]&&a.attr("class",n[i+"Class"]);}t.exports={default:i,normal:i,vee:function(t,e,n,i){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");r.applyStyle(a,n[i+"Style"]),n[i+"Class"]&&a.attr("class",n[i+"Class"]);},undirected:function(t,e,n,i){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");r.applyStyle(a,n[i+"Style"]),n[i+"Class"]&&a.attr("class",n[i+"Class"]);}};},5632:(t,e,n)=>{var r=n(8355),i=n(4322),a=n(1322);t.exports=function(t,e){var n,o=e.nodes().filter((function(t){return r.isSubgraph(e,t)})),s=t.selectAll("g.cluster").data(o,(function(t){return t}));return s.selectAll("*").remove(),s.enter().append("g").attr("class","cluster").attr("id",(function(t){return e.node(t).id})).style("opacity",0),s=t.selectAll("g.cluster"),r.applyTransition(s,e).style("opacity",1),s.each((function(t){var n=e.node(t),r=i.select(this);i.select(this).append("rect");var o=r.append("g").attr("class","label");a(o,n,n.clusterLabelPos);})),s.selectAll("rect").each((function(t){var n=e.node(t),a=i.select(this);r.applyStyle(a,n.style);})),n=s.exit?s.exit():s.selectAll(null),r.applyTransition(n,e).style("opacity",0).remove(),s};},6315:(t,e,n)=>{var r=n(1034),i=n(1322),a=n(8355),o=n(4322);t.exports=function(t,e){var n,s=t.selectAll("g.edgeLabel").data(e.edges(),(function(t){return a.edgeToId(t)})).classed("update",!0);return s.exit().remove(),s.enter().append("g").classed("edgeLabel",!0).style("opacity",0),(s=t.selectAll("g.edgeLabel")).each((function(t){var n=o.select(this);n.select(".label").remove();var a=e.edge(t),s=i(n,e.edge(t),0,0).classed("label",!0),c=s.node().getBBox();a.labelId&&s.attr("id",a.labelId),r.has(a,"width")||(a.width=c.width),r.has(a,"height")||(a.height=c.height);})),n=s.exit?s.exit():s.selectAll(null),a.applyTransition(n,e).style("opacity",0).remove(),s};},940:(t,e,n)=>{var r=n(1034),i=n(3042),a=n(8355),o=n(4322);function s(t,e){var n=(o.line||o.svg.line)().x((function(t){return t.x})).y((function(t){return t.y}));return (n.curve||n.interpolate)(t.curve),n(e)}t.exports=function(t,e,n){var c=t.selectAll("g.edgePath").data(e.edges(),(function(t){return a.edgeToId(t)})).classed("update",!0),l=function(t,e){var n=t.enter().append("g").attr("class","edgePath").style("opacity",0);return n.append("path").attr("class","path").attr("d",(function(t){var n=e.edge(t),i=e.node(t.v).elem;return s(n,r.range(n.points.length).map((function(){return e=(t=i).getBBox(),{x:(n=t.ownerSVGElement.getScreenCTM().inverse().multiply(t.getScreenCTM()).translate(e.width/2,e.height/2)).e,y:n.f};var t,e,n;})))})),n.append("defs"),n}(c,e);!function(t,e){var n=t.exit();a.applyTransition(n,e).style("opacity",0).remove();}(c,e);var u=void 0!==c.merge?c.merge(l):c;return a.applyTransition(u,e).style("opacity",1),u.each((function(t){var n=o.select(this),r=e.edge(t);r.elem=this,r.id&&n.attr("id",r.id),a.applyClass(n,r.class,(n.classed("update")?"update ":"")+"edgePath");})),u.selectAll("path.path").each((function(t){var n=e.edge(t);n.arrowheadId=r.uniqueId("arrowhead");var c=o.select(this).attr("marker-end",(function(){return "url("+(t=location.href,e=n.arrowheadId,t.split("#")[0]+"#"+e+")");var t,e;})).style("fill","none");a.applyTransition(c,e).attr("d",(function(t){return function(t,e){var n=t.edge(e),r=t.node(e.v),a=t.node(e.w),o=n.points.slice(1,n.points.length-1);return o.unshift(i(r,o[0])),o.push(i(a,o[o.length-1])),s(n,o)}(e,t)})),a.applyStyle(c,n.style);})),u.selectAll("defs *").remove(),u.selectAll("defs").each((function(t){var r=e.edge(t);(0, n[r.arrowhead])(o.select(this),r.arrowheadId,r,"arrowhead");})),u};},607:(t,e,n)=>{var r=n(1034),i=n(1322),a=n(8355),o=n(4322);t.exports=function(t,e,n){var s,c=e.nodes().filter((function(t){return !a.isSubgraph(e,t)})),l=t.selectAll("g.node").data(c,(function(t){return t})).classed("update",!0);return l.exit().remove(),l.enter().append("g").attr("class","node").style("opacity",0),(l=t.selectAll("g.node")).each((function(t){var s=e.node(t),c=o.select(this);a.applyClass(c,s.class,(c.classed("update")?"update ":"")+"node"),c.select("g.label").remove();var l=c.append("g").attr("class","label"),u=i(l,s),h=n[s.shape],f=r.pick(u.node().getBBox(),"width","height");s.elem=this,s.id&&c.attr("id",s.id),s.labelId&&l.attr("id",s.labelId),r.has(s,"width")&&(f.width=s.width),r.has(s,"height")&&(f.height=s.height),f.width+=s.paddingLeft+s.paddingRight,f.height+=s.paddingTop+s.paddingBottom,l.attr("transform","translate("+(s.paddingLeft-s.paddingRight)/2+","+(s.paddingTop-s.paddingBottom)/2+")");var d=o.select(this);d.select(".label-container").remove();var p=h(d,f,s).classed("label-container",!0);a.applyStyle(p,s.style);var g=p.node().getBBox();s.width=g.width,s.height=g.height;})),s=l.exit?l.exit():l.selectAll(null),a.applyTransition(s,e).style("opacity",0).remove(),l};},4322:(t,e,n)=>{var r;if(!r)try{r=n(7543);}catch(t){}r||(r=window.d3),t.exports=r;},6478:(t,e,n)=>{var r;try{r=n(681);}catch(t){}r||(r=window.dagre),t.exports=r;},6614:(t,e,n)=>{var r;try{r=n(8282);}catch(t){}r||(r=window.graphlib),t.exports=r;},8114:(t,e,n)=>{t.exports={node:n(3042),circle:n(6587),ellipse:n(3260),polygon:n(5337),rect:n(8049)};},6587:(t,e,n)=>{var r=n(3260);t.exports=function(t,e,n){return r(t,e,e,n)};},3260:t=>{t.exports=function(t,e,n,r){var i=t.x,a=t.y,o=i-r.x,s=a-r.y,c=Math.sqrt(e*e*s*s+n*n*o*o),l=Math.abs(e*n*o/c);r.x{function e(t,e){return t*e>0}t.exports=function(t,n,r,i){var a,o,s,c,l,u,h,f,d,p,g,y,m;if(!(a=n.y-t.y,s=t.x-n.x,l=n.x*t.y-t.x*n.y,d=a*r.x+s*r.y+l,p=a*i.x+s*i.y+l,0!==d&&0!==p&&e(d,p)||(o=i.y-r.y,c=r.x-i.x,u=i.x*r.y-r.x*i.y,h=o*t.x+c*t.y+u,f=o*n.x+c*n.y+u,0!==h&&0!==f&&e(h,f)||0==(g=a*c-o*s))))return y=Math.abs(g/2),{x:(m=s*u-c*l)<0?(m-y)/g:(m+y)/g,y:(m=o*l-a*u)<0?(m-y)/g:(m+y)/g}};},3042:t=>{t.exports=function(t,e){return t.intersect(e)};},5337:(t,e,n)=>{var r=n(6808);t.exports=function(t,e,n){var i=t.x,a=t.y,o=[],s=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY;e.forEach((function(t){s=Math.min(s,t.x),c=Math.min(c,t.y);}));for(var l=i-t.width/2-s,u=a-t.height/2-c,h=0;h1&&o.sort((function(t,e){var r=t.x-n.x,i=t.y-n.y,a=Math.sqrt(r*r+i*i),o=e.x-n.x,s=e.y-n.y,c=Math.sqrt(o*o+s*s);return a{t.exports=function(t,e){var n,r,i=t.x,a=t.y,o=e.x-i,s=e.y-a,c=t.width/2,l=t.height/2;return Math.abs(s)*c>Math.abs(o)*l?(s<0&&(l=-l),n=0===s?0:l*o/s,r=l):(o<0&&(c=-c),n=c,r=0===o?0:c*s/o),{x:i+n,y:a+r}};},8284:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){var n=t.append("foreignObject").attr("width","100000"),i=n.append("xhtml:div");i.attr("xmlns","http://www.w3.org/1999/xhtml");var a=e.label;switch(typeof a){case"function":i.insert(a);break;case"object":i.insert((function(){return a}));break;default:i.html(a);}r.applyStyle(i,e.labelStyle),i.style("display","inline-block"),i.style("white-space","nowrap");var o=i.node().getBoundingClientRect();return n.attr("width",o.width).attr("height",o.height),n};},1322:(t,e,n)=>{var r=n(7318),i=n(8284),a=n(8287);t.exports=function(t,e,n){var o=e.label,s=t.append("g");"svg"===e.labelType?a(s,e):"string"!=typeof o||"html"===e.labelType?i(s,e):r(s,e);var c,l=s.node().getBBox();switch(n){case"top":c=-e.height/2;break;case"bottom":c=e.height/2-l.height;break;default:c=-l.height/2;}return s.attr("transform","translate("+-l.width/2+","+c+")"),s};},8287:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){var n=t;return n.node().appendChild(e.label),r.applyStyle(n,e.labelStyle),n};},7318:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){for(var n=t.append("text"),i=function(t){for(var e,n="",r=!1,i=0;i{var r;try{r={defaults:n(1747),each:n(6073),isFunction:n(3560),isPlainObject:n(8630),pick:n(9722),has:n(8721),range:n(6026),uniqueId:n(3955)};}catch(t){}r||(r=window._),t.exports=r;},6381:(t,e,n)=>{var r=n(8355),i=n(4322);t.exports=function(t,e){var n=t.filter((function(){return !i.select(this).classed("update")}));function a(t){var n=e.node(t);return "translate("+n.x+","+n.y+")"}n.attr("transform",a),r.applyTransition(t,e).style("opacity",1).attr("transform",a),r.applyTransition(n.selectAll("rect"),e).attr("width",(function(t){return e.node(t).width})).attr("height",(function(t){return e.node(t).height})).attr("x",(function(t){return -e.node(t).width/2})).attr("y",(function(t){return -e.node(t).height/2}));};},4577:(t,e,n)=>{var r=n(8355),i=n(4322),a=n(1034);t.exports=function(t,e){function n(t){var n=e.edge(t);return a.has(n,"x")?"translate("+n.x+","+n.y+")":""}t.filter((function(){return !i.select(this).classed("update")})).attr("transform",n),r.applyTransition(t,e).style("opacity",1).attr("transform",n);};},4849:(t,e,n)=>{var r=n(8355),i=n(4322);t.exports=function(t,e){function n(t){var n=e.node(t);return "translate("+n.x+","+n.y+")"}t.filter((function(){return !i.select(this).classed("update")})).attr("transform",n),r.applyTransition(t,e).style("opacity",1).attr("transform",n);};},5787:(t,e,n)=>{var r=n(1034),i=n(4322),a=n(6478).layout;t.exports=function(){var t=n(607),e=n(5632),i=n(6315),l=n(940),u=n(4849),h=n(4577),f=n(6381),d=n(4418),p=n(9144),g=function(n,g){!function(t){t.nodes().forEach((function(e){var n=t.node(e);r.has(n,"label")||t.children(e).length||(n.label=e),r.has(n,"paddingX")&&r.defaults(n,{paddingLeft:n.paddingX,paddingRight:n.paddingX}),r.has(n,"paddingY")&&r.defaults(n,{paddingTop:n.paddingY,paddingBottom:n.paddingY}),r.has(n,"padding")&&r.defaults(n,{paddingLeft:n.padding,paddingRight:n.padding,paddingTop:n.padding,paddingBottom:n.padding}),r.defaults(n,o),r.each(["paddingLeft","paddingRight","paddingTop","paddingBottom"],(function(t){n[t]=Number(n[t]);})),r.has(n,"width")&&(n._prevWidth=n.width),r.has(n,"height")&&(n._prevHeight=n.height);})),t.edges().forEach((function(e){var n=t.edge(e);r.has(n,"label")||(n.label=""),r.defaults(n,s);}));}(g);var y=c(n,"output"),m=c(y,"clusters"),b=c(y,"edgePaths"),v=i(c(y,"edgeLabels"),g),_=t(c(y,"nodes"),g,d);a(g),u(_,g),h(v,g),l(b,g,p);var x=e(m,g);f(x,g),function(t){r.each(t.nodes(),(function(e){var n=t.node(e);r.has(n,"_prevWidth")?n.width=n._prevWidth:delete n.width,r.has(n,"_prevHeight")?n.height=n._prevHeight:delete n.height,delete n._prevWidth,delete n._prevHeight;}));}(g);};return g.createNodes=function(e){return arguments.length?(t=e,g):t},g.createClusters=function(t){return arguments.length?(e=t,g):e},g.createEdgeLabels=function(t){return arguments.length?(i=t,g):i},g.createEdgePaths=function(t){return arguments.length?(l=t,g):l},g.shapes=function(t){return arguments.length?(d=t,g):d},g.arrows=function(t){return arguments.length?(p=t,g):p},g};var o={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},s={arrowhead:"normal",curve:i.curveLinear};function c(t,e){var n=t.select("g."+e);return n.empty()&&(n=t.append("g").attr("class",e)),n}},4418:(t,e,n)=>{var r=n(8049),i=n(3260),a=n(6587),o=n(5337);t.exports={rect:function(t,e,n){var i=t.insert("rect",":first-child").attr("rx",n.rx).attr("ry",n.ry).attr("x",-e.width/2).attr("y",-e.height/2).attr("width",e.width).attr("height",e.height);return n.intersect=function(t){return r(n,t)},i},ellipse:function(t,e,n){var r=e.width/2,a=e.height/2,o=t.insert("ellipse",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("rx",r).attr("ry",a);return n.intersect=function(t){return i(n,r,a,t)},o},circle:function(t,e,n){var r=Math.max(e.width,e.height)/2,i=t.insert("circle",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("r",r);return n.intersect=function(t){return a(n,r,t)},i},diamond:function(t,e,n){var r=e.width*Math.SQRT2/2,i=e.height*Math.SQRT2/2,a=[{x:0,y:-i},{x:-r,y:0},{x:0,y:i},{x:r,y:0}],s=t.insert("polygon",":first-child").attr("points",a.map((function(t){return t.x+","+t.y})).join(" "));return n.intersect=function(t){return o(n,a,t)},s}};},8355:(t,e,n)=>{var r=n(1034);t.exports={isSubgraph:function(t,e){return !!t.children(e).length},edgeToId:function(t){return a(t.v)+":"+a(t.w)+":"+a(t.name)},applyStyle:function(t,e){e&&t.attr("style",e);},applyClass:function(t,e,n){e&&t.attr("class",e).attr("class",n+" "+t.attr("class"));},applyTransition:function(t,e){var n=e.graph();if(r.isPlainObject(n)){var i=n.transition;if(r.isFunction(i))return i(t)}return t}};var i=/:/g;function a(t){return t?String(t).replace(i,"\\:"):""}},5689:t=>{t.exports="0.6.4";},681:(t,e,n)=>{t.exports={graphlib:n(574),layout:n(8123),debug:n(7570),util:{time:n(1138).time,notime:n(1138).notime},version:n(8177)};},2188:(t,e,n)=>{var r=n(8436),i=n(4079);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?i(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},i={};return r.forEach(t.nodes(),(function a(o){r.has(i,o)||(i[o]=!0,n[o]=!0,r.forEach(t.outEdges(o),(function(t){r.has(n,t.w)?e.push(t):a(t.w);})),delete n[o]);})),e}(t);r.forEach(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,r.uniqueId("rev"));}));},undo:function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r);}}));}};},1133:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n,r,a,o){var s={width:0,height:0,rank:o,borderType:e},c=a[e][o-1],l=i.addDummyNode(t,"border",s,n);a[e][o]=l,t.setParent(l,r),c&&t.setEdge(c,l,{weight:1});}t.exports=function(t){r.forEach(t.children(),(function e(n){var i=t.children(n),o=t.node(n);if(i.length&&r.forEach(i,e),r.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,c=o.maxRank+1;s{var r=n(8436);function i(t){r.forEach(t.nodes(),(function(e){a(t.node(e));})),r.forEach(t.edges(),(function(e){a(t.edge(e));}));}function a(t){var e=t.width;t.width=t.height,t.height=e;}function o(t){t.y=-t.y;}function s(t){var e=t.x;t.x=t.y,t.y=e;}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||i(t);},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){r.forEach(t.nodes(),(function(e){o(t.node(e));})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.forEach(n.points,o),r.has(n,"y")&&o(n);}));}(t),"lr"!==e&&"rl"!==e||(function(t){r.forEach(t.nodes(),(function(e){s(t.node(e));})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.forEach(n.points,s),r.has(n,"x")&&s(n);}));}(t),i(t));}};},7822:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t;}function n(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev;}function r(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return n(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&n(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e;},e.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,r)),n=n._prev;return "["+t.join(", ")+"]"};},7570:(t,e,n)=>{var r=n(8436),i=n(1138),a=n(574).Graph;t.exports={debugOrdering:function(t){var e=i.buildLayerMatrix(t),n=new a({compound:!0,multigraph:!0}).setGraph({});return r.forEach(t.nodes(),(function(e){n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank);})),r.forEach(t.edges(),(function(t){n.setEdge(t.v,t.w,{},t.name);})),r.forEach(e,(function(t,e){var i="layer"+e;n.setNode(i,{rank:"same"}),r.reduce(t,(function(t,e){return n.setEdge(t,e,{style:"invis"}),e}));})),n}};},574:(t,e,n)=>{var r;try{r=n(8282);}catch(t){}r||(r=window.graphlib),t.exports=r;},4079:(t,e,n)=>{var r=n(8436),i=n(574).Graph,a=n(7822);t.exports=function(t,e){if(t.nodeCount()<=1)return [];var n=function(t,e){var n=new i,o=0,s=0;r.forEach(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0});})),r.forEach(t.edges(),(function(t){var r=n.edge(t.v,t.w)||0,i=e(t),a=r+i;n.setEdge(t.v,t.w,a),s=Math.max(s,n.node(t.v).out+=i),o=Math.max(o,n.node(t.w).in+=i);}));var l=r.range(s+o+3).map((function(){return new a})),u=o+1;return r.forEach(n.nodes(),(function(t){c(l,u,n.node(t));})),{graph:n,buckets:l,zeroIdx:u}}(t,e||o),l=function(t,e,n){for(var r,i=[],a=e[e.length-1],o=e[0];t.nodeCount();){for(;r=o.dequeue();)s(t,e,n,r);for(;r=a.dequeue();)s(t,e,n,r);if(t.nodeCount())for(var c=e.length-2;c>0;--c)if(r=e[c].dequeue()){i=i.concat(s(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return r.flatten(r.map(l,(function(e){return t.outEdges(e.v,e.w)})),!0)};var o=r.constant(1);function s(t,e,n,i,a){var o=a?[]:void 0;return r.forEach(t.inEdges(i.v),(function(r){var i=t.edge(r),s=t.node(r.v);a&&o.push({v:r.v,w:r.w}),s.out-=i,c(e,n,s);})),r.forEach(t.outEdges(i.v),(function(r){var i=t.edge(r),a=r.w,o=t.node(a);o.in-=i,c(e,n,o);})),t.removeNode(i.v),o}function c(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n);}},8123:(t,e,n)=>{var r=n(8436),i=n(2188),a=n(5995),o=n(8093),s=n(1138).normalizeRanks,c=n(4219),l=n(1138).removeEmptyRanks,u=n(2981),h=n(1133),f=n(3258),d=n(3408),p=n(7873),g=n(1138),y=n(574).Graph;t.exports=function(t,e){var n=e&&e.debugTiming?g.time:g.notime;n("layout",(function(){var e=n(" buildLayoutGraph",(function(){return function(t){var e=new y({multigraph:!0,compound:!0}),n=C(t.graph());return e.setGraph(r.merge({},b,E(n,m),r.pick(n,v))),r.forEach(t.nodes(),(function(n){var i=C(t.node(n));e.setNode(n,r.defaults(E(i,_),x)),e.setParent(n,t.parent(n));})),r.forEach(t.edges(),(function(n){var i=C(t.edge(n));e.setEdge(n,r.merge({},w,E(i,k),r.pick(i,T)));})),e}(t)}));n(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,r.forEach(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset);}));}(t);})),e(" removeSelfEdges",(function(){!function(t){r.forEach(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e);}}));}(t);})),e(" acyclic",(function(){i.run(t);})),e(" nestingGraph.run",(function(){u.run(t);})),e(" rank",(function(){o(g.asNonCompoundGraph(t));})),e(" injectEdgeLabelProxies",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};g.addDummyNode(t,"edge-proxy",i,"_ep");}}));}(t);})),e(" removeEmptyRanks",(function(){l(t);})),e(" nestingGraph.cleanup",(function(){u.cleanup(t);})),e(" normalizeRanks",(function(){s(t);})),e(" assignRankMinMax",(function(){!function(t){var e=0;r.forEach(t.nodes(),(function(n){var i=t.node(n);i.borderTop&&(i.minRank=t.node(i.borderTop).rank,i.maxRank=t.node(i.borderBottom).rank,e=r.max(e,i.maxRank));})),t.graph().maxRank=e;}(t);})),e(" removeEdgeLabelProxies",(function(){!function(t){r.forEach(t.nodes(),(function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e));}));}(t);})),e(" normalize.run",(function(){a.run(t);})),e(" parentDummyChains",(function(){c(t);})),e(" addBorderSegments",(function(){h(t);})),e(" order",(function(){d(t);})),e(" insertSelfEdges",(function(){!function(t){var e=g.buildLayerMatrix(t);r.forEach(e,(function(e){var n=0;r.forEach(e,(function(e,i){var a=t.node(e);a.order=i+n,r.forEach(a.selfEdges,(function(e){g.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:a.rank,order:i+ ++n,e:e.e,label:e.label},"_se");})),delete a.selfEdges;}));}));}(t);})),e(" adjustCoordinateSystem",(function(){f.adjust(t);})),e(" position",(function(){p(t);})),e(" positionSelfEdges",(function(){!function(t){r.forEach(t.nodes(),(function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y;}}));}(t);})),e(" removeBorderNodes",(function(){!function(t){r.forEach(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),i=t.node(n.borderTop),a=t.node(n.borderBottom),o=t.node(r.last(n.borderLeft)),s=t.node(r.last(n.borderRight));n.width=Math.abs(s.x-o.x),n.height=Math.abs(a.y-i.y),n.x=o.x+n.width/2,n.y=i.y+n.height/2;}})),r.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e);}));}(t);})),e(" normalize.undo",(function(){a.undo(t);})),e(" fixupEdgeLabelCoords",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(r.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;}}));}(t);})),e(" undoCoordinateSystem",(function(){f.undo(t);})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,a=0,o=t.graph(),s=o.marginx||0,c=o.marginy||0;function l(t){var r=t.x,o=t.y,s=t.width,c=t.height;e=Math.min(e,r-s/2),n=Math.max(n,r+s/2),i=Math.min(i,o-c/2),a=Math.max(a,o+c/2);}r.forEach(t.nodes(),(function(e){l(t.node(e));})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.has(n,"x")&&l(n);})),e-=s,i-=c,r.forEach(t.nodes(),(function(n){var r=t.node(n);r.x-=e,r.y-=i;})),r.forEach(t.edges(),(function(n){var a=t.edge(n);r.forEach(a.points,(function(t){t.x-=e,t.y-=i;})),r.has(a,"x")&&(a.x-=e),r.has(a,"y")&&(a.y-=i);})),o.width=n-e+s,o.height=a-i+c;}(t);})),e(" assignNodeIntersects",(function(){!function(t){r.forEach(t.edges(),(function(e){var n,r,i=t.edge(e),a=t.node(e.v),o=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=o,r=a),i.points.unshift(g.intersectRect(a,n)),i.points.push(g.intersectRect(o,r));}));}(t);})),e(" reversePoints",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse();}));}(t);})),e(" acyclic.undo",(function(){i.undo(t);}));}(e,n);})),n(" updateInputGraph",(function(){!function(t,e){r.forEach(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height));})),r.forEach(t.edges(),(function(n){var i=t.edge(n),a=e.edge(n);i.points=a.points,r.has(a,"x")&&(i.x=a.x,i.y=a.y);})),t.graph().width=e.graph().width,t.graph().height=e.graph().height;}(t,e);}));}));};var m=["nodesep","edgesep","ranksep","marginx","marginy"],b={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},v=["acyclicer","ranker","rankdir","align"],_=["width","height"],x={width:0,height:0},k=["minlen","weight","width","height","labeloffset"],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function E(t,e){return r.mapValues(r.pick(t,e),Number)}function C(t){var e={};return r.forEach(t,(function(t,n){e[n.toLowerCase()]=t;})),e}},8436:(t,e,n)=>{var r;try{r={cloneDeep:n(361),constant:n(5703),defaults:n(1747),each:n(6073),filter:n(3105),find:n(3311),flatten:n(5564),forEach:n(4486),forIn:n(2620),has:n(8721),isUndefined:n(2353),last:n(928),map:n(5161),mapValues:n(6604),max:n(6162),merge:n(3857),min:n(3632),minBy:n(2762),now:n(7771),pick:n(9722),range:n(6026),reduce:n(4061),sortBy:n(9734),uniqueId:n(3955),values:n(2628),zipObject:n(7287)};}catch(t){}r||(r=window._),t.exports=r;},2981:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n,o,s,c,l){var u=t.children(l);if(u.length){var h=i.addBorderNode(t,"_bt"),f=i.addBorderNode(t,"_bb"),d=t.node(l);t.setParent(h,l),d.borderTop=h,t.setParent(f,l),d.borderBottom=f,r.forEach(u,(function(r){a(t,e,n,o,s,c,r);var i=t.node(r),u=i.borderTop?i.borderTop:r,d=i.borderBottom?i.borderBottom:r,p=i.borderTop?o:2*o,g=u!==d?1:s-c[l]+1;t.setEdge(h,u,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(d,f,{weight:p,minlen:g,nestingEdge:!0});})),t.parent(l)||t.setEdge(e,h,{weight:0,minlen:s+c[l]});}else l!==e&&t.setEdge(e,l,{weight:0,minlen:n});}t.exports={run:function(t){var e=i.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(i,a){var o=t.children(i);o&&o.length&&r.forEach(o,(function(t){n(t,a+1);})),e[i]=a;}return r.forEach(t.children(),(function(t){n(t,1);})),e}(t),o=r.max(r.values(n))-1,s=2*o+1;t.graph().nestingRoot=e,r.forEach(t.edges(),(function(e){t.edge(e).minlen*=s;}));var c=function(t){return r.reduce(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;r.forEach(t.children(),(function(r){a(t,e,s,c,o,n,r);})),t.graph().nodeRankFactor=s;},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,r.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e);}));}};},5995:(t,e,n)=>{var r=n(8436),i=n(1138);t.exports={run:function(t){t.graph().dummyChains=[],r.forEach(t.edges(),(function(e){!function(t,e){var n,r,a,o=e.v,s=t.node(o).rank,c=e.w,l=t.node(c).rank,u=e.name,h=t.edge(e),f=h.labelRank;if(l!==s+1){for(t.removeEdge(e),a=0,++s;s{var r=n(8436);t.exports=function(t,e,n){var i,a={};r.forEach(n,(function(n){for(var r,o,s=t.parent(n);s;){if((r=t.parent(s))?(o=a[r],a[r]=s):(o=i,i=s),o&&o!==s)return void e.setEdge(o,s);s=r;}}));};},5439:(t,e,n)=>{var r=n(8436);t.exports=function(t,e){return r.map(e,(function(e){var n=t.inEdges(e);if(n.length){var i=r.reduce(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return {sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return {v:e,barycenter:i.sum/i.weight,weight:i.weight}}return {v:e}}))};},3128:(t,e,n)=>{var r=n(8436),i=n(574).Graph;t.exports=function(t,e,n){var a=function(t){for(var e;t.hasNode(e=r.uniqueId("_root")););return e}(t),o=new i({compound:!0}).setGraph({root:a}).setDefaultNodeLabel((function(e){return t.node(e)}));return r.forEach(t.nodes(),(function(i){var s=t.node(i),c=t.parent(i);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(o.setNode(i),o.setParent(i,c||a),r.forEach(t[n](i),(function(e){var n=e.v===i?e.w:e.v,a=o.edge(n,i),s=r.isUndefined(a)?0:a.weight;o.setEdge(n,i,{weight:t.edge(e).weight+s});})),r.has(s,"minRank")&&o.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}));})),o};},6630:(t,e,n)=>{var r=n(8436);function i(t,e,n){for(var i=r.zipObject(n,r.map(n,(function(t,e){return e}))),a=r.flatten(r.map(e,(function(e){return r.sortBy(r.map(t.outEdges(e),(function(e){return {pos:i[e.w],weight:t.edge(e).weight}})),"pos")})),!0),o=1;o0;)e%2&&(n+=c[e+1]),c[e=e-1>>1]+=t.weight;l+=t.weight*n;}))),l}t.exports=function(t,e){for(var n=0,r=1;r{var r=n(8436),i=n(2588),a=n(6630),o=n(1026),s=n(3128),c=n(5093),l=n(574).Graph,u=n(1138);function h(t,e,n){return r.map(e,(function(e){return s(t,e,n)}))}function f(t,e){var n=new l;r.forEach(t,(function(t){var i=t.graph().root,a=o(t,i,n,e);r.forEach(a.vs,(function(e,n){t.node(e).order=n;})),c(t,n,a.vs);}));}function d(t,e){r.forEach(e,(function(e){r.forEach(e,(function(e,n){t.node(e).order=n;}));}));}t.exports=function(t){var e=u.maxRank(t),n=h(t,r.range(1,e+1),"inEdges"),o=h(t,r.range(e-1,-1,-1),"outEdges"),s=i(t);d(t,s);for(var c,l=Number.POSITIVE_INFINITY,p=0,g=0;g<4;++p,++g){f(p%2?n:o,p%4>=2),s=u.buildLayerMatrix(t);var y=a(t,s);y{var r=n(8436);t.exports=function(t){var e={},n=r.filter(t.nodes(),(function(e){return !t.children(e).length})),i=r.max(r.map(n,(function(e){return t.node(e).rank}))),a=r.map(r.range(i+1),(function(){return []})),o=r.sortBy(n,(function(e){return t.node(e).rank}));return r.forEach(o,(function n(i){if(!r.has(e,i)){e[i]=!0;var o=t.node(i);a[o.rank].push(i),r.forEach(t.successors(i),n);}})),a};},9567:(t,e,n)=>{var r=n(8436);t.exports=function(t,e){var n={};return r.forEach(t,(function(t,e){var i=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};r.isUndefined(t.barycenter)||(i.barycenter=t.barycenter,i.weight=t.weight);})),r.forEach(e.edges(),(function(t){var e=n[t.v],i=n[t.w];r.isUndefined(e)||r.isUndefined(i)||(i.indegree++,e.out.push(n[t.w]));})),function(t){var e=[];function n(t){return function(e){var n,i,a,o;e.merged||(r.isUndefined(e.barycenter)||r.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(i=e,a=0,o=0,(n=t).weight&&(a+=n.barycenter*n.weight,o+=n.weight),i.weight&&(a+=i.barycenter*i.weight,o+=i.weight),n.vs=i.vs.concat(n.vs),n.barycenter=a/o,n.weight=o,n.i=Math.min(i.i,n.i),i.merged=!0);}}function i(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n);}}for(;t.length;){var a=t.pop();e.push(a),r.forEach(a.in.reverse(),n(a)),r.forEach(a.out,i(a));}return r.map(r.filter(e,(function(t){return !t.merged})),(function(t){return r.pick(t,["vs","i","barycenter","weight"])}))}(r.filter(n,(function(t){return !t.indegree})))};},1026:(t,e,n)=>{var r=n(8436),i=n(5439),a=n(9567),o=n(7304);t.exports=function t(e,n,s,c){var l=e.children(n),u=e.node(n),h=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,d={};h&&(l=r.filter(l,(function(t){return t!==h&&t!==f})));var p=i(e,l);r.forEach(p,(function(n){if(e.children(n.v).length){var i=t(e,n.v,s,c);d[n.v]=i,r.has(i,"barycenter")&&(a=n,o=i,r.isUndefined(a.barycenter)?(a.barycenter=o.barycenter,a.weight=o.weight):(a.barycenter=(a.barycenter*a.weight+o.barycenter*o.weight)/(a.weight+o.weight),a.weight+=o.weight));}var a,o;}));var g=a(p,s);!function(t,e){r.forEach(t,(function(t){t.vs=r.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0);}));}(g,d);var y=o(g,c);if(h&&(y.vs=r.flatten([h,y.vs,f],!0),e.predecessors(h).length)){var m=e.node(e.predecessors(h)[0]),b=e.node(e.predecessors(f)[0]);r.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2;}return y};},7304:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n){for(var i;e.length&&(i=r.last(e)).i<=n;)e.pop(),t.push(i.vs),n++;return n}t.exports=function(t,e){var n,o=i.partition(t,(function(t){return r.has(t,"barycenter")})),s=o.lhs,c=r.sortBy(o.rhs,(function(t){return -t.i})),l=[],u=0,h=0,f=0;s.sort((n=!!e,function(t,e){return t.barycentere.barycenter?1:n?e.i-t.i:t.i-e.i})),f=a(l,c,f),r.forEach(s,(function(t){f+=t.vs.length,l.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,f=a(l,c,f);}));var d={vs:r.flatten(l,!0)};return h&&(d.barycenter=u/h,d.weight=h),d};},4219:(t,e,n)=>{var r=n(8436);t.exports=function(t){var e=function(t){var e={},n=0;return r.forEach(t.children(),(function i(a){var o=n;r.forEach(t.children(a),i),e[a]={low:o,lim:n++};})),e}(t);r.forEach(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,a=function(t,e,n,r){var i,a,o=[],s=[],c=Math.min(e[n].low,e[r].low),l=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),o.push(i);}while(i&&(e[i].low>c||l>e[i].lim));for(a=i,i=r;(i=t.parent(i))!==a;)s.push(i);return {path:o.concat(s.reverse()),lca:a}}(t,e,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=t.node(n),u){for(;(l=o[c])!==s&&t.node(l).maxRank{var r=n(8436),i=n(574).Graph,a=n(1138);function o(t,e){var n={};return r.reduce(e,(function(e,i){var a=0,o=0,s=e.length,l=r.last(i);return r.forEach(i,(function(e,u){var h=function(t,e){if(t.node(e).dummy)return r.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),f=h?t.node(h).order:s;(h||e===l)&&(r.forEach(i.slice(o,u+1),(function(e){r.forEach(t.predecessors(e),(function(r){var i=t.node(r),o=i.order;!(os)&&c(n,e,l);}));}));}return r.reduce(e,(function(e,n){var a,o=-1,s=0;return r.forEach(n,(function(r,c){if("border"===t.node(r).dummy){var l=t.predecessors(r);l.length&&(a=t.node(l[0]).order,i(n,s,c,o,a),s=c,o=a);}i(n,s,n.length,a,e.length);})),n})),n}function c(t,e,n){if(e>n){var r=e;e=n,n=r;}var i=t[e];i||(t[e]=i={}),i[n]=!0;}function l(t,e,n){if(e>n){var i=e;e=n,n=i;}return r.has(t[e],n)}function u(t,e,n,i){var a={},o={},s={};return r.forEach(e,(function(t){r.forEach(t,(function(t,e){a[t]=t,o[t]=t,s[t]=e;}));})),r.forEach(e,(function(t){var e=-1;r.forEach(t,(function(t){var c=i(t);if(c.length){c=r.sortBy(c,(function(t){return s[t]}));for(var u=(c.length-1)/2,h=Math.floor(u),f=Math.ceil(u);h<=f;++h){var d=c[h];o[t]===t&&e{var r=n(8436),i=n(1138),a=n(3573).positionX;t.exports=function(t){(function(t){var e=i.buildLayerMatrix(t),n=t.graph().ranksep,a=0;r.forEach(e,(function(e){var i=r.max(r.map(e,(function(e){return t.node(e).height})));r.forEach(e,(function(e){t.node(e).y=a+i/2;})),a+=i+n;}));})(t=i.asNonCompoundGraph(t)),r.forEach(a(t),(function(e,n){t.node(n).x=e;}));};},300:(t,e,n)=>{var r=n(8436),i=n(574).Graph,a=n(6681).slack;function o(t,e){return r.forEach(t.nodes(),(function n(i){r.forEach(e.nodeEdges(i),(function(r){var o=r.v,s=i===o?r.w:o;t.hasNode(s)||a(e,r)||(t.setNode(s,{}),t.setEdge(i,s,{}),n(s));}));})),t.nodeCount()}function s(t,e){return r.minBy(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return a(e,n)}))}function c(t,e,n){r.forEach(t.nodes(),(function(t){e.node(t).rank+=n;}));}t.exports=function(t){var e,n,r=new i({directed:!1}),l=t.nodes()[0],u=t.nodeCount();for(r.setNode(l,{});o(r,t){var r=n(6681).longestPath,i=n(300),a=n(2472);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){a(t);}(t);break;case"tight-tree":!function(t){r(t),i(t);}(t);break;case"longest-path":o(t);}};var o=r;},2472:(t,e,n)=>{var r=n(8436),i=n(300),a=n(6681).slack,o=n(6681).longestPath,s=n(574).alg.preorder,c=n(574).alg.postorder,l=n(1138).simplify;function u(t){t=l(t),o(t);var e,n=i(t);for(d(n),h(n,t);e=g(n);)m(n,t,e,y(n,t,e));}function h(t,e){var n=c(t,t.nodes());n=n.slice(0,n.length-1),r.forEach(n,(function(n){!function(t,e,n){var r=t.node(n).parent;t.edge(n,r).cutvalue=f(t,e,n);}(t,e,n);}));}function f(t,e,n){var i=t.node(n).parent,a=!0,o=e.edge(n,i),s=0;return o||(a=!1,o=e.edge(i,n)),s=o.weight,r.forEach(e.nodeEdges(n),(function(r){var o,c,l=r.v===n,u=l?r.w:r.v;if(u!==i){var h=l===a,f=e.edge(r).weight;if(s+=h?f:-f,o=n,c=u,t.hasEdge(o,c)){var d=t.edge(n,u).cutvalue;s+=h?-d:d;}}})),s}function d(t,e){arguments.length<2&&(e=t.nodes()[0]),p(t,{},1,e);}function p(t,e,n,i,a){var o=n,s=t.node(i);return e[i]=!0,r.forEach(t.neighbors(i),(function(a){r.has(e,a)||(n=p(t,e,n,a,i));})),s.low=o,s.lim=n++,a?s.parent=a:delete s.parent,n}function g(t){return r.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function y(t,e,n){var i=n.v,o=n.w;e.hasEdge(i,o)||(i=n.w,o=n.v);var s=t.node(i),c=t.node(o),l=s,u=!1;s.lim>c.lim&&(l=c,u=!0);var h=r.filter(e.edges(),(function(e){return u===b(0,t.node(e.v),l)&&u!==b(0,t.node(e.w),l)}));return r.minBy(h,(function(t){return a(e,t)}))}function m(t,e,n,i){var a=n.v,o=n.w;t.removeEdge(a,o),t.setEdge(i.v,i.w,{}),d(t),h(t,e),function(t,e){var n=r.find(t.nodes(),(function(t){return !e.node(t).parent})),i=s(t,n);i=i.slice(1),r.forEach(i,(function(n){var r=t.node(n).parent,i=e.edge(n,r),a=!1;i||(i=e.edge(r,n),a=!0),e.node(n).rank=e.node(r).rank+(a?i.minlen:-i.minlen);}));}(t,e);}function b(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}t.exports=u,u.initLowLimValues=d,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=g,u.enterEdge=y,u.exchangeEdges=m;},6681:(t,e,n)=>{var r=n(8436);t.exports={longestPath:function(t){var e={};r.forEach(t.sources(),(function n(i){var a=t.node(i);if(r.has(e,i))return a.rank;e[i]=!0;var o=r.min(r.map(t.outEdges(i),(function(e){return n(e.w)-t.edge(e).minlen})));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),a.rank=o}));},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}};},1138:(t,e,n)=>{var r=n(8436),i=n(574).Graph;function a(t,e,n,i){var a;do{a=r.uniqueId(i);}while(t.hasNode(a));return n.dummy=e,t.setNode(a,n),a}function o(t){return r.max(r.map(t.nodes(),(function(e){var n=t.node(e).rank;if(!r.isUndefined(n))return n})))}t.exports={addDummyNode:a,simplify:function(t){var e=(new i).setGraph(t.graph());return r.forEach(t.nodes(),(function(n){e.setNode(n,t.node(n));})),r.forEach(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)});})),e},asNonCompoundGraph:function(t){var e=new i({multigraph:t.isMultigraph()}).setGraph(t.graph());return r.forEach(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n));})),r.forEach(t.edges(),(function(n){e.setEdge(n,t.edge(n));})),e},successorWeights:function(t){var e=r.map(t.nodes(),(function(e){var n={};return r.forEach(t.outEdges(e),(function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight;})),n}));return r.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=r.map(t.nodes(),(function(e){var n={};return r.forEach(t.inEdges(e),(function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight;})),n}));return r.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,a=t.y,o=e.x-i,s=e.y-a,c=t.width/2,l=t.height/2;if(!o&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*c>Math.abs(o)*l?(s<0&&(l=-l),n=l*o/s,r=l):(o<0&&(c=-c),n=c,r=c*s/o),{x:i+n,y:a+r}},buildLayerMatrix:function(t){var e=r.map(r.range(o(t)+1),(function(){return []}));return r.forEach(t.nodes(),(function(n){var i=t.node(n),a=i.rank;r.isUndefined(a)||(e[a][i.order]=n);})),e},normalizeRanks:function(t){var e=r.min(r.map(t.nodes(),(function(e){return t.node(e).rank})));r.forEach(t.nodes(),(function(n){var i=t.node(n);r.has(i,"rank")&&(i.rank-=e);}));},removeEmptyRanks:function(t){var e=r.min(r.map(t.nodes(),(function(e){return t.node(e).rank}))),n=[];r.forEach(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r);}));var i=0,a=t.graph().nodeRankFactor;r.forEach(n,(function(e,n){r.isUndefined(e)&&n%a!=0?--i:i&&r.forEach(e,(function(e){t.node(e).rank+=i;}));}));},addBorderNode:function(t,e,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),a(t,"border",i,e)},maxRank:o,partition:function(t,e){var n={lhs:[],rhs:[]};return r.forEach(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t);})),n},time:function(t,e){var n=r.now();try{return e()}finally{console.log(t+" time: "+(r.now()-n)+"ms");}},notime:function(t,e){return e()}};},8177:t=>{t.exports="0.8.5";},7856:function(t){t.exports=function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,n){return e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(t,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return !1}}function r(t,i,a){return r=n()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var a=new(Function.bind.apply(t,i));return r&&e(a,r.prototype),a},r.apply(null,arguments)}function i(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return "Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?n-1:0),i=1;i/gm),q=f(/^data-[\-\w.\u00B7-\uFFFF]/),H=f(/^aria-[\-\w]+$/),V=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),G=f(/^(?:\w+script|data):/i),X=f(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=f(/^html$/i),Q=function(){return "undefined"==typeof window?null:window},K=function(e,n){if("object"!==t(e)||"function"!=typeof e.createPolicy)return null;var r=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var a="dompurify"+(r?"#"+r:"");try{return e.createPolicy(a,{createHTML:function(t){return t},createScriptURL:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+a+" could not be created."),null}};return function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q(),r=function(t){return e(t)};if(r.version="2.4.0",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var a=n.document,o=n.document,s=n.DocumentFragment,c=n.HTMLTemplateElement,l=n.Node,u=n.Element,f=n.NodeFilter,d=n.NamedNodeMap,p=void 0===d?n.NamedNodeMap||n.MozNamedAttrMap:d,g=n.HTMLFormElement,y=n.DOMParser,m=n.trustedTypes,A=u.prototype,J=O(A,"cloneNode"),tt=O(A,"nextSibling"),et=O(A,"childNodes"),nt=O(A,"parentNode");if("function"==typeof c){var rt=o.createElement("template");rt.content&&rt.content.ownerDocument&&(o=rt.content.ownerDocument);}var it=K(m,a),at=it?it.createHTML(""):"",ot=o,st=ot.implementation,ct=ot.createNodeIterator,lt=ot.createDocumentFragment,ut=ot.getElementsByTagName,ht=a.importNode,ft={};try{ft=N(o).documentMode?o.documentMode:{};}catch(t){}var dt={};r.isSupported="function"==typeof nt&&st&&void 0!==st.createHTMLDocument&&9!==ft;var pt,gt,yt=$,mt=W,bt=q,vt=H,_t=G,xt=X,kt=V,wt=null,Tt=M({},[].concat(i(D),i(B),i(L),i(F),i(P))),Et=null,Ct=M({},[].concat(i(j),i(z),i(Y),i(U))),St=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),At=null,Mt=null,Nt=!0,Ot=!0,Dt=!1,Bt=!1,Lt=!1,It=!1,Ft=!1,Rt=!1,Pt=!1,jt=!1,zt=!0,Yt=!1,Ut="user-content-",$t=!0,Wt=!1,qt={},Ht=null,Vt=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Gt=null,Xt=M({},["audio","video","img","source","image","track"]),Zt=null,Qt=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Kt="http://www.w3.org/1998/Math/MathML",Jt="http://www.w3.org/2000/svg",te="http://www.w3.org/1999/xhtml",ee=te,ne=!1,re=["application/xhtml+xml","text/html"],ie="text/html",ae=null,oe=o.createElement("form"),se=function(t){return t instanceof RegExp||t instanceof Function},ce=function(e){ae&&ae===e||(e&&"object"===t(e)||(e={}),e=N(e),pt=pt=-1===re.indexOf(e.PARSER_MEDIA_TYPE)?ie:e.PARSER_MEDIA_TYPE,gt="application/xhtml+xml"===pt?function(t){return t}:x,wt="ALLOWED_TAGS"in e?M({},e.ALLOWED_TAGS,gt):Tt,Et="ALLOWED_ATTR"in e?M({},e.ALLOWED_ATTR,gt):Ct,Zt="ADD_URI_SAFE_ATTR"in e?M(N(Qt),e.ADD_URI_SAFE_ATTR,gt):Qt,Gt="ADD_DATA_URI_TAGS"in e?M(N(Xt),e.ADD_DATA_URI_TAGS,gt):Xt,Ht="FORBID_CONTENTS"in e?M({},e.FORBID_CONTENTS,gt):Vt,At="FORBID_TAGS"in e?M({},e.FORBID_TAGS,gt):{},Mt="FORBID_ATTR"in e?M({},e.FORBID_ATTR,gt):{},qt="USE_PROFILES"in e&&e.USE_PROFILES,Nt=!1!==e.ALLOW_ARIA_ATTR,Ot=!1!==e.ALLOW_DATA_ATTR,Dt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Bt=e.SAFE_FOR_TEMPLATES||!1,Lt=e.WHOLE_DOCUMENT||!1,Rt=e.RETURN_DOM||!1,Pt=e.RETURN_DOM_FRAGMENT||!1,jt=e.RETURN_TRUSTED_TYPE||!1,Ft=e.FORCE_BODY||!1,zt=!1!==e.SANITIZE_DOM,Yt=e.SANITIZE_NAMED_PROPS||!1,$t=!1!==e.KEEP_CONTENT,Wt=e.IN_PLACE||!1,kt=e.ALLOWED_URI_REGEXP||kt,ee=e.NAMESPACE||te,e.CUSTOM_ELEMENT_HANDLING&&se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(St.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(St.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(St.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Bt&&(Ot=!1),Pt&&(Rt=!0),qt&&(wt=M({},i(P)),Et=[],!0===qt.html&&(M(wt,D),M(Et,j)),!0===qt.svg&&(M(wt,B),M(Et,z),M(Et,U)),!0===qt.svgFilters&&(M(wt,L),M(Et,z),M(Et,U)),!0===qt.mathMl&&(M(wt,F),M(Et,Y),M(Et,U))),e.ADD_TAGS&&(wt===Tt&&(wt=N(wt)),M(wt,e.ADD_TAGS,gt)),e.ADD_ATTR&&(Et===Ct&&(Et=N(Et)),M(Et,e.ADD_ATTR,gt)),e.ADD_URI_SAFE_ATTR&&M(Zt,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Ht===Vt&&(Ht=N(Ht)),M(Ht,e.FORBID_CONTENTS,gt)),$t&&(wt["#text"]=!0),Lt&&M(wt,["html","head","body"]),wt.table&&(M(wt,["tbody"]),delete At.tbody),h&&h(e),ae=e);},le=M({},["mi","mo","mn","ms","mtext"]),ue=M({},["foreignobject","desc","title","annotation-xml"]),he=M({},["title","style","font","a","script"]),fe=M({},B);M(fe,L),M(fe,I);var de=M({},F);M(de,R);var pe=function(t){var e=nt(t);e&&e.tagName||(e={namespaceURI:te,tagName:"template"});var n=x(t.tagName),r=x(e.tagName);return t.namespaceURI===Jt?e.namespaceURI===te?"svg"===n:e.namespaceURI===Kt?"svg"===n&&("annotation-xml"===r||le[r]):Boolean(fe[n]):t.namespaceURI===Kt?e.namespaceURI===te?"math"===n:e.namespaceURI===Jt?"math"===n&&ue[r]:Boolean(de[n]):t.namespaceURI===te&&!(e.namespaceURI===Jt&&!ue[r])&&!(e.namespaceURI===Kt&&!le[r])&&!de[n]&&(he[n]||!fe[n])},ge=function(t){_(r.removed,{element:t});try{t.parentNode.removeChild(t);}catch(e){try{t.outerHTML=at;}catch(e){t.remove();}}},ye=function(t,e){try{_(r.removed,{attribute:e.getAttributeNode(t),from:e});}catch(t){_(r.removed,{attribute:null,from:e});}if(e.removeAttribute(t),"is"===t&&!Et[t])if(Rt||Pt)try{ge(e);}catch(t){}else try{e.setAttribute(t,"");}catch(t){}},me=function(t){var e,n;if(Ft)t=""+t;else {var r=k(t,/^[\r\n\t ]+/);n=r&&r[0];}"application/xhtml+xml"===pt&&(t=''+t+"");var i=it?it.createHTML(t):t;if(ee===te)try{e=(new y).parseFromString(i,pt);}catch(t){}if(!e||!e.documentElement){e=st.createDocument(ee,"template",null);try{e.documentElement.innerHTML=ne?"":i;}catch(t){}}var a=e.body||e.documentElement;return t&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),ee===te?ut.call(e,Lt?"html":"body")[0]:Lt?e.documentElement:a},be=function(t){return ct.call(t.ownerDocument||t,t,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT,null,!1)},ve=function(t){return t instanceof g&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof p)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore)},_e=function(e){return "object"===t(l)?e instanceof l:e&&"object"===t(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},xe=function(t,e,n){dt[t]&&b(dt[t],(function(t){t.call(r,e,n,ae);}));},ke=function(t){var e;if(xe("beforeSanitizeElements",t,null),ve(t))return ge(t),!0;if(C(/[\u0080-\uFFFF]/,t.nodeName))return ge(t),!0;var n=gt(t.nodeName);if(xe("uponSanitizeElement",t,{tagName:n,allowedTags:wt}),t.hasChildNodes()&&!_e(t.firstElementChild)&&(!_e(t.content)||!_e(t.content.firstElementChild))&&C(/<[/\w]/g,t.innerHTML)&&C(/<[/\w]/g,t.textContent))return ge(t),!0;if("select"===n&&C(/