@glodon-aiot/agent-cli-ui 2.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.git.md +73 -0
- package/README.lib.md +135 -0
- package/dist/es/AgentClientUI.mjs +155 -0
- package/dist/es/Dialog/AgentChat/index.mjs +757 -0
- package/dist/es/Dialog/AgentChat/style.less.mjs +4 -0
- package/dist/es/Dialog/ConnectToNetwork/index.mjs +92 -0
- package/dist/es/Dialog/ConnectToNetwork/style.less.mjs +4 -0
- package/dist/es/Dialog/FileCard/doc-icons/doc.svg.mjs +4 -0
- package/dist/es/Dialog/FileCard/doc-icons/docx.svg.mjs +4 -0
- package/dist/es/Dialog/FileCard/doc-icons/pdf.svg.mjs +4 -0
- package/dist/es/Dialog/FileCard/index.mjs +142 -0
- package/dist/es/Dialog/FileCard/style.less.mjs +4 -0
- package/dist/es/Dialog/FilePreview/index.mjs +90 -0
- package/dist/es/Dialog/FilePreview/style.less.mjs +4 -0
- package/dist/es/Dialog/Greeting/index.mjs +31 -0
- package/dist/es/Dialog/Greeting/style.less.mjs +4 -0
- package/dist/es/Dialog/HistoryContent/index.mjs +14 -0
- package/dist/es/Dialog/HistoryContent/style.less.mjs +4 -0
- package/dist/es/Dialog/HistoryItem/index.mjs +355 -0
- package/dist/es/Dialog/HistoryItem/style.less.mjs +4 -0
- package/dist/es/Dialog/HistoryItem/think.svg.mjs +4 -0
- package/dist/es/Dialog/KnowledgeDoc/index.mjs +46 -0
- package/dist/es/Dialog/KnowledgeDoc/style.less.mjs +4 -0
- package/dist/es/Dialog/KnowledgeList/KnowledgeSelect/index.mjs +68 -0
- package/dist/es/Dialog/KnowledgeList/KnowledgeSelect/style.less.mjs +4 -0
- package/dist/es/Dialog/KnowledgeList/index.mjs +69 -0
- package/dist/es/Dialog/KnowledgeList/style.less.mjs +4 -0
- package/dist/es/Dialog/PromptManager/PromptList/PromptListItem.mjs +89 -0
- package/dist/es/Dialog/PromptManager/PromptList/PublicPromptList.mjs +48 -0
- package/dist/es/Dialog/PromptManager/PromptList/access/empty.svg.mjs +4 -0
- package/dist/es/Dialog/PromptManager/PromptList/style.less.mjs +4 -0
- package/dist/es/Dialog/PromptManager/index.mjs +128 -0
- package/dist/es/Dialog/PromptManager/style.less.mjs +4 -0
- package/dist/es/Dialog/PromptSetting/index.mjs +130 -0
- package/dist/es/Dialog/PromptSetting/style.less.mjs +4 -0
- package/dist/es/Dialog/Recommend/RecommendItem.mjs +96 -0
- package/dist/es/Dialog/Recommend/index.mjs +60 -0
- package/dist/es/Dialog/Recommend/style.less.mjs +4 -0
- package/dist/es/Dialog/Recommend/tip.svg.mjs +4 -0
- package/dist/es/Dialog/ReferCollapse/index.mjs +65 -0
- package/dist/es/Dialog/ReferCollapse/style.less.mjs +4 -0
- package/dist/es/Dialog/SearchReference/index.mjs +64 -0
- package/dist/es/Dialog/SearchReference/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionAction/index.mjs +232 -0
- package/dist/es/Dialog/SessionAction/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionList/index.mjs +197 -0
- package/dist/es/Dialog/SessionList/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/NameEditPanel.mjs +48 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/SessionItem.mjs +142 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/doc-icons/doc.svg.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/doc-icons/docx.svg.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/doc-icons/pdf.svg.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/index.mjs +120 -0
- package/dist/es/Dialog/SessionListDrawer/HistorySessionList/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionListDrawer/index.mjs +44 -0
- package/dist/es/Dialog/SessionListDrawer/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionRefer/ReferItem/index.mjs +94 -0
- package/dist/es/Dialog/SessionRefer/ReferItem/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionRefer/index.mjs +86 -0
- package/dist/es/Dialog/SessionRefer/style.less.mjs +4 -0
- package/dist/es/Dialog/SessionRelated/index.mjs +43 -0
- package/dist/es/Dialog/SessionRelated/style.less.mjs +4 -0
- package/dist/es/Dialog/UploadKnowledgeFiles/ClearModal/index.mjs +51 -0
- package/dist/es/Dialog/UploadKnowledgeFiles/ClearModal/style.less.mjs +4 -0
- package/dist/es/Dialog/UploadKnowledgeFiles/index.mjs +368 -0
- package/dist/es/Dialog/UploadKnowledgeFiles/style.less.mjs +4 -0
- package/dist/es/Dialog/UploadingPrompt/index.mjs +67 -0
- package/dist/es/Dialog/UploadingPrompt/style.less.mjs +4 -0
- package/dist/es/Dialog/index.mjs +128 -0
- package/dist/es/Dialog/style.less.mjs +4 -0
- package/dist/es/FileCard/doc-icons/doc.svg.mjs +4 -0
- package/dist/es/FileCard/doc-icons/docx.svg.mjs +4 -0
- package/dist/es/FileCard/doc-icons/pdf.svg.mjs +4 -0
- package/dist/es/FileItem/index.mjs +85 -0
- package/dist/es/FileItem/style.less.mjs +4 -0
- package/dist/es/Footer/FooterWarning.mjs +25 -0
- package/dist/es/Footer/index.mjs +18 -0
- package/dist/es/Footer/style.less.mjs +4 -0
- package/dist/es/Iconfont/index.mjs +12 -0
- package/dist/es/InputProgress/index.mjs +39 -0
- package/dist/es/InputProgress/style.less.mjs +4 -0
- package/dist/es/QuillEditor/index.mjs +219 -0
- package/dist/es/QuillEditor/style.less.mjs +4 -0
- package/dist/es/_virtual/_cloneBuffer.mjs +4 -0
- package/dist/es/_virtual/_commonjsHelpers.mjs +8 -0
- package/dist/es/_virtual/_nodeUtil.mjs +4 -0
- package/dist/es/_virtual/index.mjs +4 -0
- package/dist/es/_virtual/index2.mjs +4 -0
- package/dist/es/_virtual/index3.mjs +4 -0
- package/dist/es/_virtual/index4.mjs +4 -0
- package/dist/es/_virtual/isBuffer.mjs +4 -0
- package/dist/es/_virtual/jsx-runtime.mjs +7 -0
- package/dist/es/_virtual/jsx-runtime2.mjs +4 -0
- package/dist/es/_virtual/minio-zj.mjs +4 -0
- package/dist/es/_virtual/react-jsx-runtime.production.min.mjs +4 -0
- package/dist/es/assets/brand.svg.mjs +4 -0
- package/dist/es/assets/icon.svg.mjs +4 -0
- package/dist/es/components/Copy/index.mjs +44 -0
- package/dist/es/components/Copy/style.less.mjs +4 -0
- package/dist/es/components/JsonDisplay/index.mjs +16 -0
- package/dist/es/components/JsonDisplay/style.less.mjs +4 -0
- package/dist/es/components/Markdown/Code/index.mjs +69 -0
- package/dist/es/components/Markdown/Image/index.mjs +26 -0
- package/dist/es/components/Markdown/index.mjs +48 -0
- package/dist/es/components/Markdown/style.less.mjs +4 -0
- package/dist/es/components/WebLink/index.mjs +26 -0
- package/dist/es/constant.mjs +96 -0
- package/dist/es/context.mjs +7 -0
- package/dist/es/favicon.ico +0 -0
- package/dist/es/favicon2.ico +0 -0
- package/dist/es/font/font_4108228_4w5nlhafpte.js +1 -0
- package/dist/es/font/font_4439177_0sppkcnqiqgs.js +1 -0
- package/dist/es/font/gos-font.js +64 -0
- package/dist/es/images/empty.svg +40 -0
- package/dist/es/images/loading.gif +0 -0
- package/dist/es/images/logo.png +0 -0
- package/dist/es/images/map-example.png +0 -0
- package/dist/es/images/sketch.png +0 -0
- package/dist/es/index.html +43 -0
- package/dist/es/index.mjs +325 -0
- package/dist/es/logo192.png +0 -0
- package/dist/es/logo512.png +0 -0
- package/dist/es/manifest.json +25 -0
- package/dist/es/node_modules/@babel/runtime/helpers/esm/extends.mjs +13 -0
- package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +26485 -0
- package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +54 -0
- package/dist/es/node_modules/ahooks/es/useKeyPress/index.mjs +221 -0
- package/dist/es/node_modules/ahooks/es/useLatest/index.mjs +8 -0
- package/dist/es/node_modules/ahooks/es/useMemoizedFn/index.mjs +19 -0
- package/dist/es/node_modules/ahooks/es/useUnmount/index.mjs +17 -0
- package/dist/es/node_modules/ahooks/es/utils/createEffectWithTarget.mjs +27 -0
- package/dist/es/node_modules/ahooks/es/utils/depsAreSame.mjs +11 -0
- package/dist/es/node_modules/ahooks/es/utils/depsEqual.mjs +7 -0
- package/dist/es/node_modules/ahooks/es/utils/domTarget.mjs +13 -0
- package/dist/es/node_modules/ahooks/es/utils/index.mjs +12 -0
- package/dist/es/node_modules/ahooks/es/utils/isAppleDevice.mjs +5 -0
- package/dist/es/node_modules/ahooks/es/utils/isBrowser.mjs +5 -0
- package/dist/es/node_modules/ahooks/es/utils/isDev.mjs +5 -0
- package/dist/es/node_modules/ahooks/es/utils/useDeepCompareWithTarget.mjs +11 -0
- package/dist/es/node_modules/ahooks/es/utils/useEffectWithTarget.mjs +7 -0
- package/dist/es/node_modules/antd/es/calendar/locale/zh_CN.mjs +4 -0
- package/dist/es/node_modules/antd/es/date-picker/locale/zh_CN.mjs +23 -0
- package/dist/es/node_modules/antd/es/locale/zh_CN.mjs +132 -0
- package/dist/es/node_modules/antd/es/time-picker/locale/zh_CN.mjs +8 -0
- package/dist/es/node_modules/base64-js/index.mjs +47 -0
- package/dist/es/node_modules/buffer/index.mjs +927 -0
- package/dist/es/node_modules/classnames/index.mjs +42 -0
- package/dist/es/node_modules/copy-to-clipboard/index.mjs +46 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +9 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +18 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +24 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +19 -0
- package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +4 -0
- package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +317 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +113 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +11 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +273 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +8 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +87 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +52 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +21 -0
- package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +23 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +21 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +14 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +39 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +28 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +105 -0
- package/dist/es/node_modules/ieee754/index.mjs +28 -0
- package/dist/es/node_modules/js-base64/base64.mjs +31 -0
- package/dist/es/node_modules/lodash/_Hash.mjs +22 -0
- package/dist/es/node_modules/lodash/_ListCache.mjs +22 -0
- package/dist/es/node_modules/lodash/_Map.mjs +6 -0
- package/dist/es/node_modules/lodash/_MapCache.mjs +22 -0
- package/dist/es/node_modules/lodash/_Stack.mjs +20 -0
- package/dist/es/node_modules/lodash/_Symbol.mjs +5 -0
- package/dist/es/node_modules/lodash/_Uint8Array.mjs +5 -0
- package/dist/es/node_modules/lodash/_apply.mjs +17 -0
- package/dist/es/node_modules/lodash/_arrayLikeKeys.mjs +21 -0
- package/dist/es/node_modules/lodash/_assignMergeValue.mjs +10 -0
- package/dist/es/node_modules/lodash/_assignValue.mjs +11 -0
- package/dist/es/node_modules/lodash/_assocIndexOf.mjs +12 -0
- package/dist/es/node_modules/lodash/_baseAssignValue.mjs +14 -0
- package/dist/es/node_modules/lodash/_baseCreate.mjs +17 -0
- package/dist/es/node_modules/lodash/_baseFor.mjs +5 -0
- package/dist/es/node_modules/lodash/_baseGetTag.mjs +11 -0
- package/dist/es/node_modules/lodash/_baseIsArguments.mjs +10 -0
- package/dist/es/node_modules/lodash/_baseIsNative.mjs +15 -0
- package/dist/es/node_modules/lodash/_baseIsTypedArray.mjs +13 -0
- package/dist/es/node_modules/lodash/_baseKeysIn.mjs +16 -0
- package/dist/es/node_modules/lodash/_baseMerge.mjs +22 -0
- package/dist/es/node_modules/lodash/_baseMergeDeep.mjs +33 -0
- package/dist/es/node_modules/lodash/_baseRest.mjs +11 -0
- package/dist/es/node_modules/lodash/_baseSetToString.mjs +14 -0
- package/dist/es/node_modules/lodash/_baseTimes.mjs +9 -0
- package/dist/es/node_modules/lodash/_baseTrim.mjs +9 -0
- package/dist/es/node_modules/lodash/_baseUnary.mjs +9 -0
- package/dist/es/node_modules/lodash/_cloneArrayBuffer.mjs +10 -0
- package/dist/es/node_modules/lodash/_cloneBuffer.mjs +17 -0
- package/dist/es/node_modules/lodash/_cloneTypedArray.mjs +10 -0
- package/dist/es/node_modules/lodash/_copyArray.mjs +10 -0
- package/dist/es/node_modules/lodash/_copyObject.mjs +16 -0
- package/dist/es/node_modules/lodash/_coreJsData.mjs +5 -0
- package/dist/es/node_modules/lodash/_createAssigner.mjs +17 -0
- package/dist/es/node_modules/lodash/_createBaseFor.mjs +14 -0
- package/dist/es/node_modules/lodash/_defineProperty.mjs +11 -0
- package/dist/es/node_modules/lodash/_freeGlobal.mjs +5 -0
- package/dist/es/node_modules/lodash/_getMapData.mjs +10 -0
- package/dist/es/node_modules/lodash/_getNative.mjs +11 -0
- package/dist/es/node_modules/lodash/_getPrototype.mjs +5 -0
- package/dist/es/node_modules/lodash/_getRawTag.mjs +16 -0
- package/dist/es/node_modules/lodash/_getValue.mjs +7 -0
- package/dist/es/node_modules/lodash/_hashClear.mjs +9 -0
- package/dist/es/node_modules/lodash/_hashDelete.mjs +8 -0
- package/dist/es/node_modules/lodash/_hashGet.mjs +14 -0
- package/dist/es/node_modules/lodash/_hashHas.mjs +10 -0
- package/dist/es/node_modules/lodash/_hashSet.mjs +10 -0
- package/dist/es/node_modules/lodash/_initCloneObject.mjs +11 -0
- package/dist/es/node_modules/lodash/_isIndex.mjs +9 -0
- package/dist/es/node_modules/lodash/_isIterateeCall.mjs +15 -0
- package/dist/es/node_modules/lodash/_isKeyable.mjs +8 -0
- package/dist/es/node_modules/lodash/_isMasked.mjs +12 -0
- package/dist/es/node_modules/lodash/_isPrototype.mjs +9 -0
- package/dist/es/node_modules/lodash/_listCacheClear.mjs +7 -0
- package/dist/es/node_modules/lodash/_listCacheDelete.mjs +13 -0
- package/dist/es/node_modules/lodash/_listCacheGet.mjs +10 -0
- package/dist/es/node_modules/lodash/_listCacheHas.mjs +9 -0
- package/dist/es/node_modules/lodash/_listCacheSet.mjs +10 -0
- package/dist/es/node_modules/lodash/_mapCacheClear.mjs +15 -0
- package/dist/es/node_modules/lodash/_mapCacheDelete.mjs +10 -0
- package/dist/es/node_modules/lodash/_mapCacheGet.mjs +9 -0
- package/dist/es/node_modules/lodash/_mapCacheHas.mjs +9 -0
- package/dist/es/node_modules/lodash/_mapCacheSet.mjs +10 -0
- package/dist/es/node_modules/lodash/_nativeCreate.mjs +5 -0
- package/dist/es/node_modules/lodash/_nativeKeysIn.mjs +11 -0
- package/dist/es/node_modules/lodash/_nodeUtil.mjs +17 -0
- package/dist/es/node_modules/lodash/_objectToString.mjs +8 -0
- package/dist/es/node_modules/lodash/_overArg.mjs +9 -0
- package/dist/es/node_modules/lodash/_overRest.mjs +16 -0
- package/dist/es/node_modules/lodash/_root.mjs +5 -0
- package/dist/es/node_modules/lodash/_safeGet.mjs +8 -0
- package/dist/es/node_modules/lodash/_setToString.mjs +6 -0
- package/dist/es/node_modules/lodash/_shortOut.mjs +17 -0
- package/dist/es/node_modules/lodash/_stackClear.mjs +9 -0
- package/dist/es/node_modules/lodash/_stackDelete.mjs +8 -0
- package/dist/es/node_modules/lodash/_stackGet.mjs +7 -0
- package/dist/es/node_modules/lodash/_stackHas.mjs +7 -0
- package/dist/es/node_modules/lodash/_stackSet.mjs +18 -0
- package/dist/es/node_modules/lodash/_toSource.mjs +18 -0
- package/dist/es/node_modules/lodash/_trimmedEndIndex.mjs +10 -0
- package/dist/es/node_modules/lodash/constant.mjs +9 -0
- package/dist/es/node_modules/lodash/debounce.mjs +57 -0
- package/dist/es/node_modules/lodash/eq.mjs +7 -0
- package/dist/es/node_modules/lodash/identity.mjs +7 -0
- package/dist/es/node_modules/lodash/isArguments.mjs +10 -0
- package/dist/es/node_modules/lodash/isArray.mjs +4 -0
- package/dist/es/node_modules/lodash/isArrayLike.mjs +10 -0
- package/dist/es/node_modules/lodash/isArrayLikeObject.mjs +10 -0
- package/dist/es/node_modules/lodash/isBuffer.mjs +12 -0
- package/dist/es/node_modules/lodash/isFunction.mjs +13 -0
- package/dist/es/node_modules/lodash/isLength.mjs +8 -0
- package/dist/es/node_modules/lodash/isObject.mjs +8 -0
- package/dist/es/node_modules/lodash/isObjectLike.mjs +7 -0
- package/dist/es/node_modules/lodash/isPlainObject.mjs +17 -0
- package/dist/es/node_modules/lodash/isSymbol.mjs +10 -0
- package/dist/es/node_modules/lodash/isTypedArray.mjs +7 -0
- package/dist/es/node_modules/lodash/keysIn.mjs +11 -0
- package/dist/es/node_modules/lodash/merge.mjs +10 -0
- package/dist/es/node_modules/lodash/now.mjs +7 -0
- package/dist/es/node_modules/lodash/stubFalse.mjs +7 -0
- package/dist/es/node_modules/lodash/toNumber.mjs +23 -0
- package/dist/es/node_modules/lodash/toPlainObject.mjs +10 -0
- package/dist/es/node_modules/object-assign/index.mjs +34 -0
- package/dist/es/node_modules/rc-pagination/es/locale/zh_CN.mjs +18 -0
- package/dist/es/node_modules/rc-picker/es/locale/zh_CN.mjs +31 -0
- package/dist/es/node_modules/react/cjs/react-jsx-runtime.production.min.mjs +45 -0
- package/dist/es/node_modules/react/jsx-runtime.mjs +8 -0
- package/dist/es/node_modules/react-fast-compare/index.mjs +78 -0
- package/dist/es/node_modules/react-infinite-scroll-component/dist/index.es.mjs +188 -0
- package/dist/es/node_modules/react-quill/dist/quill.snow.css.mjs +4 -0
- package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +26 -0
- package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +25 -0
- package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +242 -0
- package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +8 -0
- package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +608 -0
- package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +19 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +52 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +203 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +26 -0
- package/dist/es/node_modules/toggle-selection/index.mjs +25 -0
- package/dist/es/node_modules/tslib/tslib.es6.mjs +15 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
- package/dist/es/packages/agent-cli-sdk/src/AgentSession.mjs +243 -0
- package/dist/es/packages/agent-cli-sdk/src/BotClient.mjs +242 -0
- package/dist/es/packages/agent-cli-sdk/src/Config.mjs +34 -0
- package/dist/es/packages/agent-cli-sdk/src/DialogSession.mjs +281 -0
- package/dist/es/packages/agent-cli-sdk/src/EventBus.mjs +64 -0
- package/dist/es/packages/agent-cli-sdk/src/Logger.mjs +31 -0
- package/dist/es/packages/agent-cli-sdk/src/PayloadTypes.mjs +4 -0
- package/dist/es/packages/agent-cli-sdk/src/Session.mjs +527 -0
- package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/fetch.mjs +112 -0
- package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/parse.mjs +97 -0
- package/dist/es/packages/agent-cli-sdk/src/api/index.mjs +48 -0
- package/dist/es/packages/agent-cli-sdk/src/utils.mjs +11 -0
- package/dist/es/packages/apis/dist/es/aecpilot/cosntant.mjs +5 -0
- package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +9 -0
- package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +8 -0
- package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +414 -0
- package/dist/es/packages/apis/dist/es/base/index.mjs +154 -0
- package/dist/es/packages/apis/dist/es/cvforce/index.mjs +431 -0
- package/dist/es/packages/apis/dist/es/cvforce/model.mjs +6 -0
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
- package/dist/es/packages/apis/dist/es/utils/fetchEventSource/fetch.mjs +106 -0
- package/dist/es/packages/apis/dist/es/utils/fetchEventSource/parse.mjs +97 -0
- package/dist/es/robots.txt +3 -0
- package/dist/es/style.less.mjs +4 -0
- package/dist/es/types.mjs +4 -0
- package/dist/es/utils/clipboard.mjs +38 -0
- package/dist/es/utils/index.mjs +33 -0
- package/dist/lib/favicon.ico +0 -0
- package/dist/lib/favicon2.ico +0 -0
- package/dist/lib/font/font_4108228_4w5nlhafpte.js +1 -0
- package/dist/lib/font/font_4439177_0sppkcnqiqgs.js +1 -0
- package/dist/lib/font/gos-font.js +64 -0
- package/dist/lib/images/empty.svg +40 -0
- package/dist/lib/images/loading.gif +0 -0
- package/dist/lib/images/logo.png +0 -0
- package/dist/lib/images/map-example.png +0 -0
- package/dist/lib/images/sketch.png +0 -0
- package/dist/lib/index.html +43 -0
- package/dist/lib/index.js +169 -0
- package/dist/lib/logo192.png +0 -0
- package/dist/lib/logo512.png +0 -0
- package/dist/lib/manifest.json +25 -0
- package/dist/lib/robots.txt +3 -0
- package/dist/src/AgentClientUI.d.ts +4 -0
- package/dist/src/ConnectToNetwork/index.d.ts +13 -0
- package/dist/src/Dialog/AgentChat/index.d.ts +17 -0
- package/dist/src/Dialog/ChatEmptyView/index.d.ts +6 -0
- package/dist/src/Dialog/ConnectToNetwork/index.d.ts +13 -0
- package/dist/src/Dialog/FileCard/index.d.ts +22 -0
- package/dist/src/Dialog/FilePreview/index.d.ts +20 -0
- package/dist/src/Dialog/Greeting/index.d.ts +7 -0
- package/dist/src/Dialog/HistoryContent/index.d.ts +5 -0
- package/dist/src/Dialog/HistoryItem/index.d.ts +17 -0
- package/dist/src/Dialog/KnowledgeDoc/index.d.ts +9 -0
- package/dist/src/Dialog/KnowledgeList/KnowledgeSelect/index.d.ts +12 -0
- package/dist/src/Dialog/KnowledgeList/index.d.ts +13 -0
- package/dist/src/Dialog/PromptManager/PromptList/EditPromptModal/index.d.ts +11 -0
- package/dist/src/Dialog/PromptManager/PromptList/PrivatePromptList.d.ts +12 -0
- package/dist/src/Dialog/PromptManager/PromptList/PromptListItem.d.ts +13 -0
- package/dist/src/Dialog/PromptManager/PromptList/PublicPromptList.d.ts +12 -0
- package/dist/src/Dialog/PromptManager/index.d.ts +13 -0
- package/dist/src/Dialog/PromptSetting/index.d.ts +14 -0
- package/dist/src/Dialog/Recommend/RecommendItem.d.ts +12 -0
- package/dist/src/Dialog/Recommend/index.d.ts +14 -0
- package/dist/src/Dialog/ReferCollapse/index.d.ts +8 -0
- package/dist/src/Dialog/SearchReference/index.d.ts +7 -0
- package/dist/src/Dialog/SessionAction/index.d.ts +11 -0
- package/dist/src/Dialog/SessionList/index.d.ts +20 -0
- package/dist/src/Dialog/SessionListDrawer/HistorySessionList/NameEditPanel.d.ts +9 -0
- package/dist/src/Dialog/SessionListDrawer/HistorySessionList/SessionItem.d.ts +16 -0
- package/dist/src/Dialog/SessionListDrawer/HistorySessionList/index.d.ts +9 -0
- package/dist/src/Dialog/SessionListDrawer/index.d.ts +9 -0
- package/dist/src/Dialog/SessionRefer/ReferItem/index.d.ts +9 -0
- package/dist/src/Dialog/SessionRefer/index.d.ts +8 -0
- package/dist/src/Dialog/SessionRelated/index.d.ts +9 -0
- package/dist/src/Dialog/UploadFiles/ClearModal/index.d.ts +7 -0
- package/dist/src/Dialog/UploadFiles/index.d.ts +21 -0
- package/dist/src/Dialog/UploadKnowledgeFiles/ClearModal/index.d.ts +7 -0
- package/dist/src/Dialog/UploadKnowledgeFiles/index.d.ts +22 -0
- package/dist/src/Dialog/UploadingPrompt/index.d.ts +9 -0
- package/dist/src/Dialog/index.d.ts +9 -0
- package/dist/src/FileCard/index.d.ts +21 -0
- package/dist/src/FileItem/index.d.ts +11 -0
- package/dist/src/Footer/FooterWarning.d.ts +8 -0
- package/dist/src/Footer/index.d.ts +7 -0
- package/dist/src/Greeting/index.d.ts +7 -0
- package/dist/src/Iconfont/font_4108228_8te6zfkclqu.d.ts +0 -0
- package/dist/src/Iconfont/font_4439177_7rytwlvbmjj.d.ts +0 -0
- package/dist/src/Iconfont/index.d.ts +3 -0
- package/dist/src/InputProgress/index.d.ts +7 -0
- package/dist/src/QuillEditor/index.d.ts +19 -0
- package/dist/src/components/Copy/index.d.ts +5 -0
- package/dist/src/components/Header/index.d.ts +6 -0
- package/dist/src/components/JsonDisplay/index.d.ts +6 -0
- package/dist/src/components/Markdown/Code/index.d.ts +3 -0
- package/dist/src/components/Markdown/Image/index.d.ts +3 -0
- package/dist/src/components/Markdown/index.d.ts +6 -0
- package/dist/src/components/PDFViewer/index.d.ts +7 -0
- package/dist/src/components/WebLink/index.d.ts +7 -0
- package/dist/src/constant.d.ts +11 -0
- package/dist/src/context.d.ts +5 -0
- package/dist/src/index.d.ts +33 -0
- package/dist/src/types.d.ts +183 -0
- package/dist/src/utils/clipboard.d.ts +11 -0
- package/dist/src/utils/fetchEventSource/fetch.d.ts +44 -0
- package/dist/src/utils/fetchEventSource/index.d.ts +1 -0
- package/dist/src/utils/fetchEventSource/parse.d.ts +36 -0
- package/dist/src/utils/index.d.ts +17 -0
- package/package.json +138 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs as u } from "../../_virtual/_commonjsHelpers.mjs";
|
|
2
|
+
import { __module as i } from "../../_virtual/index4.mjs";
|
|
3
|
+
/*!
|
|
4
|
+
Copyright (c) 2018 Jed Watson.
|
|
5
|
+
Licensed under the MIT License (MIT), see
|
|
6
|
+
http://jedwatson.github.io/classnames
|
|
7
|
+
*/
|
|
8
|
+
(function(s) {
|
|
9
|
+
(function() {
|
|
10
|
+
var f = {}.hasOwnProperty;
|
|
11
|
+
function e() {
|
|
12
|
+
for (var t = "", r = 0; r < arguments.length; r++) {
|
|
13
|
+
var n = arguments[r];
|
|
14
|
+
n && (t = o(t, a(n)));
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
function a(t) {
|
|
19
|
+
if (typeof t == "string" || typeof t == "number")
|
|
20
|
+
return t;
|
|
21
|
+
if (typeof t != "object")
|
|
22
|
+
return "";
|
|
23
|
+
if (Array.isArray(t))
|
|
24
|
+
return e.apply(null, t);
|
|
25
|
+
if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
|
|
26
|
+
return t.toString();
|
|
27
|
+
var r = "";
|
|
28
|
+
for (var n in t)
|
|
29
|
+
f.call(t, n) && t[n] && (r = o(r, n));
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
function o(t, r) {
|
|
33
|
+
return r ? t ? t + " " + r : t + r : t;
|
|
34
|
+
}
|
|
35
|
+
s.exports ? (e.default = e, s.exports = e) : window.classNames = e;
|
|
36
|
+
})();
|
|
37
|
+
})(i);
|
|
38
|
+
var p = i.exports;
|
|
39
|
+
const m = /* @__PURE__ */ u(p);
|
|
40
|
+
export {
|
|
41
|
+
m as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs as p } from "../../_virtual/_commonjsHelpers.mjs";
|
|
2
|
+
import { t as m } from "../toggle-selection/index.mjs";
|
|
3
|
+
var y = m, u = {
|
|
4
|
+
"text/plain": "Text",
|
|
5
|
+
"text/html": "Url",
|
|
6
|
+
default: "Text"
|
|
7
|
+
}, g = "Copy to clipboard: #{key}, Enter";
|
|
8
|
+
function b(r) {
|
|
9
|
+
var t = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
|
|
10
|
+
return r.replace(/#{\s*key\s*}/g, t);
|
|
11
|
+
}
|
|
12
|
+
function w(r, t) {
|
|
13
|
+
var o, i, d, l, c, e, n = !1;
|
|
14
|
+
t || (t = {}), o = t.debug || !1;
|
|
15
|
+
try {
|
|
16
|
+
d = y(), l = document.createRange(), c = document.getSelection(), e = document.createElement("span"), e.textContent = r, e.ariaHidden = "true", e.style.all = "unset", e.style.position = "fixed", e.style.top = 0, e.style.clip = "rect(0, 0, 0, 0)", e.style.whiteSpace = "pre", e.style.webkitUserSelect = "text", e.style.MozUserSelect = "text", e.style.msUserSelect = "text", e.style.userSelect = "text", e.addEventListener("copy", function(a) {
|
|
17
|
+
if (a.stopPropagation(), t.format)
|
|
18
|
+
if (a.preventDefault(), typeof a.clipboardData == "undefined") {
|
|
19
|
+
o && console.warn("unable to use e.clipboardData"), o && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
|
|
20
|
+
var s = u[t.format] || u.default;
|
|
21
|
+
window.clipboardData.setData(s, r);
|
|
22
|
+
} else
|
|
23
|
+
a.clipboardData.clearData(), a.clipboardData.setData(t.format, r);
|
|
24
|
+
t.onCopy && (a.preventDefault(), t.onCopy(a.clipboardData));
|
|
25
|
+
}), document.body.appendChild(e), l.selectNodeContents(e), c.addRange(l);
|
|
26
|
+
var f = document.execCommand("copy");
|
|
27
|
+
if (!f)
|
|
28
|
+
throw new Error("copy command was unsuccessful");
|
|
29
|
+
n = !0;
|
|
30
|
+
} catch (a) {
|
|
31
|
+
o && console.error("unable to copy using execCommand: ", a), o && console.warn("trying IE specific stuff");
|
|
32
|
+
try {
|
|
33
|
+
window.clipboardData.setData(t.format || "text", r), t.onCopy && t.onCopy(window.clipboardData), n = !0;
|
|
34
|
+
} catch (s) {
|
|
35
|
+
o && console.error("unable to copy using clipboardData: ", s), o && console.error("falling back to prompt"), i = b("message" in t ? t.message : g), window.prompt(i, r);
|
|
36
|
+
}
|
|
37
|
+
} finally {
|
|
38
|
+
c && (typeof c.removeRange == "function" ? c.removeRange(l) : c.removeAllRanges()), e && document.body.removeChild(e), d();
|
|
39
|
+
}
|
|
40
|
+
return n;
|
|
41
|
+
}
|
|
42
|
+
var D = w;
|
|
43
|
+
const x = /* @__PURE__ */ p(D);
|
|
44
|
+
export {
|
|
45
|
+
x as default
|
|
46
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function l(t) {
|
|
2
|
+
let e = "";
|
|
3
|
+
for (let n in t)
|
|
4
|
+
t.hasOwnProperty(n) && (e.length && (e += "&"), e += encodeURIComponent(n) + "=" + encodeURIComponent(t[n]));
|
|
5
|
+
return e;
|
|
6
|
+
}
|
|
7
|
+
function p(t) {
|
|
8
|
+
let e = {}, n = t.split("&");
|
|
9
|
+
for (let o = 0, i = n.length; o < i; o++) {
|
|
10
|
+
let r = n[o].split("=");
|
|
11
|
+
e[decodeURIComponent(r[0])] = decodeURIComponent(r[1]);
|
|
12
|
+
}
|
|
13
|
+
return e;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
p as decode,
|
|
17
|
+
l as encode
|
|
18
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const c = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, u = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"];
|
|
2
|
+
function p(t) {
|
|
3
|
+
if (t.length > 2e3)
|
|
4
|
+
throw "URI too long";
|
|
5
|
+
const o = t, i = t.indexOf("["), r = t.indexOf("]");
|
|
6
|
+
i != -1 && r != -1 && (t = t.substring(0, i) + t.substring(i, r).replace(/:/g, ";") + t.substring(r, t.length));
|
|
7
|
+
let n = c.exec(t || ""), e = {}, s = 14;
|
|
8
|
+
for (; s--; )
|
|
9
|
+
e[u[s]] = n[s] || "";
|
|
10
|
+
return i != -1 && r != -1 && (e.source = o, e.host = e.host.substring(1, e.host.length - 1).replace(/;/g, ":"), e.authority = e.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), e.ipv6uri = !0), e.pathNames = a(e, e.path), e.queryKey = l(e, e.query), e;
|
|
11
|
+
}
|
|
12
|
+
function a(t, o) {
|
|
13
|
+
const i = /\/{2,9}/g, r = o.replace(i, "/").split("/");
|
|
14
|
+
return (o.slice(0, 1) == "/" || o.length === 0) && r.splice(0, 1), o.slice(-1) == "/" && r.splice(r.length - 1, 1), r;
|
|
15
|
+
}
|
|
16
|
+
function l(t, o) {
|
|
17
|
+
const i = {};
|
|
18
|
+
return o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(r, n, e) {
|
|
19
|
+
n && (i[n] = e);
|
|
20
|
+
}), i;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
p as parse
|
|
24
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""), n = 64, i = {};
|
|
2
|
+
let r = 0, t = 0, l;
|
|
3
|
+
function a(e) {
|
|
4
|
+
let o = "";
|
|
5
|
+
do
|
|
6
|
+
o = c[e % n] + o, e = Math.floor(e / n);
|
|
7
|
+
while (e > 0);
|
|
8
|
+
return o;
|
|
9
|
+
}
|
|
10
|
+
function d() {
|
|
11
|
+
const e = a(+/* @__PURE__ */ new Date());
|
|
12
|
+
return e !== l ? (r = 0, l = e) : e + "." + a(r++);
|
|
13
|
+
}
|
|
14
|
+
for (; t < n; t++)
|
|
15
|
+
i[c[t]] = t;
|
|
16
|
+
export {
|
|
17
|
+
a as encode,
|
|
18
|
+
d as yeast
|
|
19
|
+
};
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { transports as m } from "./transports/index.mjs";
|
|
2
|
+
import { installTimerFunctions as g, byteLength as y } from "./util.mjs";
|
|
3
|
+
import { decode as v } from "./contrib/parseqs.mjs";
|
|
4
|
+
import { parse as d } from "./contrib/parseuri.mjs";
|
|
5
|
+
import { Emitter as b } from "../../../@socket.io/component-emitter/lib/esm/index.mjs";
|
|
6
|
+
import { protocol as u } from "../../../engine.io-parser/build/esm/index.mjs";
|
|
7
|
+
import { defaultBinaryType as T } from "./transports/websocket-constructor.browser.mjs";
|
|
8
|
+
class i extends b {
|
|
9
|
+
/**
|
|
10
|
+
* Socket constructor.
|
|
11
|
+
*
|
|
12
|
+
* @param {String|Object} uri - uri or options
|
|
13
|
+
* @param {Object} opts - options
|
|
14
|
+
*/
|
|
15
|
+
constructor(t, e = {}) {
|
|
16
|
+
super(), this.binaryType = T, this.writeBuffer = [], t && typeof t == "object" && (e = t, t = null), t ? (t = d(t), e.hostname = t.host, e.secure = t.protocol === "https" || t.protocol === "wss", e.port = t.port, t.query && (e.query = t.query)) : e.host && (e.hostname = d(e.host).host), g(this, e), this.secure = e.secure != null ? e.secure : typeof location != "undefined" && location.protocol === "https:", e.hostname && !e.port && (e.port = this.secure ? "443" : "80"), this.hostname = e.hostname || (typeof location != "undefined" ? location.hostname : "localhost"), this.port = e.port || (typeof location != "undefined" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = e.transports || ["polling", "websocket", "webtransport"], this.writeBuffer = [], this.prevBufferLen = 0, this.opts = Object.assign({
|
|
17
|
+
path: "/engine.io",
|
|
18
|
+
agent: !1,
|
|
19
|
+
withCredentials: !1,
|
|
20
|
+
upgrade: !0,
|
|
21
|
+
timestampParam: "t",
|
|
22
|
+
rememberUpgrade: !1,
|
|
23
|
+
addTrailingSlash: !0,
|
|
24
|
+
rejectUnauthorized: !0,
|
|
25
|
+
perMessageDeflate: {
|
|
26
|
+
threshold: 1024
|
|
27
|
+
},
|
|
28
|
+
transportOptions: {},
|
|
29
|
+
closeOnBeforeunload: !1
|
|
30
|
+
}, e), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = v(this.opts.query)), this.id = null, this.upgrades = null, this.pingInterval = null, this.pingTimeout = null, this.pingTimeoutTimer = null, typeof addEventListener == "function" && (this.opts.closeOnBeforeunload && (this.beforeunloadEventListener = () => {
|
|
31
|
+
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
32
|
+
}, addEventListener("beforeunload", this.beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this.offlineEventListener = () => {
|
|
33
|
+
this.onClose("transport close", {
|
|
34
|
+
description: "network connection lost"
|
|
35
|
+
});
|
|
36
|
+
}, addEventListener("offline", this.offlineEventListener, !1))), this.open();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates transport of the given type.
|
|
40
|
+
*
|
|
41
|
+
* @param {String} name - transport name
|
|
42
|
+
* @return {Transport}
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
createTransport(t) {
|
|
46
|
+
const e = Object.assign({}, this.opts.query);
|
|
47
|
+
e.EIO = u, e.transport = t, this.id && (e.sid = this.id);
|
|
48
|
+
const s = Object.assign({}, this.opts, {
|
|
49
|
+
query: e,
|
|
50
|
+
socket: this,
|
|
51
|
+
hostname: this.hostname,
|
|
52
|
+
secure: this.secure,
|
|
53
|
+
port: this.port
|
|
54
|
+
}, this.opts.transportOptions[t]);
|
|
55
|
+
return new m[t](s);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Initializes transport to use and starts probe.
|
|
59
|
+
*
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
open() {
|
|
63
|
+
let t;
|
|
64
|
+
if (this.opts.rememberUpgrade && i.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1)
|
|
65
|
+
t = "websocket";
|
|
66
|
+
else if (this.transports.length === 0) {
|
|
67
|
+
this.setTimeoutFn(() => {
|
|
68
|
+
this.emitReserved("error", "No transports available");
|
|
69
|
+
}, 0);
|
|
70
|
+
return;
|
|
71
|
+
} else
|
|
72
|
+
t = this.transports[0];
|
|
73
|
+
this.readyState = "opening";
|
|
74
|
+
try {
|
|
75
|
+
t = this.createTransport(t);
|
|
76
|
+
} catch (e) {
|
|
77
|
+
this.transports.shift(), this.open();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
t.open(), this.setTransport(t);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Sets the current transport. Disables the existing one (if any).
|
|
84
|
+
*
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
setTransport(t) {
|
|
88
|
+
this.transport && this.transport.removeAllListeners(), this.transport = t, t.on("drain", this.onDrain.bind(this)).on("packet", this.onPacket.bind(this)).on("error", this.onError.bind(this)).on("close", (e) => this.onClose("transport close", e));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Probes a transport.
|
|
92
|
+
*
|
|
93
|
+
* @param {String} name - transport name
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
probe(t) {
|
|
97
|
+
let e = this.createTransport(t), s = !1;
|
|
98
|
+
i.priorWebsocketSuccess = !1;
|
|
99
|
+
const r = () => {
|
|
100
|
+
s || (e.send([{
|
|
101
|
+
type: "ping",
|
|
102
|
+
data: "probe"
|
|
103
|
+
}]), e.once("packet", (o) => {
|
|
104
|
+
if (!s)
|
|
105
|
+
if (o.type === "pong" && o.data === "probe") {
|
|
106
|
+
if (this.upgrading = !0, this.emitReserved("upgrading", e), !e)
|
|
107
|
+
return;
|
|
108
|
+
i.priorWebsocketSuccess = e.name === "websocket", this.transport.pause(() => {
|
|
109
|
+
s || this.readyState !== "closed" && (c(), this.setTransport(e), e.send([{
|
|
110
|
+
type: "upgrade"
|
|
111
|
+
}]), this.emitReserved("upgrade", e), e = null, this.upgrading = !1, this.flush());
|
|
112
|
+
});
|
|
113
|
+
} else {
|
|
114
|
+
const a = new Error("probe error");
|
|
115
|
+
a.transport = e.name, this.emitReserved("upgradeError", a);
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
};
|
|
119
|
+
function n() {
|
|
120
|
+
s || (s = !0, c(), e.close(), e = null);
|
|
121
|
+
}
|
|
122
|
+
const h = (o) => {
|
|
123
|
+
const a = new Error("probe error: " + o);
|
|
124
|
+
a.transport = e.name, n(), this.emitReserved("upgradeError", a);
|
|
125
|
+
};
|
|
126
|
+
function p() {
|
|
127
|
+
h("transport closed");
|
|
128
|
+
}
|
|
129
|
+
function l() {
|
|
130
|
+
h("socket closed");
|
|
131
|
+
}
|
|
132
|
+
function f(o) {
|
|
133
|
+
e && o.name !== e.name && n();
|
|
134
|
+
}
|
|
135
|
+
const c = () => {
|
|
136
|
+
e.removeListener("open", r), e.removeListener("error", h), e.removeListener("close", p), this.off("close", l), this.off("upgrading", f);
|
|
137
|
+
};
|
|
138
|
+
e.once("open", r), e.once("error", h), e.once("close", p), this.once("close", l), this.once("upgrading", f), this.upgrades.indexOf("webtransport") !== -1 && t !== "webtransport" ? this.setTimeoutFn(() => {
|
|
139
|
+
s || e.open();
|
|
140
|
+
}, 200) : e.open();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Called when connection is deemed open.
|
|
144
|
+
*
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
onOpen() {
|
|
148
|
+
if (this.readyState = "open", i.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush(), this.readyState === "open" && this.opts.upgrade) {
|
|
149
|
+
let t = 0;
|
|
150
|
+
const e = this.upgrades.length;
|
|
151
|
+
for (; t < e; t++)
|
|
152
|
+
this.probe(this.upgrades[t]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Handles a packet.
|
|
157
|
+
*
|
|
158
|
+
* @private
|
|
159
|
+
*/
|
|
160
|
+
onPacket(t) {
|
|
161
|
+
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing")
|
|
162
|
+
switch (this.emitReserved("packet", t), this.emitReserved("heartbeat"), this.resetPingTimeout(), t.type) {
|
|
163
|
+
case "open":
|
|
164
|
+
this.onHandshake(JSON.parse(t.data));
|
|
165
|
+
break;
|
|
166
|
+
case "ping":
|
|
167
|
+
this.sendPacket("pong"), this.emitReserved("ping"), this.emitReserved("pong");
|
|
168
|
+
break;
|
|
169
|
+
case "error":
|
|
170
|
+
const e = new Error("server error");
|
|
171
|
+
e.code = t.data, this.onError(e);
|
|
172
|
+
break;
|
|
173
|
+
case "message":
|
|
174
|
+
this.emitReserved("data", t.data), this.emitReserved("message", t.data);
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Called upon handshake completion.
|
|
180
|
+
*
|
|
181
|
+
* @param {Object} data - handshake obj
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
onHandshake(t) {
|
|
185
|
+
this.emitReserved("handshake", t), this.id = t.sid, this.transport.query.sid = t.sid, this.upgrades = this.filterUpgrades(t.upgrades), this.pingInterval = t.pingInterval, this.pingTimeout = t.pingTimeout, this.maxPayload = t.maxPayload, this.onOpen(), this.readyState !== "closed" && this.resetPingTimeout();
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Sets and resets ping timeout timer based on server pings.
|
|
189
|
+
*
|
|
190
|
+
* @private
|
|
191
|
+
*/
|
|
192
|
+
resetPingTimeout() {
|
|
193
|
+
this.clearTimeoutFn(this.pingTimeoutTimer), this.pingTimeoutTimer = this.setTimeoutFn(() => {
|
|
194
|
+
this.onClose("ping timeout");
|
|
195
|
+
}, this.pingInterval + this.pingTimeout), this.opts.autoUnref && this.pingTimeoutTimer.unref();
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Called on `drain` event
|
|
199
|
+
*
|
|
200
|
+
* @private
|
|
201
|
+
*/
|
|
202
|
+
onDrain() {
|
|
203
|
+
this.writeBuffer.splice(0, this.prevBufferLen), this.prevBufferLen = 0, this.writeBuffer.length === 0 ? this.emitReserved("drain") : this.flush();
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Flush write buffers.
|
|
207
|
+
*
|
|
208
|
+
* @private
|
|
209
|
+
*/
|
|
210
|
+
flush() {
|
|
211
|
+
if (this.readyState !== "closed" && this.transport.writable && !this.upgrading && this.writeBuffer.length) {
|
|
212
|
+
const t = this.getWritablePackets();
|
|
213
|
+
this.transport.send(t), this.prevBufferLen = t.length, this.emitReserved("flush");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Ensure the encoded size of the writeBuffer is below the maxPayload value sent by the server (only for HTTP
|
|
218
|
+
* long-polling)
|
|
219
|
+
*
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
222
|
+
getWritablePackets() {
|
|
223
|
+
if (!(this.maxPayload && this.transport.name === "polling" && this.writeBuffer.length > 1))
|
|
224
|
+
return this.writeBuffer;
|
|
225
|
+
let e = 1;
|
|
226
|
+
for (let s = 0; s < this.writeBuffer.length; s++) {
|
|
227
|
+
const r = this.writeBuffer[s].data;
|
|
228
|
+
if (r && (e += y(r)), s > 0 && e > this.maxPayload)
|
|
229
|
+
return this.writeBuffer.slice(0, s);
|
|
230
|
+
e += 2;
|
|
231
|
+
}
|
|
232
|
+
return this.writeBuffer;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Sends a message.
|
|
236
|
+
*
|
|
237
|
+
* @param {String} msg - message.
|
|
238
|
+
* @param {Object} options.
|
|
239
|
+
* @param {Function} callback function.
|
|
240
|
+
* @return {Socket} for chaining.
|
|
241
|
+
*/
|
|
242
|
+
write(t, e, s) {
|
|
243
|
+
return this.sendPacket("message", t, e, s), this;
|
|
244
|
+
}
|
|
245
|
+
send(t, e, s) {
|
|
246
|
+
return this.sendPacket("message", t, e, s), this;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Sends a packet.
|
|
250
|
+
*
|
|
251
|
+
* @param {String} type: packet type.
|
|
252
|
+
* @param {String} data.
|
|
253
|
+
* @param {Object} options.
|
|
254
|
+
* @param {Function} fn - callback function.
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
sendPacket(t, e, s, r) {
|
|
258
|
+
if (typeof e == "function" && (r = e, e = void 0), typeof s == "function" && (r = s, s = null), this.readyState === "closing" || this.readyState === "closed")
|
|
259
|
+
return;
|
|
260
|
+
s = s || {}, s.compress = s.compress !== !1;
|
|
261
|
+
const n = {
|
|
262
|
+
type: t,
|
|
263
|
+
data: e,
|
|
264
|
+
options: s
|
|
265
|
+
};
|
|
266
|
+
this.emitReserved("packetCreate", n), this.writeBuffer.push(n), r && this.once("flush", r), this.flush();
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Closes the connection.
|
|
270
|
+
*/
|
|
271
|
+
close() {
|
|
272
|
+
const t = () => {
|
|
273
|
+
this.onClose("forced close"), this.transport.close();
|
|
274
|
+
}, e = () => {
|
|
275
|
+
this.off("upgrade", e), this.off("upgradeError", e), t();
|
|
276
|
+
}, s = () => {
|
|
277
|
+
this.once("upgrade", e), this.once("upgradeError", e);
|
|
278
|
+
};
|
|
279
|
+
return (this.readyState === "opening" || this.readyState === "open") && (this.readyState = "closing", this.writeBuffer.length ? this.once("drain", () => {
|
|
280
|
+
this.upgrading ? s() : t();
|
|
281
|
+
}) : this.upgrading ? s() : t()), this;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Called upon transport error
|
|
285
|
+
*
|
|
286
|
+
* @private
|
|
287
|
+
*/
|
|
288
|
+
onError(t) {
|
|
289
|
+
i.priorWebsocketSuccess = !1, this.emitReserved("error", t), this.onClose("transport error", t);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Called upon transport close.
|
|
293
|
+
*
|
|
294
|
+
* @private
|
|
295
|
+
*/
|
|
296
|
+
onClose(t, e) {
|
|
297
|
+
(this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") && (this.clearTimeoutFn(this.pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), typeof removeEventListener == "function" && (removeEventListener("beforeunload", this.beforeunloadEventListener, !1), removeEventListener("offline", this.offlineEventListener, !1)), this.readyState = "closed", this.id = null, this.emitReserved("close", t, e), this.writeBuffer = [], this.prevBufferLen = 0);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Filters upgrades, returning only those matching client transports.
|
|
301
|
+
*
|
|
302
|
+
* @param {Array} upgrades - server upgrades
|
|
303
|
+
* @private
|
|
304
|
+
*/
|
|
305
|
+
filterUpgrades(t) {
|
|
306
|
+
const e = [];
|
|
307
|
+
let s = 0;
|
|
308
|
+
const r = t.length;
|
|
309
|
+
for (; s < r; s++)
|
|
310
|
+
~this.transports.indexOf(t[s]) && e.push(t[s]);
|
|
311
|
+
return e;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
i.protocol = u;
|
|
315
|
+
export {
|
|
316
|
+
i as Socket
|
|
317
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import "../../../engine.io-parser/build/esm/encodePacket.browser.mjs";
|
|
2
|
+
import { decodePacket as o } from "../../../engine.io-parser/build/esm/decodePacket.browser.mjs";
|
|
3
|
+
import "../../../engine.io-parser/build/esm/commons.mjs";
|
|
4
|
+
import { Emitter as i } from "../../../@socket.io/component-emitter/lib/esm/index.mjs";
|
|
5
|
+
import { installTimerFunctions as n } from "./util.mjs";
|
|
6
|
+
import { encode as p } from "./contrib/parseqs.mjs";
|
|
7
|
+
class h extends Error {
|
|
8
|
+
constructor(t, e, r) {
|
|
9
|
+
super(t), this.description = e, this.context = r, this.type = "TransportError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class y extends i {
|
|
13
|
+
/**
|
|
14
|
+
* Transport abstract constructor.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} opts - options
|
|
17
|
+
* @protected
|
|
18
|
+
*/
|
|
19
|
+
constructor(t) {
|
|
20
|
+
super(), this.writable = !1, n(this, t), this.opts = t, this.query = t.query, this.socket = t.socket;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Emits an error.
|
|
24
|
+
*
|
|
25
|
+
* @param {String} reason
|
|
26
|
+
* @param description
|
|
27
|
+
* @param context - the error context
|
|
28
|
+
* @return {Transport} for chaining
|
|
29
|
+
* @protected
|
|
30
|
+
*/
|
|
31
|
+
onError(t, e, r) {
|
|
32
|
+
return super.emitReserved("error", new h(t, e, r)), this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Opens the transport.
|
|
36
|
+
*/
|
|
37
|
+
open() {
|
|
38
|
+
return this.readyState = "opening", this.doOpen(), this;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Closes the transport.
|
|
42
|
+
*/
|
|
43
|
+
close() {
|
|
44
|
+
return (this.readyState === "opening" || this.readyState === "open") && (this.doClose(), this.onClose()), this;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sends multiple packets.
|
|
48
|
+
*
|
|
49
|
+
* @param {Array} packets
|
|
50
|
+
*/
|
|
51
|
+
send(t) {
|
|
52
|
+
this.readyState === "open" && this.write(t);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Called upon open
|
|
56
|
+
*
|
|
57
|
+
* @protected
|
|
58
|
+
*/
|
|
59
|
+
onOpen() {
|
|
60
|
+
this.readyState = "open", this.writable = !0, super.emitReserved("open");
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Called with data.
|
|
64
|
+
*
|
|
65
|
+
* @param {String} data
|
|
66
|
+
* @protected
|
|
67
|
+
*/
|
|
68
|
+
onData(t) {
|
|
69
|
+
const e = o(t, this.socket.binaryType);
|
|
70
|
+
this.onPacket(e);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Called with a decoded packet.
|
|
74
|
+
*
|
|
75
|
+
* @protected
|
|
76
|
+
*/
|
|
77
|
+
onPacket(t) {
|
|
78
|
+
super.emitReserved("packet", t);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Called upon close.
|
|
82
|
+
*
|
|
83
|
+
* @protected
|
|
84
|
+
*/
|
|
85
|
+
onClose(t) {
|
|
86
|
+
this.readyState = "closed", super.emitReserved("close", t);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Pauses the transport, in order not to lose packets during an upgrade.
|
|
90
|
+
*
|
|
91
|
+
* @param onPause
|
|
92
|
+
*/
|
|
93
|
+
pause(t) {
|
|
94
|
+
}
|
|
95
|
+
createUri(t, e = {}) {
|
|
96
|
+
return t + "://" + this._hostname() + this._port() + this.opts.path + this._query(e);
|
|
97
|
+
}
|
|
98
|
+
_hostname() {
|
|
99
|
+
const t = this.opts.hostname;
|
|
100
|
+
return t.indexOf(":") === -1 ? t : "[" + t + "]";
|
|
101
|
+
}
|
|
102
|
+
_port() {
|
|
103
|
+
return this.opts.port && (this.opts.secure && +(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
104
|
+
}
|
|
105
|
+
_query(t) {
|
|
106
|
+
const e = p(t);
|
|
107
|
+
return e.length ? "?" + e : "";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
y as Transport,
|
|
112
|
+
h as TransportError
|
|
113
|
+
};
|