Repository: chathub-dev/chathub Branch: main Commit: a7a2bd6e1205 Files: 225 Total size: 622.7 KB Directory structure: gitextract_jhqjs0wc/ ├── .eslintrc.json ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── feature_request.md │ ├── dependabot.yml │ └── workflows/ │ ├── close-inactive-issues.yml │ └── release.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── .yarnrc.yml ├── LICENSE ├── README.md ├── README_IN.md ├── README_JA.md ├── README_ZH-CN.md ├── README_ZH-TW.md ├── _locales/ │ ├── de/ │ │ └── messages.json │ ├── en/ │ │ └── messages.json │ ├── es/ │ │ └── messages.json │ ├── fr/ │ │ └── messages.json │ ├── in/ │ │ └── messages.json │ ├── ja/ │ │ └── messages.json │ ├── pt_BR/ │ │ └── messages.json │ ├── pt_PT/ │ │ └── messages.json │ ├── ru/ │ │ └── messages.json │ ├── th/ │ │ └── messages.json │ ├── zh_CN/ │ │ └── messages.json │ └── zh_TW/ │ └── messages.json ├── app.html ├── global.d.ts ├── manifest.config.ts ├── package.json ├── postcss.config.cjs ├── public/ │ └── js/ │ └── v2/ │ └── 35536E1E-65B4-4D96-9D97-6ADB7EFF8147/ │ └── api.js ├── sidepanel.html ├── src/ │ ├── app/ │ │ ├── base.scss │ │ ├── bots/ │ │ │ ├── abstract-bot.ts │ │ │ ├── baichuan/ │ │ │ │ ├── api.ts │ │ │ │ └── index.ts │ │ │ ├── bard/ │ │ │ │ ├── api.ts │ │ │ │ └── index.ts │ │ │ ├── bing/ │ │ │ │ ├── api.ts │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── chatgpt/ │ │ │ │ └── index.ts │ │ │ ├── chatgpt-api/ │ │ │ │ ├── index.ts │ │ │ │ └── types.ts │ │ │ ├── chatgpt-azure/ │ │ │ │ └── index.ts │ │ │ ├── chatgpt-webapp/ │ │ │ │ ├── arkose/ │ │ │ │ │ ├── generator.js │ │ │ │ │ ├── index.ts │ │ │ │ │ └── server.ts │ │ │ │ ├── client.ts │ │ │ │ ├── index.ts │ │ │ │ ├── requesters.ts │ │ │ │ └── types.ts │ │ │ ├── claude/ │ │ │ │ └── index.ts │ │ │ ├── claude-api/ │ │ │ │ └── index.ts │ │ │ ├── claude-web/ │ │ │ │ ├── api.ts │ │ │ │ └── index.ts │ │ │ ├── gemini-api/ │ │ │ │ └── index.ts │ │ │ ├── gradio/ │ │ │ │ └── index.ts │ │ │ ├── grok/ │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── lmsys/ │ │ │ │ └── index.ts │ │ │ ├── openrouter/ │ │ │ │ └── index.ts │ │ │ ├── perplexity/ │ │ │ │ └── index.ts │ │ │ ├── perplexity-api/ │ │ │ │ ├── api.ts │ │ │ │ └── index.ts │ │ │ ├── perplexity-web/ │ │ │ │ ├── api.ts │ │ │ │ └── index.ts │ │ │ ├── pi/ │ │ │ │ └── index.ts │ │ │ ├── poe/ │ │ │ │ ├── api.ts │ │ │ │ ├── graphql/ │ │ │ │ │ ├── AddMessageBreakMutation.graphql │ │ │ │ │ ├── AutoSubscriptionMutation.graphql │ │ │ │ │ ├── ChatViewQuery.graphql │ │ │ │ │ ├── MessageAddedSubscription.graphql │ │ │ │ │ ├── SendMessageMutation.graphql │ │ │ │ │ ├── SubscriptionsMutation.graphql │ │ │ │ │ └── ViewerStateUpdatedSubscription.graphql │ │ │ │ └── index.ts │ │ │ ├── qianwen/ │ │ │ │ ├── api.ts │ │ │ │ └── index.ts │ │ │ └── xunfei/ │ │ │ ├── api.ts │ │ │ ├── geeguard.js │ │ │ └── index.ts │ │ ├── components/ │ │ │ ├── Button.tsx │ │ │ ├── Chat/ │ │ │ │ ├── ChatMessageCard.tsx │ │ │ │ ├── ChatMessageInput.tsx │ │ │ │ ├── ChatMessageList.tsx │ │ │ │ ├── ChatbotName.tsx │ │ │ │ ├── ConversationPanel.tsx │ │ │ │ ├── ErrorAction.tsx │ │ │ │ ├── LayoutSwitch.tsx │ │ │ │ ├── MessageBubble.tsx │ │ │ │ ├── TextInput.tsx │ │ │ │ └── WebAccessCheckbox.tsx │ │ │ ├── Dialog.tsx │ │ │ ├── GuideModal.tsx │ │ │ ├── History/ │ │ │ │ ├── ChatMessage.tsx │ │ │ │ ├── Content.tsx │ │ │ │ └── Dialog.tsx │ │ │ ├── Input.tsx │ │ │ ├── Layout.tsx │ │ │ ├── Markdown/ │ │ │ │ ├── index.tsx │ │ │ │ └── markdown.css │ │ │ ├── Modals/ │ │ │ │ └── ReleaseNotesModal.tsx │ │ │ ├── Page.tsx │ │ │ ├── Premium/ │ │ │ │ ├── DiscountBadge.tsx │ │ │ │ ├── DiscountModal.tsx │ │ │ │ ├── FeatureList.tsx │ │ │ │ ├── Modal.tsx │ │ │ │ ├── PriceSection.tsx │ │ │ │ └── Testimonials.tsx │ │ │ ├── PromptCombobox.tsx │ │ │ ├── PromptLibrary/ │ │ │ │ ├── Dialog.tsx │ │ │ │ └── Library.tsx │ │ │ ├── RadioGroup.tsx │ │ │ ├── Select.tsx │ │ │ ├── Settings/ │ │ │ │ ├── Blockquote.tsx │ │ │ │ ├── ChatGPTAPISettings.tsx │ │ │ │ ├── ChatGPTAzureSettings.tsx │ │ │ │ ├── ChatGPTOpenRouterSettings.tsx │ │ │ │ ├── ChatGPTPoeSettings.tsx │ │ │ │ ├── ChatGPTWebSettings.tsx │ │ │ │ ├── ClaudeAPISettings.tsx │ │ │ │ ├── ClaudeOpenRouterSettings.tsx │ │ │ │ ├── ClaudePoeSettings.tsx │ │ │ │ ├── ClaudeWebappSettings.tsx │ │ │ │ ├── EnabledBotsSettings.tsx │ │ │ │ ├── ExportDataPanel.tsx │ │ │ │ ├── KDB.tsx │ │ │ │ ├── PerplexityAPISettings.tsx │ │ │ │ └── ShortcutPanel.tsx │ │ │ ├── Share/ │ │ │ │ ├── Dialog.tsx │ │ │ │ ├── MarkdownView.tsx │ │ │ │ ├── ShareGPTView.tsx │ │ │ │ └── sharegpt.ts │ │ │ ├── Sidebar/ │ │ │ │ ├── NavLink.tsx │ │ │ │ ├── PremiumEntry.tsx │ │ │ │ └── index.tsx │ │ │ ├── SwitchBotDropdown.tsx │ │ │ ├── Tabs.tsx │ │ │ ├── ThemeSettingModal/ │ │ │ │ └── index.tsx │ │ │ ├── Toggle.tsx │ │ │ └── Tooltip.tsx │ │ ├── consts.ts │ │ ├── context.ts │ │ ├── hooks/ │ │ │ ├── use-chat.ts │ │ │ ├── use-enabled-bots.ts │ │ │ ├── use-premium.ts │ │ │ ├── use-purchase-info.ts │ │ │ └── use-user-config.ts │ │ ├── i18n/ │ │ │ ├── index.ts │ │ │ └── locales/ │ │ │ ├── french.json │ │ │ ├── german.json │ │ │ ├── indonesia.json │ │ │ ├── japanese.json │ │ │ ├── portuguese.json │ │ │ ├── simplified-chinese.json │ │ │ ├── spanish.json │ │ │ ├── thai.json │ │ │ └── traditional-chinese.json │ │ ├── main.tsx │ │ ├── pages/ │ │ │ ├── MultiBotChatPanel.tsx │ │ │ ├── PremiumPage.tsx │ │ │ ├── SettingPage.tsx │ │ │ ├── SidePanelPage.tsx │ │ │ └── SingleBotChatPanel.tsx │ │ ├── plausible.ts │ │ ├── router.tsx │ │ ├── sidepanel.css │ │ ├── sidepanel.tsx │ │ ├── state/ │ │ │ └── index.ts │ │ ├── theme.ts │ │ └── utils/ │ │ ├── color-scheme.ts │ │ ├── env.ts │ │ ├── export.ts │ │ ├── image-compression/ │ │ │ ├── index.ts │ │ │ └── worker.ts │ │ ├── image-size.ts │ │ ├── markdown.ts │ │ ├── navigator.ts │ │ └── permissions.ts │ ├── background/ │ │ ├── index.ts │ │ ├── source.ts │ │ └── twitter-cookie.ts │ ├── content-script/ │ │ └── chatgpt-inpage-proxy.ts │ ├── rules/ │ │ ├── baichuan.json │ │ ├── bing.json │ │ ├── ddg.json │ │ ├── pplx.json │ │ └── qianwen.json │ ├── services/ │ │ ├── agent/ │ │ │ ├── index.ts │ │ │ ├── prompts.ts │ │ │ └── web-search/ │ │ │ ├── base.ts │ │ │ ├── bing-news.ts │ │ │ ├── duckduckgo.ts │ │ │ └── index.ts │ │ ├── chat-history.ts │ │ ├── lemonsqueezy.ts │ │ ├── premium.ts │ │ ├── prompts.ts │ │ ├── proxy-fetch.ts │ │ ├── release-notes.ts │ │ ├── sentry.ts │ │ ├── server-api.ts │ │ ├── storage/ │ │ │ ├── language.ts │ │ │ ├── open-times.ts │ │ │ └── token-usage.ts │ │ ├── theme.ts │ │ └── user-config.ts │ ├── types/ │ │ ├── chat.ts │ │ ├── index.ts │ │ └── messaging.ts │ ├── utils/ │ │ ├── encoding.ts │ │ ├── errors.ts │ │ ├── format.ts │ │ ├── index.ts │ │ ├── sse.ts │ │ └── stream-async-iterable.ts │ └── vite-env.d.ts ├── tailwind.config.cjs ├── tsconfig.json └── vite.config.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .eslintrc.json ================================================ { "parser": "@typescript-eslint/parser", "env": { "browser": true }, "plugins": ["@typescript-eslint"], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react/recommended", "plugin:react-hooks/recommended", "prettier" ], "overrides": [], "parserOptions": { "ecmaVersion": "latest", "sourceType": "module" }, "rules": { "react/react-in-jsx-scope": "off" }, "ignorePatterns": ["build/**"] } ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **Desktop (please complete the following information):** - OS: [e.g. Windows] - Browser [e.g. chrome, brave] - ChatHub Version [you can find it in ChatHub Settings] ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- ================================================ FILE: .github/dependabot.yml ================================================ # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates version: 2 updates: - package-ecosystem: "npm" # See documentation for possible values directory: "/" # Location of package manifests schedule: interval: "weekly" ================================================ FILE: .github/workflows/close-inactive-issues.yml ================================================ name: Close inactive issues on: schedule: - cron: "30 1 * * *" jobs: close-issues: runs-on: ubuntu-latest permissions: issues: write pull-requests: write steps: - uses: actions/stale@v5 with: days-before-issue-stale: 30 days-before-issue-close: 14 stale-issue-label: "stale" stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." days-before-pr-stale: -1 days-before-pr-close: -1 repo-token: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .github/workflows/release.yml ================================================ name: Release Workflow permissions: contents: write on: push: tags: - 'v*.*.*' env: VITE_PLAUSIBLE_API_HOST: ${{ vars.VITE_PLAUSIBLE_API_HOST }} jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '20' - name: Setup yarn run: corepack enable - name: Install dependencies run: yarn install - name: Build run: yarn build - name: Package uses: vimtor/action-zip@v1.1 with: files: dist/ dest: chathub.zip - name: Release uses: softprops/action-gh-release@v1 with: files: chathub.zip ================================================ FILE: .gitignore ================================================ # Logs logs *.log npm-debug.log* pnpm-debug.log* lerna-debug.log* node_modules dist dist-ssr *.local # Editor directories and files .vscode/* !.vscode/extensions.json .idea .DS_Store *.suo *.ntvs* *.njsproj *.sln *.sw? .env .yarn/* !.yarn/cache !.yarn/patches !.yarn/plugins !.yarn/releases !.yarn/sdks !.yarn/versions ================================================ FILE: .prettierignore ================================================ geeguard.js ================================================ FILE: .prettierrc ================================================ { "printWidth": 120, "semi": false, "tabWidth": 2, "singleQuote": true, "trailingComma": "all", "bracketSpacing": true, "overrides": [ { "files": ".prettierrc", "options": { "parser": "json" } } ] } ================================================ FILE: .yarnrc.yml ================================================ nodeLinker: node-modules ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: README.md ================================================

ChatHub

### Install Get ChatHub for Chromium
## 📷 Screenshot ![Screenshot](screenshots/extension.png?raw=true) ## 🤝 Sponsors ## ✨ Features - 🤖 Use different chatbots in one app, currently supporting ChatGPT, new Bing Chat, Google Bard, Claude, and open-source models including LLama2, Vicuna, ChatGLM etc - 💬 Chat with multiple chatbots at the same time, making it easy to compare their answers - 🚀 Support ChatGPT API and GPT-4 Browsing - 🔍 Shortcut to quickly activate the app anywhere in the browser - 🎨 Markdown and code highlight support - 📚 Prompt Library for custom prompts and community prompts - 💾 Conversation history saved locally - 📥 Export and Import all your data - 🔗 Share conversation to markdown - 🌙 Dark mode - 🌐 Web access ## 🤖 Supported Bots - ChatGPT (via Webapp/API) - Gemini - Claude (via Webapp/API) - Grok - DeepSeek - Qianwen - Llama - ... ## 🔨 Build from Source - Clone the source code - `corepack enable` - `yarn install` - `yarn build` - In Chrome/Edge go to the Extensions page (chrome://extensions or edge://extensions) - Enable Developer Mode - Drag the `dist` folder anywhere on the page to import it (do not delete the folder afterward) ================================================ FILE: README_IN.md ================================================

ChatHub

### ChatHub adalah klien chatbot all-in-one [![author][author-image]][author-url] [![license][license-image]][license-url] [![release][release-image]][release-url] [![last commit][last-commit-image]][last-commit-url] [Inggris](README.md)   |   Indonesia   |   [简体中文](README_ZH-CN.md)   |   [繁體中文](README_ZH-TW.md)   |   [日本語](README_JA.md) ## ### Instal Dapatkan ChatHub untuk Chromium Dapatkan ChatHub untuk Microsoft Edge ## [Tangkapan Layar](#-tangkapan-layar)   |   [Fitur](#-fitur)   |   [Bot yang Didukung](#-supported-bots)   |   [Instalasi Manual](#-instalasi-manual)   |   [Membangun dari Source](#-membangun-dari-source)   |   [Changelog](#-changelog) [author-image]: https://img.shields.io/badge/author-wong2-blue.svg [author-url]: https://github.com/wong2 [license-image]: https://img.shields.io/github/license/chathub-dev/chathub?color=blue [license-url]: https://github.com/chathub-dev/chathub/blob/main/LICENSE [release-image]: https://img.shields.io/github/v/release/chathub-dev/chathub?color=blue [release-url]: https://github.com/chathub-dev/chathub/releases/latest [last-commit-image]: https://img.shields.io/github/last-commit/chathub-dev/chathub?label=last%20commit [last-commit-url]: https://github.com/chathub-dev/chathub/commits
## ## 📷 Tangkapan Layar ![Tangkapan Layar](screenshots/extension.png?raw=true) ![Tangkapan Layar (Mode Gelap)](screenshots/dark.png?raw=true) ## ✨ Fitur - 🤖 Gunakan chatbot yang berbeda dalam satu aplikasi, saat ini mendukung ChatGPT, Bing Chat baru, Google Bard, Claude, dan 10+ model open-source termasuk Alpaca, Vicuna, ChatGLM, dll - 💬 Chat dengan beberapa chatbot secara bersamaan, sehingga mudah untuk membandingkan jawaban mereka - 🚀 Mendukung API ChatGPT dan Browsing GPT-4 - 🔍 Pintasan untuk dengan cepat mengaktifkan aplikasi di mana saja di browser - 🎨 Mendukung penyorotan markdown dan kode - 📚 Perpustakaan Prompt untuk prompt kustom dan prompt komunitas - 💾 Riwayat percakapan tersimpan secara lokal - 📥 Ekspor dan Impor semua data Anda - 🔗 Bagikan percakapan ke markdown - 🌙 Mode gelap ## 🤖 Bot yang Didukung * ChatGPT (melalui Webapp/API/Azure/Poe) * Bing Chat * Google Bard * Claude (melalui Poe) * iFlytek Spark * ChatGLM * Alpaca * Vicuna * Koala * Dolly * LLaMA * StableLM * OpenAssistant * ChatRWKV * ... ## 🔧 Instalasi Manual - Unduh chathub.zip dari [Release](https://github.com/chathub-dev/chathub/releases) - Ekstrak file - Di Chrome/Edge, buka halaman ekstensi (chrome://extensions atau edge://extensions) - Aktifkan Mode Pengembang - Seret folder yang telah diekstrak ke mana saja di halaman untuk mengimpor (jangan hapus folder setelah itu) ## 🔨 Membangun dari Source - Clone source code - `yarn install` - `yarn build` - Muat folder `dist` ke browser dengan mengikuti langkah-langkah dalam _Instalasi Manual_ ## 📜 Changelog ### v1.22.0 - Mendukung Claude API ### v1.21.0 - Menambahkan lebih banyak model open-source ### v1.20.0 - Akses dari panel samping Chrome ### v1.19.0 - Akses cepat ke prompt ### v1.18.0 - Mendukung Alpaca, Vicuna, dan ChatGLM ### v1.17.0 - Mendukung model Browsing GPT-4 ### v1.16.5 - Menambahkan dukungan layanan Azure OpenAI ### v1.16.0 - Menambahkan pengaturan tema kustom ### v1.15.0 - Menambahkan bot Xunfei Spark ### v1.14.0 - Mendukung lebih banyak bot dalam mode all-in-one untuk pengguna premium ### v1.12.0 - Menambahkan lisensi premium ### v1.11.0 - Dukungan Claude (melalui Poe) ### v1.10.0 - Command + K ### v1.9.4 - Mode gelap ### v1.9.3 - Dukungan rumus matematika dengan katex - Simpan prompt komunitas ke lokal ### v1.9.2 - Hapus riwayat pesan ### v1.9.0 - Bagikan percakapan sebagai markdown atau melalui sharegpt.com ### v1.8.0 - Impor/Ekspor semua data - Edit prompt lokal - Mengalihkan chatbot untuk dibandingkan ### v1.7.0 - Menambahkan riwayat percakapan ### v1.6.0 - Menambahkan dukungan untuk Google Bard ### v1.5.4 - Dukungan model GPT-4 dalam mode api ChatGPT ### v1.5.1 - Menambahkan pengaturan i18n ### v1.5.0 - Dukungan model GPT-4 dalam mode Webapp ChatGPT ### v1.4.0 - Menambahkan Prompt Library ### v1.3.0 - Menambahkan tombol salin kode - Sinkronisasi status chat antara all-in-one dan mode mandiri - Memungkinkan input sambil menghasilkan jawaban ### v1.2.0 - Dukungan untuk menyalin teks pesan - Perbaiki gaya elemen formulir halaman pengaturan ================================================ FILE: README_JA.md ================================================

ChatHub

### ChatHub はオールインワンのチャットボットクライアントです [![author][author-image]][author-url] [![license][license-image]][license-url] [![release][release-image]][release-url] [![last commit][last-commit-image]][last-commit-url] [English](README.md)   |   [Indonesia](README_IN.md)   |   [简体中文](README_ZH-CN.md)   |   [繁體中文](README_ZH-TW.md)   |   日本語 ## ### インストール Chromium 用の ChatHub を入手してください Microsoft Edge 用の ChatHub を入手してください ## [スクリーンショット](#-スクリーンショット)   |   [特徴](#-特徴)   |   [サポートされているボット](#-サポートされているボット)   |   [手動インストール](#-手動インストール)   |   [ソースからビルドする](#-ソースからビルドする)   |   [変更ログ](#-変更ログ) [author-image]: https://img.shields.io/badge/author-wong2-blue.svg [author-url]: https://github.com/wong2 [license-image]: https://img.shields.io/github/license/chathub-dev/chathub?color=blue [license-url]: https://github.com/chathub-dev/chathub/blob/main/LICENSE [release-image]: https://img.shields.io/github/v/release/chathub-dev/chathub?color=blue [release-url]: https://github.com/chathub-dev/chathub/releases/latest [last-commit-image]: https://img.shields.io/github/last-commit/chathub-dev/chathub?label=last%20commit [last-commit-url]: https://github.com/chathub-dev/chathub/commits
## ## 📷 スクリーンショット ![Screenshot](screenshots/extension.png?raw=true) ![Screenshot (Dark Mode)](screenshots/dark.png?raw=true) ## ✨ 特徴 - 🤖 アプリ内で異なるチャットボットを使用できます。現在は ChatGPT、新しい Bing Chat、Google Bard、Claude、および Alpaca、Vicuna、ChatGLM などを含む10以上のオープンソースモデルをサポートしています - 💬 複数のチャットボットと同時にチャットすることで、回答を比較しやすくします - 🚀 ChatGPT API および GPT-4 Browsing をサポートします - 🔍 ブラウザのどこからでもアプリを素早くアクティブにするためのショートカット - 🎨 Markdown とコードのハイライトのサポート - 📚 カスタムプロンプトとコミュニティプロンプトのためのプロンプトライブラリ - 💾 ローカルに保存された会話履歴 - 📥 データのエクスポートとインポート - 🔗 マークダウン形式で会話を共有 - 🌙 ダークモード ## 🤖 サポートされているボット * ChatGPT(Web アプリ/API/Azure/Poe経由) * Bing Chat * Google Bard * Claude(Poe 経由) * iFlytek Spark * ChatGLM * Alpaca * Vicuna * Koala * Dolly * LLaMA * StableLM * OpenAssistant * ChatRWKV * ... ## 🔧 手動インストール - [リリース](https://github.com/chathub-dev/chathub/releases)から chathub.zip をダウンロード - ファイルを解凍 - Chrome/Edge で拡張機能ページに移動します (chrome://extensions または edge://extensions) - 開発者モードを有効にする - 解凍したフォルダーをページ上の任意の場所にドラッグしてインポートします (後でフォルダーを削除しないでください) ## 🔨 ソースからビルドする - ソースコードをクローン - `yarn install` - `yarn build` - _マニュアルインストール_ の手順に従って、`dist` _フォルダをブラウザに読み込みます_ ## 📜 変更ログ ### v1.22.0 - Claude API のサポートを追加 ### v1.21.0 - より多くのオープンソースモデルを追加 ### v1.20.0 - Chrome のサイドパネルからアクセスできるようにしました ### v1.19.0 - プロンプトへの簡単アクセス ### v1.18.0 - Alpaca、Vicuna、ChatGLM のサポート ### v1.17.0 - GPT-4 Browsing モデルのサポート ### v1.16.5 - Azure OpenAI サービスのサポートを追加 ### v1.16.0 - カスタムテーマ設定を追加 ### v1.15.0 - Xunfei Spark ボットを追加 ### v1.14.0 - プレミアムユーザー向けのオールインワンモードで、より多くのボットをサポート ### v1.12.0 - プレミアムライセンスを追加 ### v1.11.0 - クロードのサポートを追加 (Poe経由で) ### v1.10.0 - Command + K ### v1.9.4 - ダークモード ### v1.9.3 - katex で数式をサポート - コミュニティプロンプトをローカルに保存 ### v1.9.2 - 履歴メッセージを削除する ### v1.9.0 - markdown として、または sharegpt.com 経由でチャットを共有する ### v1.8.0 - すべてのデータのインポート/エクスポート - ローカルプロンプトを編集する - 比較のためにチャットボットを切り替える ### v1.7.0 - 会話履歴を追加する ### v1.6.0 - Google Bard のサポートを追加 ### v1.5.4 - ChatGPT api モードで GPT-4 モデルをサポート ### v1.5.1 - i18n 設定を追加 ### v1.5.0 - ChatGPT Webapp モードで GPT-4 モデルをサポート ### v1.4.0 - プロンプトライブラリを追加 ### v1.3.0 - コピーコードボタンを追加 - オールインワンモードとスタンドアロンモードの間でチャット状態を同期 - 回答の生成中に入力を許可 ### v1.2.0 - コピーメッセージテキストのサポート - ページフォーム要素スタイルの設定を改善 ================================================ FILE: README_ZH-CN.md ================================================

ChatHub

### ChatHub 是款全能聊天机器人客户端 [![作者][作者-image]][作者-url] [![许可证][许可证-image]][许可证-url] [![发布][发布-image]][发布-url] [![最后提交][最后提交-image]][最后提交-url] [English](README.md)   |   [Indonesia](README_IN.md)   |   简体中文   |   [繁體中文](README_ZH-TW.md)   |   [日本語](README_JA.md) ## ### 安装 获取 Chromium 版 ChatHub   获取 Microsoft Edge 版 ChatHub ## [截图](#-截图)   |   [特点](#-特点)   |   [支持的聊天机器人](#-支持的聊天机器人)   |   [手动安装](#-手动安装)   |   [从源代码构建](#-从源代码构建)   |   [更新日志](#-更新日志) [作者-image]: https://img.shields.io/badge/author-wong2-blue.svg [作者-url]: https://github.com/wong2 [许可证-image]: https://img.shields.io/github/license/chathub-dev/chathub?color=blue [许可证-url]: https://github.com/chathub-dev/chathub/blob/main/LICENSE [发布-image]: https://img.shields.io/github/v/release/chathub-dev/chathub?color=blue [发布-url]: https://github.com/chathub-dev/chathub/releases/latest [最后提交-image]: https://img.shields.io/github/last-commit/chathub-dev/chathub?label=last%20commit [最后提交-url]: https://github.com/chathub-dev/chathub/commits
## ## 📷 截图 ![截图](screenshots/extension.png?raw=true) ![截图 (暗黑模式)](screenshots/dark.png?raw=true) ## ✨ 特点 - 🤖 在一个应用中使用不同的聊天机器人,目前支持 ChatGPT、新的 Bing Chat、Google Bard、Claude 以及包括 Alpaca、Vicuna、ChatGLM 等在内的 10 多个开源模型 - 💬 同时与多个聊天机器人进行对话,方便比较它们的回答 - 🚀 支持 ChatGPT API 和 GPT-4 浏览 - 🔍 快捷方式,可在浏览器的任何位置快速激活应用 - 🎨 支持 Markdown 和代码高亮显示 - 📚 自定义提示和社区提示的提示库 - 💾 本地保存对话历史 - 📥 导出和导入所有数据 - 🔗 将对话转为 Markdown 并分享 - 🌙 暗黑模式 ## 🤖 支持的聊天机器人 * ChatGPT(通过 Web 应用/API/Azure/Poe) * Bing Chat * Google Bard * Claude(通过 Poe) * iFlytek Spark * ChatGLM * Alpaca * Vicuna * Koala * Dolly * LLaMA * StableLM * OpenAssistant * ChatRWKV * ... ## 🔧 手动安装 - 从 [Releases](https://github.com/chathub-dev/chathub/releases) 下载 chathub.zip - 解压文件 - 在 Chrome/Edge 中进入扩展页面 (chrome://extensions 或 edge://extensions) - 启用开发者模式 - 将解压后的文件夹拖到页面上的任何位置进行导入(导入后不要删除文件夹) ## 🔨 从源代码构建 - 克隆源代码 - 运行 `yarn install` - 运行 `yarn build` - 按照 _手动安装_ 中的步骤将 `dist` _文件夹加载到浏览器中_ ## 📜 更新日志 ### v1.22.0 - 支持 Claude API ### v1.21.0 - 添加更多开源模型 ### v1.20.0 - 从 Chrome 侧边栏访问 ### v1.19.0 - 快速访问提示 ### v1.18.0 - 支持 Alpaca、Vicuna 和 ChatGLM ### v1.17.0 - 支持 GPT-4 浏览模型 ### v1.16.5 - 增加 Azure OpenAI 服务支持 ### v1.16.0 - 增加自定义主题设置 ### v1.15.0 - 增加讯飞 Spark 机器人 ### v1.14.0 - 为高级用户在全能模式中支持更多机器人 ### v1.12.0 - 增加高级许可证 ### v1.11.0 - 支持 Claude (via Poe) ### v1.10.0 - 新增了快捷键 Command + K ### v1.9.4 - 新增了暗黑模式 ### v1.9.3 - 支持使用 katex 插件输入数学公式 - 可以将社区提示保存到本地 ### v1.9.2 - 可以删除历史消息 ### v1.9.0 - 可以将聊天记录分享为 Markdown 或通过 sharegpt.com 分享 ### v1.8.0 - 可以导入/导出所有数据 - 可以编辑本地提示 - 可以切换聊天机器人进行比较 ### v1.7.0 - 新增了对话历史记录 ### v1.6.0 - 增加了对 Google Bard 的支持 ### v1.5.4 - 在 ChatGPT API 模式下支持 GPT-4 模型 ### v1.5.1 - 增加了国际化设置 ### v1.5.0 - 在 ChatGPT Webapp 模式下支持 GPT-4 模型 ### v1.4.0 - 新增了 Prompt 库 ### v1.3.0 - 增加了复制代码按钮 - 在全合一模式和独立模式之间同步聊天状态 - 允许在生成答案时输入 ### v1.2.0 - 支持复制消息文本 - 改进了设置页面表单元素的样式 ================================================ FILE: README_ZH-TW.md ================================================

ChatHub

### ChatHub 是個全能的聊天機器人客戶端 [![作者][作者-image]][作者-url] [![許可證][許可證-image]][許可證-url] [![發布][發布-image]][發布-url] [![版本發佈][版本發佈-image]][版本發佈-url] [English](README.md)   |   [Indonesia](README_IN.md)   |   [简体中文](README_ZH-CN.md)   |   繁體中文   |   [日本語](README_JA.md) ## ### 安装 获取 Chromium 版本的 ChatHub   获取 Microsoft Edge 版本的 ChatHub ## [螢幕截圖](#-螢幕截圖)   |   [功能特色](#-功能特色)   |   [支援的聊天機器人](#-支援的聊天機器人)   |   [手動安裝](#-手動安裝)   |   [從原始碼建立](#-從原始碼建立)   |   [更新日誌](#-更新日誌) [作者-image]: https://img.shields.io/badge/author-wong2-blue.svg [作者-url]: https://github.com/wong2 [許可證-image]: https://img.shields.io/github/license/chathub-dev/chathub?color=blue [許可證-url]: https://github.com/chathub-dev/chathub/blob/main/LICENSE [發布-image]: https://img.shields.io/github/v/release/chathub-dev/chathub?color=blue [發布-url]: https://github.com/chathub-dev/chathub/releases/latest [版本發佈-image]: https://img.shields.io/github/last-commit/chathub-dev/chathub?label=last%20commit [版本發佈-url]: https://github.com/chathub-dev/chathub/commits
## ## 📷 螢幕截圖 ![螢幕截圖](screenshots/extension.png?raw=true) ![螢幕截圖 (暗模式)](screenshots/dark.png?raw=true) ## ✨ 功能特色 - 🤖 在一個應用程式中使用不同的聊天機器人,目前支援 ChatGPT、新的 Bing Chat、Google Bard、Claude,還有 10 多個開源模型,包括 Alpaca、Vicuna、ChatGLM 等 - 💬 同時與多個聊天機器人進行對話,輕鬆比較它們的回答 - 🚀 支援 ChatGPT API 和 GPT-4 瀏覽 - 🔍 快速啟動應用程式的捷徑,可在瀏覽器中的任何地方使用 - 🎨 支援 Markdown 和程式碼高亮顯示 - 📚 自訂提示和社群提示的提示庫 - 💾 本地保存對話歷史 - 📥 匯出和匯入所有資料 - 🔗 將對話分享為 Markdown 格式 - 🌙 黑暗模式 ## 🤖 支援的聊天機器人 * ChatGPT(透過網頁應用程式/API/Azure/Poe) * Bing Chat * Google Bard * Claude(透過 Poe) * iFlytek Spark * ChatGLM * Alpaca * Vicuna * Koala * Dolly * LLaMA * StableLM * OpenAssistant * ChatRWKV * ... ## 🔧 手動安裝 - 從 [Releases](https://github.com/chathub-dev/chathub/releases) 下載 chathub.zip - 解壓縮該文件 - 在 Chrome/Edge 瀏覽器中,前往擴展功能頁面 (chrome://extensions 或 edge://extensions) - 啟用開發人員模式 - 拖動解壓縮後的文件夾到頁面上的任何位置以導入它 (導入後不要刪除文件夾) ## 🔨 從原始碼建立 - 複製原始碼 - `yarn install` - `yarn build` - 按照「手動安裝」中的步驟將 `dist` _資料夾載入瀏覽器_ ## 📜 更新日誌 ### v1.22.0 - 支援 Claude API ### v1.21.0 - 新增更多開源模型 ### v1.20.0 - 從 Chrome 側邊面板進入 ### v1.19.0 - 快速存取提示 ### v1.18.0 - 支援 Alpaca、Vicuna 和 ChatGLM ### v1.17.0 - 支援 GPT-4 瀏覽模型 ### v1.16.5 - 新增支援 Azure OpenAI 服務 ### v1.16.0 - 新增自訂主題設定 ### v1.15.0 - 新增訊飛 Spark 機器人 ### v1.14.0 - 支援高級用戶的全能模式中的更多機器人 ### v1.12.0 - 新增高級授權 ### v1.11.0 - 支援 Claude (透過 Poe) ### v1.10.0 - 新增 Command + K 功能 ### v1.9.4 - 新增暗模式 ### v1.9.3 - 支援使用 katex 的數學公式 - 將社區提示保存到本地 ### v1.9.2 - 刪除對話歷史消息 ### v1.9.0 - 可將聊天記錄以 Markdown 格式或通過 sharegpt.com 分享 ### v1.8.0 - 匯出/匯入所有數據 - 編輯本地提示 - 切換聊天機器人以進行比較 ### v1.7.0 - 新增對話歷史 ### v1.6.0 - 新增支援 Google Bard ### v1.5.4 - 支援 ChatGPT API 模式下的 GPT-4 模型 ### v1.5.1 - 新增 i18n 設置 ### v1.5.0 - 支援 ChatGPT Webapp 模式下的 GPT-4 模型 ### v1.4.0 - 新增提示庫 ### v1.3.0 - 新增複製代碼按鈕 - 在全能模式和獨立模式之間同步聊天狀態 - 允許在生成答案時輸入 ### v1.2.0 - 支援複製消息文本 - 改善設置頁面表單元素樣式 ================================================ FILE: _locales/de/messages.json ================================================ { "appName": { "message": "ChatHub - All-in-One Chatbot Klient" }, "appDesc": { "message": "Bessere Benutzeroberfläche für Ihre Lieblings-Chatbots" } } ================================================ FILE: _locales/en/messages.json ================================================ { "appName": { "message": "ChatHub - All-in-one chatbot client" }, "appDesc": { "message": "Use ChatGPT, Bing, Bard, Claude and more chatbots simultaneously" } } ================================================ FILE: _locales/es/messages.json ================================================ { "appName": { "message": "ChatHub - Cliente de chatbot todo en uno" }, "appDesc": { "message": "Utiliza ChatGPT, Bing, Bard, Claude y más chatbots simultáneamente" } } ================================================ FILE: _locales/fr/messages.json ================================================ { "appName": { "message": "ChatHub - Client de chatbot tout-en-un" }, "appDesc": { "message": "Une meilleure interface utilisateur pour vos chatbots préférés" } } ================================================ FILE: _locales/in/messages.json ================================================ { "appName": { "message": "ChatHub - Semua klien chatbot dalam satu tempat" }, "appDesc": { "message": "Semua chatbot favorit Anda dalam satu tempat" } } ================================================ FILE: _locales/ja/messages.json ================================================ { "appName": { "message": "ChatHub - オールインワンチャットボットクライアント" }, "appDesc": { "message": "ChatGPT、Bing、Bard、およびClaudeを一つのプラットフォームで使用します" } } ================================================ FILE: _locales/pt_BR/messages.json ================================================ { "appName": { "message": "ChatHub - All-in-one chatbot client" }, "appDesc": { "message": "Use o ChatGPT, Bing, Bard, Claude e mais chatbots simultaneamente" } } ================================================ FILE: _locales/pt_PT/messages.json ================================================ { "appName": { "message": "ChatHub - All-in-one chatbot client" }, "appDesc": { "message": "Use o ChatGPT, Bing, Bard, Claude e mais chatbots simultaneamente" } } ================================================ FILE: _locales/ru/messages.json ================================================ { "appName": { "message": "ChatHub — универсальный клиент для чат-ботов" }, "appDesc": { "message": "Улучшенный UI для ваших любимых чат-ботов" } } ================================================ FILE: _locales/th/messages.json ================================================ { "appName": { "message": "ChatHub - ไคลเอนต์แชทบอทแบบครบวงจร" }, "appDesc": { "message": "UI ที่ดีกว่ากับแชทบอทที่คุณชื่นชอบ" } } ================================================ FILE: _locales/zh_CN/messages.json ================================================ { "appName": { "message": "ChatHub - All-in-one chatbot client" }, "appDesc": { "message": "同时使用ChatGPT, Bing, Bard和更多机器人" } } ================================================ FILE: _locales/zh_TW/messages.json ================================================ { "appName": { "message": "ChatHub - 全方位聊天機器人客戶端" }, "appDesc": { "message": "為您最喜愛的聊天機器人提供更好的用戶界面" } } ================================================ FILE: app.html ================================================ ChatHub
================================================ FILE: global.d.ts ================================================ declare module '*.gql' ================================================ FILE: manifest.config.ts ================================================ import { defineManifest } from '@crxjs/vite-plugin' export default defineManifest(async () => { return { manifest_version: 3, name: '__MSG_appName__', description: '__MSG_appDesc__', default_locale: 'en', version: '1.45.7', icons: { '16': 'src/assets/icon.png', '32': 'src/assets/icon.png', '48': 'src/assets/icon.png', '128': 'src/assets/icon.png', }, background: { service_worker: 'src/background/index.ts', type: 'module', }, action: {}, host_permissions: [ 'https://*.bing.com/', 'https://*.openai.com/', 'https://bard.google.com/', 'https://*.chathub.gg/', 'https://*.duckduckgo.com/', 'https://*.poe.com/', 'https://*.anthropic.com/', 'https://*.claude.ai/', ], optional_host_permissions: ['https://*/*', 'wss://*/*'], permissions: ['storage', 'unlimitedStorage', 'sidePanel', 'declarativeNetRequestWithHostAccess', 'scripting'], content_scripts: [ { matches: ['https://chat.openai.com/*'], js: ['src/content-script/chatgpt-inpage-proxy.ts'], }, ], commands: { 'open-app': { suggested_key: { default: 'Alt+J', windows: 'Alt+J', linux: 'Alt+J', mac: 'Command+J', }, description: 'Open ChatHub app', }, }, side_panel: { default_path: 'sidepanel.html', }, declarative_net_request: { rule_resources: [ { id: 'ruleset_bing', enabled: true, path: 'src/rules/bing.json', }, { id: 'ruleset_ddg', enabled: true, path: 'src/rules/ddg.json', }, { id: 'ruleset_qianwen', enabled: true, path: 'src/rules/qianwen.json', }, { id: 'ruleset_baichuan', enabled: true, path: 'src/rules/baichuan.json', }, { id: 'ruleset_pplx', enabled: true, path: 'src/rules/pplx.json', }, ], }, } }) ================================================ FILE: package.json ================================================ { "name": "chathub-extension", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "tsc && vite build" }, "devDependencies": { "@crxjs/vite-plugin": "2.0.0-beta.21", "@headlessui/tailwindcss": "^0.2.0", "@types/cookie": "^0.6.0", "@types/humanize-duration": "^3.27.3", "@types/lodash-es": "^4.17.12", "@types/md5": "^2.3.5", "@types/react": "18.2.18", "@types/react-color": "^3.0.10", "@types/react-copy-to-clipboard": "^5.0.7", "@types/react-dom": "^18.2.18", "@types/react-scroll-to-bottom": "^4.2.4", "@types/turndown": "^5.0.4", "@types/uuid": "^9.0.7", "@types/webextension-polyfill": "^0.10.7", "@typescript-eslint/eslint-plugin": "^6.15.0", "@typescript-eslint/parser": "^6.15.0", "@vitejs/plugin-react": "^4.2.1", "autoprefixer": "^10.4.16", "chrome-types": "^0.1.246", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "postcss": "^8.4.32", "postcss-import": "^15.1.0", "postcss-nesting": "^12.0.2", "prettier": "^3.1.1", "process": "^0.11.10", "sass": "^1.69.5", "tailwind-scrollbar": "^3.0.5", "tailwindcss": "^3.4.0", "typescript": "^5.3.3", "vite": "4.5.1", "vite-tsconfig-paths": "^4.2.2" }, "dependencies": { "@epic-web/cachified": "^4.0.0", "@floating-ui/react": "^0.26.4", "@google/generative-ai": "^0.1.3", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.1.1", "@radix-ui/react-tooltip": "^1.0.7", "@sentry/integrations": "^7.90.0", "@sentry/react": "^7.90.0", "@tanstack/react-router": "^1.43.6", "async-cache-dedupe": "^2.0.0", "browser-fs-access": "^0.35.0", "browser-image-compression": "^2.0.2", "clsx": "^2.0.0", "compare-versions": "^6.1.0", "cookie": "^0.6.0", "dayjs": "^1.11.10", "eventsource-parser": "^1.1.1", "framer-motion": "^10.16.16", "fuse.js": "^7.0.0", "github-markdown-css": "^5.5.0", "gpt3-tokenizer": "^1.1.5", "highlight.js": "^11.9.0", "humanize-duration": "^3.31.0", "i18next": "^23.7.11", "i18next-browser-languagedetector": "^7.2.0", "immer": "^10.0.3", "inter-ui": "^3.19.3", "jotai": "^2.6.0", "jotai-immer": "^0.2.0", "js-base64": "^3.7.5", "lodash-es": "^4.17.21", "md5": "^2.3.0", "nanoid": "^5.0.4", "ofetch": "^1.3.3", "plausible-tracker": "^0.3.8", "react": "^18.2.0", "react-color": "^2.19.3", "react-confetti-explosion": "^2.1.2", "react-copy-to-clipboard": "^5.1.0", "react-dom": "^18.2.0", "react-hot-toast": "^2.4.1", "react-i18next": "^13.5.0", "react-icons": "^4.12.0", "react-markdown": "^8.0.7", "react-node-to-string": "^0.1.2", "react-scroll-to-bottom": "^4.2.0", "react-spinners": "^0.13.8", "react-textarea-autosize": "^8.5.3", "react-viewport-list": "^7.1.2", "rehype-highlight": "^6.0.0", "rehype-stringify": "^9.0.4", "remark-breaks": "^3.0.3", "remark-gfm": "^3.0.1", "remark-math": "^5.1.1", "remark-parse": "^10.0.2", "remark-rehype": "^10.1.0", "remark-supersub": "^1.0.0", "slashes": "^3.0.12", "swr": "^2.2.4", "tailwind-merge": "^2.1.0", "turndown": "^7.1.2", "unified": "^10.1.2", "uuid": "^9.0.1", "webextension-polyfill": "^0.10.0", "websocket-as-promised": "^2.0.1" }, "packageManager": "yarn@4.0.1" } ================================================ FILE: postcss.config.cjs ================================================ module.exports = { plugins: { 'postcss-import': {}, 'tailwindcss/nesting': 'postcss-nesting', tailwindcss: {}, autoprefixer: {}, }, } ================================================ FILE: public/js/v2/35536E1E-65B4-4D96-9D97-6ADB7EFF8147/api.js ================================================ var arkoseLabsClientApi2c145230;!function(){var e={7983:function(e,t){"use strict";t.N=void 0;var n=/^([^\w]*)(javascript|data|vbscript)/im,r=/&#(\w+)(^\w|;)?/g,i=/&tab;/gi,o=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,a=/^.+(:|:)/gim,c=[".","/"];t.N=function(e){var t,s=(t=e||"",(t=t.replace(i," ")).replace(r,(function(e,t){return String.fromCharCode(t)}))).replace(o,"").trim();if(!s)return"about:blank";if(function(e){return c.indexOf(e[0])>-1}(s))return s;var u=s.match(a);if(!u)return s;var l=u[0];return n.test(l)?"about:blank":s}},3940:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var c=0;c0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=o),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),i&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=i):l[4]="".concat(i)),t.push(l))}},t}},3835:function(e){"use strict";e.exports=function(e){return e[1]}},913:function(e,t,n){var r,i,o;!function(a,c){"use strict";i=[n(4486)],void 0===(o="function"==typeof(r=function(e){var t=/(^|@)\S+:\d+/,n=/^\s*at .*(\S+:\d+|\(native\))/m,r=/^(eval@)?(\[native code])?$/;return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(n))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter((function(e){return!!e.match(n)}),this).map((function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var n=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],""):n;var i=this.extractLocation(r?r[1]:n),o=r&&n||void 0,a=["eval",""].indexOf(i[0])>-1?void 0:i[0];return new e({functionName:o,fileName:a,lineNumber:i[1],columnNumber:i[2],source:t})}),this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter((function(e){return!e.match(r)}),this).map((function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e({functionName:t});var n=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(n),i=r&&r[1]?r[1]:void 0,o=this.extractLocation(t.replace(n,""));return new e({functionName:i,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split("\n"),i=[],o=2,a=r.length;o/,"$2").replace(/\([^)]*\)/g,"")||void 0;o.match(/\(([^)]*)\)/)&&(n=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var c=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new e({functionName:a,args:c,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:t})}),this)}}})?r.apply(t,i):r)||(e.exports=o)}()},2265:function(e){"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var c=new i(r,o||e,a),s=n?n+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],c]:e._events[s].push(c):(e._events[s]=c,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function c(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),c.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},c.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i-1},_e.prototype.set=function(e,t){var n=this.__data__,r=Ie(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ae.prototype.clear=function(){this.__data__={hash:new ke,map:new(ve||_e),string:new ke}},Ae.prototype.delete=function(e){return Fe(this,e).delete(e)},Ae.prototype.get=function(e){return Fe(this,e).get(e)},Ae.prototype.has=function(e){return Fe(this,e).has(e)},Ae.prototype.set=function(e,t){return Fe(this,e).set(e,t),this},Te.prototype.clear=function(){this.__data__=new _e},Te.prototype.delete=function(e){return this.__data__.delete(e)},Te.prototype.get=function(e){return this.__data__.get(e)},Te.prototype.has=function(e){return this.__data__.has(e)},Te.prototype.set=function(e,t){var n=this.__data__;if(n instanceof _e){var r=n.__data__;if(!ve||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ae(r)}return n.set(e,t),this};var Me=le?V(le,Object):function(){return[]},qe=function(e){return te.call(e)};function ze(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||I.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=i}(e.length)&&!Xe(e)}var Be=fe||function(){return!1};function Xe(e){var t=Ge(e)?te.call(e):"";return t==s||t==u}function Ge(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Je(e){return We(e)?Pe(e):function(e){if(!He(e))return de(e);var t=[];for(var n in Object(e))ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Re(e,!0,!0)}},4486:function(e,t){var n,r,i;!function(o,a){"use strict";r=[],void 0===(i="function"==typeof(n=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function n(e){return function(){return this[e]}}var r=["isConstructor","isEval","isNative","isToplevel"],i=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=["args"],c=["evalOrigin"],s=r.concat(i,o,a,c);function u(e){if(e)for(var n=0;n0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0;var r={};!function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,n||"default");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"===e(n)?n:String(n)}function i(e,n){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"api",t=function(e){if(document.currentScript)return document.currentScript;var t="enforcement"===e?'script[id="enforcementScript"]':'script[src*="v2"][src*="api.js"][data-callback]',n=document.querySelectorAll(t);if(n&&1===n.length)return n[0];try{throw new Error}catch(e){try{var r=te().parse(e)[0].fileName;return document.querySelector('script[src="'.concat(r,'"]'))}catch(e){return null}}}(e);if(!t)return null;var n=t.src,r={};try{r=function(e){if(!e)throw new Error("Empty URL");var t=e.toLowerCase().split("/v2/").filter((function(e){return""!==e}));if(t.length<2)throw new Error("Invalid Client-API URL");var n=t[0],r=t[1].split("/").filter((function(e){return""!==e}));return{host:n,key:ne(r[0])?r[0].toUpperCase():null,extHost:n}}(n)}catch(e){}if(e===N){var i=window.location.hash;if(i.length>0){var o=("#"===i.charAt(0)?i.substring(1):i).split("&"),a=o[0];r.key=ne(a)?a:r.key,r.id=o[1]}}return r}(),ie=function(e,t){for(var n,r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var ve=function(){return window&&window.crypto&&"function"==typeof window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},he=n(2265),ge=n.n(he),me=n(7983);function ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function be(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};try{var n=function(e){return JSON.parse(e)}(e.data),r=n||{},i=r.data,o=r.key,a=r.message,c=r.type,s=Oe(i);if(a&&o===t.config.identifier)return t.emitter.emit(a,s),"broadcast"===c&&t.postMessageToParent({data:s,key:o,message:a}),void("emit"===c&&t.postMessageToChildren({data:s,key:o,message:a}));n&&"FunCaptcha-action"===n.msg&&t.postMessageToChildren({data:Se(Se({},n),n.payload||{})})}catch(n){if(e.data===q)return void t.emitter.emit(q,{});if(e.data===D)return void t.emitter.emit(D,{});if(e.data.msg===M)return void t.emitter.emit(M,{});"string"==typeof e.data&&-1!==e.data.indexOf("key_pressed_")&&t.config.iframePosition===N&&window.parent&&"function"==typeof window.parent.postMessage&&window.parent.postMessage(e.data,"*")}}}return o(e,[{key:"context",set:function(e){this.config.context=e}},{key:"identifier",set:function(e){this.config.identifier=e}},{key:"setup",value:function(e,t){var n,r,i;this.config.identifier!==this.identifier&&(n=window,r=this.config.identifier,(i=n[H])&&i[r]&&(i[r].listener&&window.removeEventListener("message",i[r].listener),i[r].error&&window.removeEventListener("error",i[r].error),delete i[r])),this.config.identifier=e,this.config.iframePosition=t,fe(window,this.config.identifier);var o=window[H][this.config.identifier].listener;o&&window.removeEventListener("message",o),de(window,this.config.identifier,"listener",this.messageListener),window.addEventListener("message",window[H][this.config.identifier].listener)}},{key:"postMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=t.data,r=t.key,i=t.message,o=t.type;if(se(e.postMessage)){var a=Se(Se({},n),{},{data:n,key:r,message:i,type:o});e.postMessage(function(e){return JSON.stringify(e)}(a),this.config.target)}}},{key:"postMessageToChildren",value:function(e){for(var t=e.data,n=e.key,r=e.message,i=document.querySelectorAll("iframe"),o=[],a=0;a1&&void 0!==arguments[1]&&arguments[1],n=Date.now();Te||(Te=n,Pe=n);var r=n-Te,i=n-Pe;Ie&&(t?console.debug("%c".concat(Ce).concat(e,": ").concat(r," since last event - ").concat(i," total time - ").concat(Date.now()),"color: ".concat(t,";")):console.debug("".concat(Ce).concat(e,": ").concat(r," since last event - ").concat(i," total time - ").concat(Date.now()))),Te=n},Me=n(3940),qe=n.n(Me),ze=We;!function(e,t){for(var n=119,r=134,i=122,o=118,a=133,c=131,s=137,u=107,l=113,f=We,d=e();;)try{if(379847===-parseInt(f(n))/1*(-parseInt(f(r))/2)+parseInt(f(i))/3+parseInt(f(o))/4+parseInt(f(a))/5+-parseInt(f(c))/6+parseInt(f(s))/7*(-parseInt(f(u))/8)+-parseInt(f(l))/9)break;d.push(d.shift())}catch(e){d.push(d.shift())}}(Je);var He,$e,Ue=(He=115,$e=!0,function(e,t){var n=$e?function(){if(t){var n=t[We(He)](e,arguments);return t=null,n}}:function(){};return $e=!1,n}),Ve=Ue(void 0,(function(){var e=117,t=121,n=132,r=109,i=We;return Ve[i(e)]()[i(t)](i(n)+i(r))[i(e)]().constructor(Ve)[i(t)]("(((.+)+)+)+$")}));function We(e,t){var n=Je();return We=function(e,t){return n[e-=102]},We(e,t)}Ve();var Be=[ze(135),ze(116)+ze(102)],Xe={};Xe[ze(130)]=!0;var Ge={};function Je(){var e=["operty","98752jXTTXx","hasOwnPr","+)+$","forEach","enabled","eOffset","3115449jUsVhz","call","apply","ECRespon","toString","1311240fFqRvl","63617knDNJe","prototyp","search","1622595aRpzHJ","theme","closeOnE","eButton","keys","observab","optional","hideClos","default","4164720ByzkrJ","(((.+)+)","1499220eaMZBt","18zEdzoa","lightbox","ility","182OLSPTB","sive","length","settings","landscap"];return(Je=function(){return e})()}Ge.default=!1;var Ze={};Ze[ze(124)+"sc"]=Xe,Ze[ze(129)+ze(125)]=Ge;var Ye={};Ye[ze(130)]=!0;var Qe={};Qe[ze(130)]=70;var et={};et[ze(111)]=Ye,et[ze(105)+ze(112)]=Qe;var tt={};tt[ze(130)]={};var nt={optional:!0},rt={};rt[ze(135)]=Ze,rt[ze(116)+ze(102)]=et,rt[ze(127)+ze(136)]=tt,rt.f=nt;var it=rt,ot=function(){var e=123,t=104,n=135,r=116,i=102,o=110,a=126,c=120,s=108,u=106,l=114,f=128,d=110,p=ze,v=arguments[p(103)]>0&&void 0!==arguments[0]?arguments[0]:{},h=v[p(e)],g=void 0===h?null:h,m=v[p(t)]||v,y={};y[p(n)]={},y[p(r)+p(i)]={};var b=y;["lightbox",p(r)+p(i)][p(o)]((function(e){var t=120,n=106,r=114,i=p,o=m[e]||{},a=it[e];Object.keys(a)[i(d)]((function(c){var s=i;Object[s(t)+"e"]["hasOwnPr"+s(n)][s(r)](o,c)?b[e][c]=o[c]:b[e][c]=a[c].default}))})),g&&(b.theme=g);it[p(n)],it[p(r)+p(i)];var w=pe(it,Be);return Object[p(a)](w).forEach((function(e){var t=p;Object[t(c)+"e"][t(s)+t(u)][t(l)](m,e)?b[e]=m[e]:!0!==it[e][t(f)]&&(b[e]=it[e].default)})),b},at=n(3379),ct=n.n(at),st=n(7795),ut=n.n(st),lt=n(569),ft=n.n(lt),dt=n(3565),pt=n.n(dt),vt=n(9216),ht=n.n(vt),gt=n(4589),mt=n.n(gt),yt=n(903),bt={};bt.styleTagTransform=mt(),bt.setAttributes=pt(),bt.insert=ft().bind(null,"head"),bt.domAPI=ut(),bt.insertStyleElement=ht();ct()(yt.Z,bt);var wt=yt.Z&&yt.Z.locals?yt.Z.locals:void 0;function Ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var jt={show:!1,isActive:void 0,element:void 0,frame:void 0,mode:void 0,ECResponsive:!0,enforcementUrl:null},St=function(e,t){e.setAttribute("class",t)},xt=function(){return qe()(wt.container,function(e){for(var t=1;t=parseInt(i,10)&&(s=i),f<=parseInt(r,10)&&(s=r),a&&d>=parseInt(a,10)&&(u=a),o&&d<=parseInt(o,10)&&(u=o)}return s=le(s),{height:u=le(u),width:s}}({width:t,height:n,minWidth:r,maxWidth:o,minHeight:i,maxHeight:a,landscapeOffset:jt.ECResponsive.landscapeOffset||0});u=l.width,s=l.height}var f=!1;t&&t!==jt.frame.style.width&&(jt.frame.style.width=t,f=!0),n&&n!==jt.frame.style.height&&(jt.frame.style.height=n,f=!0),jt.mode===p&&(r&&r!==jt.frame.style["min-width"]&&(jt.frame.style["min-width"]=r,f=!0),i&&i!==jt.frame.style["min-height"]&&(jt.frame.style["min-height"]=i,f=!0),o&&o!==jt.frame.style["max-width"]&&(jt.frame.style["max-width"]=o,f=!0),a&&a!==jt.frame.style["max-height"]&&(jt.frame.style["max-height"]=a,f=!0)),f&&Ee.emit(A,{width:u,height:s}),document.activeElement!==jt.element&&!1===jt.mode&&jt.frame.focus()}}));var Et=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={},n=["publicKey","data","isSDK","language","mode","onDataRequest","onCompleted","onHide","onReady","onReset","onResize","onShow","onShown","onSuppress","onError","onWarning","onFailed","onResize","settings","selector","accessibilitySettings","styleTheme","uaTheme","apiLoadTime","enableDirectionalInput","inlineRunOnTrigger"];return Object.keys(e).filter((function(e){return-1!==n.indexOf(e)})).forEach((function(n){t[n]=e[n]})),t};!function(e,t){for(var n=190,r=191,i=203,o=201,a=197,c=208,s=198,u=202,l=193,f=207,d=192,p=204,v=Tt,h=e();;)try{if(134883===parseInt(v(n))/1*(parseInt(v(r))/2)+-parseInt(v(i))/3*(parseInt(v(o))/4)+-parseInt(v(a))/5+-parseInt(v(c))/6+-parseInt(v(s))/7*(-parseInt(v(u))/8)+-parseInt(v(l))/9*(-parseInt(v(f))/10)+-parseInt(v(d))/11*(parseInt(v(p))/12))break;h.push(h.shift())}catch(e){h.push(h.shift())}}(At);var kt=function(){var e=195,t=!0;return function(n,r){var i=t?function(){if(r){var t=r[Tt(e)](n,arguments);return r=null,t}}:function(){};return t=!1,i}}(),_t=kt(void 0,(function(){var e=205,t=194,n=196,r=200,i=189,o=199,a=Tt;return _t[a(200)]()[a(e)](a(t)+a(n))[a(r)]()[a(i)+a(o)](_t).search(a(t)+a(n))}));function At(){var e=["331140bObYZE","3269dePuBo","tor","toString","124700NFjzSD","3256galLZq","3gvmdVa","594444sQfUHh","search","split","38730GmOFGi","1057680axFmxk","construc","3vjqrlw","142958HOfWqr","55qzyzgN","585eyUPFl","(((.+)+)","apply","+)+$"];return(At=function(){return e})()}function Tt(e,t){var n=At();return Tt=function(e,t){return n[e-=189]},Tt(e,t)}_t();!function(e,t){for(var n=459,r=464,i=458,o=461,a=475,c=471,s=454,u=477,l=455,f=476,d=463,p=Rt,v=e();;)try{if(217126===parseInt(p(n))/1+-parseInt(p(r))/2+parseInt(p(i))/3*(parseInt(p(o))/4)+parseInt(p(a))/5*(parseInt(p(c))/6)+-parseInt(p(s))/7*(parseInt(p(u))/8)+-parseInt(p(l))/9+parseInt(p(f))/10*(parseInt(p(d))/11))break;v.push(v.shift())}catch(e){v.push(v.shift())}}(It);var Pt=function(){var e=479,t=!0;return function(n,r){var i=t?function(){if(r){var t=r[Rt(e)](n,arguments);return r=null,t}}:function(){};return t=!1,i}}(),Ct=Pt(void 0,(function(){var e=469,t=466,n=457,r=462,i=460,o=473,a=466,c=457,s=Rt;return Ct[s(462)]()[s(e)](s(t)+s(n))[s(r)]()[s(i)+s(o)](Ct)[s(e)](s(a)+s(c))}));function It(){var e=["724465bXqSUS","322020jhTTBg","118424nMYndJ","nOnTrigg","apply","77wyYzHF","1267956rJKgkn","location","+)+$","9iclmJq","198561xLEuCT","construc","339236wQBSpJ","toString","66YyrQIj","540500wywSxE","language","(((.+)+)","href","__nightm","search","isSDK","6TpKyDX","inlineRu","tor","are"];return(It=function(){return e})()}function Rt(e,t){var n=It();return Rt=function(e,t){return n[e-=454]},Rt(e,t)}Ct();var Lt,Nt,Dt=function(){var e=456,t=467,n=467,r=Rt;return window[r(e)][r(t)]?function(e){return e||"string"==typeof e?e[Tt(206)]("?")[0]:null}(window[r(e)][r(n)]):null},Ft=function(e){return"boolean"==typeof e?e:null},Kt=function(){var e=474,t=Rt;return!!window[t(468)+t(e)]};function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qt(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:5e3,i=t,o=n,a=ve(),s=function(){var e={},t=window.navigator;if(e.platform=t.platform,e.language=t.language,t.connection)try{e.connection={effectiveType:t.connection.effectiveType,rtt:t.connection.rtt,downlink:t.connection.downlink}}catch(e){}return e}(),u={},l={},f=e,d=null,p={},v=null,h=null,g={timerCheckInterval:r},m=!1,y=!1,b=!1,w=!1,O=!1,j=function(){var e;if(w){for(var t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=e.timerId,n=e.type;if(!0===g.enabled){var r=t?c({},t,u[t]):u,d=Object.keys(r).reduce((function(e,t){r[t].logged=!0;var n=r[t],i=(n.logged,pe(n,ke));return Ae(Ae({},e),{},c({},t,i))}),{}),m={id:a,publicKey:f,capiVersion:o,mode:h,suppressed:O,device:s,error:p,windowError:l,sessionId:v,timers:d,sampled:n===Re};j("Logging Metrics:",m);try{var y=new XMLHttpRequest;y.open("POST",i),y.send(JSON.stringify(m))}catch(e){}}},x=function(e){return g&&Object.prototype.hasOwnProperty.call(g,"".concat(e,"Threshold"))?g["".concat(e,"Threshold")]:Ne[e]},E=function e(){if(b)return!1;var t=!1;return m&&(Object.keys(u).forEach((function(e){var n=x(e),r=u[e],i=r.diff,o=r.logged,a=r.end;if(0!==n&&!0!==o&&(i&&i>n&&(t=!0,u[e].logged=!0),!i&&!a)){var c=u[e].start,s=Date.now(),l=s-c;l>n&&(u[e].diff=l,u[e].end=s,u[e].logged=!0,t=!0)}})),t&&S()),d=setTimeout(e,g.timerCheckInterval),!0},k=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ae(Ae({},{start:null,end:null,diff:null,threshold:null,logged:!1,metrics:{}}),e)},_=function(){return{id:a,publicKey:f,sessionId:v,mode:h,settings:g,device:s,error:p,windowError:l,timers:u,debugEnabled:w}},A=function(){clearTimeout(d)};d=setTimeout(E,g.timerCheckInterval);try{"true"===window.localStorage.getItem("capiDebug")&&(w=!0,window.capiObserver={getValues:_})}catch(e){}return{getValues:_,timerStart:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),n=u[e]||{};if(!n.start){var r=x(e);j("".concat(e," started:"),t),u[e]=k(Ae(Ae({},n),{},{start:t,threshold:r}))}},timerEnd:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),n=u[e];n&&!n.end&&(n.end=t,n.diff=n.end-n.start,j("".concat(e," ended:"),t,n.diff),b&&S({timerId:e,type:Re}))},timerCheck:E,subTimerStart:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),r=arguments.length>3?arguments[3]:void 0,i=u[e];i||(i=k()),i.end||(i.metrics[t]=Ae({start:n,end:null,diff:null},r&&{info:r}),u[e]=i,j("".concat(e,".").concat(t," started:"),n))},subTimerEnd:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),r=u[e];if(r&&!r.end){var i=r.metrics[t];i&&(i.end=n,i.diff=i.end-i.start,j("".concat(e,".").concat(t," ended:"),n,i.diff))}},cancelIntervalTimer:A,setup:function(e,t){m=!0,g=Ae(Ae({},g),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(De).reduce((function(t,n){var r=e[n],i=De[n];if("boolean"===i.type)return Ae(Ae({},t),{},c({},n,"boolean"==typeof r?r:i.default));var o="float"===i.type?parseFloat(r,0):parseInt(r,10);return Ae(Ae({},t),{},c({},n,isNaN(o)?i.default:o))}),{})}(e)),h=t,Object.keys(u).forEach((function(e){var t=x(e);u[e].threshold=t}));var n,r=g.samplePercentage;n=r,(b=Math.random()<=n/100)&&A(),j("Session sampled:",b)},setSession:function(e){v=e},logError:function(e){y||(p=e,y=!0,S({type:Le}))},logWindowError:function(e,t,n,r){g&&!0!==g.windowErrorEnabled||(l[e]={message:t,filename:n,stack:r})},debugLog:j,setSuppressed:function(){O=!0},setPublicKey:function(e){f=e,y=!1,p={},["onShown","onComplete"].forEach((function(e){if(u[e]){var t=u[e].threshold||null;u[e]=k({threshold:t})}}))},observabilityTimer:Fe,apiLoadTimerSetup:function(e,t){u[e]=Ae(Ae({},t),{},{logged:!1}),b&&S({timerId:e,type:Re})}}}(zt,"".concat($t).concat("/metrics/ui"),d,5e3);Ut.subTimerStart(U,B);var Vt=function(e){return"arkose-".concat(e,"-wrapper")},Wt={},Bt="onCompleted",Xt="onHide",Gt="onReady",Jt="onReset",Zt="onShow",Yt="onShown",Qt="onSuppress",en="onFailed",tn="onError",nn="onWarning",rn="onResize",on="onDataRequest",an=(c(Lt={},g,Bt),c(Lt,m,Xt),c(Lt,y,Gt),c(Lt,b,Gt),c(Lt,w,Jt),c(Lt,O,Zt),c(Lt,S,Yt),c(Lt,j,Qt),c(Lt,h,en),c(Lt,x,tn),c(Lt,E,nn),c(Lt,k,rn),c(Lt,_,on),Lt);Ke("Set all hooks");var cn=o((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.completed,r=t.token,i=t.suppressed,o=t.error,c=t.warning,s=t.width,u=t.height,l=t.requested;a(this,e),this.completed=!!n,this.token=r||null,this.suppressed=!!i,this.error=o||null,this.warning=c||null,this.width=s||0,this.height=u||0,this.requested=l||null}));Ke("Instantiated Ark Hook Class");var sn=function(e){var t=document.createElement("div");return t.setAttribute("aria-hidden",!0),t.setAttribute("class",Vt(e||zt)),t},un=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return qt(qt({element:sn(),inactiveElement:null,bodyElement:document.querySelector("body"),savedActiveElement:null,modifiedSiblings:[],challengeLoadedEvents:[],container:null,elements:function(){return document.querySelectorAll(Wt.config.selector)},initialSetupCompleted:!1,enforcementLoaded:!1,enforcementReady:!1,getPublicKeyTimeout:null,isActive:!1,isHidden:!1,isReady:!1,isConfigured:!1,suppressed:!1,isResettingChallenge:!1,lastResetTimestamp:0,isCompleteReset:!1,fpData:null,onReadyEventCheck:[],width:0,height:0,token:null,externalRequested:!1},t),{},{config:qt(qt({},zt?{publicKey:zt}:{}),{},{selector:(e=zt,"[data-".concat(f,'-public-key="').concat(e,'"]')),styleTheme:t.config&&t.config.styleTheme||z,siteData:{location:{...window.location,origin:"https://chat.openai.com"}},apiLoadTime:null,settings:{},accessibilitySettings:{lockFocusToModal:!0}},t.config),events:qt({},t.events)})},ln=function(e){var t=Wt.events[an[e]];if(se(t)){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i0&&void 0!==arguments[0]&&arguments[0],t=Wt,n=t.element,r=t.bodyElement,i=t.container,o=t.events,a=t.lastResetTimestamp,c=t.config;if(c.publicKey){var s=Date.now();if(!(s-a<100)){Wt.lastResetTimestamp=s,Wt.isActive=!1,Wt.completed=!1,Wt.token=null,Wt.isReady=!1,Wt.onReadyEventCheck=[],fn(),r&&o&&(r.removeEventListener("click",o.bodyClicked),window.removeEventListener("keyup",o.escapePressed),Wt.events.bodyClicked=null,Wt.events.escapePressed=null);var u=n;Wt.inactiveElement=u,Wt.element=void 0,Wt.element=sn(c.publicKey),i&&u&&i.contains(u)&&(Ee.emit("enforcement detach"),setTimeout((function(){try{i.removeChild(u)}catch(e){}}),5e3)),Wt=un(l()(Wt)),e||ln(w,new cn(Wt)),yn()}}},pn=function(e){Wt.element.setAttribute("aria-hidden",e)},vn=function(){Ke("Showing enforcement"),Wt.enforcementReady&&!Wt.isActive&&(Ee.emit("trigger show"),Wt.isHidden&&(Wt.isHidden=!1,Wt.isReady&&Ee.emit(P,{token:Wt.token})))},hn=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).manual;Wt.isActive=!1,e&&(Wt.isHidden=!0),ln(m,new cn(Wt)),Wt.savedActiveElement&&(Wt.savedActiveElement.focus(),Wt.savedActiveElement=null),ue(Wt,"config.mode")!==p&&function(){for(var e=Wt.modifiedSiblings,t=0;t=0&&n.indexOf(Wt.config.publicKey)>=0){var i=r.stack;Ut.logWindowError("integration",t,n,i)}})),window.addEventListener("error",window[H][e].error)}(e),Ke("Set up window error"),Wt=un({id:e})},wn=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Wt.initialSetupCompleted=!0;var n=function(e){return e===p?p:"lightbox"}(t.mode||ue(Wt,"config.mode")),r=t.styleTheme||z,i=Wt.isConfigured&&r!==Wt.config.styleTheme;Wt.isConfigured=!0;var o=zt||Wt.config.publicKey||null,a=!1;t.publicKey&&o!==t.publicKey&&(!function(e){Ke("Seting up key"),de(window,Wt.id,"publicKey",e),Ut.setPublicKey(e),Wt.element&&Wt.element.getAttribute&&(Wt.element.getAttribute("class").match(e)||Wt.element.setAttribute("class",Vt(e))),Ke("Set up key")}(t.publicKey),o=t.publicKey,Wt.config.publicKey&&Wt.config.publicKey!==t.publicKey&&(a=!0)),Wt.config=qt(qt(qt(qt({},Wt.config),t),{mode:n}),{},{styleTheme:r,publicKey:o,language:""!==t.language?t.language||Wt.config.language:void 0}),Wt.events=qt(qt({},Wt.events),{},(c(e={},Bt,t[Bt]||Wt.events[Bt]),c(e,en,t[en]||Wt.events[en]),c(e,Xt,t[Xt]||Wt.events[Xt]),c(e,Gt,t[Gt]||Wt.events[Gt]),c(e,Jt,t[Jt]||Wt.events[Jt]),c(e,Zt,t[Zt]||Wt.events[Zt]),c(e,Yt,t[Yt]||Wt.events[Yt]),c(e,Qt,t[Qt]||Wt.events[Qt]),c(e,tn,t[tn]||Wt.events[tn]),c(e,nn,t[nn]||Wt.events[nn]),c(e,rn,t[rn]||Wt.events[rn]),c(e,on,t[on]||Wt.events[on]),e)),Wt.config.pageLevel=function(e){var t,n=465,r=470,i=472,o=478,a=Rt;return{chref:Dt(),clang:null!==(t=e[a(n)])&&void 0!==t?t:null,surl:null,sdk:Ft(e[a(r)])||!1,nm:Kt(),triggeredInline:e[a(i)+a(o)+"er"]||!1}}(Wt.config),Ke("Configured initial state"),Ee.emit(C,Wt.config),Ke("Emitt Config event"),i||a?(Ke("Resetting enforcement"),dn(!0)):(Ke("Call setup mode"),yn()),"lightbox"===n&&(Wt.element.setAttribute("aria-modal",!0),Wt.element.setAttribute("role","dialog"))},On=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.event,n=e.observability;if(Wt.onReadyEventCheck.push(t),n){var r=n.timerId,i=n.subTimerId,o=n.time;Ut.subTimerEnd(r,i,o)}Q[t]&&Ut.subTimerEnd(U,Q[t]);var a=[T,K,R];Ut.subTimerStart(U,G);var c=function(e,t){var n,r,i=[],o=e.length,a=t.length;for(n=0;n0&&void 0!==arguments[0]?arguments[0]:{};Ut.timerStart(U),[J,Y,Z].forEach((function(e){Ut.subTimerStart(U,e)})),wn(Et(e))},getConfig:function(){return l()(Wt.config)},dataResponse:function(e){if(Wt.requested){var t={message:I,data:e,key:Wt.config.publicKey,type:"emit"};Ee.emit(I,t),Wt.requested=null}},reset:function(){dn()},run:vn,version:d},xn=ie.getAttribute("data-callback");Ke("Set up Every function"),Ee.on("show enforcement",(function(){Wt.isReady||(Ut.timerStart(V),Ut.timerStart(W)),Wt.isActive=!0,Wt.savedActiveElement=document.activeElement,ln(O,new cn(Wt)),ue(Wt,"config.mode")!==p&&function(){var e=Wt.bodyElement.children;Wt.modifiedSiblings=[];for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:{};Wt.completed=!0,Wt.token=e.token,Ut.timerEnd(W),ln(g,new cn(Wt)),ue(Wt,"config.mode")!==p&&(Wt.isCompleteReset=!0,dn())})),Ee.on("hide enforcement",hn),Ee.on(A,(function(e){var t=e.width,n=e.height;Wt.width=t,Wt.height=n,ln(k,new cn(Wt))})),Ee.on(T,(function(){Ke("Got enforcement loaded","darkblue"),Wt.enforcementLoaded=!0,On({event:T}),Wt.initialSetupCompleted&&Ee.emit(C,Wt.config)})),Ee.on("challenge suppressed",(function(e){var t=e.token;Wt.isActive=!1,Wt.suppressed=!0,jn({token:t}),Ut.setSuppressed(),Ut.timerEnd(V),ln(j,new cn(Wt))})),Ee.on("data initial",On),Ee.on("settings fp collected",On),Ee.on("challenge token",jn),Ee.on("challenge window error",(function(e){var t=e.message,n=e.source,r=e.stack;Ut.logWindowError("challenge",t,n,r)})),Ee.on(R,(function(e){var t=e.event,n=void 0===t?{}:t,r=e.settings,i=void 0===r?{}:r,o=e.observability;Wt.config.settings=i;var a=function(e){return ue(e,"observability",{})}(Wt.config.settings);Ut.setup(a,Wt.config.mode);var c=ue(Wt,"config.apiLoadTime");c&&Ut.apiLoadTimerSetup($,c),On({event:n,observability:o}),fn()})),Ee.on("challenge fail number limit reached",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Wt.isActive=!1,Wt.isHidden=!0,Wt.token=e.token,ln(h,new cn(Wt),e)})),Ee.on("error",(function(e){var t=qt({source:null},e.error);Wt.error=t,Ut.logError(t),ln(x,new cn(Wt)),hn()})),Ee.on("warning",(function(e){var t=qt({source:null},e.warning);Wt.warning=t,Ut.logError(t),ln(E,new cn(Wt))})),Ee.on("data_request",(function(e){e.sdk&&(Wt.requested=e,ln(_,new cn(Wt)))})),Ee.on(K,On),Ee.on(F,(function(e){var t=e.action,n=e.timerId,r=e.subTimerId,i=e.time,o=e.info,a="".concat(r?"subTimer":"timer").concat("end"===t?"End":"Start"),c=r?[n,r,i,o]:[n,i];Ut[a].apply(Ut,c)})),Ee.on("force reset",(function(){dn()})),Ee.on("redraw challenge",(function(){Wt.element&&(Wt.element.querySelector("iframe").style.display="inline")})),Ke("Set up Every emitter"),xn?(Ke("Attempting callback"),function e(){if(!se(window[xn]))return setTimeout(e,1e3);var t=document.querySelectorAll(".".concat(Vt(zt)));return t&&t.length&&Array.prototype.slice.call(t).forEach((function(e){try{e.parentNode.removeChild(e)}catch(e){}})),Ke("Cleaned up iframes"),bn(),window[xn](Sn)}()):(Ke("Start setup function"),bn())}(),arkoseLabsClientApi2c145230=r}(); ================================================ FILE: sidepanel.html ================================================ ChatHub
================================================ FILE: src/app/base.scss ================================================ @use 'inter-ui/default' as inter-ui with ( $inter-font-display: swap, $inter-font-path: 'inter-ui/Inter (web)' ); @use 'inter-ui/variable' as inter-ui-variable with ( $inter-font-display: swap, $inter-font-path: 'inter-ui/Inter (web)' ); @include inter-ui.weight-400-normal; @include inter-ui.weight-500-normal; @include inter-ui.weight-600-normal; @include inter-ui.weight-700-normal; @include inter-ui-variable.normal; @tailwind base; @tailwind components; @tailwind utilities; html, body { font-family: 'Inter', 'system-ui'; } @supports (font-variation-settings: normal) { html, body { font-family: 'Inter var', 'system-ui'; } } body { font-size: 100%; } :focus-visible { outline: none; } @mixin light-theme { color-scheme: light; --color-primary-blue: 73 135 252; // #4987FC --color-secondary: 242 242 242; // #F2F2F2 --color-primary-purple: 103 86 189; // #6756BD --primary-background: 255 255 255; // #FFFFFF --primary-text: 48 48 48; // #303030 --secondary-text: 128 128 128; // #808080 --light-text: 190 190 190; // #BEBEBE --primary-border: 237 237 237; // #EDEDED } @mixin dark-theme { color-scheme: dark; --color-primary-blue: 50 104 206; // #3268CE --color-secondary: 46 46 46; // #2E2E2E --color-primary-purple: 57 41 141; // #39298D --primary-background: 25 25 25; // #191919 --primary-text: 223 223 223; // #DFDFDF --secondary-text: 127 127 127; // #7F7F7F --light-text: 79 79 79; // #4F4F4F --primary-border: 53 53 53; // #353535 } @layer base { :root { opacity: 0.88; } } :root.light { @include light-theme; @import 'highlight.js/scss/github.scss'; } :root.dark { @include dark-theme; @import 'highlight.js/scss/github-dark.scss'; } ================================================ FILE: src/app/bots/abstract-bot.ts ================================================ import { Sentry } from '~services/sentry' import { ChatError, ErrorCode } from '~utils/errors' import { streamAsyncIterable } from '~utils/stream-async-iterable' export type AnwserPayload = { text: string } export type Event = | { type: 'UPDATE_ANSWER' data: AnwserPayload } | { type: 'DONE' } | { type: 'ERROR' error: ChatError } export interface MessageParams { prompt: string rawUserInput?: string image?: File signal?: AbortSignal } export interface SendMessageParams extends MessageParams { onEvent: (event: Event) => void } export abstract class AbstractBot { public async sendMessage(params: MessageParams) { return this.doSendMessageGenerator(params) } protected async *doSendMessageGenerator(params: MessageParams) { const wrapError = (err: unknown) => { Sentry.captureException(err) if (err instanceof ChatError) { return err } if (!params.signal?.aborted) { // ignore user abort exception return new ChatError((err as Error).message, ErrorCode.UNKOWN_ERROR) } } const stream = new ReadableStream({ start: (controller) => { this.doSendMessage({ prompt: params.prompt, rawUserInput: params.rawUserInput, image: params.image, signal: params.signal, onEvent(event) { if (event.type === 'UPDATE_ANSWER') { controller.enqueue(event.data) } else if (event.type === 'DONE') { controller.close() } else if (event.type === 'ERROR') { const error = wrapError(event.error) if (error) { controller.error(error) } } }, }).catch((err) => { const error = wrapError(err) if (error) { controller.error(error) } }) }, }) yield* streamAsyncIterable(stream) } get name(): string | undefined { return undefined } get supportsImageInput() { return false } abstract doSendMessage(params: SendMessageParams): Promise abstract resetConversation(): void } class DummyBot extends AbstractBot { async doSendMessage(_params: SendMessageParams) { // dummy } resetConversation() { // dummy } get name() { return '' } } export abstract class AsyncAbstractBot extends AbstractBot { #bot: AbstractBot #initializeError?: Error constructor() { super() this.#bot = new DummyBot() this.initializeBot() .then((bot) => { this.#bot = bot }) .catch((err) => { this.#initializeError = err }) } abstract initializeBot(): Promise doSendMessage(params: SendMessageParams) { if (this.#bot instanceof DummyBot && this.#initializeError) { throw this.#initializeError } return this.#bot.doSendMessage(params) } resetConversation() { return this.#bot.resetConversation() } get name() { return this.#bot.name } get supportsImageInput() { return this.#bot.supportsImageInput } } ================================================ FILE: src/app/bots/baichuan/api.ts ================================================ import { ofetch } from 'ofetch' import { customAlphabet } from 'nanoid' import { ChatError, ErrorCode } from '~utils/errors' interface UserInfo { id: number } export async function getUserInfo(): Promise { const resp = await ofetch<{ data?: UserInfo; code: number; msg: string }>( 'https://www.baichuan-ai.com/api/user/user-info', { method: 'POST' }, ) if (resp.code === 401) { throw new ChatError('请先登录百川账号', ErrorCode.BAICHUAN_WEB_UNAUTHORIZED) } if (resp.code !== 200) { throw new Error(`Error: ${resp.code} ${resp.msg}`) } return resp.data! } const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz0123456789') function randomString(length: number) { return nanoid(length) } export function generateSessionId() { return 'p' + randomString(10) } export function generateMessageId() { return 'U' + randomString(14) } ================================================ FILE: src/app/bots/baichuan/index.ts ================================================ import { AbstractBot, SendMessageParams } from '../abstract-bot' import { requestHostPermission } from '~app/utils/permissions' import { ChatError, ErrorCode } from '~utils/errors' import { uuid } from '~utils' import { generateMessageId, generateSessionId, getUserInfo } from './api' import { streamAsyncIterable } from '~utils/stream-async-iterable' interface Message { id: string createdAt: number data: string from: 0 | 1 // human | bot } interface ConversationContext { conversationId: string historyMessages: Message[] userId: number lastMessageId?: string } export class BaichuanWebBot extends AbstractBot { private conversationContext?: ConversationContext async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermission('https://*.baichuan-ai.com/'))) { throw new ChatError('Missing baichuan-ai.com permission', ErrorCode.MISSING_HOST_PERMISSION) } if (!this.conversationContext) { const conversationId = generateSessionId() const userInfo = await getUserInfo() this.conversationContext = { conversationId, historyMessages: [], userId: userInfo.id } } const { conversationId, lastMessageId, historyMessages, userId } = this.conversationContext const message: Message = { id: generateMessageId(), createdAt: Date.now(), data: params.prompt, from: 0, } const resp = await fetch('https://www.baichuan-ai.com/api/chat/v1/chat', { method: 'POST', signal: params.signal, headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ assistant: {}, assistant_info: {}, retry: 3, type: "input", stream: true, request_id: uuid(), app_info: { id: 10001, name: 'baichuan_web' }, user_info: { id: userId, status: 1 }, prompt: { id: message.id, data: message.data, from: message.from, parent_id: lastMessageId || 0, created_at: message.createdAt, attachments: [] }, session_info: { id: conversationId, name: '新的对话', created_at: Date.now() }, parameters: { repetition_penalty: -1, temperature: -1, top_k: -1, top_p: -1, max_new_tokens: -1, do_sample: -1, regenerate: 0, wse:true }, history: historyMessages, }), }) const decoder = new TextDecoder() let result = '' let answerMessageId: string | undefined for await (const uint8Array of streamAsyncIterable(resp.body!)) { const str = decoder.decode(uint8Array) console.debug('baichuan stream', str) const lines = str.split('\n') for (const line of lines) { if (!line) { continue } const data = JSON.parse(line) if (!data.answer) { continue } answerMessageId = data.answer.id const text = data.answer.data if (text) { result += text params.onEvent({ type: 'UPDATE_ANSWER', data: { text: result } }) } } } this.conversationContext.historyMessages.push(message) if (answerMessageId) { this.conversationContext.lastMessageId = answerMessageId if (result) { this.conversationContext.historyMessages.push({ id: answerMessageId, data: result, createdAt: Date.now(), from: 1, }) } } params.onEvent({ type: 'DONE' }) } resetConversation() { this.conversationContext = undefined } get name() { return '百川大模型' } } ================================================ FILE: src/app/bots/bard/api.ts ================================================ import { ofetch } from 'ofetch' import { ChatError, ErrorCode } from '~utils/errors' function extractFromHTML(variableName: string, html: string) { const regex = new RegExp(`"${variableName}":"([^"]+)"`) const match = regex.exec(html) return match?.[1] } export async function fetchRequestParams() { const html = await ofetch('https://bard.google.com/', { responseType: 'text' }) const atValue = extractFromHTML('SNlM0e', html) const blValue = extractFromHTML('cfb2h', html) if (!atValue) { throw new ChatError('There is no logged-in Google account in this browser', ErrorCode.BARD_UNAUTHORIZED) } return { atValue, blValue } } export function parseBardResponse(resp: string) { const data = JSON.parse(resp.split('\n')[3]) const payload = JSON.parse(data[0][2]) if (!payload) { throw new ChatError('Failed to load bard response', ErrorCode.BARD_EMPTY_RESPONSE) } console.debug('bard response payload', payload) let text = payload[4][0][1][0] as string const images = payload[4][0][4] || [] for (const image of images) { const [media, source, placeholder] = image text = text.replace(placeholder, `[![${media[4]}](${media[0][0]})](${source[0][0]})`) } return { text, ids: [...payload[1], payload[4][0][0]] as [string, string, string], } } ================================================ FILE: src/app/bots/bard/index.ts ================================================ import { ofetch } from 'ofetch' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { fetchRequestParams, parseBardResponse } from './api' function generateReqId() { return Math.floor(Math.random() * 900000) + 100000 } interface ConversationContext { requestParams: Awaited> contextIds: [string, string, string] } export class BardBot extends AbstractBot { private conversationContext?: ConversationContext async doSendMessage(params: SendMessageParams) { if (!this.conversationContext) { this.conversationContext = { requestParams: await fetchRequestParams(), contextIds: ['', '', ''], } } const { requestParams, contextIds } = this.conversationContext let imageUrl: string | undefined if (params.image) { imageUrl = await this.uploadImage(params.image) } const payload = [ null, JSON.stringify([ [params.prompt, 0, null, imageUrl ? [[[imageUrl, 1], params.image!.name]] : []], null, contextIds, ]), ] const resp = await ofetch( 'https://bard.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate', { method: 'POST', signal: params.signal, query: { bl: requestParams.blValue, _reqid: generateReqId(), rt: 'c', }, body: new URLSearchParams({ at: requestParams.atValue!, 'f.req': JSON.stringify(payload), }), parseResponse: (txt) => txt, }, ) const { text, ids } = parseBardResponse(resp) this.conversationContext.contextIds = ids params.onEvent({ type: 'UPDATE_ANSWER', data: { text }, }) params.onEvent({ type: 'DONE' }) } resetConversation() { this.conversationContext = undefined } get supportsImageInput() { return true } private async uploadImage(image: File) { const headers = { 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8', 'push-id': 'feeds/mcudyrk2a4khkz', 'x-goog-upload-header-content-length': image.size.toString(), 'x-goog-upload-protocol': 'resumable', 'x-tenant-id': 'bard-storage', } const resp = await ofetch.raw('https://content-push.googleapis.com/upload/', { method: 'POST', headers: { ...headers, 'x-goog-upload-command': 'start', }, body: new URLSearchParams({ [`File name: ${image.name}`]: '' }), }) const uploadUrl = resp.headers.get('x-goog-upload-url') console.debug('Bard upload url', uploadUrl) if (!uploadUrl) { throw new Error('Failed to upload image') } const uploadResult = await ofetch(uploadUrl, { method: 'POST', headers: { ...headers, 'x-goog-upload-command': 'upload, finalize', 'x-goog-upload-offset': '0', }, body: image, }) return uploadResult as string } } ================================================ FILE: src/app/bots/bing/api.ts ================================================ import { random } from 'lodash-es' import { FetchError, FetchResponse, ofetch } from 'ofetch' import { uuid } from '~utils' import { ChatError, ErrorCode } from '~utils/errors' import { ConversationResponse } from './types' // https://github.com/acheong08/EdgeGPT/blob/master/src/EdgeGPT.py#L32 function randomIP() { return `13.${random(104, 107)}.${random(0, 255)}.${random(0, 255)}` } const API_ENDPOINT = 'https://www.bing.com/turing/conversation/create' export async function createConversation(): Promise { const headers = { 'x-ms-client-request-id': uuid(), 'x-ms-useragent': 'azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.3 OS/macOS', } let rawResponse: FetchResponse try { rawResponse = await ofetch.raw(API_ENDPOINT, { headers, redirect: 'error' }) if (!rawResponse._data?.result) { throw new Error('Invalid response') } } catch (err) { console.error('retry bing create', err) rawResponse = await ofetch.raw(API_ENDPOINT, { headers: { ...headers, 'x-forwarded-for': randomIP() }, redirect: 'error', }) if (!rawResponse._data) { throw new FetchError(`Failed to fetch (${API_ENDPOINT})`) } } const data = rawResponse._data if (data.result.value !== 'Success') { const message = `${data.result.value}: ${data.result.message}` if (data.result.value === 'UnauthorizedRequest') { throw new ChatError(message, ErrorCode.BING_UNAUTHORIZED) } throw new Error(message) } const conversationSignature = rawResponse.headers.get('x-sydney-conversationsignature')! const encryptedConversationSignature = rawResponse.headers.get('x-sydney-encryptedconversationsignature') || undefined data.conversationSignature = data.conversationSignature || conversationSignature data.encryptedConversationSignature = encryptedConversationSignature return data } ================================================ FILE: src/app/bots/bing/index.ts ================================================ import { ofetch } from 'ofetch' import WebSocketAsPromised from 'websocket-as-promised' import { requestHostPermission } from '~app/utils/permissions' import { BingConversationStyle, getUserConfig } from '~services/user-config' import { uuid } from '~utils' import { ChatError, ErrorCode } from '~utils/errors' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { createConversation } from './api' import { ChatResponseMessage, ConversationInfo, InvocationEventType } from './types' import { convertMessageToMarkdown, file2base64, websocketUtils } from './utils' const OPTIONS_SETS = [ 'nlu_direct_response_filter', 'deepleo', 'disable_emoji_spoken_text', 'responsible_ai_policy_235', 'enablemm', 'dv3sugg', 'autosave', 'glfluxv15', 'clgalileo', 'clgalileonsr', 'mtreasoncls3', 'sahararespv2', 'gptvprvc', 'fluxprod', 'revimglnk', 'revimgsrc1', ] const SLICE_IDS = [ '0712newass0', '0212boptpsc', 'plgbd2c', '1113gldcl1s1', '1201reason', '124multi2ts0', 'cacdupereccf', 'cacmuidarb', 'cacfrwebt2cf', 'sswebtop2cf', ] export class BingWebBot extends AbstractBot { private conversationContext?: ConversationInfo private buildChatRequest(conversation: ConversationInfo, message: string, imageUrl?: string) { const requestId = uuid() const optionsSets = [...OPTIONS_SETS] let tone = 'Balanced' if (conversation.conversationStyle === BingConversationStyle.Precise) { optionsSets.push('h3precise') tone = 'Precise' } else if (conversation.conversationStyle === BingConversationStyle.Creative) { optionsSets.push('h3imaginative') tone = 'Creative' } return { arguments: [ { source: 'cib', optionsSets, allowedMessageTypes: [ 'Chat', 'InternalSearchQuery', 'Disengaged', 'InternalLoaderMessage', 'SemanticSerp', 'GenerateContentQuery', 'SearchQuery', ], sliceIds: SLICE_IDS, verbosity: 'verbose', scenario: 'SERP', plugins: [], conversationHistoryOptionsSets: ['autosave', 'savemem', 'uprofupd', 'uprofgen'], isStartOfSession: conversation.invocationId === 0, message: { timestamp: new Date().toISOString(), author: 'user', inputMethod: 'Keyboard', text: message, imageUrl, messageType: 'Chat', requestId, messageId: requestId, }, requestId, conversationId: conversation.conversationId, conversationSignature: conversation.conversationSignature, participant: { id: conversation.clientId }, tone, }, ], invocationId: conversation.invocationId.toString(), target: 'chat', type: InvocationEventType.StreamInvocation, } } async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermission('wss://*.bing.com/'))) { throw new ChatError('Missing bing.com permission', ErrorCode.MISSING_HOST_PERMISSION) } if (!this.conversationContext) { const [conversation, { bingConversationStyle }] = await Promise.all([createConversation(), getUserConfig()]) this.conversationContext = { conversationId: conversation.conversationId, conversationSignature: conversation.conversationSignature, encryptedConversationSignature: conversation.encryptedConversationSignature, clientId: conversation.clientId, invocationId: 0, conversationStyle: bingConversationStyle, } } const conversation = this.conversationContext! let imageUrl: string | undefined if (params.image) { imageUrl = await this.uploadImage(params.image) } const wsp = new WebSocketAsPromised(this.buildWssUrl(conversation.encryptedConversationSignature), { packMessage: websocketUtils.packMessage, unpackMessage: websocketUtils.unpackMessage, }) let receivedAnswer = false wsp.onUnpackedMessage.addListener((events) => { for (const event of events) { console.debug('bing ws event', event) if (JSON.stringify(event) === '{}') { wsp.sendPacked({ type: 6 }) wsp.sendPacked(this.buildChatRequest(conversation, params.prompt, imageUrl)) conversation.invocationId += 1 } else if (event.type === 6) { wsp.sendPacked({ type: 6 }) } else if (event.type === 3) { params.onEvent({ type: 'DONE' }) wsp.removeAllListeners() wsp.close() } else if (event.type === 1) { const messages = event.arguments[0].messages if (messages) { receivedAnswer = true const text = convertMessageToMarkdown(messages[0]) params.onEvent({ type: 'UPDATE_ANSWER', data: { text } }) } } else if (event.type === 2) { const messages = event.item.messages as ChatResponseMessage[] | undefined if (!messages) { if (event.item.result.value === 'UnauthorizedRequest') { this.conversationContext = undefined params.onEvent({ type: 'ERROR', error: new ChatError('UnauthorizedRequest', ErrorCode.BING_UNAUTHORIZED), }) return } const captcha = event.item.result.value === 'CaptchaChallenge' if (captcha) { this.conversationContext = undefined } params.onEvent({ type: 'ERROR', error: new ChatError( event.item.result.error || 'Unknown error', captcha ? ErrorCode.BING_CAPTCHA : ErrorCode.UNKOWN_ERROR, ), }) return } const limited = messages.some((message) => message.contentOrigin === 'TurnLimiter') if (limited) { params.onEvent({ type: 'ERROR', error: new ChatError( 'Sorry, you have reached chat turns limit in this conversation.', ErrorCode.CONVERSATION_LIMIT, ), }) return } if (!receivedAnswer) { const message = event.item.messages[event.item.firstNewMessageIndex] as ChatResponseMessage if (message) { receivedAnswer = true const text = convertMessageToMarkdown(message) params.onEvent({ type: 'UPDATE_ANSWER', data: { text }, }) } } } } }) wsp.onClose.addListener(() => { params.onEvent({ type: 'DONE' }) }) params.signal?.addEventListener('abort', () => { wsp.removeAllListeners() wsp.close() }) try { await wsp.open() } catch (err) { wsp.removeAllListeners() throw new ChatError((err as Error).message, ErrorCode.NETWORK_ERROR) } wsp.sendPacked({ protocol: 'json', version: 1 }) } resetConversation() { this.conversationContext = undefined } get supportsImageInput() { return true } private async uploadImage(image: File) { const formData = new FormData() formData.append( 'knowledgeRequest', JSON.stringify({ imageInfo: {}, knowledgeRequest: { invokedSkills: ['ImageById'], subscriptionId: 'Bing.Chat.Multimodal', invokedSkillsRequestData: { enableFaceBlur: false }, convoData: { convoid: '', convotone: 'Balanced' }, }, }), ) formData.append('imageBase64', await file2base64(image)) const resp = await ofetch<{ blobId: string }>('https://www.bing.com/images/kblob', { method: 'POST', body: formData, }) if (!resp.blobId) { console.debug('kblob response: ', resp) throw new Error('Failed to upload image') } return `https://www.bing.com/images/blob?bcid=${resp.blobId}` } private buildWssUrl(encryptedConversationSignature: string | undefined) { if (!encryptedConversationSignature) { return 'wss://sydney.bing.com/sydney/ChatHub' } return `wss://sydney.bing.com/sydney/ChatHub?sec_access_token=${encodeURIComponent(encryptedConversationSignature)}` } } ================================================ FILE: src/app/bots/bing/types.ts ================================================ import { BingConversationStyle } from '~services/user-config' export interface ConversationResponse { conversationId: string clientId: string conversationSignature: string encryptedConversationSignature?: string result: { value: string message: null } } export enum InvocationEventType { Invocation = 1, StreamItem = 2, Completion = 3, StreamInvocation = 4, CancelInvocation = 5, Ping = 6, Close = 7, } // https://github.com/bytemate/bingchat-api/blob/main/src/lib.ts export interface ConversationInfo { conversationId: string clientId: string conversationSignature: string invocationId: number conversationStyle: BingConversationStyle encryptedConversationSignature?: string } export interface BingChatResponse { conversationSignature: string conversationId: string clientId: string invocationId: number conversationExpiryTime: Date response: string details: ChatResponseMessage } export interface ChatResponseMessage { text: string author: string createdAt: Date timestamp: Date messageId: string messageType?: string requestId: string offense: string adaptiveCards: AdaptiveCard[] sourceAttributions: SourceAttribution[] feedback: Feedback contentOrigin: string privacy: null suggestedResponses: SuggestedResponse[] } export interface AdaptiveCard { type: string version: string body: Body[] } export interface Body { type: string text: string wrap: boolean size?: string } export interface Feedback { tag: null updatedOn: null type: string } export interface SourceAttribution { providerDisplayName: string seeMoreUrl: string searchQuery: string } export interface SuggestedResponse { text: string author: string createdAt: Date timestamp: Date messageId: string messageType: string offense: string feedback: Feedback contentOrigin: string privacy: null } export async function generateMarkdown(response: BingChatResponse) { // change `[^Number^]` to markdown link const regex = /\[\^(\d+)\^\]/g const markdown = response.details.text.replace(regex, (match, p1) => { const sourceAttribution = response.details.sourceAttributions[Number(p1) - 1] return `[${sourceAttribution.providerDisplayName}](${sourceAttribution.seeMoreUrl})` }) return markdown } ================================================ FILE: src/app/bots/bing/utils.ts ================================================ import { ChatResponseMessage } from './types' export function convertMessageToMarkdown(message: ChatResponseMessage): string { if (message.messageType === 'InternalSearchQuery') { return message.text } if (message.messageType === 'InternalLoaderMessage') { return `_${message.text}_` } for (const card of message.adaptiveCards) { for (const block of card.body) { if (block.type === 'TextBlock') { return block.text } } } return '' } const RecordSeparator = String.fromCharCode(30) export const websocketUtils = { packMessage(data: unknown) { return `${JSON.stringify(data)}${RecordSeparator}` }, unpackMessage(data: string | ArrayBuffer | Blob) { return data .toString() .split(RecordSeparator) .filter(Boolean) .map((s) => JSON.parse(s)) }, } export async function file2base64(file: File, keepHeader = false): Promise { return new Promise((resolve, reject) => { const reader = new FileReader() reader.onload = () => { if (keepHeader) { resolve(reader.result as string) } else { const base64String = (reader.result as string).replace('data:', '').replace(/^.+,/, '') resolve(base64String) } } reader.onerror = reject reader.readAsDataURL(file) }) } ================================================ FILE: src/app/bots/chatgpt/index.ts ================================================ import { ChatGPTMode, getUserConfig } from '~/services/user-config' import * as agent from '~services/agent' import { ChatError, ErrorCode } from '~utils/errors' import { AsyncAbstractBot, MessageParams } from '../abstract-bot' import { ChatGPTApiBot } from '../chatgpt-api' import { ChatGPTAzureApiBot } from '../chatgpt-azure' import { ChatGPTWebBot } from '../chatgpt-webapp' import { PoeWebBot } from '../poe' import { OpenRouterBot } from '../openrouter' export class ChatGPTBot extends AsyncAbstractBot { async initializeBot() { const { chatgptMode, ...config } = await getUserConfig() if (chatgptMode === ChatGPTMode.API) { if (!config.openaiApiKey) { throw new ChatError('OpenAI API key not set', ErrorCode.API_KEY_NOT_SET) } return new ChatGPTApiBot({ openaiApiKey: config.openaiApiKey, openaiApiHost: config.openaiApiHost, chatgptApiModel: config.chatgptApiModel, chatgptApiTemperature: config.chatgptApiTemperature, chatgptApiSystemMessage: config.chatgptApiSystemMessage, }) } if (chatgptMode === ChatGPTMode.Azure) { if (!config.azureOpenAIApiInstanceName || !config.azureOpenAIApiDeploymentName || !config.azureOpenAIApiKey) { throw new Error('Please check your Azure OpenAI API configuration') } return new ChatGPTAzureApiBot({ azureOpenAIApiKey: config.azureOpenAIApiKey, azureOpenAIApiDeploymentName: config.azureOpenAIApiDeploymentName, azureOpenAIApiInstanceName: config.azureOpenAIApiInstanceName, }) } if (chatgptMode === ChatGPTMode.Poe) { return new PoeWebBot(config.chatgptPoeModelName) } if (chatgptMode === ChatGPTMode.OpenRouter) { if (!config.openrouterApiKey) { throw new ChatError('OpenRouter API key not set', ErrorCode.API_KEY_NOT_SET) } const model = `openai/${config.openrouterOpenAIModel}` return new OpenRouterBot({ apiKey: config.openrouterApiKey, model }) } return new ChatGPTWebBot(config.chatgptWebappModelName) } async sendMessage(params: MessageParams) { const { chatgptWebAccess } = await getUserConfig() if (chatgptWebAccess) { return agent.execute(params.prompt, (prompt) => this.doSendMessageGenerator({ ...params, prompt }), params.signal) } return this.doSendMessageGenerator(params) } } ================================================ FILE: src/app/bots/chatgpt-api/index.ts ================================================ import { isArray } from 'lodash-es' import { DEFAULT_CHATGPT_SYSTEM_MESSAGE } from '~app/consts' import { UserConfig } from '~services/user-config' import { ChatError, ErrorCode } from '~utils/errors' import { parseSSEResponse } from '~utils/sse' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { file2base64 } from '../bing/utils' import { ChatMessage } from './types' interface ConversationContext { messages: ChatMessage[] } const CONTEXT_SIZE = 9 export abstract class AbstractChatGPTApiBot extends AbstractBot { private conversationContext?: ConversationContext private buildUserMessage(prompt: string, imageUrl?: string): ChatMessage { if (!imageUrl) { return { role: 'user', content: prompt } } return { role: 'user', content: [ { type: 'text', text: prompt }, { type: 'image_url', image_url: { url: imageUrl, detail: 'low' } }, ], } } private buildMessages(prompt: string, imageUrl?: string): ChatMessage[] { const currentDate = new Date().toISOString().split('T')[0] const systemMessage = this.getSystemMessage().replace('{current_date}', currentDate) return [ { role: 'system', content: systemMessage }, ...this.conversationContext!.messages.slice(-(CONTEXT_SIZE + 1)), this.buildUserMessage(prompt, imageUrl), ] } getSystemMessage() { return DEFAULT_CHATGPT_SYSTEM_MESSAGE } async doSendMessage(params: SendMessageParams) { if (!this.conversationContext) { this.conversationContext = { messages: [] } } let imageUrl: string | undefined if (params.image) { imageUrl = await file2base64(params.image, true) } const resp = await this.fetchCompletionApi(this.buildMessages(params.prompt, imageUrl), params.signal) // add user message to context only after fetch success this.conversationContext.messages.push(this.buildUserMessage(params.rawUserInput || params.prompt, imageUrl)) let done = false const result: ChatMessage = { role: 'assistant', content: '' } const finish = () => { done = true params.onEvent({ type: 'DONE' }) const messages = this.conversationContext!.messages messages.push(result) } await parseSSEResponse(resp, (message) => { console.debug('chatgpt sse message', message) if (message === '[DONE]') { finish() return } let data try { data = JSON.parse(message) } catch (err) { console.error(err) return } if (data?.choices?.length) { const delta = data.choices[0].delta if (delta?.content) { result.content += delta.content params.onEvent({ type: 'UPDATE_ANSWER', data: { text: result.content }, }) } } }) if (!done) { finish() } } resetConversation() { this.conversationContext = undefined } abstract fetchCompletionApi(messages: ChatMessage[], signal?: AbortSignal): Promise } export class ChatGPTApiBot extends AbstractChatGPTApiBot { constructor( private config: Pick< UserConfig, 'openaiApiKey' | 'openaiApiHost' | 'chatgptApiModel' | 'chatgptApiTemperature' | 'chatgptApiSystemMessage' >, ) { super() } getSystemMessage() { return this.config.chatgptApiSystemMessage || DEFAULT_CHATGPT_SYSTEM_MESSAGE } async fetchCompletionApi(messages: ChatMessage[], signal?: AbortSignal) { const { openaiApiKey, openaiApiHost } = this.config const hasImageInput = messages.some( (message) => isArray(message.content) && message.content.some((part) => part.type === 'image_url'), ) const model = hasImageInput ? 'gpt-4-vision-preview' : this.getModelName() const resp = await fetch(`${openaiApiHost}/v1/chat/completions`, { method: 'POST', signal, headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${openaiApiKey}`, }, body: JSON.stringify({ model, messages, max_tokens: hasImageInput ? 500 : undefined, stream: true, }), }) if (!resp.ok) { const error = await resp.text() if (error.includes('insufficient_quota')) { throw new ChatError('Insufficient ChatGPT API usage quota', ErrorCode.CHATGPT_INSUFFICIENT_QUOTA) } } return resp } private getModelName() { const { chatgptApiModel } = this.config if (chatgptApiModel === 'gpt-4-turbo') { return 'gpt-4-1106-preview' } if (chatgptApiModel === 'gpt-3.5-turbo') { return 'gpt-3.5-turbo-1106' } return chatgptApiModel } get name() { return `ChatGPT (API/${this.config.chatgptApiModel})` } get supportsImageInput() { return true } } ================================================ FILE: src/app/bots/chatgpt-api/types.ts ================================================ export type ContentPart = | { type: 'text'; text: string } | { type: 'image_url'; image_url: { url: string; detail?: 'low' | 'high' } } export type ChatMessage = | { role: 'system' | 'assistant' content: string } | { role: 'user' content: string | ContentPart[] } ================================================ FILE: src/app/bots/chatgpt-azure/index.ts ================================================ import { UserConfig } from '~services/user-config' import { AbstractChatGPTApiBot } from '../chatgpt-api' import { ChatMessage } from '../chatgpt-api/types' export class ChatGPTAzureApiBot extends AbstractChatGPTApiBot { constructor( private config: Pick< UserConfig, 'azureOpenAIApiKey' | 'azureOpenAIApiDeploymentName' | 'azureOpenAIApiInstanceName' >, ) { super() } async fetchCompletionApi(messages: ChatMessage[], signal?: AbortSignal) { const endpoint = `https://${this.config.azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${this.config.azureOpenAIApiDeploymentName}/chat/completions?api-version=2025-01-01-preview` return fetch(endpoint, { method: 'POST', signal, headers: { 'Content-Type': 'application/json', 'api-key': this.config.azureOpenAIApiKey, }, body: JSON.stringify({ messages, stream: true, }), }) } get name() { return `ChatGPT (azure/gpt-3.5)` } } ================================================ FILE: src/app/bots/chatgpt-webapp/arkose/generator.js ================================================ import Browser from 'webextension-polyfill' class ArkoseTokenGenerator { constructor() { this.enforcement = undefined this.pendingPromises = [] window.useArkoseSetupEnforcement = this.useArkoseSetupEnforcement.bind(this) this.injectScript() } useArkoseSetupEnforcement(enforcement) { this.enforcement = enforcement enforcement.setConfig({ onCompleted: (r) => { console.debug('enforcement.onCompleted', r) this.pendingPromises.forEach((promise) => { promise.resolve(r.token) }) this.pendingPromises = [] }, onReady: () => { console.debug('enforcement.onReady') }, onError: (r) => { console.debug('enforcement.onError', r) this.pendingPromises.forEach((promise) => { promise.reject(new Error('Error generating arkose token')) }) }, onFailed: (r) => { console.debug('enforcement.onFailed', r) this.pendingPromises.forEach((promise) => { promise.reject(new Error('Failed to generate arkose token')) }) }, }) } injectScript() { const script = document.createElement('script') script.src = Browser.runtime.getURL('/js/v2/35536E1E-65B4-4D96-9D97-6ADB7EFF8147/api.js') script.async = true script.defer = true script.setAttribute('data-callback', 'useArkoseSetupEnforcement') document.body.appendChild(script) } async generate() { if (!this.enforcement) { return } return new Promise((resolve, reject) => { this.pendingPromises = [{ resolve, reject }] // store only one promise for now. this.enforcement.run() }) } } export const arkoseTokenGenerator = new ArkoseTokenGenerator() ================================================ FILE: src/app/bots/chatgpt-webapp/arkose/index.ts ================================================ import { arkoseTokenGenerator } from './generator' import { fetchArkoseToken } from './server' export async function getArkoseToken() { const token = await arkoseTokenGenerator.generate() if (token) { return token } return fetchArkoseToken() } ================================================ FILE: src/app/bots/chatgpt-webapp/arkose/server.ts ================================================ import { ofetch } from 'ofetch' export async function fetchArkoseToken(): Promise { try { const resp = await ofetch('https://chathub.gg/api/arkose') return resp.token } catch (err) { console.error(err) return undefined } } ================================================ FILE: src/app/bots/chatgpt-webapp/client.ts ================================================ import { ofetch } from 'ofetch' import { RequestInitSubset } from '~types/messaging' import { ChatError, ErrorCode } from '~utils/errors' import { Requester, globalFetchRequester, proxyFetchRequester } from './requesters' class ChatGPTClient { requester: Requester constructor() { this.requester = globalFetchRequester proxyFetchRequester.findExistingProxyTab().then((tab) => { if (tab) { this.switchRequester(proxyFetchRequester) } }) } switchRequester(newRequester: Requester) { console.debug('client switchRequester', newRequester) this.requester = newRequester } async fetch(url: string, options?: RequestInitSubset): Promise { return this.requester.fetch(url, options) } async getAccessToken(): Promise { const resp = await this.fetch('https://chat.openai.com/api/auth/session') if (resp.status === 403) { throw new ChatError('Please pass Cloudflare check', ErrorCode.CHATGPT_CLOUDFLARE) } const data = await resp.json().catch(() => ({})) if (!data.accessToken) { throw new ChatError('There is no logged-in ChatGPT account in this browser.', ErrorCode.CHATGPT_UNAUTHORIZED) } return data.accessToken } private async requestBackendAPIWithToken(token: string, method: 'GET' | 'POST', path: string, data?: unknown) { return this.fetch(`https://chat.openai.com/backend-api${path}`, { method, headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}`, }, body: data === undefined ? undefined : JSON.stringify(data), }) } async getModels(token: string): Promise<{ slug: string; title: string; description: string; max_tokens: number }[]> { const resp = await this.requestBackendAPIWithToken(token, 'GET', '/models').then((r) => r.json()) return resp.models } async generateChatTitle(token: string, conversationId: string, messageId: string) { await this.requestBackendAPIWithToken(token, 'POST', `/conversation/gen_title/${conversationId}`, { message_id: messageId, }) } async createFileUpload(token: string, file: File): Promise<{ fileId: string; uploadUrl: string }> { const resp = await this.requestBackendAPIWithToken(token, 'POST', '/files', { file_name: file.name, file_size: file.size, use_case: 'multimodal', }) const data = await resp.json() if (data.status !== 'success') { throw new Error('Failed to init ChatGPT file upload') } return { fileId: data.file_id, uploadUrl: data.upload_url, } } async completeFileUpload(token: string, fileId: string) { await this.requestBackendAPIWithToken(token, 'POST', `/files/${fileId}/uploaded`, {}) } async uploadFile(token: string, file: File) { const { fileId, uploadUrl } = await this.createFileUpload(token, file) await ofetch(uploadUrl, { method: 'PUT', body: file, headers: { 'x-ms-blob-type': 'BlockBlob', 'x-ms-version': '2020-04-08', 'Content-Type': file.type, }, }) await this.completeFileUpload(token, fileId) return fileId } // Switch to proxy mode, or refresh the proxy tab async fixAuthState() { if (this.requester === proxyFetchRequester) { await proxyFetchRequester.refreshProxyTab() } else { await proxyFetchRequester.getProxyTab() this.switchRequester(proxyFetchRequester) } } } export const chatGPTClient = new ChatGPTClient() ================================================ FILE: src/app/bots/chatgpt-webapp/index.ts ================================================ import { get as getPath } from 'lodash-es' import { v4 as uuidv4 } from 'uuid' import { getImageSize } from '~app/utils/image-size' import { ChatGPTWebModel } from '~services/user-config' import { ChatError, ErrorCode } from '~utils/errors' import { parseSSEResponse } from '~utils/sse' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { getArkoseToken } from './arkose' import { chatGPTClient } from './client' import { ImageContent, ResponseContent, ResponsePayload } from './types' function removeCitations(text: string) { return text.replaceAll(/\u3010\d+\u2020source\u3011/g, '') } function parseResponseContent(content: ResponseContent): { text?: string; image?: ImageContent } { if (content.content_type === 'text') { return { text: removeCitations(content.parts[0]) } } if (content.content_type === 'code') { return { text: '_' + content.text + '_' } } if (content.content_type === 'multimodal_text') { for (const part of content.parts) { if (part.content_type === 'image_asset_pointer') { return { image: part } } } } return {} } interface ConversationContext { conversationId: string lastMessageId: string } export class ChatGPTWebBot extends AbstractBot { private accessToken?: string private conversationContext?: ConversationContext constructor(public model: ChatGPTWebModel) { super() } private async getModelName(): Promise { if (this.model === ChatGPTWebModel['GPT-4']) { return 'gpt-4' } return 'text-davinci-002-render-sha' } private async uploadImage(image: File): Promise { const fileId = await chatGPTClient.uploadFile(this.accessToken!, image) const size = await getImageSize(image) return { asset_pointer: `file-service://${fileId}`, width: size.width, height: size.height, size_bytes: image.size, } } private buildMessage(prompt: string, image?: ImageContent) { return { id: uuidv4(), author: { role: 'user' }, content: image ? { content_type: 'multimodal_text', parts: [image, prompt] } : { content_type: 'text', parts: [prompt] }, } } async doSendMessage(params: SendMessageParams) { if (!this.accessToken) { this.accessToken = await chatGPTClient.getAccessToken() } const modelName = await this.getModelName() console.debug('Using model:', modelName) const arkoseToken = await getArkoseToken() let image: ImageContent | undefined = undefined if (params.image) { image = await this.uploadImage(params.image) } const resp = await chatGPTClient.fetch('https://chat.openai.com/backend-api/conversation', { method: 'POST', signal: params.signal, headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${this.accessToken}`, }, body: JSON.stringify({ action: 'next', messages: [this.buildMessage(params.prompt, image)], model: modelName, conversation_id: this.conversationContext?.conversationId || undefined, parent_message_id: this.conversationContext?.lastMessageId || uuidv4(), arkose_token: arkoseToken, conversation_mode: { kind: 'primary_assistant' }, }), }) const isFirstMessage = !this.conversationContext await parseSSEResponse(resp, (message) => { console.debug('chatgpt sse message', message) if (message === '[DONE]') { params.onEvent({ type: 'DONE' }) return } let parsed: ResponsePayload | { message: null; error: string } try { parsed = JSON.parse(message) } catch (err) { console.error(err) return } if (!parsed.message && parsed.error) { params.onEvent({ type: 'ERROR', error: new ChatError(parsed.error, ErrorCode.UNKOWN_ERROR), }) return } const payload = parsed as ResponsePayload const role = getPath(payload, 'message.author.role') if (role !== 'assistant' && role !== 'tool') { return } const content = payload.message?.content as ResponseContent | undefined if (!content) { return } const { text } = parseResponseContent(content) if (text) { this.conversationContext = { conversationId: payload.conversation_id, lastMessageId: payload.message.id } params.onEvent({ type: 'UPDATE_ANSWER', data: { text } }) } }).catch((err: Error) => { if (err.message.includes('token_expired')) { throw new ChatError(err.message, ErrorCode.CHATGPT_AUTH) } throw err }) // auto generate title on first response if (isFirstMessage && this.conversationContext) { const c = this.conversationContext chatGPTClient.generateChatTitle(this.accessToken, c.conversationId, c.lastMessageId) } } resetConversation() { this.conversationContext = undefined } get name() { return `ChatGPT (webapp/${this.model})` } get supportsImageInput() { return true } } ================================================ FILE: src/app/bots/chatgpt-webapp/requesters.ts ================================================ import Browser, { Runtime } from 'webextension-polyfill' import { CHATGPT_HOME_URL } from '~app/consts' import { proxyFetch } from '~services/proxy-fetch' import { RequestInitSubset } from '~types/messaging' export interface Requester { fetch(url: string, options?: RequestInitSubset): Promise } class GlobalFetchRequester implements Requester { fetch(url: string, options?: RequestInitSubset) { return fetch(url, options) } } class ProxyFetchRequester implements Requester { async findExistingProxyTab() { const tabs = await Browser.tabs.query({ pinned: true }) const results: (string | undefined)[] = await Promise.all( tabs.map(async (tab) => { if (tab.url) { return tab.url } return Browser.tabs.sendMessage(tab.id!, 'url').catch(() => undefined) }), ) for (let i = 0; i < results.length; i++) { if (results[i]?.startsWith('https://chat.openai.com')) { return tabs[i] } } } waitForProxyTabReady(): Promise { return new Promise((resolve, reject) => { const listener = async function (message: any, sender: Runtime.MessageSender) { if (message.event === 'PROXY_TAB_READY') { console.debug('new proxy tab ready') Browser.runtime.onMessage.removeListener(listener) clearTimeout(timer) resolve(sender.tab!) return true } } const timer = setTimeout(() => { Browser.runtime.onMessage.removeListener(listener) reject(new Error('Timeout waiting for ChatGPT tab')) }, 10 * 1000) Browser.runtime.onMessage.addListener(listener) }) } async createProxyTab() { const readyPromise = this.waitForProxyTabReady() Browser.tabs.create({ url: CHATGPT_HOME_URL, pinned: true }) return readyPromise } async getProxyTab() { let tab = await this.findExistingProxyTab() if (!tab) { tab = await this.createProxyTab() } return tab } async refreshProxyTab() { const tab = await this.findExistingProxyTab() if (!tab) { await this.createProxyTab() return } const readyPromise = this.waitForProxyTabReady() Browser.tabs.reload(tab.id!) return readyPromise } async fetch(url: string, options?: RequestInitSubset) { const tab = await this.getProxyTab() const resp = await proxyFetch(tab.id!, url, options) if (resp.status === 403) { await this.refreshProxyTab() return proxyFetch(tab.id!, url, options) } return resp } } export const globalFetchRequester = new GlobalFetchRequester() export const proxyFetchRequester = new ProxyFetchRequester() ================================================ FILE: src/app/bots/chatgpt-webapp/types.ts ================================================ export type ResponsePayload = { conversation_id: string message: { id: string author: { role: 'assistant' | 'tool' | 'user' } content: ResponseContent recipient: 'all' | string } error: null } export type ResponseContent = | { content_type: 'text' parts: string[] } | { content_type: 'code' text: string } | { content_type: 'tether_browsing_display' result: string } | { content_type: 'multimodal_text' parts: ({ content_type: 'image_asset_pointer' } & ImageContent)[] } export type ResponseCitation = { start_ix: number end_ix: number metadata: { title: string url: string text: string } } export interface ImageContent { asset_pointer: string // file-service://file-5JUtfsLd8O0GEZzjtFmWvZr8 size_bytes: number width: number height: number } ================================================ FILE: src/app/bots/claude/index.ts ================================================ import { ClaudeMode, getUserConfig } from '~/services/user-config' import * as agent from '~services/agent' import { AsyncAbstractBot, MessageParams } from '../abstract-bot' import { ClaudeApiBot } from '../claude-api' import { ClaudeWebBot } from '../claude-web' import { PoeWebBot } from '../poe' import { ChatError, ErrorCode } from '~utils/errors' import { OpenRouterBot } from '../openrouter' export class ClaudeBot extends AsyncAbstractBot { async initializeBot() { const { claudeMode, ...config } = await getUserConfig() if (claudeMode === ClaudeMode.API) { if (!config.claudeApiKey) { throw new Error('Claude API key missing') } return new ClaudeApiBot({ claudeApiKey: config.claudeApiKey, claudeApiModel: config.claudeApiModel, }) } if (claudeMode === ClaudeMode.Webapp) { return new ClaudeWebBot() } if (claudeMode === ClaudeMode.OpenRouter) { if (!config.openrouterApiKey) { throw new ChatError('OpenRouter API key not set', ErrorCode.API_KEY_NOT_SET) } const model = `anthropic/${config.openrouterClaudeModel}` return new OpenRouterBot({ apiKey: config.openrouterApiKey, model }) } return new PoeWebBot(config.poeModel) } async sendMessage(params: MessageParams) { const { claudeWebAccess } = await getUserConfig() if (claudeWebAccess) { return agent.execute(params.prompt, (prompt) => this.doSendMessageGenerator({ ...params, prompt }), params.signal) } return this.doSendMessageGenerator(params) } } ================================================ FILE: src/app/bots/claude-api/index.ts ================================================ import { requestHostPermission } from '~app/utils/permissions' import { ClaudeAPIModel, UserConfig } from '~services/user-config' import { ChatError, ErrorCode } from '~utils/errors' import { parseSSEResponse } from '~utils/sse' import { AbstractBot, SendMessageParams } from '../abstract-bot' interface ConversationContext { prompt: string } export class ClaudeApiBot extends AbstractBot { private conversationContext?: ConversationContext constructor(private config: Pick) { super() } async fetchCompletionApi(prompt: string, signal?: AbortSignal) { return fetch('https://api.anthropic.com/v1/complete', { method: 'POST', signal, headers: { 'content-type': 'application/json', 'x-api-key': this.config.claudeApiKey, 'anthropic-version': '2023-06-01', }, body: JSON.stringify({ prompt, model: this.getModelName(), max_tokens_to_sample: 100_000, stream: true, }), }) } async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermission('https://*.anthropic.com/'))) { throw new ChatError('Missing anthropic.com permission', ErrorCode.UNKOWN_ERROR) } if (!this.conversationContext) { this.conversationContext = { prompt: '' } } this.conversationContext.prompt += `\n\nHuman: ${params.prompt}\n\nAssistant:` const resp = await this.fetchCompletionApi(this.conversationContext.prompt, params.signal) let result = '' await parseSSEResponse(resp, (message) => { console.debug('claude sse message', message) const data = JSON.parse(message) as { completion: string } if (data.completion) { result += data.completion params.onEvent({ type: 'UPDATE_ANSWER', data: { text: result.trimStart() } }) } }) params.onEvent({ type: 'DONE' }) this.conversationContext!.prompt += result } private getModelName() { switch (this.config.claudeApiModel) { case ClaudeAPIModel['claude-instant-1']: return 'claude-instant-1.2' default: return 'claude-2.1' } } resetConversation() { this.conversationContext = undefined } get name() { return `Claude (API/${this.config.claudeApiModel})` } } ================================================ FILE: src/app/bots/claude-web/api.ts ================================================ import { FetchError, ofetch } from 'ofetch' import { uuid } from '~utils' import { ChatError, ErrorCode } from '~utils/errors' export async function fetchOrganizationId(): Promise { let resp: Response try { resp = await fetch('https://claude.ai/api/organizations', { redirect: 'error', cache: 'no-cache' }) } catch (err) { console.error(err) throw new ChatError('Claude webapp not avaiable in your country', ErrorCode.CLAUDE_WEB_UNAVAILABLE) } if (resp.status === 403) { throw new ChatError('There is no logged-in Claude account in this browser.', ErrorCode.CLAUDE_WEB_UNAUTHORIZED) } const orgs = await resp.json() return orgs[0].uuid } export async function createConversation(organizationId: string): Promise { const id = uuid() try { await ofetch(`https://claude.ai/api/organizations/${organizationId}/chat_conversations`, { method: 'POST', body: { name: '', uuid: id }, }) } catch (err) { if (err instanceof FetchError && err.status === 403) { throw new ChatError('There is no logged-in Claude account in this browser.', ErrorCode.CLAUDE_WEB_UNAUTHORIZED) } throw err } return id } export async function generateChatTitle(organizationId: string, conversationId: string, content: string) { await ofetch('https://claude.ai/api/generate_chat_title', { method: 'POST', body: { organization_uuid: organizationId, conversation_uuid: conversationId, recent_titles: [], message_content: content, }, }) } ================================================ FILE: src/app/bots/claude-web/index.ts ================================================ import { parseSSEResponse } from '~utils/sse' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { createConversation, fetchOrganizationId, generateChatTitle } from './api' import { requestHostPermission } from '~app/utils/permissions' import { ChatError, ErrorCode } from '~utils/errors' interface ConversationContext { conversationId: string } export class ClaudeWebBot extends AbstractBot { private organizationId?: string private conversationContext?: ConversationContext private model: string constructor() { super() this.model = 'claude-2.1' } async doSendMessage(params: SendMessageParams): Promise { if (!(await requestHostPermission('https://*.claude.ai/'))) { throw new ChatError('Missing claude.ai permission', ErrorCode.MISSING_HOST_PERMISSION) } if (!this.organizationId) { this.organizationId = await fetchOrganizationId() } if (!this.conversationContext) { const conversationId = await createConversation(this.organizationId) this.conversationContext = { conversationId } generateChatTitle(this.organizationId, conversationId, params.prompt).catch(console.error) } const resp = await fetch('https://claude.ai/api/append_message', { method: 'POST', signal: params.signal, headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ organization_uuid: this.organizationId, conversation_uuid: this.conversationContext.conversationId, text: params.prompt, completion: { prompt: params.prompt, model: this.model, }, attachments: [], }), }) // different models are available for different accounts if (!resp.ok && resp.status === 403 && this.model === 'claude-2.1') { if ((await resp.text()).includes('model_not_allowed')) { this.model = 'claude-2.0' return this.doSendMessage(params) } } let result = '' await parseSSEResponse(resp, (message) => { console.debug('claude sse message', message) const payload = JSON.parse(message) if (payload.completion) { result += payload.completion params.onEvent({ type: 'UPDATE_ANSWER', data: { text: result.trimStart() }, }) } else if (payload.error) { throw new Error(JSON.stringify(payload.error)) } }) params.onEvent({ type: 'DONE' }) } resetConversation() { this.conversationContext = undefined } get name() { return 'Claude (webapp/claude-2)' } } ================================================ FILE: src/app/bots/gemini-api/index.ts ================================================ import { GoogleGenerativeAI, ChatSession } from '@google/generative-ai' import { AbstractBot, AsyncAbstractBot, SendMessageParams } from '../abstract-bot' import { getUserConfig } from '~services/user-config' interface ConversationContext { chatSession: ChatSession } export class GeminiApiBot extends AbstractBot { private conversationContext?: ConversationContext sdk: GoogleGenerativeAI constructor(public apiKey: string) { super() this.sdk = new GoogleGenerativeAI(apiKey) } async doSendMessage(params: SendMessageParams) { if (!this.conversationContext) { const model = this.sdk.getGenerativeModel({ model: 'gemini-pro' }) const chatSession = model.startChat() this.conversationContext = { chatSession } } const result = await this.conversationContext.chatSession.sendMessageStream(params.prompt) let text = '' for await (const chunk of result.stream) { const chunkText = chunk.text() console.debug('gemini stream', chunkText) text += chunkText params.onEvent({ type: 'UPDATE_ANSWER', data: { text } }) } if (!text) { params.onEvent({ type: 'UPDATE_ANSWER', data: { text: 'Empty response' } }) } params.onEvent({ type: 'DONE' }) } resetConversation() { this.conversationContext = undefined } get name() { return 'Gemini Pro' } } export class GeminiBot extends AsyncAbstractBot { async initializeBot() { const { geminiApiKey } = await getUserConfig() if (!geminiApiKey) { throw new Error('Gemini API key missing') } return new GeminiApiBot(geminiApiKey) } } ================================================ FILE: src/app/bots/gradio/index.ts ================================================ import WebSocketAsPromised from 'websocket-as-promised' import { ChatError, ErrorCode } from '~utils/errors' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { html2md } from '~app/utils/markdown' function generateSessionHash() { // https://stackoverflow.com/a/12502559/325241 return Math.random().toString(36).substring(2) } enum FnIndex { Send = 39, Receive = 40, } interface ConversationContext { sessionHash: string } export class GradioBot extends AbstractBot { private conversationContext?: ConversationContext constructor( public wsUrl: string, public model: string, public params: number[], public mode?: 'text' | 'html', ) { super() } async doSendMessage(params: SendMessageParams) { if (!this.conversationContext) { const sessionHash = await this.createSession(params.signal) this.conversationContext = { sessionHash } } const sendWsp = await this.connectWebsocket( FnIndex.Send, this.conversationContext.sessionHash, [null, this.model, params.prompt], params.onEvent, ) const receiveWsp = await this.connectWebsocket( FnIndex.Receive, this.conversationContext.sessionHash, [null, ...this.params], params.onEvent, ) params.signal?.addEventListener('abort', () => { ;[sendWsp, receiveWsp].forEach((wsp) => { wsp.removeAllListeners() wsp.close() }) }) } async connectWebsocket(fnIndex: number, sessionHash: string, data: unknown[], onEvent: SendMessageParams['onEvent']) { const wsp = new WebSocketAsPromised(this.wsUrl, { packMessage: (data) => JSON.stringify(data), unpackMessage: (data) => JSON.parse(data as string), }) wsp.onUnpackedMessage.addListener(async (event) => { if (event.msg === 'send_hash') { wsp.sendPacked({ fn_index: fnIndex, session_hash: sessionHash }) } else if (event.msg === 'send_data') { wsp.sendPacked({ fn_index: fnIndex, data, event_data: null, session_hash: sessionHash, }) } else if (event.msg === 'process_generating') { if (event.success && event.output.data) { if (fnIndex === FnIndex.Receive) { const outputData = event.output.data if (outputData[1].length > 0) { const text = outputData[1][outputData[1].length - 1][1] onEvent({ type: 'UPDATE_ANSWER', data: { text: this.mode === 'html' ? html2md(text) : text, }, }) } } } else { onEvent({ type: 'ERROR', error: new ChatError(event.output.error, ErrorCode.UNKOWN_ERROR) }) } } else if (event.msg === 'queue_full') { onEvent({ type: 'ERROR', error: new ChatError('queue_full', ErrorCode.UNKOWN_ERROR) }) } else if (event.msg === 'process_completed' && fnIndex === FnIndex.Receive && !event.output.data[1].length) { onEvent({ type: 'ERROR', error: new ChatError('Session has been inactive for too long', ErrorCode.LMSYS_SESSION_EXPIRED), }) } }) if (fnIndex === FnIndex.Receive) { wsp.onClose.addListener(() => { wsp.removeAllListeners() onEvent({ type: 'DONE' }) }) } try { await wsp.open() } catch (err) { console.error('WS open error', err) throw new ChatError('Failed to establish websocket connection.', ErrorCode.NETWORK_ERROR) } return wsp } resetConversation() { this.conversationContext = undefined } public async createSession(_signal?: AbortSignal) { return generateSessionHash() } } ================================================ FILE: src/app/bots/grok/index.ts ================================================ import { FetchError, ofetch } from 'ofetch' import Browser from 'webextension-polyfill' import { requestHostPermission } from '~app/utils/permissions' import { ChatError, ErrorCode } from '~utils/errors' import { streamAsyncIterable } from '~utils/stream-async-iterable' import { AbstractBot, SendMessageParams } from '../abstract-bot' const AUTHORIZATION_VALUE = 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs=1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA' interface StreamMessage { result: { sender: string message: string query: string } } interface ChatMessage { sender: 1 | 2 message: string } interface ConversationContext { conversationId: string messages: ChatMessage[] } export class GrokWebBot extends AbstractBot { private csrfToken?: string private conversationContext?: ConversationContext constructor() { super() } async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermission('https://*.twitter.com/'))) { throw new ChatError('Missing twitter.com permission', ErrorCode.MISSING_HOST_PERMISSION) } if (!this.csrfToken) { this.csrfToken = await this.readCsrfToken() } if (!this.conversationContext) { const conversationId = await this.getConversationId() this.conversationContext = { conversationId, messages: [] } } this.conversationContext.messages.push({ sender: 1, message: params.prompt }) const resp = await fetch('https://api.twitter.com/2/grok/add_response.json', { method: 'POST', headers: { Authorization: AUTHORIZATION_VALUE, 'x-csrf-token': this.csrfToken!, }, body: JSON.stringify({ conversationId: this.conversationContext.conversationId, responses: this.conversationContext.messages, systemPromptName: 'fun', }), signal: params.signal, }) if (!resp.ok) { throw new Error(resp.status.toString() + ' ' + (await resp.text())) } const decoder = new TextDecoder() let result = '' for await (const uint8Array of streamAsyncIterable(resp.body!)) { const str = decoder.decode(uint8Array) console.debug('grok stream', str) const lines = str.split('\n') for (const line of lines) { if (!line) { continue } const payload: StreamMessage = JSON.parse(line) if (!payload.result) { continue } if (!result && !payload.result.message && payload.result.query) { params.onEvent({ type: 'UPDATE_ANSWER', data: { text: '_' + payload.result.query + '_' } }) } else { const text = payload.result.message if (text.startsWith('[link]')) { // [link](#tweet=1711679181984346515)\n\n==\n\n[link](#tweet=1663711402643845122) // skip special Twitter card message for now } else { result += text params.onEvent({ type: 'UPDATE_ANSWER', data: { text: result } }) } } } } this.conversationContext.messages.push({ sender: 2, message: result }) params.onEvent({ type: 'DONE' }) } private async getConversationId(): Promise { try { const resp = await ofetch('https://twitter.com/i/api/2/grok/conversation_id.json', { headers: { Authorization: AUTHORIZATION_VALUE, 'x-csrf-token': this.csrfToken!, }, }) return resp.conversationId } catch (err) { if (err instanceof FetchError) { if (err.status === 401) { throw new ChatError('Grok is only available to Twitter Premium+ subscribers', ErrorCode.GROK_UNAVAILABLE) } if (err.status === 451) { throw new ChatError('Grok is not available in your country', ErrorCode.GROK_UNAVAILABLE) } // csrf & cookie mismatch if (err.status === 403) { this.csrfToken = await this.readCsrfToken({ refresh: true }) return this.getConversationId() } } throw err } } private async readCsrfToken({ refresh }: { refresh?: boolean } = {}): Promise { const token = await Browser.runtime.sendMessage({ type: 'read-twitter-csrf-token', data: { refresh }, target: 'background', }) console.debug('twitter csrf token', token) if (!token) { throw new ChatError('There is no logged-in Twitter account in this browser.', ErrorCode.TWITTER_UNAUTHORIZED) } return token } resetConversation() { this.conversationContext = undefined } get name() { return 'Grok' } } ================================================ FILE: src/app/bots/index.ts ================================================ import { BaichuanWebBot } from './baichuan' import { BardBot } from './bard' import { BingWebBot } from './bing' import { ChatGPTBot } from './chatgpt' import { ClaudeBot } from './claude' import { GeminiBot } from './gemini-api' import { GrokWebBot } from './grok' import { LMSYSBot } from './lmsys' import { PerplexityBot } from './perplexity' import { PiBot } from './pi' import { QianwenWebBot } from './qianwen' import { XunfeiBot } from './xunfei' export type BotId = | 'chatgpt' | 'bing' | 'bard' | 'claude' | 'perplexity' | 'xunfei' | 'vicuna' | 'falcon' | 'mistral' | 'chatglm' | 'llama' | 'pi' | 'wizardlm' | 'qianwen' | 'baichuan' | 'yi' | 'grok' | 'gemini' export function createBotInstance(botId: BotId) { switch (botId) { case 'chatgpt': return new ChatGPTBot() case 'bing': return new BingWebBot() case 'bard': return new BardBot() case 'claude': return new ClaudeBot() case 'xunfei': return new XunfeiBot() case 'vicuna': return new LMSYSBot('vicuna-33b') case 'chatglm': return new LMSYSBot('chatglm2-6b') case 'llama': return new LMSYSBot('llama-2-70b-chat') case 'wizardlm': return new LMSYSBot('wizardlm-13b') case 'falcon': return new LMSYSBot('falcon-180b-chat') case 'mistral': return new LMSYSBot('mixtral-8x7b-instruct-v0.1') case 'yi': return new LMSYSBot('yi-34b-chat') case 'pi': return new PiBot() case 'qianwen': return new QianwenWebBot() case 'baichuan': return new BaichuanWebBot() case 'perplexity': return new PerplexityBot() case 'grok': return new GrokWebBot() case 'gemini': return new GeminiBot() } } export type BotInstance = ReturnType ================================================ FILE: src/app/bots/lmsys/index.ts ================================================ import WebSocketAsPromised from 'websocket-as-promised' import { GradioBot } from '../gradio' import { ChatError, ErrorCode } from '~utils/errors' export class LMSYSBot extends GradioBot { constructor(model: string) { super('wss://chat.lmsys.org/queue/join', model, [0.7, 1, 512], 'text') } private async initializeSession( fnIndex: number, sessionHash: string, data: unknown[], signal?: AbortSignal, ): Promise { const wsp = new WebSocketAsPromised(this.wsUrl, { packMessage: (data) => JSON.stringify(data), unpackMessage: (data) => JSON.parse(data as string), }) signal?.addEventListener('abort', () => wsp.close()) return new Promise((resolve, reject) => { wsp.onUnpackedMessage.addListener((event) => { if (event.msg === 'send_hash') { wsp.sendPacked({ fn_index: fnIndex, session_hash: sessionHash }) } else if (event.msg === 'send_data') { wsp.sendPacked({ fn_index: fnIndex, data, event_data: null, session_hash: sessionHash }) } else if (event.msg === 'process_completed') { resolve() } }) wsp.open().catch((err) => { console.error('lmsys ws open error', err) reject(new ChatError('Failed to establish websocket connection.', ErrorCode.LMSYS_WS_ERROR)) }) }) } async createSession(signal?: AbortSignal) { const sessionHash = await super.createSession(signal) await Promise.all([ this.initializeSession(36, sessionHash, [], signal), this.initializeSession(43, sessionHash, [{}], signal), ]) return sessionHash } } ================================================ FILE: src/app/bots/openrouter/index.ts ================================================ import { requestHostPermission } from '~app/utils/permissions' import { ChatError, ErrorCode } from '~utils/errors' import { parseSSEResponse } from '~utils/sse' import { AbstractBot, SendMessageParams } from '../abstract-bot' interface ChatMessage { role: 'system' | 'assistant' | 'user' content: string } interface ConversationContext { messages: ChatMessage[] } const CONTEXT_SIZE = 9 export class OpenRouterBot extends AbstractBot { private conversationContext?: ConversationContext constructor(private config: { apiKey: string; model: string }) { super() } buildMessages(prompt: string): ChatMessage[] { return [...this.conversationContext!.messages.slice(-(CONTEXT_SIZE + 1)), { role: 'user', content: prompt }] } async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermission('https://*.openrouter.ai/'))) { throw new ChatError('Missing openrouter.ai permission', ErrorCode.MISSING_HOST_PERMISSION) } if (!this.conversationContext) { this.conversationContext = { messages: [] } } const resp = await this.fetchCompletionApi(this.buildMessages(params.prompt), params.signal) this.conversationContext.messages.push({ role: 'user', content: params.rawUserInput || params.prompt, }) let done = false const result: ChatMessage = { role: 'assistant', content: '' } const finish = () => { done = true params.onEvent({ type: 'DONE' }) const messages = this.conversationContext!.messages messages.push(result) } await parseSSEResponse(resp, (message) => { console.debug('openrouter sse message', message) if (message === '[DONE]') { finish() return } let data try { data = JSON.parse(message) } catch (err) { console.error(err) return } if (data?.choices?.length) { const delta = data.choices[0].delta if (delta?.content) { result.content += delta.content params.onEvent({ type: 'UPDATE_ANSWER', data: { text: result.content }, }) } } }) if (!done) { finish() } } async fetchCompletionApi(messages: ChatMessage[], signal?: AbortSignal): Promise { return fetch('https://openrouter.ai/api/v1/chat/completions', { method: 'POST', signal, headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${this.config.apiKey}`, 'HTTP-Referer': 'https://chathub.gg', 'X-Title': 'ChatHub', }, body: JSON.stringify({ model: this.config.model, messages, stream: true, }), }) } resetConversation() { this.conversationContext = undefined } get name() { return `OpenRouter/${this.config.model}` } } ================================================ FILE: src/app/bots/perplexity/index.ts ================================================ import { PerplexityMode, getUserConfig } from '~/services/user-config' import { AsyncAbstractBot } from '../abstract-bot' import { PerplexityApiBot } from '../perplexity-api' import { PerplexityLabsBot } from '../perplexity-web' export class PerplexityBot extends AsyncAbstractBot { async initializeBot() { const { perplexityMode, ...config } = await getUserConfig() if (perplexityMode === PerplexityMode.API) { if (!config.perplexityApiKey) { throw new Error('Perplexity API key missing') } return new PerplexityApiBot(config.perplexityApiKey, 'pplx-70b-online') } return new PerplexityLabsBot('pplx-70b-online') } } ================================================ FILE: src/app/bots/perplexity-api/api.ts ================================================ import { ofetch } from 'ofetch' async function getSessionId() { const resp: string = await ofetch('https://labs-api.perplexity.ai/socket.io/?transport=polling&EIO=4') const data = JSON.parse(resp.slice(1)) const sessionId: string = data.sid return sessionId } async function initSession(sessionId: string) { const resp = await ofetch(`https://labs-api.perplexity.ai/socket.io/?EIO=4&transport=polling&sid=${sessionId}`, { method: 'POST', body: '40{"jwt":"anonymous-ask-user"}', }) if (resp !== 'OK') { throw new Error('Failed to init perplexity session') } } export async function createSession(): Promise { const sessionId = await getSessionId() await initSession(sessionId) return sessionId } ================================================ FILE: src/app/bots/perplexity-api/index.ts ================================================ import { parseSSEResponse } from '~utils/sse' import { AbstractBot, SendMessageParams } from '../abstract-bot' interface ChatMessage { role: 'user' | 'assistant' content: string } interface ConversationContext { messages: ChatMessage[] } export class PerplexityApiBot extends AbstractBot { private conversationContext?: ConversationContext constructor( public apiKey: string, public model: string, ) { super() } async doSendMessage(params: SendMessageParams) { if (!this.conversationContext) { this.conversationContext = { messages: [] } } const message: ChatMessage = { role: 'user', content: params.prompt } const resp = await this.fetchCompletionApi([...this.conversationContext.messages, message], params.signal) // add user message to context only after fetch success this.conversationContext.messages.push(message) let answer: string = '' await parseSSEResponse(resp, (message) => { console.debug('pplx sse message', message) let data try { data = JSON.parse(message) } catch (err) { console.error(err) return } if (data?.choices?.length) { const message = data.choices[0].message if (message.role === 'assistant' && message.content) { answer = message.content params.onEvent({ type: 'UPDATE_ANSWER', data: { text: answer } }) } } }) this.conversationContext.messages.push({ role: 'assistant', content: answer }) params.onEvent({ type: 'DONE' }) } private async fetchCompletionApi(messages: ChatMessage[], signal?: AbortSignal) { return fetch('https://api.perplexity.ai/chat/completions', { method: 'POST', signal, body: JSON.stringify({ model: this.model, messages, stream: true, }), headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${this.apiKey}`, }, }) } resetConversation() { this.conversationContext = undefined } get name() { return 'Perplexity (API)' } } ================================================ FILE: src/app/bots/perplexity-web/api.ts ================================================ import { FetchError, ofetch } from 'ofetch' import { ChatError, ErrorCode } from '~utils/errors' async function getSessionId() { let resp: string try { resp = await ofetch('https://labs-api.perplexity.ai/socket.io/?transport=polling&EIO=4') } catch (err) { if (err instanceof FetchError && err.status === 403) { throw new ChatError('Please pass Perplexity security check', ErrorCode.PPLX_FORBIDDEN_ERROR) } throw err } const data = JSON.parse(resp.slice(1)) const sessionId: string = data.sid return sessionId } async function initSession(sessionId: string) { const resp = await ofetch(`https://labs-api.perplexity.ai/socket.io/?EIO=4&transport=polling&sid=${sessionId}`, { method: 'POST', body: '40{"jwt":"anonymous-ask-user"}', }) if (resp !== 'OK') { throw new Error('Failed to init perplexity session') } } export async function createSession(): Promise { const sessionId = await getSessionId() await initSession(sessionId) return sessionId } ================================================ FILE: src/app/bots/perplexity-web/index.ts ================================================ import WebSocketAsPromised from 'websocket-as-promised' import { requestHostPermissions } from '~app/utils/permissions' import { ChatError, ErrorCode } from '~utils/errors' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { createSession } from './api' interface ConversationContext { wsp: WebSocketAsPromised } export class PerplexityLabsBot extends AbstractBot { private conversationContext?: ConversationContext constructor(public model: string) { super() } private buildMessage(prompt: string) { const params = [ 'perplexity_playground', { version: '2.1', source: 'default', model: this.model, messages: [{ role: 'user', content: prompt, priority: 0 }], }, ] return `42${JSON.stringify(params)}` } private async setupWebsocket(sessionId: string): Promise { const wsp = new WebSocketAsPromised( `wss://labs-api.perplexity.ai/socket.io/?EIO=4&transport=websocket&sid=${sessionId}`, ) return new Promise((resolve, reject) => { wsp.onOpen.addListener(() => { wsp.send('2probe') wsp.send('5') }) wsp.onMessage.addListener((data: string) => { if (data === '2') { wsp.send('3') } else if (data === '6') { resolve(wsp) } }) wsp.open().catch(reject) }) } async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermissions(['https://*.perplexity.ai/', 'wss://*.perplexity.ai/']))) { throw new ChatError('Missing perplexity.ai permission', ErrorCode.MISSING_HOST_PERMISSION) } if (!this.conversationContext) { const sessionId = await createSession() const wsp = await this.setupWebsocket(sessionId) this.conversationContext = { wsp } } const { wsp } = this.conversationContext const listener = (data: string) => { console.debug('pplx ws data', data) if (!data.startsWith('42')) { return } const payload = JSON.parse(data.slice(2)) if (payload[0] !== 'pplx-70b-online_query_progress') { return } const chunk = payload[1] if (chunk.output) { params.onEvent({ type: 'UPDATE_ANSWER', data: { text: chunk.output } }) } if (chunk.status === 'completed') { wsp.onMessage.removeListener(listener) params.onEvent({ type: 'DONE' }) } if (chunk.status === 'failed') { wsp.onMessage.removeListener(listener) params.onEvent({ type: 'ERROR', error: new ChatError('failed', ErrorCode.UNKOWN_ERROR) }) } } wsp.onMessage.addListener(listener) wsp.send(this.buildMessage(params.prompt)) } resetConversation() { this.conversationContext = undefined } get name() { return 'Perplexity (webapp)' } } ================================================ FILE: src/app/bots/pi/index.ts ================================================ import { requestHostPermission } from '~app/utils/permissions' import { ChatError, ErrorCode } from '~utils/errors' import { parseSSEResponse } from '~utils/sse' import { AbstractBot, SendMessageParams } from '../abstract-bot' interface ConversationContext { initialized: boolean } export class PiBot extends AbstractBot { private conversationContext?: ConversationContext async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermission('https://*.pi.ai/'))) { throw new ChatError('Missing pi.ai permission', ErrorCode.MISSING_HOST_PERMISSION) } if (!this.conversationContext?.initialized) { await fetch('https://pi.ai/api/chat/start', { method: 'POST' }) this.conversationContext = { initialized: true } } const resp = await fetch('https://pi.ai/api/chat', { method: 'POST', signal: params.signal, body: JSON.stringify({ text: params.prompt }), headers: { 'Content-Type': 'application/json', }, }) await parseSSEResponse(resp, (message) => { console.debug('pi sse', message) const data = JSON.parse(message) if (data.text) { params.onEvent({ type: 'UPDATE_ANSWER', data: { text: data.text } }) } }) params.onEvent({ type: 'DONE' }) } resetConversation() { this.conversationContext = undefined } } ================================================ FILE: src/app/bots/poe/api.ts ================================================ import md5 from 'md5' import { ofetch } from 'ofetch' import i18n from '~app/i18n' import { decodePoeFormkey } from '~services/server-api' import { ChatError, ErrorCode } from '~utils/errors' import AddMessageBreakMutation from './graphql/AddMessageBreakMutation.graphql?raw' import ChatViewQuery from './graphql/ChatViewQuery.graphql?raw' import MessageAddedSubscription from './graphql/MessageAddedSubscription.graphql?raw' import SendMessageMutation from './graphql/SendMessageMutation.graphql?raw' import SubscriptionsMutation from './graphql/SubscriptionsMutation.graphql?raw' import ViewerStateUpdatedSubscription from './graphql/ViewerStateUpdatedSubscription.graphql?raw' export const GRAPHQL_QUERIES = { AddMessageBreakMutation, ChatViewQuery, SendMessageMutation, SubscriptionsMutation, MessageAddedSubscription, ViewerStateUpdatedSubscription, } export interface PoeSettings { formkey: string tchannelData: ChannelData } interface ChannelData { minSeq: string channel: string channelHash: string boxName: string baseHost: string targetUrl: string enableWebsocket: boolean } async function getFormkey() { const html: string = await ofetch('https://poe.com', { parseResponse: (txt) => txt }) const formkey = await decodePoeFormkey(html) return formkey } export async function getPoeSettings(): Promise { const [settings, formkey] = await Promise.all([ofetch('https://poe.com/api/settings'), getFormkey()]) console.debug('poe formkey', formkey) settings.formkey = formkey return settings } export interface GqlHeaders { formkey: string tchannel: string } export async function gqlRequest(queryName: keyof typeof GRAPHQL_QUERIES, variables: any, poeSettings: PoeSettings) { const query = GRAPHQL_QUERIES[queryName] const payload = { query, variables } const tagId = md5(JSON.stringify(payload) + poeSettings.formkey + 'Jb1hi3fg1MxZpzYfy') return ofetch('https://poe.com/api/gql_POST', { method: 'POST', body: payload, headers: { 'poe-formkey': poeSettings.formkey, 'poe-tag-id': tagId, 'poe-tchannel': poeSettings.tchannelData.channel, }, }) } export async function getChatId(bot: string, poeSettings: PoeSettings): Promise { const resp = await gqlRequest('ChatViewQuery', { bot }, poeSettings) if (!resp.data) { throw new ChatError(i18n.t('You need to login to Poe first'), ErrorCode.POE_UNAUTHORIZED) } return resp.data.chatOfBot.chatId } ================================================ FILE: src/app/bots/poe/graphql/AddMessageBreakMutation.graphql ================================================ mutation AddMessageBreakMutation($chatId: BigInt!) { messageBreakCreate(chatId: $chatId) { message { id __typename messageId text linkifiedText authorNickname state vote voteReason creationTime suggestedReplies } } } ================================================ FILE: src/app/bots/poe/graphql/AutoSubscriptionMutation.graphql ================================================ mutation AutoSubscriptionMutation($subscriptions: [AutoSubscriptionQuery!]!) { autoSubscribe(subscriptions: $subscriptions) { viewer { id } } } ================================================ FILE: src/app/bots/poe/graphql/ChatViewQuery.graphql ================================================ query ChatViewQuery($bot: String!) { chatOfBot(bot: $bot) { id chatId defaultBotNickname shouldShowDisclaimer } } ================================================ FILE: src/app/bots/poe/graphql/MessageAddedSubscription.graphql ================================================ subscription messageAdded($chatId: BigInt!) { messageAdded(chatId: $chatId) { id messageId creationTime state ...ChatMessage_message ...chatHelpers_isBotMessage } } fragment ChatMessageDownvotedButton_message on Message { ...MessageFeedbackReasonModal_message ...MessageFeedbackOtherModal_message } fragment ChatMessageDropdownMenu_message on Message { id messageId vote text linkifiedText ...chatHelpers_isBotMessage } fragment ChatMessageFeedbackButtons_message on Message { id messageId vote voteReason ...ChatMessageDownvotedButton_message } fragment ChatMessageOverflowButton_message on Message { text ...ChatMessageDropdownMenu_message ...chatHelpers_isBotMessage } fragment ChatMessageSuggestedReplies_SuggestedReplyButton_message on Message { messageId } fragment ChatMessageSuggestedReplies_message on Message { suggestedReplies ...ChatMessageSuggestedReplies_SuggestedReplyButton_message } fragment ChatMessage_message on Message { id messageId text author linkifiedText state ...ChatMessageSuggestedReplies_message ...ChatMessageFeedbackButtons_message ...ChatMessageOverflowButton_message ...chatHelpers_isHumanMessage ...chatHelpers_isBotMessage ...chatHelpers_isChatBreak ...chatHelpers_useTimeoutLevel ...MarkdownLinkInner_message } fragment MarkdownLinkInner_message on Message { messageId } fragment MessageFeedbackOtherModal_message on Message { id messageId } fragment MessageFeedbackReasonModal_message on Message { id messageId } fragment chatHelpers_isBotMessage on Message { ...chatHelpers_isHumanMessage ...chatHelpers_isChatBreak } fragment chatHelpers_isChatBreak on Message { author } fragment chatHelpers_isHumanMessage on Message { author } fragment chatHelpers_useTimeoutLevel on Message { id state text messageId } ================================================ FILE: src/app/bots/poe/graphql/SendMessageMutation.graphql ================================================ mutation chatHelpers_sendMessageMutation_Mutation( $chatId: BigInt! $bot: String! $query: String! $source: MessageSource $withChatBreak: Boolean! ) { messageEdgeCreate(chatId: $chatId, bot: $bot, query: $query, source: $source, withChatBreak: $withChatBreak) { chatBreak { cursor node { id messageId text author suggestedReplies creationTime state } id } message { cursor node { id messageId text author suggestedReplies creationTime state chat { shouldShowDisclaimer id } } id } } } ================================================ FILE: src/app/bots/poe/graphql/SubscriptionsMutation.graphql ================================================ mutation subscriptionsMutation($subscriptions: [AutoSubscriptionQuery!]!) { autoSubscribe(subscriptions: $subscriptions) { viewer { id } } } ================================================ FILE: src/app/bots/poe/graphql/ViewerStateUpdatedSubscription.graphql ================================================ subscription viewerStateUpdated { viewerStateUpdated { id ...ChatPageBotSwitcher_viewer } } fragment BotHeader_bot on Bot { displayName messageLimit { dailyLimit } ...BotImage_bot } fragment BotImage_bot on Bot { image { __typename ... on LocalBotImage { localName } ... on UrlBotImage { url } } displayName } fragment BotLink_bot on Bot { displayName } fragment ChatPageBotSwitcher_viewer on Viewer { availableBots { id messageLimit { dailyLimit } ...BotLink_bot ...BotHeader_bot } allowUserCreatedBots: booleanGate(gateName: "enable_user_created_bots") } ================================================ FILE: src/app/bots/poe/index.ts ================================================ import { t } from 'i18next' import WebSocketAsPromised from 'websocket-as-promised' import { requestHostPermission } from '~app/utils/permissions' import { PoeClaudeModel, PoeGPTModel } from '~services/user-config' import { ChatError, ErrorCode } from '~utils/errors' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { GRAPHQL_QUERIES, PoeSettings, getChatId, getPoeSettings, gqlRequest } from './api' interface ChatMessage { id: string author: string text: string state: 'complete' | 'incomplete' messageId: number } interface WebsocketMessage { message_type: 'subscriptionUpdate' payload: { subscription_name: 'messageAdded' unique_id: string data: { messageAdded: ChatMessage } } } interface ConversationContext { poeSettings: PoeSettings chatId: number // user specific chat id for the bot wsp: WebSocketAsPromised minMessageId?: number } export class PoeWebBot extends AbstractBot { private conversationContext?: ConversationContext constructor(public botId: string) { super() } async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermission('https://*.poe.com/'))) { throw new ChatError('Missing poe.com permission', ErrorCode.MISSING_POE_HOST_PERMISSION) } if (!this.conversationContext) { console.log('Using poe model', this.botId) const { poeSettings, chatId } = await this.getChatInfo() const wsp = await this.connectWebsocket(poeSettings) await this.subscribe(poeSettings) this.conversationContext = { chatId, poeSettings, wsp } await this.sendChatBreak().catch(console.error) } const wsp = this.conversationContext.wsp const onUnpackedMessageListener = (data: any) => { const messages: WebsocketMessage[] = data.messages.map((s: string) => JSON.parse(s)) for (const m of messages) { if (m.message_type === 'subscriptionUpdate' && m.payload.subscription_name === 'messageAdded') { const chatMessage = m.payload.data.messageAdded console.debug('poe ws chat message', chatMessage) if (chatMessage.author !== this.botId) { continue } if ( this.conversationContext?.minMessageId && chatMessage.messageId <= this.conversationContext.minMessageId ) { continue } params.onEvent({ type: 'UPDATE_ANSWER', data: { text: chatMessage.text.trimStart() }, }) if (chatMessage.state === 'complete') { this.conversationContext!.minMessageId = chatMessage.messageId params.onEvent({ type: 'DONE' }) wsp.removeAllListeners() } } } } wsp.onUnpackedMessage.addListener(onUnpackedMessageListener) wsp.onError.addListener(console.error) try { await wsp.open() } catch (e) { console.error('poe ws open error', e) throw new ChatError('Failed to establish websocket connection.', ErrorCode.NETWORK_ERROR) } try { await this.sendMessageRequest(params.prompt) } catch (err) { wsp.removeAllListeners() wsp.close() throw err } } resetConversation() { if (!this.conversationContext) { return } const wsp = this.conversationContext.wsp wsp.removeAllListeners() wsp.close() this.sendChatBreak() this.conversationContext = undefined } private async getChatInfo() { const poeSettings = await getPoeSettings() const chatId = await getChatId(this.botId, poeSettings) return { poeSettings, chatId } } private async sendMessageRequest(message: string) { const { poeSettings, chatId } = this.conversationContext! const resp = await gqlRequest( 'SendMessageMutation', { bot: this.botId, chatId, query: message, source: null, withChatBreak: false, }, poeSettings, ) if (!resp.data) { throw new Error(JSON.stringify(resp.errors)) } if (!resp.data.messageEdgeCreate.message) { throw new ChatError(t('You’ve reached the daily free message limit for this model'), ErrorCode.POE_MESSAGE_LIMIT) } } private async sendChatBreak() { const { chatId, poeSettings } = this.conversationContext! await gqlRequest('AddMessageBreakMutation', { chatId }, poeSettings) } private async subscribe(poeSettings: PoeSettings) { await gqlRequest( 'SubscriptionsMutation', { subscriptions: [ { subscriptionName: 'messageAdded', query: GRAPHQL_QUERIES.MessageAddedSubscription, }, ], }, poeSettings, ) } private async getWebsocketUrl(poeSettings: PoeSettings) { const domain = `tch${Math.floor(Math.random() * 1000000) + 1}` const channel = poeSettings.tchannelData return `wss://${domain}.tch.${channel.baseHost}/up/${channel.boxName}/updates?min_seq=${channel.minSeq}&channel=${channel.channel}&hash=${channel.channelHash}` } private async connectWebsocket(poeSettings: PoeSettings) { const wsUrl = await this.getWebsocketUrl(poeSettings) console.debug('ws url', wsUrl) const wsp = new WebSocketAsPromised(wsUrl, { packMessage: (data) => JSON.stringify(data), unpackMessage: (data) => JSON.parse(data as string), }) return wsp } get name() { if (this.botId === PoeGPTModel['GPT-3.5']) { return 'ChatGPT (poe/gpt-3.5)' } if (this.botId === PoeGPTModel['GPT-4']) { return 'ChatGPT (poe/gpt-4)' } if (this.botId === PoeClaudeModel['claude-instant']) { return 'Claude (poe/claude-instant)' } if (this.botId === PoeClaudeModel['claude-instant-100k']) { return 'Claude (poe/claude-100k)' } if (this.botId === PoeClaudeModel['claude-2-100k']) { return 'Claude (poe/claude-2-100k)' } } } ================================================ FILE: src/app/bots/qianwen/api.ts ================================================ import { ofetch } from 'ofetch' import { ChatError, ErrorCode } from '~utils/errors' interface CreationResponse { data: { sessionId: string } success: boolean errorMsg: string | null errorCode: string | null } export async function createConversation(firstQuery: string, csrfToken: string) { const resp = await ofetch('https://qianwen.aliyun.com/addSession', { method: 'POST', body: { firstQuery, sessionType: 'text_chat', }, headers: { 'X-Platform': 'pc_tongyi', 'X-Xsrf-Token': csrfToken, }, }) if (!resp.success) { if (resp.errorCode === '4000') { throw new ChatError('请先登录通义千问账号', ErrorCode.QIANWEN_WEB_UNAUTHORIZED) } throw new Error(`Error: ${resp.errorCode} ${resp.errorMsg}`) } return resp.data.sessionId } function extractVariable(variableName: string, html: string) { const regex = new RegExp(`${variableName}\\s?=\\s?"([^"]+)"`) const match = regex.exec(html) if (!match) { throw new Error('Failed to get csrfToken') } return match[1] } export async function getCsrfToken() { const html = await ofetch('https://tongyi.aliyun.com/qianwen/', { parseResponse: (t) => t }) return extractVariable('csrfToken', html) } ================================================ FILE: src/app/bots/qianwen/index.ts ================================================ import { requestHostPermissions } from '~app/utils/permissions' import { uuid } from '~utils' import { ChatError, ErrorCode } from '~utils/errors' import { parseSSEResponse } from '~utils/sse' import { AbstractBot, SendMessageParams } from '../abstract-bot' import { createConversation, getCsrfToken } from './api' function generateMessageId() { return uuid().replace(/-/g, '') } interface ConversationContext { conversationId: string csrfToken: string lastMessageId?: string } export class QianwenWebBot extends AbstractBot { private conversationContext?: ConversationContext async doSendMessage(params: SendMessageParams) { if (!(await requestHostPermissions(['https://qianwen.aliyun.com/', 'https://tongyi.aliyun.com/']))) { throw new ChatError('Missing qianwen.aliyun.com permission', ErrorCode.MISSING_HOST_PERMISSION) } if (!this.conversationContext) { const csrfToken = await getCsrfToken() const conversationId = await createConversation(params.prompt, csrfToken) this.conversationContext = { conversationId, csrfToken } } const resp = await fetch('https://qianwen.aliyun.com/conversation', { method: 'POST', signal: params.signal, headers: { 'Content-Type': 'application/json', 'X-Platform': 'pc_tongyi', 'X-Xsrf-Token': this.conversationContext.csrfToken, }, body: JSON.stringify({ action: 'next', msgId: generateMessageId(), parentMsgId: this.conversationContext.lastMessageId || '0', contents: [{ contentType: 'text', content: params.prompt }], sessionId: this.conversationContext.conversationId, sessionType: 'text_chat', model: '', modelType: '', openSearch: true, timeout: 120, }), }) let done = false await parseSSEResponse(resp, (message) => { console.debug('qianwen sse', message) const data = JSON.parse(message) const text = data.content[0] if (text) { params.onEvent({ type: 'UPDATE_ANSWER', data: { text } }) } if (data.stopReason === 'stop') { this.conversationContext!.lastMessageId = data.msgId done = true params.onEvent({ type: 'DONE' }) } }) if (!done) { params.onEvent({ type: 'DONE' }) } } resetConversation() { this.conversationContext = undefined } get name() { return '通义千问' } } ================================================ FILE: src/app/bots/xunfei/api.ts ================================================ import { ofetch } from 'ofetch' import './geeguard' import { ChatError, ErrorCode } from '~utils/errors' export async function getGeeToken(): Promise { const resp: string = await ofetch('https://riskct.geetest.com/g2/api/v1/pre_load?client_type=web') const config = JSON.parse(resp.slice(1, -1)) console.debug('GeeGuard config:', config) const token = await (window as any).GeeGuard.load({ appId: 'ihuqg3dmuzcr2kmghumvivsk7c3l4joe', js: config.data.js, staticPath: config.data.static_path, gToken: config.data.g_token, type: 'gt', }) return token.gee_token } export async function createConversation() { const resp = await ofetch('https://xinghuo.xfyun.cn/iflygpt/u/chat-list/v1/create-chat-list', { method: 'POST', body: {}, }) if (resp.code === 80000) { throw new ChatError('请先登录讯飞账号', ErrorCode.XUNFEI_UNAUTHORIZED) } if (resp.code !== 0) { throw new Error(`Failed to create conversation: ${resp.desc}`) } return { chatId: resp.data.id as number, } } ================================================ FILE: src/app/bots/xunfei/geeguard.js ================================================ _MNVo.$_Aq=function(){var $_BDGR=2;for(;$_BDGR!==1;){switch($_BDGR){case 2:return{$_BDHO:function($_BDIz){var $_BDJb=2;for(;$_BDJb!==14;){switch($_BDJb){case 5:$_BDJb=$_BEAm<$_BEBW.length?4:7;break;case 2:var $_BECR='',$_BEBW=decodeURI('%15P%0EY!7$%5D%0AZ3%0C%14G%00h5=%03L=X8%259X%10e2&.X%0ES3;%06A%06h\'=%14%5C%17_8%3C9V%0BW%25%11%08Q%06w#%0C%15P%07C479G%06X37%15P%07t%224%01P%11h%107%09P%11W#=%15%15%0AEw3%0BG%06W3+GP%1BS4\'%13%5C%0DQy%0C%20Z%0CQ;79%5E%06O$%0C%06E%13Z.%0C%10P%01%5D%3E&3P%0EF8%20%06G%1Ae#=%15T%04S%096%08%5B%06h;3%05P%0Fh\'=%17k%14S59%0EA1S$=%0BC%06z81%06Y%25_;74L%10B2?2g/h%14%014e%11_:;%13%5C%15S%013%0B@%06h4=%0AE%0FS#79%5C%0EF8%20%13T%0DB%09=%05_%06U#%0C%14A%02X33%0BZ%0DS%09&%0FP%0Dh4%20%02T%17S%12%3E%02X%06X#%0C%13G%1AE%09%10%06A%17S%25+*T%0DW07%15k%0CF$%0C%14T%0DEz!%02G%0APz&%0F%5C%0Dh#:%15Z%14h:!*T%1Bb8\'%04%5D3Y%3E%3C%13F=@2%3C%03Z%11h:=%09Z%10F61%02k%0CX07%14A%16D27%09Q=Q2&4A%0CD65%02%60%13R6&%02F=a20,%5C%17%7B26%0ET(S.!9W%11S699F%17W#79F%02P6%20%0Ek%14S59%0EA0F27%04%5D$D6?%0AT%11h#=%17k%17Y%04&%15%5C%0DQ%096%08V%16%5B2%3C%13k%0EE%07=%0E%5B%17S%25%17%09T%01Z269A%0A%5B2=%12A=Z24%13k%0DC:0%02G=%5B$%1B%09Q%06N26#w=Y9%3E%08T%07h%137%11%5C%00S%1A=%13%5C%0CX%12$%02%5B%17h\'\'%14%5D=%5B%3E%3C9E%02D2%3C%13%7B%0CR2%0C%14P%17f%25=%17P%11B.%0C%01%5C%0FB2%209T%01E8%3E%12A%06h%09!%02%5B%17h%16%22%17Y%06f6+%22G%11Y%25%0C%0BP%0DQ#:9%5B%06N#%0C%01@%0DU#;%08%5B=E6%3C%14%18%10S%25;%01k%10D46%08V=w\'%22%0BP=%5B2!%14T%04S%090%0E%5B%07h%257%06Q%1Ae#3%13P=Y91%08X%13Z2&%02k%07_$%22%0BT%1Ah%207%05%5E%0AB%1A7%03%5C%02e#%20%02T%0Eh$&%06G%17d2%3C%03P%11_959E%11Y#=%13L%13S%09!%02G%0AP%09bW%05S%06gbWk%00Y91%06A=X6?%02k%00Y9&%02%5B%17a%3E%3C%03Z%14h6%22%17P%0DR%14:%0EY%07h%3E&%02G%02B8%209v%0CC9&%02G=D%22%3C%09%5C%0DQ%09!%0B%5C%00S%093%0BY=A20%0C%5C%17f2%20%14%5C%10B2%3C%13f%17Y%253%00P=D2&%12G%0Dh$&%1EY%06h?;%03Q%06X%09$%06Y%16S%09!%12F%13S96%02Q=%06%09%1F4v0e%1A3%13G%0AN%091%06Y%0Fh%3E4%15T%0ES%09;%09Q%06N%1849W%0FY499T%01Y%22&%5DW%0FW999Z%0DS%25%20%08G=@%3E!%0EW%0AZ%3E&%1Ek%22d%19%1DGe1y%09(%08Z%0Eh%1F3%02A%17S9!%04%5D%14S%3E%3E%02G=%1E%3E%3C%11P%11B26JV%0CZ8%20%14%0FCh$+%14A%06%5Bz\'%0Ek%25D6%3C%0CY%0AXw%15%08A%0B_4%0C%06C%02_;%1E%02S%17h%16$%06%5B%17q6%20%03PCt%3Cr%25a=c9;%11P%11Ew%11%22%15V%03w%1F%02Q%0AC:%0C%14Z%0ES%09%14%12A%16D6r%25%5ECt%03%0C&G%0AW;r2%5B%0AU86%02%15.e%09?%14s%16Z;!%04G%06S9%17%0BP%0ES9&9w%0AB$&%15P%02%5Bw%04%02G%02%16%043%09FC%7B8%3C%08k%0BS%3E5%0FA=W!3%0EY4_3&%0Fk%14S59%0EA7S/&4%5C%19S%166%0D@%10B%09%04%15%5C%0DR6%0C$P%0DB%22%20%1E%15$Y#:%0EV=A20%0C%5C%17s/;%13s%16Z;!%04G%06S9%0C%25T%0D%5D%10=%13%5D%0AUw%1F%03%15!b%09%20%02F%06B%09?%06A%00%5E2!9x0%16%18\'%13Y%0CY%3C%0C*fCc%1Er%20Z%17%5E%3E19P%1B_#%14%12Y%0FE4%20%02P%0Dh1=%09A0_-79S%0CX#%14%06X%0AZ.%0C%5B%14%07Y4&%1EE%06%16?&%0AY%5D%0A?&%0AY%5D%0A?7%06Q%5D%0A:7%13TCX6?%02%08A@%3E7%10E%0CD#pGV%0CX#7%09A%5E%14%20;%03A%0B%0B37%11%5C%00Sz%25%0EQ%17%5E%7Br%0E%5B%0AB%3E3%0B%18%10U6%3E%02%08R%14i%0C%0AZ%19p%22%3E%0Bf%00D27%09p%0FS:7%09A=t6&%06%5B%04h%1B7%02Y%02A66%02P=%11%7B%0COQ%1AX6?%0EVND6%3C%00PY%16%09%7F%06E%13Z2%7F%14L%10B2?JW%0CR.%0C$P%0DB%22%20%1Ek%17Y%133%13T6d%1B%0CS%0D%13N%09%1F%0E%5B%0AY9r7G%0Ch%20;%03A%0Bh%7F%22%15P%05S%25!JV%0CX#%20%06F%17%0Cw%0C+P%17B2%20Gr%0CB?;%04k+S;$%02A%0AU6r)P%16S%09%13%15T%01_4r3L%13S$7%13A%0AX0%0C%08S%05E2&0%5C%07B?%0C&R%06X4+Gs!h%12%075z0b%1E%1E%22k%14Y%2569B%06T%3C;%13s%16Z;!%04G%06S9%17%0BP%0ES9&9x%02D;7%13A=W!3%0EY7Y\'%0C$Y%02D2%3C%03Z%0Dh%7F4%08G%00S3%7F%04Z%0FY%25!%5D%15=%7B%03r%22M%17D6%0C%17M=e2%20%0ES%02hw%0C3g%22%7C%16%1CGe1y%09z%17G%06P2%20%14%18%11S3\'%04P%07%1B:=%13%5C%0CXmr9x%06_%25+%08%156%7F%09&%02M%17u8%3C%13P%0DB%09%1E%12V%0AR6r%25G%0AQ?&9_%0C_9%0C*%5C%00D8!%08S%17%16%02;%00%5D%16D%09%01$g*f%03%1B)t=z%221%0EQ%02%16%043%09F=%5B:%1F%10b/Z%3E%1BWzE%07%096%02C%0AU2%02%0EM%06Z%053%13%5C%0Ch%10;%0BYCe6%3C%14k.ew%00%02S%06D2%3C%04PCe\'7%04%5C%02Z#+9f%0A%5B%1F7%0Ek%0EY-%11%06%5B%00S;%14%12Y%0Fe4%20%02P%0Dh%10%1D3%7D%22%7B%09&%02M%17e%3E(%02t%07%5C%22!%13k%05C;%3E%14V%11S2%3C%22Y%06%5B2%3C%13k+C:3%09F%17%03ecGw7h3;%11k3D%3E!%13%5C%0DW%09%02*%5C%0DQ%1B;2k.Y9=%13L%13Sw%11%08G%10_!39%7D&z%01%0C4X%02Z;r!Z%0DB$%0C%0AF&N%3E&!@%0FZ$1%15P%06X%09%1F4%15._91%0FZ=X8%3C%02k9a%166%08W%06p%09%1E%02C%06X%3E?Gx7h:3%17kDhf%22%1Fk%25C#\'%15TC%7B3r%25a=E\'3%09k%20W;;%05G%0Ah84%01F%06B%1F7%0ER%0BB%09%01%02R%0CSw%07.%15/_0:%13k.o%05%1B&qCf%05%1D9%1C=e#3%04V%02B8%60U%07Ct%03%0C%06C%02_;%1A%02%5C%04%5E#%0C*P%0DZ8%0C%0AX.A%00%1E%0B%5C*%061;%01Y,%10f%0C%01Z%0DB%09:%06G%07A6%20%02v%0CX4\'%15G%06X4+9q,%7B%057%04A/_$&9x%06R%3E34P%17B%3E%3C%00F1W95%02k%17_:7=Z%0DS%094%15P%12C2%3C%04L=Q2&%25Z%16X3;%09R%20Z%3E7%09A1S4&9R%0FY53%0Bv%0C%5B\'=%14%5C%17S%18%22%02G%02B%3E=%09k.S3;%06f%0CC%251%02k%00D23%13P,E4;%0BY%02B8%209x0e#%20%02T%0Eh%207%05%5E%0AB%184%01Y%0AX2%13%12Q%0AY%14=%09A%06N#%0C%05P%04_9%02%06A%0Bh$7%14F%0AY9%01%13Z%11W079B%06T%3C;%13g%06G%227%14A%25C;%3E%14V%11S2%3C9%7C%0DB;%0C%0C%5B%06S%09%60%03k%00D23%13P\'O93%0A%5C%00E%14=%0AE%11S$!%08G=Z6%3C%00@%02Q2%0C%15P%0FS6!%02k@%06ak9%5C%10f8;%09A*X%073%13%5D=_$%13%15G%02O%09!%04G%06S9%0C%01%5C%0FZ%057%04A=U\'\'$Y%02E$%0C%08F%00F%22%0C%14E%0F_#%0CDSZU%09%02.kHht%60%01S=%5B$%01%06C%06t;=%05k%10O$&%02X/W95%12T%04S%09!%13G%0AX0%0CKk.W4%1B%09A%06Z%095%02A%20Y9&%02M%17h$\'%05T%11D6+9V%02X!3%14k%07S!;%04P.S:=%15L=W%2519g%06P;7%04A=Z81%06Y0B8%20%06R%06h%253%13%5C%0Ch$&%06G%17h;3%09R%16W07%14k%10Y%25&9%607u%09&%15%5C%02X0%3E%02k%06@2%3C%08Q%07h37%14V%11_\'&%0EZ%0Dh43%13V%0Bh%20:%0EA%06e\'3%04P=%5B%22%3E%13%5C%13Z.%0C%04Y%0CE2%02%06A%0Bh4=%0BZ%11r2%22%13%5D=B2*%13w%02E2%3E%0E%5B%06h%0C=%05_%06U#r5P%05Z21%13h=C$7%15y%02X0\'%06R%06h%3E%02%06Q=P%3E%3E%0Bf%17O;79X%02N%09%22%0B@%04_9!9%5B%0CA%253%17k%00Y9%3C%02V%17h%184%01Y%0AX2%13%12Q%0AY%14=%09A%06N#%0C%15P%15S%25!%02k%04S#%14%12Y%0Fo23%15k@Pab9n%0CT=7%04AC%7F9&%0Bh=D8\'%09Q=Q2&3%5C%0ES-=%09P,P1!%02A=r6&%02a%0A%5B2%14%08G%0EW#%0C%17Y%02B1=%15X=D21%13k%0Af?=%09P=T%25%0C%00P%17u?3%09%5B%06Z%133%13T=R2!%13%5C%0DW#;%08%5B=Y\'7%09q%02B60%06F%06h%05%06$e%06S%25%11%08%5B%0DS4&%0EZ%0D%7F47%22C%06X#%0C%0AF4D%3E&%02e%11Y1;%0BP%11%7B6%20%0Ck%01D8%25%14P%11z6%3C%00@%02Q2%0C%01%5C%0FZ%09=%09A%11W9!%0EA%0AY91%06%5B%00S;%0C%0E%5B%07S/7%03q!h%05%06$p%0DU86%02Q%22C3;%08s%11W:79%16%05Pe%0C%0AF/W%22%3C%04%5D6D%3E%0C%06A%17W499F%16P1;%1FP%10h#:%15P%10%5E8%3E%03k%11S$=%0BC%06R%18%22%13%5C%0CX$%0C%06W%10h6%3E%17%5D%02T2&%0EV=B.%22%02k0%60%10%15%02Z%0ES#%20%1Ep%0FS:7%09A=%151%60%01k%11W96%08X=P8%20%04P%07h4:%06G%22B%09=%17G%17h$;%09%5D=Q2&7T%11W:7%13P%11h2%229%11%3Cs%22%0C%0BZ%14hs%0D!Q=S/%229%11%3C~%04%0C2%7B.w%04%19%22q%3Cd%12%1C#p1s%05%0D0p!q%1B%0C0p!q%1B%0D%03P%01C0%0D%15P%0DR2%20%02G%3C_94%08k%0AX97%15k6x%1A%134~&r%08%04%22%7B\'y%05%0D0p!q%1B%0CVk%02B6%3C%0FkQh059T%07R%3E&%0EZ%0Dh;=%00%04%13h6&%06%5B=U8=%0C%5C%06h4=%08%5E%0AS#7%14A%5E%07lr4T%0ES%04;%13P%5Ee#%20%0EV%17%0D%094%15Z%0Eu?3%15v%0CR2%0C%04G%06W#79D%16S%25+9X%02N%03=%12V%0Bf8;%09A%10h%180%0DP%00Bw%22%15Z%17Y#+%17PC%5B6+GZ%0DZ.r%05PCW9r(W%09S4&%5D%15=%0B%09c_E%17%16%16%20%0ET%0Fh%08%0D%1EW=C4%25%02W=%5B%3E6%03Y%06h4:%15Z%0ES%09%0D8R%20D%007%05k%00D23%13P&@2%3C%13k%06%5B\'&%1Ek%06D%25=%15k%0DYz%22%15P%05S%257%09V%06h%08%0D%01%5C%11S1=%1Fj%3Ch:=%15P=E%3E%3C9B%06T%3C;%13k8Y58%02V%17%16%180%0DP%00B%0A%0C%00A%3CZ81%06Y%3C_3%0COX%0AXz?%08%5B%0CU?%20%08X%06%0CwbNk%0CX#=%12V%0BE#3%15A=%12%08%150k%02U8!%0Fk%3Ci26%00P7D61%0C%5C%0DQ%07%20%02C%06X#;%08%5B0B6&%0EF%17_4!9R%06B%12*%13P%0DE%3E=%09k%11Q53O%04S%04%7BrU%05W%1AwbK%15S%18e%7B9a%0CYw:%0ER%0B%16!3%0B@%06h$#%15A=A20%00YQh%03:%0EFCT%25=%10F%06Dp!G%5C%0EF;7%0AP%0DB6&%0EZ%0D%1684Gz%01%5C21%13%1B%00D23%13PC_$r%06%15%10%5E%3E?GT%0DRw6%08P%10Xp&GF%16F\'=%15AC%119\'%0BYD%166!GA%0BSw4%0EG%10Bw3%15R%16%5B2%3C%13%1B=c%14%01%0FP%0FZ%1D3%11T=U8=%0C%5C%06B2!%13%08=E#3%09Q%02D3%0C%17@%05P%3E%3C#P%15_479S%0AZ;%06%02M%17h;7%14F=%5E%3E5%0Fk%00Y89%0EP%17S$&Z%04X%16%043%0AP0_#7Zf%17D%3E1%13%0ECS/%22%0EG%06Ej%06%0F@O%16gcJ%7F%02Xzc%5E%02S%16gb%5D%05S%0CgcGr.b%093%14%5C%0D%5E%091%08F=D21U%05Q%06%09z%0AT%1B%1B:=%09Z%00%5E%25=%0APY%16%09%7F9%04RF#rEa%0A%5B2!G%7B%06Aw%00%08X%02Xu%0C8R%00B%09&%06%5B=i%08+%05G%0Ch;3%14A5W;%0C%04Z%10%5E%09=%12A%10_379%5E%15O1%0C%0E%5B%15S%25&%02Q=F8%259T%10_9%0C%02M%13%5Bf%0C3%5D%0AEw0%15Z%14E2%20@FC_:%22%0BP%0ES9&%06A%0AY9r%08SCy58%02V%17%184%20%02T%17Sw;%14%15%02%16$:%0EXCW96GQ%0CS$%3C@ACE%22%22%17Z%11Bw3GF%06U8%3C%03%15%02D0\'%0AP%0DBy%0C%06V%17_!79a%0CC4:%22C%06X#%0C%14T%0EE%22%3C%00t%11h;=%00k%02U8!9j%3CU%25%05%02W=Z6%3C%00k%10C5!%13G%0AX0%0C%14G%04T%09%7FJk%0EC;&%0EE%0F_43%13%5C%0CX%09%22Tk%1AW96%02M=B6%3C%0Fk%20A:r%01_%0CD30%06%5B%08%160%3E%1E%15=%1E4=%0BZ%11%1B03%0A@%17%0Cw%0C%04Z%0DB6;%09F=%5C%09%119O=d%09v8%7C*h8%3C%14@%00U2!%14kWh%0E%0C3k/h\'%0C%20k%00D23%13P,T=7%04A0B8%20%02k%06hs%0D-x=e%09v8w\'Y%09$9M=_96%02M%07T%09%20%02F%16Z#%0C(kTh%06%0C%14k%16E2%20&R%06X#%0C%12k%07T%133%13T=G%09v8w!%7F%09!%02A=%12%08%10$%7D=c%09%169%03=f%0969t=Y9\'%17R%11W37%09P%06R269p=P%09%0A9@%0DR24%0E%5B%06R%097%1FP%00C#74D%0Fh%01%0CCj!w8%0C%15Z%14E%09%259B%0AX3=%10%7B%02%5B2%0C.%7B0s%05%06Gz1%16%05%177y%22u%12r.%7B7yw1%06V%0BS%7F%3C%06X%06%1Aw$%06Y%16S~r1t/c%12%01O%0AO%16h%7B9%5B=x%09%3E%0EF%17E%09g9%5B%16Z;%0C%0EkZh4%0C%0Bk%04h$7%14F%0AY9%0C_k%07W#3%05T%10S%09;%13P%0Eh%057%03@%00Sw=%01%15%06%5B\'&%1E%15%02D%253%1E%15%14_#:G%5B%0C%16%3E%3C%0EA%0AW;r%11T%0FC2%0C%15k*h%11%0C%08E%06X%0909%5E=X6$%0ER%02B8%209w=w%25%20%06LMF%25=%13Z%17O\'7IG%06R%221%02%15%00W;%3E%02QCY9r%09@%0FZw=%15%15%16X37%01%5C%0DS3%0C%08W%09S4&4A%0CD2%0C%1Ek%17h%207%05%5E%0AB%1E%3C%03P%1BS3%16%25kPh#3%15R%06B%09%115p%22b%12r3t!z%12r.sCx%18%06Gp;%7F%04%064%15%00W4:%02%1D%0ARw%1B)a&q%12%00G%7B,bw%1C2y/%16%07%00.x%22d%0Er,p:%16%16%073z*x%14%00%22x&x%03~G%5B%02%5B2r3p;bw%1C(aCx%02%1E+%19C@6%3E%12PCb%12%0A3%15-y%03r)%60/z%7Br2%7B*g%02%17G%1D%0DW:7N%1C=%5B%09=%05_%06U#%01%13Z%11S%193%0AP%10h6%0C%13G%02X$3%04A%0AY9%0C,k%13C#%0C%0CP%1Ah%1A%0C%08k4h%0D%0C/k)hw;%14%15%0DY#r%06%15%05C91%13%5C%0CX%09&%02F%17h%04%17+p%20bw$%06Y%16Sw%145z.%1643%04%5D%06%16%00%1A%22g&%1693%0AP%5E%09%09:9X%0CL%1E%3C%03P%1BS3%16%25k-bwdI%07=x%03rQ%1BWh%197%13F%00W\'79G%06F;3%04P=x%03rQ%1BRh%257%06Q%14D%3E&%02k:W96%02M=Q2&.A%06%5B%09%1F%08W%0AZ2r4T%05W%25;9y%06X8$%08k%0AR5%16%06A%02hw%05%02W5_2%259P%0ET26%03P%07hx%0CH%01R%0F%09o%5C%15%06N\';%15P%10%0B%1A=%09%19C%04gr4P%13%16ebV%0CC%06ghW%05Y%06gr2a%20%0Dw%22%06A%0B%0BxiGQ%0C%5B6;%09%08=l20%15T=x%03rR%1BRhWRg5c6WR9F%16T$&%15k%00Y9!%08Y%06hw%00%02T%0F_#+9T%0ERaf9F%06B%1E&%02X=U;=%14P=%12fr4P%00C%257Gk%0AWd%609s%0AD24%08M=s35%02k%02D:dSk-bwgI%05=%7F%12%0C*%7C6%7Fw%0CAk-bc%7CWk,f%07%1D9R%06B%09%13%0AT%19Y9%0C%00P%17b%3E?%02kCb8\'%04%5D=n%3E3%08X%0Ah%19%06G%03M%05%09%7DVk%17W5%3E%02A=x%03rR%1BQh;=%04T%0Fe#=%15P=W%25?9v%0CUw%11%08V=u?%20%08X%06h%1B%159%1AW%07%60%0C%10P%02D60%0BP=%12fr9%1AW%07a%0C%11P%11E%3E=%09kX%162*%17%5C%11S$o3@%06%1AwaV%15\'S4rU%05W%06wbW%0FS%06mbW%156b%14iGE%02B?oH%0ECR8?%06%5C%0D%0B%09?%08Q%06Z%09%1F%0EV%11Y$=%01A=a2%11%0FT%17h%16%00*k%17Y%02%22%17P%11u6!%02kL%05%09%1C3%15U%18g%0C%13Z/Y%207%15v%02E2%0CGs%0CU%22!9F%0EW%25&%13C=~%223%10P%0Ah%113%04P%01Y899%60%20h%04=%09L=%16%1F7%06Q%0FS$!9~%0CX&\'%02G%0CD%09%10%0BT%00%5D%157%15G%1Ah%19%06G%04S%18g%0CS%1BZ%06%09%05%02v%0BW#z0%5C%0D%1Fw%16%02F%08B8%229%7B7%05ygVkC%16wrG%15C%16%097%1FP%00h%10%01&k1S6%3E%0AP=%16%14=%06F%17h#3%15R%06B%13=%0AT%0AX%093%15V%0B_#7%04A%16D2%0C%02%5B%00D.%22%13kL%0E%09!%17T%11U%09%13%09Q%11Y%3E6Gk.Y#=%15Z%0FW%09%01%06X%10C959%15._9;9%06U%06w%0C1%5C%15Y%09%1D%17P%11W%09?%08W%0AZ2%0CXkL%02f%609w%11Y%20!%02G=W%25?%0FS=r8%3E%17%5D%0AX%09%14%06%5C%11F?=%09P=x2*%13w%0CY%3C%0C%00P%17c%16%0C%12T=x%22%04%0EF%0AY9%0C*T%00%16%18%019p%07Q2%1A3x/h%137%0BY=F2%20%0A%5C%10E%3E=%09k*X$;%00%5B%0AW%095%02A%20f%02%0C%17%5D%02X#=%0A%7F0h%13%171%7C%20s%09%01%22y&x%1E%07*j/%7F%12%0C%03P%15_479V%13C%09cV%05=%07ybI%07=a%12%10#g*%60%12%009%7B%0C%5D%3E39R%06B%18%019F%06Z2%3C%0E@%0Eh%0D7%17A%0Ch%13%20%06R%0CXw%06%08@%00%5E%09cW%07=e.?%05%5C%02X%09%10%06G%0DS$rA%15-Y5%3E%02k%14S5%16%15%5C%15S%25%0C+C7S;%0C5Z%17Y%25%0C%05T%17B2%20%1Ek!d%18%054p1h%04:%06G%13h%12%1C%20%7C-s%09%0D9Z%10h\'7%15X%0AE$;%08%5B%10h:3%0DZ%11h%07%1A&%7B7y%1A%0D2t=%7B2;%1D@=%07fe9F%06Z2%3C%0E@%0Ez%3E79E%11Y:%22%13k.W4:4E%06S3%0CGz0h$7%13%60%22h37%09%5C%06R%09%04%02G%0AL8%3C9%5C,e%09%1A%22t\'u%1F%008e&d%1A%1B4f*y%19%019%1B=~%03%119P%0DQ%3E%3C%02k5s%05%01.z-h%0D%06%22k%20%5E%25=%0A%5C%16%5Bw%1D4k-@%3E6%0ET=w47%15k&E$7%09A%0AW;%0C%10P%01y%04%0CGa5hfbSk%04S#%00%02F%16Z#%0C(%5B%06f;\'%14k%09g%227%15L=%07fa9r%06X2%20%0EV=u%1F%008w%22b%03%175l=%608;%04P=%07fd9f%0CZ6%20%0EF=f%1F%13)a,%7B%08%025z3s%05%06.p0h%0D7%0C%5C=~%12%13#v+d%08%02+%60$%7F%19%019m%13S%25;%06%157W5%3E%02A=%07gc9V%02E#%0C%00P%17r2$%0EV%06h%18%019v3c%09%10%0B%5C%0D%5D%09%134%600hfc%5Ek0s%1B%17)%7C6%7B%08%165%7C5s%05%0C4X%02D#%061kR%06n%0C/p%22r%14%1A5j6w%095%02A&X0;%09P=T%25=%10F%06D%09%14%0EG%06%16%07:%08%5B%06%16sc9e+w%19%06(x%3Cz%16%1C%20%60%22q%12%0CCk4_96%08B%10h%12%3C%11%5C%19S9%0C4%5C%06%5B2%3C%14k0A%3E!%14k%04S#%10%15Z%14E2%209g%20w%09%133%137hfcUk%11S$%3E9G%06E%09%22%15Z%07C4&4@%01h%08!%02Y%06X%3E\'%0Ak%02C3;%08%1A%0CQ0iGV%0CR21%14%08A@8%20%05%5C%10%14%09%25%0E%5B%07Y%20%0C8j%0FW$&0T%17_%25%02%15Z%0EF#%0C8j%05N3%20%0EC%06D%08\'%09B%11W\'%22%02Q=W4%25%13F=i%084%1FQ%11_!7%15j%06@6%3E%12T%17S%093%04T%02B$%0C%06@%07_8%7D%10T%15%0Dw1%08Q%06U$oE%04Ah%3E!3L%13S%04\'%17E%0CD#7%03k%3Ci3%20%0EC%06D%08\'%09B%11W\'%22%02Q=W449X%0A%5B2%06%1EE%06E%091%06V%0BS%08%0C%06V%0EF#!9%11%3Ct%11!9T%16%5E%093%12Q%0AYx?%17P%04%0Du%0C%15P%14h6\'%03%5C%0C%19d5%17EXh\':%06%5B%17Y:%0C%06VPh%08%0D%03G%0A@2%208P%15W;\'%06A%06h%08%01%02Y%06X%3E\'%0Aj*r%12%0D5P%00Y%256%02G=U6%3C7Y%02O%03+%17P=O%2519j%3CA20%03G%0A@2%208P%15W;\'%06A%06h%08%0D%09%5C%04%5E#?%06G%06h%207%05Q%11_!7%15v%0C%5B:3%09Q=i%08!%02Y%06X%3E\'%0Aj%06@6%3E%12T%17S%095%02A,A9%02%15Z%13S%25&%1Eq%06E4%20%0EE%17Y%25%0C%01%5C%0FS93%0AP=U6%3E%0Bf%06Z2%3C%0E@%0Eh%04%06%22t/b%1F%0D7y6q%1E%1C9R%06B%16&%13G%0AT%22&%02k%10X?%0C8j%10S;7%09%5C%16%5B%08\'%09B%11W\'%22%02Q=i%08%3E%06F%17a6&%0EG%22Z2%20%13k%16X%3C%3C%08B%0Dh$&%17%5B=%5B6&%04%5D=i%08%25%02W%07D%3E$%02G%25C919P%04F%093%12Q%0AYx?%17%01Xh6\'%03%5C%0C%1963%04%0E=R%25;%11P%11h$&%02T%0FB?%1B%01G%02%5B2%0C8j%0FW$&0T%17_%25%11%08%5B%05_%25?9%0FYh61%0AEWh3%20%0EC%06Dz7%11T%0FC6&%02k%10S#%06%0EX%06Y%22&9j%3CA20%03G%0A@2%208@%0DA%253%17E%06R%094%08G&W4:9j%3CA20%03G%0A@2%208F%00D%3E%22%13j%05X%09!%09%5C%0Bh9=%13%5C%05_43%13%5C%0CX$%0C%06V%0EF%096%08V%16%5B2%3C%13p%0FS:7%09A=i\':%06%5B%17Y:%0C%06V%0CB$%0C%04T%0FZ264P%0FS9;%12X=%07eb9T%16R%3E=HS%0FW4i9T%00P#!9T%00%05#!9j4s%15%165%7C5s%05%0D%22y&%7B%08%11&v+s%096%06A%02h$&%02T%0FB?%17%15G%0CD%09v%04Q%00i6!%03_%05Z6!%12A%0CF1:%11V9z:1%01Y%3Ch61%0AT=W4?%06A%10h$7%0BP%0D_%22?JP%15W;\'%06A%06h%08%0D9T%16R%3E=9T%16R%3E=HMN%5Bc3%5Ck%20%5E%25=%0AP\'D%3E$%02G%14h61%0AEWB$%0C%14P%13h%08%0DCB%06T3%20%0EC%06D%16!%1E%5B%00s/7%04@%17Y%25%0C%06V%14h$&%02T%0FB?%02%0B@%04_9%0C8j%14S56%15%5C%15S%25%0D%14V%11_\'&8S%16X4%0CCV%0BD8?%02j%02E.%3C%04f%00D%3E%22%13%7C%0DP8%0C%02%5B%02T;7%03e%0FC0;%09k%14S56%15%5C%15S%25%0C%10P%01R%25;%11P%11%1B2$%06Y%16W#79K=U8%3C%14%5C%10B2%3C%13k%02U639V%02Z;%02%0FT%0DB8?9T%16R%3E=HX%13S0i9B%06T3%20%0EC%06Dz7%11T%0FC6&%02%18%11S$%22%08%5B%10S%093%12E=H)%0C%06V%0Ch61%0AEPhs%0D%25%7F%11hs%0D#t%08h!1%10A%10hs%0D$%7F;h47%0EY=%12%08%11%25_=E%3E5%25L%17S$%0C%02%5B%00h2%3E%04kGi%15%1B%1Dk%00_\':%02G%17S/&9%11%3Cu%1119A%0Ce#%20%0E%5B%04v%096%02S%0AX2%02%15Z%13S%25&%0EP%10h%257%03kR%06g%0C%11V%0EF#!9P%0DU%25+%17A!Z81%0Ck%15_37%08%1APQ\'%22%5Ck%02Z0=9C%0AR2=HX%13%02lr%04Z%07S4!Z%17%02@4cI%01Qsgc%22%17=A6%20%09k%10S#%13%13A%11_5\'%13P=Z%3E09%11%3Ct%1F%229%11%3Cu%1E(9C%0AR2=HB%06T:iGV%0CR21%14%08A@\'jK%15%15Y%250%0EFAh\'%20%08V%06E$%10%0BZ%00%5D%093%12Q%0AYx?%17%06Xh%20=%15Q%10hs%0D$p)h07%13e%11Y#=%13L%13S%1849V%11S6&%02p%0DU%25+%17A%0CD%09;%11kGi%14%13%20k%20y%19%01(y&h\'3%15F%06h$7%13e%11Y#=%13L%13S%1849y%02B%3E%3CVk7O\'7%22G%11Y%25hGv%1AU;;%04k%15Ud%0C%0A%5C%1B%7F9%0C%0FP%02R%09%02%0CV%10%01%09$%0EQ%06Yx=%00RX%164=%03P%00Ejp%13%5D%06Y%253Ek%07_$%22%0BT%1A%0Cw%3C%08%5B%06%0D%09%11%0EE%0BS%25%0C2A%05%0E%09$%04%5D%17E%091%0BT%0EF%09%05%08G%07w%25%20%06L=@4c9w%0FY49$%5C%13%5E2%209Q%06T%225%00P%11h!1%0AE=@4=%13F=@%3E6%02ZL%5B\'f%5C%15%00Y37%04F%5E%146$W%04M%06yb_xM%06op9%5C%0D_#%0C%0FT%10y%20%3C7G%0CF2%20%13L=@4%259T%17%16%180%0DP%00By!%02A3D8%0C%06@%07_8%7D%10P%01%5Bl%0C%25@%05P2%20%02Q!Z81%0Ct%0FQ8%20%0EA%0B%5B%09?%08Q%06h%13%17%25w6q%12%009%05S%06gbW%05S%06gbW%05S%06g%0CCj%20u#%0C%14A%02D#%06%0EX%06hs!%12E%06D%09$%04Z=S/&%02%5B%07h!1TA%10hs%0D$q%10h%15%3E%08V%08u%3E%22%0FP%11%7B86%02k&X4%20%1EE%17Y%25%0C%08V%13B%09$%04%5D=t6!%02k%15U&&%14k%15_37%08%1A%0EF25%5Ck%15_37%08%1A%12C%3E1%0CA%0A%5B2i9T%00A:&%14k%15U&%0C%06V%0EFd&%14k%15_37%08k%01Z81%0Cf%0AL2%0C%14E%0F_479%5C%0DU;\'%03P%10hs%0D#w)h44%00k-w%09v8q%20q%09%11%25v=W4%25%0Ak%15Uf&%14k%15_37%08%1A%0EF259%1AI%1Cx%0Cmk%10B61%0Ck%13W3%0C;G=j#%0C!%07=Q2&2a%20%7B8%3C%13%5D=%06gbWk%10S#%02%12W%0F_4%0CCj\'~.%0C%12%5B%10%5E%3E4%13kGi%13%170k%17Y%1D%01(%7B=Q2&2a%20e21%08%5B%07E%09%141k%0EF;%0C%01Y%0CY%25%0C%01%5C%0DW;;%1DP=Z%04:%0ES%17b8%0C(%7B&hgcU%06W%03ae_%0C%02T46%02S%04%5E%3E8%0CY%0EX8%22%16G%10B%22$%10M%1AL%09~mk)e%18%1CIF%17D%3E%3C%00%5C%05O%09;%09C\'_0;%13k%20_\':%02G3W%253%0AF=E%2203Z=w%12%019Q%11e?;%01A7Y%091%08E%1Ab8%0C4P%11_6%3E%0EO%02T;7$%5C%13%5E2%209n%3Eh%1A7%14F%02Q2r%13Z%0C%16;=%09RCP8%20Gg0w%09%0E%12k*X!3%0B%5C%07%16%05%01&%15%13C5%3E%0EVC%5D2+9X%17%04%09%14Vk%0EC;%06%08k%02%5B%09\'%0Ak%0EY3%02%08B*X#%0CW%05%20%07%12a%5E%06WrfdV%01W%00b%10T%06S%03d%17PsW%0E%12%17Sp%20%0E%60%10V%01!%0Fb%17!%0D%5B%0FceP%04Preg%22p%20t%11%14PpT%02%14e%5E%02Trg%60#vRrnfR%04%25%01n%16#%00\'%07%14cWvQ%0F%16%11%25%03%22%0F%15f#%03%25t%60%16WtS%04%60k%25%03T%07n%17V%02T%04bdRsS%0F%16%14Q%07T%01fg%5E%04Z%04ec&p%25%0Ffj%5E%0C%20w%12b_vSrajQqT%02o%10U%05%22%05abTw&%04dc_v%22%00%15%11UwV%0F%60bQ%00Z%04%16kU%04Zrg%10!%05Vun%14Q%00S%04d%13U%04\'%04daW%0DS%01egUt&%06gdQqV%0F%14%17%22s%22%03%11%60P%01%5Bs%16jWw%22toc9N=R%3E$5P%0Eb8%0C%01G%0C%5B%04&%15%5C%0DQ%09$%06Y%16S%1849q5h1%20%08X-C:0%02G=D2$%02G%17h%0B%0E9F%12C6%20%02a%0Ch%13%109X%13h,/9%04S%06gc9V%0CS149nih%25%01%0F%5C%05B%03=9R%06B%02%06$s%16Z;%0B%02T%11h97%1FA!O#7%14k%13W36%0E%5B%04h%143%09%5B%0CBw1%08%5B%15S%25&G@%0DR24%0E%5B%06Rw=%15%15%0DC;%3EGA%0C%1680%0DP%00B%096%0AERh%0B09R%06B%02%06$q%02B2%0C%5D%15=T8=%0BP%02X%095%02A6b%14%1F%0E%5B%16B2!9X%16Z#;%17Y%1Ab8%0C%3Ck%00Y9$%02G%17h07%13%607u%1F=%12G%10h1=%15X%02B%09/9q.h4=%0AE%02D2%06%08k%0AE%12$%02%5B=M%5D%0C%14D%11b8%0C%13Z1W3;%1Fk8Y58%02V%17%16%16%20%15T%1Ak%09%0EEkYh6!%14%5C%04X%09%0E%09k%05D8?.%5B%17hs%0D#q%04h;3%14A*X37%1Fk%10B%25;%09R%0AP.%0C%05%5C%17z2%3C%00A%0Bhs%0D#r%16h1%20%08X1W3;%1Fk%07Z%04:%0ES%17b8%0C:k%0EY3%0CCj%20~%1D%0CCj\'p%03%0C%09P%04W#79o&d%18%0C;S=%5B\':9Q%0Cf%220%0B%5C%00h3?%16%04=%14%09%0C9k=h%09%0C9V%0CX$&%15@%00B8%209V%00hs%0D%22q%02h;=%06Q=Q2%3C%02G%02B2%11%08Y%0FS4&9k%0CX%057%0DP%00B269B%0Dh%09%0C9k%11Y2%0C%15P%09S4&%02Q=h%22%3C%0FT%0DR;7%03G%06%5C21%13%5C%0CXw1%06A%00%5Ew7%15G%0CD%09%0C&%15%13D8?%0EF%06%1643%09%5B%0CBw0%02%15%11S$=%0BC%06Rw%25%0EA%0B%16%3E&%14P%0FPy%0C9e%11Y:;%14P=S9%0CCj\'%7F%14%0C9kGi%12%13%15k%16D;!%06S%06i2%3C%04Z%07S%09%0CG%5C%10%169=%13%15%0AB2%20%06W%0FS%7F1%06%5B%0DY#r%15P%02Rw%22%15Z%13S%25&%1E%150O:0%08YKe.?%05Z%0F%18%3E&%02G%02B8%20N%1C=f%25=%0A%5C%10Sy3%0BYCW41%02E%17Ew3%09%15%02D%253%1Ek%0CX%11\'%0BS%0AZ;7%03k%16X60%0BPCB8r%0BZ%00W#7GR%0FY53%0B%15%0CT=7%04A=q27%20@%02D3%0C7G%0C%5B%3E!%02FC%5B%22!%13%15%01Sw1%08%5B%10B%25\'%04A%06Rw$%0ETCX2%259k%14E%09&%14@=h%09%0C%08P%07h37%01%5C%0DS%07%20%08E%06D#+9T%0DW;+%14P=h37%01T%16Z#%0C7G%0C%5B%3E!%02%1B%11W47GT%00U2%22%13FCW9r%06G%11W.%0C%01@%0FP%3E%3E%0BP%07h%095%12Q=D875P%10C;&9k=Q#%0C%0E%5B%05Y%094%0E%5B%02Z;+9k=h%257%0DP%00B%09%20%08P*X1=9k%0FW-+3%5C%0ES%09%3C%08ACWw4%12%5B%00B%3E=%09k%E6%A9%82%E5%9D%A1%E5%BD%95%E5%B9%AA9kGi%12%11%1Ek%07S5\'%00R%06S%093%03Q&@2%3C%13y%0AE#7%09P%11h0%06%08%5E%06X%09%20%02F%0CZ!79R%06S%09%0CCj&t-%0C7Z%10E%3E0%0BPCc9:%06%5B%07Z26Ge%11Y:;%14PCd28%02V%17_8%3C%5Dk%11S&\'%02F%17%7F3%3E%02v%02Z;0%06V%08h2!9k=h\'%20%08X%0AE2%0C%20p&6Q%0C9G%02U2%0C9k%3Ci2!*Z%07C;79%5E%0C%5E%09v8q)g%09%0C%03P%00D.%22%13k%16X?3%09Q%0FS3%20%02_%06U#;%08%5B=h6%3E%0Bf%06B#%3E%02Q');$_BDJb=1;break;case 1:var $_BEAm=0,$_BEDp=0;$_BDJb=5;break;case 4:$_BDJb=$_BEDp===$_BDIz.length?3:9;break;case 8:$_BEAm++,$_BEDp++;$_BDJb=5;break;case 3:$_BEDp=0;$_BDJb=9;break;case 9:$_BECR+=String.fromCharCode($_BEBW.charCodeAt($_BEAm)^$_BDIz.charCodeAt($_BEDp));$_BDJb=8;break;case 7:$_BECR=$_BECR.split('^');return function($_BEEj){var $_BEFk=2;for(;$_BEFk!==1;){switch($_BEFk){case 2:return $_BECR[$_BEEj];break;}}};break;}}}('g5c6WR')};break;}}}();_MNVo.$_BY=function(){var $_BEGb=2;for(;$_BEGb!==1;){switch($_BEGb){case 2:return{$_BEHy:function $_BEIG($_BEJJ,$_BFAc){var $_BFBy=2;for(;$_BFBy!==10;){switch($_BFBy){case 4:$_BFCI[($_BFDF+$_BFAc)%$_BEJJ]=[];$_BFBy=3;break;case 13:$_BFEa-=1;$_BFBy=6;break;case 9:var $_BFFz=0;$_BFBy=8;break;case 8:$_BFBy=$_BFFz<$_BEJJ?7:11;break;case 12:$_BFFz+=1;$_BFBy=8;break;case 6:$_BFBy=$_BFEa>=0?14:12;break;case 1:var $_BFDF=0;$_BFBy=5;break;case 2:var $_BFCI=[];$_BFBy=1;break;case 3:$_BFDF+=1;$_BFBy=5;break;case 14:$_BFCI[$_BFFz][($_BFEa+$_BFAc*$_BFFz)%$_BEJJ]=$_BFCI[$_BFEa];$_BFBy=13;break;case 5:$_BFBy=$_BFDF<$_BEJJ?4:9;break;case 7:var $_BFEa=$_BEJJ-1;$_BFBy=6;break;case 11:return $_BFCI;break;}}}(20,5)};break;}}}();_MNVo.$_Cn=function(){return typeof _MNVo.$_Aq.$_BDHO==='function'?_MNVo.$_Aq.$_BDHO.apply(_MNVo.$_Aq,arguments):_MNVo.$_Aq.$_BDHO;};_MNVo.$_Dt=function(){return typeof _MNVo.$_BY.$_BEHy==='function'?_MNVo.$_BY.$_BEHy.apply(_MNVo.$_BY,arguments):_MNVo.$_BY.$_BEHy;};function _MNVo(){}!function(){var GeeGuard=function(e){function p(e,t,c,s){var $_EEN=_MNVo.$_Dt()[4][18];for(;$_EEN!==_MNVo.$_Dt()[4][17];){switch($_EEN){case _MNVo.$_Dt()[12][18]:return new(c=c||Promise)(function(n,i){function r(e){var $_EFL=_MNVo.$_Dt()[4][18];for(;$_EFL!==_MNVo.$_Dt()[8][17];){switch($_EFL){case _MNVo.$_Dt()[4][18]:try{a(s[_MNVo.$_Cn(60)](e));}catch(t){i(t);}$_EFL=_MNVo.$_Dt()[8][17];break;}}}function o(e){var $_EGb=_MNVo.$_Dt()[12][18];for(;$_EGb!==_MNVo.$_Dt()[0][17];){switch($_EGb){case _MNVo.$_Dt()[4][18]:try{a(s[_MNVo.$_Cn(29)](e));}catch(t){i(t);}$_EGb=_MNVo.$_Dt()[0][17];break;}}}function a(e){var $_EHZ=_MNVo.$_Dt()[12][18];for(;$_EHZ!==_MNVo.$_Dt()[12][16];){switch($_EHZ){case _MNVo.$_Dt()[8][18]:var t;$_EHZ=_MNVo.$_Dt()[4][17];break;case _MNVo.$_Dt()[12][17]:e[_MNVo.$_Cn(14)]?n(e[_MNVo.$_Cn(88)]):((t=e[_MNVo.$_Cn(88)])instanceof c?t:new c(function(e){e(t);}))[_MNVo.$_Cn(23)](r,o);$_EHZ=_MNVo.$_Dt()[12][16];break;}}}a((s=s[_MNVo.$_Cn(12)](e,t||[]))[_MNVo.$_Cn(60)]());});break;}}}function m(n,i){var $_EIr=_MNVo.$_Dt()[8][18];for(;$_EIr!==_MNVo.$_Dt()[4][17];){switch($_EIr){case _MNVo.$_Dt()[12][18]:var r,o,a,c={"\u006c\u0061\u0062\u0065\u006c":0,"\u0073\u0065\u006e\u0074":function(){if(1&a[0])throw a[1];return a[1];},"\u0074\u0072\u0079\u0073":[],"\u006f\u0070\u0073":[]},e={"\u006e\u0065\u0078\u0074":t(0),"\u0074\u0068\u0072\u006f\u0077":t(1),"\u0072\u0065\u0074\u0075\u0072\u006e":t(2)};return _MNVo.$_Cn(61)==typeof Symbol&&(e[Symbol[_MNVo.$_Cn(79)]]=function(){return this;}),e;function t(t){var $_EJC=_MNVo.$_Dt()[0][18];for(;$_EJC!==_MNVo.$_Dt()[12][17];){switch($_EJC){case _MNVo.$_Dt()[0][18]:return function(e){return s([t,e]);};break;}}}function s(e){var $_FAF=_MNVo.$_Dt()[4][18];for(;$_FAF!==_MNVo.$_Dt()[12][16];){switch($_FAF){case _MNVo.$_Dt()[0][18]:if(r)throw new TypeError(_MNVo.$_Cn(9));while(c)try{if(r=1,o&&(a=2&e[0]?o[_MNVo.$_Cn(85)]:e[0]?o[_MNVo.$_Cn(29)]||((a=o[_MNVo.$_Cn(85)])&&a[_MNVo.$_Cn(92)](o),0):o[_MNVo.$_Cn(60)])&&!(a=a[_MNVo.$_Cn(92)](o,e[1]))[_MNVo.$_Cn(14)])return a;switch(o=0,(e=a?[2&e[0],a[_MNVo.$_Cn(88)]]:e)[0]){case 0:case 1:a=e;break;case 4:return c[_MNVo.$_Cn(15)]++,{"\u0076\u0061\u006c\u0075\u0065":e[1],"\u0064\u006f\u006e\u0065":!1};case 5:c[_MNVo.$_Cn(15)]++,o=e[1],e=[0];continue;case 7:e=c[_MNVo.$_Cn(27)][_MNVo.$_Cn(16)](),c[_MNVo.$_Cn(25)][_MNVo.$_Cn(16)]();continue;default:if(!(a=0<(a=c[_MNVo.$_Cn(25)])[_MNVo.$_Cn(59)]&&a[a[_MNVo.$_Cn(59)]-1])&&(6===e[0]||2===e[0])){c=0;continue;}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]];break;}}}function h(e,t){var $_FGn=_MNVo.$_Dt()[8][18];for(;$_FGn!==_MNVo.$_Dt()[4][17];){switch($_FGn){case _MNVo.$_Dt()[8][18]:e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]];break;}}}function v(e,t){var $_FHE=_MNVo.$_Dt()[8][18];for(;$_FHE!==_MNVo.$_Dt()[4][17];){switch($_FHE){case _MNVo.$_Dt()[0][18]:return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:[e[1]<<(t-=32)|e[0]>>>32-t,e[0]<>>32-t];break;}}}function w(e,t){var $_FIr=_MNVo.$_Dt()[0][18];for(;$_FIr!==_MNVo.$_Dt()[4][17];){switch($_FIr){case _MNVo.$_Dt()[4][18]:return 0===(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=g(e=h(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=g(e=h(e,[3301882366,444984403]),[0,e[0]>>>1]);break;}}}function r(e,t){var $_GBn=_MNVo.$_Dt()[12][18];for(;$_GBn!==_MNVo.$_Dt()[12][16];){switch($_GBn){case _MNVo.$_Dt()[12][18]:for(var n=(e=e||_MNVo.$_Cn(56))[_MNVo.$_Cn(59)]%16,i=e[_MNVo.$_Cn(59)]-n,r=[0,t=t||0],o=[0,t],a=[0,0],c=[0,0],s=[2277735313,289559509],u=[1291169091,658871167],l=0;l>>0)[_MNVo.$_Cn(41)](16))[_MNVo.$_Cn(82)](-8)+(_MNVo.$_Cn(74)+(r[1]>>>0)[_MNVo.$_Cn(41)](16))[_MNVo.$_Cn(82)](-8)+(_MNVo.$_Cn(74)+(o[0]>>>0)[_MNVo.$_Cn(41)](16))[_MNVo.$_Cn(82)](-8)+(_MNVo.$_Cn(74)+(o[1]>>>0)[_MNVo.$_Cn(41)](16))[_MNVo.$_Cn(82)](-8);break;}}}function n(e,t){var $_GCs=_MNVo.$_Dt()[4][18];for(;$_GCs!==_MNVo.$_Dt()[8][17];){switch($_GCs){case _MNVo.$_Dt()[0][18]:return!function(e,t){for(var n=0,i=e[_MNVo.$_Cn(59)];n>>0,r=0;if(2<=arguments[_MNVo.$_Cn(59)])t=arguments[1];else{while(ro&&(o=s[c],a=c);}t&&0!==a?this[_MNVo.$_Cn(431)](e,a,n):n(this[_MNVo.$_Cn(430)]=a);},"\u0064\u0061\u0074\u0061\u0062\u0061\u0073\u0065":function(t,n,i){try{var e,r=this;window[_MNVo.$_Cn(281)]?(e=window[_MNVo.$_Cn(281)](r[_MNVo.$_Cn(76)],_MNVo.$_Cn(56),r[_MNVo.$_Cn(76)],1048576),n!==undefined?e[_MNVo.$_Cn(485)](function(e){e[_MNVo.$_Cn(444)](_MNVo.$_Cn(481),[],function(){},function(){}),e[_MNVo.$_Cn(444)](_MNVo.$_Cn(450),[t,n],function(){i();},function(){i();});}):e[_MNVo.$_Cn(485)](function(e){e[_MNVo.$_Cn(444)](_MNVo.$_Cn(497),[t],function(e,t){1<=t[_MNVo.$_Cn(447)][_MNVo.$_Cn(59)]?r[_MNVo.$_Cn(446)][_MNVo.$_Cn(428)]=t[_MNVo.$_Cn(447)][_MNVo.$_Cn(464)](0)[_MNVo.$_Cn(88)]:r[_MNVo.$_Cn(446)][_MNVo.$_Cn(428)]=_MNVo.$_Cn(56),i();},function(){i();});})):i();}catch(o){i();}},"\u0069\u006e\u0064\u0065\u0078\u0064\u0062":function(n,t,i){try{var e,r=this;_MNVo.$_Cn(287)in window||(indexedDB=window[_MNVo.$_Cn(287)]||window[_MNVo.$_Cn(499)]||window[_MNVo.$_Cn(478)]||window[_MNVo.$_Cn(47)]),indexedDB?((e=indexedDB[_MNVo.$_Cn(469)](r[_MNVo.$_Cn(76)],1))[_MNVo.$_Cn(97)]=function(){i();},e[_MNVo.$_Cn(439)]=function(e){(e[_MNVo.$_Cn(480)]&&e[_MNVo.$_Cn(480)][_MNVo.$_Cn(421)])[_MNVo.$_Cn(413)](r[_MNVo.$_Cn(76)],{"\u006b\u0065\u0079\u0050\u0061\u0074\u0068":_MNVo.$_Cn(76),"\u0075\u006e\u0069\u0071\u0075\u0065":!1}),i();},t!==undefined?e[_MNVo.$_Cn(406)]=function(e){e=e[_MNVo.$_Cn(480)][_MNVo.$_Cn(421)];e[_MNVo.$_Cn(483)][_MNVo.$_Cn(400)](r[_MNVo.$_Cn(76)])&&e[_MNVo.$_Cn(485)]([r[_MNVo.$_Cn(76)]],_MNVo.$_Cn(505))[_MNVo.$_Cn(475)](r[_MNVo.$_Cn(76)])[_MNVo.$_Cn(487)]({"\u006e\u0061\u006d\u0065":n,"\u0076\u0061\u006c\u0075\u0065":t}),i(),e[_MNVo.$_Cn(524)]();}:e[_MNVo.$_Cn(406)]=function(e){var t,e=e[_MNVo.$_Cn(480)]&&e[_MNVo.$_Cn(480)][_MNVo.$_Cn(421)];e[_MNVo.$_Cn(483)][_MNVo.$_Cn(400)](r[_MNVo.$_Cn(76)])?(t=e[_MNVo.$_Cn(485)]([r[_MNVo.$_Cn(76)]])[_MNVo.$_Cn(475)](r[_MNVo.$_Cn(76)])[_MNVo.$_Cn(536)](n))[_MNVo.$_Cn(406)]=function(){t[_MNVo.$_Cn(421)]===undefined?r[_MNVo.$_Cn(446)][_MNVo.$_Cn(510)]=undefined:r[_MNVo.$_Cn(446)][_MNVo.$_Cn(510)]=t[_MNVo.$_Cn(421)][_MNVo.$_Cn(88)];}:r[_MNVo.$_Cn(446)][_MNVo.$_Cn(510)]=undefined,i(),e[_MNVo.$_Cn(524)]();}):i();}catch(o){i();}},"\u0073\u0065\u0073\u0073\u0069\u006f\u006e":function(e,t,n){try{var i=window[_MNVo.$_Cn(213)];i&&(t!==undefined?i[_MNVo.$_Cn(523)](e,t):this[_MNVo.$_Cn(446)][_MNVo.$_Cn(461)]=i[_MNVo.$_Cn(507)](e)),n();}catch(r){n();}},"\u0063\u006f\u006f\u006b\u0069\u0065":function(e,t,n){t!==undefined?(document[_MNVo.$_Cn(323)]=_MNVo.$_Cn(56)[_MNVo.$_Cn(75)](e,_MNVo.$_Cn(515))[_MNVo.$_Cn(75)](re[_MNVo.$_Cn(582)]),document[_MNVo.$_Cn(323)]=_MNVo.$_Cn(56)[_MNVo.$_Cn(75)](e,_MNVo.$_Cn(330))[_MNVo.$_Cn(75)](t,_MNVo.$_Cn(555))[_MNVo.$_Cn(75)](re[_MNVo.$_Cn(582)])):this[_MNVo.$_Cn(446)][_MNVo.$_Cn(323)]=oe(e,document[_MNVo.$_Cn(323)]),n();},"\u006c\u006f\u0063\u0061\u006c\u0053\u0074\u006f\u0072\u0061\u0067\u0065":function(e,t,n){try{var i=window[_MNVo.$_Cn(244)];i&&(t!==undefined?i[_MNVo.$_Cn(523)](e,t):this[_MNVo.$_Cn(446)][_MNVo.$_Cn(545)]=i[_MNVo.$_Cn(507)](e)),n();}catch(r){n();}},"\u0077\u0069\u006e\u0064\u006f\u0077\u004e\u0061\u006d\u0065":function(e,t,n){t!==undefined?window[_MNVo.$_Cn(76)]=function(e,t,n){if(-1>16),n+=String[_MNVo.$_Cn(325)]((65280&i)>>8),n+=String[_MNVo.$_Cn(325)](255&i),i=r=0);return 12===r?(i>>=4,n+=String[_MNVo.$_Cn(325)](i)):18===r&&(i>>=2,n+=String[_MNVo.$_Cn(325)]((65280&i)>>8),n+=String[_MNVo.$_Cn(325)](255&i)),n;};var de=function(e){for(e=_MNVo.$_Cn(56)[_MNVo.$_Cn(75)](e),i=0;i>2,r[1]=(3&e[_MNVo.$_Cn(6)](i))<<4,e[_MNVo.$_Cn(59)]>i+1&&(r[1]|=e[_MNVo.$_Cn(6)](i+1)>>4,r[2]=(15&e[_MNVo.$_Cn(6)](i+1))<<2),e[_MNVo.$_Cn(59)]>i+2&&(r[2]|=e[_MNVo.$_Cn(6)](i+2)>>6,r[3]=63&e[_MNVo.$_Cn(6)](i+2));for(var o=0;o8?3:1,b=new Array(32*g),y=new Array(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0),_=0,S=0,A=0;A>>4^T),T^=i,C^=i<<4,i=65535&(T>>>-16^C),C^=i,T^=i<<-16,i=858993459&(C>>>2^T),T^=i,C^=i<<2,i=65535&(T>>>-16^C),C^=i,T^=i<<-16,i=1431655765&(C>>>1^T),T^=i,C^=i<<1,i=16711935&(T>>>8^C),C^=i,T^=i<<8,i=1431655765&(C>>>1^T),T^=i,C^=i<<1,i=C<<8|T>>>20&240,C=T<<24|T<<8&16711680|T>>>8&65280|T>>>24&240,T=i;for(var E=0;E>>26,T=T<<2|T>>>26):(C=C<<1|C>>>27,T=T<<1|T>>>27),C&=-15,T&=-15,t=r[C>>>28]|o[C>>>24&15]|a[C>>>20&15]|c[C>>>16&15]|s[C>>>12&15]|u[C>>>8&15]|l[C>>>4&15],n=d[T>>>28]|f[T>>>24&15]|h[T>>>20&15]|p[T>>>16&15]|m[T>>>12&15]|v[T>>>8&15]|w[T>>>4&15],i=65535&(n>>>16^t),b[S++]=t^i,b[S++]=n^i<<16;}return b;}(e),k=0,P=t[_MNVo.$_Cn(59)],O=0,D=32==x[_MNVo.$_Cn(59)]?3:9,M=3==D?n?new Array(0,32,2):new Array(30,-2,-2):n?new Array(0,32,2,62,30,-2,64,96,2):new Array(94,62,-2,32,64,2,30,-2,-2);2==o?t+=_MNVo.$_Cn(577):1==o?n&&(s=8-P%8,t+=String[_MNVo.$_Cn(325)](s,s,s,s,s,s,s,s),8===s&&(P+=8)):o||(t+=_MNVo.$_Cn(518));var N=_MNVo.$_Cn(56),B=_MNVo.$_Cn(56);1==i&&(h=r[_MNVo.$_Cn(6)](k++)<<24|r[_MNVo.$_Cn(6)](k++)<<16|r[_MNVo.$_Cn(6)](k++)<<8|r[_MNVo.$_Cn(6)](k++),m=r[_MNVo.$_Cn(6)](k++)<<24|r[_MNVo.$_Cn(6)](k++)<<16|r[_MNVo.$_Cn(6)](k++)<<8|r[_MNVo.$_Cn(6)](k++),k=0);while(k>>4^f))<<4,d^=(s=65535&(d>>>16^(f^=s)))<<16,d^=s=858993459&((f^=s)>>>2^d),d^=s=16711935&((f^=s<<2)>>>8^d),d=(d^=(s=1431655765&(d>>>1^(f^=s<<8)))<<1)<<1|d>>>31,f=(f^=s)<<1|f>>>31,c=0;c>>4|f<<28)^x[a+1],s=d,d=f,f=s^(y[u>>>24&63]|S[u>>>16&63]|C[u>>>8&63]|E[63&u]|b[l>>>24&63]|_[l>>>16&63]|A[l>>>8&63]|T[63&l]);s=d,d=f,f=s;}f=f>>>1|f<<31,f^=s=1431655765&((d=d>>>1|d<<31)>>>1^f),f^=(s=16711935&(f>>>8^(d^=s<<1)))<<8,f^=(s=858993459&(f>>>2^(d^=s)))<<2,f^=s=65535&((d^=s)>>>16^f),f^=s=252645135&((d^=s<<16)>>>4^f),d^=s<<4,1==i&&(n?(h=d,m=f):(d^=p,f^=v)),B+=String[_MNVo.$_Cn(325)](d>>>24,d>>>16&255,d>>>8&255,255&d,f>>>24,f>>>16&255,f>>>8&255,255&f),512==(O+=8)&&(N+=B,B=_MNVo.$_Cn(56),O=0);}return N+=B,n||(1===o&&(r=0,(r=(o=N[_MNVo.$_Cn(59)])?N[_MNVo.$_Cn(6)](o-1):r)<=8&&(N=N[_MNVo.$_Cn(391)](0,o-r))),N=decodeURIComponent(escape(N))),N;},he=function(e,t,n){return{"\u006b\u0065\u0079":function(e){for(var t=e[_MNVo.$_Cn(59)];t<24;t++)e+=_MNVo.$_Cn(90);return e;}(e[_MNVo.$_Cn(82)](t,n)),"\u0076\u0065\u0063\u0074\u006f\u0072":1};},pe={"\u0065\u006e\u0063\u0072\u0079\u0070\u0074":function(e,t){e=he(e,0,24);return de(fe(e[_MNVo.$_Cn(488)],t,1,0,0,1));},"\u0064\u0065\u0063\u0072\u0079\u0070\u0074":function(e,t){e=he(e,0,24);return fe(e[_MNVo.$_Cn(488)],le(t),0,0,0,1);}};function me(e,t){var $_BADu=_MNVo.$_Dt()[8][18];for(;$_BADu!==_MNVo.$_Dt()[0][17];){switch($_BADu){case _MNVo.$_Dt()[12][18]:var n=r(ae(32)+String(new Date()[_MNVo.$_Cn(538)]())),i=pe[_MNVo.$_Cn(584)](re[_MNVo.$_Cn(488)],n);t[_MNVo.$_Cn(431)](re[_MNVo.$_Cn(488)],i,function(){window[_MNVo.$_Cn(346)]=i,e(n);});$_BADu=_MNVo.$_Dt()[4][17];break;}}}var ve=_MNVo.$_Cn(56),we=_MNVo.$_Cn(61),ge=_MNVo.$_Cn(443),be=_MNVo.$_Cn(21),ye=_MNVo.$_Cn(235),$_BEK=_MNVo.$_Cn(556),Se=_MNVo.$_Cn(76),Ae=_MNVo.$_Cn(297),Ce=_MNVo.$_Cn(31),Te=_MNVo.$_Cn(554),Ee=_MNVo.$_Cn(583),xe=_MNVo.$_Cn(520),ke=_MNVo.$_Cn(594),Pe=_MNVo.$_Cn(543),Oe=_MNVo.$_Cn(565),De=_MNVo.$_Cn(551),Me=_MNVo.$_Cn(512),Ne=_MNVo.$_Cn(537),Be=_MNVo.$_Cn(64),Re=_MNVo.$_Cn(572),je=_MNVo.$_Cn(597),Ie=_MNVo.$_Cn(548),Fe=_MNVo.$_Cn(527),Ue=_MNVo.$_Cn(10),Le=_MNVo.$_Cn(557),ze=_MNVo.$_Cn(588),qe=_MNVo.$_Cn(593),Ge=_MNVo.$_Cn(589),He=_MNVo.$_Cn(569),Ve=_MNVo.$_Cn(516),We=_MNVo.$_Cn(567),Ze=function(e){for(var t={},n=0;n>>2]>>>24-o%4*8&255;t[i+o>>>2]|=a<<24-(i+o)%4*8;}else for(o=0;o>>2]=n[o>>>2];return this[_MNVo.$_Cn(806)]+=r,this;},"\u0063\u006c\u0061\u006d\u0070":function(){var e=this[_MNVo.$_Cn(829)],t=this[_MNVo.$_Cn(806)];e[t>>>2]&=4294967295<<32-t%4*8,e[_MNVo.$_Cn(59)]=Math[_MNVo.$_Cn(804)](t/4);}}),o=e[_MNVo.$_Cn(807)]={},l=o[_MNVo.$_Cn(838)]={"\u0070\u0061\u0072\u0073\u0065":function(e){for(var t=e[_MNVo.$_Cn(59)],n=[],i=0;i>>2]|=(255&e[_MNVo.$_Cn(6)](i))<<24-i%4*8;return new u[(_MNVo.$_Cn(857))](n,t);}},a=o[_MNVo.$_Cn(847)]={"\u0070\u0061\u0072\u0073\u0065":function(e){return l[_MNVo.$_Cn(836)](unescape(encodeURIComponent(e)));}},c=i[_MNVo.$_Cn(862)]=r[_MNVo.$_Cn(870)]({"\u0072\u0065\u0073\u0065\u0074":function(){this[_MNVo.$_Cn(446)]=new u[(_MNVo.$_Cn(857))](),this[_MNVo.$_Cn(824)]=0;},"\u0024\u005f\u0042\u0049\u007a":function(e){_MNVo.$_Cn(235)==typeof e&&(e=a[_MNVo.$_Cn(836)](e)),this[_MNVo.$_Cn(446)][_MNVo.$_Cn(75)](e),this[_MNVo.$_Cn(824)]+=e[_MNVo.$_Cn(806)];},"\u0024\u005f\u0042\u004a\u0072":function(e){var t=this[_MNVo.$_Cn(446)],n=t[_MNVo.$_Cn(829)],i=t[_MNVo.$_Cn(806)],r=this[_MNVo.$_Cn(885)],o=i/(4*r),a=(o=e?Math[_MNVo.$_Cn(804)](o):Math[_MNVo.$_Cn(263)]((0|o)-this[_MNVo.$_Cn(834)],0))*r,i=Math[_MNVo.$_Cn(51)](4*a,i);if(a){for(var c=0;c>>2]>>>24-a%4*8&255;o[_MNVo.$_Cn(50)](c);}i=n[_MNVo.$_Cn(810)][_MNVo.$_Cn(829)];return o;}};}}),f=e[_MNVo.$_Cn(863)]={},o=i[_MNVo.$_Cn(873)]=r[_MNVo.$_Cn(870)]({"\u0063\u0072\u0065\u0061\u0074\u0065\u0045\u006e\u0063\u0072\u0079\u0070\u0074\u006f\u0072":function(e,t){return this[_MNVo.$_Cn(874)][_MNVo.$_Cn(326)](e,t);},"\u0069\u006e\u0069\u0074":function(e,t){this[_MNVo.$_Cn(825)]=e,this[_MNVo.$_Cn(803)]=t;}}),o=f[_MNVo.$_Cn(892)]=((f=o[_MNVo.$_Cn(870)]())[_MNVo.$_Cn(874)]=f[_MNVo.$_Cn(870)]({"\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0042\u006c\u006f\u0063\u006b":function(e,t){var n=this[_MNVo.$_Cn(825)],i=n[_MNVo.$_Cn(885)];!function(e,t,n){var i=this[_MNVo.$_Cn(803)];{var r;i?(r=i,this[_MNVo.$_Cn(803)]=undefined):r=this[_MNVo.$_Cn(801)];}for(var o=0;o>>8^255&r^99;var o=e[v[r]=n],a=e[o],c=e[a],s=257*e[r]^16843008*r;w[n]=s<<24|s>>>8,g[n]=s<<16|s>>>16,b[n]=s<<8|s>>>24,y[n]=s,_[r]=(s=16843009*c^65537*a^257*o^16843008*n)<<24|s>>>8,S[r]=s<<16|s>>>16,A[r]=s<<8|s>>>24,C[r]=s,n?(n=o^e[e[e[c^o]]],i^=e[e[i]]):n=i=1;}}();var T=[0,1,2,4,8,16,32,64,128,27,54],s=s[_MNVo.$_Cn(923)]=f[_MNVo.$_Cn(870)]({"\u0024\u005f\u0043\u0045\u004a":function(){if(!this[_MNVo.$_Cn(982)]||this[_MNVo.$_Cn(908)]!==this[_MNVo.$_Cn(430)]){for(var e=this[_MNVo.$_Cn(908)]=this[_MNVo.$_Cn(430)],t=e[_MNVo.$_Cn(829)],n=e[_MNVo.$_Cn(806)]/4,i=4*(1+(this[_MNVo.$_Cn(982)]=6+n)),r=this[_MNVo.$_Cn(992)]=[],o=0;o>>24]<<24|m[s>>>16&255]<<16|m[s>>>8&255]<<8|m[255&s]):(s=m[(s=s<<8|s>>>24)>>>24]<<24|m[s>>>16&255]<<16|m[s>>>8&255]<<8|m[255&s],s^=T[o/n|0]<<24),r[o]=r[o-n]^s);for(var a=this[_MNVo.$_Cn(986)]=[],c=0;c>>24]]^S[m[s>>>16&255]]^A[m[s>>>8&255]]^C[m[255&s]];}}},"\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0042\u006c\u006f\u0063\u006b":function(e,t){this[_MNVo.$_Cn(906)](e,t,this[_MNVo.$_Cn(992)],w,g,b,y,m);},"\u0024\u005f\u0044\u0048\u0079":function(e,t,n,i,r,o,a,c){for(var s=this[_MNVo.$_Cn(982)],u=e[t]^n[0],l=e[t+1]^n[1],d=e[t+2]^n[2],f=e[t+3]^n[3],h=4,p=1;p>>24]^r[l>>>16&255]^o[d>>>8&255]^a[255&f]^n[h++],v=i[l>>>24]^r[d>>>16&255]^o[f>>>8&255]^a[255&u]^n[h++],w=i[d>>>24]^r[f>>>16&255]^o[u>>>8&255]^a[255&l]^n[h++],g=i[f>>>24]^r[u>>>16&255]^o[l>>>8&255]^a[255&d]^n[h++],u=m,l=v,d=w,f=g;m=(c[u>>>24]<<24|c[l>>>16&255]<<16|c[d>>>8&255]<<8|c[255&f])^n[h++],v=(c[l>>>24]<<24|c[d>>>16&255]<<16|c[f>>>8&255]<<8|c[255&u])^n[h++],w=(c[d>>>24]<<24|c[f>>>16&255]<<16|c[u>>>8&255]<<8|c[255&l])^n[h++],g=(c[f>>>24]<<24|c[u>>>16&255]<<16|c[l>>>8&255]<<8|c[255&d])^n[h++];e[t]=m,e[t+1]=v,e[t+2]=w,e[t+3]=g;},"\u006b\u0065\u0079\u0053\u0069\u007a\u0065":8});return e[_MNVo.$_Cn(923)]=f[_MNVo.$_Cn(991)](s),e[_MNVo.$_Cn(923)];}(),Ct=function(){function t(){var $_BAFx=_MNVo.$_Dt()[0][18];for(;$_BAFx!==_MNVo.$_Dt()[12][17];){switch($_BAFx){case _MNVo.$_Dt()[8][18]:this[_MNVo.$_Cn(456)]=0,this[_MNVo.$_Cn(401)]=0,this[_MNVo.$_Cn(416)]=[];$_BAFx=_MNVo.$_Dt()[4][17];break;}}}t[_MNVo.$_Cn(72)][_MNVo.$_Cn(857)]=function(e){for(var t,n,i=0;i<256;++i)this[_MNVo.$_Cn(416)][i]=i;for(i=t=0;i<256;++i)t=t+this[_MNVo.$_Cn(416)][i]+e[i%e[_MNVo.$_Cn(59)]]&255,n=this[_MNVo.$_Cn(416)][i],this[_MNVo.$_Cn(416)][i]=this[_MNVo.$_Cn(416)][t],this[_MNVo.$_Cn(416)][t]=n;this[_MNVo.$_Cn(456)]=0,this[_MNVo.$_Cn(401)]=0;},t[_MNVo.$_Cn(72)][_MNVo.$_Cn(60)]=function(){var e;return this[_MNVo.$_Cn(456)]=this[_MNVo.$_Cn(456)]+1&255,this[_MNVo.$_Cn(401)]=this[_MNVo.$_Cn(401)]+this[_MNVo.$_Cn(416)][this[_MNVo.$_Cn(456)]]&255,e=this[_MNVo.$_Cn(416)][this[_MNVo.$_Cn(456)]],this[_MNVo.$_Cn(416)][this[_MNVo.$_Cn(456)]]=this[_MNVo.$_Cn(416)][this[_MNVo.$_Cn(401)]],this[_MNVo.$_Cn(416)][this[_MNVo.$_Cn(401)]]=e,this[_MNVo.$_Cn(416)][e+this[_MNVo.$_Cn(416)][this[_MNVo.$_Cn(456)]]&255];};var n,i,r,o=256;function a(){var $_BAGf=_MNVo.$_Dt()[8][18];for(;$_BAGf!==_MNVo.$_Dt()[8][16];){switch($_BAGf){case _MNVo.$_Dt()[12][18]:if(null==n){n=new t();while(r>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n;break;}}}function h(e){var $_BBDw=_MNVo.$_Dt()[8][18];for(;$_BBDw!==_MNVo.$_Dt()[12][17];){switch($_BBDw){case _MNVo.$_Dt()[12][18]:this[_MNVo.$_Cn(482)]=e;$_BBDw=_MNVo.$_Dt()[0][17];break;}}}function p(e){var $_BBEM=_MNVo.$_Dt()[4][18];for(;$_BBEM!==_MNVo.$_Dt()[0][17];){switch($_BBEM){case _MNVo.$_Dt()[8][18]:this[_MNVo.$_Cn(482)]=e,this[_MNVo.$_Cn(948)]=e[_MNVo.$_Cn(920)](),this[_MNVo.$_Cn(912)]=32767&this[_MNVo.$_Cn(948)],this[_MNVo.$_Cn(996)]=this[_MNVo.$_Cn(948)]>>15,this[_MNVo.$_Cn(935)]=(1<>15)*this[_MNVo.$_Cn(912)]&this[_MNVo.$_Cn(935)])<<15)&e[_MNVo.$_Cn(970)];e[n=t+this[_MNVo.$_Cn(482)][_MNVo.$_Cn(477)]]+=this[_MNVo.$_Cn(482)][_MNVo.$_Cn(934)](0,i,e,t,0,this[_MNVo.$_Cn(482)][_MNVo.$_Cn(477)]);while(e[n]>=e[_MNVo.$_Cn(942)])e[n]-=e[_MNVo.$_Cn(942)],e[++n]++;}e[_MNVo.$_Cn(849)](),e[_MNVo.$_Cn(924)](this[_MNVo.$_Cn(482)][_MNVo.$_Cn(477)],e),0<=e[_MNVo.$_Cn(971)](this[_MNVo.$_Cn(482)])&&e[_MNVo.$_Cn(922)](this[_MNVo.$_Cn(482)],e);},p[_MNVo.$_Cn(72)][_MNVo.$_Cn(933)]=function(e,t,n){e[_MNVo.$_Cn(964)](t,n),this[_MNVo.$_Cn(7)](n);},p[_MNVo.$_Cn(72)][_MNVo.$_Cn(974)]=function(e,t){e[_MNVo.$_Cn(946)](t),this[_MNVo.$_Cn(7)](t);},w[_MNVo.$_Cn(72)][_MNVo.$_Cn(925)]=function(e){for(var t=this[_MNVo.$_Cn(477)]-1;0<=t;--t)e[t]=this[t];e[_MNVo.$_Cn(477)]=this[_MNVo.$_Cn(477)],e[_MNVo.$_Cn(425)]=this[_MNVo.$_Cn(425)];},w[_MNVo.$_Cn(72)][_MNVo.$_Cn(981)]=function(e){this[_MNVo.$_Cn(477)]=1,this[_MNVo.$_Cn(425)]=e<0?-1:0,0this[_MNVo.$_Cn(947)]?(this[this[_MNVo.$_Cn(477)]-1]|=(c&(1<>this[_MNVo.$_Cn(947)]-a):this[this[_MNVo.$_Cn(477)]-1]|=c<=this[_MNVo.$_Cn(947)]&&(a-=this[_MNVo.$_Cn(947)]));}8==n&&0!=(128&e[0])&&(this[_MNVo.$_Cn(425)]=-1,0>i|a,a=(this[c]&r)<=this[_MNVo.$_Cn(477)])t[_MNVo.$_Cn(477)]=0;else{var i=e%this[_MNVo.$_Cn(947)],r=this[_MNVo.$_Cn(947)]-i,o=(1<>i;for(var a=n+1;a>i;0>=this[_MNVo.$_Cn(947)];if(e[_MNVo.$_Cn(477)]>=this[_MNVo.$_Cn(947)];i+=this[_MNVo.$_Cn(425)];}else{i+=this[_MNVo.$_Cn(425)];while(n>=this[_MNVo.$_Cn(947)];i-=e[_MNVo.$_Cn(425)];}t[_MNVo.$_Cn(425)]=i<0?-1:0,i<-1?t[n++]=this[_MNVo.$_Cn(942)]+i:0=t[_MNVo.$_Cn(942)]&&(e[n+t[_MNVo.$_Cn(477)]]-=t[_MNVo.$_Cn(942)],e[n+t[_MNVo.$_Cn(477)]+1]=1);}0>this[_MNVo.$_Cn(902)]:0),l=this[_MNVo.$_Cn(911)]/r,d=(1<>c)&&(r=!0,o=d(n));while(0<=a)c>(c+=this[_MNVo.$_Cn(947)]-t)):(n=this[a]>>(c-=t)&i,c<=0&&(c+=this[_MNVo.$_Cn(947)],--a)),(r=0>6|192):(n[--t]=63&r|128,n[--t]=r>>6&63|128,n[--t]=r>>12|224);}n[--t]=0;var o=new c(),a=[];while(2>3))||null==(e=this[_MNVo.$_Cn(997)](e))?null:0==(1&(e=e[_MNVo.$_Cn(41)](16))[_MNVo.$_Cn(59)])?e:_MNVo.$_Cn(90)+e;},m;}();function Tt(e){var $_BBGY=_MNVo.$_Dt()[12][18];for(;$_BBGY!==_MNVo.$_Dt()[12][16];){switch($_BBGY){case _MNVo.$_Dt()[0][18]:var t=ae(32),n=new Ct()[_MNVo.$_Cn(584)](t);while(!n||256!==n[_MNVo.$_Cn(59)])t=ae(32),n=new Ct()[_MNVo.$_Cn(584)](t);$_BBGY=_MNVo.$_Dt()[8][17];break;case _MNVo.$_Dt()[12][17]:return function(e){for(var t=[],n=0,i=0;i<2*e[_MNVo.$_Cn(59)];i+=2)t[i>>>3]|=parseInt(e[n],10)<<24-i%8*4,n++;for(var r=[],i=0;i>>2]>>>24-i%4*8&255;r[_MNVo.$_Cn(50)]((o>>>4)[_MNVo.$_Cn(41)](16)),r[_MNVo.$_Cn(50)]((15&o)[_MNVo.$_Cn(41)](16));}return r[_MNVo.$_Cn(161)](_MNVo.$_Cn(56));}(At[_MNVo.$_Cn(584)](e,t))+n;break;}}}var Et,xt,kt,Pt,Ot,Dt=(Ze={"\u0073\u0074\u0072\u0069\u006e\u0067\u0069\u0066\u0079":function(e){}},Ot=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_MNVo.$_Cn(61)!=typeof Date[_MNVo.$_Cn(72)][_MNVo.$_Cn(909)]&&(Date[_MNVo.$_Cn(72)][_MNVo.$_Cn(909)]=function(){return isFinite(this[_MNVo.$_Cn(941)]())?_MNVo.$_Cn(56)[_MNVo.$_Cn(75)](this[_MNVo.$_Cn(954)](),_MNVo.$_Cn(370))[_MNVo.$_Cn(75)](Mt(this[_MNVo.$_Cn(903)]()+1),_MNVo.$_Cn(370))[_MNVo.$_Cn(75)](Mt(this[_MNVo.$_Cn(960)]()),_MNVo.$_Cn(409))[_MNVo.$_Cn(75)](Mt(this[_MNVo.$_Cn(967)]()),_MNVo.$_Cn(978))[_MNVo.$_Cn(75)](Mt(this[_MNVo.$_Cn(963)]()),_MNVo.$_Cn(978))[_MNVo.$_Cn(75)](Mt(this[_MNVo.$_Cn(910)]()),_MNVo.$_Cn(492)):null;},Boolean[_MNVo.$_Cn(72)][_MNVo.$_Cn(909)]=Nt,Number[_MNVo.$_Cn(72)][_MNVo.$_Cn(909)]=Nt,String[_MNVo.$_Cn(72)][_MNVo.$_Cn(909)]=Nt),kt={"\u0008":_MNVo.$_Cn(959),"\u0009":_MNVo.$_Cn(901),"\u000a":_MNVo.$_Cn(980),"\u000c":_MNVo.$_Cn(995),"\u000d":_MNVo.$_Cn(900),"\u0022":_MNVo.$_Cn(977),"\u005c":_MNVo.$_Cn(945)},Ze[_MNVo.$_Cn(984)]=function(e,t,n){var i;if(xt=Et=_MNVo.$_Cn(56),_MNVo.$_Cn(46)==typeof n)for(i=0;ia?e[_MNVo.$_Cn(319)][o[1+a]](r):e[_MNVo.$_Cn(319)][o[s]](r);for(var u=Math[_MNVo.$_Cn(295)](n[c][_MNVo.$_Cn(6)]()-70)[_MNVo.$_Cn(41)]()[0],l=0;l { console.debug('xunfei sse', message) if (message === '') { done = true params.onEvent({ type: 'DONE' }) } else if (message === '') { throw new ChatError('讯飞无法继续这个话题,请重启会话', ErrorCode.CONVERSATION_LIMIT) } else if (/\[.*\]/.test(message)) { return } else if (message.includes('descr')) { const payload = JSON.parse(message) throw new Error(payload.descr) } else if (!done) { let decoded: string try { decoded = Base64.decode(message) } catch (err) { throw new ChatError('讯飞无法回答该问题', ErrorCode.CONVERSATION_LIMIT) } answer += decoded params.onEvent({ type: 'UPDATE_ANSWER', data: { text: answer } }) } }) } resetConversation() { this.conversationContext = undefined } get name() { return '讯飞星火' } } ================================================ FILE: src/app/components/Button.tsx ================================================ import { cx } from '~/utils' import { ButtonHTMLAttributes, FC, ReactNode } from 'react' import { BeatLoader } from 'react-spinners' import React from 'react' import { motion } from 'framer-motion' export interface Props { text: string className?: string color?: 'primary' | 'flat' type?: ButtonHTMLAttributes['type'] onClick?: () => void isLoading?: boolean size?: 'small' | 'normal' | 'tiny' icon?: ReactNode } const Button = React.forwardRef((props, ref) => { const size = props.size || 'normal' const type = props.type || 'button' return ( ) }) Button.displayName = 'Button' export default Button export const MotionButton = motion(Button) ================================================ FILE: src/app/components/Chat/ChatMessageCard.tsx ================================================ import { cx } from '~/utils' import { FC, memo, useEffect, useMemo, useState } from 'react' import { CopyToClipboard } from 'react-copy-to-clipboard' import { IoCheckmarkSharp, IoCopyOutline } from 'react-icons/io5' import { BeatLoader } from 'react-spinners' import { ChatMessageModel } from '~/types' import Markdown from '../Markdown' import ErrorAction from './ErrorAction' import MessageBubble from './MessageBubble' const COPY_ICON_CLASS = 'self-top cursor-pointer invisible group-hover:visible mt-[12px] text-primary-text' interface Props { message: ChatMessageModel className?: string } const ChatMessageCard: FC = ({ message, className }) => { const [copied, setCopied] = useState(false) const imageUrl = useMemo(() => { return message.image ? URL.createObjectURL(message.image) : '' }, [message.image]) const copyText = useMemo(() => { if (message.text) { return message.text } if (message.error) { return message.error.message } }, [message.error, message.text]) useEffect(() => { if (copied) { setTimeout(() => setCopied(false), 1000) } }, [copied]) return (
{!!imageUrl && } {message.text ? ( {message.text} ) : ( !message.error && )} {!!message.error &&

{message.error.message}

}
{!!message.error && }
{!!copyText && ( setCopied(true)}> {copied ? : } )}
) } export default memo(ChatMessageCard) ================================================ FILE: src/app/components/Chat/ChatMessageInput.tsx ================================================ import { FloatingFocusManager, FloatingList, autoUpdate, flip, offset, shift, useDismiss, useFloating, useInteractions, useListNavigation, useRole, } from '@floating-ui/react' import { fileOpen } from 'browser-fs-access' import { cx } from '~/utils' import { ClipboardEventHandler, FC, ReactNode, memo, useCallback, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { GoBook, GoImage } from 'react-icons/go' import { RiDeleteBackLine } from 'react-icons/ri' import { trackEvent } from '~app/plausible' import { Prompt } from '~services/prompts' import Button from '../Button' import PromptCombobox, { ComboboxContext } from '../PromptCombobox' import PromptLibraryDialog from '../PromptLibrary/Dialog' import TextInput from './TextInput' interface Props { mode: 'full' | 'compact' onSubmit: (value: string, image?: File) => void className?: string disabled?: boolean placeholder?: string actionButton?: ReactNode | null autoFocus?: boolean supportImageInput?: boolean } const ChatMessageInput: FC = (props) => { const { t } = useTranslation() const { placeholder = t('Use / to select prompts, Shift+Enter to add new line') } = props const [value, setValue] = useState('') const [image, setImage] = useState(undefined) const formRef = useRef(null) const inputRef = useRef(null) const [isPromptLibraryDialogOpen, setIsPromptLibraryDialogOpen] = useState(false) const [activeIndex, setActiveIndex] = useState(null) const [isComboboxOpen, setIsComboboxOpen] = useState(false) const { refs, floatingStyles, context } = useFloating({ whileElementsMounted: autoUpdate, middleware: [offset(15), flip(), shift()], placement: 'top-start', open: isComboboxOpen, onOpenChange: setIsComboboxOpen, }) const floatingListRef = useRef([]) const handleSelect = useCallback((p: Prompt) => { if (p.id === 'PROMPT_LIBRARY') { setIsPromptLibraryDialogOpen(true) setIsComboboxOpen(false) trackEvent('open_prompt_library', { source: 'combobox' }) } else { setValue(p.prompt) setIsComboboxOpen(false) inputRef.current?.focus() trackEvent('use_prompt', { source: 'combobox' }) } }, []) const listNavigation = useListNavigation(context, { listRef: floatingListRef, activeIndex, onNavigate: setActiveIndex, loop: true, focusItemOnOpen: true, openOnArrowKeyDown: false, }) const dismiss = useDismiss(context) const role = useRole(context, { role: 'listbox' }) const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([role, dismiss, listNavigation]) const comboboxContext = useMemo( () => ({ activeIndex, getItemProps, handleSelect, setIsComboboxOpen: (open: boolean) => { setIsComboboxOpen(open) if (open) { trackEvent('open_prompt_combobox') } else { inputRef.current?.focus() } }, }), [activeIndex, getItemProps, handleSelect], ) const onFormSubmit = useCallback( (e: React.FormEvent) => { e.preventDefault() if (value.trim()) { props.onSubmit(value, image) } setValue('') setImage(undefined) }, [image, props, value], ) const onValueChange = useCallback((v: string) => { setValue(v) setIsComboboxOpen(v === '/') }, []) const insertTextAtCursor = useCallback( (text: string) => { const cursorPosition = inputRef.current?.selectionStart || 0 const textBeforeCursor = value.slice(0, cursorPosition) const textAfterCursor = value.slice(cursorPosition) setValue(`${textBeforeCursor}${text}${textAfterCursor}`) setIsPromptLibraryDialogOpen(false) inputRef.current?.focus() }, [value], ) const openPromptLibrary = useCallback(() => { setIsPromptLibraryDialogOpen(true) trackEvent('open_prompt_library') }, []) const selectImage = useCallback(async () => { const file = await fileOpen({ mimeTypes: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif'], extensions: ['.jpg', '.jpeg', '.png', '.gif'], }) setImage(file) inputRef.current?.focus() }, []) const onPaste: ClipboardEventHandler = useCallback((event) => { const files = event.clipboardData.files if (!files.length) { return } const imageFile = Array.from(files).find((file) => file.type.startsWith('image/')) if (imageFile) { event.preventDefault() setImage(imageFile) inputRef.current?.focus() } }, []) return (
{props.mode === 'full' && ( <> {isPromptLibraryDialogOpen && ( setIsPromptLibraryDialogOpen(false)} insertPrompt={insertTextAtCursor} /> )} {isComboboxOpen && (
)}
{props.supportImageInput && ( )} )}
{image && (
{image.name} setImage(undefined)} />
)}
{props.actionButton ||