@nocobase/plugin-ai 2.3.0-alpha.1 → 2.3.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/docs/nocobase/ai-dev/watermark-plugin.md +2 -0
- package/dist/ai/docs/nocobase/ai-employees/block/ai-chat-box.md +133 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/documents.md +1 -1
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/index.md +11 -7
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/settings.md +12 -8
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/rag.md +43 -13
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-database.md +3 -3
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/create-document.md +1 -1
- package/dist/ai/docs/nocobase/api/app/env.md +2 -0
- package/dist/ai/docs/nocobase/api/cli/api/resource/create.md +4 -3
- package/dist/ai/docs/nocobase/building-tips/ai-fill-js-block-form.md +1092 -0
- package/dist/ai/docs/nocobase/data-sources/calendar/calendar-collection.md +100 -3
- package/dist/ai/docs/nocobase/data-sources/collection-comment/index.md +92 -39
- package/dist/ai/docs/nocobase/data-sources/collection-sql/index.md +150 -29
- package/dist/ai/docs/nocobase/data-sources/collection-tree/index.md +93 -5
- package/dist/ai/docs/nocobase/data-sources/collection-view/index.md +226 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/china-region.md +122 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/collection-select.md +105 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/json.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/nano-id.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/snowflake-id.md +108 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/sort.md +3 -19
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/uuid.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/associations/index.md +44 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/color.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/email.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/icon.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/input.md +112 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/integer.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/number.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/password.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/percent.md +104 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/phone.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/textarea.md +99 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/url.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox-group.md +105 -3
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/china-region.md +108 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/multiple-select.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/radio-group.md +106 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/select.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/date.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime-without-tz.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/index.md +53 -47
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/time.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/unix-timestamp.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/circle.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/line.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/point.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/polygon.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/index.md +62 -16
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/markdown.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/rich-text.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-at.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-by.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/space.md +100 -6
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/table-oid.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-at.md +104 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-by.md +104 -6
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/validation.md +68 -58
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection.md +32 -13
- package/dist/ai/docs/nocobase/data-sources/data-modeling/index.md +41 -33
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mariadb/index.md +114 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mssql/index.md +117 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mysql/index.md +103 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-nocobase/index.md +75 -73
- package/dist/ai/docs/nocobase/data-sources/data-source-external-oracle/index.md +129 -11
- package/dist/ai/docs/nocobase/data-sources/data-source-external-postgres/index.md +110 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-kingbase/index.md +75 -49
- package/dist/ai/docs/nocobase/data-sources/data-source-main/general-collection.md +116 -15
- package/dist/ai/docs/nocobase/data-sources/data-source-main/index.md +92 -62
- package/dist/ai/docs/nocobase/data-sources/data-source-main/inheritance-collection.md +97 -10
- package/dist/ai/docs/nocobase/data-sources/data-source-manager/external-database.md +97 -58
- package/dist/ai/docs/nocobase/data-sources/data-source-manager/index.md +32 -24
- package/dist/ai/docs/nocobase/data-sources/data-source-rest-api/index.md +115 -153
- package/dist/ai/docs/nocobase/data-sources/external/clickhouse.md +124 -0
- package/dist/ai/docs/nocobase/data-sources/external/doris.md +130 -0
- package/dist/ai/docs/nocobase/data-sources/external/index.md +140 -0
- package/dist/ai/docs/nocobase/data-sources/external/kingbase.md +129 -0
- package/dist/ai/docs/nocobase/data-sources/external/mariadb.md +126 -0
- package/dist/ai/docs/nocobase/data-sources/external/mssql.md +129 -0
- package/dist/ai/docs/nocobase/data-sources/external/mysql.md +115 -0
- package/dist/ai/docs/nocobase/data-sources/external/nocobase.md +159 -0
- package/dist/ai/docs/nocobase/data-sources/external/oceanbase.md +126 -0
- package/dist/ai/docs/nocobase/data-sources/external/oracle.md +158 -0
- package/dist/ai/docs/nocobase/data-sources/external/postgresql.md +122 -0
- package/dist/ai/docs/nocobase/data-sources/external/rest-api.md +245 -0
- package/dist/ai/docs/nocobase/data-sources/field-attachment-url/index.md +100 -12
- package/dist/ai/docs/nocobase/data-sources/field-encryption/index.md +48 -47
- package/dist/ai/docs/nocobase/data-sources/field-formula/index.md +99 -5
- package/dist/ai/docs/nocobase/data-sources/field-markdown-vditor/index.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/field-sequence/index.md +102 -5
- package/dist/ai/docs/nocobase/data-sources/field-signature/index.md +18 -16
- package/dist/ai/docs/nocobase/data-sources/field-sort/index.md +76 -73
- package/dist/ai/docs/nocobase/data-sources/file-manager/field-attachment.md +101 -7
- package/dist/ai/docs/nocobase/data-sources/file-manager/file-collection.md +101 -14
- package/dist/ai/docs/nocobase/data-sources/index.md +49 -33
- package/dist/ai/docs/nocobase/data-sources/main/index.md +130 -0
- package/dist/ai/docs/nocobase/data-sources/main/kingbase.md +147 -0
- package/dist/ai/docs/nocobase/data-sources/main/mariadb.md +59 -0
- package/dist/ai/docs/nocobase/data-sources/main/mysql.md +59 -0
- package/dist/ai/docs/nocobase/data-sources/main/oceanbase.md +62 -0
- package/dist/ai/docs/nocobase/data-sources/main/postgresql.md +61 -0
- package/dist/ai/docs/nocobase/file-manager/file-preview/index.md +44 -3
- package/dist/ai/docs/nocobase/file-manager/stable-url.md +1 -1
- package/dist/ai/docs/nocobase/file-manager/storage/aliyun-oss.md +100 -3
- package/dist/ai/docs/nocobase/file-manager/storage/index.md +76 -26
- package/dist/ai/docs/nocobase/file-manager/storage/local.md +4 -2
- package/dist/ai/docs/nocobase/file-manager/storage/s3-pro.md +58 -7
- package/dist/ai/docs/nocobase/get-started/installation/docker-nginx.mdx +4 -1
- package/dist/ai/docs/nocobase/get-started/installation/docker.mdx +2 -0
- package/dist/ai/docs/nocobase/get-started/installation/env.md +13 -1
- package/dist/ai/docs/nocobase/nocobase-cli/production/reverse-proxy/caddy.md +28 -5
- package/dist/ai/docs/nocobase/nocobase-cli/production/reverse-proxy/nginx.md +25 -0
- package/dist/ai/docs/nocobase/ops-management/migration-manager/built-in-tables.md +1 -2
- package/dist/ai/docs/nocobase/plugin-development/build.md +10 -4
- package/dist/ai/docs/nocobase/plugin-development/client/appendix/faq.md +1 -1
- package/dist/ai/docs/nocobase/plugin-development/client/examples/custom-action.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/client/examples/custom-block.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/client/examples/custom-field.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/client/examples/fullstack-plugin.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/client/examples/settings-page.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/common/i18n.md +3 -3
- package/dist/ai/docs/nocobase/plugin-development/server/cache.md +1 -1
- package/dist/ai/docs/nocobase/plugin-development/server/collections.md +0 -6
- package/dist/ai/docs/nocobase/plugin-development/server/command.md +2 -2
- package/dist/ai/docs/nocobase/plugin-development/server/context.md +2 -2
- package/dist/ai/docs/nocobase/plugin-development/server/i18n.md +4 -4
- package/dist/ai/docs/nocobase/plugin-development/write-your-first-plugin.md +91 -43
- package/dist/ai/docs/nocobase/runjs/context/ai.md +194 -4
- package/dist/ai/docs/nocobase/security/guide.md +17 -2
- package/dist/ai/docs/nocobase/users-permissions/sync/index.md +8 -1
- package/dist/ai/docs/nocobase/users-permissions/sync/sources/dingtalk.md +138 -0
- package/dist/ai/docs/nocobase/users-permissions/sync/sources/ldap.md +87 -0
- package/dist/ai/docs/nocobase/workflow/nodes/javascript.md +21 -1
- package/dist/ai/tools/executeFrontendTool.d.ts +10 -0
- package/dist/ai/tools/executeFrontendTool.js +86 -0
- package/dist/ai/tools/getSkill.js +1 -1
- package/dist/ai/tools/knowledge-base-retrieve.js +3 -1
- package/dist/ai/tools/loadFrontendTool.d.ts +10 -0
- package/dist/ai/tools/loadFrontendTool.js +99 -0
- package/dist/client/244.aeb24ce76c510b34.js +10 -0
- package/dist/client/{525.203778500aca5d05.js → 525.94dd4136c1361477.js} +1 -1
- package/dist/client/681.6ffbc9329b9ac242.js +10 -0
- package/dist/client/705.1d735e63c25f66a8.js +10 -0
- package/dist/client/index.d.ts +1 -3
- package/dist/client/index.js +8 -8
- package/dist/client-v2/244.ee9ec45eac0eb99f.js +10 -0
- package/dist/client-v2/420.a5b929a5e7f330be.js +10 -0
- package/dist/client-v2/681.6890caa389564ff7.js +10 -0
- package/dist/client-v2/705.00c101bef403fb44.js +10 -0
- package/dist/client-v2/ai-employees/AIEmployeeShortcut.d.ts +2 -0
- package/dist/client-v2/ai-employees/AddContextButton.d.ts +2 -0
- package/dist/client-v2/ai-employees/chatbox/components/AIEmployeeSwitcher.d.ts +1 -0
- package/dist/client-v2/ai-employees/chatbox/components/ChatBoxUnreadBadge.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/components/Conversations.d.ts +9 -1
- package/dist/client-v2/ai-employees/chatbox/components/MessageRenderers.d.ts +1 -1
- package/dist/client-v2/ai-employees/chatbox/components/Messages.d.ts +5 -1
- package/dist/client-v2/ai-employees/chatbox/components/ModelSwitcher.d.ts +4 -0
- package/dist/client-v2/ai-employees/chatbox/components/Sender.d.ts +33 -1
- package/dist/client-v2/ai-employees/chatbox/components/index.d.ts +1 -0
- package/dist/client-v2/ai-employees/chatbox/hooks/reasoning-stream.d.ts +10 -0
- package/dist/client-v2/ai-employees/chatbox/hooks/useChat.d.ts +8 -5
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxEffect.d.ts +2 -1
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatConversationActions.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +4 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useToolCallActions.d.ts +3 -1
- package/dist/client-v2/ai-employees/chatbox/hooks/useUploadFiles.d.ts +13 -3
- package/dist/client-v2/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/index.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/roles.d.ts +2 -153
- package/dist/client-v2/ai-employees/chatbox/stores/chat-box.d.ts +46 -33
- package/dist/client-v2/ai-employees/chatbox/stores/chat-conversations.d.ts +7 -7
- package/dist/client-v2/ai-employees/chatbox/stores/chat-messages.d.ts +23 -18
- package/dist/client-v2/ai-employees/chatbox/stores/chat-sender.d.ts +43 -0
- package/dist/client-v2/ai-employees/chatbox/stores/chat-tool-call.d.ts +6 -5
- package/dist/client-v2/ai-employees/chatbox/stores/chat-tools.d.ts +11 -5
- package/dist/client-v2/ai-employees/chatbox/stores/mounted-chat-boxes.d.ts +20 -0
- package/dist/client-v2/ai-employees/chatbox/stores/runtime.d.ts +43 -0
- package/dist/client-v2/ai-employees/chatbox/stores/workflow-tasks.d.ts +22 -10
- package/dist/client-v2/ai-employees/chatbox/upload.d.ts +19 -0
- package/dist/client-v2/ai-employees/chatbox/utils.d.ts +28 -4
- package/dist/client-v2/ai-employees/frontend-tools.d.ts +11 -0
- package/dist/client-v2/ai-employees/tools/SuggestionsOptionsCard.d.ts +1 -1
- package/dist/client-v2/ai-employees/tools/WorkflowTaskOutputCard.d.ts +1 -1
- package/dist/client-v2/ai-employees/types.d.ts +30 -0
- package/dist/client-v2/block/ai-chat-box/AIChatBoxBlockModel.d.ts +21 -0
- package/dist/client-v2/block/ai-chat-box/AIChatBoxCoreModel.d.ts +13 -0
- package/dist/client-v2/{ai-employees/chatbox/components/DebugPanel.d.ts → block/ai-chat-box/components/AIChatBoxCoreView.d.ts} +1 -1
- package/dist/client-v2/block/ai-chat-box/components/AIChatBoxView.d.ts +12 -0
- package/dist/client-v2/block/ai-chat-box/index.d.ts +14 -0
- package/dist/client-v2/block/ai-chat-box/settings.d.ts +12 -0
- package/dist/client-v2/block/ai-chat-box/sub-models.d.ts +26 -0
- package/dist/client-v2/block/ai-chat-box/types.d.ts +38 -0
- package/dist/client-v2/block/ai-chat-box/utils.d.ts +26 -0
- package/dist/client-v2/index.d.ts +3 -5
- package/dist/client-v2/index.js +3 -3
- package/dist/client-v2/llm-providers/forms.d.ts +2 -0
- package/dist/client-v2/llm-providers/index.d.ts +1 -0
- package/dist/client-v2/llm-services/model-select.d.ts +33 -0
- package/dist/client-v2/llm-services/utils.d.ts +1 -0
- package/dist/client-v2/manager/ai-manager.d.ts +10 -3
- package/dist/client-v2/manager/frontend-tool-registry.d.ts +30 -0
- package/dist/client-v2/models/ai-employees/AIEmployeeActionModel.d.ts +4 -1
- package/dist/client-v2/models/ai-employees/AIEmployeeShortcutModel.d.ts +8 -0
- package/dist/client-v2/pages/EmployeesPage.d.ts +12 -0
- package/dist/client-v2/pages/LLMServicesPage.d.ts +9 -4
- package/dist/client-v2/repositories/AIConfigRepository.d.ts +2 -0
- package/dist/client-v2/runjs/registerAIEmployeeRunJSFacade.d.ts +1 -0
- package/dist/client-v2/workflow/types.d.ts +1 -0
- package/dist/collections/ai-employees.d.ts +1 -0
- package/dist/collections/ai-employees.js +1 -0
- package/dist/common/ai-employee-validation.d.ts +17 -0
- package/dist/common/ai-employee-validation.js +67 -0
- package/dist/common/error-codes.d.ts +14 -0
- package/dist/common/error-codes.js +51 -0
- package/dist/common/frontend-tools.d.ts +26 -0
- package/dist/common/frontend-tools.js +57 -0
- package/dist/common/llm-service-models.d.ts +16 -0
- package/dist/common/llm-service-models.js +84 -0
- package/dist/externalVersion.js +19 -17
- package/dist/locale/de-DE.json +2 -1
- package/dist/locale/en-US.json +87 -5
- package/dist/locale/es-ES.json +2 -1
- package/dist/locale/fr-FR.json +2 -1
- package/dist/locale/hu-HU.json +2 -1
- package/dist/locale/id-ID.json +2 -1
- package/dist/locale/it-IT.json +2 -1
- package/dist/locale/ja-JP.json +2 -1
- package/dist/locale/ko-KR.json +2 -1
- package/dist/locale/nl-NL.json +2 -1
- package/dist/locale/pt-BR.json +2 -1
- package/dist/locale/ru-RU.json +2 -1
- package/dist/locale/tr-TR.json +2 -1
- package/dist/locale/uk-UA.json +2 -1
- package/dist/locale/vi-VN.json +2 -1
- package/dist/locale/zh-CN.json +87 -5
- package/dist/locale/zh-TW.json +2 -1
- package/dist/node_modules/@langchain/mistralai/package.json +1 -1
- package/dist/node_modules/@langchain/xai/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonrepair/package.json +1 -1
- package/dist/node_modules/just-bash/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-conversations.d.ts +4 -1
- package/dist/server/ai-employees/ai-conversations.js +2 -0
- package/dist/server/ai-employees/ai-employee.d.ts +32 -2
- package/dist/server/ai-employees/ai-employee.js +367 -79
- package/dist/server/ai-employees/ai-knowledge-base.d.ts +21 -1
- package/dist/server/ai-employees/ai-knowledge-base.js +87 -12
- package/dist/server/ai-employees/middleware/conversation.js +28 -22
- package/dist/server/ai-employees/middleware/index.d.ts +1 -0
- package/dist/server/ai-employees/middleware/index.js +2 -0
- package/dist/server/ai-employees/middleware/tool-result-integrity.d.ts +22 -0
- package/dist/server/ai-employees/middleware/tool-result-integrity.js +211 -0
- package/dist/server/ai-employees/reasoning-stream-state.d.ts +23 -0
- package/dist/server/ai-employees/reasoning-stream-state.js +63 -0
- package/dist/server/collections/ai-conversations.js +5 -0
- package/dist/server/document-loader/constants.js +1 -1
- package/dist/server/features/knowledge-base.d.ts +2 -0
- package/dist/server/frontend-tools.d.ts +25 -0
- package/dist/server/frontend-tools.js +171 -0
- package/dist/server/llm-providers/common/reasoning.js +18 -10
- package/dist/server/llm-providers/deepseek/index.d.ts +10 -0
- package/dist/server/llm-providers/deepseek/index.js +32 -0
- package/dist/server/llm-providers/deepseek/provider.d.ts +57 -0
- package/dist/server/llm-providers/deepseek/provider.js +320 -0
- package/dist/server/llm-providers/deepseek/reasoning.d.ts +83 -0
- package/dist/server/llm-providers/deepseek/reasoning.js +285 -0
- package/dist/server/llm-providers/mistral.d.ts +1 -1
- package/dist/server/llm-providers/provider.d.ts +1 -0
- package/dist/server/llm-providers/provider.js +3 -0
- package/dist/server/llm-providers/shengsuanyun.d.ts +29 -0
- package/dist/server/llm-providers/shengsuanyun.js +114 -0
- package/dist/server/manager/ai-feature-manager.js +1 -1
- package/dist/server/manager/ai-manager.d.ts +3 -0
- package/dist/server/manager/ai-manager.js +7 -2
- package/dist/server/manager/work-context-handler.js +10 -3
- package/dist/server/migrations/20260501000000-ai-employee-knowledge-base-retrieval-strategy.d.ts +14 -0
- package/dist/server/migrations/20260501000000-ai-employee-knowledge-base-retrieval-strategy.js +49 -0
- package/dist/server/plugin.d.ts +1 -0
- package/dist/server/plugin.js +31 -0
- package/dist/server/resource/aiConversations.d.ts +2 -0
- package/dist/server/resource/aiConversations.js +33 -3
- package/dist/server/resource/aiEmployees.d.ts +2 -0
- package/dist/server/resource/aiEmployees.js +96 -0
- package/dist/server/resource/aiWorkflowTasks.js +9 -1
- package/dist/server/resource/llmServices.d.ts +11 -0
- package/dist/server/resource/llmServices.js +85 -0
- package/dist/server/types/ai-message.type.d.ts +4 -0
- package/dist/server/types/knowledge-base.type.d.ts +8 -3
- package/dist/server/workflow/nodes/employee/files.d.ts +1 -1
- package/dist/server/workflow/nodes/employee/files.js +48 -1
- package/dist/server/workflow/nodes/employee/index.js +7 -2
- package/dist/server/workflow/nodes/employee/types.d.ts +1 -0
- package/dist/swagger/common.d.ts +143 -0
- package/dist/swagger/common.js +144 -0
- package/dist/swagger/employees.d.ts +301 -0
- package/dist/swagger/employees.js +131 -0
- package/dist/swagger/index.d.ts +1617 -0
- package/dist/swagger/index.js +62 -0
- package/dist/swagger/llm.d.ts +563 -0
- package/dist/swagger/llm.js +255 -0
- package/dist/swagger/schemas.d.ts +757 -0
- package/dist/swagger/schemas.js +392 -0
- package/package.json +2 -2
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-store.md +0 -24
- package/dist/ai/docs/nocobase/data-sources/development/index.md +0 -6
- package/dist/client/372.40eb52905e3f3049.js +0 -10
- package/dist/client/681.399948c18d753667.js +0 -10
- package/dist/client/705.380279da896021fb.js +0 -10
- package/dist/client-v2/372.8cc3fde09c9bec77.js +0 -10
- package/dist/client-v2/406.341be51205c674e0.js +0 -10
- package/dist/client-v2/681.082f4f1c7b841983.js +0 -10
- package/dist/client-v2/705.1d10027ff8cfdf79.js +0 -10
- package/dist/client-v2/ai-employees/chatbox/stores/create-selectors.d.ts +0 -46
- package/dist/client-v2/ai-employees/chatbox/utils/normalizeTriggerTaskOptions.d.ts +0 -19
- package/dist/client-v2/debug-logger.d.ts +0 -52
- package/dist/server/llm-providers/deepseek.d.ts +0 -40
- package/dist/server/llm-providers/deepseek.js +0 -174
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
pkg: '@nocobase/plugin-auth-ldap'
|
|
3
|
+
title: "Synchronize User Data from LDAP"
|
|
4
|
+
description: "Synchronize LDAP users and departments to NocoBase by reusing an existing LDAP authenticator."
|
|
5
|
+
keywords: "LDAP,user synchronization,department synchronization,Bind DN,Search DN,NocoBase"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Synchronize User Data from LDAP
|
|
9
|
+
|
|
10
|
+
<PluginInfo commercial="true" name="auth-ldap"></PluginInfo>
|
|
11
|
+
|
|
12
|
+
## Introduction
|
|
13
|
+
|
|
14
|
+
The **Auth: LDAP** plugin can use an existing LDAP authenticator as a user data synchronization source. The synchronization source reuses the authenticator's LDAP connection, Bind DN, Search DN, search scope, and attribute mappings, then writes the resulting users and optional department hierarchy to NocoBase.
|
|
15
|
+
|
|
16
|
+
## Before you begin
|
|
17
|
+
|
|
18
|
+
1. Install and enable the **Auth: LDAP** and **User Data Synchronization** plugins.
|
|
19
|
+
2. Create and verify an LDAP authenticator. See [Authentication: LDAP](/auth-verification/auth-ldap/).
|
|
20
|
+
3. Make sure the authenticator's attribute mappings include the fields needed by NocoBase, such as username or email, nickname, and phone number.
|
|
21
|
+
|
|
22
|
+
## Add an LDAP synchronization source
|
|
23
|
+
|
|
24
|
+
Go to **Users & Permissions > Synchronize**, click **Add new**, and select **LDAP** as the type.
|
|
25
|
+
|
|
26
|
+
Configure the following fields:
|
|
27
|
+
|
|
28
|
+
| Field | Description |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source name | A unique name for this synchronization source. |
|
|
31
|
+
| Enabled | Enables manual synchronization and LDAP synchronization tasks for this source. |
|
|
32
|
+
| LDAP authenticator | The existing LDAP authenticator whose connection and attribute mappings will be reused. |
|
|
33
|
+
| Sync filter | The LDAP filter used to find users during synchronization. The default is `(&(objectCategory=person)(objectClass=user))`. Adjust it to match your directory schema. |
|
|
34
|
+
| Size limit | Optional maximum number of entries returned by an LDAP search. Leave it empty to use the LDAP server's default limit. |
|
|
35
|
+
| Page size | Optional page size for paged LDAP searches. Use this when the directory contains more entries than a single query can return. |
|
|
36
|
+
| Sync departments | Also synchronizes the LDAP organizational hierarchy to NocoBase departments. |
|
|
37
|
+
| Department search DN | Required when department synchronization is enabled. Specify the DN that contains the organizational units to synchronize, for example `ou=departments,dc=example,dc=com`. |
|
|
38
|
+
|
|
39
|
+
:::info
|
|
40
|
+
The synchronization source uses the selected authenticator's Bind DN and Bind password to search LDAP. It does not store a second copy of the LDAP connection credentials.
|
|
41
|
+
:::
|
|
42
|
+
|
|
43
|
+
## Synchronize users
|
|
44
|
+
|
|
45
|
+
Save and enable the source, then click **Sync** to start a full synchronization. Open **Task** to review the result and retry a failed task.
|
|
46
|
+
|
|
47
|
+
User matching follows the field selected in the LDAP authenticator's **Use this field to bind the user** setting. Keep that setting and the authenticator's attribute mappings stable after the first synchronization to avoid creating duplicate users.
|
|
48
|
+
|
|
49
|
+
## Synchronize departments
|
|
50
|
+
|
|
51
|
+
Enable **Sync departments** and enter a **Department search DN** when the LDAP directory contains a hierarchy that should be represented in NocoBase.
|
|
52
|
+
|
|
53
|
+
The plugin searches organizational units below that DN, preserves their parent-child relationships, and associates users with departments based on their distinguished names. The configured Department search DN must cover the organizational units referenced by the users you expect to synchronize.
|
|
54
|
+
|
|
55
|
+
## Synchronized fields
|
|
56
|
+
|
|
57
|
+
### User fields
|
|
58
|
+
|
|
59
|
+
User fields reuse the selected LDAP authenticator's **Attribute mapping**:
|
|
60
|
+
|
|
61
|
+
| LDAP attribute or setting | NocoBase field or purpose |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| Login account attribute | Used as the source-unique user identifier and written to the username or email selected by the authenticator's **Use this field to bind the user** setting. This attribute is usually inferred from `{{account}}` in the authenticator's search filter, such as `uid`, `sAMAccountName`, or `mail`. A user without this attribute is skipped. |
|
|
64
|
+
| Attribute mapped to `username` | Username. |
|
|
65
|
+
| Attribute mapped to `nickname` | User nickname. |
|
|
66
|
+
| Attribute mapped to `email` | Email address. |
|
|
67
|
+
| Attribute mapped to `phone` | Phone number. |
|
|
68
|
+
| `distinguishedName`, falling back to the entry DN | Finds the nearest synchronized department in the DN path and sets it as the user's primary department. This applies only when department synchronization is enabled. |
|
|
69
|
+
|
|
70
|
+
For a multi-valued LDAP attribute, only the first value is currently synchronized. Other user attributes that are not included in the authenticator's attribute mapping are not synchronized.
|
|
71
|
+
|
|
72
|
+
### Department fields
|
|
73
|
+
|
|
74
|
+
| LDAP attribute or structure | NocoBase field or purpose |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `objectGUID` | Source-unique department identifier. An organizational unit without this attribute is skipped. |
|
|
77
|
+
| `ou`, `cn`, `name` | The first non-empty value in this order becomes the department name. An organizational unit without a name is skipped. |
|
|
78
|
+
| `distinguishedName`, falling back to the entry DN | Identifies the current department and its parent to build the department hierarchy. |
|
|
79
|
+
|
|
80
|
+
Department synchronization searches for `organizationalUnit` and `container` objects by default. It does not currently synchronize multiple user departments from attributes such as `memberOf`, or department owners.
|
|
81
|
+
|
|
82
|
+
## Troubleshooting
|
|
83
|
+
|
|
84
|
+
- If no users are returned, verify the authenticator's Search DN, search scope, Bind DN permissions, and the synchronization filter.
|
|
85
|
+
- If the result is truncated, configure a page size and verify the LDAP server's size limits.
|
|
86
|
+
- If departments are missing, verify that department synchronization is enabled and the Department search DN covers the required organizational units.
|
|
87
|
+
- Review the synchronization task details and application logs for LDAP connection, bind, and search errors.
|
|
@@ -44,6 +44,26 @@ If checked, subsequent nodes will still be executed even if the script encounter
|
|
|
44
44
|
If the script errors out, it will have no return value, and the node's result will be populated with the error message. If subsequent nodes use the result variable from the script node, it should be handled with caution.
|
|
45
45
|
:::
|
|
46
46
|
|
|
47
|
+
## Worker concurrency control
|
|
48
|
+
|
|
49
|
+
JavaScript script nodes place pending scripts in a task queue and execute them in separate Worker threads. By default, NocoBase does not limit JavaScript script Worker concurrency. If multiple tasks are waiting in the queue, they can create Workers and run concurrently.
|
|
50
|
+
|
|
51
|
+
If scripts consume a significant amount of memory while running, multiple Workers can quickly increase the memory usage of an application instance. In this case, use the `WORKFLOW_SCRIPT_WORKER_CONCURRENCY` environment variable to set a concurrency limit. The same applies to CPU-intensive scripts: excessive concurrency increases CPU contention and may affect other requests and workflows in NocoBase. You should also configure this variable if a large number of script tasks may be created within a short period:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
WORKFLOW_SCRIPT_WORKER_CONCURRENCY=4
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The configuration rules are as follows:
|
|
58
|
+
|
|
59
|
+
- If the variable is unset or its value is invalid, concurrency is unlimited
|
|
60
|
+
- A positive integer sets the maximum number of Worker threads that can run concurrently
|
|
61
|
+
- A value of `0` removes the concurrency limit, allowing all queued tasks to run concurrently
|
|
62
|
+
|
|
63
|
+
When the concurrency limit is reached, new tasks remain in the queue until a Worker becomes available. You can keep the default configuration if scripts run infrequently and each execution uses few resources. If you need a concurrency limit, start with a small value and adjust it gradually based on the application instance's memory and CPU usage and task queueing time.
|
|
64
|
+
|
|
65
|
+
If an application runs on multiple server instances, this setting applies separately to each instance. The overall concurrency capacity also depends on the number of instances that can consume tasks. Restart the NocoBase service after changing the environment variable for the new value to take effect.
|
|
66
|
+
|
|
47
67
|
## Execution Engine
|
|
48
68
|
|
|
49
69
|
The JavaScript script node supports two execution engines, automatically selected based on whether the `WORKFLOW_SCRIPT_MODULES` environment variable is configured:
|
|
@@ -164,4 +184,4 @@ async function sleep(time) {
|
|
|
164
184
|
await sleep(1000);
|
|
165
185
|
|
|
166
186
|
return 123;
|
|
167
|
-
```
|
|
187
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import("@nocobase/ai").ToolsOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var executeFrontendTool_exports = {};
|
|
38
|
+
__export(executeFrontendTool_exports, {
|
|
39
|
+
default: () => executeFrontendTool_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(executeFrontendTool_exports);
|
|
42
|
+
var import_ai = require("@nocobase/ai");
|
|
43
|
+
var import_zod = require("zod");
|
|
44
|
+
var import_frontend_tools = require("../../common/frontend-tools");
|
|
45
|
+
var import_frontend_tools2 = require("../../server/frontend-tools");
|
|
46
|
+
var import_package = __toESM(require("../../../package.json"));
|
|
47
|
+
var executeFrontendTool_default = (0, import_ai.defineTools)({
|
|
48
|
+
scope: "GENERAL",
|
|
49
|
+
execution: "frontend",
|
|
50
|
+
defaultPermission: "ALLOW",
|
|
51
|
+
introduction: {
|
|
52
|
+
title: `{{t("Execute frontend tool", { ns: "${import_package.default.name}" })}}`,
|
|
53
|
+
about: `{{t("Execute a frontend tool provided by the selected block.", { ns: "${import_package.default.name}" })}}`
|
|
54
|
+
},
|
|
55
|
+
definition: {
|
|
56
|
+
name: import_frontend_tools.EXECUTE_FRONTEND_TOOL_NAME,
|
|
57
|
+
description: "Execute a frontend tool from the current frontendToolCatalog. Use loadFrontendTool first when you need its input schema. Never use a tool id that is not present in the current catalog.",
|
|
58
|
+
schema: import_zod.z.object({
|
|
59
|
+
toolId: import_zod.z.string().describe("The exact tool id from the current frontendToolCatalog."),
|
|
60
|
+
args: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).default({}).describe("Arguments that match the loaded frontend tool schema.")
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
invoke: async (ctx, args, runtime) => {
|
|
64
|
+
const tool = await (0, import_frontend_tools2.findCurrentFrontendTool)(ctx, args.toolId);
|
|
65
|
+
if (!tool) {
|
|
66
|
+
return {
|
|
67
|
+
status: "error",
|
|
68
|
+
content: "Frontend tool is unavailable in the current conversation."
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const result = await (0, import_frontend_tools2.readFrontendToolResult)(ctx, runtime.toolCallId);
|
|
72
|
+
if (!(result == null ? void 0 : result.provided)) {
|
|
73
|
+
return {
|
|
74
|
+
status: "error",
|
|
75
|
+
content: "Frontend tool did not return a result."
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if ((0, import_frontend_tools.isFrontendToolInvokeResult)(result.value)) {
|
|
79
|
+
return result.value;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
status: "success",
|
|
83
|
+
content: result.value
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
@@ -43,7 +43,7 @@ var import_ai = require("@nocobase/ai");
|
|
|
43
43
|
var import_zod = require("zod");
|
|
44
44
|
var import_package = __toESM(require("../../../package.json"));
|
|
45
45
|
var getSkill_default = (0, import_ai.defineTools)({
|
|
46
|
-
scope: "
|
|
46
|
+
scope: "SPECIFIED",
|
|
47
47
|
defaultPermission: "ALLOW",
|
|
48
48
|
introduction: {
|
|
49
49
|
title: `{{t("Load specific SKILLS", { ns: "${import_package.default.name}" })}}`,
|
|
@@ -42,6 +42,7 @@ module.exports = __toCommonJS(knowledge_base_retrieve_exports);
|
|
|
42
42
|
var import_ai = require("@nocobase/ai");
|
|
43
43
|
var import_zod = require("zod");
|
|
44
44
|
var import_shared = require("./sub-agents/shared");
|
|
45
|
+
var import_ai_knowledge_base = require("../../server/ai-employees/ai-knowledge-base");
|
|
45
46
|
var import_package = __toESM(require("../../../package.json"));
|
|
46
47
|
var knowledge_base_retrieve_default = (0, import_ai.defineTools)({
|
|
47
48
|
scope: "SPECIFIED",
|
|
@@ -84,7 +85,8 @@ var knowledge_base_retrieve_default = (0, import_ai.defineTools)({
|
|
|
84
85
|
const plugin = (0, import_shared.getAIPlugin)(ctx);
|
|
85
86
|
const content = await plugin.knowledgeBaseManager.retrievePrompt({
|
|
86
87
|
username,
|
|
87
|
-
query
|
|
88
|
+
query,
|
|
89
|
+
roleNames: (0, import_ai_knowledge_base.getCurrentRoleNames)(ctx.state)
|
|
88
90
|
});
|
|
89
91
|
return {
|
|
90
92
|
status: "success",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import("@nocobase/ai").ToolsOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var loadFrontendTool_exports = {};
|
|
38
|
+
__export(loadFrontendTool_exports, {
|
|
39
|
+
default: () => loadFrontendTool_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(loadFrontendTool_exports);
|
|
42
|
+
var import_ai = require("@nocobase/ai");
|
|
43
|
+
var import_zod = require("zod");
|
|
44
|
+
var import_frontend_tools = require("../../common/frontend-tools");
|
|
45
|
+
var import_frontend_tools2 = require("../../server/frontend-tools");
|
|
46
|
+
var import_package = __toESM(require("../../../package.json"));
|
|
47
|
+
var loadFrontendTool_default = (0, import_ai.defineTools)({
|
|
48
|
+
scope: "GENERAL",
|
|
49
|
+
execution: "frontend",
|
|
50
|
+
defaultPermission: "ALLOW",
|
|
51
|
+
introduction: {
|
|
52
|
+
title: `{{t("Load frontend tool", { ns: "${import_package.default.name}" })}}`,
|
|
53
|
+
about: `{{t("Load the input schema of a frontend tool provided by the selected block.", { ns: "${import_package.default.name}" })}}`
|
|
54
|
+
},
|
|
55
|
+
definition: {
|
|
56
|
+
name: import_frontend_tools.LOAD_FRONTEND_TOOL_NAME,
|
|
57
|
+
description: 'Load the complete input schema for one frontend tool. This is not a tool discovery API: only call it with an exact tool id copied from the current frontendToolCatalog, and never invent an id such as "current-workspace". After loading a suitable tool, call executeFrontendTool with arguments that match the returned schema.',
|
|
58
|
+
schema: import_zod.z.object({
|
|
59
|
+
toolId: import_zod.z.string().describe("The exact tool id from the current frontendToolCatalog.")
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
invoke: async (ctx, args, runtime) => {
|
|
63
|
+
const tool = await (0, import_frontend_tools2.findCurrentFrontendTool)(ctx, args.toolId);
|
|
64
|
+
if (!tool) {
|
|
65
|
+
return {
|
|
66
|
+
status: "error",
|
|
67
|
+
content: {
|
|
68
|
+
message: "Frontend tool is unavailable in the current conversation."
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const result = await (0, import_frontend_tools2.readFrontendToolResult)(ctx, runtime.toolCallId);
|
|
73
|
+
if (!(result == null ? void 0 : result.provided)) {
|
|
74
|
+
return {
|
|
75
|
+
status: "error",
|
|
76
|
+
content: "Frontend tool manifest was not returned."
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if ((0, import_frontend_tools.isFrontendToolInvokeResult)(result.value)) {
|
|
80
|
+
return result.value;
|
|
81
|
+
}
|
|
82
|
+
if (!(0, import_frontend_tools.isFrontendToolManifest)(result.value) || result.value.id !== args.toolId) {
|
|
83
|
+
return {
|
|
84
|
+
status: "error",
|
|
85
|
+
content: "Frontend tool returned an invalid manifest."
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
status: "success",
|
|
90
|
+
content: {
|
|
91
|
+
id: result.value.id,
|
|
92
|
+
name: result.value.name,
|
|
93
|
+
title: result.value.title,
|
|
94
|
+
description: result.value.description,
|
|
95
|
+
inputSchema: result.value.inputSchema
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["244"],{143:function(u,e,t){t.r(e),t.d(e,{listAIEmployees:function(){return N},SkillSettings:function(){return uc},updateAIEmployee:function(){return X},createAIEmployee:function(){return Y},deleteAIEmployee:function(){return $},normalizeKnowledgeBaseSettingsForForm:function(){return uu},isKnowledgeBaseEnabled:function(){return Q},listKnowledgeBases:function(){return Z},buildEmployeeSubmitValues:function(){return ui},normalizeSkillSettings:function(){return uo},default:function(){return uy},isAIEmployeeUsernameConflictError:function(){return z},EMPLOYEE_PROMPT_VARIABLE_NAMESPACES:function(){return M},KnowledgeBaseSettings:function(){return uC},updateAIEmployeeEnabled:function(){return J},EmployeesPage:function(){return uf},moveAIEmployee:function(){return q},createInitialEmployeeValues:function(){return ue}});var n=t(9155),r=t.n(n),l=t(2059),a=t(7375),o=t(5428),i=t(5477),A=t(3485),E=t(7694),s=t(9488),F=t(4196),c=t(3617),D=t(9312),B=t(8666),C=t(9937),m=/^[a-zA-Z0-9_-]+$/,d=RegExp("^[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C-\\u0C5D\\u0C60-\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0-\\u0CE1\\u0CF1-\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D6FC}-\\u{1D714}\\u{1D716}-\\u{1D734}\\u{1D736}-\\u{1D74E}\\u{1D750}-\\u{1D76E}\\u{1D770}-\\u{1D788}\\u{1D78A}-\\u{1D7A8}\\u{1D7AA}-\\u{1D7C2}\\u{1D7C4}-\\u{1D7CB}\\u{1DF00}-\\u{1DF1E}\\u{1DF25}-\\u{1DF2A}\\u{1E030}-\\u{1E06D}\\u{1E100}-\\u{1E12C}\\u{1E137}-\\u{1E13D}\\u{1E14E}\\u{1E290}-\\u{1E2AD}\\u{1E2C0}-\\u{1E2EB}\\u{1E4D0}-\\u{1E4EB}\\u{1E5D0}-\\u{1E5ED}\\u{1E5F0}\\u{1E6C0}-\\u{1E6DE}\\u{1E6E0}-\\u{1E6E2}\\u{1E6E4}-\\u{1E6E5}\\u{1E6E7}-\\u{1E6ED}\\u{1E6F0}-\\u{1E6F4}\\u{1E6FE}-\\u{1E6FF}\\u{1E7E0}-\\u{1E7E6}\\u{1E7E8}-\\u{1E7EB}\\u{1E7ED}-\\u{1E7EE}\\u{1E7F0}-\\u{1E7FE}\\u{1E800}-\\u{1E8C4}\\u{1E900}-\\u{1E943}\\u{1E94B}\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1-\\u05C2\\u05C4-\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7-\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0897-\\u089F\\u08CA-\\u08E1\\u08E3-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962-\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7-\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2-\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47-\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70-\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2-\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47-\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62-\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55-\\u0C56\\u0C62-\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5-\\u0CD6\\u0CE2-\\u0CE3\\u0CF3\\u0D00-\\u0D03\\u0D3B-\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62-\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2-\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EBC\\u0EC8-\\u0ECE\\u0F18-\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F3F\\u0F71-\\u0F84\\u0F86-\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F\\u109A-\\u109D\\u135D-\\u135F\\u1712-\\u1715\\u1732-\\u1734\\u1752-\\u1753\\u1772-\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u180F\\u1885-\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F\\u1AB0-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099-\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E-\\uA69F\\uA6F0-\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880-\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C-\\uAA4D\\uAA7B-\\uAA7D\\uAAB0\\uAAB2-\\uAAB4\\uAAB7-\\uAAB8\\uAABE-\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5-\\uAAF6\\uABE3-\\uABEA\\uABEC-\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\u{101FD}\\u{102E0}\\u{10376}-\\u{1037A}\\u{10A01}-\\u{10A03}\\u{10A05}-\\u{10A06}\\u{10A0C}-\\u{10A0F}\\u{10A38}-\\u{10A3A}\\u{10A3F}\\u{10AE5}-\\u{10AE6}\\u{10D24}-\\u{10D27}\\u{10D69}-\\u{10D6D}\\u{10EAB}-\\u{10EAC}\\u{10EFA}-\\u{10EFF}\\u{10F46}-\\u{10F50}\\u{10F82}-\\u{10F85}\\u{11000}-\\u{11002}\\u{11038}-\\u{11046}\\u{11070}\\u{11073}-\\u{11074}\\u{1107F}-\\u{11082}\\u{110B0}-\\u{110BA}\\u{110C2}\\u{11100}-\\u{11102}\\u{11127}-\\u{11134}\\u{11145}-\\u{11146}\\u{11173}\\u{11180}-\\u{11182}\\u{111B3}-\\u{111C0}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111CF}\\u{1122C}-\\u{11237}\\u{1123E}\\u{11241}\\u{112DF}-\\u{112EA}\\u{11300}-\\u{11303}\\u{1133B}-\\u{1133C}\\u{1133E}-\\u{11344}\\u{11347}-\\u{11348}\\u{1134B}-\\u{1134D}\\u{11357}\\u{11362}-\\u{11363}\\u{11366}-\\u{1136C}\\u{11370}-\\u{11374}\\u{113B8}-\\u{113C0}\\u{113C2}\\u{113C5}\\u{113C7}-\\u{113CA}\\u{113CC}-\\u{113D0}\\u{113D2}\\u{113E1}-\\u{113E2}\\u{11435}-\\u{11446}\\u{1145E}\\u{114B0}-\\u{114C3}\\u{115AF}-\\u{115B5}\\u{115B8}-\\u{115C0}\\u{115DC}-\\u{115DD}\\u{11630}-\\u{11640}\\u{116AB}-\\u{116B7}\\u{1171D}-\\u{1172B}\\u{1182C}-\\u{1183A}\\u{11930}-\\u{11935}\\u{11937}-\\u{11938}\\u{1193B}-\\u{1193E}\\u{11940}\\u{11942}-\\u{11943}\\u{119D1}-\\u{119D7}\\u{119DA}-\\u{119E0}\\u{119E4}\\u{11A01}-\\u{11A0A}\\u{11A33}-\\u{11A39}\\u{11A3B}-\\u{11A3E}\\u{11A47}\\u{11A51}-\\u{11A5B}\\u{11A8A}-\\u{11A99}\\u{11B60}-\\u{11B67}\\u{11C2F}-\\u{11C36}\\u{11C38}-\\u{11C3F}\\u{11C92}-\\u{11CA7}\\u{11CA9}-\\u{11CB6}\\u{11D31}-\\u{11D36}\\u{11D3A}\\u{11D3C}-\\u{11D3D}\\u{11D3F}-\\u{11D45}\\u{11D47}\\u{11D8A}-\\u{11D8E}\\u{11D90}-\\u{11D91}\\u{11D93}-\\u{11D97}\\u{11EF3}-\\u{11EF6}\\u{11F00}-\\u{11F01}\\u{11F03}\\u{11F34}-\\u{11F3A}\\u{11F3E}-\\u{11F42}\\u{11F5A}\\u{13440}\\u{13447}-\\u{13455}\\u{1611E}-\\u{1612F}\\u{16AF0}-\\u{16AF4}\\u{16B30}-\\u{16B36}\\u{16F4F}\\u{16F51}-\\u{16F87}\\u{16F8F}-\\u{16F92}\\u{16FE4}\\u{16FF0}-\\u{16FF1}\\u{1BC9D}-\\u{1BC9E}\\u{1CF00}-\\u{1CF2D}\\u{1CF30}-\\u{1CF46}\\u{1D165}-\\u{1D169}\\u{1D16D}-\\u{1D172}\\u{1D17B}-\\u{1D182}\\u{1D185}-\\u{1D18B}\\u{1D1AA}-\\u{1D1AD}\\u{1D242}-\\u{1D244}\\u{1DA00}-\\u{1DA36}\\u{1DA3B}-\\u{1DA6C}\\u{1DA75}\\u{1DA84}\\u{1DA9B}-\\u{1DA9F}\\u{1DAA1}-\\u{1DAAF}\\u{1E000}-\\u{1E006}\\u{1E008}-\\u{1E018}\\u{1E01B}-\\u{1E021}\\u{1E023}-\\u{1E024}\\u{1E026}-\\u{1E02A}\\u{1E08F}\\u{1E130}-\\u{1E136}\\u{1E2AE}\\u{1E2EC}-\\u{1E2EF}\\u{1E4EC}-\\u{1E4EF}\\u{1E5EE}-\\u{1E5EF}\\u{1E6E3}\\u{1E6E6}\\u{1E6EE}-\\u{1E6EF}\\u{1E6F5}\\u{1E8D0}-\\u{1E8D6}\\u{1E944}-\\u{1E94A}\\u{E0100}-\\u{E01EF}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9} ._'’()&\xb7-]+$","u"),f=function(u){return u.trim()},p=function(u,e){return u.length>0&&Array.from(u).length<=e},y=function(u){var e=f(u);return p(e,64)&&m.test(e)},g=function(u){var e=f(u);return p(e,64)&&d.test(e)&&RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C-\\u0C5D\\u0C60-\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0-\\u0CE1\\u0CF1-\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D6FC}-\\u{1D714}\\u{1D716}-\\u{1D734}\\u{1D736}-\\u{1D74E}\\u{1D750}-\\u{1D76E}\\u{1D770}-\\u{1D788}\\u{1D78A}-\\u{1D7A8}\\u{1D7AA}-\\u{1D7C2}\\u{1D7C4}-\\u{1D7CB}\\u{1DF00}-\\u{1DF1E}\\u{1DF25}-\\u{1DF2A}\\u{1E030}-\\u{1E06D}\\u{1E100}-\\u{1E12C}\\u{1E137}-\\u{1E13D}\\u{1E14E}\\u{1E290}-\\u{1E2AD}\\u{1E2C0}-\\u{1E2EB}\\u{1E4D0}-\\u{1E4EB}\\u{1E5D0}-\\u{1E5ED}\\u{1E5F0}\\u{1E6C0}-\\u{1E6DE}\\u{1E6E0}-\\u{1E6E2}\\u{1E6E4}-\\u{1E6E5}\\u{1E6E7}-\\u{1E6ED}\\u{1E6F0}-\\u{1E6F4}\\u{1E6FE}-\\u{1E6FF}\\u{1E7E0}-\\u{1E7E6}\\u{1E7E8}-\\u{1E7EB}\\u{1E7ED}-\\u{1E7EE}\\u{1E7F0}-\\u{1E7FE}\\u{1E800}-\\u{1E8C4}\\u{1E900}-\\u{1E943}\\u{1E94B}\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}]","u").test(e)};function b(u,e){(null==e||e>u.length)&&(e=u.length);for(var t=0,n=Array(e);t<e;t++)n[t]=u[t];return n}function h(u,e,t,n,r,l,a){try{var o=u[l](a),i=o.value}catch(u){t(u);return}o.done?e(i):Promise.resolve(i).then(n,r)}function v(u){return function(){var e=this,t=arguments;return new Promise(function(n,r){var l=u.apply(e,t);function a(u){h(l,n,r,a,o,"next",u)}function o(u){h(l,n,r,a,o,"throw",u)}a(void 0)})}}function k(u){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable}))),n.forEach(function(e){var n;n=t[e],e in u?Object.defineProperty(u,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):u[e]=n})}return u}function S(u,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(e)):(function(u){var e=Object.keys(u);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(u);e.push.apply(e,t)}return e})(Object(e)).forEach(function(t){Object.defineProperty(u,t,Object.getOwnPropertyDescriptor(e,t))}),u}function w(u,e){return function(u){if(Array.isArray(u))return u}(u)||function(u,e){var t,n,r=null==u?null:"u">typeof Symbol&&u[Symbol.iterator]||u["@@iterator"];if(null!=r){var l=[],a=!0,o=!1;try{for(r=r.call(u);!(a=(t=r.next()).done)&&(l.push(t.value),!e||l.length!==e);a=!0);}catch(u){o=!0,n=u}finally{try{a||null==r.return||r.return()}finally{if(o)throw n}}return l}}(u,e)||x(u,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(u){return function(u){if(Array.isArray(u))return b(u)}(u)||function(u){if("u">typeof Symbol&&null!=u[Symbol.iterator]||null!=u["@@iterator"])return Array.from(u)}(u)||x(u)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(u,e){if(u){if("string"==typeof u)return b(u,e);var t=Object.prototype.toString.call(u).slice(8,-1);if("Object"===t&&u.constructor&&(t=u.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(u,e)}}function T(u,e){var t,n,r,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),o=Object.defineProperty;return o(a,"next",{value:i(0)}),o(a,"throw",{value:i(1)}),o(a,"return",{value:i(2)}),"function"==typeof Symbol&&o(a,Symbol.iterator,{value:function(){return this}}),a;function i(o){return function(i){var A=[o,i];if(t)throw TypeError("Generator is already executing.");for(;a&&(a=0,A[0]&&(l=0)),l;)try{if(t=1,n&&(r=2&A[0]?n.return:A[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,A[1])).done)return r;switch(n=0,r&&(A=[2&A[0],r.value]),A[0]){case 0:case 1:r=A;break;case 4:return l.label++,{value:A[1],done:!1};case 5:l.label++,n=A[1],A=[0];continue;case 7:A=l.ops.pop(),l.trys.pop();continue;default:if(!(r=(r=l.trys).length>0&&r[r.length-1])&&(6===A[0]||2===A[0])){l=0;continue}if(3===A[0]&&(!r||A[1]>r[0]&&A[1]<r[3])){l.label=A[1];break}if(6===A[0]&&l.label<r[1]){l.label=r[1],r=A;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(A);break}r[2]&&l.ops.pop(),l.trys.pop();continue}A=e.call(u,l)}catch(u){A=[6,u],n=0}finally{t=r=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}}}function P(){var u,e,t=(u=["\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n\n .ant-spin-nested-loading,\n .ant-spin-container,\n .ant-table,\n .ant-table-container {\n min-height: 0;\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n\n .ant-table-content {\n flex: 1;\n min-height: 0;\n }\n\n .ant-table-body {\n flex: 1;\n min-height: 0;\n }\n\n .ant-table-thead > tr > th {\n white-space: nowrap;\n }\n\n .ant-pagination {\n flex: 0 0 auto;\n }\n"],e||(e=u.slice(0)),Object.freeze(Object.defineProperties(u,{raw:{value:Object.freeze(e)}})));return P=function(){return t},t}var O=Object.keys(F.B)[0],L="sort",M=["user","roleName","locale","now","timestamp"],j=function(u){return"".concat(u,":")},R=(0,i.css)(P()),K=function(u){return null!==u&&(void 0===u?"undefined":u&&"u">typeof Symbol&&u.constructor===Symbol?"symbol":typeof u)=="object"&&!Array.isArray(u)},z=function(u){if(!K(u)||!K(u.response)||!K(u.response.data))return!1;var e=u.response.data.errors;return Array.isArray(e)&&e.some(function(u){return K(u)&&"AI_EMPLOYEE_USERNAME_CONFLICT"===u.code})},W=function(u){var e;if(K(u))return null==(e=u.data)?void 0:e.data},_=function(u){if(!K(u))return{};var e=u.data;return K(e)?e:{}},V=function(u){return K(u)&&"string"==typeof u.username},G=function(u){return K(u)&&"string"==typeof u.key&&"string"==typeof u.name},U=function(u,e,t,n){return v(function(){var r;return T(this,function(l){if("function"!=typeof(r=u.resource(e)[t]))throw Error("Missing resource action: ".concat(e,".").concat(t));return[2,r(n)]})})()},H=function(u,e){var t=S(k({},u),{username:f(u.username),nickname:"string"==typeof u.nickname?f(u.nickname):u.nickname});return e.edit&&("system"===u._aboutMode&&(t.about=null),delete t._aboutMode,delete t.enabled),t};function N(u,e){return v(function(){var t,n,r;return T(this,function(l){switch(l.label){case 0:return[4,U(u,"aiEmployees","list",{page:e.page,pageSize:e.pageSize,filter:{category:e.category},sort:[L]})];case 1:return n=W(t=l.sent()),r=_(t),[2,{data:Array.isArray(n)?n.filter(V):[],total:"number"==typeof r.count?r.count:void 0}]}})})()}function q(u,e,t){return v(function(){return T(this,function(n){switch(n.label){case 0:return[4,U(u,"aiEmployees","move",{sourceId:e,targetId:t,sortField:L})];case 1:return n.sent(),[2]}})})()}function Y(u,e){return v(function(){return T(this,function(t){switch(t.label){case 0:return[4,U(u,"aiEmployees","create",{values:H(e,{edit:!1})})];case 1:return t.sent(),[2]}})})()}function X(u,e){return v(function(){return T(this,function(t){switch(t.label){case 0:if(!e.username)throw Error("Missing AI employee username.");return[4,U(u,"aiEmployees","update",{values:H(e,{edit:!0}),filterByTk:e.username})];case 1:return t.sent(),[2]}})})()}function $(u,e){return v(function(){return T(this,function(t){switch(t.label){case 0:return[4,U(u,"aiEmployees","destroy",{filterByTk:e})];case 1:return t.sent(),[2]}})})()}function J(u,e,t){return v(function(){return T(this,function(n){switch(n.label){case 0:return[4,U(u,"aiEmployees","update",{filterByTk:e,values:{enabled:t}})];case 1:return n.sent(),[2]}})})()}function Q(u){return v(function(){var e;return T(this,function(t){switch(t.label){case 0:return[4,U(u,"aiSettings","isKnowledgeBaseEnabled")];case 1:return[2,K(e=W(t.sent()))&&!0===e.enabled]}})})()}function Z(u){return v(function(){var e;return T(this,function(t){switch(t.label){case 0:return[4,U(u,"aiKnowledgeBase","list",{fields:["key","name"],filter:{enabled:!0}})];case 1:return[2,Array.isArray(e=W(t.sent()))?e.filter(G):[]]}})})()}var uu=function(u,e){return S(k({},null!=u?u:{}),{retrievalStrategy:(null==u?void 0:u.retrievalStrategy)==="onDemand"?"onDemand":e})},ue=function(u){return{username:(0,E.randomId)(),enabled:!0,enableKnowledgeBase:!1,knowledgeBase:{knowledgeBaseKeys:[],topK:3,score:"0.6",retrievalStrategy:"onDemand"},knowledgeBasePrompt:u("knowledge Base Prompt default"),avatar:O,builtIn:!1,category:"business"}},ut=function(u){var e=u.disabled,t=u.value,a=u.onChange,o=l.theme.useToken().token,i=t||O,A=(0,n.useMemo)(function(){return Object.keys(F.B).map(function(u){return{seed:u,uri:(0,F.H)(u)}})},[]);return r().createElement(r().Fragment,null,r().createElement("div",{style:{marginBottom:o.marginLG+o.margin}},r().createElement(l.Avatar,{size:2*o.controlHeightLG+o.paddingSM+2*o.lineWidth,src:(0,F.H)(i)})),e?null:r().createElement(l.List,{grid:{gutter:o.margin,column:10},dataSource:A,renderItem:function(u){return r().createElement(l.List.Item,null,r().createElement("button",{"aria-label":u.seed,type:"button",onClick:function(){return null==a?void 0:a(u.seed)},onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),null==a||a(u.seed))},style:{background:"transparent",borderColor:i===u.seed?o.colorPrimary:"transparent",borderStyle:"solid",borderWidth:2*o.lineWidth,borderRadius:"50%",cursor:"pointer",display:"inline-flex",padding:0}},r().createElement(l.Avatar,{size:o.controlHeightLG+o.paddingSM+2*o.lineWidth,src:u.uri})))}}))},un=function(u){var e=u.edit,t=u.builtIn,n=(0,s.kj)();return r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"username",label:j(n("Username")),rules:[{required:!0,whitespace:!0},{validator:function(u,e){return"string"==typeof e&&y(e)?Promise.resolve():Promise.reject(Error(n("Use 1-64 letters, numbers, underscores, or hyphens.")))}}],preserve:!0},r().createElement(l.Input,{disabled:e})),r().createElement(l.Form.Item,{name:"nickname",label:j(n("Nickname")),rules:[{required:!0,whitespace:!0},{validator:function(u,e){return"string"==typeof e&&g(e)?Promise.resolve():Promise.reject(Error(n("Use 1-64 letters, numbers, spaces, or . _ - ' ( ) & \xb7.")))}}],preserve:!0},r().createElement(l.Input,{disabled:t})),r().createElement(l.Form.Item,{name:"position",label:j(n("Position")),extra:n("Position description"),preserve:!0},r().createElement(l.Input,{disabled:t,placeholder:n("Position placeholder")})),r().createElement(l.Form.Item,{name:"avatar",label:j(n("Avatar")),preserve:!0},r().createElement(ut,{disabled:t})),r().createElement(l.Form.Item,{name:"bio",label:j(n("Bio")),preserve:!0},r().createElement(l.Input.TextArea,{disabled:t,placeholder:n("Bio placeholder")})),r().createElement(l.Form.Item,{name:"greeting",label:j(n("Greeting message")),preserve:!0},r().createElement(l.Input.TextArea,{disabled:t,placeholder:n("Greeting message placeholder")})))},ur=function(u){var e,t=u.builtIn,a=u.record,o=(0,s.kj)(),i=l.theme.useToken().token,E=l.Form.useFormInstance(),F=null!=(e=l.Form.useWatch("_aboutMode",E))?e:(null==a?void 0:a.about)?"custom":"system";return(0,n.useEffect)(function(){t&&!E.getFieldValue("_aboutMode")&&E.setFieldValue("_aboutMode",(null==a?void 0:a.about)?"custom":"system")},[t,E,null==a?void 0:a.about]),r().createElement(r().Fragment,null,r().createElement(l.Alert,{message:o("Role setting description"),type:"info",showIcon:!0}),t?r().createElement(l.Form.Item,{name:"_aboutMode",preserve:!0},r().createElement(l.Radio.Group,null,r().createElement(l.Radio,{value:"system"},o("System default")),r().createElement(l.Radio,{value:"custom"},o("Custom")))):null,t&&"system"===F?r().createElement(l.Typography.Paragraph,{copyable:!0,style:{backgroundColor:i.colorFillQuaternary,borderColor:i.colorBorder,borderRadius:i.borderRadius,borderStyle:"solid",borderWidth:i.lineWidth,margin:0,maxHeight:12*i.controlHeightLG,overflowY:"auto",paddingBlock:i.paddingSM,paddingInline:i.padding,whiteSpace:"pre-wrap",wordBreak:"break-word"}},(null==a?void 0:a.defaultPrompt)||""):r().createElement(l.Form.Item,{name:"about",label:j(o("Role setting")),preserve:!0},r().createElement(A.VariableTextArea,{namespaces:M,placeholder:o("Role setting placeholder"),rows:15})))},ul=function(u){return K(u)?u:{}},ua=function(u){return"string"==typeof u?{name:u,autoCall:!1}:K(u)&&"string"==typeof u.name?{name:u.name,autoCall:!0===u.autoCall}:void 0},uo=function(u){return K(u)?{skills:Array.isArray(u.skills)?u.skills.filter(function(u){return"string"==typeof u}):[],tools:Array.isArray(u.tools)?u.tools.map(ua).filter(function(u){return!!u}):[]}:{}},ui=function(u,e){var t=S(k({},u),{skillSettings:uo(e.skillSettings)});return K(e.modelSettings)&&(t.modelSettings=ul(e.modelSettings)),e.knowledgeBase&&(t.knowledgeBase=e.knowledgeBase),"string"==typeof e.knowledgeBasePrompt&&(t.knowledgeBasePrompt=e.knowledgeBasePrompt),t},uA=function(){var u=(0,c.M)(),e=w((0,n.useState)(!1),2),t=e[0],r=e[1];return(0,n.useEffect)(function(){var e=!1;return v(function(){return T(this,function(t){switch(t.label){case 0:r(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,u.getLLMServices()];case 2:return t.sent(),[3,5];case 3:return console.error(t.sent()),[3,5];case 4:return e||r(!1),[7];case 5:return[2]}})})().catch(function(u){console.error(u)}),function(){e=!0}},[u]),{services:u.llmServices,loading:t||u.llmServicesLoading}},uE=(0,E.observer)(function(){var u=(0,s.kj)(),e=l.Form.useFormInstance(),t=l.Form.useWatch("modelSettings",{form:e,preserve:!0}),a=w((0,n.useState)(function(){return ul(e.getFieldValue("modelSettings"))}),2),o=a[0],i=a[1],A=uA(),E=A.services,F=A.loading,c=!!o.enabled,D=(0,n.useMemo)(function(){var u=Array.isArray(o.models)?o.models:[];if(u.length)return u.map(C.Wm).filter(function(u){return!!u});var e=(0,C.Wm)(o);return e?[e]:[]},[o]),B=(0,n.useCallback)(function(u){var t=k({},ul(e.getFieldValue("modelSettings")),u);i(t),e.setFieldsValue({modelSettings:t})},[e]);return(0,n.useEffect)(function(){i(ul(t))},[t]),(0,n.useEffect)(function(){if(c&&!D.length&&E.length){var u=E[0],e=null==u?void 0:u.enabledModels[0],t=u&&e?"".concat(u.llmService,":").concat(e.value):void 0;t&&B({models:[(0,C.JC)(t)]})}},[c,D.length,E,B]),r().createElement(r().Fragment,null,r().createElement(l.Alert,{type:"info",showIcon:!0,message:u("Restrict this AI employee to the selected models.")}),r().createElement(l.Form.Item,{label:r().createElement(l.Typography.Text,{strong:!0},j(u("Enable dedicated model configuration"))),preserve:!0},r().createElement(l.Switch,{checked:c,onChange:function(u){return B({enabled:u})}})),r().createElement(l.Form.Item,{label:r().createElement(l.Typography.Text,{strong:!0},j(u("Models"))),preserve:!0},r().createElement(C.AE,{disabled:!c,loading:F,placeholder:u("Select models"),services:E,value:D,onChange:function(u){u.length?B({llmService:void 0,model:void 0,models:u.map(C.JC)}):B({llmService:void 0,model:void 0,models:[]})}})))}),us=function(){var u=(0,s.kj)();return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e?u(e):t}},uF=function(u){var e=u.title,t=u.description,n=l.theme.useToken().token;return r().createElement("div",null,r().createElement("div",{style:{fontWeight:n.fontWeightStrong,fontSize:n.fontSizeSM}},e),r().createElement("div",{style:{color:n.colorTextSecondary,fontSize:n.fontSizeSM}},t))},uc=(0,E.observer)(function(u){var e=u.builtIn,t=(0,s.kj)(),o=l.theme.useToken().token,i=us(),A=(0,c.M)(),E=l.Form.useFormInstance(),F=uo(l.Form.useWatch("skillSettings",{form:E,preserve:!0})),D=Array.isArray(F.skills)?F.skills:[],B=w((0,n.useState)(e&&!D.length?[]:["custom-skills"]),2),C=B[0],m=B[1],d=r().useRef(D.length);(0,n.useEffect)(function(){A.getAISkills().catch(function(u){console.error(u)})},[A]);var f=function(u){var e=uo(E.getFieldValue("skillSettings"));E.setFieldsValue({skillSettings:S(k({},e),{skills:u})})},p=new Set(D),y=new Map(A.aiSkills.map(function(u){return[u.name,u]})),g=A.aiSkills.filter(function(u){return"GENERAL"===u.scope}),b=D.map(function(u){return y.get(u)}).filter(function(u){return!!u&&"SPECIFIED"===u.scope}),h=A.aiSkills.filter(function(u){return"CUSTOM"===u.scope}),v=D.filter(function(u){var e=y.get(u);return!e||"CUSTOM"===e.scope});(0,n.useEffect)(function(){var u=0===d.current;e&&0===v.length?m([]):u&&v.length>0&&m(["custom-skills"]),d.current=v.length},[e,v.length]);var x=h.filter(function(u){return!p.has(u.name)}).map(function(u){var e,t;return{key:u.name,label:r().createElement("div",{style:{maxWidth:8*o.controlHeightLG,minWidth:4*o.controlHeightLG}},r().createElement("div",null,i(null!=(e=u.title)?e:u.name,u.name)),r().createElement(l.Typography.Text,{type:"secondary"},i(null!=(t=u.about)?t:u.description))),onClick:function(){var e=uo(E.getFieldValue("skillSettings")),t=Array.isArray(e.skills)?e.skills:[];t.includes(u.name)||f(I(t).concat([u.name]))}}}),T=function(u){var e,t;return r().createElement(l.List.Item,{key:u.name},r().createElement("div",null,i(null!=(e=u.title)?e:u.name,u.name)),r().createElement(l.Typography.Text,{type:"secondary"},i(null!=(t=u.about)?t:u.description)))},P=[{key:"general-skills",label:r().createElement(uF,{title:t("General skills"),description:t("Shared by all AI employees.")}),children:r().createElement(l.List,{itemLayout:"vertical",size:"small",dataSource:g,renderItem:T})}];return e&&b.length&&P.push({key:"specific-skills",label:r().createElement(uF,{title:t("Employee-specific skills"),description:t("Only available to this AI employee.")}),children:r().createElement(l.List,{itemLayout:"vertical",size:"small",dataSource:b,renderItem:T})}),h.length&&P.push({key:"custom-skills",label:r().createElement(uF,{title:t("Custom skills"),description:t("Can be added to or removed from this AI employee.")}),extra:r().createElement("div",{onClick:function(u){u.stopPropagation()},onKeyDown:function(u){u.stopPropagation()}},r().createElement(l.Dropdown,{menu:{items:x},disabled:!x.length,placement:"bottomRight"},r().createElement(l.Button,{type:"primary",icon:r().createElement(a.PlusOutlined,null),disabled:!x.length,style:{pointerEvents:x.length?void 0:"none"}},t("Add skill")))),children:r().createElement(l.List,{itemLayout:"vertical",bordered:!0,dataSource:v,renderItem:function(u){var e,n,o=y.get(u),A=o?i(null!=(e=o.title)?e:o.name,o.name):u,E=o?i(null!=(n=o.about)?n:o.description):null;return r().createElement(l.List.Item,{key:u,extra:r().createElement(l.Button,{"aria-label":t("Delete"),icon:r().createElement(a.DeleteOutlined,null),type:"text",onClick:function(){f(D.filter(function(e){return e!==u}))}})},r().createElement("div",null,A),E?r().createElement(l.Typography.Text,{type:"secondary"},E):null)}})}),A.aiSkillsLoading?r().createElement(l.Spin,null):r().createElement(l.Collapse,{ghost:!0,size:"small",activeKey:C,onChange:function(u){return m(Array.isArray(u)?u.map(String):[String(u)])},items:P})}),uD=function(u,e){return"CUSTOM"===u.scope?(null==e?void 0:e.autoCall)?"ALLOW":"ASK":"ALLOW"===u.defaultPermission?"ALLOW":"ASK"},uB=(0,E.observer)(function(u){var e=u.builtIn,t=(0,s.kj)(),o=l.theme.useToken().token,i=us(),A=(0,c.M)(),E=l.Form.useFormInstance(),F=l.Form.useWatch("skillSettings",{form:E,preserve:!0}),D=w((0,n.useState)(function(){return uo(E.getFieldValue("skillSettings"))}),2),B=D[0],C=D[1],m=Array.isArray(B.tools)?B.tools:[],d=w((0,n.useState)(e&&!m.length?[]:["custom-tools"]),2),f=d[0],p=d[1],y=r().useRef(m.length),g=[{label:t("Ask"),value:"ASK"},{label:t("Allow"),value:"ALLOW"}];(0,n.useEffect)(function(){A.refreshAITools().catch(function(u){console.error(u)})},[A]),(0,n.useEffect)(function(){C(uo(F))},[F]);var b=function(u){var e=S(k({},uo(E.getFieldValue("skillSettings"))),{tools:u});C(e),E.setFieldsValue({skillSettings:e})},h=new Set(m.map(function(u){return u.name})),v=new Map(A.aiTools.map(function(u){return[u.definition.name,u]})),x=A.aiTools.filter(function(u){return"GENERAL"===u.scope&&"loader"===u.from}),T=m.filter(function(u){var e=v.get(u.name);return e&&"GENERAL"!==e.scope&&"CUSTOM"!==e.scope}),P=m.filter(function(u){var e=v.get(u.name);return!e||"CUSTOM"===e.scope});(0,n.useEffect)(function(){var u=0===y.current;e&&0===P.length?p([]):u&&P.length>0&&p(["custom-tools"]),y.current=P.length},[e,P.length]);var O=A.aiTools.filter(function(u){return"CUSTOM"===u.scope&&!h.has(u.definition.name)}).map(function(u){var e,t,n,a;return{key:u.definition.name,label:r().createElement("div",{style:{maxWidth:8*o.controlHeightLG,minWidth:4*o.controlHeightLG}},r().createElement(l.Flex,{justify:"space-between"},r().createElement("div",null,i(null!=(e=null==(n=u.introduction)?void 0:n.title)?e:u.definition.name,u.definition.name))),r().createElement(l.Typography.Text,{type:"secondary"},i(null!=(t=null==(a=u.introduction)?void 0:a.about)?t:u.definition.description))),onClick:function(){var e=uo(E.getFieldValue("skillSettings")),t=Array.isArray(e.tools)?e.tools:[];t.some(function(e){return e.name===u.definition.name})||b(I(t).concat([{name:u.definition.name,autoCall:!1}]))}}}),L=function(u){var e,n,a,o,A="definition"in u?u:v.get(u.name);if(!A)return null;var E="definition"in u?void 0:u;return r().createElement(l.List.Item,{key:A.definition.name,extra:r().createElement(l.Flex,{vertical:!0,justify:"end"},r().createElement(l.Space,null,r().createElement(l.Typography.Text,{type:"secondary"},t("Permission")),r().createElement(l.Segmented,{size:"small",options:g,value:uD(A,E),disabled:!0})))},r().createElement("div",null,i(null!=(e=null==(a=A.introduction)?void 0:a.title)?e:A.definition.name,A.definition.name)),r().createElement(l.Typography.Text,{type:"secondary"},i(null!=(n=null==(o=A.introduction)?void 0:o.about)?n:A.definition.description)))},M=[{key:"general-tools",label:r().createElement(uF,{title:t("General tools"),description:t("Shared by all AI employees.")}),children:r().createElement(l.List,{itemLayout:"vertical",size:"small",dataSource:x,renderItem:L})}];return e&&T.length&&M.push({key:"specific-tools",label:r().createElement(uF,{title:t("Employee-specific tools"),description:t("Only available to this AI employee.")}),children:r().createElement(l.List,{itemLayout:"vertical",size:"small",dataSource:T,renderItem:L})}),M.push({key:"custom-tools",label:r().createElement(uF,{title:t("Custom tools"),description:t("Created by workflow. You can add/remove and set default permissions.")}),extra:r().createElement("div",{onClick:function(u){u.stopPropagation()},onKeyDown:function(u){u.stopPropagation()}},r().createElement(l.Dropdown,{menu:{items:O},disabled:!(null==O?void 0:O.length),placement:"bottomRight"},r().createElement(l.Button,{type:"primary",icon:r().createElement(a.PlusOutlined,null),disabled:!(null==O?void 0:O.length),style:{pointerEvents:(null==O?void 0:O.length)?void 0:"none"}},t("Add tool")))),children:r().createElement(l.List,{itemLayout:"vertical",bordered:!0,dataSource:P,renderItem:function(u){var e,n,o,A,E=v.get(u.name),s=E?i(null!=(e=null==(o=E.introduction)?void 0:o.title)?e:E.definition.name,E.definition.name):u.name,F=E?i(null!=(n=null==(A=E.introduction)?void 0:A.about)?n:E.definition.description):null;return r().createElement(l.List.Item,{key:u.name,extra:r().createElement(l.Space,null,r().createElement(l.Typography.Text,null,t("Permission")),r().createElement(l.Segmented,{size:"small",options:g,value:E?uD(E,u):u.autoCall?"ALLOW":"ASK",onChange:function(e){b(m.map(function(t){return t.name===u.name?S(k({},t),{autoCall:"ALLOW"===e}):t}))}}),r().createElement(l.Button,{"aria-label":t("Delete"),icon:r().createElement(a.DeleteOutlined,null),type:"text",onClick:function(){b(m.filter(function(e){return e.name!==u.name}))}}))},r().createElement("div",null,s),F?r().createElement(l.Typography.Text,{type:"secondary"},F):null)}})}),A.aiToolsLoading?r().createElement(l.Spin,null):r().createElement(l.Collapse,{ghost:!0,size:"small",activeKey:f,onChange:function(u){return p(Array.isArray(u)?u.map(String):[String(u)])},items:M})}),uC=function(u){var e=u.apiClient,t=(0,s.kj)(),a=l.Form.useFormInstance(),o=l.Form.useWatch("enableKnowledgeBase",a),i=w((0,n.useState)([]),2),A=i[0],E=i[1],F=w((0,n.useState)(!1),2),c=F[0],D=F[1];return(0,n.useEffect)(function(){var u=!1;return v(function(){var t;return T(this,function(n){switch(n.label){case 0:D(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,Z(e)];case 2:return t=n.sent(),u||E(t),[3,5];case 3:return console.error(n.sent()),[3,5];case 4:return u||D(!1),[7];case 5:return[2]}})})().catch(function(u){console.error(u)}),function(){u=!0}},[e]),r().createElement(r().Fragment,null,r().createElement(l.Form.Item,{name:"enableKnowledgeBase",label:j(t("Enable Knowledge Base")),valuePropName:"checked",preserve:!0},r().createElement(l.Switch,null)),r().createElement(l.Form.Item,{name:["knowledgeBase","knowledgeBaseKeys"],label:j(t("Knowledge Base")),extra:t("Actual retrieval is limited to knowledge bases accessible to the roles of the user using this AI employee. Inaccessible knowledge bases are excluded."),preserve:!0},r().createElement(l.Select,{disabled:!o,fieldNames:{label:"name",value:"key"},loading:c,mode:"multiple",placeholder:t("Leave blank to retrieve from all knowledge bases"),options:A})),r().createElement(l.Form.Item,{name:["knowledgeBase","retrievalStrategy"],label:j(t("Retrieval strategy")),preserve:!0},r().createElement(l.Radio.Group,{disabled:!o,"aria-label":t("Retrieval strategy")},r().createElement(l.Space,{direction:"vertical"},r().createElement(l.Radio,{value:"onDemand"},r().createElement(l.Space,{direction:"vertical",size:0},r().createElement("span",null,t("Retrieve on demand")),r().createElement(l.Typography.Text,{type:"secondary"},t("The AI employee retrieves knowledge-base content only when it determines that it is needed.")))),r().createElement(l.Radio,{value:"always"},r().createElement(l.Space,{direction:"vertical",size:0},r().createElement("span",null,t("Automatically retrieve for every question")),r().createElement(l.Typography.Text,{type:"secondary"},t("Retrieve before every user question, then answer with the retrieved content."))))))),r().createElement(l.Form.Item,{name:"knowledgeBasePrompt",label:j(t("Knowledge Base Prompt")),extra:t("Include {knowledgeBaseData} in the prompt to insert the retrieved knowledge-base content."),rules:[{required:!0},{validator:function(u,e){return!o||"string"==typeof e&&e.includes("{knowledgeBaseData}")?Promise.resolve():Promise.reject(Error(t("The Knowledge Base Prompt must include {knowledgeBaseData} before you can save it.")))}}],preserve:!0},r().createElement(l.Input.TextArea,{disabled:!o,autoSize:{minRows:5}})),r().createElement(l.Form.Item,{name:["knowledgeBase","topK"],label:j(t("Top K")),extra:t("Maximum number of knowledge-base entries returned for each retrieval."),rules:[{required:!0}],preserve:!0},r().createElement(l.InputNumber,{disabled:!o,min:1,max:100})),r().createElement(l.Form.Item,{name:["knowledgeBase","score"],label:j(t("Score")),extra:t("Minimum similarity score for knowledge-base content to be included in retrieval results."),rules:[{required:!0}],preserve:!0},r().createElement(l.InputNumber,{disabled:!o,min:0,max:1,step:.1})))},um=function(u){var e,t=u.apiClient,n=u.activeTab,a=u.edit,o=u.onTabChange,i=u.record,A=u.knowledgeBaseEnabled,E=(0,s.kj)(),F=l.Form.useFormInstance(),c=null!=(e=l.Form.useWatch("chatSettings",F))?e:{},D=!!(null==i?void 0:i.builtIn),B=!1!==c.enableSkills,C=!1!==c.enableTools;return r().createElement(l.Tabs,{activeKey:n,onChange:o,items:[{key:"profile",label:E("Profile"),children:r().createElement(un,{edit:a,builtIn:D}),forceRender:!0},{key:"roleSetting",label:E("Role setting"),children:r().createElement(ur,{builtIn:D,record:i}),forceRender:!0},{key:"modelSettings",label:E("Model settings"),children:r().createElement(uE,null),forceRender:!0}].concat(I(B?[{key:"skills",label:E("Skills"),children:r().createElement(uc,{builtIn:D}),forceRender:!0}]:[]),I(C?[{key:"tools",label:E("Tools"),children:r().createElement(uB,{builtIn:D}),forceRender:!0}]:[]),I(A?[{key:"knowledgeBase",label:E("KnowledgeBase"),children:r().createElement(uC,{apiClient:t}),forceRender:!0}]:[]))})},ud=function(u){var e=u.record,t=u.onUpdated,a=(0,A.useApp)(),o=(0,s.kj)(),i=l.App.useApp().message,E=(0,c.M)(),F=w((0,n.useState)(!1),2),D=F[0],B=F[1];return r().createElement(l.Switch,{checked:!!e.enabled,onChange:function(u){return v(function(){return T(this,function(n){switch(n.label){case 0:B(!0),n.label=1;case 1:return n.trys.push([1,5,6,7]),[4,J(a.apiClient,e.username,u)];case 2:return n.sent(),i.success(o("Saved successfully")),[4,t()];case 3:return n.sent(),[4,E.refreshAIEmployees()];case 4:return n.sent(),[3,7];case 5:return console.error(n.sent()),i.error(o("Failed to update")),[3,7];case 6:return B(!1),[7];case 7:return[2]}})})()},loading:D,size:"small"})},uf=function(){var u=(0,A.useApp)(),e=(0,E.useFlowContext)(),t=(0,s.kj)(),i=l.theme.useToken().token,B=l.App.useApp().message,C=(0,c.M)(),m=w((0,n.useState)("business"),2),d=m[0],f=m[1],p=w((0,n.useState)([]),2),y=p[0],g=p[1],b=w((0,n.useState)(!1),2),h=b[0],k=b[1],S=w((0,n.useState)(!1),2),I=S[0],x=S[1],P=w((0,n.useState)([]),2),O=P[0],L=P[1],M=u.apiClient.auth,j=(null==M?void 0:M.role)==="root",K=(0,n.useMemo)(function(){return{color:i.colorPrimary,marginInline:-i.paddingSM,paddingBlock:i.paddingSM,paddingInlineEnd:i.paddingXS+i.paddingSM,paddingInlineStart:i.paddingSM}},[i.colorPrimary,i.paddingSM,i.paddingXS]),z=(0,n.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d;return v(function(){return T(this,function(t){switch(t.label){case 0:k(!0),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,N(u.apiClient,{category:e})];case 2:return g(t.sent().data),[3,4];case 3:return k(!1),[7];case 4:return[2]}})})()},[u.apiClient,d]);(0,n.useEffect)(function(){z().catch(function(u){console.error(u),k(!1)})},[z]),(0,n.useEffect)(function(){v(function(){return T(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,Q(u.apiClient)];case 1:return x.apply(void 0,[e.sent()]),[3,3];case 2:return console.error(e.sent()),[3,3];case 3:return[2]}})})().catch(function(u){console.error(u)})},[u.apiClient]);var W=function(u){e.viewer.open({type:"drawer",width:D.o,closable:!0,content:r().createElement(up,{editingRecord:u,knowledgeBaseEnabled:I,onSubmitted:function(){return v(function(){return T(this,function(u){switch(u.label){case 0:return[4,z()];case 1:return u.sent(),[4,C.refreshAIEmployees()];case 2:return u.sent(),[2]}})})()}})})},_=[{title:t("Avatar"),dataIndex:"avatar",render:function(u){return u?r().createElement(l.Avatar,{shape:"circle",size:"large",src:(0,F.H)(u)}):null}},{title:t("Username"),dataIndex:"username",render:function(u,e){var n=e.missingKnowledgeBaseKeys||[];return n.length?r().createElement(l.Space,{size:"small"},r().createElement("span",null,u),r().createElement(l.Tooltip,{title:t("Missing knowledge base configuration for keys: {{keys}}. Create knowledge bases with the same keys to enable this employee normally.",{keys:n.join(", ")})},r().createElement(a.ExclamationCircleOutlined,null))):u}},{title:t("Nickname"),dataIndex:"nickname"},{title:t("Position"),dataIndex:"position"},{title:t("Enabled"),dataIndex:"enabled",render:function(u,e){return r().createElement(ud,{record:e,onUpdated:function(){return z()}})}},{title:t("Actions"),key:"actions",render:function(e,n){return r().createElement(l.Space,{size:i.marginXS},r().createElement("a",{style:K,onClick:function(){return W(n)}},t("Edit")),r().createElement(l.Popconfirm,{title:t("Delete AI employee"),description:t("Are you sure you want to delete this AI employee?"),onConfirm:function(){return v(function(){return T(this,function(e){switch(e.label){case 0:if(n.builtIn&&!j)return B.warning(t("Cannot delete built-in ai employees")),[2];return[4,$(u.apiClient,n.username)];case 1:return e.sent(),B.success(t("Saved successfully")),[4,z()];case 2:return e.sent(),[4,C.refreshAIEmployees()];case 3:return e.sent(),[2]}})})()}},r().createElement("a",{style:K},t("Delete"))))}}];return r().createElement(l.Card,{style:{display:"flex",flexDirection:"column",minHeight:"100%"},styles:{body:{display:"flex",flex:1,flexDirection:"column",minHeight:0}}},r().createElement(l.Flex,{vertical:!0,gap:"middle",style:{flex:1,minHeight:0}},r().createElement(l.Flex,{justify:"space-between",wrap:"wrap",gap:"middle"},r().createElement(l.Radio.Group,{optionType:"button",value:d,options:[{label:t("Business"),value:"business"},{label:t("Developer"),value:"developer"}],onChange:function(u){return f(u.target.value)}}),r().createElement(l.Space,null,r().createElement(l.Button,{icon:r().createElement(a.ReloadOutlined,null),onClick:function(){return z()}},t("Refresh")),r().createElement(l.Button,{type:"primary",icon:r().createElement(a.PlusOutlined,null),onClick:function(){e.viewer.open({type:"drawer",width:D.o,closable:!0,content:r().createElement(up,{knowledgeBaseEnabled:I,onSubmitted:function(){return v(function(){return T(this,function(u){switch(u.label){case 0:return[4,z()];case 1:return u.sent(),[4,C.refreshAIEmployees()];case 2:return u.sent(),[2]}})})()}})})}},t("New AI employee")))),r().createElement("div",{style:{display:"flex",flex:1,flexDirection:"column",minHeight:0}},r().createElement(A.Table,{rowKey:"username",loading:h,columns:_,dataSource:y,className:R,isDraggable:!0,onSortEnd:function(e,n){return v(function(){var r,l,a;return T(this,function(i){switch(i.label){case 0:if(!e.username||!n.username||e.username===n.username)return[2];r=y,l=y.findIndex(function(u){return u.username===e.username}),a=y.findIndex(function(u){return u.username===n.username}),l>=0&&a>=0&&g((0,o.arrayMove)(y,l,a)),i.label=1;case 1:return i.trys.push([1,5,,6]),[4,q(u.apiClient,e.username,n.username)];case 2:return i.sent(),B.success(t("Saved successfully")),[4,z()];case 3:return i.sent(),[4,C.refreshAIEmployees()];case 4:return i.sent(),[3,6];case 5:return console.error(i.sent()),g(r),B.error(t("Failed to update")),[3,6];case 6:return[2]}})})()},rowSelection:{selectedRowKeys:O,onChange:L},pagination:{defaultPageSize:20,showTotal:function(u){return t("Total {{count}} items",{count:u})}},scroll:{x:"max-content",y:"100%"}}))))},up=function(u){var e=u.editingRecord,t=u.knowledgeBaseEnabled,a=u.onSubmitted,o=(0,A.useApp)(),i=(0,E.useFlowContext)(),F=(0,s.kj)(),c=l.App.useApp().message,D=w(l.Form.useForm(),1)[0],C=w((0,n.useState)(!1),2),m=C[0],d=C[1],f=w((0,n.useState)("profile"),2),p=f[0],y=f[1],g=w((0,n.useState)(!1),2),b=g[0],h=g[1],I=(0,n.useRef)();I.current||(I.current=e?S(k({},e),{knowledgeBase:uu(e.knowledgeBase,"always"),_aboutMode:e.builtIn?e.about?"custom":"system":void 0}):ue(F));var x=I.current,P=i.view,O=P.Header,L=P.Footer;(0,n.useEffect)(function(){D.setFieldsValue(x)},[D,x]);var M=(0,B.C)({view:i.view,form:D,initialValues:x,dirty:b,title:F("Unsaved changes"),content:F("Are you sure you don't want to save?")});return r().createElement(r().Fragment,null,r().createElement(O,{title:e?F("Edit AI employee"):F("New AI employee")}),r().createElement(l.Spin,{spinning:m},r().createElement(l.Form,{form:D,layout:"vertical",onFinish:function(u){return v(function(){var t,n;return T(this,function(r){switch(r.label){case 0:d(!0),r.label=1;case 1:if(r.trys.push([1,8,9,10]),t=ui(u,D.getFieldsValue(!0)),!e)return[3,3];return[4,X(o.apiClient,t)];case 2:return r.sent(),[3,5];case 3:return[4,Y(o.apiClient,t)];case 4:r.sent(),r.label=5;case 5:return c.success(F("Saved successfully")),[4,a()];case 6:return r.sent(),[4,i.view.close(void 0,!0)];case 7:return r.sent(),[3,10];case 8:if(n=r.sent(),!e&&z(n))return y("profile"),D.setFields([{name:"username",errors:[F("Username already exists")]}]),[2];throw n;case 9:return d(!1),[7];case 10:return[2]}})})()},onValuesChange:function(){return h(!0)}},r().createElement(um,{apiClient:o.apiClient,activeTab:p,edit:!!e,onTabChange:y,record:e,knowledgeBaseEnabled:t}))),r().createElement(L,null,r().createElement(l.Flex,{justify:"end",gap:"small"},r().createElement(l.Button,{onClick:M},F("Cancel")),r().createElement(l.Button,{type:"primary",loading:m,onClick:function(){return D.submit()}},F("Submit")))))},uy=uf}}]);
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["525"],{620:function(n,e,u){u.r(e),u.d(e,{AIResourceContextCollector:function(){return c}});var t=u(9155),o=u(3342),r=u(
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["525"],{620:function(n,e,u){u.r(e),u.d(e,{AIResourceContextCollector:function(){return c}});var t=u(9155),o=u(3342),r=u(1821),c=function(n){var e=n.uid,u=(0,o.useResourceActionContext)();return(0,t.useEffect)(function(){if("collections:list"===e&&"function"==typeof(null==u?void 0:u.refresh))return(0,r.I8)(function(){return u.refresh()})},[e,u]),null}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["681"],{6600:function(e,t,n){n.r(t),n.d(t,{DataModelingModal:function(){return ed}});var r=n(9155),o=n.n(r),a=n(2059),l=n(7375),i=n(4069),c=n(7251),u=n(7174),s=n(3485),f=n(9488),d=n(3397),p=n(5477),y=n(7757),m=n.n(y),b=n(809);n(7695);var v=n(842),h=/^\s*\{\{\s*t\s*\(\s*(['"])(.*?)\1(?:\s*,\s*([\s\S]*?))?\)\s*\}\}\s*$/,g=/\{\{\s*t\s*\(\s*(['"])(.*?)\1(?:\s*,\s*([\s\S]*?))?\)\s*\}\}/g;function O(e){var t=null==e?void 0:e.trim();if(t){try{var n=JSON.parse(t);return n&&(void 0===n?"undefined":n&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)=="object"&&!Array.isArray(n)?n:void 0}catch(e){}var r={},o=t.match(/(?:^|[{,\s])ns\s*:\s*(\[[\s\S]*?\])/);if(null==o?void 0:o[1]){var a,l,i=(a=o[1],l=[],a.replace(/(['"])(.*?)\1/g,function(e,t,n){return l.push(n),""}),l.length?l:void 0);i&&(r.ns=i)}else{var c=t.match(/(?:^|[{,\s])ns\s*:\s*(['"])(.*?)\1/);(null==c?void 0:c[2])&&(r.ns=c[2])}var u=t.match(/(?:^|[{,\s])nsMode\s*:\s*(['"])(.*?)\1/);return(null==u?void 0:u[2])&&(r.nsMode=u[2]),Object.keys(r).length?r:void 0}}function w(e,t){if("string"!=typeof e)return e;var n=e.match(h);return(null==n?void 0:n[2])?t(n[2],O(n[3])):e.replace(g,function(e,n,r,o){return t(r,O(o))})}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function k(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||P(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||P(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}}function A(){var e,t,n=(e=["\n width: 100%;\n height: 100%;\n svg:not(:root) {\n overflow: unset;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return A=function(){return n},n}var T=new(m()),C={collection:function(e){var t=e.data,n=a.theme.useToken().token,r=(0,s.useApp)(),i=(0,f.kj)(),c=r.dataSourceManager.collectionFieldInterfaceManager,u={top:"50%",transform:"translateY(-50%)",width:n.sizeXS,height:n.sizeXS,opacity:0,pointerEvents:"none"};return o().createElement(a.Card,{size:"small",title:o().createElement("div",{style:{position:"relative"}},o().createElement(b.h7,{type:"target",position:v.yX.Left,id:t.name,style:u}),t.title," ",o().createElement("span",{style:{fontSize:n.fontSizeSM,color:n.colorTextDescription}},t.name),o().createElement(b.h7,{type:"source",position:v.yX.Right,id:t.name,style:u})),styles:{body:{padding:0,minWidth:5*n.sizeXXL}}},o().createElement(a.List,{dataSource:t.fields,size:"small",renderItem:function(e){var r=e.interface?null==c?void 0:c.getFieldInterface(e.interface):void 0;return o().createElement(a.List.Item,{style:{position:"relative"}},o().createElement(a.Flex,{justify:"space-between",gap:n.marginLG,style:{width:"100%"}},o().createElement(b.h7,{type:"source",position:v.yX.Right,id:"".concat(t.name,"-").concat(e.name),style:u}),o().createElement(a.Flex,{vertical:!0},o().createElement("div",null,e.title,e.primaryKey?o().createElement(l.KeyOutlined,{style:{marginLeft:n.marginXXS}}):null),o().createElement("div",{style:{fontSize:n.fontSizeSM,color:n.colorTextDescription}},e.name)),o().createElement(a.Flex,{vertical:!0,align:"flex-end"},o().createElement("div",{style:{fontSize:n.fontSizeSM,color:n.colorTextSecondary}},(null==r?void 0:r.title)?w(r.title,i):""),o().createElement("div",{style:{fontSize:n.fontSizeSM,color:n.colorTextDescription}},e.type))))}}))}},M=function(e,t,n,r){var o;return(o=function(){var o,a,l,i;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(c){switch(c.label){case 0:return a=!t.length,l={id:"root",layoutOptions:{"elk.algorithm":t.length?"org.eclipse.elk.layered":"org.eclipse.elk.box"},children:e.map(function(e){var t;return k(E({},e),{targetPosition:a?"left":"top",sourcePosition:a?"right":"bottom",width:n,height:r*(((null==(t=e.data.fields)?void 0:t.length)||0)+1)})}),edges:t},[4,T.layout(l)];case 1:return[2,{nodes:(null==(o=(i=c.sent()).children)?void 0:o.map(function(e){return k(E({},e),{position:{x:e.x||0,y:e.y||0}})}))||[],edges:i.edges||[]}]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function l(e){j(a,n,r,l,i,"next",e)}function i(e){j(a,n,r,l,i,"throw",e)}l(void 0)})})()},F=function(e){var t=e.map(function(e){return k(E({},e),{fields:e.autoGenId&&!e.fields.some(function(e){return"id"===e.name})?[{name:"id",interface:"id",type:"bigInt",title:"ID",primaryKey:!0,autoIncrement:!0}].concat(I(e.fields)):I(e.fields)})}),n=new Map(t.map(function(e){return[e.name,e]})),r=new Set,o=t.map(function(e){return{id:e.name,type:"collection",position:{x:0,y:0},data:{title:e.title,name:e.name,fields:I(e.fields)}}}),a=[],l=function(e,t){var n="".concat(e,"-").concat(t),o="".concat(t,"-").concat(e);r.has(n)||r.has(o)||(a.push({id:n,source:e,sourceHandle:e,target:t,targetHandle:t,type:"smoothstep",animated:!0}),r.add(n))},i=!0,c=!1,u=void 0;try{for(var s,f=t[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var d=s.value,p=!0,y=!1,m=void 0;try{for(var b,v=d.fields[Symbol.iterator]();!(p=(b=v.next()).done);p=!0){var h=b.value,g="string"==typeof h.target?h.target:void 0,O="string"==typeof h.through?h.through:void 0;g&&g!==d.name&&("belongsToMany"===h.type&&O&&n.has(O)?(l(d.name,O),l(O,g)):l(d.name,g))}}catch(e){y=!0,m=e}finally{try{p||null==v.return||v.return()}finally{if(y)throw m}}}}catch(e){c=!0,u=e}finally{try{i||null==f.return||f.return()}finally{if(c)throw u}}return{nodes:o,edges:a}},D=function(e){var t=e.collections,n=(0,s.useGlobalTheme)().isDarkTheme,l=a.theme.useToken().token,i=x((0,b.ck)([]),3),c=i[0],u=i[1],f=i[2],d=x((0,b.fM)([]),3),y=d[0],m=d[1],v=d[2],h=(0,r.useMemo)(function(){return F(t)},[t]),g=8*l.controlHeightLG,O=l.controlHeightLG+l.paddingSM;return(0,r.useEffect)(function(){M(h.nodes,h.edges,g,O).then(function(e){u(e.nodes),m(e.edges)}).catch(function(e){return console.error("Error laying out elements:",e)})},[h,g,O,m,u]),o().createElement("div",{className:(0,p.css)(A())},o().createElement(b.Gc,{nodes:c,edges:y,nodeTypes:C,fitView:!0,panOnDrag:!0,zoomOnScroll:!0,proOptions:{hideAttribution:!0},onNodesChange:f,onEdgesChange:v,colorMode:n?"dark":"light"},o().createElement(b.VS,null),o().createElement(b.H2,{position:"top-right"})))},R=n(2625);function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function G(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var X=function(){var e=(0,s.useApp)(),t=(0,f.kj)();return(0,r.useMemo)(function(){var n,r,o,a=e.dataSourceManager.collectionFieldInterfaceManager,l=(null==a||null==(r=a.getFieldInterfaces)?void 0:r.call(a))||[],i=(null==a||null==(o=a.getFieldInterfaceGroups)?void 0:o.call(a))||{};return n=l.reduce(function(e,t){var n=t.group||"basic";return e[n]||(e[n]=[]),e[n].push(t),e},{}),Object.keys(i).map(function(e){var r=i[e];return G(L({},r),{label:w(r.label,t),key:e,options:(n[e]||[]).filter(function(e){return!e.hidden}).map(function(n){return G(L({},n),{key:"".concat(e,"-").concat(n.name),value:n.name,label:w(n.title||n.name,t)})}).sort(function(e,t){var n,r;return(null!=(n=e.order)?n:0)-(null!=(r=t.order)?r:0)})})}).filter(function(e){return e.options.length>0}).sort(function(e,t){var n,r;return(null!=(n=e.order)?n:0)-(null!=(r=t.order)?r:0)})},[e.dataSourceManager.collectionFieldInterfaceManager,t])};function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function N(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function H(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){H(e,t,n[t])})}return e}function B(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return z(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(){var e,t,n=(e=["\n .editable-cell {\n position: relative;\n }\n\n .editable-cell-value-wrap {\n padding: ","px ","px;\n cursor: pointer;\n }\n\n &:hover .editable-cell-value-wrap {\n border: ","px "," ",";\n border-radius: ","px;\n padding: ","px\n ","px;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return U=function(){return n},n}var V=o().createContext(null),q=function(e){var t=_(a.Form.useForm(),1)[0];return o().createElement(a.Form,{form:t,component:!1},o().createElement(V.Provider,{value:t},o().createElement("tr",e)))},W=function(e){var t=e.title,n=e.editable,l=e.EditComponent,i=e.ReadComponent,c=e.children,u=e.dataIndex,s=e.record,f=e.handleSave,d=function(e,t){if(null==e)return{};var n,r,o,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=function(e,t){if(null==e)return{};var n,r,o={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}(e,["title","editable","EditComponent","ReadComponent","children","dataIndex","record","handleSave"]),p=_((0,r.useState)(!1),2),y=p[0],m=p[1],b=(0,r.useRef)(null),v=(0,r.useContext)(V);(0,r.useEffect)(function(){if(y){var e,t;null==(t=b.current)||null==(e=t.focus)||e.call(t)}},[y]);var h=function(){m(!y),null==v||v.setFieldsValue(H({},u,s[u]))},g=function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:if(!v)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,v.validateFields()];case 2:return e=t.sent(),h(),f(K({},s,e)),[3,4];case 3:return console.log("Save failed:",t.sent()),[3,4];case 4:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){N(a,r,o,l,i,"next",e)}function i(e){N(a,r,o,l,i,"throw",e)}l(void 0)})})()},O=(null==i?void 0:i(s))||c;if(n){var w=l?o().createElement(l,{record:s,save:g,focusRef:b}):o().createElement(a.Input,{ref:b,onPressEnter:g,onBlur:g});O=y?o().createElement(a.Form.Item,{style:{margin:0},name:u,rules:[{required:!0,message:"".concat(t," is required.")}]},w):o().createElement("div",{className:"editable-cell-value-wrap",onClick:h},O)}return o().createElement("td",d,O)},$=function(e){var t=(0,f.kj)(),n=a.theme.useToken().token,r={collectionTitle:5*n.controlHeightLG,collectionName:4*n.controlHeightLG,template:4*n.controlHeightLG,preset:8*n.controlHeightLG,description:9*n.controlHeightLG};return[{title:t("Collection display name"),dataIndex:"title",key:"title",width:r.collectionTitle,editable:!0},{title:t("Collection name"),dataIndex:"name",key:"name",width:r.collectionName,editable:!0},{title:t("Collection template"),dataIndex:"template",key:"template",width:r.template,render:function(e){if("string"!=typeof e||!e)return null;var n=e.charAt(0).toUpperCase()+e.slice(1);return o().createElement(a.Tag,null,t("".concat(n," collection")))}},{title:t("Preset fields"),key:"preset",width:r.preset,render:function(e,n){var r=[];return!1!==n.autoGenId&&r.push("id"),!1!==n.createdAt&&r.push("createdAt"),!1!==n.updatedAt&&r.push("updatedAt"),n.createdBy&&r.push("createdBy"),n.updatedBy&&r.push("updatedBy"),o().createElement(a.Checkbox.Group,{options:[{label:"ID",value:"id"},{label:t("Created at"),value:"createdAt"},{label:t("Last updated at"),value:"updatedAt"},{label:t("Created by"),value:"createdBy"},{label:t("Last updated by"),value:"updatedBy"}],defaultValue:r,disabled:!0})}},{title:t("Description"),dataIndex:"description",key:"description",width:r.description}].map(function(t){return t.editable?B(K({},t),{onCell:function(n,r){return{record:n,editable:t.editable,dataIndex:t.dataIndex,title:t.title,handleSave:function(t){return e(r,t)}}}}):t})},J=function(e){var t=e.record,n=e.save,l=e.focusRef,i=e.collection,c=(0,f.kj)(),u=(0,s.useApp)(),d=(0,R.useRequest)(function(){return u.apiClient.request({url:"app:getInfo"})},{cacheKey:"@nocobase/plugin-ai/app-info"}),p=X(),y=(0,r.useMemo)(function(){return p.map(function(e){return B(K({},e),{options:e.options.filter(function(e){return Y(e,i,d.data)})})}).filter(function(e){return e.options.length>0}).map(function(e){return B(K({},e),{label:e.label,options:e.options.map(function(e){return B(K({},e),{label:e.label,value:e.value})})})})},[i,p,d.data]),m=u.dataSourceManager.collectionFieldInterfaceManager,b=t.interface?null==m?void 0:m.getFieldInterface(t.interface):void 0,v=b?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"-",r=w(e,t);return null==r||""===r?n:"string"==typeof r||"number"==typeof r||"boolean"==typeof r?String(r):n}(b.title||t.interface,c):t.interface;return o().createElement(a.Select,{ref:l,options:y,defaultValue:v,onBlur:n})},Y=function(e,t,n){if(e.hidden)return!1;if("tableoid"===e.value){var r,o;return(null==n||null==(o=n.data)||null==(r=o.database)?void 0:r.dialect)==="postgres"}return"string"==typeof e.value&&"boolean"==typeof t[e.value]?!!t[e.value]:!["o2o","subTable","linkTo"].includes(e.name||"")},Q=function(e,t,n){var r=(0,f.kj)(),l=(0,s.useApp)(),i=a.theme.useToken().token,c={fieldTitle:5*i.controlHeightLG,fieldName:4*i.controlHeightLG,fieldInterface:5*i.controlHeightLG,description:9*i.controlHeightLG};return[a.Table.EXPAND_COLUMN,{title:r("Field display name"),dataIndex:"title",width:c.fieldTitle,key:"title",editable:!0},{title:r("Field name"),dataIndex:"name",key:"name",width:c.fieldName,editable:!0},{title:r("Field interface"),width:c.fieldInterface,dataIndex:"interface",key:"interface",editable:!0,EditComponent:function(t){return o().createElement(J,B(K({},t),{collection:e}))},ReadComponent:function(e){var t,n=e.interface;if(!n)return null;var i=null==(t=l.dataSourceManager.collectionFieldInterfaceManager)?void 0:t.getFieldInterface(n);return o().createElement(a.Tag,null,i?w(i.title,r):n)}},{title:r("Description"),dataIndex:"description",key:"description",width:c.description}].map(function(e){return e.editable?B(K({},e),{onCell:function(r,o){return{record:r,editable:e.editable,dataIndex:e.dataIndex,title:e.title,EditComponent:e.EditComponent,ReadComponent:e.ReadComponent,handleSave:function(e){return n(t,o,e)}}}}):e})},Z=function(e){var t=e.record,n=a.theme.useToken().token,r={color:n.colorTextSecondary,marginRight:n.marginXS,marginLeft:n.marginXXL},l=[["Target",t.target],["TargetKey",t.targetKey],["SourceKey",t.sourceKey],["ForeignKey",t.foreignKey],["OtherKey",t.otherKey]];return o().createElement(o().Fragment,null,t.enum?o().createElement("div",null,o().createElement("span",{style:r},"Enumurations:"),t.enum.map(function(e){return o().createElement(a.Tag,{key:e.value},e.label," (",e.value,")")})):null,l.map(function(e){var t=_(e,2),n=t[0],a=t[1];return a?o().createElement("div",{key:n},o().createElement("span",{style:r},n,":"),o().createElement("span",null,a)):null}))},ee=function(e){var t=e.record,n=e.collectionIndex,r=e.rowClassName,l=Q(t,n,e.updateFieldRecord);return o().createElement(a.Table,{rowKey:"name",rowClassName:r,columns:l,components:{body:{row:q,cell:W}},dataSource:t.fields,pagination:!1,expandable:{rowExpandable:function(e){var t;return!!(null==(t=e.enum)?void 0:t.length)||["m2m","m2o","o2m","o2o"].includes(String(e.interface))},expandedRowRender:function(e){return o().createElement(Z,{record:e})}}})},et=function(e){var t,n=e.collections,l=e.updateCollectionRecord,i=e.updateFieldRecord,c=a.theme.useToken().token,u=$(l),s=(t=a.theme.useToken().token,(0,r.useMemo)(function(){return(0,p.cx)("editable-row",(0,p.css)(U(),t.paddingXXS,t.paddingSM,t.lineWidth,t.lineType,t.colorBorder,t.borderRadius,Math.max(t.paddingXXS-t.lineWidth,0),Math.max(t.paddingSM-t.lineWidth,0)))},[t]));return o().createElement(a.Table,{scroll:{y:"calc(100vh - ".concat(c.controlHeightLG+8*c.marginXXL,"px)")},style:{height:"calc(100vh - ".concat(c.controlHeightLG+6*c.marginXXL,"px)")},rowKey:"name",rowClassName:s,columns:u,dataSource:n,components:{body:{row:q,cell:W}},expandable:{expandedRowRender:function(e,t,r,a){var l=n.findIndex(function(t){return t.name===e.name});return a?o().createElement(ee,{record:e,collectionIndex:l,rowClassName:s,updateFieldRecord:i}):null},rowExpandable:function(e){var t;return!!(null==(t=e.fields)?void 0:t.length)}}})};function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function er(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function eo(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){er(a,r,o,l,i,"next",e)}function i(e){er(a,r,o,l,i,"throw",e)}l(void 0)})}}function ea(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function el(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ei(e){return function(e){if(Array.isArray(e))return en(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return en(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return en(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ec(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var eu=function(e){if(Array.isArray(e))return e;if("string"!=typeof e)return null;try{var t=JSON.parse(e);return Array.isArray(t)?t:null}catch(e){return null}},es=function(e){var t=e.children,n=a.theme.useToken().token;return o().createElement("div",{style:{height:"calc(100vh - ".concat(n.controlHeightLG+7*n.marginXXL,"px)"),overflowY:"auto"}},t)},ef=function(e){var t=(0,s.useApp)();return(0,r.useMemo)(function(){var n=t.dataSourceManager.collectionFieldInterfaceManager;return(e||[]).map(function(e){var t;return el(ea({},e),{hidden:!1,fields:(null==(t=e.fields)?void 0:t.map(function(e){var t=e.interface?null==n?void 0:n.getFieldInterface(e.interface):void 0,r=(null==t?void 0:t.default)||{},o=ea(el(ea({},r.uiSchema,e.uiSchema),{title:e.title}),e.enum?{enum:e.enum}:{});return el(ea({},e),{type:e.type||r.type,uiSchema:o})}))||[]})})},[t.dataSourceManager.collectionFieldInterfaceManager,e])},ed=function(e){var t=e.tool,n=e.saveToolArgs,p=(0,f.kj)(),y=(0,s.useGlobalTheme)().isDarkTheme,m=ef(eu(t.args.collections)),b=(0,d.VU)().chatToolModel,v={updateCollectionRecord:(0,r.useCallback)(function(e,r){return eo(function(){var o,a;return ec(this,function(l){switch(l.label){case 0:if(!(null==(o=eu(t.args.collections))?void 0:o[e]))return[2];return(a=ei(o))[e]=ea({},a[e],r),[4,null==n?void 0:n(el(ea({},t.args),{collections:a}))];case 1:return l.sent(),[2]}})})()},[n,t.args]),updateFieldRecord:(0,r.useCallback)(function(e,r,o){return eo(function(){var a,l,i,c,u;return ec(this,function(s){switch(s.label){case 0:if(!(null==(i=eu(t.args.collections))||null==(l=i[e])||null==(a=l.fields)?void 0:a[r]))return[2];return c=ei(i),(u=ei(c[e].fields))[r]=ea({},u[r],o),c[e]=el(ea({},c[e]),{fields:u}),[4,null==n?void 0:n(el(ea({},t.args),{collections:c}))];case 1:return s.sent(),[2]}})})()},[n,t.args])},h=v.updateCollectionRecord,g=v.updateFieldRecord;return((0,r.useEffect)(function(){b.setAdjustArgs(el(ea({},t.args),{collections:m}))},[b,m,t.args]),eu(t.args.collections))?o().createElement(a.Tabs,{defaultActiveKey:"collections",items:[{key:"collections",label:p("Collections"),icon:o().createElement(l.DatabaseOutlined,null),children:o().createElement(et,{collections:m,updateCollectionRecord:h,updateFieldRecord:g})},{key:"graph",icon:o().createElement(l.NodeIndexOutlined,null),label:p("Diagram"),children:o().createElement(es,null,o().createElement(D,{collections:m}))},{key:"definition",icon:o().createElement(l.FileTextOutlined,null),label:"Definition",children:o().createElement(es,null,o().createElement(i.A,{language:"json",style:y?c.A:u.A},JSON.stringify(m,null,2)))}]}):o().createElement(a.Alert,{showIcon:!0,type:"error",message:p("Invalid definition")})}}}]);
|