@blocklet/pages-kit 0.2.285 → 0.2.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/builtin/async/ai-runtime/api/assistant.js +26 -0
- package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +127 -0
- package/lib/cjs/builtin/async/ai-runtime/api/message.js +33 -0
- package/lib/cjs/builtin/async/ai-runtime/api/request.js +47 -0
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +121 -0
- package/lib/cjs/builtin/async/ai-runtime/api/subscription.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +63 -0
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading.js +60 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +40 -0
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +51 -0
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +156 -0
- package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +43 -0
- package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/components/RuntimeProvider.js +16 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +109 -0
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +102 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +193 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
- package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +105 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +12 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +66 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +43 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +44 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +76 -0
- package/lib/cjs/builtin/async/ai-runtime/components/layout/index.js +15 -0
- package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +34 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageActions.js +38 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +30 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +134 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/message/ReferenceLinks.js +11 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/LanguageField.js +55 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/NumberField.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/SelectField.js +24 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/StringField.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/parameters/index.js +37 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +94 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +48 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +21 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +67 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +15 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +103 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +72 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +31 -0
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +22 -0
- package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +62 -0
- package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
- package/lib/cjs/builtin/async/ai-runtime/constants.js +5 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +32 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +37 -0
- package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +35 -0
- package/lib/cjs/builtin/async/ai-runtime/index.js +75 -0
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +147 -0
- package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +59 -0
- package/lib/cjs/builtin/async/ai-runtime/state/index.js +423 -0
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +217 -0
- package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +52 -0
- package/lib/cjs/builtin/async/ai-runtime/utils.js +49 -0
- package/lib/cjs/builtin/async/react-scroll-to-bottom.js +1 -1
- package/lib/cjs/utils/builtin.js +1 -0
- package/lib/cjs/utils/inject-global-components.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/api/assistant.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/api/dataset.js +113 -0
- package/lib/esm/builtin/async/ai-runtime/api/message.js +28 -0
- package/lib/esm/builtin/async/ai-runtime/api/request.js +43 -0
- package/lib/esm/builtin/async/ai-runtime/api/session.js +112 -0
- package/lib/esm/builtin/async/ai-runtime/api/subscription.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +56 -0
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading.js +56 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +48 -0
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +129 -0
- package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +40 -0
- package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +27 -0
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeProvider.js +10 -0
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +101 -0
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +93 -0
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +190 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +92 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +197 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +122 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +152 -0
- package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +135 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +99 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.js +15 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.js +30 -0
- package/lib/esm/builtin/async/ai-runtime/components/common/index.js +3 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +42 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +59 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +37 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +38 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +73 -0
- package/lib/esm/builtin/async/ai-runtime/components/layout/index.js +12 -0
- package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +8 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageActions.js +35 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +24 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +105 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +42 -0
- package/lib/esm/builtin/async/ai-runtime/components/message/ReferenceLinks.js +8 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/LanguageField.js +53 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/NumberField.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/SelectField.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/StringField.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/parameters/index.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +88 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +22 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.js +15 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +61 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +9 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +97 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +19 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +16 -0
- package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +59 -0
- package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +88 -0
- package/lib/esm/builtin/async/ai-runtime/constants.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/header.js +25 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +31 -0
- package/lib/esm/builtin/async/ai-runtime/index.js +66 -0
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +144 -0
- package/lib/esm/builtin/async/ai-runtime/state/assistant.js +54 -0
- package/lib/esm/builtin/async/ai-runtime/state/index.js +423 -0
- package/lib/esm/builtin/async/ai-runtime/state/session.js +209 -0
- package/lib/esm/builtin/async/ai-runtime/state/subscription.js +47 -0
- package/lib/esm/builtin/async/ai-runtime/utils.js +42 -0
- package/lib/esm/builtin/async/react-scroll-to-bottom.js +1 -1
- package/lib/esm/utils/builtin.js +1 -0
- package/lib/esm/utils/inject-global-components.js +2 -0
- package/lib/types/builtin/async/ai-runtime/api/assistant.d.ts +18 -0
- package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +39 -0
- package/lib/types/builtin/async/ai-runtime/api/message.d.ts +39 -0
- package/lib/types/builtin/async/ai-runtime/api/request.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +54 -0
- package/lib/types/builtin/async/ai-runtime/api/subscription.d.ts +15 -0
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +11 -0
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading.d.ts +33 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/RuntimeProvider.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +61 -0
- package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +13 -0
- package/lib/types/builtin/async/ai-runtime/components/common/MessageMetadataRenderer.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/common/MessageSuggestedQuestions.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +3 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +12 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +28 -0
- package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +8 -0
- package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +13 -0
- package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/layout/index.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageActions.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +10 -0
- package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/message/ReferenceLinks.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/LanguageField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/NumberField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/SelectField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/StringField.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/parameters/index.d.ts +7 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHome.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +5 -0
- package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +9 -0
- package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +2 -0
- package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +4 -0
- package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +25 -0
- package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +6 -0
- package/lib/types/builtin/async/ai-runtime/index.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +126 -0
- package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +17 -0
- package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +40 -0
- package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +15 -0
- package/lib/types/builtin/async/ai-runtime/utils.d.ts +20 -0
- package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +3 -2
- package/lib/types/builtin/session.d.ts +11 -1
- package/lib/types/utils/builtin.d.ts +1 -0
- package/package.json +13 -8
- package/tsconfig.json +5 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
const react_1 = require("@iconify/react");
|
|
42
|
+
const material_1 = require("@mui/material");
|
|
43
|
+
const react_2 = __importDefault(require("react"));
|
|
44
|
+
const locale_1 = require("../../../locale");
|
|
45
|
+
const react_markdown_1 = __importDefault(require("../../react-markdown"));
|
|
46
|
+
const react_syntax_highlighter_1 = __importDefault(require("../../react-syntax-highlighter"));
|
|
47
|
+
const ActionButton_1 = require("./ActionButton");
|
|
48
|
+
const ReactSyntaxHighlighter = react_2.default.lazy(() => (0, react_syntax_highlighter_1.default)().then((m) => ({ default: m.Prism })));
|
|
49
|
+
const Markdown = react_2.default.lazy(() => Promise.all([
|
|
50
|
+
(0, react_markdown_1.default)(),
|
|
51
|
+
Promise.resolve().then(() => __importStar(require('https://esm.sh/remark-gfm@4?bundle'))),
|
|
52
|
+
]).then(([{ default: Markdown }, remark]) => ({
|
|
53
|
+
default: (props) => (0, jsx_runtime_1.jsx)(Markdown, Object.assign({}, props, { remarkPlugins: [remark.default] })),
|
|
54
|
+
})));
|
|
55
|
+
const MarkdownRenderer = (0, material_1.styled)((props) => ((0, jsx_runtime_1.jsx)(Markdown, Object.assign({}, props, { components: {
|
|
56
|
+
pre: MarkdownPre,
|
|
57
|
+
code: (_a) => {
|
|
58
|
+
var { node, inline, className, children } = _a, props = __rest(_a, ["node", "inline", "className", "children"]);
|
|
59
|
+
if (!children)
|
|
60
|
+
return null;
|
|
61
|
+
const match = /language-(\w+)/.exec(className || '');
|
|
62
|
+
return !inline ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: ReactSyntaxHighlighter, language: match === null || match === void 0 ? void 0 : match[1] }, props, { sx: { borderRadius: 1 }, children: String(children).replace(/\n$/, '') }))) : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "code", className: className }, props, { children: children })));
|
|
63
|
+
},
|
|
64
|
+
table: ({ className, children }) => {
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { overflow: 'auto', my: 1 }, children: (0, jsx_runtime_1.jsx)("table", { className: className, children: children }) }));
|
|
66
|
+
},
|
|
67
|
+
} })))) `
|
|
68
|
+
width: 100%;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
word-break: break-word;
|
|
71
|
+
|
|
72
|
+
> * {
|
|
73
|
+
&:first-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
|
|
74
|
+
margin-top: 0;
|
|
75
|
+
}
|
|
76
|
+
&:last-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
|
|
77
|
+
margin-bottom: 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
pre {
|
|
82
|
+
overflow: auto;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
li {
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
li p {
|
|
91
|
+
display: inline-block;
|
|
92
|
+
vertical-align: top;
|
|
93
|
+
margin: 0;
|
|
94
|
+
padding: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
table {
|
|
98
|
+
border-collapse: collapse;
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
|
|
101
|
+
th,
|
|
102
|
+
td {
|
|
103
|
+
border: 1px solid grey;
|
|
104
|
+
padding: 4px 8px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
a {
|
|
109
|
+
color: ${({ theme }) => theme.palette.primary.main};
|
|
110
|
+
|
|
111
|
+
:hover {
|
|
112
|
+
text-decoration: underline;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.writing > *:last-child {
|
|
117
|
+
&:after {
|
|
118
|
+
content: '';
|
|
119
|
+
display: inline-block;
|
|
120
|
+
vertical-align: middle;
|
|
121
|
+
height: 1.2em;
|
|
122
|
+
margin-top: -0.2em;
|
|
123
|
+
margin-left: 0.1em;
|
|
124
|
+
border-right: 0.2em solid orange;
|
|
125
|
+
border-radius: 10px;
|
|
126
|
+
animation: blink-caret 0.75s step-end infinite;
|
|
127
|
+
|
|
128
|
+
@keyframes blink-caret {
|
|
129
|
+
from,
|
|
130
|
+
to {
|
|
131
|
+
border-color: transparent;
|
|
132
|
+
}
|
|
133
|
+
50% {
|
|
134
|
+
border-color: ${({ theme }) => theme.palette.secondary.main};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
exports.default = MarkdownRenderer;
|
|
141
|
+
function MarkdownPre({ children }) {
|
|
142
|
+
const { t } = (0, locale_1.useLocaleContext)();
|
|
143
|
+
const childrenProps = children === null || children === void 0 ? void 0 : children.props;
|
|
144
|
+
if (!(childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.children))
|
|
145
|
+
return null;
|
|
146
|
+
const match = /language-(\w+)/.exec(childrenProps.className || '');
|
|
147
|
+
const language = match === null || match === void 0 ? void 0 : match[1];
|
|
148
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { component: "div", sx: {
|
|
149
|
+
fontSize: 14,
|
|
150
|
+
borderRadius: 1,
|
|
151
|
+
bgcolor: 'rgb(245, 242, 240)',
|
|
152
|
+
'> pre': { mt: '0 !important' },
|
|
153
|
+
}, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", p: 0.5, pl: 1.5, borderBottom: 1, borderColor: "grey.200", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { children: language }), (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1 }), (0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { autoReset: true, tip: t('copyToClipboard'), tipSucceed: t('copied'), title: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:copy" }), titleSucceed: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:copy-check" }), sx: { minWidth: 32, minHeight: 32, p: 0, fontSize: 18 }, onClick: () => {
|
|
154
|
+
window.navigator.clipboard.writeText(childrenProps.children);
|
|
155
|
+
} })] }), children] }));
|
|
156
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
function MenuButton({ sx, menus, children }) {
|
|
8
|
+
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
9
|
+
const open = Boolean(anchorEl);
|
|
10
|
+
const handleClick = (event) => {
|
|
11
|
+
setAnchorEl(event.currentTarget);
|
|
12
|
+
};
|
|
13
|
+
const handleClose = () => {
|
|
14
|
+
setAnchorEl(null);
|
|
15
|
+
};
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: sx, children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleClick, children: children || (0, jsx_runtime_1.jsx)(icons_material_1.MoreHoriz, {}) }), (0, jsx_runtime_1.jsx)(material_1.Menu, { disableScrollLock: true, MenuListProps: {
|
|
17
|
+
sx: {
|
|
18
|
+
p: 0.5,
|
|
19
|
+
'.MuiMenuItem-root': {
|
|
20
|
+
minWidth: 120,
|
|
21
|
+
fontSize: 14,
|
|
22
|
+
lineHeight: 1.5,
|
|
23
|
+
fontWeight: 'medium',
|
|
24
|
+
borderRadius: 0.5,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}, slotProps: {
|
|
28
|
+
paper: {
|
|
29
|
+
sx: {
|
|
30
|
+
border: 1,
|
|
31
|
+
borderColor: 'divider',
|
|
32
|
+
boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}, anchorEl: anchorEl, anchorOrigin: {
|
|
36
|
+
vertical: 'bottom',
|
|
37
|
+
horizontal: 'right',
|
|
38
|
+
}, transformOrigin: {
|
|
39
|
+
vertical: 'top',
|
|
40
|
+
horizontal: 'right',
|
|
41
|
+
}, open: open, onClick: handleClose, onClose: handleClose, children: typeof menus === 'function' ? menus() : menus })] }));
|
|
42
|
+
}
|
|
43
|
+
exports.default = MenuButton;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
const material_1 = require("@mui/material");
|
|
16
|
+
const locale_1 = require("../../../locale");
|
|
17
|
+
const subscribe_1 = require("../hooks/subscribe");
|
|
18
|
+
function PoweredBy(_a) {
|
|
19
|
+
var { assistantId } = _a, props = __rest(_a, ["assistantId"]);
|
|
20
|
+
const { t } = (0, locale_1.useLocaleContext)();
|
|
21
|
+
const { subscribeLink } = (0, subscribe_1.useSubscribeLink)({ assistantId });
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ py: 0.5 }, props, { children: [subscribeLink && ((0, jsx_runtime_1.jsxs)(material_1.Box, { className: "ai-chat-require-subscribe-footer", sx: {
|
|
23
|
+
px: 2,
|
|
24
|
+
fontSize: 12,
|
|
25
|
+
lineHeight: '20px',
|
|
26
|
+
textAlign: 'center',
|
|
27
|
+
color: 'rgba(75, 85, 99, 1)',
|
|
28
|
+
}, children: [t('requireNewSubscriptionFooter'), (0, jsx_runtime_1.jsx)(material_1.Link, { href: subscribeLink, sx: { ml: 0.5 }, children: t('subscribeNow') })] })), (0, jsx_runtime_1.jsx)(material_1.Stack, { className: "ai-chat-powered-by", direction: "row", justifyContent: "center", children: (0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "caption", sx: { display: 'inline-flex', alignItems: 'center', a: { display: 'inline-flex', alignItems: 'center' } }, children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { component: "span", fontSize: 12, color: "text.poweredBy", children: [t('poweredBy'), ' '] }), "\u00A0", (0, jsx_runtime_1.jsxs)(material_1.Link, { href: "https://www.arcblock.io", target: "_blank", color: "text.poweredBy", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", src: "https://www.arcblock.io/.well-known/service/blocklet/logo", sx: { height: 16, verticalAlign: 'middle', mr: 0.5, borderRadius: 0.5 } }), "ArcBlock"] }), "\u00A0\u00B7\u00A0", (0, jsx_runtime_1.jsxs)(material_1.Link, { href: "https://www.aigne.io", target: "_blank", color: "text.poweredBy", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", src: "https://www.aigne.io/.well-known/service/blocklet/logo", sx: { height: 16, verticalAlign: 'middle', mr: 0.5, borderRadius: 0.5 } }), "AIGNE"] })] }) })] })));
|
|
29
|
+
}
|
|
30
|
+
exports.default = PoweredBy;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const locale_1 = require("../../../locale");
|
|
9
|
+
const locales_1 = require("../locales");
|
|
10
|
+
const GlobalLoading_1 = __importDefault(require("./GlobalLoading"));
|
|
11
|
+
const ThemeProvider_1 = __importDefault(require("./ThemeProvider"));
|
|
12
|
+
function RuntimeProvider({ children }) {
|
|
13
|
+
const { locale } = (0, locale_1.useLocaleContext)();
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { translations: locales_1.translations, locale: locale, fallbackLocale: "en", children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.default, { children: (0, jsx_runtime_1.jsxs)(react_1.default.Suspense, { children: [(0, jsx_runtime_1.jsx)(GlobalLoading_1.default, { sx: { position: 'fixed', left: 0, top: 0, width: '100%', zIndex: 'snackbar' } }), children] }) }) }));
|
|
15
|
+
}
|
|
16
|
+
exports.default = RuntimeProvider;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useScrollToBottomModule = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const material_1 = require("@mui/material");
|
|
29
|
+
const react_1 = require("react");
|
|
30
|
+
const react_scroll_to_bottom_1 = __importDefault(require("../../react-scroll-to-bottom"));
|
|
31
|
+
const scrollToBottomModuleLoader = {};
|
|
32
|
+
function loadScrollToBottomModule() {
|
|
33
|
+
var _a;
|
|
34
|
+
(_a = scrollToBottomModuleLoader.promise) !== null && _a !== void 0 ? _a : (scrollToBottomModuleLoader.promise = (0, react_scroll_to_bottom_1.default)()
|
|
35
|
+
.then((mod) => {
|
|
36
|
+
scrollToBottomModuleLoader.mod = mod;
|
|
37
|
+
return mod;
|
|
38
|
+
})
|
|
39
|
+
.catch((error) => {
|
|
40
|
+
scrollToBottomModuleLoader.error = error;
|
|
41
|
+
throw error;
|
|
42
|
+
}));
|
|
43
|
+
return scrollToBottomModuleLoader;
|
|
44
|
+
}
|
|
45
|
+
function useScrollToBottomModule() {
|
|
46
|
+
const loader = loadScrollToBottomModule();
|
|
47
|
+
const [mod, setMod] = (0, react_1.useState)(loader.mod);
|
|
48
|
+
const [error, setError] = (0, react_1.useState)(loader.error);
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
try {
|
|
52
|
+
yield loader.promise;
|
|
53
|
+
if (loader.mod)
|
|
54
|
+
setMod(loader.mod);
|
|
55
|
+
else if (loader.error)
|
|
56
|
+
setError(loader.error);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
setError(error);
|
|
60
|
+
}
|
|
61
|
+
}))();
|
|
62
|
+
}, []);
|
|
63
|
+
if (mod)
|
|
64
|
+
return mod;
|
|
65
|
+
if (error)
|
|
66
|
+
throw error;
|
|
67
|
+
throw loader.promise;
|
|
68
|
+
}
|
|
69
|
+
exports.useScrollToBottomModule = useScrollToBottomModule;
|
|
70
|
+
function ScrollView(_a) {
|
|
71
|
+
var { children, initialScrollBehavior } = _a, props = __rest(_a, ["children", "initialScrollBehavior"]);
|
|
72
|
+
const { Composer } = useScrollToBottomModule();
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(Composer, { initialScrollBehavior: initialScrollBehavior, children: (0, jsx_runtime_1.jsx)(ScrollViewWithinWindow, Object.assign({}, props, { children: children })) }));
|
|
74
|
+
}
|
|
75
|
+
exports.default = ScrollView;
|
|
76
|
+
function ScrollViewWithinWindow(_a) {
|
|
77
|
+
var { children, scroller, component } = _a, props = __rest(_a, ["children", "scroller", "component"]);
|
|
78
|
+
const { setTarget } = useScrollToBottomModule().useInternalContext();
|
|
79
|
+
const ele = useFakeScrollElementOfWindow();
|
|
80
|
+
(0, react_1.useEffect)(() => {
|
|
81
|
+
if (scroller === 'window') {
|
|
82
|
+
setTarget(ele);
|
|
83
|
+
}
|
|
84
|
+
}, [scroller]);
|
|
85
|
+
if (!component)
|
|
86
|
+
return children;
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: component }, props, { ref: !scroller ? setTarget : undefined, children: children })));
|
|
88
|
+
}
|
|
89
|
+
function useFakeScrollElementOfWindow() {
|
|
90
|
+
return (0, react_1.useMemo)(() => {
|
|
91
|
+
const e = document.scrollingElement;
|
|
92
|
+
return new Proxy(e, {
|
|
93
|
+
get: (_, p) => {
|
|
94
|
+
if (p === 'offsetHeight')
|
|
95
|
+
return window.innerHeight;
|
|
96
|
+
if (['addEventListener', 'removeEventListener'].includes(p))
|
|
97
|
+
return window[p].bind(window);
|
|
98
|
+
const v = e[p];
|
|
99
|
+
if (v instanceof Function)
|
|
100
|
+
return v.bind(e);
|
|
101
|
+
return v;
|
|
102
|
+
},
|
|
103
|
+
set: (_, p, v) => {
|
|
104
|
+
e[p] = v;
|
|
105
|
+
return true;
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}, []);
|
|
109
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.SocialShareButtons = exports.SocialShareMenu = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("@iconify/react");
|
|
20
|
+
const material_1 = require("@mui/material");
|
|
21
|
+
const react_2 = require("react");
|
|
22
|
+
const react_share_1 = require("react-share");
|
|
23
|
+
const locale_1 = require("../../../locale");
|
|
24
|
+
const locales_1 = require("../locales");
|
|
25
|
+
const utils_1 = require("../utils");
|
|
26
|
+
const MenuButton_1 = __importDefault(require("./MenuButton"));
|
|
27
|
+
const getFormattedUrl = (url) => {
|
|
28
|
+
// remove page & sessionId query params
|
|
29
|
+
const urlObj = new URL(url);
|
|
30
|
+
urlObj.searchParams.delete('page');
|
|
31
|
+
urlObj.searchParams.delete('sessionId');
|
|
32
|
+
return urlObj.toString();
|
|
33
|
+
};
|
|
34
|
+
function SocialShare(props) {
|
|
35
|
+
const { type = 'menu' } = props, restProps = __rest(props, ["type"]);
|
|
36
|
+
const { locale } = (0, locale_1.useLocaleContext)();
|
|
37
|
+
const renderContent = (0, react_2.useCallback)(() => {
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
if (type === 'buttons') {
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(SocialShareButtons, Object.assign({}, restProps));
|
|
41
|
+
}
|
|
42
|
+
return (0, jsx_runtime_1.jsx)(SocialShareMenu, Object.assign({}, restProps));
|
|
43
|
+
}, [type, restProps]);
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { translations: locales_1.translations, locale: locale, fallbackLocale: "en", children: renderContent() }));
|
|
45
|
+
}
|
|
46
|
+
exports.default = SocialShare;
|
|
47
|
+
function SocialShareMenu(_a) {
|
|
48
|
+
var { url = getFormattedUrl(window.location.href), content } = _a, restProps = __rest(_a, ["url", "content"]);
|
|
49
|
+
const theme = (0, material_1.useTheme)();
|
|
50
|
+
const { t } = (0, locale_1.useLocaleContext)();
|
|
51
|
+
const itemIconSx = {
|
|
52
|
+
width: 22,
|
|
53
|
+
height: 22,
|
|
54
|
+
border: 1,
|
|
55
|
+
borderColor: theme.palette.text.secondary,
|
|
56
|
+
borderRadius: 0.75,
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
};
|
|
61
|
+
const buttonSx = {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
gap: 1.5,
|
|
65
|
+
minWidth: 120,
|
|
66
|
+
lineHeight: '1!important',
|
|
67
|
+
};
|
|
68
|
+
const iconProps = {
|
|
69
|
+
bgStyle: { fill: '#fff' },
|
|
70
|
+
iconFillColor: theme.palette.text.secondary,
|
|
71
|
+
style: {
|
|
72
|
+
borderRadius: '6px',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
const renderShareIcon = () => {
|
|
76
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
77
|
+
return (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: () => (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:share" }) }, restProps));
|
|
78
|
+
};
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(MenuButton_1.default, { menus: [
|
|
80
|
+
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.TwitterShareButton, url: url, title: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.XIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToX') })] }) }, "shareOnX"),
|
|
81
|
+
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.TelegramShareButton, url: url, title: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.TelegramIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToTelegram') })] }) }, "shareOnTelegram"),
|
|
82
|
+
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.RedditShareButton, url: url, title: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.RedditIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToReddit') })] }) }, "shareOnReddit"),
|
|
83
|
+
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.WeiboShareButton, url: url, title: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.WeiboIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToWeibo') })] }) }, "shareOnWeibo"),
|
|
84
|
+
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.FacebookShareButton, url: url, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.FacebookIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToFacebook') })] }) }, "shareOnFacebook"),
|
|
85
|
+
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.LinkedinShareButton, url: url, summary: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.LinkedinIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToLinkedin') })] }) }, "shareOnLinkedin"),
|
|
86
|
+
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "div", sx: buttonSx, onClick: () => {
|
|
87
|
+
window.navigator.clipboard.writeText(url);
|
|
88
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: itemIconSx, round: true, children: (0, jsx_runtime_1.jsx)(react_1.Icon, Object.assign({ icon: "tabler:link" }, iconProps)) }), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.copyLink') })] }) }, "copyToClipboard"),
|
|
89
|
+
], children: renderShareIcon() }));
|
|
90
|
+
}
|
|
91
|
+
exports.SocialShareMenu = SocialShareMenu;
|
|
92
|
+
function SocialShareButtons(_a) {
|
|
93
|
+
var { url = getFormattedUrl(window.location.href), content, sx, itemSx, onClick, bgFill, iconFill } = _a, rest = __rest(_a, ["url", "content", "sx", "itemSx", "onClick", "bgFill", "iconFill"]);
|
|
94
|
+
const mergedSx = (0, utils_1.mergeSx)({ display: 'flex', alignItems: 'center', gap: 0.5, lineHeight: 1 }, sx);
|
|
95
|
+
const mergedItemSx = (0, utils_1.mergeSx)({ width: { xs: 24, sm: 28 }, height: { xs: 24, sm: 28 }, borderRadius: 1 }, itemSx);
|
|
96
|
+
const iconProps = {
|
|
97
|
+
bgStyle: { fill: bgFill || '#bbb' },
|
|
98
|
+
iconFillColor: iconFill || '#fff',
|
|
99
|
+
};
|
|
100
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: mergedSx }, rest, { children: [(0, jsx_runtime_1.jsx)(react_share_1.TwitterShareButton, { url: url, title: content, children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.XIcon, sx: mergedItemSx }, iconProps)) }), (0, jsx_runtime_1.jsx)(react_share_1.TelegramShareButton, { url: url, title: content, children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.TelegramIcon, sx: mergedItemSx }, iconProps)) }), (0, jsx_runtime_1.jsx)(react_share_1.RedditShareButton, { url: url, title: content, children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.RedditIcon, sx: mergedItemSx }, iconProps)) }), (0, jsx_runtime_1.jsx)(react_share_1.WeiboShareButton, { url: url, title: content, children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.WeiboIcon, sx: mergedItemSx }, iconProps)) }), (0, jsx_runtime_1.jsx)(react_share_1.FacebookShareButton, { url: url, children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.FacebookIcon, sx: mergedItemSx }, iconProps)) }), (0, jsx_runtime_1.jsx)(react_share_1.LinkedinShareButton, { url: url, summary: content, children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.LinkedinIcon, sx: mergedItemSx }, iconProps)) })] })));
|
|
101
|
+
}
|
|
102
|
+
exports.SocialShareButtons = SocialShareButtons;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
16
|
+
const material_1 = require("@mui/material");
|
|
17
|
+
const react_1 = require("react");
|
|
18
|
+
function ThemeProvider({ children, template, transparentHeaderBg, }) {
|
|
19
|
+
const theme = (0, material_1.useTheme)();
|
|
20
|
+
const colors = {
|
|
21
|
+
default: {
|
|
22
|
+
color: undefined,
|
|
23
|
+
bg: '#ffffff',
|
|
24
|
+
// primary: '#333843',
|
|
25
|
+
primary: '#3B82F6',
|
|
26
|
+
},
|
|
27
|
+
blue: {
|
|
28
|
+
color: 'white',
|
|
29
|
+
bg: 'linear-gradient(180deg, #0D60FF 0%, #E2EDFE 100%)',
|
|
30
|
+
primary: '#0D60FF',
|
|
31
|
+
},
|
|
32
|
+
red: {
|
|
33
|
+
color: 'white',
|
|
34
|
+
bg: 'linear-gradient(180deg, #F65F84 0%, #817DE6 100%), linear-gradient(180deg, #9300FF 0%, #D900FF 100%)',
|
|
35
|
+
primary: '#F65F84',
|
|
36
|
+
},
|
|
37
|
+
green: {
|
|
38
|
+
color: 'white',
|
|
39
|
+
bg: 'linear-gradient(180deg, #149E8C 0%, #35E77D 100%)',
|
|
40
|
+
primary: '#149E8C',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const color = colors[template] || colors.default;
|
|
44
|
+
const newTheme = (0, react_1.useMemo)(() => {
|
|
45
|
+
const themeOptions = {
|
|
46
|
+
components: {
|
|
47
|
+
MuiSelect: {
|
|
48
|
+
defaultProps: { IconComponent: icons_material_1.ArrowDropDownRounded },
|
|
49
|
+
},
|
|
50
|
+
MuiTextField: {
|
|
51
|
+
variants: [
|
|
52
|
+
{
|
|
53
|
+
props: {},
|
|
54
|
+
style: ({ theme }) => theme.unstable_sx({
|
|
55
|
+
'.MuiInputBase-root': {
|
|
56
|
+
fieldset: { borderColor: 'rgba(229, 231, 235, 1)' },
|
|
57
|
+
'&:hover': {
|
|
58
|
+
fieldset: {
|
|
59
|
+
border: 'none',
|
|
60
|
+
boxShadow: `0px 0px 0px 4px ${(0, material_1.alpha)(theme.palette.primary.main, 0.2)}, 0px 0px 0px 1px ${theme.palette.primary.main}`,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
'&.Mui-focused fieldset': {
|
|
64
|
+
border: 'none',
|
|
65
|
+
boxShadow: `0px 0px 0px 4px ${(0, material_1.alpha)(theme.palette.primary.main, 0.2)}, 0px 0px 0px 1px ${theme.palette.primary.main}`,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
props: { select: true },
|
|
72
|
+
style: (_a) => {
|
|
73
|
+
var { theme } = _a, p = __rest(_a, ["theme"]);
|
|
74
|
+
const { placeholder } = p;
|
|
75
|
+
return theme.unstable_sx({
|
|
76
|
+
'& .MuiSelect-select .notranslate::after': placeholder
|
|
77
|
+
? {
|
|
78
|
+
content: `"${placeholder}"`,
|
|
79
|
+
opacity: 0.42,
|
|
80
|
+
}
|
|
81
|
+
: {},
|
|
82
|
+
'& .MuiFormLabel-root:not(.MuiInputLabel-shrink) + .MuiInputBase-root > .MuiSelect-select .notranslate::after': {
|
|
83
|
+
opacity: 0,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
MuiListItemButton: {
|
|
91
|
+
variants: [
|
|
92
|
+
{
|
|
93
|
+
props: {},
|
|
94
|
+
style: ({ theme }) => theme.unstable_sx({
|
|
95
|
+
fontSize: 13,
|
|
96
|
+
color: '#010714',
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
MuiDialog: {
|
|
102
|
+
variants: [
|
|
103
|
+
{
|
|
104
|
+
props: {},
|
|
105
|
+
style: ({ theme }) => theme.unstable_sx({
|
|
106
|
+
'.MuiDialogTitle-root': {
|
|
107
|
+
px: 2.5,
|
|
108
|
+
py: 2,
|
|
109
|
+
},
|
|
110
|
+
'.MuiDialogContent-root': {
|
|
111
|
+
px: 2.5,
|
|
112
|
+
py: 2,
|
|
113
|
+
},
|
|
114
|
+
'.MuiDialogActions-root': {
|
|
115
|
+
px: 2.5,
|
|
116
|
+
py: 2,
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
const paletteTheme = (0, material_1.createTheme)({
|
|
125
|
+
palette: {
|
|
126
|
+
primary: {
|
|
127
|
+
main: color.primary,
|
|
128
|
+
},
|
|
129
|
+
secondary: {
|
|
130
|
+
main: '#010714',
|
|
131
|
+
},
|
|
132
|
+
text: {
|
|
133
|
+
secondary: '#98A3B1',
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
poweredBy: 'rgba(209, 213, 219, 1)',
|
|
136
|
+
},
|
|
137
|
+
// @ts-ignore custom `black` color
|
|
138
|
+
black: {
|
|
139
|
+
main: '#010714',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
return (0, material_1.createTheme)(theme, themeOptions, {
|
|
144
|
+
palette: {
|
|
145
|
+
primary: paletteTheme.palette.primary,
|
|
146
|
+
secondary: paletteTheme.palette.secondary,
|
|
147
|
+
text: paletteTheme.palette.text,
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
black: paletteTheme.palette.black,
|
|
150
|
+
background: {
|
|
151
|
+
default: color.bg,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
shape: {
|
|
155
|
+
borderRadius: 8,
|
|
156
|
+
},
|
|
157
|
+
shadows: [
|
|
158
|
+
'none',
|
|
159
|
+
'0px 0px 0px 1px rgba(2, 7, 19, 0.08), 0px 1px 2px -1px rgba(2, 7, 19, 0.08), 0px 2px 4px 0px rgba(2, 7, 19, 0.04)',
|
|
160
|
+
'0px 0px 0px 1px rgba(2, 7, 19, 0.08), 0px 1px 2px -1px rgba(2, 7, 19, 0.08), 0px 2px 8px 0px rgba(2, 7, 19, 0.10)',
|
|
161
|
+
...paletteTheme.shadows.slice(3),
|
|
162
|
+
],
|
|
163
|
+
});
|
|
164
|
+
}, [theme]);
|
|
165
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.ThemeProvider, { theme: newTheme, children: [(0, jsx_runtime_1.jsx)(material_1.GlobalStyles, { styles: {
|
|
166
|
+
'.page-header': transparentHeaderBg
|
|
167
|
+
? {
|
|
168
|
+
backgroundColor: 'transparent !important',
|
|
169
|
+
color: color.color,
|
|
170
|
+
button: {
|
|
171
|
+
color: color.color,
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
: {
|
|
175
|
+
// with border bottom
|
|
176
|
+
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
177
|
+
},
|
|
178
|
+
body: {
|
|
179
|
+
background: 'transparent !important',
|
|
180
|
+
'&:before': {
|
|
181
|
+
content: '""',
|
|
182
|
+
position: 'fixed',
|
|
183
|
+
left: 0,
|
|
184
|
+
top: 0,
|
|
185
|
+
right: 0,
|
|
186
|
+
bottom: 0,
|
|
187
|
+
background: color.bg,
|
|
188
|
+
zIndex: -1,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
} }), children] }));
|
|
192
|
+
}
|
|
193
|
+
exports.default = ThemeProvider;
|