@ant-design/agentic-ui 2.29.5 → 2.29.7
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/dist/AILabel/index.js +17 -8
- package/dist/AgenticLayout/index.js +3 -5
- package/dist/BackTo/BackBottom.js +17 -8
- package/dist/BackTo/BackTop.js +17 -8
- package/dist/BackTo/ScrollVisibleButton.js +75 -11
- package/dist/Bubble/AIBubble.js +131 -121
- package/dist/Bubble/Avatar/index.js +19 -10
- package/dist/Bubble/FileView.js +2 -2
- package/dist/Bubble/List/PureBubbleList.js +4 -5
- package/dist/Bubble/List/index.js +4 -5
- package/dist/Bubble/List/style.js +3 -0
- package/dist/Bubble/MessagesContent/BubbleExtra.js +108 -93
- package/dist/Bubble/MessagesContent/CopyButton/index.js +36 -26
- package/dist/Bubble/MessagesContent/DocInfo.js +19 -10
- package/dist/Bubble/MessagesContent/MarkdownPreview.js +2 -2
- package/dist/Bubble/MessagesContent/index.js +149 -130
- package/dist/Bubble/PureBubble.js +151 -133
- package/dist/Bubble/UserBubble.js +1 -1
- package/dist/Bubble/style.js +2 -2
- package/dist/Bubble/types/BubbleExtra.js +4 -1
- package/dist/Bubble/types/DocInfo.js +9 -1
- package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_0.png +0 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_1.png +0 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_2.png +0 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/index.d.ts +51 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/index.js +45 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/lottie.d.ts +85 -0
- package/dist/ChatLayout/components/FooterBackgroundLottie/lottie.js +382 -0
- package/dist/ChatLayout/index.js +52 -14
- package/dist/ChatLayout/style.js +11 -0
- package/dist/ChatLayout/types.d.ts +28 -0
- package/dist/Components/ActionIconBox/index.js +30 -38
- package/dist/Components/ActionItemBox/ActionItemBox.js +1 -1
- package/dist/Components/Button/SwitchButton/index.js +18 -17
- package/dist/Components/LayoutHeader/index.js +5 -3
- package/dist/Components/LayoutHeader/style.js +5 -0
- package/dist/Components/Loading/CreativeRecommendationLoading.js +2 -2
- package/dist/Components/Loading/CreativeSparkLoading.js +2 -2
- package/dist/Components/SuggestionList/index.js +20 -19
- package/dist/Components/TextAnimate/index.js +19 -10
- package/dist/Components/TypingAnimation/index.js +19 -10
- package/dist/Components/effects/EffectPlayer.js +20 -11
- package/dist/Components/icons/LoadingSpinnerIcon.js +19 -10
- package/dist/History/components/HistoryActionsBox.js +21 -23
- package/dist/History/components/HistoryItem.js +61 -53
- package/dist/History/components/HistoryRunningIcon.js +19 -10
- package/dist/History/components/LoadMoreComponent.js +61 -55
- package/dist/History/components/NewChatComponent.js +53 -47
- package/dist/History/components/SearchComponent.js +24 -26
- package/dist/History/hooks/useHistory.js +80 -73
- package/dist/History/index.js +17 -16
- package/dist/History/menu.js +17 -8
- package/dist/Hooks/useAutoScroll.js +19 -19
- package/dist/Hooks/useDebounceFn/index.js +51 -45
- package/dist/Hooks/useElementSize.d.ts +5 -0
- package/dist/Hooks/useElementSize.js +71 -0
- package/dist/Hooks/useIntersectionOnce.js +17 -8
- package/dist/Hooks/useLanguage.d.ts +3 -0
- package/dist/I18n/locales.d.ts +3 -0
- package/dist/I18n/locales.js +8 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +22 -12
- package/dist/MarkdownEditor/editor/Editor.js +31 -39
- package/dist/MarkdownEditor/editor/components/CommentList/index.js +29 -37
- package/dist/MarkdownEditor/editor/elements/Image/index.js +86 -71
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +17 -16
- package/dist/MarkdownEditor/editor/elements/Media/index.js +107 -92
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +19 -10
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +17 -16
- package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +1 -1
- package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +1 -1
- package/dist/MarkdownEditor/editor/parser/parse/parseEmptyLines.js +1 -1
- package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +4 -1
- package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +2 -2
- package/dist/MarkdownEditor/editor/parser/remarkParse.js +3 -1
- package/dist/MarkdownEditor/editor/plugins/handlePaste.js +25 -30
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/arrow.js +0 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/enter.js +0 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.js +0 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/tab.js +0 -1
- package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +39 -53
- package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +1 -1
- package/dist/MarkdownEditor/editor/plugins/useOnchange.js +28 -22
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +1 -1
- package/dist/MarkdownEditor/editor/store.js +17 -13
- package/dist/MarkdownEditor/editor/tools/InsertAutocomplete.js +202 -197
- package/dist/MarkdownEditor/editor/tools/InsertLink.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.js +142 -134
- package/dist/MarkdownEditor/editor/utils/ace.js +61 -61
- package/dist/MarkdownEditor/editor/utils/editorUtils.js +11 -4
- package/dist/MarkdownEditor/editor/utils/index.js +8 -2
- package/dist/MarkdownEditor/editor/utils/keyboard.js +31 -35
- package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +23 -17
- package/dist/MarkdownEditor/editor/utils/media.js +21 -23
- package/dist/MarkdownEditor/editor/utils/performanceMonitor.js +55 -50
- package/dist/MarkdownEditor/editor/utils/useLocalState.js +11 -4
- package/dist/MarkdownEditor/types.d.ts +1 -0
- package/dist/MarkdownEditor/types.js +4 -1
- package/dist/MarkdownEditor/utils/native-table/native-table-editor.js +14 -14
- package/dist/MarkdownEditor/utils/native-table/native-table-keyboard.js +2 -2
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +1 -0
- package/dist/MarkdownInputField/AttachmentButton/index.js +33 -31
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +14 -7
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +2 -2
- package/dist/MarkdownInputField/FileMapView/index.js +17 -16
- package/dist/MarkdownInputField/FilePaste/index.js +25 -30
- package/dist/MarkdownInputField/FileUploadManager/index.js +39 -40
- package/dist/MarkdownInputField/MarkdownInputField.js +38 -29
- package/dist/MarkdownInputField/QuickActions/index.js +66 -60
- package/dist/MarkdownInputField/SendButton/index.js +22 -13
- package/dist/MarkdownInputField/Suggestion/index.js +17 -16
- package/dist/MarkdownInputField/VoiceInput/index.js +51 -45
- package/dist/MarkdownInputField/VoiceInputManager/index.js +133 -125
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +103 -101
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldStyles.js +1 -1
- package/dist/MarkdownInputField/style.js +1 -2
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.js +14 -1
- package/dist/Plugins/chart/BarChart/index.js +8 -8
- package/dist/Plugins/chart/ChartRender.js +52 -46
- package/dist/Plugins/chart/DonutChart/index.js +26 -17
- package/dist/Plugins/chart/DonutChart/plugins.js +1 -1
- package/dist/Plugins/chart/DonutChart/types.js +1 -1
- package/dist/Plugins/chart/FunnelChart/index.js +31 -28
- package/dist/Plugins/chart/LineChart/index.js +19 -10
- package/dist/Plugins/chart/RadarChart/index.js +19 -10
- package/dist/Plugins/chart/ScatterChart/index.js +19 -10
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +20 -11
- package/dist/Plugins/chart/index.js +31 -13
- package/dist/Plugins/chart/loadChartRuntime.js +17 -16
- package/dist/Plugins/chart/types/classNames.js +4 -1
- package/dist/Plugins/chart/utils.js +20 -20
- package/dist/Plugins/code/CodeUI/Katex/Katex.js +52 -46
- package/dist/Plugins/code/components/AceEditor.js +149 -133
- package/dist/Plugins/code/components/CodeRenderer.js +7 -7
- package/dist/Plugins/code/components/CodeToolbar.js +2 -2
- package/dist/Plugins/code/components/LanguageSelector.js +6 -6
- package/dist/Plugins/code/components/LoadImage.js +5 -5
- package/dist/Plugins/code/components/ThinkBlock.js +8 -8
- package/dist/Plugins/code/hooks/useCodeEditorState.js +5 -5
- package/dist/Plugins/code/index.js +6 -6
- package/dist/Plugins/code/langIconMap.js +0 -1
- package/dist/Plugins/code/langIcons/AbapIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ActionscriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/AdaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ApacheIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ApexIcon.js +19 -10
- package/dist/Plugins/code/langIcons/AplIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ApplescriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/AstroIcon.js +19 -10
- package/dist/Plugins/code/langIcons/AwkIcon.js +19 -10
- package/dist/Plugins/code/langIcons/BallerinaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/BatIcon.js +19 -10
- package/dist/Plugins/code/langIcons/BicepIcon.js +19 -10
- package/dist/Plugins/code/langIcons/BladeIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CadenceIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ClojureIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CmakeIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CobolIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CodeqlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CoffeeIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ConsoleIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CppIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CrystalIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CsharpIcon.js +19 -10
- package/dist/Plugins/code/langIcons/CssIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DartIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DatabaseIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DiffIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DockerIcon.js +19 -10
- package/dist/Plugins/code/langIcons/DotenvIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ElixirIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ElmIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ErbIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ErlangIcon.js +19 -10
- package/dist/Plugins/code/langIcons/FsharpIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GdscriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GlslIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GnuplotIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GoIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GraphqlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/GroovyIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HackIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HamlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HandlebarsIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HaskellIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HclIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HclLightIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HjsonIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HlslIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HtmlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/HttpIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ImbaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/IniIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JavaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JavascriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JinjaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/Json5Icon.js +19 -10
- package/dist/Plugins/code/langIcons/JsonIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JsonnetIcon.js +19 -10
- package/dist/Plugins/code/langIcons/JuliaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/KotlinIcon.js +19 -10
- package/dist/Plugins/code/langIcons/KustoIcon.js +19 -10
- package/dist/Plugins/code/langIcons/LessIcon.js +19 -10
- package/dist/Plugins/code/langIcons/LiquidIcon.js +19 -10
- package/dist/Plugins/code/langIcons/LispIcon.js +19 -10
- package/dist/Plugins/code/langIcons/LuaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MakefileIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MarkdownIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MarkojsIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MatlabIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MdxIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MermaidIcon.js +19 -10
- package/dist/Plugins/code/langIcons/MojoIcon.js +19 -10
- package/dist/Plugins/code/langIcons/NginxIcon.js +19 -10
- package/dist/Plugins/code/langIcons/NimIcon.js +19 -10
- package/dist/Plugins/code/langIcons/NixIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ObjectiveCIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ObjectiveCppIcon.js +19 -10
- package/dist/Plugins/code/langIcons/OcamlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PascalIcon.js +19 -10
- package/dist/Plugins/code/langIcons/Perl6Icon.js +19 -10
- package/dist/Plugins/code/langIcons/PerlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PhpIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PostcssIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PowershellIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PrismaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PrologIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ProtoIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PugIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PuppetIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PurescriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/PythonIcon.js +19 -10
- package/dist/Plugins/code/langIcons/RIcon.js +19 -10
- package/dist/Plugins/code/langIcons/RazorIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ReactIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ReactTsIcon.js +19 -10
- package/dist/Plugins/code/langIcons/RubyIcon.js +19 -10
- package/dist/Plugins/code/langIcons/RustIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SasIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SassIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ScalaIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SchemeIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ShaderlabIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SolidityIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SparqlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/StataIcon.js +19 -10
- package/dist/Plugins/code/langIcons/StylusIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SvelteIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SwiftIcon.js +19 -10
- package/dist/Plugins/code/langIcons/SystemverilogIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TclIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TexIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TomlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TwigIcon.js +19 -10
- package/dist/Plugins/code/langIcons/TypescriptIcon.js +19 -10
- package/dist/Plugins/code/langIcons/VerilogIcon.js +19 -10
- package/dist/Plugins/code/langIcons/VhdlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/VimIcon.js +19 -10
- package/dist/Plugins/code/langIcons/VueIcon.js +19 -10
- package/dist/Plugins/code/langIcons/WebassemblyIcon.js +19 -10
- package/dist/Plugins/code/langIcons/WenyanIcon.js +19 -10
- package/dist/Plugins/code/langIcons/WgslIcon.js +19 -10
- package/dist/Plugins/code/langIcons/WolframlanguageIcon.js +19 -10
- package/dist/Plugins/code/langIcons/XmlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/XslIcon.js +19 -10
- package/dist/Plugins/code/langIcons/YamlIcon.js +19 -10
- package/dist/Plugins/code/langIcons/ZigIcon.js +19 -10
- package/dist/Plugins/code/loadAceEditor.js +21 -23
- package/dist/Plugins/code/utils/langOptions.js +6 -6
- package/dist/Plugins/formatter/index.js +6 -6
- package/dist/Plugins/katex/InlineKatex.js +52 -46
- package/dist/Plugins/katex/Katex.js +53 -47
- package/dist/Plugins/katex/index.js +6 -6
- package/dist/Plugins/katex/loadKatex.js +27 -29
- package/dist/Plugins/mermaid/Mermaid.js +34 -28
- package/dist/Plugins/mermaid/useMermaidRender.js +103 -97
- package/dist/Plugins/mermaid/utils.js +25 -17
- package/dist/Schema/SchemaEditor/AceEditorWrapper.js +162 -150
- package/dist/Schema/SchemaEditor/index.js +8 -1
- package/dist/Schema/SchemaForm/index.js +2 -2
- package/dist/Schema/SchemaRenderer/index.js +45 -46
- package/dist/ThoughtChainList/index.js +22 -13
- package/dist/ToolUseBar/BarItem/Content.js +3 -3
- package/dist/ToolUseBar/BarItem/index.js +10 -3
- package/dist/ToolUseBar/index.js +19 -10
- package/dist/ToolUseBar/style.js +4 -4
- package/dist/Types/common.js +4 -1
- package/dist/Types/message.js +4 -1
- package/dist/Utils/debugUtils.js +8 -8
- package/dist/Utils/getScroll.js +12 -5
- package/dist/Utils/loadCSS.js +23 -22
- package/dist/Utils/proxySandbox/ProxySandbox.js +42 -34
- package/dist/Utils/proxySandbox/SecurityContextManager.js +54 -54
- package/dist/Utils/proxySandbox/index.js +25 -22
- package/dist/Utils/proxySandbox/types.js +11 -11
- package/dist/Utils/scrollTo.js +8 -1
- package/dist/WelcomeMessage/index.js +1 -1
- package/dist/Workspace/File/FileComponent.js +91 -66
- package/dist/Workspace/File/PreviewComponent.js +15 -8
- package/dist/Workspace/File/index.d.ts +1 -1
- package/dist/Workspace/File/style.js +7 -0
- package/dist/Workspace/RealtimeFollow/index.js +1 -2
- package/dist/Workspace/index.js +13 -11
- package/dist/Workspace/style.js +8 -14
- package/dist/Workspace/types.d.ts +50 -0
- package/dist/Workspace/types.js +0 -1
- package/package.json +25 -25
|
@@ -87,6 +87,13 @@ function _define_property(obj, key, value) {
|
|
|
87
87
|
}
|
|
88
88
|
return obj;
|
|
89
89
|
}
|
|
90
|
+
function _instanceof(left, right) {
|
|
91
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
92
|
+
return !!right[Symbol.hasInstance](left);
|
|
93
|
+
} else {
|
|
94
|
+
return left instanceof right;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
90
97
|
function _iterable_to_array(iter) {
|
|
91
98
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
92
99
|
}
|
|
@@ -150,7 +157,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
150
157
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
151
158
|
}
|
|
152
159
|
function _ts_generator(thisArg, body) {
|
|
153
|
-
var f, y, t,
|
|
160
|
+
var f, y, t, _ = {
|
|
154
161
|
label: 0,
|
|
155
162
|
sent: function() {
|
|
156
163
|
if (t[0] & 1) throw t[1];
|
|
@@ -158,13 +165,17 @@ function _ts_generator(thisArg, body) {
|
|
|
158
165
|
},
|
|
159
166
|
trys: [],
|
|
160
167
|
ops: []
|
|
161
|
-
};
|
|
162
|
-
return g
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
169
|
+
return d(g, "next", {
|
|
170
|
+
value: verb(0)
|
|
171
|
+
}), d(g, "throw", {
|
|
172
|
+
value: verb(1)
|
|
173
|
+
}), d(g, "return", {
|
|
174
|
+
value: verb(2)
|
|
175
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
176
|
+
value: function() {
|
|
177
|
+
return this;
|
|
178
|
+
}
|
|
168
179
|
}), g;
|
|
169
180
|
function verb(n) {
|
|
170
181
|
return function(v) {
|
|
@@ -176,7 +187,7 @@ function _ts_generator(thisArg, body) {
|
|
|
176
187
|
}
|
|
177
188
|
function step(op) {
|
|
178
189
|
if (f) throw new TypeError("Generator is already executing.");
|
|
179
|
-
while(_)try {
|
|
190
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
180
191
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
181
192
|
if (y = 0, t) op = [
|
|
182
193
|
op[0] & 2,
|
|
@@ -385,13 +396,13 @@ var DANGEROUS_GLOBALS = [
|
|
|
385
396
|
function ProxySandbox() {
|
|
386
397
|
var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
387
398
|
_class_call_check(this, ProxySandbox);
|
|
399
|
+
var _config_allowConsole, _config_allowTimers, _config_strictMode, _config_allowDOM;
|
|
388
400
|
_define_property(this, "config", void 0);
|
|
389
401
|
_define_property(this, "globalProxy", void 0);
|
|
390
402
|
_define_property(this, "sandboxGlobal", void 0);
|
|
391
403
|
_define_property(this, "isActive", false);
|
|
392
404
|
_define_property(this, "timeoutId", null);
|
|
393
405
|
_define_property(this, "startTime", 0);
|
|
394
|
-
var _config_allowConsole, _config_allowTimers, _config_strictMode, _config_allowDOM;
|
|
395
406
|
this.config = {
|
|
396
407
|
allowedGlobals: config.allowedGlobals || SAFE_GLOBALS,
|
|
397
408
|
forbiddenGlobals: config.forbiddenGlobals || DANGEROUS_GLOBALS,
|
|
@@ -965,14 +976,13 @@ var DANGEROUS_GLOBALS = [
|
|
|
965
976
|
value: /**
|
|
966
977
|
* 在沙箱中执行代码
|
|
967
978
|
*/ function execute(code, injectedParams) {
|
|
968
|
-
var _this = this;
|
|
969
979
|
return _async_to_generator(function() {
|
|
970
980
|
var result, error, success, err, executionTime;
|
|
971
981
|
return _ts_generator(this, function(_state) {
|
|
972
982
|
switch(_state.label){
|
|
973
983
|
case 0:
|
|
974
|
-
|
|
975
|
-
|
|
984
|
+
this.startTime = performance.now();
|
|
985
|
+
this.isActive = true;
|
|
976
986
|
success = false;
|
|
977
987
|
_state.label = 1;
|
|
978
988
|
case 1:
|
|
@@ -988,7 +998,7 @@ var DANGEROUS_GLOBALS = [
|
|
|
988
998
|
];
|
|
989
999
|
return [
|
|
990
1000
|
4,
|
|
991
|
-
|
|
1001
|
+
this.executeWithWorker(code, injectedParams)
|
|
992
1002
|
];
|
|
993
1003
|
case 2:
|
|
994
1004
|
result = _state.sent();
|
|
@@ -997,13 +1007,13 @@ var DANGEROUS_GLOBALS = [
|
|
|
997
1007
|
7
|
|
998
1008
|
];
|
|
999
1009
|
case 3:
|
|
1000
|
-
if (!
|
|
1010
|
+
if (!this.isObviousInfiniteLoop(code)) return [
|
|
1001
1011
|
3,
|
|
1002
1012
|
5
|
|
1003
1013
|
];
|
|
1004
1014
|
return [
|
|
1005
1015
|
4,
|
|
1006
|
-
|
|
1016
|
+
this.executeWithInstructionLimit(code, injectedParams)
|
|
1007
1017
|
];
|
|
1008
1018
|
case 4:
|
|
1009
1019
|
// 只对明显的死循环使用指令计数
|
|
@@ -1015,7 +1025,7 @@ var DANGEROUS_GLOBALS = [
|
|
|
1015
1025
|
case 5:
|
|
1016
1026
|
return [
|
|
1017
1027
|
4,
|
|
1018
|
-
|
|
1028
|
+
this.executeWithTimeout(code, injectedParams)
|
|
1019
1029
|
];
|
|
1020
1030
|
case 6:
|
|
1021
1031
|
// 对正常代码直接执行,但有超时保护
|
|
@@ -1029,19 +1039,19 @@ var DANGEROUS_GLOBALS = [
|
|
|
1029
1039
|
];
|
|
1030
1040
|
case 8:
|
|
1031
1041
|
err = _state.sent();
|
|
1032
|
-
error = err
|
|
1042
|
+
error = _instanceof(err, Error) ? err : new Error(String(err));
|
|
1033
1043
|
success = false;
|
|
1034
1044
|
return [
|
|
1035
1045
|
3,
|
|
1036
1046
|
10
|
|
1037
1047
|
];
|
|
1038
1048
|
case 9:
|
|
1039
|
-
|
|
1049
|
+
this.cleanup();
|
|
1040
1050
|
return [
|
|
1041
1051
|
7
|
|
1042
1052
|
];
|
|
1043
1053
|
case 10:
|
|
1044
|
-
executionTime = performance.now() -
|
|
1054
|
+
executionTime = performance.now() - this.startTime;
|
|
1045
1055
|
return [
|
|
1046
1056
|
2,
|
|
1047
1057
|
{
|
|
@@ -1049,12 +1059,12 @@ var DANGEROUS_GLOBALS = [
|
|
|
1049
1059
|
success: success,
|
|
1050
1060
|
error: error,
|
|
1051
1061
|
executionTime: executionTime,
|
|
1052
|
-
memoryUsage:
|
|
1062
|
+
memoryUsage: this.getMemoryUsage()
|
|
1053
1063
|
}
|
|
1054
1064
|
];
|
|
1055
1065
|
}
|
|
1056
1066
|
});
|
|
1057
|
-
})();
|
|
1067
|
+
}).call(this);
|
|
1058
1068
|
}
|
|
1059
1069
|
},
|
|
1060
1070
|
{
|
|
@@ -1083,9 +1093,10 @@ var DANGEROUS_GLOBALS = [
|
|
|
1083
1093
|
* 注意:对于同步死循环,setTimeout 无法中断,需要使用 Worker 或指令计数
|
|
1084
1094
|
* 这个方法只适用于不包含死循环的代码
|
|
1085
1095
|
*/ function executeWithTimeout(code, injectedParams) {
|
|
1086
|
-
var _this = this;
|
|
1087
1096
|
return _async_to_generator(function() {
|
|
1097
|
+
var _this;
|
|
1088
1098
|
return _ts_generator(this, function(_state) {
|
|
1099
|
+
_this = this;
|
|
1089
1100
|
return [
|
|
1090
1101
|
2,
|
|
1091
1102
|
new Promise(function(resolve, reject) {
|
|
@@ -1103,7 +1114,7 @@ var DANGEROUS_GLOBALS = [
|
|
|
1103
1114
|
})
|
|
1104
1115
|
];
|
|
1105
1116
|
});
|
|
1106
|
-
})();
|
|
1117
|
+
}).call(this);
|
|
1107
1118
|
}
|
|
1108
1119
|
},
|
|
1109
1120
|
{
|
|
@@ -1112,9 +1123,10 @@ var DANGEROUS_GLOBALS = [
|
|
|
1112
1123
|
* 使用指令计数限制执行时间
|
|
1113
1124
|
* 这是处理同步死循环的唯一方法(在不使用 Worker 的情况下)
|
|
1114
1125
|
*/ function executeWithInstructionLimit(code, injectedParams) {
|
|
1115
|
-
var _this = this;
|
|
1116
1126
|
return _async_to_generator(function() {
|
|
1127
|
+
var _this;
|
|
1117
1128
|
return _ts_generator(this, function(_state) {
|
|
1129
|
+
_this = this;
|
|
1118
1130
|
return [
|
|
1119
1131
|
2,
|
|
1120
1132
|
new Promise(function(resolve, reject) {
|
|
@@ -1160,7 +1172,7 @@ var DANGEROUS_GLOBALS = [
|
|
|
1160
1172
|
})
|
|
1161
1173
|
];
|
|
1162
1174
|
});
|
|
1163
|
-
})();
|
|
1175
|
+
}).call(this);
|
|
1164
1176
|
}
|
|
1165
1177
|
},
|
|
1166
1178
|
{
|
|
@@ -1214,7 +1226,7 @@ var DANGEROUS_GLOBALS = [
|
|
|
1214
1226
|
try {
|
|
1215
1227
|
JSON.stringify(value);
|
|
1216
1228
|
serializableParams[key] = value;
|
|
1217
|
-
} catch (
|
|
1229
|
+
} catch (unused) {
|
|
1218
1230
|
console.warn('无法序列化注入参数 "'.concat(key, '",回退到同步执行'));
|
|
1219
1231
|
this.fallbackToSyncExecution(code, injectedParams, resolve, reject);
|
|
1220
1232
|
return null;
|
|
@@ -1398,7 +1410,7 @@ var DANGEROUS_GLOBALS = [
|
|
|
1398
1410
|
return func.apply(null, allowedValues);
|
|
1399
1411
|
} catch (error) {
|
|
1400
1412
|
// 检查是否是因为试图访问被禁止的全局变量
|
|
1401
|
-
if (error
|
|
1413
|
+
if (_instanceof(error, ReferenceError)) {
|
|
1402
1414
|
var match = error.message.match(/(\w+) is not defined/);
|
|
1403
1415
|
if (match) {
|
|
1404
1416
|
var varName = match[1];
|
|
@@ -1639,10 +1651,7 @@ var DANGEROUS_GLOBALS = [
|
|
|
1639
1651
|
/**
|
|
1640
1652
|
* 快速执行代码的工具函数
|
|
1641
1653
|
*/ export function runInSandbox(code, config, injectedParams) {
|
|
1642
|
-
return
|
|
1643
|
-
}
|
|
1644
|
-
function _runInSandbox() {
|
|
1645
|
-
_runInSandbox = _async_to_generator(function(code, config, injectedParams) {
|
|
1654
|
+
return _async_to_generator(function() {
|
|
1646
1655
|
var sandbox;
|
|
1647
1656
|
return _ts_generator(this, function(_state) {
|
|
1648
1657
|
switch(_state.label){
|
|
@@ -1676,6 +1685,5 @@ function _runInSandbox() {
|
|
|
1676
1685
|
];
|
|
1677
1686
|
}
|
|
1678
1687
|
});
|
|
1679
|
-
});
|
|
1680
|
-
return _runInSandbox.apply(this, arguments);
|
|
1688
|
+
})();
|
|
1681
1689
|
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* 安全上下文管理器
|
|
3
|
-
*
|
|
4
|
-
* 提供更细粒度的安全控制,管理沙箱内的执行上下文,
|
|
5
|
-
* 包括变量作用域、API 权限、资源限制等。
|
|
6
|
-
*
|
|
7
|
-
* @author md-editor
|
|
8
|
-
* @version 1.0.0
|
|
9
|
-
*/ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
2
|
try {
|
|
11
3
|
var info = gen[key](arg);
|
|
12
4
|
var value = info.value;
|
|
@@ -107,7 +99,7 @@ function _object_spread_props(target, source) {
|
|
|
107
99
|
return target;
|
|
108
100
|
}
|
|
109
101
|
function _ts_generator(thisArg, body) {
|
|
110
|
-
var f, y, t,
|
|
102
|
+
var f, y, t, _ = {
|
|
111
103
|
label: 0,
|
|
112
104
|
sent: function() {
|
|
113
105
|
if (t[0] & 1) throw t[1];
|
|
@@ -115,13 +107,17 @@ function _ts_generator(thisArg, body) {
|
|
|
115
107
|
},
|
|
116
108
|
trys: [],
|
|
117
109
|
ops: []
|
|
118
|
-
};
|
|
119
|
-
return g
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
|
|
110
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
111
|
+
return d(g, "next", {
|
|
112
|
+
value: verb(0)
|
|
113
|
+
}), d(g, "throw", {
|
|
114
|
+
value: verb(1)
|
|
115
|
+
}), d(g, "return", {
|
|
116
|
+
value: verb(2)
|
|
117
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
118
|
+
value: function() {
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
125
121
|
}), g;
|
|
126
122
|
function verb(n) {
|
|
127
123
|
return function(v) {
|
|
@@ -133,7 +129,7 @@ function _ts_generator(thisArg, body) {
|
|
|
133
129
|
}
|
|
134
130
|
function step(op) {
|
|
135
131
|
if (f) throw new TypeError("Generator is already executing.");
|
|
136
|
-
while(_)try {
|
|
132
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
137
133
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
138
134
|
if (y = 0, t) op = [
|
|
139
135
|
op[0] & 2,
|
|
@@ -201,7 +197,15 @@ function _ts_generator(thisArg, body) {
|
|
|
201
197
|
};
|
|
202
198
|
}
|
|
203
199
|
}
|
|
204
|
-
|
|
200
|
+
/**
|
|
201
|
+
* 安全上下文管理器
|
|
202
|
+
*
|
|
203
|
+
* 提供更细粒度的安全控制,管理沙箱内的执行上下文,
|
|
204
|
+
* 包括变量作用域、API 权限、资源限制等。
|
|
205
|
+
*
|
|
206
|
+
* @author md-editor
|
|
207
|
+
* @version 1.0.0
|
|
208
|
+
*/ import { ProxySandbox } from "./ProxySandbox";
|
|
205
209
|
/**
|
|
206
210
|
* 安全上下文管理器类
|
|
207
211
|
*/ export var SecurityContextManager = /*#__PURE__*/ function() {
|
|
@@ -221,8 +225,8 @@ import { ProxySandbox } from "./ProxySandbox";
|
|
|
221
225
|
value: /**
|
|
222
226
|
* 合并默认配置
|
|
223
227
|
*/ function mergeDefaultConfig(config) {
|
|
228
|
+
var _config_allowConsole, _config_allowTimers, _config_strictMode, _config_allowDOM, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
|
|
224
229
|
var _config_permissions, _config_permissions1, _config_permissions2, _config_permissions3, _config_permissions4, _config_limits, _config_limits1, _config_limits2, _config_limits3, _config_monitoring, _config_monitoring1, _config_monitoring2;
|
|
225
|
-
var _config_allowConsole, _config_allowTimers, _config_strictMode, _config_allowDOM, _config_permissions_network, _config_permissions_fileSystem, _config_permissions_media, _config_permissions_geolocation, _config_permissions_notifications, _config_monitoring_enablePerformanceMonitoring, _config_monitoring_enableErrorTracking, _config_monitoring_enableResourceMonitoring;
|
|
226
230
|
return {
|
|
227
231
|
// 继承沙箱配置
|
|
228
232
|
allowedGlobals: config.allowedGlobals || [],
|
|
@@ -236,11 +240,11 @@ import { ProxySandbox } from "./ProxySandbox";
|
|
|
236
240
|
maxMemoryUsage: config.maxMemoryUsage || 10 * 1024 * 1024,
|
|
237
241
|
// 权限配置
|
|
238
242
|
permissions: {
|
|
239
|
-
network: (
|
|
240
|
-
fileSystem: (
|
|
241
|
-
media: (
|
|
242
|
-
geolocation: (
|
|
243
|
-
notifications: (
|
|
243
|
+
network: (_ref = (_config_permissions = config.permissions) === null || _config_permissions === void 0 ? void 0 : _config_permissions.network) !== null && _ref !== void 0 ? _ref : false,
|
|
244
|
+
fileSystem: (_ref1 = (_config_permissions1 = config.permissions) === null || _config_permissions1 === void 0 ? void 0 : _config_permissions1.fileSystem) !== null && _ref1 !== void 0 ? _ref1 : false,
|
|
245
|
+
media: (_ref2 = (_config_permissions2 = config.permissions) === null || _config_permissions2 === void 0 ? void 0 : _config_permissions2.media) !== null && _ref2 !== void 0 ? _ref2 : false,
|
|
246
|
+
geolocation: (_ref3 = (_config_permissions3 = config.permissions) === null || _config_permissions3 === void 0 ? void 0 : _config_permissions3.geolocation) !== null && _ref3 !== void 0 ? _ref3 : false,
|
|
247
|
+
notifications: (_ref4 = (_config_permissions4 = config.permissions) === null || _config_permissions4 === void 0 ? void 0 : _config_permissions4.notifications) !== null && _ref4 !== void 0 ? _ref4 : false
|
|
244
248
|
},
|
|
245
249
|
// 资源限制
|
|
246
250
|
limits: {
|
|
@@ -251,9 +255,9 @@ import { ProxySandbox } from "./ProxySandbox";
|
|
|
251
255
|
},
|
|
252
256
|
// 监控配置
|
|
253
257
|
monitoring: {
|
|
254
|
-
enablePerformanceMonitoring: (
|
|
255
|
-
enableErrorTracking: (
|
|
256
|
-
enableResourceMonitoring: (
|
|
258
|
+
enablePerformanceMonitoring: (_ref5 = (_config_monitoring = config.monitoring) === null || _config_monitoring === void 0 ? void 0 : _config_monitoring.enablePerformanceMonitoring) !== null && _ref5 !== void 0 ? _ref5 : true,
|
|
259
|
+
enableErrorTracking: (_ref6 = (_config_monitoring1 = config.monitoring) === null || _config_monitoring1 === void 0 ? void 0 : _config_monitoring1.enableErrorTracking) !== null && _ref6 !== void 0 ? _ref6 : true,
|
|
260
|
+
enableResourceMonitoring: (_ref7 = (_config_monitoring2 = config.monitoring) === null || _config_monitoring2 === void 0 ? void 0 : _config_monitoring2.enableResourceMonitoring) !== null && _ref7 !== void 0 ? _ref7 : true
|
|
257
261
|
}
|
|
258
262
|
};
|
|
259
263
|
}
|
|
@@ -395,15 +399,15 @@ import { ProxySandbox } from "./ProxySandbox";
|
|
|
395
399
|
key: "executeInContext",
|
|
396
400
|
value: /**
|
|
397
401
|
* 在指定上下文中执行代码
|
|
398
|
-
*/ function executeInContext(
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
var context, mergedScope, sandboxConfig, wrappedCode, sandbox, result;
|
|
402
|
+
*/ function executeInContext(_0, _1) {
|
|
403
|
+
return _async_to_generator(function(contextId, code) {
|
|
404
|
+
var additionalScope, context, mergedScope, sandboxConfig, wrappedCode, sandbox, result;
|
|
405
|
+
var _arguments = arguments;
|
|
403
406
|
return _ts_generator(this, function(_state) {
|
|
404
407
|
switch(_state.label){
|
|
405
408
|
case 0:
|
|
406
|
-
|
|
409
|
+
additionalScope = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
410
|
+
context = this.getContext(contextId);
|
|
407
411
|
if (!context) {
|
|
408
412
|
throw new Error("Context ".concat(contextId, " not found"));
|
|
409
413
|
}
|
|
@@ -411,26 +415,26 @@ import { ProxySandbox } from "./ProxySandbox";
|
|
|
411
415
|
mergedScope = _object_spread({}, context.scope, additionalScope);
|
|
412
416
|
// 创建沙箱配置
|
|
413
417
|
sandboxConfig = {
|
|
414
|
-
allowedGlobals:
|
|
415
|
-
forbiddenGlobals:
|
|
416
|
-
allowConsole:
|
|
417
|
-
allowTimers:
|
|
418
|
-
timeout:
|
|
419
|
-
strictMode:
|
|
420
|
-
customGlobals: _object_spread(_object_spread_props(_object_spread({},
|
|
418
|
+
allowedGlobals: this.config.allowedGlobals,
|
|
419
|
+
forbiddenGlobals: this.config.forbiddenGlobals,
|
|
420
|
+
allowConsole: this.config.allowConsole,
|
|
421
|
+
allowTimers: this.config.allowTimers,
|
|
422
|
+
timeout: this.config.limits.maxExecutionTime,
|
|
423
|
+
strictMode: this.config.strictMode,
|
|
424
|
+
customGlobals: _object_spread(_object_spread_props(_object_spread({}, this.config.customGlobals, mergedScope), {
|
|
421
425
|
// 添加上下文相关的全局变量
|
|
422
426
|
__context: {
|
|
423
427
|
id: contextId,
|
|
424
428
|
permissions: context.permissions
|
|
425
429
|
}
|
|
426
|
-
}),
|
|
427
|
-
__performance:
|
|
430
|
+
}), this.config.monitoring.enablePerformanceMonitoring && {
|
|
431
|
+
__performance: this.globalMonitors.get('performance')
|
|
428
432
|
}),
|
|
429
|
-
allowDOM:
|
|
430
|
-
maxMemoryUsage:
|
|
433
|
+
allowDOM: this.config.allowDOM,
|
|
434
|
+
maxMemoryUsage: this.config.limits.maxMemoryUsage
|
|
431
435
|
};
|
|
432
436
|
// 包装代码以添加资源监控
|
|
433
|
-
wrappedCode =
|
|
437
|
+
wrappedCode = this.wrapCodeWithMonitoring(code);
|
|
434
438
|
// 创建沙箱并执行
|
|
435
439
|
sandbox = new ProxySandbox(sandboxConfig);
|
|
436
440
|
_state.label = 1;
|
|
@@ -448,7 +452,7 @@ import { ProxySandbox } from "./ProxySandbox";
|
|
|
448
452
|
case 2:
|
|
449
453
|
result = _state.sent();
|
|
450
454
|
// 更新上下文的资源使用情况
|
|
451
|
-
|
|
455
|
+
this.updateContextResourceUsage(context, result);
|
|
452
456
|
return [
|
|
453
457
|
2,
|
|
454
458
|
result
|
|
@@ -464,7 +468,7 @@ import { ProxySandbox } from "./ProxySandbox";
|
|
|
464
468
|
];
|
|
465
469
|
}
|
|
466
470
|
});
|
|
467
|
-
})();
|
|
471
|
+
}).apply(this, arguments);
|
|
468
472
|
}
|
|
469
473
|
},
|
|
470
474
|
{
|
|
@@ -590,10 +594,7 @@ import { ProxySandbox } from "./ProxySandbox";
|
|
|
590
594
|
/**
|
|
591
595
|
* 快速在受控环境中执行代码的工具函数
|
|
592
596
|
*/ export function runInSecureContext(code, config, contextScope) {
|
|
593
|
-
return
|
|
594
|
-
}
|
|
595
|
-
function _runInSecureContext() {
|
|
596
|
-
_runInSecureContext = _async_to_generator(function(code, config, contextScope) {
|
|
597
|
+
return _async_to_generator(function() {
|
|
597
598
|
var manager, contextId;
|
|
598
599
|
return _ts_generator(this, function(_state) {
|
|
599
600
|
switch(_state.label){
|
|
@@ -628,6 +629,5 @@ function _runInSecureContext() {
|
|
|
628
629
|
];
|
|
629
630
|
}
|
|
630
631
|
});
|
|
631
|
-
});
|
|
632
|
-
return _runInSecureContext.apply(this, arguments);
|
|
632
|
+
})();
|
|
633
633
|
}
|
|
@@ -59,6 +59,13 @@ function _define_property(obj, key, value) {
|
|
|
59
59
|
}
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
|
+
function _instanceof(left, right) {
|
|
63
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
64
|
+
return !!right[Symbol.hasInstance](left);
|
|
65
|
+
} else {
|
|
66
|
+
return left instanceof right;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
62
69
|
function _object_spread(target) {
|
|
63
70
|
for(var i = 1; i < arguments.length; i++){
|
|
64
71
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -99,7 +106,7 @@ function _object_spread_props(target, source) {
|
|
|
99
106
|
return target;
|
|
100
107
|
}
|
|
101
108
|
function _ts_generator(thisArg, body) {
|
|
102
|
-
var f, y, t,
|
|
109
|
+
var f, y, t, _ = {
|
|
103
110
|
label: 0,
|
|
104
111
|
sent: function() {
|
|
105
112
|
if (t[0] & 1) throw t[1];
|
|
@@ -107,13 +114,17 @@ function _ts_generator(thisArg, body) {
|
|
|
107
114
|
},
|
|
108
115
|
trys: [],
|
|
109
116
|
ops: []
|
|
110
|
-
};
|
|
111
|
-
return g
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
118
|
+
return d(g, "next", {
|
|
119
|
+
value: verb(0)
|
|
120
|
+
}), d(g, "throw", {
|
|
121
|
+
value: verb(1)
|
|
122
|
+
}), d(g, "return", {
|
|
123
|
+
value: verb(2)
|
|
124
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
125
|
+
value: function() {
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
117
128
|
}), g;
|
|
118
129
|
function verb(n) {
|
|
119
130
|
return function(v) {
|
|
@@ -125,7 +136,7 @@ function _ts_generator(thisArg, body) {
|
|
|
125
136
|
}
|
|
126
137
|
function step(op) {
|
|
127
138
|
if (f) throw new TypeError("Generator is already executing.");
|
|
128
|
-
while(_)try {
|
|
139
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
129
140
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
130
141
|
if (y = 0, t) op = [
|
|
131
142
|
op[0] & 2,
|
|
@@ -307,10 +318,7 @@ export { SecurityContextManager, createSecurityContextManager, runInSecureContex
|
|
|
307
318
|
/**
|
|
308
319
|
* 快速执行简单代码的便捷函数
|
|
309
320
|
*/ export function quickExecute(code, customGlobals, injectedParams) {
|
|
310
|
-
return
|
|
311
|
-
}
|
|
312
|
-
function _quickExecute() {
|
|
313
|
-
_quickExecute = _async_to_generator(function(code, customGlobals, injectedParams) {
|
|
321
|
+
return _async_to_generator(function() {
|
|
314
322
|
var result;
|
|
315
323
|
return _ts_generator(this, function(_state) {
|
|
316
324
|
switch(_state.label){
|
|
@@ -332,16 +340,12 @@ function _quickExecute() {
|
|
|
332
340
|
];
|
|
333
341
|
}
|
|
334
342
|
});
|
|
335
|
-
});
|
|
336
|
-
return _quickExecute.apply(this, arguments);
|
|
343
|
+
})();
|
|
337
344
|
}
|
|
338
345
|
/**
|
|
339
346
|
* 执行数学表达式的安全计算器
|
|
340
347
|
*/ export function safeMathEval(expression) {
|
|
341
|
-
return
|
|
342
|
-
}
|
|
343
|
-
function _safeMathEval() {
|
|
344
|
-
_safeMathEval = _async_to_generator(function(expression) {
|
|
348
|
+
return _async_to_generator(function() {
|
|
345
349
|
var mathOnlyConfig, safePattern, result, value;
|
|
346
350
|
return _ts_generator(this, function(_state) {
|
|
347
351
|
switch(_state.label){
|
|
@@ -402,8 +406,7 @@ function _safeMathEval() {
|
|
|
402
406
|
];
|
|
403
407
|
}
|
|
404
408
|
});
|
|
405
|
-
});
|
|
406
|
-
return _safeMathEval.apply(this, arguments);
|
|
409
|
+
})();
|
|
407
410
|
}
|
|
408
411
|
/**
|
|
409
412
|
* 沙箱状态检查工具
|
|
@@ -529,7 +532,7 @@ function _safeMathEval() {
|
|
|
529
532
|
];
|
|
530
533
|
case 9:
|
|
531
534
|
error2 = _state.sent();
|
|
532
|
-
results.timeoutMechanism = error2
|
|
535
|
+
results.timeoutMechanism = _instanceof(error2, Error) && error2.message.includes('timeout');
|
|
533
536
|
return [
|
|
534
537
|
3,
|
|
535
538
|
10
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* 沙箱模块的 TypeScript 类型定义
|
|
3
|
-
*
|
|
4
|
-
* 提供完整的类型定义,确保类型安全和良好的开发体验。
|
|
5
|
-
*
|
|
6
|
-
* @author md-editor
|
|
7
|
-
* @version 1.0.0
|
|
8
|
-
*/ /**
|
|
9
|
-
* 沙箱错误类型枚举
|
|
10
|
-
*/ function _assert_this_initialized(self) {
|
|
1
|
+
function _assert_this_initialized(self) {
|
|
11
2
|
if (self === void 0) {
|
|
12
3
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
13
4
|
}
|
|
@@ -125,7 +116,16 @@ function _is_native_reflect_construct() {
|
|
|
125
116
|
return !!result;
|
|
126
117
|
})();
|
|
127
118
|
}
|
|
128
|
-
|
|
119
|
+
/**
|
|
120
|
+
* 沙箱模块的 TypeScript 类型定义
|
|
121
|
+
*
|
|
122
|
+
* 提供完整的类型定义,确保类型安全和良好的开发体验。
|
|
123
|
+
*
|
|
124
|
+
* @author md-editor
|
|
125
|
+
* @version 1.0.0
|
|
126
|
+
*/ /**
|
|
127
|
+
* 沙箱错误类型枚举
|
|
128
|
+
*/ export var SandboxErrorType = /*#__PURE__*/ function(SandboxErrorType) {
|
|
129
129
|
/** 代码执行超时 */ SandboxErrorType["TIMEOUT"] = "TIMEOUT";
|
|
130
130
|
/** 内存超限 */ SandboxErrorType["MEMORY_LIMIT"] = "MEMORY_LIMIT";
|
|
131
131
|
/** 访问被禁止的全局对象 */ SandboxErrorType["FORBIDDEN_ACCESS"] = "FORBIDDEN_ACCESS";
|
package/dist/Utils/scrollTo.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
function _instanceof(left, right) {
|
|
2
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3
|
+
return !!right[Symbol.hasInstance](left);
|
|
4
|
+
} else {
|
|
5
|
+
return left instanceof right;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
1
8
|
import raf from "rc-util/lib/raf";
|
|
2
9
|
import { easeInOutCubic } from "./easings";
|
|
3
10
|
import getScroll, { isWindow } from "./getScroll";
|
|
@@ -40,7 +47,7 @@ export default function scrollTo(y) {
|
|
|
40
47
|
var nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
|
|
41
48
|
if (isWindow(container)) {
|
|
42
49
|
container.scrollTo(window.pageXOffset, nextScrollTop);
|
|
43
|
-
} else if (container
|
|
50
|
+
} else if (_instanceof(container, Document) || container.constructor.name === 'HTMLDocument') {
|
|
44
51
|
container.documentElement.scrollTop = nextScrollTop;
|
|
45
52
|
} else {
|
|
46
53
|
container.scrollTop = nextScrollTop;
|
|
@@ -118,7 +118,7 @@ import { useStyle } from "./style";
|
|
|
118
118
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
119
119
|
var prefixCls = getPrefixCls('agentic-welcome');
|
|
120
120
|
var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
121
|
-
var
|
|
121
|
+
var _ref = customStyle || {}, ref = _object_destructuring_empty(_ref), restStyle = _extends({}, _ref);
|
|
122
122
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
123
123
|
className: classnames(prefixCls, hashId, rootClassName),
|
|
124
124
|
style: restStyle
|