diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..ae221f64a13249526cfcf9caf55833347f71a325 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +Dockerfile +.vscode/ +.idea +.gitignore +LICENSE +README.md +node_modules/ +.svelte-kit/ diff --git a/.env b/.env new file mode 100644 index 0000000000000000000000000000000000000000..dc121826aa765e5a51dc41f4021b95eb2ed9e4eb --- /dev/null +++ b/.env @@ -0,0 +1,83 @@ +# Use .env.local to change these variables +# DO NOT EDIT THIS FILE WITH SENSITIVE DATA + +MONGODB_URL=#your mongodb URL here +MONGODB_DB_NAME=chat-ui +MONGODB_DIRECT_CONNECTION=false + +COOKIE_NAME=hf-chat +HF_ACCESS_TOKEN=#hf_<token> from from https://huggingface.co/settings/token + +# used to activate search with web functionality. disabled if not defined +SERPAPI_KEY=#your serpapi key here + +# Parameters to enable "Sign in with HF" +OPENID_CLIENT_ID= +OPENID_CLIENT_SECRET= +OPENID_SCOPES="openid profile" # Add "email" for some providers like Google that do not provide preferred_username +OPENID_PROVIDER_URL=https://huggingface.co # for Google, use https://accounts.google.com + + +# 'name', 'userMessageToken', 'assistantMessageToken' are required +MODELS=`[ + { + "name": "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5", + "datasetName": "OpenAssistant/oasst1", + "description": "A good alternative to ChatGPT", + "websiteUrl": "https://open-assistant.io", + "userMessageToken": "<|prompter|>", + "assistantMessageToken": "<|assistant|>", + "messageEndToken": "</s>", + "preprompt": "Below are a series of dialogues between various people and an AI assistant. The AI tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable. The assistant is happy to help with almost anything, and will do its best to understand exactly what is needed. It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer. That said, the assistant is practical and really does its best, and doesn't let caution get too much in the way of being useful.\n-----\n", + "promptExamples": [ + { + "title": "Write an email from bullet list", + "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)" + }, { + "title": "Code a snake game", + "prompt": "Code a basic snake game in python, give explanations for each step." + }, { + "title": "Assist in a task", + "prompt": "How do I make a delicious lemon cheesecake?" + } + ], + "parameters": { + "temperature": 0.9, + "top_p": 0.95, + "repetition_penalty": 1.2, + "top_k": 50, + "truncate": 1000, + "max_new_tokens": 1024 + } + } +]` +OLD_MODELS=`[]`# any removed models, `{ name: string, displayName?: string, id?: string }` + +PUBLIC_ORIGIN=#https://huggingface.co +PUBLIC_SHARE_PREFIX=#https://hf.co/chat +PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable +PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=#UA-XXXXXXXX-X / Leave empty to disable +PUBLIC_ANNOUNCEMENT_BANNERS=`[ + { + "title": "Chat UI is now open sourced on GitHub", + "linkTitle": "GitHub repo", + "linkHref": "https://github.com/huggingface/chat-ui" + } +]` + +PARQUET_EXPORT_DATASET= +PARQUET_EXPORT_HF_TOKEN= +PARQUET_EXPORT_SECRET= + + +PUBLIC_APP_NAME=ChatUI # name used as title throughout the app +PUBLIC_APP_ASSETS=chatui # used to find logos & favicons in static/$PUBLIC_APP_ASSETS +PUBLIC_APP_COLOR=blue # can be any of tailwind colors: https://tailwindcss.com/docs/customizing-colors#default-color-palette +PUBLIC_APP_DATA_SHARING=#set to 1 to enable options & text regarding data sharing +PUBLIC_APP_DISCLAIMER=#set to 1 to show a disclaimer on login page + +# PUBLIC_APP_NAME=HuggingChat +# PUBLIC_APP_ASSETS=huggingchat +# PUBLIC_APP_COLOR=yellow +# PUBLIC_APP_DATA_SHARING=1 +# PUBLIC_APP_DISCLAIMER=1 \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000000000000000000000000000000000..38972655faff07d2cc0383044bbf9f43b22c2248 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,13 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example + +# Ignore files for PNPM, NPM and YARN +pnpm-lock.yaml +package-lock.json +yarn.lock diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000000000000000000000000000000000000..93a488b15bf1c2bb5bc5e9990a9a959e2a8118b9 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,43 @@ +module.exports = { + root: true, + parser: "@typescript-eslint/parser", + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:svelte/recommended", + "prettier", + ], + plugins: ["@typescript-eslint"], + ignorePatterns: ["*.cjs"], + overrides: [ + { + files: ["*.svelte"], + parser: "svelte-eslint-parser", + parserOptions: { + parser: "@typescript-eslint/parser", + }, + }, + ], + parserOptions: { + sourceType: "module", + ecmaVersion: 2020, + extraFileExtensions: [".svelte"], + }, + rules: { + "no-shadow": ["error"], + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-non-null-assertion": "error", + "@typescript-eslint/no-unused-vars": [ + // prevent variables with a _ prefix from being marked as unused + "error", + { + argsIgnorePattern: "^_", + }, + ], + }, + env: { + browser: true, + es2017: true, + node: true, + }, +}; diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml new file mode 100644 index 0000000000000000000000000000000000000000..66117b3e0d0fe04a4fb9ad71e8b0c3536b7e932c --- /dev/null +++ b/.github/workflows/lint-and-test.yml @@ -0,0 +1,49 @@ +name: Lint and test +on: + pull_request: + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: "18" + cache: "npm" + - run: | + npm install ci + - name: "Checking lint/format errors" + run: | + npm run lint + - name: "Checking type errors" + run: | + npm run check + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + + services: + mongodb: + image: mongo:6.0.5 + ports: + - 27017:27017 + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: "18" + cache: "npm" + - run: | + npm ci + - name: "Tests" + run: | + npm run test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..6635cf5542756197081eedaa1ec3a7c2c5a0b537 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000000000000000000000000000000000..b6f27f135954640c8cc5bfd7b8c9922ca6eb2aad --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000000000000000000000000000000000..38972655faff07d2cc0383044bbf9f43b22c2248 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example + +# Ignore files for PNPM, NPM and YARN +pnpm-lock.yaml +package-lock.json +yarn.lock diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000000000000000000000000000000000..7b1b699c07e3cf12569382256ab6e8842272a8da --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "useTabs": true, + "trailingComma": "es5", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], + "pluginSearchDirs": ["."], + "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..c32c1bbc3ef092e6702bb6ef83bf3fd87308d20b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.fixAll": true + }, + "eslint.validate": ["javascript", "svelte"] +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9d5791e55ca44d46b6cc1ffa20697a5a67583bba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker +# you will also find guides on how best to write your Dockerfile +FROM node:19 as builder-production + +WORKDIR /app + +COPY --link --chown=1000 package-lock.json package.json ./ +RUN --mount=type=cache,target=/app/.npm \ + npm set cache /app/.npm && \ + npm ci --omit=dev + +FROM builder-production as builder + +RUN --mount=type=cache,target=/app/.npm \ + npm set cache /app/.npm && \ + npm ci + +COPY --link --chown=1000 . . + +RUN --mount=type=secret,id=DOTENV_LOCAL,dst=.env.local \ + npm run build + +FROM node:19-slim + +RUN npm install -g pm2 + +COPY --from=builder-production /app/node_modules /app/node_modules +COPY --link --chown=1000 package.json /app/package.json +COPY --from=builder /app/build /app/build + +CMD pm2 start /app/build/index.js -i $CPU_CORES --no-daemon diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e44d8f5b79a0643c99977835611e1da9d08fc3cf --- /dev/null +++ b/LICENSE @@ -0,0 +1,203 @@ +Copyright 2018- The Hugging Face team. All rights reserved. + + 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) 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 + + (d) 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/PRIVACY.md b/PRIVACY.md new file mode 100644 index 0000000000000000000000000000000000000000..5c122ac9f239bdac85b573eec7f204a62f9d74fd --- /dev/null +++ b/PRIVACY.md @@ -0,0 +1,38 @@ +## Privacy + +> Last updated: May 15, 2023 + +Starting with `v0.2` of HuggingChat, users are authenticated through their HF user account. + +By default, your conversations are shared with the model's authors (for the `v0.2` model, to <a target="_blank" href="https://open-assistant.io/dashboard">Open Assistant</a>) to improve their training data and model over time. Model authors are the custodians of the data collected by their model, even if it's hosted on our platform. + +If you disable data sharing in your settings, your conversations will not be used for any downstream usage (including for research or model training purposes), and they will only be stored to let you access past conversations. You can click on the Delete icon to delete any past conversation at any moment. + +🗓 Please also consult huggingface.co's main privacy policy at https://huggingface.co/privacy. To exercise any of your legal privacy rights, please send an email to privacy@huggingface.co. + +## About available LLMs + +The goal of this app is to showcase that it is now (May 2023) possible to build an open source alternative to ChatGPT. 💪 + +For now, it's running OpenAssistant's [latest LLaMA based model](https://huggingface.co/OpenAssistant/oasst-sft-6-llama-30b-xor) (which is one of the current best open source chat models), but the plan in the longer-term is to expose all good-quality chat models from the Hub. + +We are not affiliated with Open Assistant, but if you want to contribute to the training data for the next generation of open models, please consider contributing to https://open-assistant.io/ ❤️ + +## Technical details + +This app is running in a [Space](https://huggingface.co/docs/hub/spaces-overview), which entails that the code for this UI is publicly visible [inside the Space repo](https://huggingface.co/spaces/huggingchat/chat-ui/tree/main). + +**Further development takes place on the [huggingface/chat-ui GitHub repo](https://github.com/huggingface/chat-ui).** + +The inference backend is running the optimized [text-generation-inference](https://github.com/huggingface/text-generation-inference) on HuggingFace's Inference API infrastructure. + +It is therefore possible to deploy a copy of this app to a Space and customize it (swap model, add some UI elements, or store user messages according to your own Terms and conditions) + +We welcome any feedback on this app: please participate to the public discussion at https://huggingface.co/spaces/huggingchat/chat-ui/discussions + +<a target="_blank" href="https://huggingface.co/spaces/huggingchat/chat-ui/discussions"><img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-a-discussion-xl.svg" title="open a discussion"></a> + +## Coming soon + +- User setting to share conversations with model authors (done ✅) +- LLM watermarking diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..85ea4c51186d6edb442dc5f3d482b82824d282aa --- /dev/null +++ b/README.md @@ -0,0 +1,137 @@ +--- +title: chat-ui +emoji: 🔥 +colorFrom: purple +colorTo: purple +sdk: docker +pinned: false +license: apache-2.0 +base_path: /chat +app_port: 3000 +duplicated_from: huggingchat/chat-ui +--- + +# Chat UI + + + +A chat interface using open source models, eg OpenAssistant. It is a SvelteKit app and it powers the [HuggingChat app on hf.co/chat](https://huggingface.co/chat). + +1. [Setup](#setup) +2. [Launch](#launch) +3. [Extra parameters](#extra-parameters) +4. [Deploying to a HF Space](#deploying-to-a-hf-space) +5. [Building](#building) + +## Setup + +The default config for Chat UI is stored in the `.env` file. You will need to override some values to get Chat UI to run locally. This is done in `.env.local`. + +Start by creating a `.env.local` file in the root of the repository. The bare minimum config you need to get Chat UI to run locally is the following: + +```bash +MONGODB_URL=<the URL to your mongoDB instance> +HF_ACCESS_TOKEN=<your access token> +``` + +### Database + +The chat history is stored in a MongoDB instance, and having a DB instance available is needed for Chat UI to work. + +You can use a local MongoDB instance. The easiest way is to spin one up using docker: + +```bash +docker run -d -p 27017:27017 --name mongo-chatui mongo:latest +``` + +In which case the url of your DB will be `MONGODB_URL=mongodb://localhost:27017`. + +Alternatively, you can use a [free MongoDB Atlas](https://www.mongodb.com/pricing) instance for this, Chat UI should fit comfortably within the free tier. After which you can set the `MONGODB_URL` variable in `.env.local` to match your instance. + +### Hugging Face Access Token + +You will need a Hugging Face access token to run Chat UI locally, using the remote inference endpoints. You can get one from [your Hugging Face profile](https://huggingface.co/settings/tokens). + +## Launch + +After you're done with the `.env.local` file you can run Chat UI locally with: + +```bash +npm install +npm run dev +``` + +## Extra parameters + +### OpenID connect + +The login feature is disabled by default and users are attributed a unique ID based on their browser. But if you want to use OpenID to authenticate your users, you can add the following to your `.env.local` file: + +```bash +OPENID_PROVIDER_URL=<your OIDC issuer> +OPENID_CLIENT_ID=<your OIDC client ID> +OPENID_CLIENT_SECRET=<your OIDC client secret> +``` + +These variables will enable the openID sign-in modal for users. + +### Custom models + +You can customize the parameters passed to the model or even use a new model by updating the `MODELS` variable in your `.env.local`. The default one can be found in `.env` and looks like this : + +```json +MODELS=`[ + { + "name": "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5", + "datasetName": "OpenAssistant/oasst1", + "description": "A good alternative to ChatGPT", + "websiteUrl": "https://open-assistant.io", + "userMessageToken": "<|prompter|>", + "assistantMessageToken": "<|assistant|>", + "messageEndToken": "</s>", + "preprompt": "Below are a series of dialogues between various people and an AI assistant. The AI tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable. The assistant is happy to help with almost anything, and will do its best to understand exactly what is needed. It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer. That said, the assistant is practical and really does its best, and doesn't let caution get too much in the way of being useful.\n-----\n", + "promptExamples": [ + { + "title": "Write an email from bullet list", + "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)" + }, { + "title": "Code a snake game", + "prompt": "Code a basic snake game in python, give explanations for each step." + }, { + "title": "Assist in a task", + "prompt": "How do I make a delicious lemon cheesecake?" + } + ], + "parameters": { + "temperature": 0.9, + "top_p": 0.95, + "repetition_penalty": 1.2, + "top_k": 50, + "truncate": 1000, + "max_new_tokens": 1024 + } + } +]` +``` + +You can change things like the parameters, or customize the preprompt to better suit your needs. You can also add more models by adding more objects to the array, with different preprompts for example. + +### Running your own models + +If you want to, you can even run your own models, by having a look at our endpoint project, [text-generation-inference](https://github.com/huggingface/text-generation-inference). You can then add your own endpoint to the `MODELS` variable in `.env.local` and it will be picked up as well. + +## Deploying to a HF Space + +Create a `DOTENV_LOCAL` secret to your HF space with the content of your .env.local, and they will be picked up automatically when you run. + +## Building + +To create a production version of your app: + +```bash +npm run build +``` + +You can preview the production build with `npm run preview`. + +> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..114b71bfdc81c16908b9d490106559ef1aa86371 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5510 @@ +{ + "name": "chat-ui", + "version": "0.3.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "chat-ui", + "version": "0.3.0", + "dependencies": { + "@huggingface/hub": "^0.5.1", + "@huggingface/inference": "^2.2.0", + "autoprefixer": "^10.4.14", + "date-fns": "^2.29.3", + "dotenv": "^16.0.3", + "highlight.js": "^11.7.0", + "jsdom": "^22.0.0", + "marked": "^4.3.0", + "mongodb": "^5.3.0", + "nanoid": "^4.0.2", + "openid-client": "^5.4.2", + "parquetjs": "^0.11.2", + "postcss": "^8.4.21", + "serpapi": "^1.1.1", + "tailwind-scrollbar": "^3.0.0", + "tailwindcss": "^3.3.1", + "zod": "^3.21.4" + }, + "devDependencies": { + "@iconify-json/carbon": "^1.1.16", + "@iconify-json/eos-icons": "^1.1.6", + "@sveltejs/adapter-node": "^1.2.4", + "@sveltejs/kit": "^1.15.10", + "@tailwindcss/typography": "^0.5.9", + "@types/jsdom": "^21.1.1", + "@types/marked": "^4.0.8", + "@types/parquetjs": "^0.10.3", + "@typescript-eslint/eslint-plugin": "^5.45.0", + "@typescript-eslint/parser": "^5.45.0", + "eslint": "^8.28.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-svelte": "^2.27.3", + "prettier": "^2.8.0", + "prettier-plugin-svelte": "^2.8.1", + "prettier-plugin-tailwindcss": "^0.2.7", + "svelte": "^3.58.0", + "svelte-check": "^3.2.0", + "tslib": "^2.4.1", + "typescript": "^4.9.3", + "unplugin-icons": "^0.16.1", + "vite": "^4.0.0", + "vitest": "^0.31.0" + } + }, + "node_modules/@antfu/install-pkg": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@antfu/install-pkg/-/install-pkg-0.1.1.tgz", + "integrity": "sha512-LyB/8+bSfa0DFGC06zpCEfs89/XoWZwws5ygEa5D+Xsm3OfI+aXQ86VgVG7Acyef+rSZ5HE7J8rrxzrQeM3PjQ==", + "dev": true, + "dependencies": { + "execa": "^5.1.1", + "find-up": "^5.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@antfu/utils": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@antfu/utils/-/utils-0.7.2.tgz", + "integrity": "sha512-vy9fM3pIxZmX07dL+VX1aZe7ynZ+YyB0jY+jE6r3hOK6GNY2t6W8rzpFC4tgpbXUYABkFQwgJq2XYXlxbXAI0g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.16.tgz", + "integrity": "sha512-baLqRpLe4JnKrUXLJChoTN0iXZH7El/mu58GE3WIA6/H834k0XWvLRmGLG8y8arTRS9hJJibPnF0tiGhmWeZgw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.16.tgz", + "integrity": "sha512-QX48qmsEZW+gcHgTmAj+x21mwTz8MlYQBnzF6861cNdQGvj2jzzFjqH0EBabrIa/WVZ2CHolwMoqxVryqKt8+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.16.tgz", + "integrity": "sha512-G4wfHhrrz99XJgHnzFvB4UwwPxAWZaZBOFXh+JH1Duf1I4vIVfuYY9uVLpx4eiV2D/Jix8LJY+TAdZ3i40tDow==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.16.tgz", + "integrity": "sha512-/Ofw8UXZxuzTLsNFmz1+lmarQI6ztMZ9XktvXedTbt3SNWDn0+ODTwxExLYQ/Hod91EZB4vZPQJLoqLF0jvEzA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.16.tgz", + "integrity": "sha512-SzBQtCV3Pdc9kyizh36Ol+dNVhkDyIrGb/JXZqFq8WL37LIyrXU0gUpADcNV311sCOhvY+f2ivMhb5Tuv8nMOQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.16.tgz", + "integrity": "sha512-ZqftdfS1UlLiH1DnS2u3It7l4Bc3AskKeu+paJSfk7RNOMrOxmeFDhLTMQqMxycP1C3oj8vgkAT6xfAuq7ZPRA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.16.tgz", + "integrity": "sha512-rHV6zNWW1tjgsu0dKQTX9L0ByiJHHLvQKrWtnz8r0YYJI27FU3Xu48gpK2IBj1uCSYhJ+pEk6Y0Um7U3rIvV8g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.16.tgz", + "integrity": "sha512-n4O8oVxbn7nl4+m+ISb0a68/lcJClIbaGAoXwqeubj/D1/oMMuaAXmJVfFlRjJLu/ZvHkxoiFJnmbfp4n8cdSw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.16.tgz", + "integrity": "sha512-8yoZhGkU6aHu38WpaM4HrRLTFc7/VVD9Q2SvPcmIQIipQt2I/GMTZNdEHXoypbbGao5kggLcxg0iBKjo0SQYKA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.16.tgz", + "integrity": "sha512-9ZBjlkdaVYxPNO8a7OmzDbOH9FMQ1a58j7Xb21UfRU29KcEEU3VTHk+Cvrft/BNv0gpWJMiiZ/f4w0TqSP0gLA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.16.tgz", + "integrity": "sha512-TIZTRojVBBzdgChY3UOG7BlPhqJz08AL7jdgeeu+kiObWMFzGnQD7BgBBkWRwOtKR1i2TNlO7YK6m4zxVjjPRQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.16.tgz", + "integrity": "sha512-UPeRuFKCCJYpBbIdczKyHLAIU31GEm0dZl1eMrdYeXDH+SJZh/i+2cAmD3A1Wip9pIc5Sc6Kc5cFUrPXtR0XHA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.16.tgz", + "integrity": "sha512-io6yShgIEgVUhExJejJ21xvO5QtrbiSeI7vYUnr7l+v/O9t6IowyhdiYnyivX2X5ysOVHAuyHW+Wyi7DNhdw6Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.16.tgz", + "integrity": "sha512-WhlGeAHNbSdG/I2gqX2RK2gfgSNwyJuCiFHMc8s3GNEMMHUI109+VMBfhVqRb0ZGzEeRiibi8dItR3ws3Lk+cA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.16.tgz", + "integrity": "sha512-gHRReYsJtViir63bXKoFaQ4pgTyah4ruiMRQ6im9YZuv+gp3UFJkNTY4sFA73YDynmXZA6hi45en4BGhNOJUsw==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.16.tgz", + "integrity": "sha512-mfiiBkxEbUHvi+v0P+TS7UnA9TeGXR48aK4XHkTj0ZwOijxexgMF01UDFaBX7Q6CQsB0d+MFNv9IiXbIHTNd4g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.16.tgz", + "integrity": "sha512-n8zK1YRDGLRZfVcswcDMDM0j2xKYLNXqei217a4GyBxHIuPMGrrVuJ+Ijfpr0Kufcm7C1k/qaIrGy6eG7wvgmA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.16.tgz", + "integrity": "sha512-lEEfkfsUbo0xC47eSTBqsItXDSzwzwhKUSsVaVjVji07t8+6KA5INp2rN890dHZeueXJAI8q0tEIfbwVRYf6Ew==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.16.tgz", + "integrity": "sha512-jlRjsuvG1fgGwnE8Afs7xYDnGz0dBgTNZfgCK6TlvPH3Z13/P5pi6I57vyLE8qZYLrGVtwcm9UbUx1/mZ8Ukag==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.16.tgz", + "integrity": "sha512-TzoU2qwVe2boOHl/3KNBUv2PNUc38U0TNnzqOAcgPiD/EZxT2s736xfC2dYQbszAwo4MKzzwBV0iHjhfjxMimg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.16.tgz", + "integrity": "sha512-B8b7W+oo2yb/3xmwk9Vc99hC9bNolvqjaTZYEfMQhzdpBsjTvZBlXQ/teUE55Ww6sg//wlcDjOaqldOKyigWdA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.16.tgz", + "integrity": "sha512-xJ7OH/nanouJO9pf03YsL9NAFQBHd8AqfrQd7Pf5laGyyTt/gToul6QYOA/i5i/q8y9iaM5DQFNTgpi995VkOg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", + "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", + "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.5.1", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.38.0.tgz", + "integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@huggingface/hub": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@huggingface/hub/-/hub-0.5.1.tgz", + "integrity": "sha512-ZaE2gY8NY+XwIOL7+gBhPq19PXG4gbGSSJ7zwWLoq6MKP+nsgkQk/c7fBFrxgBwR6lNd0AJMHPRCjwTndqsqWQ==", + "dependencies": { + "hash-wasm": "^4.9.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@huggingface/inference": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.2.0.tgz", + "integrity": "sha512-26YhLzkms4JvzDnoR72O8LjTk1oFMNe2M3YbrSlrpfCjAa0B26bLfvQj/J/xUOek05CO1bapc5V428mo/uq6rQ==", + "engines": { + "node": ">=18" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@iconify-json/carbon": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/@iconify-json/carbon/-/carbon-1.1.16.tgz", + "integrity": "sha512-AD8bcnRSGA0WfcGEass2FbA0sagrUzrpFx5WchuDy3uf7yKBWumdypdQK121DH321fQDl5+zZQ26T6gC9knwUQ==", + "dev": true, + "dependencies": { + "@iconify/types": "*" + } + }, + "node_modules/@iconify-json/eos-icons": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@iconify-json/eos-icons/-/eos-icons-1.1.6.tgz", + "integrity": "sha512-A1kUcVbgrdlBBacFcs+srwnfSH9htQvlgbi0u6Jf38lp4PZAK3InXVbVySrJKx//FJtSMdnpZh0b89yjcAIIBg==", + "dev": true, + "dependencies": { + "@iconify/types": "*" + } + }, + "node_modules/@iconify/types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", + "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", + "dev": true + }, + "node_modules/@iconify/utils": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.1.5.tgz", + "integrity": "sha512-6MvDI+I6QMvXn5rK9KQGdpEE4mmLTcuQdLZEiX5N+uZB+vc4Yw9K1OtnOgkl8mp4d9X0UrILREyZgF1NUwUt+Q==", + "dev": true, + "dependencies": { + "@antfu/install-pkg": "^0.1.1", + "@antfu/utils": "^0.7.2", + "@iconify/types": "^2.0.0", + "debug": "^4.3.4", + "kolorist": "^1.7.0", + "local-pkg": "^0.4.3" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.21", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz", + "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==", + "dev": true + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "24.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.1.tgz", + "integrity": "sha512-15LsiWRZk4eOGqvrJyu3z3DaBu5BhXIMeWnijSRvd8irrrg9SHpQ1pH+BUK4H6Z9wL9yOxZJMTLU+Au86XHxow==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "glob": "^8.0.3", + "is-reference": "1.2.1", + "magic-string": "^0.27.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/magic-string": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@rollup/plugin-json": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.0.0.tgz", + "integrity": "sha512-i/4C5Jrdr1XUarRhVu27EEwjt4GObltD7c+MkCIpO2QIbojw8MUs+CCTqOphQi3Qtg1FLmYt+l+6YeoIf51J7w==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz", + "integrity": "sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.2.0", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@sveltejs/adapter-node": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.2.4.tgz", + "integrity": "sha512-TNnhS+OKRZ9RKnC+ho5mlE2FJquI61i0v7yOXxBUSU3LAoYH2kwVVL8P8ecjefmZ8BOfM1V54pBnDODBU5CEaA==", + "dev": true, + "dependencies": { + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "rollup": "^3.7.0" + }, + "peerDependencies": { + "@sveltejs/kit": "^1.0.0" + } + }, + "node_modules/@sveltejs/kit": { + "version": "1.15.10", + "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.15.10.tgz", + "integrity": "sha512-qRZxODfsixjgY+7OOxhAQB8viVaxjyDUz2lM6cE22kObzF5mNke81FIxB2wdaOX42LyfVwIYULZQSr7duxLZ7w==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@sveltejs/vite-plugin-svelte": "^2.1.1", + "@types/cookie": "^0.5.1", + "cookie": "^0.5.0", + "devalue": "^4.3.0", + "esm-env": "^1.0.0", + "kleur": "^4.1.5", + "magic-string": "^0.30.0", + "mime": "^3.0.0", + "sade": "^1.8.1", + "set-cookie-parser": "^2.6.0", + "sirv": "^2.0.2", + "tiny-glob": "^0.2.9", + "undici": "~5.22.0" + }, + "bin": { + "svelte-kit": "svelte-kit.js" + }, + "engines": { + "node": "^16.14 || >=18" + }, + "peerDependencies": { + "svelte": "^3.54.0", + "vite": "^4.0.0" + } + }, + "node_modules/@sveltejs/vite-plugin-svelte": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.1.1.tgz", + "integrity": "sha512-7YeBDt4us0FiIMNsVXxyaP4Hwyn2/v9x3oqStkHU3ZdIc5O22pGwUwH33wUqYo+7Itdmo8zxJ45Qvfm3H7UUjQ==", + "dev": true, + "dependencies": { + "debug": "^4.3.4", + "deepmerge": "^4.3.1", + "kleur": "^4.1.5", + "magic-string": "^0.30.0", + "svelte-hmr": "^0.15.1", + "vitefu": "^0.2.4" + }, + "engines": { + "node": "^14.18.0 || >= 16" + }, + "peerDependencies": { + "svelte": "^3.54.0", + "vite": "^4.0.0" + } + }, + "node_modules/@tailwindcss/typography": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.9.tgz", + "integrity": "sha512-t8Sg3DyynFysV9f4JDOVISGsjazNb48AeIYQwcL+Bsq5uf4RYL75C1giZ43KISjeDGBaTN3Kxh7Xj/vRSMJUUg==", + "dev": true, + "dependencies": { + "lodash.castarray": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.2", + "postcss-selector-parser": "6.0.10" + }, + "peerDependencies": { + "tailwindcss": ">=3.0.0 || insiders" + } + }, + "node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser": { + "version": "6.0.10", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", + "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@types/chai": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", + "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==", + "dev": true + }, + "node_modules/@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/cookie": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.5.1.tgz", + "integrity": "sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==", + "dev": true + }, + "node_modules/@types/estree": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", + "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==", + "dev": true + }, + "node_modules/@types/jsdom": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.1.tgz", + "integrity": "sha512-cZFuoVLtzKP3gmq9eNosUL1R50U+USkbLtUQ1bYVgl/lKp0FZM7Cq4aIHAL8oIvQ17uSHi7jXPtfDOdjPwBE7A==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "node_modules/@types/marked": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.0.8.tgz", + "integrity": "sha512-HVNzMT5QlWCOdeuBsgXP8EZzKUf0+AXzN+sLmjvaB3ZlLqO+e4u0uXrdw9ub69wBKFs+c6/pA4r9sy6cCDvImw==", + "dev": true + }, + "node_modules/@types/node": { + "version": "18.13.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz", + "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==" + }, + "node_modules/@types/node-int64": { + "version": "0.4.29", + "resolved": "https://registry.npmjs.org/@types/node-int64/-/node-int64-0.4.29.tgz", + "integrity": "sha512-rHXvenLTj/CcsmNAebaBOhxQ2MqEGl3yXZZcZ21XYR+gzGTTcpOy2N4IxpvTCz48loyQNatHvfn6GhIbbZ1R3Q==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/parquetjs": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/@types/parquetjs/-/parquetjs-0.10.3.tgz", + "integrity": "sha512-n0xVEor3+3qHfCmFAf0pO4m/Pxc5JEmiVkEWWqJexN+p11/Nr+rqABKcIEj4X6tGKF1cnVIeBqy67mW2Yd+Kbg==", + "dev": true, + "dependencies": { + "@types/node-int64": "*" + } + }, + "node_modules/@types/pug": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.6.tgz", + "integrity": "sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==", + "dev": true + }, + "node_modules/@types/resolve": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", + "dev": true + }, + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz", + "integrity": "sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==", + "dev": true + }, + "node_modules/@types/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog==" + }, + "node_modules/@types/whatwg-url": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", + "dependencies": { + "@types/node": "*", + "@types/webidl-conversions": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz", + "integrity": "sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/type-utils": "5.52.0", + "@typescript-eslint/utils": "5.52.0", + "debug": "^4.3.4", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.52.0.tgz", + "integrity": "sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.52.0.tgz", + "integrity": "sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.52.0.tgz", + "integrity": "sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "5.52.0", + "@typescript-eslint/utils": "5.52.0", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.52.0.tgz", + "integrity": "sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.52.0.tgz", + "integrity": "sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/visitor-keys": "5.52.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.52.0.tgz", + "integrity": "sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.52.0", + "@typescript-eslint/types": "5.52.0", + "@typescript-eslint/typescript-estree": "5.52.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.52.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.52.0.tgz", + "integrity": "sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.52.0", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@vitest/expect": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.31.0.tgz", + "integrity": "sha512-Jlm8ZTyp6vMY9iz9Ny9a0BHnCG4fqBa8neCF6Pk/c/6vkUk49Ls6UBlgGAU82QnzzoaUs9E/mUhq/eq9uMOv/g==", + "dev": true, + "dependencies": { + "@vitest/spy": "0.31.0", + "@vitest/utils": "0.31.0", + "chai": "^4.3.7" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.31.0.tgz", + "integrity": "sha512-H1OE+Ly7JFeBwnpHTrKyCNm/oZgr+16N4qIlzzqSG/YRQDATBYmJb/KUn3GrZaiQQyL7GwpNHVZxSQd6juLCgw==", + "dev": true, + "dependencies": { + "@vitest/utils": "0.31.0", + "concordance": "^5.0.4", + "p-limit": "^4.0.0", + "pathe": "^1.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/snapshot": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.31.0.tgz", + "integrity": "sha512-5dTXhbHnyUMTMOujZPB0wjFjQ6q5x9c8TvAsSPUNKjp1tVU7i9pbqcKPqntyu2oXtmVxKbuHCqrOd+Ft60r4tg==", + "dev": true, + "dependencies": { + "magic-string": "^0.30.0", + "pathe": "^1.1.0", + "pretty-format": "^27.5.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.31.0.tgz", + "integrity": "sha512-IzCEQ85RN26GqjQNkYahgVLLkULOxOm5H/t364LG0JYb3Apg0PsYCHLBYGA006+SVRMWhQvHlBBCyuByAMFmkg==", + "dev": true, + "dependencies": { + "tinyspy": "^2.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.31.0.tgz", + "integrity": "sha512-kahaRyLX7GS1urekRXN2752X4gIgOGVX4Wo8eDUGUkTWlGpXzf5ZS6N9RUUS+Re3XEE8nVGqNyxkSxF5HXlGhQ==", + "dev": true, + "dependencies": { + "concordance": "^5.0.4", + "loupe": "^2.3.6", + "pretty-format": "^27.5.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/autoprefixer": { + "version": "10.4.14", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz", + "integrity": "sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + } + ], + "dependencies": { + "browserslist": "^4.21.5", + "caniuse-lite": "^1.0.30001464", + "fraction.js": "^4.2.0", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/bindings": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", + "integrity": "sha512-u4cBQNepWxYA55FunZSM7wMi55yQaN0otnhhilNoWHq0MfOfJeQx0v0mRRpolGOExPjZcl6FtB0BB8Xkb88F0g==", + "optional": true + }, + "node_modules/blueimp-md5": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", + "integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brotli": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz", + "integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==", + "dependencies": { + "base64-js": "^1.1.2" + } + }, + "node_modules/browserslist": { + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bson": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.2.0.tgz", + "integrity": "sha512-HevkSpDbpUfsrHWmWiAsNavANKYIErV2ePXllp1bwq5CDreAaFVj6RVlZpJnxK4WWDCJ/5jMUpaY6G526q3Hjg==", + "engines": { + "node": ">=14.20.1" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001478", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001478.tgz", + "integrity": "sha512-gMhDyXGItTHipJj2ApIvR+iVB5hd0KP3svMWWXDvZOmjzJJassGLMfxRkQCSYgGd2gtdL/ReeiyvMSFD1Ss6Mw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/concordance": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/concordance/-/concordance-5.0.4.tgz", + "integrity": "sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==", + "dev": true, + "dependencies": { + "date-time": "^3.1.0", + "esutils": "^2.0.3", + "fast-diff": "^1.2.0", + "js-string-escape": "^1.0.1", + "lodash": "^4.17.15", + "md5-hex": "^3.0.1", + "semver": "^7.3.2", + "well-known-symbols": "^2.0.0" + }, + "engines": { + "node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14" + } + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cssstyle": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", + "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==", + "dependencies": { + "rrweb-cssom": "^0.6.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/data-urls": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", + "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==", + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^12.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/data-urls/node_modules/tr46": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "dependencies": { + "punycode": "^2.3.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/data-urls/node_modules/whatwg-url": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz", + "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==", + "dependencies": { + "tr46": "^4.1.1", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/date-fns": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", + "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==", + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, + "node_modules/date-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", + "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", + "dev": true, + "dependencies": { + "time-zone": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" + }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/detect-indent": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz", + "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/devalue": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-4.3.0.tgz", + "integrity": "sha512-n94yQo4LI3w7erwf84mhRUkUJfhLoCZiLyoOZ/QFsDbcWNZePrLwbQpvZBUG2TNxwV3VjCKPxkiiQA6pe3TrTA==", + "dev": true + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==" + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "dependencies": { + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.359", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.359.tgz", + "integrity": "sha512-OoVcngKCIuNXtZnsYoqlCvr0Cf3NIPzDIgwUfI9bdTFjXCrr79lI0kwQstLPZ7WhCezLlGksZk/BFAzoXC7GDw==" + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==", + "dev": true + }, + "node_modules/esbuild": { + "version": "0.17.16", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.16.tgz", + "integrity": "sha512-aeSuUKr9aFVY9Dc8ETVELGgkj4urg5isYx8pLf4wlGgB0vTFjxJQdHnNH6Shmx4vYYrOTLCHtRI5i1XZ9l2Zcg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.16", + "@esbuild/android-arm64": "0.17.16", + "@esbuild/android-x64": "0.17.16", + "@esbuild/darwin-arm64": "0.17.16", + "@esbuild/darwin-x64": "0.17.16", + "@esbuild/freebsd-arm64": "0.17.16", + "@esbuild/freebsd-x64": "0.17.16", + "@esbuild/linux-arm": "0.17.16", + "@esbuild/linux-arm64": "0.17.16", + "@esbuild/linux-ia32": "0.17.16", + "@esbuild/linux-loong64": "0.17.16", + "@esbuild/linux-mips64el": "0.17.16", + "@esbuild/linux-ppc64": "0.17.16", + "@esbuild/linux-riscv64": "0.17.16", + "@esbuild/linux-s390x": "0.17.16", + "@esbuild/linux-x64": "0.17.16", + "@esbuild/netbsd-x64": "0.17.16", + "@esbuild/openbsd-x64": "0.17.16", + "@esbuild/sunos-x64": "0.17.16", + "@esbuild/win32-arm64": "0.17.16", + "@esbuild/win32-ia32": "0.17.16", + "@esbuild/win32-x64": "0.17.16" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz", + "integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.2", + "@eslint/js": "8.38.0", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-visitor-keys": "^3.4.0", + "espree": "^9.5.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-prettier": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz", + "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-svelte": { + "version": "2.27.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-2.27.3.tgz", + "integrity": "sha512-LPri23kkKeeh+TkYr9FndQEy2Q5BhOrIwatnLdXx6hUtTIolohzrTJhWMK3k8BwitVBnJGl5CDVWNkV80tmdkQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@jridgewell/sourcemap-codec": "^1.4.14", + "debug": "^4.3.1", + "esutils": "^2.0.3", + "known-css-properties": "^0.27.0", + "postcss": "^8.4.5", + "postcss-load-config": "^3.1.4", + "postcss-safe-parser": "^6.0.0", + "svelte-eslint-parser": "^0.27.0" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0-0", + "svelte": "^3.37.0" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", + "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esm-env": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.0.0.tgz", + "integrity": "sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==", + "dev": true + }, + "node_modules/espree": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", + "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", + "dev": true, + "dependencies": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz", + "integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fraction.js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", + "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/infusion" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalyzer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", + "dev": true + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hash-wasm": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/hash-wasm/-/hash-wasm-4.9.0.tgz", + "integrity": "sha512-7SW7ejyfnRxuOc7ptQHSf4LDoZaWOivfzqw+5rpcQku0nHfmicPKE51ra9BiRLAmT8+gGLestr1XroUkqdjL6w==" + }, + "node_modules/highlight.js": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.7.0.tgz", + "integrity": "sha512-1rRqesRFhMO/PRF+G86evnyJkCgaZFOI+Z6kdj15TA18funfoqJXvgPCLSf0SWq3SRfg1j3HlDs8o4s3EGq1oQ==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/int53": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/int53/-/int53-0.2.4.tgz", + "integrity": "sha512-a5jlKftS7HUOhkUyYD7j2sJ/ZnvWiNlZS1ldR+g1ifQ+/UuZXIE+YTc/lK1qGj/GwAU5F8Z0e1eVq2t1J5Ob2g==" + }, + "node_modules/ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-builtin-module": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.3.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/jiti": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.18.2.tgz", + "integrity": "sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg==", + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/jose": { + "version": "4.14.4", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.14.4.tgz", + "integrity": "sha512-j8GhLiKmUAh+dsFXlX1aJCbt5KMibuKb+d7j1JaOJG6s2UjX1PQlW+OKB/sD4a/5ZYF4RcmYmLSndOoU3Lt/3g==", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/js-sdsl": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/js-string-escape": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", + "integrity": "sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsdom": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-22.0.0.tgz", + "integrity": "sha512-p5ZTEb5h+O+iU02t0GfEjAnkdYPrQSkfuTSMkMYyIoMvUNEHsbG0bHHbfXIcfTqD2UfvjQX7mmgiFsyRwGscVw==", + "dependencies": { + "abab": "^2.0.6", + "cssstyle": "^3.0.0", + "data-urls": "^4.0.0", + "decimal.js": "^10.4.3", + "domexception": "^4.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.4", + "parse5": "^7.1.2", + "rrweb-cssom": "^0.6.0", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^12.0.1", + "ws": "^8.13.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "dependencies": { + "punycode": "^2.3.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz", + "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==", + "dependencies": { + "tr46": "^4.1.1", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/known-css-properties": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.27.0.tgz", + "integrity": "sha512-uMCj6+hZYDoffuvAJjFAPz56E9uoowFHmTkqRtRq5WyC5Q6Cu/fTZKNQpX/RbzChBYLLl3lo8CjFZBAZXq9qFg==", + "dev": true + }, + "node_modules/kolorist": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.7.0.tgz", + "integrity": "sha512-ymToLHqL02udwVdbkowNpzjFd6UzozMtshPQKVi5k1EjKRqKqBrOnE9QbLEb0/pV76SAiIT13hdL8R6suc+f3g==", + "dev": true + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" + }, + "node_modules/local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.castarray": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz", + "integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==", + "dev": true + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lzo": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/lzo/-/lzo-0.4.11.tgz", + "integrity": "sha512-apQHNoW2Alg72FMqaC/7pn03I7umdgSVFt2KRkCXXils4Z9u3QBh1uOtl2O5WmZIDLd9g6Lu4lIdOLmiSTFVCQ==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "bindings": "~1.2.1" + } + }, + "node_modules/magic-string": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz", + "integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/md5-hex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-3.0.1.tgz", + "integrity": "sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==", + "dev": true, + "dependencies": { + "blueimp-md5": "^2.10.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "optional": true + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mlly": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.2.1.tgz", + "integrity": "sha512-1aMEByaWgBPEbWV2BOPEMySRrzl7rIHXmQxam4DM8jVjalTQDjpN2ZKOLUrwyhfZQO7IXHml2StcHMhooDeEEQ==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2", + "pathe": "^1.1.0", + "pkg-types": "^1.0.3", + "ufo": "^1.1.2" + } + }, + "node_modules/mongodb": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.3.0.tgz", + "integrity": "sha512-Wy/sbahguL8c3TXQWXmuBabiLD+iVmz+tOgQf+FwkCjhUIorqbAxRbbz00g4ZoN4sXIPwpAlTANMaGRjGGTikQ==", + "dependencies": { + "bson": "^5.2.0", + "mongodb-connection-string-url": "^2.6.0", + "socks": "^2.7.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "optionalDependencies": { + "saslprep": "^1.0.3" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.201.0", + "mongodb-client-encryption": ">=2.3.0 <3", + "snappy": "^7.2.2" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + } + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz", + "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==", + "dependencies": { + "@types/whatwg-url": "^8.2.1", + "whatwg-url": "^11.0.0" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/mrmime": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", + "integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.2.tgz", + "integrity": "sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^14 || ^16 || >=18" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==" + }, + "node_modules/node-releases": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nwsapi": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.4.tgz", + "integrity": "sha512-NHj4rzRo0tQdijE9ZqAx6kYDcoRwYwSYzCA8MY3JzfxlrvEU0jhnhJT9BhqhJs7I/dKcrDm6TyulaRqZPIhN5g==" + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/object-stream": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/object-stream/-/object-stream-0.0.1.tgz", + "integrity": "sha512-+NPJnRvX9RDMRY9mOWOo/NDppBjbZhXirNNSu2IBnuNboClC9h1ZGHXgHBLDbJMHsxeJDq922aVmG5xs24a/cA==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/oidc-token-hash": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz", + "integrity": "sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==", + "engines": { + "node": "^10.13.0 || >=12.0.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/openid-client": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.4.2.tgz", + "integrity": "sha512-lIhsdPvJ2RneBm3nGBBhQchpe3Uka//xf7WPHTIglery8gnckvW7Bd9IaQzekzXJvWthCMyi/xVEyGW0RFPytw==", + "dependencies": { + "jose": "^4.14.1", + "lru-cache": "^6.0.0", + "object-hash": "^2.2.0", + "oidc-token-hash": "^5.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/openid-client/node_modules/object-hash": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz", + "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parquetjs": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/parquetjs/-/parquetjs-0.11.2.tgz", + "integrity": "sha512-Y6FOc3Oi2AxY4TzJPz7fhICCR8tQNL3p+2xGQoUAMbmlJBR7+JJmMrwuyMjIpDiM7G8Wj/8oqOH4UDUmu4I5ZA==", + "dependencies": { + "brotli": "^1.3.0", + "bson": "^1.0.4", + "int53": "^0.2.4", + "object-stream": "0.0.1", + "snappyjs": "^0.6.0", + "thrift": "^0.11.0", + "varint": "^5.0.0" + }, + "engines": { + "node": ">=7.6" + }, + "optionalDependencies": { + "lzo": "^0.4.0" + } + }, + "node_modules/parquetjs/node_modules/bson": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz", + "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==", + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pathe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.0.tgz", + "integrity": "sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pirates": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", + "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "dev": true, + "dependencies": { + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" + } + }, + "node_modules/postcss": { + "version": "8.4.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz", + "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-import": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-14.1.0.tgz", + "integrity": "sha512-flwI+Vgm4SElObFVPpTIT7SU7R3qk2L7PyduMcokiaVKuWv9d/U+Gm/QAd8NDLuykTWTkcrjOeD2Pp1rMeBTGw==", + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-js": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz", + "integrity": "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==", + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/postcss-load-config": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.4.tgz", + "integrity": "sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==", + "dependencies": { + "lilconfig": "^2.0.5", + "yaml": "^1.10.2" + }, + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": ">=8.0.9", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/postcss-nested": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.0.tgz", + "integrity": "sha512-0DkamqrPcmkBDsLn+vQDIrtkSbNkv5AD/M322ySo9kqFkCIYklym2xEmWkwo+Y3/qZo34tzEPNUw4y7yMCdv5w==", + "dependencies": { + "postcss-selector-parser": "^6.0.10" + }, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-safe-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz", + "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==", + "dev": true, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.3.3" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz", + "integrity": "sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" + }, + "node_modules/postcss/node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-svelte": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.9.0.tgz", + "integrity": "sha512-3doBi5NO4IVgaNPtwewvrgPpqAcvNv0NwJNflr76PIGgi9nf1oguQV1Hpdm9TI2ALIQVn/9iIwLpBO5UcD2Jiw==", + "dev": true, + "peerDependencies": { + "prettier": "^1.16.4 || ^2.0.0", + "svelte": "^3.2.0" + } + }, + "node_modules/prettier-plugin-tailwindcss": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.2.7.tgz", + "integrity": "sha512-jQopIOgjLpX+y8HeD56XZw7onupRTC0cw7eKKUimI7vhjkPF5/1ltW5LyqaPtSyc8HvEpvNZsvvsGFa2qpa59w==", + "dev": true, + "engines": { + "node": ">=12.17.0" + }, + "peerDependencies": { + "@ianvs/prettier-plugin-sort-imports": "*", + "@prettier/plugin-php": "*", + "@prettier/plugin-pug": "*", + "@shopify/prettier-plugin-liquid": "*", + "@shufo/prettier-plugin-blade": "*", + "@trivago/prettier-plugin-sort-imports": "*", + "prettier": ">=2.2.0", + "prettier-plugin-astro": "*", + "prettier-plugin-css-order": "*", + "prettier-plugin-import-sort": "*", + "prettier-plugin-jsdoc": "*", + "prettier-plugin-organize-attributes": "*", + "prettier-plugin-organize-imports": "*", + "prettier-plugin-style-order": "*", + "prettier-plugin-svelte": "*", + "prettier-plugin-twig-melody": "*" + }, + "peerDependenciesMeta": { + "@ianvs/prettier-plugin-sort-imports": { + "optional": true + }, + "@prettier/plugin-php": { + "optional": true + }, + "@prettier/plugin-pug": { + "optional": true + }, + "@shopify/prettier-plugin-liquid": { + "optional": true + }, + "@shufo/prettier-plugin-blade": { + "optional": true + }, + "@trivago/prettier-plugin-sort-imports": { + "optional": true + }, + "prettier-plugin-astro": { + "optional": true + }, + "prettier-plugin-css-order": { + "optional": true + }, + "prettier-plugin-import-sort": { + "optional": true + }, + "prettier-plugin-jsdoc": { + "optional": true + }, + "prettier-plugin-organize-attributes": { + "optional": true + }, + "prettier-plugin-organize-imports": { + "optional": true + }, + "prettier-plugin-style-order": { + "optional": true + }, + "prettier-plugin-svelte": { + "optional": true + }, + "prettier-plugin-twig-melody": { + "optional": true + } + } + }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", + "engines": { + "node": ">=0.6.0", + "teleport": ">=0.2.0" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "3.21.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.5.tgz", + "integrity": "sha512-a4NTKS4u9PusbUJcfF4IMxuqjFzjm6ifj76P54a7cKnvVzJaG12BLVR+hgU2YDGHzyMMQNxLAZWuALsn8q2oQg==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/rrweb-cssom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", + "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==" + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sander": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/sander/-/sander-0.5.1.tgz", + "integrity": "sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==", + "dev": true, + "dependencies": { + "es6-promise": "^3.1.2", + "graceful-fs": "^4.1.3", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.2" + } + }, + "node_modules/sander/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/saslprep": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", + "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", + "optional": true, + "dependencies": { + "sparse-bitfield": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serpapi": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/serpapi/-/serpapi-1.1.1.tgz", + "integrity": "sha512-t5Bqu/6VMJ9naX8K+qCgUStpZOaNQFvIM4AudhMJLS6sqQT/EHaYrhGidDZHVx8QvcEdY6y1wNlxizOCtvJtUQ==", + "dependencies": { + "undici": "^5.12.0" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==", + "dev": true + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/sirv": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.2.tgz", + "integrity": "sha512-4Qog6aE29nIjAOKe/wowFTxOdmbEZKb+3tsLljaBRzJwtqto0BChD2zzH0LhgCSXiI+V7X+Y45v14wBZQ1TK3w==", + "dev": true, + "dependencies": { + "@polka/url": "^1.0.0-next.20", + "mrmime": "^1.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/snappyjs": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/snappyjs/-/snappyjs-0.6.1.tgz", + "integrity": "sha512-YIK6I2lsH072UE0aOFxxY1dPDCS43I5ktqHpeAsuLNYWkE5pGxRGWfDM4/vSUfNzXjC1Ivzt3qx31PCLmc9yqg==" + }, + "node_modules/socks": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", + "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/sorcery": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.0.tgz", + "integrity": "sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.14", + "buffer-crc32": "^0.2.5", + "minimist": "^1.2.0", + "sander": "^0.5.0" + }, + "bin": { + "sorcery": "bin/sorcery" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "optional": true, + "dependencies": { + "memory-pager": "^1.0.2" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "node_modules/std-env": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.3.tgz", + "integrity": "sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==", + "dev": true + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-literal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", + "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/sucrase": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.32.0.tgz", + "integrity": "sha512-ydQOU34rpSyj2TGyz4D2p8rbktIOZ8QY9s+DGLvFU1i5pWJE8vkpruCjGCMHsdXwnD7JDcS+noSwM/a7zyNFDQ==", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "7.1.6", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sucrase/node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/svelte": { + "version": "3.58.0", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.58.0.tgz", + "integrity": "sha512-brIBNNB76mXFmU/Kerm4wFnkskBbluBDCjx/8TcpYRb298Yh2dztS2kQ6bhtjMcvUhd5ynClfwpz5h2gnzdQ1A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/svelte-check": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.2.0.tgz", + "integrity": "sha512-6ZnscN8dHEN5Eq5LgIzjj07W9nc9myyBH+diXsUAuiY/3rt0l65/LCIQYlIuoFEjp2F1NhXqZiJwV9omPj9tMw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.17", + "chokidar": "^3.4.1", + "fast-glob": "^3.2.7", + "import-fresh": "^3.2.1", + "picocolors": "^1.0.0", + "sade": "^1.7.4", + "svelte-preprocess": "^5.0.3", + "typescript": "^5.0.3" + }, + "bin": { + "svelte-check": "bin/svelte-check" + }, + "peerDependencies": { + "svelte": "^3.55.0" + } + }, + "node_modules/svelte-check/node_modules/typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=12.20" + } + }, + "node_modules/svelte-eslint-parser": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.27.0.tgz", + "integrity": "sha512-x9cBbCZwLdCnNE3yPqGhvAqEl9FCILC6AaV2xRtwzaMCpvpqO7ceONXj9xka3fQFczSqLzkwOxP4Ln4cIQNqXg==", + "dev": true, + "dependencies": { + "eslint-scope": "^7.0.0", + "eslint-visitor-keys": "^3.0.0", + "espree": "^9.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "svelte": "^3.37.0" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + } + } + }, + "node_modules/svelte-eslint-parser/node_modules/eslint-scope": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", + "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/svelte-eslint-parser/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/svelte-hmr": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.1.tgz", + "integrity": "sha512-BiKB4RZ8YSwRKCNVdNxK/GfY+r4Kjgp9jCLEy0DuqAKfmQtpL38cQK3afdpjw4sqSs4PLi3jIPJIFp259NkZtA==", + "dev": true, + "engines": { + "node": "^12.20 || ^14.13.1 || >= 16" + }, + "peerDependencies": { + "svelte": ">=3.19.0" + } + }, + "node_modules/svelte-preprocess": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.0.3.tgz", + "integrity": "sha512-GrHF1rusdJVbOZOwgPWtpqmaexkydznKzy5qIC2FabgpFyKN57bjMUUUqPRfbBXK5igiEWn1uO/DXsa2vJ5VHA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@types/pug": "^2.0.6", + "detect-indent": "^6.1.0", + "magic-string": "^0.27.0", + "sorcery": "^0.11.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">= 14.10.0" + }, + "peerDependencies": { + "@babel/core": "^7.10.2", + "coffeescript": "^2.5.1", + "less": "^3.11.3 || ^4.0.0", + "postcss": "^7 || ^8", + "postcss-load-config": "^2.1.0 || ^3.0.0 || ^4.0.0", + "pug": "^3.0.0", + "sass": "^1.26.8", + "stylus": "^0.55.0", + "sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0", + "svelte": "^3.23.0", + "typescript": ">=3.9.5 || ^4.0.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "coffeescript": { + "optional": true + }, + "less": { + "optional": true + }, + "postcss": { + "optional": true + }, + "postcss-load-config": { + "optional": true + }, + "pug": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/svelte-preprocess/node_modules/magic-string": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" + }, + "node_modules/tailwind-scrollbar": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tailwind-scrollbar/-/tailwind-scrollbar-3.0.0.tgz", + "integrity": "sha512-OkVRX9Q1T769vk979UZ519jhj/j/zNBHql7zPLI+tlhX+ahksYO4ZryWD29lOETDx9Wj1sw+K1OeW7W3+ECQOA==", + "engines": { + "node": ">=12.13.0" + }, + "peerDependencies": { + "tailwindcss": "3.x" + } + }, + "node_modules/tailwindcss": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.1.tgz", + "integrity": "sha512-Vkiouc41d4CEq0ujXl6oiGFQ7bA3WEhUZdTgXAhtKxSy49OmKs8rEfQmupsfF0IGW8fv2iQkp1EVUuapCFrZ9g==", + "dependencies": { + "arg": "^5.0.2", + "chokidar": "^3.5.3", + "color-name": "^1.1.4", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.2.12", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.17.2", + "lilconfig": "^2.0.6", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.0.0", + "postcss": "^8.0.9", + "postcss-import": "^14.1.0", + "postcss-js": "^4.0.0", + "postcss-load-config": "^3.1.4", + "postcss-nested": "6.0.0", + "postcss-selector-parser": "^6.0.11", + "postcss-value-parser": "^4.2.0", + "quick-lru": "^5.1.1", + "resolve": "^1.22.1", + "sucrase": "^3.29.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=12.13.0" + }, + "peerDependencies": { + "postcss": "^8.0.9" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/thrift": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/thrift/-/thrift-0.11.0.tgz", + "integrity": "sha512-UpsBhOC45a45TpeHOXE4wwYwL8uD2apbHTbtBvkwtUU4dNwCjC7DpQTjw2Q6eIdfNtw+dKthdwq94uLXTJPfFw==", + "dependencies": { + "node-int64": "^0.4.0", + "q": "^1.5.0", + "ws": ">= 2.2.3" + }, + "engines": { + "node": ">= 4.1.0" + } + }, + "node_modules/time-zone": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", + "integrity": "sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/tiny-glob": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", + "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", + "dev": true, + "dependencies": { + "globalyzer": "0.1.0", + "globrex": "^0.1.2" + } + }, + "node_modules/tinybench": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.0.tgz", + "integrity": "sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.5.0.tgz", + "integrity": "sha512-paHQtnrlS1QZYKF/GnLoOM/DN9fqaGOFbCbxzAhwniySnzl9Ebk8w73/dd34DAhe/obUbPAOldTyYXQZxnPBPQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.0.tgz", + "integrity": "sha512-7eORpyqImoOvkQJCSkL0d0mB4NHHIFAy4b1u8PHdDa7SjGS2njzl6/lyGoZLm+eyYEtlUmFGE0rFj66SWxZgQQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/totalist": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.0.tgz", + "integrity": "sha512-eM+pCBxXO/njtF7vdFsHuqb+ElbxqtI4r5EAvk6grfAFyJ6IvWlSkfZ5T9ozC6xWw3Fj1fGoSmrl0gUs46JVIw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" + }, + "node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", + "dev": true + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/ufo": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.1.2.tgz", + "integrity": "sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==", + "dev": true + }, + "node_modules/undici": { + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.22.0.tgz", + "integrity": "sha512-fR9RXCc+6Dxav4P9VV/sp5w3eFiSdOjJYsbtWfd4s5L5C4ogyuVpdKIVHeW0vV1MloM65/f7W45nR9ZxwVdyiA==", + "dependencies": { + "busboy": "^1.6.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unplugin": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.3.1.tgz", + "integrity": "sha512-h4uUTIvFBQRxUKS2Wjys6ivoeofGhxzTe2sRWlooyjHXVttcVfV/JiavNd3d4+jty0SVV0dxGw9AkY9MwiaCEw==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2", + "chokidar": "^3.5.3", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.5.0" + } + }, + "node_modules/unplugin-icons": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/unplugin-icons/-/unplugin-icons-0.16.1.tgz", + "integrity": "sha512-qTunFUkpAyDnwzwV7YV1ZgCWRYfLuURcCurhhXOWMy2ipY88qx1pADvral2hJu4Xymh0X0t3Zcll3BIru2AVLQ==", + "dev": true, + "dependencies": { + "@antfu/install-pkg": "^0.1.1", + "@antfu/utils": "^0.7.2", + "@iconify/utils": "^2.1.5", + "debug": "^4.3.4", + "kolorist": "^1.7.0", + "local-pkg": "^0.4.3", + "unplugin": "^1.3.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@svgr/core": ">=7.0.0", + "@vue/compiler-sfc": "^3.0.2 || ^2.7.0", + "vue-template-compiler": "^2.6.12", + "vue-template-es2015-compiler": "^1.9.0" + }, + "peerDependenciesMeta": { + "@svgr/core": { + "optional": true + }, + "@vue/compiler-sfc": { + "optional": true + }, + "vue-template-compiler": { + "optional": true + }, + "vue-template-es2015-compiler": { + "optional": true + } + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", + "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "browserslist-lint": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, + "node_modules/vite": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.5.tgz", + "integrity": "sha512-0gEnL9wiRFxgz40o/i/eTBwm+NEbpUeTWhzKrZDSdKm6nplj+z4lKz8ANDgildxHm47Vg8EUia0aicKbawUVVA==", + "dev": true, + "dependencies": { + "esbuild": "^0.17.5", + "postcss": "^8.4.23", + "rollup": "^3.21.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.31.0.tgz", + "integrity": "sha512-8x1x1LNuPvE2vIvkSB7c1mApX5oqlgsxzHQesYF7l5n1gKrEmrClIiZuOFbFDQcjLsmcWSwwmrWrcGWm9Fxc/g==", + "dev": true, + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.2.0", + "pathe": "^1.1.0", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vitefu": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.4.tgz", + "integrity": "sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==", + "dev": true, + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.31.0.tgz", + "integrity": "sha512-JwWJS9p3GU9GxkG7eBSmr4Q4x4bvVBSswaCFf1PBNHiPx00obfhHRJfgHcnI0ffn+NMlIh9QGvG75FlaIBdKGA==", + "dev": true, + "dependencies": { + "@types/chai": "^4.3.4", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "@vitest/expect": "0.31.0", + "@vitest/runner": "0.31.0", + "@vitest/snapshot": "0.31.0", + "@vitest/spy": "0.31.0", + "@vitest/utils": "0.31.0", + "acorn": "^8.8.2", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.7", + "concordance": "^5.0.4", + "debug": "^4.3.4", + "local-pkg": "^0.4.3", + "magic-string": "^0.30.0", + "pathe": "^1.1.0", + "picocolors": "^1.0.0", + "std-env": "^3.3.2", + "strip-literal": "^1.0.1", + "tinybench": "^2.4.0", + "tinypool": "^0.5.0", + "vite": "^3.0.0 || ^4.0.0", + "vite-node": "0.31.0", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@vitest/browser": "*", + "@vitest/ui": "*", + "happy-dom": "*", + "jsdom": "*", + "playwright": "*", + "safaridriver": "*", + "webdriverio": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "playwright": { + "optional": true + }, + "safaridriver": { + "optional": true + }, + "webdriverio": { + "optional": true + } + } + }, + "node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "engines": { + "node": ">=12" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack-virtual-modules": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz", + "integrity": "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==", + "dev": true + }, + "node_modules/well-known-symbols": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", + "integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "dev": true, + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", + "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a70636e70897137bb26c3fc43244ddfecaae2c0d --- /dev/null +++ b/package.json @@ -0,0 +1,61 @@ +{ + "name": "chat-ui", + "version": "0.3.0", + "private": true, + "packageManager": "npm@9.5.0", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --plugin-search-dir . --check . && eslint .", + "format": "prettier --plugin-search-dir . --write .", + "test": "MONGODB_URL=mongodb://127.0.0.1:27017/ vitest" + }, + "devDependencies": { + "@iconify-json/carbon": "^1.1.16", + "@iconify-json/eos-icons": "^1.1.6", + "@sveltejs/adapter-node": "^1.2.4", + "@sveltejs/kit": "^1.15.10", + "@tailwindcss/typography": "^0.5.9", + "@types/jsdom": "^21.1.1", + "@types/marked": "^4.0.8", + "@types/parquetjs": "^0.10.3", + "@typescript-eslint/eslint-plugin": "^5.45.0", + "@typescript-eslint/parser": "^5.45.0", + "eslint": "^8.28.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-svelte": "^2.27.3", + "prettier": "^2.8.0", + "prettier-plugin-svelte": "^2.8.1", + "prettier-plugin-tailwindcss": "^0.2.7", + "svelte": "^3.58.0", + "svelte-check": "^3.2.0", + "tslib": "^2.4.1", + "typescript": "^4.9.3", + "unplugin-icons": "^0.16.1", + "vite": "^4.0.0", + "vitest": "^0.31.0" + }, + "type": "module", + "dependencies": { + "@huggingface/hub": "^0.5.1", + "@huggingface/inference": "^2.2.0", + "autoprefixer": "^10.4.14", + "date-fns": "^2.29.3", + "dotenv": "^16.0.3", + "highlight.js": "^11.7.0", + "jsdom": "^22.0.0", + "marked": "^4.3.0", + "mongodb": "^5.3.0", + "nanoid": "^4.0.2", + "openid-client": "^5.4.2", + "parquetjs": "^0.11.2", + "postcss": "^8.4.21", + "serpapi": "^1.1.1", + "tailwind-scrollbar": "^3.0.0", + "tailwindcss": "^3.3.1", + "zod": "^3.21.4" + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000000000000000000000000000000000000..7b75c83aff1c05e0e0e315638e07a22314603d4d --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/src/app.d.ts b/src/app.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfd942be68dce05eda0ca563062e867c1230d866 --- /dev/null +++ b/src/app.d.ts @@ -0,0 +1,20 @@ +/// <reference types="@sveltejs/kit" /> +/// <reference types="unplugin-icons/types/svelte" /> + +import type { User } from "$lib/types/User"; + +// See https://kit.svelte.dev/docs/types#app +// for information about these interfaces +declare global { + namespace App { + // interface Error {} + interface Locals { + sessionId: string; + user?: User; + } + // interface PageData {} + // interface Platform {} + } +} + +export {}; diff --git a/src/app.html b/src/app.html new file mode 100644 index 0000000000000000000000000000000000000000..f17eea3e26d80642ac822b3bf15c5c7b4878f3a0 --- /dev/null +++ b/src/app.html @@ -0,0 +1,71 @@ +<!DOCTYPE html> +<html lang="en" class="h-full"> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> + <script> + if ( + localStorage.theme === "dark" || + (!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches) + ) { + document.documentElement.classList.add("dark"); + } + + // For some reason, Sveltekit doesn't let us load env variables from .env here, so we load it from hooks.server.ts + window.gaId = "%gaId%"; + window.gaIdDeprecated = "%gaIdDeprecated%"; + </script> + %sveltekit.head% + </head> + <body data-sveltekit-preload-data="hover" class="h-full dark:bg-gray-900"> + <div id="app" class="contents h-full">%sveltekit.body%</div> + + <!-- Google Tag Manager --> + <script> + if (window.gaId) { + const script = document.createElement("script"); + script.src = "https://www.googletagmanager.com/gtag/js?id=" + window.gaId; + script.async = true; + document.head.appendChild(script); + + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag("js", new Date()); + /// ^ See https://developers.google.com/tag-platform/gtagjs/install + gtag("config", window.gaId); + gtag("consent", "default", { ad_storage: "denied", analytics_storage: "denied" }); + /// ^ See https://developers.google.com/tag-platform/gtagjs/reference#consent + /// TODO: ask the user for their consent and update this with gtag('consent', 'update') + } + </script> + + <!-- Google Analytics v3 (deprecated on 1 July 2023) --> + <script> + if (window.gaIdDeprecated) { + (function (i, s, o, g, r, a, m) { + i["GoogleAnalyticsObject"] = r; + (i[r] = + i[r] || + function () { + (i[r].q = i[r].q || []).push(arguments); + }), + (i[r].l = 1 * new Date()); + (a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]); + a.async = 1; + a.src = g; + m.parentNode.insertBefore(a, m); + })( + window, + document, + "script", + "https://www.google-analytics.com/analytics.js", + "ganalytics" + ); + ganalytics("create", window.gaIdDeprecated, "auto"); + ganalytics("send", "pageview"); + } + </script> + </body> +</html> diff --git a/src/hooks.server.ts b/src/hooks.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..378223866600a826f72de76f531458c9318503e9 --- /dev/null +++ b/src/hooks.server.ts @@ -0,0 +1,109 @@ +import { COOKIE_NAME } from "$env/static/private"; +import type { Handle } from "@sveltejs/kit"; +import { + PUBLIC_GOOGLE_ANALYTICS_ID, + PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID, + PUBLIC_ORIGIN, + PUBLIC_APP_DISCLAIMER, +} from "$env/static/public"; +import { collections } from "$lib/server/database"; +import { base } from "$app/paths"; +import { refreshSessionCookie, requiresUser } from "$lib/server/auth"; +import { ERROR_MESSAGES } from "$lib/stores/errors"; + +export const handle: Handle = async ({ event, resolve }) => { + const token = event.cookies.get(COOKIE_NAME); + + event.locals.sessionId = token || crypto.randomUUID(); + + const user = await collections.users.findOne({ sessionId: event.locals.sessionId }); + + if (user) { + event.locals.user = user; + } + + function errorResponse(status: number, message: string) { + const sendJson = + event.request.headers.get("accept")?.includes("application/json") || + event.request.headers.get("content-type")?.includes("application/json"); + return new Response(sendJson ? JSON.stringify({ error: message }) : message, { + status, + headers: { + "content-type": sendJson ? "application/json" : "text/plain", + }, + }); + } + + // CSRF protection + const requestContentType = event.request.headers.get("content-type")?.split(";")[0] ?? ""; + /** https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-enctype */ + const nativeFormContentTypes = [ + "multipart/form-data", + "application/x-www-form-urlencoded", + "text/plain", + ]; + if (event.request.method === "POST" && nativeFormContentTypes.includes(requestContentType)) { + const referer = event.request.headers.get("referer"); + + if (!referer) { + return errorResponse(403, "Non-JSON form requests need to have a referer"); + } + + const validOrigins = [ + new URL(event.request.url).origin, + ...(PUBLIC_ORIGIN ? [new URL(PUBLIC_ORIGIN).origin] : []), + ]; + + if (!validOrigins.includes(new URL(referer).origin)) { + return errorResponse(403, "Invalid referer for POST request"); + } + } + + if ( + !event.url.pathname.startsWith(`${base}/login`) && + !event.url.pathname.startsWith(`${base}/admin`) && + !["GET", "OPTIONS", "HEAD"].includes(event.request.method) + ) { + if (!user && requiresUser) { + return errorResponse(401, ERROR_MESSAGES.authOnly); + } + + // if login is not required and the call is not from /settings and we display the ethics modal with PUBLIC_APP_DISCLAIMER + // we check if the user has accepted the ethics modal first. + // If login is required, `ethicsModalAcceptedAt` is already true at this point, so do not pass this condition. This saves a DB call. + if ( + !requiresUser && + !event.url.pathname.startsWith(`${base}/settings`) && + !!PUBLIC_APP_DISCLAIMER + ) { + const hasAcceptedEthicsModal = await collections.settings.countDocuments({ + sessionId: event.locals.sessionId, + ethicsModalAcceptedAt: { $exists: true }, + }); + + if (!hasAcceptedEthicsModal) { + return errorResponse(405, "You need to accept the welcome modal first"); + } + } + } + + refreshSessionCookie(event.cookies, event.locals.sessionId); + + let replaced = false; + + const response = await resolve(event, { + transformPageChunk: (chunk) => { + // For some reason, Sveltekit doesn't let us load env variables from .env in the app.html template + if (replaced || !chunk.html.includes("%gaId%") || !chunk.html.includes("%gaIdDeprecated%")) { + return chunk.html; + } + replaced = true; + + return chunk.html + .replace("%gaId%", PUBLIC_GOOGLE_ANALYTICS_ID) + .replace("%gaIdDeprecated%", PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID); + }, + }); + + return response; +}; diff --git a/src/lib/actions/snapScrollToBottom.ts b/src/lib/actions/snapScrollToBottom.ts new file mode 100644 index 0000000000000000000000000000000000000000..b22a0648221f6b58853a910fb6286f79574a0246 --- /dev/null +++ b/src/lib/actions/snapScrollToBottom.ts @@ -0,0 +1,54 @@ +import { navigating } from "$app/stores"; +import { tick } from "svelte"; +import { get } from "svelte/store"; + +const detachedOffset = 10; + +/** + * @param node element to snap scroll to bottom + * @param dependency pass in a dependency to update scroll on changes. + */ +export const snapScrollToBottom = (node: HTMLElement, dependency: unknown) => { + let prevScrollValue = node.scrollTop; + let isDetached = false; + + const handleScroll = () => { + // if user scrolled up, we detach + if (node.scrollTop < prevScrollValue) { + isDetached = true; + } + + // if user scrolled back to within 10px of bottom, we reattach + if (node.scrollTop - (node.scrollHeight - node.clientHeight) >= -detachedOffset) { + isDetached = false; + } + + prevScrollValue = node.scrollTop; + }; + + const updateScroll = async (_options: { force?: boolean } = {}) => { + const defaultOptions = { force: false }; + const options = { ...defaultOptions, ..._options }; + const { force } = options; + + if (!force && isDetached && !get(navigating)) return; + + // wait for next tick to ensure that the DOM is updated + await tick(); + + node.scrollTo({ top: node.scrollHeight }); + }; + + node.addEventListener("scroll", handleScroll); + + if (dependency) { + updateScroll({ force: true }); + } + + return { + update: updateScroll, + destroy: () => { + node.removeEventListener("scroll", handleScroll); + }, + }; +}; diff --git a/src/lib/buildPrompt.ts b/src/lib/buildPrompt.ts new file mode 100644 index 0000000000000000000000000000000000000000..6768c3c09c2da09f2eacca6b150fd438b247c905 --- /dev/null +++ b/src/lib/buildPrompt.ts @@ -0,0 +1,57 @@ +import type { BackendModel } from "./server/models"; +import type { Message } from "./types/Message"; +import { collections } from "$lib/server/database"; +import { ObjectId } from "mongodb"; +/** + * Convert [{user: "assistant", content: "hi"}, {user: "user", content: "hello"}] to: + * + * <|assistant|>hi<|endoftext|><|prompter|>hello<|endoftext|><|assistant|> + */ + +export async function buildPrompt( + messages: Pick<Message, "from" | "content">[], + model: BackendModel, + webSearchId?: string +): Promise<string> { + const prompt = + messages + .map( + (m) => + (m.from === "user" + ? model.userMessageToken + m.content + : model.assistantMessageToken + m.content) + + (model.messageEndToken + ? m.content.endsWith(model.messageEndToken) + ? "" + : model.messageEndToken + : "") + ) + .join("") + model.assistantMessageToken; + + let webPrompt = ""; + + if (webSearchId) { + const webSearch = await collections.webSearches.findOne({ + _id: new ObjectId(webSearchId), + }); + + if (!webSearch) throw new Error("Web search not found"); + + if (webSearch.summary) { + webPrompt = + model.assistantMessageToken + + `The following context was found while searching the internet: ${webSearch.summary}` + + model.messageEndToken; + } + } + const finalPrompt = + model.preprompt + + webPrompt + + prompt + .split(" ") + .slice(-(model.parameters?.truncate ?? 0)) + .join(" "); + + // Not super precise, but it's truncated in the model's backend anyway + return finalPrompt; +} diff --git a/src/lib/components/AnnouncementBanner.svelte b/src/lib/components/AnnouncementBanner.svelte new file mode 100644 index 0000000000000000000000000000000000000000..7d6948a6b387ef45104b9b08294ac1e5920e607b --- /dev/null +++ b/src/lib/components/AnnouncementBanner.svelte @@ -0,0 +1,15 @@ +<script lang="ts"> + export let title = ""; + export let classNames = ""; +</script> + +<div class="flex items-center rounded-xl bg-gray-100 p-1 text-sm dark:bg-gray-800 {classNames}"> + <span + class="mr-2 inline-flex items-center rounded-lg bg-gradient-to-br from-primary-300 px-2 py-1 text-xxs font-medium uppercase leading-3 text-primary-700 dark:from-primary-900 dark:text-primary-400" + >New</span + > + {title} + <div class="ml-auto shrink-0"> + <slot /> + </div> +</div> diff --git a/src/lib/components/CodeBlock.svelte b/src/lib/components/CodeBlock.svelte new file mode 100644 index 0000000000000000000000000000000000000000..dc7cbc500d9eb55e709ef2767ad25a91692fe129 --- /dev/null +++ b/src/lib/components/CodeBlock.svelte @@ -0,0 +1,28 @@ +<script lang="ts"> + import { afterUpdate } from "svelte"; + import CopyToClipBoardBtn from "./CopyToClipBoardBtn.svelte"; + + export let code = ""; + export let lang = ""; + + $: highlightedCode = ""; + + afterUpdate(async () => { + const { default: hljs } = await import("highlight.js"); + const language = hljs.getLanguage(lang); + + highlightedCode = hljs.highlightAuto(code, language?.aliases).value; + }); +</script> + +<div class="group relative my-4 rounded-lg"> + <!-- eslint-disable svelte/no-at-html-tags --> + <pre + class="scrollbar-custom overflow-auto px-5 scrollbar-thumb-gray-500 hover:scrollbar-thumb-gray-400 dark:scrollbar-thumb-white/10 dark:hover:scrollbar-thumb-white/20"><code + class="language-{lang}">{@html highlightedCode || code.replaceAll("<", "<")}</code + ></pre> + <CopyToClipBoardBtn + classNames="absolute top-2 right-2 invisible opacity-0 group-hover:visible group-hover:opacity-100" + value={code} + /> +</div> diff --git a/src/lib/components/CopyToClipBoardBtn.svelte b/src/lib/components/CopyToClipBoardBtn.svelte new file mode 100644 index 0000000000000000000000000000000000000000..bf5a8e31aab6939dadcd43a17885762ffe768b1a --- /dev/null +++ b/src/lib/components/CopyToClipBoardBtn.svelte @@ -0,0 +1,50 @@ +<script lang="ts"> + import { onDestroy } from "svelte"; + + import IconCopy from "./icons/IconCopy.svelte"; + import Tooltip from "./Tooltip.svelte"; + + export let classNames = ""; + export let value: string; + + let isSuccess = false; + let timeout: ReturnType<typeof setTimeout>; + + const handleClick = async () => { + // writeText() can be unavailable or fail in some cases (iframe, etc) so we try/catch + try { + await navigator.clipboard.writeText(value); + + isSuccess = true; + if (timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(() => { + isSuccess = false; + }, 1000); + } catch (err) { + console.error(err); + } + }; + + onDestroy(() => { + if (timeout) { + clearTimeout(timeout); + } + }); +</script> + +<button + class="btn rounded-lg border border-gray-200 px-2 py-2 text-sm shadow-sm transition-all hover:border-gray-300 active:shadow-inner dark:border-gray-600 dark:hover:border-gray-400 {classNames} + {!isSuccess && 'text-gray-200 dark:text-gray-200'} + {isSuccess && 'text-green-500'} + " + title={"Copy to clipboard"} + type="button" + on:click={handleClick} +> + <span class="relative"> + <IconCopy /> + <Tooltip classNames={isSuccess ? "opacity-100" : "opacity-0"} /> + </span> +</button> diff --git a/src/lib/components/LoginModal.svelte b/src/lib/components/LoginModal.svelte new file mode 100644 index 0000000000000000000000000000000000000000..79a6a30ab45a338e8b376cacbd40a005ac771007 --- /dev/null +++ b/src/lib/components/LoginModal.svelte @@ -0,0 +1,72 @@ +<script lang="ts"> + import { browser } from "$app/environment"; + import { base } from "$app/paths"; + import { page } from "$app/stores"; + import { PUBLIC_APP_DATA_SHARING, PUBLIC_APP_NAME, PUBLIC_VERSION } from "$env/static/public"; + import LogoHuggingFaceBorderless from "$lib/components/icons/LogoHuggingFaceBorderless.svelte"; + import Modal from "$lib/components/Modal.svelte"; + import type { LayoutData } from "../../routes/$types"; + import Logo from "./icons/Logo.svelte"; + export let settings: LayoutData["settings"]; + + const isIframe = browser && window.self !== window.parent; +</script> + +<Modal> + <div + class="flex w-full flex-col items-center gap-6 bg-gradient-to-t from-primary-500/40 via-primary-500/10 to-primary-500/0 px-4 pb-10 pt-9 text-center " + > + <h2 class="flex items-center text-2xl font-semibold text-gray-800"> + <Logo classNames="mr-1" /> + {PUBLIC_APP_NAME} + <div + class="ml-3 flex h-6 items-center rounded-lg border border-gray-100 bg-gray-50 px-2 text-base text-gray-400" + > + v{PUBLIC_VERSION} + </div> + </h2> + <p class="px-4 text-lg font-semibold leading-snug text-gray-800 sm:px-12"> + This application is for demonstration purposes only. + </p> + <p class="text-base text-gray-800"> + AI is an area of active research with known problems such as biased generation and + misinformation. Do not use this application for high-stakes decisions or advice. + </p> + {#if PUBLIC_APP_DATA_SHARING} + <p class="px-2 text-sm text-gray-500"> + Your conversations will be shared with model authors unless you disable it from your + settings. + </p> + {/if} + <form + action="{base}/{$page.data.requiresLogin ? 'login' : 'settings'}" + target={isIframe ? "_blank" : ""} + method="POST" + class="flex w-full flex-col items-center gap-2" + > + {#if $page.data.requiresLogin} + <button + type="submit" + class="mt-2 flex items-center whitespace-nowrap rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-primary-500" + > + Sign in + {#if PUBLIC_APP_NAME === "HuggingChat"} + with <LogoHuggingFaceBorderless classNames="text-xl mr-1 ml-1.5" /> Hugging Face + {/if} + </button> + <p class="mt-2 px-2 text-sm text-gray-500">to start chatting right away</p> + {:else} + <input type="hidden" name="ethicsModalAccepted" value={true} /> + {#each Object.entries(settings) as [key, val]} + <input type="hidden" name={key} value={val} /> + {/each} + <button + type="submit" + class="mt-2 rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-primary-500" + > + Start chatting + </button> + {/if} + </form> + </div> +</Modal> diff --git a/src/lib/components/MobileNav.svelte b/src/lib/components/MobileNav.svelte new file mode 100644 index 0000000000000000000000000000000000000000..7225e83dcbadc2229cf76e0b024a346368cec43b --- /dev/null +++ b/src/lib/components/MobileNav.svelte @@ -0,0 +1,62 @@ +<script lang="ts"> + import { navigating } from "$app/stores"; + import { createEventDispatcher } from "svelte"; + import { browser } from "$app/environment"; + import { base } from "$app/paths"; + + import CarbonClose from "~icons/carbon/close"; + import CarbonAdd from "~icons/carbon/add"; + import CarbonTextAlignJustify from "~icons/carbon/text-align-justify"; + + export let isOpen = false; + export let title: string | undefined; + + $: title = title || "New Chat"; + + let closeEl: HTMLButtonElement; + let openEl: HTMLButtonElement; + + const dispatch = createEventDispatcher(); + + $: if ($navigating) { + dispatch("toggle", false); + } + + $: if (isOpen && closeEl) { + closeEl.focus(); + } else if (!isOpen && browser && document.activeElement === closeEl) { + openEl.focus(); + } +</script> + +<nav + class="flex h-12 items-center justify-between border-b bg-gray-50 px-4 dark:border-gray-800 dark:bg-gray-800/70 md:hidden" +> + <button + type="button" + class="-ml-3 flex h-9 w-9 shrink-0 items-center justify-center" + on:click={() => dispatch("toggle", true)} + aria-label="Open menu" + bind:this={openEl}><CarbonTextAlignJustify /></button + > + <span class="truncate px-4">{title}</span> + <a href={`${base}/`} class="-mr-3 flex h-9 w-9 shrink-0 items-center justify-center" + ><CarbonAdd /></a + > +</nav> +<nav + class="fixed inset-0 z-30 grid max-h-screen grid-cols-1 grid-rows-[auto,auto,1fr,auto] bg-white bg-gradient-to-l from-gray-50 dark:bg-gray-900 dark:from-gray-800/30 {isOpen + ? 'block' + : 'hidden'}" +> + <div class="flex h-12 items-center px-4"> + <button + type="button" + class="-mr-3 ml-auto flex h-9 w-9 items-center justify-center" + on:click={() => dispatch("toggle", false)} + aria-label="Close menu" + bind:this={closeEl}><CarbonClose /></button + > + </div> + <slot /> +</nav> diff --git a/src/lib/components/Modal.svelte b/src/lib/components/Modal.svelte new file mode 100644 index 0000000000000000000000000000000000000000..c161ad33088cdfd69326156c910e73579ce3b244 --- /dev/null +++ b/src/lib/components/Modal.svelte @@ -0,0 +1,62 @@ +<script lang="ts"> + import { createEventDispatcher, onDestroy, onMount } from "svelte"; + import { cubicOut } from "svelte/easing"; + import { fade } from "svelte/transition"; + import Portal from "./Portal.svelte"; + import { browser } from "$app/environment"; + + export let width = "max-w-sm"; + + let backdropEl: HTMLDivElement; + let modalEl: HTMLDivElement; + + const dispatch = createEventDispatcher<{ close: void }>(); + + function handleKeydown(event: KeyboardEvent) { + // close on ESC + if (event.key === "Escape") { + event.preventDefault(); + dispatch("close"); + } + } + + function handleBackdropClick(event: MouseEvent) { + if (event.target === backdropEl) { + dispatch("close"); + } + } + + onMount(() => { + document.getElementById("app")?.setAttribute("inert", "true"); + modalEl.focus(); + }); + + onDestroy(() => { + if (!browser) return; + // remove inert attribute if this is the last modal + if (document.querySelectorAll('[role="dialog"]:not(#app *)').length === 1) { + document.getElementById("app")?.removeAttribute("inert"); + } + }); +</script> + +<Portal> + <div + role="presentation" + tabindex="-1" + bind:this={backdropEl} + on:click={handleBackdropClick} + transition:fade={{ easing: cubicOut, duration: 300 }} + class="fixed inset-0 z-40 flex items-center justify-center bg-black/80 p-8 backdrop-blur-sm dark:bg-black/50" + > + <div + role="dialog" + tabindex="-1" + bind:this={modalEl} + on:keydown={handleKeydown} + class="-mt-10 overflow-hidden rounded-2xl bg-white shadow-2xl outline-none md:-mt-20 {width}" + > + <slot /> + </div> + </div> +</Portal> diff --git a/src/lib/components/ModelCardMetadata.svelte b/src/lib/components/ModelCardMetadata.svelte new file mode 100644 index 0000000000000000000000000000000000000000..2576a95f59649ee9817b262eea62b0e20da1a802 --- /dev/null +++ b/src/lib/components/ModelCardMetadata.svelte @@ -0,0 +1,48 @@ +<script lang="ts"> + import CarbonEarth from "~icons/carbon/earth"; + import CarbonArrowUpRight from "~icons/carbon/arrow-up-right"; + import type { Model } from "$lib/types/Model"; + + export let model: Pick<Model, "name" | "datasetName" | "websiteUrl">; + + export let variant: "light" | "dark" = "light"; +</script> + +<div + class="flex items-center gap-5 rounded-xl bg-gray-100 px-3 py-2 text-sm + {variant === 'dark' + ? 'text-gray-600 dark:bg-gray-800 dark:text-gray-300' + : 'text-gray-800 dark:bg-gray-100 dark:text-gray-600'}" +> + <a + href="https://huggingface.co/{model.name}" + target="_blank" + rel="noreferrer" + class="flex items-center hover:underline" + ><CarbonArrowUpRight class="mr-1.5 shrink-0 text-xs text-gray-400" /> + Model + <div class="max-sm:hidden"> page</div></a + > + {#if model.datasetName} + <a + href="https://huggingface.co/datasets/{model.datasetName}" + target="_blank" + rel="noreferrer" + class="flex items-center hover:underline" + ><CarbonArrowUpRight class="mr-1.5 shrink-0 text-xs text-gray-400" /> + Dataset + <div class="max-sm:hidden"> page</div></a + > + {/if} + {#if model.websiteUrl} + <a + href={model.websiteUrl} + target="_blank" + class="ml-auto flex items-center hover:underline" + rel="noreferrer" + > + <CarbonEarth class="mr-1.5 shrink-0 text-xs text-gray-400" /> + Website + </a> + {/if} +</div> diff --git a/src/lib/components/ModelsModal.svelte b/src/lib/components/ModelsModal.svelte new file mode 100644 index 0000000000000000000000000000000000000000..a1ef83c26fb155f48a4f60642401aab3ef234637 --- /dev/null +++ b/src/lib/components/ModelsModal.svelte @@ -0,0 +1,80 @@ +<script lang="ts"> + import { createEventDispatcher } from "svelte"; + + import Modal from "$lib/components/Modal.svelte"; + import CarbonClose from "~icons/carbon/close"; + import CarbonCheckmark from "~icons/carbon/checkmark-filled"; + import ModelCardMetadata from "./ModelCardMetadata.svelte"; + import type { Model } from "$lib/types/Model"; + import type { LayoutData } from "../../routes/$types"; + import { enhance } from "$app/forms"; + import { base } from "$app/paths"; + + export let settings: LayoutData["settings"]; + export let models: Array<Model>; + + let selectedModelId = settings.activeModel; + + const dispatch = createEventDispatcher<{ close: void }>(); +</script> + +<Modal width="max-w-lg" on:close> + <form + action="{base}/settings" + method="post" + use:enhance={() => { + dispatch("close"); + }} + class="flex w-full flex-col gap-5 p-6" + > + {#each Object.entries(settings).filter(([k]) => k !== "activeModel") as [key, val]} + <input type="hidden" name={key} value={val} /> + {/each} + <div class="flex items-start justify-between text-xl font-semibold text-gray-800"> + <h2>Models</h2> + <button type="button" class="group" on:click={() => dispatch("close")}> + <CarbonClose class="text-gray-900 group-hover:text-gray-500" /> + </button> + </div> + + <div class="space-y-4"> + {#each models as model} + <div + class="rounded-xl border border-gray-100 {model.id === selectedModelId + ? 'bg-gradient-to-r from-primary-200/40 via-primary-500/10' + : ''}" + > + <label class="group flex cursor-pointer p-3" on:change aria-label={model.displayName}> + <input + type="radio" + class="sr-only" + name="activeModel" + value={model.id} + bind:group={selectedModelId} + /> + <span> + <span class="text-md block font-semibold leading-tight text-gray-800" + >{model.displayName}</span + > + {#if model.description} + <span class="text-xs text-[#9FA8B5]">{model.description}</span> + {/if} + </span> + <CarbonCheckmark + class="-mr-1 -mt-1 ml-auto shrink-0 text-xl {model.id === selectedModelId + ? 'text-primary-400' + : 'text-transparent group-hover:text-gray-200'}" + /> + </label> + <ModelCardMetadata {model} /> + </div> + {/each} + </div> + <button + type="submit" + class="mt-2 rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 ring-gray-400 ring-offset-1 transition-colors hover:ring" + > + Apply + </button> + </form> +</Modal> diff --git a/src/lib/components/NavConversationItem.svelte b/src/lib/components/NavConversationItem.svelte new file mode 100644 index 0000000000000000000000000000000000000000..380dabc34ef4d7c939c7f2c39cb7787450f4f950 --- /dev/null +++ b/src/lib/components/NavConversationItem.svelte @@ -0,0 +1,87 @@ +<script lang="ts"> + import { base } from "$app/paths"; + import { page } from "$app/stores"; + import { createEventDispatcher } from "svelte"; + + import CarbonCheckmark from "~icons/carbon/checkmark"; + import CarbonTrashCan from "~icons/carbon/trash-can"; + import CarbonClose from "~icons/carbon/close"; + import CarbonEdit from "~icons/carbon/edit"; + + export let conv: { id: string; title: string }; + + let confirmDelete = false; + + const dispatch = createEventDispatcher<{ + deleteConversation: string; + editConversationTitle: { id: string; title: string }; + }>(); +</script> + +<a + data-sveltekit-noscroll + on:mouseleave={() => { + confirmDelete = false; + }} + href="{base}/conversation/{conv.id}" + class="group flex h-11 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700 {conv.id === + $page.params.id + ? 'bg-gray-100 dark:bg-gray-700' + : ''}" +> + <div class="flex-1 truncate"> + {#if confirmDelete} + <span class="font-semibold"> Delete </span> + {/if} + {conv.title} + </div> + + {#if confirmDelete} + <button + type="button" + class="flex h-5 w-5 items-center justify-center rounded md:hidden md:group-hover:flex" + title="Confirm delete action" + on:click|preventDefault={() => dispatch("deleteConversation", conv.id)} + > + <CarbonCheckmark class="text-xs text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" /> + </button> + <button + type="button" + class="flex h-5 w-5 items-center justify-center rounded md:hidden md:group-hover:flex" + title="Cancel delete action" + on:click|preventDefault={() => { + confirmDelete = false; + }} + > + <CarbonClose class="text-xs text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" /> + </button> + {:else} + <button + type="button" + class="flex h-5 w-5 items-center justify-center rounded md:hidden md:group-hover:flex" + title="Edit conversation title" + on:click|preventDefault={() => { + const newTitle = prompt("Edit this conversation title:", conv.title); + if (!newTitle) return; + dispatch("editConversationTitle", { id: conv.id, title: newTitle }); + }} + > + <CarbonEdit class="text-xs text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" /> + </button> + + <button + type="button" + class="flex h-5 w-5 items-center justify-center rounded md:hidden md:group-hover:flex" + title="Delete conversation" + on:click|preventDefault={(event) => { + if (event.shiftKey) { + dispatch("deleteConversation", conv.id); + } else { + confirmDelete = true; + } + }} + > + <CarbonTrashCan class="text-xs text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" /> + </button> + {/if} +</a> diff --git a/src/lib/components/NavMenu.svelte b/src/lib/components/NavMenu.svelte new file mode 100644 index 0000000000000000000000000000000000000000..b44667b2363d3e7ea0b52d80aee0e0cf450aa9ef --- /dev/null +++ b/src/lib/components/NavMenu.svelte @@ -0,0 +1,94 @@ +<script lang="ts"> + import { base } from "$app/paths"; + import { createEventDispatcher } from "svelte"; + + import Logo from "$lib/components/icons/Logo.svelte"; + import { switchTheme } from "$lib/switchTheme"; + import { PUBLIC_APP_NAME, PUBLIC_ORIGIN } from "$env/static/public"; + import NavConversationItem from "./NavConversationItem.svelte"; + import type { LayoutData } from "../../routes/$types"; + + const dispatch = createEventDispatcher<{ + shareConversation: { id: string; title: string }; + clickSettings: void; + clickLogout: void; + }>(); + + export let conversations: Array<{ + id: string; + title: string; + }> = []; + export let user: LayoutData["user"]; +</script> + +<div class="sticky top-0 flex flex-none items-center justify-between px-3 py-3.5 max-sm:pt-0"> + <a class="flex items-center rounded-xl text-lg font-semibold" href="{PUBLIC_ORIGIN}{base}/"> + <Logo classNames="mr-1" /> + {PUBLIC_APP_NAME} + </a> + <a + href={`${base}/`} + class="flex rounded-lg border bg-white px-2 py-0.5 text-center shadow-sm hover:shadow-none dark:border-gray-600 dark:bg-gray-700" + > + New Chat + </a> +</div> +<div + class="scrollbar-custom flex flex-col gap-1 overflow-y-auto rounded-r-xl bg-gradient-to-l from-gray-50 px-3 pb-3 pt-2 dark:from-gray-800/30" +> + {#each conversations as conv (conv.id)} + <NavConversationItem on:editConversationTitle on:deleteConversation {conv} /> + {/each} +</div> +<div + class="mt-0.5 flex flex-col gap-1 rounded-r-xl bg-gradient-to-l from-gray-50 p-3 text-sm dark:from-gray-800/30" +> + {#if user?.username || user?.email} + <form + action="{base}/logout" + method="post" + class="group flex items-center gap-1.5 rounded-lg pl-3 pr-2 hover:bg-gray-100 dark:hover:bg-gray-700" + > + <span + class="flex h-9 flex-none shrink items-center gap-1.5 truncate pr-2 text-gray-500 dark:text-gray-400" + >{user?.username || user?.email}</span + > + <button + type="submit" + class="ml-auto h-6 flex-none items-center gap-1.5 rounded-md border bg-white px-2 text-gray-700 shadow-sm group-hover:flex hover:shadow-none dark:border-gray-600 dark:bg-gray-600 dark:text-gray-400 dark:hover:text-gray-300 md:hidden" + > + Sign Out + </button> + </form> + {/if} + <button + on:click={switchTheme} + type="button" + class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700" + > + Theme + </button> + <button + on:click={() => dispatch("clickSettings")} + type="button" + class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700" + > + Settings + </button> + {#if PUBLIC_APP_NAME === "HuggingChat"} + <a + href="https://huggingface.co/spaces/huggingchat/chat-ui/discussions" + target="_blank" + rel="noreferrer" + class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700" + > + Feedback + </a> + <a + href="{base}/privacy" + class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700" + > + About & Privacy + </a> + {/if} +</div> diff --git a/src/lib/components/OpenWebSearchResults.svelte b/src/lib/components/OpenWebSearchResults.svelte new file mode 100644 index 0000000000000000000000000000000000000000..8b74b8af074d15a39ec4e6f7eddad62226596fb6 --- /dev/null +++ b/src/lib/components/OpenWebSearchResults.svelte @@ -0,0 +1,114 @@ +<script lang="ts"> + import type { WebSearchMessage } from "$lib/types/WebSearch"; + import CarbonCaretRight from "~icons/carbon/caret-right"; + + import CarbonCheckmark from "~icons/carbon/checkmark-filled"; + import CarbonError from "~icons/carbon/error-filled"; + + import EosIconsLoading from "~icons/eos-icons/loading"; + + export let loading = false; + export let classNames = ""; + export let webSearchMessages: WebSearchMessage[] = []; + + let detailsOpen: boolean; + let error: boolean; + $: error = webSearchMessages.some((message) => message.type === "error"); +</script> + +<details + class="flex w-fit rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900 {classNames} max-w-full" + bind:open={detailsOpen} +> + <summary + class="align-center flex cursor-pointer select-none list-none py-1 pl-2.5 pr-2 align-text-top transition-all" + > + {#if error} + <CarbonError class="my-auto text-red-700 dark:text-red-500" /> + {:else if loading} + <EosIconsLoading class="my-auto text-gray-500" /> + {:else} + <CarbonCheckmark class="my-auto text-gray-500" /> + {/if} + <span class="px-2 font-medium" class:text-red-700={error} class:dark:text-red-500={error} + >Web search + </span> + <div class="my-auto transition-all" class:rotate-90={detailsOpen}> + <CarbonCaretRight /> + </div> + </summary> + + <div class="content px-5 pb-5 pt-4"> + {#if webSearchMessages.length === 0} + <div class="mx-auto w-fit"> + <EosIconsLoading class="mb-3 h-4 w-4" /> + </div> + {:else} + <ol> + {#each webSearchMessages as message} + {#if message.type === "update"} + <li class="group border-l pb-6 last:!border-transparent last:pb-0 dark:border-gray-800"> + <div class="flex items-start"> + <div + class="-ml-1.5 h-3 w-3 flex-none rounded-full bg-gray-200 dark:bg-gray-600 {loading + ? 'group-last:animate-pulse group-last:bg-gray-300 group-last:dark:bg-gray-500' + : ''}" + /> + <h3 class="text-md -mt-1.5 pl-2.5 text-gray-800 dark:text-gray-100"> + {message.message} + </h3> + </div> + {#if message.args} + <p class="mt-1.5 pl-4 text-gray-500 dark:text-gray-400"> + {message.args} + </p> + {/if} + </li> + {:else if message.type === "error"} + <li class="group border-l pb-6 last:!border-transparent last:pb-0 dark:border-gray-800"> + <div class="flex items-start"> + <CarbonError + class="-ml-1.5 h-3 w-3 flex-none scale-110 text-red-700 dark:text-red-500" + /> + <h3 class="text-md -mt-1.5 pl-2.5 text-red-700 dark:text-red-500"> + {message.message} + </h3> + </div> + {#if message.args} + <p class="mt-1.5 pl-4 text-gray-500 dark:text-gray-400"> + {message.args} + </p> + {/if} + </li> + {/if} + {/each} + </ol> + {/if} + </div> +</details> + +<style> + @keyframes grow { + 0% { + font-size: 0; + opacity: 0; + } + 30% { + font-size: 1em; + opacity: 0; + } + 100% { + opacity: 1; + } + } + + details[open] .content { + animation-name: grow; + animation-duration: 300ms; + animation-delay: 0ms; + } + + details summary::-webkit-details-marker { + display: none; + } +</style> diff --git a/src/lib/components/Portal.svelte b/src/lib/components/Portal.svelte new file mode 100644 index 0000000000000000000000000000000000000000..dad285ed6bd7317f94c4e6152bf6c076ecbc52b5 --- /dev/null +++ b/src/lib/components/Portal.svelte @@ -0,0 +1,19 @@ +<script lang="ts"> + import { onMount, onDestroy } from "svelte"; + + let el: HTMLElement; + + onMount(() => { + el.ownerDocument.body.appendChild(el); + }); + + onDestroy(() => { + if (el?.parentNode) { + el.parentNode.removeChild(el); + } + }); +</script> + +<div bind:this={el} class="contents" hidden> + <slot /> +</div> diff --git a/src/lib/components/ScrollToBottomBtn.svelte b/src/lib/components/ScrollToBottomBtn.svelte new file mode 100644 index 0000000000000000000000000000000000000000..07e1d985def7d9e1fa2e4edd93c104c47b23b178 --- /dev/null +++ b/src/lib/components/ScrollToBottomBtn.svelte @@ -0,0 +1,46 @@ +<script lang="ts"> + import { fade } from "svelte/transition"; + import { onDestroy } from "svelte"; + import IconChevron from "./icons/IconChevron.svelte"; + + export let scrollNode: HTMLElement; + export { className as class }; + + let visible = false; + let className = ""; + let observer: ResizeObserver | null = null; + + $: if (scrollNode) { + destroy(); + + if (window.ResizeObserver) { + observer = new ResizeObserver(() => { + updateVisibility(); + }); + observer.observe(scrollNode); + } + scrollNode.addEventListener("scroll", updateVisibility); + } + + function updateVisibility() { + if (!scrollNode) return; + visible = + Math.ceil(scrollNode.scrollTop) + 200 < scrollNode.scrollHeight - scrollNode.clientHeight; + } + + function destroy() { + observer?.disconnect(); + scrollNode?.removeEventListener("scroll", updateVisibility); + } + + onDestroy(destroy); +</script> + +{#if visible} + <button + transition:fade|local={{ duration: 150 }} + on:click={() => scrollNode.scrollTo({ top: scrollNode.scrollHeight, behavior: "smooth" })} + class="btn absolute flex h-[41px] w-[41px] rounded-full border bg-white shadow-md transition-all hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-700 dark:shadow-gray-950 dark:hover:bg-gray-600 {className}" + ><IconChevron classNames="mt-[2px]" /></button + > +{/if} diff --git a/src/lib/components/SettingsModal.svelte b/src/lib/components/SettingsModal.svelte new file mode 100644 index 0000000000000000000000000000000000000000..d23a655d259d0600ab7ee85a8ae834c299f414cf --- /dev/null +++ b/src/lib/components/SettingsModal.svelte @@ -0,0 +1,111 @@ +<script lang="ts"> + import { createEventDispatcher } from "svelte"; + + import Modal from "$lib/components/Modal.svelte"; + import CarbonClose from "~icons/carbon/close"; + import Switch from "$lib/components/Switch.svelte"; + import type { Settings } from "$lib/types/Settings"; + import { enhance } from "$app/forms"; + import { base } from "$app/paths"; + import { PUBLIC_APP_DATA_SHARING } from "$env/static/public"; + + export let settings: Pick<Settings, "shareConversationsWithModelAuthors">; + + let shareConversationsWithModelAuthors = settings.shareConversationsWithModelAuthors; + let isConfirmingDeletion = false; + + const dispatch = createEventDispatcher<{ close: void }>(); +</script> + +<Modal on:close> + <div class="flex w-full flex-col gap-5 p-6"> + <div class="flex items-start justify-between text-xl font-semibold text-gray-800"> + <h2>Settings</h2> + <button type="button" class="group" on:click={() => dispatch("close")}> + <CarbonClose class="text-gray-900 group-hover:text-gray-500" /> + </button> + </div> + <form + class="flex flex-col gap-5" + use:enhance={() => { + dispatch("close"); + }} + method="post" + action="{base}/settings" + > + {#if PUBLIC_APP_DATA_SHARING} + <label class="flex cursor-pointer select-none items-center gap-2 text-gray-500"> + {#each Object.entries(settings).filter(([k]) => k !== "shareConversationsWithModelAuthors") as [key, val]} + <input type="hidden" name={key} value={val} /> + {/each} + <Switch + name="shareConversationsWithModelAuthors" + bind:checked={shareConversationsWithModelAuthors} + /> + Share conversations with model authors + </label> + + <p class="text-gray-800"> + Sharing your data will help improve the training data and make open models better over + time. + </p> + <p class="text-gray-800"> + You can change this setting at any time, it applies to all your conversations. + </p> + <p class="text-gray-800"> + Read more about this model's authors, + <a + href="https://open-assistant.io/" + target="_blank" + rel="noreferrer" + class="underline decoration-gray-300 hover:decoration-gray-700">Open Assistant</a + >. + </p> + {/if} + <form + method="post" + action="{base}/conversations?/delete" + on:submit|preventDefault={() => (isConfirmingDeletion = true)} + > + <button type="submit" class="underline decoration-gray-300 hover:decoration-gray-700"> + Delete all conversations + </button> + </form> + <button + type="submit" + class="mt-2 rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 ring-gray-400 ring-offset-1 transition-all focus-visible:outline-none focus-visible:ring hover:ring" + > + Apply + </button> + </form> + + {#if isConfirmingDeletion} + <Modal on:close={() => (isConfirmingDeletion = false)}> + <form + use:enhance={() => { + dispatch("close"); + }} + method="post" + action="{base}/conversations?/delete" + class="flex w-full flex-col gap-5 p-6" + > + <div class="flex items-start justify-between text-xl font-semibold text-gray-800"> + <h2>Are you sure?</h2> + <button type="button" class="group" on:click={() => (isConfirmingDeletion = false)}> + <CarbonClose class="text-gray-900 group-hover:text-gray-500" /> + </button> + </div> + <p class="text-gray-800"> + This action will delete all your conversations. This cannot be undone. + </p> + <button + type="submit" + class="mt-2 rounded-full bg-red-700 px-5 py-2 text-lg font-semibold text-gray-100 ring-gray-400 ring-offset-1 transition-all focus-visible:outline-none focus-visible:ring hover:ring" + > + Confirm deletion + </button> + </form> + </Modal> + {/if} + </div> +</Modal> diff --git a/src/lib/components/StopGeneratingBtn.svelte b/src/lib/components/StopGeneratingBtn.svelte new file mode 100644 index 0000000000000000000000000000000000000000..fd29e9c12e7d09db7fc59f7df3b6d914dda37326 --- /dev/null +++ b/src/lib/components/StopGeneratingBtn.svelte @@ -0,0 +1,13 @@ +<script lang="ts"> + import CarbonStopFilledAlt from "~icons/carbon/stop-filled-alt"; + + export let classNames = ""; +</script> + +<button + type="button" + on:click + class="btn flex h-9 rounded-lg border bg-white px-3 py-1 shadow-sm transition-all hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-700 dark:hover:bg-gray-600 {classNames}" +> + <CarbonStopFilledAlt class="-ml-1 mr-1 h-[1.25rem] w-[1.1875rem] text-gray-400" /> Stop generating +</button> diff --git a/src/lib/components/Switch.svelte b/src/lib/components/Switch.svelte new file mode 100644 index 0000000000000000000000000000000000000000..013bde8dff2a538b8d3df1d6f409bb02295b9c43 --- /dev/null +++ b/src/lib/components/Switch.svelte @@ -0,0 +1,13 @@ +<script lang="ts"> + export let checked: boolean; + export let name: string; +</script> + +<input bind:checked type="checkbox" {name} class="peer pointer-events-none absolute opacity-0" /> +<div + on:click + on:keypress + class="relative inline-flex h-5 w-9 shrink-0 items-center rounded-full bg-gray-300 p-1 shadow-inner ring-gray-400 transition-all peer-checked:bg-blue-600 peer-focus-visible:ring peer-focus-visible:ring-offset-1 hover:bg-gray-400 dark:bg-gray-600 peer-checked:[&>div]:translate-x-3.5" +> + <div class="h-3.5 w-3.5 rounded-full bg-white shadow-sm transition-all" /> +</div> diff --git a/src/lib/components/Toast.svelte b/src/lib/components/Toast.svelte new file mode 100644 index 0000000000000000000000000000000000000000..2470d358ae52406fbedeb43cbf8e1dacd09c5aec --- /dev/null +++ b/src/lib/components/Toast.svelte @@ -0,0 +1,19 @@ +<script lang="ts"> + import { fade } from "svelte/transition"; + + import IconDazzled from "$lib/components/icons/IconDazzled.svelte"; + + export let message = ""; +</script> + +<div + transition:fade={{ duration: 300 }} + class="pointer-events-none fixed right-0 top-12 z-20 bg-gradient-to-bl from-red-500/20 via-red-500/0 to-red-500/0 pb-36 pl-36 pr-2 pt-2 md:top-0 md:pr-8 md:pt-5" +> + <div + class="pointer-events-auto flex items-center rounded-full bg-white/90 px-3 py-1 shadow-sm dark:bg-gray-900/80" + > + <IconDazzled classNames="text-2xl mr-2" /> + <h2 class="font-semibold">{message}</h2> + </div> +</div> diff --git a/src/lib/components/Tooltip.svelte b/src/lib/components/Tooltip.svelte new file mode 100644 index 0000000000000000000000000000000000000000..0caf14d5edb956e14c686c68b588c1e984ee42a6 --- /dev/null +++ b/src/lib/components/Tooltip.svelte @@ -0,0 +1,22 @@ +<script lang="ts"> + export let classNames = ""; + export let label = "Copied"; + export let position = "left-1/2 top-full transform -translate-x-1/2 translate-y-2"; +</script> + +<div + class=" + pointer-events-none absolute rounded bg-black px-2 py-1 font-normal leading-tight text-white shadow transition-opacity + {position} + {classNames} + " +> + <div + class="absolute bottom-full left-1/2 h-0 w-0 -translate-x-1/2 transform border-4 border-t-0 border-black" + style=" + border-left-color: transparent; + border-right-color: transparent; + " + /> + {label} +</div> diff --git a/src/lib/components/WebSearchToggle.svelte b/src/lib/components/WebSearchToggle.svelte new file mode 100644 index 0000000000000000000000000000000000000000..66295e7637c1a6c573ff26e260c9cf58948b4421 --- /dev/null +++ b/src/lib/components/WebSearchToggle.svelte @@ -0,0 +1,27 @@ +<script lang="ts"> + import { webSearchParameters } from "$lib/stores/webSearchParameters"; + import CarbonInformation from "~icons/carbon/information"; + import Switch from "./Switch.svelte"; + + const toggle = () => ($webSearchParameters.useSearch = !$webSearchParameters.useSearch); +</script> + +<div + class="flex h-9 cursor-pointer select-none items-center gap-2 rounded-xl border bg-white p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 dark:bg-gray-900" + on:click={toggle} + on:keypress={toggle} +> + <Switch name="useSearch" bind:checked={$webSearchParameters.useSearch} on:click on:keypress /> + <div class="whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">Search web</div> + <div class="group relative w-max"> + <CarbonInformation class="text-xs text-gray-500" /> + <div + class="pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800" + > + <p class="max-w-sm text-sm text-gray-800 dark:text-gray-200"> + When enabled, the model will try to complement its answer with information queried from the + web. + </p> + </div> + </div> +</div> diff --git a/src/lib/components/chat/ChatInput.svelte b/src/lib/components/chat/ChatInput.svelte new file mode 100644 index 0000000000000000000000000000000000000000..6ceb9f4a7e119ea173b8466d8ae4353351ba4a94 --- /dev/null +++ b/src/lib/components/chat/ChatInput.svelte @@ -0,0 +1,65 @@ +<script lang="ts"> + import { createEventDispatcher, onMount } from "svelte"; + + export let value = ""; + export let minRows = 1; + export let maxRows: null | number = null; + export let placeholder = ""; + export let disabled = false; + + // Approximate width from which we disable autofocus + const TABLET_VIEWPORT_WIDTH = 768; + + let innerWidth = 0; + let textareaElement: HTMLTextAreaElement; + + const dispatch = createEventDispatcher<{ submit: void }>(); + + $: minHeight = `${1 + minRows * 1.5}em`; + $: maxHeight = maxRows ? `${1 + maxRows * 1.5}em` : `auto`; + + function handleKeydown(event: KeyboardEvent) { + // submit on enter + if (event.key === "Enter" && !event.shiftKey) { + event.preventDefault(); + dispatch("submit"); // use a custom event instead of `event.target.form.requestSubmit()` as it does not work on Safari 14 + } + } + + onMount(() => { + if (innerWidth > TABLET_VIEWPORT_WIDTH) { + textareaElement.focus(); + } + }); +</script> + +<svelte:window bind:innerWidth /> + +<div class="relative min-w-0 flex-1"> + <pre + class="scrollbar-custom invisible overflow-x-hidden overflow-y-scroll whitespace-pre-wrap break-words p-3" + aria-hidden="true" + style="min-height: {minHeight}; max-height: {maxHeight}">{(value || " ") + "\n"}</pre> + + <textarea + enterkeyhint="send" + tabindex="0" + rows="1" + class="scrollbar-custom absolute top-0 m-0 h-full w-full resize-none scroll-p-3 overflow-x-hidden overflow-y-scroll border-0 bg-transparent p-3 outline-none focus:ring-0 focus-visible:ring-0" + bind:value + bind:this={textareaElement} + {disabled} + on:keydown={handleKeydown} + on:keypress + {placeholder} + /> +</div> + +<style> + pre, + textarea { + font-family: inherit; + box-sizing: border-box; + line-height: 1.5; + } +</style> diff --git a/src/lib/components/chat/ChatIntroduction.svelte b/src/lib/components/chat/ChatIntroduction.svelte new file mode 100644 index 0000000000000000000000000000000000000000..d301e617054a01746410d3d7447e1b3c81c5d1ab --- /dev/null +++ b/src/lib/components/chat/ChatIntroduction.svelte @@ -0,0 +1,95 @@ +<script lang="ts"> + import { PUBLIC_APP_NAME, PUBLIC_VERSION } from "$env/static/public"; + import { PUBLIC_ANNOUNCEMENT_BANNERS } from "$env/static/public"; + import Logo from "$lib/components/icons/Logo.svelte"; + import { createEventDispatcher } from "svelte"; + import IconChevron from "$lib/components/icons/IconChevron.svelte"; + import CarbonArrowUpRight from "~icons/carbon/arrow-up-right"; + import AnnouncementBanner from "../AnnouncementBanner.svelte"; + import ModelsModal from "../ModelsModal.svelte"; + import type { Model } from "$lib/types/Model"; + import ModelCardMetadata from "../ModelCardMetadata.svelte"; + import type { LayoutData } from "../../../routes/$types"; + import { findCurrentModel } from "$lib/utils/models"; + + export let currentModel: Model; + export let settings: LayoutData["settings"]; + export let models: Model[]; + + let isModelsModalOpen = false; + + $: currentModelMetadata = findCurrentModel(models, settings.activeModel); + + const announcementBanners = PUBLIC_ANNOUNCEMENT_BANNERS + ? JSON.parse(PUBLIC_ANNOUNCEMENT_BANNERS) + : []; + + const dispatch = createEventDispatcher<{ message: string }>(); +</script> + +<div class="my-auto grid gap-8 lg:grid-cols-3"> + <div class="lg:col-span-1"> + <div> + <div class="mb-3 flex items-center text-2xl font-semibold"> + <Logo classNames="mr-1 flex-none" /> + {PUBLIC_APP_NAME} + <div + class="ml-3 flex h-6 items-center rounded-lg border border-gray-100 bg-gray-50 px-2 text-base text-gray-400 dark:border-gray-700/60 dark:bg-gray-800" + > + v{PUBLIC_VERSION} + </div> + </div> + <p class="text-base text-gray-600 dark:text-gray-400"> + Making the community's best AI chat models available to everyone. + </p> + </div> + </div> + <div class="lg:col-span-2 lg:pl-24"> + {#each announcementBanners as banner} + <AnnouncementBanner classNames="mb-4" title={banner.title}> + <a + target="_blank" + href={banner.linkHref} + class="mr-2 flex items-center underline hover:no-underline" + ><CarbonArrowUpRight class="mr-1.5 text-xs" /> {banner.linkTitle}</a + > + </AnnouncementBanner> + {/each} + + {#if isModelsModalOpen} + <ModelsModal {settings} {models} on:close={() => (isModelsModalOpen = false)} /> + {/if} + <div class="overflow-hidden rounded-xl border dark:border-gray-800"> + <div class="flex p-3"> + <div> + <div class="text-sm text-gray-600 dark:text-gray-400">Current Model</div> + <div class="font-semibold">{currentModel.displayName}</div> + </div> + {#if models.length > 1} + <button + type="button" + on:click={() => (isModelsModalOpen = true)} + class="btn ml-auto flex h-7 w-7 self-start rounded-full bg-gray-100 p-1 text-xs hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:hover:bg-gray-600" + ><IconChevron /></button + > + {/if} + </div> + <ModelCardMetadata variant="dark" model={currentModel} /> + </div> + </div> + {#if currentModelMetadata.promptExamples} + <div class="lg:col-span-3 lg:mt-12"> + <p class="mb-3 text-gray-600 dark:text-gray-300">Examples</p> + <div class="grid gap-3 lg:grid-cols-3 lg:gap-5"> + {#each currentModelMetadata.promptExamples as example} + <button + type="button" + class="rounded-xl border bg-gray-50 p-2.5 text-gray-600 hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4" + on:click={() => dispatch("message", example.prompt)} + > + {example.title} + </button> + {/each} + </div> + </div>{/if} +</div> diff --git a/src/lib/components/chat/ChatMessage.svelte b/src/lib/components/chat/ChatMessage.svelte new file mode 100644 index 0000000000000000000000000000000000000000..f9c8dc835773ef0628a702d83f57ded6cb0ab272 --- /dev/null +++ b/src/lib/components/chat/ChatMessage.svelte @@ -0,0 +1,212 @@ +<script lang="ts"> + import { marked } from "marked"; + import type { Message } from "$lib/types/Message"; + import { afterUpdate, createEventDispatcher } from "svelte"; + import { deepestChild } from "$lib/utils/deepestChild"; + import { page } from "$app/stores"; + + import CodeBlock from "../CodeBlock.svelte"; + import IconLoading from "../icons/IconLoading.svelte"; + import CarbonRotate360 from "~icons/carbon/rotate-360"; + import CarbonDownload from "~icons/carbon/download"; + import CarbonThumbsUp from "~icons/carbon/thumbs-up"; + import CarbonThumbsDown from "~icons/carbon/thumbs-down"; + import { PUBLIC_SEP_TOKEN } from "$lib/constants/publicSepToken"; + import type { Model } from "$lib/types/Model"; + import type { WebSearchMessage } from "$lib/types/WebSearch"; + + import OpenWebSearchResults from "../OpenWebSearchResults.svelte"; + + function sanitizeMd(md: string) { + let ret = md + .replace(/<\|[a-z]*$/, "") + .replace(/<\|[a-z]+\|$/, "") + .replace(/<$/, "") + .replaceAll(PUBLIC_SEP_TOKEN, " ") + .replaceAll(/<\|[a-z]+\|>/g, " ") + .replaceAll(/<br\s?\/?>/gi, "\n") + .replaceAll("<", "<") + .trim(); + + for (const stop of [...(model.parameters?.stop ?? []), "<|endoftext|>"]) { + if (ret.endsWith(stop)) { + ret = ret.slice(0, -stop.length).trim(); + } + } + + return ret; + } + function unsanitizeMd(md: string) { + return md.replaceAll("<", "<"); + } + + export let model: Model; + export let message: Message; + export let loading = false; + export let isAuthor = true; + export let readOnly = false; + export let isTapped = false; + + export let webSearchMessages: WebSearchMessage[] = []; + + const dispatch = createEventDispatcher<{ + retry: { content: string; id: Message["id"] }; + vote: { score: Message["score"]; id: Message["id"] }; + }>(); + + let contentEl: HTMLElement; + let loadingEl: IconLoading; + let pendingTimeout: ReturnType<typeof setTimeout>; + + const renderer = new marked.Renderer(); + + // For code blocks with simple backticks + renderer.codespan = (code) => { + // Unsanitize double-sanitized code + return `<code>${code.replaceAll("&", "&")}</code>`; + }; + + const options: marked.MarkedOptions = { + ...marked.getDefaults(), + gfm: true, + breaks: true, + renderer, + }; + + $: tokens = marked.lexer(sanitizeMd(message.content)); + + afterUpdate(() => { + loadingEl?.$destroy(); + clearTimeout(pendingTimeout); + + // Add loading animation to the last message if update takes more than 600ms + if (loading) { + pendingTimeout = setTimeout(() => { + if (contentEl) { + loadingEl = new IconLoading({ + target: deepestChild(contentEl), + props: { classNames: "loading inline ml-2" }, + }); + } + }, 600); + } + }); + + $: downloadLink = + message.from === "user" ? `${$page.url.pathname}/message/${message.id}/prompt` : undefined; + + let webSearchIsDone = true; + + $: webSearchIsDone = + webSearchMessages.length > 0 && + webSearchMessages[webSearchMessages.length - 1].type === "result"; +</script> + +{#if message.from === "assistant"} + <div + class="group relative -mb-8 flex items-start justify-start gap-4 pb-8 leading-relaxed" + on:click={() => (isTapped = !isTapped)} + on:keypress={() => (isTapped = !isTapped)} + > + <img + alt="" + src="https://huggingface.co/avatars/2edb18bd0206c16b433841a47f53fa8e.svg" + class="mt-5 h-3 w-3 flex-none select-none rounded-full shadow-lg" + /> + <div + class="relative min-h-[calc(2rem+theme(spacing[3.5])*2)] min-w-[60px] break-words rounded-2xl border border-gray-100 bg-gradient-to-br from-gray-50 px-5 py-3.5 text-gray-600 prose-pre:my-2 dark:border-gray-800 dark:from-gray-800/40 dark:text-gray-300" + > + {#if webSearchMessages && webSearchMessages.length > 0} + <OpenWebSearchResults + classNames={tokens.length ? "mb-3.5" : ""} + {webSearchMessages} + loading={!webSearchIsDone} + /> + {/if} + {#if !message.content && (webSearchIsDone || (webSearchMessages && webSearchMessages.length === 0))} + <IconLoading /> + {/if} + + <div + class="prose max-w-none dark:prose-invert max-sm:prose-sm prose-headings:font-semibold prose-h1:text-lg prose-h2:text-base prose-h3:text-base prose-pre:bg-gray-800 dark:prose-pre:bg-gray-900" + bind:this={contentEl} + > + {#each tokens as token} + {#if token.type === "code"} + <CodeBlock lang={token.lang} code={unsanitizeMd(token.text)} /> + {:else} + <!-- eslint-disable-next-line svelte/no-at-html-tags --> + {@html marked(token.raw, options)} + {/if} + {/each} + </div> + </div> + {#if isAuthor && !loading && message.content} + <div + class="absolute bottom-1 right-0 flex max-md:transition-all md:bottom-0 md:group-hover:visible md:group-hover:opacity-100 + {message.score ? 'visible opacity-100' : 'invisible max-md:-translate-y-4 max-md:opacity-0'} + {isTapped ? 'max-md:visible max-md:translate-y-0 max-md:opacity-100' : ''} + " + > + <button + class="btn rounded-sm p-1 text-sm text-gray-400 focus:ring-0 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300 + {message.score && message.score > 0 + ? 'text-green-500 hover:text-green-500 dark:text-green-400 hover:dark:text-green-400' + : ''}" + title={message.score === 1 ? "Remove +1" : "+1"} + type="button" + on:click={() => dispatch("vote", { score: message.score === 1 ? 0 : 1, id: message.id })} + > + <CarbonThumbsUp class="h-[1.14em] w-[1.14em]" /> + </button> + <button + class="btn rounded-sm p-1 text-sm text-gray-400 focus:ring-0 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300 + {message.score && message.score < 0 + ? 'text-red-500 hover:text-red-500 dark:text-red-400 hover:dark:text-red-400' + : ''}" + title={message.score === -1 ? "Remove -1" : "-1"} + type="button" + on:click={() => + dispatch("vote", { score: message.score === -1 ? 0 : -1, id: message.id })} + > + <CarbonThumbsDown class="h-[1.14em] w-[1.14em]" /> + </button> + </div> + {/if} + </div> +{/if} +{#if message.from === "user"} + <div class="group relative flex items-start justify-start gap-4 max-sm:text-sm"> + <div class="mt-5 h-3 w-3 flex-none rounded-full" /> + <div + class="max-w-full whitespace-break-spaces break-words rounded-2xl px-5 py-3.5 text-gray-500 dark:text-gray-400" + > + {message.content.trim()} + </div> + {#if !loading} + <div class="absolute right-0 top-3.5 flex gap-2 lg:-right-2"> + {#if downloadLink} + <a + class="rounded-lg border border-gray-100 p-1 text-xs text-gray-400 group-hover:block hover:text-gray-500 dark:border-gray-800 dark:text-gray-400 dark:hover:text-gray-300 md:hidden" + title="Download prompt and parameters" + type="button" + target="_blank" + href={downloadLink} + > + <CarbonDownload /> + </a> + {/if} + {#if !readOnly} + <button + class="cursor-pointer rounded-lg border border-gray-100 p-1 text-xs text-gray-400 group-hover:block hover:text-gray-500 dark:border-gray-800 dark:text-gray-400 dark:hover:text-gray-300 md:hidden lg:-right-2" + title="Retry" + type="button" + on:click={() => dispatch("retry", { content: message.content, id: message.id })} + > + <CarbonRotate360 /> + </button> + {/if} + </div> + {/if} + </div> +{/if} diff --git a/src/lib/components/chat/ChatMessages.svelte b/src/lib/components/chat/ChatMessages.svelte new file mode 100644 index 0000000000000000000000000000000000000000..a8c89b1ca0e9a42a44855e35801e1f7c6a3bfa69 --- /dev/null +++ b/src/lib/components/chat/ChatMessages.svelte @@ -0,0 +1,83 @@ +<script lang="ts"> + import type { Message } from "$lib/types/Message"; + import { snapScrollToBottom } from "$lib/actions/snapScrollToBottom"; + import ScrollToBottomBtn from "$lib/components/ScrollToBottomBtn.svelte"; + import { tick } from "svelte"; + import { randomUUID } from "$lib/utils/randomUuid"; + import type { Model } from "$lib/types/Model"; + import type { LayoutData } from "../../../routes/$types"; + import ChatIntroduction from "./ChatIntroduction.svelte"; + import ChatMessage from "./ChatMessage.svelte"; + import type { WebSearchMessage } from "$lib/types/WebSearch"; + + export let messages: Message[]; + export let loading: boolean; + export let pending: boolean; + export let isAuthor: boolean; + export let currentModel: Model; + export let settings: LayoutData["settings"]; + export let models: Model[]; + export let readOnly: boolean; + export let searches: Record<string, WebSearchMessage[]>; + + let webSearchArray: Array<WebSearchMessage[] | undefined> = []; + let chatContainer: HTMLElement; + + export let webSearchMessages: WebSearchMessage[] = []; + + async function scrollToBottom() { + await tick(); + chatContainer.scrollTop = chatContainer.scrollHeight; + } + + // If last message is from user, scroll to bottom + $: if (messages[messages.length - 1]?.from === "user") { + scrollToBottom(); + } + + $: messages, + (webSearchArray = messages.map((message, idx) => { + if (message.webSearchId) { + return searches[message.webSearchId] ?? []; + } else if (idx === messages.length - 1) { + return webSearchMessages; + } else { + return []; + } + })); +</script> + +<div + class="scrollbar-custom mr-1 h-full overflow-y-auto" + use:snapScrollToBottom={messages.length ? [...messages, ...webSearchMessages] : false} + bind:this={chatContainer} +> + <div class="mx-auto flex h-full max-w-3xl flex-col gap-6 px-5 pt-6 sm:gap-8 xl:max-w-4xl"> + {#each messages as message, i} + <ChatMessage + loading={loading && i === messages.length - 1} + {message} + {isAuthor} + {readOnly} + model={currentModel} + webSearchMessages={webSearchArray[i]} + on:retry + on:vote + /> + {:else} + <ChatIntroduction {settings} {models} {currentModel} on:message /> + {/each} + {#if pending} + <ChatMessage + message={{ from: "assistant", content: "", id: randomUUID() }} + model={currentModel} + {webSearchMessages} + /> + {/if} + <div class="h-44 flex-none" /> + </div> + <ScrollToBottomBtn + class="bottom-36 right-4 max-md:hidden lg:right-10" + scrollNode={chatContainer} + /> +</div> diff --git a/src/lib/components/chat/ChatWindow.svelte b/src/lib/components/chat/ChatWindow.svelte new file mode 100644 index 0000000000000000000000000000000000000000..f2d6ad29fe4d6ca8dc4f6b79c94d2425e3736152 --- /dev/null +++ b/src/lib/components/chat/ChatWindow.svelte @@ -0,0 +1,146 @@ +<script lang="ts"> + import type { Message } from "$lib/types/Message"; + import { createEventDispatcher } from "svelte"; + + import CarbonSendAltFilled from "~icons/carbon/send-alt-filled"; + import CarbonExport from "~icons/carbon/export"; + import CarbonStopFilledAlt from "~icons/carbon/stop-filled-alt"; + import EosIconsLoading from "~icons/eos-icons/loading"; + + import ChatMessages from "./ChatMessages.svelte"; + import ChatInput from "./ChatInput.svelte"; + import StopGeneratingBtn from "../StopGeneratingBtn.svelte"; + import type { Model } from "$lib/types/Model"; + import type { LayoutData } from "../../../routes/$types"; + import WebSearchToggle from "../WebSearchToggle.svelte"; + import type { WebSearchMessage } from "$lib/types/WebSearch"; + import LoginModal from "../LoginModal.svelte"; + + export let messages: Message[] = []; + export let loading = false; + export let pending = false; + export let shared = false; + export let currentModel: Model; + export let models: Model[]; + export let settings: LayoutData["settings"]; + export let webSearchMessages: WebSearchMessage[] = []; + export let searches: Record<string, WebSearchMessage[]> = {}; + + export let loginRequired = false; + $: isReadOnly = !models.some((model) => model.id === currentModel.id); + + let loginModalOpen = false; + let message: string; + + const dispatch = createEventDispatcher<{ + message: string; + share: void; + stop: void; + retry: { id: Message["id"]; content: string }; + }>(); + + const handleSubmit = () => { + if (loading) return; + dispatch("message", message); + message = ""; + }; +</script> + +<div class="relative min-h-0 min-w-0"> + {#if loginModalOpen} + <LoginModal {settings} on:close={() => (loginModalOpen = false)} /> + {/if} + <ChatMessages + {loading} + {pending} + {settings} + {currentModel} + {models} + {messages} + readOnly={isReadOnly} + isAuthor={!shared} + {webSearchMessages} + {searches} + on:message + on:vote + on:retry={(ev) => { + if (!loading) dispatch("retry", ev.detail); + }} + /> + <div + class="dark:via-gray-80 pointer-events-none absolute inset-x-0 bottom-0 z-0 mx-auto flex w-full max-w-3xl flex-col items-center justify-center bg-gradient-to-t from-white via-white/80 to-white/0 px-3.5 py-4 dark:border-gray-800 dark:from-gray-900 dark:to-gray-900/0 max-md:border-t max-md:bg-white max-md:dark:bg-gray-900 sm:px-5 md:py-8 xl:max-w-4xl [&>*]:pointer-events-auto" + > + <div class="flex w-full pb-3 max-md:justify-between"> + {#if settings?.searchEnabled} + <WebSearchToggle /> + {/if} + {#if loading} + <StopGeneratingBtn + classNames={settings?.searchEnabled ? "md:-translate-x-1/2 md:mx-auto" : "mx-auto"} + on:click={() => dispatch("stop")} + /> + {/if} + </div> + <form + on:submit|preventDefault={handleSubmit} + class="relative flex w-full max-w-4xl flex-1 items-center rounded-xl border bg-gray-100 focus-within:border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:focus-within:border-gray-500 + {isReadOnly ? 'opacity-30' : ''}" + > + <div class="flex w-full flex-1 border-none bg-transparent"> + <ChatInput + placeholder="Ask anything" + bind:value={message} + on:submit={handleSubmit} + on:keypress={() => { + if (loginRequired) loginModalOpen = true; + }} + maxRows={4} + disabled={isReadOnly} + /> + + {#if loading} + <button + class="btn mx-1 my-1 inline-block h-[2.4rem] self-end rounded-lg bg-transparent p-1 px-[0.7rem] text-gray-400 disabled:opacity-60 enabled:hover:text-gray-700 dark:disabled:opacity-40 enabled:dark:hover:text-gray-100 md:hidden" + on:click={() => dispatch("stop")} + > + <CarbonStopFilledAlt /> + </button> + <div + class="mx-1 my-1 hidden h-[2.4rem] items-center p-1 px-[0.7rem] text-gray-400 disabled:opacity-60 enabled:hover:text-gray-700 dark:disabled:opacity-40 enabled:dark:hover:text-gray-100 md:flex" + > + <EosIconsLoading /> + </div> + {:else} + <button + class="btn mx-1 my-1 h-[2.4rem] self-end rounded-lg bg-transparent p-1 px-[0.7rem] text-gray-400 disabled:opacity-60 enabled:hover:text-gray-700 dark:disabled:opacity-40 enabled:dark:hover:text-gray-100" + disabled={!message || isReadOnly} + type="submit" + > + <CarbonSendAltFilled /> + </button> + {/if} + </div> + </form> + <div class="mt-2 flex justify-between self-stretch px-1 text-xs text-gray-400/90 max-sm:gap-2"> + <p> + Model: <a + href="https://huggingface.co/{currentModel.name}" + target="_blank" + rel="noreferrer" + class="hover:underline">{currentModel.displayName}</a + > <span class="max-sm:hidden">·</span><br class="sm:hidden" /> Generated content may be inaccurate + or false. + </p> + {#if messages.length} + <button + class="flex flex-none items-center hover:text-gray-400 hover:underline max-sm:rounded-lg max-sm:bg-gray-50 max-sm:px-2.5 dark:max-sm:bg-gray-800" + type="button" + on:click={() => dispatch("share")} + > + <CarbonExport class="text-[.6rem] sm:mr-1.5 sm:text-primary-500" /> + <div class="max-sm:hidden">Share this conversation</div> + </button> + {/if} + </div> + </div> +</div> diff --git a/src/lib/components/icons/IconChevron.svelte b/src/lib/components/icons/IconChevron.svelte new file mode 100644 index 0000000000000000000000000000000000000000..6368a08fc43ec23d8dab0205215ecc99d53fc295 --- /dev/null +++ b/src/lib/components/icons/IconChevron.svelte @@ -0,0 +1,20 @@ +<script lang="ts"> + export let classNames = ""; +</script> + +<svg + width="1em" + height="1em" + viewBox="0 0 15 6" + class={classNames} + fill="none" + xmlns="http://www.w3.org/2000/svg" +> + <path + d="M1.67236 1L7.67236 7L13.6724 1" + stroke="currentColor" + stroke-width="2" + stroke-linecap="round" + stroke-linejoin="round" + /> +</svg> diff --git a/src/lib/components/icons/IconCopy.svelte b/src/lib/components/icons/IconCopy.svelte new file mode 100644 index 0000000000000000000000000000000000000000..79fdfe1c97a696bb9729db87ab409aeb974e9c53 --- /dev/null +++ b/src/lib/components/icons/IconCopy.svelte @@ -0,0 +1,26 @@ +<script lang="ts"> + export let classNames = ""; +</script> + +<svg + class={classNames} + xmlns="http://www.w3.org/2000/svg" + aria-hidden="true" + fill="currentColor" + focusable="false" + role="img" + width="1em" + height="1em" + preserveAspectRatio="xMidYMid meet" + viewBox="0 0 32 32" +> + <path + d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" + transform="translate(0)" + /> + <path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)" /><rect + fill="none" + width="32" + height="32" + /> +</svg> diff --git a/src/lib/components/icons/IconDazzled.svelte b/src/lib/components/icons/IconDazzled.svelte new file mode 100644 index 0000000000000000000000000000000000000000..a57479e34716923bb4e3dabf63453b97f4ffaf88 --- /dev/null +++ b/src/lib/components/icons/IconDazzled.svelte @@ -0,0 +1,36 @@ +<script lang="ts"> + export let classNames = ""; +</script> + +<svg + xmlns="http://www.w3.org/2000/svg" + width="1em" + height="1em" + class={classNames} + fill="none" + viewBox="0 0 26 23" +> + <path + fill="url(#a)" + d="M.93 10.65A10.17 10.17 0 0 1 11.11.48h4.67a9.45 9.45 0 0 1 0 18.89H4.53L1.62 22.2a.38.38 0 0 1-.69-.28V10.65Z" + /> + <path + fill="#000" + fill-rule="evenodd" + d="M11.52 7.4a1.86 1.86 0 1 1-3.72 0 1.86 1.86 0 0 1 3.72 0Zm7.57 0a1.86 1.86 0 1 1-3.73 0 1.86 1.86 0 0 1 3.73 0ZM8.9 12.9a.55.55 0 0 0-.11.35.76.76 0 0 1-1.51 0c0-.95.67-1.94 1.76-1.94 1.09 0 1.76 1 1.76 1.94H9.3a.55.55 0 0 0-.12-.35c-.06-.07-.1-.08-.13-.08s-.08 0-.14.08Zm4.04 0a.55.55 0 0 0-.12.35h-1.51c0-.95.68-1.94 1.76-1.94 1.1 0 1.77 1 1.77 1.94h-1.51a.55.55 0 0 0-.12-.35c-.06-.07-.11-.08-.14-.08-.02 0-.07 0-.13.08Zm-1.89.79c-.02 0-.07-.01-.13-.08a.55.55 0 0 1-.12-.36h-1.5c0 .95.67 1.95 1.75 1.95 1.1 0 1.77-1 1.77-1.95h-1.51c0 .16-.06.28-.12.36-.06.07-.11.08-.14.08Zm4.04 0c-.03 0-.08-.01-.14-.08a.55.55 0 0 1-.12-.36h-1.5c0 .95.67 1.95 1.76 1.95 1.08 0 1.76-1 1.76-1.95h-1.51c0 .16-.06.28-.12.36-.06.07-.11.08-.13.08Zm1.76-.44c0-.16.05-.28.12-.35.06-.07.1-.08.13-.08s.08 0 .14.08c.06.07.11.2.11.35a.76.76 0 0 0 1.51 0c0-.95-.67-1.94-1.76-1.94-1.09 0-1.76 1-1.76 1.94h1.5Z" + clip-rule="evenodd" + /> + <defs> + <radialGradient + id="a" + cx="0" + cy="0" + r="1" + gradientTransform="matrix(0 31.37 -34.85 0 13.08 -9.02)" + gradientUnits="userSpaceOnUse" + > + <stop stop-color="#FFD21E" /> + <stop offset="1" stop-color="red" /> + </radialGradient> + </defs> +</svg> diff --git a/src/lib/components/icons/IconLoading.svelte b/src/lib/components/icons/IconLoading.svelte new file mode 100644 index 0000000000000000000000000000000000000000..bb5d9868ef3d1d979a927c6dcb551b218228ef20 --- /dev/null +++ b/src/lib/components/icons/IconLoading.svelte @@ -0,0 +1,18 @@ +<script lang="ts"> + export let classNames = ""; +</script> + +<div class={"inline-flex h-8 flex-none items-center gap-1 " + classNames}> + <div + class="h-1 w-1 animate-bounce rounded-full bg-gray-500 dark:bg-gray-400" + style="animation-delay: 0.25s;" + /> + <div + class="h-1 w-1 animate-bounce rounded-full bg-gray-500 dark:bg-gray-400" + style="animation-delay: 0.5s;" + /> + <div + class="h-1 w-1 animate-bounce rounded-full bg-gray-500 dark:bg-gray-400" + style="animation-delay: 0.75s;" + /> +</div> diff --git a/src/lib/components/icons/Logo.svelte b/src/lib/components/icons/Logo.svelte new file mode 100644 index 0000000000000000000000000000000000000000..ffd45f2b3706a5a5af74cccf8a473e72bd93c34b --- /dev/null +++ b/src/lib/components/icons/Logo.svelte @@ -0,0 +1,28 @@ +<script lang="ts"> + import { page } from "$app/stores"; + import { PUBLIC_APP_ASSETS, PUBLIC_APP_NAME, PUBLIC_ORIGIN } from "$env/static/public"; + import { base } from "$app/paths"; + + export let classNames = ""; +</script> + +{#if PUBLIC_APP_ASSETS === "chatui"} + <svg + height="30" + width="30" + viewBox="0 0 30 30" + xmlns="http://www.w3.org/2000/svg" + class={classNames} + > + <path + d="M4.06151 14.1464C4.06151 11.8818 4.9611 9.71004 6.56237 8.10877C8.16364 6.5075 10.3354 5.60791 12.6 5.60791H16.5231C18.6254 5.60791 20.6416 6.44307 22.1282 7.92965C23.6148 9.41624 24.45 11.4325 24.45 13.5348C24.45 15.6372 23.6148 17.6534 22.1282 19.14C20.6416 20.6266 18.6254 21.4618 16.5231 21.4618H7.08459L4.63844 23.8387C4.59547 23.8942 4.53557 23.9343 4.4678 23.9527C4.40004 23.9712 4.32811 23.9671 4.2629 23.941C4.1977 23.9149 4.14276 23.8683 4.10643 23.8082C4.07009 23.7481 4.05432 23.6778 4.06151 23.6079V14.1464Z" + class="fill-primary-500" + /> + </svg> +{:else} + <object + class={classNames} + data="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/favicon.svg" + title="{PUBLIC_APP_NAME} logo" + /> +{/if} diff --git a/src/lib/components/icons/LogoHuggingFaceBorderless.svelte b/src/lib/components/icons/LogoHuggingFaceBorderless.svelte new file mode 100644 index 0000000000000000000000000000000000000000..89a92da09ec15b979b768ec7f5613410ceac5e53 --- /dev/null +++ b/src/lib/components/icons/LogoHuggingFaceBorderless.svelte @@ -0,0 +1,50 @@ +<script lang="ts"> + export let classNames = ""; +</script> + +<svg + class={classNames} + xmlns="http://www.w3.org/2000/svg" + width="1em" + height="1em" + fill="none" + viewBox="0 0 95 88" +> + <path fill="#FFD21E" d="M47.21 76.5a34.75 34.75 0 1 0 0-69.5 34.75 34.75 0 0 0 0 69.5Z" /> + <path + fill="#FF9D0B" + d="M81.96 41.75a34.75 34.75 0 1 0-69.5 0 34.75 34.75 0 0 0 69.5 0Zm-73.5 0a38.75 38.75 0 1 1 77.5 0 38.75 38.75 0 0 1-77.5 0Z" + /> + <path + fill="#3A3B45" + d="M58.5 32.3c1.28.44 1.78 3.06 3.07 2.38a5 5 0 1 0-6.76-2.07c.61 1.15 2.55-.72 3.7-.32ZM34.95 32.3c-1.28.44-1.79 3.06-3.07 2.38a5 5 0 1 1 6.76-2.07c-.61 1.15-2.56-.72-3.7-.32ZM46.96 56.29c9.83 0 13-8.76 13-13.26 0-2.34-1.57-1.6-4.09-.36-2.33 1.15-5.46 2.74-8.9 2.74-7.19 0-13-6.88-13-2.38s3.16 13.26 13 13.26Z" + /> + <mask id="a" width="27" height="16" x="33" y="41" maskUnits="userSpaceOnUse"> + <path + fill="#fff" + d="M46.96 56.29c9.83 0 13-8.76 13-13.26 0-2.34-1.57-1.6-4.09-.36-2.33 1.15-5.46 2.74-8.9 2.74-7.19 0-13-6.88-13-2.38s3.16 13.26 13 13.26Z" + /> + </mask> + <g mask="url(#a)"> + <path + fill="#F94040" + d="M47.21 66.5a8.67 8.67 0 0 0 2.65-16.94c-.84-.26-1.73 2.6-2.65 2.6-.86 0-1.7-2.88-2.48-2.65a8.68 8.68 0 0 0 2.48 16.99Z" + /> + </g> + <path + fill="#FF9D0B" + d="M70.71 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM24.21 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM17.52 48c-1.62 0-3.06.66-4.07 1.87a5.97 5.97 0 0 0-1.33 3.76 7.1 7.1 0 0 0-1.94-.3c-1.55 0-2.95.59-3.94 1.66a5.8 5.8 0 0 0-.8 7 5.3 5.3 0 0 0-1.79 2.82c-.24.9-.48 2.8.8 4.74a5.22 5.22 0 0 0-.37 5.02c1.02 2.32 3.57 4.14 8.52 6.1 3.07 1.22 5.89 2 5.91 2.01a44.33 44.33 0 0 0 10.93 1.6c5.86 0 10.05-1.8 12.46-5.34 3.88-5.69 3.33-10.9-1.7-15.92-2.77-2.78-4.62-6.87-5-7.77-.78-2.66-2.84-5.62-6.25-5.62a5.7 5.7 0 0 0-4.6 2.46c-1-1.26-1.98-2.25-2.86-2.82A7.4 7.4 0 0 0 17.52 48Zm0 4c.51 0 1.14.22 1.82.65 2.14 1.36 6.25 8.43 7.76 11.18.5.92 1.37 1.31 2.14 1.31 1.55 0 2.75-1.53.15-3.48-3.92-2.93-2.55-7.72-.68-8.01.08-.02.17-.02.24-.02 1.7 0 2.45 2.93 2.45 2.93s2.2 5.52 5.98 9.3c3.77 3.77 3.97 6.8 1.22 10.83-1.88 2.75-5.47 3.58-9.16 3.58-3.81 0-7.73-.9-9.92-1.46-.11-.03-13.45-3.8-11.76-7 .28-.54.75-.76 1.34-.76 2.38 0 6.7 3.54 8.57 3.54.41 0 .7-.17.83-.6.79-2.85-12.06-4.05-10.98-8.17.2-.73.71-1.02 1.44-1.02 3.14 0 10.2 5.53 11.68 5.53.11 0 .2-.03.24-.1.74-1.2.33-2.04-4.9-5.2-5.21-3.16-8.88-5.06-6.8-7.33.24-.26.58-.38 1-.38 3.17 0 10.66 6.82 10.66 6.82s2.02 2.1 3.25 2.1c.28 0 .52-.1.68-.38.86-1.46-8.06-8.22-8.56-11.01-.34-1.9.24-2.85 1.31-2.85Z" + /> + <path + fill="#FFD21E" + d="M38.6 76.69c2.75-4.04 2.55-7.07-1.22-10.84-3.78-3.77-5.98-9.3-5.98-9.3s-.82-3.2-2.69-2.9c-1.87.3-3.24 5.08.68 8.01 3.91 2.93-.78 4.92-2.29 2.17-1.5-2.75-5.62-9.82-7.76-11.18-2.13-1.35-3.63-.6-3.13 2.2.5 2.79 9.43 9.55 8.56 11-.87 1.47-3.93-1.71-3.93-1.71s-9.57-8.71-11.66-6.44c-2.08 2.27 1.59 4.17 6.8 7.33 5.23 3.16 5.64 4 4.9 5.2-.75 1.2-12.28-8.53-13.36-4.4-1.08 4.11 11.77 5.3 10.98 8.15-.8 2.85-9.06-5.38-10.74-2.18-1.7 3.21 11.65 6.98 11.76 7.01 4.3 1.12 15.25 3.49 19.08-2.12Z" + /> + <path + fill="#FF9D0B" + d="M77.4 48c1.62 0 3.07.66 4.07 1.87a5.97 5.97 0 0 1 1.33 3.76 7.1 7.1 0 0 1 1.95-.3c1.55 0 2.95.59 3.94 1.66a5.8 5.8 0 0 1 .8 7 5.3 5.3 0 0 1 1.78 2.82c.24.9.48 2.8-.8 4.74a5.22 5.22 0 0 1 .37 5.02c-1.02 2.32-3.57 4.14-8.51 6.1-3.08 1.22-5.9 2-5.92 2.01a44.33 44.33 0 0 1-10.93 1.6c-5.86 0-10.05-1.8-12.46-5.34-3.88-5.69-3.33-10.9 1.7-15.92 2.78-2.78 4.63-6.87 5.01-7.77.78-2.66 2.83-5.62 6.24-5.62a5.7 5.7 0 0 1 4.6 2.46c1-1.26 1.98-2.25 2.87-2.82A7.4 7.4 0 0 1 77.4 48Zm0 4c-.51 0-1.13.22-1.82.65-2.13 1.36-6.25 8.43-7.76 11.18a2.43 2.43 0 0 1-2.14 1.31c-1.54 0-2.75-1.53-.14-3.48 3.91-2.93 2.54-7.72.67-8.01a1.54 1.54 0 0 0-.24-.02c-1.7 0-2.45 2.93-2.45 2.93s-2.2 5.52-5.97 9.3c-3.78 3.77-3.98 6.8-1.22 10.83 1.87 2.75 5.47 3.58 9.15 3.58 3.82 0 7.73-.9 9.93-1.46.1-.03 13.45-3.8 11.76-7-.29-.54-.75-.76-1.34-.76-2.38 0-6.71 3.54-8.57 3.54-.42 0-.71-.17-.83-.6-.8-2.85 12.05-4.05 10.97-8.17-.19-.73-.7-1.02-1.44-1.02-3.14 0-10.2 5.53-11.68 5.53-.1 0-.19-.03-.23-.1-.74-1.2-.34-2.04 4.88-5.2 5.23-3.16 8.9-5.06 6.8-7.33-.23-.26-.57-.38-.98-.38-3.18 0-10.67 6.82-10.67 6.82s-2.02 2.1-3.24 2.1a.74.74 0 0 1-.68-.38c-.87-1.46 8.05-8.22 8.55-11.01.34-1.9-.24-2.85-1.31-2.85Z" + /> + <path + fill="#FFD21E" + d="M56.33 76.69c-2.75-4.04-2.56-7.07 1.22-10.84 3.77-3.77 5.97-9.3 5.97-9.3s.82-3.2 2.7-2.9c1.86.3 3.23 5.08-.68 8.01-3.92 2.93.78 4.92 2.28 2.17 1.51-2.75 5.63-9.82 7.76-11.18 2.13-1.35 3.64-.6 3.13 2.2-.5 2.79-9.42 9.55-8.55 11 .86 1.47 3.92-1.71 3.92-1.71s9.58-8.71 11.66-6.44c2.08 2.27-1.58 4.17-6.8 7.33-5.23 3.16-5.63 4-4.9 5.2.75 1.2 12.28-8.53 13.36-4.4 1.08 4.11-11.76 5.3-10.97 8.15.8 2.85 9.05-5.38 10.74-2.18 1.69 3.21-11.65 6.98-11.76 7.01-4.31 1.12-15.26 3.49-19.08-2.12Z" + /> +</svg> diff --git a/src/lib/constants/publicSepToken.ts b/src/lib/constants/publicSepToken.ts new file mode 100644 index 0000000000000000000000000000000000000000..15d962d69ba33e1abeb8a35885aa7647d24cf7af --- /dev/null +++ b/src/lib/constants/publicSepToken.ts @@ -0,0 +1 @@ +export const PUBLIC_SEP_TOKEN = "</s>"; diff --git a/src/lib/server/abortedGenerations.ts b/src/lib/server/abortedGenerations.ts new file mode 100644 index 0000000000000000000000000000000000000000..575cf637bfef812c40905e35570ba3ca1a31b241 --- /dev/null +++ b/src/lib/server/abortedGenerations.ts @@ -0,0 +1,29 @@ +// Shouldn't be needed if we dove into sveltekit internals, see https://github.com/huggingface/chat-ui/pull/88#issuecomment-1523173850 + +import { setTimeout } from "node:timers/promises"; +import { collections } from "./database"; + +let closed = false; +process.on("SIGINT", () => { + closed = true; +}); + +export let abortedGenerations: Map<string, Date> = new Map(); + +async function maintainAbortedGenerations() { + while (!closed) { + await setTimeout(1000); + + try { + const aborts = await collections.abortedGenerations.find({}).sort({ createdAt: 1 }).toArray(); + + abortedGenerations = new Map( + aborts.map(({ conversationId, createdAt }) => [conversationId.toString(), createdAt]) + ); + } catch (err) { + console.error(err); + } + } +} + +maintainAbortedGenerations(); diff --git a/src/lib/server/auth.ts b/src/lib/server/auth.ts new file mode 100644 index 0000000000000000000000000000000000000000..96793da575f6f01695d714a71d45ee181b9e1964 --- /dev/null +++ b/src/lib/server/auth.ts @@ -0,0 +1,118 @@ +import { Issuer, BaseClient, type UserinfoResponse, TokenSet } from "openid-client"; +import { addHours, addYears } from "date-fns"; +import { + COOKIE_NAME, + OPENID_CLIENT_ID, + OPENID_CLIENT_SECRET, + OPENID_PROVIDER_URL, + OPENID_SCOPES, +} from "$env/static/private"; +import { sha256 } from "$lib/utils/sha256"; +import { z } from "zod"; +import { dev } from "$app/environment"; +import type { Cookies } from "@sveltejs/kit"; + +export interface OIDCSettings { + redirectURI: string; +} + +export interface OIDCUserInfo { + token: TokenSet; + userData: UserinfoResponse; +} + +export const requiresUser = !!OPENID_CLIENT_ID && !!OPENID_CLIENT_SECRET; + +export function refreshSessionCookie(cookies: Cookies, sessionId: string) { + cookies.set(COOKIE_NAME, sessionId, { + path: "/", + // So that it works inside the space's iframe + sameSite: dev ? "lax" : "none", + secure: !dev, + httpOnly: true, + expires: addYears(new Date(), 1), + }); +} + +export const authCondition = (locals: App.Locals) => { + return locals.user + ? { userId: locals.user._id } + : { sessionId: locals.sessionId, userId: { $exists: false } }; +}; + +/** + * Generates a CSRF token using the user sessionId. Note that we don't need a secret because sessionId is enough. + */ +export async function generateCsrfToken(sessionId: string, redirectUrl: string): Promise<string> { + const data = { + expiration: addHours(new Date(), 1).getTime(), + redirectUrl, + }; + + return Buffer.from( + JSON.stringify({ + data, + signature: await sha256(JSON.stringify(data) + "##" + sessionId), + }) + ).toString("base64"); +} + +async function getOIDCClient(settings: OIDCSettings): Promise<BaseClient> { + const issuer = await Issuer.discover(OPENID_PROVIDER_URL); + return new issuer.Client({ + client_id: OPENID_CLIENT_ID, + client_secret: OPENID_CLIENT_SECRET, + redirect_uris: [settings.redirectURI], + response_types: ["code"], + }); +} + +export async function getOIDCAuthorizationUrl( + settings: OIDCSettings, + params: { sessionId: string } +): Promise<string> { + const client = await getOIDCClient(settings); + const csrfToken = await generateCsrfToken(params.sessionId, settings.redirectURI); + const url = client.authorizationUrl({ + scope: OPENID_SCOPES, + state: csrfToken, + }); + + return url; +} + +export async function getOIDCUserData(settings: OIDCSettings, code: string): Promise<OIDCUserInfo> { + const client = await getOIDCClient(settings); + const token = await client.callback(settings.redirectURI, { code }); + const userData = await client.userinfo(token); + + return { token, userData }; +} + +export async function validateAndParseCsrfToken( + token: string, + sessionId: string +): Promise<{ + /** This is the redirect url that was passed to the OIDC provider */ + redirectUrl: string; +} | null> { + try { + const { data, signature } = z + .object({ + data: z.object({ + expiration: z.number().int(), + redirectUrl: z.string().url(), + }), + signature: z.string().length(64), + }) + .parse(JSON.parse(token)); + const reconstructSign = await sha256(JSON.stringify(data) + "##" + sessionId); + + if (data.expiration > Date.now() && signature === reconstructSign) { + return { redirectUrl: data.redirectUrl }; + } + } catch (e) { + console.error(e); + } + return null; +} diff --git a/src/lib/server/database.ts b/src/lib/server/database.ts new file mode 100644 index 0000000000000000000000000000000000000000..4fc4908e2236e8fdbe937054c24f33f3cfd6341a --- /dev/null +++ b/src/lib/server/database.ts @@ -0,0 +1,62 @@ +import { MONGODB_URL, MONGODB_DB_NAME, MONGODB_DIRECT_CONNECTION } from "$env/static/private"; +import { MongoClient } from "mongodb"; +import type { Conversation } from "$lib/types/Conversation"; +import type { SharedConversation } from "$lib/types/SharedConversation"; +import type { WebSearch } from "$lib/types/WebSearch"; +import type { AbortedGeneration } from "$lib/types/AbortedGeneration"; +import type { Settings } from "$lib/types/Settings"; +import type { User } from "$lib/types/User"; + +if (!MONGODB_URL) { + throw new Error( + "Please specify the MONGODB_URL environment variable inside .env.local. Set it to mongodb://localhost:27017 if you are running MongoDB locally, or to a MongoDB Atlas free instance for example." + ); +} + +const client = new MongoClient(MONGODB_URL, { + directConnection: MONGODB_DIRECT_CONNECTION === "true", +}); + +export const connectPromise = client.connect().catch(console.error); + +const db = client.db(MONGODB_DB_NAME + (import.meta.env.MODE === "test" ? "-test" : "")); + +const conversations = db.collection<Conversation>("conversations"); +const sharedConversations = db.collection<SharedConversation>("sharedConversations"); +const abortedGenerations = db.collection<AbortedGeneration>("abortedGenerations"); +const settings = db.collection<Settings>("settings"); +const users = db.collection<User>("users"); +const webSearches = db.collection<WebSearch>("webSearches"); + +export { client, db }; +export const collections = { + conversations, + sharedConversations, + abortedGenerations, + settings, + users, + webSearches, +}; + +client.on("open", () => { + conversations + .createIndex( + { sessionId: 1, updatedAt: -1 }, + { partialFilterExpression: { sessionId: { $exists: true } } } + ) + .catch(console.error); + conversations + .createIndex( + { userId: 1, updatedAt: -1 }, + { partialFilterExpression: { userId: { $exists: true } } } + ) + .catch(console.error); + webSearches.createIndex({ sessionId: 1, updatedAt: -1 }).catch(console.error); + abortedGenerations.createIndex({ updatedAt: 1 }, { expireAfterSeconds: 30 }).catch(console.error); + abortedGenerations.createIndex({ conversationId: 1 }, { unique: true }).catch(console.error); + sharedConversations.createIndex({ hash: 1 }, { unique: true }).catch(console.error); + settings.createIndex({ sessionId: 1 }, { unique: true, sparse: true }).catch(console.error); + settings.createIndex({ userId: 1 }, { unique: true, sparse: true }).catch(console.error); + users.createIndex({ hfUserId: 1 }, { unique: true }).catch(console.error); + users.createIndex({ sessionId: 1 }, { unique: true, sparse: true }).catch(console.error); +}); diff --git a/src/lib/server/generateFromDefaultEndpoint.ts b/src/lib/server/generateFromDefaultEndpoint.ts new file mode 100644 index 0000000000000000000000000000000000000000..84e94a383ae9e2a0d4fc2416924d328219415ba4 --- /dev/null +++ b/src/lib/server/generateFromDefaultEndpoint.ts @@ -0,0 +1,43 @@ +import { defaultModel } from "$lib/server/models"; +import { modelEndpoint } from "./modelEndpoint"; +import { textGeneration } from "@huggingface/inference"; +import { trimSuffix } from "$lib/utils/trimSuffix"; +import { trimPrefix } from "$lib/utils/trimPrefix"; +import { PUBLIC_SEP_TOKEN } from "$lib/constants/publicSepToken"; + +interface Parameters { + temperature: number; + truncate: number; + max_new_tokens: number; + stop: string[]; +} +export async function generateFromDefaultEndpoint( + prompt: string, + parameters?: Partial<Parameters> +) { + const newParameters = { + ...defaultModel.parameters, + ...parameters, + return_full_text: false, + }; + + const endpoint = modelEndpoint(defaultModel); + let { generated_text } = await textGeneration( + { + model: endpoint.url, + inputs: prompt, + parameters: newParameters, + }, + { + fetch: (url, options) => + fetch(url, { + ...options, + headers: { ...options?.headers, Authorization: endpoint.authorization }, + }), + } + ); + + generated_text = trimSuffix(trimPrefix(generated_text, "<|startoftext|>"), PUBLIC_SEP_TOKEN); + + return generated_text; +} diff --git a/src/lib/server/modelEndpoint.ts b/src/lib/server/modelEndpoint.ts new file mode 100644 index 0000000000000000000000000000000000000000..1edd45cf91e251ff13c89f2f56ee6130a74bce19 --- /dev/null +++ b/src/lib/server/modelEndpoint.ts @@ -0,0 +1,32 @@ +import { HF_ACCESS_TOKEN } from "$env/static/private"; +import { sum } from "$lib/utils/sum"; +import type { BackendModel } from "./models"; + +/** + * Find a random load-balanced endpoint + */ +export function modelEndpoint(model: BackendModel): { + url: string; + authorization: string; + weight: number; +} { + if (!model.endpoints) { + return { + url: `https://api-inference.huggingface.co/models/${model.name}`, + authorization: `Bearer ${HF_ACCESS_TOKEN}`, + weight: 1, + }; + } + const endpoints = model.endpoints; + const totalWeight = sum(endpoints.map((e) => e.weight)); + + let random = Math.random() * totalWeight; + for (const endpoint of endpoints) { + if (random < endpoint.weight) { + return endpoint; + } + random -= endpoint.weight; + } + + throw new Error("Invalid config, no endpoint found"); +} diff --git a/src/lib/server/models.ts b/src/lib/server/models.ts new file mode 100644 index 0000000000000000000000000000000000000000..6946f40623098176a3d262d08ef60961eeceb650 --- /dev/null +++ b/src/lib/server/models.ts @@ -0,0 +1,80 @@ +import { HF_ACCESS_TOKEN, MODELS, OLD_MODELS } from "$env/static/private"; +import { z } from "zod"; + +const modelsRaw = z + .array( + z.object({ + /** Used as an identifier in DB */ + id: z.string().optional(), + /** Used to link to the model page, and for inference */ + name: z.string().min(1), + displayName: z.string().min(1).optional(), + description: z.string().min(1).optional(), + websiteUrl: z.string().url().optional(), + datasetName: z.string().min(1).optional(), + userMessageToken: z.string().min(1), + assistantMessageToken: z.string().min(1), + messageEndToken: z.string().min(1).optional(), + preprompt: z.string().default(""), + prepromptUrl: z.string().url().optional(), + promptExamples: z + .array( + z.object({ + title: z.string().min(1), + prompt: z.string().min(1), + }) + ) + .optional(), + endpoints: z + .array( + z.object({ + url: z.string().url(), + authorization: z.string().min(1).default(`Bearer ${HF_ACCESS_TOKEN}`), + weight: z.number().int().positive().default(1), + }) + ) + .optional(), + parameters: z + .object({ + temperature: z.number().min(0).max(1), + truncate: z.number().int().positive(), + max_new_tokens: z.number().int().positive(), + stop: z.array(z.string()).optional(), + }) + .passthrough() + .optional(), + }) + ) + .parse(JSON.parse(MODELS)); + +export const models = await Promise.all( + modelsRaw.map(async (m) => ({ + ...m, + id: m.id || m.name, + displayName: m.displayName || m.name, + preprompt: m.prepromptUrl ? await fetch(m.prepromptUrl).then((r) => r.text()) : m.preprompt, + })) +); + +// Models that have been deprecated +export const oldModels = OLD_MODELS + ? z + .array( + z.object({ + id: z.string().optional(), + name: z.string().min(1), + displayName: z.string().min(1).optional(), + }) + ) + .parse(JSON.parse(OLD_MODELS)) + .map((m) => ({ ...m, id: m.id || m.name, displayName: m.displayName || m.name })) + : []; + +export type BackendModel = (typeof models)[0]; + +export const defaultModel = models[0]; + +export const validateModel = (_models: BackendModel[]) => { + // Zod enum function requires 2 parameters + return z.enum([_models[0].id, ..._models.slice(1).map((m) => m.id)]); +}; diff --git a/src/lib/server/websearch/generateQuery.ts b/src/lib/server/websearch/generateQuery.ts new file mode 100644 index 0000000000000000000000000000000000000000..ace204e86718488959fa05ad86127deaad45e1f8 --- /dev/null +++ b/src/lib/server/websearch/generateQuery.ts @@ -0,0 +1,25 @@ +import type { Message } from "$lib/types/Message"; +import { generateFromDefaultEndpoint } from "../generateFromDefaultEndpoint"; +import type { BackendModel } from "../models"; + +export async function generateQuery(messages: Message[], model: BackendModel) { + const promptSearchQuery = + model.userMessageToken + + "The following messages were written by a user, trying to answer a question." + + model.messageEndToken + + messages + .filter((message) => message.from === "user") + .map((message) => model.userMessageToken + message.content + model.messageEndToken) + + model.userMessageToken + + "What plain-text english sentence would you input into Google to answer the last question? Answer with a short (10 words max) simple sentence." + + model.messageEndToken + + model.assistantMessageToken + + "Query: "; + + const searchQuery = await generateFromDefaultEndpoint(promptSearchQuery).then((query) => { + const arr = query.split(/\r?\n/); + return arr[0].length > 0 ? arr[0] : arr[1]; + }); + + return searchQuery; +} diff --git a/src/lib/server/websearch/parseWeb.ts b/src/lib/server/websearch/parseWeb.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe3e567a6e2b936c627f35b498719e7d19841c53 --- /dev/null +++ b/src/lib/server/websearch/parseWeb.ts @@ -0,0 +1,56 @@ +import { JSDOM, VirtualConsole } from "jsdom"; + +function removeTags(node: Node) { + if (node.hasChildNodes()) { + node.childNodes.forEach((childNode) => { + if (node.nodeName === "SCRIPT" || node.nodeName === "STYLE") { + node.removeChild(childNode); + } else { + removeTags(childNode); + } + }); + } +} +function naiveInnerText(node: Node): string { + const Node = node; // We need Node(DOM's Node) for the constants, but Node doesn't exist in the nodejs global space, and any Node instance references the constants through the prototype chain + return [...node.childNodes] + .map((childNode) => { + switch (childNode.nodeType) { + case Node.TEXT_NODE: + return node.textContent; + case Node.ELEMENT_NODE: + return naiveInnerText(childNode); + default: + return ""; + } + }) + .join("\n"); +} + +export async function parseWeb(url: string) { + const abortController = new AbortController(); + setTimeout(() => abortController.abort(), 10000); + const htmlString = await fetch(url, { signal: abortController.signal }) + .then((response) => response.text()) + .catch((err) => console.log(err)); + + const virtualConsole = new VirtualConsole(); + virtualConsole.on("error", () => { + // No-op to skip console errors. + }); + + // put the html string into a DOM + const dom = new JSDOM(htmlString ?? "", { + virtualConsole, + }); + + const body = dom.window.document.querySelector("body"); + if (!body) throw new Error("body of the webpage is null"); + + removeTags(body); + + // recursively extract text content from the body and then remove newlines and multiple spaces + const text = (naiveInnerText(body) ?? "").replace(/ {2}|\r\n|\n|\r/gm, ""); + + return text; +} diff --git a/src/lib/server/websearch/searchWeb.ts b/src/lib/server/websearch/searchWeb.ts new file mode 100644 index 0000000000000000000000000000000000000000..39dc2de379e95d4b4ae137dffedc43210f57139c --- /dev/null +++ b/src/lib/server/websearch/searchWeb.ts @@ -0,0 +1,20 @@ +import { SERPAPI_KEY } from "$env/static/private"; + +import { getJson } from "serpapi"; +import type { GoogleParameters } from "serpapi"; + +// Show result as JSON +export async function searchWeb(query: string) { + const params = { + q: query, + hl: "en", + gl: "us", + google_domain: "google.com", + api_key: SERPAPI_KEY, + } satisfies GoogleParameters; + + // Show result as JSON + const response = await getJson("google", params); + + return response; +} diff --git a/src/lib/server/websearch/summarizeWeb.ts b/src/lib/server/websearch/summarizeWeb.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f3212a4c8ab6189b377718aafcce8b0bd69afee --- /dev/null +++ b/src/lib/server/websearch/summarizeWeb.ts @@ -0,0 +1,23 @@ +import { generateFromDefaultEndpoint } from "../generateFromDefaultEndpoint"; +import type { BackendModel } from "../models"; + +export async function summarizeWeb(content: string, query: string, model: BackendModel) { + const summaryPrompt = + model.userMessageToken + + content + .split(" ") + .slice(0, model.parameters?.truncate ?? 0) + .join(" ") + + model.messageEndToken + + model.userMessageToken + + `The text above should be summarized to best answer the query: ${query}.` + + model.messageEndToken + + model.assistantMessageToken + + "Summary: "; + + const summary = await generateFromDefaultEndpoint(summaryPrompt).then((txt: string) => + txt.trim() + ); + + return summary; +} diff --git a/src/lib/shareConversation.ts b/src/lib/shareConversation.ts new file mode 100644 index 0000000000000000000000000000000000000000..4768b604a42258d5d97231dd0e44f9198ef1864c --- /dev/null +++ b/src/lib/shareConversation.ts @@ -0,0 +1,27 @@ +import { base } from "$app/paths"; +import { ERROR_MESSAGES, error } from "$lib/stores/errors"; +import { share } from "./utils/share"; + +export async function shareConversation(id: string, title: string) { + try { + const res = await fetch(`${base}/conversation/${id}/share`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + }); + + if (!res.ok) { + error.set("Error while sharing conversation, try again."); + console.error("Error while sharing conversation: " + (await res.text())); + return; + } + + const { url } = await res.json(); + + share(url, title); + } catch (err) { + error.set(ERROR_MESSAGES.default); + console.error(err); + } +} diff --git a/src/lib/stores/errors.ts b/src/lib/stores/errors.ts new file mode 100644 index 0000000000000000000000000000000000000000..28bc57ee37fbb3efa8daaa07f0b7b67e568aecbd --- /dev/null +++ b/src/lib/stores/errors.ts @@ -0,0 +1,8 @@ +import { writable } from "svelte/store"; + +export const ERROR_MESSAGES = { + default: "Oops, something went wrong.", + authOnly: "You have to be logged in.", +}; + +export const error = writable<string | null>(null); diff --git a/src/lib/stores/pendingMessage.ts b/src/lib/stores/pendingMessage.ts new file mode 100644 index 0000000000000000000000000000000000000000..f28d7aaf9995f9848f6c7988503c20a08d81d97c --- /dev/null +++ b/src/lib/stores/pendingMessage.ts @@ -0,0 +1,3 @@ +import { writable } from "svelte/store"; + +export const pendingMessage = writable<string>(""); diff --git a/src/lib/stores/pendingMessageIdToRetry.ts b/src/lib/stores/pendingMessageIdToRetry.ts new file mode 100644 index 0000000000000000000000000000000000000000..47eec8770ae561b2c4881c5d001a3d46ee699b3b --- /dev/null +++ b/src/lib/stores/pendingMessageIdToRetry.ts @@ -0,0 +1,4 @@ +import type { Message } from "$lib/types/Message"; +import { writable } from "svelte/store"; + +export const pendingMessageIdToRetry = writable<Message["id"] | null>(null); diff --git a/src/lib/stores/webSearchParameters.ts b/src/lib/stores/webSearchParameters.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd088a60621090930e9600c6086380afd2b412e8 --- /dev/null +++ b/src/lib/stores/webSearchParameters.ts @@ -0,0 +1,9 @@ +import { writable } from "svelte/store"; +export interface WebSearchParameters { + useSearch: boolean; + nItems: number; +} +export const webSearchParameters = writable<WebSearchParameters>({ + useSearch: false, + nItems: 5, +}); diff --git a/src/lib/switchTheme.ts b/src/lib/switchTheme.ts new file mode 100644 index 0000000000000000000000000000000000000000..9da30b244c4b20b4585b34a02617895a3499a56f --- /dev/null +++ b/src/lib/switchTheme.ts @@ -0,0 +1,10 @@ +export function switchTheme() { + const { classList } = document.querySelector("html") as HTMLElement; + if (classList.contains("dark")) { + classList.remove("dark"); + localStorage.theme = "light"; + } else { + classList.add("dark"); + localStorage.theme = "dark"; + } +} diff --git a/src/lib/types/AbortedGeneration.ts b/src/lib/types/AbortedGeneration.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe4c2824b4f3257bea71c3acacd65fcee0918188 --- /dev/null +++ b/src/lib/types/AbortedGeneration.ts @@ -0,0 +1,8 @@ +// Ideally shouldn't be needed, see https://github.com/huggingface/chat-ui/pull/88#issuecomment-1523173850 + +import type { Conversation } from "./Conversation"; +import type { Timestamps } from "./Timestamps"; + +export interface AbortedGeneration extends Timestamps { + conversationId: Conversation["_id"]; +} diff --git a/src/lib/types/Conversation.ts b/src/lib/types/Conversation.ts new file mode 100644 index 0000000000000000000000000000000000000000..df5fa821239aec21e184a68f7ffdbb125ceb95b7 --- /dev/null +++ b/src/lib/types/Conversation.ts @@ -0,0 +1,20 @@ +import type { ObjectId } from "mongodb"; +import type { Message } from "./Message"; +import type { Timestamps } from "./Timestamps"; +import type { User } from "./User"; + +export interface Conversation extends Timestamps { + _id: ObjectId; + + sessionId?: string; + userId?: User["_id"]; + + model: string; + + title: string; + messages: Message[]; + + meta?: { + fromShareId?: string; + }; +} diff --git a/src/lib/types/Message.ts b/src/lib/types/Message.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9ceb5c7bee481708f2a1c240d0665ef4614d643 --- /dev/null +++ b/src/lib/types/Message.ts @@ -0,0 +1,7 @@ +export interface Message { + from: "user" | "assistant"; + id: ReturnType<typeof crypto.randomUUID>; + content: string; + webSearchId?: string; + score?: -1 | 0 | 1; +} diff --git a/src/lib/types/Model.ts b/src/lib/types/Model.ts new file mode 100644 index 0000000000000000000000000000000000000000..754210be0dddd380c8a65ed423254a4b610f14ba --- /dev/null +++ b/src/lib/types/Model.ts @@ -0,0 +1,13 @@ +import type { BackendModel } from "$lib/server/models"; + +export type Model = Pick< + BackendModel, + | "id" + | "name" + | "displayName" + | "websiteUrl" + | "datasetName" + | "promptExamples" + | "parameters" + | "description" +>; diff --git a/src/lib/types/Settings.ts b/src/lib/types/Settings.ts new file mode 100644 index 0000000000000000000000000000000000000000..6cf9e618a2aafdc4381f54773803e7cfbf207a29 --- /dev/null +++ b/src/lib/types/Settings.ts @@ -0,0 +1,23 @@ +import { defaultModel } from "$lib/server/models"; +import type { Timestamps } from "./Timestamps"; +import type { User } from "./User"; + +export interface Settings extends Timestamps { + userId?: User["_id"]; + sessionId?: string; + + /** + * Note: Only conversations with this settings explicitly set to true should be shared. + * + * This setting is explicitly set to true when users accept the ethics modal. + * */ + shareConversationsWithModelAuthors: boolean; + ethicsModalAcceptedAt: Date | null; + activeModel: string; +} + +// TODO: move this to a constant file along with other constants +export const DEFAULT_SETTINGS = { + shareConversationsWithModelAuthors: true, + activeModel: defaultModel.id, +}; diff --git a/src/lib/types/SharedConversation.ts b/src/lib/types/SharedConversation.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8981ed83a8871ef49fa539a14cb1ebfca599ea0 --- /dev/null +++ b/src/lib/types/SharedConversation.ts @@ -0,0 +1,12 @@ +import type { Message } from "./Message"; +import type { Timestamps } from "./Timestamps"; + +export interface SharedConversation extends Timestamps { + _id: string; + + hash: string; + + model: string; + title: string; + messages: Message[]; +} diff --git a/src/lib/types/Timestamps.ts b/src/lib/types/Timestamps.ts new file mode 100644 index 0000000000000000000000000000000000000000..12d1867d1be509310190df09d2392bfaa77d6500 --- /dev/null +++ b/src/lib/types/Timestamps.ts @@ -0,0 +1,4 @@ +export interface Timestamps { + createdAt: Date; + updatedAt: Date; +} diff --git a/src/lib/types/UrlDependency.ts b/src/lib/types/UrlDependency.ts new file mode 100644 index 0000000000000000000000000000000000000000..dca26f87f494d42c15d5f6079a0a5cacd81e59a9 --- /dev/null +++ b/src/lib/types/UrlDependency.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-shadow */ +export enum UrlDependency { + ConversationList = "conversation:list", + Conversation = "conversation", +} diff --git a/src/lib/types/User.ts b/src/lib/types/User.ts new file mode 100644 index 0000000000000000000000000000000000000000..7cd8d10377b265231033dd04b68ab2229dedd714 --- /dev/null +++ b/src/lib/types/User.ts @@ -0,0 +1,15 @@ +import type { ObjectId } from "mongodb"; +import type { Timestamps } from "./Timestamps"; + +export interface User extends Timestamps { + _id: ObjectId; + + username?: string; + name: string; + email?: string; + avatarUrl: string; + hfUserId: string; + + // Session identifier, stored in the cookie + sessionId: string; +} diff --git a/src/lib/types/WebSearch.ts b/src/lib/types/WebSearch.ts new file mode 100644 index 0000000000000000000000000000000000000000..2b3bd799d936839ee5a31c3d0b0bc20b473d37a3 --- /dev/null +++ b/src/lib/types/WebSearch.ts @@ -0,0 +1,40 @@ +import type { ObjectId } from "mongodb"; +import type { Conversation } from "./Conversation"; +import type { Timestamps } from "./Timestamps"; + +export interface WebSearch extends Timestamps { + _id: ObjectId; + + convId: Conversation["_id"]; + + prompt: string; + + searchQuery: string; + results: string[]; + knowledgeGraph: string; + summary: string; + + messages: WebSearchMessage[]; +} + +export type WebSearchMessageUpdate = { + type: "update"; + message: string; + args?: string[]; +}; + +export type WebSearchMessageError = { + type: "error"; + message: string; + args?: string[]; +}; + +export type WebSearchMessageResult = { + type: "result"; + id: string; +}; + +export type WebSearchMessage = + | WebSearchMessageUpdate + | WebSearchMessageResult + | WebSearchMessageError; diff --git a/src/lib/utils/analytics.ts b/src/lib/utils/analytics.ts new file mode 100644 index 0000000000000000000000000000000000000000..72fd5d70df54c0436a8aa3f5fca4dfbcb5f64ff5 --- /dev/null +++ b/src/lib/utils/analytics.ts @@ -0,0 +1,39 @@ +export interface GAEvent { + hitType: "event"; + eventCategory: string; + eventAction: string; + eventLabel?: string; + eventValue?: number; +} + +// Send a Google Analytics event +export function sendAnalyticsEvent({ + eventCategory, + eventAction, + eventLabel, + eventValue, +}: Omit<GAEvent, "hitType">): void { + // Mandatory fields + const event: GAEvent = { + hitType: "event", + eventCategory, + eventAction, + }; + // Optional fields + if (eventLabel) { + event.eventLabel = eventLabel; + } + if (eventValue) { + event.eventValue = eventValue; + } + + // @ts-expect-error typescript doesn't know gtag is on the window object + if (!!window?.gtag && typeof window?.gtag === "function") { + // @ts-expect-error typescript doesn't know gtag is on the window object + window?.gtag("event", eventAction, { + event_category: event.eventCategory, + event_label: event.eventLabel, + value: event.eventValue, + }); + } +} diff --git a/src/lib/utils/concatUint8Arrays.ts b/src/lib/utils/concatUint8Arrays.ts new file mode 100644 index 0000000000000000000000000000000000000000..e53396eca7e3dee20a543fb6ac28ecf48c7e3965 --- /dev/null +++ b/src/lib/utils/concatUint8Arrays.ts @@ -0,0 +1,12 @@ +import { sum } from "./sum"; + +export function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array { + const totalLength = sum(arrays.map((a) => a.length)); + const result = new Uint8Array(totalLength); + let offset = 0; + for (const array of arrays) { + result.set(array, offset); + offset += array.length; + } + return result; +} diff --git a/src/lib/utils/deepestChild.ts b/src/lib/utils/deepestChild.ts new file mode 100644 index 0000000000000000000000000000000000000000..ac6ed1d1dd64e6f3a8bbd559887de77b3e49f8c3 --- /dev/null +++ b/src/lib/utils/deepestChild.ts @@ -0,0 +1,6 @@ +export function deepestChild(el: HTMLElement): HTMLElement { + if (el.lastElementChild && el.lastElementChild.nodeType !== Node.TEXT_NODE) { + return deepestChild(el.lastElementChild as HTMLElement); + } + return el; +} diff --git a/src/lib/utils/models.ts b/src/lib/utils/models.ts new file mode 100644 index 0000000000000000000000000000000000000000..181288d8d6a2cc1a852c9087dcbb8a3392e70051 --- /dev/null +++ b/src/lib/utils/models.ts @@ -0,0 +1,4 @@ +import type { Model } from "$lib/types/Model"; + +export const findCurrentModel = (models: Model[], id?: string) => + models.find((m) => m.id === id) ?? models[0]; diff --git a/src/lib/utils/randomUuid.ts b/src/lib/utils/randomUuid.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d536365c57659305ad28d6fc06b89d77ab337ab --- /dev/null +++ b/src/lib/utils/randomUuid.ts @@ -0,0 +1,14 @@ +type UUID = ReturnType<typeof crypto.randomUUID>; + +export function randomUUID(): UUID { + // Only on old safari / ios + if (!("randomUUID" in crypto)) { + return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => + ( + Number(c) ^ + (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (Number(c) / 4))) + ).toString(16) + ) as UUID; + } + return crypto.randomUUID(); +} diff --git a/src/lib/utils/sha256.ts b/src/lib/utils/sha256.ts new file mode 100644 index 0000000000000000000000000000000000000000..43059b518fc5a4da6ed08ab36aeb6c289007f6aa --- /dev/null +++ b/src/lib/utils/sha256.ts @@ -0,0 +1,7 @@ +export async function sha256(input: string): Promise<string> { + const utf8 = new TextEncoder().encode(input); + const hashBuffer = await crypto.subtle.digest("SHA-256", utf8); + const hashArray = Array.from(new Uint8Array(hashBuffer)); + const hashHex = hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join(""); + return hashHex; +} diff --git a/src/lib/utils/share.ts b/src/lib/utils/share.ts new file mode 100644 index 0000000000000000000000000000000000000000..4587669a10164aa7c961429fbddec9cf438c0eca --- /dev/null +++ b/src/lib/utils/share.ts @@ -0,0 +1,7 @@ +export function share(url: string, title: string) { + if (navigator.share) { + navigator.share({ url, title }); + } else { + prompt("Copy this public url to share:", url); + } +} diff --git a/src/lib/utils/streamToAsyncIterable.ts b/src/lib/utils/streamToAsyncIterable.ts new file mode 100644 index 0000000000000000000000000000000000000000..e935d719c8c29eb5e4efc30812f61b5f44716923 --- /dev/null +++ b/src/lib/utils/streamToAsyncIterable.ts @@ -0,0 +1,15 @@ +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of#iterating_over_async_generators +export async function* streamToAsyncIterable( + stream: ReadableStream<Uint8Array> +): AsyncIterableIterator<Uint8Array> { + const reader = stream.getReader(); + try { + while (true) { + const { done, value } = await reader.read(); + if (done) return; + yield value; + } + } finally { + reader.releaseLock(); + } +} diff --git a/src/lib/utils/sum.ts b/src/lib/utils/sum.ts new file mode 100644 index 0000000000000000000000000000000000000000..289b70584ef9f7795b1f4b1bf0151237dc2c55ff --- /dev/null +++ b/src/lib/utils/sum.ts @@ -0,0 +1,3 @@ +export function sum(nums: number[]): number { + return nums.reduce((a, b) => a + b, 0); +} diff --git a/src/lib/utils/trimPrefix.ts b/src/lib/utils/trimPrefix.ts new file mode 100644 index 0000000000000000000000000000000000000000..d006e66deca639f3f4d208e77a64ba368fab00ee --- /dev/null +++ b/src/lib/utils/trimPrefix.ts @@ -0,0 +1,6 @@ +export function trimPrefix(input: string, prefix: string) { + if (input.startsWith(prefix)) { + return input.slice(prefix.length); + } + return input; +} diff --git a/src/lib/utils/trimSuffix.ts b/src/lib/utils/trimSuffix.ts new file mode 100644 index 0000000000000000000000000000000000000000..729107942ebaa2d7e1281dd77f8e52e8b135a5ad --- /dev/null +++ b/src/lib/utils/trimSuffix.ts @@ -0,0 +1,6 @@ +export function trimSuffix(input: string, end: string): string { + if (input.endsWith(end)) { + return input.slice(0, input.length - end.length); + } + return input; +} diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 0000000000000000000000000000000000000000..6836376aa41a8ef0bef4064e070e5de5c184879e --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,15 @@ +<script lang="ts"> + import { page } from "$app/stores"; +</script> + +<div + class="flex items-center justify-center bg-gradient-to-t from-gray-200 text-gray-800 dark:from-gray-700 dark:text-gray-300" +> + <div + class="align-center -mt-24 flex flex-col justify-center rounded-xl border bg-white px-8 pb-2 pt-4 text-center dark:border-gray-700 dark:bg-gray-800" + > + <h1 class="mb-2 text-5xl font-semibold">{$page.status}</h1> + <div class="-mx-8 my-2 h-px bg-gray-200 dark:bg-gray-700" /> + <h2 class="max-w-sm text-lg">{$page.error?.message}</h2> + </div> +</div> diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..28e8e79e4a8ad8d950babaea9c3dcd3aa5c647e2 --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1,84 @@ +import { redirect } from "@sveltejs/kit"; +import type { LayoutServerLoad } from "./$types"; +import { collections } from "$lib/server/database"; +import type { Conversation } from "$lib/types/Conversation"; +import { UrlDependency } from "$lib/types/UrlDependency"; +import { defaultModel, models, oldModels, validateModel } from "$lib/server/models"; +import { authCondition, requiresUser } from "$lib/server/auth"; +import { DEFAULT_SETTINGS } from "$lib/types/Settings"; +import { SERPAPI_KEY } from "$env/static/private"; + +export const load: LayoutServerLoad = async ({ locals, depends, url }) => { + const { conversations } = collections; + const urlModel = url.searchParams.get("model"); + + depends(UrlDependency.ConversationList); + + if (urlModel) { + const isValidModel = validateModel(models).safeParse(urlModel).success; + + if (isValidModel) { + await collections.settings.updateOne( + authCondition(locals), + { $set: { activeModel: urlModel } }, + { upsert: true } + ); + } + + throw redirect(302, url.pathname); + } + + const settings = await collections.settings.findOne(authCondition(locals)); + + // If the active model in settings is not valid, set it to the default model. This can happen if model was disabled. + if (settings && !validateModel(models).safeParse(settings?.activeModel).success) { + settings.activeModel = defaultModel.id; + await collections.settings.updateOne(authCondition(locals), { + $set: { activeModel: defaultModel.id }, + }); + } + + return { + conversations: await conversations + .find(authCondition(locals)) + .sort({ updatedAt: -1 }) + .project<Pick<Conversation, "title" | "model" | "_id" | "updatedAt" | "createdAt">>({ + title: 1, + model: 1, + _id: 1, + updatedAt: 1, + createdAt: 1, + }) + .map((conv) => ({ + id: conv._id.toString(), + title: conv.title, + model: conv.model ?? defaultModel, + })) + .toArray(), + settings: { + shareConversationsWithModelAuthors: + settings?.shareConversationsWithModelAuthors ?? + DEFAULT_SETTINGS.shareConversationsWithModelAuthors, + ethicsModalAcceptedAt: settings?.ethicsModalAcceptedAt ?? null, + activeModel: settings?.activeModel ?? DEFAULT_SETTINGS.activeModel, + searchEnabled: !!SERPAPI_KEY, + }, + models: models.map((model) => ({ + id: model.id, + name: model.name, + websiteUrl: model.websiteUrl, + datasetName: model.datasetName, + displayName: model.displayName, + description: model.description, + promptExamples: model.promptExamples, + parameters: model.parameters, + })), + oldModels, + user: locals.user && { + username: locals.user.username, + avatarUrl: locals.user.avatarUrl, + email: locals.user.email, + }, + requiresLogin: requiresUser, + }; +}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte new file mode 100644 index 0000000000000000000000000000000000000000..aee567b08e201c0939c755cb97421c5df321a411 --- /dev/null +++ b/src/routes/+layout.svelte @@ -0,0 +1,185 @@ +<script lang="ts"> + import { onDestroy } from "svelte"; + import { goto, invalidate } from "$app/navigation"; + import { page } from "$app/stores"; + import "../styles/main.css"; + import { base } from "$app/paths"; + import { PUBLIC_ORIGIN, PUBLIC_APP_DISCLAIMER } from "$env/static/public"; + + import { shareConversation } from "$lib/shareConversation"; + import { UrlDependency } from "$lib/types/UrlDependency"; + import { error } from "$lib/stores/errors"; + + import MobileNav from "$lib/components/MobileNav.svelte"; + import NavMenu from "$lib/components/NavMenu.svelte"; + import Toast from "$lib/components/Toast.svelte"; + import SettingsModal from "$lib/components/SettingsModal.svelte"; + import LoginModal from "$lib/components/LoginModal.svelte"; + import { PUBLIC_APP_ASSETS, PUBLIC_APP_NAME } from "$env/static/public"; + + export let data; + + let isNavOpen = false; + let isSettingsOpen = false; + let errorToastTimeout: ReturnType<typeof setTimeout>; + let currentError: string | null; + + async function onError() { + // If a new different error comes, wait for the current error to hide first + if ($error && currentError && $error !== currentError) { + clearTimeout(errorToastTimeout); + currentError = null; + await new Promise((resolve) => setTimeout(resolve, 300)); + } + + currentError = $error; + + errorToastTimeout = setTimeout(() => { + $error = null; + currentError = null; + }, 3000); + } + + async function deleteConversation(id: string) { + try { + const res = await fetch(`${base}/conversation/${id}`, { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + }); + + if (!res.ok) { + $error = "Error while deleting conversation, try again."; + return; + } + + if ($page.params.id !== id) { + await invalidate(UrlDependency.ConversationList); + } else { + await goto(`${base}/`, { invalidateAll: true }); + } + } catch (err) { + console.error(err); + $error = String(err); + } + } + + async function editConversationTitle(id: string, title: string) { + try { + const res = await fetch(`${base}/conversation/${id}`, { + method: "PATCH", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ title }), + }); + + if (!res.ok) { + $error = "Error while editing title, try again."; + return; + } + + await invalidate(UrlDependency.ConversationList); + } catch (err) { + console.error(err); + $error = String(err); + } + } + + onDestroy(() => { + clearTimeout(errorToastTimeout); + }); + + $: if ($error) onError(); + + const requiresLogin = + !$page.error && + !$page.route.id?.startsWith("/r/") && + (data.requiresLogin + ? !data.user + : !data.settings.ethicsModalAcceptedAt && !!PUBLIC_APP_DISCLAIMER); +</script> + +<svelte:head> + <title>{PUBLIC_APP_NAME}</title> + <meta name="description" content="The first open source alternative to ChatGPT. 💪" /> + <meta name="twitter:card" content="summary_large_image" /> + <meta name="twitter:site" content="@huggingface" /> + <meta property="og:title" content={PUBLIC_APP_NAME} /> + <meta property="og:type" content="website" /> + <meta property="og:url" content="{PUBLIC_ORIGIN || $page.url.origin}{base}" /> + <meta + property="og:image" + content="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/thumbnail.png" + /> + <link + rel="icon" + href="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/favicon.svg" + type="image/svg+xml" + /> + <link + rel="icon" + href="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/favicon.png" + type="image/png" + /> + <!-- Icon Support for iOS Bookmark Home Screen --> + <link + rel="apple-touch-icon" + href="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/touch-icon-ipad-retina.png" + sizes="167x167" + type="image/png" + /> + <link + rel="apple-touch-icon" + href="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/touch-icon-ipad.png" + sizes="152x152" + type="image/png" + /> + <link + rel="apple-touch-icon" + href="{PUBLIC_ORIGIN || + $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/touch-icon-iphone-retina.png" + sizes="180x180" + type="image/png" + /> +</svelte:head> + +<div + class="grid h-full w-screen grid-cols-1 grid-rows-[auto,1fr] overflow-hidden text-smd dark:text-gray-300 md:grid-cols-[280px,1fr] md:grid-rows-[1fr]" +> + <MobileNav + isOpen={isNavOpen} + on:toggle={(ev) => (isNavOpen = ev.detail)} + title={data.conversations.find((conv) => conv.id === $page.params.id)?.title} + > + <NavMenu + conversations={data.conversations} + user={data.user} + on:shareConversation={(ev) => shareConversation(ev.detail.id, ev.detail.title)} + on:deleteConversation={(ev) => deleteConversation(ev.detail)} + on:clickSettings={() => (isSettingsOpen = true)} + on:editConversationTitle={(ev) => editConversationTitle(ev.detail.id, ev.detail.title)} + /> + </MobileNav> + <nav class="grid max-h-screen grid-cols-1 grid-rows-[auto,1fr,auto] max-md:hidden"> + <NavMenu + conversations={data.conversations} + user={data.user} + on:shareConversation={(ev) => shareConversation(ev.detail.id, ev.detail.title)} + on:deleteConversation={(ev) => deleteConversation(ev.detail)} + on:clickSettings={() => (isSettingsOpen = true)} + on:editConversationTitle={(ev) => editConversationTitle(ev.detail.id, ev.detail.title)} + /> + </nav> + {#if currentError} + <Toast message={currentError} /> + {/if} + {#if isSettingsOpen} + <SettingsModal on:close={() => (isSettingsOpen = false)} settings={data.settings} /> + {/if} + {#if requiresLogin} + <LoginModal settings={data.settings} /> + {/if} + <slot /> +</div> diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte new file mode 100644 index 0000000000000000000000000000000000000000..b2a76b571fb560ac051f48948ca2bace23e96d6b --- /dev/null +++ b/src/routes/+page.svelte @@ -0,0 +1,51 @@ +<script lang="ts"> + import { goto } from "$app/navigation"; + import { base } from "$app/paths"; + import ChatWindow from "$lib/components/chat/ChatWindow.svelte"; + import { ERROR_MESSAGES, error } from "$lib/stores/errors"; + import { pendingMessage } from "$lib/stores/pendingMessage"; + import { findCurrentModel } from "$lib/utils/models"; + + export let data; + let loading = false; + + async function createConversation(message: string) { + try { + loading = true; + const res = await fetch(`${base}/conversation`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ model: data.settings.activeModel }), + }); + + if (!res.ok) { + error.set("Error while creating conversation, try again."); + console.error("Error while creating conversation: " + (await res.text())); + return; + } + + const { conversationId } = await res.json(); + + // Ugly hack to use a store as temp storage, feel free to improve ^^ + pendingMessage.set(message); + + // invalidateAll to update list of conversations + await goto(`${base}/conversation/${conversationId}`, { invalidateAll: true }); + } catch (err) { + error.set(ERROR_MESSAGES.default); + console.error(err); + } finally { + loading = false; + } + } +</script> + +<ChatWindow + on:message={(ev) => createConversation(ev.detail)} + {loading} + currentModel={findCurrentModel([...data.models, ...data.oldModels], data.settings.activeModel)} + models={data.models} + settings={data.settings} +/> diff --git a/src/routes/admin/export/+server.ts b/src/routes/admin/export/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..2cdae1f2aa779316e5998907a2b0484be2847cfc --- /dev/null +++ b/src/routes/admin/export/+server.ts @@ -0,0 +1,166 @@ +import { + PARQUET_EXPORT_DATASET, + PARQUET_EXPORT_HF_TOKEN, + PARQUET_EXPORT_SECRET, +} from "$env/static/private"; +import { collections } from "$lib/server/database"; +import type { Message } from "$lib/types/Message"; +import { error } from "@sveltejs/kit"; +import { pathToFileURL } from "node:url"; +import { unlink } from "node:fs/promises"; +import { uploadFile } from "@huggingface/hub"; +import parquet from "parquetjs"; +import { z } from "zod"; + +// Triger like this: +// curl -X POST "http://localhost:5173/chat/admin/export" -H "Authorization: Bearer <PARQUET_EXPORT_SECRET>" -H "Content-Type: application/json" -d '{"model": "OpenAssistant/oasst-sft-6-llama-30b-xor"}' + +export async function POST({ request }) { + if (!PARQUET_EXPORT_SECRET || !PARQUET_EXPORT_DATASET || !PARQUET_EXPORT_HF_TOKEN) { + throw error(500, "Parquet export is not configured."); + } + + if (request.headers.get("Authorization") !== `Bearer ${PARQUET_EXPORT_SECRET}`) { + throw error(403); + } + + const { model } = z + .object({ + model: z.string(), + }) + .parse(await request.json()); + + const schema = new parquet.ParquetSchema({ + title: { type: "UTF8" }, + created_at: { type: "TIMESTAMP_MILLIS" }, + updated_at: { type: "TIMESTAMP_MILLIS" }, + messages: { + repeated: true, + fields: { + from: { type: "UTF8" }, + content: { type: "UTF8" }, + score: { type: "INT_8", optional: true }, + }, + }, + }); + + const fileName = `/tmp/conversations-${new Date().toJSON().slice(0, 10)}-${Date.now()}.parquet`; + + const writer = await parquet.ParquetWriter.openFile(schema, fileName); + + let count = 0; + console.log("Exporting conversations for model", model); + + for await (const conversation of collections.settings.aggregate<{ + title: string; + created_at: Date; + updated_at: Date; + messages: Message[]; + }>([ + { + $match: { + shareConversationsWithModelAuthors: true, + sessionId: { $exists: true }, + userId: { $exists: false }, + }, + }, + { + $lookup: { + from: "conversations", + localField: "sessionId", + foreignField: "sessionId", + as: "conversations", + pipeline: [{ $match: { model, userId: { $exists: false } } }], + }, + }, + { $unwind: "$conversations" }, + { + $project: { + title: "$conversations.title", + created_at: "$conversations.createdAt", + updated_at: "$conversations.updatedAt", + messages: "$conversations.messages", + }, + }, + ])) { + await writer.appendRow({ + title: conversation.title, + created_at: conversation.created_at, + updated_at: conversation.updated_at, + messages: conversation.messages.map((message: Message) => ({ + from: message.from, + content: message.content, + ...(message.score ? { score: message.score } : undefined), + })), + }); + ++count; + + if (count % 1_000 === 0) { + console.log("Exported", count, "conversations"); + } + } + + console.log("exporting convos with userId"); + + for await (const conversation of collections.settings.aggregate<{ + title: string; + created_at: Date; + updated_at: Date; + messages: Message[]; + }>([ + { $match: { shareConversationsWithModelAuthors: true, userId: { $exists: true } } }, + { + $lookup: { + from: "conversations", + localField: "userId", + foreignField: "userId", + as: "conversations", + pipeline: [{ $match: { model } }], + }, + }, + { $unwind: "$conversations" }, + { + $project: { + title: "$conversations.title", + created_at: "$conversations.createdAt", + updated_at: "$conversations.updatedAt", + messages: "$conversations.messages", + }, + }, + ])) { + await writer.appendRow({ + title: conversation.title, + created_at: conversation.created_at, + updated_at: conversation.updated_at, + messages: conversation.messages.map((message: Message) => ({ + from: message.from, + content: message.content, + ...(message.score ? { score: message.score } : undefined), + })), + }); + ++count; + + if (count % 1_000 === 0) { + console.log("Exported", count, "conversations"); + } + } + + await writer.close(); + + console.log("Uploading", fileName, "to Hugging Face Hub"); + + await uploadFile({ + file: pathToFileURL(fileName), + credentials: { accessToken: PARQUET_EXPORT_HF_TOKEN }, + repo: { + type: "dataset", + name: PARQUET_EXPORT_DATASET, + }, + }); + + console.log("Upload done"); + + await unlink(fileName); + + return new Response(); +} diff --git a/src/routes/conversation/+server.ts b/src/routes/conversation/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..fbf6034f90b4ac27b7ae9c41b69e8c8516252556 --- /dev/null +++ b/src/routes/conversation/+server.ts @@ -0,0 +1,61 @@ +import type { RequestHandler } from "./$types"; +import { collections } from "$lib/server/database"; +import { ObjectId } from "mongodb"; +import { error, redirect } from "@sveltejs/kit"; +import { base } from "$app/paths"; +import { z } from "zod"; +import type { Message } from "$lib/types/Message"; +import { models, validateModel } from "$lib/server/models"; +import { authCondition } from "$lib/server/auth"; + +export const POST: RequestHandler = async ({ locals, request }) => { + const body = await request.text(); + + let title = ""; + let messages: Message[] = []; + + const values = z + .object({ + fromShare: z.string().optional(), + model: validateModel(models), + }) + .parse(JSON.parse(body)); + + if (values.fromShare) { + const conversation = await collections.sharedConversations.findOne({ + _id: values.fromShare, + }); + + if (!conversation) { + throw error(404, "Conversation not found"); + } + + title = conversation.title; + messages = conversation.messages; + values.model = conversation.model; + } + + const res = await collections.conversations.insertOne({ + _id: new ObjectId(), + title: + title || + "Untitled " + ((await collections.conversations.countDocuments(authCondition(locals))) + 1), + messages, + model: values.model, + createdAt: new Date(), + updatedAt: new Date(), + ...(locals.user ? { userId: locals.user._id } : { sessionId: locals.sessionId }), + ...(values.fromShare ? { meta: { fromShareId: values.fromShare } } : {}), + }); + + return new Response( + JSON.stringify({ + conversationId: res.insertedId.toString(), + }), + { headers: { "Content-Type": "application/json" } } + ); +}; + +export const GET: RequestHandler = async () => { + throw redirect(302, `${base}/`); +}; diff --git a/src/routes/conversation/[id]/+page.server.ts b/src/routes/conversation/[id]/+page.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..500b832a1f21a6497f8132da76911bf57cdca04a --- /dev/null +++ b/src/routes/conversation/[id]/+page.server.ts @@ -0,0 +1,52 @@ +import { collections } from "$lib/server/database"; +import { ObjectId } from "mongodb"; +import { error } from "@sveltejs/kit"; +import { authCondition } from "$lib/server/auth"; +import type { WebSearchMessageResult } from "$lib/types/WebSearch"; +import { UrlDependency } from "$lib/types/UrlDependency"; + +export const load = async ({ params, depends, locals }) => { + // todo: add validation on params.id + const conversation = await collections.conversations.findOne({ + _id: new ObjectId(params.id), + ...authCondition(locals), + }); + + depends(UrlDependency.Conversation); + + if (!conversation) { + const conversationExists = + (await collections.conversations.countDocuments({ + _id: new ObjectId(params.id), + })) !== 0; + + if (conversationExists) { + throw error( + 403, + "You don't have access to this conversation. If someone gave you this link, ask them to use the 'share' feature instead." + ); + } + + throw error(404, "Conversation not found."); + } + + const webSearchesId = conversation.messages + .filter((message) => message.webSearchId) + .map((message) => new ObjectId(message.webSearchId)); + + const results = await collections.webSearches.find({ _id: { $in: webSearchesId } }).toArray(); + + const searches = Object.fromEntries( + results.map((x) => [ + x._id.toString(), + [...x.messages, { type: "result", id: x._id.toString() } satisfies WebSearchMessageResult], + ]) + ); + + return { + messages: conversation.messages, + title: conversation.title, + model: conversation.model, + searches, + }; +}; diff --git a/src/routes/conversation/[id]/+page.svelte b/src/routes/conversation/[id]/+page.svelte new file mode 100644 index 0000000000000000000000000000000000000000..4a7b9e5676669e07a096e295567c1b0b82327738 --- /dev/null +++ b/src/routes/conversation/[id]/+page.svelte @@ -0,0 +1,280 @@ +<script lang="ts"> + import ChatWindow from "$lib/components/chat/ChatWindow.svelte"; + import { pendingMessage } from "$lib/stores/pendingMessage"; + import { pendingMessageIdToRetry } from "$lib/stores/pendingMessageIdToRetry"; + import { onMount } from "svelte"; + import { page } from "$app/stores"; + import { textGenerationStream, type Options } from "@huggingface/inference"; + import { invalidate } from "$app/navigation"; + import { base } from "$app/paths"; + import { shareConversation } from "$lib/shareConversation"; + import { UrlDependency } from "$lib/types/UrlDependency"; + import { ERROR_MESSAGES, error } from "$lib/stores/errors"; + import { randomUUID } from "$lib/utils/randomUuid"; + import { findCurrentModel } from "$lib/utils/models"; + import { webSearchParameters } from "$lib/stores/webSearchParameters"; + import type { WebSearchMessage } from "$lib/types/WebSearch"; + import type { Message } from "$lib/types/Message"; + import { browser } from "$app/environment"; + + export let data; + + let messages = data.messages; + let lastLoadedMessages = data.messages; + let isAborted = false; + + let webSearchMessages: WebSearchMessage[] = []; + + // Since we modify the messages array locally, we don't want to reset it if an old version is passed + $: if (data.messages !== lastLoadedMessages) { + messages = data.messages; + lastLoadedMessages = data.messages; + } + + let loading = false; + let pending = false; + + async function getTextGenerationStream( + inputs: string, + messageId: string, + isRetry = false, + webSearchId?: string + ) { + let conversationId = $page.params.id; + const responseId = randomUUID(); + + const response = textGenerationStream( + { + model: $page.url.href, + inputs, + parameters: { + ...data.models.find((m) => m.id === data.model)?.parameters, + return_full_text: false, + }, + }, + { + id: messageId, + response_id: responseId, + is_retry: isRetry, + use_cache: false, + web_search_id: webSearchId, + } as Options + ); + + for await (const output of response) { + pending = false; + + if (!output) { + break; + } + + if (conversationId !== $page.params.id) { + fetch(`${base}/conversation/${conversationId}/stop-generating`, { + method: "POST", + }).catch(console.error); + break; + } + + if (isAborted) { + isAborted = false; + fetch(`${base}/conversation/${conversationId}/stop-generating`, { + method: "POST", + }).catch(console.error); + break; + } + + // final message + if (output.generated_text) { + const lastMessage = messages[messages.length - 1]; + + if (lastMessage) { + lastMessage.content = output.generated_text; + lastMessage.webSearchId = webSearchId; + messages = [...messages]; + } + break; + } + + if (!output.token.special) { + const lastMessage = messages[messages.length - 1]; + + if (lastMessage?.from !== "assistant") { + // First token has a space at the beginning, trim it + messages = [ + ...messages, + // id doesn't match the backend id but it's not important for assistant messages + { from: "assistant", content: output.token.text.trimStart(), id: responseId }, + ]; + } else { + lastMessage.content += output.token.text; + messages = [...messages]; + } + } + } + } + + async function summarizeTitle(id: string) { + await fetch(`${base}/conversation/${id}/summarize`, { + method: "POST", + }); + } + + async function writeMessage(message: string, messageId = randomUUID()) { + if (!message.trim()) return; + + try { + isAborted = false; + loading = true; + pending = true; + + let retryMessageIndex = messages.findIndex((msg) => msg.id === messageId); + const isRetry = retryMessageIndex !== -1; + if (!isRetry) { + retryMessageIndex = messages.length; + } + + messages = [ + ...messages.slice(0, retryMessageIndex), + { from: "user", content: message, id: messageId }, + ]; + + let searchResponseId: string | null = ""; + if ($webSearchParameters.useSearch) { + webSearchMessages = []; + + const res = await fetch( + `${base}/conversation/${$page.params.id}/web-search?` + + new URLSearchParams({ prompt: message }), + { + method: "GET", + } + ); + + // required bc linting doesn't see TextDecoderStream for some reason? + // eslint-disable-next-line no-undef + const encoder = new TextDecoderStream(); + const reader = res?.body?.pipeThrough(encoder).getReader(); + + while (searchResponseId === "") { + await new Promise((r) => setTimeout(r, 25)); + + if (isAborted) { + reader?.cancel(); + return; + } + + reader + ?.read() + .then(async ({ done, value }) => { + if (done) { + reader.cancel(); + return; + } + + try { + webSearchMessages = (JSON.parse(value) as { messages: WebSearchMessage[] }) + .messages; + } catch (parseError) { + // in case of parsing error we wait for the next message + return; + } + + const lastSearchMessage = webSearchMessages[webSearchMessages.length - 1]; + if (lastSearchMessage.type === "result") { + searchResponseId = lastSearchMessage.id; + reader.cancel(); + return; + } + }) + .catch(() => { + searchResponseId = null; + }); + } + } + + await getTextGenerationStream(message, messageId, isRetry, searchResponseId ?? undefined); + + webSearchMessages = []; + if (browser) invalidate(UrlDependency.Conversation); + + if (messages.filter((m) => m.from === "user").length === 1) { + summarizeTitle($page.params.id) + .then(() => invalidate(UrlDependency.ConversationList)) + .catch(console.error); + } else { + await invalidate(UrlDependency.ConversationList); + } + } catch (err) { + if (err instanceof Error && err.message.includes("overloaded")) { + $error = "Too much traffic, please try again."; + } else if (err instanceof Error) { + $error = err.message; + } else { + $error = ERROR_MESSAGES.default; + } + console.error(err); + } finally { + loading = false; + pending = false; + } + } + + async function voteMessage(score: Message["score"], messageId: string) { + let conversationId = $page.params.id; + let oldScore: Message["score"] | undefined; + + // optimistic update to avoid waiting for the server + messages = messages.map((message) => { + if (message.id === messageId) { + oldScore = message.score; + return { ...message, score: score }; + } + return message; + }); + + try { + await fetch(`${base}/conversation/${conversationId}/message/${messageId}/vote`, { + method: "POST", + body: JSON.stringify({ score }), + }); + } catch { + // revert score on any error + messages = messages.map((message) => { + return message.id !== messageId ? message : { ...message, score: oldScore }; + }); + } + } + + onMount(async () => { + if ($pendingMessage) { + const val = $pendingMessage; + const messageId = $pendingMessageIdToRetry || undefined; + $pendingMessage = ""; + $pendingMessageIdToRetry = null; + + writeMessage(val, messageId); + } + }); + $: $page.params.id, (isAborted = true); + $: title = data.conversations.find((conv) => conv.id === $page.params.id)?.title ?? data.title; +</script> + +<svelte:head> + <title>{title}</title> +</svelte:head> + +<ChatWindow + {loading} + {pending} + {messages} + bind:webSearchMessages + searches={{ ...data.searches }} + on:message={(event) => writeMessage(event.detail)} + on:retry={(event) => writeMessage(event.detail.content, event.detail.id)} + on:vote={(event) => voteMessage(event.detail.score, event.detail.id)} + on:share={() => shareConversation($page.params.id, data.title)} + on:stop={() => (isAborted = true)} + models={data.models} + currentModel={findCurrentModel([...data.models, ...data.oldModels], data.model)} + settings={data.settings} +/> diff --git a/src/routes/conversation/[id]/+server.ts b/src/routes/conversation/[id]/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b0a3a895b56830cf50c9339e74c7046472e7abe --- /dev/null +++ b/src/routes/conversation/[id]/+server.ts @@ -0,0 +1,256 @@ +import { buildPrompt } from "$lib/buildPrompt"; +import { PUBLIC_SEP_TOKEN } from "$lib/constants/publicSepToken"; +import { abortedGenerations } from "$lib/server/abortedGenerations"; +import { authCondition } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import { modelEndpoint } from "$lib/server/modelEndpoint"; +import { models } from "$lib/server/models"; +import type { Message } from "$lib/types/Message"; +import { concatUint8Arrays } from "$lib/utils/concatUint8Arrays"; +import { streamToAsyncIterable } from "$lib/utils/streamToAsyncIterable"; +import { trimPrefix } from "$lib/utils/trimPrefix"; +import { trimSuffix } from "$lib/utils/trimSuffix"; +import type { TextGenerationStreamOutput } from "@huggingface/inference"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; +import { z } from "zod"; + +export async function POST({ request, fetch, locals, params }) { + const id = z.string().parse(params.id); + const convId = new ObjectId(id); + const date = new Date(); + + const conv = await collections.conversations.findOne({ + _id: convId, + ...authCondition(locals), + }); + + if (!conv) { + throw error(404, "Conversation not found"); + } + + const model = models.find((m) => m.id === conv.model); + + if (!model) { + throw error(410, "Model not available anymore"); + } + + const json = await request.json(); + const { + inputs: newPrompt, + options: { id: messageId, is_retry, web_search_id, response_id: responseId }, + } = z + .object({ + inputs: z.string().trim().min(1), + options: z.object({ + id: z.optional(z.string().uuid()), + response_id: z.optional(z.string().uuid()), + is_retry: z.optional(z.boolean()), + web_search_id: z.ostring(), + }), + }) + .parse(json); + + const messages = (() => { + if (is_retry && messageId) { + let retryMessageIdx = conv.messages.findIndex((message) => message.id === messageId); + if (retryMessageIdx === -1) { + retryMessageIdx = conv.messages.length; + } + return [ + ...conv.messages.slice(0, retryMessageIdx), + { content: newPrompt, from: "user", id: messageId as Message["id"] }, + ]; + } + return [ + ...conv.messages, + { content: newPrompt, from: "user", id: (messageId as Message["id"]) || crypto.randomUUID() }, + ]; + })() satisfies Message[]; + + const prompt = await buildPrompt(messages, model, web_search_id); + const randomEndpoint = modelEndpoint(model); + + const abortController = new AbortController(); + + const resp = await fetch(randomEndpoint.url, { + headers: { + "Content-Type": request.headers.get("Content-Type") ?? "application/json", + Authorization: randomEndpoint.authorization, + }, + method: "POST", + body: JSON.stringify({ + ...json, + inputs: prompt, + }), + signal: abortController.signal, + }); + + if (!resp.body) { + throw new Error("Response body is empty"); + } + + const [stream1, stream2] = resp.body.tee(); + + async function saveMessage() { + let generated_text = await parseGeneratedText(stream2, convId, date, abortController); + + // We could also check if PUBLIC_ASSISTANT_MESSAGE_TOKEN is present and use it to slice the text + if (generated_text.startsWith(prompt)) { + generated_text = generated_text.slice(prompt.length); + } + + generated_text = trimSuffix( + trimPrefix(generated_text, "<|startoftext|>"), + PUBLIC_SEP_TOKEN + ).trimEnd(); + + for (const stop of [...(model?.parameters?.stop ?? []), "<|endoftext|>"]) { + if (generated_text.endsWith(stop)) { + generated_text = generated_text.slice(0, -stop.length).trimEnd(); + } + } + + messages.push({ + from: "assistant", + content: generated_text, + webSearchId: web_search_id, + id: (responseId as Message["id"]) || crypto.randomUUID(), + }); + + await collections.conversations.updateOne( + { + _id: convId, + }, + { + $set: { + messages, + updatedAt: new Date(), + }, + } + ); + } + + saveMessage().catch(console.error); + // Todo: maybe we should wait for the message to be saved before ending the response - in case of errors + return new Response(stream1, { + headers: Object.fromEntries(resp.headers.entries()), + status: resp.status, + statusText: resp.statusText, + }); +} + +export async function DELETE({ locals, params }) { + const convId = new ObjectId(params.id); + + const conv = await collections.conversations.findOne({ + _id: convId, + ...authCondition(locals), + }); + + if (!conv) { + throw error(404, "Conversation not found"); + } + + await collections.conversations.deleteOne({ _id: conv._id }); + + return new Response(); +} + +async function parseGeneratedText( + stream: ReadableStream, + conversationId: ObjectId, + promptedAt: Date, + abortController: AbortController +): Promise<string> { + const inputs: Uint8Array[] = []; + for await (const input of streamToAsyncIterable(stream)) { + inputs.push(input); + + const date = abortedGenerations.get(conversationId.toString()); + + if (date && date > promptedAt) { + abortController.abort("Cancelled by user"); + const completeInput = concatUint8Arrays(inputs); + + const lines = new TextDecoder() + .decode(completeInput) + .split("\n") + .filter((line) => line.startsWith("data:")); + + const tokens = lines.map((line) => { + try { + const json: TextGenerationStreamOutput = JSON.parse(line.slice("data:".length)); + return json.token.text; + } catch { + return ""; + } + }); + return tokens.join(""); + } + } + + // Merge inputs into a single Uint8Array + const completeInput = concatUint8Arrays(inputs); + + // Get last line starting with "data:" and parse it as JSON to get the generated text + const message = new TextDecoder().decode(completeInput); + + let lastIndex = message.lastIndexOf("\ndata:"); + if (lastIndex === -1) { + lastIndex = message.indexOf("data"); + } + + if (lastIndex === -1) { + console.error("Could not parse last message", message); + } + + let lastMessage = message.slice(lastIndex).trim().slice("data:".length); + if (lastMessage.includes("\n")) { + lastMessage = lastMessage.slice(0, lastMessage.indexOf("\n")); + } + + const lastMessageJSON = JSON.parse(lastMessage); + + if (lastMessageJSON.error) { + throw new Error(lastMessageJSON.error); + } + + const res = lastMessageJSON.generated_text; + + if (typeof res !== "string") { + throw new Error("Could not parse generated text"); + } + + return res; +} + +export async function PATCH({ request, locals, params }) { + const { title } = z + .object({ title: z.string().trim().min(1).max(100) }) + .parse(await request.json()); + + const convId = new ObjectId(params.id); + + const conv = await collections.conversations.findOne({ + _id: convId, + ...authCondition(locals), + }); + + if (!conv) { + throw error(404, "Conversation not found"); + } + + await collections.conversations.updateOne( + { + _id: convId, + }, + { + $set: { + title, + }, + } + ); + + return new Response(); +} diff --git a/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts b/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a217aebf1ca06eb6109409aae978dee13e83ece --- /dev/null +++ b/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts @@ -0,0 +1,52 @@ +import { buildPrompt } from "$lib/buildPrompt"; +import { authCondition } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import { models } from "$lib/server/models"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; + +export async function GET({ params, locals }) { + const convId = new ObjectId(params.id); + + const conv = await collections.conversations.findOne({ + _id: convId, + ...authCondition(locals), + }); + + if (!conv) { + throw error(404, "Conversation not found"); + } + + const messageId = params.messageId; + + const messageIndex = conv.messages.findIndex((msg) => msg.id === messageId); + + if (messageIndex === -1) { + throw error(404, "Message not found"); + } + + const model = models.find((m) => m.id === conv.model); + + if (!model) { + throw error(404, "Conversation model not found"); + } + + const prompt = await buildPrompt(conv.messages.slice(0, messageIndex + 1), model); + + return new Response( + JSON.stringify( + { + note: "This is a preview of the prompt that will be sent to the model when retrying the message. It may differ from what was sent in the past if the parameters have been updated since", + prompt, + model: model.name, + parameters: { + ...model.parameters, + return_full_text: false, + }, + }, + null, + 2 + ), + { headers: { "Content-Type": "application/json" } } + ); +} diff --git a/src/routes/conversation/[id]/message/[messageId]/vote/+server.ts b/src/routes/conversation/[id]/message/[messageId]/vote/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..8702a1346ae9b16639a5bfaf858998968a9cb452 --- /dev/null +++ b/src/routes/conversation/[id]/message/[messageId]/vote/+server.ts @@ -0,0 +1,38 @@ +import { authCondition } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; +import { z } from "zod"; + +export async function POST({ params, request, locals }) { + const { score } = z + .object({ + score: z.number().int().min(-1).max(1), + }) + .parse(await request.json()); + const conversationId = new ObjectId(params.id); + const messageId = params.messageId; + + const document = await collections.conversations.updateOne( + { + _id: conversationId, + ...authCondition(locals), + "messages.id": messageId, + }, + { + ...(score !== 0 + ? { + $set: { + "messages.$.score": score, + }, + } + : { $unset: { "messages.$.score": "" } }), + } + ); + + if (!document.matchedCount) { + throw error(404, "Message not found"); + } + + return new Response(); +} diff --git a/src/routes/conversation/[id]/share/+server.ts b/src/routes/conversation/[id]/share/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..38eae0b89d5701ff5d5e2cf8e1efdb59697d2fde --- /dev/null +++ b/src/routes/conversation/[id]/share/+server.ts @@ -0,0 +1,56 @@ +import { base } from "$app/paths"; +import { PUBLIC_ORIGIN, PUBLIC_SHARE_PREFIX } from "$env/static/public"; +import { authCondition } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import type { SharedConversation } from "$lib/types/SharedConversation"; +import { sha256 } from "$lib/utils/sha256"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; +import { nanoid } from "nanoid"; + +export async function POST({ params, url, locals }) { + const conversation = await collections.conversations.findOne({ + _id: new ObjectId(params.id), + ...authCondition(locals), + }); + + if (!conversation) { + throw error(404, "Conversation not found"); + } + + const hash = await sha256(JSON.stringify(conversation.messages)); + + const existingShare = await collections.sharedConversations.findOne({ hash }); + + if (existingShare) { + return new Response( + JSON.stringify({ + url: getShareUrl(url, existingShare._id), + }), + { headers: { "Content-Type": "application/json" } } + ); + } + + const shared: SharedConversation = { + _id: nanoid(7), + createdAt: new Date(), + messages: conversation.messages, + hash, + updatedAt: new Date(), + title: conversation.title, + model: conversation.model, + }; + + await collections.sharedConversations.insertOne(shared); + + return new Response( + JSON.stringify({ + url: getShareUrl(url, shared._id), + }), + { headers: { "Content-Type": "application/json" } } + ); +} + +function getShareUrl(url: URL, shareId: string): string { + return `${PUBLIC_SHARE_PREFIX || `${PUBLIC_ORIGIN || url.origin}${base}`}/r/${shareId}`; +} diff --git a/src/routes/conversation/[id]/stop-generating/+server.ts b/src/routes/conversation/[id]/stop-generating/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..d640543496609f8be2118963ed5c0fca441d9cd6 --- /dev/null +++ b/src/routes/conversation/[id]/stop-generating/+server.ts @@ -0,0 +1,28 @@ +import { authCondition } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; + +/** + * Ideally, we'd be able to detect the client-side abort, see https://github.com/huggingface/chat-ui/pull/88#issuecomment-1523173850 + */ +export async function POST({ params, locals }) { + const conversationId = new ObjectId(params.id); + + const conversation = await collections.conversations.findOne({ + _id: conversationId, + ...authCondition(locals), + }); + + if (!conversation) { + throw error(404, "Conversation not found"); + } + + await collections.abortedGenerations.updateOne( + { conversationId }, + { $set: { updatedAt: new Date() }, $setOnInsert: { createdAt: new Date() } }, + { upsert: true } + ); + + return new Response(); +} diff --git a/src/routes/conversation/[id]/summarize/+server.ts b/src/routes/conversation/[id]/summarize/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..00ce45cf4f43d932eb68b4f2389fe3a2200f72e0 --- /dev/null +++ b/src/routes/conversation/[id]/summarize/+server.ts @@ -0,0 +1,52 @@ +import { buildPrompt } from "$lib/buildPrompt"; +import { authCondition } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import { generateFromDefaultEndpoint } from "$lib/server/generateFromDefaultEndpoint"; +import { defaultModel } from "$lib/server/models"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; + +export async function POST({ params, locals }) { + const convId = new ObjectId(params.id); + + const conversation = await collections.conversations.findOne({ + _id: convId, + ...authCondition(locals), + }); + + if (!conversation) { + throw error(404, "Conversation not found"); + } + + const firstMessage = conversation.messages.find((m) => m.from === "user"); + + const userPrompt = + `Please summarize the following message as a single sentence of less than 5 words:\n` + + firstMessage?.content; + + const prompt = await buildPrompt([{ from: "user", content: userPrompt }], defaultModel); + const generated_text = await generateFromDefaultEndpoint(prompt); + + if (generated_text) { + await collections.conversations.updateOne( + { + _id: convId, + ...authCondition(locals), + }, + { + $set: { title: generated_text }, + } + ); + } + + return new Response( + JSON.stringify( + generated_text + ? { + title: generated_text, + } + : {} + ), + { headers: { "Content-Type": "application/json" } } + ); +} diff --git a/src/routes/conversation/[id]/web-search/+server.ts b/src/routes/conversation/[id]/web-search/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ae5afd8a1178b4fa3a60e1d7b4e0e88176f877e --- /dev/null +++ b/src/routes/conversation/[id]/web-search/+server.ts @@ -0,0 +1,121 @@ +import { authCondition } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import { defaultModel } from "$lib/server/models"; +import { searchWeb } from "$lib/server/websearch/searchWeb"; +import type { Message } from "$lib/types/Message"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; +import { z } from "zod"; +import type { WebSearch } from "$lib/types/WebSearch"; +import { generateQuery } from "$lib/server/websearch/generateQuery"; +import { parseWeb } from "$lib/server/websearch/parseWeb"; +import { summarizeWeb } from "$lib/server/websearch/summarizeWeb"; + +interface GenericObject { + [key: string]: GenericObject | unknown; +} + +function removeLinks(obj: GenericObject) { + for (const prop in obj) { + if (prop.endsWith("link")) delete obj[prop]; + else if (typeof obj[prop] === "object") removeLinks(obj[prop] as GenericObject); + } + return obj; +} +export async function GET({ params, locals, url }) { + const model = defaultModel; + const convId = new ObjectId(params.id); + const searchId = new ObjectId(); + + const conv = await collections.conversations.findOne({ + _id: convId, + ...authCondition(locals), + }); + + if (!conv) { + throw error(404, "Conversation not found"); + } + + const prompt = z.string().trim().min(1).parse(url.searchParams.get("prompt")); + + const messages = (() => { + return [...conv.messages, { content: prompt, from: "user", id: crypto.randomUUID() }]; + })() satisfies Message[]; + + const stream = new ReadableStream({ + async start(controller) { + const webSearch: WebSearch = { + _id: searchId, + convId: convId, + prompt: prompt, + searchQuery: "", + knowledgeGraph: "", + results: [], + summary: "", + messages: [], + createdAt: new Date(), + updatedAt: new Date(), + }; + + function appendUpdate(message: string, args?: string[]) { + webSearch.messages.push({ + type: "update", + message, + args, + }); + controller.enqueue(JSON.stringify({ messages: webSearch.messages })); + } + + try { + appendUpdate("Generating search query"); + webSearch.searchQuery = await generateQuery(messages, model); + + appendUpdate("Searching Google", [webSearch.searchQuery]); + const results = await searchWeb(webSearch.searchQuery); + + let text = ""; + webSearch.results = + (results.organic_results && + results.organic_results.map((el: { link: string }) => el.link)) ?? + []; + + if (results.knowledge_graph) { + // if google returns a knowledge graph, we use it + webSearch.knowledgeGraph = JSON.stringify(removeLinks(results.knowledge_graph)); + text = webSearch.knowledgeGraph; + appendUpdate("Found a Google knowledge page"); + } else if (webSearch.results.length > 0) { + // otherwise we use the top result from search + const topUrl = webSearch.results[0]; + appendUpdate("Browsing first result", [JSON.stringify(topUrl)]); + + text = await parseWeb(topUrl); + if (!text) throw new Error("text of the webpage is null"); + } else { + throw new Error("No results found for this search query"); + } + + appendUpdate("Creating summary"); + webSearch.summary = await summarizeWeb(text, webSearch.searchQuery, model); + appendUpdate("Injecting summary", [JSON.stringify(webSearch.summary)]); + } catch (searchError) { + if (searchError instanceof Error) { + webSearch.messages.push({ + type: "error", + message: "An error occurred with the web search", + args: [JSON.stringify(searchError.message)], + }); + } + } + + const res = await collections.webSearches.insertOne(webSearch); + webSearch.messages.push({ + type: "result", + id: res.insertedId.toString(), + }); + controller.enqueue(JSON.stringify({ messages: webSearch.messages })); + }, + }); + + return new Response(stream, { headers: { "Content-Type": "application/json" } }); +} diff --git a/src/routes/conversations/+page.server.ts b/src/routes/conversations/+page.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4f7daae5f7864bcaf43608af604a75205cc7d9b --- /dev/null +++ b/src/routes/conversations/+page.server.ts @@ -0,0 +1,17 @@ +import { base } from "$app/paths"; +import { authCondition } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import { redirect } from "@sveltejs/kit"; + +export const actions = { + delete: async function ({ locals }) { + // double check we have a user to delete conversations for + if (locals.user?._id || locals.sessionId) { + await collections.conversations.deleteMany({ + ...authCondition(locals), + }); + } + + throw redirect(303, `${base}/`); + }, +}; diff --git a/src/routes/login/+page.server.ts b/src/routes/login/+page.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..28692b5304687ce69551c5015d71a4419069415a --- /dev/null +++ b/src/routes/login/+page.server.ts @@ -0,0 +1,16 @@ +import { redirect } from "@sveltejs/kit"; +import { getOIDCAuthorizationUrl } from "$lib/server/auth"; +import { base } from "$app/paths"; + +export const actions = { + default: async function ({ url, locals, request }) { + // TODO: Handle errors if provider is not responding + const referer = request.headers.get("referer"); + const authorizationUrl = await getOIDCAuthorizationUrl( + { redirectURI: `${(referer ? new URL(referer) : url).origin}${base}/login/callback` }, + { sessionId: locals.sessionId } + ); + + throw redirect(303, authorizationUrl); + }, +}; diff --git a/src/routes/login/callback/+page.server.ts b/src/routes/login/callback/+page.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ccbc1b48b66f62a0c8a1fb9f7eb55e939d3215f --- /dev/null +++ b/src/routes/login/callback/+page.server.ts @@ -0,0 +1,39 @@ +import { redirect, error } from "@sveltejs/kit"; +import { getOIDCUserData, validateAndParseCsrfToken } from "$lib/server/auth"; +import { z } from "zod"; +import { base } from "$app/paths"; +import { updateUser } from "./updateUser"; + +export async function load({ url, locals, cookies }) { + const { error: errorName, error_description: errorDescription } = z + .object({ + error: z.string().optional(), + error_description: z.string().optional(), + }) + .parse(Object.fromEntries(url.searchParams.entries())); + + if (errorName) { + throw error(400, errorName + (errorDescription ? ": " + errorDescription : "")); + } + + const { code, state } = z + .object({ + code: z.string(), + state: z.string(), + }) + .parse(Object.fromEntries(url.searchParams.entries())); + + const csrfToken = Buffer.from(state, "base64").toString("utf-8"); + + const validatedToken = await validateAndParseCsrfToken(csrfToken, locals.sessionId); + + if (!validatedToken) { + throw error(403, "Invalid or expired CSRF token"); + } + + const { userData } = await getOIDCUserData({ redirectURI: validatedToken.redirectUrl }, code); + + await updateUser({ userData, locals, cookies }); + + throw redirect(302, `${base}/`); +} diff --git a/src/routes/login/callback/updateUser.spec.ts b/src/routes/login/callback/updateUser.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..24a7ff2757519d26bd9af7c163cdd76fc25bf69e --- /dev/null +++ b/src/routes/login/callback/updateUser.spec.ts @@ -0,0 +1,144 @@ +import { assert, it, describe, afterEach, vi, expect } from "vitest"; +import type { Cookies } from "@sveltejs/kit"; +import { collections } from "$lib/server/database"; +import { updateUser } from "./updateUser"; +import { ObjectId } from "mongodb"; +import { DEFAULT_SETTINGS } from "$lib/types/Settings"; +import { defaultModel } from "$lib/server/models"; + +const userData = { + preferred_username: "new-username", + name: "name", + picture: "https://example.com/avatar.png", + sub: "1234567890", +}; + +const locals = { + userId: "1234567890", + sessionId: "1234567890", +}; + +// @ts-expect-error SvelteKit cookies dumb mock +const cookiesMock: Cookies = { + set: vi.fn(), +}; + +const insertRandomUser = async () => { + const res = await collections.users.insertOne({ + _id: new ObjectId(), + createdAt: new Date(), + updatedAt: new Date(), + username: "base-username", + name: userData.name, + avatarUrl: userData.picture, + hfUserId: userData.sub, + sessionId: locals.sessionId, + }); + + return res.insertedId; +}; + +const insertRandomConversations = async (count: number) => { + const res = await collections.conversations.insertMany( + new Array(count).fill(0).map(() => ({ + _id: new ObjectId(), + title: "random title", + messages: [], + model: defaultModel.id, + createdAt: new Date(), + updatedAt: new Date(), + sessionId: locals.sessionId, + })) + ); + + return res.insertedIds; +}; + +describe("login", () => { + it("should update user if existing", async () => { + await insertRandomUser(); + + await updateUser({ userData, locals, cookies: cookiesMock }); + + const existingUser = await collections.users.findOne({ hfUserId: userData.sub }); + + assert.equal(existingUser?.name, userData.name); + + expect(cookiesMock.set).toBeCalledTimes(1); + }); + + it("should migrate pre-existing conversations for new user", async () => { + const insertedId = await insertRandomUser(); + + await insertRandomConversations(2); + + await updateUser({ userData, locals, cookies: cookiesMock }); + + const conversationCount = await collections.conversations.countDocuments({ + userId: insertedId, + sessionId: { $exists: false }, + }); + + assert.equal(conversationCount, 2); + + await collections.conversations.deleteMany({ userId: insertedId }); + }); + + it("should create default settings for new user", async () => { + await updateUser({ userData, locals, cookies: cookiesMock }); + + const user = await collections.users.findOne({ sessionId: locals.sessionId }); + + assert.exists(user); + + const settings = await collections.settings.findOne({ userId: user?._id }); + + expect(settings).toMatchObject({ + userId: user?._id, + updatedAt: expect.any(Date), + createdAt: expect.any(Date), + ethicsModalAcceptedAt: expect.any(Date), + ...DEFAULT_SETTINGS, + }); + + await collections.settings.deleteOne({ userId: user?._id }); + }); + + it("should migrate pre-existing settings for pre-existing user", async () => { + const { insertedId } = await collections.settings.insertOne({ + sessionId: locals.sessionId, + ethicsModalAcceptedAt: new Date(), + updatedAt: new Date(), + createdAt: new Date(), + ...DEFAULT_SETTINGS, + shareConversationsWithModelAuthors: false, + }); + + await updateUser({ userData, locals, cookies: cookiesMock }); + + const settings = await collections.settings.findOne({ + _id: insertedId, + sessionId: { $exists: false }, + }); + + assert.exists(settings); + + const user = await collections.users.findOne({ hfUserId: userData.sub }); + + expect(settings).toMatchObject({ + userId: user?._id, + updatedAt: expect.any(Date), + createdAt: expect.any(Date), + ethicsModalAcceptedAt: expect.any(Date), + ...DEFAULT_SETTINGS, + shareConversationsWithModelAuthors: false, + }); + + await collections.settings.deleteOne({ userId: user?._id }); + }); +}); + +afterEach(async () => { + await collections.users.deleteMany({ hfUserId: userData.sub }); + vi.clearAllMocks(); +}); diff --git a/src/routes/login/callback/updateUser.ts b/src/routes/login/callback/updateUser.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7c8b5f643e2c3d8d02bff5a4c6c3d92aad09a89 --- /dev/null +++ b/src/routes/login/callback/updateUser.ts @@ -0,0 +1,84 @@ +import { authCondition, refreshSessionCookie } from "$lib/server/auth"; +import { collections } from "$lib/server/database"; +import { ObjectId } from "mongodb"; +import { DEFAULT_SETTINGS } from "$lib/types/Settings"; +import { z } from "zod"; +import type { UserinfoResponse } from "openid-client"; +import type { Cookies } from "@sveltejs/kit"; + +export async function updateUser(params: { + userData: UserinfoResponse; + locals: App.Locals; + cookies: Cookies; +}) { + const { userData, locals, cookies } = params; + const { + preferred_username: username, + name, + email, + picture: avatarUrl, + sub: hfUserId, + } = z + .object({ + preferred_username: z.string().optional(), + name: z.string(), + picture: z.string(), + sub: z.string(), + email: z.string().email().optional(), + }) + .refine((data) => data.preferred_username || data.email, { + message: "Either preferred_username or email must be provided by the provider.", + }) + .parse(userData); + + const existingUser = await collections.users.findOne({ hfUserId }); + let userId = existingUser?._id; + + if (existingUser) { + // update existing user if any + await collections.users.updateOne( + { _id: existingUser._id }, + { $set: { username, name, avatarUrl } } + ); + // refresh session cookie + refreshSessionCookie(cookies, existingUser.sessionId); + } else { + // user doesn't exist yet, create a new one + const { insertedId } = await collections.users.insertOne({ + _id: new ObjectId(), + createdAt: new Date(), + updatedAt: new Date(), + username, + name, + email, + avatarUrl, + hfUserId, + sessionId: locals.sessionId, + }); + + userId = insertedId; + + // update pre-existing settings + const { matchedCount } = await collections.settings.updateOne(authCondition(locals), { + $set: { userId, updatedAt: new Date() }, + $unset: { sessionId: "" }, + }); + + if (!matchedCount) { + // create new default settings + await collections.settings.insertOne({ + userId, + ethicsModalAcceptedAt: new Date(), + updatedAt: new Date(), + createdAt: new Date(), + ...DEFAULT_SETTINGS, + }); + } + } + + // migrate pre-existing conversations + await collections.conversations.updateMany(authCondition(locals), { + $set: { userId }, + $unset: { sessionId: "" }, + }); +} diff --git a/src/routes/logout/+page.server.ts b/src/routes/logout/+page.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d60b6c5d8df28981da4d06d5ea58eeeaf838b47 --- /dev/null +++ b/src/routes/logout/+page.server.ts @@ -0,0 +1,17 @@ +import { dev } from "$app/environment"; +import { base } from "$app/paths"; +import { COOKIE_NAME } from "$env/static/private"; +import { redirect } from "@sveltejs/kit"; + +export const actions = { + default: async function ({ cookies }) { + cookies.delete(COOKIE_NAME, { + path: "/", + // So that it works inside the space's iframe + sameSite: dev ? "lax" : "none", + secure: !dev, + httpOnly: true, + }); + throw redirect(303, `${base}/`); + }, +}; diff --git a/src/routes/privacy/+page.svelte b/src/routes/privacy/+page.svelte new file mode 100644 index 0000000000000000000000000000000000000000..f50fa73a6017b02725a3f941ee796c56ae8d8b6d --- /dev/null +++ b/src/routes/privacy/+page.svelte @@ -0,0 +1,11 @@ +<script lang="ts"> + import { marked } from "marked"; + import privacy from "../../../PRIVACY.md?raw"; +</script> + +<div class="overflow-auto p-6"> + <div class="prose mx-auto px-4 pb-24 pt-6 dark:prose-invert md:pt-12"> + <!-- eslint-disable-next-line svelte/no-at-html-tags --> + {@html marked(privacy, { gfm: true })} + </div> +</div> diff --git a/src/routes/r/[id]/+page.server.ts b/src/routes/r/[id]/+page.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..4bc892004c5d3a2c8dc3c955bf28f3b24c52014a --- /dev/null +++ b/src/routes/r/[id]/+page.server.ts @@ -0,0 +1,35 @@ +import type { PageServerLoad } from "./$types"; +import { collections } from "$lib/server/database"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; +import type { WebSearchMessageResult } from "$lib/types/WebSearch"; + +export const load: PageServerLoad = async ({ params }) => { + const conversation = await collections.sharedConversations.findOne({ + _id: params.id, + }); + + if (!conversation) { + throw error(404, "Conversation not found"); + } + + const webSearchesId = conversation.messages + .filter((message) => message.webSearchId) + .map((message) => new ObjectId(message.webSearchId)); + + const results = await collections.webSearches.find({ _id: { $in: webSearchesId } }).toArray(); + + const searches = Object.fromEntries( + results.map((x) => [ + x._id.toString(), + [...x.messages, { type: "result", id: x._id.toString() } satisfies WebSearchMessageResult], + ]) + ); + + return { + messages: conversation.messages, + title: conversation.title, + model: conversation.model, + searches, + }; +}; diff --git a/src/routes/r/[id]/+page.svelte b/src/routes/r/[id]/+page.svelte new file mode 100644 index 0000000000000000000000000000000000000000..d5894be27a690405fed954b34b466edebf6d5981 --- /dev/null +++ b/src/routes/r/[id]/+page.svelte @@ -0,0 +1,87 @@ +<script lang="ts"> + import { goto } from "$app/navigation"; + import { base } from "$app/paths"; + import { page } from "$app/stores"; + import { PUBLIC_APP_DISCLAIMER } from "$env/static/public"; + import ChatWindow from "$lib/components/chat/ChatWindow.svelte"; + import { ERROR_MESSAGES, error } from "$lib/stores/errors"; + import { pendingMessage } from "$lib/stores/pendingMessage"; + import { pendingMessageIdToRetry } from "$lib/stores/pendingMessageIdToRetry"; + import { findCurrentModel } from "$lib/utils/models"; + import { share } from "$lib/utils/share"; + import type { PageData } from "./$types"; + + export let data: PageData; + + let loading = false; + + async function createConversation() { + try { + loading = true; + const res = await fetch(`${base}/conversation`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + fromShare: $page.params.id, + model: data.model, + }), + }); + + if (!res.ok) { + error.set("Error while creating conversation, try again."); + console.error("Error while creating conversation: " + (await res.text())); + return; + } + + const { conversationId } = await res.json(); + + return conversationId; + } catch (err) { + error.set(ERROR_MESSAGES.default); + console.error(String(err)); + throw err; + } + } + + async function shareConversation() { + const url = `${window.location.origin}${window.location.pathname}`; + + share(url, data.title); + } +</script> + +<svelte:head> + <title>{data.title}</title> +</svelte:head> + +<ChatWindow + {loading} + shared={true} + messages={data.messages} + searches={data.searches} + on:message={(ev) => + createConversation() + .then((convId) => { + $pendingMessage = ev.detail; + return goto(`${base}/conversation/${convId}`, { invalidateAll: true }); + }) + .finally(() => (loading = false))} + on:share={shareConversation} + on:retry={(ev) => + createConversation() + .then((convId) => { + $pendingMessageIdToRetry = ev.detail.id; + $pendingMessage = ev.detail.content; + return goto(`${base}/conversation/${convId}`, { invalidateAll: true }); + }) + .finally(() => (loading = false))} + models={data.models} + currentModel={findCurrentModel(data.models, data.model)} + settings={data.settings} + loginRequired={!$page.error && + (data.requiresLogin + ? !data.user + : !data.settings.ethicsModalAcceptedAt && !!PUBLIC_APP_DISCLAIMER)} +/> diff --git a/src/routes/r/[id]/message/[messageId]/prompt/+server.ts b/src/routes/r/[id]/message/[messageId]/prompt/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..255fa79d83b8de3fb7a3c1613fe310d15dd62dcf --- /dev/null +++ b/src/routes/r/[id]/message/[messageId]/prompt/+server.ts @@ -0,0 +1,47 @@ +import { buildPrompt } from "$lib/buildPrompt"; +import { collections } from "$lib/server/database"; +import { models } from "$lib/server/models"; +import { error } from "@sveltejs/kit"; + +export async function GET({ params }) { + const conv = await collections.sharedConversations.findOne({ + _id: params.id, + }); + + if (!conv) { + throw error(404, "Conversation not found"); + } + + const messageId = params.messageId; + + const messageIndex = conv.messages.findIndex((msg) => msg.id === messageId); + + if (messageIndex === -1) { + throw error(404, "Message not found"); + } + + const model = models.find((m) => m.id === conv.model); + + if (!model) { + throw error(404, "Conversation model not found"); + } + + const prompt = await buildPrompt(conv.messages.slice(0, messageIndex + 1), model); + + return new Response( + JSON.stringify( + { + note: "This is a preview of the prompt that will be sent to the model when retrying the message. It may differ from what was sent in the past if the parameters have been updated since", + prompt, + model: model.name, + parameters: { + ...model.parameters, + return_full_text: false, + }, + }, + null, + 2 + ), + { headers: { "Content-Type": "application/json" } } + ); +} diff --git a/src/routes/search/[id]/+server.ts b/src/routes/search/[id]/+server.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee880722c456a26a5fedaf3cc58a25bc27a5d1e9 --- /dev/null +++ b/src/routes/search/[id]/+server.ts @@ -0,0 +1,39 @@ +import { collections } from "$lib/server/database"; +import { sha256 } from "$lib/utils/sha256"; +import { error } from "@sveltejs/kit"; +import { ObjectId } from "mongodb"; + +export async function GET({ params, locals }) { + const searchId = new ObjectId(params.id); + + const search = await collections.webSearches.findOne({ + _id: searchId, + }); + + if (!search) { + throw error(404, "Search query not found"); + } + + const conv = await collections.conversations.findOne({ + _id: search.convId, + }); + + if (!conv) { + throw error(404, "Conversation not found"); + } + + // there's no better way to see if a conversation has been shared, so we hash the messages and see if there's a shared conversation with the same hash + const hash = await sha256(JSON.stringify(conv.messages)); + const sharedConv = await collections.sharedConversations.findOne({ + hash: hash, + }); + + const userShouldSeeConv = + (conv.userId && locals.user?._id.toString() === conv.userId.toString()) || sharedConv !== null; + + if (!userShouldSeeConv) { + throw error(403, "You don't have access to the conversation here."); + } + + return new Response(JSON.stringify(search), { headers: { "Content-Type": "application/json" } }); +} diff --git a/src/routes/settings/+page.server.ts b/src/routes/settings/+page.server.ts new file mode 100644 index 0000000000000000000000000000000000000000..582c009559edee2733ac60aa3cc9a271fb2a5130 --- /dev/null +++ b/src/routes/settings/+page.server.ts @@ -0,0 +1,46 @@ +import { base } from "$app/paths"; +import { collections } from "$lib/server/database"; +import { redirect } from "@sveltejs/kit"; +import { z } from "zod"; +import { models, validateModel } from "$lib/server/models"; +import { authCondition } from "$lib/server/auth"; +import { DEFAULT_SETTINGS } from "$lib/types/Settings"; + +export const actions = { + default: async function ({ request, locals }) { + const formData = await request.formData(); + + const { ethicsModalAccepted, ...settings } = z + .object({ + shareConversationsWithModelAuthors: z + .boolean({ coerce: true }) + .default(DEFAULT_SETTINGS.shareConversationsWithModelAuthors), + ethicsModalAccepted: z.boolean({ coerce: true }).optional(), + activeModel: validateModel(models), + }) + .parse({ + shareConversationsWithModelAuthors: formData.get("shareConversationsWithModelAuthors"), + ethicsModalAccepted: formData.get("ethicsModalAccepted"), + activeModel: formData.get("activeModel") ?? DEFAULT_SETTINGS.activeModel, + }); + + await collections.settings.updateOne( + authCondition(locals), + { + $set: { + ...settings, + ...(ethicsModalAccepted && { ethicsModalAcceptedAt: new Date() }), + updatedAt: new Date(), + }, + $setOnInsert: { + createdAt: new Date(), + }, + }, + { + upsert: true, + } + ); + + throw redirect(303, request.headers.get("referer") || `${base}/`); + }, +}; diff --git a/src/styles/highlight-js.css b/src/styles/highlight-js.css new file mode 100644 index 0000000000000000000000000000000000000000..b262688368e9a946d72b21ae70fba7d711072fbb --- /dev/null +++ b/src/styles/highlight-js.css @@ -0,0 +1 @@ +@import "highlight.js/styles/atom-one-dark"; diff --git a/src/styles/main.css b/src/styles/main.css new file mode 100644 index 0000000000000000000000000000000000000000..6ea57c50974dab960f23ce8440bfd576f10ddb52 --- /dev/null +++ b/src/styles/main.css @@ -0,0 +1,17 @@ +@import "./highlight-js.css"; + +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer components { + .btn { + @apply inline-flex flex-shrink-0 cursor-pointer select-none items-center justify-center whitespace-nowrap outline-none transition-all focus:ring disabled:cursor-default; + } +} + +@layer utilities { + .scrollbar-custom { + @apply scrollbar-thin scrollbar-track-transparent scrollbar-thumb-black/10 scrollbar-thumb-rounded-full scrollbar-w-1 hover:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/10 dark:hover:scrollbar-thumb-white/20; + } +} diff --git a/static/chatui/favicon.png b/static/chatui/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..5a3f7c66f7cc89dccc2730821fed6eeb671d44ed Binary files /dev/null and b/static/chatui/favicon.png differ diff --git a/static/chatui/favicon.svg b/static/chatui/favicon.svg new file mode 100644 index 0000000000000000000000000000000000000000..cc55dcb9e607621ed8dcc32a93168225304febc9 --- /dev/null +++ b/static/chatui/favicon.svg @@ -0,0 +1,6 @@ +<svg width="30" height="30" viewBox="0 0 30 30" + xmlns="http://www.w3.org/2000/svg"> + <path + d="M4.06151 14.1464C4.06151 11.8818 4.9611 9.71004 6.56237 8.10877C8.16364 6.5075 10.3354 5.60791 12.6 5.60791H16.5231C18.6254 5.60791 20.6416 6.44307 22.1282 7.92965C23.6148 9.41624 24.45 11.4325 24.45 13.5348C24.45 15.6372 23.6148 17.6534 22.1282 19.14C20.6416 20.6266 18.6254 21.4618 16.5231 21.4618H7.08459L4.63844 23.8387C4.59547 23.8942 4.53557 23.9343 4.4678 23.9527C4.40004 23.9712 4.32811 23.9671 4.2629 23.941C4.1977 23.9149 4.14276 23.8683 4.10643 23.8082C4.07009 23.7481 4.05432 23.6778 4.06151 23.6079V14.1464Z" + style="fill:rgb(107, 114, 128)"></path> +</svg> \ No newline at end of file diff --git a/static/chatui/touch-icon-ipad-retina.png b/static/chatui/touch-icon-ipad-retina.png new file mode 100644 index 0000000000000000000000000000000000000000..38a6b8c0310304f1c48fbf7c03f9d7015c10f96f Binary files /dev/null and b/static/chatui/touch-icon-ipad-retina.png differ diff --git a/static/chatui/touch-icon-ipad.png b/static/chatui/touch-icon-ipad.png new file mode 100644 index 0000000000000000000000000000000000000000..66edeb65eb11b2e792a20a10d4ad08e697264654 Binary files /dev/null and b/static/chatui/touch-icon-ipad.png differ diff --git a/static/chatui/touch-icon-iphone-retina.png b/static/chatui/touch-icon-iphone-retina.png new file mode 100644 index 0000000000000000000000000000000000000000..776c4d1185525e6f9062a0cd57d48fa9079d4488 Binary files /dev/null and b/static/chatui/touch-icon-iphone-retina.png differ diff --git a/static/huggingchat/favicon.png b/static/huggingchat/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..a50bfcdf12b6c4b92228adfeb499a28ae0156160 Binary files /dev/null and b/static/huggingchat/favicon.png differ diff --git a/static/huggingchat/favicon.svg b/static/huggingchat/favicon.svg new file mode 100644 index 0000000000000000000000000000000000000000..baf19d86510b76622df3163c2df97cbca01b57e3 --- /dev/null +++ b/static/huggingchat/favicon.svg @@ -0,0 +1,14 @@ +<svg width="30" height="30" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path + fill="#FFD21E" + d="M1.76 5.63a3.7 3.7 0 0 1 3.7-3.7h1.7a3.43 3.43 0 0 1 0 6.87H3.07L2.01 9.83a.14.14 0 0 1-.25-.1v-4.1Z" + /> + <path + fill="#32343D" + d="M7.37 4.8c.13.05.19.33.33.25a.54.54 0 0 0 .22-.73.54.54 0 0 0-.73-.22.54.54 0 0 0-.22.73c.06.13.27-.08.4-.03ZM4.83 4.8c-.14.05-.2.33-.33.25a.54.54 0 0 1-.23-.73A.54.54 0 0 1 5 4.1c.26.14.36.47.22.73-.06.13-.27-.08-.4-.03ZM6.12 7.4c1.06 0 1.4-.96 1.4-1.44 0-.49-.62.26-1.4.26-.77 0-1.4-.75-1.4-.26 0 .48.34 1.43 1.4 1.43Z" + /> + <path + fill="#FF323D" + d="M6.97 7.12c-.2.16-.49.27-.85.27-.34 0-.6-.1-.81-.24a.94.94 0 0 1 .57-.49c.04-.01.09.06.13.14.05.07.1.15.14.15.05 0 .1-.08.14-.15.05-.08.1-.15.14-.13a.93.93 0 0 1 .54.45Z" + /> +</svg> \ No newline at end of file diff --git a/static/huggingchat/thumbnail.png b/static/huggingchat/thumbnail.png new file mode 100644 index 0000000000000000000000000000000000000000..1ee95c7fb3bd657664a78eb482643962f91b8f0e Binary files /dev/null and b/static/huggingchat/thumbnail.png differ diff --git a/static/huggingchat/touch-icon-ipad-retina.png b/static/huggingchat/touch-icon-ipad-retina.png new file mode 100644 index 0000000000000000000000000000000000000000..61bdbba6b9f97c78906714d7f5476e30079bdae5 Binary files /dev/null and b/static/huggingchat/touch-icon-ipad-retina.png differ diff --git a/static/huggingchat/touch-icon-ipad.png b/static/huggingchat/touch-icon-ipad.png new file mode 100644 index 0000000000000000000000000000000000000000..895fc95800390bddfd2f365441698d2cc3846c9a Binary files /dev/null and b/static/huggingchat/touch-icon-ipad.png differ diff --git a/static/huggingchat/touch-icon-iphone-retina.png b/static/huggingchat/touch-icon-iphone-retina.png new file mode 100644 index 0000000000000000000000000000000000000000..cdf6d55032eed5086b7c87a744f18fcce833882d Binary files /dev/null and b/static/huggingchat/touch-icon-iphone-retina.png differ diff --git a/svelte.config.js b/svelte.config.js new file mode 100644 index 0000000000000000000000000000000000000000..e93decaf872ef153bf12ba1a5aaad6e4937a2c87 --- /dev/null +++ b/svelte.config.js @@ -0,0 +1,29 @@ +import adapter from "@sveltejs/adapter-node"; +import { vitePreprocess } from "@sveltejs/kit/vite"; +import dotenv from "dotenv"; + +dotenv.config({ path: "./.env.local" }); +dotenv.config({ path: "./.env" }); + +process.env.PUBLIC_VERSION = process.env.npm_package_version; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + // Consult https://kit.svelte.dev/docs/integrations#preprocessors + // for more information about preprocessors + preprocess: vitePreprocess(), + + kit: { + adapter: adapter(), + + paths: { + base: process.env.APP_BASE || "", + }, + csrf: { + // handled in hooks.server.ts, because we can have multiple valid origins + checkOrigin: false, + }, + }, +}; + +export default config; diff --git a/tailwind.config.cjs b/tailwind.config.cjs new file mode 100644 index 0000000000000000000000000000000000000000..773347ec02b3a46d6339829b8636f47b37c11a73 --- /dev/null +++ b/tailwind.config.cjs @@ -0,0 +1,29 @@ +const defaultTheme = require("tailwindcss/defaultTheme"); +const colors = require("tailwindcss/colors"); + +import dotenv from "dotenv"; +dotenv.config({ path: "./.env" }); + +/** @type {import('tailwindcss').Config} */ +export default { + darkMode: "class", + content: ["./src/**/*.{html,js,svelte,ts}"], + theme: { + extend: { + colors: { + primary: colors[process.env.PUBLIC_APP_COLOR], + }, + // fontFamily: { + // sans: ['"Inter"', ...defaultTheme.fontFamily.sans] + // }, + fontSize: { + xxs: "0.625rem", + smd: "0.94rem", + }, + }, + }, + plugins: [ + require("tailwind-scrollbar")({ nocompatible: true }), + require("@tailwindcss/typography"), + ], +}; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..fbfc0ac0b5a0de065a5166c0e1475c4b98510268 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "./.svelte-kit/tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + "target": "ES2018" + } + // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias + // + // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes + // from the referenced tsconfig.json - TypeScript does not merge them in +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..4a73fc2099065c273e7d95d2f2122538d0502b27 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,12 @@ +import { sveltekit } from "@sveltejs/kit/vite"; +import { defineConfig } from "vite"; +import Icons from "unplugin-icons/vite"; + +export default defineConfig({ + plugins: [ + sveltekit(), + Icons({ + compiler: "svelte", + }), + ], +});