From d02c122d277b0126f8b3f9506c93db408ad9248b Mon Sep 17 00:00:00 2001 From: terwer Date: Tue, 23 May 2023 18:07:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=96=B0=E5=A2=9E=E5=8D=9A?= =?UTF-8?q?=E5=AE=A2API=E3=80=81=E6=80=9D=E6=BA=90API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- pnpm-lock.yaml | 188 +- public/libs/zhi-blog-api/README.md | 38 + public/libs/zhi-blog-api/index.d.ts | 16 + public/libs/zhi-blog-api/index.js | 9405 ++++++++++++++ public/libs/zhi-blog-api/lib/IBlogApi.d.ts | 139 + public/libs/zhi-blog-api/lib/blogAdaptor.d.ts | 88 + public/libs/zhi-blog-api/lib/blogApi.d.ts | 21 + public/libs/zhi-blog-api/lib/blogConfig.d.ts | 98 + .../libs/zhi-blog-api/lib/blogConstants.d.ts | 14 + .../zhi-blog-api/lib/blogPlaceholder.d.ts | 50 + .../zhi-blog-api/lib/enums/blogTypeEnum.d.ts | 22 + .../lib/enums/postStatusEnum.d.ts | 18 + .../zhi-blog-api/lib/models/categoryInfo.d.ts | 39 + .../zhi-blog-api/lib/models/mediaObject.d.ts | 42 + public/libs/zhi-blog-api/lib/models/post.d.ts | 70 + .../zhi-blog-api/lib/models/siteConfig.d.ts | 44 + .../zhi-blog-api/lib/models/userBlog.d.ts | 29 + .../lib/utils/ZhiBlogApiUtil.d.ts | 13 + .../libs/zhi-blog-api/lib/zhi-blog-api.d.ts | 2 + public/libs/zhi-blog-api/package.json | 39 + public/libs/zhi-common/README.md | 51 + public/libs/zhi-common/index.d.ts | 4 + public/libs/zhi-common/index.js | 8914 +++++++++++++ public/libs/zhi-common/lib/IBlogApi.d.ts | 139 + public/libs/zhi-common/lib/ZhiCommonUtil.d.ts | 13 + public/libs/zhi-common/lib/ZhiUtil.d.ts | 65 + public/libs/zhi-common/lib/blogApi.d.ts | 88 + public/libs/zhi-common/lib/blogConfig.d.ts | 98 + public/libs/zhi-common/lib/blogConstants.d.ts | 14 + .../libs/zhi-common/lib/blogPlaceholder.d.ts | 50 + public/libs/zhi-common/lib/dateUtil.d.ts | 60 + .../zhi-common/lib/enums/blogTypeEnum.d.ts | 22 + .../zhi-common/lib/enums/postStatusEnum.d.ts | 18 + public/libs/zhi-common/lib/htmlUtil.d.ts | 73 + public/libs/zhi-common/lib/jsonUtil.d.ts | 21 + public/libs/zhi-common/lib/markdownUtil.d.ts | 23 + .../lib/md-adaptor/LuteAdaptor.d.ts | 60 + .../lib/md-adaptor/MarkdownAdaptor.d.ts | 20 + .../lib/md-adaptor/ShowdownAdaptor.d.ts | 16 + .../zhi-common/lib/models/categoryInfo.d.ts | 39 + .../zhi-common/lib/models/mediaObject.d.ts | 42 + public/libs/zhi-common/lib/models/post.d.ts | 70 + .../zhi-common/lib/models/siteConfig.d.ts | 44 + .../libs/zhi-common/lib/models/userBlog.d.ts | 29 + public/libs/zhi-common/lib/objectUtil.d.ts | 16 + public/libs/zhi-common/lib/strUtil.d.ts | 59 + .../zhi-common/lib/utils/ZhiBlogApiUtil.d.ts | 13 + public/libs/zhi-common/lib/versionUtil.d.ts | 37 + public/libs/zhi-common/lib/zhi-blog-api.d.ts | 2 + public/libs/zhi-common/lib/zhi-common.d.ts | 25 + public/libs/zhi-common/package.json | 41 + public/libs/zhi-device/README.md | 62 + public/libs/zhi-device/deviceDetection.d.ts | 21 + public/libs/zhi-device/index.d.ts | 11 + public/libs/zhi-device/index.js | 430 + .../libs/zhi-device/lib/basePathTypeEnum.d.ts | 31 + public/libs/zhi-device/lib/browserUtil.d.ts | 84 + .../libs/zhi-device/lib/deviceTypeEnum.d.ts | 42 + public/libs/zhi-device/lib/siyuanDevice.d.ts | 153 + public/libs/zhi-device/package.json | 35 + public/libs/zhi-electron/README.md | 9 + public/libs/zhi-electron/index.d.ts | 3 + public/libs/zhi-electron/index.d.ts.map | 1 + public/libs/zhi-electron/index.js | 519 + .../lib/browser-window/WindowManager.d.ts.map | 1 + .../lib/browser-window/index.d.ts | 23 + .../lib/browser-window/index.d.ts.map | 1 + public/libs/zhi-env/README.md | 150 + public/libs/zhi-env/index.d.ts | 8 + public/libs/zhi-env/index.js | 88 + public/libs/zhi-env/lib/EnvConstants.d.ts | 30 + public/libs/zhi-env/lib/zhi-env.d.ts | 51 + public/libs/zhi-env/package.json | 33 + public/libs/zhi-log/README.md | 60 + public/libs/zhi-log/index.d.ts | 47 + public/libs/zhi-log/index.js | 998 ++ public/libs/zhi-log/lib/crossChalk.d.ts | 23 + public/libs/zhi-log/lib/defaultLogger.d.ts | 52 + public/libs/zhi-log/lib/envHelper.d.ts | 27 + .../lib/factory/abstractLogFactory.d.ts | 30 + .../zhi-log/lib/factory/customLogFactory.d.ts | 22 + public/libs/zhi-log/lib/logConstants.d.ts | 42 + public/libs/zhi-log/lib/logger.d.ts | 37 + public/libs/zhi-log/package.json | 42 + public/libs/zhi-publisher-sdk/README.md | 41 + public/libs/zhi-publisher-sdk/index.d.ts | 2 + public/libs/zhi-publisher-sdk/index.js | 47 + public/libs/zhi-publisher-sdk/package.json | 33 + .../libs/zhi-publisher-sdk/publish-sdk.d.ts | 41 + public/libs/zhi-siyuan-api/README.md | 49 + public/libs/zhi-siyuan-api/index.d.ts | 9 + public/libs/zhi-siyuan-api/index.js | 10474 ++++++++++++++++ .../zhi-siyuan-api/lib/ISiyuanKernelApi.d.ts | 37 + .../zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts | 30 + .../zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts | 34 + public/libs/zhi-siyuan-api/lib/siyuanApi.d.ts | 25 + .../zhi-siyuan-api/lib/siyuanClientApi.d.ts | 3 + .../libs/zhi-siyuan-api/lib/siyuanConfig.d.ts | 32 + .../zhi-siyuan-api/lib/siyuanConstants.d.ts | 18 + .../zhi-siyuan-api/lib/siyuanKernelApi.d.ts | 263 + .../zhi-siyuan-api/lib/siyuanPlaceholder.d.ts | 7 + .../zhi-siyuan-api/lib/zhi-siyuan-api.d.ts | 2 + public/libs/zhi-siyuan-api/package.json | 40 + public/polyfills/fs.js | 123 + public/polyfills/mimeDb.js | 8540 +++++++++++++ public/polyfills/path.js | 519 + src/App.vue | 10 + src/app-instance.ts | 84 + src/components/publish/PublishIndex.vue | 34 +- src/layouts/default/DefaultFooter.vue | 2 +- src/loader.ts | 72 + src/main.ts | 14 +- src/tools.ts | 27 + src/utils/constants.ts | 1 + src/utils/inject-keys.ts | 32 + src/utils/utils.ts | 74 + tsconfig.json | 2 +- 118 files changed, 44329 insertions(+), 101 deletions(-) create mode 100644 public/libs/zhi-blog-api/README.md create mode 100644 public/libs/zhi-blog-api/index.d.ts create mode 100644 public/libs/zhi-blog-api/index.js create mode 100644 public/libs/zhi-blog-api/lib/IBlogApi.d.ts create mode 100644 public/libs/zhi-blog-api/lib/blogAdaptor.d.ts create mode 100644 public/libs/zhi-blog-api/lib/blogApi.d.ts create mode 100644 public/libs/zhi-blog-api/lib/blogConfig.d.ts create mode 100644 public/libs/zhi-blog-api/lib/blogConstants.d.ts create mode 100644 public/libs/zhi-blog-api/lib/blogPlaceholder.d.ts create mode 100644 public/libs/zhi-blog-api/lib/enums/blogTypeEnum.d.ts create mode 100644 public/libs/zhi-blog-api/lib/enums/postStatusEnum.d.ts create mode 100644 public/libs/zhi-blog-api/lib/models/categoryInfo.d.ts create mode 100644 public/libs/zhi-blog-api/lib/models/mediaObject.d.ts create mode 100644 public/libs/zhi-blog-api/lib/models/post.d.ts create mode 100644 public/libs/zhi-blog-api/lib/models/siteConfig.d.ts create mode 100644 public/libs/zhi-blog-api/lib/models/userBlog.d.ts create mode 100644 public/libs/zhi-blog-api/lib/utils/ZhiBlogApiUtil.d.ts create mode 100644 public/libs/zhi-blog-api/lib/zhi-blog-api.d.ts create mode 100644 public/libs/zhi-blog-api/package.json create mode 100644 public/libs/zhi-common/README.md create mode 100644 public/libs/zhi-common/index.d.ts create mode 100644 public/libs/zhi-common/index.js create mode 100644 public/libs/zhi-common/lib/IBlogApi.d.ts create mode 100644 public/libs/zhi-common/lib/ZhiCommonUtil.d.ts create mode 100644 public/libs/zhi-common/lib/ZhiUtil.d.ts create mode 100644 public/libs/zhi-common/lib/blogApi.d.ts create mode 100644 public/libs/zhi-common/lib/blogConfig.d.ts create mode 100644 public/libs/zhi-common/lib/blogConstants.d.ts create mode 100644 public/libs/zhi-common/lib/blogPlaceholder.d.ts create mode 100644 public/libs/zhi-common/lib/dateUtil.d.ts create mode 100644 public/libs/zhi-common/lib/enums/blogTypeEnum.d.ts create mode 100644 public/libs/zhi-common/lib/enums/postStatusEnum.d.ts create mode 100644 public/libs/zhi-common/lib/htmlUtil.d.ts create mode 100644 public/libs/zhi-common/lib/jsonUtil.d.ts create mode 100644 public/libs/zhi-common/lib/markdownUtil.d.ts create mode 100644 public/libs/zhi-common/lib/md-adaptor/LuteAdaptor.d.ts create mode 100644 public/libs/zhi-common/lib/md-adaptor/MarkdownAdaptor.d.ts create mode 100644 public/libs/zhi-common/lib/md-adaptor/ShowdownAdaptor.d.ts create mode 100644 public/libs/zhi-common/lib/models/categoryInfo.d.ts create mode 100644 public/libs/zhi-common/lib/models/mediaObject.d.ts create mode 100644 public/libs/zhi-common/lib/models/post.d.ts create mode 100644 public/libs/zhi-common/lib/models/siteConfig.d.ts create mode 100644 public/libs/zhi-common/lib/models/userBlog.d.ts create mode 100644 public/libs/zhi-common/lib/objectUtil.d.ts create mode 100644 public/libs/zhi-common/lib/strUtil.d.ts create mode 100644 public/libs/zhi-common/lib/utils/ZhiBlogApiUtil.d.ts create mode 100644 public/libs/zhi-common/lib/versionUtil.d.ts create mode 100644 public/libs/zhi-common/lib/zhi-blog-api.d.ts create mode 100644 public/libs/zhi-common/lib/zhi-common.d.ts create mode 100644 public/libs/zhi-common/package.json create mode 100644 public/libs/zhi-device/README.md create mode 100644 public/libs/zhi-device/deviceDetection.d.ts create mode 100644 public/libs/zhi-device/index.d.ts create mode 100644 public/libs/zhi-device/index.js create mode 100644 public/libs/zhi-device/lib/basePathTypeEnum.d.ts create mode 100644 public/libs/zhi-device/lib/browserUtil.d.ts create mode 100644 public/libs/zhi-device/lib/deviceTypeEnum.d.ts create mode 100644 public/libs/zhi-device/lib/siyuanDevice.d.ts create mode 100644 public/libs/zhi-device/package.json create mode 100644 public/libs/zhi-electron/README.md create mode 100644 public/libs/zhi-electron/index.d.ts create mode 100644 public/libs/zhi-electron/index.d.ts.map create mode 100644 public/libs/zhi-electron/index.js create mode 100644 public/libs/zhi-electron/lib/browser-window/WindowManager.d.ts.map create mode 100644 public/libs/zhi-electron/lib/browser-window/index.d.ts create mode 100644 public/libs/zhi-electron/lib/browser-window/index.d.ts.map create mode 100644 public/libs/zhi-env/README.md create mode 100644 public/libs/zhi-env/index.d.ts create mode 100644 public/libs/zhi-env/index.js create mode 100644 public/libs/zhi-env/lib/EnvConstants.d.ts create mode 100644 public/libs/zhi-env/lib/zhi-env.d.ts create mode 100644 public/libs/zhi-env/package.json create mode 100644 public/libs/zhi-log/README.md create mode 100644 public/libs/zhi-log/index.d.ts create mode 100644 public/libs/zhi-log/index.js create mode 100644 public/libs/zhi-log/lib/crossChalk.d.ts create mode 100644 public/libs/zhi-log/lib/defaultLogger.d.ts create mode 100644 public/libs/zhi-log/lib/envHelper.d.ts create mode 100644 public/libs/zhi-log/lib/factory/abstractLogFactory.d.ts create mode 100644 public/libs/zhi-log/lib/factory/customLogFactory.d.ts create mode 100644 public/libs/zhi-log/lib/logConstants.d.ts create mode 100644 public/libs/zhi-log/lib/logger.d.ts create mode 100644 public/libs/zhi-log/package.json create mode 100644 public/libs/zhi-publisher-sdk/README.md create mode 100644 public/libs/zhi-publisher-sdk/index.d.ts create mode 100644 public/libs/zhi-publisher-sdk/index.js create mode 100644 public/libs/zhi-publisher-sdk/package.json create mode 100644 public/libs/zhi-publisher-sdk/publish-sdk.d.ts create mode 100644 public/libs/zhi-siyuan-api/README.md create mode 100644 public/libs/zhi-siyuan-api/index.d.ts create mode 100644 public/libs/zhi-siyuan-api/index.js create mode 100644 public/libs/zhi-siyuan-api/lib/ISiyuanKernelApi.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/siyuanApi.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/siyuanClientApi.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/siyuanConfig.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/siyuanConstants.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/siyuanKernelApi.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/siyuanPlaceholder.d.ts create mode 100644 public/libs/zhi-siyuan-api/lib/zhi-siyuan-api.d.ts create mode 100644 public/libs/zhi-siyuan-api/package.json create mode 100644 public/polyfills/fs.js create mode 100644 public/polyfills/mimeDb.js create mode 100644 public/polyfills/path.js create mode 100644 src/app-instance.ts create mode 100644 src/loader.ts create mode 100644 src/tools.ts create mode 100644 src/utils/inject-keys.ts create mode 100644 src/utils/utils.ts diff --git a/package.json b/package.json index 5fd24df..ee06fca 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "minimist": "^1.2.8", "rollup-plugin-livereload": "^2.0.5", "ts-node": "^10.9.1", - "typescript": "^5.0.2", + "typescript": "^5.0.4", "vite": "^4.3.2", "vite-plugin-html": "^3.2.0", "vue-tsc": "^1.4.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c59989d..891590e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,7 +17,7 @@ dependencies: devDependencies: '@terwer/eslint-config-custom': specifier: ^1.2.0 - version: 1.2.0(@nuxt/eslint-config@0.1.1)(@typescript-eslint/eslint-plugin@5.59.6)(astro-eslint-parser@0.13.3)(eslint-config-prettier@8.8.0)(eslint-config-turbo@1.9.8)(eslint-plugin-prettier@4.2.1)(eslint-plugin-svelte@2.29.0)(eslint-plugin-vue@9.13.0)(eslint@8.41.0)(prettier-plugin-svelte@2.10.0)(prettier@2.8.8)(typescript@5.0.2) + version: 1.2.0(@nuxt/eslint-config@0.1.1)(@typescript-eslint/eslint-plugin@5.59.7)(astro-eslint-parser@0.13.3)(eslint-config-prettier@8.8.0)(eslint-config-turbo@1.9.8)(eslint-plugin-prettier@4.2.1)(eslint-plugin-svelte@2.29.0)(eslint-plugin-vue@9.14.0)(eslint@8.41.0)(prettier-plugin-svelte@2.10.0)(prettier@2.8.8)(typescript@5.0.4) '@types/node': specifier: '18' version: 18.16.14 @@ -35,10 +35,10 @@ devDependencies: version: 2.0.5 ts-node: specifier: ^10.9.1 - version: 10.9.1(@types/node@18.16.14)(typescript@5.0.2) + version: 10.9.1(@types/node@18.16.14)(typescript@5.0.4) typescript: - specifier: ^5.0.2 - version: 5.0.2 + specifier: ^5.0.4 + version: 5.0.4 vite: specifier: ^4.3.2 version: 4.3.2(@types/node@18.16.14) @@ -47,7 +47,7 @@ devDependencies: version: 3.2.0(vite@4.3.2) vue-tsc: specifier: ^1.4.2 - version: 1.4.2(typescript@5.0.2) + version: 1.4.2(typescript@5.0.4) packages: @@ -465,10 +465,10 @@ packages: eslint: ^8.29.0 dependencies: '@rushstack/eslint-patch': 1.3.0 - '@typescript-eslint/eslint-plugin': 5.59.6(@typescript-eslint/parser@5.59.6)(eslint@8.41.0)(typescript@4.9.5) - '@typescript-eslint/parser': 5.59.6(eslint@8.41.0)(typescript@4.9.5) + '@typescript-eslint/eslint-plugin': 5.59.7(@typescript-eslint/parser@5.59.7)(eslint@8.41.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.59.7(eslint@8.41.0)(typescript@4.9.5) eslint: 8.41.0 - eslint-plugin-vue: 9.13.0(eslint@8.41.0) + eslint-plugin-vue: 9.14.0(eslint@8.41.0) typescript: 4.9.5 transitivePeerDependencies: - supports-color @@ -502,7 +502,7 @@ packages: resolution: {integrity: sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ==} dev: false - /@terwer/eslint-config-custom@1.2.0(@nuxt/eslint-config@0.1.1)(@typescript-eslint/eslint-plugin@5.59.6)(astro-eslint-parser@0.13.3)(eslint-config-prettier@8.8.0)(eslint-config-turbo@1.9.8)(eslint-plugin-prettier@4.2.1)(eslint-plugin-svelte@2.29.0)(eslint-plugin-vue@9.13.0)(eslint@8.41.0)(prettier-plugin-svelte@2.10.0)(prettier@2.8.8)(typescript@5.0.2): + /@terwer/eslint-config-custom@1.2.0(@nuxt/eslint-config@0.1.1)(@typescript-eslint/eslint-plugin@5.59.7)(astro-eslint-parser@0.13.3)(eslint-config-prettier@8.8.0)(eslint-config-turbo@1.9.8)(eslint-plugin-prettier@4.2.1)(eslint-plugin-svelte@2.29.0)(eslint-plugin-vue@9.14.0)(eslint@8.41.0)(prettier-plugin-svelte@2.10.0)(prettier@2.8.8)(typescript@5.0.4): resolution: {integrity: sha512-gygsswnGgCsYvhEsLNgdjA8DZidzWFj6i8sfGJYzOEk2Bwc1o7dteis5e5+LBIeQhEPHuvKGUiaSfcqdNL8qIA==} peerDependencies: '@nuxt/eslint-config': ^0.1.1 @@ -519,17 +519,17 @@ packages: typescript: ^5.0.4 dependencies: '@nuxt/eslint-config': 0.1.1(eslint@8.41.0) - '@typescript-eslint/eslint-plugin': 5.59.6(@typescript-eslint/parser@5.59.6)(eslint@8.41.0)(typescript@5.0.2) + '@typescript-eslint/eslint-plugin': 5.59.7(@typescript-eslint/parser@5.59.7)(eslint@8.41.0)(typescript@5.0.4) astro-eslint-parser: 0.13.3 eslint: 8.41.0 eslint-config-prettier: 8.8.0(eslint@8.41.0) eslint-config-turbo: 1.9.8(eslint@8.41.0) eslint-plugin-prettier: 4.2.1(eslint-config-prettier@8.8.0)(eslint@8.41.0)(prettier@2.8.8) eslint-plugin-svelte: 2.29.0(eslint@8.41.0)(svelte@3.59.1)(ts-node@10.9.1) - eslint-plugin-vue: 9.13.0(eslint@8.41.0) + eslint-plugin-vue: 9.14.0(eslint@8.41.0) prettier: 2.8.8 prettier-plugin-svelte: 2.10.0(prettier@2.8.8)(svelte@3.59.1) - typescript: 5.0.2 + typescript: 5.0.4 dev: true /@tsconfig/node10@1.0.9: @@ -574,8 +574,8 @@ packages: resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==} dev: false - /@typescript-eslint/eslint-plugin@5.59.6(@typescript-eslint/parser@5.59.6)(eslint@8.41.0)(typescript@4.9.5): - resolution: {integrity: sha512-sXtOgJNEuRU5RLwPUb1jxtToZbgvq3M6FPpY4QENxoOggK+UpTxUBpj6tD8+Qh2g46Pi9We87E+eHnUw8YcGsw==} + /@typescript-eslint/eslint-plugin@5.59.7(@typescript-eslint/parser@5.59.7)(eslint@8.41.0)(typescript@4.9.5): + resolution: {integrity: sha512-BL+jYxUFIbuYwy+4fF86k5vdT9lT0CNJ6HtwrIvGh0PhH8s0yy5rjaKH2fDCrz5ITHy07WCzVGNvAmjJh4IJFA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -586,10 +586,10 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.59.6(eslint@8.41.0)(typescript@4.9.5) - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/type-utils': 5.59.6(eslint@8.41.0)(typescript@4.9.5) - '@typescript-eslint/utils': 5.59.6(eslint@8.41.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.59.7(eslint@8.41.0)(typescript@4.9.5) + '@typescript-eslint/scope-manager': 5.59.7 + '@typescript-eslint/type-utils': 5.59.7(eslint@8.41.0)(typescript@4.9.5) + '@typescript-eslint/utils': 5.59.7(eslint@8.41.0)(typescript@4.9.5) debug: 4.3.4 eslint: 8.41.0 grapheme-splitter: 1.0.4 @@ -602,8 +602,8 @@ packages: - supports-color dev: true - /@typescript-eslint/eslint-plugin@5.59.6(@typescript-eslint/parser@5.59.6)(eslint@8.41.0)(typescript@5.0.2): - resolution: {integrity: sha512-sXtOgJNEuRU5RLwPUb1jxtToZbgvq3M6FPpY4QENxoOggK+UpTxUBpj6tD8+Qh2g46Pi9We87E+eHnUw8YcGsw==} + /@typescript-eslint/eslint-plugin@5.59.7(@typescript-eslint/parser@5.59.7)(eslint@8.41.0)(typescript@5.0.4): + resolution: {integrity: sha512-BL+jYxUFIbuYwy+4fF86k5vdT9lT0CNJ6HtwrIvGh0PhH8s0yy5rjaKH2fDCrz5ITHy07WCzVGNvAmjJh4IJFA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -614,24 +614,24 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.59.6(eslint@8.41.0)(typescript@5.0.2) - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/type-utils': 5.59.6(eslint@8.41.0)(typescript@5.0.2) - '@typescript-eslint/utils': 5.59.6(eslint@8.41.0)(typescript@5.0.2) + '@typescript-eslint/parser': 5.59.7(eslint@8.41.0)(typescript@5.0.4) + '@typescript-eslint/scope-manager': 5.59.7 + '@typescript-eslint/type-utils': 5.59.7(eslint@8.41.0)(typescript@5.0.4) + '@typescript-eslint/utils': 5.59.7(eslint@8.41.0)(typescript@5.0.4) debug: 4.3.4 eslint: 8.41.0 grapheme-splitter: 1.0.4 ignore: 5.2.4 natural-compare-lite: 1.4.0 semver: 7.5.1 - tsutils: 3.21.0(typescript@5.0.2) - typescript: 5.0.2 + tsutils: 3.21.0(typescript@5.0.4) + typescript: 5.0.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@5.59.6(eslint@8.41.0)(typescript@4.9.5): - resolution: {integrity: sha512-7pCa6al03Pv1yf/dUg/s1pXz/yGMUBAw5EeWqNTFiSueKvRNonze3hma3lhdsOrQcaOXhbk5gKu2Fludiho9VA==} + /@typescript-eslint/parser@5.59.7(eslint@8.41.0)(typescript@4.9.5): + resolution: {integrity: sha512-VhpsIEuq/8i5SF+mPg9jSdIwgMBBp0z9XqjiEay+81PYLJuroN+ET1hM5IhkiYMJd9MkTz8iJLt7aaGAgzWUbQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -640,9 +640,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/typescript-estree': 5.59.6(typescript@4.9.5) + '@typescript-eslint/scope-manager': 5.59.7 + '@typescript-eslint/types': 5.59.7 + '@typescript-eslint/typescript-estree': 5.59.7(typescript@4.9.5) debug: 4.3.4 eslint: 8.41.0 typescript: 4.9.5 @@ -650,8 +650,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@5.59.6(eslint@8.41.0)(typescript@5.0.2): - resolution: {integrity: sha512-7pCa6al03Pv1yf/dUg/s1pXz/yGMUBAw5EeWqNTFiSueKvRNonze3hma3lhdsOrQcaOXhbk5gKu2Fludiho9VA==} + /@typescript-eslint/parser@5.59.7(eslint@8.41.0)(typescript@5.0.4): + resolution: {integrity: sha512-VhpsIEuq/8i5SF+mPg9jSdIwgMBBp0z9XqjiEay+81PYLJuroN+ET1hM5IhkiYMJd9MkTz8iJLt7aaGAgzWUbQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -660,26 +660,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/typescript-estree': 5.59.6(typescript@5.0.2) + '@typescript-eslint/scope-manager': 5.59.7 + '@typescript-eslint/types': 5.59.7 + '@typescript-eslint/typescript-estree': 5.59.7(typescript@5.0.4) debug: 4.3.4 eslint: 8.41.0 - typescript: 5.0.2 + typescript: 5.0.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager@5.59.6: - resolution: {integrity: sha512-gLbY3Le9Dxcb8KdpF0+SJr6EQ+hFGYFl6tVY8VxLPFDfUZC7BHFw+Vq7bM5lE9DwWPfx4vMWWTLGXgpc0mAYyQ==} + /@typescript-eslint/scope-manager@5.59.7: + resolution: {integrity: sha512-FL6hkYWK9zBGdxT2wWEd2W8ocXMu3K94i3gvMrjXpx+koFYdYV7KprKfirpgY34vTGzEPPuKoERpP8kD5h7vZQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/visitor-keys': 5.59.6 + '@typescript-eslint/types': 5.59.7 + '@typescript-eslint/visitor-keys': 5.59.7 dev: true - /@typescript-eslint/type-utils@5.59.6(eslint@8.41.0)(typescript@4.9.5): - resolution: {integrity: sha512-A4tms2Mp5yNvLDlySF+kAThV9VTBPCvGf0Rp8nl/eoDX9Okun8byTKoj3fJ52IJitjWOk0fKPNQhXEB++eNozQ==} + /@typescript-eslint/type-utils@5.59.7(eslint@8.41.0)(typescript@4.9.5): + resolution: {integrity: sha512-ozuz/GILuYG7osdY5O5yg0QxXUAEoI4Go3Do5xeu+ERH9PorHBPSdvD3Tjp2NN2bNLh1NJQSsQu2TPu/Ly+HaQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -688,8 +688,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.59.6(typescript@4.9.5) - '@typescript-eslint/utils': 5.59.6(eslint@8.41.0)(typescript@4.9.5) + '@typescript-eslint/typescript-estree': 5.59.7(typescript@4.9.5) + '@typescript-eslint/utils': 5.59.7(eslint@8.41.0)(typescript@4.9.5) debug: 4.3.4 eslint: 8.41.0 tsutils: 3.21.0(typescript@4.9.5) @@ -698,8 +698,8 @@ packages: - supports-color dev: true - /@typescript-eslint/type-utils@5.59.6(eslint@8.41.0)(typescript@5.0.2): - resolution: {integrity: sha512-A4tms2Mp5yNvLDlySF+kAThV9VTBPCvGf0Rp8nl/eoDX9Okun8byTKoj3fJ52IJitjWOk0fKPNQhXEB++eNozQ==} + /@typescript-eslint/type-utils@5.59.7(eslint@8.41.0)(typescript@5.0.4): + resolution: {integrity: sha512-ozuz/GILuYG7osdY5O5yg0QxXUAEoI4Go3Do5xeu+ERH9PorHBPSdvD3Tjp2NN2bNLh1NJQSsQu2TPu/Ly+HaQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -708,23 +708,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.59.6(typescript@5.0.2) - '@typescript-eslint/utils': 5.59.6(eslint@8.41.0)(typescript@5.0.2) + '@typescript-eslint/typescript-estree': 5.59.7(typescript@5.0.4) + '@typescript-eslint/utils': 5.59.7(eslint@8.41.0)(typescript@5.0.4) debug: 4.3.4 eslint: 8.41.0 - tsutils: 3.21.0(typescript@5.0.2) - typescript: 5.0.2 + tsutils: 3.21.0(typescript@5.0.4) + typescript: 5.0.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types@5.59.6: - resolution: {integrity: sha512-tH5lBXZI7T2MOUgOWFdVNUILsI02shyQvfzG9EJkoONWugCG77NDDa1EeDGw7oJ5IvsTAAGVV8I3Tk2PNu9QfA==} + /@typescript-eslint/types@5.59.7: + resolution: {integrity: sha512-UnVS2MRRg6p7xOSATscWkKjlf/NDKuqo5TdbWck6rIRZbmKpVNTLALzNvcjIfHBE7736kZOFc/4Z3VcZwuOM/A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree@5.59.6(typescript@4.9.5): - resolution: {integrity: sha512-vW6JP3lMAs/Tq4KjdI/RiHaaJSO7IUsbkz17it/Rl9Q+WkQ77EOuOnlbaU8kKfVIOJxMhnRiBG+olE7f3M16DA==} + /@typescript-eslint/typescript-estree@5.59.7(typescript@4.9.5): + resolution: {integrity: sha512-4A1NtZ1I3wMN2UGDkU9HMBL+TIQfbrh4uS0WDMMpf3xMRursDbqEf1ahh6vAAe3mObt8k3ZATnezwG4pdtWuUQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -732,8 +732,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/visitor-keys': 5.59.6 + '@typescript-eslint/types': 5.59.7 + '@typescript-eslint/visitor-keys': 5.59.7 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -744,8 +744,8 @@ packages: - supports-color dev: true - /@typescript-eslint/typescript-estree@5.59.6(typescript@5.0.2): - resolution: {integrity: sha512-vW6JP3lMAs/Tq4KjdI/RiHaaJSO7IUsbkz17it/Rl9Q+WkQ77EOuOnlbaU8kKfVIOJxMhnRiBG+olE7f3M16DA==} + /@typescript-eslint/typescript-estree@5.59.7(typescript@5.0.4): + resolution: {integrity: sha512-4A1NtZ1I3wMN2UGDkU9HMBL+TIQfbrh4uS0WDMMpf3xMRursDbqEf1ahh6vAAe3mObt8k3ZATnezwG4pdtWuUQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -753,20 +753,20 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/visitor-keys': 5.59.6 + '@typescript-eslint/types': 5.59.7 + '@typescript-eslint/visitor-keys': 5.59.7 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.1 - tsutils: 3.21.0(typescript@5.0.2) - typescript: 5.0.2 + tsutils: 3.21.0(typescript@5.0.4) + typescript: 5.0.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@5.59.6(eslint@8.41.0)(typescript@4.9.5): - resolution: {integrity: sha512-vzaaD6EXbTS29cVH0JjXBdzMt6VBlv+hE31XktDRMX1j3462wZCJa7VzO2AxXEXcIl8GQqZPcOPuW/Z1tZVogg==} + /@typescript-eslint/utils@5.59.7(eslint@8.41.0)(typescript@4.9.5): + resolution: {integrity: sha512-yCX9WpdQKaLufz5luG4aJbOpdXf/fjwGMcLFXZVPUz3QqLirG5QcwwnIHNf8cjLjxK4qtzTO8udUtMQSAToQnQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -774,9 +774,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.41.0) '@types/json-schema': 7.0.11 '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/typescript-estree': 5.59.6(typescript@4.9.5) + '@typescript-eslint/scope-manager': 5.59.7 + '@typescript-eslint/types': 5.59.7 + '@typescript-eslint/typescript-estree': 5.59.7(typescript@4.9.5) eslint: 8.41.0 eslint-scope: 5.1.1 semver: 7.5.1 @@ -785,8 +785,8 @@ packages: - typescript dev: true - /@typescript-eslint/utils@5.59.6(eslint@8.41.0)(typescript@5.0.2): - resolution: {integrity: sha512-vzaaD6EXbTS29cVH0JjXBdzMt6VBlv+hE31XktDRMX1j3462wZCJa7VzO2AxXEXcIl8GQqZPcOPuW/Z1tZVogg==} + /@typescript-eslint/utils@5.59.7(eslint@8.41.0)(typescript@5.0.4): + resolution: {integrity: sha512-yCX9WpdQKaLufz5luG4aJbOpdXf/fjwGMcLFXZVPUz3QqLirG5QcwwnIHNf8cjLjxK4qtzTO8udUtMQSAToQnQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -794,9 +794,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.41.0) '@types/json-schema': 7.0.11 '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/types': 5.59.6 - '@typescript-eslint/typescript-estree': 5.59.6(typescript@5.0.2) + '@typescript-eslint/scope-manager': 5.59.7 + '@typescript-eslint/types': 5.59.7 + '@typescript-eslint/typescript-estree': 5.59.7(typescript@5.0.4) eslint: 8.41.0 eslint-scope: 5.1.1 semver: 7.5.1 @@ -805,11 +805,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys@5.59.6: - resolution: {integrity: sha512-zEfbFLzB9ETcEJ4HZEEsCR9HHeNku5/Qw1jSS5McYJv5BR+ftYXwFFAH5Al+xkGaZEqowMwl7uoJjQb1YSPF8Q==} + /@typescript-eslint/visitor-keys@5.59.7: + resolution: {integrity: sha512-tyN+X2jvMslUszIiYbF0ZleP+RqQsFVpGrKI6e0Eet1w8WmhsAtmzaqm8oM8WJQ1ysLwhnsK/4hYHJjOgJVfQQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.59.6 + '@typescript-eslint/types': 5.59.7 eslint-visitor-keys: 3.4.1 dev: true @@ -836,13 +836,13 @@ packages: muggle-string: 0.2.2 dev: true - /@volar/typescript@1.4.0(typescript@5.0.2): + /@volar/typescript@1.4.0(typescript@5.0.4): resolution: {integrity: sha512-r6OMHj/LeS86iQy3LEjjS+qpmHr9I7BiH8gAwp9WEJP76FHlMPi/EPDQxhf3VcMQ/w6Pi5aBczqI+I3akr9t4g==} peerDependencies: typescript: '*' dependencies: '@volar/language-core': 1.4.0 - typescript: 5.0.2 + typescript: 5.0.4 dev: true /@volar/vue-language-core@1.4.2: @@ -859,10 +859,10 @@ packages: vue-template-compiler: 2.7.14 dev: true - /@volar/vue-typescript@1.4.2(typescript@5.0.2): + /@volar/vue-typescript@1.4.2(typescript@5.0.4): resolution: {integrity: sha512-A1m1cSvS0Pf7Sm9q0S/1riV4RQQeH2h5gGo0vR9fGK2SrAStvh4HuuxPOX4N9uMDbRsNMhC0ILXwtlvjQ/IXJA==} dependencies: - '@volar/typescript': 1.4.0(typescript@5.0.2) + '@volar/typescript': 1.4.0(typescript@5.0.4) '@volar/vue-language-core': 1.4.2 transitivePeerDependencies: - typescript @@ -1094,8 +1094,8 @@ packages: engines: {node: ^14.18.0 || >=16.0.0} dependencies: '@astrojs/compiler': 1.4.2 - '@typescript-eslint/scope-manager': 5.59.6 - '@typescript-eslint/types': 5.59.6 + '@typescript-eslint/scope-manager': 5.59.7 + '@typescript-eslint/types': 5.59.7 astrojs-compiler-sync: 0.3.2(@astrojs/compiler@1.4.2) debug: 4.3.4 eslint-visitor-keys: 3.4.1 @@ -1550,8 +1550,8 @@ packages: eslint: 8.41.0 dev: true - /eslint-plugin-vue@9.13.0(eslint@8.41.0): - resolution: {integrity: sha512-aBz9A8WB4wmpnVv0pYUt86cmH9EkcwWzgEwecBxMoRNhQjTL5i4sqadnwShv/hOdr8Hbl8XANGV7dtX9UQIAyA==} + /eslint-plugin-vue@9.14.0(eslint@8.41.0): + resolution: {integrity: sha512-4O7EuiqPGVQA1wYCzLvCzsBTv9JIPHLHhrf0k55DLzbwtmJbSw2TKS0G/l7pOwi9RWMSkjIT7ftChU5gZpgnJw==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.2.0 || ^7.0.0 || ^8.0.0 @@ -2375,7 +2375,7 @@ packages: dependencies: lilconfig: 2.1.0 postcss: 8.4.23 - ts-node: 10.9.1(@types/node@18.16.14)(typescript@5.0.2) + ts-node: 10.9.1(@types/node@18.16.14)(typescript@5.0.4) yaml: 1.10.2 dev: true @@ -2637,7 +2637,7 @@ packages: is-number: 7.0.0 dev: true - /ts-node@10.9.1(@types/node@18.16.14)(typescript@5.0.2): + /ts-node@10.9.1(@types/node@18.16.14)(typescript@5.0.4): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -2663,7 +2663,7 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.0.2 + typescript: 5.0.4 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true @@ -2686,14 +2686,14 @@ packages: typescript: 4.9.5 dev: true - /tsutils@3.21.0(typescript@5.0.2): + /tsutils@3.21.0(typescript@5.0.4): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 5.0.2 + typescript: 5.0.4 dev: true /type-check@0.4.0: @@ -2714,8 +2714,8 @@ packages: hasBin: true dev: true - /typescript@5.0.2: - resolution: {integrity: sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==} + /typescript@5.0.4: + resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==} engines: {node: '>=12.20'} hasBin: true dev: true @@ -2859,16 +2859,16 @@ packages: he: 1.2.0 dev: true - /vue-tsc@1.4.2(typescript@5.0.2): + /vue-tsc@1.4.2(typescript@5.0.4): resolution: {integrity: sha512-8VFjVekJuFtFG+N4rEimoR0OvNubhoTIMl2dlvbpyAD40LVPR1PN2SUc2qZPnWGGRsXZAVmFgiBHX0RB20HGyA==} hasBin: true peerDependencies: typescript: '*' dependencies: '@volar/vue-language-core': 1.4.2 - '@volar/vue-typescript': 1.4.2(typescript@5.0.2) + '@volar/vue-typescript': 1.4.2(typescript@5.0.4) semver: 7.5.1 - typescript: 5.0.2 + typescript: 5.0.4 dev: true /vue@3.2.47: diff --git a/public/libs/zhi-blog-api/README.md b/public/libs/zhi-blog-api/README.md new file mode 100644 index 0000000..aec2043 --- /dev/null +++ b/public/libs/zhi-blog-api/README.md @@ -0,0 +1,38 @@ +# zhi-blog-api + +a common blog interface + +Note: BlogApi should be implemented as a specific BlogApi, it cannot be used directly + +## Deps + +``` +├── zhi-env +├── zhi-log +``` + +## Dev + +```bash +pnpm dev -F zhi-blog-api +``` + +## Build + +```bash +pnpm build -F zhi-blog-api +``` + +## Test + +Execute the unit tests via [vitest](https://vitest.dev) + +```bash +pnpm test -F zhi-blog-api +``` + +## Publish + +```bash +pnpm publish -F zhi-blog-api --tag latest +``` \ No newline at end of file diff --git a/public/libs/zhi-blog-api/index.d.ts b/public/libs/zhi-blog-api/index.d.ts new file mode 100644 index 0000000..8b750be --- /dev/null +++ b/public/libs/zhi-blog-api/index.d.ts @@ -0,0 +1,16 @@ +import BlogConfig, { PageType, PasswordType } from "./lib/blogConfig"; +import BlogPlaceholder from "./lib/blogPlaceholder"; +import BlogApi from "./lib/blogApi"; +import BlogAdaptor from "./lib/zhi-blog-api"; +import Post from "./lib/models/post"; +import UserBlog from "./lib/models/userBlog"; +import SiteConfig from "./lib/models/siteConfig"; +import PostStatusEnum from "./lib/enums/postStatusEnum"; +import CategoryInfo from "./lib/models/categoryInfo"; +import MediaObject from "./lib/models/mediaObject"; +import BlogConstants from "./lib/blogConstants"; +import BlogTypeEnum from "./lib/enums/blogTypeEnum"; +export { BlogApi, BlogAdaptor }; +export { BlogConfig, BlogPlaceholder, PasswordType, PageType, PostStatusEnum }; +export { Post, UserBlog, SiteConfig, CategoryInfo, MediaObject }; +export { BlogConstants, BlogTypeEnum }; diff --git a/public/libs/zhi-blog-api/index.js b/public/libs/zhi-blog-api/index.js new file mode 100644 index 0000000..c3b6424 --- /dev/null +++ b/public/libs/zhi-blog-api/index.js @@ -0,0 +1,9405 @@ +var Oo = Object.defineProperty; +var Io = (e, t, n) => t in e ? Oo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; +var Y = (e, t, n) => (Io(e, typeof t != "symbol" ? t + "" : t, n), n); +var Ao = /* @__PURE__ */ ((e) => (e[e.Markdown = 0] = "Markdown", e[e.Html = 1] = "Html", e[e.Formatter = 2] = "Formatter", e[e.Markdown_And_Formatter = 3] = "Markdown_And_Formatter", e[e.MDX = 4] = "MDX", e))(Ao || {}), Ro = /* @__PURE__ */ ((e) => (e[e.PasswordType_Password = 0] = "PasswordType_Password", e[e.PasswordType_Token = 1] = "PasswordType_Token", e))(Ro || {}); +class gu { + constructor() { + /** + * 首页 + */ + Y(this, "home"); + /** + * API地址 + */ + Y(this, "apiUrl"); + /** + * 用户名 + */ + Y(this, "username"); + /** + * 密码类型 + */ + Y(this, "passwordType"); + /** + * 密码 + */ + Y(this, "password"); + /** + * 是否发布 + */ + Y(this, "apiStatus"); + /** + * 博客名(API获取) + */ + Y(this, "blogName"); + /** + * 文章别名key + */ + Y(this, "posidKey"); + /** + * 文章预览链接 + */ + Y(this, "previewUrl"); + /** + * 文章类型 + */ + Y(this, "pageType"); + /** + * 操作提示 + */ + Y(this, "placeholder"); + /** + * 是否处理标题 + * + * @protected + */ + Y(this, "fixTitle"); + this.home = "", this.apiUrl = "", this.username = "", this.passwordType = 0, this.password = "", this.apiStatus = !1, this.blogName = "", this.posidKey = "", this.previewUrl = "", this.pageType = 0, this.placeholder = void 0, this.fixTitle = !1; + } +} +class yu { + constructor() { + /** + * 首页操作提示 + */ + Y(this, "homePlaceholder"); + /** + * API 地址操作提示 + */ + Y(this, "apiUrlPlaceholder"); + /** + * 用户名操作提示 + */ + Y(this, "usernamePlaceholder"); + /** + * 密码类型操作提示 + */ + Y(this, "passwordTypePlaceholder"); + /** + * 密码操作提示 + */ + Y(this, "passwordPlaceholder"); + /** + * API状态是否正常操作提示 + */ + Y(this, "apiStatusPlaceholder"); + /** + * 博客名(API获取)操作提示 + */ + Y(this, "blogNamePlaceholder"); + /** + * 文章别名key操作提示 + */ + Y(this, "posidKeyPlaceholder"); + /** + * 文章预览链接操作提示 + */ + Y(this, "previewUrlPlaceholder"); + /** + * 文章类型操作提示 + */ + Y(this, "pageTypePlaceholder"); + this.homePlaceholder = "", this.apiUrlPlaceholder = "", this.usernamePlaceholder = "", this.passwordTypePlaceholder = "", this.passwordPlaceholder = "", this.apiStatusPlaceholder = !1, this.blogNamePlaceholder = "", this.posidKeyPlaceholder = "", this.previewUrlPlaceholder = "", this.pageTypePlaceholder = ""; + } +} +class _u { + async deletePost(t) { + throw new Error("You must implement this method in sub class"); + } + async editPost(t, n, a) { + throw new Error("You must implement this method in sub class"); + } + async getCategories() { + throw new Error("You must implement this method in sub class"); + } + async getPost(t, n) { + throw new Error("You must implement this method in sub class"); + } + async getPreviewUrl(t) { + throw new Error("You must implement this method in sub class"); + } + async getRecentPosts(t, n, a) { + throw new Error("You must implement this method in sub class"); + } + async getRecentPostsCount(t) { + throw new Error("You must implement this method in sub class"); + } + async getUsersBlogs() { + throw new Error("You must implement this method in sub class"); + } + async newMediaObject(t) { + throw new Error("You must implement this method in sub class"); + } + async newPost(t, n) { + throw new Error("You must implement this method in sub class"); + } +} +var Sn = /* @__PURE__ */ ((e) => (e.PostStatusEnum_Publish = "publish", e.PostStatusEnum_Draft = "draft", e.PostStatusEnum_Inherit = "inherit", e))(Sn || {}); +class Lo { + constructor() { + /** + * 文章ID + */ + Y(this, "postid"); + /** + * 标题 + */ + Y(this, "title"); + /** + * 逗号分隔的标签 + */ + Y(this, "mt_keywords"); + /** + * 链接 + */ + Y(this, "link"); + /** + * 永久链接 + */ + Y(this, "permalink"); + /** + * 摘要 + */ + Y(this, "shortDesc"); + /** + * 描述 + */ + Y(this, "description"); + /** + * 短评 + */ + Y(this, "mt_excerpt"); + /** + * 别名 + */ + Y(this, "wp_slug"); + /** + * 创建时间 + */ + Y(this, "dateCreated"); + /** + * 分类 + */ + Y(this, "categories"); + /** + * 更多 + */ + Y(this, "mt_text_more"); + /** + * 发布状态 + */ + Y(this, "post_status"); + /** + * 是否发布 + */ + Y(this, "isPublished"); + /** + * 发布密码 + */ + Y(this, "wp_password"); + this.postid = "", this.title = "", this.mt_keywords = "", this.permalink = "", this.description = "", this.wp_slug = "", this.dateCreated = /* @__PURE__ */ new Date(), this.categories = [], this.isPublished = !0, this.post_status = Sn.PostStatusEnum_Publish, this.wp_password = ""; + } +} +var Mo = Object.defineProperty, zo = (e, t, n) => t in e ? Mo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, $e = (e, t, n) => (zo(e, typeof t != "symbol" ? t + "" : t, n), n), jn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function xn(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var Ur = { exports: {} }, Tn = {}, Ge = {}, Rt = {}, ar = {}, se = {}, rr = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0; + class t { + } + e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; + class n extends t { + constructor(T) { + if (super(), !e.IDENTIFIER.test(T)) + throw new Error("CodeGen: name must be a valid identifier"); + this.str = T; + } + toString() { + return this.str; + } + emptyStr() { + return !1; + } + get names() { + return { [this.str]: 1 }; + } + } + e.Name = n; + class a extends t { + constructor(T) { + super(), this._items = typeof T == "string" ? [T] : T; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) + return !1; + const T = this._items[0]; + return T === "" || T === '""'; + } + get str() { + var T; + return (T = this._str) !== null && T !== void 0 ? T : this._str = this._items.reduce((R, r) => `${R}${r}`, ""); + } + get names() { + var T; + return (T = this._names) !== null && T !== void 0 ? T : this._names = this._items.reduce((R, r) => (r instanceof n && (R[r.str] = (R[r.str] || 0) + 1), R), {}); + } + } + e._Code = a, e.nil = new a(""); + function i($, ...T) { + const R = [$[0]]; + let r = 0; + for (; r < T.length; ) + b(R, T[r]), R.push($[++r]); + return new a(R); + } + e._ = i; + const l = new a("+"); + function f($, ...T) { + const R = [M($[0])]; + let r = 0; + for (; r < T.length; ) + R.push(l), b(R, T[r]), R.push(l, M($[++r])); + return k(R), new a(R); + } + e.str = f; + function b($, T) { + T instanceof a ? $.push(...T._items) : T instanceof n ? $.push(T) : $.push(S(T)); + } + e.addCodeArg = b; + function k($) { + let T = 1; + for (; T < $.length - 1; ) { + if ($[T] === l) { + const R = _($[T - 1], $[T + 1]); + if (R !== void 0) { + $.splice(T - 1, 3, R); + continue; + } + $[T++] = "+"; + } + T++; + } + } + function _($, T) { + if (T === '""') + return $; + if ($ === '""') + return T; + if (typeof $ == "string") + return T instanceof n || $[$.length - 1] !== '"' ? void 0 : typeof T != "string" ? `${$.slice(0, -1)}${T}"` : T[0] === '"' ? $.slice(0, -1) + T.slice(1) : void 0; + if (typeof T == "string" && T[0] === '"' && !($ instanceof n)) + return `"${$}${T.slice(1)}`; + } + function y($, T) { + return T.emptyStr() ? $ : $.emptyStr() ? T : f`${$}${T}`; + } + e.strConcat = y; + function S($) { + return typeof $ == "number" || typeof $ == "boolean" || $ === null ? $ : M(Array.isArray($) ? $.join(",") : $); + } + function A($) { + return new a(M($)); + } + e.stringify = A; + function M($) { + return JSON.stringify($).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); + } + e.safeStringify = M; + function O($) { + return typeof $ == "string" && e.IDENTIFIER.test($) ? new a(`.${$}`) : i`[${$}]`; + } + e.getProperty = O; + function C($) { + if (typeof $ == "string" && e.IDENTIFIER.test($)) + return new a(`${$}`); + throw new Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`); + } + e.getEsmExportName = C; + function x($) { + return new a($.toString()); + } + e.regexpCode = x; +})(rr); +var Br = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0; + const t = rr; + class n extends Error { + constructor(_) { + super(`CodeGen: "code" for ${_} not defined`), this.value = _.value; + } + } + var a; + (function(k) { + k[k.Started = 0] = "Started", k[k.Completed = 1] = "Completed"; + })(a = e.UsedValueState || (e.UsedValueState = {})), e.varKinds = { + const: new t.Name("const"), + let: new t.Name("let"), + var: new t.Name("var") + }; + class i { + constructor({ prefixes: _, parent: y } = {}) { + this._names = {}, this._prefixes = _, this._parent = y; + } + toName(_) { + return _ instanceof t.Name ? _ : this.name(_); + } + name(_) { + return new t.Name(this._newName(_)); + } + _newName(_) { + const y = this._names[_] || this._nameGroup(_); + return `${_}${y.index++}`; + } + _nameGroup(_) { + var y, S; + if (!((S = (y = this._parent) === null || y === void 0 ? void 0 : y._prefixes) === null || S === void 0) && S.has(_) || this._prefixes && !this._prefixes.has(_)) + throw new Error(`CodeGen: prefix "${_}" is not allowed in this scope`); + return this._names[_] = { prefix: _, index: 0 }; + } + } + e.Scope = i; + class l extends t.Name { + constructor(_, y) { + super(y), this.prefix = _; + } + setValue(_, { property: y, itemIndex: S }) { + this.value = _, this.scopePath = (0, t._)`.${new t.Name(y)}[${S}]`; + } + } + e.ValueScopeName = l; + const f = (0, t._)`\n`; + class b extends i { + constructor(_) { + super(_), this._values = {}, this._scope = _.scope, this.opts = { ..._, _n: _.lines ? f : t.nil }; + } + get() { + return this._scope; + } + name(_) { + return new l(_, this._newName(_)); + } + value(_, y) { + var S; + if (y.ref === void 0) + throw new Error("CodeGen: ref must be passed in value"); + const A = this.toName(_), { prefix: M } = A, O = (S = y.key) !== null && S !== void 0 ? S : y.ref; + let C = this._values[M]; + if (C) { + const T = C.get(O); + if (T) + return T; + } else + C = this._values[M] = /* @__PURE__ */ new Map(); + C.set(O, A); + const x = this._scope[M] || (this._scope[M] = []), $ = x.length; + return x[$] = y.ref, A.setValue(y, { property: M, itemIndex: $ }), A; + } + getValue(_, y) { + const S = this._values[_]; + if (S) + return S.get(y); + } + scopeRefs(_, y = this._values) { + return this._reduceValues(y, (S) => { + if (S.scopePath === void 0) + throw new Error(`CodeGen: name "${S}" has no value`); + return (0, t._)`${_}${S.scopePath}`; + }); + } + scopeCode(_ = this._values, y, S) { + return this._reduceValues(_, (A) => { + if (A.value === void 0) + throw new Error(`CodeGen: name "${A}" has no value`); + return A.value.code; + }, y, S); + } + _reduceValues(_, y, S = {}, A) { + let M = t.nil; + for (const O in _) { + const C = _[O]; + if (!C) + continue; + const x = S[O] = S[O] || /* @__PURE__ */ new Map(); + C.forEach(($) => { + if (x.has($)) + return; + x.set($, a.Started); + let T = y($); + if (T) { + const R = this.opts.es5 ? e.varKinds.var : e.varKinds.const; + M = (0, t._)`${M}${R} ${$} = ${T};${this.opts._n}`; + } else if (T = A == null ? void 0 : A($)) + M = (0, t._)`${M}${T}${this.opts._n}`; + else + throw new n($); + x.set($, a.Completed); + }); + } + return M; + } + } + e.ValueScope = b; +})(Br); +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.or = e.and = e.not = e.CodeGen = e.operators = e.varKinds = e.ValueScopeName = e.ValueScope = e.Scope = e.Name = e.regexpCode = e.stringify = e.getProperty = e.nil = e.strConcat = e.str = e._ = void 0; + const t = rr, n = Br; + var a = rr; + Object.defineProperty(e, "_", { enumerable: !0, get: function() { + return a._; + } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { + return a.str; + } }), Object.defineProperty(e, "strConcat", { enumerable: !0, get: function() { + return a.strConcat; + } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { + return a.nil; + } }), Object.defineProperty(e, "getProperty", { enumerable: !0, get: function() { + return a.getProperty; + } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { + return a.stringify; + } }), Object.defineProperty(e, "regexpCode", { enumerable: !0, get: function() { + return a.regexpCode; + } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { + return a.Name; + } }); + var i = Br; + Object.defineProperty(e, "Scope", { enumerable: !0, get: function() { + return i.Scope; + } }), Object.defineProperty(e, "ValueScope", { enumerable: !0, get: function() { + return i.ValueScope; + } }), Object.defineProperty(e, "ValueScopeName", { enumerable: !0, get: function() { + return i.ValueScopeName; + } }), Object.defineProperty(e, "varKinds", { enumerable: !0, get: function() { + return i.varKinds; + } }), e.operators = { + GT: new t._Code(">"), + GTE: new t._Code(">="), + LT: new t._Code("<"), + LTE: new t._Code("<="), + EQ: new t._Code("==="), + NEQ: new t._Code("!=="), + NOT: new t._Code("!"), + OR: new t._Code("||"), + AND: new t._Code("&&"), + ADD: new t._Code("+") + }; + class l { + optimizeNodes() { + return this; + } + optimizeNames(d, v) { + return this; + } + } + class f extends l { + constructor(d, v, I) { + super(), this.varKind = d, this.name = v, this.rhs = I; + } + render({ es5: d, _n: v }) { + const I = d ? n.varKinds.var : this.varKind, G = this.rhs === void 0 ? "" : ` = ${this.rhs}`; + return `${I} ${this.name}${G};` + v; + } + optimizeNames(d, v) { + if (d[this.name.str]) + return this.rhs && (this.rhs = D(this.rhs, d, v)), this; + } + get names() { + return this.rhs instanceof t._CodeOrName ? this.rhs.names : {}; + } + } + class b extends l { + constructor(d, v, I) { + super(), this.lhs = d, this.rhs = v, this.sideEffects = I; + } + render({ _n: d }) { + return `${this.lhs} = ${this.rhs};` + d; + } + optimizeNames(d, v) { + if (!(this.lhs instanceof t.Name && !d[this.lhs.str] && !this.sideEffects)) + return this.rhs = D(this.rhs, d, v), this; + } + get names() { + const d = this.lhs instanceof t.Name ? {} : { ...this.lhs.names }; + return F(d, this.rhs); + } + } + class k extends b { + constructor(d, v, I, G) { + super(d, I, G), this.op = v; + } + render({ _n: d }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + d; + } + } + class _ extends l { + constructor(d) { + super(), this.label = d, this.names = {}; + } + render({ _n: d }) { + return `${this.label}:` + d; + } + } + class y extends l { + constructor(d) { + super(), this.label = d, this.names = {}; + } + render({ _n: d }) { + return `break${this.label ? ` ${this.label}` : ""};` + d; + } + } + class S extends l { + constructor(d) { + super(), this.error = d; + } + render({ _n: d }) { + return `throw ${this.error};` + d; + } + get names() { + return this.error.names; + } + } + class A extends l { + constructor(d) { + super(), this.code = d; + } + render({ _n: d }) { + return `${this.code};` + d; + } + optimizeNodes() { + return `${this.code}` ? this : void 0; + } + optimizeNames(d, v) { + return this.code = D(this.code, d, v), this; + } + get names() { + return this.code instanceof t._CodeOrName ? this.code.names : {}; + } + } + class M extends l { + constructor(d = []) { + super(), this.nodes = d; + } + render(d) { + return this.nodes.reduce((v, I) => v + I.render(d), ""); + } + optimizeNodes() { + const { nodes: d } = this; + let v = d.length; + for (; v--; ) { + const I = d[v].optimizeNodes(); + Array.isArray(I) ? d.splice(v, 1, ...I) : I ? d[v] = I : d.splice(v, 1); + } + return d.length > 0 ? this : void 0; + } + optimizeNames(d, v) { + const { nodes: I } = this; + let G = I.length; + for (; G--; ) { + const K = I[G]; + K.optimizeNames(d, v) || (q(d, K.names), I.splice(G, 1)); + } + return I.length > 0 ? this : void 0; + } + get names() { + return this.nodes.reduce((d, v) => V(d, v.names), {}); + } + } + class O extends M { + render(d) { + return "{" + d._n + super.render(d) + "}" + d._n; + } + } + class C extends M { + } + class x extends O { + } + x.kind = "else"; + class $ extends O { + constructor(d, v) { + super(v), this.condition = d; + } + render(d) { + let v = `if(${this.condition})` + super.render(d); + return this.else && (v += "else " + this.else.render(d)), v; + } + optimizeNodes() { + super.optimizeNodes(); + const d = this.condition; + if (d === !0) + return this.nodes; + let v = this.else; + if (v) { + const I = v.optimizeNodes(); + v = this.else = Array.isArray(I) ? new x(I) : I; + } + if (v) + return d === !1 ? v instanceof $ ? v : v.nodes : this.nodes.length ? this : new $(g(d), v instanceof $ ? [v] : v.nodes); + if (!(d === !1 || !this.nodes.length)) + return this; + } + optimizeNames(d, v) { + var I; + if (this.else = (I = this.else) === null || I === void 0 ? void 0 : I.optimizeNames(d, v), !!(super.optimizeNames(d, v) || this.else)) + return this.condition = D(this.condition, d, v), this; + } + get names() { + const d = super.names; + return F(d, this.condition), this.else && V(d, this.else.names), d; + } + } + $.kind = "if"; + class T extends O { + } + T.kind = "for"; + class R extends T { + constructor(d) { + super(), this.iteration = d; + } + render(d) { + return `for(${this.iteration})` + super.render(d); + } + optimizeNames(d, v) { + if (super.optimizeNames(d, v)) + return this.iteration = D(this.iteration, d, v), this; + } + get names() { + return V(super.names, this.iteration.names); + } + } + class r extends T { + constructor(d, v, I, G) { + super(), this.varKind = d, this.name = v, this.from = I, this.to = G; + } + render(d) { + const v = d.es5 ? n.varKinds.var : this.varKind, { name: I, from: G, to: K } = this; + return `for(${v} ${I}=${G}; ${I}<${K}; ${I}++)` + super.render(d); + } + get names() { + const d = F(super.names, this.from); + return F(d, this.to); + } + } + class s extends T { + constructor(d, v, I, G) { + super(), this.loop = d, this.varKind = v, this.name = I, this.iterable = G; + } + render(d) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(d); + } + optimizeNames(d, v) { + if (super.optimizeNames(d, v)) + return this.iterable = D(this.iterable, d, v), this; + } + get names() { + return V(super.names, this.iterable.names); + } + } + class o extends O { + constructor(d, v, I) { + super(), this.name = d, this.args = v, this.async = I; + } + render(d) { + return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(d); + } + } + o.kind = "func"; + class c extends M { + render(d) { + return "return " + super.render(d); + } + } + c.kind = "return"; + class u extends O { + render(d) { + let v = "try" + super.render(d); + return this.catch && (v += this.catch.render(d)), this.finally && (v += this.finally.render(d)), v; + } + optimizeNodes() { + var d, v; + return super.optimizeNodes(), (d = this.catch) === null || d === void 0 || d.optimizeNodes(), (v = this.finally) === null || v === void 0 || v.optimizeNodes(), this; + } + optimizeNames(d, v) { + var I, G; + return super.optimizeNames(d, v), (I = this.catch) === null || I === void 0 || I.optimizeNames(d, v), (G = this.finally) === null || G === void 0 || G.optimizeNames(d, v), this; + } + get names() { + const d = super.names; + return this.catch && V(d, this.catch.names), this.finally && V(d, this.finally.names), d; + } + } + class m extends O { + constructor(d) { + super(), this.error = d; + } + render(d) { + return `catch(${this.error})` + super.render(d); + } + } + m.kind = "catch"; + class p extends O { + render(d) { + return "finally" + super.render(d); + } + } + p.kind = "finally"; + class j { + constructor(d, v = {}) { + this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...v, _n: v.lines ? ` +` : "" }, this._extScope = d, this._scope = new n.Scope({ parent: d }), this._nodes = [new C()]; + } + toString() { + return this._root.render(this.opts); + } + // returns unique name in the internal scope + name(d) { + return this._scope.name(d); + } + // reserves unique name in the external scope + scopeName(d) { + return this._extScope.name(d); + } + // reserves unique name in the external scope and assigns value to it + scopeValue(d, v) { + const I = this._extScope.value(d, v); + return (this._values[I.prefix] || (this._values[I.prefix] = /* @__PURE__ */ new Set())).add(I), I; + } + getScopeValue(d, v) { + return this._extScope.getValue(d, v); + } + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(d) { + return this._extScope.scopeRefs(d, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(d, v, I, G) { + const K = this._scope.toName(v); + return I !== void 0 && G && (this._constants[K.str] = I), this._leafNode(new f(d, K, I)), K; + } + // `const` declaration (`var` in es5 mode) + const(d, v, I) { + return this._def(n.varKinds.const, d, v, I); + } + // `let` declaration with optional assignment (`var` in es5 mode) + let(d, v, I) { + return this._def(n.varKinds.let, d, v, I); + } + // `var` declaration with optional assignment + var(d, v, I) { + return this._def(n.varKinds.var, d, v, I); + } + // assignment code + assign(d, v, I) { + return this._leafNode(new b(d, v, I)); + } + // `+=` code + add(d, v) { + return this._leafNode(new k(d, e.operators.ADD, v)); + } + // appends passed SafeExpr to code or executes Block + code(d) { + return typeof d == "function" ? d() : d !== t.nil && this._leafNode(new A(d)), this; + } + // returns code for object literal for the passed argument list of key-value pairs + object(...d) { + const v = ["{"]; + for (const [I, G] of d) + v.length > 1 && v.push(","), v.push(I), (I !== G || this.opts.es5) && (v.push(":"), (0, t.addCodeArg)(v, G)); + return v.push("}"), new t._Code(v); + } + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(d, v, I) { + if (this._blockNode(new $(d)), v && I) + this.code(v).else().code(I).endIf(); + else if (v) + this.code(v).endIf(); + else if (I) + throw new Error('CodeGen: "else" body without "then" body'); + return this; + } + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(d) { + return this._elseNode(new $(d)); + } + // `else` clause - only valid after `if` or `else if` clauses + else() { + return this._elseNode(new x()); + } + // end `if` statement (needed if gen.if was used only with condition) + endIf() { + return this._endBlockNode($, x); + } + _for(d, v) { + return this._blockNode(d), v && this.code(v).endFor(), this; + } + // a generic `for` clause (or statement if `forBody` is passed) + for(d, v) { + return this._for(new R(d), v); + } + // `for` statement for a range of values + forRange(d, v, I, G, K = this.opts.es5 ? n.varKinds.var : n.varKinds.let) { + const re = this._scope.toName(d); + return this._for(new r(K, re, v, I), () => G(re)); + } + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf(d, v, I, G = n.varKinds.const) { + const K = this._scope.toName(d); + if (this.opts.es5) { + const re = v instanceof t.Name ? v : this.var("_arr", v); + return this.forRange("_i", 0, (0, t._)`${re}.length`, (ne) => { + this.var(K, (0, t._)`${re}[${ne}]`), I(K); + }); + } + return this._for(new s("of", G, K, v), () => I(K)); + } + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn(d, v, I, G = this.opts.es5 ? n.varKinds.var : n.varKinds.const) { + if (this.opts.ownProperties) + return this.forOf(d, (0, t._)`Object.keys(${v})`, I); + const K = this._scope.toName(d); + return this._for(new s("in", G, K, v), () => I(K)); + } + // end `for` loop + endFor() { + return this._endBlockNode(T); + } + // `label` statement + label(d) { + return this._leafNode(new _(d)); + } + // `break` statement + break(d) { + return this._leafNode(new y(d)); + } + // `return` statement + return(d) { + const v = new c(); + if (this._blockNode(v), this.code(d), v.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(c); + } + // `try` statement + try(d, v, I) { + if (!v && !I) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const G = new u(); + if (this._blockNode(G), this.code(d), v) { + const K = this.name("e"); + this._currNode = G.catch = new m(K), v(K); + } + return I && (this._currNode = G.finally = new p(), this.code(I)), this._endBlockNode(m, p); + } + // `throw` statement + throw(d) { + return this._leafNode(new S(d)); + } + // start self-balancing block + block(d, v) { + return this._blockStarts.push(this._nodes.length), d && this.code(d).endBlock(v), this; + } + // end the current self-balancing block + endBlock(d) { + const v = this._blockStarts.pop(); + if (v === void 0) + throw new Error("CodeGen: not in self-balancing block"); + const I = this._nodes.length - v; + if (I < 0 || d !== void 0 && I !== d) + throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${d} expected`); + return this._nodes.length = v, this; + } + // `function` heading (or definition if funcBody is passed) + func(d, v = t.nil, I, G) { + return this._blockNode(new o(d, v, I)), G && this.code(G).endFunc(), this; + } + // end function definition + endFunc() { + return this._endBlockNode(o); + } + optimize(d = 1) { + for (; d-- > 0; ) + this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants); + } + _leafNode(d) { + return this._currNode.nodes.push(d), this; + } + _blockNode(d) { + this._currNode.nodes.push(d), this._nodes.push(d); + } + _endBlockNode(d, v) { + const I = this._currNode; + if (I instanceof d || v && I instanceof v) + return this._nodes.pop(), this; + throw new Error(`CodeGen: not in block "${v ? `${d.kind}/${v.kind}` : d.kind}"`); + } + _elseNode(d) { + const v = this._currNode; + if (!(v instanceof $)) + throw new Error('CodeGen: "else" without "if"'); + return this._currNode = v.else = d, this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const d = this._nodes; + return d[d.length - 1]; + } + set _currNode(d) { + const v = this._nodes; + v[v.length - 1] = d; + } + } + e.CodeGen = j; + function V(N, d) { + for (const v in d) + N[v] = (N[v] || 0) + (d[v] || 0); + return N; + } + function F(N, d) { + return d instanceof t._CodeOrName ? V(N, d.names) : N; + } + function D(N, d, v) { + if (N instanceof t.Name) + return I(N); + if (!G(N)) + return N; + return new t._Code(N._items.reduce((K, re) => (re instanceof t.Name && (re = I(re)), re instanceof t._Code ? K.push(...re._items) : K.push(re), K), [])); + function I(K) { + const re = v[K.str]; + return re === void 0 || d[K.str] !== 1 ? K : (delete d[K.str], re); + } + function G(K) { + return K instanceof t._Code && K._items.some((re) => re instanceof t.Name && d[re.str] === 1 && v[re.str] !== void 0); + } + } + function q(N, d) { + for (const v in d) + N[v] = (N[v] || 0) - (d[v] || 0); + } + function g(N) { + return typeof N == "boolean" || typeof N == "number" || N === null ? !N : (0, t._)`!${B(N)}`; + } + e.not = g; + const H = P(e.operators.AND); + function W(...N) { + return N.reduce(H); + } + e.and = W; + const J = P(e.operators.OR); + function U(...N) { + return N.reduce(J); + } + e.or = U; + function P(N) { + return (d, v) => d === t.nil ? v : v === t.nil ? d : (0, t._)`${B(d)} ${N} ${B(v)}`; + } + function B(N) { + return N instanceof t.Name ? N : (0, t._)`(${N})`; + } +})(se); +var ce = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0; + const t = se, n = rr; + function a(o) { + const c = {}; + for (const u of o) + c[u] = !0; + return c; + } + e.toHash = a; + function i(o, c) { + return typeof c == "boolean" ? c : Object.keys(c).length === 0 ? !0 : (l(o, c), !f(c, o.self.RULES.all)); + } + e.alwaysValidSchema = i; + function l(o, c = o.schema) { + const { opts: u, self: m } = o; + if (!u.strictSchema || typeof c == "boolean") + return; + const p = m.RULES.keywords; + for (const j in c) + p[j] || s(o, `unknown keyword: "${j}"`); + } + e.checkUnknownRules = l; + function f(o, c) { + if (typeof o == "boolean") + return !o; + for (const u in o) + if (c[u]) + return !0; + return !1; + } + e.schemaHasRules = f; + function b(o, c) { + if (typeof o == "boolean") + return !o; + for (const u in o) + if (u !== "$ref" && c.all[u]) + return !0; + return !1; + } + e.schemaHasRulesButRef = b; + function k({ topSchemaRef: o, schemaPath: c }, u, m, p) { + if (!p) { + if (typeof u == "number" || typeof u == "boolean") + return u; + if (typeof u == "string") + return (0, t._)`${u}`; + } + return (0, t._)`${o}${c}${(0, t.getProperty)(m)}`; + } + e.schemaRefOrVal = k; + function _(o) { + return A(decodeURIComponent(o)); + } + e.unescapeFragment = _; + function y(o) { + return encodeURIComponent(S(o)); + } + e.escapeFragment = y; + function S(o) { + return typeof o == "number" ? `${o}` : o.replace(/~/g, "~0").replace(/\//g, "~1"); + } + e.escapeJsonPointer = S; + function A(o) { + return o.replace(/~1/g, "/").replace(/~0/g, "~"); + } + e.unescapeJsonPointer = A; + function M(o, c) { + if (Array.isArray(o)) + for (const u of o) + c(u); + else + c(o); + } + e.eachItem = M; + function O({ mergeNames: o, mergeToName: c, mergeValues: u, resultToName: m }) { + return (p, j, V, F) => { + const D = V === void 0 ? j : V instanceof t.Name ? (j instanceof t.Name ? o(p, j, V) : c(p, j, V), V) : j instanceof t.Name ? (c(p, V, j), j) : u(j, V); + return F === t.Name && !(D instanceof t.Name) ? m(p, D) : D; + }; + } + e.mergeEvaluated = { + props: O({ + mergeNames: (o, c, u) => o.if((0, t._)`${u} !== true && ${c} !== undefined`, () => { + o.if((0, t._)`${c} === true`, () => o.assign(u, !0), () => o.assign(u, (0, t._)`${u} || {}`).code((0, t._)`Object.assign(${u}, ${c})`)); + }), + mergeToName: (o, c, u) => o.if((0, t._)`${u} !== true`, () => { + c === !0 ? o.assign(u, !0) : (o.assign(u, (0, t._)`${u} || {}`), x(o, u, c)); + }), + mergeValues: (o, c) => o === !0 ? !0 : { ...o, ...c }, + resultToName: C + }), + items: O({ + mergeNames: (o, c, u) => o.if((0, t._)`${u} !== true && ${c} !== undefined`, () => o.assign(u, (0, t._)`${c} === true ? true : ${u} > ${c} ? ${u} : ${c}`)), + mergeToName: (o, c, u) => o.if((0, t._)`${u} !== true`, () => o.assign(u, c === !0 ? !0 : (0, t._)`${u} > ${c} ? ${u} : ${c}`)), + mergeValues: (o, c) => o === !0 ? !0 : Math.max(o, c), + resultToName: (o, c) => o.var("items", c) + }) + }; + function C(o, c) { + if (c === !0) + return o.var("props", !0); + const u = o.var("props", (0, t._)`{}`); + return c !== void 0 && x(o, u, c), u; + } + e.evaluatedPropsToName = C; + function x(o, c, u) { + Object.keys(u).forEach((m) => o.assign((0, t._)`${c}${(0, t.getProperty)(m)}`, !0)); + } + e.setEvaluated = x; + const $ = {}; + function T(o, c) { + return o.scopeValue("func", { + ref: c, + code: $[c.code] || ($[c.code] = new n._Code(c.code)) + }); + } + e.useFunc = T; + var R; + (function(o) { + o[o.Num = 0] = "Num", o[o.Str = 1] = "Str"; + })(R = e.Type || (e.Type = {})); + function r(o, c, u) { + if (o instanceof t.Name) { + const m = c === R.Num; + return u ? m ? (0, t._)`"[" + ${o} + "]"` : (0, t._)`"['" + ${o} + "']"` : m ? (0, t._)`"/" + ${o}` : (0, t._)`"/" + ${o}.replace(/~/g, "~0").replace(/\\//g, "~1")`; + } + return u ? (0, t.getProperty)(o).toString() : "/" + S(o); + } + e.getErrorPath = r; + function s(o, c, u = o.opts.strictSchema) { + if (u) { + if (c = `strict mode: ${c}`, u === !0) + throw new Error(c); + o.self.logger.warn(c); + } + } + e.checkStrictMode = s; +})(ce); +var Qe = {}; +Object.defineProperty(Qe, "__esModule", { value: !0 }); +const Ee = se, Do = { + // validation function arguments + data: new Ee.Name("data"), + // args passed from referencing schema + valCxt: new Ee.Name("valCxt"), + instancePath: new Ee.Name("instancePath"), + parentData: new Ee.Name("parentData"), + parentDataProperty: new Ee.Name("parentDataProperty"), + rootData: new Ee.Name("rootData"), + dynamicAnchors: new Ee.Name("dynamicAnchors"), + // function scoped variables + vErrors: new Ee.Name("vErrors"), + errors: new Ee.Name("errors"), + this: new Ee.Name("this"), + // "globals" + self: new Ee.Name("self"), + scope: new Ee.Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new Ee.Name("json"), + jsonPos: new Ee.Name("jsonPos"), + jsonLen: new Ee.Name("jsonLen"), + jsonPart: new Ee.Name("jsonPart") +}; +Qe.default = Do; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0; + const t = se, n = ce, a = Qe; + e.keywordError = { + message: ({ keyword: x }) => (0, t.str)`must pass "${x}" keyword validation` + }, e.keyword$DataError = { + message: ({ keyword: x, schemaType: $ }) => $ ? (0, t.str)`"${x}" keyword must be ${$} ($data)` : (0, t.str)`"${x}" keyword is invalid ($data)` + }; + function i(x, $ = e.keywordError, T, R) { + const { it: r } = x, { gen: s, compositeRule: o, allErrors: c } = r, u = S(x, $, T); + R ?? (o || c) ? k(s, u) : _(r, (0, t._)`[${u}]`); + } + e.reportError = i; + function l(x, $ = e.keywordError, T) { + const { it: R } = x, { gen: r, compositeRule: s, allErrors: o } = R, c = S(x, $, T); + k(r, c), s || o || _(R, a.default.vErrors); + } + e.reportExtraError = l; + function f(x, $) { + x.assign(a.default.errors, $), x.if((0, t._)`${a.default.vErrors} !== null`, () => x.if($, () => x.assign((0, t._)`${a.default.vErrors}.length`, $), () => x.assign(a.default.vErrors, null))); + } + e.resetErrorsCount = f; + function b({ gen: x, keyword: $, schemaValue: T, data: R, errsCount: r, it: s }) { + if (r === void 0) + throw new Error("ajv implementation error"); + const o = x.name("err"); + x.forRange("i", r, a.default.errors, (c) => { + x.const(o, (0, t._)`${a.default.vErrors}[${c}]`), x.if((0, t._)`${o}.instancePath === undefined`, () => x.assign((0, t._)`${o}.instancePath`, (0, t.strConcat)(a.default.instancePath, s.errorPath))), x.assign((0, t._)`${o}.schemaPath`, (0, t.str)`${s.errSchemaPath}/${$}`), s.opts.verbose && (x.assign((0, t._)`${o}.schema`, T), x.assign((0, t._)`${o}.data`, R)); + }); + } + e.extendErrors = b; + function k(x, $) { + const T = x.const("err", $); + x.if((0, t._)`${a.default.vErrors} === null`, () => x.assign(a.default.vErrors, (0, t._)`[${T}]`), (0, t._)`${a.default.vErrors}.push(${T})`), x.code((0, t._)`${a.default.errors}++`); + } + function _(x, $) { + const { gen: T, validateName: R, schemaEnv: r } = x; + r.$async ? T.throw((0, t._)`new ${x.ValidationError}(${$})`) : (T.assign((0, t._)`${R}.errors`, $), T.return(!1)); + } + const y = { + keyword: new t.Name("keyword"), + schemaPath: new t.Name("schemaPath"), + params: new t.Name("params"), + propertyName: new t.Name("propertyName"), + message: new t.Name("message"), + schema: new t.Name("schema"), + parentSchema: new t.Name("parentSchema") + }; + function S(x, $, T) { + const { createErrors: R } = x.it; + return R === !1 ? (0, t._)`{}` : A(x, $, T); + } + function A(x, $, T = {}) { + const { gen: R, it: r } = x, s = [ + M(r, T), + O(x, T) + ]; + return C(x, $, s), R.object(...s); + } + function M({ errorPath: x }, { instancePath: $ }) { + const T = $ ? (0, t.str)`${x}${(0, n.getErrorPath)($, n.Type.Str)}` : x; + return [a.default.instancePath, (0, t.strConcat)(a.default.instancePath, T)]; + } + function O({ keyword: x, it: { errSchemaPath: $ } }, { schemaPath: T, parentSchema: R }) { + let r = R ? $ : (0, t.str)`${$}/${x}`; + return T && (r = (0, t.str)`${r}${(0, n.getErrorPath)(T, n.Type.Str)}`), [y.schemaPath, r]; + } + function C(x, { params: $, message: T }, R) { + const { keyword: r, data: s, schemaValue: o, it: c } = x, { opts: u, propertyName: m, topSchemaRef: p, schemaPath: j } = c; + R.push([y.keyword, r], [y.params, typeof $ == "function" ? $(x) : $ || (0, t._)`{}`]), u.messages && R.push([y.message, typeof T == "function" ? T(x) : T]), u.verbose && R.push([y.schema, o], [y.parentSchema, (0, t._)`${p}${j}`], [a.default.data, s]), m && R.push([y.propertyName, m]); + } +})(ar); +Object.defineProperty(Rt, "__esModule", { value: !0 }); +Rt.boolOrEmptySchema = Rt.topBoolOrEmptySchema = void 0; +const Vo = ar, Uo = se, Bo = Qe, Fo = { + message: "boolean schema is false" +}; +function Ho(e) { + const { gen: t, schema: n, validateName: a } = e; + n === !1 ? Cn(e, !1) : typeof n == "object" && n.$async === !0 ? t.return(Bo.default.data) : (t.assign((0, Uo._)`${a}.errors`, null), t.return(!0)); +} +Rt.topBoolOrEmptySchema = Ho; +function qo(e, t) { + const { gen: n, schema: a } = e; + a === !1 ? (n.var(t, !1), Cn(e)) : n.var(t, !0); +} +Rt.boolOrEmptySchema = qo; +function Cn(e, t) { + const { gen: n, data: a } = e, i = { + gen: n, + keyword: "false schema", + data: a, + schema: !1, + schemaCode: !1, + schemaValue: !1, + params: {}, + it: e + }; + (0, Vo.reportError)(i, Fo, void 0, t); +} +var nr = {}, wt = {}; +Object.defineProperty(wt, "__esModule", { value: !0 }); +wt.getRules = wt.isJSONType = void 0; +const Go = ["string", "number", "integer", "boolean", "null", "object", "array"], Ko = new Set(Go); +function Wo(e) { + return typeof e == "string" && Ko.has(e); +} +wt.isJSONType = Wo; +function Yo() { + const e = { + number: { type: "number", rules: [] }, + string: { type: "string", rules: [] }, + array: { type: "array", rules: [] }, + object: { type: "object", rules: [] } + }; + return { + types: { ...e, integer: !0, boolean: !0, null: !0 }, + rules: [{ rules: [] }, e.number, e.string, e.array, e.object], + post: { rules: [] }, + all: {}, + keywords: {} + }; +} +wt.getRules = Yo; +var rt = {}; +Object.defineProperty(rt, "__esModule", { value: !0 }); +rt.shouldUseRule = rt.shouldUseGroup = rt.schemaHasRulesForType = void 0; +function Jo({ schema: e, self: t }, n) { + const a = t.RULES.types[n]; + return a && a !== !0 && Nn(e, a); +} +rt.schemaHasRulesForType = Jo; +function Nn(e, t) { + return t.rules.some((n) => On(e, n)); +} +rt.shouldUseGroup = Nn; +function On(e, t) { + var n; + return e[t.keyword] !== void 0 || ((n = t.definition.implements) === null || n === void 0 ? void 0 : n.some((a) => e[a] !== void 0)); +} +rt.shouldUseRule = On; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0; + const t = wt, n = rt, a = ar, i = se, l = ce; + var f; + (function(R) { + R[R.Correct = 0] = "Correct", R[R.Wrong = 1] = "Wrong"; + })(f = e.DataType || (e.DataType = {})); + function b(R) { + const r = k(R.type); + if (r.includes("null")) { + if (R.nullable === !1) + throw new Error("type: null contradicts nullable: false"); + } else { + if (!r.length && R.nullable !== void 0) + throw new Error('"nullable" cannot be used without "type"'); + R.nullable === !0 && r.push("null"); + } + return r; + } + e.getSchemaTypes = b; + function k(R) { + const r = Array.isArray(R) ? R : R ? [R] : []; + if (r.every(t.isJSONType)) + return r; + throw new Error("type must be JSONType or JSONType[]: " + r.join(",")); + } + e.getJSONTypes = k; + function _(R, r) { + const { gen: s, data: o, opts: c } = R, u = S(r, c.coerceTypes), m = r.length > 0 && !(u.length === 0 && r.length === 1 && (0, n.schemaHasRulesForType)(R, r[0])); + if (m) { + const p = C(r, o, c.strictNumbers, f.Wrong); + s.if(p, () => { + u.length ? A(R, r, u) : $(R); + }); + } + return m; + } + e.coerceAndCheckDataType = _; + const y = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]); + function S(R, r) { + return r ? R.filter((s) => y.has(s) || r === "array" && s === "array") : []; + } + function A(R, r, s) { + const { gen: o, data: c, opts: u } = R, m = o.let("dataType", (0, i._)`typeof ${c}`), p = o.let("coerced", (0, i._)`undefined`); + u.coerceTypes === "array" && o.if((0, i._)`${m} == 'object' && Array.isArray(${c}) && ${c}.length == 1`, () => o.assign(c, (0, i._)`${c}[0]`).assign(m, (0, i._)`typeof ${c}`).if(C(r, c, u.strictNumbers), () => o.assign(p, c))), o.if((0, i._)`${p} !== undefined`); + for (const V of s) + (y.has(V) || V === "array" && u.coerceTypes === "array") && j(V); + o.else(), $(R), o.endIf(), o.if((0, i._)`${p} !== undefined`, () => { + o.assign(c, p), M(R, p); + }); + function j(V) { + switch (V) { + case "string": + o.elseIf((0, i._)`${m} == "number" || ${m} == "boolean"`).assign(p, (0, i._)`"" + ${c}`).elseIf((0, i._)`${c} === null`).assign(p, (0, i._)`""`); + return; + case "number": + o.elseIf((0, i._)`${m} == "boolean" || ${c} === null + || (${m} == "string" && ${c} && ${c} == +${c})`).assign(p, (0, i._)`+${c}`); + return; + case "integer": + o.elseIf((0, i._)`${m} === "boolean" || ${c} === null + || (${m} === "string" && ${c} && ${c} == +${c} && !(${c} % 1))`).assign(p, (0, i._)`+${c}`); + return; + case "boolean": + o.elseIf((0, i._)`${c} === "false" || ${c} === 0 || ${c} === null`).assign(p, !1).elseIf((0, i._)`${c} === "true" || ${c} === 1`).assign(p, !0); + return; + case "null": + o.elseIf((0, i._)`${c} === "" || ${c} === 0 || ${c} === false`), o.assign(p, null); + return; + case "array": + o.elseIf((0, i._)`${m} === "string" || ${m} === "number" + || ${m} === "boolean" || ${c} === null`).assign(p, (0, i._)`[${c}]`); + } + } + } + function M({ gen: R, parentData: r, parentDataProperty: s }, o) { + R.if((0, i._)`${r} !== undefined`, () => R.assign((0, i._)`${r}[${s}]`, o)); + } + function O(R, r, s, o = f.Correct) { + const c = o === f.Correct ? i.operators.EQ : i.operators.NEQ; + let u; + switch (R) { + case "null": + return (0, i._)`${r} ${c} null`; + case "array": + u = (0, i._)`Array.isArray(${r})`; + break; + case "object": + u = (0, i._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`; + break; + case "integer": + u = m((0, i._)`!(${r} % 1) && !isNaN(${r})`); + break; + case "number": + u = m(); + break; + default: + return (0, i._)`typeof ${r} ${c} ${R}`; + } + return o === f.Correct ? u : (0, i.not)(u); + function m(p = i.nil) { + return (0, i.and)((0, i._)`typeof ${r} == "number"`, p, s ? (0, i._)`isFinite(${r})` : i.nil); + } + } + e.checkDataType = O; + function C(R, r, s, o) { + if (R.length === 1) + return O(R[0], r, s, o); + let c; + const u = (0, l.toHash)(R); + if (u.array && u.object) { + const m = (0, i._)`typeof ${r} != "object"`; + c = u.null ? m : (0, i._)`!${r} || ${m}`, delete u.null, delete u.array, delete u.object; + } else + c = i.nil; + u.number && delete u.integer; + for (const m in u) + c = (0, i.and)(c, O(m, r, s, o)); + return c; + } + e.checkDataTypes = C; + const x = { + message: ({ schema: R }) => `must be ${R}`, + params: ({ schema: R, schemaValue: r }) => typeof R == "string" ? (0, i._)`{type: ${R}}` : (0, i._)`{type: ${r}}` + }; + function $(R) { + const r = T(R); + (0, a.reportError)(r, x); + } + e.reportTypeError = $; + function T(R) { + const { gen: r, data: s, schema: o } = R, c = (0, l.schemaRefOrVal)(R, o, "type"); + return { + gen: r, + keyword: "type", + data: s, + schema: o.type, + schemaCode: c, + schemaValue: c, + parentSchema: o, + params: {}, + it: R + }; + } +})(nr); +var Cr = {}; +Object.defineProperty(Cr, "__esModule", { value: !0 }); +Cr.assignDefaults = void 0; +const xt = se, Zo = ce; +function Qo(e, t) { + const { properties: n, items: a } = e.schema; + if (t === "object" && n) + for (const i in n) + Wa(e, i, n[i].default); + else + t === "array" && Array.isArray(a) && a.forEach((i, l) => Wa(e, l, i.default)); +} +Cr.assignDefaults = Qo; +function Wa(e, t, n) { + const { gen: a, compositeRule: i, data: l, opts: f } = e; + if (n === void 0) + return; + const b = (0, xt._)`${l}${(0, xt.getProperty)(t)}`; + if (i) { + (0, Zo.checkStrictMode)(e, `default is ignored for: ${b}`); + return; + } + let k = (0, xt._)`${b} === undefined`; + f.useDefaults === "empty" && (k = (0, xt._)`${k} || ${b} === null || ${b} === ""`), a.if(k, (0, xt._)`${b} = ${(0, xt.stringify)(n)}`); +} +var Ze = {}, oe = {}; +Object.defineProperty(oe, "__esModule", { value: !0 }); +oe.validateUnion = oe.validateArray = oe.usePattern = oe.callValidateCode = oe.schemaProperties = oe.allSchemaProperties = oe.noPropertyInData = oe.propertyInData = oe.isOwnProperty = oe.hasPropFunc = oe.reportMissingProp = oe.checkMissingProp = oe.checkReportMissingProp = void 0; +const ge = se, Yr = ce, nt = Qe, Xo = ce; +function es(e, t) { + const { gen: n, data: a, it: i } = e; + n.if(Zr(n, a, t, i.opts.ownProperties), () => { + e.setParams({ missingProperty: (0, ge._)`${t}` }, !0), e.error(); + }); +} +oe.checkReportMissingProp = es; +function ts({ gen: e, data: t, it: { opts: n } }, a, i) { + return (0, ge.or)(...a.map((l) => (0, ge.and)(Zr(e, t, l, n.ownProperties), (0, ge._)`${i} = ${l}`))); +} +oe.checkMissingProp = ts; +function rs(e, t) { + e.setParams({ missingProperty: t }, !0), e.error(); +} +oe.reportMissingProp = rs; +function In(e) { + return e.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: (0, ge._)`Object.prototype.hasOwnProperty` + }); +} +oe.hasPropFunc = In; +function Jr(e, t, n) { + return (0, ge._)`${In(e)}.call(${t}, ${n})`; +} +oe.isOwnProperty = Jr; +function as(e, t, n, a) { + const i = (0, ge._)`${t}${(0, ge.getProperty)(n)} !== undefined`; + return a ? (0, ge._)`${i} && ${Jr(e, t, n)}` : i; +} +oe.propertyInData = as; +function Zr(e, t, n, a) { + const i = (0, ge._)`${t}${(0, ge.getProperty)(n)} === undefined`; + return a ? (0, ge.or)(i, (0, ge.not)(Jr(e, t, n))) : i; +} +oe.noPropertyInData = Zr; +function An(e) { + return e ? Object.keys(e).filter((t) => t !== "__proto__") : []; +} +oe.allSchemaProperties = An; +function ns(e, t) { + return An(t).filter((n) => !(0, Yr.alwaysValidSchema)(e, t[n])); +} +oe.schemaProperties = ns; +function os({ schemaCode: e, data: t, it: { gen: n, topSchemaRef: a, schemaPath: i, errorPath: l }, it: f }, b, k, _) { + const y = _ ? (0, ge._)`${e}, ${t}, ${a}${i}` : t, S = [ + [nt.default.instancePath, (0, ge.strConcat)(nt.default.instancePath, l)], + [nt.default.parentData, f.parentData], + [nt.default.parentDataProperty, f.parentDataProperty], + [nt.default.rootData, nt.default.rootData] + ]; + f.opts.dynamicRef && S.push([nt.default.dynamicAnchors, nt.default.dynamicAnchors]); + const A = (0, ge._)`${y}, ${n.object(...S)}`; + return k !== ge.nil ? (0, ge._)`${b}.call(${k}, ${A})` : (0, ge._)`${b}(${A})`; +} +oe.callValidateCode = os; +const ss = (0, ge._)`new RegExp`; +function is({ gen: e, it: { opts: t } }, n) { + const a = t.unicodeRegExp ? "u" : "", { regExp: i } = t.code, l = i(n, a); + return e.scopeValue("pattern", { + key: l.toString(), + ref: l, + code: (0, ge._)`${i.code === "new RegExp" ? ss : (0, Xo.useFunc)(e, i)}(${n}, ${a})` + }); +} +oe.usePattern = is; +function cs(e) { + const { gen: t, data: n, keyword: a, it: i } = e, l = t.name("valid"); + if (i.allErrors) { + const b = t.let("valid", !0); + return f(() => t.assign(b, !1)), b; + } + return t.var(l, !0), f(() => t.break()), l; + function f(b) { + const k = t.const("len", (0, ge._)`${n}.length`); + t.forRange("i", 0, k, (_) => { + e.subschema({ + keyword: a, + dataProp: _, + dataPropType: Yr.Type.Num + }, l), t.if((0, ge.not)(l), b); + }); + } +} +oe.validateArray = cs; +function ls(e) { + const { gen: t, schema: n, keyword: a, it: i } = e; + if (!Array.isArray(n)) + throw new Error("ajv implementation error"); + if (n.some((b) => (0, Yr.alwaysValidSchema)(i, b)) && !i.opts.unevaluated) + return; + const l = t.let("valid", !1), f = t.name("_valid"); + t.block(() => n.forEach((b, k) => { + const _ = e.subschema({ + keyword: a, + schemaProp: k, + compositeRule: !0 + }, f); + t.assign(l, (0, ge._)`${l} || ${f}`), e.mergeValidEvaluated(_, f) || t.if((0, ge.not)(l)); + })), e.result(l, () => e.reset(), () => e.error(!0)); +} +oe.validateUnion = ls; +Object.defineProperty(Ze, "__esModule", { value: !0 }); +Ze.validateKeywordUsage = Ze.validSchemaType = Ze.funcKeywordCode = Ze.macroKeywordCode = void 0; +const Se = se, yt = Qe, us = oe, ds = ar; +function hs(e, t) { + const { gen: n, keyword: a, schema: i, parentSchema: l, it: f } = e, b = t.macro.call(f.self, i, l, f), k = Rn(n, a, b); + f.opts.validateSchema !== !1 && f.self.validateSchema(b, !0); + const _ = n.name("valid"); + e.subschema({ + schema: b, + schemaPath: Se.nil, + errSchemaPath: `${f.errSchemaPath}/${a}`, + topSchemaRef: k, + compositeRule: !0 + }, _), e.pass(_, () => e.error(!0)); +} +Ze.macroKeywordCode = hs; +function ps(e, t) { + var n; + const { gen: a, keyword: i, schema: l, parentSchema: f, $data: b, it: k } = e; + ms(k, t); + const _ = !b && t.compile ? t.compile.call(k.self, l, f, k) : t.validate, y = Rn(a, i, _), S = a.let("valid"); + e.block$data(S, A), e.ok((n = t.valid) !== null && n !== void 0 ? n : S); + function A() { + if (t.errors === !1) + C(), t.modifying && Ya(e), x(() => e.error()); + else { + const $ = t.async ? M() : O(); + t.modifying && Ya(e), x(() => fs(e, $)); + } + } + function M() { + const $ = a.let("ruleErrs", null); + return a.try(() => C((0, Se._)`await `), (T) => a.assign(S, !1).if((0, Se._)`${T} instanceof ${k.ValidationError}`, () => a.assign($, (0, Se._)`${T}.errors`), () => a.throw(T))), $; + } + function O() { + const $ = (0, Se._)`${y}.errors`; + return a.assign($, null), C(Se.nil), $; + } + function C($ = t.async ? (0, Se._)`await ` : Se.nil) { + const T = k.opts.passContext ? yt.default.this : yt.default.self, R = !("compile" in t && !b || t.schema === !1); + a.assign(S, (0, Se._)`${$}${(0, us.callValidateCode)(e, y, T, R)}`, t.modifying); + } + function x($) { + var T; + a.if((0, Se.not)((T = t.valid) !== null && T !== void 0 ? T : S), $); + } +} +Ze.funcKeywordCode = ps; +function Ya(e) { + const { gen: t, data: n, it: a } = e; + t.if(a.parentData, () => t.assign(n, (0, Se._)`${a.parentData}[${a.parentDataProperty}]`)); +} +function fs(e, t) { + const { gen: n } = e; + n.if((0, Se._)`Array.isArray(${t})`, () => { + n.assign(yt.default.vErrors, (0, Se._)`${yt.default.vErrors} === null ? ${t} : ${yt.default.vErrors}.concat(${t})`).assign(yt.default.errors, (0, Se._)`${yt.default.vErrors}.length`), (0, ds.extendErrors)(e); + }, () => e.error()); +} +function ms({ schemaEnv: e }, t) { + if (t.async && !e.$async) + throw new Error("async keyword in sync schema"); +} +function Rn(e, t, n) { + if (n === void 0) + throw new Error(`keyword "${t}" failed to compile`); + return e.scopeValue("keyword", typeof n == "function" ? { ref: n } : { ref: n, code: (0, Se.stringify)(n) }); +} +function gs(e, t, n = !1) { + return !t.length || t.some((a) => a === "array" ? Array.isArray(e) : a === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == a || n && typeof e > "u"); +} +Ze.validSchemaType = gs; +function ys({ schema: e, opts: t, self: n, errSchemaPath: a }, i, l) { + if (Array.isArray(i.keyword) ? !i.keyword.includes(l) : i.keyword !== l) + throw new Error("ajv implementation error"); + const f = i.dependencies; + if (f != null && f.some((b) => !Object.prototype.hasOwnProperty.call(e, b))) + throw new Error(`parent schema must have dependencies of ${l}: ${f.join(",")}`); + if (i.validateSchema && !i.validateSchema(e[l])) { + const b = `keyword "${l}" value is invalid at path "${a}": ` + n.errorsText(i.validateSchema.errors); + if (t.validateSchema === "log") + n.logger.error(b); + else + throw new Error(b); + } +} +Ze.validateKeywordUsage = ys; +var lt = {}; +Object.defineProperty(lt, "__esModule", { value: !0 }); +lt.extendSubschemaMode = lt.extendSubschemaData = lt.getSubschema = void 0; +const Je = se, Ln = ce; +function _s(e, { keyword: t, schemaProp: n, schema: a, schemaPath: i, errSchemaPath: l, topSchemaRef: f }) { + if (t !== void 0 && a !== void 0) + throw new Error('both "keyword" and "schema" passed, only one allowed'); + if (t !== void 0) { + const b = e.schema[t]; + return n === void 0 ? { + schema: b, + schemaPath: (0, Je._)`${e.schemaPath}${(0, Je.getProperty)(t)}`, + errSchemaPath: `${e.errSchemaPath}/${t}` + } : { + schema: b[n], + schemaPath: (0, Je._)`${e.schemaPath}${(0, Je.getProperty)(t)}${(0, Je.getProperty)(n)}`, + errSchemaPath: `${e.errSchemaPath}/${t}/${(0, Ln.escapeFragment)(n)}` + }; + } + if (a !== void 0) { + if (i === void 0 || l === void 0 || f === void 0) + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + return { + schema: a, + schemaPath: i, + topSchemaRef: f, + errSchemaPath: l + }; + } + throw new Error('either "keyword" or "schema" must be passed'); +} +lt.getSubschema = _s; +function bs(e, t, { dataProp: n, dataPropType: a, data: i, dataTypes: l, propertyName: f }) { + if (i !== void 0 && n !== void 0) + throw new Error('both "data" and "dataProp" passed, only one allowed'); + const { gen: b } = t; + if (n !== void 0) { + const { errorPath: _, dataPathArr: y, opts: S } = t, A = b.let("data", (0, Je._)`${t.data}${(0, Je.getProperty)(n)}`, !0); + k(A), e.errorPath = (0, Je.str)`${_}${(0, Ln.getErrorPath)(n, a, S.jsPropertySyntax)}`, e.parentDataProperty = (0, Je._)`${n}`, e.dataPathArr = [...y, e.parentDataProperty]; + } + if (i !== void 0) { + const _ = i instanceof Je.Name ? i : b.let("data", i, !0); + k(_), f !== void 0 && (e.propertyName = f); + } + l && (e.dataTypes = l); + function k(_) { + e.data = _, e.dataLevel = t.dataLevel + 1, e.dataTypes = [], t.definedProperties = /* @__PURE__ */ new Set(), e.parentData = t.data, e.dataNames = [...t.dataNames, _]; + } +} +lt.extendSubschemaData = bs; +function ws(e, { jtdDiscriminator: t, jtdMetadata: n, compositeRule: a, createErrors: i, allErrors: l }) { + a !== void 0 && (e.compositeRule = a), i !== void 0 && (e.createErrors = i), l !== void 0 && (e.allErrors = l), e.jtdDiscriminator = t, e.jtdMetadata = n; +} +lt.extendSubschemaMode = ws; +var Pe = {}, Mn = function e(t, n) { + if (t === n) + return !0; + if (t && n && typeof t == "object" && typeof n == "object") { + if (t.constructor !== n.constructor) + return !1; + var a, i, l; + if (Array.isArray(t)) { + if (a = t.length, a != n.length) + return !1; + for (i = a; i-- !== 0; ) + if (!e(t[i], n[i])) + return !1; + return !0; + } + if (t.constructor === RegExp) + return t.source === n.source && t.flags === n.flags; + if (t.valueOf !== Object.prototype.valueOf) + return t.valueOf() === n.valueOf(); + if (t.toString !== Object.prototype.toString) + return t.toString() === n.toString(); + if (l = Object.keys(t), a = l.length, a !== Object.keys(n).length) + return !1; + for (i = a; i-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(n, l[i])) + return !1; + for (i = a; i-- !== 0; ) { + var f = l[i]; + if (!e(t[f], n[f])) + return !1; + } + return !0; + } + return t !== t && n !== n; +}, zn = { exports: {} }, ct = zn.exports = function(e, t, n) { + typeof t == "function" && (n = t, t = {}), n = t.cb || n; + var a = typeof n == "function" ? n : n.pre || function() { + }, i = n.post || function() { + }; + br(t, a, i, e, "", e); +}; +ct.keywords = { + additionalItems: !0, + items: !0, + contains: !0, + additionalProperties: !0, + propertyNames: !0, + not: !0, + if: !0, + then: !0, + else: !0 +}; +ct.arrayKeywords = { + items: !0, + allOf: !0, + anyOf: !0, + oneOf: !0 +}; +ct.propsKeywords = { + $defs: !0, + definitions: !0, + properties: !0, + patternProperties: !0, + dependencies: !0 +}; +ct.skipKeywords = { + default: !0, + enum: !0, + const: !0, + required: !0, + maximum: !0, + minimum: !0, + exclusiveMaximum: !0, + exclusiveMinimum: !0, + multipleOf: !0, + maxLength: !0, + minLength: !0, + pattern: !0, + format: !0, + maxItems: !0, + minItems: !0, + uniqueItems: !0, + maxProperties: !0, + minProperties: !0 +}; +function br(e, t, n, a, i, l, f, b, k, _) { + if (a && typeof a == "object" && !Array.isArray(a)) { + t(a, i, l, f, b, k, _); + for (var y in a) { + var S = a[y]; + if (Array.isArray(S)) { + if (y in ct.arrayKeywords) + for (var A = 0; A < S.length; A++) + br(e, t, n, S[A], i + "/" + y + "/" + A, l, i, y, a, A); + } else if (y in ct.propsKeywords) { + if (S && typeof S == "object") + for (var M in S) + br(e, t, n, S[M], i + "/" + y + "/" + vs(M), l, i, y, a, M); + } else + (y in ct.keywords || e.allKeys && !(y in ct.skipKeywords)) && br(e, t, n, S, i + "/" + y, l, i, y, a); + } + n(a, i, l, f, b, k, _); + } +} +function vs(e) { + return e.replace(/~/g, "~0").replace(/\//g, "~1"); +} +var $s = zn.exports; +Object.defineProperty(Pe, "__esModule", { value: !0 }); +Pe.getSchemaRefs = Pe.resolveUrl = Pe.normalizeId = Pe._getFullPath = Pe.getFullPath = Pe.inlineRef = void 0; +const ks = ce, Ps = Mn, Es = $s, Ss = /* @__PURE__ */ new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const" +]); +function js(e, t = !0) { + return typeof e == "boolean" ? !0 : t === !0 ? !Fr(e) : t ? Dn(e) <= t : !1; +} +Pe.inlineRef = js; +const xs = /* @__PURE__ */ new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor" +]); +function Fr(e) { + for (const t in e) { + if (xs.has(t)) + return !0; + const n = e[t]; + if (Array.isArray(n) && n.some(Fr) || typeof n == "object" && Fr(n)) + return !0; + } + return !1; +} +function Dn(e) { + let t = 0; + for (const n in e) + if (n === "$ref" || (t++, !Ss.has(n) && (typeof e[n] == "object" && (0, ks.eachItem)(e[n], (a) => t += Dn(a)), t === 1 / 0))) + return 1 / 0; + return t; +} +function Vn(e, t = "", n) { + n !== !1 && (t = It(t)); + const a = e.parse(t); + return Un(e, a); +} +Pe.getFullPath = Vn; +function Un(e, t) { + return e.serialize(t).split("#")[0] + "#"; +} +Pe._getFullPath = Un; +const Ts = /#\/?$/; +function It(e) { + return e ? e.replace(Ts, "") : ""; +} +Pe.normalizeId = It; +function Cs(e, t, n) { + return n = It(n), e.resolve(t, n); +} +Pe.resolveUrl = Cs; +const Ns = /^[a-z_][-a-z0-9._]*$/i; +function Os(e, t) { + if (typeof e == "boolean") + return {}; + const { schemaId: n, uriResolver: a } = this.opts, i = It(e[n] || t), l = { "": i }, f = Vn(a, i, !1), b = {}, k = /* @__PURE__ */ new Set(); + return Es(e, { allKeys: !0 }, (S, A, M, O) => { + if (O === void 0) + return; + const C = f + A; + let x = l[O]; + typeof S[n] == "string" && (x = $.call(this, S[n])), T.call(this, S.$anchor), T.call(this, S.$dynamicAnchor), l[A] = x; + function $(R) { + const r = this.opts.uriResolver.resolve; + if (R = It(x ? r(x, R) : R), k.has(R)) + throw y(R); + k.add(R); + let s = this.refs[R]; + return typeof s == "string" && (s = this.refs[s]), typeof s == "object" ? _(S, s.schema, R) : R !== It(C) && (R[0] === "#" ? (_(S, b[R], R), b[R] = S) : this.refs[R] = C), R; + } + function T(R) { + if (typeof R == "string") { + if (!Ns.test(R)) + throw new Error(`invalid anchor "${R}"`); + $.call(this, `#${R}`); + } + } + }), b; + function _(S, A, M) { + if (A !== void 0 && !Ps(S, A)) + throw y(M); + } + function y(S) { + return new Error(`reference "${S}" resolves to more than one schema`); + } +} +Pe.getSchemaRefs = Os; +Object.defineProperty(Ge, "__esModule", { value: !0 }); +Ge.getData = Ge.KeywordCxt = Ge.validateFunctionCode = void 0; +const Bn = Rt, Ja = nr, Qr = rt, kr = nr, Is = Cr, Jt = Ze, Rr = lt, Z = se, ee = Qe, As = Pe, at = ce, Kt = ar; +function Rs(e) { + if (qn(e) && (Gn(e), Hn(e))) { + zs(e); + return; + } + Fn(e, () => (0, Bn.topBoolOrEmptySchema)(e)); +} +Ge.validateFunctionCode = Rs; +function Fn({ gen: e, validateName: t, schema: n, schemaEnv: a, opts: i }, l) { + i.code.es5 ? e.func(t, (0, Z._)`${ee.default.data}, ${ee.default.valCxt}`, a.$async, () => { + e.code((0, Z._)`"use strict"; ${Za(n, i)}`), Ms(e, i), e.code(l); + }) : e.func(t, (0, Z._)`${ee.default.data}, ${Ls(i)}`, a.$async, () => e.code(Za(n, i)).code(l)); +} +function Ls(e) { + return (0, Z._)`{${ee.default.instancePath}="", ${ee.default.parentData}, ${ee.default.parentDataProperty}, ${ee.default.rootData}=${ee.default.data}${e.dynamicRef ? (0, Z._)`, ${ee.default.dynamicAnchors}={}` : Z.nil}}={}`; +} +function Ms(e, t) { + e.if(ee.default.valCxt, () => { + e.var(ee.default.instancePath, (0, Z._)`${ee.default.valCxt}.${ee.default.instancePath}`), e.var(ee.default.parentData, (0, Z._)`${ee.default.valCxt}.${ee.default.parentData}`), e.var(ee.default.parentDataProperty, (0, Z._)`${ee.default.valCxt}.${ee.default.parentDataProperty}`), e.var(ee.default.rootData, (0, Z._)`${ee.default.valCxt}.${ee.default.rootData}`), t.dynamicRef && e.var(ee.default.dynamicAnchors, (0, Z._)`${ee.default.valCxt}.${ee.default.dynamicAnchors}`); + }, () => { + e.var(ee.default.instancePath, (0, Z._)`""`), e.var(ee.default.parentData, (0, Z._)`undefined`), e.var(ee.default.parentDataProperty, (0, Z._)`undefined`), e.var(ee.default.rootData, ee.default.data), t.dynamicRef && e.var(ee.default.dynamicAnchors, (0, Z._)`{}`); + }); +} +function zs(e) { + const { schema: t, opts: n, gen: a } = e; + Fn(e, () => { + n.$comment && t.$comment && Wn(e), Fs(e), a.let(ee.default.vErrors, null), a.let(ee.default.errors, 0), n.unevaluated && Ds(e), Kn(e), Gs(e); + }); +} +function Ds(e) { + const { gen: t, validateName: n } = e; + e.evaluated = t.const("evaluated", (0, Z._)`${n}.evaluated`), t.if((0, Z._)`${e.evaluated}.dynamicProps`, () => t.assign((0, Z._)`${e.evaluated}.props`, (0, Z._)`undefined`)), t.if((0, Z._)`${e.evaluated}.dynamicItems`, () => t.assign((0, Z._)`${e.evaluated}.items`, (0, Z._)`undefined`)); +} +function Za(e, t) { + const n = typeof e == "object" && e[t.schemaId]; + return n && (t.code.source || t.code.process) ? (0, Z._)`/*# sourceURL=${n} */` : Z.nil; +} +function Vs(e, t) { + if (qn(e) && (Gn(e), Hn(e))) { + Us(e, t); + return; + } + (0, Bn.boolOrEmptySchema)(e, t); +} +function Hn({ schema: e, self: t }) { + if (typeof e == "boolean") + return !e; + for (const n in e) + if (t.RULES.all[n]) + return !0; + return !1; +} +function qn(e) { + return typeof e.schema != "boolean"; +} +function Us(e, t) { + const { schema: n, gen: a, opts: i } = e; + i.$comment && n.$comment && Wn(e), Hs(e), qs(e); + const l = a.const("_errs", ee.default.errors); + Kn(e, l), a.var(t, (0, Z._)`${l} === ${ee.default.errors}`); +} +function Gn(e) { + (0, at.checkUnknownRules)(e), Bs(e); +} +function Kn(e, t) { + if (e.opts.jtd) + return Qa(e, [], !1, t); + const n = (0, Ja.getSchemaTypes)(e.schema), a = (0, Ja.coerceAndCheckDataType)(e, n); + Qa(e, n, !a, t); +} +function Bs(e) { + const { schema: t, errSchemaPath: n, opts: a, self: i } = e; + t.$ref && a.ignoreKeywordsWithRef && (0, at.schemaHasRulesButRef)(t, i.RULES) && i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`); +} +function Fs(e) { + const { schema: t, opts: n } = e; + t.default !== void 0 && n.useDefaults && n.strictSchema && (0, at.checkStrictMode)(e, "default is ignored in the schema root"); +} +function Hs(e) { + const t = e.schema[e.opts.schemaId]; + t && (e.baseId = (0, As.resolveUrl)(e.opts.uriResolver, e.baseId, t)); +} +function qs(e) { + if (e.schema.$async && !e.schemaEnv.$async) + throw new Error("async schema in sync schema"); +} +function Wn({ gen: e, schemaEnv: t, schema: n, errSchemaPath: a, opts: i }) { + const l = n.$comment; + if (i.$comment === !0) + e.code((0, Z._)`${ee.default.self}.logger.log(${l})`); + else if (typeof i.$comment == "function") { + const f = (0, Z.str)`${a}/$comment`, b = e.scopeValue("root", { ref: t.root }); + e.code((0, Z._)`${ee.default.self}.opts.$comment(${l}, ${f}, ${b}.schema)`); + } +} +function Gs(e) { + const { gen: t, schemaEnv: n, validateName: a, ValidationError: i, opts: l } = e; + n.$async ? t.if((0, Z._)`${ee.default.errors} === 0`, () => t.return(ee.default.data), () => t.throw((0, Z._)`new ${i}(${ee.default.vErrors})`)) : (t.assign((0, Z._)`${a}.errors`, ee.default.vErrors), l.unevaluated && Ks(e), t.return((0, Z._)`${ee.default.errors} === 0`)); +} +function Ks({ gen: e, evaluated: t, props: n, items: a }) { + n instanceof Z.Name && e.assign((0, Z._)`${t}.props`, n), a instanceof Z.Name && e.assign((0, Z._)`${t}.items`, a); +} +function Qa(e, t, n, a) { + const { gen: i, schema: l, data: f, allErrors: b, opts: k, self: _ } = e, { RULES: y } = _; + if (l.$ref && (k.ignoreKeywordsWithRef || !(0, at.schemaHasRulesButRef)(l, y))) { + i.block(() => Zn(e, "$ref", y.all.$ref.definition)); + return; + } + k.jtd || Ws(e, t), i.block(() => { + for (const A of y.rules) + S(A); + S(y.post); + }); + function S(A) { + (0, Qr.shouldUseGroup)(l, A) && (A.type ? (i.if((0, kr.checkDataType)(A.type, f, k.strictNumbers)), Xa(e, A), t.length === 1 && t[0] === A.type && n && (i.else(), (0, kr.reportTypeError)(e)), i.endIf()) : Xa(e, A), b || i.if((0, Z._)`${ee.default.errors} === ${a || 0}`)); + } +} +function Xa(e, t) { + const { gen: n, schema: a, opts: { useDefaults: i } } = e; + i && (0, Is.assignDefaults)(e, t.type), n.block(() => { + for (const l of t.rules) + (0, Qr.shouldUseRule)(a, l) && Zn(e, l.keyword, l.definition, t.type); + }); +} +function Ws(e, t) { + e.schemaEnv.meta || !e.opts.strictTypes || (Ys(e, t), e.opts.allowUnionTypes || Js(e, t), Zs(e, e.dataTypes)); +} +function Ys(e, t) { + if (t.length) { + if (!e.dataTypes.length) { + e.dataTypes = t; + return; + } + t.forEach((n) => { + Yn(e.dataTypes, n) || Xr(e, `type "${n}" not allowed by context "${e.dataTypes.join(",")}"`); + }), Xs(e, t); + } +} +function Js(e, t) { + t.length > 1 && !(t.length === 2 && t.includes("null")) && Xr(e, "use allowUnionTypes to allow union type keyword"); +} +function Zs(e, t) { + const n = e.self.RULES.all; + for (const a in n) { + const i = n[a]; + if (typeof i == "object" && (0, Qr.shouldUseRule)(e.schema, i)) { + const { type: l } = i.definition; + l.length && !l.some((f) => Qs(t, f)) && Xr(e, `missing type "${l.join(",")}" for keyword "${a}"`); + } + } +} +function Qs(e, t) { + return e.includes(t) || t === "number" && e.includes("integer"); +} +function Yn(e, t) { + return e.includes(t) || t === "integer" && e.includes("number"); +} +function Xs(e, t) { + const n = []; + for (const a of e.dataTypes) + Yn(t, a) ? n.push(a) : t.includes("integer") && a === "number" && n.push("integer"); + e.dataTypes = n; +} +function Xr(e, t) { + const n = e.schemaEnv.baseId + e.errSchemaPath; + t += ` at "${n}" (strictTypes)`, (0, at.checkStrictMode)(e, t, e.opts.strictTypes); +} +class Jn { + constructor(t, n, a) { + if ((0, Jt.validateKeywordUsage)(t, n, a), this.gen = t.gen, this.allErrors = t.allErrors, this.keyword = a, this.data = t.data, this.schema = t.schema[a], this.$data = n.$data && t.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, at.schemaRefOrVal)(t, this.schema, a, this.$data), this.schemaType = n.schemaType, this.parentSchema = t.schema, this.params = {}, this.it = t, this.def = n, this.$data) + this.schemaCode = t.gen.const("vSchema", Qn(this.$data, t)); + else if (this.schemaCode = this.schemaValue, !(0, Jt.validSchemaType)(this.schema, n.schemaType, n.allowUndefined)) + throw new Error(`${a} value must be ${JSON.stringify(n.schemaType)}`); + ("code" in n ? n.trackErrors : n.errors !== !1) && (this.errsCount = t.gen.const("_errs", ee.default.errors)); + } + result(t, n, a) { + this.failResult((0, Z.not)(t), n, a); + } + failResult(t, n, a) { + this.gen.if(t), a ? a() : this.error(), n ? (this.gen.else(), n(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else(); + } + pass(t, n) { + this.failResult((0, Z.not)(t), void 0, n); + } + fail(t) { + if (t === void 0) { + this.error(), this.allErrors || this.gen.if(!1); + return; + } + this.gen.if(t), this.error(), this.allErrors ? this.gen.endIf() : this.gen.else(); + } + fail$data(t) { + if (!this.$data) + return this.fail(t); + const { schemaCode: n } = this; + this.fail((0, Z._)`${n} !== undefined && (${(0, Z.or)(this.invalid$data(), t)})`); + } + error(t, n, a) { + if (n) { + this.setParams(n), this._error(t, a), this.setParams({}); + return; + } + this._error(t, a); + } + _error(t, n) { + (t ? Kt.reportExtraError : Kt.reportError)(this, this.def.error, n); + } + $dataError() { + (0, Kt.reportError)(this, this.def.$dataError || Kt.keyword$DataError); + } + reset() { + if (this.errsCount === void 0) + throw new Error('add "trackErrors" to keyword definition'); + (0, Kt.resetErrorsCount)(this.gen, this.errsCount); + } + ok(t) { + this.allErrors || this.gen.if(t); + } + setParams(t, n) { + n ? Object.assign(this.params, t) : this.params = t; + } + block$data(t, n, a = Z.nil) { + this.gen.block(() => { + this.check$data(t, a), n(); + }); + } + check$data(t = Z.nil, n = Z.nil) { + if (!this.$data) + return; + const { gen: a, schemaCode: i, schemaType: l, def: f } = this; + a.if((0, Z.or)((0, Z._)`${i} === undefined`, n)), t !== Z.nil && a.assign(t, !0), (l.length || f.validateSchema) && (a.elseIf(this.invalid$data()), this.$dataError(), t !== Z.nil && a.assign(t, !1)), a.else(); + } + invalid$data() { + const { gen: t, schemaCode: n, schemaType: a, def: i, it: l } = this; + return (0, Z.or)(f(), b()); + function f() { + if (a.length) { + if (!(n instanceof Z.Name)) + throw new Error("ajv implementation error"); + const k = Array.isArray(a) ? a : [a]; + return (0, Z._)`${(0, kr.checkDataTypes)(k, n, l.opts.strictNumbers, kr.DataType.Wrong)}`; + } + return Z.nil; + } + function b() { + if (i.validateSchema) { + const k = t.scopeValue("validate$data", { ref: i.validateSchema }); + return (0, Z._)`!${k}(${n})`; + } + return Z.nil; + } + } + subschema(t, n) { + const a = (0, Rr.getSubschema)(this.it, t); + (0, Rr.extendSubschemaData)(a, this.it, t), (0, Rr.extendSubschemaMode)(a, t); + const i = { ...this.it, ...a, items: void 0, props: void 0 }; + return Vs(i, n), i; + } + mergeEvaluated(t, n) { + const { it: a, gen: i } = this; + a.opts.unevaluated && (a.props !== !0 && t.props !== void 0 && (a.props = at.mergeEvaluated.props(i, t.props, a.props, n)), a.items !== !0 && t.items !== void 0 && (a.items = at.mergeEvaluated.items(i, t.items, a.items, n))); + } + mergeValidEvaluated(t, n) { + const { it: a, gen: i } = this; + if (a.opts.unevaluated && (a.props !== !0 || a.items !== !0)) + return i.if(n, () => this.mergeEvaluated(t, Z.Name)), !0; + } +} +Ge.KeywordCxt = Jn; +function Zn(e, t, n, a) { + const i = new Jn(e, n, t); + "code" in n ? n.code(i, a) : i.$data && n.validate ? (0, Jt.funcKeywordCode)(i, n) : "macro" in n ? (0, Jt.macroKeywordCode)(i, n) : (n.compile || n.validate) && (0, Jt.funcKeywordCode)(i, n); +} +const ei = /^\/(?:[^~]|~0|~1)*$/, ti = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function Qn(e, { dataLevel: t, dataNames: n, dataPathArr: a }) { + let i, l; + if (e === "") + return ee.default.rootData; + if (e[0] === "/") { + if (!ei.test(e)) + throw new Error(`Invalid JSON-pointer: ${e}`); + i = e, l = ee.default.rootData; + } else { + const _ = ti.exec(e); + if (!_) + throw new Error(`Invalid JSON-pointer: ${e}`); + const y = +_[1]; + if (i = _[2], i === "#") { + if (y >= t) + throw new Error(k("property/index", y)); + return a[t - y]; + } + if (y > t) + throw new Error(k("data", y)); + if (l = n[t - y], !i) + return l; + } + let f = l; + const b = i.split("/"); + for (const _ of b) + _ && (l = (0, Z._)`${l}${(0, Z.getProperty)((0, at.unescapeJsonPointer)(_))}`, f = (0, Z._)`${f} && ${l}`); + return f; + function k(_, y) { + return `Cannot access ${_} ${y} levels up, current level is ${t}`; + } +} +Ge.getData = Qn; +var or = {}; +Object.defineProperty(or, "__esModule", { value: !0 }); +class ri extends Error { + constructor(t) { + super("validation failed"), this.errors = t, this.ajv = this.validation = !0; + } +} +or.default = ri; +var sr = {}; +Object.defineProperty(sr, "__esModule", { value: !0 }); +const Lr = Pe; +class ai extends Error { + constructor(t, n, a, i) { + super(i || `can't resolve reference ${a} from id ${n}`), this.missingRef = (0, Lr.resolveUrl)(t, n, a), this.missingSchema = (0, Lr.normalizeId)((0, Lr.getFullPath)(t, this.missingRef)); + } +} +sr.default = ai; +var Oe = {}; +Object.defineProperty(Oe, "__esModule", { value: !0 }); +Oe.resolveSchema = Oe.getCompilingSchema = Oe.resolveRef = Oe.compileSchema = Oe.SchemaEnv = void 0; +const Be = se, ni = or, mt = Qe, qe = Pe, en = ce, oi = Ge; +class Nr { + constructor(t) { + var n; + this.refs = {}, this.dynamicAnchors = {}; + let a; + typeof t.schema == "object" && (a = t.schema), this.schema = t.schema, this.schemaId = t.schemaId, this.root = t.root || this, this.baseId = (n = t.baseId) !== null && n !== void 0 ? n : (0, qe.normalizeId)(a == null ? void 0 : a[t.schemaId || "$id"]), this.schemaPath = t.schemaPath, this.localRefs = t.localRefs, this.meta = t.meta, this.$async = a == null ? void 0 : a.$async, this.refs = {}; + } +} +Oe.SchemaEnv = Nr; +function ea(e) { + const t = Xn.call(this, e); + if (t) + return t; + const n = (0, qe.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: a, lines: i } = this.opts.code, { ownProperties: l } = this.opts, f = new Be.CodeGen(this.scope, { es5: a, lines: i, ownProperties: l }); + let b; + e.$async && (b = f.scopeValue("Error", { + ref: ni.default, + code: (0, Be._)`require("ajv/dist/runtime/validation_error").default` + })); + const k = f.scopeName("validate"); + e.validateName = k; + const _ = { + gen: f, + allErrors: this.opts.allErrors, + data: mt.default.data, + parentData: mt.default.parentData, + parentDataProperty: mt.default.parentDataProperty, + dataNames: [mt.default.data], + dataPathArr: [Be.nil], + dataLevel: 0, + dataTypes: [], + definedProperties: /* @__PURE__ */ new Set(), + topSchemaRef: f.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, Be.stringify)(e.schema) } : { ref: e.schema }), + validateName: k, + ValidationError: b, + schema: e.schema, + schemaEnv: e, + rootId: n, + baseId: e.baseId || n, + schemaPath: Be.nil, + errSchemaPath: e.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: (0, Be._)`""`, + opts: this.opts, + self: this + }; + let y; + try { + this._compilations.add(e), (0, oi.validateFunctionCode)(_), f.optimize(this.opts.code.optimize); + const S = f.toString(); + y = `${f.scopeRefs(mt.default.scope)}return ${S}`, this.opts.code.process && (y = this.opts.code.process(y, e)); + const A = new Function(`${mt.default.self}`, `${mt.default.scope}`, y)(this, this.scope.get()); + if (this.scope.value(k, { ref: A }), A.errors = null, A.schema = e.schema, A.schemaEnv = e, e.$async && (A.$async = !0), this.opts.code.source === !0 && (A.source = { validateName: k, validateCode: S, scopeValues: f._values }), this.opts.unevaluated) { + const { props: M, items: O } = _; + A.evaluated = { + props: M instanceof Be.Name ? void 0 : M, + items: O instanceof Be.Name ? void 0 : O, + dynamicProps: M instanceof Be.Name, + dynamicItems: O instanceof Be.Name + }, A.source && (A.source.evaluated = (0, Be.stringify)(A.evaluated)); + } + return e.validate = A, e; + } catch (S) { + throw delete e.validate, delete e.validateName, y && this.logger.error("Error compiling schema, function code:", y), S; + } finally { + this._compilations.delete(e); + } +} +Oe.compileSchema = ea; +function si(e, t, n) { + var a; + n = (0, qe.resolveUrl)(this.opts.uriResolver, t, n); + const i = e.refs[n]; + if (i) + return i; + let l = li.call(this, e, n); + if (l === void 0) { + const f = (a = e.localRefs) === null || a === void 0 ? void 0 : a[n], { schemaId: b } = this.opts; + f && (l = new Nr({ schema: f, schemaId: b, root: e, baseId: t })); + } + if (l !== void 0) + return e.refs[n] = ii.call(this, l); +} +Oe.resolveRef = si; +function ii(e) { + return (0, qe.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : ea.call(this, e); +} +function Xn(e) { + for (const t of this._compilations) + if (ci(t, e)) + return t; +} +Oe.getCompilingSchema = Xn; +function ci(e, t) { + return e.schema === t.schema && e.root === t.root && e.baseId === t.baseId; +} +function li(e, t) { + let n; + for (; typeof (n = this.refs[t]) == "string"; ) + t = n; + return n || this.schemas[t] || Or.call(this, e, t); +} +function Or(e, t) { + const n = this.opts.uriResolver.parse(t), a = (0, qe._getFullPath)(this.opts.uriResolver, n); + let i = (0, qe.getFullPath)(this.opts.uriResolver, e.baseId, void 0); + if (Object.keys(e.schema).length > 0 && a === i) + return Mr.call(this, n, e); + const l = (0, qe.normalizeId)(a), f = this.refs[l] || this.schemas[l]; + if (typeof f == "string") { + const b = Or.call(this, e, f); + return typeof (b == null ? void 0 : b.schema) != "object" ? void 0 : Mr.call(this, n, b); + } + if (typeof (f == null ? void 0 : f.schema) == "object") { + if (f.validate || ea.call(this, f), l === (0, qe.normalizeId)(t)) { + const { schema: b } = f, { schemaId: k } = this.opts, _ = b[k]; + return _ && (i = (0, qe.resolveUrl)(this.opts.uriResolver, i, _)), new Nr({ schema: b, schemaId: k, root: e, baseId: i }); + } + return Mr.call(this, n, f); + } +} +Oe.resolveSchema = Or; +const ui = /* @__PURE__ */ new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions" +]); +function Mr(e, { baseId: t, schema: n, root: a }) { + var i; + if (((i = e.fragment) === null || i === void 0 ? void 0 : i[0]) !== "/") + return; + for (const b of e.fragment.slice(1).split("/")) { + if (typeof n == "boolean") + return; + const k = n[(0, en.unescapeFragment)(b)]; + if (k === void 0) + return; + n = k; + const _ = typeof n == "object" && n[this.opts.schemaId]; + !ui.has(b) && _ && (t = (0, qe.resolveUrl)(this.opts.uriResolver, t, _)); + } + let l; + if (typeof n != "boolean" && n.$ref && !(0, en.schemaHasRulesButRef)(n, this.RULES)) { + const b = (0, qe.resolveUrl)(this.opts.uriResolver, t, n.$ref); + l = Or.call(this, a, b); + } + const { schemaId: f } = this.opts; + if (l = l || new Nr({ schema: n, schemaId: f, root: a, baseId: t }), l.schema !== l.root.schema) + return l; +} +const di = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", hi = "Meta-schema for $data reference (JSON AnySchema extension proposal)", pi = "object", fi = [ + "$data" +], mi = { + $data: { + type: "string", + anyOf: [ + { + format: "relative-json-pointer" + }, + { + format: "json-pointer" + } + ] + } +}, gi = !1, yi = { + $id: di, + description: hi, + type: pi, + required: fi, + properties: mi, + additionalProperties: gi +}; +var ta = {}, Hr = { exports: {} }; +/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +(function(e, t) { + (function(n, a) { + a(t); + })(jn, function(n) { + function a() { + for (var h = arguments.length, w = Array(h), E = 0; E < h; E++) + w[E] = arguments[E]; + if (w.length > 1) { + w[0] = w[0].slice(0, -1); + for (var L = w.length - 1, z = 1; z < L; ++z) + w[z] = w[z].slice(1, -1); + return w[L] = w[L].slice(1), w.join(""); + } else + return w[0]; + } + function i(h) { + return "(?:" + h + ")"; + } + function l(h) { + return h === void 0 ? "undefined" : h === null ? "null" : Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase(); + } + function f(h) { + return h.toUpperCase(); + } + function b(h) { + return h != null ? h instanceof Array ? h : typeof h.length != "number" || h.split || h.setInterval || h.call ? [h] : Array.prototype.slice.call(h) : []; + } + function k(h, w) { + var E = h; + if (w) + for (var L in w) + E[L] = w[L]; + return E; + } + function _(h) { + var w = "[A-Za-z]", E = "[0-9]", L = a(E, "[A-Fa-f]"), z = i(i("%[EFef]" + L + "%" + L + L + "%" + L + L) + "|" + i("%[89A-Fa-f]" + L + "%" + L + L) + "|" + i("%" + L + L)), X = "[\\:\\/\\?\\#\\[\\]\\@]", Q = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", le = a(X, Q), be = h ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", de = h ? "[\\uE000-\\uF8FF]" : "[]", ie = a(w, E, "[\\-\\.\\_\\~]", be); + i(w + a(w, E, "[\\+\\-\\.]") + "*"), i(i(z + "|" + a(ie, Q, "[\\:]")) + "*"); + var me = i(i("25[0-5]") + "|" + i("2[0-4]" + E) + "|" + i("1" + E + E) + "|" + i("0?[1-9]" + E) + "|0?0?" + E), ye = i(me + "\\." + me + "\\." + me + "\\." + me), te = i(L + "{1,4}"), we = i(i(te + "\\:" + te) + "|" + ye), he = i(i(te + "\\:") + "{6}" + we), Re = i("\\:\\:" + i(te + "\\:") + "{5}" + we), jt = i(i(te) + "?\\:\\:" + i(te + "\\:") + "{4}" + we), Ue = i(i(i(te + "\\:") + "{0,1}" + te) + "?\\:\\:" + i(te + "\\:") + "{3}" + we), et = i(i(i(te + "\\:") + "{0,2}" + te) + "?\\:\\:" + i(te + "\\:") + "{2}" + we), ht = i(i(i(te + "\\:") + "{0,3}" + te) + "?\\:\\:" + te + "\\:" + we), pt = i(i(i(te + "\\:") + "{0,4}" + te) + "?\\:\\:" + we), Le = i(i(i(te + "\\:") + "{0,5}" + te) + "?\\:\\:" + te), tt = i(i(i(te + "\\:") + "{0,6}" + te) + "?\\:\\:"), ft = i([he, Re, jt, Ue, et, ht, pt, Le, tt].join("|")), Ye = i(i(ie + "|" + z) + "+"); + i("[vV]" + L + "+\\." + a(ie, Q, "[\\:]") + "+"), i(i(z + "|" + a(ie, Q)) + "*"); + var lr = i(z + "|" + a(ie, Q, "[\\:\\@]")); + return i(i(z + "|" + a(ie, Q, "[\\@]")) + "+"), i(i(lr + "|" + a("[\\/\\?]", de)) + "*"), { + NOT_SCHEME: new RegExp(a("[^]", w, E, "[\\+\\-\\.]"), "g"), + NOT_USERINFO: new RegExp(a("[^\\%\\:]", ie, Q), "g"), + NOT_HOST: new RegExp(a("[^\\%\\[\\]\\:]", ie, Q), "g"), + NOT_PATH: new RegExp(a("[^\\%\\/\\:\\@]", ie, Q), "g"), + NOT_PATH_NOSCHEME: new RegExp(a("[^\\%\\/\\@]", ie, Q), "g"), + NOT_QUERY: new RegExp(a("[^\\%]", ie, Q, "[\\:\\@\\/\\?]", de), "g"), + NOT_FRAGMENT: new RegExp(a("[^\\%]", ie, Q, "[\\:\\@\\/\\?]"), "g"), + ESCAPE: new RegExp(a("[^]", ie, Q), "g"), + UNRESERVED: new RegExp(ie, "g"), + OTHER_CHARS: new RegExp(a("[^\\%]", ie, le), "g"), + PCT_ENCODED: new RegExp(z, "g"), + IPV4ADDRESS: new RegExp("^(" + ye + ")$"), + IPV6ADDRESS: new RegExp("^\\[?(" + ft + ")" + i(i("\\%25|\\%(?!" + L + "{2})") + "(" + Ye + ")") + "?\\]?$") + //RFC 6874, with relaxed parsing rules + }; + } + var y = _(!1), S = _(!0), A = function() { + function h(w, E) { + var L = [], z = !0, X = !1, Q = void 0; + try { + for (var le = w[Symbol.iterator](), be; !(z = (be = le.next()).done) && (L.push(be.value), !(E && L.length === E)); z = !0) + ; + } catch (de) { + X = !0, Q = de; + } finally { + try { + !z && le.return && le.return(); + } finally { + if (X) + throw Q; + } + } + return L; + } + return function(w, E) { + if (Array.isArray(w)) + return w; + if (Symbol.iterator in Object(w)) + return h(w, E); + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + }; + }(), M = function(h) { + if (Array.isArray(h)) { + for (var w = 0, E = Array(h.length); w < h.length; w++) + E[w] = h[w]; + return E; + } else + return Array.from(h); + }, O = 2147483647, C = 36, x = 1, $ = 26, T = 38, R = 700, r = 72, s = 128, o = "-", c = /^xn--/, u = /[^\0-\x7E]/, m = /[\x2E\u3002\uFF0E\uFF61]/g, p = { + overflow: "Overflow: input needs wider integers to process", + "not-basic": "Illegal input >= 0x80 (not a basic code point)", + "invalid-input": "Invalid input" + }, j = C - x, V = Math.floor, F = String.fromCharCode; + function D(h) { + throw new RangeError(p[h]); + } + function q(h, w) { + for (var E = [], L = h.length; L--; ) + E[L] = w(h[L]); + return E; + } + function g(h, w) { + var E = h.split("@"), L = ""; + E.length > 1 && (L = E[0] + "@", h = E[1]), h = h.replace(m, "."); + var z = h.split("."), X = q(z, w).join("."); + return L + X; + } + function H(h) { + for (var w = [], E = 0, L = h.length; E < L; ) { + var z = h.charCodeAt(E++); + if (z >= 55296 && z <= 56319 && E < L) { + var X = h.charCodeAt(E++); + (X & 64512) == 56320 ? w.push(((z & 1023) << 10) + (X & 1023) + 65536) : (w.push(z), E--); + } else + w.push(z); + } + return w; + } + var W = function(h) { + return String.fromCodePoint.apply(String, M(h)); + }, J = function(h) { + return h - 48 < 10 ? h - 22 : h - 65 < 26 ? h - 65 : h - 97 < 26 ? h - 97 : C; + }, U = function(h, w) { + return h + 22 + 75 * (h < 26) - ((w != 0) << 5); + }, P = function(h, w, E) { + var L = 0; + for ( + h = E ? V(h / R) : h >> 1, h += V(h / w); + /* no initialization */ + h > j * $ >> 1; + L += C + ) + h = V(h / j); + return V(L + (j + 1) * h / (h + T)); + }, B = function(h) { + var w = [], E = h.length, L = 0, z = s, X = r, Q = h.lastIndexOf(o); + Q < 0 && (Q = 0); + for (var le = 0; le < Q; ++le) + h.charCodeAt(le) >= 128 && D("not-basic"), w.push(h.charCodeAt(le)); + for (var be = Q > 0 ? Q + 1 : 0; be < E; ) { + for ( + var de = L, ie = 1, me = C; + ; + /* no condition */ + me += C + ) { + be >= E && D("invalid-input"); + var ye = J(h.charCodeAt(be++)); + (ye >= C || ye > V((O - L) / ie)) && D("overflow"), L += ye * ie; + var te = me <= X ? x : me >= X + $ ? $ : me - X; + if (ye < te) + break; + var we = C - te; + ie > V(O / we) && D("overflow"), ie *= we; + } + var he = w.length + 1; + X = P(L - de, he, de == 0), V(L / he) > O - z && D("overflow"), z += V(L / he), L %= he, w.splice(L++, 0, z); + } + return String.fromCodePoint.apply(String, w); + }, N = function(h) { + var w = []; + h = H(h); + var E = h.length, L = s, z = 0, X = r, Q = !0, le = !1, be = void 0; + try { + for (var de = h[Symbol.iterator](), ie; !(Q = (ie = de.next()).done); Q = !0) { + var me = ie.value; + me < 128 && w.push(F(me)); + } + } catch (Gt) { + le = !0, be = Gt; + } finally { + try { + !Q && de.return && de.return(); + } finally { + if (le) + throw be; + } + } + var ye = w.length, te = ye; + for (ye && w.push(o); te < E; ) { + var we = O, he = !0, Re = !1, jt = void 0; + try { + for (var Ue = h[Symbol.iterator](), et; !(he = (et = Ue.next()).done); he = !0) { + var ht = et.value; + ht >= L && ht < we && (we = ht); + } + } catch (Gt) { + Re = !0, jt = Gt; + } finally { + try { + !he && Ue.return && Ue.return(); + } finally { + if (Re) + throw jt; + } + } + var pt = te + 1; + we - L > V((O - z) / pt) && D("overflow"), z += (we - L) * pt, L = we; + var Le = !0, tt = !1, ft = void 0; + try { + for (var Ye = h[Symbol.iterator](), lr; !(Le = (lr = Ye.next()).done); Le = !0) { + var qa = lr.value; + if (qa < L && ++z > O && D("overflow"), qa == L) { + for ( + var ur = z, dr = C; + ; + /* no condition */ + dr += C + ) { + var hr = dr <= X ? x : dr >= X + $ ? $ : dr - X; + if (ur < hr) + break; + var Ga = ur - hr, Ka = C - hr; + w.push(F(U(hr + Ga % Ka, 0))), ur = V(Ga / Ka); + } + w.push(F(U(ur, 0))), X = P(z, pt, te == ye), z = 0, ++te; + } + } + } catch (Gt) { + tt = !0, ft = Gt; + } finally { + try { + !Le && Ye.return && Ye.return(); + } finally { + if (tt) + throw ft; + } + } + ++z, ++L; + } + return w.join(""); + }, d = function(h) { + return g(h, function(w) { + return c.test(w) ? B(w.slice(4).toLowerCase()) : w; + }); + }, v = function(h) { + return g(h, function(w) { + return u.test(w) ? "xn--" + N(w) : w; + }); + }, I = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + version: "2.1.0", + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + ucs2: { + decode: H, + encode: W + }, + decode: B, + encode: N, + toASCII: v, + toUnicode: d + }, G = {}; + function K(h) { + var w = h.charCodeAt(0), E = void 0; + return w < 16 ? E = "%0" + w.toString(16).toUpperCase() : w < 128 ? E = "%" + w.toString(16).toUpperCase() : w < 2048 ? E = "%" + (w >> 6 | 192).toString(16).toUpperCase() + "%" + (w & 63 | 128).toString(16).toUpperCase() : E = "%" + (w >> 12 | 224).toString(16).toUpperCase() + "%" + (w >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (w & 63 | 128).toString(16).toUpperCase(), E; + } + function re(h) { + for (var w = "", E = 0, L = h.length; E < L; ) { + var z = parseInt(h.substr(E + 1, 2), 16); + if (z < 128) + w += String.fromCharCode(z), E += 3; + else if (z >= 194 && z < 224) { + if (L - E >= 6) { + var X = parseInt(h.substr(E + 4, 2), 16); + w += String.fromCharCode((z & 31) << 6 | X & 63); + } else + w += h.substr(E, 6); + E += 6; + } else if (z >= 224) { + if (L - E >= 9) { + var Q = parseInt(h.substr(E + 4, 2), 16), le = parseInt(h.substr(E + 7, 2), 16); + w += String.fromCharCode((z & 15) << 12 | (Q & 63) << 6 | le & 63); + } else + w += h.substr(E, 9); + E += 9; + } else + w += h.substr(E, 3), E += 3; + } + return w; + } + function ne(h, w) { + function E(L) { + var z = re(L); + return z.match(w.UNRESERVED) ? z : L; + } + return h.scheme && (h.scheme = String(h.scheme).replace(w.PCT_ENCODED, E).toLowerCase().replace(w.NOT_SCHEME, "")), h.userinfo !== void 0 && (h.userinfo = String(h.userinfo).replace(w.PCT_ENCODED, E).replace(w.NOT_USERINFO, K).replace(w.PCT_ENCODED, f)), h.host !== void 0 && (h.host = String(h.host).replace(w.PCT_ENCODED, E).toLowerCase().replace(w.NOT_HOST, K).replace(w.PCT_ENCODED, f)), h.path !== void 0 && (h.path = String(h.path).replace(w.PCT_ENCODED, E).replace(h.scheme ? w.NOT_PATH : w.NOT_PATH_NOSCHEME, K).replace(w.PCT_ENCODED, f)), h.query !== void 0 && (h.query = String(h.query).replace(w.PCT_ENCODED, E).replace(w.NOT_QUERY, K).replace(w.PCT_ENCODED, f)), h.fragment !== void 0 && (h.fragment = String(h.fragment).replace(w.PCT_ENCODED, E).replace(w.NOT_FRAGMENT, K).replace(w.PCT_ENCODED, f)), h; + } + function fe(h) { + return h.replace(/^0*(.*)/, "$1") || "0"; + } + function xe(h, w) { + var E = h.match(w.IPV4ADDRESS) || [], L = A(E, 2), z = L[1]; + return z ? z.split(".").map(fe).join(".") : h; + } + function Xe(h, w) { + var E = h.match(w.IPV6ADDRESS) || [], L = A(E, 3), z = L[1], X = L[2]; + if (z) { + for (var Q = z.toLowerCase().split("::").reverse(), le = A(Q, 2), be = le[0], de = le[1], ie = de ? de.split(":").map(fe) : [], me = be.split(":").map(fe), ye = w.IPV4ADDRESS.test(me[me.length - 1]), te = ye ? 7 : 8, we = me.length - te, he = Array(te), Re = 0; Re < te; ++Re) + he[Re] = ie[Re] || me[we + Re] || ""; + ye && (he[te - 1] = xe(he[te - 1], w)); + var jt = he.reduce(function(Le, tt, ft) { + if (!tt || tt === "0") { + var Ye = Le[Le.length - 1]; + Ye && Ye.index + Ye.length === ft ? Ye.length++ : Le.push({ index: ft, length: 1 }); + } + return Le; + }, []), Ue = jt.sort(function(Le, tt) { + return tt.length - Le.length; + })[0], et = void 0; + if (Ue && Ue.length > 1) { + var ht = he.slice(0, Ue.index), pt = he.slice(Ue.index + Ue.length); + et = ht.join(":") + "::" + pt.join(":"); + } else + et = he.join(":"); + return X && (et += "%" + X), et; + } else + return h; + } + var Dt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Vt = "".match(/(){0}/)[1] === void 0; + function Ie(h) { + var w = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, E = {}, L = w.iri !== !1 ? S : y; + w.reference === "suffix" && (h = (w.scheme ? w.scheme + ":" : "") + "//" + h); + var z = h.match(Dt); + if (z) { + Vt ? (E.scheme = z[1], E.userinfo = z[3], E.host = z[4], E.port = parseInt(z[5], 10), E.path = z[6] || "", E.query = z[7], E.fragment = z[8], isNaN(E.port) && (E.port = z[5])) : (E.scheme = z[1] || void 0, E.userinfo = h.indexOf("@") !== -1 ? z[3] : void 0, E.host = h.indexOf("//") !== -1 ? z[4] : void 0, E.port = parseInt(z[5], 10), E.path = z[6] || "", E.query = h.indexOf("?") !== -1 ? z[7] : void 0, E.fragment = h.indexOf("#") !== -1 ? z[8] : void 0, isNaN(E.port) && (E.port = h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? z[4] : void 0)), E.host && (E.host = Xe(xe(E.host, L), L)), E.scheme === void 0 && E.userinfo === void 0 && E.host === void 0 && E.port === void 0 && !E.path && E.query === void 0 ? E.reference = "same-document" : E.scheme === void 0 ? E.reference = "relative" : E.fragment === void 0 ? E.reference = "absolute" : E.reference = "uri", w.reference && w.reference !== "suffix" && w.reference !== E.reference && (E.error = E.error || "URI is not a " + w.reference + " reference."); + var X = G[(w.scheme || E.scheme || "").toLowerCase()]; + if (!w.unicodeSupport && (!X || !X.unicodeSupport)) { + if (E.host && (w.domainHost || X && X.domainHost)) + try { + E.host = I.toASCII(E.host.replace(L.PCT_ENCODED, re).toLowerCase()); + } catch (Q) { + E.error = E.error || "Host's domain name can not be converted to ASCII via punycode: " + Q; + } + ne(E, y); + } else + ne(E, L); + X && X.parse && X.parse(E, w); + } else + E.error = E.error || "URI can not be parsed."; + return E; + } + function Ut(h, w) { + var E = w.iri !== !1 ? S : y, L = []; + return h.userinfo !== void 0 && (L.push(h.userinfo), L.push("@")), h.host !== void 0 && L.push(Xe(xe(String(h.host), E), E).replace(E.IPV6ADDRESS, function(z, X, Q) { + return "[" + X + (Q ? "%25" + Q : "") + "]"; + })), (typeof h.port == "number" || typeof h.port == "string") && (L.push(":"), L.push(String(h.port))), L.length ? L.join("") : void 0; + } + var $t = /^\.\.?\//, kt = /^\/\.(\/|$)/, Pt = /^\/\.\.(\/|$)/, Bt = /^\/?(?:.|\n)*?(?=\/|$)/; + function Ke(h) { + for (var w = []; h.length; ) + if (h.match($t)) + h = h.replace($t, ""); + else if (h.match(kt)) + h = h.replace(kt, "/"); + else if (h.match(Pt)) + h = h.replace(Pt, "/"), w.pop(); + else if (h === "." || h === "..") + h = ""; + else { + var E = h.match(Bt); + if (E) { + var L = E[0]; + h = h.slice(L.length), w.push(L); + } else + throw new Error("Unexpected dot segment condition"); + } + return w.join(""); + } + function Te(h) { + var w = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, E = w.iri ? S : y, L = [], z = G[(w.scheme || h.scheme || "").toLowerCase()]; + if (z && z.serialize && z.serialize(h, w), h.host && !E.IPV6ADDRESS.test(h.host) && (w.domainHost || z && z.domainHost)) + try { + h.host = w.iri ? I.toUnicode(h.host) : I.toASCII(h.host.replace(E.PCT_ENCODED, re).toLowerCase()); + } catch (le) { + h.error = h.error || "Host's domain name can not be converted to " + (w.iri ? "Unicode" : "ASCII") + " via punycode: " + le; + } + ne(h, E), w.reference !== "suffix" && h.scheme && (L.push(h.scheme), L.push(":")); + var X = Ut(h, w); + if (X !== void 0 && (w.reference !== "suffix" && L.push("//"), L.push(X), h.path && h.path.charAt(0) !== "/" && L.push("/")), h.path !== void 0) { + var Q = h.path; + !w.absolutePath && (!z || !z.absolutePath) && (Q = Ke(Q)), X === void 0 && (Q = Q.replace(/^\/\//, "/%2F")), L.push(Q); + } + return h.query !== void 0 && (L.push("?"), L.push(h.query)), h.fragment !== void 0 && (L.push("#"), L.push(h.fragment)), L.join(""); + } + function Et(h, w) { + var E = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, L = arguments[3], z = {}; + return L || (h = Ie(Te(h, E), E), w = Ie(Te(w, E), E)), E = E || {}, !E.tolerant && w.scheme ? (z.scheme = w.scheme, z.userinfo = w.userinfo, z.host = w.host, z.port = w.port, z.path = Ke(w.path || ""), z.query = w.query) : (w.userinfo !== void 0 || w.host !== void 0 || w.port !== void 0 ? (z.userinfo = w.userinfo, z.host = w.host, z.port = w.port, z.path = Ke(w.path || ""), z.query = w.query) : (w.path ? (w.path.charAt(0) === "/" ? z.path = Ke(w.path) : ((h.userinfo !== void 0 || h.host !== void 0 || h.port !== void 0) && !h.path ? z.path = "/" + w.path : h.path ? z.path = h.path.slice(0, h.path.lastIndexOf("/") + 1) + w.path : z.path = w.path, z.path = Ke(z.path)), z.query = w.query) : (z.path = h.path, w.query !== void 0 ? z.query = w.query : z.query = h.query), z.userinfo = h.userinfo, z.host = h.host, z.port = h.port), z.scheme = h.scheme), z.fragment = w.fragment, z; + } + function Ft(h, w, E) { + var L = k({ scheme: "null" }, E); + return Te(Et(Ie(h, L), Ie(w, L), L, !0), L); + } + function ut(h, w) { + return typeof h == "string" ? h = Te(Ie(h, w), w) : l(h) === "object" && (h = Ie(Te(h, w), w)), h; + } + function Ht(h, w, E) { + return typeof h == "string" ? h = Te(Ie(h, E), E) : l(h) === "object" && (h = Te(h, E)), typeof w == "string" ? w = Te(Ie(w, E), E) : l(w) === "object" && (w = Te(w, E)), h === w; + } + function cr(h, w) { + return h && h.toString().replace(!w || !w.iri ? y.ESCAPE : S.ESCAPE, K); + } + function Ae(h, w) { + return h && h.toString().replace(!w || !w.iri ? y.PCT_ENCODED : S.PCT_ENCODED, re); + } + var dt = { + scheme: "http", + domainHost: !0, + parse: function(h, w) { + return h.host || (h.error = h.error || "HTTP URIs must have a host."), h; + }, + serialize: function(h, w) { + var E = String(h.scheme).toLowerCase() === "https"; + return (h.port === (E ? 443 : 80) || h.port === "") && (h.port = void 0), h.path || (h.path = "/"), h; + } + }, Ma = { + scheme: "https", + domainHost: dt.domainHost, + parse: dt.parse, + serialize: dt.serialize + }; + function za(h) { + return typeof h.secure == "boolean" ? h.secure : String(h.scheme).toLowerCase() === "wss"; + } + var qt = { + scheme: "ws", + domainHost: !0, + parse: function(h, w) { + var E = h; + return E.secure = za(E), E.resourceName = (E.path || "/") + (E.query ? "?" + E.query : ""), E.path = void 0, E.query = void 0, E; + }, + serialize: function(h, w) { + if ((h.port === (za(h) ? 443 : 80) || h.port === "") && (h.port = void 0), typeof h.secure == "boolean" && (h.scheme = h.secure ? "wss" : "ws", h.secure = void 0), h.resourceName) { + var E = h.resourceName.split("?"), L = A(E, 2), z = L[0], X = L[1]; + h.path = z && z !== "/" ? z : void 0, h.query = X, h.resourceName = void 0; + } + return h.fragment = void 0, h; + } + }, Da = { + scheme: "wss", + domainHost: qt.domainHost, + parse: qt.parse, + serialize: qt.serialize + }, vo = {}, Va = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", We = "[0-9A-Fa-f]", $o = i(i("%[EFef]" + We + "%" + We + We + "%" + We + We) + "|" + i("%[89A-Fa-f]" + We + "%" + We + We) + "|" + i("%" + We + We)), ko = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", Po = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", Eo = a(Po, '[\\"\\\\]'), So = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", jo = new RegExp(Va, "g"), St = new RegExp($o, "g"), xo = new RegExp(a("[^]", ko, "[\\.]", '[\\"]', Eo), "g"), Ua = new RegExp(a("[^]", Va, So), "g"), To = Ua; + function Ar(h) { + var w = re(h); + return w.match(jo) ? w : h; + } + var Ba = { + scheme: "mailto", + parse: function(h, w) { + var E = h, L = E.to = E.path ? E.path.split(",") : []; + if (E.path = void 0, E.query) { + for (var z = !1, X = {}, Q = E.query.split("&"), le = 0, be = Q.length; le < be; ++le) { + var de = Q[le].split("="); + switch (de[0]) { + case "to": + for (var ie = de[1].split(","), me = 0, ye = ie.length; me < ye; ++me) + L.push(ie[me]); + break; + case "subject": + E.subject = Ae(de[1], w); + break; + case "body": + E.body = Ae(de[1], w); + break; + default: + z = !0, X[Ae(de[0], w)] = Ae(de[1], w); + break; + } + } + z && (E.headers = X); + } + E.query = void 0; + for (var te = 0, we = L.length; te < we; ++te) { + var he = L[te].split("@"); + if (he[0] = Ae(he[0]), w.unicodeSupport) + he[1] = Ae(he[1], w).toLowerCase(); + else + try { + he[1] = I.toASCII(Ae(he[1], w).toLowerCase()); + } catch (Re) { + E.error = E.error || "Email address's domain name can not be converted to ASCII via punycode: " + Re; + } + L[te] = he.join("@"); + } + return E; + }, + serialize: function(h, w) { + var E = h, L = b(h.to); + if (L) { + for (var z = 0, X = L.length; z < X; ++z) { + var Q = String(L[z]), le = Q.lastIndexOf("@"), be = Q.slice(0, le).replace(St, Ar).replace(St, f).replace(xo, K), de = Q.slice(le + 1); + try { + de = w.iri ? I.toUnicode(de) : I.toASCII(Ae(de, w).toLowerCase()); + } catch (te) { + E.error = E.error || "Email address's domain name can not be converted to " + (w.iri ? "Unicode" : "ASCII") + " via punycode: " + te; + } + L[z] = be + "@" + de; + } + E.path = L.join(","); + } + var ie = h.headers = h.headers || {}; + h.subject && (ie.subject = h.subject), h.body && (ie.body = h.body); + var me = []; + for (var ye in ie) + ie[ye] !== vo[ye] && me.push(ye.replace(St, Ar).replace(St, f).replace(Ua, K) + "=" + ie[ye].replace(St, Ar).replace(St, f).replace(To, K)); + return me.length && (E.query = me.join("&")), E; + } + }, Co = /^([^\:]+)\:(.*)/, Fa = { + scheme: "urn", + parse: function(h, w) { + var E = h.path && h.path.match(Co), L = h; + if (E) { + var z = w.scheme || L.scheme || "urn", X = E[1].toLowerCase(), Q = E[2], le = z + ":" + (w.nid || X), be = G[le]; + L.nid = X, L.nss = Q, L.path = void 0, be && (L = be.parse(L, w)); + } else + L.error = L.error || "URN can not be parsed."; + return L; + }, + serialize: function(h, w) { + var E = w.scheme || h.scheme || "urn", L = h.nid, z = E + ":" + (w.nid || L), X = G[z]; + X && (h = X.serialize(h, w)); + var Q = h, le = h.nss; + return Q.path = (L || w.nid) + ":" + le, Q; + } + }, No = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ha = { + scheme: "urn:uuid", + parse: function(h, w) { + var E = h; + return E.uuid = E.nss, E.nss = void 0, !w.tolerant && (!E.uuid || !E.uuid.match(No)) && (E.error = E.error || "UUID is not valid."), E; + }, + serialize: function(h, w) { + var E = h; + return E.nss = (h.uuid || "").toLowerCase(), E; + } + }; + G[dt.scheme] = dt, G[Ma.scheme] = Ma, G[qt.scheme] = qt, G[Da.scheme] = Da, G[Ba.scheme] = Ba, G[Fa.scheme] = Fa, G[Ha.scheme] = Ha, n.SCHEMES = G, n.pctEncChar = K, n.pctDecChars = re, n.parse = Ie, n.removeDotSegments = Ke, n.serialize = Te, n.resolveComponents = Et, n.resolve = Ft, n.normalize = ut, n.equal = Ht, n.escapeComponent = cr, n.unescapeComponent = Ae, Object.defineProperty(n, "__esModule", { value: !0 }); + }); +})(Hr, Hr.exports); +var _i = Hr.exports; +Object.defineProperty(ta, "__esModule", { value: !0 }); +const eo = _i; +eo.code = 'require("ajv/dist/runtime/uri").default'; +ta.default = eo; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.CodeGen = e.Name = e.nil = e.stringify = e.str = e._ = e.KeywordCxt = void 0; + var t = Ge; + Object.defineProperty(e, "KeywordCxt", { enumerable: !0, get: function() { + return t.KeywordCxt; + } }); + var n = se; + Object.defineProperty(e, "_", { enumerable: !0, get: function() { + return n._; + } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { + return n.str; + } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { + return n.stringify; + } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { + return n.nil; + } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { + return n.Name; + } }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() { + return n.CodeGen; + } }); + const a = or, i = sr, l = wt, f = Oe, b = se, k = Pe, _ = nr, y = ce, S = yi, A = ta, M = (U, P) => new RegExp(U, P); + M.code = "new RegExp"; + const O = ["removeAdditional", "useDefaults", "coerceTypes"], C = /* @__PURE__ */ new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error" + ]), x = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now." + }, $ = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.' + }, T = 200; + function R(U) { + var P, B, N, d, v, I, G, K, re, ne, fe, xe, Xe, Dt, Vt, Ie, Ut, $t, kt, Pt, Bt, Ke, Te, Et, Ft; + const ut = U.strict, Ht = (P = U.code) === null || P === void 0 ? void 0 : P.optimize, cr = Ht === !0 || Ht === void 0 ? 1 : Ht || 0, Ae = (N = (B = U.code) === null || B === void 0 ? void 0 : B.regExp) !== null && N !== void 0 ? N : M, dt = (d = U.uriResolver) !== null && d !== void 0 ? d : A.default; + return { + strictSchema: (I = (v = U.strictSchema) !== null && v !== void 0 ? v : ut) !== null && I !== void 0 ? I : !0, + strictNumbers: (K = (G = U.strictNumbers) !== null && G !== void 0 ? G : ut) !== null && K !== void 0 ? K : !0, + strictTypes: (ne = (re = U.strictTypes) !== null && re !== void 0 ? re : ut) !== null && ne !== void 0 ? ne : "log", + strictTuples: (xe = (fe = U.strictTuples) !== null && fe !== void 0 ? fe : ut) !== null && xe !== void 0 ? xe : "log", + strictRequired: (Dt = (Xe = U.strictRequired) !== null && Xe !== void 0 ? Xe : ut) !== null && Dt !== void 0 ? Dt : !1, + code: U.code ? { ...U.code, optimize: cr, regExp: Ae } : { optimize: cr, regExp: Ae }, + loopRequired: (Vt = U.loopRequired) !== null && Vt !== void 0 ? Vt : T, + loopEnum: (Ie = U.loopEnum) !== null && Ie !== void 0 ? Ie : T, + meta: (Ut = U.meta) !== null && Ut !== void 0 ? Ut : !0, + messages: ($t = U.messages) !== null && $t !== void 0 ? $t : !0, + inlineRefs: (kt = U.inlineRefs) !== null && kt !== void 0 ? kt : !0, + schemaId: (Pt = U.schemaId) !== null && Pt !== void 0 ? Pt : "$id", + addUsedSchema: (Bt = U.addUsedSchema) !== null && Bt !== void 0 ? Bt : !0, + validateSchema: (Ke = U.validateSchema) !== null && Ke !== void 0 ? Ke : !0, + validateFormats: (Te = U.validateFormats) !== null && Te !== void 0 ? Te : !0, + unicodeRegExp: (Et = U.unicodeRegExp) !== null && Et !== void 0 ? Et : !0, + int32range: (Ft = U.int32range) !== null && Ft !== void 0 ? Ft : !0, + uriResolver: dt + }; + } + class r { + constructor(P = {}) { + this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), P = this.opts = { ...P, ...R(P) }; + const { es5: B, lines: N } = this.opts.code; + this.scope = new b.ValueScope({ scope: {}, prefixes: C, es5: B, lines: N }), this.logger = V(P.logger); + const d = P.validateFormats; + P.validateFormats = !1, this.RULES = (0, l.getRules)(), s.call(this, x, P, "NOT SUPPORTED"), s.call(this, $, P, "DEPRECATED", "warn"), this._metaOpts = p.call(this), P.formats && u.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), P.keywords && m.call(this, P.keywords), typeof P.meta == "object" && this.addMetaSchema(P.meta), c.call(this), P.validateFormats = d; + } + _addVocabularies() { + this.addKeyword("$async"); + } + _addDefaultMetaSchema() { + const { $data: P, meta: B, schemaId: N } = this.opts; + let d = S; + N === "id" && (d = { ...S }, d.id = d.$id, delete d.$id), B && P && this.addMetaSchema(d, d[N], !1); + } + defaultMeta() { + const { meta: P, schemaId: B } = this.opts; + return this.opts.defaultMeta = typeof P == "object" ? P[B] || P : void 0; + } + validate(P, B) { + let N; + if (typeof P == "string") { + if (N = this.getSchema(P), !N) + throw new Error(`no schema with key or ref "${P}"`); + } else + N = this.compile(P); + const d = N(B); + return "$async" in N || (this.errors = N.errors), d; + } + compile(P, B) { + const N = this._addSchema(P, B); + return N.validate || this._compileSchemaEnv(N); + } + compileAsync(P, B) { + if (typeof this.opts.loadSchema != "function") + throw new Error("options.loadSchema should be a function"); + const { loadSchema: N } = this.opts; + return d.call(this, P, B); + async function d(ne, fe) { + await v.call(this, ne.$schema); + const xe = this._addSchema(ne, fe); + return xe.validate || I.call(this, xe); + } + async function v(ne) { + ne && !this.getSchema(ne) && await d.call(this, { $ref: ne }, !0); + } + async function I(ne) { + try { + return this._compileSchemaEnv(ne); + } catch (fe) { + if (!(fe instanceof i.default)) + throw fe; + return G.call(this, fe), await K.call(this, fe.missingSchema), I.call(this, ne); + } + } + function G({ missingSchema: ne, missingRef: fe }) { + if (this.refs[ne]) + throw new Error(`AnySchema ${ne} is loaded but ${fe} cannot be resolved`); + } + async function K(ne) { + const fe = await re.call(this, ne); + this.refs[ne] || await v.call(this, fe.$schema), this.refs[ne] || this.addSchema(fe, ne, B); + } + async function re(ne) { + const fe = this._loading[ne]; + if (fe) + return fe; + try { + return await (this._loading[ne] = N(ne)); + } finally { + delete this._loading[ne]; + } + } + } + // Adds schema to the instance + addSchema(P, B, N, d = this.opts.validateSchema) { + if (Array.isArray(P)) { + for (const I of P) + this.addSchema(I, void 0, N, d); + return this; + } + let v; + if (typeof P == "object") { + const { schemaId: I } = this.opts; + if (v = P[I], v !== void 0 && typeof v != "string") + throw new Error(`schema ${I} must be string`); + } + return B = (0, k.normalizeId)(B || v), this._checkUnique(B), this.schemas[B] = this._addSchema(P, N, B, d, !0), this; + } + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema(P, B, N = this.opts.validateSchema) { + return this.addSchema(P, B, !0, N), this; + } + // Validate schema against its meta-schema + validateSchema(P, B) { + if (typeof P == "boolean") + return !0; + let N; + if (N = P.$schema, N !== void 0 && typeof N != "string") + throw new Error("$schema must be a string"); + if (N = N || this.opts.defaultMeta || this.defaultMeta(), !N) + return this.logger.warn("meta-schema not available"), this.errors = null, !0; + const d = this.validate(N, P); + if (!d && B) { + const v = "schema is invalid: " + this.errorsText(); + if (this.opts.validateSchema === "log") + this.logger.error(v); + else + throw new Error(v); + } + return d; + } + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(P) { + let B; + for (; typeof (B = o.call(this, P)) == "string"; ) + P = B; + if (B === void 0) { + const { schemaId: N } = this.opts, d = new f.SchemaEnv({ schema: {}, schemaId: N }); + if (B = f.resolveSchema.call(this, d, P), !B) + return; + this.refs[P] = B; + } + return B.validate || this._compileSchemaEnv(B); + } + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(P) { + if (P instanceof RegExp) + return this._removeAllSchemas(this.schemas, P), this._removeAllSchemas(this.refs, P), this; + switch (typeof P) { + case "undefined": + return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this; + case "string": { + const B = o.call(this, P); + return typeof B == "object" && this._cache.delete(B.schema), delete this.schemas[P], delete this.refs[P], this; + } + case "object": { + const B = P; + this._cache.delete(B); + let N = P[this.opts.schemaId]; + return N && (N = (0, k.normalizeId)(N), delete this.schemas[N], delete this.refs[N]), this; + } + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } + // add "vocabulary" - a collection of keywords + addVocabulary(P) { + for (const B of P) + this.addKeyword(B); + return this; + } + addKeyword(P, B) { + let N; + if (typeof P == "string") + N = P, typeof B == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), B.keyword = N); + else if (typeof P == "object" && B === void 0) { + if (B = P, N = B.keyword, Array.isArray(N) && !N.length) + throw new Error("addKeywords: keyword must be string or non-empty array"); + } else + throw new Error("invalid addKeywords parameters"); + if (D.call(this, N, B), !B) + return (0, y.eachItem)(N, (v) => q.call(this, v)), this; + H.call(this, B); + const d = { + ...B, + type: (0, _.getJSONTypes)(B.type), + schemaType: (0, _.getJSONTypes)(B.schemaType) + }; + return (0, y.eachItem)(N, d.type.length === 0 ? (v) => q.call(this, v, d) : (v) => d.type.forEach((I) => q.call(this, v, d, I))), this; + } + getKeyword(P) { + const B = this.RULES.all[P]; + return typeof B == "object" ? B.definition : !!B; + } + // Remove keyword + removeKeyword(P) { + const { RULES: B } = this; + delete B.keywords[P], delete B.all[P]; + for (const N of B.rules) { + const d = N.rules.findIndex((v) => v.keyword === P); + d >= 0 && N.rules.splice(d, 1); + } + return this; + } + // Add format + addFormat(P, B) { + return typeof B == "string" && (B = new RegExp(B)), this.formats[P] = B, this; + } + errorsText(P = this.errors, { separator: B = ", ", dataVar: N = "data" } = {}) { + return !P || P.length === 0 ? "No errors" : P.map((d) => `${N}${d.instancePath} ${d.message}`).reduce((d, v) => d + B + v); + } + $dataMetaSchema(P, B) { + const N = this.RULES.all; + P = JSON.parse(JSON.stringify(P)); + for (const d of B) { + const v = d.split("/").slice(1); + let I = P; + for (const G of v) + I = I[G]; + for (const G in N) { + const K = N[G]; + if (typeof K != "object") + continue; + const { $data: re } = K.definition, ne = I[G]; + re && ne && (I[G] = J(ne)); + } + } + return P; + } + _removeAllSchemas(P, B) { + for (const N in P) { + const d = P[N]; + (!B || B.test(N)) && (typeof d == "string" ? delete P[N] : d && !d.meta && (this._cache.delete(d.schema), delete P[N])); + } + } + _addSchema(P, B, N, d = this.opts.validateSchema, v = this.opts.addUsedSchema) { + let I; + const { schemaId: G } = this.opts; + if (typeof P == "object") + I = P[G]; + else { + if (this.opts.jtd) + throw new Error("schema must be object"); + if (typeof P != "boolean") + throw new Error("schema must be object or boolean"); + } + let K = this._cache.get(P); + if (K !== void 0) + return K; + N = (0, k.normalizeId)(I || N); + const re = k.getSchemaRefs.call(this, P, N); + return K = new f.SchemaEnv({ schema: P, schemaId: G, meta: B, baseId: N, localRefs: re }), this._cache.set(K.schema, K), v && !N.startsWith("#") && (N && this._checkUnique(N), this.refs[N] = K), d && this.validateSchema(P, !0), K; + } + _checkUnique(P) { + if (this.schemas[P] || this.refs[P]) + throw new Error(`schema with key or id "${P}" already exists`); + } + _compileSchemaEnv(P) { + if (P.meta ? this._compileMetaSchema(P) : f.compileSchema.call(this, P), !P.validate) + throw new Error("ajv implementation error"); + return P.validate; + } + _compileMetaSchema(P) { + const B = this.opts; + this.opts = this._metaOpts; + try { + f.compileSchema.call(this, P); + } finally { + this.opts = B; + } + } + } + e.default = r, r.ValidationError = a.default, r.MissingRefError = i.default; + function s(U, P, B, N = "error") { + for (const d in U) { + const v = d; + v in P && this.logger[N](`${B}: option ${d}. ${U[v]}`); + } + } + function o(U) { + return U = (0, k.normalizeId)(U), this.schemas[U] || this.refs[U]; + } + function c() { + const U = this.opts.schemas; + if (U) + if (Array.isArray(U)) + this.addSchema(U); + else + for (const P in U) + this.addSchema(U[P], P); + } + function u() { + for (const U in this.opts.formats) { + const P = this.opts.formats[U]; + P && this.addFormat(U, P); + } + } + function m(U) { + if (Array.isArray(U)) { + this.addVocabulary(U); + return; + } + this.logger.warn("keywords option as map is deprecated, pass array"); + for (const P in U) { + const B = U[P]; + B.keyword || (B.keyword = P), this.addKeyword(B); + } + } + function p() { + const U = { ...this.opts }; + for (const P of O) + delete U[P]; + return U; + } + const j = { log() { + }, warn() { + }, error() { + } }; + function V(U) { + if (U === !1) + return j; + if (U === void 0) + return console; + if (U.log && U.warn && U.error) + return U; + throw new Error("logger must implement log, warn and error methods"); + } + const F = /^[a-z_$][a-z0-9_$:-]*$/i; + function D(U, P) { + const { RULES: B } = this; + if ((0, y.eachItem)(U, (N) => { + if (B.keywords[N]) + throw new Error(`Keyword ${N} is already defined`); + if (!F.test(N)) + throw new Error(`Keyword ${N} has invalid name`); + }), !!P && P.$data && !("code" in P || "validate" in P)) + throw new Error('$data keyword must have "code" or "validate" function'); + } + function q(U, P, B) { + var N; + const d = P == null ? void 0 : P.post; + if (B && d) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES: v } = this; + let I = d ? v.post : v.rules.find(({ type: K }) => K === B); + if (I || (I = { type: B, rules: [] }, v.rules.push(I)), v.keywords[U] = !0, !P) + return; + const G = { + keyword: U, + definition: { + ...P, + type: (0, _.getJSONTypes)(P.type), + schemaType: (0, _.getJSONTypes)(P.schemaType) + } + }; + P.before ? g.call(this, I, G, P.before) : I.rules.push(G), v.all[U] = G, (N = P.implements) === null || N === void 0 || N.forEach((K) => this.addKeyword(K)); + } + function g(U, P, B) { + const N = U.rules.findIndex((d) => d.keyword === B); + N >= 0 ? U.rules.splice(N, 0, P) : (U.rules.push(P), this.logger.warn(`rule ${B} is not defined`)); + } + function H(U) { + let { metaSchema: P } = U; + P !== void 0 && (U.$data && this.opts.$data && (P = J(P)), U.validateSchema = this.compile(P, !0)); + } + const W = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" + }; + function J(U) { + return { anyOf: [U, W] }; + } +})(Tn); +var ra = {}, aa = {}, na = {}; +Object.defineProperty(na, "__esModule", { value: !0 }); +const bi = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + } +}; +na.default = bi; +var vt = {}; +Object.defineProperty(vt, "__esModule", { value: !0 }); +vt.callRef = vt.getValidate = void 0; +const wi = sr, tn = oe, Ne = se, Tt = Qe, rn = Oe, pr = ce, vi = { + keyword: "$ref", + schemaType: "string", + code(e) { + const { gen: t, schema: n, it: a } = e, { baseId: i, schemaEnv: l, validateName: f, opts: b, self: k } = a, { root: _ } = l; + if ((n === "#" || n === "#/") && i === _.baseId) + return S(); + const y = rn.resolveRef.call(k, _, i, n); + if (y === void 0) + throw new wi.default(a.opts.uriResolver, i, n); + if (y instanceof rn.SchemaEnv) + return A(y); + return M(y); + function S() { + if (l === _) + return wr(e, f, l, l.$async); + const O = t.scopeValue("root", { ref: _ }); + return wr(e, (0, Ne._)`${O}.validate`, _, _.$async); + } + function A(O) { + const C = to(e, O); + wr(e, C, O, O.$async); + } + function M(O) { + const C = t.scopeValue("schema", b.code.source === !0 ? { ref: O, code: (0, Ne.stringify)(O) } : { ref: O }), x = t.name("valid"), $ = e.subschema({ + schema: O, + dataTypes: [], + schemaPath: Ne.nil, + topSchemaRef: C, + errSchemaPath: n + }, x); + e.mergeEvaluated($), e.ok(x); + } + } +}; +function to(e, t) { + const { gen: n } = e; + return t.validate ? n.scopeValue("validate", { ref: t.validate }) : (0, Ne._)`${n.scopeValue("wrapper", { ref: t })}.validate`; +} +vt.getValidate = to; +function wr(e, t, n, a) { + const { gen: i, it: l } = e, { allErrors: f, schemaEnv: b, opts: k } = l, _ = k.passContext ? Tt.default.this : Ne.nil; + a ? y() : S(); + function y() { + if (!b.$async) + throw new Error("async schema referenced by sync schema"); + const O = i.let("valid"); + i.try(() => { + i.code((0, Ne._)`await ${(0, tn.callValidateCode)(e, t, _)}`), M(t), f || i.assign(O, !0); + }, (C) => { + i.if((0, Ne._)`!(${C} instanceof ${l.ValidationError})`, () => i.throw(C)), A(C), f || i.assign(O, !1); + }), e.ok(O); + } + function S() { + e.result((0, tn.callValidateCode)(e, t, _), () => M(t), () => A(t)); + } + function A(O) { + const C = (0, Ne._)`${O}.errors`; + i.assign(Tt.default.vErrors, (0, Ne._)`${Tt.default.vErrors} === null ? ${C} : ${Tt.default.vErrors}.concat(${C})`), i.assign(Tt.default.errors, (0, Ne._)`${Tt.default.vErrors}.length`); + } + function M(O) { + var C; + if (!l.opts.unevaluated) + return; + const x = (C = n == null ? void 0 : n.validate) === null || C === void 0 ? void 0 : C.evaluated; + if (l.props !== !0) + if (x && !x.dynamicProps) + x.props !== void 0 && (l.props = pr.mergeEvaluated.props(i, x.props, l.props)); + else { + const $ = i.var("props", (0, Ne._)`${O}.evaluated.props`); + l.props = pr.mergeEvaluated.props(i, $, l.props, Ne.Name); + } + if (l.items !== !0) + if (x && !x.dynamicItems) + x.items !== void 0 && (l.items = pr.mergeEvaluated.items(i, x.items, l.items)); + else { + const $ = i.var("items", (0, Ne._)`${O}.evaluated.items`); + l.items = pr.mergeEvaluated.items(i, $, l.items, Ne.Name); + } + } +} +vt.callRef = wr; +vt.default = vi; +Object.defineProperty(aa, "__esModule", { value: !0 }); +const $i = na, ki = vt, Pi = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + { keyword: "$comment" }, + "definitions", + $i.default, + ki.default +]; +aa.default = Pi; +var oa = {}, sa = {}; +Object.defineProperty(sa, "__esModule", { value: !0 }); +const Pr = se, ot = Pr.operators, Er = { + maximum: { okStr: "<=", ok: ot.LTE, fail: ot.GT }, + minimum: { okStr: ">=", ok: ot.GTE, fail: ot.LT }, + exclusiveMaximum: { okStr: "<", ok: ot.LT, fail: ot.GTE }, + exclusiveMinimum: { okStr: ">", ok: ot.GT, fail: ot.LTE } +}, Ei = { + message: ({ keyword: e, schemaCode: t }) => (0, Pr.str)`must be ${Er[e].okStr} ${t}`, + params: ({ keyword: e, schemaCode: t }) => (0, Pr._)`{comparison: ${Er[e].okStr}, limit: ${t}}` +}, Si = { + keyword: Object.keys(Er), + type: "number", + schemaType: "number", + $data: !0, + error: Ei, + code(e) { + const { keyword: t, data: n, schemaCode: a } = e; + e.fail$data((0, Pr._)`${n} ${Er[t].fail} ${a} || isNaN(${n})`); + } +}; +sa.default = Si; +var ia = {}; +Object.defineProperty(ia, "__esModule", { value: !0 }); +const Zt = se, ji = { + message: ({ schemaCode: e }) => (0, Zt.str)`must be multiple of ${e}`, + params: ({ schemaCode: e }) => (0, Zt._)`{multipleOf: ${e}}` +}, xi = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: !0, + error: ji, + code(e) { + const { gen: t, data: n, schemaCode: a, it: i } = e, l = i.opts.multipleOfPrecision, f = t.let("res"), b = l ? (0, Zt._)`Math.abs(Math.round(${f}) - ${f}) > 1e-${l}` : (0, Zt._)`${f} !== parseInt(${f})`; + e.fail$data((0, Zt._)`(${a} === 0 || (${f} = ${n}/${a}, ${b}))`); + } +}; +ia.default = xi; +var ca = {}, la = {}; +Object.defineProperty(la, "__esModule", { value: !0 }); +function ro(e) { + const t = e.length; + let n = 0, a = 0, i; + for (; a < t; ) + n++, i = e.charCodeAt(a++), i >= 55296 && i <= 56319 && a < t && (i = e.charCodeAt(a), (i & 64512) === 56320 && a++); + return n; +} +la.default = ro; +ro.code = 'require("ajv/dist/runtime/ucs2length").default'; +Object.defineProperty(ca, "__esModule", { value: !0 }); +const _t = se, Ti = ce, Ci = la, Ni = { + message({ keyword: e, schemaCode: t }) { + const n = e === "maxLength" ? "more" : "fewer"; + return (0, _t.str)`must NOT have ${n} than ${t} characters`; + }, + params: ({ schemaCode: e }) => (0, _t._)`{limit: ${e}}` +}, Oi = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: !0, + error: Ni, + code(e) { + const { keyword: t, data: n, schemaCode: a, it: i } = e, l = t === "maxLength" ? _t.operators.GT : _t.operators.LT, f = i.opts.unicode === !1 ? (0, _t._)`${n}.length` : (0, _t._)`${(0, Ti.useFunc)(e.gen, Ci.default)}(${n})`; + e.fail$data((0, _t._)`${f} ${l} ${a}`); + } +}; +ca.default = Oi; +var ua = {}; +Object.defineProperty(ua, "__esModule", { value: !0 }); +const Ii = oe, Sr = se, Ai = { + message: ({ schemaCode: e }) => (0, Sr.str)`must match pattern "${e}"`, + params: ({ schemaCode: e }) => (0, Sr._)`{pattern: ${e}}` +}, Ri = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: !0, + error: Ai, + code(e) { + const { data: t, $data: n, schema: a, schemaCode: i, it: l } = e, f = l.opts.unicodeRegExp ? "u" : "", b = n ? (0, Sr._)`(new RegExp(${i}, ${f}))` : (0, Ii.usePattern)(e, a); + e.fail$data((0, Sr._)`!${b}.test(${t})`); + } +}; +ua.default = Ri; +var da = {}; +Object.defineProperty(da, "__esModule", { value: !0 }); +const Qt = se, Li = { + message({ keyword: e, schemaCode: t }) { + const n = e === "maxProperties" ? "more" : "fewer"; + return (0, Qt.str)`must NOT have ${n} than ${t} properties`; + }, + params: ({ schemaCode: e }) => (0, Qt._)`{limit: ${e}}` +}, Mi = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: !0, + error: Li, + code(e) { + const { keyword: t, data: n, schemaCode: a } = e, i = t === "maxProperties" ? Qt.operators.GT : Qt.operators.LT; + e.fail$data((0, Qt._)`Object.keys(${n}).length ${i} ${a}`); + } +}; +da.default = Mi; +var ha = {}; +Object.defineProperty(ha, "__esModule", { value: !0 }); +const Wt = oe, Xt = se, zi = ce, Di = { + message: ({ params: { missingProperty: e } }) => (0, Xt.str)`must have required property '${e}'`, + params: ({ params: { missingProperty: e } }) => (0, Xt._)`{missingProperty: ${e}}` +}, Vi = { + keyword: "required", + type: "object", + schemaType: "array", + $data: !0, + error: Di, + code(e) { + const { gen: t, schema: n, schemaCode: a, data: i, $data: l, it: f } = e, { opts: b } = f; + if (!l && n.length === 0) + return; + const k = n.length >= b.loopRequired; + if (f.allErrors ? _() : y(), b.strictRequired) { + const M = e.parentSchema.properties, { definedProperties: O } = e.it; + for (const C of n) + if ((M == null ? void 0 : M[C]) === void 0 && !O.has(C)) { + const x = f.schemaEnv.baseId + f.errSchemaPath, $ = `required property "${C}" is not defined at "${x}" (strictRequired)`; + (0, zi.checkStrictMode)(f, $, f.opts.strictRequired); + } + } + function _() { + if (k || l) + e.block$data(Xt.nil, S); + else + for (const M of n) + (0, Wt.checkReportMissingProp)(e, M); + } + function y() { + const M = t.let("missing"); + if (k || l) { + const O = t.let("valid", !0); + e.block$data(O, () => A(M, O)), e.ok(O); + } else + t.if((0, Wt.checkMissingProp)(e, n, M)), (0, Wt.reportMissingProp)(e, M), t.else(); + } + function S() { + t.forOf("prop", a, (M) => { + e.setParams({ missingProperty: M }), t.if((0, Wt.noPropertyInData)(t, i, M, b.ownProperties), () => e.error()); + }); + } + function A(M, O) { + e.setParams({ missingProperty: M }), t.forOf(M, a, () => { + t.assign(O, (0, Wt.propertyInData)(t, i, M, b.ownProperties)), t.if((0, Xt.not)(O), () => { + e.error(), t.break(); + }); + }, Xt.nil); + } + } +}; +ha.default = Vi; +var pa = {}; +Object.defineProperty(pa, "__esModule", { value: !0 }); +const er = se, Ui = { + message({ keyword: e, schemaCode: t }) { + const n = e === "maxItems" ? "more" : "fewer"; + return (0, er.str)`must NOT have ${n} than ${t} items`; + }, + params: ({ schemaCode: e }) => (0, er._)`{limit: ${e}}` +}, Bi = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: !0, + error: Ui, + code(e) { + const { keyword: t, data: n, schemaCode: a } = e, i = t === "maxItems" ? er.operators.GT : er.operators.LT; + e.fail$data((0, er._)`${n}.length ${i} ${a}`); + } +}; +pa.default = Bi; +var fa = {}, ir = {}; +Object.defineProperty(ir, "__esModule", { value: !0 }); +const ao = Mn; +ao.code = 'require("ajv/dist/runtime/equal").default'; +ir.default = ao; +Object.defineProperty(fa, "__esModule", { value: !0 }); +const zr = nr, ke = se, Fi = ce, Hi = ir, qi = { + message: ({ params: { i: e, j: t } }) => (0, ke.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`, + params: ({ params: { i: e, j: t } }) => (0, ke._)`{i: ${e}, j: ${t}}` +}, Gi = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: !0, + error: qi, + code(e) { + const { gen: t, data: n, $data: a, schema: i, parentSchema: l, schemaCode: f, it: b } = e; + if (!a && !i) + return; + const k = t.let("valid"), _ = l.items ? (0, zr.getSchemaTypes)(l.items) : []; + e.block$data(k, y, (0, ke._)`${f} === false`), e.ok(k); + function y() { + const O = t.let("i", (0, ke._)`${n}.length`), C = t.let("j"); + e.setParams({ i: O, j: C }), t.assign(k, !0), t.if((0, ke._)`${O} > 1`, () => (S() ? A : M)(O, C)); + } + function S() { + return _.length > 0 && !_.some((O) => O === "object" || O === "array"); + } + function A(O, C) { + const x = t.name("item"), $ = (0, zr.checkDataTypes)(_, x, b.opts.strictNumbers, zr.DataType.Wrong), T = t.const("indices", (0, ke._)`{}`); + t.for((0, ke._)`;${O}--;`, () => { + t.let(x, (0, ke._)`${n}[${O}]`), t.if($, (0, ke._)`continue`), _.length > 1 && t.if((0, ke._)`typeof ${x} == "string"`, (0, ke._)`${x} += "_"`), t.if((0, ke._)`typeof ${T}[${x}] == "number"`, () => { + t.assign(C, (0, ke._)`${T}[${x}]`), e.error(), t.assign(k, !1).break(); + }).code((0, ke._)`${T}[${x}] = ${O}`); + }); + } + function M(O, C) { + const x = (0, Fi.useFunc)(t, Hi.default), $ = t.name("outer"); + t.label($).for((0, ke._)`;${O}--;`, () => t.for((0, ke._)`${C} = ${O}; ${C}--;`, () => t.if((0, ke._)`${x}(${n}[${O}], ${n}[${C}])`, () => { + e.error(), t.assign(k, !1).break($); + }))); + } + } +}; +fa.default = Gi; +var ma = {}; +Object.defineProperty(ma, "__esModule", { value: !0 }); +const qr = se, Ki = ce, Wi = ir, Yi = { + message: "must be equal to constant", + params: ({ schemaCode: e }) => (0, qr._)`{allowedValue: ${e}}` +}, Ji = { + keyword: "const", + $data: !0, + error: Yi, + code(e) { + const { gen: t, data: n, $data: a, schemaCode: i, schema: l } = e; + a || l && typeof l == "object" ? e.fail$data((0, qr._)`!${(0, Ki.useFunc)(t, Wi.default)}(${n}, ${i})`) : e.fail((0, qr._)`${l} !== ${n}`); + } +}; +ma.default = Ji; +var ga = {}; +Object.defineProperty(ga, "__esModule", { value: !0 }); +const Yt = se, Zi = ce, Qi = ir, Xi = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode: e }) => (0, Yt._)`{allowedValues: ${e}}` +}, ec = { + keyword: "enum", + schemaType: "array", + $data: !0, + error: Xi, + code(e) { + const { gen: t, data: n, $data: a, schema: i, schemaCode: l, it: f } = e; + if (!a && i.length === 0) + throw new Error("enum must have non-empty array"); + const b = i.length >= f.opts.loopEnum; + let k; + const _ = () => k ?? (k = (0, Zi.useFunc)(t, Qi.default)); + let y; + if (b || a) + y = t.let("valid"), e.block$data(y, S); + else { + if (!Array.isArray(i)) + throw new Error("ajv implementation error"); + const M = t.const("vSchema", l); + y = (0, Yt.or)(...i.map((O, C) => A(M, C))); + } + e.pass(y); + function S() { + t.assign(y, !1), t.forOf("v", l, (M) => t.if((0, Yt._)`${_()}(${n}, ${M})`, () => t.assign(y, !0).break())); + } + function A(M, O) { + const C = i[O]; + return typeof C == "object" && C !== null ? (0, Yt._)`${_()}(${n}, ${M}[${O}])` : (0, Yt._)`${n} === ${C}`; + } + } +}; +ga.default = ec; +Object.defineProperty(oa, "__esModule", { value: !0 }); +const tc = sa, rc = ia, ac = ca, nc = ua, oc = da, sc = ha, ic = pa, cc = fa, lc = ma, uc = ga, dc = [ + // number + tc.default, + rc.default, + // string + ac.default, + nc.default, + // object + oc.default, + sc.default, + // array + ic.default, + cc.default, + // any + { keyword: "type", schemaType: ["string", "array"] }, + { keyword: "nullable", schemaType: "boolean" }, + lc.default, + uc.default +]; +oa.default = dc; +var ya = {}, Mt = {}; +Object.defineProperty(Mt, "__esModule", { value: !0 }); +Mt.validateAdditionalItems = void 0; +const bt = se, Gr = ce, hc = { + message: ({ params: { len: e } }) => (0, bt.str)`must NOT have more than ${e} items`, + params: ({ params: { len: e } }) => (0, bt._)`{limit: ${e}}` +}, pc = { + keyword: "additionalItems", + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error: hc, + code(e) { + const { parentSchema: t, it: n } = e, { items: a } = t; + if (!Array.isArray(a)) { + (0, Gr.checkStrictMode)(n, '"additionalItems" is ignored when "items" is not an array of schemas'); + return; + } + no(e, a); + } +}; +function no(e, t) { + const { gen: n, schema: a, data: i, keyword: l, it: f } = e; + f.items = !0; + const b = n.const("len", (0, bt._)`${i}.length`); + if (a === !1) + e.setParams({ len: t.length }), e.pass((0, bt._)`${b} <= ${t.length}`); + else if (typeof a == "object" && !(0, Gr.alwaysValidSchema)(f, a)) { + const _ = n.var("valid", (0, bt._)`${b} <= ${t.length}`); + n.if((0, bt.not)(_), () => k(_)), e.ok(_); + } + function k(_) { + n.forRange("i", t.length, b, (y) => { + e.subschema({ keyword: l, dataProp: y, dataPropType: Gr.Type.Num }, _), f.allErrors || n.if((0, bt.not)(_), () => n.break()); + }); + } +} +Mt.validateAdditionalItems = no; +Mt.default = pc; +var _a = {}, zt = {}; +Object.defineProperty(zt, "__esModule", { value: !0 }); +zt.validateTuple = void 0; +const an = se, vr = ce, fc = oe, mc = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(e) { + const { schema: t, it: n } = e; + if (Array.isArray(t)) + return oo(e, "additionalItems", t); + n.items = !0, !(0, vr.alwaysValidSchema)(n, t) && e.ok((0, fc.validateArray)(e)); + } +}; +function oo(e, t, n = e.schema) { + const { gen: a, parentSchema: i, data: l, keyword: f, it: b } = e; + y(i), b.opts.unevaluated && n.length && b.items !== !0 && (b.items = vr.mergeEvaluated.items(a, n.length, b.items)); + const k = a.name("valid"), _ = a.const("len", (0, an._)`${l}.length`); + n.forEach((S, A) => { + (0, vr.alwaysValidSchema)(b, S) || (a.if((0, an._)`${_} > ${A}`, () => e.subschema({ + keyword: f, + schemaProp: A, + dataProp: A + }, k)), e.ok(k)); + }); + function y(S) { + const { opts: A, errSchemaPath: M } = b, O = n.length, C = O === S.minItems && (O === S.maxItems || S[t] === !1); + if (A.strictTuples && !C) { + const x = `"${f}" is ${O}-tuple, but minItems or maxItems/${t} are not specified or different at path "${M}"`; + (0, vr.checkStrictMode)(b, x, A.strictTuples); + } + } +} +zt.validateTuple = oo; +zt.default = mc; +Object.defineProperty(_a, "__esModule", { value: !0 }); +const gc = zt, yc = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (e) => (0, gc.validateTuple)(e, "items") +}; +_a.default = yc; +var ba = {}; +Object.defineProperty(ba, "__esModule", { value: !0 }); +const nn = se, _c = ce, bc = oe, wc = Mt, vc = { + message: ({ params: { len: e } }) => (0, nn.str)`must NOT have more than ${e} items`, + params: ({ params: { len: e } }) => (0, nn._)`{limit: ${e}}` +}, $c = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error: vc, + code(e) { + const { schema: t, parentSchema: n, it: a } = e, { prefixItems: i } = n; + a.items = !0, !(0, _c.alwaysValidSchema)(a, t) && (i ? (0, wc.validateAdditionalItems)(e, i) : e.ok((0, bc.validateArray)(e))); + } +}; +ba.default = $c; +var wa = {}; +Object.defineProperty(wa, "__esModule", { value: !0 }); +const De = se, fr = ce, kc = { + message: ({ params: { min: e, max: t } }) => t === void 0 ? (0, De.str)`must contain at least ${e} valid item(s)` : (0, De.str)`must contain at least ${e} and no more than ${t} valid item(s)`, + params: ({ params: { min: e, max: t } }) => t === void 0 ? (0, De._)`{minContains: ${e}}` : (0, De._)`{minContains: ${e}, maxContains: ${t}}` +}, Pc = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: !0, + error: kc, + code(e) { + const { gen: t, schema: n, parentSchema: a, data: i, it: l } = e; + let f, b; + const { minContains: k, maxContains: _ } = a; + l.opts.next ? (f = k === void 0 ? 1 : k, b = _) : f = 1; + const y = t.const("len", (0, De._)`${i}.length`); + if (e.setParams({ min: f, max: b }), b === void 0 && f === 0) { + (0, fr.checkStrictMode)(l, '"minContains" == 0 without "maxContains": "contains" keyword ignored'); + return; + } + if (b !== void 0 && f > b) { + (0, fr.checkStrictMode)(l, '"minContains" > "maxContains" is always invalid'), e.fail(); + return; + } + if ((0, fr.alwaysValidSchema)(l, n)) { + let C = (0, De._)`${y} >= ${f}`; + b !== void 0 && (C = (0, De._)`${C} && ${y} <= ${b}`), e.pass(C); + return; + } + l.items = !0; + const S = t.name("valid"); + b === void 0 && f === 1 ? M(S, () => t.if(S, () => t.break())) : f === 0 ? (t.let(S, !0), b !== void 0 && t.if((0, De._)`${i}.length > 0`, A)) : (t.let(S, !1), A()), e.result(S, () => e.reset()); + function A() { + const C = t.name("_valid"), x = t.let("count", 0); + M(C, () => t.if(C, () => O(x))); + } + function M(C, x) { + t.forRange("i", 0, y, ($) => { + e.subschema({ + keyword: "contains", + dataProp: $, + dataPropType: fr.Type.Num, + compositeRule: !0 + }, C), x(); + }); + } + function O(C) { + t.code((0, De._)`${C}++`), b === void 0 ? t.if((0, De._)`${C} >= ${f}`, () => t.assign(S, !0).break()) : (t.if((0, De._)`${C} > ${b}`, () => t.assign(S, !1).break()), f === 1 ? t.assign(S, !0) : t.if((0, De._)`${C} >= ${f}`, () => t.assign(S, !0))); + } + } +}; +wa.default = Pc; +var so = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0; + const t = se, n = ce, a = oe; + e.error = { + message: ({ params: { property: k, depsCount: _, deps: y } }) => { + const S = _ === 1 ? "property" : "properties"; + return (0, t.str)`must have ${S} ${y} when property ${k} is present`; + }, + params: ({ params: { property: k, depsCount: _, deps: y, missingProperty: S } }) => (0, t._)`{property: ${k}, + missingProperty: ${S}, + depsCount: ${_}, + deps: ${y}}` + // TODO change to reference + }; + const i = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error: e.error, + code(k) { + const [_, y] = l(k); + f(k, _), b(k, y); + } + }; + function l({ schema: k }) { + const _ = {}, y = {}; + for (const S in k) { + if (S === "__proto__") + continue; + const A = Array.isArray(k[S]) ? _ : y; + A[S] = k[S]; + } + return [_, y]; + } + function f(k, _ = k.schema) { + const { gen: y, data: S, it: A } = k; + if (Object.keys(_).length === 0) + return; + const M = y.let("missing"); + for (const O in _) { + const C = _[O]; + if (C.length === 0) + continue; + const x = (0, a.propertyInData)(y, S, O, A.opts.ownProperties); + k.setParams({ + property: O, + depsCount: C.length, + deps: C.join(", ") + }), A.allErrors ? y.if(x, () => { + for (const $ of C) + (0, a.checkReportMissingProp)(k, $); + }) : (y.if((0, t._)`${x} && (${(0, a.checkMissingProp)(k, C, M)})`), (0, a.reportMissingProp)(k, M), y.else()); + } + } + e.validatePropertyDeps = f; + function b(k, _ = k.schema) { + const { gen: y, data: S, keyword: A, it: M } = k, O = y.name("valid"); + for (const C in _) + (0, n.alwaysValidSchema)(M, _[C]) || (y.if( + (0, a.propertyInData)(y, S, C, M.opts.ownProperties), + () => { + const x = k.subschema({ keyword: A, schemaProp: C }, O); + k.mergeValidEvaluated(x, O); + }, + () => y.var(O, !0) + // TODO var + ), k.ok(O)); + } + e.validateSchemaDeps = b, e.default = i; +})(so); +var va = {}; +Object.defineProperty(va, "__esModule", { value: !0 }); +const io = se, Ec = ce, Sc = { + message: "property name must be valid", + params: ({ params: e }) => (0, io._)`{propertyName: ${e.propertyName}}` +}, jc = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error: Sc, + code(e) { + const { gen: t, schema: n, data: a, it: i } = e; + if ((0, Ec.alwaysValidSchema)(i, n)) + return; + const l = t.name("valid"); + t.forIn("key", a, (f) => { + e.setParams({ propertyName: f }), e.subschema({ + keyword: "propertyNames", + data: f, + dataTypes: ["string"], + propertyName: f, + compositeRule: !0 + }, l), t.if((0, io.not)(l), () => { + e.error(!0), i.allErrors || t.break(); + }); + }), e.ok(l); + } +}; +va.default = jc; +var Ir = {}; +Object.defineProperty(Ir, "__esModule", { value: !0 }); +const mr = oe, Fe = se, xc = Qe, gr = ce, Tc = { + message: "must NOT have additional properties", + params: ({ params: e }) => (0, Fe._)`{additionalProperty: ${e.additionalProperty}}` +}, Cc = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: !0, + trackErrors: !0, + error: Tc, + code(e) { + const { gen: t, schema: n, parentSchema: a, data: i, errsCount: l, it: f } = e; + if (!l) + throw new Error("ajv implementation error"); + const { allErrors: b, opts: k } = f; + if (f.props = !0, k.removeAdditional !== "all" && (0, gr.alwaysValidSchema)(f, n)) + return; + const _ = (0, mr.allSchemaProperties)(a.properties), y = (0, mr.allSchemaProperties)(a.patternProperties); + S(), e.ok((0, Fe._)`${l} === ${xc.default.errors}`); + function S() { + t.forIn("key", i, (x) => { + !_.length && !y.length ? O(x) : t.if(A(x), () => O(x)); + }); + } + function A(x) { + let $; + if (_.length > 8) { + const T = (0, gr.schemaRefOrVal)(f, a.properties, "properties"); + $ = (0, mr.isOwnProperty)(t, T, x); + } else + _.length ? $ = (0, Fe.or)(..._.map((T) => (0, Fe._)`${x} === ${T}`)) : $ = Fe.nil; + return y.length && ($ = (0, Fe.or)($, ...y.map((T) => (0, Fe._)`${(0, mr.usePattern)(e, T)}.test(${x})`))), (0, Fe.not)($); + } + function M(x) { + t.code((0, Fe._)`delete ${i}[${x}]`); + } + function O(x) { + if (k.removeAdditional === "all" || k.removeAdditional && n === !1) { + M(x); + return; + } + if (n === !1) { + e.setParams({ additionalProperty: x }), e.error(), b || t.break(); + return; + } + if (typeof n == "object" && !(0, gr.alwaysValidSchema)(f, n)) { + const $ = t.name("valid"); + k.removeAdditional === "failing" ? (C(x, $, !1), t.if((0, Fe.not)($), () => { + e.reset(), M(x); + })) : (C(x, $), b || t.if((0, Fe.not)($), () => t.break())); + } + } + function C(x, $, T) { + const R = { + keyword: "additionalProperties", + dataProp: x, + dataPropType: gr.Type.Str + }; + T === !1 && Object.assign(R, { + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }), e.subschema(R, $); + } + } +}; +Ir.default = Cc; +var $a = {}; +Object.defineProperty($a, "__esModule", { value: !0 }); +const Nc = Ge, on = oe, Dr = ce, sn = Ir, Oc = { + keyword: "properties", + type: "object", + schemaType: "object", + code(e) { + const { gen: t, schema: n, parentSchema: a, data: i, it: l } = e; + l.opts.removeAdditional === "all" && a.additionalProperties === void 0 && sn.default.code(new Nc.KeywordCxt(l, sn.default, "additionalProperties")); + const f = (0, on.allSchemaProperties)(n); + for (const S of f) + l.definedProperties.add(S); + l.opts.unevaluated && f.length && l.props !== !0 && (l.props = Dr.mergeEvaluated.props(t, (0, Dr.toHash)(f), l.props)); + const b = f.filter((S) => !(0, Dr.alwaysValidSchema)(l, n[S])); + if (b.length === 0) + return; + const k = t.name("valid"); + for (const S of b) + _(S) ? y(S) : (t.if((0, on.propertyInData)(t, i, S, l.opts.ownProperties)), y(S), l.allErrors || t.else().var(k, !0), t.endIf()), e.it.definedProperties.add(S), e.ok(k); + function _(S) { + return l.opts.useDefaults && !l.compositeRule && n[S].default !== void 0; + } + function y(S) { + e.subschema({ + keyword: "properties", + schemaProp: S, + dataProp: S + }, k); + } + } +}; +$a.default = Oc; +var ka = {}; +Object.defineProperty(ka, "__esModule", { value: !0 }); +const cn = oe, yr = se, ln = ce, un = ce, Ic = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(e) { + const { gen: t, schema: n, data: a, parentSchema: i, it: l } = e, { opts: f } = l, b = (0, cn.allSchemaProperties)(n), k = b.filter((C) => (0, ln.alwaysValidSchema)(l, n[C])); + if (b.length === 0 || k.length === b.length && (!l.opts.unevaluated || l.props === !0)) + return; + const _ = f.strictSchema && !f.allowMatchingProperties && i.properties, y = t.name("valid"); + l.props !== !0 && !(l.props instanceof yr.Name) && (l.props = (0, un.evaluatedPropsToName)(t, l.props)); + const { props: S } = l; + A(); + function A() { + for (const C of b) + _ && M(C), l.allErrors ? O(C) : (t.var(y, !0), O(C), t.if(y)); + } + function M(C) { + for (const x in _) + new RegExp(C).test(x) && (0, ln.checkStrictMode)(l, `property ${x} matches pattern ${C} (use allowMatchingProperties)`); + } + function O(C) { + t.forIn("key", a, (x) => { + t.if((0, yr._)`${(0, cn.usePattern)(e, C)}.test(${x})`, () => { + const $ = k.includes(C); + $ || e.subschema({ + keyword: "patternProperties", + schemaProp: C, + dataProp: x, + dataPropType: un.Type.Str + }, y), l.opts.unevaluated && S !== !0 ? t.assign((0, yr._)`${S}[${x}]`, !0) : !$ && !l.allErrors && t.if((0, yr.not)(y), () => t.break()); + }); + }); + } + } +}; +ka.default = Ic; +var Pa = {}; +Object.defineProperty(Pa, "__esModule", { value: !0 }); +const Ac = ce, Rc = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: !0, + code(e) { + const { gen: t, schema: n, it: a } = e; + if ((0, Ac.alwaysValidSchema)(a, n)) { + e.fail(); + return; + } + const i = t.name("valid"); + e.subschema({ + keyword: "not", + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }, i), e.failResult(i, () => e.reset(), () => e.error()); + }, + error: { message: "must NOT be valid" } +}; +Pa.default = Rc; +var Ea = {}; +Object.defineProperty(Ea, "__esModule", { value: !0 }); +const Lc = oe, Mc = { + keyword: "anyOf", + schemaType: "array", + trackErrors: !0, + code: Lc.validateUnion, + error: { message: "must match a schema in anyOf" } +}; +Ea.default = Mc; +var Sa = {}; +Object.defineProperty(Sa, "__esModule", { value: !0 }); +const $r = se, zc = ce, Dc = { + message: "must match exactly one schema in oneOf", + params: ({ params: e }) => (0, $r._)`{passingSchemas: ${e.passing}}` +}, Vc = { + keyword: "oneOf", + schemaType: "array", + trackErrors: !0, + error: Dc, + code(e) { + const { gen: t, schema: n, parentSchema: a, it: i } = e; + if (!Array.isArray(n)) + throw new Error("ajv implementation error"); + if (i.opts.discriminator && a.discriminator) + return; + const l = n, f = t.let("valid", !1), b = t.let("passing", null), k = t.name("_valid"); + e.setParams({ passing: b }), t.block(_), e.result(f, () => e.reset(), () => e.error(!0)); + function _() { + l.forEach((y, S) => { + let A; + (0, zc.alwaysValidSchema)(i, y) ? t.var(k, !0) : A = e.subschema({ + keyword: "oneOf", + schemaProp: S, + compositeRule: !0 + }, k), S > 0 && t.if((0, $r._)`${k} && ${f}`).assign(f, !1).assign(b, (0, $r._)`[${b}, ${S}]`).else(), t.if(k, () => { + t.assign(f, !0), t.assign(b, S), A && e.mergeEvaluated(A, $r.Name); + }); + }); + } + } +}; +Sa.default = Vc; +var ja = {}; +Object.defineProperty(ja, "__esModule", { value: !0 }); +const Uc = ce, Bc = { + keyword: "allOf", + schemaType: "array", + code(e) { + const { gen: t, schema: n, it: a } = e; + if (!Array.isArray(n)) + throw new Error("ajv implementation error"); + const i = t.name("valid"); + n.forEach((l, f) => { + if ((0, Uc.alwaysValidSchema)(a, l)) + return; + const b = e.subschema({ keyword: "allOf", schemaProp: f }, i); + e.ok(i), e.mergeEvaluated(b); + }); + } +}; +ja.default = Bc; +var xa = {}; +Object.defineProperty(xa, "__esModule", { value: !0 }); +const jr = se, co = ce, Fc = { + message: ({ params: e }) => (0, jr.str)`must match "${e.ifClause}" schema`, + params: ({ params: e }) => (0, jr._)`{failingKeyword: ${e.ifClause}}` +}, Hc = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: !0, + error: Fc, + code(e) { + const { gen: t, parentSchema: n, it: a } = e; + n.then === void 0 && n.else === void 0 && (0, co.checkStrictMode)(a, '"if" without "then" and "else" is ignored'); + const i = dn(a, "then"), l = dn(a, "else"); + if (!i && !l) + return; + const f = t.let("valid", !0), b = t.name("_valid"); + if (k(), e.reset(), i && l) { + const y = t.let("ifClause"); + e.setParams({ ifClause: y }), t.if(b, _("then", y), _("else", y)); + } else + i ? t.if(b, _("then")) : t.if((0, jr.not)(b), _("else")); + e.pass(f, () => e.error(!0)); + function k() { + const y = e.subschema({ + keyword: "if", + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }, b); + e.mergeEvaluated(y); + } + function _(y, S) { + return () => { + const A = e.subschema({ keyword: y }, b); + t.assign(f, b), e.mergeValidEvaluated(A, f), S ? t.assign(S, (0, jr._)`${y}`) : e.setParams({ ifClause: y }); + }; + } + } +}; +function dn(e, t) { + const n = e.schema[t]; + return n !== void 0 && !(0, co.alwaysValidSchema)(e, n); +} +xa.default = Hc; +var Ta = {}; +Object.defineProperty(Ta, "__esModule", { value: !0 }); +const qc = ce, Gc = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({ keyword: e, parentSchema: t, it: n }) { + t.if === void 0 && (0, qc.checkStrictMode)(n, `"${e}" without "if" is ignored`); + } +}; +Ta.default = Gc; +Object.defineProperty(ya, "__esModule", { value: !0 }); +const Kc = Mt, Wc = _a, Yc = zt, Jc = ba, Zc = wa, Qc = so, Xc = va, el = Ir, tl = $a, rl = ka, al = Pa, nl = Ea, ol = Sa, sl = ja, il = xa, cl = Ta; +function ll(e = !1) { + const t = [ + // any + al.default, + nl.default, + ol.default, + sl.default, + il.default, + cl.default, + // object + Xc.default, + el.default, + Qc.default, + tl.default, + rl.default + ]; + return e ? t.push(Wc.default, Jc.default) : t.push(Kc.default, Yc.default), t.push(Zc.default), t; +} +ya.default = ll; +var Ca = {}, Na = {}; +Object.defineProperty(Na, "__esModule", { value: !0 }); +const _e = se, ul = { + message: ({ schemaCode: e }) => (0, _e.str)`must match format "${e}"`, + params: ({ schemaCode: e }) => (0, _e._)`{format: ${e}}` +}, dl = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: !0, + error: ul, + code(e, t) { + const { gen: n, data: a, $data: i, schema: l, schemaCode: f, it: b } = e, { opts: k, errSchemaPath: _, schemaEnv: y, self: S } = b; + if (!k.validateFormats) + return; + i ? A() : M(); + function A() { + const O = n.scopeValue("formats", { + ref: S.formats, + code: k.code.formats + }), C = n.const("fDef", (0, _e._)`${O}[${f}]`), x = n.let("fType"), $ = n.let("format"); + n.if((0, _e._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`, () => n.assign(x, (0, _e._)`${C}.type || "string"`).assign($, (0, _e._)`${C}.validate`), () => n.assign(x, (0, _e._)`"string"`).assign($, C)), e.fail$data((0, _e.or)(T(), R())); + function T() { + return k.strictSchema === !1 ? _e.nil : (0, _e._)`${f} && !${$}`; + } + function R() { + const r = y.$async ? (0, _e._)`(${C}.async ? await ${$}(${a}) : ${$}(${a}))` : (0, _e._)`${$}(${a})`, s = (0, _e._)`(typeof ${$} == "function" ? ${r} : ${$}.test(${a}))`; + return (0, _e._)`${$} && ${$} !== true && ${x} === ${t} && !${s}`; + } + } + function M() { + const O = S.formats[l]; + if (!O) { + T(); + return; + } + if (O === !0) + return; + const [C, x, $] = R(O); + C === t && e.pass(r()); + function T() { + if (k.strictSchema === !1) { + S.logger.warn(s()); + return; + } + throw new Error(s()); + function s() { + return `unknown format "${l}" ignored in schema at path "${_}"`; + } + } + function R(s) { + const o = s instanceof RegExp ? (0, _e.regexpCode)(s) : k.code.formats ? (0, _e._)`${k.code.formats}${(0, _e.getProperty)(l)}` : void 0, c = n.scopeValue("formats", { key: l, ref: s, code: o }); + return typeof s == "object" && !(s instanceof RegExp) ? [s.type || "string", s.validate, (0, _e._)`${c}.validate`] : ["string", s, c]; + } + function r() { + if (typeof O == "object" && !(O instanceof RegExp) && O.async) { + if (!y.$async) + throw new Error("async format in sync schema"); + return (0, _e._)`await ${$}(${a})`; + } + return typeof x == "function" ? (0, _e._)`${$}(${a})` : (0, _e._)`${$}.test(${a})`; + } + } + } +}; +Na.default = dl; +Object.defineProperty(Ca, "__esModule", { value: !0 }); +const hl = Na, pl = [hl.default]; +Ca.default = pl; +var Lt = {}; +Object.defineProperty(Lt, "__esModule", { value: !0 }); +Lt.contentVocabulary = Lt.metadataVocabulary = void 0; +Lt.metadataVocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples" +]; +Lt.contentVocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema" +]; +Object.defineProperty(ra, "__esModule", { value: !0 }); +const fl = aa, ml = oa, gl = ya, yl = Ca, hn = Lt, _l = [ + fl.default, + ml.default, + (0, gl.default)(), + yl.default, + hn.metadataVocabulary, + hn.contentVocabulary +]; +ra.default = _l; +var Oa = {}, lo = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.DiscrError = void 0, function(t) { + t.Tag = "tag", t.Mapping = "mapping"; + }(e.DiscrError || (e.DiscrError = {})); +})(lo); +Object.defineProperty(Oa, "__esModule", { value: !0 }); +const Ct = se, Kr = lo, pn = Oe, bl = ce, wl = { + message: ({ params: { discrError: e, tagName: t } }) => e === Kr.DiscrError.Tag ? `tag "${t}" must be string` : `value of tag "${t}" must be in oneOf`, + params: ({ params: { discrError: e, tag: t, tagName: n } }) => (0, Ct._)`{error: ${e}, tag: ${n}, tagValue: ${t}}` +}, vl = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error: wl, + code(e) { + const { gen: t, data: n, schema: a, parentSchema: i, it: l } = e, { oneOf: f } = i; + if (!l.opts.discriminator) + throw new Error("discriminator: requires discriminator option"); + const b = a.propertyName; + if (typeof b != "string") + throw new Error("discriminator: requires propertyName"); + if (a.mapping) + throw new Error("discriminator: mapping is not supported"); + if (!f) + throw new Error("discriminator: requires oneOf keyword"); + const k = t.let("valid", !1), _ = t.const("tag", (0, Ct._)`${n}${(0, Ct.getProperty)(b)}`); + t.if((0, Ct._)`typeof ${_} == "string"`, () => y(), () => e.error(!1, { discrError: Kr.DiscrError.Tag, tag: _, tagName: b })), e.ok(k); + function y() { + const M = A(); + t.if(!1); + for (const O in M) + t.elseIf((0, Ct._)`${_} === ${O}`), t.assign(k, S(M[O])); + t.else(), e.error(!1, { discrError: Kr.DiscrError.Mapping, tag: _, tagName: b }), t.endIf(); + } + function S(M) { + const O = t.name("valid"), C = e.subschema({ keyword: "oneOf", schemaProp: M }, O); + return e.mergeEvaluated(C, Ct.Name), O; + } + function A() { + var M; + const O = {}, C = $(i); + let x = !0; + for (let r = 0; r < f.length; r++) { + let s = f[r]; + s != null && s.$ref && !(0, bl.schemaHasRulesButRef)(s, l.self.RULES) && (s = pn.resolveRef.call(l.self, l.schemaEnv.root, l.baseId, s == null ? void 0 : s.$ref), s instanceof pn.SchemaEnv && (s = s.schema)); + const o = (M = s == null ? void 0 : s.properties) === null || M === void 0 ? void 0 : M[b]; + if (typeof o != "object") + throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${b}"`); + x = x && (C || $(s)), T(o, r); + } + if (!x) + throw new Error(`discriminator: "${b}" must be required`); + return O; + function $({ required: r }) { + return Array.isArray(r) && r.includes(b); + } + function T(r, s) { + if (r.const) + R(r.const, s); + else if (r.enum) + for (const o of r.enum) + R(o, s); + else + throw new Error(`discriminator: "properties/${b}" must have "const" or "enum"`); + } + function R(r, s) { + if (typeof r != "string" || r in O) + throw new Error(`discriminator: "${b}" values must be unique strings`); + O[r] = s; + } + } + } +}; +Oa.default = vl; +const $l = "http://json-schema.org/draft-07/schema#", kl = "http://json-schema.org/draft-07/schema#", Pl = "Core schema meta-schema", El = { + schemaArray: { + type: "array", + minItems: 1, + items: { + $ref: "#" + } + }, + nonNegativeInteger: { + type: "integer", + minimum: 0 + }, + nonNegativeIntegerDefault0: { + allOf: [ + { + $ref: "#/definitions/nonNegativeInteger" + }, + { + default: 0 + } + ] + }, + simpleTypes: { + enum: [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + stringArray: { + type: "array", + items: { + type: "string" + }, + uniqueItems: !0, + default: [] + } +}, Sl = [ + "object", + "boolean" +], jl = { + $id: { + type: "string", + format: "uri-reference" + }, + $schema: { + type: "string", + format: "uri" + }, + $ref: { + type: "string", + format: "uri-reference" + }, + $comment: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: !0, + readOnly: { + type: "boolean", + default: !1 + }, + examples: { + type: "array", + items: !0 + }, + multipleOf: { + type: "number", + exclusiveMinimum: 0 + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "number" + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "number" + }, + maxLength: { + $ref: "#/definitions/nonNegativeInteger" + }, + minLength: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { + $ref: "#" + }, + items: { + anyOf: [ + { + $ref: "#" + }, + { + $ref: "#/definitions/schemaArray" + } + ], + default: !0 + }, + maxItems: { + $ref: "#/definitions/nonNegativeInteger" + }, + minItems: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + uniqueItems: { + type: "boolean", + default: !1 + }, + contains: { + $ref: "#" + }, + maxProperties: { + $ref: "#/definitions/nonNegativeInteger" + }, + minProperties: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + required: { + $ref: "#/definitions/stringArray" + }, + additionalProperties: { + $ref: "#" + }, + definitions: { + type: "object", + additionalProperties: { + $ref: "#" + }, + default: {} + }, + properties: { + type: "object", + additionalProperties: { + $ref: "#" + }, + default: {} + }, + patternProperties: { + type: "object", + additionalProperties: { + $ref: "#" + }, + propertyNames: { + format: "regex" + }, + default: {} + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [ + { + $ref: "#" + }, + { + $ref: "#/definitions/stringArray" + } + ] + } + }, + propertyNames: { + $ref: "#" + }, + const: !0, + enum: { + type: "array", + items: !0, + minItems: 1, + uniqueItems: !0 + }, + type: { + anyOf: [ + { + $ref: "#/definitions/simpleTypes" + }, + { + type: "array", + items: { + $ref: "#/definitions/simpleTypes" + }, + minItems: 1, + uniqueItems: !0 + } + ] + }, + format: { + type: "string" + }, + contentMediaType: { + type: "string" + }, + contentEncoding: { + type: "string" + }, + if: { + $ref: "#" + }, + then: { + $ref: "#" + }, + else: { + $ref: "#" + }, + allOf: { + $ref: "#/definitions/schemaArray" + }, + anyOf: { + $ref: "#/definitions/schemaArray" + }, + oneOf: { + $ref: "#/definitions/schemaArray" + }, + not: { + $ref: "#" + } +}, xl = { + $schema: $l, + $id: kl, + title: Pl, + definitions: El, + type: Sl, + properties: jl, + default: !0 +}; +(function(e, t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.MissingRefError = t.ValidationError = t.CodeGen = t.Name = t.nil = t.stringify = t.str = t._ = t.KeywordCxt = void 0; + const n = Tn, a = ra, i = Oa, l = xl, f = ["/properties"], b = "http://json-schema.org/draft-07/schema"; + class k extends n.default { + _addVocabularies() { + super._addVocabularies(), a.default.forEach((O) => this.addVocabulary(O)), this.opts.discriminator && this.addKeyword(i.default); + } + _addDefaultMetaSchema() { + if (super._addDefaultMetaSchema(), !this.opts.meta) + return; + const O = this.opts.$data ? this.$dataMetaSchema(l, f) : l; + this.addMetaSchema(O, b, !1), this.refs["http://json-schema.org/schema"] = b; + } + defaultMeta() { + return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(b) ? b : void 0); + } + } + e.exports = t = k, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = k; + var _ = Ge; + Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() { + return _.KeywordCxt; + } }); + var y = se; + Object.defineProperty(t, "_", { enumerable: !0, get: function() { + return y._; + } }), Object.defineProperty(t, "str", { enumerable: !0, get: function() { + return y.str; + } }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() { + return y.stringify; + } }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() { + return y.nil; + } }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() { + return y.Name; + } }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() { + return y.CodeGen; + } }); + var S = or; + Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() { + return S.default; + } }); + var A = sr; + Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() { + return A.default; + } }); +})(Ur, Ur.exports); +var Tl = Ur.exports; +const Cl = /* @__PURE__ */ xn(Tl); +class Nl { + constructor() { + $e(this, "ajv"), this.ajv = new Cl(); + } + validateJson(t, n) { + const a = this.ajv.validate(t, n); + return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() }; + } + validateObjectSchema(t, n) { + const a = this.ajv.validate(t, n); + return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() }; + } +} +class Ol { + constructor() { + $e(this, "TIME_SPLIT", " "); + } + /** + * 给日期添加小时 + * + * @param date - Date + * @param numOfHours - 数字 + * @author terwer + * @since 1.0.0 + */ + addHoursToDate(t, n) { + return t.setTime(t.getTime() + n * 60 * 60 * 1e3), t; + } + /** + * 转换ISO日期为中文日期的通用转换方法 + * + * @param str - '2022-07-18T06:25:48.000Z + * @param isAddTimeZone - 是否增加时区(默认不增加) + * @param isShort - 是否只返回日期 + * @author terwer + * @since 1.0.0 + */ + formatIsoToZhDateFormat(t, n, a) { + if (!t) + return ""; + let i = t; + const l = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, f = i.match(l); + if (f == null) + return t; + for (let b = 0; b < f.length; b++) { + const k = f[b]; + let _ = k; + n && (_ = this.addHoursToDate(new Date(k), 8).toISOString()); + const y = _.split("T"), S = y[0], A = y[1].split(".")[0]; + let M = S + this.TIME_SPLIT + A; + a && (M = S), i = i.replace(k, M); + } + return i; + } + /** + * 转换ISO日期为中文完整时间 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZh(t) { + return this.formatIsoToZhDateFormat(t, !1, !1); + } + /** + * 转换ISO日期为中文日期 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZhDate(t) { + return this.formatIsoToZhDateFormat(t, !1, !0); + } + /** + * 转换ISO日期为中文时间 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZhTime(t) { + return this.formatIsoToZhDateFormat(t, !1).split(this.TIME_SPLIT)[1]; + } + /** + * 当前日期时间完整格式,格式:2023-03-10 02:03:43 + */ + nowZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0); + } + /** + * 当前日期,格式:2023-03-10 + */ + nowDateZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0, !0); + } + /** + * 当前时间,格式:02:03:43 + */ + nowTimeZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0).split(this.TIME_SPLIT)[1]; + } +} +class Il { + /** + * 格式化字符串 + * + * @param str - 字符串,可用占位符,例如:test \{0\} str + * @param args - 按占位符顺序排列的参数 + * @author terwer + * @since 0.0.1 + */ + f(t, ...n) { + let a = t; + for (let i = 0; i < n.length; i++) { + const l = n[i]; + typeof l == "string" ? a = a.replace(`{${i}}`, l) : a = a.replace(`{${i}}`, l.toString()); + } + return a; + } + /** + * 字符串拼接 + * + * @param str - 字符串数组 + */ + appendStr(...t) { + return t.join(""); + } + /** + * 判断字符串中,是否包含数组中任何一个元素 + * + * @param str - 字符串 + * @param arr - 字符串数组 + */ + includeInArray(t, n) { + let a = !1; + for (let i = 0; i < n.length; i++) { + const l = n[i]; + t.includes(l) && (a = !0); + } + return a; + } + /** + * 截取指定长度的字符串 + * + * @param str - str + * @param length - 长度 + * @param ignore - 不要结尾省略号 + */ + getByLength(t, n, a) { + const i = t; + return i.length < n ? i : a ? i.substring(0, n) : i.substring(0, n) + "..."; + } + /** + * 字符串空值检测 + * + * @param str - 待检测的字符串 + */ + isEmptyString(t) { + return !t || typeof t != "string" ? !0 : t.trim().length === 0; + } + /** + * 路径组合,解决多出来/的问题 + * + * @param path1 - 路径1 + * @param path2 - 路径2 + */ + pathJoin(t, n) { + let a = t; + const i = t.lastIndexOf("/"); + return i + 1 === t.length && (a = t.substring(0, i)), n.indexOf("/") > 0 ? a = a + "/" + n : a = a + n, a; + } + /** + * 强转boolean + * + * @param val - val + */ + parseBoolean(t) { + return t || (t = "false"), t.toString().toLowerCase() === "true"; + } +} +const Vr = (e, t) => { + const n = fn(e), a = fn(t), i = n.pop(), l = a.pop(), f = yn(n, a); + return f !== 0 ? f : i && l ? yn(i.split("."), l.split(".")) : i || l ? i ? -1 : 1 : 0; +}, Al = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, fn = (e) => { + if (typeof e != "string") + throw new TypeError("Invalid argument expected string"); + const t = e.match(Al); + if (!t) + throw new Error(`Invalid argument not valid semver ('${e}' received)`); + return t.shift(), t; +}, mn = (e) => e === "*" || e === "x" || e === "X", gn = (e) => { + const t = parseInt(e, 10); + return isNaN(t) ? e : t; +}, Rl = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], Ll = (e, t) => { + if (mn(e) || mn(t)) + return 0; + const [n, a] = Rl(gn(e), gn(t)); + return n > a ? 1 : n < a ? -1 : 0; +}, yn = (e, t) => { + for (let n = 0; n < Math.max(e.length, t.length); n++) { + const a = Ll(e[n] || "0", t[n] || "0"); + if (a !== 0) + return a; + } + return 0; +}; +class Ml { + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is higher than v2 + */ + greater(t, n) { + return Vr(t, n) > 0; + } + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is equal to v2 + */ + equal(t, n) { + return Vr(t, n) === 0; + } + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is lesser than v2 + */ + lesser(t, n) { + return Vr(t, n) < 0; + } +} +var zl = Object.defineProperty, Dl = (e, t, n) => t in e ? zl(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Nt = (e, t, n) => (Dl(e, typeof t != "symbol" ? t + "" : t, n), n); +let st = class { +}; +Nt(st, "NODE_ENV_KEY", "NODE_ENV"), /** +* 开发环境 +*/ +Nt(st, "NODE_ENV_DEVELOPMENT", "development"), /** +* 生产环境 +*/ +Nt(st, "NODE_ENV_PRODUCTION", "production"), /** +* 测试环境 +*/ +Nt(st, "NODE_ENV_TEST", "test"), /** +* 是否处于调试模式 +*/ +Nt(st, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); +class Vl { + /** + * 环境初始化 + * + * @param envMeta - 需要传入 {"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false} 。特别提醒:此参数是静态元数据,取决于最终使用的项目。因此仅仅在最终使用的地方显示传递此值,中间项目请保持参数传递 + * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} + */ + constructor(t) { + Nt(this, "envMeta"), this.envMeta = t; + } + /** + * 是否是开发阶段调试 + */ + isNodeDev() { + return this.getEnv(st.NODE_ENV_KEY) === st.NODE_ENV_DEVELOPMENT; + } + /** + * 是否是调试阶段 + */ + isDev() { + return this.isNodeDev() || this.getBooleanEnv(st.VITE_DEBUG_MODE_KEY); + } + /** + * 获取环境变量,key不存在返回undefined + * @param key - key + */ + getEnv(t) { + let n; + try { + this.envMeta[t] && (n = this.envMeta[t]); + } catch { + } + return n; + } + /** + * 获取String类型的环境变量,key不存在直接返回空值 + * @param key - key + */ + getStringEnv(t) { + return this.getEnv(t) ?? ""; + } + /** + * 获取Boolean类型的环境变量,key不存在返回false + * @param key - key + */ + getBooleanEnv(t) { + let n = !1; + return this.getEnv(t) && (n = this.getStringEnv(t).toLowerCase() === "true"), n; + } + /** + * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 + * + * @param key - key + * @param defaultValue - 默认值 + * @since 0.1.0 + * @author terwer + */ + getEnvOrDefault(t, n) { + const a = this.getStringEnv(t); + return a.trim().length == 0 ? n : a; + } +} +var Ul = Object.defineProperty, Bl = (e, t, n) => t in e ? Ul(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, At = (e, t, n) => (Bl(e, typeof t != "symbol" ? t + "" : t, n), n); +class xr { +} +At(xr, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), At(xr, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); +var Ve = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(Ve || {}), uo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function Ia(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var ho = { exports: {} }; +(function(e) { + (function(t, n) { + e.exports ? e.exports = n() : t.log = n(); + })(uo, function() { + var t = function() { + }, n = "undefined", a = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), i = [ + "trace", + "debug", + "info", + "warn", + "error" + ]; + function l(C, x) { + var $ = C[x]; + if (typeof $.bind == "function") + return $.bind(C); + try { + return Function.prototype.bind.call($, C); + } catch { + return function() { + return Function.prototype.apply.apply($, [C, arguments]); + }; + } + } + function f() { + console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); + } + function b(C) { + return C === "debug" && (C = "log"), typeof console === n ? !1 : C === "trace" && a ? f : console[C] !== void 0 ? l(console, C) : console.log !== void 0 ? l(console, "log") : t; + } + function k(C, x) { + for (var $ = 0; $ < i.length; $++) { + var T = i[$]; + this[T] = $ < C ? t : this.methodFactory(T, C, x); + } + this.log = this.debug; + } + function _(C, x, $) { + return function() { + typeof console !== n && (k.call(this, x, $), this[C].apply(this, arguments)); + }; + } + function y(C, x, $) { + return b(C) || _.apply(this, arguments); + } + function S(C, x, $) { + var T = this, R; + x = x ?? "WARN"; + var r = "loglevel"; + typeof C == "string" ? r += ":" + C : typeof C == "symbol" && (r = void 0); + function s(m) { + var p = (i[m] || "silent").toUpperCase(); + if (!(typeof window === n || !r)) { + try { + window.localStorage[r] = p; + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(r) + "=" + p + ";"; + } catch { + } + } + } + function o() { + var m; + if (!(typeof window === n || !r)) { + try { + m = window.localStorage[r]; + } catch { + } + if (typeof m === n) + try { + var p = window.document.cookie, j = p.indexOf( + encodeURIComponent(r) + "=" + ); + j !== -1 && (m = /^([^;]+)/.exec(p.slice(j))[1]); + } catch { + } + return T.levels[m] === void 0 && (m = void 0), m; + } + } + function c() { + if (!(typeof window === n || !r)) { + try { + window.localStorage.removeItem(r); + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(r) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + } catch { + } + } + } + T.name = C, T.levels = { + TRACE: 0, + DEBUG: 1, + INFO: 2, + WARN: 3, + ERROR: 4, + SILENT: 5 + }, T.methodFactory = $ || y, T.getLevel = function() { + return R; + }, T.setLevel = function(m, p) { + if (typeof m == "string" && T.levels[m.toUpperCase()] !== void 0 && (m = T.levels[m.toUpperCase()]), typeof m == "number" && m >= 0 && m <= T.levels.SILENT) { + if (R = m, p !== !1 && s(m), k.call(T, m, C), typeof console === n && m < T.levels.SILENT) + return "No console available for logging"; + } else + throw "log.setLevel() called with invalid level: " + m; + }, T.setDefaultLevel = function(m) { + x = m, o() || T.setLevel(m, !1); + }, T.resetLevel = function() { + T.setLevel(x, !1), c(); + }, T.enableAll = function(m) { + T.setLevel(T.levels.TRACE, m); + }, T.disableAll = function(m) { + T.setLevel(T.levels.SILENT, m); + }; + var u = o(); + u == null && (u = x), T.setLevel(u, !1); + } + var A = new S(), M = {}; + A.getLogger = function(C) { + if (typeof C != "symbol" && typeof C != "string" || C === "") + throw new TypeError("You must supply a name when creating a logger."); + var x = M[C]; + return x || (x = M[C] = new S( + C, + A.getLevel(), + A.methodFactory + )), x; + }; + var O = typeof window !== n ? window.log : void 0; + return A.noConflict = function() { + return typeof window !== n && window.log === A && (window.log = O), A; + }, A.getLoggers = function() { + return M; + }, A.default = A, A; + }); +})(ho); +var Fl = ho.exports; +const _r = /* @__PURE__ */ Ia(Fl); +var po = { exports: {} }; +(function(e) { + (function(t, n) { + e.exports ? e.exports = n() : t.prefix = n(t); + })(uo, function(t) { + var n = function(y) { + for (var S = 1, A = arguments.length, M; S < A; S++) + for (M in arguments[S]) + Object.prototype.hasOwnProperty.call(arguments[S], M) && (y[M] = arguments[S][M]); + return y; + }, a = { + template: "[%t] %l:", + levelFormatter: function(y) { + return y.toUpperCase(); + }, + nameFormatter: function(y) { + return y || "root"; + }, + timestampFormatter: function(y) { + return y.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); + }, + format: void 0 + }, i, l = {}, f = function(y) { + if (!y || !y.getLogger) + throw new TypeError("Argument is not a root logger"); + i = y; + }, b = function(y, S) { + if (!y || !y.setLevel) + throw new TypeError("Argument is not a logger"); + var A = y.methodFactory, M = y.name || "", O = l[M] || l[""] || a; + function C(x, $, T) { + var R = A(x, $, T), r = l[T] || l[""], s = r.template.indexOf("%t") !== -1, o = r.template.indexOf("%l") !== -1, c = r.template.indexOf("%n") !== -1; + return function() { + for (var u = "", m = arguments.length, p = Array(m), j = 0; j < m; j++) + p[j] = arguments[j]; + if (M || !l[T]) { + var V = r.timestampFormatter(/* @__PURE__ */ new Date()), F = r.levelFormatter(x), D = r.nameFormatter(T); + r.format ? u += r.format(F, D, V) : (u += r.template, s && (u = u.replace(/%t/, V)), o && (u = u.replace(/%l/, F)), c && (u = u.replace(/%n/, D))), p.length && typeof p[0] == "string" ? p[0] = u + " " + p[0] : p.unshift(u); + } + R.apply(void 0, p); + }; + } + return l[M] || (y.methodFactory = C), S = S || {}, S.template && (S.format = void 0), l[M] = n({}, O, S), y.setLevel(y.getLevel()), i || y.warn( + "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md" + ), y; + }, k = { + reg: f, + apply: b + }, _; + return t && (_ = t.prefix, k.noConflict = function() { + return t.prefix === k && (t.prefix = _), k; + }), k; + }); +})(po); +var Hl = po.exports; +const _n = /* @__PURE__ */ Ia(Hl); +function ql() { + const e = Error.prepareStackTrace; + Error.prepareStackTrace = (n, a) => a; + const t = new Error().stack.slice(1); + return Error.prepareStackTrace = e, t; +} +class Tr { + /** + * 解析日志级别为枚举 + * + * @param enumObj - 枚举对象 + * @param value - 配置的值 + */ + static stringToEnumValue(t, n) { + return t[Object.keys(t).filter((a) => t[a].toString() === n)[0]]; + } + /** + * 获取配置的日志级别 + */ + static getEnvLevel(t) { + if (!t) + return; + let n; + try { + n = t.getEnvOrDefault(xr.LOG_LEVEL_KEY, Ve.LOG_LEVEL_INFO); + } catch { + n = Ve.LOG_LEVEL_INFO; + } + const a = Tr.stringToEnumValue(Ve, n.toUpperCase()); + return a || console.warn( + "[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level" + ), a ?? Ve.LOG_LEVEL_INFO; + } + /** + * 获取默认日志 + */ + static getEnvLogger(t) { + return t ? t.getEnv(xr.LOG_PREFIX_KEY) : void 0; + } +} +var Aa = { exports: {} }, bn = { exports: {} }, wn; +function Gl() { + return wn || (wn = 1, function(e) { + const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", n = typeof process < "u" && process.platform === "win32", a = typeof process < "u" && process.platform === "linux", i = { + ballotDisabled: "☒", + ballotOff: "☐", + ballotOn: "☑", + bullet: "•", + bulletWhite: "◦", + fullBlock: "█", + heart: "❤", + identicalTo: "≡", + line: "─", + mark: "※", + middot: "·", + minus: "-", + multiplication: "×", + obelus: "÷", + pencilDownRight: "✎", + pencilRight: "✏", + pencilUpRight: "✐", + percent: "%", + pilcrow2: "❡", + pilcrow: "¶", + plusMinus: "±", + question: "?", + section: "§", + starsOff: "☆", + starsOn: "★", + upDownArrow: "↕" + }, l = Object.assign({}, i, { + check: "√", + cross: "×", + ellipsisLarge: "...", + ellipsis: "...", + info: "i", + questionSmall: "?", + pointer: ">", + pointerSmall: "»", + radioOff: "( )", + radioOn: "(*)", + warning: "‼" + }), f = Object.assign({}, i, { + ballotCross: "✘", + check: "✔", + cross: "✖", + ellipsisLarge: "⋯", + ellipsis: "…", + info: "ℹ", + questionFull: "?", + questionSmall: "﹖", + pointer: a ? "▸" : "❯", + pointerSmall: a ? "‣" : "›", + radioOff: "◯", + radioOn: "◉", + warning: "⚠" + }); + e.exports = n && !t ? l : f, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: i }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: l }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: f }); + }(bn)), bn.exports; +} +const Kl = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Wl = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, Yl = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, fo = () => { + const e = { + enabled: Yl(), + visible: !0, + styles: {}, + keys: {} + }, t = (l) => { + let f = l.open = `\x1B[${l.codes[0]}m`, b = l.close = `\x1B[${l.codes[1]}m`, k = l.regex = new RegExp(`\\u001b\\[${l.codes[1]}m`, "g"); + return l.wrap = (_, y) => { + _.includes(b) && (_ = _.replace(k, b + f)); + let S = f + _ + b; + return y ? S.replace(/\r*\n/g, `${b}$&${f}`) : S; + }, l; + }, n = (l, f, b) => typeof l == "function" ? l(f) : l.wrap(f, b), a = (l, f) => { + if (l === "" || l == null) + return ""; + if (e.enabled === !1) + return l; + if (e.visible === !1) + return ""; + let b = "" + l, k = b.includes(` +`), _ = f.length; + for (_ > 0 && f.includes("unstyle") && (f = [.../* @__PURE__ */ new Set(["unstyle", ...f])].reverse()); _-- > 0; ) + b = n(e.styles[f[_]], b, k); + return b; + }, i = (l, f, b) => { + e.styles[l] = t({ name: l, codes: f }), (e.keys[b] || (e.keys[b] = [])).push(l), Reflect.defineProperty(e, l, { + configurable: !0, + enumerable: !0, + set(k) { + e.alias(l, k); + }, + get() { + let k = (_) => a(_, k.stack); + return Reflect.setPrototypeOf(k, e), k.stack = this.stack ? this.stack.concat(l) : [l], k; + } + }); + }; + return i("reset", [0, 0], "modifier"), i("bold", [1, 22], "modifier"), i("dim", [2, 22], "modifier"), i("italic", [3, 23], "modifier"), i("underline", [4, 24], "modifier"), i("inverse", [7, 27], "modifier"), i("hidden", [8, 28], "modifier"), i("strikethrough", [9, 29], "modifier"), i("black", [30, 39], "color"), i("red", [31, 39], "color"), i("green", [32, 39], "color"), i("yellow", [33, 39], "color"), i("blue", [34, 39], "color"), i("magenta", [35, 39], "color"), i("cyan", [36, 39], "color"), i("white", [37, 39], "color"), i("gray", [90, 39], "color"), i("grey", [90, 39], "color"), i("bgBlack", [40, 49], "bg"), i("bgRed", [41, 49], "bg"), i("bgGreen", [42, 49], "bg"), i("bgYellow", [43, 49], "bg"), i("bgBlue", [44, 49], "bg"), i("bgMagenta", [45, 49], "bg"), i("bgCyan", [46, 49], "bg"), i("bgWhite", [47, 49], "bg"), i("blackBright", [90, 39], "bright"), i("redBright", [91, 39], "bright"), i("greenBright", [92, 39], "bright"), i("yellowBright", [93, 39], "bright"), i("blueBright", [94, 39], "bright"), i("magentaBright", [95, 39], "bright"), i("cyanBright", [96, 39], "bright"), i("whiteBright", [97, 39], "bright"), i("bgBlackBright", [100, 49], "bgBright"), i("bgRedBright", [101, 49], "bgBright"), i("bgGreenBright", [102, 49], "bgBright"), i("bgYellowBright", [103, 49], "bgBright"), i("bgBlueBright", [104, 49], "bgBright"), i("bgMagentaBright", [105, 49], "bgBright"), i("bgCyanBright", [106, 49], "bgBright"), i("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = Wl, e.hasColor = e.hasAnsi = (l) => (e.ansiRegex.lastIndex = 0, typeof l == "string" && l !== "" && e.ansiRegex.test(l)), e.alias = (l, f) => { + let b = typeof f == "string" ? e[f] : f; + if (typeof b != "function") + throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); + b.stack || (Reflect.defineProperty(b, "name", { value: l }), e.styles[l] = b, b.stack = [l]), Reflect.defineProperty(e, l, { + configurable: !0, + enumerable: !0, + set(k) { + e.alias(l, k); + }, + get() { + let k = (_) => a(_, k.stack); + return Reflect.setPrototypeOf(k, e), k.stack = this.stack ? this.stack.concat(b.stack) : b.stack, k; + } + }); + }, e.theme = (l) => { + if (!Kl(l)) + throw new TypeError("Expected theme to be an object"); + for (let f of Object.keys(l)) + e.alias(f, l[f]); + return e; + }, e.alias("unstyle", (l) => typeof l == "string" && l !== "" ? (e.ansiRegex.lastIndex = 0, l.replace(e.ansiRegex, "")) : ""), e.alias("noop", (l) => l), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = Gl(), e.define = i, e; +}; +Aa.exports = fo(); +Aa.exports.create = fo; +var Jl = Aa.exports; +const Me = /* @__PURE__ */ Ia(Jl); +let Wr, mo, go, yo, _o = !0; +typeof process < "u" && ({ FORCE_COLOR: Wr, NODE_DISABLE_COLORS: mo, NO_COLOR: go, TERM: yo } = process.env || {}, _o = process.stdout && process.stdout.isTTY); +const ae = { + enabled: !mo && go == null && yo !== "dumb" && (Wr != null && Wr !== "0" || _o), + // modifiers + reset: pe(0, 0), + bold: pe(1, 22), + dim: pe(2, 22), + italic: pe(3, 23), + underline: pe(4, 24), + inverse: pe(7, 27), + hidden: pe(8, 28), + strikethrough: pe(9, 29), + // colors + black: pe(30, 39), + red: pe(31, 39), + green: pe(32, 39), + yellow: pe(33, 39), + blue: pe(34, 39), + magenta: pe(35, 39), + cyan: pe(36, 39), + white: pe(37, 39), + gray: pe(90, 39), + grey: pe(90, 39), + // background colors + bgBlack: pe(40, 49), + bgRed: pe(41, 49), + bgGreen: pe(42, 49), + bgYellow: pe(43, 49), + bgBlue: pe(44, 49), + bgMagenta: pe(45, 49), + bgCyan: pe(46, 49), + bgWhite: pe(47, 49) +}; +function vn(e, t) { + let n = 0, a, i = "", l = ""; + for (; n < e.length; n++) + a = e[n], i += a.open, l += a.close, ~t.indexOf(a.close) && (t = t.replace(a.rgx, a.close + a.open)); + return i + t + l; +} +function Zl(e, t) { + let n = { has: e, keys: t }; + return n.reset = ae.reset.bind(n), n.bold = ae.bold.bind(n), n.dim = ae.dim.bind(n), n.italic = ae.italic.bind(n), n.underline = ae.underline.bind(n), n.inverse = ae.inverse.bind(n), n.hidden = ae.hidden.bind(n), n.strikethrough = ae.strikethrough.bind(n), n.black = ae.black.bind(n), n.red = ae.red.bind(n), n.green = ae.green.bind(n), n.yellow = ae.yellow.bind(n), n.blue = ae.blue.bind(n), n.magenta = ae.magenta.bind(n), n.cyan = ae.cyan.bind(n), n.white = ae.white.bind(n), n.gray = ae.gray.bind(n), n.grey = ae.grey.bind(n), n.bgBlack = ae.bgBlack.bind(n), n.bgRed = ae.bgRed.bind(n), n.bgGreen = ae.bgGreen.bind(n), n.bgYellow = ae.bgYellow.bind(n), n.bgBlue = ae.bgBlue.bind(n), n.bgMagenta = ae.bgMagenta.bind(n), n.bgCyan = ae.bgCyan.bind(n), n.bgWhite = ae.bgWhite.bind(n), n; +} +function pe(e, t) { + let n = { + open: `\x1B[${e}m`, + close: `\x1B[${t}m`, + rgx: new RegExp(`\\x1b\\[${t}m`, "g") + }; + return function(a) { + return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(n)), a === void 0 ? this : ae.enabled ? vn(this.keys, a + "") : a + "") : a === void 0 ? Zl([e], [n]) : ae.enabled ? vn([n], a + "") : a + ""; + }; +} +var Ql = Object.defineProperty, Xl = (e, t, n) => t in e ? Ql(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, ve = (e, t, n) => (Xl(e, typeof t != "symbol" ? t + "" : t, n), n); +const He = class { + /** + * 检测是否运行在Chrome插件中 + */ + static isInChromeExtension() { + return He.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; + } +}; +let ue = He; +ve(ue, "isNode", typeof process < "u"), /** +* 是否在浏览器环境 +*/ +ve(ue, "isInBrowser", typeof window < "u"), /** +* 浏览器路径分隔符 +*/ +ve(ue, "BrowserSeperator", "/"), /** +* 是否是Electron环境 +*/ +ve(ue, "isElectron", () => !He.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** +* 是否有Node环境,目前包括 Electron 和 Node +*/ +ve(ue, "hasNodeEnv", () => He.isElectron() || He.isNode), /** +* 获取url参数 +* +* @param sParam - 参数 +*/ +ve(ue, "getQueryString", (e) => { + if (!He.isInBrowser) + return ""; + const t = window.location.search.substring(1).split("&"); + for (let n = 0; n < t.length; n++) { + const a = t[n].split("="); + if (a[0] === e) + return a[1]; + } + return ""; +}), /** +* 替换 URL 的参数 +* 思路: +* 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 +* +* 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 +* +* 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 +* +* 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 +* +* 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 +* +* @param url - 链接地址 +* @param paramName - 参数名 +* @param paramValue - 参数值 +*/ +ve(ue, "replaceUrlParam", (e, t, n) => { + n == null && (n = ""); + const a = new RegExp("\\b(" + t + "=).*?(&|#|$)"); + if (e.search(a) >= 0) + return e.replace(a, "$1" + n + "$2"); + const [i, l] = e.split("#"), [f, b] = i.split("?"), k = new URLSearchParams(b); + k.set(t, n); + const _ = k.toString(), y = f + (_ ? "?" + _ : ""); + return l ? y + "#" + l : y; +}), /** +* 设置url参数 +* +* @param urlstring - url +* @param key - key +* @param value - value +*/ +ve(ue, "setUrlParameter", (e, t, n) => { + if (e.includes(t)) + return He.replaceUrlParam(e, t, n); + const a = e.split("#"); + let i = a[0]; + const l = a[1]; + return i.includes("?") ? i += `&${t}=${n}` : i += `?${t}=${n}`, l && (i += "#" + l), i; +}), /** +* 重新加载指定tab +* +* @param tabname - tabname +* @param t - 延迟时间 +*/ +ve(ue, "reloadTabPage", (e, t = 200) => { + setTimeout(function() { + if (He.isInBrowser) { + const n = window.location.href; + window.location.href = He.setUrlParameter(n, "tab", e); + } + }, t); +}), /** +* 刷新当前tab页面 +*/ +ve(ue, "reloadPage", () => { + setTimeout(function() { + He.isInBrowser && window.location.reload(); + }, 200); +}), /** +* 刷新当前tab页面 +* +* @param msg - 消息提示 +* @param cb - 回调 +*/ +ve(ue, "reloadPageWithMessageCallback", (e, t) => { + t && t(e), setTimeout(function() { + He.isInBrowser && window.location.reload(); + }, 200); +}); +var je = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(je || {}); +const Ce = class { + /** + * 检测是否运行在思源打开的浏览器中 + */ + static isInSiyuanBrowser() { + return ue.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; + } + /** + * 思源笔记 window 对象 + */ + static siyuanWindow() { + let e; + return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; + } + // ========================= + // require end + // ========================= + // ========================= + // import start + // ========================= + /** + * 引入json + * + * @param jsPath - js相对路径全路径 + * @param type - 类型 + */ + static async importJs(e, t) { + let n = e; + switch (t) { + case je.BasePathType_Appearance: + n = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); + break; + case je.BasePathType_Data: + n = this.browserJoinPath(this.siyuanDataRelativePath(), e); + break; + case je.BasePathType_Themes: + n = this.browserJoinPath(this.siyuanThemeRelativePath(), e); + break; + case je.BasePathType_ZhiTheme: + n = this.browserJoinPath(this.zhiThemeRelativePath(), e); + break; + default: + throw new Error("type must be provided"); + } + const { default: a } = await import( + /* @vite-ignore */ + n + ); + return a; + } + /** + * 引入json + * + * @param jsonPath - json相对路径全路径 + * @param type - 类型 + */ + // public static async importJson(jsonPath: string, type: BasePathTypeEnum) { + // let fullJsonPath = jsonPath + // switch (type) { + // case BasePathTypeEnum.BasePathType_Appearance: + // fullJsonPath = this.browserJoinPath(this.siyuanAppearanceRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Data: + // fullJsonPath = this.browserJoinPath(this.siyuanDataRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Themes: + // fullJsonPath = this.browserJoinPath(this.siyuanThemeRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_ZhiTheme: + // fullJsonPath = this.browserJoinPath(this.zhiThemeRelativePath(), jsonPath) + // break + // default: + // throw new Error("type must be provided") + // } + // + // const { default: data } = await import(/* @vite-ignore */ fullJsonPath, { assert: { type: "json" } }) + // return data + // } + /** + * 引入 json - 以 data 为基本路径 + * + * @param jsonPath - 相对于 data 的相对路径 + */ + // public static async importDataJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Data) + // } + /** + * 引入 json - 以 appearance 为基本路径 + * + * @param jsonPath - 相对于 appearance 的相对路径 + */ + // public static async importAppearanceJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Appearance) + // } + /** + * 引入 json - 以 themes 为基本路径 + * + * @param jsonPath - 相对于 themes 的相对路径 + */ + // public static async importThemesJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Themes) + // } + /** + * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 + * + * @param jsonPath - 相对于 zhi 主题根路径的相对路径 + */ + // public static async importZhiThemeJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_ZhiTheme) + // } + /** + * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 + * + * @param jsPath - 相对于 zhi 主题根路径的相对路径 + */ + static async importZhiThemeJs(e) { + return await this.importJs(e, je.BasePathType_ZhiTheme); + } + // ========================= + // import start + // ========================= + /** + * 路径拼接 + * + * @param paths - 路径数组 + */ + static joinPath(...e) { + if (ue.hasNodeEnv()) { + const t = this.requireLib("path"); + if (t) + return t.join(...e); + } + return this.browserJoinPath(...e); + } + static browserJoinPath(...e) { + return e.join(ue.BrowserSeperator); + } + /** + * 思源笔记 conf 目录 + */ + static siyuanConfPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.confDir; + } + /** + * 思源笔记 data 目录 + */ + static siyuanDataPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.dataDir; + } + /** + * 思源笔记 data 目录-相对路径 + */ + static siyuanDataRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return ""; + } + /** + * 思源笔记 appearance 目录 + */ + static siyuanAppearancePath() { + return this.joinPath(this.siyuanConfPath(), "appearance"); + } + /** + * 思源笔记 appearance 目录-相对路径 + */ + static siyuanAppearanceRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance"); + } + /** + * 思源笔记 themes 目录-绝对路径 + * + * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 + * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath + * + * @author terwer + * @since 0.1.0 + */ + static siyuanThemePath() { + if (ue.hasNodeEnv()) + return this.joinPath(this.siyuanAppearancePath(), "themes"); + { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return this.joinPath(e.location.origin, "appearance", "themes"); + } + } + /** + * 思源笔记 themes 目录-相对路径 + */ + static siyuanThemeRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance", "themes"); + } + /** + * zhi 主题目录 - 绝对路径 + */ + static zhiThemePath() { + return this.joinPath(this.siyuanThemePath(), "zhi"); + } + /** + * zhi 主题目录 - 相对路径 + */ + static zhiThemeRelativePath() { + return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); + } +}; +let gt = Ce; +ve(gt, "isInSiyuanWidget", () => ue.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** +* 思源笔记新窗口 +* +* @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 +* @author terwer +* @version 0.1.0 +* @since 0.0.1 +*/ +ve(gt, "isInSiyuanNewWin", () => !ue.isInBrowser || !ue.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +// require start +// ========================= +/** + * 引入依赖 + * + * @param libpath - 依赖全路径 + * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 + * @param type - 可选,以谁的基本路径为准 + */ +ve(gt, "requireLib", (e, t = !0, n = je.BasePathType_None) => { + if (!ue.hasNodeEnv()) + throw new Error("require ony works on node env"); + let a = e; + if (!t) + switch (n) { + case je.BasePathType_Appearance: + a = Ce.joinPath(Ce.siyuanAppearancePath(), e); + break; + case je.BasePathType_Data: + a = Ce.joinPath(Ce.siyuanDataPath(), e); + break; + case je.BasePathType_Themes: + a = Ce.joinPath(Ce.siyuanAppearancePath(), "themes", e); + break; + case je.BasePathType_ZhiTheme: + a = Ce.joinPath(Ce.siyuanAppearancePath(), "themes", "zhi", e); + break; + default: + throw new Error("type must be provided when not use absolute path"); + } + const i = Ce.siyuanWindow(); + if (!i) + return require(a); + if (typeof i.require < "u") + return i.require(a); +}), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 appearance 的相对路径 +*/ +ve(gt, "requireAppearanceLib", (e) => Ce.requireLib(e, !1, je.BasePathType_Appearance)), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 data 的相对路径 +*/ +ve(gt, "requireDataLib", (e) => Ce.requireLib(e, !1, je.BasePathType_Data)), /** +* 引入依赖,以 theme 的基本路径为准 +* +* @param libpath - 相对于 theme 的相对路径 +*/ +ve(gt, "requireThemesLib", (e) => Ce.requireLib(e, !1, je.BasePathType_Themes)), /** +* 引入依赖,以 ZhiTheme 的基本路径为准 +* +* @param libpath - 相对于 ZhiTheme 的相对路径 +*/ +ve(gt, "requireZhiThemeLib", (e) => Ce.requireLib(e, !1, je.BasePathType_ZhiTheme)); +const ze = { + white: (e) => ue.isElectron() ? Me.whiteBright(e) : ae.white(e), + gray: (e) => ue.isElectron() ? Me.gray(e) : ae.gray(e), + blue: (e) => ue.isElectron() ? Me.blue(e) : ae.blue(e), + green: (e) => ue.isElectron() ? Me.green(e) : ae.green(e), + yellow: (e) => ue.isElectron() ? Me.yellow(e) : ae.yellow(e), + red: (e) => ue.isElectron() ? Me.red(e) : ae.red(e), + bgWhite: (e) => ue.isElectron() ? Me.bgWhiteBright(e) : ae.bgWhite(e), + bgGrey: (e) => ue.isElectron() ? Me.bgCyanBright(e) : ae.bgCyan(e), + bgBlue: (e) => ue.isElectron() ? Me.bgBlueBright(e) : ae.bgBlue(e), + bgGreen: (e) => ue.isElectron() ? Me.bgGreenBright(e) : ae.bgGreen(e), + bgYellow: (e) => ue.isElectron() ? Me.bgYellowBright(e) : ae.bgYellow(e), + bgRed: (e) => ue.isElectron() ? Me.bgRedBright(e) : ae.bgRed(e) +}; +class eu { + constructor(t, n, a) { + At(this, "consoleLogger", "console"), At(this, "stackSize", 1), At(this, "getLogger", (f) => { + let b; + if (f) + b = f; + else { + const k = this.getCallStack(), _ = [], y = []; + for (let S = 0; S < k.length; S++) { + const A = k[S], M = A.getFileName() ?? "none"; + if (S > this.stackSize - 1) + break; + const O = M + "-" + A.getLineNumber() + ":" + A.getColumnNumber(); + _.push(O); + } + y.length > 0 && (b = _.join(" -> ")); + } + return (!b || b.trim().length === 0) && (b = this.consoleLogger), _r.getLogger(b); + }), this.stackSize = 1; + let i; + t ? i = t : i = Tr.getEnvLevel(a), i = i ?? Ve.LOG_LEVEL_INFO, _r.setLevel(i); + const l = (f, b, k, _) => { + const y = [], S = n ?? Tr.getEnvLogger(a) ?? "zhi"; + return y.push(ze.gray("[") + _(S) + ze.gray("]")), y.push(ze.gray("[") + ze.gray(k.toString()) + ze.gray("]")), y.push(_(f.toUpperCase().toString())), y.push(_(b)), y.push(ze.gray(":")), y; + }; + _n.reg(_r), _n.apply(_r, { + format(f, b, k) { + let _ = []; + const y = b ?? ""; + switch (f) { + case Ve.LOG_LEVEL_TRACE: + _ = l(f, y, k, ze.gray); + break; + case Ve.LOG_LEVEL_DEBUG: + _ = l(f, y, k, ze.blue); + break; + case Ve.LOG_LEVEL_INFO: + _ = l(f, y, k, ze.green); + break; + case Ve.LOG_LEVEL_WARN: + _ = l(f, y, k, ze.yellow); + break; + case Ve.LOG_LEVEL_ERROR: + _ = l(f, y, k, ze.red); + break; + default: + _ = l(Ve.LOG_LEVEL_INFO, y, k, ze.green); + break; + } + return _.join(" "); + } + }); + } + /** + * 设置输出栈的深度,默认1 + * + * @param stackSize - 栈的深度 + */ + setStackSize(t) { + this.stackSize = t ?? 1; + } + /** + * 获取调用堆栈,若未获取到直接返回空数组 + * + * @author terwer + * @since 1.6.0 + */ + getCallStack() { + let t; + try { + t = ql(); + } catch { + t = []; + } + return t; + } +} +class tu { + /** + * 默认日志级别 + * + * @param level - 可选,未设置默认INFO + * @param sign - 可选前缀,默认zhi + * @param env - 可选环境变量实例 + */ + constructor(t, n, a) { + At(this, "logger"), this.logger = new eu(t, n, a); + } + /** + * 获取日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + * @protected + */ + getLogger(t, n) { + return this.logger.setStackSize(n), this.logger.getLogger(t); + } +} +class $n extends tu { + constructor(t, n, a) { + super(t, n, a); + } + /** + * 获取默认的日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + */ + getLogger(t, n) { + return super.getLogger(t, n); + } +} +class Ra { + /** + * 默认日志记录器 + * + * @param stackSize - 栈的深度 + * @param env - 环境变量实例 + */ + static defaultLogger(t, n) { + return Ra.customLogFactory(void 0, void 0, t).getLogger(void 0, n); + } + /** + * 自定义日志工厂 + * + * @param level - 级别 + * @param sign - 标志 + * @param env - 环境变量 + */ + static customLogFactory(t, n, a) { + return new $n(t, n, a); + } + /** + * 自定义日志工厂,自定义前缀 + * + * @param sign - 标志 + * @param env - 环境变量 + */ + static customSignLogFactory(t, n) { + return new $n(void 0, t, n); + } +} +const ru = "zhi"; +class tr { + /** + * 某些情况下,可能需要手动 init 之后才能用 + */ + static initEnv(t) { + this.env = t; + } + /** + * 获取 zhi-env 实例 - 必须在使用的时候重写此方法 + * + * ``` + * if (!this.env) { + * this.env = new Env({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false}) + * } + * return this.env + * ``` + * + * @see {@link https://github.com/terwer/zhi/tree/main/apps/zhi-env#usage docs for zhi-env usage} + */ + static zhiEnv() { + throw new Error("Method 'zhiEnv' must be implemented"); + } + /** + * 获取 zhi-log 实例 + * + * @param sign - 标志 + * @param loggerName - 日志名称 + */ + static zhiLogWithSign(t, n) { + if (this.loggerMap[n]) + return this.loggerMap[n].debug("Zhi-log use cache"), this.loggerMap[n]; + const a = this.env, i = Ra.customSignLogFactory(t, a).getLogger(n); + return this.loggerMap[n] = i, i.debug("Zhi-log add new logger"), i; + } + /** + * 获取 zhi-log 实例 + * + * @param loggerName - 日志名称 + */ + static zhiLog(t) { + return this.zhiLogWithSign(ru, t); + } + /** + * 获取 zhi-common 实例 + */ + static zhiCommon() { + return this.common || (this.common = new iu()), this.common; + } +} +$e(tr, "env"), /** +* zhi-util 的日志器缓存 +*/ +$e(tr, "loggerMap", {}), /** +* zhi-util 的通用工具类 +*/ +$e(tr, "common"); +class La extends tr { + static zhiEnv() { + return this.env || (this.env = new Vl({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; + } +} +class kn { + constructor() { + $e(this, "logger"), this.logger = La.zhiLog("lute-adaptor"), Lute ? this.logger.debug("Detected Lute is bundled, will use!") : this.logger.debug("Lute is not available!"); + } + isAvailable() { + return typeof Lute < "u"; + } + /** + * 高亮关键字 + * + * @param str - 字符串 + * @private + */ + highlightWords(t) { + const n = new RegExp("(?<=^|[\\s\\S])==([^\\n]+?)==(?=($|[\\s\\S]))", "g"); + return t.replace(n, '$1'); + } + /** + * 渲染Markdown + * + * @param md - Markdown + */ + async renderMarkdownStr(t) { + if (!this.isAvailable()) + return this.logger.error("Lute is not available, will return original md"), t; + const n = Lute, a = n.New(), i = { + renderText: (l, f) => f ? [this.highlightWords(l.Text()), n.WalkContinue] : ["", n.WalkContinue] + // renderStrong: (node: any, entering: any) => { + // return ["", luteObj.WalkContinue] + // }, + // renderParagraph: (node: any, entering: any) => { + // return ["", luteObj.WalkContinue] + // } + }; + return a.SetJSRenderers({ + renderers: { + Md2HTML: i + } + }), this.logger.info("Lute is rendering md to HTML..."), a.MarkdownStr("", t); + } +} +var bo = { exports: {} }; +(function(e) { + (function() { + function t(r) { + var s = { + omitExtraWLInCodeBlocks: { + defaultValue: !1, + describe: "Omit the default extra whiteline added to code blocks", + type: "boolean" + }, + noHeaderId: { + defaultValue: !1, + describe: "Turn on/off generated header id", + type: "boolean" + }, + prefixHeaderId: { + defaultValue: !1, + describe: "Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix", + type: "string" + }, + rawPrefixHeaderId: { + defaultValue: !1, + describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)', + type: "boolean" + }, + ghCompatibleHeaderId: { + defaultValue: !1, + describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)", + type: "boolean" + }, + rawHeaderId: { + defaultValue: !1, + describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`, + type: "boolean" + }, + headerLevelStart: { + defaultValue: !1, + describe: "The header blocks level start", + type: "integer" + }, + parseImgDimensions: { + defaultValue: !1, + describe: "Turn on/off image dimension parsing", + type: "boolean" + }, + simplifiedAutoLink: { + defaultValue: !1, + describe: "Turn on/off GFM autolink style", + type: "boolean" + }, + excludeTrailingPunctuationFromURLs: { + defaultValue: !1, + describe: "Excludes trailing punctuation from links generated with autoLinking", + type: "boolean" + }, + literalMidWordUnderscores: { + defaultValue: !1, + describe: "Parse midword underscores as literal underscores", + type: "boolean" + }, + literalMidWordAsterisks: { + defaultValue: !1, + describe: "Parse midword asterisks as literal asterisks", + type: "boolean" + }, + strikethrough: { + defaultValue: !1, + describe: "Turn on/off strikethrough support", + type: "boolean" + }, + tables: { + defaultValue: !1, + describe: "Turn on/off tables support", + type: "boolean" + }, + tablesHeaderId: { + defaultValue: !1, + describe: "Add an id to table headers", + type: "boolean" + }, + ghCodeBlocks: { + defaultValue: !0, + describe: "Turn on/off GFM fenced code blocks support", + type: "boolean" + }, + tasklists: { + defaultValue: !1, + describe: "Turn on/off GFM tasklist support", + type: "boolean" + }, + smoothLivePreview: { + defaultValue: !1, + describe: "Prevents weird effects in live previews due to incomplete input", + type: "boolean" + }, + smartIndentationFix: { + defaultValue: !1, + describe: "Tries to smartly fix indentation in es6 strings", + type: "boolean" + }, + disableForced4SpacesIndentedSublists: { + defaultValue: !1, + describe: "Disables the requirement of indenting nested sublists by 4 spaces", + type: "boolean" + }, + simpleLineBreaks: { + defaultValue: !1, + describe: "Parses simple line breaks as
(GFM Style)", + type: "boolean" + }, + requireSpaceBeforeHeadingText: { + defaultValue: !1, + describe: "Makes adding a space between `#` and the header text mandatory (GFM Style)", + type: "boolean" + }, + ghMentions: { + defaultValue: !1, + describe: "Enables github @mentions", + type: "boolean" + }, + ghMentionsLink: { + defaultValue: "https://github.com/{u}", + describe: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.", + type: "string" + }, + encodeEmails: { + defaultValue: !0, + describe: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities", + type: "boolean" + }, + openLinksInNewWindow: { + defaultValue: !1, + describe: "Open all links in new windows", + type: "boolean" + }, + backslashEscapesHTMLTags: { + defaultValue: !1, + describe: "Support for HTML Tag escaping. ex:
foo
", + type: "boolean" + }, + emoji: { + defaultValue: !1, + describe: "Enable emoji support. Ex: `this is a :smile: emoji`", + type: "boolean" + }, + underline: { + defaultValue: !1, + describe: "Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``", + type: "boolean" + }, + ellipsis: { + defaultValue: !0, + describe: "Replaces three dots with the ellipsis unicode character", + type: "boolean" + }, + completeHTMLDocument: { + defaultValue: !1, + describe: "Outputs a complete html document, including ``, `` and `` tags", + type: "boolean" + }, + metadata: { + defaultValue: !1, + describe: "Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).", + type: "boolean" + }, + splitAdjacentBlockquotes: { + defaultValue: !1, + describe: "Split adjacent blockquote blocks", + type: "boolean" + } + }; + if (r === !1) + return JSON.parse(JSON.stringify(s)); + var o = {}; + for (var c in s) + s.hasOwnProperty(c) && (o[c] = s[c].defaultValue); + return o; + } + function n() { + var r = t(!0), s = {}; + for (var o in r) + r.hasOwnProperty(o) && (s[o] = !0); + return s; + } + var a = {}, i = {}, l = {}, f = t(!0), b = "vanilla", k = { + github: { + omitExtraWLInCodeBlocks: !0, + simplifiedAutoLink: !0, + excludeTrailingPunctuationFromURLs: !0, + literalMidWordUnderscores: !0, + strikethrough: !0, + tables: !0, + tablesHeaderId: !0, + ghCodeBlocks: !0, + tasklists: !0, + disableForced4SpacesIndentedSublists: !0, + simpleLineBreaks: !0, + requireSpaceBeforeHeadingText: !0, + ghCompatibleHeaderId: !0, + ghMentions: !0, + backslashEscapesHTMLTags: !0, + emoji: !0, + splitAdjacentBlockquotes: !0 + }, + original: { + noHeaderId: !0, + ghCodeBlocks: !1 + }, + ghost: { + omitExtraWLInCodeBlocks: !0, + parseImgDimensions: !0, + simplifiedAutoLink: !0, + excludeTrailingPunctuationFromURLs: !0, + literalMidWordUnderscores: !0, + strikethrough: !0, + tables: !0, + tablesHeaderId: !0, + ghCodeBlocks: !0, + tasklists: !0, + smoothLivePreview: !0, + simpleLineBreaks: !0, + requireSpaceBeforeHeadingText: !0, + ghMentions: !1, + encodeEmails: !0 + }, + vanilla: t(!0), + allOn: n() + }; + a.helper = {}, a.extensions = {}, a.setOption = function(r, s) { + return f[r] = s, this; + }, a.getOption = function(r) { + return f[r]; + }, a.getOptions = function() { + return f; + }, a.resetOptions = function() { + f = t(!0); + }, a.setFlavor = function(r) { + if (!k.hasOwnProperty(r)) + throw Error(r + " flavor was not found"); + a.resetOptions(); + var s = k[r]; + b = r; + for (var o in s) + s.hasOwnProperty(o) && (f[o] = s[o]); + }, a.getFlavor = function() { + return b; + }, a.getFlavorOptions = function(r) { + if (k.hasOwnProperty(r)) + return k[r]; + }, a.getDefaultOptions = function(r) { + return t(r); + }, a.subParser = function(r, s) { + if (a.helper.isString(r)) + if (typeof s < "u") + i[r] = s; + else { + if (i.hasOwnProperty(r)) + return i[r]; + throw Error("SubParser named " + r + " not registered!"); + } + }, a.extension = function(r, s) { + if (!a.helper.isString(r)) + throw Error("Extension 'name' must be a string"); + if (r = a.helper.stdExtName(r), a.helper.isUndefined(s)) { + if (!l.hasOwnProperty(r)) + throw Error("Extension named " + r + " is not registered!"); + return l[r]; + } else { + typeof s == "function" && (s = s()), a.helper.isArray(s) || (s = [s]); + var o = _(s, r); + if (o.valid) + l[r] = s; + else + throw Error(o.error); + } + }, a.getAllExtensions = function() { + return l; + }, a.removeExtension = function(r) { + delete l[r]; + }, a.resetExtensions = function() { + l = {}; + }; + function _(r, s) { + var o = s ? "Error in " + s + " extension->" : "Error in unnamed extension", c = { + valid: !0, + error: "" + }; + a.helper.isArray(r) || (r = [r]); + for (var u = 0; u < r.length; ++u) { + var m = o + " sub-extension " + u + ": ", p = r[u]; + if (typeof p != "object") + return c.valid = !1, c.error = m + "must be an object, but " + typeof p + " given", c; + if (!a.helper.isString(p.type)) + return c.valid = !1, c.error = m + 'property "type" must be a string, but ' + typeof p.type + " given", c; + var j = p.type = p.type.toLowerCase(); + if (j === "language" && (j = p.type = "lang"), j === "html" && (j = p.type = "output"), j !== "lang" && j !== "output" && j !== "listener") + return c.valid = !1, c.error = m + "type " + j + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', c; + if (j === "listener") { + if (a.helper.isUndefined(p.listeners)) + return c.valid = !1, c.error = m + '. Extensions of type "listener" must have a property called "listeners"', c; + } else if (a.helper.isUndefined(p.filter) && a.helper.isUndefined(p.regex)) + return c.valid = !1, c.error = m + j + ' extensions must define either a "regex" property or a "filter" method', c; + if (p.listeners) { + if (typeof p.listeners != "object") + return c.valid = !1, c.error = m + '"listeners" property must be an object but ' + typeof p.listeners + " given", c; + for (var V in p.listeners) + if (p.listeners.hasOwnProperty(V) && typeof p.listeners[V] != "function") + return c.valid = !1, c.error = m + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + V + " must be a function but " + typeof p.listeners[V] + " given", c; + } + if (p.filter) { + if (typeof p.filter != "function") + return c.valid = !1, c.error = m + '"filter" must be a function, but ' + typeof p.filter + " given", c; + } else if (p.regex) { + if (a.helper.isString(p.regex) && (p.regex = new RegExp(p.regex, "g")), !(p.regex instanceof RegExp)) + return c.valid = !1, c.error = m + '"regex" property must either be a string or a RegExp object, but ' + typeof p.regex + " given", c; + if (a.helper.isUndefined(p.replace)) + return c.valid = !1, c.error = m + '"regex" extensions must implement a replace string or function', c; + } + } + return c; + } + a.validateExtension = function(r) { + var s = _(r, null); + return s.valid ? !0 : (console.warn(s.error), !1); + }, a.hasOwnProperty("helper") || (a.helper = {}), a.helper.isString = function(r) { + return typeof r == "string" || r instanceof String; + }, a.helper.isFunction = function(r) { + var s = {}; + return r && s.toString.call(r) === "[object Function]"; + }, a.helper.isArray = function(r) { + return Array.isArray(r); + }, a.helper.isUndefined = function(r) { + return typeof r > "u"; + }, a.helper.forEach = function(r, s) { + if (a.helper.isUndefined(r)) + throw new Error("obj param is required"); + if (a.helper.isUndefined(s)) + throw new Error("callback param is required"); + if (!a.helper.isFunction(s)) + throw new Error("callback param must be a function/closure"); + if (typeof r.forEach == "function") + r.forEach(s); + else if (a.helper.isArray(r)) + for (var o = 0; o < r.length; o++) + s(r[o], o, r); + else if (typeof r == "object") + for (var c in r) + r.hasOwnProperty(c) && s(r[c], c, r); + else + throw new Error("obj does not seem to be an array or an iterable object"); + }, a.helper.stdExtName = function(r) { + return r.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); + }; + function y(r, s) { + var o = s.charCodeAt(0); + return "¨E" + o + "E"; + } + a.helper.escapeCharactersCallback = y, a.helper.escapeCharacters = function(r, s, o) { + var c = "([" + s.replace(/([\[\]\\])/g, "\\$1") + "])"; + o && (c = "\\\\" + c); + var u = new RegExp(c, "g"); + return r = r.replace(u, y), r; + }, a.helper.unescapeHTMLEntities = function(r) { + return r.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); + }; + var S = function(r, s, o, c) { + var u = c || "", m = u.indexOf("g") > -1, p = new RegExp(s + "|" + o, "g" + u.replace(/g/g, "")), j = new RegExp(s, u.replace(/g/g, "")), V = [], F, D, q, g, H; + do + for (F = 0; q = p.exec(r); ) + if (j.test(q[0])) + F++ || (D = p.lastIndex, g = D - q[0].length); + else if (F && !--F) { + H = q.index + q[0].length; + var W = { + left: { start: g, end: D }, + match: { start: D, end: q.index }, + right: { start: q.index, end: H }, + wholeMatch: { start: g, end: H } + }; + if (V.push(W), !m) + return V; + } + while (F && (p.lastIndex = D)); + return V; + }; + a.helper.matchRecursiveRegExp = function(r, s, o, c) { + for (var u = S(r, s, o, c), m = [], p = 0; p < u.length; ++p) + m.push([ + r.slice(u[p].wholeMatch.start, u[p].wholeMatch.end), + r.slice(u[p].match.start, u[p].match.end), + r.slice(u[p].left.start, u[p].left.end), + r.slice(u[p].right.start, u[p].right.end) + ]); + return m; + }, a.helper.replaceRecursiveRegExp = function(r, s, o, c, u) { + if (!a.helper.isFunction(s)) { + var m = s; + s = function() { + return m; + }; + } + var p = S(r, o, c, u), j = r, V = p.length; + if (V > 0) { + var F = []; + p[0].wholeMatch.start !== 0 && F.push(r.slice(0, p[0].wholeMatch.start)); + for (var D = 0; D < V; ++D) + F.push( + s( + r.slice(p[D].wholeMatch.start, p[D].wholeMatch.end), + r.slice(p[D].match.start, p[D].match.end), + r.slice(p[D].left.start, p[D].left.end), + r.slice(p[D].right.start, p[D].right.end) + ) + ), D < V - 1 && F.push(r.slice(p[D].wholeMatch.end, p[D + 1].wholeMatch.start)); + p[V - 1].wholeMatch.end < r.length && F.push(r.slice(p[V - 1].wholeMatch.end)), j = F.join(""); + } + return j; + }, a.helper.regexIndexOf = function(r, s, o) { + if (!a.helper.isString(r)) + throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; + if (!(s instanceof RegExp)) + throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp"; + var c = r.substring(o || 0).search(s); + return c >= 0 ? c + (o || 0) : c; + }, a.helper.splitAtIndex = function(r, s) { + if (!a.helper.isString(r)) + throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; + return [r.substring(0, s), r.substring(s)]; + }, a.helper.encodeEmailAddress = function(r) { + var s = [ + function(o) { + return "&#" + o.charCodeAt(0) + ";"; + }, + function(o) { + return "&#x" + o.charCodeAt(0).toString(16) + ";"; + }, + function(o) { + return o; + } + ]; + return r = r.replace(/./g, function(o) { + if (o === "@") + o = s[Math.floor(Math.random() * 2)](o); + else { + var c = Math.random(); + o = c > 0.9 ? s[2](o) : c > 0.45 ? s[1](o) : s[0](o); + } + return o; + }), r; + }, a.helper.padEnd = function(r, s, o) { + return s = s >> 0, o = String(o || " "), r.length > s ? String(r) : (s = s - r.length, s > o.length && (o += o.repeat(s / o.length)), String(r) + o.slice(0, s)); + }, typeof console > "u" && (console = { + warn: function(r) { + alert(r); + }, + log: function(r) { + alert(r); + }, + error: function(r) { + throw r; + } + }), a.helper.regexes = { + asteriskDashAndColon: /([*_:~])/g + }, a.helper.emojis = { + "+1": "👍", + "-1": "👎", + 100: "💯", + 1234: "🔢", + "1st_place_medal": "🥇", + "2nd_place_medal": "🥈", + "3rd_place_medal": "🥉", + "8ball": "🎱", + a: "🅰️", + ab: "🆎", + abc: "🔤", + abcd: "🔡", + accept: "🉑", + aerial_tramway: "🚡", + airplane: "✈️", + alarm_clock: "⏰", + alembic: "⚗️", + alien: "👽", + ambulance: "🚑", + amphora: "🏺", + anchor: "⚓️", + angel: "👼", + anger: "💢", + angry: "😠", + anguished: "😧", + ant: "🐜", + apple: "🍎", + aquarius: "♒️", + aries: "♈️", + arrow_backward: "◀️", + arrow_double_down: "⏬", + arrow_double_up: "⏫", + arrow_down: "⬇️", + arrow_down_small: "🔽", + arrow_forward: "▶️", + arrow_heading_down: "⤵️", + arrow_heading_up: "⤴️", + arrow_left: "⬅️", + arrow_lower_left: "↙️", + arrow_lower_right: "↘️", + arrow_right: "➡️", + arrow_right_hook: "↪️", + arrow_up: "⬆️", + arrow_up_down: "↕️", + arrow_up_small: "🔼", + arrow_upper_left: "↖️", + arrow_upper_right: "↗️", + arrows_clockwise: "🔃", + arrows_counterclockwise: "🔄", + art: "🎨", + articulated_lorry: "🚛", + artificial_satellite: "🛰", + astonished: "😲", + athletic_shoe: "👟", + atm: "🏧", + atom_symbol: "⚛️", + avocado: "🥑", + b: "🅱️", + baby: "👶", + baby_bottle: "🍼", + baby_chick: "🐤", + baby_symbol: "🚼", + back: "🔙", + bacon: "🥓", + badminton: "🏸", + baggage_claim: "🛄", + baguette_bread: "🥖", + balance_scale: "⚖️", + balloon: "🎈", + ballot_box: "🗳", + ballot_box_with_check: "☑️", + bamboo: "🎍", + banana: "🍌", + bangbang: "‼️", + bank: "🏦", + bar_chart: "📊", + barber: "💈", + baseball: "⚾️", + basketball: "🏀", + basketball_man: "⛹️", + basketball_woman: "⛹️‍♀️", + bat: "🦇", + bath: "🛀", + bathtub: "🛁", + battery: "🔋", + beach_umbrella: "🏖", + bear: "🐻", + bed: "🛏", + bee: "🐝", + beer: "🍺", + beers: "🍻", + beetle: "🐞", + beginner: "🔰", + bell: "🔔", + bellhop_bell: "🛎", + bento: "🍱", + biking_man: "🚴", + bike: "🚲", + biking_woman: "🚴‍♀️", + bikini: "👙", + biohazard: "☣️", + bird: "🐦", + birthday: "🎂", + black_circle: "⚫️", + black_flag: "🏴", + black_heart: "🖤", + black_joker: "🃏", + black_large_square: "⬛️", + black_medium_small_square: "◾️", + black_medium_square: "◼️", + black_nib: "✒️", + black_small_square: "▪️", + black_square_button: "🔲", + blonde_man: "👱", + blonde_woman: "👱‍♀️", + blossom: "🌼", + blowfish: "🐡", + blue_book: "📘", + blue_car: "🚙", + blue_heart: "💙", + blush: "😊", + boar: "🐗", + boat: "⛵️", + bomb: "💣", + book: "📖", + bookmark: "🔖", + bookmark_tabs: "📑", + books: "📚", + boom: "💥", + boot: "👢", + bouquet: "💐", + bowing_man: "🙇", + bow_and_arrow: "🏹", + bowing_woman: "🙇‍♀️", + bowling: "🎳", + boxing_glove: "🥊", + boy: "👦", + bread: "🍞", + bride_with_veil: "👰", + bridge_at_night: "🌉", + briefcase: "💼", + broken_heart: "💔", + bug: "🐛", + building_construction: "🏗", + bulb: "💡", + bullettrain_front: "🚅", + bullettrain_side: "🚄", + burrito: "🌯", + bus: "🚌", + business_suit_levitating: "🕴", + busstop: "🚏", + bust_in_silhouette: "👤", + busts_in_silhouette: "👥", + butterfly: "🦋", + cactus: "🌵", + cake: "🍰", + calendar: "📆", + call_me_hand: "🤙", + calling: "📲", + camel: "🐫", + camera: "📷", + camera_flash: "📸", + camping: "🏕", + cancer: "♋️", + candle: "🕯", + candy: "🍬", + canoe: "🛶", + capital_abcd: "🔠", + capricorn: "♑️", + car: "🚗", + card_file_box: "🗃", + card_index: "📇", + card_index_dividers: "🗂", + carousel_horse: "🎠", + carrot: "🥕", + cat: "🐱", + cat2: "🐈", + cd: "💿", + chains: "⛓", + champagne: "🍾", + chart: "💹", + chart_with_downwards_trend: "📉", + chart_with_upwards_trend: "📈", + checkered_flag: "🏁", + cheese: "🧀", + cherries: "🍒", + cherry_blossom: "🌸", + chestnut: "🌰", + chicken: "🐔", + children_crossing: "🚸", + chipmunk: "🐿", + chocolate_bar: "🍫", + christmas_tree: "🎄", + church: "⛪️", + cinema: "🎦", + circus_tent: "🎪", + city_sunrise: "🌇", + city_sunset: "🌆", + cityscape: "🏙", + cl: "🆑", + clamp: "🗜", + clap: "👏", + clapper: "🎬", + classical_building: "🏛", + clinking_glasses: "🥂", + clipboard: "📋", + clock1: "🕐", + clock10: "🕙", + clock1030: "🕥", + clock11: "🕚", + clock1130: "🕦", + clock12: "🕛", + clock1230: "🕧", + clock130: "🕜", + clock2: "🕑", + clock230: "🕝", + clock3: "🕒", + clock330: "🕞", + clock4: "🕓", + clock430: "🕟", + clock5: "🕔", + clock530: "🕠", + clock6: "🕕", + clock630: "🕡", + clock7: "🕖", + clock730: "🕢", + clock8: "🕗", + clock830: "🕣", + clock9: "🕘", + clock930: "🕤", + closed_book: "📕", + closed_lock_with_key: "🔐", + closed_umbrella: "🌂", + cloud: "☁️", + cloud_with_lightning: "🌩", + cloud_with_lightning_and_rain: "⛈", + cloud_with_rain: "🌧", + cloud_with_snow: "🌨", + clown_face: "🤡", + clubs: "♣️", + cocktail: "🍸", + coffee: "☕️", + coffin: "⚰️", + cold_sweat: "😰", + comet: "☄️", + computer: "💻", + computer_mouse: "🖱", + confetti_ball: "🎊", + confounded: "😖", + confused: "😕", + congratulations: "㊗️", + construction: "🚧", + construction_worker_man: "👷", + construction_worker_woman: "👷‍♀️", + control_knobs: "🎛", + convenience_store: "🏪", + cookie: "🍪", + cool: "🆒", + policeman: "👮", + copyright: "©️", + corn: "🌽", + couch_and_lamp: "🛋", + couple: "👫", + couple_with_heart_woman_man: "💑", + couple_with_heart_man_man: "👨‍❤️‍👨", + couple_with_heart_woman_woman: "👩‍❤️‍👩", + couplekiss_man_man: "👨‍❤️‍💋‍👨", + couplekiss_man_woman: "💏", + couplekiss_woman_woman: "👩‍❤️‍💋‍👩", + cow: "🐮", + cow2: "🐄", + cowboy_hat_face: "🤠", + crab: "🦀", + crayon: "🖍", + credit_card: "💳", + crescent_moon: "🌙", + cricket: "🏏", + crocodile: "🐊", + croissant: "🥐", + crossed_fingers: "🤞", + crossed_flags: "🎌", + crossed_swords: "⚔️", + crown: "👑", + cry: "😢", + crying_cat_face: "😿", + crystal_ball: "🔮", + cucumber: "🥒", + cupid: "💘", + curly_loop: "➰", + currency_exchange: "💱", + curry: "🍛", + custard: "🍮", + customs: "🛃", + cyclone: "🌀", + dagger: "🗡", + dancer: "💃", + dancing_women: "👯", + dancing_men: "👯‍♂️", + dango: "🍡", + dark_sunglasses: "🕶", + dart: "🎯", + dash: "💨", + date: "📅", + deciduous_tree: "🌳", + deer: "🦌", + department_store: "🏬", + derelict_house: "🏚", + desert: "🏜", + desert_island: "🏝", + desktop_computer: "🖥", + male_detective: "🕵️", + diamond_shape_with_a_dot_inside: "💠", + diamonds: "♦️", + disappointed: "😞", + disappointed_relieved: "😥", + dizzy: "💫", + dizzy_face: "😵", + do_not_litter: "🚯", + dog: "🐶", + dog2: "🐕", + dollar: "💵", + dolls: "🎎", + dolphin: "🐬", + door: "🚪", + doughnut: "🍩", + dove: "🕊", + dragon: "🐉", + dragon_face: "🐲", + dress: "👗", + dromedary_camel: "🐪", + drooling_face: "🤤", + droplet: "💧", + drum: "🥁", + duck: "🦆", + dvd: "📀", + "e-mail": "📧", + eagle: "🦅", + ear: "👂", + ear_of_rice: "🌾", + earth_africa: "🌍", + earth_americas: "🌎", + earth_asia: "🌏", + egg: "🥚", + eggplant: "🍆", + eight_pointed_black_star: "✴️", + eight_spoked_asterisk: "✳️", + electric_plug: "🔌", + elephant: "🐘", + email: "✉️", + end: "🔚", + envelope_with_arrow: "📩", + euro: "💶", + european_castle: "🏰", + european_post_office: "🏤", + evergreen_tree: "🌲", + exclamation: "❗️", + expressionless: "😑", + eye: "👁", + eye_speech_bubble: "👁‍🗨", + eyeglasses: "👓", + eyes: "👀", + face_with_head_bandage: "🤕", + face_with_thermometer: "🤒", + fist_oncoming: "👊", + factory: "🏭", + fallen_leaf: "🍂", + family_man_woman_boy: "👪", + family_man_boy: "👨‍👦", + family_man_boy_boy: "👨‍👦‍👦", + family_man_girl: "👨‍👧", + family_man_girl_boy: "👨‍👧‍👦", + family_man_girl_girl: "👨‍👧‍👧", + family_man_man_boy: "👨‍👨‍👦", + family_man_man_boy_boy: "👨‍👨‍👦‍👦", + family_man_man_girl: "👨‍👨‍👧", + family_man_man_girl_boy: "👨‍👨‍👧‍👦", + family_man_man_girl_girl: "👨‍👨‍👧‍👧", + family_man_woman_boy_boy: "👨‍👩‍👦‍👦", + family_man_woman_girl: "👨‍👩‍👧", + family_man_woman_girl_boy: "👨‍👩‍👧‍👦", + family_man_woman_girl_girl: "👨‍👩‍👧‍👧", + family_woman_boy: "👩‍👦", + family_woman_boy_boy: "👩‍👦‍👦", + family_woman_girl: "👩‍👧", + family_woman_girl_boy: "👩‍👧‍👦", + family_woman_girl_girl: "👩‍👧‍👧", + family_woman_woman_boy: "👩‍👩‍👦", + family_woman_woman_boy_boy: "👩‍👩‍👦‍👦", + family_woman_woman_girl: "👩‍👩‍👧", + family_woman_woman_girl_boy: "👩‍👩‍👧‍👦", + family_woman_woman_girl_girl: "👩‍👩‍👧‍👧", + fast_forward: "⏩", + fax: "📠", + fearful: "😨", + feet: "🐾", + female_detective: "🕵️‍♀️", + ferris_wheel: "🎡", + ferry: "⛴", + field_hockey: "🏑", + file_cabinet: "🗄", + file_folder: "📁", + film_projector: "📽", + film_strip: "🎞", + fire: "🔥", + fire_engine: "🚒", + fireworks: "🎆", + first_quarter_moon: "🌓", + first_quarter_moon_with_face: "🌛", + fish: "🐟", + fish_cake: "🍥", + fishing_pole_and_fish: "🎣", + fist_raised: "✊", + fist_left: "🤛", + fist_right: "🤜", + flags: "🎏", + flashlight: "🔦", + fleur_de_lis: "⚜️", + flight_arrival: "🛬", + flight_departure: "🛫", + floppy_disk: "💾", + flower_playing_cards: "🎴", + flushed: "😳", + fog: "🌫", + foggy: "🌁", + football: "🏈", + footprints: "👣", + fork_and_knife: "🍴", + fountain: "⛲️", + fountain_pen: "🖋", + four_leaf_clover: "🍀", + fox_face: "🦊", + framed_picture: "🖼", + free: "🆓", + fried_egg: "🍳", + fried_shrimp: "🍤", + fries: "🍟", + frog: "🐸", + frowning: "😦", + frowning_face: "☹️", + frowning_man: "🙍‍♂️", + frowning_woman: "🙍", + middle_finger: "🖕", + fuelpump: "⛽️", + full_moon: "🌕", + full_moon_with_face: "🌝", + funeral_urn: "⚱️", + game_die: "🎲", + gear: "⚙️", + gem: "💎", + gemini: "♊️", + ghost: "👻", + gift: "🎁", + gift_heart: "💝", + girl: "👧", + globe_with_meridians: "🌐", + goal_net: "🥅", + goat: "🐐", + golf: "⛳️", + golfing_man: "🏌️", + golfing_woman: "🏌️‍♀️", + gorilla: "🦍", + grapes: "🍇", + green_apple: "🍏", + green_book: "📗", + green_heart: "💚", + green_salad: "🥗", + grey_exclamation: "❕", + grey_question: "❔", + grimacing: "😬", + grin: "😁", + grinning: "😀", + guardsman: "💂", + guardswoman: "💂‍♀️", + guitar: "🎸", + gun: "🔫", + haircut_woman: "💇", + haircut_man: "💇‍♂️", + hamburger: "🍔", + hammer: "🔨", + hammer_and_pick: "⚒", + hammer_and_wrench: "🛠", + hamster: "🐹", + hand: "✋", + handbag: "👜", + handshake: "🤝", + hankey: "💩", + hatched_chick: "🐥", + hatching_chick: "🐣", + headphones: "🎧", + hear_no_evil: "🙉", + heart: "❤️", + heart_decoration: "💟", + heart_eyes: "😍", + heart_eyes_cat: "😻", + heartbeat: "💓", + heartpulse: "💗", + hearts: "♥️", + heavy_check_mark: "✔️", + heavy_division_sign: "➗", + heavy_dollar_sign: "💲", + heavy_heart_exclamation: "❣️", + heavy_minus_sign: "➖", + heavy_multiplication_x: "✖️", + heavy_plus_sign: "➕", + helicopter: "🚁", + herb: "🌿", + hibiscus: "🌺", + high_brightness: "🔆", + high_heel: "👠", + hocho: "🔪", + hole: "🕳", + honey_pot: "🍯", + horse: "🐴", + horse_racing: "🏇", + hospital: "🏥", + hot_pepper: "🌶", + hotdog: "🌭", + hotel: "🏨", + hotsprings: "♨️", + hourglass: "⌛️", + hourglass_flowing_sand: "⏳", + house: "🏠", + house_with_garden: "🏡", + houses: "🏘", + hugs: "🤗", + hushed: "😯", + ice_cream: "🍨", + ice_hockey: "🏒", + ice_skate: "⛸", + icecream: "🍦", + id: "🆔", + ideograph_advantage: "🉐", + imp: "👿", + inbox_tray: "📥", + incoming_envelope: "📨", + tipping_hand_woman: "💁", + information_source: "ℹ️", + innocent: "😇", + interrobang: "⁉️", + iphone: "📱", + izakaya_lantern: "🏮", + jack_o_lantern: "🎃", + japan: "🗾", + japanese_castle: "🏯", + japanese_goblin: "👺", + japanese_ogre: "👹", + jeans: "👖", + joy: "😂", + joy_cat: "😹", + joystick: "🕹", + kaaba: "🕋", + key: "🔑", + keyboard: "⌨️", + keycap_ten: "🔟", + kick_scooter: "🛴", + kimono: "👘", + kiss: "💋", + kissing: "😗", + kissing_cat: "😽", + kissing_closed_eyes: "😚", + kissing_heart: "😘", + kissing_smiling_eyes: "😙", + kiwi_fruit: "🥝", + koala: "🐨", + koko: "🈁", + label: "🏷", + large_blue_circle: "🔵", + large_blue_diamond: "🔷", + large_orange_diamond: "🔶", + last_quarter_moon: "🌗", + last_quarter_moon_with_face: "🌜", + latin_cross: "✝️", + laughing: "😆", + leaves: "🍃", + ledger: "📒", + left_luggage: "🛅", + left_right_arrow: "↔️", + leftwards_arrow_with_hook: "↩️", + lemon: "🍋", + leo: "♌️", + leopard: "🐆", + level_slider: "🎚", + libra: "♎️", + light_rail: "🚈", + link: "🔗", + lion: "🦁", + lips: "👄", + lipstick: "💄", + lizard: "🦎", + lock: "🔒", + lock_with_ink_pen: "🔏", + lollipop: "🍭", + loop: "➿", + loud_sound: "🔊", + loudspeaker: "📢", + love_hotel: "🏩", + love_letter: "💌", + low_brightness: "🔅", + lying_face: "🤥", + m: "Ⓜ️", + mag: "🔍", + mag_right: "🔎", + mahjong: "🀄️", + mailbox: "📫", + mailbox_closed: "📪", + mailbox_with_mail: "📬", + mailbox_with_no_mail: "📭", + man: "👨", + man_artist: "👨‍🎨", + man_astronaut: "👨‍🚀", + man_cartwheeling: "🤸‍♂️", + man_cook: "👨‍🍳", + man_dancing: "🕺", + man_facepalming: "🤦‍♂️", + man_factory_worker: "👨‍🏭", + man_farmer: "👨‍🌾", + man_firefighter: "👨‍🚒", + man_health_worker: "👨‍⚕️", + man_in_tuxedo: "🤵", + man_judge: "👨‍⚖️", + man_juggling: "🤹‍♂️", + man_mechanic: "👨‍🔧", + man_office_worker: "👨‍💼", + man_pilot: "👨‍✈️", + man_playing_handball: "🤾‍♂️", + man_playing_water_polo: "🤽‍♂️", + man_scientist: "👨‍🔬", + man_shrugging: "🤷‍♂️", + man_singer: "👨‍🎤", + man_student: "👨‍🎓", + man_teacher: "👨‍🏫", + man_technologist: "👨‍💻", + man_with_gua_pi_mao: "👲", + man_with_turban: "👳", + tangerine: "🍊", + mans_shoe: "👞", + mantelpiece_clock: "🕰", + maple_leaf: "🍁", + martial_arts_uniform: "🥋", + mask: "😷", + massage_woman: "💆", + massage_man: "💆‍♂️", + meat_on_bone: "🍖", + medal_military: "🎖", + medal_sports: "🏅", + mega: "📣", + melon: "🍈", + memo: "📝", + men_wrestling: "🤼‍♂️", + menorah: "🕎", + mens: "🚹", + metal: "🤘", + metro: "🚇", + microphone: "🎤", + microscope: "🔬", + milk_glass: "🥛", + milky_way: "🌌", + minibus: "🚐", + minidisc: "💽", + mobile_phone_off: "📴", + money_mouth_face: "🤑", + money_with_wings: "💸", + moneybag: "💰", + monkey: "🐒", + monkey_face: "🐵", + monorail: "🚝", + moon: "🌔", + mortar_board: "🎓", + mosque: "🕌", + motor_boat: "🛥", + motor_scooter: "🛵", + motorcycle: "🏍", + motorway: "🛣", + mount_fuji: "🗻", + mountain: "⛰", + mountain_biking_man: "🚵", + mountain_biking_woman: "🚵‍♀️", + mountain_cableway: "🚠", + mountain_railway: "🚞", + mountain_snow: "🏔", + mouse: "🐭", + mouse2: "🐁", + movie_camera: "🎥", + moyai: "🗿", + mrs_claus: "🤶", + muscle: "💪", + mushroom: "🍄", + musical_keyboard: "🎹", + musical_note: "🎵", + musical_score: "🎼", + mute: "🔇", + nail_care: "💅", + name_badge: "📛", + national_park: "🏞", + nauseated_face: "🤢", + necktie: "👔", + negative_squared_cross_mark: "❎", + nerd_face: "🤓", + neutral_face: "😐", + new: "🆕", + new_moon: "🌑", + new_moon_with_face: "🌚", + newspaper: "📰", + newspaper_roll: "🗞", + next_track_button: "⏭", + ng: "🆖", + no_good_man: "🙅‍♂️", + no_good_woman: "🙅", + night_with_stars: "🌃", + no_bell: "🔕", + no_bicycles: "🚳", + no_entry: "⛔️", + no_entry_sign: "🚫", + no_mobile_phones: "📵", + no_mouth: "😶", + no_pedestrians: "🚷", + no_smoking: "🚭", + "non-potable_water": "🚱", + nose: "👃", + notebook: "📓", + notebook_with_decorative_cover: "📔", + notes: "🎶", + nut_and_bolt: "🔩", + o: "⭕️", + o2: "🅾️", + ocean: "🌊", + octopus: "🐙", + oden: "🍢", + office: "🏢", + oil_drum: "🛢", + ok: "🆗", + ok_hand: "👌", + ok_man: "🙆‍♂️", + ok_woman: "🙆", + old_key: "🗝", + older_man: "👴", + older_woman: "👵", + om: "🕉", + on: "🔛", + oncoming_automobile: "🚘", + oncoming_bus: "🚍", + oncoming_police_car: "🚔", + oncoming_taxi: "🚖", + open_file_folder: "📂", + open_hands: "👐", + open_mouth: "😮", + open_umbrella: "☂️", + ophiuchus: "⛎", + orange_book: "📙", + orthodox_cross: "☦️", + outbox_tray: "📤", + owl: "🦉", + ox: "🐂", + package: "📦", + page_facing_up: "📄", + page_with_curl: "📃", + pager: "📟", + paintbrush: "🖌", + palm_tree: "🌴", + pancakes: "🥞", + panda_face: "🐼", + paperclip: "📎", + paperclips: "🖇", + parasol_on_ground: "⛱", + parking: "🅿️", + part_alternation_mark: "〽️", + partly_sunny: "⛅️", + passenger_ship: "🛳", + passport_control: "🛂", + pause_button: "⏸", + peace_symbol: "☮️", + peach: "🍑", + peanuts: "🥜", + pear: "🍐", + pen: "🖊", + pencil2: "✏️", + penguin: "🐧", + pensive: "😔", + performing_arts: "🎭", + persevere: "😣", + person_fencing: "🤺", + pouting_woman: "🙎", + phone: "☎️", + pick: "⛏", + pig: "🐷", + pig2: "🐖", + pig_nose: "🐽", + pill: "💊", + pineapple: "🍍", + ping_pong: "🏓", + pisces: "♓️", + pizza: "🍕", + place_of_worship: "🛐", + plate_with_cutlery: "🍽", + play_or_pause_button: "⏯", + point_down: "👇", + point_left: "👈", + point_right: "👉", + point_up: "☝️", + point_up_2: "👆", + police_car: "🚓", + policewoman: "👮‍♀️", + poodle: "🐩", + popcorn: "🍿", + post_office: "🏣", + postal_horn: "📯", + postbox: "📮", + potable_water: "🚰", + potato: "🥔", + pouch: "👝", + poultry_leg: "🍗", + pound: "💷", + rage: "😡", + pouting_cat: "😾", + pouting_man: "🙎‍♂️", + pray: "🙏", + prayer_beads: "📿", + pregnant_woman: "🤰", + previous_track_button: "⏮", + prince: "🤴", + princess: "👸", + printer: "🖨", + purple_heart: "💜", + purse: "👛", + pushpin: "📌", + put_litter_in_its_place: "🚮", + question: "❓", + rabbit: "🐰", + rabbit2: "🐇", + racehorse: "🐎", + racing_car: "🏎", + radio: "📻", + radio_button: "🔘", + radioactive: "☢️", + railway_car: "🚃", + railway_track: "🛤", + rainbow: "🌈", + rainbow_flag: "🏳️‍🌈", + raised_back_of_hand: "🤚", + raised_hand_with_fingers_splayed: "🖐", + raised_hands: "🙌", + raising_hand_woman: "🙋", + raising_hand_man: "🙋‍♂️", + ram: "🐏", + ramen: "🍜", + rat: "🐀", + record_button: "⏺", + recycle: "♻️", + red_circle: "🔴", + registered: "®️", + relaxed: "☺️", + relieved: "😌", + reminder_ribbon: "🎗", + repeat: "🔁", + repeat_one: "🔂", + rescue_worker_helmet: "⛑", + restroom: "🚻", + revolving_hearts: "💞", + rewind: "⏪", + rhinoceros: "🦏", + ribbon: "🎀", + rice: "🍚", + rice_ball: "🍙", + rice_cracker: "🍘", + rice_scene: "🎑", + right_anger_bubble: "🗯", + ring: "💍", + robot: "🤖", + rocket: "🚀", + rofl: "🤣", + roll_eyes: "🙄", + roller_coaster: "🎢", + rooster: "🐓", + rose: "🌹", + rosette: "🏵", + rotating_light: "🚨", + round_pushpin: "📍", + rowing_man: "🚣", + rowing_woman: "🚣‍♀️", + rugby_football: "🏉", + running_man: "🏃", + running_shirt_with_sash: "🎽", + running_woman: "🏃‍♀️", + sa: "🈂️", + sagittarius: "♐️", + sake: "🍶", + sandal: "👡", + santa: "🎅", + satellite: "📡", + saxophone: "🎷", + school: "🏫", + school_satchel: "🎒", + scissors: "✂️", + scorpion: "🦂", + scorpius: "♏️", + scream: "😱", + scream_cat: "🙀", + scroll: "📜", + seat: "💺", + secret: "㊙️", + see_no_evil: "🙈", + seedling: "🌱", + selfie: "🤳", + shallow_pan_of_food: "🥘", + shamrock: "☘️", + shark: "🦈", + shaved_ice: "🍧", + sheep: "🐑", + shell: "🐚", + shield: "🛡", + shinto_shrine: "⛩", + ship: "🚢", + shirt: "👕", + shopping: "🛍", + shopping_cart: "🛒", + shower: "🚿", + shrimp: "🦐", + signal_strength: "📶", + six_pointed_star: "🔯", + ski: "🎿", + skier: "⛷", + skull: "💀", + skull_and_crossbones: "☠️", + sleeping: "😴", + sleeping_bed: "🛌", + sleepy: "😪", + slightly_frowning_face: "🙁", + slightly_smiling_face: "🙂", + slot_machine: "🎰", + small_airplane: "🛩", + small_blue_diamond: "🔹", + small_orange_diamond: "🔸", + small_red_triangle: "🔺", + small_red_triangle_down: "🔻", + smile: "😄", + smile_cat: "😸", + smiley: "😃", + smiley_cat: "😺", + smiling_imp: "😈", + smirk: "😏", + smirk_cat: "😼", + smoking: "🚬", + snail: "🐌", + snake: "🐍", + sneezing_face: "🤧", + snowboarder: "🏂", + snowflake: "❄️", + snowman: "⛄️", + snowman_with_snow: "☃️", + sob: "😭", + soccer: "⚽️", + soon: "🔜", + sos: "🆘", + sound: "🔉", + space_invader: "👾", + spades: "♠️", + spaghetti: "🍝", + sparkle: "❇️", + sparkler: "🎇", + sparkles: "✨", + sparkling_heart: "💖", + speak_no_evil: "🙊", + speaker: "🔈", + speaking_head: "🗣", + speech_balloon: "💬", + speedboat: "🚤", + spider: "🕷", + spider_web: "🕸", + spiral_calendar: "🗓", + spiral_notepad: "🗒", + spoon: "🥄", + squid: "🦑", + stadium: "🏟", + star: "⭐️", + star2: "🌟", + star_and_crescent: "☪️", + star_of_david: "✡️", + stars: "🌠", + station: "🚉", + statue_of_liberty: "🗽", + steam_locomotive: "🚂", + stew: "🍲", + stop_button: "⏹", + stop_sign: "🛑", + stopwatch: "⏱", + straight_ruler: "📏", + strawberry: "🍓", + stuck_out_tongue: "😛", + stuck_out_tongue_closed_eyes: "😝", + stuck_out_tongue_winking_eye: "😜", + studio_microphone: "🎙", + stuffed_flatbread: "🥙", + sun_behind_large_cloud: "🌥", + sun_behind_rain_cloud: "🌦", + sun_behind_small_cloud: "🌤", + sun_with_face: "🌞", + sunflower: "🌻", + sunglasses: "😎", + sunny: "☀️", + sunrise: "🌅", + sunrise_over_mountains: "🌄", + surfing_man: "🏄", + surfing_woman: "🏄‍♀️", + sushi: "🍣", + suspension_railway: "🚟", + sweat: "😓", + sweat_drops: "💦", + sweat_smile: "😅", + sweet_potato: "🍠", + swimming_man: "🏊", + swimming_woman: "🏊‍♀️", + symbols: "🔣", + synagogue: "🕍", + syringe: "💉", + taco: "🌮", + tada: "🎉", + tanabata_tree: "🎋", + taurus: "♉️", + taxi: "🚕", + tea: "🍵", + telephone_receiver: "📞", + telescope: "🔭", + tennis: "🎾", + tent: "⛺️", + thermometer: "🌡", + thinking: "🤔", + thought_balloon: "💭", + ticket: "🎫", + tickets: "🎟", + tiger: "🐯", + tiger2: "🐅", + timer_clock: "⏲", + tipping_hand_man: "💁‍♂️", + tired_face: "😫", + tm: "™️", + toilet: "🚽", + tokyo_tower: "🗼", + tomato: "🍅", + tongue: "👅", + top: "🔝", + tophat: "🎩", + tornado: "🌪", + trackball: "🖲", + tractor: "🚜", + traffic_light: "🚥", + train: "🚋", + train2: "🚆", + tram: "🚊", + triangular_flag_on_post: "🚩", + triangular_ruler: "📐", + trident: "🔱", + triumph: "😤", + trolleybus: "🚎", + trophy: "🏆", + tropical_drink: "🍹", + tropical_fish: "🐠", + truck: "🚚", + trumpet: "🎺", + tulip: "🌷", + tumbler_glass: "🥃", + turkey: "🦃", + turtle: "🐢", + tv: "📺", + twisted_rightwards_arrows: "🔀", + two_hearts: "💕", + two_men_holding_hands: "👬", + two_women_holding_hands: "👭", + u5272: "🈹", + u5408: "🈴", + u55b6: "🈺", + u6307: "🈯️", + u6708: "🈷️", + u6709: "🈶", + u6e80: "🈵", + u7121: "🈚️", + u7533: "🈸", + u7981: "🈲", + u7a7a: "🈳", + umbrella: "☔️", + unamused: "😒", + underage: "🔞", + unicorn: "🦄", + unlock: "🔓", + up: "🆙", + upside_down_face: "🙃", + v: "✌️", + vertical_traffic_light: "🚦", + vhs: "📼", + vibration_mode: "📳", + video_camera: "📹", + video_game: "🎮", + violin: "🎻", + virgo: "♍️", + volcano: "🌋", + volleyball: "🏐", + vs: "🆚", + vulcan_salute: "🖖", + walking_man: "🚶", + walking_woman: "🚶‍♀️", + waning_crescent_moon: "🌘", + waning_gibbous_moon: "🌖", + warning: "⚠️", + wastebasket: "🗑", + watch: "⌚️", + water_buffalo: "🐃", + watermelon: "🍉", + wave: "👋", + wavy_dash: "〰️", + waxing_crescent_moon: "🌒", + wc: "🚾", + weary: "😩", + wedding: "💒", + weight_lifting_man: "🏋️", + weight_lifting_woman: "🏋️‍♀️", + whale: "🐳", + whale2: "🐋", + wheel_of_dharma: "☸️", + wheelchair: "♿️", + white_check_mark: "✅", + white_circle: "⚪️", + white_flag: "🏳️", + white_flower: "💮", + white_large_square: "⬜️", + white_medium_small_square: "◽️", + white_medium_square: "◻️", + white_small_square: "▫️", + white_square_button: "🔳", + wilted_flower: "🥀", + wind_chime: "🎐", + wind_face: "🌬", + wine_glass: "🍷", + wink: "😉", + wolf: "🐺", + woman: "👩", + woman_artist: "👩‍🎨", + woman_astronaut: "👩‍🚀", + woman_cartwheeling: "🤸‍♀️", + woman_cook: "👩‍🍳", + woman_facepalming: "🤦‍♀️", + woman_factory_worker: "👩‍🏭", + woman_farmer: "👩‍🌾", + woman_firefighter: "👩‍🚒", + woman_health_worker: "👩‍⚕️", + woman_judge: "👩‍⚖️", + woman_juggling: "🤹‍♀️", + woman_mechanic: "👩‍🔧", + woman_office_worker: "👩‍💼", + woman_pilot: "👩‍✈️", + woman_playing_handball: "🤾‍♀️", + woman_playing_water_polo: "🤽‍♀️", + woman_scientist: "👩‍🔬", + woman_shrugging: "🤷‍♀️", + woman_singer: "👩‍🎤", + woman_student: "👩‍🎓", + woman_teacher: "👩‍🏫", + woman_technologist: "👩‍💻", + woman_with_turban: "👳‍♀️", + womans_clothes: "👚", + womans_hat: "👒", + women_wrestling: "🤼‍♀️", + womens: "🚺", + world_map: "🗺", + worried: "😟", + wrench: "🔧", + writing_hand: "✍️", + x: "❌", + yellow_heart: "💛", + yen: "💴", + yin_yang: "☯️", + yum: "😋", + zap: "⚡️", + zipper_mouth_face: "🤐", + zzz: "💤", + /* special emojis :P */ + octocat: ':octocat:', + showdown: `S` + }, a.Converter = function(r) { + var s = {}, o = [], c = [], u = {}, m = b, p = { + parsed: {}, + raw: "", + format: "" + }; + j(); + function j() { + r = r || {}; + for (var g in f) + f.hasOwnProperty(g) && (s[g] = f[g]); + if (typeof r == "object") + for (var H in r) + r.hasOwnProperty(H) && (s[H] = r[H]); + else + throw Error("Converter expects the passed parameter to be an object, but " + typeof r + " was passed instead."); + s.extensions && a.helper.forEach(s.extensions, V); + } + function V(g, H) { + if (H = H || null, a.helper.isString(g)) + if (g = a.helper.stdExtName(g), H = g, a.extensions[g]) { + console.warn("DEPRECATION WARNING: " + g + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), F(a.extensions[g], g); + return; + } else if (!a.helper.isUndefined(l[g])) + g = l[g]; + else + throw Error('Extension "' + g + '" could not be loaded. It was either not found or is not a valid extension.'); + typeof g == "function" && (g = g()), a.helper.isArray(g) || (g = [g]); + var W = _(g, H); + if (!W.valid) + throw Error(W.error); + for (var J = 0; J < g.length; ++J) { + switch (g[J].type) { + case "lang": + o.push(g[J]); + break; + case "output": + c.push(g[J]); + break; + } + if (g[J].hasOwnProperty("listeners")) + for (var U in g[J].listeners) + g[J].listeners.hasOwnProperty(U) && D(U, g[J].listeners[U]); + } + } + function F(g, H) { + typeof g == "function" && (g = g(new a.Converter())), a.helper.isArray(g) || (g = [g]); + var W = _(g, H); + if (!W.valid) + throw Error(W.error); + for (var J = 0; J < g.length; ++J) + switch (g[J].type) { + case "lang": + o.push(g[J]); + break; + case "output": + c.push(g[J]); + break; + default: + throw Error("Extension loader error: Type unrecognized!!!"); + } + } + function D(g, H) { + if (!a.helper.isString(g)) + throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof g + " given"); + if (typeof H != "function") + throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof H + " given"); + u.hasOwnProperty(g) || (u[g] = []), u[g].push(H); + } + function q(g) { + var H = g.match(/^\s*/)[0].length, W = new RegExp("^\\s{0," + H + "}", "gm"); + return g.replace(W, ""); + } + this._dispatch = function(g, H, W, J) { + if (u.hasOwnProperty(g)) + for (var U = 0; U < u[g].length; ++U) { + var P = u[g][U](g, H, this, W, J); + P && typeof P < "u" && (H = P); + } + return H; + }, this.listen = function(g, H) { + return D(g, H), this; + }, this.makeHtml = function(g) { + if (!g) + return g; + var H = { + gHtmlBlocks: [], + gHtmlMdBlocks: [], + gHtmlSpans: [], + gUrls: {}, + gTitles: {}, + gDimensions: {}, + gListLevel: 0, + hashLinkCounts: {}, + langExtensions: o, + outputModifiers: c, + converter: this, + ghCodeBlocks: [], + metadata: { + parsed: {}, + raw: "", + format: "" + } + }; + return g = g.replace(/¨/g, "¨T"), g = g.replace(/\$/g, "¨D"), g = g.replace(/\r\n/g, ` +`), g = g.replace(/\r/g, ` +`), g = g.replace(/\u00A0/g, " "), s.smartIndentationFix && (g = q(g)), g = ` + +` + g + ` + +`, g = a.subParser("detab")(g, s, H), g = g.replace(/^[ \t]+$/mg, ""), a.helper.forEach(o, function(W) { + g = a.subParser("runExtension")(W, g, s, H); + }), g = a.subParser("metadata")(g, s, H), g = a.subParser("hashPreCodeTags")(g, s, H), g = a.subParser("githubCodeBlocks")(g, s, H), g = a.subParser("hashHTMLBlocks")(g, s, H), g = a.subParser("hashCodeTags")(g, s, H), g = a.subParser("stripLinkDefinitions")(g, s, H), g = a.subParser("blockGamut")(g, s, H), g = a.subParser("unhashHTMLSpans")(g, s, H), g = a.subParser("unescapeSpecialChars")(g, s, H), g = g.replace(/¨D/g, "$$"), g = g.replace(/¨T/g, "¨"), g = a.subParser("completeHTMLDocument")(g, s, H), a.helper.forEach(c, function(W) { + g = a.subParser("runExtension")(W, g, s, H); + }), p = H.metadata, g; + }, this.makeMarkdown = this.makeMd = function(g, H) { + if (g = g.replace(/\r\n/g, ` +`), g = g.replace(/\r/g, ` +`), g = g.replace(/>[ \t]+¨NBSP;<"), !H) + if (window && window.document) + H = window.document; + else + throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM"); + var W = H.createElement("div"); + W.innerHTML = g; + var J = { + preList: d(W) + }; + N(W); + for (var U = W.childNodes, P = "", B = 0; B < U.length; B++) + P += a.subParser("makeMarkdown.node")(U[B], J); + function N(v) { + for (var I = 0; I < v.childNodes.length; ++I) { + var G = v.childNodes[I]; + G.nodeType === 3 ? !/\S/.test(G.nodeValue) && !/^[ ]+$/.test(G.nodeValue) ? (v.removeChild(G), --I) : (G.nodeValue = G.nodeValue.split(` +`).join(" "), G.nodeValue = G.nodeValue.replace(/(\s)+/g, "$1")) : G.nodeType === 1 && N(G); + } + } + function d(v) { + for (var I = v.querySelectorAll("pre"), G = [], K = 0; K < I.length; ++K) + if (I[K].childElementCount === 1 && I[K].firstChild.tagName.toLowerCase() === "code") { + var re = I[K].firstChild.innerHTML.trim(), ne = I[K].firstChild.getAttribute("data-language") || ""; + if (ne === "") + for (var fe = I[K].firstChild.className.split(" "), xe = 0; xe < fe.length; ++xe) { + var Xe = fe[xe].match(/^language-(.+)$/); + if (Xe !== null) { + ne = Xe[1]; + break; + } + } + re = a.helper.unescapeHTMLEntities(re), G.push(re), I[K].outerHTML = ''; + } else + G.push(I[K].innerHTML), I[K].innerHTML = "", I[K].setAttribute("prenum", K.toString()); + return G; + } + return P; + }, this.setOption = function(g, H) { + s[g] = H; + }, this.getOption = function(g) { + return s[g]; + }, this.getOptions = function() { + return s; + }, this.addExtension = function(g, H) { + H = H || null, V(g, H); + }, this.useExtension = function(g) { + V(g); + }, this.setFlavor = function(g) { + if (!k.hasOwnProperty(g)) + throw Error(g + " flavor was not found"); + var H = k[g]; + m = g; + for (var W in H) + H.hasOwnProperty(W) && (s[W] = H[W]); + }, this.getFlavor = function() { + return m; + }, this.removeExtension = function(g) { + a.helper.isArray(g) || (g = [g]); + for (var H = 0; H < g.length; ++H) { + for (var W = g[H], J = 0; J < o.length; ++J) + o[J] === W && o.splice(J, 1); + for (var U = 0; U < c.length; ++U) + c[U] === W && c.splice(U, 1); + } + }, this.getAllExtensions = function() { + return { + language: o, + output: c + }; + }, this.getMetadata = function(g) { + return g ? p.raw : p.parsed; + }, this.getMetadataFormat = function() { + return p.format; + }, this._setMetadataPair = function(g, H) { + p.parsed[g] = H; + }, this._setMetadataFormat = function(g) { + p.format = g; + }, this._setMetadataRaw = function(g) { + p.raw = g; + }; + }, a.subParser("anchors", function(r, s, o) { + r = o.converter._dispatch("anchors.before", r, s, o); + var c = function(u, m, p, j, V, F, D) { + if (a.helper.isUndefined(D) && (D = ""), p = p.toLowerCase(), u.search(/\(? ?(['"].*['"])?\)$/m) > -1) + j = ""; + else if (!j) + if (p || (p = m.toLowerCase().replace(/ ?\n/g, " ")), j = "#" + p, !a.helper.isUndefined(o.gUrls[p])) + j = o.gUrls[p], a.helper.isUndefined(o.gTitles[p]) || (D = o.gTitles[p]); + else + return u; + j = j.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var q = '", q; + }; + return r = r.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, c), r = r.replace( + /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, + c + ), r = r.replace( + /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, + c + ), r = r.replace(/\[([^\[\]]+)]()()()()()/g, c), s.ghMentions && (r = r.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(u, m, p, j, V) { + if (p === "\\") + return m + j; + if (!a.helper.isString(s.ghMentionsLink)) + throw new Error("ghMentionsLink option must be a string"); + var F = s.ghMentionsLink.replace(/\{u}/g, V), D = ""; + return s.openLinksInNewWindow && (D = ' rel="noopener noreferrer" target="¨E95Eblank"'), m + '" + j + ""; + })), r = o.converter._dispatch("anchors.after", r, s, o), r; + }); + var A = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, M = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, O = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, C = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, x = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, $ = function(r) { + return function(s, o, c, u, m, p, j) { + c = c.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var V = c, F = "", D = "", q = o || "", g = j || ""; + return /^www\./i.test(c) && (c = c.replace(/^www\./i, "http://www.")), r.excludeTrailingPunctuationFromURLs && p && (F = p), r.openLinksInNewWindow && (D = ' rel="noopener noreferrer" target="¨E95Eblank"'), q + '" + V + "" + F + g; + }; + }, T = function(r, s) { + return function(o, c, u) { + var m = "mailto:"; + return c = c || "", u = a.subParser("unescapeSpecialChars")(u, r, s), r.encodeEmails ? (m = a.helper.encodeEmailAddress(m + u), u = a.helper.encodeEmailAddress(u)) : m = m + u, c + '' + u + ""; + }; + }; + a.subParser("autoLinks", function(r, s, o) { + return r = o.converter._dispatch("autoLinks.before", r, s, o), r = r.replace(O, $(s)), r = r.replace(x, T(s, o)), r = o.converter._dispatch("autoLinks.after", r, s, o), r; + }), a.subParser("simplifiedAutoLinks", function(r, s, o) { + return s.simplifiedAutoLink && (r = o.converter._dispatch("simplifiedAutoLinks.before", r, s, o), s.excludeTrailingPunctuationFromURLs ? r = r.replace(M, $(s)) : r = r.replace(A, $(s)), r = r.replace(C, T(s, o)), r = o.converter._dispatch("simplifiedAutoLinks.after", r, s, o)), r; + }), a.subParser("blockGamut", function(r, s, o) { + return r = o.converter._dispatch("blockGamut.before", r, s, o), r = a.subParser("blockQuotes")(r, s, o), r = a.subParser("headers")(r, s, o), r = a.subParser("horizontalRule")(r, s, o), r = a.subParser("lists")(r, s, o), r = a.subParser("codeBlocks")(r, s, o), r = a.subParser("tables")(r, s, o), r = a.subParser("hashHTMLBlocks")(r, s, o), r = a.subParser("paragraphs")(r, s, o), r = o.converter._dispatch("blockGamut.after", r, s, o), r; + }), a.subParser("blockQuotes", function(r, s, o) { + r = o.converter._dispatch("blockQuotes.before", r, s, o), r = r + ` + +`; + var c = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; + return s.splitAdjacentBlockquotes && (c = /^ {0,3}>[\s\S]*?(?:\n\n)/gm), r = r.replace(c, function(u) { + return u = u.replace(/^[ \t]*>[ \t]?/gm, ""), u = u.replace(/¨0/g, ""), u = u.replace(/^[ \t]+$/gm, ""), u = a.subParser("githubCodeBlocks")(u, s, o), u = a.subParser("blockGamut")(u, s, o), u = u.replace(/(^|\n)/g, "$1 "), u = u.replace(/(\s*
[^\r]+?<\/pre>)/gm, function(m, p) {
+          var j = p;
+          return j = j.replace(/^  /mg, "¨0"), j = j.replace(/¨0/g, ""), j;
+        }), a.subParser("hashBlock")(`
+` + u + ` +
`, s, o); + }), r = o.converter._dispatch("blockQuotes.after", r, s, o), r; + }), a.subParser("codeBlocks", function(r, s, o) { + r = o.converter._dispatch("codeBlocks.before", r, s, o), r += "¨0"; + var c = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; + return r = r.replace(c, function(u, m, p) { + var j = m, V = p, F = ` +`; + return j = a.subParser("outdent")(j, s, o), j = a.subParser("encodeCode")(j, s, o), j = a.subParser("detab")(j, s, o), j = j.replace(/^\n+/g, ""), j = j.replace(/\n+$/g, ""), s.omitExtraWLInCodeBlocks && (F = ""), j = "
" + j + F + "
", a.subParser("hashBlock")(j, s, o) + V; + }), r = r.replace(/¨0/, ""), r = o.converter._dispatch("codeBlocks.after", r, s, o), r; + }), a.subParser("codeSpans", function(r, s, o) { + return r = o.converter._dispatch("codeSpans.before", r, s, o), typeof r > "u" && (r = ""), r = r.replace( + /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, + function(c, u, m, p) { + var j = p; + return j = j.replace(/^([ \t]*)/g, ""), j = j.replace(/[ \t]*$/g, ""), j = a.subParser("encodeCode")(j, s, o), j = u + "" + j + "", j = a.subParser("hashHTMLSpans")(j, s, o), j; + } + ), r = o.converter._dispatch("codeSpans.after", r, s, o), r; + }), a.subParser("completeHTMLDocument", function(r, s, o) { + if (!s.completeHTMLDocument) + return r; + r = o.converter._dispatch("completeHTMLDocument.before", r, s, o); + var c = "html", u = ` +`, m = "", p = ` +`, j = "", V = ""; + typeof o.metadata.parsed.doctype < "u" && (u = " +`, c = o.metadata.parsed.doctype.toString().toLowerCase(), (c === "html" || c === "html5") && (p = '')); + for (var F in o.metadata.parsed) + if (o.metadata.parsed.hasOwnProperty(F)) + switch (F.toLowerCase()) { + case "doctype": + break; + case "title": + m = "" + o.metadata.parsed.title + ` +`; + break; + case "charset": + c === "html" || c === "html5" ? p = ' +` : p = ' +`; + break; + case "language": + case "lang": + j = ' lang="' + o.metadata.parsed[F] + '"', V += ' +`; + break; + default: + V += ' +`; + } + return r = u + " + +` + m + p + V + ` + +` + r.trim() + ` + +`, r = o.converter._dispatch("completeHTMLDocument.after", r, s, o), r; + }), a.subParser("detab", function(r, s, o) { + return r = o.converter._dispatch("detab.before", r, s, o), r = r.replace(/\t(?=\t)/g, " "), r = r.replace(/\t/g, "¨A¨B"), r = r.replace(/¨B(.+?)¨A/g, function(c, u) { + for (var m = u, p = 4 - m.length % 4, j = 0; j < p; j++) + m += " "; + return m; + }), r = r.replace(/¨A/g, " "), r = r.replace(/¨B/g, ""), r = o.converter._dispatch("detab.after", r, s, o), r; + }), a.subParser("ellipsis", function(r, s, o) { + return s.ellipsis && (r = o.converter._dispatch("ellipsis.before", r, s, o), r = r.replace(/\.\.\./g, "…"), r = o.converter._dispatch("ellipsis.after", r, s, o)), r; + }), a.subParser("emoji", function(r, s, o) { + if (!s.emoji) + return r; + r = o.converter._dispatch("emoji.before", r, s, o); + var c = /:([\S]+?):/g; + return r = r.replace(c, function(u, m) { + return a.helper.emojis.hasOwnProperty(m) ? a.helper.emojis[m] : u; + }), r = o.converter._dispatch("emoji.after", r, s, o), r; + }), a.subParser("encodeAmpsAndAngles", function(r, s, o) { + return r = o.converter._dispatch("encodeAmpsAndAngles.before", r, s, o), r = r.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), r = r.replace(/<(?![a-z\/?$!])/gi, "<"), r = r.replace(//g, ">"), r = o.converter._dispatch("encodeAmpsAndAngles.after", r, s, o), r; + }), a.subParser("encodeBackslashEscapes", function(r, s, o) { + return r = o.converter._dispatch("encodeBackslashEscapes.before", r, s, o), r = r.replace(/\\(\\)/g, a.helper.escapeCharactersCallback), r = r.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, a.helper.escapeCharactersCallback), r = o.converter._dispatch("encodeBackslashEscapes.after", r, s, o), r; + }), a.subParser("encodeCode", function(r, s, o) { + return r = o.converter._dispatch("encodeCode.before", r, s, o), r = r.replace(/&/g, "&").replace(//g, ">").replace(/([*_{}\[\]\\=~-])/g, a.helper.escapeCharactersCallback), r = o.converter._dispatch("encodeCode.after", r, s, o), r; + }), a.subParser("escapeSpecialCharsWithinTagAttributes", function(r, s, o) { + r = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", r, s, o); + var c = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, u = /-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; + return r = r.replace(c, function(m) { + return m.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), r = r.replace(u, function(m) { + return m.replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), r = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", r, s, o), r; + }), a.subParser("githubCodeBlocks", function(r, s, o) { + return s.ghCodeBlocks ? (r = o.converter._dispatch("githubCodeBlocks.before", r, s, o), r += "¨0", r = r.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(c, u, m, p) { + var j = s.omitExtraWLInCodeBlocks ? "" : ` +`; + return p = a.subParser("encodeCode")(p, s, o), p = a.subParser("detab")(p, s, o), p = p.replace(/^\n+/g, ""), p = p.replace(/\n+$/g, ""), p = "
" + p + j + "
", p = a.subParser("hashBlock")(p, s, o), ` + +¨G` + (o.ghCodeBlocks.push({ text: c, codeblock: p }) - 1) + `G + +`; + }), r = r.replace(/¨0/, ""), o.converter._dispatch("githubCodeBlocks.after", r, s, o)) : r; + }), a.subParser("hashBlock", function(r, s, o) { + return r = o.converter._dispatch("hashBlock.before", r, s, o), r = r.replace(/(^\n+|\n+$)/g, ""), r = ` + +¨K` + (o.gHtmlBlocks.push(r) - 1) + `K + +`, r = o.converter._dispatch("hashBlock.after", r, s, o), r; + }), a.subParser("hashCodeTags", function(r, s, o) { + r = o.converter._dispatch("hashCodeTags.before", r, s, o); + var c = function(u, m, p, j) { + var V = p + a.subParser("encodeCode")(m, s, o) + j; + return "¨C" + (o.gHtmlSpans.push(V) - 1) + "C"; + }; + return r = a.helper.replaceRecursiveRegExp(r, c, "]*>", "", "gim"), r = o.converter._dispatch("hashCodeTags.after", r, s, o), r; + }), a.subParser("hashElement", function(r, s, o) { + return function(c, u) { + var m = u; + return m = m.replace(/\n\n/g, ` +`), m = m.replace(/^\n/, ""), m = m.replace(/\n+$/g, ""), m = ` + +¨K` + (o.gHtmlBlocks.push(m) - 1) + `K + +`, m; + }; + }), a.subParser("hashHTMLBlocks", function(r, s, o) { + r = o.converter._dispatch("hashHTMLBlocks.before", r, s, o); + var c = [ + "pre", + "div", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "blockquote", + "table", + "dl", + "ol", + "ul", + "script", + "noscript", + "form", + "fieldset", + "iframe", + "math", + "style", + "section", + "header", + "footer", + "nav", + "article", + "aside", + "address", + "audio", + "canvas", + "figure", + "hgroup", + "output", + "video", + "p" + ], u = function(g, H, W, J) { + var U = g; + return W.search(/\bmarkdown\b/) !== -1 && (U = W + o.converter.makeHtml(H) + J), ` + +¨K` + (o.gHtmlBlocks.push(U) - 1) + `K + +`; + }; + s.backslashEscapesHTMLTags && (r = r.replace(/\\<(\/?[^>]+?)>/g, function(g, H) { + return "<" + H + ">"; + })); + for (var m = 0; m < c.length; ++m) + for (var p, j = new RegExp("^ {0,3}(<" + c[m] + "\\b[^>]*>)", "im"), V = "<" + c[m] + "\\b[^>]*>", F = ""; (p = a.helper.regexIndexOf(r, j)) !== -1; ) { + var D = a.helper.splitAtIndex(r, p), q = a.helper.replaceRecursiveRegExp(D[1], u, V, F, "im"); + if (q === D[1]) + break; + r = D[0].concat(q); + } + return r = r.replace( + /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, + a.subParser("hashElement")(r, s, o) + ), r = a.helper.replaceRecursiveRegExp(r, function(g) { + return ` + +¨K` + (o.gHtmlBlocks.push(g) - 1) + `K + +`; + }, "^ {0,3}", "gm"), r = r.replace( + /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, + a.subParser("hashElement")(r, s, o) + ), r = o.converter._dispatch("hashHTMLBlocks.after", r, s, o), r; + }), a.subParser("hashHTMLSpans", function(r, s, o) { + r = o.converter._dispatch("hashHTMLSpans.before", r, s, o); + function c(u) { + return "¨C" + (o.gHtmlSpans.push(u) - 1) + "C"; + } + return r = r.replace(/<[^>]+?\/>/gi, function(u) { + return c(u); + }), r = r.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(u) { + return c(u); + }), r = r.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(u) { + return c(u); + }), r = r.replace(/<[^>]+?>/gi, function(u) { + return c(u); + }), r = o.converter._dispatch("hashHTMLSpans.after", r, s, o), r; + }), a.subParser("unhashHTMLSpans", function(r, s, o) { + r = o.converter._dispatch("unhashHTMLSpans.before", r, s, o); + for (var c = 0; c < o.gHtmlSpans.length; ++c) { + for (var u = o.gHtmlSpans[c], m = 0; /¨C(\d+)C/.test(u); ) { + var p = RegExp.$1; + if (u = u.replace("¨C" + p + "C", o.gHtmlSpans[p]), m === 10) { + console.error("maximum nesting of 10 spans reached!!!"); + break; + } + ++m; + } + r = r.replace("¨C" + c + "C", u); + } + return r = o.converter._dispatch("unhashHTMLSpans.after", r, s, o), r; + }), a.subParser("hashPreCodeTags", function(r, s, o) { + r = o.converter._dispatch("hashPreCodeTags.before", r, s, o); + var c = function(u, m, p, j) { + var V = p + a.subParser("encodeCode")(m, s, o) + j; + return ` + +¨G` + (o.ghCodeBlocks.push({ text: u, codeblock: V }) - 1) + `G + +`; + }; + return r = a.helper.replaceRecursiveRegExp(r, c, "^ {0,3}]*>\\s*]*>", "^ {0,3}\\s*
", "gim"), r = o.converter._dispatch("hashPreCodeTags.after", r, s, o), r; + }), a.subParser("headers", function(r, s, o) { + r = o.converter._dispatch("headers.before", r, s, o); + var c = isNaN(parseInt(s.headerLevelStart)) ? 1 : parseInt(s.headerLevelStart), u = s.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, m = s.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; + r = r.replace(u, function(V, F) { + var D = a.subParser("spanGamut")(F, s, o), q = s.noHeaderId ? "" : ' id="' + j(F) + '"', g = c, H = "" + D + ""; + return a.subParser("hashBlock")(H, s, o); + }), r = r.replace(m, function(V, F) { + var D = a.subParser("spanGamut")(F, s, o), q = s.noHeaderId ? "" : ' id="' + j(F) + '"', g = c + 1, H = "" + D + ""; + return a.subParser("hashBlock")(H, s, o); + }); + var p = s.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; + r = r.replace(p, function(V, F, D) { + var q = D; + s.customizedHeaderId && (q = D.replace(/\s?\{([^{]+?)}\s*$/, "")); + var g = a.subParser("spanGamut")(q, s, o), H = s.noHeaderId ? "" : ' id="' + j(D) + '"', W = c - 1 + F.length, J = "" + g + ""; + return a.subParser("hashBlock")(J, s, o); + }); + function j(V) { + var F, D; + if (s.customizedHeaderId) { + var q = V.match(/\{([^{]+?)}\s*$/); + q && q[1] && (V = q[1]); + } + return F = V, a.helper.isString(s.prefixHeaderId) ? D = s.prefixHeaderId : s.prefixHeaderId === !0 ? D = "section-" : D = "", s.rawPrefixHeaderId || (F = D + F), s.ghCompatibleHeaderId ? F = F.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase() : s.rawHeaderId ? F = F.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "¨").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase() : F = F.replace(/[^\w]/g, "").toLowerCase(), s.rawPrefixHeaderId && (F = D + F), o.hashLinkCounts[F] ? F = F + "-" + o.hashLinkCounts[F]++ : o.hashLinkCounts[F] = 1, F; + } + return r = o.converter._dispatch("headers.after", r, s, o), r; + }), a.subParser("horizontalRule", function(r, s, o) { + r = o.converter._dispatch("horizontalRule.before", r, s, o); + var c = a.subParser("hashBlock")("
", s, o); + return r = r.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, c), r = r.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, c), r = r.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, c), r = o.converter._dispatch("horizontalRule.after", r, s, o), r; + }), a.subParser("images", function(r, s, o) { + r = o.converter._dispatch("images.before", r, s, o); + var c = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, u = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, m = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, p = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, j = /!\[([^\[\]]+)]()()()()()/g; + function V(D, q, g, H, W, J, U, P) { + return H = H.replace(/\s/g, ""), F(D, q, g, H, W, J, U, P); + } + function F(D, q, g, H, W, J, U, P) { + var B = o.gUrls, N = o.gTitles, d = o.gDimensions; + if (g = g.toLowerCase(), P || (P = ""), D.search(/\(? ?(['"].*['"])?\)$/m) > -1) + H = ""; + else if (H === "" || H === null) + if ((g === "" || g === null) && (g = q.toLowerCase().replace(/ ?\n/g, " ")), H = "#" + g, !a.helper.isUndefined(B[g])) + H = B[g], a.helper.isUndefined(N[g]) || (P = N[g]), a.helper.isUndefined(d[g]) || (W = d[g].width, J = d[g].height); + else + return D; + q = q.replace(/"/g, """).replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback), H = H.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var v = '' + q + '", "
"); + }), r = r.replace(/\b__(\S[\s\S]*?)__\b/g, function(u, m) { + return c(m, "", ""); + }), r = r.replace(/\b_(\S[\s\S]*?)_\b/g, function(u, m) { + return c(m, "", ""); + })) : (r = r.replace(/___(\S[\s\S]*?)___/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + }), r = r.replace(/__(\S[\s\S]*?)__/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + }), r = r.replace(/_([^\s_][\s\S]*?)_/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + })), s.literalMidWordAsterisks ? (r = r.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(u, m, p) { + return c(p, m + "", ""); + }), r = r.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(u, m, p) { + return c(p, m + "", ""); + }), r = r.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(u, m, p) { + return c(p, m + "", ""); + })) : (r = r.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + }), r = r.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + }), r = r.replace(/\*([^\s*][\s\S]*?)\*/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + })), r = o.converter._dispatch("italicsAndBold.after", r, s, o), r; + }), a.subParser("lists", function(r, s, o) { + function c(p, j) { + o.gListLevel++, p = p.replace(/\n{2,}$/, ` +`), p += "¨0"; + var V = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, F = /\n[ \t]*\n(?!¨0)/.test(p); + return s.disableForced4SpacesIndentedSublists && (V = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm), p = p.replace(V, function(D, q, g, H, W, J, U) { + U = U && U.trim() !== ""; + var P = a.subParser("outdent")(W, s, o), B = ""; + return J && s.tasklists && (B = ' class="task-list-item" style="list-style-type: none;"', P = P.replace(/^[ \t]*\[(x|X| )?]/m, function() { + var N = ' -1 ? (P = a.subParser("githubCodeBlocks")(P, s, o), P = a.subParser("blockGamut")(P, s, o)) : (P = a.subParser("lists")(P, s, o), P = P.replace(/\n$/, ""), P = a.subParser("hashHTMLBlocks")(P, s, o), P = P.replace(/\n\n+/g, ` + +`), F ? P = a.subParser("paragraphs")(P, s, o) : P = a.subParser("spanGamut")(P, s, o)), P = P.replace("¨A", ""), P = "" + P + ` +`, P; + }), p = p.replace(/¨0/g, ""), o.gListLevel--, j && (p = p.replace(/\s+$/, "")), p; + } + function u(p, j) { + if (j === "ol") { + var V = p.match(/^ *(\d+)\./); + if (V && V[1] !== "1") + return ' start="' + V[1] + '"'; + } + return ""; + } + function m(p, j, V) { + var F = s.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, D = s.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, q = j === "ul" ? F : D, g = ""; + if (p.search(q) !== -1) + (function W(J) { + var U = J.search(q), P = u(p, j); + U !== -1 ? (g += ` + +<` + j + P + `> +` + c(J.slice(0, U), !!V) + " +`, j = j === "ul" ? "ol" : "ul", q = j === "ul" ? F : D, W(J.slice(U))) : g += ` + +<` + j + P + `> +` + c(J, !!V) + " +`; + })(p); + else { + var H = u(p, j); + g = ` + +<` + j + H + `> +` + c(p, !!V) + " +`; + } + return g; + } + return r = o.converter._dispatch("lists.before", r, s, o), r += "¨0", o.gListLevel ? r = r.replace( + /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, + function(p, j, V) { + var F = V.search(/[*+-]/g) > -1 ? "ul" : "ol"; + return m(j, F, !0); + } + ) : r = r.replace( + /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, + function(p, j, V, F) { + var D = F.search(/[*+-]/g) > -1 ? "ul" : "ol"; + return m(V, D, !1); + } + ), r = r.replace(/¨0/, ""), r = o.converter._dispatch("lists.after", r, s, o), r; + }), a.subParser("metadata", function(r, s, o) { + if (!s.metadata) + return r; + r = o.converter._dispatch("metadata.before", r, s, o); + function c(u) { + o.metadata.raw = u, u = u.replace(/&/g, "&").replace(/"/g, """), u = u.replace(/\n {4}/g, " "), u.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(m, p, j) { + return o.metadata.parsed[p] = j, ""; + }); + } + return r = r.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(u, m, p) { + return c(p), "¨M"; + }), r = r.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(u, m, p) { + return m && (o.metadata.format = m), c(p), "¨M"; + }), r = r.replace(/¨M/g, ""), r = o.converter._dispatch("metadata.after", r, s, o), r; + }), a.subParser("outdent", function(r, s, o) { + return r = o.converter._dispatch("outdent.before", r, s, o), r = r.replace(/^(\t|[ ]{1,4})/gm, "¨0"), r = r.replace(/¨0/g, ""), r = o.converter._dispatch("outdent.after", r, s, o), r; + }), a.subParser("paragraphs", function(r, s, o) { + r = o.converter._dispatch("paragraphs.before", r, s, o), r = r.replace(/^\n+/g, ""), r = r.replace(/\n+$/g, ""); + for (var c = r.split(/\n{2,}/g), u = [], m = c.length, p = 0; p < m; p++) { + var j = c[p]; + j.search(/¨(K|G)(\d+)\1/g) >= 0 ? u.push(j) : j.search(/\S/) >= 0 && (j = a.subParser("spanGamut")(j, s, o), j = j.replace(/^([ \t]*)/g, "

"), j += "

", u.push(j)); + } + for (m = u.length, p = 0; p < m; p++) { + for (var V = "", F = u[p], D = !1; /¨(K|G)(\d+)\1/.test(F); ) { + var q = RegExp.$1, g = RegExp.$2; + q === "K" ? V = o.gHtmlBlocks[g] : D ? V = a.subParser("encodeCode")(o.ghCodeBlocks[g].text, s, o) : V = o.ghCodeBlocks[g].codeblock, V = V.replace(/\$/g, "$$$$"), F = F.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, V), /^]*>\s*]*>/.test(F) && (D = !0); + } + u[p] = F; + } + return r = u.join(` +`), r = r.replace(/^\n+/g, ""), r = r.replace(/\n+$/g, ""), o.converter._dispatch("paragraphs.after", r, s, o); + }), a.subParser("runExtension", function(r, s, o, c) { + if (r.filter) + s = r.filter(s, c.converter, o); + else if (r.regex) { + var u = r.regex; + u instanceof RegExp || (u = new RegExp(u, "g")), s = s.replace(u, r.replace); + } + return s; + }), a.subParser("spanGamut", function(r, s, o) { + return r = o.converter._dispatch("spanGamut.before", r, s, o), r = a.subParser("codeSpans")(r, s, o), r = a.subParser("escapeSpecialCharsWithinTagAttributes")(r, s, o), r = a.subParser("encodeBackslashEscapes")(r, s, o), r = a.subParser("images")(r, s, o), r = a.subParser("anchors")(r, s, o), r = a.subParser("autoLinks")(r, s, o), r = a.subParser("simplifiedAutoLinks")(r, s, o), r = a.subParser("emoji")(r, s, o), r = a.subParser("underline")(r, s, o), r = a.subParser("italicsAndBold")(r, s, o), r = a.subParser("strikethrough")(r, s, o), r = a.subParser("ellipsis")(r, s, o), r = a.subParser("hashHTMLSpans")(r, s, o), r = a.subParser("encodeAmpsAndAngles")(r, s, o), s.simpleLineBreaks ? /\n\n¨K/.test(r) || (r = r.replace(/\n+/g, `
+`)) : r = r.replace(/ +\n/g, `
+`), r = o.converter._dispatch("spanGamut.after", r, s, o), r; + }), a.subParser("strikethrough", function(r, s, o) { + function c(u) { + return s.simplifiedAutoLink && (u = a.subParser("simplifiedAutoLinks")(u, s, o)), "" + u + ""; + } + return s.strikethrough && (r = o.converter._dispatch("strikethrough.before", r, s, o), r = r.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(u, m) { + return c(m); + }), r = o.converter._dispatch("strikethrough.after", r, s, o)), r; + }), a.subParser("stripLinkDefinitions", function(r, s, o) { + var c = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm, u = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm; + r += "¨0"; + var m = function(p, j, V, F, D, q, g) { + return j = j.toLowerCase(), r.toLowerCase().split(j).length - 1 < 2 ? p : (V.match(/^data:.+?\/.+?;base64,/) ? o.gUrls[j] = V.replace(/\s/g, "") : o.gUrls[j] = a.subParser("encodeAmpsAndAngles")(V, s, o), q ? q + g : (g && (o.gTitles[j] = g.replace(/"|'/g, """)), s.parseImgDimensions && F && D && (o.gDimensions[j] = { + width: F, + height: D + }), "")); + }; + return r = r.replace(u, m), r = r.replace(c, m), r = r.replace(/¨0/, ""), r; + }), a.subParser("tables", function(r, s, o) { + if (!s.tables) + return r; + var c = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, u = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; + function m(D) { + return /^:[ \t]*--*$/.test(D) ? ' style="text-align:left;"' : /^--*[ \t]*:[ \t]*$/.test(D) ? ' style="text-align:right;"' : /^:[ \t]*--*[ \t]*:$/.test(D) ? ' style="text-align:center;"' : ""; + } + function p(D, q) { + var g = ""; + return D = D.trim(), (s.tablesHeaderId || s.tableHeaderId) && (g = ' id="' + D.replace(/ /g, "_").toLowerCase() + '"'), D = a.subParser("spanGamut")(D, s, o), "" + D + ` +`; + } + function j(D, q) { + var g = a.subParser("spanGamut")(D, s, o); + return "" + g + ` +`; + } + function V(D, q) { + for (var g = ` + + +`, H = D.length, W = 0; W < H; ++W) + g += D[W]; + for (g += ` + + +`, W = 0; W < q.length; ++W) { + g += ` +`; + for (var J = 0; J < H; ++J) + g += q[W][J]; + g += ` +`; + } + return g += ` +
+`, g; + } + function F(D) { + var q, g = D.split(` +`); + for (q = 0; q < g.length; ++q) + /^ {0,3}\|/.test(g[q]) && (g[q] = g[q].replace(/^ {0,3}\|/, "")), /\|[ \t]*$/.test(g[q]) && (g[q] = g[q].replace(/\|[ \t]*$/, "")), g[q] = a.subParser("codeSpans")(g[q], s, o); + var H = g[0].split("|").map(function(v) { + return v.trim(); + }), W = g[1].split("|").map(function(v) { + return v.trim(); + }), J = [], U = [], P = [], B = []; + for (g.shift(), g.shift(), q = 0; q < g.length; ++q) + g[q].trim() !== "" && J.push( + g[q].split("|").map(function(v) { + return v.trim(); + }) + ); + if (H.length < W.length) + return D; + for (q = 0; q < W.length; ++q) + P.push(m(W[q])); + for (q = 0; q < H.length; ++q) + a.helper.isUndefined(P[q]) && (P[q] = ""), U.push(p(H[q], P[q])); + for (q = 0; q < J.length; ++q) { + for (var N = [], d = 0; d < U.length; ++d) + a.helper.isUndefined(J[q][d]), N.push(j(J[q][d], P[d])); + B.push(N); + } + return V(U, B); + } + return r = o.converter._dispatch("tables.before", r, s, o), r = r.replace(/\\(\|)/g, a.helper.escapeCharactersCallback), r = r.replace(c, F), r = r.replace(u, F), r = o.converter._dispatch("tables.after", r, s, o), r; + }), a.subParser("underline", function(r, s, o) { + return s.underline && (r = o.converter._dispatch("underline.before", r, s, o), s.literalMidWordUnderscores ? (r = r.replace(/\b___(\S[\s\S]*?)___\b/g, function(c, u) { + return "" + u + ""; + }), r = r.replace(/\b__(\S[\s\S]*?)__\b/g, function(c, u) { + return "" + u + ""; + })) : (r = r.replace(/___(\S[\s\S]*?)___/g, function(c, u) { + return /\S$/.test(u) ? "" + u + "" : c; + }), r = r.replace(/__(\S[\s\S]*?)__/g, function(c, u) { + return /\S$/.test(u) ? "" + u + "" : c; + })), r = r.replace(/(_)/g, a.helper.escapeCharactersCallback), r = o.converter._dispatch("underline.after", r, s, o)), r; + }), a.subParser("unescapeSpecialChars", function(r, s, o) { + return r = o.converter._dispatch("unescapeSpecialChars.before", r, s, o), r = r.replace(/¨E(\d+)E/g, function(c, u) { + var m = parseInt(u); + return String.fromCharCode(m); + }), r = o.converter._dispatch("unescapeSpecialChars.after", r, s, o), r; + }), a.subParser("makeMarkdown.blockquote", function(r, s) { + var o = ""; + if (r.hasChildNodes()) + for (var c = r.childNodes, u = c.length, m = 0; m < u; ++m) { + var p = a.subParser("makeMarkdown.node")(c[m], s); + p !== "" && (o += p); + } + return o = o.trim(), o = "> " + o.split(` +`).join(` +> `), o; + }), a.subParser("makeMarkdown.codeBlock", function(r, s) { + var o = r.getAttribute("language"), c = r.getAttribute("precodenum"); + return "```" + o + ` +` + s.preList[c] + "\n```"; + }), a.subParser("makeMarkdown.codeSpan", function(r) { + return "`" + r.innerHTML + "`"; + }), a.subParser("makeMarkdown.emphasis", function(r, s) { + var o = ""; + if (r.hasChildNodes()) { + o += "*"; + for (var c = r.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], s); + o += "*"; + } + return o; + }), a.subParser("makeMarkdown.header", function(r, s, o) { + var c = new Array(o + 1).join("#"), u = ""; + if (r.hasChildNodes()) { + u = c + " "; + for (var m = r.childNodes, p = m.length, j = 0; j < p; ++j) + u += a.subParser("makeMarkdown.node")(m[j], s); + } + return u; + }), a.subParser("makeMarkdown.hr", function() { + return "---"; + }), a.subParser("makeMarkdown.image", function(r) { + var s = ""; + return r.hasAttribute("src") && (s += "![" + r.getAttribute("alt") + "](", s += "<" + r.getAttribute("src") + ">", r.hasAttribute("width") && r.hasAttribute("height") && (s += " =" + r.getAttribute("width") + "x" + r.getAttribute("height")), r.hasAttribute("title") && (s += ' "' + r.getAttribute("title") + '"'), s += ")"), s; + }), a.subParser("makeMarkdown.links", function(r, s) { + var o = ""; + if (r.hasChildNodes() && r.hasAttribute("href")) { + var c = r.childNodes, u = c.length; + o = "["; + for (var m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], s); + o += "](", o += "<" + r.getAttribute("href") + ">", r.hasAttribute("title") && (o += ' "' + r.getAttribute("title") + '"'), o += ")"; + } + return o; + }), a.subParser("makeMarkdown.list", function(r, s, o) { + var c = ""; + if (!r.hasChildNodes()) + return ""; + for (var u = r.childNodes, m = u.length, p = r.getAttribute("start") || 1, j = 0; j < m; ++j) + if (!(typeof u[j].tagName > "u" || u[j].tagName.toLowerCase() !== "li")) { + var V = ""; + o === "ol" ? V = p.toString() + ". " : V = "- ", c += V + a.subParser("makeMarkdown.listItem")(u[j], s), ++p; + } + return c += ` + +`, c.trim(); + }), a.subParser("makeMarkdown.listItem", function(r, s) { + for (var o = "", c = r.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], s); + return /\n$/.test(o) ? o = o.split(` +`).join(` + `).replace(/^ {4}$/gm, "").replace(/\n\n+/g, ` + +`) : o += ` +`, o; + }), a.subParser("makeMarkdown.node", function(r, s, o) { + o = o || !1; + var c = ""; + if (r.nodeType === 3) + return a.subParser("makeMarkdown.txt")(r, s); + if (r.nodeType === 8) + return " + +`; + if (r.nodeType !== 1) + return ""; + var u = r.tagName.toLowerCase(); + switch (u) { + case "h1": + o || (c = a.subParser("makeMarkdown.header")(r, s, 1) + ` + +`); + break; + case "h2": + o || (c = a.subParser("makeMarkdown.header")(r, s, 2) + ` + +`); + break; + case "h3": + o || (c = a.subParser("makeMarkdown.header")(r, s, 3) + ` + +`); + break; + case "h4": + o || (c = a.subParser("makeMarkdown.header")(r, s, 4) + ` + +`); + break; + case "h5": + o || (c = a.subParser("makeMarkdown.header")(r, s, 5) + ` + +`); + break; + case "h6": + o || (c = a.subParser("makeMarkdown.header")(r, s, 6) + ` + +`); + break; + case "p": + o || (c = a.subParser("makeMarkdown.paragraph")(r, s) + ` + +`); + break; + case "blockquote": + o || (c = a.subParser("makeMarkdown.blockquote")(r, s) + ` + +`); + break; + case "hr": + o || (c = a.subParser("makeMarkdown.hr")(r, s) + ` + +`); + break; + case "ol": + o || (c = a.subParser("makeMarkdown.list")(r, s, "ol") + ` + +`); + break; + case "ul": + o || (c = a.subParser("makeMarkdown.list")(r, s, "ul") + ` + +`); + break; + case "precode": + o || (c = a.subParser("makeMarkdown.codeBlock")(r, s) + ` + +`); + break; + case "pre": + o || (c = a.subParser("makeMarkdown.pre")(r, s) + ` + +`); + break; + case "table": + o || (c = a.subParser("makeMarkdown.table")(r, s) + ` + +`); + break; + case "code": + c = a.subParser("makeMarkdown.codeSpan")(r, s); + break; + case "em": + case "i": + c = a.subParser("makeMarkdown.emphasis")(r, s); + break; + case "strong": + case "b": + c = a.subParser("makeMarkdown.strong")(r, s); + break; + case "del": + c = a.subParser("makeMarkdown.strikethrough")(r, s); + break; + case "a": + c = a.subParser("makeMarkdown.links")(r, s); + break; + case "img": + c = a.subParser("makeMarkdown.image")(r, s); + break; + default: + c = r.outerHTML + ` + +`; + } + return c; + }), a.subParser("makeMarkdown.paragraph", function(r, s) { + var o = ""; + if (r.hasChildNodes()) + for (var c = r.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], s); + return o = o.trim(), o; + }), a.subParser("makeMarkdown.pre", function(r, s) { + var o = r.getAttribute("prenum"); + return "
" + s.preList[o] + "
"; + }), a.subParser("makeMarkdown.strikethrough", function(r, s) { + var o = ""; + if (r.hasChildNodes()) { + o += "~~"; + for (var c = r.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], s); + o += "~~"; + } + return o; + }), a.subParser("makeMarkdown.strong", function(r, s) { + var o = ""; + if (r.hasChildNodes()) { + o += "**"; + for (var c = r.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], s); + o += "**"; + } + return o; + }), a.subParser("makeMarkdown.table", function(r, s) { + var o = "", c = [[], []], u = r.querySelectorAll("thead>tr>th"), m = r.querySelectorAll("tbody>tr"), p, j; + for (p = 0; p < u.length; ++p) { + var V = a.subParser("makeMarkdown.tableCell")(u[p], s), F = "---"; + if (u[p].hasAttribute("style")) { + var D = u[p].getAttribute("style").toLowerCase().replace(/\s/g, ""); + switch (D) { + case "text-align:left;": + F = ":---"; + break; + case "text-align:right;": + F = "---:"; + break; + case "text-align:center;": + F = ":---:"; + break; + } + } + c[0][p] = V.trim(), c[1][p] = F; + } + for (p = 0; p < m.length; ++p) { + var q = c.push([]) - 1, g = m[p].getElementsByTagName("td"); + for (j = 0; j < u.length; ++j) { + var H = " "; + typeof g[j] < "u" && (H = a.subParser("makeMarkdown.tableCell")(g[j], s)), c[q].push(H); + } + } + var W = 3; + for (p = 0; p < c.length; ++p) + for (j = 0; j < c[p].length; ++j) { + var J = c[p][j].length; + J > W && (W = J); + } + for (p = 0; p < c.length; ++p) { + for (j = 0; j < c[p].length; ++j) + p === 1 ? c[p][j].slice(-1) === ":" ? c[p][j] = a.helper.padEnd(c[p][j].slice(-1), W - 1, "-") + ":" : c[p][j] = a.helper.padEnd(c[p][j], W, "-") : c[p][j] = a.helper.padEnd(c[p][j], W); + o += "| " + c[p].join(" | ") + ` | +`; + } + return o.trim(); + }), a.subParser("makeMarkdown.tableCell", function(r, s) { + var o = ""; + if (!r.hasChildNodes()) + return ""; + for (var c = r.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], s, !0); + return o.trim(); + }), a.subParser("makeMarkdown.txt", function(r) { + var s = r.nodeValue; + return s = s.replace(/ +/g, " "), s = s.replace(/¨NBSP;/g, " "), s = a.helper.unescapeHTMLEntities(s), s = s.replace(/([*_~|`])/g, "\\$1"), s = s.replace(/^(\s*)>/g, "\\$1>"), s = s.replace(/^#/gm, "\\#"), s = s.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"), s = s.replace(/^( {0,3}\d+)\./gm, "$1\\."), s = s.replace(/^( {0,3})([+-])/gm, "$1\\$2"), s = s.replace(/]([\s]*)\(/g, "\\]$1\\("), s = s.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"), s; + }); + var R = this; + e.exports ? e.exports = a : R.showdown = a; + }).call(jn); +})(bo); +var au = bo.exports; +const Pn = /* @__PURE__ */ xn(au); +class En { + constructor() { + $e(this, "logger"), $e(this, "converter"), this.logger = La.zhiLog("showdown-adaptor"), this.converter = new Pn.Converter(); + } + isAvailable() { + return typeof Pn < "u"; + } + renderMarkdownStr(t) { + if (!this.isAvailable()) + throw new Error("Showdown is not available"); + return this.logger.info("Showdown is rendering md to HTML..."), Promise.resolve(this.converter.makeHtml(t)); + } +} +class wo { + constructor() { + $e(this, "logger"), $e(this, "mdAdaptor", new En()), this.logger = La.zhiLog("markdown-util"); + } + /** + * 获取当前 MD 解析器名称 + */ + getCurrentAdaptorName() { + return this.mdAdaptor instanceof kn ? "Lute" : this.mdAdaptor instanceof En ? "Showdown" : "None"; + } + /** + * 渲染Markdown + * + * @param md - Markdown文本 + */ + async renderHTML(t) { + const n = new kn(); + return this.logger.debug("Lute status =>", n.isAvailable()), n.isAvailable() && (this.mdAdaptor = n), this.logger.info(`Using ${this.getCurrentAdaptorName()} as markdown renderer`), await this.mdAdaptor.renderMarkdownStr(t); + } +} +class nu { + constructor() { + $e(this, "mdUtil"), this.mdUtil = new wo(); + } + /** + * 移除标题数字 + * + * @param str - 字符串 + */ + removeTitleNumber(t) { + let n = t; + const a = /([0-9]*)\./; + return n = n.replace(a, ""), n; + } + /** + * 删除挂件的HTML + * + * @param str - 原字符 + */ + removeWidgetTag(t) { + let n = t.toString(); + const a = //g; + n = n.replace(a, ""); + const i = //g; + n = n.replace(i, ""); + const l = //g; + return n = n.replace(l, ""), n; + } + /** + * 删除Markdown文本的挂件的HTML + * + * @param str - 原字符 + */ + removeMdWidgetTag(t) { + let n = t.toString(); + return n = this.removeWidgetTag(n), n; + } + /** + * 去除html标签,残缺不全也可以 + * + * @param str - 字符串 + */ + filterHtml(t) { + t = t.replace(//g, ""), t = t.replace(//g, ""), t = t.replace(/<[^>]*>/g, ""), t = t.replace(/&.*;/g, ""), t = t.replace(/(^\s*)|(\s*$)/g, ""), t = t.replace(//g, ""), t = t.replace(/"/g, "").replace(/'/g, ""), t = t.replace(/\*/g, ""), t = t.replace(/\$/g, ""), t = t.replace(/\./g, ""), t = t.replace(/\+/g, ""), t = t.replace(/\s+/g, ""), t = t.replace(/[:|:]/g, "_"), t = t.replace(/[;|;]/g, "_"), t = t.replace(/\^/g, "_"), t = t.replace(/!/g, "_"), t = t.replace(/@/g, "at_"); + const n = ["\\d*/\\d/\\d*", "[、|\\\\]", "[,|,]", "\\d", "/", "-"]; + for (let a = 0; a < n.length; a++) { + const i = new RegExp(n[a], "g"); + t = t.replace(i, ""); + } + return t = t.toLowerCase(), t; + } + /** + * 截取指定长度html + * + * @param html - html + * @param length - 长度 + * @param ignore - 不要结尾省略号 + */ + parseHtml(t, n, a) { + const i = this.filterHtml(t); + return i.length < n ? i : a === !0 ? i.substring(0, n) : i.substring(0, n) + "..."; + } + /** + * 将Markdown转换为HTML + * + * @param md - Markdown + */ + async mdToHtml(t) { + const n = await this.mdUtil.renderHTML(t); + return this.removeWidgetTag(n); + } + /** + * 将Markdown转换为纯文本 + * + * @param md - Markdown + */ + async mdToPlainText(t) { + const n = await this.mdToHtml(t); + return this.filterHtml(n); + } + /** + * 移除H1标签 + * + * @param html - html + */ + removeH1(t) { + let n = t; + const a = //g; + return n = n.replace(a, ""), n; + } + /** + * 移除Markdown里面的H1标签 + * + * JavaScript 正则表达式可以用来删除所有 Markdown 中的 h1 标签。下面是一个示例代码: + * + * const str = "# This is an H1\n## This is an H2\n### This is an H3"; + * + * const regex = /^# .*$/gm; + * const result = str.replace(regex, ''); + * + * console.log(result); + * 在这个例子中,我们使用正则表达式 /^# .*$/gm 来匹配所有的 h1 标签。 + * 在 JavaScript 中,^ 匹配行首,# 匹配 # 字符,.* 匹配任意字符,$ 匹配行尾,m 标记表示多行模式。 + */ + removeMdH1(t) { + let n = t; + const a = /^# .*$/gm; + return n = n.replace(a, ""), n; + } +} +class ou { + /** + * 检测是否是空对象 + * + * @param obj - 对象 + */ + isEmptyObject(t) { + return t ? Object.getPrototypeOf(t) === Object.prototype && Object.getOwnPropertyNames(t).length === 0 && Object.getOwnPropertySymbols(t).length === 0 : !0; + } +} +class su { + constructor() { + $e(this, "dateUtil"), $e(this, "strUtil"), $e(this, "versionUtil"), $e(this, "htmlUtil"), $e(this, "markdownUtil"), $e(this, "jsonUtil"), $e(this, "objectUtil"), this.dateUtil = new Ol(), this.strUtil = new Il(), this.versionUtil = new Ml(), this.htmlUtil = new nu(), this.markdownUtil = new wo(), this.jsonUtil = new Nl(), this.objectUtil = new ou(); + } +} +const iu = su; +var cu = Object.defineProperty, lu = (e, t, n) => t in e ? cu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Ot = (e, t, n) => (lu(e, typeof t != "symbol" ? t + "" : t, n), n); +class it { +} +Ot(it, "NODE_ENV_KEY", "NODE_ENV"), /** +* 开发环境 +*/ +Ot(it, "NODE_ENV_DEVELOPMENT", "development"), /** +* 生产环境 +*/ +Ot(it, "NODE_ENV_PRODUCTION", "production"), /** +* 测试环境 +*/ +Ot(it, "NODE_ENV_TEST", "test"), /** +* 是否处于调试模式 +*/ +Ot(it, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); +class uu { + /** + * 环境初始化 + * + * @param envMeta - 需要传入 {"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false} 。特别提醒:此参数是静态元数据,取决于最终使用的项目。因此仅仅在最终使用的地方显示传递此值,中间项目请保持参数传递 + * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} + */ + constructor(t) { + Ot(this, "envMeta"), this.envMeta = t; + } + /** + * 是否是开发阶段调试 + */ + isNodeDev() { + return this.getEnv(it.NODE_ENV_KEY) === it.NODE_ENV_DEVELOPMENT; + } + /** + * 是否是调试阶段 + */ + isDev() { + return this.isNodeDev() || this.getBooleanEnv(it.VITE_DEBUG_MODE_KEY); + } + /** + * 获取环境变量,key不存在返回undefined + * @param key - key + */ + getEnv(t) { + let n; + try { + this.envMeta[t] && (n = this.envMeta[t]); + } catch { + } + return n; + } + /** + * 获取String类型的环境变量,key不存在直接返回空值 + * @param key - key + */ + getStringEnv(t) { + return this.getEnv(t) ?? ""; + } + /** + * 获取Boolean类型的环境变量,key不存在返回false + * @param key - key + */ + getBooleanEnv(t) { + let n = !1; + return this.getEnv(t) && (n = this.getStringEnv(t).toLowerCase() === "true"), n; + } + /** + * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 + * + * @param key - key + * @param defaultValue - 默认值 + * @since 0.1.0 + * @author terwer + */ + getEnvOrDefault(t, n) { + const a = this.getStringEnv(t); + return a.trim().length == 0 ? n : a; + } +} +class du extends tr { + static zhiEnv() { + return this.env || (this.env = new uu({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; + } +} +class bu { + /** + * 初始化博客 API + * + * @param apiAdaptor - 对应博客的适配器,例如:SiYuanApiAdaptor + */ + constructor(t) { + Y(this, "logger"); + Y(this, "apiAdaptor"); + /** + * 博客API版本号 + */ + Y(this, "VERSION"); + this.logger = du.zhiLog("zhi-blog-api"), this.VERSION = "1.0.0", this.apiAdaptor = t; + } + /** + * 博客配置列表 + */ + async getUsersBlogs() { + return await this.apiAdaptor.getUsersBlogs(); + } + /** + * 最新文章数目 + * + * @param keyword - 关键字(可选,部分平台不支持搜索) + */ + async getRecentPostsCount(t) { + return await this.apiAdaptor.getRecentPostsCount(t); + } + /** + * 最新文章 + * + * @param numOfPosts - 文章数目 + * @param page - 页码(可选,从0开始,部分平台不支持分页) + * @param keyword - 关键字(可选,部分平台不支持搜索) + */ + async getRecentPosts(t, n, a) { + try { + return await this.apiAdaptor.getRecentPosts(t, n, a); + } catch (i) { + return this.logger.error("getRecentPosts fetch posts failed", i), Promise.resolve([]); + } + } + /** + * 发布文章 + * + * @param post - 文章 + * @param publish - 可选,是否发布 + */ + async newPost(t, n) { + return await this.apiAdaptor.newPost(t, n); + } + /** + * 文章详情 + * @param postid - postid + * @param useSlug - 是否使用的是别名(可选,部分平台不支持) + */ + async getPost(t, n) { + try { + return await this.apiAdaptor.getPost(t, n); + } catch (a) { + return this.logger.error(`getPost fetch posts failed => ${t},`, a), Promise.resolve(new Lo()); + } + } + /** + * 更新文章 + * + * @param postid - 文章id + * @param post - 文章 + * @param publish - 可选,是否发布 + */ + async editPost(t, n, a) { + return await this.apiAdaptor.editPost(t, n, a); + } + /** + * 删除文章 + * + * @param postid - 文章ID + */ + async deletePost(t) { + return await this.apiAdaptor.deletePost(t); + } + /** + * 获取分类列表 + */ + async getCategories() { + return await this.apiAdaptor.getCategories(); + } + /** + * 获取预览链接 + * + * @param postid - 文章ID + */ + async getPreviewUrl(t) { + return await this.apiAdaptor.getPreviewUrl(t); + } + /** + * 上传附件 + * + * @param mediaObject + */ + async newMediaObject(t) { + return await this.apiAdaptor.newMediaObject(t); + } +} +class hu { + constructor() { + /** + * 博客ID + */ + Y(this, "blogid"); + /** + * 博客地址 + */ + Y(this, "url"); + /** + * 博客名称 + */ + Y(this, "blogName"); + /** + * 是否是管理员 + */ + Y(this, "isAdmin"); + /** + * xmlrpc地址 + */ + Y(this, "xmlrpc"); + this.blogid = "", this.url = "", this.blogName = ""; + } +} +class wu { + constructor() { + /** + * 博客信息 + */ + Y(this, "userBlog"); + /** + * 域名 + */ + Y(this, "domain"); + /** + * 站点链接 + */ + Y(this, "weburl"); + /** + * 站点主题 + */ + Y(this, "webtheme"); + /** + * 站点名称 + */ + Y(this, "webname"); + /** + * 站点口号 + */ + Y(this, "webslogen"); + /** + * 关键字 + */ + Y(this, "keywords"); + /** + * 描述 + */ + Y(this, "description"); + /** + * 备案信息 + */ + Y(this, "beianinfo"); + this.userBlog = new hu(), this.domain = "", this.weburl = "", this.webtheme = "default", this.webname = "浅海拾贝", this.webslogen = "寻找未知的技术拼图", this.keywords = "软件架构、服务端开发、Java、Spring、Dubbo、Zookeeper、微服务", this.description = "浅海拾贝致力于Java后端开发及服务端技术、软件架构、微服务技术分享的个人博客", this.beianinfo = "粤ICP备18023717号-1"; + } +} +class vu { + constructor() { + /** + * 分类ID + */ + Y(this, "categoryId"); + /** + * 父分类ID + */ + Y(this, "parentId"); + /** + * 分类名称 + */ + Y(this, "description"); + /** + * 分类英文名 + */ + Y(this, "categoryName"); + /** + * 分类详情 + */ + Y(this, "categoryDescription"); + /** + * 分类地址 + */ + Y(this, "htmlUrl"); + /** + * 分类订阅地址 + */ + Y(this, "rssUrl"); + this.categoryId = "-1", this.parentId = "0", this.description = "分类1", this.categoryDescription = "这是测试分类1", this.categoryName = "cate1", this.htmlUrl = "", this.rssUrl = ""; + } +} +class $u { + constructor(t, n, a) { + Y(this, "name"); + Y(this, "type"); + Y(this, "bits"); + this.name = t, this.type = n, this.bits = a; + } +} +class pu { +} +/** + * 博客类型 + */ +Y(pu, "DEFAULT_BLOG_TYPE_KEY", "VITE_DEFAULT_TYPE"); +var fu = /* @__PURE__ */ ((e) => (e.BlogTypeEnum_Siyuan = "siyuan", e.BlogTypeEnum_Metaweblog = "metaweblog", e.BlogTypeEnum_Wordpress = "wordpress", e))(fu || {}); +export { + bu as BlogAdaptor, + _u as BlogApi, + gu as BlogConfig, + pu as BlogConstants, + yu as BlogPlaceholder, + fu as BlogTypeEnum, + vu as CategoryInfo, + $u as MediaObject, + Ao as PageType, + Ro as PasswordType, + Lo as Post, + Sn as PostStatusEnum, + wu as SiteConfig, + hu as UserBlog +}; diff --git a/public/libs/zhi-blog-api/lib/IBlogApi.d.ts b/public/libs/zhi-blog-api/lib/IBlogApi.d.ts new file mode 100644 index 0000000..a2e64fe --- /dev/null +++ b/public/libs/zhi-blog-api/lib/IBlogApi.d.ts @@ -0,0 +1,139 @@ +import UserBlog from "./models/userBlog"; +import Post from "./models/post"; +import MediaObject from "./models/mediaObject"; +import CategoryInfo from "./models/categoryInfo"; +/** + * 通用博客接口 + * + * @public + * @author terwer + * @outline deep + * @version 1.0.0 + * @since 1.0.0 + */ +interface IBlogApi { + /** + * 博客配置列表 + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getUsersBlogs getUsersBlogs} + * @returns {Promise>} + */ + getUsersBlogs(): Promise>; + /** + * 最新文章数目 + * + * @param keyword - 关键字(可选,部分平台不支持搜索) + * @returns {Promise} + */ + getRecentPostsCount(keyword?: string): Promise; + /** + * 最新文章 + * + * @param numOfPosts - 文章数目 + * @param page - 页码(可选,从0开始,部分平台不支持分页) + * @param keyword - 关键字(可选,部分平台不支持搜索) + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getRecentPosts getRecentPosts} + * @returns {Promise>} + */ + getRecentPosts(numOfPosts: number, page?: number, keyword?: string): Promise>; + /** + * 发布文章 + * + * @param post - 文章 + * @param publish - 可选,是否发布 + * + * ```ts + * const post = { + * description: "自动发布的测试内容", + * title: "自动发布的测试标题", + * categories: ["标签1","标签2"], + * // dateCreated: new Date(), + * // link: "", + * // permalink: "", + * // postid: "", + * // source: { + * // name: "", + * // url: "" + * // }; + * // userid: "" + * } + * + * const result = newPost(post, false) + * ``` + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.newPost newPost} + * @returns {Promise} + */ + newPost(post: Post, publish?: boolean): Promise; + /** + * 文章详情 + * @param postid - postid + * @param useSlug - 是否使用的是别名(可选,部分平台不支持) + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getPost getPost} + * @returns {Promise} + */ + getPost(postid: string, useSlug?: boolean): Promise; + /** + * 更新文章 + * + * @param postid - 文章id + * @param post - 文章 + * @param publish - 可选,是否发布 + * + * ```ts + * // wordpress + * // const postid = 4115 + * // conf + * // const postid = 1540103 + * const postid = "2490384_1" + * const post = { + * description: "修改过的自动发布的测试内容2", + * title: "修改过的自动发布的测试标题2", + * categories: ["标签1", "标签2"], + * // dateCreated: new Date(), + * // link: "", + * // permalink: "", + * // postid: postid, + * // source: { + * // name: "", + * // url: "" + * // }; + * // userid: "" + * } + * + * const result = editPost(postid, post, false) + * ``` + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.editPost editPost} + * @returns {Promise} + */ + editPost(postid: string, post: Post, publish?: boolean): Promise; + /** + * 删除文章 + * + * @param postid - 文章ID + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.deletePost deletePost} + * @returns {Promise} + */ + deletePost(postid: string): Promise; + /** + * 获取分类列表 + * + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getCategories getCategories} + * @returns {Promise} + */ + getCategories(): Promise; + /** + * 获取预览链接 + * + * @param postid - 文章ID + * @returns {Promise} + */ + getPreviewUrl(postid: string): Promise; + /** + * 上传附件 + * + * @param mediaObject + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.newMediaObject newMediaObject} + * @returns {Promise} + */ + newMediaObject(mediaObject: MediaObject): Promise; +} +export type { IBlogApi }; diff --git a/public/libs/zhi-blog-api/lib/blogAdaptor.d.ts b/public/libs/zhi-blog-api/lib/blogAdaptor.d.ts new file mode 100644 index 0000000..3587931 --- /dev/null +++ b/public/libs/zhi-blog-api/lib/blogAdaptor.d.ts @@ -0,0 +1,88 @@ +import UserBlog from "./models/userBlog"; +import Post from "./models/post"; +import CategoryInfo from "./models/categoryInfo"; +import MediaObject from "./models/mediaObject"; +import { IBlogApi } from "./IBlogApi"; +/** + * 博客API + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare class BlogAdaptor implements IBlogApi { + private readonly logger; + private readonly apiAdaptor; + /** + * 博客API版本号 + */ + readonly VERSION: any; + /** + * 初始化博客 API + * + * @param apiAdaptor - 对应博客的适配器,例如:SiYuanApiAdaptor + */ + constructor(apiAdaptor: IBlogApi); + /** + * 博客配置列表 + */ + getUsersBlogs(): Promise>; + /** + * 最新文章数目 + * + * @param keyword - 关键字(可选,部分平台不支持搜索) + */ + getRecentPostsCount(keyword?: string): Promise; + /** + * 最新文章 + * + * @param numOfPosts - 文章数目 + * @param page - 页码(可选,从0开始,部分平台不支持分页) + * @param keyword - 关键字(可选,部分平台不支持搜索) + */ + getRecentPosts(numOfPosts: number, page?: number, keyword?: string): Promise>; + /** + * 发布文章 + * + * @param post - 文章 + * @param publish - 可选,是否发布 + */ + newPost(post: Post, publish?: boolean): Promise; + /** + * 文章详情 + * @param postid - postid + * @param useSlug - 是否使用的是别名(可选,部分平台不支持) + */ + getPost(postid: string, useSlug?: boolean): Promise; + /** + * 更新文章 + * + * @param postid - 文章id + * @param post - 文章 + * @param publish - 可选,是否发布 + */ + editPost(postid: string, post: Post, publish?: boolean): Promise; + /** + * 删除文章 + * + * @param postid - 文章ID + */ + deletePost(postid: string): Promise; + /** + * 获取分类列表 + */ + getCategories(): Promise; + /** + * 获取预览链接 + * + * @param postid - 文章ID + */ + getPreviewUrl(postid: string): Promise; + /** + * 上传附件 + * + * @param mediaObject + */ + newMediaObject(mediaObject: MediaObject): Promise; +} +export default BlogAdaptor; diff --git a/public/libs/zhi-blog-api/lib/blogApi.d.ts b/public/libs/zhi-blog-api/lib/blogApi.d.ts new file mode 100644 index 0000000..9572d37 --- /dev/null +++ b/public/libs/zhi-blog-api/lib/blogApi.d.ts @@ -0,0 +1,21 @@ +import { IBlogApi } from "./IBlogApi"; +import Post from "./models/post"; +import CategoryInfo from "./models/categoryInfo"; +import UserBlog from "./models/userBlog"; +import MediaObject from "./models/mediaObject"; +/** + * 博客基类 + */ +declare class BlogApi implements IBlogApi { + deletePost(postid: string): Promise; + editPost(postid: string, post: Post, publish?: boolean): Promise; + getCategories(): Promise; + getPost(postid: string, useSlug?: boolean): Promise; + getPreviewUrl(postid: string): Promise; + getRecentPosts(numOfPosts: number, page?: number, keyword?: string): Promise>; + getRecentPostsCount(keyword?: string): Promise; + getUsersBlogs(): Promise>; + newMediaObject(mediaObject: MediaObject): Promise; + newPost(post: Post, publish?: boolean): Promise; +} +export default BlogApi; diff --git a/public/libs/zhi-blog-api/lib/blogConfig.d.ts b/public/libs/zhi-blog-api/lib/blogConfig.d.ts new file mode 100644 index 0000000..d01adfc --- /dev/null +++ b/public/libs/zhi-blog-api/lib/blogConfig.d.ts @@ -0,0 +1,98 @@ +import BlogPlaceholder from "./blogPlaceholder"; +/** + * 页面类型 + */ +export declare enum PageType { + /** + * Markdown正文 + */ + Markdown = 0, + /** + * HTML + */ + Html = 1, + /** + * 属性 + */ + Formatter = 2, + /** + * Markdown和属性 + */ + Markdown_And_Formatter = 3, + /** + * MDX + * + * @see {@link https://mdxjs.com/ mdx} + */ + MDX = 4 +} +/** + * 密码类型 + */ +export declare enum PasswordType { + /** + * 密码 + */ + PasswordType_Password = 0, + /** + * token + */ + PasswordType_Token = 1 +} +/** + * 博客通用配置类 + */ +declare abstract class BlogConfig { + /** + * 首页 + */ + protected home: string; + /** + * API地址 + */ + protected apiUrl: string; + /** + * 用户名 + */ + protected username: string; + /** + * 密码类型 + */ + protected passwordType: PasswordType; + /** + * 密码 + */ + protected password: string; + /** + * 是否发布 + */ + protected apiStatus: boolean; + /** + * 博客名(API获取) + */ + protected blogName: string; + /** + * 文章别名key + */ + protected posidKey: string; + /** + * 文章预览链接 + */ + protected previewUrl: string; + /** + * 文章类型 + */ + protected pageType: PageType; + /** + * 操作提示 + */ + protected placeholder: BlogPlaceholder | undefined; + /** + * 是否处理标题 + * + * @protected + */ + protected fixTitle: boolean; + protected constructor(); +} +export default BlogConfig; diff --git a/public/libs/zhi-blog-api/lib/blogConstants.d.ts b/public/libs/zhi-blog-api/lib/blogConstants.d.ts new file mode 100644 index 0000000..1ef63fa --- /dev/null +++ b/public/libs/zhi-blog-api/lib/blogConstants.d.ts @@ -0,0 +1,14 @@ +/** + * 博客通用常量定义 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class BlogConstants { + /** + * 博客类型 + */ + static DEFAULT_BLOG_TYPE_KEY: string; +} +export default BlogConstants; diff --git a/public/libs/zhi-blog-api/lib/blogPlaceholder.d.ts b/public/libs/zhi-blog-api/lib/blogPlaceholder.d.ts new file mode 100644 index 0000000..7b9e314 --- /dev/null +++ b/public/libs/zhi-blog-api/lib/blogPlaceholder.d.ts @@ -0,0 +1,50 @@ +/** + * 配置提示 + * + * @author terwer + * @since 1.0.0 + */ +declare abstract class BlogPlaceholder { + /** + * 首页操作提示 + */ + protected homePlaceholder: string; + /** + * API 地址操作提示 + */ + protected apiUrlPlaceholder: string; + /** + * 用户名操作提示 + */ + protected usernamePlaceholder: string; + /** + * 密码类型操作提示 + */ + protected passwordTypePlaceholder: string; + /** + * 密码操作提示 + */ + protected passwordPlaceholder: string; + /** + * API状态是否正常操作提示 + */ + protected apiStatusPlaceholder: boolean; + /** + * 博客名(API获取)操作提示 + */ + protected blogNamePlaceholder: string; + /** + * 文章别名key操作提示 + */ + protected posidKeyPlaceholder: string; + /** + * 文章预览链接操作提示 + */ + protected previewUrlPlaceholder: string; + /** + * 文章类型操作提示 + */ + protected pageTypePlaceholder: string; + constructor(); +} +export default BlogPlaceholder; diff --git a/public/libs/zhi-blog-api/lib/enums/blogTypeEnum.d.ts b/public/libs/zhi-blog-api/lib/enums/blogTypeEnum.d.ts new file mode 100644 index 0000000..50f7fca --- /dev/null +++ b/public/libs/zhi-blog-api/lib/enums/blogTypeEnum.d.ts @@ -0,0 +1,22 @@ +/** + * 博客类型枚举 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare enum BlogTypeEnum { + /** + * 思源笔记 + */ + BlogTypeEnum_Siyuan = "siyuan", + /** + * Metaweblog + */ + BlogTypeEnum_Metaweblog = "metaweblog", + /** + * WordPress + */ + BlogTypeEnum_Wordpress = "wordpress" +} +export default BlogTypeEnum; diff --git a/public/libs/zhi-blog-api/lib/enums/postStatusEnum.d.ts b/public/libs/zhi-blog-api/lib/enums/postStatusEnum.d.ts new file mode 100644 index 0000000..e027b6d --- /dev/null +++ b/public/libs/zhi-blog-api/lib/enums/postStatusEnum.d.ts @@ -0,0 +1,18 @@ +/** + * 文章状态枚举 + */ +declare enum PostStatusEnum { + /** + * 已发布 + */ + PostStatusEnum_Publish = "publish", + /** + * 草稿 + */ + PostStatusEnum_Draft = "draft", + /** + * 继承 + */ + PostStatusEnum_Inherit = "inherit" +} +export default PostStatusEnum; diff --git a/public/libs/zhi-blog-api/lib/models/categoryInfo.d.ts b/public/libs/zhi-blog-api/lib/models/categoryInfo.d.ts new file mode 100644 index 0000000..5b25f12 --- /dev/null +++ b/public/libs/zhi-blog-api/lib/models/categoryInfo.d.ts @@ -0,0 +1,39 @@ +/** + * 通用分类模型定义 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class CategoryInfo { + /** + * 分类ID + */ + categoryId: string; + /** + * 父分类ID + */ + parentId: string; + /** + * 分类名称 + */ + description: string; + /** + * 分类英文名 + */ + categoryName: string; + /** + * 分类详情 + */ + categoryDescription: string; + /** + * 分类地址 + */ + htmlUrl: string; + /** + * 分类订阅地址 + */ + rssUrl: string; + constructor(); +} +export default CategoryInfo; diff --git a/public/libs/zhi-blog-api/lib/models/mediaObject.d.ts b/public/libs/zhi-blog-api/lib/models/mediaObject.d.ts new file mode 100644 index 0000000..cbb47a5 --- /dev/null +++ b/public/libs/zhi-blog-api/lib/models/mediaObject.d.ts @@ -0,0 +1,42 @@ +/// +/** + * 媒体文件 + * + * ```ts + * const url = "./testdata/photo.jpg"; + * const file = fs.readFileSync(url) + * const data = { + * name: "20220616-132401-001.jpg", + * type: "image/jpeg", + * bits: file, + * overwrite: true + * } + * + * // return + * { + * attachment_id: '4108', + * date_created_gmt: 2022-06-15T21:25:23.000Z, + * parent: 0, + * link: 'https://terwergreen.files.wordpress.com/2022/06/20220616-132401-001.jpg', + * title: '20220616-132401-001.jpg', + * caption: '', + * description: '', + * metadata: { filesize: 113032 }, + * type: 'image/jpeg', + * thumbnail: 'https://terwergreen.files.wordpress.com/2022/06/20220616-132401-001.jpg?w=150', + * id: '4108', + * file: '20220616-132401-001.jpg', + * url: 'http://terwergreen.files.wordpress.com/2022/06/20220616-132401-001.jpg' + * } + * ``` + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class MediaObject { + name: string; + type: string; + bits: Buffer; + constructor(name: string, type: string, bits: Buffer); +} +export default MediaObject; diff --git a/public/libs/zhi-blog-api/lib/models/post.d.ts b/public/libs/zhi-blog-api/lib/models/post.d.ts new file mode 100644 index 0000000..56c673d --- /dev/null +++ b/public/libs/zhi-blog-api/lib/models/post.d.ts @@ -0,0 +1,70 @@ +import PostStatusEnum from "../enums/postStatusEnum"; +/** + * 通用文章模型定义 + * + * @public + */ +declare class Post { + /** + * 文章ID + */ + postid: string; + /** + * 标题 + */ + title: string; + /** + * 逗号分隔的标签 + */ + mt_keywords: string; + /** + * 链接 + */ + link?: string; + /** + * 永久链接 + */ + permalink: string; + /** + * 摘要 + */ + shortDesc?: string; + /** + * 描述 + */ + description: string; + /** + * 短评 + */ + mt_excerpt?: string; + /** + * 别名 + */ + wp_slug: string; + /** + * 创建时间 + */ + dateCreated: Date; + /** + * 分类 + */ + categories: Array; + /** + * 更多 + */ + mt_text_more?: string; + /** + * 发布状态 + */ + post_status?: PostStatusEnum; + /** + * 是否发布 + */ + isPublished: boolean; + /** + * 发布密码 + */ + wp_password: string; + constructor(); +} +export default Post; diff --git a/public/libs/zhi-blog-api/lib/models/siteConfig.d.ts b/public/libs/zhi-blog-api/lib/models/siteConfig.d.ts new file mode 100644 index 0000000..6132eaa --- /dev/null +++ b/public/libs/zhi-blog-api/lib/models/siteConfig.d.ts @@ -0,0 +1,44 @@ +import UserBlog from "./userBlog"; +/** + * 站点信息定义 + */ +declare class SiteConfig { + /** + * 博客信息 + */ + userBlog: UserBlog; + /** + * 域名 + */ + domain: string; + /** + * 站点链接 + */ + weburl: string; + /** + * 站点主题 + */ + webtheme: string; + /** + * 站点名称 + */ + webname: string; + /** + * 站点口号 + */ + webslogen: string; + /** + * 关键字 + */ + keywords: string; + /** + * 描述 + */ + description: string; + /** + * 备案信息 + */ + beianinfo: string; + constructor(); +} +export default SiteConfig; diff --git a/public/libs/zhi-blog-api/lib/models/userBlog.d.ts b/public/libs/zhi-blog-api/lib/models/userBlog.d.ts new file mode 100644 index 0000000..7929c6e --- /dev/null +++ b/public/libs/zhi-blog-api/lib/models/userBlog.d.ts @@ -0,0 +1,29 @@ +/** + * 博客信息定义 + * + * @public + */ +declare class UserBlog { + /** + * 博客ID + */ + blogid: string; + /** + * 博客地址 + */ + url: string; + /** + * 博客名称 + */ + blogName: string; + /** + * 是否是管理员 + */ + isAdmin?: boolean; + /** + * xmlrpc地址 + */ + xmlrpc?: string; + constructor(); +} +export default UserBlog; diff --git a/public/libs/zhi-blog-api/lib/utils/ZhiBlogApiUtil.d.ts b/public/libs/zhi-blog-api/lib/utils/ZhiBlogApiUtil.d.ts new file mode 100644 index 0000000..f628170 --- /dev/null +++ b/public/libs/zhi-blog-api/lib/utils/ZhiBlogApiUtil.d.ts @@ -0,0 +1,13 @@ +import { ZhiUtil } from "zhi-common"; +import { Env } from "zhi-env"; +/** + * 工具类统一入口,每个应用自己实现 + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare class ZhiBlogApiUtil extends ZhiUtil { + static zhiEnv(): Env; +} +export default ZhiBlogApiUtil; diff --git a/public/libs/zhi-blog-api/lib/zhi-blog-api.d.ts b/public/libs/zhi-blog-api/lib/zhi-blog-api.d.ts new file mode 100644 index 0000000..a10984f --- /dev/null +++ b/public/libs/zhi-blog-api/lib/zhi-blog-api.d.ts @@ -0,0 +1,2 @@ +import BlogAdaptor from "./blogAdaptor"; +export default BlogAdaptor; diff --git a/public/libs/zhi-blog-api/package.json b/public/libs/zhi-blog-api/package.json new file mode 100644 index 0000000..d83a978 --- /dev/null +++ b/public/libs/zhi-blog-api/package.json @@ -0,0 +1,39 @@ +{ + "name": "zhi-blog-api", + "version": "1.2.0", + "type": "module", + "description": "a common blog interface", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "repository": "terwer/zhi", + "homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-blog-api", + "author": "terwer", + "license": "GPL", + "files": [ + "dist", + "README.md" + ], + "keywords": [ + "zhi", + "lib", + "blog", + "api" + ], + "scripts": { + "serve": "vite", + "dev": "vite build --watch", + "build": "vite build", + "start": "vite preview", + "test": "vitest --watch" + }, + "devDependencies": { + "@terwer/eslint-config-custom": "workspace:*", + "@terwer/tsconfig": "workspace:*", + "@terwer/vite-config-custom": "workspace:*" + }, + "dependencies": { + "zhi-env": "workspace:*", + "zhi-log": "workspace:*", + "zhi-common": "workspace:*" + } +} diff --git a/public/libs/zhi-common/README.md b/public/libs/zhi-common/README.md new file mode 100644 index 0000000..2d19961 --- /dev/null +++ b/public/libs/zhi-common/README.md @@ -0,0 +1,51 @@ +# zhi-common + +a collection of util tools + +## Usage + +```ts +import { zhiCommon } from "zhi-common" + +const dateUtil = zhiCommon.dateUtil +const now = dateUtil.nowDateZh() +console.log("now=>", now) +``` + +## Deps + +``` +├── zhi-device +├── zhi-env +├── zhi-log +├── lute +├── showdown +├── compare-versions +├── ajv +``` + +## Dev + +```bash +pnpm dev -F zhi-common +``` + +## Build + +```bash +pnpm build -F zhi-common +``` + +## Test + +Execute the unit tests via [vitest](https://vitest.dev) + +```bash +pnpm test -F zhi-common +``` + +## Publish + +```bash +pnpm publish -F zhi-common --tag latest +``` \ No newline at end of file diff --git a/public/libs/zhi-common/index.d.ts b/public/libs/zhi-common/index.d.ts new file mode 100644 index 0000000..c77721e --- /dev/null +++ b/public/libs/zhi-common/index.d.ts @@ -0,0 +1,4 @@ +import ZhiCommon from "./lib/zhi-common"; +import ZhiUtil from "./lib/ZhiUtil"; +export { ZhiCommon }; +export { ZhiUtil }; diff --git a/public/libs/zhi-common/index.js b/public/libs/zhi-common/index.js new file mode 100644 index 0000000..415f4fb --- /dev/null +++ b/public/libs/zhi-common/index.js @@ -0,0 +1,8914 @@ +var Ts = Object.defineProperty; +var js = (e, r, n) => r in e ? Ts(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n; +var be = (e, r, n) => (js(e, typeof r != "symbol" ? r + "" : r, n), n); +var kn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function Pn(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var zt = { exports: {} }, Sn = {}, qe = {}, Rr = {}, et = {}, se = {}, xr = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0; + class r { + } + e._CodeOrName = r, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; + class n extends r { + constructor(O) { + if (super(), !e.IDENTIFIER.test(O)) + throw new Error("CodeGen: name must be a valid identifier"); + this.str = O; + } + toString() { + return this.str; + } + emptyStr() { + return !1; + } + get names() { + return { [this.str]: 1 }; + } + } + e.Name = n; + class a extends r { + constructor(O) { + super(), this._items = typeof O == "string" ? [O] : O; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) + return !1; + const O = this._items[0]; + return O === "" || O === '""'; + } + get str() { + var O; + return (O = this._str) !== null && O !== void 0 ? O : this._str = this._items.reduce((D, t) => `${D}${t}`, ""); + } + get names() { + var O; + return (O = this._names) !== null && O !== void 0 ? O : this._names = this._items.reduce((D, t) => (t instanceof n && (D[t.str] = (D[t.str] || 0) + 1), D), {}); + } + } + e._Code = a, e.nil = new a(""); + function u($, ...O) { + const D = [$[0]]; + let t = 0; + for (; t < O.length; ) + y(D, O[t]), D.push($[++t]); + return new a(D); + } + e._ = u; + const o = new a("+"); + function p($, ...O) { + const D = [L($[0])]; + let t = 0; + for (; t < O.length; ) + D.push(o), y(D, O[t]), D.push(o, L($[++t])); + return b(D), new a(D); + } + e.str = p; + function y($, O) { + O instanceof a ? $.push(...O._items) : O instanceof n ? $.push(O) : $.push(S(O)); + } + e.addCodeArg = y; + function b($) { + let O = 1; + for (; O < $.length - 1; ) { + if ($[O] === o) { + const D = v($[O - 1], $[O + 1]); + if (D !== void 0) { + $.splice(O - 1, 3, D); + continue; + } + $[O++] = "+"; + } + O++; + } + } + function v($, O) { + if (O === '""') + return $; + if ($ === '""') + return O; + if (typeof $ == "string") + return O instanceof n || $[$.length - 1] !== '"' ? void 0 : typeof O != "string" ? `${$.slice(0, -1)}${O}"` : O[0] === '"' ? $.slice(0, -1) + O.slice(1) : void 0; + if (typeof O == "string" && O[0] === '"' && !($ instanceof n)) + return `"${$}${O.slice(1)}`; + } + function g($, O) { + return O.emptyStr() ? $ : $.emptyStr() ? O : p`${$}${O}`; + } + e.strConcat = g; + function S($) { + return typeof $ == "number" || typeof $ == "boolean" || $ === null ? $ : L(Array.isArray($) ? $.join(",") : $); + } + function z($) { + return new a(L($)); + } + e.stringify = z; + function L($) { + return JSON.stringify($).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); + } + e.safeStringify = L; + function R($) { + return typeof $ == "string" && e.IDENTIFIER.test($) ? new a(`.${$}`) : u`[${$}]`; + } + e.getProperty = R; + function j($) { + if (typeof $ == "string" && e.IDENTIFIER.test($)) + return new a(`${$}`); + throw new Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`); + } + e.getEsmExportName = j; + function T($) { + return new a($.toString()); + } + e.regexpCode = T; +})(xr); +var Vt = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0; + const r = xr; + class n extends Error { + constructor(v) { + super(`CodeGen: "code" for ${v} not defined`), this.value = v.value; + } + } + var a; + (function(b) { + b[b.Started = 0] = "Started", b[b.Completed = 1] = "Completed"; + })(a = e.UsedValueState || (e.UsedValueState = {})), e.varKinds = { + const: new r.Name("const"), + let: new r.Name("let"), + var: new r.Name("var") + }; + class u { + constructor({ prefixes: v, parent: g } = {}) { + this._names = {}, this._prefixes = v, this._parent = g; + } + toName(v) { + return v instanceof r.Name ? v : this.name(v); + } + name(v) { + return new r.Name(this._newName(v)); + } + _newName(v) { + const g = this._names[v] || this._nameGroup(v); + return `${v}${g.index++}`; + } + _nameGroup(v) { + var g, S; + if (!((S = (g = this._parent) === null || g === void 0 ? void 0 : g._prefixes) === null || S === void 0) && S.has(v) || this._prefixes && !this._prefixes.has(v)) + throw new Error(`CodeGen: prefix "${v}" is not allowed in this scope`); + return this._names[v] = { prefix: v, index: 0 }; + } + } + e.Scope = u; + class o extends r.Name { + constructor(v, g) { + super(g), this.prefix = v; + } + setValue(v, { property: g, itemIndex: S }) { + this.value = v, this.scopePath = (0, r._)`.${new r.Name(g)}[${S}]`; + } + } + e.ValueScopeName = o; + const p = (0, r._)`\n`; + class y extends u { + constructor(v) { + super(v), this._values = {}, this._scope = v.scope, this.opts = { ...v, _n: v.lines ? p : r.nil }; + } + get() { + return this._scope; + } + name(v) { + return new o(v, this._newName(v)); + } + value(v, g) { + var S; + if (g.ref === void 0) + throw new Error("CodeGen: ref must be passed in value"); + const z = this.toName(v), { prefix: L } = z, R = (S = g.key) !== null && S !== void 0 ? S : g.ref; + let j = this._values[L]; + if (j) { + const O = j.get(R); + if (O) + return O; + } else + j = this._values[L] = /* @__PURE__ */ new Map(); + j.set(R, z); + const T = this._scope[L] || (this._scope[L] = []), $ = T.length; + return T[$] = g.ref, z.setValue(g, { property: L, itemIndex: $ }), z; + } + getValue(v, g) { + const S = this._values[v]; + if (S) + return S.get(g); + } + scopeRefs(v, g = this._values) { + return this._reduceValues(g, (S) => { + if (S.scopePath === void 0) + throw new Error(`CodeGen: name "${S}" has no value`); + return (0, r._)`${v}${S.scopePath}`; + }); + } + scopeCode(v = this._values, g, S) { + return this._reduceValues(v, (z) => { + if (z.value === void 0) + throw new Error(`CodeGen: name "${z}" has no value`); + return z.value.code; + }, g, S); + } + _reduceValues(v, g, S = {}, z) { + let L = r.nil; + for (const R in v) { + const j = v[R]; + if (!j) + continue; + const T = S[R] = S[R] || /* @__PURE__ */ new Map(); + j.forEach(($) => { + if (T.has($)) + return; + T.set($, a.Started); + let O = g($); + if (O) { + const D = this.opts.es5 ? e.varKinds.var : e.varKinds.const; + L = (0, r._)`${L}${D} ${$} = ${O};${this.opts._n}`; + } else if (O = z == null ? void 0 : z($)) + L = (0, r._)`${L}${O}${this.opts._n}`; + else + throw new n($); + T.set($, a.Completed); + }); + } + return L; + } + } + e.ValueScope = y; +})(Vt); +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.or = e.and = e.not = e.CodeGen = e.operators = e.varKinds = e.ValueScopeName = e.ValueScope = e.Scope = e.Name = e.regexpCode = e.stringify = e.getProperty = e.nil = e.strConcat = e.str = e._ = void 0; + const r = xr, n = Vt; + var a = xr; + Object.defineProperty(e, "_", { enumerable: !0, get: function() { + return a._; + } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { + return a.str; + } }), Object.defineProperty(e, "strConcat", { enumerable: !0, get: function() { + return a.strConcat; + } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { + return a.nil; + } }), Object.defineProperty(e, "getProperty", { enumerable: !0, get: function() { + return a.getProperty; + } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { + return a.stringify; + } }), Object.defineProperty(e, "regexpCode", { enumerable: !0, get: function() { + return a.regexpCode; + } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { + return a.Name; + } }); + var u = Vt; + Object.defineProperty(e, "Scope", { enumerable: !0, get: function() { + return u.Scope; + } }), Object.defineProperty(e, "ValueScope", { enumerable: !0, get: function() { + return u.ValueScope; + } }), Object.defineProperty(e, "ValueScopeName", { enumerable: !0, get: function() { + return u.ValueScopeName; + } }), Object.defineProperty(e, "varKinds", { enumerable: !0, get: function() { + return u.varKinds; + } }), e.operators = { + GT: new r._Code(">"), + GTE: new r._Code(">="), + LT: new r._Code("<"), + LTE: new r._Code("<="), + EQ: new r._Code("==="), + NEQ: new r._Code("!=="), + NOT: new r._Code("!"), + OR: new r._Code("||"), + AND: new r._Code("&&"), + ADD: new r._Code("+") + }; + class o { + optimizeNodes() { + return this; + } + optimizeNames(l, w) { + return this; + } + } + class p extends o { + constructor(l, w, I) { + super(), this.varKind = l, this.name = w, this.rhs = I; + } + render({ es5: l, _n: w }) { + const I = l ? n.varKinds.var : this.varKind, K = this.rhs === void 0 ? "" : ` = ${this.rhs}`; + return `${I} ${this.name}${K};` + w; + } + optimizeNames(l, w) { + if (l[this.name.str]) + return this.rhs && (this.rhs = V(this.rhs, l, w)), this; + } + get names() { + return this.rhs instanceof r._CodeOrName ? this.rhs.names : {}; + } + } + class y extends o { + constructor(l, w, I) { + super(), this.lhs = l, this.rhs = w, this.sideEffects = I; + } + render({ _n: l }) { + return `${this.lhs} = ${this.rhs};` + l; + } + optimizeNames(l, w) { + if (!(this.lhs instanceof r.Name && !l[this.lhs.str] && !this.sideEffects)) + return this.rhs = V(this.rhs, l, w), this; + } + get names() { + const l = this.lhs instanceof r.Name ? {} : { ...this.lhs.names }; + return H(l, this.rhs); + } + } + class b extends y { + constructor(l, w, I, K) { + super(l, I, K), this.op = w; + } + render({ _n: l }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + l; + } + } + class v extends o { + constructor(l) { + super(), this.label = l, this.names = {}; + } + render({ _n: l }) { + return `${this.label}:` + l; + } + } + class g extends o { + constructor(l) { + super(), this.label = l, this.names = {}; + } + render({ _n: l }) { + return `break${this.label ? ` ${this.label}` : ""};` + l; + } + } + class S extends o { + constructor(l) { + super(), this.error = l; + } + render({ _n: l }) { + return `throw ${this.error};` + l; + } + get names() { + return this.error.names; + } + } + class z extends o { + constructor(l) { + super(), this.code = l; + } + render({ _n: l }) { + return `${this.code};` + l; + } + optimizeNodes() { + return `${this.code}` ? this : void 0; + } + optimizeNames(l, w) { + return this.code = V(this.code, l, w), this; + } + get names() { + return this.code instanceof r._CodeOrName ? this.code.names : {}; + } + } + class L extends o { + constructor(l = []) { + super(), this.nodes = l; + } + render(l) { + return this.nodes.reduce((w, I) => w + I.render(l), ""); + } + optimizeNodes() { + const { nodes: l } = this; + let w = l.length; + for (; w--; ) { + const I = l[w].optimizeNodes(); + Array.isArray(I) ? l.splice(w, 1, ...I) : I ? l[w] = I : l.splice(w, 1); + } + return l.length > 0 ? this : void 0; + } + optimizeNames(l, w) { + const { nodes: I } = this; + let K = I.length; + for (; K--; ) { + const W = I[K]; + W.optimizeNames(l, w) || (G(l, W.names), I.splice(K, 1)); + } + return I.length > 0 ? this : void 0; + } + get names() { + return this.nodes.reduce((l, w) => U(l, w.names), {}); + } + } + class R extends L { + render(l) { + return "{" + l._n + super.render(l) + "}" + l._n; + } + } + class j extends L { + } + class T extends R { + } + T.kind = "else"; + class $ extends R { + constructor(l, w) { + super(w), this.condition = l; + } + render(l) { + let w = `if(${this.condition})` + super.render(l); + return this.else && (w += "else " + this.else.render(l)), w; + } + optimizeNodes() { + super.optimizeNodes(); + const l = this.condition; + if (l === !0) + return this.nodes; + let w = this.else; + if (w) { + const I = w.optimizeNodes(); + w = this.else = Array.isArray(I) ? new T(I) : I; + } + if (w) + return l === !1 ? w instanceof $ ? w : w.nodes : this.nodes.length ? this : new $(_(l), w instanceof $ ? [w] : w.nodes); + if (!(l === !1 || !this.nodes.length)) + return this; + } + optimizeNames(l, w) { + var I; + if (this.else = (I = this.else) === null || I === void 0 ? void 0 : I.optimizeNames(l, w), !!(super.optimizeNames(l, w) || this.else)) + return this.condition = V(this.condition, l, w), this; + } + get names() { + const l = super.names; + return H(l, this.condition), this.else && U(l, this.else.names), l; + } + } + $.kind = "if"; + class O extends R { + } + O.kind = "for"; + class D extends O { + constructor(l) { + super(), this.iteration = l; + } + render(l) { + return `for(${this.iteration})` + super.render(l); + } + optimizeNames(l, w) { + if (super.optimizeNames(l, w)) + return this.iteration = V(this.iteration, l, w), this; + } + get names() { + return U(super.names, this.iteration.names); + } + } + class t extends O { + constructor(l, w, I, K) { + super(), this.varKind = l, this.name = w, this.from = I, this.to = K; + } + render(l) { + const w = l.es5 ? n.varKinds.var : this.varKind, { name: I, from: K, to: W } = this; + return `for(${w} ${I}=${K}; ${I}<${W}; ${I}++)` + super.render(l); + } + get names() { + const l = H(super.names, this.from); + return H(l, this.to); + } + } + class d extends O { + constructor(l, w, I, K) { + super(), this.loop = l, this.varKind = w, this.name = I, this.iterable = K; + } + render(l) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(l); + } + optimizeNames(l, w) { + if (super.optimizeNames(l, w)) + return this.iterable = V(this.iterable, l, w), this; + } + get names() { + return U(super.names, this.iterable.names); + } + } + class s extends R { + constructor(l, w, I) { + super(), this.name = l, this.args = w, this.async = I; + } + render(l) { + return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(l); + } + } + s.kind = "func"; + class i extends L { + render(l) { + return "return " + super.render(l); + } + } + i.kind = "return"; + class c extends R { + render(l) { + let w = "try" + super.render(l); + return this.catch && (w += this.catch.render(l)), this.finally && (w += this.finally.render(l)), w; + } + optimizeNodes() { + var l, w; + return super.optimizeNodes(), (l = this.catch) === null || l === void 0 || l.optimizeNodes(), (w = this.finally) === null || w === void 0 || w.optimizeNodes(), this; + } + optimizeNames(l, w) { + var I, K; + return super.optimizeNames(l, w), (I = this.catch) === null || I === void 0 || I.optimizeNames(l, w), (K = this.finally) === null || K === void 0 || K.optimizeNames(l, w), this; + } + get names() { + const l = super.names; + return this.catch && U(l, this.catch.names), this.finally && U(l, this.finally.names), l; + } + } + class m extends R { + constructor(l) { + super(), this.error = l; + } + render(l) { + return `catch(${this.error})` + super.render(l); + } + } + m.kind = "catch"; + class h extends R { + render(l) { + return "finally" + super.render(l); + } + } + h.kind = "finally"; + class C { + constructor(l, w = {}) { + this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...w, _n: w.lines ? ` +` : "" }, this._extScope = l, this._scope = new n.Scope({ parent: l }), this._nodes = [new j()]; + } + toString() { + return this._root.render(this.opts); + } + // returns unique name in the internal scope + name(l) { + return this._scope.name(l); + } + // reserves unique name in the external scope + scopeName(l) { + return this._extScope.name(l); + } + // reserves unique name in the external scope and assigns value to it + scopeValue(l, w) { + const I = this._extScope.value(l, w); + return (this._values[I.prefix] || (this._values[I.prefix] = /* @__PURE__ */ new Set())).add(I), I; + } + getScopeValue(l, w) { + return this._extScope.getValue(l, w); + } + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(l) { + return this._extScope.scopeRefs(l, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(l, w, I, K) { + const W = this._scope.toName(w); + return I !== void 0 && K && (this._constants[W.str] = I), this._leafNode(new p(l, W, I)), W; + } + // `const` declaration (`var` in es5 mode) + const(l, w, I) { + return this._def(n.varKinds.const, l, w, I); + } + // `let` declaration with optional assignment (`var` in es5 mode) + let(l, w, I) { + return this._def(n.varKinds.let, l, w, I); + } + // `var` declaration with optional assignment + var(l, w, I) { + return this._def(n.varKinds.var, l, w, I); + } + // assignment code + assign(l, w, I) { + return this._leafNode(new y(l, w, I)); + } + // `+=` code + add(l, w) { + return this._leafNode(new b(l, e.operators.ADD, w)); + } + // appends passed SafeExpr to code or executes Block + code(l) { + return typeof l == "function" ? l() : l !== r.nil && this._leafNode(new z(l)), this; + } + // returns code for object literal for the passed argument list of key-value pairs + object(...l) { + const w = ["{"]; + for (const [I, K] of l) + w.length > 1 && w.push(","), w.push(I), (I !== K || this.opts.es5) && (w.push(":"), (0, r.addCodeArg)(w, K)); + return w.push("}"), new r._Code(w); + } + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(l, w, I) { + if (this._blockNode(new $(l)), w && I) + this.code(w).else().code(I).endIf(); + else if (w) + this.code(w).endIf(); + else if (I) + throw new Error('CodeGen: "else" body without "then" body'); + return this; + } + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(l) { + return this._elseNode(new $(l)); + } + // `else` clause - only valid after `if` or `else if` clauses + else() { + return this._elseNode(new T()); + } + // end `if` statement (needed if gen.if was used only with condition) + endIf() { + return this._endBlockNode($, T); + } + _for(l, w) { + return this._blockNode(l), w && this.code(w).endFor(), this; + } + // a generic `for` clause (or statement if `forBody` is passed) + for(l, w) { + return this._for(new D(l), w); + } + // `for` statement for a range of values + forRange(l, w, I, K, W = this.opts.es5 ? n.varKinds.var : n.varKinds.let) { + const re = this._scope.toName(l); + return this._for(new t(W, re, w, I), () => K(re)); + } + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf(l, w, I, K = n.varKinds.const) { + const W = this._scope.toName(l); + if (this.opts.es5) { + const re = w instanceof r.Name ? w : this.var("_arr", w); + return this.forRange("_i", 0, (0, r._)`${re}.length`, (ae) => { + this.var(W, (0, r._)`${re}[${ae}]`), I(W); + }); + } + return this._for(new d("of", K, W, w), () => I(W)); + } + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn(l, w, I, K = this.opts.es5 ? n.varKinds.var : n.varKinds.const) { + if (this.opts.ownProperties) + return this.forOf(l, (0, r._)`Object.keys(${w})`, I); + const W = this._scope.toName(l); + return this._for(new d("in", K, W, w), () => I(W)); + } + // end `for` loop + endFor() { + return this._endBlockNode(O); + } + // `label` statement + label(l) { + return this._leafNode(new v(l)); + } + // `break` statement + break(l) { + return this._leafNode(new g(l)); + } + // `return` statement + return(l) { + const w = new i(); + if (this._blockNode(w), this.code(l), w.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(i); + } + // `try` statement + try(l, w, I) { + if (!w && !I) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const K = new c(); + if (this._blockNode(K), this.code(l), w) { + const W = this.name("e"); + this._currNode = K.catch = new m(W), w(W); + } + return I && (this._currNode = K.finally = new h(), this.code(I)), this._endBlockNode(m, h); + } + // `throw` statement + throw(l) { + return this._leafNode(new S(l)); + } + // start self-balancing block + block(l, w) { + return this._blockStarts.push(this._nodes.length), l && this.code(l).endBlock(w), this; + } + // end the current self-balancing block + endBlock(l) { + const w = this._blockStarts.pop(); + if (w === void 0) + throw new Error("CodeGen: not in self-balancing block"); + const I = this._nodes.length - w; + if (I < 0 || l !== void 0 && I !== l) + throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${l} expected`); + return this._nodes.length = w, this; + } + // `function` heading (or definition if funcBody is passed) + func(l, w = r.nil, I, K) { + return this._blockNode(new s(l, w, I)), K && this.code(K).endFunc(), this; + } + // end function definition + endFunc() { + return this._endBlockNode(s); + } + optimize(l = 1) { + for (; l-- > 0; ) + this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants); + } + _leafNode(l) { + return this._currNode.nodes.push(l), this; + } + _blockNode(l) { + this._currNode.nodes.push(l), this._nodes.push(l); + } + _endBlockNode(l, w) { + const I = this._currNode; + if (I instanceof l || w && I instanceof w) + return this._nodes.pop(), this; + throw new Error(`CodeGen: not in block "${w ? `${l.kind}/${w.kind}` : l.kind}"`); + } + _elseNode(l) { + const w = this._currNode; + if (!(w instanceof $)) + throw new Error('CodeGen: "else" without "if"'); + return this._currNode = w.else = l, this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const l = this._nodes; + return l[l.length - 1]; + } + set _currNode(l) { + const w = this._nodes; + w[w.length - 1] = l; + } + } + e.CodeGen = C; + function U(N, l) { + for (const w in l) + N[w] = (N[w] || 0) + (l[w] || 0); + return N; + } + function H(N, l) { + return l instanceof r._CodeOrName ? U(N, l.names) : N; + } + function V(N, l, w) { + if (N instanceof r.Name) + return I(N); + if (!K(N)) + return N; + return new r._Code(N._items.reduce((W, re) => (re instanceof r.Name && (re = I(re)), re instanceof r._Code ? W.push(...re._items) : W.push(re), W), [])); + function I(W) { + const re = w[W.str]; + return re === void 0 || l[W.str] !== 1 ? W : (delete l[W.str], re); + } + function K(W) { + return W instanceof r._Code && W._items.some((re) => re instanceof r.Name && l[re.str] === 1 && w[re.str] !== void 0); + } + } + function G(N, l) { + for (const w in l) + N[w] = (N[w] || 0) - (l[w] || 0); + } + function _(N) { + return typeof N == "boolean" || typeof N == "number" || N === null ? !N : (0, r._)`!${F(N)}`; + } + e.not = _; + const q = k(e.operators.AND); + function J(...N) { + return N.reduce(q); + } + e.and = J; + const Z = k(e.operators.OR); + function B(...N) { + return N.reduce(Z); + } + e.or = B; + function k(N) { + return (l, w) => l === r.nil ? w : w === r.nil ? l : (0, r._)`${F(l)} ${N} ${F(w)}`; + } + function F(N) { + return N instanceof r.Name ? N : (0, r._)`(${N})`; + } +})(se); +var ie = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0; + const r = se, n = xr; + function a(s) { + const i = {}; + for (const c of s) + i[c] = !0; + return i; + } + e.toHash = a; + function u(s, i) { + return typeof i == "boolean" ? i : Object.keys(i).length === 0 ? !0 : (o(s, i), !p(i, s.self.RULES.all)); + } + e.alwaysValidSchema = u; + function o(s, i = s.schema) { + const { opts: c, self: m } = s; + if (!c.strictSchema || typeof i == "boolean") + return; + const h = m.RULES.keywords; + for (const C in i) + h[C] || d(s, `unknown keyword: "${C}"`); + } + e.checkUnknownRules = o; + function p(s, i) { + if (typeof s == "boolean") + return !s; + for (const c in s) + if (i[c]) + return !0; + return !1; + } + e.schemaHasRules = p; + function y(s, i) { + if (typeof s == "boolean") + return !s; + for (const c in s) + if (c !== "$ref" && i.all[c]) + return !0; + return !1; + } + e.schemaHasRulesButRef = y; + function b({ topSchemaRef: s, schemaPath: i }, c, m, h) { + if (!h) { + if (typeof c == "number" || typeof c == "boolean") + return c; + if (typeof c == "string") + return (0, r._)`${c}`; + } + return (0, r._)`${s}${i}${(0, r.getProperty)(m)}`; + } + e.schemaRefOrVal = b; + function v(s) { + return z(decodeURIComponent(s)); + } + e.unescapeFragment = v; + function g(s) { + return encodeURIComponent(S(s)); + } + e.escapeFragment = g; + function S(s) { + return typeof s == "number" ? `${s}` : s.replace(/~/g, "~0").replace(/\//g, "~1"); + } + e.escapeJsonPointer = S; + function z(s) { + return s.replace(/~1/g, "/").replace(/~0/g, "~"); + } + e.unescapeJsonPointer = z; + function L(s, i) { + if (Array.isArray(s)) + for (const c of s) + i(c); + else + i(s); + } + e.eachItem = L; + function R({ mergeNames: s, mergeToName: i, mergeValues: c, resultToName: m }) { + return (h, C, U, H) => { + const V = U === void 0 ? C : U instanceof r.Name ? (C instanceof r.Name ? s(h, C, U) : i(h, C, U), U) : C instanceof r.Name ? (i(h, U, C), C) : c(C, U); + return H === r.Name && !(V instanceof r.Name) ? m(h, V) : V; + }; + } + e.mergeEvaluated = { + props: R({ + mergeNames: (s, i, c) => s.if((0, r._)`${c} !== true && ${i} !== undefined`, () => { + s.if((0, r._)`${i} === true`, () => s.assign(c, !0), () => s.assign(c, (0, r._)`${c} || {}`).code((0, r._)`Object.assign(${c}, ${i})`)); + }), + mergeToName: (s, i, c) => s.if((0, r._)`${c} !== true`, () => { + i === !0 ? s.assign(c, !0) : (s.assign(c, (0, r._)`${c} || {}`), T(s, c, i)); + }), + mergeValues: (s, i) => s === !0 ? !0 : { ...s, ...i }, + resultToName: j + }), + items: R({ + mergeNames: (s, i, c) => s.if((0, r._)`${c} !== true && ${i} !== undefined`, () => s.assign(c, (0, r._)`${i} === true ? true : ${c} > ${i} ? ${c} : ${i}`)), + mergeToName: (s, i, c) => s.if((0, r._)`${c} !== true`, () => s.assign(c, i === !0 ? !0 : (0, r._)`${c} > ${i} ? ${c} : ${i}`)), + mergeValues: (s, i) => s === !0 ? !0 : Math.max(s, i), + resultToName: (s, i) => s.var("items", i) + }) + }; + function j(s, i) { + if (i === !0) + return s.var("props", !0); + const c = s.var("props", (0, r._)`{}`); + return i !== void 0 && T(s, c, i), c; + } + e.evaluatedPropsToName = j; + function T(s, i, c) { + Object.keys(c).forEach((m) => s.assign((0, r._)`${i}${(0, r.getProperty)(m)}`, !0)); + } + e.setEvaluated = T; + const $ = {}; + function O(s, i) { + return s.scopeValue("func", { + ref: i, + code: $[i.code] || ($[i.code] = new n._Code(i.code)) + }); + } + e.useFunc = O; + var D; + (function(s) { + s[s.Num = 0] = "Num", s[s.Str = 1] = "Str"; + })(D = e.Type || (e.Type = {})); + function t(s, i, c) { + if (s instanceof r.Name) { + const m = i === D.Num; + return c ? m ? (0, r._)`"[" + ${s} + "]"` : (0, r._)`"['" + ${s} + "']"` : m ? (0, r._)`"/" + ${s}` : (0, r._)`"/" + ${s}.replace(/~/g, "~0").replace(/\\//g, "~1")`; + } + return c ? (0, r.getProperty)(s).toString() : "/" + S(s); + } + e.getErrorPath = t; + function d(s, i, c = s.opts.strictSchema) { + if (c) { + if (i = `strict mode: ${i}`, c === !0) + throw new Error(i); + s.self.logger.warn(i); + } + } + e.checkStrictMode = d; +})(ie); +var Qe = {}; +Object.defineProperty(Qe, "__esModule", { value: !0 }); +const Pe = se, Os = { + // validation function arguments + data: new Pe.Name("data"), + // args passed from referencing schema + valCxt: new Pe.Name("valCxt"), + instancePath: new Pe.Name("instancePath"), + parentData: new Pe.Name("parentData"), + parentDataProperty: new Pe.Name("parentDataProperty"), + rootData: new Pe.Name("rootData"), + dynamicAnchors: new Pe.Name("dynamicAnchors"), + // function scoped variables + vErrors: new Pe.Name("vErrors"), + errors: new Pe.Name("errors"), + this: new Pe.Name("this"), + // "globals" + self: new Pe.Name("self"), + scope: new Pe.Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new Pe.Name("json"), + jsonPos: new Pe.Name("jsonPos"), + jsonLen: new Pe.Name("jsonLen"), + jsonPart: new Pe.Name("jsonPart") +}; +Qe.default = Os; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0; + const r = se, n = ie, a = Qe; + e.keywordError = { + message: ({ keyword: T }) => (0, r.str)`must pass "${T}" keyword validation` + }, e.keyword$DataError = { + message: ({ keyword: T, schemaType: $ }) => $ ? (0, r.str)`"${T}" keyword must be ${$} ($data)` : (0, r.str)`"${T}" keyword is invalid ($data)` + }; + function u(T, $ = e.keywordError, O, D) { + const { it: t } = T, { gen: d, compositeRule: s, allErrors: i } = t, c = S(T, $, O); + D ?? (s || i) ? b(d, c) : v(t, (0, r._)`[${c}]`); + } + e.reportError = u; + function o(T, $ = e.keywordError, O) { + const { it: D } = T, { gen: t, compositeRule: d, allErrors: s } = D, i = S(T, $, O); + b(t, i), d || s || v(D, a.default.vErrors); + } + e.reportExtraError = o; + function p(T, $) { + T.assign(a.default.errors, $), T.if((0, r._)`${a.default.vErrors} !== null`, () => T.if($, () => T.assign((0, r._)`${a.default.vErrors}.length`, $), () => T.assign(a.default.vErrors, null))); + } + e.resetErrorsCount = p; + function y({ gen: T, keyword: $, schemaValue: O, data: D, errsCount: t, it: d }) { + if (t === void 0) + throw new Error("ajv implementation error"); + const s = T.name("err"); + T.forRange("i", t, a.default.errors, (i) => { + T.const(s, (0, r._)`${a.default.vErrors}[${i}]`), T.if((0, r._)`${s}.instancePath === undefined`, () => T.assign((0, r._)`${s}.instancePath`, (0, r.strConcat)(a.default.instancePath, d.errorPath))), T.assign((0, r._)`${s}.schemaPath`, (0, r.str)`${d.errSchemaPath}/${$}`), d.opts.verbose && (T.assign((0, r._)`${s}.schema`, O), T.assign((0, r._)`${s}.data`, D)); + }); + } + e.extendErrors = y; + function b(T, $) { + const O = T.const("err", $); + T.if((0, r._)`${a.default.vErrors} === null`, () => T.assign(a.default.vErrors, (0, r._)`[${O}]`), (0, r._)`${a.default.vErrors}.push(${O})`), T.code((0, r._)`${a.default.errors}++`); + } + function v(T, $) { + const { gen: O, validateName: D, schemaEnv: t } = T; + t.$async ? O.throw((0, r._)`new ${T.ValidationError}(${$})`) : (O.assign((0, r._)`${D}.errors`, $), O.return(!1)); + } + const g = { + keyword: new r.Name("keyword"), + schemaPath: new r.Name("schemaPath"), + params: new r.Name("params"), + propertyName: new r.Name("propertyName"), + message: new r.Name("message"), + schema: new r.Name("schema"), + parentSchema: new r.Name("parentSchema") + }; + function S(T, $, O) { + const { createErrors: D } = T.it; + return D === !1 ? (0, r._)`{}` : z(T, $, O); + } + function z(T, $, O = {}) { + const { gen: D, it: t } = T, d = [ + L(t, O), + R(T, O) + ]; + return j(T, $, d), D.object(...d); + } + function L({ errorPath: T }, { instancePath: $ }) { + const O = $ ? (0, r.str)`${T}${(0, n.getErrorPath)($, n.Type.Str)}` : T; + return [a.default.instancePath, (0, r.strConcat)(a.default.instancePath, O)]; + } + function R({ keyword: T, it: { errSchemaPath: $ } }, { schemaPath: O, parentSchema: D }) { + let t = D ? $ : (0, r.str)`${$}/${T}`; + return O && (t = (0, r.str)`${t}${(0, n.getErrorPath)(O, n.Type.Str)}`), [g.schemaPath, t]; + } + function j(T, { params: $, message: O }, D) { + const { keyword: t, data: d, schemaValue: s, it: i } = T, { opts: c, propertyName: m, topSchemaRef: h, schemaPath: C } = i; + D.push([g.keyword, t], [g.params, typeof $ == "function" ? $(T) : $ || (0, r._)`{}`]), c.messages && D.push([g.message, typeof O == "function" ? O(T) : O]), c.verbose && D.push([g.schema, s], [g.parentSchema, (0, r._)`${h}${C}`], [a.default.data, d]), m && D.push([g.propertyName, m]); + } +})(et); +Object.defineProperty(Rr, "__esModule", { value: !0 }); +Rr.boolOrEmptySchema = Rr.topBoolOrEmptySchema = void 0; +const Ns = et, Rs = se, As = Qe, Is = { + message: "boolean schema is false" +}; +function Ms(e) { + const { gen: r, schema: n, validateName: a } = e; + n === !1 ? Cn(e, !1) : typeof n == "object" && n.$async === !0 ? r.return(As.default.data) : (r.assign((0, Rs._)`${a}.errors`, null), r.return(!0)); +} +Rr.topBoolOrEmptySchema = Ms; +function Ds(e, r) { + const { gen: n, schema: a } = e; + a === !1 ? (n.var(r, !1), Cn(e)) : n.var(r, !0); +} +Rr.boolOrEmptySchema = Ds; +function Cn(e, r) { + const { gen: n, data: a } = e, u = { + gen: n, + keyword: "false schema", + data: a, + schema: !1, + schemaCode: !1, + schemaValue: !1, + params: {}, + it: e + }; + (0, Ns.reportError)(u, Is, void 0, r); +} +var rt = {}, vr = {}; +Object.defineProperty(vr, "__esModule", { value: !0 }); +vr.getRules = vr.isJSONType = void 0; +const Ls = ["string", "number", "integer", "boolean", "null", "object", "array"], zs = new Set(Ls); +function Vs(e) { + return typeof e == "string" && zs.has(e); +} +vr.isJSONType = Vs; +function Fs() { + const e = { + number: { type: "number", rules: [] }, + string: { type: "string", rules: [] }, + array: { type: "array", rules: [] }, + object: { type: "object", rules: [] } + }; + return { + types: { ...e, integer: !0, boolean: !0, null: !0 }, + rules: [{ rules: [] }, e.number, e.string, e.array, e.object], + post: { rules: [] }, + all: {}, + keywords: {} + }; +} +vr.getRules = Fs; +var rr = {}; +Object.defineProperty(rr, "__esModule", { value: !0 }); +rr.shouldUseRule = rr.shouldUseGroup = rr.schemaHasRulesForType = void 0; +function Us({ schema: e, self: r }, n) { + const a = r.RULES.types[n]; + return a && a !== !0 && Tn(e, a); +} +rr.schemaHasRulesForType = Us; +function Tn(e, r) { + return r.rules.some((n) => jn(e, n)); +} +rr.shouldUseGroup = Tn; +function jn(e, r) { + var n; + return e[r.keyword] !== void 0 || ((n = r.definition.implements) === null || n === void 0 ? void 0 : n.some((a) => e[a] !== void 0)); +} +rr.shouldUseRule = jn; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0; + const r = vr, n = rr, a = et, u = se, o = ie; + var p; + (function(D) { + D[D.Correct = 0] = "Correct", D[D.Wrong = 1] = "Wrong"; + })(p = e.DataType || (e.DataType = {})); + function y(D) { + const t = b(D.type); + if (t.includes("null")) { + if (D.nullable === !1) + throw new Error("type: null contradicts nullable: false"); + } else { + if (!t.length && D.nullable !== void 0) + throw new Error('"nullable" cannot be used without "type"'); + D.nullable === !0 && t.push("null"); + } + return t; + } + e.getSchemaTypes = y; + function b(D) { + const t = Array.isArray(D) ? D : D ? [D] : []; + if (t.every(r.isJSONType)) + return t; + throw new Error("type must be JSONType or JSONType[]: " + t.join(",")); + } + e.getJSONTypes = b; + function v(D, t) { + const { gen: d, data: s, opts: i } = D, c = S(t, i.coerceTypes), m = t.length > 0 && !(c.length === 0 && t.length === 1 && (0, n.schemaHasRulesForType)(D, t[0])); + if (m) { + const h = j(t, s, i.strictNumbers, p.Wrong); + d.if(h, () => { + c.length ? z(D, t, c) : $(D); + }); + } + return m; + } + e.coerceAndCheckDataType = v; + const g = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]); + function S(D, t) { + return t ? D.filter((d) => g.has(d) || t === "array" && d === "array") : []; + } + function z(D, t, d) { + const { gen: s, data: i, opts: c } = D, m = s.let("dataType", (0, u._)`typeof ${i}`), h = s.let("coerced", (0, u._)`undefined`); + c.coerceTypes === "array" && s.if((0, u._)`${m} == 'object' && Array.isArray(${i}) && ${i}.length == 1`, () => s.assign(i, (0, u._)`${i}[0]`).assign(m, (0, u._)`typeof ${i}`).if(j(t, i, c.strictNumbers), () => s.assign(h, i))), s.if((0, u._)`${h} !== undefined`); + for (const U of d) + (g.has(U) || U === "array" && c.coerceTypes === "array") && C(U); + s.else(), $(D), s.endIf(), s.if((0, u._)`${h} !== undefined`, () => { + s.assign(i, h), L(D, h); + }); + function C(U) { + switch (U) { + case "string": + s.elseIf((0, u._)`${m} == "number" || ${m} == "boolean"`).assign(h, (0, u._)`"" + ${i}`).elseIf((0, u._)`${i} === null`).assign(h, (0, u._)`""`); + return; + case "number": + s.elseIf((0, u._)`${m} == "boolean" || ${i} === null + || (${m} == "string" && ${i} && ${i} == +${i})`).assign(h, (0, u._)`+${i}`); + return; + case "integer": + s.elseIf((0, u._)`${m} === "boolean" || ${i} === null + || (${m} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(h, (0, u._)`+${i}`); + return; + case "boolean": + s.elseIf((0, u._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(h, !1).elseIf((0, u._)`${i} === "true" || ${i} === 1`).assign(h, !0); + return; + case "null": + s.elseIf((0, u._)`${i} === "" || ${i} === 0 || ${i} === false`), s.assign(h, null); + return; + case "array": + s.elseIf((0, u._)`${m} === "string" || ${m} === "number" + || ${m} === "boolean" || ${i} === null`).assign(h, (0, u._)`[${i}]`); + } + } + } + function L({ gen: D, parentData: t, parentDataProperty: d }, s) { + D.if((0, u._)`${t} !== undefined`, () => D.assign((0, u._)`${t}[${d}]`, s)); + } + function R(D, t, d, s = p.Correct) { + const i = s === p.Correct ? u.operators.EQ : u.operators.NEQ; + let c; + switch (D) { + case "null": + return (0, u._)`${t} ${i} null`; + case "array": + c = (0, u._)`Array.isArray(${t})`; + break; + case "object": + c = (0, u._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`; + break; + case "integer": + c = m((0, u._)`!(${t} % 1) && !isNaN(${t})`); + break; + case "number": + c = m(); + break; + default: + return (0, u._)`typeof ${t} ${i} ${D}`; + } + return s === p.Correct ? c : (0, u.not)(c); + function m(h = u.nil) { + return (0, u.and)((0, u._)`typeof ${t} == "number"`, h, d ? (0, u._)`isFinite(${t})` : u.nil); + } + } + e.checkDataType = R; + function j(D, t, d, s) { + if (D.length === 1) + return R(D[0], t, d, s); + let i; + const c = (0, o.toHash)(D); + if (c.array && c.object) { + const m = (0, u._)`typeof ${t} != "object"`; + i = c.null ? m : (0, u._)`!${t} || ${m}`, delete c.null, delete c.array, delete c.object; + } else + i = u.nil; + c.number && delete c.integer; + for (const m in c) + i = (0, u.and)(i, R(m, t, d, s)); + return i; + } + e.checkDataTypes = j; + const T = { + message: ({ schema: D }) => `must be ${D}`, + params: ({ schema: D, schemaValue: t }) => typeof D == "string" ? (0, u._)`{type: ${D}}` : (0, u._)`{type: ${t}}` + }; + function $(D) { + const t = O(D); + (0, a.reportError)(t, T); + } + e.reportTypeError = $; + function O(D) { + const { gen: t, data: d, schema: s } = D, i = (0, o.schemaRefOrVal)(D, s, "type"); + return { + gen: t, + keyword: "type", + data: d, + schema: s.type, + schemaCode: i, + schemaValue: i, + parentSchema: s, + params: {}, + it: D + }; + } +})(rt); +var Ct = {}; +Object.defineProperty(Ct, "__esModule", { value: !0 }); +Ct.assignDefaults = void 0; +const Sr = se, Bs = ie; +function Hs(e, r) { + const { properties: n, items: a } = e.schema; + if (r === "object" && n) + for (const u in n) + Ka(e, u, n[u].default); + else + r === "array" && Array.isArray(a) && a.forEach((u, o) => Ka(e, o, u.default)); +} +Ct.assignDefaults = Hs; +function Ka(e, r, n) { + const { gen: a, compositeRule: u, data: o, opts: p } = e; + if (n === void 0) + return; + const y = (0, Sr._)`${o}${(0, Sr.getProperty)(r)}`; + if (u) { + (0, Bs.checkStrictMode)(e, `default is ignored for: ${y}`); + return; + } + let b = (0, Sr._)`${y} === undefined`; + p.useDefaults === "empty" && (b = (0, Sr._)`${b} || ${y} === null || ${y} === ""`), a.if(b, (0, Sr._)`${y} = ${(0, Sr.stringify)(n)}`); +} +var Xe = {}, ne = {}; +Object.defineProperty(ne, "__esModule", { value: !0 }); +ne.validateUnion = ne.validateArray = ne.usePattern = ne.callValidateCode = ne.schemaProperties = ne.allSchemaProperties = ne.noPropertyInData = ne.propertyInData = ne.isOwnProperty = ne.hasPropFunc = ne.reportMissingProp = ne.checkMissingProp = ne.checkReportMissingProp = void 0; +const pe = se, Kt = ie, nr = Qe, qs = ie; +function Gs(e, r) { + const { gen: n, data: a, it: u } = e; + n.if(Jt(n, a, r, u.opts.ownProperties), () => { + e.setParams({ missingProperty: (0, pe._)`${r}` }, !0), e.error(); + }); +} +ne.checkReportMissingProp = Gs; +function Ks({ gen: e, data: r, it: { opts: n } }, a, u) { + return (0, pe.or)(...a.map((o) => (0, pe.and)(Jt(e, r, o, n.ownProperties), (0, pe._)`${u} = ${o}`))); +} +ne.checkMissingProp = Ks; +function Ws(e, r) { + e.setParams({ missingProperty: r }, !0), e.error(); +} +ne.reportMissingProp = Ws; +function On(e) { + return e.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: (0, pe._)`Object.prototype.hasOwnProperty` + }); +} +ne.hasPropFunc = On; +function Wt(e, r, n) { + return (0, pe._)`${On(e)}.call(${r}, ${n})`; +} +ne.isOwnProperty = Wt; +function Js(e, r, n, a) { + const u = (0, pe._)`${r}${(0, pe.getProperty)(n)} !== undefined`; + return a ? (0, pe._)`${u} && ${Wt(e, r, n)}` : u; +} +ne.propertyInData = Js; +function Jt(e, r, n, a) { + const u = (0, pe._)`${r}${(0, pe.getProperty)(n)} === undefined`; + return a ? (0, pe.or)(u, (0, pe.not)(Wt(e, r, n))) : u; +} +ne.noPropertyInData = Jt; +function Nn(e) { + return e ? Object.keys(e).filter((r) => r !== "__proto__") : []; +} +ne.allSchemaProperties = Nn; +function Zs(e, r) { + return Nn(r).filter((n) => !(0, Kt.alwaysValidSchema)(e, r[n])); +} +ne.schemaProperties = Zs; +function Ys({ schemaCode: e, data: r, it: { gen: n, topSchemaRef: a, schemaPath: u, errorPath: o }, it: p }, y, b, v) { + const g = v ? (0, pe._)`${e}, ${r}, ${a}${u}` : r, S = [ + [nr.default.instancePath, (0, pe.strConcat)(nr.default.instancePath, o)], + [nr.default.parentData, p.parentData], + [nr.default.parentDataProperty, p.parentDataProperty], + [nr.default.rootData, nr.default.rootData] + ]; + p.opts.dynamicRef && S.push([nr.default.dynamicAnchors, nr.default.dynamicAnchors]); + const z = (0, pe._)`${g}, ${n.object(...S)}`; + return b !== pe.nil ? (0, pe._)`${y}.call(${b}, ${z})` : (0, pe._)`${y}(${z})`; +} +ne.callValidateCode = Ys; +const Xs = (0, pe._)`new RegExp`; +function Qs({ gen: e, it: { opts: r } }, n) { + const a = r.unicodeRegExp ? "u" : "", { regExp: u } = r.code, o = u(n, a); + return e.scopeValue("pattern", { + key: o.toString(), + ref: o, + code: (0, pe._)`${u.code === "new RegExp" ? Xs : (0, qs.useFunc)(e, u)}(${n}, ${a})` + }); +} +ne.usePattern = Qs; +function xs(e) { + const { gen: r, data: n, keyword: a, it: u } = e, o = r.name("valid"); + if (u.allErrors) { + const y = r.let("valid", !0); + return p(() => r.assign(y, !1)), y; + } + return r.var(o, !0), p(() => r.break()), o; + function p(y) { + const b = r.const("len", (0, pe._)`${n}.length`); + r.forRange("i", 0, b, (v) => { + e.subschema({ + keyword: a, + dataProp: v, + dataPropType: Kt.Type.Num + }, o), r.if((0, pe.not)(o), y); + }); + } +} +ne.validateArray = xs; +function ed(e) { + const { gen: r, schema: n, keyword: a, it: u } = e; + if (!Array.isArray(n)) + throw new Error("ajv implementation error"); + if (n.some((b) => (0, Kt.alwaysValidSchema)(u, b)) && !u.opts.unevaluated) + return; + const p = r.let("valid", !1), y = r.name("_valid"); + r.block(() => n.forEach((b, v) => { + const g = e.subschema({ + keyword: a, + schemaProp: v, + compositeRule: !0 + }, y); + r.assign(p, (0, pe._)`${p} || ${y}`), e.mergeValidEvaluated(g, y) || r.if((0, pe.not)(p)); + })), e.result(p, () => e.reset(), () => e.error(!0)); +} +ne.validateUnion = ed; +Object.defineProperty(Xe, "__esModule", { value: !0 }); +Xe.validateKeywordUsage = Xe.validSchemaType = Xe.funcKeywordCode = Xe.macroKeywordCode = void 0; +const Se = se, mr = Qe, rd = ne, td = et; +function ad(e, r) { + const { gen: n, keyword: a, schema: u, parentSchema: o, it: p } = e, y = r.macro.call(p.self, u, o, p), b = Rn(n, a, y); + p.opts.validateSchema !== !1 && p.self.validateSchema(y, !0); + const v = n.name("valid"); + e.subschema({ + schema: y, + schemaPath: Se.nil, + errSchemaPath: `${p.errSchemaPath}/${a}`, + topSchemaRef: b, + compositeRule: !0 + }, v), e.pass(v, () => e.error(!0)); +} +Xe.macroKeywordCode = ad; +function nd(e, r) { + var n; + const { gen: a, keyword: u, schema: o, parentSchema: p, $data: y, it: b } = e; + dd(b, r); + const v = !y && r.compile ? r.compile.call(b.self, o, p, b) : r.validate, g = Rn(a, u, v), S = a.let("valid"); + e.block$data(S, z), e.ok((n = r.valid) !== null && n !== void 0 ? n : S); + function z() { + if (r.errors === !1) + j(), r.modifying && Wa(e), T(() => e.error()); + else { + const $ = r.async ? L() : R(); + r.modifying && Wa(e), T(() => sd(e, $)); + } + } + function L() { + const $ = a.let("ruleErrs", null); + return a.try(() => j((0, Se._)`await `), (O) => a.assign(S, !1).if((0, Se._)`${O} instanceof ${b.ValidationError}`, () => a.assign($, (0, Se._)`${O}.errors`), () => a.throw(O))), $; + } + function R() { + const $ = (0, Se._)`${g}.errors`; + return a.assign($, null), j(Se.nil), $; + } + function j($ = r.async ? (0, Se._)`await ` : Se.nil) { + const O = b.opts.passContext ? mr.default.this : mr.default.self, D = !("compile" in r && !y || r.schema === !1); + a.assign(S, (0, Se._)`${$}${(0, rd.callValidateCode)(e, g, O, D)}`, r.modifying); + } + function T($) { + var O; + a.if((0, Se.not)((O = r.valid) !== null && O !== void 0 ? O : S), $); + } +} +Xe.funcKeywordCode = nd; +function Wa(e) { + const { gen: r, data: n, it: a } = e; + r.if(a.parentData, () => r.assign(n, (0, Se._)`${a.parentData}[${a.parentDataProperty}]`)); +} +function sd(e, r) { + const { gen: n } = e; + n.if((0, Se._)`Array.isArray(${r})`, () => { + n.assign(mr.default.vErrors, (0, Se._)`${mr.default.vErrors} === null ? ${r} : ${mr.default.vErrors}.concat(${r})`).assign(mr.default.errors, (0, Se._)`${mr.default.vErrors}.length`), (0, td.extendErrors)(e); + }, () => e.error()); +} +function dd({ schemaEnv: e }, r) { + if (r.async && !e.$async) + throw new Error("async keyword in sync schema"); +} +function Rn(e, r, n) { + if (n === void 0) + throw new Error(`keyword "${r}" failed to compile`); + return e.scopeValue("keyword", typeof n == "function" ? { ref: n } : { ref: n, code: (0, Se.stringify)(n) }); +} +function ud(e, r, n = !1) { + return !r.length || r.some((a) => a === "array" ? Array.isArray(e) : a === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == a || n && typeof e > "u"); +} +Xe.validSchemaType = ud; +function id({ schema: e, opts: r, self: n, errSchemaPath: a }, u, o) { + if (Array.isArray(u.keyword) ? !u.keyword.includes(o) : u.keyword !== o) + throw new Error("ajv implementation error"); + const p = u.dependencies; + if (p != null && p.some((y) => !Object.prototype.hasOwnProperty.call(e, y))) + throw new Error(`parent schema must have dependencies of ${o}: ${p.join(",")}`); + if (u.validateSchema && !u.validateSchema(e[o])) { + const b = `keyword "${o}" value is invalid at path "${a}": ` + n.errorsText(u.validateSchema.errors); + if (r.validateSchema === "log") + n.logger.error(b); + else + throw new Error(b); + } +} +Xe.validateKeywordUsage = id; +var ir = {}; +Object.defineProperty(ir, "__esModule", { value: !0 }); +ir.extendSubschemaMode = ir.extendSubschemaData = ir.getSubschema = void 0; +const Ye = se, An = ie; +function od(e, { keyword: r, schemaProp: n, schema: a, schemaPath: u, errSchemaPath: o, topSchemaRef: p }) { + if (r !== void 0 && a !== void 0) + throw new Error('both "keyword" and "schema" passed, only one allowed'); + if (r !== void 0) { + const y = e.schema[r]; + return n === void 0 ? { + schema: y, + schemaPath: (0, Ye._)`${e.schemaPath}${(0, Ye.getProperty)(r)}`, + errSchemaPath: `${e.errSchemaPath}/${r}` + } : { + schema: y[n], + schemaPath: (0, Ye._)`${e.schemaPath}${(0, Ye.getProperty)(r)}${(0, Ye.getProperty)(n)}`, + errSchemaPath: `${e.errSchemaPath}/${r}/${(0, An.escapeFragment)(n)}` + }; + } + if (a !== void 0) { + if (u === void 0 || o === void 0 || p === void 0) + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + return { + schema: a, + schemaPath: u, + topSchemaRef: p, + errSchemaPath: o + }; + } + throw new Error('either "keyword" or "schema" must be passed'); +} +ir.getSubschema = od; +function cd(e, r, { dataProp: n, dataPropType: a, data: u, dataTypes: o, propertyName: p }) { + if (u !== void 0 && n !== void 0) + throw new Error('both "data" and "dataProp" passed, only one allowed'); + const { gen: y } = r; + if (n !== void 0) { + const { errorPath: v, dataPathArr: g, opts: S } = r, z = y.let("data", (0, Ye._)`${r.data}${(0, Ye.getProperty)(n)}`, !0); + b(z), e.errorPath = (0, Ye.str)`${v}${(0, An.getErrorPath)(n, a, S.jsPropertySyntax)}`, e.parentDataProperty = (0, Ye._)`${n}`, e.dataPathArr = [...g, e.parentDataProperty]; + } + if (u !== void 0) { + const v = u instanceof Ye.Name ? u : y.let("data", u, !0); + b(v), p !== void 0 && (e.propertyName = p); + } + o && (e.dataTypes = o); + function b(v) { + e.data = v, e.dataLevel = r.dataLevel + 1, e.dataTypes = [], r.definedProperties = /* @__PURE__ */ new Set(), e.parentData = r.data, e.dataNames = [...r.dataNames, v]; + } +} +ir.extendSubschemaData = cd; +function ld(e, { jtdDiscriminator: r, jtdMetadata: n, compositeRule: a, createErrors: u, allErrors: o }) { + a !== void 0 && (e.compositeRule = a), u !== void 0 && (e.createErrors = u), o !== void 0 && (e.allErrors = o), e.jtdDiscriminator = r, e.jtdMetadata = n; +} +ir.extendSubschemaMode = ld; +var ke = {}, In = function e(r, n) { + if (r === n) + return !0; + if (r && n && typeof r == "object" && typeof n == "object") { + if (r.constructor !== n.constructor) + return !1; + var a, u, o; + if (Array.isArray(r)) { + if (a = r.length, a != n.length) + return !1; + for (u = a; u-- !== 0; ) + if (!e(r[u], n[u])) + return !1; + return !0; + } + if (r.constructor === RegExp) + return r.source === n.source && r.flags === n.flags; + if (r.valueOf !== Object.prototype.valueOf) + return r.valueOf() === n.valueOf(); + if (r.toString !== Object.prototype.toString) + return r.toString() === n.toString(); + if (o = Object.keys(r), a = o.length, a !== Object.keys(n).length) + return !1; + for (u = a; u-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(n, o[u])) + return !1; + for (u = a; u-- !== 0; ) { + var p = o[u]; + if (!e(r[p], n[p])) + return !1; + } + return !0; + } + return r !== r && n !== n; +}, Mn = { exports: {} }, ur = Mn.exports = function(e, r, n) { + typeof r == "function" && (n = r, r = {}), n = r.cb || n; + var a = typeof n == "function" ? n : n.pre || function() { + }, u = n.post || function() { + }; + mt(r, a, u, e, "", e); +}; +ur.keywords = { + additionalItems: !0, + items: !0, + contains: !0, + additionalProperties: !0, + propertyNames: !0, + not: !0, + if: !0, + then: !0, + else: !0 +}; +ur.arrayKeywords = { + items: !0, + allOf: !0, + anyOf: !0, + oneOf: !0 +}; +ur.propsKeywords = { + $defs: !0, + definitions: !0, + properties: !0, + patternProperties: !0, + dependencies: !0 +}; +ur.skipKeywords = { + default: !0, + enum: !0, + const: !0, + required: !0, + maximum: !0, + minimum: !0, + exclusiveMaximum: !0, + exclusiveMinimum: !0, + multipleOf: !0, + maxLength: !0, + minLength: !0, + pattern: !0, + format: !0, + maxItems: !0, + minItems: !0, + uniqueItems: !0, + maxProperties: !0, + minProperties: !0 +}; +function mt(e, r, n, a, u, o, p, y, b, v) { + if (a && typeof a == "object" && !Array.isArray(a)) { + r(a, u, o, p, y, b, v); + for (var g in a) { + var S = a[g]; + if (Array.isArray(S)) { + if (g in ur.arrayKeywords) + for (var z = 0; z < S.length; z++) + mt(e, r, n, S[z], u + "/" + g + "/" + z, o, u, g, a, z); + } else if (g in ur.propsKeywords) { + if (S && typeof S == "object") + for (var L in S) + mt(e, r, n, S[L], u + "/" + g + "/" + fd(L), o, u, g, a, L); + } else + (g in ur.keywords || e.allKeys && !(g in ur.skipKeywords)) && mt(e, r, n, S, u + "/" + g, o, u, g, a); + } + n(a, u, o, p, y, b, v); + } +} +function fd(e) { + return e.replace(/~/g, "~0").replace(/\//g, "~1"); +} +var hd = Mn.exports; +Object.defineProperty(ke, "__esModule", { value: !0 }); +ke.getSchemaRefs = ke.resolveUrl = ke.normalizeId = ke._getFullPath = ke.getFullPath = ke.inlineRef = void 0; +const pd = ie, md = In, gd = hd, _d = /* @__PURE__ */ new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const" +]); +function vd(e, r = !0) { + return typeof e == "boolean" ? !0 : r === !0 ? !Ft(e) : r ? Dn(e) <= r : !1; +} +ke.inlineRef = vd; +const yd = /* @__PURE__ */ new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor" +]); +function Ft(e) { + for (const r in e) { + if (yd.has(r)) + return !0; + const n = e[r]; + if (Array.isArray(n) && n.some(Ft) || typeof n == "object" && Ft(n)) + return !0; + } + return !1; +} +function Dn(e) { + let r = 0; + for (const n in e) { + if (n === "$ref") + return 1 / 0; + if (r++, !_d.has(n) && (typeof e[n] == "object" && (0, pd.eachItem)(e[n], (a) => r += Dn(a)), r === 1 / 0)) + return 1 / 0; + } + return r; +} +function Ln(e, r = "", n) { + n !== !1 && (r = Or(r)); + const a = e.parse(r); + return zn(e, a); +} +ke.getFullPath = Ln; +function zn(e, r) { + return e.serialize(r).split("#")[0] + "#"; +} +ke._getFullPath = zn; +const wd = /#\/?$/; +function Or(e) { + return e ? e.replace(wd, "") : ""; +} +ke.normalizeId = Or; +function bd(e, r, n) { + return n = Or(n), e.resolve(r, n); +} +ke.resolveUrl = bd; +const $d = /^[a-z_][-a-z0-9._]*$/i; +function Ed(e, r) { + if (typeof e == "boolean") + return {}; + const { schemaId: n, uriResolver: a } = this.opts, u = Or(e[n] || r), o = { "": u }, p = Ln(a, u, !1), y = {}, b = /* @__PURE__ */ new Set(); + return gd(e, { allKeys: !0 }, (S, z, L, R) => { + if (R === void 0) + return; + const j = p + z; + let T = o[R]; + typeof S[n] == "string" && (T = $.call(this, S[n])), O.call(this, S.$anchor), O.call(this, S.$dynamicAnchor), o[z] = T; + function $(D) { + const t = this.opts.uriResolver.resolve; + if (D = Or(T ? t(T, D) : D), b.has(D)) + throw g(D); + b.add(D); + let d = this.refs[D]; + return typeof d == "string" && (d = this.refs[d]), typeof d == "object" ? v(S, d.schema, D) : D !== Or(j) && (D[0] === "#" ? (v(S, y[D], D), y[D] = S) : this.refs[D] = j), D; + } + function O(D) { + if (typeof D == "string") { + if (!$d.test(D)) + throw new Error(`invalid anchor "${D}"`); + $.call(this, `#${D}`); + } + } + }), y; + function v(S, z, L) { + if (z !== void 0 && !md(S, z)) + throw g(L); + } + function g(S) { + return new Error(`reference "${S}" resolves to more than one schema`); + } +} +ke.getSchemaRefs = Ed; +Object.defineProperty(qe, "__esModule", { value: !0 }); +qe.getData = qe.KeywordCxt = qe.validateFunctionCode = void 0; +const Vn = Rr, Ja = rt, Zt = rr, wt = rt, kd = Ct, Jr = Xe, Rt = ir, Y = se, x = Qe, Pd = ke, tr = ie, Gr = et; +function Sd(e) { + if (Bn(e) && (Hn(e), Un(e))) { + jd(e); + return; + } + Fn(e, () => (0, Vn.topBoolOrEmptySchema)(e)); +} +qe.validateFunctionCode = Sd; +function Fn({ gen: e, validateName: r, schema: n, schemaEnv: a, opts: u }, o) { + u.code.es5 ? e.func(r, (0, Y._)`${x.default.data}, ${x.default.valCxt}`, a.$async, () => { + e.code((0, Y._)`"use strict"; ${Za(n, u)}`), Td(e, u), e.code(o); + }) : e.func(r, (0, Y._)`${x.default.data}, ${Cd(u)}`, a.$async, () => e.code(Za(n, u)).code(o)); +} +function Cd(e) { + return (0, Y._)`{${x.default.instancePath}="", ${x.default.parentData}, ${x.default.parentDataProperty}, ${x.default.rootData}=${x.default.data}${e.dynamicRef ? (0, Y._)`, ${x.default.dynamicAnchors}={}` : Y.nil}}={}`; +} +function Td(e, r) { + e.if(x.default.valCxt, () => { + e.var(x.default.instancePath, (0, Y._)`${x.default.valCxt}.${x.default.instancePath}`), e.var(x.default.parentData, (0, Y._)`${x.default.valCxt}.${x.default.parentData}`), e.var(x.default.parentDataProperty, (0, Y._)`${x.default.valCxt}.${x.default.parentDataProperty}`), e.var(x.default.rootData, (0, Y._)`${x.default.valCxt}.${x.default.rootData}`), r.dynamicRef && e.var(x.default.dynamicAnchors, (0, Y._)`${x.default.valCxt}.${x.default.dynamicAnchors}`); + }, () => { + e.var(x.default.instancePath, (0, Y._)`""`), e.var(x.default.parentData, (0, Y._)`undefined`), e.var(x.default.parentDataProperty, (0, Y._)`undefined`), e.var(x.default.rootData, x.default.data), r.dynamicRef && e.var(x.default.dynamicAnchors, (0, Y._)`{}`); + }); +} +function jd(e) { + const { schema: r, opts: n, gen: a } = e; + Fn(e, () => { + n.$comment && r.$comment && Gn(e), Id(e), a.let(x.default.vErrors, null), a.let(x.default.errors, 0), n.unevaluated && Od(e), qn(e), Ld(e); + }); +} +function Od(e) { + const { gen: r, validateName: n } = e; + e.evaluated = r.const("evaluated", (0, Y._)`${n}.evaluated`), r.if((0, Y._)`${e.evaluated}.dynamicProps`, () => r.assign((0, Y._)`${e.evaluated}.props`, (0, Y._)`undefined`)), r.if((0, Y._)`${e.evaluated}.dynamicItems`, () => r.assign((0, Y._)`${e.evaluated}.items`, (0, Y._)`undefined`)); +} +function Za(e, r) { + const n = typeof e == "object" && e[r.schemaId]; + return n && (r.code.source || r.code.process) ? (0, Y._)`/*# sourceURL=${n} */` : Y.nil; +} +function Nd(e, r) { + if (Bn(e) && (Hn(e), Un(e))) { + Rd(e, r); + return; + } + (0, Vn.boolOrEmptySchema)(e, r); +} +function Un({ schema: e, self: r }) { + if (typeof e == "boolean") + return !e; + for (const n in e) + if (r.RULES.all[n]) + return !0; + return !1; +} +function Bn(e) { + return typeof e.schema != "boolean"; +} +function Rd(e, r) { + const { schema: n, gen: a, opts: u } = e; + u.$comment && n.$comment && Gn(e), Md(e), Dd(e); + const o = a.const("_errs", x.default.errors); + qn(e, o), a.var(r, (0, Y._)`${o} === ${x.default.errors}`); +} +function Hn(e) { + (0, tr.checkUnknownRules)(e), Ad(e); +} +function qn(e, r) { + if (e.opts.jtd) + return Ya(e, [], !1, r); + const n = (0, Ja.getSchemaTypes)(e.schema), a = (0, Ja.coerceAndCheckDataType)(e, n); + Ya(e, n, !a, r); +} +function Ad(e) { + const { schema: r, errSchemaPath: n, opts: a, self: u } = e; + r.$ref && a.ignoreKeywordsWithRef && (0, tr.schemaHasRulesButRef)(r, u.RULES) && u.logger.warn(`$ref: keywords ignored in schema at path "${n}"`); +} +function Id(e) { + const { schema: r, opts: n } = e; + r.default !== void 0 && n.useDefaults && n.strictSchema && (0, tr.checkStrictMode)(e, "default is ignored in the schema root"); +} +function Md(e) { + const r = e.schema[e.opts.schemaId]; + r && (e.baseId = (0, Pd.resolveUrl)(e.opts.uriResolver, e.baseId, r)); +} +function Dd(e) { + if (e.schema.$async && !e.schemaEnv.$async) + throw new Error("async schema in sync schema"); +} +function Gn({ gen: e, schemaEnv: r, schema: n, errSchemaPath: a, opts: u }) { + const o = n.$comment; + if (u.$comment === !0) + e.code((0, Y._)`${x.default.self}.logger.log(${o})`); + else if (typeof u.$comment == "function") { + const p = (0, Y.str)`${a}/$comment`, y = e.scopeValue("root", { ref: r.root }); + e.code((0, Y._)`${x.default.self}.opts.$comment(${o}, ${p}, ${y}.schema)`); + } +} +function Ld(e) { + const { gen: r, schemaEnv: n, validateName: a, ValidationError: u, opts: o } = e; + n.$async ? r.if((0, Y._)`${x.default.errors} === 0`, () => r.return(x.default.data), () => r.throw((0, Y._)`new ${u}(${x.default.vErrors})`)) : (r.assign((0, Y._)`${a}.errors`, x.default.vErrors), o.unevaluated && zd(e), r.return((0, Y._)`${x.default.errors} === 0`)); +} +function zd({ gen: e, evaluated: r, props: n, items: a }) { + n instanceof Y.Name && e.assign((0, Y._)`${r}.props`, n), a instanceof Y.Name && e.assign((0, Y._)`${r}.items`, a); +} +function Ya(e, r, n, a) { + const { gen: u, schema: o, data: p, allErrors: y, opts: b, self: v } = e, { RULES: g } = v; + if (o.$ref && (b.ignoreKeywordsWithRef || !(0, tr.schemaHasRulesButRef)(o, g))) { + u.block(() => Jn(e, "$ref", g.all.$ref.definition)); + return; + } + b.jtd || Vd(e, r), u.block(() => { + for (const z of g.rules) + S(z); + S(g.post); + }); + function S(z) { + (0, Zt.shouldUseGroup)(o, z) && (z.type ? (u.if((0, wt.checkDataType)(z.type, p, b.strictNumbers)), Xa(e, z), r.length === 1 && r[0] === z.type && n && (u.else(), (0, wt.reportTypeError)(e)), u.endIf()) : Xa(e, z), y || u.if((0, Y._)`${x.default.errors} === ${a || 0}`)); + } +} +function Xa(e, r) { + const { gen: n, schema: a, opts: { useDefaults: u } } = e; + u && (0, kd.assignDefaults)(e, r.type), n.block(() => { + for (const o of r.rules) + (0, Zt.shouldUseRule)(a, o) && Jn(e, o.keyword, o.definition, r.type); + }); +} +function Vd(e, r) { + e.schemaEnv.meta || !e.opts.strictTypes || (Fd(e, r), e.opts.allowUnionTypes || Ud(e, r), Bd(e, e.dataTypes)); +} +function Fd(e, r) { + if (r.length) { + if (!e.dataTypes.length) { + e.dataTypes = r; + return; + } + r.forEach((n) => { + Kn(e.dataTypes, n) || Yt(e, `type "${n}" not allowed by context "${e.dataTypes.join(",")}"`); + }), qd(e, r); + } +} +function Ud(e, r) { + r.length > 1 && !(r.length === 2 && r.includes("null")) && Yt(e, "use allowUnionTypes to allow union type keyword"); +} +function Bd(e, r) { + const n = e.self.RULES.all; + for (const a in n) { + const u = n[a]; + if (typeof u == "object" && (0, Zt.shouldUseRule)(e.schema, u)) { + const { type: o } = u.definition; + o.length && !o.some((p) => Hd(r, p)) && Yt(e, `missing type "${o.join(",")}" for keyword "${a}"`); + } + } +} +function Hd(e, r) { + return e.includes(r) || r === "number" && e.includes("integer"); +} +function Kn(e, r) { + return e.includes(r) || r === "integer" && e.includes("number"); +} +function qd(e, r) { + const n = []; + for (const a of e.dataTypes) + Kn(r, a) ? n.push(a) : r.includes("integer") && a === "number" && n.push("integer"); + e.dataTypes = n; +} +function Yt(e, r) { + const n = e.schemaEnv.baseId + e.errSchemaPath; + r += ` at "${n}" (strictTypes)`, (0, tr.checkStrictMode)(e, r, e.opts.strictTypes); +} +class Wn { + constructor(r, n, a) { + if ((0, Jr.validateKeywordUsage)(r, n, a), this.gen = r.gen, this.allErrors = r.allErrors, this.keyword = a, this.data = r.data, this.schema = r.schema[a], this.$data = n.$data && r.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, tr.schemaRefOrVal)(r, this.schema, a, this.$data), this.schemaType = n.schemaType, this.parentSchema = r.schema, this.params = {}, this.it = r, this.def = n, this.$data) + this.schemaCode = r.gen.const("vSchema", Zn(this.$data, r)); + else if (this.schemaCode = this.schemaValue, !(0, Jr.validSchemaType)(this.schema, n.schemaType, n.allowUndefined)) + throw new Error(`${a} value must be ${JSON.stringify(n.schemaType)}`); + ("code" in n ? n.trackErrors : n.errors !== !1) && (this.errsCount = r.gen.const("_errs", x.default.errors)); + } + result(r, n, a) { + this.failResult((0, Y.not)(r), n, a); + } + failResult(r, n, a) { + this.gen.if(r), a ? a() : this.error(), n ? (this.gen.else(), n(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else(); + } + pass(r, n) { + this.failResult((0, Y.not)(r), void 0, n); + } + fail(r) { + if (r === void 0) { + this.error(), this.allErrors || this.gen.if(!1); + return; + } + this.gen.if(r), this.error(), this.allErrors ? this.gen.endIf() : this.gen.else(); + } + fail$data(r) { + if (!this.$data) + return this.fail(r); + const { schemaCode: n } = this; + this.fail((0, Y._)`${n} !== undefined && (${(0, Y.or)(this.invalid$data(), r)})`); + } + error(r, n, a) { + if (n) { + this.setParams(n), this._error(r, a), this.setParams({}); + return; + } + this._error(r, a); + } + _error(r, n) { + (r ? Gr.reportExtraError : Gr.reportError)(this, this.def.error, n); + } + $dataError() { + (0, Gr.reportError)(this, this.def.$dataError || Gr.keyword$DataError); + } + reset() { + if (this.errsCount === void 0) + throw new Error('add "trackErrors" to keyword definition'); + (0, Gr.resetErrorsCount)(this.gen, this.errsCount); + } + ok(r) { + this.allErrors || this.gen.if(r); + } + setParams(r, n) { + n ? Object.assign(this.params, r) : this.params = r; + } + block$data(r, n, a = Y.nil) { + this.gen.block(() => { + this.check$data(r, a), n(); + }); + } + check$data(r = Y.nil, n = Y.nil) { + if (!this.$data) + return; + const { gen: a, schemaCode: u, schemaType: o, def: p } = this; + a.if((0, Y.or)((0, Y._)`${u} === undefined`, n)), r !== Y.nil && a.assign(r, !0), (o.length || p.validateSchema) && (a.elseIf(this.invalid$data()), this.$dataError(), r !== Y.nil && a.assign(r, !1)), a.else(); + } + invalid$data() { + const { gen: r, schemaCode: n, schemaType: a, def: u, it: o } = this; + return (0, Y.or)(p(), y()); + function p() { + if (a.length) { + if (!(n instanceof Y.Name)) + throw new Error("ajv implementation error"); + const b = Array.isArray(a) ? a : [a]; + return (0, Y._)`${(0, wt.checkDataTypes)(b, n, o.opts.strictNumbers, wt.DataType.Wrong)}`; + } + return Y.nil; + } + function y() { + if (u.validateSchema) { + const b = r.scopeValue("validate$data", { ref: u.validateSchema }); + return (0, Y._)`!${b}(${n})`; + } + return Y.nil; + } + } + subschema(r, n) { + const a = (0, Rt.getSubschema)(this.it, r); + (0, Rt.extendSubschemaData)(a, this.it, r), (0, Rt.extendSubschemaMode)(a, r); + const u = { ...this.it, ...a, items: void 0, props: void 0 }; + return Nd(u, n), u; + } + mergeEvaluated(r, n) { + const { it: a, gen: u } = this; + a.opts.unevaluated && (a.props !== !0 && r.props !== void 0 && (a.props = tr.mergeEvaluated.props(u, r.props, a.props, n)), a.items !== !0 && r.items !== void 0 && (a.items = tr.mergeEvaluated.items(u, r.items, a.items, n))); + } + mergeValidEvaluated(r, n) { + const { it: a, gen: u } = this; + if (a.opts.unevaluated && (a.props !== !0 || a.items !== !0)) + return u.if(n, () => this.mergeEvaluated(r, Y.Name)), !0; + } +} +qe.KeywordCxt = Wn; +function Jn(e, r, n, a) { + const u = new Wn(e, n, r); + "code" in n ? n.code(u, a) : u.$data && n.validate ? (0, Jr.funcKeywordCode)(u, n) : "macro" in n ? (0, Jr.macroKeywordCode)(u, n) : (n.compile || n.validate) && (0, Jr.funcKeywordCode)(u, n); +} +const Gd = /^\/(?:[^~]|~0|~1)*$/, Kd = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function Zn(e, { dataLevel: r, dataNames: n, dataPathArr: a }) { + let u, o; + if (e === "") + return x.default.rootData; + if (e[0] === "/") { + if (!Gd.test(e)) + throw new Error(`Invalid JSON-pointer: ${e}`); + u = e, o = x.default.rootData; + } else { + const v = Kd.exec(e); + if (!v) + throw new Error(`Invalid JSON-pointer: ${e}`); + const g = +v[1]; + if (u = v[2], u === "#") { + if (g >= r) + throw new Error(b("property/index", g)); + return a[r - g]; + } + if (g > r) + throw new Error(b("data", g)); + if (o = n[r - g], !u) + return o; + } + let p = o; + const y = u.split("/"); + for (const v of y) + v && (o = (0, Y._)`${o}${(0, Y.getProperty)((0, tr.unescapeJsonPointer)(v))}`, p = (0, Y._)`${p} && ${o}`); + return p; + function b(v, g) { + return `Cannot access ${v} ${g} levels up, current level is ${r}`; + } +} +qe.getData = Zn; +var tt = {}; +Object.defineProperty(tt, "__esModule", { value: !0 }); +class Wd extends Error { + constructor(r) { + super("validation failed"), this.errors = r, this.ajv = this.validation = !0; + } +} +tt.default = Wd; +var at = {}; +Object.defineProperty(at, "__esModule", { value: !0 }); +const At = ke; +class Jd extends Error { + constructor(r, n, a, u) { + super(u || `can't resolve reference ${a} from id ${n}`), this.missingRef = (0, At.resolveUrl)(r, n, a), this.missingSchema = (0, At.normalizeId)((0, At.getFullPath)(r, this.missingRef)); + } +} +at.default = Jd; +var Re = {}; +Object.defineProperty(Re, "__esModule", { value: !0 }); +Re.resolveSchema = Re.getCompilingSchema = Re.resolveRef = Re.compileSchema = Re.SchemaEnv = void 0; +const Fe = se, Zd = tt, hr = Qe, He = ke, Qa = ie, Yd = qe; +class Tt { + constructor(r) { + var n; + this.refs = {}, this.dynamicAnchors = {}; + let a; + typeof r.schema == "object" && (a = r.schema), this.schema = r.schema, this.schemaId = r.schemaId, this.root = r.root || this, this.baseId = (n = r.baseId) !== null && n !== void 0 ? n : (0, He.normalizeId)(a == null ? void 0 : a[r.schemaId || "$id"]), this.schemaPath = r.schemaPath, this.localRefs = r.localRefs, this.meta = r.meta, this.$async = a == null ? void 0 : a.$async, this.refs = {}; + } +} +Re.SchemaEnv = Tt; +function Xt(e) { + const r = Yn.call(this, e); + if (r) + return r; + const n = (0, He.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: a, lines: u } = this.opts.code, { ownProperties: o } = this.opts, p = new Fe.CodeGen(this.scope, { es5: a, lines: u, ownProperties: o }); + let y; + e.$async && (y = p.scopeValue("Error", { + ref: Zd.default, + code: (0, Fe._)`require("ajv/dist/runtime/validation_error").default` + })); + const b = p.scopeName("validate"); + e.validateName = b; + const v = { + gen: p, + allErrors: this.opts.allErrors, + data: hr.default.data, + parentData: hr.default.parentData, + parentDataProperty: hr.default.parentDataProperty, + dataNames: [hr.default.data], + dataPathArr: [Fe.nil], + dataLevel: 0, + dataTypes: [], + definedProperties: /* @__PURE__ */ new Set(), + topSchemaRef: p.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, Fe.stringify)(e.schema) } : { ref: e.schema }), + validateName: b, + ValidationError: y, + schema: e.schema, + schemaEnv: e, + rootId: n, + baseId: e.baseId || n, + schemaPath: Fe.nil, + errSchemaPath: e.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: (0, Fe._)`""`, + opts: this.opts, + self: this + }; + let g; + try { + this._compilations.add(e), (0, Yd.validateFunctionCode)(v), p.optimize(this.opts.code.optimize); + const S = p.toString(); + g = `${p.scopeRefs(hr.default.scope)}return ${S}`, this.opts.code.process && (g = this.opts.code.process(g, e)); + const L = new Function(`${hr.default.self}`, `${hr.default.scope}`, g)(this, this.scope.get()); + if (this.scope.value(b, { ref: L }), L.errors = null, L.schema = e.schema, L.schemaEnv = e, e.$async && (L.$async = !0), this.opts.code.source === !0 && (L.source = { validateName: b, validateCode: S, scopeValues: p._values }), this.opts.unevaluated) { + const { props: R, items: j } = v; + L.evaluated = { + props: R instanceof Fe.Name ? void 0 : R, + items: j instanceof Fe.Name ? void 0 : j, + dynamicProps: R instanceof Fe.Name, + dynamicItems: j instanceof Fe.Name + }, L.source && (L.source.evaluated = (0, Fe.stringify)(L.evaluated)); + } + return e.validate = L, e; + } catch (S) { + throw delete e.validate, delete e.validateName, g && this.logger.error("Error compiling schema, function code:", g), S; + } finally { + this._compilations.delete(e); + } +} +Re.compileSchema = Xt; +function Xd(e, r, n) { + var a; + n = (0, He.resolveUrl)(this.opts.uriResolver, r, n); + const u = e.refs[n]; + if (u) + return u; + let o = eu.call(this, e, n); + if (o === void 0) { + const p = (a = e.localRefs) === null || a === void 0 ? void 0 : a[n], { schemaId: y } = this.opts; + p && (o = new Tt({ schema: p, schemaId: y, root: e, baseId: r })); + } + if (o !== void 0) + return e.refs[n] = Qd.call(this, o); +} +Re.resolveRef = Xd; +function Qd(e) { + return (0, He.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : Xt.call(this, e); +} +function Yn(e) { + for (const r of this._compilations) + if (xd(r, e)) + return r; +} +Re.getCompilingSchema = Yn; +function xd(e, r) { + return e.schema === r.schema && e.root === r.root && e.baseId === r.baseId; +} +function eu(e, r) { + let n; + for (; typeof (n = this.refs[r]) == "string"; ) + r = n; + return n || this.schemas[r] || jt.call(this, e, r); +} +function jt(e, r) { + const n = this.opts.uriResolver.parse(r), a = (0, He._getFullPath)(this.opts.uriResolver, n); + let u = (0, He.getFullPath)(this.opts.uriResolver, e.baseId, void 0); + if (Object.keys(e.schema).length > 0 && a === u) + return It.call(this, n, e); + const o = (0, He.normalizeId)(a), p = this.refs[o] || this.schemas[o]; + if (typeof p == "string") { + const y = jt.call(this, e, p); + return typeof (y == null ? void 0 : y.schema) != "object" ? void 0 : It.call(this, n, y); + } + if (typeof (p == null ? void 0 : p.schema) == "object") { + if (p.validate || Xt.call(this, p), o === (0, He.normalizeId)(r)) { + const { schema: y } = p, { schemaId: b } = this.opts, v = y[b]; + return v && (u = (0, He.resolveUrl)(this.opts.uriResolver, u, v)), new Tt({ schema: y, schemaId: b, root: e, baseId: u }); + } + return It.call(this, n, p); + } +} +Re.resolveSchema = jt; +const ru = /* @__PURE__ */ new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions" +]); +function It(e, { baseId: r, schema: n, root: a }) { + var u; + if (((u = e.fragment) === null || u === void 0 ? void 0 : u[0]) !== "/") + return; + for (const y of e.fragment.slice(1).split("/")) { + if (typeof n == "boolean") + return; + const b = n[(0, Qa.unescapeFragment)(y)]; + if (b === void 0) + return; + n = b; + const v = typeof n == "object" && n[this.opts.schemaId]; + !ru.has(y) && v && (r = (0, He.resolveUrl)(this.opts.uriResolver, r, v)); + } + let o; + if (typeof n != "boolean" && n.$ref && !(0, Qa.schemaHasRulesButRef)(n, this.RULES)) { + const y = (0, He.resolveUrl)(this.opts.uriResolver, r, n.$ref); + o = jt.call(this, a, y); + } + const { schemaId: p } = this.opts; + if (o = o || new Tt({ schema: n, schemaId: p, root: a, baseId: r }), o.schema !== o.root.schema) + return o; +} +const tu = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", au = "Meta-schema for $data reference (JSON AnySchema extension proposal)", nu = "object", su = [ + "$data" +], du = { + $data: { + type: "string", + anyOf: [ + { + format: "relative-json-pointer" + }, + { + format: "json-pointer" + } + ] + } +}, uu = !1, iu = { + $id: tu, + description: au, + type: nu, + required: su, + properties: du, + additionalProperties: uu +}; +var Qt = {}, Ut = { exports: {} }; +/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +(function(e, r) { + (function(n, a) { + a(r); + })(kn, function(n) { + function a() { + for (var E = arguments.length, f = Array(E), P = 0; P < E; P++) + f[P] = arguments[P]; + if (f.length > 1) { + f[0] = f[0].slice(0, -1); + for (var M = f.length - 1, A = 1; A < M; ++A) + f[A] = f[A].slice(1, -1); + return f[M] = f[M].slice(1), f.join(""); + } else + return f[0]; + } + function u(E) { + return "(?:" + E + ")"; + } + function o(E) { + return E === void 0 ? "undefined" : E === null ? "null" : Object.prototype.toString.call(E).split(" ").pop().split("]").shift().toLowerCase(); + } + function p(E) { + return E.toUpperCase(); + } + function y(E) { + return E != null ? E instanceof Array ? E : typeof E.length != "number" || E.split || E.setInterval || E.call ? [E] : Array.prototype.slice.call(E) : []; + } + function b(E, f) { + var P = E; + if (f) + for (var M in f) + P[M] = f[M]; + return P; + } + function v(E) { + var f = "[A-Za-z]", P = "[0-9]", M = a(P, "[A-Fa-f]"), A = u(u("%[EFef]" + M + "%" + M + M + "%" + M + M) + "|" + u("%[89A-Fa-f]" + M + "%" + M + M) + "|" + u("%" + M + M)), X = "[\\:\\/\\?\\#\\[\\]\\@]", Q = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", ue = a(X, Q), he = E ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", _e = E ? "[\\uE000-\\uF8FF]" : "[]", de = a(f, P, "[\\-\\.\\_\\~]", he); + u(f + a(f, P, "[\\+\\-\\.]") + "*"), u(u(A + "|" + a(de, Q, "[\\:]")) + "*"); + var ce = u(u("25[0-5]") + "|" + u("2[0-4]" + P) + "|" + u("1" + P + P) + "|" + u("0?[1-9]" + P) + "|0?0?" + P), ve = u(ce + "\\." + ce + "\\." + ce + "\\." + ce), ee = u(M + "{1,4}"), me = u(u(ee + "\\:" + ee) + "|" + ve), we = u(u(ee + "\\:") + "{6}" + me), ge = u("\\:\\:" + u(ee + "\\:") + "{5}" + me), ar = u(u(ee) + "?\\:\\:" + u(ee + "\\:") + "{4}" + me), We = u(u(u(ee + "\\:") + "{0,1}" + ee) + "?\\:\\:" + u(ee + "\\:") + "{3}" + me), Je = u(u(u(ee + "\\:") + "{0,2}" + ee) + "?\\:\\:" + u(ee + "\\:") + "{2}" + me), Pr = u(u(u(ee + "\\:") + "{0,3}" + ee) + "?\\:\\:" + ee + "\\:" + me), lr = u(u(u(ee + "\\:") + "{0,4}" + ee) + "?\\:\\:" + me), Me = u(u(u(ee + "\\:") + "{0,5}" + ee) + "?\\:\\:" + ee), Ze = u(u(u(ee + "\\:") + "{0,6}" + ee) + "?\\:\\:"), fr = u([we, ge, ar, We, Je, Pr, lr, Me, Ze].join("|")), er = u(u(de + "|" + A) + "+"); + u("[vV]" + M + "+\\." + a(de, Q, "[\\:]") + "+"), u(u(A + "|" + a(de, Q)) + "*"); + var Hr = u(A + "|" + a(de, Q, "[\\:\\@]")); + return u(u(A + "|" + a(de, Q, "[\\@]")) + "+"), u(u(Hr + "|" + a("[\\/\\?]", _e)) + "*"), { + NOT_SCHEME: new RegExp(a("[^]", f, P, "[\\+\\-\\.]"), "g"), + NOT_USERINFO: new RegExp(a("[^\\%\\:]", de, Q), "g"), + NOT_HOST: new RegExp(a("[^\\%\\[\\]\\:]", de, Q), "g"), + NOT_PATH: new RegExp(a("[^\\%\\/\\:\\@]", de, Q), "g"), + NOT_PATH_NOSCHEME: new RegExp(a("[^\\%\\/\\@]", de, Q), "g"), + NOT_QUERY: new RegExp(a("[^\\%]", de, Q, "[\\:\\@\\/\\?]", _e), "g"), + NOT_FRAGMENT: new RegExp(a("[^\\%]", de, Q, "[\\:\\@\\/\\?]"), "g"), + ESCAPE: new RegExp(a("[^]", de, Q), "g"), + UNRESERVED: new RegExp(de, "g"), + OTHER_CHARS: new RegExp(a("[^\\%]", de, ue), "g"), + PCT_ENCODED: new RegExp(A, "g"), + IPV4ADDRESS: new RegExp("^(" + ve + ")$"), + IPV6ADDRESS: new RegExp("^\\[?(" + fr + ")" + u(u("\\%25|\\%(?!" + M + "{2})") + "(" + er + ")") + "?\\]?$") + //RFC 6874, with relaxed parsing rules + }; + } + var g = v(!1), S = v(!0), z = function() { + function E(f, P) { + var M = [], A = !0, X = !1, Q = void 0; + try { + for (var ue = f[Symbol.iterator](), he; !(A = (he = ue.next()).done) && (M.push(he.value), !(P && M.length === P)); A = !0) + ; + } catch (_e) { + X = !0, Q = _e; + } finally { + try { + !A && ue.return && ue.return(); + } finally { + if (X) + throw Q; + } + } + return M; + } + return function(f, P) { + if (Array.isArray(f)) + return f; + if (Symbol.iterator in Object(f)) + return E(f, P); + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + }; + }(), L = function(E) { + if (Array.isArray(E)) { + for (var f = 0, P = Array(E.length); f < E.length; f++) + P[f] = E[f]; + return P; + } else + return Array.from(E); + }, R = 2147483647, j = 36, T = 1, $ = 26, O = 38, D = 700, t = 72, d = 128, s = "-", i = /^xn--/, c = /[^\0-\x7E]/, m = /[\x2E\u3002\uFF0E\uFF61]/g, h = { + overflow: "Overflow: input needs wider integers to process", + "not-basic": "Illegal input >= 0x80 (not a basic code point)", + "invalid-input": "Invalid input" + }, C = j - T, U = Math.floor, H = String.fromCharCode; + function V(E) { + throw new RangeError(h[E]); + } + function G(E, f) { + for (var P = [], M = E.length; M--; ) + P[M] = f(E[M]); + return P; + } + function _(E, f) { + var P = E.split("@"), M = ""; + P.length > 1 && (M = P[0] + "@", E = P[1]), E = E.replace(m, "."); + var A = E.split("."), X = G(A, f).join("."); + return M + X; + } + function q(E) { + for (var f = [], P = 0, M = E.length; P < M; ) { + var A = E.charCodeAt(P++); + if (A >= 55296 && A <= 56319 && P < M) { + var X = E.charCodeAt(P++); + (X & 64512) == 56320 ? f.push(((A & 1023) << 10) + (X & 1023) + 65536) : (f.push(A), P--); + } else + f.push(A); + } + return f; + } + var J = function(f) { + return String.fromCodePoint.apply(String, L(f)); + }, Z = function(f) { + return f - 48 < 10 ? f - 22 : f - 65 < 26 ? f - 65 : f - 97 < 26 ? f - 97 : j; + }, B = function(f, P) { + return f + 22 + 75 * (f < 26) - ((P != 0) << 5); + }, k = function(f, P, M) { + var A = 0; + for ( + f = M ? U(f / D) : f >> 1, f += U(f / P); + /* no initialization */ + f > C * $ >> 1; + A += j + ) + f = U(f / C); + return U(A + (C + 1) * f / (f + O)); + }, F = function(f) { + var P = [], M = f.length, A = 0, X = d, Q = t, ue = f.lastIndexOf(s); + ue < 0 && (ue = 0); + for (var he = 0; he < ue; ++he) + f.charCodeAt(he) >= 128 && V("not-basic"), P.push(f.charCodeAt(he)); + for (var _e = ue > 0 ? ue + 1 : 0; _e < M; ) { + for ( + var de = A, ce = 1, ve = j; + ; + /* no condition */ + ve += j + ) { + _e >= M && V("invalid-input"); + var ee = Z(f.charCodeAt(_e++)); + (ee >= j || ee > U((R - A) / ce)) && V("overflow"), A += ee * ce; + var me = ve <= Q ? T : ve >= Q + $ ? $ : ve - Q; + if (ee < me) + break; + var we = j - me; + ce > U(R / we) && V("overflow"), ce *= we; + } + var ge = P.length + 1; + Q = k(A - de, ge, de == 0), U(A / ge) > R - X && V("overflow"), X += U(A / ge), A %= ge, P.splice(A++, 0, X); + } + return String.fromCodePoint.apply(String, P); + }, N = function(f) { + var P = []; + f = q(f); + var M = f.length, A = d, X = 0, Q = t, ue = !0, he = !1, _e = void 0; + try { + for (var de = f[Symbol.iterator](), ce; !(ue = (ce = de.next()).done); ue = !0) { + var ve = ce.value; + ve < 128 && P.push(H(ve)); + } + } catch (qr) { + he = !0, _e = qr; + } finally { + try { + !ue && de.return && de.return(); + } finally { + if (he) + throw _e; + } + } + var ee = P.length, me = ee; + for (ee && P.push(s); me < M; ) { + var we = R, ge = !0, ar = !1, We = void 0; + try { + for (var Je = f[Symbol.iterator](), Pr; !(ge = (Pr = Je.next()).done); ge = !0) { + var lr = Pr.value; + lr >= A && lr < we && (we = lr); + } + } catch (qr) { + ar = !0, We = qr; + } finally { + try { + !ge && Je.return && Je.return(); + } finally { + if (ar) + throw We; + } + } + var Me = me + 1; + we - A > U((R - X) / Me) && V("overflow"), X += (we - A) * Me, A = we; + var Ze = !0, fr = !1, er = void 0; + try { + for (var Hr = f[Symbol.iterator](), Ba; !(Ze = (Ba = Hr.next()).done); Ze = !0) { + var Ha = Ba.value; + if (Ha < A && ++X > R && V("overflow"), Ha == A) { + for ( + var dt = X, ut = j; + ; + /* no condition */ + ut += j + ) { + var it = ut <= Q ? T : ut >= Q + $ ? $ : ut - Q; + if (dt < it) + break; + var qa = dt - it, Ga = j - it; + P.push(H(B(it + qa % Ga, 0))), dt = U(qa / Ga); + } + P.push(H(B(dt, 0))), Q = k(X, Me, me == ee), X = 0, ++me; + } + } + } catch (qr) { + fr = !0, er = qr; + } finally { + try { + !Ze && Hr.return && Hr.return(); + } finally { + if (fr) + throw er; + } + } + ++X, ++A; + } + return P.join(""); + }, l = function(f) { + return _(f, function(P) { + return i.test(P) ? F(P.slice(4).toLowerCase()) : P; + }); + }, w = function(f) { + return _(f, function(P) { + return c.test(P) ? "xn--" + N(P) : P; + }); + }, I = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + version: "2.1.0", + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + ucs2: { + decode: q, + encode: J + }, + decode: F, + encode: N, + toASCII: w, + toUnicode: l + }, K = {}; + function W(E) { + var f = E.charCodeAt(0), P = void 0; + return f < 16 ? P = "%0" + f.toString(16).toUpperCase() : f < 128 ? P = "%" + f.toString(16).toUpperCase() : f < 2048 ? P = "%" + (f >> 6 | 192).toString(16).toUpperCase() + "%" + (f & 63 | 128).toString(16).toUpperCase() : P = "%" + (f >> 12 | 224).toString(16).toUpperCase() + "%" + (f >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (f & 63 | 128).toString(16).toUpperCase(), P; + } + function re(E) { + for (var f = "", P = 0, M = E.length; P < M; ) { + var A = parseInt(E.substr(P + 1, 2), 16); + if (A < 128) + f += String.fromCharCode(A), P += 3; + else if (A >= 194 && A < 224) { + if (M - P >= 6) { + var X = parseInt(E.substr(P + 4, 2), 16); + f += String.fromCharCode((A & 31) << 6 | X & 63); + } else + f += E.substr(P, 6); + P += 6; + } else if (A >= 224) { + if (M - P >= 9) { + var Q = parseInt(E.substr(P + 4, 2), 16), ue = parseInt(E.substr(P + 7, 2), 16); + f += String.fromCharCode((A & 15) << 12 | (Q & 63) << 6 | ue & 63); + } else + f += E.substr(P, 9); + P += 9; + } else + f += E.substr(P, 3), P += 3; + } + return f; + } + function ae(E, f) { + function P(M) { + var A = re(M); + return A.match(f.UNRESERVED) ? A : M; + } + return E.scheme && (E.scheme = String(E.scheme).replace(f.PCT_ENCODED, P).toLowerCase().replace(f.NOT_SCHEME, "")), E.userinfo !== void 0 && (E.userinfo = String(E.userinfo).replace(f.PCT_ENCODED, P).replace(f.NOT_USERINFO, W).replace(f.PCT_ENCODED, p)), E.host !== void 0 && (E.host = String(E.host).replace(f.PCT_ENCODED, P).toLowerCase().replace(f.NOT_HOST, W).replace(f.PCT_ENCODED, p)), E.path !== void 0 && (E.path = String(E.path).replace(f.PCT_ENCODED, P).replace(E.scheme ? f.NOT_PATH : f.NOT_PATH_NOSCHEME, W).replace(f.PCT_ENCODED, p)), E.query !== void 0 && (E.query = String(E.query).replace(f.PCT_ENCODED, P).replace(f.NOT_QUERY, W).replace(f.PCT_ENCODED, p)), E.fragment !== void 0 && (E.fragment = String(E.fragment).replace(f.PCT_ENCODED, P).replace(f.NOT_FRAGMENT, W).replace(f.PCT_ENCODED, p)), E; + } + function fe(E) { + return E.replace(/^0*(.*)/, "$1") || "0"; + } + function Te(E, f) { + var P = E.match(f.IPV4ADDRESS) || [], M = z(P, 2), A = M[1]; + return A ? A.split(".").map(fe).join(".") : E; + } + function xe(E, f) { + var P = E.match(f.IPV6ADDRESS) || [], M = z(P, 3), A = M[1], X = M[2]; + if (A) { + for (var Q = A.toLowerCase().split("::").reverse(), ue = z(Q, 2), he = ue[0], _e = ue[1], de = _e ? _e.split(":").map(fe) : [], ce = he.split(":").map(fe), ve = f.IPV4ADDRESS.test(ce[ce.length - 1]), ee = ve ? 7 : 8, me = ce.length - ee, we = Array(ee), ge = 0; ge < ee; ++ge) + we[ge] = de[ge] || ce[me + ge] || ""; + ve && (we[ee - 1] = Te(we[ee - 1], f)); + var ar = we.reduce(function(Me, Ze, fr) { + if (!Ze || Ze === "0") { + var er = Me[Me.length - 1]; + er && er.index + er.length === fr ? er.length++ : Me.push({ index: fr, length: 1 }); + } + return Me; + }, []), We = ar.sort(function(Me, Ze) { + return Ze.length - Me.length; + })[0], Je = void 0; + if (We && We.length > 1) { + var Pr = we.slice(0, We.index), lr = we.slice(We.index + We.length); + Je = Pr.join(":") + "::" + lr.join(":"); + } else + Je = we.join(":"); + return X && (Je += "%" + X), Je; + } else + return E; + } + var Dr = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Lr = "".match(/(){0}/)[1] === void 0; + function Ae(E) { + var f = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, P = {}, M = f.iri !== !1 ? S : g; + f.reference === "suffix" && (E = (f.scheme ? f.scheme + ":" : "") + "//" + E); + var A = E.match(Dr); + if (A) { + Lr ? (P.scheme = A[1], P.userinfo = A[3], P.host = A[4], P.port = parseInt(A[5], 10), P.path = A[6] || "", P.query = A[7], P.fragment = A[8], isNaN(P.port) && (P.port = A[5])) : (P.scheme = A[1] || void 0, P.userinfo = E.indexOf("@") !== -1 ? A[3] : void 0, P.host = E.indexOf("//") !== -1 ? A[4] : void 0, P.port = parseInt(A[5], 10), P.path = A[6] || "", P.query = E.indexOf("?") !== -1 ? A[7] : void 0, P.fragment = E.indexOf("#") !== -1 ? A[8] : void 0, isNaN(P.port) && (P.port = E.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? A[4] : void 0)), P.host && (P.host = xe(Te(P.host, M), M)), P.scheme === void 0 && P.userinfo === void 0 && P.host === void 0 && P.port === void 0 && !P.path && P.query === void 0 ? P.reference = "same-document" : P.scheme === void 0 ? P.reference = "relative" : P.fragment === void 0 ? P.reference = "absolute" : P.reference = "uri", f.reference && f.reference !== "suffix" && f.reference !== P.reference && (P.error = P.error || "URI is not a " + f.reference + " reference."); + var X = K[(f.scheme || P.scheme || "").toLowerCase()]; + if (!f.unicodeSupport && (!X || !X.unicodeSupport)) { + if (P.host && (f.domainHost || X && X.domainHost)) + try { + P.host = I.toASCII(P.host.replace(M.PCT_ENCODED, re).toLowerCase()); + } catch (Q) { + P.error = P.error || "Host's domain name can not be converted to ASCII via punycode: " + Q; + } + ae(P, g); + } else + ae(P, M); + X && X.parse && X.parse(P, f); + } else + P.error = P.error || "URI can not be parsed."; + return P; + } + function zr(E, f) { + var P = f.iri !== !1 ? S : g, M = []; + return E.userinfo !== void 0 && (M.push(E.userinfo), M.push("@")), E.host !== void 0 && M.push(xe(Te(String(E.host), P), P).replace(P.IPV6ADDRESS, function(A, X, Q) { + return "[" + X + (Q ? "%25" + Q : "") + "]"; + })), (typeof E.port == "number" || typeof E.port == "string") && (M.push(":"), M.push(String(E.port))), M.length ? M.join("") : void 0; + } + var wr = /^\.\.?\//, br = /^\/\.(\/|$)/, $r = /^\/\.\.(\/|$)/, Vr = /^\/?(?:.|\n)*?(?=\/|$)/; + function Ge(E) { + for (var f = []; E.length; ) + if (E.match(wr)) + E = E.replace(wr, ""); + else if (E.match(br)) + E = E.replace(br, "/"); + else if (E.match($r)) + E = E.replace($r, "/"), f.pop(); + else if (E === "." || E === "..") + E = ""; + else { + var P = E.match(Vr); + if (P) { + var M = P[0]; + E = E.slice(M.length), f.push(M); + } else + throw new Error("Unexpected dot segment condition"); + } + return f.join(""); + } + function je(E) { + var f = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, P = f.iri ? S : g, M = [], A = K[(f.scheme || E.scheme || "").toLowerCase()]; + if (A && A.serialize && A.serialize(E, f), E.host && !P.IPV6ADDRESS.test(E.host)) { + if (f.domainHost || A && A.domainHost) + try { + E.host = f.iri ? I.toUnicode(E.host) : I.toASCII(E.host.replace(P.PCT_ENCODED, re).toLowerCase()); + } catch (ue) { + E.error = E.error || "Host's domain name can not be converted to " + (f.iri ? "Unicode" : "ASCII") + " via punycode: " + ue; + } + } + ae(E, P), f.reference !== "suffix" && E.scheme && (M.push(E.scheme), M.push(":")); + var X = zr(E, f); + if (X !== void 0 && (f.reference !== "suffix" && M.push("//"), M.push(X), E.path && E.path.charAt(0) !== "/" && M.push("/")), E.path !== void 0) { + var Q = E.path; + !f.absolutePath && (!A || !A.absolutePath) && (Q = Ge(Q)), X === void 0 && (Q = Q.replace(/^\/\//, "/%2F")), M.push(Q); + } + return E.query !== void 0 && (M.push("?"), M.push(E.query)), E.fragment !== void 0 && (M.push("#"), M.push(E.fragment)), M.join(""); + } + function Er(E, f) { + var P = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, M = arguments[3], A = {}; + return M || (E = Ae(je(E, P), P), f = Ae(je(f, P), P)), P = P || {}, !P.tolerant && f.scheme ? (A.scheme = f.scheme, A.userinfo = f.userinfo, A.host = f.host, A.port = f.port, A.path = Ge(f.path || ""), A.query = f.query) : (f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0 ? (A.userinfo = f.userinfo, A.host = f.host, A.port = f.port, A.path = Ge(f.path || ""), A.query = f.query) : (f.path ? (f.path.charAt(0) === "/" ? A.path = Ge(f.path) : ((E.userinfo !== void 0 || E.host !== void 0 || E.port !== void 0) && !E.path ? A.path = "/" + f.path : E.path ? A.path = E.path.slice(0, E.path.lastIndexOf("/") + 1) + f.path : A.path = f.path, A.path = Ge(A.path)), A.query = f.query) : (A.path = E.path, f.query !== void 0 ? A.query = f.query : A.query = E.query), A.userinfo = E.userinfo, A.host = E.host, A.port = E.port), A.scheme = E.scheme), A.fragment = f.fragment, A; + } + function Fr(E, f, P) { + var M = b({ scheme: "null" }, P); + return je(Er(Ae(E, M), Ae(f, M), M, !0), M); + } + function or(E, f) { + return typeof E == "string" ? E = je(Ae(E, f), f) : o(E) === "object" && (E = Ae(je(E, f), f)), E; + } + function Ur(E, f, P) { + return typeof E == "string" ? E = je(Ae(E, P), P) : o(E) === "object" && (E = je(E, P)), typeof f == "string" ? f = je(Ae(f, P), P) : o(f) === "object" && (f = je(f, P)), E === f; + } + function st(E, f) { + return E && E.toString().replace(!f || !f.iri ? g.ESCAPE : S.ESCAPE, W); + } + function Ie(E, f) { + return E && E.toString().replace(!f || !f.iri ? g.PCT_ENCODED : S.PCT_ENCODED, re); + } + var cr = { + scheme: "http", + domainHost: !0, + parse: function(f, P) { + return f.host || (f.error = f.error || "HTTP URIs must have a host."), f; + }, + serialize: function(f, P) { + var M = String(f.scheme).toLowerCase() === "https"; + return (f.port === (M ? 443 : 80) || f.port === "") && (f.port = void 0), f.path || (f.path = "/"), f; + } + }, Ia = { + scheme: "https", + domainHost: cr.domainHost, + parse: cr.parse, + serialize: cr.serialize + }; + function Ma(E) { + return typeof E.secure == "boolean" ? E.secure : String(E.scheme).toLowerCase() === "wss"; + } + var Br = { + scheme: "ws", + domainHost: !0, + parse: function(f, P) { + var M = f; + return M.secure = Ma(M), M.resourceName = (M.path || "/") + (M.query ? "?" + M.query : ""), M.path = void 0, M.query = void 0, M; + }, + serialize: function(f, P) { + if ((f.port === (Ma(f) ? 443 : 80) || f.port === "") && (f.port = void 0), typeof f.secure == "boolean" && (f.scheme = f.secure ? "wss" : "ws", f.secure = void 0), f.resourceName) { + var M = f.resourceName.split("?"), A = z(M, 2), X = A[0], Q = A[1]; + f.path = X && X !== "/" ? X : void 0, f.query = Q, f.resourceName = void 0; + } + return f.fragment = void 0, f; + } + }, Da = { + scheme: "wss", + domainHost: Br.domainHost, + parse: Br.parse, + serialize: Br.serialize + }, _s = {}, La = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", Ke = "[0-9A-Fa-f]", vs = u(u("%[EFef]" + Ke + "%" + Ke + Ke + "%" + Ke + Ke) + "|" + u("%[89A-Fa-f]" + Ke + "%" + Ke + Ke) + "|" + u("%" + Ke + Ke)), ys = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", ws = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", bs = a(ws, '[\\"\\\\]'), $s = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", Es = new RegExp(La, "g"), kr = new RegExp(vs, "g"), ks = new RegExp(a("[^]", ys, "[\\.]", '[\\"]', bs), "g"), za = new RegExp(a("[^]", La, $s), "g"), Ps = za; + function Nt(E) { + var f = re(E); + return f.match(Es) ? f : E; + } + var Va = { + scheme: "mailto", + parse: function(f, P) { + var M = f, A = M.to = M.path ? M.path.split(",") : []; + if (M.path = void 0, M.query) { + for (var X = !1, Q = {}, ue = M.query.split("&"), he = 0, _e = ue.length; he < _e; ++he) { + var de = ue[he].split("="); + switch (de[0]) { + case "to": + for (var ce = de[1].split(","), ve = 0, ee = ce.length; ve < ee; ++ve) + A.push(ce[ve]); + break; + case "subject": + M.subject = Ie(de[1], P); + break; + case "body": + M.body = Ie(de[1], P); + break; + default: + X = !0, Q[Ie(de[0], P)] = Ie(de[1], P); + break; + } + } + X && (M.headers = Q); + } + M.query = void 0; + for (var me = 0, we = A.length; me < we; ++me) { + var ge = A[me].split("@"); + if (ge[0] = Ie(ge[0]), P.unicodeSupport) + ge[1] = Ie(ge[1], P).toLowerCase(); + else + try { + ge[1] = I.toASCII(Ie(ge[1], P).toLowerCase()); + } catch (ar) { + M.error = M.error || "Email address's domain name can not be converted to ASCII via punycode: " + ar; + } + A[me] = ge.join("@"); + } + return M; + }, + serialize: function(f, P) { + var M = f, A = y(f.to); + if (A) { + for (var X = 0, Q = A.length; X < Q; ++X) { + var ue = String(A[X]), he = ue.lastIndexOf("@"), _e = ue.slice(0, he).replace(kr, Nt).replace(kr, p).replace(ks, W), de = ue.slice(he + 1); + try { + de = P.iri ? I.toUnicode(de) : I.toASCII(Ie(de, P).toLowerCase()); + } catch (me) { + M.error = M.error || "Email address's domain name can not be converted to " + (P.iri ? "Unicode" : "ASCII") + " via punycode: " + me; + } + A[X] = _e + "@" + de; + } + M.path = A.join(","); + } + var ce = f.headers = f.headers || {}; + f.subject && (ce.subject = f.subject), f.body && (ce.body = f.body); + var ve = []; + for (var ee in ce) + ce[ee] !== _s[ee] && ve.push(ee.replace(kr, Nt).replace(kr, p).replace(za, W) + "=" + ce[ee].replace(kr, Nt).replace(kr, p).replace(Ps, W)); + return ve.length && (M.query = ve.join("&")), M; + } + }, Ss = /^([^\:]+)\:(.*)/, Fa = { + scheme: "urn", + parse: function(f, P) { + var M = f.path && f.path.match(Ss), A = f; + if (M) { + var X = P.scheme || A.scheme || "urn", Q = M[1].toLowerCase(), ue = M[2], he = X + ":" + (P.nid || Q), _e = K[he]; + A.nid = Q, A.nss = ue, A.path = void 0, _e && (A = _e.parse(A, P)); + } else + A.error = A.error || "URN can not be parsed."; + return A; + }, + serialize: function(f, P) { + var M = P.scheme || f.scheme || "urn", A = f.nid, X = M + ":" + (P.nid || A), Q = K[X]; + Q && (f = Q.serialize(f, P)); + var ue = f, he = f.nss; + return ue.path = (A || P.nid) + ":" + he, ue; + } + }, Cs = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ua = { + scheme: "urn:uuid", + parse: function(f, P) { + var M = f; + return M.uuid = M.nss, M.nss = void 0, !P.tolerant && (!M.uuid || !M.uuid.match(Cs)) && (M.error = M.error || "UUID is not valid."), M; + }, + serialize: function(f, P) { + var M = f; + return M.nss = (f.uuid || "").toLowerCase(), M; + } + }; + K[cr.scheme] = cr, K[Ia.scheme] = Ia, K[Br.scheme] = Br, K[Da.scheme] = Da, K[Va.scheme] = Va, K[Fa.scheme] = Fa, K[Ua.scheme] = Ua, n.SCHEMES = K, n.pctEncChar = W, n.pctDecChars = re, n.parse = Ae, n.removeDotSegments = Ge, n.serialize = je, n.resolveComponents = Er, n.resolve = Fr, n.normalize = or, n.equal = Ur, n.escapeComponent = st, n.unescapeComponent = Ie, Object.defineProperty(n, "__esModule", { value: !0 }); + }); +})(Ut, Ut.exports); +var ou = Ut.exports; +Object.defineProperty(Qt, "__esModule", { value: !0 }); +const Xn = ou; +Xn.code = 'require("ajv/dist/runtime/uri").default'; +Qt.default = Xn; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.CodeGen = e.Name = e.nil = e.stringify = e.str = e._ = e.KeywordCxt = void 0; + var r = qe; + Object.defineProperty(e, "KeywordCxt", { enumerable: !0, get: function() { + return r.KeywordCxt; + } }); + var n = se; + Object.defineProperty(e, "_", { enumerable: !0, get: function() { + return n._; + } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { + return n.str; + } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { + return n.stringify; + } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { + return n.nil; + } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { + return n.Name; + } }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() { + return n.CodeGen; + } }); + const a = tt, u = at, o = vr, p = Re, y = se, b = ke, v = rt, g = ie, S = iu, z = Qt, L = (B, k) => new RegExp(B, k); + L.code = "new RegExp"; + const R = ["removeAdditional", "useDefaults", "coerceTypes"], j = /* @__PURE__ */ new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error" + ]), T = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now." + }, $ = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.' + }, O = 200; + function D(B) { + var k, F, N, l, w, I, K, W, re, ae, fe, Te, xe, Dr, Lr, Ae, zr, wr, br, $r, Vr, Ge, je, Er, Fr; + const or = B.strict, Ur = (k = B.code) === null || k === void 0 ? void 0 : k.optimize, st = Ur === !0 || Ur === void 0 ? 1 : Ur || 0, Ie = (N = (F = B.code) === null || F === void 0 ? void 0 : F.regExp) !== null && N !== void 0 ? N : L, cr = (l = B.uriResolver) !== null && l !== void 0 ? l : z.default; + return { + strictSchema: (I = (w = B.strictSchema) !== null && w !== void 0 ? w : or) !== null && I !== void 0 ? I : !0, + strictNumbers: (W = (K = B.strictNumbers) !== null && K !== void 0 ? K : or) !== null && W !== void 0 ? W : !0, + strictTypes: (ae = (re = B.strictTypes) !== null && re !== void 0 ? re : or) !== null && ae !== void 0 ? ae : "log", + strictTuples: (Te = (fe = B.strictTuples) !== null && fe !== void 0 ? fe : or) !== null && Te !== void 0 ? Te : "log", + strictRequired: (Dr = (xe = B.strictRequired) !== null && xe !== void 0 ? xe : or) !== null && Dr !== void 0 ? Dr : !1, + code: B.code ? { ...B.code, optimize: st, regExp: Ie } : { optimize: st, regExp: Ie }, + loopRequired: (Lr = B.loopRequired) !== null && Lr !== void 0 ? Lr : O, + loopEnum: (Ae = B.loopEnum) !== null && Ae !== void 0 ? Ae : O, + meta: (zr = B.meta) !== null && zr !== void 0 ? zr : !0, + messages: (wr = B.messages) !== null && wr !== void 0 ? wr : !0, + inlineRefs: (br = B.inlineRefs) !== null && br !== void 0 ? br : !0, + schemaId: ($r = B.schemaId) !== null && $r !== void 0 ? $r : "$id", + addUsedSchema: (Vr = B.addUsedSchema) !== null && Vr !== void 0 ? Vr : !0, + validateSchema: (Ge = B.validateSchema) !== null && Ge !== void 0 ? Ge : !0, + validateFormats: (je = B.validateFormats) !== null && je !== void 0 ? je : !0, + unicodeRegExp: (Er = B.unicodeRegExp) !== null && Er !== void 0 ? Er : !0, + int32range: (Fr = B.int32range) !== null && Fr !== void 0 ? Fr : !0, + uriResolver: cr + }; + } + class t { + constructor(k = {}) { + this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), k = this.opts = { ...k, ...D(k) }; + const { es5: F, lines: N } = this.opts.code; + this.scope = new y.ValueScope({ scope: {}, prefixes: j, es5: F, lines: N }), this.logger = U(k.logger); + const l = k.validateFormats; + k.validateFormats = !1, this.RULES = (0, o.getRules)(), d.call(this, T, k, "NOT SUPPORTED"), d.call(this, $, k, "DEPRECATED", "warn"), this._metaOpts = h.call(this), k.formats && c.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), k.keywords && m.call(this, k.keywords), typeof k.meta == "object" && this.addMetaSchema(k.meta), i.call(this), k.validateFormats = l; + } + _addVocabularies() { + this.addKeyword("$async"); + } + _addDefaultMetaSchema() { + const { $data: k, meta: F, schemaId: N } = this.opts; + let l = S; + N === "id" && (l = { ...S }, l.id = l.$id, delete l.$id), F && k && this.addMetaSchema(l, l[N], !1); + } + defaultMeta() { + const { meta: k, schemaId: F } = this.opts; + return this.opts.defaultMeta = typeof k == "object" ? k[F] || k : void 0; + } + validate(k, F) { + let N; + if (typeof k == "string") { + if (N = this.getSchema(k), !N) + throw new Error(`no schema with key or ref "${k}"`); + } else + N = this.compile(k); + const l = N(F); + return "$async" in N || (this.errors = N.errors), l; + } + compile(k, F) { + const N = this._addSchema(k, F); + return N.validate || this._compileSchemaEnv(N); + } + compileAsync(k, F) { + if (typeof this.opts.loadSchema != "function") + throw new Error("options.loadSchema should be a function"); + const { loadSchema: N } = this.opts; + return l.call(this, k, F); + async function l(ae, fe) { + await w.call(this, ae.$schema); + const Te = this._addSchema(ae, fe); + return Te.validate || I.call(this, Te); + } + async function w(ae) { + ae && !this.getSchema(ae) && await l.call(this, { $ref: ae }, !0); + } + async function I(ae) { + try { + return this._compileSchemaEnv(ae); + } catch (fe) { + if (!(fe instanceof u.default)) + throw fe; + return K.call(this, fe), await W.call(this, fe.missingSchema), I.call(this, ae); + } + } + function K({ missingSchema: ae, missingRef: fe }) { + if (this.refs[ae]) + throw new Error(`AnySchema ${ae} is loaded but ${fe} cannot be resolved`); + } + async function W(ae) { + const fe = await re.call(this, ae); + this.refs[ae] || await w.call(this, fe.$schema), this.refs[ae] || this.addSchema(fe, ae, F); + } + async function re(ae) { + const fe = this._loading[ae]; + if (fe) + return fe; + try { + return await (this._loading[ae] = N(ae)); + } finally { + delete this._loading[ae]; + } + } + } + // Adds schema to the instance + addSchema(k, F, N, l = this.opts.validateSchema) { + if (Array.isArray(k)) { + for (const I of k) + this.addSchema(I, void 0, N, l); + return this; + } + let w; + if (typeof k == "object") { + const { schemaId: I } = this.opts; + if (w = k[I], w !== void 0 && typeof w != "string") + throw new Error(`schema ${I} must be string`); + } + return F = (0, b.normalizeId)(F || w), this._checkUnique(F), this.schemas[F] = this._addSchema(k, N, F, l, !0), this; + } + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema(k, F, N = this.opts.validateSchema) { + return this.addSchema(k, F, !0, N), this; + } + // Validate schema against its meta-schema + validateSchema(k, F) { + if (typeof k == "boolean") + return !0; + let N; + if (N = k.$schema, N !== void 0 && typeof N != "string") + throw new Error("$schema must be a string"); + if (N = N || this.opts.defaultMeta || this.defaultMeta(), !N) + return this.logger.warn("meta-schema not available"), this.errors = null, !0; + const l = this.validate(N, k); + if (!l && F) { + const w = "schema is invalid: " + this.errorsText(); + if (this.opts.validateSchema === "log") + this.logger.error(w); + else + throw new Error(w); + } + return l; + } + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(k) { + let F; + for (; typeof (F = s.call(this, k)) == "string"; ) + k = F; + if (F === void 0) { + const { schemaId: N } = this.opts, l = new p.SchemaEnv({ schema: {}, schemaId: N }); + if (F = p.resolveSchema.call(this, l, k), !F) + return; + this.refs[k] = F; + } + return F.validate || this._compileSchemaEnv(F); + } + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(k) { + if (k instanceof RegExp) + return this._removeAllSchemas(this.schemas, k), this._removeAllSchemas(this.refs, k), this; + switch (typeof k) { + case "undefined": + return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this; + case "string": { + const F = s.call(this, k); + return typeof F == "object" && this._cache.delete(F.schema), delete this.schemas[k], delete this.refs[k], this; + } + case "object": { + const F = k; + this._cache.delete(F); + let N = k[this.opts.schemaId]; + return N && (N = (0, b.normalizeId)(N), delete this.schemas[N], delete this.refs[N]), this; + } + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } + // add "vocabulary" - a collection of keywords + addVocabulary(k) { + for (const F of k) + this.addKeyword(F); + return this; + } + addKeyword(k, F) { + let N; + if (typeof k == "string") + N = k, typeof F == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), F.keyword = N); + else if (typeof k == "object" && F === void 0) { + if (F = k, N = F.keyword, Array.isArray(N) && !N.length) + throw new Error("addKeywords: keyword must be string or non-empty array"); + } else + throw new Error("invalid addKeywords parameters"); + if (V.call(this, N, F), !F) + return (0, g.eachItem)(N, (w) => G.call(this, w)), this; + q.call(this, F); + const l = { + ...F, + type: (0, v.getJSONTypes)(F.type), + schemaType: (0, v.getJSONTypes)(F.schemaType) + }; + return (0, g.eachItem)(N, l.type.length === 0 ? (w) => G.call(this, w, l) : (w) => l.type.forEach((I) => G.call(this, w, l, I))), this; + } + getKeyword(k) { + const F = this.RULES.all[k]; + return typeof F == "object" ? F.definition : !!F; + } + // Remove keyword + removeKeyword(k) { + const { RULES: F } = this; + delete F.keywords[k], delete F.all[k]; + for (const N of F.rules) { + const l = N.rules.findIndex((w) => w.keyword === k); + l >= 0 && N.rules.splice(l, 1); + } + return this; + } + // Add format + addFormat(k, F) { + return typeof F == "string" && (F = new RegExp(F)), this.formats[k] = F, this; + } + errorsText(k = this.errors, { separator: F = ", ", dataVar: N = "data" } = {}) { + return !k || k.length === 0 ? "No errors" : k.map((l) => `${N}${l.instancePath} ${l.message}`).reduce((l, w) => l + F + w); + } + $dataMetaSchema(k, F) { + const N = this.RULES.all; + k = JSON.parse(JSON.stringify(k)); + for (const l of F) { + const w = l.split("/").slice(1); + let I = k; + for (const K of w) + I = I[K]; + for (const K in N) { + const W = N[K]; + if (typeof W != "object") + continue; + const { $data: re } = W.definition, ae = I[K]; + re && ae && (I[K] = Z(ae)); + } + } + return k; + } + _removeAllSchemas(k, F) { + for (const N in k) { + const l = k[N]; + (!F || F.test(N)) && (typeof l == "string" ? delete k[N] : l && !l.meta && (this._cache.delete(l.schema), delete k[N])); + } + } + _addSchema(k, F, N, l = this.opts.validateSchema, w = this.opts.addUsedSchema) { + let I; + const { schemaId: K } = this.opts; + if (typeof k == "object") + I = k[K]; + else { + if (this.opts.jtd) + throw new Error("schema must be object"); + if (typeof k != "boolean") + throw new Error("schema must be object or boolean"); + } + let W = this._cache.get(k); + if (W !== void 0) + return W; + N = (0, b.normalizeId)(I || N); + const re = b.getSchemaRefs.call(this, k, N); + return W = new p.SchemaEnv({ schema: k, schemaId: K, meta: F, baseId: N, localRefs: re }), this._cache.set(W.schema, W), w && !N.startsWith("#") && (N && this._checkUnique(N), this.refs[N] = W), l && this.validateSchema(k, !0), W; + } + _checkUnique(k) { + if (this.schemas[k] || this.refs[k]) + throw new Error(`schema with key or id "${k}" already exists`); + } + _compileSchemaEnv(k) { + if (k.meta ? this._compileMetaSchema(k) : p.compileSchema.call(this, k), !k.validate) + throw new Error("ajv implementation error"); + return k.validate; + } + _compileMetaSchema(k) { + const F = this.opts; + this.opts = this._metaOpts; + try { + p.compileSchema.call(this, k); + } finally { + this.opts = F; + } + } + } + e.default = t, t.ValidationError = a.default, t.MissingRefError = u.default; + function d(B, k, F, N = "error") { + for (const l in B) { + const w = l; + w in k && this.logger[N](`${F}: option ${l}. ${B[w]}`); + } + } + function s(B) { + return B = (0, b.normalizeId)(B), this.schemas[B] || this.refs[B]; + } + function i() { + const B = this.opts.schemas; + if (B) + if (Array.isArray(B)) + this.addSchema(B); + else + for (const k in B) + this.addSchema(B[k], k); + } + function c() { + for (const B in this.opts.formats) { + const k = this.opts.formats[B]; + k && this.addFormat(B, k); + } + } + function m(B) { + if (Array.isArray(B)) { + this.addVocabulary(B); + return; + } + this.logger.warn("keywords option as map is deprecated, pass array"); + for (const k in B) { + const F = B[k]; + F.keyword || (F.keyword = k), this.addKeyword(F); + } + } + function h() { + const B = { ...this.opts }; + for (const k of R) + delete B[k]; + return B; + } + const C = { log() { + }, warn() { + }, error() { + } }; + function U(B) { + if (B === !1) + return C; + if (B === void 0) + return console; + if (B.log && B.warn && B.error) + return B; + throw new Error("logger must implement log, warn and error methods"); + } + const H = /^[a-z_$][a-z0-9_$:-]*$/i; + function V(B, k) { + const { RULES: F } = this; + if ((0, g.eachItem)(B, (N) => { + if (F.keywords[N]) + throw new Error(`Keyword ${N} is already defined`); + if (!H.test(N)) + throw new Error(`Keyword ${N} has invalid name`); + }), !!k && k.$data && !("code" in k || "validate" in k)) + throw new Error('$data keyword must have "code" or "validate" function'); + } + function G(B, k, F) { + var N; + const l = k == null ? void 0 : k.post; + if (F && l) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES: w } = this; + let I = l ? w.post : w.rules.find(({ type: W }) => W === F); + if (I || (I = { type: F, rules: [] }, w.rules.push(I)), w.keywords[B] = !0, !k) + return; + const K = { + keyword: B, + definition: { + ...k, + type: (0, v.getJSONTypes)(k.type), + schemaType: (0, v.getJSONTypes)(k.schemaType) + } + }; + k.before ? _.call(this, I, K, k.before) : I.rules.push(K), w.all[B] = K, (N = k.implements) === null || N === void 0 || N.forEach((W) => this.addKeyword(W)); + } + function _(B, k, F) { + const N = B.rules.findIndex((l) => l.keyword === F); + N >= 0 ? B.rules.splice(N, 0, k) : (B.rules.push(k), this.logger.warn(`rule ${F} is not defined`)); + } + function q(B) { + let { metaSchema: k } = B; + k !== void 0 && (B.$data && this.opts.$data && (k = Z(k)), B.validateSchema = this.compile(k, !0)); + } + const J = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" + }; + function Z(B) { + return { anyOf: [B, J] }; + } +})(Sn); +var xt = {}, ea = {}, ra = {}; +Object.defineProperty(ra, "__esModule", { value: !0 }); +const cu = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + } +}; +ra.default = cu; +var yr = {}; +Object.defineProperty(yr, "__esModule", { value: !0 }); +yr.callRef = yr.getValidate = void 0; +const lu = at, xa = ne, Ne = se, Cr = Qe, en = Re, ot = ie, fu = { + keyword: "$ref", + schemaType: "string", + code(e) { + const { gen: r, schema: n, it: a } = e, { baseId: u, schemaEnv: o, validateName: p, opts: y, self: b } = a, { root: v } = o; + if ((n === "#" || n === "#/") && u === v.baseId) + return S(); + const g = en.resolveRef.call(b, v, u, n); + if (g === void 0) + throw new lu.default(a.opts.uriResolver, u, n); + if (g instanceof en.SchemaEnv) + return z(g); + return L(g); + function S() { + if (o === v) + return gt(e, p, o, o.$async); + const R = r.scopeValue("root", { ref: v }); + return gt(e, (0, Ne._)`${R}.validate`, v, v.$async); + } + function z(R) { + const j = Qn(e, R); + gt(e, j, R, R.$async); + } + function L(R) { + const j = r.scopeValue("schema", y.code.source === !0 ? { ref: R, code: (0, Ne.stringify)(R) } : { ref: R }), T = r.name("valid"), $ = e.subschema({ + schema: R, + dataTypes: [], + schemaPath: Ne.nil, + topSchemaRef: j, + errSchemaPath: n + }, T); + e.mergeEvaluated($), e.ok(T); + } + } +}; +function Qn(e, r) { + const { gen: n } = e; + return r.validate ? n.scopeValue("validate", { ref: r.validate }) : (0, Ne._)`${n.scopeValue("wrapper", { ref: r })}.validate`; +} +yr.getValidate = Qn; +function gt(e, r, n, a) { + const { gen: u, it: o } = e, { allErrors: p, schemaEnv: y, opts: b } = o, v = b.passContext ? Cr.default.this : Ne.nil; + a ? g() : S(); + function g() { + if (!y.$async) + throw new Error("async schema referenced by sync schema"); + const R = u.let("valid"); + u.try(() => { + u.code((0, Ne._)`await ${(0, xa.callValidateCode)(e, r, v)}`), L(r), p || u.assign(R, !0); + }, (j) => { + u.if((0, Ne._)`!(${j} instanceof ${o.ValidationError})`, () => u.throw(j)), z(j), p || u.assign(R, !1); + }), e.ok(R); + } + function S() { + e.result((0, xa.callValidateCode)(e, r, v), () => L(r), () => z(r)); + } + function z(R) { + const j = (0, Ne._)`${R}.errors`; + u.assign(Cr.default.vErrors, (0, Ne._)`${Cr.default.vErrors} === null ? ${j} : ${Cr.default.vErrors}.concat(${j})`), u.assign(Cr.default.errors, (0, Ne._)`${Cr.default.vErrors}.length`); + } + function L(R) { + var j; + if (!o.opts.unevaluated) + return; + const T = (j = n == null ? void 0 : n.validate) === null || j === void 0 ? void 0 : j.evaluated; + if (o.props !== !0) + if (T && !T.dynamicProps) + T.props !== void 0 && (o.props = ot.mergeEvaluated.props(u, T.props, o.props)); + else { + const $ = u.var("props", (0, Ne._)`${R}.evaluated.props`); + o.props = ot.mergeEvaluated.props(u, $, o.props, Ne.Name); + } + if (o.items !== !0) + if (T && !T.dynamicItems) + T.items !== void 0 && (o.items = ot.mergeEvaluated.items(u, T.items, o.items)); + else { + const $ = u.var("items", (0, Ne._)`${R}.evaluated.items`); + o.items = ot.mergeEvaluated.items(u, $, o.items, Ne.Name); + } + } +} +yr.callRef = gt; +yr.default = fu; +Object.defineProperty(ea, "__esModule", { value: !0 }); +const hu = ra, pu = yr, mu = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + { keyword: "$comment" }, + "definitions", + hu.default, + pu.default +]; +ea.default = mu; +var ta = {}, aa = {}; +Object.defineProperty(aa, "__esModule", { value: !0 }); +const bt = se, sr = bt.operators, $t = { + maximum: { okStr: "<=", ok: sr.LTE, fail: sr.GT }, + minimum: { okStr: ">=", ok: sr.GTE, fail: sr.LT }, + exclusiveMaximum: { okStr: "<", ok: sr.LT, fail: sr.GTE }, + exclusiveMinimum: { okStr: ">", ok: sr.GT, fail: sr.LTE } +}, gu = { + message: ({ keyword: e, schemaCode: r }) => (0, bt.str)`must be ${$t[e].okStr} ${r}`, + params: ({ keyword: e, schemaCode: r }) => (0, bt._)`{comparison: ${$t[e].okStr}, limit: ${r}}` +}, _u = { + keyword: Object.keys($t), + type: "number", + schemaType: "number", + $data: !0, + error: gu, + code(e) { + const { keyword: r, data: n, schemaCode: a } = e; + e.fail$data((0, bt._)`${n} ${$t[r].fail} ${a} || isNaN(${n})`); + } +}; +aa.default = _u; +var na = {}; +Object.defineProperty(na, "__esModule", { value: !0 }); +const Zr = se, vu = { + message: ({ schemaCode: e }) => (0, Zr.str)`must be multiple of ${e}`, + params: ({ schemaCode: e }) => (0, Zr._)`{multipleOf: ${e}}` +}, yu = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: !0, + error: vu, + code(e) { + const { gen: r, data: n, schemaCode: a, it: u } = e, o = u.opts.multipleOfPrecision, p = r.let("res"), y = o ? (0, Zr._)`Math.abs(Math.round(${p}) - ${p}) > 1e-${o}` : (0, Zr._)`${p} !== parseInt(${p})`; + e.fail$data((0, Zr._)`(${a} === 0 || (${p} = ${n}/${a}, ${y}))`); + } +}; +na.default = yu; +var sa = {}, da = {}; +Object.defineProperty(da, "__esModule", { value: !0 }); +function xn(e) { + const r = e.length; + let n = 0, a = 0, u; + for (; a < r; ) + n++, u = e.charCodeAt(a++), u >= 55296 && u <= 56319 && a < r && (u = e.charCodeAt(a), (u & 64512) === 56320 && a++); + return n; +} +da.default = xn; +xn.code = 'require("ajv/dist/runtime/ucs2length").default'; +Object.defineProperty(sa, "__esModule", { value: !0 }); +const gr = se, wu = ie, bu = da, $u = { + message({ keyword: e, schemaCode: r }) { + const n = e === "maxLength" ? "more" : "fewer"; + return (0, gr.str)`must NOT have ${n} than ${r} characters`; + }, + params: ({ schemaCode: e }) => (0, gr._)`{limit: ${e}}` +}, Eu = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: !0, + error: $u, + code(e) { + const { keyword: r, data: n, schemaCode: a, it: u } = e, o = r === "maxLength" ? gr.operators.GT : gr.operators.LT, p = u.opts.unicode === !1 ? (0, gr._)`${n}.length` : (0, gr._)`${(0, wu.useFunc)(e.gen, bu.default)}(${n})`; + e.fail$data((0, gr._)`${p} ${o} ${a}`); + } +}; +sa.default = Eu; +var ua = {}; +Object.defineProperty(ua, "__esModule", { value: !0 }); +const ku = ne, Et = se, Pu = { + message: ({ schemaCode: e }) => (0, Et.str)`must match pattern "${e}"`, + params: ({ schemaCode: e }) => (0, Et._)`{pattern: ${e}}` +}, Su = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: !0, + error: Pu, + code(e) { + const { data: r, $data: n, schema: a, schemaCode: u, it: o } = e, p = o.opts.unicodeRegExp ? "u" : "", y = n ? (0, Et._)`(new RegExp(${u}, ${p}))` : (0, ku.usePattern)(e, a); + e.fail$data((0, Et._)`!${y}.test(${r})`); + } +}; +ua.default = Su; +var ia = {}; +Object.defineProperty(ia, "__esModule", { value: !0 }); +const Yr = se, Cu = { + message({ keyword: e, schemaCode: r }) { + const n = e === "maxProperties" ? "more" : "fewer"; + return (0, Yr.str)`must NOT have ${n} than ${r} properties`; + }, + params: ({ schemaCode: e }) => (0, Yr._)`{limit: ${e}}` +}, Tu = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: !0, + error: Cu, + code(e) { + const { keyword: r, data: n, schemaCode: a } = e, u = r === "maxProperties" ? Yr.operators.GT : Yr.operators.LT; + e.fail$data((0, Yr._)`Object.keys(${n}).length ${u} ${a}`); + } +}; +ia.default = Tu; +var oa = {}; +Object.defineProperty(oa, "__esModule", { value: !0 }); +const Kr = ne, Xr = se, ju = ie, Ou = { + message: ({ params: { missingProperty: e } }) => (0, Xr.str)`must have required property '${e}'`, + params: ({ params: { missingProperty: e } }) => (0, Xr._)`{missingProperty: ${e}}` +}, Nu = { + keyword: "required", + type: "object", + schemaType: "array", + $data: !0, + error: Ou, + code(e) { + const { gen: r, schema: n, schemaCode: a, data: u, $data: o, it: p } = e, { opts: y } = p; + if (!o && n.length === 0) + return; + const b = n.length >= y.loopRequired; + if (p.allErrors ? v() : g(), y.strictRequired) { + const L = e.parentSchema.properties, { definedProperties: R } = e.it; + for (const j of n) + if ((L == null ? void 0 : L[j]) === void 0 && !R.has(j)) { + const T = p.schemaEnv.baseId + p.errSchemaPath, $ = `required property "${j}" is not defined at "${T}" (strictRequired)`; + (0, ju.checkStrictMode)(p, $, p.opts.strictRequired); + } + } + function v() { + if (b || o) + e.block$data(Xr.nil, S); + else + for (const L of n) + (0, Kr.checkReportMissingProp)(e, L); + } + function g() { + const L = r.let("missing"); + if (b || o) { + const R = r.let("valid", !0); + e.block$data(R, () => z(L, R)), e.ok(R); + } else + r.if((0, Kr.checkMissingProp)(e, n, L)), (0, Kr.reportMissingProp)(e, L), r.else(); + } + function S() { + r.forOf("prop", a, (L) => { + e.setParams({ missingProperty: L }), r.if((0, Kr.noPropertyInData)(r, u, L, y.ownProperties), () => e.error()); + }); + } + function z(L, R) { + e.setParams({ missingProperty: L }), r.forOf(L, a, () => { + r.assign(R, (0, Kr.propertyInData)(r, u, L, y.ownProperties)), r.if((0, Xr.not)(R), () => { + e.error(), r.break(); + }); + }, Xr.nil); + } + } +}; +oa.default = Nu; +var ca = {}; +Object.defineProperty(ca, "__esModule", { value: !0 }); +const Qr = se, Ru = { + message({ keyword: e, schemaCode: r }) { + const n = e === "maxItems" ? "more" : "fewer"; + return (0, Qr.str)`must NOT have ${n} than ${r} items`; + }, + params: ({ schemaCode: e }) => (0, Qr._)`{limit: ${e}}` +}, Au = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: !0, + error: Ru, + code(e) { + const { keyword: r, data: n, schemaCode: a } = e, u = r === "maxItems" ? Qr.operators.GT : Qr.operators.LT; + e.fail$data((0, Qr._)`${n}.length ${u} ${a}`); + } +}; +ca.default = Au; +var la = {}, nt = {}; +Object.defineProperty(nt, "__esModule", { value: !0 }); +const es = In; +es.code = 'require("ajv/dist/runtime/equal").default'; +nt.default = es; +Object.defineProperty(la, "__esModule", { value: !0 }); +const Mt = rt, Ee = se, Iu = ie, Mu = nt, Du = { + message: ({ params: { i: e, j: r } }) => (0, Ee.str)`must NOT have duplicate items (items ## ${r} and ${e} are identical)`, + params: ({ params: { i: e, j: r } }) => (0, Ee._)`{i: ${e}, j: ${r}}` +}, Lu = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: !0, + error: Du, + code(e) { + const { gen: r, data: n, $data: a, schema: u, parentSchema: o, schemaCode: p, it: y } = e; + if (!a && !u) + return; + const b = r.let("valid"), v = o.items ? (0, Mt.getSchemaTypes)(o.items) : []; + e.block$data(b, g, (0, Ee._)`${p} === false`), e.ok(b); + function g() { + const R = r.let("i", (0, Ee._)`${n}.length`), j = r.let("j"); + e.setParams({ i: R, j }), r.assign(b, !0), r.if((0, Ee._)`${R} > 1`, () => (S() ? z : L)(R, j)); + } + function S() { + return v.length > 0 && !v.some((R) => R === "object" || R === "array"); + } + function z(R, j) { + const T = r.name("item"), $ = (0, Mt.checkDataTypes)(v, T, y.opts.strictNumbers, Mt.DataType.Wrong), O = r.const("indices", (0, Ee._)`{}`); + r.for((0, Ee._)`;${R}--;`, () => { + r.let(T, (0, Ee._)`${n}[${R}]`), r.if($, (0, Ee._)`continue`), v.length > 1 && r.if((0, Ee._)`typeof ${T} == "string"`, (0, Ee._)`${T} += "_"`), r.if((0, Ee._)`typeof ${O}[${T}] == "number"`, () => { + r.assign(j, (0, Ee._)`${O}[${T}]`), e.error(), r.assign(b, !1).break(); + }).code((0, Ee._)`${O}[${T}] = ${R}`); + }); + } + function L(R, j) { + const T = (0, Iu.useFunc)(r, Mu.default), $ = r.name("outer"); + r.label($).for((0, Ee._)`;${R}--;`, () => r.for((0, Ee._)`${j} = ${R}; ${j}--;`, () => r.if((0, Ee._)`${T}(${n}[${R}], ${n}[${j}])`, () => { + e.error(), r.assign(b, !1).break($); + }))); + } + } +}; +la.default = Lu; +var fa = {}; +Object.defineProperty(fa, "__esModule", { value: !0 }); +const Bt = se, zu = ie, Vu = nt, Fu = { + message: "must be equal to constant", + params: ({ schemaCode: e }) => (0, Bt._)`{allowedValue: ${e}}` +}, Uu = { + keyword: "const", + $data: !0, + error: Fu, + code(e) { + const { gen: r, data: n, $data: a, schemaCode: u, schema: o } = e; + a || o && typeof o == "object" ? e.fail$data((0, Bt._)`!${(0, zu.useFunc)(r, Vu.default)}(${n}, ${u})`) : e.fail((0, Bt._)`${o} !== ${n}`); + } +}; +fa.default = Uu; +var ha = {}; +Object.defineProperty(ha, "__esModule", { value: !0 }); +const Wr = se, Bu = ie, Hu = nt, qu = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode: e }) => (0, Wr._)`{allowedValues: ${e}}` +}, Gu = { + keyword: "enum", + schemaType: "array", + $data: !0, + error: qu, + code(e) { + const { gen: r, data: n, $data: a, schema: u, schemaCode: o, it: p } = e; + if (!a && u.length === 0) + throw new Error("enum must have non-empty array"); + const y = u.length >= p.opts.loopEnum; + let b; + const v = () => b ?? (b = (0, Bu.useFunc)(r, Hu.default)); + let g; + if (y || a) + g = r.let("valid"), e.block$data(g, S); + else { + if (!Array.isArray(u)) + throw new Error("ajv implementation error"); + const L = r.const("vSchema", o); + g = (0, Wr.or)(...u.map((R, j) => z(L, j))); + } + e.pass(g); + function S() { + r.assign(g, !1), r.forOf("v", o, (L) => r.if((0, Wr._)`${v()}(${n}, ${L})`, () => r.assign(g, !0).break())); + } + function z(L, R) { + const j = u[R]; + return typeof j == "object" && j !== null ? (0, Wr._)`${v()}(${n}, ${L}[${R}])` : (0, Wr._)`${n} === ${j}`; + } + } +}; +ha.default = Gu; +Object.defineProperty(ta, "__esModule", { value: !0 }); +const Ku = aa, Wu = na, Ju = sa, Zu = ua, Yu = ia, Xu = oa, Qu = ca, xu = la, ei = fa, ri = ha, ti = [ + // number + Ku.default, + Wu.default, + // string + Ju.default, + Zu.default, + // object + Yu.default, + Xu.default, + // array + Qu.default, + xu.default, + // any + { keyword: "type", schemaType: ["string", "array"] }, + { keyword: "nullable", schemaType: "boolean" }, + ei.default, + ri.default +]; +ta.default = ti; +var pa = {}, Ir = {}; +Object.defineProperty(Ir, "__esModule", { value: !0 }); +Ir.validateAdditionalItems = void 0; +const _r = se, Ht = ie, ai = { + message: ({ params: { len: e } }) => (0, _r.str)`must NOT have more than ${e} items`, + params: ({ params: { len: e } }) => (0, _r._)`{limit: ${e}}` +}, ni = { + keyword: "additionalItems", + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error: ai, + code(e) { + const { parentSchema: r, it: n } = e, { items: a } = r; + if (!Array.isArray(a)) { + (0, Ht.checkStrictMode)(n, '"additionalItems" is ignored when "items" is not an array of schemas'); + return; + } + rs(e, a); + } +}; +function rs(e, r) { + const { gen: n, schema: a, data: u, keyword: o, it: p } = e; + p.items = !0; + const y = n.const("len", (0, _r._)`${u}.length`); + if (a === !1) + e.setParams({ len: r.length }), e.pass((0, _r._)`${y} <= ${r.length}`); + else if (typeof a == "object" && !(0, Ht.alwaysValidSchema)(p, a)) { + const v = n.var("valid", (0, _r._)`${y} <= ${r.length}`); + n.if((0, _r.not)(v), () => b(v)), e.ok(v); + } + function b(v) { + n.forRange("i", r.length, y, (g) => { + e.subschema({ keyword: o, dataProp: g, dataPropType: Ht.Type.Num }, v), p.allErrors || n.if((0, _r.not)(v), () => n.break()); + }); + } +} +Ir.validateAdditionalItems = rs; +Ir.default = ni; +var ma = {}, Mr = {}; +Object.defineProperty(Mr, "__esModule", { value: !0 }); +Mr.validateTuple = void 0; +const rn = se, _t = ie, si = ne, di = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(e) { + const { schema: r, it: n } = e; + if (Array.isArray(r)) + return ts(e, "additionalItems", r); + n.items = !0, !(0, _t.alwaysValidSchema)(n, r) && e.ok((0, si.validateArray)(e)); + } +}; +function ts(e, r, n = e.schema) { + const { gen: a, parentSchema: u, data: o, keyword: p, it: y } = e; + g(u), y.opts.unevaluated && n.length && y.items !== !0 && (y.items = _t.mergeEvaluated.items(a, n.length, y.items)); + const b = a.name("valid"), v = a.const("len", (0, rn._)`${o}.length`); + n.forEach((S, z) => { + (0, _t.alwaysValidSchema)(y, S) || (a.if((0, rn._)`${v} > ${z}`, () => e.subschema({ + keyword: p, + schemaProp: z, + dataProp: z + }, b)), e.ok(b)); + }); + function g(S) { + const { opts: z, errSchemaPath: L } = y, R = n.length, j = R === S.minItems && (R === S.maxItems || S[r] === !1); + if (z.strictTuples && !j) { + const T = `"${p}" is ${R}-tuple, but minItems or maxItems/${r} are not specified or different at path "${L}"`; + (0, _t.checkStrictMode)(y, T, z.strictTuples); + } + } +} +Mr.validateTuple = ts; +Mr.default = di; +Object.defineProperty(ma, "__esModule", { value: !0 }); +const ui = Mr, ii = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (e) => (0, ui.validateTuple)(e, "items") +}; +ma.default = ii; +var ga = {}; +Object.defineProperty(ga, "__esModule", { value: !0 }); +const tn = se, oi = ie, ci = ne, li = Ir, fi = { + message: ({ params: { len: e } }) => (0, tn.str)`must NOT have more than ${e} items`, + params: ({ params: { len: e } }) => (0, tn._)`{limit: ${e}}` +}, hi = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error: fi, + code(e) { + const { schema: r, parentSchema: n, it: a } = e, { prefixItems: u } = n; + a.items = !0, !(0, oi.alwaysValidSchema)(a, r) && (u ? (0, li.validateAdditionalItems)(e, u) : e.ok((0, ci.validateArray)(e))); + } +}; +ga.default = hi; +var _a = {}; +Object.defineProperty(_a, "__esModule", { value: !0 }); +const ze = se, ct = ie, pi = { + message: ({ params: { min: e, max: r } }) => r === void 0 ? (0, ze.str)`must contain at least ${e} valid item(s)` : (0, ze.str)`must contain at least ${e} and no more than ${r} valid item(s)`, + params: ({ params: { min: e, max: r } }) => r === void 0 ? (0, ze._)`{minContains: ${e}}` : (0, ze._)`{minContains: ${e}, maxContains: ${r}}` +}, mi = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: !0, + error: pi, + code(e) { + const { gen: r, schema: n, parentSchema: a, data: u, it: o } = e; + let p, y; + const { minContains: b, maxContains: v } = a; + o.opts.next ? (p = b === void 0 ? 1 : b, y = v) : p = 1; + const g = r.const("len", (0, ze._)`${u}.length`); + if (e.setParams({ min: p, max: y }), y === void 0 && p === 0) { + (0, ct.checkStrictMode)(o, '"minContains" == 0 without "maxContains": "contains" keyword ignored'); + return; + } + if (y !== void 0 && p > y) { + (0, ct.checkStrictMode)(o, '"minContains" > "maxContains" is always invalid'), e.fail(); + return; + } + if ((0, ct.alwaysValidSchema)(o, n)) { + let j = (0, ze._)`${g} >= ${p}`; + y !== void 0 && (j = (0, ze._)`${j} && ${g} <= ${y}`), e.pass(j); + return; + } + o.items = !0; + const S = r.name("valid"); + y === void 0 && p === 1 ? L(S, () => r.if(S, () => r.break())) : p === 0 ? (r.let(S, !0), y !== void 0 && r.if((0, ze._)`${u}.length > 0`, z)) : (r.let(S, !1), z()), e.result(S, () => e.reset()); + function z() { + const j = r.name("_valid"), T = r.let("count", 0); + L(j, () => r.if(j, () => R(T))); + } + function L(j, T) { + r.forRange("i", 0, g, ($) => { + e.subschema({ + keyword: "contains", + dataProp: $, + dataPropType: ct.Type.Num, + compositeRule: !0 + }, j), T(); + }); + } + function R(j) { + r.code((0, ze._)`${j}++`), y === void 0 ? r.if((0, ze._)`${j} >= ${p}`, () => r.assign(S, !0).break()) : (r.if((0, ze._)`${j} > ${y}`, () => r.assign(S, !1).break()), p === 1 ? r.assign(S, !0) : r.if((0, ze._)`${j} >= ${p}`, () => r.assign(S, !0))); + } + } +}; +_a.default = mi; +var as = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0; + const r = se, n = ie, a = ne; + e.error = { + message: ({ params: { property: b, depsCount: v, deps: g } }) => { + const S = v === 1 ? "property" : "properties"; + return (0, r.str)`must have ${S} ${g} when property ${b} is present`; + }, + params: ({ params: { property: b, depsCount: v, deps: g, missingProperty: S } }) => (0, r._)`{property: ${b}, + missingProperty: ${S}, + depsCount: ${v}, + deps: ${g}}` + // TODO change to reference + }; + const u = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error: e.error, + code(b) { + const [v, g] = o(b); + p(b, v), y(b, g); + } + }; + function o({ schema: b }) { + const v = {}, g = {}; + for (const S in b) { + if (S === "__proto__") + continue; + const z = Array.isArray(b[S]) ? v : g; + z[S] = b[S]; + } + return [v, g]; + } + function p(b, v = b.schema) { + const { gen: g, data: S, it: z } = b; + if (Object.keys(v).length === 0) + return; + const L = g.let("missing"); + for (const R in v) { + const j = v[R]; + if (j.length === 0) + continue; + const T = (0, a.propertyInData)(g, S, R, z.opts.ownProperties); + b.setParams({ + property: R, + depsCount: j.length, + deps: j.join(", ") + }), z.allErrors ? g.if(T, () => { + for (const $ of j) + (0, a.checkReportMissingProp)(b, $); + }) : (g.if((0, r._)`${T} && (${(0, a.checkMissingProp)(b, j, L)})`), (0, a.reportMissingProp)(b, L), g.else()); + } + } + e.validatePropertyDeps = p; + function y(b, v = b.schema) { + const { gen: g, data: S, keyword: z, it: L } = b, R = g.name("valid"); + for (const j in v) + (0, n.alwaysValidSchema)(L, v[j]) || (g.if( + (0, a.propertyInData)(g, S, j, L.opts.ownProperties), + () => { + const T = b.subschema({ keyword: z, schemaProp: j }, R); + b.mergeValidEvaluated(T, R); + }, + () => g.var(R, !0) + // TODO var + ), b.ok(R)); + } + e.validateSchemaDeps = y, e.default = u; +})(as); +var va = {}; +Object.defineProperty(va, "__esModule", { value: !0 }); +const ns = se, gi = ie, _i = { + message: "property name must be valid", + params: ({ params: e }) => (0, ns._)`{propertyName: ${e.propertyName}}` +}, vi = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error: _i, + code(e) { + const { gen: r, schema: n, data: a, it: u } = e; + if ((0, gi.alwaysValidSchema)(u, n)) + return; + const o = r.name("valid"); + r.forIn("key", a, (p) => { + e.setParams({ propertyName: p }), e.subschema({ + keyword: "propertyNames", + data: p, + dataTypes: ["string"], + propertyName: p, + compositeRule: !0 + }, o), r.if((0, ns.not)(o), () => { + e.error(!0), u.allErrors || r.break(); + }); + }), e.ok(o); + } +}; +va.default = vi; +var Ot = {}; +Object.defineProperty(Ot, "__esModule", { value: !0 }); +const lt = ne, Ue = se, yi = Qe, ft = ie, wi = { + message: "must NOT have additional properties", + params: ({ params: e }) => (0, Ue._)`{additionalProperty: ${e.additionalProperty}}` +}, bi = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: !0, + trackErrors: !0, + error: wi, + code(e) { + const { gen: r, schema: n, parentSchema: a, data: u, errsCount: o, it: p } = e; + if (!o) + throw new Error("ajv implementation error"); + const { allErrors: y, opts: b } = p; + if (p.props = !0, b.removeAdditional !== "all" && (0, ft.alwaysValidSchema)(p, n)) + return; + const v = (0, lt.allSchemaProperties)(a.properties), g = (0, lt.allSchemaProperties)(a.patternProperties); + S(), e.ok((0, Ue._)`${o} === ${yi.default.errors}`); + function S() { + r.forIn("key", u, (T) => { + !v.length && !g.length ? R(T) : r.if(z(T), () => R(T)); + }); + } + function z(T) { + let $; + if (v.length > 8) { + const O = (0, ft.schemaRefOrVal)(p, a.properties, "properties"); + $ = (0, lt.isOwnProperty)(r, O, T); + } else + v.length ? $ = (0, Ue.or)(...v.map((O) => (0, Ue._)`${T} === ${O}`)) : $ = Ue.nil; + return g.length && ($ = (0, Ue.or)($, ...g.map((O) => (0, Ue._)`${(0, lt.usePattern)(e, O)}.test(${T})`))), (0, Ue.not)($); + } + function L(T) { + r.code((0, Ue._)`delete ${u}[${T}]`); + } + function R(T) { + if (b.removeAdditional === "all" || b.removeAdditional && n === !1) { + L(T); + return; + } + if (n === !1) { + e.setParams({ additionalProperty: T }), e.error(), y || r.break(); + return; + } + if (typeof n == "object" && !(0, ft.alwaysValidSchema)(p, n)) { + const $ = r.name("valid"); + b.removeAdditional === "failing" ? (j(T, $, !1), r.if((0, Ue.not)($), () => { + e.reset(), L(T); + })) : (j(T, $), y || r.if((0, Ue.not)($), () => r.break())); + } + } + function j(T, $, O) { + const D = { + keyword: "additionalProperties", + dataProp: T, + dataPropType: ft.Type.Str + }; + O === !1 && Object.assign(D, { + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }), e.subschema(D, $); + } + } +}; +Ot.default = bi; +var ya = {}; +Object.defineProperty(ya, "__esModule", { value: !0 }); +const $i = qe, an = ne, Dt = ie, nn = Ot, Ei = { + keyword: "properties", + type: "object", + schemaType: "object", + code(e) { + const { gen: r, schema: n, parentSchema: a, data: u, it: o } = e; + o.opts.removeAdditional === "all" && a.additionalProperties === void 0 && nn.default.code(new $i.KeywordCxt(o, nn.default, "additionalProperties")); + const p = (0, an.allSchemaProperties)(n); + for (const S of p) + o.definedProperties.add(S); + o.opts.unevaluated && p.length && o.props !== !0 && (o.props = Dt.mergeEvaluated.props(r, (0, Dt.toHash)(p), o.props)); + const y = p.filter((S) => !(0, Dt.alwaysValidSchema)(o, n[S])); + if (y.length === 0) + return; + const b = r.name("valid"); + for (const S of y) + v(S) ? g(S) : (r.if((0, an.propertyInData)(r, u, S, o.opts.ownProperties)), g(S), o.allErrors || r.else().var(b, !0), r.endIf()), e.it.definedProperties.add(S), e.ok(b); + function v(S) { + return o.opts.useDefaults && !o.compositeRule && n[S].default !== void 0; + } + function g(S) { + e.subschema({ + keyword: "properties", + schemaProp: S, + dataProp: S + }, b); + } + } +}; +ya.default = Ei; +var wa = {}; +Object.defineProperty(wa, "__esModule", { value: !0 }); +const sn = ne, ht = se, dn = ie, un = ie, ki = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(e) { + const { gen: r, schema: n, data: a, parentSchema: u, it: o } = e, { opts: p } = o, y = (0, sn.allSchemaProperties)(n), b = y.filter((j) => (0, dn.alwaysValidSchema)(o, n[j])); + if (y.length === 0 || b.length === y.length && (!o.opts.unevaluated || o.props === !0)) + return; + const v = p.strictSchema && !p.allowMatchingProperties && u.properties, g = r.name("valid"); + o.props !== !0 && !(o.props instanceof ht.Name) && (o.props = (0, un.evaluatedPropsToName)(r, o.props)); + const { props: S } = o; + z(); + function z() { + for (const j of y) + v && L(j), o.allErrors ? R(j) : (r.var(g, !0), R(j), r.if(g)); + } + function L(j) { + for (const T in v) + new RegExp(j).test(T) && (0, dn.checkStrictMode)(o, `property ${T} matches pattern ${j} (use allowMatchingProperties)`); + } + function R(j) { + r.forIn("key", a, (T) => { + r.if((0, ht._)`${(0, sn.usePattern)(e, j)}.test(${T})`, () => { + const $ = b.includes(j); + $ || e.subschema({ + keyword: "patternProperties", + schemaProp: j, + dataProp: T, + dataPropType: un.Type.Str + }, g), o.opts.unevaluated && S !== !0 ? r.assign((0, ht._)`${S}[${T}]`, !0) : !$ && !o.allErrors && r.if((0, ht.not)(g), () => r.break()); + }); + }); + } + } +}; +wa.default = ki; +var ba = {}; +Object.defineProperty(ba, "__esModule", { value: !0 }); +const Pi = ie, Si = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: !0, + code(e) { + const { gen: r, schema: n, it: a } = e; + if ((0, Pi.alwaysValidSchema)(a, n)) { + e.fail(); + return; + } + const u = r.name("valid"); + e.subschema({ + keyword: "not", + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }, u), e.failResult(u, () => e.reset(), () => e.error()); + }, + error: { message: "must NOT be valid" } +}; +ba.default = Si; +var $a = {}; +Object.defineProperty($a, "__esModule", { value: !0 }); +const Ci = ne, Ti = { + keyword: "anyOf", + schemaType: "array", + trackErrors: !0, + code: Ci.validateUnion, + error: { message: "must match a schema in anyOf" } +}; +$a.default = Ti; +var Ea = {}; +Object.defineProperty(Ea, "__esModule", { value: !0 }); +const vt = se, ji = ie, Oi = { + message: "must match exactly one schema in oneOf", + params: ({ params: e }) => (0, vt._)`{passingSchemas: ${e.passing}}` +}, Ni = { + keyword: "oneOf", + schemaType: "array", + trackErrors: !0, + error: Oi, + code(e) { + const { gen: r, schema: n, parentSchema: a, it: u } = e; + if (!Array.isArray(n)) + throw new Error("ajv implementation error"); + if (u.opts.discriminator && a.discriminator) + return; + const o = n, p = r.let("valid", !1), y = r.let("passing", null), b = r.name("_valid"); + e.setParams({ passing: y }), r.block(v), e.result(p, () => e.reset(), () => e.error(!0)); + function v() { + o.forEach((g, S) => { + let z; + (0, ji.alwaysValidSchema)(u, g) ? r.var(b, !0) : z = e.subschema({ + keyword: "oneOf", + schemaProp: S, + compositeRule: !0 + }, b), S > 0 && r.if((0, vt._)`${b} && ${p}`).assign(p, !1).assign(y, (0, vt._)`[${y}, ${S}]`).else(), r.if(b, () => { + r.assign(p, !0), r.assign(y, S), z && e.mergeEvaluated(z, vt.Name); + }); + }); + } + } +}; +Ea.default = Ni; +var ka = {}; +Object.defineProperty(ka, "__esModule", { value: !0 }); +const Ri = ie, Ai = { + keyword: "allOf", + schemaType: "array", + code(e) { + const { gen: r, schema: n, it: a } = e; + if (!Array.isArray(n)) + throw new Error("ajv implementation error"); + const u = r.name("valid"); + n.forEach((o, p) => { + if ((0, Ri.alwaysValidSchema)(a, o)) + return; + const y = e.subschema({ keyword: "allOf", schemaProp: p }, u); + e.ok(u), e.mergeEvaluated(y); + }); + } +}; +ka.default = Ai; +var Pa = {}; +Object.defineProperty(Pa, "__esModule", { value: !0 }); +const kt = se, ss = ie, Ii = { + message: ({ params: e }) => (0, kt.str)`must match "${e.ifClause}" schema`, + params: ({ params: e }) => (0, kt._)`{failingKeyword: ${e.ifClause}}` +}, Mi = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: !0, + error: Ii, + code(e) { + const { gen: r, parentSchema: n, it: a } = e; + n.then === void 0 && n.else === void 0 && (0, ss.checkStrictMode)(a, '"if" without "then" and "else" is ignored'); + const u = on(a, "then"), o = on(a, "else"); + if (!u && !o) + return; + const p = r.let("valid", !0), y = r.name("_valid"); + if (b(), e.reset(), u && o) { + const g = r.let("ifClause"); + e.setParams({ ifClause: g }), r.if(y, v("then", g), v("else", g)); + } else + u ? r.if(y, v("then")) : r.if((0, kt.not)(y), v("else")); + e.pass(p, () => e.error(!0)); + function b() { + const g = e.subschema({ + keyword: "if", + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }, y); + e.mergeEvaluated(g); + } + function v(g, S) { + return () => { + const z = e.subschema({ keyword: g }, y); + r.assign(p, y), e.mergeValidEvaluated(z, p), S ? r.assign(S, (0, kt._)`${g}`) : e.setParams({ ifClause: g }); + }; + } + } +}; +function on(e, r) { + const n = e.schema[r]; + return n !== void 0 && !(0, ss.alwaysValidSchema)(e, n); +} +Pa.default = Mi; +var Sa = {}; +Object.defineProperty(Sa, "__esModule", { value: !0 }); +const Di = ie, Li = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({ keyword: e, parentSchema: r, it: n }) { + r.if === void 0 && (0, Di.checkStrictMode)(n, `"${e}" without "if" is ignored`); + } +}; +Sa.default = Li; +Object.defineProperty(pa, "__esModule", { value: !0 }); +const zi = Ir, Vi = ma, Fi = Mr, Ui = ga, Bi = _a, Hi = as, qi = va, Gi = Ot, Ki = ya, Wi = wa, Ji = ba, Zi = $a, Yi = Ea, Xi = ka, Qi = Pa, xi = Sa; +function eo(e = !1) { + const r = [ + // any + Ji.default, + Zi.default, + Yi.default, + Xi.default, + Qi.default, + xi.default, + // object + qi.default, + Gi.default, + Hi.default, + Ki.default, + Wi.default + ]; + return e ? r.push(Vi.default, Ui.default) : r.push(zi.default, Fi.default), r.push(Bi.default), r; +} +pa.default = eo; +var Ca = {}, Ta = {}; +Object.defineProperty(Ta, "__esModule", { value: !0 }); +const ye = se, ro = { + message: ({ schemaCode: e }) => (0, ye.str)`must match format "${e}"`, + params: ({ schemaCode: e }) => (0, ye._)`{format: ${e}}` +}, to = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: !0, + error: ro, + code(e, r) { + const { gen: n, data: a, $data: u, schema: o, schemaCode: p, it: y } = e, { opts: b, errSchemaPath: v, schemaEnv: g, self: S } = y; + if (!b.validateFormats) + return; + u ? z() : L(); + function z() { + const R = n.scopeValue("formats", { + ref: S.formats, + code: b.code.formats + }), j = n.const("fDef", (0, ye._)`${R}[${p}]`), T = n.let("fType"), $ = n.let("format"); + n.if((0, ye._)`typeof ${j} == "object" && !(${j} instanceof RegExp)`, () => n.assign(T, (0, ye._)`${j}.type || "string"`).assign($, (0, ye._)`${j}.validate`), () => n.assign(T, (0, ye._)`"string"`).assign($, j)), e.fail$data((0, ye.or)(O(), D())); + function O() { + return b.strictSchema === !1 ? ye.nil : (0, ye._)`${p} && !${$}`; + } + function D() { + const t = g.$async ? (0, ye._)`(${j}.async ? await ${$}(${a}) : ${$}(${a}))` : (0, ye._)`${$}(${a})`, d = (0, ye._)`(typeof ${$} == "function" ? ${t} : ${$}.test(${a}))`; + return (0, ye._)`${$} && ${$} !== true && ${T} === ${r} && !${d}`; + } + } + function L() { + const R = S.formats[o]; + if (!R) { + O(); + return; + } + if (R === !0) + return; + const [j, T, $] = D(R); + j === r && e.pass(t()); + function O() { + if (b.strictSchema === !1) { + S.logger.warn(d()); + return; + } + throw new Error(d()); + function d() { + return `unknown format "${o}" ignored in schema at path "${v}"`; + } + } + function D(d) { + const s = d instanceof RegExp ? (0, ye.regexpCode)(d) : b.code.formats ? (0, ye._)`${b.code.formats}${(0, ye.getProperty)(o)}` : void 0, i = n.scopeValue("formats", { key: o, ref: d, code: s }); + return typeof d == "object" && !(d instanceof RegExp) ? [d.type || "string", d.validate, (0, ye._)`${i}.validate`] : ["string", d, i]; + } + function t() { + if (typeof R == "object" && !(R instanceof RegExp) && R.async) { + if (!g.$async) + throw new Error("async format in sync schema"); + return (0, ye._)`await ${$}(${a})`; + } + return typeof T == "function" ? (0, ye._)`${$}(${a})` : (0, ye._)`${$}.test(${a})`; + } + } + } +}; +Ta.default = to; +Object.defineProperty(Ca, "__esModule", { value: !0 }); +const ao = Ta, no = [ao.default]; +Ca.default = no; +var Ar = {}; +Object.defineProperty(Ar, "__esModule", { value: !0 }); +Ar.contentVocabulary = Ar.metadataVocabulary = void 0; +Ar.metadataVocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples" +]; +Ar.contentVocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema" +]; +Object.defineProperty(xt, "__esModule", { value: !0 }); +const so = ea, uo = ta, io = pa, oo = Ca, cn = Ar, co = [ + so.default, + uo.default, + (0, io.default)(), + oo.default, + cn.metadataVocabulary, + cn.contentVocabulary +]; +xt.default = co; +var ja = {}, ds = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.DiscrError = void 0, function(r) { + r.Tag = "tag", r.Mapping = "mapping"; + }(e.DiscrError || (e.DiscrError = {})); +})(ds); +Object.defineProperty(ja, "__esModule", { value: !0 }); +const Tr = se, qt = ds, ln = Re, lo = ie, fo = { + message: ({ params: { discrError: e, tagName: r } }) => e === qt.DiscrError.Tag ? `tag "${r}" must be string` : `value of tag "${r}" must be in oneOf`, + params: ({ params: { discrError: e, tag: r, tagName: n } }) => (0, Tr._)`{error: ${e}, tag: ${n}, tagValue: ${r}}` +}, ho = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error: fo, + code(e) { + const { gen: r, data: n, schema: a, parentSchema: u, it: o } = e, { oneOf: p } = u; + if (!o.opts.discriminator) + throw new Error("discriminator: requires discriminator option"); + const y = a.propertyName; + if (typeof y != "string") + throw new Error("discriminator: requires propertyName"); + if (a.mapping) + throw new Error("discriminator: mapping is not supported"); + if (!p) + throw new Error("discriminator: requires oneOf keyword"); + const b = r.let("valid", !1), v = r.const("tag", (0, Tr._)`${n}${(0, Tr.getProperty)(y)}`); + r.if((0, Tr._)`typeof ${v} == "string"`, () => g(), () => e.error(!1, { discrError: qt.DiscrError.Tag, tag: v, tagName: y })), e.ok(b); + function g() { + const L = z(); + r.if(!1); + for (const R in L) + r.elseIf((0, Tr._)`${v} === ${R}`), r.assign(b, S(L[R])); + r.else(), e.error(!1, { discrError: qt.DiscrError.Mapping, tag: v, tagName: y }), r.endIf(); + } + function S(L) { + const R = r.name("valid"), j = e.subschema({ keyword: "oneOf", schemaProp: L }, R); + return e.mergeEvaluated(j, Tr.Name), R; + } + function z() { + var L; + const R = {}, j = $(u); + let T = !0; + for (let t = 0; t < p.length; t++) { + let d = p[t]; + d != null && d.$ref && !(0, lo.schemaHasRulesButRef)(d, o.self.RULES) && (d = ln.resolveRef.call(o.self, o.schemaEnv.root, o.baseId, d == null ? void 0 : d.$ref), d instanceof ln.SchemaEnv && (d = d.schema)); + const s = (L = d == null ? void 0 : d.properties) === null || L === void 0 ? void 0 : L[y]; + if (typeof s != "object") + throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${y}"`); + T = T && (j || $(d)), O(s, t); + } + if (!T) + throw new Error(`discriminator: "${y}" must be required`); + return R; + function $({ required: t }) { + return Array.isArray(t) && t.includes(y); + } + function O(t, d) { + if (t.const) + D(t.const, d); + else if (t.enum) + for (const s of t.enum) + D(s, d); + else + throw new Error(`discriminator: "properties/${y}" must have "const" or "enum"`); + } + function D(t, d) { + if (typeof t != "string" || t in R) + throw new Error(`discriminator: "${y}" values must be unique strings`); + R[t] = d; + } + } + } +}; +ja.default = ho; +const po = "http://json-schema.org/draft-07/schema#", mo = "http://json-schema.org/draft-07/schema#", go = "Core schema meta-schema", _o = { + schemaArray: { + type: "array", + minItems: 1, + items: { + $ref: "#" + } + }, + nonNegativeInteger: { + type: "integer", + minimum: 0 + }, + nonNegativeIntegerDefault0: { + allOf: [ + { + $ref: "#/definitions/nonNegativeInteger" + }, + { + default: 0 + } + ] + }, + simpleTypes: { + enum: [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + stringArray: { + type: "array", + items: { + type: "string" + }, + uniqueItems: !0, + default: [] + } +}, vo = [ + "object", + "boolean" +], yo = { + $id: { + type: "string", + format: "uri-reference" + }, + $schema: { + type: "string", + format: "uri" + }, + $ref: { + type: "string", + format: "uri-reference" + }, + $comment: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: !0, + readOnly: { + type: "boolean", + default: !1 + }, + examples: { + type: "array", + items: !0 + }, + multipleOf: { + type: "number", + exclusiveMinimum: 0 + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "number" + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "number" + }, + maxLength: { + $ref: "#/definitions/nonNegativeInteger" + }, + minLength: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { + $ref: "#" + }, + items: { + anyOf: [ + { + $ref: "#" + }, + { + $ref: "#/definitions/schemaArray" + } + ], + default: !0 + }, + maxItems: { + $ref: "#/definitions/nonNegativeInteger" + }, + minItems: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + uniqueItems: { + type: "boolean", + default: !1 + }, + contains: { + $ref: "#" + }, + maxProperties: { + $ref: "#/definitions/nonNegativeInteger" + }, + minProperties: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + required: { + $ref: "#/definitions/stringArray" + }, + additionalProperties: { + $ref: "#" + }, + definitions: { + type: "object", + additionalProperties: { + $ref: "#" + }, + default: {} + }, + properties: { + type: "object", + additionalProperties: { + $ref: "#" + }, + default: {} + }, + patternProperties: { + type: "object", + additionalProperties: { + $ref: "#" + }, + propertyNames: { + format: "regex" + }, + default: {} + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [ + { + $ref: "#" + }, + { + $ref: "#/definitions/stringArray" + } + ] + } + }, + propertyNames: { + $ref: "#" + }, + const: !0, + enum: { + type: "array", + items: !0, + minItems: 1, + uniqueItems: !0 + }, + type: { + anyOf: [ + { + $ref: "#/definitions/simpleTypes" + }, + { + type: "array", + items: { + $ref: "#/definitions/simpleTypes" + }, + minItems: 1, + uniqueItems: !0 + } + ] + }, + format: { + type: "string" + }, + contentMediaType: { + type: "string" + }, + contentEncoding: { + type: "string" + }, + if: { + $ref: "#" + }, + then: { + $ref: "#" + }, + else: { + $ref: "#" + }, + allOf: { + $ref: "#/definitions/schemaArray" + }, + anyOf: { + $ref: "#/definitions/schemaArray" + }, + oneOf: { + $ref: "#/definitions/schemaArray" + }, + not: { + $ref: "#" + } +}, wo = { + $schema: po, + $id: mo, + title: go, + definitions: _o, + type: vo, + properties: yo, + default: !0 +}; +(function(e, r) { + Object.defineProperty(r, "__esModule", { value: !0 }), r.MissingRefError = r.ValidationError = r.CodeGen = r.Name = r.nil = r.stringify = r.str = r._ = r.KeywordCxt = void 0; + const n = Sn, a = xt, u = ja, o = wo, p = ["/properties"], y = "http://json-schema.org/draft-07/schema"; + class b extends n.default { + _addVocabularies() { + super._addVocabularies(), a.default.forEach((R) => this.addVocabulary(R)), this.opts.discriminator && this.addKeyword(u.default); + } + _addDefaultMetaSchema() { + if (super._addDefaultMetaSchema(), !this.opts.meta) + return; + const R = this.opts.$data ? this.$dataMetaSchema(o, p) : o; + this.addMetaSchema(R, y, !1), this.refs["http://json-schema.org/schema"] = y; + } + defaultMeta() { + return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(y) ? y : void 0); + } + } + e.exports = r = b, Object.defineProperty(r, "__esModule", { value: !0 }), r.default = b; + var v = qe; + Object.defineProperty(r, "KeywordCxt", { enumerable: !0, get: function() { + return v.KeywordCxt; + } }); + var g = se; + Object.defineProperty(r, "_", { enumerable: !0, get: function() { + return g._; + } }), Object.defineProperty(r, "str", { enumerable: !0, get: function() { + return g.str; + } }), Object.defineProperty(r, "stringify", { enumerable: !0, get: function() { + return g.stringify; + } }), Object.defineProperty(r, "nil", { enumerable: !0, get: function() { + return g.nil; + } }), Object.defineProperty(r, "Name", { enumerable: !0, get: function() { + return g.Name; + } }), Object.defineProperty(r, "CodeGen", { enumerable: !0, get: function() { + return g.CodeGen; + } }); + var S = tt; + Object.defineProperty(r, "ValidationError", { enumerable: !0, get: function() { + return S.default; + } }); + var z = at; + Object.defineProperty(r, "MissingRefError", { enumerable: !0, get: function() { + return z.default; + } }); +})(zt, zt.exports); +var bo = zt.exports; +const $o = /* @__PURE__ */ Pn(bo); +class Eo { + constructor() { + be(this, "ajv"); + this.ajv = new $o(); + } + validateJson(r, n) { + const a = this.ajv.validate(r, n); + return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() }; + } + validateObjectSchema(r, n) { + const a = this.ajv.validate(r, n); + return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() }; + } +} +class ko { + constructor() { + be(this, "TIME_SPLIT", " "); + } + /** + * 给日期添加小时 + * + * @param date - Date + * @param numOfHours - 数字 + * @author terwer + * @since 1.0.0 + */ + addHoursToDate(r, n) { + return r.setTime(r.getTime() + n * 60 * 60 * 1e3), r; + } + /** + * 转换ISO日期为中文日期的通用转换方法 + * + * @param str - '2022-07-18T06:25:48.000Z + * @param isAddTimeZone - 是否增加时区(默认不增加) + * @param isShort - 是否只返回日期 + * @author terwer + * @since 1.0.0 + */ + formatIsoToZhDateFormat(r, n, a) { + if (!r) + return ""; + let u = r; + const o = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, p = u.match(o); + if (p == null) + return r; + for (let y = 0; y < p.length; y++) { + const b = p[y]; + let v = b; + n && (v = this.addHoursToDate(new Date(b), 8).toISOString()); + const g = v.split("T"), S = g[0], z = g[1].split(".")[0]; + let L = S + this.TIME_SPLIT + z; + a && (L = S), u = u.replace(b, L); + } + return u; + } + /** + * 转换ISO日期为中文完整时间 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZh(r) { + return this.formatIsoToZhDateFormat(r, !1, !1); + } + /** + * 转换ISO日期为中文日期 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZhDate(r) { + return this.formatIsoToZhDateFormat(r, !1, !0); + } + /** + * 转换ISO日期为中文时间 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZhTime(r) { + return this.formatIsoToZhDateFormat(r, !1).split(this.TIME_SPLIT)[1]; + } + /** + * 当前日期时间完整格式,格式:2023-03-10 02:03:43 + */ + nowZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0); + } + /** + * 当前日期,格式:2023-03-10 + */ + nowDateZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0, !0); + } + /** + * 当前时间,格式:02:03:43 + */ + nowTimeZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0).split(this.TIME_SPLIT)[1]; + } +} +class Po { + /** + * 格式化字符串 + * + * @param str - 字符串,可用占位符,例如:test \{0\} str + * @param args - 按占位符顺序排列的参数 + * @author terwer + * @since 0.0.1 + */ + f(r, ...n) { + let a = r; + for (let u = 0; u < n.length; u++) { + const o = n[u]; + typeof o == "string" ? a = a.replace(`{${u}}`, o) : a = a.replace(`{${u}}`, o.toString()); + } + return a; + } + /** + * 字符串拼接 + * + * @param str - 字符串数组 + */ + appendStr(...r) { + return r.join(""); + } + /** + * 判断字符串中,是否包含数组中任何一个元素 + * + * @param str - 字符串 + * @param arr - 字符串数组 + */ + includeInArray(r, n) { + let a = !1; + for (let u = 0; u < n.length; u++) { + const o = n[u]; + r.includes(o) && (a = !0); + } + return a; + } + /** + * 截取指定长度的字符串 + * + * @param str - str + * @param length - 长度 + * @param ignore - 不要结尾省略号 + */ + getByLength(r, n, a) { + const u = r; + return u.length < n ? u : a ? u.substring(0, n) : u.substring(0, n) + "..."; + } + /** + * 字符串空值检测 + * + * @param str - 待检测的字符串 + */ + isEmptyString(r) { + return !r || typeof r != "string" ? !0 : r.trim().length === 0; + } + /** + * 路径组合,解决多出来/的问题 + * + * @param path1 - 路径1 + * @param path2 - 路径2 + */ + pathJoin(r, n) { + let a = r; + const u = r.lastIndexOf("/"); + return u + 1 === r.length && (a = r.substring(0, u)), n.indexOf("/") > 0 ? a = a + "/" + n : a = a + n, a; + } + /** + * 强转boolean + * + * @param val - val + */ + parseBoolean(r) { + return r || (r = "false"), r.toString().toLowerCase() === "true"; + } +} +const Lt = (e, r) => { + const n = fn(e), a = fn(r), u = n.pop(), o = a.pop(), p = mn(n, a); + return p !== 0 ? p : u && o ? mn(u.split("."), o.split(".")) : u || o ? u ? -1 : 1 : 0; +}, So = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, fn = (e) => { + if (typeof e != "string") + throw new TypeError("Invalid argument expected string"); + const r = e.match(So); + if (!r) + throw new Error(`Invalid argument not valid semver ('${e}' received)`); + return r.shift(), r; +}, hn = (e) => e === "*" || e === "x" || e === "X", pn = (e) => { + const r = parseInt(e, 10); + return isNaN(r) ? e : r; +}, Co = (e, r) => typeof e != typeof r ? [String(e), String(r)] : [e, r], To = (e, r) => { + if (hn(e) || hn(r)) + return 0; + const [n, a] = Co(pn(e), pn(r)); + return n > a ? 1 : n < a ? -1 : 0; +}, mn = (e, r) => { + for (let n = 0; n < Math.max(e.length, r.length); n++) { + const a = To(e[n] || "0", r[n] || "0"); + if (a !== 0) + return a; + } + return 0; +}; +class jo { + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is higher than v2 + */ + greater(r, n) { + return Lt(r, n) > 0; + } + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is equal to v2 + */ + equal(r, n) { + return Lt(r, n) === 0; + } + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is lesser than v2 + */ + lesser(r, n) { + return Lt(r, n) < 0; + } +} +var Oo = Object.defineProperty, No = (e, r, n) => r in e ? Oo(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, jr = (e, r, n) => (No(e, typeof r != "symbol" ? r + "" : r, n), n); +let dr = class { +}; +jr(dr, "NODE_ENV_KEY", "NODE_ENV"), /** +* 开发环境 +*/ +jr(dr, "NODE_ENV_DEVELOPMENT", "development"), /** +* 生产环境 +*/ +jr(dr, "NODE_ENV_PRODUCTION", "production"), /** +* 测试环境 +*/ +jr(dr, "NODE_ENV_TEST", "test"), /** +* 是否处于调试模式 +*/ +jr(dr, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); +class Ro { + /** + * 环境初始化 + * + * @param envMeta - 需要传入 {"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false} 。特别提醒:此参数是静态元数据,取决于最终使用的项目。因此仅仅在最终使用的地方显示传递此值,中间项目请保持参数传递 + * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} + */ + constructor(r) { + jr(this, "envMeta"), this.envMeta = r; + } + /** + * 是否是开发阶段调试 + */ + isNodeDev() { + return this.getEnv(dr.NODE_ENV_KEY) === dr.NODE_ENV_DEVELOPMENT; + } + /** + * 是否是调试阶段 + */ + isDev() { + return this.isNodeDev() || this.getBooleanEnv(dr.VITE_DEBUG_MODE_KEY); + } + /** + * 获取环境变量,key不存在返回undefined + * @param key - key + */ + getEnv(r) { + let n; + try { + this.envMeta[r] && (n = this.envMeta[r]); + } catch { + } + return n; + } + /** + * 获取String类型的环境变量,key不存在直接返回空值 + * @param key - key + */ + getStringEnv(r) { + return this.getEnv(r) ?? ""; + } + /** + * 获取Boolean类型的环境变量,key不存在返回false + * @param key - key + */ + getBooleanEnv(r) { + let n = !1; + return this.getEnv(r) && (n = this.getStringEnv(r).toLowerCase() === "true"), n; + } + /** + * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 + * + * @param key - key + * @param defaultValue - 默认值 + * @since 0.1.0 + * @author terwer + */ + getEnvOrDefault(r, n) { + const a = this.getStringEnv(r); + return a.trim().length == 0 ? n : a; + } +} +var Ao = Object.defineProperty, Io = (e, r, n) => r in e ? Ao(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, Nr = (e, r, n) => (Io(e, typeof r != "symbol" ? r + "" : r, n), n); +class Pt { +} +Nr(Pt, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), Nr(Pt, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); +var Ve = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(Ve || {}), us = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function Oa(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var is = { exports: {} }; +(function(e) { + (function(r, n) { + e.exports ? e.exports = n() : r.log = n(); + })(us, function() { + var r = function() { + }, n = "undefined", a = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), u = [ + "trace", + "debug", + "info", + "warn", + "error" + ]; + function o(j, T) { + var $ = j[T]; + if (typeof $.bind == "function") + return $.bind(j); + try { + return Function.prototype.bind.call($, j); + } catch { + return function() { + return Function.prototype.apply.apply($, [j, arguments]); + }; + } + } + function p() { + console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); + } + function y(j) { + return j === "debug" && (j = "log"), typeof console === n ? !1 : j === "trace" && a ? p : console[j] !== void 0 ? o(console, j) : console.log !== void 0 ? o(console, "log") : r; + } + function b(j, T) { + for (var $ = 0; $ < u.length; $++) { + var O = u[$]; + this[O] = $ < j ? r : this.methodFactory(O, j, T); + } + this.log = this.debug; + } + function v(j, T, $) { + return function() { + typeof console !== n && (b.call(this, T, $), this[j].apply(this, arguments)); + }; + } + function g(j, T, $) { + return y(j) || v.apply(this, arguments); + } + function S(j, T, $) { + var O = this, D; + T = T ?? "WARN"; + var t = "loglevel"; + typeof j == "string" ? t += ":" + j : typeof j == "symbol" && (t = void 0); + function d(m) { + var h = (u[m] || "silent").toUpperCase(); + if (!(typeof window === n || !t)) { + try { + window.localStorage[t] = h; + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(t) + "=" + h + ";"; + } catch { + } + } + } + function s() { + var m; + if (!(typeof window === n || !t)) { + try { + m = window.localStorage[t]; + } catch { + } + if (typeof m === n) + try { + var h = window.document.cookie, C = h.indexOf( + encodeURIComponent(t) + "=" + ); + C !== -1 && (m = /^([^;]+)/.exec(h.slice(C))[1]); + } catch { + } + return O.levels[m] === void 0 && (m = void 0), m; + } + } + function i() { + if (!(typeof window === n || !t)) { + try { + window.localStorage.removeItem(t); + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(t) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + } catch { + } + } + } + O.name = j, O.levels = { + TRACE: 0, + DEBUG: 1, + INFO: 2, + WARN: 3, + ERROR: 4, + SILENT: 5 + }, O.methodFactory = $ || g, O.getLevel = function() { + return D; + }, O.setLevel = function(m, h) { + if (typeof m == "string" && O.levels[m.toUpperCase()] !== void 0 && (m = O.levels[m.toUpperCase()]), typeof m == "number" && m >= 0 && m <= O.levels.SILENT) { + if (D = m, h !== !1 && d(m), b.call(O, m, j), typeof console === n && m < O.levels.SILENT) + return "No console available for logging"; + } else + throw "log.setLevel() called with invalid level: " + m; + }, O.setDefaultLevel = function(m) { + T = m, s() || O.setLevel(m, !1); + }, O.resetLevel = function() { + O.setLevel(T, !1), i(); + }, O.enableAll = function(m) { + O.setLevel(O.levels.TRACE, m); + }, O.disableAll = function(m) { + O.setLevel(O.levels.SILENT, m); + }; + var c = s(); + c == null && (c = T), O.setLevel(c, !1); + } + var z = new S(), L = {}; + z.getLogger = function(j) { + if (typeof j != "symbol" && typeof j != "string" || j === "") + throw new TypeError("You must supply a name when creating a logger."); + var T = L[j]; + return T || (T = L[j] = new S( + j, + z.getLevel(), + z.methodFactory + )), T; + }; + var R = typeof window !== n ? window.log : void 0; + return z.noConflict = function() { + return typeof window !== n && window.log === z && (window.log = R), z; + }, z.getLoggers = function() { + return L; + }, z.default = z, z; + }); +})(is); +var Mo = is.exports; +const pt = /* @__PURE__ */ Oa(Mo); +var os = { exports: {} }; +(function(e) { + (function(r, n) { + e.exports ? e.exports = n() : r.prefix = n(r); + })(us, function(r) { + var n = function(g) { + for (var S = 1, z = arguments.length, L; S < z; S++) + for (L in arguments[S]) + Object.prototype.hasOwnProperty.call(arguments[S], L) && (g[L] = arguments[S][L]); + return g; + }, a = { + template: "[%t] %l:", + levelFormatter: function(g) { + return g.toUpperCase(); + }, + nameFormatter: function(g) { + return g || "root"; + }, + timestampFormatter: function(g) { + return g.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); + }, + format: void 0 + }, u, o = {}, p = function(g) { + if (!g || !g.getLogger) + throw new TypeError("Argument is not a root logger"); + u = g; + }, y = function(g, S) { + if (!g || !g.setLevel) + throw new TypeError("Argument is not a logger"); + var z = g.methodFactory, L = g.name || "", R = o[L] || o[""] || a; + function j(T, $, O) { + var D = z(T, $, O), t = o[O] || o[""], d = t.template.indexOf("%t") !== -1, s = t.template.indexOf("%l") !== -1, i = t.template.indexOf("%n") !== -1; + return function() { + for (var c = "", m = arguments.length, h = Array(m), C = 0; C < m; C++) + h[C] = arguments[C]; + if (L || !o[O]) { + var U = t.timestampFormatter(/* @__PURE__ */ new Date()), H = t.levelFormatter(T), V = t.nameFormatter(O); + t.format ? c += t.format(H, V, U) : (c += t.template, d && (c = c.replace(/%t/, U)), s && (c = c.replace(/%l/, H)), i && (c = c.replace(/%n/, V))), h.length && typeof h[0] == "string" ? h[0] = c + " " + h[0] : h.unshift(c); + } + D.apply(void 0, h); + }; + } + return o[L] || (g.methodFactory = j), S = S || {}, S.template && (S.format = void 0), o[L] = n({}, R, S), g.setLevel(g.getLevel()), u || g.warn( + "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md" + ), g; + }, b = { + reg: p, + apply: y + }, v; + return r && (v = r.prefix, b.noConflict = function() { + return r.prefix === b && (r.prefix = v), b; + }), b; + }); +})(os); +var Do = os.exports; +const gn = /* @__PURE__ */ Oa(Do); +function Lo() { + const e = Error.prepareStackTrace; + Error.prepareStackTrace = (n, a) => a; + const r = new Error().stack.slice(1); + return Error.prepareStackTrace = e, r; +} +class St { + /** + * 解析日志级别为枚举 + * + * @param enumObj - 枚举对象 + * @param value - 配置的值 + */ + static stringToEnumValue(r, n) { + return r[Object.keys(r).filter((a) => r[a].toString() === n)[0]]; + } + /** + * 获取配置的日志级别 + */ + static getEnvLevel(r) { + if (!r) + return; + let n; + try { + n = r.getEnvOrDefault(Pt.LOG_LEVEL_KEY, Ve.LOG_LEVEL_INFO); + } catch { + n = Ve.LOG_LEVEL_INFO; + } + const a = St.stringToEnumValue(Ve, n.toUpperCase()); + return a || console.warn( + "[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level" + ), a ?? Ve.LOG_LEVEL_INFO; + } + /** + * 获取默认日志 + */ + static getEnvLogger(r) { + return r ? r.getEnv(Pt.LOG_PREFIX_KEY) : void 0; + } +} +var Na = { exports: {} }, _n = { exports: {} }, vn; +function zo() { + return vn || (vn = 1, function(e) { + const r = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", n = typeof process < "u" && process.platform === "win32", a = typeof process < "u" && process.platform === "linux", u = { + ballotDisabled: "☒", + ballotOff: "☐", + ballotOn: "☑", + bullet: "•", + bulletWhite: "◦", + fullBlock: "█", + heart: "❤", + identicalTo: "≡", + line: "─", + mark: "※", + middot: "·", + minus: "-", + multiplication: "×", + obelus: "÷", + pencilDownRight: "✎", + pencilRight: "✏", + pencilUpRight: "✐", + percent: "%", + pilcrow2: "❡", + pilcrow: "¶", + plusMinus: "±", + question: "?", + section: "§", + starsOff: "☆", + starsOn: "★", + upDownArrow: "↕" + }, o = Object.assign({}, u, { + check: "√", + cross: "×", + ellipsisLarge: "...", + ellipsis: "...", + info: "i", + questionSmall: "?", + pointer: ">", + pointerSmall: "»", + radioOff: "( )", + radioOn: "(*)", + warning: "‼" + }), p = Object.assign({}, u, { + ballotCross: "✘", + check: "✔", + cross: "✖", + ellipsisLarge: "⋯", + ellipsis: "…", + info: "ℹ", + questionFull: "?", + questionSmall: "﹖", + pointer: a ? "▸" : "❯", + pointerSmall: a ? "‣" : "›", + radioOff: "◯", + radioOn: "◉", + warning: "⚠" + }); + e.exports = n && !r ? o : p, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: u }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: o }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: p }); + }(_n)), _n.exports; +} +const Vo = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Fo = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, Uo = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, cs = () => { + const e = { + enabled: Uo(), + visible: !0, + styles: {}, + keys: {} + }, r = (o) => { + let p = o.open = `\x1B[${o.codes[0]}m`, y = o.close = `\x1B[${o.codes[1]}m`, b = o.regex = new RegExp(`\\u001b\\[${o.codes[1]}m`, "g"); + return o.wrap = (v, g) => { + v.includes(y) && (v = v.replace(b, y + p)); + let S = p + v + y; + return g ? S.replace(/\r*\n/g, `${y}$&${p}`) : S; + }, o; + }, n = (o, p, y) => typeof o == "function" ? o(p) : o.wrap(p, y), a = (o, p) => { + if (o === "" || o == null) + return ""; + if (e.enabled === !1) + return o; + if (e.visible === !1) + return ""; + let y = "" + o, b = y.includes(` +`), v = p.length; + for (v > 0 && p.includes("unstyle") && (p = [.../* @__PURE__ */ new Set(["unstyle", ...p])].reverse()); v-- > 0; ) + y = n(e.styles[p[v]], y, b); + return y; + }, u = (o, p, y) => { + e.styles[o] = r({ name: o, codes: p }), (e.keys[y] || (e.keys[y] = [])).push(o), Reflect.defineProperty(e, o, { + configurable: !0, + enumerable: !0, + set(b) { + e.alias(o, b); + }, + get() { + let b = (v) => a(v, b.stack); + return Reflect.setPrototypeOf(b, e), b.stack = this.stack ? this.stack.concat(o) : [o], b; + } + }); + }; + return u("reset", [0, 0], "modifier"), u("bold", [1, 22], "modifier"), u("dim", [2, 22], "modifier"), u("italic", [3, 23], "modifier"), u("underline", [4, 24], "modifier"), u("inverse", [7, 27], "modifier"), u("hidden", [8, 28], "modifier"), u("strikethrough", [9, 29], "modifier"), u("black", [30, 39], "color"), u("red", [31, 39], "color"), u("green", [32, 39], "color"), u("yellow", [33, 39], "color"), u("blue", [34, 39], "color"), u("magenta", [35, 39], "color"), u("cyan", [36, 39], "color"), u("white", [37, 39], "color"), u("gray", [90, 39], "color"), u("grey", [90, 39], "color"), u("bgBlack", [40, 49], "bg"), u("bgRed", [41, 49], "bg"), u("bgGreen", [42, 49], "bg"), u("bgYellow", [43, 49], "bg"), u("bgBlue", [44, 49], "bg"), u("bgMagenta", [45, 49], "bg"), u("bgCyan", [46, 49], "bg"), u("bgWhite", [47, 49], "bg"), u("blackBright", [90, 39], "bright"), u("redBright", [91, 39], "bright"), u("greenBright", [92, 39], "bright"), u("yellowBright", [93, 39], "bright"), u("blueBright", [94, 39], "bright"), u("magentaBright", [95, 39], "bright"), u("cyanBright", [96, 39], "bright"), u("whiteBright", [97, 39], "bright"), u("bgBlackBright", [100, 49], "bgBright"), u("bgRedBright", [101, 49], "bgBright"), u("bgGreenBright", [102, 49], "bgBright"), u("bgYellowBright", [103, 49], "bgBright"), u("bgBlueBright", [104, 49], "bgBright"), u("bgMagentaBright", [105, 49], "bgBright"), u("bgCyanBright", [106, 49], "bgBright"), u("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = Fo, e.hasColor = e.hasAnsi = (o) => (e.ansiRegex.lastIndex = 0, typeof o == "string" && o !== "" && e.ansiRegex.test(o)), e.alias = (o, p) => { + let y = typeof p == "string" ? e[p] : p; + if (typeof y != "function") + throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); + y.stack || (Reflect.defineProperty(y, "name", { value: o }), e.styles[o] = y, y.stack = [o]), Reflect.defineProperty(e, o, { + configurable: !0, + enumerable: !0, + set(b) { + e.alias(o, b); + }, + get() { + let b = (v) => a(v, b.stack); + return Reflect.setPrototypeOf(b, e), b.stack = this.stack ? this.stack.concat(y.stack) : y.stack, b; + } + }); + }, e.theme = (o) => { + if (!Vo(o)) + throw new TypeError("Expected theme to be an object"); + for (let p of Object.keys(o)) + e.alias(p, o[p]); + return e; + }, e.alias("unstyle", (o) => typeof o == "string" && o !== "" ? (e.ansiRegex.lastIndex = 0, o.replace(e.ansiRegex, "")) : ""), e.alias("noop", (o) => o), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = zo(), e.define = u, e; +}; +Na.exports = cs(); +Na.exports.create = cs; +var Bo = Na.exports; +const De = /* @__PURE__ */ Oa(Bo); +let Gt, ls, fs, hs, ps = !0; +typeof process < "u" && ({ FORCE_COLOR: Gt, NODE_DISABLE_COLORS: ls, NO_COLOR: fs, TERM: hs } = process.env || {}, ps = process.stdout && process.stdout.isTTY); +const te = { + enabled: !ls && fs == null && hs !== "dumb" && (Gt != null && Gt !== "0" || ps), + // modifiers + reset: le(0, 0), + bold: le(1, 22), + dim: le(2, 22), + italic: le(3, 23), + underline: le(4, 24), + inverse: le(7, 27), + hidden: le(8, 28), + strikethrough: le(9, 29), + // colors + black: le(30, 39), + red: le(31, 39), + green: le(32, 39), + yellow: le(33, 39), + blue: le(34, 39), + magenta: le(35, 39), + cyan: le(36, 39), + white: le(37, 39), + gray: le(90, 39), + grey: le(90, 39), + // background colors + bgBlack: le(40, 49), + bgRed: le(41, 49), + bgGreen: le(42, 49), + bgYellow: le(43, 49), + bgBlue: le(44, 49), + bgMagenta: le(45, 49), + bgCyan: le(46, 49), + bgWhite: le(47, 49) +}; +function yn(e, r) { + let n = 0, a, u = "", o = ""; + for (; n < e.length; n++) + a = e[n], u += a.open, o += a.close, ~r.indexOf(a.close) && (r = r.replace(a.rgx, a.close + a.open)); + return u + r + o; +} +function Ho(e, r) { + let n = { has: e, keys: r }; + return n.reset = te.reset.bind(n), n.bold = te.bold.bind(n), n.dim = te.dim.bind(n), n.italic = te.italic.bind(n), n.underline = te.underline.bind(n), n.inverse = te.inverse.bind(n), n.hidden = te.hidden.bind(n), n.strikethrough = te.strikethrough.bind(n), n.black = te.black.bind(n), n.red = te.red.bind(n), n.green = te.green.bind(n), n.yellow = te.yellow.bind(n), n.blue = te.blue.bind(n), n.magenta = te.magenta.bind(n), n.cyan = te.cyan.bind(n), n.white = te.white.bind(n), n.gray = te.gray.bind(n), n.grey = te.grey.bind(n), n.bgBlack = te.bgBlack.bind(n), n.bgRed = te.bgRed.bind(n), n.bgGreen = te.bgGreen.bind(n), n.bgYellow = te.bgYellow.bind(n), n.bgBlue = te.bgBlue.bind(n), n.bgMagenta = te.bgMagenta.bind(n), n.bgCyan = te.bgCyan.bind(n), n.bgWhite = te.bgWhite.bind(n), n; +} +function le(e, r) { + let n = { + open: `\x1B[${e}m`, + close: `\x1B[${r}m`, + rgx: new RegExp(`\\x1b\\[${r}m`, "g") + }; + return function(a) { + return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(n)), a === void 0 ? this : te.enabled ? yn(this.keys, a + "") : a + "") : a === void 0 ? Ho([e], [n]) : te.enabled ? yn([n], a + "") : a + ""; + }; +} +var qo = Object.defineProperty, Go = (e, r, n) => r in e ? qo(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, $e = (e, r, n) => (Go(e, typeof r != "symbol" ? r + "" : r, n), n); +const Be = class { + /** + * 检测是否运行在Chrome插件中 + */ + static isInChromeExtension() { + return Be.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; + } +}; +let oe = Be; +$e(oe, "isNode", typeof process < "u"), /** +* 是否在浏览器环境 +*/ +$e(oe, "isInBrowser", typeof window < "u"), /** +* 浏览器路径分隔符 +*/ +$e(oe, "BrowserSeperator", "/"), /** +* 是否是Electron环境 +*/ +$e(oe, "isElectron", () => !Be.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** +* 是否有Node环境,目前包括 Electron 和 Node +*/ +$e(oe, "hasNodeEnv", () => Be.isElectron() || Be.isNode), /** +* 获取url参数 +* +* @param sParam - 参数 +*/ +$e(oe, "getQueryString", (e) => { + if (!Be.isInBrowser) + return ""; + const r = window.location.search.substring(1).split("&"); + for (let n = 0; n < r.length; n++) { + const a = r[n].split("="); + if (a[0] === e) + return a[1]; + } + return ""; +}), /** +* 替换 URL 的参数 +* 思路: +* 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 +* +* 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 +* +* 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 +* +* 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 +* +* 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 +* +* @param url - 链接地址 +* @param paramName - 参数名 +* @param paramValue - 参数值 +*/ +$e(oe, "replaceUrlParam", (e, r, n) => { + n == null && (n = ""); + const a = new RegExp("\\b(" + r + "=).*?(&|#|$)"); + if (e.search(a) >= 0) + return e.replace(a, "$1" + n + "$2"); + const [u, o] = e.split("#"), [p, y] = u.split("?"), b = new URLSearchParams(y); + b.set(r, n); + const v = b.toString(), g = p + (v ? "?" + v : ""); + return o ? g + "#" + o : g; +}), /** +* 设置url参数 +* +* @param urlstring - url +* @param key - key +* @param value - value +*/ +$e(oe, "setUrlParameter", (e, r, n) => { + if (e.includes(r)) + return Be.replaceUrlParam(e, r, n); + const a = e.split("#"); + let u = a[0]; + const o = a[1]; + return u.includes("?") ? u += `&${r}=${n}` : u += `?${r}=${n}`, o && (u += "#" + o), u; +}), /** +* 重新加载指定tab +* +* @param tabname - tabname +* @param t - 延迟时间 +*/ +$e(oe, "reloadTabPage", (e, r = 200) => { + setTimeout(function() { + if (Be.isInBrowser) { + const n = window.location.href; + window.location.href = Be.setUrlParameter(n, "tab", e); + } + }, r); +}), /** +* 刷新当前tab页面 +*/ +$e(oe, "reloadPage", () => { + setTimeout(function() { + Be.isInBrowser && window.location.reload(); + }, 200); +}), /** +* 刷新当前tab页面 +* +* @param msg - 消息提示 +* @param cb - 回调 +*/ +$e(oe, "reloadPageWithMessageCallback", (e, r) => { + r && r(e), setTimeout(function() { + Be.isInBrowser && window.location.reload(); + }, 200); +}); +var Ce = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(Ce || {}); +const Oe = class { + /** + * 检测是否运行在思源打开的浏览器中 + */ + static isInSiyuanBrowser() { + return oe.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; + } + /** + * 思源笔记 window 对象 + */ + static siyuanWindow() { + let e; + return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; + } + // ========================= + // require end + // ========================= + // ========================= + // import start + // ========================= + /** + * 引入json + * + * @param jsPath - js相对路径全路径 + * @param type - 类型 + */ + static async importJs(e, r) { + let n = e; + switch (r) { + case Ce.BasePathType_Appearance: + n = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); + break; + case Ce.BasePathType_Data: + n = this.browserJoinPath(this.siyuanDataRelativePath(), e); + break; + case Ce.BasePathType_Themes: + n = this.browserJoinPath(this.siyuanThemeRelativePath(), e); + break; + case Ce.BasePathType_ZhiTheme: + n = this.browserJoinPath(this.zhiThemeRelativePath(), e); + break; + default: + throw new Error("type must be provided"); + } + const { default: a } = await import( + /* @vite-ignore */ + n + ); + return a; + } + /** + * 引入json + * + * @param jsonPath - json相对路径全路径 + * @param type - 类型 + */ + // public static async importJson(jsonPath: string, type: BasePathTypeEnum) { + // let fullJsonPath = jsonPath + // switch (type) { + // case BasePathTypeEnum.BasePathType_Appearance: + // fullJsonPath = this.browserJoinPath(this.siyuanAppearanceRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Data: + // fullJsonPath = this.browserJoinPath(this.siyuanDataRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Themes: + // fullJsonPath = this.browserJoinPath(this.siyuanThemeRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_ZhiTheme: + // fullJsonPath = this.browserJoinPath(this.zhiThemeRelativePath(), jsonPath) + // break + // default: + // throw new Error("type must be provided") + // } + // + // const { default: data } = await import(/* @vite-ignore */ fullJsonPath, { assert: { type: "json" } }) + // return data + // } + /** + * 引入 json - 以 data 为基本路径 + * + * @param jsonPath - 相对于 data 的相对路径 + */ + // public static async importDataJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Data) + // } + /** + * 引入 json - 以 appearance 为基本路径 + * + * @param jsonPath - 相对于 appearance 的相对路径 + */ + // public static async importAppearanceJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Appearance) + // } + /** + * 引入 json - 以 themes 为基本路径 + * + * @param jsonPath - 相对于 themes 的相对路径 + */ + // public static async importThemesJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Themes) + // } + /** + * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 + * + * @param jsonPath - 相对于 zhi 主题根路径的相对路径 + */ + // public static async importZhiThemeJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_ZhiTheme) + // } + /** + * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 + * + * @param jsPath - 相对于 zhi 主题根路径的相对路径 + */ + static async importZhiThemeJs(e) { + return await this.importJs(e, Ce.BasePathType_ZhiTheme); + } + // ========================= + // import start + // ========================= + /** + * 路径拼接 + * + * @param paths - 路径数组 + */ + static joinPath(...e) { + if (oe.hasNodeEnv()) { + const r = this.requireLib("path"); + if (r) + return r.join(...e); + } + return this.browserJoinPath(...e); + } + static browserJoinPath(...e) { + return e.join(oe.BrowserSeperator); + } + /** + * 思源笔记 conf 目录 + */ + static siyuanConfPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.confDir; + } + /** + * 思源笔记 data 目录 + */ + static siyuanDataPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.dataDir; + } + /** + * 思源笔记 data 目录-相对路径 + */ + static siyuanDataRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return ""; + } + /** + * 思源笔记 appearance 目录 + */ + static siyuanAppearancePath() { + return this.joinPath(this.siyuanConfPath(), "appearance"); + } + /** + * 思源笔记 appearance 目录-相对路径 + */ + static siyuanAppearanceRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance"); + } + /** + * 思源笔记 themes 目录-绝对路径 + * + * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 + * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath + * + * @author terwer + * @since 0.1.0 + */ + static siyuanThemePath() { + if (oe.hasNodeEnv()) + return this.joinPath(this.siyuanAppearancePath(), "themes"); + { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return this.joinPath(e.location.origin, "appearance", "themes"); + } + } + /** + * 思源笔记 themes 目录-相对路径 + */ + static siyuanThemeRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance", "themes"); + } + /** + * zhi 主题目录 - 绝对路径 + */ + static zhiThemePath() { + return this.joinPath(this.siyuanThemePath(), "zhi"); + } + /** + * zhi 主题目录 - 相对路径 + */ + static zhiThemeRelativePath() { + return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); + } +}; +let pr = Oe; +$e(pr, "isInSiyuanWidget", () => oe.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** +* 思源笔记新窗口 +* +* @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 +* @author terwer +* @version 0.1.0 +* @since 0.0.1 +*/ +$e(pr, "isInSiyuanNewWin", () => !oe.isInBrowser || !oe.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +// require start +// ========================= +/** + * 引入依赖 + * + * @param libpath - 依赖全路径 + * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 + * @param type - 可选,以谁的基本路径为准 + */ +$e(pr, "requireLib", (e, r = !0, n = Ce.BasePathType_None) => { + if (!oe.hasNodeEnv()) + throw new Error("require ony works on node env"); + let a = e; + if (!r) + switch (n) { + case Ce.BasePathType_Appearance: + a = Oe.joinPath(Oe.siyuanAppearancePath(), e); + break; + case Ce.BasePathType_Data: + a = Oe.joinPath(Oe.siyuanDataPath(), e); + break; + case Ce.BasePathType_Themes: + a = Oe.joinPath(Oe.siyuanAppearancePath(), "themes", e); + break; + case Ce.BasePathType_ZhiTheme: + a = Oe.joinPath(Oe.siyuanAppearancePath(), "themes", "zhi", e); + break; + default: + throw new Error("type must be provided when not use absolute path"); + } + const u = Oe.siyuanWindow(); + if (!u) + return require(a); + if (typeof u.require < "u") + return u.require(a); +}), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 appearance 的相对路径 +*/ +$e(pr, "requireAppearanceLib", (e) => Oe.requireLib(e, !1, Ce.BasePathType_Appearance)), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 data 的相对路径 +*/ +$e(pr, "requireDataLib", (e) => Oe.requireLib(e, !1, Ce.BasePathType_Data)), /** +* 引入依赖,以 theme 的基本路径为准 +* +* @param libpath - 相对于 theme 的相对路径 +*/ +$e(pr, "requireThemesLib", (e) => Oe.requireLib(e, !1, Ce.BasePathType_Themes)), /** +* 引入依赖,以 ZhiTheme 的基本路径为准 +* +* @param libpath - 相对于 ZhiTheme 的相对路径 +*/ +$e(pr, "requireZhiThemeLib", (e) => Oe.requireLib(e, !1, Ce.BasePathType_ZhiTheme)); +const Le = { + white: (e) => oe.isElectron() ? De.whiteBright(e) : te.white(e), + gray: (e) => oe.isElectron() ? De.gray(e) : te.gray(e), + blue: (e) => oe.isElectron() ? De.blue(e) : te.blue(e), + green: (e) => oe.isElectron() ? De.green(e) : te.green(e), + yellow: (e) => oe.isElectron() ? De.yellow(e) : te.yellow(e), + red: (e) => oe.isElectron() ? De.red(e) : te.red(e), + bgWhite: (e) => oe.isElectron() ? De.bgWhiteBright(e) : te.bgWhite(e), + bgGrey: (e) => oe.isElectron() ? De.bgCyanBright(e) : te.bgCyan(e), + bgBlue: (e) => oe.isElectron() ? De.bgBlueBright(e) : te.bgBlue(e), + bgGreen: (e) => oe.isElectron() ? De.bgGreenBright(e) : te.bgGreen(e), + bgYellow: (e) => oe.isElectron() ? De.bgYellowBright(e) : te.bgYellow(e), + bgRed: (e) => oe.isElectron() ? De.bgRedBright(e) : te.bgRed(e) +}; +class Ko { + constructor(r, n, a) { + Nr(this, "consoleLogger", "console"), Nr(this, "stackSize", 1), Nr(this, "getLogger", (p) => { + let y; + if (p) + y = p; + else { + const b = this.getCallStack(), v = [], g = []; + for (let S = 0; S < b.length; S++) { + const z = b[S], L = z.getFileName() ?? "none"; + if (S > this.stackSize - 1) + break; + const R = L + "-" + z.getLineNumber() + ":" + z.getColumnNumber(); + v.push(R); + } + g.length > 0 && (y = v.join(" -> ")); + } + return (!y || y.trim().length === 0) && (y = this.consoleLogger), pt.getLogger(y); + }), this.stackSize = 1; + let u; + r ? u = r : u = St.getEnvLevel(a), u = u ?? Ve.LOG_LEVEL_INFO, pt.setLevel(u); + const o = (p, y, b, v) => { + const g = [], S = n ?? St.getEnvLogger(a) ?? "zhi"; + return g.push(Le.gray("[") + v(S) + Le.gray("]")), g.push(Le.gray("[") + Le.gray(b.toString()) + Le.gray("]")), g.push(v(p.toUpperCase().toString())), g.push(v(y)), g.push(Le.gray(":")), g; + }; + gn.reg(pt), gn.apply(pt, { + format(p, y, b) { + let v = []; + const g = y ?? ""; + switch (p) { + case Ve.LOG_LEVEL_TRACE: + v = o(p, g, b, Le.gray); + break; + case Ve.LOG_LEVEL_DEBUG: + v = o(p, g, b, Le.blue); + break; + case Ve.LOG_LEVEL_INFO: + v = o(p, g, b, Le.green); + break; + case Ve.LOG_LEVEL_WARN: + v = o(p, g, b, Le.yellow); + break; + case Ve.LOG_LEVEL_ERROR: + v = o(p, g, b, Le.red); + break; + default: + v = o(Ve.LOG_LEVEL_INFO, g, b, Le.green); + break; + } + return v.join(" "); + } + }); + } + /** + * 设置输出栈的深度,默认1 + * + * @param stackSize - 栈的深度 + */ + setStackSize(r) { + this.stackSize = r ?? 1; + } + /** + * 获取调用堆栈,若未获取到直接返回空数组 + * + * @author terwer + * @since 1.6.0 + */ + getCallStack() { + let r; + try { + r = Lo(); + } catch { + r = []; + } + return r; + } +} +class Wo { + /** + * 默认日志级别 + * + * @param level - 可选,未设置默认INFO + * @param sign - 可选前缀,默认zhi + * @param env - 可选环境变量实例 + */ + constructor(r, n, a) { + Nr(this, "logger"), this.logger = new Ko(r, n, a); + } + /** + * 获取日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + * @protected + */ + getLogger(r, n) { + return this.logger.setStackSize(n), this.logger.getLogger(r); + } +} +class wn extends Wo { + constructor(r, n, a) { + super(r, n, a); + } + /** + * 获取默认的日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + */ + getLogger(r, n) { + return super.getLogger(r, n); + } +} +class Ra { + /** + * 默认日志记录器 + * + * @param stackSize - 栈的深度 + * @param env - 环境变量实例 + */ + static defaultLogger(r, n) { + return Ra.customLogFactory(void 0, void 0, r).getLogger(void 0, n); + } + /** + * 自定义日志工厂 + * + * @param level - 级别 + * @param sign - 标志 + * @param env - 环境变量 + */ + static customLogFactory(r, n, a) { + return new wn(r, n, a); + } + /** + * 自定义日志工厂,自定义前缀 + * + * @param sign - 标志 + * @param env - 环境变量 + */ + static customSignLogFactory(r, n) { + return new wn(void 0, r, n); + } +} +const Jo = "zhi"; +class yt { + /** + * 某些情况下,可能需要手动 init 之后才能用 + */ + static initEnv(r) { + this.env = r; + } + /** + * 获取 zhi-env 实例 - 必须在使用的时候重写此方法 + * + * ``` + * if (!this.env) { + * this.env = new Env({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false}) + * } + * return this.env + * ``` + * + * @see {@link https://github.com/terwer/zhi/tree/main/apps/zhi-env#usage docs for zhi-env usage} + */ + static zhiEnv() { + throw new Error("Method 'zhiEnv' must be implemented"); + } + /** + * 获取 zhi-log 实例 + * + * @param sign - 标志 + * @param loggerName - 日志名称 + */ + static zhiLogWithSign(r, n) { + if (this.loggerMap[n]) + return this.loggerMap[n].debug("Zhi-log use cache"), this.loggerMap[n]; + const a = this.env, u = Ra.customSignLogFactory(r, a).getLogger(n); + return this.loggerMap[n] = u, u.debug("Zhi-log add new logger"), u; + } + /** + * 获取 zhi-log 实例 + * + * @param loggerName - 日志名称 + */ + static zhiLog(r) { + return this.zhiLogWithSign(Jo, r); + } + /** + * 获取 zhi-common 实例 + */ + static zhiCommon() { + return this.common || (this.common = new xo()), this.common; + } +} +/** + * zhi-util 的运行时环境 + */ +be(yt, "env"), /** + * zhi-util 的日志器缓存 + */ +be(yt, "loggerMap", {}), /** + * zhi-util 的通用工具类 + */ +be(yt, "common"); +class Aa extends yt { + static zhiEnv() { + return this.env || (this.env = new Ro({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; + } +} +class bn { + constructor() { + be(this, "logger"); + this.logger = Aa.zhiLog("lute-adaptor"), Lute ? this.logger.debug("Detected Lute is bundled, will use!") : this.logger.debug("Lute is not available!"); + } + isAvailable() { + return typeof Lute < "u"; + } + /** + * 高亮关键字 + * + * @param str - 字符串 + * @private + */ + highlightWords(r) { + const n = new RegExp("(?<=^|[\\s\\S])==([^\\n]+?)==(?=($|[\\s\\S]))", "g"); + return r.replace(n, '$1'); + } + /** + * 渲染Markdown + * + * @param md - Markdown + */ + async renderMarkdownStr(r) { + if (!this.isAvailable()) + return this.logger.error("Lute is not available, will return original md"), r; + const n = Lute, a = n.New(), u = { + renderText: (o, p) => p ? [this.highlightWords(o.Text()), n.WalkContinue] : ["", n.WalkContinue] + // renderStrong: (node: any, entering: any) => { + // return ["", luteObj.WalkContinue] + // }, + // renderParagraph: (node: any, entering: any) => { + // return ["", luteObj.WalkContinue] + // } + }; + return a.SetJSRenderers({ + renderers: { + Md2HTML: u + } + }), this.logger.info("Lute is rendering md to HTML..."), a.MarkdownStr("", r); + } +} +var ms = { exports: {} }; +(function(e) { + (function() { + function r(t) { + var d = { + omitExtraWLInCodeBlocks: { + defaultValue: !1, + describe: "Omit the default extra whiteline added to code blocks", + type: "boolean" + }, + noHeaderId: { + defaultValue: !1, + describe: "Turn on/off generated header id", + type: "boolean" + }, + prefixHeaderId: { + defaultValue: !1, + describe: "Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix", + type: "string" + }, + rawPrefixHeaderId: { + defaultValue: !1, + describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)', + type: "boolean" + }, + ghCompatibleHeaderId: { + defaultValue: !1, + describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)", + type: "boolean" + }, + rawHeaderId: { + defaultValue: !1, + describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`, + type: "boolean" + }, + headerLevelStart: { + defaultValue: !1, + describe: "The header blocks level start", + type: "integer" + }, + parseImgDimensions: { + defaultValue: !1, + describe: "Turn on/off image dimension parsing", + type: "boolean" + }, + simplifiedAutoLink: { + defaultValue: !1, + describe: "Turn on/off GFM autolink style", + type: "boolean" + }, + excludeTrailingPunctuationFromURLs: { + defaultValue: !1, + describe: "Excludes trailing punctuation from links generated with autoLinking", + type: "boolean" + }, + literalMidWordUnderscores: { + defaultValue: !1, + describe: "Parse midword underscores as literal underscores", + type: "boolean" + }, + literalMidWordAsterisks: { + defaultValue: !1, + describe: "Parse midword asterisks as literal asterisks", + type: "boolean" + }, + strikethrough: { + defaultValue: !1, + describe: "Turn on/off strikethrough support", + type: "boolean" + }, + tables: { + defaultValue: !1, + describe: "Turn on/off tables support", + type: "boolean" + }, + tablesHeaderId: { + defaultValue: !1, + describe: "Add an id to table headers", + type: "boolean" + }, + ghCodeBlocks: { + defaultValue: !0, + describe: "Turn on/off GFM fenced code blocks support", + type: "boolean" + }, + tasklists: { + defaultValue: !1, + describe: "Turn on/off GFM tasklist support", + type: "boolean" + }, + smoothLivePreview: { + defaultValue: !1, + describe: "Prevents weird effects in live previews due to incomplete input", + type: "boolean" + }, + smartIndentationFix: { + defaultValue: !1, + describe: "Tries to smartly fix indentation in es6 strings", + type: "boolean" + }, + disableForced4SpacesIndentedSublists: { + defaultValue: !1, + describe: "Disables the requirement of indenting nested sublists by 4 spaces", + type: "boolean" + }, + simpleLineBreaks: { + defaultValue: !1, + describe: "Parses simple line breaks as
(GFM Style)", + type: "boolean" + }, + requireSpaceBeforeHeadingText: { + defaultValue: !1, + describe: "Makes adding a space between `#` and the header text mandatory (GFM Style)", + type: "boolean" + }, + ghMentions: { + defaultValue: !1, + describe: "Enables github @mentions", + type: "boolean" + }, + ghMentionsLink: { + defaultValue: "https://github.com/{u}", + describe: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.", + type: "string" + }, + encodeEmails: { + defaultValue: !0, + describe: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities", + type: "boolean" + }, + openLinksInNewWindow: { + defaultValue: !1, + describe: "Open all links in new windows", + type: "boolean" + }, + backslashEscapesHTMLTags: { + defaultValue: !1, + describe: "Support for HTML Tag escaping. ex:
foo
", + type: "boolean" + }, + emoji: { + defaultValue: !1, + describe: "Enable emoji support. Ex: `this is a :smile: emoji`", + type: "boolean" + }, + underline: { + defaultValue: !1, + describe: "Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``", + type: "boolean" + }, + ellipsis: { + defaultValue: !0, + describe: "Replaces three dots with the ellipsis unicode character", + type: "boolean" + }, + completeHTMLDocument: { + defaultValue: !1, + describe: "Outputs a complete html document, including ``, `` and `` tags", + type: "boolean" + }, + metadata: { + defaultValue: !1, + describe: "Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).", + type: "boolean" + }, + splitAdjacentBlockquotes: { + defaultValue: !1, + describe: "Split adjacent blockquote blocks", + type: "boolean" + } + }; + if (t === !1) + return JSON.parse(JSON.stringify(d)); + var s = {}; + for (var i in d) + d.hasOwnProperty(i) && (s[i] = d[i].defaultValue); + return s; + } + function n() { + var t = r(!0), d = {}; + for (var s in t) + t.hasOwnProperty(s) && (d[s] = !0); + return d; + } + var a = {}, u = {}, o = {}, p = r(!0), y = "vanilla", b = { + github: { + omitExtraWLInCodeBlocks: !0, + simplifiedAutoLink: !0, + excludeTrailingPunctuationFromURLs: !0, + literalMidWordUnderscores: !0, + strikethrough: !0, + tables: !0, + tablesHeaderId: !0, + ghCodeBlocks: !0, + tasklists: !0, + disableForced4SpacesIndentedSublists: !0, + simpleLineBreaks: !0, + requireSpaceBeforeHeadingText: !0, + ghCompatibleHeaderId: !0, + ghMentions: !0, + backslashEscapesHTMLTags: !0, + emoji: !0, + splitAdjacentBlockquotes: !0 + }, + original: { + noHeaderId: !0, + ghCodeBlocks: !1 + }, + ghost: { + omitExtraWLInCodeBlocks: !0, + parseImgDimensions: !0, + simplifiedAutoLink: !0, + excludeTrailingPunctuationFromURLs: !0, + literalMidWordUnderscores: !0, + strikethrough: !0, + tables: !0, + tablesHeaderId: !0, + ghCodeBlocks: !0, + tasklists: !0, + smoothLivePreview: !0, + simpleLineBreaks: !0, + requireSpaceBeforeHeadingText: !0, + ghMentions: !1, + encodeEmails: !0 + }, + vanilla: r(!0), + allOn: n() + }; + a.helper = {}, a.extensions = {}, a.setOption = function(t, d) { + return p[t] = d, this; + }, a.getOption = function(t) { + return p[t]; + }, a.getOptions = function() { + return p; + }, a.resetOptions = function() { + p = r(!0); + }, a.setFlavor = function(t) { + if (!b.hasOwnProperty(t)) + throw Error(t + " flavor was not found"); + a.resetOptions(); + var d = b[t]; + y = t; + for (var s in d) + d.hasOwnProperty(s) && (p[s] = d[s]); + }, a.getFlavor = function() { + return y; + }, a.getFlavorOptions = function(t) { + if (b.hasOwnProperty(t)) + return b[t]; + }, a.getDefaultOptions = function(t) { + return r(t); + }, a.subParser = function(t, d) { + if (a.helper.isString(t)) + if (typeof d < "u") + u[t] = d; + else { + if (u.hasOwnProperty(t)) + return u[t]; + throw Error("SubParser named " + t + " not registered!"); + } + }, a.extension = function(t, d) { + if (!a.helper.isString(t)) + throw Error("Extension 'name' must be a string"); + if (t = a.helper.stdExtName(t), a.helper.isUndefined(d)) { + if (!o.hasOwnProperty(t)) + throw Error("Extension named " + t + " is not registered!"); + return o[t]; + } else { + typeof d == "function" && (d = d()), a.helper.isArray(d) || (d = [d]); + var s = v(d, t); + if (s.valid) + o[t] = d; + else + throw Error(s.error); + } + }, a.getAllExtensions = function() { + return o; + }, a.removeExtension = function(t) { + delete o[t]; + }, a.resetExtensions = function() { + o = {}; + }; + function v(t, d) { + var s = d ? "Error in " + d + " extension->" : "Error in unnamed extension", i = { + valid: !0, + error: "" + }; + a.helper.isArray(t) || (t = [t]); + for (var c = 0; c < t.length; ++c) { + var m = s + " sub-extension " + c + ": ", h = t[c]; + if (typeof h != "object") + return i.valid = !1, i.error = m + "must be an object, but " + typeof h + " given", i; + if (!a.helper.isString(h.type)) + return i.valid = !1, i.error = m + 'property "type" must be a string, but ' + typeof h.type + " given", i; + var C = h.type = h.type.toLowerCase(); + if (C === "language" && (C = h.type = "lang"), C === "html" && (C = h.type = "output"), C !== "lang" && C !== "output" && C !== "listener") + return i.valid = !1, i.error = m + "type " + C + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', i; + if (C === "listener") { + if (a.helper.isUndefined(h.listeners)) + return i.valid = !1, i.error = m + '. Extensions of type "listener" must have a property called "listeners"', i; + } else if (a.helper.isUndefined(h.filter) && a.helper.isUndefined(h.regex)) + return i.valid = !1, i.error = m + C + ' extensions must define either a "regex" property or a "filter" method', i; + if (h.listeners) { + if (typeof h.listeners != "object") + return i.valid = !1, i.error = m + '"listeners" property must be an object but ' + typeof h.listeners + " given", i; + for (var U in h.listeners) + if (h.listeners.hasOwnProperty(U) && typeof h.listeners[U] != "function") + return i.valid = !1, i.error = m + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + U + " must be a function but " + typeof h.listeners[U] + " given", i; + } + if (h.filter) { + if (typeof h.filter != "function") + return i.valid = !1, i.error = m + '"filter" must be a function, but ' + typeof h.filter + " given", i; + } else if (h.regex) { + if (a.helper.isString(h.regex) && (h.regex = new RegExp(h.regex, "g")), !(h.regex instanceof RegExp)) + return i.valid = !1, i.error = m + '"regex" property must either be a string or a RegExp object, but ' + typeof h.regex + " given", i; + if (a.helper.isUndefined(h.replace)) + return i.valid = !1, i.error = m + '"regex" extensions must implement a replace string or function', i; + } + } + return i; + } + a.validateExtension = function(t) { + var d = v(t, null); + return d.valid ? !0 : (console.warn(d.error), !1); + }, a.hasOwnProperty("helper") || (a.helper = {}), a.helper.isString = function(t) { + return typeof t == "string" || t instanceof String; + }, a.helper.isFunction = function(t) { + var d = {}; + return t && d.toString.call(t) === "[object Function]"; + }, a.helper.isArray = function(t) { + return Array.isArray(t); + }, a.helper.isUndefined = function(t) { + return typeof t > "u"; + }, a.helper.forEach = function(t, d) { + if (a.helper.isUndefined(t)) + throw new Error("obj param is required"); + if (a.helper.isUndefined(d)) + throw new Error("callback param is required"); + if (!a.helper.isFunction(d)) + throw new Error("callback param must be a function/closure"); + if (typeof t.forEach == "function") + t.forEach(d); + else if (a.helper.isArray(t)) + for (var s = 0; s < t.length; s++) + d(t[s], s, t); + else if (typeof t == "object") + for (var i in t) + t.hasOwnProperty(i) && d(t[i], i, t); + else + throw new Error("obj does not seem to be an array or an iterable object"); + }, a.helper.stdExtName = function(t) { + return t.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); + }; + function g(t, d) { + var s = d.charCodeAt(0); + return "¨E" + s + "E"; + } + a.helper.escapeCharactersCallback = g, a.helper.escapeCharacters = function(t, d, s) { + var i = "([" + d.replace(/([\[\]\\])/g, "\\$1") + "])"; + s && (i = "\\\\" + i); + var c = new RegExp(i, "g"); + return t = t.replace(c, g), t; + }, a.helper.unescapeHTMLEntities = function(t) { + return t.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); + }; + var S = function(t, d, s, i) { + var c = i || "", m = c.indexOf("g") > -1, h = new RegExp(d + "|" + s, "g" + c.replace(/g/g, "")), C = new RegExp(d, c.replace(/g/g, "")), U = [], H, V, G, _, q; + do + for (H = 0; G = h.exec(t); ) + if (C.test(G[0])) + H++ || (V = h.lastIndex, _ = V - G[0].length); + else if (H && !--H) { + q = G.index + G[0].length; + var J = { + left: { start: _, end: V }, + match: { start: V, end: G.index }, + right: { start: G.index, end: q }, + wholeMatch: { start: _, end: q } + }; + if (U.push(J), !m) + return U; + } + while (H && (h.lastIndex = V)); + return U; + }; + a.helper.matchRecursiveRegExp = function(t, d, s, i) { + for (var c = S(t, d, s, i), m = [], h = 0; h < c.length; ++h) + m.push([ + t.slice(c[h].wholeMatch.start, c[h].wholeMatch.end), + t.slice(c[h].match.start, c[h].match.end), + t.slice(c[h].left.start, c[h].left.end), + t.slice(c[h].right.start, c[h].right.end) + ]); + return m; + }, a.helper.replaceRecursiveRegExp = function(t, d, s, i, c) { + if (!a.helper.isFunction(d)) { + var m = d; + d = function() { + return m; + }; + } + var h = S(t, s, i, c), C = t, U = h.length; + if (U > 0) { + var H = []; + h[0].wholeMatch.start !== 0 && H.push(t.slice(0, h[0].wholeMatch.start)); + for (var V = 0; V < U; ++V) + H.push( + d( + t.slice(h[V].wholeMatch.start, h[V].wholeMatch.end), + t.slice(h[V].match.start, h[V].match.end), + t.slice(h[V].left.start, h[V].left.end), + t.slice(h[V].right.start, h[V].right.end) + ) + ), V < U - 1 && H.push(t.slice(h[V].wholeMatch.end, h[V + 1].wholeMatch.start)); + h[U - 1].wholeMatch.end < t.length && H.push(t.slice(h[U - 1].wholeMatch.end)), C = H.join(""); + } + return C; + }, a.helper.regexIndexOf = function(t, d, s) { + if (!a.helper.isString(t)) + throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; + if (!(d instanceof RegExp)) + throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp"; + var i = t.substring(s || 0).search(d); + return i >= 0 ? i + (s || 0) : i; + }, a.helper.splitAtIndex = function(t, d) { + if (!a.helper.isString(t)) + throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; + return [t.substring(0, d), t.substring(d)]; + }, a.helper.encodeEmailAddress = function(t) { + var d = [ + function(s) { + return "&#" + s.charCodeAt(0) + ";"; + }, + function(s) { + return "&#x" + s.charCodeAt(0).toString(16) + ";"; + }, + function(s) { + return s; + } + ]; + return t = t.replace(/./g, function(s) { + if (s === "@") + s = d[Math.floor(Math.random() * 2)](s); + else { + var i = Math.random(); + s = i > 0.9 ? d[2](s) : i > 0.45 ? d[1](s) : d[0](s); + } + return s; + }), t; + }, a.helper.padEnd = function(d, s, i) { + return s = s >> 0, i = String(i || " "), d.length > s ? String(d) : (s = s - d.length, s > i.length && (i += i.repeat(s / i.length)), String(d) + i.slice(0, s)); + }, typeof console > "u" && (console = { + warn: function(t) { + alert(t); + }, + log: function(t) { + alert(t); + }, + error: function(t) { + throw t; + } + }), a.helper.regexes = { + asteriskDashAndColon: /([*_:~])/g + }, a.helper.emojis = { + "+1": "👍", + "-1": "👎", + 100: "💯", + 1234: "🔢", + "1st_place_medal": "🥇", + "2nd_place_medal": "🥈", + "3rd_place_medal": "🥉", + "8ball": "🎱", + a: "🅰️", + ab: "🆎", + abc: "🔤", + abcd: "🔡", + accept: "🉑", + aerial_tramway: "🚡", + airplane: "✈️", + alarm_clock: "⏰", + alembic: "⚗️", + alien: "👽", + ambulance: "🚑", + amphora: "🏺", + anchor: "⚓️", + angel: "👼", + anger: "💢", + angry: "😠", + anguished: "😧", + ant: "🐜", + apple: "🍎", + aquarius: "♒️", + aries: "♈️", + arrow_backward: "◀️", + arrow_double_down: "⏬", + arrow_double_up: "⏫", + arrow_down: "⬇️", + arrow_down_small: "🔽", + arrow_forward: "▶️", + arrow_heading_down: "⤵️", + arrow_heading_up: "⤴️", + arrow_left: "⬅️", + arrow_lower_left: "↙️", + arrow_lower_right: "↘️", + arrow_right: "➡️", + arrow_right_hook: "↪️", + arrow_up: "⬆️", + arrow_up_down: "↕️", + arrow_up_small: "🔼", + arrow_upper_left: "↖️", + arrow_upper_right: "↗️", + arrows_clockwise: "🔃", + arrows_counterclockwise: "🔄", + art: "🎨", + articulated_lorry: "🚛", + artificial_satellite: "🛰", + astonished: "😲", + athletic_shoe: "👟", + atm: "🏧", + atom_symbol: "⚛️", + avocado: "🥑", + b: "🅱️", + baby: "👶", + baby_bottle: "🍼", + baby_chick: "🐤", + baby_symbol: "🚼", + back: "🔙", + bacon: "🥓", + badminton: "🏸", + baggage_claim: "🛄", + baguette_bread: "🥖", + balance_scale: "⚖️", + balloon: "🎈", + ballot_box: "🗳", + ballot_box_with_check: "☑️", + bamboo: "🎍", + banana: "🍌", + bangbang: "‼️", + bank: "🏦", + bar_chart: "📊", + barber: "💈", + baseball: "⚾️", + basketball: "🏀", + basketball_man: "⛹️", + basketball_woman: "⛹️‍♀️", + bat: "🦇", + bath: "🛀", + bathtub: "🛁", + battery: "🔋", + beach_umbrella: "🏖", + bear: "🐻", + bed: "🛏", + bee: "🐝", + beer: "🍺", + beers: "🍻", + beetle: "🐞", + beginner: "🔰", + bell: "🔔", + bellhop_bell: "🛎", + bento: "🍱", + biking_man: "🚴", + bike: "🚲", + biking_woman: "🚴‍♀️", + bikini: "👙", + biohazard: "☣️", + bird: "🐦", + birthday: "🎂", + black_circle: "⚫️", + black_flag: "🏴", + black_heart: "🖤", + black_joker: "🃏", + black_large_square: "⬛️", + black_medium_small_square: "◾️", + black_medium_square: "◼️", + black_nib: "✒️", + black_small_square: "▪️", + black_square_button: "🔲", + blonde_man: "👱", + blonde_woman: "👱‍♀️", + blossom: "🌼", + blowfish: "🐡", + blue_book: "📘", + blue_car: "🚙", + blue_heart: "💙", + blush: "😊", + boar: "🐗", + boat: "⛵️", + bomb: "💣", + book: "📖", + bookmark: "🔖", + bookmark_tabs: "📑", + books: "📚", + boom: "💥", + boot: "👢", + bouquet: "💐", + bowing_man: "🙇", + bow_and_arrow: "🏹", + bowing_woman: "🙇‍♀️", + bowling: "🎳", + boxing_glove: "🥊", + boy: "👦", + bread: "🍞", + bride_with_veil: "👰", + bridge_at_night: "🌉", + briefcase: "💼", + broken_heart: "💔", + bug: "🐛", + building_construction: "🏗", + bulb: "💡", + bullettrain_front: "🚅", + bullettrain_side: "🚄", + burrito: "🌯", + bus: "🚌", + business_suit_levitating: "🕴", + busstop: "🚏", + bust_in_silhouette: "👤", + busts_in_silhouette: "👥", + butterfly: "🦋", + cactus: "🌵", + cake: "🍰", + calendar: "📆", + call_me_hand: "🤙", + calling: "📲", + camel: "🐫", + camera: "📷", + camera_flash: "📸", + camping: "🏕", + cancer: "♋️", + candle: "🕯", + candy: "🍬", + canoe: "🛶", + capital_abcd: "🔠", + capricorn: "♑️", + car: "🚗", + card_file_box: "🗃", + card_index: "📇", + card_index_dividers: "🗂", + carousel_horse: "🎠", + carrot: "🥕", + cat: "🐱", + cat2: "🐈", + cd: "💿", + chains: "⛓", + champagne: "🍾", + chart: "💹", + chart_with_downwards_trend: "📉", + chart_with_upwards_trend: "📈", + checkered_flag: "🏁", + cheese: "🧀", + cherries: "🍒", + cherry_blossom: "🌸", + chestnut: "🌰", + chicken: "🐔", + children_crossing: "🚸", + chipmunk: "🐿", + chocolate_bar: "🍫", + christmas_tree: "🎄", + church: "⛪️", + cinema: "🎦", + circus_tent: "🎪", + city_sunrise: "🌇", + city_sunset: "🌆", + cityscape: "🏙", + cl: "🆑", + clamp: "🗜", + clap: "👏", + clapper: "🎬", + classical_building: "🏛", + clinking_glasses: "🥂", + clipboard: "📋", + clock1: "🕐", + clock10: "🕙", + clock1030: "🕥", + clock11: "🕚", + clock1130: "🕦", + clock12: "🕛", + clock1230: "🕧", + clock130: "🕜", + clock2: "🕑", + clock230: "🕝", + clock3: "🕒", + clock330: "🕞", + clock4: "🕓", + clock430: "🕟", + clock5: "🕔", + clock530: "🕠", + clock6: "🕕", + clock630: "🕡", + clock7: "🕖", + clock730: "🕢", + clock8: "🕗", + clock830: "🕣", + clock9: "🕘", + clock930: "🕤", + closed_book: "📕", + closed_lock_with_key: "🔐", + closed_umbrella: "🌂", + cloud: "☁️", + cloud_with_lightning: "🌩", + cloud_with_lightning_and_rain: "⛈", + cloud_with_rain: "🌧", + cloud_with_snow: "🌨", + clown_face: "🤡", + clubs: "♣️", + cocktail: "🍸", + coffee: "☕️", + coffin: "⚰️", + cold_sweat: "😰", + comet: "☄️", + computer: "💻", + computer_mouse: "🖱", + confetti_ball: "🎊", + confounded: "😖", + confused: "😕", + congratulations: "㊗️", + construction: "🚧", + construction_worker_man: "👷", + construction_worker_woman: "👷‍♀️", + control_knobs: "🎛", + convenience_store: "🏪", + cookie: "🍪", + cool: "🆒", + policeman: "👮", + copyright: "©️", + corn: "🌽", + couch_and_lamp: "🛋", + couple: "👫", + couple_with_heart_woman_man: "💑", + couple_with_heart_man_man: "👨‍❤️‍👨", + couple_with_heart_woman_woman: "👩‍❤️‍👩", + couplekiss_man_man: "👨‍❤️‍💋‍👨", + couplekiss_man_woman: "💏", + couplekiss_woman_woman: "👩‍❤️‍💋‍👩", + cow: "🐮", + cow2: "🐄", + cowboy_hat_face: "🤠", + crab: "🦀", + crayon: "🖍", + credit_card: "💳", + crescent_moon: "🌙", + cricket: "🏏", + crocodile: "🐊", + croissant: "🥐", + crossed_fingers: "🤞", + crossed_flags: "🎌", + crossed_swords: "⚔️", + crown: "👑", + cry: "😢", + crying_cat_face: "😿", + crystal_ball: "🔮", + cucumber: "🥒", + cupid: "💘", + curly_loop: "➰", + currency_exchange: "💱", + curry: "🍛", + custard: "🍮", + customs: "🛃", + cyclone: "🌀", + dagger: "🗡", + dancer: "💃", + dancing_women: "👯", + dancing_men: "👯‍♂️", + dango: "🍡", + dark_sunglasses: "🕶", + dart: "🎯", + dash: "💨", + date: "📅", + deciduous_tree: "🌳", + deer: "🦌", + department_store: "🏬", + derelict_house: "🏚", + desert: "🏜", + desert_island: "🏝", + desktop_computer: "🖥", + male_detective: "🕵️", + diamond_shape_with_a_dot_inside: "💠", + diamonds: "♦️", + disappointed: "😞", + disappointed_relieved: "😥", + dizzy: "💫", + dizzy_face: "😵", + do_not_litter: "🚯", + dog: "🐶", + dog2: "🐕", + dollar: "💵", + dolls: "🎎", + dolphin: "🐬", + door: "🚪", + doughnut: "🍩", + dove: "🕊", + dragon: "🐉", + dragon_face: "🐲", + dress: "👗", + dromedary_camel: "🐪", + drooling_face: "🤤", + droplet: "💧", + drum: "🥁", + duck: "🦆", + dvd: "📀", + "e-mail": "📧", + eagle: "🦅", + ear: "👂", + ear_of_rice: "🌾", + earth_africa: "🌍", + earth_americas: "🌎", + earth_asia: "🌏", + egg: "🥚", + eggplant: "🍆", + eight_pointed_black_star: "✴️", + eight_spoked_asterisk: "✳️", + electric_plug: "🔌", + elephant: "🐘", + email: "✉️", + end: "🔚", + envelope_with_arrow: "📩", + euro: "💶", + european_castle: "🏰", + european_post_office: "🏤", + evergreen_tree: "🌲", + exclamation: "❗️", + expressionless: "😑", + eye: "👁", + eye_speech_bubble: "👁‍🗨", + eyeglasses: "👓", + eyes: "👀", + face_with_head_bandage: "🤕", + face_with_thermometer: "🤒", + fist_oncoming: "👊", + factory: "🏭", + fallen_leaf: "🍂", + family_man_woman_boy: "👪", + family_man_boy: "👨‍👦", + family_man_boy_boy: "👨‍👦‍👦", + family_man_girl: "👨‍👧", + family_man_girl_boy: "👨‍👧‍👦", + family_man_girl_girl: "👨‍👧‍👧", + family_man_man_boy: "👨‍👨‍👦", + family_man_man_boy_boy: "👨‍👨‍👦‍👦", + family_man_man_girl: "👨‍👨‍👧", + family_man_man_girl_boy: "👨‍👨‍👧‍👦", + family_man_man_girl_girl: "👨‍👨‍👧‍👧", + family_man_woman_boy_boy: "👨‍👩‍👦‍👦", + family_man_woman_girl: "👨‍👩‍👧", + family_man_woman_girl_boy: "👨‍👩‍👧‍👦", + family_man_woman_girl_girl: "👨‍👩‍👧‍👧", + family_woman_boy: "👩‍👦", + family_woman_boy_boy: "👩‍👦‍👦", + family_woman_girl: "👩‍👧", + family_woman_girl_boy: "👩‍👧‍👦", + family_woman_girl_girl: "👩‍👧‍👧", + family_woman_woman_boy: "👩‍👩‍👦", + family_woman_woman_boy_boy: "👩‍👩‍👦‍👦", + family_woman_woman_girl: "👩‍👩‍👧", + family_woman_woman_girl_boy: "👩‍👩‍👧‍👦", + family_woman_woman_girl_girl: "👩‍👩‍👧‍👧", + fast_forward: "⏩", + fax: "📠", + fearful: "😨", + feet: "🐾", + female_detective: "🕵️‍♀️", + ferris_wheel: "🎡", + ferry: "⛴", + field_hockey: "🏑", + file_cabinet: "🗄", + file_folder: "📁", + film_projector: "📽", + film_strip: "🎞", + fire: "🔥", + fire_engine: "🚒", + fireworks: "🎆", + first_quarter_moon: "🌓", + first_quarter_moon_with_face: "🌛", + fish: "🐟", + fish_cake: "🍥", + fishing_pole_and_fish: "🎣", + fist_raised: "✊", + fist_left: "🤛", + fist_right: "🤜", + flags: "🎏", + flashlight: "🔦", + fleur_de_lis: "⚜️", + flight_arrival: "🛬", + flight_departure: "🛫", + floppy_disk: "💾", + flower_playing_cards: "🎴", + flushed: "😳", + fog: "🌫", + foggy: "🌁", + football: "🏈", + footprints: "👣", + fork_and_knife: "🍴", + fountain: "⛲️", + fountain_pen: "🖋", + four_leaf_clover: "🍀", + fox_face: "🦊", + framed_picture: "🖼", + free: "🆓", + fried_egg: "🍳", + fried_shrimp: "🍤", + fries: "🍟", + frog: "🐸", + frowning: "😦", + frowning_face: "☹️", + frowning_man: "🙍‍♂️", + frowning_woman: "🙍", + middle_finger: "🖕", + fuelpump: "⛽️", + full_moon: "🌕", + full_moon_with_face: "🌝", + funeral_urn: "⚱️", + game_die: "🎲", + gear: "⚙️", + gem: "💎", + gemini: "♊️", + ghost: "👻", + gift: "🎁", + gift_heart: "💝", + girl: "👧", + globe_with_meridians: "🌐", + goal_net: "🥅", + goat: "🐐", + golf: "⛳️", + golfing_man: "🏌️", + golfing_woman: "🏌️‍♀️", + gorilla: "🦍", + grapes: "🍇", + green_apple: "🍏", + green_book: "📗", + green_heart: "💚", + green_salad: "🥗", + grey_exclamation: "❕", + grey_question: "❔", + grimacing: "😬", + grin: "😁", + grinning: "😀", + guardsman: "💂", + guardswoman: "💂‍♀️", + guitar: "🎸", + gun: "🔫", + haircut_woman: "💇", + haircut_man: "💇‍♂️", + hamburger: "🍔", + hammer: "🔨", + hammer_and_pick: "⚒", + hammer_and_wrench: "🛠", + hamster: "🐹", + hand: "✋", + handbag: "👜", + handshake: "🤝", + hankey: "💩", + hatched_chick: "🐥", + hatching_chick: "🐣", + headphones: "🎧", + hear_no_evil: "🙉", + heart: "❤️", + heart_decoration: "💟", + heart_eyes: "😍", + heart_eyes_cat: "😻", + heartbeat: "💓", + heartpulse: "💗", + hearts: "♥️", + heavy_check_mark: "✔️", + heavy_division_sign: "➗", + heavy_dollar_sign: "💲", + heavy_heart_exclamation: "❣️", + heavy_minus_sign: "➖", + heavy_multiplication_x: "✖️", + heavy_plus_sign: "➕", + helicopter: "🚁", + herb: "🌿", + hibiscus: "🌺", + high_brightness: "🔆", + high_heel: "👠", + hocho: "🔪", + hole: "🕳", + honey_pot: "🍯", + horse: "🐴", + horse_racing: "🏇", + hospital: "🏥", + hot_pepper: "🌶", + hotdog: "🌭", + hotel: "🏨", + hotsprings: "♨️", + hourglass: "⌛️", + hourglass_flowing_sand: "⏳", + house: "🏠", + house_with_garden: "🏡", + houses: "🏘", + hugs: "🤗", + hushed: "😯", + ice_cream: "🍨", + ice_hockey: "🏒", + ice_skate: "⛸", + icecream: "🍦", + id: "🆔", + ideograph_advantage: "🉐", + imp: "👿", + inbox_tray: "📥", + incoming_envelope: "📨", + tipping_hand_woman: "💁", + information_source: "ℹ️", + innocent: "😇", + interrobang: "⁉️", + iphone: "📱", + izakaya_lantern: "🏮", + jack_o_lantern: "🎃", + japan: "🗾", + japanese_castle: "🏯", + japanese_goblin: "👺", + japanese_ogre: "👹", + jeans: "👖", + joy: "😂", + joy_cat: "😹", + joystick: "🕹", + kaaba: "🕋", + key: "🔑", + keyboard: "⌨️", + keycap_ten: "🔟", + kick_scooter: "🛴", + kimono: "👘", + kiss: "💋", + kissing: "😗", + kissing_cat: "😽", + kissing_closed_eyes: "😚", + kissing_heart: "😘", + kissing_smiling_eyes: "😙", + kiwi_fruit: "🥝", + koala: "🐨", + koko: "🈁", + label: "🏷", + large_blue_circle: "🔵", + large_blue_diamond: "🔷", + large_orange_diamond: "🔶", + last_quarter_moon: "🌗", + last_quarter_moon_with_face: "🌜", + latin_cross: "✝️", + laughing: "😆", + leaves: "🍃", + ledger: "📒", + left_luggage: "🛅", + left_right_arrow: "↔️", + leftwards_arrow_with_hook: "↩️", + lemon: "🍋", + leo: "♌️", + leopard: "🐆", + level_slider: "🎚", + libra: "♎️", + light_rail: "🚈", + link: "🔗", + lion: "🦁", + lips: "👄", + lipstick: "💄", + lizard: "🦎", + lock: "🔒", + lock_with_ink_pen: "🔏", + lollipop: "🍭", + loop: "➿", + loud_sound: "🔊", + loudspeaker: "📢", + love_hotel: "🏩", + love_letter: "💌", + low_brightness: "🔅", + lying_face: "🤥", + m: "Ⓜ️", + mag: "🔍", + mag_right: "🔎", + mahjong: "🀄️", + mailbox: "📫", + mailbox_closed: "📪", + mailbox_with_mail: "📬", + mailbox_with_no_mail: "📭", + man: "👨", + man_artist: "👨‍🎨", + man_astronaut: "👨‍🚀", + man_cartwheeling: "🤸‍♂️", + man_cook: "👨‍🍳", + man_dancing: "🕺", + man_facepalming: "🤦‍♂️", + man_factory_worker: "👨‍🏭", + man_farmer: "👨‍🌾", + man_firefighter: "👨‍🚒", + man_health_worker: "👨‍⚕️", + man_in_tuxedo: "🤵", + man_judge: "👨‍⚖️", + man_juggling: "🤹‍♂️", + man_mechanic: "👨‍🔧", + man_office_worker: "👨‍💼", + man_pilot: "👨‍✈️", + man_playing_handball: "🤾‍♂️", + man_playing_water_polo: "🤽‍♂️", + man_scientist: "👨‍🔬", + man_shrugging: "🤷‍♂️", + man_singer: "👨‍🎤", + man_student: "👨‍🎓", + man_teacher: "👨‍🏫", + man_technologist: "👨‍💻", + man_with_gua_pi_mao: "👲", + man_with_turban: "👳", + tangerine: "🍊", + mans_shoe: "👞", + mantelpiece_clock: "🕰", + maple_leaf: "🍁", + martial_arts_uniform: "🥋", + mask: "😷", + massage_woman: "💆", + massage_man: "💆‍♂️", + meat_on_bone: "🍖", + medal_military: "🎖", + medal_sports: "🏅", + mega: "📣", + melon: "🍈", + memo: "📝", + men_wrestling: "🤼‍♂️", + menorah: "🕎", + mens: "🚹", + metal: "🤘", + metro: "🚇", + microphone: "🎤", + microscope: "🔬", + milk_glass: "🥛", + milky_way: "🌌", + minibus: "🚐", + minidisc: "💽", + mobile_phone_off: "📴", + money_mouth_face: "🤑", + money_with_wings: "💸", + moneybag: "💰", + monkey: "🐒", + monkey_face: "🐵", + monorail: "🚝", + moon: "🌔", + mortar_board: "🎓", + mosque: "🕌", + motor_boat: "🛥", + motor_scooter: "🛵", + motorcycle: "🏍", + motorway: "🛣", + mount_fuji: "🗻", + mountain: "⛰", + mountain_biking_man: "🚵", + mountain_biking_woman: "🚵‍♀️", + mountain_cableway: "🚠", + mountain_railway: "🚞", + mountain_snow: "🏔", + mouse: "🐭", + mouse2: "🐁", + movie_camera: "🎥", + moyai: "🗿", + mrs_claus: "🤶", + muscle: "💪", + mushroom: "🍄", + musical_keyboard: "🎹", + musical_note: "🎵", + musical_score: "🎼", + mute: "🔇", + nail_care: "💅", + name_badge: "📛", + national_park: "🏞", + nauseated_face: "🤢", + necktie: "👔", + negative_squared_cross_mark: "❎", + nerd_face: "🤓", + neutral_face: "😐", + new: "🆕", + new_moon: "🌑", + new_moon_with_face: "🌚", + newspaper: "📰", + newspaper_roll: "🗞", + next_track_button: "⏭", + ng: "🆖", + no_good_man: "🙅‍♂️", + no_good_woman: "🙅", + night_with_stars: "🌃", + no_bell: "🔕", + no_bicycles: "🚳", + no_entry: "⛔️", + no_entry_sign: "🚫", + no_mobile_phones: "📵", + no_mouth: "😶", + no_pedestrians: "🚷", + no_smoking: "🚭", + "non-potable_water": "🚱", + nose: "👃", + notebook: "📓", + notebook_with_decorative_cover: "📔", + notes: "🎶", + nut_and_bolt: "🔩", + o: "⭕️", + o2: "🅾️", + ocean: "🌊", + octopus: "🐙", + oden: "🍢", + office: "🏢", + oil_drum: "🛢", + ok: "🆗", + ok_hand: "👌", + ok_man: "🙆‍♂️", + ok_woman: "🙆", + old_key: "🗝", + older_man: "👴", + older_woman: "👵", + om: "🕉", + on: "🔛", + oncoming_automobile: "🚘", + oncoming_bus: "🚍", + oncoming_police_car: "🚔", + oncoming_taxi: "🚖", + open_file_folder: "📂", + open_hands: "👐", + open_mouth: "😮", + open_umbrella: "☂️", + ophiuchus: "⛎", + orange_book: "📙", + orthodox_cross: "☦️", + outbox_tray: "📤", + owl: "🦉", + ox: "🐂", + package: "📦", + page_facing_up: "📄", + page_with_curl: "📃", + pager: "📟", + paintbrush: "🖌", + palm_tree: "🌴", + pancakes: "🥞", + panda_face: "🐼", + paperclip: "📎", + paperclips: "🖇", + parasol_on_ground: "⛱", + parking: "🅿️", + part_alternation_mark: "〽️", + partly_sunny: "⛅️", + passenger_ship: "🛳", + passport_control: "🛂", + pause_button: "⏸", + peace_symbol: "☮️", + peach: "🍑", + peanuts: "🥜", + pear: "🍐", + pen: "🖊", + pencil2: "✏️", + penguin: "🐧", + pensive: "😔", + performing_arts: "🎭", + persevere: "😣", + person_fencing: "🤺", + pouting_woman: "🙎", + phone: "☎️", + pick: "⛏", + pig: "🐷", + pig2: "🐖", + pig_nose: "🐽", + pill: "💊", + pineapple: "🍍", + ping_pong: "🏓", + pisces: "♓️", + pizza: "🍕", + place_of_worship: "🛐", + plate_with_cutlery: "🍽", + play_or_pause_button: "⏯", + point_down: "👇", + point_left: "👈", + point_right: "👉", + point_up: "☝️", + point_up_2: "👆", + police_car: "🚓", + policewoman: "👮‍♀️", + poodle: "🐩", + popcorn: "🍿", + post_office: "🏣", + postal_horn: "📯", + postbox: "📮", + potable_water: "🚰", + potato: "🥔", + pouch: "👝", + poultry_leg: "🍗", + pound: "💷", + rage: "😡", + pouting_cat: "😾", + pouting_man: "🙎‍♂️", + pray: "🙏", + prayer_beads: "📿", + pregnant_woman: "🤰", + previous_track_button: "⏮", + prince: "🤴", + princess: "👸", + printer: "🖨", + purple_heart: "💜", + purse: "👛", + pushpin: "📌", + put_litter_in_its_place: "🚮", + question: "❓", + rabbit: "🐰", + rabbit2: "🐇", + racehorse: "🐎", + racing_car: "🏎", + radio: "📻", + radio_button: "🔘", + radioactive: "☢️", + railway_car: "🚃", + railway_track: "🛤", + rainbow: "🌈", + rainbow_flag: "🏳️‍🌈", + raised_back_of_hand: "🤚", + raised_hand_with_fingers_splayed: "🖐", + raised_hands: "🙌", + raising_hand_woman: "🙋", + raising_hand_man: "🙋‍♂️", + ram: "🐏", + ramen: "🍜", + rat: "🐀", + record_button: "⏺", + recycle: "♻️", + red_circle: "🔴", + registered: "®️", + relaxed: "☺️", + relieved: "😌", + reminder_ribbon: "🎗", + repeat: "🔁", + repeat_one: "🔂", + rescue_worker_helmet: "⛑", + restroom: "🚻", + revolving_hearts: "💞", + rewind: "⏪", + rhinoceros: "🦏", + ribbon: "🎀", + rice: "🍚", + rice_ball: "🍙", + rice_cracker: "🍘", + rice_scene: "🎑", + right_anger_bubble: "🗯", + ring: "💍", + robot: "🤖", + rocket: "🚀", + rofl: "🤣", + roll_eyes: "🙄", + roller_coaster: "🎢", + rooster: "🐓", + rose: "🌹", + rosette: "🏵", + rotating_light: "🚨", + round_pushpin: "📍", + rowing_man: "🚣", + rowing_woman: "🚣‍♀️", + rugby_football: "🏉", + running_man: "🏃", + running_shirt_with_sash: "🎽", + running_woman: "🏃‍♀️", + sa: "🈂️", + sagittarius: "♐️", + sake: "🍶", + sandal: "👡", + santa: "🎅", + satellite: "📡", + saxophone: "🎷", + school: "🏫", + school_satchel: "🎒", + scissors: "✂️", + scorpion: "🦂", + scorpius: "♏️", + scream: "😱", + scream_cat: "🙀", + scroll: "📜", + seat: "💺", + secret: "㊙️", + see_no_evil: "🙈", + seedling: "🌱", + selfie: "🤳", + shallow_pan_of_food: "🥘", + shamrock: "☘️", + shark: "🦈", + shaved_ice: "🍧", + sheep: "🐑", + shell: "🐚", + shield: "🛡", + shinto_shrine: "⛩", + ship: "🚢", + shirt: "👕", + shopping: "🛍", + shopping_cart: "🛒", + shower: "🚿", + shrimp: "🦐", + signal_strength: "📶", + six_pointed_star: "🔯", + ski: "🎿", + skier: "⛷", + skull: "💀", + skull_and_crossbones: "☠️", + sleeping: "😴", + sleeping_bed: "🛌", + sleepy: "😪", + slightly_frowning_face: "🙁", + slightly_smiling_face: "🙂", + slot_machine: "🎰", + small_airplane: "🛩", + small_blue_diamond: "🔹", + small_orange_diamond: "🔸", + small_red_triangle: "🔺", + small_red_triangle_down: "🔻", + smile: "😄", + smile_cat: "😸", + smiley: "😃", + smiley_cat: "😺", + smiling_imp: "😈", + smirk: "😏", + smirk_cat: "😼", + smoking: "🚬", + snail: "🐌", + snake: "🐍", + sneezing_face: "🤧", + snowboarder: "🏂", + snowflake: "❄️", + snowman: "⛄️", + snowman_with_snow: "☃️", + sob: "😭", + soccer: "⚽️", + soon: "🔜", + sos: "🆘", + sound: "🔉", + space_invader: "👾", + spades: "♠️", + spaghetti: "🍝", + sparkle: "❇️", + sparkler: "🎇", + sparkles: "✨", + sparkling_heart: "💖", + speak_no_evil: "🙊", + speaker: "🔈", + speaking_head: "🗣", + speech_balloon: "💬", + speedboat: "🚤", + spider: "🕷", + spider_web: "🕸", + spiral_calendar: "🗓", + spiral_notepad: "🗒", + spoon: "🥄", + squid: "🦑", + stadium: "🏟", + star: "⭐️", + star2: "🌟", + star_and_crescent: "☪️", + star_of_david: "✡️", + stars: "🌠", + station: "🚉", + statue_of_liberty: "🗽", + steam_locomotive: "🚂", + stew: "🍲", + stop_button: "⏹", + stop_sign: "🛑", + stopwatch: "⏱", + straight_ruler: "📏", + strawberry: "🍓", + stuck_out_tongue: "😛", + stuck_out_tongue_closed_eyes: "😝", + stuck_out_tongue_winking_eye: "😜", + studio_microphone: "🎙", + stuffed_flatbread: "🥙", + sun_behind_large_cloud: "🌥", + sun_behind_rain_cloud: "🌦", + sun_behind_small_cloud: "🌤", + sun_with_face: "🌞", + sunflower: "🌻", + sunglasses: "😎", + sunny: "☀️", + sunrise: "🌅", + sunrise_over_mountains: "🌄", + surfing_man: "🏄", + surfing_woman: "🏄‍♀️", + sushi: "🍣", + suspension_railway: "🚟", + sweat: "😓", + sweat_drops: "💦", + sweat_smile: "😅", + sweet_potato: "🍠", + swimming_man: "🏊", + swimming_woman: "🏊‍♀️", + symbols: "🔣", + synagogue: "🕍", + syringe: "💉", + taco: "🌮", + tada: "🎉", + tanabata_tree: "🎋", + taurus: "♉️", + taxi: "🚕", + tea: "🍵", + telephone_receiver: "📞", + telescope: "🔭", + tennis: "🎾", + tent: "⛺️", + thermometer: "🌡", + thinking: "🤔", + thought_balloon: "💭", + ticket: "🎫", + tickets: "🎟", + tiger: "🐯", + tiger2: "🐅", + timer_clock: "⏲", + tipping_hand_man: "💁‍♂️", + tired_face: "😫", + tm: "™️", + toilet: "🚽", + tokyo_tower: "🗼", + tomato: "🍅", + tongue: "👅", + top: "🔝", + tophat: "🎩", + tornado: "🌪", + trackball: "🖲", + tractor: "🚜", + traffic_light: "🚥", + train: "🚋", + train2: "🚆", + tram: "🚊", + triangular_flag_on_post: "🚩", + triangular_ruler: "📐", + trident: "🔱", + triumph: "😤", + trolleybus: "🚎", + trophy: "🏆", + tropical_drink: "🍹", + tropical_fish: "🐠", + truck: "🚚", + trumpet: "🎺", + tulip: "🌷", + tumbler_glass: "🥃", + turkey: "🦃", + turtle: "🐢", + tv: "📺", + twisted_rightwards_arrows: "🔀", + two_hearts: "💕", + two_men_holding_hands: "👬", + two_women_holding_hands: "👭", + u5272: "🈹", + u5408: "🈴", + u55b6: "🈺", + u6307: "🈯️", + u6708: "🈷️", + u6709: "🈶", + u6e80: "🈵", + u7121: "🈚️", + u7533: "🈸", + u7981: "🈲", + u7a7a: "🈳", + umbrella: "☔️", + unamused: "😒", + underage: "🔞", + unicorn: "🦄", + unlock: "🔓", + up: "🆙", + upside_down_face: "🙃", + v: "✌️", + vertical_traffic_light: "🚦", + vhs: "📼", + vibration_mode: "📳", + video_camera: "📹", + video_game: "🎮", + violin: "🎻", + virgo: "♍️", + volcano: "🌋", + volleyball: "🏐", + vs: "🆚", + vulcan_salute: "🖖", + walking_man: "🚶", + walking_woman: "🚶‍♀️", + waning_crescent_moon: "🌘", + waning_gibbous_moon: "🌖", + warning: "⚠️", + wastebasket: "🗑", + watch: "⌚️", + water_buffalo: "🐃", + watermelon: "🍉", + wave: "👋", + wavy_dash: "〰️", + waxing_crescent_moon: "🌒", + wc: "🚾", + weary: "😩", + wedding: "💒", + weight_lifting_man: "🏋️", + weight_lifting_woman: "🏋️‍♀️", + whale: "🐳", + whale2: "🐋", + wheel_of_dharma: "☸️", + wheelchair: "♿️", + white_check_mark: "✅", + white_circle: "⚪️", + white_flag: "🏳️", + white_flower: "💮", + white_large_square: "⬜️", + white_medium_small_square: "◽️", + white_medium_square: "◻️", + white_small_square: "▫️", + white_square_button: "🔳", + wilted_flower: "🥀", + wind_chime: "🎐", + wind_face: "🌬", + wine_glass: "🍷", + wink: "😉", + wolf: "🐺", + woman: "👩", + woman_artist: "👩‍🎨", + woman_astronaut: "👩‍🚀", + woman_cartwheeling: "🤸‍♀️", + woman_cook: "👩‍🍳", + woman_facepalming: "🤦‍♀️", + woman_factory_worker: "👩‍🏭", + woman_farmer: "👩‍🌾", + woman_firefighter: "👩‍🚒", + woman_health_worker: "👩‍⚕️", + woman_judge: "👩‍⚖️", + woman_juggling: "🤹‍♀️", + woman_mechanic: "👩‍🔧", + woman_office_worker: "👩‍💼", + woman_pilot: "👩‍✈️", + woman_playing_handball: "🤾‍♀️", + woman_playing_water_polo: "🤽‍♀️", + woman_scientist: "👩‍🔬", + woman_shrugging: "🤷‍♀️", + woman_singer: "👩‍🎤", + woman_student: "👩‍🎓", + woman_teacher: "👩‍🏫", + woman_technologist: "👩‍💻", + woman_with_turban: "👳‍♀️", + womans_clothes: "👚", + womans_hat: "👒", + women_wrestling: "🤼‍♀️", + womens: "🚺", + world_map: "🗺", + worried: "😟", + wrench: "🔧", + writing_hand: "✍️", + x: "❌", + yellow_heart: "💛", + yen: "💴", + yin_yang: "☯️", + yum: "😋", + zap: "⚡️", + zipper_mouth_face: "🤐", + zzz: "💤", + /* special emojis :P */ + octocat: ':octocat:', + showdown: `S` + }, a.Converter = function(t) { + var d = {}, s = [], i = [], c = {}, m = y, h = { + parsed: {}, + raw: "", + format: "" + }; + C(); + function C() { + t = t || {}; + for (var _ in p) + p.hasOwnProperty(_) && (d[_] = p[_]); + if (typeof t == "object") + for (var q in t) + t.hasOwnProperty(q) && (d[q] = t[q]); + else + throw Error("Converter expects the passed parameter to be an object, but " + typeof t + " was passed instead."); + d.extensions && a.helper.forEach(d.extensions, U); + } + function U(_, q) { + if (q = q || null, a.helper.isString(_)) + if (_ = a.helper.stdExtName(_), q = _, a.extensions[_]) { + console.warn("DEPRECATION WARNING: " + _ + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), H(a.extensions[_], _); + return; + } else if (!a.helper.isUndefined(o[_])) + _ = o[_]; + else + throw Error('Extension "' + _ + '" could not be loaded. It was either not found or is not a valid extension.'); + typeof _ == "function" && (_ = _()), a.helper.isArray(_) || (_ = [_]); + var J = v(_, q); + if (!J.valid) + throw Error(J.error); + for (var Z = 0; Z < _.length; ++Z) { + switch (_[Z].type) { + case "lang": + s.push(_[Z]); + break; + case "output": + i.push(_[Z]); + break; + } + if (_[Z].hasOwnProperty("listeners")) + for (var B in _[Z].listeners) + _[Z].listeners.hasOwnProperty(B) && V(B, _[Z].listeners[B]); + } + } + function H(_, q) { + typeof _ == "function" && (_ = _(new a.Converter())), a.helper.isArray(_) || (_ = [_]); + var J = v(_, q); + if (!J.valid) + throw Error(J.error); + for (var Z = 0; Z < _.length; ++Z) + switch (_[Z].type) { + case "lang": + s.push(_[Z]); + break; + case "output": + i.push(_[Z]); + break; + default: + throw Error("Extension loader error: Type unrecognized!!!"); + } + } + function V(_, q) { + if (!a.helper.isString(_)) + throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof _ + " given"); + if (typeof q != "function") + throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof q + " given"); + c.hasOwnProperty(_) || (c[_] = []), c[_].push(q); + } + function G(_) { + var q = _.match(/^\s*/)[0].length, J = new RegExp("^\\s{0," + q + "}", "gm"); + return _.replace(J, ""); + } + this._dispatch = function(q, J, Z, B) { + if (c.hasOwnProperty(q)) + for (var k = 0; k < c[q].length; ++k) { + var F = c[q][k](q, J, this, Z, B); + F && typeof F < "u" && (J = F); + } + return J; + }, this.listen = function(_, q) { + return V(_, q), this; + }, this.makeHtml = function(_) { + if (!_) + return _; + var q = { + gHtmlBlocks: [], + gHtmlMdBlocks: [], + gHtmlSpans: [], + gUrls: {}, + gTitles: {}, + gDimensions: {}, + gListLevel: 0, + hashLinkCounts: {}, + langExtensions: s, + outputModifiers: i, + converter: this, + ghCodeBlocks: [], + metadata: { + parsed: {}, + raw: "", + format: "" + } + }; + return _ = _.replace(/¨/g, "¨T"), _ = _.replace(/\$/g, "¨D"), _ = _.replace(/\r\n/g, ` +`), _ = _.replace(/\r/g, ` +`), _ = _.replace(/\u00A0/g, " "), d.smartIndentationFix && (_ = G(_)), _ = ` + +` + _ + ` + +`, _ = a.subParser("detab")(_, d, q), _ = _.replace(/^[ \t]+$/mg, ""), a.helper.forEach(s, function(J) { + _ = a.subParser("runExtension")(J, _, d, q); + }), _ = a.subParser("metadata")(_, d, q), _ = a.subParser("hashPreCodeTags")(_, d, q), _ = a.subParser("githubCodeBlocks")(_, d, q), _ = a.subParser("hashHTMLBlocks")(_, d, q), _ = a.subParser("hashCodeTags")(_, d, q), _ = a.subParser("stripLinkDefinitions")(_, d, q), _ = a.subParser("blockGamut")(_, d, q), _ = a.subParser("unhashHTMLSpans")(_, d, q), _ = a.subParser("unescapeSpecialChars")(_, d, q), _ = _.replace(/¨D/g, "$$"), _ = _.replace(/¨T/g, "¨"), _ = a.subParser("completeHTMLDocument")(_, d, q), a.helper.forEach(i, function(J) { + _ = a.subParser("runExtension")(J, _, d, q); + }), h = q.metadata, _; + }, this.makeMarkdown = this.makeMd = function(_, q) { + if (_ = _.replace(/\r\n/g, ` +`), _ = _.replace(/\r/g, ` +`), _ = _.replace(/>[ \t]+¨NBSP;<"), !q) + if (window && window.document) + q = window.document; + else + throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM"); + var J = q.createElement("div"); + J.innerHTML = _; + var Z = { + preList: l(J) + }; + N(J); + for (var B = J.childNodes, k = "", F = 0; F < B.length; F++) + k += a.subParser("makeMarkdown.node")(B[F], Z); + function N(w) { + for (var I = 0; I < w.childNodes.length; ++I) { + var K = w.childNodes[I]; + K.nodeType === 3 ? !/\S/.test(K.nodeValue) && !/^[ ]+$/.test(K.nodeValue) ? (w.removeChild(K), --I) : (K.nodeValue = K.nodeValue.split(` +`).join(" "), K.nodeValue = K.nodeValue.replace(/(\s)+/g, "$1")) : K.nodeType === 1 && N(K); + } + } + function l(w) { + for (var I = w.querySelectorAll("pre"), K = [], W = 0; W < I.length; ++W) + if (I[W].childElementCount === 1 && I[W].firstChild.tagName.toLowerCase() === "code") { + var re = I[W].firstChild.innerHTML.trim(), ae = I[W].firstChild.getAttribute("data-language") || ""; + if (ae === "") + for (var fe = I[W].firstChild.className.split(" "), Te = 0; Te < fe.length; ++Te) { + var xe = fe[Te].match(/^language-(.+)$/); + if (xe !== null) { + ae = xe[1]; + break; + } + } + re = a.helper.unescapeHTMLEntities(re), K.push(re), I[W].outerHTML = ''; + } else + K.push(I[W].innerHTML), I[W].innerHTML = "", I[W].setAttribute("prenum", W.toString()); + return K; + } + return k; + }, this.setOption = function(_, q) { + d[_] = q; + }, this.getOption = function(_) { + return d[_]; + }, this.getOptions = function() { + return d; + }, this.addExtension = function(_, q) { + q = q || null, U(_, q); + }, this.useExtension = function(_) { + U(_); + }, this.setFlavor = function(_) { + if (!b.hasOwnProperty(_)) + throw Error(_ + " flavor was not found"); + var q = b[_]; + m = _; + for (var J in q) + q.hasOwnProperty(J) && (d[J] = q[J]); + }, this.getFlavor = function() { + return m; + }, this.removeExtension = function(_) { + a.helper.isArray(_) || (_ = [_]); + for (var q = 0; q < _.length; ++q) { + for (var J = _[q], Z = 0; Z < s.length; ++Z) + s[Z] === J && s.splice(Z, 1); + for (var B = 0; B < i.length; ++B) + i[B] === J && i.splice(B, 1); + } + }, this.getAllExtensions = function() { + return { + language: s, + output: i + }; + }, this.getMetadata = function(_) { + return _ ? h.raw : h.parsed; + }, this.getMetadataFormat = function() { + return h.format; + }, this._setMetadataPair = function(_, q) { + h.parsed[_] = q; + }, this._setMetadataFormat = function(_) { + h.format = _; + }, this._setMetadataRaw = function(_) { + h.raw = _; + }; + }, a.subParser("anchors", function(t, d, s) { + t = s.converter._dispatch("anchors.before", t, d, s); + var i = function(c, m, h, C, U, H, V) { + if (a.helper.isUndefined(V) && (V = ""), h = h.toLowerCase(), c.search(/\(? ?(['"].*['"])?\)$/m) > -1) + C = ""; + else if (!C) + if (h || (h = m.toLowerCase().replace(/ ?\n/g, " ")), C = "#" + h, !a.helper.isUndefined(s.gUrls[h])) + C = s.gUrls[h], a.helper.isUndefined(s.gTitles[h]) || (V = s.gTitles[h]); + else + return c; + C = C.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var G = '", G; + }; + return t = t.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, i), t = t.replace( + /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, + i + ), t = t.replace( + /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, + i + ), t = t.replace(/\[([^\[\]]+)]()()()()()/g, i), d.ghMentions && (t = t.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(c, m, h, C, U) { + if (h === "\\") + return m + C; + if (!a.helper.isString(d.ghMentionsLink)) + throw new Error("ghMentionsLink option must be a string"); + var H = d.ghMentionsLink.replace(/\{u}/g, U), V = ""; + return d.openLinksInNewWindow && (V = ' rel="noopener noreferrer" target="¨E95Eblank"'), m + '" + C + ""; + })), t = s.converter._dispatch("anchors.after", t, d, s), t; + }); + var z = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, L = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, R = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, j = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, T = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, $ = function(t) { + return function(d, s, i, c, m, h, C) { + i = i.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var U = i, H = "", V = "", G = s || "", _ = C || ""; + return /^www\./i.test(i) && (i = i.replace(/^www\./i, "http://www.")), t.excludeTrailingPunctuationFromURLs && h && (H = h), t.openLinksInNewWindow && (V = ' rel="noopener noreferrer" target="¨E95Eblank"'), G + '" + U + "" + H + _; + }; + }, O = function(t, d) { + return function(s, i, c) { + var m = "mailto:"; + return i = i || "", c = a.subParser("unescapeSpecialChars")(c, t, d), t.encodeEmails ? (m = a.helper.encodeEmailAddress(m + c), c = a.helper.encodeEmailAddress(c)) : m = m + c, i + '' + c + ""; + }; + }; + a.subParser("autoLinks", function(t, d, s) { + return t = s.converter._dispatch("autoLinks.before", t, d, s), t = t.replace(R, $(d)), t = t.replace(T, O(d, s)), t = s.converter._dispatch("autoLinks.after", t, d, s), t; + }), a.subParser("simplifiedAutoLinks", function(t, d, s) { + return d.simplifiedAutoLink && (t = s.converter._dispatch("simplifiedAutoLinks.before", t, d, s), d.excludeTrailingPunctuationFromURLs ? t = t.replace(L, $(d)) : t = t.replace(z, $(d)), t = t.replace(j, O(d, s)), t = s.converter._dispatch("simplifiedAutoLinks.after", t, d, s)), t; + }), a.subParser("blockGamut", function(t, d, s) { + return t = s.converter._dispatch("blockGamut.before", t, d, s), t = a.subParser("blockQuotes")(t, d, s), t = a.subParser("headers")(t, d, s), t = a.subParser("horizontalRule")(t, d, s), t = a.subParser("lists")(t, d, s), t = a.subParser("codeBlocks")(t, d, s), t = a.subParser("tables")(t, d, s), t = a.subParser("hashHTMLBlocks")(t, d, s), t = a.subParser("paragraphs")(t, d, s), t = s.converter._dispatch("blockGamut.after", t, d, s), t; + }), a.subParser("blockQuotes", function(t, d, s) { + t = s.converter._dispatch("blockQuotes.before", t, d, s), t = t + ` + +`; + var i = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; + return d.splitAdjacentBlockquotes && (i = /^ {0,3}>[\s\S]*?(?:\n\n)/gm), t = t.replace(i, function(c) { + return c = c.replace(/^[ \t]*>[ \t]?/gm, ""), c = c.replace(/¨0/g, ""), c = c.replace(/^[ \t]+$/gm, ""), c = a.subParser("githubCodeBlocks")(c, d, s), c = a.subParser("blockGamut")(c, d, s), c = c.replace(/(^|\n)/g, "$1 "), c = c.replace(/(\s*
[^\r]+?<\/pre>)/gm, function(m, h) {
+          var C = h;
+          return C = C.replace(/^  /mg, "¨0"), C = C.replace(/¨0/g, ""), C;
+        }), a.subParser("hashBlock")(`
+` + c + ` +
`, d, s); + }), t = s.converter._dispatch("blockQuotes.after", t, d, s), t; + }), a.subParser("codeBlocks", function(t, d, s) { + t = s.converter._dispatch("codeBlocks.before", t, d, s), t += "¨0"; + var i = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; + return t = t.replace(i, function(c, m, h) { + var C = m, U = h, H = ` +`; + return C = a.subParser("outdent")(C, d, s), C = a.subParser("encodeCode")(C, d, s), C = a.subParser("detab")(C, d, s), C = C.replace(/^\n+/g, ""), C = C.replace(/\n+$/g, ""), d.omitExtraWLInCodeBlocks && (H = ""), C = "
" + C + H + "
", a.subParser("hashBlock")(C, d, s) + U; + }), t = t.replace(/¨0/, ""), t = s.converter._dispatch("codeBlocks.after", t, d, s), t; + }), a.subParser("codeSpans", function(t, d, s) { + return t = s.converter._dispatch("codeSpans.before", t, d, s), typeof t > "u" && (t = ""), t = t.replace( + /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, + function(i, c, m, h) { + var C = h; + return C = C.replace(/^([ \t]*)/g, ""), C = C.replace(/[ \t]*$/g, ""), C = a.subParser("encodeCode")(C, d, s), C = c + "" + C + "", C = a.subParser("hashHTMLSpans")(C, d, s), C; + } + ), t = s.converter._dispatch("codeSpans.after", t, d, s), t; + }), a.subParser("completeHTMLDocument", function(t, d, s) { + if (!d.completeHTMLDocument) + return t; + t = s.converter._dispatch("completeHTMLDocument.before", t, d, s); + var i = "html", c = ` +`, m = "", h = ` +`, C = "", U = ""; + typeof s.metadata.parsed.doctype < "u" && (c = " +`, i = s.metadata.parsed.doctype.toString().toLowerCase(), (i === "html" || i === "html5") && (h = '')); + for (var H in s.metadata.parsed) + if (s.metadata.parsed.hasOwnProperty(H)) + switch (H.toLowerCase()) { + case "doctype": + break; + case "title": + m = "" + s.metadata.parsed.title + ` +`; + break; + case "charset": + i === "html" || i === "html5" ? h = ' +` : h = ' +`; + break; + case "language": + case "lang": + C = ' lang="' + s.metadata.parsed[H] + '"', U += ' +`; + break; + default: + U += ' +`; + } + return t = c + " + +` + m + h + U + ` + +` + t.trim() + ` + +`, t = s.converter._dispatch("completeHTMLDocument.after", t, d, s), t; + }), a.subParser("detab", function(t, d, s) { + return t = s.converter._dispatch("detab.before", t, d, s), t = t.replace(/\t(?=\t)/g, " "), t = t.replace(/\t/g, "¨A¨B"), t = t.replace(/¨B(.+?)¨A/g, function(i, c) { + for (var m = c, h = 4 - m.length % 4, C = 0; C < h; C++) + m += " "; + return m; + }), t = t.replace(/¨A/g, " "), t = t.replace(/¨B/g, ""), t = s.converter._dispatch("detab.after", t, d, s), t; + }), a.subParser("ellipsis", function(t, d, s) { + return d.ellipsis && (t = s.converter._dispatch("ellipsis.before", t, d, s), t = t.replace(/\.\.\./g, "…"), t = s.converter._dispatch("ellipsis.after", t, d, s)), t; + }), a.subParser("emoji", function(t, d, s) { + if (!d.emoji) + return t; + t = s.converter._dispatch("emoji.before", t, d, s); + var i = /:([\S]+?):/g; + return t = t.replace(i, function(c, m) { + return a.helper.emojis.hasOwnProperty(m) ? a.helper.emojis[m] : c; + }), t = s.converter._dispatch("emoji.after", t, d, s), t; + }), a.subParser("encodeAmpsAndAngles", function(t, d, s) { + return t = s.converter._dispatch("encodeAmpsAndAngles.before", t, d, s), t = t.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), t = t.replace(/<(?![a-z\/?$!])/gi, "<"), t = t.replace(//g, ">"), t = s.converter._dispatch("encodeAmpsAndAngles.after", t, d, s), t; + }), a.subParser("encodeBackslashEscapes", function(t, d, s) { + return t = s.converter._dispatch("encodeBackslashEscapes.before", t, d, s), t = t.replace(/\\(\\)/g, a.helper.escapeCharactersCallback), t = t.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, a.helper.escapeCharactersCallback), t = s.converter._dispatch("encodeBackslashEscapes.after", t, d, s), t; + }), a.subParser("encodeCode", function(t, d, s) { + return t = s.converter._dispatch("encodeCode.before", t, d, s), t = t.replace(/&/g, "&").replace(//g, ">").replace(/([*_{}\[\]\\=~-])/g, a.helper.escapeCharactersCallback), t = s.converter._dispatch("encodeCode.after", t, d, s), t; + }), a.subParser("escapeSpecialCharsWithinTagAttributes", function(t, d, s) { + t = s.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", t, d, s); + var i = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, c = /-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; + return t = t.replace(i, function(m) { + return m.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), t = t.replace(c, function(m) { + return m.replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), t = s.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", t, d, s), t; + }), a.subParser("githubCodeBlocks", function(t, d, s) { + return d.ghCodeBlocks ? (t = s.converter._dispatch("githubCodeBlocks.before", t, d, s), t += "¨0", t = t.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(i, c, m, h) { + var C = d.omitExtraWLInCodeBlocks ? "" : ` +`; + return h = a.subParser("encodeCode")(h, d, s), h = a.subParser("detab")(h, d, s), h = h.replace(/^\n+/g, ""), h = h.replace(/\n+$/g, ""), h = "
" + h + C + "
", h = a.subParser("hashBlock")(h, d, s), ` + +¨G` + (s.ghCodeBlocks.push({ text: i, codeblock: h }) - 1) + `G + +`; + }), t = t.replace(/¨0/, ""), s.converter._dispatch("githubCodeBlocks.after", t, d, s)) : t; + }), a.subParser("hashBlock", function(t, d, s) { + return t = s.converter._dispatch("hashBlock.before", t, d, s), t = t.replace(/(^\n+|\n+$)/g, ""), t = ` + +¨K` + (s.gHtmlBlocks.push(t) - 1) + `K + +`, t = s.converter._dispatch("hashBlock.after", t, d, s), t; + }), a.subParser("hashCodeTags", function(t, d, s) { + t = s.converter._dispatch("hashCodeTags.before", t, d, s); + var i = function(c, m, h, C) { + var U = h + a.subParser("encodeCode")(m, d, s) + C; + return "¨C" + (s.gHtmlSpans.push(U) - 1) + "C"; + }; + return t = a.helper.replaceRecursiveRegExp(t, i, "]*>", "", "gim"), t = s.converter._dispatch("hashCodeTags.after", t, d, s), t; + }), a.subParser("hashElement", function(t, d, s) { + return function(i, c) { + var m = c; + return m = m.replace(/\n\n/g, ` +`), m = m.replace(/^\n/, ""), m = m.replace(/\n+$/g, ""), m = ` + +¨K` + (s.gHtmlBlocks.push(m) - 1) + `K + +`, m; + }; + }), a.subParser("hashHTMLBlocks", function(t, d, s) { + t = s.converter._dispatch("hashHTMLBlocks.before", t, d, s); + var i = [ + "pre", + "div", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "blockquote", + "table", + "dl", + "ol", + "ul", + "script", + "noscript", + "form", + "fieldset", + "iframe", + "math", + "style", + "section", + "header", + "footer", + "nav", + "article", + "aside", + "address", + "audio", + "canvas", + "figure", + "hgroup", + "output", + "video", + "p" + ], c = function(_, q, J, Z) { + var B = _; + return J.search(/\bmarkdown\b/) !== -1 && (B = J + s.converter.makeHtml(q) + Z), ` + +¨K` + (s.gHtmlBlocks.push(B) - 1) + `K + +`; + }; + d.backslashEscapesHTMLTags && (t = t.replace(/\\<(\/?[^>]+?)>/g, function(_, q) { + return "<" + q + ">"; + })); + for (var m = 0; m < i.length; ++m) + for (var h, C = new RegExp("^ {0,3}(<" + i[m] + "\\b[^>]*>)", "im"), U = "<" + i[m] + "\\b[^>]*>", H = ""; (h = a.helper.regexIndexOf(t, C)) !== -1; ) { + var V = a.helper.splitAtIndex(t, h), G = a.helper.replaceRecursiveRegExp(V[1], c, U, H, "im"); + if (G === V[1]) + break; + t = V[0].concat(G); + } + return t = t.replace( + /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, + a.subParser("hashElement")(t, d, s) + ), t = a.helper.replaceRecursiveRegExp(t, function(_) { + return ` + +¨K` + (s.gHtmlBlocks.push(_) - 1) + `K + +`; + }, "^ {0,3}", "gm"), t = t.replace( + /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, + a.subParser("hashElement")(t, d, s) + ), t = s.converter._dispatch("hashHTMLBlocks.after", t, d, s), t; + }), a.subParser("hashHTMLSpans", function(t, d, s) { + t = s.converter._dispatch("hashHTMLSpans.before", t, d, s); + function i(c) { + return "¨C" + (s.gHtmlSpans.push(c) - 1) + "C"; + } + return t = t.replace(/<[^>]+?\/>/gi, function(c) { + return i(c); + }), t = t.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(c) { + return i(c); + }), t = t.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(c) { + return i(c); + }), t = t.replace(/<[^>]+?>/gi, function(c) { + return i(c); + }), t = s.converter._dispatch("hashHTMLSpans.after", t, d, s), t; + }), a.subParser("unhashHTMLSpans", function(t, d, s) { + t = s.converter._dispatch("unhashHTMLSpans.before", t, d, s); + for (var i = 0; i < s.gHtmlSpans.length; ++i) { + for (var c = s.gHtmlSpans[i], m = 0; /¨C(\d+)C/.test(c); ) { + var h = RegExp.$1; + if (c = c.replace("¨C" + h + "C", s.gHtmlSpans[h]), m === 10) { + console.error("maximum nesting of 10 spans reached!!!"); + break; + } + ++m; + } + t = t.replace("¨C" + i + "C", c); + } + return t = s.converter._dispatch("unhashHTMLSpans.after", t, d, s), t; + }), a.subParser("hashPreCodeTags", function(t, d, s) { + t = s.converter._dispatch("hashPreCodeTags.before", t, d, s); + var i = function(c, m, h, C) { + var U = h + a.subParser("encodeCode")(m, d, s) + C; + return ` + +¨G` + (s.ghCodeBlocks.push({ text: c, codeblock: U }) - 1) + `G + +`; + }; + return t = a.helper.replaceRecursiveRegExp(t, i, "^ {0,3}]*>\\s*]*>", "^ {0,3}\\s*
", "gim"), t = s.converter._dispatch("hashPreCodeTags.after", t, d, s), t; + }), a.subParser("headers", function(t, d, s) { + t = s.converter._dispatch("headers.before", t, d, s); + var i = isNaN(parseInt(d.headerLevelStart)) ? 1 : parseInt(d.headerLevelStart), c = d.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, m = d.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; + t = t.replace(c, function(U, H) { + var V = a.subParser("spanGamut")(H, d, s), G = d.noHeaderId ? "" : ' id="' + C(H) + '"', _ = i, q = "" + V + ""; + return a.subParser("hashBlock")(q, d, s); + }), t = t.replace(m, function(U, H) { + var V = a.subParser("spanGamut")(H, d, s), G = d.noHeaderId ? "" : ' id="' + C(H) + '"', _ = i + 1, q = "" + V + ""; + return a.subParser("hashBlock")(q, d, s); + }); + var h = d.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; + t = t.replace(h, function(U, H, V) { + var G = V; + d.customizedHeaderId && (G = V.replace(/\s?\{([^{]+?)}\s*$/, "")); + var _ = a.subParser("spanGamut")(G, d, s), q = d.noHeaderId ? "" : ' id="' + C(V) + '"', J = i - 1 + H.length, Z = "" + _ + ""; + return a.subParser("hashBlock")(Z, d, s); + }); + function C(U) { + var H, V; + if (d.customizedHeaderId) { + var G = U.match(/\{([^{]+?)}\s*$/); + G && G[1] && (U = G[1]); + } + return H = U, a.helper.isString(d.prefixHeaderId) ? V = d.prefixHeaderId : d.prefixHeaderId === !0 ? V = "section-" : V = "", d.rawPrefixHeaderId || (H = V + H), d.ghCompatibleHeaderId ? H = H.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase() : d.rawHeaderId ? H = H.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "¨").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase() : H = H.replace(/[^\w]/g, "").toLowerCase(), d.rawPrefixHeaderId && (H = V + H), s.hashLinkCounts[H] ? H = H + "-" + s.hashLinkCounts[H]++ : s.hashLinkCounts[H] = 1, H; + } + return t = s.converter._dispatch("headers.after", t, d, s), t; + }), a.subParser("horizontalRule", function(t, d, s) { + t = s.converter._dispatch("horizontalRule.before", t, d, s); + var i = a.subParser("hashBlock")("
", d, s); + return t = t.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, i), t = t.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, i), t = t.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, i), t = s.converter._dispatch("horizontalRule.after", t, d, s), t; + }), a.subParser("images", function(t, d, s) { + t = s.converter._dispatch("images.before", t, d, s); + var i = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, c = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, m = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, h = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, C = /!\[([^\[\]]+)]()()()()()/g; + function U(V, G, _, q, J, Z, B, k) { + return q = q.replace(/\s/g, ""), H(V, G, _, q, J, Z, B, k); + } + function H(V, G, _, q, J, Z, B, k) { + var F = s.gUrls, N = s.gTitles, l = s.gDimensions; + if (_ = _.toLowerCase(), k || (k = ""), V.search(/\(? ?(['"].*['"])?\)$/m) > -1) + q = ""; + else if (q === "" || q === null) + if ((_ === "" || _ === null) && (_ = G.toLowerCase().replace(/ ?\n/g, " ")), q = "#" + _, !a.helper.isUndefined(F[_])) + q = F[_], a.helper.isUndefined(N[_]) || (k = N[_]), a.helper.isUndefined(l[_]) || (J = l[_].width, Z = l[_].height); + else + return V; + G = G.replace(/"/g, """).replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback), q = q.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var w = '' + G + '", "
"); + }), t = t.replace(/\b__(\S[\s\S]*?)__\b/g, function(c, m) { + return i(m, "", ""); + }), t = t.replace(/\b_(\S[\s\S]*?)_\b/g, function(c, m) { + return i(m, "", ""); + })) : (t = t.replace(/___(\S[\s\S]*?)___/g, function(c, m) { + return /\S$/.test(m) ? i(m, "", "") : c; + }), t = t.replace(/__(\S[\s\S]*?)__/g, function(c, m) { + return /\S$/.test(m) ? i(m, "", "") : c; + }), t = t.replace(/_([^\s_][\s\S]*?)_/g, function(c, m) { + return /\S$/.test(m) ? i(m, "", "") : c; + })), d.literalMidWordAsterisks ? (t = t.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(c, m, h) { + return i(h, m + "", ""); + }), t = t.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(c, m, h) { + return i(h, m + "", ""); + }), t = t.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(c, m, h) { + return i(h, m + "", ""); + })) : (t = t.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(c, m) { + return /\S$/.test(m) ? i(m, "", "") : c; + }), t = t.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(c, m) { + return /\S$/.test(m) ? i(m, "", "") : c; + }), t = t.replace(/\*([^\s*][\s\S]*?)\*/g, function(c, m) { + return /\S$/.test(m) ? i(m, "", "") : c; + })), t = s.converter._dispatch("italicsAndBold.after", t, d, s), t; + }), a.subParser("lists", function(t, d, s) { + function i(h, C) { + s.gListLevel++, h = h.replace(/\n{2,}$/, ` +`), h += "¨0"; + var U = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, H = /\n[ \t]*\n(?!¨0)/.test(h); + return d.disableForced4SpacesIndentedSublists && (U = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm), h = h.replace(U, function(V, G, _, q, J, Z, B) { + B = B && B.trim() !== ""; + var k = a.subParser("outdent")(J, d, s), F = ""; + return Z && d.tasklists && (F = ' class="task-list-item" style="list-style-type: none;"', k = k.replace(/^[ \t]*\[(x|X| )?]/m, function() { + var N = ' -1 ? (k = a.subParser("githubCodeBlocks")(k, d, s), k = a.subParser("blockGamut")(k, d, s)) : (k = a.subParser("lists")(k, d, s), k = k.replace(/\n$/, ""), k = a.subParser("hashHTMLBlocks")(k, d, s), k = k.replace(/\n\n+/g, ` + +`), H ? k = a.subParser("paragraphs")(k, d, s) : k = a.subParser("spanGamut")(k, d, s)), k = k.replace("¨A", ""), k = "" + k + ` +`, k; + }), h = h.replace(/¨0/g, ""), s.gListLevel--, C && (h = h.replace(/\s+$/, "")), h; + } + function c(h, C) { + if (C === "ol") { + var U = h.match(/^ *(\d+)\./); + if (U && U[1] !== "1") + return ' start="' + U[1] + '"'; + } + return ""; + } + function m(h, C, U) { + var H = d.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, V = d.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, G = C === "ul" ? H : V, _ = ""; + if (h.search(G) !== -1) + (function J(Z) { + var B = Z.search(G), k = c(h, C); + B !== -1 ? (_ += ` + +<` + C + k + `> +` + i(Z.slice(0, B), !!U) + " +`, C = C === "ul" ? "ol" : "ul", G = C === "ul" ? H : V, J(Z.slice(B))) : _ += ` + +<` + C + k + `> +` + i(Z, !!U) + " +`; + })(h); + else { + var q = c(h, C); + _ = ` + +<` + C + q + `> +` + i(h, !!U) + " +`; + } + return _; + } + return t = s.converter._dispatch("lists.before", t, d, s), t += "¨0", s.gListLevel ? t = t.replace( + /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, + function(h, C, U) { + var H = U.search(/[*+-]/g) > -1 ? "ul" : "ol"; + return m(C, H, !0); + } + ) : t = t.replace( + /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, + function(h, C, U, H) { + var V = H.search(/[*+-]/g) > -1 ? "ul" : "ol"; + return m(U, V, !1); + } + ), t = t.replace(/¨0/, ""), t = s.converter._dispatch("lists.after", t, d, s), t; + }), a.subParser("metadata", function(t, d, s) { + if (!d.metadata) + return t; + t = s.converter._dispatch("metadata.before", t, d, s); + function i(c) { + s.metadata.raw = c, c = c.replace(/&/g, "&").replace(/"/g, """), c = c.replace(/\n {4}/g, " "), c.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(m, h, C) { + return s.metadata.parsed[h] = C, ""; + }); + } + return t = t.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(c, m, h) { + return i(h), "¨M"; + }), t = t.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(c, m, h) { + return m && (s.metadata.format = m), i(h), "¨M"; + }), t = t.replace(/¨M/g, ""), t = s.converter._dispatch("metadata.after", t, d, s), t; + }), a.subParser("outdent", function(t, d, s) { + return t = s.converter._dispatch("outdent.before", t, d, s), t = t.replace(/^(\t|[ ]{1,4})/gm, "¨0"), t = t.replace(/¨0/g, ""), t = s.converter._dispatch("outdent.after", t, d, s), t; + }), a.subParser("paragraphs", function(t, d, s) { + t = s.converter._dispatch("paragraphs.before", t, d, s), t = t.replace(/^\n+/g, ""), t = t.replace(/\n+$/g, ""); + for (var i = t.split(/\n{2,}/g), c = [], m = i.length, h = 0; h < m; h++) { + var C = i[h]; + C.search(/¨(K|G)(\d+)\1/g) >= 0 ? c.push(C) : C.search(/\S/) >= 0 && (C = a.subParser("spanGamut")(C, d, s), C = C.replace(/^([ \t]*)/g, "

"), C += "

", c.push(C)); + } + for (m = c.length, h = 0; h < m; h++) { + for (var U = "", H = c[h], V = !1; /¨(K|G)(\d+)\1/.test(H); ) { + var G = RegExp.$1, _ = RegExp.$2; + G === "K" ? U = s.gHtmlBlocks[_] : V ? U = a.subParser("encodeCode")(s.ghCodeBlocks[_].text, d, s) : U = s.ghCodeBlocks[_].codeblock, U = U.replace(/\$/g, "$$$$"), H = H.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, U), /^]*>\s*]*>/.test(H) && (V = !0); + } + c[h] = H; + } + return t = c.join(` +`), t = t.replace(/^\n+/g, ""), t = t.replace(/\n+$/g, ""), s.converter._dispatch("paragraphs.after", t, d, s); + }), a.subParser("runExtension", function(t, d, s, i) { + if (t.filter) + d = t.filter(d, i.converter, s); + else if (t.regex) { + var c = t.regex; + c instanceof RegExp || (c = new RegExp(c, "g")), d = d.replace(c, t.replace); + } + return d; + }), a.subParser("spanGamut", function(t, d, s) { + return t = s.converter._dispatch("spanGamut.before", t, d, s), t = a.subParser("codeSpans")(t, d, s), t = a.subParser("escapeSpecialCharsWithinTagAttributes")(t, d, s), t = a.subParser("encodeBackslashEscapes")(t, d, s), t = a.subParser("images")(t, d, s), t = a.subParser("anchors")(t, d, s), t = a.subParser("autoLinks")(t, d, s), t = a.subParser("simplifiedAutoLinks")(t, d, s), t = a.subParser("emoji")(t, d, s), t = a.subParser("underline")(t, d, s), t = a.subParser("italicsAndBold")(t, d, s), t = a.subParser("strikethrough")(t, d, s), t = a.subParser("ellipsis")(t, d, s), t = a.subParser("hashHTMLSpans")(t, d, s), t = a.subParser("encodeAmpsAndAngles")(t, d, s), d.simpleLineBreaks ? /\n\n¨K/.test(t) || (t = t.replace(/\n+/g, `
+`)) : t = t.replace(/ +\n/g, `
+`), t = s.converter._dispatch("spanGamut.after", t, d, s), t; + }), a.subParser("strikethrough", function(t, d, s) { + function i(c) { + return d.simplifiedAutoLink && (c = a.subParser("simplifiedAutoLinks")(c, d, s)), "" + c + ""; + } + return d.strikethrough && (t = s.converter._dispatch("strikethrough.before", t, d, s), t = t.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(c, m) { + return i(m); + }), t = s.converter._dispatch("strikethrough.after", t, d, s)), t; + }), a.subParser("stripLinkDefinitions", function(t, d, s) { + var i = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm, c = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm; + t += "¨0"; + var m = function(h, C, U, H, V, G, _) { + return C = C.toLowerCase(), t.toLowerCase().split(C).length - 1 < 2 ? h : (U.match(/^data:.+?\/.+?;base64,/) ? s.gUrls[C] = U.replace(/\s/g, "") : s.gUrls[C] = a.subParser("encodeAmpsAndAngles")(U, d, s), G ? G + _ : (_ && (s.gTitles[C] = _.replace(/"|'/g, """)), d.parseImgDimensions && H && V && (s.gDimensions[C] = { + width: H, + height: V + }), "")); + }; + return t = t.replace(c, m), t = t.replace(i, m), t = t.replace(/¨0/, ""), t; + }), a.subParser("tables", function(t, d, s) { + if (!d.tables) + return t; + var i = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, c = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; + function m(V) { + return /^:[ \t]*--*$/.test(V) ? ' style="text-align:left;"' : /^--*[ \t]*:[ \t]*$/.test(V) ? ' style="text-align:right;"' : /^:[ \t]*--*[ \t]*:$/.test(V) ? ' style="text-align:center;"' : ""; + } + function h(V, G) { + var _ = ""; + return V = V.trim(), (d.tablesHeaderId || d.tableHeaderId) && (_ = ' id="' + V.replace(/ /g, "_").toLowerCase() + '"'), V = a.subParser("spanGamut")(V, d, s), "" + V + ` +`; + } + function C(V, G) { + var _ = a.subParser("spanGamut")(V, d, s); + return "" + _ + ` +`; + } + function U(V, G) { + for (var _ = ` + + +`, q = V.length, J = 0; J < q; ++J) + _ += V[J]; + for (_ += ` + + +`, J = 0; J < G.length; ++J) { + _ += ` +`; + for (var Z = 0; Z < q; ++Z) + _ += G[J][Z]; + _ += ` +`; + } + return _ += ` +
+`, _; + } + function H(V) { + var G, _ = V.split(` +`); + for (G = 0; G < _.length; ++G) + /^ {0,3}\|/.test(_[G]) && (_[G] = _[G].replace(/^ {0,3}\|/, "")), /\|[ \t]*$/.test(_[G]) && (_[G] = _[G].replace(/\|[ \t]*$/, "")), _[G] = a.subParser("codeSpans")(_[G], d, s); + var q = _[0].split("|").map(function(w) { + return w.trim(); + }), J = _[1].split("|").map(function(w) { + return w.trim(); + }), Z = [], B = [], k = [], F = []; + for (_.shift(), _.shift(), G = 0; G < _.length; ++G) + _[G].trim() !== "" && Z.push( + _[G].split("|").map(function(w) { + return w.trim(); + }) + ); + if (q.length < J.length) + return V; + for (G = 0; G < J.length; ++G) + k.push(m(J[G])); + for (G = 0; G < q.length; ++G) + a.helper.isUndefined(k[G]) && (k[G] = ""), B.push(h(q[G], k[G])); + for (G = 0; G < Z.length; ++G) { + for (var N = [], l = 0; l < B.length; ++l) + a.helper.isUndefined(Z[G][l]), N.push(C(Z[G][l], k[l])); + F.push(N); + } + return U(B, F); + } + return t = s.converter._dispatch("tables.before", t, d, s), t = t.replace(/\\(\|)/g, a.helper.escapeCharactersCallback), t = t.replace(i, H), t = t.replace(c, H), t = s.converter._dispatch("tables.after", t, d, s), t; + }), a.subParser("underline", function(t, d, s) { + return d.underline && (t = s.converter._dispatch("underline.before", t, d, s), d.literalMidWordUnderscores ? (t = t.replace(/\b___(\S[\s\S]*?)___\b/g, function(i, c) { + return "" + c + ""; + }), t = t.replace(/\b__(\S[\s\S]*?)__\b/g, function(i, c) { + return "" + c + ""; + })) : (t = t.replace(/___(\S[\s\S]*?)___/g, function(i, c) { + return /\S$/.test(c) ? "" + c + "" : i; + }), t = t.replace(/__(\S[\s\S]*?)__/g, function(i, c) { + return /\S$/.test(c) ? "" + c + "" : i; + })), t = t.replace(/(_)/g, a.helper.escapeCharactersCallback), t = s.converter._dispatch("underline.after", t, d, s)), t; + }), a.subParser("unescapeSpecialChars", function(t, d, s) { + return t = s.converter._dispatch("unescapeSpecialChars.before", t, d, s), t = t.replace(/¨E(\d+)E/g, function(i, c) { + var m = parseInt(c); + return String.fromCharCode(m); + }), t = s.converter._dispatch("unescapeSpecialChars.after", t, d, s), t; + }), a.subParser("makeMarkdown.blockquote", function(t, d) { + var s = ""; + if (t.hasChildNodes()) + for (var i = t.childNodes, c = i.length, m = 0; m < c; ++m) { + var h = a.subParser("makeMarkdown.node")(i[m], d); + h !== "" && (s += h); + } + return s = s.trim(), s = "> " + s.split(` +`).join(` +> `), s; + }), a.subParser("makeMarkdown.codeBlock", function(t, d) { + var s = t.getAttribute("language"), i = t.getAttribute("precodenum"); + return "```" + s + ` +` + d.preList[i] + "\n```"; + }), a.subParser("makeMarkdown.codeSpan", function(t) { + return "`" + t.innerHTML + "`"; + }), a.subParser("makeMarkdown.emphasis", function(t, d) { + var s = ""; + if (t.hasChildNodes()) { + s += "*"; + for (var i = t.childNodes, c = i.length, m = 0; m < c; ++m) + s += a.subParser("makeMarkdown.node")(i[m], d); + s += "*"; + } + return s; + }), a.subParser("makeMarkdown.header", function(t, d, s) { + var i = new Array(s + 1).join("#"), c = ""; + if (t.hasChildNodes()) { + c = i + " "; + for (var m = t.childNodes, h = m.length, C = 0; C < h; ++C) + c += a.subParser("makeMarkdown.node")(m[C], d); + } + return c; + }), a.subParser("makeMarkdown.hr", function() { + return "---"; + }), a.subParser("makeMarkdown.image", function(t) { + var d = ""; + return t.hasAttribute("src") && (d += "![" + t.getAttribute("alt") + "](", d += "<" + t.getAttribute("src") + ">", t.hasAttribute("width") && t.hasAttribute("height") && (d += " =" + t.getAttribute("width") + "x" + t.getAttribute("height")), t.hasAttribute("title") && (d += ' "' + t.getAttribute("title") + '"'), d += ")"), d; + }), a.subParser("makeMarkdown.links", function(t, d) { + var s = ""; + if (t.hasChildNodes() && t.hasAttribute("href")) { + var i = t.childNodes, c = i.length; + s = "["; + for (var m = 0; m < c; ++m) + s += a.subParser("makeMarkdown.node")(i[m], d); + s += "](", s += "<" + t.getAttribute("href") + ">", t.hasAttribute("title") && (s += ' "' + t.getAttribute("title") + '"'), s += ")"; + } + return s; + }), a.subParser("makeMarkdown.list", function(t, d, s) { + var i = ""; + if (!t.hasChildNodes()) + return ""; + for (var c = t.childNodes, m = c.length, h = t.getAttribute("start") || 1, C = 0; C < m; ++C) + if (!(typeof c[C].tagName > "u" || c[C].tagName.toLowerCase() !== "li")) { + var U = ""; + s === "ol" ? U = h.toString() + ". " : U = "- ", i += U + a.subParser("makeMarkdown.listItem")(c[C], d), ++h; + } + return i += ` + +`, i.trim(); + }), a.subParser("makeMarkdown.listItem", function(t, d) { + for (var s = "", i = t.childNodes, c = i.length, m = 0; m < c; ++m) + s += a.subParser("makeMarkdown.node")(i[m], d); + return /\n$/.test(s) ? s = s.split(` +`).join(` + `).replace(/^ {4}$/gm, "").replace(/\n\n+/g, ` + +`) : s += ` +`, s; + }), a.subParser("makeMarkdown.node", function(t, d, s) { + s = s || !1; + var i = ""; + if (t.nodeType === 3) + return a.subParser("makeMarkdown.txt")(t, d); + if (t.nodeType === 8) + return " + +`; + if (t.nodeType !== 1) + return ""; + var c = t.tagName.toLowerCase(); + switch (c) { + case "h1": + s || (i = a.subParser("makeMarkdown.header")(t, d, 1) + ` + +`); + break; + case "h2": + s || (i = a.subParser("makeMarkdown.header")(t, d, 2) + ` + +`); + break; + case "h3": + s || (i = a.subParser("makeMarkdown.header")(t, d, 3) + ` + +`); + break; + case "h4": + s || (i = a.subParser("makeMarkdown.header")(t, d, 4) + ` + +`); + break; + case "h5": + s || (i = a.subParser("makeMarkdown.header")(t, d, 5) + ` + +`); + break; + case "h6": + s || (i = a.subParser("makeMarkdown.header")(t, d, 6) + ` + +`); + break; + case "p": + s || (i = a.subParser("makeMarkdown.paragraph")(t, d) + ` + +`); + break; + case "blockquote": + s || (i = a.subParser("makeMarkdown.blockquote")(t, d) + ` + +`); + break; + case "hr": + s || (i = a.subParser("makeMarkdown.hr")(t, d) + ` + +`); + break; + case "ol": + s || (i = a.subParser("makeMarkdown.list")(t, d, "ol") + ` + +`); + break; + case "ul": + s || (i = a.subParser("makeMarkdown.list")(t, d, "ul") + ` + +`); + break; + case "precode": + s || (i = a.subParser("makeMarkdown.codeBlock")(t, d) + ` + +`); + break; + case "pre": + s || (i = a.subParser("makeMarkdown.pre")(t, d) + ` + +`); + break; + case "table": + s || (i = a.subParser("makeMarkdown.table")(t, d) + ` + +`); + break; + case "code": + i = a.subParser("makeMarkdown.codeSpan")(t, d); + break; + case "em": + case "i": + i = a.subParser("makeMarkdown.emphasis")(t, d); + break; + case "strong": + case "b": + i = a.subParser("makeMarkdown.strong")(t, d); + break; + case "del": + i = a.subParser("makeMarkdown.strikethrough")(t, d); + break; + case "a": + i = a.subParser("makeMarkdown.links")(t, d); + break; + case "img": + i = a.subParser("makeMarkdown.image")(t, d); + break; + default: + i = t.outerHTML + ` + +`; + } + return i; + }), a.subParser("makeMarkdown.paragraph", function(t, d) { + var s = ""; + if (t.hasChildNodes()) + for (var i = t.childNodes, c = i.length, m = 0; m < c; ++m) + s += a.subParser("makeMarkdown.node")(i[m], d); + return s = s.trim(), s; + }), a.subParser("makeMarkdown.pre", function(t, d) { + var s = t.getAttribute("prenum"); + return "
" + d.preList[s] + "
"; + }), a.subParser("makeMarkdown.strikethrough", function(t, d) { + var s = ""; + if (t.hasChildNodes()) { + s += "~~"; + for (var i = t.childNodes, c = i.length, m = 0; m < c; ++m) + s += a.subParser("makeMarkdown.node")(i[m], d); + s += "~~"; + } + return s; + }), a.subParser("makeMarkdown.strong", function(t, d) { + var s = ""; + if (t.hasChildNodes()) { + s += "**"; + for (var i = t.childNodes, c = i.length, m = 0; m < c; ++m) + s += a.subParser("makeMarkdown.node")(i[m], d); + s += "**"; + } + return s; + }), a.subParser("makeMarkdown.table", function(t, d) { + var s = "", i = [[], []], c = t.querySelectorAll("thead>tr>th"), m = t.querySelectorAll("tbody>tr"), h, C; + for (h = 0; h < c.length; ++h) { + var U = a.subParser("makeMarkdown.tableCell")(c[h], d), H = "---"; + if (c[h].hasAttribute("style")) { + var V = c[h].getAttribute("style").toLowerCase().replace(/\s/g, ""); + switch (V) { + case "text-align:left;": + H = ":---"; + break; + case "text-align:right;": + H = "---:"; + break; + case "text-align:center;": + H = ":---:"; + break; + } + } + i[0][h] = U.trim(), i[1][h] = H; + } + for (h = 0; h < m.length; ++h) { + var G = i.push([]) - 1, _ = m[h].getElementsByTagName("td"); + for (C = 0; C < c.length; ++C) { + var q = " "; + typeof _[C] < "u" && (q = a.subParser("makeMarkdown.tableCell")(_[C], d)), i[G].push(q); + } + } + var J = 3; + for (h = 0; h < i.length; ++h) + for (C = 0; C < i[h].length; ++C) { + var Z = i[h][C].length; + Z > J && (J = Z); + } + for (h = 0; h < i.length; ++h) { + for (C = 0; C < i[h].length; ++C) + h === 1 ? i[h][C].slice(-1) === ":" ? i[h][C] = a.helper.padEnd(i[h][C].slice(-1), J - 1, "-") + ":" : i[h][C] = a.helper.padEnd(i[h][C], J, "-") : i[h][C] = a.helper.padEnd(i[h][C], J); + s += "| " + i[h].join(" | ") + ` | +`; + } + return s.trim(); + }), a.subParser("makeMarkdown.tableCell", function(t, d) { + var s = ""; + if (!t.hasChildNodes()) + return ""; + for (var i = t.childNodes, c = i.length, m = 0; m < c; ++m) + s += a.subParser("makeMarkdown.node")(i[m], d, !0); + return s.trim(); + }), a.subParser("makeMarkdown.txt", function(t) { + var d = t.nodeValue; + return d = d.replace(/ +/g, " "), d = d.replace(/¨NBSP;/g, " "), d = a.helper.unescapeHTMLEntities(d), d = d.replace(/([*_~|`])/g, "\\$1"), d = d.replace(/^(\s*)>/g, "\\$1>"), d = d.replace(/^#/gm, "\\#"), d = d.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"), d = d.replace(/^( {0,3}\d+)\./gm, "$1\\."), d = d.replace(/^( {0,3})([+-])/gm, "$1\\$2"), d = d.replace(/]([\s]*)\(/g, "\\]$1\\("), d = d.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"), d; + }); + var D = this; + e.exports ? e.exports = a : D.showdown = a; + }).call(kn); +})(ms); +var Zo = ms.exports; +const $n = /* @__PURE__ */ Pn(Zo); +class En { + constructor() { + be(this, "logger"); + be(this, "converter"); + this.logger = Aa.zhiLog("showdown-adaptor"), this.converter = new $n.Converter(); + } + isAvailable() { + return typeof $n < "u"; + } + renderMarkdownStr(r) { + if (!this.isAvailable()) + throw new Error("Showdown is not available"); + return this.logger.info("Showdown is rendering md to HTML..."), Promise.resolve(this.converter.makeHtml(r)); + } +} +class gs { + constructor() { + be(this, "logger"); + be(this, "mdAdaptor", new En()); + this.logger = Aa.zhiLog("markdown-util"); + } + /** + * 获取当前 MD 解析器名称 + */ + getCurrentAdaptorName() { + return this.mdAdaptor instanceof bn ? "Lute" : this.mdAdaptor instanceof En ? "Showdown" : "None"; + } + /** + * 渲染Markdown + * + * @param md - Markdown文本 + */ + async renderHTML(r) { + const n = new bn(); + return this.logger.debug("Lute status =>", n.isAvailable()), n.isAvailable() && (this.mdAdaptor = n), this.logger.info(`Using ${this.getCurrentAdaptorName()} as markdown renderer`), await this.mdAdaptor.renderMarkdownStr(r); + } +} +class Yo { + constructor() { + be(this, "mdUtil"); + this.mdUtil = new gs(); + } + /** + * 移除标题数字 + * + * @param str - 字符串 + */ + removeTitleNumber(r) { + let n = r; + const a = /([0-9]*)\./; + return n = n.replace(a, ""), n; + } + /** + * 删除挂件的HTML + * + * @param str - 原字符 + */ + removeWidgetTag(r) { + let n = r.toString(); + const a = //g; + n = n.replace(a, ""); + const u = //g; + n = n.replace(u, ""); + const o = //g; + return n = n.replace(o, ""), n; + } + /** + * 删除Markdown文本的挂件的HTML + * + * @param str - 原字符 + */ + removeMdWidgetTag(r) { + let n = r.toString(); + return n = this.removeWidgetTag(n), n; + } + /** + * 去除html标签,残缺不全也可以 + * + * @param str - 字符串 + */ + filterHtml(r) { + r = r.replace(//g, ""), r = r.replace(//g, ""), r = r.replace(/<[^>]*>/g, ""), r = r.replace(/&.*;/g, ""), r = r.replace(/(^\s*)|(\s*$)/g, ""), r = r.replace(//g, ""), r = r.replace(/"/g, "").replace(/'/g, ""), r = r.replace(/\*/g, ""), r = r.replace(/\$/g, ""), r = r.replace(/\./g, ""), r = r.replace(/\+/g, ""), r = r.replace(/\s+/g, ""), r = r.replace(/[:|:]/g, "_"), r = r.replace(/[;|;]/g, "_"), r = r.replace(/\^/g, "_"), r = r.replace(/!/g, "_"), r = r.replace(/@/g, "at_"); + const n = ["\\d*/\\d/\\d*", "[、|\\\\]", "[,|,]", "\\d", "/", "-"]; + for (let a = 0; a < n.length; a++) { + const u = new RegExp(n[a], "g"); + r = r.replace(u, ""); + } + return r = r.toLowerCase(), r; + } + /** + * 截取指定长度html + * + * @param html - html + * @param length - 长度 + * @param ignore - 不要结尾省略号 + */ + parseHtml(r, n, a) { + const u = this.filterHtml(r); + return u.length < n ? u : a === !0 ? u.substring(0, n) : u.substring(0, n) + "..."; + } + /** + * 将Markdown转换为HTML + * + * @param md - Markdown + */ + async mdToHtml(r) { + const n = await this.mdUtil.renderHTML(r); + return this.removeWidgetTag(n); + } + /** + * 将Markdown转换为纯文本 + * + * @param md - Markdown + */ + async mdToPlainText(r) { + const n = await this.mdToHtml(r); + return this.filterHtml(n); + } + /** + * 移除H1标签 + * + * @param html - html + */ + removeH1(r) { + let n = r; + const a = //g; + return n = n.replace(a, ""), n; + } + /** + * 移除Markdown里面的H1标签 + * + * JavaScript 正则表达式可以用来删除所有 Markdown 中的 h1 标签。下面是一个示例代码: + * + * const str = "# This is an H1\n## This is an H2\n### This is an H3"; + * + * const regex = /^# .*$/gm; + * const result = str.replace(regex, ''); + * + * console.log(result); + * 在这个例子中,我们使用正则表达式 /^# .*$/gm 来匹配所有的 h1 标签。 + * 在 JavaScript 中,^ 匹配行首,# 匹配 # 字符,.* 匹配任意字符,$ 匹配行尾,m 标记表示多行模式。 + */ + removeMdH1(r) { + let n = r; + const a = /^# .*$/gm; + return n = n.replace(a, ""), n; + } +} +class Xo { + /** + * 检测是否是空对象 + * + * @param obj - 对象 + */ + isEmptyObject(r) { + return r ? Object.getPrototypeOf(r) === Object.prototype && Object.getOwnPropertyNames(r).length === 0 && Object.getOwnPropertySymbols(r).length === 0 : !0; + } +} +class Qo { + constructor() { + be(this, "dateUtil"); + be(this, "strUtil"); + be(this, "versionUtil"); + be(this, "htmlUtil"); + be(this, "markdownUtil"); + be(this, "jsonUtil"); + be(this, "objectUtil"); + this.dateUtil = new ko(), this.strUtil = new Po(), this.versionUtil = new jo(), this.htmlUtil = new Yo(), this.markdownUtil = new gs(), this.jsonUtil = new Eo(), this.objectUtil = new Xo(); + } +} +const xo = Qo; +export { + xo as ZhiCommon, + yt as ZhiUtil +}; diff --git a/public/libs/zhi-common/lib/IBlogApi.d.ts b/public/libs/zhi-common/lib/IBlogApi.d.ts new file mode 100644 index 0000000..a2e64fe --- /dev/null +++ b/public/libs/zhi-common/lib/IBlogApi.d.ts @@ -0,0 +1,139 @@ +import UserBlog from "./models/userBlog"; +import Post from "./models/post"; +import MediaObject from "./models/mediaObject"; +import CategoryInfo from "./models/categoryInfo"; +/** + * 通用博客接口 + * + * @public + * @author terwer + * @outline deep + * @version 1.0.0 + * @since 1.0.0 + */ +interface IBlogApi { + /** + * 博客配置列表 + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getUsersBlogs getUsersBlogs} + * @returns {Promise>} + */ + getUsersBlogs(): Promise>; + /** + * 最新文章数目 + * + * @param keyword - 关键字(可选,部分平台不支持搜索) + * @returns {Promise} + */ + getRecentPostsCount(keyword?: string): Promise; + /** + * 最新文章 + * + * @param numOfPosts - 文章数目 + * @param page - 页码(可选,从0开始,部分平台不支持分页) + * @param keyword - 关键字(可选,部分平台不支持搜索) + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getRecentPosts getRecentPosts} + * @returns {Promise>} + */ + getRecentPosts(numOfPosts: number, page?: number, keyword?: string): Promise>; + /** + * 发布文章 + * + * @param post - 文章 + * @param publish - 可选,是否发布 + * + * ```ts + * const post = { + * description: "自动发布的测试内容", + * title: "自动发布的测试标题", + * categories: ["标签1","标签2"], + * // dateCreated: new Date(), + * // link: "", + * // permalink: "", + * // postid: "", + * // source: { + * // name: "", + * // url: "" + * // }; + * // userid: "" + * } + * + * const result = newPost(post, false) + * ``` + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.newPost newPost} + * @returns {Promise} + */ + newPost(post: Post, publish?: boolean): Promise; + /** + * 文章详情 + * @param postid - postid + * @param useSlug - 是否使用的是别名(可选,部分平台不支持) + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getPost getPost} + * @returns {Promise} + */ + getPost(postid: string, useSlug?: boolean): Promise; + /** + * 更新文章 + * + * @param postid - 文章id + * @param post - 文章 + * @param publish - 可选,是否发布 + * + * ```ts + * // wordpress + * // const postid = 4115 + * // conf + * // const postid = 1540103 + * const postid = "2490384_1" + * const post = { + * description: "修改过的自动发布的测试内容2", + * title: "修改过的自动发布的测试标题2", + * categories: ["标签1", "标签2"], + * // dateCreated: new Date(), + * // link: "", + * // permalink: "", + * // postid: postid, + * // source: { + * // name: "", + * // url: "" + * // }; + * // userid: "" + * } + * + * const result = editPost(postid, post, false) + * ``` + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.editPost editPost} + * @returns {Promise} + */ + editPost(postid: string, post: Post, publish?: boolean): Promise; + /** + * 删除文章 + * + * @param postid - 文章ID + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.deletePost deletePost} + * @returns {Promise} + */ + deletePost(postid: string): Promise; + /** + * 获取分类列表 + * + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.getCategories getCategories} + * @returns {Promise} + */ + getCategories(): Promise; + /** + * 获取预览链接 + * + * @param postid - 文章ID + * @returns {Promise} + */ + getPreviewUrl(postid: string): Promise; + /** + * 上传附件 + * + * @param mediaObject + * @see {@link https://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.newMediaObject newMediaObject} + * @returns {Promise} + */ + newMediaObject(mediaObject: MediaObject): Promise; +} +export type { IBlogApi }; diff --git a/public/libs/zhi-common/lib/ZhiCommonUtil.d.ts b/public/libs/zhi-common/lib/ZhiCommonUtil.d.ts new file mode 100644 index 0000000..95d2016 --- /dev/null +++ b/public/libs/zhi-common/lib/ZhiCommonUtil.d.ts @@ -0,0 +1,13 @@ +import { Env } from "zhi-env"; +import ZhiUtil from "./ZhiUtil"; +/** + * Common 模块工具类 + * + * @author terwer + * @version 1.4.0 + * @since 1.4.0 + */ +declare class ZhiCommonUtil extends ZhiUtil { + static zhiEnv(): Env; +} +export default ZhiCommonUtil; diff --git a/public/libs/zhi-common/lib/ZhiUtil.d.ts b/public/libs/zhi-common/lib/ZhiUtil.d.ts new file mode 100644 index 0000000..f300deb --- /dev/null +++ b/public/libs/zhi-common/lib/ZhiUtil.d.ts @@ -0,0 +1,65 @@ +import { DefaultLogger } from "zhi-log"; +import { Env } from "zhi-env"; +import ZhiCommon from "./zhi-common"; +/** + * 工具类统一入口,每个应用自己实现,可继承 zhi-common 然后扩展 + * + * ``` + * zhiEnv 方法必须重写,zhiLog 方法可不用 + * ``` + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare abstract class ZhiUtil { + /** + * zhi-util 的运行时环境 + */ + protected static env: Env | undefined; + /** + * zhi-util 的日志器缓存 + */ + protected static loggerMap: { + [key: string]: DefaultLogger; + }; + /** + * zhi-util 的通用工具类 + */ + protected static common: ZhiCommon | undefined; + /** + * 某些情况下,可能需要手动 init 之后才能用 + */ + static initEnv(env: Env): void; + /** + * 获取 zhi-env 实例 - 必须在使用的时候重写此方法 + * + * ``` + * if (!this.env) { + * this.env = new Env(import.meta.env) + * } + * return this.env + * ``` + * + * @see {@link https://github.com/terwer/zhi/tree/main/apps/zhi-env#usage docs for zhi-env usage} + */ + static zhiEnv(): Env; + /** + * 获取 zhi-log 实例 + * + * @param sign - 标志 + * @param loggerName - 日志名称 + */ + static zhiLogWithSign(sign: string, loggerName: string): DefaultLogger; + /** + * 获取 zhi-log 实例 + * + * @param loggerName - 日志名称 + */ + static zhiLog(loggerName: string): DefaultLogger; + /** + * 获取 zhi-common 实例 + */ + static zhiCommon(): ZhiCommon; +} +export default ZhiUtil; diff --git a/public/libs/zhi-common/lib/blogApi.d.ts b/public/libs/zhi-common/lib/blogApi.d.ts new file mode 100644 index 0000000..9640fbd --- /dev/null +++ b/public/libs/zhi-common/lib/blogApi.d.ts @@ -0,0 +1,88 @@ +import UserBlog from "./models/userBlog"; +import Post from "./models/post"; +import CategoryInfo from "./models/categoryInfo"; +import MediaObject from "./models/mediaObject"; +import type { IBlogApi } from "./IBlogApi"; +/** + * 博客API + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare class BlogApi implements IBlogApi { + private readonly logger; + private readonly apiAdaptor; + /** + * 博客API版本号 + */ + readonly VERSION: string; + /** + * 初始化博客 API + * + * @param apiAdaptor - 对应博客的适配器,例如:SiYuanApiAdaptor + */ + constructor(apiAdaptor: IBlogApi); + /** + * 博客配置列表 + */ + getUsersBlogs(): Promise>; + /** + * 最新文章数目 + * + * @param keyword - 关键字(可选,部分平台不支持搜索) + */ + getRecentPostsCount(keyword?: string): Promise; + /** + * 最新文章 + * + * @param numOfPosts - 文章数目 + * @param page - 页码(可选,从0开始,部分平台不支持分页) + * @param keyword - 关键字(可选,部分平台不支持搜索) + */ + getRecentPosts(numOfPosts: number, page?: number, keyword?: string): Promise>; + /** + * 发布文章 + * + * @param post - 文章 + * @param publish - 可选,是否发布 + */ + newPost(post: Post, publish?: boolean): Promise; + /** + * 文章详情 + * @param postid - postid + * @param useSlug - 是否使用的是别名(可选,部分平台不支持) + */ + getPost(postid: string, useSlug?: boolean): Promise; + /** + * 更新文章 + * + * @param postid - 文章id + * @param post - 文章 + * @param publish - 可选,是否发布 + */ + editPost(postid: string, post: Post, publish?: boolean): Promise; + /** + * 删除文章 + * + * @param postid - 文章ID + */ + deletePost(postid: string): Promise; + /** + * 获取分类列表 + */ + getCategories(): Promise; + /** + * 获取预览链接 + * + * @param postid - 文章ID + */ + getPreviewUrl(postid: string): Promise; + /** + * 上传附件 + * + * @param mediaObject + */ + newMediaObject(mediaObject: MediaObject): Promise; +} +export default BlogApi; diff --git a/public/libs/zhi-common/lib/blogConfig.d.ts b/public/libs/zhi-common/lib/blogConfig.d.ts new file mode 100644 index 0000000..d01adfc --- /dev/null +++ b/public/libs/zhi-common/lib/blogConfig.d.ts @@ -0,0 +1,98 @@ +import BlogPlaceholder from "./blogPlaceholder"; +/** + * 页面类型 + */ +export declare enum PageType { + /** + * Markdown正文 + */ + Markdown = 0, + /** + * HTML + */ + Html = 1, + /** + * 属性 + */ + Formatter = 2, + /** + * Markdown和属性 + */ + Markdown_And_Formatter = 3, + /** + * MDX + * + * @see {@link https://mdxjs.com/ mdx} + */ + MDX = 4 +} +/** + * 密码类型 + */ +export declare enum PasswordType { + /** + * 密码 + */ + PasswordType_Password = 0, + /** + * token + */ + PasswordType_Token = 1 +} +/** + * 博客通用配置类 + */ +declare abstract class BlogConfig { + /** + * 首页 + */ + protected home: string; + /** + * API地址 + */ + protected apiUrl: string; + /** + * 用户名 + */ + protected username: string; + /** + * 密码类型 + */ + protected passwordType: PasswordType; + /** + * 密码 + */ + protected password: string; + /** + * 是否发布 + */ + protected apiStatus: boolean; + /** + * 博客名(API获取) + */ + protected blogName: string; + /** + * 文章别名key + */ + protected posidKey: string; + /** + * 文章预览链接 + */ + protected previewUrl: string; + /** + * 文章类型 + */ + protected pageType: PageType; + /** + * 操作提示 + */ + protected placeholder: BlogPlaceholder | undefined; + /** + * 是否处理标题 + * + * @protected + */ + protected fixTitle: boolean; + protected constructor(); +} +export default BlogConfig; diff --git a/public/libs/zhi-common/lib/blogConstants.d.ts b/public/libs/zhi-common/lib/blogConstants.d.ts new file mode 100644 index 0000000..1ef63fa --- /dev/null +++ b/public/libs/zhi-common/lib/blogConstants.d.ts @@ -0,0 +1,14 @@ +/** + * 博客通用常量定义 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class BlogConstants { + /** + * 博客类型 + */ + static DEFAULT_BLOG_TYPE_KEY: string; +} +export default BlogConstants; diff --git a/public/libs/zhi-common/lib/blogPlaceholder.d.ts b/public/libs/zhi-common/lib/blogPlaceholder.d.ts new file mode 100644 index 0000000..7b9e314 --- /dev/null +++ b/public/libs/zhi-common/lib/blogPlaceholder.d.ts @@ -0,0 +1,50 @@ +/** + * 配置提示 + * + * @author terwer + * @since 1.0.0 + */ +declare abstract class BlogPlaceholder { + /** + * 首页操作提示 + */ + protected homePlaceholder: string; + /** + * API 地址操作提示 + */ + protected apiUrlPlaceholder: string; + /** + * 用户名操作提示 + */ + protected usernamePlaceholder: string; + /** + * 密码类型操作提示 + */ + protected passwordTypePlaceholder: string; + /** + * 密码操作提示 + */ + protected passwordPlaceholder: string; + /** + * API状态是否正常操作提示 + */ + protected apiStatusPlaceholder: boolean; + /** + * 博客名(API获取)操作提示 + */ + protected blogNamePlaceholder: string; + /** + * 文章别名key操作提示 + */ + protected posidKeyPlaceholder: string; + /** + * 文章预览链接操作提示 + */ + protected previewUrlPlaceholder: string; + /** + * 文章类型操作提示 + */ + protected pageTypePlaceholder: string; + constructor(); +} +export default BlogPlaceholder; diff --git a/public/libs/zhi-common/lib/dateUtil.d.ts b/public/libs/zhi-common/lib/dateUtil.d.ts new file mode 100644 index 0000000..9c3ded5 --- /dev/null +++ b/public/libs/zhi-common/lib/dateUtil.d.ts @@ -0,0 +1,60 @@ +/** + * 时间处理工具类 + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare class DateUtil { + private readonly TIME_SPLIT; + /** + * 给日期添加小时 + * + * @param date - Date + * @param numOfHours - 数字 + * @author terwer + * @since 1.0.0 + */ + private addHoursToDate; + /** + * 转换ISO日期为中文日期的通用转换方法 + * + * @param str - '2022-07-18T06:25:48.000Z + * @param isAddTimeZone - 是否增加时区(默认不增加) + * @param isShort - 是否只返回日期 + * @author terwer + * @since 1.0.0 + */ + private formatIsoToZhDateFormat; + /** + * 转换ISO日期为中文完整时间 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZh(str: string): string; + /** + * 转换ISO日期为中文日期 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZhDate(str: string): string; + /** + * 转换ISO日期为中文时间 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZhTime(str: string): string; + /** + * 当前日期时间完整格式,格式:2023-03-10 02:03:43 + */ + nowZh(): string; + /** + * 当前日期,格式:2023-03-10 + */ + nowDateZh(): string; + /** + * 当前时间,格式:02:03:43 + */ + nowTimeZh(): string; +} +export default DateUtil; diff --git a/public/libs/zhi-common/lib/enums/blogTypeEnum.d.ts b/public/libs/zhi-common/lib/enums/blogTypeEnum.d.ts new file mode 100644 index 0000000..50f7fca --- /dev/null +++ b/public/libs/zhi-common/lib/enums/blogTypeEnum.d.ts @@ -0,0 +1,22 @@ +/** + * 博客类型枚举 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare enum BlogTypeEnum { + /** + * 思源笔记 + */ + BlogTypeEnum_Siyuan = "siyuan", + /** + * Metaweblog + */ + BlogTypeEnum_Metaweblog = "metaweblog", + /** + * WordPress + */ + BlogTypeEnum_Wordpress = "wordpress" +} +export default BlogTypeEnum; diff --git a/public/libs/zhi-common/lib/enums/postStatusEnum.d.ts b/public/libs/zhi-common/lib/enums/postStatusEnum.d.ts new file mode 100644 index 0000000..e027b6d --- /dev/null +++ b/public/libs/zhi-common/lib/enums/postStatusEnum.d.ts @@ -0,0 +1,18 @@ +/** + * 文章状态枚举 + */ +declare enum PostStatusEnum { + /** + * 已发布 + */ + PostStatusEnum_Publish = "publish", + /** + * 草稿 + */ + PostStatusEnum_Draft = "draft", + /** + * 继承 + */ + PostStatusEnum_Inherit = "inherit" +} +export default PostStatusEnum; diff --git a/public/libs/zhi-common/lib/htmlUtil.d.ts b/public/libs/zhi-common/lib/htmlUtil.d.ts new file mode 100644 index 0000000..178d08e --- /dev/null +++ b/public/libs/zhi-common/lib/htmlUtil.d.ts @@ -0,0 +1,73 @@ +/** + * HTML 处理工具类 + */ +declare class HtmlUtil { + private readonly mdUtil; + constructor(); + /** + * 移除标题数字 + * + * @param str - 字符串 + */ + removeTitleNumber(str: string): string; + /** + * 删除挂件的HTML + * + * @param str - 原字符 + */ + removeWidgetTag(str: string): string; + /** + * 删除Markdown文本的挂件的HTML + * + * @param str - 原字符 + */ + removeMdWidgetTag(str: string): string; + /** + * 去除html标签,残缺不全也可以 + * + * @param str - 字符串 + */ + filterHtml(str: string): string; + /** + * 截取指定长度html + * + * @param html - html + * @param length - 长度 + * @param ignore - 不要结尾省略号 + */ + parseHtml(html: string, length: number, ignore?: boolean): string; + /** + * 将Markdown转换为HTML + * + * @param md - Markdown + */ + mdToHtml(md: string): Promise; + /** + * 将Markdown转换为纯文本 + * + * @param md - Markdown + */ + mdToPlainText(md: string): Promise; + /** + * 移除H1标签 + * + * @param html - html + */ + removeH1(html: string): string; + /** + * 移除Markdown里面的H1标签 + * + * JavaScript 正则表达式可以用来删除所有 Markdown 中的 h1 标签。下面是一个示例代码: + * + * const str = "# This is an H1\n## This is an H2\n### This is an H3"; + * + * const regex = /^# .*$/gm; + * const result = str.replace(regex, ''); + * + * console.log(result); + * 在这个例子中,我们使用正则表达式 /^# .*$/gm 来匹配所有的 h1 标签。 + * 在 JavaScript 中,^ 匹配行首,# 匹配 # 字符,.* 匹配任意字符,$ 匹配行尾,m 标记表示多行模式。 + */ + removeMdH1(md: string): string; +} +export default HtmlUtil; diff --git a/public/libs/zhi-common/lib/jsonUtil.d.ts b/public/libs/zhi-common/lib/jsonUtil.d.ts new file mode 100644 index 0000000..8359802 --- /dev/null +++ b/public/libs/zhi-common/lib/jsonUtil.d.ts @@ -0,0 +1,21 @@ +import { JSONSchemaType } from "ajv"; +/** + * 校验 JSON schema + * + * @author terwer + * @version 1.5.0 + * @since 1.5.0 + */ +declare class JsonUtil { + private ajv; + constructor(); + validateJson(schema: JSONSchemaType, data: T): { + valid: boolean; + error?: string; + }; + validateObjectSchema(schemaObject: object, dataObject: object): { + valid: boolean; + error?: string; + }; +} +export default JsonUtil; diff --git a/public/libs/zhi-common/lib/markdownUtil.d.ts b/public/libs/zhi-common/lib/markdownUtil.d.ts new file mode 100644 index 0000000..0152d5c --- /dev/null +++ b/public/libs/zhi-common/lib/markdownUtil.d.ts @@ -0,0 +1,23 @@ +/** + * Markdown 处理工具类 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class MarkdownUtil { + private readonly logger; + private mdAdaptor; + constructor(); + /** + * 获取当前 MD 解析器名称 + */ + private getCurrentAdaptorName; + /** + * 渲染Markdown + * + * @param md - Markdown文本 + */ + renderHTML(md: string): Promise; +} +export default MarkdownUtil; diff --git a/public/libs/zhi-common/lib/md-adaptor/LuteAdaptor.d.ts b/public/libs/zhi-common/lib/md-adaptor/LuteAdaptor.d.ts new file mode 100644 index 0000000..405ee58 --- /dev/null +++ b/public/libs/zhi-common/lib/md-adaptor/LuteAdaptor.d.ts @@ -0,0 +1,60 @@ +import MarkdownAdaptor from "./MarkdownAdaptor"; +/** + * Lute 适配器 + * + * 引用 lute 库的方法 + * + * 1 dev/prod 环境 + * 在 index.html 直接引用 + * + * 2 test 环境 + * 在 setup.ts 引用 require("../public/lib/lute/lute.min.js") + * + * 3 es 环境(不推荐) + * + * ``` + * // https://stackoverflow.com/a/73702082/4037224 + * const require = createRequire(import.meta.url) + * global.require = require //this will make require at the global scobe and treat it like the original require + * require("./lute.min.cjs") + * ``` + * + * 更好的方法 + * + * ``` + * import Module from "node:module" + * + * const require = Module.createRequire(import.meta.url) + * require("./lute.min.cjs") + * ``` + * + * 2023-04-09 - lute version 2.7.5 - update at April 9, 2023 09:32 + * + * 4 Nuxt3 环境 + * 参考:https://github.com/88250/lute/issues/191 + * + * @see {@link https://github.com/88250/lute/tree/master/javascript lute} + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class LuteAdaptor implements MarkdownAdaptor { + private readonly logger; + constructor(); + isAvailable(): boolean; + /** + * 高亮关键字 + * + * @param str - 字符串 + * @private + */ + private highlightWords; + /** + * 渲染Markdown + * + * @param md - Markdown + */ + renderMarkdownStr(md: string): Promise; +} +export default LuteAdaptor; diff --git a/public/libs/zhi-common/lib/md-adaptor/MarkdownAdaptor.d.ts b/public/libs/zhi-common/lib/md-adaptor/MarkdownAdaptor.d.ts new file mode 100644 index 0000000..df5e5bf --- /dev/null +++ b/public/libs/zhi-common/lib/md-adaptor/MarkdownAdaptor.d.ts @@ -0,0 +1,20 @@ +/** + * Markdown适配器接口 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +interface MarkdownAdaptor { + /** + * 是否可用 + */ + isAvailable(): boolean; + /** + * 渲染MD + * + * @param md - Markdown + */ + renderMarkdownStr(md: string): Promise; +} +export default MarkdownAdaptor; diff --git a/public/libs/zhi-common/lib/md-adaptor/ShowdownAdaptor.d.ts b/public/libs/zhi-common/lib/md-adaptor/ShowdownAdaptor.d.ts new file mode 100644 index 0000000..5203c1c --- /dev/null +++ b/public/libs/zhi-common/lib/md-adaptor/ShowdownAdaptor.d.ts @@ -0,0 +1,16 @@ +import MarkdownAdaptor from "./MarkdownAdaptor"; +/** + * showdown 适配器 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class ShowdownAdaptor implements MarkdownAdaptor { + private readonly logger; + private readonly converter; + constructor(); + isAvailable(): boolean; + renderMarkdownStr(md: string): Promise; +} +export default ShowdownAdaptor; diff --git a/public/libs/zhi-common/lib/models/categoryInfo.d.ts b/public/libs/zhi-common/lib/models/categoryInfo.d.ts new file mode 100644 index 0000000..5b25f12 --- /dev/null +++ b/public/libs/zhi-common/lib/models/categoryInfo.d.ts @@ -0,0 +1,39 @@ +/** + * 通用分类模型定义 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class CategoryInfo { + /** + * 分类ID + */ + categoryId: string; + /** + * 父分类ID + */ + parentId: string; + /** + * 分类名称 + */ + description: string; + /** + * 分类英文名 + */ + categoryName: string; + /** + * 分类详情 + */ + categoryDescription: string; + /** + * 分类地址 + */ + htmlUrl: string; + /** + * 分类订阅地址 + */ + rssUrl: string; + constructor(); +} +export default CategoryInfo; diff --git a/public/libs/zhi-common/lib/models/mediaObject.d.ts b/public/libs/zhi-common/lib/models/mediaObject.d.ts new file mode 100644 index 0000000..cbb47a5 --- /dev/null +++ b/public/libs/zhi-common/lib/models/mediaObject.d.ts @@ -0,0 +1,42 @@ +/// +/** + * 媒体文件 + * + * ```ts + * const url = "./testdata/photo.jpg"; + * const file = fs.readFileSync(url) + * const data = { + * name: "20220616-132401-001.jpg", + * type: "image/jpeg", + * bits: file, + * overwrite: true + * } + * + * // return + * { + * attachment_id: '4108', + * date_created_gmt: 2022-06-15T21:25:23.000Z, + * parent: 0, + * link: 'https://terwergreen.files.wordpress.com/2022/06/20220616-132401-001.jpg', + * title: '20220616-132401-001.jpg', + * caption: '', + * description: '', + * metadata: { filesize: 113032 }, + * type: 'image/jpeg', + * thumbnail: 'https://terwergreen.files.wordpress.com/2022/06/20220616-132401-001.jpg?w=150', + * id: '4108', + * file: '20220616-132401-001.jpg', + * url: 'http://terwergreen.files.wordpress.com/2022/06/20220616-132401-001.jpg' + * } + * ``` + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class MediaObject { + name: string; + type: string; + bits: Buffer; + constructor(name: string, type: string, bits: Buffer); +} +export default MediaObject; diff --git a/public/libs/zhi-common/lib/models/post.d.ts b/public/libs/zhi-common/lib/models/post.d.ts new file mode 100644 index 0000000..56c673d --- /dev/null +++ b/public/libs/zhi-common/lib/models/post.d.ts @@ -0,0 +1,70 @@ +import PostStatusEnum from "../enums/postStatusEnum"; +/** + * 通用文章模型定义 + * + * @public + */ +declare class Post { + /** + * 文章ID + */ + postid: string; + /** + * 标题 + */ + title: string; + /** + * 逗号分隔的标签 + */ + mt_keywords: string; + /** + * 链接 + */ + link?: string; + /** + * 永久链接 + */ + permalink: string; + /** + * 摘要 + */ + shortDesc?: string; + /** + * 描述 + */ + description: string; + /** + * 短评 + */ + mt_excerpt?: string; + /** + * 别名 + */ + wp_slug: string; + /** + * 创建时间 + */ + dateCreated: Date; + /** + * 分类 + */ + categories: Array; + /** + * 更多 + */ + mt_text_more?: string; + /** + * 发布状态 + */ + post_status?: PostStatusEnum; + /** + * 是否发布 + */ + isPublished: boolean; + /** + * 发布密码 + */ + wp_password: string; + constructor(); +} +export default Post; diff --git a/public/libs/zhi-common/lib/models/siteConfig.d.ts b/public/libs/zhi-common/lib/models/siteConfig.d.ts new file mode 100644 index 0000000..6132eaa --- /dev/null +++ b/public/libs/zhi-common/lib/models/siteConfig.d.ts @@ -0,0 +1,44 @@ +import UserBlog from "./userBlog"; +/** + * 站点信息定义 + */ +declare class SiteConfig { + /** + * 博客信息 + */ + userBlog: UserBlog; + /** + * 域名 + */ + domain: string; + /** + * 站点链接 + */ + weburl: string; + /** + * 站点主题 + */ + webtheme: string; + /** + * 站点名称 + */ + webname: string; + /** + * 站点口号 + */ + webslogen: string; + /** + * 关键字 + */ + keywords: string; + /** + * 描述 + */ + description: string; + /** + * 备案信息 + */ + beianinfo: string; + constructor(); +} +export default SiteConfig; diff --git a/public/libs/zhi-common/lib/models/userBlog.d.ts b/public/libs/zhi-common/lib/models/userBlog.d.ts new file mode 100644 index 0000000..7929c6e --- /dev/null +++ b/public/libs/zhi-common/lib/models/userBlog.d.ts @@ -0,0 +1,29 @@ +/** + * 博客信息定义 + * + * @public + */ +declare class UserBlog { + /** + * 博客ID + */ + blogid: string; + /** + * 博客地址 + */ + url: string; + /** + * 博客名称 + */ + blogName: string; + /** + * 是否是管理员 + */ + isAdmin?: boolean; + /** + * xmlrpc地址 + */ + xmlrpc?: string; + constructor(); +} +export default UserBlog; diff --git a/public/libs/zhi-common/lib/objectUtil.d.ts b/public/libs/zhi-common/lib/objectUtil.d.ts new file mode 100644 index 0000000..ba76433 --- /dev/null +++ b/public/libs/zhi-common/lib/objectUtil.d.ts @@ -0,0 +1,16 @@ +/** + * Object 工具类 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class ObjectUtil { + /** + * 检测是否是空对象 + * + * @param obj - 对象 + */ + isEmptyObject(obj: any): boolean; +} +export default ObjectUtil; diff --git a/public/libs/zhi-common/lib/strUtil.d.ts b/public/libs/zhi-common/lib/strUtil.d.ts new file mode 100644 index 0000000..4d21855 --- /dev/null +++ b/public/libs/zhi-common/lib/strUtil.d.ts @@ -0,0 +1,59 @@ +/** + * 字符串工具类 + * + * @public + * @author terwer + * @since 0.0.1 + */ +declare class StrUtil { + /** + * 格式化字符串 + * + * @param str - 字符串,可用占位符,例如:test \{0\} str + * @param args - 按占位符顺序排列的参数 + * @author terwer + * @since 0.0.1 + */ + f(str: string, ...args: (string | number | boolean | object)[]): string; + /** + * 字符串拼接 + * + * @param str - 字符串数组 + */ + appendStr(...str: string[]): string; + /** + * 判断字符串中,是否包含数组中任何一个元素 + * + * @param str - 字符串 + * @param arr - 字符串数组 + */ + includeInArray(str: string, arr: string[]): boolean; + /** + * 截取指定长度的字符串 + * + * @param str - str + * @param length - 长度 + * @param ignore - 不要结尾省略号 + */ + getByLength(str: string, length: number, ignore?: boolean): string; + /** + * 字符串空值检测 + * + * @param str - 待检测的字符串 + */ + isEmptyString(str: any): boolean; + /** + * 路径组合,解决多出来/的问题 + * + * @param path1 - 路径1 + * @param path2 - 路径2 + */ + pathJoin(path1: string, path2: string): string; + /** + * 强转boolean + * + * @param val - val + */ + parseBoolean(val: any): boolean; +} +export default StrUtil; diff --git a/public/libs/zhi-common/lib/utils/ZhiBlogApiUtil.d.ts b/public/libs/zhi-common/lib/utils/ZhiBlogApiUtil.d.ts new file mode 100644 index 0000000..f628170 --- /dev/null +++ b/public/libs/zhi-common/lib/utils/ZhiBlogApiUtil.d.ts @@ -0,0 +1,13 @@ +import { ZhiUtil } from "zhi-common"; +import { Env } from "zhi-env"; +/** + * 工具类统一入口,每个应用自己实现 + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare class ZhiBlogApiUtil extends ZhiUtil { + static zhiEnv(): Env; +} +export default ZhiBlogApiUtil; diff --git a/public/libs/zhi-common/lib/versionUtil.d.ts b/public/libs/zhi-common/lib/versionUtil.d.ts new file mode 100644 index 0000000..680eae3 --- /dev/null +++ b/public/libs/zhi-common/lib/versionUtil.d.ts @@ -0,0 +1,37 @@ +/** + * 版本号比较 + * + * @public + * @author terwer + * @since 1.0.2 + */ +declare class VersionUtil { + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is higher than v2 + */ + greater(v1: string, v2: string): boolean; + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is equal to v2 + */ + equal(v1: string, v2: string): boolean; + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is lesser than v2 + */ + lesser(v1: string, v2: string): boolean; +} +export default VersionUtil; diff --git a/public/libs/zhi-common/lib/zhi-blog-api.d.ts b/public/libs/zhi-common/lib/zhi-blog-api.d.ts new file mode 100644 index 0000000..556625c --- /dev/null +++ b/public/libs/zhi-common/lib/zhi-blog-api.d.ts @@ -0,0 +1,2 @@ +import BlogApi from "./blogApi"; +export default BlogApi; diff --git a/public/libs/zhi-common/lib/zhi-common.d.ts b/public/libs/zhi-common/lib/zhi-common.d.ts new file mode 100644 index 0000000..0280738 --- /dev/null +++ b/public/libs/zhi-common/lib/zhi-common.d.ts @@ -0,0 +1,25 @@ +import JsonUtil from "./jsonUtil"; +import DateUtil from "./dateUtil"; +import StrUtil from "./strUtil"; +import VersionUtil from "./versionUtil"; +import HtmlUtil from "./htmlUtil"; +import MarkdownUtil from "./markdownUtil"; +import ObjectUtil from "./objectUtil"; +/** + * 平台无关的通用工具类 + * + * @author terwer + * @version 1.4.0 + * @since 1.3.0 + */ +declare class ZhiCommon { + readonly dateUtil: DateUtil; + readonly strUtil: StrUtil; + readonly versionUtil: VersionUtil; + readonly htmlUtil: HtmlUtil; + readonly markdownUtil: MarkdownUtil; + readonly jsonUtil: JsonUtil; + readonly objectUtil: ObjectUtil; + constructor(); +} +export default ZhiCommon; diff --git a/public/libs/zhi-common/package.json b/public/libs/zhi-common/package.json new file mode 100644 index 0000000..1376068 --- /dev/null +++ b/public/libs/zhi-common/package.json @@ -0,0 +1,41 @@ +{ + "name": "zhi-common", + "version": "1.5.3", + "type": "module", + "description": "a collection of util tools", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "repository": "terwer/zhi", + "homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-common", + "author": "terwer", + "license": "GPL", + "files": [ + "dist", + "README.md" + ], + "keywords": [ + "zhi", + "lib" + ], + "scripts": { + "serve": "vite", + "dev": "vite build --watch", + "build": "vite build", + "start": "vite preview", + "test": "vitest --watch" + }, + "devDependencies": { + "@terwer/eslint-config-custom": "workspace:*", + "@terwer/tsconfig": "workspace:*", + "@terwer/vite-config-custom": "workspace:*", + "@types/showdown": "^2.0.1" + }, + "dependencies": { + "ajv": "^8.12.0", + "compare-versions": "5.0.3", + "showdown": "^2.1.0", + "zhi-device": "workspace:*", + "zhi-env": "workspace:*", + "zhi-log": "workspace:*" + } +} diff --git a/public/libs/zhi-device/README.md b/public/libs/zhi-device/README.md new file mode 100644 index 0000000..4819366 --- /dev/null +++ b/public/libs/zhi-device/README.md @@ -0,0 +1,62 @@ +# zhi-device + +auto check environment whether in browser, browser extension, electron, node and more + +## Usage + +```ts +import { DeviceDetection, BrowserUtil, DeviceTypeEnum } from "zhi-device" + +console.log("isInBrowser=>", BrowserUtil.isInBrowser) + +const deviceType: DeviceTypeEnum = DeviceDetection.getDevice() +console.log("deviceType=>", deviceType) + +// supported platforms +// Mobile +// Siyuan_Widget +// Siyuan_NewWindow +// Siyuan_MainWindow +// Chrome_Extension +// Chrome_Browser +// Node +``` + +## Deps + +``` +## Congregations! zhi-device need no deps, it is just pure js code 🎉 +``` + +## Dev + +```bash +pnpm dev -F zhi-device +``` + +## Build + +```bash +pnpm build -F zhi-device +``` + +## Api + +```bash +pnpm doc -F zhi-device +pnpm md -F zhi-device +``` + +## Test + +Execute the unit tests via [vitest](https://vitest.dev) + +```bash +pnpm test -F zhi-device +``` + +## Publish + +```bash +pnpm publish -F zhi-device --tag=latest +``` \ No newline at end of file diff --git a/public/libs/zhi-device/deviceDetection.d.ts b/public/libs/zhi-device/deviceDetection.d.ts new file mode 100644 index 0000000..e19e5b2 --- /dev/null +++ b/public/libs/zhi-device/deviceDetection.d.ts @@ -0,0 +1,21 @@ +import DeviceTypeEnum from "./lib/deviceTypeEnum"; +/** + * 设备检测 + * + * @public + * @author terwer + * @version 0.1.0 + * @since 0.1.0 + */ +declare class DeviceDetection { + /** + * 获取当前设备 + */ + static getDevice(): DeviceTypeEnum; + /** + * 检测移动端 + * @private + */ + private static detectMobileDevice; +} +export default DeviceDetection; diff --git a/public/libs/zhi-device/index.d.ts b/public/libs/zhi-device/index.d.ts new file mode 100644 index 0000000..fe5b18d --- /dev/null +++ b/public/libs/zhi-device/index.d.ts @@ -0,0 +1,11 @@ +import DeviceDetection from "./deviceDetection"; +import DeviceTypeEnum from "./lib/deviceTypeEnum"; +import BasePathTypeEnum from "./lib/basePathTypeEnum"; +import BrowserUtil from "./lib/browserUtil"; +import SiyuanDevice from "./lib/siyuanDevice"; +/** + * zhi-device 入口 + */ +export { DeviceDetection }; +export { BrowserUtil, SiyuanDevice }; +export { DeviceTypeEnum, BasePathTypeEnum }; diff --git a/public/libs/zhi-device/index.js b/public/libs/zhi-device/index.js new file mode 100644 index 0000000..32f33b8 --- /dev/null +++ b/public/libs/zhi-device/index.js @@ -0,0 +1,430 @@ +var g = Object.defineProperty; +var P = (a, e, t) => e in a ? g(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t; +var r = (a, e, t) => (P(a, typeof e != "symbol" ? e + "" : e, t), t); +const u = class { + /** + * 检测是否运行在Chrome插件中 + */ + static isInChromeExtension() { + return u.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; + } +}; +let i = u; +/** + * 是否在浏览器环境 + */ +r(i, "isNode", typeof process < "u"), /** + * 是否在浏览器环境 + */ +r(i, "isInBrowser", typeof window < "u"), /** + * 浏览器路径分隔符 + */ +r(i, "BrowserSeperator", "/"), /** + * 是否是Electron环境 + */ +r(i, "isElectron", () => !u.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** + * 是否有Node环境,目前包括 Electron 和 Node + */ +r(i, "hasNodeEnv", () => u.isElectron() || u.isNode), /** + * 获取url参数 + * + * @param sParam - 参数 + */ +r(i, "getQueryString", (e) => { + if (!u.isInBrowser) + return ""; + const n = window.location.search.substring(1).split("&"); + for (let s = 0; s < n.length; s++) { + const c = n[s].split("="); + if (c[0] === e) + return c[1]; + } + return ""; +}), /** + * 替换 URL 的参数 + * 思路: + * 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 + * + * 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 + * + * 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 + * + * 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 + * + * 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 + * + * @param url - 链接地址 + * @param paramName - 参数名 + * @param paramValue - 参数值 + */ +r(i, "replaceUrlParam", (e, t, n) => { + n == null && (n = ""); + const s = new RegExp("\\b(" + t + "=).*?(&|#|$)"); + if (e.search(s) >= 0) + return e.replace(s, "$1" + n + "$2"); + const [c, d] = e.split("#"), [y, b] = c.split("?"), l = new URLSearchParams(b); + l.set(t, n); + const m = l.toString(), f = y + (m ? "?" + m : ""); + return d ? f + "#" + d : f; +}), /** + * 设置url参数 + * + * @param urlstring - url + * @param key - key + * @param value - value + */ +r(i, "setUrlParameter", (e, t, n) => { + if (e.includes(t)) + return u.replaceUrlParam(e, t, n); + const s = e.split("#"); + let c = s[0]; + const d = s[1]; + return c.includes("?") ? c += `&${t}=${n}` : c += `?${t}=${n}`, d && (c += "#" + d), c; +}), /** + * 重新加载指定tab + * + * @param tabname - tabname + * @param t - 延迟时间 + */ +r(i, "reloadTabPage", (e, t = 200) => { + setTimeout(function() { + if (u.isInBrowser) { + const n = window.location.href; + window.location.href = u.setUrlParameter(n, "tab", e); + } + }, t); +}), /** + * 刷新当前tab页面 + */ +r(i, "reloadPage", () => { + setTimeout(function() { + u.isInBrowser && window.location.reload(); + }, 200); +}), /** + * 刷新当前tab页面 + * + * @param msg - 消息提示 + * @param cb - 回调 + */ +r(i, "reloadPageWithMessageCallback", (e, t) => { + t && t(e), setTimeout(function() { + u.isInBrowser && window.location.reload(); + }, 200); +}); +var o = /* @__PURE__ */ ((a) => (a.BasePathType_Appearance = "Appearance", a.BasePathType_Data = "Data", a.BasePathType_Themes = "Themes", a.BasePathType_ZhiTheme = "ZhiTheme", a.BasePathType_None = "None", a))(o || {}); +const h = class { + /** + * 检测是否运行在思源打开的浏览器中 + */ + static isInSiyuanBrowser() { + return i.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; + } + /** + * 思源笔记 window 对象 + */ + static siyuanWindow() { + let e; + return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; + } + // ========================= + // require end + // ========================= + // ========================= + // import start + // ========================= + /** + * 引入json + * + * @param jsPath - js相对路径全路径 + * @param type - 类型 + */ + static async importJs(e, t) { + let n = e; + switch (t) { + case o.BasePathType_Appearance: + n = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); + break; + case o.BasePathType_Data: + n = this.browserJoinPath(this.siyuanDataRelativePath(), e); + break; + case o.BasePathType_Themes: + n = this.browserJoinPath(this.siyuanThemeRelativePath(), e); + break; + case o.BasePathType_ZhiTheme: + n = this.browserJoinPath(this.zhiThemeRelativePath(), e); + break; + default: + throw new Error("type must be provided"); + } + const { default: s } = await import( + /* @vite-ignore */ + n + ); + return s; + } + /** + * 引入json + * + * @param jsonPath - json相对路径全路径 + * @param type - 类型 + */ + // public static async importJson(jsonPath: string, type: BasePathTypeEnum) { + // let fullJsonPath = jsonPath + // switch (type) { + // case BasePathTypeEnum.BasePathType_Appearance: + // fullJsonPath = this.browserJoinPath(this.siyuanAppearanceRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Data: + // fullJsonPath = this.browserJoinPath(this.siyuanDataRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Themes: + // fullJsonPath = this.browserJoinPath(this.siyuanThemeRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_ZhiTheme: + // fullJsonPath = this.browserJoinPath(this.zhiThemeRelativePath(), jsonPath) + // break + // default: + // throw new Error("type must be provided") + // } + // + // const { default: data } = await import(/* @vite-ignore */ fullJsonPath, { assert: { type: "json" } }) + // return data + // } + /** + * 引入 json - 以 data 为基本路径 + * + * @param jsonPath - 相对于 data 的相对路径 + */ + // public static async importDataJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Data) + // } + /** + * 引入 json - 以 appearance 为基本路径 + * + * @param jsonPath - 相对于 appearance 的相对路径 + */ + // public static async importAppearanceJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Appearance) + // } + /** + * 引入 json - 以 themes 为基本路径 + * + * @param jsonPath - 相对于 themes 的相对路径 + */ + // public static async importThemesJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Themes) + // } + /** + * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 + * + * @param jsonPath - 相对于 zhi 主题根路径的相对路径 + */ + // public static async importZhiThemeJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_ZhiTheme) + // } + /** + * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 + * + * @param jsPath - 相对于 zhi 主题根路径的相对路径 + */ + static async importZhiThemeJs(e) { + return await this.importJs(e, o.BasePathType_ZhiTheme); + } + // ========================= + // import start + // ========================= + /** + * 路径拼接 + * + * @param paths - 路径数组 + */ + static joinPath(...e) { + if (i.hasNodeEnv()) { + const t = this.requireLib("path"); + if (t) + return t.join(...e); + } + return this.browserJoinPath(...e); + } + static browserJoinPath(...e) { + return e.join(i.BrowserSeperator); + } + /** + * 思源笔记 conf 目录 + */ + static siyuanConfPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.confDir; + } + /** + * 思源笔记 data 目录 + */ + static siyuanDataPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.dataDir; + } + /** + * 思源笔记 data 目录-相对路径 + */ + static siyuanDataRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return ""; + } + /** + * 思源笔记 appearance 目录 + */ + static siyuanAppearancePath() { + return this.joinPath(this.siyuanConfPath(), "appearance"); + } + /** + * 思源笔记 appearance 目录-相对路径 + */ + static siyuanAppearanceRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance"); + } + /** + * 思源笔记 themes 目录-绝对路径 + * + * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 + * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath + * + * @author terwer + * @since 0.1.0 + */ + static siyuanThemePath() { + if (i.hasNodeEnv()) + return this.joinPath(this.siyuanAppearancePath(), "themes"); + { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return this.joinPath(e.location.origin, "appearance", "themes"); + } + } + /** + * 思源笔记 themes 目录-相对路径 + */ + static siyuanThemeRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance", "themes"); + } + /** + * zhi 主题目录 - 绝对路径 + */ + static zhiThemePath() { + return this.joinPath(this.siyuanThemePath(), "zhi"); + } + /** + * zhi 主题目录 - 相对路径 + */ + static zhiThemeRelativePath() { + return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); + } +}; +let w = h; +/** + * 思源笔记iframe挂件环境 + */ +r(w, "isInSiyuanWidget", () => i.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** + * 思源笔记新窗口 + * + * @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 + * @author terwer + * @version 0.1.0 + * @since 0.0.1 + */ +r(w, "isInSiyuanNewWin", () => !i.isInBrowser || !i.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +// require start +// ========================= +/** + * 引入依赖 + * + * @param libpath - 依赖全路径 + * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 + * @param type - 可选,以谁的基本路径为准 + */ +r(w, "requireLib", (e, t = !0, n = o.BasePathType_None) => { + if (!i.hasNodeEnv()) + throw new Error("require ony works on node env"); + let s = e; + if (!t) + switch (n) { + case o.BasePathType_Appearance: + s = h.joinPath(h.siyuanAppearancePath(), e); + break; + case o.BasePathType_Data: + s = h.joinPath(h.siyuanDataPath(), e); + break; + case o.BasePathType_Themes: + s = h.joinPath(h.siyuanAppearancePath(), "themes", e); + break; + case o.BasePathType_ZhiTheme: + s = h.joinPath(h.siyuanAppearancePath(), "themes", "zhi", e); + break; + default: + throw new Error("type must be provided when not use absolute path"); + } + const c = h.siyuanWindow(); + if (!c) + return require(s); + if (typeof c.require < "u") + return c.require(s); +}), /** + * 引入依赖,以 data 的基本路径为准 + * + * @param libpath - 相对于 appearance 的相对路径 + */ +r(w, "requireAppearanceLib", (e) => h.requireLib(e, !1, o.BasePathType_Appearance)), /** + * 引入依赖,以 data 的基本路径为准 + * + * @param libpath - 相对于 data 的相对路径 + */ +r(w, "requireDataLib", (e) => h.requireLib(e, !1, o.BasePathType_Data)), /** + * 引入依赖,以 theme 的基本路径为准 + * + * @param libpath - 相对于 theme 的相对路径 + */ +r(w, "requireThemesLib", (e) => h.requireLib(e, !1, o.BasePathType_Themes)), /** + * 引入依赖,以 ZhiTheme 的基本路径为准 + * + * @param libpath - 相对于 ZhiTheme 的相对路径 + */ +r(w, "requireZhiThemeLib", (e) => h.requireLib(e, !1, o.BasePathType_ZhiTheme)); +var p = /* @__PURE__ */ ((a) => (a.DeviceType_Mobile_Device = "Mobile", a.DeviceType_Siyuan_Widget = "Siyuan_Widget", a.DeviceType_Siyuan_NewWin = "Siyuan_NewWindow", a.DeviceType_Siyuan_MainWin = "Siyuan_MainWindow", a.DeviceType_Siyuan_Browser = "Siyuan_Browser", a.DeviceType_Chrome_Extension = "Chrome_Extension", a.DeviceType_Chrome_Browser = "Chrome_Browser", a.DeviceType_Node = "Node", a))(p || {}); +class v { + /** + * 获取当前设备 + */ + static getDevice() { + return this.detectMobileDevice() ? p.DeviceType_Mobile_Device : w.isInSiyuanWidget() ? p.DeviceType_Siyuan_Widget : w.isInSiyuanNewWin() ? p.DeviceType_Siyuan_NewWin : i.isElectron() ? p.DeviceType_Siyuan_MainWin : w.isInSiyuanBrowser() ? p.DeviceType_Siyuan_Browser : i.isInChromeExtension() ? p.DeviceType_Chrome_Extension : i.isNode ? p.DeviceType_Node : p.DeviceType_Chrome_Browser; + } + /** + * 检测移动端 + * @private + */ + static detectMobileDevice() { + let e = !1; + return i.isInBrowser && function(t) { + (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test( + t + ) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test( + t.substr(0, 4) + )) && (e = !0); + }(navigator.userAgent || navigator.vendor || window.opera), e; + } +} +export { + o as BasePathTypeEnum, + i as BrowserUtil, + v as DeviceDetection, + p as DeviceTypeEnum, + w as SiyuanDevice +}; diff --git a/public/libs/zhi-device/lib/basePathTypeEnum.d.ts b/public/libs/zhi-device/lib/basePathTypeEnum.d.ts new file mode 100644 index 0000000..1dadc09 --- /dev/null +++ b/public/libs/zhi-device/lib/basePathTypeEnum.d.ts @@ -0,0 +1,31 @@ +/** + * 基本路径枚举 + * + * @public + * @author terwer + * @version 0.1.0 + * @since 0.1.0 + */ +declare enum BasePathTypeEnum { + /** + * Appearance + */ + BasePathType_Appearance = "Appearance", + /** + * Data + */ + BasePathType_Data = "Data", + /** + * Themes + */ + BasePathType_Themes = "Themes", + /** + * Zhi 主题目录 + */ + BasePathType_ZhiTheme = "ZhiTheme", + /** + * 未设置 + */ + BasePathType_None = "None" +} +export default BasePathTypeEnum; diff --git a/public/libs/zhi-device/lib/browserUtil.d.ts b/public/libs/zhi-device/lib/browserUtil.d.ts new file mode 100644 index 0000000..e268f3b --- /dev/null +++ b/public/libs/zhi-device/lib/browserUtil.d.ts @@ -0,0 +1,84 @@ +/** + * 浏览器工具类 + * + * @public + * @author terwer + * @since 1.0.2 + */ +declare class BrowserUtil { + /** + * 是否在浏览器环境 + */ + static isNode: boolean; + /** + * 是否在浏览器环境 + */ + static isInBrowser: boolean; + /** + * 浏览器路径分隔符 + */ + static BrowserSeperator: string; + /** + * 是否是Electron环境 + */ + static isElectron: () => boolean; + /** + * 是否有Node环境,目前包括 Electron 和 Node + */ + static hasNodeEnv: () => boolean; + /** + * 检测是否运行在Chrome插件中 + */ + static isInChromeExtension(): boolean; + /** + * 获取url参数 + * + * @param sParam - 参数 + */ + static getQueryString: (sParam: string) => string; + /** + * 替换 URL 的参数 + * 思路: + * 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 + * + * 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 + * + * 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 + * + * 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 + * + * 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 + * + * @param url - 链接地址 + * @param paramName - 参数名 + * @param paramValue - 参数值 + */ + static replaceUrlParam: (url: string, paramName: string, paramValue: string) => string; + /** + * 设置url参数 + * + * @param urlstring - url + * @param key - key + * @param value - value + */ + static setUrlParameter: (urlstring: string, key: string, value: string) => string; + /** + * 重新加载指定tab + * + * @param tabname - tabname + * @param t - 延迟时间 + */ + static reloadTabPage: (tabname: string, t?: number) => void; + /** + * 刷新当前tab页面 + */ + static reloadPage: () => void; + /** + * 刷新当前tab页面 + * + * @param msg - 消息提示 + * @param cb - 回调 + */ + static reloadPageWithMessageCallback: (msg: string, cb: any) => void; +} +export default BrowserUtil; diff --git a/public/libs/zhi-device/lib/deviceTypeEnum.d.ts b/public/libs/zhi-device/lib/deviceTypeEnum.d.ts new file mode 100644 index 0000000..ffdc9c3 --- /dev/null +++ b/public/libs/zhi-device/lib/deviceTypeEnum.d.ts @@ -0,0 +1,42 @@ +/** + * 设备类型枚举 + * + * @public + * @author terwer + * @since 1.0.8 + */ +declare enum DeviceTypeEnum { + /** + * 移动端 + */ + DeviceType_Mobile_Device = "Mobile", + /** + * 思源笔记挂件 + */ + DeviceType_Siyuan_Widget = "Siyuan_Widget", + /** + * 思源笔记新窗口 + */ + DeviceType_Siyuan_NewWin = "Siyuan_NewWindow", + /** + * 思源笔记主窗口 + */ + DeviceType_Siyuan_MainWin = "Siyuan_MainWindow", + /** + * 思源打开的浏览器 + */ + DeviceType_Siyuan_Browser = "Siyuan_Browser", + /** + * Google Chrome浏览器插件 + */ + DeviceType_Chrome_Extension = "Chrome_Extension", + /** + * Google Chrome浏览器(Docker浏览器共用) + */ + DeviceType_Chrome_Browser = "Chrome_Browser", + /** + * Node环境 + */ + DeviceType_Node = "Node" +} +export default DeviceTypeEnum; diff --git a/public/libs/zhi-device/lib/siyuanDevice.d.ts b/public/libs/zhi-device/lib/siyuanDevice.d.ts new file mode 100644 index 0000000..c4e7ea5 --- /dev/null +++ b/public/libs/zhi-device/lib/siyuanDevice.d.ts @@ -0,0 +1,153 @@ +import BasePathTypeEnum from "./basePathTypeEnum"; +/** + * 思源笔记设备相关 + * + * @public + * @author terwer + * @version 0.1.0 + * @since 0.1.0 + */ +declare class SiyuanDevice { + /** + * 思源笔记iframe挂件环境 + */ + static isInSiyuanWidget: () => boolean; + /** + * 思源笔记新窗口 + * + * @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 + * @author terwer + * @version 0.1.0 + * @since 0.0.1 + */ + static isInSiyuanNewWin: () => boolean; + /** + * 检测是否运行在思源打开的浏览器中 + */ + static isInSiyuanBrowser(): boolean; + /** + * 思源笔记 window 对象 + */ + static siyuanWindow(): any; + /** + * 引入依赖 + * + * @param libpath - 依赖全路径 + * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 + * @param type - 可选,以谁的基本路径为准 + */ + static requireLib: (libpath: string, abs?: boolean, type?: BasePathTypeEnum) => any; + /** + * 引入依赖,以 data 的基本路径为准 + * + * @param libpath - 相对于 appearance 的相对路径 + */ + static requireAppearanceLib: (libpath: string) => any; + /** + * 引入依赖,以 data 的基本路径为准 + * + * @param libpath - 相对于 data 的相对路径 + */ + static requireDataLib: (libpath: string) => any; + /** + * 引入依赖,以 theme 的基本路径为准 + * + * @param libpath - 相对于 theme 的相对路径 + */ + static requireThemesLib: (libpath: string) => any; + /** + * 引入依赖,以 ZhiTheme 的基本路径为准 + * + * @param libpath - 相对于 ZhiTheme 的相对路径 + */ + static requireZhiThemeLib: (libpath: string) => any; + /** + * 引入json + * + * @param jsPath - js相对路径全路径 + * @param type - 类型 + */ + static importJs(jsPath: string, type: BasePathTypeEnum): Promise; + /** + * 引入json + * + * @param jsonPath - json相对路径全路径 + * @param type - 类型 + */ + /** + * 引入 json - 以 data 为基本路径 + * + * @param jsonPath - 相对于 data 的相对路径 + */ + /** + * 引入 json - 以 appearance 为基本路径 + * + * @param jsonPath - 相对于 appearance 的相对路径 + */ + /** + * 引入 json - 以 themes 为基本路径 + * + * @param jsonPath - 相对于 themes 的相对路径 + */ + /** + * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 + * + * @param jsonPath - 相对于 zhi 主题根路径的相对路径 + */ + /** + * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 + * + * @param jsPath - 相对于 zhi 主题根路径的相对路径 + */ + static importZhiThemeJs(jsPath: string): Promise; + /** + * 路径拼接 + * + * @param paths - 路径数组 + */ + static joinPath(...paths: string[]): string; + static browserJoinPath(...paths: string[]): string; + /** + * 思源笔记 conf 目录 + */ + static siyuanConfPath(): any; + /** + * 思源笔记 data 目录 + */ + static siyuanDataPath(): any; + /** + * 思源笔记 data 目录-相对路径 + */ + static siyuanDataRelativePath(): string; + /** + * 思源笔记 appearance 目录 + */ + static siyuanAppearancePath(): string; + /** + * 思源笔记 appearance 目录-相对路径 + */ + static siyuanAppearanceRelativePath(): string; + /** + * 思源笔记 themes 目录-绝对路径 + * + * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 + * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath + * + * @author terwer + * @since 0.1.0 + */ + static siyuanThemePath(): string; + /** + * 思源笔记 themes 目录-相对路径 + */ + static siyuanThemeRelativePath(): string; + /** + * zhi 主题目录 - 绝对路径 + */ + static zhiThemePath(): string; + /** + * zhi 主题目录 - 相对路径 + */ + static zhiThemeRelativePath(): string; +} +export default SiyuanDevice; diff --git a/public/libs/zhi-device/package.json b/public/libs/zhi-device/package.json new file mode 100644 index 0000000..de8a42c --- /dev/null +++ b/public/libs/zhi-device/package.json @@ -0,0 +1,35 @@ +{ + "name": "zhi-device", + "version": "0.7.2", + "type": "module", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "description": "auto check environment whether in browser, browser extension, electron, node and more", + "repository": "terwer/zhi", + "homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-device", + "author": "terwer", + "license": "GPL", + "files": [ + "dist", + "README.md" + ], + "keywords": [ + "zhi", + "device", + "browser", + "node", + "electron" + ], + "scripts": { + "serve": "vite", + "dev": "vite build --watch", + "build": "vite build", + "start": "vite preview", + "test": "vitest --watch" + }, + "devDependencies": { + "@terwer/eslint-config-custom": "workspace:*", + "@terwer/tsconfig": "workspace:*", + "@terwer/vite-config-custom": "workspace:*" + } +} diff --git a/public/libs/zhi-electron/README.md b/public/libs/zhi-electron/README.md new file mode 100644 index 0000000..d306e04 --- /dev/null +++ b/public/libs/zhi-electron/README.md @@ -0,0 +1,9 @@ +# zhi-electron +a simple api for electron + +## Usage + +```js +// siyuan condole +zhiWindow.openBrowserWindow("https://www.baidu.com") +``` \ No newline at end of file diff --git a/public/libs/zhi-electron/index.d.ts b/public/libs/zhi-electron/index.d.ts new file mode 100644 index 0000000..e3dbfae --- /dev/null +++ b/public/libs/zhi-electron/index.d.ts @@ -0,0 +1,3 @@ +import ZhiBrowserWindow from "./lib/browser-window"; +export { ZhiBrowserWindow }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/public/libs/zhi-electron/index.d.ts.map b/public/libs/zhi-electron/index.d.ts.map new file mode 100644 index 0000000..4e2327b --- /dev/null +++ b/public/libs/zhi-electron/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,sBAAsB,CAAA;AAEnD,OAAO,EAAE,gBAAgB,EAAE,CAAA"} \ No newline at end of file diff --git a/public/libs/zhi-electron/index.js b/public/libs/zhi-electron/index.js new file mode 100644 index 0000000..7d9ed7e --- /dev/null +++ b/public/libs/zhi-electron/index.js @@ -0,0 +1,519 @@ +var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { + get: (a, b) => (typeof require !== "undefined" ? require : a)[b] +}) : x)(function(x) { + if (typeof require !== "undefined") + return require.apply(this, arguments); + throw new Error('Dynamic require of "' + x + '" is not supported'); +}); + +// ../zhi-device/dist/index.js +var g = Object.defineProperty; +var P = (a, e, t) => e in a ? g(a, e, { enumerable: true, configurable: true, writable: true, value: t }) : a[e] = t; +var r = (a, e, t) => (P(a, typeof e != "symbol" ? e + "" : e, t), t); +var u = class { + /** + * 检测是否运行在Chrome插件中 + */ + static isInChromeExtension() { + return u.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : false; + } +}; +var i = u; +r(i, "isNode", typeof process < "u"), /** +* 是否在浏览器环境 +*/ +r(i, "isInBrowser", typeof window < "u"), /** +* 浏览器路径分隔符 +*/ +r(i, "BrowserSeperator", "/"), /** +* 是否是Electron环境 +*/ +r(i, "isElectron", () => !u.isInBrowser || !window.navigator || !window.navigator.userAgent ? false : /Electron/.test(window.navigator.userAgent)), /** +* 是否有Node环境,目前包括 Electron 和 Node +*/ +r(i, "hasNodeEnv", () => u.isElectron() || u.isNode), /** +* 获取url参数 +* +* @param sParam - 参数 +*/ +r(i, "getQueryString", (e) => { + if (!u.isInBrowser) + return ""; + const n = window.location.search.substring(1).split("&"); + for (let s = 0; s < n.length; s++) { + const c = n[s].split("="); + if (c[0] === e) + return c[1]; + } + return ""; +}), /** +* 替换 URL 的参数 +* 思路: +* 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 +* +* 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 +* +* 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 +* +* 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 +* +* 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 +* +* @param url - 链接地址 +* @param paramName - 参数名 +* @param paramValue - 参数值 +*/ +r(i, "replaceUrlParam", (e, t, n) => { + n == null && (n = ""); + const s = new RegExp("\\b(" + t + "=).*?(&|#|$)"); + if (e.search(s) >= 0) + return e.replace(s, "$1" + n + "$2"); + const [c, d] = e.split("#"), [y, b] = c.split("?"), l = new URLSearchParams(b); + l.set(t, n); + const m = l.toString(), f = y + (m ? "?" + m : ""); + return d ? f + "#" + d : f; +}), /** +* 设置url参数 +* +* @param urlstring - url +* @param key - key +* @param value - value +*/ +r(i, "setUrlParameter", (e, t, n) => { + if (e.includes(t)) + return u.replaceUrlParam(e, t, n); + const s = e.split("#"); + let c = s[0]; + const d = s[1]; + return c.includes("?") ? c += `&${t}=${n}` : c += `?${t}=${n}`, d && (c += "#" + d), c; +}), /** +* 重新加载指定tab +* +* @param tabname - tabname +* @param t - 延迟时间 +*/ +r(i, "reloadTabPage", (e, t = 200) => { + setTimeout(function() { + if (u.isInBrowser) { + const n = window.location.href; + window.location.href = u.setUrlParameter(n, "tab", e); + } + }, t); +}), /** +* 刷新当前tab页面 +*/ +r(i, "reloadPage", () => { + setTimeout(function() { + u.isInBrowser && window.location.reload(); + }, 200); +}), /** +* 刷新当前tab页面 +* +* @param msg - 消息提示 +* @param cb - 回调 +*/ +r(i, "reloadPageWithMessageCallback", (e, t) => { + t && t(e), setTimeout(function() { + u.isInBrowser && window.location.reload(); + }, 200); +}); +var o = /* @__PURE__ */ ((a) => (a.BasePathType_Appearance = "Appearance", a.BasePathType_Data = "Data", a.BasePathType_Themes = "Themes", a.BasePathType_ZhiTheme = "ZhiTheme", a.BasePathType_None = "None", a))(o || {}); +var h = class { + /** + * 检测是否运行在思源打开的浏览器中 + */ + static isInSiyuanBrowser() { + return i.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : false; + } + /** + * 思源笔记 window 对象 + */ + static siyuanWindow() { + let e; + return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; + } + // ========================= + // require end + // ========================= + // ========================= + // import start + // ========================= + /** + * 引入json + * + * @param jsPath - js相对路径全路径 + * @param type - 类型 + */ + static async importJs(e, t) { + let n = e; + switch (t) { + case o.BasePathType_Appearance: + n = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); + break; + case o.BasePathType_Data: + n = this.browserJoinPath(this.siyuanDataRelativePath(), e); + break; + case o.BasePathType_Themes: + n = this.browserJoinPath(this.siyuanThemeRelativePath(), e); + break; + case o.BasePathType_ZhiTheme: + n = this.browserJoinPath(this.zhiThemeRelativePath(), e); + break; + default: + throw new Error("type must be provided"); + } + const { default: s } = await import( + /* @vite-ignore */ + n + ); + return s; + } + /** + * 引入json + * + * @param jsonPath - json相对路径全路径 + * @param type - 类型 + */ + // public static async importJson(jsonPath: string, type: BasePathTypeEnum) { + // let fullJsonPath = jsonPath + // switch (type) { + // case BasePathTypeEnum.BasePathType_Appearance: + // fullJsonPath = this.browserJoinPath(this.siyuanAppearanceRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Data: + // fullJsonPath = this.browserJoinPath(this.siyuanDataRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Themes: + // fullJsonPath = this.browserJoinPath(this.siyuanThemeRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_ZhiTheme: + // fullJsonPath = this.browserJoinPath(this.zhiThemeRelativePath(), jsonPath) + // break + // default: + // throw new Error("type must be provided") + // } + // + // const { default: data } = await import(/* @vite-ignore */ fullJsonPath, { assert: { type: "json" } }) + // return data + // } + /** + * 引入 json - 以 data 为基本路径 + * + * @param jsonPath - 相对于 data 的相对路径 + */ + // public static async importDataJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Data) + // } + /** + * 引入 json - 以 appearance 为基本路径 + * + * @param jsonPath - 相对于 appearance 的相对路径 + */ + // public static async importAppearanceJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Appearance) + // } + /** + * 引入 json - 以 themes 为基本路径 + * + * @param jsonPath - 相对于 themes 的相对路径 + */ + // public static async importThemesJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Themes) + // } + /** + * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 + * + * @param jsonPath - 相对于 zhi 主题根路径的相对路径 + */ + // public static async importZhiThemeJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_ZhiTheme) + // } + /** + * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 + * + * @param jsPath - 相对于 zhi 主题根路径的相对路径 + */ + static async importZhiThemeJs(e) { + return await this.importJs(e, o.BasePathType_ZhiTheme); + } + // ========================= + // import start + // ========================= + /** + * 路径拼接 + * + * @param paths - 路径数组 + */ + static joinPath(...e) { + if (i.hasNodeEnv()) { + const t = this.requireLib("path"); + if (t) + return t.join(...e); + } + return this.browserJoinPath(...e); + } + static browserJoinPath(...e) { + return e.join(i.BrowserSeperator); + } + /** + * 思源笔记 conf 目录 + */ + static siyuanConfPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.confDir; + } + /** + * 思源笔记 data 目录 + */ + static siyuanDataPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.dataDir; + } + /** + * 思源笔记 data 目录-相对路径 + */ + static siyuanDataRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return ""; + } + /** + * 思源笔记 appearance 目录 + */ + static siyuanAppearancePath() { + return this.joinPath(this.siyuanConfPath(), "appearance"); + } + /** + * 思源笔记 appearance 目录-相对路径 + */ + static siyuanAppearanceRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance"); + } + /** + * 思源笔记 themes 目录-绝对路径 + * + * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 + * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath + * + * @author terwer + * @since 0.1.0 + */ + static siyuanThemePath() { + if (i.hasNodeEnv()) + return this.joinPath(this.siyuanAppearancePath(), "themes"); + { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return this.joinPath(e.location.origin, "appearance", "themes"); + } + } + /** + * 思源笔记 themes 目录-相对路径 + */ + static siyuanThemeRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance", "themes"); + } + /** + * zhi 主题目录 - 绝对路径 + */ + static zhiThemePath() { + return this.joinPath(this.siyuanThemePath(), "zhi"); + } + /** + * zhi 主题目录 - 相对路径 + */ + static zhiThemeRelativePath() { + return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); + } +}; +var w = h; +r(w, "isInSiyuanWidget", () => i.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : false), /** +* 思源笔记新窗口 +* +* @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 +* @author terwer +* @version 0.1.0 +* @since 0.0.1 +*/ +r(w, "isInSiyuanNewWin", () => !i.isInBrowser || !i.isElectron() ? false : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +// require start +// ========================= +/** + * 引入依赖 + * + * @param libpath - 依赖全路径 + * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 + * @param type - 可选,以谁的基本路径为准 + */ +r(w, "requireLib", (e, t = true, n = o.BasePathType_None) => { + if (!i.hasNodeEnv()) + throw new Error("require ony works on node env"); + let s = e; + if (!t) + switch (n) { + case o.BasePathType_Appearance: + s = h.joinPath(h.siyuanAppearancePath(), e); + break; + case o.BasePathType_Data: + s = h.joinPath(h.siyuanDataPath(), e); + break; + case o.BasePathType_Themes: + s = h.joinPath(h.siyuanAppearancePath(), "themes", e); + break; + case o.BasePathType_ZhiTheme: + s = h.joinPath(h.siyuanAppearancePath(), "themes", "zhi", e); + break; + default: + throw new Error("type must be provided when not use absolute path"); + } + const c = h.siyuanWindow(); + if (!c) + return __require(s); + if (typeof c.require < "u") + return c.require(s); +}), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 appearance 的相对路径 +*/ +r(w, "requireAppearanceLib", (e) => h.requireLib(e, false, o.BasePathType_Appearance)), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 data 的相对路径 +*/ +r(w, "requireDataLib", (e) => h.requireLib(e, false, o.BasePathType_Data)), /** +* 引入依赖,以 theme 的基本路径为准 +* +* @param libpath - 相对于 theme 的相对路径 +*/ +r(w, "requireThemesLib", (e) => h.requireLib(e, false, o.BasePathType_Themes)), /** +* 引入依赖,以 ZhiTheme 的基本路径为准 +* +* @param libpath - 相对于 ZhiTheme 的相对路径 +*/ +r(w, "requireZhiThemeLib", (e) => h.requireLib(e, false, o.BasePathType_ZhiTheme)); + +// src/lib/browser-window/WindowManager.ts +var WindowManager = class { + logger; + common; + init(logger, common) { + this.logger = logger; + this.common = common; + } + /** + * 打开新窗口 + * + * 示例: + * + * ``` + * ## development + * windowManager.openBrowserWindow("https://www.baidu.com", undefined, undefined, true, false) + * windowManager.openBrowserWindow("https://www.baidu.com", { "key1": "value1", "key2": "value2" }, undefined, true, false) + * + * ## production + * windowManager.openBrowserWindow("https://www.baidu.com") + * ``` + * + * @param url - url + * @param params - 参数 + * @param win - 父窗口 + * @param isDev - 是否打开开发者工具 + * @param modal - 是否模态 + */ + openBrowserWindow(url, params, win, isDev = false, modal = false) { + try { + if (this.common.strUtil.isEmptyString(url)) { + this.logger.error("Url cannot be empty"); + return; + } + if (!i.isElectron()) { + this.logger.info("BrowserWindow can ony be available in siyuan Electron environment"); + return; + } + if (params) { + Object.keys(params).forEach((key) => { + const value = params[key]; + url = i.setUrlParameter(url, key, value); + }); + } + this.logger.info(this.common.strUtil.f("Opening a new BrowserWindow from url => {0}", url)); + const mainWin = win ?? w.siyuanWindow(); + const { app, BrowserWindow, getCurrentWindow } = mainWin.require("@electron/remote"); + const remote = mainWin.require("@electron/remote").require("@electron/remote/main"); + const mainWindow = getCurrentWindow(); + const newWindow = new BrowserWindow({ + parent: mainWindow, + width: 900, + height: 750, + resizable: true, + modal, + icon: w.browserJoinPath( + w.siyuanWindow().siyuan.config.system.appDir, + "stage", + "icon-large.png" + ), + titleBarOverlay: { + color: "#cccccca5", + symbolColor: "black" + }, + webPreferences: { + nativeWindowOpen: true, + nodeIntegration: true, + webviewTag: true, + webSecurity: false, + contextIsolation: false + } + }); + newWindow.webContents.userAgent = `SiYuan/${app.getVersion()} https://b3log.org/siyuan Electron`; + remote.enable(newWindow.webContents); + if (isDev) { + newWindow.webContents.openDevTools(); + } + newWindow.loadURL(url); + } catch (e) { + this.logger.error("Open browser window failed", e); + } + } +}; +var WindowManager_default = WindowManager; + +// src/lib/browser-window/index.ts +var ZhiBrowserWindow = class { + logger; + windowManager; + constructor() { + this.windowManager = new WindowManager_default(); + } + init(logger, common) { + this.logger = logger; + this.windowManager.init(logger, common); + } + /** + * 挂载 BrowserWindow + * + * @author terwer + * @since 1.0.0 + */ + initBrowserWindow() { + const win = w.siyuanWindow(); + win.zhi = win.zhi ?? {}; + win.zhi.windowManager = this.windowManager; + this.logger.info("zhiWindow inited"); + return this.windowManager; + } +}; +var browser_window_default = ZhiBrowserWindow; +export { + browser_window_default as ZhiBrowserWindow +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vemhpLWZyYW1ld29yay96aGkvbGlicy96aGktZGV2aWNlL2Rpc3QvaW5kZXguanMiLCAiLi4vLi4vLi4vLi4vLi4vemhpLWZyYW1ld29yay96aGkvbGlicy96aGktZWxlY3Ryb24vc3JjL2xpYi9icm93c2VyLXdpbmRvdy9XaW5kb3dNYW5hZ2VyLnRzIiwgIi4uLy4uLy4uLy4uLy4uL3poaS1mcmFtZXdvcmsvemhpL2xpYnMvemhpLWVsZWN0cm9uL3NyYy9saWIvYnJvd3Nlci13aW5kb3cvaW5kZXgudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbInZhciBnID0gT2JqZWN0LmRlZmluZVByb3BlcnR5O1xudmFyIFAgPSAoYSwgZSwgdCkgPT4gZSBpbiBhID8gZyhhLCBlLCB7IGVudW1lcmFibGU6ICEwLCBjb25maWd1cmFibGU6ICEwLCB3cml0YWJsZTogITAsIHZhbHVlOiB0IH0pIDogYVtlXSA9IHQ7XG52YXIgciA9IChhLCBlLCB0KSA9PiAoUChhLCB0eXBlb2YgZSAhPSBcInN5bWJvbFwiID8gZSArIFwiXCIgOiBlLCB0KSwgdCk7XG5jb25zdCB1ID0gY2xhc3Mge1xuICAvKipcbiAgICogXHU2OEMwXHU2RDRCXHU2NjJGXHU1NDI2XHU4RkQwXHU4ODRDXHU1NzI4Q2hyb21lXHU2M0QyXHU0RUY2XHU0RTJEXG4gICAqL1xuICBzdGF0aWMgaXNJbkNocm9tZUV4dGVuc2lvbigpIHtcbiAgICByZXR1cm4gdS5pc0luQnJvd3NlciA/IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoXCJjaHJvbWUtZXh0ZW5zaW9uOi8vXCIpID4gLTEgOiAhMTtcbiAgfVxufTtcbmxldCBpID0gdTtcbi8qKlxuICogXHU2NjJGXHU1NDI2XHU1NzI4XHU2RDRGXHU4OUM4XHU1NjY4XHU3M0FGXHU1ODgzXG4gKi9cbnIoaSwgXCJpc05vZGVcIiwgdHlwZW9mIHByb2Nlc3MgPCBcInVcIiksIC8qKlxuICogXHU2NjJGXHU1NDI2XHU1NzI4XHU2RDRGXHU4OUM4XHU1NjY4XHU3M0FGXHU1ODgzXG4gKi9cbnIoaSwgXCJpc0luQnJvd3NlclwiLCB0eXBlb2Ygd2luZG93IDwgXCJ1XCIpLCAvKipcbiAqIFx1NkQ0Rlx1ODlDOFx1NTY2OFx1OERFRlx1NUY4NFx1NTIwNlx1OTY5NFx1N0IyNlxuICovXG5yKGksIFwiQnJvd3NlclNlcGVyYXRvclwiLCBcIi9cIiksIC8qKlxuICogXHU2NjJGXHU1NDI2XHU2NjJGRWxlY3Ryb25cdTczQUZcdTU4ODNcbiAqL1xucihpLCBcImlzRWxlY3Ryb25cIiwgKCkgPT4gIXUuaXNJbkJyb3dzZXIgfHwgIXdpbmRvdy5uYXZpZ2F0b3IgfHwgIXdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50ID8gITEgOiAvRWxlY3Ryb24vLnRlc3Qod2luZG93Lm5hdmlnYXRvci51c2VyQWdlbnQpKSwgLyoqXG4gKiBcdTY2MkZcdTU0MjZcdTY3MDlOb2RlXHU3M0FGXHU1ODgzXHVGRjBDXHU3NkVFXHU1MjREXHU1MzA1XHU2MkVDIEVsZWN0cm9uIFx1NTQ4QyBOb2RlXG4gKi9cbnIoaSwgXCJoYXNOb2RlRW52XCIsICgpID0+IHUuaXNFbGVjdHJvbigpIHx8IHUuaXNOb2RlKSwgLyoqXG4gKiBcdTgzQjdcdTUzRDZ1cmxcdTUzQzJcdTY1NzBcbiAqXG4gKiBAcGFyYW0gc1BhcmFtIC0gXHU1M0MyXHU2NTcwXG4gKi9cbnIoaSwgXCJnZXRRdWVyeVN0cmluZ1wiLCAoZSkgPT4ge1xuICBpZiAoIXUuaXNJbkJyb3dzZXIpXG4gICAgcmV0dXJuIFwiXCI7XG4gIGNvbnN0IG4gPSB3aW5kb3cubG9jYXRpb24uc2VhcmNoLnN1YnN0cmluZygxKS5zcGxpdChcIiZcIik7XG4gIGZvciAobGV0IHMgPSAwOyBzIDwgbi5sZW5ndGg7IHMrKykge1xuICAgIGNvbnN0IGMgPSBuW3NdLnNwbGl0KFwiPVwiKTtcbiAgICBpZiAoY1swXSA9PT0gZSlcbiAgICAgIHJldHVybiBjWzFdO1xuICB9XG4gIHJldHVybiBcIlwiO1xufSksIC8qKlxuICogXHU2NkZGXHU2MzYyIFVSTCBcdTc2ODRcdTUzQzJcdTY1NzBcbiAqIFx1NjAxRFx1OERFRlx1RkYxQVxuICogMS4gXHU0RjdGXHU3NTI4XHU0RTg2IFVSTFNlYXJjaFBhcmFtcyBcdTVCRjlcdThDNjFcdTY3NjVcdTg5RTNcdTY3OTBcdTU0OENcdTY3ODRcdTVFRkEgVVJMIFx1NjdFNVx1OEJFMlx1NTNDMlx1NjU3MFx1MzAwMlxuICpcbiAqIDIuIFx1NTcyOFx1NTkwNFx1NzQwNlx1NTMwNVx1NTQyQiBoYXNoIFx1NzI0N1x1NkJCNVx1NzY4NCBVUkwgXHU2NUY2XHU0RjdGXHU3NTI4XHU0RTg2IHNwbGl0IFx1NTFGRFx1NjU3MFx1NUMwNiBVUkwgXHU1MjA2XHU2MjEwXHU0RTI0XHU5MEU4XHU1MjA2XHVGRjFBXHU1N0ZBXHU2NzJDIFVSTCBcdTU0OEMgaGFzaCBcdTcyNDdcdTZCQjVcdTMwMDJcbiAqXG4gKiAzLiBcdTcxMzZcdTU0MEVcdUZGMENcdTUxOERcdTZCMjFcdTRGN0ZcdTc1Mjggc3BsaXQgXHU1MUZEXHU2NTcwXHU1QzA2XHU1N0ZBXHU2NzJDIFVSTCBcdTUyMDZcdTYyMTBcdTRFMjRcdTkwRThcdTUyMDZcdUZGMUFcdThERUZcdTVGODRcdTU0OENcdTY3RTVcdThCRTJcdTUzQzJcdTY1NzBcdTMwMDJcbiAqXG4gKiA0LiBcdTVDMDZcdTY3RTVcdThCRTJcdTUzQzJcdTY1NzBcdThGNkNcdTYzNjJcdTRFM0EgVVJMU2VhcmNoUGFyYW1zIFx1NUJGOVx1OEM2MVx1RkYwQ1x1NzEzNlx1NTQwRVx1OEJCRVx1N0Y2RVx1NjMwN1x1NUI5QVx1NzY4NFx1NTNDMlx1NjU3MFx1NTQwRFx1NTQ4Q1x1NTAzQ1x1MzAwMlxuICpcbiAqIDUuIFx1NjcwMFx1NTQwRVx1RkYwQ1x1NEY3Rlx1NzUyOCB0b1N0cmluZyBcdTUxRkRcdTY1NzBcdTVDMDZcdTY3RTVcdThCRTJcdTUzQzJcdTY1NzBcdThGNkNcdTYzNjJcdTRFM0FcdTVCNTdcdTdCMjZcdTRFMzJcdUZGMENcdTVFNzZcdTVDMDZcdTUxNzZcdTRFMEVcdThERUZcdTVGODRcdTdFQzRcdTU0MDhcdTYyMTBcdTY1QjBcdTc2ODRcdTU3RkFcdTY3MkMgVVJMXHUzMDAyXHU1OTgyXHU2NzlDIFVSTCBcdTUzMDVcdTU0MkIgaGFzaCBcdTcyNDdcdTZCQjVcdUZGMENcdTUyMTlcdTVDMDZcdTUxNzZcdTZERkJcdTUyQTBcdTUyMzBcdTY1QjBcdTc2ODRcdTU3RkFcdTY3MkMgVVJMIFx1NEUyRFx1MzAwMlxuICpcbiAqIEBwYXJhbSB1cmwgLSBcdTk0RkVcdTYzQTVcdTU3MzBcdTU3NDBcbiAqIEBwYXJhbSBwYXJhbU5hbWUgLSBcdTUzQzJcdTY1NzBcdTU0MERcbiAqIEBwYXJhbSBwYXJhbVZhbHVlIC0gXHU1M0MyXHU2NTcwXHU1MDNDXG4gKi9cbnIoaSwgXCJyZXBsYWNlVXJsUGFyYW1cIiwgKGUsIHQsIG4pID0+IHtcbiAgbiA9PSBudWxsICYmIChuID0gXCJcIik7XG4gIGNvbnN0IHMgPSBuZXcgUmVnRXhwKFwiXFxcXGIoXCIgKyB0ICsgXCI9KS4qPygmfCN8JClcIik7XG4gIGlmIChlLnNlYXJjaChzKSA+PSAwKVxuICAgIHJldHVybiBlLnJlcGxhY2UocywgXCIkMVwiICsgbiArIFwiJDJcIik7XG4gIGNvbnN0IFtjLCBkXSA9IGUuc3BsaXQoXCIjXCIpLCBbeSwgYl0gPSBjLnNwbGl0KFwiP1wiKSwgbCA9IG5ldyBVUkxTZWFyY2hQYXJhbXMoYik7XG4gIGwuc2V0KHQsIG4pO1xuICBjb25zdCBtID0gbC50b1N0cmluZygpLCBmID0geSArIChtID8gXCI/XCIgKyBtIDogXCJcIik7XG4gIHJldHVybiBkID8gZiArIFwiI1wiICsgZCA6IGY7XG59KSwgLyoqXG4gKiBcdThCQkVcdTdGNkV1cmxcdTUzQzJcdTY1NzBcbiAqXG4gKiBAcGFyYW0gdXJsc3RyaW5nIC0gdXJsXG4gKiBAcGFyYW0ga2V5IC0ga2V5XG4gKiBAcGFyYW0gdmFsdWUgLSB2YWx1ZVxuICovXG5yKGksIFwic2V0VXJsUGFyYW1ldGVyXCIsIChlLCB0LCBuKSA9PiB7XG4gIGlmIChlLmluY2x1ZGVzKHQpKVxuICAgIHJldHVybiB1LnJlcGxhY2VVcmxQYXJhbShlLCB0LCBuKTtcbiAgY29uc3QgcyA9IGUuc3BsaXQoXCIjXCIpO1xuICBsZXQgYyA9IHNbMF07XG4gIGNvbnN0IGQgPSBzWzFdO1xuICByZXR1cm4gYy5pbmNsdWRlcyhcIj9cIikgPyBjICs9IGAmJHt0fT0ke259YCA6IGMgKz0gYD8ke3R9PSR7bn1gLCBkICYmIChjICs9IFwiI1wiICsgZCksIGM7XG59KSwgLyoqXG4gKiBcdTkxQ0RcdTY1QjBcdTUyQTBcdThGN0RcdTYzMDdcdTVCOUF0YWJcbiAqXG4gKiBAcGFyYW0gdGFibmFtZSAtIHRhYm5hbWVcbiAqIEBwYXJhbSB0IC0gXHU1RUY2XHU4RkRGXHU2NUY2XHU5NUY0XG4gKi9cbnIoaSwgXCJyZWxvYWRUYWJQYWdlXCIsIChlLCB0ID0gMjAwKSA9PiB7XG4gIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgaWYgKHUuaXNJbkJyb3dzZXIpIHtcbiAgICAgIGNvbnN0IG4gPSB3aW5kb3cubG9jYXRpb24uaHJlZjtcbiAgICAgIHdpbmRvdy5sb2NhdGlvbi5ocmVmID0gdS5zZXRVcmxQYXJhbWV0ZXIobiwgXCJ0YWJcIiwgZSk7XG4gICAgfVxuICB9LCB0KTtcbn0pLCAvKipcbiAqIFx1NTIzN1x1NjVCMFx1NUY1M1x1NTI0RHRhYlx1OTg3NVx1OTc2MlxuICovXG5yKGksIFwicmVsb2FkUGFnZVwiLCAoKSA9PiB7XG4gIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgdS5pc0luQnJvd3NlciAmJiB3aW5kb3cubG9jYXRpb24ucmVsb2FkKCk7XG4gIH0sIDIwMCk7XG59KSwgLyoqXG4gKiBcdTUyMzdcdTY1QjBcdTVGNTNcdTUyNER0YWJcdTk4NzVcdTk3NjJcbiAqXG4gKiBAcGFyYW0gbXNnIC0gXHU2RDg4XHU2MDZGXHU2M0QwXHU3OTNBXG4gKiBAcGFyYW0gY2IgLSBcdTU2REVcdThDMDNcbiAqL1xucihpLCBcInJlbG9hZFBhZ2VXaXRoTWVzc2FnZUNhbGxiYWNrXCIsIChlLCB0KSA9PiB7XG4gIHQgJiYgdChlKSwgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICB1LmlzSW5Ccm93c2VyICYmIHdpbmRvdy5sb2NhdGlvbi5yZWxvYWQoKTtcbiAgfSwgMjAwKTtcbn0pO1xudmFyIG8gPSAvKiBAX19QVVJFX18gKi8gKChhKSA9PiAoYS5CYXNlUGF0aFR5cGVfQXBwZWFyYW5jZSA9IFwiQXBwZWFyYW5jZVwiLCBhLkJhc2VQYXRoVHlwZV9EYXRhID0gXCJEYXRhXCIsIGEuQmFzZVBhdGhUeXBlX1RoZW1lcyA9IFwiVGhlbWVzXCIsIGEuQmFzZVBhdGhUeXBlX1poaVRoZW1lID0gXCJaaGlUaGVtZVwiLCBhLkJhc2VQYXRoVHlwZV9Ob25lID0gXCJOb25lXCIsIGEpKShvIHx8IHt9KTtcbmNvbnN0IGggPSBjbGFzcyB7XG4gIC8qKlxuICAgKiBcdTY4QzBcdTZENEJcdTY2MkZcdTU0MjZcdThGRDBcdTg4NENcdTU3MjhcdTYwMURcdTZFOTBcdTYyNTNcdTVGMDBcdTc2ODRcdTZENEZcdTg5QzhcdTU2NjhcdTRFMkRcbiAgICovXG4gIHN0YXRpYyBpc0luU2l5dWFuQnJvd3NlcigpIHtcbiAgICByZXR1cm4gaS5pc0luQnJvd3NlciA/IHR5cGVvZiB3aW5kb3cuc2l5dWFuIDwgXCJ1XCIgJiYgdHlwZW9mIHdpbmRvdy5MdXRlIDwgXCJ1XCIgOiAhMTtcbiAgfVxuICAvKipcbiAgICogXHU2MDFEXHU2RTkwXHU3QjE0XHU4QkIwIHdpbmRvdyBcdTVCRjlcdThDNjFcbiAgICovXG4gIHN0YXRpYyBzaXl1YW5XaW5kb3coKSB7XG4gICAgbGV0IGU7XG4gICAgcmV0dXJuIHRoaXMuaXNJblNpeXVhbldpZGdldCgpID8gZSA9IHBhcmVudC53aW5kb3cgOiB0aGlzLmlzSW5TaXl1YW5OZXdXaW4oKSB8fCB0aGlzLmlzSW5TaXl1YW5Ccm93c2VyKCkgfHwgdHlwZW9mIHdpbmRvdyA8IFwidVwiID8gZSA9IHdpbmRvdyA6IGUgPSB2b2lkIDAsIGU7XG4gIH1cbiAgLy8gPT09PT09PT09PT09PT09PT09PT09PT09PVxuICAvLyByZXF1aXJlIGVuZFxuICAvLyA9PT09PT09PT09PT09PT09PT09PT09PT09XG4gIC8vID09PT09PT09PT09PT09PT09PT09PT09PT1cbiAgLy8gaW1wb3J0IHN0YXJ0XG4gIC8vID09PT09PT09PT09PT09PT09PT09PT09PT1cbiAgLyoqXG4gICAqIFx1NUYxNVx1NTE2NWpzb25cbiAgICpcbiAgICogQHBhcmFtIGpzUGF0aCAtIGpzXHU3NkY4XHU1QkY5XHU4REVGXHU1Rjg0XHU1MTY4XHU4REVGXHU1Rjg0XG4gICAqIEBwYXJhbSB0eXBlIC0gXHU3QzdCXHU1NzhCXG4gICAqL1xuICBzdGF0aWMgYXN5bmMgaW1wb3J0SnMoZSwgdCkge1xuICAgIGxldCBuID0gZTtcbiAgICBzd2l0Y2ggKHQpIHtcbiAgICAgIGNhc2Ugby5CYXNlUGF0aFR5cGVfQXBwZWFyYW5jZTpcbiAgICAgICAgbiA9IHRoaXMuYnJvd3NlckpvaW5QYXRoKHRoaXMuc2l5dWFuQXBwZWFyYW5jZVJlbGF0aXZlUGF0aCgpLCBlKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIG8uQmFzZVBhdGhUeXBlX0RhdGE6XG4gICAgICAgIG4gPSB0aGlzLmJyb3dzZXJKb2luUGF0aCh0aGlzLnNpeXVhbkRhdGFSZWxhdGl2ZVBhdGgoKSwgZSk7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSBvLkJhc2VQYXRoVHlwZV9UaGVtZXM6XG4gICAgICAgIG4gPSB0aGlzLmJyb3dzZXJKb2luUGF0aCh0aGlzLnNpeXVhblRoZW1lUmVsYXRpdmVQYXRoKCksIGUpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2Ugby5CYXNlUGF0aFR5cGVfWmhpVGhlbWU6XG4gICAgICAgIG4gPSB0aGlzLmJyb3dzZXJKb2luUGF0aCh0aGlzLnpoaVRoZW1lUmVsYXRpdmVQYXRoKCksIGUpO1xuICAgICAgICBicmVhaztcbiAgICAgIGRlZmF1bHQ6XG4gICAgICAgIHRocm93IG5ldyBFcnJvcihcInR5cGUgbXVzdCBiZSBwcm92aWRlZFwiKTtcbiAgICB9XG4gICAgY29uc3QgeyBkZWZhdWx0OiBzIH0gPSBhd2FpdCBpbXBvcnQoXG4gICAgICAvKiBAdml0ZS1pZ25vcmUgKi9cbiAgICAgIG5cbiAgICApO1xuICAgIHJldHVybiBzO1xuICB9XG4gIC8qKlxuICAgKiBcdTVGMTVcdTUxNjVqc29uXG4gICAqXG4gICAqIEBwYXJhbSBqc29uUGF0aCAtIGpzb25cdTc2RjhcdTVCRjlcdThERUZcdTVGODRcdTUxNjhcdThERUZcdTVGODRcbiAgICogQHBhcmFtIHR5cGUgLSBcdTdDN0JcdTU3OEJcbiAgICovXG4gIC8vIHB1YmxpYyBzdGF0aWMgYXN5bmMgaW1wb3J0SnNvbihqc29uUGF0aDogc3RyaW5nLCB0eXBlOiBCYXNlUGF0aFR5cGVFbnVtKSB7XG4gIC8vICAgbGV0IGZ1bGxKc29uUGF0aCA9IGpzb25QYXRoXG4gIC8vICAgc3dpdGNoICh0eXBlKSB7XG4gIC8vICAgICBjYXNlIEJhc2VQYXRoVHlwZUVudW0uQmFzZVBhdGhUeXBlX0FwcGVhcmFuY2U6XG4gIC8vICAgICAgIGZ1bGxKc29uUGF0aCA9IHRoaXMuYnJvd3NlckpvaW5QYXRoKHRoaXMuc2l5dWFuQXBwZWFyYW5jZVJlbGF0aXZlUGF0aCgpLCBqc29uUGF0aClcbiAgLy8gICAgICAgYnJlYWtcbiAgLy8gICAgIGNhc2UgQmFzZVBhdGhUeXBlRW51bS5CYXNlUGF0aFR5cGVfRGF0YTpcbiAgLy8gICAgICAgZnVsbEpzb25QYXRoID0gdGhpcy5icm93c2VySm9pblBhdGgodGhpcy5zaXl1YW5EYXRhUmVsYXRpdmVQYXRoKCksIGpzb25QYXRoKVxuICAvLyAgICAgICBicmVha1xuICAvLyAgICAgY2FzZSBCYXNlUGF0aFR5cGVFbnVtLkJhc2VQYXRoVHlwZV9UaGVtZXM6XG4gIC8vICAgICAgIGZ1bGxKc29uUGF0aCA9IHRoaXMuYnJvd3NlckpvaW5QYXRoKHRoaXMuc2l5dWFuVGhlbWVSZWxhdGl2ZVBhdGgoKSwganNvblBhdGgpXG4gIC8vICAgICAgIGJyZWFrXG4gIC8vICAgICBjYXNlIEJhc2VQYXRoVHlwZUVudW0uQmFzZVBhdGhUeXBlX1poaVRoZW1lOlxuICAvLyAgICAgICBmdWxsSnNvblBhdGggPSB0aGlzLmJyb3dzZXJKb2luUGF0aCh0aGlzLnpoaVRoZW1lUmVsYXRpdmVQYXRoKCksIGpzb25QYXRoKVxuICAvLyAgICAgICBicmVha1xuICAvLyAgICAgZGVmYXVsdDpcbiAgLy8gICAgICAgdGhyb3cgbmV3IEVycm9yKFwidHlwZSBtdXN0IGJlIHByb3ZpZGVkXCIpXG4gIC8vICAgfVxuICAvL1xuICAvLyAgIGNvbnN0IHsgZGVmYXVsdDogZGF0YSB9ID0gYXdhaXQgaW1wb3J0KC8qIEB2aXRlLWlnbm9yZSAqLyBmdWxsSnNvblBhdGgsIHsgYXNzZXJ0OiB7IHR5cGU6IFwianNvblwiIH0gfSlcbiAgLy8gICByZXR1cm4gZGF0YVxuICAvLyB9XG4gIC8qKlxuICAgKiBcdTVGMTVcdTUxNjUganNvbiAtIFx1NEVFNSBkYXRhIFx1NEUzQVx1NTdGQVx1NjcyQ1x1OERFRlx1NUY4NFxuICAgKlxuICAgKiBAcGFyYW0ganNvblBhdGggLSBcdTc2RjhcdTVCRjlcdTRFOEUgZGF0YSBcdTc2ODRcdTc2RjhcdTVCRjlcdThERUZcdTVGODRcbiAgICovXG4gIC8vIHB1YmxpYyBzdGF0aWMgYXN5bmMgaW1wb3J0RGF0YUpzb24oanNvblBhdGg6IHN0cmluZykge1xuICAvLyAgIHJldHVybiBhd2FpdCB0aGlzLmltcG9ydEpzb24oanNvblBhdGgsIEJhc2VQYXRoVHlwZUVudW0uQmFzZVBhdGhUeXBlX0RhdGEpXG4gIC8vIH1cbiAgLyoqXG4gICAqIFx1NUYxNVx1NTE2NSBqc29uIC0gXHU0RUU1IGFwcGVhcmFuY2UgXHU0RTNBXHU1N0ZBXHU2NzJDXHU4REVGXHU1Rjg0XG4gICAqXG4gICAqIEBwYXJhbSBqc29uUGF0aCAtIFx1NzZGOFx1NUJGOVx1NEU4RSBhcHBlYXJhbmNlIFx1NzY4NFx1NzZGOFx1NUJGOVx1OERFRlx1NUY4NFxuICAgKi9cbiAgLy8gcHVibGljIHN0YXRpYyBhc3luYyBpbXBvcnRBcHBlYXJhbmNlSnNvbihqc29uUGF0aDogc3RyaW5nKSB7XG4gIC8vICAgcmV0dXJuIGF3YWl0IHRoaXMuaW1wb3J0SnNvbihqc29uUGF0aCwgQmFzZVBhdGhUeXBlRW51bS5CYXNlUGF0aFR5cGVfQXBwZWFyYW5jZSlcbiAgLy8gfVxuICAvKipcbiAgICogXHU1RjE1XHU1MTY1IGpzb24gLSBcdTRFRTUgdGhlbWVzIFx1NEUzQVx1NTdGQVx1NjcyQ1x1OERFRlx1NUY4NFxuICAgKlxuICAgKiBAcGFyYW0ganNvblBhdGggLSBcdTc2RjhcdTVCRjlcdTRFOEUgdGhlbWVzIFx1NzY4NFx1NzZGOFx1NUJGOVx1OERFRlx1NUY4NFxuICAgKi9cbiAgLy8gcHVibGljIHN0YXRpYyBhc3luYyBpbXBvcnRUaGVtZXNKc29uKGpzb25QYXRoOiBzdHJpbmcpIHtcbiAgLy8gICByZXR1cm4gYXdhaXQgdGhpcy5pbXBvcnRKc29uKGpzb25QYXRoLCBCYXNlUGF0aFR5cGVFbnVtLkJhc2VQYXRoVHlwZV9UaGVtZXMpXG4gIC8vIH1cbiAgLyoqXG4gICAqIFx1NUYxNVx1NTE2NSB6aGkgXHU0RTNCXHU5ODk4XHU3Njg0IGpzb24gLSBcdTRFRTUgemhpIFx1NEUzQlx1OTg5OCBcdTc2ODRcdTY4MzlcdThERUZcdTVGODRcdTRFM0FcdTU3RkFcdTY3MkNcdThERUZcdTVGODRcbiAgICpcbiAgICogQHBhcmFtIGpzb25QYXRoIC0gXHU3NkY4XHU1QkY5XHU0RThFIHpoaSBcdTRFM0JcdTk4OThcdTY4MzlcdThERUZcdTVGODRcdTc2ODRcdTc2RjhcdTVCRjlcdThERUZcdTVGODRcbiAgICovXG4gIC8vIHB1YmxpYyBzdGF0aWMgYXN5bmMgaW1wb3J0WmhpVGhlbWVKc29uKGpzb25QYXRoOiBzdHJpbmcpIHtcbiAgLy8gICByZXR1cm4gYXdhaXQgdGhpcy5pbXBvcnRKc29uKGpzb25QYXRoLCBCYXNlUGF0aFR5cGVFbnVtLkJhc2VQYXRoVHlwZV9aaGlUaGVtZSlcbiAgLy8gfVxuICAvKipcbiAgICogXHU1RjE1XHU1MTY1IHpoaSBcdTRFM0JcdTk4OThcdTc2ODQganMgLSBcdTRFRTUgemhpIFx1NEUzQlx1OTg5OCBcdTc2ODRcdTY4MzlcdThERUZcdTVGODRcdTRFM0FcdTU3RkFcdTY3MkNcdThERUZcdTVGODRcbiAgICpcbiAgICogQHBhcmFtIGpzUGF0aCAtIFx1NzZGOFx1NUJGOVx1NEU4RSB6aGkgXHU0RTNCXHU5ODk4XHU2ODM5XHU4REVGXHU1Rjg0XHU3Njg0XHU3NkY4XHU1QkY5XHU4REVGXHU1Rjg0XG4gICAqL1xuICBzdGF0aWMgYXN5bmMgaW1wb3J0WmhpVGhlbWVKcyhlKSB7XG4gICAgcmV0dXJuIGF3YWl0IHRoaXMuaW1wb3J0SnMoZSwgby5CYXNlUGF0aFR5cGVfWmhpVGhlbWUpO1xuICB9XG4gIC8vID09PT09PT09PT09PT09PT09PT09PT09PT1cbiAgLy8gaW1wb3J0IHN0YXJ0XG4gIC8vID09PT09PT09PT09PT09PT09PT09PT09PT1cbiAgLyoqXG4gICAqIFx1OERFRlx1NUY4NFx1NjJGQ1x1NjNBNVxuICAgKlxuICAgKiBAcGFyYW0gcGF0aHMgLSBcdThERUZcdTVGODRcdTY1NzBcdTdFQzRcbiAgICovXG4gIHN0YXRpYyBqb2luUGF0aCguLi5lKSB7XG4gICAgaWYgKGkuaGFzTm9kZUVudigpKSB7XG4gICAgICBjb25zdCB0ID0gdGhpcy5yZXF1aXJlTGliKFwicGF0aFwiKTtcbiAgICAgIGlmICh0KVxuICAgICAgICByZXR1cm4gdC5qb2luKC4uLmUpO1xuICAgIH1cbiAgICByZXR1cm4gdGhpcy5icm93c2VySm9pblBhdGgoLi4uZSk7XG4gIH1cbiAgc3RhdGljIGJyb3dzZXJKb2luUGF0aCguLi5lKSB7XG4gICAgcmV0dXJuIGUuam9pbihpLkJyb3dzZXJTZXBlcmF0b3IpO1xuICB9XG4gIC8qKlxuICAgKiBcdTYwMURcdTZFOTBcdTdCMTRcdThCQjAgY29uZiBcdTc2RUVcdTVGNTVcbiAgICovXG4gIHN0YXRpYyBzaXl1YW5Db25mUGF0aCgpIHtcbiAgICBjb25zdCBlID0gdGhpcy5zaXl1YW5XaW5kb3coKTtcbiAgICBpZiAoIWUpXG4gICAgICB0aHJvdyBuZXcgRXJyb3IoXCJOb3QgaW4gc2l5dWFuIGVudlwiKTtcbiAgICByZXR1cm4gZS5zaXl1YW4uY29uZmlnLnN5c3RlbS5jb25mRGlyO1xuICB9XG4gIC8qKlxuICAgKiBcdTYwMURcdTZFOTBcdTdCMTRcdThCQjAgZGF0YSBcdTc2RUVcdTVGNTVcbiAgICovXG4gIHN0YXRpYyBzaXl1YW5EYXRhUGF0aCgpIHtcbiAgICBjb25zdCBlID0gdGhpcy5zaXl1YW5XaW5kb3coKTtcbiAgICBpZiAoIWUpXG4gICAgICB0aHJvdyBuZXcgRXJyb3IoXCJOb3QgaW4gc2l5dWFuIGVudlwiKTtcbiAgICByZXR1cm4gZS5zaXl1YW4uY29uZmlnLnN5c3RlbS5kYXRhRGlyO1xuICB9XG4gIC8qKlxuICAgKiBcdTYwMURcdTZFOTBcdTdCMTRcdThCQjAgZGF0YSBcdTc2RUVcdTVGNTUtXHU3NkY4XHU1QkY5XHU4REVGXHU1Rjg0XG4gICAqL1xuICBzdGF0aWMgc2l5dWFuRGF0YVJlbGF0aXZlUGF0aCgpIHtcbiAgICBpZiAoIXRoaXMuc2l5dWFuV2luZG93KCkpXG4gICAgICB0aHJvdyBuZXcgRXJyb3IoXCJOb3QgaW4gc2l5dWFuIGVudlwiKTtcbiAgICByZXR1cm4gXCJcIjtcbiAgfVxuICAvKipcbiAgICogXHU2MDFEXHU2RTkwXHU3QjE0XHU4QkIwIGFwcGVhcmFuY2UgXHU3NkVFXHU1RjU1XG4gICAqL1xuICBzdGF0aWMgc2l5dWFuQXBwZWFyYW5jZVBhdGgoKSB7XG4gICAgcmV0dXJuIHRoaXMuam9pblBhdGgodGhpcy5zaXl1YW5Db25mUGF0aCgpLCBcImFwcGVhcmFuY2VcIik7XG4gIH1cbiAgLyoqXG4gICAqIFx1NjAxRFx1NkU5MFx1N0IxNFx1OEJCMCBhcHBlYXJhbmNlIFx1NzZFRVx1NUY1NS1cdTc2RjhcdTVCRjlcdThERUZcdTVGODRcbiAgICovXG4gIHN0YXRpYyBzaXl1YW5BcHBlYXJhbmNlUmVsYXRpdmVQYXRoKCkge1xuICAgIGlmICghdGhpcy5zaXl1YW5XaW5kb3coKSlcbiAgICAgIHRocm93IG5ldyBFcnJvcihcIk5vdCBpbiBzaXl1YW4gZW52XCIpO1xuICAgIHJldHVybiB0aGlzLmJyb3dzZXJKb2luUGF0aChcIlwiLCBcImFwcGVhcmFuY2VcIik7XG4gIH1cbiAgLyoqXG4gICAqIFx1NjAxRFx1NkU5MFx1N0IxNFx1OEJCMCB0aGVtZXMgXHU3NkVFXHU1RjU1LVx1N0VERFx1NUJGOVx1OERFRlx1NUY4NFxuICAgKlxuICAgKiBcdTZDRThcdTYxMEY6IFx1NTk4Mlx1Njc5Q1x1NjYyRlx1OTc1RSBlbGVjdHJvbiBcdTU0OEMgTm9kZSBcdTczQUZcdTU4ODNcdUZGMENcdThGRDlcdTkxQ0NcdThGRDRcdTU2REVcdTc2ODRcdTY2MkZcdTZENEZcdTg5QzhcdTU2NjhcdTc2ODRcdThERUZcdTVGODRcdUZGMENcdTRFMERcdTY2MkZcdTcyNjlcdTc0MDZcdThERUZcdTVGODRcbiAgICogXHU1OTgyXHU2NzlDXHU0RjdGXHU3NTI4XHU3MjY5XHU3NDA2XHU4REVGXHU1Rjg0XHVGRjBDXHU4QkY3XHU4QzAzXHU3NTI4IHNpeXVhbkFwcGVhcmFuY2VQYXRoIFx1NjIxNlx1ODAwNSBzaXl1YW5EYXRhUGF0aFxuICAgKlxuICAgKiBAYXV0aG9yIHRlcndlclxuICAgKiBAc2luY2UgMC4xLjBcbiAgICovXG4gIHN0YXRpYyBzaXl1YW5UaGVtZVBhdGgoKSB7XG4gICAgaWYgKGkuaGFzTm9kZUVudigpKVxuICAgICAgcmV0dXJuIHRoaXMuam9pblBhdGgodGhpcy5zaXl1YW5BcHBlYXJhbmNlUGF0aCgpLCBcInRoZW1lc1wiKTtcbiAgICB7XG4gICAgICBjb25zdCBlID0gdGhpcy5zaXl1YW5XaW5kb3coKTtcbiAgICAgIGlmICghZSlcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiTm90IGluIHNpeXVhbiBlbnZcIik7XG4gICAgICByZXR1cm4gdGhpcy5qb2luUGF0aChlLmxvY2F0aW9uLm9yaWdpbiwgXCJhcHBlYXJhbmNlXCIsIFwidGhlbWVzXCIpO1xuICAgIH1cbiAgfVxuICAvKipcbiAgICogXHU2MDFEXHU2RTkwXHU3QjE0XHU4QkIwIHRoZW1lcyBcdTc2RUVcdTVGNTUtXHU3NkY4XHU1QkY5XHU4REVGXHU1Rjg0XG4gICAqL1xuICBzdGF0aWMgc2l5dWFuVGhlbWVSZWxhdGl2ZVBhdGgoKSB7XG4gICAgaWYgKCF0aGlzLnNpeXVhbldpbmRvdygpKVxuICAgICAgdGhyb3cgbmV3IEVycm9yKFwiTm90IGluIHNpeXVhbiBlbnZcIik7XG4gICAgcmV0dXJuIHRoaXMuYnJvd3NlckpvaW5QYXRoKFwiXCIsIFwiYXBwZWFyYW5jZVwiLCBcInRoZW1lc1wiKTtcbiAgfVxuICAvKipcbiAgICogemhpIFx1NEUzQlx1OTg5OFx1NzZFRVx1NUY1NSAtIFx1N0VERFx1NUJGOVx1OERFRlx1NUY4NFxuICAgKi9cbiAgc3RhdGljIHpoaVRoZW1lUGF0aCgpIHtcbiAgICByZXR1cm4gdGhpcy5qb2luUGF0aCh0aGlzLnNpeXVhblRoZW1lUGF0aCgpLCBcInpoaVwiKTtcbiAgfVxuICAvKipcbiAgICogemhpIFx1NEUzQlx1OTg5OFx1NzZFRVx1NUY1NSAtIFx1NzZGOFx1NUJGOVx1OERFRlx1NUY4NFxuICAgKi9cbiAgc3RhdGljIHpoaVRoZW1lUmVsYXRpdmVQYXRoKCkge1xuICAgIHJldHVybiB0aGlzLmJyb3dzZXJKb2luUGF0aCh0aGlzLnNpeXVhblRoZW1lUmVsYXRpdmVQYXRoKCksIFwiemhpXCIpO1xuICB9XG59O1xubGV0IHcgPSBoO1xuLyoqXG4gKiBcdTYwMURcdTZFOTBcdTdCMTRcdThCQjBpZnJhbWVcdTYzMDJcdTRFRjZcdTczQUZcdTU4ODNcbiAqL1xucih3LCBcImlzSW5TaXl1YW5XaWRnZXRcIiwgKCkgPT4gaS5pc0luQnJvd3NlciA/IHdpbmRvdy5mcmFtZUVsZW1lbnQgIT0gbnVsbCAmJiB3aW5kb3cuZnJhbWVFbGVtZW50LnBhcmVudEVsZW1lbnQgIT0gbnVsbCAmJiB3aW5kb3cuZnJhbWVFbGVtZW50LnBhcmVudEVsZW1lbnQucGFyZW50RWxlbWVudCAhPSBudWxsICYmIHdpbmRvdy5mcmFtZUVsZW1lbnQucGFyZW50RWxlbWVudC5wYXJlbnRFbGVtZW50LmdldEF0dHJpYnV0ZShcImRhdGEtbm9kZS1pZFwiKSAhPT0gXCJcIiA6ICExKSwgLyoqXG4gKiBcdTYwMURcdTZFOTBcdTdCMTRcdThCQjBcdTY1QjBcdTdBOTdcdTUzRTNcbiAqXG4gKiBAZGVwcmVjYXRlZCB3aW5kb3cudGVyd2VyIFx1NTIyNFx1NjVBRFx1NjVCOVx1NUYwRlx1NURGMlx1NUU5Rlx1NUYwM1x1RkYwQ1x1NUVGQVx1OEJBRVx1NEVFNVx1NTQwRVx1NjI1M1x1NUYwMFx1NjVCMFx1N0E5N1x1NTNFM1x1NkNFOFx1NTE2NSB3aW5kb3cuc2l5dWFuTmV3V2luIFx1RkYwQ1x1OEZEOVx1NjgzN1x1OEJFRFx1NEU0OVx1NEYxQVx1NjZGNFx1NUJCOVx1NjYxM1x1NzQwNlx1ODlFM1xuICogQGF1dGhvciB0ZXJ3ZXJcbiAqIEB2ZXJzaW9uIDAuMS4wXG4gKiBAc2luY2UgMC4wLjFcbiAqL1xucih3LCBcImlzSW5TaXl1YW5OZXdXaW5cIiwgKCkgPT4gIWkuaXNJbkJyb3dzZXIgfHwgIWkuaXNFbGVjdHJvbigpID8gITEgOiB0eXBlb2Ygd2luZG93LnRlcndlciA8IFwidVwiIHx8IHR5cGVvZiB3aW5kb3cuc2l5dWFuTmV3V2luIDwgXCJ1XCIpLCAvLyA9PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyByZXF1aXJlIHN0YXJ0XG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09XG4vKipcbiAqIFx1NUYxNVx1NTE2NVx1NEY5RFx1OEQ1NlxuICpcbiAqIEBwYXJhbSBsaWJwYXRoIC0gXHU0RjlEXHU4RDU2XHU1MTY4XHU4REVGXHU1Rjg0XG4gKiBAcGFyYW0gYWJzIC0gXHU1M0VGXHU5MDA5XHVGRjBDXHU2NjJGXHU1NDI2XHU0RjdGXHU3NTI4XHU4OUM5XHU1Rjk3XHU4REVGXHU1Rjg0XHVGRjBDXHU5RUQ4XHU4QkE0XHU2NjJGIHRydWUgXHVGRjBDIFx1NTQyRlx1NzUyOFx1NEU0Qlx1NTQwRSB0eXBlXHU1M0MyXHU2NTcwXHU2NUUwXHU2NTQ4XG4gKiBAcGFyYW0gdHlwZSAtIFx1NTNFRlx1OTAwOVx1RkYwQ1x1NEVFNVx1OEMwMVx1NzY4NFx1NTdGQVx1NjcyQ1x1OERFRlx1NUY4NFx1NEUzQVx1NTFDNlxuICovXG5yKHcsIFwicmVxdWlyZUxpYlwiLCAoZSwgdCA9ICEwLCBuID0gby5CYXNlUGF0aFR5cGVfTm9uZSkgPT4ge1xuICBpZiAoIWkuaGFzTm9kZUVudigpKVxuICAgIHRocm93IG5ldyBFcnJvcihcInJlcXVpcmUgb255IHdvcmtzIG9uIG5vZGUgZW52XCIpO1xuICBsZXQgcyA9IGU7XG4gIGlmICghdClcbiAgICBzd2l0Y2ggKG4pIHtcbiAgICAgIGNhc2Ugby5CYXNlUGF0aFR5cGVfQXBwZWFyYW5jZTpcbiAgICAgICAgcyA9IGguam9pblBhdGgoaC5zaXl1YW5BcHBlYXJhbmNlUGF0aCgpLCBlKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIG8uQmFzZVBhdGhUeXBlX0RhdGE6XG4gICAgICAgIHMgPSBoLmpvaW5QYXRoKGguc2l5dWFuRGF0YVBhdGgoKSwgZSk7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSBvLkJhc2VQYXRoVHlwZV9UaGVtZXM6XG4gICAgICAgIHMgPSBoLmpvaW5QYXRoKGguc2l5dWFuQXBwZWFyYW5jZVBhdGgoKSwgXCJ0aGVtZXNcIiwgZSk7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSBvLkJhc2VQYXRoVHlwZV9aaGlUaGVtZTpcbiAgICAgICAgcyA9IGguam9pblBhdGgoaC5zaXl1YW5BcHBlYXJhbmNlUGF0aCgpLCBcInRoZW1lc1wiLCBcInpoaVwiLCBlKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBkZWZhdWx0OlxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJ0eXBlIG11c3QgYmUgcHJvdmlkZWQgd2hlbiBub3QgdXNlIGFic29sdXRlIHBhdGhcIik7XG4gICAgfVxuICBjb25zdCBjID0gaC5zaXl1YW5XaW5kb3coKTtcbiAgaWYgKCFjKVxuICAgIHJldHVybiByZXF1aXJlKHMpO1xuICBpZiAodHlwZW9mIGMucmVxdWlyZSA8IFwidVwiKVxuICAgIHJldHVybiBjLnJlcXVpcmUocyk7XG59KSwgLyoqXG4gKiBcdTVGMTVcdTUxNjVcdTRGOURcdThENTZcdUZGMENcdTRFRTUgZGF0YSBcdTc2ODRcdTU3RkFcdTY3MkNcdThERUZcdTVGODRcdTRFM0FcdTUxQzZcbiAqXG4gKiBAcGFyYW0gbGlicGF0aCAtIFx1NzZGOFx1NUJGOVx1NEU4RSBhcHBlYXJhbmNlIFx1NzY4NFx1NzZGOFx1NUJGOVx1OERFRlx1NUY4NFxuICovXG5yKHcsIFwicmVxdWlyZUFwcGVhcmFuY2VMaWJcIiwgKGUpID0+IGgucmVxdWlyZUxpYihlLCAhMSwgby5CYXNlUGF0aFR5cGVfQXBwZWFyYW5jZSkpLCAvKipcbiAqIFx1NUYxNVx1NTE2NVx1NEY5RFx1OEQ1Nlx1RkYwQ1x1NEVFNSBkYXRhIFx1NzY4NFx1NTdGQVx1NjcyQ1x1OERFRlx1NUY4NFx1NEUzQVx1NTFDNlxuICpcbiAqIEBwYXJhbSBsaWJwYXRoIC0gXHU3NkY4XHU1QkY5XHU0RThFIGRhdGEgXHU3Njg0XHU3NkY4XHU1QkY5XHU4REVGXHU1Rjg0XG4gKi9cbnIodywgXCJyZXF1aXJlRGF0YUxpYlwiLCAoZSkgPT4gaC5yZXF1aXJlTGliKGUsICExLCBvLkJhc2VQYXRoVHlwZV9EYXRhKSksIC8qKlxuICogXHU1RjE1XHU1MTY1XHU0RjlEXHU4RDU2XHVGRjBDXHU0RUU1IHRoZW1lIFx1NzY4NFx1NTdGQVx1NjcyQ1x1OERFRlx1NUY4NFx1NEUzQVx1NTFDNlxuICpcbiAqIEBwYXJhbSBsaWJwYXRoIC0gXHU3NkY4XHU1QkY5XHU0RThFIHRoZW1lIFx1NzY4NFx1NzZGOFx1NUJGOVx1OERFRlx1NUY4NFxuICovXG5yKHcsIFwicmVxdWlyZVRoZW1lc0xpYlwiLCAoZSkgPT4gaC5yZXF1aXJlTGliKGUsICExLCBvLkJhc2VQYXRoVHlwZV9UaGVtZXMpKSwgLyoqXG4gKiBcdTVGMTVcdTUxNjVcdTRGOURcdThENTZcdUZGMENcdTRFRTUgWmhpVGhlbWUgXHU3Njg0XHU1N0ZBXHU2NzJDXHU4REVGXHU1Rjg0XHU0RTNBXHU1MUM2XG4gKlxuICogQHBhcmFtIGxpYnBhdGggLSBcdTc2RjhcdTVCRjlcdTRFOEUgWmhpVGhlbWUgXHU3Njg0XHU3NkY4XHU1QkY5XHU4REVGXHU1Rjg0XG4gKi9cbnIodywgXCJyZXF1aXJlWmhpVGhlbWVMaWJcIiwgKGUpID0+IGgucmVxdWlyZUxpYihlLCAhMSwgby5CYXNlUGF0aFR5cGVfWmhpVGhlbWUpKTtcbnZhciBwID0gLyogQF9fUFVSRV9fICovICgoYSkgPT4gKGEuRGV2aWNlVHlwZV9Nb2JpbGVfRGV2aWNlID0gXCJNb2JpbGVcIiwgYS5EZXZpY2VUeXBlX1NpeXVhbl9XaWRnZXQgPSBcIlNpeXVhbl9XaWRnZXRcIiwgYS5EZXZpY2VUeXBlX1NpeXVhbl9OZXdXaW4gPSBcIlNpeXVhbl9OZXdXaW5kb3dcIiwgYS5EZXZpY2VUeXBlX1NpeXVhbl9NYWluV2luID0gXCJTaXl1YW5fTWFpbldpbmRvd1wiLCBhLkRldmljZVR5cGVfU2l5dWFuX0Jyb3dzZXIgPSBcIlNpeXVhbl9Ccm93c2VyXCIsIGEuRGV2aWNlVHlwZV9DaHJvbWVfRXh0ZW5zaW9uID0gXCJDaHJvbWVfRXh0ZW5zaW9uXCIsIGEuRGV2aWNlVHlwZV9DaHJvbWVfQnJvd3NlciA9IFwiQ2hyb21lX0Jyb3dzZXJcIiwgYS5EZXZpY2VUeXBlX05vZGUgPSBcIk5vZGVcIiwgYSkpKHAgfHwge30pO1xuY2xhc3MgdiB7XG4gIC8qKlxuICAgKiBcdTgzQjdcdTUzRDZcdTVGNTNcdTUyNERcdThCQkVcdTU5MDdcbiAgICovXG4gIHN0YXRpYyBnZXREZXZpY2UoKSB7XG4gICAgcmV0dXJuIHRoaXMuZGV0ZWN0TW9iaWxlRGV2aWNlKCkgPyBwLkRldmljZVR5cGVfTW9iaWxlX0RldmljZSA6IHcuaXNJblNpeXVhbldpZGdldCgpID8gcC5EZXZpY2VUeXBlX1NpeXVhbl9XaWRnZXQgOiB3LmlzSW5TaXl1YW5OZXdXaW4oKSA/IHAuRGV2aWNlVHlwZV9TaXl1YW5fTmV3V2luIDogaS5pc0VsZWN0cm9uKCkgPyBwLkRldmljZVR5cGVfU2l5dWFuX01haW5XaW4gOiB3LmlzSW5TaXl1YW5Ccm93c2VyKCkgPyBwLkRldmljZVR5cGVfU2l5dWFuX0Jyb3dzZXIgOiBpLmlzSW5DaHJvbWVFeHRlbnNpb24oKSA/IHAuRGV2aWNlVHlwZV9DaHJvbWVfRXh0ZW5zaW9uIDogaS5pc05vZGUgPyBwLkRldmljZVR5cGVfTm9kZSA6IHAuRGV2aWNlVHlwZV9DaHJvbWVfQnJvd3NlcjtcbiAgfVxuICAvKipcbiAgICogXHU2OEMwXHU2RDRCXHU3OUZCXHU1MkE4XHU3QUVGXG4gICAqIEBwcml2YXRlXG4gICAqL1xuICBzdGF0aWMgZGV0ZWN0TW9iaWxlRGV2aWNlKCkge1xuICAgIGxldCBlID0gITE7XG4gICAgcmV0dXJuIGkuaXNJbkJyb3dzZXIgJiYgZnVuY3Rpb24odCkge1xuICAgICAgKC8oYW5kcm9pZHxiYlxcZCt8bWVlZ28pLittb2JpbGV8YXZhbnRnb3xiYWRhXFwvfGJsYWNrYmVycnl8YmxhemVyfGNvbXBhbHxlbGFpbmV8ZmVubmVjfGhpcHRvcHxpZW1vYmlsZXxpcChob25lfG9kKXxpcmlzfGtpbmRsZXxsZ2UgfG1hZW1vfG1pZHB8bW1wfG1vYmlsZS4rZmlyZWZveHxuZXRmcm9udHxvcGVyYSBtKG9ifGluKWl8cGFsbSggb3MpP3xwaG9uZXxwKGl4aXxyZSlcXC98cGx1Y2tlcnxwb2NrZXR8cHNwfHNlcmllcyg0fDYpMHxzeW1iaWFufHRyZW98dXBcXC4oYnJvd3NlcnxsaW5rKXx2b2RhZm9uZXx3YXB8d2luZG93cyBjZXx4ZGF8eGlpbm8vaS50ZXN0KFxuICAgICAgICB0XG4gICAgICApIHx8IC8xMjA3fDYzMTB8NjU5MHwzZ3NvfDR0aHB8NTBbMS02XWl8Nzcwc3w4MDJzfGEgd2F8YWJhY3xhYyhlcnxvb3xzLSl8YWkoa298cm4pfGFsKGF2fGNhfGNvKXxhbW9pfGFuKGV4fG55fHl3KXxhcHR1fGFyKGNofGdvKXxhcyh0ZXx1cyl8YXR0d3xhdShkaXwtbXxyIHxzICl8YXZhbnxiZShja3xsbHxucSl8YmkobGJ8cmQpfGJsKGFjfGF6KXxicihlfHYpd3xidW1ifGJ3LShufHUpfGM1NVxcL3xjYXBpfGNjd2F8Y2RtLXxjZWxsfGNodG18Y2xkY3xjbWQtfGNvKG1wfG5kKXxjcmF3fGRhKGl0fGxsfG5nKXxkYnRlfGRjLXN8ZGV2aXxkaWNhfGRtb2J8ZG8oY3xwKW98ZHMoMTJ8LWQpfGVsKDQ5fGFpKXxlbShsMnx1bCl8ZXIoaWN8azApfGVzbDh8ZXooWzQtN10wfG9zfHdhfHplKXxmZXRjfGZseSgtfF8pfGcxIHV8ZzU2MHxnZW5lfGdmLTV8Zy1tb3xnbyhcXC53fG9kKXxncihhZHx1bil8aGFpZXxoY2l0fGhkLShtfHB8dCl8aGVpLXxoaShwdHx0YSl8aHAoIGl8aXApfGhzLWN8aHQoYygtfCB8X3xhfGd8cHxzfHQpfHRwKXxodShhd3x0Yyl8aS0oMjB8Z298bWEpfGkyMzB8aWFjKCB8LXxcXC8pfGlicm98aWRlYXxpZzAxfGlrb218aW0xa3xpbm5vfGlwYXF8aXJpc3xqYSh0fHYpYXxqYnJvfGplbXV8amlnc3xrZGRpfGtlaml8a2d0KCB8XFwvKXxrbG9ufGtwdCB8a3djLXxreW8oY3xrKXxsZShub3x4aSl8bGcoIGd8XFwvKGt8bHx1KXw1MHw1NHwtW2Etd10pfGxpYnd8bHlueHxtMS13fG0zZ2F8bTUwXFwvfG1hKHRlfHVpfHhvKXxtYygwMXwyMXxjYSl8bS1jcnxtZShyY3xyaSl8bWkobzh8b2F8dHMpfG1tZWZ8bW8oMDF8MDJ8Yml8ZGV8ZG98dCgtfCB8b3x2KXx6eil8bXQoNTB8cDF8diApfG13YnB8bXl3YXxuMTBbMC0yXXxuMjBbMi0zXXxuMzAoMHwyKXxuNTAoMHwyfDUpfG43KDAoMHwxKXwxMCl8bmUoKGN8bSktfG9ufHRmfHdmfHdnfHd0KXxub2soNnxpKXxuenBofG8yaW18b3AodGl8d3YpfG9yYW58b3dnMXxwODAwfHBhbihhfGR8dCl8cGR4Z3xwZygxM3wtKFsxLThdfGMpKXxwaGlsfHBpcmV8cGwoYXl8dWMpfHBuLTJ8cG8oY2t8cnR8c2UpfHByb3h8cHNpb3xwdC1nfHFhLWF8cWMoMDd8MTJ8MjF8MzJ8NjB8LVsyLTddfGktKXxxdGVrfHIzODB8cjYwMHxyYWtzfHJpbTl8cm8odmV8em8pfHM1NVxcL3xzYShnZXxtYXxtbXxtc3xueXx2YSl8c2MoMDF8aC18b298cC0pfHNka1xcL3xzZShjKC18MHwxKXw0N3xtY3xuZHxyaSl8c2doLXxzaGFyfHNpZSgtfG0pfHNrLTB8c2woNDV8aWQpfHNtKGFsfGFyfGIzfGl0fHQ1KXxzbyhmdHxueSl8c3AoMDF8aC18di18diApfHN5KDAxfG1iKXx0MigxOHw1MCl8dDYoMDB8MTB8MTgpfHRhKGd0fGxrKXx0Y2wtfHRkZy18dGVsKGl8bSl8dGltLXx0LW1vfHRvKHBsfHNoKXx0cyg3MHxtLXxtM3xtNSl8dHgtOXx1cChcXC5ifGcxfHNpKXx1dHN0fHY0MDB8djc1MHx2ZXJpfHZpKHJnfHRlKXx2ayg0MHw1WzAtM118LXYpfHZtNDB8dm9kYXx2dWxjfHZ4KDUyfDUzfDYwfDYxfDcwfDgwfDgxfDgzfDg1fDk4KXx3M2MoLXwgKXx3ZWJjfHdoaXR8d2koZyB8bmN8bncpfHdtbGJ8d29udXx4NzAwfHlhcy18eW91cnx6ZXRvfHp0ZS0vaS50ZXN0KFxuICAgICAgICB0LnN1YnN0cigwLCA0KVxuICAgICAgKSkgJiYgKGUgPSAhMCk7XG4gICAgfShuYXZpZ2F0b3IudXNlckFnZW50IHx8IG5hdmlnYXRvci52ZW5kb3IgfHwgd2luZG93Lm9wZXJhKSwgZTtcbiAgfVxufVxuZXhwb3J0IHtcbiAgbyBhcyBCYXNlUGF0aFR5cGVFbnVtLFxuICBpIGFzIEJyb3dzZXJVdGlsLFxuICB2IGFzIERldmljZURldGVjdGlvbixcbiAgcCBhcyBEZXZpY2VUeXBlRW51bSxcbiAgdyBhcyBTaXl1YW5EZXZpY2Vcbn07XG4iLCAiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMywgVGVyd2VyIC4gQWxsIHJpZ2h0cyByZXNlcnZlZC5cbiAqIERPIE5PVCBBTFRFUiBPUiBSRU1PVkUgQ09QWVJJR0hUIE5PVElDRVMgT1IgVEhJUyBGSUxFIEhFQURFUi5cbiAqXG4gKiBUaGlzIGNvZGUgaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeSBpdFxuICogdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2ZXJzaW9uIDIgb25seSwgYXNcbiAqIHB1Ymxpc2hlZCBieSB0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uLiAgVGVyd2VyIGRlc2lnbmF0ZXMgdGhpc1xuICogcGFydGljdWxhciBmaWxlIGFzIHN1YmplY3QgdG8gdGhlIFwiQ2xhc3NwYXRoXCIgZXhjZXB0aW9uIGFzIHByb3ZpZGVkXG4gKiBieSBUZXJ3ZXIgaW4gdGhlIExJQ0VOU0UgZmlsZSB0aGF0IGFjY29tcGFuaWVkIHRoaXMgY29kZS5cbiAqXG4gKiBUaGlzIGNvZGUgaXMgZGlzdHJpYnV0ZWQgaW4gdGhlIGhvcGUgdGhhdCBpdCB3aWxsIGJlIHVzZWZ1bCwgYnV0IFdJVEhPVVRcbiAqIEFOWSBXQVJSQU5UWTsgd2l0aG91dCBldmVuIHRoZSBpbXBsaWVkIHdhcnJhbnR5IG9mIE1FUkNIQU5UQUJJTElUWSBvclxuICogRklUTkVTUyBGT1IgQSBQQVJUSUNVTEFSIFBVUlBPU0UuICBTZWUgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlXG4gKiB2ZXJzaW9uIDIgZm9yIG1vcmUgZGV0YWlscyAoYSBjb3B5IGlzIGluY2x1ZGVkIGluIHRoZSBMSUNFTlNFIGZpbGUgdGhhdFxuICogYWNjb21wYW5pZWQgdGhpcyBjb2RlKS5cbiAqXG4gKiBZb3Ugc2hvdWxkIGhhdmUgcmVjZWl2ZWQgYSBjb3B5IG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2ZXJzaW9uXG4gKiAyIGFsb25nIHdpdGggdGhpcyB3b3JrOyBpZiBub3QsIHdyaXRlIHRvIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sXG4gKiBJbmMuLCA1MSBGcmFua2xpbiBTdCwgRmlmdGggRmxvb3IsIEJvc3RvbiwgTUEgMDIxMTAtMTMwMSBVU0EuXG4gKlxuICogUGxlYXNlIGNvbnRhY3QgVGVyd2VyLCBTaGVuemhlbiwgR3Vhbmdkb25nLCBDaGluYSwgeW91d2VpY3NAMTYzLmNvbVxuICogb3IgdmlzaXQgd3d3LnRlcndlci5zcGFjZSBpZiB5b3UgbmVlZCBhZGRpdGlvbmFsIGluZm9ybWF0aW9uIG9yIGhhdmUgYW55XG4gKiBxdWVzdGlvbnMuXG4gKi9cblxuaW1wb3J0IHsgQnJvd3NlclV0aWwsIFNpeXVhbkRldmljZSB9IGZyb20gXCJ6aGktZGV2aWNlXCJcblxuLyoqXG4gKiBcdTdBOTdcdTUzRTNcdTdCQTFcdTc0MDZcdTU2NjhcbiAqXG4gKiBAYXV0aG9yIHRlcndlclxuICogQHZlcnNpb24gMS4wLjBcbiAqIEBzaW5jZSAxLjAuMFxuICovXG5jbGFzcyBXaW5kb3dNYW5hZ2VyIHtcbiAgcHJpdmF0ZSBsb2dnZXI6IGFueVxuICBwcml2YXRlIGNvbW1vbjogYW55XG5cbiAgaW5pdChsb2dnZXI6IGFueSwgY29tbW9uOiBhbnkpIHtcbiAgICB0aGlzLmxvZ2dlciA9IGxvZ2dlclxuICAgIHRoaXMuY29tbW9uID0gY29tbW9uXG4gIH1cblxuICAvKipcbiAgICogXHU2MjUzXHU1RjAwXHU2NUIwXHU3QTk3XHU1M0UzXG4gICAqXG4gICAqIFx1NzkzQVx1NEY4Qlx1RkYxQVxuICAgKlxuICAgKiBgYGBcbiAgICogIyMgZGV2ZWxvcG1lbnRcbiAgICogd2luZG93TWFuYWdlci5vcGVuQnJvd3NlcldpbmRvdyhcImh0dHBzOi8vd3d3LmJhaWR1LmNvbVwiLCB1bmRlZmluZWQsIHVuZGVmaW5lZCwgdHJ1ZSwgZmFsc2UpXG4gICAqIHdpbmRvd01hbmFnZXIub3BlbkJyb3dzZXJXaW5kb3coXCJodHRwczovL3d3dy5iYWlkdS5jb21cIiwgeyBcImtleTFcIjogXCJ2YWx1ZTFcIiwgXCJrZXkyXCI6IFwidmFsdWUyXCIgfSwgdW5kZWZpbmVkLCB0cnVlLCBmYWxzZSlcbiAgICpcbiAgICogIyMgcHJvZHVjdGlvblxuICAgKiB3aW5kb3dNYW5hZ2VyLm9wZW5Ccm93c2VyV2luZG93KFwiaHR0cHM6Ly93d3cuYmFpZHUuY29tXCIpXG4gICAqIGBgYFxuICAgKlxuICAgKiBAcGFyYW0gdXJsIC0gdXJsXG4gICAqIEBwYXJhbSBwYXJhbXMgLSBcdTUzQzJcdTY1NzBcbiAgICogQHBhcmFtIHdpbiAtIFx1NzIzNlx1N0E5N1x1NTNFM1xuICAgKiBAcGFyYW0gaXNEZXYgLSBcdTY2MkZcdTU0MjZcdTYyNTNcdTVGMDBcdTVGMDBcdTUzRDFcdTgwMDVcdTVERTVcdTUxNzdcbiAgICogQHBhcmFtIG1vZGFsIC0gXHU2NjJGXHU1NDI2XHU2QTIxXHU2MDAxXG4gICAqL1xuICBwdWJsaWMgb3BlbkJyb3dzZXJXaW5kb3codXJsOiBzdHJpbmcsIHBhcmFtcz86IFJlY29yZDxzdHJpbmcsIHN0cmluZz4sIHdpbj86IGFueSwgaXNEZXYgPSBmYWxzZSwgbW9kYWwgPSBmYWxzZSkge1xuICAgIHRyeSB7XG4gICAgICBpZiAodGhpcy5jb21tb24uc3RyVXRpbC5pc0VtcHR5U3RyaW5nKHVybCkpIHtcbiAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJVcmwgY2Fubm90IGJlIGVtcHR5XCIpXG4gICAgICAgIHJldHVyblxuICAgICAgfVxuXG4gICAgICBpZiAoIUJyb3dzZXJVdGlsLmlzRWxlY3Ryb24oKSkge1xuICAgICAgICB0aGlzLmxvZ2dlci5pbmZvKFwiQnJvd3NlcldpbmRvdyBjYW4gb255IGJlIGF2YWlsYWJsZSBpbiBzaXl1YW4gRWxlY3Ryb24gZW52aXJvbm1lbnRcIilcbiAgICAgICAgcmV0dXJuXG4gICAgICB9XG5cbiAgICAgIGlmIChwYXJhbXMpIHtcbiAgICAgICAgT2JqZWN0LmtleXMocGFyYW1zKS5mb3JFYWNoKChrZXk6IHN0cmluZykgPT4ge1xuICAgICAgICAgIGNvbnN0IHZhbHVlID0gcGFyYW1zW2tleV1cbiAgICAgICAgICB1cmwgPSBCcm93c2VyVXRpbC5zZXRVcmxQYXJhbWV0ZXIodXJsLCBrZXksIHZhbHVlKVxuICAgICAgICB9KVxuICAgICAgfVxuXG4gICAgICB0aGlzLmxvZ2dlci5pbmZvKHRoaXMuY29tbW9uLnN0clV0aWwuZihcIk9wZW5pbmcgYSBuZXcgQnJvd3NlcldpbmRvdyBmcm9tIHVybCA9PiB7MH1cIiwgdXJsKSlcblxuICAgICAgY29uc3QgbWFpbldpbiA9IHdpbiA/PyBTaXl1YW5EZXZpY2Uuc2l5dWFuV2luZG93KClcbiAgICAgIGNvbnN0IHsgYXBwLCBCcm93c2VyV2luZG93LCBnZXRDdXJyZW50V2luZG93IH0gPSBtYWluV2luLnJlcXVpcmUoXCJAZWxlY3Ryb24vcmVtb3RlXCIpXG4gICAgICBjb25zdCByZW1vdGUgPSBtYWluV2luLnJlcXVpcmUoXCJAZWxlY3Ryb24vcmVtb3RlXCIpLnJlcXVpcmUoXCJAZWxlY3Ryb24vcmVtb3RlL21haW5cIilcbiAgICAgIGNvbnN0IG1haW5XaW5kb3cgPSBnZXRDdXJyZW50V2luZG93KClcbiAgICAgIGNvbnN0IG5ld1dpbmRvdyA9IG5ldyBCcm93c2VyV2luZG93KHtcbiAgICAgICAgcGFyZW50OiBtYWluV2luZG93LFxuICAgICAgICB3aWR0aDogOTAwLFxuICAgICAgICBoZWlnaHQ6IDc1MCxcbiAgICAgICAgcmVzaXphYmxlOiB0cnVlLFxuICAgICAgICBtb2RhbDogbW9kYWwsXG4gICAgICAgIGljb246IFNpeXVhbkRldmljZS5icm93c2VySm9pblBhdGgoXG4gICAgICAgICAgU2l5dWFuRGV2aWNlLnNpeXVhbldpbmRvdygpLnNpeXVhbi5jb25maWcuc3lzdGVtLmFwcERpcixcbiAgICAgICAgICBcInN0YWdlXCIsXG4gICAgICAgICAgXCJpY29uLWxhcmdlLnBuZ1wiXG4gICAgICAgICksXG4gICAgICAgIHRpdGxlQmFyT3ZlcmxheToge1xuICAgICAgICAgIGNvbG9yOiBcIiNjY2NjY2NhNVwiLFxuICAgICAgICAgIHN5bWJvbENvbG9yOiBcImJsYWNrXCIsXG4gICAgICAgIH0sXG4gICAgICAgIHdlYlByZWZlcmVuY2VzOiB7XG4gICAgICAgICAgbmF0aXZlV2luZG93T3BlbjogdHJ1ZSxcbiAgICAgICAgICBub2RlSW50ZWdyYXRpb246IHRydWUsXG4gICAgICAgICAgd2Vidmlld1RhZzogdHJ1ZSxcbiAgICAgICAgICB3ZWJTZWN1cml0eTogZmFsc2UsXG4gICAgICAgICAgY29udGV4dElzb2xhdGlvbjogZmFsc2UsXG4gICAgICAgIH0sXG4gICAgICB9KVxuXG4gICAgICBuZXdXaW5kb3cud2ViQ29udGVudHMudXNlckFnZW50ID0gYFNpWXVhbi8ke2FwcC5nZXRWZXJzaW9uKCl9IGh0dHBzOi8vYjNsb2cub3JnL3NpeXVhbiBFbGVjdHJvbmBcbiAgICAgIC8vIFx1NTE0MVx1OEJCOFxuICAgICAgcmVtb3RlLmVuYWJsZShuZXdXaW5kb3cud2ViQ29udGVudHMpXG4gICAgICBpZiAoaXNEZXYpIHtcbiAgICAgICAgbmV3V2luZG93LndlYkNvbnRlbnRzLm9wZW5EZXZUb29scygpXG4gICAgICB9XG4gICAgICBuZXdXaW5kb3cubG9hZFVSTCh1cmwpXG4gICAgfSBjYXRjaCAoZSkge1xuICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoXCJPcGVuIGJyb3dzZXIgd2luZG93IGZhaWxlZFwiLCBlKVxuICAgIH1cbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBXaW5kb3dNYW5hZ2VyXG4iLCAiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMywgVGVyd2VyIC4gQWxsIHJpZ2h0cyByZXNlcnZlZC5cbiAqIERPIE5PVCBBTFRFUiBPUiBSRU1PVkUgQ09QWVJJR0hUIE5PVElDRVMgT1IgVEhJUyBGSUxFIEhFQURFUi5cbiAqXG4gKiBUaGlzIGNvZGUgaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeSBpdFxuICogdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2ZXJzaW9uIDIgb25seSwgYXNcbiAqIHB1Ymxpc2hlZCBieSB0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uLiAgVGVyd2VyIGRlc2lnbmF0ZXMgdGhpc1xuICogcGFydGljdWxhciBmaWxlIGFzIHN1YmplY3QgdG8gdGhlIFwiQ2xhc3NwYXRoXCIgZXhjZXB0aW9uIGFzIHByb3ZpZGVkXG4gKiBieSBUZXJ3ZXIgaW4gdGhlIExJQ0VOU0UgZmlsZSB0aGF0IGFjY29tcGFuaWVkIHRoaXMgY29kZS5cbiAqXG4gKiBUaGlzIGNvZGUgaXMgZGlzdHJpYnV0ZWQgaW4gdGhlIGhvcGUgdGhhdCBpdCB3aWxsIGJlIHVzZWZ1bCwgYnV0IFdJVEhPVVRcbiAqIEFOWSBXQVJSQU5UWTsgd2l0aG91dCBldmVuIHRoZSBpbXBsaWVkIHdhcnJhbnR5IG9mIE1FUkNIQU5UQUJJTElUWSBvclxuICogRklUTkVTUyBGT1IgQSBQQVJUSUNVTEFSIFBVUlBPU0UuICBTZWUgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlXG4gKiB2ZXJzaW9uIDIgZm9yIG1vcmUgZGV0YWlscyAoYSBjb3B5IGlzIGluY2x1ZGVkIGluIHRoZSBMSUNFTlNFIGZpbGUgdGhhdFxuICogYWNjb21wYW5pZWQgdGhpcyBjb2RlKS5cbiAqXG4gKiBZb3Ugc2hvdWxkIGhhdmUgcmVjZWl2ZWQgYSBjb3B5IG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2ZXJzaW9uXG4gKiAyIGFsb25nIHdpdGggdGhpcyB3b3JrOyBpZiBub3QsIHdyaXRlIHRvIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sXG4gKiBJbmMuLCA1MSBGcmFua2xpbiBTdCwgRmlmdGggRmxvb3IsIEJvc3RvbiwgTUEgMDIxMTAtMTMwMSBVU0EuXG4gKlxuICogUGxlYXNlIGNvbnRhY3QgVGVyd2VyLCBTaGVuemhlbiwgR3Vhbmdkb25nLCBDaGluYSwgeW91d2VpY3NAMTYzLmNvbVxuICogb3IgdmlzaXQgd3d3LnRlcndlci5zcGFjZSBpZiB5b3UgbmVlZCBhZGRpdGlvbmFsIGluZm9ybWF0aW9uIG9yIGhhdmUgYW55XG4gKiBxdWVzdGlvbnMuXG4gKi9cblxuaW1wb3J0IFdpbmRvd01hbmFnZXIgZnJvbSBcIi4vV2luZG93TWFuYWdlclwiXG5pbXBvcnQgeyBTaXl1YW5EZXZpY2UgfSBmcm9tIFwiemhpLWRldmljZVwiXG5cbi8qKlxuICogXHU4RkQ5XHU5MUNDXHU3RURGXHU0RTAwXHU2MzAyXHU4RjdEXHU0RTAwXHU0RTJBXHU2NUI5XHU2Q0Q1XHVGRjBDXHU1M0VGXHU0RUU1XHU2MjUzXHU1RjAwIEVsZWN0cm9uIFx1NzY4NCBCcm93c2VyV2luZG93XG4gKlxuICogQGF1dGhvciB0ZXJ3ZXJcbiAqIEB2ZXJzaW9uIDEuMC4wXG4gKiBAc2luY2UgMS4wLjBcbiAqL1xuY2xhc3MgWmhpQnJvd3NlcldpbmRvdyB7XG4gIHByaXZhdGUgbG9nZ2VyOiBhbnlcblxuICBwcml2YXRlIHJlYWRvbmx5IHdpbmRvd01hbmFnZXJcblxuICBjb25zdHJ1Y3RvcigpIHtcbiAgICB0aGlzLndpbmRvd01hbmFnZXIgPSBuZXcgV2luZG93TWFuYWdlcigpXG4gIH1cblxuICBpbml0KGxvZ2dlcjogYW55LCBjb21tb246IGFueSkge1xuICAgIHRoaXMubG9nZ2VyID0gbG9nZ2VyXG4gICAgdGhpcy53aW5kb3dNYW5hZ2VyLmluaXQobG9nZ2VyLCBjb21tb24pXG4gIH1cblxuICAvKipcbiAgICogXHU2MzAyXHU4RjdEIEJyb3dzZXJXaW5kb3dcbiAgICpcbiAgICogQGF1dGhvciB0ZXJ3ZXJcbiAgICogQHNpbmNlIDEuMC4wXG4gICAqL1xuICBwdWJsaWMgaW5pdEJyb3dzZXJXaW5kb3coKSB7XG4gICAgY29uc3Qgd2luID0gU2l5dWFuRGV2aWNlLnNpeXVhbldpbmRvdygpXG4gICAgd2luLnpoaSA9IHdpbi56aGkgPz8ge31cbiAgICB3aW4uemhpLndpbmRvd01hbmFnZXIgPSB0aGlzLndpbmRvd01hbmFnZXJcbiAgICB0aGlzLmxvZ2dlci5pbmZvKFwiemhpV2luZG93IGluaXRlZFwiKVxuICAgIHJldHVybiB0aGlzLndpbmRvd01hbmFnZXJcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBaaGlCcm93c2VyV2luZG93XG4iXSwKICAibWFwcGluZ3MiOiAiOzs7Ozs7Ozs7QUFBQSxJQUFJLElBQUksT0FBTztBQUNmLElBQUksSUFBSSxDQUFDLEdBQUcsR0FBRyxNQUFNLEtBQUssSUFBSSxFQUFFLEdBQUcsR0FBRyxFQUFFLFlBQVksTUFBSSxjQUFjLE1BQUksVUFBVSxNQUFJLE9BQU8sRUFBRSxDQUFDLElBQUksRUFBRSxDQUFDLElBQUk7QUFDN0csSUFBSSxJQUFJLENBQUMsR0FBRyxHQUFHLE9BQU8sRUFBRSxHQUFHLE9BQU8sS0FBSyxXQUFXLElBQUksS0FBSyxHQUFHLENBQUMsR0FBRztBQUNsRSxJQUFNLElBQUksTUFBTTtBQUFBO0FBQUE7QUFBQTtBQUFBLEVBSWQsT0FBTyxzQkFBc0I7QUFDM0IsV0FBTyxFQUFFLGNBQWMsT0FBTyxTQUFTLEtBQUssUUFBUSxxQkFBcUIsSUFBSSxLQUFLO0FBQUEsRUFDcEY7QUFDRjtBQUNBLElBQUksSUFBSTtBQUlSLEVBQUUsR0FBRyxVQUFVLE9BQU8sVUFBVSxHQUFHO0FBQUE7QUFBQTtBQUduQyxFQUFFLEdBQUcsZUFBZSxPQUFPLFNBQVMsR0FBRztBQUFBO0FBQUE7QUFHdkMsRUFBRSxHQUFHLG9CQUFvQixHQUFHO0FBQUE7QUFBQTtBQUc1QixFQUFFLEdBQUcsY0FBYyxNQUFNLENBQUMsRUFBRSxlQUFlLENBQUMsT0FBTyxhQUFhLENBQUMsT0FBTyxVQUFVLFlBQVksUUFBSyxXQUFXLEtBQUssT0FBTyxVQUFVLFNBQVMsQ0FBQztBQUFBO0FBQUE7QUFHOUksRUFBRSxHQUFHLGNBQWMsTUFBTSxFQUFFLFdBQVcsS0FBSyxFQUFFLE1BQU07QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUtuRCxFQUFFLEdBQUcsa0JBQWtCLENBQUMsTUFBTTtBQUM1QixNQUFJLENBQUMsRUFBRTtBQUNMLFdBQU87QUFDVCxRQUFNLElBQUksT0FBTyxTQUFTLE9BQU8sVUFBVSxDQUFDLEVBQUUsTUFBTSxHQUFHO0FBQ3ZELFdBQVMsSUFBSSxHQUFHLElBQUksRUFBRSxRQUFRLEtBQUs7QUFDakMsVUFBTSxJQUFJLEVBQUUsQ0FBQyxFQUFFLE1BQU0sR0FBRztBQUN4QixRQUFJLEVBQUUsQ0FBQyxNQUFNO0FBQ1gsYUFBTyxFQUFFLENBQUM7QUFBQSxFQUNkO0FBQ0EsU0FBTztBQUNULENBQUM7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQWlCRCxFQUFFLEdBQUcsbUJBQW1CLENBQUMsR0FBRyxHQUFHLE1BQU07QUFDbkMsT0FBSyxTQUFTLElBQUk7QUFDbEIsUUFBTSxJQUFJLElBQUksT0FBTyxTQUFTLElBQUksY0FBYztBQUNoRCxNQUFJLEVBQUUsT0FBTyxDQUFDLEtBQUs7QUFDakIsV0FBTyxFQUFFLFFBQVEsR0FBRyxPQUFPLElBQUksSUFBSTtBQUNyQyxRQUFNLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxNQUFNLEdBQUcsR0FBRyxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsTUFBTSxHQUFHLEdBQUcsSUFBSSxJQUFJLGdCQUFnQixDQUFDO0FBQzdFLElBQUUsSUFBSSxHQUFHLENBQUM7QUFDVixRQUFNLElBQUksRUFBRSxTQUFTLEdBQUcsSUFBSSxLQUFLLElBQUksTUFBTSxJQUFJO0FBQy9DLFNBQU8sSUFBSSxJQUFJLE1BQU0sSUFBSTtBQUMzQixDQUFDO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBT0QsRUFBRSxHQUFHLG1CQUFtQixDQUFDLEdBQUcsR0FBRyxNQUFNO0FBQ25DLE1BQUksRUFBRSxTQUFTLENBQUM7QUFDZCxXQUFPLEVBQUUsZ0JBQWdCLEdBQUcsR0FBRyxDQUFDO0FBQ2xDLFFBQU0sSUFBSSxFQUFFLE1BQU0sR0FBRztBQUNyQixNQUFJLElBQUksRUFBRSxDQUFDO0FBQ1gsUUFBTSxJQUFJLEVBQUUsQ0FBQztBQUNiLFNBQU8sRUFBRSxTQUFTLEdBQUcsSUFBSSxLQUFLLElBQUksS0FBSyxNQUFNLEtBQUssSUFBSSxLQUFLLEtBQUssTUFBTSxLQUFLLE1BQU0sSUFBSTtBQUN2RixDQUFDO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQU1ELEVBQUUsR0FBRyxpQkFBaUIsQ0FBQyxHQUFHLElBQUksUUFBUTtBQUNwQyxhQUFXLFdBQVc7QUFDcEIsUUFBSSxFQUFFLGFBQWE7QUFDakIsWUFBTSxJQUFJLE9BQU8sU0FBUztBQUMxQixhQUFPLFNBQVMsT0FBTyxFQUFFLGdCQUFnQixHQUFHLE9BQU8sQ0FBQztBQUFBLElBQ3REO0FBQUEsRUFDRixHQUFHLENBQUM7QUFDTixDQUFDO0FBQUE7QUFBQTtBQUdELEVBQUUsR0FBRyxjQUFjLE1BQU07QUFDdkIsYUFBVyxXQUFXO0FBQ3BCLE1BQUUsZUFBZSxPQUFPLFNBQVMsT0FBTztBQUFBLEVBQzFDLEdBQUcsR0FBRztBQUNSLENBQUM7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBTUQsRUFBRSxHQUFHLGlDQUFpQyxDQUFDLEdBQUcsTUFBTTtBQUM5QyxPQUFLLEVBQUUsQ0FBQyxHQUFHLFdBQVcsV0FBVztBQUMvQixNQUFFLGVBQWUsT0FBTyxTQUFTLE9BQU87QUFBQSxFQUMxQyxHQUFHLEdBQUc7QUFDUixDQUFDO0FBQ0QsSUFBSSxJQUFxQixrQkFBQyxPQUFPLEVBQUUsMEJBQTBCLGNBQWMsRUFBRSxvQkFBb0IsUUFBUSxFQUFFLHNCQUFzQixVQUFVLEVBQUUsd0JBQXdCLFlBQVksRUFBRSxvQkFBb0IsUUFBUSxJQUFJLEtBQUssQ0FBQyxDQUFDO0FBQzFOLElBQU0sSUFBSSxNQUFNO0FBQUE7QUFBQTtBQUFBO0FBQUEsRUFJZCxPQUFPLG9CQUFvQjtBQUN6QixXQUFPLEVBQUUsY0FBYyxPQUFPLE9BQU8sU0FBUyxPQUFPLE9BQU8sT0FBTyxPQUFPLE1BQU07QUFBQSxFQUNsRjtBQUFBO0FBQUE7QUFBQTtBQUFBLEVBSUEsT0FBTyxlQUFlO0FBQ3BCLFFBQUk7QUFDSixXQUFPLEtBQUssaUJBQWlCLElBQUksSUFBSSxPQUFPLFNBQVMsS0FBSyxpQkFBaUIsS0FBSyxLQUFLLGtCQUFrQixLQUFLLE9BQU8sU0FBUyxNQUFNLElBQUksU0FBUyxJQUFJLFFBQVE7QUFBQSxFQUM3SjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLEVBYUEsYUFBYSxTQUFTLEdBQUcsR0FBRztBQUMxQixRQUFJLElBQUk7QUFDUixZQUFRLEdBQUc7QUFBQSxNQUNULEtBQUssRUFBRTtBQUNMLFlBQUksS0FBSyxnQkFBZ0IsS0FBSyw2QkFBNkIsR0FBRyxDQUFDO0FBQy9EO0FBQUEsTUFDRixLQUFLLEVBQUU7QUFDTCxZQUFJLEtBQUssZ0JBQWdCLEtBQUssdUJBQXVCLEdBQUcsQ0FBQztBQUN6RDtBQUFBLE1BQ0YsS0FBSyxFQUFFO0FBQ0wsWUFBSSxLQUFLLGdCQUFnQixLQUFLLHdCQUF3QixHQUFHLENBQUM7QUFDMUQ7QUFBQSxNQUNGLEtBQUssRUFBRTtBQUNMLFlBQUksS0FBSyxnQkFBZ0IsS0FBSyxxQkFBcUIsR0FBRyxDQUFDO0FBQ3ZEO0FBQUEsTUFDRjtBQUNFLGNBQU0sSUFBSSxNQUFNLHVCQUF1QjtBQUFBLElBQzNDO0FBQ0EsVUFBTSxFQUFFLFNBQVMsRUFBRSxJQUFJLE1BQU07QUFBQTtBQUFBLE1BRTNCO0FBQUE7QUFFRixXQUFPO0FBQUEsRUFDVDtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxFQWtFQSxhQUFhLGlCQUFpQixHQUFHO0FBQy9CLFdBQU8sTUFBTSxLQUFLLFNBQVMsR0FBRyxFQUFFLHFCQUFxQjtBQUFBLEVBQ3ZEO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLEVBU0EsT0FBTyxZQUFZLEdBQUc7QUFDcEIsUUFBSSxFQUFFLFdBQVcsR0FBRztBQUNsQixZQUFNLElBQUksS0FBSyxXQUFXLE1BQU07QUFDaEMsVUFBSTtBQUNGLGVBQU8sRUFBRSxLQUFLLEdBQUcsQ0FBQztBQUFBLElBQ3RCO0FBQ0EsV0FBTyxLQUFLLGdCQUFnQixHQUFHLENBQUM7QUFBQSxFQUNsQztBQUFBLEVBQ0EsT0FBTyxtQkFBbUIsR0FBRztBQUMzQixXQUFPLEVBQUUsS0FBSyxFQUFFLGdCQUFnQjtBQUFBLEVBQ2xDO0FBQUE7QUFBQTtBQUFBO0FBQUEsRUFJQSxPQUFPLGlCQUFpQjtBQUN0QixVQUFNLElBQUksS0FBSyxhQUFhO0FBQzVCLFFBQUksQ0FBQztBQUNILFlBQU0sSUFBSSxNQUFNLG1CQUFtQjtBQUNyQyxXQUFPLEVBQUUsT0FBTyxPQUFPLE9BQU87QUFBQSxFQUNoQztBQUFBO0FBQUE7QUFBQTtBQUFBLEVBSUEsT0FBTyxpQkFBaUI7QUFDdEIsVUFBTSxJQUFJLEtBQUssYUFBYTtBQUM1QixRQUFJLENBQUM7QUFDSCxZQUFNLElBQUksTUFBTSxtQkFBbUI7QUFDckMsV0FBTyxFQUFFLE9BQU8sT0FBTyxPQUFPO0FBQUEsRUFDaEM7QUFBQTtBQUFBO0FBQUE7QUFBQSxFQUlBLE9BQU8seUJBQXlCO0FBQzlCLFFBQUksQ0FBQyxLQUFLLGFBQWE7QUFDckIsWUFBTSxJQUFJLE1BQU0sbUJBQW1CO0FBQ3JDLFdBQU87QUFBQSxFQUNUO0FBQUE7QUFBQTtBQUFBO0FBQUEsRUFJQSxPQUFPLHVCQUF1QjtBQUM1QixXQUFPLEtBQUssU0FBUyxLQUFLLGVBQWUsR0FBRyxZQUFZO0FBQUEsRUFDMUQ7QUFBQTtBQUFBO0FBQUE7QUFBQSxFQUlBLE9BQU8sK0JBQStCO0FBQ3BDLFFBQUksQ0FBQyxLQUFLLGFBQWE7QUFDckIsWUFBTSxJQUFJLE1BQU0sbUJBQW1CO0FBQ3JDLFdBQU8sS0FBSyxnQkFBZ0IsSUFBSSxZQUFZO0FBQUEsRUFDOUM7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxFQVVBLE9BQU8sa0JBQWtCO0FBQ3ZCLFFBQUksRUFBRSxXQUFXO0FBQ2YsYUFBTyxLQUFLLFNBQVMsS0FBSyxxQkFBcUIsR0FBRyxRQUFRO0FBQzVEO0FBQ0UsWUFBTSxJQUFJLEtBQUssYUFBYTtBQUM1QixVQUFJLENBQUM7QUFDSCxjQUFNLElBQUksTUFBTSxtQkFBbUI7QUFDckMsYUFBTyxLQUFLLFNBQVMsRUFBRSxTQUFTLFFBQVEsY0FBYyxRQUFRO0FBQUEsSUFDaEU7QUFBQSxFQUNGO0FBQUE7QUFBQTtBQUFBO0FBQUEsRUFJQSxPQUFPLDBCQUEwQjtBQUMvQixRQUFJLENBQUMsS0FBSyxhQUFhO0FBQ3JCLFlBQU0sSUFBSSxNQUFNLG1CQUFtQjtBQUNyQyxXQUFPLEtBQUssZ0JBQWdCLElBQUksY0FBYyxRQUFRO0FBQUEsRUFDeEQ7QUFBQTtBQUFBO0FBQUE7QUFBQSxFQUlBLE9BQU8sZUFBZTtBQUNwQixXQUFPLEtBQUssU0FBUyxLQUFLLGdCQUFnQixHQUFHLEtBQUs7QUFBQSxFQUNwRDtBQUFBO0FBQUE7QUFBQTtBQUFBLEVBSUEsT0FBTyx1QkFBdUI7QUFDNUIsV0FBTyxLQUFLLGdCQUFnQixLQUFLLHdCQUF3QixHQUFHLEtBQUs7QUFBQSxFQUNuRTtBQUNGO0FBQ0EsSUFBSSxJQUFJO0FBSVIsRUFBRSxHQUFHLG9CQUFvQixNQUFNLEVBQUUsY0FBYyxPQUFPLGdCQUFnQixRQUFRLE9BQU8sYUFBYSxpQkFBaUIsUUFBUSxPQUFPLGFBQWEsY0FBYyxpQkFBaUIsUUFBUSxPQUFPLGFBQWEsY0FBYyxjQUFjLGFBQWEsY0FBYyxNQUFNLEtBQUssS0FBRTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBUTlRLEVBQUUsR0FBRyxvQkFBb0IsTUFBTSxDQUFDLEVBQUUsZUFBZSxDQUFDLEVBQUUsV0FBVyxJQUFJLFFBQUssT0FBTyxPQUFPLFNBQVMsT0FBTyxPQUFPLE9BQU8sZUFBZSxHQUFHO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBVXRJLEVBQUUsR0FBRyxjQUFjLENBQUMsR0FBRyxJQUFJLE1BQUksSUFBSSxFQUFFLHNCQUFzQjtBQUN6RCxNQUFJLENBQUMsRUFBRSxXQUFXO0FBQ2hCLFVBQU0sSUFBSSxNQUFNLCtCQUErQjtBQUNqRCxNQUFJLElBQUk7QUFDUixNQUFJLENBQUM7QUFDSCxZQUFRLEdBQUc7QUFBQSxNQUNULEtBQUssRUFBRTtBQUNMLFlBQUksRUFBRSxTQUFTLEVBQUUscUJBQXFCLEdBQUcsQ0FBQztBQUMxQztBQUFBLE1BQ0YsS0FBSyxFQUFFO0FBQ0wsWUFBSSxFQUFFLFNBQVMsRUFBRSxlQUFlLEdBQUcsQ0FBQztBQUNwQztBQUFBLE1BQ0YsS0FBSyxFQUFFO0FBQ0wsWUFBSSxFQUFFLFNBQVMsRUFBRSxxQkFBcUIsR0FBRyxVQUFVLENBQUM7QUFDcEQ7QUFBQSxNQUNGLEtBQUssRUFBRTtBQUNMLFlBQUksRUFBRSxTQUFTLEVBQUUscUJBQXFCLEdBQUcsVUFBVSxPQUFPLENBQUM7QUFDM0Q7QUFBQSxNQUNGO0FBQ0UsY0FBTSxJQUFJLE1BQU0sa0RBQWtEO0FBQUEsSUFDdEU7QUFDRixRQUFNLElBQUksRUFBRSxhQUFhO0FBQ3pCLE1BQUksQ0FBQztBQUNILFdBQU8sVUFBUSxDQUFDO0FBQ2xCLE1BQUksT0FBTyxFQUFFLFVBQVU7QUFDckIsV0FBTyxFQUFFLFFBQVEsQ0FBQztBQUN0QixDQUFDO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFLRCxFQUFFLEdBQUcsd0JBQXdCLENBQUMsTUFBTSxFQUFFLFdBQVcsR0FBRyxPQUFJLEVBQUUsdUJBQXVCLENBQUM7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUtsRixFQUFFLEdBQUcsa0JBQWtCLENBQUMsTUFBTSxFQUFFLFdBQVcsR0FBRyxPQUFJLEVBQUUsaUJBQWlCLENBQUM7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUt0RSxFQUFFLEdBQUcsb0JBQW9CLENBQUMsTUFBTSxFQUFFLFdBQVcsR0FBRyxPQUFJLEVBQUUsbUJBQW1CLENBQUM7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUsxRSxFQUFFLEdBQUcsc0JBQXNCLENBQUMsTUFBTSxFQUFFLFdBQVcsR0FBRyxPQUFJLEVBQUUscUJBQXFCLENBQUM7OztBQzdXOUUsSUFBTSxnQkFBTixNQUFvQjtBQUFBLEVBQ1Y7QUFBQSxFQUNBO0FBQUEsRUFFUixLQUFLLFFBQWEsUUFBYTtBQUM3QixTQUFLLFNBQVM7QUFDZCxTQUFLLFNBQVM7QUFBQSxFQUNoQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxFQXNCTyxrQkFBa0IsS0FBYSxRQUFpQyxLQUFXLFFBQVEsT0FBTyxRQUFRLE9BQU87QUFDOUcsUUFBSTtBQUNGLFVBQUksS0FBSyxPQUFPLFFBQVEsY0FBYyxHQUFHLEdBQUc7QUFDMUMsYUFBSyxPQUFPLE1BQU0scUJBQXFCO0FBQ3ZDO0FBQUEsTUFDRjtBQUVBLFVBQUksQ0FBQyxFQUFZLFdBQVcsR0FBRztBQUM3QixhQUFLLE9BQU8sS0FBSyxtRUFBbUU7QUFDcEY7QUFBQSxNQUNGO0FBRUEsVUFBSSxRQUFRO0FBQ1YsZUFBTyxLQUFLLE1BQU0sRUFBRSxRQUFRLENBQUMsUUFBZ0I7QUFDM0MsZ0JBQU0sUUFBUSxPQUFPLEdBQUc7QUFDeEIsZ0JBQU0sRUFBWSxnQkFBZ0IsS0FBSyxLQUFLLEtBQUs7QUFBQSxRQUNuRCxDQUFDO0FBQUEsTUFDSDtBQUVBLFdBQUssT0FBTyxLQUFLLEtBQUssT0FBTyxRQUFRLEVBQUUsK0NBQStDLEdBQUcsQ0FBQztBQUUxRixZQUFNLFVBQVUsT0FBTyxFQUFhLGFBQWE7QUFDakQsWUFBTSxFQUFFLEtBQUssZUFBZSxpQkFBaUIsSUFBSSxRQUFRLFFBQVEsa0JBQWtCO0FBQ25GLFlBQU0sU0FBUyxRQUFRLFFBQVEsa0JBQWtCLEVBQUUsUUFBUSx1QkFBdUI7QUFDbEYsWUFBTSxhQUFhLGlCQUFpQjtBQUNwQyxZQUFNLFlBQVksSUFBSSxjQUFjO0FBQUEsUUFDbEMsUUFBUTtBQUFBLFFBQ1IsT0FBTztBQUFBLFFBQ1AsUUFBUTtBQUFBLFFBQ1IsV0FBVztBQUFBLFFBQ1g7QUFBQSxRQUNBLE1BQU0sRUFBYTtBQUFBLFVBQ2pCLEVBQWEsYUFBYSxFQUFFLE9BQU8sT0FBTyxPQUFPO0FBQUEsVUFDakQ7QUFBQSxVQUNBO0FBQUEsUUFDRjtBQUFBLFFBQ0EsaUJBQWlCO0FBQUEsVUFDZixPQUFPO0FBQUEsVUFDUCxhQUFhO0FBQUEsUUFDZjtBQUFBLFFBQ0EsZ0JBQWdCO0FBQUEsVUFDZCxrQkFBa0I7QUFBQSxVQUNsQixpQkFBaUI7QUFBQSxVQUNqQixZQUFZO0FBQUEsVUFDWixhQUFhO0FBQUEsVUFDYixrQkFBa0I7QUFBQSxRQUNwQjtBQUFBLE1BQ0YsQ0FBQztBQUVELGdCQUFVLFlBQVksWUFBWSxVQUFVLElBQUksV0FBVztBQUUzRCxhQUFPLE9BQU8sVUFBVSxXQUFXO0FBQ25DLFVBQUksT0FBTztBQUNULGtCQUFVLFlBQVksYUFBYTtBQUFBLE1BQ3JDO0FBQ0EsZ0JBQVUsUUFBUSxHQUFHO0FBQUEsSUFDdkIsU0FBUyxHQUFQO0FBQ0EsV0FBSyxPQUFPLE1BQU0sOEJBQThCLENBQUM7QUFBQSxJQUNuRDtBQUFBLEVBQ0Y7QUFDRjtBQUVBLElBQU8sd0JBQVE7OztBQzFGZixJQUFNLG1CQUFOLE1BQXVCO0FBQUEsRUFDYjtBQUFBLEVBRVM7QUFBQSxFQUVqQixjQUFjO0FBQ1osU0FBSyxnQkFBZ0IsSUFBSSxzQkFBYztBQUFBLEVBQ3pDO0FBQUEsRUFFQSxLQUFLLFFBQWEsUUFBYTtBQUM3QixTQUFLLFNBQVM7QUFDZCxTQUFLLGNBQWMsS0FBSyxRQUFRLE1BQU07QUFBQSxFQUN4QztBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLEVBUU8sb0JBQW9CO0FBQ3pCLFVBQU0sTUFBTSxFQUFhLGFBQWE7QUFDdEMsUUFBSSxNQUFNLElBQUksT0FBTyxDQUFDO0FBQ3RCLFFBQUksSUFBSSxnQkFBZ0IsS0FBSztBQUM3QixTQUFLLE9BQU8sS0FBSyxrQkFBa0I7QUFDbkMsV0FBTyxLQUFLO0FBQUEsRUFDZDtBQUNGO0FBRUEsSUFBTyx5QkFBUTsiLAogICJuYW1lcyI6IFtdCn0K diff --git a/public/libs/zhi-electron/lib/browser-window/WindowManager.d.ts.map b/public/libs/zhi-electron/lib/browser-window/WindowManager.d.ts.map new file mode 100644 index 0000000..dd72e91 --- /dev/null +++ b/public/libs/zhi-electron/lib/browser-window/WindowManager.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"WindowManager.d.ts","sourceRoot":"","sources":["../../../src/lib/browser-window/WindowManager.ts"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,cAAM,aAAa;IACjB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAAK;IAEnB,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;IAK7B;;;;;;;;;;;;;;;;;;;OAmBG;IACI,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,UAAQ,EAAE,KAAK,UAAQ;CA4D/G;AAED,eAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/public/libs/zhi-electron/lib/browser-window/index.d.ts b/public/libs/zhi-electron/lib/browser-window/index.d.ts new file mode 100644 index 0000000..4bcd9e1 --- /dev/null +++ b/public/libs/zhi-electron/lib/browser-window/index.d.ts @@ -0,0 +1,23 @@ +import WindowManager from "./WindowManager"; +/** + * 这里统一挂载一个方法,可以打开 Electron 的 BrowserWindow + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class ZhiBrowserWindow { + private logger; + private readonly windowManager; + constructor(); + init(logger: any, common: any): void; + /** + * 挂载 BrowserWindow + * + * @author terwer + * @since 1.0.0 + */ + initBrowserWindow(): WindowManager; +} +export default ZhiBrowserWindow; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/public/libs/zhi-electron/lib/browser-window/index.d.ts.map b/public/libs/zhi-electron/lib/browser-window/index.d.ts.map new file mode 100644 index 0000000..7a90cd4 --- /dev/null +++ b/public/libs/zhi-electron/lib/browser-window/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/browser-window/index.ts"],"names":[],"mappings":"AAyBA,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAG3C;;;;;;GAMG;AACH,cAAM,gBAAgB;IACpB,OAAO,CAAC,MAAM,CAAK;IAEnB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAA;;IAM9B,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;IAK7B;;;;;OAKG;IACI,iBAAiB;CAKzB;AAED,eAAe,gBAAgB,CAAA"} \ No newline at end of file diff --git a/public/libs/zhi-env/README.md b/public/libs/zhi-env/README.md new file mode 100644 index 0000000..3a899e5 --- /dev/null +++ b/public/libs/zhi-env/README.md @@ -0,0 +1,150 @@ +# zhi-env + +a cross-platform env config lib + +## Usage + +For simple use + +```js +import { Env } from "zhi-env" + +const env = new Env({ + "some-key": "some-value", +}) +const val = env.getEnv("some-key") +console.log("val=>", val) +``` + +For `vite` + +```js +import { Env } from "zhi-env" + +const env = new Env(import.meta.env) +const val = env.getEnv("some-key") +console.log("val=>", val) +``` + +For `Nuxt` framework + +```ts +// https://github.com/vitejs/vite/issues/9539#issuecomment-1206301266 + +import { Env } from "zhi-env" + +const nuxtEnv = useRuntimeConfig() +const env = new Env(nuxtEnv) +// 访问公共变量 +// const env = new Env(nuxtEnv.public) + +const val = env.getEnv("some-key") +console.log("val=>", val) +``` + +For Astro framework or other libs + +```ts +import { Env } from "zhi-env" + +// 1 add "module": "esnext" to tsconfig.json +// add "target": "esnext" to tsconfig.json +// 2 add env.d.ts +// ``` +// interface ImportMeta { +// readonly env: ImportMetaEnv +// } +// ``` +// 3 (optional) if you are using esbuild, add define to esbuild. +// ``` +// const defineEnv = { +// NODE_ENV: isProduction ? "production" : "development", +// ...getNormalizedEnvDefines(["NODE", "VITE_"]), +// } +// bundledEsbuildConfig.define = {} +// bundledEsbuildConfig.define = { +// ...bundledEsbuildConfig.define, +// "import.meta.env": JSON.stringify(defineEnv), +// } +// ``` + +const envMeta = import.meta.env +const env = new Env(import.meta.env) + +const val = env.getEnv("some-key") +console.log("val=>", val) +``` + +For unit tests + +- vitestrecommend + +```ts +// simple +describe("zhiEnv", () => { + it("test env", () => { + const env = new Env(import.meta.env) + expect(env.getEnv(EnvConstants.NODE_ENV_KEY)).toEqual("test") + }) +}) +``` + +- jest + +```ts +import { getNormalizedEnvDefines } from "../../../packages/esbuild-config-custom/esmUtils" + +describe("zhiEnv", () => { + const NOT_EXIST_KEY = "NOT_EXIST_KEY" + getNormalizedEnvDefines(["NODE", "VITE_"]) + + it("test env", () => { + const env = new Env(import.meta.env) + expect(env.getEnv(EnvConstants.NODE_ENV_KEY)).toEqual("test") + }) + + it("test debug mode", () => { + const env = new Env(import.meta.env) + expect(env.getEnv(EnvConstants.VITE_DEBUG_MODE_KEY)).toEqual("true") + }) +}) +``` + +## Deps + +``` +## Congregations! zhi-env need no deps, it is just pure js code 🎉 +``` + +## Dev + +```bash +pnpm dev -F zhi-env +``` + +## Build + +```bash +pnpm build -F zhi-env +``` + +## Api + +```bash +pnpm doc -F zhi-env +pnpm md -F zhi-env +``` + +## Test + +Execute the unit tests via [vitest](https://vitest.dev) + +```bash +pnpm test -F zhi-env +``` + +## Publish + +```bash +pnpm publish -F zhi-env --tag latest +``` \ No newline at end of file diff --git a/public/libs/zhi-env/index.d.ts b/public/libs/zhi-env/index.d.ts new file mode 100644 index 0000000..8a47b85 --- /dev/null +++ b/public/libs/zhi-env/index.d.ts @@ -0,0 +1,8 @@ +/** + * @packageDocumentation + * zhi-env 通用环境变量模块 + */ +import EnvConstants from "./lib/EnvConstants"; +import Env from "./lib/zhi-env"; +export { Env }; +export { EnvConstants }; diff --git a/public/libs/zhi-env/index.js b/public/libs/zhi-env/index.js new file mode 100644 index 0000000..a12dc8f --- /dev/null +++ b/public/libs/zhi-env/index.js @@ -0,0 +1,88 @@ +var _ = Object.defineProperty; +var D = (i, t, e) => t in i ? _(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e; +var r = (i, t, e) => (D(i, typeof t != "symbol" ? t + "" : t, e), e); +class E { +} +/** + * Node环境 + */ +r(E, "NODE_ENV_KEY", "NODE_ENV"), /** + * 开发环境 + */ +r(E, "NODE_ENV_DEVELOPMENT", "development"), /** + * 生产环境 + */ +r(E, "NODE_ENV_PRODUCTION", "production"), /** + * 测试环境 + */ +r(E, "NODE_ENV_TEST", "test"), /** + * 是否处于调试模式 + */ +r(E, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); +class N { + /** + * 环境初始化 + * + * @param envMeta - 需要传入 {"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false} 。特别提醒:此参数是静态元数据,取决于最终使用的项目。因此仅仅在最终使用的地方显示传递此值,中间项目请保持参数传递 + * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} + */ + constructor(t) { + r(this, "envMeta"); + this.envMeta = t; + } + /** + * 是否是开发阶段调试 + */ + isNodeDev() { + return this.getEnv(E.NODE_ENV_KEY) === E.NODE_ENV_DEVELOPMENT; + } + /** + * 是否是调试阶段 + */ + isDev() { + return this.isNodeDev() || this.getBooleanEnv(E.VITE_DEBUG_MODE_KEY); + } + /** + * 获取环境变量,key不存在返回undefined + * @param key - key + */ + getEnv(t) { + let e; + try { + this.envMeta[t] && (e = this.envMeta[t]); + } catch { + } + return e; + } + /** + * 获取String类型的环境变量,key不存在直接返回空值 + * @param key - key + */ + getStringEnv(t) { + return this.getEnv(t) ?? ""; + } + /** + * 获取Boolean类型的环境变量,key不存在返回false + * @param key - key + */ + getBooleanEnv(t) { + let e = !1; + return this.getEnv(t) && (e = this.getStringEnv(t).toLowerCase() === "true"), e; + } + /** + * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 + * + * @param key - key + * @param defaultValue - 默认值 + * @since 0.1.0 + * @author terwer + */ + getEnvOrDefault(t, e) { + const n = this.getStringEnv(t); + return n.trim().length == 0 ? e : n; + } +} +export { + N as Env, + E as EnvConstants +}; diff --git a/public/libs/zhi-env/lib/EnvConstants.d.ts b/public/libs/zhi-env/lib/EnvConstants.d.ts new file mode 100644 index 0000000..b72bb16 --- /dev/null +++ b/public/libs/zhi-env/lib/EnvConstants.d.ts @@ -0,0 +1,30 @@ +/** + * 预定义的环境变量 + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare class EnvConstants { + /** + * Node环境 + */ + static NODE_ENV_KEY: string; + /** + * 开发环境 + */ + static NODE_ENV_DEVELOPMENT: string; + /** + * 生产环境 + */ + static NODE_ENV_PRODUCTION: string; + /** + * 测试环境 + */ + static NODE_ENV_TEST: string; + /** + * 是否处于调试模式 + */ + static VITE_DEBUG_MODE_KEY: string; +} +export default EnvConstants; diff --git a/public/libs/zhi-env/lib/zhi-env.d.ts b/public/libs/zhi-env/lib/zhi-env.d.ts new file mode 100644 index 0000000..4420f7d --- /dev/null +++ b/public/libs/zhi-env/lib/zhi-env.d.ts @@ -0,0 +1,51 @@ +/** + * 环境变量工具类 + * + * @public + * @author terwer + * @description 跨平台环境变量读取 + * @since 0.0.1 + */ +declare class Env { + private readonly envMeta; + /** + * 是否是开发阶段调试 + */ + isNodeDev(): boolean; + /** + * 是否是调试阶段 + */ + isDev(): boolean; + /** + * 环境初始化 + * + * @param envMeta - 需要传入 import.meta.env 。特别提醒:此参数是静态元数据,取决于最终使用的项目。因此仅仅在最终使用的地方显示传递此值,中间项目请保持参数传递 + * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} + */ + constructor(envMeta: any); + /** + * 获取环境变量,key不存在返回undefined + * @param key - key + */ + getEnv(key: string): string | undefined; + /** + * 获取String类型的环境变量,key不存在直接返回空值 + * @param key - key + */ + getStringEnv(key: string): string; + /** + * 获取Boolean类型的环境变量,key不存在返回false + * @param key - key + */ + getBooleanEnv(key: string): boolean; + /** + * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 + * + * @param key - key + * @param defaultValue - 默认值 + * @since 0.1.0 + * @author terwer + */ + getEnvOrDefault(key: string, defaultValue: string): string; +} +export default Env; diff --git a/public/libs/zhi-env/package.json b/public/libs/zhi-env/package.json new file mode 100644 index 0000000..fae563f --- /dev/null +++ b/public/libs/zhi-env/package.json @@ -0,0 +1,33 @@ +{ + "name": "zhi-env", + "version": "1.17.1", + "type": "module", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "description": "a cross-platform env config lib", + "repository": "terwer/zhi", + "homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-env", + "author": "terwer", + "license": "GPL", + "files": [ + "dist", + "README.md" + ], + "keywords": [ + "zhi-env", + "zhi", + "env" + ], + "scripts": { + "serve": "vite", + "dev": "vite build --watch", + "build": "vite build", + "start": "vite preview", + "test": "vitest --watch" + }, + "devDependencies": { + "@terwer/eslint-config-custom": "workspace:*", + "@terwer/tsconfig": "workspace:*", + "@terwer/vite-config-custom": "workspace:*" + } +} diff --git a/public/libs/zhi-log/README.md b/public/libs/zhi-log/README.md new file mode 100644 index 0000000..8be0f79 --- /dev/null +++ b/public/libs/zhi-log/README.md @@ -0,0 +1,60 @@ +# zhi-log + +a simple logger for Node and Browser + +## Usage + +```ts +import { LogFactory } from "zhi-log" + +const env = new Env(import.meta.env) +const logger = LogFactory.defaultLogger(env) +logger.debug("debug msg") +logger.info("info msg") +logger.error("error msg") +``` + +## Deps + +``` +├── zhi-device +├── zhi-env +├── loglevel +├── callsites +├── loglevel-plugin-prefix +├── ansi-colors +├── kleur +``` + +## Dev + +```bash +pnpm dev -F zhi-log +``` + +## Build + +```bash +pnpm build -F zhi-log +``` + +## Api + +```bash +pnpm doc -F zhi-log +pnpm md -F zhi-log +``` + +## Test + +Execute the unit tests via [vitest](https://vitest.dev) + +```bash +pnpm test -F zhi-log +``` + +## Publish + +``` +pnpm publish -F zhi-log --tag=latest +``` \ No newline at end of file diff --git a/public/libs/zhi-log/index.d.ts b/public/libs/zhi-log/index.d.ts new file mode 100644 index 0000000..acbc552 --- /dev/null +++ b/public/libs/zhi-log/index.d.ts @@ -0,0 +1,47 @@ +/** + * @packageDocumentation + * zhi-log 多平台日志模块 + */ +import { Env } from "zhi-env"; +import LogLevelEnum, { LogConstants } from "./lib/logConstants"; +import AbstractLogFactory from "./lib/factory/abstractLogFactory"; +import CustomLogFactory from "./lib/factory/customLogFactory"; +import DefaultLogger from "./lib/defaultLogger"; +import EnvHelper from "./lib/envHelper"; +import crossChalk from "./lib/crossChalk"; +/** + * 日志工具类 + * + * @public + * @author terwer + * @since 1.0.7 + */ +declare class LogFactory { + /** + * 默认日志记录器 + * + * @param stackSize - 栈的深度 + * @param env - 环境变量实例 + */ + static defaultLogger(env?: Env, stackSize?: number): DefaultLogger; + /** + * 自定义日志工厂 + * + * @param level - 级别 + * @param sign - 标志 + * @param env - 环境变量 + */ + static customLogFactory(level?: LogLevelEnum, sign?: string, env?: Env): CustomLogFactory; + /** + * 自定义日志工厂,自定义前缀 + * + * @param sign - 标志 + * @param env - 环境变量 + */ + static customSignLogFactory(sign?: string, env?: Env): CustomLogFactory; +} +export { LogFactory }; +export { LogLevelEnum, AbstractLogFactory, CustomLogFactory }; +export { LogConstants, EnvHelper }; +export { crossChalk }; +export type { DefaultLogger }; diff --git a/public/libs/zhi-log/index.js b/public/libs/zhi-log/index.js new file mode 100644 index 0000000..663ca24 --- /dev/null +++ b/public/libs/zhi-log/index.js @@ -0,0 +1,998 @@ +var ce = Object.defineProperty; +var ue = (e, r, t) => r in e ? ce(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t; +var C = (e, r, t) => (ue(e, typeof r != "symbol" ? r + "" : r, t), t); +class D { +} +C(D, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), C(D, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); +var x = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(x || {}), ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function Y(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var te = { exports: {} }; +(function(e) { + (function(r, t) { + e.exports ? e.exports = t() : r.log = t(); + })(ee, function() { + var r = function() { + }, t = "undefined", o = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), n = [ + "trace", + "debug", + "info", + "warn", + "error" + ]; + function i(d, y) { + var m = d[y]; + if (typeof m.bind == "function") + return m.bind(d); + try { + return Function.prototype.bind.call(m, d); + } catch { + return function() { + return Function.prototype.apply.apply(m, [d, arguments]); + }; + } + } + function s() { + console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); + } + function u(d) { + return d === "debug" && (d = "log"), typeof console === t ? !1 : d === "trace" && o ? s : console[d] !== void 0 ? i(console, d) : console.log !== void 0 ? i(console, "log") : r; + } + function g(d, y) { + for (var m = 0; m < n.length; m++) { + var f = n[m]; + this[f] = m < d ? r : this.methodFactory(f, d, y); + } + this.log = this.debug; + } + function c(d, y, m) { + return function() { + typeof console !== t && (g.call(this, y, m), this[d].apply(this, arguments)); + }; + } + function a(d, y, m) { + return u(d) || c.apply(this, arguments); + } + function v(d, y, m) { + var f = this, F; + y = y ?? "WARN"; + var w = "loglevel"; + typeof d == "string" ? w += ":" + d : typeof d == "symbol" && (w = void 0); + function j(h) { + var L = (n[h] || "silent").toUpperCase(); + if (!(typeof window === t || !w)) { + try { + window.localStorage[w] = L; + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(w) + "=" + L + ";"; + } catch { + } + } + } + function N() { + var h; + if (!(typeof window === t || !w)) { + try { + h = window.localStorage[w]; + } catch { + } + if (typeof h === t) + try { + var L = window.document.cookie, I = L.indexOf( + encodeURIComponent(w) + "=" + ); + I !== -1 && (h = /^([^;]+)/.exec(L.slice(I))[1]); + } catch { + } + return f.levels[h] === void 0 && (h = void 0), h; + } + } + function U() { + if (!(typeof window === t || !w)) { + try { + window.localStorage.removeItem(w); + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(w) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + } catch { + } + } + } + f.name = d, f.levels = { + TRACE: 0, + DEBUG: 1, + INFO: 2, + WARN: 3, + ERROR: 4, + SILENT: 5 + }, f.methodFactory = m || a, f.getLevel = function() { + return F; + }, f.setLevel = function(h, L) { + if (typeof h == "string" && f.levels[h.toUpperCase()] !== void 0 && (h = f.levels[h.toUpperCase()]), typeof h == "number" && h >= 0 && h <= f.levels.SILENT) { + if (F = h, L !== !1 && j(h), g.call(f, h, d), typeof console === t && h < f.levels.SILENT) + return "No console available for logging"; + } else + throw "log.setLevel() called with invalid level: " + h; + }, f.setDefaultLevel = function(h) { + y = h, N() || f.setLevel(h, !1); + }, f.resetLevel = function() { + f.setLevel(y, !1), U(); + }, f.enableAll = function(h) { + f.setLevel(f.levels.TRACE, h); + }, f.disableAll = function(h) { + f.setLevel(f.levels.SILENT, h); + }; + var T = N(); + T == null && (T = y), f.setLevel(T, !1); + } + var B = new v(), k = {}; + B.getLogger = function(y) { + if (typeof y != "symbol" && typeof y != "string" || y === "") + throw new TypeError("You must supply a name when creating a logger."); + var m = k[y]; + return m || (m = k[y] = new v( + y, + B.getLevel(), + B.methodFactory + )), m; + }; + var q = typeof window !== t ? window.log : void 0; + return B.noConflict = function() { + return typeof window !== t && window.log === B && (window.log = q), B; + }, B.getLoggers = function() { + return k; + }, B.default = B, B; + }); +})(te); +var ge = te.exports; +const W = /* @__PURE__ */ Y(ge); +var re = { exports: {} }; +(function(e) { + (function(r, t) { + e.exports ? e.exports = t() : r.prefix = t(r); + })(ee, function(r) { + var t = function(a) { + for (var v = 1, B = arguments.length, k; v < B; v++) + for (k in arguments[v]) + Object.prototype.hasOwnProperty.call(arguments[v], k) && (a[k] = arguments[v][k]); + return a; + }, o = { + template: "[%t] %l:", + levelFormatter: function(a) { + return a.toUpperCase(); + }, + nameFormatter: function(a) { + return a || "root"; + }, + timestampFormatter: function(a) { + return a.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); + }, + format: void 0 + }, n, i = {}, s = function(a) { + if (!a || !a.getLogger) + throw new TypeError("Argument is not a root logger"); + n = a; + }, u = function(a, v) { + if (!a || !a.setLevel) + throw new TypeError("Argument is not a logger"); + var B = a.methodFactory, k = a.name || "", q = i[k] || i[""] || o; + function d(y, m, f) { + var F = B(y, m, f), w = i[f] || i[""], j = w.template.indexOf("%t") !== -1, N = w.template.indexOf("%l") !== -1, U = w.template.indexOf("%n") !== -1; + return function() { + for (var T = "", h = arguments.length, L = Array(h), I = 0; I < h; I++) + L[I] = arguments[I]; + if (k || !i[f]) { + var G = w.timestampFormatter(/* @__PURE__ */ new Date()), J = w.levelFormatter(y), Z = w.nameFormatter(f); + w.format ? T += w.format(J, Z, G) : (T += w.template, j && (T = T.replace(/%t/, G)), N && (T = T.replace(/%l/, J)), U && (T = T.replace(/%n/, Z))), L.length && typeof L[0] == "string" ? L[0] = T + " " + L[0] : L.unshift(T); + } + F.apply(void 0, L); + }; + } + return i[k] || (a.methodFactory = d), v = v || {}, v.template && (v.format = void 0), i[k] = t({}, q, v), a.setLevel(a.getLevel()), n || a.warn( + "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md" + ), a; + }, g = { + reg: s, + apply: u + }, c; + return r && (c = r.prefix, g.noConflict = function() { + return r.prefix === g && (r.prefix = c), g; + }), g; + }); +})(re); +var he = re.exports; +const K = /* @__PURE__ */ Y(he); +function fe() { + const e = Error.prepareStackTrace; + Error.prepareStackTrace = (t, o) => o; + const r = new Error().stack.slice(1); + return Error.prepareStackTrace = e, r; +} +class V { + /** + * 解析日志级别为枚举 + * + * @param enumObj - 枚举对象 + * @param value - 配置的值 + */ + static stringToEnumValue(r, t) { + return r[Object.keys(r).filter((o) => r[o].toString() === t)[0]]; + } + /** + * 获取配置的日志级别 + */ + static getEnvLevel(r) { + if (!r) + return; + let t; + try { + t = r.getEnvOrDefault(D.LOG_LEVEL_KEY, x.LOG_LEVEL_INFO); + } catch { + t = x.LOG_LEVEL_INFO; + } + const o = V.stringToEnumValue(x, t.toUpperCase()); + return o || console.warn( + "[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level" + ), o ?? x.LOG_LEVEL_INFO; + } + /** + * 获取默认日志 + */ + static getEnvLogger(r) { + return r ? r.getEnv(D.LOG_PREFIX_KEY) : void 0; + } +} +var z = { exports: {} }, M = { exports: {} }, X; +function pe() { + return X || (X = 1, function(e) { + const r = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", t = typeof process < "u" && process.platform === "win32", o = typeof process < "u" && process.platform === "linux", n = { + ballotDisabled: "☒", + ballotOff: "☐", + ballotOn: "☑", + bullet: "•", + bulletWhite: "◦", + fullBlock: "█", + heart: "❤", + identicalTo: "≡", + line: "─", + mark: "※", + middot: "·", + minus: "-", + multiplication: "×", + obelus: "÷", + pencilDownRight: "✎", + pencilRight: "✏", + pencilUpRight: "✐", + percent: "%", + pilcrow2: "❡", + pilcrow: "¶", + plusMinus: "±", + question: "?", + section: "§", + starsOff: "☆", + starsOn: "★", + upDownArrow: "↕" + }, i = Object.assign({}, n, { + check: "√", + cross: "×", + ellipsisLarge: "...", + ellipsis: "...", + info: "i", + questionSmall: "?", + pointer: ">", + pointerSmall: "»", + radioOff: "( )", + radioOn: "(*)", + warning: "‼" + }), s = Object.assign({}, n, { + ballotCross: "✘", + check: "✔", + cross: "✖", + ellipsisLarge: "⋯", + ellipsis: "…", + info: "ℹ", + questionFull: "?", + questionSmall: "﹖", + pointer: o ? "▸" : "❯", + pointerSmall: o ? "‣" : "›", + radioOff: "◯", + radioOn: "◉", + warning: "⚠" + }); + e.exports = t && !r ? i : s, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: n }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: i }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: s }); + }(M)), M.exports; +} +const de = (e) => e !== null && typeof e == "object" && !Array.isArray(e), be = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, ye = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, ne = () => { + const e = { + enabled: ye(), + visible: !0, + styles: {}, + keys: {} + }, r = (i) => { + let s = i.open = `\x1B[${i.codes[0]}m`, u = i.close = `\x1B[${i.codes[1]}m`, g = i.regex = new RegExp(`\\u001b\\[${i.codes[1]}m`, "g"); + return i.wrap = (c, a) => { + c.includes(u) && (c = c.replace(g, u + s)); + let v = s + c + u; + return a ? v.replace(/\r*\n/g, `${u}$&${s}`) : v; + }, i; + }, t = (i, s, u) => typeof i == "function" ? i(s) : i.wrap(s, u), o = (i, s) => { + if (i === "" || i == null) + return ""; + if (e.enabled === !1) + return i; + if (e.visible === !1) + return ""; + let u = "" + i, g = u.includes(` +`), c = s.length; + for (c > 0 && s.includes("unstyle") && (s = [.../* @__PURE__ */ new Set(["unstyle", ...s])].reverse()); c-- > 0; ) + u = t(e.styles[s[c]], u, g); + return u; + }, n = (i, s, u) => { + e.styles[i] = r({ name: i, codes: s }), (e.keys[u] || (e.keys[u] = [])).push(i), Reflect.defineProperty(e, i, { + configurable: !0, + enumerable: !0, + set(c) { + e.alias(i, c); + }, + get() { + let c = (a) => o(a, c.stack); + return Reflect.setPrototypeOf(c, e), c.stack = this.stack ? this.stack.concat(i) : [i], c; + } + }); + }; + return n("reset", [0, 0], "modifier"), n("bold", [1, 22], "modifier"), n("dim", [2, 22], "modifier"), n("italic", [3, 23], "modifier"), n("underline", [4, 24], "modifier"), n("inverse", [7, 27], "modifier"), n("hidden", [8, 28], "modifier"), n("strikethrough", [9, 29], "modifier"), n("black", [30, 39], "color"), n("red", [31, 39], "color"), n("green", [32, 39], "color"), n("yellow", [33, 39], "color"), n("blue", [34, 39], "color"), n("magenta", [35, 39], "color"), n("cyan", [36, 39], "color"), n("white", [37, 39], "color"), n("gray", [90, 39], "color"), n("grey", [90, 39], "color"), n("bgBlack", [40, 49], "bg"), n("bgRed", [41, 49], "bg"), n("bgGreen", [42, 49], "bg"), n("bgYellow", [43, 49], "bg"), n("bgBlue", [44, 49], "bg"), n("bgMagenta", [45, 49], "bg"), n("bgCyan", [46, 49], "bg"), n("bgWhite", [47, 49], "bg"), n("blackBright", [90, 39], "bright"), n("redBright", [91, 39], "bright"), n("greenBright", [92, 39], "bright"), n("yellowBright", [93, 39], "bright"), n("blueBright", [94, 39], "bright"), n("magentaBright", [95, 39], "bright"), n("cyanBright", [96, 39], "bright"), n("whiteBright", [97, 39], "bright"), n("bgBlackBright", [100, 49], "bgBright"), n("bgRedBright", [101, 49], "bgBright"), n("bgGreenBright", [102, 49], "bgBright"), n("bgYellowBright", [103, 49], "bgBright"), n("bgBlueBright", [104, 49], "bgBright"), n("bgMagentaBright", [105, 49], "bgBright"), n("bgCyanBright", [106, 49], "bgBright"), n("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = be, e.hasColor = e.hasAnsi = (i) => (e.ansiRegex.lastIndex = 0, typeof i == "string" && i !== "" && e.ansiRegex.test(i)), e.alias = (i, s) => { + let u = typeof s == "string" ? e[s] : s; + if (typeof u != "function") + throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); + u.stack || (Reflect.defineProperty(u, "name", { value: i }), e.styles[i] = u, u.stack = [i]), Reflect.defineProperty(e, i, { + configurable: !0, + enumerable: !0, + set(g) { + e.alias(i, g); + }, + get() { + let g = (c) => o(c, g.stack); + return Reflect.setPrototypeOf(g, e), g.stack = this.stack ? this.stack.concat(u.stack) : u.stack, g; + } + }); + }, e.theme = (i) => { + if (!de(i)) + throw new TypeError("Expected theme to be an object"); + for (let s of Object.keys(i)) + e.alias(s, i[s]); + return e; + }, e.alias("unstyle", (i) => typeof i == "string" && i !== "" ? (e.ansiRegex.lastIndex = 0, i.replace(e.ansiRegex, "")) : ""), e.alias("noop", (i) => i), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = pe(), e.define = n, e; +}; +z.exports = ne(); +z.exports.create = ne; +var we = z.exports; +const _ = /* @__PURE__ */ Y(we); +let $, ie, oe, ae, se = !0; +typeof process < "u" && ({ FORCE_COLOR: $, NODE_DISABLE_COLORS: ie, NO_COLOR: oe, TERM: ae } = process.env || {}, se = process.stdout && process.stdout.isTTY); +const l = { + enabled: !ie && oe == null && ae !== "dumb" && ($ != null && $ !== "0" || se), + // modifiers + reset: b(0, 0), + bold: b(1, 22), + dim: b(2, 22), + italic: b(3, 23), + underline: b(4, 24), + inverse: b(7, 27), + hidden: b(8, 28), + strikethrough: b(9, 29), + // colors + black: b(30, 39), + red: b(31, 39), + green: b(32, 39), + yellow: b(33, 39), + blue: b(34, 39), + magenta: b(35, 39), + cyan: b(36, 39), + white: b(37, 39), + gray: b(90, 39), + grey: b(90, 39), + // background colors + bgBlack: b(40, 49), + bgRed: b(41, 49), + bgGreen: b(42, 49), + bgYellow: b(43, 49), + bgBlue: b(44, 49), + bgMagenta: b(45, 49), + bgCyan: b(46, 49), + bgWhite: b(47, 49) +}; +function H(e, r) { + let t = 0, o, n = "", i = ""; + for (; t < e.length; t++) + o = e[t], n += o.open, i += o.close, ~r.indexOf(o.close) && (r = r.replace(o.rgx, o.close + o.open)); + return n + r + i; +} +function me(e, r) { + let t = { has: e, keys: r }; + return t.reset = l.reset.bind(t), t.bold = l.bold.bind(t), t.dim = l.dim.bind(t), t.italic = l.italic.bind(t), t.underline = l.underline.bind(t), t.inverse = l.inverse.bind(t), t.hidden = l.hidden.bind(t), t.strikethrough = l.strikethrough.bind(t), t.black = l.black.bind(t), t.red = l.red.bind(t), t.green = l.green.bind(t), t.yellow = l.yellow.bind(t), t.blue = l.blue.bind(t), t.magenta = l.magenta.bind(t), t.cyan = l.cyan.bind(t), t.white = l.white.bind(t), t.gray = l.gray.bind(t), t.grey = l.grey.bind(t), t.bgBlack = l.bgBlack.bind(t), t.bgRed = l.bgRed.bind(t), t.bgGreen = l.bgGreen.bind(t), t.bgYellow = l.bgYellow.bind(t), t.bgBlue = l.bgBlue.bind(t), t.bgMagenta = l.bgMagenta.bind(t), t.bgCyan = l.bgCyan.bind(t), t.bgWhite = l.bgWhite.bind(t), t; +} +function b(e, r) { + let t = { + open: `\x1B[${e}m`, + close: `\x1B[${r}m`, + rgx: new RegExp(`\\x1b\\[${r}m`, "g") + }; + return function(o) { + return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(t)), o === void 0 ? this : l.enabled ? H(this.keys, o + "") : o + "") : o === void 0 ? me([e], [t]) : l.enabled ? H([t], o + "") : o + ""; + }; +} +var ve = Object.defineProperty, Ee = (e, r, t) => r in e ? ve(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, E = (e, r, t) => (Ee(e, typeof r != "symbol" ? r + "" : r, t), t); +const S = class { + /** + * 检测是否运行在Chrome插件中 + */ + static isInChromeExtension() { + return S.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; + } +}; +let p = S; +E(p, "isNode", typeof process < "u"), /** +* 是否在浏览器环境 +*/ +E(p, "isInBrowser", typeof window < "u"), /** +* 浏览器路径分隔符 +*/ +E(p, "BrowserSeperator", "/"), /** +* 是否是Electron环境 +*/ +E(p, "isElectron", () => !S.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** +* 是否有Node环境,目前包括 Electron 和 Node +*/ +E(p, "hasNodeEnv", () => S.isElectron() || S.isNode), /** +* 获取url参数 +* +* @param sParam - 参数 +*/ +E(p, "getQueryString", (e) => { + if (!S.isInBrowser) + return ""; + const r = window.location.search.substring(1).split("&"); + for (let t = 0; t < r.length; t++) { + const o = r[t].split("="); + if (o[0] === e) + return o[1]; + } + return ""; +}), /** +* 替换 URL 的参数 +* 思路: +* 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 +* +* 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 +* +* 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 +* +* 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 +* +* 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 +* +* @param url - 链接地址 +* @param paramName - 参数名 +* @param paramValue - 参数值 +*/ +E(p, "replaceUrlParam", (e, r, t) => { + t == null && (t = ""); + const o = new RegExp("\\b(" + r + "=).*?(&|#|$)"); + if (e.search(o) >= 0) + return e.replace(o, "$1" + t + "$2"); + const [n, i] = e.split("#"), [s, u] = n.split("?"), g = new URLSearchParams(u); + g.set(r, t); + const c = g.toString(), a = s + (c ? "?" + c : ""); + return i ? a + "#" + i : a; +}), /** +* 设置url参数 +* +* @param urlstring - url +* @param key - key +* @param value - value +*/ +E(p, "setUrlParameter", (e, r, t) => { + if (e.includes(r)) + return S.replaceUrlParam(e, r, t); + const o = e.split("#"); + let n = o[0]; + const i = o[1]; + return n.includes("?") ? n += `&${r}=${t}` : n += `?${r}=${t}`, i && (n += "#" + i), n; +}), /** +* 重新加载指定tab +* +* @param tabname - tabname +* @param t - 延迟时间 +*/ +E(p, "reloadTabPage", (e, r = 200) => { + setTimeout(function() { + if (S.isInBrowser) { + const t = window.location.href; + window.location.href = S.setUrlParameter(t, "tab", e); + } + }, r); +}), /** +* 刷新当前tab页面 +*/ +E(p, "reloadPage", () => { + setTimeout(function() { + S.isInBrowser && window.location.reload(); + }, 200); +}), /** +* 刷新当前tab页面 +* +* @param msg - 消息提示 +* @param cb - 回调 +*/ +E(p, "reloadPageWithMessageCallback", (e, r) => { + r && r(e), setTimeout(function() { + S.isInBrowser && window.location.reload(); + }, 200); +}); +var P = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(P || {}); +const R = class { + /** + * 检测是否运行在思源打开的浏览器中 + */ + static isInSiyuanBrowser() { + return p.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; + } + /** + * 思源笔记 window 对象 + */ + static siyuanWindow() { + let e; + return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; + } + // ========================= + // require end + // ========================= + // ========================= + // import start + // ========================= + /** + * 引入json + * + * @param jsPath - js相对路径全路径 + * @param type - 类型 + */ + static async importJs(e, r) { + let t = e; + switch (r) { + case P.BasePathType_Appearance: + t = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); + break; + case P.BasePathType_Data: + t = this.browserJoinPath(this.siyuanDataRelativePath(), e); + break; + case P.BasePathType_Themes: + t = this.browserJoinPath(this.siyuanThemeRelativePath(), e); + break; + case P.BasePathType_ZhiTheme: + t = this.browserJoinPath(this.zhiThemeRelativePath(), e); + break; + default: + throw new Error("type must be provided"); + } + const { default: o } = await import( + /* @vite-ignore */ + t + ); + return o; + } + /** + * 引入json + * + * @param jsonPath - json相对路径全路径 + * @param type - 类型 + */ + // public static async importJson(jsonPath: string, type: BasePathTypeEnum) { + // let fullJsonPath = jsonPath + // switch (type) { + // case BasePathTypeEnum.BasePathType_Appearance: + // fullJsonPath = this.browserJoinPath(this.siyuanAppearanceRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Data: + // fullJsonPath = this.browserJoinPath(this.siyuanDataRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Themes: + // fullJsonPath = this.browserJoinPath(this.siyuanThemeRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_ZhiTheme: + // fullJsonPath = this.browserJoinPath(this.zhiThemeRelativePath(), jsonPath) + // break + // default: + // throw new Error("type must be provided") + // } + // + // const { default: data } = await import(/* @vite-ignore */ fullJsonPath, { assert: { type: "json" } }) + // return data + // } + /** + * 引入 json - 以 data 为基本路径 + * + * @param jsonPath - 相对于 data 的相对路径 + */ + // public static async importDataJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Data) + // } + /** + * 引入 json - 以 appearance 为基本路径 + * + * @param jsonPath - 相对于 appearance 的相对路径 + */ + // public static async importAppearanceJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Appearance) + // } + /** + * 引入 json - 以 themes 为基本路径 + * + * @param jsonPath - 相对于 themes 的相对路径 + */ + // public static async importThemesJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Themes) + // } + /** + * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 + * + * @param jsonPath - 相对于 zhi 主题根路径的相对路径 + */ + // public static async importZhiThemeJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_ZhiTheme) + // } + /** + * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 + * + * @param jsPath - 相对于 zhi 主题根路径的相对路径 + */ + static async importZhiThemeJs(e) { + return await this.importJs(e, P.BasePathType_ZhiTheme); + } + // ========================= + // import start + // ========================= + /** + * 路径拼接 + * + * @param paths - 路径数组 + */ + static joinPath(...e) { + if (p.hasNodeEnv()) { + const r = this.requireLib("path"); + if (r) + return r.join(...e); + } + return this.browserJoinPath(...e); + } + static browserJoinPath(...e) { + return e.join(p.BrowserSeperator); + } + /** + * 思源笔记 conf 目录 + */ + static siyuanConfPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.confDir; + } + /** + * 思源笔记 data 目录 + */ + static siyuanDataPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.dataDir; + } + /** + * 思源笔记 data 目录-相对路径 + */ + static siyuanDataRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return ""; + } + /** + * 思源笔记 appearance 目录 + */ + static siyuanAppearancePath() { + return this.joinPath(this.siyuanConfPath(), "appearance"); + } + /** + * 思源笔记 appearance 目录-相对路径 + */ + static siyuanAppearanceRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance"); + } + /** + * 思源笔记 themes 目录-绝对路径 + * + * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 + * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath + * + * @author terwer + * @since 0.1.0 + */ + static siyuanThemePath() { + if (p.hasNodeEnv()) + return this.joinPath(this.siyuanAppearancePath(), "themes"); + { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return this.joinPath(e.location.origin, "appearance", "themes"); + } + } + /** + * 思源笔记 themes 目录-相对路径 + */ + static siyuanThemeRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance", "themes"); + } + /** + * zhi 主题目录 - 绝对路径 + */ + static zhiThemePath() { + return this.joinPath(this.siyuanThemePath(), "zhi"); + } + /** + * zhi 主题目录 - 相对路径 + */ + static zhiThemeRelativePath() { + return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); + } +}; +let A = R; +E(A, "isInSiyuanWidget", () => p.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** +* 思源笔记新窗口 +* +* @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 +* @author terwer +* @version 0.1.0 +* @since 0.0.1 +*/ +E(A, "isInSiyuanNewWin", () => !p.isInBrowser || !p.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +// require start +// ========================= +/** + * 引入依赖 + * + * @param libpath - 依赖全路径 + * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 + * @param type - 可选,以谁的基本路径为准 + */ +E(A, "requireLib", (e, r = !0, t = P.BasePathType_None) => { + if (!p.hasNodeEnv()) + throw new Error("require ony works on node env"); + let o = e; + if (!r) + switch (t) { + case P.BasePathType_Appearance: + o = R.joinPath(R.siyuanAppearancePath(), e); + break; + case P.BasePathType_Data: + o = R.joinPath(R.siyuanDataPath(), e); + break; + case P.BasePathType_Themes: + o = R.joinPath(R.siyuanAppearancePath(), "themes", e); + break; + case P.BasePathType_ZhiTheme: + o = R.joinPath(R.siyuanAppearancePath(), "themes", "zhi", e); + break; + default: + throw new Error("type must be provided when not use absolute path"); + } + const n = R.siyuanWindow(); + if (!n) + return require(o); + if (typeof n.require < "u") + return n.require(o); +}), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 appearance 的相对路径 +*/ +E(A, "requireAppearanceLib", (e) => R.requireLib(e, !1, P.BasePathType_Appearance)), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 data 的相对路径 +*/ +E(A, "requireDataLib", (e) => R.requireLib(e, !1, P.BasePathType_Data)), /** +* 引入依赖,以 theme 的基本路径为准 +* +* @param libpath - 相对于 theme 的相对路径 +*/ +E(A, "requireThemesLib", (e) => R.requireLib(e, !1, P.BasePathType_Themes)), /** +* 引入依赖,以 ZhiTheme 的基本路径为准 +* +* @param libpath - 相对于 ZhiTheme 的相对路径 +*/ +E(A, "requireZhiThemeLib", (e) => R.requireLib(e, !1, P.BasePathType_ZhiTheme)); +const O = { + white: (e) => p.isElectron() ? _.whiteBright(e) : l.white(e), + gray: (e) => p.isElectron() ? _.gray(e) : l.gray(e), + blue: (e) => p.isElectron() ? _.blue(e) : l.blue(e), + green: (e) => p.isElectron() ? _.green(e) : l.green(e), + yellow: (e) => p.isElectron() ? _.yellow(e) : l.yellow(e), + red: (e) => p.isElectron() ? _.red(e) : l.red(e), + bgWhite: (e) => p.isElectron() ? _.bgWhiteBright(e) : l.bgWhite(e), + bgGrey: (e) => p.isElectron() ? _.bgCyanBright(e) : l.bgCyan(e), + bgBlue: (e) => p.isElectron() ? _.bgBlueBright(e) : l.bgBlue(e), + bgGreen: (e) => p.isElectron() ? _.bgGreenBright(e) : l.bgGreen(e), + bgYellow: (e) => p.isElectron() ? _.bgYellowBright(e) : l.bgYellow(e), + bgRed: (e) => p.isElectron() ? _.bgRedBright(e) : l.bgRed(e) +}; +class Le { + constructor(r, t, o) { + C(this, "consoleLogger", "console"); + C(this, "stackSize", 1); + /** + * 获取日志记录器 + * + * @param loggerName - 日志记录器,默认为 console + * @author terwer + * @since 1.0.0 + */ + C(this, "getLogger", (r) => { + let t; + if (r) + t = r; + else { + const o = this.getCallStack(), n = [], i = []; + for (let s = 0; s < o.length; s++) { + const u = o[s], g = u.getFileName() ?? "none"; + if (s > this.stackSize - 1) + break; + const c = g + "-" + u.getLineNumber() + ":" + u.getColumnNumber(); + n.push(c); + } + i.length > 0 && (t = n.join(" -> ")); + } + return (!t || t.trim().length === 0) && (t = this.consoleLogger), W.getLogger(t); + }); + this.stackSize = 1; + let n; + r ? n = r : n = V.getEnvLevel(o), n = n ?? x.LOG_LEVEL_INFO, W.setLevel(n); + const i = (s, u, g, c) => { + const a = [], v = t ?? V.getEnvLogger(o) ?? "zhi"; + return a.push(O.gray("[") + c(v) + O.gray("]")), a.push(O.gray("[") + O.gray(g.toString()) + O.gray("]")), a.push(c(s.toUpperCase().toString())), a.push(c(u)), a.push(O.gray(":")), a; + }; + K.reg(W), K.apply(W, { + format(s, u, g) { + let c = []; + const a = u ?? ""; + switch (s) { + case x.LOG_LEVEL_TRACE: + c = i(s, a, g, O.gray); + break; + case x.LOG_LEVEL_DEBUG: + c = i(s, a, g, O.blue); + break; + case x.LOG_LEVEL_INFO: + c = i(s, a, g, O.green); + break; + case x.LOG_LEVEL_WARN: + c = i(s, a, g, O.yellow); + break; + case x.LOG_LEVEL_ERROR: + c = i(s, a, g, O.red); + break; + default: + c = i(x.LOG_LEVEL_INFO, a, g, O.green); + break; + } + return c.join(" "); + } + }); + } + /** + * 设置输出栈的深度,默认1 + * + * @param stackSize - 栈的深度 + */ + setStackSize(r) { + this.stackSize = r ?? 1; + } + /** + * 获取调用堆栈,若未获取到直接返回空数组 + * + * @author terwer + * @since 1.6.0 + */ + getCallStack() { + let r; + try { + r = fe(); + } catch { + r = []; + } + return r; + } +} +class Pe { + /** + * 默认日志级别 + * + * @param level - 可选,未设置默认INFO + * @param sign - 可选前缀,默认zhi + * @param env - 可选环境变量实例 + */ + constructor(r, t, o) { + C(this, "logger"); + this.logger = new Le(r, t, o); + } + /** + * 获取日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + * @protected + */ + getLogger(r, t) { + return this.logger.setStackSize(t), this.logger.getLogger(r); + } +} +class Q extends Pe { + constructor(r, t, o) { + super(r, t, o); + } + /** + * 获取默认的日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + */ + getLogger(r, t) { + return super.getLogger(r, t); + } +} +class le { + /** + * 默认日志记录器 + * + * @param stackSize - 栈的深度 + * @param env - 环境变量实例 + */ + static defaultLogger(r, t) { + return le.customLogFactory(void 0, void 0, r).getLogger(void 0, t); + } + /** + * 自定义日志工厂 + * + * @param level - 级别 + * @param sign - 标志 + * @param env - 环境变量 + */ + static customLogFactory(r, t, o) { + return new Q(r, t, o); + } + /** + * 自定义日志工厂,自定义前缀 + * + * @param sign - 标志 + * @param env - 环境变量 + */ + static customSignLogFactory(r, t) { + return new Q(void 0, r, t); + } +} +export { + Pe as AbstractLogFactory, + Q as CustomLogFactory, + V as EnvHelper, + D as LogConstants, + le as LogFactory, + x as LogLevelEnum, + O as crossChalk +}; diff --git a/public/libs/zhi-log/lib/crossChalk.d.ts b/public/libs/zhi-log/lib/crossChalk.d.ts new file mode 100644 index 0000000..e453fde --- /dev/null +++ b/public/libs/zhi-log/lib/crossChalk.d.ts @@ -0,0 +1,23 @@ +/** + * 跨平台,同时支持Node和浏览器的颜色解决方案 + * + * @public + * @author terwer + * @version 1.9.2 + * @since 1.9.2 + */ +declare const crossChalk: { + white: (str: string) => string; + gray: (str: string) => string; + blue: (str: string) => string; + green: (str: string) => string; + yellow: (str: string) => string; + red: (str: string) => string; + bgWhite: (str: string) => string; + bgGrey: (str: string) => string; + bgBlue: (str: string) => string; + bgGreen: (str: string) => string; + bgYellow: (str: string) => string; + bgRed: (str: string) => string; +}; +export default crossChalk; diff --git a/public/libs/zhi-log/lib/defaultLogger.d.ts b/public/libs/zhi-log/lib/defaultLogger.d.ts new file mode 100644 index 0000000..a178a65 --- /dev/null +++ b/public/libs/zhi-log/lib/defaultLogger.d.ts @@ -0,0 +1,52 @@ +import { Logger } from "loglevel"; +/** + * 默认日志记录器 + * + * @public + * @author terwer + * @since 1.0.7 + */ +interface DefaultLogger extends Logger { + /** + * 日志颜色 + */ + colors?: string[]; + /** + * Output trace message to console. + * This will also include a full stack trace + * + * @param msg - unknown data to log to the console + */ + trace(...msg: unknown[]): void; + /** + * Output debug message to console including appropriate icons + * + * @param msg - unknown data to log to the console + */ + debug(...msg: unknown[]): void; + /** + * Output debug message to console including appropriate icons + * + * @param msg - unknown data to log to the console + */ + log(...msg: unknown[]): void; + /** + * Output info message to console including appropriate icons + * + * @param msg - unknown data to log to the console + */ + info(...msg: unknown[]): void; + /** + * Output warn message to console including appropriate icons + * + * @param msg - unknown data to log to the console + */ + warn(...msg: unknown[]): void; + /** + * Output error message to console including appropriate icons + * + * @param msg - unknown data to log to the console + */ + error(...msg: unknown[]): void; +} +export default DefaultLogger; diff --git a/public/libs/zhi-log/lib/envHelper.d.ts b/public/libs/zhi-log/lib/envHelper.d.ts new file mode 100644 index 0000000..df59742 --- /dev/null +++ b/public/libs/zhi-log/lib/envHelper.d.ts @@ -0,0 +1,27 @@ +import LogLevelEnum from "./logConstants"; +import { Env } from "zhi-env"; +/** + * 解析日志级别为枚举 + * + * @public + * @author terwer + * @since 1.4.0 + */ +declare class EnvHelper { + /** + * 解析日志级别为枚举 + * + * @param enumObj - 枚举对象 + * @param value - 配置的值 + */ + private static stringToEnumValue; + /** + * 获取配置的日志级别 + */ + static getEnvLevel(env?: Env): LogLevelEnum | undefined; + /** + * 获取默认日志 + */ + static getEnvLogger(env?: Env): string | undefined; +} +export default EnvHelper; diff --git a/public/libs/zhi-log/lib/factory/abstractLogFactory.d.ts b/public/libs/zhi-log/lib/factory/abstractLogFactory.d.ts new file mode 100644 index 0000000..18d0f9b --- /dev/null +++ b/public/libs/zhi-log/lib/factory/abstractLogFactory.d.ts @@ -0,0 +1,30 @@ +import LogLevelEnum from "../logConstants"; +import { Env } from "zhi-env"; +import DefaultLogger from "../defaultLogger"; +/** + * 日志记录工厂 + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare abstract class AbstractLogFactory { + private logger; + /** + * 默认日志级别 + * + * @param level - 可选,未设置默认INFO + * @param sign - 可选前缀,默认zhi + * @param env - 可选环境变量实例 + */ + protected constructor(level?: LogLevelEnum, sign?: string, env?: Env); + /** + * 获取日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + * @protected + */ + protected getLogger(loggerName?: string, stackSize?: number): DefaultLogger; +} +export default AbstractLogFactory; diff --git a/public/libs/zhi-log/lib/factory/customLogFactory.d.ts b/public/libs/zhi-log/lib/factory/customLogFactory.d.ts new file mode 100644 index 0000000..d707cad --- /dev/null +++ b/public/libs/zhi-log/lib/factory/customLogFactory.d.ts @@ -0,0 +1,22 @@ +import AbstractLogFactory from "./abstractLogFactory"; +import LogLevelEnum from "../logConstants"; +import { Env } from "zhi-env"; +import DefaultLogger from "../defaultLogger"; +/** + * 自定义日志工厂 + * + * @public + * @author terwer + * @since 1.0.7 + */ +declare class CustomLogFactory extends AbstractLogFactory { + constructor(level?: LogLevelEnum, sign?: string, env?: Env); + /** + * 获取默认的日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + */ + getLogger(loggerName?: string, stackSize?: number): DefaultLogger; +} +export default CustomLogFactory; diff --git a/public/libs/zhi-log/lib/logConstants.d.ts b/public/libs/zhi-log/lib/logConstants.d.ts new file mode 100644 index 0000000..b5dff3d --- /dev/null +++ b/public/libs/zhi-log/lib/logConstants.d.ts @@ -0,0 +1,42 @@ +/** + * 日志常量 + * + * @public + * @author terwer + * @since 1.4.0 + */ +declare class LogConstants { + static readonly LOG_LEVEL_KEY = "VITE_LOG_LEVEL"; + static readonly LOG_PREFIX_KEY = "VITE_LOG_PREFIX"; +} +/** + * 日志级别 + * + * @author terwer + * @since 1.0.7 + * @public + */ +declare enum LogLevelEnum { + /** + * TRACE + */ + LOG_LEVEL_TRACE = "TRACE", + /** + * DEBUG + */ + LOG_LEVEL_DEBUG = "DEBUG", + /** + * INFO + */ + LOG_LEVEL_INFO = "INFO", + /** + * WARN + */ + LOG_LEVEL_WARN = "WARN", + /** + * ERROR + */ + LOG_LEVEL_ERROR = "ERROR" +} +export default LogLevelEnum; +export { LogConstants }; diff --git a/public/libs/zhi-log/lib/logger.d.ts b/public/libs/zhi-log/lib/logger.d.ts new file mode 100644 index 0000000..d80ad41 --- /dev/null +++ b/public/libs/zhi-log/lib/logger.d.ts @@ -0,0 +1,37 @@ +import LogLevelEnum from "./logConstants"; +import { CallSite } from "callsites"; +import { Env } from "zhi-env"; +import DefaultLogger from "./defaultLogger"; +/** + * 日志工具类 + * + * @author terwer + * @since 1.0.0 + */ +declare class Logger { + private consoleLogger; + private stackSize; + /** + * 设置输出栈的深度,默认1 + * + * @param stackSize - 栈的深度 + */ + setStackSize(stackSize?: number): void; + constructor(level?: LogLevelEnum, sign?: string, env?: Env); + /** + * 获取调用堆栈,若未获取到直接返回空数组 + * + * @author terwer + * @since 1.6.0 + */ + getCallStack(): CallSite[]; + /** + * 获取日志记录器 + * + * @param loggerName - 日志记录器,默认为 console + * @author terwer + * @since 1.0.0 + */ + getLogger: (loggerName?: string) => DefaultLogger; +} +export default Logger; diff --git a/public/libs/zhi-log/package.json b/public/libs/zhi-log/package.json new file mode 100644 index 0000000..fc1b9e2 --- /dev/null +++ b/public/libs/zhi-log/package.json @@ -0,0 +1,42 @@ +{ + "name": "zhi-log", + "version": "1.13.2", + "type": "module", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "description": "a simple logger for Node and Browser", + "repository": "terwer/zhi", + "homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-log", + "author": "terwer", + "license": "GPL", + "files": [ + "dist", + "README.md" + ], + "keywords": [ + "zhi-log", + "zhi", + "log" + ], + "scripts": { + "serve": "vite", + "dev": "vite build --watch", + "build": "vite build", + "start": "vite preview", + "test": "vitest --watch" + }, + "devDependencies": { + "@terwer/eslint-config-custom": "workspace:*", + "@terwer/tsconfig": "workspace:*", + "@terwer/vite-config-custom": "workspace:*" + }, + "dependencies": { + "ansi-colors": "^4.1.3", + "callsites": "^4.0.0", + "kleur": "^4.1.5", + "loglevel": "^1.8.1", + "loglevel-plugin-prefix": "^0.8.4", + "zhi-device": "workspace:*", + "zhi-env": "workspace:*" + } +} diff --git a/public/libs/zhi-publisher-sdk/README.md b/public/libs/zhi-publisher-sdk/README.md new file mode 100644 index 0000000..e25f1f1 --- /dev/null +++ b/public/libs/zhi-publisher-sdk/README.md @@ -0,0 +1,41 @@ +# publisher-sdk + +a common sdk for publishing post to every platform + +## Usage + +```js +// usage +``` + +## Deps + +``` +## Congregations! publisher-sdk need no deps, it is just pure js code 🎉 +``` + +## Dev + +```bash +pnpm dev -F publisher-sdk +``` + +## Build + +```bash +pnpm build -F publisher-sdk +``` + +## Test + +Execute the unit tests via [vitest](https://vitest.dev) + +```bash +pnpm test -F publisher-sdk +``` + +## Publish + +```bash +pnpm publish -F publisher-sdk --tag latest +``` \ No newline at end of file diff --git a/public/libs/zhi-publisher-sdk/index.d.ts b/public/libs/zhi-publisher-sdk/index.d.ts new file mode 100644 index 0000000..15a8618 --- /dev/null +++ b/public/libs/zhi-publisher-sdk/index.d.ts @@ -0,0 +1,2 @@ +import PublishSdk from "./publish-sdk"; +export { PublishSdk }; diff --git a/public/libs/zhi-publisher-sdk/index.js b/public/libs/zhi-publisher-sdk/index.js new file mode 100644 index 0000000..81a723a --- /dev/null +++ b/public/libs/zhi-publisher-sdk/index.js @@ -0,0 +1,47 @@ +var r = Object.defineProperty; +var g = (n, t, s) => t in n ? r(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s; +var i = (n, t, s) => (g(n, typeof t != "symbol" ? t + "" : t, s), s); +(function(n, t) { + !n || n.getElementById("livereloadscript") || (t = n.createElement("script"), t.async = 1, t.src = "//" + (self.location.host || "localhost").split(":")[0] + ":35730/livereload.js?snipver=1", t.id = "livereloadscript", n.getElementsByTagName("head")[0].appendChild(t)); +})(self.document); +class a { + static init(t) { + this.appInstance = t.appInstance, this.Env = t.Env, this.BlogConstants = t.BlogConstants, this.BlogTypeEnum = t.BlogTypeEnum, this.SiyuanConstants = t.SiyuanConstants, this.SiyuanConfig = t.SiyuanConfig, this.SiYuanApiAdaptor = t.SiYuanApiAdaptor, this.BlogApi = t.BlogApi; + } + /** + * 获取 siyuan-kernel-api 实例 + * + * @param type - Env | BlogTypeEnum + * @param cfg - BlogConfig + * @return BlogApi + */ + static blogApi(t, s) { + if (!this.bApi) { + let e, o; + switch (console.log(t instanceof this.Env), t instanceof this.Env && (o = t.getEnv(this.BlogConstants.DEFAULT_BLOG_TYPE_KEY)), o) { + case this.BlogTypeEnum.BlogTypeEnum_Wordpress: + break; + default: { + if (t instanceof this.Env) { + const p = t.getEnvOrDefault(this.SiyuanConstants.VITE_SIYUAN_API_URL_KEY, "http://127.0.0.1:6806"), l = t.getStringEnv(this.SiyuanConstants.VITE_SIYUAN_AUTH_TOKEN_KEY), c = new this.SiyuanConfig(p, l); + c.fixTitle = !0, e = new this.SiYuanApiAdaptor(c); + } else + e = new this.SiYuanApiAdaptor(s), e.init(this.appInstance); + break; + } + } + if (!e) + throw new Error("ApiAdaptor cannot be null"); + this.bApi = new this.BlogApi(e); + } + return this.bApi; + } +} +/** + * BlogApi + * @private + */ +i(a, "appInstance"), i(a, "bApi"), i(a, "Env"), i(a, "BlogConstants"), i(a, "BlogTypeEnum"), i(a, "SiyuanConstants"), i(a, "SiyuanConfig"), i(a, "SiYuanApiAdaptor"), i(a, "BlogApi"); +export { + a as PublishSdk +}; diff --git a/public/libs/zhi-publisher-sdk/package.json b/public/libs/zhi-publisher-sdk/package.json new file mode 100644 index 0000000..623e114 --- /dev/null +++ b/public/libs/zhi-publisher-sdk/package.json @@ -0,0 +1,33 @@ +{ + "name": "zhi-publisher-sdk", + "version": "0.2.1", + "type": "module", + "description": "a common sdk for publishing post to every platform", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "repository": "terwer/zhi", + "homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-publisher-sdk", + "author": "terwer", + "license": "GPL", + "files": [ + "dist", + "README.md" + ], + "keywords": [ + "zhi", + "lib" + ], + "scripts": { + "serve": "vite", + "dev": "vite build --watch", + "build": "vite build", + "start": "vite preview", + "test": "vitest --watch" + }, + "devDependencies": { + "@terwer/eslint-config-custom": "workspace:*", + "@terwer/vite-config-custom": "workspace:*", + "@types/path-browserify": "^1.0.0", + "path-browserify": "^1.0.1" + } +} diff --git a/public/libs/zhi-publisher-sdk/publish-sdk.d.ts b/public/libs/zhi-publisher-sdk/publish-sdk.d.ts new file mode 100644 index 0000000..524653d --- /dev/null +++ b/public/libs/zhi-publisher-sdk/publish-sdk.d.ts @@ -0,0 +1,41 @@ +/** + * 发布 SDK + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class PublishSdk { + /** + * BlogApi + * @private + */ + private static appInstance; + private static bApi; + private static Env; + private static BlogConstants; + private static BlogTypeEnum; + private static SiyuanConstants; + private static SiyuanConfig; + private static SiYuanApiAdaptor; + private static BlogApi; + static init(options: { + appInstance: any; + Env: any; + BlogConstants: any; + BlogTypeEnum: any; + SiyuanConstants: any; + SiyuanConfig: any; + SiYuanApiAdaptor: any; + BlogApi: any; + }): void; + /** + * 获取 siyuan-kernel-api 实例 + * + * @param type - Env | BlogTypeEnum + * @param cfg - BlogConfig + * @return BlogApi + */ + static blogApi(type: any, cfg: any): any; +} +export default PublishSdk; diff --git a/public/libs/zhi-siyuan-api/README.md b/public/libs/zhi-siyuan-api/README.md new file mode 100644 index 0000000..d588991 --- /dev/null +++ b/public/libs/zhi-siyuan-api/README.md @@ -0,0 +1,49 @@ +# zhi-siyuan-api + +a siyuan-note api including both kernel and client + +## Usage + +```js +import { SiyuanKernelApi } from "zhi-siyuan-api" + +const siyuanConfig = new SiyuanConfig("http://127.0.0.1:6806", "") +const kernelApi = new SiyuanKernelApi(siyuanConfig) +const result = await kernelApi.lsNotebooks() +console.log("result=>", result) +``` + +## Deps + +``` +├── zhi-env +├── zhi-log +├── zhi-common +├── zhi-blog-api +``` + +## Dev + +```bash +pnpm dev -F zhi-siyuan-api +``` + +## Build + +```bash +pnpm build -F zhi-siyuan-api +``` + +## Test + +Execute the unit tests via [vitest](https://vitest.dev) + +```bash +pnpm test -F zhi-siyuan-api +``` + +## Publish + +```bash +pnpm publish -F zhi-siyuan-api --tag latest +``` \ No newline at end of file diff --git a/public/libs/zhi-siyuan-api/index.d.ts b/public/libs/zhi-siyuan-api/index.d.ts new file mode 100644 index 0000000..49fb990 --- /dev/null +++ b/public/libs/zhi-siyuan-api/index.d.ts @@ -0,0 +1,9 @@ +import SiyuanApi from "./lib/zhi-siyuan-api"; +import SiyuanKernelApi from "./lib/siyuanKernelApi"; +import type { SiyuanData } from "./lib/ISiyuanKernelApi"; +import SiyuanConfig from "./lib/siyuanConfig"; +import SiYuanApiAdaptor from "./lib/siYuanApiAdaptor"; +import SiyuanConstants from "./lib/siyuanConstants"; +export { SiyuanApi }; +export { SiyuanData, SiyuanKernelApi }; +export { SiyuanConstants, SiyuanConfig, SiYuanApiAdaptor }; diff --git a/public/libs/zhi-siyuan-api/index.js b/public/libs/zhi-siyuan-api/index.js new file mode 100644 index 0000000..17769b5 --- /dev/null +++ b/public/libs/zhi-siyuan-api/index.js @@ -0,0 +1,10474 @@ +var bs = Object.defineProperty; +var ys = (e, t, r) => t in e ? bs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r; +var $e = (e, t, r) => (ys(e, typeof t != "symbol" ? t + "" : t, r), r); +var _s = Object.defineProperty, ws = (e, t, r) => t in e ? _s(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, oe = (e, t, r) => (ws(e, typeof t != "symbol" ? t + "" : t, r), r), ao = /* @__PURE__ */ ((e) => (e[e.PasswordType_Password = 0] = "PasswordType_Password", e[e.PasswordType_Token = 1] = "PasswordType_Token", e))(ao || {}); +class vs { + constructor() { + oe(this, "home"), oe(this, "apiUrl"), oe(this, "username"), oe(this, "passwordType"), oe(this, "password"), oe(this, "apiStatus"), oe(this, "blogName"), oe(this, "posidKey"), oe(this, "previewUrl"), oe(this, "pageType"), oe(this, "placeholder"), oe(this, "fixTitle"), this.home = "", this.apiUrl = "", this.username = "", this.passwordType = 0, this.password = "", this.apiStatus = !1, this.blogName = "", this.posidKey = "", this.previewUrl = "", this.pageType = 0, this.placeholder = void 0, this.fixTitle = !1; + } +} +class ks { + constructor() { + oe(this, "homePlaceholder"), oe(this, "apiUrlPlaceholder"), oe(this, "usernamePlaceholder"), oe(this, "passwordTypePlaceholder"), oe(this, "passwordPlaceholder"), oe(this, "apiStatusPlaceholder"), oe(this, "blogNamePlaceholder"), oe(this, "posidKeyPlaceholder"), oe(this, "previewUrlPlaceholder"), oe(this, "pageTypePlaceholder"), this.homePlaceholder = "", this.apiUrlPlaceholder = "", this.usernamePlaceholder = "", this.passwordTypePlaceholder = "", this.passwordPlaceholder = "", this.apiStatusPlaceholder = !1, this.blogNamePlaceholder = "", this.posidKeyPlaceholder = "", this.previewUrlPlaceholder = "", this.pageTypePlaceholder = ""; + } +} +class Es { + async deletePost(t) { + throw new Error("You must implement this method in sub class"); + } + async editPost(t, r, a) { + throw new Error("You must implement this method in sub class"); + } + async getCategories() { + throw new Error("You must implement this method in sub class"); + } + async getPost(t, r) { + throw new Error("You must implement this method in sub class"); + } + async getPreviewUrl(t) { + throw new Error("You must implement this method in sub class"); + } + async getRecentPosts(t, r, a) { + throw new Error("You must implement this method in sub class"); + } + async getRecentPostsCount(t) { + throw new Error("You must implement this method in sub class"); + } + async getUsersBlogs() { + throw new Error("You must implement this method in sub class"); + } + async newMediaObject(t) { + throw new Error("You must implement this method in sub class"); + } + async newPost(t, r) { + throw new Error("You must implement this method in sub class"); + } +} +var Br = /* @__PURE__ */ ((e) => (e.PostStatusEnum_Publish = "publish", e.PostStatusEnum_Draft = "draft", e.PostStatusEnum_Inherit = "inherit", e))(Br || {}); +class _n { + constructor() { + oe(this, "postid"), oe(this, "title"), oe(this, "mt_keywords"), oe(this, "link"), oe(this, "permalink"), oe(this, "shortDesc"), oe(this, "description"), oe(this, "mt_excerpt"), oe(this, "wp_slug"), oe(this, "dateCreated"), oe(this, "categories"), oe(this, "mt_text_more"), oe(this, "post_status"), oe(this, "isPublished"), oe(this, "wp_password"), this.postid = "", this.title = "", this.mt_keywords = "", this.permalink = "", this.description = "", this.wp_slug = "", this.dateCreated = /* @__PURE__ */ new Date(), this.categories = [], this.isPublished = !0, this.post_status = Br.PostStatusEnum_Publish, this.wp_password = ""; + } +} +var $s = Object.defineProperty, Ps = (e, t, r) => t in e ? $s(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Te = (e, t, r) => (Ps(e, typeof t != "symbol" ? t + "" : t, r), r), no = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function oo(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var la = { exports: {} }, so = {}, at = {}, Ht = {}, br = {}, ie = {}, fr = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0; + class t { + } + e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; + class r extends t { + constructor(C) { + if (super(), !e.IDENTIFIER.test(C)) + throw new Error("CodeGen: name must be a valid identifier"); + this.str = C; + } + toString() { + return this.str; + } + emptyStr() { + return !1; + } + get names() { + return { [this.str]: 1 }; + } + } + e.Name = r; + class a extends t { + constructor(C) { + super(), this._items = typeof C == "string" ? [C] : C; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) + return !1; + const C = this._items[0]; + return C === "" || C === '""'; + } + get str() { + var C; + return (C = this._str) !== null && C !== void 0 ? C : this._str = this._items.reduce((R, n) => `${R}${n}`, ""); + } + get names() { + var C; + return (C = this._names) !== null && C !== void 0 ? C : this._names = this._items.reduce((R, n) => (n instanceof r && (R[n.str] = (R[n.str] || 0) + 1), R), {}); + } + } + e._Code = a, e.nil = new a(""); + function s(v, ...C) { + const R = [v[0]]; + let n = 0; + for (; n < C.length; ) + b(R, C[n]), R.push(v[++n]); + return new a(R); + } + e._ = s; + const l = new a("+"); + function d(v, ...C) { + const R = [A(v[0])]; + let n = 0; + for (; n < C.length; ) + R.push(l), b(R, C[n]), R.push(l, A(v[++n])); + return _(R), new a(R); + } + e.str = d; + function b(v, C) { + C instanceof a ? v.push(...C._items) : C instanceof r ? v.push(C) : v.push(E(C)); + } + e.addCodeArg = b; + function _(v) { + let C = 1; + for (; C < v.length - 1; ) { + if (v[C] === l) { + const R = y(v[C - 1], v[C + 1]); + if (R !== void 0) { + v.splice(C - 1, 3, R); + continue; + } + v[C++] = "+"; + } + C++; + } + } + function y(v, C) { + if (C === '""') + return v; + if (v === '""') + return C; + if (typeof v == "string") + return C instanceof r || v[v.length - 1] !== '"' ? void 0 : typeof C != "string" ? `${v.slice(0, -1)}${C}"` : C[0] === '"' ? v.slice(0, -1) + C.slice(1) : void 0; + if (typeof C == "string" && C[0] === '"' && !(v instanceof r)) + return `"${v}${C.slice(1)}`; + } + function f(v, C) { + return C.emptyStr() ? v : v.emptyStr() ? C : d`${v}${C}`; + } + e.strConcat = f; + function E(v) { + return typeof v == "number" || typeof v == "boolean" || v === null ? v : A(Array.isArray(v) ? v.join(",") : v); + } + function N(v) { + return new a(A(v)); + } + e.stringify = N; + function A(v) { + return JSON.stringify(v).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); + } + e.safeStringify = A; + function j(v) { + return typeof v == "string" && e.IDENTIFIER.test(v) ? new a(`.${v}`) : s`[${v}]`; + } + e.getProperty = j; + function P(v) { + if (typeof v == "string" && e.IDENTIFIER.test(v)) + return new a(`${v}`); + throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`); + } + e.getEsmExportName = P; + function x(v) { + return new a(v.toString()); + } + e.regexpCode = x; +})(fr); +var ca = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0; + const t = fr; + class r extends Error { + constructor(y) { + super(`CodeGen: "code" for ${y} not defined`), this.value = y.value; + } + } + var a; + (function(_) { + _[_.Started = 0] = "Started", _[_.Completed = 1] = "Completed"; + })(a = e.UsedValueState || (e.UsedValueState = {})), e.varKinds = { + const: new t.Name("const"), + let: new t.Name("let"), + var: new t.Name("var") + }; + class s { + constructor({ prefixes: y, parent: f } = {}) { + this._names = {}, this._prefixes = y, this._parent = f; + } + toName(y) { + return y instanceof t.Name ? y : this.name(y); + } + name(y) { + return new t.Name(this._newName(y)); + } + _newName(y) { + const f = this._names[y] || this._nameGroup(y); + return `${y}${f.index++}`; + } + _nameGroup(y) { + var f, E; + if (!((E = (f = this._parent) === null || f === void 0 ? void 0 : f._prefixes) === null || E === void 0) && E.has(y) || this._prefixes && !this._prefixes.has(y)) + throw new Error(`CodeGen: prefix "${y}" is not allowed in this scope`); + return this._names[y] = { prefix: y, index: 0 }; + } + } + e.Scope = s; + class l extends t.Name { + constructor(y, f) { + super(f), this.prefix = y; + } + setValue(y, { property: f, itemIndex: E }) { + this.value = y, this.scopePath = (0, t._)`.${new t.Name(f)}[${E}]`; + } + } + e.ValueScopeName = l; + const d = (0, t._)`\n`; + class b extends s { + constructor(y) { + super(y), this._values = {}, this._scope = y.scope, this.opts = { ...y, _n: y.lines ? d : t.nil }; + } + get() { + return this._scope; + } + name(y) { + return new l(y, this._newName(y)); + } + value(y, f) { + var E; + if (f.ref === void 0) + throw new Error("CodeGen: ref must be passed in value"); + const N = this.toName(y), { prefix: A } = N, j = (E = f.key) !== null && E !== void 0 ? E : f.ref; + let P = this._values[A]; + if (P) { + const C = P.get(j); + if (C) + return C; + } else + P = this._values[A] = /* @__PURE__ */ new Map(); + P.set(j, N); + const x = this._scope[A] || (this._scope[A] = []), v = x.length; + return x[v] = f.ref, N.setValue(f, { property: A, itemIndex: v }), N; + } + getValue(y, f) { + const E = this._values[y]; + if (E) + return E.get(f); + } + scopeRefs(y, f = this._values) { + return this._reduceValues(f, (E) => { + if (E.scopePath === void 0) + throw new Error(`CodeGen: name "${E}" has no value`); + return (0, t._)`${y}${E.scopePath}`; + }); + } + scopeCode(y = this._values, f, E) { + return this._reduceValues(y, (N) => { + if (N.value === void 0) + throw new Error(`CodeGen: name "${N}" has no value`); + return N.value.code; + }, f, E); + } + _reduceValues(y, f, E = {}, N) { + let A = t.nil; + for (const j in y) { + const P = y[j]; + if (!P) + continue; + const x = E[j] = E[j] || /* @__PURE__ */ new Map(); + P.forEach((v) => { + if (x.has(v)) + return; + x.set(v, a.Started); + let C = f(v); + if (C) { + const R = this.opts.es5 ? e.varKinds.var : e.varKinds.const; + A = (0, t._)`${A}${R} ${v} = ${C};${this.opts._n}`; + } else if (C = N == null ? void 0 : N(v)) + A = (0, t._)`${A}${C}${this.opts._n}`; + else + throw new r(v); + x.set(v, a.Completed); + }); + } + return A; + } + } + e.ValueScope = b; +})(ca); +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.or = e.and = e.not = e.CodeGen = e.operators = e.varKinds = e.ValueScopeName = e.ValueScope = e.Scope = e.Name = e.regexpCode = e.stringify = e.getProperty = e.nil = e.strConcat = e.str = e._ = void 0; + const t = fr, r = ca; + var a = fr; + Object.defineProperty(e, "_", { enumerable: !0, get: function() { + return a._; + } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { + return a.str; + } }), Object.defineProperty(e, "strConcat", { enumerable: !0, get: function() { + return a.strConcat; + } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { + return a.nil; + } }), Object.defineProperty(e, "getProperty", { enumerable: !0, get: function() { + return a.getProperty; + } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { + return a.stringify; + } }), Object.defineProperty(e, "regexpCode", { enumerable: !0, get: function() { + return a.regexpCode; + } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { + return a.Name; + } }); + var s = ca; + Object.defineProperty(e, "Scope", { enumerable: !0, get: function() { + return s.Scope; + } }), Object.defineProperty(e, "ValueScope", { enumerable: !0, get: function() { + return s.ValueScope; + } }), Object.defineProperty(e, "ValueScopeName", { enumerable: !0, get: function() { + return s.ValueScopeName; + } }), Object.defineProperty(e, "varKinds", { enumerable: !0, get: function() { + return s.varKinds; + } }), e.operators = { + GT: new t._Code(">"), + GTE: new t._Code(">="), + LT: new t._Code("<"), + LTE: new t._Code("<="), + EQ: new t._Code("==="), + NEQ: new t._Code("!=="), + NOT: new t._Code("!"), + OR: new t._Code("||"), + AND: new t._Code("&&"), + ADD: new t._Code("+") + }; + class l { + optimizeNodes() { + return this; + } + optimizeNames(h, $) { + return this; + } + } + class d extends l { + constructor(h, $, I) { + super(), this.varKind = h, this.name = $, this.rhs = I; + } + render({ es5: h, _n: $ }) { + const I = h ? r.varKinds.var : this.varKind, H = this.rhs === void 0 ? "" : ` = ${this.rhs}`; + return `${I} ${this.name}${H};` + $; + } + optimizeNames(h, $) { + if (h[this.name.str]) + return this.rhs && (this.rhs = B(this.rhs, h, $)), this; + } + get names() { + return this.rhs instanceof t._CodeOrName ? this.rhs.names : {}; + } + } + class b extends l { + constructor(h, $, I) { + super(), this.lhs = h, this.rhs = $, this.sideEffects = I; + } + render({ _n: h }) { + return `${this.lhs} = ${this.rhs};` + h; + } + optimizeNames(h, $) { + if (!(this.lhs instanceof t.Name && !h[this.lhs.str] && !this.sideEffects)) + return this.rhs = B(this.rhs, h, $), this; + } + get names() { + const h = this.lhs instanceof t.Name ? {} : { ...this.lhs.names }; + return q(h, this.rhs); + } + } + class _ extends b { + constructor(h, $, I, H) { + super(h, I, H), this.op = $; + } + render({ _n: h }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + h; + } + } + class y extends l { + constructor(h) { + super(), this.label = h, this.names = {}; + } + render({ _n: h }) { + return `${this.label}:` + h; + } + } + class f extends l { + constructor(h) { + super(), this.label = h, this.names = {}; + } + render({ _n: h }) { + return `break${this.label ? ` ${this.label}` : ""};` + h; + } + } + class E extends l { + constructor(h) { + super(), this.error = h; + } + render({ _n: h }) { + return `throw ${this.error};` + h; + } + get names() { + return this.error.names; + } + } + class N extends l { + constructor(h) { + super(), this.code = h; + } + render({ _n: h }) { + return `${this.code};` + h; + } + optimizeNodes() { + return `${this.code}` ? this : void 0; + } + optimizeNames(h, $) { + return this.code = B(this.code, h, $), this; + } + get names() { + return this.code instanceof t._CodeOrName ? this.code.names : {}; + } + } + class A extends l { + constructor(h = []) { + super(), this.nodes = h; + } + render(h) { + return this.nodes.reduce(($, I) => $ + I.render(h), ""); + } + optimizeNodes() { + const { nodes: h } = this; + let $ = h.length; + for (; $--; ) { + const I = h[$].optimizeNodes(); + Array.isArray(I) ? h.splice($, 1, ...I) : I ? h[$] = I : h.splice($, 1); + } + return h.length > 0 ? this : void 0; + } + optimizeNames(h, $) { + const { nodes: I } = this; + let H = I.length; + for (; H--; ) { + const K = I[H]; + K.optimizeNames(h, $) || (G(h, K.names), I.splice(H, 1)); + } + return I.length > 0 ? this : void 0; + } + get names() { + return this.nodes.reduce((h, $) => z(h, $.names), {}); + } + } + class j extends A { + render(h) { + return "{" + h._n + super.render(h) + "}" + h._n; + } + } + class P extends A { + } + class x extends j { + } + x.kind = "else"; + class v extends j { + constructor(h, $) { + super($), this.condition = h; + } + render(h) { + let $ = `if(${this.condition})` + super.render(h); + return this.else && ($ += "else " + this.else.render(h)), $; + } + optimizeNodes() { + super.optimizeNodes(); + const h = this.condition; + if (h === !0) + return this.nodes; + let $ = this.else; + if ($) { + const I = $.optimizeNodes(); + $ = this.else = Array.isArray(I) ? new x(I) : I; + } + if ($) + return h === !1 ? $ instanceof v ? $ : $.nodes : this.nodes.length ? this : new v(w(h), $ instanceof v ? [$] : $.nodes); + if (!(h === !1 || !this.nodes.length)) + return this; + } + optimizeNames(h, $) { + var I; + if (this.else = (I = this.else) === null || I === void 0 ? void 0 : I.optimizeNames(h, $), !!(super.optimizeNames(h, $) || this.else)) + return this.condition = B(this.condition, h, $), this; + } + get names() { + const h = super.names; + return q(h, this.condition), this.else && z(h, this.else.names), h; + } + } + v.kind = "if"; + class C extends j { + } + C.kind = "for"; + class R extends C { + constructor(h) { + super(), this.iteration = h; + } + render(h) { + return `for(${this.iteration})` + super.render(h); + } + optimizeNames(h, $) { + if (super.optimizeNames(h, $)) + return this.iteration = B(this.iteration, h, $), this; + } + get names() { + return z(super.names, this.iteration.names); + } + } + class n extends C { + constructor(h, $, I, H) { + super(), this.varKind = h, this.name = $, this.from = I, this.to = H; + } + render(h) { + const $ = h.es5 ? r.varKinds.var : this.varKind, { name: I, from: H, to: K } = this; + return `for(${$} ${I}=${H}; ${I}<${K}; ${I}++)` + super.render(h); + } + get names() { + const h = q(super.names, this.from); + return q(h, this.to); + } + } + class i extends C { + constructor(h, $, I, H) { + super(), this.loop = h, this.varKind = $, this.name = I, this.iterable = H; + } + render(h) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(h); + } + optimizeNames(h, $) { + if (super.optimizeNames(h, $)) + return this.iterable = B(this.iterable, h, $), this; + } + get names() { + return z(super.names, this.iterable.names); + } + } + class o extends j { + constructor(h, $, I) { + super(), this.name = h, this.args = $, this.async = I; + } + render(h) { + return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(h); + } + } + o.kind = "func"; + class c extends A { + render(h) { + return "return " + super.render(h); + } + } + c.kind = "return"; + class u extends j { + render(h) { + let $ = "try" + super.render(h); + return this.catch && ($ += this.catch.render(h)), this.finally && ($ += this.finally.render(h)), $; + } + optimizeNodes() { + var h, $; + return super.optimizeNodes(), (h = this.catch) === null || h === void 0 || h.optimizeNodes(), ($ = this.finally) === null || $ === void 0 || $.optimizeNodes(), this; + } + optimizeNames(h, $) { + var I, H; + return super.optimizeNames(h, $), (I = this.catch) === null || I === void 0 || I.optimizeNames(h, $), (H = this.finally) === null || H === void 0 || H.optimizeNames(h, $), this; + } + get names() { + const h = super.names; + return this.catch && z(h, this.catch.names), this.finally && z(h, this.finally.names), h; + } + } + class m extends j { + constructor(h) { + super(), this.error = h; + } + render(h) { + return `catch(${this.error})` + super.render(h); + } + } + m.kind = "catch"; + class g extends j { + render(h) { + return "finally" + super.render(h); + } + } + g.kind = "finally"; + class O { + constructor(h, $ = {}) { + this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...$, _n: $.lines ? ` +` : "" }, this._extScope = h, this._scope = new r.Scope({ parent: h }), this._nodes = [new P()]; + } + toString() { + return this._root.render(this.opts); + } + // returns unique name in the internal scope + name(h) { + return this._scope.name(h); + } + // reserves unique name in the external scope + scopeName(h) { + return this._extScope.name(h); + } + // reserves unique name in the external scope and assigns value to it + scopeValue(h, $) { + const I = this._extScope.value(h, $); + return (this._values[I.prefix] || (this._values[I.prefix] = /* @__PURE__ */ new Set())).add(I), I; + } + getScopeValue(h, $) { + return this._extScope.getValue(h, $); + } + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(h) { + return this._extScope.scopeRefs(h, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(h, $, I, H) { + const K = this._scope.toName($); + return I !== void 0 && H && (this._constants[K.str] = I), this._leafNode(new d(h, K, I)), K; + } + // `const` declaration (`var` in es5 mode) + const(h, $, I) { + return this._def(r.varKinds.const, h, $, I); + } + // `let` declaration with optional assignment (`var` in es5 mode) + let(h, $, I) { + return this._def(r.varKinds.let, h, $, I); + } + // `var` declaration with optional assignment + var(h, $, I) { + return this._def(r.varKinds.var, h, $, I); + } + // assignment code + assign(h, $, I) { + return this._leafNode(new b(h, $, I)); + } + // `+=` code + add(h, $) { + return this._leafNode(new _(h, e.operators.ADD, $)); + } + // appends passed SafeExpr to code or executes Block + code(h) { + return typeof h == "function" ? h() : h !== t.nil && this._leafNode(new N(h)), this; + } + // returns code for object literal for the passed argument list of key-value pairs + object(...h) { + const $ = ["{"]; + for (const [I, H] of h) + $.length > 1 && $.push(","), $.push(I), (I !== H || this.opts.es5) && ($.push(":"), (0, t.addCodeArg)($, H)); + return $.push("}"), new t._Code($); + } + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(h, $, I) { + if (this._blockNode(new v(h)), $ && I) + this.code($).else().code(I).endIf(); + else if ($) + this.code($).endIf(); + else if (I) + throw new Error('CodeGen: "else" body without "then" body'); + return this; + } + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(h) { + return this._elseNode(new v(h)); + } + // `else` clause - only valid after `if` or `else if` clauses + else() { + return this._elseNode(new x()); + } + // end `if` statement (needed if gen.if was used only with condition) + endIf() { + return this._endBlockNode(v, x); + } + _for(h, $) { + return this._blockNode(h), $ && this.code($).endFor(), this; + } + // a generic `for` clause (or statement if `forBody` is passed) + for(h, $) { + return this._for(new R(h), $); + } + // `for` statement for a range of values + forRange(h, $, I, H, K = this.opts.es5 ? r.varKinds.var : r.varKinds.let) { + const te = this._scope.toName(h); + return this._for(new n(K, te, $, I), () => H(te)); + } + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf(h, $, I, H = r.varKinds.const) { + const K = this._scope.toName(h); + if (this.opts.es5) { + const te = $ instanceof t.Name ? $ : this.var("_arr", $); + return this.forRange("_i", 0, (0, t._)`${te}.length`, (ne) => { + this.var(K, (0, t._)`${te}[${ne}]`), I(K); + }); + } + return this._for(new i("of", H, K, $), () => I(K)); + } + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn(h, $, I, H = this.opts.es5 ? r.varKinds.var : r.varKinds.const) { + if (this.opts.ownProperties) + return this.forOf(h, (0, t._)`Object.keys(${$})`, I); + const K = this._scope.toName(h); + return this._for(new i("in", H, K, $), () => I(K)); + } + // end `for` loop + endFor() { + return this._endBlockNode(C); + } + // `label` statement + label(h) { + return this._leafNode(new y(h)); + } + // `break` statement + break(h) { + return this._leafNode(new f(h)); + } + // `return` statement + return(h) { + const $ = new c(); + if (this._blockNode($), this.code(h), $.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(c); + } + // `try` statement + try(h, $, I) { + if (!$ && !I) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const H = new u(); + if (this._blockNode(H), this.code(h), $) { + const K = this.name("e"); + this._currNode = H.catch = new m(K), $(K); + } + return I && (this._currNode = H.finally = new g(), this.code(I)), this._endBlockNode(m, g); + } + // `throw` statement + throw(h) { + return this._leafNode(new E(h)); + } + // start self-balancing block + block(h, $) { + return this._blockStarts.push(this._nodes.length), h && this.code(h).endBlock($), this; + } + // end the current self-balancing block + endBlock(h) { + const $ = this._blockStarts.pop(); + if ($ === void 0) + throw new Error("CodeGen: not in self-balancing block"); + const I = this._nodes.length - $; + if (I < 0 || h !== void 0 && I !== h) + throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${h} expected`); + return this._nodes.length = $, this; + } + // `function` heading (or definition if funcBody is passed) + func(h, $ = t.nil, I, H) { + return this._blockNode(new o(h, $, I)), H && this.code(H).endFunc(), this; + } + // end function definition + endFunc() { + return this._endBlockNode(o); + } + optimize(h = 1) { + for (; h-- > 0; ) + this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants); + } + _leafNode(h) { + return this._currNode.nodes.push(h), this; + } + _blockNode(h) { + this._currNode.nodes.push(h), this._nodes.push(h); + } + _endBlockNode(h, $) { + const I = this._currNode; + if (I instanceof h || $ && I instanceof $) + return this._nodes.pop(), this; + throw new Error(`CodeGen: not in block "${$ ? `${h.kind}/${$.kind}` : h.kind}"`); + } + _elseNode(h) { + const $ = this._currNode; + if (!($ instanceof v)) + throw new Error('CodeGen: "else" without "if"'); + return this._currNode = $.else = h, this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const h = this._nodes; + return h[h.length - 1]; + } + set _currNode(h) { + const $ = this._nodes; + $[$.length - 1] = h; + } + } + e.CodeGen = O; + function z(L, h) { + for (const $ in h) + L[$] = (L[$] || 0) + (h[$] || 0); + return L; + } + function q(L, h) { + return h instanceof t._CodeOrName ? z(L, h.names) : L; + } + function B(L, h, $) { + if (L instanceof t.Name) + return I(L); + if (!H(L)) + return L; + return new t._Code(L._items.reduce((K, te) => (te instanceof t.Name && (te = I(te)), te instanceof t._Code ? K.push(...te._items) : K.push(te), K), [])); + function I(K) { + const te = $[K.str]; + return te === void 0 || h[K.str] !== 1 ? K : (delete h[K.str], te); + } + function H(K) { + return K instanceof t._Code && K._items.some((te) => te instanceof t.Name && h[te.str] === 1 && $[te.str] !== void 0); + } + } + function G(L, h) { + for (const $ in h) + L[$] = (L[$] || 0) - (h[$] || 0); + } + function w(L) { + return typeof L == "boolean" || typeof L == "number" || L === null ? !L : (0, t._)`!${F(L)}`; + } + e.not = w; + const U = S(e.operators.AND); + function W(...L) { + return L.reduce(U); + } + e.and = W; + const Y = S(e.operators.OR); + function V(...L) { + return L.reduce(Y); + } + e.or = V; + function S(L) { + return (h, $) => h === t.nil ? $ : $ === t.nil ? h : (0, t._)`${F(h)} ${L} ${F($)}`; + } + function F(L) { + return L instanceof t.Name ? L : (0, t._)`(${L})`; + } +})(ie); +var ce = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0; + const t = ie, r = fr; + function a(o) { + const c = {}; + for (const u of o) + c[u] = !0; + return c; + } + e.toHash = a; + function s(o, c) { + return typeof c == "boolean" ? c : Object.keys(c).length === 0 ? !0 : (l(o, c), !d(c, o.self.RULES.all)); + } + e.alwaysValidSchema = s; + function l(o, c = o.schema) { + const { opts: u, self: m } = o; + if (!u.strictSchema || typeof c == "boolean") + return; + const g = m.RULES.keywords; + for (const O in c) + g[O] || i(o, `unknown keyword: "${O}"`); + } + e.checkUnknownRules = l; + function d(o, c) { + if (typeof o == "boolean") + return !o; + for (const u in o) + if (c[u]) + return !0; + return !1; + } + e.schemaHasRules = d; + function b(o, c) { + if (typeof o == "boolean") + return !o; + for (const u in o) + if (u !== "$ref" && c.all[u]) + return !0; + return !1; + } + e.schemaHasRulesButRef = b; + function _({ topSchemaRef: o, schemaPath: c }, u, m, g) { + if (!g) { + if (typeof u == "number" || typeof u == "boolean") + return u; + if (typeof u == "string") + return (0, t._)`${u}`; + } + return (0, t._)`${o}${c}${(0, t.getProperty)(m)}`; + } + e.schemaRefOrVal = _; + function y(o) { + return N(decodeURIComponent(o)); + } + e.unescapeFragment = y; + function f(o) { + return encodeURIComponent(E(o)); + } + e.escapeFragment = f; + function E(o) { + return typeof o == "number" ? `${o}` : o.replace(/~/g, "~0").replace(/\//g, "~1"); + } + e.escapeJsonPointer = E; + function N(o) { + return o.replace(/~1/g, "/").replace(/~0/g, "~"); + } + e.unescapeJsonPointer = N; + function A(o, c) { + if (Array.isArray(o)) + for (const u of o) + c(u); + else + c(o); + } + e.eachItem = A; + function j({ mergeNames: o, mergeToName: c, mergeValues: u, resultToName: m }) { + return (g, O, z, q) => { + const B = z === void 0 ? O : z instanceof t.Name ? (O instanceof t.Name ? o(g, O, z) : c(g, O, z), z) : O instanceof t.Name ? (c(g, z, O), O) : u(O, z); + return q === t.Name && !(B instanceof t.Name) ? m(g, B) : B; + }; + } + e.mergeEvaluated = { + props: j({ + mergeNames: (o, c, u) => o.if((0, t._)`${u} !== true && ${c} !== undefined`, () => { + o.if((0, t._)`${c} === true`, () => o.assign(u, !0), () => o.assign(u, (0, t._)`${u} || {}`).code((0, t._)`Object.assign(${u}, ${c})`)); + }), + mergeToName: (o, c, u) => o.if((0, t._)`${u} !== true`, () => { + c === !0 ? o.assign(u, !0) : (o.assign(u, (0, t._)`${u} || {}`), x(o, u, c)); + }), + mergeValues: (o, c) => o === !0 ? !0 : { ...o, ...c }, + resultToName: P + }), + items: j({ + mergeNames: (o, c, u) => o.if((0, t._)`${u} !== true && ${c} !== undefined`, () => o.assign(u, (0, t._)`${c} === true ? true : ${u} > ${c} ? ${u} : ${c}`)), + mergeToName: (o, c, u) => o.if((0, t._)`${u} !== true`, () => o.assign(u, c === !0 ? !0 : (0, t._)`${u} > ${c} ? ${u} : ${c}`)), + mergeValues: (o, c) => o === !0 ? !0 : Math.max(o, c), + resultToName: (o, c) => o.var("items", c) + }) + }; + function P(o, c) { + if (c === !0) + return o.var("props", !0); + const u = o.var("props", (0, t._)`{}`); + return c !== void 0 && x(o, u, c), u; + } + e.evaluatedPropsToName = P; + function x(o, c, u) { + Object.keys(u).forEach((m) => o.assign((0, t._)`${c}${(0, t.getProperty)(m)}`, !0)); + } + e.setEvaluated = x; + const v = {}; + function C(o, c) { + return o.scopeValue("func", { + ref: c, + code: v[c.code] || (v[c.code] = new r._Code(c.code)) + }); + } + e.useFunc = C; + var R; + (function(o) { + o[o.Num = 0] = "Num", o[o.Str = 1] = "Str"; + })(R = e.Type || (e.Type = {})); + function n(o, c, u) { + if (o instanceof t.Name) { + const m = c === R.Num; + return u ? m ? (0, t._)`"[" + ${o} + "]"` : (0, t._)`"['" + ${o} + "']"` : m ? (0, t._)`"/" + ${o}` : (0, t._)`"/" + ${o}.replace(/~/g, "~0").replace(/\\//g, "~1")`; + } + return u ? (0, t.getProperty)(o).toString() : "/" + E(o); + } + e.getErrorPath = n; + function i(o, c, u = o.opts.strictSchema) { + if (u) { + if (c = `strict mode: ${c}`, u === !0) + throw new Error(c); + o.self.logger.warn(c); + } + } + e.checkStrictMode = i; +})(ce); +var ct = {}; +Object.defineProperty(ct, "__esModule", { value: !0 }); +const Oe = ie, Ss = { + // validation function arguments + data: new Oe.Name("data"), + // args passed from referencing schema + valCxt: new Oe.Name("valCxt"), + instancePath: new Oe.Name("instancePath"), + parentData: new Oe.Name("parentData"), + parentDataProperty: new Oe.Name("parentDataProperty"), + rootData: new Oe.Name("rootData"), + dynamicAnchors: new Oe.Name("dynamicAnchors"), + // function scoped variables + vErrors: new Oe.Name("vErrors"), + errors: new Oe.Name("errors"), + this: new Oe.Name("this"), + // "globals" + self: new Oe.Name("self"), + scope: new Oe.Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new Oe.Name("json"), + jsonPos: new Oe.Name("jsonPos"), + jsonLen: new Oe.Name("jsonLen"), + jsonPart: new Oe.Name("jsonPart") +}; +ct.default = Ss; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0; + const t = ie, r = ce, a = ct; + e.keywordError = { + message: ({ keyword: x }) => (0, t.str)`must pass "${x}" keyword validation` + }, e.keyword$DataError = { + message: ({ keyword: x, schemaType: v }) => v ? (0, t.str)`"${x}" keyword must be ${v} ($data)` : (0, t.str)`"${x}" keyword is invalid ($data)` + }; + function s(x, v = e.keywordError, C, R) { + const { it: n } = x, { gen: i, compositeRule: o, allErrors: c } = n, u = E(x, v, C); + R ?? (o || c) ? _(i, u) : y(n, (0, t._)`[${u}]`); + } + e.reportError = s; + function l(x, v = e.keywordError, C) { + const { it: R } = x, { gen: n, compositeRule: i, allErrors: o } = R, c = E(x, v, C); + _(n, c), i || o || y(R, a.default.vErrors); + } + e.reportExtraError = l; + function d(x, v) { + x.assign(a.default.errors, v), x.if((0, t._)`${a.default.vErrors} !== null`, () => x.if(v, () => x.assign((0, t._)`${a.default.vErrors}.length`, v), () => x.assign(a.default.vErrors, null))); + } + e.resetErrorsCount = d; + function b({ gen: x, keyword: v, schemaValue: C, data: R, errsCount: n, it: i }) { + if (n === void 0) + throw new Error("ajv implementation error"); + const o = x.name("err"); + x.forRange("i", n, a.default.errors, (c) => { + x.const(o, (0, t._)`${a.default.vErrors}[${c}]`), x.if((0, t._)`${o}.instancePath === undefined`, () => x.assign((0, t._)`${o}.instancePath`, (0, t.strConcat)(a.default.instancePath, i.errorPath))), x.assign((0, t._)`${o}.schemaPath`, (0, t.str)`${i.errSchemaPath}/${v}`), i.opts.verbose && (x.assign((0, t._)`${o}.schema`, C), x.assign((0, t._)`${o}.data`, R)); + }); + } + e.extendErrors = b; + function _(x, v) { + const C = x.const("err", v); + x.if((0, t._)`${a.default.vErrors} === null`, () => x.assign(a.default.vErrors, (0, t._)`[${C}]`), (0, t._)`${a.default.vErrors}.push(${C})`), x.code((0, t._)`${a.default.errors}++`); + } + function y(x, v) { + const { gen: C, validateName: R, schemaEnv: n } = x; + n.$async ? C.throw((0, t._)`new ${x.ValidationError}(${v})`) : (C.assign((0, t._)`${R}.errors`, v), C.return(!1)); + } + const f = { + keyword: new t.Name("keyword"), + schemaPath: new t.Name("schemaPath"), + params: new t.Name("params"), + propertyName: new t.Name("propertyName"), + message: new t.Name("message"), + schema: new t.Name("schema"), + parentSchema: new t.Name("parentSchema") + }; + function E(x, v, C) { + const { createErrors: R } = x.it; + return R === !1 ? (0, t._)`{}` : N(x, v, C); + } + function N(x, v, C = {}) { + const { gen: R, it: n } = x, i = [ + A(n, C), + j(x, C) + ]; + return P(x, v, i), R.object(...i); + } + function A({ errorPath: x }, { instancePath: v }) { + const C = v ? (0, t.str)`${x}${(0, r.getErrorPath)(v, r.Type.Str)}` : x; + return [a.default.instancePath, (0, t.strConcat)(a.default.instancePath, C)]; + } + function j({ keyword: x, it: { errSchemaPath: v } }, { schemaPath: C, parentSchema: R }) { + let n = R ? v : (0, t.str)`${v}/${x}`; + return C && (n = (0, t.str)`${n}${(0, r.getErrorPath)(C, r.Type.Str)}`), [f.schemaPath, n]; + } + function P(x, { params: v, message: C }, R) { + const { keyword: n, data: i, schemaValue: o, it: c } = x, { opts: u, propertyName: m, topSchemaRef: g, schemaPath: O } = c; + R.push([f.keyword, n], [f.params, typeof v == "function" ? v(x) : v || (0, t._)`{}`]), u.messages && R.push([f.message, typeof C == "function" ? C(x) : C]), u.verbose && R.push([f.schema, o], [f.parentSchema, (0, t._)`${g}${O}`], [a.default.data, i]), m && R.push([f.propertyName, m]); + } +})(br); +Object.defineProperty(Ht, "__esModule", { value: !0 }); +Ht.boolOrEmptySchema = Ht.topBoolOrEmptySchema = void 0; +const Ts = br, Cs = ie, xs = ct, Os = { + message: "boolean schema is false" +}; +function Ns(e) { + const { gen: t, schema: r, validateName: a } = e; + r === !1 ? io(e, !1) : typeof r == "object" && r.$async === !0 ? t.return(xs.default.data) : (t.assign((0, Cs._)`${a}.errors`, null), t.return(!0)); +} +Ht.topBoolOrEmptySchema = Ns; +function js(e, t) { + const { gen: r, schema: a } = e; + a === !1 ? (r.var(t, !1), io(e)) : r.var(t, !0); +} +Ht.boolOrEmptySchema = js; +function io(e, t) { + const { gen: r, data: a } = e, s = { + gen: r, + keyword: "false schema", + data: a, + schema: !1, + schemaCode: !1, + schemaValue: !1, + params: {}, + it: e + }; + (0, Ts.reportError)(s, Os, void 0, t); +} +var yr = {}, Nt = {}; +Object.defineProperty(Nt, "__esModule", { value: !0 }); +Nt.getRules = Nt.isJSONType = void 0; +const Ls = ["string", "number", "integer", "boolean", "null", "object", "array"], As = new Set(Ls); +function Rs(e) { + return typeof e == "string" && As.has(e); +} +Nt.isJSONType = Rs; +function Is() { + const e = { + number: { type: "number", rules: [] }, + string: { type: "string", rules: [] }, + array: { type: "array", rules: [] }, + object: { type: "object", rules: [] } + }; + return { + types: { ...e, integer: !0, boolean: !0, null: !0 }, + rules: [{ rules: [] }, e.number, e.string, e.array, e.object], + post: { rules: [] }, + all: {}, + keywords: {} + }; +} +Nt.getRules = Is; +var pt = {}; +Object.defineProperty(pt, "__esModule", { value: !0 }); +pt.shouldUseRule = pt.shouldUseGroup = pt.schemaHasRulesForType = void 0; +function Ms({ schema: e, self: t }, r) { + const a = t.RULES.types[r]; + return a && a !== !0 && lo(e, a); +} +pt.schemaHasRulesForType = Ms; +function lo(e, t) { + return t.rules.some((r) => co(e, r)); +} +pt.shouldUseGroup = lo; +function co(e, t) { + var r; + return e[t.keyword] !== void 0 || ((r = t.definition.implements) === null || r === void 0 ? void 0 : r.some((a) => e[a] !== void 0)); +} +pt.shouldUseRule = co; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0; + const t = Nt, r = pt, a = br, s = ie, l = ce; + var d; + (function(R) { + R[R.Correct = 0] = "Correct", R[R.Wrong = 1] = "Wrong"; + })(d = e.DataType || (e.DataType = {})); + function b(R) { + const n = _(R.type); + if (n.includes("null")) { + if (R.nullable === !1) + throw new Error("type: null contradicts nullable: false"); + } else { + if (!n.length && R.nullable !== void 0) + throw new Error('"nullable" cannot be used without "type"'); + R.nullable === !0 && n.push("null"); + } + return n; + } + e.getSchemaTypes = b; + function _(R) { + const n = Array.isArray(R) ? R : R ? [R] : []; + if (n.every(t.isJSONType)) + return n; + throw new Error("type must be JSONType or JSONType[]: " + n.join(",")); + } + e.getJSONTypes = _; + function y(R, n) { + const { gen: i, data: o, opts: c } = R, u = E(n, c.coerceTypes), m = n.length > 0 && !(u.length === 0 && n.length === 1 && (0, r.schemaHasRulesForType)(R, n[0])); + if (m) { + const g = P(n, o, c.strictNumbers, d.Wrong); + i.if(g, () => { + u.length ? N(R, n, u) : v(R); + }); + } + return m; + } + e.coerceAndCheckDataType = y; + const f = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]); + function E(R, n) { + return n ? R.filter((i) => f.has(i) || n === "array" && i === "array") : []; + } + function N(R, n, i) { + const { gen: o, data: c, opts: u } = R, m = o.let("dataType", (0, s._)`typeof ${c}`), g = o.let("coerced", (0, s._)`undefined`); + u.coerceTypes === "array" && o.if((0, s._)`${m} == 'object' && Array.isArray(${c}) && ${c}.length == 1`, () => o.assign(c, (0, s._)`${c}[0]`).assign(m, (0, s._)`typeof ${c}`).if(P(n, c, u.strictNumbers), () => o.assign(g, c))), o.if((0, s._)`${g} !== undefined`); + for (const z of i) + (f.has(z) || z === "array" && u.coerceTypes === "array") && O(z); + o.else(), v(R), o.endIf(), o.if((0, s._)`${g} !== undefined`, () => { + o.assign(c, g), A(R, g); + }); + function O(z) { + switch (z) { + case "string": + o.elseIf((0, s._)`${m} == "number" || ${m} == "boolean"`).assign(g, (0, s._)`"" + ${c}`).elseIf((0, s._)`${c} === null`).assign(g, (0, s._)`""`); + return; + case "number": + o.elseIf((0, s._)`${m} == "boolean" || ${c} === null + || (${m} == "string" && ${c} && ${c} == +${c})`).assign(g, (0, s._)`+${c}`); + return; + case "integer": + o.elseIf((0, s._)`${m} === "boolean" || ${c} === null + || (${m} === "string" && ${c} && ${c} == +${c} && !(${c} % 1))`).assign(g, (0, s._)`+${c}`); + return; + case "boolean": + o.elseIf((0, s._)`${c} === "false" || ${c} === 0 || ${c} === null`).assign(g, !1).elseIf((0, s._)`${c} === "true" || ${c} === 1`).assign(g, !0); + return; + case "null": + o.elseIf((0, s._)`${c} === "" || ${c} === 0 || ${c} === false`), o.assign(g, null); + return; + case "array": + o.elseIf((0, s._)`${m} === "string" || ${m} === "number" + || ${m} === "boolean" || ${c} === null`).assign(g, (0, s._)`[${c}]`); + } + } + } + function A({ gen: R, parentData: n, parentDataProperty: i }, o) { + R.if((0, s._)`${n} !== undefined`, () => R.assign((0, s._)`${n}[${i}]`, o)); + } + function j(R, n, i, o = d.Correct) { + const c = o === d.Correct ? s.operators.EQ : s.operators.NEQ; + let u; + switch (R) { + case "null": + return (0, s._)`${n} ${c} null`; + case "array": + u = (0, s._)`Array.isArray(${n})`; + break; + case "object": + u = (0, s._)`${n} && typeof ${n} == "object" && !Array.isArray(${n})`; + break; + case "integer": + u = m((0, s._)`!(${n} % 1) && !isNaN(${n})`); + break; + case "number": + u = m(); + break; + default: + return (0, s._)`typeof ${n} ${c} ${R}`; + } + return o === d.Correct ? u : (0, s.not)(u); + function m(g = s.nil) { + return (0, s.and)((0, s._)`typeof ${n} == "number"`, g, i ? (0, s._)`isFinite(${n})` : s.nil); + } + } + e.checkDataType = j; + function P(R, n, i, o) { + if (R.length === 1) + return j(R[0], n, i, o); + let c; + const u = (0, l.toHash)(R); + if (u.array && u.object) { + const m = (0, s._)`typeof ${n} != "object"`; + c = u.null ? m : (0, s._)`!${n} || ${m}`, delete u.null, delete u.array, delete u.object; + } else + c = s.nil; + u.number && delete u.integer; + for (const m in u) + c = (0, s.and)(c, j(m, n, i, o)); + return c; + } + e.checkDataTypes = P; + const x = { + message: ({ schema: R }) => `must be ${R}`, + params: ({ schema: R, schemaValue: n }) => typeof R == "string" ? (0, s._)`{type: ${R}}` : (0, s._)`{type: ${n}}` + }; + function v(R) { + const n = C(R); + (0, a.reportError)(n, x); + } + e.reportTypeError = v; + function C(R) { + const { gen: n, data: i, schema: o } = R, c = (0, l.schemaRefOrVal)(R, o, "type"); + return { + gen: n, + keyword: "type", + data: i, + schema: o.type, + schemaCode: c, + schemaValue: c, + parentSchema: o, + params: {}, + it: R + }; + } +})(yr); +var Zr = {}; +Object.defineProperty(Zr, "__esModule", { value: !0 }); +Zr.assignDefaults = void 0; +const Bt = ie, Ds = ce; +function Bs(e, t) { + const { properties: r, items: a } = e.schema; + if (t === "object" && r) + for (const s in r) + wn(e, s, r[s].default); + else + t === "array" && Array.isArray(a) && a.forEach((s, l) => wn(e, l, s.default)); +} +Zr.assignDefaults = Bs; +function wn(e, t, r) { + const { gen: a, compositeRule: s, data: l, opts: d } = e; + if (r === void 0) + return; + const b = (0, Bt._)`${l}${(0, Bt.getProperty)(t)}`; + if (s) { + (0, Ds.checkStrictMode)(e, `default is ignored for: ${b}`); + return; + } + let _ = (0, Bt._)`${b} === undefined`; + d.useDefaults === "empty" && (_ = (0, Bt._)`${_} || ${b} === null || ${b} === ""`), a.if(_, (0, Bt._)`${b} = ${(0, Bt.stringify)(r)}`); +} +var lt = {}, se = {}; +Object.defineProperty(se, "__esModule", { value: !0 }); +se.validateUnion = se.validateArray = se.usePattern = se.callValidateCode = se.schemaProperties = se.allSchemaProperties = se.noPropertyInData = se.propertyInData = se.isOwnProperty = se.hasPropFunc = se.reportMissingProp = se.checkMissingProp = se.checkReportMissingProp = void 0; +const _e = ie, ba = ce, mt = ct, zs = ce; +function Vs(e, t) { + const { gen: r, data: a, it: s } = e; + r.if(_a(r, a, t, s.opts.ownProperties), () => { + e.setParams({ missingProperty: (0, _e._)`${t}` }, !0), e.error(); + }); +} +se.checkReportMissingProp = Vs; +function Fs({ gen: e, data: t, it: { opts: r } }, a, s) { + return (0, _e.or)(...a.map((l) => (0, _e.and)(_a(e, t, l, r.ownProperties), (0, _e._)`${s} = ${l}`))); +} +se.checkMissingProp = Fs; +function qs(e, t) { + e.setParams({ missingProperty: t }, !0), e.error(); +} +se.reportMissingProp = qs; +function uo(e) { + return e.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: (0, _e._)`Object.prototype.hasOwnProperty` + }); +} +se.hasPropFunc = uo; +function ya(e, t, r) { + return (0, _e._)`${uo(e)}.call(${t}, ${r})`; +} +se.isOwnProperty = ya; +function Us(e, t, r, a) { + const s = (0, _e._)`${t}${(0, _e.getProperty)(r)} !== undefined`; + return a ? (0, _e._)`${s} && ${ya(e, t, r)}` : s; +} +se.propertyInData = Us; +function _a(e, t, r, a) { + const s = (0, _e._)`${t}${(0, _e.getProperty)(r)} === undefined`; + return a ? (0, _e.or)(s, (0, _e.not)(ya(e, t, r))) : s; +} +se.noPropertyInData = _a; +function ho(e) { + return e ? Object.keys(e).filter((t) => t !== "__proto__") : []; +} +se.allSchemaProperties = ho; +function Gs(e, t) { + return ho(t).filter((r) => !(0, ba.alwaysValidSchema)(e, t[r])); +} +se.schemaProperties = Gs; +function Hs({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: a, schemaPath: s, errorPath: l }, it: d }, b, _, y) { + const f = y ? (0, _e._)`${e}, ${t}, ${a}${s}` : t, E = [ + [mt.default.instancePath, (0, _e.strConcat)(mt.default.instancePath, l)], + [mt.default.parentData, d.parentData], + [mt.default.parentDataProperty, d.parentDataProperty], + [mt.default.rootData, mt.default.rootData] + ]; + d.opts.dynamicRef && E.push([mt.default.dynamicAnchors, mt.default.dynamicAnchors]); + const N = (0, _e._)`${f}, ${r.object(...E)}`; + return _ !== _e.nil ? (0, _e._)`${b}.call(${_}, ${N})` : (0, _e._)`${b}(${N})`; +} +se.callValidateCode = Hs; +const Ks = (0, _e._)`new RegExp`; +function Ws({ gen: e, it: { opts: t } }, r) { + const a = t.unicodeRegExp ? "u" : "", { regExp: s } = t.code, l = s(r, a); + return e.scopeValue("pattern", { + key: l.toString(), + ref: l, + code: (0, _e._)`${s.code === "new RegExp" ? Ks : (0, zs.useFunc)(e, s)}(${r}, ${a})` + }); +} +se.usePattern = Ws; +function Ys(e) { + const { gen: t, data: r, keyword: a, it: s } = e, l = t.name("valid"); + if (s.allErrors) { + const b = t.let("valid", !0); + return d(() => t.assign(b, !1)), b; + } + return t.var(l, !0), d(() => t.break()), l; + function d(b) { + const _ = t.const("len", (0, _e._)`${r}.length`); + t.forRange("i", 0, _, (y) => { + e.subschema({ + keyword: a, + dataProp: y, + dataPropType: ba.Type.Num + }, l), t.if((0, _e.not)(l), b); + }); + } +} +se.validateArray = Ys; +function Zs(e) { + const { gen: t, schema: r, keyword: a, it: s } = e; + if (!Array.isArray(r)) + throw new Error("ajv implementation error"); + if (r.some((b) => (0, ba.alwaysValidSchema)(s, b)) && !s.opts.unevaluated) + return; + const l = t.let("valid", !1), d = t.name("_valid"); + t.block(() => r.forEach((b, _) => { + const y = e.subschema({ + keyword: a, + schemaProp: _, + compositeRule: !0 + }, d); + t.assign(l, (0, _e._)`${l} || ${d}`), e.mergeValidEvaluated(y, d) || t.if((0, _e.not)(l)); + })), e.result(l, () => e.reset(), () => e.error(!0)); +} +se.validateUnion = Zs; +Object.defineProperty(lt, "__esModule", { value: !0 }); +lt.validateKeywordUsage = lt.validSchemaType = lt.funcKeywordCode = lt.macroKeywordCode = void 0; +const Ne = ie, Ct = ct, Js = se, Qs = br; +function Xs(e, t) { + const { gen: r, keyword: a, schema: s, parentSchema: l, it: d } = e, b = t.macro.call(d.self, s, l, d), _ = po(r, a, b); + d.opts.validateSchema !== !1 && d.self.validateSchema(b, !0); + const y = r.name("valid"); + e.subschema({ + schema: b, + schemaPath: Ne.nil, + errSchemaPath: `${d.errSchemaPath}/${a}`, + topSchemaRef: _, + compositeRule: !0 + }, y), e.pass(y, () => e.error(!0)); +} +lt.macroKeywordCode = Xs; +function ei(e, t) { + var r; + const { gen: a, keyword: s, schema: l, parentSchema: d, $data: b, it: _ } = e; + ri(_, t); + const y = !b && t.compile ? t.compile.call(_.self, l, d, _) : t.validate, f = po(a, s, y), E = a.let("valid"); + e.block$data(E, N), e.ok((r = t.valid) !== null && r !== void 0 ? r : E); + function N() { + if (t.errors === !1) + P(), t.modifying && vn(e), x(() => e.error()); + else { + const v = t.async ? A() : j(); + t.modifying && vn(e), x(() => ti(e, v)); + } + } + function A() { + const v = a.let("ruleErrs", null); + return a.try(() => P((0, Ne._)`await `), (C) => a.assign(E, !1).if((0, Ne._)`${C} instanceof ${_.ValidationError}`, () => a.assign(v, (0, Ne._)`${C}.errors`), () => a.throw(C))), v; + } + function j() { + const v = (0, Ne._)`${f}.errors`; + return a.assign(v, null), P(Ne.nil), v; + } + function P(v = t.async ? (0, Ne._)`await ` : Ne.nil) { + const C = _.opts.passContext ? Ct.default.this : Ct.default.self, R = !("compile" in t && !b || t.schema === !1); + a.assign(E, (0, Ne._)`${v}${(0, Js.callValidateCode)(e, f, C, R)}`, t.modifying); + } + function x(v) { + var C; + a.if((0, Ne.not)((C = t.valid) !== null && C !== void 0 ? C : E), v); + } +} +lt.funcKeywordCode = ei; +function vn(e) { + const { gen: t, data: r, it: a } = e; + t.if(a.parentData, () => t.assign(r, (0, Ne._)`${a.parentData}[${a.parentDataProperty}]`)); +} +function ti(e, t) { + const { gen: r } = e; + r.if((0, Ne._)`Array.isArray(${t})`, () => { + r.assign(Ct.default.vErrors, (0, Ne._)`${Ct.default.vErrors} === null ? ${t} : ${Ct.default.vErrors}.concat(${t})`).assign(Ct.default.errors, (0, Ne._)`${Ct.default.vErrors}.length`), (0, Qs.extendErrors)(e); + }, () => e.error()); +} +function ri({ schemaEnv: e }, t) { + if (t.async && !e.$async) + throw new Error("async keyword in sync schema"); +} +function po(e, t, r) { + if (r === void 0) + throw new Error(`keyword "${t}" failed to compile`); + return e.scopeValue("keyword", typeof r == "function" ? { ref: r } : { ref: r, code: (0, Ne.stringify)(r) }); +} +function ai(e, t, r = !1) { + return !t.length || t.some((a) => a === "array" ? Array.isArray(e) : a === "object" ? e && typeof e == "object" && !Array.isArray(e) : typeof e == a || r && typeof e > "u"); +} +lt.validSchemaType = ai; +function ni({ schema: e, opts: t, self: r, errSchemaPath: a }, s, l) { + if (Array.isArray(s.keyword) ? !s.keyword.includes(l) : s.keyword !== l) + throw new Error("ajv implementation error"); + const d = s.dependencies; + if (d != null && d.some((b) => !Object.prototype.hasOwnProperty.call(e, b))) + throw new Error(`parent schema must have dependencies of ${l}: ${d.join(",")}`); + if (s.validateSchema && !s.validateSchema(e[l])) { + const b = `keyword "${l}" value is invalid at path "${a}": ` + r.errorsText(s.validateSchema.errors); + if (t.validateSchema === "log") + r.logger.error(b); + else + throw new Error(b); + } +} +lt.validateKeywordUsage = ni; +var _t = {}; +Object.defineProperty(_t, "__esModule", { value: !0 }); +_t.extendSubschemaMode = _t.extendSubschemaData = _t.getSubschema = void 0; +const it = ie, fo = ce; +function oi(e, { keyword: t, schemaProp: r, schema: a, schemaPath: s, errSchemaPath: l, topSchemaRef: d }) { + if (t !== void 0 && a !== void 0) + throw new Error('both "keyword" and "schema" passed, only one allowed'); + if (t !== void 0) { + const b = e.schema[t]; + return r === void 0 ? { + schema: b, + schemaPath: (0, it._)`${e.schemaPath}${(0, it.getProperty)(t)}`, + errSchemaPath: `${e.errSchemaPath}/${t}` + } : { + schema: b[r], + schemaPath: (0, it._)`${e.schemaPath}${(0, it.getProperty)(t)}${(0, it.getProperty)(r)}`, + errSchemaPath: `${e.errSchemaPath}/${t}/${(0, fo.escapeFragment)(r)}` + }; + } + if (a !== void 0) { + if (s === void 0 || l === void 0 || d === void 0) + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + return { + schema: a, + schemaPath: s, + topSchemaRef: d, + errSchemaPath: l + }; + } + throw new Error('either "keyword" or "schema" must be passed'); +} +_t.getSubschema = oi; +function si(e, t, { dataProp: r, dataPropType: a, data: s, dataTypes: l, propertyName: d }) { + if (s !== void 0 && r !== void 0) + throw new Error('both "data" and "dataProp" passed, only one allowed'); + const { gen: b } = t; + if (r !== void 0) { + const { errorPath: y, dataPathArr: f, opts: E } = t, N = b.let("data", (0, it._)`${t.data}${(0, it.getProperty)(r)}`, !0); + _(N), e.errorPath = (0, it.str)`${y}${(0, fo.getErrorPath)(r, a, E.jsPropertySyntax)}`, e.parentDataProperty = (0, it._)`${r}`, e.dataPathArr = [...f, e.parentDataProperty]; + } + if (s !== void 0) { + const y = s instanceof it.Name ? s : b.let("data", s, !0); + _(y), d !== void 0 && (e.propertyName = d); + } + l && (e.dataTypes = l); + function _(y) { + e.data = y, e.dataLevel = t.dataLevel + 1, e.dataTypes = [], t.definedProperties = /* @__PURE__ */ new Set(), e.parentData = t.data, e.dataNames = [...t.dataNames, y]; + } +} +_t.extendSubschemaData = si; +function ii(e, { jtdDiscriminator: t, jtdMetadata: r, compositeRule: a, createErrors: s, allErrors: l }) { + a !== void 0 && (e.compositeRule = a), s !== void 0 && (e.createErrors = s), l !== void 0 && (e.allErrors = l), e.jtdDiscriminator = t, e.jtdMetadata = r; +} +_t.extendSubschemaMode = ii; +var xe = {}, mo = function e(t, r) { + if (t === r) + return !0; + if (t && r && typeof t == "object" && typeof r == "object") { + if (t.constructor !== r.constructor) + return !1; + var a, s, l; + if (Array.isArray(t)) { + if (a = t.length, a != r.length) + return !1; + for (s = a; s-- !== 0; ) + if (!e(t[s], r[s])) + return !1; + return !0; + } + if (t.constructor === RegExp) + return t.source === r.source && t.flags === r.flags; + if (t.valueOf !== Object.prototype.valueOf) + return t.valueOf() === r.valueOf(); + if (t.toString !== Object.prototype.toString) + return t.toString() === r.toString(); + if (l = Object.keys(t), a = l.length, a !== Object.keys(r).length) + return !1; + for (s = a; s-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(r, l[s])) + return !1; + for (s = a; s-- !== 0; ) { + var d = l[s]; + if (!e(t[d], r[d])) + return !1; + } + return !0; + } + return t !== t && r !== r; +}, go = { exports: {} }, yt = go.exports = function(e, t, r) { + typeof t == "function" && (r = t, t = {}), r = t.cb || r; + var a = typeof r == "function" ? r : r.pre || function() { + }, s = r.post || function() { + }; + Ar(t, a, s, e, "", e); +}; +yt.keywords = { + additionalItems: !0, + items: !0, + contains: !0, + additionalProperties: !0, + propertyNames: !0, + not: !0, + if: !0, + then: !0, + else: !0 +}; +yt.arrayKeywords = { + items: !0, + allOf: !0, + anyOf: !0, + oneOf: !0 +}; +yt.propsKeywords = { + $defs: !0, + definitions: !0, + properties: !0, + patternProperties: !0, + dependencies: !0 +}; +yt.skipKeywords = { + default: !0, + enum: !0, + const: !0, + required: !0, + maximum: !0, + minimum: !0, + exclusiveMaximum: !0, + exclusiveMinimum: !0, + multipleOf: !0, + maxLength: !0, + minLength: !0, + pattern: !0, + format: !0, + maxItems: !0, + minItems: !0, + uniqueItems: !0, + maxProperties: !0, + minProperties: !0 +}; +function Ar(e, t, r, a, s, l, d, b, _, y) { + if (a && typeof a == "object" && !Array.isArray(a)) { + t(a, s, l, d, b, _, y); + for (var f in a) { + var E = a[f]; + if (Array.isArray(E)) { + if (f in yt.arrayKeywords) + for (var N = 0; N < E.length; N++) + Ar(e, t, r, E[N], s + "/" + f + "/" + N, l, s, f, a, N); + } else if (f in yt.propsKeywords) { + if (E && typeof E == "object") + for (var A in E) + Ar(e, t, r, E[A], s + "/" + f + "/" + li(A), l, s, f, a, A); + } else + (f in yt.keywords || e.allKeys && !(f in yt.skipKeywords)) && Ar(e, t, r, E, s + "/" + f, l, s, f, a); + } + r(a, s, l, d, b, _, y); + } +} +function li(e) { + return e.replace(/~/g, "~0").replace(/\//g, "~1"); +} +var ci = go.exports; +Object.defineProperty(xe, "__esModule", { value: !0 }); +xe.getSchemaRefs = xe.resolveUrl = xe.normalizeId = xe._getFullPath = xe.getFullPath = xe.inlineRef = void 0; +const ui = ce, di = mo, hi = ci, pi = /* @__PURE__ */ new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const" +]); +function fi(e, t = !0) { + return typeof e == "boolean" ? !0 : t === !0 ? !ua(e) : t ? bo(e) <= t : !1; +} +xe.inlineRef = fi; +const mi = /* @__PURE__ */ new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor" +]); +function ua(e) { + for (const t in e) { + if (mi.has(t)) + return !0; + const r = e[t]; + if (Array.isArray(r) && r.some(ua) || typeof r == "object" && ua(r)) + return !0; + } + return !1; +} +function bo(e) { + let t = 0; + for (const r in e) + if (r === "$ref" || (t++, !pi.has(r) && (typeof e[r] == "object" && (0, ui.eachItem)(e[r], (a) => t += bo(a)), t === 1 / 0))) + return 1 / 0; + return t; +} +function yo(e, t = "", r) { + r !== !1 && (t = qt(t)); + const a = e.parse(t); + return _o(e, a); +} +xe.getFullPath = yo; +function _o(e, t) { + return e.serialize(t).split("#")[0] + "#"; +} +xe._getFullPath = _o; +const gi = /#\/?$/; +function qt(e) { + return e ? e.replace(gi, "") : ""; +} +xe.normalizeId = qt; +function bi(e, t, r) { + return r = qt(r), e.resolve(t, r); +} +xe.resolveUrl = bi; +const yi = /^[a-z_][-a-z0-9._]*$/i; +function _i(e, t) { + if (typeof e == "boolean") + return {}; + const { schemaId: r, uriResolver: a } = this.opts, s = qt(e[r] || t), l = { "": s }, d = yo(a, s, !1), b = {}, _ = /* @__PURE__ */ new Set(); + return hi(e, { allKeys: !0 }, (E, N, A, j) => { + if (j === void 0) + return; + const P = d + N; + let x = l[j]; + typeof E[r] == "string" && (x = v.call(this, E[r])), C.call(this, E.$anchor), C.call(this, E.$dynamicAnchor), l[N] = x; + function v(R) { + const n = this.opts.uriResolver.resolve; + if (R = qt(x ? n(x, R) : R), _.has(R)) + throw f(R); + _.add(R); + let i = this.refs[R]; + return typeof i == "string" && (i = this.refs[i]), typeof i == "object" ? y(E, i.schema, R) : R !== qt(P) && (R[0] === "#" ? (y(E, b[R], R), b[R] = E) : this.refs[R] = P), R; + } + function C(R) { + if (typeof R == "string") { + if (!yi.test(R)) + throw new Error(`invalid anchor "${R}"`); + v.call(this, `#${R}`); + } + } + }), b; + function y(E, N, A) { + if (N !== void 0 && !di(E, N)) + throw f(A); + } + function f(E) { + return new Error(`reference "${E}" resolves to more than one schema`); + } +} +xe.getSchemaRefs = _i; +Object.defineProperty(at, "__esModule", { value: !0 }); +at.getData = at.KeywordCxt = at.validateFunctionCode = void 0; +const wo = Ht, kn = yr, wa = pt, zr = yr, wi = Zr, cr = lt, ra = _t, Z = ie, X = ct, vi = xe, ft = ce, nr = br; +function ki(e) { + if (Eo(e) && ($o(e), ko(e))) { + Pi(e); + return; + } + vo(e, () => (0, wo.topBoolOrEmptySchema)(e)); +} +at.validateFunctionCode = ki; +function vo({ gen: e, validateName: t, schema: r, schemaEnv: a, opts: s }, l) { + s.code.es5 ? e.func(t, (0, Z._)`${X.default.data}, ${X.default.valCxt}`, a.$async, () => { + e.code((0, Z._)`"use strict"; ${En(r, s)}`), $i(e, s), e.code(l); + }) : e.func(t, (0, Z._)`${X.default.data}, ${Ei(s)}`, a.$async, () => e.code(En(r, s)).code(l)); +} +function Ei(e) { + return (0, Z._)`{${X.default.instancePath}="", ${X.default.parentData}, ${X.default.parentDataProperty}, ${X.default.rootData}=${X.default.data}${e.dynamicRef ? (0, Z._)`, ${X.default.dynamicAnchors}={}` : Z.nil}}={}`; +} +function $i(e, t) { + e.if(X.default.valCxt, () => { + e.var(X.default.instancePath, (0, Z._)`${X.default.valCxt}.${X.default.instancePath}`), e.var(X.default.parentData, (0, Z._)`${X.default.valCxt}.${X.default.parentData}`), e.var(X.default.parentDataProperty, (0, Z._)`${X.default.valCxt}.${X.default.parentDataProperty}`), e.var(X.default.rootData, (0, Z._)`${X.default.valCxt}.${X.default.rootData}`), t.dynamicRef && e.var(X.default.dynamicAnchors, (0, Z._)`${X.default.valCxt}.${X.default.dynamicAnchors}`); + }, () => { + e.var(X.default.instancePath, (0, Z._)`""`), e.var(X.default.parentData, (0, Z._)`undefined`), e.var(X.default.parentDataProperty, (0, Z._)`undefined`), e.var(X.default.rootData, X.default.data), t.dynamicRef && e.var(X.default.dynamicAnchors, (0, Z._)`{}`); + }); +} +function Pi(e) { + const { schema: t, opts: r, gen: a } = e; + vo(e, () => { + r.$comment && t.$comment && So(e), Oi(e), a.let(X.default.vErrors, null), a.let(X.default.errors, 0), r.unevaluated && Si(e), Po(e), Li(e); + }); +} +function Si(e) { + const { gen: t, validateName: r } = e; + e.evaluated = t.const("evaluated", (0, Z._)`${r}.evaluated`), t.if((0, Z._)`${e.evaluated}.dynamicProps`, () => t.assign((0, Z._)`${e.evaluated}.props`, (0, Z._)`undefined`)), t.if((0, Z._)`${e.evaluated}.dynamicItems`, () => t.assign((0, Z._)`${e.evaluated}.items`, (0, Z._)`undefined`)); +} +function En(e, t) { + const r = typeof e == "object" && e[t.schemaId]; + return r && (t.code.source || t.code.process) ? (0, Z._)`/*# sourceURL=${r} */` : Z.nil; +} +function Ti(e, t) { + if (Eo(e) && ($o(e), ko(e))) { + Ci(e, t); + return; + } + (0, wo.boolOrEmptySchema)(e, t); +} +function ko({ schema: e, self: t }) { + if (typeof e == "boolean") + return !e; + for (const r in e) + if (t.RULES.all[r]) + return !0; + return !1; +} +function Eo(e) { + return typeof e.schema != "boolean"; +} +function Ci(e, t) { + const { schema: r, gen: a, opts: s } = e; + s.$comment && r.$comment && So(e), Ni(e), ji(e); + const l = a.const("_errs", X.default.errors); + Po(e, l), a.var(t, (0, Z._)`${l} === ${X.default.errors}`); +} +function $o(e) { + (0, ft.checkUnknownRules)(e), xi(e); +} +function Po(e, t) { + if (e.opts.jtd) + return $n(e, [], !1, t); + const r = (0, kn.getSchemaTypes)(e.schema), a = (0, kn.coerceAndCheckDataType)(e, r); + $n(e, r, !a, t); +} +function xi(e) { + const { schema: t, errSchemaPath: r, opts: a, self: s } = e; + t.$ref && a.ignoreKeywordsWithRef && (0, ft.schemaHasRulesButRef)(t, s.RULES) && s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`); +} +function Oi(e) { + const { schema: t, opts: r } = e; + t.default !== void 0 && r.useDefaults && r.strictSchema && (0, ft.checkStrictMode)(e, "default is ignored in the schema root"); +} +function Ni(e) { + const t = e.schema[e.opts.schemaId]; + t && (e.baseId = (0, vi.resolveUrl)(e.opts.uriResolver, e.baseId, t)); +} +function ji(e) { + if (e.schema.$async && !e.schemaEnv.$async) + throw new Error("async schema in sync schema"); +} +function So({ gen: e, schemaEnv: t, schema: r, errSchemaPath: a, opts: s }) { + const l = r.$comment; + if (s.$comment === !0) + e.code((0, Z._)`${X.default.self}.logger.log(${l})`); + else if (typeof s.$comment == "function") { + const d = (0, Z.str)`${a}/$comment`, b = e.scopeValue("root", { ref: t.root }); + e.code((0, Z._)`${X.default.self}.opts.$comment(${l}, ${d}, ${b}.schema)`); + } +} +function Li(e) { + const { gen: t, schemaEnv: r, validateName: a, ValidationError: s, opts: l } = e; + r.$async ? t.if((0, Z._)`${X.default.errors} === 0`, () => t.return(X.default.data), () => t.throw((0, Z._)`new ${s}(${X.default.vErrors})`)) : (t.assign((0, Z._)`${a}.errors`, X.default.vErrors), l.unevaluated && Ai(e), t.return((0, Z._)`${X.default.errors} === 0`)); +} +function Ai({ gen: e, evaluated: t, props: r, items: a }) { + r instanceof Z.Name && e.assign((0, Z._)`${t}.props`, r), a instanceof Z.Name && e.assign((0, Z._)`${t}.items`, a); +} +function $n(e, t, r, a) { + const { gen: s, schema: l, data: d, allErrors: b, opts: _, self: y } = e, { RULES: f } = y; + if (l.$ref && (_.ignoreKeywordsWithRef || !(0, ft.schemaHasRulesButRef)(l, f))) { + s.block(() => xo(e, "$ref", f.all.$ref.definition)); + return; + } + _.jtd || Ri(e, t), s.block(() => { + for (const N of f.rules) + E(N); + E(f.post); + }); + function E(N) { + (0, wa.shouldUseGroup)(l, N) && (N.type ? (s.if((0, zr.checkDataType)(N.type, d, _.strictNumbers)), Pn(e, N), t.length === 1 && t[0] === N.type && r && (s.else(), (0, zr.reportTypeError)(e)), s.endIf()) : Pn(e, N), b || s.if((0, Z._)`${X.default.errors} === ${a || 0}`)); + } +} +function Pn(e, t) { + const { gen: r, schema: a, opts: { useDefaults: s } } = e; + s && (0, wi.assignDefaults)(e, t.type), r.block(() => { + for (const l of t.rules) + (0, wa.shouldUseRule)(a, l) && xo(e, l.keyword, l.definition, t.type); + }); +} +function Ri(e, t) { + e.schemaEnv.meta || !e.opts.strictTypes || (Ii(e, t), e.opts.allowUnionTypes || Mi(e, t), Di(e, e.dataTypes)); +} +function Ii(e, t) { + if (t.length) { + if (!e.dataTypes.length) { + e.dataTypes = t; + return; + } + t.forEach((r) => { + To(e.dataTypes, r) || va(e, `type "${r}" not allowed by context "${e.dataTypes.join(",")}"`); + }), zi(e, t); + } +} +function Mi(e, t) { + t.length > 1 && !(t.length === 2 && t.includes("null")) && va(e, "use allowUnionTypes to allow union type keyword"); +} +function Di(e, t) { + const r = e.self.RULES.all; + for (const a in r) { + const s = r[a]; + if (typeof s == "object" && (0, wa.shouldUseRule)(e.schema, s)) { + const { type: l } = s.definition; + l.length && !l.some((d) => Bi(t, d)) && va(e, `missing type "${l.join(",")}" for keyword "${a}"`); + } + } +} +function Bi(e, t) { + return e.includes(t) || t === "number" && e.includes("integer"); +} +function To(e, t) { + return e.includes(t) || t === "integer" && e.includes("number"); +} +function zi(e, t) { + const r = []; + for (const a of e.dataTypes) + To(t, a) ? r.push(a) : t.includes("integer") && a === "number" && r.push("integer"); + e.dataTypes = r; +} +function va(e, t) { + const r = e.schemaEnv.baseId + e.errSchemaPath; + t += ` at "${r}" (strictTypes)`, (0, ft.checkStrictMode)(e, t, e.opts.strictTypes); +} +class Co { + constructor(t, r, a) { + if ((0, cr.validateKeywordUsage)(t, r, a), this.gen = t.gen, this.allErrors = t.allErrors, this.keyword = a, this.data = t.data, this.schema = t.schema[a], this.$data = r.$data && t.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, ft.schemaRefOrVal)(t, this.schema, a, this.$data), this.schemaType = r.schemaType, this.parentSchema = t.schema, this.params = {}, this.it = t, this.def = r, this.$data) + this.schemaCode = t.gen.const("vSchema", Oo(this.$data, t)); + else if (this.schemaCode = this.schemaValue, !(0, cr.validSchemaType)(this.schema, r.schemaType, r.allowUndefined)) + throw new Error(`${a} value must be ${JSON.stringify(r.schemaType)}`); + ("code" in r ? r.trackErrors : r.errors !== !1) && (this.errsCount = t.gen.const("_errs", X.default.errors)); + } + result(t, r, a) { + this.failResult((0, Z.not)(t), r, a); + } + failResult(t, r, a) { + this.gen.if(t), a ? a() : this.error(), r ? (this.gen.else(), r(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else(); + } + pass(t, r) { + this.failResult((0, Z.not)(t), void 0, r); + } + fail(t) { + if (t === void 0) { + this.error(), this.allErrors || this.gen.if(!1); + return; + } + this.gen.if(t), this.error(), this.allErrors ? this.gen.endIf() : this.gen.else(); + } + fail$data(t) { + if (!this.$data) + return this.fail(t); + const { schemaCode: r } = this; + this.fail((0, Z._)`${r} !== undefined && (${(0, Z.or)(this.invalid$data(), t)})`); + } + error(t, r, a) { + if (r) { + this.setParams(r), this._error(t, a), this.setParams({}); + return; + } + this._error(t, a); + } + _error(t, r) { + (t ? nr.reportExtraError : nr.reportError)(this, this.def.error, r); + } + $dataError() { + (0, nr.reportError)(this, this.def.$dataError || nr.keyword$DataError); + } + reset() { + if (this.errsCount === void 0) + throw new Error('add "trackErrors" to keyword definition'); + (0, nr.resetErrorsCount)(this.gen, this.errsCount); + } + ok(t) { + this.allErrors || this.gen.if(t); + } + setParams(t, r) { + r ? Object.assign(this.params, t) : this.params = t; + } + block$data(t, r, a = Z.nil) { + this.gen.block(() => { + this.check$data(t, a), r(); + }); + } + check$data(t = Z.nil, r = Z.nil) { + if (!this.$data) + return; + const { gen: a, schemaCode: s, schemaType: l, def: d } = this; + a.if((0, Z.or)((0, Z._)`${s} === undefined`, r)), t !== Z.nil && a.assign(t, !0), (l.length || d.validateSchema) && (a.elseIf(this.invalid$data()), this.$dataError(), t !== Z.nil && a.assign(t, !1)), a.else(); + } + invalid$data() { + const { gen: t, schemaCode: r, schemaType: a, def: s, it: l } = this; + return (0, Z.or)(d(), b()); + function d() { + if (a.length) { + if (!(r instanceof Z.Name)) + throw new Error("ajv implementation error"); + const _ = Array.isArray(a) ? a : [a]; + return (0, Z._)`${(0, zr.checkDataTypes)(_, r, l.opts.strictNumbers, zr.DataType.Wrong)}`; + } + return Z.nil; + } + function b() { + if (s.validateSchema) { + const _ = t.scopeValue("validate$data", { ref: s.validateSchema }); + return (0, Z._)`!${_}(${r})`; + } + return Z.nil; + } + } + subschema(t, r) { + const a = (0, ra.getSubschema)(this.it, t); + (0, ra.extendSubschemaData)(a, this.it, t), (0, ra.extendSubschemaMode)(a, t); + const s = { ...this.it, ...a, items: void 0, props: void 0 }; + return Ti(s, r), s; + } + mergeEvaluated(t, r) { + const { it: a, gen: s } = this; + a.opts.unevaluated && (a.props !== !0 && t.props !== void 0 && (a.props = ft.mergeEvaluated.props(s, t.props, a.props, r)), a.items !== !0 && t.items !== void 0 && (a.items = ft.mergeEvaluated.items(s, t.items, a.items, r))); + } + mergeValidEvaluated(t, r) { + const { it: a, gen: s } = this; + if (a.opts.unevaluated && (a.props !== !0 || a.items !== !0)) + return s.if(r, () => this.mergeEvaluated(t, Z.Name)), !0; + } +} +at.KeywordCxt = Co; +function xo(e, t, r, a) { + const s = new Co(e, r, t); + "code" in r ? r.code(s, a) : s.$data && r.validate ? (0, cr.funcKeywordCode)(s, r) : "macro" in r ? (0, cr.macroKeywordCode)(s, r) : (r.compile || r.validate) && (0, cr.funcKeywordCode)(s, r); +} +const Vi = /^\/(?:[^~]|~0|~1)*$/, Fi = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function Oo(e, { dataLevel: t, dataNames: r, dataPathArr: a }) { + let s, l; + if (e === "") + return X.default.rootData; + if (e[0] === "/") { + if (!Vi.test(e)) + throw new Error(`Invalid JSON-pointer: ${e}`); + s = e, l = X.default.rootData; + } else { + const y = Fi.exec(e); + if (!y) + throw new Error(`Invalid JSON-pointer: ${e}`); + const f = +y[1]; + if (s = y[2], s === "#") { + if (f >= t) + throw new Error(_("property/index", f)); + return a[t - f]; + } + if (f > t) + throw new Error(_("data", f)); + if (l = r[t - f], !s) + return l; + } + let d = l; + const b = s.split("/"); + for (const y of b) + y && (l = (0, Z._)`${l}${(0, Z.getProperty)((0, ft.unescapeJsonPointer)(y))}`, d = (0, Z._)`${d} && ${l}`); + return d; + function _(y, f) { + return `Cannot access ${y} ${f} levels up, current level is ${t}`; + } +} +at.getData = Oo; +var _r = {}; +Object.defineProperty(_r, "__esModule", { value: !0 }); +class qi extends Error { + constructor(t) { + super("validation failed"), this.errors = t, this.ajv = this.validation = !0; + } +} +_r.default = qi; +var wr = {}; +Object.defineProperty(wr, "__esModule", { value: !0 }); +const aa = xe; +class Ui extends Error { + constructor(t, r, a, s) { + super(s || `can't resolve reference ${a} from id ${r}`), this.missingRef = (0, aa.resolveUrl)(t, r, a), this.missingSchema = (0, aa.normalizeId)((0, aa.getFullPath)(t, this.missingRef)); + } +} +wr.default = Ui; +var Be = {}; +Object.defineProperty(Be, "__esModule", { value: !0 }); +Be.resolveSchema = Be.getCompilingSchema = Be.resolveRef = Be.compileSchema = Be.SchemaEnv = void 0; +const Qe = ie, Gi = _r, Pt = ct, rt = xe, Sn = ce, Hi = at; +class Jr { + constructor(t) { + var r; + this.refs = {}, this.dynamicAnchors = {}; + let a; + typeof t.schema == "object" && (a = t.schema), this.schema = t.schema, this.schemaId = t.schemaId, this.root = t.root || this, this.baseId = (r = t.baseId) !== null && r !== void 0 ? r : (0, rt.normalizeId)(a == null ? void 0 : a[t.schemaId || "$id"]), this.schemaPath = t.schemaPath, this.localRefs = t.localRefs, this.meta = t.meta, this.$async = a == null ? void 0 : a.$async, this.refs = {}; + } +} +Be.SchemaEnv = Jr; +function ka(e) { + const t = No.call(this, e); + if (t) + return t; + const r = (0, rt.getFullPath)(this.opts.uriResolver, e.root.baseId), { es5: a, lines: s } = this.opts.code, { ownProperties: l } = this.opts, d = new Qe.CodeGen(this.scope, { es5: a, lines: s, ownProperties: l }); + let b; + e.$async && (b = d.scopeValue("Error", { + ref: Gi.default, + code: (0, Qe._)`require("ajv/dist/runtime/validation_error").default` + })); + const _ = d.scopeName("validate"); + e.validateName = _; + const y = { + gen: d, + allErrors: this.opts.allErrors, + data: Pt.default.data, + parentData: Pt.default.parentData, + parentDataProperty: Pt.default.parentDataProperty, + dataNames: [Pt.default.data], + dataPathArr: [Qe.nil], + dataLevel: 0, + dataTypes: [], + definedProperties: /* @__PURE__ */ new Set(), + topSchemaRef: d.scopeValue("schema", this.opts.code.source === !0 ? { ref: e.schema, code: (0, Qe.stringify)(e.schema) } : { ref: e.schema }), + validateName: _, + ValidationError: b, + schema: e.schema, + schemaEnv: e, + rootId: r, + baseId: e.baseId || r, + schemaPath: Qe.nil, + errSchemaPath: e.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: (0, Qe._)`""`, + opts: this.opts, + self: this + }; + let f; + try { + this._compilations.add(e), (0, Hi.validateFunctionCode)(y), d.optimize(this.opts.code.optimize); + const E = d.toString(); + f = `${d.scopeRefs(Pt.default.scope)}return ${E}`, this.opts.code.process && (f = this.opts.code.process(f, e)); + const N = new Function(`${Pt.default.self}`, `${Pt.default.scope}`, f)(this, this.scope.get()); + if (this.scope.value(_, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: _, validateCode: E, scopeValues: d._values }), this.opts.unevaluated) { + const { props: A, items: j } = y; + N.evaluated = { + props: A instanceof Qe.Name ? void 0 : A, + items: j instanceof Qe.Name ? void 0 : j, + dynamicProps: A instanceof Qe.Name, + dynamicItems: j instanceof Qe.Name + }, N.source && (N.source.evaluated = (0, Qe.stringify)(N.evaluated)); + } + return e.validate = N, e; + } catch (E) { + throw delete e.validate, delete e.validateName, f && this.logger.error("Error compiling schema, function code:", f), E; + } finally { + this._compilations.delete(e); + } +} +Be.compileSchema = ka; +function Ki(e, t, r) { + var a; + r = (0, rt.resolveUrl)(this.opts.uriResolver, t, r); + const s = e.refs[r]; + if (s) + return s; + let l = Zi.call(this, e, r); + if (l === void 0) { + const d = (a = e.localRefs) === null || a === void 0 ? void 0 : a[r], { schemaId: b } = this.opts; + d && (l = new Jr({ schema: d, schemaId: b, root: e, baseId: t })); + } + if (l !== void 0) + return e.refs[r] = Wi.call(this, l); +} +Be.resolveRef = Ki; +function Wi(e) { + return (0, rt.inlineRef)(e.schema, this.opts.inlineRefs) ? e.schema : e.validate ? e : ka.call(this, e); +} +function No(e) { + for (const t of this._compilations) + if (Yi(t, e)) + return t; +} +Be.getCompilingSchema = No; +function Yi(e, t) { + return e.schema === t.schema && e.root === t.root && e.baseId === t.baseId; +} +function Zi(e, t) { + let r; + for (; typeof (r = this.refs[t]) == "string"; ) + t = r; + return r || this.schemas[t] || Qr.call(this, e, t); +} +function Qr(e, t) { + const r = this.opts.uriResolver.parse(t), a = (0, rt._getFullPath)(this.opts.uriResolver, r); + let s = (0, rt.getFullPath)(this.opts.uriResolver, e.baseId, void 0); + if (Object.keys(e.schema).length > 0 && a === s) + return na.call(this, r, e); + const l = (0, rt.normalizeId)(a), d = this.refs[l] || this.schemas[l]; + if (typeof d == "string") { + const b = Qr.call(this, e, d); + return typeof (b == null ? void 0 : b.schema) != "object" ? void 0 : na.call(this, r, b); + } + if (typeof (d == null ? void 0 : d.schema) == "object") { + if (d.validate || ka.call(this, d), l === (0, rt.normalizeId)(t)) { + const { schema: b } = d, { schemaId: _ } = this.opts, y = b[_]; + return y && (s = (0, rt.resolveUrl)(this.opts.uriResolver, s, y)), new Jr({ schema: b, schemaId: _, root: e, baseId: s }); + } + return na.call(this, r, d); + } +} +Be.resolveSchema = Qr; +const Ji = /* @__PURE__ */ new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions" +]); +function na(e, { baseId: t, schema: r, root: a }) { + var s; + if (((s = e.fragment) === null || s === void 0 ? void 0 : s[0]) !== "/") + return; + for (const b of e.fragment.slice(1).split("/")) { + if (typeof r == "boolean") + return; + const _ = r[(0, Sn.unescapeFragment)(b)]; + if (_ === void 0) + return; + r = _; + const y = typeof r == "object" && r[this.opts.schemaId]; + !Ji.has(b) && y && (t = (0, rt.resolveUrl)(this.opts.uriResolver, t, y)); + } + let l; + if (typeof r != "boolean" && r.$ref && !(0, Sn.schemaHasRulesButRef)(r, this.RULES)) { + const b = (0, rt.resolveUrl)(this.opts.uriResolver, t, r.$ref); + l = Qr.call(this, a, b); + } + const { schemaId: d } = this.opts; + if (l = l || new Jr({ schema: r, schemaId: d, root: a, baseId: t }), l.schema !== l.root.schema) + return l; +} +const Qi = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", Xi = "Meta-schema for $data reference (JSON AnySchema extension proposal)", el = "object", tl = [ + "$data" +], rl = { + $data: { + type: "string", + anyOf: [ + { + format: "relative-json-pointer" + }, + { + format: "json-pointer" + } + ] + } +}, al = !1, nl = { + $id: Qi, + description: Xi, + type: el, + required: tl, + properties: rl, + additionalProperties: al +}; +var Ea = {}, da = { exports: {} }; +/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +(function(e, t) { + (function(r, a) { + a(t); + })(no, function(r) { + function a() { + for (var p = arguments.length, k = Array(p), T = 0; T < p; T++) + k[T] = arguments[T]; + if (k.length > 1) { + k[0] = k[0].slice(0, -1); + for (var M = k.length - 1, D = 1; D < M; ++D) + k[D] = k[D].slice(1, -1); + return k[M] = k[M].slice(1), k.join(""); + } else + return k[0]; + } + function s(p) { + return "(?:" + p + ")"; + } + function l(p) { + return p === void 0 ? "undefined" : p === null ? "null" : Object.prototype.toString.call(p).split(" ").pop().split("]").shift().toLowerCase(); + } + function d(p) { + return p.toUpperCase(); + } + function b(p) { + return p != null ? p instanceof Array ? p : typeof p.length != "number" || p.split || p.setInterval || p.call ? [p] : Array.prototype.slice.call(p) : []; + } + function _(p, k) { + var T = p; + if (k) + for (var M in k) + T[M] = k[M]; + return T; + } + function y(p) { + var k = "[A-Za-z]", T = "[0-9]", M = a(T, "[A-Fa-f]"), D = s(s("%[EFef]" + M + "%" + M + M + "%" + M + M) + "|" + s("%[89A-Fa-f]" + M + "%" + M + M) + "|" + s("%" + M + M)), Q = "[\\:\\/\\?\\#\\[\\]\\@]", J = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", ue = a(Q, J), ke = p ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", pe = p ? "[\\uE000-\\uF8FF]" : "[]", le = a(k, T, "[\\-\\.\\_\\~]", ke); + s(k + a(k, T, "[\\+\\-\\.]") + "*"), s(s(D + "|" + a(le, J, "[\\:]")) + "*"); + var ye = s(s("25[0-5]") + "|" + s("2[0-4]" + T) + "|" + s("1" + T + T) + "|" + s("0?[1-9]" + T) + "|0?0?" + T), we = s(ye + "\\." + ye + "\\." + ye + "\\." + ye), ee = s(M + "{1,4}"), Ee = s(s(ee + "\\:" + ee) + "|" + we), fe = s(s(ee + "\\:") + "{6}" + Ee), qe = s("\\:\\:" + s(ee + "\\:") + "{5}" + Ee), Dt = s(s(ee) + "?\\:\\:" + s(ee + "\\:") + "{4}" + Ee), Je = s(s(s(ee + "\\:") + "{0,1}" + ee) + "?\\:\\:" + s(ee + "\\:") + "{3}" + Ee), dt = s(s(s(ee + "\\:") + "{0,2}" + ee) + "?\\:\\:" + s(ee + "\\:") + "{2}" + Ee), kt = s(s(s(ee + "\\:") + "{0,3}" + ee) + "?\\:\\:" + ee + "\\:" + Ee), Et = s(s(s(ee + "\\:") + "{0,4}" + ee) + "?\\:\\:" + Ee), Ue = s(s(s(ee + "\\:") + "{0,5}" + ee) + "?\\:\\:" + ee), ht = s(s(s(ee + "\\:") + "{0,6}" + ee) + "?\\:\\:"), $t = s([fe, qe, Dt, Je, dt, kt, Et, Ue, ht].join("|")), st = s(s(le + "|" + D) + "+"); + s("[vV]" + M + "+\\." + a(le, J, "[\\:]") + "+"), s(s(D + "|" + a(le, J)) + "*"); + var Er = s(D + "|" + a(le, J, "[\\:\\@]")); + return s(s(D + "|" + a(le, J, "[\\@]")) + "+"), s(s(Er + "|" + a("[\\/\\?]", pe)) + "*"), { + NOT_SCHEME: new RegExp(a("[^]", k, T, "[\\+\\-\\.]"), "g"), + NOT_USERINFO: new RegExp(a("[^\\%\\:]", le, J), "g"), + NOT_HOST: new RegExp(a("[^\\%\\[\\]\\:]", le, J), "g"), + NOT_PATH: new RegExp(a("[^\\%\\/\\:\\@]", le, J), "g"), + NOT_PATH_NOSCHEME: new RegExp(a("[^\\%\\/\\@]", le, J), "g"), + NOT_QUERY: new RegExp(a("[^\\%]", le, J, "[\\:\\@\\/\\?]", pe), "g"), + NOT_FRAGMENT: new RegExp(a("[^\\%]", le, J, "[\\:\\@\\/\\?]"), "g"), + ESCAPE: new RegExp(a("[^]", le, J), "g"), + UNRESERVED: new RegExp(le, "g"), + OTHER_CHARS: new RegExp(a("[^\\%]", le, ue), "g"), + PCT_ENCODED: new RegExp(D, "g"), + IPV4ADDRESS: new RegExp("^(" + we + ")$"), + IPV6ADDRESS: new RegExp("^\\[?(" + $t + ")" + s(s("\\%25|\\%(?!" + M + "{2})") + "(" + st + ")") + "?\\]?$") + //RFC 6874, with relaxed parsing rules + }; + } + var f = y(!1), E = y(!0), N = function() { + function p(k, T) { + var M = [], D = !0, Q = !1, J = void 0; + try { + for (var ue = k[Symbol.iterator](), ke; !(D = (ke = ue.next()).done) && (M.push(ke.value), !(T && M.length === T)); D = !0) + ; + } catch (pe) { + Q = !0, J = pe; + } finally { + try { + !D && ue.return && ue.return(); + } finally { + if (Q) + throw J; + } + } + return M; + } + return function(k, T) { + if (Array.isArray(k)) + return k; + if (Symbol.iterator in Object(k)) + return p(k, T); + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + }; + }(), A = function(p) { + if (Array.isArray(p)) { + for (var k = 0, T = Array(p.length); k < p.length; k++) + T[k] = p[k]; + return T; + } else + return Array.from(p); + }, j = 2147483647, P = 36, x = 1, v = 26, C = 38, R = 700, n = 72, i = 128, o = "-", c = /^xn--/, u = /[^\0-\x7E]/, m = /[\x2E\u3002\uFF0E\uFF61]/g, g = { + overflow: "Overflow: input needs wider integers to process", + "not-basic": "Illegal input >= 0x80 (not a basic code point)", + "invalid-input": "Invalid input" + }, O = P - x, z = Math.floor, q = String.fromCharCode; + function B(p) { + throw new RangeError(g[p]); + } + function G(p, k) { + for (var T = [], M = p.length; M--; ) + T[M] = k(p[M]); + return T; + } + function w(p, k) { + var T = p.split("@"), M = ""; + T.length > 1 && (M = T[0] + "@", p = T[1]), p = p.replace(m, "."); + var D = p.split("."), Q = G(D, k).join("."); + return M + Q; + } + function U(p) { + for (var k = [], T = 0, M = p.length; T < M; ) { + var D = p.charCodeAt(T++); + if (D >= 55296 && D <= 56319 && T < M) { + var Q = p.charCodeAt(T++); + (Q & 64512) == 56320 ? k.push(((D & 1023) << 10) + (Q & 1023) + 65536) : (k.push(D), T--); + } else + k.push(D); + } + return k; + } + var W = function(p) { + return String.fromCodePoint.apply(String, A(p)); + }, Y = function(p) { + return p - 48 < 10 ? p - 22 : p - 65 < 26 ? p - 65 : p - 97 < 26 ? p - 97 : P; + }, V = function(p, k) { + return p + 22 + 75 * (p < 26) - ((k != 0) << 5); + }, S = function(p, k, T) { + var M = 0; + for ( + p = T ? z(p / R) : p >> 1, p += z(p / k); + /* no initialization */ + p > O * v >> 1; + M += P + ) + p = z(p / O); + return z(M + (O + 1) * p / (p + C)); + }, F = function(p) { + var k = [], T = p.length, M = 0, D = i, Q = n, J = p.lastIndexOf(o); + J < 0 && (J = 0); + for (var ue = 0; ue < J; ++ue) + p.charCodeAt(ue) >= 128 && B("not-basic"), k.push(p.charCodeAt(ue)); + for (var ke = J > 0 ? J + 1 : 0; ke < T; ) { + for ( + var pe = M, le = 1, ye = P; + ; + /* no condition */ + ye += P + ) { + ke >= T && B("invalid-input"); + var we = Y(p.charCodeAt(ke++)); + (we >= P || we > z((j - M) / le)) && B("overflow"), M += we * le; + var ee = ye <= Q ? x : ye >= Q + v ? v : ye - Q; + if (we < ee) + break; + var Ee = P - ee; + le > z(j / Ee) && B("overflow"), le *= Ee; + } + var fe = k.length + 1; + Q = S(M - pe, fe, pe == 0), z(M / fe) > j - D && B("overflow"), D += z(M / fe), M %= fe, k.splice(M++, 0, D); + } + return String.fromCodePoint.apply(String, k); + }, L = function(p) { + var k = []; + p = U(p); + var T = p.length, M = i, D = 0, Q = n, J = !0, ue = !1, ke = void 0; + try { + for (var pe = p[Symbol.iterator](), le; !(J = (le = pe.next()).done); J = !0) { + var ye = le.value; + ye < 128 && k.push(q(ye)); + } + } catch (ar) { + ue = !0, ke = ar; + } finally { + try { + !J && pe.return && pe.return(); + } finally { + if (ue) + throw ke; + } + } + var we = k.length, ee = we; + for (we && k.push(o); ee < T; ) { + var Ee = j, fe = !0, qe = !1, Dt = void 0; + try { + for (var Je = p[Symbol.iterator](), dt; !(fe = (dt = Je.next()).done); fe = !0) { + var kt = dt.value; + kt >= M && kt < Ee && (Ee = kt); + } + } catch (ar) { + qe = !0, Dt = ar; + } finally { + try { + !fe && Je.return && Je.return(); + } finally { + if (qe) + throw Dt; + } + } + var Et = ee + 1; + Ee - M > z((j - D) / Et) && B("overflow"), D += (Ee - M) * Et, M = Ee; + var Ue = !0, ht = !1, $t = void 0; + try { + for (var st = p[Symbol.iterator](), Er; !(Ue = (Er = st.next()).done); Ue = !0) { + var gn = Er.value; + if (gn < M && ++D > j && B("overflow"), gn == M) { + for ( + var $r = D, Pr = P; + ; + /* no condition */ + Pr += P + ) { + var Sr = Pr <= Q ? x : Pr >= Q + v ? v : Pr - Q; + if ($r < Sr) + break; + var bn = $r - Sr, yn = P - Sr; + k.push(q(V(Sr + bn % yn, 0))), $r = z(bn / yn); + } + k.push(q(V($r, 0))), Q = S(D, Et, ee == we), D = 0, ++ee; + } + } + } catch (ar) { + ht = !0, $t = ar; + } finally { + try { + !Ue && st.return && st.return(); + } finally { + if (ht) + throw $t; + } + } + ++D, ++M; + } + return k.join(""); + }, h = function(p) { + return w(p, function(k) { + return c.test(k) ? F(k.slice(4).toLowerCase()) : k; + }); + }, $ = function(p) { + return w(p, function(k) { + return u.test(k) ? "xn--" + L(k) : k; + }); + }, I = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + version: "2.1.0", + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + ucs2: { + decode: U, + encode: W + }, + decode: F, + encode: L, + toASCII: $, + toUnicode: h + }, H = {}; + function K(p) { + var k = p.charCodeAt(0), T = void 0; + return k < 16 ? T = "%0" + k.toString(16).toUpperCase() : k < 128 ? T = "%" + k.toString(16).toUpperCase() : k < 2048 ? T = "%" + (k >> 6 | 192).toString(16).toUpperCase() + "%" + (k & 63 | 128).toString(16).toUpperCase() : T = "%" + (k >> 12 | 224).toString(16).toUpperCase() + "%" + (k >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (k & 63 | 128).toString(16).toUpperCase(), T; + } + function te(p) { + for (var k = "", T = 0, M = p.length; T < M; ) { + var D = parseInt(p.substr(T + 1, 2), 16); + if (D < 128) + k += String.fromCharCode(D), T += 3; + else if (D >= 194 && D < 224) { + if (M - T >= 6) { + var Q = parseInt(p.substr(T + 4, 2), 16); + k += String.fromCharCode((D & 31) << 6 | Q & 63); + } else + k += p.substr(T, 6); + T += 6; + } else if (D >= 224) { + if (M - T >= 9) { + var J = parseInt(p.substr(T + 4, 2), 16), ue = parseInt(p.substr(T + 7, 2), 16); + k += String.fromCharCode((D & 15) << 12 | (J & 63) << 6 | ue & 63); + } else + k += p.substr(T, 9); + T += 9; + } else + k += p.substr(T, 3), T += 3; + } + return k; + } + function ne(p, k) { + function T(M) { + var D = te(M); + return D.match(k.UNRESERVED) ? D : M; + } + return p.scheme && (p.scheme = String(p.scheme).replace(k.PCT_ENCODED, T).toLowerCase().replace(k.NOT_SCHEME, "")), p.userinfo !== void 0 && (p.userinfo = String(p.userinfo).replace(k.PCT_ENCODED, T).replace(k.NOT_USERINFO, K).replace(k.PCT_ENCODED, d)), p.host !== void 0 && (p.host = String(p.host).replace(k.PCT_ENCODED, T).toLowerCase().replace(k.NOT_HOST, K).replace(k.PCT_ENCODED, d)), p.path !== void 0 && (p.path = String(p.path).replace(k.PCT_ENCODED, T).replace(p.scheme ? k.NOT_PATH : k.NOT_PATH_NOSCHEME, K).replace(k.PCT_ENCODED, d)), p.query !== void 0 && (p.query = String(p.query).replace(k.PCT_ENCODED, T).replace(k.NOT_QUERY, K).replace(k.PCT_ENCODED, d)), p.fragment !== void 0 && (p.fragment = String(p.fragment).replace(k.PCT_ENCODED, T).replace(k.NOT_FRAGMENT, K).replace(k.PCT_ENCODED, d)), p; + } + function be(p) { + return p.replace(/^0*(.*)/, "$1") || "0"; + } + function Ae(p, k) { + var T = p.match(k.IPV4ADDRESS) || [], M = N(T, 2), D = M[1]; + return D ? D.split(".").map(be).join(".") : p; + } + function ut(p, k) { + var T = p.match(k.IPV6ADDRESS) || [], M = N(T, 3), D = M[1], Q = M[2]; + if (D) { + for (var J = D.toLowerCase().split("::").reverse(), ue = N(J, 2), ke = ue[0], pe = ue[1], le = pe ? pe.split(":").map(be) : [], ye = ke.split(":").map(be), we = k.IPV4ADDRESS.test(ye[ye.length - 1]), ee = we ? 7 : 8, Ee = ye.length - ee, fe = Array(ee), qe = 0; qe < ee; ++qe) + fe[qe] = le[qe] || ye[Ee + qe] || ""; + we && (fe[ee - 1] = Ae(fe[ee - 1], k)); + var Dt = fe.reduce(function(Ue, ht, $t) { + if (!ht || ht === "0") { + var st = Ue[Ue.length - 1]; + st && st.index + st.length === $t ? st.length++ : Ue.push({ index: $t, length: 1 }); + } + return Ue; + }, []), Je = Dt.sort(function(Ue, ht) { + return ht.length - Ue.length; + })[0], dt = void 0; + if (Je && Je.length > 1) { + var kt = fe.slice(0, Je.index), Et = fe.slice(Je.index + Je.length); + dt = kt.join(":") + "::" + Et.join(":"); + } else + dt = fe.join(":"); + return Q && (dt += "%" + Q), dt; + } else + return p; + } + var Zt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Jt = "".match(/(){0}/)[1] === void 0; + function ze(p) { + var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, T = {}, M = k.iri !== !1 ? E : f; + k.reference === "suffix" && (p = (k.scheme ? k.scheme + ":" : "") + "//" + p); + var D = p.match(Zt); + if (D) { + Jt ? (T.scheme = D[1], T.userinfo = D[3], T.host = D[4], T.port = parseInt(D[5], 10), T.path = D[6] || "", T.query = D[7], T.fragment = D[8], isNaN(T.port) && (T.port = D[5])) : (T.scheme = D[1] || void 0, T.userinfo = p.indexOf("@") !== -1 ? D[3] : void 0, T.host = p.indexOf("//") !== -1 ? D[4] : void 0, T.port = parseInt(D[5], 10), T.path = D[6] || "", T.query = p.indexOf("?") !== -1 ? D[7] : void 0, T.fragment = p.indexOf("#") !== -1 ? D[8] : void 0, isNaN(T.port) && (T.port = p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? D[4] : void 0)), T.host && (T.host = ut(Ae(T.host, M), M)), T.scheme === void 0 && T.userinfo === void 0 && T.host === void 0 && T.port === void 0 && !T.path && T.query === void 0 ? T.reference = "same-document" : T.scheme === void 0 ? T.reference = "relative" : T.fragment === void 0 ? T.reference = "absolute" : T.reference = "uri", k.reference && k.reference !== "suffix" && k.reference !== T.reference && (T.error = T.error || "URI is not a " + k.reference + " reference."); + var Q = H[(k.scheme || T.scheme || "").toLowerCase()]; + if (!k.unicodeSupport && (!Q || !Q.unicodeSupport)) { + if (T.host && (k.domainHost || Q && Q.domainHost)) + try { + T.host = I.toASCII(T.host.replace(M.PCT_ENCODED, te).toLowerCase()); + } catch (J) { + T.error = T.error || "Host's domain name can not be converted to ASCII via punycode: " + J; + } + ne(T, f); + } else + ne(T, M); + Q && Q.parse && Q.parse(T, k); + } else + T.error = T.error || "URI can not be parsed."; + return T; + } + function Qt(p, k) { + var T = k.iri !== !1 ? E : f, M = []; + return p.userinfo !== void 0 && (M.push(p.userinfo), M.push("@")), p.host !== void 0 && M.push(ut(Ae(String(p.host), T), T).replace(T.IPV6ADDRESS, function(D, Q, J) { + return "[" + Q + (J ? "%25" + J : "") + "]"; + })), (typeof p.port == "number" || typeof p.port == "string") && (M.push(":"), M.push(String(p.port))), M.length ? M.join("") : void 0; + } + var Lt = /^\.\.?\//, At = /^\/\.(\/|$)/, Rt = /^\/\.\.(\/|$)/, Xt = /^\/?(?:.|\n)*?(?=\/|$)/; + function nt(p) { + for (var k = []; p.length; ) + if (p.match(Lt)) + p = p.replace(Lt, ""); + else if (p.match(At)) + p = p.replace(At, "/"); + else if (p.match(Rt)) + p = p.replace(Rt, "/"), k.pop(); + else if (p === "." || p === "..") + p = ""; + else { + var T = p.match(Xt); + if (T) { + var M = T[0]; + p = p.slice(M.length), k.push(M); + } else + throw new Error("Unexpected dot segment condition"); + } + return k.join(""); + } + function Re(p) { + var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, T = k.iri ? E : f, M = [], D = H[(k.scheme || p.scheme || "").toLowerCase()]; + if (D && D.serialize && D.serialize(p, k), p.host && !T.IPV6ADDRESS.test(p.host) && (k.domainHost || D && D.domainHost)) + try { + p.host = k.iri ? I.toUnicode(p.host) : I.toASCII(p.host.replace(T.PCT_ENCODED, te).toLowerCase()); + } catch (ue) { + p.error = p.error || "Host's domain name can not be converted to " + (k.iri ? "Unicode" : "ASCII") + " via punycode: " + ue; + } + ne(p, T), k.reference !== "suffix" && p.scheme && (M.push(p.scheme), M.push(":")); + var Q = Qt(p, k); + if (Q !== void 0 && (k.reference !== "suffix" && M.push("//"), M.push(Q), p.path && p.path.charAt(0) !== "/" && M.push("/")), p.path !== void 0) { + var J = p.path; + !k.absolutePath && (!D || !D.absolutePath) && (J = nt(J)), Q === void 0 && (J = J.replace(/^\/\//, "/%2F")), M.push(J); + } + return p.query !== void 0 && (M.push("?"), M.push(p.query)), p.fragment !== void 0 && (M.push("#"), M.push(p.fragment)), M.join(""); + } + function It(p, k) { + var T = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, M = arguments[3], D = {}; + return M || (p = ze(Re(p, T), T), k = ze(Re(k, T), T)), T = T || {}, !T.tolerant && k.scheme ? (D.scheme = k.scheme, D.userinfo = k.userinfo, D.host = k.host, D.port = k.port, D.path = nt(k.path || ""), D.query = k.query) : (k.userinfo !== void 0 || k.host !== void 0 || k.port !== void 0 ? (D.userinfo = k.userinfo, D.host = k.host, D.port = k.port, D.path = nt(k.path || ""), D.query = k.query) : (k.path ? (k.path.charAt(0) === "/" ? D.path = nt(k.path) : ((p.userinfo !== void 0 || p.host !== void 0 || p.port !== void 0) && !p.path ? D.path = "/" + k.path : p.path ? D.path = p.path.slice(0, p.path.lastIndexOf("/") + 1) + k.path : D.path = k.path, D.path = nt(D.path)), D.query = k.query) : (D.path = p.path, k.query !== void 0 ? D.query = k.query : D.query = p.query), D.userinfo = p.userinfo, D.host = p.host, D.port = p.port), D.scheme = p.scheme), D.fragment = k.fragment, D; + } + function er(p, k, T) { + var M = _({ scheme: "null" }, T); + return Re(It(ze(p, M), ze(k, M), M, !0), M); + } + function wt(p, k) { + return typeof p == "string" ? p = Re(ze(p, k), k) : l(p) === "object" && (p = ze(Re(p, k), k)), p; + } + function tr(p, k, T) { + return typeof p == "string" ? p = Re(ze(p, T), T) : l(p) === "object" && (p = Re(p, T)), typeof k == "string" ? k = Re(ze(k, T), T) : l(k) === "object" && (k = Re(k, T)), p === k; + } + function kr(p, k) { + return p && p.toString().replace(!k || !k.iri ? f.ESCAPE : E.ESCAPE, K); + } + function Fe(p, k) { + return p && p.toString().replace(!k || !k.iri ? f.PCT_ENCODED : E.PCT_ENCODED, te); + } + var vt = { + scheme: "http", + domainHost: !0, + parse: function(p, k) { + return p.host || (p.error = p.error || "HTTP URIs must have a host."), p; + }, + serialize: function(p, k) { + var T = String(p.scheme).toLowerCase() === "https"; + return (p.port === (T ? 443 : 80) || p.port === "") && (p.port = void 0), p.path || (p.path = "/"), p; + } + }, ln = { + scheme: "https", + domainHost: vt.domainHost, + parse: vt.parse, + serialize: vt.serialize + }; + function cn(p) { + return typeof p.secure == "boolean" ? p.secure : String(p.scheme).toLowerCase() === "wss"; + } + var rr = { + scheme: "ws", + domainHost: !0, + parse: function(p, k) { + var T = p; + return T.secure = cn(T), T.resourceName = (T.path || "/") + (T.query ? "?" + T.query : ""), T.path = void 0, T.query = void 0, T; + }, + serialize: function(p, k) { + if ((p.port === (cn(p) ? 443 : 80) || p.port === "") && (p.port = void 0), typeof p.secure == "boolean" && (p.scheme = p.secure ? "wss" : "ws", p.secure = void 0), p.resourceName) { + var T = p.resourceName.split("?"), M = N(T, 2), D = M[0], Q = M[1]; + p.path = D && D !== "/" ? D : void 0, p.query = Q, p.resourceName = void 0; + } + return p.fragment = void 0, p; + } + }, un = { + scheme: "wss", + domainHost: rr.domainHost, + parse: rr.parse, + serialize: rr.serialize + }, ss = {}, dn = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", ot = "[0-9A-Fa-f]", is = s(s("%[EFef]" + ot + "%" + ot + ot + "%" + ot + ot) + "|" + s("%[89A-Fa-f]" + ot + "%" + ot + ot) + "|" + s("%" + ot + ot)), ls = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cs = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", us = a(cs, '[\\"\\\\]'), ds = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", hs = new RegExp(dn, "g"), Mt = new RegExp(is, "g"), ps = new RegExp(a("[^]", ls, "[\\.]", '[\\"]', us), "g"), hn = new RegExp(a("[^]", dn, ds), "g"), fs = hn; + function ta(p) { + var k = te(p); + return k.match(hs) ? k : p; + } + var pn = { + scheme: "mailto", + parse: function(p, k) { + var T = p, M = T.to = T.path ? T.path.split(",") : []; + if (T.path = void 0, T.query) { + for (var D = !1, Q = {}, J = T.query.split("&"), ue = 0, ke = J.length; ue < ke; ++ue) { + var pe = J[ue].split("="); + switch (pe[0]) { + case "to": + for (var le = pe[1].split(","), ye = 0, we = le.length; ye < we; ++ye) + M.push(le[ye]); + break; + case "subject": + T.subject = Fe(pe[1], k); + break; + case "body": + T.body = Fe(pe[1], k); + break; + default: + D = !0, Q[Fe(pe[0], k)] = Fe(pe[1], k); + break; + } + } + D && (T.headers = Q); + } + T.query = void 0; + for (var ee = 0, Ee = M.length; ee < Ee; ++ee) { + var fe = M[ee].split("@"); + if (fe[0] = Fe(fe[0]), k.unicodeSupport) + fe[1] = Fe(fe[1], k).toLowerCase(); + else + try { + fe[1] = I.toASCII(Fe(fe[1], k).toLowerCase()); + } catch (qe) { + T.error = T.error || "Email address's domain name can not be converted to ASCII via punycode: " + qe; + } + M[ee] = fe.join("@"); + } + return T; + }, + serialize: function(p, k) { + var T = p, M = b(p.to); + if (M) { + for (var D = 0, Q = M.length; D < Q; ++D) { + var J = String(M[D]), ue = J.lastIndexOf("@"), ke = J.slice(0, ue).replace(Mt, ta).replace(Mt, d).replace(ps, K), pe = J.slice(ue + 1); + try { + pe = k.iri ? I.toUnicode(pe) : I.toASCII(Fe(pe, k).toLowerCase()); + } catch (ee) { + T.error = T.error || "Email address's domain name can not be converted to " + (k.iri ? "Unicode" : "ASCII") + " via punycode: " + ee; + } + M[D] = ke + "@" + pe; + } + T.path = M.join(","); + } + var le = p.headers = p.headers || {}; + p.subject && (le.subject = p.subject), p.body && (le.body = p.body); + var ye = []; + for (var we in le) + le[we] !== ss[we] && ye.push(we.replace(Mt, ta).replace(Mt, d).replace(hn, K) + "=" + le[we].replace(Mt, ta).replace(Mt, d).replace(fs, K)); + return ye.length && (T.query = ye.join("&")), T; + } + }, ms = /^([^\:]+)\:(.*)/, fn = { + scheme: "urn", + parse: function(p, k) { + var T = p.path && p.path.match(ms), M = p; + if (T) { + var D = k.scheme || M.scheme || "urn", Q = T[1].toLowerCase(), J = T[2], ue = D + ":" + (k.nid || Q), ke = H[ue]; + M.nid = Q, M.nss = J, M.path = void 0, ke && (M = ke.parse(M, k)); + } else + M.error = M.error || "URN can not be parsed."; + return M; + }, + serialize: function(p, k) { + var T = k.scheme || p.scheme || "urn", M = p.nid, D = T + ":" + (k.nid || M), Q = H[D]; + Q && (p = Q.serialize(p, k)); + var J = p, ue = p.nss; + return J.path = (M || k.nid) + ":" + ue, J; + } + }, gs = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, mn = { + scheme: "urn:uuid", + parse: function(p, k) { + var T = p; + return T.uuid = T.nss, T.nss = void 0, !k.tolerant && (!T.uuid || !T.uuid.match(gs)) && (T.error = T.error || "UUID is not valid."), T; + }, + serialize: function(p, k) { + var T = p; + return T.nss = (p.uuid || "").toLowerCase(), T; + } + }; + H[vt.scheme] = vt, H[ln.scheme] = ln, H[rr.scheme] = rr, H[un.scheme] = un, H[pn.scheme] = pn, H[fn.scheme] = fn, H[mn.scheme] = mn, r.SCHEMES = H, r.pctEncChar = K, r.pctDecChars = te, r.parse = ze, r.removeDotSegments = nt, r.serialize = Re, r.resolveComponents = It, r.resolve = er, r.normalize = wt, r.equal = tr, r.escapeComponent = kr, r.unescapeComponent = Fe, Object.defineProperty(r, "__esModule", { value: !0 }); + }); +})(da, da.exports); +var ol = da.exports; +Object.defineProperty(Ea, "__esModule", { value: !0 }); +const jo = ol; +jo.code = 'require("ajv/dist/runtime/uri").default'; +Ea.default = jo; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.CodeGen = e.Name = e.nil = e.stringify = e.str = e._ = e.KeywordCxt = void 0; + var t = at; + Object.defineProperty(e, "KeywordCxt", { enumerable: !0, get: function() { + return t.KeywordCxt; + } }); + var r = ie; + Object.defineProperty(e, "_", { enumerable: !0, get: function() { + return r._; + } }), Object.defineProperty(e, "str", { enumerable: !0, get: function() { + return r.str; + } }), Object.defineProperty(e, "stringify", { enumerable: !0, get: function() { + return r.stringify; + } }), Object.defineProperty(e, "nil", { enumerable: !0, get: function() { + return r.nil; + } }), Object.defineProperty(e, "Name", { enumerable: !0, get: function() { + return r.Name; + } }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() { + return r.CodeGen; + } }); + const a = _r, s = wr, l = Nt, d = Be, b = ie, _ = xe, y = yr, f = ce, E = nl, N = Ea, A = (V, S) => new RegExp(V, S); + A.code = "new RegExp"; + const j = ["removeAdditional", "useDefaults", "coerceTypes"], P = /* @__PURE__ */ new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error" + ]), x = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now." + }, v = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.' + }, C = 200; + function R(V) { + var S, F, L, h, $, I, H, K, te, ne, be, Ae, ut, Zt, Jt, ze, Qt, Lt, At, Rt, Xt, nt, Re, It, er; + const wt = V.strict, tr = (S = V.code) === null || S === void 0 ? void 0 : S.optimize, kr = tr === !0 || tr === void 0 ? 1 : tr || 0, Fe = (L = (F = V.code) === null || F === void 0 ? void 0 : F.regExp) !== null && L !== void 0 ? L : A, vt = (h = V.uriResolver) !== null && h !== void 0 ? h : N.default; + return { + strictSchema: (I = ($ = V.strictSchema) !== null && $ !== void 0 ? $ : wt) !== null && I !== void 0 ? I : !0, + strictNumbers: (K = (H = V.strictNumbers) !== null && H !== void 0 ? H : wt) !== null && K !== void 0 ? K : !0, + strictTypes: (ne = (te = V.strictTypes) !== null && te !== void 0 ? te : wt) !== null && ne !== void 0 ? ne : "log", + strictTuples: (Ae = (be = V.strictTuples) !== null && be !== void 0 ? be : wt) !== null && Ae !== void 0 ? Ae : "log", + strictRequired: (Zt = (ut = V.strictRequired) !== null && ut !== void 0 ? ut : wt) !== null && Zt !== void 0 ? Zt : !1, + code: V.code ? { ...V.code, optimize: kr, regExp: Fe } : { optimize: kr, regExp: Fe }, + loopRequired: (Jt = V.loopRequired) !== null && Jt !== void 0 ? Jt : C, + loopEnum: (ze = V.loopEnum) !== null && ze !== void 0 ? ze : C, + meta: (Qt = V.meta) !== null && Qt !== void 0 ? Qt : !0, + messages: (Lt = V.messages) !== null && Lt !== void 0 ? Lt : !0, + inlineRefs: (At = V.inlineRefs) !== null && At !== void 0 ? At : !0, + schemaId: (Rt = V.schemaId) !== null && Rt !== void 0 ? Rt : "$id", + addUsedSchema: (Xt = V.addUsedSchema) !== null && Xt !== void 0 ? Xt : !0, + validateSchema: (nt = V.validateSchema) !== null && nt !== void 0 ? nt : !0, + validateFormats: (Re = V.validateFormats) !== null && Re !== void 0 ? Re : !0, + unicodeRegExp: (It = V.unicodeRegExp) !== null && It !== void 0 ? It : !0, + int32range: (er = V.int32range) !== null && er !== void 0 ? er : !0, + uriResolver: vt + }; + } + class n { + constructor(S = {}) { + this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), S = this.opts = { ...S, ...R(S) }; + const { es5: F, lines: L } = this.opts.code; + this.scope = new b.ValueScope({ scope: {}, prefixes: P, es5: F, lines: L }), this.logger = z(S.logger); + const h = S.validateFormats; + S.validateFormats = !1, this.RULES = (0, l.getRules)(), i.call(this, x, S, "NOT SUPPORTED"), i.call(this, v, S, "DEPRECATED", "warn"), this._metaOpts = g.call(this), S.formats && u.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), S.keywords && m.call(this, S.keywords), typeof S.meta == "object" && this.addMetaSchema(S.meta), c.call(this), S.validateFormats = h; + } + _addVocabularies() { + this.addKeyword("$async"); + } + _addDefaultMetaSchema() { + const { $data: S, meta: F, schemaId: L } = this.opts; + let h = E; + L === "id" && (h = { ...E }, h.id = h.$id, delete h.$id), F && S && this.addMetaSchema(h, h[L], !1); + } + defaultMeta() { + const { meta: S, schemaId: F } = this.opts; + return this.opts.defaultMeta = typeof S == "object" ? S[F] || S : void 0; + } + validate(S, F) { + let L; + if (typeof S == "string") { + if (L = this.getSchema(S), !L) + throw new Error(`no schema with key or ref "${S}"`); + } else + L = this.compile(S); + const h = L(F); + return "$async" in L || (this.errors = L.errors), h; + } + compile(S, F) { + const L = this._addSchema(S, F); + return L.validate || this._compileSchemaEnv(L); + } + compileAsync(S, F) { + if (typeof this.opts.loadSchema != "function") + throw new Error("options.loadSchema should be a function"); + const { loadSchema: L } = this.opts; + return h.call(this, S, F); + async function h(ne, be) { + await $.call(this, ne.$schema); + const Ae = this._addSchema(ne, be); + return Ae.validate || I.call(this, Ae); + } + async function $(ne) { + ne && !this.getSchema(ne) && await h.call(this, { $ref: ne }, !0); + } + async function I(ne) { + try { + return this._compileSchemaEnv(ne); + } catch (be) { + if (!(be instanceof s.default)) + throw be; + return H.call(this, be), await K.call(this, be.missingSchema), I.call(this, ne); + } + } + function H({ missingSchema: ne, missingRef: be }) { + if (this.refs[ne]) + throw new Error(`AnySchema ${ne} is loaded but ${be} cannot be resolved`); + } + async function K(ne) { + const be = await te.call(this, ne); + this.refs[ne] || await $.call(this, be.$schema), this.refs[ne] || this.addSchema(be, ne, F); + } + async function te(ne) { + const be = this._loading[ne]; + if (be) + return be; + try { + return await (this._loading[ne] = L(ne)); + } finally { + delete this._loading[ne]; + } + } + } + // Adds schema to the instance + addSchema(S, F, L, h = this.opts.validateSchema) { + if (Array.isArray(S)) { + for (const I of S) + this.addSchema(I, void 0, L, h); + return this; + } + let $; + if (typeof S == "object") { + const { schemaId: I } = this.opts; + if ($ = S[I], $ !== void 0 && typeof $ != "string") + throw new Error(`schema ${I} must be string`); + } + return F = (0, _.normalizeId)(F || $), this._checkUnique(F), this.schemas[F] = this._addSchema(S, L, F, h, !0), this; + } + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema(S, F, L = this.opts.validateSchema) { + return this.addSchema(S, F, !0, L), this; + } + // Validate schema against its meta-schema + validateSchema(S, F) { + if (typeof S == "boolean") + return !0; + let L; + if (L = S.$schema, L !== void 0 && typeof L != "string") + throw new Error("$schema must be a string"); + if (L = L || this.opts.defaultMeta || this.defaultMeta(), !L) + return this.logger.warn("meta-schema not available"), this.errors = null, !0; + const h = this.validate(L, S); + if (!h && F) { + const $ = "schema is invalid: " + this.errorsText(); + if (this.opts.validateSchema === "log") + this.logger.error($); + else + throw new Error($); + } + return h; + } + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(S) { + let F; + for (; typeof (F = o.call(this, S)) == "string"; ) + S = F; + if (F === void 0) { + const { schemaId: L } = this.opts, h = new d.SchemaEnv({ schema: {}, schemaId: L }); + if (F = d.resolveSchema.call(this, h, S), !F) + return; + this.refs[S] = F; + } + return F.validate || this._compileSchemaEnv(F); + } + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(S) { + if (S instanceof RegExp) + return this._removeAllSchemas(this.schemas, S), this._removeAllSchemas(this.refs, S), this; + switch (typeof S) { + case "undefined": + return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this; + case "string": { + const F = o.call(this, S); + return typeof F == "object" && this._cache.delete(F.schema), delete this.schemas[S], delete this.refs[S], this; + } + case "object": { + const F = S; + this._cache.delete(F); + let L = S[this.opts.schemaId]; + return L && (L = (0, _.normalizeId)(L), delete this.schemas[L], delete this.refs[L]), this; + } + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } + // add "vocabulary" - a collection of keywords + addVocabulary(S) { + for (const F of S) + this.addKeyword(F); + return this; + } + addKeyword(S, F) { + let L; + if (typeof S == "string") + L = S, typeof F == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), F.keyword = L); + else if (typeof S == "object" && F === void 0) { + if (F = S, L = F.keyword, Array.isArray(L) && !L.length) + throw new Error("addKeywords: keyword must be string or non-empty array"); + } else + throw new Error("invalid addKeywords parameters"); + if (B.call(this, L, F), !F) + return (0, f.eachItem)(L, ($) => G.call(this, $)), this; + U.call(this, F); + const h = { + ...F, + type: (0, y.getJSONTypes)(F.type), + schemaType: (0, y.getJSONTypes)(F.schemaType) + }; + return (0, f.eachItem)(L, h.type.length === 0 ? ($) => G.call(this, $, h) : ($) => h.type.forEach((I) => G.call(this, $, h, I))), this; + } + getKeyword(S) { + const F = this.RULES.all[S]; + return typeof F == "object" ? F.definition : !!F; + } + // Remove keyword + removeKeyword(S) { + const { RULES: F } = this; + delete F.keywords[S], delete F.all[S]; + for (const L of F.rules) { + const h = L.rules.findIndex(($) => $.keyword === S); + h >= 0 && L.rules.splice(h, 1); + } + return this; + } + // Add format + addFormat(S, F) { + return typeof F == "string" && (F = new RegExp(F)), this.formats[S] = F, this; + } + errorsText(S = this.errors, { separator: F = ", ", dataVar: L = "data" } = {}) { + return !S || S.length === 0 ? "No errors" : S.map((h) => `${L}${h.instancePath} ${h.message}`).reduce((h, $) => h + F + $); + } + $dataMetaSchema(S, F) { + const L = this.RULES.all; + S = JSON.parse(JSON.stringify(S)); + for (const h of F) { + const $ = h.split("/").slice(1); + let I = S; + for (const H of $) + I = I[H]; + for (const H in L) { + const K = L[H]; + if (typeof K != "object") + continue; + const { $data: te } = K.definition, ne = I[H]; + te && ne && (I[H] = Y(ne)); + } + } + return S; + } + _removeAllSchemas(S, F) { + for (const L in S) { + const h = S[L]; + (!F || F.test(L)) && (typeof h == "string" ? delete S[L] : h && !h.meta && (this._cache.delete(h.schema), delete S[L])); + } + } + _addSchema(S, F, L, h = this.opts.validateSchema, $ = this.opts.addUsedSchema) { + let I; + const { schemaId: H } = this.opts; + if (typeof S == "object") + I = S[H]; + else { + if (this.opts.jtd) + throw new Error("schema must be object"); + if (typeof S != "boolean") + throw new Error("schema must be object or boolean"); + } + let K = this._cache.get(S); + if (K !== void 0) + return K; + L = (0, _.normalizeId)(I || L); + const te = _.getSchemaRefs.call(this, S, L); + return K = new d.SchemaEnv({ schema: S, schemaId: H, meta: F, baseId: L, localRefs: te }), this._cache.set(K.schema, K), $ && !L.startsWith("#") && (L && this._checkUnique(L), this.refs[L] = K), h && this.validateSchema(S, !0), K; + } + _checkUnique(S) { + if (this.schemas[S] || this.refs[S]) + throw new Error(`schema with key or id "${S}" already exists`); + } + _compileSchemaEnv(S) { + if (S.meta ? this._compileMetaSchema(S) : d.compileSchema.call(this, S), !S.validate) + throw new Error("ajv implementation error"); + return S.validate; + } + _compileMetaSchema(S) { + const F = this.opts; + this.opts = this._metaOpts; + try { + d.compileSchema.call(this, S); + } finally { + this.opts = F; + } + } + } + e.default = n, n.ValidationError = a.default, n.MissingRefError = s.default; + function i(V, S, F, L = "error") { + for (const h in V) { + const $ = h; + $ in S && this.logger[L](`${F}: option ${h}. ${V[$]}`); + } + } + function o(V) { + return V = (0, _.normalizeId)(V), this.schemas[V] || this.refs[V]; + } + function c() { + const V = this.opts.schemas; + if (V) + if (Array.isArray(V)) + this.addSchema(V); + else + for (const S in V) + this.addSchema(V[S], S); + } + function u() { + for (const V in this.opts.formats) { + const S = this.opts.formats[V]; + S && this.addFormat(V, S); + } + } + function m(V) { + if (Array.isArray(V)) { + this.addVocabulary(V); + return; + } + this.logger.warn("keywords option as map is deprecated, pass array"); + for (const S in V) { + const F = V[S]; + F.keyword || (F.keyword = S), this.addKeyword(F); + } + } + function g() { + const V = { ...this.opts }; + for (const S of j) + delete V[S]; + return V; + } + const O = { log() { + }, warn() { + }, error() { + } }; + function z(V) { + if (V === !1) + return O; + if (V === void 0) + return console; + if (V.log && V.warn && V.error) + return V; + throw new Error("logger must implement log, warn and error methods"); + } + const q = /^[a-z_$][a-z0-9_$:-]*$/i; + function B(V, S) { + const { RULES: F } = this; + if ((0, f.eachItem)(V, (L) => { + if (F.keywords[L]) + throw new Error(`Keyword ${L} is already defined`); + if (!q.test(L)) + throw new Error(`Keyword ${L} has invalid name`); + }), !!S && S.$data && !("code" in S || "validate" in S)) + throw new Error('$data keyword must have "code" or "validate" function'); + } + function G(V, S, F) { + var L; + const h = S == null ? void 0 : S.post; + if (F && h) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES: $ } = this; + let I = h ? $.post : $.rules.find(({ type: K }) => K === F); + if (I || (I = { type: F, rules: [] }, $.rules.push(I)), $.keywords[V] = !0, !S) + return; + const H = { + keyword: V, + definition: { + ...S, + type: (0, y.getJSONTypes)(S.type), + schemaType: (0, y.getJSONTypes)(S.schemaType) + } + }; + S.before ? w.call(this, I, H, S.before) : I.rules.push(H), $.all[V] = H, (L = S.implements) === null || L === void 0 || L.forEach((K) => this.addKeyword(K)); + } + function w(V, S, F) { + const L = V.rules.findIndex((h) => h.keyword === F); + L >= 0 ? V.rules.splice(L, 0, S) : (V.rules.push(S), this.logger.warn(`rule ${F} is not defined`)); + } + function U(V) { + let { metaSchema: S } = V; + S !== void 0 && (V.$data && this.opts.$data && (S = Y(S)), V.validateSchema = this.compile(S, !0)); + } + const W = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" + }; + function Y(V) { + return { anyOf: [V, W] }; + } +})(so); +var $a = {}, Pa = {}, Sa = {}; +Object.defineProperty(Sa, "__esModule", { value: !0 }); +const sl = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + } +}; +Sa.default = sl; +var jt = {}; +Object.defineProperty(jt, "__esModule", { value: !0 }); +jt.callRef = jt.getValidate = void 0; +const il = wr, Tn = se, De = ie, zt = ct, Cn = Be, Tr = ce, ll = { + keyword: "$ref", + schemaType: "string", + code(e) { + const { gen: t, schema: r, it: a } = e, { baseId: s, schemaEnv: l, validateName: d, opts: b, self: _ } = a, { root: y } = l; + if ((r === "#" || r === "#/") && s === y.baseId) + return E(); + const f = Cn.resolveRef.call(_, y, s, r); + if (f === void 0) + throw new il.default(a.opts.uriResolver, s, r); + if (f instanceof Cn.SchemaEnv) + return N(f); + return A(f); + function E() { + if (l === y) + return Rr(e, d, l, l.$async); + const j = t.scopeValue("root", { ref: y }); + return Rr(e, (0, De._)`${j}.validate`, y, y.$async); + } + function N(j) { + const P = Lo(e, j); + Rr(e, P, j, j.$async); + } + function A(j) { + const P = t.scopeValue("schema", b.code.source === !0 ? { ref: j, code: (0, De.stringify)(j) } : { ref: j }), x = t.name("valid"), v = e.subschema({ + schema: j, + dataTypes: [], + schemaPath: De.nil, + topSchemaRef: P, + errSchemaPath: r + }, x); + e.mergeEvaluated(v), e.ok(x); + } + } +}; +function Lo(e, t) { + const { gen: r } = e; + return t.validate ? r.scopeValue("validate", { ref: t.validate }) : (0, De._)`${r.scopeValue("wrapper", { ref: t })}.validate`; +} +jt.getValidate = Lo; +function Rr(e, t, r, a) { + const { gen: s, it: l } = e, { allErrors: d, schemaEnv: b, opts: _ } = l, y = _.passContext ? zt.default.this : De.nil; + a ? f() : E(); + function f() { + if (!b.$async) + throw new Error("async schema referenced by sync schema"); + const j = s.let("valid"); + s.try(() => { + s.code((0, De._)`await ${(0, Tn.callValidateCode)(e, t, y)}`), A(t), d || s.assign(j, !0); + }, (P) => { + s.if((0, De._)`!(${P} instanceof ${l.ValidationError})`, () => s.throw(P)), N(P), d || s.assign(j, !1); + }), e.ok(j); + } + function E() { + e.result((0, Tn.callValidateCode)(e, t, y), () => A(t), () => N(t)); + } + function N(j) { + const P = (0, De._)`${j}.errors`; + s.assign(zt.default.vErrors, (0, De._)`${zt.default.vErrors} === null ? ${P} : ${zt.default.vErrors}.concat(${P})`), s.assign(zt.default.errors, (0, De._)`${zt.default.vErrors}.length`); + } + function A(j) { + var P; + if (!l.opts.unevaluated) + return; + const x = (P = r == null ? void 0 : r.validate) === null || P === void 0 ? void 0 : P.evaluated; + if (l.props !== !0) + if (x && !x.dynamicProps) + x.props !== void 0 && (l.props = Tr.mergeEvaluated.props(s, x.props, l.props)); + else { + const v = s.var("props", (0, De._)`${j}.evaluated.props`); + l.props = Tr.mergeEvaluated.props(s, v, l.props, De.Name); + } + if (l.items !== !0) + if (x && !x.dynamicItems) + x.items !== void 0 && (l.items = Tr.mergeEvaluated.items(s, x.items, l.items)); + else { + const v = s.var("items", (0, De._)`${j}.evaluated.items`); + l.items = Tr.mergeEvaluated.items(s, v, l.items, De.Name); + } + } +} +jt.callRef = Rr; +jt.default = ll; +Object.defineProperty(Pa, "__esModule", { value: !0 }); +const cl = Sa, ul = jt, dl = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + { keyword: "$comment" }, + "definitions", + cl.default, + ul.default +]; +Pa.default = dl; +var Ta = {}, Ca = {}; +Object.defineProperty(Ca, "__esModule", { value: !0 }); +const Vr = ie, gt = Vr.operators, Fr = { + maximum: { okStr: "<=", ok: gt.LTE, fail: gt.GT }, + minimum: { okStr: ">=", ok: gt.GTE, fail: gt.LT }, + exclusiveMaximum: { okStr: "<", ok: gt.LT, fail: gt.GTE }, + exclusiveMinimum: { okStr: ">", ok: gt.GT, fail: gt.LTE } +}, hl = { + message: ({ keyword: e, schemaCode: t }) => (0, Vr.str)`must be ${Fr[e].okStr} ${t}`, + params: ({ keyword: e, schemaCode: t }) => (0, Vr._)`{comparison: ${Fr[e].okStr}, limit: ${t}}` +}, pl = { + keyword: Object.keys(Fr), + type: "number", + schemaType: "number", + $data: !0, + error: hl, + code(e) { + const { keyword: t, data: r, schemaCode: a } = e; + e.fail$data((0, Vr._)`${r} ${Fr[t].fail} ${a} || isNaN(${r})`); + } +}; +Ca.default = pl; +var xa = {}; +Object.defineProperty(xa, "__esModule", { value: !0 }); +const ur = ie, fl = { + message: ({ schemaCode: e }) => (0, ur.str)`must be multiple of ${e}`, + params: ({ schemaCode: e }) => (0, ur._)`{multipleOf: ${e}}` +}, ml = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: !0, + error: fl, + code(e) { + const { gen: t, data: r, schemaCode: a, it: s } = e, l = s.opts.multipleOfPrecision, d = t.let("res"), b = l ? (0, ur._)`Math.abs(Math.round(${d}) - ${d}) > 1e-${l}` : (0, ur._)`${d} !== parseInt(${d})`; + e.fail$data((0, ur._)`(${a} === 0 || (${d} = ${r}/${a}, ${b}))`); + } +}; +xa.default = ml; +var Oa = {}, Na = {}; +Object.defineProperty(Na, "__esModule", { value: !0 }); +function Ao(e) { + const t = e.length; + let r = 0, a = 0, s; + for (; a < t; ) + r++, s = e.charCodeAt(a++), s >= 55296 && s <= 56319 && a < t && (s = e.charCodeAt(a), (s & 64512) === 56320 && a++); + return r; +} +Na.default = Ao; +Ao.code = 'require("ajv/dist/runtime/ucs2length").default'; +Object.defineProperty(Oa, "__esModule", { value: !0 }); +const xt = ie, gl = ce, bl = Na, yl = { + message({ keyword: e, schemaCode: t }) { + const r = e === "maxLength" ? "more" : "fewer"; + return (0, xt.str)`must NOT have ${r} than ${t} characters`; + }, + params: ({ schemaCode: e }) => (0, xt._)`{limit: ${e}}` +}, _l = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: !0, + error: yl, + code(e) { + const { keyword: t, data: r, schemaCode: a, it: s } = e, l = t === "maxLength" ? xt.operators.GT : xt.operators.LT, d = s.opts.unicode === !1 ? (0, xt._)`${r}.length` : (0, xt._)`${(0, gl.useFunc)(e.gen, bl.default)}(${r})`; + e.fail$data((0, xt._)`${d} ${l} ${a}`); + } +}; +Oa.default = _l; +var ja = {}; +Object.defineProperty(ja, "__esModule", { value: !0 }); +const wl = se, qr = ie, vl = { + message: ({ schemaCode: e }) => (0, qr.str)`must match pattern "${e}"`, + params: ({ schemaCode: e }) => (0, qr._)`{pattern: ${e}}` +}, kl = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: !0, + error: vl, + code(e) { + const { data: t, $data: r, schema: a, schemaCode: s, it: l } = e, d = l.opts.unicodeRegExp ? "u" : "", b = r ? (0, qr._)`(new RegExp(${s}, ${d}))` : (0, wl.usePattern)(e, a); + e.fail$data((0, qr._)`!${b}.test(${t})`); + } +}; +ja.default = kl; +var La = {}; +Object.defineProperty(La, "__esModule", { value: !0 }); +const dr = ie, El = { + message({ keyword: e, schemaCode: t }) { + const r = e === "maxProperties" ? "more" : "fewer"; + return (0, dr.str)`must NOT have ${r} than ${t} properties`; + }, + params: ({ schemaCode: e }) => (0, dr._)`{limit: ${e}}` +}, $l = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: !0, + error: El, + code(e) { + const { keyword: t, data: r, schemaCode: a } = e, s = t === "maxProperties" ? dr.operators.GT : dr.operators.LT; + e.fail$data((0, dr._)`Object.keys(${r}).length ${s} ${a}`); + } +}; +La.default = $l; +var Aa = {}; +Object.defineProperty(Aa, "__esModule", { value: !0 }); +const or = se, hr = ie, Pl = ce, Sl = { + message: ({ params: { missingProperty: e } }) => (0, hr.str)`must have required property '${e}'`, + params: ({ params: { missingProperty: e } }) => (0, hr._)`{missingProperty: ${e}}` +}, Tl = { + keyword: "required", + type: "object", + schemaType: "array", + $data: !0, + error: Sl, + code(e) { + const { gen: t, schema: r, schemaCode: a, data: s, $data: l, it: d } = e, { opts: b } = d; + if (!l && r.length === 0) + return; + const _ = r.length >= b.loopRequired; + if (d.allErrors ? y() : f(), b.strictRequired) { + const A = e.parentSchema.properties, { definedProperties: j } = e.it; + for (const P of r) + if ((A == null ? void 0 : A[P]) === void 0 && !j.has(P)) { + const x = d.schemaEnv.baseId + d.errSchemaPath, v = `required property "${P}" is not defined at "${x}" (strictRequired)`; + (0, Pl.checkStrictMode)(d, v, d.opts.strictRequired); + } + } + function y() { + if (_ || l) + e.block$data(hr.nil, E); + else + for (const A of r) + (0, or.checkReportMissingProp)(e, A); + } + function f() { + const A = t.let("missing"); + if (_ || l) { + const j = t.let("valid", !0); + e.block$data(j, () => N(A, j)), e.ok(j); + } else + t.if((0, or.checkMissingProp)(e, r, A)), (0, or.reportMissingProp)(e, A), t.else(); + } + function E() { + t.forOf("prop", a, (A) => { + e.setParams({ missingProperty: A }), t.if((0, or.noPropertyInData)(t, s, A, b.ownProperties), () => e.error()); + }); + } + function N(A, j) { + e.setParams({ missingProperty: A }), t.forOf(A, a, () => { + t.assign(j, (0, or.propertyInData)(t, s, A, b.ownProperties)), t.if((0, hr.not)(j), () => { + e.error(), t.break(); + }); + }, hr.nil); + } + } +}; +Aa.default = Tl; +var Ra = {}; +Object.defineProperty(Ra, "__esModule", { value: !0 }); +const pr = ie, Cl = { + message({ keyword: e, schemaCode: t }) { + const r = e === "maxItems" ? "more" : "fewer"; + return (0, pr.str)`must NOT have ${r} than ${t} items`; + }, + params: ({ schemaCode: e }) => (0, pr._)`{limit: ${e}}` +}, xl = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: !0, + error: Cl, + code(e) { + const { keyword: t, data: r, schemaCode: a } = e, s = t === "maxItems" ? pr.operators.GT : pr.operators.LT; + e.fail$data((0, pr._)`${r}.length ${s} ${a}`); + } +}; +Ra.default = xl; +var Ia = {}, vr = {}; +Object.defineProperty(vr, "__esModule", { value: !0 }); +const Ro = mo; +Ro.code = 'require("ajv/dist/runtime/equal").default'; +vr.default = Ro; +Object.defineProperty(Ia, "__esModule", { value: !0 }); +const oa = yr, Ce = ie, Ol = ce, Nl = vr, jl = { + message: ({ params: { i: e, j: t } }) => (0, Ce.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`, + params: ({ params: { i: e, j: t } }) => (0, Ce._)`{i: ${e}, j: ${t}}` +}, Ll = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: !0, + error: jl, + code(e) { + const { gen: t, data: r, $data: a, schema: s, parentSchema: l, schemaCode: d, it: b } = e; + if (!a && !s) + return; + const _ = t.let("valid"), y = l.items ? (0, oa.getSchemaTypes)(l.items) : []; + e.block$data(_, f, (0, Ce._)`${d} === false`), e.ok(_); + function f() { + const j = t.let("i", (0, Ce._)`${r}.length`), P = t.let("j"); + e.setParams({ i: j, j: P }), t.assign(_, !0), t.if((0, Ce._)`${j} > 1`, () => (E() ? N : A)(j, P)); + } + function E() { + return y.length > 0 && !y.some((j) => j === "object" || j === "array"); + } + function N(j, P) { + const x = t.name("item"), v = (0, oa.checkDataTypes)(y, x, b.opts.strictNumbers, oa.DataType.Wrong), C = t.const("indices", (0, Ce._)`{}`); + t.for((0, Ce._)`;${j}--;`, () => { + t.let(x, (0, Ce._)`${r}[${j}]`), t.if(v, (0, Ce._)`continue`), y.length > 1 && t.if((0, Ce._)`typeof ${x} == "string"`, (0, Ce._)`${x} += "_"`), t.if((0, Ce._)`typeof ${C}[${x}] == "number"`, () => { + t.assign(P, (0, Ce._)`${C}[${x}]`), e.error(), t.assign(_, !1).break(); + }).code((0, Ce._)`${C}[${x}] = ${j}`); + }); + } + function A(j, P) { + const x = (0, Ol.useFunc)(t, Nl.default), v = t.name("outer"); + t.label(v).for((0, Ce._)`;${j}--;`, () => t.for((0, Ce._)`${P} = ${j}; ${P}--;`, () => t.if((0, Ce._)`${x}(${r}[${j}], ${r}[${P}])`, () => { + e.error(), t.assign(_, !1).break(v); + }))); + } + } +}; +Ia.default = Ll; +var Ma = {}; +Object.defineProperty(Ma, "__esModule", { value: !0 }); +const ha = ie, Al = ce, Rl = vr, Il = { + message: "must be equal to constant", + params: ({ schemaCode: e }) => (0, ha._)`{allowedValue: ${e}}` +}, Ml = { + keyword: "const", + $data: !0, + error: Il, + code(e) { + const { gen: t, data: r, $data: a, schemaCode: s, schema: l } = e; + a || l && typeof l == "object" ? e.fail$data((0, ha._)`!${(0, Al.useFunc)(t, Rl.default)}(${r}, ${s})`) : e.fail((0, ha._)`${l} !== ${r}`); + } +}; +Ma.default = Ml; +var Da = {}; +Object.defineProperty(Da, "__esModule", { value: !0 }); +const lr = ie, Dl = ce, Bl = vr, zl = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode: e }) => (0, lr._)`{allowedValues: ${e}}` +}, Vl = { + keyword: "enum", + schemaType: "array", + $data: !0, + error: zl, + code(e) { + const { gen: t, data: r, $data: a, schema: s, schemaCode: l, it: d } = e; + if (!a && s.length === 0) + throw new Error("enum must have non-empty array"); + const b = s.length >= d.opts.loopEnum; + let _; + const y = () => _ ?? (_ = (0, Dl.useFunc)(t, Bl.default)); + let f; + if (b || a) + f = t.let("valid"), e.block$data(f, E); + else { + if (!Array.isArray(s)) + throw new Error("ajv implementation error"); + const A = t.const("vSchema", l); + f = (0, lr.or)(...s.map((j, P) => N(A, P))); + } + e.pass(f); + function E() { + t.assign(f, !1), t.forOf("v", l, (A) => t.if((0, lr._)`${y()}(${r}, ${A})`, () => t.assign(f, !0).break())); + } + function N(A, j) { + const P = s[j]; + return typeof P == "object" && P !== null ? (0, lr._)`${y()}(${r}, ${A}[${j}])` : (0, lr._)`${r} === ${P}`; + } + } +}; +Da.default = Vl; +Object.defineProperty(Ta, "__esModule", { value: !0 }); +const Fl = Ca, ql = xa, Ul = Oa, Gl = ja, Hl = La, Kl = Aa, Wl = Ra, Yl = Ia, Zl = Ma, Jl = Da, Ql = [ + // number + Fl.default, + ql.default, + // string + Ul.default, + Gl.default, + // object + Hl.default, + Kl.default, + // array + Wl.default, + Yl.default, + // any + { keyword: "type", schemaType: ["string", "array"] }, + { keyword: "nullable", schemaType: "boolean" }, + Zl.default, + Jl.default +]; +Ta.default = Ql; +var Ba = {}, Wt = {}; +Object.defineProperty(Wt, "__esModule", { value: !0 }); +Wt.validateAdditionalItems = void 0; +const Ot = ie, pa = ce, Xl = { + message: ({ params: { len: e } }) => (0, Ot.str)`must NOT have more than ${e} items`, + params: ({ params: { len: e } }) => (0, Ot._)`{limit: ${e}}` +}, ec = { + keyword: "additionalItems", + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error: Xl, + code(e) { + const { parentSchema: t, it: r } = e, { items: a } = t; + if (!Array.isArray(a)) { + (0, pa.checkStrictMode)(r, '"additionalItems" is ignored when "items" is not an array of schemas'); + return; + } + Io(e, a); + } +}; +function Io(e, t) { + const { gen: r, schema: a, data: s, keyword: l, it: d } = e; + d.items = !0; + const b = r.const("len", (0, Ot._)`${s}.length`); + if (a === !1) + e.setParams({ len: t.length }), e.pass((0, Ot._)`${b} <= ${t.length}`); + else if (typeof a == "object" && !(0, pa.alwaysValidSchema)(d, a)) { + const y = r.var("valid", (0, Ot._)`${b} <= ${t.length}`); + r.if((0, Ot.not)(y), () => _(y)), e.ok(y); + } + function _(y) { + r.forRange("i", t.length, b, (f) => { + e.subschema({ keyword: l, dataProp: f, dataPropType: pa.Type.Num }, y), d.allErrors || r.if((0, Ot.not)(y), () => r.break()); + }); + } +} +Wt.validateAdditionalItems = Io; +Wt.default = ec; +var za = {}, Yt = {}; +Object.defineProperty(Yt, "__esModule", { value: !0 }); +Yt.validateTuple = void 0; +const xn = ie, Ir = ce, tc = se, rc = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(e) { + const { schema: t, it: r } = e; + if (Array.isArray(t)) + return Mo(e, "additionalItems", t); + r.items = !0, !(0, Ir.alwaysValidSchema)(r, t) && e.ok((0, tc.validateArray)(e)); + } +}; +function Mo(e, t, r = e.schema) { + const { gen: a, parentSchema: s, data: l, keyword: d, it: b } = e; + f(s), b.opts.unevaluated && r.length && b.items !== !0 && (b.items = Ir.mergeEvaluated.items(a, r.length, b.items)); + const _ = a.name("valid"), y = a.const("len", (0, xn._)`${l}.length`); + r.forEach((E, N) => { + (0, Ir.alwaysValidSchema)(b, E) || (a.if((0, xn._)`${y} > ${N}`, () => e.subschema({ + keyword: d, + schemaProp: N, + dataProp: N + }, _)), e.ok(_)); + }); + function f(E) { + const { opts: N, errSchemaPath: A } = b, j = r.length, P = j === E.minItems && (j === E.maxItems || E[t] === !1); + if (N.strictTuples && !P) { + const x = `"${d}" is ${j}-tuple, but minItems or maxItems/${t} are not specified or different at path "${A}"`; + (0, Ir.checkStrictMode)(b, x, N.strictTuples); + } + } +} +Yt.validateTuple = Mo; +Yt.default = rc; +Object.defineProperty(za, "__esModule", { value: !0 }); +const ac = Yt, nc = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (e) => (0, ac.validateTuple)(e, "items") +}; +za.default = nc; +var Va = {}; +Object.defineProperty(Va, "__esModule", { value: !0 }); +const On = ie, oc = ce, sc = se, ic = Wt, lc = { + message: ({ params: { len: e } }) => (0, On.str)`must NOT have more than ${e} items`, + params: ({ params: { len: e } }) => (0, On._)`{limit: ${e}}` +}, cc = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error: lc, + code(e) { + const { schema: t, parentSchema: r, it: a } = e, { prefixItems: s } = r; + a.items = !0, !(0, oc.alwaysValidSchema)(a, t) && (s ? (0, ic.validateAdditionalItems)(e, s) : e.ok((0, sc.validateArray)(e))); + } +}; +Va.default = cc; +var Fa = {}; +Object.defineProperty(Fa, "__esModule", { value: !0 }); +const Ye = ie, Cr = ce, uc = { + message: ({ params: { min: e, max: t } }) => t === void 0 ? (0, Ye.str)`must contain at least ${e} valid item(s)` : (0, Ye.str)`must contain at least ${e} and no more than ${t} valid item(s)`, + params: ({ params: { min: e, max: t } }) => t === void 0 ? (0, Ye._)`{minContains: ${e}}` : (0, Ye._)`{minContains: ${e}, maxContains: ${t}}` +}, dc = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: !0, + error: uc, + code(e) { + const { gen: t, schema: r, parentSchema: a, data: s, it: l } = e; + let d, b; + const { minContains: _, maxContains: y } = a; + l.opts.next ? (d = _ === void 0 ? 1 : _, b = y) : d = 1; + const f = t.const("len", (0, Ye._)`${s}.length`); + if (e.setParams({ min: d, max: b }), b === void 0 && d === 0) { + (0, Cr.checkStrictMode)(l, '"minContains" == 0 without "maxContains": "contains" keyword ignored'); + return; + } + if (b !== void 0 && d > b) { + (0, Cr.checkStrictMode)(l, '"minContains" > "maxContains" is always invalid'), e.fail(); + return; + } + if ((0, Cr.alwaysValidSchema)(l, r)) { + let P = (0, Ye._)`${f} >= ${d}`; + b !== void 0 && (P = (0, Ye._)`${P} && ${f} <= ${b}`), e.pass(P); + return; + } + l.items = !0; + const E = t.name("valid"); + b === void 0 && d === 1 ? A(E, () => t.if(E, () => t.break())) : d === 0 ? (t.let(E, !0), b !== void 0 && t.if((0, Ye._)`${s}.length > 0`, N)) : (t.let(E, !1), N()), e.result(E, () => e.reset()); + function N() { + const P = t.name("_valid"), x = t.let("count", 0); + A(P, () => t.if(P, () => j(x))); + } + function A(P, x) { + t.forRange("i", 0, f, (v) => { + e.subschema({ + keyword: "contains", + dataProp: v, + dataPropType: Cr.Type.Num, + compositeRule: !0 + }, P), x(); + }); + } + function j(P) { + t.code((0, Ye._)`${P}++`), b === void 0 ? t.if((0, Ye._)`${P} >= ${d}`, () => t.assign(E, !0).break()) : (t.if((0, Ye._)`${P} > ${b}`, () => t.assign(E, !1).break()), d === 1 ? t.assign(E, !0) : t.if((0, Ye._)`${P} >= ${d}`, () => t.assign(E, !0))); + } + } +}; +Fa.default = dc; +var Do = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0; + const t = ie, r = ce, a = se; + e.error = { + message: ({ params: { property: _, depsCount: y, deps: f } }) => { + const E = y === 1 ? "property" : "properties"; + return (0, t.str)`must have ${E} ${f} when property ${_} is present`; + }, + params: ({ params: { property: _, depsCount: y, deps: f, missingProperty: E } }) => (0, t._)`{property: ${_}, + missingProperty: ${E}, + depsCount: ${y}, + deps: ${f}}` + // TODO change to reference + }; + const s = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error: e.error, + code(_) { + const [y, f] = l(_); + d(_, y), b(_, f); + } + }; + function l({ schema: _ }) { + const y = {}, f = {}; + for (const E in _) { + if (E === "__proto__") + continue; + const N = Array.isArray(_[E]) ? y : f; + N[E] = _[E]; + } + return [y, f]; + } + function d(_, y = _.schema) { + const { gen: f, data: E, it: N } = _; + if (Object.keys(y).length === 0) + return; + const A = f.let("missing"); + for (const j in y) { + const P = y[j]; + if (P.length === 0) + continue; + const x = (0, a.propertyInData)(f, E, j, N.opts.ownProperties); + _.setParams({ + property: j, + depsCount: P.length, + deps: P.join(", ") + }), N.allErrors ? f.if(x, () => { + for (const v of P) + (0, a.checkReportMissingProp)(_, v); + }) : (f.if((0, t._)`${x} && (${(0, a.checkMissingProp)(_, P, A)})`), (0, a.reportMissingProp)(_, A), f.else()); + } + } + e.validatePropertyDeps = d; + function b(_, y = _.schema) { + const { gen: f, data: E, keyword: N, it: A } = _, j = f.name("valid"); + for (const P in y) + (0, r.alwaysValidSchema)(A, y[P]) || (f.if( + (0, a.propertyInData)(f, E, P, A.opts.ownProperties), + () => { + const x = _.subschema({ keyword: N, schemaProp: P }, j); + _.mergeValidEvaluated(x, j); + }, + () => f.var(j, !0) + // TODO var + ), _.ok(j)); + } + e.validateSchemaDeps = b, e.default = s; +})(Do); +var qa = {}; +Object.defineProperty(qa, "__esModule", { value: !0 }); +const Bo = ie, hc = ce, pc = { + message: "property name must be valid", + params: ({ params: e }) => (0, Bo._)`{propertyName: ${e.propertyName}}` +}, fc = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error: pc, + code(e) { + const { gen: t, schema: r, data: a, it: s } = e; + if ((0, hc.alwaysValidSchema)(s, r)) + return; + const l = t.name("valid"); + t.forIn("key", a, (d) => { + e.setParams({ propertyName: d }), e.subschema({ + keyword: "propertyNames", + data: d, + dataTypes: ["string"], + propertyName: d, + compositeRule: !0 + }, l), t.if((0, Bo.not)(l), () => { + e.error(!0), s.allErrors || t.break(); + }); + }), e.ok(l); + } +}; +qa.default = fc; +var Xr = {}; +Object.defineProperty(Xr, "__esModule", { value: !0 }); +const xr = se, Xe = ie, mc = ct, Or = ce, gc = { + message: "must NOT have additional properties", + params: ({ params: e }) => (0, Xe._)`{additionalProperty: ${e.additionalProperty}}` +}, bc = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: !0, + trackErrors: !0, + error: gc, + code(e) { + const { gen: t, schema: r, parentSchema: a, data: s, errsCount: l, it: d } = e; + if (!l) + throw new Error("ajv implementation error"); + const { allErrors: b, opts: _ } = d; + if (d.props = !0, _.removeAdditional !== "all" && (0, Or.alwaysValidSchema)(d, r)) + return; + const y = (0, xr.allSchemaProperties)(a.properties), f = (0, xr.allSchemaProperties)(a.patternProperties); + E(), e.ok((0, Xe._)`${l} === ${mc.default.errors}`); + function E() { + t.forIn("key", s, (x) => { + !y.length && !f.length ? j(x) : t.if(N(x), () => j(x)); + }); + } + function N(x) { + let v; + if (y.length > 8) { + const C = (0, Or.schemaRefOrVal)(d, a.properties, "properties"); + v = (0, xr.isOwnProperty)(t, C, x); + } else + y.length ? v = (0, Xe.or)(...y.map((C) => (0, Xe._)`${x} === ${C}`)) : v = Xe.nil; + return f.length && (v = (0, Xe.or)(v, ...f.map((C) => (0, Xe._)`${(0, xr.usePattern)(e, C)}.test(${x})`))), (0, Xe.not)(v); + } + function A(x) { + t.code((0, Xe._)`delete ${s}[${x}]`); + } + function j(x) { + if (_.removeAdditional === "all" || _.removeAdditional && r === !1) { + A(x); + return; + } + if (r === !1) { + e.setParams({ additionalProperty: x }), e.error(), b || t.break(); + return; + } + if (typeof r == "object" && !(0, Or.alwaysValidSchema)(d, r)) { + const v = t.name("valid"); + _.removeAdditional === "failing" ? (P(x, v, !1), t.if((0, Xe.not)(v), () => { + e.reset(), A(x); + })) : (P(x, v), b || t.if((0, Xe.not)(v), () => t.break())); + } + } + function P(x, v, C) { + const R = { + keyword: "additionalProperties", + dataProp: x, + dataPropType: Or.Type.Str + }; + C === !1 && Object.assign(R, { + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }), e.subschema(R, v); + } + } +}; +Xr.default = bc; +var Ua = {}; +Object.defineProperty(Ua, "__esModule", { value: !0 }); +const yc = at, Nn = se, sa = ce, jn = Xr, _c = { + keyword: "properties", + type: "object", + schemaType: "object", + code(e) { + const { gen: t, schema: r, parentSchema: a, data: s, it: l } = e; + l.opts.removeAdditional === "all" && a.additionalProperties === void 0 && jn.default.code(new yc.KeywordCxt(l, jn.default, "additionalProperties")); + const d = (0, Nn.allSchemaProperties)(r); + for (const E of d) + l.definedProperties.add(E); + l.opts.unevaluated && d.length && l.props !== !0 && (l.props = sa.mergeEvaluated.props(t, (0, sa.toHash)(d), l.props)); + const b = d.filter((E) => !(0, sa.alwaysValidSchema)(l, r[E])); + if (b.length === 0) + return; + const _ = t.name("valid"); + for (const E of b) + y(E) ? f(E) : (t.if((0, Nn.propertyInData)(t, s, E, l.opts.ownProperties)), f(E), l.allErrors || t.else().var(_, !0), t.endIf()), e.it.definedProperties.add(E), e.ok(_); + function y(E) { + return l.opts.useDefaults && !l.compositeRule && r[E].default !== void 0; + } + function f(E) { + e.subschema({ + keyword: "properties", + schemaProp: E, + dataProp: E + }, _); + } + } +}; +Ua.default = _c; +var Ga = {}; +Object.defineProperty(Ga, "__esModule", { value: !0 }); +const Ln = se, Nr = ie, An = ce, Rn = ce, wc = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(e) { + const { gen: t, schema: r, data: a, parentSchema: s, it: l } = e, { opts: d } = l, b = (0, Ln.allSchemaProperties)(r), _ = b.filter((P) => (0, An.alwaysValidSchema)(l, r[P])); + if (b.length === 0 || _.length === b.length && (!l.opts.unevaluated || l.props === !0)) + return; + const y = d.strictSchema && !d.allowMatchingProperties && s.properties, f = t.name("valid"); + l.props !== !0 && !(l.props instanceof Nr.Name) && (l.props = (0, Rn.evaluatedPropsToName)(t, l.props)); + const { props: E } = l; + N(); + function N() { + for (const P of b) + y && A(P), l.allErrors ? j(P) : (t.var(f, !0), j(P), t.if(f)); + } + function A(P) { + for (const x in y) + new RegExp(P).test(x) && (0, An.checkStrictMode)(l, `property ${x} matches pattern ${P} (use allowMatchingProperties)`); + } + function j(P) { + t.forIn("key", a, (x) => { + t.if((0, Nr._)`${(0, Ln.usePattern)(e, P)}.test(${x})`, () => { + const v = _.includes(P); + v || e.subschema({ + keyword: "patternProperties", + schemaProp: P, + dataProp: x, + dataPropType: Rn.Type.Str + }, f), l.opts.unevaluated && E !== !0 ? t.assign((0, Nr._)`${E}[${x}]`, !0) : !v && !l.allErrors && t.if((0, Nr.not)(f), () => t.break()); + }); + }); + } + } +}; +Ga.default = wc; +var Ha = {}; +Object.defineProperty(Ha, "__esModule", { value: !0 }); +const vc = ce, kc = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: !0, + code(e) { + const { gen: t, schema: r, it: a } = e; + if ((0, vc.alwaysValidSchema)(a, r)) { + e.fail(); + return; + } + const s = t.name("valid"); + e.subschema({ + keyword: "not", + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }, s), e.failResult(s, () => e.reset(), () => e.error()); + }, + error: { message: "must NOT be valid" } +}; +Ha.default = kc; +var Ka = {}; +Object.defineProperty(Ka, "__esModule", { value: !0 }); +const Ec = se, $c = { + keyword: "anyOf", + schemaType: "array", + trackErrors: !0, + code: Ec.validateUnion, + error: { message: "must match a schema in anyOf" } +}; +Ka.default = $c; +var Wa = {}; +Object.defineProperty(Wa, "__esModule", { value: !0 }); +const Mr = ie, Pc = ce, Sc = { + message: "must match exactly one schema in oneOf", + params: ({ params: e }) => (0, Mr._)`{passingSchemas: ${e.passing}}` +}, Tc = { + keyword: "oneOf", + schemaType: "array", + trackErrors: !0, + error: Sc, + code(e) { + const { gen: t, schema: r, parentSchema: a, it: s } = e; + if (!Array.isArray(r)) + throw new Error("ajv implementation error"); + if (s.opts.discriminator && a.discriminator) + return; + const l = r, d = t.let("valid", !1), b = t.let("passing", null), _ = t.name("_valid"); + e.setParams({ passing: b }), t.block(y), e.result(d, () => e.reset(), () => e.error(!0)); + function y() { + l.forEach((f, E) => { + let N; + (0, Pc.alwaysValidSchema)(s, f) ? t.var(_, !0) : N = e.subschema({ + keyword: "oneOf", + schemaProp: E, + compositeRule: !0 + }, _), E > 0 && t.if((0, Mr._)`${_} && ${d}`).assign(d, !1).assign(b, (0, Mr._)`[${b}, ${E}]`).else(), t.if(_, () => { + t.assign(d, !0), t.assign(b, E), N && e.mergeEvaluated(N, Mr.Name); + }); + }); + } + } +}; +Wa.default = Tc; +var Ya = {}; +Object.defineProperty(Ya, "__esModule", { value: !0 }); +const Cc = ce, xc = { + keyword: "allOf", + schemaType: "array", + code(e) { + const { gen: t, schema: r, it: a } = e; + if (!Array.isArray(r)) + throw new Error("ajv implementation error"); + const s = t.name("valid"); + r.forEach((l, d) => { + if ((0, Cc.alwaysValidSchema)(a, l)) + return; + const b = e.subschema({ keyword: "allOf", schemaProp: d }, s); + e.ok(s), e.mergeEvaluated(b); + }); + } +}; +Ya.default = xc; +var Za = {}; +Object.defineProperty(Za, "__esModule", { value: !0 }); +const Ur = ie, zo = ce, Oc = { + message: ({ params: e }) => (0, Ur.str)`must match "${e.ifClause}" schema`, + params: ({ params: e }) => (0, Ur._)`{failingKeyword: ${e.ifClause}}` +}, Nc = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: !0, + error: Oc, + code(e) { + const { gen: t, parentSchema: r, it: a } = e; + r.then === void 0 && r.else === void 0 && (0, zo.checkStrictMode)(a, '"if" without "then" and "else" is ignored'); + const s = In(a, "then"), l = In(a, "else"); + if (!s && !l) + return; + const d = t.let("valid", !0), b = t.name("_valid"); + if (_(), e.reset(), s && l) { + const f = t.let("ifClause"); + e.setParams({ ifClause: f }), t.if(b, y("then", f), y("else", f)); + } else + s ? t.if(b, y("then")) : t.if((0, Ur.not)(b), y("else")); + e.pass(d, () => e.error(!0)); + function _() { + const f = e.subschema({ + keyword: "if", + compositeRule: !0, + createErrors: !1, + allErrors: !1 + }, b); + e.mergeEvaluated(f); + } + function y(f, E) { + return () => { + const N = e.subschema({ keyword: f }, b); + t.assign(d, b), e.mergeValidEvaluated(N, d), E ? t.assign(E, (0, Ur._)`${f}`) : e.setParams({ ifClause: f }); + }; + } + } +}; +function In(e, t) { + const r = e.schema[t]; + return r !== void 0 && !(0, zo.alwaysValidSchema)(e, r); +} +Za.default = Nc; +var Ja = {}; +Object.defineProperty(Ja, "__esModule", { value: !0 }); +const jc = ce, Lc = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({ keyword: e, parentSchema: t, it: r }) { + t.if === void 0 && (0, jc.checkStrictMode)(r, `"${e}" without "if" is ignored`); + } +}; +Ja.default = Lc; +Object.defineProperty(Ba, "__esModule", { value: !0 }); +const Ac = Wt, Rc = za, Ic = Yt, Mc = Va, Dc = Fa, Bc = Do, zc = qa, Vc = Xr, Fc = Ua, qc = Ga, Uc = Ha, Gc = Ka, Hc = Wa, Kc = Ya, Wc = Za, Yc = Ja; +function Zc(e = !1) { + const t = [ + // any + Uc.default, + Gc.default, + Hc.default, + Kc.default, + Wc.default, + Yc.default, + // object + zc.default, + Vc.default, + Bc.default, + Fc.default, + qc.default + ]; + return e ? t.push(Rc.default, Mc.default) : t.push(Ac.default, Ic.default), t.push(Dc.default), t; +} +Ba.default = Zc; +var Qa = {}, Xa = {}; +Object.defineProperty(Xa, "__esModule", { value: !0 }); +const ve = ie, Jc = { + message: ({ schemaCode: e }) => (0, ve.str)`must match format "${e}"`, + params: ({ schemaCode: e }) => (0, ve._)`{format: ${e}}` +}, Qc = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: !0, + error: Jc, + code(e, t) { + const { gen: r, data: a, $data: s, schema: l, schemaCode: d, it: b } = e, { opts: _, errSchemaPath: y, schemaEnv: f, self: E } = b; + if (!_.validateFormats) + return; + s ? N() : A(); + function N() { + const j = r.scopeValue("formats", { + ref: E.formats, + code: _.code.formats + }), P = r.const("fDef", (0, ve._)`${j}[${d}]`), x = r.let("fType"), v = r.let("format"); + r.if((0, ve._)`typeof ${P} == "object" && !(${P} instanceof RegExp)`, () => r.assign(x, (0, ve._)`${P}.type || "string"`).assign(v, (0, ve._)`${P}.validate`), () => r.assign(x, (0, ve._)`"string"`).assign(v, P)), e.fail$data((0, ve.or)(C(), R())); + function C() { + return _.strictSchema === !1 ? ve.nil : (0, ve._)`${d} && !${v}`; + } + function R() { + const n = f.$async ? (0, ve._)`(${P}.async ? await ${v}(${a}) : ${v}(${a}))` : (0, ve._)`${v}(${a})`, i = (0, ve._)`(typeof ${v} == "function" ? ${n} : ${v}.test(${a}))`; + return (0, ve._)`${v} && ${v} !== true && ${x} === ${t} && !${i}`; + } + } + function A() { + const j = E.formats[l]; + if (!j) { + C(); + return; + } + if (j === !0) + return; + const [P, x, v] = R(j); + P === t && e.pass(n()); + function C() { + if (_.strictSchema === !1) { + E.logger.warn(i()); + return; + } + throw new Error(i()); + function i() { + return `unknown format "${l}" ignored in schema at path "${y}"`; + } + } + function R(i) { + const o = i instanceof RegExp ? (0, ve.regexpCode)(i) : _.code.formats ? (0, ve._)`${_.code.formats}${(0, ve.getProperty)(l)}` : void 0, c = r.scopeValue("formats", { key: l, ref: i, code: o }); + return typeof i == "object" && !(i instanceof RegExp) ? [i.type || "string", i.validate, (0, ve._)`${c}.validate`] : ["string", i, c]; + } + function n() { + if (typeof j == "object" && !(j instanceof RegExp) && j.async) { + if (!f.$async) + throw new Error("async format in sync schema"); + return (0, ve._)`await ${v}(${a})`; + } + return typeof x == "function" ? (0, ve._)`${v}(${a})` : (0, ve._)`${v}.test(${a})`; + } + } + } +}; +Xa.default = Qc; +Object.defineProperty(Qa, "__esModule", { value: !0 }); +const Xc = Xa, eu = [Xc.default]; +Qa.default = eu; +var Kt = {}; +Object.defineProperty(Kt, "__esModule", { value: !0 }); +Kt.contentVocabulary = Kt.metadataVocabulary = void 0; +Kt.metadataVocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples" +]; +Kt.contentVocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema" +]; +Object.defineProperty($a, "__esModule", { value: !0 }); +const tu = Pa, ru = Ta, au = Ba, nu = Qa, Mn = Kt, ou = [ + tu.default, + ru.default, + (0, au.default)(), + nu.default, + Mn.metadataVocabulary, + Mn.contentVocabulary +]; +$a.default = ou; +var en = {}, Vo = {}; +(function(e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.DiscrError = void 0, function(t) { + t.Tag = "tag", t.Mapping = "mapping"; + }(e.DiscrError || (e.DiscrError = {})); +})(Vo); +Object.defineProperty(en, "__esModule", { value: !0 }); +const Vt = ie, fa = Vo, Dn = Be, su = ce, iu = { + message: ({ params: { discrError: e, tagName: t } }) => e === fa.DiscrError.Tag ? `tag "${t}" must be string` : `value of tag "${t}" must be in oneOf`, + params: ({ params: { discrError: e, tag: t, tagName: r } }) => (0, Vt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}` +}, lu = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error: iu, + code(e) { + const { gen: t, data: r, schema: a, parentSchema: s, it: l } = e, { oneOf: d } = s; + if (!l.opts.discriminator) + throw new Error("discriminator: requires discriminator option"); + const b = a.propertyName; + if (typeof b != "string") + throw new Error("discriminator: requires propertyName"); + if (a.mapping) + throw new Error("discriminator: mapping is not supported"); + if (!d) + throw new Error("discriminator: requires oneOf keyword"); + const _ = t.let("valid", !1), y = t.const("tag", (0, Vt._)`${r}${(0, Vt.getProperty)(b)}`); + t.if((0, Vt._)`typeof ${y} == "string"`, () => f(), () => e.error(!1, { discrError: fa.DiscrError.Tag, tag: y, tagName: b })), e.ok(_); + function f() { + const A = N(); + t.if(!1); + for (const j in A) + t.elseIf((0, Vt._)`${y} === ${j}`), t.assign(_, E(A[j])); + t.else(), e.error(!1, { discrError: fa.DiscrError.Mapping, tag: y, tagName: b }), t.endIf(); + } + function E(A) { + const j = t.name("valid"), P = e.subschema({ keyword: "oneOf", schemaProp: A }, j); + return e.mergeEvaluated(P, Vt.Name), j; + } + function N() { + var A; + const j = {}, P = v(s); + let x = !0; + for (let n = 0; n < d.length; n++) { + let i = d[n]; + i != null && i.$ref && !(0, su.schemaHasRulesButRef)(i, l.self.RULES) && (i = Dn.resolveRef.call(l.self, l.schemaEnv.root, l.baseId, i == null ? void 0 : i.$ref), i instanceof Dn.SchemaEnv && (i = i.schema)); + const o = (A = i == null ? void 0 : i.properties) === null || A === void 0 ? void 0 : A[b]; + if (typeof o != "object") + throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${b}"`); + x = x && (P || v(i)), C(o, n); + } + if (!x) + throw new Error(`discriminator: "${b}" must be required`); + return j; + function v({ required: n }) { + return Array.isArray(n) && n.includes(b); + } + function C(n, i) { + if (n.const) + R(n.const, i); + else if (n.enum) + for (const o of n.enum) + R(o, i); + else + throw new Error(`discriminator: "properties/${b}" must have "const" or "enum"`); + } + function R(n, i) { + if (typeof n != "string" || n in j) + throw new Error(`discriminator: "${b}" values must be unique strings`); + j[n] = i; + } + } + } +}; +en.default = lu; +const cu = "http://json-schema.org/draft-07/schema#", uu = "http://json-schema.org/draft-07/schema#", du = "Core schema meta-schema", hu = { + schemaArray: { + type: "array", + minItems: 1, + items: { + $ref: "#" + } + }, + nonNegativeInteger: { + type: "integer", + minimum: 0 + }, + nonNegativeIntegerDefault0: { + allOf: [ + { + $ref: "#/definitions/nonNegativeInteger" + }, + { + default: 0 + } + ] + }, + simpleTypes: { + enum: [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + stringArray: { + type: "array", + items: { + type: "string" + }, + uniqueItems: !0, + default: [] + } +}, pu = [ + "object", + "boolean" +], fu = { + $id: { + type: "string", + format: "uri-reference" + }, + $schema: { + type: "string", + format: "uri" + }, + $ref: { + type: "string", + format: "uri-reference" + }, + $comment: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: !0, + readOnly: { + type: "boolean", + default: !1 + }, + examples: { + type: "array", + items: !0 + }, + multipleOf: { + type: "number", + exclusiveMinimum: 0 + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "number" + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "number" + }, + maxLength: { + $ref: "#/definitions/nonNegativeInteger" + }, + minLength: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { + $ref: "#" + }, + items: { + anyOf: [ + { + $ref: "#" + }, + { + $ref: "#/definitions/schemaArray" + } + ], + default: !0 + }, + maxItems: { + $ref: "#/definitions/nonNegativeInteger" + }, + minItems: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + uniqueItems: { + type: "boolean", + default: !1 + }, + contains: { + $ref: "#" + }, + maxProperties: { + $ref: "#/definitions/nonNegativeInteger" + }, + minProperties: { + $ref: "#/definitions/nonNegativeIntegerDefault0" + }, + required: { + $ref: "#/definitions/stringArray" + }, + additionalProperties: { + $ref: "#" + }, + definitions: { + type: "object", + additionalProperties: { + $ref: "#" + }, + default: {} + }, + properties: { + type: "object", + additionalProperties: { + $ref: "#" + }, + default: {} + }, + patternProperties: { + type: "object", + additionalProperties: { + $ref: "#" + }, + propertyNames: { + format: "regex" + }, + default: {} + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [ + { + $ref: "#" + }, + { + $ref: "#/definitions/stringArray" + } + ] + } + }, + propertyNames: { + $ref: "#" + }, + const: !0, + enum: { + type: "array", + items: !0, + minItems: 1, + uniqueItems: !0 + }, + type: { + anyOf: [ + { + $ref: "#/definitions/simpleTypes" + }, + { + type: "array", + items: { + $ref: "#/definitions/simpleTypes" + }, + minItems: 1, + uniqueItems: !0 + } + ] + }, + format: { + type: "string" + }, + contentMediaType: { + type: "string" + }, + contentEncoding: { + type: "string" + }, + if: { + $ref: "#" + }, + then: { + $ref: "#" + }, + else: { + $ref: "#" + }, + allOf: { + $ref: "#/definitions/schemaArray" + }, + anyOf: { + $ref: "#/definitions/schemaArray" + }, + oneOf: { + $ref: "#/definitions/schemaArray" + }, + not: { + $ref: "#" + } +}, mu = { + $schema: cu, + $id: uu, + title: du, + definitions: hu, + type: pu, + properties: fu, + default: !0 +}; +(function(e, t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.MissingRefError = t.ValidationError = t.CodeGen = t.Name = t.nil = t.stringify = t.str = t._ = t.KeywordCxt = void 0; + const r = so, a = $a, s = en, l = mu, d = ["/properties"], b = "http://json-schema.org/draft-07/schema"; + class _ extends r.default { + _addVocabularies() { + super._addVocabularies(), a.default.forEach((j) => this.addVocabulary(j)), this.opts.discriminator && this.addKeyword(s.default); + } + _addDefaultMetaSchema() { + if (super._addDefaultMetaSchema(), !this.opts.meta) + return; + const j = this.opts.$data ? this.$dataMetaSchema(l, d) : l; + this.addMetaSchema(j, b, !1), this.refs["http://json-schema.org/schema"] = b; + } + defaultMeta() { + return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(b) ? b : void 0); + } + } + e.exports = t = _, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = _; + var y = at; + Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() { + return y.KeywordCxt; + } }); + var f = ie; + Object.defineProperty(t, "_", { enumerable: !0, get: function() { + return f._; + } }), Object.defineProperty(t, "str", { enumerable: !0, get: function() { + return f.str; + } }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() { + return f.stringify; + } }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() { + return f.nil; + } }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() { + return f.Name; + } }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() { + return f.CodeGen; + } }); + var E = _r; + Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() { + return E.default; + } }); + var N = wr; + Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() { + return N.default; + } }); +})(la, la.exports); +var gu = la.exports; +const bu = /* @__PURE__ */ oo(gu); +class yu { + constructor() { + Te(this, "ajv"), this.ajv = new bu(); + } + validateJson(t, r) { + const a = this.ajv.validate(t, r); + return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() }; + } + validateObjectSchema(t, r) { + const a = this.ajv.validate(t, r); + return a ? { valid: a } : { valid: a, error: this.ajv.errorsText() }; + } +} +class _u { + constructor() { + Te(this, "TIME_SPLIT", " "); + } + /** + * 给日期添加小时 + * + * @param date - Date + * @param numOfHours - 数字 + * @author terwer + * @since 1.0.0 + */ + addHoursToDate(t, r) { + return t.setTime(t.getTime() + r * 60 * 60 * 1e3), t; + } + /** + * 转换ISO日期为中文日期的通用转换方法 + * + * @param str - '2022-07-18T06:25:48.000Z + * @param isAddTimeZone - 是否增加时区(默认不增加) + * @param isShort - 是否只返回日期 + * @author terwer + * @since 1.0.0 + */ + formatIsoToZhDateFormat(t, r, a) { + if (!t) + return ""; + let s = t; + const l = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, d = s.match(l); + if (d == null) + return t; + for (let b = 0; b < d.length; b++) { + const _ = d[b]; + let y = _; + r && (y = this.addHoursToDate(new Date(_), 8).toISOString()); + const f = y.split("T"), E = f[0], N = f[1].split(".")[0]; + let A = E + this.TIME_SPLIT + N; + a && (A = E), s = s.replace(_, A); + } + return s; + } + /** + * 转换ISO日期为中文完整时间 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZh(t) { + return this.formatIsoToZhDateFormat(t, !1, !1); + } + /** + * 转换ISO日期为中文日期 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZhDate(t) { + return this.formatIsoToZhDateFormat(t, !1, !0); + } + /** + * 转换ISO日期为中文时间 + * + * @param str - '2022-07-18T06:25:48.000Z + */ + formatIsoToZhTime(t) { + return this.formatIsoToZhDateFormat(t, !1).split(this.TIME_SPLIT)[1]; + } + /** + * 当前日期时间完整格式,格式:2023-03-10 02:03:43 + */ + nowZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0); + } + /** + * 当前日期,格式:2023-03-10 + */ + nowDateZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0, !0); + } + /** + * 当前时间,格式:02:03:43 + */ + nowTimeZh() { + return this.formatIsoToZhDateFormat((/* @__PURE__ */ new Date()).toISOString(), !0).split(this.TIME_SPLIT)[1]; + } +} +class wu { + /** + * 格式化字符串 + * + * @param str - 字符串,可用占位符,例如:test \{0\} str + * @param args - 按占位符顺序排列的参数 + * @author terwer + * @since 0.0.1 + */ + f(t, ...r) { + let a = t; + for (let s = 0; s < r.length; s++) { + const l = r[s]; + typeof l == "string" ? a = a.replace(`{${s}}`, l) : a = a.replace(`{${s}}`, l.toString()); + } + return a; + } + /** + * 字符串拼接 + * + * @param str - 字符串数组 + */ + appendStr(...t) { + return t.join(""); + } + /** + * 判断字符串中,是否包含数组中任何一个元素 + * + * @param str - 字符串 + * @param arr - 字符串数组 + */ + includeInArray(t, r) { + let a = !1; + for (let s = 0; s < r.length; s++) { + const l = r[s]; + t.includes(l) && (a = !0); + } + return a; + } + /** + * 截取指定长度的字符串 + * + * @param str - str + * @param length - 长度 + * @param ignore - 不要结尾省略号 + */ + getByLength(t, r, a) { + const s = t; + return s.length < r ? s : a ? s.substring(0, r) : s.substring(0, r) + "..."; + } + /** + * 字符串空值检测 + * + * @param str - 待检测的字符串 + */ + isEmptyString(t) { + return !t || typeof t != "string" ? !0 : t.trim().length === 0; + } + /** + * 路径组合,解决多出来/的问题 + * + * @param path1 - 路径1 + * @param path2 - 路径2 + */ + pathJoin(t, r) { + let a = t; + const s = t.lastIndexOf("/"); + return s + 1 === t.length && (a = t.substring(0, s)), r.indexOf("/") > 0 ? a = a + "/" + r : a = a + r, a; + } + /** + * 强转boolean + * + * @param val - val + */ + parseBoolean(t) { + return t || (t = "false"), t.toString().toLowerCase() === "true"; + } +} +const ia = (e, t) => { + const r = Bn(e), a = Bn(t), s = r.pop(), l = a.pop(), d = Fn(r, a); + return d !== 0 ? d : s && l ? Fn(s.split("."), l.split(".")) : s || l ? s ? -1 : 1 : 0; +}, vu = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Bn = (e) => { + if (typeof e != "string") + throw new TypeError("Invalid argument expected string"); + const t = e.match(vu); + if (!t) + throw new Error(`Invalid argument not valid semver ('${e}' received)`); + return t.shift(), t; +}, zn = (e) => e === "*" || e === "x" || e === "X", Vn = (e) => { + const t = parseInt(e, 10); + return isNaN(t) ? e : t; +}, ku = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], Eu = (e, t) => { + if (zn(e) || zn(t)) + return 0; + const [r, a] = ku(Vn(e), Vn(t)); + return r > a ? 1 : r < a ? -1 : 0; +}, Fn = (e, t) => { + for (let r = 0; r < Math.max(e.length, t.length); r++) { + const a = Eu(e[r] || "0", t[r] || "0"); + if (a !== 0) + return a; + } + return 0; +}; +class $u { + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is higher than v2 + */ + greater(t, r) { + return ia(t, r) > 0; + } + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is equal to v2 + */ + equal(t, r) { + return ia(t, r) === 0; + } + /** + * Compare [semver](https://semver.org/) version strings + * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`. + * + * @param v1 - First version to compare + * @param v2 - Second version to compare + * @returns boolean true if v1 is lesser than v2 + */ + lesser(t, r) { + return ia(t, r) < 0; + } +} +var Pu = Object.defineProperty, Su = (e, t, r) => t in e ? Pu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ft = (e, t, r) => (Su(e, typeof t != "symbol" ? t + "" : t, r), r); +let bt = class { +}; +Ft(bt, "NODE_ENV_KEY", "NODE_ENV"), /** +* 开发环境 +*/ +Ft(bt, "NODE_ENV_DEVELOPMENT", "development"), /** +* 生产环境 +*/ +Ft(bt, "NODE_ENV_PRODUCTION", "production"), /** +* 测试环境 +*/ +Ft(bt, "NODE_ENV_TEST", "test"), /** +* 是否处于调试模式 +*/ +Ft(bt, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); +class Tu { + /** + * 环境初始化 + * + * @param envMeta - 需要传入 {"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false} 。特别提醒:此参数是静态元数据,取决于最终使用的项目。因此仅仅在最终使用的地方显示传递此值,中间项目请保持参数传递 + * @see {@link https://vitejs.dev/guide/env-and-mode.html#production-replacement} + */ + constructor(t) { + Ft(this, "envMeta"), this.envMeta = t; + } + /** + * 是否是开发阶段调试 + */ + isNodeDev() { + return this.getEnv(bt.NODE_ENV_KEY) === bt.NODE_ENV_DEVELOPMENT; + } + /** + * 是否是调试阶段 + */ + isDev() { + return this.isNodeDev() || this.getBooleanEnv(bt.VITE_DEBUG_MODE_KEY); + } + /** + * 获取环境变量,key不存在返回undefined + * @param key - key + */ + getEnv(t) { + let r; + try { + this.envMeta[t] && (r = this.envMeta[t]); + } catch { + } + return r; + } + /** + * 获取String类型的环境变量,key不存在直接返回空值 + * @param key - key + */ + getStringEnv(t) { + return this.getEnv(t) ?? ""; + } + /** + * 获取Boolean类型的环境变量,key不存在返回false + * @param key - key + */ + getBooleanEnv(t) { + let r = !1; + return this.getEnv(t) && (r = this.getStringEnv(t).toLowerCase() === "true"), r; + } + /** + * 获取环境变量,如果未定义或者为空值,用指定的默认值代替 + * + * @param key - key + * @param defaultValue - 默认值 + * @since 0.1.0 + * @author terwer + */ + getEnvOrDefault(t, r) { + const a = this.getStringEnv(t); + return a.trim().length == 0 ? r : a; + } +} +var Cu = Object.defineProperty, xu = (e, t, r) => t in e ? Cu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ut = (e, t, r) => (xu(e, typeof t != "symbol" ? t + "" : t, r), r); +class Gr { +} +Ut(Gr, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), Ut(Gr, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); +var Ze = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(Ze || {}), Fo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function tn(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var qo = { exports: {} }; +(function(e) { + (function(t, r) { + e.exports ? e.exports = r() : t.log = r(); + })(Fo, function() { + var t = function() { + }, r = "undefined", a = typeof window !== r && typeof window.navigator !== r && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [ + "trace", + "debug", + "info", + "warn", + "error" + ]; + function l(P, x) { + var v = P[x]; + if (typeof v.bind == "function") + return v.bind(P); + try { + return Function.prototype.bind.call(v, P); + } catch { + return function() { + return Function.prototype.apply.apply(v, [P, arguments]); + }; + } + } + function d() { + console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); + } + function b(P) { + return P === "debug" && (P = "log"), typeof console === r ? !1 : P === "trace" && a ? d : console[P] !== void 0 ? l(console, P) : console.log !== void 0 ? l(console, "log") : t; + } + function _(P, x) { + for (var v = 0; v < s.length; v++) { + var C = s[v]; + this[C] = v < P ? t : this.methodFactory(C, P, x); + } + this.log = this.debug; + } + function y(P, x, v) { + return function() { + typeof console !== r && (_.call(this, x, v), this[P].apply(this, arguments)); + }; + } + function f(P, x, v) { + return b(P) || y.apply(this, arguments); + } + function E(P, x, v) { + var C = this, R; + x = x ?? "WARN"; + var n = "loglevel"; + typeof P == "string" ? n += ":" + P : typeof P == "symbol" && (n = void 0); + function i(m) { + var g = (s[m] || "silent").toUpperCase(); + if (!(typeof window === r || !n)) { + try { + window.localStorage[n] = g; + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(n) + "=" + g + ";"; + } catch { + } + } + } + function o() { + var m; + if (!(typeof window === r || !n)) { + try { + m = window.localStorage[n]; + } catch { + } + if (typeof m === r) + try { + var g = window.document.cookie, O = g.indexOf( + encodeURIComponent(n) + "=" + ); + O !== -1 && (m = /^([^;]+)/.exec(g.slice(O))[1]); + } catch { + } + return C.levels[m] === void 0 && (m = void 0), m; + } + } + function c() { + if (!(typeof window === r || !n)) { + try { + window.localStorage.removeItem(n); + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(n) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + } catch { + } + } + } + C.name = P, C.levels = { + TRACE: 0, + DEBUG: 1, + INFO: 2, + WARN: 3, + ERROR: 4, + SILENT: 5 + }, C.methodFactory = v || f, C.getLevel = function() { + return R; + }, C.setLevel = function(m, g) { + if (typeof m == "string" && C.levels[m.toUpperCase()] !== void 0 && (m = C.levels[m.toUpperCase()]), typeof m == "number" && m >= 0 && m <= C.levels.SILENT) { + if (R = m, g !== !1 && i(m), _.call(C, m, P), typeof console === r && m < C.levels.SILENT) + return "No console available for logging"; + } else + throw "log.setLevel() called with invalid level: " + m; + }, C.setDefaultLevel = function(m) { + x = m, o() || C.setLevel(m, !1); + }, C.resetLevel = function() { + C.setLevel(x, !1), c(); + }, C.enableAll = function(m) { + C.setLevel(C.levels.TRACE, m); + }, C.disableAll = function(m) { + C.setLevel(C.levels.SILENT, m); + }; + var u = o(); + u == null && (u = x), C.setLevel(u, !1); + } + var N = new E(), A = {}; + N.getLogger = function(P) { + if (typeof P != "symbol" && typeof P != "string" || P === "") + throw new TypeError("You must supply a name when creating a logger."); + var x = A[P]; + return x || (x = A[P] = new E( + P, + N.getLevel(), + N.methodFactory + )), x; + }; + var j = typeof window !== r ? window.log : void 0; + return N.noConflict = function() { + return typeof window !== r && window.log === N && (window.log = j), N; + }, N.getLoggers = function() { + return A; + }, N.default = N, N; + }); +})(qo); +var Ou = qo.exports; +const jr = /* @__PURE__ */ tn(Ou); +var Uo = { exports: {} }; +(function(e) { + (function(t, r) { + e.exports ? e.exports = r() : t.prefix = r(t); + })(Fo, function(t) { + var r = function(f) { + for (var E = 1, N = arguments.length, A; E < N; E++) + for (A in arguments[E]) + Object.prototype.hasOwnProperty.call(arguments[E], A) && (f[A] = arguments[E][A]); + return f; + }, a = { + template: "[%t] %l:", + levelFormatter: function(f) { + return f.toUpperCase(); + }, + nameFormatter: function(f) { + return f || "root"; + }, + timestampFormatter: function(f) { + return f.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); + }, + format: void 0 + }, s, l = {}, d = function(f) { + if (!f || !f.getLogger) + throw new TypeError("Argument is not a root logger"); + s = f; + }, b = function(f, E) { + if (!f || !f.setLevel) + throw new TypeError("Argument is not a logger"); + var N = f.methodFactory, A = f.name || "", j = l[A] || l[""] || a; + function P(x, v, C) { + var R = N(x, v, C), n = l[C] || l[""], i = n.template.indexOf("%t") !== -1, o = n.template.indexOf("%l") !== -1, c = n.template.indexOf("%n") !== -1; + return function() { + for (var u = "", m = arguments.length, g = Array(m), O = 0; O < m; O++) + g[O] = arguments[O]; + if (A || !l[C]) { + var z = n.timestampFormatter(/* @__PURE__ */ new Date()), q = n.levelFormatter(x), B = n.nameFormatter(C); + n.format ? u += n.format(q, B, z) : (u += n.template, i && (u = u.replace(/%t/, z)), o && (u = u.replace(/%l/, q)), c && (u = u.replace(/%n/, B))), g.length && typeof g[0] == "string" ? g[0] = u + " " + g[0] : g.unshift(u); + } + R.apply(void 0, g); + }; + } + return l[A] || (f.methodFactory = P), E = E || {}, E.template && (E.format = void 0), l[A] = r({}, j, E), f.setLevel(f.getLevel()), s || f.warn( + "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md" + ), f; + }, _ = { + reg: d, + apply: b + }, y; + return t && (y = t.prefix, _.noConflict = function() { + return t.prefix === _ && (t.prefix = y), _; + }), _; + }); +})(Uo); +var Nu = Uo.exports; +const qn = /* @__PURE__ */ tn(Nu); +function ju() { + const e = Error.prepareStackTrace; + Error.prepareStackTrace = (r, a) => a; + const t = new Error().stack.slice(1); + return Error.prepareStackTrace = e, t; +} +class Hr { + /** + * 解析日志级别为枚举 + * + * @param enumObj - 枚举对象 + * @param value - 配置的值 + */ + static stringToEnumValue(t, r) { + return t[Object.keys(t).filter((a) => t[a].toString() === r)[0]]; + } + /** + * 获取配置的日志级别 + */ + static getEnvLevel(t) { + if (!t) + return; + let r; + try { + r = t.getEnvOrDefault(Gr.LOG_LEVEL_KEY, Ze.LOG_LEVEL_INFO); + } catch { + r = Ze.LOG_LEVEL_INFO; + } + const a = Hr.stringToEnumValue(Ze, r.toUpperCase()); + return a || console.warn( + "[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level" + ), a ?? Ze.LOG_LEVEL_INFO; + } + /** + * 获取默认日志 + */ + static getEnvLogger(t) { + return t ? t.getEnv(Gr.LOG_PREFIX_KEY) : void 0; + } +} +var rn = { exports: {} }, Un = { exports: {} }, Gn; +function Lu() { + return Gn || (Gn = 1, function(e) { + const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", r = typeof process < "u" && process.platform === "win32", a = typeof process < "u" && process.platform === "linux", s = { + ballotDisabled: "☒", + ballotOff: "☐", + ballotOn: "☑", + bullet: "•", + bulletWhite: "◦", + fullBlock: "█", + heart: "❤", + identicalTo: "≡", + line: "─", + mark: "※", + middot: "·", + minus: "-", + multiplication: "×", + obelus: "÷", + pencilDownRight: "✎", + pencilRight: "✏", + pencilUpRight: "✐", + percent: "%", + pilcrow2: "❡", + pilcrow: "¶", + plusMinus: "±", + question: "?", + section: "§", + starsOff: "☆", + starsOn: "★", + upDownArrow: "↕" + }, l = Object.assign({}, s, { + check: "√", + cross: "×", + ellipsisLarge: "...", + ellipsis: "...", + info: "i", + questionSmall: "?", + pointer: ">", + pointerSmall: "»", + radioOff: "( )", + radioOn: "(*)", + warning: "‼" + }), d = Object.assign({}, s, { + ballotCross: "✘", + check: "✔", + cross: "✖", + ellipsisLarge: "⋯", + ellipsis: "…", + info: "ℹ", + questionFull: "?", + questionSmall: "﹖", + pointer: a ? "▸" : "❯", + pointerSmall: a ? "‣" : "›", + radioOff: "◯", + radioOn: "◉", + warning: "⚠" + }); + e.exports = r && !t ? l : d, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: l }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: d }); + }(Un)), Un.exports; +} +const Au = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Ru = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, Iu = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, Go = () => { + const e = { + enabled: Iu(), + visible: !0, + styles: {}, + keys: {} + }, t = (l) => { + let d = l.open = `\x1B[${l.codes[0]}m`, b = l.close = `\x1B[${l.codes[1]}m`, _ = l.regex = new RegExp(`\\u001b\\[${l.codes[1]}m`, "g"); + return l.wrap = (y, f) => { + y.includes(b) && (y = y.replace(_, b + d)); + let E = d + y + b; + return f ? E.replace(/\r*\n/g, `${b}$&${d}`) : E; + }, l; + }, r = (l, d, b) => typeof l == "function" ? l(d) : l.wrap(d, b), a = (l, d) => { + if (l === "" || l == null) + return ""; + if (e.enabled === !1) + return l; + if (e.visible === !1) + return ""; + let b = "" + l, _ = b.includes(` +`), y = d.length; + for (y > 0 && d.includes("unstyle") && (d = [.../* @__PURE__ */ new Set(["unstyle", ...d])].reverse()); y-- > 0; ) + b = r(e.styles[d[y]], b, _); + return b; + }, s = (l, d, b) => { + e.styles[l] = t({ name: l, codes: d }), (e.keys[b] || (e.keys[b] = [])).push(l), Reflect.defineProperty(e, l, { + configurable: !0, + enumerable: !0, + set(_) { + e.alias(l, _); + }, + get() { + let _ = (y) => a(y, _.stack); + return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(l) : [l], _; + } + }); + }; + return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = Ru, e.hasColor = e.hasAnsi = (l) => (e.ansiRegex.lastIndex = 0, typeof l == "string" && l !== "" && e.ansiRegex.test(l)), e.alias = (l, d) => { + let b = typeof d == "string" ? e[d] : d; + if (typeof b != "function") + throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); + b.stack || (Reflect.defineProperty(b, "name", { value: l }), e.styles[l] = b, b.stack = [l]), Reflect.defineProperty(e, l, { + configurable: !0, + enumerable: !0, + set(_) { + e.alias(l, _); + }, + get() { + let _ = (y) => a(y, _.stack); + return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(b.stack) : b.stack, _; + } + }); + }, e.theme = (l) => { + if (!Au(l)) + throw new TypeError("Expected theme to be an object"); + for (let d of Object.keys(l)) + e.alias(d, l[d]); + return e; + }, e.alias("unstyle", (l) => typeof l == "string" && l !== "" ? (e.ansiRegex.lastIndex = 0, l.replace(e.ansiRegex, "")) : ""), e.alias("noop", (l) => l), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = Lu(), e.define = s, e; +}; +rn.exports = Go(); +rn.exports.create = Go; +var Mu = rn.exports; +const Ge = /* @__PURE__ */ tn(Mu); +let ma, Ho, Ko, Wo, Yo = !0; +typeof process < "u" && ({ FORCE_COLOR: ma, NODE_DISABLE_COLORS: Ho, NO_COLOR: Ko, TERM: Wo } = process.env || {}, Yo = process.stdout && process.stdout.isTTY); +const re = { + enabled: !Ho && Ko == null && Wo !== "dumb" && (ma != null && ma !== "0" || Yo), + // modifiers + reset: me(0, 0), + bold: me(1, 22), + dim: me(2, 22), + italic: me(3, 23), + underline: me(4, 24), + inverse: me(7, 27), + hidden: me(8, 28), + strikethrough: me(9, 29), + // colors + black: me(30, 39), + red: me(31, 39), + green: me(32, 39), + yellow: me(33, 39), + blue: me(34, 39), + magenta: me(35, 39), + cyan: me(36, 39), + white: me(37, 39), + gray: me(90, 39), + grey: me(90, 39), + // background colors + bgBlack: me(40, 49), + bgRed: me(41, 49), + bgGreen: me(42, 49), + bgYellow: me(43, 49), + bgBlue: me(44, 49), + bgMagenta: me(45, 49), + bgCyan: me(46, 49), + bgWhite: me(47, 49) +}; +function Hn(e, t) { + let r = 0, a, s = "", l = ""; + for (; r < e.length; r++) + a = e[r], s += a.open, l += a.close, ~t.indexOf(a.close) && (t = t.replace(a.rgx, a.close + a.open)); + return s + t + l; +} +function Du(e, t) { + let r = { has: e, keys: t }; + return r.reset = re.reset.bind(r), r.bold = re.bold.bind(r), r.dim = re.dim.bind(r), r.italic = re.italic.bind(r), r.underline = re.underline.bind(r), r.inverse = re.inverse.bind(r), r.hidden = re.hidden.bind(r), r.strikethrough = re.strikethrough.bind(r), r.black = re.black.bind(r), r.red = re.red.bind(r), r.green = re.green.bind(r), r.yellow = re.yellow.bind(r), r.blue = re.blue.bind(r), r.magenta = re.magenta.bind(r), r.cyan = re.cyan.bind(r), r.white = re.white.bind(r), r.gray = re.gray.bind(r), r.grey = re.grey.bind(r), r.bgBlack = re.bgBlack.bind(r), r.bgRed = re.bgRed.bind(r), r.bgGreen = re.bgGreen.bind(r), r.bgYellow = re.bgYellow.bind(r), r.bgBlue = re.bgBlue.bind(r), r.bgMagenta = re.bgMagenta.bind(r), r.bgCyan = re.bgCyan.bind(r), r.bgWhite = re.bgWhite.bind(r), r; +} +function me(e, t) { + let r = { + open: `\x1B[${e}m`, + close: `\x1B[${t}m`, + rgx: new RegExp(`\\x1b\\[${t}m`, "g") + }; + return function(a) { + return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(r)), a === void 0 ? this : re.enabled ? Hn(this.keys, a + "") : a + "") : a === void 0 ? Du([e], [r]) : re.enabled ? Hn([r], a + "") : a + ""; + }; +} +var Bu = Object.defineProperty, zu = (e, t, r) => t in e ? Bu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Pe = (e, t, r) => (zu(e, typeof t != "symbol" ? t + "" : t, r), r); +const et = class { + /** + * 检测是否运行在Chrome插件中 + */ + static isInChromeExtension() { + return et.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; + } +}; +let de = et; +Pe(de, "isNode", typeof process < "u"), /** +* 是否在浏览器环境 +*/ +Pe(de, "isInBrowser", typeof window < "u"), /** +* 浏览器路径分隔符 +*/ +Pe(de, "BrowserSeperator", "/"), /** +* 是否是Electron环境 +*/ +Pe(de, "isElectron", () => !et.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** +* 是否有Node环境,目前包括 Electron 和 Node +*/ +Pe(de, "hasNodeEnv", () => et.isElectron() || et.isNode), /** +* 获取url参数 +* +* @param sParam - 参数 +*/ +Pe(de, "getQueryString", (e) => { + if (!et.isInBrowser) + return ""; + const t = window.location.search.substring(1).split("&"); + for (let r = 0; r < t.length; r++) { + const a = t[r].split("="); + if (a[0] === e) + return a[1]; + } + return ""; +}), /** +* 替换 URL 的参数 +* 思路: +* 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 +* +* 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 +* +* 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 +* +* 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 +* +* 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 +* +* @param url - 链接地址 +* @param paramName - 参数名 +* @param paramValue - 参数值 +*/ +Pe(de, "replaceUrlParam", (e, t, r) => { + r == null && (r = ""); + const a = new RegExp("\\b(" + t + "=).*?(&|#|$)"); + if (e.search(a) >= 0) + return e.replace(a, "$1" + r + "$2"); + const [s, l] = e.split("#"), [d, b] = s.split("?"), _ = new URLSearchParams(b); + _.set(t, r); + const y = _.toString(), f = d + (y ? "?" + y : ""); + return l ? f + "#" + l : f; +}), /** +* 设置url参数 +* +* @param urlstring - url +* @param key - key +* @param value - value +*/ +Pe(de, "setUrlParameter", (e, t, r) => { + if (e.includes(t)) + return et.replaceUrlParam(e, t, r); + const a = e.split("#"); + let s = a[0]; + const l = a[1]; + return s.includes("?") ? s += `&${t}=${r}` : s += `?${t}=${r}`, l && (s += "#" + l), s; +}), /** +* 重新加载指定tab +* +* @param tabname - tabname +* @param t - 延迟时间 +*/ +Pe(de, "reloadTabPage", (e, t = 200) => { + setTimeout(function() { + if (et.isInBrowser) { + const r = window.location.href; + window.location.href = et.setUrlParameter(r, "tab", e); + } + }, t); +}), /** +* 刷新当前tab页面 +*/ +Pe(de, "reloadPage", () => { + setTimeout(function() { + et.isInBrowser && window.location.reload(); + }, 200); +}), /** +* 刷新当前tab页面 +* +* @param msg - 消息提示 +* @param cb - 回调 +*/ +Pe(de, "reloadPageWithMessageCallback", (e, t) => { + t && t(e), setTimeout(function() { + et.isInBrowser && window.location.reload(); + }, 200); +}); +var je = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(je || {}); +const Ie = class { + /** + * 检测是否运行在思源打开的浏览器中 + */ + static isInSiyuanBrowser() { + return de.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; + } + /** + * 思源笔记 window 对象 + */ + static siyuanWindow() { + let e; + return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; + } + // ========================= + // require end + // ========================= + // ========================= + // import start + // ========================= + /** + * 引入json + * + * @param jsPath - js相对路径全路径 + * @param type - 类型 + */ + static async importJs(e, t) { + let r = e; + switch (t) { + case je.BasePathType_Appearance: + r = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); + break; + case je.BasePathType_Data: + r = this.browserJoinPath(this.siyuanDataRelativePath(), e); + break; + case je.BasePathType_Themes: + r = this.browserJoinPath(this.siyuanThemeRelativePath(), e); + break; + case je.BasePathType_ZhiTheme: + r = this.browserJoinPath(this.zhiThemeRelativePath(), e); + break; + default: + throw new Error("type must be provided"); + } + const { default: a } = await import( + /* @vite-ignore */ + r + ); + return a; + } + /** + * 引入json + * + * @param jsonPath - json相对路径全路径 + * @param type - 类型 + */ + // public static async importJson(jsonPath: string, type: BasePathTypeEnum) { + // let fullJsonPath = jsonPath + // switch (type) { + // case BasePathTypeEnum.BasePathType_Appearance: + // fullJsonPath = this.browserJoinPath(this.siyuanAppearanceRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Data: + // fullJsonPath = this.browserJoinPath(this.siyuanDataRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Themes: + // fullJsonPath = this.browserJoinPath(this.siyuanThemeRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_ZhiTheme: + // fullJsonPath = this.browserJoinPath(this.zhiThemeRelativePath(), jsonPath) + // break + // default: + // throw new Error("type must be provided") + // } + // + // const { default: data } = await import(/* @vite-ignore */ fullJsonPath, { assert: { type: "json" } }) + // return data + // } + /** + * 引入 json - 以 data 为基本路径 + * + * @param jsonPath - 相对于 data 的相对路径 + */ + // public static async importDataJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Data) + // } + /** + * 引入 json - 以 appearance 为基本路径 + * + * @param jsonPath - 相对于 appearance 的相对路径 + */ + // public static async importAppearanceJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Appearance) + // } + /** + * 引入 json - 以 themes 为基本路径 + * + * @param jsonPath - 相对于 themes 的相对路径 + */ + // public static async importThemesJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Themes) + // } + /** + * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 + * + * @param jsonPath - 相对于 zhi 主题根路径的相对路径 + */ + // public static async importZhiThemeJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_ZhiTheme) + // } + /** + * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 + * + * @param jsPath - 相对于 zhi 主题根路径的相对路径 + */ + static async importZhiThemeJs(e) { + return await this.importJs(e, je.BasePathType_ZhiTheme); + } + // ========================= + // import start + // ========================= + /** + * 路径拼接 + * + * @param paths - 路径数组 + */ + static joinPath(...e) { + if (de.hasNodeEnv()) { + const t = this.requireLib("path"); + if (t) + return t.join(...e); + } + return this.browserJoinPath(...e); + } + static browserJoinPath(...e) { + return e.join(de.BrowserSeperator); + } + /** + * 思源笔记 conf 目录 + */ + static siyuanConfPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.confDir; + } + /** + * 思源笔记 data 目录 + */ + static siyuanDataPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.dataDir; + } + /** + * 思源笔记 data 目录-相对路径 + */ + static siyuanDataRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return ""; + } + /** + * 思源笔记 appearance 目录 + */ + static siyuanAppearancePath() { + return this.joinPath(this.siyuanConfPath(), "appearance"); + } + /** + * 思源笔记 appearance 目录-相对路径 + */ + static siyuanAppearanceRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance"); + } + /** + * 思源笔记 themes 目录-绝对路径 + * + * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 + * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath + * + * @author terwer + * @since 0.1.0 + */ + static siyuanThemePath() { + if (de.hasNodeEnv()) + return this.joinPath(this.siyuanAppearancePath(), "themes"); + { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return this.joinPath(e.location.origin, "appearance", "themes"); + } + } + /** + * 思源笔记 themes 目录-相对路径 + */ + static siyuanThemeRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance", "themes"); + } + /** + * zhi 主题目录 - 绝对路径 + */ + static zhiThemePath() { + return this.joinPath(this.siyuanThemePath(), "zhi"); + } + /** + * zhi 主题目录 - 相对路径 + */ + static zhiThemeRelativePath() { + return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); + } +}; +let St = Ie; +Pe(St, "isInSiyuanWidget", () => de.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** +* 思源笔记新窗口 +* +* @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 +* @author terwer +* @version 0.1.0 +* @since 0.0.1 +*/ +Pe(St, "isInSiyuanNewWin", () => !de.isInBrowser || !de.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +// require start +// ========================= +/** + * 引入依赖 + * + * @param libpath - 依赖全路径 + * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 + * @param type - 可选,以谁的基本路径为准 + */ +Pe(St, "requireLib", (e, t = !0, r = je.BasePathType_None) => { + if (!de.hasNodeEnv()) + throw new Error("require ony works on node env"); + let a = e; + if (!t) + switch (r) { + case je.BasePathType_Appearance: + a = Ie.joinPath(Ie.siyuanAppearancePath(), e); + break; + case je.BasePathType_Data: + a = Ie.joinPath(Ie.siyuanDataPath(), e); + break; + case je.BasePathType_Themes: + a = Ie.joinPath(Ie.siyuanAppearancePath(), "themes", e); + break; + case je.BasePathType_ZhiTheme: + a = Ie.joinPath(Ie.siyuanAppearancePath(), "themes", "zhi", e); + break; + default: + throw new Error("type must be provided when not use absolute path"); + } + const s = Ie.siyuanWindow(); + if (!s) + return require(a); + if (typeof s.require < "u") + return s.require(a); +}), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 appearance 的相对路径 +*/ +Pe(St, "requireAppearanceLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Appearance)), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 data 的相对路径 +*/ +Pe(St, "requireDataLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Data)), /** +* 引入依赖,以 theme 的基本路径为准 +* +* @param libpath - 相对于 theme 的相对路径 +*/ +Pe(St, "requireThemesLib", (e) => Ie.requireLib(e, !1, je.BasePathType_Themes)), /** +* 引入依赖,以 ZhiTheme 的基本路径为准 +* +* @param libpath - 相对于 ZhiTheme 的相对路径 +*/ +Pe(St, "requireZhiThemeLib", (e) => Ie.requireLib(e, !1, je.BasePathType_ZhiTheme)); +const He = { + white: (e) => de.isElectron() ? Ge.whiteBright(e) : re.white(e), + gray: (e) => de.isElectron() ? Ge.gray(e) : re.gray(e), + blue: (e) => de.isElectron() ? Ge.blue(e) : re.blue(e), + green: (e) => de.isElectron() ? Ge.green(e) : re.green(e), + yellow: (e) => de.isElectron() ? Ge.yellow(e) : re.yellow(e), + red: (e) => de.isElectron() ? Ge.red(e) : re.red(e), + bgWhite: (e) => de.isElectron() ? Ge.bgWhiteBright(e) : re.bgWhite(e), + bgGrey: (e) => de.isElectron() ? Ge.bgCyanBright(e) : re.bgCyan(e), + bgBlue: (e) => de.isElectron() ? Ge.bgBlueBright(e) : re.bgBlue(e), + bgGreen: (e) => de.isElectron() ? Ge.bgGreenBright(e) : re.bgGreen(e), + bgYellow: (e) => de.isElectron() ? Ge.bgYellowBright(e) : re.bgYellow(e), + bgRed: (e) => de.isElectron() ? Ge.bgRedBright(e) : re.bgRed(e) +}; +class Vu { + constructor(t, r, a) { + Ut(this, "consoleLogger", "console"), Ut(this, "stackSize", 1), Ut(this, "getLogger", (d) => { + let b; + if (d) + b = d; + else { + const _ = this.getCallStack(), y = [], f = []; + for (let E = 0; E < _.length; E++) { + const N = _[E], A = N.getFileName() ?? "none"; + if (E > this.stackSize - 1) + break; + const j = A + "-" + N.getLineNumber() + ":" + N.getColumnNumber(); + y.push(j); + } + f.length > 0 && (b = y.join(" -> ")); + } + return (!b || b.trim().length === 0) && (b = this.consoleLogger), jr.getLogger(b); + }), this.stackSize = 1; + let s; + t ? s = t : s = Hr.getEnvLevel(a), s = s ?? Ze.LOG_LEVEL_INFO, jr.setLevel(s); + const l = (d, b, _, y) => { + const f = [], E = r ?? Hr.getEnvLogger(a) ?? "zhi"; + return f.push(He.gray("[") + y(E) + He.gray("]")), f.push(He.gray("[") + He.gray(_.toString()) + He.gray("]")), f.push(y(d.toUpperCase().toString())), f.push(y(b)), f.push(He.gray(":")), f; + }; + qn.reg(jr), qn.apply(jr, { + format(d, b, _) { + let y = []; + const f = b ?? ""; + switch (d) { + case Ze.LOG_LEVEL_TRACE: + y = l(d, f, _, He.gray); + break; + case Ze.LOG_LEVEL_DEBUG: + y = l(d, f, _, He.blue); + break; + case Ze.LOG_LEVEL_INFO: + y = l(d, f, _, He.green); + break; + case Ze.LOG_LEVEL_WARN: + y = l(d, f, _, He.yellow); + break; + case Ze.LOG_LEVEL_ERROR: + y = l(d, f, _, He.red); + break; + default: + y = l(Ze.LOG_LEVEL_INFO, f, _, He.green); + break; + } + return y.join(" "); + } + }); + } + /** + * 设置输出栈的深度,默认1 + * + * @param stackSize - 栈的深度 + */ + setStackSize(t) { + this.stackSize = t ?? 1; + } + /** + * 获取调用堆栈,若未获取到直接返回空数组 + * + * @author terwer + * @since 1.6.0 + */ + getCallStack() { + let t; + try { + t = ju(); + } catch { + t = []; + } + return t; + } +} +class Fu { + /** + * 默认日志级别 + * + * @param level - 可选,未设置默认INFO + * @param sign - 可选前缀,默认zhi + * @param env - 可选环境变量实例 + */ + constructor(t, r, a) { + Ut(this, "logger"), this.logger = new Vu(t, r, a); + } + /** + * 获取日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + * @protected + */ + getLogger(t, r) { + return this.logger.setStackSize(r), this.logger.getLogger(t); + } +} +class Kn extends Fu { + constructor(t, r, a) { + super(t, r, a); + } + /** + * 获取默认的日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + */ + getLogger(t, r) { + return super.getLogger(t, r); + } +} +class an { + /** + * 默认日志记录器 + * + * @param stackSize - 栈的深度 + * @param env - 环境变量实例 + */ + static defaultLogger(t, r) { + return an.customLogFactory(void 0, void 0, t).getLogger(void 0, r); + } + /** + * 自定义日志工厂 + * + * @param level - 级别 + * @param sign - 标志 + * @param env - 环境变量 + */ + static customLogFactory(t, r, a) { + return new Kn(t, r, a); + } + /** + * 自定义日志工厂,自定义前缀 + * + * @param sign - 标志 + * @param env - 环境变量 + */ + static customSignLogFactory(t, r) { + return new Kn(void 0, t, r); + } +} +const qu = "zhi"; +class Dr { + /** + * 某些情况下,可能需要手动 init 之后才能用 + */ + static initEnv(t) { + this.env = t; + } + /** + * 获取 zhi-env 实例 - 必须在使用的时候重写此方法 + * + * ``` + * if (!this.env) { + * this.env = new Env({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":false}) + * } + * return this.env + * ``` + * + * @see {@link https://github.com/terwer/zhi/tree/main/apps/zhi-env#usage docs for zhi-env usage} + */ + static zhiEnv() { + throw new Error("Method 'zhiEnv' must be implemented"); + } + /** + * 获取 zhi-log 实例 + * + * @param sign - 标志 + * @param loggerName - 日志名称 + */ + static zhiLogWithSign(t, r) { + if (this.loggerMap[r]) + return this.loggerMap[r].debug("Zhi-log use cache"), this.loggerMap[r]; + const a = this.env, s = an.customSignLogFactory(t, a).getLogger(r); + return this.loggerMap[r] = s, s.debug("Zhi-log add new logger"), s; + } + /** + * 获取 zhi-log 实例 + * + * @param loggerName - 日志名称 + */ + static zhiLog(t) { + return this.zhiLogWithSign(qu, t); + } + /** + * 获取 zhi-common 实例 + */ + static zhiCommon() { + return this.common || (this.common = new Wu()), this.common; + } +} +Te(Dr, "env"), /** +* zhi-util 的日志器缓存 +*/ +Te(Dr, "loggerMap", {}), /** +* zhi-util 的通用工具类 +*/ +Te(Dr, "common"); +class nn extends Dr { + static zhiEnv() { + return this.env || (this.env = new Tu({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; + } +} +class Wn { + constructor() { + Te(this, "logger"), this.logger = nn.zhiLog("lute-adaptor"), Lute ? this.logger.debug("Detected Lute is bundled, will use!") : this.logger.debug("Lute is not available!"); + } + isAvailable() { + return typeof Lute < "u"; + } + /** + * 高亮关键字 + * + * @param str - 字符串 + * @private + */ + highlightWords(t) { + const r = new RegExp("(?<=^|[\\s\\S])==([^\\n]+?)==(?=($|[\\s\\S]))", "g"); + return t.replace(r, '$1'); + } + /** + * 渲染Markdown + * + * @param md - Markdown + */ + async renderMarkdownStr(t) { + if (!this.isAvailable()) + return this.logger.error("Lute is not available, will return original md"), t; + const r = Lute, a = r.New(), s = { + renderText: (l, d) => d ? [this.highlightWords(l.Text()), r.WalkContinue] : ["", r.WalkContinue] + // renderStrong: (node: any, entering: any) => { + // return ["", luteObj.WalkContinue] + // }, + // renderParagraph: (node: any, entering: any) => { + // return ["", luteObj.WalkContinue] + // } + }; + return a.SetJSRenderers({ + renderers: { + Md2HTML: s + } + }), this.logger.info("Lute is rendering md to HTML..."), a.MarkdownStr("", t); + } +} +var Zo = { exports: {} }; +(function(e) { + (function() { + function t(n) { + var i = { + omitExtraWLInCodeBlocks: { + defaultValue: !1, + describe: "Omit the default extra whiteline added to code blocks", + type: "boolean" + }, + noHeaderId: { + defaultValue: !1, + describe: "Turn on/off generated header id", + type: "boolean" + }, + prefixHeaderId: { + defaultValue: !1, + describe: "Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix", + type: "string" + }, + rawPrefixHeaderId: { + defaultValue: !1, + describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)', + type: "boolean" + }, + ghCompatibleHeaderId: { + defaultValue: !1, + describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)", + type: "boolean" + }, + rawHeaderId: { + defaultValue: !1, + describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`, + type: "boolean" + }, + headerLevelStart: { + defaultValue: !1, + describe: "The header blocks level start", + type: "integer" + }, + parseImgDimensions: { + defaultValue: !1, + describe: "Turn on/off image dimension parsing", + type: "boolean" + }, + simplifiedAutoLink: { + defaultValue: !1, + describe: "Turn on/off GFM autolink style", + type: "boolean" + }, + excludeTrailingPunctuationFromURLs: { + defaultValue: !1, + describe: "Excludes trailing punctuation from links generated with autoLinking", + type: "boolean" + }, + literalMidWordUnderscores: { + defaultValue: !1, + describe: "Parse midword underscores as literal underscores", + type: "boolean" + }, + literalMidWordAsterisks: { + defaultValue: !1, + describe: "Parse midword asterisks as literal asterisks", + type: "boolean" + }, + strikethrough: { + defaultValue: !1, + describe: "Turn on/off strikethrough support", + type: "boolean" + }, + tables: { + defaultValue: !1, + describe: "Turn on/off tables support", + type: "boolean" + }, + tablesHeaderId: { + defaultValue: !1, + describe: "Add an id to table headers", + type: "boolean" + }, + ghCodeBlocks: { + defaultValue: !0, + describe: "Turn on/off GFM fenced code blocks support", + type: "boolean" + }, + tasklists: { + defaultValue: !1, + describe: "Turn on/off GFM tasklist support", + type: "boolean" + }, + smoothLivePreview: { + defaultValue: !1, + describe: "Prevents weird effects in live previews due to incomplete input", + type: "boolean" + }, + smartIndentationFix: { + defaultValue: !1, + describe: "Tries to smartly fix indentation in es6 strings", + type: "boolean" + }, + disableForced4SpacesIndentedSublists: { + defaultValue: !1, + describe: "Disables the requirement of indenting nested sublists by 4 spaces", + type: "boolean" + }, + simpleLineBreaks: { + defaultValue: !1, + describe: "Parses simple line breaks as
(GFM Style)", + type: "boolean" + }, + requireSpaceBeforeHeadingText: { + defaultValue: !1, + describe: "Makes adding a space between `#` and the header text mandatory (GFM Style)", + type: "boolean" + }, + ghMentions: { + defaultValue: !1, + describe: "Enables github @mentions", + type: "boolean" + }, + ghMentionsLink: { + defaultValue: "https://github.com/{u}", + describe: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.", + type: "string" + }, + encodeEmails: { + defaultValue: !0, + describe: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities", + type: "boolean" + }, + openLinksInNewWindow: { + defaultValue: !1, + describe: "Open all links in new windows", + type: "boolean" + }, + backslashEscapesHTMLTags: { + defaultValue: !1, + describe: "Support for HTML Tag escaping. ex:
foo
", + type: "boolean" + }, + emoji: { + defaultValue: !1, + describe: "Enable emoji support. Ex: `this is a :smile: emoji`", + type: "boolean" + }, + underline: { + defaultValue: !1, + describe: "Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``", + type: "boolean" + }, + ellipsis: { + defaultValue: !0, + describe: "Replaces three dots with the ellipsis unicode character", + type: "boolean" + }, + completeHTMLDocument: { + defaultValue: !1, + describe: "Outputs a complete html document, including ``, `` and `` tags", + type: "boolean" + }, + metadata: { + defaultValue: !1, + describe: "Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).", + type: "boolean" + }, + splitAdjacentBlockquotes: { + defaultValue: !1, + describe: "Split adjacent blockquote blocks", + type: "boolean" + } + }; + if (n === !1) + return JSON.parse(JSON.stringify(i)); + var o = {}; + for (var c in i) + i.hasOwnProperty(c) && (o[c] = i[c].defaultValue); + return o; + } + function r() { + var n = t(!0), i = {}; + for (var o in n) + n.hasOwnProperty(o) && (i[o] = !0); + return i; + } + var a = {}, s = {}, l = {}, d = t(!0), b = "vanilla", _ = { + github: { + omitExtraWLInCodeBlocks: !0, + simplifiedAutoLink: !0, + excludeTrailingPunctuationFromURLs: !0, + literalMidWordUnderscores: !0, + strikethrough: !0, + tables: !0, + tablesHeaderId: !0, + ghCodeBlocks: !0, + tasklists: !0, + disableForced4SpacesIndentedSublists: !0, + simpleLineBreaks: !0, + requireSpaceBeforeHeadingText: !0, + ghCompatibleHeaderId: !0, + ghMentions: !0, + backslashEscapesHTMLTags: !0, + emoji: !0, + splitAdjacentBlockquotes: !0 + }, + original: { + noHeaderId: !0, + ghCodeBlocks: !1 + }, + ghost: { + omitExtraWLInCodeBlocks: !0, + parseImgDimensions: !0, + simplifiedAutoLink: !0, + excludeTrailingPunctuationFromURLs: !0, + literalMidWordUnderscores: !0, + strikethrough: !0, + tables: !0, + tablesHeaderId: !0, + ghCodeBlocks: !0, + tasklists: !0, + smoothLivePreview: !0, + simpleLineBreaks: !0, + requireSpaceBeforeHeadingText: !0, + ghMentions: !1, + encodeEmails: !0 + }, + vanilla: t(!0), + allOn: r() + }; + a.helper = {}, a.extensions = {}, a.setOption = function(n, i) { + return d[n] = i, this; + }, a.getOption = function(n) { + return d[n]; + }, a.getOptions = function() { + return d; + }, a.resetOptions = function() { + d = t(!0); + }, a.setFlavor = function(n) { + if (!_.hasOwnProperty(n)) + throw Error(n + " flavor was not found"); + a.resetOptions(); + var i = _[n]; + b = n; + for (var o in i) + i.hasOwnProperty(o) && (d[o] = i[o]); + }, a.getFlavor = function() { + return b; + }, a.getFlavorOptions = function(n) { + if (_.hasOwnProperty(n)) + return _[n]; + }, a.getDefaultOptions = function(n) { + return t(n); + }, a.subParser = function(n, i) { + if (a.helper.isString(n)) + if (typeof i < "u") + s[n] = i; + else { + if (s.hasOwnProperty(n)) + return s[n]; + throw Error("SubParser named " + n + " not registered!"); + } + }, a.extension = function(n, i) { + if (!a.helper.isString(n)) + throw Error("Extension 'name' must be a string"); + if (n = a.helper.stdExtName(n), a.helper.isUndefined(i)) { + if (!l.hasOwnProperty(n)) + throw Error("Extension named " + n + " is not registered!"); + return l[n]; + } else { + typeof i == "function" && (i = i()), a.helper.isArray(i) || (i = [i]); + var o = y(i, n); + if (o.valid) + l[n] = i; + else + throw Error(o.error); + } + }, a.getAllExtensions = function() { + return l; + }, a.removeExtension = function(n) { + delete l[n]; + }, a.resetExtensions = function() { + l = {}; + }; + function y(n, i) { + var o = i ? "Error in " + i + " extension->" : "Error in unnamed extension", c = { + valid: !0, + error: "" + }; + a.helper.isArray(n) || (n = [n]); + for (var u = 0; u < n.length; ++u) { + var m = o + " sub-extension " + u + ": ", g = n[u]; + if (typeof g != "object") + return c.valid = !1, c.error = m + "must be an object, but " + typeof g + " given", c; + if (!a.helper.isString(g.type)) + return c.valid = !1, c.error = m + 'property "type" must be a string, but ' + typeof g.type + " given", c; + var O = g.type = g.type.toLowerCase(); + if (O === "language" && (O = g.type = "lang"), O === "html" && (O = g.type = "output"), O !== "lang" && O !== "output" && O !== "listener") + return c.valid = !1, c.error = m + "type " + O + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', c; + if (O === "listener") { + if (a.helper.isUndefined(g.listeners)) + return c.valid = !1, c.error = m + '. Extensions of type "listener" must have a property called "listeners"', c; + } else if (a.helper.isUndefined(g.filter) && a.helper.isUndefined(g.regex)) + return c.valid = !1, c.error = m + O + ' extensions must define either a "regex" property or a "filter" method', c; + if (g.listeners) { + if (typeof g.listeners != "object") + return c.valid = !1, c.error = m + '"listeners" property must be an object but ' + typeof g.listeners + " given", c; + for (var z in g.listeners) + if (g.listeners.hasOwnProperty(z) && typeof g.listeners[z] != "function") + return c.valid = !1, c.error = m + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + z + " must be a function but " + typeof g.listeners[z] + " given", c; + } + if (g.filter) { + if (typeof g.filter != "function") + return c.valid = !1, c.error = m + '"filter" must be a function, but ' + typeof g.filter + " given", c; + } else if (g.regex) { + if (a.helper.isString(g.regex) && (g.regex = new RegExp(g.regex, "g")), !(g.regex instanceof RegExp)) + return c.valid = !1, c.error = m + '"regex" property must either be a string or a RegExp object, but ' + typeof g.regex + " given", c; + if (a.helper.isUndefined(g.replace)) + return c.valid = !1, c.error = m + '"regex" extensions must implement a replace string or function', c; + } + } + return c; + } + a.validateExtension = function(n) { + var i = y(n, null); + return i.valid ? !0 : (console.warn(i.error), !1); + }, a.hasOwnProperty("helper") || (a.helper = {}), a.helper.isString = function(n) { + return typeof n == "string" || n instanceof String; + }, a.helper.isFunction = function(n) { + var i = {}; + return n && i.toString.call(n) === "[object Function]"; + }, a.helper.isArray = function(n) { + return Array.isArray(n); + }, a.helper.isUndefined = function(n) { + return typeof n > "u"; + }, a.helper.forEach = function(n, i) { + if (a.helper.isUndefined(n)) + throw new Error("obj param is required"); + if (a.helper.isUndefined(i)) + throw new Error("callback param is required"); + if (!a.helper.isFunction(i)) + throw new Error("callback param must be a function/closure"); + if (typeof n.forEach == "function") + n.forEach(i); + else if (a.helper.isArray(n)) + for (var o = 0; o < n.length; o++) + i(n[o], o, n); + else if (typeof n == "object") + for (var c in n) + n.hasOwnProperty(c) && i(n[c], c, n); + else + throw new Error("obj does not seem to be an array or an iterable object"); + }, a.helper.stdExtName = function(n) { + return n.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); + }; + function f(n, i) { + var o = i.charCodeAt(0); + return "¨E" + o + "E"; + } + a.helper.escapeCharactersCallback = f, a.helper.escapeCharacters = function(n, i, o) { + var c = "([" + i.replace(/([\[\]\\])/g, "\\$1") + "])"; + o && (c = "\\\\" + c); + var u = new RegExp(c, "g"); + return n = n.replace(u, f), n; + }, a.helper.unescapeHTMLEntities = function(n) { + return n.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); + }; + var E = function(n, i, o, c) { + var u = c || "", m = u.indexOf("g") > -1, g = new RegExp(i + "|" + o, "g" + u.replace(/g/g, "")), O = new RegExp(i, u.replace(/g/g, "")), z = [], q, B, G, w, U; + do + for (q = 0; G = g.exec(n); ) + if (O.test(G[0])) + q++ || (B = g.lastIndex, w = B - G[0].length); + else if (q && !--q) { + U = G.index + G[0].length; + var W = { + left: { start: w, end: B }, + match: { start: B, end: G.index }, + right: { start: G.index, end: U }, + wholeMatch: { start: w, end: U } + }; + if (z.push(W), !m) + return z; + } + while (q && (g.lastIndex = B)); + return z; + }; + a.helper.matchRecursiveRegExp = function(n, i, o, c) { + for (var u = E(n, i, o, c), m = [], g = 0; g < u.length; ++g) + m.push([ + n.slice(u[g].wholeMatch.start, u[g].wholeMatch.end), + n.slice(u[g].match.start, u[g].match.end), + n.slice(u[g].left.start, u[g].left.end), + n.slice(u[g].right.start, u[g].right.end) + ]); + return m; + }, a.helper.replaceRecursiveRegExp = function(n, i, o, c, u) { + if (!a.helper.isFunction(i)) { + var m = i; + i = function() { + return m; + }; + } + var g = E(n, o, c, u), O = n, z = g.length; + if (z > 0) { + var q = []; + g[0].wholeMatch.start !== 0 && q.push(n.slice(0, g[0].wholeMatch.start)); + for (var B = 0; B < z; ++B) + q.push( + i( + n.slice(g[B].wholeMatch.start, g[B].wholeMatch.end), + n.slice(g[B].match.start, g[B].match.end), + n.slice(g[B].left.start, g[B].left.end), + n.slice(g[B].right.start, g[B].right.end) + ) + ), B < z - 1 && q.push(n.slice(g[B].wholeMatch.end, g[B + 1].wholeMatch.start)); + g[z - 1].wholeMatch.end < n.length && q.push(n.slice(g[z - 1].wholeMatch.end)), O = q.join(""); + } + return O; + }, a.helper.regexIndexOf = function(n, i, o) { + if (!a.helper.isString(n)) + throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; + if (!(i instanceof RegExp)) + throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp"; + var c = n.substring(o || 0).search(i); + return c >= 0 ? c + (o || 0) : c; + }, a.helper.splitAtIndex = function(n, i) { + if (!a.helper.isString(n)) + throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; + return [n.substring(0, i), n.substring(i)]; + }, a.helper.encodeEmailAddress = function(n) { + var i = [ + function(o) { + return "&#" + o.charCodeAt(0) + ";"; + }, + function(o) { + return "&#x" + o.charCodeAt(0).toString(16) + ";"; + }, + function(o) { + return o; + } + ]; + return n = n.replace(/./g, function(o) { + if (o === "@") + o = i[Math.floor(Math.random() * 2)](o); + else { + var c = Math.random(); + o = c > 0.9 ? i[2](o) : c > 0.45 ? i[1](o) : i[0](o); + } + return o; + }), n; + }, a.helper.padEnd = function(n, i, o) { + return i = i >> 0, o = String(o || " "), n.length > i ? String(n) : (i = i - n.length, i > o.length && (o += o.repeat(i / o.length)), String(n) + o.slice(0, i)); + }, typeof console > "u" && (console = { + warn: function(n) { + alert(n); + }, + log: function(n) { + alert(n); + }, + error: function(n) { + throw n; + } + }), a.helper.regexes = { + asteriskDashAndColon: /([*_:~])/g + }, a.helper.emojis = { + "+1": "👍", + "-1": "👎", + 100: "💯", + 1234: "🔢", + "1st_place_medal": "🥇", + "2nd_place_medal": "🥈", + "3rd_place_medal": "🥉", + "8ball": "🎱", + a: "🅰️", + ab: "🆎", + abc: "🔤", + abcd: "🔡", + accept: "🉑", + aerial_tramway: "🚡", + airplane: "✈️", + alarm_clock: "⏰", + alembic: "⚗️", + alien: "👽", + ambulance: "🚑", + amphora: "🏺", + anchor: "⚓️", + angel: "👼", + anger: "💢", + angry: "😠", + anguished: "😧", + ant: "🐜", + apple: "🍎", + aquarius: "♒️", + aries: "♈️", + arrow_backward: "◀️", + arrow_double_down: "⏬", + arrow_double_up: "⏫", + arrow_down: "⬇️", + arrow_down_small: "🔽", + arrow_forward: "▶️", + arrow_heading_down: "⤵️", + arrow_heading_up: "⤴️", + arrow_left: "⬅️", + arrow_lower_left: "↙️", + arrow_lower_right: "↘️", + arrow_right: "➡️", + arrow_right_hook: "↪️", + arrow_up: "⬆️", + arrow_up_down: "↕️", + arrow_up_small: "🔼", + arrow_upper_left: "↖️", + arrow_upper_right: "↗️", + arrows_clockwise: "🔃", + arrows_counterclockwise: "🔄", + art: "🎨", + articulated_lorry: "🚛", + artificial_satellite: "🛰", + astonished: "😲", + athletic_shoe: "👟", + atm: "🏧", + atom_symbol: "⚛️", + avocado: "🥑", + b: "🅱️", + baby: "👶", + baby_bottle: "🍼", + baby_chick: "🐤", + baby_symbol: "🚼", + back: "🔙", + bacon: "🥓", + badminton: "🏸", + baggage_claim: "🛄", + baguette_bread: "🥖", + balance_scale: "⚖️", + balloon: "🎈", + ballot_box: "🗳", + ballot_box_with_check: "☑️", + bamboo: "🎍", + banana: "🍌", + bangbang: "‼️", + bank: "🏦", + bar_chart: "📊", + barber: "💈", + baseball: "⚾️", + basketball: "🏀", + basketball_man: "⛹️", + basketball_woman: "⛹️‍♀️", + bat: "🦇", + bath: "🛀", + bathtub: "🛁", + battery: "🔋", + beach_umbrella: "🏖", + bear: "🐻", + bed: "🛏", + bee: "🐝", + beer: "🍺", + beers: "🍻", + beetle: "🐞", + beginner: "🔰", + bell: "🔔", + bellhop_bell: "🛎", + bento: "🍱", + biking_man: "🚴", + bike: "🚲", + biking_woman: "🚴‍♀️", + bikini: "👙", + biohazard: "☣️", + bird: "🐦", + birthday: "🎂", + black_circle: "⚫️", + black_flag: "🏴", + black_heart: "🖤", + black_joker: "🃏", + black_large_square: "⬛️", + black_medium_small_square: "◾️", + black_medium_square: "◼️", + black_nib: "✒️", + black_small_square: "▪️", + black_square_button: "🔲", + blonde_man: "👱", + blonde_woman: "👱‍♀️", + blossom: "🌼", + blowfish: "🐡", + blue_book: "📘", + blue_car: "🚙", + blue_heart: "💙", + blush: "😊", + boar: "🐗", + boat: "⛵️", + bomb: "💣", + book: "📖", + bookmark: "🔖", + bookmark_tabs: "📑", + books: "📚", + boom: "💥", + boot: "👢", + bouquet: "💐", + bowing_man: "🙇", + bow_and_arrow: "🏹", + bowing_woman: "🙇‍♀️", + bowling: "🎳", + boxing_glove: "🥊", + boy: "👦", + bread: "🍞", + bride_with_veil: "👰", + bridge_at_night: "🌉", + briefcase: "💼", + broken_heart: "💔", + bug: "🐛", + building_construction: "🏗", + bulb: "💡", + bullettrain_front: "🚅", + bullettrain_side: "🚄", + burrito: "🌯", + bus: "🚌", + business_suit_levitating: "🕴", + busstop: "🚏", + bust_in_silhouette: "👤", + busts_in_silhouette: "👥", + butterfly: "🦋", + cactus: "🌵", + cake: "🍰", + calendar: "📆", + call_me_hand: "🤙", + calling: "📲", + camel: "🐫", + camera: "📷", + camera_flash: "📸", + camping: "🏕", + cancer: "♋️", + candle: "🕯", + candy: "🍬", + canoe: "🛶", + capital_abcd: "🔠", + capricorn: "♑️", + car: "🚗", + card_file_box: "🗃", + card_index: "📇", + card_index_dividers: "🗂", + carousel_horse: "🎠", + carrot: "🥕", + cat: "🐱", + cat2: "🐈", + cd: "💿", + chains: "⛓", + champagne: "🍾", + chart: "💹", + chart_with_downwards_trend: "📉", + chart_with_upwards_trend: "📈", + checkered_flag: "🏁", + cheese: "🧀", + cherries: "🍒", + cherry_blossom: "🌸", + chestnut: "🌰", + chicken: "🐔", + children_crossing: "🚸", + chipmunk: "🐿", + chocolate_bar: "🍫", + christmas_tree: "🎄", + church: "⛪️", + cinema: "🎦", + circus_tent: "🎪", + city_sunrise: "🌇", + city_sunset: "🌆", + cityscape: "🏙", + cl: "🆑", + clamp: "🗜", + clap: "👏", + clapper: "🎬", + classical_building: "🏛", + clinking_glasses: "🥂", + clipboard: "📋", + clock1: "🕐", + clock10: "🕙", + clock1030: "🕥", + clock11: "🕚", + clock1130: "🕦", + clock12: "🕛", + clock1230: "🕧", + clock130: "🕜", + clock2: "🕑", + clock230: "🕝", + clock3: "🕒", + clock330: "🕞", + clock4: "🕓", + clock430: "🕟", + clock5: "🕔", + clock530: "🕠", + clock6: "🕕", + clock630: "🕡", + clock7: "🕖", + clock730: "🕢", + clock8: "🕗", + clock830: "🕣", + clock9: "🕘", + clock930: "🕤", + closed_book: "📕", + closed_lock_with_key: "🔐", + closed_umbrella: "🌂", + cloud: "☁️", + cloud_with_lightning: "🌩", + cloud_with_lightning_and_rain: "⛈", + cloud_with_rain: "🌧", + cloud_with_snow: "🌨", + clown_face: "🤡", + clubs: "♣️", + cocktail: "🍸", + coffee: "☕️", + coffin: "⚰️", + cold_sweat: "😰", + comet: "☄️", + computer: "💻", + computer_mouse: "🖱", + confetti_ball: "🎊", + confounded: "😖", + confused: "😕", + congratulations: "㊗️", + construction: "🚧", + construction_worker_man: "👷", + construction_worker_woman: "👷‍♀️", + control_knobs: "🎛", + convenience_store: "🏪", + cookie: "🍪", + cool: "🆒", + policeman: "👮", + copyright: "©️", + corn: "🌽", + couch_and_lamp: "🛋", + couple: "👫", + couple_with_heart_woman_man: "💑", + couple_with_heart_man_man: "👨‍❤️‍👨", + couple_with_heart_woman_woman: "👩‍❤️‍👩", + couplekiss_man_man: "👨‍❤️‍💋‍👨", + couplekiss_man_woman: "💏", + couplekiss_woman_woman: "👩‍❤️‍💋‍👩", + cow: "🐮", + cow2: "🐄", + cowboy_hat_face: "🤠", + crab: "🦀", + crayon: "🖍", + credit_card: "💳", + crescent_moon: "🌙", + cricket: "🏏", + crocodile: "🐊", + croissant: "🥐", + crossed_fingers: "🤞", + crossed_flags: "🎌", + crossed_swords: "⚔️", + crown: "👑", + cry: "😢", + crying_cat_face: "😿", + crystal_ball: "🔮", + cucumber: "🥒", + cupid: "💘", + curly_loop: "➰", + currency_exchange: "💱", + curry: "🍛", + custard: "🍮", + customs: "🛃", + cyclone: "🌀", + dagger: "🗡", + dancer: "💃", + dancing_women: "👯", + dancing_men: "👯‍♂️", + dango: "🍡", + dark_sunglasses: "🕶", + dart: "🎯", + dash: "💨", + date: "📅", + deciduous_tree: "🌳", + deer: "🦌", + department_store: "🏬", + derelict_house: "🏚", + desert: "🏜", + desert_island: "🏝", + desktop_computer: "🖥", + male_detective: "🕵️", + diamond_shape_with_a_dot_inside: "💠", + diamonds: "♦️", + disappointed: "😞", + disappointed_relieved: "😥", + dizzy: "💫", + dizzy_face: "😵", + do_not_litter: "🚯", + dog: "🐶", + dog2: "🐕", + dollar: "💵", + dolls: "🎎", + dolphin: "🐬", + door: "🚪", + doughnut: "🍩", + dove: "🕊", + dragon: "🐉", + dragon_face: "🐲", + dress: "👗", + dromedary_camel: "🐪", + drooling_face: "🤤", + droplet: "💧", + drum: "🥁", + duck: "🦆", + dvd: "📀", + "e-mail": "📧", + eagle: "🦅", + ear: "👂", + ear_of_rice: "🌾", + earth_africa: "🌍", + earth_americas: "🌎", + earth_asia: "🌏", + egg: "🥚", + eggplant: "🍆", + eight_pointed_black_star: "✴️", + eight_spoked_asterisk: "✳️", + electric_plug: "🔌", + elephant: "🐘", + email: "✉️", + end: "🔚", + envelope_with_arrow: "📩", + euro: "💶", + european_castle: "🏰", + european_post_office: "🏤", + evergreen_tree: "🌲", + exclamation: "❗️", + expressionless: "😑", + eye: "👁", + eye_speech_bubble: "👁‍🗨", + eyeglasses: "👓", + eyes: "👀", + face_with_head_bandage: "🤕", + face_with_thermometer: "🤒", + fist_oncoming: "👊", + factory: "🏭", + fallen_leaf: "🍂", + family_man_woman_boy: "👪", + family_man_boy: "👨‍👦", + family_man_boy_boy: "👨‍👦‍👦", + family_man_girl: "👨‍👧", + family_man_girl_boy: "👨‍👧‍👦", + family_man_girl_girl: "👨‍👧‍👧", + family_man_man_boy: "👨‍👨‍👦", + family_man_man_boy_boy: "👨‍👨‍👦‍👦", + family_man_man_girl: "👨‍👨‍👧", + family_man_man_girl_boy: "👨‍👨‍👧‍👦", + family_man_man_girl_girl: "👨‍👨‍👧‍👧", + family_man_woman_boy_boy: "👨‍👩‍👦‍👦", + family_man_woman_girl: "👨‍👩‍👧", + family_man_woman_girl_boy: "👨‍👩‍👧‍👦", + family_man_woman_girl_girl: "👨‍👩‍👧‍👧", + family_woman_boy: "👩‍👦", + family_woman_boy_boy: "👩‍👦‍👦", + family_woman_girl: "👩‍👧", + family_woman_girl_boy: "👩‍👧‍👦", + family_woman_girl_girl: "👩‍👧‍👧", + family_woman_woman_boy: "👩‍👩‍👦", + family_woman_woman_boy_boy: "👩‍👩‍👦‍👦", + family_woman_woman_girl: "👩‍👩‍👧", + family_woman_woman_girl_boy: "👩‍👩‍👧‍👦", + family_woman_woman_girl_girl: "👩‍👩‍👧‍👧", + fast_forward: "⏩", + fax: "📠", + fearful: "😨", + feet: "🐾", + female_detective: "🕵️‍♀️", + ferris_wheel: "🎡", + ferry: "⛴", + field_hockey: "🏑", + file_cabinet: "🗄", + file_folder: "📁", + film_projector: "📽", + film_strip: "🎞", + fire: "🔥", + fire_engine: "🚒", + fireworks: "🎆", + first_quarter_moon: "🌓", + first_quarter_moon_with_face: "🌛", + fish: "🐟", + fish_cake: "🍥", + fishing_pole_and_fish: "🎣", + fist_raised: "✊", + fist_left: "🤛", + fist_right: "🤜", + flags: "🎏", + flashlight: "🔦", + fleur_de_lis: "⚜️", + flight_arrival: "🛬", + flight_departure: "🛫", + floppy_disk: "💾", + flower_playing_cards: "🎴", + flushed: "😳", + fog: "🌫", + foggy: "🌁", + football: "🏈", + footprints: "👣", + fork_and_knife: "🍴", + fountain: "⛲️", + fountain_pen: "🖋", + four_leaf_clover: "🍀", + fox_face: "🦊", + framed_picture: "🖼", + free: "🆓", + fried_egg: "🍳", + fried_shrimp: "🍤", + fries: "🍟", + frog: "🐸", + frowning: "😦", + frowning_face: "☹️", + frowning_man: "🙍‍♂️", + frowning_woman: "🙍", + middle_finger: "🖕", + fuelpump: "⛽️", + full_moon: "🌕", + full_moon_with_face: "🌝", + funeral_urn: "⚱️", + game_die: "🎲", + gear: "⚙️", + gem: "💎", + gemini: "♊️", + ghost: "👻", + gift: "🎁", + gift_heart: "💝", + girl: "👧", + globe_with_meridians: "🌐", + goal_net: "🥅", + goat: "🐐", + golf: "⛳️", + golfing_man: "🏌️", + golfing_woman: "🏌️‍♀️", + gorilla: "🦍", + grapes: "🍇", + green_apple: "🍏", + green_book: "📗", + green_heart: "💚", + green_salad: "🥗", + grey_exclamation: "❕", + grey_question: "❔", + grimacing: "😬", + grin: "😁", + grinning: "😀", + guardsman: "💂", + guardswoman: "💂‍♀️", + guitar: "🎸", + gun: "🔫", + haircut_woman: "💇", + haircut_man: "💇‍♂️", + hamburger: "🍔", + hammer: "🔨", + hammer_and_pick: "⚒", + hammer_and_wrench: "🛠", + hamster: "🐹", + hand: "✋", + handbag: "👜", + handshake: "🤝", + hankey: "💩", + hatched_chick: "🐥", + hatching_chick: "🐣", + headphones: "🎧", + hear_no_evil: "🙉", + heart: "❤️", + heart_decoration: "💟", + heart_eyes: "😍", + heart_eyes_cat: "😻", + heartbeat: "💓", + heartpulse: "💗", + hearts: "♥️", + heavy_check_mark: "✔️", + heavy_division_sign: "➗", + heavy_dollar_sign: "💲", + heavy_heart_exclamation: "❣️", + heavy_minus_sign: "➖", + heavy_multiplication_x: "✖️", + heavy_plus_sign: "➕", + helicopter: "🚁", + herb: "🌿", + hibiscus: "🌺", + high_brightness: "🔆", + high_heel: "👠", + hocho: "🔪", + hole: "🕳", + honey_pot: "🍯", + horse: "🐴", + horse_racing: "🏇", + hospital: "🏥", + hot_pepper: "🌶", + hotdog: "🌭", + hotel: "🏨", + hotsprings: "♨️", + hourglass: "⌛️", + hourglass_flowing_sand: "⏳", + house: "🏠", + house_with_garden: "🏡", + houses: "🏘", + hugs: "🤗", + hushed: "😯", + ice_cream: "🍨", + ice_hockey: "🏒", + ice_skate: "⛸", + icecream: "🍦", + id: "🆔", + ideograph_advantage: "🉐", + imp: "👿", + inbox_tray: "📥", + incoming_envelope: "📨", + tipping_hand_woman: "💁", + information_source: "ℹ️", + innocent: "😇", + interrobang: "⁉️", + iphone: "📱", + izakaya_lantern: "🏮", + jack_o_lantern: "🎃", + japan: "🗾", + japanese_castle: "🏯", + japanese_goblin: "👺", + japanese_ogre: "👹", + jeans: "👖", + joy: "😂", + joy_cat: "😹", + joystick: "🕹", + kaaba: "🕋", + key: "🔑", + keyboard: "⌨️", + keycap_ten: "🔟", + kick_scooter: "🛴", + kimono: "👘", + kiss: "💋", + kissing: "😗", + kissing_cat: "😽", + kissing_closed_eyes: "😚", + kissing_heart: "😘", + kissing_smiling_eyes: "😙", + kiwi_fruit: "🥝", + koala: "🐨", + koko: "🈁", + label: "🏷", + large_blue_circle: "🔵", + large_blue_diamond: "🔷", + large_orange_diamond: "🔶", + last_quarter_moon: "🌗", + last_quarter_moon_with_face: "🌜", + latin_cross: "✝️", + laughing: "😆", + leaves: "🍃", + ledger: "📒", + left_luggage: "🛅", + left_right_arrow: "↔️", + leftwards_arrow_with_hook: "↩️", + lemon: "🍋", + leo: "♌️", + leopard: "🐆", + level_slider: "🎚", + libra: "♎️", + light_rail: "🚈", + link: "🔗", + lion: "🦁", + lips: "👄", + lipstick: "💄", + lizard: "🦎", + lock: "🔒", + lock_with_ink_pen: "🔏", + lollipop: "🍭", + loop: "➿", + loud_sound: "🔊", + loudspeaker: "📢", + love_hotel: "🏩", + love_letter: "💌", + low_brightness: "🔅", + lying_face: "🤥", + m: "Ⓜ️", + mag: "🔍", + mag_right: "🔎", + mahjong: "🀄️", + mailbox: "📫", + mailbox_closed: "📪", + mailbox_with_mail: "📬", + mailbox_with_no_mail: "📭", + man: "👨", + man_artist: "👨‍🎨", + man_astronaut: "👨‍🚀", + man_cartwheeling: "🤸‍♂️", + man_cook: "👨‍🍳", + man_dancing: "🕺", + man_facepalming: "🤦‍♂️", + man_factory_worker: "👨‍🏭", + man_farmer: "👨‍🌾", + man_firefighter: "👨‍🚒", + man_health_worker: "👨‍⚕️", + man_in_tuxedo: "🤵", + man_judge: "👨‍⚖️", + man_juggling: "🤹‍♂️", + man_mechanic: "👨‍🔧", + man_office_worker: "👨‍💼", + man_pilot: "👨‍✈️", + man_playing_handball: "🤾‍♂️", + man_playing_water_polo: "🤽‍♂️", + man_scientist: "👨‍🔬", + man_shrugging: "🤷‍♂️", + man_singer: "👨‍🎤", + man_student: "👨‍🎓", + man_teacher: "👨‍🏫", + man_technologist: "👨‍💻", + man_with_gua_pi_mao: "👲", + man_with_turban: "👳", + tangerine: "🍊", + mans_shoe: "👞", + mantelpiece_clock: "🕰", + maple_leaf: "🍁", + martial_arts_uniform: "🥋", + mask: "😷", + massage_woman: "💆", + massage_man: "💆‍♂️", + meat_on_bone: "🍖", + medal_military: "🎖", + medal_sports: "🏅", + mega: "📣", + melon: "🍈", + memo: "📝", + men_wrestling: "🤼‍♂️", + menorah: "🕎", + mens: "🚹", + metal: "🤘", + metro: "🚇", + microphone: "🎤", + microscope: "🔬", + milk_glass: "🥛", + milky_way: "🌌", + minibus: "🚐", + minidisc: "💽", + mobile_phone_off: "📴", + money_mouth_face: "🤑", + money_with_wings: "💸", + moneybag: "💰", + monkey: "🐒", + monkey_face: "🐵", + monorail: "🚝", + moon: "🌔", + mortar_board: "🎓", + mosque: "🕌", + motor_boat: "🛥", + motor_scooter: "🛵", + motorcycle: "🏍", + motorway: "🛣", + mount_fuji: "🗻", + mountain: "⛰", + mountain_biking_man: "🚵", + mountain_biking_woman: "🚵‍♀️", + mountain_cableway: "🚠", + mountain_railway: "🚞", + mountain_snow: "🏔", + mouse: "🐭", + mouse2: "🐁", + movie_camera: "🎥", + moyai: "🗿", + mrs_claus: "🤶", + muscle: "💪", + mushroom: "🍄", + musical_keyboard: "🎹", + musical_note: "🎵", + musical_score: "🎼", + mute: "🔇", + nail_care: "💅", + name_badge: "📛", + national_park: "🏞", + nauseated_face: "🤢", + necktie: "👔", + negative_squared_cross_mark: "❎", + nerd_face: "🤓", + neutral_face: "😐", + new: "🆕", + new_moon: "🌑", + new_moon_with_face: "🌚", + newspaper: "📰", + newspaper_roll: "🗞", + next_track_button: "⏭", + ng: "🆖", + no_good_man: "🙅‍♂️", + no_good_woman: "🙅", + night_with_stars: "🌃", + no_bell: "🔕", + no_bicycles: "🚳", + no_entry: "⛔️", + no_entry_sign: "🚫", + no_mobile_phones: "📵", + no_mouth: "😶", + no_pedestrians: "🚷", + no_smoking: "🚭", + "non-potable_water": "🚱", + nose: "👃", + notebook: "📓", + notebook_with_decorative_cover: "📔", + notes: "🎶", + nut_and_bolt: "🔩", + o: "⭕️", + o2: "🅾️", + ocean: "🌊", + octopus: "🐙", + oden: "🍢", + office: "🏢", + oil_drum: "🛢", + ok: "🆗", + ok_hand: "👌", + ok_man: "🙆‍♂️", + ok_woman: "🙆", + old_key: "🗝", + older_man: "👴", + older_woman: "👵", + om: "🕉", + on: "🔛", + oncoming_automobile: "🚘", + oncoming_bus: "🚍", + oncoming_police_car: "🚔", + oncoming_taxi: "🚖", + open_file_folder: "📂", + open_hands: "👐", + open_mouth: "😮", + open_umbrella: "☂️", + ophiuchus: "⛎", + orange_book: "📙", + orthodox_cross: "☦️", + outbox_tray: "📤", + owl: "🦉", + ox: "🐂", + package: "📦", + page_facing_up: "📄", + page_with_curl: "📃", + pager: "📟", + paintbrush: "🖌", + palm_tree: "🌴", + pancakes: "🥞", + panda_face: "🐼", + paperclip: "📎", + paperclips: "🖇", + parasol_on_ground: "⛱", + parking: "🅿️", + part_alternation_mark: "〽️", + partly_sunny: "⛅️", + passenger_ship: "🛳", + passport_control: "🛂", + pause_button: "⏸", + peace_symbol: "☮️", + peach: "🍑", + peanuts: "🥜", + pear: "🍐", + pen: "🖊", + pencil2: "✏️", + penguin: "🐧", + pensive: "😔", + performing_arts: "🎭", + persevere: "😣", + person_fencing: "🤺", + pouting_woman: "🙎", + phone: "☎️", + pick: "⛏", + pig: "🐷", + pig2: "🐖", + pig_nose: "🐽", + pill: "💊", + pineapple: "🍍", + ping_pong: "🏓", + pisces: "♓️", + pizza: "🍕", + place_of_worship: "🛐", + plate_with_cutlery: "🍽", + play_or_pause_button: "⏯", + point_down: "👇", + point_left: "👈", + point_right: "👉", + point_up: "☝️", + point_up_2: "👆", + police_car: "🚓", + policewoman: "👮‍♀️", + poodle: "🐩", + popcorn: "🍿", + post_office: "🏣", + postal_horn: "📯", + postbox: "📮", + potable_water: "🚰", + potato: "🥔", + pouch: "👝", + poultry_leg: "🍗", + pound: "💷", + rage: "😡", + pouting_cat: "😾", + pouting_man: "🙎‍♂️", + pray: "🙏", + prayer_beads: "📿", + pregnant_woman: "🤰", + previous_track_button: "⏮", + prince: "🤴", + princess: "👸", + printer: "🖨", + purple_heart: "💜", + purse: "👛", + pushpin: "📌", + put_litter_in_its_place: "🚮", + question: "❓", + rabbit: "🐰", + rabbit2: "🐇", + racehorse: "🐎", + racing_car: "🏎", + radio: "📻", + radio_button: "🔘", + radioactive: "☢️", + railway_car: "🚃", + railway_track: "🛤", + rainbow: "🌈", + rainbow_flag: "🏳️‍🌈", + raised_back_of_hand: "🤚", + raised_hand_with_fingers_splayed: "🖐", + raised_hands: "🙌", + raising_hand_woman: "🙋", + raising_hand_man: "🙋‍♂️", + ram: "🐏", + ramen: "🍜", + rat: "🐀", + record_button: "⏺", + recycle: "♻️", + red_circle: "🔴", + registered: "®️", + relaxed: "☺️", + relieved: "😌", + reminder_ribbon: "🎗", + repeat: "🔁", + repeat_one: "🔂", + rescue_worker_helmet: "⛑", + restroom: "🚻", + revolving_hearts: "💞", + rewind: "⏪", + rhinoceros: "🦏", + ribbon: "🎀", + rice: "🍚", + rice_ball: "🍙", + rice_cracker: "🍘", + rice_scene: "🎑", + right_anger_bubble: "🗯", + ring: "💍", + robot: "🤖", + rocket: "🚀", + rofl: "🤣", + roll_eyes: "🙄", + roller_coaster: "🎢", + rooster: "🐓", + rose: "🌹", + rosette: "🏵", + rotating_light: "🚨", + round_pushpin: "📍", + rowing_man: "🚣", + rowing_woman: "🚣‍♀️", + rugby_football: "🏉", + running_man: "🏃", + running_shirt_with_sash: "🎽", + running_woman: "🏃‍♀️", + sa: "🈂️", + sagittarius: "♐️", + sake: "🍶", + sandal: "👡", + santa: "🎅", + satellite: "📡", + saxophone: "🎷", + school: "🏫", + school_satchel: "🎒", + scissors: "✂️", + scorpion: "🦂", + scorpius: "♏️", + scream: "😱", + scream_cat: "🙀", + scroll: "📜", + seat: "💺", + secret: "㊙️", + see_no_evil: "🙈", + seedling: "🌱", + selfie: "🤳", + shallow_pan_of_food: "🥘", + shamrock: "☘️", + shark: "🦈", + shaved_ice: "🍧", + sheep: "🐑", + shell: "🐚", + shield: "🛡", + shinto_shrine: "⛩", + ship: "🚢", + shirt: "👕", + shopping: "🛍", + shopping_cart: "🛒", + shower: "🚿", + shrimp: "🦐", + signal_strength: "📶", + six_pointed_star: "🔯", + ski: "🎿", + skier: "⛷", + skull: "💀", + skull_and_crossbones: "☠️", + sleeping: "😴", + sleeping_bed: "🛌", + sleepy: "😪", + slightly_frowning_face: "🙁", + slightly_smiling_face: "🙂", + slot_machine: "🎰", + small_airplane: "🛩", + small_blue_diamond: "🔹", + small_orange_diamond: "🔸", + small_red_triangle: "🔺", + small_red_triangle_down: "🔻", + smile: "😄", + smile_cat: "😸", + smiley: "😃", + smiley_cat: "😺", + smiling_imp: "😈", + smirk: "😏", + smirk_cat: "😼", + smoking: "🚬", + snail: "🐌", + snake: "🐍", + sneezing_face: "🤧", + snowboarder: "🏂", + snowflake: "❄️", + snowman: "⛄️", + snowman_with_snow: "☃️", + sob: "😭", + soccer: "⚽️", + soon: "🔜", + sos: "🆘", + sound: "🔉", + space_invader: "👾", + spades: "♠️", + spaghetti: "🍝", + sparkle: "❇️", + sparkler: "🎇", + sparkles: "✨", + sparkling_heart: "💖", + speak_no_evil: "🙊", + speaker: "🔈", + speaking_head: "🗣", + speech_balloon: "💬", + speedboat: "🚤", + spider: "🕷", + spider_web: "🕸", + spiral_calendar: "🗓", + spiral_notepad: "🗒", + spoon: "🥄", + squid: "🦑", + stadium: "🏟", + star: "⭐️", + star2: "🌟", + star_and_crescent: "☪️", + star_of_david: "✡️", + stars: "🌠", + station: "🚉", + statue_of_liberty: "🗽", + steam_locomotive: "🚂", + stew: "🍲", + stop_button: "⏹", + stop_sign: "🛑", + stopwatch: "⏱", + straight_ruler: "📏", + strawberry: "🍓", + stuck_out_tongue: "😛", + stuck_out_tongue_closed_eyes: "😝", + stuck_out_tongue_winking_eye: "😜", + studio_microphone: "🎙", + stuffed_flatbread: "🥙", + sun_behind_large_cloud: "🌥", + sun_behind_rain_cloud: "🌦", + sun_behind_small_cloud: "🌤", + sun_with_face: "🌞", + sunflower: "🌻", + sunglasses: "😎", + sunny: "☀️", + sunrise: "🌅", + sunrise_over_mountains: "🌄", + surfing_man: "🏄", + surfing_woman: "🏄‍♀️", + sushi: "🍣", + suspension_railway: "🚟", + sweat: "😓", + sweat_drops: "💦", + sweat_smile: "😅", + sweet_potato: "🍠", + swimming_man: "🏊", + swimming_woman: "🏊‍♀️", + symbols: "🔣", + synagogue: "🕍", + syringe: "💉", + taco: "🌮", + tada: "🎉", + tanabata_tree: "🎋", + taurus: "♉️", + taxi: "🚕", + tea: "🍵", + telephone_receiver: "📞", + telescope: "🔭", + tennis: "🎾", + tent: "⛺️", + thermometer: "🌡", + thinking: "🤔", + thought_balloon: "💭", + ticket: "🎫", + tickets: "🎟", + tiger: "🐯", + tiger2: "🐅", + timer_clock: "⏲", + tipping_hand_man: "💁‍♂️", + tired_face: "😫", + tm: "™️", + toilet: "🚽", + tokyo_tower: "🗼", + tomato: "🍅", + tongue: "👅", + top: "🔝", + tophat: "🎩", + tornado: "🌪", + trackball: "🖲", + tractor: "🚜", + traffic_light: "🚥", + train: "🚋", + train2: "🚆", + tram: "🚊", + triangular_flag_on_post: "🚩", + triangular_ruler: "📐", + trident: "🔱", + triumph: "😤", + trolleybus: "🚎", + trophy: "🏆", + tropical_drink: "🍹", + tropical_fish: "🐠", + truck: "🚚", + trumpet: "🎺", + tulip: "🌷", + tumbler_glass: "🥃", + turkey: "🦃", + turtle: "🐢", + tv: "📺", + twisted_rightwards_arrows: "🔀", + two_hearts: "💕", + two_men_holding_hands: "👬", + two_women_holding_hands: "👭", + u5272: "🈹", + u5408: "🈴", + u55b6: "🈺", + u6307: "🈯️", + u6708: "🈷️", + u6709: "🈶", + u6e80: "🈵", + u7121: "🈚️", + u7533: "🈸", + u7981: "🈲", + u7a7a: "🈳", + umbrella: "☔️", + unamused: "😒", + underage: "🔞", + unicorn: "🦄", + unlock: "🔓", + up: "🆙", + upside_down_face: "🙃", + v: "✌️", + vertical_traffic_light: "🚦", + vhs: "📼", + vibration_mode: "📳", + video_camera: "📹", + video_game: "🎮", + violin: "🎻", + virgo: "♍️", + volcano: "🌋", + volleyball: "🏐", + vs: "🆚", + vulcan_salute: "🖖", + walking_man: "🚶", + walking_woman: "🚶‍♀️", + waning_crescent_moon: "🌘", + waning_gibbous_moon: "🌖", + warning: "⚠️", + wastebasket: "🗑", + watch: "⌚️", + water_buffalo: "🐃", + watermelon: "🍉", + wave: "👋", + wavy_dash: "〰️", + waxing_crescent_moon: "🌒", + wc: "🚾", + weary: "😩", + wedding: "💒", + weight_lifting_man: "🏋️", + weight_lifting_woman: "🏋️‍♀️", + whale: "🐳", + whale2: "🐋", + wheel_of_dharma: "☸️", + wheelchair: "♿️", + white_check_mark: "✅", + white_circle: "⚪️", + white_flag: "🏳️", + white_flower: "💮", + white_large_square: "⬜️", + white_medium_small_square: "◽️", + white_medium_square: "◻️", + white_small_square: "▫️", + white_square_button: "🔳", + wilted_flower: "🥀", + wind_chime: "🎐", + wind_face: "🌬", + wine_glass: "🍷", + wink: "😉", + wolf: "🐺", + woman: "👩", + woman_artist: "👩‍🎨", + woman_astronaut: "👩‍🚀", + woman_cartwheeling: "🤸‍♀️", + woman_cook: "👩‍🍳", + woman_facepalming: "🤦‍♀️", + woman_factory_worker: "👩‍🏭", + woman_farmer: "👩‍🌾", + woman_firefighter: "👩‍🚒", + woman_health_worker: "👩‍⚕️", + woman_judge: "👩‍⚖️", + woman_juggling: "🤹‍♀️", + woman_mechanic: "👩‍🔧", + woman_office_worker: "👩‍💼", + woman_pilot: "👩‍✈️", + woman_playing_handball: "🤾‍♀️", + woman_playing_water_polo: "🤽‍♀️", + woman_scientist: "👩‍🔬", + woman_shrugging: "🤷‍♀️", + woman_singer: "👩‍🎤", + woman_student: "👩‍🎓", + woman_teacher: "👩‍🏫", + woman_technologist: "👩‍💻", + woman_with_turban: "👳‍♀️", + womans_clothes: "👚", + womans_hat: "👒", + women_wrestling: "🤼‍♀️", + womens: "🚺", + world_map: "🗺", + worried: "😟", + wrench: "🔧", + writing_hand: "✍️", + x: "❌", + yellow_heart: "💛", + yen: "💴", + yin_yang: "☯️", + yum: "😋", + zap: "⚡️", + zipper_mouth_face: "🤐", + zzz: "💤", + /* special emojis :P */ + octocat: ':octocat:', + showdown: `S` + }, a.Converter = function(n) { + var i = {}, o = [], c = [], u = {}, m = b, g = { + parsed: {}, + raw: "", + format: "" + }; + O(); + function O() { + n = n || {}; + for (var w in d) + d.hasOwnProperty(w) && (i[w] = d[w]); + if (typeof n == "object") + for (var U in n) + n.hasOwnProperty(U) && (i[U] = n[U]); + else + throw Error("Converter expects the passed parameter to be an object, but " + typeof n + " was passed instead."); + i.extensions && a.helper.forEach(i.extensions, z); + } + function z(w, U) { + if (U = U || null, a.helper.isString(w)) + if (w = a.helper.stdExtName(w), U = w, a.extensions[w]) { + console.warn("DEPRECATION WARNING: " + w + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), q(a.extensions[w], w); + return; + } else if (!a.helper.isUndefined(l[w])) + w = l[w]; + else + throw Error('Extension "' + w + '" could not be loaded. It was either not found or is not a valid extension.'); + typeof w == "function" && (w = w()), a.helper.isArray(w) || (w = [w]); + var W = y(w, U); + if (!W.valid) + throw Error(W.error); + for (var Y = 0; Y < w.length; ++Y) { + switch (w[Y].type) { + case "lang": + o.push(w[Y]); + break; + case "output": + c.push(w[Y]); + break; + } + if (w[Y].hasOwnProperty("listeners")) + for (var V in w[Y].listeners) + w[Y].listeners.hasOwnProperty(V) && B(V, w[Y].listeners[V]); + } + } + function q(w, U) { + typeof w == "function" && (w = w(new a.Converter())), a.helper.isArray(w) || (w = [w]); + var W = y(w, U); + if (!W.valid) + throw Error(W.error); + for (var Y = 0; Y < w.length; ++Y) + switch (w[Y].type) { + case "lang": + o.push(w[Y]); + break; + case "output": + c.push(w[Y]); + break; + default: + throw Error("Extension loader error: Type unrecognized!!!"); + } + } + function B(w, U) { + if (!a.helper.isString(w)) + throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof w + " given"); + if (typeof U != "function") + throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof U + " given"); + u.hasOwnProperty(w) || (u[w] = []), u[w].push(U); + } + function G(w) { + var U = w.match(/^\s*/)[0].length, W = new RegExp("^\\s{0," + U + "}", "gm"); + return w.replace(W, ""); + } + this._dispatch = function(w, U, W, Y) { + if (u.hasOwnProperty(w)) + for (var V = 0; V < u[w].length; ++V) { + var S = u[w][V](w, U, this, W, Y); + S && typeof S < "u" && (U = S); + } + return U; + }, this.listen = function(w, U) { + return B(w, U), this; + }, this.makeHtml = function(w) { + if (!w) + return w; + var U = { + gHtmlBlocks: [], + gHtmlMdBlocks: [], + gHtmlSpans: [], + gUrls: {}, + gTitles: {}, + gDimensions: {}, + gListLevel: 0, + hashLinkCounts: {}, + langExtensions: o, + outputModifiers: c, + converter: this, + ghCodeBlocks: [], + metadata: { + parsed: {}, + raw: "", + format: "" + } + }; + return w = w.replace(/¨/g, "¨T"), w = w.replace(/\$/g, "¨D"), w = w.replace(/\r\n/g, ` +`), w = w.replace(/\r/g, ` +`), w = w.replace(/\u00A0/g, " "), i.smartIndentationFix && (w = G(w)), w = ` + +` + w + ` + +`, w = a.subParser("detab")(w, i, U), w = w.replace(/^[ \t]+$/mg, ""), a.helper.forEach(o, function(W) { + w = a.subParser("runExtension")(W, w, i, U); + }), w = a.subParser("metadata")(w, i, U), w = a.subParser("hashPreCodeTags")(w, i, U), w = a.subParser("githubCodeBlocks")(w, i, U), w = a.subParser("hashHTMLBlocks")(w, i, U), w = a.subParser("hashCodeTags")(w, i, U), w = a.subParser("stripLinkDefinitions")(w, i, U), w = a.subParser("blockGamut")(w, i, U), w = a.subParser("unhashHTMLSpans")(w, i, U), w = a.subParser("unescapeSpecialChars")(w, i, U), w = w.replace(/¨D/g, "$$"), w = w.replace(/¨T/g, "¨"), w = a.subParser("completeHTMLDocument")(w, i, U), a.helper.forEach(c, function(W) { + w = a.subParser("runExtension")(W, w, i, U); + }), g = U.metadata, w; + }, this.makeMarkdown = this.makeMd = function(w, U) { + if (w = w.replace(/\r\n/g, ` +`), w = w.replace(/\r/g, ` +`), w = w.replace(/>[ \t]+¨NBSP;<"), !U) + if (window && window.document) + U = window.document; + else + throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM"); + var W = U.createElement("div"); + W.innerHTML = w; + var Y = { + preList: h(W) + }; + L(W); + for (var V = W.childNodes, S = "", F = 0; F < V.length; F++) + S += a.subParser("makeMarkdown.node")(V[F], Y); + function L($) { + for (var I = 0; I < $.childNodes.length; ++I) { + var H = $.childNodes[I]; + H.nodeType === 3 ? !/\S/.test(H.nodeValue) && !/^[ ]+$/.test(H.nodeValue) ? ($.removeChild(H), --I) : (H.nodeValue = H.nodeValue.split(` +`).join(" "), H.nodeValue = H.nodeValue.replace(/(\s)+/g, "$1")) : H.nodeType === 1 && L(H); + } + } + function h($) { + for (var I = $.querySelectorAll("pre"), H = [], K = 0; K < I.length; ++K) + if (I[K].childElementCount === 1 && I[K].firstChild.tagName.toLowerCase() === "code") { + var te = I[K].firstChild.innerHTML.trim(), ne = I[K].firstChild.getAttribute("data-language") || ""; + if (ne === "") + for (var be = I[K].firstChild.className.split(" "), Ae = 0; Ae < be.length; ++Ae) { + var ut = be[Ae].match(/^language-(.+)$/); + if (ut !== null) { + ne = ut[1]; + break; + } + } + te = a.helper.unescapeHTMLEntities(te), H.push(te), I[K].outerHTML = ''; + } else + H.push(I[K].innerHTML), I[K].innerHTML = "", I[K].setAttribute("prenum", K.toString()); + return H; + } + return S; + }, this.setOption = function(w, U) { + i[w] = U; + }, this.getOption = function(w) { + return i[w]; + }, this.getOptions = function() { + return i; + }, this.addExtension = function(w, U) { + U = U || null, z(w, U); + }, this.useExtension = function(w) { + z(w); + }, this.setFlavor = function(w) { + if (!_.hasOwnProperty(w)) + throw Error(w + " flavor was not found"); + var U = _[w]; + m = w; + for (var W in U) + U.hasOwnProperty(W) && (i[W] = U[W]); + }, this.getFlavor = function() { + return m; + }, this.removeExtension = function(w) { + a.helper.isArray(w) || (w = [w]); + for (var U = 0; U < w.length; ++U) { + for (var W = w[U], Y = 0; Y < o.length; ++Y) + o[Y] === W && o.splice(Y, 1); + for (var V = 0; V < c.length; ++V) + c[V] === W && c.splice(V, 1); + } + }, this.getAllExtensions = function() { + return { + language: o, + output: c + }; + }, this.getMetadata = function(w) { + return w ? g.raw : g.parsed; + }, this.getMetadataFormat = function() { + return g.format; + }, this._setMetadataPair = function(w, U) { + g.parsed[w] = U; + }, this._setMetadataFormat = function(w) { + g.format = w; + }, this._setMetadataRaw = function(w) { + g.raw = w; + }; + }, a.subParser("anchors", function(n, i, o) { + n = o.converter._dispatch("anchors.before", n, i, o); + var c = function(u, m, g, O, z, q, B) { + if (a.helper.isUndefined(B) && (B = ""), g = g.toLowerCase(), u.search(/\(? ?(['"].*['"])?\)$/m) > -1) + O = ""; + else if (!O) + if (g || (g = m.toLowerCase().replace(/ ?\n/g, " ")), O = "#" + g, !a.helper.isUndefined(o.gUrls[g])) + O = o.gUrls[g], a.helper.isUndefined(o.gTitles[g]) || (B = o.gTitles[g]); + else + return u; + O = O.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var G = '", G; + }; + return n = n.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, c), n = n.replace( + /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, + c + ), n = n.replace( + /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, + c + ), n = n.replace(/\[([^\[\]]+)]()()()()()/g, c), i.ghMentions && (n = n.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(u, m, g, O, z) { + if (g === "\\") + return m + O; + if (!a.helper.isString(i.ghMentionsLink)) + throw new Error("ghMentionsLink option must be a string"); + var q = i.ghMentionsLink.replace(/\{u}/g, z), B = ""; + return i.openLinksInNewWindow && (B = ' rel="noopener noreferrer" target="¨E95Eblank"'), m + '" + O + ""; + })), n = o.converter._dispatch("anchors.after", n, i, o), n; + }); + var N = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, A = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, j = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, P = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, x = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, v = function(n) { + return function(i, o, c, u, m, g, O) { + c = c.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var z = c, q = "", B = "", G = o || "", w = O || ""; + return /^www\./i.test(c) && (c = c.replace(/^www\./i, "http://www.")), n.excludeTrailingPunctuationFromURLs && g && (q = g), n.openLinksInNewWindow && (B = ' rel="noopener noreferrer" target="¨E95Eblank"'), G + '" + z + "" + q + w; + }; + }, C = function(n, i) { + return function(o, c, u) { + var m = "mailto:"; + return c = c || "", u = a.subParser("unescapeSpecialChars")(u, n, i), n.encodeEmails ? (m = a.helper.encodeEmailAddress(m + u), u = a.helper.encodeEmailAddress(u)) : m = m + u, c + '' + u + ""; + }; + }; + a.subParser("autoLinks", function(n, i, o) { + return n = o.converter._dispatch("autoLinks.before", n, i, o), n = n.replace(j, v(i)), n = n.replace(x, C(i, o)), n = o.converter._dispatch("autoLinks.after", n, i, o), n; + }), a.subParser("simplifiedAutoLinks", function(n, i, o) { + return i.simplifiedAutoLink && (n = o.converter._dispatch("simplifiedAutoLinks.before", n, i, o), i.excludeTrailingPunctuationFromURLs ? n = n.replace(A, v(i)) : n = n.replace(N, v(i)), n = n.replace(P, C(i, o)), n = o.converter._dispatch("simplifiedAutoLinks.after", n, i, o)), n; + }), a.subParser("blockGamut", function(n, i, o) { + return n = o.converter._dispatch("blockGamut.before", n, i, o), n = a.subParser("blockQuotes")(n, i, o), n = a.subParser("headers")(n, i, o), n = a.subParser("horizontalRule")(n, i, o), n = a.subParser("lists")(n, i, o), n = a.subParser("codeBlocks")(n, i, o), n = a.subParser("tables")(n, i, o), n = a.subParser("hashHTMLBlocks")(n, i, o), n = a.subParser("paragraphs")(n, i, o), n = o.converter._dispatch("blockGamut.after", n, i, o), n; + }), a.subParser("blockQuotes", function(n, i, o) { + n = o.converter._dispatch("blockQuotes.before", n, i, o), n = n + ` + +`; + var c = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; + return i.splitAdjacentBlockquotes && (c = /^ {0,3}>[\s\S]*?(?:\n\n)/gm), n = n.replace(c, function(u) { + return u = u.replace(/^[ \t]*>[ \t]?/gm, ""), u = u.replace(/¨0/g, ""), u = u.replace(/^[ \t]+$/gm, ""), u = a.subParser("githubCodeBlocks")(u, i, o), u = a.subParser("blockGamut")(u, i, o), u = u.replace(/(^|\n)/g, "$1 "), u = u.replace(/(\s*
[^\r]+?<\/pre>)/gm, function(m, g) {
+          var O = g;
+          return O = O.replace(/^  /mg, "¨0"), O = O.replace(/¨0/g, ""), O;
+        }), a.subParser("hashBlock")(`
+` + u + ` +
`, i, o); + }), n = o.converter._dispatch("blockQuotes.after", n, i, o), n; + }), a.subParser("codeBlocks", function(n, i, o) { + n = o.converter._dispatch("codeBlocks.before", n, i, o), n += "¨0"; + var c = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; + return n = n.replace(c, function(u, m, g) { + var O = m, z = g, q = ` +`; + return O = a.subParser("outdent")(O, i, o), O = a.subParser("encodeCode")(O, i, o), O = a.subParser("detab")(O, i, o), O = O.replace(/^\n+/g, ""), O = O.replace(/\n+$/g, ""), i.omitExtraWLInCodeBlocks && (q = ""), O = "
" + O + q + "
", a.subParser("hashBlock")(O, i, o) + z; + }), n = n.replace(/¨0/, ""), n = o.converter._dispatch("codeBlocks.after", n, i, o), n; + }), a.subParser("codeSpans", function(n, i, o) { + return n = o.converter._dispatch("codeSpans.before", n, i, o), typeof n > "u" && (n = ""), n = n.replace( + /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, + function(c, u, m, g) { + var O = g; + return O = O.replace(/^([ \t]*)/g, ""), O = O.replace(/[ \t]*$/g, ""), O = a.subParser("encodeCode")(O, i, o), O = u + "" + O + "", O = a.subParser("hashHTMLSpans")(O, i, o), O; + } + ), n = o.converter._dispatch("codeSpans.after", n, i, o), n; + }), a.subParser("completeHTMLDocument", function(n, i, o) { + if (!i.completeHTMLDocument) + return n; + n = o.converter._dispatch("completeHTMLDocument.before", n, i, o); + var c = "html", u = ` +`, m = "", g = ` +`, O = "", z = ""; + typeof o.metadata.parsed.doctype < "u" && (u = " +`, c = o.metadata.parsed.doctype.toString().toLowerCase(), (c === "html" || c === "html5") && (g = '')); + for (var q in o.metadata.parsed) + if (o.metadata.parsed.hasOwnProperty(q)) + switch (q.toLowerCase()) { + case "doctype": + break; + case "title": + m = "" + o.metadata.parsed.title + ` +`; + break; + case "charset": + c === "html" || c === "html5" ? g = ' +` : g = ' +`; + break; + case "language": + case "lang": + O = ' lang="' + o.metadata.parsed[q] + '"', z += ' +`; + break; + default: + z += ' +`; + } + return n = u + " + +` + m + g + z + ` + +` + n.trim() + ` + +`, n = o.converter._dispatch("completeHTMLDocument.after", n, i, o), n; + }), a.subParser("detab", function(n, i, o) { + return n = o.converter._dispatch("detab.before", n, i, o), n = n.replace(/\t(?=\t)/g, " "), n = n.replace(/\t/g, "¨A¨B"), n = n.replace(/¨B(.+?)¨A/g, function(c, u) { + for (var m = u, g = 4 - m.length % 4, O = 0; O < g; O++) + m += " "; + return m; + }), n = n.replace(/¨A/g, " "), n = n.replace(/¨B/g, ""), n = o.converter._dispatch("detab.after", n, i, o), n; + }), a.subParser("ellipsis", function(n, i, o) { + return i.ellipsis && (n = o.converter._dispatch("ellipsis.before", n, i, o), n = n.replace(/\.\.\./g, "…"), n = o.converter._dispatch("ellipsis.after", n, i, o)), n; + }), a.subParser("emoji", function(n, i, o) { + if (!i.emoji) + return n; + n = o.converter._dispatch("emoji.before", n, i, o); + var c = /:([\S]+?):/g; + return n = n.replace(c, function(u, m) { + return a.helper.emojis.hasOwnProperty(m) ? a.helper.emojis[m] : u; + }), n = o.converter._dispatch("emoji.after", n, i, o), n; + }), a.subParser("encodeAmpsAndAngles", function(n, i, o) { + return n = o.converter._dispatch("encodeAmpsAndAngles.before", n, i, o), n = n.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), n = n.replace(/<(?![a-z\/?$!])/gi, "<"), n = n.replace(//g, ">"), n = o.converter._dispatch("encodeAmpsAndAngles.after", n, i, o), n; + }), a.subParser("encodeBackslashEscapes", function(n, i, o) { + return n = o.converter._dispatch("encodeBackslashEscapes.before", n, i, o), n = n.replace(/\\(\\)/g, a.helper.escapeCharactersCallback), n = n.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, a.helper.escapeCharactersCallback), n = o.converter._dispatch("encodeBackslashEscapes.after", n, i, o), n; + }), a.subParser("encodeCode", function(n, i, o) { + return n = o.converter._dispatch("encodeCode.before", n, i, o), n = n.replace(/&/g, "&").replace(//g, ">").replace(/([*_{}\[\]\\=~-])/g, a.helper.escapeCharactersCallback), n = o.converter._dispatch("encodeCode.after", n, i, o), n; + }), a.subParser("escapeSpecialCharsWithinTagAttributes", function(n, i, o) { + n = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", n, i, o); + var c = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, u = /-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; + return n = n.replace(c, function(m) { + return m.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), n = n.replace(u, function(m) { + return m.replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), n = o.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", n, i, o), n; + }), a.subParser("githubCodeBlocks", function(n, i, o) { + return i.ghCodeBlocks ? (n = o.converter._dispatch("githubCodeBlocks.before", n, i, o), n += "¨0", n = n.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(c, u, m, g) { + var O = i.omitExtraWLInCodeBlocks ? "" : ` +`; + return g = a.subParser("encodeCode")(g, i, o), g = a.subParser("detab")(g, i, o), g = g.replace(/^\n+/g, ""), g = g.replace(/\n+$/g, ""), g = "
" + g + O + "
", g = a.subParser("hashBlock")(g, i, o), ` + +¨G` + (o.ghCodeBlocks.push({ text: c, codeblock: g }) - 1) + `G + +`; + }), n = n.replace(/¨0/, ""), o.converter._dispatch("githubCodeBlocks.after", n, i, o)) : n; + }), a.subParser("hashBlock", function(n, i, o) { + return n = o.converter._dispatch("hashBlock.before", n, i, o), n = n.replace(/(^\n+|\n+$)/g, ""), n = ` + +¨K` + (o.gHtmlBlocks.push(n) - 1) + `K + +`, n = o.converter._dispatch("hashBlock.after", n, i, o), n; + }), a.subParser("hashCodeTags", function(n, i, o) { + n = o.converter._dispatch("hashCodeTags.before", n, i, o); + var c = function(u, m, g, O) { + var z = g + a.subParser("encodeCode")(m, i, o) + O; + return "¨C" + (o.gHtmlSpans.push(z) - 1) + "C"; + }; + return n = a.helper.replaceRecursiveRegExp(n, c, "]*>", "", "gim"), n = o.converter._dispatch("hashCodeTags.after", n, i, o), n; + }), a.subParser("hashElement", function(n, i, o) { + return function(c, u) { + var m = u; + return m = m.replace(/\n\n/g, ` +`), m = m.replace(/^\n/, ""), m = m.replace(/\n+$/g, ""), m = ` + +¨K` + (o.gHtmlBlocks.push(m) - 1) + `K + +`, m; + }; + }), a.subParser("hashHTMLBlocks", function(n, i, o) { + n = o.converter._dispatch("hashHTMLBlocks.before", n, i, o); + var c = [ + "pre", + "div", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "blockquote", + "table", + "dl", + "ol", + "ul", + "script", + "noscript", + "form", + "fieldset", + "iframe", + "math", + "style", + "section", + "header", + "footer", + "nav", + "article", + "aside", + "address", + "audio", + "canvas", + "figure", + "hgroup", + "output", + "video", + "p" + ], u = function(w, U, W, Y) { + var V = w; + return W.search(/\bmarkdown\b/) !== -1 && (V = W + o.converter.makeHtml(U) + Y), ` + +¨K` + (o.gHtmlBlocks.push(V) - 1) + `K + +`; + }; + i.backslashEscapesHTMLTags && (n = n.replace(/\\<(\/?[^>]+?)>/g, function(w, U) { + return "<" + U + ">"; + })); + for (var m = 0; m < c.length; ++m) + for (var g, O = new RegExp("^ {0,3}(<" + c[m] + "\\b[^>]*>)", "im"), z = "<" + c[m] + "\\b[^>]*>", q = ""; (g = a.helper.regexIndexOf(n, O)) !== -1; ) { + var B = a.helper.splitAtIndex(n, g), G = a.helper.replaceRecursiveRegExp(B[1], u, z, q, "im"); + if (G === B[1]) + break; + n = B[0].concat(G); + } + return n = n.replace( + /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, + a.subParser("hashElement")(n, i, o) + ), n = a.helper.replaceRecursiveRegExp(n, function(w) { + return ` + +¨K` + (o.gHtmlBlocks.push(w) - 1) + `K + +`; + }, "^ {0,3}", "gm"), n = n.replace( + /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, + a.subParser("hashElement")(n, i, o) + ), n = o.converter._dispatch("hashHTMLBlocks.after", n, i, o), n; + }), a.subParser("hashHTMLSpans", function(n, i, o) { + n = o.converter._dispatch("hashHTMLSpans.before", n, i, o); + function c(u) { + return "¨C" + (o.gHtmlSpans.push(u) - 1) + "C"; + } + return n = n.replace(/<[^>]+?\/>/gi, function(u) { + return c(u); + }), n = n.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(u) { + return c(u); + }), n = n.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(u) { + return c(u); + }), n = n.replace(/<[^>]+?>/gi, function(u) { + return c(u); + }), n = o.converter._dispatch("hashHTMLSpans.after", n, i, o), n; + }), a.subParser("unhashHTMLSpans", function(n, i, o) { + n = o.converter._dispatch("unhashHTMLSpans.before", n, i, o); + for (var c = 0; c < o.gHtmlSpans.length; ++c) { + for (var u = o.gHtmlSpans[c], m = 0; /¨C(\d+)C/.test(u); ) { + var g = RegExp.$1; + if (u = u.replace("¨C" + g + "C", o.gHtmlSpans[g]), m === 10) { + console.error("maximum nesting of 10 spans reached!!!"); + break; + } + ++m; + } + n = n.replace("¨C" + c + "C", u); + } + return n = o.converter._dispatch("unhashHTMLSpans.after", n, i, o), n; + }), a.subParser("hashPreCodeTags", function(n, i, o) { + n = o.converter._dispatch("hashPreCodeTags.before", n, i, o); + var c = function(u, m, g, O) { + var z = g + a.subParser("encodeCode")(m, i, o) + O; + return ` + +¨G` + (o.ghCodeBlocks.push({ text: u, codeblock: z }) - 1) + `G + +`; + }; + return n = a.helper.replaceRecursiveRegExp(n, c, "^ {0,3}]*>\\s*]*>", "^ {0,3}\\s*
", "gim"), n = o.converter._dispatch("hashPreCodeTags.after", n, i, o), n; + }), a.subParser("headers", function(n, i, o) { + n = o.converter._dispatch("headers.before", n, i, o); + var c = isNaN(parseInt(i.headerLevelStart)) ? 1 : parseInt(i.headerLevelStart), u = i.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, m = i.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; + n = n.replace(u, function(z, q) { + var B = a.subParser("spanGamut")(q, i, o), G = i.noHeaderId ? "" : ' id="' + O(q) + '"', w = c, U = "" + B + ""; + return a.subParser("hashBlock")(U, i, o); + }), n = n.replace(m, function(z, q) { + var B = a.subParser("spanGamut")(q, i, o), G = i.noHeaderId ? "" : ' id="' + O(q) + '"', w = c + 1, U = "" + B + ""; + return a.subParser("hashBlock")(U, i, o); + }); + var g = i.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; + n = n.replace(g, function(z, q, B) { + var G = B; + i.customizedHeaderId && (G = B.replace(/\s?\{([^{]+?)}\s*$/, "")); + var w = a.subParser("spanGamut")(G, i, o), U = i.noHeaderId ? "" : ' id="' + O(B) + '"', W = c - 1 + q.length, Y = "" + w + ""; + return a.subParser("hashBlock")(Y, i, o); + }); + function O(z) { + var q, B; + if (i.customizedHeaderId) { + var G = z.match(/\{([^{]+?)}\s*$/); + G && G[1] && (z = G[1]); + } + return q = z, a.helper.isString(i.prefixHeaderId) ? B = i.prefixHeaderId : i.prefixHeaderId === !0 ? B = "section-" : B = "", i.rawPrefixHeaderId || (q = B + q), i.ghCompatibleHeaderId ? q = q.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase() : i.rawHeaderId ? q = q.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "¨").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase() : q = q.replace(/[^\w]/g, "").toLowerCase(), i.rawPrefixHeaderId && (q = B + q), o.hashLinkCounts[q] ? q = q + "-" + o.hashLinkCounts[q]++ : o.hashLinkCounts[q] = 1, q; + } + return n = o.converter._dispatch("headers.after", n, i, o), n; + }), a.subParser("horizontalRule", function(n, i, o) { + n = o.converter._dispatch("horizontalRule.before", n, i, o); + var c = a.subParser("hashBlock")("
", i, o); + return n = n.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, c), n = n.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, c), n = n.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, c), n = o.converter._dispatch("horizontalRule.after", n, i, o), n; + }), a.subParser("images", function(n, i, o) { + n = o.converter._dispatch("images.before", n, i, o); + var c = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, u = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, m = /!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, g = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, O = /!\[([^\[\]]+)]()()()()()/g; + function z(B, G, w, U, W, Y, V, S) { + return U = U.replace(/\s/g, ""), q(B, G, w, U, W, Y, V, S); + } + function q(B, G, w, U, W, Y, V, S) { + var F = o.gUrls, L = o.gTitles, h = o.gDimensions; + if (w = w.toLowerCase(), S || (S = ""), B.search(/\(? ?(['"].*['"])?\)$/m) > -1) + U = ""; + else if (U === "" || U === null) + if ((w === "" || w === null) && (w = G.toLowerCase().replace(/ ?\n/g, " ")), U = "#" + w, !a.helper.isUndefined(F[w])) + U = F[w], a.helper.isUndefined(L[w]) || (S = L[w]), a.helper.isUndefined(h[w]) || (W = h[w].width, Y = h[w].height); + else + return B; + G = G.replace(/"/g, """).replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback), U = U.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback); + var $ = '' + G + '", "
"); + }), n = n.replace(/\b__(\S[\s\S]*?)__\b/g, function(u, m) { + return c(m, "", ""); + }), n = n.replace(/\b_(\S[\s\S]*?)_\b/g, function(u, m) { + return c(m, "", ""); + })) : (n = n.replace(/___(\S[\s\S]*?)___/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + }), n = n.replace(/__(\S[\s\S]*?)__/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + }), n = n.replace(/_([^\s_][\s\S]*?)_/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + })), i.literalMidWordAsterisks ? (n = n.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(u, m, g) { + return c(g, m + "", ""); + }), n = n.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(u, m, g) { + return c(g, m + "", ""); + }), n = n.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(u, m, g) { + return c(g, m + "", ""); + })) : (n = n.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + }), n = n.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + }), n = n.replace(/\*([^\s*][\s\S]*?)\*/g, function(u, m) { + return /\S$/.test(m) ? c(m, "", "") : u; + })), n = o.converter._dispatch("italicsAndBold.after", n, i, o), n; + }), a.subParser("lists", function(n, i, o) { + function c(g, O) { + o.gListLevel++, g = g.replace(/\n{2,}$/, ` +`), g += "¨0"; + var z = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, q = /\n[ \t]*\n(?!¨0)/.test(g); + return i.disableForced4SpacesIndentedSublists && (z = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm), g = g.replace(z, function(B, G, w, U, W, Y, V) { + V = V && V.trim() !== ""; + var S = a.subParser("outdent")(W, i, o), F = ""; + return Y && i.tasklists && (F = ' class="task-list-item" style="list-style-type: none;"', S = S.replace(/^[ \t]*\[(x|X| )?]/m, function() { + var L = ' -1 ? (S = a.subParser("githubCodeBlocks")(S, i, o), S = a.subParser("blockGamut")(S, i, o)) : (S = a.subParser("lists")(S, i, o), S = S.replace(/\n$/, ""), S = a.subParser("hashHTMLBlocks")(S, i, o), S = S.replace(/\n\n+/g, ` + +`), q ? S = a.subParser("paragraphs")(S, i, o) : S = a.subParser("spanGamut")(S, i, o)), S = S.replace("¨A", ""), S = "" + S + ` +`, S; + }), g = g.replace(/¨0/g, ""), o.gListLevel--, O && (g = g.replace(/\s+$/, "")), g; + } + function u(g, O) { + if (O === "ol") { + var z = g.match(/^ *(\d+)\./); + if (z && z[1] !== "1") + return ' start="' + z[1] + '"'; + } + return ""; + } + function m(g, O, z) { + var q = i.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, B = i.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, G = O === "ul" ? q : B, w = ""; + if (g.search(G) !== -1) + (function W(Y) { + var V = Y.search(G), S = u(g, O); + V !== -1 ? (w += ` + +<` + O + S + `> +` + c(Y.slice(0, V), !!z) + " +`, O = O === "ul" ? "ol" : "ul", G = O === "ul" ? q : B, W(Y.slice(V))) : w += ` + +<` + O + S + `> +` + c(Y, !!z) + " +`; + })(g); + else { + var U = u(g, O); + w = ` + +<` + O + U + `> +` + c(g, !!z) + " +`; + } + return w; + } + return n = o.converter._dispatch("lists.before", n, i, o), n += "¨0", o.gListLevel ? n = n.replace( + /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, + function(g, O, z) { + var q = z.search(/[*+-]/g) > -1 ? "ul" : "ol"; + return m(O, q, !0); + } + ) : n = n.replace( + /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, + function(g, O, z, q) { + var B = q.search(/[*+-]/g) > -1 ? "ul" : "ol"; + return m(z, B, !1); + } + ), n = n.replace(/¨0/, ""), n = o.converter._dispatch("lists.after", n, i, o), n; + }), a.subParser("metadata", function(n, i, o) { + if (!i.metadata) + return n; + n = o.converter._dispatch("metadata.before", n, i, o); + function c(u) { + o.metadata.raw = u, u = u.replace(/&/g, "&").replace(/"/g, """), u = u.replace(/\n {4}/g, " "), u.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(m, g, O) { + return o.metadata.parsed[g] = O, ""; + }); + } + return n = n.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(u, m, g) { + return c(g), "¨M"; + }), n = n.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(u, m, g) { + return m && (o.metadata.format = m), c(g), "¨M"; + }), n = n.replace(/¨M/g, ""), n = o.converter._dispatch("metadata.after", n, i, o), n; + }), a.subParser("outdent", function(n, i, o) { + return n = o.converter._dispatch("outdent.before", n, i, o), n = n.replace(/^(\t|[ ]{1,4})/gm, "¨0"), n = n.replace(/¨0/g, ""), n = o.converter._dispatch("outdent.after", n, i, o), n; + }), a.subParser("paragraphs", function(n, i, o) { + n = o.converter._dispatch("paragraphs.before", n, i, o), n = n.replace(/^\n+/g, ""), n = n.replace(/\n+$/g, ""); + for (var c = n.split(/\n{2,}/g), u = [], m = c.length, g = 0; g < m; g++) { + var O = c[g]; + O.search(/¨(K|G)(\d+)\1/g) >= 0 ? u.push(O) : O.search(/\S/) >= 0 && (O = a.subParser("spanGamut")(O, i, o), O = O.replace(/^([ \t]*)/g, "

"), O += "

", u.push(O)); + } + for (m = u.length, g = 0; g < m; g++) { + for (var z = "", q = u[g], B = !1; /¨(K|G)(\d+)\1/.test(q); ) { + var G = RegExp.$1, w = RegExp.$2; + G === "K" ? z = o.gHtmlBlocks[w] : B ? z = a.subParser("encodeCode")(o.ghCodeBlocks[w].text, i, o) : z = o.ghCodeBlocks[w].codeblock, z = z.replace(/\$/g, "$$$$"), q = q.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, z), /^]*>\s*]*>/.test(q) && (B = !0); + } + u[g] = q; + } + return n = u.join(` +`), n = n.replace(/^\n+/g, ""), n = n.replace(/\n+$/g, ""), o.converter._dispatch("paragraphs.after", n, i, o); + }), a.subParser("runExtension", function(n, i, o, c) { + if (n.filter) + i = n.filter(i, c.converter, o); + else if (n.regex) { + var u = n.regex; + u instanceof RegExp || (u = new RegExp(u, "g")), i = i.replace(u, n.replace); + } + return i; + }), a.subParser("spanGamut", function(n, i, o) { + return n = o.converter._dispatch("spanGamut.before", n, i, o), n = a.subParser("codeSpans")(n, i, o), n = a.subParser("escapeSpecialCharsWithinTagAttributes")(n, i, o), n = a.subParser("encodeBackslashEscapes")(n, i, o), n = a.subParser("images")(n, i, o), n = a.subParser("anchors")(n, i, o), n = a.subParser("autoLinks")(n, i, o), n = a.subParser("simplifiedAutoLinks")(n, i, o), n = a.subParser("emoji")(n, i, o), n = a.subParser("underline")(n, i, o), n = a.subParser("italicsAndBold")(n, i, o), n = a.subParser("strikethrough")(n, i, o), n = a.subParser("ellipsis")(n, i, o), n = a.subParser("hashHTMLSpans")(n, i, o), n = a.subParser("encodeAmpsAndAngles")(n, i, o), i.simpleLineBreaks ? /\n\n¨K/.test(n) || (n = n.replace(/\n+/g, `
+`)) : n = n.replace(/ +\n/g, `
+`), n = o.converter._dispatch("spanGamut.after", n, i, o), n; + }), a.subParser("strikethrough", function(n, i, o) { + function c(u) { + return i.simplifiedAutoLink && (u = a.subParser("simplifiedAutoLinks")(u, i, o)), "" + u + ""; + } + return i.strikethrough && (n = o.converter._dispatch("strikethrough.before", n, i, o), n = n.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(u, m) { + return c(m); + }), n = o.converter._dispatch("strikethrough.after", n, i, o)), n; + }), a.subParser("stripLinkDefinitions", function(n, i, o) { + var c = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm, u = /^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm; + n += "¨0"; + var m = function(g, O, z, q, B, G, w) { + return O = O.toLowerCase(), n.toLowerCase().split(O).length - 1 < 2 ? g : (z.match(/^data:.+?\/.+?;base64,/) ? o.gUrls[O] = z.replace(/\s/g, "") : o.gUrls[O] = a.subParser("encodeAmpsAndAngles")(z, i, o), G ? G + w : (w && (o.gTitles[O] = w.replace(/"|'/g, """)), i.parseImgDimensions && q && B && (o.gDimensions[O] = { + width: q, + height: B + }), "")); + }; + return n = n.replace(u, m), n = n.replace(c, m), n = n.replace(/¨0/, ""), n; + }), a.subParser("tables", function(n, i, o) { + if (!i.tables) + return n; + var c = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, u = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; + function m(B) { + return /^:[ \t]*--*$/.test(B) ? ' style="text-align:left;"' : /^--*[ \t]*:[ \t]*$/.test(B) ? ' style="text-align:right;"' : /^:[ \t]*--*[ \t]*:$/.test(B) ? ' style="text-align:center;"' : ""; + } + function g(B, G) { + var w = ""; + return B = B.trim(), (i.tablesHeaderId || i.tableHeaderId) && (w = ' id="' + B.replace(/ /g, "_").toLowerCase() + '"'), B = a.subParser("spanGamut")(B, i, o), "" + B + ` +`; + } + function O(B, G) { + var w = a.subParser("spanGamut")(B, i, o); + return "" + w + ` +`; + } + function z(B, G) { + for (var w = ` + + +`, U = B.length, W = 0; W < U; ++W) + w += B[W]; + for (w += ` + + +`, W = 0; W < G.length; ++W) { + w += ` +`; + for (var Y = 0; Y < U; ++Y) + w += G[W][Y]; + w += ` +`; + } + return w += ` +
+`, w; + } + function q(B) { + var G, w = B.split(` +`); + for (G = 0; G < w.length; ++G) + /^ {0,3}\|/.test(w[G]) && (w[G] = w[G].replace(/^ {0,3}\|/, "")), /\|[ \t]*$/.test(w[G]) && (w[G] = w[G].replace(/\|[ \t]*$/, "")), w[G] = a.subParser("codeSpans")(w[G], i, o); + var U = w[0].split("|").map(function($) { + return $.trim(); + }), W = w[1].split("|").map(function($) { + return $.trim(); + }), Y = [], V = [], S = [], F = []; + for (w.shift(), w.shift(), G = 0; G < w.length; ++G) + w[G].trim() !== "" && Y.push( + w[G].split("|").map(function($) { + return $.trim(); + }) + ); + if (U.length < W.length) + return B; + for (G = 0; G < W.length; ++G) + S.push(m(W[G])); + for (G = 0; G < U.length; ++G) + a.helper.isUndefined(S[G]) && (S[G] = ""), V.push(g(U[G], S[G])); + for (G = 0; G < Y.length; ++G) { + for (var L = [], h = 0; h < V.length; ++h) + a.helper.isUndefined(Y[G][h]), L.push(O(Y[G][h], S[h])); + F.push(L); + } + return z(V, F); + } + return n = o.converter._dispatch("tables.before", n, i, o), n = n.replace(/\\(\|)/g, a.helper.escapeCharactersCallback), n = n.replace(c, q), n = n.replace(u, q), n = o.converter._dispatch("tables.after", n, i, o), n; + }), a.subParser("underline", function(n, i, o) { + return i.underline && (n = o.converter._dispatch("underline.before", n, i, o), i.literalMidWordUnderscores ? (n = n.replace(/\b___(\S[\s\S]*?)___\b/g, function(c, u) { + return "" + u + ""; + }), n = n.replace(/\b__(\S[\s\S]*?)__\b/g, function(c, u) { + return "" + u + ""; + })) : (n = n.replace(/___(\S[\s\S]*?)___/g, function(c, u) { + return /\S$/.test(u) ? "" + u + "" : c; + }), n = n.replace(/__(\S[\s\S]*?)__/g, function(c, u) { + return /\S$/.test(u) ? "" + u + "" : c; + })), n = n.replace(/(_)/g, a.helper.escapeCharactersCallback), n = o.converter._dispatch("underline.after", n, i, o)), n; + }), a.subParser("unescapeSpecialChars", function(n, i, o) { + return n = o.converter._dispatch("unescapeSpecialChars.before", n, i, o), n = n.replace(/¨E(\d+)E/g, function(c, u) { + var m = parseInt(u); + return String.fromCharCode(m); + }), n = o.converter._dispatch("unescapeSpecialChars.after", n, i, o), n; + }), a.subParser("makeMarkdown.blockquote", function(n, i) { + var o = ""; + if (n.hasChildNodes()) + for (var c = n.childNodes, u = c.length, m = 0; m < u; ++m) { + var g = a.subParser("makeMarkdown.node")(c[m], i); + g !== "" && (o += g); + } + return o = o.trim(), o = "> " + o.split(` +`).join(` +> `), o; + }), a.subParser("makeMarkdown.codeBlock", function(n, i) { + var o = n.getAttribute("language"), c = n.getAttribute("precodenum"); + return "```" + o + ` +` + i.preList[c] + "\n```"; + }), a.subParser("makeMarkdown.codeSpan", function(n) { + return "`" + n.innerHTML + "`"; + }), a.subParser("makeMarkdown.emphasis", function(n, i) { + var o = ""; + if (n.hasChildNodes()) { + o += "*"; + for (var c = n.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], i); + o += "*"; + } + return o; + }), a.subParser("makeMarkdown.header", function(n, i, o) { + var c = new Array(o + 1).join("#"), u = ""; + if (n.hasChildNodes()) { + u = c + " "; + for (var m = n.childNodes, g = m.length, O = 0; O < g; ++O) + u += a.subParser("makeMarkdown.node")(m[O], i); + } + return u; + }), a.subParser("makeMarkdown.hr", function() { + return "---"; + }), a.subParser("makeMarkdown.image", function(n) { + var i = ""; + return n.hasAttribute("src") && (i += "![" + n.getAttribute("alt") + "](", i += "<" + n.getAttribute("src") + ">", n.hasAttribute("width") && n.hasAttribute("height") && (i += " =" + n.getAttribute("width") + "x" + n.getAttribute("height")), n.hasAttribute("title") && (i += ' "' + n.getAttribute("title") + '"'), i += ")"), i; + }), a.subParser("makeMarkdown.links", function(n, i) { + var o = ""; + if (n.hasChildNodes() && n.hasAttribute("href")) { + var c = n.childNodes, u = c.length; + o = "["; + for (var m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], i); + o += "](", o += "<" + n.getAttribute("href") + ">", n.hasAttribute("title") && (o += ' "' + n.getAttribute("title") + '"'), o += ")"; + } + return o; + }), a.subParser("makeMarkdown.list", function(n, i, o) { + var c = ""; + if (!n.hasChildNodes()) + return ""; + for (var u = n.childNodes, m = u.length, g = n.getAttribute("start") || 1, O = 0; O < m; ++O) + if (!(typeof u[O].tagName > "u" || u[O].tagName.toLowerCase() !== "li")) { + var z = ""; + o === "ol" ? z = g.toString() + ". " : z = "- ", c += z + a.subParser("makeMarkdown.listItem")(u[O], i), ++g; + } + return c += ` + +`, c.trim(); + }), a.subParser("makeMarkdown.listItem", function(n, i) { + for (var o = "", c = n.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], i); + return /\n$/.test(o) ? o = o.split(` +`).join(` + `).replace(/^ {4}$/gm, "").replace(/\n\n+/g, ` + +`) : o += ` +`, o; + }), a.subParser("makeMarkdown.node", function(n, i, o) { + o = o || !1; + var c = ""; + if (n.nodeType === 3) + return a.subParser("makeMarkdown.txt")(n, i); + if (n.nodeType === 8) + return " + +`; + if (n.nodeType !== 1) + return ""; + var u = n.tagName.toLowerCase(); + switch (u) { + case "h1": + o || (c = a.subParser("makeMarkdown.header")(n, i, 1) + ` + +`); + break; + case "h2": + o || (c = a.subParser("makeMarkdown.header")(n, i, 2) + ` + +`); + break; + case "h3": + o || (c = a.subParser("makeMarkdown.header")(n, i, 3) + ` + +`); + break; + case "h4": + o || (c = a.subParser("makeMarkdown.header")(n, i, 4) + ` + +`); + break; + case "h5": + o || (c = a.subParser("makeMarkdown.header")(n, i, 5) + ` + +`); + break; + case "h6": + o || (c = a.subParser("makeMarkdown.header")(n, i, 6) + ` + +`); + break; + case "p": + o || (c = a.subParser("makeMarkdown.paragraph")(n, i) + ` + +`); + break; + case "blockquote": + o || (c = a.subParser("makeMarkdown.blockquote")(n, i) + ` + +`); + break; + case "hr": + o || (c = a.subParser("makeMarkdown.hr")(n, i) + ` + +`); + break; + case "ol": + o || (c = a.subParser("makeMarkdown.list")(n, i, "ol") + ` + +`); + break; + case "ul": + o || (c = a.subParser("makeMarkdown.list")(n, i, "ul") + ` + +`); + break; + case "precode": + o || (c = a.subParser("makeMarkdown.codeBlock")(n, i) + ` + +`); + break; + case "pre": + o || (c = a.subParser("makeMarkdown.pre")(n, i) + ` + +`); + break; + case "table": + o || (c = a.subParser("makeMarkdown.table")(n, i) + ` + +`); + break; + case "code": + c = a.subParser("makeMarkdown.codeSpan")(n, i); + break; + case "em": + case "i": + c = a.subParser("makeMarkdown.emphasis")(n, i); + break; + case "strong": + case "b": + c = a.subParser("makeMarkdown.strong")(n, i); + break; + case "del": + c = a.subParser("makeMarkdown.strikethrough")(n, i); + break; + case "a": + c = a.subParser("makeMarkdown.links")(n, i); + break; + case "img": + c = a.subParser("makeMarkdown.image")(n, i); + break; + default: + c = n.outerHTML + ` + +`; + } + return c; + }), a.subParser("makeMarkdown.paragraph", function(n, i) { + var o = ""; + if (n.hasChildNodes()) + for (var c = n.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], i); + return o = o.trim(), o; + }), a.subParser("makeMarkdown.pre", function(n, i) { + var o = n.getAttribute("prenum"); + return "
" + i.preList[o] + "
"; + }), a.subParser("makeMarkdown.strikethrough", function(n, i) { + var o = ""; + if (n.hasChildNodes()) { + o += "~~"; + for (var c = n.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], i); + o += "~~"; + } + return o; + }), a.subParser("makeMarkdown.strong", function(n, i) { + var o = ""; + if (n.hasChildNodes()) { + o += "**"; + for (var c = n.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], i); + o += "**"; + } + return o; + }), a.subParser("makeMarkdown.table", function(n, i) { + var o = "", c = [[], []], u = n.querySelectorAll("thead>tr>th"), m = n.querySelectorAll("tbody>tr"), g, O; + for (g = 0; g < u.length; ++g) { + var z = a.subParser("makeMarkdown.tableCell")(u[g], i), q = "---"; + if (u[g].hasAttribute("style")) { + var B = u[g].getAttribute("style").toLowerCase().replace(/\s/g, ""); + switch (B) { + case "text-align:left;": + q = ":---"; + break; + case "text-align:right;": + q = "---:"; + break; + case "text-align:center;": + q = ":---:"; + break; + } + } + c[0][g] = z.trim(), c[1][g] = q; + } + for (g = 0; g < m.length; ++g) { + var G = c.push([]) - 1, w = m[g].getElementsByTagName("td"); + for (O = 0; O < u.length; ++O) { + var U = " "; + typeof w[O] < "u" && (U = a.subParser("makeMarkdown.tableCell")(w[O], i)), c[G].push(U); + } + } + var W = 3; + for (g = 0; g < c.length; ++g) + for (O = 0; O < c[g].length; ++O) { + var Y = c[g][O].length; + Y > W && (W = Y); + } + for (g = 0; g < c.length; ++g) { + for (O = 0; O < c[g].length; ++O) + g === 1 ? c[g][O].slice(-1) === ":" ? c[g][O] = a.helper.padEnd(c[g][O].slice(-1), W - 1, "-") + ":" : c[g][O] = a.helper.padEnd(c[g][O], W, "-") : c[g][O] = a.helper.padEnd(c[g][O], W); + o += "| " + c[g].join(" | ") + ` | +`; + } + return o.trim(); + }), a.subParser("makeMarkdown.tableCell", function(n, i) { + var o = ""; + if (!n.hasChildNodes()) + return ""; + for (var c = n.childNodes, u = c.length, m = 0; m < u; ++m) + o += a.subParser("makeMarkdown.node")(c[m], i, !0); + return o.trim(); + }), a.subParser("makeMarkdown.txt", function(n) { + var i = n.nodeValue; + return i = i.replace(/ +/g, " "), i = i.replace(/¨NBSP;/g, " "), i = a.helper.unescapeHTMLEntities(i), i = i.replace(/([*_~|`])/g, "\\$1"), i = i.replace(/^(\s*)>/g, "\\$1>"), i = i.replace(/^#/gm, "\\#"), i = i.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"), i = i.replace(/^( {0,3}\d+)\./gm, "$1\\."), i = i.replace(/^( {0,3})([+-])/gm, "$1\\$2"), i = i.replace(/]([\s]*)\(/g, "\\]$1\\("), i = i.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"), i; + }); + var R = this; + e.exports ? e.exports = a : R.showdown = a; + }).call(no); +})(Zo); +var Uu = Zo.exports; +const Yn = /* @__PURE__ */ oo(Uu); +class Zn { + constructor() { + Te(this, "logger"), Te(this, "converter"), this.logger = nn.zhiLog("showdown-adaptor"), this.converter = new Yn.Converter(); + } + isAvailable() { + return typeof Yn < "u"; + } + renderMarkdownStr(t) { + if (!this.isAvailable()) + throw new Error("Showdown is not available"); + return this.logger.info("Showdown is rendering md to HTML..."), Promise.resolve(this.converter.makeHtml(t)); + } +} +class Jo { + constructor() { + Te(this, "logger"), Te(this, "mdAdaptor", new Zn()), this.logger = nn.zhiLog("markdown-util"); + } + /** + * 获取当前 MD 解析器名称 + */ + getCurrentAdaptorName() { + return this.mdAdaptor instanceof Wn ? "Lute" : this.mdAdaptor instanceof Zn ? "Showdown" : "None"; + } + /** + * 渲染Markdown + * + * @param md - Markdown文本 + */ + async renderHTML(t) { + const r = new Wn(); + return this.logger.debug("Lute status =>", r.isAvailable()), r.isAvailable() && (this.mdAdaptor = r), this.logger.info(`Using ${this.getCurrentAdaptorName()} as markdown renderer`), await this.mdAdaptor.renderMarkdownStr(t); + } +} +class Gu { + constructor() { + Te(this, "mdUtil"), this.mdUtil = new Jo(); + } + /** + * 移除标题数字 + * + * @param str - 字符串 + */ + removeTitleNumber(t) { + let r = t; + const a = /([0-9]*)\./; + return r = r.replace(a, ""), r; + } + /** + * 删除挂件的HTML + * + * @param str - 原字符 + */ + removeWidgetTag(t) { + let r = t.toString(); + const a = //g; + r = r.replace(a, ""); + const s = //g; + r = r.replace(s, ""); + const l = //g; + return r = r.replace(l, ""), r; + } + /** + * 删除Markdown文本的挂件的HTML + * + * @param str - 原字符 + */ + removeMdWidgetTag(t) { + let r = t.toString(); + return r = this.removeWidgetTag(r), r; + } + /** + * 去除html标签,残缺不全也可以 + * + * @param str - 字符串 + */ + filterHtml(t) { + t = t.replace(//g, ""), t = t.replace(//g, ""), t = t.replace(/<[^>]*>/g, ""), t = t.replace(/&.*;/g, ""), t = t.replace(/(^\s*)|(\s*$)/g, ""), t = t.replace(//g, ""), t = t.replace(/"/g, "").replace(/'/g, ""), t = t.replace(/\*/g, ""), t = t.replace(/\$/g, ""), t = t.replace(/\./g, ""), t = t.replace(/\+/g, ""), t = t.replace(/\s+/g, ""), t = t.replace(/[:|:]/g, "_"), t = t.replace(/[;|;]/g, "_"), t = t.replace(/\^/g, "_"), t = t.replace(/!/g, "_"), t = t.replace(/@/g, "at_"); + const r = ["\\d*/\\d/\\d*", "[、|\\\\]", "[,|,]", "\\d", "/", "-"]; + for (let a = 0; a < r.length; a++) { + const s = new RegExp(r[a], "g"); + t = t.replace(s, ""); + } + return t = t.toLowerCase(), t; + } + /** + * 截取指定长度html + * + * @param html - html + * @param length - 长度 + * @param ignore - 不要结尾省略号 + */ + parseHtml(t, r, a) { + const s = this.filterHtml(t); + return s.length < r ? s : a === !0 ? s.substring(0, r) : s.substring(0, r) + "..."; + } + /** + * 将Markdown转换为HTML + * + * @param md - Markdown + */ + async mdToHtml(t) { + const r = await this.mdUtil.renderHTML(t); + return this.removeWidgetTag(r); + } + /** + * 将Markdown转换为纯文本 + * + * @param md - Markdown + */ + async mdToPlainText(t) { + const r = await this.mdToHtml(t); + return this.filterHtml(r); + } + /** + * 移除H1标签 + * + * @param html - html + */ + removeH1(t) { + let r = t; + const a = //g; + return r = r.replace(a, ""), r; + } + /** + * 移除Markdown里面的H1标签 + * + * JavaScript 正则表达式可以用来删除所有 Markdown 中的 h1 标签。下面是一个示例代码: + * + * const str = "# This is an H1\n## This is an H2\n### This is an H3"; + * + * const regex = /^# .*$/gm; + * const result = str.replace(regex, ''); + * + * console.log(result); + * 在这个例子中,我们使用正则表达式 /^# .*$/gm 来匹配所有的 h1 标签。 + * 在 JavaScript 中,^ 匹配行首,# 匹配 # 字符,.* 匹配任意字符,$ 匹配行尾,m 标记表示多行模式。 + */ + removeMdH1(t) { + let r = t; + const a = /^# .*$/gm; + return r = r.replace(a, ""), r; + } +} +class Hu { + /** + * 检测是否是空对象 + * + * @param obj - 对象 + */ + isEmptyObject(t) { + return t ? Object.getPrototypeOf(t) === Object.prototype && Object.getOwnPropertyNames(t).length === 0 && Object.getOwnPropertySymbols(t).length === 0 : !0; + } +} +class Ku { + constructor() { + Te(this, "dateUtil"), Te(this, "strUtil"), Te(this, "versionUtil"), Te(this, "htmlUtil"), Te(this, "markdownUtil"), Te(this, "jsonUtil"), Te(this, "objectUtil"), this.dateUtil = new _u(), this.strUtil = new wu(), this.versionUtil = new $u(), this.htmlUtil = new Gu(), this.markdownUtil = new Jo(), this.jsonUtil = new yu(), this.objectUtil = new Hu(); + } +} +const Wu = Ku; +var Yu = Object.defineProperty, Zu = (e, t, r) => t in e ? Yu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, sr = (e, t, r) => (Zu(e, typeof t != "symbol" ? t + "" : t, r), r); +class ir { +} +sr(ir, "NODE_ENV_KEY", "NODE_ENV"), /** +* 开发环境 +*/ +sr(ir, "NODE_ENV_DEVELOPMENT", "development"), /** +* 生产环境 +*/ +sr(ir, "NODE_ENV_PRODUCTION", "production"), /** +* 测试环境 +*/ +sr(ir, "NODE_ENV_TEST", "test"), /** +* 是否处于调试模式 +*/ +sr(ir, "VITE_DEBUG_MODE_KEY", "VITE_DEBUG_MODE"); +class Ju { +} +oe(Ju, "DEFAULT_BLOG_TYPE_KEY", "VITE_DEFAULT_TYPE"); +class Qu extends ks { +} +class Jn extends vs { + constructor(r, a) { + super(); + /** + * 思源笔记伺服地址 + */ + $e(this, "apiUrl"); + /** + * 思源笔记 API token + */ + $e(this, "password"); + /** + * 思源笔记操作提示 + * + * @protected + */ + $e(this, "placeholder"); + /** + * 是否修复标题 + * + * @protected + */ + $e(this, "fixTitle"); + this.apiUrl = r ?? "http://127.0.0.1:6806", this.passwordType = ao.PasswordType_Token, this.password = a ?? "", this.placeholder = new Qu(), this.fixTitle = !0; + } +} +var Xu = Object.defineProperty, ed = (e, t, r) => t in e ? Xu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Gt = (e, t, r) => (ed(e, typeof t != "symbol" ? t + "" : t, r), r); +class Kr { +} +Gt(Kr, "LOG_LEVEL_KEY", "VITE_LOG_LEVEL"), Gt(Kr, "LOG_PREFIX_KEY", "VITE_LOG_PREFIX"); +var Ve = /* @__PURE__ */ ((e) => (e.LOG_LEVEL_TRACE = "TRACE", e.LOG_LEVEL_DEBUG = "DEBUG", e.LOG_LEVEL_INFO = "INFO", e.LOG_LEVEL_WARN = "WARN", e.LOG_LEVEL_ERROR = "ERROR", e))(Ve || {}), Qo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function on(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var Xo = { exports: {} }; +(function(e) { + (function(t, r) { + e.exports ? e.exports = r() : t.log = r(); + })(Qo, function() { + var t = function() { + }, r = "undefined", a = typeof window !== r && typeof window.navigator !== r && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [ + "trace", + "debug", + "info", + "warn", + "error" + ]; + function l(P, x) { + var v = P[x]; + if (typeof v.bind == "function") + return v.bind(P); + try { + return Function.prototype.bind.call(v, P); + } catch { + return function() { + return Function.prototype.apply.apply(v, [P, arguments]); + }; + } + } + function d() { + console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); + } + function b(P) { + return P === "debug" && (P = "log"), typeof console === r ? !1 : P === "trace" && a ? d : console[P] !== void 0 ? l(console, P) : console.log !== void 0 ? l(console, "log") : t; + } + function _(P, x) { + for (var v = 0; v < s.length; v++) { + var C = s[v]; + this[C] = v < P ? t : this.methodFactory(C, P, x); + } + this.log = this.debug; + } + function y(P, x, v) { + return function() { + typeof console !== r && (_.call(this, x, v), this[P].apply(this, arguments)); + }; + } + function f(P, x, v) { + return b(P) || y.apply(this, arguments); + } + function E(P, x, v) { + var C = this, R; + x = x ?? "WARN"; + var n = "loglevel"; + typeof P == "string" ? n += ":" + P : typeof P == "symbol" && (n = void 0); + function i(m) { + var g = (s[m] || "silent").toUpperCase(); + if (!(typeof window === r || !n)) { + try { + window.localStorage[n] = g; + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(n) + "=" + g + ";"; + } catch { + } + } + } + function o() { + var m; + if (!(typeof window === r || !n)) { + try { + m = window.localStorage[n]; + } catch { + } + if (typeof m === r) + try { + var g = window.document.cookie, O = g.indexOf( + encodeURIComponent(n) + "=" + ); + O !== -1 && (m = /^([^;]+)/.exec(g.slice(O))[1]); + } catch { + } + return C.levels[m] === void 0 && (m = void 0), m; + } + } + function c() { + if (!(typeof window === r || !n)) { + try { + window.localStorage.removeItem(n); + return; + } catch { + } + try { + window.document.cookie = encodeURIComponent(n) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + } catch { + } + } + } + C.name = P, C.levels = { + TRACE: 0, + DEBUG: 1, + INFO: 2, + WARN: 3, + ERROR: 4, + SILENT: 5 + }, C.methodFactory = v || f, C.getLevel = function() { + return R; + }, C.setLevel = function(m, g) { + if (typeof m == "string" && C.levels[m.toUpperCase()] !== void 0 && (m = C.levels[m.toUpperCase()]), typeof m == "number" && m >= 0 && m <= C.levels.SILENT) { + if (R = m, g !== !1 && i(m), _.call(C, m, P), typeof console === r && m < C.levels.SILENT) + return "No console available for logging"; + } else + throw "log.setLevel() called with invalid level: " + m; + }, C.setDefaultLevel = function(m) { + x = m, o() || C.setLevel(m, !1); + }, C.resetLevel = function() { + C.setLevel(x, !1), c(); + }, C.enableAll = function(m) { + C.setLevel(C.levels.TRACE, m); + }, C.disableAll = function(m) { + C.setLevel(C.levels.SILENT, m); + }; + var u = o(); + u == null && (u = x), C.setLevel(u, !1); + } + var N = new E(), A = {}; + N.getLogger = function(P) { + if (typeof P != "symbol" && typeof P != "string" || P === "") + throw new TypeError("You must supply a name when creating a logger."); + var x = A[P]; + return x || (x = A[P] = new E( + P, + N.getLevel(), + N.methodFactory + )), x; + }; + var j = typeof window !== r ? window.log : void 0; + return N.noConflict = function() { + return typeof window !== r && window.log === N && (window.log = j), N; + }, N.getLoggers = function() { + return A; + }, N.default = N, N; + }); +})(Xo); +var td = Xo.exports; +const Lr = /* @__PURE__ */ on(td); +var es = { exports: {} }; +(function(e) { + (function(t, r) { + e.exports ? e.exports = r() : t.prefix = r(t); + })(Qo, function(t) { + var r = function(f) { + for (var E = 1, N = arguments.length, A; E < N; E++) + for (A in arguments[E]) + Object.prototype.hasOwnProperty.call(arguments[E], A) && (f[A] = arguments[E][A]); + return f; + }, a = { + template: "[%t] %l:", + levelFormatter: function(f) { + return f.toUpperCase(); + }, + nameFormatter: function(f) { + return f || "root"; + }, + timestampFormatter: function(f) { + return f.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); + }, + format: void 0 + }, s, l = {}, d = function(f) { + if (!f || !f.getLogger) + throw new TypeError("Argument is not a root logger"); + s = f; + }, b = function(f, E) { + if (!f || !f.setLevel) + throw new TypeError("Argument is not a logger"); + var N = f.methodFactory, A = f.name || "", j = l[A] || l[""] || a; + function P(x, v, C) { + var R = N(x, v, C), n = l[C] || l[""], i = n.template.indexOf("%t") !== -1, o = n.template.indexOf("%l") !== -1, c = n.template.indexOf("%n") !== -1; + return function() { + for (var u = "", m = arguments.length, g = Array(m), O = 0; O < m; O++) + g[O] = arguments[O]; + if (A || !l[C]) { + var z = n.timestampFormatter(/* @__PURE__ */ new Date()), q = n.levelFormatter(x), B = n.nameFormatter(C); + n.format ? u += n.format(q, B, z) : (u += n.template, i && (u = u.replace(/%t/, z)), o && (u = u.replace(/%l/, q)), c && (u = u.replace(/%n/, B))), g.length && typeof g[0] == "string" ? g[0] = u + " " + g[0] : g.unshift(u); + } + R.apply(void 0, g); + }; + } + return l[A] || (f.methodFactory = P), E = E || {}, E.template && (E.format = void 0), l[A] = r({}, j, E), f.setLevel(f.getLevel()), s || f.warn( + "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md" + ), f; + }, _ = { + reg: d, + apply: b + }, y; + return t && (y = t.prefix, _.noConflict = function() { + return t.prefix === _ && (t.prefix = y), _; + }), _; + }); +})(es); +var rd = es.exports; +const Qn = /* @__PURE__ */ on(rd); +function ad() { + const e = Error.prepareStackTrace; + Error.prepareStackTrace = (r, a) => a; + const t = new Error().stack.slice(1); + return Error.prepareStackTrace = e, t; +} +class mr { + /** + * 解析日志级别为枚举 + * + * @param enumObj - 枚举对象 + * @param value - 配置的值 + */ + static stringToEnumValue(t, r) { + return t[Object.keys(t).filter((a) => t[a].toString() === r)[0]]; + } + /** + * 获取配置的日志级别 + */ + static getEnvLevel(t) { + if (!t) + return; + let r; + try { + r = t.getEnvOrDefault(Kr.LOG_LEVEL_KEY, Ve.LOG_LEVEL_INFO); + } catch { + r = Ve.LOG_LEVEL_INFO; + } + const a = mr.stringToEnumValue(Ve, r.toUpperCase()); + return a || console.warn( + "[zhi-log] LOG_LEVEL is invalid in you .env file.It must be either debug, info, warn or error, fallback to default info level" + ), a ?? Ve.LOG_LEVEL_INFO; + } + /** + * 获取默认日志 + */ + static getEnvLogger(t) { + return t ? t.getEnv(Kr.LOG_PREFIX_KEY) : void 0; + } +} +var sn = { exports: {} }, Xn = { exports: {} }, eo; +function nd() { + return eo || (eo = 1, function(e) { + const t = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", r = typeof process < "u" && process.platform === "win32", a = typeof process < "u" && process.platform === "linux", s = { + ballotDisabled: "☒", + ballotOff: "☐", + ballotOn: "☑", + bullet: "•", + bulletWhite: "◦", + fullBlock: "█", + heart: "❤", + identicalTo: "≡", + line: "─", + mark: "※", + middot: "·", + minus: "-", + multiplication: "×", + obelus: "÷", + pencilDownRight: "✎", + pencilRight: "✏", + pencilUpRight: "✐", + percent: "%", + pilcrow2: "❡", + pilcrow: "¶", + plusMinus: "±", + question: "?", + section: "§", + starsOff: "☆", + starsOn: "★", + upDownArrow: "↕" + }, l = Object.assign({}, s, { + check: "√", + cross: "×", + ellipsisLarge: "...", + ellipsis: "...", + info: "i", + questionSmall: "?", + pointer: ">", + pointerSmall: "»", + radioOff: "( )", + radioOn: "(*)", + warning: "‼" + }), d = Object.assign({}, s, { + ballotCross: "✘", + check: "✔", + cross: "✖", + ellipsisLarge: "⋯", + ellipsis: "…", + info: "ℹ", + questionFull: "?", + questionSmall: "﹖", + pointer: a ? "▸" : "❯", + pointerSmall: a ? "‣" : "›", + radioOff: "◯", + radioOn: "◉", + warning: "⚠" + }); + e.exports = r && !t ? l : d, Reflect.defineProperty(e.exports, "common", { enumerable: !1, value: s }), Reflect.defineProperty(e.exports, "windows", { enumerable: !1, value: l }), Reflect.defineProperty(e.exports, "other", { enumerable: !1, value: d }); + }(Xn)), Xn.exports; +} +const od = (e) => e !== null && typeof e == "object" && !Array.isArray(e), sd = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, id = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, ts = () => { + const e = { + enabled: id(), + visible: !0, + styles: {}, + keys: {} + }, t = (l) => { + let d = l.open = `\x1B[${l.codes[0]}m`, b = l.close = `\x1B[${l.codes[1]}m`, _ = l.regex = new RegExp(`\\u001b\\[${l.codes[1]}m`, "g"); + return l.wrap = (y, f) => { + y.includes(b) && (y = y.replace(_, b + d)); + let E = d + y + b; + return f ? E.replace(/\r*\n/g, `${b}$&${d}`) : E; + }, l; + }, r = (l, d, b) => typeof l == "function" ? l(d) : l.wrap(d, b), a = (l, d) => { + if (l === "" || l == null) + return ""; + if (e.enabled === !1) + return l; + if (e.visible === !1) + return ""; + let b = "" + l, _ = b.includes(` +`), y = d.length; + for (y > 0 && d.includes("unstyle") && (d = [.../* @__PURE__ */ new Set(["unstyle", ...d])].reverse()); y-- > 0; ) + b = r(e.styles[d[y]], b, _); + return b; + }, s = (l, d, b) => { + e.styles[l] = t({ name: l, codes: d }), (e.keys[b] || (e.keys[b] = [])).push(l), Reflect.defineProperty(e, l, { + configurable: !0, + enumerable: !0, + set(_) { + e.alias(l, _); + }, + get() { + let _ = (y) => a(y, _.stack); + return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(l) : [l], _; + } + }); + }; + return s("reset", [0, 0], "modifier"), s("bold", [1, 22], "modifier"), s("dim", [2, 22], "modifier"), s("italic", [3, 23], "modifier"), s("underline", [4, 24], "modifier"), s("inverse", [7, 27], "modifier"), s("hidden", [8, 28], "modifier"), s("strikethrough", [9, 29], "modifier"), s("black", [30, 39], "color"), s("red", [31, 39], "color"), s("green", [32, 39], "color"), s("yellow", [33, 39], "color"), s("blue", [34, 39], "color"), s("magenta", [35, 39], "color"), s("cyan", [36, 39], "color"), s("white", [37, 39], "color"), s("gray", [90, 39], "color"), s("grey", [90, 39], "color"), s("bgBlack", [40, 49], "bg"), s("bgRed", [41, 49], "bg"), s("bgGreen", [42, 49], "bg"), s("bgYellow", [43, 49], "bg"), s("bgBlue", [44, 49], "bg"), s("bgMagenta", [45, 49], "bg"), s("bgCyan", [46, 49], "bg"), s("bgWhite", [47, 49], "bg"), s("blackBright", [90, 39], "bright"), s("redBright", [91, 39], "bright"), s("greenBright", [92, 39], "bright"), s("yellowBright", [93, 39], "bright"), s("blueBright", [94, 39], "bright"), s("magentaBright", [95, 39], "bright"), s("cyanBright", [96, 39], "bright"), s("whiteBright", [97, 39], "bright"), s("bgBlackBright", [100, 49], "bgBright"), s("bgRedBright", [101, 49], "bgBright"), s("bgGreenBright", [102, 49], "bgBright"), s("bgYellowBright", [103, 49], "bgBright"), s("bgBlueBright", [104, 49], "bgBright"), s("bgMagentaBright", [105, 49], "bgBright"), s("bgCyanBright", [106, 49], "bgBright"), s("bgWhiteBright", [107, 49], "bgBright"), e.ansiRegex = sd, e.hasColor = e.hasAnsi = (l) => (e.ansiRegex.lastIndex = 0, typeof l == "string" && l !== "" && e.ansiRegex.test(l)), e.alias = (l, d) => { + let b = typeof d == "string" ? e[d] : d; + if (typeof b != "function") + throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); + b.stack || (Reflect.defineProperty(b, "name", { value: l }), e.styles[l] = b, b.stack = [l]), Reflect.defineProperty(e, l, { + configurable: !0, + enumerable: !0, + set(_) { + e.alias(l, _); + }, + get() { + let _ = (y) => a(y, _.stack); + return Reflect.setPrototypeOf(_, e), _.stack = this.stack ? this.stack.concat(b.stack) : b.stack, _; + } + }); + }, e.theme = (l) => { + if (!od(l)) + throw new TypeError("Expected theme to be an object"); + for (let d of Object.keys(l)) + e.alias(d, l[d]); + return e; + }, e.alias("unstyle", (l) => typeof l == "string" && l !== "" ? (e.ansiRegex.lastIndex = 0, l.replace(e.ansiRegex, "")) : ""), e.alias("noop", (l) => l), e.none = e.clear = e.noop, e.stripColor = e.unstyle, e.symbols = nd(), e.define = s, e; +}; +sn.exports = ts(); +sn.exports.create = ts; +var ld = sn.exports; +const Ke = /* @__PURE__ */ on(ld); +let ga, rs, as, ns, os = !0; +typeof process < "u" && ({ FORCE_COLOR: ga, NODE_DISABLE_COLORS: rs, NO_COLOR: as, TERM: ns } = process.env || {}, os = process.stdout && process.stdout.isTTY); +const ae = { + enabled: !rs && as == null && ns !== "dumb" && (ga != null && ga !== "0" || os), + // modifiers + reset: ge(0, 0), + bold: ge(1, 22), + dim: ge(2, 22), + italic: ge(3, 23), + underline: ge(4, 24), + inverse: ge(7, 27), + hidden: ge(8, 28), + strikethrough: ge(9, 29), + // colors + black: ge(30, 39), + red: ge(31, 39), + green: ge(32, 39), + yellow: ge(33, 39), + blue: ge(34, 39), + magenta: ge(35, 39), + cyan: ge(36, 39), + white: ge(37, 39), + gray: ge(90, 39), + grey: ge(90, 39), + // background colors + bgBlack: ge(40, 49), + bgRed: ge(41, 49), + bgGreen: ge(42, 49), + bgYellow: ge(43, 49), + bgBlue: ge(44, 49), + bgMagenta: ge(45, 49), + bgCyan: ge(46, 49), + bgWhite: ge(47, 49) +}; +function to(e, t) { + let r = 0, a, s = "", l = ""; + for (; r < e.length; r++) + a = e[r], s += a.open, l += a.close, ~t.indexOf(a.close) && (t = t.replace(a.rgx, a.close + a.open)); + return s + t + l; +} +function cd(e, t) { + let r = { has: e, keys: t }; + return r.reset = ae.reset.bind(r), r.bold = ae.bold.bind(r), r.dim = ae.dim.bind(r), r.italic = ae.italic.bind(r), r.underline = ae.underline.bind(r), r.inverse = ae.inverse.bind(r), r.hidden = ae.hidden.bind(r), r.strikethrough = ae.strikethrough.bind(r), r.black = ae.black.bind(r), r.red = ae.red.bind(r), r.green = ae.green.bind(r), r.yellow = ae.yellow.bind(r), r.blue = ae.blue.bind(r), r.magenta = ae.magenta.bind(r), r.cyan = ae.cyan.bind(r), r.white = ae.white.bind(r), r.gray = ae.gray.bind(r), r.grey = ae.grey.bind(r), r.bgBlack = ae.bgBlack.bind(r), r.bgRed = ae.bgRed.bind(r), r.bgGreen = ae.bgGreen.bind(r), r.bgYellow = ae.bgYellow.bind(r), r.bgBlue = ae.bgBlue.bind(r), r.bgMagenta = ae.bgMagenta.bind(r), r.bgCyan = ae.bgCyan.bind(r), r.bgWhite = ae.bgWhite.bind(r), r; +} +function ge(e, t) { + let r = { + open: `\x1B[${e}m`, + close: `\x1B[${t}m`, + rgx: new RegExp(`\\x1b\\[${t}m`, "g") + }; + return function(a) { + return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(r)), a === void 0 ? this : ae.enabled ? to(this.keys, a + "") : a + "") : a === void 0 ? cd([e], [r]) : ae.enabled ? to([r], a + "") : a + ""; + }; +} +var ud = Object.defineProperty, dd = (e, t, r) => t in e ? ud(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Se = (e, t, r) => (dd(e, typeof t != "symbol" ? t + "" : t, r), r); +const tt = class { + /** + * 检测是否运行在Chrome插件中 + */ + static isInChromeExtension() { + return tt.isInBrowser ? window.location.href.indexOf("chrome-extension://") > -1 : !1; + } +}; +let he = tt; +Se(he, "isNode", typeof process < "u"), /** +* 是否在浏览器环境 +*/ +Se(he, "isInBrowser", typeof window < "u"), /** +* 浏览器路径分隔符 +*/ +Se(he, "BrowserSeperator", "/"), /** +* 是否是Electron环境 +*/ +Se(he, "isElectron", () => !tt.isInBrowser || !window.navigator || !window.navigator.userAgent ? !1 : /Electron/.test(window.navigator.userAgent)), /** +* 是否有Node环境,目前包括 Electron 和 Node +*/ +Se(he, "hasNodeEnv", () => tt.isElectron() || tt.isNode), /** +* 获取url参数 +* +* @param sParam - 参数 +*/ +Se(he, "getQueryString", (e) => { + if (!tt.isInBrowser) + return ""; + const t = window.location.search.substring(1).split("&"); + for (let r = 0; r < t.length; r++) { + const a = t[r].split("="); + if (a[0] === e) + return a[1]; + } + return ""; +}), /** +* 替换 URL 的参数 +* 思路: +* 1. 使用了 URLSearchParams 对象来解析和构建 URL 查询参数。 +* +* 2. 在处理包含 hash 片段的 URL 时使用了 split 函数将 URL 分成两部分:基本 URL 和 hash 片段。 +* +* 3. 然后,再次使用 split 函数将基本 URL 分成两部分:路径和查询参数。 +* +* 4. 将查询参数转换为 URLSearchParams 对象,然后设置指定的参数名和值。 +* +* 5. 最后,使用 toString 函数将查询参数转换为字符串,并将其与路径组合成新的基本 URL。如果 URL 包含 hash 片段,则将其添加到新的基本 URL 中。 +* +* @param url - 链接地址 +* @param paramName - 参数名 +* @param paramValue - 参数值 +*/ +Se(he, "replaceUrlParam", (e, t, r) => { + r == null && (r = ""); + const a = new RegExp("\\b(" + t + "=).*?(&|#|$)"); + if (e.search(a) >= 0) + return e.replace(a, "$1" + r + "$2"); + const [s, l] = e.split("#"), [d, b] = s.split("?"), _ = new URLSearchParams(b); + _.set(t, r); + const y = _.toString(), f = d + (y ? "?" + y : ""); + return l ? f + "#" + l : f; +}), /** +* 设置url参数 +* +* @param urlstring - url +* @param key - key +* @param value - value +*/ +Se(he, "setUrlParameter", (e, t, r) => { + if (e.includes(t)) + return tt.replaceUrlParam(e, t, r); + const a = e.split("#"); + let s = a[0]; + const l = a[1]; + return s.includes("?") ? s += `&${t}=${r}` : s += `?${t}=${r}`, l && (s += "#" + l), s; +}), /** +* 重新加载指定tab +* +* @param tabname - tabname +* @param t - 延迟时间 +*/ +Se(he, "reloadTabPage", (e, t = 200) => { + setTimeout(function() { + if (tt.isInBrowser) { + const r = window.location.href; + window.location.href = tt.setUrlParameter(r, "tab", e); + } + }, t); +}), /** +* 刷新当前tab页面 +*/ +Se(he, "reloadPage", () => { + setTimeout(function() { + tt.isInBrowser && window.location.reload(); + }, 200); +}), /** +* 刷新当前tab页面 +* +* @param msg - 消息提示 +* @param cb - 回调 +*/ +Se(he, "reloadPageWithMessageCallback", (e, t) => { + t && t(e), setTimeout(function() { + tt.isInBrowser && window.location.reload(); + }, 200); +}); +var Le = /* @__PURE__ */ ((e) => (e.BasePathType_Appearance = "Appearance", e.BasePathType_Data = "Data", e.BasePathType_Themes = "Themes", e.BasePathType_ZhiTheme = "ZhiTheme", e.BasePathType_None = "None", e))(Le || {}); +const Me = class { + /** + * 检测是否运行在思源打开的浏览器中 + */ + static isInSiyuanBrowser() { + return he.isInBrowser ? typeof window.siyuan < "u" && typeof window.Lute < "u" : !1; + } + /** + * 思源笔记 window 对象 + */ + static siyuanWindow() { + let e; + return this.isInSiyuanWidget() ? e = parent.window : this.isInSiyuanNewWin() || this.isInSiyuanBrowser() || typeof window < "u" ? e = window : e = void 0, e; + } + // ========================= + // require end + // ========================= + // ========================= + // import start + // ========================= + /** + * 引入json + * + * @param jsPath - js相对路径全路径 + * @param type - 类型 + */ + static async importJs(e, t) { + let r = e; + switch (t) { + case Le.BasePathType_Appearance: + r = this.browserJoinPath(this.siyuanAppearanceRelativePath(), e); + break; + case Le.BasePathType_Data: + r = this.browserJoinPath(this.siyuanDataRelativePath(), e); + break; + case Le.BasePathType_Themes: + r = this.browserJoinPath(this.siyuanThemeRelativePath(), e); + break; + case Le.BasePathType_ZhiTheme: + r = this.browserJoinPath(this.zhiThemeRelativePath(), e); + break; + default: + throw new Error("type must be provided"); + } + const { default: a } = await import( + /* @vite-ignore */ + r + ); + return a; + } + /** + * 引入json + * + * @param jsonPath - json相对路径全路径 + * @param type - 类型 + */ + // public static async importJson(jsonPath: string, type: BasePathTypeEnum) { + // let fullJsonPath = jsonPath + // switch (type) { + // case BasePathTypeEnum.BasePathType_Appearance: + // fullJsonPath = this.browserJoinPath(this.siyuanAppearanceRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Data: + // fullJsonPath = this.browserJoinPath(this.siyuanDataRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_Themes: + // fullJsonPath = this.browserJoinPath(this.siyuanThemeRelativePath(), jsonPath) + // break + // case BasePathTypeEnum.BasePathType_ZhiTheme: + // fullJsonPath = this.browserJoinPath(this.zhiThemeRelativePath(), jsonPath) + // break + // default: + // throw new Error("type must be provided") + // } + // + // const { default: data } = await import(/* @vite-ignore */ fullJsonPath, { assert: { type: "json" } }) + // return data + // } + /** + * 引入 json - 以 data 为基本路径 + * + * @param jsonPath - 相对于 data 的相对路径 + */ + // public static async importDataJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Data) + // } + /** + * 引入 json - 以 appearance 为基本路径 + * + * @param jsonPath - 相对于 appearance 的相对路径 + */ + // public static async importAppearanceJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Appearance) + // } + /** + * 引入 json - 以 themes 为基本路径 + * + * @param jsonPath - 相对于 themes 的相对路径 + */ + // public static async importThemesJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_Themes) + // } + /** + * 引入 zhi 主题的 json - 以 zhi 主题 的根路径为基本路径 + * + * @param jsonPath - 相对于 zhi 主题根路径的相对路径 + */ + // public static async importZhiThemeJson(jsonPath: string) { + // return await this.importJson(jsonPath, BasePathTypeEnum.BasePathType_ZhiTheme) + // } + /** + * 引入 zhi 主题的 js - 以 zhi 主题 的根路径为基本路径 + * + * @param jsPath - 相对于 zhi 主题根路径的相对路径 + */ + static async importZhiThemeJs(e) { + return await this.importJs(e, Le.BasePathType_ZhiTheme); + } + // ========================= + // import start + // ========================= + /** + * 路径拼接 + * + * @param paths - 路径数组 + */ + static joinPath(...e) { + if (he.hasNodeEnv()) { + const t = this.requireLib("path"); + if (t) + return t.join(...e); + } + return this.browserJoinPath(...e); + } + static browserJoinPath(...e) { + return e.join(he.BrowserSeperator); + } + /** + * 思源笔记 conf 目录 + */ + static siyuanConfPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.confDir; + } + /** + * 思源笔记 data 目录 + */ + static siyuanDataPath() { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return e.siyuan.config.system.dataDir; + } + /** + * 思源笔记 data 目录-相对路径 + */ + static siyuanDataRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return ""; + } + /** + * 思源笔记 appearance 目录 + */ + static siyuanAppearancePath() { + return this.joinPath(this.siyuanConfPath(), "appearance"); + } + /** + * 思源笔记 appearance 目录-相对路径 + */ + static siyuanAppearanceRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance"); + } + /** + * 思源笔记 themes 目录-绝对路径 + * + * 注意: 如果是非 electron 和 Node 环境,这里返回的是浏览器的路径,不是物理路径 + * 如果使用物理路径,请调用 siyuanAppearancePath 或者 siyuanDataPath + * + * @author terwer + * @since 0.1.0 + */ + static siyuanThemePath() { + if (he.hasNodeEnv()) + return this.joinPath(this.siyuanAppearancePath(), "themes"); + { + const e = this.siyuanWindow(); + if (!e) + throw new Error("Not in siyuan env"); + return this.joinPath(e.location.origin, "appearance", "themes"); + } + } + /** + * 思源笔记 themes 目录-相对路径 + */ + static siyuanThemeRelativePath() { + if (!this.siyuanWindow()) + throw new Error("Not in siyuan env"); + return this.browserJoinPath("", "appearance", "themes"); + } + /** + * zhi 主题目录 - 绝对路径 + */ + static zhiThemePath() { + return this.joinPath(this.siyuanThemePath(), "zhi"); + } + /** + * zhi 主题目录 - 相对路径 + */ + static zhiThemeRelativePath() { + return this.browserJoinPath(this.siyuanThemeRelativePath(), "zhi"); + } +}; +let Tt = Me; +Se(Tt, "isInSiyuanWidget", () => he.isInBrowser ? window.frameElement != null && window.frameElement.parentElement != null && window.frameElement.parentElement.parentElement != null && window.frameElement.parentElement.parentElement.getAttribute("data-node-id") !== "" : !1), /** +* 思源笔记新窗口 +* +* @deprecated window.terwer 判断方式已废弃,建议以后打开新窗口注入 window.siyuanNewWin ,这样语义会更容易理解 +* @author terwer +* @version 0.1.0 +* @since 0.0.1 +*/ +Se(Tt, "isInSiyuanNewWin", () => !he.isInBrowser || !he.isElectron() ? !1 : typeof window.terwer < "u" || typeof window.siyuanNewWin < "u"), // ========================= +// require start +// ========================= +/** + * 引入依赖 + * + * @param libpath - 依赖全路径 + * @param abs - 可选,是否使用觉得路径,默认是 true , 启用之后 type参数无效 + * @param type - 可选,以谁的基本路径为准 + */ +Se(Tt, "requireLib", (e, t = !0, r = Le.BasePathType_None) => { + if (!he.hasNodeEnv()) + throw new Error("require ony works on node env"); + let a = e; + if (!t) + switch (r) { + case Le.BasePathType_Appearance: + a = Me.joinPath(Me.siyuanAppearancePath(), e); + break; + case Le.BasePathType_Data: + a = Me.joinPath(Me.siyuanDataPath(), e); + break; + case Le.BasePathType_Themes: + a = Me.joinPath(Me.siyuanAppearancePath(), "themes", e); + break; + case Le.BasePathType_ZhiTheme: + a = Me.joinPath(Me.siyuanAppearancePath(), "themes", "zhi", e); + break; + default: + throw new Error("type must be provided when not use absolute path"); + } + const s = Me.siyuanWindow(); + if (!s) + return require(a); + if (typeof s.require < "u") + return s.require(a); +}), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 appearance 的相对路径 +*/ +Se(Tt, "requireAppearanceLib", (e) => Me.requireLib(e, !1, Le.BasePathType_Appearance)), /** +* 引入依赖,以 data 的基本路径为准 +* +* @param libpath - 相对于 data 的相对路径 +*/ +Se(Tt, "requireDataLib", (e) => Me.requireLib(e, !1, Le.BasePathType_Data)), /** +* 引入依赖,以 theme 的基本路径为准 +* +* @param libpath - 相对于 theme 的相对路径 +*/ +Se(Tt, "requireThemesLib", (e) => Me.requireLib(e, !1, Le.BasePathType_Themes)), /** +* 引入依赖,以 ZhiTheme 的基本路径为准 +* +* @param libpath - 相对于 ZhiTheme 的相对路径 +*/ +Se(Tt, "requireZhiThemeLib", (e) => Me.requireLib(e, !1, Le.BasePathType_ZhiTheme)); +const We = { + white: (e) => he.isElectron() ? Ke.whiteBright(e) : ae.white(e), + gray: (e) => he.isElectron() ? Ke.gray(e) : ae.gray(e), + blue: (e) => he.isElectron() ? Ke.blue(e) : ae.blue(e), + green: (e) => he.isElectron() ? Ke.green(e) : ae.green(e), + yellow: (e) => he.isElectron() ? Ke.yellow(e) : ae.yellow(e), + red: (e) => he.isElectron() ? Ke.red(e) : ae.red(e), + bgWhite: (e) => he.isElectron() ? Ke.bgWhiteBright(e) : ae.bgWhite(e), + bgGrey: (e) => he.isElectron() ? Ke.bgCyanBright(e) : ae.bgCyan(e), + bgBlue: (e) => he.isElectron() ? Ke.bgBlueBright(e) : ae.bgBlue(e), + bgGreen: (e) => he.isElectron() ? Ke.bgGreenBright(e) : ae.bgGreen(e), + bgYellow: (e) => he.isElectron() ? Ke.bgYellowBright(e) : ae.bgYellow(e), + bgRed: (e) => he.isElectron() ? Ke.bgRedBright(e) : ae.bgRed(e) +}; +class hd { + constructor(t, r, a) { + Gt(this, "consoleLogger", "console"), Gt(this, "stackSize", 1), Gt(this, "getLogger", (d) => { + let b; + if (d) + b = d; + else { + const _ = this.getCallStack(), y = [], f = []; + for (let E = 0; E < _.length; E++) { + const N = _[E], A = N.getFileName() ?? "none"; + if (E > this.stackSize - 1) + break; + const j = A + "-" + N.getLineNumber() + ":" + N.getColumnNumber(); + y.push(j); + } + f.length > 0 && (b = y.join(" -> ")); + } + return (!b || b.trim().length === 0) && (b = this.consoleLogger), Lr.getLogger(b); + }), this.stackSize = 1; + let s; + t ? s = t : s = mr.getEnvLevel(a), s = s ?? Ve.LOG_LEVEL_INFO, Lr.setLevel(s); + const l = (d, b, _, y) => { + const f = [], E = r ?? mr.getEnvLogger(a) ?? "zhi"; + return f.push(We.gray("[") + y(E) + We.gray("]")), f.push(We.gray("[") + We.gray(_.toString()) + We.gray("]")), f.push(y(d.toUpperCase().toString())), f.push(y(b)), f.push(We.gray(":")), f; + }; + Qn.reg(Lr), Qn.apply(Lr, { + format(d, b, _) { + let y = []; + const f = b ?? ""; + switch (d) { + case Ve.LOG_LEVEL_TRACE: + y = l(d, f, _, We.gray); + break; + case Ve.LOG_LEVEL_DEBUG: + y = l(d, f, _, We.blue); + break; + case Ve.LOG_LEVEL_INFO: + y = l(d, f, _, We.green); + break; + case Ve.LOG_LEVEL_WARN: + y = l(d, f, _, We.yellow); + break; + case Ve.LOG_LEVEL_ERROR: + y = l(d, f, _, We.red); + break; + default: + y = l(Ve.LOG_LEVEL_INFO, f, _, We.green); + break; + } + return y.join(" "); + } + }); + } + /** + * 设置输出栈的深度,默认1 + * + * @param stackSize - 栈的深度 + */ + setStackSize(t) { + this.stackSize = t ?? 1; + } + /** + * 获取调用堆栈,若未获取到直接返回空数组 + * + * @author terwer + * @since 1.6.0 + */ + getCallStack() { + let t; + try { + t = ad(); + } catch { + t = []; + } + return t; + } +} +class pd { + /** + * 默认日志级别 + * + * @param level - 可选,未设置默认INFO + * @param sign - 可选前缀,默认zhi + * @param env - 可选环境变量实例 + */ + constructor(t, r, a) { + Gt(this, "logger"), this.logger = new hd(t, r, a); + } + /** + * 获取日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + * @protected + */ + getLogger(t, r) { + return this.logger.setStackSize(r), this.logger.getLogger(t); + } +} +class ro extends pd { + constructor(t, r, a) { + super(t, r, a); + } + /** + * 获取默认的日志记录器 + * + * @param loggerName - 日志记录器名称 + * @param stackSize - 打印栈的深度 + */ + getLogger(t, r) { + return super.getLogger(t, r); + } +} +class Wr { + /** + * 默认日志记录器 + * + * @param stackSize - 栈的深度 + * @param env - 环境变量实例 + */ + static defaultLogger(t, r) { + return Wr.customLogFactory(void 0, void 0, t).getLogger(void 0, r); + } + /** + * 自定义日志工厂 + * + * @param level - 级别 + * @param sign - 标志 + * @param env - 环境变量 + */ + static customLogFactory(t, r, a) { + return new ro(t, r, a); + } + /** + * 自定义日志工厂,自定义前缀 + * + * @param sign - 标志 + * @param env - 环境变量 + */ + static customSignLogFactory(t, r) { + return new ro(void 0, t, r); + } +} +class Yr { +} +/** + * 思源 API 伺服地址 + */ +$e(Yr, "VITE_SIYUAN_API_URL_KEY", "VITE_SIYUAN_API_URL"), /** + * 思源 token + */ +$e(Yr, "VITE_SIYUAN_AUTH_TOKEN_KEY", "VITE_SIYUAN_AUTH_TOKEN"); +class gr { + /** + * 通用环境变量 + * + * @param appInstance - 插件实例 + */ + static zhiEnv(t) { + return this.env || (this.env = new t.zhiEnv.Env({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 })), this.env; + } + /** + * 通用日志 + * + * @param appInstance - 应用实例 + * @param loggerName - 日志名称 + */ + static zhiLog(t, r) { + const a = this.zhiEnv(t); + return t.zhiCommon.ZhiUtil.initEnv(a), t.zhiCommon.ZhiUtil.zhiLogWithSign("publisher", r); + } + /** + * 通用工具入口 + * + * @param appInstance - 应用实例 + */ + static zhiCommon(t) { + return t.zhiCommon.ZhiUtil.zhiCommon(); + } +} +$e(gr, "env"); +class ea { + /** + * 初始化思源服务端 API + * + * @param cfg - 环境变量 或者 配置项 + */ + constructor(t) { + /** + * 思源笔记服务端API版本号 + */ + $e(this, "VERSION"); + $e(this, "logger"); + $e(this, "env"); + $e(this, "common"); + $e(this, "siyuanConfig"); + if (this.VERSION = "1.0.0", t instanceof Jn) + this.siyuanConfig = t, this.logger = Wr.customLogFactory(Ve.LOG_LEVEL_DEBUG, "zhi").getLogger("siyuan-kernel-api"); + else { + const r = t, a = mr.getEnvLevel(r), s = r.getStringEnv(Yr.VITE_SIYUAN_API_URL_KEY), l = r.getStringEnv(Yr.VITE_SIYUAN_AUTH_TOKEN_KEY); + this.siyuanConfig = new Jn(s, l), this.logger = Wr.customLogFactory(a, "siyuan-kernel-api", r).getLogger(ea.name); + } + } + init(t) { + this.env = gr.zhiEnv(t), this.common = gr.zhiCommon(t); + } + /** + * 分页获取根文档 + * + * @param keyword - 关键字 + */ + async getRootBlocksCount(t) { + const r = `SELECT COUNT(DISTINCT b1.root_id) as count + FROM blocks b1 + WHERE 1 = 1 + AND (b1.root_id ='${t}' OR (b1.content LIKE '%${t}%') OR (b1.tag LIKE '%${t}%') + )`, a = await this.sql(r); + return this.logger.debug("getRootBlocksCount data=>", a[0].count), a[0].count; + } + /** + * 分页获取根文档 + + * ```sql + * select DISTINCT b2.root_id,b2.parent_id,b2.content from blocks b2 + * WHERE 1==1 + * AND b2.id IN ( + * SELECT DISTINCT b1.root_id + * FROM blocks b1 + * WHERE 1 = 1 + * AND ((b1.content LIKE '%github%') OR (b1.tag LIKE '%github%')) + * ORDER BY b1.updated DESC,b1.created DESC LIMIT 0,10 + * ) + * ORDER BY b2.updated DESC,b2.created DESC + * ``` + * + * @param page 页码 + * @param pagesize 数目 + * @param keyword 可选,搜索关键字 + */ + async getRootBlocks(t, r, a) { + const s = `select DISTINCT b2.root_id,b2.parent_id,b2.content from blocks b2 + WHERE 1==1 + AND b2.id IN ( + SELECT DISTINCT b1.root_id + FROM blocks b1 + WHERE 1 = 1 + AND (b1.root_id ='${a}' OR (b1.content LIKE '%${a}%') OR (b1.tag LIKE '%${a}%')) + ORDER BY b1.updated DESC,b1.created DESC LIMIT ${t * r},${r} + ) + ORDER BY b2.updated DESC,b2.created DESC`; + return await this.sql(s); + } + /** + * 获取该文档下面的子文档个数 + * + * ```sql + * SELECT COUNT(DISTINCT b1.root_id) AS count + * FROM blocks b1 + * WHERE b1.path LIKE '%/20220927094918-1d85uyp%'; + * ``` + * + * @param docId 文档ID + */ + async getSubdocCount(t) { + const r = `SELECT COUNT(DISTINCT b1.root_id) AS count + FROM blocks b1 + WHERE b1.root_id='${t}' OR b1.path LIKE '%/${t}%'`; + return (await this.sql(r))[0].count; + } + /** + * 分页获取子文档 + * + * ```sql + * SELECT DISTINCT b2.root_id,b2.content,b2.path FROM blocks b2 + * WHERE b2.id IN ( + * SELECT DISTINCT b1.root_id + * FROM blocks b1 + * WHERE b1.path like '%/20220927094918-1d85uyp%' + * AND ((b1.content LIKE '%文档%') OR (b1.tag LIKE '%文档%')) + * ORDER BY b1.updated DESC,b1.created DESC LIMIT 0,10 + * ) + * ORDER BY b2.updated DESC,b2.created DESC + * ``` + * + * @param docId 文档ID + * @param page 页码 + * @param pagesize 数目 + * @param keyword 关键字 + */ + async getSubdocs(t, r, a, s) { + const l = `SELECT DISTINCT b2.root_id,b2.content,b2.path FROM blocks b2 + WHERE b2.id IN ( + SELECT DISTINCT b1.root_id + FROM blocks b1 + WHERE b1.root_id='${t}' OR b1.path like '%/${t}%' + AND ((b1.content LIKE '%${s}%') OR (b1.tag LIKE '%${s}%')) + ORDER BY b1.updated DESC,b1.created DESC LIMIT ${r * a},${a} + ) + ORDER BY b2.content,b2.updated DESC,b2.created DESC,id`; + return this.logger.debug("siyuanApi getSubdocs sql=>", l), await this.sql(l); + } + /** + * 以id获取思源块信息 + * @param blockId 块ID + */ + async getBlockByID(t) { + const r = `select * + from blocks + where id = '${t}'`, a = await this.sql(r); + if (!a || a.length === 0) + throw new Error("通过ID查询块信息失败"); + return a[0]; + } + /** + * 以slug获取思源块信息 + * @param slug 内容快别名 + */ + async getRootBlockBySlug(t) { + const r = `select root_id from attributes where name='custom-slug' and value='${t}' limit 1`; + return (await this.sql(r))[0]; + } + /** + * 以内容块ID获取根块 + * + * @param blockID 内容块ID + */ + async getRootBlock(t) { + const r = `select root_id from blocks where id='${t}' limit 1`; + return (await this.sql(r))[0]; + } + /** + * 导出markdown文本 + * @param docId 文档id + */ + async exportMdContent(t) { + const r = { + id: t + }, a = "/api/export/exportMdContent"; + return await this.siyuanRequest(a, r); + } + /** + * 以sql发送请求 + * + * @param sql - sql + */ + async sql(t) { + const r = { + stmt: t + }, a = "/api/query/sql"; + return this.env.isDev() && this.logger.trace("sql=>", t), await this.siyuanRequest(a, r); + } + /** + * 向思源请求数据 + * + * @param url - url + * @param data - 数据 + */ + async siyuanRequest(t, r) { + const a = `${this.siyuanConfig.apiUrl}${t}`, s = { + body: JSON.stringify(r), + method: "POST" + }; + this.common.strUtil.isEmptyString(this.siyuanConfig.password) || Object.assign(s, { + headers: { + Authorization: `Token ${this.siyuanConfig.password}` + } + }), this.env.isDev() && (this.logger.trace("开始向思源请求数据,reqUrl=>", a), this.logger.trace("开始向思源请求数据,fetchOps=>", s)); + const d = await (await fetch(a, s)).json(); + if (this.env.isDev() && this.logger.trace("思源请求数据返回,resJson=>", d), d.code === -1) + throw new Error(d.msg); + return d.code === 0 ? d.data : null; + } + /** + * 列出笔记本 + */ + async lsNotebooks() { + return await this.siyuanRequest("/api/notebook/lsNotebooks", {}); + } + /** + * 打开笔记本 + * + * @param notebookId - 笔记本ID + */ + async openNotebook(t) { + return await this.siyuanRequest("/api/notebook/openNotebook", { + notebook: t + }); + } + /** + * 关闭笔记本 + * + * @param notebookId - 笔记本ID + */ + async closeNotebook(t) { + return await this.siyuanRequest("/api/notebook/closeNotebook", { + notebook: t + }); + } + /** + * 重命名笔记本 + * + * @param notebookId - 笔记本ID + * @param name - 新笔记本名称 + */ + async renameNotebook(t, r) { + return await this.siyuanRequest("/api/notebook/renameNotebook", { + notebook: t, + name: r + }); + } + /** + * 创建笔记本 + * + * @param name - 新笔记本名称 + */ + async createNotebook(t) { + return await this.siyuanRequest("/api/notebook/createNotebook", { + name: t + }); + } + /** + * 删除笔记本 + * + * @param notebookId - 笔记本ID + */ + async removeNotebook(t) { + return await this.siyuanRequest("/api/notebook/removeNotebook", { + notebook: t + }); + } + /** + * 获取笔记本配置 + * + * @param notebookId - 笔记本ID + */ + async getNotebookConf(t) { + return await this.siyuanRequest("/api/notebook/getNotebookConf", { + notebook: t + }); + } + /** + * 保存笔记本配置 + * + * ```json + * { + * "notebook": "20210817205410-2kvfpfn", + * "conf": { + * "name": "测试笔记本", + * "closed": false, + * "refCreateSavePath": "", + * "createDocNameTemplate": "", + * "dailyNoteSavePath": "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}", + * "dailyNoteTemplatePath": "" + * } + * } + * ``` + * @param notebookConf - 笔记本配置 + */ + async setNotebookConf(t) { + return await this.siyuanRequest("/api/notebook/setNotebookConf", t); + } + /** + * 推送消息 + * + * 参数 + * + * ```json + * { + * "msg": "test", + * "timeout": 7000 + * } + * ``` + * + * timeout:消息持续显示时间,单位为毫秒。可以不传入该字段,默认为 7000 毫秒 + * + * 返回值 + * + * ``` + * { + * "code": 0, + * "msg": "", + * "data": { + * "id": "62jtmqi" + * } + * } + * + * id:消息 ID + * ``` + * + * @param msgObj 消息体 + */ + async pushMsg(t) { + return await this.siyuanRequest("/api/notification/pushMsg", t); + } + /** + * 推送报错消息 + * + * 参数 + * + * ``` + * { + * "msg": "test", + * "timeout": 7000 + * } + * ``` + * + * timeout:消息持续显示时间,单位为毫秒。可以不传入该字段,默认为 7000 毫秒 + * + * 返回值 + * + * ``` + * { + * "code": 0, + * "msg": "", + * "data": { + * "id": "qc9znut" + * } + * } + * + * id:消息 ID + * ``` + * + * @param msgObj + */ + async pushErrMsg(t) { + return await this.siyuanRequest("/api/notification/pushErrMsg", t); + } + /** + * 获取块属性 + * @param blockId + */ + async getBlockAttrs(t) { + const r = { + id: t + }, a = "/api/attr/getBlockAttrs"; + return await this.siyuanRequest(a, r); + } + /** + * 设置块属性 + * @param blockId + * @param attrs + */ + async setBlockAttrs(t, r) { + const a = "/api/attr/setBlockAttrs"; + return await this.siyuanRequest(a, { + id: t, + attrs: r + }); + } +} +class fd { +} +class gd { + /** + * 构造思源 API对象 + * + * @param cfg - 环境变量 或者 配置项 + */ + constructor(t) { + /** + * 思源笔记内核API + */ + $e(this, "kernelApi"); + /** + * 思源笔记客户端API + */ + $e(this, "clientApi"); + this.kernelApi = new ea(t), this.clientApi = new fd(); + } +} +class bd extends Es { + /** + * 初始化思源 API 适配器 + * + * @param cfg - 环境变量 或者 配置项 + */ + constructor(r) { + super(); + $e(this, "logger"); + $e(this, "common"); + $e(this, "siyuanKernelApi"); + $e(this, "cfg"); + this.siyuanKernelApi = new ea(r), this.cfg = this.siyuanKernelApi.siyuanConfig; + } + init(r) { + this.logger = gr.zhiLog(r, "siyuan-api-adaptor"), this.common = gr.zhiCommon(r), this.siyuanKernelApi.init(r); + } + async deletePost(r) { + return await super.deletePost(r); + } + async editPost(r, a, s) { + return await super.editPost(r, a, s); + } + async getCategories() { + return Promise.resolve([]); + } + async getPost(r, a, s) { + let l = r; + if (a) { + const P = await this.siyuanKernelApi.getRootBlockBySlug(r); + P && (l = P.root_id); + } + const d = await this.siyuanKernelApi.getBlockByID(l); + if (!d) + throw new Error("文章不存存在,postid=>" + l); + const b = await this.siyuanKernelApi.getBlockAttrs(l); + let _ = !0; + (b["custom-publish-status"] || "draft") === "secret" && (_ = !1); + const f = b["custom-post-password"] || "", E = b["custom-desc"] || ""; + let N = d.content ?? ""; + this.cfg.fixTitle && (N = this.common.htmlUtil.removeTitleNumber(N)); + let A; + if (!s) { + const P = await this.siyuanKernelApi.exportMdContent(l); + A = await this.common.markdownUtil.renderHTML(P.content), A = this.common.htmlUtil.removeWidgetTag(A), this.cfg.fixTitle && (A = this.common.htmlUtil.removeH1(A)); + } + const j = new _n(); + return j.postid = d.root_id || "", j.title = N || "", j.description = A || "", j.shortDesc = E || "", j.mt_keywords = b.tags || "", j.post_status = _ ? Br.PostStatusEnum_Publish : Br.PostStatusEnum_Draft, j.wp_password = f, j; + } + async getPreviewUrl(r) { + return await super.getPreviewUrl(r); + } + async getRecentPosts(r, a, s) { + const l = []; + let d = 0; + a && (d = a); + const b = s ?? "", _ = await this.siyuanKernelApi.getRootBlocks(d, r, b); + this.logger.debug("getRecentPosts from siyuan, get counts =>", _.length); + for (let y = 0; y < _.length; y++) { + const f = _[y], E = await this.siyuanKernelApi.getBlockAttrs(f.root_id), N = await this.getPost(f.root_id, !1, !0), A = E["custom-slug"] || ""; + let j = f.content ?? ""; + this.cfg.fixTitle && (j = this.common.htmlUtil.removeTitleNumber(j)); + const P = new _n(); + P.postid = f.root_id, P.title = j, P.permalink = A === "" ? this.common.strUtil.appendStr("/post/", f.root_id) : this.common.strUtil.appendStr("/post/", A, ".html"), P.mt_keywords = N.mt_keywords, P.description = N.description, l.push(P); + } + return l; + } + async getRecentPostsCount(r) { + return await this.siyuanKernelApi.getRootBlocksCount(r ?? ""); + } + async getUsersBlogs() { + return await super.getUsersBlogs(); + } + async newMediaObject(r) { + return await super.newMediaObject(r); + } + async newPost(r, a) { + return await super.newPost(r, a); + } +} +export { + bd as SiYuanApiAdaptor, + gd as SiyuanApi, + Jn as SiyuanConfig, + Yr as SiyuanConstants, + ea as SiyuanKernelApi +}; diff --git a/public/libs/zhi-siyuan-api/lib/ISiyuanKernelApi.d.ts b/public/libs/zhi-siyuan-api/lib/ISiyuanKernelApi.d.ts new file mode 100644 index 0000000..0856cc6 --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/ISiyuanKernelApi.d.ts @@ -0,0 +1,37 @@ +/** + * 思源 API 返回类型 + */ +interface SiyuanData { + /** + * 非 0 为异常情况 + */ + code: number; + /** + * 正常情况下是空字符串,异常情况下会返回错误文案 + */ + msg: string; + /** + * 可能为 \{\}、[] 或者 NULL,根据不同接口而不同 + */ + data: any[] | object | null | undefined; +} +/** + * 思源笔记内核接口定义 + * + * @see {@link https://github.com/siyuan-note/siyuan/blob/master/API_zh_CN.md#%E9%89%B4%E6%9D%83 siyuan-api} + * @see {@link https://github.com/leolee9086/noob-core/blob/master/frontEnd/noobApi/util/kernelApi.js kernelApi} + */ +interface ISiyuanKernelApi { + lsNotebooks(): Promise; + openNotebook(notebookId: string): Promise; + closeNotebook(notebookId: string): Promise; + renameNotebook(notebookId: string, name: string): Promise; + createNotebook(name: string): Promise; + removeNotebook(notebookId: string): Promise; + getNotebookConf(notebookId: string): Promise; + setNotebookConf(notebookConf: object): Promise; + pushMsg(msgObj: object): Promise; + pushErrMsg(msgObj: object): Promise; +} +export default ISiyuanKernelApi; +export type { SiyuanData }; diff --git a/public/libs/zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts b/public/libs/zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts new file mode 100644 index 0000000..979e2a9 --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/ZhiSiyuanApiUtil.d.ts @@ -0,0 +1,30 @@ +/** + * 工具类统一入口,每个应用自己实现 + * + * @public + * @author terwer + * @since 1.0.0 + */ +declare class ZhiSiyuanApiUtil { + private static env; + /** + * 通用环境变量 + * + * @param appInstance - 插件实例 + */ + static zhiEnv(appInstance: any): any; + /** + * 通用日志 + * + * @param appInstance - 应用实例 + * @param loggerName - 日志名称 + */ + static zhiLog(appInstance: any, loggerName: string): any; + /** + * 通用工具入口 + * + * @param appInstance - 应用实例 + */ + static zhiCommon(appInstance: any): any; +} +export default ZhiSiyuanApiUtil; diff --git a/public/libs/zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts b/public/libs/zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts new file mode 100644 index 0000000..55da6ca --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/siYuanApiAdaptor.d.ts @@ -0,0 +1,34 @@ +import { BlogApi, CategoryInfo, MediaObject, Post, UserBlog } from "zhi-blog-api"; +import { Env } from "zhi-env"; +import SiyuanConfig from "./siyuanConfig"; +/** + * 思源笔记API适配器 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class SiYuanApiAdaptor extends BlogApi { + private logger; + private common; + private readonly siyuanKernelApi; + private readonly cfg; + /** + * 初始化思源 API 适配器 + * + * @param cfg - 环境变量 或者 配置项 + */ + constructor(cfg: Env | SiyuanConfig); + init(appInstance: any): void; + deletePost(postid: string): Promise; + editPost(postid: string, post: Post, publish?: boolean): Promise; + getCategories(): Promise; + getPost(postid: string, useSlug?: boolean, skipBody?: boolean): Promise; + getPreviewUrl(postid: string): Promise; + getRecentPosts(numOfPosts: number, page?: number, keyword?: string): Promise>; + getRecentPostsCount(keyword?: string): Promise; + getUsersBlogs(): Promise>; + newMediaObject(mediaObject: MediaObject): Promise; + newPost(post: Post, publish?: boolean): Promise; +} +export default SiYuanApiAdaptor; diff --git a/public/libs/zhi-siyuan-api/lib/siyuanApi.d.ts b/public/libs/zhi-siyuan-api/lib/siyuanApi.d.ts new file mode 100644 index 0000000..c97c12c --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/siyuanApi.d.ts @@ -0,0 +1,25 @@ +import { Env } from "zhi-env"; +import SiyuanConfig from "./siyuanConfig"; +/** + * 思源笔记API + * + * @author terwer + * @since 1.0.0 + */ +declare class SiyuanApi { + /** + * 思源笔记内核API + */ + readonly kernelApi: any; + /** + * 思源笔记客户端API + */ + readonly clientApi: any; + /** + * 构造思源 API对象 + * + * @param cfg - 环境变量 或者 配置项 + */ + constructor(cfg: Env | SiyuanConfig); +} +export default SiyuanApi; diff --git a/public/libs/zhi-siyuan-api/lib/siyuanClientApi.d.ts b/public/libs/zhi-siyuan-api/lib/siyuanClientApi.d.ts new file mode 100644 index 0000000..d4dc66f --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/siyuanClientApi.d.ts @@ -0,0 +1,3 @@ +declare class SiyuanClientApi { +} +export default SiyuanClientApi; diff --git a/public/libs/zhi-siyuan-api/lib/siyuanConfig.d.ts b/public/libs/zhi-siyuan-api/lib/siyuanConfig.d.ts new file mode 100644 index 0000000..95b1155 --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/siyuanConfig.d.ts @@ -0,0 +1,32 @@ +import { BlogConfig } from "zhi-blog-api"; +import SiyuanPlaceholder from "./siyuanPlaceholder"; +/** + * 思源笔记配置 + * + * @author terwer + * @since 1.0.0 + */ +declare class SiyuanConfig extends BlogConfig { + /** + * 思源笔记伺服地址 + */ + apiUrl: string; + /** + * 思源笔记 API token + */ + password: string; + /** + * 思源笔记操作提示 + * + * @protected + */ + placeholder: SiyuanPlaceholder; + /** + * 是否修复标题 + * + * @protected + */ + fixTitle: boolean; + constructor(apiUrl?: string, password?: string); +} +export default SiyuanConfig; diff --git a/public/libs/zhi-siyuan-api/lib/siyuanConstants.d.ts b/public/libs/zhi-siyuan-api/lib/siyuanConstants.d.ts new file mode 100644 index 0000000..9d5aa17 --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/siyuanConstants.d.ts @@ -0,0 +1,18 @@ +/** + * 预定义思源变量 + * + * @author terwer + * @version 1.0.0 + * @since 1.0.0 + */ +declare class SiyuanConstants { + /** + * 思源 API 伺服地址 + */ + static VITE_SIYUAN_API_URL_KEY: string; + /** + * 思源 token + */ + static VITE_SIYUAN_AUTH_TOKEN_KEY: string; +} +export default SiyuanConstants; diff --git a/public/libs/zhi-siyuan-api/lib/siyuanKernelApi.d.ts b/public/libs/zhi-siyuan-api/lib/siyuanKernelApi.d.ts new file mode 100644 index 0000000..c49e28c --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/siyuanKernelApi.d.ts @@ -0,0 +1,263 @@ +import { Env } from "zhi-env"; +import SiyuanConfig from "./siyuanConfig"; +import ISiyuanKernelApi, { type SiyuanData } from "./ISiyuanKernelApi"; +/** + * 思源笔记服务端API v2.8.2 + * + * 1. 均是 POST 方法 + * + * 2. 需要带参的接口,参数为 JSON 字符串,放置到 body 里,标头 Content-Type 为 application/json + * + * 3. 鉴权:在 `设置` - `关于` 里查看 API token,请求标头:Authorization: Token xxx + * + * @public + * @author terwer + * @since 1.0.0 + * @see {@link https://github.com/siyuan-note/siyuan/blob/master/API_zh_CN.md#%E9%89%B4%E6%9D%83 siyuan-api} + * @see {@link https://github.com/leolee9086/noob-core/blob/master/frontEnd/noobApi/util/kernelApi.js kernelApi} + */ +declare class SiyuanKernelApi implements ISiyuanKernelApi { + /** + * 思源笔记服务端API版本号 + */ + readonly VERSION: any; + private logger; + private env; + private common; + readonly siyuanConfig: any; + /** + * 初始化思源服务端 API + * + * @param cfg - 环境变量 或者 配置项 + */ + constructor(cfg: Env | SiyuanConfig); + init(appInstance: any): void; + /** + * 分页获取根文档 + * + * @param keyword - 关键字 + */ + getRootBlocksCount(keyword: string): Promise; + /** + * 分页获取根文档 + + * ```sql + * select DISTINCT b2.root_id,b2.parent_id,b2.content from blocks b2 + * WHERE 1==1 + * AND b2.id IN ( + * SELECT DISTINCT b1.root_id + * FROM blocks b1 + * WHERE 1 = 1 + * AND ((b1.content LIKE '%github%') OR (b1.tag LIKE '%github%')) + * ORDER BY b1.updated DESC,b1.created DESC LIMIT 0,10 + * ) + * ORDER BY b2.updated DESC,b2.created DESC + * ``` + * + * @param page 页码 + * @param pagesize 数目 + * @param keyword 可选,搜索关键字 + */ + getRootBlocks(page: number, pagesize: number, keyword: string): Promise; + /** + * 获取该文档下面的子文档个数 + * + * ```sql + * SELECT COUNT(DISTINCT b1.root_id) AS count + * FROM blocks b1 + * WHERE b1.path LIKE '%/20220927094918-1d85uyp%'; + * ``` + * + * @param docId 文档ID + */ + getSubdocCount(docId: string): Promise; + /** + * 分页获取子文档 + * + * ```sql + * SELECT DISTINCT b2.root_id,b2.content,b2.path FROM blocks b2 + * WHERE b2.id IN ( + * SELECT DISTINCT b1.root_id + * FROM blocks b1 + * WHERE b1.path like '%/20220927094918-1d85uyp%' + * AND ((b1.content LIKE '%文档%') OR (b1.tag LIKE '%文档%')) + * ORDER BY b1.updated DESC,b1.created DESC LIMIT 0,10 + * ) + * ORDER BY b2.updated DESC,b2.created DESC + * ``` + * + * @param docId 文档ID + * @param page 页码 + * @param pagesize 数目 + * @param keyword 关键字 + */ + getSubdocs(docId: string, page: number, pagesize: number, keyword: string): Promise; + /** + * 以id获取思源块信息 + * @param blockId 块ID + */ + getBlockByID(blockId: string): Promise; + /** + * 以slug获取思源块信息 + * @param slug 内容快别名 + */ + getRootBlockBySlug(slug: string): Promise; + /** + * 以内容块ID获取根块 + * + * @param blockID 内容块ID + */ + getRootBlock(blockID: string): Promise; + /** + * 导出markdown文本 + * @param docId 文档id + */ + exportMdContent(docId: string): Promise; + /** + * 以sql发送请求 + * + * @param sql - sql + */ + sql(sql: string): Promise; + /** + * 向思源请求数据 + * + * @param url - url + * @param data - 数据 + */ + siyuanRequest(url: string, data: object): Promise; + /** + * 列出笔记本 + */ + lsNotebooks(): Promise; + /** + * 打开笔记本 + * + * @param notebookId - 笔记本ID + */ + openNotebook(notebookId: string): Promise; + /** + * 关闭笔记本 + * + * @param notebookId - 笔记本ID + */ + closeNotebook(notebookId: string): Promise; + /** + * 重命名笔记本 + * + * @param notebookId - 笔记本ID + * @param name - 新笔记本名称 + */ + renameNotebook(notebookId: string, name: string): Promise; + /** + * 创建笔记本 + * + * @param name - 新笔记本名称 + */ + createNotebook(name: string): Promise; + /** + * 删除笔记本 + * + * @param notebookId - 笔记本ID + */ + removeNotebook(notebookId: string): Promise; + /** + * 获取笔记本配置 + * + * @param notebookId - 笔记本ID + */ + getNotebookConf(notebookId: string): Promise; + /** + * 保存笔记本配置 + * + * ```json + * { + * "notebook": "20210817205410-2kvfpfn", + * "conf": { + * "name": "测试笔记本", + * "closed": false, + * "refCreateSavePath": "", + * "createDocNameTemplate": "", + * "dailyNoteSavePath": "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}", + * "dailyNoteTemplatePath": "" + * } + * } + * ``` + * @param notebookConf - 笔记本配置 + */ + setNotebookConf(notebookConf: object): Promise; + /** + * 推送消息 + * + * 参数 + * + * ```json + * { + * "msg": "test", + * "timeout": 7000 + * } + * ``` + * + * timeout:消息持续显示时间,单位为毫秒。可以不传入该字段,默认为 7000 毫秒 + * + * 返回值 + * + * ``` + * { + * "code": 0, + * "msg": "", + * "data": { + * "id": "62jtmqi" + * } + * } + * + * id:消息 ID + * ``` + * + * @param msgObj 消息体 + */ + pushMsg(msgObj: object): Promise; + /** + * 推送报错消息 + * + * 参数 + * + * ``` + * { + * "msg": "test", + * "timeout": 7000 + * } + * ``` + * + * timeout:消息持续显示时间,单位为毫秒。可以不传入该字段,默认为 7000 毫秒 + * + * 返回值 + * + * ``` + * { + * "code": 0, + * "msg": "", + * "data": { + * "id": "qc9znut" + * } + * } + * + * id:消息 ID + * ``` + * + * @param msgObj + */ + pushErrMsg(msgObj: object): Promise; + /** + * 获取块属性 + * @param blockId + */ + getBlockAttrs(blockId: string): Promise; + /** + * 设置块属性 + * @param blockId + * @param attrs + */ + setBlockAttrs(blockId: string, attrs: any): Promise; +} +export default SiyuanKernelApi; diff --git a/public/libs/zhi-siyuan-api/lib/siyuanPlaceholder.d.ts b/public/libs/zhi-siyuan-api/lib/siyuanPlaceholder.d.ts new file mode 100644 index 0000000..cc02ab2 --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/siyuanPlaceholder.d.ts @@ -0,0 +1,7 @@ +import { BlogPlaceholder } from "zhi-blog-api"; +/** + * 思源笔记操作提示 + */ +declare class SiyuanPlaceholder extends BlogPlaceholder { +} +export default SiyuanPlaceholder; diff --git a/public/libs/zhi-siyuan-api/lib/zhi-siyuan-api.d.ts b/public/libs/zhi-siyuan-api/lib/zhi-siyuan-api.d.ts new file mode 100644 index 0000000..c6b724d --- /dev/null +++ b/public/libs/zhi-siyuan-api/lib/zhi-siyuan-api.d.ts @@ -0,0 +1,2 @@ +import SiyuanApi from "./siyuanApi"; +export default SiyuanApi; diff --git a/public/libs/zhi-siyuan-api/package.json b/public/libs/zhi-siyuan-api/package.json new file mode 100644 index 0000000..2d3d777 --- /dev/null +++ b/public/libs/zhi-siyuan-api/package.json @@ -0,0 +1,40 @@ +{ + "name": "zhi-siyuan-api", + "version": "1.1.3", + "type": "module", + "description": "a siyuan-note api including both kernel and client", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "repository": "terwer/zhi", + "homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-siyuan-api", + "author": "terwer", + "license": "GPL", + "files": [ + "dist", + "README.md" + ], + "keywords": [ + "zhi", + "lib", + "siyuan", + "note", + "api" + ], + "scripts": { + "serve": "vite", + "dev": "vite build --watch", + "build": "vite build", + "start": "vite preview", + "test": "vitest --watch" + }, + "devDependencies": { + "@terwer/eslint-config-custom": "workspace:*", + "@terwer/tsconfig": "workspace:*", + "@terwer/vite-config-custom": "workspace:*" + }, + "dependencies": { + "zhi-env": "workspace:*", + "zhi-log": "workspace:*", + "zhi-blog-api": "workspace:*" + } +} diff --git a/public/polyfills/fs.js b/public/polyfills/fs.js new file mode 100644 index 0000000..43dba96 --- /dev/null +++ b/public/polyfills/fs.js @@ -0,0 +1,123 @@ +import mimes from "./mimeDb.js" +import path from "./path.js" +export let readFile = async (file) => { + let res = await fetch("/api/file/getFile", { + method: "POST", + body: JSON.stringify({ + path: file, + }), + }) + if (res.status !== 200) { + console.error(`${file}读取错误`) + } + let mime = res.headers.get("Content-Type") + if (isText(mime)) { + return await res.text() + } else { + let buf = await res.arrayBuffer() + return buf + } +} +let mimetype = {} +Object.getOwnPropertyNames(mimes).forEach((type) => { + let extensions = mimes[type]["extensions"] + if (extensions) { + extensions.forEach((extension) => { + mimetype[extension] = type + }) + } +}) +export let writeFile = async (content, path, flag) => { + if (!flag) { + let extension = path.split(".").pop() + let blob = new Blob([content], { + type: mimetype[extension] || "text/plain", + }) + let file = new File([blob], path.split("/").pop(), { + lastModified: Date.now(), + }) + return await writeFileDirectly(file, path) + } else { + return await writeFileDirectly(content, path) + } +} +export let writeFileDirectly = async (file, path) => { + let data = new FormData() + data.append("path", path) + data.append("file", file) + data.append("isDir", false) + data.append("modTime", Date.now()) + let res = await fetch("/api/file/putFile", { + method: "POST", + body: data, + }) + return await res.json() +} +export let readDir = async (path) => { + let res = await fetch("/api/file/readDir", { + method: "POST", + body: JSON.stringify({ + path: path, + }), + }) + if (res.status !== 200) { + console.error(`${path}读取错误`) + } + let { data } = await res.json() + return data +} +export let exists = async (name) => { + try { + let files = await readDir(path.dirname(name)) + let result = files.find((file) => { + return path.join(path.dirname(name), file.name) === name + }) + + return result || undefined + } catch (e) { + console.warn(`工作空间内容读取错误:${e}`) + return undefined + } +} +export let mkdir = async (path) => { + let data = new FormData() + data.append("path", path) + data.append("file", "") + data.append("isDir", true) + data.append("modTime", Date.now()) + let res = await fetch("/api/file/putFile", { + method: "POST", + body: data, + }) + return await res.json() +} + +export function isText(mime) { + if (mime && mime.startsWith("text")) { + return true + } + if (mime === "application/json") { + return true + } + if (mime === "application/x-javascript") { + return true + } else return false +} +let fs = { + readFile, + writeFile, + readDir, + exists, + mkdir, +} + +export default fs +export let initFile = async (path, data) => { + if (!(await exists(path))) { + if (data === undefined) { + await writeFile("", path) + } else { + await writeFile(data, path) + } + } +} diff --git a/public/polyfills/mimeDb.js b/public/polyfills/mimeDb.js new file mode 100644 index 0000000..b2ef0fd --- /dev/null +++ b/public/polyfills/mimeDb.js @@ -0,0 +1,8540 @@ +export default { + "application/1d-interleaved-parityfec": { + source: "iana", + }, + "application/3gpdash-qoe-report+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/3gpp-ims+xml": { + source: "iana", + compressible: true, + }, + "application/3gpphal+json": { + source: "iana", + compressible: true, + }, + "application/3gpphalforms+json": { + source: "iana", + compressible: true, + }, + "application/a2l": { + source: "iana", + }, + "application/ace+cbor": { + source: "iana", + }, + "application/activemessage": { + source: "iana", + }, + "application/activity+json": { + source: "iana", + compressible: true, + }, + "application/alto-costmap+json": { + source: "iana", + compressible: true, + }, + "application/alto-costmapfilter+json": { + source: "iana", + compressible: true, + }, + "application/alto-directory+json": { + source: "iana", + compressible: true, + }, + "application/alto-endpointcost+json": { + source: "iana", + compressible: true, + }, + "application/alto-endpointcostparams+json": { + source: "iana", + compressible: true, + }, + "application/alto-endpointprop+json": { + source: "iana", + compressible: true, + }, + "application/alto-endpointpropparams+json": { + source: "iana", + compressible: true, + }, + "application/alto-error+json": { + source: "iana", + compressible: true, + }, + "application/alto-networkmap+json": { + source: "iana", + compressible: true, + }, + "application/alto-networkmapfilter+json": { + source: "iana", + compressible: true, + }, + "application/alto-updatestreamcontrol+json": { + source: "iana", + compressible: true, + }, + "application/alto-updatestreamparams+json": { + source: "iana", + compressible: true, + }, + "application/aml": { + source: "iana", + }, + "application/andrew-inset": { + source: "iana", + extensions: ["ez"], + }, + "application/applefile": { + source: "iana", + }, + "application/applixware": { + source: "apache", + extensions: ["aw"], + }, + "application/at+jwt": { + source: "iana", + }, + "application/atf": { + source: "iana", + }, + "application/atfx": { + source: "iana", + }, + "application/atom+xml": { + source: "iana", + compressible: true, + extensions: ["atom"], + }, + "application/atomcat+xml": { + source: "iana", + compressible: true, + extensions: ["atomcat"], + }, + "application/atomdeleted+xml": { + source: "iana", + compressible: true, + extensions: ["atomdeleted"], + }, + "application/atomicmail": { + source: "iana", + }, + "application/atomsvc+xml": { + source: "iana", + compressible: true, + extensions: ["atomsvc"], + }, + "application/atsc-dwd+xml": { + source: "iana", + compressible: true, + extensions: ["dwd"], + }, + "application/atsc-dynamic-event-message": { + source: "iana", + }, + "application/atsc-held+xml": { + source: "iana", + compressible: true, + extensions: ["held"], + }, + "application/atsc-rdt+json": { + source: "iana", + compressible: true, + }, + "application/atsc-rsat+xml": { + source: "iana", + compressible: true, + extensions: ["rsat"], + }, + "application/atxml": { + source: "iana", + }, + "application/auth-policy+xml": { + source: "iana", + compressible: true, + }, + "application/bacnet-xdd+zip": { + source: "iana", + compressible: false, + }, + "application/batch-smtp": { + source: "iana", + }, + "application/bdoc": { + compressible: false, + extensions: ["bdoc"], + }, + "application/beep+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/calendar+json": { + source: "iana", + compressible: true, + }, + "application/calendar+xml": { + source: "iana", + compressible: true, + extensions: ["xcs"], + }, + "application/call-completion": { + source: "iana", + }, + "application/cals-1840": { + source: "iana", + }, + "application/captive+json": { + source: "iana", + compressible: true, + }, + "application/cbor": { + source: "iana", + }, + "application/cbor-seq": { + source: "iana", + }, + "application/cccex": { + source: "iana", + }, + "application/ccmp+xml": { + source: "iana", + compressible: true, + }, + "application/ccxml+xml": { + source: "iana", + compressible: true, + extensions: ["ccxml"], + }, + "application/cdfx+xml": { + source: "iana", + compressible: true, + extensions: ["cdfx"], + }, + "application/cdmi-capability": { + source: "iana", + extensions: ["cdmia"], + }, + "application/cdmi-container": { + source: "iana", + extensions: ["cdmic"], + }, + "application/cdmi-domain": { + source: "iana", + extensions: ["cdmid"], + }, + "application/cdmi-object": { + source: "iana", + extensions: ["cdmio"], + }, + "application/cdmi-queue": { + source: "iana", + extensions: ["cdmiq"], + }, + "application/cdni": { + source: "iana", + }, + "application/cea": { + source: "iana", + }, + "application/cea-2018+xml": { + source: "iana", + compressible: true, + }, + "application/cellml+xml": { + source: "iana", + compressible: true, + }, + "application/cfw": { + source: "iana", + }, + "application/city+json": { + source: "iana", + compressible: true, + }, + "application/clr": { + source: "iana", + }, + "application/clue+xml": { + source: "iana", + compressible: true, + }, + "application/clue_info+xml": { + source: "iana", + compressible: true, + }, + "application/cms": { + source: "iana", + }, + "application/cnrp+xml": { + source: "iana", + compressible: true, + }, + "application/coap-group+json": { + source: "iana", + compressible: true, + }, + "application/coap-payload": { + source: "iana", + }, + "application/commonground": { + source: "iana", + }, + "application/conference-info+xml": { + source: "iana", + compressible: true, + }, + "application/cose": { + source: "iana", + }, + "application/cose-key": { + source: "iana", + }, + "application/cose-key-set": { + source: "iana", + }, + "application/cpl+xml": { + source: "iana", + compressible: true, + extensions: ["cpl"], + }, + "application/csrattrs": { + source: "iana", + }, + "application/csta+xml": { + source: "iana", + compressible: true, + }, + "application/cstadata+xml": { + source: "iana", + compressible: true, + }, + "application/csvm+json": { + source: "iana", + compressible: true, + }, + "application/cu-seeme": { + source: "apache", + extensions: ["cu"], + }, + "application/cwt": { + source: "iana", + }, + "application/cybercash": { + source: "iana", + }, + "application/dart": { + compressible: true, + }, + "application/dash+xml": { + source: "iana", + compressible: true, + extensions: ["mpd"], + }, + "application/dash-patch+xml": { + source: "iana", + compressible: true, + extensions: ["mpp"], + }, + "application/dashdelta": { + source: "iana", + }, + "application/davmount+xml": { + source: "iana", + compressible: true, + extensions: ["davmount"], + }, + "application/dca-rft": { + source: "iana", + }, + "application/dcd": { + source: "iana", + }, + "application/dec-dx": { + source: "iana", + }, + "application/dialog-info+xml": { + source: "iana", + compressible: true, + }, + "application/dicom": { + source: "iana", + }, + "application/dicom+json": { + source: "iana", + compressible: true, + }, + "application/dicom+xml": { + source: "iana", + compressible: true, + }, + "application/dii": { + source: "iana", + }, + "application/dit": { + source: "iana", + }, + "application/dns": { + source: "iana", + }, + "application/dns+json": { + source: "iana", + compressible: true, + }, + "application/dns-message": { + source: "iana", + }, + "application/docbook+xml": { + source: "apache", + compressible: true, + extensions: ["dbk"], + }, + "application/dots+cbor": { + source: "iana", + }, + "application/dskpp+xml": { + source: "iana", + compressible: true, + }, + "application/dssc+der": { + source: "iana", + extensions: ["dssc"], + }, + "application/dssc+xml": { + source: "iana", + compressible: true, + extensions: ["xdssc"], + }, + "application/dvcs": { + source: "iana", + }, + "application/ecmascript": { + source: "iana", + compressible: true, + extensions: ["es", "ecma"], + }, + "application/edi-consent": { + source: "iana", + }, + "application/edi-x12": { + source: "iana", + compressible: false, + }, + "application/edifact": { + source: "iana", + compressible: false, + }, + "application/efi": { + source: "iana", + }, + "application/elm+json": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/elm+xml": { + source: "iana", + compressible: true, + }, + "application/emergencycalldata.cap+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/emergencycalldata.comment+xml": { + source: "iana", + compressible: true, + }, + "application/emergencycalldata.control+xml": { + source: "iana", + compressible: true, + }, + "application/emergencycalldata.deviceinfo+xml": { + source: "iana", + compressible: true, + }, + "application/emergencycalldata.ecall.msd": { + source: "iana", + }, + "application/emergencycalldata.providerinfo+xml": { + source: "iana", + compressible: true, + }, + "application/emergencycalldata.serviceinfo+xml": { + source: "iana", + compressible: true, + }, + "application/emergencycalldata.subscriberinfo+xml": { + source: "iana", + compressible: true, + }, + "application/emergencycalldata.veds+xml": { + source: "iana", + compressible: true, + }, + "application/emma+xml": { + source: "iana", + compressible: true, + extensions: ["emma"], + }, + "application/emotionml+xml": { + source: "iana", + compressible: true, + extensions: ["emotionml"], + }, + "application/encaprtp": { + source: "iana", + }, + "application/epp+xml": { + source: "iana", + compressible: true, + }, + "application/epub+zip": { + source: "iana", + compressible: false, + extensions: ["epub"], + }, + "application/eshop": { + source: "iana", + }, + "application/exi": { + source: "iana", + extensions: ["exi"], + }, + "application/expect-ct-report+json": { + source: "iana", + compressible: true, + }, + "application/express": { + source: "iana", + extensions: ["exp"], + }, + "application/fastinfoset": { + source: "iana", + }, + "application/fastsoap": { + source: "iana", + }, + "application/fdt+xml": { + source: "iana", + compressible: true, + extensions: ["fdt"], + }, + "application/fhir+json": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/fhir+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/fido.trusted-apps+json": { + compressible: true, + }, + "application/fits": { + source: "iana", + }, + "application/flexfec": { + source: "iana", + }, + "application/font-sfnt": { + source: "iana", + }, + "application/font-tdpfr": { + source: "iana", + extensions: ["pfr"], + }, + "application/font-woff": { + source: "iana", + compressible: false, + }, + "application/framework-attributes+xml": { + source: "iana", + compressible: true, + }, + "application/geo+json": { + source: "iana", + compressible: true, + extensions: ["geojson"], + }, + "application/geo+json-seq": { + source: "iana", + }, + "application/geopackage+sqlite3": { + source: "iana", + }, + "application/geoxacml+xml": { + source: "iana", + compressible: true, + }, + "application/gltf-buffer": { + source: "iana", + }, + "application/gml+xml": { + source: "iana", + compressible: true, + extensions: ["gml"], + }, + "application/gpx+xml": { + source: "apache", + compressible: true, + extensions: ["gpx"], + }, + "application/gxf": { + source: "apache", + extensions: ["gxf"], + }, + "application/gzip": { + source: "iana", + compressible: false, + extensions: ["gz"], + }, + "application/h224": { + source: "iana", + }, + "application/held+xml": { + source: "iana", + compressible: true, + }, + "application/hjson": { + extensions: ["hjson"], + }, + "application/http": { + source: "iana", + }, + "application/hyperstudio": { + source: "iana", + extensions: ["stk"], + }, + "application/ibe-key-request+xml": { + source: "iana", + compressible: true, + }, + "application/ibe-pkg-reply+xml": { + source: "iana", + compressible: true, + }, + "application/ibe-pp-data": { + source: "iana", + }, + "application/iges": { + source: "iana", + }, + "application/im-iscomposing+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/index": { + source: "iana", + }, + "application/index.cmd": { + source: "iana", + }, + "application/index.obj": { + source: "iana", + }, + "application/index.response": { + source: "iana", + }, + "application/index.vnd": { + source: "iana", + }, + "application/inkml+xml": { + source: "iana", + compressible: true, + extensions: ["ink", "inkml"], + }, + "application/iotp": { + source: "iana", + }, + "application/ipfix": { + source: "iana", + extensions: ["ipfix"], + }, + "application/ipp": { + source: "iana", + }, + "application/isup": { + source: "iana", + }, + "application/its+xml": { + source: "iana", + compressible: true, + extensions: ["its"], + }, + "application/java-archive": { + source: "apache", + compressible: false, + extensions: ["jar", "war", "ear"], + }, + "application/java-serialized-object": { + source: "apache", + compressible: false, + extensions: ["ser"], + }, + "application/java-vm": { + source: "apache", + compressible: false, + extensions: ["class"], + }, + "application/javascript": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["js", "mjs"], + }, + "application/jf2feed+json": { + source: "iana", + compressible: true, + }, + "application/jose": { + source: "iana", + }, + "application/jose+json": { + source: "iana", + compressible: true, + }, + "application/jrd+json": { + source: "iana", + compressible: true, + }, + "application/jscalendar+json": { + source: "iana", + compressible: true, + }, + "application/json": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["json", "map"], + }, + "application/json-patch+json": { + source: "iana", + compressible: true, + }, + "application/json-seq": { + source: "iana", + }, + "application/json5": { + extensions: ["json5"], + }, + "application/jsonml+json": { + source: "apache", + compressible: true, + extensions: ["jsonml"], + }, + "application/jwk+json": { + source: "iana", + compressible: true, + }, + "application/jwk-set+json": { + source: "iana", + compressible: true, + }, + "application/jwt": { + source: "iana", + }, + "application/kpml-request+xml": { + source: "iana", + compressible: true, + }, + "application/kpml-response+xml": { + source: "iana", + compressible: true, + }, + "application/ld+json": { + source: "iana", + compressible: true, + extensions: ["jsonld"], + }, + "application/lgr+xml": { + source: "iana", + compressible: true, + extensions: ["lgr"], + }, + "application/link-format": { + source: "iana", + }, + "application/load-control+xml": { + source: "iana", + compressible: true, + }, + "application/lost+xml": { + source: "iana", + compressible: true, + extensions: ["lostxml"], + }, + "application/lostsync+xml": { + source: "iana", + compressible: true, + }, + "application/lpf+zip": { + source: "iana", + compressible: false, + }, + "application/lxf": { + source: "iana", + }, + "application/mac-binhex40": { + source: "iana", + extensions: ["hqx"], + }, + "application/mac-compactpro": { + source: "apache", + extensions: ["cpt"], + }, + "application/macwriteii": { + source: "iana", + }, + "application/mads+xml": { + source: "iana", + compressible: true, + extensions: ["mads"], + }, + "application/manifest+json": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["webmanifest"], + }, + "application/marc": { + source: "iana", + extensions: ["mrc"], + }, + "application/marcxml+xml": { + source: "iana", + compressible: true, + extensions: ["mrcx"], + }, + "application/mathematica": { + source: "iana", + extensions: ["ma", "nb", "mb"], + }, + "application/mathml+xml": { + source: "iana", + compressible: true, + extensions: ["mathml"], + }, + "application/mathml-content+xml": { + source: "iana", + compressible: true, + }, + "application/mathml-presentation+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-associated-procedure-description+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-deregister+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-envelope+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-msk+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-msk-response+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-protection-description+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-reception-report+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-register+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-register-response+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-schedule+xml": { + source: "iana", + compressible: true, + }, + "application/mbms-user-service-description+xml": { + source: "iana", + compressible: true, + }, + "application/mbox": { + source: "iana", + extensions: ["mbox"], + }, + "application/media-policy-dataset+xml": { + source: "iana", + compressible: true, + extensions: ["mpf"], + }, + "application/media_control+xml": { + source: "iana", + compressible: true, + }, + "application/mediaservercontrol+xml": { + source: "iana", + compressible: true, + extensions: ["mscml"], + }, + "application/merge-patch+json": { + source: "iana", + compressible: true, + }, + "application/metalink+xml": { + source: "apache", + compressible: true, + extensions: ["metalink"], + }, + "application/metalink4+xml": { + source: "iana", + compressible: true, + extensions: ["meta4"], + }, + "application/mets+xml": { + source: "iana", + compressible: true, + extensions: ["mets"], + }, + "application/mf4": { + source: "iana", + }, + "application/mikey": { + source: "iana", + }, + "application/mipc": { + source: "iana", + }, + "application/missing-blocks+cbor-seq": { + source: "iana", + }, + "application/mmt-aei+xml": { + source: "iana", + compressible: true, + extensions: ["maei"], + }, + "application/mmt-usd+xml": { + source: "iana", + compressible: true, + extensions: ["musd"], + }, + "application/mods+xml": { + source: "iana", + compressible: true, + extensions: ["mods"], + }, + "application/moss-keys": { + source: "iana", + }, + "application/moss-signature": { + source: "iana", + }, + "application/mosskey-data": { + source: "iana", + }, + "application/mosskey-request": { + source: "iana", + }, + "application/mp21": { + source: "iana", + extensions: ["m21", "mp21"], + }, + "application/mp4": { + source: "iana", + extensions: ["mp4s", "m4p"], + }, + "application/mpeg4-generic": { + source: "iana", + }, + "application/mpeg4-iod": { + source: "iana", + }, + "application/mpeg4-iod-xmt": { + source: "iana", + }, + "application/mrb-consumer+xml": { + source: "iana", + compressible: true, + }, + "application/mrb-publish+xml": { + source: "iana", + compressible: true, + }, + "application/msc-ivr+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/msc-mixer+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/msword": { + source: "iana", + compressible: false, + extensions: ["doc", "dot"], + }, + "application/mud+json": { + source: "iana", + compressible: true, + }, + "application/multipart-core": { + source: "iana", + }, + "application/mxf": { + source: "iana", + extensions: ["mxf"], + }, + "application/n-quads": { + source: "iana", + extensions: ["nq"], + }, + "application/n-triples": { + source: "iana", + extensions: ["nt"], + }, + "application/nasdata": { + source: "iana", + }, + "application/news-checkgroups": { + source: "iana", + charset: "US-ASCII", + }, + "application/news-groupinfo": { + source: "iana", + charset: "US-ASCII", + }, + "application/news-transmission": { + source: "iana", + }, + "application/nlsml+xml": { + source: "iana", + compressible: true, + }, + "application/node": { + source: "iana", + extensions: ["cjs"], + }, + "application/nss": { + source: "iana", + }, + "application/oauth-authz-req+jwt": { + source: "iana", + }, + "application/oblivious-dns-message": { + source: "iana", + }, + "application/ocsp-request": { + source: "iana", + }, + "application/ocsp-response": { + source: "iana", + }, + "application/octet-stream": { + source: "iana", + compressible: false, + extensions: [ + "bin", + "dms", + "lrf", + "mar", + "so", + "dist", + "distz", + "pkg", + "bpk", + "dump", + "elc", + "deploy", + "exe", + "dll", + "deb", + "dmg", + "iso", + "img", + "msi", + "msp", + "msm", + "buffer", + ], + }, + "application/oda": { + source: "iana", + extensions: ["oda"], + }, + "application/odm+xml": { + source: "iana", + compressible: true, + }, + "application/odx": { + source: "iana", + }, + "application/oebps-package+xml": { + source: "iana", + compressible: true, + extensions: ["opf"], + }, + "application/ogg": { + source: "iana", + compressible: false, + extensions: ["ogx"], + }, + "application/omdoc+xml": { + source: "apache", + compressible: true, + extensions: ["omdoc"], + }, + "application/onenote": { + source: "apache", + extensions: ["onetoc", "onetoc2", "onetmp", "onepkg"], + }, + "application/opc-nodeset+xml": { + source: "iana", + compressible: true, + }, + "application/oscore": { + source: "iana", + }, + "application/oxps": { + source: "iana", + extensions: ["oxps"], + }, + "application/p21": { + source: "iana", + }, + "application/p21+zip": { + source: "iana", + compressible: false, + }, + "application/p2p-overlay+xml": { + source: "iana", + compressible: true, + extensions: ["relo"], + }, + "application/parityfec": { + source: "iana", + }, + "application/passport": { + source: "iana", + }, + "application/patch-ops-error+xml": { + source: "iana", + compressible: true, + extensions: ["xer"], + }, + "application/pdf": { + source: "iana", + compressible: false, + extensions: ["pdf"], + }, + "application/pdx": { + source: "iana", + }, + "application/pem-certificate-chain": { + source: "iana", + }, + "application/pgp-encrypted": { + source: "iana", + compressible: false, + extensions: ["pgp"], + }, + "application/pgp-keys": { + source: "iana", + extensions: ["asc"], + }, + "application/pgp-signature": { + source: "iana", + extensions: ["asc", "sig"], + }, + "application/pics-rules": { + source: "apache", + extensions: ["prf"], + }, + "application/pidf+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/pidf-diff+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/pkcs10": { + source: "iana", + extensions: ["p10"], + }, + "application/pkcs12": { + source: "iana", + }, + "application/pkcs7-mime": { + source: "iana", + extensions: ["p7m", "p7c"], + }, + "application/pkcs7-signature": { + source: "iana", + extensions: ["p7s"], + }, + "application/pkcs8": { + source: "iana", + extensions: ["p8"], + }, + "application/pkcs8-encrypted": { + source: "iana", + }, + "application/pkix-attr-cert": { + source: "iana", + extensions: ["ac"], + }, + "application/pkix-cert": { + source: "iana", + extensions: ["cer"], + }, + "application/pkix-crl": { + source: "iana", + extensions: ["crl"], + }, + "application/pkix-pkipath": { + source: "iana", + extensions: ["pkipath"], + }, + "application/pkixcmp": { + source: "iana", + extensions: ["pki"], + }, + "application/pls+xml": { + source: "iana", + compressible: true, + extensions: ["pls"], + }, + "application/poc-settings+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/postscript": { + source: "iana", + compressible: true, + extensions: ["ai", "eps", "ps"], + }, + "application/ppsp-tracker+json": { + source: "iana", + compressible: true, + }, + "application/problem+json": { + source: "iana", + compressible: true, + }, + "application/problem+xml": { + source: "iana", + compressible: true, + }, + "application/provenance+xml": { + source: "iana", + compressible: true, + extensions: ["provx"], + }, + "application/prs.alvestrand.titrax-sheet": { + source: "iana", + }, + "application/prs.cww": { + source: "iana", + extensions: ["cww"], + }, + "application/prs.cyn": { + source: "iana", + charset: "7-BIT", + }, + "application/prs.hpub+zip": { + source: "iana", + compressible: false, + }, + "application/prs.nprend": { + source: "iana", + }, + "application/prs.plucker": { + source: "iana", + }, + "application/prs.rdf-xml-crypt": { + source: "iana", + }, + "application/prs.xsf+xml": { + source: "iana", + compressible: true, + }, + "application/pskc+xml": { + source: "iana", + compressible: true, + extensions: ["pskcxml"], + }, + "application/pvd+json": { + source: "iana", + compressible: true, + }, + "application/qsig": { + source: "iana", + }, + "application/raml+yaml": { + compressible: true, + extensions: ["raml"], + }, + "application/raptorfec": { + source: "iana", + }, + "application/rdap+json": { + source: "iana", + compressible: true, + }, + "application/rdf+xml": { + source: "iana", + compressible: true, + extensions: ["rdf", "owl"], + }, + "application/reginfo+xml": { + source: "iana", + compressible: true, + extensions: ["rif"], + }, + "application/relax-ng-compact-syntax": { + source: "iana", + extensions: ["rnc"], + }, + "application/remote-printing": { + source: "iana", + }, + "application/reputon+json": { + source: "iana", + compressible: true, + }, + "application/resource-lists+xml": { + source: "iana", + compressible: true, + extensions: ["rl"], + }, + "application/resource-lists-diff+xml": { + source: "iana", + compressible: true, + extensions: ["rld"], + }, + "application/rfc+xml": { + source: "iana", + compressible: true, + }, + "application/riscos": { + source: "iana", + }, + "application/rlmi+xml": { + source: "iana", + compressible: true, + }, + "application/rls-services+xml": { + source: "iana", + compressible: true, + extensions: ["rs"], + }, + "application/route-apd+xml": { + source: "iana", + compressible: true, + extensions: ["rapd"], + }, + "application/route-s-tsid+xml": { + source: "iana", + compressible: true, + extensions: ["sls"], + }, + "application/route-usd+xml": { + source: "iana", + compressible: true, + extensions: ["rusd"], + }, + "application/rpki-ghostbusters": { + source: "iana", + extensions: ["gbr"], + }, + "application/rpki-manifest": { + source: "iana", + extensions: ["mft"], + }, + "application/rpki-publication": { + source: "iana", + }, + "application/rpki-roa": { + source: "iana", + extensions: ["roa"], + }, + "application/rpki-updown": { + source: "iana", + }, + "application/rsd+xml": { + source: "apache", + compressible: true, + extensions: ["rsd"], + }, + "application/rss+xml": { + source: "apache", + compressible: true, + extensions: ["rss"], + }, + "application/rtf": { + source: "iana", + compressible: true, + extensions: ["rtf"], + }, + "application/rtploopback": { + source: "iana", + }, + "application/rtx": { + source: "iana", + }, + "application/samlassertion+xml": { + source: "iana", + compressible: true, + }, + "application/samlmetadata+xml": { + source: "iana", + compressible: true, + }, + "application/sarif+json": { + source: "iana", + compressible: true, + }, + "application/sarif-external-properties+json": { + source: "iana", + compressible: true, + }, + "application/sbe": { + source: "iana", + }, + "application/sbml+xml": { + source: "iana", + compressible: true, + extensions: ["sbml"], + }, + "application/scaip+xml": { + source: "iana", + compressible: true, + }, + "application/scim+json": { + source: "iana", + compressible: true, + }, + "application/scvp-cv-request": { + source: "iana", + extensions: ["scq"], + }, + "application/scvp-cv-response": { + source: "iana", + extensions: ["scs"], + }, + "application/scvp-vp-request": { + source: "iana", + extensions: ["spq"], + }, + "application/scvp-vp-response": { + source: "iana", + extensions: ["spp"], + }, + "application/sdp": { + source: "iana", + extensions: ["sdp"], + }, + "application/secevent+jwt": { + source: "iana", + }, + "application/senml+cbor": { + source: "iana", + }, + "application/senml+json": { + source: "iana", + compressible: true, + }, + "application/senml+xml": { + source: "iana", + compressible: true, + extensions: ["senmlx"], + }, + "application/senml-etch+cbor": { + source: "iana", + }, + "application/senml-etch+json": { + source: "iana", + compressible: true, + }, + "application/senml-exi": { + source: "iana", + }, + "application/sensml+cbor": { + source: "iana", + }, + "application/sensml+json": { + source: "iana", + compressible: true, + }, + "application/sensml+xml": { + source: "iana", + compressible: true, + extensions: ["sensmlx"], + }, + "application/sensml-exi": { + source: "iana", + }, + "application/sep+xml": { + source: "iana", + compressible: true, + }, + "application/sep-exi": { + source: "iana", + }, + "application/session-info": { + source: "iana", + }, + "application/set-payment": { + source: "iana", + }, + "application/set-payment-initiation": { + source: "iana", + extensions: ["setpay"], + }, + "application/set-registration": { + source: "iana", + }, + "application/set-registration-initiation": { + source: "iana", + extensions: ["setreg"], + }, + "application/sgml": { + source: "iana", + }, + "application/sgml-open-catalog": { + source: "iana", + }, + "application/shf+xml": { + source: "iana", + compressible: true, + extensions: ["shf"], + }, + "application/sieve": { + source: "iana", + extensions: ["siv", "sieve"], + }, + "application/simple-filter+xml": { + source: "iana", + compressible: true, + }, + "application/simple-message-summary": { + source: "iana", + }, + "application/simplesymbolcontainer": { + source: "iana", + }, + "application/sipc": { + source: "iana", + }, + "application/slate": { + source: "iana", + }, + "application/smil": { + source: "iana", + }, + "application/smil+xml": { + source: "iana", + compressible: true, + extensions: ["smi", "smil"], + }, + "application/smpte336m": { + source: "iana", + }, + "application/soap+fastinfoset": { + source: "iana", + }, + "application/soap+xml": { + source: "iana", + compressible: true, + }, + "application/sparql-query": { + source: "iana", + extensions: ["rq"], + }, + "application/sparql-results+xml": { + source: "iana", + compressible: true, + extensions: ["srx"], + }, + "application/spdx+json": { + source: "iana", + compressible: true, + }, + "application/spirits-event+xml": { + source: "iana", + compressible: true, + }, + "application/sql": { + source: "iana", + }, + "application/srgs": { + source: "iana", + extensions: ["gram"], + }, + "application/srgs+xml": { + source: "iana", + compressible: true, + extensions: ["grxml"], + }, + "application/sru+xml": { + source: "iana", + compressible: true, + extensions: ["sru"], + }, + "application/ssdl+xml": { + source: "apache", + compressible: true, + extensions: ["ssdl"], + }, + "application/ssml+xml": { + source: "iana", + compressible: true, + extensions: ["ssml"], + }, + "application/stix+json": { + source: "iana", + compressible: true, + }, + "application/swid+xml": { + source: "iana", + compressible: true, + extensions: ["swidtag"], + }, + "application/tamp-apex-update": { + source: "iana", + }, + "application/tamp-apex-update-confirm": { + source: "iana", + }, + "application/tamp-community-update": { + source: "iana", + }, + "application/tamp-community-update-confirm": { + source: "iana", + }, + "application/tamp-error": { + source: "iana", + }, + "application/tamp-sequence-adjust": { + source: "iana", + }, + "application/tamp-sequence-adjust-confirm": { + source: "iana", + }, + "application/tamp-status-query": { + source: "iana", + }, + "application/tamp-status-response": { + source: "iana", + }, + "application/tamp-update": { + source: "iana", + }, + "application/tamp-update-confirm": { + source: "iana", + }, + "application/tar": { + compressible: true, + }, + "application/taxii+json": { + source: "iana", + compressible: true, + }, + "application/td+json": { + source: "iana", + compressible: true, + }, + "application/tei+xml": { + source: "iana", + compressible: true, + extensions: ["tei", "teicorpus"], + }, + "application/tetra_isi": { + source: "iana", + }, + "application/thraud+xml": { + source: "iana", + compressible: true, + extensions: ["tfi"], + }, + "application/timestamp-query": { + source: "iana", + }, + "application/timestamp-reply": { + source: "iana", + }, + "application/timestamped-data": { + source: "iana", + extensions: ["tsd"], + }, + "application/tlsrpt+gzip": { + source: "iana", + }, + "application/tlsrpt+json": { + source: "iana", + compressible: true, + }, + "application/tnauthlist": { + source: "iana", + }, + "application/token-introspection+jwt": { + source: "iana", + }, + "application/toml": { + compressible: true, + extensions: ["toml"], + }, + "application/trickle-ice-sdpfrag": { + source: "iana", + }, + "application/trig": { + source: "iana", + extensions: ["trig"], + }, + "application/ttml+xml": { + source: "iana", + compressible: true, + extensions: ["ttml"], + }, + "application/tve-trigger": { + source: "iana", + }, + "application/tzif": { + source: "iana", + }, + "application/tzif-leap": { + source: "iana", + }, + "application/ubjson": { + compressible: false, + extensions: ["ubj"], + }, + "application/ulpfec": { + source: "iana", + }, + "application/urc-grpsheet+xml": { + source: "iana", + compressible: true, + }, + "application/urc-ressheet+xml": { + source: "iana", + compressible: true, + extensions: ["rsheet"], + }, + "application/urc-targetdesc+xml": { + source: "iana", + compressible: true, + extensions: ["td"], + }, + "application/urc-uisocketdesc+xml": { + source: "iana", + compressible: true, + }, + "application/vcard+json": { + source: "iana", + compressible: true, + }, + "application/vcard+xml": { + source: "iana", + compressible: true, + }, + "application/vemmi": { + source: "iana", + }, + "application/vividence.scriptfile": { + source: "apache", + }, + "application/vnd.1000minds.decision-model+xml": { + source: "iana", + compressible: true, + extensions: ["1km"], + }, + "application/vnd.3gpp-prose+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp-prose-pc3ch+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp-v2x-local-service-information": { + source: "iana", + }, + "application/vnd.3gpp.5gnas": { + source: "iana", + }, + "application/vnd.3gpp.access-transfer-events+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.bsf+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.gmop+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.gtpc": { + source: "iana", + }, + "application/vnd.3gpp.interworking-data": { + source: "iana", + }, + "application/vnd.3gpp.lpp": { + source: "iana", + }, + "application/vnd.3gpp.mc-signalling-ear": { + source: "iana", + }, + "application/vnd.3gpp.mcdata-affiliation-command+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcdata-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcdata-payload": { + source: "iana", + }, + "application/vnd.3gpp.mcdata-service-config+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcdata-signalling": { + source: "iana", + }, + "application/vnd.3gpp.mcdata-ue-config+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcdata-user-profile+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-affiliation-command+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-floor-request+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-location-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-mbms-usage-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-service-config+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-signed+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-ue-config+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-ue-init-config+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcptt-user-profile+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-affiliation-command+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-affiliation-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-location-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-mbms-usage-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-service-config+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-transmission-request+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-ue-config+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mcvideo-user-profile+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.mid-call+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.ngap": { + source: "iana", + }, + "application/vnd.3gpp.pfcp": { + source: "iana", + }, + "application/vnd.3gpp.pic-bw-large": { + source: "iana", + extensions: ["plb"], + }, + "application/vnd.3gpp.pic-bw-small": { + source: "iana", + extensions: ["psb"], + }, + "application/vnd.3gpp.pic-bw-var": { + source: "iana", + extensions: ["pvb"], + }, + "application/vnd.3gpp.s1ap": { + source: "iana", + }, + "application/vnd.3gpp.sms": { + source: "iana", + }, + "application/vnd.3gpp.sms+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.srvcc-ext+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.srvcc-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.state-and-event-info+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp.ussd+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp2.bcmcsinfo+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.3gpp2.sms": { + source: "iana", + }, + "application/vnd.3gpp2.tcap": { + source: "iana", + extensions: ["tcap"], + }, + "application/vnd.3lightssoftware.imagescal": { + source: "iana", + }, + "application/vnd.3m.post-it-notes": { + source: "iana", + extensions: ["pwn"], + }, + "application/vnd.accpac.simply.aso": { + source: "iana", + extensions: ["aso"], + }, + "application/vnd.accpac.simply.imp": { + source: "iana", + extensions: ["imp"], + }, + "application/vnd.acucobol": { + source: "iana", + extensions: ["acu"], + }, + "application/vnd.acucorp": { + source: "iana", + extensions: ["atc", "acutc"], + }, + "application/vnd.adobe.air-application-installer-package+zip": { + source: "apache", + compressible: false, + extensions: ["air"], + }, + "application/vnd.adobe.flash.movie": { + source: "iana", + }, + "application/vnd.adobe.formscentral.fcdt": { + source: "iana", + extensions: ["fcdt"], + }, + "application/vnd.adobe.fxp": { + source: "iana", + extensions: ["fxp", "fxpl"], + }, + "application/vnd.adobe.partial-upload": { + source: "iana", + }, + "application/vnd.adobe.xdp+xml": { + source: "iana", + compressible: true, + extensions: ["xdp"], + }, + "application/vnd.adobe.xfdf": { + source: "iana", + extensions: ["xfdf"], + }, + "application/vnd.aether.imp": { + source: "iana", + }, + "application/vnd.afpc.afplinedata": { + source: "iana", + }, + "application/vnd.afpc.afplinedata-pagedef": { + source: "iana", + }, + "application/vnd.afpc.cmoca-cmresource": { + source: "iana", + }, + "application/vnd.afpc.foca-charset": { + source: "iana", + }, + "application/vnd.afpc.foca-codedfont": { + source: "iana", + }, + "application/vnd.afpc.foca-codepage": { + source: "iana", + }, + "application/vnd.afpc.modca": { + source: "iana", + }, + "application/vnd.afpc.modca-cmtable": { + source: "iana", + }, + "application/vnd.afpc.modca-formdef": { + source: "iana", + }, + "application/vnd.afpc.modca-mediummap": { + source: "iana", + }, + "application/vnd.afpc.modca-objectcontainer": { + source: "iana", + }, + "application/vnd.afpc.modca-overlay": { + source: "iana", + }, + "application/vnd.afpc.modca-pagesegment": { + source: "iana", + }, + "application/vnd.age": { + source: "iana", + extensions: ["age"], + }, + "application/vnd.ah-barcode": { + source: "iana", + }, + "application/vnd.ahead.space": { + source: "iana", + extensions: ["ahead"], + }, + "application/vnd.airzip.filesecure.azf": { + source: "iana", + extensions: ["azf"], + }, + "application/vnd.airzip.filesecure.azs": { + source: "iana", + extensions: ["azs"], + }, + "application/vnd.amadeus+json": { + source: "iana", + compressible: true, + }, + "application/vnd.amazon.ebook": { + source: "apache", + extensions: ["azw"], + }, + "application/vnd.amazon.mobi8-ebook": { + source: "iana", + }, + "application/vnd.americandynamics.acc": { + source: "iana", + extensions: ["acc"], + }, + "application/vnd.amiga.ami": { + source: "iana", + extensions: ["ami"], + }, + "application/vnd.amundsen.maze+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.android.ota": { + source: "iana", + }, + "application/vnd.android.package-archive": { + source: "apache", + compressible: false, + extensions: ["apk"], + }, + "application/vnd.anki": { + source: "iana", + }, + "application/vnd.anser-web-certificate-issue-initiation": { + source: "iana", + extensions: ["cii"], + }, + "application/vnd.anser-web-funds-transfer-initiation": { + source: "apache", + extensions: ["fti"], + }, + "application/vnd.antix.game-component": { + source: "iana", + extensions: ["atx"], + }, + "application/vnd.apache.arrow.file": { + source: "iana", + }, + "application/vnd.apache.arrow.stream": { + source: "iana", + }, + "application/vnd.apache.thrift.binary": { + source: "iana", + }, + "application/vnd.apache.thrift.compact": { + source: "iana", + }, + "application/vnd.apache.thrift.json": { + source: "iana", + }, + "application/vnd.api+json": { + source: "iana", + compressible: true, + }, + "application/vnd.aplextor.warrp+json": { + source: "iana", + compressible: true, + }, + "application/vnd.apothekende.reservation+json": { + source: "iana", + compressible: true, + }, + "application/vnd.apple.installer+xml": { + source: "iana", + compressible: true, + extensions: ["mpkg"], + }, + "application/vnd.apple.keynote": { + source: "iana", + extensions: ["key"], + }, + "application/vnd.apple.mpegurl": { + source: "iana", + extensions: ["m3u8"], + }, + "application/vnd.apple.numbers": { + source: "iana", + extensions: ["numbers"], + }, + "application/vnd.apple.pages": { + source: "iana", + extensions: ["pages"], + }, + "application/vnd.apple.pkpass": { + compressible: false, + extensions: ["pkpass"], + }, + "application/vnd.arastra.swi": { + source: "iana", + }, + "application/vnd.aristanetworks.swi": { + source: "iana", + extensions: ["swi"], + }, + "application/vnd.artisan+json": { + source: "iana", + compressible: true, + }, + "application/vnd.artsquare": { + source: "iana", + }, + "application/vnd.astraea-software.iota": { + source: "iana", + extensions: ["iota"], + }, + "application/vnd.audiograph": { + source: "iana", + extensions: ["aep"], + }, + "application/vnd.autopackage": { + source: "iana", + }, + "application/vnd.avalon+json": { + source: "iana", + compressible: true, + }, + "application/vnd.avistar+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.balsamiq.bmml+xml": { + source: "iana", + compressible: true, + extensions: ["bmml"], + }, + "application/vnd.balsamiq.bmpr": { + source: "iana", + }, + "application/vnd.banana-accounting": { + source: "iana", + }, + "application/vnd.bbf.usp.error": { + source: "iana", + }, + "application/vnd.bbf.usp.msg": { + source: "iana", + }, + "application/vnd.bbf.usp.msg+json": { + source: "iana", + compressible: true, + }, + "application/vnd.bekitzur-stech+json": { + source: "iana", + compressible: true, + }, + "application/vnd.bint.med-content": { + source: "iana", + }, + "application/vnd.biopax.rdf+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.blink-idb-value-wrapper": { + source: "iana", + }, + "application/vnd.blueice.multipass": { + source: "iana", + extensions: ["mpm"], + }, + "application/vnd.bluetooth.ep.oob": { + source: "iana", + }, + "application/vnd.bluetooth.le.oob": { + source: "iana", + }, + "application/vnd.bmi": { + source: "iana", + extensions: ["bmi"], + }, + "application/vnd.bpf": { + source: "iana", + }, + "application/vnd.bpf3": { + source: "iana", + }, + "application/vnd.businessobjects": { + source: "iana", + extensions: ["rep"], + }, + "application/vnd.byu.uapi+json": { + source: "iana", + compressible: true, + }, + "application/vnd.cab-jscript": { + source: "iana", + }, + "application/vnd.canon-cpdl": { + source: "iana", + }, + "application/vnd.canon-lips": { + source: "iana", + }, + "application/vnd.capasystems-pg+json": { + source: "iana", + compressible: true, + }, + "application/vnd.cendio.thinlinc.clientconf": { + source: "iana", + }, + "application/vnd.century-systems.tcp_stream": { + source: "iana", + }, + "application/vnd.chemdraw+xml": { + source: "iana", + compressible: true, + extensions: ["cdxml"], + }, + "application/vnd.chess-pgn": { + source: "iana", + }, + "application/vnd.chipnuts.karaoke-mmd": { + source: "iana", + extensions: ["mmd"], + }, + "application/vnd.ciedi": { + source: "iana", + }, + "application/vnd.cinderella": { + source: "iana", + extensions: ["cdy"], + }, + "application/vnd.cirpack.isdn-ext": { + source: "iana", + }, + "application/vnd.citationstyles.style+xml": { + source: "iana", + compressible: true, + extensions: ["csl"], + }, + "application/vnd.claymore": { + source: "iana", + extensions: ["cla"], + }, + "application/vnd.cloanto.rp9": { + source: "iana", + extensions: ["rp9"], + }, + "application/vnd.clonk.c4group": { + source: "iana", + extensions: ["c4g", "c4d", "c4f", "c4p", "c4u"], + }, + "application/vnd.cluetrust.cartomobile-config": { + source: "iana", + extensions: ["c11amc"], + }, + "application/vnd.cluetrust.cartomobile-config-pkg": { + source: "iana", + extensions: ["c11amz"], + }, + "application/vnd.coffeescript": { + source: "iana", + }, + "application/vnd.collabio.xodocuments.document": { + source: "iana", + }, + "application/vnd.collabio.xodocuments.document-template": { + source: "iana", + }, + "application/vnd.collabio.xodocuments.presentation": { + source: "iana", + }, + "application/vnd.collabio.xodocuments.presentation-template": { + source: "iana", + }, + "application/vnd.collabio.xodocuments.spreadsheet": { + source: "iana", + }, + "application/vnd.collabio.xodocuments.spreadsheet-template": { + source: "iana", + }, + "application/vnd.collection+json": { + source: "iana", + compressible: true, + }, + "application/vnd.collection.doc+json": { + source: "iana", + compressible: true, + }, + "application/vnd.collection.next+json": { + source: "iana", + compressible: true, + }, + "application/vnd.comicbook+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.comicbook-rar": { + source: "iana", + }, + "application/vnd.commerce-battelle": { + source: "iana", + }, + "application/vnd.commonspace": { + source: "iana", + extensions: ["csp"], + }, + "application/vnd.contact.cmsg": { + source: "iana", + extensions: ["cdbcmsg"], + }, + "application/vnd.coreos.ignition+json": { + source: "iana", + compressible: true, + }, + "application/vnd.cosmocaller": { + source: "iana", + extensions: ["cmc"], + }, + "application/vnd.crick.clicker": { + source: "iana", + extensions: ["clkx"], + }, + "application/vnd.crick.clicker.keyboard": { + source: "iana", + extensions: ["clkk"], + }, + "application/vnd.crick.clicker.palette": { + source: "iana", + extensions: ["clkp"], + }, + "application/vnd.crick.clicker.template": { + source: "iana", + extensions: ["clkt"], + }, + "application/vnd.crick.clicker.wordbank": { + source: "iana", + extensions: ["clkw"], + }, + "application/vnd.criticaltools.wbs+xml": { + source: "iana", + compressible: true, + extensions: ["wbs"], + }, + "application/vnd.cryptii.pipe+json": { + source: "iana", + compressible: true, + }, + "application/vnd.crypto-shade-file": { + source: "iana", + }, + "application/vnd.cryptomator.encrypted": { + source: "iana", + }, + "application/vnd.cryptomator.vault": { + source: "iana", + }, + "application/vnd.ctc-posml": { + source: "iana", + extensions: ["pml"], + }, + "application/vnd.ctct.ws+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.cups-pdf": { + source: "iana", + }, + "application/vnd.cups-postscript": { + source: "iana", + }, + "application/vnd.cups-ppd": { + source: "iana", + extensions: ["ppd"], + }, + "application/vnd.cups-raster": { + source: "iana", + }, + "application/vnd.cups-raw": { + source: "iana", + }, + "application/vnd.curl": { + source: "iana", + }, + "application/vnd.curl.car": { + source: "apache", + extensions: ["car"], + }, + "application/vnd.curl.pcurl": { + source: "apache", + extensions: ["pcurl"], + }, + "application/vnd.cyan.dean.root+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.cybank": { + source: "iana", + }, + "application/vnd.cyclonedx+json": { + source: "iana", + compressible: true, + }, + "application/vnd.cyclonedx+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.d2l.coursepackage1p0+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.d3m-dataset": { + source: "iana", + }, + "application/vnd.d3m-problem": { + source: "iana", + }, + "application/vnd.dart": { + source: "iana", + compressible: true, + extensions: ["dart"], + }, + "application/vnd.data-vision.rdz": { + source: "iana", + extensions: ["rdz"], + }, + "application/vnd.datapackage+json": { + source: "iana", + compressible: true, + }, + "application/vnd.dataresource+json": { + source: "iana", + compressible: true, + }, + "application/vnd.dbf": { + source: "iana", + extensions: ["dbf"], + }, + "application/vnd.debian.binary-package": { + source: "iana", + }, + "application/vnd.dece.data": { + source: "iana", + extensions: ["uvf", "uvvf", "uvd", "uvvd"], + }, + "application/vnd.dece.ttml+xml": { + source: "iana", + compressible: true, + extensions: ["uvt", "uvvt"], + }, + "application/vnd.dece.unspecified": { + source: "iana", + extensions: ["uvx", "uvvx"], + }, + "application/vnd.dece.zip": { + source: "iana", + extensions: ["uvz", "uvvz"], + }, + "application/vnd.denovo.fcselayout-link": { + source: "iana", + extensions: ["fe_launch"], + }, + "application/vnd.desmume.movie": { + source: "iana", + }, + "application/vnd.dir-bi.plate-dl-nosuffix": { + source: "iana", + }, + "application/vnd.dm.delegation+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dna": { + source: "iana", + extensions: ["dna"], + }, + "application/vnd.document+json": { + source: "iana", + compressible: true, + }, + "application/vnd.dolby.mlp": { + source: "apache", + extensions: ["mlp"], + }, + "application/vnd.dolby.mobile.1": { + source: "iana", + }, + "application/vnd.dolby.mobile.2": { + source: "iana", + }, + "application/vnd.doremir.scorecloud-binary-document": { + source: "iana", + }, + "application/vnd.dpgraph": { + source: "iana", + extensions: ["dpg"], + }, + "application/vnd.dreamfactory": { + source: "iana", + extensions: ["dfac"], + }, + "application/vnd.drive+json": { + source: "iana", + compressible: true, + }, + "application/vnd.ds-keypoint": { + source: "apache", + extensions: ["kpxx"], + }, + "application/vnd.dtg.local": { + source: "iana", + }, + "application/vnd.dtg.local.flash": { + source: "iana", + }, + "application/vnd.dtg.local.html": { + source: "iana", + }, + "application/vnd.dvb.ait": { + source: "iana", + extensions: ["ait"], + }, + "application/vnd.dvb.dvbisl+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dvb.dvbj": { + source: "iana", + }, + "application/vnd.dvb.esgcontainer": { + source: "iana", + }, + "application/vnd.dvb.ipdcdftnotifaccess": { + source: "iana", + }, + "application/vnd.dvb.ipdcesgaccess": { + source: "iana", + }, + "application/vnd.dvb.ipdcesgaccess2": { + source: "iana", + }, + "application/vnd.dvb.ipdcesgpdd": { + source: "iana", + }, + "application/vnd.dvb.ipdcroaming": { + source: "iana", + }, + "application/vnd.dvb.iptv.alfec-base": { + source: "iana", + }, + "application/vnd.dvb.iptv.alfec-enhancement": { + source: "iana", + }, + "application/vnd.dvb.notif-aggregate-root+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dvb.notif-container+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dvb.notif-generic+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dvb.notif-ia-msglist+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dvb.notif-ia-registration-request+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dvb.notif-ia-registration-response+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dvb.notif-init+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.dvb.pfr": { + source: "iana", + }, + "application/vnd.dvb.service": { + source: "iana", + extensions: ["svc"], + }, + "application/vnd.dxr": { + source: "iana", + }, + "application/vnd.dynageo": { + source: "iana", + extensions: ["geo"], + }, + "application/vnd.dzr": { + source: "iana", + }, + "application/vnd.easykaraoke.cdgdownload": { + source: "iana", + }, + "application/vnd.ecdis-update": { + source: "iana", + }, + "application/vnd.ecip.rlp": { + source: "iana", + }, + "application/vnd.eclipse.ditto+json": { + source: "iana", + compressible: true, + }, + "application/vnd.ecowin.chart": { + source: "iana", + extensions: ["mag"], + }, + "application/vnd.ecowin.filerequest": { + source: "iana", + }, + "application/vnd.ecowin.fileupdate": { + source: "iana", + }, + "application/vnd.ecowin.series": { + source: "iana", + }, + "application/vnd.ecowin.seriesrequest": { + source: "iana", + }, + "application/vnd.ecowin.seriesupdate": { + source: "iana", + }, + "application/vnd.efi.img": { + source: "iana", + }, + "application/vnd.efi.iso": { + source: "iana", + }, + "application/vnd.emclient.accessrequest+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.enliven": { + source: "iana", + extensions: ["nml"], + }, + "application/vnd.enphase.envoy": { + source: "iana", + }, + "application/vnd.eprints.data+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.epson.esf": { + source: "iana", + extensions: ["esf"], + }, + "application/vnd.epson.msf": { + source: "iana", + extensions: ["msf"], + }, + "application/vnd.epson.quickanime": { + source: "iana", + extensions: ["qam"], + }, + "application/vnd.epson.salt": { + source: "iana", + extensions: ["slt"], + }, + "application/vnd.epson.ssf": { + source: "iana", + extensions: ["ssf"], + }, + "application/vnd.ericsson.quickcall": { + source: "iana", + }, + "application/vnd.espass-espass+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.eszigno3+xml": { + source: "iana", + compressible: true, + extensions: ["es3", "et3"], + }, + "application/vnd.etsi.aoc+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.asic-e+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.etsi.asic-s+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.etsi.cug+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvcommand+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvdiscovery+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvprofile+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvsad-bc+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvsad-cod+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvsad-npvr+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvservice+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvsync+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.iptvueprofile+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.mcid+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.mheg5": { + source: "iana", + }, + "application/vnd.etsi.overload-control-policy-dataset+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.pstn+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.sci+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.simservs+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.timestamp-token": { + source: "iana", + }, + "application/vnd.etsi.tsl+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.etsi.tsl.der": { + source: "iana", + }, + "application/vnd.eu.kasparian.car+json": { + source: "iana", + compressible: true, + }, + "application/vnd.eudora.data": { + source: "iana", + }, + "application/vnd.evolv.ecig.profile": { + source: "iana", + }, + "application/vnd.evolv.ecig.settings": { + source: "iana", + }, + "application/vnd.evolv.ecig.theme": { + source: "iana", + }, + "application/vnd.exstream-empower+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.exstream-package": { + source: "iana", + }, + "application/vnd.ezpix-album": { + source: "iana", + extensions: ["ez2"], + }, + "application/vnd.ezpix-package": { + source: "iana", + extensions: ["ez3"], + }, + "application/vnd.f-secure.mobile": { + source: "iana", + }, + "application/vnd.familysearch.gedcom+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.fastcopy-disk-image": { + source: "iana", + }, + "application/vnd.fdf": { + source: "iana", + extensions: ["fdf"], + }, + "application/vnd.fdsn.mseed": { + source: "iana", + extensions: ["mseed"], + }, + "application/vnd.fdsn.seed": { + source: "iana", + extensions: ["seed", "dataless"], + }, + "application/vnd.ffsns": { + source: "iana", + }, + "application/vnd.ficlab.flb+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.filmit.zfc": { + source: "iana", + }, + "application/vnd.fints": { + source: "iana", + }, + "application/vnd.firemonkeys.cloudcell": { + source: "iana", + }, + "application/vnd.flographit": { + source: "iana", + extensions: ["gph"], + }, + "application/vnd.fluxtime.clip": { + source: "iana", + extensions: ["ftc"], + }, + "application/vnd.font-fontforge-sfd": { + source: "iana", + }, + "application/vnd.framemaker": { + source: "iana", + extensions: ["fm", "frame", "maker", "book"], + }, + "application/vnd.frogans.fnc": { + source: "iana", + extensions: ["fnc"], + }, + "application/vnd.frogans.ltf": { + source: "iana", + extensions: ["ltf"], + }, + "application/vnd.fsc.weblaunch": { + source: "iana", + extensions: ["fsc"], + }, + "application/vnd.fujifilm.fb.docuworks": { + source: "iana", + }, + "application/vnd.fujifilm.fb.docuworks.binder": { + source: "iana", + }, + "application/vnd.fujifilm.fb.docuworks.container": { + source: "iana", + }, + "application/vnd.fujifilm.fb.jfi+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.fujitsu.oasys": { + source: "iana", + extensions: ["oas"], + }, + "application/vnd.fujitsu.oasys2": { + source: "iana", + extensions: ["oa2"], + }, + "application/vnd.fujitsu.oasys3": { + source: "iana", + extensions: ["oa3"], + }, + "application/vnd.fujitsu.oasysgp": { + source: "iana", + extensions: ["fg5"], + }, + "application/vnd.fujitsu.oasysprs": { + source: "iana", + extensions: ["bh2"], + }, + "application/vnd.fujixerox.art-ex": { + source: "iana", + }, + "application/vnd.fujixerox.art4": { + source: "iana", + }, + "application/vnd.fujixerox.ddd": { + source: "iana", + extensions: ["ddd"], + }, + "application/vnd.fujixerox.docuworks": { + source: "iana", + extensions: ["xdw"], + }, + "application/vnd.fujixerox.docuworks.binder": { + source: "iana", + extensions: ["xbd"], + }, + "application/vnd.fujixerox.docuworks.container": { + source: "iana", + }, + "application/vnd.fujixerox.hbpl": { + source: "iana", + }, + "application/vnd.fut-misnet": { + source: "iana", + }, + "application/vnd.futoin+cbor": { + source: "iana", + }, + "application/vnd.futoin+json": { + source: "iana", + compressible: true, + }, + "application/vnd.fuzzysheet": { + source: "iana", + extensions: ["fzs"], + }, + "application/vnd.genomatix.tuxedo": { + source: "iana", + extensions: ["txd"], + }, + "application/vnd.gentics.grd+json": { + source: "iana", + compressible: true, + }, + "application/vnd.geo+json": { + source: "iana", + compressible: true, + }, + "application/vnd.geocube+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.geogebra.file": { + source: "iana", + extensions: ["ggb"], + }, + "application/vnd.geogebra.slides": { + source: "iana", + }, + "application/vnd.geogebra.tool": { + source: "iana", + extensions: ["ggt"], + }, + "application/vnd.geometry-explorer": { + source: "iana", + extensions: ["gex", "gre"], + }, + "application/vnd.geonext": { + source: "iana", + extensions: ["gxt"], + }, + "application/vnd.geoplan": { + source: "iana", + extensions: ["g2w"], + }, + "application/vnd.geospace": { + source: "iana", + extensions: ["g3w"], + }, + "application/vnd.gerber": { + source: "iana", + }, + "application/vnd.globalplatform.card-content-mgt": { + source: "iana", + }, + "application/vnd.globalplatform.card-content-mgt-response": { + source: "iana", + }, + "application/vnd.gmx": { + source: "iana", + extensions: ["gmx"], + }, + "application/vnd.google-apps.document": { + compressible: false, + extensions: ["gdoc"], + }, + "application/vnd.google-apps.presentation": { + compressible: false, + extensions: ["gslides"], + }, + "application/vnd.google-apps.spreadsheet": { + compressible: false, + extensions: ["gsheet"], + }, + "application/vnd.google-earth.kml+xml": { + source: "iana", + compressible: true, + extensions: ["kml"], + }, + "application/vnd.google-earth.kmz": { + source: "iana", + compressible: false, + extensions: ["kmz"], + }, + "application/vnd.gov.sk.e-form+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.gov.sk.e-form+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.gov.sk.xmldatacontainer+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.grafeq": { + source: "iana", + extensions: ["gqf", "gqs"], + }, + "application/vnd.gridmp": { + source: "iana", + }, + "application/vnd.groove-account": { + source: "iana", + extensions: ["gac"], + }, + "application/vnd.groove-help": { + source: "iana", + extensions: ["ghf"], + }, + "application/vnd.groove-identity-message": { + source: "iana", + extensions: ["gim"], + }, + "application/vnd.groove-injector": { + source: "iana", + extensions: ["grv"], + }, + "application/vnd.groove-tool-message": { + source: "iana", + extensions: ["gtm"], + }, + "application/vnd.groove-tool-template": { + source: "iana", + extensions: ["tpl"], + }, + "application/vnd.groove-vcard": { + source: "iana", + extensions: ["vcg"], + }, + "application/vnd.hal+json": { + source: "iana", + compressible: true, + }, + "application/vnd.hal+xml": { + source: "iana", + compressible: true, + extensions: ["hal"], + }, + "application/vnd.handheld-entertainment+xml": { + source: "iana", + compressible: true, + extensions: ["zmm"], + }, + "application/vnd.hbci": { + source: "iana", + extensions: ["hbci"], + }, + "application/vnd.hc+json": { + source: "iana", + compressible: true, + }, + "application/vnd.hcl-bireports": { + source: "iana", + }, + "application/vnd.hdt": { + source: "iana", + }, + "application/vnd.heroku+json": { + source: "iana", + compressible: true, + }, + "application/vnd.hhe.lesson-player": { + source: "iana", + extensions: ["les"], + }, + "application/vnd.hl7cda+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/vnd.hl7v2+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/vnd.hp-hpgl": { + source: "iana", + extensions: ["hpgl"], + }, + "application/vnd.hp-hpid": { + source: "iana", + extensions: ["hpid"], + }, + "application/vnd.hp-hps": { + source: "iana", + extensions: ["hps"], + }, + "application/vnd.hp-jlyt": { + source: "iana", + extensions: ["jlt"], + }, + "application/vnd.hp-pcl": { + source: "iana", + extensions: ["pcl"], + }, + "application/vnd.hp-pclxl": { + source: "iana", + extensions: ["pclxl"], + }, + "application/vnd.httphone": { + source: "iana", + }, + "application/vnd.hydrostatix.sof-data": { + source: "iana", + extensions: ["sfd-hdstx"], + }, + "application/vnd.hyper+json": { + source: "iana", + compressible: true, + }, + "application/vnd.hyper-item+json": { + source: "iana", + compressible: true, + }, + "application/vnd.hyperdrive+json": { + source: "iana", + compressible: true, + }, + "application/vnd.hzn-3d-crossword": { + source: "iana", + }, + "application/vnd.ibm.afplinedata": { + source: "iana", + }, + "application/vnd.ibm.electronic-media": { + source: "iana", + }, + "application/vnd.ibm.minipay": { + source: "iana", + extensions: ["mpy"], + }, + "application/vnd.ibm.modcap": { + source: "iana", + extensions: ["afp", "listafp", "list3820"], + }, + "application/vnd.ibm.rights-management": { + source: "iana", + extensions: ["irm"], + }, + "application/vnd.ibm.secure-container": { + source: "iana", + extensions: ["sc"], + }, + "application/vnd.iccprofile": { + source: "iana", + extensions: ["icc", "icm"], + }, + "application/vnd.ieee.1905": { + source: "iana", + }, + "application/vnd.igloader": { + source: "iana", + extensions: ["igl"], + }, + "application/vnd.imagemeter.folder+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.imagemeter.image+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.immervision-ivp": { + source: "iana", + extensions: ["ivp"], + }, + "application/vnd.immervision-ivu": { + source: "iana", + extensions: ["ivu"], + }, + "application/vnd.ims.imsccv1p1": { + source: "iana", + }, + "application/vnd.ims.imsccv1p2": { + source: "iana", + }, + "application/vnd.ims.imsccv1p3": { + source: "iana", + }, + "application/vnd.ims.lis.v2.result+json": { + source: "iana", + compressible: true, + }, + "application/vnd.ims.lti.v2.toolconsumerprofile+json": { + source: "iana", + compressible: true, + }, + "application/vnd.ims.lti.v2.toolproxy+json": { + source: "iana", + compressible: true, + }, + "application/vnd.ims.lti.v2.toolproxy.id+json": { + source: "iana", + compressible: true, + }, + "application/vnd.ims.lti.v2.toolsettings+json": { + source: "iana", + compressible: true, + }, + "application/vnd.ims.lti.v2.toolsettings.simple+json": { + source: "iana", + compressible: true, + }, + "application/vnd.informedcontrol.rms+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.informix-visionary": { + source: "iana", + }, + "application/vnd.infotech.project": { + source: "iana", + }, + "application/vnd.infotech.project+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.innopath.wamp.notification": { + source: "iana", + }, + "application/vnd.insors.igm": { + source: "iana", + extensions: ["igm"], + }, + "application/vnd.intercon.formnet": { + source: "iana", + extensions: ["xpw", "xpx"], + }, + "application/vnd.intergeo": { + source: "iana", + extensions: ["i2g"], + }, + "application/vnd.intertrust.digibox": { + source: "iana", + }, + "application/vnd.intertrust.nncp": { + source: "iana", + }, + "application/vnd.intu.qbo": { + source: "iana", + extensions: ["qbo"], + }, + "application/vnd.intu.qfx": { + source: "iana", + extensions: ["qfx"], + }, + "application/vnd.iptc.g2.catalogitem+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.iptc.g2.conceptitem+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.iptc.g2.knowledgeitem+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.iptc.g2.newsitem+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.iptc.g2.newsmessage+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.iptc.g2.packageitem+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.iptc.g2.planningitem+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.ipunplugged.rcprofile": { + source: "iana", + extensions: ["rcprofile"], + }, + "application/vnd.irepository.package+xml": { + source: "iana", + compressible: true, + extensions: ["irp"], + }, + "application/vnd.is-xpr": { + source: "iana", + extensions: ["xpr"], + }, + "application/vnd.isac.fcs": { + source: "iana", + extensions: ["fcs"], + }, + "application/vnd.iso11783-10+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.jam": { + source: "iana", + extensions: ["jam"], + }, + "application/vnd.japannet-directory-service": { + source: "iana", + }, + "application/vnd.japannet-jpnstore-wakeup": { + source: "iana", + }, + "application/vnd.japannet-payment-wakeup": { + source: "iana", + }, + "application/vnd.japannet-registration": { + source: "iana", + }, + "application/vnd.japannet-registration-wakeup": { + source: "iana", + }, + "application/vnd.japannet-setstore-wakeup": { + source: "iana", + }, + "application/vnd.japannet-verification": { + source: "iana", + }, + "application/vnd.japannet-verification-wakeup": { + source: "iana", + }, + "application/vnd.jcp.javame.midlet-rms": { + source: "iana", + extensions: ["rms"], + }, + "application/vnd.jisp": { + source: "iana", + extensions: ["jisp"], + }, + "application/vnd.joost.joda-archive": { + source: "iana", + extensions: ["joda"], + }, + "application/vnd.jsk.isdn-ngn": { + source: "iana", + }, + "application/vnd.kahootz": { + source: "iana", + extensions: ["ktz", "ktr"], + }, + "application/vnd.kde.karbon": { + source: "iana", + extensions: ["karbon"], + }, + "application/vnd.kde.kchart": { + source: "iana", + extensions: ["chrt"], + }, + "application/vnd.kde.kformula": { + source: "iana", + extensions: ["kfo"], + }, + "application/vnd.kde.kivio": { + source: "iana", + extensions: ["flw"], + }, + "application/vnd.kde.kontour": { + source: "iana", + extensions: ["kon"], + }, + "application/vnd.kde.kpresenter": { + source: "iana", + extensions: ["kpr", "kpt"], + }, + "application/vnd.kde.kspread": { + source: "iana", + extensions: ["ksp"], + }, + "application/vnd.kde.kword": { + source: "iana", + extensions: ["kwd", "kwt"], + }, + "application/vnd.kenameaapp": { + source: "iana", + extensions: ["htke"], + }, + "application/vnd.kidspiration": { + source: "iana", + extensions: ["kia"], + }, + "application/vnd.kinar": { + source: "iana", + extensions: ["kne", "knp"], + }, + "application/vnd.koan": { + source: "iana", + extensions: ["skp", "skd", "skt", "skm"], + }, + "application/vnd.kodak-descriptor": { + source: "iana", + extensions: ["sse"], + }, + "application/vnd.las": { + source: "iana", + }, + "application/vnd.las.las+json": { + source: "iana", + compressible: true, + }, + "application/vnd.las.las+xml": { + source: "iana", + compressible: true, + extensions: ["lasxml"], + }, + "application/vnd.laszip": { + source: "iana", + }, + "application/vnd.leap+json": { + source: "iana", + compressible: true, + }, + "application/vnd.liberty-request+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.llamagraphics.life-balance.desktop": { + source: "iana", + extensions: ["lbd"], + }, + "application/vnd.llamagraphics.life-balance.exchange+xml": { + source: "iana", + compressible: true, + extensions: ["lbe"], + }, + "application/vnd.logipipe.circuit+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.loom": { + source: "iana", + }, + "application/vnd.lotus-1-2-3": { + source: "iana", + extensions: ["123"], + }, + "application/vnd.lotus-approach": { + source: "iana", + extensions: ["apr"], + }, + "application/vnd.lotus-freelance": { + source: "iana", + extensions: ["pre"], + }, + "application/vnd.lotus-notes": { + source: "iana", + extensions: ["nsf"], + }, + "application/vnd.lotus-organizer": { + source: "iana", + extensions: ["org"], + }, + "application/vnd.lotus-screencam": { + source: "iana", + extensions: ["scm"], + }, + "application/vnd.lotus-wordpro": { + source: "iana", + extensions: ["lwp"], + }, + "application/vnd.macports.portpkg": { + source: "iana", + extensions: ["portpkg"], + }, + "application/vnd.mapbox-vector-tile": { + source: "iana", + extensions: ["mvt"], + }, + "application/vnd.marlin.drm.actiontoken+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.marlin.drm.conftoken+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.marlin.drm.license+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.marlin.drm.mdcf": { + source: "iana", + }, + "application/vnd.mason+json": { + source: "iana", + compressible: true, + }, + "application/vnd.maxar.archive.3tz+zip": { + source: "iana", + compressible: false, + }, + "application/vnd.maxmind.maxmind-db": { + source: "iana", + }, + "application/vnd.mcd": { + source: "iana", + extensions: ["mcd"], + }, + "application/vnd.medcalcdata": { + source: "iana", + extensions: ["mc1"], + }, + "application/vnd.mediastation.cdkey": { + source: "iana", + extensions: ["cdkey"], + }, + "application/vnd.meridian-slingshot": { + source: "iana", + }, + "application/vnd.mfer": { + source: "iana", + extensions: ["mwf"], + }, + "application/vnd.mfmp": { + source: "iana", + extensions: ["mfm"], + }, + "application/vnd.micro+json": { + source: "iana", + compressible: true, + }, + "application/vnd.micrografx.flo": { + source: "iana", + extensions: ["flo"], + }, + "application/vnd.micrografx.igx": { + source: "iana", + extensions: ["igx"], + }, + "application/vnd.microsoft.portable-executable": { + source: "iana", + }, + "application/vnd.microsoft.windows.thumbnail-cache": { + source: "iana", + }, + "application/vnd.miele+json": { + source: "iana", + compressible: true, + }, + "application/vnd.mif": { + source: "iana", + extensions: ["mif"], + }, + "application/vnd.minisoft-hp3000-save": { + source: "iana", + }, + "application/vnd.mitsubishi.misty-guard.trustweb": { + source: "iana", + }, + "application/vnd.mobius.daf": { + source: "iana", + extensions: ["daf"], + }, + "application/vnd.mobius.dis": { + source: "iana", + extensions: ["dis"], + }, + "application/vnd.mobius.mbk": { + source: "iana", + extensions: ["mbk"], + }, + "application/vnd.mobius.mqy": { + source: "iana", + extensions: ["mqy"], + }, + "application/vnd.mobius.msl": { + source: "iana", + extensions: ["msl"], + }, + "application/vnd.mobius.plc": { + source: "iana", + extensions: ["plc"], + }, + "application/vnd.mobius.txf": { + source: "iana", + extensions: ["txf"], + }, + "application/vnd.mophun.application": { + source: "iana", + extensions: ["mpn"], + }, + "application/vnd.mophun.certificate": { + source: "iana", + extensions: ["mpc"], + }, + "application/vnd.motorola.flexsuite": { + source: "iana", + }, + "application/vnd.motorola.flexsuite.adsi": { + source: "iana", + }, + "application/vnd.motorola.flexsuite.fis": { + source: "iana", + }, + "application/vnd.motorola.flexsuite.gotap": { + source: "iana", + }, + "application/vnd.motorola.flexsuite.kmr": { + source: "iana", + }, + "application/vnd.motorola.flexsuite.ttc": { + source: "iana", + }, + "application/vnd.motorola.flexsuite.wem": { + source: "iana", + }, + "application/vnd.motorola.iprm": { + source: "iana", + }, + "application/vnd.mozilla.xul+xml": { + source: "iana", + compressible: true, + extensions: ["xul"], + }, + "application/vnd.ms-3mfdocument": { + source: "iana", + }, + "application/vnd.ms-artgalry": { + source: "iana", + extensions: ["cil"], + }, + "application/vnd.ms-asf": { + source: "iana", + }, + "application/vnd.ms-cab-compressed": { + source: "iana", + extensions: ["cab"], + }, + "application/vnd.ms-color.iccprofile": { + source: "apache", + }, + "application/vnd.ms-excel": { + source: "iana", + compressible: false, + extensions: ["xls", "xlm", "xla", "xlc", "xlt", "xlw"], + }, + "application/vnd.ms-excel.addin.macroenabled.12": { + source: "iana", + extensions: ["xlam"], + }, + "application/vnd.ms-excel.sheet.binary.macroenabled.12": { + source: "iana", + extensions: ["xlsb"], + }, + "application/vnd.ms-excel.sheet.macroenabled.12": { + source: "iana", + extensions: ["xlsm"], + }, + "application/vnd.ms-excel.template.macroenabled.12": { + source: "iana", + extensions: ["xltm"], + }, + "application/vnd.ms-fontobject": { + source: "iana", + compressible: true, + extensions: ["eot"], + }, + "application/vnd.ms-htmlhelp": { + source: "iana", + extensions: ["chm"], + }, + "application/vnd.ms-ims": { + source: "iana", + extensions: ["ims"], + }, + "application/vnd.ms-lrm": { + source: "iana", + extensions: ["lrm"], + }, + "application/vnd.ms-office.activex+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.ms-officetheme": { + source: "iana", + extensions: ["thmx"], + }, + "application/vnd.ms-opentype": { + source: "apache", + compressible: true, + }, + "application/vnd.ms-outlook": { + compressible: false, + extensions: ["msg"], + }, + "application/vnd.ms-package.obfuscated-opentype": { + source: "apache", + }, + "application/vnd.ms-pki.seccat": { + source: "apache", + extensions: ["cat"], + }, + "application/vnd.ms-pki.stl": { + source: "apache", + extensions: ["stl"], + }, + "application/vnd.ms-playready.initiator+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.ms-powerpoint": { + source: "iana", + compressible: false, + extensions: ["ppt", "pps", "pot"], + }, + "application/vnd.ms-powerpoint.addin.macroenabled.12": { + source: "iana", + extensions: ["ppam"], + }, + "application/vnd.ms-powerpoint.presentation.macroenabled.12": { + source: "iana", + extensions: ["pptm"], + }, + "application/vnd.ms-powerpoint.slide.macroenabled.12": { + source: "iana", + extensions: ["sldm"], + }, + "application/vnd.ms-powerpoint.slideshow.macroenabled.12": { + source: "iana", + extensions: ["ppsm"], + }, + "application/vnd.ms-powerpoint.template.macroenabled.12": { + source: "iana", + extensions: ["potm"], + }, + "application/vnd.ms-printdevicecapabilities+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.ms-printing.printticket+xml": { + source: "apache", + compressible: true, + }, + "application/vnd.ms-printschematicket+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.ms-project": { + source: "iana", + extensions: ["mpp", "mpt"], + }, + "application/vnd.ms-tnef": { + source: "iana", + }, + "application/vnd.ms-windows.devicepairing": { + source: "iana", + }, + "application/vnd.ms-windows.nwprinting.oob": { + source: "iana", + }, + "application/vnd.ms-windows.printerpairing": { + source: "iana", + }, + "application/vnd.ms-windows.wsd.oob": { + source: "iana", + }, + "application/vnd.ms-wmdrm.lic-chlg-req": { + source: "iana", + }, + "application/vnd.ms-wmdrm.lic-resp": { + source: "iana", + }, + "application/vnd.ms-wmdrm.meter-chlg-req": { + source: "iana", + }, + "application/vnd.ms-wmdrm.meter-resp": { + source: "iana", + }, + "application/vnd.ms-word.document.macroenabled.12": { + source: "iana", + extensions: ["docm"], + }, + "application/vnd.ms-word.template.macroenabled.12": { + source: "iana", + extensions: ["dotm"], + }, + "application/vnd.ms-works": { + source: "iana", + extensions: ["wps", "wks", "wcm", "wdb"], + }, + "application/vnd.ms-wpl": { + source: "iana", + extensions: ["wpl"], + }, + "application/vnd.ms-xpsdocument": { + source: "iana", + compressible: false, + extensions: ["xps"], + }, + "application/vnd.msa-disk-image": { + source: "iana", + }, + "application/vnd.mseq": { + source: "iana", + extensions: ["mseq"], + }, + "application/vnd.msign": { + source: "iana", + }, + "application/vnd.multiad.creator": { + source: "iana", + }, + "application/vnd.multiad.creator.cif": { + source: "iana", + }, + "application/vnd.music-niff": { + source: "iana", + }, + "application/vnd.musician": { + source: "iana", + extensions: ["mus"], + }, + "application/vnd.muvee.style": { + source: "iana", + extensions: ["msty"], + }, + "application/vnd.mynfc": { + source: "iana", + extensions: ["taglet"], + }, + "application/vnd.nacamar.ybrid+json": { + source: "iana", + compressible: true, + }, + "application/vnd.ncd.control": { + source: "iana", + }, + "application/vnd.ncd.reference": { + source: "iana", + }, + "application/vnd.nearst.inv+json": { + source: "iana", + compressible: true, + }, + "application/vnd.nebumind.line": { + source: "iana", + }, + "application/vnd.nervana": { + source: "iana", + }, + "application/vnd.netfpx": { + source: "iana", + }, + "application/vnd.neurolanguage.nlu": { + source: "iana", + extensions: ["nlu"], + }, + "application/vnd.nimn": { + source: "iana", + }, + "application/vnd.nintendo.nitro.rom": { + source: "iana", + }, + "application/vnd.nintendo.snes.rom": { + source: "iana", + }, + "application/vnd.nitf": { + source: "iana", + extensions: ["ntf", "nitf"], + }, + "application/vnd.noblenet-directory": { + source: "iana", + extensions: ["nnd"], + }, + "application/vnd.noblenet-sealer": { + source: "iana", + extensions: ["nns"], + }, + "application/vnd.noblenet-web": { + source: "iana", + extensions: ["nnw"], + }, + "application/vnd.nokia.catalogs": { + source: "iana", + }, + "application/vnd.nokia.conml+wbxml": { + source: "iana", + }, + "application/vnd.nokia.conml+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.nokia.iptv.config+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.nokia.isds-radio-presets": { + source: "iana", + }, + "application/vnd.nokia.landmark+wbxml": { + source: "iana", + }, + "application/vnd.nokia.landmark+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.nokia.landmarkcollection+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.nokia.n-gage.ac+xml": { + source: "iana", + compressible: true, + extensions: ["ac"], + }, + "application/vnd.nokia.n-gage.data": { + source: "iana", + extensions: ["ngdat"], + }, + "application/vnd.nokia.n-gage.symbian.install": { + source: "iana", + extensions: ["n-gage"], + }, + "application/vnd.nokia.ncd": { + source: "iana", + }, + "application/vnd.nokia.pcd+wbxml": { + source: "iana", + }, + "application/vnd.nokia.pcd+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.nokia.radio-preset": { + source: "iana", + extensions: ["rpst"], + }, + "application/vnd.nokia.radio-presets": { + source: "iana", + extensions: ["rpss"], + }, + "application/vnd.novadigm.edm": { + source: "iana", + extensions: ["edm"], + }, + "application/vnd.novadigm.edx": { + source: "iana", + extensions: ["edx"], + }, + "application/vnd.novadigm.ext": { + source: "iana", + extensions: ["ext"], + }, + "application/vnd.ntt-local.content-share": { + source: "iana", + }, + "application/vnd.ntt-local.file-transfer": { + source: "iana", + }, + "application/vnd.ntt-local.ogw_remote-access": { + source: "iana", + }, + "application/vnd.ntt-local.sip-ta_remote": { + source: "iana", + }, + "application/vnd.ntt-local.sip-ta_tcp_stream": { + source: "iana", + }, + "application/vnd.oasis.opendocument.chart": { + source: "iana", + extensions: ["odc"], + }, + "application/vnd.oasis.opendocument.chart-template": { + source: "iana", + extensions: ["otc"], + }, + "application/vnd.oasis.opendocument.database": { + source: "iana", + extensions: ["odb"], + }, + "application/vnd.oasis.opendocument.formula": { + source: "iana", + extensions: ["odf"], + }, + "application/vnd.oasis.opendocument.formula-template": { + source: "iana", + extensions: ["odft"], + }, + "application/vnd.oasis.opendocument.graphics": { + source: "iana", + compressible: false, + extensions: ["odg"], + }, + "application/vnd.oasis.opendocument.graphics-template": { + source: "iana", + extensions: ["otg"], + }, + "application/vnd.oasis.opendocument.image": { + source: "iana", + extensions: ["odi"], + }, + "application/vnd.oasis.opendocument.image-template": { + source: "iana", + extensions: ["oti"], + }, + "application/vnd.oasis.opendocument.presentation": { + source: "iana", + compressible: false, + extensions: ["odp"], + }, + "application/vnd.oasis.opendocument.presentation-template": { + source: "iana", + extensions: ["otp"], + }, + "application/vnd.oasis.opendocument.spreadsheet": { + source: "iana", + compressible: false, + extensions: ["ods"], + }, + "application/vnd.oasis.opendocument.spreadsheet-template": { + source: "iana", + extensions: ["ots"], + }, + "application/vnd.oasis.opendocument.text": { + source: "iana", + compressible: false, + extensions: ["odt"], + }, + "application/vnd.oasis.opendocument.text-master": { + source: "iana", + extensions: ["odm"], + }, + "application/vnd.oasis.opendocument.text-template": { + source: "iana", + extensions: ["ott"], + }, + "application/vnd.oasis.opendocument.text-web": { + source: "iana", + extensions: ["oth"], + }, + "application/vnd.obn": { + source: "iana", + }, + "application/vnd.ocf+cbor": { + source: "iana", + }, + "application/vnd.oci.image.manifest.v1+json": { + source: "iana", + compressible: true, + }, + "application/vnd.oftn.l10n+json": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.contentaccessdownload+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.contentaccessstreaming+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.cspg-hexbinary": { + source: "iana", + }, + "application/vnd.oipf.dae.svg+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.dae.xhtml+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.mippvcontrolmessage+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.pae.gem": { + source: "iana", + }, + "application/vnd.oipf.spdiscovery+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.spdlist+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.ueprofile+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oipf.userprofile+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.olpc-sugar": { + source: "iana", + extensions: ["xo"], + }, + "application/vnd.oma-scws-config": { + source: "iana", + }, + "application/vnd.oma-scws-http-request": { + source: "iana", + }, + "application/vnd.oma-scws-http-response": { + source: "iana", + }, + "application/vnd.oma.bcast.associated-procedure-parameter+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.bcast.drm-trigger+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.bcast.imd+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.bcast.ltkm": { + source: "iana", + }, + "application/vnd.oma.bcast.notification+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.bcast.provisioningtrigger": { + source: "iana", + }, + "application/vnd.oma.bcast.sgboot": { + source: "iana", + }, + "application/vnd.oma.bcast.sgdd+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.bcast.sgdu": { + source: "iana", + }, + "application/vnd.oma.bcast.simple-symbol-container": { + source: "iana", + }, + "application/vnd.oma.bcast.smartcard-trigger+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.bcast.sprov+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.bcast.stkm": { + source: "iana", + }, + "application/vnd.oma.cab-address-book+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.cab-feature-handler+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.cab-pcc+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.cab-subs-invite+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.cab-user-prefs+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.dcd": { + source: "iana", + }, + "application/vnd.oma.dcdc": { + source: "iana", + }, + "application/vnd.oma.dd2+xml": { + source: "iana", + compressible: true, + extensions: ["dd2"], + }, + "application/vnd.oma.drm.risd+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.group-usage-list+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.lwm2m+cbor": { + source: "iana", + }, + "application/vnd.oma.lwm2m+json": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.lwm2m+tlv": { + source: "iana", + }, + "application/vnd.oma.pal+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.poc.detailed-progress-report+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.poc.final-report+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.poc.groups+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.poc.invocation-descriptor+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.poc.optimized-progress-report+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.push": { + source: "iana", + }, + "application/vnd.oma.scidm.messages+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oma.xcap-directory+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.omads-email+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/vnd.omads-file+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/vnd.omads-folder+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/vnd.omaloc-supl-init": { + source: "iana", + }, + "application/vnd.onepager": { + source: "iana", + }, + "application/vnd.onepagertamp": { + source: "iana", + }, + "application/vnd.onepagertamx": { + source: "iana", + }, + "application/vnd.onepagertat": { + source: "iana", + }, + "application/vnd.onepagertatp": { + source: "iana", + }, + "application/vnd.onepagertatx": { + source: "iana", + }, + "application/vnd.openblox.game+xml": { + source: "iana", + compressible: true, + extensions: ["obgx"], + }, + "application/vnd.openblox.game-binary": { + source: "iana", + }, + "application/vnd.openeye.oeb": { + source: "iana", + }, + "application/vnd.openofficeorg.extension": { + source: "apache", + extensions: ["oxt"], + }, + "application/vnd.openstreetmap.data+xml": { + source: "iana", + compressible: true, + extensions: ["osm"], + }, + "application/vnd.opentimestamps.ots": { + source: "iana", + }, + "application/vnd.openxmlformats-officedocument.custom-properties+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.customxmlproperties+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.drawing+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.extended-properties+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.comments+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.presentation": { + source: "iana", + compressible: false, + extensions: ["pptx"], + }, + "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.slide": { + source: "iana", + extensions: ["sldx"], + }, + "application/vnd.openxmlformats-officedocument.presentationml.slide+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideshow": { + source: "iana", + extensions: ["ppsx"], + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.tags+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.template": { + source: "iana", + extensions: ["potx"], + }, + "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": { + source: "iana", + compressible: false, + extensions: ["xlsx"], + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.template": { + source: "iana", + extensions: ["xltx"], + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.theme+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.themeoverride+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.vmldrawing": { + source: "iana", + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { + source: "iana", + compressible: false, + extensions: ["docx"], + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.template": { + source: "iana", + extensions: ["dotx"], + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-package.core-properties+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.openxmlformats-package.relationships+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oracle.resource+json": { + source: "iana", + compressible: true, + }, + "application/vnd.orange.indata": { + source: "iana", + }, + "application/vnd.osa.netdeploy": { + source: "iana", + }, + "application/vnd.osgeo.mapguide.package": { + source: "iana", + extensions: ["mgp"], + }, + "application/vnd.osgi.bundle": { + source: "iana", + }, + "application/vnd.osgi.dp": { + source: "iana", + extensions: ["dp"], + }, + "application/vnd.osgi.subsystem": { + source: "iana", + extensions: ["esa"], + }, + "application/vnd.otps.ct-kip+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.oxli.countgraph": { + source: "iana", + }, + "application/vnd.pagerduty+json": { + source: "iana", + compressible: true, + }, + "application/vnd.palm": { + source: "iana", + extensions: ["pdb", "pqa", "oprc"], + }, + "application/vnd.panoply": { + source: "iana", + }, + "application/vnd.paos.xml": { + source: "iana", + }, + "application/vnd.patentdive": { + source: "iana", + }, + "application/vnd.patientecommsdoc": { + source: "iana", + }, + "application/vnd.pawaafile": { + source: "iana", + extensions: ["paw"], + }, + "application/vnd.pcos": { + source: "iana", + }, + "application/vnd.pg.format": { + source: "iana", + extensions: ["str"], + }, + "application/vnd.pg.osasli": { + source: "iana", + extensions: ["ei6"], + }, + "application/vnd.piaccess.application-licence": { + source: "iana", + }, + "application/vnd.picsel": { + source: "iana", + extensions: ["efif"], + }, + "application/vnd.pmi.widget": { + source: "iana", + extensions: ["wg"], + }, + "application/vnd.poc.group-advertisement+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.pocketlearn": { + source: "iana", + extensions: ["plf"], + }, + "application/vnd.powerbuilder6": { + source: "iana", + extensions: ["pbd"], + }, + "application/vnd.powerbuilder6-s": { + source: "iana", + }, + "application/vnd.powerbuilder7": { + source: "iana", + }, + "application/vnd.powerbuilder7-s": { + source: "iana", + }, + "application/vnd.powerbuilder75": { + source: "iana", + }, + "application/vnd.powerbuilder75-s": { + source: "iana", + }, + "application/vnd.preminet": { + source: "iana", + }, + "application/vnd.previewsystems.box": { + source: "iana", + extensions: ["box"], + }, + "application/vnd.proteus.magazine": { + source: "iana", + extensions: ["mgz"], + }, + "application/vnd.psfs": { + source: "iana", + }, + "application/vnd.publishare-delta-tree": { + source: "iana", + extensions: ["qps"], + }, + "application/vnd.pvi.ptid1": { + source: "iana", + extensions: ["ptid"], + }, + "application/vnd.pwg-multiplexed": { + source: "iana", + }, + "application/vnd.pwg-xhtml-print+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.qualcomm.brew-app-res": { + source: "iana", + }, + "application/vnd.quarantainenet": { + source: "iana", + }, + "application/vnd.quark.quarkxpress": { + source: "iana", + extensions: ["qxd", "qxt", "qwd", "qwt", "qxl", "qxb"], + }, + "application/vnd.quobject-quoxdocument": { + source: "iana", + }, + "application/vnd.radisys.moml+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-audit+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-audit-conf+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-audit-conn+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-audit-dialog+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-audit-stream+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-conf+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-dialog+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-dialog-base+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-dialog-fax-detect+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-dialog-fax-sendrecv+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-dialog-group+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-dialog-speech+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.radisys.msml-dialog-transform+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.rainstor.data": { + source: "iana", + }, + "application/vnd.rapid": { + source: "iana", + }, + "application/vnd.rar": { + source: "iana", + extensions: ["rar"], + }, + "application/vnd.realvnc.bed": { + source: "iana", + extensions: ["bed"], + }, + "application/vnd.recordare.musicxml": { + source: "iana", + extensions: ["mxl"], + }, + "application/vnd.recordare.musicxml+xml": { + source: "iana", + compressible: true, + extensions: ["musicxml"], + }, + "application/vnd.renlearn.rlprint": { + source: "iana", + }, + "application/vnd.resilient.logic": { + source: "iana", + }, + "application/vnd.restful+json": { + source: "iana", + compressible: true, + }, + "application/vnd.rig.cryptonote": { + source: "iana", + extensions: ["cryptonote"], + }, + "application/vnd.rim.cod": { + source: "apache", + extensions: ["cod"], + }, + "application/vnd.rn-realmedia": { + source: "apache", + extensions: ["rm"], + }, + "application/vnd.rn-realmedia-vbr": { + source: "apache", + extensions: ["rmvb"], + }, + "application/vnd.route66.link66+xml": { + source: "iana", + compressible: true, + extensions: ["link66"], + }, + "application/vnd.rs-274x": { + source: "iana", + }, + "application/vnd.ruckus.download": { + source: "iana", + }, + "application/vnd.s3sms": { + source: "iana", + }, + "application/vnd.sailingtracker.track": { + source: "iana", + extensions: ["st"], + }, + "application/vnd.sar": { + source: "iana", + }, + "application/vnd.sbm.cid": { + source: "iana", + }, + "application/vnd.sbm.mid2": { + source: "iana", + }, + "application/vnd.scribus": { + source: "iana", + }, + "application/vnd.sealed.3df": { + source: "iana", + }, + "application/vnd.sealed.csf": { + source: "iana", + }, + "application/vnd.sealed.doc": { + source: "iana", + }, + "application/vnd.sealed.eml": { + source: "iana", + }, + "application/vnd.sealed.mht": { + source: "iana", + }, + "application/vnd.sealed.net": { + source: "iana", + }, + "application/vnd.sealed.ppt": { + source: "iana", + }, + "application/vnd.sealed.tiff": { + source: "iana", + }, + "application/vnd.sealed.xls": { + source: "iana", + }, + "application/vnd.sealedmedia.softseal.html": { + source: "iana", + }, + "application/vnd.sealedmedia.softseal.pdf": { + source: "iana", + }, + "application/vnd.seemail": { + source: "iana", + extensions: ["see"], + }, + "application/vnd.seis+json": { + source: "iana", + compressible: true, + }, + "application/vnd.sema": { + source: "iana", + extensions: ["sema"], + }, + "application/vnd.semd": { + source: "iana", + extensions: ["semd"], + }, + "application/vnd.semf": { + source: "iana", + extensions: ["semf"], + }, + "application/vnd.shade-save-file": { + source: "iana", + }, + "application/vnd.shana.informed.formdata": { + source: "iana", + extensions: ["ifm"], + }, + "application/vnd.shana.informed.formtemplate": { + source: "iana", + extensions: ["itp"], + }, + "application/vnd.shana.informed.interchange": { + source: "iana", + extensions: ["iif"], + }, + "application/vnd.shana.informed.package": { + source: "iana", + extensions: ["ipk"], + }, + "application/vnd.shootproof+json": { + source: "iana", + compressible: true, + }, + "application/vnd.shopkick+json": { + source: "iana", + compressible: true, + }, + "application/vnd.shp": { + source: "iana", + }, + "application/vnd.shx": { + source: "iana", + }, + "application/vnd.sigrok.session": { + source: "iana", + }, + "application/vnd.simtech-mindmapper": { + source: "iana", + extensions: ["twd", "twds"], + }, + "application/vnd.siren+json": { + source: "iana", + compressible: true, + }, + "application/vnd.smaf": { + source: "iana", + extensions: ["mmf"], + }, + "application/vnd.smart.notebook": { + source: "iana", + }, + "application/vnd.smart.teacher": { + source: "iana", + extensions: ["teacher"], + }, + "application/vnd.snesdev-page-table": { + source: "iana", + }, + "application/vnd.software602.filler.form+xml": { + source: "iana", + compressible: true, + extensions: ["fo"], + }, + "application/vnd.software602.filler.form-xml-zip": { + source: "iana", + }, + "application/vnd.solent.sdkm+xml": { + source: "iana", + compressible: true, + extensions: ["sdkm", "sdkd"], + }, + "application/vnd.spotfire.dxp": { + source: "iana", + extensions: ["dxp"], + }, + "application/vnd.spotfire.sfs": { + source: "iana", + extensions: ["sfs"], + }, + "application/vnd.sqlite3": { + source: "iana", + }, + "application/vnd.sss-cod": { + source: "iana", + }, + "application/vnd.sss-dtf": { + source: "iana", + }, + "application/vnd.sss-ntf": { + source: "iana", + }, + "application/vnd.stardivision.calc": { + source: "apache", + extensions: ["sdc"], + }, + "application/vnd.stardivision.draw": { + source: "apache", + extensions: ["sda"], + }, + "application/vnd.stardivision.impress": { + source: "apache", + extensions: ["sdd"], + }, + "application/vnd.stardivision.math": { + source: "apache", + extensions: ["smf"], + }, + "application/vnd.stardivision.writer": { + source: "apache", + extensions: ["sdw", "vor"], + }, + "application/vnd.stardivision.writer-global": { + source: "apache", + extensions: ["sgl"], + }, + "application/vnd.stepmania.package": { + source: "iana", + extensions: ["smzip"], + }, + "application/vnd.stepmania.stepchart": { + source: "iana", + extensions: ["sm"], + }, + "application/vnd.street-stream": { + source: "iana", + }, + "application/vnd.sun.wadl+xml": { + source: "iana", + compressible: true, + extensions: ["wadl"], + }, + "application/vnd.sun.xml.calc": { + source: "apache", + extensions: ["sxc"], + }, + "application/vnd.sun.xml.calc.template": { + source: "apache", + extensions: ["stc"], + }, + "application/vnd.sun.xml.draw": { + source: "apache", + extensions: ["sxd"], + }, + "application/vnd.sun.xml.draw.template": { + source: "apache", + extensions: ["std"], + }, + "application/vnd.sun.xml.impress": { + source: "apache", + extensions: ["sxi"], + }, + "application/vnd.sun.xml.impress.template": { + source: "apache", + extensions: ["sti"], + }, + "application/vnd.sun.xml.math": { + source: "apache", + extensions: ["sxm"], + }, + "application/vnd.sun.xml.writer": { + source: "apache", + extensions: ["sxw"], + }, + "application/vnd.sun.xml.writer.global": { + source: "apache", + extensions: ["sxg"], + }, + "application/vnd.sun.xml.writer.template": { + source: "apache", + extensions: ["stw"], + }, + "application/vnd.sus-calendar": { + source: "iana", + extensions: ["sus", "susp"], + }, + "application/vnd.svd": { + source: "iana", + extensions: ["svd"], + }, + "application/vnd.swiftview-ics": { + source: "iana", + }, + "application/vnd.sycle+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.syft+json": { + source: "iana", + compressible: true, + }, + "application/vnd.symbian.install": { + source: "apache", + extensions: ["sis", "sisx"], + }, + "application/vnd.syncml+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["xsm"], + }, + "application/vnd.syncml.dm+wbxml": { + source: "iana", + charset: "UTF-8", + extensions: ["bdm"], + }, + "application/vnd.syncml.dm+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["xdm"], + }, + "application/vnd.syncml.dm.notification": { + source: "iana", + }, + "application/vnd.syncml.dmddf+wbxml": { + source: "iana", + }, + "application/vnd.syncml.dmddf+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["ddf"], + }, + "application/vnd.syncml.dmtnds+wbxml": { + source: "iana", + }, + "application/vnd.syncml.dmtnds+xml": { + source: "iana", + charset: "UTF-8", + compressible: true, + }, + "application/vnd.syncml.ds.notification": { + source: "iana", + }, + "application/vnd.tableschema+json": { + source: "iana", + compressible: true, + }, + "application/vnd.tao.intent-module-archive": { + source: "iana", + extensions: ["tao"], + }, + "application/vnd.tcpdump.pcap": { + source: "iana", + extensions: ["pcap", "cap", "dmp"], + }, + "application/vnd.think-cell.ppttc+json": { + source: "iana", + compressible: true, + }, + "application/vnd.tmd.mediaflex.api+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.tml": { + source: "iana", + }, + "application/vnd.tmobile-livetv": { + source: "iana", + extensions: ["tmo"], + }, + "application/vnd.tri.onesource": { + source: "iana", + }, + "application/vnd.trid.tpt": { + source: "iana", + extensions: ["tpt"], + }, + "application/vnd.triscape.mxs": { + source: "iana", + extensions: ["mxs"], + }, + "application/vnd.trueapp": { + source: "iana", + extensions: ["tra"], + }, + "application/vnd.truedoc": { + source: "iana", + }, + "application/vnd.ubisoft.webplayer": { + source: "iana", + }, + "application/vnd.ufdl": { + source: "iana", + extensions: ["ufd", "ufdl"], + }, + "application/vnd.uiq.theme": { + source: "iana", + extensions: ["utz"], + }, + "application/vnd.umajin": { + source: "iana", + extensions: ["umj"], + }, + "application/vnd.unity": { + source: "iana", + extensions: ["unityweb"], + }, + "application/vnd.uoml+xml": { + source: "iana", + compressible: true, + extensions: ["uoml"], + }, + "application/vnd.uplanet.alert": { + source: "iana", + }, + "application/vnd.uplanet.alert-wbxml": { + source: "iana", + }, + "application/vnd.uplanet.bearer-choice": { + source: "iana", + }, + "application/vnd.uplanet.bearer-choice-wbxml": { + source: "iana", + }, + "application/vnd.uplanet.cacheop": { + source: "iana", + }, + "application/vnd.uplanet.cacheop-wbxml": { + source: "iana", + }, + "application/vnd.uplanet.channel": { + source: "iana", + }, + "application/vnd.uplanet.channel-wbxml": { + source: "iana", + }, + "application/vnd.uplanet.list": { + source: "iana", + }, + "application/vnd.uplanet.list-wbxml": { + source: "iana", + }, + "application/vnd.uplanet.listcmd": { + source: "iana", + }, + "application/vnd.uplanet.listcmd-wbxml": { + source: "iana", + }, + "application/vnd.uplanet.signal": { + source: "iana", + }, + "application/vnd.uri-map": { + source: "iana", + }, + "application/vnd.valve.source.material": { + source: "iana", + }, + "application/vnd.vcx": { + source: "iana", + extensions: ["vcx"], + }, + "application/vnd.vd-study": { + source: "iana", + }, + "application/vnd.vectorworks": { + source: "iana", + }, + "application/vnd.vel+json": { + source: "iana", + compressible: true, + }, + "application/vnd.verimatrix.vcas": { + source: "iana", + }, + "application/vnd.veritone.aion+json": { + source: "iana", + compressible: true, + }, + "application/vnd.veryant.thin": { + source: "iana", + }, + "application/vnd.ves.encrypted": { + source: "iana", + }, + "application/vnd.vidsoft.vidconference": { + source: "iana", + }, + "application/vnd.visio": { + source: "iana", + extensions: ["vsd", "vst", "vss", "vsw"], + }, + "application/vnd.visionary": { + source: "iana", + extensions: ["vis"], + }, + "application/vnd.vividence.scriptfile": { + source: "iana", + }, + "application/vnd.vsf": { + source: "iana", + extensions: ["vsf"], + }, + "application/vnd.wap.sic": { + source: "iana", + }, + "application/vnd.wap.slc": { + source: "iana", + }, + "application/vnd.wap.wbxml": { + source: "iana", + charset: "UTF-8", + extensions: ["wbxml"], + }, + "application/vnd.wap.wmlc": { + source: "iana", + extensions: ["wmlc"], + }, + "application/vnd.wap.wmlscriptc": { + source: "iana", + extensions: ["wmlsc"], + }, + "application/vnd.webturbo": { + source: "iana", + extensions: ["wtb"], + }, + "application/vnd.wfa.dpp": { + source: "iana", + }, + "application/vnd.wfa.p2p": { + source: "iana", + }, + "application/vnd.wfa.wsc": { + source: "iana", + }, + "application/vnd.windows.devicepairing": { + source: "iana", + }, + "application/vnd.wmc": { + source: "iana", + }, + "application/vnd.wmf.bootstrap": { + source: "iana", + }, + "application/vnd.wolfram.mathematica": { + source: "iana", + }, + "application/vnd.wolfram.mathematica.package": { + source: "iana", + }, + "application/vnd.wolfram.player": { + source: "iana", + extensions: ["nbp"], + }, + "application/vnd.wordperfect": { + source: "iana", + extensions: ["wpd"], + }, + "application/vnd.wqd": { + source: "iana", + extensions: ["wqd"], + }, + "application/vnd.wrq-hp3000-labelled": { + source: "iana", + }, + "application/vnd.wt.stf": { + source: "iana", + extensions: ["stf"], + }, + "application/vnd.wv.csp+wbxml": { + source: "iana", + }, + "application/vnd.wv.csp+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.wv.ssp+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.xacml+json": { + source: "iana", + compressible: true, + }, + "application/vnd.xara": { + source: "iana", + extensions: ["xar"], + }, + "application/vnd.xfdl": { + source: "iana", + extensions: ["xfdl"], + }, + "application/vnd.xfdl.webform": { + source: "iana", + }, + "application/vnd.xmi+xml": { + source: "iana", + compressible: true, + }, + "application/vnd.xmpie.cpkg": { + source: "iana", + }, + "application/vnd.xmpie.dpkg": { + source: "iana", + }, + "application/vnd.xmpie.plan": { + source: "iana", + }, + "application/vnd.xmpie.ppkg": { + source: "iana", + }, + "application/vnd.xmpie.xlim": { + source: "iana", + }, + "application/vnd.yamaha.hv-dic": { + source: "iana", + extensions: ["hvd"], + }, + "application/vnd.yamaha.hv-script": { + source: "iana", + extensions: ["hvs"], + }, + "application/vnd.yamaha.hv-voice": { + source: "iana", + extensions: ["hvp"], + }, + "application/vnd.yamaha.openscoreformat": { + source: "iana", + extensions: ["osf"], + }, + "application/vnd.yamaha.openscoreformat.osfpvg+xml": { + source: "iana", + compressible: true, + extensions: ["osfpvg"], + }, + "application/vnd.yamaha.remote-setup": { + source: "iana", + }, + "application/vnd.yamaha.smaf-audio": { + source: "iana", + extensions: ["saf"], + }, + "application/vnd.yamaha.smaf-phrase": { + source: "iana", + extensions: ["spf"], + }, + "application/vnd.yamaha.through-ngn": { + source: "iana", + }, + "application/vnd.yamaha.tunnel-udpencap": { + source: "iana", + }, + "application/vnd.yaoweme": { + source: "iana", + }, + "application/vnd.yellowriver-custom-menu": { + source: "iana", + extensions: ["cmp"], + }, + "application/vnd.youtube.yt": { + source: "iana", + }, + "application/vnd.zul": { + source: "iana", + extensions: ["zir", "zirz"], + }, + "application/vnd.zzazz.deck+xml": { + source: "iana", + compressible: true, + extensions: ["zaz"], + }, + "application/voicexml+xml": { + source: "iana", + compressible: true, + extensions: ["vxml"], + }, + "application/voucher-cms+json": { + source: "iana", + compressible: true, + }, + "application/vq-rtcpxr": { + source: "iana", + }, + "application/wasm": { + source: "iana", + compressible: true, + extensions: ["wasm"], + }, + "application/watcherinfo+xml": { + source: "iana", + compressible: true, + extensions: ["wif"], + }, + "application/webpush-options+json": { + source: "iana", + compressible: true, + }, + "application/whoispp-query": { + source: "iana", + }, + "application/whoispp-response": { + source: "iana", + }, + "application/widget": { + source: "iana", + extensions: ["wgt"], + }, + "application/winhlp": { + source: "apache", + extensions: ["hlp"], + }, + "application/wita": { + source: "iana", + }, + "application/wordperfect5.1": { + source: "iana", + }, + "application/wsdl+xml": { + source: "iana", + compressible: true, + extensions: ["wsdl"], + }, + "application/wspolicy+xml": { + source: "iana", + compressible: true, + extensions: ["wspolicy"], + }, + "application/x-7z-compressed": { + source: "apache", + compressible: false, + extensions: ["7z"], + }, + "application/x-abiword": { + source: "apache", + extensions: ["abw"], + }, + "application/x-ace-compressed": { + source: "apache", + extensions: ["ace"], + }, + "application/x-amf": { + source: "apache", + }, + "application/x-apple-diskimage": { + source: "apache", + extensions: ["dmg"], + }, + "application/x-arj": { + compressible: false, + extensions: ["arj"], + }, + "application/x-authorware-bin": { + source: "apache", + extensions: ["aab", "x32", "u32", "vox"], + }, + "application/x-authorware-map": { + source: "apache", + extensions: ["aam"], + }, + "application/x-authorware-seg": { + source: "apache", + extensions: ["aas"], + }, + "application/x-bcpio": { + source: "apache", + extensions: ["bcpio"], + }, + "application/x-bdoc": { + compressible: false, + extensions: ["bdoc"], + }, + "application/x-bittorrent": { + source: "apache", + extensions: ["torrent"], + }, + "application/x-blorb": { + source: "apache", + extensions: ["blb", "blorb"], + }, + "application/x-bzip": { + source: "apache", + compressible: false, + extensions: ["bz"], + }, + "application/x-bzip2": { + source: "apache", + compressible: false, + extensions: ["bz2", "boz"], + }, + "application/x-cbr": { + source: "apache", + extensions: ["cbr", "cba", "cbt", "cbz", "cb7"], + }, + "application/x-cdlink": { + source: "apache", + extensions: ["vcd"], + }, + "application/x-cfs-compressed": { + source: "apache", + extensions: ["cfs"], + }, + "application/x-chat": { + source: "apache", + extensions: ["chat"], + }, + "application/x-chess-pgn": { + source: "apache", + extensions: ["pgn"], + }, + "application/x-chrome-extension": { + extensions: ["crx"], + }, + "application/x-cocoa": { + source: "nginx", + extensions: ["cco"], + }, + "application/x-compress": { + source: "apache", + }, + "application/x-conference": { + source: "apache", + extensions: ["nsc"], + }, + "application/x-cpio": { + source: "apache", + extensions: ["cpio"], + }, + "application/x-csh": { + source: "apache", + extensions: ["csh"], + }, + "application/x-deb": { + compressible: false, + }, + "application/x-debian-package": { + source: "apache", + extensions: ["deb", "udeb"], + }, + "application/x-dgc-compressed": { + source: "apache", + extensions: ["dgc"], + }, + "application/x-director": { + source: "apache", + extensions: ["dir", "dcr", "dxr", "cst", "cct", "cxt", "w3d", "fgd", "swa"], + }, + "application/x-doom": { + source: "apache", + extensions: ["wad"], + }, + "application/x-dtbncx+xml": { + source: "apache", + compressible: true, + extensions: ["ncx"], + }, + "application/x-dtbook+xml": { + source: "apache", + compressible: true, + extensions: ["dtb"], + }, + "application/x-dtbresource+xml": { + source: "apache", + compressible: true, + extensions: ["res"], + }, + "application/x-dvi": { + source: "apache", + compressible: false, + extensions: ["dvi"], + }, + "application/x-envoy": { + source: "apache", + extensions: ["evy"], + }, + "application/x-eva": { + source: "apache", + extensions: ["eva"], + }, + "application/x-font-bdf": { + source: "apache", + extensions: ["bdf"], + }, + "application/x-font-dos": { + source: "apache", + }, + "application/x-font-framemaker": { + source: "apache", + }, + "application/x-font-ghostscript": { + source: "apache", + extensions: ["gsf"], + }, + "application/x-font-libgrx": { + source: "apache", + }, + "application/x-font-linux-psf": { + source: "apache", + extensions: ["psf"], + }, + "application/x-font-pcf": { + source: "apache", + extensions: ["pcf"], + }, + "application/x-font-snf": { + source: "apache", + extensions: ["snf"], + }, + "application/x-font-speedo": { + source: "apache", + }, + "application/x-font-sunos-news": { + source: "apache", + }, + "application/x-font-type1": { + source: "apache", + extensions: ["pfa", "pfb", "pfm", "afm"], + }, + "application/x-font-vfont": { + source: "apache", + }, + "application/x-freearc": { + source: "apache", + extensions: ["arc"], + }, + "application/x-futuresplash": { + source: "apache", + extensions: ["spl"], + }, + "application/x-gca-compressed": { + source: "apache", + extensions: ["gca"], + }, + "application/x-glulx": { + source: "apache", + extensions: ["ulx"], + }, + "application/x-gnumeric": { + source: "apache", + extensions: ["gnumeric"], + }, + "application/x-gramps-xml": { + source: "apache", + extensions: ["gramps"], + }, + "application/x-gtar": { + source: "apache", + extensions: ["gtar"], + }, + "application/x-gzip": { + source: "apache", + }, + "application/x-hdf": { + source: "apache", + extensions: ["hdf"], + }, + "application/x-httpd-php": { + compressible: true, + extensions: ["php"], + }, + "application/x-install-instructions": { + source: "apache", + extensions: ["install"], + }, + "application/x-iso9660-image": { + source: "apache", + extensions: ["iso"], + }, + "application/x-iwork-keynote-sffkey": { + extensions: ["key"], + }, + "application/x-iwork-numbers-sffnumbers": { + extensions: ["numbers"], + }, + "application/x-iwork-pages-sffpages": { + extensions: ["pages"], + }, + "application/x-java-archive-diff": { + source: "nginx", + extensions: ["jardiff"], + }, + "application/x-java-jnlp-file": { + source: "apache", + compressible: false, + extensions: ["jnlp"], + }, + "application/x-javascript": { + compressible: true, + }, + "application/x-keepass2": { + extensions: ["kdbx"], + }, + "application/x-latex": { + source: "apache", + compressible: false, + extensions: ["latex"], + }, + "application/x-lua-bytecode": { + extensions: ["luac"], + }, + "application/x-lzh-compressed": { + source: "apache", + extensions: ["lzh", "lha"], + }, + "application/x-makeself": { + source: "nginx", + extensions: ["run"], + }, + "application/x-mie": { + source: "apache", + extensions: ["mie"], + }, + "application/x-mobipocket-ebook": { + source: "apache", + extensions: ["prc", "mobi"], + }, + "application/x-mpegurl": { + compressible: false, + }, + "application/x-ms-application": { + source: "apache", + extensions: ["application"], + }, + "application/x-ms-shortcut": { + source: "apache", + extensions: ["lnk"], + }, + "application/x-ms-wmd": { + source: "apache", + extensions: ["wmd"], + }, + "application/x-ms-wmz": { + source: "apache", + extensions: ["wmz"], + }, + "application/x-ms-xbap": { + source: "apache", + extensions: ["xbap"], + }, + "application/x-msaccess": { + source: "apache", + extensions: ["mdb"], + }, + "application/x-msbinder": { + source: "apache", + extensions: ["obd"], + }, + "application/x-mscardfile": { + source: "apache", + extensions: ["crd"], + }, + "application/x-msclip": { + source: "apache", + extensions: ["clp"], + }, + "application/x-msdos-program": { + extensions: ["exe"], + }, + "application/x-msdownload": { + source: "apache", + extensions: ["exe", "dll", "com", "bat", "msi"], + }, + "application/x-msmediaview": { + source: "apache", + extensions: ["mvb", "m13", "m14"], + }, + "application/x-msmetafile": { + source: "apache", + extensions: ["wmf", "wmz", "emf", "emz"], + }, + "application/x-msmoney": { + source: "apache", + extensions: ["mny"], + }, + "application/x-mspublisher": { + source: "apache", + extensions: ["pub"], + }, + "application/x-msschedule": { + source: "apache", + extensions: ["scd"], + }, + "application/x-msterminal": { + source: "apache", + extensions: ["trm"], + }, + "application/x-mswrite": { + source: "apache", + extensions: ["wri"], + }, + "application/x-netcdf": { + source: "apache", + extensions: ["nc", "cdf"], + }, + "application/x-ns-proxy-autoconfig": { + compressible: true, + extensions: ["pac"], + }, + "application/x-nzb": { + source: "apache", + extensions: ["nzb"], + }, + "application/x-perl": { + source: "nginx", + extensions: ["pl", "pm"], + }, + "application/x-pilot": { + source: "nginx", + extensions: ["prc", "pdb"], + }, + "application/x-pkcs12": { + source: "apache", + compressible: false, + extensions: ["p12", "pfx"], + }, + "application/x-pkcs7-certificates": { + source: "apache", + extensions: ["p7b", "spc"], + }, + "application/x-pkcs7-certreqresp": { + source: "apache", + extensions: ["p7r"], + }, + "application/x-pki-message": { + source: "iana", + }, + "application/x-rar-compressed": { + source: "apache", + compressible: false, + extensions: ["rar"], + }, + "application/x-redhat-package-manager": { + source: "nginx", + extensions: ["rpm"], + }, + "application/x-research-info-systems": { + source: "apache", + extensions: ["ris"], + }, + "application/x-sea": { + source: "nginx", + extensions: ["sea"], + }, + "application/x-sh": { + source: "apache", + compressible: true, + extensions: ["sh"], + }, + "application/x-shar": { + source: "apache", + extensions: ["shar"], + }, + "application/x-shockwave-flash": { + source: "apache", + compressible: false, + extensions: ["swf"], + }, + "application/x-silverlight-app": { + source: "apache", + extensions: ["xap"], + }, + "application/x-sql": { + source: "apache", + extensions: ["sql"], + }, + "application/x-stuffit": { + source: "apache", + compressible: false, + extensions: ["sit"], + }, + "application/x-stuffitx": { + source: "apache", + extensions: ["sitx"], + }, + "application/x-subrip": { + source: "apache", + extensions: ["srt"], + }, + "application/x-sv4cpio": { + source: "apache", + extensions: ["sv4cpio"], + }, + "application/x-sv4crc": { + source: "apache", + extensions: ["sv4crc"], + }, + "application/x-t3vm-image": { + source: "apache", + extensions: ["t3"], + }, + "application/x-tads": { + source: "apache", + extensions: ["gam"], + }, + "application/x-tar": { + source: "apache", + compressible: true, + extensions: ["tar"], + }, + "application/x-tcl": { + source: "apache", + extensions: ["tcl", "tk"], + }, + "application/x-tex": { + source: "apache", + extensions: ["tex"], + }, + "application/x-tex-tfm": { + source: "apache", + extensions: ["tfm"], + }, + "application/x-texinfo": { + source: "apache", + extensions: ["texinfo", "texi"], + }, + "application/x-tgif": { + source: "apache", + extensions: ["obj"], + }, + "application/x-ustar": { + source: "apache", + extensions: ["ustar"], + }, + "application/x-virtualbox-hdd": { + compressible: true, + extensions: ["hdd"], + }, + "application/x-virtualbox-ova": { + compressible: true, + extensions: ["ova"], + }, + "application/x-virtualbox-ovf": { + compressible: true, + extensions: ["ovf"], + }, + "application/x-virtualbox-vbox": { + compressible: true, + extensions: ["vbox"], + }, + "application/x-virtualbox-vbox-extpack": { + compressible: false, + extensions: ["vbox-extpack"], + }, + "application/x-virtualbox-vdi": { + compressible: true, + extensions: ["vdi"], + }, + "application/x-virtualbox-vhd": { + compressible: true, + extensions: ["vhd"], + }, + "application/x-virtualbox-vmdk": { + compressible: true, + extensions: ["vmdk"], + }, + "application/x-wais-source": { + source: "apache", + extensions: ["src"], + }, + "application/x-web-app-manifest+json": { + compressible: true, + extensions: ["webapp"], + }, + "application/x-www-form-urlencoded": { + source: "iana", + compressible: true, + }, + "application/x-x509-ca-cert": { + source: "iana", + extensions: ["der", "crt", "pem"], + }, + "application/x-x509-ca-ra-cert": { + source: "iana", + }, + "application/x-x509-next-ca-cert": { + source: "iana", + }, + "application/x-xfig": { + source: "apache", + extensions: ["fig"], + }, + "application/x-xliff+xml": { + source: "apache", + compressible: true, + extensions: ["xlf"], + }, + "application/x-xpinstall": { + source: "apache", + compressible: false, + extensions: ["xpi"], + }, + "application/x-xz": { + source: "apache", + extensions: ["xz"], + }, + "application/x-zmachine": { + source: "apache", + extensions: ["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"], + }, + "application/x400-bp": { + source: "iana", + }, + "application/xacml+xml": { + source: "iana", + compressible: true, + }, + "application/xaml+xml": { + source: "apache", + compressible: true, + extensions: ["xaml"], + }, + "application/xcap-att+xml": { + source: "iana", + compressible: true, + extensions: ["xav"], + }, + "application/xcap-caps+xml": { + source: "iana", + compressible: true, + extensions: ["xca"], + }, + "application/xcap-diff+xml": { + source: "iana", + compressible: true, + extensions: ["xdf"], + }, + "application/xcap-el+xml": { + source: "iana", + compressible: true, + extensions: ["xel"], + }, + "application/xcap-error+xml": { + source: "iana", + compressible: true, + }, + "application/xcap-ns+xml": { + source: "iana", + compressible: true, + extensions: ["xns"], + }, + "application/xcon-conference-info+xml": { + source: "iana", + compressible: true, + }, + "application/xcon-conference-info-diff+xml": { + source: "iana", + compressible: true, + }, + "application/xenc+xml": { + source: "iana", + compressible: true, + extensions: ["xenc"], + }, + "application/xhtml+xml": { + source: "iana", + compressible: true, + extensions: ["xhtml", "xht"], + }, + "application/xhtml-voice+xml": { + source: "apache", + compressible: true, + }, + "application/xliff+xml": { + source: "iana", + compressible: true, + extensions: ["xlf"], + }, + "application/xml": { + source: "iana", + compressible: true, + extensions: ["xml", "xsl", "xsd", "rng"], + }, + "application/xml-dtd": { + source: "iana", + compressible: true, + extensions: ["dtd"], + }, + "application/xml-external-parsed-entity": { + source: "iana", + }, + "application/xml-patch+xml": { + source: "iana", + compressible: true, + }, + "application/xmpp+xml": { + source: "iana", + compressible: true, + }, + "application/xop+xml": { + source: "iana", + compressible: true, + extensions: ["xop"], + }, + "application/xproc+xml": { + source: "apache", + compressible: true, + extensions: ["xpl"], + }, + "application/xslt+xml": { + source: "iana", + compressible: true, + extensions: ["xsl", "xslt"], + }, + "application/xspf+xml": { + source: "apache", + compressible: true, + extensions: ["xspf"], + }, + "application/xv+xml": { + source: "iana", + compressible: true, + extensions: ["mxml", "xhvml", "xvml", "xvm"], + }, + "application/yang": { + source: "iana", + extensions: ["yang"], + }, + "application/yang-data+json": { + source: "iana", + compressible: true, + }, + "application/yang-data+xml": { + source: "iana", + compressible: true, + }, + "application/yang-patch+json": { + source: "iana", + compressible: true, + }, + "application/yang-patch+xml": { + source: "iana", + compressible: true, + }, + "application/yin+xml": { + source: "iana", + compressible: true, + extensions: ["yin"], + }, + "application/zip": { + source: "iana", + compressible: false, + extensions: ["zip"], + }, + "application/zlib": { + source: "iana", + }, + "application/zstd": { + source: "iana", + }, + "audio/1d-interleaved-parityfec": { + source: "iana", + }, + "audio/32kadpcm": { + source: "iana", + }, + "audio/3gpp": { + source: "iana", + compressible: false, + extensions: ["3gpp"], + }, + "audio/3gpp2": { + source: "iana", + }, + "audio/aac": { + source: "iana", + }, + "audio/ac3": { + source: "iana", + }, + "audio/adpcm": { + source: "apache", + extensions: ["adp"], + }, + "audio/amr": { + source: "iana", + extensions: ["amr"], + }, + "audio/amr-wb": { + source: "iana", + }, + "audio/amr-wb+": { + source: "iana", + }, + "audio/aptx": { + source: "iana", + }, + "audio/asc": { + source: "iana", + }, + "audio/atrac-advanced-lossless": { + source: "iana", + }, + "audio/atrac-x": { + source: "iana", + }, + "audio/atrac3": { + source: "iana", + }, + "audio/basic": { + source: "iana", + compressible: false, + extensions: ["au", "snd"], + }, + "audio/bv16": { + source: "iana", + }, + "audio/bv32": { + source: "iana", + }, + "audio/clearmode": { + source: "iana", + }, + "audio/cn": { + source: "iana", + }, + "audio/dat12": { + source: "iana", + }, + "audio/dls": { + source: "iana", + }, + "audio/dsr-es201108": { + source: "iana", + }, + "audio/dsr-es202050": { + source: "iana", + }, + "audio/dsr-es202211": { + source: "iana", + }, + "audio/dsr-es202212": { + source: "iana", + }, + "audio/dv": { + source: "iana", + }, + "audio/dvi4": { + source: "iana", + }, + "audio/eac3": { + source: "iana", + }, + "audio/encaprtp": { + source: "iana", + }, + "audio/evrc": { + source: "iana", + }, + "audio/evrc-qcp": { + source: "iana", + }, + "audio/evrc0": { + source: "iana", + }, + "audio/evrc1": { + source: "iana", + }, + "audio/evrcb": { + source: "iana", + }, + "audio/evrcb0": { + source: "iana", + }, + "audio/evrcb1": { + source: "iana", + }, + "audio/evrcnw": { + source: "iana", + }, + "audio/evrcnw0": { + source: "iana", + }, + "audio/evrcnw1": { + source: "iana", + }, + "audio/evrcwb": { + source: "iana", + }, + "audio/evrcwb0": { + source: "iana", + }, + "audio/evrcwb1": { + source: "iana", + }, + "audio/evs": { + source: "iana", + }, + "audio/flexfec": { + source: "iana", + }, + "audio/fwdred": { + source: "iana", + }, + "audio/g711-0": { + source: "iana", + }, + "audio/g719": { + source: "iana", + }, + "audio/g722": { + source: "iana", + }, + "audio/g7221": { + source: "iana", + }, + "audio/g723": { + source: "iana", + }, + "audio/g726-16": { + source: "iana", + }, + "audio/g726-24": { + source: "iana", + }, + "audio/g726-32": { + source: "iana", + }, + "audio/g726-40": { + source: "iana", + }, + "audio/g728": { + source: "iana", + }, + "audio/g729": { + source: "iana", + }, + "audio/g7291": { + source: "iana", + }, + "audio/g729d": { + source: "iana", + }, + "audio/g729e": { + source: "iana", + }, + "audio/gsm": { + source: "iana", + }, + "audio/gsm-efr": { + source: "iana", + }, + "audio/gsm-hr-08": { + source: "iana", + }, + "audio/ilbc": { + source: "iana", + }, + "audio/ip-mr_v2.5": { + source: "iana", + }, + "audio/isac": { + source: "apache", + }, + "audio/l16": { + source: "iana", + }, + "audio/l20": { + source: "iana", + }, + "audio/l24": { + source: "iana", + compressible: false, + }, + "audio/l8": { + source: "iana", + }, + "audio/lpc": { + source: "iana", + }, + "audio/melp": { + source: "iana", + }, + "audio/melp1200": { + source: "iana", + }, + "audio/melp2400": { + source: "iana", + }, + "audio/melp600": { + source: "iana", + }, + "audio/mhas": { + source: "iana", + }, + "audio/midi": { + source: "apache", + extensions: ["mid", "midi", "kar", "rmi"], + }, + "audio/mobile-xmf": { + source: "iana", + extensions: ["mxmf"], + }, + "audio/mp3": { + compressible: false, + extensions: ["mp3"], + }, + "audio/mp4": { + source: "iana", + compressible: false, + extensions: ["m4a", "mp4a"], + }, + "audio/mp4a-latm": { + source: "iana", + }, + "audio/mpa": { + source: "iana", + }, + "audio/mpa-robust": { + source: "iana", + }, + "audio/mpeg": { + source: "iana", + compressible: false, + extensions: ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], + }, + "audio/mpeg4-generic": { + source: "iana", + }, + "audio/musepack": { + source: "apache", + }, + "audio/ogg": { + source: "iana", + compressible: false, + extensions: ["oga", "ogg", "spx", "opus"], + }, + "audio/opus": { + source: "iana", + }, + "audio/parityfec": { + source: "iana", + }, + "audio/pcma": { + source: "iana", + }, + "audio/pcma-wb": { + source: "iana", + }, + "audio/pcmu": { + source: "iana", + }, + "audio/pcmu-wb": { + source: "iana", + }, + "audio/prs.sid": { + source: "iana", + }, + "audio/qcelp": { + source: "iana", + }, + "audio/raptorfec": { + source: "iana", + }, + "audio/red": { + source: "iana", + }, + "audio/rtp-enc-aescm128": { + source: "iana", + }, + "audio/rtp-midi": { + source: "iana", + }, + "audio/rtploopback": { + source: "iana", + }, + "audio/rtx": { + source: "iana", + }, + "audio/s3m": { + source: "apache", + extensions: ["s3m"], + }, + "audio/scip": { + source: "iana", + }, + "audio/silk": { + source: "apache", + extensions: ["sil"], + }, + "audio/smv": { + source: "iana", + }, + "audio/smv-qcp": { + source: "iana", + }, + "audio/smv0": { + source: "iana", + }, + "audio/sofa": { + source: "iana", + }, + "audio/sp-midi": { + source: "iana", + }, + "audio/speex": { + source: "iana", + }, + "audio/t140c": { + source: "iana", + }, + "audio/t38": { + source: "iana", + }, + "audio/telephone-event": { + source: "iana", + }, + "audio/tetra_acelp": { + source: "iana", + }, + "audio/tetra_acelp_bb": { + source: "iana", + }, + "audio/tone": { + source: "iana", + }, + "audio/tsvcis": { + source: "iana", + }, + "audio/uemclip": { + source: "iana", + }, + "audio/ulpfec": { + source: "iana", + }, + "audio/usac": { + source: "iana", + }, + "audio/vdvi": { + source: "iana", + }, + "audio/vmr-wb": { + source: "iana", + }, + "audio/vnd.3gpp.iufp": { + source: "iana", + }, + "audio/vnd.4sb": { + source: "iana", + }, + "audio/vnd.audiokoz": { + source: "iana", + }, + "audio/vnd.celp": { + source: "iana", + }, + "audio/vnd.cisco.nse": { + source: "iana", + }, + "audio/vnd.cmles.radio-events": { + source: "iana", + }, + "audio/vnd.cns.anp1": { + source: "iana", + }, + "audio/vnd.cns.inf1": { + source: "iana", + }, + "audio/vnd.dece.audio": { + source: "iana", + extensions: ["uva", "uvva"], + }, + "audio/vnd.digital-winds": { + source: "iana", + extensions: ["eol"], + }, + "audio/vnd.dlna.adts": { + source: "iana", + }, + "audio/vnd.dolby.heaac.1": { + source: "iana", + }, + "audio/vnd.dolby.heaac.2": { + source: "iana", + }, + "audio/vnd.dolby.mlp": { + source: "iana", + }, + "audio/vnd.dolby.mps": { + source: "iana", + }, + "audio/vnd.dolby.pl2": { + source: "iana", + }, + "audio/vnd.dolby.pl2x": { + source: "iana", + }, + "audio/vnd.dolby.pl2z": { + source: "iana", + }, + "audio/vnd.dolby.pulse.1": { + source: "iana", + }, + "audio/vnd.dra": { + source: "iana", + extensions: ["dra"], + }, + "audio/vnd.dts": { + source: "iana", + extensions: ["dts"], + }, + "audio/vnd.dts.hd": { + source: "iana", + extensions: ["dtshd"], + }, + "audio/vnd.dts.uhd": { + source: "iana", + }, + "audio/vnd.dvb.file": { + source: "iana", + }, + "audio/vnd.everad.plj": { + source: "iana", + }, + "audio/vnd.hns.audio": { + source: "iana", + }, + "audio/vnd.lucent.voice": { + source: "iana", + extensions: ["lvp"], + }, + "audio/vnd.ms-playready.media.pya": { + source: "iana", + extensions: ["pya"], + }, + "audio/vnd.nokia.mobile-xmf": { + source: "iana", + }, + "audio/vnd.nortel.vbk": { + source: "iana", + }, + "audio/vnd.nuera.ecelp4800": { + source: "iana", + extensions: ["ecelp4800"], + }, + "audio/vnd.nuera.ecelp7470": { + source: "iana", + extensions: ["ecelp7470"], + }, + "audio/vnd.nuera.ecelp9600": { + source: "iana", + extensions: ["ecelp9600"], + }, + "audio/vnd.octel.sbc": { + source: "iana", + }, + "audio/vnd.presonus.multitrack": { + source: "iana", + }, + "audio/vnd.qcelp": { + source: "iana", + }, + "audio/vnd.rhetorex.32kadpcm": { + source: "iana", + }, + "audio/vnd.rip": { + source: "iana", + extensions: ["rip"], + }, + "audio/vnd.rn-realaudio": { + compressible: false, + }, + "audio/vnd.sealedmedia.softseal.mpeg": { + source: "iana", + }, + "audio/vnd.vmx.cvsd": { + source: "iana", + }, + "audio/vnd.wave": { + compressible: false, + }, + "audio/vorbis": { + source: "iana", + compressible: false, + }, + "audio/vorbis-config": { + source: "iana", + }, + "audio/wav": { + compressible: false, + extensions: ["wav"], + }, + "audio/wave": { + compressible: false, + extensions: ["wav"], + }, + "audio/webm": { + source: "apache", + compressible: false, + extensions: ["weba"], + }, + "audio/x-aac": { + source: "apache", + compressible: false, + extensions: ["aac"], + }, + "audio/x-aiff": { + source: "apache", + extensions: ["aif", "aiff", "aifc"], + }, + "audio/x-caf": { + source: "apache", + compressible: false, + extensions: ["caf"], + }, + "audio/x-flac": { + source: "apache", + extensions: ["flac"], + }, + "audio/x-m4a": { + source: "nginx", + extensions: ["m4a"], + }, + "audio/x-matroska": { + source: "apache", + extensions: ["mka"], + }, + "audio/x-mpegurl": { + source: "apache", + extensions: ["m3u"], + }, + "audio/x-ms-wax": { + source: "apache", + extensions: ["wax"], + }, + "audio/x-ms-wma": { + source: "apache", + extensions: ["wma"], + }, + "audio/x-pn-realaudio": { + source: "apache", + extensions: ["ram", "ra"], + }, + "audio/x-pn-realaudio-plugin": { + source: "apache", + extensions: ["rmp"], + }, + "audio/x-realaudio": { + source: "nginx", + extensions: ["ra"], + }, + "audio/x-tta": { + source: "apache", + }, + "audio/x-wav": { + source: "apache", + extensions: ["wav"], + }, + "audio/xm": { + source: "apache", + extensions: ["xm"], + }, + "chemical/x-cdx": { + source: "apache", + extensions: ["cdx"], + }, + "chemical/x-cif": { + source: "apache", + extensions: ["cif"], + }, + "chemical/x-cmdf": { + source: "apache", + extensions: ["cmdf"], + }, + "chemical/x-cml": { + source: "apache", + extensions: ["cml"], + }, + "chemical/x-csml": { + source: "apache", + extensions: ["csml"], + }, + "chemical/x-pdb": { + source: "apache", + }, + "chemical/x-xyz": { + source: "apache", + extensions: ["xyz"], + }, + "font/collection": { + source: "iana", + extensions: ["ttc"], + }, + "font/otf": { + source: "iana", + compressible: true, + extensions: ["otf"], + }, + "font/sfnt": { + source: "iana", + }, + "font/ttf": { + source: "iana", + compressible: true, + extensions: ["ttf"], + }, + "font/woff": { + source: "iana", + extensions: ["woff"], + }, + "font/woff2": { + source: "iana", + extensions: ["woff2"], + }, + "image/aces": { + source: "iana", + extensions: ["exr"], + }, + "image/apng": { + compressible: false, + extensions: ["apng"], + }, + "image/avci": { + source: "iana", + extensions: ["avci"], + }, + "image/avcs": { + source: "iana", + extensions: ["avcs"], + }, + "image/avif": { + source: "iana", + compressible: false, + extensions: ["avif"], + }, + "image/bmp": { + source: "iana", + compressible: true, + extensions: ["bmp"], + }, + "image/cgm": { + source: "iana", + extensions: ["cgm"], + }, + "image/dicom-rle": { + source: "iana", + extensions: ["drle"], + }, + "image/emf": { + source: "iana", + extensions: ["emf"], + }, + "image/fits": { + source: "iana", + extensions: ["fits"], + }, + "image/g3fax": { + source: "iana", + extensions: ["g3"], + }, + "image/gif": { + source: "iana", + compressible: false, + extensions: ["gif"], + }, + "image/heic": { + source: "iana", + extensions: ["heic"], + }, + "image/heic-sequence": { + source: "iana", + extensions: ["heics"], + }, + "image/heif": { + source: "iana", + extensions: ["heif"], + }, + "image/heif-sequence": { + source: "iana", + extensions: ["heifs"], + }, + "image/hej2k": { + source: "iana", + extensions: ["hej2"], + }, + "image/hsj2": { + source: "iana", + extensions: ["hsj2"], + }, + "image/ief": { + source: "iana", + extensions: ["ief"], + }, + "image/jls": { + source: "iana", + extensions: ["jls"], + }, + "image/jp2": { + source: "iana", + compressible: false, + extensions: ["jp2", "jpg2"], + }, + "image/jpeg": { + source: "iana", + compressible: false, + extensions: ["jpeg", "jpg", "jpe"], + }, + "image/jph": { + source: "iana", + extensions: ["jph"], + }, + "image/jphc": { + source: "iana", + extensions: ["jhc"], + }, + "image/jpm": { + source: "iana", + compressible: false, + extensions: ["jpm"], + }, + "image/jpx": { + source: "iana", + compressible: false, + extensions: ["jpx", "jpf"], + }, + "image/jxr": { + source: "iana", + extensions: ["jxr"], + }, + "image/jxra": { + source: "iana", + extensions: ["jxra"], + }, + "image/jxrs": { + source: "iana", + extensions: ["jxrs"], + }, + "image/jxs": { + source: "iana", + extensions: ["jxs"], + }, + "image/jxsc": { + source: "iana", + extensions: ["jxsc"], + }, + "image/jxsi": { + source: "iana", + extensions: ["jxsi"], + }, + "image/jxss": { + source: "iana", + extensions: ["jxss"], + }, + "image/ktx": { + source: "iana", + extensions: ["ktx"], + }, + "image/ktx2": { + source: "iana", + extensions: ["ktx2"], + }, + "image/naplps": { + source: "iana", + }, + "image/pjpeg": { + compressible: false, + }, + "image/png": { + source: "iana", + compressible: false, + extensions: ["png"], + }, + "image/prs.btif": { + source: "iana", + extensions: ["btif"], + }, + "image/prs.pti": { + source: "iana", + extensions: ["pti"], + }, + "image/pwg-raster": { + source: "iana", + }, + "image/sgi": { + source: "apache", + extensions: ["sgi"], + }, + "image/svg+xml": { + source: "iana", + compressible: true, + extensions: ["svg", "svgz"], + }, + "image/t38": { + source: "iana", + extensions: ["t38"], + }, + "image/tiff": { + source: "iana", + compressible: false, + extensions: ["tif", "tiff"], + }, + "image/tiff-fx": { + source: "iana", + extensions: ["tfx"], + }, + "image/vnd.adobe.photoshop": { + source: "iana", + compressible: true, + extensions: ["psd"], + }, + "image/vnd.airzip.accelerator.azv": { + source: "iana", + extensions: ["azv"], + }, + "image/vnd.cns.inf2": { + source: "iana", + }, + "image/vnd.dece.graphic": { + source: "iana", + extensions: ["uvi", "uvvi", "uvg", "uvvg"], + }, + "image/vnd.djvu": { + source: "iana", + extensions: ["djvu", "djv"], + }, + "image/vnd.dvb.subtitle": { + source: "iana", + extensions: ["sub"], + }, + "image/vnd.dwg": { + source: "iana", + extensions: ["dwg"], + }, + "image/vnd.dxf": { + source: "iana", + extensions: ["dxf"], + }, + "image/vnd.fastbidsheet": { + source: "iana", + extensions: ["fbs"], + }, + "image/vnd.fpx": { + source: "iana", + extensions: ["fpx"], + }, + "image/vnd.fst": { + source: "iana", + extensions: ["fst"], + }, + "image/vnd.fujixerox.edmics-mmr": { + source: "iana", + extensions: ["mmr"], + }, + "image/vnd.fujixerox.edmics-rlc": { + source: "iana", + extensions: ["rlc"], + }, + "image/vnd.globalgraphics.pgb": { + source: "iana", + }, + "image/vnd.microsoft.icon": { + source: "iana", + compressible: true, + extensions: ["ico"], + }, + "image/vnd.mix": { + source: "iana", + }, + "image/vnd.mozilla.apng": { + source: "iana", + }, + "image/vnd.ms-dds": { + compressible: true, + extensions: ["dds"], + }, + "image/vnd.ms-modi": { + source: "iana", + extensions: ["mdi"], + }, + "image/vnd.ms-photo": { + source: "apache", + extensions: ["wdp"], + }, + "image/vnd.net-fpx": { + source: "iana", + extensions: ["npx"], + }, + "image/vnd.pco.b16": { + source: "iana", + extensions: ["b16"], + }, + "image/vnd.radiance": { + source: "iana", + }, + "image/vnd.sealed.png": { + source: "iana", + }, + "image/vnd.sealedmedia.softseal.gif": { + source: "iana", + }, + "image/vnd.sealedmedia.softseal.jpg": { + source: "iana", + }, + "image/vnd.svf": { + source: "iana", + }, + "image/vnd.tencent.tap": { + source: "iana", + extensions: ["tap"], + }, + "image/vnd.valve.source.texture": { + source: "iana", + extensions: ["vtf"], + }, + "image/vnd.wap.wbmp": { + source: "iana", + extensions: ["wbmp"], + }, + "image/vnd.xiff": { + source: "iana", + extensions: ["xif"], + }, + "image/vnd.zbrush.pcx": { + source: "iana", + extensions: ["pcx"], + }, + "image/webp": { + source: "apache", + extensions: ["webp"], + }, + "image/wmf": { + source: "iana", + extensions: ["wmf"], + }, + "image/x-3ds": { + source: "apache", + extensions: ["3ds"], + }, + "image/x-cmu-raster": { + source: "apache", + extensions: ["ras"], + }, + "image/x-cmx": { + source: "apache", + extensions: ["cmx"], + }, + "image/x-freehand": { + source: "apache", + extensions: ["fh", "fhc", "fh4", "fh5", "fh7"], + }, + "image/x-icon": { + source: "apache", + compressible: true, + extensions: ["ico"], + }, + "image/x-jng": { + source: "nginx", + extensions: ["jng"], + }, + "image/x-mrsid-image": { + source: "apache", + extensions: ["sid"], + }, + "image/x-ms-bmp": { + source: "nginx", + compressible: true, + extensions: ["bmp"], + }, + "image/x-pcx": { + source: "apache", + extensions: ["pcx"], + }, + "image/x-pict": { + source: "apache", + extensions: ["pic", "pct"], + }, + "image/x-portable-anymap": { + source: "apache", + extensions: ["pnm"], + }, + "image/x-portable-bitmap": { + source: "apache", + extensions: ["pbm"], + }, + "image/x-portable-graymap": { + source: "apache", + extensions: ["pgm"], + }, + "image/x-portable-pixmap": { + source: "apache", + extensions: ["ppm"], + }, + "image/x-rgb": { + source: "apache", + extensions: ["rgb"], + }, + "image/x-tga": { + source: "apache", + extensions: ["tga"], + }, + "image/x-xbitmap": { + source: "apache", + extensions: ["xbm"], + }, + "image/x-xcf": { + compressible: false, + }, + "image/x-xpixmap": { + source: "apache", + extensions: ["xpm"], + }, + "image/x-xwindowdump": { + source: "apache", + extensions: ["xwd"], + }, + "message/cpim": { + source: "iana", + }, + "message/delivery-status": { + source: "iana", + }, + "message/disposition-notification": { + source: "iana", + extensions: ["disposition-notification"], + }, + "message/external-body": { + source: "iana", + }, + "message/feedback-report": { + source: "iana", + }, + "message/global": { + source: "iana", + extensions: ["u8msg"], + }, + "message/global-delivery-status": { + source: "iana", + extensions: ["u8dsn"], + }, + "message/global-disposition-notification": { + source: "iana", + extensions: ["u8mdn"], + }, + "message/global-headers": { + source: "iana", + extensions: ["u8hdr"], + }, + "message/http": { + source: "iana", + compressible: false, + }, + "message/imdn+xml": { + source: "iana", + compressible: true, + }, + "message/news": { + source: "iana", + }, + "message/partial": { + source: "iana", + compressible: false, + }, + "message/rfc822": { + source: "iana", + compressible: true, + extensions: ["eml", "mime"], + }, + "message/s-http": { + source: "iana", + }, + "message/sip": { + source: "iana", + }, + "message/sipfrag": { + source: "iana", + }, + "message/tracking-status": { + source: "iana", + }, + "message/vnd.si.simp": { + source: "iana", + }, + "message/vnd.wfa.wsc": { + source: "iana", + extensions: ["wsc"], + }, + "model/3mf": { + source: "iana", + extensions: ["3mf"], + }, + "model/e57": { + source: "iana", + }, + "model/gltf+json": { + source: "iana", + compressible: true, + extensions: ["gltf"], + }, + "model/gltf-binary": { + source: "iana", + compressible: true, + extensions: ["glb"], + }, + "model/iges": { + source: "iana", + compressible: false, + extensions: ["igs", "iges"], + }, + "model/mesh": { + source: "iana", + compressible: false, + extensions: ["msh", "mesh", "silo"], + }, + "model/mtl": { + source: "iana", + extensions: ["mtl"], + }, + "model/obj": { + source: "iana", + extensions: ["obj"], + }, + "model/step": { + source: "iana", + }, + "model/step+xml": { + source: "iana", + compressible: true, + extensions: ["stpx"], + }, + "model/step+zip": { + source: "iana", + compressible: false, + extensions: ["stpz"], + }, + "model/step-xml+zip": { + source: "iana", + compressible: false, + extensions: ["stpxz"], + }, + "model/stl": { + source: "iana", + extensions: ["stl"], + }, + "model/vnd.collada+xml": { + source: "iana", + compressible: true, + extensions: ["dae"], + }, + "model/vnd.dwf": { + source: "iana", + extensions: ["dwf"], + }, + "model/vnd.flatland.3dml": { + source: "iana", + }, + "model/vnd.gdl": { + source: "iana", + extensions: ["gdl"], + }, + "model/vnd.gs-gdl": { + source: "apache", + }, + "model/vnd.gs.gdl": { + source: "iana", + }, + "model/vnd.gtw": { + source: "iana", + extensions: ["gtw"], + }, + "model/vnd.moml+xml": { + source: "iana", + compressible: true, + }, + "model/vnd.mts": { + source: "iana", + extensions: ["mts"], + }, + "model/vnd.opengex": { + source: "iana", + extensions: ["ogex"], + }, + "model/vnd.parasolid.transmit.binary": { + source: "iana", + extensions: ["x_b"], + }, + "model/vnd.parasolid.transmit.text": { + source: "iana", + extensions: ["x_t"], + }, + "model/vnd.pytha.pyox": { + source: "iana", + }, + "model/vnd.rosette.annotated-data-model": { + source: "iana", + }, + "model/vnd.sap.vds": { + source: "iana", + extensions: ["vds"], + }, + "model/vnd.usdz+zip": { + source: "iana", + compressible: false, + extensions: ["usdz"], + }, + "model/vnd.valve.source.compiled-map": { + source: "iana", + extensions: ["bsp"], + }, + "model/vnd.vtu": { + source: "iana", + extensions: ["vtu"], + }, + "model/vrml": { + source: "iana", + compressible: false, + extensions: ["wrl", "vrml"], + }, + "model/x3d+binary": { + source: "apache", + compressible: false, + extensions: ["x3db", "x3dbz"], + }, + "model/x3d+fastinfoset": { + source: "iana", + extensions: ["x3db"], + }, + "model/x3d+vrml": { + source: "apache", + compressible: false, + extensions: ["x3dv", "x3dvz"], + }, + "model/x3d+xml": { + source: "iana", + compressible: true, + extensions: ["x3d", "x3dz"], + }, + "model/x3d-vrml": { + source: "iana", + extensions: ["x3dv"], + }, + "multipart/alternative": { + source: "iana", + compressible: false, + }, + "multipart/appledouble": { + source: "iana", + }, + "multipart/byteranges": { + source: "iana", + }, + "multipart/digest": { + source: "iana", + }, + "multipart/encrypted": { + source: "iana", + compressible: false, + }, + "multipart/form-data": { + source: "iana", + compressible: false, + }, + "multipart/header-set": { + source: "iana", + }, + "multipart/mixed": { + source: "iana", + }, + "multipart/multilingual": { + source: "iana", + }, + "multipart/parallel": { + source: "iana", + }, + "multipart/related": { + source: "iana", + compressible: false, + }, + "multipart/report": { + source: "iana", + }, + "multipart/signed": { + source: "iana", + compressible: false, + }, + "multipart/vnd.bint.med-plus": { + source: "iana", + }, + "multipart/voice-message": { + source: "iana", + }, + "multipart/x-mixed-replace": { + source: "iana", + }, + "text/1d-interleaved-parityfec": { + source: "iana", + }, + "text/cache-manifest": { + source: "iana", + compressible: true, + extensions: ["appcache", "manifest"], + }, + "text/calendar": { + source: "iana", + extensions: ["ics", "ifb"], + }, + "text/calender": { + compressible: true, + }, + "text/cmd": { + compressible: true, + }, + "text/coffeescript": { + extensions: ["coffee", "litcoffee"], + }, + "text/cql": { + source: "iana", + }, + "text/cql-expression": { + source: "iana", + }, + "text/cql-identifier": { + source: "iana", + }, + "text/css": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["css"], + }, + "text/csv": { + source: "iana", + compressible: true, + extensions: ["csv"], + }, + "text/csv-schema": { + source: "iana", + }, + "text/directory": { + source: "iana", + }, + "text/dns": { + source: "iana", + }, + "text/ecmascript": { + source: "iana", + }, + "text/encaprtp": { + source: "iana", + }, + "text/enriched": { + source: "iana", + }, + "text/fhirpath": { + source: "iana", + }, + "text/flexfec": { + source: "iana", + }, + "text/fwdred": { + source: "iana", + }, + "text/gff3": { + source: "iana", + }, + "text/grammar-ref-list": { + source: "iana", + }, + "text/html": { + source: "iana", + compressible: true, + extensions: ["html", "htm", "shtml"], + }, + "text/jade": { + extensions: ["jade"], + }, + "text/javascript": { + source: "iana", + compressible: true, + }, + "text/jcr-cnd": { + source: "iana", + }, + "text/jsx": { + compressible: true, + extensions: ["jsx"], + }, + "text/less": { + compressible: true, + extensions: ["less"], + }, + "text/markdown": { + source: "iana", + compressible: true, + extensions: ["markdown", "md"], + }, + "text/mathml": { + source: "nginx", + extensions: ["mml"], + }, + "text/mdx": { + compressible: true, + extensions: ["mdx"], + }, + "text/mizar": { + source: "iana", + }, + "text/n3": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["n3"], + }, + "text/parameters": { + source: "iana", + charset: "UTF-8", + }, + "text/parityfec": { + source: "iana", + }, + "text/plain": { + source: "iana", + compressible: true, + extensions: ["txt", "text", "conf", "def", "list", "log", "in", "ini"], + }, + "text/provenance-notation": { + source: "iana", + charset: "UTF-8", + }, + "text/prs.fallenstein.rst": { + source: "iana", + }, + "text/prs.lines.tag": { + source: "iana", + extensions: ["dsc"], + }, + "text/prs.prop.logic": { + source: "iana", + }, + "text/raptorfec": { + source: "iana", + }, + "text/red": { + source: "iana", + }, + "text/rfc822-headers": { + source: "iana", + }, + "text/richtext": { + source: "iana", + compressible: true, + extensions: ["rtx"], + }, + "text/rtf": { + source: "iana", + compressible: true, + extensions: ["rtf"], + }, + "text/rtp-enc-aescm128": { + source: "iana", + }, + "text/rtploopback": { + source: "iana", + }, + "text/rtx": { + source: "iana", + }, + "text/sgml": { + source: "iana", + extensions: ["sgml", "sgm"], + }, + "text/shaclc": { + source: "iana", + }, + "text/shex": { + source: "iana", + extensions: ["shex"], + }, + "text/slim": { + extensions: ["slim", "slm"], + }, + "text/spdx": { + source: "iana", + extensions: ["spdx"], + }, + "text/strings": { + source: "iana", + }, + "text/stylus": { + extensions: ["stylus", "styl"], + }, + "text/t140": { + source: "iana", + }, + "text/tab-separated-values": { + source: "iana", + compressible: true, + extensions: ["tsv"], + }, + "text/troff": { + source: "iana", + extensions: ["t", "tr", "roff", "man", "me", "ms"], + }, + "text/turtle": { + source: "iana", + charset: "UTF-8", + extensions: ["ttl"], + }, + "text/ulpfec": { + source: "iana", + }, + "text/uri-list": { + source: "iana", + compressible: true, + extensions: ["uri", "uris", "urls"], + }, + "text/vcard": { + source: "iana", + compressible: true, + extensions: ["vcard"], + }, + "text/vnd.a": { + source: "iana", + }, + "text/vnd.abc": { + source: "iana", + }, + "text/vnd.ascii-art": { + source: "iana", + }, + "text/vnd.curl": { + source: "iana", + extensions: ["curl"], + }, + "text/vnd.curl.dcurl": { + source: "apache", + extensions: ["dcurl"], + }, + "text/vnd.curl.mcurl": { + source: "apache", + extensions: ["mcurl"], + }, + "text/vnd.curl.scurl": { + source: "apache", + extensions: ["scurl"], + }, + "text/vnd.debian.copyright": { + source: "iana", + charset: "UTF-8", + }, + "text/vnd.dmclientscript": { + source: "iana", + }, + "text/vnd.dvb.subtitle": { + source: "iana", + extensions: ["sub"], + }, + "text/vnd.esmertec.theme-descriptor": { + source: "iana", + charset: "UTF-8", + }, + "text/vnd.familysearch.gedcom": { + source: "iana", + extensions: ["ged"], + }, + "text/vnd.ficlab.flt": { + source: "iana", + }, + "text/vnd.fly": { + source: "iana", + extensions: ["fly"], + }, + "text/vnd.fmi.flexstor": { + source: "iana", + extensions: ["flx"], + }, + "text/vnd.gml": { + source: "iana", + }, + "text/vnd.graphviz": { + source: "iana", + extensions: ["gv"], + }, + "text/vnd.hans": { + source: "iana", + }, + "text/vnd.hgl": { + source: "iana", + }, + "text/vnd.in3d.3dml": { + source: "iana", + extensions: ["3dml"], + }, + "text/vnd.in3d.spot": { + source: "iana", + extensions: ["spot"], + }, + "text/vnd.iptc.newsml": { + source: "iana", + }, + "text/vnd.iptc.nitf": { + source: "iana", + }, + "text/vnd.latex-z": { + source: "iana", + }, + "text/vnd.motorola.reflex": { + source: "iana", + }, + "text/vnd.ms-mediapackage": { + source: "iana", + }, + "text/vnd.net2phone.commcenter.command": { + source: "iana", + }, + "text/vnd.radisys.msml-basic-layout": { + source: "iana", + }, + "text/vnd.senx.warpscript": { + source: "iana", + }, + "text/vnd.si.uricatalogue": { + source: "iana", + }, + "text/vnd.sosi": { + source: "iana", + }, + "text/vnd.sun.j2me.app-descriptor": { + source: "iana", + charset: "UTF-8", + extensions: ["jad"], + }, + "text/vnd.trolltech.linguist": { + source: "iana", + charset: "UTF-8", + }, + "text/vnd.wap.si": { + source: "iana", + }, + "text/vnd.wap.sl": { + source: "iana", + }, + "text/vnd.wap.wml": { + source: "iana", + extensions: ["wml"], + }, + "text/vnd.wap.wmlscript": { + source: "iana", + extensions: ["wmls"], + }, + "text/vtt": { + source: "iana", + charset: "UTF-8", + compressible: true, + extensions: ["vtt"], + }, + "text/x-asm": { + source: "apache", + extensions: ["s", "asm"], + }, + "text/x-c": { + source: "apache", + extensions: ["c", "cc", "cxx", "cpp", "h", "hh", "dic"], + }, + "text/x-component": { + source: "nginx", + extensions: ["htc"], + }, + "text/x-fortran": { + source: "apache", + extensions: ["f", "for", "f77", "f90"], + }, + "text/x-gwt-rpc": { + compressible: true, + }, + "text/x-handlebars-template": { + extensions: ["hbs"], + }, + "text/x-java-source": { + source: "apache", + extensions: ["java"], + }, + "text/x-jquery-tmpl": { + compressible: true, + }, + "text/x-lua": { + extensions: ["lua"], + }, + "text/x-markdown": { + compressible: true, + extensions: ["mkd"], + }, + "text/x-nfo": { + source: "apache", + extensions: ["nfo"], + }, + "text/x-opml": { + source: "apache", + extensions: ["opml"], + }, + "text/x-org": { + compressible: true, + extensions: ["org"], + }, + "text/x-pascal": { + source: "apache", + extensions: ["p", "pas"], + }, + "text/x-processing": { + compressible: true, + extensions: ["pde"], + }, + "text/x-sass": { + extensions: ["sass"], + }, + "text/x-scss": { + extensions: ["scss"], + }, + "text/x-setext": { + source: "apache", + extensions: ["etx"], + }, + "text/x-sfv": { + source: "apache", + extensions: ["sfv"], + }, + "text/x-suse-ymp": { + compressible: true, + extensions: ["ymp"], + }, + "text/x-uuencode": { + source: "apache", + extensions: ["uu"], + }, + "text/x-vcalendar": { + source: "apache", + extensions: ["vcs"], + }, + "text/x-vcard": { + source: "apache", + extensions: ["vcf"], + }, + "text/xml": { + source: "iana", + compressible: true, + extensions: ["xml"], + }, + "text/xml-external-parsed-entity": { + source: "iana", + }, + "text/yaml": { + compressible: true, + extensions: ["yaml", "yml"], + }, + "video/1d-interleaved-parityfec": { + source: "iana", + }, + "video/3gpp": { + source: "iana", + extensions: ["3gp", "3gpp"], + }, + "video/3gpp-tt": { + source: "iana", + }, + "video/3gpp2": { + source: "iana", + extensions: ["3g2"], + }, + "video/av1": { + source: "iana", + }, + "video/bmpeg": { + source: "iana", + }, + "video/bt656": { + source: "iana", + }, + "video/celb": { + source: "iana", + }, + "video/dv": { + source: "iana", + }, + "video/encaprtp": { + source: "iana", + }, + "video/ffv1": { + source: "iana", + }, + "video/flexfec": { + source: "iana", + }, + "video/h261": { + source: "iana", + extensions: ["h261"], + }, + "video/h263": { + source: "iana", + extensions: ["h263"], + }, + "video/h263-1998": { + source: "iana", + }, + "video/h263-2000": { + source: "iana", + }, + "video/h264": { + source: "iana", + extensions: ["h264"], + }, + "video/h264-rcdo": { + source: "iana", + }, + "video/h264-svc": { + source: "iana", + }, + "video/h265": { + source: "iana", + }, + "video/iso.segment": { + source: "iana", + extensions: ["m4s"], + }, + "video/jpeg": { + source: "iana", + extensions: ["jpgv"], + }, + "video/jpeg2000": { + source: "iana", + }, + "video/jpm": { + source: "apache", + extensions: ["jpm", "jpgm"], + }, + "video/jxsv": { + source: "iana", + }, + "video/mj2": { + source: "iana", + extensions: ["mj2", "mjp2"], + }, + "video/mp1s": { + source: "iana", + }, + "video/mp2p": { + source: "iana", + }, + "video/mp2t": { + source: "iana", + extensions: ["ts"], + }, + "video/mp4": { + source: "iana", + compressible: false, + extensions: ["mp4", "mp4v", "mpg4"], + }, + "video/mp4v-es": { + source: "iana", + }, + "video/mpeg": { + source: "iana", + compressible: false, + extensions: ["mpeg", "mpg", "mpe", "m1v", "m2v"], + }, + "video/mpeg4-generic": { + source: "iana", + }, + "video/mpv": { + source: "iana", + }, + "video/nv": { + source: "iana", + }, + "video/ogg": { + source: "iana", + compressible: false, + extensions: ["ogv"], + }, + "video/parityfec": { + source: "iana", + }, + "video/pointer": { + source: "iana", + }, + "video/quicktime": { + source: "iana", + compressible: false, + extensions: ["qt", "mov"], + }, + "video/raptorfec": { + source: "iana", + }, + "video/raw": { + source: "iana", + }, + "video/rtp-enc-aescm128": { + source: "iana", + }, + "video/rtploopback": { + source: "iana", + }, + "video/rtx": { + source: "iana", + }, + "video/scip": { + source: "iana", + }, + "video/smpte291": { + source: "iana", + }, + "video/smpte292m": { + source: "iana", + }, + "video/ulpfec": { + source: "iana", + }, + "video/vc1": { + source: "iana", + }, + "video/vc2": { + source: "iana", + }, + "video/vnd.cctv": { + source: "iana", + }, + "video/vnd.dece.hd": { + source: "iana", + extensions: ["uvh", "uvvh"], + }, + "video/vnd.dece.mobile": { + source: "iana", + extensions: ["uvm", "uvvm"], + }, + "video/vnd.dece.mp4": { + source: "iana", + }, + "video/vnd.dece.pd": { + source: "iana", + extensions: ["uvp", "uvvp"], + }, + "video/vnd.dece.sd": { + source: "iana", + extensions: ["uvs", "uvvs"], + }, + "video/vnd.dece.video": { + source: "iana", + extensions: ["uvv", "uvvv"], + }, + "video/vnd.directv.mpeg": { + source: "iana", + }, + "video/vnd.directv.mpeg-tts": { + source: "iana", + }, + "video/vnd.dlna.mpeg-tts": { + source: "iana", + }, + "video/vnd.dvb.file": { + source: "iana", + extensions: ["dvb"], + }, + "video/vnd.fvt": { + source: "iana", + extensions: ["fvt"], + }, + "video/vnd.hns.video": { + source: "iana", + }, + "video/vnd.iptvforum.1dparityfec-1010": { + source: "iana", + }, + "video/vnd.iptvforum.1dparityfec-2005": { + source: "iana", + }, + "video/vnd.iptvforum.2dparityfec-1010": { + source: "iana", + }, + "video/vnd.iptvforum.2dparityfec-2005": { + source: "iana", + }, + "video/vnd.iptvforum.ttsavc": { + source: "iana", + }, + "video/vnd.iptvforum.ttsmpeg2": { + source: "iana", + }, + "video/vnd.motorola.video": { + source: "iana", + }, + "video/vnd.motorola.videop": { + source: "iana", + }, + "video/vnd.mpegurl": { + source: "iana", + extensions: ["mxu", "m4u"], + }, + "video/vnd.ms-playready.media.pyv": { + source: "iana", + extensions: ["pyv"], + }, + "video/vnd.nokia.interleaved-multimedia": { + source: "iana", + }, + "video/vnd.nokia.mp4vr": { + source: "iana", + }, + "video/vnd.nokia.videovoip": { + source: "iana", + }, + "video/vnd.objectvideo": { + source: "iana", + }, + "video/vnd.radgamettools.bink": { + source: "iana", + }, + "video/vnd.radgamettools.smacker": { + source: "iana", + }, + "video/vnd.sealed.mpeg1": { + source: "iana", + }, + "video/vnd.sealed.mpeg4": { + source: "iana", + }, + "video/vnd.sealed.swf": { + source: "iana", + }, + "video/vnd.sealedmedia.softseal.mov": { + source: "iana", + }, + "video/vnd.uvvu.mp4": { + source: "iana", + extensions: ["uvu", "uvvu"], + }, + "video/vnd.vivo": { + source: "iana", + extensions: ["viv"], + }, + "video/vnd.youtube.yt": { + source: "iana", + }, + "video/vp8": { + source: "iana", + }, + "video/vp9": { + source: "iana", + }, + "video/webm": { + source: "apache", + compressible: false, + extensions: ["webm"], + }, + "video/x-f4v": { + source: "apache", + extensions: ["f4v"], + }, + "video/x-fli": { + source: "apache", + extensions: ["fli"], + }, + "video/x-flv": { + source: "apache", + compressible: false, + extensions: ["flv"], + }, + "video/x-m4v": { + source: "apache", + extensions: ["m4v"], + }, + "video/x-matroska": { + source: "apache", + compressible: false, + extensions: ["mkv", "mk3d", "mks"], + }, + "video/x-mng": { + source: "apache", + extensions: ["mng"], + }, + "video/x-ms-asf": { + source: "apache", + extensions: ["asf", "asx"], + }, + "video/x-ms-vob": { + source: "apache", + extensions: ["vob"], + }, + "video/x-ms-wm": { + source: "apache", + extensions: ["wm"], + }, + "video/x-ms-wmv": { + source: "apache", + compressible: false, + extensions: ["wmv"], + }, + "video/x-ms-wmx": { + source: "apache", + extensions: ["wmx"], + }, + "video/x-ms-wvx": { + source: "apache", + extensions: ["wvx"], + }, + "video/x-msvideo": { + source: "apache", + extensions: ["avi"], + }, + "video/x-sgi-movie": { + source: "apache", + extensions: ["movie"], + }, + "video/x-smv": { + source: "apache", + extensions: ["smv"], + }, + "x-conference/x-cooltalk": { + source: "apache", + extensions: ["ice"], + }, + "x-shader/x-fragment": { + compressible: true, + }, + "x-shader/x-vertex": { + compressible: true, + }, +} diff --git a/public/polyfills/path.js b/public/polyfills/path.js new file mode 100644 index 0000000..7de880e --- /dev/null +++ b/public/polyfills/path.js @@ -0,0 +1,519 @@ +// 'path' module extracted from Node.js v8.11.1 (only the posix part) +// transplited with Babel + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +"use strict" + +function assertPath(path) { + if (typeof path !== "string") { + throw new TypeError("Path must be a string. Received " + JSON.stringify(path)) + } +} + +// Resolves . and .. elements in a path with directory names +function normalizeStringPosix(path, allowAboveRoot) { + var res = "" + var lastSegmentLength = 0 + var lastSlash = -1 + var dots = 0 + var code + for (var i = 0; i <= path.length; ++i) { + if (i < path.length) code = path.charCodeAt(i) + else if (code === 47 /*/*/) break + else code = 47 /*/*/ + if (code === 47 /*/*/) { + if (lastSlash === i - 1 || dots === 1) { + // NOOP + } else if (lastSlash !== i - 1 && dots === 2) { + if ( + res.length < 2 || + lastSegmentLength !== 2 || + res.charCodeAt(res.length - 1) !== 46 /*.*/ || + res.charCodeAt(res.length - 2) !== 46 /*.*/ + ) { + if (res.length > 2) { + var lastSlashIndex = res.lastIndexOf("/") + if (lastSlashIndex !== res.length - 1) { + if (lastSlashIndex === -1) { + res = "" + lastSegmentLength = 0 + } else { + res = res.slice(0, lastSlashIndex) + lastSegmentLength = res.length - 1 - res.lastIndexOf("/") + } + lastSlash = i + dots = 0 + continue + } + } else if (res.length === 2 || res.length === 1) { + res = "" + lastSegmentLength = 0 + lastSlash = i + dots = 0 + continue + } + } + if (allowAboveRoot) { + if (res.length > 0) res += "/.." + else res = ".." + lastSegmentLength = 2 + } + } else { + if (res.length > 0) res += "/" + path.slice(lastSlash + 1, i) + else res = path.slice(lastSlash + 1, i) + lastSegmentLength = i - lastSlash - 1 + } + lastSlash = i + dots = 0 + } else if (code === 46 /*.*/ && dots !== -1) { + ++dots + } else { + dots = -1 + } + } + return res +} + +function _format(sep, pathObject) { + var dir = pathObject.dir || pathObject.root + var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "") + if (!dir) { + return base + } + if (dir === pathObject.root) { + return dir + base + } + return dir + sep + base +} + +var posix = { + // path.resolve([from ...], to) + resolve: function resolve() { + var resolvedPath = "" + var resolvedAbsolute = false + var cwd + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path + if (i >= 0) path = arguments[i] + else { + if (cwd === undefined) cwd = process.cwd() + path = cwd + } + + assertPath(path) + + // Skip empty entries + if (path.length === 0) { + continue + } + + resolvedPath = path + "/" + resolvedPath + resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/ + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute) + + if (resolvedAbsolute) { + if (resolvedPath.length > 0) return "/" + resolvedPath + else return "/" + } else if (resolvedPath.length > 0) { + return resolvedPath + } else { + return "." + } + }, + + normalize: function normalize(path) { + assertPath(path) + + if (path.length === 0) return "." + + var isAbsolute = path.charCodeAt(0) === 47 /*/*/ + var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/ + + // Normalize the path + path = normalizeStringPosix(path, !isAbsolute) + + if (path.length === 0 && !isAbsolute) path = "." + if (path.length > 0 && trailingSeparator) path += "/" + + if (isAbsolute) return "/" + path + return path + }, + + isAbsolute: function isAbsolute(path) { + assertPath(path) + return path.length > 0 && path.charCodeAt(0) === 47 /*/*/ + }, + + join: function join() { + if (arguments.length === 0) return "." + var joined + for (var i = 0; i < arguments.length; ++i) { + var arg = arguments[i] + assertPath(arg) + if (arg.length > 0) { + if (joined === undefined) joined = arg + else joined += "/" + arg + } + } + if (joined === undefined) return "." + return posix.normalize(joined) + }, + + relative: function relative(from, to) { + assertPath(from) + assertPath(to) + + if (from === to) return "" + + from = posix.resolve(from) + to = posix.resolve(to) + + if (from === to) return "" + + // Trim any leading backslashes + var fromStart = 1 + for (; fromStart < from.length; ++fromStart) { + if (from.charCodeAt(fromStart) !== 47 /*/*/) break + } + var fromEnd = from.length + var fromLen = fromEnd - fromStart + + // Trim any leading backslashes + var toStart = 1 + for (; toStart < to.length; ++toStart) { + if (to.charCodeAt(toStart) !== 47 /*/*/) break + } + var toEnd = to.length + var toLen = toEnd - toStart + + // Compare paths to find the longest common path from root + var length = fromLen < toLen ? fromLen : toLen + var lastCommonSep = -1 + var i = 0 + for (; i <= length; ++i) { + if (i === length) { + if (toLen > length) { + if (to.charCodeAt(toStart + i) === 47 /*/*/) { + // We get here if `from` is the exact base path for `to`. + // For example: from='/foo/bar'; to='/foo/bar/baz' + return to.slice(toStart + i + 1) + } else if (i === 0) { + // We get here if `from` is the root + // For example: from='/'; to='/foo' + return to.slice(toStart + i) + } + } else if (fromLen > length) { + if (from.charCodeAt(fromStart + i) === 47 /*/*/) { + // We get here if `to` is the exact base path for `from`. + // For example: from='/foo/bar/baz'; to='/foo/bar' + lastCommonSep = i + } else if (i === 0) { + // We get here if `to` is the root. + // For example: from='/foo'; to='/' + lastCommonSep = 0 + } + } + break + } + var fromCode = from.charCodeAt(fromStart + i) + var toCode = to.charCodeAt(toStart + i) + if (fromCode !== toCode) break + else if (fromCode === 47 /*/*/) lastCommonSep = i + } + + var out = "" + // Generate the relative path based on the path difference between `to` + // and `from` + for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { + if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) { + if (out.length === 0) out += ".." + else out += "/.." + } + } + + // Lastly, append the rest of the destination (`to`) path that comes after + // the common path parts + if (out.length > 0) return out + to.slice(toStart + lastCommonSep) + else { + toStart += lastCommonSep + if (to.charCodeAt(toStart) === 47 /*/*/) ++toStart + return to.slice(toStart) + } + }, + + _makeLong: function _makeLong(path) { + return path + }, + + dirname: function dirname(path) { + assertPath(path) + if (path.length === 0) return "." + var code = path.charCodeAt(0) + var hasRoot = code === 47 /*/*/ + var end = -1 + var matchedSlash = true + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i) + if (code === 47 /*/*/) { + if (!matchedSlash) { + end = i + break + } + } else { + // We saw the first non-path separator + matchedSlash = false + } + } + + if (end === -1) return hasRoot ? "/" : "." + if (hasRoot && end === 1) return "//" + return path.slice(0, end) + }, + + basename: function basename(path, ext) { + if (ext !== undefined && typeof ext !== "string") throw new TypeError('"ext" argument must be a string') + assertPath(path) + + var start = 0 + var end = -1 + var matchedSlash = true + var i + + if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { + if (ext.length === path.length && ext === path) return "" + var extIdx = ext.length - 1 + var firstNonSlashEnd = -1 + for (i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i) + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1 + break + } + } else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false + firstNonSlashEnd = i + 1 + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === ext.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i + } + } else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1 + end = firstNonSlashEnd + } + } + } + } + + if (start === end) end = firstNonSlashEnd + else if (end === -1) end = path.length + return path.slice(start, end) + } else { + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1 + break + } + } else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false + end = i + 1 + } + } + + if (end === -1) return "" + return path.slice(start, end) + } + }, + + extname: function extname(path) { + assertPath(path) + var startDot = -1 + var startPart = 0 + var end = -1 + var matchedSlash = true + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0 + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i) + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1 + break + } + continue + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false + end = i + 1 + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) startDot = i + else if (preDotState !== 1) preDotState = 1 + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1 + } + } + + if ( + startDot === -1 || + end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) + ) { + return "" + } + return path.slice(startDot, end) + }, + + format: function format(pathObject) { + if (pathObject === null || typeof pathObject !== "object") { + throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject) + } + return _format("/", pathObject) + }, + + parse: function parse(path) { + assertPath(path) + + var ret = { root: "", dir: "", base: "", ext: "", name: "" } + if (path.length === 0) return ret + var code = path.charCodeAt(0) + var isAbsolute = code === 47 /*/*/ + var start + if (isAbsolute) { + ret.root = "/" + start = 1 + } else { + start = 0 + } + var startDot = -1 + var startPart = 0 + var end = -1 + var matchedSlash = true + var i = path.length - 1 + + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0 + + // Get non-dir info + for (; i >= start; --i) { + code = path.charCodeAt(i) + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1 + break + } + continue + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false + end = i + 1 + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) startDot = i + else if (preDotState !== 1) preDotState = 1 + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1 + } + } + + if ( + startDot === -1 || + end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) + ) { + if (end !== -1) { + if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end) + else ret.base = ret.name = path.slice(startPart, end) + } + } else { + if (startPart === 0 && isAbsolute) { + ret.name = path.slice(1, startDot) + ret.base = path.slice(1, end) + } else { + ret.name = path.slice(startPart, startDot) + ret.base = path.slice(startPart, end) + } + ret.ext = path.slice(startDot, end) + } + + if (startPart > 0) ret.dir = path.slice(0, startPart - 1) + else if (isAbsolute) ret.dir = "/" + + return ret + }, + + sep: "/", + delimiter: ":", + win32: null, + posix: null, +} + +posix.posix = posix + +export default posix diff --git a/src/App.vue b/src/App.vue index 9a1d44e..7ad4a1c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -29,6 +29,16 @@ import AppLayout from "~/src/layouts/AppLayout.vue" // global style import "~/src/assets/style.css" import "~/src/assets/style.dark.css" +import { inject } from "vue" +import { InjectKeys } from "~/src/utils/inject-keys.ts" + +// Vue 实例 +// const vueInstance = inject(InjectKeys.VUE_INSTANCE) +// logger.info("vueInstance=>", vueInstance) + +// appInstance +const appInstance = inject(InjectKeys.APP_INSTANCE) +appInstance.logger.debug("appInstance=>", appInstance)