diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..ad6a450
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,130 @@
+---
+kind: pipeline
+type: docker
+name: build:dev
+clone:
+ disable: true
+
+steps:
+ - name: clone
+ image: alpine/git
+ commands:
+ - git clone $DRONE_REMOTE_URL .
+ - git checkout dev
+ - name: build dev
+ image: plugins/docker
+ depends_on: [clone]
+ settings:
+ username:
+ from_secret: DOCKER_REGISTRY_USER
+ password:
+ from_secret: DOCKER_REGISTRY_PASSWORD
+ repo: registry.odit.services/lfk/document-server
+ tags:
+ - dev
+ registry: registry.odit.services
+ - name: run changelog export
+ depends_on: ["clone"]
+ image: node:latest
+ commands:
+ - npx auto-changelog --commit-limit false -p -u --hide-credit
+ - name: push new changelog to repo
+ depends_on: ["run changelog export"]
+ image: appleboy/drone-git-push
+ settings:
+ branch: dev
+ commit: true
+ commit_message: 🧾New changelog file version [CI SKIP] [skip ci]
+ author_email: bot@odit.services
+ remote: git@git.odit.services:lfk/document-server.git
+ ssh_key:
+ from_secret: GITLAB_SSHKEY
+ - name: run full license export
+ depends_on: ["clone"]
+ image: node:14.15.1-alpine3.12
+ commands:
+ - yarn
+ - yarn licenses:export
+ - name: push new licenses file to repo
+ depends_on: ["run full license export"]
+ image: appleboy/drone-git-push
+ settings:
+ branch: dev
+ commit: true
+ commit_message: 📖New license file version [CI SKIP] [skip ci]
+ author_email: bot@odit.services
+ remote: git@git.odit.services:lfk/document-server.git
+ skip_verify: true
+ ssh_key:
+ from_secret: GITLAB_SSHKEY
+
+trigger:
+ branch:
+ - dev
+ event:
+ - push
+
+---
+kind: pipeline
+type: docker
+name: build:latest
+clone:
+ disable: true
+
+steps:
+ - name: clone
+ image: alpine/git
+ commands:
+ - git clone $DRONE_REMOTE_URL .
+ - git checkout dev
+ - git merge main
+ - git checkout main
+ - name: build latest
+ depends_on: ["clone"]
+ image: plugins/docker
+ settings:
+ username:
+ from_secret: DOCKER_REGISTRY_USER
+ password:
+ from_secret: DOCKER_REGISTRY_PASSWORD
+ repo: registry.odit.services/lfk/document-server
+ tags:
+ - latest
+ registry: registry.odit.services
+ - name: push merge to repo
+ depends_on: ["clone"]
+ image: appleboy/drone-git-push
+ settings:
+ branch: dev
+ commit: false
+ remote: git@git.odit.services:lfk/document-server.git
+ ssh_key:
+ from_secret: GITLAB_SSHKEY
+
+trigger:
+ branch:
+ - main
+ event:
+ - push
+
+---
+kind: pipeline
+type: docker
+name: build:tags
+
+steps:
+ - name: build $DRONE_TAG
+ image: plugins/docker
+ depends_on: [clone]
+ settings:
+ username:
+ from_secret: DOCKER_REGISTRY_USER
+ password:
+ from_secret: DOCKER_REGISTRY_PASSWORD
+ repo: registry.odit.services/lfk/document-server
+ tags:
+ - '${DRONE_TAG}'
+ registry: registry.odit.services
+trigger:
+ event:
+ - tag
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index a2ffac2..72aa169 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,3 +127,14 @@ dist
.yarn/install-state.gz
.pnp.*
+yarn.lock
+package-lock.json
+build
+
+*.sqlite
+*.sqlite-jurnal
+/docs
+lib
+/oss-attribution
+*.tmp
+*.pdf
\ No newline at end of file
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..ff8ad2b
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,8 @@
+{
+ "recommendations": [
+ "2gua.rainbow-brackets",
+ "christian-kohler.npm-intellisense",
+ "remimarsal.prettier-now"
+ ],
+ "unwantedRecommendations": []
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..fd68d0b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,20 @@
+{
+ "editor.formatOnSave": true,
+ "typescript.format.enable": true,
+ "typescript.preferences.quoteStyle": "single",
+ "[json]": {
+ "editor.defaultFormatter": "vscode.json-language-features"
+ },
+ "prettier.enable": false,
+ "[typescript]": {
+ "editor.defaultFormatter": "vscode.typescript-language-features",
+ "editor.codeActionsOnSave": {
+ "source.organizeImports": true,
+ // "source.fixAll": true
+ }
+ },
+ "javascript.preferences.quoteStyle": "single",
+ "javascript.preferences.importModuleSpecifierEnding": "minimal",
+ "typescript.preferences.importModuleSpecifierEnding": "minimal",
+ "typescript.preferences.includePackageJsonAutoImports": "on"
+}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..8e68844
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+### Changelog
+
+All notable changes to this project will be documented in this file. Dates are displayed in UTC.
+
+#### 0.0.2
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..6d2946c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,16 @@
+# Typescript Build
+FROM node:14.15.1-alpine3.12
+WORKDIR /app
+COPY package.json ./
+RUN npm i -g pnpm
+RUN pnpm i
+COPY tsconfig.json ./
+COPY src ./src
+RUN pnpm run build
+# final image
+FROM node:14.15.1-alpine3.12
+COPY package.json ./
+RUN npm i -g pnpm
+RUN pnpm i --prod
+COPY --from=0 /app/dist dist
+ENTRYPOINT ["node", "dist/app.js"]
\ No newline at end of file
diff --git a/README.md b/README.md
index 3e2c277..57fc0ee 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,76 @@
-# document-server
+# @lfk/document-server
-The document generation server responsible for creating pdfs for sponsoring contracts, certificates and more.
\ No newline at end of file
+The document generation server responsible for creating pdfs for sponsoring contracts, certificates and more.
+This server doesn't interact with any database and can therefor be deployed on it's own.
+The basic generation mechanism makes the templates and routes interchangeable (if you want to expand or modify it).
+
+## Quickstart 🐳
+> Use this to run the document server in docker.
+
+1. Clone the repo or copy the docker-compose
+2. Run in the folder that contains the docker-compose file: `docker-compose up -d`
+3. Visit http://127.0.0.1:4010/docs to check if the server is running
+
+## Dev Setup 🛠
+> Local dev setup
+
+1. Rename the .env.example file to .env (you can adjust app port and other settings, if needed)
+2. Install Dependencies
+ ```bash
+ yarn
+ ```
+3. Start the server
+ ```bash
+ yarn dev
+ ```
+
+## ENV Vars
+> You can provide them via .env file or docker env vars.
+
+| Name | Type | Default | Description
+| - | - | - | -
+| APP_PORT | Number | 4010 | The port the backend server listens on. Is optional.
+| NODE_ENV | String | dev | The apps env - influences debug info.
+
+## Templates
+> The document server uses html templates to generate various pdf documents.
+> The templates are stored in src/templates by default.
+
+We provide a set of default templates that we use for the ["Lauf für Kaya!" charity run](https://lauf-fuer-kaya.de).
+We use mustache-style templating strings to fill the templates with real information (exact strings are explained below).
+You can provide your own templates by replacing the ones we provided before compiling the project or by simply mounting your custom templates into the docker container.
+
+The server currently needs the following templates to work:
+* sponsoring_contract.html
+
+### Sponsoring Contracts
+
+| Template String | Type | Optional | Description
+| - | - | - | -
+| runner_firstname | string | ❌ | The runner's first name
+| runner_middlename | string | ✅ | The runner's middle name
+| runner_lastname | string | ❌ | The runner's last name
+| runner_id | int | ❌ | The runner's id
+
+## Recommended Editor
+
+[Visual Studio Code](https://code.visualstudio.com/)
+
+### Recommended Extensions
+
+* will be automatically recommended via ./vscode/extensions.json
+
+## Staging
+### Branches & Tags
+* vX.Y.Z: Release tags created from the main branch
+ * The version numbers follow the semver standard
+ * A new release tag automaticly triggers the release ci pipeline
+* main: Protected "release" branch
+ * The latest tag of the docker image get's build from this
+ * New releases get created as tags from this
+* dev: Current dev branch for merging the different feature branches and bugfixes
+ * The dev tag of the docker image get's build from this
+ * Only push minor changes to this branch!
+ * To merge a feature branch into this please create a pull request
+* feature/xyz: Feature branches - nameing scheme: `feature/issueid-title`
+* bugfix/xyz: Branches for bugfixes - nameing scheme:`bugfix/issueid-title`
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..cb5d403
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,9 @@
+version: "3"
+services:
+ document_server:
+ build: .
+ ports:
+ - 4010:4010
+ environment:
+ APP_PORT: 4010
+ NODE_ENV: production
\ No newline at end of file
diff --git a/licenses.md b/licenses.md
new file mode 100644
index 0000000..e8ca9ce
--- /dev/null
+++ b/licenses.md
@@ -0,0 +1,573 @@
+# @odit/class-validator-jsonschema
+**Author**: Aleksi Pekkala
+**Repo**: git@github.com:epiphone/class-validator-jsonschema.git
+**License**: MIT
+**Description**: Convert class-validator-decorated classes into JSON schema
+## License Text
+MIT License
+
+Copyright (c) 2017 Aleksi Pekkala
+
+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.
+
+
+# class-transformer
+**Author**: [object Object]
+**Repo**: [object Object]
+**License**: MIT
+**Description**: Proper decorator-based transformation / serialization / deserialization of plain javascript objects to class constructors
+## License Text
+The MIT License
+
+Copyright (c) 2015-2020 Umed Khudoiberdiev
+
+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.
+
+# class-validator
+**Author**: TypeStack contributors
+**Repo**: [object Object]
+**License**: MIT
+**Description**: Decorator-based property validation for classes.
+## License Text
+
+The MIT License
+
+Copyright (c) 2015-2020 TypeStack
+
+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.
+
+# consola
+**Author**: undefined
+**Repo**: nuxt/consola
+**License**: MIT
+**Description**: Elegant Console Logger for Node.js and Browser
+## License Text
+
+
+# cors
+**Author**: Troy Goode (https://github.com/troygoode/)
+**Repo**: expressjs/cors
+**License**: MIT
+**Description**: Node.js CORS middleware
+## License Text
+(The MIT License)
+
+Copyright (c) 2013 Troy Goode
+
+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.
+
+
+# dotenv
+**Author**: undefined
+**Repo**: [object Object]
+**License**: BSD-2-Clause
+**Description**: Loads environment variables from .env file
+## License Text
+Copyright (c) 2015, Scott Motte
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# express
+**Author**: TJ Holowaychuk
+**Repo**: expressjs/express
+**License**: MIT
+**Description**: Fast, unopinionated, minimalist web framework
+## License Text
+(The MIT License)
+
+Copyright (c) 2009-2014 TJ Holowaychuk
+Copyright (c) 2013-2014 Roman Shtylman
+Copyright (c) 2014-2015 Douglas Christopher Wilson
+
+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.
+
+
+# html-pdf
+**Author**: Marc Bachmann
+**Repo**: [object Object]
+**License**: MIT
+**Description**: HTML to PDF converter that uses phantomjs
+## License Text
+The MIT License
+
+Copyright (c) 2016 Contributors https://github.com/marcbachmann/node-html-pdf/graphs/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.
+
+
+# reflect-metadata
+**Author**: [object Object]
+**Repo**: [object Object]
+**License**: Apache-2.0
+**Description**: Polyfill for Metadata Reflection API
+## License Text
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+# routing-controllers
+**Author**: [object Object]
+**Repo**: [object Object]
+**License**: MIT
+**Description**: Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
+## License Text
+
+
+# routing-controllers-openapi
+**Author**: Aleksi Pekkala
+**Repo**: git@github.com:epiphone/routing-controllers-openapi
+**License**: MIT
+**Description**: Runtime OpenAPI v3 spec generation for routing-controllers
+## License Text
+MIT License
+
+Copyright (c) 2017 Aleksi Pekkala
+
+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.
+
+
+# @odit/license-exporter
+**Author**: ODIT.Services
+**Repo**: [object Object]
+**License**: MIT
+**Description**: A simple license crawler for crediting open source work
+## License Text
+MIT License Copyright (c) 2020 ODIT.Services (info@odit.services)
+
+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 (including the next
+paragraph) 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.
+
+
+# @types/express
+**Author**: undefined
+**Repo**: [object Object]
+**License**: MIT
+**Description**: TypeScript definitions for Express
+## License Text
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ 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
+
+
+# @types/node
+**Author**: undefined
+**Repo**: [object Object]
+**License**: MIT
+**Description**: TypeScript definitions for Node.js
+## License Text
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ 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
+
+
+# nodemon
+**Author**: [object Object]
+**Repo**: [object Object]
+**License**: MIT
+**Description**: Simple monitor script for use during development of a node.js app.
+## License Text
+MIT License
+
+Copyright (c) 2010 - present, Remy Sharp, https://remysharp.com
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do 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.
+
+
+# release-it
+**Author**: [object Object]
+**Repo**: [object Object]
+**License**: MIT
+**Description**: Generic CLI tool to automate versioning and package publishing related tasks.
+## License Text
+MIT License
+
+Copyright (c) 2018 Lars Kappert
+
+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.
+
+
+# rimraf
+**Author**: Isaac Z. Schlueter (http://blog.izs.me/)
+**Repo**: git://github.com/isaacs/rimraf.git
+**License**: ISC
+**Description**: A deep deletion module for node (like `rm -rf`)
+## License Text
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+# ts-node
+**Author**: [object Object]
+**Repo**: [object Object]
+**License**: MIT
+**Description**: TypeScript execution environment and REPL for node.js, with source map support
+## License Text
+The MIT License (MIT)
+
+Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do 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.
+
+
+# typescript
+**Author**: Microsoft Corp.
+**Repo**: [object Object]
+**License**: Apache-2.0
+**Description**: TypeScript is a language for application scale JavaScript development
+## License Text
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..ba89b3e
--- /dev/null
+++ b/package.json
@@ -0,0 +1,76 @@
+{
+ "name": "@odit/lfk-document-server",
+ "version": "0.0.2",
+ "description": "The document generation server for the LfK! runner system. This generates certificates, sponsoring aggreements and more",
+ "main": "src/app.ts",
+ "scripts": {
+ "dev": "nodemon src/app.ts",
+ "build": "rimraf ./dist && tsc",
+ "licenses:export": "license-exporter --markdown",
+ "release": "release-it --only-version"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@git.odit.services:lfk/document-server.git"
+ },
+ "keywords": [
+ "odit",
+ "lfk",
+ "pdf",
+ "generate"
+ ],
+ "author": {
+ "name": "ODIT.Services",
+ "email": "info@odit.services",
+ "url": "https://odit.services"
+ },
+ "contributors": [
+ {
+ "name": "Philipp Dormann",
+ "email": "philipp@philippdormann.de",
+ "url": "https://philippdormann.de"
+ },
+ {
+ "name": "Nicolai Ort",
+ "email": "info@nicolai-ort.com",
+ "url": "https://nicolai-ort.com"
+ }
+ ],
+ "license": "CC-BY-NC-SA-4.0",
+ "dependencies": {
+ "@odit/class-validator-jsonschema": "^2.1.1",
+ "class-transformer": "0.3.1",
+ "class-validator": "^0.13.1",
+ "consola": "^2.15.0",
+ "cors": "^2.8.5",
+ "dotenv": "^8.2.0",
+ "express": "^4.17.1",
+ "html-pdf": "^2.2.0",
+ "reflect-metadata": "^0.1.13",
+ "routing-controllers": "^0.9.0-alpha.6",
+ "routing-controllers-openapi": "^2.2.0"
+ },
+ "devDependencies": {
+ "@odit/license-exporter": "^0.0.9",
+ "@types/express": "^4.17.11",
+ "@types/node": "^14.14.22",
+ "nodemon": "^2.0.7",
+ "release-it": "^14.2.2",
+ "rimraf": "^3.0.2",
+ "ts-node": "^9.1.1",
+ "typescript": "^4.1.3"
+ },
+ "release-it": {
+ "git": {
+ "commit": true,
+ "requireCleanWorkingDir": false,
+ "commitMessage": "🚀Bumped version to v${version}",
+ "requireBranch": "dev",
+ "push": false,
+ "tag": false
+ },
+ "npm": {
+ "publish": false
+ }
+ }
+}
diff --git a/src/PdfCreator.ts b/src/PdfCreator.ts
new file mode 100644
index 0000000..2345c8c
--- /dev/null
+++ b/src/PdfCreator.ts
@@ -0,0 +1,56 @@
+import fs from "fs";
+import pdf_converter from "html-pdf";
+import path from 'path';
+import { Stream } from 'stream';
+
+/**
+ * This class is responsible for all things pdf creation.
+ * This uses the html templates from src/templates.
+ */
+export class PdfCreator {
+ private templateDir = path.join(__dirname, '/templates');
+
+ //TODO: Accept the runner class
+ public async generateSponsoringContract(): Promise {
+ let template = fs.readFileSync(`${this.templateDir}/sponsoring_contract.html`, 'utf8');
+ template = template.replace("{{Runner Name}}", "lelele");
+ return new Pdf(await pdf_converter.create(template, { format: "A5", orientation: "landscape" }));
+ }
+
+}
+
+/**
+ * This class is a wrapper for the pdf objects created by html-pdf.
+ * It offers typed conversion to Buffer and Stream.
+ */
+export class Pdf {
+ content: any;
+
+ constructor(pdf: any) {
+ this.content = pdf;
+ }
+
+ /**
+ * Promise wrapper function that resolves the toBuffer promise for pdf generation.
+ */
+ public async toBuffer(): Promise {
+ let promise = await new Promise((resolve, reject) => {
+ this.content.toBuffer(function (err, buffer: Buffer) {
+ resolve(buffer);
+ });
+ });
+ return await promise;
+ }
+
+ /**
+ * Promise wrapper function that resolves the toStream promise for pdf generation.
+ */
+ public async toStream(): Promise {
+ let promise = await new Promise((resolve, reject) => {
+ this.content.toStream(function (err, stream: Stream) {
+ resolve(stream);
+ });
+ });
+ return await promise;
+ }
+}
\ No newline at end of file
diff --git a/src/apispec.ts b/src/apispec.ts
new file mode 100644
index 0000000..4a1f496
--- /dev/null
+++ b/src/apispec.ts
@@ -0,0 +1,25 @@
+import { MetadataArgsStorage } from 'routing-controllers';
+import { routingControllersToSpec } from 'routing-controllers-openapi';
+import { config } from './config';
+
+/**
+ * This function generates a the openapi spec from route metadata and type schemas.
+ * @param storage MetadataArgsStorage object generated by routing-controllers.
+ * @param schemas MetadataArgsStorage object generated by class-validator-jsonschema.
+ */
+export function generateSpec(storage: MetadataArgsStorage, schemas) {
+ return routingControllersToSpec(
+ storage,
+ {},
+ {
+ components: {
+ schemas,
+ },
+ info: {
+ description: "The the API for the LfK! document server.",
+ title: "LfK! document server API",
+ version: config.version
+ },
+ }
+ );
+}
\ No newline at end of file
diff --git a/src/app.ts b/src/app.ts
new file mode 100644
index 0000000..6996e09
--- /dev/null
+++ b/src/app.ts
@@ -0,0 +1,29 @@
+import consola from "consola";
+import "reflect-metadata";
+import { createExpressServer } from "routing-controllers";
+import { config, e as errors } from './config';
+import loaders from "./loaders/index";
+import { ErrorHandler } from './middlewares/ErrorHandler';
+
+const CONTROLLERS_FILE_EXTENSION = process.env.NODE_ENV === 'production' ? 'js' : 'ts';
+const app = createExpressServer({
+ middlewares: [ErrorHandler],
+ development: config.development,
+ cors: true,
+ controllers: [`${__dirname}/controllers/*.${CONTROLLERS_FILE_EXTENSION}`],
+});
+
+async function main() {
+ await loaders(app);
+ app.listen(config.internal_port, () => {
+ consola.success(
+ `⚡️[server]: Server is running at http://localhost:${config.internal_port}`
+ );
+ });
+}
+if (errors === 0) {
+ main();
+} else {
+ consola.error("error");
+ // something's wrong
+}
diff --git a/src/config.ts b/src/config.ts
new file mode 100644
index 0000000..3b95934
--- /dev/null
+++ b/src/config.ts
@@ -0,0 +1,16 @@
+import { config as configDotenv } from 'dotenv';
+
+configDotenv();
+export const config = {
+ internal_port: parseInt(process.env.APP_PORT) || 4010,
+ development: process.env.NODE_ENV === "production",
+ version: process.env.VERSION || require('../package.json').version
+}
+let errors = 0
+if (typeof config.internal_port !== "number") {
+ errors++
+}
+if (typeof config.development !== "boolean") {
+ errors++
+}
+export let e = errors
\ No newline at end of file
diff --git a/src/controllers/PdfController.ts b/src/controllers/PdfController.ts
new file mode 100644
index 0000000..0ec9581
--- /dev/null
+++ b/src/controllers/PdfController.ts
@@ -0,0 +1,20 @@
+import { ContentType, Controller, Get } from 'routing-controllers';
+import { OpenAPI } from 'routing-controllers-openapi';
+import { PdfCreator } from '../PdfCreator';
+
+@Controller()
+export class PdfController {
+ private pdf: PdfCreator;
+ constructor() {
+ this.pdf = new PdfCreator();
+ }
+
+ @Get('/contracts')
+ @ContentType("application/pdf")
+ @OpenAPI({ description: "Generate Sponsoring contract pdfs from runner objects." })
+ async generateContracts() {
+ //TODO: Accept the real classes
+ const contracts = await this.pdf.generateSponsoringContract();
+ return await contracts.toBuffer();
+ }
+}
\ No newline at end of file
diff --git a/src/controllers/StatusController.ts b/src/controllers/StatusController.ts
new file mode 100644
index 0000000..f27c1f9
--- /dev/null
+++ b/src/controllers/StatusController.ts
@@ -0,0 +1,14 @@
+import { Get, JsonController } from 'routing-controllers';
+import { OpenAPI } from 'routing-controllers-openapi';
+import { config } from '../config';
+
+@JsonController()
+export class StatusController {
+ @Get('/version')
+ @OpenAPI({ description: "A very basic endpoint that just returns the curent package version." })
+ getVersion() {
+ return {
+ "version": config.version
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/errors/AddressErrors.ts b/src/errors/AddressErrors.ts
new file mode 100644
index 0000000..300bb31
--- /dev/null
+++ b/src/errors/AddressErrors.ts
@@ -0,0 +1,57 @@
+import { IsString } from 'class-validator';
+import { BadRequestError } from 'routing-controllers';
+
+/**
+ * Error to throw when an address's postal code fails validation.
+ */
+export class AddressPostalCodeInvalidError extends BadRequestError {
+ @IsString()
+ name = "AddressPostalCodeInvalidError"
+
+ @IsString()
+ message = "The postal code you provided is invalid. \n Please check if your postal code follows the postal code validation guidelines."
+}
+
+/**
+ * Error to throw when an non-empty address's first line isn't set.
+ */
+export class AddressFirstLineEmptyError extends BadRequestError {
+ @IsString()
+ name = "AddressFirstLineEmptyError"
+
+ @IsString()
+ message = "You provided a empty first address line. \n If you want an empty address please set all propertys to null. \n For non-empty addresses the following fields have to be set: address1, postalcode, city, country"
+}
+
+/**
+ * Error to throw when an non-empty address's postal code isn't set.
+ */
+export class AddressPostalCodeEmptyError extends BadRequestError {
+ @IsString()
+ name = "AddressPostalCodeEmptyError"
+
+ @IsString()
+ message = "You provided a empty postal code. \n If you want an empty address please set all propertys to null. \n For non-empty addresses the following fields have to be set: address1, postalcode, city, country"
+}
+
+/**
+ * Error to throw when an non-empty address's city isn't set.
+ */
+export class AddressCityEmptyError extends BadRequestError {
+ @IsString()
+ name = "AddressCityEmptyError"
+
+ @IsString()
+ message = "You provided a empty city. \n If you want an empty address please set all propertys to null. \n For non-empty addresses the following fields have to be set: address1, postalcode, city, country"
+}
+
+/**
+ * Error to throw when an non-empty address's country isn't set.
+ */
+export class AddressCountryEmptyError extends BadRequestError {
+ @IsString()
+ name = "AddressCountryEmptyError"
+
+ @IsString()
+ message = "You provided a empty country. \n If you want an empty address please set all propertys to null. \n For non-empty addresses the following fields have to be set: address1, postalcode, city, country"
+}
\ No newline at end of file
diff --git a/src/loaders/express.ts b/src/loaders/express.ts
new file mode 100644
index 0000000..985e931
--- /dev/null
+++ b/src/loaders/express.ts
@@ -0,0 +1,11 @@
+import { Application } from "express";
+/**
+ * Loader for express related configurations.
+ * Configures proxy trusts, globally used middlewares and other express features.
+ */
+export default async (app: Application) => {
+ app.enable('trust proxy');
+ app.disable('x-powered-by');
+ app.disable('x-served-by');
+ return app;
+};
diff --git a/src/loaders/index.ts b/src/loaders/index.ts
new file mode 100644
index 0000000..3e30a21
--- /dev/null
+++ b/src/loaders/index.ts
@@ -0,0 +1,13 @@
+import { Application } from "express";
+import expressLoader from "./express";
+import openapiLoader from "./openapi";
+
+/**
+ * Index Loader that executes the other loaders in the right order.
+ * This basicly exists for abstraction and a overall better dev experience.
+ */
+export default async (app: Application) => {
+ await openapiLoader(app);
+ await expressLoader(app);
+ return app;
+};
diff --git a/src/loaders/openapi.ts b/src/loaders/openapi.ts
new file mode 100644
index 0000000..b12871b
--- /dev/null
+++ b/src/loaders/openapi.ts
@@ -0,0 +1,24 @@
+import { validationMetadatasToSchemas } from "@odit/class-validator-jsonschema";
+import express, { Application } from "express";
+import path from 'path';
+import { getMetadataArgsStorage } from "routing-controllers";
+import { generateSpec } from '../apispec';
+
+/**
+ * Loader for everything openapi related - from creating the schema to serving it via a static route and swaggerUiExpress.
+ * All auth schema related stuff also has to be configured here
+ */
+export default async (app: Application) => {
+ const storage = getMetadataArgsStorage();
+ const schemas = validationMetadatasToSchemas({
+ refPointerPrefix: "#/components/schemas/",
+ });
+
+ //Spec creation based on the previously created schemas
+ const spec = generateSpec(storage, schemas);
+ app.get(["/docs/openapi.json", "/docs/swagger.json"], (req, res) => {
+ res.json(spec);
+ });
+ app.use('/docs', express.static(path.join(__dirname, '../static/docs'), { index: "index.html", extensions: ['html'] }));
+ return app;
+};
diff --git a/src/middlewares/ErrorHandler.ts b/src/middlewares/ErrorHandler.ts
new file mode 100644
index 0000000..71ef2db
--- /dev/null
+++ b/src/middlewares/ErrorHandler.ts
@@ -0,0 +1,14 @@
+import { ExpressErrorMiddlewareInterface, Middleware } from "routing-controllers";
+
+/**
+ * Our Error handling middlware that returns our custom httperrors to the user.
+ */
+@Middleware({ type: "after" })
+export class ErrorHandler implements ExpressErrorMiddlewareInterface {
+ public error(error: any, request: any, response: any, next: (err: any) => any) {
+ if (response.headersSent) {
+ return;
+ }
+ response.json(error);
+ }
+}
diff --git a/src/models/Address.ts b/src/models/Address.ts
new file mode 100644
index 0000000..aaaf8b3
--- /dev/null
+++ b/src/models/Address.ts
@@ -0,0 +1,50 @@
+import {
+ IsString
+} from "class-validator";
+
+/**
+ * Defines the Address class.
+ * Implemented this way to prevent any formatting differences.
+*/
+export class Address {
+ /**
+ * The address's first line.
+ * Containing the street and house number.
+ */
+ @IsString()
+ address1?: string;
+
+ /**
+ * The address's second line.
+ * Containing optional information.
+ */
+ @IsString()
+ address2?: string;
+
+ /**
+ * The address's postal code.
+ * This will get checked against the postal code syntax for the configured country.
+ */
+ @IsString()
+ postalcode: string;
+
+ /**
+ * The address's city.
+ */
+ @IsString()
+ city: string;
+
+ /**
+ * The address's country.
+ */
+ @IsString()
+ country: string;
+
+ public reset() {
+ this.address1 = null;
+ this.address2 = null;
+ this.city = null;
+ this.country = null;
+ this.postalcode = null;
+ }
+}
diff --git a/src/models/CertificateRunner.ts b/src/models/CertificateRunner.ts
new file mode 100644
index 0000000..a30b356
--- /dev/null
+++ b/src/models/CertificateRunner.ts
@@ -0,0 +1,16 @@
+import {
+ IsArray
+} from "class-validator";
+import { DistanceDonation } from './DistanceDonation';
+import { Runner } from './Runner';
+
+/**
+ * Defines the certificate runner class (from which the runner certificates get generated).
+*/
+export class CertificateRunner extends Runner {
+ /**
+ * Array containing all distance donations associated with the runner.
+ */
+ @IsArray()
+ distanceDonations: DistanceDonation[];
+}
diff --git a/src/models/DistanceDonation.ts b/src/models/DistanceDonation.ts
new file mode 100644
index 0000000..a4e35e1
--- /dev/null
+++ b/src/models/DistanceDonation.ts
@@ -0,0 +1,40 @@
+import { IsInt, IsNotEmpty, IsObject, IsPositive } from "class-validator";
+import { Donation } from "./Donation";
+import { Runner } from "./Runner";
+
+/**
+ * Defines the DistanceDonation class.
+ * For distanceDonations a donor pledges to donate a certain amount for each kilometer ran by a runner.
+*/
+export class DistanceDonation extends Donation {
+ /**
+ * The donation's associated runner.
+ * Used as the source of the donation's distance.
+ */
+ @IsObject()
+ @IsNotEmpty()
+ runner: Runner;
+
+ /**
+ * The donation's amount donated per distance.
+ * The amount the donor set to be donated per kilometer that the runner ran.
+ */
+ @IsInt()
+ @IsPositive()
+ amountPerDistance: number;
+
+ /**
+ * The donation's amount in cents (or whatever your currency's smallest unit is.).
+ * Get's calculated from the runner's distance ran and the amount donated per kilometer.
+ */
+ public get amount(): number {
+ let calculatedAmount = 0;
+ try {
+ calculatedAmount = this.amountPerDistance * (this.runner.distance / 1000);
+ } catch (error) {
+ throw error;
+ }
+ return calculatedAmount;
+ }
+
+}
diff --git a/src/models/Donation.ts b/src/models/Donation.ts
new file mode 100644
index 0000000..1beaf0c
--- /dev/null
+++ b/src/models/Donation.ts
@@ -0,0 +1,32 @@
+import {
+ IsInt,
+ IsNotEmpty,
+ IsObject
+} from "class-validator";
+import { Donor } from './Donor';
+
+/**
+ * Defines the Donation base calss.
+ * A donation just associates a donor with a donation amount.
+ * The specifics of the amoun's determination has to be implemented in child classes.
+*/
+export abstract class Donation {
+ /**
+ * Autogenerated unique id (primary key).
+ */
+ @IsInt()
+ id: number;
+
+ /**
+ * The donations's donor.
+ */
+ @IsNotEmpty()
+ @IsObject()
+ donor: Donor;
+
+ /**
+ * The donation's amount in cents (or whatever your currency's smallest unit is.).
+ * The exact implementation may differ for each type of donation.
+ */
+ public abstract get amount(): number;
+}
\ No newline at end of file
diff --git a/src/models/Donor.ts b/src/models/Donor.ts
new file mode 100644
index 0000000..cb9d9df
--- /dev/null
+++ b/src/models/Donor.ts
@@ -0,0 +1,37 @@
+import {
+
+ IsInt,
+
+
+
+ IsString
+} from "class-validator";
+
+/**
+ * Defines the Donor class.
+*/
+export class Donor {
+ /**
+ * The donor's id.
+ */
+ @IsInt()
+ id: number;
+
+ /**
+ * The donor's first name.
+ */
+ @IsString()
+ firstname: string;
+
+ /**
+ * The donor's middle name.
+ */
+ @IsString()
+ middlename?: string;
+
+ /**
+ * The donor's last name.
+ */
+ @IsString()
+ lastname: string;
+}
diff --git a/src/models/FixedDonation.ts b/src/models/FixedDonation.ts
new file mode 100644
index 0000000..18c8a23
--- /dev/null
+++ b/src/models/FixedDonation.ts
@@ -0,0 +1,16 @@
+import { IsInt, IsPositive } from "class-validator";
+import { Donation } from "./Donation";
+
+/**
+ * Defines the FixedDonation entity.
+ * In the past there was no easy way to track fixed donations (eg. for creating donation receipts).
+*/
+export class FixedDonation extends Donation {
+
+ /**
+ * The donation's amount in cents (or whatever your currency's smallest unit is.).
+ */
+ @IsInt()
+ @IsPositive()
+ amount: number;
+}
\ No newline at end of file
diff --git a/src/models/Runner.ts b/src/models/Runner.ts
new file mode 100644
index 0000000..f7968a8
--- /dev/null
+++ b/src/models/Runner.ts
@@ -0,0 +1,47 @@
+import {
+ IsInt,
+ IsObject,
+ IsString
+} from "class-validator";
+import { RunnerGroup } from './RunnerGroup';
+
+/**
+ * Defines the runner class (from which the runner sponsoring contracts get generated).
+*/
+export class Runner {
+ /**
+ * The runner's id.
+ */
+ @IsInt()
+ id: number;
+
+ /**
+ * The runner's first name.
+ */
+ @IsString()
+ firstname: string;
+
+ /**
+ * The runner's middle name.
+ */
+ @IsString()
+ middlename?: string;
+
+ /**
+ * The runner's last name.
+ */
+ @IsString()
+ lastname: string;
+
+ /**
+ * The runner's group.
+ */
+ @IsObject()
+ group: RunnerGroup;
+
+ /**
+ * The total distance ran by the runner.
+ */
+ @IsInt()
+ distance: number;
+}
diff --git a/src/models/RunnerCard.ts b/src/models/RunnerCard.ts
new file mode 100644
index 0000000..3a4cffb
--- /dev/null
+++ b/src/models/RunnerCard.ts
@@ -0,0 +1,33 @@
+import {
+ IsEAN,
+ IsInt,
+ IsNotEmpty,
+ IsObject,
+ IsString
+} from "class-validator";
+import { Runner } from './Runner';
+
+/**
+ * Defines the runner card class (used to create runner card pdfs).
+*/
+export class RunnerCard {
+ /**
+ * The cards's id.
+ */
+ @IsInt()
+ id: number;
+
+ /**
+ * The card's associated runner.
+ */
+ @IsObject()
+ runner: Runner | null;
+
+ /**
+ * The card's code.
+ */
+ @IsEAN()
+ @IsString()
+ @IsNotEmpty()
+ code: string;
+}
diff --git a/src/models/RunnerGroup.ts b/src/models/RunnerGroup.ts
new file mode 100644
index 0000000..f50a179
--- /dev/null
+++ b/src/models/RunnerGroup.ts
@@ -0,0 +1,36 @@
+import { IsInt, IsNotEmpty, IsObject, IsOptional, IsString } from "class-validator";
+
+/**
+ * Defines the runner group class - a simplified version of the backend's ResponseRunnerTeam/-Organization
+*/
+export abstract class RunnerGroup {
+ /**
+ * The group's id.
+ */
+ @IsInt()
+ @IsNotEmpty()
+ id: number;;
+
+ /**
+ * The group's name.
+ */
+ @IsString()
+ @IsNotEmpty()
+ name: string;
+
+ /**
+ * The group's parent group.
+ * If it is set this implies that the object is a team.
+ */
+ @IsObject()
+ @IsOptional()
+ parentGroup?: RunnerGroup
+
+ /**
+ * Returns the groups full name in the format: org.name/team.name (or just org).
+ */
+ public get fullName(): string {
+ if (!this.parentGroup) { return this.name; }
+ return `${this.name}/${this.parentGroup.fullName}`;
+ }
+}
diff --git a/src/static/docs/index.html b/src/static/docs/index.html
new file mode 100644
index 0000000..2870cac
--- /dev/null
+++ b/src/static/docs/index.html
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+ API Docs
+
+
+
+
+
+
+
API Docs
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/static/docs/rapidoc-min.js b/src/static/docs/rapidoc-min.js
new file mode 100644
index 0000000..be2f2d8
--- /dev/null
+++ b/src/static/docs/rapidoc-min.js
@@ -0,0 +1,220 @@
+/*!
+ * RapiDoc 8.4.3 - WebComponent to View OpenAPI docs
+ * License: MIT
+ * Repo : https://github.com/mrin9/RapiDoc
+ * Author : Mrinmoy Majumdar
+ */!function(e){var t=window.webpackHotUpdate;window.webpackHotUpdate=function(e,n){!function(e,t){if(!w[e]||!x[e])return;for(var n in x[e]=!1,t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n]);0==--g&&0===y&&A()}(e,n),t&&t(e,n)};var n,r=!0,o="b7be87fff176cf5e55c8",i={},a=[],s=[];function c(e){var t=T[e];if(!t)return C;var r=function(r){return t.hot.active?(T[r]?-1===T[r].parents.indexOf(e)&&T[r].parents.push(e):(a=[e],n=r),-1===t.children.indexOf(r)&&t.children.push(r)):(console.warn("[HMR] unexpected require("+r+") from disposed module "+e),a=[]),C(r)},o=function(e){return{configurable:!0,enumerable:!0,get:function(){return C[e]},set:function(t){C[e]=t}}};for(var i in C)Object.prototype.hasOwnProperty.call(C,i)&&"e"!==i&&"t"!==i&&Object.defineProperty(r,i,o(i));return r.e=function(e){return"ready"===p&&f("prepare"),y++,C.e(e).then(t,(function(e){throw t(),e}));function t(){y--,"prepare"===p&&(b[e]||O(e),0===y&&0===g&&A())}},r.t=function(e,t){return 1&t&&(e=r(e)),C.t(e,-2&t)},r}function l(t){var r={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:n!==t,active:!0,accept:function(e,t){if(void 0===e)r._selfAccepted=!0;else if("function"==typeof e)r._selfAccepted=e;else if("object"==typeof e)for(var n=0;n=0&&r._disposeHandlers.splice(t,1)},invalidate:function(){switch(this._selfInvalidated=!0,p){case"idle":(h={})[t]=e[t],f("ready");break;case"ready":j(t);break;case"prepare":case"check":case"dispose":case"apply":(m=m||[]).push(t)}},check:S,apply:E,status:function(e){if(!e)return p;u.push(e)},addStatusHandler:function(e){u.push(e)},removeStatusHandler:function(e){var t=u.indexOf(e);t>=0&&u.splice(t,1)},data:i[t]};return n=void 0,r}var u=[],p="idle";function f(e){p=e;for(var t=0;t0;){var o=r.pop(),i=o.id,a=o.chain;if((u=T[i])&&(!u.hot._selfAccepted||u.hot._selfInvalidated)){if(u.hot._selfDeclined)return{type:"self-declined",chain:a,moduleId:i};if(u.hot._main)return{type:"unaccepted",chain:a,moduleId:i};for(var s=0;s ")),A.type){case"self-declined":r.onDeclined&&r.onDeclined(A),r.ignoreDeclined||(E=new Error("Aborted because of self decline: "+A.moduleId+P));break;case"declined":r.onDeclined&&r.onDeclined(A),r.ignoreDeclined||(E=new Error("Aborted because of declined dependency: "+A.moduleId+" in "+A.parentId+P));break;case"unaccepted":r.onUnaccepted&&r.onUnaccepted(A),r.ignoreUnaccepted||(E=new Error("Aborted because "+p+" is not accepted"+P));break;case"accepted":r.onAccepted&&r.onAccepted(A),j=!0;break;case"disposed":r.onDisposed&&r.onDisposed(A),I=!0;break;default:throw new Error("Unexception type "+A.type)}if(E)return f("abort"),Promise.reject(E);if(j)for(p in x[p]=h[p],g(b,A.outdatedModules),A.outdatedDependencies)Object.prototype.hasOwnProperty.call(A.outdatedDependencies,p)&&(y[p]||(y[p]=[]),g(y[p],A.outdatedDependencies[p]));I&&(g(b,[A.moduleId]),x[p]=S)}var R,L=[];for(c=0;c0;)if(p=B.pop(),u=T[p]){var D={},q=u.hot._disposeHandlers;for(l=0;l=0&&F.parents.splice(R,1))}}for(p in y)if(Object.prototype.hasOwnProperty.call(y,p)&&(u=T[p]))for(M=y[p],l=0;l=0&&u.children.splice(R,1);f("apply"),void 0!==v&&(o=v,v=void 0);for(p in h=void 0,x)Object.prototype.hasOwnProperty.call(x,p)&&(e[p]=x[p]);var z=null;for(p in y)if(Object.prototype.hasOwnProperty.call(y,p)&&(u=T[p])){M=y[p];var U=[];for(c=0;ce.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,i=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}n.d(t,"a",(function(){return A})),n.d(t,"b",(function(){return L})),n.d(t,"c",(function(){return F})),n.d(t,"d",(function(){return R})),n.d(t,"e",(function(){return E})),n.d(t,"f",(function(){return D})),n.d(t,"g",(function(){return O})),n.d(t,"h",(function(){return r})),n.d(t,"i",(function(){return a})),n.d(t,"j",(function(){return o})),n.d(t,"k",(function(){return _})),n.d(t,"l",(function(){return s})),n.d(t,"m",(function(){return q})),n.d(t,"n",(function(){return B})),n.d(t,"o",(function(){return y})),n.d(t,"p",(function(){return N})),n.d(t,"q",(function(){return c})),n.d(t,"r",(function(){return m})),n.d(t,"s",(function(){return g})),n.d(t,"t",(function(){return l})),n.d(t,"u",(function(){return j})),n.d(t,"v",(function(){return M})),n.d(t,"w",(function(){return h})),n.d(t,"x",(function(){return b})),n.d(t,"y",(function(){return v}));var A={ANCHOR:"&",COMMENT:"#",TAG:"!",DIRECTIVES_END:"-",DOCUMENT_END:"."},E={ALIAS:"ALIAS",BLANK_LINE:"BLANK_LINE",BLOCK_FOLDED:"BLOCK_FOLDED",BLOCK_LITERAL:"BLOCK_LITERAL",COMMENT:"COMMENT",DIRECTIVE:"DIRECTIVE",DOCUMENT:"DOCUMENT",FLOW_MAP:"FLOW_MAP",FLOW_SEQ:"FLOW_SEQ",MAP:"MAP",MAP_KEY:"MAP_KEY",MAP_VALUE:"MAP_VALUE",PLAIN:"PLAIN",QUOTE_DOUBLE:"QUOTE_DOUBLE",QUOTE_SINGLE:"QUOTE_SINGLE",SEQ:"SEQ",SEQ_ITEM:"SEQ_ITEM"},_="tag:yaml.org,2002:",j={MAP:"tag:yaml.org,2002:map",SEQ:"tag:yaml.org,2002:seq",STR:"tag:yaml.org,2002:str"};function T(e){for(var t=[0],n=e.indexOf("\n");-1!==n;)n+=1,t.push(n),n=e.indexOf("\n",n);return t}function C(e){var t,n;return"string"==typeof e?(t=T(e),n=e):(Array.isArray(e)&&(e=e[0]),e&&e.context&&(e.lineStarts||(e.lineStarts=T(e.context.src)),t=e.lineStarts,n=e.context.src)),{lineStarts:t,src:n}}function I(e,t){if("number"!=typeof e||e<0)return null;var n=C(t),r=n.lineStarts,o=n.src;if(!r||!o||e>o.length)return null;for(var i=0;i=1)||e>r.length)return null;for(var i=r[e-1],a=r[e];a&&a>i&&"\n"===o[a-1];)--a;return o.slice(i,a)}var R=function(){function e(t,n){o(this,e),this.start=t,this.end=n||t}return a(e,null,[{key:"copy",value:function(t){return new e(t.start,t.end)}}]),a(e,[{key:"isEmpty",value:function(){return"number"!=typeof this.start||!this.end||this.end<=this.start}},{key:"setOrigRange",value:function(e,t){var n=this.start,r=this.end;if(0===e.length||r<=e[0])return this.origStart=n,this.origEnd=r,t;for(var o=t;on);)++o;this.origStart=n+o;for(var i=o;o=r);)++o;return this.origEnd=r+o,i}}]),e}(),L=function(){function e(t,n,r){o(this,e),Object.defineProperty(this,"context",{value:r||null,writable:!0}),this.error=null,this.range=null,this.valueRange=null,this.props=n||[],this.type=t,this.value=null}return a(e,null,[{key:"addStringTerminator",value:function(t,n,r){if("\n"===r[r.length-1])return r;var o=e.endOfWhiteSpace(t,n);return o>=t.length||"\n"===t[o]?r+"\n":r}},{key:"atDocumentBoundary",value:function(e,t,n){var r=e[t];if(!r)return!0;var o=e[t-1];if(o&&"\n"!==o)return!1;if(n){if(r!==n)return!1}else if(r!==A.DIRECTIVES_END&&r!==A.DOCUMENT_END)return!1;var i=e[t+1],a=e[t+2];if(i!==r||a!==r)return!1;var s=e[t+3];return!s||"\n"===s||"\t"===s||" "===s}},{key:"endOfIdentifier",value:function(e,t){for(var n=e[t],r="<"===n,o=r?["\n","\t"," ",">"]:["\n","\t"," ","[","]","{","}",","];n&&-1===o.indexOf(n);)n=e[t+=1];return r&&">"===n&&(t+=1),t}},{key:"endOfIndent",value:function(e,t){for(var n=e[t];" "===n;)n=e[t+=1];return t}},{key:"endOfLine",value:function(e,t){for(var n=e[t];n&&"\n"!==n;)n=e[t+=1];return t}},{key:"endOfWhiteSpace",value:function(e,t){for(var n=e[t];"\t"===n||" "===n;)n=e[t+=1];return t}},{key:"startOfLine",value:function(e,t){var n=e[t-1];if("\n"===n)return t;for(;n&&"\n"!==n;)n=e[t-=1];return t+1}},{key:"endOfBlockIndent",value:function(t,n,r){var o=e.endOfIndent(t,r);if(o>r+n)return o;var i=e.endOfWhiteSpace(t,o),a=t[i];return a&&"\n"!==a?null:i}},{key:"atBlank",value:function(e,t,n){var r=e[t];return"\n"===r||"\t"===r||" "===r||n&&!r}},{key:"nextNodeIsIndented",value:function(e,t,n){return!(!e||t<0)&&(t>0||n&&"-"===e)}},{key:"normalizeOffset",value:function(t,n){var r=t[n];return r?"\n"!==r&&"\n"===t[n-1]?n-1:e.endOfWhiteSpace(t,n):n}},{key:"foldNewline",value:function(t,n,r){for(var o=0,i=!1,a="",s=t[n+1];" "===s||"\t"===s||"\n"===s;){switch(s){case"\n":o=0,n+=1,a+="\n";break;case"\t":o<=r&&(i=!0),n=e.endOfWhiteSpace(t,n+2)-1;break;case" ":o+=1,n+=1}s=t[n+1]}return a||(a=" "),s&&o<=r&&(i=!0),{fold:a,offset:n,error:i}}}]),a(e,[{key:"getPropValue",value:function(e,t,n){if(!this.context)return null;var r=this.context.src,o=this.props[e];return o&&r[o.start]===t?r.slice(o.start+(n?1:0),o.end):null}},{key:"commentHasRequiredWhitespace",value:function(t){var n=this.context.src;if(this.header&&t===this.header.end)return!1;if(!this.valueRange)return!1;var r=this.valueRange.end;return t!==r||e.atBlank(n,r-1)}},{key:"parseComment",value:function(t){var n=this.context.src;if(n[t]===A.COMMENT){var r=e.endOfLine(n,t+1),o=new R(t,r);return this.props.push(o),r}return t}},{key:"setOrigRanges",value:function(e,t){return this.range&&(t=this.range.setOrigRange(e,t)),this.valueRange&&this.valueRange.setOrigRange(e,t),this.props.forEach((function(n){return n.setOrigRange(e,t)})),t}},{key:"toString",value:function(){var t=this.context.src,n=this.range,r=this.value;if(null!=r)return r;var o=t.slice(n.start,n.end);return e.addStringTerminator(t,n.end,o)}},{key:"anchor",get:function(){for(var e=0;e0?e.join("\n"):null}},{key:"hasComment",get:function(){if(this.context)for(var e=this.context.src,t=0;t2&&void 0!==arguments[2]?arguments[2]:80,i=P(n.line,t);if(!i)return null;var a=n.col;if(i.length>o)if(a<=o-10)i=i.substr(0,o-1)+"…";else{var s=Math.round(o/2);i.length>a+s&&(i=i.substr(0,a+s-1)+"…"),a-=i.length-o,i="…"+i.substr(1-o)}var c=1,l="";r&&(r.line===n.line&&a+(r.col-n.col)<=o+1?c=r.col-n.col:(c=Math.min(i.length+1,o)-a,l="…"));var u=a>1?" ".repeat(a-1):"",p="^".repeat(c);return"".concat(i,"\n").concat(u).concat(p).concat(l)}(this.linePos,e);a&&(this.message+=":\n\n".concat(a,"\n"))}delete this.source}}}]),n}(d(Error)),M=function(e){c(n,e);var t=m(n);function n(e,r){return o(this,n),t.call(this,"YAMLReferenceError",e,r)}return n}(N),B=function(e){c(n,e);var t=m(n);function n(e,r){return o(this,n),t.call(this,"YAMLSemanticError",e,r)}return n}(N),D=function(e){c(n,e);var t=m(n);function n(e,r){return o(this,n),t.call(this,"YAMLSyntaxError",e,r)}return n}(N),q=function(e){c(n,e);var t=m(n);function n(e,r){return o(this,n),t.call(this,"YAMLWarning",e,r)}return n}(N),F=function(e){c(n,e);var t=m(n);function n(){return o(this,n),t.apply(this,arguments)}return a(n,[{key:"parseBlockValue",value:function(e){for(var t=this.context,r=t.indent,o=t.inFlow,i=t.src,a=e,s=e,c=i[a];"\n"===c&&!L.atDocumentBoundary(i,a+1);c=i[a]){var l=L.endOfBlockIndent(i,r,a+1);if(null===l||"#"===i[l])break;a="\n"===i[l]?l:s=n.endOfLine(i,l,o)}return this.valueRange.isEmpty()&&(this.valueRange.start=e),this.valueRange.end=s,s}},{key:"parse",value:function(e,t){this.context=e;var r=e.inFlow,o=e.src,i=t,a=o[i];return a&&"#"!==a&&"\n"!==a&&(i=n.endOfLine(o,t,r)),this.valueRange=new R(t,i),i=L.endOfWhiteSpace(o,i),i=this.parseComment(i),this.hasComment&&!this.valueRange.isEmpty()||(i=this.parseBlockValue(i)),i}},{key:"strValue",get:function(){if(!this.valueRange||!this.context)return null;for(var e=this.valueRange,t=e.start,n=e.end,r=this.context.src,o=r[n-1];tl?r.slice(l,a+1):s)}else i+=s}var p=r[t];switch(p){case"\t":return{errors:[new B(this,"Plain value cannot start with a tab character")],str:i};case"@":case"`":var f="Plain value cannot start with reserved character ".concat(p);return{errors:[new B(this,f)],str:i};default:return i}}}],[{key:"endOfLine",value:function(e,t,n){for(var r=e[t],o=t;r&&"\n"!==r&&(!n||"["!==r&&"]"!==r&&"{"!==r&&"}"!==r&&","!==r);){var i=e[o+1];if(":"===r&&(!i||"\n"===i||"\t"===i||" "===i||n&&","===i))break;if((" "===r||"\t"===r)&&"#"===i)break;o+=1,r=i}return o}}]),n}(L)},function(e,t,n){"use strict";n.d(t,"a",(function(){return v})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return y})),n.d(t,"d",(function(){return i})),n.d(t,"e",(function(){return d})),n.d(t,"f",(function(){return s})),n.d(t,"g",(function(){return f})),n.d(t,"h",(function(){return x})),n.d(t,"i",(function(){return b})),n.d(t,"j",(function(){return P})),n.d(t,"k",(function(){return g})),n.d(t,"l",(function(){return l})),n.d(t,"m",(function(){return o})),n.d(t,"n",(function(){return H})),n.d(t,"o",(function(){return V})),n.d(t,"p",(function(){return w})),n.d(t,"q",(function(){return D})),n.d(t,"r",(function(){return R})),n.d(t,"s",(function(){return m})),n.d(t,"t",(function(){return k})),n.d(t,"u",(function(){return $})),n.d(t,"v",(function(){return S})),n.d(t,"w",(function(){return a}));var r=n(0);function o(e,t,n){return n?-1===n.indexOf("\n")?"".concat(e," #").concat(n):"".concat(e,"\n")+n.replace(/^/gm,"".concat(t||"","#")):e}var i=function e(){Object(r.j)(this,e)};function a(e,t,n){if(Array.isArray(e))return e.map((function(e,t){return a(e,String(t),n)}));if(e&&"function"==typeof e.toJSON){var r=n&&n.anchors&&n.anchors.get(e);r&&(n.onCreate=function(e){r.res=e,delete n.onCreate});var o=e.toJSON(t,n);return r&&n.onCreate&&n.onCreate(o),o}return n&&n.keep||"bigint"!=typeof e?e:Number(e)}var s=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(e){var o;return Object(r.j)(this,n),(o=t.call(this)).value=e,o}return Object(r.i)(n,[{key:"toJSON",value:function(e,t){return t&&t.keep?this.value:a(this.value,e,t)}},{key:"toString",value:function(){return String(this.value)}}]),n}(i);function c(e,t,n){for(var r=n,o=t.length-1;o>=0;--o){var i=t[o],a=Number.isInteger(i)&&i>=0?[]:{};a[i]=r,r=a}return e.createNode(r,!1)}var l=function(e){return null==e||"object"===Object(r.h)(e)&&e[Symbol.iterator]().next().done},u=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(e){var o;return Object(r.j)(this,n),o=t.call(this),Object(r.l)(Object(r.w)(o),"items",[]),o.schema=e,o}return Object(r.i)(n,[{key:"addIn",value:function(e,t){if(l(e))this.add(t);else{var o=Object(r.x)(e),i=o[0],a=o.slice(1),s=this.get(i,!0);if(s instanceof n)s.addIn(a,t);else{if(void 0!==s||!this.schema)throw new Error("Expected YAML collection at ".concat(i,". Remaining path: ").concat(a));this.set(i,c(this.schema,a,t))}}}},{key:"deleteIn",value:function(e){var t=Object(r.x)(e),o=t[0],i=t.slice(1);if(0===i.length)return this.delete(o);var a=this.get(o,!0);if(a instanceof n)return a.deleteIn(i);throw new Error("Expected YAML collection at ".concat(o,". Remaining path: ").concat(i))}},{key:"getIn",value:function(e,t){var o=Object(r.x)(e),i=o[0],a=o.slice(1),c=this.get(i,!0);return 0===a.length?!t&&c instanceof s?c.value:c:c instanceof n?c.getIn(a,t):void 0}},{key:"hasAllNullValues",value:function(){return this.items.every((function(e){if(!e||"PAIR"!==e.type)return!1;var t=e.value;return null==t||t instanceof s&&null==t.value&&!t.commentBefore&&!t.comment&&!t.tag}))}},{key:"hasIn",value:function(e){var t=Object(r.x)(e),o=t[0],i=t.slice(1);if(0===i.length)return this.has(o);var a=this.get(o,!0);return a instanceof n&&a.hasIn(i)}},{key:"setIn",value:function(e,t){var o=Object(r.x)(e),i=o[0],a=o.slice(1);if(0===a.length)this.set(i,t);else{var s=this.get(i,!0);if(s instanceof n)s.setIn(a,t);else{if(void 0!==s||!this.schema)throw new Error("Expected YAML collection at ".concat(i,". Remaining path: ").concat(a));this.set(i,c(this.schema,a,t))}}}},{key:"toJSON",value:function(){return null}},{key:"toString",value:function(e,t,i,a){var s=this,c=t.blockItem,l=t.flowChars,u=t.isMap,p=t.itemIndent,f=e,d=f.indent,h=f.indentStep,v=f.stringify,m=this.type===r.e.FLOW_MAP||this.type===r.e.FLOW_SEQ||e.inFlow;m&&(p+=h);var g=u&&this.hasAllNullValues();e=Object.assign({},e,{allNullValues:g,indent:p,inFlow:m,type:null});var y,b=!1,x=!1,w=this.items.reduce((function(t,n,r){var i;n&&(!b&&n.spaceBefore&&t.push({type:"comment",str:""}),n.commentBefore&&n.commentBefore.match(/^.*$/gm).forEach((function(e){t.push({type:"comment",str:"#".concat(e)})})),n.comment&&(i=n.comment),m&&(!b&&n.spaceBefore||n.commentBefore||n.comment||n.key&&(n.key.commentBefore||n.key.comment)||n.value&&(n.value.commentBefore||n.value.comment))&&(x=!0)),b=!1;var a=v(n,e,(function(){return i=null}),(function(){return b=!0}));return m&&!x&&a.includes("\n")&&(x=!0),m&&rn.maxFlowStringSingleLineLength){y=k;var A,E=Object(r.g)(O);try{for(E.s();!(A=E.n()).done;){var _=A.value;y+=_?"\n".concat(h).concat(d).concat(_):"\n"}}catch(e){E.e(e)}finally{E.f()}y+="\n".concat(d).concat(S)}else y="".concat(k," ").concat(O.join(" ")," ").concat(S)}else{var j=w.map(c);y=j.shift();var T,C=Object(r.g)(j);try{for(C.s();!(T=C.n()).done;){var I=T.value;y+=I?"\n".concat(d).concat(I):"\n"}}catch(e){C.e(e)}finally{C.f()}}return this.comment?(y+="\n"+this.comment.replace(/^/gm,"".concat(d,"#")),i&&i()):b&&a&&a(),y}}]),n}(i);function p(e){var t=e instanceof s?e.value:e;return t&&"string"==typeof t&&(t=Number(t)),Number.isInteger(t)&&t>=0?t:null}Object(r.l)(u,"maxFlowStringSingleLineLength",60);var f=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(){return Object(r.j)(this,n),t.apply(this,arguments)}return Object(r.i)(n,[{key:"add",value:function(e){this.items.push(e)}},{key:"delete",value:function(e){var t=p(e);return"number"==typeof t&&this.items.splice(t,1).length>0}},{key:"get",value:function(e,t){var n=p(e);if("number"==typeof n){var r=this.items[n];return!t&&r instanceof s?r.value:r}}},{key:"has",value:function(e){var t=p(e);return"number"==typeof t&&t1&&void 0!==arguments[1]?arguments[1]:null;return Object(r.j)(this,n),(o=t.call(this)).key=e,o.value=i,o.type=n.Type.PAIR,o}return Object(r.i)(n,[{key:"addToJSMap",value:function(e,t){var n=a(this.key,"",e);if(t instanceof Map){var o=a(this.value,n,e);t.set(n,o)}else if(t instanceof Set)t.add(n);else{var s=function(e,t,n){return null===t?"":"object"!==Object(r.h)(t)?String(t):e instanceof i&&n&&n.doc?e.toString({anchors:{},doc:n.doc,indent:"",indentStep:n.indentStep,inFlow:!0,inStringifyKey:!0,stringify:n.stringify}):JSON.stringify(t)}(this.key,n,e);t[s]=a(this.value,s,e)}return t}},{key:"toJSON",value:function(e,t){var n=t&&t.mapAsMap?new Map:{};return this.addToJSMap(t,n)}},{key:"toString",value:function(e,t,n){if(!e||!e.doc)return JSON.stringify(this);var a=e.doc.options,c=a.indent,l=a.indentSeq,p=a.simpleKeys,d=this.key,h=this.value,v=d instanceof i&&d.comment;if(p){if(v)throw new Error("With simple keys, key nodes cannot have comments");if(d instanceof u){throw new Error("With simple keys, collection cannot be used as a key value")}}var m=!p&&(!d||v||d instanceof u||d.type===r.e.BLOCK_FOLDED||d.type===r.e.BLOCK_LITERAL),g=e,y=g.doc,b=g.indent,x=g.indentStep,w=g.stringify;e=Object.assign({},e,{implicitKey:!m,indent:b+x});var k=!1,S=w(d,e,(function(){return v=null}),(function(){return k=!0}));if(S=o(S,e.indent,v),e.allNullValues&&!p)return this.comment?(S=o(S,e.indent,this.comment),t&&t()):k&&!v&&n&&n(),e.inFlow?S:"? ".concat(S);S=m?"? ".concat(S,"\n").concat(b,":"):"".concat(S,":"),this.comment&&(S=o(S,e.indent,this.comment),t&&t());var O="",A=null;if(h instanceof i){if(h.spaceBefore&&(O="\n"),h.commentBefore){var E=h.commentBefore.replace(/^/gm,"".concat(e.indent,"#"));O+="\n".concat(E)}A=h.comment}else h&&"object"===Object(r.h)(h)&&(h=y.schema.createNode(h,!0));e.implicitKey=!1,!m&&!this.comment&&h instanceof s&&(e.indentAtStart=S.length+1),k=!1,!l&&c>=2&&!e.inFlow&&!m&&h instanceof f&&h.type!==r.e.FLOW_SEQ&&!h.tag&&!y.anchors.getName(h)&&(e.indent=e.indent.substr(2));var _=w(h,e,(function(){return A=null}),(function(){return k=!0})),j=" ";if(O||this.comment)j="".concat(O,"\n").concat(e.indent);else if(!m&&h instanceof u){("["===_[0]||"{"===_[0])&&!_.includes("\n")||(j="\n".concat(e.indent))}return k&&!A&&n&&n(),o(S+j+_,e.indent,A)}},{key:"commentBefore",get:function(){return this.key instanceof i?this.key.commentBefore:void 0},set:function(e){if(null==this.key&&(this.key=new s(null)),!(this.key instanceof i)){throw new Error("Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.")}this.key.commentBefore=e}}]),n}(i);Object(r.l)(d,"Type",{PAIR:"PAIR",MERGE_PAIR:"MERGE_PAIR"});var h=function e(t,n){if(t instanceof v){var o=n.get(t.source);return o.count*o.aliasCount}if(t instanceof u){var i,a=0,s=Object(r.g)(t.items);try{for(s.s();!(i=s.n()).done;){var c=e(i.value,n);c>a&&(a=c)}}catch(e){s.e(e)}finally{s.f()}return a}if(t instanceof d){var l=e(t.key,n),p=e(t.value,n);return Math.max(l,p)}return 1},v=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(e){var o;return Object(r.j)(this,n),(o=t.call(this)).source=e,o.type=r.e.ALIAS,o}return Object(r.i)(n,null,[{key:"stringify",value:function(e,t){var n=e.range,r=e.source,o=t.anchors,i=t.doc,a=t.implicitKey,s=t.inStringifyKey,c=Object.keys(o).find((function(e){return o[e]===r}));if(!c&&s&&(c=i.anchors.getName(r)||i.anchors.newName()),c)return"*".concat(c).concat(a?" ":"");var l=i.anchors.getName(r)?"Alias node must be after source node":"Source node not found for alias node";throw new Error("".concat(l," [").concat(n,"]"))}}]),Object(r.i)(n,[{key:"toJSON",value:function(e,t){if(!t)return a(this.source,e,t);var n=t.anchors,o=t.maxAliasCount,i=n.get(this.source);if(!i||void 0===i.res){var s="This should not happen: Alias anchor was not resolved?";throw this.cstNode?new r.v(this.cstNode,s):new ReferenceError(s)}if(o>=0&&(i.count+=1,0===i.aliasCount&&(i.aliasCount=h(this.source,n)),i.count*i.aliasCount>o)){var c="Excessive alias count indicates a resource exhaustion attack";throw this.cstNode?new r.v(this.cstNode,c):new ReferenceError(c)}return i.res}},{key:"toString",value:function(e){return n.stringify(this,e)}},{key:"tag",set:function(e){throw new Error("Alias nodes cannot have tags")}}]),n}(i);function m(e,t){var n,o=t instanceof s?t.value:t,i=Object(r.g)(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(a instanceof d){if(a.key===t||a.key===o)return a;if(a.key&&a.key.value===o)return a}}}catch(e){i.e(e)}finally{i.f()}}Object(r.l)(v,"default",!0);var g=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(){return Object(r.j)(this,n),t.apply(this,arguments)}return Object(r.i)(n,[{key:"add",value:function(e,t){e?e instanceof d||(e=new d(e.key||e,e.value)):e=new d(e);var n=m(this.items,e.key),r=this.schema&&this.schema.sortMapEntries;if(n){if(!t)throw new Error("Key ".concat(e.key," already set"));n.value=e.value}else if(r){var o=this.items.findIndex((function(t){return r(e,t)<0}));-1===o?this.items.push(e):this.items.splice(o,0,e)}else this.items.push(e)}},{key:"delete",value:function(e){var t=m(this.items,e);return!!t&&this.items.splice(this.items.indexOf(t),1).length>0}},{key:"get",value:function(e,t){var n=m(this.items,e),r=n&&n.value;return!t&&r instanceof s?r.value:r}},{key:"has",value:function(e){return!!m(this.items,e)}},{key:"set",value:function(e,t){this.add(new d(e,t),!0)}},{key:"toJSON",value:function(e,t,n){var o=n?new n:t&&t.mapAsMap?new Map:{};t&&t.onCreate&&t.onCreate(o);var i,a=Object(r.g)(this.items);try{for(a.s();!(i=a.n()).done;){i.value.addToJSMap(t,o)}}catch(e){a.e(e)}finally{a.f()}return o}},{key:"toString",value:function(e,t,o){if(!e)return JSON.stringify(this);var i,a=Object(r.g)(this.items);try{for(a.s();!(i=a.n()).done;){var s=i.value;if(!(s instanceof d))throw new Error("Map items must all be pairs; found ".concat(JSON.stringify(s)," instead"))}}catch(e){a.e(e)}finally{a.f()}return Object(r.s)(Object(r.t)(n.prototype),"toString",this).call(this,e,{blockItem:function(e){return e.str},flowChars:{start:"{",end:"}"},isMap:!0,itemIndent:e.indent||""},t,o)}}]),n}(u),y=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(e){var o;if(Object(r.j)(this,n),e instanceof d){var i=e.value;i instanceof f||((i=new f).items.push(e.value),i.range=e.value.range),(o=t.call(this,e.key,i)).range=e.range}else o=t.call(this,new s("<<"),new f);return o.type=d.Type.MERGE_PAIR,Object(r.y)(o)}return Object(r.i)(n,[{key:"addToJSMap",value:function(e,t){var n,o=Object(r.g)(this.value.items);try{for(o.s();!(n=o.n()).done;){var i=n.value.source;if(!(i instanceof g))throw new Error("Merge sources must be maps");var a,s=i.toJSON(null,e,Map),c=Object(r.g)(s);try{for(c.s();!(a=c.n()).done;){var l=Object(r.o)(a.value,2),u=l[0],p=l[1];t instanceof Map?t.has(u)||t.set(u,p):t instanceof Set?t.add(u):Object.prototype.hasOwnProperty.call(t,u)||(t[u]=p)}}catch(e){c.e(e)}finally{c.f()}}}catch(e){o.e(e)}finally{o.f()}return t}},{key:"toString",value:function(e,t){var o=this.value;if(o.items.length>1)return Object(r.s)(Object(r.t)(n.prototype),"toString",this).call(this,e,t);this.value=o.items[0];var i=Object(r.s)(Object(r.t)(n.prototype),"toString",this).call(this,e,t);return this.value=o,i}}]),n}(d),b={defaultType:r.e.BLOCK_LITERAL,lineWidth:76},x={trueStr:"true",falseStr:"false"},w={asBigInt:!1},k={nullStr:"null"},S={defaultType:r.e.PLAIN,doubleQuoted:{jsonEncoding:!1,minMultiLineLength:40},fold:{lineWidth:80,minContentWidth:20}};function O(e,t,n){var o,i=Object(r.g)(t);try{for(i.s();!(o=i.n()).done;){var a=o.value,c=a.format,l=a.test,u=a.resolve;if(l){var p=e.match(l);if(p){var f=u.apply(null,p);return f instanceof s||(f=new s(f)),c&&(f.format=c),f}}}}catch(e){i.e(e)}finally{i.f()}return n&&(e=n(e)),new s(e)}var A=function(e,t){for(var n=e[t+1];" "===n||"\t"===n;){do{n=e[t+=1]}while(n&&"\n"!==n);n=e[t+1]}return t};function E(e,t,n,r){var o=r.indentAtStart,i=r.lineWidth,a=void 0===i?80:i,s=r.minContentWidth,c=void 0===s?20:s,l=r.onFold,u=r.onOverflow;if(!a||a<0)return e;var p=Math.max(1+c,1+a-t.length);if(e.length<=p)return e;var f,d=[],h={},v=a-("number"==typeof o?o:t.length),m=void 0,g=void 0,y=!1,b=-1;for("block"===n&&-1!==(b=A(e,b))&&(v=b+p);f=e[b+=1];){if("quoted"===n&&"\\"===f)switch(e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}if("\n"===f)"block"===n&&(b=A(e,b)),v=b+p,m=void 0;else{if(" "===f&&g&&" "!==g&&"\n"!==g&&"\t"!==g){var x=e[b+1];x&&" "!==x&&"\n"!==x&&"\t"!==x&&(m=b)}if(b>=v)if(m)d.push(m),v=m+p,m=void 0;else if("quoted"===n){for(;" "===g||"\t"===g;)g=f,f=e[b+=1],y=!0;d.push(b-2),h[b-2]=!0,v=b-2+p,m=void 0}else y=!0}g=f}if(y&&u&&u(),0===d.length)return e;l&&l();for(var w=e.slice(0,d[0]),k=0;kt)return!0;if(n-(o=r+1)<=t)return!1}return!0}(s,S.fold.lineWidth-c.length)),p=u?"|":">";if(!s)return p+"\n";var f="",d="";if(s=s.replace(/[\n\t ]*$/,(function(e){var t=e.indexOf("\n");return-1===t?p+="-":s!==e&&t===e.length-1||(p+="+",o&&o()),d=e.replace(/\n$/,""),""})).replace(/^[\n ]*/,(function(e){-1!==e.indexOf(" ")&&(p+=l);var t=e.match(/ +$/);return t?(f=e.slice(0,-t[0].length),t[0]):(f=e,"")})),d&&(d=d.replace(/\n+(?!\n|$)/g,"$&".concat(c))),f&&(f=f.replace(/\n+/g,"$&".concat(c))),i&&(p+=" #"+i.replace(/ ?[\r\n]+/g," "),n&&n()),!s)return"".concat(p).concat(l,"\n").concat(c).concat(d);if(u)return s=s.replace(/\n+/g,"$&".concat(c)),"".concat(p,"\n").concat(c).concat(f).concat(s).concat(d);s=s.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,"$&".concat(c));var h=E("".concat(f).concat(s).concat(d),c,"block",S.fold);return"".concat(p,"\n").concat(c).concat(h)}function P(e,t,n,o){var i=S.defaultType,a=t.implicitKey,s=t.inFlow,c=e,l=c.type,u=c.value;"string"!=typeof u&&(u=String(u),e=Object.assign({},e,{value:u}));var p=function(i){switch(i){case r.e.BLOCK_FOLDED:case r.e.BLOCK_LITERAL:return I(e,t,n,o);case r.e.QUOTE_DOUBLE:return T(u,t);case r.e.QUOTE_SINGLE:return C(u,t);case r.e.PLAIN:return function(e,t,n,o){var i=e.comment,a=e.type,s=e.value,c=t.actualString,l=t.implicitKey,u=t.indent,p=t.inFlow;if(l&&/[\n[\]{},]/.test(s)||p&&/[[\]{},]/.test(s))return T(s,t);if(!s||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||p||-1===s.indexOf("\n")?-1!==s.indexOf('"')&&-1===s.indexOf("'")?C(s,t):T(s,t):I(e,t,n,o);if(!l&&!p&&a!==r.e.PLAIN&&-1!==s.indexOf("\n"))return I(e,t,n,o);if(""===u&&j(s))return t.forceBlockIndent=!0,I(e,t,n,o);var f=s.replace(/\n+/g,"$&\n".concat(u));if(c){var d=t.doc.schema.tags;if("string"!=typeof O(f,d,d.scalarFallback).value)return T(s,t)}var h=l?f:E(f,u,"flow",_(t));return!i||p||-1===h.indexOf("\n")&&-1===i.indexOf("\n")?h:(n&&n(),function(e,t,n){if(!n)return e;var r=n.replace(/[\s\S]^/gm,"$&".concat(t,"#"));return"#".concat(r,"\n").concat(t).concat(e)}(h,u,i))}(e,t,n,o);default:return null}};l!==r.e.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(u)?l=r.e.QUOTE_DOUBLE:!a&&!s||l!==r.e.BLOCK_FOLDED&&l!==r.e.BLOCK_LITERAL||(l=r.e.QUOTE_DOUBLE);var f=p(l);if(null===f&&null===(f=p(i)))throw new Error("Unsupported default string type ".concat(i));return f}function R(e){var t=e.format,n=e.minFractionDigits,r=e.tag,o=e.value;if("bigint"==typeof o)return String(o);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";var i=JSON.stringify(o);if(!t&&n&&(!r||"tag:yaml.org,2002:float"===r)&&/^\d/.test(i)){var a=i.indexOf(".");a<0&&(a=i.length,i+=".");for(var s=n-(i.length-a-1);s-- >0;)i+="0"}return i}function L(e,t){var n,o,i;switch(t.type){case r.e.FLOW_MAP:n="}",o="flow map";break;case r.e.FLOW_SEQ:n="]",o="flow sequence";break;default:return void e.push(new r.n(t,"Not a flow collection!?"))}for(var a=t.items.length-1;a>=0;--a){var s=t.items[a];if(!s||s.type!==r.e.COMMENT){i=s;break}}if(i&&i.char!==n){var c,l="Expected ".concat(o," to end with ").concat(n);"number"==typeof i.offset?(c=new r.n(t,l)).offset=i.offset+1:(c=new r.n(i,l),i.range&&i.range.end&&(c.offset=i.range.end-i.range.start)),e.push(c)}}function N(e,t){var n=t.context.src[t.range.start-1];if("\n"!==n&&"\t"!==n&&" "!==n){e.push(new r.n(t,"Comments must be separated from other tokens by white space characters"))}}function M(e,t){var n=String(t),o=n.substr(0,8)+"..."+n.substr(-8);return new r.n(e,'The "'.concat(o,'" key is too long'))}function B(e,t){var n,o=Object(r.g)(t);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=i.afterKey,s=i.before,c=i.comment,l=e.items[s];l?(a&&l.value&&(l=l.value),void 0===c?!a&&l.commentBefore||(l.spaceBefore=!0):l.commentBefore?l.commentBefore+="\n"+c:l.commentBefore=c):void 0!==c&&(e.comment?e.comment+="\n"+c:e.comment=c)}}catch(e){o.e(e)}finally{o.f()}}function D(e,t){var n=t.strValue;return n?"string"==typeof n?n:(n.errors.forEach((function(n){n.source||(n.source=t),e.errors.push(n)})),n.str):""}function q(e,t){var n=t.tag,o=t.type,i=!1;if(n){var a=n.handle,s=n.suffix,c=n.verbatim;if(c){if("!"!==c&&"!!"!==c)return c;var l="Verbatim tags aren't resolved, so ".concat(c," is invalid.");e.errors.push(new r.n(t,l))}else if("!"!==a||s)try{return function(e,t){var n=t.tag,o=n.handle,i=n.suffix,a=e.tagPrefixes.find((function(e){return e.handle===o}));if(!a){var s=e.getDefaults().tagPrefixes;if(s&&(a=s.find((function(e){return e.handle===o}))),!a)throw new r.n(t,"The ".concat(o," tag handle is non-default and was not declared."))}if(!i)throw new r.n(t,"The ".concat(o," tag has no suffix."));if("!"===o&&"1.0"===(e.version||e.options.version)){if("^"===i[0])return e.warnings.push(new r.m(t,"YAML 1.0 ^ tag expansion is not supported")),i;if(/[:/]/.test(i)){var c=i.match(/^([a-z0-9-]+)\/(.*)/i);return c?"tag:".concat(c[1],".yaml.org,2002:").concat(c[2]):"tag:".concat(i)}}return a.prefix+decodeURIComponent(i)}(e,t)}catch(t){e.errors.push(t)}else i=!0}switch(o){case r.e.BLOCK_FOLDED:case r.e.BLOCK_LITERAL:case r.e.QUOTE_DOUBLE:case r.e.QUOTE_SINGLE:return r.u.STR;case r.e.FLOW_MAP:case r.e.MAP:return r.u.MAP;case r.e.FLOW_SEQ:case r.e.SEQ:return r.u.SEQ;case r.e.PLAIN:return i?r.u.STR:null;default:return null}}function F(e,t,n){var o,i=e.schema.tags,a=[],c=Object(r.g)(i);try{for(c.s();!(o=c.n()).done;){var l=o.value;if(l.tag===n){if(!l.test){var p=l.resolve(e,t);return p instanceof u?p:new s(p)}a.push(l)}}}catch(e){c.e(e)}finally{c.f()}var f=D(e,t);return"string"==typeof f&&a.length>0?O(f,a,i.scalarFallback):null}function z(e,t,n){try{var o=F(e,t,n);if(o)return n&&t.tag&&(o.tag=n),o}catch(n){return n.source||(n.source=t),e.errors.push(n),null}try{var i=function(e){switch(e.type){case r.e.FLOW_MAP:case r.e.MAP:return r.u.MAP;case r.e.FLOW_SEQ:case r.e.SEQ:return r.u.SEQ;default:return r.u.STR}}(t);if(!i)throw new Error("The tag ".concat(n," is unavailable"));var a="The tag ".concat(n," is unavailable, falling back to ").concat(i);e.warnings.push(new r.m(t,a));var s=F(e,t,i);return s.tag=n,s}catch(n){var c=new r.v(t,n.message);return c.stack=n.stack,e.errors.push(c),null}}function U(e,t){var n,o={before:[],after:[]},i=!1,a=!1,s=function(e){if(!e)return!1;var t=e.type;return t===r.e.MAP_KEY||t===r.e.MAP_VALUE||t===r.e.SEQ_ITEM}(t.context.parent)?t.context.parent.props.concat(t.props):t.props,c=Object(r.g)(s);try{for(c.s();!(n=c.n()).done;){var l=n.value,u=l.start,p=l.end;switch(t.context.src[u]){case r.a.COMMENT:if(!t.commentHasRequiredWhitespace(u)){e.push(new r.n(t,"Comments must be separated from other tokens by white space characters"))}var f=t.header,d=t.valueRange;(d&&(u>d.start||f&&u>f.start)?o.after:o.before).push(t.context.src.slice(u+1,p));break;case r.a.ANCHOR:if(i){e.push(new r.n(t,"A node can have at most one anchor"))}i=!0;break;case r.a.TAG:if(a){e.push(new r.n(t,"A node can have at most one tag"))}a=!0}}}catch(e){c.e(e)}finally{c.f()}return{comments:o,hasAnchor:i,hasTag:a}}function $(e,t){if(!t)return null;t.error&&e.errors.push(t.error);var n=U(e.errors,t),o=n.comments,i=n.hasAnchor,a=n.hasTag;if(i){var s=e.anchors,c=t.anchor,l=s.getNode(c);l&&(s.map[s.newName(c)]=l),s.map[c]=t}if(t.type===r.e.ALIAS&&(i||a)){e.errors.push(new r.n(t,"An alias node must not specify any properties"))}var u=function(e,t){var n=e.anchors,o=e.errors,i=e.schema;if(t.type===r.e.ALIAS){var a=t.rawValue,s=n.getNode(a);if(!s){var c="Aliased anchor not found: ".concat(a);return o.push(new r.v(t,c)),null}var l=new v(s);return n._cstAliases.push(l),l}var u=q(e,t);if(u)return z(e,t,u);if(t.type!==r.e.PLAIN){var p="Failed to resolve ".concat(t.type," node here");return o.push(new r.f(t,p)),null}try{return O(D(e,t),i.tags,i.tags.scalarFallback)}catch(e){return e.source||(e.source=t),o.push(e),null}}(e,t);if(u){u.range=[t.range.start,t.range.end],e.options.keepCstNodes&&(u.cstNode=t),e.options.keepNodeTypes&&(u.type=t.type);var p=o.before.join("\n");p&&(u.commentBefore=u.commentBefore?"".concat(u.commentBefore,"\n").concat(p):p);var f=o.after.join("\n");f&&(u.comment=u.comment?"".concat(u.comment,"\n").concat(f):f)}return t.resolved=u}function H(e,t){if(t.type!==r.e.MAP&&t.type!==r.e.FLOW_MAP){var n="A ".concat(t.type," node cannot be resolved as a mapping");return e.errors.push(new r.f(t,n)),null}var o=t.type===r.e.FLOW_MAP?function(e,t){for(var n=[],o=[],i=void 0,a=!1,s="{",c=0;c0){(l=new r.c(r.e.PLAIN,[])).context={parent:c,src:c.context.src};var u=c.range.start+1;if(l.range={start:u,end:u},l.valueRange={start:u,end:u},"number"==typeof c.range.origStart){var p=c.range.origStart+1;l.range.origStart=l.range.origEnd=p,l.valueRange.origStart=l.valueRange.origEnd=p}}var f=new d(i,$(e,l));W(c,f),o.push(f),i&&"number"==typeof a&&c.range.start>a+1024&&e.errors.push(M(t,i)),i=void 0,a=null;break;default:void 0!==i&&o.push(new d(i)),i=$(e,c),a=c.range.start,c.error&&e.errors.push(c.error);e:for(var h=s+1;;++h){var v=t.items[h];switch(v&&v.type){case r.e.BLANK_LINE:case r.e.COMMENT:continue e;case r.e.MAP_VALUE:break e;default:e.errors.push(new r.n(c,"Implicit map keys need to be followed by map values"));break e}}if(c.valueRangeContainsNewline){e.errors.push(new r.n(c,"Implicit map keys need to be on a single line"))}}}void 0!==i&&o.push(new d(i));return{comments:n,items:o}}(e,t),i=o.comments,a=o.items,s=new g;s.items=a,B(s,i);for(var c=!1,l=0;lo.valueRange.start)return!1;if(i[s]!==r.a.COMMENT)return!1;for(var c=n;cs+1024&&e.errors.push(M(t,a));for(var g=l.context.src,y=s;ye.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){function t(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}e.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}})),o=(r.defaults,r.getDefaults,r.changeDefaults,/[&<>"']/),i=/[&<>"']/g,a=/[<>"']|&(?!#?\w+;)/,s=/[<>"']|&(?!#?\w+;)/g,c={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(e){return c[e]},u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function p(e){return e.replace(u,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var f=/(^|[^\[])\^/g,d=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,v={},m=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function b(e,t){v[" "+e]||(m.test(e)?v[" "+e]=e+"/":v[" "+e]=x(e,"/",!0));var n=-1===(e=v[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(g,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(y,"$1")+t:e+t}function x(e,t,n){var r=e.length;if(0===r)return"";for(var o=0;o=0&&"\\"===n[o];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length1;)1&t&&(n+=e),t>>=1,e+=e;return n+e},P=r.defaults,R=j,L=_,N=w,M=T;function B(e,t,n){var r=t.href,o=t.title?N(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:n,href:r,title:o,text:i}:{type:"image",raw:n,href:r,title:o,text:N(i)}}var D=function(){function e(e){this.options=e||P}var t=e.prototype;return t.space=function(e){var t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e,t){var n=this.rules.block.code.exec(e);if(n){var r=t[t.length-1];if(r&&"paragraph"===r.type)return{raw:n[0],text:n[0].trimRight()};var o=n[0].replace(/^ {4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?o:R(o,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var n=t[0],r=function(e,t){var n=e.match(/^(\s+)(?:```)/);if(null===n)return t;var r=n[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=r.length?e.slice(r.length):e})).join("\n")}(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim():t[2],text:r}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var n=t[2].trim();if(/#$/.test(n)){var r=R(n,"#");this.options.pedantic?n=r.trim():r&&!/ $/.test(r)||(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n}}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var n={type:"table",header:L(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(n.header.length===n.align.length){var r,o=n.align.length;for(r=0;r ?/gm,"");return{type:"blockquote",raw:t[0],text:n}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){var n,r,o,i,a,s,c,l,u=t[0],p=t[2],f=p.length>1,d={type:"list",raw:u,ordered:f,start:f?+p.slice(0,-1):"",loose:!1,items:[]},h=t[0].match(this.rules.block.item),v=!1,m=h.length;o=this.rules.block.listItemStart.exec(h[0]);for(var g=0;go[0].length||i[1].length>3){h.splice(g,2,h[g]+"\n"+h[g+1]),g--,m--;continue}(!this.options.pedantic||this.options.smartLists?i[2][i[2].length-1]!==p[p.length-1]:f===(1===i[2].length))&&(a=h.slice(g+1).join("\n"),d.raw=d.raw.substring(0,d.raw.length-a.length),g=m-1),o=i}r=n.length,~(n=n.replace(/^ *([*+-]|\d+[.)]) ?/,"")).indexOf("\n ")&&(r-=n.length,n=this.options.pedantic?n.replace(/^ {1,4}/gm,""):n.replace(new RegExp("^ {1,"+r+"}","gm"),"")),s=v||/\n\n(?!\s*$)/.test(n),g!==m-1&&(v="\n"===n.charAt(n.length-1),s||(s=v)),s&&(d.loose=!0),this.options.gfm&&(l=void 0,(c=/^\[[ xX]\] /.test(n))&&(l=" "!==n[1],n=n.replace(/^\[[ xX]\] +/,""))),d.items.push({type:"list_item",raw:u,task:c,checked:l,loose:s,text:n})}return d}},t.html=function(e){var t=this.rules.block.html.exec(e);if(t)return{type:this.options.sanitize?"paragraph":"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):N(t[0]):t[0]}},t.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},t.table=function(e){var t=this.rules.block.table.exec(e);if(t){var n={type:"table",header:L(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(n.header.length===n.align.length){n.raw=t[0];var r,o=n.align.length;for(r=0;r/i.test(r[0])&&(t=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:r[0],inLink:t,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):N(r[0]):r[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var n=t[2].trim();if(!this.options.pedantic&&/^$/.test(n))return;var r=R(n.slice(0,-1),"\\");if((n.length-r.length)%2==0)return}else{var o=M(t[2],"()");if(o>-1){var i=(0===t[0].indexOf("!")?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,i).trim(),t[3]=""}}var a=t[2],s="";if(this.options.pedantic){var c=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(a);c&&(a=c[1],s=c[3])}else s=t[3]?t[3].slice(1,-1):"";return a=a.trim(),/^$/.test(n)?a.slice(1):a.slice(1,-1)),B(t,{href:a?a.replace(this.rules.inline._escapes,"$1"):a,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0])}},t.reflink=function(e,t){var n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){var r=(n[2]||n[1]).replace(/\s+/g," ");if(!(r=t[r.toLowerCase()])||!r.href){var o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return B(n,r,n[0])}},t.strong=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.strong.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var o,i="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(i.lastIndex=0;null!=(r=i.exec(t));)if(o=this.rules.inline.strong.middle.exec(t.slice(0,r.index+3)))return{type:"strong",raw:e.slice(0,o[0].length),text:e.slice(2,o[0].length-2)}}},t.em=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.em.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var o,i="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(i.lastIndex=0;null!=(r=i.exec(t));)if(o=this.rules.inline.em.middle.exec(t.slice(0,r.index+2)))return{type:"em",raw:e.slice(0,o[0].length),text:e.slice(1,o[0].length-1)}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var n=t[2].replace(/\n/g," "),r=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return r&&o&&(n=n.substring(1,n.length-1)),n=N(n,!0),{type:"codespan",raw:t[0],text:n}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2]}},t.autolink=function(e,t){var n,r,o=this.rules.inline.autolink.exec(e);if(o)return r="@"===o[2]?"mailto:"+(n=N(this.options.mangle?t(o[1]):o[1])):n=N(o[1]),{type:"link",raw:o[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}},t.url=function(e,t){var n;if(n=this.rules.inline.url.exec(e)){var r,o;if("@"===n[2])o="mailto:"+(r=N(this.options.mangle?t(n[0]):n[0]));else{var i;do{i=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(i!==n[0]);r=N(n[0]),o="www."===n[1]?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}},t.inlineText=function(e,t,n){var r,o=this.rules.inline.text.exec(e);if(o)return r=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(o[0]):N(o[0]):o[0]:N(this.options.smartypants?n(o[0]):o[0]),{type:"text",raw:o[0],text:r}},e}(),q=A,F=S,z=E,U={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:q,table:q,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};U.def=F(U.def).replace("label",U._label).replace("title",U._title).getRegex(),U.bullet=/(?:[*+-]|\d{1,9}[.)])/,U.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,U.item=F(U.item,"gm").replace(/bull/g,U.bullet).getRegex(),U.listItemStart=F(/^( *)(bull)/).replace("bull",U.bullet).getRegex(),U.list=F(U.list).replace(/bull/g,U.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+U.def.source+")").getRegex(),U._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",U._comment=/|$)/,U.html=F(U.html,"i").replace("comment",U._comment).replace("tag",U._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),U.paragraph=F(U._paragraph).replace("hr",U.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.blockquote=F(U.blockquote).replace("paragraph",U.paragraph).getRegex(),U.normal=z({},U),U.gfm=z({},U.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),U.gfm.nptable=F(U.gfm.nptable).replace("hr",U.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.gfm.table=F(U.gfm.table).replace("hr",U.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.pedantic=z({},U.normal,{html:F("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",U._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:q,paragraph:F(U.normal._paragraph).replace("hr",U.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",U.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var $={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:q,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation*\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation*\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:q,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"};$.punctuation=F($.punctuation).replace(/punctuation/g,$._punctuation).getRegex(),$._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",$._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",$._comment=F(U._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),$.em.start=F($.em.start).replace(/punctuation/g,$._punctuation).getRegex(),$.em.middle=F($.em.middle).replace(/punctuation/g,$._punctuation).replace(/overlapSkip/g,$._overlapSkip).getRegex(),$.em.endAst=F($.em.endAst,"g").replace(/punctuation/g,$._punctuation).getRegex(),$.em.endUnd=F($.em.endUnd,"g").replace(/punctuation/g,$._punctuation).getRegex(),$.strong.start=F($.strong.start).replace(/punctuation/g,$._punctuation).getRegex(),$.strong.middle=F($.strong.middle).replace(/punctuation/g,$._punctuation).replace(/overlapSkip/g,$._overlapSkip).getRegex(),$.strong.endAst=F($.strong.endAst,"g").replace(/punctuation/g,$._punctuation).getRegex(),$.strong.endUnd=F($.strong.endUnd,"g").replace(/punctuation/g,$._punctuation).getRegex(),$.blockSkip=F($._blockSkip,"g").getRegex(),$.overlapSkip=F($._overlapSkip,"g").getRegex(),$._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,$._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,$._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,$.autolink=F($.autolink).replace("scheme",$._scheme).replace("email",$._email).getRegex(),$._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,$.tag=F($.tag).replace("comment",$._comment).replace("attribute",$._attribute).getRegex(),$._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,$._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,$.link=F($.link).replace("label",$._label).replace("href",$._href).replace("title",$._title).getRegex(),$.reflink=F($.reflink).replace("label",$._label).getRegex(),$.reflinkSearch=F($.reflinkSearch,"g").replace("reflink",$.reflink).replace("nolink",$.nolink).getRegex(),$.normal=z({},$),$.pedantic=z({},$.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:F(/^!?\[(label)\]\((.*?)\)/).replace("label",$._label).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$._label).getRegex()}),$.gfm=z({},$.normal,{escape:F($.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\.5&&(n="x"+n.toString(16)),r+=""+n+";";return r}var Q=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||W,this.options.tokenizer=this.options.tokenizer||new D,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:V.normal,inline:Y.normal};this.options.pedantic?(t.block=V.pedantic,t.inline=Y.pedantic):this.options.gfm&&(t.block=V.gfm,this.options.breaks?t.inline=Y.breaks:t.inline=Y.gfm),this.tokenizer.rules=t}t.lex=function(e,n){return new t(n).lex(e)},t.lexInline=function(e,n){return new t(n).inlineTokens(e)};var n,r,o,i=t.prototype;return i.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},i.blockTokens=function(e,t,n){var r,o,i,a;for(void 0===t&&(t=[]),void 0===n&&(n=!0),e=e.replace(/^ +$/gm,"");e;)if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((a=t[t.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.nptable(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],n),t.push(r);else if(r=this.tokenizer.list(e)){for(e=e.substring(r.raw.length),i=r.items.length,o=0;o0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(c));)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,i.index)+"["+K("a",i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(c));)c=c.slice(0,i.index)+"["+K("a",i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;e;)if(a||(s=""),a=!1,o=this.tokenizer.escape(e))e=e.substring(o.raw.length),t.push(o);else if(o=this.tokenizer.tag(e,n,r))e=e.substring(o.raw.length),n=o.inLink,r=o.inRawBlock,t.push(o);else if(o=this.tokenizer.link(e))e=e.substring(o.raw.length),"link"===o.type&&(o.tokens=this.inlineTokens(o.text,[],!0,r)),t.push(o);else if(o=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(o.raw.length),"link"===o.type&&(o.tokens=this.inlineTokens(o.text,[],!0,r)),t.push(o);else if(o=this.tokenizer.strong(e,c,s))e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),t.push(o);else if(o=this.tokenizer.em(e,c,s))e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),t.push(o);else if(o=this.tokenizer.codespan(e))e=e.substring(o.raw.length),t.push(o);else if(o=this.tokenizer.br(e))e=e.substring(o.raw.length),t.push(o);else if(o=this.tokenizer.del(e))e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),t.push(o);else if(o=this.tokenizer.autolink(e,J))e=e.substring(o.raw.length),t.push(o);else if(n||!(o=this.tokenizer.url(e,J))){if(o=this.tokenizer.inlineText(e,r,G))e=e.substring(o.raw.length),s=o.raw.slice(-1),a=!0,t.push(o);else if(e){var u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}throw new Error(u)}}else e=e.substring(o.raw.length),t.push(o);return t},n=t,o=[{key:"rules",get:function(){return{block:V,inline:Y}}}],(r=null)&&e(n.prototype,r),o&&e(n,o),t}(),X=r.defaults,Z=O,ee=w,te=function(){function e(e){this.options=e||X}var t=e.prototype;return t.code=function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var o=this.options.highlight(e,r);null!=o&&o!==e&&(n=!0,e=o)}return r?'