@gientech/modual 1.4.4 → 1.4.6
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/.editorconfig +38 -0
- package/.prettierignore +16 -0
- package/.prettierrc +17 -0
- package/README.md +129 -129
- package/USAGE.md +191 -0
- package/bash.exe.stackdump +40 -0
- package/components.json +21 -0
- package/dist/README.md +129 -0
- package/dist/assets/AppLoading-mci3gLZt.js +414 -0
- package/{assets/GientechStreamReader-A8zHypyu.js → dist/assets/GientechStreamReader-4496nAm0.js} +2 -2
- package/{assets → dist/assets}/database.svg +11 -11
- package/{assets → dist/assets}/database_add.svg +53 -53
- package/{assets → dist/assets}/database_connect.svg +66 -66
- package/{assets → dist/assets}/database_upload.svg +29 -29
- package/{assets → dist/assets}/defaultWeLogo.svg +14 -14
- package/{assets/index-B7u9FawR.js → dist/assets/index-7rZAt9P3.js} +1 -1
- package/dist/assets/index-BVENTW1Q.js +13 -0
- package/dist/assets/index-Bb8_WB-l.js +1 -0
- package/{assets/index-rydP_SDR.js → dist/assets/index-BpJ9Bm5x.js} +6 -6
- package/dist/assets/index-CNxDI4h-.js +1078 -0
- package/{assets/index-EcdpegTC.js → dist/assets/index-CWzpBU29.js} +1 -1
- package/{assets/index-DiQ4Me9J.js → dist/assets/index-D1m34Ij7.js} +124 -124
- package/{assets/index-CFlRqq2H.js → dist/assets/index-_gBtdXQV.js} +2 -2
- package/{assets/MySQL.svg → dist/assets/mysql.svg} +14 -14
- package/{assets/plus-ufD39rmY.js → dist/assets/plus-CrtEUXaQ.js} +1 -1
- package/dist/assets/style3.css +1 -0
- package/{assets/x-_1-UpSBt.js → dist/assets/x-Dr3EBTzJ.js} +1 -1
- package/{chat.d.ts → dist/chat.d.ts} +1 -1
- package/dist/chat.js +142 -0
- package/dist/database.js +20 -0
- package/{databaseId.js → dist/databaseId.js} +2 -2
- package/dist/databaseTable.js +6 -0
- package/{index.js → dist/index.js} +3 -3
- package/{modelManage.js → dist/modelManage.js} +1 -1
- package/dist/package.json +63 -0
- package/{sensitive.js → dist/sensitive.js} +1 -1
- package/dist/streamFilesReader.js +1 -0
- package/{worker → dist/worker}/pdf.worker.min.js +21 -21
- package/doc_assets/2.png +0 -0
- package/doc_assets/demo.md +27 -0
- package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +2 -0
- package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +23699 -0
- package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +1 -0
- package/doc_assets/demos/dist-app/index.html +14 -0
- package/doc_assets/demos/dist-app/vite.svg +1 -0
- package/doc_assets/images/1.png +0 -0
- package/doc_assets/images/3.png +0 -0
- package/doc_assets/images/component-screenshot.png +1 -0
- package/doc_assets/install.md +5 -0
- package/eslint.config.js +92 -0
- package/index.html +13 -0
- package/package.json +99 -44
- package/package.json.demo-backup +109 -0
- package/postcss.config.cjs +19 -0
- package/public/vite.svg +1 -0
- package/public/worker/pdf.worker.min.js +22 -0
- package/scripts/README.md +133 -0
- package/scripts/build-demo.js +88 -0
- package/scripts/demo-selector.js +216 -0
- package/scripts/dev-demo.js +76 -0
- package/scripts/preview-demo.js +130 -0
- package/scripts/run-demo.bat +34 -0
- package/src/assets/img/downArrow.png +0 -0
- package/src/assets/img/excel.png +0 -0
- package/src/assets/img/img.png +0 -0
- package/src/assets/img/pdf.png +0 -0
- package/src/assets/img/ppt.png +0 -0
- package/src/assets/img/txt.png +0 -0
- package/src/assets/img/word.png +0 -0
- package/src/assets/login/homeBg.png +0 -0
- package/src/assets/login/left.jpg +0 -0
- package/src/assets/login/logoImg.png +0 -0
- package/src/examples/Demo/index.tsx +12 -0
- package/src/examples/LoginPage/index.tsx +18 -0
- package/src/examples/chat/components/DrawerGraphPreview.tsx +78 -0
- package/src/examples/chat/index.tsx +177 -0
- package/src/examples/chat/logo03.png +0 -0
- package/src/examples/gientechStreamFilesReader/index.tsx +950 -0
- package/src/examples/ragDatabaseDataPage/index.tsx +36 -0
- package/src/examples/ragDatabaseIdPage/index.tsx +44 -0
- package/src/examples/ragDatabasePage/index.tsx +36 -0
- package/src/examples/ragModelManagePage/index.tsx +37 -0
- package/src/examples/ragSearchPage/index.tsx +0 -0
- package/src/examples/ragSensitiveWordsPage/index.tsx +32 -0
- package/src/examples/streamFiles/index.tsx +384 -0
- package/src/lib_enter.ts +40 -0
- package/src/main.tsx +5 -0
- package/src/main.tsx.backup +5 -0
- package/src/modules/chat/Conversations/Item.tsx +167 -0
- package/src/modules/chat/Conversations/List.tsx +206 -0
- package/src/modules/chat/Conversations/groupByTime.ts +39 -0
- package/src/modules/chat/Conversations/index.tsx +217 -0
- package/src/modules/chat/constants.tsx +33 -0
- package/src/modules/chat/data.txt +82 -0
- package/src/modules/chat/index.tsx +2024 -0
- package/src/modules/chat/types.ts +17 -0
- package/src/modules/database/CreateModal.tsx +398 -0
- package/src/modules/database/assets/Doris.png +0 -0
- package/src/modules/database/assets/PostgreSQL.png +0 -0
- package/src/modules/database/assets/SQLServer.png +0 -0
- package/src/modules/database/assets/database.svg +11 -0
- package/src/modules/database/assets/database_add.svg +53 -0
- package/src/modules/database/assets/database_connect.svg +66 -0
- package/src/modules/database/assets/database_upload.svg +29 -0
- package/src/modules/database/assets/empty.png +0 -0
- package/src/modules/database/assets/mysql.svg +14 -0
- package/src/modules/database/index.tsx +466 -0
- package/src/modules/database/server.ts +196 -0
- package/src/modules/databaseId/CustomCom.tsx +156 -0
- package/src/modules/databaseId/EditConfig.tsx +268 -0
- package/src/modules/databaseId/UploadDrawer.tsx +520 -0
- package/src/modules/databaseId/assets/aiOptimize.svg +10 -0
- package/src/modules/databaseId/assets/empty.png +0 -0
- package/src/modules/databaseId/assets/template.svg +6 -0
- package/src/modules/databaseId/assets/upload.svg +9 -0
- package/src/modules/databaseId/assets/useTemp.svg +6 -0
- package/src/modules/databaseId/index.tsx +734 -0
- package/src/modules/databaseId/server.ts +286 -0
- package/src/modules/databaseId/style.css +5 -0
- package/src/modules/databaseTable/EditRowDrawer.tsx +119 -0
- package/src/modules/databaseTable/index.tsx +357 -0
- package/src/modules/databaseTable/server.ts +180 -0
- package/src/modules/headlessChat/constants.tsx +32 -0
- package/src/modules/headlessChat/index.tsx +1063 -0
- package/src/modules/headlessChat/types.ts +23 -0
- package/src/modules/login/components/Login/LoginBox/index.tsx +102 -0
- package/src/modules/login/components/Login/RegisterBox/index.tsx +180 -0
- package/src/modules/login/components/Login/index.tsx +100 -0
- package/src/modules/login/index.tsx +106 -0
- package/src/modules/login/style.css +3 -0
- package/src/modules/login/useServices.ts +53 -0
- package/src/modules/login/utils.ts +42 -0
- package/src/modules/modelManage/ConfigDrawer.tsx +249 -0
- package/src/modules/modelManage/assets/empty.png +0 -0
- package/src/modules/modelManage/const.ts +50 -0
- package/src/modules/modelManage/index.tsx +439 -0
- package/src/modules/modelManage/server.ts +185 -0
- package/src/modules/nodegraph/index.tsx +1 -0
- package/src/modules/search/assets/Icon-history.svg +8 -0
- package/src/modules/search/assets/answerAwartar.png +0 -0
- package/src/modules/search/assets/doc.png +0 -0
- package/src/modules/search/assets/genera.gif +0 -0
- package/src/modules/search/assets/icon-robot.svg +9 -0
- package/src/modules/search/assets/icon-search-bar.svg +14 -0
- package/src/modules/search/assets/icon-sub-title.svg +3 -0
- package/src/modules/search/assets/icon-title.svg +9 -0
- package/src/modules/search/assets/icon-zoomOut.svg +9 -0
- package/src/modules/search/assets/iconAi.svg +9 -0
- package/src/modules/search/assets/pdf.png +0 -0
- package/src/modules/search/assets/ppt.png +0 -0
- package/src/modules/search/assets/search.svg +3 -0
- package/src/modules/search/assets/selected.svg +4 -0
- package/src/modules/search/assets/txt.png +0 -0
- package/src/modules/search/assets/xls.png +0 -0
- package/src/modules/search/components/AssisSelect.tsx +137 -0
- package/src/modules/search/components/Editor/ChatViewEditor.tsx +261 -0
- package/src/modules/search/components/Editor/aichat.css +1 -0
- package/src/modules/search/components/Editor/constant.ts +13 -0
- package/src/modules/search/components/Editor/index.tsx +113 -0
- package/src/modules/search/components/Editor/plugins/autofomatRules.ts +332 -0
- package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +20 -0
- package/src/modules/search/components/Editor/plugins/createIndexes.tsx +38 -0
- package/src/modules/search/components/Editor/plugins/displayer.ts +298 -0
- package/src/modules/search/components/Editor/plugins/imageClick.tsx +32 -0
- package/src/modules/search/components/Editor/plugins/myplugin.tsx +98 -0
- package/src/modules/search/components/Editor/ui/avatar.tsx +19 -0
- package/src/modules/search/components/Editor/ui/blockquote-element.tsx +21 -0
- package/src/modules/search/components/Editor/ui/button.tsx +58 -0
- package/src/modules/search/components/Editor/ui/calendar.tsx +68 -0
- package/src/modules/search/components/Editor/ui/caption.tsx +46 -0
- package/src/modules/search/components/Editor/ui/checkbox.tsx +27 -0
- package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +188 -0
- package/src/modules/search/components/Editor/ui/code-block-element.css +434 -0
- package/src/modules/search/components/Editor/ui/code-block-element.tsx +39 -0
- package/src/modules/search/components/Editor/ui/code-leaf.tsx +24 -0
- package/src/modules/search/components/Editor/ui/code-line-element.tsx +10 -0
- package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +21 -0
- package/src/modules/search/components/Editor/ui/column-element.tsx +30 -0
- package/src/modules/search/components/Editor/ui/column-group-element.tsx +94 -0
- package/src/modules/search/components/Editor/ui/command.tsx +75 -0
- package/src/modules/search/components/Editor/ui/comment-avatar.tsx +22 -0
- package/src/modules/search/components/Editor/ui/comment-create-form.tsx +37 -0
- package/src/modules/search/components/Editor/ui/comment-item.tsx +74 -0
- package/src/modules/search/components/Editor/ui/comment-leaf.tsx +49 -0
- package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +42 -0
- package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +22 -0
- package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +32 -0
- package/src/modules/search/components/Editor/ui/comment-value.tsx +34 -0
- package/src/modules/search/components/Editor/ui/comments-popover.tsx +63 -0
- package/src/modules/search/components/Editor/ui/date-element.tsx +83 -0
- package/src/modules/search/components/Editor/ui/dialog.tsx +63 -0
- package/src/modules/search/components/Editor/ui/draggable.tsx +177 -0
- package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +180 -0
- package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +85 -0
- package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +28 -0
- package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +76 -0
- package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +8 -0
- package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +51 -0
- package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +77 -0
- package/src/modules/search/components/Editor/ui/heading-element.tsx +48 -0
- package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +17 -0
- package/src/modules/search/components/Editor/ui/hr-element.tsx +30 -0
- package/src/modules/search/components/Editor/ui/icons.tsx +267 -0
- package/src/modules/search/components/Editor/ui/image-element.tsx +74 -0
- package/src/modules/search/components/Editor/ui/inline-combobox.tsx +368 -0
- package/src/modules/search/components/Editor/ui/input.tsx +25 -0
- package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +218 -0
- package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +20 -0
- package/src/modules/search/components/Editor/ui/link-element.tsx +29 -0
- package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +161 -0
- package/src/modules/search/components/Editor/ui/list-element.tsx +30 -0
- package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +24 -0
- package/src/modules/search/components/Editor/ui/media-embed-element.tsx +133 -0
- package/src/modules/search/components/Editor/ui/media-popover.tsx +97 -0
- package/src/modules/search/components/Editor/ui/mention-element.tsx +43 -0
- package/src/modules/search/components/Editor/ui/mention-input-element.tsx +141 -0
- package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +93 -0
- package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +67 -0
- package/src/modules/search/components/Editor/ui/paragraph-element.tsx +4 -0
- package/src/modules/search/components/Editor/ui/placeholder.tsx +52 -0
- package/src/modules/search/components/Editor/ui/popover.tsx +32 -0
- package/src/modules/search/components/Editor/ui/resizable.tsx +66 -0
- package/src/modules/search/components/Editor/ui/separator.tsx +25 -0
- package/src/modules/search/components/Editor/ui/style.less +12 -0
- package/src/modules/search/components/Editor/ui/table-cell-element.tsx +143 -0
- package/src/modules/search/components/Editor/ui/table-element.tsx +243 -0
- package/src/modules/search/components/Editor/ui/table-row-element.tsx +22 -0
- package/src/modules/search/components/Editor/ui/tableValue.tsx +135 -0
- package/src/modules/search/components/Editor/ui/todo-list-element.tsx +43 -0
- package/src/modules/search/components/Editor/ui/toggle-element.tsx +31 -0
- package/src/modules/search/components/Editor/ui/toolbar.tsx +157 -0
- package/src/modules/search/components/Editor/ui/tooltip.tsx +65 -0
- package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +160 -0
- package/src/modules/search/components/Editor/ui/with-draggables.tsx +175 -0
- package/src/modules/search/components/FileList.tsx +287 -0
- package/src/modules/search/components/ImageGroupView/index.tsx +85 -0
- package/src/modules/search/components/ResultContent.tsx +232 -0
- package/src/modules/search/components/SearchInput.tsx +232 -0
- package/src/modules/search/components/SearchLanding.tsx +74 -0
- package/src/modules/search/components/SearchView.tsx +563 -0
- package/src/modules/search/components/SimpleEditor.tsx +158 -0
- package/src/modules/search/components/SimpleFileList.tsx +215 -0
- package/src/modules/search/index.tsx +10 -0
- package/src/modules/search/reademe.md +1 -0
- package/src/modules/search/servers/apis.tsx +19 -0
- package/src/modules/search/servers/index.ts +184 -0
- package/src/modules/search/style.less +503 -0
- package/src/modules/search/type.ts +22 -0
- package/src/modules/search/utils.ts +34 -0
- package/src/modules/sensitive/index.tsx +313 -0
- package/src/modules/sensitive/server.ts +122 -0
- package/src/modules/streamFilesReader/GientechStreamReader.tsx +1619 -0
- package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
- package/src/modules/streamFilesReader/components/Header/index.tsx +297 -0
- package/src/modules/streamFilesReader/index.tsx +3 -0
- package/src/style.css +6 -0
- package/src/type.d.ts +0 -0
- package/src/utils/commonFn.tsx +111 -0
- package/src/utils/gientechCommon/components/AppError.tsx +32 -0
- package/src/utils/gientechCommon/components/AppLoading.tsx +75 -0
- package/src/utils/gientechCommon/components/DeleteModal.tsx +75 -0
- package/src/utils/gientechCommon/components/DisplayError.tsx +33 -0
- package/src/utils/gientechCommon/components/DisplayLoading.tsx +38 -0
- package/src/utils/gientechCommon/components/FeedBackModal.tsx +310 -0
- package/src/utils/gientechCommon/components/FileCardCommon.tsx +82 -0
- package/src/utils/gientechCommon/components/FileManager/index.tsx +390 -0
- package/src/utils/gientechCommon/components/FileManager/style.css +5 -0
- package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +296 -0
- package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +339 -0
- package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +245 -0
- package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +209 -0
- package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
- package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +148 -0
- package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +14 -0
- package/src/utils/gientechCommon/components/RenameModal.tsx +86 -0
- package/src/utils/gientechCommon/components/style.less +11 -0
- package/src/utils/gientechCommon/configs/commonConfig.ts +2 -0
- package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
- package/src/utils/gientechCommon/configs/stylesConfig.ts +142 -0
- package/src/utils/gientechCommon/hooks/AichatUseController.tsx +345 -0
- package/src/utils/gientechCommon/slate/converters/deserializers.ts +763 -0
- package/src/utils/gientechCommon/slate/converters/mockData.ts +232 -0
- package/src/utils/gientechCommon/slate/converters/slateConverters.ts +258 -0
- package/src/utils/gientechCommon/slate/richElements/index.tsx +499 -0
- package/src/utils/gientechCommon/utils/request.ts +37 -0
- package/src/utils/gientechCommon/utils/serverFn.ts +172 -0
- package/src/utils/index.tsx +126 -0
- package/src/utils/testconfigs/demologin/index.tsx +32 -0
- package/src/utils/testconfigs/index.ts +53 -0
- package/src/vite-env.d.ts +11 -0
- package/stats.html +4949 -0
- package/tailwind.config.js +170 -0
- package/tsconfig.app.json +30 -0
- package/tsconfig.app.tsbuildinfo +11 -0
- package/tsconfig.json +13 -0
- package/tsconfig.node.json +22 -0
- package/tsconfig.node.tsbuildinfo +1 -0
- package/vite.config.ts +216 -0
- package/workflows/release.yml +60 -0
- package/assets/AppLoading-BpA2wf4Z.js +0 -414
- package/assets/LeftOutlined-BdBZ6FSD.js +0 -1
- package/assets/index-CNJZ9j4J.js +0 -1
- package/assets/index-DfSHCQcq.js +0 -1289
- package/assets/style3.css +0 -1
- package/chat.js +0 -151
- package/database.js +0 -20
- package/databaseTable.js +0 -18
- package/streamFilesReader.js +0 -1
- /package/{assets → dist/assets}/Doris.png +0 -0
- /package/{assets → dist/assets}/PostgreSQL.png +0 -0
- /package/{assets → dist/assets}/SQLServer.png +0 -0
- /package/{assets → dist/assets}/empty.png +0 -0
- /package/{assets → dist/assets}/homeBg.png +0 -0
- /package/{assets → dist/assets}/index-CpW6Dhpp.js +0 -0
- /package/{assets → dist/assets}/left.jpg +0 -0
- /package/{assets → dist/assets}/logoImg.png +0 -0
- /package/{assets → dist/assets}/style.css +0 -0
- /package/{assets → dist/assets}/style2.css +0 -0
- /package/{assets → dist/assets}/style4.css +0 -0
- /package/{database.d.ts → dist/database.d.ts} +0 -0
- /package/{databaseId.d.ts → dist/databaseId.d.ts} +0 -0
- /package/{databaseTable.d.ts → dist/databaseTable.d.ts} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{modelManage.d.ts → dist/modelManage.d.ts} +0 -0
- /package/{sensitive.d.ts → dist/sensitive.d.ts} +0 -0
- /package/{streamFilesReader.d.ts → dist/streamFilesReader.d.ts} +0 -0
- /package/{vite.svg → dist/vite.svg} +0 -0
package/dist/chat.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import{jsx as d,jsxs as R,Fragment as $n}from"react/jsx-runtime";import*as F from"react";import Ge,{useRef as Le,useEffect as Se,Component as Mr,createElement as Rt,PureComponent as An,useState as ue,useMemo as Ae}from"react";import{c as Ye,g as rr,az as jr,C as mt,ar as Rr,aR as zr,H as Xe,aG as Nn,h as Ce,u as Lr,k as qr,aK as nr,S as kn,aJ as On,ah as pt,U as Gt,L as Ur,N as Je,aV as Yt,T as Wr,b as Hr,r as Vr,t as Re,q as Qt,aW as Bn,aA as _n,aD as Tn,aB as Pn,aX as Mn,ag as wt,Q as jn,aY as rt,aZ as Oe,_ as Ve,a_ as Xr,a$ as Jr,b0 as Kr,V as Ee,b1 as $e,b2 as Gr,O as Rn,aO as Yr,b3 as Qr,b4 as cr,b5 as zn,b6 as Ln,w as Zr,b7 as qn,b8 as Un,au as Wn,o as ur,ay as dr,b9 as Hn,ab as ze,ba as Vn,bb as pr,a as je,aU as or,bc as Xn,bd as en,ad as tn,F as fr,I as Jn,be as Kn}from"./assets/index-D1m34Ij7.js";import{h as Gn,v as Yn,C as Qn,H as Zn,A as eo,F as to}from"./assets/AppLoading-mci3gLZt.js";import{D as ro,z as mr}from"./assets/index-CNxDI4h-.js";import{u as it}from"./assets/index-CpW6Dhpp.js";/* empty css */import{P as rn}from"./assets/plus-CrtEUXaQ.js";import{X as ar}from"./assets/x-Dr3EBTzJ.js";import{A as no,i as oo,s as be,M as sr,S as It}from"./assets/index-BpJ9Bm5x.js";import{g as gr,a as ao,P as nn}from"./assets/index-CWzpBU29.js";import{flushSync as hr}from"react-dom";import"./assets/index-BVENTW1Q.js";/**
|
|
2
|
+
* @license lucide-react v0.456.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const so=Ye("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
7
|
+
* @license lucide-react v0.456.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const io=Ye("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
12
|
+
* @license lucide-react v0.456.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const zt=Ye("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/**
|
|
17
|
+
* @license lucide-react v0.456.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const lo=Ye("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
|
|
22
|
+
* @license lucide-react v0.456.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const co=Ye("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
27
|
+
* @license lucide-react v0.456.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const uo=Ye("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
|
|
32
|
+
* @license lucide-react v0.456.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const on=Ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
37
|
+
* @license lucide-react v0.456.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const po=Ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
42
|
+
* @license lucide-react v0.456.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const fo=Ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),mo=e=>{const{componentCls:t,iconCls:r,antCls:n,zIndexPopup:o,colorText:a,colorWarning:s,marginXXS:c,marginXS:p,fontSize:m,fontWeightStrong:y,colorTextHeading:v}=e;return{[t]:{zIndex:o,[`&${n}-popover`]:{fontSize:m},[`${t}-message`]:{marginBottom:p,display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t}-message-icon ${r}`]:{color:s,fontSize:m,lineHeight:1,marginInlineEnd:p},[`${t}-title`]:{fontWeight:y,color:v,"&:only-child":{fontWeight:"normal"}},[`${t}-description`]:{marginTop:c,color:a}},[`${t}-buttons`]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:p}}}}},go=e=>{const{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},an=rr("Popconfirm",e=>mo(e),go,{resetStyle:!1});var ho=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const sn=e=>{const{prefixCls:t,okButtonProps:r,cancelButtonProps:n,title:o,description:a,cancelText:s,okText:c,okType:p="primary",icon:m=F.createElement(jr,null),showCancel:y=!0,close:v,onConfirm:x,onCancel:w,onPopupClick:C}=e,{getPrefixCls:i}=F.useContext(mt),[f]=Rr("Popconfirm",zr.Popconfirm),g=gr(o),h=gr(a);return F.createElement("div",{className:`${t}-inner-content`,onClick:C},F.createElement("div",{className:`${t}-message`},m&&F.createElement("span",{className:`${t}-message-icon`},m),F.createElement("div",{className:`${t}-message-text`},g&&F.createElement("div",{className:`${t}-title`},g),h&&F.createElement("div",{className:`${t}-description`},h))),F.createElement("div",{className:`${t}-buttons`},y&&F.createElement(Xe,Object.assign({onClick:w,size:"small"},n),s||(f==null?void 0:f.cancelText)),F.createElement(no,{buttonProps:Object.assign(Object.assign({size:"small"},Nn(p)),r),actionFn:x,close:v,prefixCls:i("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},c||(f==null?void 0:f.okText))))},yo=e=>{const{prefixCls:t,placement:r,className:n,style:o}=e,a=ho(e,["prefixCls","placement","className","style"]),{getPrefixCls:s}=F.useContext(mt),c=s("popconfirm",t),[p]=an(c);return p(F.createElement(ao,{placement:r,className:Ce(c,n),style:o,content:F.createElement(sn,Object.assign({prefixCls:c},a))}))};var vo=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const bo=F.forwardRef((e,t)=>{var r,n;const{prefixCls:o,placement:a="top",trigger:s="click",okType:c="primary",icon:p=F.createElement(jr,null),children:m,overlayClassName:y,onOpenChange:v,onVisibleChange:x,overlayStyle:w,styles:C,classNames:i}=e,f=vo(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:g,className:h,style:E,classNames:D,styles:b}=Lr("popconfirm"),[A,k]=qr(!1,{value:(r=e.open)!==null&&r!==void 0?r:e.visible,defaultValue:(n=e.defaultOpen)!==null&&n!==void 0?n:e.defaultVisible}),T=(U,V)=>{k(U,!0),x==null||x(U),v==null||v(U,V)},N=U=>{T(!1,U)},$=U=>{var V;return(V=e.onConfirm)===null||V===void 0?void 0:V.call(void 0,U)},_=U=>{var V;T(!1,U),(V=e.onCancel)===null||V===void 0||V.call(void 0,U)},H=(U,V)=>{const{disabled:X=!1}=e;X||T(U,V)},z=g("popconfirm",o),L=Ce(z,h,y,D.root,i==null?void 0:i.root),M=Ce(D.body,i==null?void 0:i.body),[Q]=an(z);return Q(F.createElement(nn,Object.assign({},nr(f,["title"]),{trigger:s,placement:a,onOpenChange:H,open:A,ref:t,classNames:{root:L,body:M},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},b.root),E),w),C==null?void 0:C.root),body:Object.assign(Object.assign({},b.body),C==null?void 0:C.body)},content:F.createElement(sn,Object.assign({okType:c,icon:p},e,{prefixCls:z,close:N,onConfirm:$,onCancel:_})),"data-popover-inject":!0}),m))}),ln=bo;ln._InternalPanelDoNotUseOrYouWillBeFired=yo;var xo={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},Fo=function(){var t=Le([]),r=Le(null);return Se(function(){var n=Date.now(),o=!1;t.current.forEach(function(a){if(a){o=!0;var s=a.style;s.transitionDuration=".3s, .3s, .3s, .06s",r.current&&n-r.current<100&&(s.transitionDuration="0s, 0s")}}),o&&(r.current=Date.now())}),t.current},yr=0,Co=On();function wo(){var e;return Co?(e=yr,yr+=1):e="TEST_OR_SSR",e}const Eo=(function(e){var t=F.useState(),r=kn(t,2),n=r[0],o=r[1];return F.useEffect(function(){o("rc_progress_".concat(wo()))},[]),e||n});var vr=function(t){var r=t.bg,n=t.children;return F.createElement("div",{style:{width:"100%",height:"100%",background:r}},n)};function br(e,t){return Object.keys(e).map(function(r){var n=parseFloat(r),o="".concat(Math.floor(n*t),"%");return"".concat(e[r]," ").concat(o)})}var So=F.forwardRef(function(e,t){var r=e.prefixCls,n=e.color,o=e.gradientId,a=e.radius,s=e.style,c=e.ptg,p=e.strokeLinecap,m=e.strokeWidth,y=e.size,v=e.gapDegree,x=n&&pt(n)==="object",w=x?"#FFF":void 0,C=y/2,i=F.createElement("circle",{className:"".concat(r,"-circle-path"),r:a,cx:C,cy:C,stroke:w,strokeLinecap:p,strokeWidth:m,opacity:c===0?0:1,style:s,ref:t});if(!x)return i;var f="".concat(o,"-conic"),g=v?"".concat(180+v/2,"deg"):"0deg",h=br(n,(360-v)/360),E=br(n,1),D="conic-gradient(from ".concat(g,", ").concat(h.join(", "),")"),b="linear-gradient(to ".concat(v?"bottom":"top",", ").concat(E.join(", "),")");return F.createElement(F.Fragment,null,F.createElement("mask",{id:f},i),F.createElement("foreignObject",{x:0,y:0,width:y,height:y,mask:"url(#".concat(f,")")},F.createElement(vr,{bg:b},F.createElement(vr,{bg:D}))))}),Ft=100,Lt=function(t,r,n,o,a,s,c,p,m,y){var v=arguments.length>10&&arguments[10]!==void 0?arguments[10]:0,x=n/100*360*((360-s)/360),w=s===0?0:{bottom:0,top:180,left:90,right:-90}[c],C=(100-o)/100*r;m==="round"&&o!==100&&(C+=y/2,C>=r&&(C=r-.01));var i=Ft/2;return{stroke:typeof p=="string"?p:void 0,strokeDasharray:"".concat(r,"px ").concat(t),strokeDashoffset:C+v,transform:"rotate(".concat(a+x+w,"deg)"),transformOrigin:"".concat(i,"px ").concat(i,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},Do=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function xr(e){var t=e??[];return Array.isArray(t)?t:[t]}var Io=function(t){var r=Gt(Gt({},xo),t),n=r.id,o=r.prefixCls,a=r.steps,s=r.strokeWidth,c=r.trailWidth,p=r.gapDegree,m=p===void 0?0:p,y=r.gapPosition,v=r.trailColor,x=r.strokeLinecap,w=r.style,C=r.className,i=r.strokeColor,f=r.percent,g=Ur(r,Do),h=Ft/2,E=Eo(n),D="".concat(E,"-gradient"),b=h-s/2,A=Math.PI*2*b,k=m>0?90+m/2:-90,T=A*((360-m)/360),N=pt(a)==="object"?a:{count:a,gap:2},$=N.count,_=N.gap,H=xr(f),z=xr(i),L=z.find(function(ee){return ee&&pt(ee)==="object"}),M=L&&pt(L)==="object",Q=M?"butt":x,U=Lt(A,T,0,100,k,m,y,v,Q,s),V=Fo(),X=function(){var Y=0;return H.map(function(j,K){var le=z[K]||z[z.length-1],we=Lt(A,T,Y,j,k,m,y,le,Q,s);return Y+=j,F.createElement(So,{key:K,color:le,ptg:j,radius:b,prefixCls:o,gradientId:D,style:we,strokeLinecap:Q,strokeWidth:s,gapDegree:m,ref:function(Ne){V[K]=Ne},size:Ft})}).reverse()},q=function(){var Y=Math.round($*(H[0]/100)),j=100/$,K=0;return new Array($).fill(null).map(function(le,we){var Ie=we<=Y-1?z[0]:v,Ne=Ie&&pt(Ie)==="object"?"url(#".concat(D,")"):void 0,xe=Lt(A,T,K,j,k,m,y,Ie,"butt",s,_);return K+=(T-xe.strokeDashoffset+_)*100/T,F.createElement("circle",{key:we,className:"".concat(o,"-circle-path"),r:b,cx:h,cy:h,stroke:Ne,strokeWidth:s,opacity:1,style:xe,ref:function(_e){V[we]=_e}})})};return F.createElement("svg",Je({className:Ce("".concat(o,"-circle"),C),viewBox:"0 0 ".concat(Ft," ").concat(Ft),style:w,id:n,role:"presentation"},g),!$&&F.createElement("circle",{className:"".concat(o,"-circle-trail"),r:b,cx:h,cy:h,stroke:v,strokeLinecap:Q,strokeWidth:c||s,style:U}),$?q():X())};function nt(e){return!e||e<0?0:e>100?100:e}function Nt({success:e,successPercent:t}){let r=t;return e&&"progress"in e&&(r=e.progress),e&&"percent"in e&&(r=e.percent),r}const $o=({percent:e,success:t,successPercent:r})=>{const n=nt(Nt({success:t,successPercent:r}));return[n,nt(nt(e)-n)]},Ao=({success:e={},strokeColor:t})=>{const{strokeColor:r}=e;return[r||Yt.green,t||null]},Ot=(e,t,r)=>{var n,o,a,s;let c=-1,p=-1;if(t==="step"){const m=r.steps,y=r.strokeWidth;typeof e=="string"||typeof e>"u"?(c=e==="small"?2:14,p=y??8):typeof e=="number"?[c,p]=[e,e]:[c=14,p=8]=Array.isArray(e)?e:[e.width,e.height],c*=m}else if(t==="line"){const m=r==null?void 0:r.strokeWidth;typeof e=="string"||typeof e>"u"?p=m||(e==="small"?6:8):typeof e=="number"?[c,p]=[e,e]:[c=-1,p=8]=Array.isArray(e)?e:[e.width,e.height]}else(t==="circle"||t==="dashboard")&&(typeof e=="string"||typeof e>"u"?[c,p]=e==="small"?[60,60]:[120,120]:typeof e=="number"?[c,p]=[e,e]:Array.isArray(e)&&(c=(o=(n=e[0])!==null&&n!==void 0?n:e[1])!==null&&o!==void 0?o:120,p=(s=(a=e[0])!==null&&a!==void 0?a:e[1])!==null&&s!==void 0?s:120));return[c,p]},No=3,ko=e=>No/e*100,Oo=e=>{const{prefixCls:t,trailColor:r=null,strokeLinecap:n="round",gapPosition:o,gapDegree:a,width:s=120,type:c,children:p,success:m,size:y=s,steps:v}=e,[x,w]=Ot(y,"circle");let{strokeWidth:C}=e;C===void 0&&(C=Math.max(ko(x),6));const i={width:x,height:w,fontSize:x*.15+6},f=F.useMemo(()=>{if(a||a===0)return a;if(c==="dashboard")return 75},[a,c]),g=$o(e),h=o||c==="dashboard"&&"bottom"||void 0,E=Object.prototype.toString.call(e.strokeColor)==="[object Object]",D=Ao({success:m,strokeColor:e.strokeColor}),b=Ce(`${t}-inner`,{[`${t}-circle-gradient`]:E}),A=F.createElement(Io,{steps:v,percent:v?g[1]:g,strokeWidth:C,trailWidth:C,strokeColor:v?D[1]:D,strokeLinecap:n,trailColor:r,prefixCls:t,gapDegree:f,gapPosition:h}),k=x<=20,T=F.createElement("div",{className:b,style:i},A,!k&&p);return k?F.createElement(Wr,{title:p},T):T},kt="--progress-line-stroke-color",cn="--progress-percent",Fr=e=>{const t=e?"100%":"-100%";return new Qt(`antProgress${e?"RTL":"LTR"}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:"translateX(0) scaleX(1)",opacity:0}})},Bo=e=>{const{componentCls:t,iconCls:r}=e;return{[t]:Object.assign(Object.assign({},Vr(e)),{display:"inline-block","&-rtl":{direction:"rtl"},"&-line":{position:"relative",width:"100%",fontSize:e.fontSize},[`${t}-outer`]:{display:"inline-flex",alignItems:"center",width:"100%"},[`${t}-inner`]:{position:"relative",display:"inline-block",width:"100%",flex:1,overflow:"hidden",verticalAlign:"middle",backgroundColor:e.remainingColor,borderRadius:e.lineBorderRadius},[`${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.defaultColor}},[`${t}-success-bg, ${t}-bg`]:{position:"relative",background:e.defaultColor,borderRadius:e.lineBorderRadius,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`},[`${t}-layout-bottom`]:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",[`${t}-text`]:{width:"max-content",marginInlineStart:0,marginTop:e.marginXXS}},[`${t}-bg`]:{overflow:"hidden","&::after":{content:'""',background:{_multi_value_:!0,value:["inherit",`var(${kt})`]},height:"100%",width:`calc(1 / var(${cn}) * 100%)`,display:"block"},[`&${t}-bg-inner`]:{minWidth:"max-content","&::after":{content:"none"},[`${t}-text-inner`]:{color:e.colorWhite,[`&${t}-text-bright`]:{color:"rgba(0, 0, 0, 0.45)"}}}},[`${t}-success-bg`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,backgroundColor:e.colorSuccess},[`${t}-text`]:{display:"inline-block",marginInlineStart:e.marginXS,color:e.colorText,lineHeight:1,width:"2em",whiteSpace:"nowrap",textAlign:"start",verticalAlign:"middle",wordBreak:"normal",[r]:{fontSize:e.fontSize},[`&${t}-text-outer`]:{width:"max-content"},[`&${t}-text-outer${t}-text-start`]:{width:"max-content",marginInlineStart:0,marginInlineEnd:e.marginXS}},[`${t}-text-inner`]:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",marginInlineStart:0,padding:`0 ${Re(e.paddingXXS)}`,[`&${t}-text-start`]:{justifyContent:"start"},[`&${t}-text-end`]:{justifyContent:"end"}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:"absolute",inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.lineBorderRadius,opacity:0,animationName:Fr(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:"infinite",content:'""'}},[`&${t}-rtl${t}-status-active`]:{[`${t}-bg::before`]:{animationName:Fr(!0)}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}},_o=e=>{const{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.remainingColor},[`&${t}-circle ${t}-inner`]:{position:"relative",lineHeight:1,backgroundColor:"transparent"},[`&${t}-circle ${t}-text`]:{position:"absolute",insetBlockStart:"50%",insetInlineStart:0,width:"100%",margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:"normal",textAlign:"center",transform:"translateY(-50%)",[r]:{fontSize:e.circleIconFontSize}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:"bottom"}}}},To=e=>{const{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:"inline-block","&-outer":{display:"flex",flexDirection:"row",alignItems:"center"},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}},Po=e=>{const{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${r}`]:{fontSize:e.fontSizeSM}}}},Mo=e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:"1em",circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`}),jo=rr("Progress",e=>{const t=e.calc(e.marginXXS).div(2).equal(),r=Hr(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:"2.4s"});return[Bo(r),_o(r),To(r),Po(r)]},Mo);var Ro=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const zo=e=>{let t=[];return Object.keys(e).forEach(r=>{const n=Number.parseFloat(r.replace(/%/g,""));Number.isNaN(n)||t.push({key:n,value:e[r]})}),t=t.sort((r,n)=>r.key-n.key),t.map(({key:r,value:n})=>`${n} ${r}%`).join(", ")},Lo=(e,t)=>{const{from:r=Yt.blue,to:n=Yt.blue,direction:o=t==="rtl"?"to left":"to right"}=e,a=Ro(e,["from","to","direction"]);if(Object.keys(a).length!==0){const c=zo(a),p=`linear-gradient(${o}, ${c})`;return{background:p,[kt]:p}}const s=`linear-gradient(${o}, ${r}, ${n})`;return{background:s,[kt]:s}},qo=e=>{const{prefixCls:t,direction:r,percent:n,size:o,strokeWidth:a,strokeColor:s,strokeLinecap:c="round",children:p,trailColor:m=null,percentPosition:y,success:v}=e,{align:x,type:w}=y,C=s&&typeof s!="string"?Lo(s,r):{[kt]:s,background:s},i=c==="square"||c==="butt"?0:void 0,f=o??[-1,a||(o==="small"?6:8)],[g,h]=Ot(f,"line",{strokeWidth:a}),E={backgroundColor:m||void 0,borderRadius:i},D=Object.assign(Object.assign({width:`${nt(n)}%`,height:h,borderRadius:i},C),{[cn]:nt(n)/100}),b=Nt(e),A={width:`${nt(b)}%`,height:h,borderRadius:i,backgroundColor:v==null?void 0:v.strokeColor},k={width:g<0?"100%":g},T=F.createElement("div",{className:`${t}-inner`,style:E},F.createElement("div",{className:Ce(`${t}-bg`,`${t}-bg-${w}`),style:D},w==="inner"&&p),b!==void 0&&F.createElement("div",{className:`${t}-success-bg`,style:A})),N=w==="outer"&&x==="start",$=w==="outer"&&x==="end";return w==="outer"&&x==="center"?F.createElement("div",{className:`${t}-layout-bottom`},T,p):F.createElement("div",{className:`${t}-outer`,style:k},N&&p,T,$&&p)},Uo=e=>{const{size:t,steps:r,rounding:n=Math.round,percent:o=0,strokeWidth:a=8,strokeColor:s,trailColor:c=null,prefixCls:p,children:m}=e,y=n(r*(o/100)),x=t??[t==="small"?2:14,a],[w,C]=Ot(x,"step",{steps:r,strokeWidth:a}),i=w/r,f=Array.from({length:r});for(let g=0;g<r;g++){const h=Array.isArray(s)?s[g]:s;f[g]=F.createElement("div",{key:g,className:Ce(`${p}-steps-item`,{[`${p}-steps-item-active`]:g<=y-1}),style:{backgroundColor:g<=y-1?h:c,width:i,height:C}})}return F.createElement("div",{className:`${p}-steps-outer`},f,m)};var Wo=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const Ho=["normal","exception","active","success"],Vo=F.forwardRef((e,t)=>{const{prefixCls:r,className:n,rootClassName:o,steps:a,strokeColor:s,percent:c=0,size:p="default",showInfo:m=!0,type:y="line",status:v,format:x,style:w,percentPosition:C={}}=e,i=Wo(e,["prefixCls","className","rootClassName","steps","strokeColor","percent","size","showInfo","type","status","format","style","percentPosition"]),{align:f="end",type:g="outer"}=C,h=Array.isArray(s)?s[0]:s,E=typeof s=="string"||Array.isArray(s)?s:void 0,D=F.useMemo(()=>{if(h){const X=typeof h=="string"?h:Object.values(h)[0];return new Bn(X).isLight()}return!1},[s]),b=F.useMemo(()=>{var X,q;const ee=Nt(e);return Number.parseInt(ee!==void 0?(X=ee??0)===null||X===void 0?void 0:X.toString():(q=c??0)===null||q===void 0?void 0:q.toString(),10)},[c,e.success,e.successPercent]),A=F.useMemo(()=>!Ho.includes(v)&&b>=100?"success":v||"normal",[v,b]),{getPrefixCls:k,direction:T,progress:N}=F.useContext(mt),$=k("progress",r),[_,H,z]=jo($),L=y==="line",M=L&&!a,Q=F.useMemo(()=>{if(!m)return null;const X=Nt(e);let q;const ee=x||(j=>`${j}%`),Y=L&&D&&g==="inner";return g==="inner"||x||A!=="exception"&&A!=="success"?q=ee(nt(c),nt(X)):A==="exception"?q=L?F.createElement(_n,null):F.createElement(Tn,null):A==="success"&&(q=L?F.createElement(Pn,null):F.createElement(Mn,null)),F.createElement("span",{className:Ce(`${$}-text`,{[`${$}-text-bright`]:Y,[`${$}-text-${f}`]:M,[`${$}-text-${g}`]:M}),title:typeof q=="string"?q:void 0},q)},[m,c,b,A,y,$,x]);let U;y==="line"?U=a?F.createElement(Uo,Object.assign({},e,{strokeColor:E,prefixCls:$,steps:typeof a=="object"?a.count:a}),Q):F.createElement(qo,Object.assign({},e,{strokeColor:h,prefixCls:$,direction:T,percentPosition:{align:f,type:g}}),Q):(y==="circle"||y==="dashboard")&&(U=F.createElement(Oo,Object.assign({},e,{strokeColor:h,prefixCls:$,progressStatus:A}),Q));const V=Ce($,`${$}-status-${A}`,{[`${$}-${y==="dashboard"&&"circle"||y}`]:y!=="line",[`${$}-inline-circle`]:y==="circle"&&Ot(p,"circle")[0]<=20,[`${$}-line`]:M,[`${$}-line-align-${f}`]:M,[`${$}-line-position-${g}`]:M,[`${$}-steps`]:a,[`${$}-show-info`]:m,[`${$}-${p}`]:typeof p=="string",[`${$}-rtl`]:T==="rtl"},N==null?void 0:N.className,n,o,H,z);return _(F.createElement("div",Object.assign({ref:t,style:Object.assign(Object.assign({},N==null?void 0:N.style),w),className:V,role:"progressbar","aria-valuenow":b,"aria-valuemin":0,"aria-valuemax":100},nr(i,["trailColor","strokeWidth","width","gapDegree","gapPosition","strokeLinecap","success","successPercent"])),U))});var Xo={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},Jo=function(t,r){return F.createElement(wt,Je({},t,{ref:r,icon:Xo}))},Ko=F.forwardRef(Jo);const qt=(function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(","),n=e.name||"",o=e.type||"",a=o.replace(/\/.*$/,"");return r.some(function(s){var c=s.trim();if(/^\*(\/\*)?$/.test(s))return!0;if(c.charAt(0)==="."){var p=n.toLowerCase(),m=c.toLowerCase(),y=[m];return(m===".jpg"||m===".jpeg")&&(y=[".jpg",".jpeg"]),y.some(function(v){return p.endsWith(v)})}return/\/\*$/.test(c)?a===c.replace(/\/.*$/,""):o===c?!0:/^\w+$/.test(c)?(jn(!1,"Upload takes an invalidate 'accept' type '".concat(c,"'.Skip for check.")),!0):!1})}return!0});function Go(e,t){var r="cannot ".concat(e.method," ").concat(e.action," ").concat(t.status,"'"),n=new Error(r);return n.status=t.status,n.method=e.method,n.url=e.action,n}function Cr(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch{return t}}function wr(e){var t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=function(a){a.total>0&&(a.percent=a.loaded/a.total*100),e.onProgress(a)});var r=new FormData;e.data&&Object.keys(e.data).forEach(function(o){var a=e.data[o];if(Array.isArray(a)){a.forEach(function(s){r.append("".concat(o,"[]"),s)});return}r.append(o,a)}),e.file instanceof Blob?r.append(e.filename,e.file,e.file.name):r.append(e.filename,e.file),t.onerror=function(a){e.onError(a)},t.onload=function(){return t.status<200||t.status>=300?e.onError(Go(e,t),Cr(t)):e.onSuccess(Cr(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);var n=e.headers||{};return n["X-Requested-With"]!==null&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(n).forEach(function(o){n[o]!==null&&t.setRequestHeader(o,n[o])}),t.send(r),{abort:function(){t.abort()}}}var Yo=(function(){var e=rt(Oe().mark(function t(r,n){var o,a,s,c,p,m,y,v;return Oe().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:m=function(){return m=rt(Oe().mark(function i(f){return Oe().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.abrupt("return",new Promise(function(E){f.file(function(D){n(D)?(f.fullPath&&!D.webkitRelativePath&&(Object.defineProperties(D,{webkitRelativePath:{writable:!0}}),D.webkitRelativePath=f.fullPath.replace(/^\//,""),Object.defineProperties(D,{webkitRelativePath:{writable:!1}})),E(D)):E(null)})}));case 1:case"end":return h.stop()}},i)})),m.apply(this,arguments)},p=function(i){return m.apply(this,arguments)},c=function(){return c=rt(Oe().mark(function i(f){var g,h,E,D,b;return Oe().wrap(function(k){for(;;)switch(k.prev=k.next){case 0:g=f.createReader(),h=[];case 2:return k.next=5,new Promise(function(T){g.readEntries(T,function(){return T([])})});case 5:if(E=k.sent,D=E.length,D){k.next=9;break}return k.abrupt("break",12);case 9:for(b=0;b<D;b++)h.push(E[b]);k.next=2;break;case 12:return k.abrupt("return",h);case 13:case"end":return k.stop()}},i)})),c.apply(this,arguments)},s=function(i){return c.apply(this,arguments)},o=[],a=[],r.forEach(function(C){return a.push(C.webkitGetAsEntry())}),y=(function(){var C=rt(Oe().mark(function i(f,g){var h,E;return Oe().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(f){b.next=2;break}return b.abrupt("return");case 2:if(f.path=g||"",!f.isFile){b.next=10;break}return b.next=6,p(f);case 6:h=b.sent,h&&o.push(h),b.next=15;break;case 10:if(!f.isDirectory){b.next=15;break}return b.next=13,s(f);case 13:E=b.sent,a.push.apply(a,Ve(E));case 15:case"end":return b.stop()}},i)}));return function(f,g){return C.apply(this,arguments)}})(),v=0;case 9:if(!(v<a.length)){w.next=15;break}return w.next=12,y(a[v]);case 12:v++,w.next=9;break;case 15:return w.abrupt("return",o);case 16:case"end":return w.stop()}},t)}));return function(r,n){return e.apply(this,arguments)}})(),Qo=+new Date,Zo=0;function Ut(){return"rc-upload-".concat(Qo,"-").concat(++Zo)}var ea=["component","prefixCls","className","classNames","disabled","id","name","style","styles","multiple","accept","capture","children","directory","folder","openFileDialogOnClick","onMouseEnter","onMouseLeave","hasControlInside"],ta=(function(e){Xr(r,e);var t=Jr(r);function r(){var n;Kr(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return n=t.call.apply(t,[this].concat(a)),Ee($e(n),"state",{uid:Ut()}),Ee($e(n),"reqs",{}),Ee($e(n),"fileInput",void 0),Ee($e(n),"_isMounted",void 0),Ee($e(n),"onChange",function(c){var p=n.props,m=p.accept,y=p.directory,v=c.target.files,x=Ve(v).filter(function(w){return!y||qt(w,m)});n.uploadFiles(x),n.reset()}),Ee($e(n),"onClick",function(c){var p=n.fileInput;if(p){var m=c.target,y=n.props.onClick;if(m&&m.tagName==="BUTTON"){var v=p.parentNode;v.focus(),m.blur()}p.click(),y&&y(c)}}),Ee($e(n),"onKeyDown",function(c){c.key==="Enter"&&n.onClick(c)}),Ee($e(n),"onDataTransferFiles",(function(){var c=rt(Oe().mark(function p(m,y){var v,x,w,C,i,f,g;return Oe().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(v=n.props,x=v.multiple,w=v.accept,C=v.directory,i=Ve(m.items||[]),f=Ve(m.files||[]),(f.length>0||i.some(function(D){return D.kind==="file"}))&&(y==null||y()),!C){E.next=11;break}return E.next=7,Yo(Array.prototype.slice.call(i),function(D){return qt(D,n.props.accept)});case 7:f=E.sent,n.uploadFiles(f),E.next=14;break;case 11:g=Ve(f).filter(function(D){return qt(D,w)}),x===!1&&(g=f.slice(0,1)),n.uploadFiles(g);case 14:case"end":return E.stop()}},p)}));return function(p,m){return c.apply(this,arguments)}})()),Ee($e(n),"onFilePaste",(function(){var c=rt(Oe().mark(function p(m){var y,v;return Oe().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(y=n.props.pastable,y){w.next=3;break}return w.abrupt("return");case 3:if(m.type!=="paste"){w.next=6;break}return v=m.clipboardData,w.abrupt("return",n.onDataTransferFiles(v,function(){m.preventDefault()}));case 6:case"end":return w.stop()}},p)}));return function(p){return c.apply(this,arguments)}})()),Ee($e(n),"onFileDragOver",function(c){c.preventDefault()}),Ee($e(n),"onFileDrop",(function(){var c=rt(Oe().mark(function p(m){var y;return Oe().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(m.preventDefault(),m.type!=="drop"){x.next=4;break}return y=m.dataTransfer,x.abrupt("return",n.onDataTransferFiles(y));case 4:case"end":return x.stop()}},p)}));return function(p){return c.apply(this,arguments)}})()),Ee($e(n),"uploadFiles",function(c){var p=Ve(c),m=p.map(function(y){return y.uid=Ut(),n.processFile(y,p)});Promise.all(m).then(function(y){var v=n.props.onBatchStart;v==null||v(y.map(function(x){var w=x.origin,C=x.parsedFile;return{file:w,parsedFile:C}})),y.filter(function(x){return x.parsedFile!==null}).forEach(function(x){n.post(x)})})}),Ee($e(n),"processFile",(function(){var c=rt(Oe().mark(function p(m,y){var v,x,w,C,i,f,g,h,E;return Oe().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(v=n.props.beforeUpload,x=m,!v){b.next=14;break}return b.prev=3,b.next=6,v(m,y);case 6:x=b.sent,b.next=12;break;case 9:b.prev=9,b.t0=b.catch(3),x=!1;case 12:if(x!==!1){b.next=14;break}return b.abrupt("return",{origin:m,parsedFile:null,action:null,data:null});case 14:if(w=n.props.action,typeof w!="function"){b.next=21;break}return b.next=18,w(m);case 18:C=b.sent,b.next=22;break;case 21:C=w;case 22:if(i=n.props.data,typeof i!="function"){b.next=29;break}return b.next=26,i(m);case 26:f=b.sent,b.next=30;break;case 29:f=i;case 30:return g=(pt(x)==="object"||typeof x=="string")&&x?x:m,g instanceof File?h=g:h=new File([g],m.name,{type:m.type}),E=h,E.uid=m.uid,b.abrupt("return",{origin:m,data:f,parsedFile:E,action:C});case 35:case"end":return b.stop()}},p,null,[[3,9]])}));return function(p,m){return c.apply(this,arguments)}})()),Ee($e(n),"saveFileInput",function(c){n.fileInput=c}),n}return Gr(r,[{key:"componentDidMount",value:function(){this._isMounted=!0;var o=this.props.pastable;o&&document.addEventListener("paste",this.onFilePaste)}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort(),document.removeEventListener("paste",this.onFilePaste)}},{key:"componentDidUpdate",value:function(o){var a=this.props.pastable;a&&!o.pastable?document.addEventListener("paste",this.onFilePaste):!a&&o.pastable&&document.removeEventListener("paste",this.onFilePaste)}},{key:"post",value:function(o){var a=this,s=o.data,c=o.origin,p=o.action,m=o.parsedFile;if(this._isMounted){var y=this.props,v=y.onStart,x=y.customRequest,w=y.name,C=y.headers,i=y.withCredentials,f=y.method,g=c.uid,h=x||wr,E={action:p,filename:w,data:s,file:m,headers:C,withCredentials:i,method:f||"post",onProgress:function(b){var A=a.props.onProgress;A==null||A(b,m)},onSuccess:function(b,A){var k=a.props.onSuccess;k==null||k(b,m,A),delete a.reqs[g]},onError:function(b,A){var k=a.props.onError;k==null||k(b,A,m),delete a.reqs[g]}};v(c),this.reqs[g]=h(E,{defaultRequest:wr})}}},{key:"reset",value:function(){this.setState({uid:Ut()})}},{key:"abort",value:function(o){var a=this.reqs;if(o){var s=o.uid?o.uid:o;a[s]&&a[s].abort&&a[s].abort(),delete a[s]}else Object.keys(a).forEach(function(c){a[c]&&a[c].abort&&a[c].abort(),delete a[c]})}},{key:"render",value:function(){var o=this.props,a=o.component,s=o.prefixCls,c=o.className,p=o.classNames,m=p===void 0?{}:p,y=o.disabled,v=o.id,x=o.name,w=o.style,C=o.styles,i=C===void 0?{}:C,f=o.multiple,g=o.accept,h=o.capture,E=o.children,D=o.directory,b=o.folder,A=o.openFileDialogOnClick,k=o.onMouseEnter,T=o.onMouseLeave,N=o.hasControlInside,$=Ur(o,ea),_=Ce(Ee(Ee(Ee({},s,!0),"".concat(s,"-disabled"),y),c,c)),H=D||b?{directory:"directory",webkitdirectory:"webkitdirectory"}:{},z=y?{}:{onClick:A?this.onClick:function(){},onKeyDown:A?this.onKeyDown:function(){},onMouseEnter:k,onMouseLeave:T,onDrop:this.onFileDrop,onDragOver:this.onFileDragOver,tabIndex:N?void 0:"0"};return Ge.createElement(a,Je({},z,{className:_,role:N?void 0:"button",style:w}),Ge.createElement("input",Je({},Rn($,{aria:!0,data:!0}),{id:v,name:x,disabled:y,type:"file",ref:this.saveFileInput,onClick:function(M){return M.stopPropagation()},key:this.state.uid,style:Gt({display:"none"},i.input),className:m.input,accept:g},H,{multiple:f,onChange:this.onChange},h!=null?{capture:h}:{})),E)}}]),r})(Mr);function Wt(){}var Zt=(function(e){Xr(r,e);var t=Jr(r);function r(){var n;Kr(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return n=t.call.apply(t,[this].concat(a)),Ee($e(n),"uploader",void 0),Ee($e(n),"saveUploader",function(c){n.uploader=c}),n}return Gr(r,[{key:"abort",value:function(o){this.uploader.abort(o)}},{key:"render",value:function(){return Ge.createElement(ta,Je({},this.props,{ref:this.saveUploader}))}}]),r})(Mr);Ee(Zt,"defaultProps",{component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:Wt,onError:Wt,onSuccess:Wt,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0,hasControlInside:!1});const ra=e=>{const{componentCls:t,iconCls:r}=e;return{[`${t}-wrapper`]:{[`${t}-drag`]:{position:"relative",width:"100%",height:"100%",textAlign:"center",background:e.colorFillAlter,border:`${Re(e.lineWidth)} dashed ${e.colorBorder}`,borderRadius:e.borderRadiusLG,cursor:"pointer",transition:`border-color ${e.motionDurationSlow}`,[t]:{padding:e.padding},[`${t}-btn`]:{display:"table",width:"100%",height:"100%",outline:"none",borderRadius:e.borderRadiusLG,"&:focus-visible":{outline:`${Re(e.lineWidthFocus)} solid ${e.colorPrimaryBorder}`}},[`${t}-drag-container`]:{display:"table-cell",verticalAlign:"middle"},[`
|
|
47
|
+
&:not(${t}-disabled):hover,
|
|
48
|
+
&-hover:not(${t}-disabled)
|
|
49
|
+
`]:{borderColor:e.colorPrimaryHover},[`p${t}-drag-icon`]:{marginBottom:e.margin,[r]:{color:e.colorPrimary,fontSize:e.uploadThumbnailSize}},[`p${t}-text`]:{margin:`0 0 ${Re(e.marginXXS)}`,color:e.colorTextHeading,fontSize:e.fontSizeLG},[`p${t}-hint`]:{color:e.colorTextDescription,fontSize:e.fontSize},[`&${t}-disabled`]:{[`p${t}-drag-icon ${r},
|
|
50
|
+
p${t}-text,
|
|
51
|
+
p${t}-hint
|
|
52
|
+
`]:{color:e.colorTextDisabled}}}}}},na=e=>{const{componentCls:t,iconCls:r,fontSize:n,lineHeight:o,calc:a}=e,s=`${t}-list-item`,c=`${s}-actions`,p=`${s}-action`;return{[`${t}-wrapper`]:{[`${t}-list`]:Object.assign(Object.assign({},Yr()),{lineHeight:e.lineHeight,[s]:{position:"relative",height:a(e.lineHeight).mul(n).equal(),marginTop:e.marginXS,fontSize:n,display:"flex",alignItems:"center",transition:`background-color ${e.motionDurationSlow}`,borderRadius:e.borderRadiusSM,"&:hover":{backgroundColor:e.controlItemBgHover},[`${s}-name`]:Object.assign(Object.assign({},Qr),{padding:`0 ${Re(e.paddingXS)}`,lineHeight:o,flex:"auto",transition:`all ${e.motionDurationSlow}`}),[c]:{whiteSpace:"nowrap",[p]:{opacity:0},[r]:{color:e.actionsColor,transition:`all ${e.motionDurationSlow}`},[`
|
|
53
|
+
${p}:focus-visible,
|
|
54
|
+
&.picture ${p}
|
|
55
|
+
`]:{opacity:1}},[`${t}-icon ${r}`]:{color:e.colorIcon,fontSize:n},[`${s}-progress`]:{position:"absolute",bottom:e.calc(e.uploadProgressOffset).mul(-1).equal(),width:"100%",paddingInlineStart:a(n).add(e.paddingXS).equal(),fontSize:n,lineHeight:0,pointerEvents:"none","> div":{margin:0}}},[`${s}:hover ${p}`]:{opacity:1},[`${s}-error`]:{color:e.colorError,[`${s}-name, ${t}-icon ${r}`]:{color:e.colorError},[c]:{[`${r}, ${r}:hover`]:{color:e.colorError},[p]:{opacity:1}}},[`${t}-list-item-container`]:{transition:`opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,"&::before":{display:"table",width:0,height:0,content:'""'}}})}}},oa=e=>{const{componentCls:t}=e,r=new Qt("uploadAnimateInlineIn",{from:{width:0,height:0,padding:0,opacity:0,margin:e.calc(e.marginXS).div(-2).equal()}}),n=new Qt("uploadAnimateInlineOut",{to:{width:0,height:0,padding:0,opacity:0,margin:e.calc(e.marginXS).div(-2).equal()}}),o=`${t}-animate-inline`;return[{[`${t}-wrapper`]:{[`${o}-appear, ${o}-enter, ${o}-leave`]:{animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseInOutCirc,animationFillMode:"forwards"},[`${o}-appear, ${o}-enter`]:{animationName:r},[`${o}-leave`]:{animationName:n}}},{[`${t}-wrapper`]:oo(e)},r,n]},aa=e=>{const{componentCls:t,iconCls:r,uploadThumbnailSize:n,uploadProgressOffset:o,calc:a}=e,s=`${t}-list`,c=`${s}-item`;return{[`${t}-wrapper`]:{[`
|
|
56
|
+
${s}${s}-picture,
|
|
57
|
+
${s}${s}-picture-card,
|
|
58
|
+
${s}${s}-picture-circle
|
|
59
|
+
`]:{[c]:{position:"relative",height:a(n).add(a(e.lineWidth).mul(2)).add(a(e.paddingXS).mul(2)).equal(),padding:e.paddingXS,border:`${Re(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusLG,"&:hover":{background:"transparent"},[`${c}-thumbnail`]:Object.assign(Object.assign({},Qr),{width:n,height:n,lineHeight:Re(a(n).add(e.paddingSM).equal()),textAlign:"center",flex:"none",[r]:{fontSize:e.fontSizeHeading2,color:e.colorPrimary},img:{display:"block",width:"100%",height:"100%",overflow:"hidden"}}),[`${c}-progress`]:{bottom:o,width:`calc(100% - ${Re(a(e.paddingSM).mul(2).equal())})`,marginTop:0,paddingInlineStart:a(n).add(e.paddingXS).equal()}},[`${c}-error`]:{borderColor:e.colorError,[`${c}-thumbnail ${r}`]:{[`svg path[fill='${cr[0]}']`]:{fill:e.colorErrorBg},[`svg path[fill='${cr.primary}']`]:{fill:e.colorError}}},[`${c}-uploading`]:{borderStyle:"dashed",[`${c}-name`]:{marginBottom:o}}},[`${s}${s}-picture-circle ${c}`]:{[`&, &::before, ${c}-thumbnail`]:{borderRadius:"50%"}}}}},sa=e=>{const{componentCls:t,iconCls:r,fontSizeLG:n,colorTextLightSolid:o,calc:a}=e,s=`${t}-list`,c=`${s}-item`,p=e.uploadPicCardSize;return{[`
|
|
60
|
+
${t}-wrapper${t}-picture-card-wrapper,
|
|
61
|
+
${t}-wrapper${t}-picture-circle-wrapper
|
|
62
|
+
`]:Object.assign(Object.assign({},Yr()),{display:"block",[`${t}${t}-select`]:{width:p,height:p,textAlign:"center",verticalAlign:"top",backgroundColor:e.colorFillAlter,border:`${Re(e.lineWidth)} dashed ${e.colorBorder}`,borderRadius:e.borderRadiusLG,cursor:"pointer",transition:`border-color ${e.motionDurationSlow}`,[`> ${t}`]:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",textAlign:"center"},[`&:not(${t}-disabled):hover`]:{borderColor:e.colorPrimary}},[`${s}${s}-picture-card, ${s}${s}-picture-circle`]:{display:"flex",flexWrap:"wrap","@supports not (gap: 1px)":{"& > *":{marginBlockEnd:e.marginXS,marginInlineEnd:e.marginXS}},"@supports (gap: 1px)":{gap:e.marginXS},[`${s}-item-container`]:{display:"inline-block",width:p,height:p,verticalAlign:"top"},"&::after":{display:"none"},"&::before":{display:"none"},[c]:{height:"100%",margin:0,"&::before":{position:"absolute",zIndex:1,width:`calc(100% - ${Re(a(e.paddingXS).mul(2).equal())})`,height:`calc(100% - ${Re(a(e.paddingXS).mul(2).equal())})`,backgroundColor:e.colorBgMask,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'" "'}},[`${c}:hover`]:{[`&::before, ${c}-actions`]:{opacity:1}},[`${c}-actions`]:{position:"absolute",insetInlineStart:0,zIndex:10,width:"100%",whiteSpace:"nowrap",textAlign:"center",opacity:0,transition:`all ${e.motionDurationSlow}`,[`
|
|
63
|
+
${r}-eye,
|
|
64
|
+
${r}-download,
|
|
65
|
+
${r}-delete
|
|
66
|
+
`]:{zIndex:10,width:n,margin:`0 ${Re(e.marginXXS)}`,fontSize:n,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,color:o,"&:hover":{color:o},svg:{verticalAlign:"baseline"}}},[`${c}-thumbnail, ${c}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${c}-name`]:{display:"none",textAlign:"center"},[`${c}-file + ${c}-name`]:{position:"absolute",bottom:e.margin,display:"block",width:`calc(100% - ${Re(a(e.paddingXS).mul(2).equal())})`},[`${c}-uploading`]:{[`&${c}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${r}-eye, ${r}-download, ${r}-delete`]:{display:"none"}},[`${c}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${Re(a(e.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${t}-wrapper${t}-picture-circle-wrapper`]:{[`${t}${t}-select`]:{borderRadius:"50%"}}}},ia=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},la=e=>{const{componentCls:t,colorTextDisabled:r}=e;return{[`${t}-wrapper`]:Object.assign(Object.assign({},Vr(e)),{[t]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${t}-select`]:{display:"inline-block"},[`${t}-hidden`]:{display:"none"},[`${t}-disabled`]:{color:r,cursor:"not-allowed"}})}},ca=e=>({actionsColor:e.colorIcon,pictureCardSize:e.controlHeightLG*2.55}),ua=rr("Upload",e=>{const{fontSizeHeading3:t,fontHeight:r,lineWidth:n,pictureCardSize:o,calc:a}=e,s=Hr(e,{uploadThumbnailSize:a(t).mul(2).equal(),uploadProgressOffset:a(a(r).div(2)).add(n).equal(),uploadPicCardSize:o});return[la(s),ra(s),aa(s),sa(s),na(s),oa(s),ia(s),zn(s)]},ca);var da={icon:function(t,r){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M534 352V136H232v752h560V394H576a42 42 0 01-42-42z",fill:r}},{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z",fill:t}}]}},name:"file",theme:"twotone"},pa=function(t,r){return F.createElement(wt,Je({},t,{ref:r,icon:da}))},fa=F.forwardRef(pa),ma={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"},ga=function(t,r){return F.createElement(wt,Je({},t,{ref:r,icon:ma}))},ha=F.forwardRef(ga),ya={icon:function(t,r){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z",fill:t}},{tag:"path",attrs:{d:"M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z",fill:r}},{tag:"path",attrs:{d:"M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z",fill:r}},{tag:"path",attrs:{d:"M276 368a28 28 0 1056 0 28 28 0 10-56 0z",fill:r}},{tag:"path",attrs:{d:"M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z",fill:t}}]}},name:"picture",theme:"twotone"},va=function(t,r){return F.createElement(wt,Je({},t,{ref:r,icon:ya}))},ba=F.forwardRef(va);function $t(e){return Object.assign(Object.assign({},e),{lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.name,size:e.size,type:e.type,uid:e.uid,percent:0,originFileObj:e})}function At(e,t){const r=Ve(t),n=r.findIndex(({uid:o})=>o===e.uid);return n===-1?r.push(e):r[n]=e,r}function Ht(e,t){const r=e.uid!==void 0?"uid":"name";return t.filter(n=>n[r]===e[r])[0]}function xa(e,t){const r=e.uid!==void 0?"uid":"name",n=t.filter(o=>o[r]!==e[r]);return n.length===t.length?null:n}const Fa=(e="")=>{const t=e.split("/"),n=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(n)||[""])[0]},un=e=>e.indexOf("image/")===0,Ca=e=>{if(e.type&&!e.thumbUrl)return un(e.type);const t=e.thumbUrl||e.url||"",r=Fa(t);return/^data:image\//.test(t)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(r)?!0:!(/^data:/.test(t)||r)},tt=200;function wa(e){return new Promise(t=>{if(!e.type||!un(e.type)){t("");return}const r=document.createElement("canvas");r.width=tt,r.height=tt,r.style.cssText=`position: fixed; left: 0; top: 0; width: ${tt}px; height: ${tt}px; z-index: 9999; display: none;`,document.body.appendChild(r);const n=r.getContext("2d"),o=new Image;if(o.onload=()=>{const{width:a,height:s}=o;let c=tt,p=tt,m=0,y=0;a>s?(p=s*(tt/a),y=-(p-c)/2):(c=a*(tt/s),m=-(c-p)/2),n.drawImage(o,m,y,c,p);const v=r.toDataURL();document.body.removeChild(r),window.URL.revokeObjectURL(o.src),t(v)},o.crossOrigin="anonymous",e.type.startsWith("image/svg+xml")){const a=new FileReader;a.onload=()=>{a.result&&typeof a.result=="string"&&(o.src=a.result)},a.readAsDataURL(e)}else if(e.type.startsWith("image/gif")){const a=new FileReader;a.onload=()=>{a.result&&t(a.result)},a.readAsDataURL(e)}else o.src=window.URL.createObjectURL(e)})}var Ea={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"},Sa=function(t,r){return F.createElement(wt,Je({},t,{ref:r,icon:Ea}))},Da=F.forwardRef(Sa);const Ia=F.forwardRef(({prefixCls:e,className:t,style:r,locale:n,listType:o,file:a,items:s,progress:c,iconRender:p,actionIconRender:m,itemRender:y,isImgUrl:v,showPreviewIcon:x,showRemoveIcon:w,showDownloadIcon:C,previewIcon:i,removeIcon:f,downloadIcon:g,extra:h,onPreview:E,onDownload:D,onClose:b},A)=>{var k,T;const{status:N}=a,[$,_]=F.useState(N);F.useEffect(()=>{N!=="removed"&&_(N)},[N]);const[H,z]=F.useState(!1);F.useEffect(()=>{const he=setTimeout(()=>{z(!0)},300);return()=>{clearTimeout(he)}},[]);const L=p(a);let M=F.createElement("div",{className:`${e}-icon`},L);if(o==="picture"||o==="picture-card"||o==="picture-circle")if($==="uploading"||!a.thumbUrl&&!a.url){const he=Ce(`${e}-list-item-thumbnail`,{[`${e}-list-item-file`]:$!=="uploading"});M=F.createElement("div",{className:he},L)}else{const he=v!=null&&v(a)?F.createElement("img",{src:a.thumbUrl||a.url,alt:a.name,className:`${e}-list-item-image`,crossOrigin:a.crossOrigin}):L,Qe=Ce(`${e}-list-item-thumbnail`,{[`${e}-list-item-file`]:v&&!v(a)});M=F.createElement("a",{className:Qe,onClick:Pe=>E(a,Pe),href:a.url||a.thumbUrl,target:"_blank",rel:"noopener noreferrer"},he)}const Q=Ce(`${e}-list-item`,`${e}-list-item-${$}`),U=typeof a.linkProps=="string"?JSON.parse(a.linkProps):a.linkProps,V=(typeof w=="function"?w(a):w)?m((typeof f=="function"?f(a):f)||F.createElement(Ko,null),()=>b(a),e,n.removeFile,!0):null,X=(typeof C=="function"?C(a):C)&&$==="done"?m((typeof g=="function"?g(a):g)||F.createElement(Da,null),()=>D(a),e,n.downloadFile):null,q=o!=="picture-card"&&o!=="picture-circle"&&F.createElement("span",{key:"download-delete",className:Ce(`${e}-list-item-actions`,{picture:o==="picture"})},X,V),ee=typeof h=="function"?h(a):h,Y=ee&&F.createElement("span",{className:`${e}-list-item-extra`},ee),j=Ce(`${e}-list-item-name`),K=a.url?F.createElement("a",Object.assign({key:"view",target:"_blank",rel:"noopener noreferrer",className:j,title:a.name},U,{href:a.url,onClick:he=>E(a,he)}),a.name,Y):F.createElement("span",{key:"view",className:j,onClick:he=>E(a,he),title:a.name},a.name,Y),le=(typeof x=="function"?x(a):x)&&(a.url||a.thumbUrl)?F.createElement("a",{href:a.url||a.thumbUrl,target:"_blank",rel:"noopener noreferrer",onClick:he=>E(a,he),title:n.previewFile},typeof i=="function"?i(a):i||F.createElement(Ln,null)):null,we=(o==="picture-card"||o==="picture-circle")&&$!=="uploading"&&F.createElement("span",{className:`${e}-list-item-actions`},le,$==="done"&&X,V),{getPrefixCls:Ie}=F.useContext(mt),Ne=Ie(),xe=F.createElement("div",{className:Q},M,K,q,we,H&&F.createElement(Zr,{motionName:`${Ne}-fade`,visible:$==="uploading",motionDeadline:2e3},({className:he})=>{const Qe="percent"in a?F.createElement(Vo,Object.assign({type:"line",percent:a.percent,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"]},c)):null;return F.createElement("div",{className:Ce(`${e}-list-item-progress`,he)},Qe)})),Be=a.response&&typeof a.response=="string"?a.response:((k=a.error)===null||k===void 0?void 0:k.statusText)||((T=a.error)===null||T===void 0?void 0:T.message)||n.uploadError,_e=$==="error"?F.createElement(Wr,{title:Be,getPopupContainer:he=>he.parentNode},xe):xe;return F.createElement("div",{className:Ce(`${e}-list-item-container`,t),style:r,ref:A},y?y(_e,a,s,{download:D.bind(null,a),preview:E.bind(null,a),remove:b.bind(null,a)}):_e)}),$a=(e,t)=>{const{listType:r="text",previewFile:n=wa,onPreview:o,onDownload:a,onRemove:s,locale:c,iconRender:p,isImageUrl:m=Ca,prefixCls:y,items:v=[],showPreviewIcon:x=!0,showRemoveIcon:w=!0,showDownloadIcon:C=!1,removeIcon:i,previewIcon:f,downloadIcon:g,extra:h,progress:E={size:[-1,2],showInfo:!1},appendAction:D,appendActionVisible:b=!0,itemRender:A,disabled:k}=e,[,T]=qn(),[N,$]=F.useState(!1),_=["picture-card","picture-circle"].includes(r);F.useEffect(()=>{r.startsWith("picture")&&(v||[]).forEach(j=>{!(j.originFileObj instanceof File||j.originFileObj instanceof Blob)||j.thumbUrl!==void 0||(j.thumbUrl="",n==null||n(j.originFileObj).then(K=>{j.thumbUrl=K||"",T()}))})},[r,v,n]),F.useEffect(()=>{$(!0)},[]);const H=(j,K)=>{if(o)return K==null||K.preventDefault(),o(j)},z=j=>{typeof a=="function"?a(j):j.url&&window.open(j.url)},L=j=>{s==null||s(j)},M=j=>{if(p)return p(j,r);const K=j.status==="uploading";if(r.startsWith("picture")){const le=r==="picture"?F.createElement(dr,null):c.uploading,we=m!=null&&m(j)?F.createElement(ba,null):F.createElement(fa,null);return K?le:we}return K?F.createElement(dr,null):F.createElement(ha,null)},Q=(j,K,le,we,Ie)=>{const Ne={type:"text",size:"small",title:we,onClick:xe=>{var Be,_e;K(),F.isValidElement(j)&&((_e=(Be=j.props).onClick)===null||_e===void 0||_e.call(Be,xe))},className:`${le}-list-item-action`,disabled:Ie?k:!1};return F.isValidElement(j)?F.createElement(Xe,Object.assign({},Ne,{icon:ur(j,Object.assign(Object.assign({},j.props),{onClick:()=>{}}))})):F.createElement(Xe,Object.assign({},Ne),F.createElement("span",null,j))};F.useImperativeHandle(t,()=>({handlePreview:H,handleDownload:z}));const{getPrefixCls:U}=F.useContext(mt),V=U("upload",y),X=U(),q=Ce(`${V}-list`,`${V}-list-${r}`),ee=F.useMemo(()=>nr(Un(X),["onAppearEnd","onEnterEnd","onLeaveEnd"]),[X]),Y=Object.assign(Object.assign({},_?{}:ee),{motionDeadline:2e3,motionName:`${V}-${_?"animate-inline":"animate"}`,keys:Ve(v.map(j=>({key:j.uid,file:j}))),motionAppear:N});return F.createElement("div",{className:q},F.createElement(Wn,Object.assign({},Y,{component:!1}),({key:j,file:K,className:le,style:we})=>F.createElement(Ia,{key:j,locale:c,prefixCls:V,className:le,style:we,file:K,items:v,progress:E,listType:r,isImgUrl:m,showPreviewIcon:x,showRemoveIcon:w,showDownloadIcon:C,removeIcon:i,previewIcon:f,downloadIcon:g,extra:h,iconRender:M,actionIconRender:Q,itemRender:A,onPreview:H,onDownload:z,onClose:L})),D&&F.createElement(Zr,Object.assign({},Y,{visible:b,forceRender:!0}),({className:j,style:K})=>ur(D,le=>({className:Ce(le.className,j),style:Object.assign(Object.assign(Object.assign({},K),{pointerEvents:j?"none":void 0}),le.style)}))))},Aa=F.forwardRef($a);var Na=function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function c(y){try{m(n.next(y))}catch(v){s(v)}}function p(y){try{m(n.throw(y))}catch(v){s(v)}}function m(y){y.done?a(y.value):o(y.value).then(c,p)}m((n=n.apply(e,[])).next())})};const Ct=`__LIST_IGNORE_${Date.now()}__`,ka=(e,t)=>{const r=Lr("upload"),{fileList:n,defaultFileList:o,onRemove:a,showUploadList:s=!0,listType:c="text",onPreview:p,onDownload:m,onChange:y,onDrop:v,previewFile:x,disabled:w,locale:C,iconRender:i,isImageUrl:f,progress:g,prefixCls:h,className:E,type:D="select",children:b,style:A,itemRender:k,maxCount:T,data:N={},multiple:$=!1,hasControlInside:_=!0,action:H="",accept:z="",supportServerRender:L=!0,rootClassName:M}=e,Q=F.useContext(Hn),U=w??Q,V=e.customRequest||r.customRequest,[X,q]=qr(o||[],{value:n,postState:J=>J??[]}),[ee,Y]=F.useState("drop"),j=F.useRef(null),K=F.useRef(null);F.useMemo(()=>{const J=Date.now();(n||[]).forEach((ne,de)=>{!ne.uid&&!Object.isFrozen(ne)&&(ne.uid=`__AUTO__${J}_${de}__`)})},[n]);const le=(J,ne,de)=>{let te=Ve(ne),ae=!1;T===1?te=te.slice(-1):T&&(ae=te.length>T,te=te.slice(0,T)),hr(()=>{q(te)});const De={file:J,fileList:te};de&&(De.event=de),(!ae||J.status==="removed"||te.some(Ke=>Ke.uid===J.uid))&&hr(()=>{y==null||y(De)})},we=(J,ne)=>Na(void 0,void 0,void 0,function*(){const{beforeUpload:de,transformFile:te}=e;let ae=J;if(de){const De=yield de(J,ne);if(De===!1)return!1;if(delete J[Ct],De===Ct)return Object.defineProperty(J,Ct,{value:!0,configurable:!0}),!1;typeof De=="object"&&De&&(ae=De)}return te&&(ae=yield te(ae)),ae}),Ie=J=>{const ne=J.filter(ae=>!ae.file[Ct]);if(!ne.length)return;const de=ne.map(ae=>$t(ae.file));let te=Ve(X);de.forEach(ae=>{te=At(ae,te)}),de.forEach((ae,De)=>{let Ke=ae;if(ne[De].parsedFile)ae.status="uploading";else{const{originFileObj:Ue}=ae;let We;try{We=new File([Ue],Ue.name,{type:Ue.type})}catch{We=new Blob([Ue],{type:Ue.type}),We.name=Ue.name,We.lastModifiedDate=new Date,We.lastModified=new Date().getTime()}We.uid=ae.uid,Ke=We}le(Ke,te)})},Ne=(J,ne,de)=>{try{typeof J=="string"&&(J=JSON.parse(J))}catch{}if(!Ht(ne,X))return;const te=$t(ne);te.status="done",te.percent=100,te.response=J,te.xhr=de;const ae=At(te,X);le(te,ae)},xe=(J,ne)=>{if(!Ht(ne,X))return;const de=$t(ne);de.status="uploading",de.percent=J.percent;const te=At(de,X);le(de,te,J)},Be=(J,ne,de)=>{if(!Ht(de,X))return;const te=$t(de);te.error=J,te.response=ne,te.status="error";const ae=At(te,X);le(te,ae)},_e=J=>{let ne;Promise.resolve(typeof a=="function"?a(J):a).then(de=>{var te;if(de===!1)return;const ae=xa(J,X);ae&&(ne=Object.assign(Object.assign({},J),{status:"removed"}),X==null||X.forEach(De=>{const Ke=ne.uid!==void 0?"uid":"name";De[Ke]===ne[Ke]&&!Object.isFrozen(De)&&(De.status="removed")}),(te=j.current)===null||te===void 0||te.abort(ne),le(ne,ae))})},he=J=>{Y(J.type),J.type==="drop"&&(v==null||v(J))};F.useImperativeHandle(t,()=>({onBatchStart:Ie,onSuccess:Ne,onProgress:xe,onError:Be,fileList:X,upload:j.current,nativeElement:K.current}));const{getPrefixCls:Qe,direction:Pe,upload:Ze}=F.useContext(mt),ye=Qe("upload",h),qe=Object.assign(Object.assign({onBatchStart:Ie,onError:Be,onProgress:xe,onSuccess:Ne},e),{customRequest:V,data:N,multiple:$,action:H,accept:z,supportServerRender:L,prefixCls:ye,disabled:U,beforeUpload:we,onChange:void 0,hasControlInside:_});delete qe.className,delete qe.style,(!b||U)&&delete qe.id;const ot=`${ye}-wrapper`,[lt,gt,Bt]=ua(ye,ot),[ht]=Rr("Upload",zr.Upload),{showRemoveIcon:Et,showPreviewIcon:_t,showDownloadIcon:Me,removeIcon:yt,previewIcon:Tt,downloadIcon:Pt,extra:vt}=typeof s=="boolean"?{}:s,Te=typeof Et>"u"?!U:Et,Z=(J,ne)=>s?F.createElement(Aa,{prefixCls:ye,listType:c,items:X,previewFile:x,onPreview:p,onDownload:m,onRemove:_e,showRemoveIcon:Te,showPreviewIcon:_t,showDownloadIcon:Me,removeIcon:yt,previewIcon:Tt,downloadIcon:Pt,iconRender:i,extra:vt,locale:Object.assign(Object.assign({},ht),C),isImageUrl:f,progress:g,appendAction:J,appendActionVisible:ne,itemRender:k,disabled:U}):J,ct=Ce(ot,E,M,gt,Bt,Ze==null?void 0:Ze.className,{[`${ye}-rtl`]:Pe==="rtl",[`${ye}-picture-card-wrapper`]:c==="picture-card",[`${ye}-picture-circle-wrapper`]:c==="picture-circle"}),bt=Object.assign(Object.assign({},Ze==null?void 0:Ze.style),A);if(D==="drag"){const J=Ce(gt,ye,`${ye}-drag`,{[`${ye}-drag-uploading`]:X.some(ne=>ne.status==="uploading"),[`${ye}-drag-hover`]:ee==="dragover",[`${ye}-disabled`]:U,[`${ye}-rtl`]:Pe==="rtl"});return lt(F.createElement("span",{className:ct,ref:K},F.createElement("div",{className:J,style:bt,onDrop:he,onDragOver:he,onDragLeave:he},F.createElement(Zt,Object.assign({},qe,{ref:j,className:`${ye}-btn`}),F.createElement("div",{className:`${ye}-drag-container`},b))),Z()))}const Mt=Ce(ye,`${ye}-select`,{[`${ye}-disabled`]:U,[`${ye}-hidden`]:!b}),ut=F.createElement("div",{className:Mt,style:bt},F.createElement(Zt,Object.assign({},qe,{ref:j})));return lt(c==="picture-card"||c==="picture-circle"?F.createElement("span",{className:ct,ref:K},Z(ut,!!b)):F.createElement("span",{className:ct,ref:K},ut,Z()))},dn=F.forwardRef(ka);var Oa=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const Ba=F.forwardRef((e,t)=>{const{style:r,height:n,hasControlInside:o=!1,children:a}=e,s=Oa(e,["style","height","hasControlInside","children"]),c=Object.assign(Object.assign({},r),{height:n});return F.createElement(dn,Object.assign({ref:t,hasControlInside:o},s,{style:c,type:"drag"}),a)}),ir=dn;ir.Dragger=Ba;ir.LIST_IGNORE=Ct;const Er={actions:[{icon:d(ze,{type:"rag/folder",size:18}),name:"history",badgeCount:0}],switchs:[{label:"\u8054\u7F51\u641C\u7D22",name:"netSearch",type:"checkbox",defaultValue:!1,enabled:!0,icon:d(ze,{type:"rag/url",size:12})},{label:"\u63A8\u7406\u601D\u8003",name:"reasoning",type:"checkbox",defaultValue:!1,enabled:!0,icon:d(ze,{type:"rag/think",size:12})}]};function _a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Vn(e,t)}var Sr=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Ta(e,t){return!!(e===t||Sr(e)&&Sr(t))}function Pa(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Ta(e[r],t[r]))return!1;return!0}function Vt(e,t){t===void 0&&(t=Pa);var r,n=[],o,a=!1;function s(){for(var c=[],p=0;p<arguments.length;p++)c[p]=arguments[p];return a&&r===this&&t(c,n)||(o=e.apply(this,c),a=!0,r=this,n=c),o}return s}var Ma=typeof performance=="object"&&typeof performance.now=="function",Dr=Ma?function(){return performance.now()}:function(){return Date.now()};function Ir(e){cancelAnimationFrame(e.id)}function ja(e,t){var r=Dr();function n(){Dr()-r>=t?e.call(null):o.id=requestAnimationFrame(n)}var o={id:requestAnimationFrame(n)};return o}var Xt=-1;function $r(e){if(e===void 0&&(e=!1),Xt===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Xt=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Xt}var dt=null;function Ar(e){if(e===void 0&&(e=!1),dt===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),o=n.style;return o.width="100px",o.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?dt="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?dt="negative":dt="positive-ascending"),document.body.removeChild(t),dt}return dt}var Ra=150,za=function(t,r){return t};function La(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,o=e.getItemSize,a=e.getOffsetForIndexAndAlignment,s=e.getStartIndexForOffset,c=e.getStopIndexForStartIndex,p=e.initInstanceProps,m=e.shouldResetStyleCacheOnItemSizeChange,y=e.validateProps;return t=(function(v){_a(x,v);function x(C){var i;return i=v.call(this,C)||this,i._instanceProps=p(i.props,$e(i)),i._outerRef=void 0,i._resetIsScrollingTimeoutId=null,i.state={instance:$e(i),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof i.props.initialScrollOffset=="number"?i.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},i._callOnItemsRendered=void 0,i._callOnItemsRendered=Vt(function(f,g,h,E){return i.props.onItemsRendered({overscanStartIndex:f,overscanStopIndex:g,visibleStartIndex:h,visibleStopIndex:E})}),i._callOnScroll=void 0,i._callOnScroll=Vt(function(f,g,h){return i.props.onScroll({scrollDirection:f,scrollOffset:g,scrollUpdateWasRequested:h})}),i._getItemStyle=void 0,i._getItemStyle=function(f){var g=i.props,h=g.direction,E=g.itemSize,D=g.layout,b=i._getItemStyleCache(m&&E,m&&D,m&&h),A;if(b.hasOwnProperty(f))A=b[f];else{var k=r(i.props,f,i._instanceProps),T=o(i.props,f,i._instanceProps),N=h==="horizontal"||D==="horizontal",$=h==="rtl",_=N?k:0;b[f]=A={position:"absolute",left:$?void 0:_,right:$?_:void 0,top:N?0:k,height:N?"100%":T,width:N?T:"100%"}}return A},i._getItemStyleCache=void 0,i._getItemStyleCache=Vt(function(f,g,h){return{}}),i._onScrollHorizontal=function(f){var g=f.currentTarget,h=g.clientWidth,E=g.scrollLeft,D=g.scrollWidth;i.setState(function(b){if(b.scrollOffset===E)return null;var A=i.props.direction,k=E;if(A==="rtl")switch(Ar()){case"negative":k=-E;break;case"positive-descending":k=D-h-E;break}return k=Math.max(0,Math.min(k,D-h)),{isScrolling:!0,scrollDirection:b.scrollOffset<k?"forward":"backward",scrollOffset:k,scrollUpdateWasRequested:!1}},i._resetIsScrollingDebounced)},i._onScrollVertical=function(f){var g=f.currentTarget,h=g.clientHeight,E=g.scrollHeight,D=g.scrollTop;i.setState(function(b){if(b.scrollOffset===D)return null;var A=Math.max(0,Math.min(D,E-h));return{isScrolling:!0,scrollDirection:b.scrollOffset<A?"forward":"backward",scrollOffset:A,scrollUpdateWasRequested:!1}},i._resetIsScrollingDebounced)},i._outerRefSetter=function(f){var g=i.props.outerRef;i._outerRef=f,typeof g=="function"?g(f):g!=null&&typeof g=="object"&&g.hasOwnProperty("current")&&(g.current=f)},i._resetIsScrollingDebounced=function(){i._resetIsScrollingTimeoutId!==null&&Ir(i._resetIsScrollingTimeoutId),i._resetIsScrollingTimeoutId=ja(i._resetIsScrolling,Ra)},i._resetIsScrolling=function(){i._resetIsScrollingTimeoutId=null,i.setState({isScrolling:!1},function(){i._getItemStyleCache(-1,null)})},i}x.getDerivedStateFromProps=function(i,f){return qa(i,f),y(i),null};var w=x.prototype;return w.scrollTo=function(i){i=Math.max(0,i),this.setState(function(f){return f.scrollOffset===i?null:{scrollDirection:f.scrollOffset<i?"forward":"backward",scrollOffset:i,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},w.scrollToItem=function(i,f){f===void 0&&(f="auto");var g=this.props,h=g.itemCount,E=g.layout,D=this.state.scrollOffset;i=Math.max(0,Math.min(i,h-1));var b=0;if(this._outerRef){var A=this._outerRef;E==="vertical"?b=A.scrollWidth>A.clientWidth?$r():0:b=A.scrollHeight>A.clientHeight?$r():0}this.scrollTo(a(this.props,i,f,D,this._instanceProps,b))},w.componentDidMount=function(){var i=this.props,f=i.direction,g=i.initialScrollOffset,h=i.layout;if(typeof g=="number"&&this._outerRef!=null){var E=this._outerRef;f==="horizontal"||h==="horizontal"?E.scrollLeft=g:E.scrollTop=g}this._callPropsCallbacks()},w.componentDidUpdate=function(){var i=this.props,f=i.direction,g=i.layout,h=this.state,E=h.scrollOffset,D=h.scrollUpdateWasRequested;if(D&&this._outerRef!=null){var b=this._outerRef;if(f==="horizontal"||g==="horizontal")if(f==="rtl")switch(Ar()){case"negative":b.scrollLeft=-E;break;case"positive-ascending":b.scrollLeft=E;break;default:var A=b.clientWidth,k=b.scrollWidth;b.scrollLeft=k-A-E;break}else b.scrollLeft=E;else b.scrollTop=E}this._callPropsCallbacks()},w.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Ir(this._resetIsScrollingTimeoutId)},w.render=function(){var i=this.props,f=i.children,g=i.className,h=i.direction,E=i.height,D=i.innerRef,b=i.innerElementType,A=i.innerTagName,k=i.itemCount,T=i.itemData,N=i.itemKey,$=N===void 0?za:N,_=i.layout,H=i.outerElementType,z=i.outerTagName,L=i.style,M=i.useIsScrolling,Q=i.width,U=this.state.isScrolling,V=h==="horizontal"||_==="horizontal",X=V?this._onScrollHorizontal:this._onScrollVertical,q=this._getRangeToRender(),ee=q[0],Y=q[1],j=[];if(k>0)for(var K=ee;K<=Y;K++)j.push(Rt(f,{data:T,key:$(K,T),index:K,isScrolling:M?U:void 0,style:this._getItemStyle(K)}));var le=n(this.props,this._instanceProps);return Rt(H||z||"div",{className:g,onScroll:X,ref:this._outerRefSetter,style:Je({position:"relative",height:E,width:Q,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:h},L)},Rt(b||A||"div",{children:j,ref:D,style:{height:V?"100%":le,pointerEvents:U?"none":void 0,width:V?le:"100%"}}))},w._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var i=this.props.itemCount;if(i>0){var f=this._getRangeToRender(),g=f[0],h=f[1],E=f[2],D=f[3];this._callOnItemsRendered(g,h,E,D)}}if(typeof this.props.onScroll=="function"){var b=this.state,A=b.scrollDirection,k=b.scrollOffset,T=b.scrollUpdateWasRequested;this._callOnScroll(A,k,T)}},w._getRangeToRender=function(){var i=this.props,f=i.itemCount,g=i.overscanCount,h=this.state,E=h.isScrolling,D=h.scrollDirection,b=h.scrollOffset;if(f===0)return[0,0,0,0];var A=s(this.props,b,this._instanceProps),k=c(this.props,A,b,this._instanceProps),T=!E||D==="backward"?Math.max(1,g):1,N=!E||D==="forward"?Math.max(1,g):1;return[Math.max(0,A-T),Math.max(0,Math.min(f-1,k+N)),A,k]},x})(An),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var qa=function(t,r){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,r.instance},Ua=50,ft=function(t,r,n){var o=t,a=o.itemSize,s=n.itemMetadataMap,c=n.lastMeasuredIndex;if(r>c){var p=0;if(c>=0){var m=s[c];p=m.offset+m.size}for(var y=c+1;y<=r;y++){var v=a(y);s[y]={offset:p,size:v},p+=v}n.lastMeasuredIndex=r}return s[r]},Wa=function(t,r,n){var o=r.itemMetadataMap,a=r.lastMeasuredIndex,s=a>0?o[a].offset:0;return s>=n?pn(t,r,a,0,n):Ha(t,r,Math.max(0,a),n)},pn=function(t,r,n,o,a){for(;o<=n;){var s=o+Math.floor((n-o)/2),c=ft(t,s,r).offset;if(c===a)return s;c<a?o=s+1:c>a&&(n=s-1)}return o>0?o-1:0},Ha=function(t,r,n,o){for(var a=t.itemCount,s=1;n<a&&ft(t,n,r).offset<o;)n+=s,s*=2;return pn(t,r,Math.min(n,a-1),Math.floor(n/2),o)},Nr=function(t,r){var n=t.itemCount,o=r.itemMetadataMap,a=r.estimatedItemSize,s=r.lastMeasuredIndex,c=0;if(s>=n&&(s=n-1),s>=0){var p=o[s];c=p.offset+p.size}var m=n-s-1,y=m*a;return c+y},Va=La({getItemOffset:function(t,r,n){return ft(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Nr,getOffsetForIndexAndAlignment:function(t,r,n,o,a,s){var c=t.direction,p=t.height,m=t.layout,y=t.width,v=c==="horizontal"||m==="horizontal",x=v?y:p,w=ft(t,r,a),C=Nr(t,a),i=Math.max(0,Math.min(C-x,w.offset)),f=Math.max(0,w.offset-x+w.size+s);switch(n==="smart"&&(o>=f-x&&o<=i+x?n="auto":n="center"),n){case"start":return i;case"end":return f;case"center":return Math.round(f+(i-f)/2);case"auto":default:return o>=f&&o<=i?o:o<f?f:i}},getStartIndexForOffset:function(t,r,n){return Wa(t,n,r)},getStopIndexForStartIndex:function(t,r,n,o){for(var a=t.direction,s=t.height,c=t.itemCount,p=t.layout,m=t.width,y=a==="horizontal"||p==="horizontal",v=y?m:s,x=ft(t,r,o),w=n+v,C=x.offset+x.size,i=r;i<c-1&&C<w;)i++,C+=ft(t,i,o).size;return i},initInstanceProps:function(t,r){var n=t,o=n.estimatedItemSize,a={itemMetadataMap:{},estimatedItemSize:o||Ua,lastMeasuredIndex:-1};return r.resetAfterIndex=function(s,c){c===void 0&&(c=!0),a.lastMeasuredIndex=Math.min(a.lastMeasuredIndex,s-1),r._getItemStyleCache(-1),c&&r.forceUpdate()},a},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){t.itemSize}});function Xa({isActive:e,isNew:t,isDisabled:r,data:n,eventsEmit:o,styles:a={},assistantList:s=[]}){const[c,p]=ue(!1),m=(a==null?void 0:a.colors)||{},y=Ae(()=>{const f=n==null?void 0:n.configId;if(!f||!s||s.length===0)return"\u672A\u9009\u62E9\u52A9\u624B";const g=s.find(h=>String(h==null?void 0:h.id)===String(f));if(!g)return"\u672A\u9009\u62E9\u52A9\u624B";if(g!=null&&g.name)return g.name;try{const h=typeof g.configJson=="string"?JSON.parse(g.configJson):g.configJson;return(h==null?void 0:h.config_name)||"\u672A\u9009\u62E9\u52A9\u624B"}catch{return"\u672A\u9009\u62E9\u52A9\u624B"}},[s,n==null?void 0:n.configId]),v=[{key:"rename",icon:d(uo,{size:12}),label:"\u91CD\u547D\u540D",onClick:f=>{f.domEvent.stopPropagation(),o&&o("conversations:rename_icon_clicked",n)}},{key:"delete",icon:d(fo,{size:12}),label:"\u5220\u9664",danger:!0,onClick:f=>{f.domEvent.stopPropagation(),o&&o("conversations:delete_icon_clicked",n)}}],x=e?m.activeItemBg||"#f0f4ff":c?m.itemHoverBg||"#f5f7fa":m.itemBg||"transparent",w=e?m.activeItemText||m.primary||"#0122ff":m.itemText||"#333",C=e?m.activeItemBorder||m.primary||"#0122ff":"transparent",i=f=>{const g=pr(),h=pr(f);return g.isSame(h,"day")?h.format("HH:mm"):h.format("MM-DD HH:mm")};return R("div",{className:"flex relative items-center justify-between mb-2 px-4 py-3 rounded-md transition-colors cursor-pointer select-none",onClick:()=>!r&&o&&o("conversation:item_click",n),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{minHeight:48,background:x,color:w,border:`1px solid ${C}`,...a.item,opacity:r?.5:1},children:[R("div",{className:"flex flex-col gap-y-2 flex-1 min-w-0",children:[d("span",{className:"truncate text-sm max-w-[160px] font-medium",title:n.label||"\u672A\u547D\u540D\u4F1A\u8BDD",style:{color:w,fontSize:"14px",lineHeight:"1.4"},children:n.label||"\u672A\u547D\u540D\u4F1A\u8BDD"}),R("div",{className:"flex items-center justify-between gap-2",children:[d("span",{className:"text-xs truncate flex-1",style:{color:e?m.activeItemTextSecondary||"#666":m.itemTextSecondary||"#666",fontSize:"12px",lineHeight:"1.3"},children:y}),n.gmtModified&&d("span",{className:"text-xs flex-shrink-0",style:{color:e?m.activeItemTextSecondary||"#999":m.itemTextSecondary||"#999",fontSize:"12px",lineHeight:"1.3"},children:i(n.gmtModified)})]})]}),!r&&c&&!t&&d("div",{className:"absolute top-2 right-3",children:d(ro,{menu:{items:v},trigger:["click"],placement:"bottomRight",children:d(so,{size:16,className:"text-gray-600 hover:text-gray-800",style:{cursor:"pointer",color:e?m.activeItemTextSecondary||"#999":m.itemTextSecondary||"#999"},onClick:f=>f.stopPropagation()})})})]})}function Ja(e,t=[{label:"\u5F53\u5929",dayPeriod:1}]){const r=new Date,n={other:[]};return e.forEach(o=>{const a=new Date(o.gmtModified),s=Math.floor((+r-+a)/(1e3*60*60*24));let c=!1;for(const p of t)if(s<=p.dayPeriod){n[p.label]||(n[p.label]=[]),n[p.label].push(o),c=!0;break}c||n.other.push(o)}),n}function Ka(e){const{data:t,activedItem:r,onChange:n,onDelete:o,sortRules:a=[{label:"\u5F53\u5929",dayPeriod:1}],eventsEmit:s,assistantList:c,height:p=400,styles:m={},hasMore:y=!1,loadingMore:v=!1}=e,x=t.map(N=>N.sessionId+"-"+N.gmtModified).join(","),w=Ae(()=>{const N=a.length>0?a:[{label:"\u5F53\u5929",dayPeriod:1}],$=Ja(t,N),_=N.every(z=>!$[z.label]||$[z.label].length===0),H=[];return N.forEach(z=>{$[z.label]&&$[z.label].length>0&&(H.push({type:"group",label:z.label}),$[z.label].forEach(L=>H.push({type:"item",data:L})))}),$.other.length>0&&!_&&(H.push({type:"group",label:"\u5176\u4ED6"}),$.other.forEach(z=>H.push({type:"item",data:z}))),_&&$.other.length>0&&$.other.forEach(z=>H.push({type:"item",data:z})),H},[t,a,x]),C=Ae(()=>w.map(N=>N.type==="group"?`g:${N.label}`:`i:${N.data.sessionId}`).join("|"),[w]),i=56,f=14,g=36,h=N=>N===w.length?g:w[N].type==="group"?32:i+f,E=Le(null),D=Ae(()=>w.findIndex(N=>{var $;return N.type==="item"&&(($=N.data)==null?void 0:$.sessionId)===r}),[w,r]),b=Ae(()=>w.findIndex(N=>N.type==="item"),[w]),A=Le(void 0);Se(()=>{const N=A.current;r!==N&&D>-1&&D===b&&E.current&&E.current.scrollToItem(D,"start"),A.current=r},[r,D,b]);const k=Le(0);if(Se(()=>{if(E.current){const N=k.current,$=w.length;k.current=$,$!==N&&E.current.resetAfterIndex(Math.max(0,Math.min(N,$)-1),!1)}},[w.length]),Se(()=>{E.current&&E.current.resetAfterIndex(0,!1)},[C]),w.length===0)return d("div",{className:"text-center text-zinc-400 py-8",children:"\u6682\u65E0\u4F1A\u8BDD"});const T=(m==null?void 0:m.colors)||{};return d(Gn,{flipKey:x,spring:{stiffness:180,damping:18},children:d(Va,{ref:E,height:p,width:"100%",itemCount:w.length+1,itemSize:h,itemKey:N=>{if(N===w.length)return"footer";const $=w[N];return $.type==="item"?$.data.sessionId:`group-${$.label}`},onItemsRendered:({visibleStopIndex:N})=>{y&&!v&&N>=w.length-1-3&&typeof s=="function"&&s("conversations:load_more")},style:{overflowX:"hidden"},children:({index:N,style:$})=>{if(N===w.length){const H=(m==null?void 0:m.colors)||{};return d("div",{style:{...$,height:g,lineHeight:`${g}px`,textAlign:"center",fontSize:"10px",color:H.textMuted||"#9ca3af",background:H.groupBg||"white"},children:v?"\u52A0\u8F7D\u4E2D...":y?"":"\u6CA1\u6709\u66F4\u591A\u4E86"})}const _=w[N];return _.type==="group"?d("div",{style:{...$,background:T.groupBg||"white",zIndex:1},className:"pt-2 pb-1 px-[28px] py-[2px] text-xs text-gray-400",children:_.label}):d(Yn,{flipId:_.data.sessionId,children:d("div",{style:$,className:"px-[12px] py-[2px]",children:d(Xa,{isActive:r===_.data.sessionId,isDisabled:!1,isNew:_.data.isNew,data:_.data,eventsEmit:s,assistantList:c,styles:m})})},_.data.sessionId)}})})}const Ga=({value:e,eventsEmit:t,setSearch:r,style:n,styles:o={}})=>{const a=o.colors||{},s=o.radius||"12px",c=a.border||"#e5e7eb",p=a.primary||"#2563eb",m=o.headerBg||a.sidebarBg||a.background||"#fff",[y,v]=Ge.useState(!1);return R("div",{className:"flex items-center gap-2 px-4 py-3 sticky top-0 z-10 min-w-0",style:{...n,background:m,borderTopLeftRadius:s,borderTopRightRadius:s},children:[d("button",{className:"border-none flex items-center justify-center",onClick:()=>{v(!1),t&&t("conversation:create")},title:"\u65B0\u5EFA\u4F1A\u8BDD",style:{height:42,borderRadius:"90px",background:p,color:a.buttonText||"#fff",fontWeight:600,boxShadow:o.shadow||"0 2px 8px 0 rgba(0,0,0,0.04)",padding:y?"0 0":"0 14px",minWidth:y?0:180,width:y?0:void 0,opacity:y?0:1,overflow:"hidden",flexShrink:0,transition:"width .22s ease, min-width .22s ease, padding .22s ease, opacity .18s ease"},children:R("div",{className:"flex items-center gap-2",children:[d(rn,{size:18}),d("span",{className:"text-sm",children:"\u65B0\u5EFA\u5BF9\u8BDD"})]})}),y?R("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[d("input",{className:"flex-1 px-3 py-2 text-sm transition-all",placeholder:"\u641C\u7D22\u4F1A\u8BDD...",value:e,onChange:x=>r(x.target.value),onBlur:()=>v(!1),onKeyDown:x=>{x.key==="Enter"&&v(!1)},style:{minWidth:0,width:"100%",maxWidth:"100%",borderRadius:s,background:a.inputBg||"#f4f4f5",border:`1px solid ${c}`,color:a.text||"#222",outline:"none"}}),d("button",{className:"flex items-center justify-center transition-colors",style:{width:36,height:36,borderRadius:"90px",border:`1px solid ${c}`,color:a.text||"#222",flexShrink:0},onClick:()=>v(!1),title:"\u6536\u8D77\u641C\u7D22",children:d(ar,{size:16})})]}):d("button",{className:"ml-auto flex items-center justify-center transition-colors",style:{width:36,height:36,borderRadius:"90px",border:`1px solid ${c}`,color:p,flexShrink:0},onClick:()=>v(!0),title:"\u641C\u7D22",children:d(po,{size:18})})]})};function Ya(e){const{data:t,sortRules:r,activedItem:n,eventsEmit:o,assistantList:a,styles:s={},hasMore:c=!1,loadingMore:p=!1}=e,[m,y]=ue(""),v=Ae(()=>m?t.filter(b=>(b.label||"\u672A\u547D\u540D\u4F1A\u8BDD").toLowerCase().includes(m.toLowerCase())):t,[t,m]),x=Ae(()=>[...v].sort((b,A)=>new Date(A.gmtModified).getTime()-new Date(b.gmtModified).getTime()),[v]),w=Le(null),[C,i]=ue(400);Se(()=>{function b(){w.current&&i(w.current.clientHeight)}return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[]);const f=(s==null?void 0:s.colors)||{};s!=null&&s.radius;const g=(s==null?void 0:s.shadow)||"0 4px 24px 0 rgba(0,0,0,0.06)",h=f.border||"#e5e7eb",E=f.sidebarBg||f.background||"#EAEEFF",D=f.text||"#222";return R("div",{className:"h-full flex flex-col overflow-y-hidden",style:{background:E,color:D,boxShadow:g,border:`1px solid ${h}`,...s.container},children:[d(Ga,{value:m,setSearch:y,eventsEmit:o,style:s.header,styles:s}),R("div",{className:"flex-1 min-h-0 relative",ref:w,style:s.list,children:[d(Ka,{eventsEmit:o,data:x,assistantList:a,activedItem:n,sortRules:r,height:C,styles:s,hasMore:c,loadingMore:p}),d("div",{className:"pointer-events-none absolute left-0 right-0 top-0 h-3 z-20",style:{background:`linear-gradient(to bottom, ${E}cc, transparent)`}})]})]})}const Qa=(e,t)=>{let r=e&&e.replace(/<think>[\s\S]*?<\/think>/g,"");r=r.replace(/\[retrive-tag[^\]]*\][\s\S]*?\[\/retrive-tag\]/g,""),r=r.replace(/<a\s+[^>]*>(.*?)<\/a>/g,""),console.log("_content",r);const n=new Qn(t.currentTarget||t.target,{text:()=>r});try{n.on("success",()=>{be.success("\u6587\u672C\u590D\u5236\u6210\u529F",2),n.destroy()}),n.on("error",o=>{be.error("\u590D\u5236\u5931\u8D25",2),n.destroy()}),n.onClick(t)}catch(o){n.destroy(),be.error("\u590D\u5236\u5931\u8D25: "+o,2)}},kr=e=>{const t=e.toLowerCase().split(".").pop()||"";return/^(jpg|jpeg|png|gif|bmp|webp)$/.test(t)?"image":/^(doc|docx)$/.test(t)?"word":/^(xls|xlsx|csv)$/.test(t)?"excel":/^(ppt|pptx)$/.test(t)?"ppt":t==="pdf"?"pdf":/^(txt|json|md|markdown)$/.test(t)?"text":/^(zip|rar|7z)$/.test(t)?"archive":"file"};function Za(e){const t=[];for(const r of e){if(r.query){const n=r.query.queryId||r.query.id||r.queryId||r.id||it(32);t.push({istype:"user",content:r.query.content,time:r.query.gmtCreate,queryId:n,clientSideId:n+"-user",...r.query})}if(r.reply){const n=r.reply.queryId||r.reply.id||r.queryId||r.id||it(32);t.push({istype:"ai",content:r.reply.content,isDefault:r.reply.isDefault,time:r.time||r.gmtCreate||Date.now(),queryId:n,clientSideId:n+"-ai",...r.reply})}}return t}const Or=async(e,t,r)=>{try{je.post(`${e.url}/qa/feedback`,t,{headers:{Authorization:e.token,"X-CSRF-TOKEN-IN":e.CSRFToken||""}}).then(n=>{n.data.success&&r&&r()})}catch(n){console.log("error",n)}},Jt=async(e,t,r)=>{try{je.delete(`${e.url}/qa/feedback/cancel?queryId=${t.queryId}`,{headers:{Authorization:e.token,"X-CSRF-TOKEN-IN":e.CSRFToken||""}}).then(n=>{n.data.success&&r&&r()})}catch(n){console.log("error",n)}},es=(e,t)=>{try{je.get(`${e.url}/qa/feedback/que/list`,{headers:{Authorization:e.token}}).then(r=>{r.data.success&&t&&t(r.data.data)})}catch(r){console.log("error",r)}},ts=async(e,t,r)=>{try{je.post(`${e.url}/qa/dialogue/reName`,t,{headers:{Authorization:e.token,"X-CSRF-TOKEN-IN":e.CSRFToken||""}}).then(n=>{n.data.success?r&&r(n):be.error("\u7F16\u8F91\u540D\u5B57\u5931\u8D25")}).catch(n=>{var o,a;(a=(o=n==null?void 0:n.response)==null?void 0:o.data)!=null&&a.errorMsg&&be.error(n.response.data.errorMsg)})}catch(n){console.log("error",n)}},rs=async(e,t,r)=>{try{je.delete(`${e.url}/qa/dialogue/delete?sessionId=${t.sessionId}`,{headers:{Authorization:e.token,"X-CSRF-TOKEN-IN":e.CSRFToken||""}}).then(n=>{n.data.success&&r&&r(n.data)})}catch(n){console.log("error",n)}},ns=async(e,t,r)=>{console.log("[DEBUG] handleCreateConversation \u8BF7\u6C42",{url:e.url,token:e.token,data:t});try{je.post(`${e.url}/qa/dialogue/create`,t,{headers:{Authorization:e.token,"X-CSRF-TOKEN-IN":e.CSRFToken||""}}).then(n=>{n.data.success?r&&r(n.data):be.error(n.data.errorMsg||"\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25")}).catch(n=>{var o,a;(a=(o=n==null?void 0:n.response)==null?void 0:o.data)!=null&&a.errorMsg&&be.error(n.response.data.errorMsg)})}catch(n){console.log("error",n)}},os=async(e,t,r)=>{try{const{uid:n,queryId:o}=t;let a=`${e.url}/index/knowledgeBase/file/deleteByUid?uid=${n}`;o&&(a+=`&queryId=${o}`),je.delete(a,{headers:{Authorization:e.token,"X-CSRF-TOKEN-IN":e.CSRFToken||""}}).then(s=>{s.data.success?r&&r(!0,s):r&&r(!1,s)}).catch(s=>{r&&r(!1,s)})}catch(n){r&&r(!1,n)}},as=""+new URL("assets/defaultWeLogo.svg",import.meta.url).href,ss="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAOkSURBVHgBxZRbTBxlFMd/c2EvXBbZLbsCVhcKaAyh2BKTWrX12RhNmxa1IVp98FEJVGNMY2KItSZtqGjaROMlaDSVxiZeqiRa0FBpIlSkhgK15WoLu7AL3V1md25+7CpUojzYB7/km5OZc+Z35pzz/wb+l3X7PotNL9tvd1yIc8OrYp9pWXZ6JXXdfLOtbdNa4fJazoZdu9xVNUE5petIVS9h/npRfkDKefg/A+OaJuUGvIz3DzD14R6uHv/WCmzbcuNlj7S+3z7+5Xepno7TLeJWWiv2n5zyTcEaT/TJlrfwljxCTm42lgHRmIHDqaIqIsTE43NS7FHCBXKkIzw4eGKkYcdnwmGvBspSy+DpxlrffXtqC6WeqM3+CZ3wnAZLOyXAlsXfOjU7D6EYHLw7zVKvgykcG+r98YmKjdG5BK3nw7w7YQuATdAJWR4IJ2UiswKoiC39+S0+4QjNL0NWgDU7y57ZVlLd2n+FO/Kd7BxxcPOpMKGrCSxNTNm2kVUZ2e1g+5YCxh4q4IW+cAactYTZLi6dxgqw4dUjj+UgfXpSJRAaY9Lt4dZAkoW5YWSXyKwo6ZYbhsFCciPe9hgHtDiB+kqe6huF6jknv2As9/Dj3mv2se4Yh5RhEr4SbD2FpMjomkZ0eoaunl5yxXwqKsspKwsiOVzYqST143k8Xe7gvaN17tHOTi0D/D6U3DqhO7oNNxOlU6heD0cOH2frg/dSU1ywMgRhRmMpvvjoG55t3I0RWWDvuST9iy5q64qtr2/LV9Ill/aNOsb9fnC48a+zGYzF6R/opefsGU59sl88d6V5tpagqekNFg2LgeHN3F/pJS9rET2l4v15Ruav1PHLEdsUJYpXcNjXKA54iCd11gf9ONUkLqeVtu4ciQUjwcCF3wjc4sUlJbhouyjOVek6O2kvT3kGV3e9P/uetlmhi4VpCsU0Wz5o5i6/kIehY8UjyHlLpVt8daKZc1d0qt3zaV2ex09LjYvnhsx3rj8pEq90N1QU+Q+9WJVgbzBPpFIzIrZNsYWVlYyVhJXVtFys6UHWf76O36NDu3nt0fbVJ0Wm6Sedomx5hzPCwYpJygvdkOMVQhbKFjrEFG2JRQjPTHH4Uh4HoptFfy2T5+9clt/qo6fS9MMYilqEL1dCyCQtQsnKhC51yUyCkBLz4qeT77Np3KCme/EvwJVndUcfl0qr6uzKwAb8biemqTCjmYS0RUKhM1zuep2TzZfIpFlefwDISXe8s31UTQAAAABJRU5ErkJggg==",is=(e,t)=>{const r={...or.colors,...e};return`
|
|
67
|
+
.g-welcome-${t} .g-welcome-title {
|
|
68
|
+
background-image: linear-gradient(90deg, #3262FA 0%, #6C18FF 100%);
|
|
69
|
+
-webkit-background-clip: text;
|
|
70
|
+
background-clip: text;
|
|
71
|
+
color: transparent;
|
|
72
|
+
-webkit-text-fill-color: transparent;
|
|
73
|
+
}
|
|
74
|
+
.g-welcome-${t} .g-welcome-subtitle {
|
|
75
|
+
color: ${r.disabled};
|
|
76
|
+
}
|
|
77
|
+
.g-welcome-${t} .g-welcome-btn {
|
|
78
|
+
background-color: #ffffff;
|
|
79
|
+
border-color: ${r.border};
|
|
80
|
+
color: ${r.text};
|
|
81
|
+
height: 36px;
|
|
82
|
+
border-width: 1px;
|
|
83
|
+
box-shadow: 0 1px 2px rgba(31,35,41,0.04);
|
|
84
|
+
}
|
|
85
|
+
.g-welcome-${t} .g-welcome-btn:hover {
|
|
86
|
+
border-color: ${r.primary};
|
|
87
|
+
color: ${r.primary};
|
|
88
|
+
background-color: #ffffff;
|
|
89
|
+
box-shadow: 0 2px 6px rgba(31,35,41,0.08);
|
|
90
|
+
}
|
|
91
|
+
.g-welcome-${t} .g-welcome-btn.active {
|
|
92
|
+
background-image: linear-gradient(90deg, #F1F8FF 0%, #F9F4FF 100%);
|
|
93
|
+
border-color: ${r.primary};
|
|
94
|
+
box-shadow: 0 4px 10px rgba(24, 144, 255, 0.25);
|
|
95
|
+
}
|
|
96
|
+
.g-welcome-${t} .g-welcome-btn .icon-badge {
|
|
97
|
+
width: 24px;
|
|
98
|
+
height: 24px;
|
|
99
|
+
border-radius: 9999px;
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
background: radial-gradient(100% 100% at 50% 0%, #F2F3F5 0%, #FFFFFF 100%);
|
|
104
|
+
box-shadow: inset 0 0 0 1px ${r.border};
|
|
105
|
+
}
|
|
106
|
+
.g-welcome-${t} .g-welcome-pagination-btn {
|
|
107
|
+
color: ${r.primary};
|
|
108
|
+
}
|
|
109
|
+
.g-welcome-${t} .g-welcome-pagination-btn:disabled {
|
|
110
|
+
color: ${r.disabled};
|
|
111
|
+
cursor: not-allowed;
|
|
112
|
+
}
|
|
113
|
+
.g-welcome-${t} .g-welcome-pagination-text {
|
|
114
|
+
color: ${r.text};
|
|
115
|
+
}
|
|
116
|
+
`};function ls({config:e,styles:t}){if(!e)return null;const r=JSON.parse(e.configJson),n=Ae(()=>{var o;return{...or.colors,...(o=t==null?void 0:t.theme)==null?void 0:o.colors}},[t]);return R("div",{className:"w-[340px] rounded-xl p-4 animate-fade-in bg-white",children:[R("div",{className:"flex items-center mb-2",children:[d("span",{className:"text-md font-bold truncate mr-2",style:{color:n.primary},children:r.config_name||"\u52A9\u624B\u914D\u7F6E"}),d("span",{className:"text-xs truncate rounded px-2 py-0.5",style:{backgroundColor:`${n.primary}1A`,color:n.disabled},children:r.model_name})]}),d("div",{className:"border-b my-2",style:{borderColor:n.border}}),R("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-700 mb-2",style:{color:n.text},children:[R("div",{children:["\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570\uFF1A",d("span",{className:"font-semibold",children:r.max_round})]}),R("div",{children:["\u6700\u5927\u4EE4\u724C\u6570\uFF1A",d("span",{className:"font-semibold",children:r.max_tokens})]}),R("div",{children:["\u6E29\u5EA6\uFF1A",d("span",{className:"font-semibold",children:r.temperature})]}),R("div",{children:["\u53EC\u56DE\u6570\uFF1A",d("span",{className:"font-semibold",children:r.top_k})]}),R("div",{children:["\u591A\u6837\u6027\uFF1A",d("span",{className:"font-semibold",children:r.top_p})]}),R("div",{children:["\u76F8\u4F3C\u5EA6\u9608\u503C\uFF1A",d("span",{className:"font-semibold",children:r.score_threshold})]})]}),R("div",{className:"mb-2",children:[d("div",{className:"text-xs text-gray-400 mb-1",style:{color:n.disabled},children:"\u5173\u8054\u77E5\u8BC6\u5E93\uFF1A"}),d("div",{className:"flex flex-wrap gap-1",children:r.knowledge_base_name?r.knowledge_base_name.split(";").map((o,a)=>d("span",{className:"px-2 py-0.5 rounded-full text-xs",style:{backgroundColor:`${n.primary}1A`,color:n.primary},children:o},a)):d("span",{className:"text-gray-300",style:{color:n.disabled},children:"\u65E0"})})]}),R("div",{className:"mb-2",children:[d("div",{className:"text-xs text-gray-400 mb-1",style:{color:n.disabled},children:"\u5F00\u542F\u529F\u80FD:"}),R("div",{className:"flex flex-wrap gap-2 text-xs mt-2",children:[!!r.enabled_faq&&d("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${n.success}1A`,color:n.success},children:"FAQ"}),!!r.enabled_graph&&d("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${n.success}1A`,color:n.success},children:"\u56FE\u8C31"}),!!r.dependOnKb&&d("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${n.success}1A`,color:n.success},children:"\u5F3A\u77E5\u8BC6\u4F9D\u8D56"}),!!r.enabled_table_select&&d("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${n.success}1A`,color:n.success},children:"\u8868\u683C\u7B5B\u9009"}),!!r.enabled_rerank&&d("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${n.success}1A`,color:n.success},children:"\u7CBE\u6392\u6A21\u5F0F"}),!!r.need_trace_source&&d("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${n.success}1A`,color:n.success},children:"\u6EAF\u6E90"}),!!r.is_download&&d("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${n.success}1A`,color:n.success},children:"\u4E0B\u8F7D\u6EAF\u6E90"})]})]})]})}function cs(e,t=[],r=60){const[n,o]=ue("");return Se(()=>{o("");let a=0;const s=setInterval(()=>{o(c=>a>=e.length?(clearInterval(s),c):(a++,e.slice(0,a)))},r);return()=>clearInterval(s)},[e,...t]),n}function us(e){const{assistantList:t,eventsEmit:r,styles:n,selectedId:o,onSelectAssistant:a,productLogo:s}=e,[c,p]=ue(1),m=12,y=Le();Se(()=>{o&&y.current!==o&&(r==null||r("conversation:new_assistant_change",{assistantId:o}),y.current=o)},[o,r]);const v=Ae(()=>it(),[]);Se(()=>{var h;if((h=n==null?void 0:n.theme)!=null&&h.colors){const E=document.createElement("style");return E.innerHTML=is(n.theme.colors,v),E.id=`g-welcome-styles-${v}`,document.head.appendChild(E),()=>{const D=document.getElementById(E.id);D&&D.remove()}}},[n,v]);const x=Ae(()=>t.find(h=>h.id===o),[t,o]),w=Ae(()=>JSON.parse((x==null?void 0:x.configJson)||"{}"),[x]),C=Math.ceil(((t==null?void 0:t.length)||0)/m),i=(t==null?void 0:t.slice((c-1)*m,c*m))||[];Se(()=>{if(o&&t){const h=t.findIndex(E=>E.id===o);if(h!==-1){const E=Math.floor(h/m)+1;p(E)}}},[o,t,m]);const f=w.prologue||"\u60A8\u597D\uFF0C\u6B22\u8FCE\u4F7F\u7528\u5C0F\u9CB8\u667A\u80FD\u95EE\u7B54",g=cs(f,[o],30);return R("div",{className:`flex flex-col items-center justify-center h-full w-full g-welcome-${v}`,children:[d("img",{src:s||as,alt:"logo",className:"mb-4",style:{width:100,height:100}}),d("div",{className:"text-3xl font-bold mb-2 g-welcome-title",children:g}),d("div",{className:"text-sm text-gray-500 mb-20",children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u667A\u80FD\u52A9\u624B\uFF0C\u5F00\u59CB\u4F60\u7684\u667A\u80FD\u95EE\u7B54\u4E4B\u65C5"}),!o&&d("div",{className:"flex mb-2 g-welcome-subtitle",children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u667A\u80FD\u52A9\u624B"}),d("div",{className:"flex flex-wrap gap-3 px-5 justify-center mb-4",children:i&&i.length>0?i.map(h=>{const E=o===h.id;let D=h.icon;try{const b=JSON.parse(h.configJson||"{}");D=D||b.icon||b.avatar||b.logo}catch{}return D=D||ss,d(nn,{content:()=>d(ls,{config:t.find(b=>b.id===h.id),styles:n}),trigger:"hover",placement:"bottom",children:R("button",{className:`g-welcome-btn px-3 cursor-pointer rounded-full border font-medium min-w-[160px] text-sm transition-all flex items-center gap-2 ${E?"active":""}`,onClick:()=>a==null?void 0:a(h.id),title:h.name,children:[d("span",{className:"icon-badge",children:d("img",{src:D,alt:"icon",style:{width:16,height:16,borderRadius:4}})}),d("span",{className:"truncate max-w-[180px]",children:h.name})]})},h.id)}):d("div",{className:"g-welcome-subtitle",children:"\u6682\u65E0\u53EF\u7528\u52A9\u624B"})}),C>1&&R("div",{className:"flex items-center gap-3 text-sm",children:[d("button",{className:"g-welcome-pagination-btn px-3 py-1 rounded transition-colors",onClick:()=>p(h=>Math.max(1,h-1)),disabled:c===1,children:"\u4E0A\u4E00\u9875"}),R("span",{className:"g-welcome-pagination-text",children:[c," / ",C]}),d("button",{className:"g-welcome-pagination-btn px-3 py-1 rounded transition-colors",onClick:()=>p(h=>Math.min(C,h+1)),disabled:c===C,children:"\u4E0B\u4E00\u9875"})]})]})}async function ds(e,t){const r=e.getReader();let n;for(;!(n=await r.read()).done;)t(n.value)}function ps(e){let t,r,n,o=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=ms(t,s);const c=t.length;let p=0;for(;r<c;){o&&(t[r]===10&&(p=++r),o=!1);let m=-1;for(;r<c&&m===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-p);break;case 13:o=!0;case 10:m=r;break}if(m===-1)break;e(t.subarray(p,m),n),p=r,n=-1}p===c?t=void 0:p!==0&&(t=t.subarray(p),r-=p)}}function fs(e,t,r){let n=Br();const o=new TextDecoder;return function(s,c){if(s.length===0)r==null||r(n),n=Br();else if(c>0){const p=o.decode(s.subarray(0,c)),m=c+(s[c+1]===32?2:1),y=o.decode(s.subarray(m));switch(p){case"data":n.data=n.data?n.data+`
|
|
117
|
+
`+y:y;break;case"event":n.event=y;break;case"id":e(n.id=y);break;case"retry":const v=parseInt(y,10);isNaN(v)||t(n.retry=v);break}}}}function ms(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Br(){return{data:"",event:"",id:"",retry:void 0}}var gs=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const er="text/event-stream",hs=1e3,_r="last-event-id";function ys(e,t){var{signal:r,headers:n,onopen:o,onmessage:a,onclose:s,onerror:c,openWhenHidden:p,fetch:m}=t,y=gs(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((v,x)=>{const w=Object.assign({},n);w.accept||(w.accept=er);let C;function i(){C.abort(),document.hidden||b()}p||document.addEventListener("visibilitychange",i);let f=hs,g=0;function h(){document.removeEventListener("visibilitychange",i),window.clearTimeout(g),C.abort()}r==null||r.addEventListener("abort",()=>{h(),v()});const E=m??window.fetch,D=o??vs;async function b(){var A;C=new AbortController;try{const k=await E(e,Object.assign(Object.assign({},y),{headers:w,signal:C.signal}));await D(k),await ds(k.body,ps(fs(T=>{T?w[_r]=T:delete w[_r]},T=>{f=T},a))),s==null||s(),h(),v()}catch(k){if(!C.signal.aborted)try{const T=(A=c==null?void 0:c(k))!==null&&A!==void 0?A:f;window.clearTimeout(g),g=window.setTimeout(b,T)}catch(T){h(),x(T)}}}b()})}function vs(e){const t=e.headers.get("content-type");if(!(t!=null&&t.startsWith(er)))throw new Error(`Expected content-type to be ${er}, Actual: ${t}`)}class Kt extends Error{}let He=null;const bs=({baseUrl:e,token:t,CSRFToken:r,setChatData:n,activeSessionId:o,setAppStatus:a,setConversationList:s})=>{const c=({content:C,status:i,respTime:f,filePaths:g,reference:h,webReference:E,graphReference:D,databaseReference:b,llmType:A,resultType:k,queryId:T,tokens:N})=>{n($=>{var V;if(!$[0])return $;const _=$[0],H=_.messages||[],z=H.length-1;if(z<0)return $;const L=H[z];if(L.istype!=="ai")return $;let M=H.slice();if(g!=null&&g.length){const X=H.length-2;if(X>=0&&((V=H[X])==null?void 0:V.istype)==="user"){const q={...H[X],filePaths:g};M[X]=q}}const Q={...L,content:(L.content||"")+C,status:i,respTime:f,filePaths:g,reference:h,webReference:E,graphReference:D??L.graphReference,databaseReference:b??L.databaseReference,resultType:k,llmType:A,tokens:N,queryId:T||L.queryId||it(32)};return Q.clientSideId=Q.clientSideId||Q.queryId+"-ai",M[z]=Q,[{..._,isNew:!1,messages:M},...$.slice(1)]})},p=C=>{if(C instanceof Kt)throw a(i=>({...i,display:"error",sender:"ready"})),He&&(He.abort(),He=null),C};return{updateUserFilesMessage:({currentFiles:C})=>{n(i=>{if(!i[0])return i;const f=i[0],g=f.messages||[];if(!g.length)return i;const h=g.length-2;if(h<0||g[h].istype!=="user")return i;const D=g.slice();return D[h]={...g[h],currentFiles:C},[{...f,messages:D},...i.slice(1)]})},api_startChat_re:(C,i)=>{He&&He.abort(),He=new AbortController;const f=`${e}/qa/ai/question_re`;console.log("data",C);const g={...C};ys(f,{method:"post",signal:He.signal,headers:{"Content-Type":"application/json",Accept:"text/event-stream",Authorization:t||"","X-CSRF-TOKEN-IN":r||""},openWhenHidden:!0,body:JSON.stringify(g),onopen:async h=>{if(h.status===500)throw new Kt("Internal Server Error");if(!h.ok)throw new Kt(`HTTP error: ${h.status}`)},onmessage:h=>{const E=JSON.parse(h.data);if(o!==E.sessionId)return;const{reply:D,resultType:b,respTime:A,reference:k,webReference:T,graphReference:N,filePaths:$,status:_,docs:H,llmType:z,databaseReference:L}=E,M=$?JSON.parse($):[];if(_===2&&D&&D.content&&(D.content.includes("\u6A21\u578B\u6682\u65E0\u6CD5\u8FD4\u56DE")||D.content.includes("\u5931\u8D25")||D.content.includes("\u9519\u8BEF")||D.content.includes("\u8BF7\u7A0D\u540E\u518D\u8BD5"))&&a(Q=>({...Q,display:"ready",sender:"ready"})),_===2){if(c({content:D.content||"",status:2,respTime:A,filePaths:M,reference:k||H||"",webReference:T||"",graphReference:N||null,databaseReference:L,llmType:z,resultType:b,queryId:E.queryId,tokens:E.tokens}),a(Q=>({...Q,display:"ready",sender:"ready"})),i){const Q=A||Date.now();console.log("[AichatUseController] \u6D88\u606F\u53D1\u9001\u6210\u529F\uFF0CgmtModified:",Q),i(Q)}}else c({content:D.content||"",status:_,respTime:A,filePaths:M,reference:k||H||"",webReference:T||"",graphReference:N||null,databaseReference:L,llmType:z,resultType:b,queryId:E.queryId,tokens:E.tokens})},onerror:p})},addEmptyMessage:({queryId:C,content:i,filePaths:f,currentFiles:g})=>{n(h=>{const E=new Date().toISOString(),D=C||it(32),b={istype:"user",content:i,time:E,queryId:D,clientSideId:D+"-user",filePaths:f||"",currentFiles:g||[]},A={istype:"ai",content:"",time:new Date(Date.now()+1).toISOString(),streaming:!0,status:0,queryId:D,clientSideId:D+"-ai"},k=h.find(T=>T.id===o);return k?k.messages.push(b,A):console.warn("addEmptyMessage called without an active session."),[...h]})},setLastEmptyMessage:({now:C})=>{n(i=>{if(!i[0])return i;const f=i[0],g=f.messages||[];if(!g.length)return i;const h=g.length-1;if(h<0)return i;const E=g[h];if(E.istype!=="ai")return i;const D=g.slice();return D[h]={...E,istype:"ai",content:"",time:C,streaming:!0,status:0},[{...f,messages:D},...i.slice(1)]})},stopStream:()=>{He&&(He.abort(),He=null),a(C=>({...C,display:"ready",sender:"ready"}))}}},Tr=e=>e?Array.isArray(e)?e.map(n=>"/minio/"+n.split("/").slice(3).join("/")):"/minio/"+e.split("/").slice(3).join("/"):"",Pr="http://10.15.12.13:9000/",xs=e=>{if(typeof e=="string"){const t=e.split(".");return t.length?t[t.length-1]:""}else return""},Fs=e=>{var b,A,k,T,N,$,_,H;const{file_type:t,file_name:r,url:n,parse_url:o,retrieve_tags:a,file_id:s,parsed_file_type:c,onlyDownloadTypes:p,references:m,eventsEmit:y,styles:v,isUploadFile:x,type:w,collectionItems:C,pdfPages:i=0,fileManagerData:f}=e;if(w==="collection"&&Array.isArray(C)){const M=`calc(90% - ${.5}px)`,Q=C.slice(0,4),U=C.length>4,V="\u6253\u5F00\u5408\u96C6",X=()=>{if(f&&t==="pdf"&&!e.pdfPages){const q=((f==null?void 0:f.uploadedFiles)||[]).find(ee=>{var Y;return((ee==null?void 0:ee.name)||((Y=ee==null?void 0:ee.file)==null?void 0:Y.name))===r});if(!(q!=null&&q.pdfPages)){be.warning("\u8BE5PDF\u6587\u4EF6\u672A\u89E3\u6790\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}y==null||y("reference_file:click",{...e,pdfPages:(q==null?void 0:q.pdfPages)||0})}else y==null||y("reference_file:click",e)};return R("div",{className:"user-file relative group flex flex-col items-center justify-center cursor-pointer backdrop-blur-sm rounded-lg border p-2 text-sm transition-all bg-white shadow",style:{width:94,height:94,minWidth:94,minHeight:94,borderColor:(A=(b=v==null?void 0:v.theme)==null?void 0:b.colors)==null?void 0:A.border},onClick:X,children:[d("div",{className:"grid grid-cols-2 items-center justify-center grid-rows-2 gap-1 w-full h-full",style:{width:"100%",height:"100%",gap:1},children:Q.map((q,ee)=>{var K,le,we,Ie;if(U&&ee===3)return d("div",{className:"flex items-center justify-center bg-gray-100 rounded",style:{width:M,height:M},children:d("span",{className:"text-xl text-gray-300 font-bold scale-75",children:"..."})},"ellipsis");if(q.file_type==="image"||q.file_type==="jpg"||q.file_type==="jpeg"||q.file_type==="png"||q.file_type==="gif"||q.file_type==="bmp"||q.file_type==="webp")return d("div",{className:"relative flex items-center justify-center bg-white rounded-lg border overflow-hidden",style:{width:M,height:M,borderColor:(le=(K=v==null?void 0:v.theme)==null?void 0:K.colors)==null?void 0:le.border},children:d("div",{className:"flex items-center justify-center w-full h-full scale-75",children:d("img",{src:String(q.url||q.file_path||""),alt:q.file_name||"",className:"object-contain max-w-full max-h-full"})})},q.file_name||ee);const j=tr(String(q.file_type||""),v);return d("div",{className:"user-file flex flex-col items-center justify-center rounded-lg border bg-gray-50 p-1 text-sm",title:q.file_name,style:{width:M,height:M,borderColor:(Ie=(we=v==null?void 0:v.theme)==null?void 0:we.colors)==null?void 0:Ie.border},children:d("div",{className:"flex items-center justify-center w-full h-full scale-75",children:j})},q.file_name||ee)})}),d("div",{className:"absolute inset-0 bg-transparent group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center rounded-lg pointer-events-none",children:R("div",{className:"flex flex-col items-center text-xs justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity",children:[d(zt,{size:20,className:"mb-1 text-white"}),d("span",{className:"text-white text-center",style:{fontSize:12},children:V})]})})]})}const g=()=>{if(console.log(o,"parse_url",n,"url"),f&&t==="pdf"&&!i){const z=((f==null?void 0:f.uploadedFiles)||[]).find(L=>{var M;return((L==null?void 0:L.name)||((M=L==null?void 0:L.file)==null?void 0:M.name))===(r||"").replace(/\s+/g,"")});if(!(z!=null&&z.pdfPages)){be.warning("\u8BE5PDF\u6587\u4EF6\u672A\u89E3\u6790\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}y==null||y("reference_file:click",{file:r,file_type:t,url:n,parse_url:o,retrieve_tags:a,file_id:s,parsed_file_type:c,references:m,type:h,isUploadFile:x,pdfPages:z.pdfPages||0})}else y==null||y("reference_file:click",{file:r,file_type:t,url:n,parse_url:o,retrieve_tags:a,file_id:s,parsed_file_type:c,references:m,type:h,isUploadFile:x,pdfPages:i})},h=Ae(()=>(r||"").split(".").pop()||"",[r]),E=tr(h,v),D=async()=>{if(n){const z=Tr(n.indexOf("http")>-1?n:`${Pr}/${n}`);if(h.toLowerCase()==="json"){try{const Q=await fetch(z);if(!Q.ok)throw new Error("\u4E0B\u8F7D\u5931\u8D25");const U=await Q.blob(),V=document.createElement("a");V.href=URL.createObjectURL(U),V.download=r||"",document.body.appendChild(V),V.click(),document.body.removeChild(V),setTimeout(()=>URL.revokeObjectURL(V.href),1e3)}catch{alert("\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25")}return}const M=document.createElement("a");M.href=z,M.download=r||"",document.body.appendChild(M),M.click(),document.body.removeChild(M)}};return p&&p.includes(h.toLowerCase())?R("div",{className:"user-file relative group w-24 h-24 flex flex-col items-center justify-center cursor-pointer backdrop-blur-sm rounded-lg border p-2 text-sm transition-all",title:r,onClick:D,style:{borderColor:(T=(k=v==null?void 0:v.theme)==null?void 0:k.colors)==null?void 0:T.border},children:[E,d("span",{className:"file-name font-medium truncate text-center px-2 pt-1",style:{fontSize:10,maxWidth:"5.5rem"},children:r}),d("div",{className:"absolute text-center inset-0 cursor-pointer bg-transparent group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center rounded-lg",children:R("div",{className:"flex flex-col items-center text-xs justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity",children:[d(zt,{className:"text-white opacity-0 group-hover:opacity-100 transition-opacity mx-auto"}),d("div",{className:"text-white text-center",style:{fontSize:10},children:"\u4E0B\u8F7D\u6587\u4EF6"})]})})]},r):h==="image"||h==="jpg"||h==="jpeg"||h==="png"||h==="gif"||h==="bmp"||h==="webp"?R("div",{className:"relative group w-24 h-24 cursor-pointer flex items-center justify-center",onClick:()=>g(),children:[n?d("img",{src:String(Tr(n&&n.indexOf("http")>-1?n:`${Pr}/${n}`)||""),alt:r||"",className:"w-full h-full object-cover rounded-md border",style:{borderColor:($=(N=v==null?void 0:v.theme)==null?void 0:N.colors)==null?void 0:$.border}}):d("div",{className:"w-full h-full flex items-center justify-center",children:d("span",{className:"animate-spin rounded-full border-2 border-gray-300 border-t-blue-500 w-8 h-8 inline-block"})}),d("div",{className:"absolute inset-0 bg-transparent group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center rounded-md",children:R("div",{className:"flex flex-col items-center text-xs justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity",children:[d(io,{className:"text-white opacity-0 group-hover:opacity-100 transition-opacity mx-auto"}),d("div",{className:"text-white text-center",children:"\u67E5\u770B\u56FE\u7247"})]})})]},r):R("div",{className:"user-file relative group w-24 h-24 flex flex-col items-center justify-center cursor-pointer backdrop-blur-sm rounded-lg border p-2 text-sm transition-all",title:r,onClick:g,style:{borderColor:(H=(_=v==null?void 0:v.theme)==null?void 0:_.colors)==null?void 0:H.border},children:[E,d("span",{className:"file-name font-medium truncate text-center px-2 pt-1",style:{fontSize:10,maxWidth:"5.5rem"},children:r}),d("div",{className:"absolute text-center inset-0 cursor-pointer bg-transparent group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center rounded-lg",children:R("div",{className:"flex flex-col items-center text-xs justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity",children:[d(zt,{className:"text-white opacity-0 group-hover:opacity-100 transition-opacity mx-auto"}),d("div",{className:"text-white text-center",style:{fontSize:10},children:"\u6253\u5F00\u6587\u4EF6"})]})})]},r)},Cs=e=>e?e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`:"",ws=({fileName:e,fileSize:t,icon:r,statusText:n,statusColor:o="text-gray-400",statusIcon:a,onRemove:s,themeColors:c={},cardId:p,showRemove:m=!0,disabledRemove:y=!1,onRemoveWithAnim:v,extra:x,style:w})=>R("div",{id:p,className:"group gap-x-2.5 items-center file-display-card relative flex w-[210px] bg-white border border-gray-200 rounded-md shadow-sm px-2 py-1 transition-all hover:shadow-md hover:border-blue-300",style:w,children:[d("div",{className:"pt-1",children:r}),R("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[R("div",{className:"flex items-center justify-between gap-1",children:[d("span",{className:"text-[12px] font-medium truncate max-w-[120px]",title:e,children:e}),d("span",{className:"ml-1 text-[11px] text-gray-400",children:Cs(t)})]}),R("div",{className:`text-[10px] mt-0.5 flex items-center gap-3 ${o}`,children:[a,d("span",{children:n})]})]}),x,m&&!y&&d("button",{className:"absolute top-0.5 right-0.5 opacity-0 group-hover:opacity-100 transition-opacity text-gray-300 hover:text-red-400 text-xs p-0.5 rounded-full bg-white shadow-sm z-10",onClick:()=>{v&&p?v(p):s&&s()},title:"\u79FB\u9664",style:{lineHeight:0,color:c.error||"#FF0000"},children:d(ar,{className:"w-3.5 h-3.5"})})]});function tr(e,t){var n;const r=((n=t==null?void 0:t.theme)==null?void 0:n.icons)||{};switch(e.toLowerCase()){case"docx":case"doc":return r.docx?d("img",{src:r.docx,alt:"docx",style:{width:20,height:20}}):d(ze,{type:"rag/word",size:18});case"image":case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":case"svg":case"ico":return r.image?d("img",{src:r.image,alt:"image",style:{width:20,height:20}}):d(ze,{type:"rag/pic",size:18});case"pptx":case"ppt":return r.pptx?d("img",{src:r.pptx,alt:"pptx",style:{width:20,height:20}}):d(ze,{type:"rag/ppt",size:18});case"sheets":case"excel":case"xls":case"csv":case"xlsx":case"xlsm":case"xlsb":case"xltx":case"xltm":case"xlt":case"xlam":return r.sheets?d("img",{src:r.sheets,alt:"sheets",style:{width:20,height:20}}):d(ze,{type:"rag/excel",size:18});case"pdf":return r.pdf?d("img",{src:r.pdf,alt:"pdf",style:{width:20,height:20}}):d(ze,{type:"rag/pdf",size:18});case"txt":return r.txt?d("img",{src:r.txt,alt:"txt",style:{width:20,height:20}}):d(ze,{type:"rag/txt",size:18});case"md":return r.md?d("img",{src:r.md,alt:"txt",style:{width:20,height:20}}):d(ze,{type:"rag/document",size:18});case"json":return r.json?d("img",{src:r.json,alt:"json",style:{width:20,height:20}}):d(ze,{type:"rag/json",size:18});case"html":case"htm":return r.html?d("img",{src:r.html,alt:"html",style:{width:20,height:20}}):d(ze,{type:"rag/url",size:18});case"xml":default:return d(ze,{type:"rag/file",size:18})}}const Es=[{file:{name:"\u4EA7\u54C1\u9700\u6C42\u6587\u6863.pdf",size:1024*1024*2.5,type:"application/pdf"},type:"pdf",status:"uploaded",url:"https://example.com/file1.pdf"},{file:{name:"\u6570\u636E\u5206\u6790\u62A5\u544A.xlsx",size:1024*1024*1.2,type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},type:"excel",status:"uploaded",url:"https://example.com/file3.xlsx"},{file:{name:"\u7CFB\u7EDF\u67B6\u6784\u56FE.png",size:1024*512,type:"image/png"},type:"image",status:"uploaded",url:"https://example.com/file2.png"}];function Ss({open:e,onCancel:t,files:r=Es,currentFiles:n=[],onUpload:o,onRemoveFile:a,styles:s,eventsEmit:c}){const p={pending:"\u5F85\u4E0A\u4F20",uploading:"\u4E0A\u4F20\u4E2D",uploaded:"\u5DF2\u4E0A\u4F20",analyzing:"\u89E3\u6790\u4E2D",analyze_failed:"\u89E3\u6790\u5931\u8D25",error:"\u5931\u8D25"},[m,y]=ue([]),v=(i,f)=>{c&&c("uploaded_file:removeFromTemp",{file:i,idx:f})},x=s&&s.theme&&s.theme.colors?s.theme.colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080",shadow:"#000000",appBackground:"#fff"},w=r.map((i,f)=>R("div",{className:"relative flex flex-col gap-2.5 items-center justify-center",children:[d("div",{className:"absolute right-1 top-1 z-10",children:d(ln,{title:"\u786E\u8BA4\u4ECE\u4E34\u65F6\u5BF9\u8BDD\u77E5\u8BC6\u5E93\u79FB\u9664\u8BE5\u6587\u4EF6\uFF1F",onConfirm:()=>v(i,f),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",children:d("button",{className:"bg-white cursor-pointer rounded-full p-0.5",style:{lineHeight:0,color:x&&x.text?x.text:"#FF0000",transition:"background 0.2s, color 0.2s"},onMouseOver:g=>{g.currentTarget.style.color=x&&x.error?x.error:"#FF0000"},onMouseOut:g=>{g.currentTarget.style.color=x.text},title:"\u79FB\u9664",children:d(ar,{className:"w-3 h-3"})})})}),d(Fs,{file_type:xs(i.file.name||i.name),file_name:i.name||i.file.name,url:i.url,retrieve_tags:[],styles:s,isUploadFile:!0,eventsEmit:c,parse_url:i.convertedFilePath,pdfPages:i.pdfPages||0})]},i.file.name+f)),C=n.map((i,f)=>{const g=i.file.name.split(".").pop()||"",h=tr(g,s);return d(ws,{cardId:`pending-file-card-${f}`,fileName:i.file.name,fileSize:i.file.size,icon:h,statusText:p[i.status||"pending"],statusColor:"text-gray-400",showRemove:!0,onRemove:()=>a&&a(i,f,"pending"),themeColors:x,style:{boxShadow:"none",height:55,background:"#f8fafc"}},i.file.name+f)});return m.length>0?(x&&x.error&&x.error,x&&x.error&&x.error+"",x&&x.error&&x.error):(x&&x.disabledText&&x.disabledText,x&&x.disabledBackground&&x.disabledBackground,x&&x.disabledText&&x.disabledText),R(sr,{open:e,onCancel:t,footer:null,title:"\u5BF9\u8BDD\u4E34\u65F6\u6587\u4EF6\u77E5\u8BC6\u5E93",closable:!1,width:800,styles:{body:{padding:"0",maxHeight:"70vh",overflow:"auto"}},children:[R("div",{className:"file-manager-modal space-y-6 px-4 py-4",children:[R("div",{className:"",children:[d("div",{className:"flex items-center mb-2 justify-between",children:R("div",{className:"flex items-center",children:[d("span",{className:"text-xs font-semibold text-gray-700",children:"\u5DF2\u4E0A\u4F20\u6587\u4EF6"}),R("span",{className:"ml-2 text-xs text-gray-400",children:[r.length," \u4E2A"]})]})}),d("div",{className:"w-full relative min-h-[200px] max-h-[260px] p-2 overflow-y-auto",style:{overflowX:"hidden"},children:d("div",{className:"flex flex-wrap gap-1",children:w.length>0?w:d("div",{className:"flex items-center w-full h-full py-10 justify-center text-gray-400 text-sm",children:"\u6682\u65E0\u5DF2\u4E0A\u4F20\u6587\u4EF6"})})})]}),R("div",{children:[R("div",{className:"flex items-center mb-2",children:[d("span",{className:"text-xs font-semibold text-gray-700",children:"\u5F85\u4E0A\u4F20\u6587\u4EF6"}),R("span",{className:"ml-2 text-xs text-gray-400",children:[n.length," \u4E2A"]})]}),R("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[C,d(ir.Dragger,{multiple:!0,showUploadList:!1,beforeUpload:(i,f)=>(i===f[0]&&(o==null||o(f)),!1),className:"!bg-gray-50 !border-dashed !border-gray-300 hover:!border-blue-400 cursor-pointer min-w-[160px] max-w-[220px] flex flex-row items-center justify-center border-2 rounded-lg transition-all",style:{height:45,boxShadow:"none",padding:0},children:R("div",{className:"flex flex-row items-center pb-8 justify-center",children:[d(rn,{size:20,className:"text-blue-400 mr-2"}),d("div",{className:"text-xs text-gray-500",children:"\u4E0A\u4F20\u6587\u4EF6"})]})})]})]}),d("div",{className:"flex justify-end gap-2",children:d(Xe,{type:"primary",onClick:t,children:"\u786E\u8BA4"})})]}),d("style",{children:`
|
|
118
|
+
.file-manager-modal .ant-upload-wrapper,
|
|
119
|
+
.file-manager-modal .ant-upload-drag,
|
|
120
|
+
.file-manager-modal .ant-upload-drag-container {
|
|
121
|
+
min-height: 55px !important;
|
|
122
|
+
height: 55px !important;
|
|
123
|
+
padding: 0 !important;
|
|
124
|
+
}
|
|
125
|
+
`})]})}function Ds(){return R("div",{className:"flex flex-col gap-8 p-4 w-full mx-auto",children:[R("div",{className:"flex items-start gap-4",children:[d("div",{className:"w-10 h-10 rounded-full bg-muted/80 animate-pulse"}),d("div",{className:"flex-1",children:d(It,{active:!0,paragraph:{rows:1}})})]}),R("div",{className:"flex items-start gap-4",children:[d("div",{className:"w-10 h-10 rounded-full bg-muted/80 animate-pulse"}),d("div",{className:"flex-1",children:d(It,{active:!0,paragraph:{rows:3}})})]}),R("div",{className:"flex items-start gap-4",children:[d("div",{className:"w-10 h-10 rounded-full bg-muted/80 animate-pulse"}),d("div",{className:"flex-1",children:d(It,{active:!0,paragraph:{rows:1}})})]}),R("div",{className:"flex items-start gap-4",children:[d("div",{className:"w-10 h-10 rounded-full bg-muted/80 animate-pulse"}),d("div",{className:"flex-1",children:d(It,{active:!0,paragraph:{rows:2}})})]})]})}function Is({msg:e,subMsg:t}){return R("div",{className:"flex flex-col items-center justify-center h-full p-8 text-center bg-white/80 backdrop-blur-sm",children:[d("div",{className:"mb-6 animate-bounce",children:d(co,{size:64,className:"text-[#d70016]"})}),d("h2",{className:"text-[20px] font-medium text-[#222222] mb-3",children:e||"\u5E94\u7528\u521D\u59CB\u5316\u5931\u8D25"}),d("p",{className:"text-[14px] text-[#555555] mb-8 max-w-[400px]",children:t||"\u65E0\u6CD5\u5B8C\u6210\u5E94\u7528\u521D\u59CB\u5316\uFF0C\u8FD9\u53EF\u80FD\u662F\u7531\u4E8E\u7F51\u7EDC\u8FDE\u63A5\u95EE\u9898\u6216\u670D\u52A1\u914D\u7F6E\u9519\u8BEF\u5BFC\u81F4\u7684\u3002\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u5E76\u91CD\u8BD5\u3002"}),d(Xe,{type:"primary",icon:d(on,{className:"w-4 h-4"}),onClick:()=>window.location.reload(),className:"flex items-center gap-2 bg-gradient-to-r from-[#2B69FF] to-[#8F91FF] border-none hover:opacity-90",children:"\u91CD\u65B0\u52A0\u8F7D"})]})}function $s(){return R("div",{className:"flex flex-col items-center justify-center h-full p-8 text-center bg-transparent! backdrop-blur-sm",children:[d("div",{className:"mb-6 animate-bounce",children:d(Xn,{size:64,className:"text-[#d70016]"})}),d("h2",{className:"text-[20px] font-medium text-[#222222] mb-3",children:"\u62B1\u6B49\uFF0C\u9047\u5230\u4E86\u4E00\u4E9B\u95EE\u9898"}),d("p",{className:"text-[14px] text-[#555555] mb-8 max-w-[400px]",children:"\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"}),d(Xe,{type:"primary",icon:d(on,{className:"w-4 h-4"}),onClick:()=>window.location.reload(),className:"flex items-center gap-2 bg-gradient-to-r from-[#2B69FF] to-[#8F91FF] border-none hover:opacity-90",children:"\u91CD\u65B0\u52A0\u8F7D"})]})}const As=1e3,Ns=3e3,ks=({isModalOpen:e,handleOk:t,handleCancel:r,data:n})=>{const o={header:{height:"60px",borderBottom:"1px solid #F0F0F0",display:"flex",paddingLeft:"24px",alignItems:"center",marginBottom:"16px"},title:{fontSize:"16px"},body:{padding:"0 24px"},mask:{},footer:{marginTop:"0px",padding:"0 24px 16px 24px"},content:{padding:0}},[a]=en();return Se(()=>{if(!e){a.resetFields();return}a.setFieldValue("new_name",n==null?void 0:n.label)},[n,e]),d(tn,{modal:{styles:o},children:d(sr,{title:d("div",{className:"text-[16px]",children:"\u7F16\u8F91\u4F1A\u8BDD\u540D\u79F0"}),closeIcon:null,open:e,width:520,centered:!0,className:"[&:[.ant-modal-content]]:bg-red",footer:R("div",{className:"mt-[16px] flex justify-end",children:[d(Xe,{children:"\u53D6\u6D88",onClick:r,className:"mr-[8px]"}),d(Xe,{children:"\u786E\u8BA4",onClick:async()=>{try{const s=await a.validateFields();t("ok_rename",s)}catch(s){console.log(s);return}},type:"primary",className:"border-none"})]}),children:d(fr,{form:a,children:d(fr.Item,{name:"new_name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165"},{max:100,message:"\u6700\u5927\u5B57\u6570\u9650\u5236100"}],children:d(Jn,{})})})})})},Os=({isModalOpen:e,handleOk:t,handleCancel:r,data:n})=>{const o={header:{height:"60px",borderBottom:"1px solid #F0F0F0",display:"flex",paddingLeft:"24px",alignItems:"center",marginBottom:"16px"},title:{fontSize:"16px"},body:{padding:"0 24px"},mask:{},footer:{marginTop:"0px",padding:"0 24px 16px 24px"},content:{padding:0}},[a]=en();return Se(()=>{if(!e){a.resetFields();return}a.setFieldValue("new_name",n==null?void 0:n.label)},[n,e]),d(tn,{modal:{styles:o},children:d(sr,{title:d("div",{className:"text-[16px]",children:"\u5220\u9664\u4F1A\u8BDD"}),closeIcon:null,open:e,width:520,centered:!0,className:"[&:[.ant-modal-content]]:bg-red",footer:R("div",{className:"mt-[16px] flex justify-end",children:[d(Xe,{children:"\u53D6\u6D88",onClick:r,className:"mr-[8px]"}),d(Xe,{children:"\u786E\u8BA4",onClick:async()=>{try{const s=await a.validateFields();t("ok_remove",s)}catch(s){console.log(s);return}},type:"primary",className:"border-none"})]}),children:d("div",{children:`\u786E\u5B9A\u8981\u5220\u9664\u4F1A\u8BDD\u300C${n.label}\u300D\u5417\uFF1F\u5220\u9664\u540E\u65E0\u6CD5\u6062\u590D\u3002`})})})};function Xs(e=Zn){return function({token:r,url:n="http://localhost:8888",styles:o,CSRFToken:a,eventsEmit:s,scrollOld:c,...p}){const m=Ae(()=>Kn({theme:or,mode:"light"},o),[o]),[y,v]=ue(!1),[x,w]=ue(!1),[C,i]=ue(null),[f,g]=ue([]),[h,E]=ue(1),[D]=ue(16),[b,A]=ue(0),[k,T]=ue(!1),[N,$]=ue([]),[_,H]=ue(void 0),[z,L]=ue([]),[M,Q]=ue([]),[U,V]=ue(void 0),[X,q]=ue(!1),[ee,Y]=ue({display:"ready",sender:"ready",app:"initializing"}),[j,K]=ue([]);function le(u,l){if(!l)return u;const I=Array.isArray(u)?[...u]:{...u};for(const S in l)l[S]!==void 0&&l[S]!==null&&Object.prototype.hasOwnProperty.call(l,S)&&(typeof u[S]=="object"&&u[S]!==null&&!Array.isArray(u[S])&&typeof l[S]=="object"&&l[S]!==null&&!Array.isArray(l[S])?I[S]=le(u[S],l[S]):I[S]=l[S]);return I}const[we,Ie]=ue(()=>le(Er,p.senderConfig));Se(()=>{p.senderConfig&&Ie(le(Er,p.senderConfig))},[p.senderConfig]);const[Ne,xe]=ue([]),[Be,_e]=ue(()=>({uploadedFiles:[]}));Se(()=>{if(!_)return;const u=N.find(S=>S.id===_);let l=[],I=!1;if(u&&u.messages){const S=[...u.messages||[]].reverse().find(B=>B.istype==="ai");if(S!=null&&S.reference&&S.resultType===5){I=!0;try{l=JSON.parse(S.reference).map(P=>ut(P))}catch{}}}I&&_e({uploadedFiles:l})},[N]),Se(()=>{_e({uploadedFiles:[]})},[_]);const[he,Qe]=Ge.useState(()=>{var l;if(!M||M.length===0)return;const u=M.find(I=>I.isDefault);return u?u.id:(l=M[0])==null?void 0:l.id});Ge.useEffect(()=>{if(!M||M.length===0)return;const u=M.some(l=>l.id===he);if(!he||!u){const l=M.find(I=>I.isDefault);Qe(l?l.id:M[0].id)}},[M]);const[Pe,Ze]=ue({}),ye=Le(void 0),qe=Le(void 0),ot=Le(void 0);Le({sessionId:""}),Le(null);const[lt,gt]=ue({}),[Bt,ht]=ue(!1),[Et,_t]=ue([]),Me=Le(!1),{api_startChat_re:yt,addEmptyMessage:Tt,setLastEmptyMessage:Pt,stopStream:vt}=bs({baseUrl:n,CSRFToken:a,token:r,setChatData:$,activeSessionId:_,setAppStatus:Y,setConversationList:g}),Te=Ae(()=>{const u={};return(M||[]).forEach(l=>{u[l.id]=l}),u},[M]),Z=Ae(()=>{const u=N.find(I=>I.id===_)||{id:_,messages:[]},l=u.configId?Te[u.configId]:null;return{...u,assistantInfo:l}},[N,_,Te]),ct=Ae(()=>{if(Z.configId&&Te){const u=Te[Z.configId];return u!=null&&u.configJson?JSON.parse(u.configJson).is_download:!1}else return!1},[Z.configId,Te]),bt=Ae(()=>{if((Z.configId||U)&&Te){const u=Te[Z.configId];if(u!=null&&u.configJson){const l=JSON.parse(u.configJson);return console.log("is_enableThinking",Z.configId,Te,U),!!l.thinking}else if(U){const l=Te[U];if(l!=null&&l.configJson)return!!JSON.parse(l.configJson).thinking}}return!1},[Z.configId,Te,U]);function Mt(u,l){const I=new Map;return u.forEach(S=>I.set(S.uid,ut(S))),l.forEach(S=>I.set(S.uid,ut(S))),Array.from(I.values())}function ut(u){if(!u||u.file&&u.file.name)return u;const l=u.name||u.fileName||"";return{...u,url:u.filePath||"",uid:u.uid||"",file:{name:l,size:typeof u.size=="string"&&u.size.endsWith("MB")?Number(u.size.replace("MB",""))*1024*1024:u.size||0,type:u.type||""},name:l}}Se(()=>{if(ye.current&&ye.current!==_){const l=ye.current,I=f.find(P=>P.sessionId===l&&P.isNew),S=N.find(P=>P.id===l&&P.isNew),B=S&&S.messages&&S.messages.length>0;I&&!B&&(g(P=>P.filter(se=>se.sessionId!==l)),$(P=>P.filter(se=>se.id!==l)))}ye.current=_;const u=Z.messages&&Z.messages.length>0?Z.messages[Z.messages.length-1].recommendQuestion:[];L(u)},[_,f,N,Z.messages]);const J=async u=>{var l,I,S,B;if(!k){T(!0);try{const P=await je.get(`${n}/qa/dialogue/list?pageNo=${u}&pageSize=${D}&sysType=INT_SESSION`,{headers:{Authorization:r}}),se=((I=(l=P==null?void 0:P.data)==null?void 0:l.data)==null?void 0:I.records)||[],G=((B=(S=P==null?void 0:P.data)==null?void 0:S.data)==null?void 0:B.total)||0;A(G),g(pe=>{const ge=new Map;return[...pe,...se].forEach(O=>{ge.set(O.sessionId,O)}),Array.from(ge.values())}),E(u)}catch{}finally{T(!1)}}};Se(()=>{Y(u=>({...u,app:"initializing"})),je.get(`${n}/qa/search/config/helper/list?pageNo=1&pageSize=3000`,{headers:{Authorization:r}}).then(u=>{Q(u.data.data||[])}).catch(()=>{}),J(1).then(()=>{_||St(),Y(u=>({...u,app:"ready"}))}).catch(()=>{Y(u=>({...u,app:"error"}))})},[n,r]),Se(()=>{_&&(Y(u=>({...u,display:"loading"})),je.get(`${n}/qa/dialogue/getDialogBySessionId?sessionId=${_}`,{headers:{Authorization:r}}).then(u=>{var Fe;const l={data:{data:{queryReplyPairList:[{query:{id:27665,gmtCreate:"2025-11-06T06:31:05.000+00:00",content:"\u63A7\u5236\u5668\u8D77\u4E0D\u6765\uFF08\u63A7\u5236\u5668\u53F3\u4E0A\u89D2RDY\u706F\u4E0D\u4EAE\uFF09",type:"text",queryId:"query-2532b3d4510867288e5ac5cb38338870",audioUrl:"",filePaths:null,currentFiles:null},reply:{id:27638,gmtCreate:"2025-11-06T06:31:15.000+00:00",content:`<think>
|
|
126
|
+
\u597D\u7684\uFF0C\u6211\u73B0\u5728\u9700\u8981\u56DE\u7B54\u7528\u6237\u7684\u95EE\u9898\uFF1A\u201C\u63A7\u5236\u5668\u8D77\u4E0D\u6765\uFF08\u63A7\u5236\u5668\u53F3\u4E0A\u89D2RDY\u706F\u4E0D\u4EAE\uFF09\u201D\u3002\u9996\u5148\uFF0C\u6211\u8981\u67E5\u770B\u63D0\u4F9B\u7684\u53C2\u8003\u8D44\u6599\uFF0C\u770B\u770B\u662F\u5426\u6709\u76F8\u5173\u4FE1\u606F\u3002
|
|
127
|
+
|
|
128
|
+
\u53C2\u8003\u8D44\u65990\u63D0\u5230\u4E86\u73B0\u8C61\u201C\u63A7\u5236\u5668\u8D77\u4E0D\u6765\uFF08\u63A7\u5236\u5668\u53F3\u4E0A\u89D2RDY\u706F\u4E0D\u4EAE\uFF09\u201D\uFF0C\u5E76\u5173\u8054\u5230\u201C\u5305\u542B\u201D\u548C\u201C\u4EA7\u751F\u201D\u5173\u7CFB\uFF0C\u4F46\u6CA1\u6709\u63D0\u4F9B\u5904\u7406\u65B9\u6CD5\u3002\u53C2\u8003\u8D44\u65991\u548C2\u90FD\u8BE6\u7EC6\u63CF\u8FF0\u4E86\u8FD9\u4E2A\u73B0\u8C61\uFF0C\u5E76\u4E14\u90FD\u7ED9\u51FA\u4E86\u5904\u7406\u65B9\u6CD5\uFF1A\u68C0\u67E5NT255\u6A21\u5757\u662F\u5426\u62A5\u7EA2\uFF0C\u66F4\u6362\u6A21\u5757\uFF0C\u5E76\u7279\u522B\u63D0\u5230\u673A\u8231\u68C0\u67E5FS211/N\u6A21\u5757\u3002\u8FD9\u4E9B\u5904\u7406\u65B9\u6CD5\u7684ID\u90FD\u662F10001\uFF0C\u8BF4\u660E\u662F\u540C\u4E00\u4E2A\u89E3\u51B3\u65B9\u6848\u3002
|
|
129
|
+
|
|
130
|
+
\u7528\u6237\u7684\u95EE\u9898\u6CA1\u6709\u6307\u5B9A\u7248\u672C\uFF0C\u6839\u636E\u89C4\u52192\uFF0C\u6211\u5E94\u8BE5\u4F7F\u7528\u6700\u65B0\u7684\u7248\u672C\u4FE1\u606F\u3002\u4E0D\u8FC7\uFF0C\u53C2\u8003\u8D44\u6599\u4E2D\u6CA1\u6709\u660E\u786E\u7684\u7248\u672C\u65E5\u671F\uFF0C\u6240\u4EE5\u53EA\u80FD\u5047\u8BBE\u5B83\u4EEC\u90FD\u662F\u6700\u65B0\u7684\u3002\u56E0\u6B64\uFF0C\u6211\u5E94\u8BE5\u7EFC\u5408\u6240\u6709\u53C2\u8003\u8D44\u6599\u7684\u4FE1\u606F\uFF0C\u63D0\u4F9B\u5904\u7406\u65B9\u6CD5\u3002
|
|
131
|
+
|
|
132
|
+
\u6700\u540E\uFF0C\u6211\u9700\u8981\u6309\u7167\u8981\u6C42\uFF0C\u7528\u7B80\u6D01\u7684\u8BED\u8A00\u56DE\u7B54\uFF0C\u5E76\u6807\u6CE8\u6765\u6E90\u3002\u7531\u4E8E\u5904\u7406\u65B9\u6CD5\u5728\u53C2\u8003\u8D44\u65991\u548C2\u4E2D\u90FD\u6709\uFF0C\u6211\u4F1A\u5F15\u7528\u8FD9\u4E24\u4E2A\u6765\u6E90\u3002
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
</think>
|
|
136
|
+
|
|
137
|
+
\u63A7\u5236\u5668\u8D77\u4E0D\u6765\uFF08\u63A7\u5236\u5668\u53F3\u4E0A\u89D2RDY\u706F\u4E0D\u4EAE\uFF09\u7684\u5904\u7406\u65B9\u6CD5\u5982\u4E0B\uFF1A
|
|
138
|
+
|
|
139
|
+
1. \u68C0\u67E5NT255\u6A21\u5757\u662F\u5426\u62A5\u7EA2\uFF08ERR\u706F\u662F\u5426\u4EAE\u7EA2\uFF09[retrive-tag id="2290607639633892359" image_urls="" fromType="2"][1][/retrive-tag][retrive-tag id="439368868506707299" image_urls="" fromType="2"][2][/retrive-tag]\u3002
|
|
140
|
+
2. \u66F4\u6362NT255\u6A21\u5757\uFF08\u6CE8\uFF1A\u673A\u8231\u68C0\u67E5FS211/N\u6A21\u5757\uFF09[retrive-tag id="2290607639633892359" image_urls="" fromType="2"][1][/retrive-tag][retrive-tag id="439368868506707299" image_urls="" fromType="2"][2][/retrive-tag]\u3002
|
|
141
|
+
|
|
142
|
+
\u8FD9\u4E9B\u6B65\u9AA4\u53EF\u4EE5\u5E2E\u52A9\u89E3\u51B3\u63A7\u5236\u5668\u65E0\u6CD5\u542F\u52A8\u7684\u95EE\u9898\u3002`,type:"text",reference:"[]",webReference:"[]",graphReference:'[{"cyphers":["match (n:`\u7EC4\u4EF6`)-[e]-(m) where id(n) == \\"\u7EC4\u4EF6101\\" return n,e,m;","match (n:`\u73B0\u8C61`)-[e]-(m) where id(n) == \\"\u73B0\u8C611001\\" return n,e,m;","match (n:`\u73B0\u8C61`)-[e]-(m) where id(n) == \\"\u73B0\u8C611001\\" return n,e,m;"],"fetchUrl":"https://10.160.33.150:30001/jinxin_graph/proxy/search/graph/search/cypherSearch4Rag","graphName":"\u6545\u969C\u5904\u7406\u56FE\u8C31","id":"1952195957278367755","traceNodes":[{"graphId":"1952195957278367755","id":"3484145002858895870","name":"\u63A7\u5236\u5668","nodeType":"\u7EC4\u4EF6","vid":"\u7EC4\u4EF6101"},{"graphId":"1952195957278367755","id":"2290607639633892359","name":"\u63A7\u5236\u5668\u8D77\u4E0D\u6765\uFF08\u63A7\u5236\u5668\u53F3\u4E0A\u89D2RDY\u706F\u4E0D\u4EAE\uFF09","nodeType":"\u73B0\u8C61","vid":"\u73B0\u8C611001"},{"graphId":"1952195957278367755","id":"439368868506707299","name":"\u63A7\u5236\u5668\u8D77\u4E0D\u6765\uFF08\u63A7\u5236\u5668\u53F3\u4E0A\u89D2RDY\u706F\u4E0D\u4EAE\uFF09","nodeType":"\u73B0\u8C61","vid":"\u73B0\u8C611001"}]}]',queryId:"query-2532b3d4510867288e5ac5cb38338870",feedbackResult:null,feedbackId:null,parsedFilePaths:null,recommendQuestion:'["\u5728\u68C0\u67E5NT255\u6A21\u5757\u65F6\uFF0CERR\u706F\u4EAE\u7EA2\u53EF\u80FD\u8868\u793A\u54EA\u4E9B\u5177\u4F53\u95EE\u9898\uFF1F","\u66F4\u6362NT255\u6A21\u5757\u65F6\u9700\u8981\u6CE8\u610F\u54EA\u4E9B\u6B65\u9AA4\u6216\u6CE8\u610F\u4E8B\u9879\uFF1F","\u9664\u4E86\u68C0\u67E5\u548C\u66F4\u6362NT255\u6A21\u5757\uFF0C\u8FD8\u6709\u54EA\u4E9B\u65B9\u6CD5\u53EF\u4EE5\u6392\u67E5\u63A7\u5236\u5668\u65E0\u6CD5\u542F\u52A8\u7684\u95EE\u9898\uFF1F"]',llmType:1,resultType:1,respTime:32453,tokens:824}}]}}};if(!l.data.data){Y(W=>({...W,display:"ready"}));return}const I=((Fe=l.data.data)==null?void 0:Fe.queryReplyPairList)||[],S=Za(I),{sessionId:B,searchConfigDTO:P,filePath:se,configId:G,reference:pe,webReference:ge,uploadedFiles:O,fileList:ce,currentFiles:ie}=u.data.data;if(S.length>0){const W=S.length-1-[...S].reverse().findIndex(oe=>oe.istype==="ai");W>=0&&W<S.length&&S[W].istype==="ai"&&(pe&&(S[W].reference=pe),ge&&(S[W].webReference=ge))}const me=ie||ce||O;if(me&&S.length>0){const W=[...S].reverse().findIndex(oe=>oe.istype==="user");W!==-1&&(console.log(S[S.length-1-W].currentFiles,"filesData"),S[S.length-1-W].currentFiles=me)}f.find(W=>W.sessionId===B)&&g(W=>W.map(oe=>oe.sessionId===B?{...oe,searchConfigDTO:P,filePath:se,configId:G}:oe));const ke={configId:u.data.data.configId,filePath:u.data.data.filePath,searchConfigDTO:u.data.data.searchConfigDTO||{},sessionId:u.data.data.sessionId,label:u.data.data.label,kbId:u.data.data.kbId};$(W=>{const oe=W.filter(fe=>fe.id!==_);return[{id:_,messages:S,...ke},...oe]}),Y(W=>({...W,display:"ready"}))}).catch(u=>{console.error("\u83B7\u53D6\u804A\u5929\u6570\u636E\u5931\u8D25:",u),u.response&&u.response.status===404&&St(),Y(l=>({...l,display:"error"}))}))},[_,n,r]),Se(()=>{const u=Be.uploadedFiles.length;Ie(l=>{const I=Array.isArray(l.actions)?l.actions:[];return{...l,actions:I.map(B=>B.name==="history"?{...B,badgeCount:u}:B)}})},[Be.uploadedFiles]),Se(()=>{es({url:n,token:r},u=>{_t(u)})},[]),Ge.useEffect(()=>{Ne.length&&$(u=>{if(!u[0])return u;const{messages:l}=u[0];for(let I=l.length-1;I>=0;I--)if(l[I].istype==="user"){const S=l[I].currentFiles||[];l[I].currentFiles=Ne.map(B=>{var se,G,pe;const P=S.find(ge=>ge.uid===B.uid);return{name:((se=B.file)==null?void 0:se.name)||B.name,size:((G=B.file)==null?void 0:G.size)||B.size,type:((pe=B.file)==null?void 0:pe.type)||B.type,status:B.status,uid:B.uid,url:B.url||(P==null?void 0:P.url)||""}});break}return[...u]})},[Ne]);let ne=null,de=null;const te=(u,l,I,S)=>{const B=u.join(",");let P=0;de=()=>{Me.current=!0};const se=async()=>{if(!Me.current){if(P>=As){Me.current||S("\u6587\u4EF6\u89E3\u6790\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");return}P++;try{const G=await je.get(`${n}/index/knowledgeBase/file/getFileStatusByUids?uids=${B}`,{headers:{Authorization:r}});if(Me.current)return;if(G.data.success){const pe=G.data.data;Me.current||l(pe),pe.every(O=>O.status===3)?Me.current||I():Me.current||setTimeout(se,Ns)}else Me.current||S(G.data.errorMsg||"\u67E5\u8BE2\u6587\u4EF6\u72B6\u6001\u5931\u8D25")}catch{if(Me.current)return;S("\u67E5\u8BE2\u6587\u4EF6\u72B6\u6001\u65F6\u53D1\u751F\u7F51\u7EDC\u9519\u8BEF")}}};se()},ae=(u,l)=>{$(I=>{const S=[...I];return S[0]&&(S[0]={...S[0],messages:S[0].messages.map(B=>B.queryId===u?{...B,feedbackResult:l}:B)}),S})},De=async u=>{var l,I;if(u)try{const S=(Z==null?void 0:Z.configId)||((l=Te==null?void 0:Te[(Z==null?void 0:Z.configId)||""])==null?void 0:l.id)||"",B=await je.get(`${n}/qa/ai/recommendQuestion?queryId=${u}&configId=${S||""}`.replace(/\?&/,"?"),{headers:{Authorization:r}});L(((I=B.data)==null?void 0:I.data)||[])}catch{L([])}};function Ke(u){const{content:l,audioUrl:I,filePaths:S,queryId:B}=u;if(!_||!B)return;const P=(Z==null?void 0:Z.messages)||[],se=P.findIndex(ie=>(ie==null?void 0:ie.queryId)===B&&((ie==null?void 0:ie.istype)==="ai"||(ie==null?void 0:ie.isUser)===!1));let G;if(se>0)for(let ie=se-1;ie>=0;ie-=1){const me=P[ie];if((me==null?void 0:me.istype)==="user"||(me==null?void 0:me.isUser)===!0){G=me;break}}const pe=(G==null?void 0:G.content)??l;if(!pe)return;const ge=(G==null?void 0:G.filePaths)??S,O=(typeof ge=="string"&&ge?JSON.parse(ge):ge||[]).map(ie=>ie.uid),ce=Date.now();Pt({now:ce}),Y(ie=>({...ie,display:"processing",sender:"processing"})),u.clearFn&&u.clearFn(),g(ie=>ie.map(me=>me.sessionId===_?{...me,gmtModified:ce}:me)),yt({configId:Z.configId,content:pe,fileUids:O,lastDate:ce,name:Z.label||"",queryId:B,sessionId:String(_||""),type:(G==null?void 0:G.audioUrl)??I?"audioUrl":"text",audioUrl:((G==null?void 0:G.audioUrl)??I)||"",enableThinking:!!Pe.reasoning,enableWebsearch:!!Pe.netSearch,qaChannel:Pe.qaChannel},ie=>{De(B)})}async function Ue(u,l){if(!_)return;const I=f.find(S=>S.sessionId===_);if(I&&I.isNew){let S=!1;const B=U||I.configId,P=u&&u.content?u.content.slice(0,20):I.label||"\u672A\u547D\u540D\u4F1A\u8BDD";if(await new Promise((se,G)=>{ns({url:n,token:r,CSRFToken:a},{label:P,sessionId:I.sessionId,sysType:"INT_SESSION",configId:B},pe=>{pe&&pe.data&&pe.data.sessionId?(g(ge=>ge.map(O=>O.sessionId===I.sessionId?{...O,isNew:!1,configId:B,label:P}:O)),$(ge=>ge.map(O=>O.id===I.sessionId?{...O,isNew:!1,configId:B,label:P}:O)),S=!0,se()):(be.error("\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),G())})}),!S)return;We(_,u,l,B);return}We(_,u,l)}function We(u,l,I,S){const B="query-"+it(32),P=f.find(O=>O.sessionId===u),se=S||(P==null?void 0:P.configId)||Z.configId;console.log("\u52A9\u624B\u914D\u7F6E\u8BE6\u60C5",se);const G=l&&l.content?l.content.slice(0,20):"\u672A\u547D\u540D\u4F1A\u8BDD";let pe;if(l.files&&l.files.length>0&&(pe=l.files.map(O=>({name:O.file.name,size:O.file.size,type:O.file.type,filePath:O.filePath||"",convertedFilePath:O.convertedFilePath||"",uid:O.uid||""}))),console.log("\u672C\u5730\u6587\u4EF6\u4E0A\u4F20",l.files),Tt({content:l.content||l.text||"",queryId:B,currentFiles:pe,filePaths:pe?JSON.stringify(pe):void 0}),g(O=>O.map(ce=>ce.sessionId===u&&ce.label==="\u672A\u547D\u540D\u4F1A\u8BDD"&&ce.isNew?{...ce,label:G,gmtModified:Date.now(),isNew:!1}:ce)),$(O=>O.map(ce=>ce.id===u&&ce.label==="\u672A\u547D\u540D\u4F1A\u8BDD"&&ce.isNew?{...ce,label:G,isNew:!1}:ce)),l.files&&l.files.length>0){Y(re=>({...re,sender:"uploading",display:"uploading"})),ne=new AbortController,Me.current=!1;const O=l.files.map(()=>`rc-upload-${Date.now()}-${Math.random().toString(36).slice(2)}`),ce=l.files.map((re,ke)=>({...re,uid:O[ke],status:"uploading"}));xe(ce);const ie=new FormData;l.files.forEach(re=>{ie.append("files",re.file)});const me=String(u||"");ie.append("sessionId",me),ie.append("uids",O.join(",")),je.post(`${n}/index/knowledgeBase/file/uploadFiles`,ie,{headers:{Authorization:r,"Content-Type":"multipart/form-data"},signal:ne.signal}).then(re=>{if(console.log("\u6587\u4EF6\u4E0A\u4F20\u7684\u6253\u5370\u7ED3\u679C",re),!Me.current)if(re.data.success&&Array.isArray(re.data.data)&&re.data.data.length>0){xe(W=>W.map(oe=>{const ve=re.data.data.find(fe=>fe.uid===oe.uid);return ve?{...oe,...ve}:oe})),Y(W=>({...W,sender:"processing",display:"analyzing"})),xe(W=>W.map(oe=>({...oe,status:"parsing"})));const ke=re.data.data,Fe=ke.map(W=>W.uid);te(Fe,W=>{if(xe(ve=>ve.map(fe=>{const st=W.find(et=>et.uid===fe.uid);if(st)switch(st.status){case 3:return{...fe,status:"done"};case 4:return{...fe,status:"error"};case 1:case 2:default:return{...fe,status:"parsing"}}return fe})),W.length>0&&W.every(ve=>ve.status===3)){xe([]);const ve=new Map;(W||[]).forEach(fe=>{ve.set(fe.id,fe)}),_e(fe=>({uploadedFiles:Mt(fe.uploadedFiles,ke).map(et=>{var xt;return{...et,pdfPages:((xt=ve.get(et.id))==null?void 0:xt.pdfPages)||0}})}))}},()=>{I==null||I(),Y(oe=>({...oe,sender:"processing",display:"processing"})),xe(oe=>oe.map(ve=>{const fe=ke.find(st=>st.uid===ve.uid);return fe?{...ve,...fe,url:fe.filePath,filePath:fe.filePath,name:fe.fileName||ve.name,convertedFilePath:fe.convertedFilePath||ve.convertedFilePath}:ve})),$(oe=>{if(!oe[0])return oe;const{messages:ve}=oe[0];for(let fe=ve.length-1;fe>=0;fe--)if(ve[fe].istype==="user"){const st=ve[fe].currentFiles||[];ve[fe].currentFiles=st.map(et=>{const xt=ke.find(In=>In.uid===et.uid);return xt?{...et,...xt}:et});break}return[...oe]});const W=Date.now();yt({configId:se,content:l.content||l.text||"",fileUids:Fe,lastDate:W,name:G,queryId:B,sessionId:String(u||""),type:"text",audioUrl:"",enableThinking:!!Pe.reasoning,enableWebsearch:!!Pe.netSearch,qaChannel:Pe.qaChannel},oe=>{De(B)})},W=>{Y(oe=>({...oe,display:"ready",sender:"ready"})),xe(oe=>oe.map(ve=>({...ve,status:"error",message:W})))})}else{const ke=re.data.errorMsg||"\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25";Y(Fe=>({...Fe,display:"error",sender:"ready"})),xe(Fe=>Fe.map(W=>({...W,status:"error",message:ke})))}}).catch(re=>{var ke,Fe;((ke=re==null?void 0:re.response)==null?void 0:ke.status)===413?(Fe=re==null?void 0:re.response)!=null&&Fe.statusText.includes("Request Entity Too Large")&&be.error("\u6587\u4EF6\u8D85\u8FC7\u6700\u5927\u53EF\u4E0A\u4F20\u9650\u5236"):be.error("\u7F51\u7EDC\u9519\u8BEF"),Y(W=>({...W,display:"error",sender:"ready"})),xe(W=>W.map(oe=>({...oe,status:"error",message:"\u7F51\u7EDC\u9519\u8BEF"})))});return}Y(O=>({...O,display:"processing",sender:"processing"}));const ge=Date.now();g(O=>O.map(ce=>ce.sessionId===u?{...ce,gmtModified:ge}:ce)),I==null||I(),yt({configId:se,content:l.content||l.text||"",fileUids:[],lastDate:ge,name:G,queryId:B,sessionId:String(u||""),type:"text",audioUrl:"",enableThinking:!!Pe.reasoning,enableWebsearch:!!Pe.netSearch,qaChannel:Pe.qaChannel},O=>{De(B)})}function jt(u){u.restult==1?Jt({url:n,token:r,CSRFToken:a},{queryId:u.queryId},()=>{ae(u.queryId,null)}):Or({url:n,token:r,CSRFToken:a},{restult:1,queryId:u.queryId},()=>{ae(u.queryId,1)})}function St(u){const l=it(32),I={sessionId:l,label:"\u672A\u547D\u540D\u4F1A\u8BDD",gmtModified:Date.now(),searchConfigDTO:{},filePath:"",configId:"",isNew:!0};g(S=>[{...I,messages:[]},...S]),$(S=>[{id:l,messages:[],...I},...S]),H(l)}const fn=u=>{var B;const l=new Set([...Be.uploadedFiles.map(P=>P.file.name),...j.map(P=>P.file.name)]),I=[],S=new Set;Array.from(u).forEach(P=>{l.has(P.name)?S.add(P.name):(I.push({file:P,type:kr(P.name),status:"pending",preview:P.type.startsWith("image")?URL.createObjectURL(P):void 0}),l.add(P.name))}),S.size>0&&be.warning(`\u4E0D\u80FD\u4E0A\u4F20\u540C\u540D\u6587\u4EF6: ${Array.from(S).join(", ")}`),I.length>0&&(K(P=>[...P,...I]),(B=qe.current)==null||B.call(qe,I))},mn=(u,l,I)=>{var S;(S=ot.current)==null||S.call(ot,u,l,I)};function gn(u){if(u!=null&&u.sessionId&&u.sessionId!==_){H(u.sessionId),Y(I=>({...I,sender:"ready"}));const l=N.find(I=>I.id===u.sessionId);if(l&&l.messages&&l.messages.length>0){const I=[...l.messages].reverse().find(S=>S.istype==="ai");I&&I.recommendQuestion?L(I.recommendQuestion):L([])}else L([])}}const hn=async u=>new Promise((l,I)=>{rs({url:n,token:r,CSRFToken:a},{sessionId:u},S=>{S?(be.success("\u5220\u9664\u6210\u529F!"),l(S)):(be.error("\u5220\u9664\u5931\u8D25!"),I(S))})}),yn=async()=>{try{return g([]),A(0),await J(1),[]}catch(u){throw be.error("\u5237\u65B0\u4F1A\u8BDD\u5217\u8868\u5931\u8D25"),u}},vn=async(u,l)=>new Promise((I,S)=>{ts({url:n,token:r,CSRFToken:a},{label:l,sessionId:u},B=>{if(B){const P=Date.now();g(se=>se.map(G=>G.sessionId===u?{...G,label:l,gmtModified:P}:G)),be.success("\u91CD\u547D\u540D\u6210\u529F!"),I(B)}else be.error("\u91CD\u547D\u540D\u5931\u8D25"),S(B)})}),bn=u=>{g(l=>{const I=l.filter(S=>S.sessionId!==u);return _===u&&(I.length>0?H(I[0].sessionId):St()),I})},xn=(u,l)=>{const I=Date.now();g(S=>S.map(B=>B.sessionId===u?{...B,label:l,gmtModified:I}:B))},Fn=u=>{Or({url:n,token:r,CSRFToken:a},{...u,...lt,restult:0},()=>{ae(lt.queryId,0)})},Cn=u=>{const l=u.new_name,I=C.data.label;l&&l!==I?C.async_renameConversation(l).then(()=>{C.fn_renameItemInList(l),v(!1)}).catch(()=>{}):v(!1)},wn=u=>{C.async_deleteConversation().then(()=>{C.fn_removeItemFromList(),w(!1)}).catch(()=>{})},Dt=(u,l)=>{switch(console.log(u,l),u){case"close_remove":w(!1);break;case"close_rename":v(!1);break;case"ok_rename":Cn(l);break;case"ok_remove":wn();break}},En=async({url:u,params:l,replacePredataFunction:I})=>{var S,B;try{const P=await je.post(u,l,{headers:{Authorization:r}}),se=(B=(S=P==null?void 0:P.data)==null?void 0:S.data)==null?void 0:B.data;se&&I(se)}catch(P){console.log("error",P)}},at=(u,l)=>{var I,S,B;switch(console.log(`[Event] ${u}`,l),u){case"conversations:load_more":{f.length<b&&!k&&J(h+1);break}case"retrieve-sql-data:pagingation_click":const{page:P,pageSize:se,fetchUrl:G,source:pe,replacePredataFunction:ge}=l;En({url:`${n}${G}`,replacePredataFunction:ge,params:{pageNo:P,pageSize:se,convertedFilePath:pe,stream:!1}});break;case"web_referenceFile_title:click":if(!((I=l==null?void 0:l.data)!=null&&I.link))return console.error("\u6CA1\u6709\u7F51\u9875\u5730\u5740");window.open(l.data.link,"_blank");break;case"conversation:item_click":gn(l);break;case"files:finished_animation_complete":xe([]);break;case"conversation:create":St();break;case"conversation:new_assistant_change":V(l.assistantId);break;case"conversations:rename_icon_clicked":i({data:l,async_renameConversation:O=>vn(l.sessionId,O),fn_renameItemInList:O=>xn(l.sessionId,O)}),v(!0);break;case"conversations:delete_icon_clicked":i({data:l,async_deleteConversation:()=>hn(l.sessionId),async_refreshConversationList:yn,fn_removeItemFromList:()=>bn(l.sessionId)}),w(!0);break;case"sender:send":Ue(l,l.clearFn);break;case"sender:send_recommandQuestion":{const O=((l==null?void 0:l.content)??"").toString();if(!O)break;Ue({content:O},()=>{});break}case"chatbox:follow_up_question_click":{const O=((l==null?void 0:l.question)??(l==null?void 0:l.content)??"").toString();if(!O)break;Ue({content:O},()=>{});break}case"sender:action_history":q(!0);break;case"sender:stop":Me.current=!0,ne&&(ne.abort(),ne=null),de&&(de(),de=null),Y(O=>({...O,display:"ready",sender:"ready"})),xe([]),vt==null||vt();break;case"sender:clear":(S=l.clearFn)==null||S.call(l);break;case"sender:configChange":l&&l.all&&Ze(l.all);break;case"action_copy:click":l&&Qa(l.content,l.event);break;case"chatbox:copy":{const O=(l==null?void 0:l.content)||"";if(!O)break;const ce=async me=>{try{return await navigator.clipboard.writeText(me),be.success("\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F"),!0}catch{return!1}},ie=me=>{const re=document.createElement("textarea");re.value=me,re.style.position="fixed",re.style.opacity="0",document.body.appendChild(re),re.focus(),re.select();try{document.execCommand("copy"),be.success("\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F")}catch{be.error("\u590D\u5236\u5931\u8D25")}document.body.removeChild(re)};ce(O).then(me=>{me||ie(O)});break}case"chatbox:repeat":console.log(l,"sdkflskdjflksdjfklsdjlfkjsdklfjsdklfjlks"),Ke(l);break;case"action_thumbsup":jt(l);break;case"chatbox:like":jt({queryId:l==null?void 0:l.queryId,restult:l==null?void 0:l.result});break;case"action_thumbsdown":l.restult===0?Jt({url:n,token:r,CSRFToken:a},{queryId:l.queryId},()=>{ae(l.queryId,null)}):(gt(l),ht(!0));break;case"chatbox:dislike":(l==null?void 0:l.result)===0?Jt({url:n,token:r,CSRFToken:a},{queryId:l.queryId},()=>{ae(l.queryId,null)}):(gt({queryId:l==null?void 0:l.queryId}),ht(!0));break;case"action_retrive_tag":s==null||s("action_retrive_tag",l);break;case"referenceFile_view":s==null||s("referenceFile_view",l);break;case"referenceFile_question":console.log(l,"zhezhhzhzh"),s==null||s("referenceFile_question",l);break;case"referenceFile_download":s==null||s("referenceFile_download",l);break;case"retrive_tag:click":s==null||s("retrive_tag:click",l);break;case"fileManager:change":{const O=Array.isArray(l==null?void 0:l.uploadedFiles)?l.uploadedFiles:[];K(O),typeof(l==null?void 0:l.setUploadedFiles)=="function"&&(qe.current=l.setUploadedFiles,ot.current=l.removeFile);break}case"uploaded_file:removeFromTemp":{console.log("[DEBUG] mergedEventsEmit uploaded_file:removeFromTemp \u4E8B\u4EF6",l);const O=(B=l==null?void 0:l.file)==null?void 0:B.uid;if(!O){console.warn("[DEBUG] \u7F3A\u5C11uid\uFF0C\u65E0\u6CD5\u5220\u9664\u4E34\u65F6\u6587\u4EF6",l);break}const ce=[...Z.messages||[]].reverse().find(me=>me.istype==="user"),ie=ce==null?void 0:ce.queryId;os({url:n,token:r,CSRFToken:a},{uid:O,queryId:ie},(me,re)=>{if(me){if(be.success("\u6587\u4EF6\u5DF2\u4ECE\u4E34\u65F6\u77E5\u8BC6\u5E93\u79FB\u9664"),re&&Array.isArray(re.data&&re.data.data)){const ke=re.data.data.map(Fe=>{var oe;const W=Fe.name||Fe.fileName||"";return{file:{name:W,size:Number((oe=Fe.size)==null?void 0:oe.replace("MB",""))*1024*1024||0,type:Fe.type},type:kr(W),status:"uploaded",url:Fe.filePath,convertedFilePath:Fe.convertedFilePath,uid:Fe.uid,preview:Fe.type==="image"?Fe.filePath:void 0}});_e({uploadedFiles:ke})}}else console.log("[DEBUG] removeFilefromTempUpload \u56DE\u8C03 false\uFF0Cres:",re),be.error("\u6587\u4EF6\u79FB\u9664\u5931\u8D25")});break}case"uploaded_file:remove_batch":break;default:s==null||s(u,l)}},Sn=[{key:"conversations",type:"custom",label:"\u5BF9\u8BDD\u5386\u53F2",icon:d(lo,{size:16}),enabled:!0,component:d(Ya,{data:f,assistantList:M,activedItem:_||"",hasMore:f.length<b,loadingMore:k,sortRules:[{label:"\u5F53\u5929",dayPeriod:1},{label:"3\u5929",dayPeriod:3},{label:"7\u5929",dayPeriod:7},{label:"30\u5929",dayPeriod:30}],eventsEmit:at,styles:m.theme})}],lr=Ge.useMemo(()=>()=>d(us,{eventsEmit:at,assistantList:M,styles:m,selectedId:he,onSelectAssistant:Qe,productLogo:p==null?void 0:p.productLogo}),[he]),Dn={...Ge.useMemo(()=>({AiChatBox:(u,l)=>{var pe,ge;const I=l===(((pe=Z==null?void 0:Z.messages)==null?void 0:pe.length)||0)-1;let S="ready";if(I)if(u.status!==void 0)switch(u.status){case 0:S="thinking";break;case 1:S="processing";break;case 2:S="ready";break;case 3:S="error";break;default:S=ee.display}else S=ee.display;let B=[];if(Array.isArray(z))B=z;else if(typeof z=="string")try{B=JSON.parse(z)||[]}catch{B=[]}const P=(()=>{const O=u==null?void 0:u.reference;if(!O)return"[]";if(typeof O=="string")try{return JSON.parse(O),O}catch{return"[]"}try{return JSON.stringify(O)}catch{return"[]"}})(),se=(()=>{const O=u==null?void 0:u.webReference;if(!O)return"[]";if(typeof O=="string")try{return JSON.parse(O),O}catch{return"[]"}try{return JSON.stringify(O)}catch{return"[]"}})(),G=(()=>{const O=u==null?void 0:u.graphReference;if(!O)return"[]";if(typeof O=="string")try{return JSON.parse(O),O}catch{return"[]"}try{return JSON.stringify(O)}catch{return"[]"}})();return d(mr,{...u,reference:P,webReference:se,graphReference:G,contentType:"stream",displayStatus:S,eventsEmit:at,isLast:I&&(u==null?void 0:u.istype)==="ai",followUpQuestions:I&&(u==null?void 0:u.istype)==="ai"?B:[],defaultAnswer:((ge=Z==null?void 0:Z.searchConfigDTO)==null?void 0:ge.defaultAnswer)||"\u4E0D\u77E5\u9053\u4EC0\u4E48\u539F\u56E0\u6211\u4EEC\u6CA1\u80FD\u67E5\u5230\u4F60\u8981\u7684\u95EE\u9898*-*",is_download:ct,styles:m},`${(u==null?void 0:u.queryId)||(u==null?void 0:u.id)||l}-${(u==null?void 0:u.istype)||"unknown"}`)},LogoBox:u=>u&&u.LogoBox===null?null:u&&typeof u.LogoBox=="function"?d(u.LogoBox,{}):d("div",{className:"text-2xl w-full text-center font-bold",children:"\u5C0F\u9CB8\u667A\u80FD\u52A9\u624B"}),DisplayLoading:()=>d(Ds,{}),DisplayError:()=>d($s,{}),AppError:()=>d(Is,{msg:"\u5E94\u7528\u521D\u59CB\u5316\u5931\u8D25",subMsg:"\u65E0\u6CD5\u5B8C\u6210\u5E94\u7528\u521D\u59CB\u5316\uFF0C\u8FD9\u53EF\u80FD\u662F\u7531\u4E8E\u7F51\u7EDC\u8FDE\u63A5\u95EE\u9898\u6216\u670D\u52A1\u914D\u7F6E\u9519\u8BEF\u5BFC\u81F4\u7684\u3002\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u5E76\u91CD\u8BD5\u3002"}),AppLoading:()=>{var u,l;return d(eo,{title:(u=p==null?void 0:p.appLoadingConfig)==null?void 0:u.title,subtitle:((l=p==null?void 0:p.appLoadingConfig)==null?void 0:l.subtitle)||""})},UserChatBox:(u,l)=>d(mr,{...u,contentType:"plainText",isUser:!0,displayStatus:"ready",eventsEmit:at,styles:m,fileManagerData:Be},`${(u==null?void 0:u.queryId)||(u==null?void 0:u.id)||l}-user`),WelcomeComponent:lr}),[lr,Z,ee.display,at,m,ct,Be]),...p.CustomComponents||{}};return Se(()=>{Ie(u=>{const l=Array.isArray(u.switchs)?u.switchs.map(I=>I.name==="reasoning"?{...I,enabled:bt}:I):[];return{...u,switchs:l}})},[bt]),R($n,{children:[d(Ss,{open:X,onCancel:()=>q(!1),files:Be.uploadedFiles,currentFiles:j,onUpload:fn,onRemoveFile:mn,styles:m,eventsEmit:at}),d(e,{...p,status:ee,chatData:Z,sidebar:Sn,recommandQuestions:[],eventsEmit:at,styles:m,senderConfig:we,fileUploadStatus:Ne,CustomComponents:Dn,activeSessionId:_,scrollOld:c}),d(to,{open:Bt,feedBackList:Et,setOpen:ht,handleConfirm:Fn}),d(ks,{isModalOpen:y,handleOk:Dt,handleCancel:()=>Dt("close_rename"),data:(C==null?void 0:C.data)||{}}),d(Os,{isModalOpen:x,handleOk:Dt,handleCancel:()=>Dt("close_remove"),data:(C==null?void 0:C.data)||{}})]})}}export{Xs as default};
|
package/dist/database.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{jsxs as L,jsx as n,Fragment as de}from"react/jsx-runtime";import{useState as F,useMemo as W,useRef as q,useEffect as De}from"react";import{a as me,J as R,T as be,a4 as ye,a5 as Fe,m as Ie}from"./assets/index-D1m34Ij7.js";import{M as $}from"./assets/index-_gBtdXQV.js";/* empty css */import{M as K,s as J}from"./assets/index-BpJ9Bm5x.js";import"react-dom";const Ee=({url:m,token:v,role:B,eventsEmit:E})=>{const c=me.create({baseURL:m,timeout:1e6});return c.interceptors.request.use(e=>{let t=v;return!t&&!["user/login","user/kaptcha","user/regist"].some(u=>e.url.includes(u))?(E&&E("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=t||"",e.headers.userName=B==="\u672A\u767B\u5F55\u7528\u6237"?"":B,e)}),c.interceptors.response.use(e=>{const t=["user/kaptcha"],i=e.data;if(t.some(g=>e.config.url&&e.config.url.includes(g))||i.size&&i.type)return i;const{success:u,errorMsg:b,errorCode:D}=i;return u?i:(E&&E("request:error_business",{errorCode:D,errorMsg:b||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:i}),!1)},async e=>{var t,i,u,b,D,g,C,h,w;if(e.message==="canceled")return Promise.reject(e);if(E){let d="request:error_network",j={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((t=e==null?void 0:e.response)==null?void 0:t.status)===401?(d="request:error_auth",j={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((u=(i=e==null?void 0:e.response)==null?void 0:i.data)==null?void 0:u.errorCode)==="30013"||((D=(b=e==null?void 0:e.response)==null?void 0:b.data)==null?void 0:D.errorCode)==="30023")&&(d="request:error_business",j={errorCode:(C=(g=e==null?void 0:e.response)==null?void 0:g.data)==null?void 0:C.errorCode,errorMsg:((w=(h=e==null?void 0:e.response)==null?void 0:h.data)==null?void 0:w.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),E(d,j)}return console.log("Error occurs",e),Promise.reject(e)}),{getDatabaseList:async e=>{try{const t=await c.get(`/queryPageDBList?${new URLSearchParams(e).toString()}`),{success:i,data:u}=t;if(i)return u}catch(t){console.log("getDatabaseList error:",t)}},getShareDatabaseList:async e=>{try{const t=await c.get(`/queryShareDBList?${new URLSearchParams(e).toString()}`),{success:i,data:u}=t;if(i)return u}catch(t){console.log("getShareDatabaseList error:",t)}},delDatabaseById:async(e,t)=>{const i=O(t);try{const u=await c.delete(`/${i}/deleteDB/${e}`),{success:b,data:D}=u;if(b)return D}catch(u){console.log("delDatabaseById error:",u)}},saveDatabase:async(e,t)=>{const i=O(t);try{const u=await c.post(`/${i}/saveDBInfo`,e),{success:b,data:D}=u;if(b)return D}catch(u){console.log("saveDatabase error:",u)}},testConnection:async e=>{try{const t=await c.post("/directDB/testConnect",e),{success:i,data:u}=t;if(i)return u}catch(t){console.log("testConnection error:",t)}},syncSchema:async e=>{try{const t=await c.get(`/directDB/syncSchema/${e}`),{success:i,data:u}=t;if(i)return u}catch(t){console.log("syncSchema error:",t)}}}},O=m=>m=="DataTable"?"dataTable":"directDB",ge="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAzNiAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xNCAxMkMxNCAxMC44OTU0IDE0Ljg5NTQgMTAgMTYgMTBIMjlDMzEuMjA5MSAxMCAzMyAxMS43OTA5IDMzIDE0VjI2QzMzIDMwLjQxODMgMjkuNDE4MyAzNCAyNSAzNEgxNkMxNC44OTU0IDM0IDE0IDMzLjEwNDYgMTQgMzJWMTJaIiBmaWxsPSJ1cmwoI3BhaW50MF9saW5lYXJfNDQ3Ml8xODA1MikiLz4NCjxmb3JlaWduT2JqZWN0IHg9Ii0xIiB5PSItMSIgd2lkdGg9IjMyIiBoZWlnaHQ9IjM2Ij48ZGl2IHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIiBzdHlsZT0iYmFja2Ryb3AtZmlsdGVyOmJsdXIoMnB4KTtjbGlwLXBhdGg6dXJsKCNiZ2JsdXJfMF80NDcyXzE4MDUyX2NsaXBfcGF0aCk7aGVpZ2h0OjEwMCU7d2lkdGg6MTAwJSI+PC9kaXY+PC9mb3JlaWduT2JqZWN0PjxnIGRhdGEtZmlnbWEtYmctYmx1ci1yYWRpdXM9IjQiPg0KPHBhdGggZD0iTTMgN0MzIDQuNzkwODYgNC43OTA4NiAzIDcgM0gyM0MyNS4yMDkxIDMgMjcgNC43OTA4NiAyNyA3VjE5QzI3IDI1LjYyNzQgMjEuNjI3NCAzMSAxNSAzMUg3QzQuNzkwODYgMzEgMyAyOS4yMDkxIDMgMjdWN1oiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNDYiLz4NCjxwYXRoIGQ9Ik03IDMuMjVIMjNDMjUuMDcxMSAzLjI1IDI2Ljc1IDQuOTI4OTMgMjYuNzUgN1YxOUMyNi43NSAyNS40ODkzIDIxLjQ4OTMgMzAuNzUgMTUgMzAuNzVIN0M0LjkyODkzIDMwLjc1IDMuMjUgMjkuMDcxMSAzLjI1IDI3VjdDMy4yNSA0LjkyODkzIDQuOTI4OTMgMy4yNSA3IDMuMjVaIiBzdHJva2U9IndoaXRlIiBzdHJva2Utb3BhY2l0eT0iMC4zNCIgc3Ryb2tlLXdpZHRoPSIwLjUiLz4NCjwvZz4NCjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIxX2RfNDQ3Ml8xODA1MikiPg0KPHBhdGggZD0iTTE0IDE5VjExLjY2NjciIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS44Mzk3MiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+DQo8cGF0aCBkPSJNMTEgMTRMMTIgMTNMMTQgMTFMMTYgMTNMMTcgMTQiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+DQo8cGF0aCBkPSJNMTAgMjJIMTgiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+DQo8L2c+DQo8ZGVmcz4NCjxjbGlwUGF0aCBpZD0iYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPjxwYXRoIGQ9Ik0zIDdDMyA0Ljc5MDg2IDQuNzkwODYgMyA3IDNIMjNDMjUuMjA5MSAzIDI3IDQuNzkwODYgMjcgN1YxOUMyNyAyNS42Mjc0IDIxLjYyNzQgMzEgMTUgMzFIN0M0Ljc5MDg2IDMxIDMgMjkuMjA5MSAzIDI3VjdaIi8+DQo8L2NsaXBQYXRoPjxmaWx0ZXIgaWQ9ImZpbHRlcjFfZF80NDcyXzE4MDUyIiB4PSI1IiB5PSI2IiB3aWR0aD0iMTgiIGhlaWdodD0iMjEiIGZpbHRlclVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj4NCjxmZUZsb29kIGZsb29kLW9wYWNpdHk9IjAiIHJlc3VsdD0iQmFja2dyb3VuZEltYWdlRml4Ii8+DQo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4NCjxmZU9mZnNldC8+DQo8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIyIi8+DQo8ZmVDb21wb3NpdGUgaW4yPSJoYXJkQWxwaGEiIG9wZXJhdG9yPSJvdXQiLz4NCjxmZUNvbG9yTWF0cml4IHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwLjM5NjA3OCAwIDAgMCAwIDAuOTg0MzE0IDAgMCAwIDAuNCAwIi8+DQo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iQmFja2dyb3VuZEltYWdlRml4IiByZXN1bHQ9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIi8+DQo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluPSJTb3VyY2VHcmFwaGljIiBpbjI9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIiByZXN1bHQ9InNoYXBlIi8+DQo8L2ZpbHRlcj4NCjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl80NDcyXzE4MDUyIiB4MT0iMjMuNSIgeTE9IjEwIiB4Mj0iMjMuNSIgeTI9IjM0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+DQo8c3RvcCBzdG9wLWNvbG9yPSIjNjRBMEZEIi8+DQo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMwMTVBRkYiLz4NCjwvbGluZWFyR3JhZGllbnQ+DQo8L2RlZnM+DQo8L3N2Zz4NCg==",Me=""+new URL("assets/database_connect.svg",import.meta.url).href,pe=""+new URL("assets/mysql.svg",import.meta.url).href,fe=""+new URL("assets/SQLServer.png",import.meta.url).href,Ae=""+new URL("assets/PostgreSQL.png",import.meta.url).href,Ce=""+new URL("assets/Doris.png",import.meta.url).href,he=[{label:"MySQL",value:"MySQL",icon:pe},{label:"PostgreSQL",value:"PostgreSQL",icon:Ae},{label:"SQLServer",value:"SQLServer",icon:fe},{label:"Doris",value:"Doris",icon:Ce}],Be=({drawerTitle:m,drawerVisible:v,isConnectSuccess:B,handleDrawerClose:E,dbInfo:c,dbType:l,eventsEmit:p})=>{const[Q,V]=F(!1),[G,N]=F(!1),[e,t]=F({}),[i,u]=F(!1),b=W(()=>({id:l,layout:"vertical",formWidth:"500px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",counter:150,required:!1,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""}]}),[l,c]),D=W(()=>({id:l,layout:"vertical",formWidth:"470px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",required:!1,counter:150,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""},{id:"db-info",label:"\u76F4\u8FDE\u6570\u636E\u6E90\u4FE1\u606F",type:"title",level:2},{id:"dbType",name:"dbType",label:"\u6570\u636E\u6E90\u7C7B\u578B",type:"select",disabled:!!c,required:!0,options:he.map(a=>{const{label:r,value:M,icon:k}=a;return{label:r,value:M,render:()=>L("div",{className:"flex items-center gap-2",children:[n("img",{src:k,width:24}),n("span",{children:r})]})}})},{id:"dbHost",name:"dbHost",label:"\u4E3B\u673A\u5730\u5740",type:"input",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165IP\u5730\u5740\u6216\u8005\u57DF\u540D"},{id:"dbPort",name:"dbPort",label:"\u7AEF\u53E3\u53F7",type:"number",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7AEF\u53E3\u540D\u79F0"},{id:"dbDatabase",name:"dbDatabase",label:"\u8FDE\u63A5\u6570\u636E\u5E93\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u8FDE\u63A5\u6570\u636E\u5E93\u540D",required:!0,type:"input"},{type:"col",children:[{id:"dbUser",type:"input",name:"dbUser",label:"\u7528\u6237\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",required:!0},{id:"dbPassword",type:"password",name:"dbPassword",label:"\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",required:!0,disabled:i?!1:!!c}]}]}),[l,c,i]),g=q(null),C=(a,r,M)=>{switch(console.log("[Form] eventsEmit:",a,r,M),a){case"form:ready":r.formRef&&(g.current=r.formRef);break;case"form_field_change":console.log("\u5B57\u6BB5\u503C\u53D8\u5316:",r),t(k=>({...k,[r.fieldId]:r.value}));break;case"form_validation_error":console.log("\u8868\u5355\u9A8C\u8BC1\u9519\u8BEF:",r);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,r)}p==null||p(a,r,M)},h=async()=>{try{V(!0);const a=await g.current.getAllData();a.isValid&&(console.log(a,"==="),l=="DirectDB"&&m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!i&&(a.fields=a.fields.filter(r=>r.name=="name"||r.name=="description")),await p("form_submitted",a,void 0),u(!1))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{V(!1)}},w=async()=>{try{N(!0);const a=await g.current.getAllData();if(a.isValid){const r=a.fields.reduce((M,k)=>(M[k.name]=k.value,M),{});await p("form:connect_test",r,void 0)}}catch{N(!1)}finally{N(!1)}},d=W(()=>{const a=l=="DataTable"?b:D;return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:a.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:a.id,type:"form",size:"md",formWidth:a.formWidth,formConfig:{layout:a.layout,showReset:!1,showSubmit:!1,formWidth:a.formWidth,getFormData:()=>({...e,timestamp:new Date().toISOString(),formId:a.id}),onFieldChange:(r,M)=>{C("form_field_change",{fieldId:r,value:M},void 0)},onValidationError:r=>{C("form_validation_error",r,void 0)}}}],dataSource:[{id:a.id,fields:a.fields,defaultValues:{...c}}],eventsEmit:C}},[l,b,D,v,c]),j=W(()=>l=="DirectDB"?c?i&&!B:!B:!1,[l,B,i,v]);return L(K,{title:m,width:620,onCancel:()=>{E(),u(!1)},open:v,destroyOnHidden:!0,footer:L("div",{className:"flex justify-end gap-3",children:[n(R,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{E(),u(!1)}}),n(R,{mode:"primary",label:"\u786E\u8BA4",loading:Q,disabled:j,onClick:h})]}),children:[n($,{...d},"example-form"),l==="DirectDB"&&n(de,{children:m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!i?n(R,{mode:"primary",className:"mt-[10px]",label:"\u4FEE\u6539\u5BC6\u7801",onClick:()=>{u(!0),g.current.setValues({dbPassword:void 0})}}):n(be,{title:"\u9700\u901A\u8FC7\u6D4B\u8BD5\u624D\u53EF\u521B\u5EFA\u6210\u529F",children:n(R,{mode:"primary",className:"mt-[10px]",label:"\u8FDE\u63A5\u6D4B\u8BD5",loading:G,onClick:w})})})]})},Ne=""+new URL("assets/empty.png",import.meta.url).href,{confirm:we}=K,je=ye.div`
|
|
2
|
+
width: 282px;
|
|
3
|
+
height: 81px;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
justify-space:between;
|
|
7
|
+
align-items: center;
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
padding:12px;
|
|
10
|
+
|
|
11
|
+
flexD
|
|
12
|
+
color: #2a2a2a;
|
|
13
|
+
background-color: #ffffff;
|
|
14
|
+
&:hover {
|
|
15
|
+
color: #055aff;
|
|
16
|
+
border: 1px solid #2b69ff;
|
|
17
|
+
background-color: #F1F5FF;
|
|
18
|
+
};
|
|
19
|
+
border: 1px solid #EBEBEB
|
|
20
|
+
`,ke=[{key:"add_file_db",label:"\u4E0A\u4F20\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0A\u4F20Excel\u3001csv\u7B49\u683C\u5F0F\u6570\u636E\u8868\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:ge},{key:"add_direct_db",label:"\u76F4\u8FDE\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0E\u5DF2\u6709\u4E1A\u52A1\u5EFA\u7ACB\u8FDE\u63A5\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:Me}],Qe=m=>{const{url:v,token:B,role:E,CustomComponents:c,getBtnDisabled:l}=m,[p,Q]=F("my-db"),[V,G]=F({app:"ready",container:"ready",content:"ready"}),[N,e]=F(!1),[t,i]=F([{id:"my-db",data:[]},{id:"shared-db",data:[]}]),u=q(null),[b,D]=F(!1),[g,C]=F(""),[h,w]=F("DataTable"),[d,j]=F(),[a,r]=F(!1),{getDatabaseList:M,delDatabaseById:k,saveDatabase:ee,testConnection:ue,getShareDatabaseList:te,syncSchema:ae}=Ee({url:v,token:B,role:E,eventsEmit:m.eventsEmit}),H=W(()=>[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"my-db",type:"card",cardType:"database",rowHeight:220,viewPageSize:12,viewBehavior:"pagination",actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}],toolbar:[{type:"customized",key:"add",render:()=>n(Fe,{mode:"primary",label:"\u521B\u5EFA\u6570\u636E\u5E93",actions:ke.map(o=>({key:o.key,component:n(je,{children:L("div",{className:"flex flex-grow",children:[n("div",{className:"mr-[6px]",children:n("img",{src:o.icon})}),L("div",{children:[n("div",{className:"text-base font-bold mb-1 text-[14px]",children:o.label}),n("div",{className:"text-[#888] text-[10px]",children:o.dsc})]})]})},o.key)})),eventEmit:Y})},{type:"fuzzy_search",key:"search",label:"\u8F93\u5165\u540D\u79F0\u641C\u7D22",searchKeys:["name","description"],position:"right"}]},{label:"\u5171\u4EAB\u6570\u636E\u5E93",id:"shared-db",type:"card",cardType:"database",rowHeight:240,toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",position:"right"}],actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}]}],[t]);De(()=>{G(o=>({...o,content:"loading"})),se()},[]);const se=async()=>{var o,s,f,y;try{const[A,z]=await Promise.allSettled([M({pageNo:1,pageSize:999}),te({pageNo:1,pageSize:999})]);let T=[];if(A.status==="fulfilled"&&A.value&&(o=A.value)!=null&&o.records){const x=X((s=A.value)==null?void 0:s.records);T.push({id:"my-db",data:x||[]})}if(z.status==="fulfilled"&&z.value&&(f=z.value)!=null&&f.records){const x=X((y=z.value)==null?void 0:y.records);T.push({id:"shared-db",data:x||[]})}i(T),G(x=>({...x,content:"ready"}))}catch(A){console.log("[DatabaseApiError] getDatabaseList:",A)}},X=o=>(o||[]).map(s=>{const f=U("shared-db").map((y,A)=>({...y,key:y.type==="divider"?`${y.key}_${s.id}`:y.key,disabled:l&&l(y.key=="edit"?7:4,s.permission)}));return s.datasourceType=="DirectDB"&&f.push({label:"\u540C\u6B65\u8868\u7ED3\u6784",key:"sync_schema",disabled:l&&l(7,s.permission)}),console.log("[DatabaseViewAdopter] actions:",f),{...s,actions:f||[]}}),ie="admin",re=()=>L("div",{className:"flex flex-col items-center justify-center h-full",children:[n("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:n("img",{src:Ne,width:120})}),n("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5E93"})]}),U=o=>{const s=H.find(y=>y.id===o);return(s==null?void 0:s.actions)||[]},oe=W(()=>{var s;const o=((s=t==null?void 0:t.find(f=>f.id===p))==null?void 0:s.data)||[];return N?[]:o},[p,t,N]),_=()=>{D(!1),r(!1),j(void 0)},ce=async o=>{console.log("[DatabaseViewAdopter] \u6D4B\u8BD5\u8FDE\u63A5:",o);const s=await ue(o);return s&&(r(!0),J.success("\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F\uFF01")),s};async function Y(o,s,f){var y,A,z,T,x;switch(console.log("[DatabaseViewAdopter] mergedEventsEmit",o,s),o){case"card_delete":we({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await k(s.id,s.datasourceType)&&(u!=null&&u.current)&&(u==null||u.current.appFn.removeItem(s.id))},onCancel(){console.log("Cancel")}});break;case"card_edit":C("\u7F16\u8F91\u6570\u636E\u5E93"),D(!0),w(s.datasourceType),delete s.render,j(s);break;case"select":Q(s.id);break;case"filesDir_clicked":Q(s.id);break;case"dropdown_action":C("\u521B\u5EFA\u6570\u636E\u5E93"),D(!0),s.key=="add_file_db"?w("DataTable"):w("DirectDB");break;case"form_submitted":try{const S=s.fields.reduce((Z,I)=>(Z[I.name]=I.value,Z),{}),ne=d?{id:d==null?void 0:d.id,...S}:S,P=await ee(ne,h);if(P){if(d){const Z={...d,...S,datasourceType:h,actions:U("my-db").map((I,le)=>({...I,key:I.type==="divider"?`${I.key}_${P}`:I.key,allow:!0}))};(A=(y=u==null?void 0:u.current)==null?void 0:y.appFn)==null||A.updateItem(Z,d==null?void 0:d.id),J.success("\u6570\u636E\u5E93\u7F16\u8F91\u6210\u529F\uFF01")}else{const Z={...S,...P,createBy:ie,datasourceType:h,actions:U("my-db").map((I,le)=>({...I,key:I.type==="divider"?`${I.key}_${P}`:I.key,allow:!0}))};(T=(z=u==null?void 0:u.current)==null?void 0:z.appFn)==null||T.addItem(Z,{animate:!0,position:"start"}),J.success("\u6570\u636E\u5E93\u521B\u5EFA\u6210\u529F\uFF01")}return P}}catch(S){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",S)}finally{_()}break;case"form:connect_test":return await ce(s);case"toolbar_test_empty":console.log("[DatabaseViewAdopter] toolbar_test_empty \u4E8B\u4EF6\u89E6\u53D1"),e(!N);break;case"card_sync_schema":await ae(s.id)&&(r(!0),J.success("\u540C\u6B65\u8868\u7ED3\u6784\u6210\u529F\uFF01"));break;default:(x=m.eventsEmit)==null||x.call(m,o,s);break}}return L(Ie,{title:"\u6570\u636E\u5E93\u7BA1\u7406",children:[n($,{ref:u,label:"",model:"tabs",defaultActiveId:p,views:H,dataSource:oe,eventsEmit:Y,status:V,CustomComponents:{EmptyData:re,...c},styles:m.styles},"db"),n(Be,{drawerTitle:g,drawerVisible:b,isConnectSuccess:a,dbType:h,dbInfo:d,handleDrawerClose:_,eventsEmit:Y})]})};export{Qe as default};
|