@d19n/webchat 1.0.5 → 1.1.0
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.md +19 -14
- package/dist/TwilioChat/Chat.d.ts +3 -12
- package/dist/TwilioChat/components/ChatHeader.d.ts +5 -0
- package/dist/TwilioChat/components/ChatInput.d.ts +5 -0
- package/dist/TwilioChat/components/Container.d.ts +6 -0
- package/dist/TwilioChat/components/Message.d.ts +29 -0
- package/dist/TwilioChat/components/MessageList.d.ts +5 -0
- package/dist/TwilioChat/components/NotificationBar.d.ts +3 -0
- package/dist/TwilioChat/components/TypingIndicator.d.ts +5 -0
- package/dist/TwilioChat/components/Widget.d.ts +5 -0
- package/dist/TwilioChat/components/styled/ChatContent.d.ts +3 -0
- package/dist/TwilioChat/components/styled/ChatContentList.d.ts +3 -0
- package/dist/TwilioChat/components/styled/ChatWrapper.d.ts +3 -0
- package/dist/TwilioChat/components/styled/EventPost.d.ts +3 -0
- package/dist/TwilioChat/components/styled/Header.d.ts +3 -0
- package/dist/TwilioChat/components/styled/InputForm.d.ts +3 -0
- package/dist/TwilioChat/components/styled/MyPost.d.ts +3 -0
- package/dist/TwilioChat/components/styled/Splitter.d.ts +3 -0
- package/dist/TwilioChat/components/styled/WidgetButton.d.ts +3 -0
- package/dist/TwilioChat/components/styled/YFPost.d.ts +3 -0
- package/dist/TwilioChat/index.d.ts +2 -12
- package/dist/_virtual/_commonjsHelpers.js +1 -1
- package/dist/_virtual/index11.js +1 -1
- package/dist/_virtual/index2.js +1 -1
- package/dist/_virtual/index3.js +1 -1
- package/dist/_virtual/index5.js +1 -1
- package/dist/_virtual/index6.js +1 -1
- package/dist/_virtual/index7.js +1 -1
- package/dist/_virtual/index8.js +1 -1
- package/dist/assets/assets.d.ts +44 -0
- package/dist/assets/images/{svg/youfibre-upload.svg → youfibre-upload.svg} +4 -4
- package/dist/assets/styles/app.scss +242 -210
- package/dist/context/ChatGlobalContext.d.ts +31 -0
- package/dist/index.d.ts +2 -8
- package/dist/index.js +6 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -36
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js +1 -1
- package/dist/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js.map +1 -1
- package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +2 -0
- package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js.map +1 -0
- package/dist/node_modules/attr-accept/dist/es/index.js +1 -1
- package/dist/node_modules/classnames/index.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transport.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transport.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/polling-xhr.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/webtransport.js.map +1 -1
- package/dist/node_modules/mdast-util-gfm-strikethrough/from-markdown.js +1 -1
- package/dist/node_modules/mdast-util-gfm-table/from-markdown.js +1 -1
- package/dist/node_modules/micromark-extension-gfm-autolink-literal/syntax.js +1 -1
- package/dist/node_modules/micromark-extension-gfm-autolink-literal/syntax.js.map +1 -1
- package/dist/node_modules/micromark-extension-gfm-table/syntax.js +1 -1
- package/dist/node_modules/micromark-extension-gfm-table/syntax.js.map +1 -1
- package/dist/node_modules/micromark-extension-gfm-task-list-item/syntax.js +1 -1
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -1
- package/dist/node_modules/prop-types/index.js +1 -1
- package/dist/node_modules/prop-types/index.js.map +1 -1
- package/dist/node_modules/react-bootstrap/esm/Col.js +1 -1
- package/dist/node_modules/react-bootstrap/esm/Row.js +1 -1
- package/dist/node_modules/react-dropzone/dist/es/index.js.map +1 -1
- package/dist/node_modules/react-dropzone/dist/es/utils/index.js +1 -1
- package/dist/node_modules/react-dropzone/dist/es/utils/index.js.map +1 -1
- package/dist/node_modules/react-icons/bs/index.js +2 -0
- package/dist/node_modules/react-icons/bs/index.js.map +1 -0
- package/dist/node_modules/react-icons/io/index.js +2 -0
- package/dist/node_modules/react-icons/io/index.js.map +1 -0
- package/dist/node_modules/react-icons/lib/iconBase.js +2 -0
- package/dist/node_modules/react-icons/lib/iconBase.js.map +1 -0
- package/dist/node_modules/react-icons/lib/iconContext.js.map +1 -0
- package/dist/node_modules/react-is/cjs/react-is.development.js +3 -4
- package/dist/node_modules/react-is/cjs/react-is.development.js.map +1 -1
- package/dist/node_modules/{react-markdown/node_modules/react-is → react-is}/cjs/react-is.production.min.js +1 -1
- package/dist/node_modules/react-is/cjs/react-is.production.min.js.map +1 -0
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/react-is/index.js.map +1 -1
- package/dist/node_modules/react-markdown/lib/ast-to-react.js +1 -1
- package/dist/node_modules/react-markdown/lib/ast-to-react.js.map +1 -1
- package/dist/node_modules/react-modal-image/es/Image.js.map +1 -1
- package/dist/node_modules/react-modal-image/es/Lightbox.js.map +1 -1
- package/dist/node_modules/react-modal-image/es/styles.js.map +1 -1
- package/dist/node_modules/react-timer-hook/dist/index.js +1 -1
- package/dist/node_modules/react-toastify/dist/react-toastify.esm.js.map +1 -1
- package/dist/node_modules/socket.io-client/build/esm/manager.js.map +1 -1
- package/dist/node_modules/socket.io-client/build/esm/socket.js +1 -1
- package/dist/node_modules/socket.io-client/build/esm/socket.js.map +1 -1
- package/dist/node_modules/socket.io-parser/build/esm/index.js +1 -1
- package/dist/node_modules/socket.io-parser/build/esm/index.js.map +1 -1
- package/dist/node_modules/style-inject/dist/style-inject.es.js.map +1 -1
- package/dist/node_modules/styled-components/dist/styled-components.browser.esm.js +1 -1
- package/dist/node_modules/styled-components/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/node_modules/stylis/src/Enum.js +2 -0
- package/dist/node_modules/stylis/src/Enum.js.map +1 -0
- package/dist/node_modules/stylis/src/Middleware.js +2 -0
- package/dist/node_modules/stylis/src/Middleware.js.map +1 -0
- package/dist/node_modules/stylis/src/Parser.js +2 -0
- package/dist/node_modules/stylis/src/Parser.js.map +1 -0
- package/dist/node_modules/stylis/src/Prefixer.js +2 -0
- package/dist/node_modules/stylis/src/Prefixer.js.map +1 -0
- package/dist/node_modules/stylis/src/Serializer.js +2 -0
- package/dist/node_modules/stylis/src/Serializer.js.map +1 -0
- package/dist/node_modules/stylis/src/Tokenizer.js +2 -0
- package/dist/node_modules/stylis/src/Tokenizer.js.map +1 -0
- package/dist/node_modules/stylis/src/Utility.js +2 -0
- package/dist/node_modules/stylis/src/Utility.js.map +1 -0
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/package.json/package.json +30 -19
- package/dist/services/chatService.d.ts +48 -0
- package/dist/src/TwilioChat/Chat.js +1 -1
- package/dist/src/TwilioChat/Chat.js.map +1 -1
- package/dist/src/TwilioChat/components/ChatHeader.js +2 -0
- package/dist/src/TwilioChat/components/ChatHeader.js.map +1 -0
- package/dist/src/TwilioChat/components/ChatInput.js +2 -0
- package/dist/src/TwilioChat/components/ChatInput.js.map +1 -0
- package/dist/src/TwilioChat/components/Container.js +2 -0
- package/dist/src/TwilioChat/components/Container.js.map +1 -0
- package/dist/src/TwilioChat/components/Message.js +2 -0
- package/dist/src/TwilioChat/components/Message.js.map +1 -0
- package/dist/src/TwilioChat/components/MessageList.js +2 -0
- package/dist/src/TwilioChat/components/MessageList.js.map +1 -0
- package/dist/src/TwilioChat/components/NotificationBar.js +2 -0
- package/dist/src/TwilioChat/components/NotificationBar.js.map +1 -0
- package/dist/src/TwilioChat/components/TypingIndicator.js +2 -0
- package/dist/src/TwilioChat/components/TypingIndicator.js.map +1 -0
- package/dist/src/TwilioChat/components/Widget.js +2 -0
- package/dist/src/TwilioChat/components/Widget.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/ChatContent.js +2 -0
- package/dist/src/TwilioChat/components/styled/ChatContent.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/ChatContentList.js +2 -0
- package/dist/src/TwilioChat/components/styled/ChatContentList.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/ChatWrapper.js +2 -0
- package/dist/src/TwilioChat/components/styled/ChatWrapper.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/EventPost.js +2 -0
- package/dist/src/TwilioChat/components/styled/EventPost.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/Header.js +2 -0
- package/dist/src/TwilioChat/components/styled/Header.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/InputForm.js +2 -0
- package/dist/src/TwilioChat/components/styled/InputForm.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/MyPost.js +2 -0
- package/dist/src/TwilioChat/components/styled/MyPost.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/Splitter.js +2 -0
- package/dist/src/TwilioChat/components/styled/Splitter.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/WidgetButton.js +2 -0
- package/dist/src/TwilioChat/components/styled/WidgetButton.js.map +1 -0
- package/dist/src/TwilioChat/components/styled/YFPost.js +2 -0
- package/dist/src/TwilioChat/components/styled/YFPost.js.map +1 -0
- package/dist/src/TwilioChat/index.js +1 -1
- package/dist/src/TwilioChat/index.js.map +1 -1
- package/dist/src/assets/audio/notification.wav.js +2 -0
- package/dist/src/assets/audio/notification.wav.js.map +1 -0
- package/dist/src/assets/images/chat.svg.js +2 -0
- package/dist/src/assets/images/chat.svg.js.map +1 -0
- package/dist/src/assets/images/close.svg.js +2 -0
- package/dist/src/assets/images/close.svg.js.map +1 -0
- package/dist/src/assets/images/favicon.svg.js +2 -0
- package/dist/src/assets/images/favicon.svg.js.map +1 -0
- package/dist/src/assets/images/ico-close.png.js +2 -0
- package/dist/src/assets/images/ico-close.png.js.map +1 -0
- package/dist/src/assets/images/loader-transparent.gif.js +2 -0
- package/dist/src/assets/images/loader-transparent.gif.js.map +1 -0
- package/dist/src/assets/images/youfibre-upload.svg.js +2 -0
- package/dist/src/assets/images/youfibre-upload.svg.js.map +1 -0
- package/dist/src/assets/styles/app.scss.js +1 -1
- package/dist/src/context/ChatGlobalContext.js +2 -0
- package/dist/src/context/ChatGlobalContext.js.map +1 -0
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/services/chatService.js +2 -0
- package/dist/src/services/chatService.js.map +1 -0
- package/dist/src/utils/alert.js.map +1 -1
- package/dist/src/utils/chats.js +2 -0
- package/dist/src/utils/chats.js.map +1 -0
- package/dist/src/utils/helperFn.js +1 -1
- package/dist/src/utils/helperFn.js.map +1 -1
- package/dist/src/utils/validate.js +2 -0
- package/dist/src/utils/validate.js.map +1 -0
- package/dist/utils/helperFn.d.ts +18 -2
- package/dist/utils/validate.d.ts +3 -0
- package/package.json +26 -19
- package/dist/NotificationBar/index.d.ts +0 -3
- package/dist/_virtual/ConfigApi.js +0 -2
- package/dist/_virtual/ConfigApi.js.map +0 -1
- package/dist/_virtual/ConfigApi2.js +0 -2
- package/dist/_virtual/ConfigApi2.js.map +0 -1
- package/dist/_virtual/api.provider.js +0 -2
- package/dist/_virtual/api.provider.js.map +0 -1
- package/dist/_virtual/errors.js +0 -2
- package/dist/_virtual/errors.js.map +0 -1
- package/dist/_virtual/helpers.js +0 -2
- package/dist/_virtual/helpers.js.map +0 -1
- package/dist/_virtual/hoist-non-react-statics.cjs.js +0 -2
- package/dist/_virtual/hoist-non-react-statics.cjs.js.map +0 -1
- package/dist/_virtual/index12.js +0 -2
- package/dist/_virtual/index12.js.map +0 -1
- package/dist/_virtual/index13.js +0 -2
- package/dist/_virtual/index13.js.map +0 -1
- package/dist/_virtual/index14.js +0 -2
- package/dist/_virtual/index14.js.map +0 -1
- package/dist/_virtual/index15.js +0 -2
- package/dist/_virtual/index15.js.map +0 -1
- package/dist/_virtual/index16.js +0 -2
- package/dist/_virtual/index16.js.map +0 -1
- package/dist/_virtual/react-is.development2.js +0 -2
- package/dist/_virtual/react-is.development2.js.map +0 -1
- package/dist/_virtual/react-is.development3.js +0 -2
- package/dist/_virtual/react-is.development3.js.map +0 -1
- package/dist/_virtual/react-is.development4.js +0 -2
- package/dist/_virtual/react-is.development4.js.map +0 -1
- package/dist/_virtual/react-is.production.js +0 -2
- package/dist/_virtual/react-is.production.js.map +0 -1
- package/dist/_virtual/react-is.production.min2.js +0 -2
- package/dist/_virtual/react-is.production.min2.js.map +0 -1
- package/dist/_virtual/react-is.production.min3.js +0 -2
- package/dist/_virtual/react-is.production.min3.js.map +0 -1
- package/dist/_virtual/schema.types.js +0 -2
- package/dist/_virtual/schema.types.js.map +0 -1
- package/dist/api/api.d.ts +0 -17
- package/dist/assets/images/png/ico-chat.png +0 -0
- package/dist/context/GlobalContext.d.ts +0 -18
- package/dist/node_modules/@d19n/odin-sdk-generator/dist/api.provider.js +0 -2
- package/dist/node_modules/@d19n/odin-sdk-generator/dist/api.provider.js.map +0 -1
- package/dist/node_modules/@d19n/odin-sdk-generator/dist/utilities/helpers.js +0 -2
- package/dist/node_modules/@d19n/odin-sdk-generator/dist/utilities/helpers.js.map +0 -1
- package/dist/node_modules/@d19n/odin-types/dist/types/errors.js +0 -2
- package/dist/node_modules/@d19n/odin-types/dist/types/errors.js.map +0 -1
- package/dist/node_modules/@d19n/odin-types/dist/types/schema.types.js +0 -2
- package/dist/node_modules/@d19n/odin-types/dist/types/schema.types.js.map +0 -1
- package/dist/node_modules/@d19n/youfibre-odin-sdk/dist/api-sdk-v2/ConfigApi.js +0 -2
- package/dist/node_modules/@d19n/youfibre-odin-sdk/dist/api-sdk-v2/ConfigApi.js.map +0 -1
- package/dist/node_modules/@emotion/stylis/dist/stylis.browser.esm.js +0 -2
- package/dist/node_modules/@emotion/stylis/dist/stylis.browser.esm.js.map +0 -1
- package/dist/node_modules/@emotion/unitless/dist/unitless.browser.esm.js +0 -2
- package/dist/node_modules/@emotion/unitless/dist/unitless.browser.esm.js.map +0 -1
- package/dist/node_modules/camel-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/camel-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/capital-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/capital-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/change-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/change-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/constant-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/constant-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/dot-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/dot-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/header-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/header-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +0 -2
- package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js.map +0 -1
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js +0 -10
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js.map +0 -1
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js +0 -10
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js.map +0 -1
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +0 -2
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js.map +0 -1
- package/dist/node_modules/lower-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/lower-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/no-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/no-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/param-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/param-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/pascal-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/pascal-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/path-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/path-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -10
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +0 -1
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -10
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +0 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +0 -2
- package/dist/node_modules/prop-types/node_modules/react-is/index.js.map +0 -1
- package/dist/node_modules/react-icons/bs/index.esm.js +0 -2
- package/dist/node_modules/react-icons/bs/index.esm.js.map +0 -1
- package/dist/node_modules/react-icons/lib/esm/iconBase.js +0 -2
- package/dist/node_modules/react-icons/lib/esm/iconBase.js.map +0 -1
- package/dist/node_modules/react-icons/lib/esm/iconContext.js.map +0 -1
- package/dist/node_modules/react-is/cjs/react-is.production.js +0 -11
- package/dist/node_modules/react-is/cjs/react-is.production.js.map +0 -1
- package/dist/node_modules/react-markdown/node_modules/react-is/cjs/react-is.development.js +0 -10
- package/dist/node_modules/react-markdown/node_modules/react-is/cjs/react-is.development.js.map +0 -1
- package/dist/node_modules/react-markdown/node_modules/react-is/cjs/react-is.production.min.js.map +0 -1
- package/dist/node_modules/react-markdown/node_modules/react-is/index.js +0 -2
- package/dist/node_modules/react-markdown/node_modules/react-is/index.js.map +0 -1
- package/dist/node_modules/sentence-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/sentence-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/snake-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/snake-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/upper-case/dist.es2015/index.js +0 -2
- package/dist/node_modules/upper-case/dist.es2015/index.js.map +0 -1
- package/dist/node_modules/upper-case-first/dist.es2015/index.js +0 -2
- package/dist/node_modules/upper-case-first/dist.es2015/index.js.map +0 -1
- package/dist/src/NotificationBar/index.js +0 -2
- package/dist/src/NotificationBar/index.js.map +0 -1
- package/dist/src/api/api.js +0 -2
- package/dist/src/api/api.js.map +0 -1
- package/dist/src/context/GlobalContext.js +0 -2
- package/dist/src/context/GlobalContext.js.map +0 -1
- /package/dist/assets/images/{svg/chat.svg → chat.svg} +0 -0
- /package/dist/assets/images/{svg/close.svg → close.svg} +0 -0
- /package/dist/assets/images/{svg/favicon.svg → favicon.svg} +0 -0
- /package/dist/assets/images/{png/ico-close.png → ico-close.png} +0 -0
- /package/dist/assets/images/{gif/loader-transparent.gif → loader-transparent.gif} +0 -0
- /package/dist/node_modules/react-icons/lib/{esm/iconContext.js → iconContext.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.js","sources":["../../../../../node_modules/socket.io-client/build/esm/socket.js"],"sourcesContent":["import { PacketType } from \"socket.io-parser\";\nimport { on } from \"./on.js\";\nimport { Emitter, } from \"@socket.io/component-emitter\";\n/**\n * Internal events.\n * These events can't be emitted by the user.\n */\nconst RESERVED_EVENTS = Object.freeze({\n connect: 1,\n connect_error: 1,\n disconnect: 1,\n disconnecting: 1,\n // EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener\n newListener: 1,\n removeListener: 1,\n});\n/**\n * A Socket is the fundamental class for interacting with the server.\n *\n * A Socket belongs to a certain Namespace (by default /) and uses an underlying {@link Manager} to communicate.\n *\n * @example\n * const socket = io();\n *\n * socket.on(\"connect\", () => {\n * console.log(\"connected\");\n * });\n *\n * // send an event to the server\n * socket.emit(\"foo\", \"bar\");\n *\n * socket.on(\"foobar\", () => {\n * // an event was received from the server\n * });\n *\n * // upon disconnection\n * socket.on(\"disconnect\", (reason) => {\n * console.log(`disconnected due to ${reason}`);\n * });\n */\nexport class Socket extends Emitter {\n /**\n * `Socket` constructor.\n */\n constructor(io, nsp, opts) {\n super();\n /**\n * Whether the socket is currently connected to the server.\n *\n * @example\n * const socket = io();\n *\n * socket.on(\"connect\", () => {\n * console.log(socket.connected); // true\n * });\n *\n * socket.on(\"disconnect\", () => {\n * console.log(socket.connected); // false\n * });\n */\n this.connected = false;\n /**\n * Whether the connection state was recovered after a temporary disconnection. In that case, any missed packets will\n * be transmitted by the server.\n */\n this.recovered = false;\n /**\n * Buffer for packets received before the CONNECT packet\n */\n this.receiveBuffer = [];\n /**\n * Buffer for packets that will be sent once the socket is connected\n */\n this.sendBuffer = [];\n /**\n * The queue of packets to be sent with retry in case of failure.\n *\n * Packets are sent one by one, each waiting for the server acknowledgement, in order to guarantee the delivery order.\n * @private\n */\n this._queue = [];\n /**\n * A sequence to generate the ID of the {@link QueuedPacket}.\n * @private\n */\n this._queueSeq = 0;\n this.ids = 0;\n /**\n * A map containing acknowledgement handlers.\n *\n * The `withError` attribute is used to differentiate handlers that accept an error as first argument:\n *\n * - `socket.emit(\"test\", (err, value) => { ... })` with `ackTimeout` option\n * - `socket.timeout(5000).emit(\"test\", (err, value) => { ... })`\n * - `const value = await socket.emitWithAck(\"test\")`\n *\n * From those that don't:\n *\n * - `socket.emit(\"test\", (value) => { ... });`\n *\n * In the first case, the handlers will be called with an error when:\n *\n * - the timeout is reached\n * - the socket gets disconnected\n *\n * In the second case, the handlers will be simply discarded upon disconnection, since the client will never receive\n * an acknowledgement from the server.\n *\n * @private\n */\n this.acks = {};\n this.flags = {};\n this.io = io;\n this.nsp = nsp;\n if (opts && opts.auth) {\n this.auth = opts.auth;\n }\n this._opts = Object.assign({}, opts);\n if (this.io._autoConnect)\n this.open();\n }\n /**\n * Whether the socket is currently disconnected\n *\n * @example\n * const socket = io();\n *\n * socket.on(\"connect\", () => {\n * console.log(socket.disconnected); // false\n * });\n *\n * socket.on(\"disconnect\", () => {\n * console.log(socket.disconnected); // true\n * });\n */\n get disconnected() {\n return !this.connected;\n }\n /**\n * Subscribe to open, close and packet events\n *\n * @private\n */\n subEvents() {\n if (this.subs)\n return;\n const io = this.io;\n this.subs = [\n on(io, \"open\", this.onopen.bind(this)),\n on(io, \"packet\", this.onpacket.bind(this)),\n on(io, \"error\", this.onerror.bind(this)),\n on(io, \"close\", this.onclose.bind(this)),\n ];\n }\n /**\n * Whether the Socket will try to reconnect when its Manager connects or reconnects.\n *\n * @example\n * const socket = io();\n *\n * console.log(socket.active); // true\n *\n * socket.on(\"disconnect\", (reason) => {\n * if (reason === \"io server disconnect\") {\n * // the disconnection was initiated by the server, you need to manually reconnect\n * console.log(socket.active); // false\n * }\n * // else the socket will automatically try to reconnect\n * console.log(socket.active); // true\n * });\n */\n get active() {\n return !!this.subs;\n }\n /**\n * \"Opens\" the socket.\n *\n * @example\n * const socket = io({\n * autoConnect: false\n * });\n *\n * socket.connect();\n */\n connect() {\n if (this.connected)\n return this;\n this.subEvents();\n if (!this.io[\"_reconnecting\"])\n this.io.open(); // ensure open\n if (\"open\" === this.io._readyState)\n this.onopen();\n return this;\n }\n /**\n * Alias for {@link connect()}.\n */\n open() {\n return this.connect();\n }\n /**\n * Sends a `message` event.\n *\n * This method mimics the WebSocket.send() method.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send\n *\n * @example\n * socket.send(\"hello\");\n *\n * // this is equivalent to\n * socket.emit(\"message\", \"hello\");\n *\n * @return self\n */\n send(...args) {\n args.unshift(\"message\");\n this.emit.apply(this, args);\n return this;\n }\n /**\n * Override `emit`.\n * If the event is in `events`, it's emitted normally.\n *\n * @example\n * socket.emit(\"hello\", \"world\");\n *\n * // all serializable datastructures are supported (no need to call JSON.stringify)\n * socket.emit(\"hello\", 1, \"2\", { 3: [\"4\"], 5: Uint8Array.from([6]) });\n *\n * // with an acknowledgement from the server\n * socket.emit(\"hello\", \"world\", (val) => {\n * // ...\n * });\n *\n * @return self\n */\n emit(ev, ...args) {\n var _a, _b, _c;\n if (RESERVED_EVENTS.hasOwnProperty(ev)) {\n throw new Error('\"' + ev.toString() + '\" is a reserved event name');\n }\n args.unshift(ev);\n if (this._opts.retries && !this.flags.fromQueue && !this.flags.volatile) {\n this._addToQueue(args);\n return this;\n }\n const packet = {\n type: PacketType.EVENT,\n data: args,\n };\n packet.options = {};\n packet.options.compress = this.flags.compress !== false;\n // event ack callback\n if (\"function\" === typeof args[args.length - 1]) {\n const id = this.ids++;\n const ack = args.pop();\n this._registerAckCallback(id, ack);\n packet.id = id;\n }\n const isTransportWritable = (_b = (_a = this.io.engine) === null || _a === void 0 ? void 0 : _a.transport) === null || _b === void 0 ? void 0 : _b.writable;\n const isConnected = this.connected && !((_c = this.io.engine) === null || _c === void 0 ? void 0 : _c._hasPingExpired());\n const discardPacket = this.flags.volatile && !isTransportWritable;\n if (discardPacket) {\n }\n else if (isConnected) {\n this.notifyOutgoingListeners(packet);\n this.packet(packet);\n }\n else {\n this.sendBuffer.push(packet);\n }\n this.flags = {};\n return this;\n }\n /**\n * @private\n */\n _registerAckCallback(id, ack) {\n var _a;\n const timeout = (_a = this.flags.timeout) !== null && _a !== void 0 ? _a : this._opts.ackTimeout;\n if (timeout === undefined) {\n this.acks[id] = ack;\n return;\n }\n // @ts-ignore\n const timer = this.io.setTimeoutFn(() => {\n delete this.acks[id];\n for (let i = 0; i < this.sendBuffer.length; i++) {\n if (this.sendBuffer[i].id === id) {\n this.sendBuffer.splice(i, 1);\n }\n }\n ack.call(this, new Error(\"operation has timed out\"));\n }, timeout);\n const fn = (...args) => {\n // @ts-ignore\n this.io.clearTimeoutFn(timer);\n ack.apply(this, args);\n };\n fn.withError = true;\n this.acks[id] = fn;\n }\n /**\n * Emits an event and waits for an acknowledgement\n *\n * @example\n * // without timeout\n * const response = await socket.emitWithAck(\"hello\", \"world\");\n *\n * // with a specific timeout\n * try {\n * const response = await socket.timeout(1000).emitWithAck(\"hello\", \"world\");\n * } catch (err) {\n * // the server did not acknowledge the event in the given delay\n * }\n *\n * @return a Promise that will be fulfilled when the server acknowledges the event\n */\n emitWithAck(ev, ...args) {\n return new Promise((resolve, reject) => {\n const fn = (arg1, arg2) => {\n return arg1 ? reject(arg1) : resolve(arg2);\n };\n fn.withError = true;\n args.push(fn);\n this.emit(ev, ...args);\n });\n }\n /**\n * Add the packet to the queue.\n * @param args\n * @private\n */\n _addToQueue(args) {\n let ack;\n if (typeof args[args.length - 1] === \"function\") {\n ack = args.pop();\n }\n const packet = {\n id: this._queueSeq++,\n tryCount: 0,\n pending: false,\n args,\n flags: Object.assign({ fromQueue: true }, this.flags),\n };\n args.push((err, ...responseArgs) => {\n if (packet !== this._queue[0]) {\n // the packet has already been acknowledged\n return;\n }\n const hasError = err !== null;\n if (hasError) {\n if (packet.tryCount > this._opts.retries) {\n this._queue.shift();\n if (ack) {\n ack(err);\n }\n }\n }\n else {\n this._queue.shift();\n if (ack) {\n ack(null, ...responseArgs);\n }\n }\n packet.pending = false;\n return this._drainQueue();\n });\n this._queue.push(packet);\n this._drainQueue();\n }\n /**\n * Send the first packet of the queue, and wait for an acknowledgement from the server.\n * @param force - whether to resend a packet that has not been acknowledged yet\n *\n * @private\n */\n _drainQueue(force = false) {\n if (!this.connected || this._queue.length === 0) {\n return;\n }\n const packet = this._queue[0];\n if (packet.pending && !force) {\n return;\n }\n packet.pending = true;\n packet.tryCount++;\n this.flags = packet.flags;\n this.emit.apply(this, packet.args);\n }\n /**\n * Sends a packet.\n *\n * @param packet\n * @private\n */\n packet(packet) {\n packet.nsp = this.nsp;\n this.io._packet(packet);\n }\n /**\n * Called upon engine `open`.\n *\n * @private\n */\n onopen() {\n if (typeof this.auth == \"function\") {\n this.auth((data) => {\n this._sendConnectPacket(data);\n });\n }\n else {\n this._sendConnectPacket(this.auth);\n }\n }\n /**\n * Sends a CONNECT packet to initiate the Socket.IO session.\n *\n * @param data\n * @private\n */\n _sendConnectPacket(data) {\n this.packet({\n type: PacketType.CONNECT,\n data: this._pid\n ? Object.assign({ pid: this._pid, offset: this._lastOffset }, data)\n : data,\n });\n }\n /**\n * Called upon engine or manager `error`.\n *\n * @param err\n * @private\n */\n onerror(err) {\n if (!this.connected) {\n this.emitReserved(\"connect_error\", err);\n }\n }\n /**\n * Called upon engine `close`.\n *\n * @param reason\n * @param description\n * @private\n */\n onclose(reason, description) {\n this.connected = false;\n delete this.id;\n this.emitReserved(\"disconnect\", reason, description);\n this._clearAcks();\n }\n /**\n * Clears the acknowledgement handlers upon disconnection, since the client will never receive an acknowledgement from\n * the server.\n *\n * @private\n */\n _clearAcks() {\n Object.keys(this.acks).forEach((id) => {\n const isBuffered = this.sendBuffer.some((packet) => String(packet.id) === id);\n if (!isBuffered) {\n // note: handlers that do not accept an error as first argument are ignored here\n const ack = this.acks[id];\n delete this.acks[id];\n if (ack.withError) {\n ack.call(this, new Error(\"socket has been disconnected\"));\n }\n }\n });\n }\n /**\n * Called with socket packet.\n *\n * @param packet\n * @private\n */\n onpacket(packet) {\n const sameNamespace = packet.nsp === this.nsp;\n if (!sameNamespace)\n return;\n switch (packet.type) {\n case PacketType.CONNECT:\n if (packet.data && packet.data.sid) {\n this.onconnect(packet.data.sid, packet.data.pid);\n }\n else {\n this.emitReserved(\"connect_error\", new Error(\"It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)\"));\n }\n break;\n case PacketType.EVENT:\n case PacketType.BINARY_EVENT:\n this.onevent(packet);\n break;\n case PacketType.ACK:\n case PacketType.BINARY_ACK:\n this.onack(packet);\n break;\n case PacketType.DISCONNECT:\n this.ondisconnect();\n break;\n case PacketType.CONNECT_ERROR:\n this.destroy();\n const err = new Error(packet.data.message);\n // @ts-ignore\n err.data = packet.data.data;\n this.emitReserved(\"connect_error\", err);\n break;\n }\n }\n /**\n * Called upon a server event.\n *\n * @param packet\n * @private\n */\n onevent(packet) {\n const args = packet.data || [];\n if (null != packet.id) {\n args.push(this.ack(packet.id));\n }\n if (this.connected) {\n this.emitEvent(args);\n }\n else {\n this.receiveBuffer.push(Object.freeze(args));\n }\n }\n emitEvent(args) {\n if (this._anyListeners && this._anyListeners.length) {\n const listeners = this._anyListeners.slice();\n for (const listener of listeners) {\n listener.apply(this, args);\n }\n }\n super.emit.apply(this, args);\n if (this._pid && args.length && typeof args[args.length - 1] === \"string\") {\n this._lastOffset = args[args.length - 1];\n }\n }\n /**\n * Produces an ack callback to emit with an event.\n *\n * @private\n */\n ack(id) {\n const self = this;\n let sent = false;\n return function (...args) {\n // prevent double callbacks\n if (sent)\n return;\n sent = true;\n self.packet({\n type: PacketType.ACK,\n id: id,\n data: args,\n });\n };\n }\n /**\n * Called upon a server acknowledgement.\n *\n * @param packet\n * @private\n */\n onack(packet) {\n const ack = this.acks[packet.id];\n if (typeof ack !== \"function\") {\n return;\n }\n delete this.acks[packet.id];\n // @ts-ignore FIXME ack is incorrectly inferred as 'never'\n if (ack.withError) {\n packet.data.unshift(null);\n }\n // @ts-ignore\n ack.apply(this, packet.data);\n }\n /**\n * Called upon server connect.\n *\n * @private\n */\n onconnect(id, pid) {\n this.id = id;\n this.recovered = pid && this._pid === pid;\n this._pid = pid; // defined only if connection state recovery is enabled\n this.connected = true;\n this.emitBuffered();\n this.emitReserved(\"connect\");\n this._drainQueue(true);\n }\n /**\n * Emit buffered events (received and emitted).\n *\n * @private\n */\n emitBuffered() {\n this.receiveBuffer.forEach((args) => this.emitEvent(args));\n this.receiveBuffer = [];\n this.sendBuffer.forEach((packet) => {\n this.notifyOutgoingListeners(packet);\n this.packet(packet);\n });\n this.sendBuffer = [];\n }\n /**\n * Called upon server disconnect.\n *\n * @private\n */\n ondisconnect() {\n this.destroy();\n this.onclose(\"io server disconnect\");\n }\n /**\n * Called upon forced client/server side disconnections,\n * this method ensures the manager stops tracking us and\n * that reconnections don't get triggered for this.\n *\n * @private\n */\n destroy() {\n if (this.subs) {\n // clean subscriptions to avoid reconnections\n this.subs.forEach((subDestroy) => subDestroy());\n this.subs = undefined;\n }\n this.io[\"_destroy\"](this);\n }\n /**\n * Disconnects the socket manually. In that case, the socket will not try to reconnect.\n *\n * If this is the last active Socket instance of the {@link Manager}, the low-level connection will be closed.\n *\n * @example\n * const socket = io();\n *\n * socket.on(\"disconnect\", (reason) => {\n * // console.log(reason); prints \"io client disconnect\"\n * });\n *\n * socket.disconnect();\n *\n * @return self\n */\n disconnect() {\n if (this.connected) {\n this.packet({ type: PacketType.DISCONNECT });\n }\n // remove socket from pool\n this.destroy();\n if (this.connected) {\n // fire events\n this.onclose(\"io client disconnect\");\n }\n return this;\n }\n /**\n * Alias for {@link disconnect()}.\n *\n * @return self\n */\n close() {\n return this.disconnect();\n }\n /**\n * Sets the compress flag.\n *\n * @example\n * socket.compress(false).emit(\"hello\");\n *\n * @param compress - if `true`, compresses the sending data\n * @return self\n */\n compress(compress) {\n this.flags.compress = compress;\n return this;\n }\n /**\n * Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not\n * ready to send messages.\n *\n * @example\n * socket.volatile.emit(\"hello\"); // the server may or may not receive it\n *\n * @returns self\n */\n get volatile() {\n this.flags.volatile = true;\n return this;\n }\n /**\n * Sets a modifier for a subsequent event emission that the callback will be called with an error when the\n * given number of milliseconds have elapsed without an acknowledgement from the server:\n *\n * @example\n * socket.timeout(5000).emit(\"my-event\", (err) => {\n * if (err) {\n * // the server did not acknowledge the event in the given delay\n * }\n * });\n *\n * @returns self\n */\n timeout(timeout) {\n this.flags.timeout = timeout;\n return this;\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback.\n *\n * @example\n * socket.onAny((event, ...args) => {\n * console.log(`got ${event}`);\n * });\n *\n * @param listener\n */\n onAny(listener) {\n this._anyListeners = this._anyListeners || [];\n this._anyListeners.push(listener);\n return this;\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback. The listener is added to the beginning of the listeners array.\n *\n * @example\n * socket.prependAny((event, ...args) => {\n * console.log(`got event ${event}`);\n * });\n *\n * @param listener\n */\n prependAny(listener) {\n this._anyListeners = this._anyListeners || [];\n this._anyListeners.unshift(listener);\n return this;\n }\n /**\n * Removes the listener that will be fired when any event is emitted.\n *\n * @example\n * const catchAllListener = (event, ...args) => {\n * console.log(`got event ${event}`);\n * }\n *\n * socket.onAny(catchAllListener);\n *\n * // remove a specific listener\n * socket.offAny(catchAllListener);\n *\n * // or remove all listeners\n * socket.offAny();\n *\n * @param listener\n */\n offAny(listener) {\n if (!this._anyListeners) {\n return this;\n }\n if (listener) {\n const listeners = this._anyListeners;\n for (let i = 0; i < listeners.length; i++) {\n if (listener === listeners[i]) {\n listeners.splice(i, 1);\n return this;\n }\n }\n }\n else {\n this._anyListeners = [];\n }\n return this;\n }\n /**\n * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,\n * e.g. to remove listeners.\n */\n listenersAny() {\n return this._anyListeners || [];\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback.\n *\n * Note: acknowledgements sent to the server are not included.\n *\n * @example\n * socket.onAnyOutgoing((event, ...args) => {\n * console.log(`sent event ${event}`);\n * });\n *\n * @param listener\n */\n onAnyOutgoing(listener) {\n this._anyOutgoingListeners = this._anyOutgoingListeners || [];\n this._anyOutgoingListeners.push(listener);\n return this;\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback. The listener is added to the beginning of the listeners array.\n *\n * Note: acknowledgements sent to the server are not included.\n *\n * @example\n * socket.prependAnyOutgoing((event, ...args) => {\n * console.log(`sent event ${event}`);\n * });\n *\n * @param listener\n */\n prependAnyOutgoing(listener) {\n this._anyOutgoingListeners = this._anyOutgoingListeners || [];\n this._anyOutgoingListeners.unshift(listener);\n return this;\n }\n /**\n * Removes the listener that will be fired when any event is emitted.\n *\n * @example\n * const catchAllListener = (event, ...args) => {\n * console.log(`sent event ${event}`);\n * }\n *\n * socket.onAnyOutgoing(catchAllListener);\n *\n * // remove a specific listener\n * socket.offAnyOutgoing(catchAllListener);\n *\n * // or remove all listeners\n * socket.offAnyOutgoing();\n *\n * @param [listener] - the catch-all listener (optional)\n */\n offAnyOutgoing(listener) {\n if (!this._anyOutgoingListeners) {\n return this;\n }\n if (listener) {\n const listeners = this._anyOutgoingListeners;\n for (let i = 0; i < listeners.length; i++) {\n if (listener === listeners[i]) {\n listeners.splice(i, 1);\n return this;\n }\n }\n }\n else {\n this._anyOutgoingListeners = [];\n }\n return this;\n }\n /**\n * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,\n * e.g. to remove listeners.\n */\n listenersAnyOutgoing() {\n return this._anyOutgoingListeners || [];\n }\n /**\n * Notify the listeners for each packet sent\n *\n * @param packet\n *\n * @private\n */\n notifyOutgoingListeners(packet) {\n if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) {\n const listeners = this._anyOutgoingListeners.slice();\n for (const listener of listeners) {\n listener.apply(this, packet.data);\n }\n }\n }\n}\n"],"names":["RESERVED_EVENTS","Object","freeze","connect","connect_error","disconnect","disconnecting","newListener","removeListener","Socket","Emitter","constructor","io","nsp","opts","super","this","connected","recovered","receiveBuffer","sendBuffer","_queue","_queueSeq","ids","acks","flags","auth","_opts","assign","_autoConnect","open","disconnected","subEvents","subs","on","onopen","bind","onpacket","onerror","onclose","active","_readyState","send","args","unshift","emit","apply","ev","_a","_b","_c","hasOwnProperty","Error","toString","retries","fromQueue","volatile","_addToQueue","packet","type","PacketType","EVENT","data","options","compress","length","id","ack","pop","_registerAckCallback","isTransportWritable","engine","transport","writable","isConnected","_hasPingExpired","notifyOutgoingListeners","push","timeout","ackTimeout","undefined","timer","setTimeoutFn","i","splice","call","fn","clearTimeoutFn","withError","emitWithAck","Promise","resolve","reject","arg1","arg2","tryCount","pending","err","responseArgs","shift","_drainQueue","force","_packet","_sendConnectPacket","CONNECT","_pid","pid","offset","_lastOffset","emitReserved","reason","description","_clearAcks","keys","forEach","some","String","sid","onconnect","BINARY_EVENT","onevent","ACK","BINARY_ACK","onack","DISCONNECT","ondisconnect","CONNECT_ERROR","destroy","message","emitEvent","_anyListeners","listeners","slice","listener","self","sent","emitBuffered","subDestroy","close","onAny","prependAny","offAny","listenersAny","onAnyOutgoing","_anyOutgoingListeners","prependAnyOutgoing","offAnyOutgoing","listenersAnyOutgoing"],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AAKgI,uBAAyBhI,KAAKgI,sBAAsB/E,OAAQ,CACjE,MAAMkE,EAAYnH,KAAKgI,sBAAsBZ,QAC7C,IAAK,MAAMC,KAAYF,EACnBE,EAASvF,MAAM9B,KAAM0C,EAAOI,KAEpC,CACJ","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"socket.js","sources":["../../../../../node_modules/socket.io-client/build/esm/socket.js"],"sourcesContent":["import { PacketType } from \"socket.io-parser\";\nimport { on } from \"./on.js\";\nimport { Emitter, } from \"@socket.io/component-emitter\";\n/**\n * Internal events.\n * These events can't be emitted by the user.\n */\nconst RESERVED_EVENTS = Object.freeze({\n connect: 1,\n connect_error: 1,\n disconnect: 1,\n disconnecting: 1,\n // EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener\n newListener: 1,\n removeListener: 1,\n});\n/**\n * A Socket is the fundamental class for interacting with the server.\n *\n * A Socket belongs to a certain Namespace (by default /) and uses an underlying {@link Manager} to communicate.\n *\n * @example\n * const socket = io();\n *\n * socket.on(\"connect\", () => {\n * console.log(\"connected\");\n * });\n *\n * // send an event to the server\n * socket.emit(\"foo\", \"bar\");\n *\n * socket.on(\"foobar\", () => {\n * // an event was received from the server\n * });\n *\n * // upon disconnection\n * socket.on(\"disconnect\", (reason) => {\n * console.log(`disconnected due to ${reason}`);\n * });\n */\nexport class Socket extends Emitter {\n /**\n * `Socket` constructor.\n */\n constructor(io, nsp, opts) {\n super();\n /**\n * Whether the socket is currently connected to the server.\n *\n * @example\n * const socket = io();\n *\n * socket.on(\"connect\", () => {\n * console.log(socket.connected); // true\n * });\n *\n * socket.on(\"disconnect\", () => {\n * console.log(socket.connected); // false\n * });\n */\n this.connected = false;\n /**\n * Whether the connection state was recovered after a temporary disconnection. In that case, any missed packets will\n * be transmitted by the server.\n */\n this.recovered = false;\n /**\n * Buffer for packets received before the CONNECT packet\n */\n this.receiveBuffer = [];\n /**\n * Buffer for packets that will be sent once the socket is connected\n */\n this.sendBuffer = [];\n /**\n * The queue of packets to be sent with retry in case of failure.\n *\n * Packets are sent one by one, each waiting for the server acknowledgement, in order to guarantee the delivery order.\n * @private\n */\n this._queue = [];\n /**\n * A sequence to generate the ID of the {@link QueuedPacket}.\n * @private\n */\n this._queueSeq = 0;\n this.ids = 0;\n /**\n * A map containing acknowledgement handlers.\n *\n * The `withError` attribute is used to differentiate handlers that accept an error as first argument:\n *\n * - `socket.emit(\"test\", (err, value) => { ... })` with `ackTimeout` option\n * - `socket.timeout(5000).emit(\"test\", (err, value) => { ... })`\n * - `const value = await socket.emitWithAck(\"test\")`\n *\n * From those that don't:\n *\n * - `socket.emit(\"test\", (value) => { ... });`\n *\n * In the first case, the handlers will be called with an error when:\n *\n * - the timeout is reached\n * - the socket gets disconnected\n *\n * In the second case, the handlers will be simply discarded upon disconnection, since the client will never receive\n * an acknowledgement from the server.\n *\n * @private\n */\n this.acks = {};\n this.flags = {};\n this.io = io;\n this.nsp = nsp;\n if (opts && opts.auth) {\n this.auth = opts.auth;\n }\n this._opts = Object.assign({}, opts);\n if (this.io._autoConnect)\n this.open();\n }\n /**\n * Whether the socket is currently disconnected\n *\n * @example\n * const socket = io();\n *\n * socket.on(\"connect\", () => {\n * console.log(socket.disconnected); // false\n * });\n *\n * socket.on(\"disconnect\", () => {\n * console.log(socket.disconnected); // true\n * });\n */\n get disconnected() {\n return !this.connected;\n }\n /**\n * Subscribe to open, close and packet events\n *\n * @private\n */\n subEvents() {\n if (this.subs)\n return;\n const io = this.io;\n this.subs = [\n on(io, \"open\", this.onopen.bind(this)),\n on(io, \"packet\", this.onpacket.bind(this)),\n on(io, \"error\", this.onerror.bind(this)),\n on(io, \"close\", this.onclose.bind(this)),\n ];\n }\n /**\n * Whether the Socket will try to reconnect when its Manager connects or reconnects.\n *\n * @example\n * const socket = io();\n *\n * console.log(socket.active); // true\n *\n * socket.on(\"disconnect\", (reason) => {\n * if (reason === \"io server disconnect\") {\n * // the disconnection was initiated by the server, you need to manually reconnect\n * console.log(socket.active); // false\n * }\n * // else the socket will automatically try to reconnect\n * console.log(socket.active); // true\n * });\n */\n get active() {\n return !!this.subs;\n }\n /**\n * \"Opens\" the socket.\n *\n * @example\n * const socket = io({\n * autoConnect: false\n * });\n *\n * socket.connect();\n */\n connect() {\n if (this.connected)\n return this;\n this.subEvents();\n if (!this.io[\"_reconnecting\"])\n this.io.open(); // ensure open\n if (\"open\" === this.io._readyState)\n this.onopen();\n return this;\n }\n /**\n * Alias for {@link connect()}.\n */\n open() {\n return this.connect();\n }\n /**\n * Sends a `message` event.\n *\n * This method mimics the WebSocket.send() method.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send\n *\n * @example\n * socket.send(\"hello\");\n *\n * // this is equivalent to\n * socket.emit(\"message\", \"hello\");\n *\n * @return self\n */\n send(...args) {\n args.unshift(\"message\");\n this.emit.apply(this, args);\n return this;\n }\n /**\n * Override `emit`.\n * If the event is in `events`, it's emitted normally.\n *\n * @example\n * socket.emit(\"hello\", \"world\");\n *\n * // all serializable datastructures are supported (no need to call JSON.stringify)\n * socket.emit(\"hello\", 1, \"2\", { 3: [\"4\"], 5: Uint8Array.from([6]) });\n *\n * // with an acknowledgement from the server\n * socket.emit(\"hello\", \"world\", (val) => {\n * // ...\n * });\n *\n * @return self\n */\n emit(ev, ...args) {\n var _a, _b, _c;\n if (RESERVED_EVENTS.hasOwnProperty(ev)) {\n throw new Error('\"' + ev.toString() + '\" is a reserved event name');\n }\n args.unshift(ev);\n if (this._opts.retries && !this.flags.fromQueue && !this.flags.volatile) {\n this._addToQueue(args);\n return this;\n }\n const packet = {\n type: PacketType.EVENT,\n data: args,\n };\n packet.options = {};\n packet.options.compress = this.flags.compress !== false;\n // event ack callback\n if (\"function\" === typeof args[args.length - 1]) {\n const id = this.ids++;\n const ack = args.pop();\n this._registerAckCallback(id, ack);\n packet.id = id;\n }\n const isTransportWritable = (_b = (_a = this.io.engine) === null || _a === void 0 ? void 0 : _a.transport) === null || _b === void 0 ? void 0 : _b.writable;\n const isConnected = this.connected && !((_c = this.io.engine) === null || _c === void 0 ? void 0 : _c._hasPingExpired());\n const discardPacket = this.flags.volatile && !isTransportWritable;\n if (discardPacket) {\n }\n else if (isConnected) {\n this.notifyOutgoingListeners(packet);\n this.packet(packet);\n }\n else {\n this.sendBuffer.push(packet);\n }\n this.flags = {};\n return this;\n }\n /**\n * @private\n */\n _registerAckCallback(id, ack) {\n var _a;\n const timeout = (_a = this.flags.timeout) !== null && _a !== void 0 ? _a : this._opts.ackTimeout;\n if (timeout === undefined) {\n this.acks[id] = ack;\n return;\n }\n // @ts-ignore\n const timer = this.io.setTimeoutFn(() => {\n delete this.acks[id];\n for (let i = 0; i < this.sendBuffer.length; i++) {\n if (this.sendBuffer[i].id === id) {\n this.sendBuffer.splice(i, 1);\n }\n }\n ack.call(this, new Error(\"operation has timed out\"));\n }, timeout);\n const fn = (...args) => {\n // @ts-ignore\n this.io.clearTimeoutFn(timer);\n ack.apply(this, args);\n };\n fn.withError = true;\n this.acks[id] = fn;\n }\n /**\n * Emits an event and waits for an acknowledgement\n *\n * @example\n * // without timeout\n * const response = await socket.emitWithAck(\"hello\", \"world\");\n *\n * // with a specific timeout\n * try {\n * const response = await socket.timeout(1000).emitWithAck(\"hello\", \"world\");\n * } catch (err) {\n * // the server did not acknowledge the event in the given delay\n * }\n *\n * @return a Promise that will be fulfilled when the server acknowledges the event\n */\n emitWithAck(ev, ...args) {\n return new Promise((resolve, reject) => {\n const fn = (arg1, arg2) => {\n return arg1 ? reject(arg1) : resolve(arg2);\n };\n fn.withError = true;\n args.push(fn);\n this.emit(ev, ...args);\n });\n }\n /**\n * Add the packet to the queue.\n * @param args\n * @private\n */\n _addToQueue(args) {\n let ack;\n if (typeof args[args.length - 1] === \"function\") {\n ack = args.pop();\n }\n const packet = {\n id: this._queueSeq++,\n tryCount: 0,\n pending: false,\n args,\n flags: Object.assign({ fromQueue: true }, this.flags),\n };\n args.push((err, ...responseArgs) => {\n if (packet !== this._queue[0]) {\n }\n const hasError = err !== null;\n if (hasError) {\n if (packet.tryCount > this._opts.retries) {\n this._queue.shift();\n if (ack) {\n ack(err);\n }\n }\n }\n else {\n this._queue.shift();\n if (ack) {\n ack(null, ...responseArgs);\n }\n }\n packet.pending = false;\n return this._drainQueue();\n });\n this._queue.push(packet);\n this._drainQueue();\n }\n /**\n * Send the first packet of the queue, and wait for an acknowledgement from the server.\n * @param force - whether to resend a packet that has not been acknowledged yet\n *\n * @private\n */\n _drainQueue(force = false) {\n if (!this.connected || this._queue.length === 0) {\n return;\n }\n const packet = this._queue[0];\n if (packet.pending && !force) {\n return;\n }\n packet.pending = true;\n packet.tryCount++;\n this.flags = packet.flags;\n this.emit.apply(this, packet.args);\n }\n /**\n * Sends a packet.\n *\n * @param packet\n * @private\n */\n packet(packet) {\n packet.nsp = this.nsp;\n this.io._packet(packet);\n }\n /**\n * Called upon engine `open`.\n *\n * @private\n */\n onopen() {\n if (typeof this.auth == \"function\") {\n this.auth((data) => {\n this._sendConnectPacket(data);\n });\n }\n else {\n this._sendConnectPacket(this.auth);\n }\n }\n /**\n * Sends a CONNECT packet to initiate the Socket.IO session.\n *\n * @param data\n * @private\n */\n _sendConnectPacket(data) {\n this.packet({\n type: PacketType.CONNECT,\n data: this._pid\n ? Object.assign({ pid: this._pid, offset: this._lastOffset }, data)\n : data,\n });\n }\n /**\n * Called upon engine or manager `error`.\n *\n * @param err\n * @private\n */\n onerror(err) {\n if (!this.connected) {\n this.emitReserved(\"connect_error\", err);\n }\n }\n /**\n * Called upon engine `close`.\n *\n * @param reason\n * @param description\n * @private\n */\n onclose(reason, description) {\n this.connected = false;\n delete this.id;\n this.emitReserved(\"disconnect\", reason, description);\n this._clearAcks();\n }\n /**\n * Clears the acknowledgement handlers upon disconnection, since the client will never receive an acknowledgement from\n * the server.\n *\n * @private\n */\n _clearAcks() {\n Object.keys(this.acks).forEach((id) => {\n const isBuffered = this.sendBuffer.some((packet) => String(packet.id) === id);\n if (!isBuffered) {\n // note: handlers that do not accept an error as first argument are ignored here\n const ack = this.acks[id];\n delete this.acks[id];\n if (ack.withError) {\n ack.call(this, new Error(\"socket has been disconnected\"));\n }\n }\n });\n }\n /**\n * Called with socket packet.\n *\n * @param packet\n * @private\n */\n onpacket(packet) {\n const sameNamespace = packet.nsp === this.nsp;\n if (!sameNamespace)\n return;\n switch (packet.type) {\n case PacketType.CONNECT:\n if (packet.data && packet.data.sid) {\n this.onconnect(packet.data.sid, packet.data.pid);\n }\n else {\n this.emitReserved(\"connect_error\", new Error(\"It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)\"));\n }\n break;\n case PacketType.EVENT:\n case PacketType.BINARY_EVENT:\n this.onevent(packet);\n break;\n case PacketType.ACK:\n case PacketType.BINARY_ACK:\n this.onack(packet);\n break;\n case PacketType.DISCONNECT:\n this.ondisconnect();\n break;\n case PacketType.CONNECT_ERROR:\n this.destroy();\n const err = new Error(packet.data.message);\n // @ts-ignore\n err.data = packet.data.data;\n this.emitReserved(\"connect_error\", err);\n break;\n }\n }\n /**\n * Called upon a server event.\n *\n * @param packet\n * @private\n */\n onevent(packet) {\n const args = packet.data || [];\n if (null != packet.id) {\n args.push(this.ack(packet.id));\n }\n if (this.connected) {\n this.emitEvent(args);\n }\n else {\n this.receiveBuffer.push(Object.freeze(args));\n }\n }\n emitEvent(args) {\n if (this._anyListeners && this._anyListeners.length) {\n const listeners = this._anyListeners.slice();\n for (const listener of listeners) {\n listener.apply(this, args);\n }\n }\n super.emit.apply(this, args);\n if (this._pid && args.length && typeof args[args.length - 1] === \"string\") {\n this._lastOffset = args[args.length - 1];\n }\n }\n /**\n * Produces an ack callback to emit with an event.\n *\n * @private\n */\n ack(id) {\n const self = this;\n let sent = false;\n return function (...args) {\n // prevent double callbacks\n if (sent)\n return;\n sent = true;\n self.packet({\n type: PacketType.ACK,\n id: id,\n data: args,\n });\n };\n }\n /**\n * Called upon a server acknowledgement.\n *\n * @param packet\n * @private\n */\n onack(packet) {\n const ack = this.acks[packet.id];\n if (typeof ack !== \"function\") {\n return;\n }\n delete this.acks[packet.id];\n // @ts-ignore FIXME ack is incorrectly inferred as 'never'\n if (ack.withError) {\n packet.data.unshift(null);\n }\n // @ts-ignore\n ack.apply(this, packet.data);\n }\n /**\n * Called upon server connect.\n *\n * @private\n */\n onconnect(id, pid) {\n this.id = id;\n this.recovered = pid && this._pid === pid;\n this._pid = pid; // defined only if connection state recovery is enabled\n this.connected = true;\n this.emitBuffered();\n this._drainQueue(true);\n this.emitReserved(\"connect\");\n }\n /**\n * Emit buffered events (received and emitted).\n *\n * @private\n */\n emitBuffered() {\n this.receiveBuffer.forEach((args) => this.emitEvent(args));\n this.receiveBuffer = [];\n this.sendBuffer.forEach((packet) => {\n this.notifyOutgoingListeners(packet);\n this.packet(packet);\n });\n this.sendBuffer = [];\n }\n /**\n * Called upon server disconnect.\n *\n * @private\n */\n ondisconnect() {\n this.destroy();\n this.onclose(\"io server disconnect\");\n }\n /**\n * Called upon forced client/server side disconnections,\n * this method ensures the manager stops tracking us and\n * that reconnections don't get triggered for this.\n *\n * @private\n */\n destroy() {\n if (this.subs) {\n // clean subscriptions to avoid reconnections\n this.subs.forEach((subDestroy) => subDestroy());\n this.subs = undefined;\n }\n this.io[\"_destroy\"](this);\n }\n /**\n * Disconnects the socket manually. In that case, the socket will not try to reconnect.\n *\n * If this is the last active Socket instance of the {@link Manager}, the low-level connection will be closed.\n *\n * @example\n * const socket = io();\n *\n * socket.on(\"disconnect\", (reason) => {\n * // console.log(reason); prints \"io client disconnect\"\n * });\n *\n * socket.disconnect();\n *\n * @return self\n */\n disconnect() {\n if (this.connected) {\n this.packet({ type: PacketType.DISCONNECT });\n }\n // remove socket from pool\n this.destroy();\n if (this.connected) {\n // fire events\n this.onclose(\"io client disconnect\");\n }\n return this;\n }\n /**\n * Alias for {@link disconnect()}.\n *\n * @return self\n */\n close() {\n return this.disconnect();\n }\n /**\n * Sets the compress flag.\n *\n * @example\n * socket.compress(false).emit(\"hello\");\n *\n * @param compress - if `true`, compresses the sending data\n * @return self\n */\n compress(compress) {\n this.flags.compress = compress;\n return this;\n }\n /**\n * Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not\n * ready to send messages.\n *\n * @example\n * socket.volatile.emit(\"hello\"); // the server may or may not receive it\n *\n * @returns self\n */\n get volatile() {\n this.flags.volatile = true;\n return this;\n }\n /**\n * Sets a modifier for a subsequent event emission that the callback will be called with an error when the\n * given number of milliseconds have elapsed without an acknowledgement from the server:\n *\n * @example\n * socket.timeout(5000).emit(\"my-event\", (err) => {\n * if (err) {\n * // the server did not acknowledge the event in the given delay\n * }\n * });\n *\n * @returns self\n */\n timeout(timeout) {\n this.flags.timeout = timeout;\n return this;\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback.\n *\n * @example\n * socket.onAny((event, ...args) => {\n * console.log(`got ${event}`);\n * });\n *\n * @param listener\n */\n onAny(listener) {\n this._anyListeners = this._anyListeners || [];\n this._anyListeners.push(listener);\n return this;\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback. The listener is added to the beginning of the listeners array.\n *\n * @example\n * socket.prependAny((event, ...args) => {\n * console.log(`got event ${event}`);\n * });\n *\n * @param listener\n */\n prependAny(listener) {\n this._anyListeners = this._anyListeners || [];\n this._anyListeners.unshift(listener);\n return this;\n }\n /**\n * Removes the listener that will be fired when any event is emitted.\n *\n * @example\n * const catchAllListener = (event, ...args) => {\n * console.log(`got event ${event}`);\n * }\n *\n * socket.onAny(catchAllListener);\n *\n * // remove a specific listener\n * socket.offAny(catchAllListener);\n *\n * // or remove all listeners\n * socket.offAny();\n *\n * @param listener\n */\n offAny(listener) {\n if (!this._anyListeners) {\n return this;\n }\n if (listener) {\n const listeners = this._anyListeners;\n for (let i = 0; i < listeners.length; i++) {\n if (listener === listeners[i]) {\n listeners.splice(i, 1);\n return this;\n }\n }\n }\n else {\n this._anyListeners = [];\n }\n return this;\n }\n /**\n * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,\n * e.g. to remove listeners.\n */\n listenersAny() {\n return this._anyListeners || [];\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback.\n *\n * Note: acknowledgements sent to the server are not included.\n *\n * @example\n * socket.onAnyOutgoing((event, ...args) => {\n * console.log(`sent event ${event}`);\n * });\n *\n * @param listener\n */\n onAnyOutgoing(listener) {\n this._anyOutgoingListeners = this._anyOutgoingListeners || [];\n this._anyOutgoingListeners.push(listener);\n return this;\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback. The listener is added to the beginning of the listeners array.\n *\n * Note: acknowledgements sent to the server are not included.\n *\n * @example\n * socket.prependAnyOutgoing((event, ...args) => {\n * console.log(`sent event ${event}`);\n * });\n *\n * @param listener\n */\n prependAnyOutgoing(listener) {\n this._anyOutgoingListeners = this._anyOutgoingListeners || [];\n this._anyOutgoingListeners.unshift(listener);\n return this;\n }\n /**\n * Removes the listener that will be fired when any event is emitted.\n *\n * @example\n * const catchAllListener = (event, ...args) => {\n * console.log(`sent event ${event}`);\n * }\n *\n * socket.onAnyOutgoing(catchAllListener);\n *\n * // remove a specific listener\n * socket.offAnyOutgoing(catchAllListener);\n *\n * // or remove all listeners\n * socket.offAnyOutgoing();\n *\n * @param [listener] - the catch-all listener (optional)\n */\n offAnyOutgoing(listener) {\n if (!this._anyOutgoingListeners) {\n return this;\n }\n if (listener) {\n const listeners = this._anyOutgoingListeners;\n for (let i = 0; i < listeners.length; i++) {\n if (listener === listeners[i]) {\n listeners.splice(i, 1);\n return this;\n }\n }\n }\n else {\n this._anyOutgoingListeners = [];\n }\n return this;\n }\n /**\n * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,\n * e.g. to remove listeners.\n */\n listenersAnyOutgoing() {\n return this._anyOutgoingListeners || [];\n }\n /**\n * Notify the listeners for each packet sent\n *\n * @param packet\n *\n * @private\n */\n notifyOutgoingListeners(packet) {\n if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) {\n const listeners = this._anyOutgoingListeners.slice();\n for (const listener of listeners) {\n listener.apply(this, packet.data);\n }\n }\n }\n}\n"],"names":["RESERVED_EVENTS","Object","freeze","connect","connect_error","disconnect","disconnecting","newListener","removeListener","Socket","Emitter","constructor","io","nsp","opts","super","this","connected","recovered","receiveBuffer","sendBuffer","_queue","_queueSeq","ids","acks","flags","auth","_opts","assign","_autoConnect","open","disconnected","subEvents","subs","on","onopen","bind","onpacket","onerror","onclose","active","_readyState","send","args","unshift","emit","apply","ev","_a","_b","_c","hasOwnProperty","Error","toString","retries","fromQueue","volatile","_addToQueue","packet","type","PacketType","EVENT","data","options","compress","length","id","ack","pop","_registerAckCallback","isTransportWritable","engine","transport","writable","isConnected","_hasPingExpired","notifyOutgoingListeners","push","timeout","ackTimeout","undefined","timer","setTimeoutFn","i","splice","call","fn","clearTimeoutFn","withError","emitWithAck","Promise","resolve","reject","arg1","arg2","tryCount","pending","err","responseArgs","shift","_drainQueue","force","_packet","_sendConnectPacket","CONNECT","_pid","pid","offset","_lastOffset","emitReserved","reason","description","_clearAcks","keys","forEach","some","String","sid","onconnect","BINARY_EVENT","onevent","ACK","BINARY_ACK","onack","DISCONNECT","ondisconnect","CONNECT_ERROR","destroy","message","emitEvent","_anyListeners","listeners","slice","listener","self","sent","emitBuffered","subDestroy","close","onAny","prependAny","offAny","listenersAny","onAnyOutgoing","_anyOutgoingListeners","prependAnyOutgoing","offAnyOutgoing","listenersAnyOutgoing"],"mappings":"wLAOA,MAAMA,EAAkBC,OAAOC,OAAO,CAClCC,QAAS,EACTC,cAAe,EACfC,WAAY,EACZC,cAAe,EAEfC,YAAa,EACbC,eAAgB,IA0Bb,MAAMC,UAAeC,EAIxB,WAAAC,CAAYC,EAAIC,EAAKC,GACjBC,QAeAC,KAAKC,WAAY,EAKjBD,KAAKE,WAAY,EAIjBF,KAAKG,cAAgB,G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
|
|
1
|
+
import{Emitter as t}from"../../../@socket.io/component-emitter/lib/esm/index.js";import{deconstructPacket as r,reconstructPacket as e}from"./binary.js";import{hasBinary as n,isBinary as s}from"./is-binary.js";const i=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],o=5;var c;!function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"}(c||(c={}));class a{constructor(t){this.replacer=t}encode(t){return t.type!==c.EVENT&&t.type!==c.ACK||!n(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===c.EVENT?c.BINARY_EVENT:c.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let r=""+t.type;return t.type!==c.BINARY_EVENT&&t.type!==c.BINARY_ACK||(r+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(r+=t.nsp+","),null!=t.id&&(r+=t.id),null!=t.data&&(r+=JSON.stringify(t.data,this.replacer)),r}encodeAsBinary(t){const e=r(t),n=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(n),s}}class u extends t{constructor(t){super(),this.reviver=t}add(t){let r;if("string"==typeof t){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const e=r.type===c.BINARY_EVENT;e||r.type===c.BINARY_ACK?(r.type=e?c.EVENT:c.ACK,this.reconstructor=new h(r),0===r.attachments&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else{if(!s(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r))}}decodeString(t){let r=0;const e={type:Number(t.charAt(0))};if(void 0===c[e.type])throw new Error("unknown packet type "+e.type);if(e.type===c.BINARY_EVENT||e.type===c.BINARY_ACK){const n=r+1;for(;"-"!==t.charAt(++r)&&r!=t.length;);const s=t.substring(n,r);if(s!=Number(s)||"-"!==t.charAt(r))throw new Error("Illegal attachments");e.attachments=Number(s)}if("/"===t.charAt(r+1)){const n=r+1;for(;++r;){if(","===t.charAt(r))break;if(r===t.length)break}e.nsp=t.substring(n,r)}else e.nsp="/";const n=t.charAt(r+1);if(""!==n&&Number(n)==n){const n=r+1;for(;++r;){const e=t.charAt(r);if(null==e||Number(e)!=e){--r;break}if(r===t.length)break}e.id=Number(t.substring(n,r+1))}if(t.charAt(++r)){const n=this.tryParse(t.substr(r));if(!u.isPayloadValid(e.type,n))throw new Error("invalid payload");e.data=n}return e}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(t){return!1}}static isPayloadValid(t,r){switch(t){case c.CONNECT:return d(r);case c.DISCONNECT:return void 0===r;case c.CONNECT_ERROR:return"string"==typeof r||d(r);case c.EVENT:case c.BINARY_EVENT:return Array.isArray(r)&&("number"==typeof r[0]||"string"==typeof r[0]&&-1===i.indexOf(r[0]));case c.ACK:case c.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class h{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const t=e(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const N=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t};function d(t){return"[object Object]"===Object.prototype.toString.call(t)}function p(t){return"string"==typeof t.nsp&&(void 0===(r=t.id)||N(r))&&function(t,r){switch(t){case c.CONNECT:return void 0===r||d(r);case c.DISCONNECT:return void 0===r;case c.EVENT:return Array.isArray(r)&&("number"==typeof r[0]||"string"==typeof r[0]&&-1===i.indexOf(r[0]));case c.ACK:return Array.isArray(r);case c.CONNECT_ERROR:return"string"==typeof r||d(r);default:return!1}}(t.type,t.data);var r}export{u as Decoder,a as Encoder,c as PacketType,p as isPacketValid,o as protocol};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../node_modules/socket.io-parser/build/esm/index.js"],"sourcesContent":["import { Emitter } from \"@socket.io/component-emitter\";\nimport { deconstructPacket, reconstructPacket } from \"./binary.js\";\nimport { isBinary, hasBinary } from \"./is-binary.js\";\n/**\n * These strings must not be used as event names, as they have a special meaning.\n */\nconst RESERVED_EVENTS = [\n \"connect\",\n \"connect_error\",\n \"disconnect\",\n \"disconnecting\",\n \"newListener\",\n \"removeListener\", // used by the Node.js EventEmitter\n];\n/**\n * Protocol version.\n *\n * @public\n */\nexport const protocol = 5;\nexport var PacketType;\n(function (PacketType) {\n PacketType[PacketType[\"CONNECT\"] = 0] = \"CONNECT\";\n PacketType[PacketType[\"DISCONNECT\"] = 1] = \"DISCONNECT\";\n PacketType[PacketType[\"EVENT\"] = 2] = \"EVENT\";\n PacketType[PacketType[\"ACK\"] = 3] = \"ACK\";\n PacketType[PacketType[\"CONNECT_ERROR\"] = 4] = \"CONNECT_ERROR\";\n PacketType[PacketType[\"BINARY_EVENT\"] = 5] = \"BINARY_EVENT\";\n PacketType[PacketType[\"BINARY_ACK\"] = 6] = \"BINARY_ACK\";\n})(PacketType || (PacketType = {}));\n/**\n * A socket.io Encoder instance\n */\nexport class Encoder {\n /**\n * Encoder constructor\n *\n * @param {function} replacer - custom replacer to pass down to JSON.parse\n */\n constructor(replacer) {\n this.replacer = replacer;\n }\n /**\n * Encode a packet as a single string if non-binary, or as a\n * buffer sequence, depending on packet type.\n *\n * @param {Object} obj - packet object\n */\n encode(obj) {\n if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {\n if (hasBinary(obj)) {\n return this.encodeAsBinary({\n type: obj.type === PacketType.EVENT\n ? PacketType.BINARY_EVENT\n : PacketType.BINARY_ACK,\n nsp: obj.nsp,\n data: obj.data,\n id: obj.id,\n });\n }\n }\n return [this.encodeAsString(obj)];\n }\n /**\n * Encode packet as string.\n */\n encodeAsString(obj) {\n // first is type\n let str = \"\" + obj.type;\n // attachments if we have them\n if (obj.type === PacketType.BINARY_EVENT ||\n obj.type === PacketType.BINARY_ACK) {\n str += obj.attachments + \"-\";\n }\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && \"/\" !== obj.nsp) {\n str += obj.nsp + \",\";\n }\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n // json data\n if (null != obj.data) {\n str += JSON.stringify(obj.data, this.replacer);\n }\n return str;\n }\n /**\n * Encode packet as 'buffer sequence' by removing blobs, and\n * deconstructing packet into object with placeholders and\n * a list of buffers.\n */\n encodeAsBinary(obj) {\n const deconstruction = deconstructPacket(obj);\n const pack = this.encodeAsString(deconstruction.packet);\n const buffers = deconstruction.buffers;\n buffers.unshift(pack); // add packet info to beginning of data list\n return buffers; // write all the buffers\n }\n}\n// see https://stackoverflow.com/questions/8511281/check-if-a-value-is-an-object-in-javascript\nfunction isObject(value) {\n return Object.prototype.toString.call(value) === \"[object Object]\";\n}\n/**\n * A socket.io Decoder instance\n *\n * @return {Object} decoder\n */\nexport class Decoder extends Emitter {\n /**\n * Decoder constructor\n *\n * @param {function} reviver - custom reviver to pass down to JSON.stringify\n */\n constructor(reviver) {\n super();\n this.reviver = reviver;\n }\n /**\n * Decodes an encoded packet string into packet JSON.\n *\n * @param {String} obj - encoded packet\n */\n add(obj) {\n let packet;\n if (typeof obj === \"string\") {\n if (this.reconstructor) {\n throw new Error(\"got plaintext data when reconstructing a packet\");\n }\n packet = this.decodeString(obj);\n const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;\n if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {\n packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;\n // binary packet's json\n this.reconstructor = new BinaryReconstructor(packet);\n // no attachments, labeled binary but no binary data to follow\n if (packet.attachments === 0) {\n super.emitReserved(\"decoded\", packet);\n }\n }\n else {\n // non-binary full packet\n super.emitReserved(\"decoded\", packet);\n }\n }\n else if (isBinary(obj) || obj.base64) {\n // raw binary data\n if (!this.reconstructor) {\n throw new Error(\"got binary data when not reconstructing a packet\");\n }\n else {\n packet = this.reconstructor.takeBinaryData(obj);\n if (packet) {\n // received final buffer\n this.reconstructor = null;\n super.emitReserved(\"decoded\", packet);\n }\n }\n }\n else {\n throw new Error(\"Unknown type: \" + obj);\n }\n }\n /**\n * Decode a packet String (JSON data)\n *\n * @param {String} str\n * @return {Object} packet\n */\n decodeString(str) {\n let i = 0;\n // look up type\n const p = {\n type: Number(str.charAt(0)),\n };\n if (PacketType[p.type] === undefined) {\n throw new Error(\"unknown packet type \" + p.type);\n }\n // look up attachments if type binary\n if (p.type === PacketType.BINARY_EVENT ||\n p.type === PacketType.BINARY_ACK) {\n const start = i + 1;\n while (str.charAt(++i) !== \"-\" && i != str.length) { }\n const buf = str.substring(start, i);\n if (buf != Number(buf) || str.charAt(i) !== \"-\") {\n throw new Error(\"Illegal attachments\");\n }\n p.attachments = Number(buf);\n }\n // look up namespace (if any)\n if (\"/\" === str.charAt(i + 1)) {\n const start = i + 1;\n while (++i) {\n const c = str.charAt(i);\n if (\",\" === c)\n break;\n if (i === str.length)\n break;\n }\n p.nsp = str.substring(start, i);\n }\n else {\n p.nsp = \"/\";\n }\n // look up id\n const next = str.charAt(i + 1);\n if (\"\" !== next && Number(next) == next) {\n const start = i + 1;\n while (++i) {\n const c = str.charAt(i);\n if (null == c || Number(c) != c) {\n --i;\n break;\n }\n if (i === str.length)\n break;\n }\n p.id = Number(str.substring(start, i + 1));\n }\n // look up json data\n if (str.charAt(++i)) {\n const payload = this.tryParse(str.substr(i));\n if (Decoder.isPayloadValid(p.type, payload)) {\n p.data = payload;\n }\n else {\n throw new Error(\"invalid payload\");\n }\n }\n return p;\n }\n tryParse(str) {\n try {\n return JSON.parse(str, this.reviver);\n }\n catch (e) {\n return false;\n }\n }\n static isPayloadValid(type, payload) {\n switch (type) {\n case PacketType.CONNECT:\n return isObject(payload);\n case PacketType.DISCONNECT:\n return payload === undefined;\n case PacketType.CONNECT_ERROR:\n return typeof payload === \"string\" || isObject(payload);\n case PacketType.EVENT:\n case PacketType.BINARY_EVENT:\n return (Array.isArray(payload) &&\n (typeof payload[0] === \"number\" ||\n (typeof payload[0] === \"string\" &&\n RESERVED_EVENTS.indexOf(payload[0]) === -1)));\n case PacketType.ACK:\n case PacketType.BINARY_ACK:\n return Array.isArray(payload);\n }\n }\n /**\n * Deallocates a parser's resources\n */\n destroy() {\n if (this.reconstructor) {\n this.reconstructor.finishedReconstruction();\n this.reconstructor = null;\n }\n }\n}\n/**\n * A manager of a binary event's 'buffer sequence'. Should\n * be constructed whenever a packet of type BINARY_EVENT is\n * decoded.\n *\n * @param {Object} packet\n * @return {BinaryReconstructor} initialized reconstructor\n */\nclass BinaryReconstructor {\n constructor(packet) {\n this.packet = packet;\n this.buffers = [];\n this.reconPack = packet;\n }\n /**\n * Method to be called when binary data received from connection\n * after a BINARY_EVENT packet.\n *\n * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n * @return {null | Object} returns null if more binary data is expected or\n * a reconstructed packet object if all buffers have been received.\n */\n takeBinaryData(binData) {\n this.buffers.push(binData);\n if (this.buffers.length === this.reconPack.attachments) {\n // done with buffer list\n const packet = reconstructPacket(this.reconPack, this.buffers);\n this.finishedReconstruction();\n return packet;\n }\n return null;\n }\n /**\n * Cleans up binary packet reconstruction variables.\n */\n finishedReconstruction() {\n this.reconPack = null;\n this.buffers = [];\n }\n}\n"],"names":["RESERVED_EVENTS","protocol","PacketType","Encoder","constructor","replacer","this","encode","obj","type","EVENT","ACK","hasBinary","encodeAsString","encodeAsBinary","BINARY_EVENT","BINARY_ACK","nsp","data","id","str","attachments","JSON","stringify","deconstruction","deconstructPacket","pack","packet","buffers","unshift","isObject","value","Object","prototype","toString","call","Decoder","Emitter","reviver","super","add","reconstructor","Error","decodeString","isBinaryEvent","BinaryReconstructor","emitReserved","isBinary","base64","takeBinaryData","i","p","Number","charAt","undefined","start","length","buf","substring","next","c","payload","tryParse","substr","isPayloadValid","parse","e","CONNECT","DISCONNECT","CONNECT_ERROR","Array","isArray","indexOf","destroy","finishedReconstruction","reconPack","binData","push","reconstructPacket"],"mappings":"iNAMA,MAAMA,EAAkB,CACpB,UACA,gBACA,aACA,gBACA,cACA,kBAOSC,EAAW,EACd,IAACC,GACX,SAAWA,GACPA,EAAWA,EAAoB,QAAI,GAAK,UACxCA,EAAWA,EAAuB,WAAI,GAAK,aAC3CA,EAAWA,EAAkB,MAAI,GAAK,QACtCA,EAAWA,EAAgB,IAAI,GAAK,MACpCA,EAAWA,EAA0B,cAAI,GAAK,gBAC9CA,EAAWA,EAAyB,aAAI,GAAK,eAC7CA,EAAWA,EAAuB,WAAI,GAAK,YAC9C,CARD,CAQGA,IAAeA,EAAa,CAAA,IAIxB,MAAMC,EAMT,WAAAC,CAAYC,GACRC,KAAKD,SAAWA,CACpB,CAOA,MAAAE,CAAOC,GACH,OAAIA,EAAIC,OAASP,EAAWQ,OAASF,EAAIC,OAASP,EAAWS,MACrDC,EAAUJ,GAWX,CAACF,KAAKO,eAAeL,IAVbF,KAAKQ,eAAe,CACvBL,KAAMD,EAAIC,OAASP,EAAWQ,MACxBR,EAAWa,aACXb,EAAWc,WACjBC,IAAKT,EAAIS,IACTC,KAAMV,EAAIU,KACVC,GAAIX,EAAIW,IAKxB,CAIA,cAAAN,CAAeL,GAEX,IAAIY,EAAM,GAAKZ,EAAIC,KAmBnB,OAjBID,EAAIC,OAASP,EAAWa,cACxBP,EAAIC,OAASP,EAAWc,aACxBI,GAAOZ,EAAIa,YAAc,KAIzBb,EAAIS,KAAO,MAAQT,EAAIS,MACvBG,GAAOZ,EAAIS,IAAM,KAGjB,MAAQT,EAAIW,KACZC,GAAOZ,EAAIW,IAGX,MAAQX,EAAIU,OAC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AevD,EAAMoD,GACxB,OAAQpD,GACJ,KAAKP,EAAWiE,QACZ,OAAOrC,EAAS+B,GACpB,KAAK3D,EAAWkE,WACZ,YAAmBd,IAAZO,EACX,KAAK3D,EAAWmE,cACZ,MAA0B,iBAAZR,GAAwB/B,EAAS+B,GACnD,KAAK3D,EAAWQ,MAChB,KAAKR,EAAWa,aACZ,OAAQuD,MAAMC,QAAQV,KACK,iBAAfA,EAAQ,IACW,iBAAfA,EAAQ,KAC4B,IAAxC7D,EAAgBwE,QAAQX,EAAQ,KAChD,KAAK3D,EAAWS,IAChB,KAAKT,EAAWc,WACZ,OAAOsD,MAAMC,QAAQV,GAEjC,CAIA,OAAAY,GACQnE,KAAKmC,gBACLnC,KAAKmC,cAAciC,yBACnBpE,KAAKmC,cAAgB,KAE7B,EAUJ,MAAMI,EACF,WAAAzC,CAAYuB,GACRrB,KAAKqB,OAASA,EACdrB,KAAKsB,QAAU,GACftB,KAAKqE,UAAYhD,CACrB,CASA,cAAAsB,CAAe2B,GAEX,GADAtE,KAAKsB,QAAQiD,KAAKD,GACdtE,KAAKsB,QAAQ4B,SAAWlD,KAAKqE,UAAUtD,YAAa,CAEpD,MAAMM,EAASmD,EAAkBxE,KAAKqE,UAAWrE,KAAKsB,SAEtD,OADAtB,KAAKoE,yBACE/C,CACX,CACA,OAAO,IACX,CAIA,sBAAA+C,GACIpE,KAAKqE,UAAY,KACjBrE,KAAKsB,QAAU,EACnB","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../node_modules/socket.io-parser/build/esm/index.js"],"sourcesContent":["import { Emitter } from \"@socket.io/component-emitter\";\nimport { deconstructPacket, reconstructPacket } from \"./binary.js\";\nimport { isBinary, hasBinary } from \"./is-binary.js\";\n/**\n * These strings must not be used as event names, as they have a special meaning.\n */\nconst RESERVED_EVENTS = [\n \"connect\", // used on the client side\n \"connect_error\", // used on the client side\n \"disconnect\", // used on both sides\n \"disconnecting\", // used on the server side\n \"newListener\", // used by the Node.js EventEmitter\n \"removeListener\", // used by the Node.js EventEmitter\n];\n/**\n * Protocol version.\n *\n * @public\n */\nexport const protocol = 5;\nexport var PacketType;\n(function (PacketType) {\n PacketType[PacketType[\"CONNECT\"] = 0] = \"CONNECT\";\n PacketType[PacketType[\"DISCONNECT\"] = 1] = \"DISCONNECT\";\n PacketType[PacketType[\"EVENT\"] = 2] = \"EVENT\";\n PacketType[PacketType[\"ACK\"] = 3] = \"ACK\";\n PacketType[PacketType[\"CONNECT_ERROR\"] = 4] = \"CONNECT_ERROR\";\n PacketType[PacketType[\"BINARY_EVENT\"] = 5] = \"BINARY_EVENT\";\n PacketType[PacketType[\"BINARY_ACK\"] = 6] = \"BINARY_ACK\";\n})(PacketType || (PacketType = {}));\n/**\n * A socket.io Encoder instance\n */\nexport class Encoder {\n /**\n * Encoder constructor\n *\n * @param {function} replacer - custom replacer to pass down to JSON.parse\n */\n constructor(replacer) {\n this.replacer = replacer;\n }\n /**\n * Encode a packet as a single string if non-binary, or as a\n * buffer sequence, depending on packet type.\n *\n * @param {Object} obj - packet object\n */\n encode(obj) {\n if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {\n if (hasBinary(obj)) {\n return this.encodeAsBinary({\n type: obj.type === PacketType.EVENT\n ? PacketType.BINARY_EVENT\n : PacketType.BINARY_ACK,\n nsp: obj.nsp,\n data: obj.data,\n id: obj.id,\n });\n }\n }\n return [this.encodeAsString(obj)];\n }\n /**\n * Encode packet as string.\n */\n encodeAsString(obj) {\n // first is type\n let str = \"\" + obj.type;\n // attachments if we have them\n if (obj.type === PacketType.BINARY_EVENT ||\n obj.type === PacketType.BINARY_ACK) {\n str += obj.attachments + \"-\";\n }\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && \"/\" !== obj.nsp) {\n str += obj.nsp + \",\";\n }\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n // json data\n if (null != obj.data) {\n str += JSON.stringify(obj.data, this.replacer);\n }\n return str;\n }\n /**\n * Encode packet as 'buffer sequence' by removing blobs, and\n * deconstructing packet into object with placeholders and\n * a list of buffers.\n */\n encodeAsBinary(obj) {\n const deconstruction = deconstructPacket(obj);\n const pack = this.encodeAsString(deconstruction.packet);\n const buffers = deconstruction.buffers;\n buffers.unshift(pack); // add packet info to beginning of data list\n return buffers; // write all the buffers\n }\n}\n/**\n * A socket.io Decoder instance\n *\n * @return {Object} decoder\n */\nexport class Decoder extends Emitter {\n /**\n * Decoder constructor\n *\n * @param {function} reviver - custom reviver to pass down to JSON.stringify\n */\n constructor(reviver) {\n super();\n this.reviver = reviver;\n }\n /**\n * Decodes an encoded packet string into packet JSON.\n *\n * @param {String} obj - encoded packet\n */\n add(obj) {\n let packet;\n if (typeof obj === \"string\") {\n if (this.reconstructor) {\n throw new Error(\"got plaintext data when reconstructing a packet\");\n }\n packet = this.decodeString(obj);\n const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;\n if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {\n packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;\n // binary packet's json\n this.reconstructor = new BinaryReconstructor(packet);\n // no attachments, labeled binary but no binary data to follow\n if (packet.attachments === 0) {\n super.emitReserved(\"decoded\", packet);\n }\n }\n else {\n // non-binary full packet\n super.emitReserved(\"decoded\", packet);\n }\n }\n else if (isBinary(obj) || obj.base64) {\n // raw binary data\n if (!this.reconstructor) {\n throw new Error(\"got binary data when not reconstructing a packet\");\n }\n else {\n packet = this.reconstructor.takeBinaryData(obj);\n if (packet) {\n // received final buffer\n this.reconstructor = null;\n super.emitReserved(\"decoded\", packet);\n }\n }\n }\n else {\n throw new Error(\"Unknown type: \" + obj);\n }\n }\n /**\n * Decode a packet String (JSON data)\n *\n * @param {String} str\n * @return {Object} packet\n */\n decodeString(str) {\n let i = 0;\n // look up type\n const p = {\n type: Number(str.charAt(0)),\n };\n if (PacketType[p.type] === undefined) {\n throw new Error(\"unknown packet type \" + p.type);\n }\n // look up attachments if type binary\n if (p.type === PacketType.BINARY_EVENT ||\n p.type === PacketType.BINARY_ACK) {\n const start = i + 1;\n while (str.charAt(++i) !== \"-\" && i != str.length) { }\n const buf = str.substring(start, i);\n if (buf != Number(buf) || str.charAt(i) !== \"-\") {\n throw new Error(\"Illegal attachments\");\n }\n p.attachments = Number(buf);\n }\n // look up namespace (if any)\n if (\"/\" === str.charAt(i + 1)) {\n const start = i + 1;\n while (++i) {\n const c = str.charAt(i);\n if (\",\" === c)\n break;\n if (i === str.length)\n break;\n }\n p.nsp = str.substring(start, i);\n }\n else {\n p.nsp = \"/\";\n }\n // look up id\n const next = str.charAt(i + 1);\n if (\"\" !== next && Number(next) == next) {\n const start = i + 1;\n while (++i) {\n const c = str.charAt(i);\n if (null == c || Number(c) != c) {\n --i;\n break;\n }\n if (i === str.length)\n break;\n }\n p.id = Number(str.substring(start, i + 1));\n }\n // look up json data\n if (str.charAt(++i)) {\n const payload = this.tryParse(str.substr(i));\n if (Decoder.isPayloadValid(p.type, payload)) {\n p.data = payload;\n }\n else {\n throw new Error(\"invalid payload\");\n }\n }\n return p;\n }\n tryParse(str) {\n try {\n return JSON.parse(str, this.reviver);\n }\n catch (e) {\n return false;\n }\n }\n static isPayloadValid(type, payload) {\n switch (type) {\n case PacketType.CONNECT:\n return isObject(payload);\n case PacketType.DISCONNECT:\n return payload === undefined;\n case PacketType.CONNECT_ERROR:\n return typeof payload === \"string\" || isObject(payload);\n case PacketType.EVENT:\n case PacketType.BINARY_EVENT:\n return (Array.isArray(payload) &&\n (typeof payload[0] === \"number\" ||\n (typeof payload[0] === \"string\" &&\n RESERVED_EVENTS.indexOf(payload[0]) === -1)));\n case PacketType.ACK:\n case PacketType.BINARY_ACK:\n return Array.isArray(payload);\n }\n }\n /**\n * Deallocates a parser's resources\n */\n destroy() {\n if (this.reconstructor) {\n this.reconstructor.finishedReconstruction();\n this.reconstructor = null;\n }\n }\n}\n/**\n * A manager of a binary event's 'buffer sequence'. Should\n * be constructed whenever a packet of type BINARY_EVENT is\n * decoded.\n *\n * @param {Object} packet\n * @return {BinaryReconstructor} initialized reconstructor\n */\nclass BinaryReconstructor {\n constructor(packet) {\n this.packet = packet;\n this.buffers = [];\n this.reconPack = packet;\n }\n /**\n * Method to be called when binary data received from connection\n * after a BINARY_EVENT packet.\n *\n * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n * @return {null | Object} returns null if more binary data is expected or\n * a reconstructed packet object if all buffers have been received.\n */\n takeBinaryData(binData) {\n this.buffers.push(binData);\n if (this.buffers.length === this.reconPack.attachments) {\n // done with buffer list\n const packet = reconstructPacket(this.reconPack, this.buffers);\n this.finishedReconstruction();\n return packet;\n }\n return null;\n }\n /**\n * Cleans up binary packet reconstruction variables.\n */\n finishedReconstruction() {\n this.reconPack = null;\n this.buffers = [];\n }\n}\nfunction isNamespaceValid(nsp) {\n return typeof nsp === \"string\";\n}\n// see https://caniuse.com/mdn-javascript_builtins_number_isinteger\nconst isInteger = Number.isInteger ||\n function (value) {\n return (typeof value === \"number\" &&\n isFinite(value) &&\n Math.floor(value) === value);\n };\nfunction isAckIdValid(id) {\n return id === undefined || isInteger(id);\n}\n// see https://stackoverflow.com/questions/8511281/check-if-a-value-is-an-object-in-javascript\nfunction isObject(value) {\n return Object.prototype.toString.call(value) === \"[object Object]\";\n}\nfunction isDataValid(type, payload) {\n switch (type) {\n case PacketType.CONNECT:\n return payload === undefined || isObject(payload);\n case PacketType.DISCONNECT:\n return payload === undefined;\n case PacketType.EVENT:\n return (Array.isArray(payload) &&\n (typeof payload[0] === \"number\" ||\n (typeof payload[0] === \"string\" &&\n RESERVED_EVENTS.indexOf(payload[0]) === -1)));\n case PacketType.ACK:\n return Array.isArray(payload);\n case PacketType.CONNECT_ERROR:\n return typeof payload === \"string\" || isObject(payload);\n default:\n return false;\n }\n}\nexport function isPacketValid(packet) {\n return (isNamespaceValid(packet.nsp) &&\n isAckIdValid(packet.id) &&\n isDataValid(packet.type, packet.data));\n}\n"],"names":["RESERVED_EVENTS","protocol","PacketType","Encoder","constructor","replacer","this","encode","obj","type","EVENT","ACK","hasBinary","encodeAsString","encodeAsBinary","BINARY_EVENT","BINARY_ACK","nsp","data","id","str","attachments","JSON","stringify","deconstruction","deconstructPacket","pack","packet","buffers","unshift","Decoder","Emitter","reviver","super","add","reconstructor","Error","decodeString","isBinaryEvent","BinaryReconstructor","emitReserved","isBinary","base64","takeBinaryData","i","p","Number","charAt","undefined","start","length","buf","substring","next","c","payload","tryParse","substr","isPayloadValid","parse","e","CONNECT","isObject","DISCONNECT","CONNECT_ERROR","Array","isArray","indexOf","destroy","finishedReconstruction","reconPack","binData","push","reconstructPacket","isInteger","value","isFinite","Math","floor","Object","prototype","toString","call","isPacketValid","isDataValid"],"mappings":"iNAMA,MAAMA,EAAkB,CACpB,UACA,gBACA,aACA,gBACA,cACA,kBAOSC,EAAW,EACd,IAACC,GACX,SAAWA,GACPA,EAAWA,EAAoB,QAAI,GAAK,UACxCA,EAAWA,EAAuB,WAAI,GAAK,aAC3CA,EAAWA,EAAkB,MAAI,GAAK,QACtCA,EAAWA,EAAgB,IAAI,GAAK,MACpCA,EAAWA,EAA0B,cAAI,GAAK,gBAC9CA,EAAWA,EAAyB,aAAI,GAAK,eAC7CA,EAAWA,EAAuB,WAAI,GAAK,YAC9C,CARD,CAQGA,IAAeA,EAAa,CAAA,IAIxB,MAAMC,EAMT,WAAAC,CAAYC,GACRC,KAAKD,SAAWA,CACpB,CAOA,MAAAE,CAAOC,GACH,OAAIA,EAAIC,OAASP,EAAWQ,OAASF,EAAIC,OAASP,EAAWS,MACrDC,EAAUJ,GAWX,CAACF,KAAKO,eAAeL,IAVbF,KAAKQ,eAAe,CACvBL,KAAMD,EAAIC,OAASP,EAAWQ,MACxBR,EAAWa,aACXb,EAAWc,WACjBC,IAAKT,EAAIS,IACTC,KAAMV,EAAIU,KACVC,GAAIX,EAAIW,IAKxB,CAIA,cAAAN,CAAeL,GAEX,IAAIY,EAAM,GAAKZ,EAAIC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,EAAcxD,GAC1B,MApCsB,iBAoCGA,EAAOV,WA1BlB+B,KADI7B,EA4BDQ,EAAOR,KA3BGuD,EAAUvD,KAMzC,SAAqBV,EAAM8C,GACvB,OAAQ9C,GACJ,KAAKP,EAAW2D,QACZ,YAAmBb,IAAZO,GAAyBO,EAASP,GAC7C,KAAKrD,EAAW6D,WACZ,YAAmBf,IAAZO,EACX,KAAKrD,EAAWQ,MACZ,OAAQuD,MAAMC,QAAQX,KACK,iBAAfA,EAAQ,IACW,iBAAfA,EAAQ,KAC4B,IAAxCvD,EAAgBmE,QAAQZ,EAAQ,KAChD,KAAKrD,EAAWS,IACZ,OAAOsD,MAAMC,QAAQX,GACzB,KAAKrD,EAAW8D,cACZ,MAA0B,iBAAZT,GAAwBO,EAASP,GACnD,QACI,OAAO,EAEnB,CAIQ6B,CAAYzD,EAAOlB,KAAMkB,EAAOT,MA7BxC,IAAsBC,CA8BtB","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-inject.es.js","sources":["../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"AAAA,SAASA,EAAYC,EAAKC,
|
|
1
|
+
{"version":3,"file":"style-inject.es.js","sources":["../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"AAAA,SAASA,EAAYC,EAAKC,YACnBA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"../../../_virtual/index5.js";import t,{useContext as n,createElement as r,useRef as o}from"react";import s from"../../@emotion/stylis/dist/stylis.browser.esm.js";import i from"../../@emotion/unitless/dist/unitless.browser.esm.js";import a from"../../@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js";import c from"../../../_virtual/hoist-non-react-statics.cjs.js";function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var l=function(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n},d=function(t){return null!==t&&"object"==typeof t&&"[object Object]"===(t.toString?t.toString():Object.prototype.toString.call(t))&&!e.typeOf(t)},h=Object.freeze([]),p=Object.freeze({});function f(e){return"function"==typeof e}function m(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function y(e){return e&&"string"==typeof e.styledComponentId}var v="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",g="undefined"!=typeof window&&"HTMLElement"in window,S=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&(void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV)),w="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n"}:{};function b(){for(var e=arguments.length<=0?void 0:arguments[0],t=[],n=1,r=arguments.length;n<r;n+=1)t.push(n<0||arguments.length<=n?void 0:arguments[n]);return t.forEach(function(t){e=e.replace(/%[a-z]/,t)}),e}function E(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw"production"===process.env.NODE_ENV?new Error("An error occurred. See https://git.io/JUIaE#"+e+" for more information."+(n.length>0?" Args: "+n.join(", "):"")):new Error(b.apply(void 0,[w[e]].concat(n)).trim())}var _=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},t.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&E(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var s=r;s<o;s++)this.groupSizes[s]=0}for(var i=this.indexOfGroup(e+1),a=0,c=t.length;a<c;a++)this.tag.insertRule(i,t[a])&&(this.groupSizes[e]++,i++)},t.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},t.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,s=r;s<o;s++)t+=this.tag.getRule(s)+"/*!sc*/\n";return t},e}(),A=new Map,C=new Map,N=1,I=function(e){if(A.has(e))return A.get(e);for(;C.has(N);)N++;var t=N++;return"production"!==process.env.NODE_ENV&&((0|t)<0||t>1<<30)&&E(16,""+t),A.set(e,t),C.set(t,e),t},P=function(e){return C.get(e)},R=function(e,t){t>=N&&(N=t+1),A.set(e,t),C.set(t,e)},j="style["+v+'][data-styled-version="5.3.11"]',O=new RegExp("^"+v+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),D=function(e,t,n){for(var r,o=n.split(","),s=0,i=o.length;s<i;s++)(r=o[s])&&e.registerName(t,r)},T=function(e,t){for(var n=(t.textContent||"").split("/*!sc*/\n"),r=[],o=0,s=n.length;o<s;o++){var i=n[o].trim();if(i){var a=i.match(O);if(a){var c=0|parseInt(a[1],10),u=a[2];0!==c&&(R(u,c),D(e,u,a[3]),e.getTag().insertRules(c,r)),r.length=0}else r.push(i)}}},k=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(v))return r}}(n),s=void 0!==o?o.nextSibling:null;r.setAttribute(v,"active"),r.setAttribute("data-styled-version","5.3.11");var i="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null;return i&&r.setAttribute("nonce",i),n.insertBefore(r,s),r},x=function(){function e(e){var t=this.element=k(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}E(17)}(t),this.length=0}var t=e.prototype;return t.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},t.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},t.getRule=function(e){var t=this.sheet.cssRules[e];return void 0!==t&&"string"==typeof t.cssText?t.cssText:""},e}(),z=function(){function e(e){var t=this.element=k(e);this.nodes=t.childNodes,this.length=0}var t=e.prototype;return t.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),B=function(){function e(e){this.rules=[],this.length=0}var t=e.prototype;return t.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},t.deleteRule=function(e){this.rules.splice(e,1),this.length--},t.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),V=g,F={isServer:!g,useCSSOMInjection:!S},L=function(){function e(e,t,n){void 0===e&&(e=p),void 0===t&&(t={}),this.options=u({},F,{},e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&g&&V&&(V=!1,function(e){for(var t=document.querySelectorAll(j),n=0,r=t.length;n<r;n++){var o=t[n];o&&"active"!==o.getAttribute(v)&&(T(e,o),o.parentNode&&o.parentNode.removeChild(o))}}(this))}e.registerId=function(e){return I(e)};var t=e.prototype;return t.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(u({},this.options,{},t),this.gs,n&&this.names||void 0)},t.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.getTag=function(){return this.tag||(this.tag=(n=(t=this.options).isServer,r=t.useCSSOMInjection,o=t.target,e=n?new B(o):r?new x(o):new z(o),new _(e)));var e,t,n,r,o},t.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.registerName=function(e,t){if(I(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},t.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(I(e),n)},t.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.clearRules=function(e){this.getTag().clearGroup(I(e)),this.clearNames(e)},t.clearTag=function(){this.tag=void 0},t.toString=function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=0;o<n;o++){var s=P(o);if(void 0!==s){var i=e.names.get(s),a=t.getGroup(o);if(i&&a&&i.size){var c=v+".g"+o+'[id="'+s+'"]',u="";void 0!==i&&i.forEach(function(e){e.length>0&&(u+=e+",")}),r+=""+a+c+'{content:"'+u+'"}/*!sc*/\n'}}}return r}(this)},e}(),M=/(a)(d)/gi,G=function(e){return String.fromCharCode(e+(e>25?39:97))};function Y(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=G(t%52)+n;return(G(t%52)+n).replace(M,"$1-$2")}var q=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},$=function(e){return q(5381,e)};var H=$("5.3.11"),U=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&function(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(f(n)&&!y(n))return!1}return!0}(e),this.componentId=t,this.baseHash=q(H,t),this.baseStyle=n,L.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.componentId,o=[];if(this.baseStyle&&o.push(this.baseStyle.generateAndInjectStyles(e,t,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(r,this.staticRulesId))o.push(this.staticRulesId);else{var s=ae(this.rules,e,t,n).join(""),i=Y(q(this.baseHash,s)>>>0);if(!t.hasNameForId(r,i)){var a=n(s,"."+i,void 0,r);t.insertRules(r,i,a)}o.push(i),this.staticRulesId=i}else{for(var c=this.rules.length,u=q(this.baseHash,n.hash),l="",d=0;d<c;d++){var h=this.rules[d];if("string"==typeof h)l+=h,"production"!==process.env.NODE_ENV&&(u=q(u,h+d));else if(h){var p=ae(h,e,t,n),f=Array.isArray(p)?p.join(""):p;u=q(u,f+d),l+=f}}if(l){var m=Y(u>>>0);if(!t.hasNameForId(r,m)){var y=n(l,"."+m,void 0,r);t.insertRules(r,m,y)}o.push(m)}}return o.join(" ")},e}(),W=/^\s*\/\/.*$/gm,Z=[":","[",".","#"];var J=t.createContext();J.Consumer;var X=t.createContext(),K=(X.Consumer,new L),Q=function(){var e,t,n,r,o=p,i=o.options,a=void 0===i?p:i,c=o.plugins,u=void 0===c?h:c,l=new s(a),d=[],f=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,s,i,a,c,u,l,d){switch(n){case 1:if(0===l&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===u)return r+"/*|*/";break;case 3:switch(u){case 102:case 112:return e(o[0]+r),"";default:return r+(0===d?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}(function(e){d.push(e)}),m=function(n,o,s){return 0===o&&-1!==Z.indexOf(s[t.length])||s.match(r)?n:"."+e};function y(o,s,i,a){void 0===a&&(a="&");var c=o.replace(W,""),u=s&&i?i+" "+s+" { "+c+" }":c;return e=a,t=s,n=new RegExp("\\"+t+"\\b","g"),r=new RegExp("(\\"+t+"\\b){2,}"),l(i||!s?"":s,u)}return l.use([].concat(u,[function(e,r,o){2===e&&o.length&&o[0].lastIndexOf(t)>0&&(o[0]=o[0].replace(n,m))},f,function(e){if(-2===e){var t=d;return d=[],t}}])),y.hash=u.length?u.reduce(function(e,t){return t.name||E(15),q(e,t.name)},5381).toString():"",y}();var ee=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Q);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return E(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=Q),this.name+e.hash},e}(),te=/([A-Z])/,ne=/([A-Z])/g,re=/^ms-/,oe=function(e){return"-"+e.toLowerCase()};function se(e){return te.test(e)?e.replace(ne,oe).replace(re,"-ms-"):e}var ie=function(e){return null==e||!1===e||""===e};function ae(t,n,r,o){if(Array.isArray(t)){for(var s,a=[],c=0,u=t.length;c<u;c+=1)""!==(s=ae(t[c],n,r,o))&&(Array.isArray(s)?a.push.apply(a,s):a.push(s));return a}if(ie(t))return"";if(y(t))return"."+t.styledComponentId;if(f(t)){if("function"!=typeof(h=t)||h.prototype&&h.prototype.isReactComponent||!n)return t;var l=t(n);return"production"!==process.env.NODE_ENV&&e.isElement(l)&&console.warn(m(t)+" is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details."),ae(l,n,r,o)}var h;return t instanceof ee?r?(t.inject(r,o),t.getName(o)):t:d(t)?function e(t,n){var r,o,s=[];for(var a in t)t.hasOwnProperty(a)&&!ie(t[a])&&(Array.isArray(t[a])&&t[a].isCss||f(t[a])?s.push(se(a)+":",t[a],";"):d(t[a])?s.push.apply(s,e(t[a],a)):s.push(se(a)+": "+(r=a,(null==(o=t[a])||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||r in i||r.startsWith("--")?String(o).trim():o+"px")+";")));return n?[n+" {"].concat(s,["}"]):s}(t):t.toString()}var ce=function(e){return Array.isArray(e)&&(e.isCss=!0),e};function ue(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return f(e)||d(e)?ce(ae(l(h,[e].concat(n)))):0===n.length&&1===e.length&&"string"==typeof e[0]?e:ce(ae(l(e,n)))}var le=/invalid hook call/i,de=new Set,he=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,pe=/(^-|-$)/g;function fe(e){return e.replace(he,"-").replace(pe,"")}function me(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var ye=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},ve=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function ge(e,t,n){var r=e[n];ye(t)&&ye(r)?Se(r,t):e[n]=t}function Se(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o=0,s=n;o<s.length;o++){var i=s[o];if(ye(i))for(var a in i)ve(a)&&ge(e,i[a],a)}return e}var we=t.createContext();we.Consumer;var be={};function Ee(e,s,i){var l=y(e),d=!me(e),v=s.attrs,g=void 0===v?h:v,S=s.componentId,w=void 0===S?function(e,t){var n="string"!=typeof e?"sc":fe(e);be[n]=(be[n]||0)+1;var r=n+"-"+function(e){return Y($(e)>>>0)}("5.3.11"+n+be[n]);return t?t+"-"+r:r}(s.displayName,s.parentComponentId):S,b=s.displayName,E=void 0===b?function(e){return me(e)?"styled."+e:"Styled("+m(e)+")"}(e):b,_=s.displayName&&s.componentId?fe(s.displayName)+"-"+s.componentId:s.componentId||w,A=l&&e.attrs?Array.prototype.concat(e.attrs,g).filter(Boolean):g,C=s.shouldForwardProp;l&&e.shouldForwardProp&&(C=s.shouldForwardProp?function(t,n,r){return e.shouldForwardProp(t,n,r)&&s.shouldForwardProp(t,n,r)}:e.shouldForwardProp);var N,I=new U(i,_,l?e.componentStyle:void 0),P=I.isStatic&&0===g.length,R=function(e,t){return function(e,t,o,s){var i=e.attrs,c=e.componentStyle,l=e.defaultProps,d=e.foldedComponentIds,h=e.shouldForwardProp,m=e.styledComponentId,y=e.target,v=function(e,t,n){void 0===e&&(e=p);var r=u({},t,{theme:e}),o={};return n.forEach(function(e){var t,n,s,i=e;for(t in f(i)&&(i=i(r)),i)r[t]=o[t]="className"===t?(n=o[t],s=i[t],n&&s?n+" "+s:n||s):i[t]}),[r,o]}(function(e,t,n){return void 0===n&&(n=p),e.theme!==n.theme&&e.theme||t||n.theme}(t,n(we),l)||p,t,i),g=v[0],S=v[1],w=function(e,t,r,o){var s=n(J)||K,i=n(X)||Q,a=t?e.generateAndInjectStyles(p,s,i):e.generateAndInjectStyles(r,s,i);return"production"!==process.env.NODE_ENV&&!t&&o&&o(a),a}(c,s,g,"production"!==process.env.NODE_ENV?e.warnTooManyClasses:void 0),b=o,E=S.$as||t.$as||S.as||t.as||y,_=me(E),A=S!==t?u({},t,{},S):t,C={};for(var N in A)"$"!==N[0]&&"as"!==N&&("forwardedAs"===N?C.as=A[N]:(h?h(N,a,E):!_||a(N))&&(C[N]=A[N]));return t.style&&S.style!==t.style&&(C.style=u({},t.style,{},S.style)),C.className=Array.prototype.concat(d,m,w!==m?w:null,t.className,S.className).filter(Boolean).join(" "),C.ref=b,r(E,C)}(N,e,t,P)};return R.displayName=E,(N=t.forwardRef(R)).attrs=A,N.componentStyle=I,N.displayName=E,N.shouldForwardProp=C,N.foldedComponentIds=l?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,N.styledComponentId=_,N.target=l?e.target:e,N.withComponent=function(e){var t=s.componentId,n=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(s,["componentId"]),r=t&&t+"-"+(me(e)?e:fe(m(e)));return Ee(e,u({},n,{attrs:A,componentId:r}),i)},Object.defineProperty(N,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=l?Se({},e.defaultProps,t):t}}),"production"!==process.env.NODE_ENV&&(function(e,t){if("production"!==process.env.NODE_ENV){var n="The component "+e+(t?' with the id of "'+t+'"':"")+" has been created dynamically.\nYou may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",r=console.error;try{var s=!0;console.error=function(e){if(le.test(e))s=!1,de.delete(n);else{for(var t=arguments.length,o=new Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];r.apply(void 0,[e].concat(o))}},o(),s&&!de.has(n)&&(console.warn(n),de.add(n))}catch(e){le.test(e.message)&&de.delete(n)}finally{console.error=r}}}(E,_),N.warnTooManyClasses=function(e,t){var n={},r=!1;return function(o){if(!r&&(n[o]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'+t+'"':"";console.warn("Over 200 classes were generated for component "+e+s+".\nConsider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),r=!0,n={}}}}(E,_)),Object.defineProperty(N,"toString",{value:function(){return"."+N.styledComponentId}}),d&&c(N,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),N}var _e=function(t){return function t(n,r,o){if(void 0===o&&(o=p),!e.isValidElementType(r))return E(1,String(r));var s=function(){return n(r,o,ue.apply(void 0,arguments))};return s.withConfig=function(e){return t(n,r,u({},o,{},e))},s.attrs=function(e){return t(n,r,u({},o,{attrs:Array.prototype.concat(o.attrs,e).filter(Boolean)}))},s}(Ee,t)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){_e[e]=_e(e)}),"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native"),"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window["__styled-components-init__"]=window["__styled-components-init__"]||0,1===window["__styled-components-init__"]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window["__styled-components-init__"]+=1);export{J as StyleSheetContext,we as ThemeContext,ue as css,_e as default,y as isStyledComponent};
|
|
1
|
+
import{__assign as e,__spreadArray as t}from"../../tslib/tslib.es6.js";import n from"../../@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js";import o,{createElement as r}from"react";import s from"../../@emotion/unitless/dist/emotion-unitless.esm.js";import{RULESET as i}from"../../stylis/src/Enum.js";import{prefixer as a,middleware as c,rulesheet as u}from"../../stylis/src/Middleware.js";import{stringify as l,serialize as p}from"../../stylis/src/Serializer.js";import{compile as d}from"../../stylis/src/Parser.js";var h="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",f="active",m="data-styled-version",y="6.3.8",v="/*!sc*/\n",g="undefined"!=typeof window&&"undefined"!=typeof document,S=void 0===o.createContext,w=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),b=/invalid hook call/i,C=new Set,N=function(e,n){if("production"!==process.env.NODE_ENV){if(S)return;var r=n?' with the id of "'.concat(n,'"'):"",s="The component ".concat(e).concat(r," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n",i=console.error;try{var a=!0;console.error=function(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];b.test(e)?(a=!1,C.delete(s)):i.apply(void 0,t([e],n,!1))},"function"==typeof o.useState&&o.useState(null),a&&!C.has(s)&&(console.warn(s),C.add(s))}catch(e){b.test(e.message)&&C.delete(s)}finally{console.error=i}}},E=Object.freeze([]),A=Object.freeze({});var P=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","br","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]),_=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,I=/(^-|-$)/g;function D(e){return e.replace(_,"-").replace(I,"")}var O=/(a)(d)/gi,T=function(e){return String.fromCharCode(e+(e>25?39:97))};function R(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=T(t%52)+n;return(T(t%52)+n).replace(O,"$1-$2")}var j,x=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},k=function(e){return x(5381,e)};function F(e){return R(k(e)>>>0)}function M(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function V(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var B="function"==typeof Symbol&&Symbol.for,z=B?Symbol.for("react.memo"):60115,L=B?Symbol.for("react.forward_ref"):60112,$={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},G={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Y={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},q=((j={})[L]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},j[z]=Y,j);function H(e){return("type"in(t=e)&&t.type.$$typeof)===z?Y:"$$typeof"in e?q[e.$$typeof]:$;var t}var W=Object.defineProperty,U=Object.getOwnPropertyNames,Z=Object.getOwnPropertySymbols,J=Object.getOwnPropertyDescriptor,K=Object.getPrototypeOf,Q=Object.prototype;function X(e,t,n){if("string"!=typeof t){if(Q){var o=K(t);o&&o!==Q&&X(e,o,n)}var r=U(t);Z&&(r=r.concat(Z(t)));for(var s=H(e),i=H(t),a=0;a<r.length;++a){var c=r[a];if(!(c in G||n&&n[c]||i&&c in i||s&&c in s)){var u=J(t,c);try{W(e,c,u)}catch(e){}}}}return e}function ee(e){return"function"==typeof e}function te(e){return"object"==typeof e&&"styledComponentId"in e}function ne(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function oe(e,t){if(0===e.length)return"";for(var n=e[0],o=1;o<e.length;o++)n+=e[o];return n}function re(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function se(e,t,n){if(void 0===n&&(n=!1),!n&&!re(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=se(e[o],t[o]);else if(re(t))for(var o in t)e[o]=se(e[o],t[o]);return e}function ie(e,t){Object.defineProperty(e,"toString",{value:t})}var ae="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function ce(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],o=[],r=1,s=e.length;r<s;r+=1)o.push(e[r]);return o.forEach(function(e){n=n.replace(/%[a-z]/,e)}),n}function ue(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(ce.apply(void 0,t([ae[e]],n,!1)).trim())}var le=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw ue(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s<r;s++)this.groupSizes[s]=0}for(var i=this.indexOfGroup(e+1),a=(s=0,t.length);s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(var r=n;r<o;r++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;s<r;s++)t+="".concat(this.tag.getRule(s)).concat(v);return t},e}(),pe=1<<30,de=new Map,he=new Map,fe=1,me=function(e){if(de.has(e))return de.get(e);for(;he.has(fe);)fe++;var t=fe++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>pe))throw ue(16,"".concat(t));return de.set(e,t),he.set(t,e),t},ye=function(e,t){fe=t+1,de.set(e,t),he.set(t,e)},ve="style[".concat(h,"][").concat(m,'="').concat(y,'"]'),ge=new RegExp("^".concat(h,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Se=function(e,t,n){for(var o,r=n.split(","),s=0,i=r.length;s<i;s++)(o=r[s])&&e.registerName(t,o)},we=function(e,t){for(var n,o=(null!==(n=t.textContent)&&void 0!==n?n:"").split(v),r=[],s=0,i=o.length;s<i;s++){var a=o[s].trim();if(a){var c=a.match(ge);if(c){var u=0|parseInt(c[1],10),l=c[2];0!==u&&(ye(l,u),Se(e,l,c[3]),e.getTag().insertRules(u,r)),r.length=0}else r.push(a)}}},be=function(e){for(var t=document.querySelectorAll(ve),n=0,o=t.length;n<o;n++){var r=t[n];r&&r.getAttribute(h)!==f&&(we(e,r),r.parentNode&&r.parentNode.removeChild(r))}};var Ce=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){var t=Array.from(e.querySelectorAll("style[".concat(h,"]")));return t[t.length-1]}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(h,f),o.setAttribute(m,y);var i="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null;return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},Ne=function(){function e(e){this.element=Ce(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,o=t.length;n<o;n++){var r=t[n];if(r.ownerNode===e)return r}throw ue(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),Ee=function(){function e(e){this.element=Ce(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),Ae=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Pe=g,_e={isServer:!g,useCSSOMInjection:!w},Ie=function(){function t(t,n,o){void 0===t&&(t=A),void 0===n&&(n={});var r=this;this.options=e(e({},_e),t),this.gs=n,this.names=new Map(o),this.server=!!t.isServer,!this.server&&g&&Pe&&(Pe=!1,be(this)),ie(this,function(){return function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return he.get(e)}(n);if(void 0===r)return"continue";var s=e.names.get(r),i=t.getGroup(n);if(void 0===s||!s.size||0===i.length)return"continue";var a="".concat(h,".g").concat(n,'[id="').concat(r,'"]'),c="";void 0!==s&&s.forEach(function(e){e.length>0&&(c+="".concat(e,","))}),o+="".concat(i).concat(a,'{content:"').concat(c,'"}').concat(v)},s=0;s<n;s++)r(s);return o}(r)})}return t.registerId=function(e){return me(e)},t.prototype.rehydrate=function(){!this.server&&g&&be(this)},t.prototype.reconstructWithOptions=function(n,o){return void 0===o&&(o=!0),new t(e(e({},this.options),n),this.gs,o&&this.names||void 0)},t.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new Ae(n):t?new Ne(n):new Ee(n)}(this.options),new le(e)));var e},t.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.prototype.registerName=function(e,t){if(me(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},t.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(me(e),n)},t.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.prototype.clearRules=function(e){this.getTag().clearGroup(me(e)),this.clearNames(e)},t.prototype.clearTag=function(){this.tag=void 0},t}(),De=/&/g,Oe=47;function Te(e){if(-1===e.indexOf("}"))return!1;for(var t=e.length,n=0,o=0,r=!1,s=0;s<t;s++){var i=e.charCodeAt(s);if(0!==o||r||i!==Oe||42!==e.charCodeAt(s+1))if(r)42===i&&e.charCodeAt(s+1)===Oe&&(r=!1,s++);else if(34!==i&&39!==i||0!==s&&92===e.charCodeAt(s-1)){if(0===o)if(123===i)n++;else if(125===i&&--n<0)return!0}else 0===o?o=i:o===i&&(o=0);else r=!0,s++}return 0!==n||0!==o}function Re(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Re(e.children,t)),e})}var je=new Ie,xe=function(){var e,t,n,o=A,r=o.options,s=void 0===r?A:r,h=o.plugins,f=void 0===h?E:h,m=function(n,o,r){return r.startsWith(t)&&r.endsWith(t)&&r.replaceAll(t,"").length>0?".".concat(e):n},y=f.slice();y.push(function(e){e.type===i&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(De,t).replace(n,m))}),s.prefix&&y.push(a),y.push(l);var v=function(o,r,i,a){void 0===r&&(r=""),void 0===i&&(i=""),void 0===a&&(a="&"),e=a,t=r,n=new RegExp("\\".concat(t,"\\b"),"g");var l=function(e){if(!Te(e))return e;for(var t=e.length,n="",o=0,r=0,s=0,i=!1,a=0;a<t;a++){var c=e.charCodeAt(a);if(0!==s||i||c!==Oe||42!==e.charCodeAt(a+1))if(i)42===c&&e.charCodeAt(a+1)===Oe&&(i=!1,a++);else if(34!==c&&39!==c||0!==a&&92===e.charCodeAt(a-1)){if(0===s)if(123===c)r++;else if(125===c){if(--r<0){for(var u=a+1;u<t;){var l=e.charCodeAt(u);if(59===l||10===l)break;u++}u<t&&59===e.charCodeAt(u)&&u++,r=0,a=u-1,o=u;continue}0===r&&(n+=e.substring(o,a+1),o=a+1)}else 59===c&&0===r&&(n+=e.substring(o,a+1),o=a+1)}else 0===s?s=c:s===c&&(s=0);else i=!0,a++}if(o<t){var p=e.substring(o);Te(p)||(n+=p)}return n}(function(e){if(-1===e.indexOf("//"))return e;for(var t=e.length,n=[],o=0,r=0,s=0,i=0;r<t;){var a=e.charCodeAt(r);if(34!==a&&39!==a||0!==r&&92===e.charCodeAt(r-1))if(0===s)if(40===a&&r>=3&&108==(32|e.charCodeAt(r-1))&&114==(32|e.charCodeAt(r-2))&&117==(32|e.charCodeAt(r-3)))i=1,r++;else if(i>0)41===a?i--:40===a&&i++,r++;else if(a===Oe&&r+1<t&&e.charCodeAt(r+1)===Oe){for(r>o&&n.push(e.substring(o,r));r<t&&10!==e.charCodeAt(r);)r++;o=r}else r++;else r++;else 0===s?s=a:s===a&&(s=0),r++}return 0===o?e:(o<t&&n.push(e.substring(o)),n.join(""))}(o)),h=d(i||r?"".concat(i," ").concat(r," { ").concat(l," }"):l);s.namespace&&(h=Re(h,s.namespace));var f=[];return p(h,c(y.concat(u(function(e){return f.push(e)})))),f};return v.hash=f.length?f.reduce(function(e,t){return t.name||ue(15),x(e,t.name)},5381).toString():"",v}(),ke={shouldForwardProp:void 0,styleSheet:je,stylis:xe},Fe=S?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(ke)}}:o.createContext(ke);function Me(){return S?ke:o.useContext(Fe)}Fe.Consumer,S||o.createContext(void 0);var Ve=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=xe);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ie(this,function(){throw ue(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=xe),this.name+e.hash},e}();function Be(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||e in s||e.startsWith("--")?String(t).trim():"".concat(t,"px")}var ze=function(e){return e>="A"&&e<="Z"};function Le(e){for(var t="",n=0;n<e.length;n++){var o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;ze(o)?t+="-"+o.toLowerCase():t+=o}return t.startsWith("ms-")?"-"+t:t}var $e=function(e){return null==e||!1===e||""===e},Ge=function(e){var n=[];for(var o in e){var r=e[o];e.hasOwnProperty(o)&&!$e(r)&&(Array.isArray(r)&&r.isCss||ee(r)?n.push("".concat(Le(o),":"),r,";"):re(r)?n.push.apply(n,t(t(["".concat(o," {")],Ge(r),!1),["}"],!1)):n.push("".concat(Le(o),": ").concat(Be(o,r),";")))}return n};function Ye(e,t,n,o){if($e(e))return[];if(te(e))return[".".concat(e.styledComponentId)];if(ee(e)){if(!ee(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return[e];var r=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof r||Array.isArray(r)||r instanceof Ve||re(r)||null===r||console.error("".concat(M(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Ye(r,t,n,o)}var s;return e instanceof Ve?n?(e.inject(n,o),[e.getName(o)]):[e]:re(e)?Ge(e):Array.isArray(e)?Array.prototype.concat.apply(E,e.map(function(e){return Ye(e,t,n,o)})):[e.toString()]}var qe=k(y),He=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&function(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(ee(n)&&!te(n))return!1}return!0}(e),this.componentId=t,this.baseHash=x(qe,t),this.baseStyle=n,Ie.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n).className:"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))o=ne(o,this.staticRulesId);else{var r=oe(Ye(this.rules,e,t,n)),s=R(x(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i)}o=ne(o,s),this.staticRulesId=s}else{for(var a=x(this.baseHash,n.hash),c="",u=0;u<this.rules.length;u++){var l=this.rules[u];if("string"==typeof l)c+=l,"production"!==process.env.NODE_ENV&&(a=x(a,l));else if(l){var p=oe(Ye(l,e,t,n));a=x(a,p+u),c+=p}}if(c){var d=R(a>>>0);if(!t.hasNameForId(this.componentId,d)){var h=n(c,".".concat(d),void 0,this.componentId);t.insertRules(this.componentId,d,h)}o=ne(o,d)}}return{className:o,css:"undefined"==typeof window?t.getTag().getGroup(me(this.componentId)):""}},e}(),We=S?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(void 0)}}:o.createContext(void 0);We.Consumer;var Ue={},Ze=new Set;function Je(t,s,i){var a=te(t),c=t,u=!V(t),l=s.attrs,p=void 0===l?E:l,d=s.componentId,h=void 0===d?function(e,t){var n="string"!=typeof e?"sc":D(e);Ue[n]=(Ue[n]||0)+1;var o="".concat(n,"-").concat(F(y+n+Ue[n]));return t?"".concat(t,"-").concat(o):o}(s.displayName,s.parentComponentId):d,f=s.displayName,m=void 0===f?function(e){return V(e)?"styled.".concat(e):"Styled(".concat(M(e),")")}(t):f,v=s.displayName&&s.componentId?"".concat(D(s.displayName),"-").concat(s.componentId):s.componentId||h,g=a&&c.attrs?c.attrs.concat(p).filter(Boolean):p,w=s.shouldForwardProp;if(a&&c.shouldForwardProp){var b=c.shouldForwardProp;if(s.shouldForwardProp){var C=s.shouldForwardProp;w=function(e,t){return b(e,t)&&C(e,t)}}else w=b}var _=new He(i,v,a?c.componentStyle:void 0);function I(t,s){return function(t,s,i){var a=t.attrs,c=t.componentStyle,u=t.defaultProps,l=t.foldedComponentIds,p=t.styledComponentId,d=t.target,h=S?void 0:o.useContext(We),f=Me(),m=t.shouldForwardProp||f.shouldForwardProp;"production"!==process.env.NODE_ENV&&o.useDebugValue&&o.useDebugValue(p);var y=function(e,t,n){return void 0===n&&(n=A),e.theme!==n.theme&&e.theme||t||n.theme}(s,h,u)||A,v=function(t,n,o){for(var r,s=e(e({},n),{className:void 0,theme:o}),i=0;i<t.length;i+=1){var a=ee(r=t[i])?r(s):r;for(var c in a)"className"===c?s.className=ne(s.className,a[c]):"style"===c?s.style=e(e({},s.style),a[c]):s[c]=a[c]}return"className"in n&&"string"==typeof n.className&&(s.className=ne(s.className,n.className)),s}(a,s,y),g=v.as||d,w={};for(var b in v)void 0===v[b]||"$"===b[0]||"as"===b||"theme"===b&&v.theme===y||("forwardedAs"===b?w.as=v.forwardedAs:m&&!m(b,g)||(w[b]=v[b],m||"development"!==process.env.NODE_ENV||n(b)||Ze.has(b)||!P.has(g)||(Ze.add(b),console.warn('styled-components: it looks like an unknown prop "'.concat(b,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var C=function(e,t){var n=Me(),r=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&o.useDebugValue&&o.useDebugValue(r.className),r}(c,v),N=C.className,E=C.css;"production"!==process.env.NODE_ENV&&t.warnTooManyClasses&&t.warnTooManyClasses(N);var _=ne(l,p);N&&(_+=" "+N),v.className&&(_+=" "+v.className),w[V(g)&&!P.has(g)?"class":"className"]=_,i&&(w.ref=i);var I=r(g,w);return S&&E?o.createElement(o.Fragment,null,o.createElement("style",{precedence:"styled-components",href:"sc-".concat(p,"-").concat(N),children:E}),I):I}(O,t,s)}I.displayName=m;var O=o.forwardRef(I);return O.attrs=g,O.componentStyle=_,O.displayName=m,O.shouldForwardProp=w,O.foldedComponentIds=a?ne(c.foldedComponentIds,c.styledComponentId):"",O.styledComponentId=v,O.target=a?c.target:t,Object.defineProperty(O,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=a?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var o=0,r=t;o<r.length;o++)se(e,r[o],!0);return e}({},c.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(N(m,v),O.warnTooManyClasses=function(e,t){var n={},o=!1;return function(r){if(!o&&(n[r]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),o=!0,n={}}}}(m,v)),ie(O,function(){return".".concat(O.styledComponentId)}),u&&X(O,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),O}function Ke(e,t){for(var n=[e[0]],o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}var Qe=function(e){return Object.assign(e,{isCss:!0})};function Xe(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(ee(e)||re(e))return Qe(Ye(Ke(E,t([e],n,!0))));var r=e;return 0===n.length&&1===r.length&&"string"==typeof r[0]?Ye(r):Qe(Ye(Ke(r,n)))}function et(n,o,r){if(void 0===r&&(r=A),!o)throw ue(1,o);var s=function(e){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,Xe.apply(void 0,t([e],s,!1)))};return s.attrs=function(t){return et(n,o,e(e({},r),{attrs:Array.prototype.concat(r.attrs,t).filter(Boolean)}))},s.withConfig=function(t){return et(n,o,e(e({},r),t))},s}var tt=function(e){return et(Je,e)},nt=tt;P.forEach(function(e){nt[e]=tt(e)}),"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var ot="__sc-".concat(h,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[ot]||(window[ot]=0),1===window[ot]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-several-instances-of-module-on-the-page for more info."),window[ot]+=1);export{Fe as StyleSheetContext,We as ThemeContext,Xe as css,nt as default,te as isStyledComponent,nt as styled,y as version};
|
|
2
2
|
//# sourceMappingURL=styled-components.browser.esm.js.map
|