@bynder/compact-view 5.2.0 → 5.2.2
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/AccessToken.js +5 -0
- package/AccessToken2.js +176 -0
- package/AccessToken3.js +4 -0
- package/ActiveFilter.js +6 -6
- package/ActiveFilters.js +24 -25
- package/AddMedia.js +21 -22
- package/AdditionalInfo.js +18 -0
- package/Advanced.js +3 -4
- package/App.js +68 -61
- package/Arrow.js +14 -0
- package/AssetCard.js +68 -57
- package/AssetCardMetaproperties.js +14 -14
- package/AssetFilter.js +36 -36
- package/AssetFilterContext.js +3 -4
- package/AssetItem.js +14 -14
- package/AssetList.js +46 -46
- package/AssetTypeItem.js +13 -13
- package/AssetsView.js +0 -1
- package/Autocomplete_new.js +70 -82
- package/Axios2.js +136 -0
- package/AxiosError.js +54 -0
- package/AxiosHeaders.js +181 -0
- package/AxiosURLSearchParams.js +33 -0
- package/Badge.js +44 -0
- package/Baloon.js +42 -0
- package/BaseStyles.js +10 -0
- package/Blob.js +4 -0
- package/Box.js +22 -0
- package/Button.js +39 -0
- package/Button.styles.js +40 -0
- package/ButtonAction.js +3 -4
- package/ButtonLegacy.js +48 -0
- package/ButtonLegacy.styles.js +28 -0
- package/CancelToken.js +77 -0
- package/CanceledError.js +11 -0
- package/Card.js +84 -0
- package/CardSkeleton.js +15 -15
- package/Checkbox.js +85 -0
- package/Checkbox.styles.js +2 -3
- package/Checkmark.js +7 -0
- package/Chip.js +70 -41
- package/Chip2.js +42 -0
- package/CollectionCard.js +9 -9
- package/CollectionItem.js +15 -15
- package/CollectionList.js +2 -3
- package/CollectionView.js +2 -3
- package/CollectionsView.js +6 -7
- package/ColorHexInput.js +31 -0
- package/ColorPicker.js +66 -0
- package/ColorPickerSolid.js +20 -0
- package/ColorPickerWithOpacity.js +37 -0
- package/Combobox.js +61 -0
- package/ConcealedAction.js +16 -0
- package/ConfigContext.js +0 -1
- package/ConnectButton.js +1 -2
- package/Container.js +14 -14
- package/Container2.js +31 -0
- package/Content.js +16 -0
- package/ContextAction.js +26 -18
- package/ContextActionButton.js +29 -0
- package/ControlGroup.js +32 -0
- package/DOMFunctions.js +27 -0
- package/Dat.js +62 -51
- package/DatDropdownItem.js +20 -20
- package/DesignSystemContext.js +4 -5
- package/DesignSystemProvider.js +29 -0
- package/DirectionSelect.js +16 -16
- package/Divider.js +21 -0
- package/DocumentIcon.js +0 -1
- package/DomainInput.js +15 -15
- package/DragRange.js +25 -0
- package/DragSelect.js +68 -63
- package/Dropdown.js +12 -12
- package/Dropdown2.js +169 -0
- package/DropdownContent.js +54 -39
- package/DropdownListItem.js +3 -4
- package/Enum.js +12 -0
- package/ErrorIcon.js +0 -1
- package/ErrorMessage.js +20 -20
- package/FieldSelect.js +4 -5
- package/FilePlaceholder.js +19 -0
- package/FileSelector.js +126 -141
- package/Flex.js +21 -0
- package/FontPicker.js +104 -0
- package/Footer.js +16 -0
- package/Form.js +23 -0
- package/FormData.js +4 -0
- package/Frame.js +64 -0
- package/Group.js +17 -0
- package/Group2.js +26 -0
- package/Header.js +0 -1
- package/Header2.js +43 -0
- package/Header22.js +15 -0
- package/HelperText.js +26 -0
- package/HorizontalScroll.js +4 -5
- package/HttpHandler.js +74 -0
- package/HttpResponse.js +85 -0
- package/HttpStatusCode.js +71 -0
- package/IconPlaceholder.js +18 -0
- package/Image.js +19 -0
- package/Images.js +30 -0
- package/Indicator.js +74 -0
- package/InfiniteScroll.js +8 -9
- package/InlineBanner.js +51 -0
- package/Input.js +109 -0
- package/Input.styles.js +71 -0
- package/InputContainer.js +9 -0
- package/InputField.js +74 -0
- package/InputRow.js +18 -0
- package/Inspector.js +34 -0
- package/InteractiveIcon.js +28 -0
- package/InterceptorManager.js +58 -0
- package/Item.js +107 -0
- package/Item2.js +14 -0
- package/Item4.js +190 -0
- package/Label.js +33 -0
- package/LeftArrow.js +3 -4
- package/List.js +25 -0
- package/ListItem.js +11 -0
- package/ListItem2.js +58 -0
- package/ListItem4.js +37 -0
- package/LoginComponent.js +0 -1
- package/LoginContext.js +0 -1
- package/MetapropertyFilterContent.js +2 -3
- package/MetapropertyOption.js +2 -4
- package/Middleware.js +49 -0
- package/Middleware2.js +49 -0
- package/Modal.js +2 -3
- package/Modal2.js +31 -0
- package/ModalBase.js +117 -0
- package/ModalBase.styles.js +75 -0
- package/ModalConfirmation.js +8 -0
- package/NoResults.js +16 -16
- package/OffsetContext.js +9 -0
- package/Oops.js +1 -2
- package/OpacityInput.js +17 -0
- package/Option_new.js +19 -19
- package/Overlay.js +35 -0
- package/Parser.js +131 -0
- package/Prefixer.js +187 -0
- package/Radio.js +78 -0
- package/RadioGroup.js +25 -0
- package/RangeInput.js +41 -0
- package/RefreshingSpinner.js +3 -4
- package/ReportModal.js +16 -15
- package/RequestHandler.js +119 -0
- package/RightArrow.js +4 -5
- package/RootElementContext.js +0 -1
- package/Row.js +16 -0
- package/SearchInput.js +27 -23
- package/SearchInput2.js +46 -0
- package/SectionTitle.js +17 -0
- package/Select.js +49 -0
- package/SelectButtonText.js +16 -0
- package/SelectedItemContainer.js +11 -11
- package/SelectedItems.js +2 -3
- package/SelectionContext.js +0 -1
- package/SelectionFooter.js +8 -8
- package/Serializer.js +27 -0
- package/ShadowRoot.js +0 -1
- package/ShadowRootInternal.js +17 -18
- package/Shield.js +0 -1
- package/Sidebar.js +17 -0
- package/Skeleton.js +6 -7
- package/Slider.constants.js +6 -0
- package/Slider.js +128 -0
- package/SmartFilterContent.js +2 -3
- package/SmartFilterSelect_new.js +2 -3
- package/Smartfilters_new.js +86 -77
- package/Spinner.js +2 -3
- package/Spinner2.js +15 -0
- package/StatefulAssetList.js +15 -16
- package/Stats.js +16 -0
- package/StatsItem.js +23 -0
- package/Status.js +32 -0
- package/StoreInitializer.js +29 -0
- package/Styles.css.js +0 -1
- package/Switch.js +82 -0
- package/SwitchNLS.js +26 -24
- package/Tabs2.js +10 -0
- package/TagItem.js +8 -9
- package/Tags.js +9 -10
- package/Text2.js +11 -0
- package/Text22.js +18 -0
- package/Text4.js +18 -0
- package/Textarea.js +92 -0
- package/Theming.js +4 -5
- package/Thumb.js +28 -0
- package/Thumbnail.js +91 -0
- package/Tokenizer.js +147 -0
- package/Toolbar.js +13 -13
- package/Tooltip.js +2 -3
- package/Tooltip2.js +111 -0
- package/TruncatedText.js +34 -0
- package/URLSearchParams.js +5 -0
- package/Utility.js +56 -0
- package/ViewSwitch.js +8 -8
- package/_check_private_redeclaration.js +7 -0
- package/_class_apply_descriptor_get.js +6 -0
- package/_class_apply_descriptor_set.js +11 -0
- package/_class_extract_field_descriptor.js +7 -0
- package/_class_private_field_get.js +9 -0
- package/_class_private_field_init.js +7 -0
- package/_class_private_field_set.js +9 -0
- package/_commonjsHelpers.js +6 -0
- package/adapters.js +53 -0
- package/api/types/getFilters_new.d.ts +8 -0
- package/api.js +25 -0
- package/api2.js +40 -0
- package/api3.js +406 -0
- package/applyScopeDataToEvent.js +83 -0
- package/applyScopeDataToEvent2.js +55 -0
- package/asset.type.js +9 -10
- package/asyncDebounce.js +0 -1
- package/auth.js +0 -1
- package/autocomplete.js +2 -3
- package/axios.js +46 -0
- package/base.js +57 -0
- package/base64Converter.js +0 -1
- package/baseclient.js +498 -0
- package/bind.js +8 -0
- package/browser.js +44 -0
- package/buildFullPath.js +9 -0
- package/buildURL.js +23 -0
- package/bundle.esm.js +81 -0
- package/calculateContainerMaxHeight.js +12 -0
- package/calculateNodeHeight.js +35 -0
- package/carrier.js +13 -0
- package/chain.js +8 -0
- package/checkGlobals.js +13 -0
- package/checks.js +178 -0
- package/chunk-6HYIRFX2.js +1 -0
- package/chunk.js +0 -1
- package/class.js +0 -1
- package/cleanUrl.js +11 -0
- package/client.js +76 -0
- package/clientreport.js +15 -0
- package/clsx.js +17 -0
- package/colorTransforms.js +12 -0
- package/combineFilters.js +0 -1
- package/combineMetaproperties.js +1 -2
- package/combineURLs.js +6 -0
- package/composeSignals.js +30 -0
- package/constants.js +2 -13
- package/constants2.js +82 -0
- package/constants3.js +14 -0
- package/constants4.js +8 -0
- package/constants5.js +4 -0
- package/constants6.js +4 -0
- package/context.js +12 -0
- package/context10.js +12 -0
- package/context2.js +9 -0
- package/context3.js +12 -0
- package/context6.js +5 -0
- package/cookieStore.js +116 -0
- package/cookies.js +32 -0
- package/core.js +42 -0
- package/createSelectors.js +0 -1
- package/crypto.js +0 -1
- package/currentScopes.js +9 -0
- package/data.js +4 -0
- package/de_DE.json.js +18 -0
- package/debug-build.js +4 -0
- package/debug-build2.js +4 -0
- package/debug-build3.js +4 -0
- package/debug-build4.js +4 -0
- package/debug-build5.js +4 -0
- package/debug-build6.js +4 -0
- package/decorators.js +37 -0
- package/defaultScopes.js +12 -0
- package/devUtils.js +20 -0
- package/dispatchRequest.js +31 -0
- package/doc.js +26 -0
- package/domHelpers.js +15 -0
- package/dsn.js +54 -0
- package/dynamicSamplingContext.js +34 -0
- package/dynamicSamplingContext2.js +34 -0
- package/emotion-unitless.esm.js +52 -0
- package/en_US.json.js +23 -0
- package/englishText-12403056.js +6 -0
- package/env.js +6 -0
- package/envelope.js +113 -0
- package/envelope2.js +23 -0
- package/envelope3.js +24 -0
- package/error.js +9 -0
- package/errors.js +33 -0
- package/errors2.js +55 -0
- package/es_ES.json.js +18 -0
- package/es_MX.json.js +18 -0
- package/eventProcessors.js +27 -0
- package/eventProcessors2.js +23 -0
- package/eventbuilder.js +128 -0
- package/exports.js +11 -0
- package/exports2.js +16 -0
- package/exports3.js +8 -0
- package/fetch.js +44 -0
- package/fetch2.js +141 -0
- package/filter/filters/smartfilters/Metaproperties/Autocomplete_new.d.ts +1 -1
- package/filter/filters/smartfilters/Metaproperties/Option_new.d.ts +3 -3
- package/filterAssets.js +1 -2
- package/fixFontSpaceInUrl.js +8 -0
- package/focusWithoutScrolling.js +45 -0
- package/forceHiddenStyles.js +19 -0
- package/formDataToJSON.js +31 -0
- package/fr_FR.json.js +18 -0
- package/getAbsoluteUrl.js +13 -0
- package/getAsset.js +1 -2
- package/getAssetCounts.js +1 -2
- package/getAssets.js +2 -3
- package/getCallFrame.js +12 -0
- package/getCollections.js +1 -2
- package/getFilterOptions.js +1 -2
- package/getFilters.js +1 -2
- package/getFilters_new.js +1 -2
- package/getLimitedUseThumbnails.js +0 -1
- package/getRequestCookies.js +40 -0
- package/getRootSpan.js +6 -0
- package/getRootSpan2.js +6 -0
- package/getSimilarityAssets.js +1 -2
- package/getSizingData.js +45 -0
- package/getStatusCodeColor.js +6 -0
- package/getThumbPosition.js +6 -0
- package/getTimestamp.js +7 -0
- package/getUseLayerOptions.js +49 -0
- package/handlers.js +92 -7
- package/handlers2.js +6 -0
- package/helpers.js +3 -5
- package/helpers2.js +6 -0
- package/hexFromPercentage.js +7 -0
- package/http.js +17 -0
- package/hub.js +446 -0
- package/hub2.js +442 -0
- package/immer.js +472 -0
- package/import.js +7 -0
- package/index-esm.js +10781 -0
- package/index-esm2.js +138 -0
- package/index-esm3.js +131 -0
- package/index.browser.js +11 -0
- package/index.js +0 -1
- package/index.module.js +57 -0
- package/index.module2.js +72 -0
- package/index.module3.js +57 -0
- package/index10.js +20 -0
- package/index102.js +273 -0
- package/index11.js +18 -0
- package/index112.js +29 -0
- package/index12.js +38 -0
- package/index13.js +2432 -0
- package/index14.js +558 -0
- package/index15.js +58 -0
- package/index16.js +4 -0
- package/index17.js +89 -0
- package/index18.js +9 -0
- package/index19.js +62 -0
- package/index2.js +0 -1
- package/index20.js +15 -0
- package/index21.js +11 -0
- package/index22.js +42 -0
- package/index23.js +9 -0
- package/index24.js +10 -0
- package/index25.js +7 -0
- package/index26.js +12 -0
- package/index27.js +11 -0
- package/index28.js +639 -0
- package/index29.js +76 -0
- package/index3.js +5 -54
- package/index30.js +7 -0
- package/index31.js +22 -0
- package/index32.js +2 -0
- package/index33.js +7 -0
- package/index34.js +20 -0
- package/index35.js +8 -0
- package/index36.js +4 -0
- package/index37.js +13 -0
- package/index38.js +13 -0
- package/index39.js +15 -0
- package/index4.js +1684 -18
- package/index40.js +13 -0
- package/index41.js +21 -0
- package/index42.js +66 -0
- package/index43.js +8 -0
- package/index44.js +57 -0
- package/index45.js +69 -0
- package/index46.js +33 -0
- package/index47.js +13 -0
- package/index48.js +123 -0
- package/index49.js +88 -0
- package/index5.js +27 -0
- package/index50.js +10 -0
- package/index51.js +13 -0
- package/index52.js +16 -0
- package/index53.js +16 -0
- package/index54.js +9 -0
- package/index55.js +9 -0
- package/index56.js +17 -0
- package/index57.js +31 -0
- package/index58.js +18 -0
- package/index6.js +315 -0
- package/index7.js +4 -0
- package/index72.js +228 -0
- package/index8.js +5051 -0
- package/index82.js +8 -0
- package/index9.js +55 -0
- package/index92.js +12 -0
- package/integration.js +38 -0
- package/is.js +77 -0
- package/is2.js +14 -0
- package/is3.js +14 -0
- package/isAbsoluteURL.js +6 -0
- package/isAbsoluteUrl2.js +6 -0
- package/isAxiosError.js +7 -0
- package/isCancel.js +6 -0
- package/isIterable.js +6 -0
- package/isStringEqual.js +6 -0
- package/isURLSameOrigin.js +8 -0
- package/isValidHexValue.js +6 -0
- package/isVirtualEvent.js +11 -0
- package/iso.js +38 -0
- package/it_IT.json.js +18 -0
- package/itemContext.js +5 -0
- package/ja_JP.json.js +18 -0
- package/ko_KR.json.js +18 -0
- package/localStorageHelper.js +32 -0
- package/localStorageHelper2.js +4 -0
- package/localization.js +46 -0
- package/logger.js +0 -1
- package/logger2.js +56 -0
- package/logger3.js +56 -0
- package/logger4.js +56 -0
- package/loginwindow.js +0 -1
- package/makeHexWithOpacity.js +12 -0
- package/makeInternalTokens.js +22 -0
- package/matchRequestUrl.js +23 -0
- package/memo.js +25 -0
- package/merge.js +13 -0
- package/mergeConfig.js +70 -0
- package/mergeProps.js +22 -0
- package/mergeRefs.js +9 -0
- package/middleware.js +177 -0
- package/middleware2.js +177 -0
- package/misc.js +58 -0
- package/misc2.js +28 -0
- package/misc3.js +24 -0
- package/nl_NL.json.js +18 -0
- package/normalize.js +97 -0
- package/normalizePath.js +11 -0
- package/normalizeResponse.js +1 -2
- package/normalizeRows.js +10 -0
- package/notify.js +52 -0
- package/null.js +4 -0
- package/oauth2.js +0 -1
- package/object.js +110 -0
- package/object2.js +39 -0
- package/object3.js +17 -0
- package/opacityPercentageFromHex.js +9 -0
- package/openLink.js +27 -0
- package/package.json +1 -1
- package/packageVersion.js +4 -0
- package/parse.js +9 -0
- package/parse2.js +44 -0
- package/parseHeaders.js +30 -0
- package/parseProtocol.js +7 -0
- package/pl_PL.json.js +18 -0
- package/platform.js +42 -0
- package/prepareEvent.js +141 -0
- package/prepareEvent2.js +5 -0
- package/prepareEvent3.js +5 -0
- package/progressEventReducer.js +35 -0
- package/promisebuffer.js +44 -0
- package/propagationContext.js +11 -0
- package/pt_BR.json.js +18 -0
- package/ratelimit.js +37 -0
- package/react.js +19 -0
- package/react2.js +19 -0
- package/regexes.js +51 -0
- package/registries.js +41 -0
- package/resolveConfig.js +33 -0
- package/result.type.js +0 -1
- package/ru_RU.json.js +18 -0
- package/runAfterTransition.js +35 -0
- package/schemas.js +368 -0
- package/schemas2.js +691 -0
- package/scope.js +412 -0
- package/scope2.js +407 -0
- package/scope3.js +348 -0
- package/sdk-DhxX43BH.js +4813 -0
- package/sdkMetadata.js +15 -0
- package/serializeRequest.js +12 -0
- package/serializeResponse.js +14 -0
- package/session.js +57 -0
- package/session2.js +57 -0
- package/session3.js +16 -0
- package/settle.js +14 -0
- package/shadowdom.js +13 -0
- package/shadowdom2.js +13 -0
- package/spanOnScope.js +12 -0
- package/spanUtils.js +31 -0
- package/spanUtils2.js +31 -0
- package/speedometer.js +19 -0
- package/spread.js +8 -0
- package/stack-parsers.js +48 -0
- package/stackStrategy.js +98 -0
- package/stacktrace.js +49 -0
- package/state.js +106 -0
- package/store/StoreInitializer.d.ts +8 -0
- package/store/useDatStore.d.ts +11 -8
- package/string.js +6 -0
- package/styled-components.browser.esm.js +530 -0
- package/styles.js +55 -0
- package/styles2.js +17 -0
- package/supports.js +6 -0
- package/syncpromise.js +121 -0
- package/syncpromise2.js +109 -0
- package/text.js +0 -1
- package/textSelection.js +33 -0
- package/textStyles.js +20 -0
- package/theme.js +238 -0
- package/themeContainers.js +20 -0
- package/themes3.js +26 -0
- package/throttle.js +15 -0
- package/time.js +24 -0
- package/time2.js +24 -0
- package/time3.js +24 -0
- package/toFormData.js +85 -0
- package/toPublicUrl.js +9 -0
- package/toURLEncodedForm.js +13 -0
- package/token.js +236 -0
- package/tokenExpirationHelper.js +48 -0
- package/tokenExpirationHelper2.js +4 -0
- package/tokensAndThemes.js +92 -0
- package/tr_TR.json.js +18 -0
- package/trackStream.js +63 -0
- package/transformData.js +13 -0
- package/transitional.js +8 -0
- package/trimMetapropertyValue.js +1 -2
- package/tslib.es6.js +18 -0
- package/typeof.js +11 -0
- package/url.js +0 -1
- package/urlHelper.js +15 -0
- package/urlHelper2.js +4 -0
- package/useAccountDomain.js +0 -1
- package/useAuthInformation.js +0 -1
- package/useAutoHeight.js +25 -0
- package/useClickOutside.js +0 -1
- package/useDatStore.js +31 -28
- package/useDimensions.js +0 -1
- package/useEffectEvent.js +18 -0
- package/useFocus.js +30 -0
- package/useFocusRing.js +34 -0
- package/useFocusVisible.js +92 -0
- package/useFocusWithin.js +57 -0
- package/useFonts.js +118 -0
- package/useGlobalListeners.js +34 -0
- package/useGroupContext.js +10 -0
- package/useHover.js +79 -0
- package/useId.js +8 -0
- package/useId2.js +17 -0
- package/useKeyDown.js +14 -0
- package/useLayoutEffect.js +6 -0
- package/useOrderingStore.js +6 -7
- package/usePress.js +359 -0
- package/useRouterStore.js +6 -7
- package/useScrollHighlightedIntoView.js +24 -0
- package/useSearchStore.js +5 -6
- package/useSimilaritySearchStore.js +6 -7
- package/useSyncRef.js +12 -0
- package/useTranslate.js +13 -0
- package/useZIndex.js +9 -0
- package/userfeedback.js +28 -0
- package/util.js +265 -0
- package/utils/fixFontSpaceInUrl.d.ts +1 -0
- package/utils.js +26 -45
- package/utils2.js +43 -46
- package/utils3.js +50 -0
- package/utils4.js +12 -0
- package/utils5.js +71 -0
- package/utils6.js +222 -0
- package/utils7.js +9 -0
- package/utils8.js +70 -0
- package/validator.js +54 -0
- package/vanilla.js +14 -0
- package/vanilla2.js +14 -0
- package/version.js +4 -0
- package/version2.js +4 -0
- package/version3.js +4 -0
- package/versionContext.js +9 -0
- package/versions.js +8 -0
- package/views/asset/asset-card/AssetCard.d.ts +4 -2
- package/views/asset/asset-card/ContextAction.d.ts +3 -1
- package/worldwide.js +19 -0
- package/worldwide2.js +15 -0
- package/worldwide3.js +10 -0
- package/xhr.js +71 -0
- package/zh_CN.json.js +18 -0
- package/zh_TW.json.js +18 -0
- package/ActiveFilter.js.map +0 -1
- package/ActiveFilters.js.map +0 -1
- package/AddMedia.js.map +0 -1
- package/Advanced.js.map +0 -1
- package/App.js.map +0 -1
- package/AssetCard.js.map +0 -1
- package/AssetCardMetaproperties.js.map +0 -1
- package/AssetFilter.js.map +0 -1
- package/AssetFilterContext.js.map +0 -1
- package/AssetItem.js.map +0 -1
- package/AssetList.js.map +0 -1
- package/AssetTypeItem.js.map +0 -1
- package/AssetsView.js.map +0 -1
- package/Autocomplete_new.js.map +0 -1
- package/ButtonAction.js.map +0 -1
- package/CardSkeleton.js.map +0 -1
- package/Checkbox.styles.js.map +0 -1
- package/Chip.js.map +0 -1
- package/CollectionCard.js.map +0 -1
- package/CollectionItem.js.map +0 -1
- package/CollectionList.js.map +0 -1
- package/CollectionView.js.map +0 -1
- package/CollectionsView.js.map +0 -1
- package/ConfigContext.js.map +0 -1
- package/ConnectButton.js.map +0 -1
- package/Container.js.map +0 -1
- package/ContextAction.js.map +0 -1
- package/Dat.js.map +0 -1
- package/DatDropdownItem.js.map +0 -1
- package/DesignSystemContext.js.map +0 -1
- package/DirectionSelect.js.map +0 -1
- package/DocumentIcon.js.map +0 -1
- package/DomainInput.js.map +0 -1
- package/DragSelect.js.map +0 -1
- package/Dropdown.js.map +0 -1
- package/DropdownContent.js.map +0 -1
- package/DropdownListItem.js.map +0 -1
- package/ErrorIcon.js.map +0 -1
- package/ErrorMessage.js.map +0 -1
- package/FieldSelect.js.map +0 -1
- package/FileSelector.js.map +0 -1
- package/Header.js.map +0 -1
- package/HorizontalScroll.js.map +0 -1
- package/InfiniteScroll.js.map +0 -1
- package/LeftArrow.js.map +0 -1
- package/LoginComponent.js.map +0 -1
- package/LoginContext.js.map +0 -1
- package/MetapropertyFilterContent.js.map +0 -1
- package/MetapropertyOption.js.map +0 -1
- package/Modal.js.map +0 -1
- package/NoResults.js.map +0 -1
- package/Oops.js.map +0 -1
- package/Option_new.js.map +0 -1
- package/RefreshingSpinner.js.map +0 -1
- package/ReportModal.js.map +0 -1
- package/RightArrow.js.map +0 -1
- package/RootElementContext.js.map +0 -1
- package/SearchInput.js.map +0 -1
- package/SelectedItemContainer.js.map +0 -1
- package/SelectedItems.js.map +0 -1
- package/SelectionContext.js.map +0 -1
- package/SelectionFooter.js.map +0 -1
- package/ShadowRoot.js.map +0 -1
- package/ShadowRootInternal.js.map +0 -1
- package/Shield.js.map +0 -1
- package/Skeleton.js.map +0 -1
- package/SmartFilterContent.js.map +0 -1
- package/SmartFilterSelect_new.js.map +0 -1
- package/Smartfilters_new.js.map +0 -1
- package/Spinner.js.map +0 -1
- package/StatefulAssetList.js.map +0 -1
- package/Styles.css.js.map +0 -1
- package/SwitchNLS.js.map +0 -1
- package/TagItem.js.map +0 -1
- package/Tags.js.map +0 -1
- package/Theming.js.map +0 -1
- package/Toolbar.js.map +0 -1
- package/Tooltip.js.map +0 -1
- package/ViewSwitch.js.map +0 -1
- package/asset.type.js.map +0 -1
- package/asyncDebounce.js.map +0 -1
- package/auth.js.map +0 -1
- package/autocomplete.js.map +0 -1
- package/base64Converter.js.map +0 -1
- package/chunk.js.map +0 -1
- package/class.js.map +0 -1
- package/combineFilters.js.map +0 -1
- package/combineMetaproperties.js.map +0 -1
- package/constants.js.map +0 -1
- package/createSelectors.js.map +0 -1
- package/crypto.js.map +0 -1
- package/filterAssets.js.map +0 -1
- package/getAsset.js.map +0 -1
- package/getAssetCounts.js.map +0 -1
- package/getAssets.js.map +0 -1
- package/getCollections.js.map +0 -1
- package/getFilterOptions.js.map +0 -1
- package/getFilters.js.map +0 -1
- package/getFilters_new.js.map +0 -1
- package/getLimitedUseThumbnails.js.map +0 -1
- package/getSimilarityAssets.js.map +0 -1
- package/handlers.js.map +0 -1
- package/helpers.js.map +0 -1
- package/index.js.map +0 -1
- package/index2.js.map +0 -1
- package/index3.js.map +0 -1
- package/index4.js.map +0 -1
- package/logger.js.map +0 -1
- package/loginwindow.js.map +0 -1
- package/normalizeResponse.js.map +0 -1
- package/oauth2.js.map +0 -1
- package/result.type.js.map +0 -1
- package/router/RouterContext.d.ts +0 -19
- package/text.js.map +0 -1
- package/trimMetapropertyValue.js.map +0 -1
- package/url.js.map +0 -1
- package/useAccountDomain.js.map +0 -1
- package/useAuthInformation.js.map +0 -1
- package/useClickOutside.js.map +0 -1
- package/useDatStore.js.map +0 -1
- package/useDimensions.js.map +0 -1
- package/useOrderingStore.js.map +0 -1
- package/useRouterStore.js.map +0 -1
- package/useSearchStore.js.map +0 -1
- package/useSimilaritySearchStore.js.map +0 -1
- package/utils.js.map +0 -1
- package/utils2.js.map +0 -1
package/sdk-DhxX43BH.js
ADDED
|
@@ -0,0 +1,4813 @@
|
|
|
1
|
+
const kr = [];
|
|
2
|
+
for (let r = 0; r < 256; ++r)
|
|
3
|
+
kr.push((r + 256).toString(16).slice(1));
|
|
4
|
+
typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
5
|
+
var he = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
6
|
+
function Ve(r) {
|
|
7
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
8
|
+
}
|
|
9
|
+
var qt = { exports: {} }, Sr = qt.exports, pe;
|
|
10
|
+
function Or() {
|
|
11
|
+
return pe || (pe = 1, (function(r) {
|
|
12
|
+
(function(t, e) {
|
|
13
|
+
r.exports ? r.exports = e() : t.log = e();
|
|
14
|
+
})(Sr, function() {
|
|
15
|
+
var t = function() {
|
|
16
|
+
}, e = "undefined", n = typeof window !== e && typeof window.navigator !== e && /Trident\/|MSIE /.test(window.navigator.userAgent), o = [
|
|
17
|
+
"trace",
|
|
18
|
+
"debug",
|
|
19
|
+
"info",
|
|
20
|
+
"warn",
|
|
21
|
+
"error"
|
|
22
|
+
], i = {}, u = null;
|
|
23
|
+
function l(E, U) {
|
|
24
|
+
var S = E[U];
|
|
25
|
+
if (typeof S.bind == "function")
|
|
26
|
+
return S.bind(E);
|
|
27
|
+
try {
|
|
28
|
+
return Function.prototype.bind.call(S, E);
|
|
29
|
+
} catch {
|
|
30
|
+
return function() {
|
|
31
|
+
return Function.prototype.apply.apply(S, [E, arguments]);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function f() {
|
|
36
|
+
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
37
|
+
}
|
|
38
|
+
function d(E) {
|
|
39
|
+
return E === "debug" && (E = "log"), typeof console === e ? !1 : E === "trace" && n ? f : console[E] !== void 0 ? l(console, E) : console.log !== void 0 ? l(console, "log") : t;
|
|
40
|
+
}
|
|
41
|
+
function _() {
|
|
42
|
+
for (var E = this.getLevel(), U = 0; U < o.length; U++) {
|
|
43
|
+
var S = o[U];
|
|
44
|
+
this[S] = U < E ? t : this.methodFactory(S, E, this.name);
|
|
45
|
+
}
|
|
46
|
+
if (this.log = this.debug, typeof console === e && E < this.levels.SILENT)
|
|
47
|
+
return "No console available for logging";
|
|
48
|
+
}
|
|
49
|
+
function L(E) {
|
|
50
|
+
return function() {
|
|
51
|
+
typeof console !== e && (_.call(this), this[E].apply(this, arguments));
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function B(E, U, S) {
|
|
55
|
+
return d(E) || L.apply(this, arguments);
|
|
56
|
+
}
|
|
57
|
+
function K(E, U) {
|
|
58
|
+
var S = this, y, g, m, p = "loglevel";
|
|
59
|
+
typeof E == "string" ? p += ":" + E : typeof E == "symbol" && (p = void 0);
|
|
60
|
+
function x(P) {
|
|
61
|
+
var N = (o[P] || "silent").toUpperCase();
|
|
62
|
+
if (!(typeof window === e || !p)) {
|
|
63
|
+
try {
|
|
64
|
+
window.localStorage[p] = N;
|
|
65
|
+
return;
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
window.document.cookie = encodeURIComponent(p) + "=" + N + ";";
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function k() {
|
|
75
|
+
var P;
|
|
76
|
+
if (!(typeof window === e || !p)) {
|
|
77
|
+
try {
|
|
78
|
+
P = window.localStorage[p];
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
if (typeof P === e)
|
|
82
|
+
try {
|
|
83
|
+
var N = window.document.cookie, b = encodeURIComponent(p), z = N.indexOf(b + "=");
|
|
84
|
+
z !== -1 && (P = /^([^;]+)/.exec(
|
|
85
|
+
N.slice(z + b.length + 1)
|
|
86
|
+
)[1]);
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
89
|
+
return S.levels[P] === void 0 && (P = void 0), P;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function C() {
|
|
93
|
+
if (!(typeof window === e || !p)) {
|
|
94
|
+
try {
|
|
95
|
+
window.localStorage.removeItem(p);
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
window.document.cookie = encodeURIComponent(p) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
100
|
+
} catch {
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function O(P) {
|
|
105
|
+
var N = P;
|
|
106
|
+
if (typeof N == "string" && S.levels[N.toUpperCase()] !== void 0 && (N = S.levels[N.toUpperCase()]), typeof N == "number" && N >= 0 && N <= S.levels.SILENT)
|
|
107
|
+
return N;
|
|
108
|
+
throw new TypeError("log.setLevel() called with invalid level: " + P);
|
|
109
|
+
}
|
|
110
|
+
S.name = E, S.levels = {
|
|
111
|
+
TRACE: 0,
|
|
112
|
+
DEBUG: 1,
|
|
113
|
+
INFO: 2,
|
|
114
|
+
WARN: 3,
|
|
115
|
+
ERROR: 4,
|
|
116
|
+
SILENT: 5
|
|
117
|
+
}, S.methodFactory = U || B, S.getLevel = function() {
|
|
118
|
+
return m ?? g ?? y;
|
|
119
|
+
}, S.setLevel = function(P, N) {
|
|
120
|
+
return m = O(P), N !== !1 && x(m), _.call(S);
|
|
121
|
+
}, S.setDefaultLevel = function(P) {
|
|
122
|
+
g = O(P), k() || S.setLevel(P, !1);
|
|
123
|
+
}, S.resetLevel = function() {
|
|
124
|
+
m = null, C(), _.call(S);
|
|
125
|
+
}, S.enableAll = function(P) {
|
|
126
|
+
S.setLevel(S.levels.TRACE, P);
|
|
127
|
+
}, S.disableAll = function(P) {
|
|
128
|
+
S.setLevel(S.levels.SILENT, P);
|
|
129
|
+
}, S.rebuild = function() {
|
|
130
|
+
if (u !== S && (y = O(u.getLevel())), _.call(S), u === S)
|
|
131
|
+
for (var P in i)
|
|
132
|
+
i[P].rebuild();
|
|
133
|
+
}, y = O(
|
|
134
|
+
u ? u.getLevel() : "WARN"
|
|
135
|
+
);
|
|
136
|
+
var q = k();
|
|
137
|
+
q != null && (m = O(q)), _.call(S);
|
|
138
|
+
}
|
|
139
|
+
u = new K(), u.getLogger = function(E) {
|
|
140
|
+
if (typeof E != "symbol" && typeof E != "string" || E === "")
|
|
141
|
+
throw new TypeError("You must supply a name when creating a logger.");
|
|
142
|
+
var U = i[E];
|
|
143
|
+
return U || (U = i[E] = new K(
|
|
144
|
+
E,
|
|
145
|
+
u.methodFactory
|
|
146
|
+
)), U;
|
|
147
|
+
};
|
|
148
|
+
var G = typeof window !== e ? window.log : void 0;
|
|
149
|
+
return u.noConflict = function() {
|
|
150
|
+
return typeof window !== e && window.log === u && (window.log = G), u;
|
|
151
|
+
}, u.getLoggers = function() {
|
|
152
|
+
return i;
|
|
153
|
+
}, u.default = u, u;
|
|
154
|
+
});
|
|
155
|
+
})(qt)), qt.exports;
|
|
156
|
+
}
|
|
157
|
+
var xr = Or();
|
|
158
|
+
const Q = /* @__PURE__ */ Ve(xr);
|
|
159
|
+
let Ft = localStorage.getItem("asset_sdk_verbose") === "true";
|
|
160
|
+
const Ur = {};
|
|
161
|
+
Q.setDefaultLevel(Ft ? Q.levels.DEBUG : Q.levels.WARN);
|
|
162
|
+
function Rr(r) {
|
|
163
|
+
Ft = r, localStorage.setItem("asset_sdk_verbose", String(!!r));
|
|
164
|
+
const t = Ft ? Q.levels.DEBUG : Q.levels.WARN;
|
|
165
|
+
Q.setLevel(t), Object.values(Ur).forEach((e) => {
|
|
166
|
+
e.setLevel(t);
|
|
167
|
+
});
|
|
168
|
+
try {
|
|
169
|
+
localStorage.setItem("asset_sdk_verbose", String(r));
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.error(`Can't save logger verbosity to localStorage: ${e}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
typeof window < "u" && (window.asset_sdk_logger = { setVerbose: Rr, log: Q });
|
|
175
|
+
const J = /* @__PURE__ */ Object.create(null);
|
|
176
|
+
J.open = "0";
|
|
177
|
+
J.close = "1";
|
|
178
|
+
J.ping = "2";
|
|
179
|
+
J.pong = "3";
|
|
180
|
+
J.message = "4";
|
|
181
|
+
J.upgrade = "5";
|
|
182
|
+
J.noop = "6";
|
|
183
|
+
const St = /* @__PURE__ */ Object.create(null);
|
|
184
|
+
Object.keys(J).forEach((r) => {
|
|
185
|
+
St[J[r]] = r;
|
|
186
|
+
});
|
|
187
|
+
const Ht = { type: "error", data: "parser error" }, Ke = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Ge = typeof ArrayBuffer == "function", Ye = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r && r.buffer instanceof ArrayBuffer, ee = ({ type: r, data: t }, e, n) => Ke && t instanceof Blob ? e ? n(t) : fe(t, n) : Ge && (t instanceof ArrayBuffer || Ye(t)) ? e ? n(t) : fe(new Blob([t]), n) : n(J[r] + (t || "")), fe = (r, t) => {
|
|
188
|
+
const e = new FileReader();
|
|
189
|
+
return e.onload = function() {
|
|
190
|
+
const n = e.result.split(",")[1];
|
|
191
|
+
t("b" + (n || ""));
|
|
192
|
+
}, e.readAsDataURL(r);
|
|
193
|
+
};
|
|
194
|
+
function de(r) {
|
|
195
|
+
return r instanceof Uint8Array ? r : r instanceof ArrayBuffer ? new Uint8Array(r) : new Uint8Array(r.buffer, r.byteOffset, r.byteLength);
|
|
196
|
+
}
|
|
197
|
+
let At;
|
|
198
|
+
function Tr(r, t) {
|
|
199
|
+
if (Ke && r.data instanceof Blob)
|
|
200
|
+
return r.data.arrayBuffer().then(de).then(t);
|
|
201
|
+
if (Ge && (r.data instanceof ArrayBuffer || Ye(r.data)))
|
|
202
|
+
return t(de(r.data));
|
|
203
|
+
ee(r, !1, (e) => {
|
|
204
|
+
At || (At = new TextEncoder()), t(At.encode(e));
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
const ye = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ut = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
208
|
+
for (let r = 0; r < ye.length; r++)
|
|
209
|
+
ut[ye.charCodeAt(r)] = r;
|
|
210
|
+
const Cr = (r) => {
|
|
211
|
+
let t = r.length * 0.75, e = r.length, n, o = 0, i, u, l, f;
|
|
212
|
+
r[r.length - 1] === "=" && (t--, r[r.length - 2] === "=" && t--);
|
|
213
|
+
const d = new ArrayBuffer(t), _ = new Uint8Array(d);
|
|
214
|
+
for (n = 0; n < e; n += 4)
|
|
215
|
+
i = ut[r.charCodeAt(n)], u = ut[r.charCodeAt(n + 1)], l = ut[r.charCodeAt(n + 2)], f = ut[r.charCodeAt(n + 3)], _[o++] = i << 2 | u >> 4, _[o++] = (u & 15) << 4 | l >> 2, _[o++] = (l & 3) << 6 | f & 63;
|
|
216
|
+
return d;
|
|
217
|
+
}, Pr = typeof ArrayBuffer == "function", re = (r, t) => {
|
|
218
|
+
if (typeof r != "string")
|
|
219
|
+
return {
|
|
220
|
+
type: "message",
|
|
221
|
+
data: We(r, t)
|
|
222
|
+
};
|
|
223
|
+
const e = r.charAt(0);
|
|
224
|
+
return e === "b" ? {
|
|
225
|
+
type: "message",
|
|
226
|
+
data: Lr(r.substring(1), t)
|
|
227
|
+
} : St[e] ? r.length > 1 ? {
|
|
228
|
+
type: St[e],
|
|
229
|
+
data: r.substring(1)
|
|
230
|
+
} : {
|
|
231
|
+
type: St[e]
|
|
232
|
+
} : Ht;
|
|
233
|
+
}, Lr = (r, t) => {
|
|
234
|
+
if (Pr) {
|
|
235
|
+
const e = Cr(r);
|
|
236
|
+
return We(e, t);
|
|
237
|
+
} else
|
|
238
|
+
return { base64: !0, data: r };
|
|
239
|
+
}, We = (r, t) => {
|
|
240
|
+
switch (t) {
|
|
241
|
+
case "blob":
|
|
242
|
+
return r instanceof Blob ? r : new Blob([r]);
|
|
243
|
+
case "arraybuffer":
|
|
244
|
+
default:
|
|
245
|
+
return r instanceof ArrayBuffer ? r : r.buffer;
|
|
246
|
+
}
|
|
247
|
+
}, Je = "", Ar = (r, t) => {
|
|
248
|
+
const e = r.length, n = new Array(e);
|
|
249
|
+
let o = 0;
|
|
250
|
+
r.forEach((i, u) => {
|
|
251
|
+
ee(i, !1, (l) => {
|
|
252
|
+
n[u] = l, ++o === e && t(n.join(Je));
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}, jr = (r, t) => {
|
|
256
|
+
const e = r.split(Je), n = [];
|
|
257
|
+
for (let o = 0; o < e.length; o++) {
|
|
258
|
+
const i = re(e[o], t);
|
|
259
|
+
if (n.push(i), i.type === "error")
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
return n;
|
|
263
|
+
};
|
|
264
|
+
function Br() {
|
|
265
|
+
return new TransformStream({
|
|
266
|
+
transform(r, t) {
|
|
267
|
+
Tr(r, (e) => {
|
|
268
|
+
const n = e.length;
|
|
269
|
+
let o;
|
|
270
|
+
if (n < 126)
|
|
271
|
+
o = new Uint8Array(1), new DataView(o.buffer).setUint8(0, n);
|
|
272
|
+
else if (n < 65536) {
|
|
273
|
+
o = new Uint8Array(3);
|
|
274
|
+
const i = new DataView(o.buffer);
|
|
275
|
+
i.setUint8(0, 126), i.setUint16(1, n);
|
|
276
|
+
} else {
|
|
277
|
+
o = new Uint8Array(9);
|
|
278
|
+
const i = new DataView(o.buffer);
|
|
279
|
+
i.setUint8(0, 127), i.setBigUint64(1, BigInt(n));
|
|
280
|
+
}
|
|
281
|
+
r.data && typeof r.data != "string" && (o[0] |= 128), t.enqueue(o), t.enqueue(e);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
let jt;
|
|
287
|
+
function bt(r) {
|
|
288
|
+
return r.reduce((t, e) => t + e.length, 0);
|
|
289
|
+
}
|
|
290
|
+
function _t(r, t) {
|
|
291
|
+
if (r[0].length === t)
|
|
292
|
+
return r.shift();
|
|
293
|
+
const e = new Uint8Array(t);
|
|
294
|
+
let n = 0;
|
|
295
|
+
for (let o = 0; o < t; o++)
|
|
296
|
+
e[o] = r[0][n++], n === r[0].length && (r.shift(), n = 0);
|
|
297
|
+
return r.length && n < r[0].length && (r[0] = r[0].slice(n)), e;
|
|
298
|
+
}
|
|
299
|
+
function Nr(r, t) {
|
|
300
|
+
jt || (jt = new TextDecoder());
|
|
301
|
+
const e = [];
|
|
302
|
+
let n = 0, o = -1, i = !1;
|
|
303
|
+
return new TransformStream({
|
|
304
|
+
transform(u, l) {
|
|
305
|
+
for (e.push(u); ; ) {
|
|
306
|
+
if (n === 0) {
|
|
307
|
+
if (bt(e) < 1)
|
|
308
|
+
break;
|
|
309
|
+
const f = _t(e, 1);
|
|
310
|
+
i = (f[0] & 128) === 128, o = f[0] & 127, o < 126 ? n = 3 : o === 126 ? n = 1 : n = 2;
|
|
311
|
+
} else if (n === 1) {
|
|
312
|
+
if (bt(e) < 2)
|
|
313
|
+
break;
|
|
314
|
+
const f = _t(e, 2);
|
|
315
|
+
o = new DataView(f.buffer, f.byteOffset, f.length).getUint16(0), n = 3;
|
|
316
|
+
} else if (n === 2) {
|
|
317
|
+
if (bt(e) < 8)
|
|
318
|
+
break;
|
|
319
|
+
const f = _t(e, 8), d = new DataView(f.buffer, f.byteOffset, f.length), _ = d.getUint32(0);
|
|
320
|
+
if (_ > Math.pow(2, 21) - 1) {
|
|
321
|
+
l.enqueue(Ht);
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
o = _ * Math.pow(2, 32) + d.getUint32(4), n = 3;
|
|
325
|
+
} else {
|
|
326
|
+
if (bt(e) < o)
|
|
327
|
+
break;
|
|
328
|
+
const f = _t(e, o);
|
|
329
|
+
l.enqueue(re(i ? f : jt.decode(f), t)), n = 0;
|
|
330
|
+
}
|
|
331
|
+
if (o === 0 || o > r) {
|
|
332
|
+
l.enqueue(Ht);
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
const Xe = 4;
|
|
340
|
+
function D(r) {
|
|
341
|
+
if (r) return Ir(r);
|
|
342
|
+
}
|
|
343
|
+
function Ir(r) {
|
|
344
|
+
for (var t in D.prototype)
|
|
345
|
+
r[t] = D.prototype[t];
|
|
346
|
+
return r;
|
|
347
|
+
}
|
|
348
|
+
D.prototype.on = D.prototype.addEventListener = function(r, t) {
|
|
349
|
+
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + r] = this._callbacks["$" + r] || []).push(t), this;
|
|
350
|
+
};
|
|
351
|
+
D.prototype.once = function(r, t) {
|
|
352
|
+
function e() {
|
|
353
|
+
this.off(r, e), t.apply(this, arguments);
|
|
354
|
+
}
|
|
355
|
+
return e.fn = t, this.on(r, e), this;
|
|
356
|
+
};
|
|
357
|
+
D.prototype.off = D.prototype.removeListener = D.prototype.removeAllListeners = D.prototype.removeEventListener = function(r, t) {
|
|
358
|
+
if (this._callbacks = this._callbacks || {}, arguments.length == 0)
|
|
359
|
+
return this._callbacks = {}, this;
|
|
360
|
+
var e = this._callbacks["$" + r];
|
|
361
|
+
if (!e) return this;
|
|
362
|
+
if (arguments.length == 1)
|
|
363
|
+
return delete this._callbacks["$" + r], this;
|
|
364
|
+
for (var n, o = 0; o < e.length; o++)
|
|
365
|
+
if (n = e[o], n === t || n.fn === t) {
|
|
366
|
+
e.splice(o, 1);
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
return e.length === 0 && delete this._callbacks["$" + r], this;
|
|
370
|
+
};
|
|
371
|
+
D.prototype.emit = function(r) {
|
|
372
|
+
this._callbacks = this._callbacks || {};
|
|
373
|
+
for (var t = new Array(arguments.length - 1), e = this._callbacks["$" + r], n = 1; n < arguments.length; n++)
|
|
374
|
+
t[n - 1] = arguments[n];
|
|
375
|
+
if (e) {
|
|
376
|
+
e = e.slice(0);
|
|
377
|
+
for (var n = 0, o = e.length; n < o; ++n)
|
|
378
|
+
e[n].apply(this, t);
|
|
379
|
+
}
|
|
380
|
+
return this;
|
|
381
|
+
};
|
|
382
|
+
D.prototype.emitReserved = D.prototype.emit;
|
|
383
|
+
D.prototype.listeners = function(r) {
|
|
384
|
+
return this._callbacks = this._callbacks || {}, this._callbacks["$" + r] || [];
|
|
385
|
+
};
|
|
386
|
+
D.prototype.hasListeners = function(r) {
|
|
387
|
+
return !!this.listeners(r).length;
|
|
388
|
+
};
|
|
389
|
+
const Pt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (r) => Promise.resolve().then(r) : (r, t) => t(r, 0), V = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Dr = "arraybuffer";
|
|
390
|
+
function $e(r, ...t) {
|
|
391
|
+
return t.reduce((e, n) => (r.hasOwnProperty(n) && (e[n] = r[n]), e), {});
|
|
392
|
+
}
|
|
393
|
+
const qr = V.setTimeout, Fr = V.clearTimeout;
|
|
394
|
+
function Lt(r, t) {
|
|
395
|
+
t.useNativeTimers ? (r.setTimeoutFn = qr.bind(V), r.clearTimeoutFn = Fr.bind(V)) : (r.setTimeoutFn = V.setTimeout.bind(V), r.clearTimeoutFn = V.clearTimeout.bind(V));
|
|
396
|
+
}
|
|
397
|
+
const Hr = 1.33;
|
|
398
|
+
function zr(r) {
|
|
399
|
+
return typeof r == "string" ? Mr(r) : Math.ceil((r.byteLength || r.size) * Hr);
|
|
400
|
+
}
|
|
401
|
+
function Mr(r) {
|
|
402
|
+
let t = 0, e = 0;
|
|
403
|
+
for (let n = 0, o = r.length; n < o; n++)
|
|
404
|
+
t = r.charCodeAt(n), t < 128 ? e += 1 : t < 2048 ? e += 2 : t < 55296 || t >= 57344 ? e += 3 : (n++, e += 4);
|
|
405
|
+
return e;
|
|
406
|
+
}
|
|
407
|
+
function Qe() {
|
|
408
|
+
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
409
|
+
}
|
|
410
|
+
function Vr(r) {
|
|
411
|
+
let t = "";
|
|
412
|
+
for (let e in r)
|
|
413
|
+
r.hasOwnProperty(e) && (t.length && (t += "&"), t += encodeURIComponent(e) + "=" + encodeURIComponent(r[e]));
|
|
414
|
+
return t;
|
|
415
|
+
}
|
|
416
|
+
function Kr(r) {
|
|
417
|
+
let t = {}, e = r.split("&");
|
|
418
|
+
for (let n = 0, o = e.length; n < o; n++) {
|
|
419
|
+
let i = e[n].split("=");
|
|
420
|
+
t[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
|
|
421
|
+
}
|
|
422
|
+
return t;
|
|
423
|
+
}
|
|
424
|
+
class Gr extends Error {
|
|
425
|
+
constructor(t, e, n) {
|
|
426
|
+
super(t), this.description = e, this.context = n, this.type = "TransportError";
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
class ne extends D {
|
|
430
|
+
/**
|
|
431
|
+
* Transport abstract constructor.
|
|
432
|
+
*
|
|
433
|
+
* @param {Object} opts - options
|
|
434
|
+
* @protected
|
|
435
|
+
*/
|
|
436
|
+
constructor(t) {
|
|
437
|
+
super(), this.writable = !1, Lt(this, t), this.opts = t, this.query = t.query, this.socket = t.socket, this.supportsBinary = !t.forceBase64;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Emits an error.
|
|
441
|
+
*
|
|
442
|
+
* @param {String} reason
|
|
443
|
+
* @param description
|
|
444
|
+
* @param context - the error context
|
|
445
|
+
* @return {Transport} for chaining
|
|
446
|
+
* @protected
|
|
447
|
+
*/
|
|
448
|
+
onError(t, e, n) {
|
|
449
|
+
return super.emitReserved("error", new Gr(t, e, n)), this;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Opens the transport.
|
|
453
|
+
*/
|
|
454
|
+
open() {
|
|
455
|
+
return this.readyState = "opening", this.doOpen(), this;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Closes the transport.
|
|
459
|
+
*/
|
|
460
|
+
close() {
|
|
461
|
+
return (this.readyState === "opening" || this.readyState === "open") && (this.doClose(), this.onClose()), this;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Sends multiple packets.
|
|
465
|
+
*
|
|
466
|
+
* @param {Array} packets
|
|
467
|
+
*/
|
|
468
|
+
send(t) {
|
|
469
|
+
this.readyState === "open" && this.write(t);
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Called upon open
|
|
473
|
+
*
|
|
474
|
+
* @protected
|
|
475
|
+
*/
|
|
476
|
+
onOpen() {
|
|
477
|
+
this.readyState = "open", this.writable = !0, super.emitReserved("open");
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Called with data.
|
|
481
|
+
*
|
|
482
|
+
* @param {String} data
|
|
483
|
+
* @protected
|
|
484
|
+
*/
|
|
485
|
+
onData(t) {
|
|
486
|
+
const e = re(t, this.socket.binaryType);
|
|
487
|
+
this.onPacket(e);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Called with a decoded packet.
|
|
491
|
+
*
|
|
492
|
+
* @protected
|
|
493
|
+
*/
|
|
494
|
+
onPacket(t) {
|
|
495
|
+
super.emitReserved("packet", t);
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Called upon close.
|
|
499
|
+
*
|
|
500
|
+
* @protected
|
|
501
|
+
*/
|
|
502
|
+
onClose(t) {
|
|
503
|
+
this.readyState = "closed", super.emitReserved("close", t);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Pauses the transport, in order not to lose packets during an upgrade.
|
|
507
|
+
*
|
|
508
|
+
* @param onPause
|
|
509
|
+
*/
|
|
510
|
+
pause(t) {
|
|
511
|
+
}
|
|
512
|
+
createUri(t, e = {}) {
|
|
513
|
+
return t + "://" + this._hostname() + this._port() + this.opts.path + this._query(e);
|
|
514
|
+
}
|
|
515
|
+
_hostname() {
|
|
516
|
+
const t = this.opts.hostname;
|
|
517
|
+
return t.indexOf(":") === -1 ? t : "[" + t + "]";
|
|
518
|
+
}
|
|
519
|
+
_port() {
|
|
520
|
+
return this.opts.port && (this.opts.secure && +(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
521
|
+
}
|
|
522
|
+
_query(t) {
|
|
523
|
+
const e = Vr(t);
|
|
524
|
+
return e.length ? "?" + e : "";
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
class Yr extends ne {
|
|
528
|
+
constructor() {
|
|
529
|
+
super(...arguments), this._polling = !1;
|
|
530
|
+
}
|
|
531
|
+
get name() {
|
|
532
|
+
return "polling";
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Opens the socket (triggers polling). We write a PING message to determine
|
|
536
|
+
* when the transport is open.
|
|
537
|
+
*
|
|
538
|
+
* @protected
|
|
539
|
+
*/
|
|
540
|
+
doOpen() {
|
|
541
|
+
this._poll();
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Pauses polling.
|
|
545
|
+
*
|
|
546
|
+
* @param {Function} onPause - callback upon buffers are flushed and transport is paused
|
|
547
|
+
* @package
|
|
548
|
+
*/
|
|
549
|
+
pause(t) {
|
|
550
|
+
this.readyState = "pausing";
|
|
551
|
+
const e = () => {
|
|
552
|
+
this.readyState = "paused", t();
|
|
553
|
+
};
|
|
554
|
+
if (this._polling || !this.writable) {
|
|
555
|
+
let n = 0;
|
|
556
|
+
this._polling && (n++, this.once("pollComplete", function() {
|
|
557
|
+
--n || e();
|
|
558
|
+
})), this.writable || (n++, this.once("drain", function() {
|
|
559
|
+
--n || e();
|
|
560
|
+
}));
|
|
561
|
+
} else
|
|
562
|
+
e();
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Starts polling cycle.
|
|
566
|
+
*
|
|
567
|
+
* @private
|
|
568
|
+
*/
|
|
569
|
+
_poll() {
|
|
570
|
+
this._polling = !0, this.doPoll(), this.emitReserved("poll");
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Overloads onData to detect payloads.
|
|
574
|
+
*
|
|
575
|
+
* @protected
|
|
576
|
+
*/
|
|
577
|
+
onData(t) {
|
|
578
|
+
const e = (n) => {
|
|
579
|
+
if (this.readyState === "opening" && n.type === "open" && this.onOpen(), n.type === "close")
|
|
580
|
+
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
581
|
+
this.onPacket(n);
|
|
582
|
+
};
|
|
583
|
+
jr(t, this.socket.binaryType).forEach(e), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* For polling, send a close packet.
|
|
587
|
+
*
|
|
588
|
+
* @protected
|
|
589
|
+
*/
|
|
590
|
+
doClose() {
|
|
591
|
+
const t = () => {
|
|
592
|
+
this.write([{ type: "close" }]);
|
|
593
|
+
};
|
|
594
|
+
this.readyState === "open" ? t() : this.once("open", t);
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Writes a packets payload.
|
|
598
|
+
*
|
|
599
|
+
* @param {Array} packets - data packets
|
|
600
|
+
* @protected
|
|
601
|
+
*/
|
|
602
|
+
write(t) {
|
|
603
|
+
this.writable = !1, Ar(t, (e) => {
|
|
604
|
+
this.doWrite(e, () => {
|
|
605
|
+
this.writable = !0, this.emitReserved("drain");
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Generates uri for connection.
|
|
611
|
+
*
|
|
612
|
+
* @private
|
|
613
|
+
*/
|
|
614
|
+
uri() {
|
|
615
|
+
const t = this.opts.secure ? "https" : "http", e = this.query || {};
|
|
616
|
+
return this.opts.timestampRequests !== !1 && (e[this.opts.timestampParam] = Qe()), !this.supportsBinary && !e.sid && (e.b64 = 1), this.createUri(t, e);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
let Ze = !1;
|
|
620
|
+
try {
|
|
621
|
+
Ze = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
622
|
+
} catch {
|
|
623
|
+
}
|
|
624
|
+
const Wr = Ze;
|
|
625
|
+
function Jr() {
|
|
626
|
+
}
|
|
627
|
+
class Xr extends Yr {
|
|
628
|
+
/**
|
|
629
|
+
* XHR Polling constructor.
|
|
630
|
+
*
|
|
631
|
+
* @param {Object} opts
|
|
632
|
+
* @package
|
|
633
|
+
*/
|
|
634
|
+
constructor(t) {
|
|
635
|
+
if (super(t), typeof location < "u") {
|
|
636
|
+
const e = location.protocol === "https:";
|
|
637
|
+
let n = location.port;
|
|
638
|
+
n || (n = e ? "443" : "80"), this.xd = typeof location < "u" && t.hostname !== location.hostname || n !== t.port;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Sends data.
|
|
643
|
+
*
|
|
644
|
+
* @param {String} data to send.
|
|
645
|
+
* @param {Function} called upon flush.
|
|
646
|
+
* @private
|
|
647
|
+
*/
|
|
648
|
+
doWrite(t, e) {
|
|
649
|
+
const n = this.request({
|
|
650
|
+
method: "POST",
|
|
651
|
+
data: t
|
|
652
|
+
});
|
|
653
|
+
n.on("success", e), n.on("error", (o, i) => {
|
|
654
|
+
this.onError("xhr post error", o, i);
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Starts a poll cycle.
|
|
659
|
+
*
|
|
660
|
+
* @private
|
|
661
|
+
*/
|
|
662
|
+
doPoll() {
|
|
663
|
+
const t = this.request();
|
|
664
|
+
t.on("data", this.onData.bind(this)), t.on("error", (e, n) => {
|
|
665
|
+
this.onError("xhr poll error", e, n);
|
|
666
|
+
}), this.pollXhr = t;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
let nt = class Ot extends D {
|
|
670
|
+
/**
|
|
671
|
+
* Request constructor
|
|
672
|
+
*
|
|
673
|
+
* @param {Object} options
|
|
674
|
+
* @package
|
|
675
|
+
*/
|
|
676
|
+
constructor(t, e, n) {
|
|
677
|
+
super(), this.createRequest = t, Lt(this, n), this._opts = n, this._method = n.method || "GET", this._uri = e, this._data = n.data !== void 0 ? n.data : null, this._create();
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Creates the XHR object and sends the request.
|
|
681
|
+
*
|
|
682
|
+
* @private
|
|
683
|
+
*/
|
|
684
|
+
_create() {
|
|
685
|
+
var t;
|
|
686
|
+
const e = $e(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
687
|
+
e.xdomain = !!this._opts.xd;
|
|
688
|
+
const n = this._xhr = this.createRequest(e);
|
|
689
|
+
try {
|
|
690
|
+
n.open(this._method, this._uri, !0);
|
|
691
|
+
try {
|
|
692
|
+
if (this._opts.extraHeaders) {
|
|
693
|
+
n.setDisableHeaderCheck && n.setDisableHeaderCheck(!0);
|
|
694
|
+
for (let o in this._opts.extraHeaders)
|
|
695
|
+
this._opts.extraHeaders.hasOwnProperty(o) && n.setRequestHeader(o, this._opts.extraHeaders[o]);
|
|
696
|
+
}
|
|
697
|
+
} catch {
|
|
698
|
+
}
|
|
699
|
+
if (this._method === "POST")
|
|
700
|
+
try {
|
|
701
|
+
n.setRequestHeader("Content-type", "text/plain;charset=UTF-8");
|
|
702
|
+
} catch {
|
|
703
|
+
}
|
|
704
|
+
try {
|
|
705
|
+
n.setRequestHeader("Accept", "*/*");
|
|
706
|
+
} catch {
|
|
707
|
+
}
|
|
708
|
+
(t = this._opts.cookieJar) === null || t === void 0 || t.addCookies(n), "withCredentials" in n && (n.withCredentials = this._opts.withCredentials), this._opts.requestTimeout && (n.timeout = this._opts.requestTimeout), n.onreadystatechange = () => {
|
|
709
|
+
var o;
|
|
710
|
+
n.readyState === 3 && ((o = this._opts.cookieJar) === null || o === void 0 || o.parseCookies(
|
|
711
|
+
// @ts-ignore
|
|
712
|
+
n.getResponseHeader("set-cookie")
|
|
713
|
+
)), n.readyState === 4 && (n.status === 200 || n.status === 1223 ? this._onLoad() : this.setTimeoutFn(() => {
|
|
714
|
+
this._onError(typeof n.status == "number" ? n.status : 0);
|
|
715
|
+
}, 0));
|
|
716
|
+
}, n.send(this._data);
|
|
717
|
+
} catch (o) {
|
|
718
|
+
this.setTimeoutFn(() => {
|
|
719
|
+
this._onError(o);
|
|
720
|
+
}, 0);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
typeof document < "u" && (this._index = Ot.requestsCount++, Ot.requests[this._index] = this);
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Called upon error.
|
|
727
|
+
*
|
|
728
|
+
* @private
|
|
729
|
+
*/
|
|
730
|
+
_onError(t) {
|
|
731
|
+
this.emitReserved("error", t, this._xhr), this._cleanup(!0);
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Cleans up house.
|
|
735
|
+
*
|
|
736
|
+
* @private
|
|
737
|
+
*/
|
|
738
|
+
_cleanup(t) {
|
|
739
|
+
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
740
|
+
if (this._xhr.onreadystatechange = Jr, t)
|
|
741
|
+
try {
|
|
742
|
+
this._xhr.abort();
|
|
743
|
+
} catch {
|
|
744
|
+
}
|
|
745
|
+
typeof document < "u" && delete Ot.requests[this._index], this._xhr = null;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Called upon load.
|
|
750
|
+
*
|
|
751
|
+
* @private
|
|
752
|
+
*/
|
|
753
|
+
_onLoad() {
|
|
754
|
+
const t = this._xhr.responseText;
|
|
755
|
+
t !== null && (this.emitReserved("data", t), this.emitReserved("success"), this._cleanup());
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Aborts the request.
|
|
759
|
+
*
|
|
760
|
+
* @package
|
|
761
|
+
*/
|
|
762
|
+
abort() {
|
|
763
|
+
this._cleanup();
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
nt.requestsCount = 0;
|
|
767
|
+
nt.requests = {};
|
|
768
|
+
if (typeof document < "u") {
|
|
769
|
+
if (typeof attachEvent == "function")
|
|
770
|
+
attachEvent("onunload", ge);
|
|
771
|
+
else if (typeof addEventListener == "function") {
|
|
772
|
+
const r = "onpagehide" in V ? "pagehide" : "unload";
|
|
773
|
+
addEventListener(r, ge, !1);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function ge() {
|
|
777
|
+
for (let r in nt.requests)
|
|
778
|
+
nt.requests.hasOwnProperty(r) && nt.requests[r].abort();
|
|
779
|
+
}
|
|
780
|
+
const $r = (function() {
|
|
781
|
+
const r = tr({
|
|
782
|
+
xdomain: !1
|
|
783
|
+
});
|
|
784
|
+
return r && r.responseType !== null;
|
|
785
|
+
})();
|
|
786
|
+
class Qr extends Xr {
|
|
787
|
+
constructor(t) {
|
|
788
|
+
super(t);
|
|
789
|
+
const e = t && t.forceBase64;
|
|
790
|
+
this.supportsBinary = $r && !e;
|
|
791
|
+
}
|
|
792
|
+
request(t = {}) {
|
|
793
|
+
return Object.assign(t, { xd: this.xd }, this.opts), new nt(tr, this.uri(), t);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
function tr(r) {
|
|
797
|
+
const t = r.xdomain;
|
|
798
|
+
try {
|
|
799
|
+
if (typeof XMLHttpRequest < "u" && (!t || Wr))
|
|
800
|
+
return new XMLHttpRequest();
|
|
801
|
+
} catch {
|
|
802
|
+
}
|
|
803
|
+
if (!t)
|
|
804
|
+
try {
|
|
805
|
+
return new V[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
|
|
806
|
+
} catch {
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const er = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
810
|
+
class Zr extends ne {
|
|
811
|
+
get name() {
|
|
812
|
+
return "websocket";
|
|
813
|
+
}
|
|
814
|
+
doOpen() {
|
|
815
|
+
const t = this.uri(), e = this.opts.protocols, n = er ? {} : $e(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
816
|
+
this.opts.extraHeaders && (n.headers = this.opts.extraHeaders);
|
|
817
|
+
try {
|
|
818
|
+
this.ws = this.createSocket(t, e, n);
|
|
819
|
+
} catch (o) {
|
|
820
|
+
return this.emitReserved("error", o);
|
|
821
|
+
}
|
|
822
|
+
this.ws.binaryType = this.socket.binaryType, this.addEventListeners();
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Adds event listeners to the socket
|
|
826
|
+
*
|
|
827
|
+
* @private
|
|
828
|
+
*/
|
|
829
|
+
addEventListeners() {
|
|
830
|
+
this.ws.onopen = () => {
|
|
831
|
+
this.opts.autoUnref && this.ws._socket.unref(), this.onOpen();
|
|
832
|
+
}, this.ws.onclose = (t) => this.onClose({
|
|
833
|
+
description: "websocket connection closed",
|
|
834
|
+
context: t
|
|
835
|
+
}), this.ws.onmessage = (t) => this.onData(t.data), this.ws.onerror = (t) => this.onError("websocket error", t);
|
|
836
|
+
}
|
|
837
|
+
write(t) {
|
|
838
|
+
this.writable = !1;
|
|
839
|
+
for (let e = 0; e < t.length; e++) {
|
|
840
|
+
const n = t[e], o = e === t.length - 1;
|
|
841
|
+
ee(n, this.supportsBinary, (i) => {
|
|
842
|
+
try {
|
|
843
|
+
this.doWrite(n, i);
|
|
844
|
+
} catch {
|
|
845
|
+
}
|
|
846
|
+
o && Pt(() => {
|
|
847
|
+
this.writable = !0, this.emitReserved("drain");
|
|
848
|
+
}, this.setTimeoutFn);
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
doClose() {
|
|
853
|
+
typeof this.ws < "u" && (this.ws.onerror = () => {
|
|
854
|
+
}, this.ws.close(), this.ws = null);
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Generates uri for connection.
|
|
858
|
+
*
|
|
859
|
+
* @private
|
|
860
|
+
*/
|
|
861
|
+
uri() {
|
|
862
|
+
const t = this.opts.secure ? "wss" : "ws", e = this.query || {};
|
|
863
|
+
return this.opts.timestampRequests && (e[this.opts.timestampParam] = Qe()), this.supportsBinary || (e.b64 = 1), this.createUri(t, e);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const Bt = V.WebSocket || V.MozWebSocket;
|
|
867
|
+
class tn extends Zr {
|
|
868
|
+
createSocket(t, e, n) {
|
|
869
|
+
return er ? new Bt(t, e, n) : e ? new Bt(t, e) : new Bt(t);
|
|
870
|
+
}
|
|
871
|
+
doWrite(t, e) {
|
|
872
|
+
this.ws.send(e);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
class en extends ne {
|
|
876
|
+
get name() {
|
|
877
|
+
return "webtransport";
|
|
878
|
+
}
|
|
879
|
+
doOpen() {
|
|
880
|
+
try {
|
|
881
|
+
this._transport = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]);
|
|
882
|
+
} catch (t) {
|
|
883
|
+
return this.emitReserved("error", t);
|
|
884
|
+
}
|
|
885
|
+
this._transport.closed.then(() => {
|
|
886
|
+
this.onClose();
|
|
887
|
+
}).catch((t) => {
|
|
888
|
+
this.onError("webtransport error", t);
|
|
889
|
+
}), this._transport.ready.then(() => {
|
|
890
|
+
this._transport.createBidirectionalStream().then((t) => {
|
|
891
|
+
const e = Nr(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = t.readable.pipeThrough(e).getReader(), o = Br();
|
|
892
|
+
o.readable.pipeTo(t.writable), this._writer = o.writable.getWriter();
|
|
893
|
+
const i = () => {
|
|
894
|
+
n.read().then(({ done: l, value: f }) => {
|
|
895
|
+
l || (this.onPacket(f), i());
|
|
896
|
+
}).catch((l) => {
|
|
897
|
+
});
|
|
898
|
+
};
|
|
899
|
+
i();
|
|
900
|
+
const u = { type: "open" };
|
|
901
|
+
this.query.sid && (u.data = `{"sid":"${this.query.sid}"}`), this._writer.write(u).then(() => this.onOpen());
|
|
902
|
+
});
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
write(t) {
|
|
906
|
+
this.writable = !1;
|
|
907
|
+
for (let e = 0; e < t.length; e++) {
|
|
908
|
+
const n = t[e], o = e === t.length - 1;
|
|
909
|
+
this._writer.write(n).then(() => {
|
|
910
|
+
o && Pt(() => {
|
|
911
|
+
this.writable = !0, this.emitReserved("drain");
|
|
912
|
+
}, this.setTimeoutFn);
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
doClose() {
|
|
917
|
+
var t;
|
|
918
|
+
(t = this._transport) === null || t === void 0 || t.close();
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
const rn = {
|
|
922
|
+
websocket: tn,
|
|
923
|
+
webtransport: en,
|
|
924
|
+
polling: Qr
|
|
925
|
+
}, nn = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, on = [
|
|
926
|
+
"source",
|
|
927
|
+
"protocol",
|
|
928
|
+
"authority",
|
|
929
|
+
"userInfo",
|
|
930
|
+
"user",
|
|
931
|
+
"password",
|
|
932
|
+
"host",
|
|
933
|
+
"port",
|
|
934
|
+
"relative",
|
|
935
|
+
"path",
|
|
936
|
+
"directory",
|
|
937
|
+
"file",
|
|
938
|
+
"query",
|
|
939
|
+
"anchor"
|
|
940
|
+
];
|
|
941
|
+
function zt(r) {
|
|
942
|
+
if (r.length > 8e3)
|
|
943
|
+
throw "URI too long";
|
|
944
|
+
const t = r, e = r.indexOf("["), n = r.indexOf("]");
|
|
945
|
+
e != -1 && n != -1 && (r = r.substring(0, e) + r.substring(e, n).replace(/:/g, ";") + r.substring(n, r.length));
|
|
946
|
+
let o = nn.exec(r || ""), i = {}, u = 14;
|
|
947
|
+
for (; u--; )
|
|
948
|
+
i[on[u]] = o[u] || "";
|
|
949
|
+
return e != -1 && n != -1 && (i.source = t, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = sn(i, i.path), i.queryKey = an(i, i.query), i;
|
|
950
|
+
}
|
|
951
|
+
function sn(r, t) {
|
|
952
|
+
const e = /\/{2,9}/g, n = t.replace(e, "/").split("/");
|
|
953
|
+
return (t.slice(0, 1) == "/" || t.length === 0) && n.splice(0, 1), t.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
|
|
954
|
+
}
|
|
955
|
+
function an(r, t) {
|
|
956
|
+
const e = {};
|
|
957
|
+
return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(n, o, i) {
|
|
958
|
+
o && (e[o] = i);
|
|
959
|
+
}), e;
|
|
960
|
+
}
|
|
961
|
+
const Mt = typeof addEventListener == "function" && typeof removeEventListener == "function", xt = [];
|
|
962
|
+
Mt && addEventListener("offline", () => {
|
|
963
|
+
xt.forEach((r) => r());
|
|
964
|
+
}, !1);
|
|
965
|
+
class X extends D {
|
|
966
|
+
/**
|
|
967
|
+
* Socket constructor.
|
|
968
|
+
*
|
|
969
|
+
* @param {String|Object} uri - uri or options
|
|
970
|
+
* @param {Object} opts - options
|
|
971
|
+
*/
|
|
972
|
+
constructor(t, e) {
|
|
973
|
+
if (super(), this.binaryType = Dr, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (e = t, t = null), t) {
|
|
974
|
+
const n = zt(t);
|
|
975
|
+
e.hostname = n.host, e.secure = n.protocol === "https" || n.protocol === "wss", e.port = n.port, n.query && (e.query = n.query);
|
|
976
|
+
} else e.host && (e.hostname = zt(e.host).host);
|
|
977
|
+
Lt(this, e), this.secure = e.secure != null ? e.secure : typeof location < "u" && location.protocol === "https:", e.hostname && !e.port && (e.port = this.secure ? "443" : "80"), this.hostname = e.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = e.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, e.transports.forEach((n) => {
|
|
978
|
+
const o = n.prototype.name;
|
|
979
|
+
this.transports.push(o), this._transportsByName[o] = n;
|
|
980
|
+
}), this.opts = Object.assign({
|
|
981
|
+
path: "/engine.io",
|
|
982
|
+
agent: !1,
|
|
983
|
+
withCredentials: !1,
|
|
984
|
+
upgrade: !0,
|
|
985
|
+
timestampParam: "t",
|
|
986
|
+
rememberUpgrade: !1,
|
|
987
|
+
addTrailingSlash: !0,
|
|
988
|
+
rejectUnauthorized: !0,
|
|
989
|
+
perMessageDeflate: {
|
|
990
|
+
threshold: 1024
|
|
991
|
+
},
|
|
992
|
+
transportOptions: {},
|
|
993
|
+
closeOnBeforeunload: !1
|
|
994
|
+
}, e), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Kr(this.opts.query)), Mt && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
995
|
+
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
996
|
+
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
997
|
+
this._onClose("transport close", {
|
|
998
|
+
description: "network connection lost"
|
|
999
|
+
});
|
|
1000
|
+
}, xt.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Creates transport of the given type.
|
|
1004
|
+
*
|
|
1005
|
+
* @param {String} name - transport name
|
|
1006
|
+
* @return {Transport}
|
|
1007
|
+
* @private
|
|
1008
|
+
*/
|
|
1009
|
+
createTransport(t) {
|
|
1010
|
+
const e = Object.assign({}, this.opts.query);
|
|
1011
|
+
e.EIO = Xe, e.transport = t, this.id && (e.sid = this.id);
|
|
1012
|
+
const n = Object.assign({}, this.opts, {
|
|
1013
|
+
query: e,
|
|
1014
|
+
socket: this,
|
|
1015
|
+
hostname: this.hostname,
|
|
1016
|
+
secure: this.secure,
|
|
1017
|
+
port: this.port
|
|
1018
|
+
}, this.opts.transportOptions[t]);
|
|
1019
|
+
return new this._transportsByName[t](n);
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Initializes transport to use and starts probe.
|
|
1023
|
+
*
|
|
1024
|
+
* @private
|
|
1025
|
+
*/
|
|
1026
|
+
_open() {
|
|
1027
|
+
if (this.transports.length === 0) {
|
|
1028
|
+
this.setTimeoutFn(() => {
|
|
1029
|
+
this.emitReserved("error", "No transports available");
|
|
1030
|
+
}, 0);
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
const t = this.opts.rememberUpgrade && X.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
|
|
1034
|
+
this.readyState = "opening";
|
|
1035
|
+
const e = this.createTransport(t);
|
|
1036
|
+
e.open(), this.setTransport(e);
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Sets the current transport. Disables the existing one (if any).
|
|
1040
|
+
*
|
|
1041
|
+
* @private
|
|
1042
|
+
*/
|
|
1043
|
+
setTransport(t) {
|
|
1044
|
+
this.transport && this.transport.removeAllListeners(), this.transport = t, t.on("drain", this._onDrain.bind(this)).on("packet", this._onPacket.bind(this)).on("error", this._onError.bind(this)).on("close", (e) => this._onClose("transport close", e));
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Called when connection is deemed open.
|
|
1048
|
+
*
|
|
1049
|
+
* @private
|
|
1050
|
+
*/
|
|
1051
|
+
onOpen() {
|
|
1052
|
+
this.readyState = "open", X.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Handles a packet.
|
|
1056
|
+
*
|
|
1057
|
+
* @private
|
|
1058
|
+
*/
|
|
1059
|
+
_onPacket(t) {
|
|
1060
|
+
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing")
|
|
1061
|
+
switch (this.emitReserved("packet", t), this.emitReserved("heartbeat"), t.type) {
|
|
1062
|
+
case "open":
|
|
1063
|
+
this.onHandshake(JSON.parse(t.data));
|
|
1064
|
+
break;
|
|
1065
|
+
case "ping":
|
|
1066
|
+
this._sendPacket("pong"), this.emitReserved("ping"), this.emitReserved("pong"), this._resetPingTimeout();
|
|
1067
|
+
break;
|
|
1068
|
+
case "error":
|
|
1069
|
+
const e = new Error("server error");
|
|
1070
|
+
e.code = t.data, this._onError(e);
|
|
1071
|
+
break;
|
|
1072
|
+
case "message":
|
|
1073
|
+
this.emitReserved("data", t.data), this.emitReserved("message", t.data);
|
|
1074
|
+
break;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Called upon handshake completion.
|
|
1079
|
+
*
|
|
1080
|
+
* @param {Object} data - handshake obj
|
|
1081
|
+
* @private
|
|
1082
|
+
*/
|
|
1083
|
+
onHandshake(t) {
|
|
1084
|
+
this.emitReserved("handshake", t), this.id = t.sid, this.transport.query.sid = t.sid, this._pingInterval = t.pingInterval, this._pingTimeout = t.pingTimeout, this._maxPayload = t.maxPayload, this.onOpen(), this.readyState !== "closed" && this._resetPingTimeout();
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Sets and resets ping timeout timer based on server pings.
|
|
1088
|
+
*
|
|
1089
|
+
* @private
|
|
1090
|
+
*/
|
|
1091
|
+
_resetPingTimeout() {
|
|
1092
|
+
this.clearTimeoutFn(this._pingTimeoutTimer);
|
|
1093
|
+
const t = this._pingInterval + this._pingTimeout;
|
|
1094
|
+
this._pingTimeoutTime = Date.now() + t, this._pingTimeoutTimer = this.setTimeoutFn(() => {
|
|
1095
|
+
this._onClose("ping timeout");
|
|
1096
|
+
}, t), this.opts.autoUnref && this._pingTimeoutTimer.unref();
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Called on `drain` event
|
|
1100
|
+
*
|
|
1101
|
+
* @private
|
|
1102
|
+
*/
|
|
1103
|
+
_onDrain() {
|
|
1104
|
+
this.writeBuffer.splice(0, this._prevBufferLen), this._prevBufferLen = 0, this.writeBuffer.length === 0 ? this.emitReserved("drain") : this.flush();
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Flush write buffers.
|
|
1108
|
+
*
|
|
1109
|
+
* @private
|
|
1110
|
+
*/
|
|
1111
|
+
flush() {
|
|
1112
|
+
if (this.readyState !== "closed" && this.transport.writable && !this.upgrading && this.writeBuffer.length) {
|
|
1113
|
+
const t = this._getWritablePackets();
|
|
1114
|
+
this.transport.send(t), this._prevBufferLen = t.length, this.emitReserved("flush");
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Ensure the encoded size of the writeBuffer is below the maxPayload value sent by the server (only for HTTP
|
|
1119
|
+
* long-polling)
|
|
1120
|
+
*
|
|
1121
|
+
* @private
|
|
1122
|
+
*/
|
|
1123
|
+
_getWritablePackets() {
|
|
1124
|
+
if (!(this._maxPayload && this.transport.name === "polling" && this.writeBuffer.length > 1))
|
|
1125
|
+
return this.writeBuffer;
|
|
1126
|
+
let t = 1;
|
|
1127
|
+
for (let e = 0; e < this.writeBuffer.length; e++) {
|
|
1128
|
+
const n = this.writeBuffer[e].data;
|
|
1129
|
+
if (n && (t += zr(n)), e > 0 && t > this._maxPayload)
|
|
1130
|
+
return this.writeBuffer.slice(0, e);
|
|
1131
|
+
t += 2;
|
|
1132
|
+
}
|
|
1133
|
+
return this.writeBuffer;
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Checks whether the heartbeat timer has expired but the socket has not yet been notified.
|
|
1137
|
+
*
|
|
1138
|
+
* Note: this method is private for now because it does not really fit the WebSocket API, but if we put it in the
|
|
1139
|
+
* `write()` method then the message would not be buffered by the Socket.IO client.
|
|
1140
|
+
*
|
|
1141
|
+
* @return {boolean}
|
|
1142
|
+
* @private
|
|
1143
|
+
*/
|
|
1144
|
+
/* private */
|
|
1145
|
+
_hasPingExpired() {
|
|
1146
|
+
if (!this._pingTimeoutTime)
|
|
1147
|
+
return !0;
|
|
1148
|
+
const t = Date.now() > this._pingTimeoutTime;
|
|
1149
|
+
return t && (this._pingTimeoutTime = 0, Pt(() => {
|
|
1150
|
+
this._onClose("ping timeout");
|
|
1151
|
+
}, this.setTimeoutFn)), t;
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Sends a message.
|
|
1155
|
+
*
|
|
1156
|
+
* @param {String} msg - message.
|
|
1157
|
+
* @param {Object} options.
|
|
1158
|
+
* @param {Function} fn - callback function.
|
|
1159
|
+
* @return {Socket} for chaining.
|
|
1160
|
+
*/
|
|
1161
|
+
write(t, e, n) {
|
|
1162
|
+
return this._sendPacket("message", t, e, n), this;
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Sends a message. Alias of {@link Socket#write}.
|
|
1166
|
+
*
|
|
1167
|
+
* @param {String} msg - message.
|
|
1168
|
+
* @param {Object} options.
|
|
1169
|
+
* @param {Function} fn - callback function.
|
|
1170
|
+
* @return {Socket} for chaining.
|
|
1171
|
+
*/
|
|
1172
|
+
send(t, e, n) {
|
|
1173
|
+
return this._sendPacket("message", t, e, n), this;
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Sends a packet.
|
|
1177
|
+
*
|
|
1178
|
+
* @param {String} type: packet type.
|
|
1179
|
+
* @param {String} data.
|
|
1180
|
+
* @param {Object} options.
|
|
1181
|
+
* @param {Function} fn - callback function.
|
|
1182
|
+
* @private
|
|
1183
|
+
*/
|
|
1184
|
+
_sendPacket(t, e, n, o) {
|
|
1185
|
+
if (typeof e == "function" && (o = e, e = void 0), typeof n == "function" && (o = n, n = null), this.readyState === "closing" || this.readyState === "closed")
|
|
1186
|
+
return;
|
|
1187
|
+
n = n || {}, n.compress = n.compress !== !1;
|
|
1188
|
+
const i = {
|
|
1189
|
+
type: t,
|
|
1190
|
+
data: e,
|
|
1191
|
+
options: n
|
|
1192
|
+
};
|
|
1193
|
+
this.emitReserved("packetCreate", i), this.writeBuffer.push(i), o && this.once("flush", o), this.flush();
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Closes the connection.
|
|
1197
|
+
*/
|
|
1198
|
+
close() {
|
|
1199
|
+
const t = () => {
|
|
1200
|
+
this._onClose("forced close"), this.transport.close();
|
|
1201
|
+
}, e = () => {
|
|
1202
|
+
this.off("upgrade", e), this.off("upgradeError", e), t();
|
|
1203
|
+
}, n = () => {
|
|
1204
|
+
this.once("upgrade", e), this.once("upgradeError", e);
|
|
1205
|
+
};
|
|
1206
|
+
return (this.readyState === "opening" || this.readyState === "open") && (this.readyState = "closing", this.writeBuffer.length ? this.once("drain", () => {
|
|
1207
|
+
this.upgrading ? n() : t();
|
|
1208
|
+
}) : this.upgrading ? n() : t()), this;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Called upon transport error
|
|
1212
|
+
*
|
|
1213
|
+
* @private
|
|
1214
|
+
*/
|
|
1215
|
+
_onError(t) {
|
|
1216
|
+
if (X.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
|
|
1217
|
+
return this.transports.shift(), this._open();
|
|
1218
|
+
this.emitReserved("error", t), this._onClose("transport error", t);
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Called upon transport close.
|
|
1222
|
+
*
|
|
1223
|
+
* @private
|
|
1224
|
+
*/
|
|
1225
|
+
_onClose(t, e) {
|
|
1226
|
+
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
1227
|
+
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), Mt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
1228
|
+
const n = xt.indexOf(this._offlineEventListener);
|
|
1229
|
+
n !== -1 && xt.splice(n, 1);
|
|
1230
|
+
}
|
|
1231
|
+
this.readyState = "closed", this.id = null, this.emitReserved("close", t, e), this.writeBuffer = [], this._prevBufferLen = 0;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
X.protocol = Xe;
|
|
1236
|
+
class un extends X {
|
|
1237
|
+
constructor() {
|
|
1238
|
+
super(...arguments), this._upgrades = [];
|
|
1239
|
+
}
|
|
1240
|
+
onOpen() {
|
|
1241
|
+
if (super.onOpen(), this.readyState === "open" && this.opts.upgrade)
|
|
1242
|
+
for (let t = 0; t < this._upgrades.length; t++)
|
|
1243
|
+
this._probe(this._upgrades[t]);
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Probes a transport.
|
|
1247
|
+
*
|
|
1248
|
+
* @param {String} name - transport name
|
|
1249
|
+
* @private
|
|
1250
|
+
*/
|
|
1251
|
+
_probe(t) {
|
|
1252
|
+
let e = this.createTransport(t), n = !1;
|
|
1253
|
+
X.priorWebsocketSuccess = !1;
|
|
1254
|
+
const o = () => {
|
|
1255
|
+
n || (e.send([{ type: "ping", data: "probe" }]), e.once("packet", (L) => {
|
|
1256
|
+
if (!n)
|
|
1257
|
+
if (L.type === "pong" && L.data === "probe") {
|
|
1258
|
+
if (this.upgrading = !0, this.emitReserved("upgrading", e), !e)
|
|
1259
|
+
return;
|
|
1260
|
+
X.priorWebsocketSuccess = e.name === "websocket", this.transport.pause(() => {
|
|
1261
|
+
n || this.readyState !== "closed" && (_(), this.setTransport(e), e.send([{ type: "upgrade" }]), this.emitReserved("upgrade", e), e = null, this.upgrading = !1, this.flush());
|
|
1262
|
+
});
|
|
1263
|
+
} else {
|
|
1264
|
+
const B = new Error("probe error");
|
|
1265
|
+
B.transport = e.name, this.emitReserved("upgradeError", B);
|
|
1266
|
+
}
|
|
1267
|
+
}));
|
|
1268
|
+
};
|
|
1269
|
+
function i() {
|
|
1270
|
+
n || (n = !0, _(), e.close(), e = null);
|
|
1271
|
+
}
|
|
1272
|
+
const u = (L) => {
|
|
1273
|
+
const B = new Error("probe error: " + L);
|
|
1274
|
+
B.transport = e.name, i(), this.emitReserved("upgradeError", B);
|
|
1275
|
+
};
|
|
1276
|
+
function l() {
|
|
1277
|
+
u("transport closed");
|
|
1278
|
+
}
|
|
1279
|
+
function f() {
|
|
1280
|
+
u("socket closed");
|
|
1281
|
+
}
|
|
1282
|
+
function d(L) {
|
|
1283
|
+
e && L.name !== e.name && i();
|
|
1284
|
+
}
|
|
1285
|
+
const _ = () => {
|
|
1286
|
+
e.removeListener("open", o), e.removeListener("error", u), e.removeListener("close", l), this.off("close", f), this.off("upgrading", d);
|
|
1287
|
+
};
|
|
1288
|
+
e.once("open", o), e.once("error", u), e.once("close", l), this.once("close", f), this.once("upgrading", d), this._upgrades.indexOf("webtransport") !== -1 && t !== "webtransport" ? this.setTimeoutFn(() => {
|
|
1289
|
+
n || e.open();
|
|
1290
|
+
}, 200) : e.open();
|
|
1291
|
+
}
|
|
1292
|
+
onHandshake(t) {
|
|
1293
|
+
this._upgrades = this._filterUpgrades(t.upgrades), super.onHandshake(t);
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Filters upgrades, returning only those matching client transports.
|
|
1297
|
+
*
|
|
1298
|
+
* @param {Array} upgrades - server upgrades
|
|
1299
|
+
* @private
|
|
1300
|
+
*/
|
|
1301
|
+
_filterUpgrades(t) {
|
|
1302
|
+
const e = [];
|
|
1303
|
+
for (let n = 0; n < t.length; n++)
|
|
1304
|
+
~this.transports.indexOf(t[n]) && e.push(t[n]);
|
|
1305
|
+
return e;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
let cn = class extends un {
|
|
1309
|
+
constructor(r, t = {}) {
|
|
1310
|
+
const e = typeof r == "object" ? r : t;
|
|
1311
|
+
(!e.transports || e.transports && typeof e.transports[0] == "string") && (e.transports = (e.transports || ["polling", "websocket", "webtransport"]).map((n) => rn[n]).filter((n) => !!n)), super(r, e);
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
function ln(r, t = "", e) {
|
|
1315
|
+
let n = r;
|
|
1316
|
+
e = e || typeof location < "u" && location, r == null && (r = e.protocol + "//" + e.host), typeof r == "string" && (r.charAt(0) === "/" && (r.charAt(1) === "/" ? r = e.protocol + r : r = e.host + r), /^(https?|wss?):\/\//.test(r) || (typeof e < "u" ? r = e.protocol + "//" + r : r = "https://" + r), n = zt(r)), n.port || (/^(http|ws)$/.test(n.protocol) ? n.port = "80" : /^(http|ws)s$/.test(n.protocol) && (n.port = "443")), n.path = n.path || "/";
|
|
1317
|
+
const o = n.host.indexOf(":") !== -1 ? "[" + n.host + "]" : n.host;
|
|
1318
|
+
return n.id = n.protocol + "://" + o + ":" + n.port + t, n.href = n.protocol + "://" + o + (e && e.port === n.port ? "" : ":" + n.port), n;
|
|
1319
|
+
}
|
|
1320
|
+
const hn = typeof ArrayBuffer == "function", pn = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r.buffer instanceof ArrayBuffer, rr = Object.prototype.toString, fn = typeof Blob == "function" || typeof Blob < "u" && rr.call(Blob) === "[object BlobConstructor]", dn = typeof File == "function" || typeof File < "u" && rr.call(File) === "[object FileConstructor]";
|
|
1321
|
+
function oe(r) {
|
|
1322
|
+
return hn && (r instanceof ArrayBuffer || pn(r)) || fn && r instanceof Blob || dn && r instanceof File;
|
|
1323
|
+
}
|
|
1324
|
+
function Ut(r, t) {
|
|
1325
|
+
if (!r || typeof r != "object")
|
|
1326
|
+
return !1;
|
|
1327
|
+
if (Array.isArray(r)) {
|
|
1328
|
+
for (let e = 0, n = r.length; e < n; e++)
|
|
1329
|
+
if (Ut(r[e]))
|
|
1330
|
+
return !0;
|
|
1331
|
+
return !1;
|
|
1332
|
+
}
|
|
1333
|
+
if (oe(r))
|
|
1334
|
+
return !0;
|
|
1335
|
+
if (r.toJSON && typeof r.toJSON == "function" && arguments.length === 1)
|
|
1336
|
+
return Ut(r.toJSON(), !0);
|
|
1337
|
+
for (const e in r)
|
|
1338
|
+
if (Object.prototype.hasOwnProperty.call(r, e) && Ut(r[e]))
|
|
1339
|
+
return !0;
|
|
1340
|
+
return !1;
|
|
1341
|
+
}
|
|
1342
|
+
function yn(r) {
|
|
1343
|
+
const t = [], e = r.data, n = r;
|
|
1344
|
+
return n.data = Vt(e, t), n.attachments = t.length, { packet: n, buffers: t };
|
|
1345
|
+
}
|
|
1346
|
+
function Vt(r, t) {
|
|
1347
|
+
if (!r)
|
|
1348
|
+
return r;
|
|
1349
|
+
if (oe(r)) {
|
|
1350
|
+
const e = { _placeholder: !0, num: t.length };
|
|
1351
|
+
return t.push(r), e;
|
|
1352
|
+
} else if (Array.isArray(r)) {
|
|
1353
|
+
const e = new Array(r.length);
|
|
1354
|
+
for (let n = 0; n < r.length; n++)
|
|
1355
|
+
e[n] = Vt(r[n], t);
|
|
1356
|
+
return e;
|
|
1357
|
+
} else if (typeof r == "object" && !(r instanceof Date)) {
|
|
1358
|
+
const e = {};
|
|
1359
|
+
for (const n in r)
|
|
1360
|
+
Object.prototype.hasOwnProperty.call(r, n) && (e[n] = Vt(r[n], t));
|
|
1361
|
+
return e;
|
|
1362
|
+
}
|
|
1363
|
+
return r;
|
|
1364
|
+
}
|
|
1365
|
+
function gn(r, t) {
|
|
1366
|
+
return r.data = Kt(r.data, t), delete r.attachments, r;
|
|
1367
|
+
}
|
|
1368
|
+
function Kt(r, t) {
|
|
1369
|
+
if (!r)
|
|
1370
|
+
return r;
|
|
1371
|
+
if (r && r._placeholder === !0) {
|
|
1372
|
+
if (typeof r.num == "number" && r.num >= 0 && r.num < t.length)
|
|
1373
|
+
return t[r.num];
|
|
1374
|
+
throw new Error("illegal attachments");
|
|
1375
|
+
} else if (Array.isArray(r))
|
|
1376
|
+
for (let e = 0; e < r.length; e++)
|
|
1377
|
+
r[e] = Kt(r[e], t);
|
|
1378
|
+
else if (typeof r == "object")
|
|
1379
|
+
for (const e in r)
|
|
1380
|
+
Object.prototype.hasOwnProperty.call(r, e) && (r[e] = Kt(r[e], t));
|
|
1381
|
+
return r;
|
|
1382
|
+
}
|
|
1383
|
+
const mn = [
|
|
1384
|
+
"connect",
|
|
1385
|
+
"connect_error",
|
|
1386
|
+
"disconnect",
|
|
1387
|
+
"disconnecting",
|
|
1388
|
+
"newListener",
|
|
1389
|
+
"removeListener"
|
|
1390
|
+
// used by the Node.js EventEmitter
|
|
1391
|
+
], vn = 5;
|
|
1392
|
+
var T;
|
|
1393
|
+
(function(r) {
|
|
1394
|
+
r[r.CONNECT = 0] = "CONNECT", r[r.DISCONNECT = 1] = "DISCONNECT", r[r.EVENT = 2] = "EVENT", r[r.ACK = 3] = "ACK", r[r.CONNECT_ERROR = 4] = "CONNECT_ERROR", r[r.BINARY_EVENT = 5] = "BINARY_EVENT", r[r.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1395
|
+
})(T || (T = {}));
|
|
1396
|
+
class bn {
|
|
1397
|
+
/**
|
|
1398
|
+
* Encoder constructor
|
|
1399
|
+
*
|
|
1400
|
+
* @param {function} replacer - custom replacer to pass down to JSON.parse
|
|
1401
|
+
*/
|
|
1402
|
+
constructor(t) {
|
|
1403
|
+
this.replacer = t;
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* Encode a packet as a single string if non-binary, or as a
|
|
1407
|
+
* buffer sequence, depending on packet type.
|
|
1408
|
+
*
|
|
1409
|
+
* @param {Object} obj - packet object
|
|
1410
|
+
*/
|
|
1411
|
+
encode(t) {
|
|
1412
|
+
return (t.type === T.EVENT || t.type === T.ACK) && Ut(t) ? this.encodeAsBinary({
|
|
1413
|
+
type: t.type === T.EVENT ? T.BINARY_EVENT : T.BINARY_ACK,
|
|
1414
|
+
nsp: t.nsp,
|
|
1415
|
+
data: t.data,
|
|
1416
|
+
id: t.id
|
|
1417
|
+
}) : [this.encodeAsString(t)];
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Encode packet as string.
|
|
1421
|
+
*/
|
|
1422
|
+
encodeAsString(t) {
|
|
1423
|
+
let e = "" + t.type;
|
|
1424
|
+
return (t.type === T.BINARY_EVENT || t.type === T.BINARY_ACK) && (e += t.attachments + "-"), t.nsp && t.nsp !== "/" && (e += t.nsp + ","), t.id != null && (e += t.id), t.data != null && (e += JSON.stringify(t.data, this.replacer)), e;
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Encode packet as 'buffer sequence' by removing blobs, and
|
|
1428
|
+
* deconstructing packet into object with placeholders and
|
|
1429
|
+
* a list of buffers.
|
|
1430
|
+
*/
|
|
1431
|
+
encodeAsBinary(t) {
|
|
1432
|
+
const e = yn(t), n = this.encodeAsString(e.packet), o = e.buffers;
|
|
1433
|
+
return o.unshift(n), o;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
function me(r) {
|
|
1437
|
+
return Object.prototype.toString.call(r) === "[object Object]";
|
|
1438
|
+
}
|
|
1439
|
+
class ie extends D {
|
|
1440
|
+
/**
|
|
1441
|
+
* Decoder constructor
|
|
1442
|
+
*
|
|
1443
|
+
* @param {function} reviver - custom reviver to pass down to JSON.stringify
|
|
1444
|
+
*/
|
|
1445
|
+
constructor(t) {
|
|
1446
|
+
super(), this.reviver = t;
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Decodes an encoded packet string into packet JSON.
|
|
1450
|
+
*
|
|
1451
|
+
* @param {String} obj - encoded packet
|
|
1452
|
+
*/
|
|
1453
|
+
add(t) {
|
|
1454
|
+
let e;
|
|
1455
|
+
if (typeof t == "string") {
|
|
1456
|
+
if (this.reconstructor)
|
|
1457
|
+
throw new Error("got plaintext data when reconstructing a packet");
|
|
1458
|
+
e = this.decodeString(t);
|
|
1459
|
+
const n = e.type === T.BINARY_EVENT;
|
|
1460
|
+
n || e.type === T.BINARY_ACK ? (e.type = n ? T.EVENT : T.ACK, this.reconstructor = new _n(e), e.attachments === 0 && super.emitReserved("decoded", e)) : super.emitReserved("decoded", e);
|
|
1461
|
+
} else if (oe(t) || t.base64)
|
|
1462
|
+
if (this.reconstructor)
|
|
1463
|
+
e = this.reconstructor.takeBinaryData(t), e && (this.reconstructor = null, super.emitReserved("decoded", e));
|
|
1464
|
+
else
|
|
1465
|
+
throw new Error("got binary data when not reconstructing a packet");
|
|
1466
|
+
else
|
|
1467
|
+
throw new Error("Unknown type: " + t);
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Decode a packet String (JSON data)
|
|
1471
|
+
*
|
|
1472
|
+
* @param {String} str
|
|
1473
|
+
* @return {Object} packet
|
|
1474
|
+
*/
|
|
1475
|
+
decodeString(t) {
|
|
1476
|
+
let e = 0;
|
|
1477
|
+
const n = {
|
|
1478
|
+
type: Number(t.charAt(0))
|
|
1479
|
+
};
|
|
1480
|
+
if (T[n.type] === void 0)
|
|
1481
|
+
throw new Error("unknown packet type " + n.type);
|
|
1482
|
+
if (n.type === T.BINARY_EVENT || n.type === T.BINARY_ACK) {
|
|
1483
|
+
const i = e + 1;
|
|
1484
|
+
for (; t.charAt(++e) !== "-" && e != t.length; )
|
|
1485
|
+
;
|
|
1486
|
+
const u = t.substring(i, e);
|
|
1487
|
+
if (u != Number(u) || t.charAt(e) !== "-")
|
|
1488
|
+
throw new Error("Illegal attachments");
|
|
1489
|
+
n.attachments = Number(u);
|
|
1490
|
+
}
|
|
1491
|
+
if (t.charAt(e + 1) === "/") {
|
|
1492
|
+
const i = e + 1;
|
|
1493
|
+
for (; ++e && !(t.charAt(e) === "," || e === t.length); )
|
|
1494
|
+
;
|
|
1495
|
+
n.nsp = t.substring(i, e);
|
|
1496
|
+
} else
|
|
1497
|
+
n.nsp = "/";
|
|
1498
|
+
const o = t.charAt(e + 1);
|
|
1499
|
+
if (o !== "" && Number(o) == o) {
|
|
1500
|
+
const i = e + 1;
|
|
1501
|
+
for (; ++e; ) {
|
|
1502
|
+
const u = t.charAt(e);
|
|
1503
|
+
if (u == null || Number(u) != u) {
|
|
1504
|
+
--e;
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
if (e === t.length)
|
|
1508
|
+
break;
|
|
1509
|
+
}
|
|
1510
|
+
n.id = Number(t.substring(i, e + 1));
|
|
1511
|
+
}
|
|
1512
|
+
if (t.charAt(++e)) {
|
|
1513
|
+
const i = this.tryParse(t.substr(e));
|
|
1514
|
+
if (ie.isPayloadValid(n.type, i))
|
|
1515
|
+
n.data = i;
|
|
1516
|
+
else
|
|
1517
|
+
throw new Error("invalid payload");
|
|
1518
|
+
}
|
|
1519
|
+
return n;
|
|
1520
|
+
}
|
|
1521
|
+
tryParse(t) {
|
|
1522
|
+
try {
|
|
1523
|
+
return JSON.parse(t, this.reviver);
|
|
1524
|
+
} catch {
|
|
1525
|
+
return !1;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
static isPayloadValid(t, e) {
|
|
1529
|
+
switch (t) {
|
|
1530
|
+
case T.CONNECT:
|
|
1531
|
+
return me(e);
|
|
1532
|
+
case T.DISCONNECT:
|
|
1533
|
+
return e === void 0;
|
|
1534
|
+
case T.CONNECT_ERROR:
|
|
1535
|
+
return typeof e == "string" || me(e);
|
|
1536
|
+
case T.EVENT:
|
|
1537
|
+
case T.BINARY_EVENT:
|
|
1538
|
+
return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" && mn.indexOf(e[0]) === -1);
|
|
1539
|
+
case T.ACK:
|
|
1540
|
+
case T.BINARY_ACK:
|
|
1541
|
+
return Array.isArray(e);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Deallocates a parser's resources
|
|
1546
|
+
*/
|
|
1547
|
+
destroy() {
|
|
1548
|
+
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
class _n {
|
|
1552
|
+
constructor(t) {
|
|
1553
|
+
this.packet = t, this.buffers = [], this.reconPack = t;
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Method to be called when binary data received from connection
|
|
1557
|
+
* after a BINARY_EVENT packet.
|
|
1558
|
+
*
|
|
1559
|
+
* @param {Buffer | ArrayBuffer} binData - the raw binary data received
|
|
1560
|
+
* @return {null | Object} returns null if more binary data is expected or
|
|
1561
|
+
* a reconstructed packet object if all buffers have been received.
|
|
1562
|
+
*/
|
|
1563
|
+
takeBinaryData(t) {
|
|
1564
|
+
if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) {
|
|
1565
|
+
const e = gn(this.reconPack, this.buffers);
|
|
1566
|
+
return this.finishedReconstruction(), e;
|
|
1567
|
+
}
|
|
1568
|
+
return null;
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Cleans up binary packet reconstruction variables.
|
|
1572
|
+
*/
|
|
1573
|
+
finishedReconstruction() {
|
|
1574
|
+
this.reconPack = null, this.buffers = [];
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
const wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1578
|
+
__proto__: null,
|
|
1579
|
+
Decoder: ie,
|
|
1580
|
+
Encoder: bn,
|
|
1581
|
+
get PacketType() {
|
|
1582
|
+
return T;
|
|
1583
|
+
},
|
|
1584
|
+
protocol: vn
|
|
1585
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1586
|
+
function W(r, t, e) {
|
|
1587
|
+
return r.on(t, e), function() {
|
|
1588
|
+
r.off(t, e);
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
const En = Object.freeze({
|
|
1592
|
+
connect: 1,
|
|
1593
|
+
connect_error: 1,
|
|
1594
|
+
disconnect: 1,
|
|
1595
|
+
disconnecting: 1,
|
|
1596
|
+
// EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener
|
|
1597
|
+
newListener: 1,
|
|
1598
|
+
removeListener: 1
|
|
1599
|
+
});
|
|
1600
|
+
class nr extends D {
|
|
1601
|
+
/**
|
|
1602
|
+
* `Socket` constructor.
|
|
1603
|
+
*/
|
|
1604
|
+
constructor(t, e, n) {
|
|
1605
|
+
super(), this.connected = !1, this.recovered = !1, this.receiveBuffer = [], this.sendBuffer = [], this._queue = [], this._queueSeq = 0, this.ids = 0, this.acks = {}, this.flags = {}, this.io = t, this.nsp = e, n && n.auth && (this.auth = n.auth), this._opts = Object.assign({}, n), this.io._autoConnect && this.open();
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Whether the socket is currently disconnected
|
|
1609
|
+
*
|
|
1610
|
+
* @example
|
|
1611
|
+
* const socket = io();
|
|
1612
|
+
*
|
|
1613
|
+
* socket.on("connect", () => {
|
|
1614
|
+
* console.log(socket.disconnected); // false
|
|
1615
|
+
* });
|
|
1616
|
+
*
|
|
1617
|
+
* socket.on("disconnect", () => {
|
|
1618
|
+
* console.log(socket.disconnected); // true
|
|
1619
|
+
* });
|
|
1620
|
+
*/
|
|
1621
|
+
get disconnected() {
|
|
1622
|
+
return !this.connected;
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Subscribe to open, close and packet events
|
|
1626
|
+
*
|
|
1627
|
+
* @private
|
|
1628
|
+
*/
|
|
1629
|
+
subEvents() {
|
|
1630
|
+
if (this.subs)
|
|
1631
|
+
return;
|
|
1632
|
+
const t = this.io;
|
|
1633
|
+
this.subs = [
|
|
1634
|
+
W(t, "open", this.onopen.bind(this)),
|
|
1635
|
+
W(t, "packet", this.onpacket.bind(this)),
|
|
1636
|
+
W(t, "error", this.onerror.bind(this)),
|
|
1637
|
+
W(t, "close", this.onclose.bind(this))
|
|
1638
|
+
];
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Whether the Socket will try to reconnect when its Manager connects or reconnects.
|
|
1642
|
+
*
|
|
1643
|
+
* @example
|
|
1644
|
+
* const socket = io();
|
|
1645
|
+
*
|
|
1646
|
+
* console.log(socket.active); // true
|
|
1647
|
+
*
|
|
1648
|
+
* socket.on("disconnect", (reason) => {
|
|
1649
|
+
* if (reason === "io server disconnect") {
|
|
1650
|
+
* // the disconnection was initiated by the server, you need to manually reconnect
|
|
1651
|
+
* console.log(socket.active); // false
|
|
1652
|
+
* }
|
|
1653
|
+
* // else the socket will automatically try to reconnect
|
|
1654
|
+
* console.log(socket.active); // true
|
|
1655
|
+
* });
|
|
1656
|
+
*/
|
|
1657
|
+
get active() {
|
|
1658
|
+
return !!this.subs;
|
|
1659
|
+
}
|
|
1660
|
+
/**
|
|
1661
|
+
* "Opens" the socket.
|
|
1662
|
+
*
|
|
1663
|
+
* @example
|
|
1664
|
+
* const socket = io({
|
|
1665
|
+
* autoConnect: false
|
|
1666
|
+
* });
|
|
1667
|
+
*
|
|
1668
|
+
* socket.connect();
|
|
1669
|
+
*/
|
|
1670
|
+
connect() {
|
|
1671
|
+
return this.connected ? this : (this.subEvents(), this.io._reconnecting || this.io.open(), this.io._readyState === "open" && this.onopen(), this);
|
|
1672
|
+
}
|
|
1673
|
+
/**
|
|
1674
|
+
* Alias for {@link connect()}.
|
|
1675
|
+
*/
|
|
1676
|
+
open() {
|
|
1677
|
+
return this.connect();
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* Sends a `message` event.
|
|
1681
|
+
*
|
|
1682
|
+
* This method mimics the WebSocket.send() method.
|
|
1683
|
+
*
|
|
1684
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
|
|
1685
|
+
*
|
|
1686
|
+
* @example
|
|
1687
|
+
* socket.send("hello");
|
|
1688
|
+
*
|
|
1689
|
+
* // this is equivalent to
|
|
1690
|
+
* socket.emit("message", "hello");
|
|
1691
|
+
*
|
|
1692
|
+
* @return self
|
|
1693
|
+
*/
|
|
1694
|
+
send(...t) {
|
|
1695
|
+
return t.unshift("message"), this.emit.apply(this, t), this;
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Override `emit`.
|
|
1699
|
+
* If the event is in `events`, it's emitted normally.
|
|
1700
|
+
*
|
|
1701
|
+
* @example
|
|
1702
|
+
* socket.emit("hello", "world");
|
|
1703
|
+
*
|
|
1704
|
+
* // all serializable datastructures are supported (no need to call JSON.stringify)
|
|
1705
|
+
* socket.emit("hello", 1, "2", { 3: ["4"], 5: Uint8Array.from([6]) });
|
|
1706
|
+
*
|
|
1707
|
+
* // with an acknowledgement from the server
|
|
1708
|
+
* socket.emit("hello", "world", (val) => {
|
|
1709
|
+
* // ...
|
|
1710
|
+
* });
|
|
1711
|
+
*
|
|
1712
|
+
* @return self
|
|
1713
|
+
*/
|
|
1714
|
+
emit(t, ...e) {
|
|
1715
|
+
var n, o, i;
|
|
1716
|
+
if (En.hasOwnProperty(t))
|
|
1717
|
+
throw new Error('"' + t.toString() + '" is a reserved event name');
|
|
1718
|
+
if (e.unshift(t), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1719
|
+
return this._addToQueue(e), this;
|
|
1720
|
+
const u = {
|
|
1721
|
+
type: T.EVENT,
|
|
1722
|
+
data: e
|
|
1723
|
+
};
|
|
1724
|
+
if (u.options = {}, u.options.compress = this.flags.compress !== !1, typeof e[e.length - 1] == "function") {
|
|
1725
|
+
const d = this.ids++, _ = e.pop();
|
|
1726
|
+
this._registerAckCallback(d, _), u.id = d;
|
|
1727
|
+
}
|
|
1728
|
+
const l = (o = (n = this.io.engine) === null || n === void 0 ? void 0 : n.transport) === null || o === void 0 ? void 0 : o.writable, f = this.connected && !(!((i = this.io.engine) === null || i === void 0) && i._hasPingExpired());
|
|
1729
|
+
return this.flags.volatile && !l || (f ? (this.notifyOutgoingListeners(u), this.packet(u)) : this.sendBuffer.push(u)), this.flags = {}, this;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* @private
|
|
1733
|
+
*/
|
|
1734
|
+
_registerAckCallback(t, e) {
|
|
1735
|
+
var n;
|
|
1736
|
+
const o = (n = this.flags.timeout) !== null && n !== void 0 ? n : this._opts.ackTimeout;
|
|
1737
|
+
if (o === void 0) {
|
|
1738
|
+
this.acks[t] = e;
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
const i = this.io.setTimeoutFn(() => {
|
|
1742
|
+
delete this.acks[t];
|
|
1743
|
+
for (let l = 0; l < this.sendBuffer.length; l++)
|
|
1744
|
+
this.sendBuffer[l].id === t && this.sendBuffer.splice(l, 1);
|
|
1745
|
+
e.call(this, new Error("operation has timed out"));
|
|
1746
|
+
}, o), u = (...l) => {
|
|
1747
|
+
this.io.clearTimeoutFn(i), e.apply(this, l);
|
|
1748
|
+
};
|
|
1749
|
+
u.withError = !0, this.acks[t] = u;
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Emits an event and waits for an acknowledgement
|
|
1753
|
+
*
|
|
1754
|
+
* @example
|
|
1755
|
+
* // without timeout
|
|
1756
|
+
* const response = await socket.emitWithAck("hello", "world");
|
|
1757
|
+
*
|
|
1758
|
+
* // with a specific timeout
|
|
1759
|
+
* try {
|
|
1760
|
+
* const response = await socket.timeout(1000).emitWithAck("hello", "world");
|
|
1761
|
+
* } catch (err) {
|
|
1762
|
+
* // the server did not acknowledge the event in the given delay
|
|
1763
|
+
* }
|
|
1764
|
+
*
|
|
1765
|
+
* @return a Promise that will be fulfilled when the server acknowledges the event
|
|
1766
|
+
*/
|
|
1767
|
+
emitWithAck(t, ...e) {
|
|
1768
|
+
return new Promise((n, o) => {
|
|
1769
|
+
const i = (u, l) => u ? o(u) : n(l);
|
|
1770
|
+
i.withError = !0, e.push(i), this.emit(t, ...e);
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Add the packet to the queue.
|
|
1775
|
+
* @param args
|
|
1776
|
+
* @private
|
|
1777
|
+
*/
|
|
1778
|
+
_addToQueue(t) {
|
|
1779
|
+
let e;
|
|
1780
|
+
typeof t[t.length - 1] == "function" && (e = t.pop());
|
|
1781
|
+
const n = {
|
|
1782
|
+
id: this._queueSeq++,
|
|
1783
|
+
tryCount: 0,
|
|
1784
|
+
pending: !1,
|
|
1785
|
+
args: t,
|
|
1786
|
+
flags: Object.assign({ fromQueue: !0 }, this.flags)
|
|
1787
|
+
};
|
|
1788
|
+
t.push((o, ...i) => n !== this._queue[0] ? void 0 : (o !== null ? n.tryCount > this._opts.retries && (this._queue.shift(), e && e(o)) : (this._queue.shift(), e && e(null, ...i)), n.pending = !1, this._drainQueue())), this._queue.push(n), this._drainQueue();
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Send the first packet of the queue, and wait for an acknowledgement from the server.
|
|
1792
|
+
* @param force - whether to resend a packet that has not been acknowledged yet
|
|
1793
|
+
*
|
|
1794
|
+
* @private
|
|
1795
|
+
*/
|
|
1796
|
+
_drainQueue(t = !1) {
|
|
1797
|
+
if (!this.connected || this._queue.length === 0)
|
|
1798
|
+
return;
|
|
1799
|
+
const e = this._queue[0];
|
|
1800
|
+
e.pending && !t || (e.pending = !0, e.tryCount++, this.flags = e.flags, this.emit.apply(this, e.args));
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Sends a packet.
|
|
1804
|
+
*
|
|
1805
|
+
* @param packet
|
|
1806
|
+
* @private
|
|
1807
|
+
*/
|
|
1808
|
+
packet(t) {
|
|
1809
|
+
t.nsp = this.nsp, this.io._packet(t);
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* Called upon engine `open`.
|
|
1813
|
+
*
|
|
1814
|
+
* @private
|
|
1815
|
+
*/
|
|
1816
|
+
onopen() {
|
|
1817
|
+
typeof this.auth == "function" ? this.auth((t) => {
|
|
1818
|
+
this._sendConnectPacket(t);
|
|
1819
|
+
}) : this._sendConnectPacket(this.auth);
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Sends a CONNECT packet to initiate the Socket.IO session.
|
|
1823
|
+
*
|
|
1824
|
+
* @param data
|
|
1825
|
+
* @private
|
|
1826
|
+
*/
|
|
1827
|
+
_sendConnectPacket(t) {
|
|
1828
|
+
this.packet({
|
|
1829
|
+
type: T.CONNECT,
|
|
1830
|
+
data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, t) : t
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Called upon engine or manager `error`.
|
|
1835
|
+
*
|
|
1836
|
+
* @param err
|
|
1837
|
+
* @private
|
|
1838
|
+
*/
|
|
1839
|
+
onerror(t) {
|
|
1840
|
+
this.connected || this.emitReserved("connect_error", t);
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Called upon engine `close`.
|
|
1844
|
+
*
|
|
1845
|
+
* @param reason
|
|
1846
|
+
* @param description
|
|
1847
|
+
* @private
|
|
1848
|
+
*/
|
|
1849
|
+
onclose(t, e) {
|
|
1850
|
+
this.connected = !1, delete this.id, this.emitReserved("disconnect", t, e), this._clearAcks();
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Clears the acknowledgement handlers upon disconnection, since the client will never receive an acknowledgement from
|
|
1854
|
+
* the server.
|
|
1855
|
+
*
|
|
1856
|
+
* @private
|
|
1857
|
+
*/
|
|
1858
|
+
_clearAcks() {
|
|
1859
|
+
Object.keys(this.acks).forEach((t) => {
|
|
1860
|
+
if (!this.sendBuffer.some((e) => String(e.id) === t)) {
|
|
1861
|
+
const e = this.acks[t];
|
|
1862
|
+
delete this.acks[t], e.withError && e.call(this, new Error("socket has been disconnected"));
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Called with socket packet.
|
|
1868
|
+
*
|
|
1869
|
+
* @param packet
|
|
1870
|
+
* @private
|
|
1871
|
+
*/
|
|
1872
|
+
onpacket(t) {
|
|
1873
|
+
if (t.nsp === this.nsp)
|
|
1874
|
+
switch (t.type) {
|
|
1875
|
+
case T.CONNECT:
|
|
1876
|
+
t.data && t.data.sid ? this.onconnect(t.data.sid, t.data.pid) : 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/)"));
|
|
1877
|
+
break;
|
|
1878
|
+
case T.EVENT:
|
|
1879
|
+
case T.BINARY_EVENT:
|
|
1880
|
+
this.onevent(t);
|
|
1881
|
+
break;
|
|
1882
|
+
case T.ACK:
|
|
1883
|
+
case T.BINARY_ACK:
|
|
1884
|
+
this.onack(t);
|
|
1885
|
+
break;
|
|
1886
|
+
case T.DISCONNECT:
|
|
1887
|
+
this.ondisconnect();
|
|
1888
|
+
break;
|
|
1889
|
+
case T.CONNECT_ERROR:
|
|
1890
|
+
this.destroy();
|
|
1891
|
+
const e = new Error(t.data.message);
|
|
1892
|
+
e.data = t.data.data, this.emitReserved("connect_error", e);
|
|
1893
|
+
break;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Called upon a server event.
|
|
1898
|
+
*
|
|
1899
|
+
* @param packet
|
|
1900
|
+
* @private
|
|
1901
|
+
*/
|
|
1902
|
+
onevent(t) {
|
|
1903
|
+
const e = t.data || [];
|
|
1904
|
+
t.id != null && e.push(this.ack(t.id)), this.connected ? this.emitEvent(e) : this.receiveBuffer.push(Object.freeze(e));
|
|
1905
|
+
}
|
|
1906
|
+
emitEvent(t) {
|
|
1907
|
+
if (this._anyListeners && this._anyListeners.length) {
|
|
1908
|
+
const e = this._anyListeners.slice();
|
|
1909
|
+
for (const n of e)
|
|
1910
|
+
n.apply(this, t);
|
|
1911
|
+
}
|
|
1912
|
+
super.emit.apply(this, t), this._pid && t.length && typeof t[t.length - 1] == "string" && (this._lastOffset = t[t.length - 1]);
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* Produces an ack callback to emit with an event.
|
|
1916
|
+
*
|
|
1917
|
+
* @private
|
|
1918
|
+
*/
|
|
1919
|
+
ack(t) {
|
|
1920
|
+
const e = this;
|
|
1921
|
+
let n = !1;
|
|
1922
|
+
return function(...o) {
|
|
1923
|
+
n || (n = !0, e.packet({
|
|
1924
|
+
type: T.ACK,
|
|
1925
|
+
id: t,
|
|
1926
|
+
data: o
|
|
1927
|
+
}));
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Called upon a server acknowledgement.
|
|
1932
|
+
*
|
|
1933
|
+
* @param packet
|
|
1934
|
+
* @private
|
|
1935
|
+
*/
|
|
1936
|
+
onack(t) {
|
|
1937
|
+
const e = this.acks[t.id];
|
|
1938
|
+
typeof e == "function" && (delete this.acks[t.id], e.withError && t.data.unshift(null), e.apply(this, t.data));
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Called upon server connect.
|
|
1942
|
+
*
|
|
1943
|
+
* @private
|
|
1944
|
+
*/
|
|
1945
|
+
onconnect(t, e) {
|
|
1946
|
+
this.id = t, this.recovered = e && this._pid === e, this._pid = e, this.connected = !0, this.emitBuffered(), this.emitReserved("connect"), this._drainQueue(!0);
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Emit buffered events (received and emitted).
|
|
1950
|
+
*
|
|
1951
|
+
* @private
|
|
1952
|
+
*/
|
|
1953
|
+
emitBuffered() {
|
|
1954
|
+
this.receiveBuffer.forEach((t) => this.emitEvent(t)), this.receiveBuffer = [], this.sendBuffer.forEach((t) => {
|
|
1955
|
+
this.notifyOutgoingListeners(t), this.packet(t);
|
|
1956
|
+
}), this.sendBuffer = [];
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Called upon server disconnect.
|
|
1960
|
+
*
|
|
1961
|
+
* @private
|
|
1962
|
+
*/
|
|
1963
|
+
ondisconnect() {
|
|
1964
|
+
this.destroy(), this.onclose("io server disconnect");
|
|
1965
|
+
}
|
|
1966
|
+
/**
|
|
1967
|
+
* Called upon forced client/server side disconnections,
|
|
1968
|
+
* this method ensures the manager stops tracking us and
|
|
1969
|
+
* that reconnections don't get triggered for this.
|
|
1970
|
+
*
|
|
1971
|
+
* @private
|
|
1972
|
+
*/
|
|
1973
|
+
destroy() {
|
|
1974
|
+
this.subs && (this.subs.forEach((t) => t()), this.subs = void 0), this.io._destroy(this);
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* Disconnects the socket manually. In that case, the socket will not try to reconnect.
|
|
1978
|
+
*
|
|
1979
|
+
* If this is the last active Socket instance of the {@link Manager}, the low-level connection will be closed.
|
|
1980
|
+
*
|
|
1981
|
+
* @example
|
|
1982
|
+
* const socket = io();
|
|
1983
|
+
*
|
|
1984
|
+
* socket.on("disconnect", (reason) => {
|
|
1985
|
+
* // console.log(reason); prints "io client disconnect"
|
|
1986
|
+
* });
|
|
1987
|
+
*
|
|
1988
|
+
* socket.disconnect();
|
|
1989
|
+
*
|
|
1990
|
+
* @return self
|
|
1991
|
+
*/
|
|
1992
|
+
disconnect() {
|
|
1993
|
+
return this.connected && this.packet({ type: T.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
|
|
1994
|
+
}
|
|
1995
|
+
/**
|
|
1996
|
+
* Alias for {@link disconnect()}.
|
|
1997
|
+
*
|
|
1998
|
+
* @return self
|
|
1999
|
+
*/
|
|
2000
|
+
close() {
|
|
2001
|
+
return this.disconnect();
|
|
2002
|
+
}
|
|
2003
|
+
/**
|
|
2004
|
+
* Sets the compress flag.
|
|
2005
|
+
*
|
|
2006
|
+
* @example
|
|
2007
|
+
* socket.compress(false).emit("hello");
|
|
2008
|
+
*
|
|
2009
|
+
* @param compress - if `true`, compresses the sending data
|
|
2010
|
+
* @return self
|
|
2011
|
+
*/
|
|
2012
|
+
compress(t) {
|
|
2013
|
+
return this.flags.compress = t, this;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not
|
|
2017
|
+
* ready to send messages.
|
|
2018
|
+
*
|
|
2019
|
+
* @example
|
|
2020
|
+
* socket.volatile.emit("hello"); // the server may or may not receive it
|
|
2021
|
+
*
|
|
2022
|
+
* @returns self
|
|
2023
|
+
*/
|
|
2024
|
+
get volatile() {
|
|
2025
|
+
return this.flags.volatile = !0, this;
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Sets a modifier for a subsequent event emission that the callback will be called with an error when the
|
|
2029
|
+
* given number of milliseconds have elapsed without an acknowledgement from the server:
|
|
2030
|
+
*
|
|
2031
|
+
* @example
|
|
2032
|
+
* socket.timeout(5000).emit("my-event", (err) => {
|
|
2033
|
+
* if (err) {
|
|
2034
|
+
* // the server did not acknowledge the event in the given delay
|
|
2035
|
+
* }
|
|
2036
|
+
* });
|
|
2037
|
+
*
|
|
2038
|
+
* @returns self
|
|
2039
|
+
*/
|
|
2040
|
+
timeout(t) {
|
|
2041
|
+
return this.flags.timeout = t, this;
|
|
2042
|
+
}
|
|
2043
|
+
/**
|
|
2044
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
|
|
2045
|
+
* callback.
|
|
2046
|
+
*
|
|
2047
|
+
* @example
|
|
2048
|
+
* socket.onAny((event, ...args) => {
|
|
2049
|
+
* console.log(`got ${event}`);
|
|
2050
|
+
* });
|
|
2051
|
+
*
|
|
2052
|
+
* @param listener
|
|
2053
|
+
*/
|
|
2054
|
+
onAny(t) {
|
|
2055
|
+
return this._anyListeners = this._anyListeners || [], this._anyListeners.push(t), this;
|
|
2056
|
+
}
|
|
2057
|
+
/**
|
|
2058
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
|
|
2059
|
+
* callback. The listener is added to the beginning of the listeners array.
|
|
2060
|
+
*
|
|
2061
|
+
* @example
|
|
2062
|
+
* socket.prependAny((event, ...args) => {
|
|
2063
|
+
* console.log(`got event ${event}`);
|
|
2064
|
+
* });
|
|
2065
|
+
*
|
|
2066
|
+
* @param listener
|
|
2067
|
+
*/
|
|
2068
|
+
prependAny(t) {
|
|
2069
|
+
return this._anyListeners = this._anyListeners || [], this._anyListeners.unshift(t), this;
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Removes the listener that will be fired when any event is emitted.
|
|
2073
|
+
*
|
|
2074
|
+
* @example
|
|
2075
|
+
* const catchAllListener = (event, ...args) => {
|
|
2076
|
+
* console.log(`got event ${event}`);
|
|
2077
|
+
* }
|
|
2078
|
+
*
|
|
2079
|
+
* socket.onAny(catchAllListener);
|
|
2080
|
+
*
|
|
2081
|
+
* // remove a specific listener
|
|
2082
|
+
* socket.offAny(catchAllListener);
|
|
2083
|
+
*
|
|
2084
|
+
* // or remove all listeners
|
|
2085
|
+
* socket.offAny();
|
|
2086
|
+
*
|
|
2087
|
+
* @param listener
|
|
2088
|
+
*/
|
|
2089
|
+
offAny(t) {
|
|
2090
|
+
if (!this._anyListeners)
|
|
2091
|
+
return this;
|
|
2092
|
+
if (t) {
|
|
2093
|
+
const e = this._anyListeners;
|
|
2094
|
+
for (let n = 0; n < e.length; n++)
|
|
2095
|
+
if (t === e[n])
|
|
2096
|
+
return e.splice(n, 1), this;
|
|
2097
|
+
} else
|
|
2098
|
+
this._anyListeners = [];
|
|
2099
|
+
return this;
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
|
|
2103
|
+
* e.g. to remove listeners.
|
|
2104
|
+
*/
|
|
2105
|
+
listenersAny() {
|
|
2106
|
+
return this._anyListeners || [];
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
|
|
2110
|
+
* callback.
|
|
2111
|
+
*
|
|
2112
|
+
* Note: acknowledgements sent to the server are not included.
|
|
2113
|
+
*
|
|
2114
|
+
* @example
|
|
2115
|
+
* socket.onAnyOutgoing((event, ...args) => {
|
|
2116
|
+
* console.log(`sent event ${event}`);
|
|
2117
|
+
* });
|
|
2118
|
+
*
|
|
2119
|
+
* @param listener
|
|
2120
|
+
*/
|
|
2121
|
+
onAnyOutgoing(t) {
|
|
2122
|
+
return this._anyOutgoingListeners = this._anyOutgoingListeners || [], this._anyOutgoingListeners.push(t), this;
|
|
2123
|
+
}
|
|
2124
|
+
/**
|
|
2125
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
|
|
2126
|
+
* callback. The listener is added to the beginning of the listeners array.
|
|
2127
|
+
*
|
|
2128
|
+
* Note: acknowledgements sent to the server are not included.
|
|
2129
|
+
*
|
|
2130
|
+
* @example
|
|
2131
|
+
* socket.prependAnyOutgoing((event, ...args) => {
|
|
2132
|
+
* console.log(`sent event ${event}`);
|
|
2133
|
+
* });
|
|
2134
|
+
*
|
|
2135
|
+
* @param listener
|
|
2136
|
+
*/
|
|
2137
|
+
prependAnyOutgoing(t) {
|
|
2138
|
+
return this._anyOutgoingListeners = this._anyOutgoingListeners || [], this._anyOutgoingListeners.unshift(t), this;
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Removes the listener that will be fired when any event is emitted.
|
|
2142
|
+
*
|
|
2143
|
+
* @example
|
|
2144
|
+
* const catchAllListener = (event, ...args) => {
|
|
2145
|
+
* console.log(`sent event ${event}`);
|
|
2146
|
+
* }
|
|
2147
|
+
*
|
|
2148
|
+
* socket.onAnyOutgoing(catchAllListener);
|
|
2149
|
+
*
|
|
2150
|
+
* // remove a specific listener
|
|
2151
|
+
* socket.offAnyOutgoing(catchAllListener);
|
|
2152
|
+
*
|
|
2153
|
+
* // or remove all listeners
|
|
2154
|
+
* socket.offAnyOutgoing();
|
|
2155
|
+
*
|
|
2156
|
+
* @param [listener] - the catch-all listener (optional)
|
|
2157
|
+
*/
|
|
2158
|
+
offAnyOutgoing(t) {
|
|
2159
|
+
if (!this._anyOutgoingListeners)
|
|
2160
|
+
return this;
|
|
2161
|
+
if (t) {
|
|
2162
|
+
const e = this._anyOutgoingListeners;
|
|
2163
|
+
for (let n = 0; n < e.length; n++)
|
|
2164
|
+
if (t === e[n])
|
|
2165
|
+
return e.splice(n, 1), this;
|
|
2166
|
+
} else
|
|
2167
|
+
this._anyOutgoingListeners = [];
|
|
2168
|
+
return this;
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2171
|
+
* Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
|
|
2172
|
+
* e.g. to remove listeners.
|
|
2173
|
+
*/
|
|
2174
|
+
listenersAnyOutgoing() {
|
|
2175
|
+
return this._anyOutgoingListeners || [];
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Notify the listeners for each packet sent
|
|
2179
|
+
*
|
|
2180
|
+
* @param packet
|
|
2181
|
+
*
|
|
2182
|
+
* @private
|
|
2183
|
+
*/
|
|
2184
|
+
notifyOutgoingListeners(t) {
|
|
2185
|
+
if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) {
|
|
2186
|
+
const e = this._anyOutgoingListeners.slice();
|
|
2187
|
+
for (const n of e)
|
|
2188
|
+
n.apply(this, t.data);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
function it(r) {
|
|
2193
|
+
r = r || {}, this.ms = r.min || 100, this.max = r.max || 1e4, this.factor = r.factor || 2, this.jitter = r.jitter > 0 && r.jitter <= 1 ? r.jitter : 0, this.attempts = 0;
|
|
2194
|
+
}
|
|
2195
|
+
it.prototype.duration = function() {
|
|
2196
|
+
var r = this.ms * Math.pow(this.factor, this.attempts++);
|
|
2197
|
+
if (this.jitter) {
|
|
2198
|
+
var t = Math.random(), e = Math.floor(t * this.jitter * r);
|
|
2199
|
+
r = (Math.floor(t * 10) & 1) == 0 ? r - e : r + e;
|
|
2200
|
+
}
|
|
2201
|
+
return Math.min(r, this.max) | 0;
|
|
2202
|
+
};
|
|
2203
|
+
it.prototype.reset = function() {
|
|
2204
|
+
this.attempts = 0;
|
|
2205
|
+
};
|
|
2206
|
+
it.prototype.setMin = function(r) {
|
|
2207
|
+
this.ms = r;
|
|
2208
|
+
};
|
|
2209
|
+
it.prototype.setMax = function(r) {
|
|
2210
|
+
this.max = r;
|
|
2211
|
+
};
|
|
2212
|
+
it.prototype.setJitter = function(r) {
|
|
2213
|
+
this.jitter = r;
|
|
2214
|
+
};
|
|
2215
|
+
class Gt extends D {
|
|
2216
|
+
constructor(t, e) {
|
|
2217
|
+
var n;
|
|
2218
|
+
super(), this.nsps = {}, this.subs = [], t && typeof t == "object" && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.opts = e, Lt(this, e), this.reconnection(e.reconnection !== !1), this.reconnectionAttempts(e.reconnectionAttempts || 1 / 0), this.reconnectionDelay(e.reconnectionDelay || 1e3), this.reconnectionDelayMax(e.reconnectionDelayMax || 5e3), this.randomizationFactor((n = e.randomizationFactor) !== null && n !== void 0 ? n : 0.5), this.backoff = new it({
|
|
2219
|
+
min: this.reconnectionDelay(),
|
|
2220
|
+
max: this.reconnectionDelayMax(),
|
|
2221
|
+
jitter: this.randomizationFactor()
|
|
2222
|
+
}), this.timeout(e.timeout == null ? 2e4 : e.timeout), this._readyState = "closed", this.uri = t;
|
|
2223
|
+
const o = e.parser || wn;
|
|
2224
|
+
this.encoder = new o.Encoder(), this.decoder = new o.Decoder(), this._autoConnect = e.autoConnect !== !1, this._autoConnect && this.open();
|
|
2225
|
+
}
|
|
2226
|
+
reconnection(t) {
|
|
2227
|
+
return arguments.length ? (this._reconnection = !!t, t || (this.skipReconnect = !0), this) : this._reconnection;
|
|
2228
|
+
}
|
|
2229
|
+
reconnectionAttempts(t) {
|
|
2230
|
+
return t === void 0 ? this._reconnectionAttempts : (this._reconnectionAttempts = t, this);
|
|
2231
|
+
}
|
|
2232
|
+
reconnectionDelay(t) {
|
|
2233
|
+
var e;
|
|
2234
|
+
return t === void 0 ? this._reconnectionDelay : (this._reconnectionDelay = t, (e = this.backoff) === null || e === void 0 || e.setMin(t), this);
|
|
2235
|
+
}
|
|
2236
|
+
randomizationFactor(t) {
|
|
2237
|
+
var e;
|
|
2238
|
+
return t === void 0 ? this._randomizationFactor : (this._randomizationFactor = t, (e = this.backoff) === null || e === void 0 || e.setJitter(t), this);
|
|
2239
|
+
}
|
|
2240
|
+
reconnectionDelayMax(t) {
|
|
2241
|
+
var e;
|
|
2242
|
+
return t === void 0 ? this._reconnectionDelayMax : (this._reconnectionDelayMax = t, (e = this.backoff) === null || e === void 0 || e.setMax(t), this);
|
|
2243
|
+
}
|
|
2244
|
+
timeout(t) {
|
|
2245
|
+
return arguments.length ? (this._timeout = t, this) : this._timeout;
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* Starts trying to reconnect if reconnection is enabled and we have not
|
|
2249
|
+
* started reconnecting yet
|
|
2250
|
+
*
|
|
2251
|
+
* @private
|
|
2252
|
+
*/
|
|
2253
|
+
maybeReconnectOnOpen() {
|
|
2254
|
+
!this._reconnecting && this._reconnection && this.backoff.attempts === 0 && this.reconnect();
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* Sets the current transport `socket`.
|
|
2258
|
+
*
|
|
2259
|
+
* @param {Function} fn - optional, callback
|
|
2260
|
+
* @return self
|
|
2261
|
+
* @public
|
|
2262
|
+
*/
|
|
2263
|
+
open(t) {
|
|
2264
|
+
if (~this._readyState.indexOf("open"))
|
|
2265
|
+
return this;
|
|
2266
|
+
this.engine = new cn(this.uri, this.opts);
|
|
2267
|
+
const e = this.engine, n = this;
|
|
2268
|
+
this._readyState = "opening", this.skipReconnect = !1;
|
|
2269
|
+
const o = W(e, "open", function() {
|
|
2270
|
+
n.onopen(), t && t();
|
|
2271
|
+
}), i = (l) => {
|
|
2272
|
+
this.cleanup(), this._readyState = "closed", this.emitReserved("error", l), t ? t(l) : this.maybeReconnectOnOpen();
|
|
2273
|
+
}, u = W(e, "error", i);
|
|
2274
|
+
if (this._timeout !== !1) {
|
|
2275
|
+
const l = this._timeout, f = this.setTimeoutFn(() => {
|
|
2276
|
+
o(), i(new Error("timeout")), e.close();
|
|
2277
|
+
}, l);
|
|
2278
|
+
this.opts.autoUnref && f.unref(), this.subs.push(() => {
|
|
2279
|
+
this.clearTimeoutFn(f);
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
return this.subs.push(o), this.subs.push(u), this;
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Alias for open()
|
|
2286
|
+
*
|
|
2287
|
+
* @return self
|
|
2288
|
+
* @public
|
|
2289
|
+
*/
|
|
2290
|
+
connect(t) {
|
|
2291
|
+
return this.open(t);
|
|
2292
|
+
}
|
|
2293
|
+
/**
|
|
2294
|
+
* Called upon transport open.
|
|
2295
|
+
*
|
|
2296
|
+
* @private
|
|
2297
|
+
*/
|
|
2298
|
+
onopen() {
|
|
2299
|
+
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
2300
|
+
const t = this.engine;
|
|
2301
|
+
this.subs.push(
|
|
2302
|
+
W(t, "ping", this.onping.bind(this)),
|
|
2303
|
+
W(t, "data", this.ondata.bind(this)),
|
|
2304
|
+
W(t, "error", this.onerror.bind(this)),
|
|
2305
|
+
W(t, "close", this.onclose.bind(this)),
|
|
2306
|
+
// @ts-ignore
|
|
2307
|
+
W(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
2308
|
+
);
|
|
2309
|
+
}
|
|
2310
|
+
/**
|
|
2311
|
+
* Called upon a ping.
|
|
2312
|
+
*
|
|
2313
|
+
* @private
|
|
2314
|
+
*/
|
|
2315
|
+
onping() {
|
|
2316
|
+
this.emitReserved("ping");
|
|
2317
|
+
}
|
|
2318
|
+
/**
|
|
2319
|
+
* Called with data.
|
|
2320
|
+
*
|
|
2321
|
+
* @private
|
|
2322
|
+
*/
|
|
2323
|
+
ondata(t) {
|
|
2324
|
+
try {
|
|
2325
|
+
this.decoder.add(t);
|
|
2326
|
+
} catch (e) {
|
|
2327
|
+
this.onclose("parse error", e);
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* Called when parser fully decodes a packet.
|
|
2332
|
+
*
|
|
2333
|
+
* @private
|
|
2334
|
+
*/
|
|
2335
|
+
ondecoded(t) {
|
|
2336
|
+
Pt(() => {
|
|
2337
|
+
this.emitReserved("packet", t);
|
|
2338
|
+
}, this.setTimeoutFn);
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Called upon socket error.
|
|
2342
|
+
*
|
|
2343
|
+
* @private
|
|
2344
|
+
*/
|
|
2345
|
+
onerror(t) {
|
|
2346
|
+
this.emitReserved("error", t);
|
|
2347
|
+
}
|
|
2348
|
+
/**
|
|
2349
|
+
* Creates a new socket for the given `nsp`.
|
|
2350
|
+
*
|
|
2351
|
+
* @return {Socket}
|
|
2352
|
+
* @public
|
|
2353
|
+
*/
|
|
2354
|
+
socket(t, e) {
|
|
2355
|
+
let n = this.nsps[t];
|
|
2356
|
+
return n ? this._autoConnect && !n.active && n.connect() : (n = new nr(this, t, e), this.nsps[t] = n), n;
|
|
2357
|
+
}
|
|
2358
|
+
/**
|
|
2359
|
+
* Called upon a socket close.
|
|
2360
|
+
*
|
|
2361
|
+
* @param socket
|
|
2362
|
+
* @private
|
|
2363
|
+
*/
|
|
2364
|
+
_destroy(t) {
|
|
2365
|
+
const e = Object.keys(this.nsps);
|
|
2366
|
+
for (const n of e)
|
|
2367
|
+
if (this.nsps[n].active)
|
|
2368
|
+
return;
|
|
2369
|
+
this._close();
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Writes a packet.
|
|
2373
|
+
*
|
|
2374
|
+
* @param packet
|
|
2375
|
+
* @private
|
|
2376
|
+
*/
|
|
2377
|
+
_packet(t) {
|
|
2378
|
+
const e = this.encoder.encode(t);
|
|
2379
|
+
for (let n = 0; n < e.length; n++)
|
|
2380
|
+
this.engine.write(e[n], t.options);
|
|
2381
|
+
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Clean up transport subscriptions and packet buffer.
|
|
2384
|
+
*
|
|
2385
|
+
* @private
|
|
2386
|
+
*/
|
|
2387
|
+
cleanup() {
|
|
2388
|
+
this.subs.forEach((t) => t()), this.subs.length = 0, this.decoder.destroy();
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* Close the current socket.
|
|
2392
|
+
*
|
|
2393
|
+
* @private
|
|
2394
|
+
*/
|
|
2395
|
+
_close() {
|
|
2396
|
+
this.skipReconnect = !0, this._reconnecting = !1, this.onclose("forced close");
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Alias for close()
|
|
2400
|
+
*
|
|
2401
|
+
* @private
|
|
2402
|
+
*/
|
|
2403
|
+
disconnect() {
|
|
2404
|
+
return this._close();
|
|
2405
|
+
}
|
|
2406
|
+
/**
|
|
2407
|
+
* Called when:
|
|
2408
|
+
*
|
|
2409
|
+
* - the low-level engine is closed
|
|
2410
|
+
* - the parser encountered a badly formatted packet
|
|
2411
|
+
* - all sockets are disconnected
|
|
2412
|
+
*
|
|
2413
|
+
* @private
|
|
2414
|
+
*/
|
|
2415
|
+
onclose(t, e) {
|
|
2416
|
+
var n;
|
|
2417
|
+
this.cleanup(), (n = this.engine) === null || n === void 0 || n.close(), this.backoff.reset(), this._readyState = "closed", this.emitReserved("close", t, e), this._reconnection && !this.skipReconnect && this.reconnect();
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Attempt a reconnection.
|
|
2421
|
+
*
|
|
2422
|
+
* @private
|
|
2423
|
+
*/
|
|
2424
|
+
reconnect() {
|
|
2425
|
+
if (this._reconnecting || this.skipReconnect)
|
|
2426
|
+
return this;
|
|
2427
|
+
const t = this;
|
|
2428
|
+
if (this.backoff.attempts >= this._reconnectionAttempts)
|
|
2429
|
+
this.backoff.reset(), this.emitReserved("reconnect_failed"), this._reconnecting = !1;
|
|
2430
|
+
else {
|
|
2431
|
+
const e = this.backoff.duration();
|
|
2432
|
+
this._reconnecting = !0;
|
|
2433
|
+
const n = this.setTimeoutFn(() => {
|
|
2434
|
+
t.skipReconnect || (this.emitReserved("reconnect_attempt", t.backoff.attempts), !t.skipReconnect && t.open((o) => {
|
|
2435
|
+
o ? (t._reconnecting = !1, t.reconnect(), this.emitReserved("reconnect_error", o)) : t.onreconnect();
|
|
2436
|
+
}));
|
|
2437
|
+
}, e);
|
|
2438
|
+
this.opts.autoUnref && n.unref(), this.subs.push(() => {
|
|
2439
|
+
this.clearTimeoutFn(n);
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Called upon successful reconnect.
|
|
2445
|
+
*
|
|
2446
|
+
* @private
|
|
2447
|
+
*/
|
|
2448
|
+
onreconnect() {
|
|
2449
|
+
const t = this.backoff.attempts;
|
|
2450
|
+
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", t);
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
const at = {};
|
|
2454
|
+
function Nt(r, t) {
|
|
2455
|
+
typeof r == "object" && (t = r, r = void 0), t = t || {};
|
|
2456
|
+
const e = ln(r, t.path || "/socket.io"), n = e.source, o = e.id, i = e.path, u = at[o] && i in at[o].nsps, l = t.forceNew || t["force new connection"] || t.multiplex === !1 || u;
|
|
2457
|
+
let f;
|
|
2458
|
+
return l ? f = new Gt(n, t) : (at[o] || (at[o] = new Gt(n, t)), f = at[o]), e.query && !t.query && (t.query = e.queryKey), f.socket(e.path, t);
|
|
2459
|
+
}
|
|
2460
|
+
Object.assign(Nt, {
|
|
2461
|
+
Manager: Gt,
|
|
2462
|
+
Socket: nr,
|
|
2463
|
+
io: Nt,
|
|
2464
|
+
connect: Nt
|
|
2465
|
+
});
|
|
2466
|
+
/*!
|
|
2467
|
+
* hash-wasm (https://www.npmjs.com/package/hash-wasm)
|
|
2468
|
+
* (c) Dani Biro
|
|
2469
|
+
* @license MIT
|
|
2470
|
+
*/
|
|
2471
|
+
function kn(r, t, e, n) {
|
|
2472
|
+
function o(i) {
|
|
2473
|
+
return i instanceof e ? i : new e(function(u) {
|
|
2474
|
+
u(i);
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2477
|
+
return new (e || (e = Promise))(function(i, u) {
|
|
2478
|
+
function l(_) {
|
|
2479
|
+
try {
|
|
2480
|
+
d(n.next(_));
|
|
2481
|
+
} catch (L) {
|
|
2482
|
+
u(L);
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
function f(_) {
|
|
2486
|
+
try {
|
|
2487
|
+
d(n.throw(_));
|
|
2488
|
+
} catch (L) {
|
|
2489
|
+
u(L);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
function d(_) {
|
|
2493
|
+
_.done ? i(_.value) : o(_.value).then(l, f);
|
|
2494
|
+
}
|
|
2495
|
+
d((n = n.apply(r, [])).next());
|
|
2496
|
+
});
|
|
2497
|
+
}
|
|
2498
|
+
class I {
|
|
2499
|
+
constructor() {
|
|
2500
|
+
this.mutex = Promise.resolve();
|
|
2501
|
+
}
|
|
2502
|
+
lock() {
|
|
2503
|
+
let t = () => {
|
|
2504
|
+
};
|
|
2505
|
+
return this.mutex = this.mutex.then(() => new Promise(t)), new Promise((e) => {
|
|
2506
|
+
t = e;
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
dispatch(t) {
|
|
2510
|
+
return kn(this, void 0, void 0, function* () {
|
|
2511
|
+
const e = yield this.lock();
|
|
2512
|
+
try {
|
|
2513
|
+
return yield Promise.resolve(t());
|
|
2514
|
+
} finally {
|
|
2515
|
+
e();
|
|
2516
|
+
}
|
|
2517
|
+
});
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
function Sn() {
|
|
2521
|
+
return typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global;
|
|
2522
|
+
}
|
|
2523
|
+
const ve = Sn();
|
|
2524
|
+
ve.TextEncoder && new ve.TextEncoder();
|
|
2525
|
+
const be = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", On = new Uint8Array(256);
|
|
2526
|
+
for (let r = 0; r < be.length; r++)
|
|
2527
|
+
On[be.charCodeAt(r)] = r;
|
|
2528
|
+
new I();
|
|
2529
|
+
new I();
|
|
2530
|
+
new I();
|
|
2531
|
+
new I();
|
|
2532
|
+
new I();
|
|
2533
|
+
new I();
|
|
2534
|
+
new I();
|
|
2535
|
+
new I();
|
|
2536
|
+
new I();
|
|
2537
|
+
new I();
|
|
2538
|
+
new I();
|
|
2539
|
+
new I();
|
|
2540
|
+
new I();
|
|
2541
|
+
new I();
|
|
2542
|
+
new I();
|
|
2543
|
+
new I();
|
|
2544
|
+
new I();
|
|
2545
|
+
new I();
|
|
2546
|
+
new I();
|
|
2547
|
+
new I();
|
|
2548
|
+
new I();
|
|
2549
|
+
new I();
|
|
2550
|
+
new I();
|
|
2551
|
+
function Yt(r) {
|
|
2552
|
+
"@babel/helpers - typeof";
|
|
2553
|
+
return Yt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
2554
|
+
return typeof t;
|
|
2555
|
+
} : function(t) {
|
|
2556
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2557
|
+
}, Yt(r);
|
|
2558
|
+
}
|
|
2559
|
+
function xn(r, t, e) {
|
|
2560
|
+
return Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
2561
|
+
}
|
|
2562
|
+
function Un(r, t) {
|
|
2563
|
+
if (!(r instanceof t))
|
|
2564
|
+
throw new TypeError("Cannot call a class as a function");
|
|
2565
|
+
}
|
|
2566
|
+
function Rn(r, t, e) {
|
|
2567
|
+
return t = pt(t), Tn(r, se() ? Reflect.construct(t, e || [], pt(r).constructor) : t.apply(r, e));
|
|
2568
|
+
}
|
|
2569
|
+
function Tn(r, t) {
|
|
2570
|
+
if (t && (Yt(t) === "object" || typeof t == "function"))
|
|
2571
|
+
return t;
|
|
2572
|
+
if (t !== void 0)
|
|
2573
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
2574
|
+
return Cn(r);
|
|
2575
|
+
}
|
|
2576
|
+
function Cn(r) {
|
|
2577
|
+
if (r === void 0)
|
|
2578
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2579
|
+
return r;
|
|
2580
|
+
}
|
|
2581
|
+
function Pn(r, t) {
|
|
2582
|
+
if (typeof t != "function" && t !== null)
|
|
2583
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
2584
|
+
r.prototype = Object.create(t && t.prototype, { constructor: { value: r, writable: !0, configurable: !0 } }), Object.defineProperty(r, "prototype", { writable: !1 }), t && ht(r, t);
|
|
2585
|
+
}
|
|
2586
|
+
function Wt(r) {
|
|
2587
|
+
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
2588
|
+
return Wt = function(e) {
|
|
2589
|
+
if (e === null || !An(e)) return e;
|
|
2590
|
+
if (typeof e != "function")
|
|
2591
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
2592
|
+
if (typeof t < "u") {
|
|
2593
|
+
if (t.has(e)) return t.get(e);
|
|
2594
|
+
t.set(e, n);
|
|
2595
|
+
}
|
|
2596
|
+
function n() {
|
|
2597
|
+
return Ln(e, arguments, pt(this).constructor);
|
|
2598
|
+
}
|
|
2599
|
+
return n.prototype = Object.create(e.prototype, { constructor: { value: n, enumerable: !1, writable: !0, configurable: !0 } }), ht(n, e);
|
|
2600
|
+
}, Wt(r);
|
|
2601
|
+
}
|
|
2602
|
+
function Ln(r, t, e) {
|
|
2603
|
+
if (se()) return Reflect.construct.apply(null, arguments);
|
|
2604
|
+
var n = [null];
|
|
2605
|
+
n.push.apply(n, t);
|
|
2606
|
+
var o = new (r.bind.apply(r, n))();
|
|
2607
|
+
return e && ht(o, e.prototype), o;
|
|
2608
|
+
}
|
|
2609
|
+
function se() {
|
|
2610
|
+
try {
|
|
2611
|
+
var r = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
2612
|
+
}));
|
|
2613
|
+
} catch {
|
|
2614
|
+
}
|
|
2615
|
+
return (se = function() {
|
|
2616
|
+
return !!r;
|
|
2617
|
+
})();
|
|
2618
|
+
}
|
|
2619
|
+
function An(r) {
|
|
2620
|
+
try {
|
|
2621
|
+
return Function.toString.call(r).indexOf("[native code]") !== -1;
|
|
2622
|
+
} catch {
|
|
2623
|
+
return typeof r == "function";
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
function ht(r, t) {
|
|
2627
|
+
return ht = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, n) {
|
|
2628
|
+
return e.__proto__ = n, e;
|
|
2629
|
+
}, ht(r, t);
|
|
2630
|
+
}
|
|
2631
|
+
function pt(r) {
|
|
2632
|
+
return pt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
2633
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
2634
|
+
}, pt(r);
|
|
2635
|
+
}
|
|
2636
|
+
var wt = /* @__PURE__ */ (function(r) {
|
|
2637
|
+
function t(e) {
|
|
2638
|
+
var n, o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, u = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
|
|
2639
|
+
if (Un(this, t), n = Rn(this, t, [e]), n.originalRequest = i, n.originalResponse = u, n.causingError = o, o != null && (e += ", caused by ".concat(o.toString())), i != null) {
|
|
2640
|
+
var l = i.getHeader("X-Request-ID") || "n/a", f = i.getMethod(), d = i.getURL(), _ = u ? u.getStatus() : "n/a", L = u ? u.getBody() || "" : "n/a";
|
|
2641
|
+
e += ", originated from request (method: ".concat(f, ", url: ").concat(d, ", response code: ").concat(_, ", response text: ").concat(L, ", request id: ").concat(l, ")");
|
|
2642
|
+
}
|
|
2643
|
+
return n.message = e, n;
|
|
2644
|
+
}
|
|
2645
|
+
return Pn(t, r), xn(t);
|
|
2646
|
+
})(/* @__PURE__ */ Wt(Error));
|
|
2647
|
+
function ft(r) {
|
|
2648
|
+
"@babel/helpers - typeof";
|
|
2649
|
+
return ft = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
2650
|
+
return typeof t;
|
|
2651
|
+
} : function(t) {
|
|
2652
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2653
|
+
}, ft(r);
|
|
2654
|
+
}
|
|
2655
|
+
function jn(r, t) {
|
|
2656
|
+
if (!(r instanceof t))
|
|
2657
|
+
throw new TypeError("Cannot call a class as a function");
|
|
2658
|
+
}
|
|
2659
|
+
function Bn(r, t) {
|
|
2660
|
+
for (var e = 0; e < t.length; e++) {
|
|
2661
|
+
var n = t[e];
|
|
2662
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, In(n.key), n);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
function Nn(r, t, e) {
|
|
2666
|
+
return t && Bn(r.prototype, t), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
2667
|
+
}
|
|
2668
|
+
function In(r) {
|
|
2669
|
+
var t = Dn(r, "string");
|
|
2670
|
+
return ft(t) == "symbol" ? t : t + "";
|
|
2671
|
+
}
|
|
2672
|
+
function Dn(r, t) {
|
|
2673
|
+
if (ft(r) != "object" || !r) return r;
|
|
2674
|
+
var e = r[Symbol.toPrimitive];
|
|
2675
|
+
if (e !== void 0) {
|
|
2676
|
+
var n = e.call(r, t);
|
|
2677
|
+
if (ft(n) != "object") return n;
|
|
2678
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2679
|
+
}
|
|
2680
|
+
return String(r);
|
|
2681
|
+
}
|
|
2682
|
+
var qn = /* @__PURE__ */ (function() {
|
|
2683
|
+
function r() {
|
|
2684
|
+
jn(this, r);
|
|
2685
|
+
}
|
|
2686
|
+
return Nn(r, [{
|
|
2687
|
+
key: "listAllUploads",
|
|
2688
|
+
value: function() {
|
|
2689
|
+
return Promise.resolve([]);
|
|
2690
|
+
}
|
|
2691
|
+
}, {
|
|
2692
|
+
key: "findUploadsByFingerprint",
|
|
2693
|
+
value: function(t) {
|
|
2694
|
+
return Promise.resolve([]);
|
|
2695
|
+
}
|
|
2696
|
+
}, {
|
|
2697
|
+
key: "removeUpload",
|
|
2698
|
+
value: function(t) {
|
|
2699
|
+
return Promise.resolve();
|
|
2700
|
+
}
|
|
2701
|
+
}, {
|
|
2702
|
+
key: "addUpload",
|
|
2703
|
+
value: function(t, e) {
|
|
2704
|
+
return Promise.resolve(null);
|
|
2705
|
+
}
|
|
2706
|
+
}]);
|
|
2707
|
+
})();
|
|
2708
|
+
const or = "3.7.7", Fn = or, st = typeof Buffer == "function", _e = typeof TextDecoder == "function" ? new TextDecoder() : void 0, we = typeof TextEncoder == "function" ? new TextEncoder() : void 0, Hn = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", ct = Array.prototype.slice.call(Hn), Et = ((r) => {
|
|
2709
|
+
let t = {};
|
|
2710
|
+
return r.forEach((e, n) => t[e] = n), t;
|
|
2711
|
+
})(ct), zn = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, F = String.fromCharCode.bind(String), Ee = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (r) => new Uint8Array(Array.prototype.slice.call(r, 0)), ir = (r) => r.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), sr = (r) => r.replace(/[^A-Za-z0-9\+\/]/g, ""), ar = (r) => {
|
|
2712
|
+
let t, e, n, o, i = "";
|
|
2713
|
+
const u = r.length % 3;
|
|
2714
|
+
for (let l = 0; l < r.length; ) {
|
|
2715
|
+
if ((e = r.charCodeAt(l++)) > 255 || (n = r.charCodeAt(l++)) > 255 || (o = r.charCodeAt(l++)) > 255)
|
|
2716
|
+
throw new TypeError("invalid character found");
|
|
2717
|
+
t = e << 16 | n << 8 | o, i += ct[t >> 18 & 63] + ct[t >> 12 & 63] + ct[t >> 6 & 63] + ct[t & 63];
|
|
2718
|
+
}
|
|
2719
|
+
return u ? i.slice(0, u - 3) + "===".substring(u) : i;
|
|
2720
|
+
}, ae = typeof btoa == "function" ? (r) => btoa(r) : st ? (r) => Buffer.from(r, "binary").toString("base64") : ar, Jt = st ? (r) => Buffer.from(r).toString("base64") : (r) => {
|
|
2721
|
+
let t = [];
|
|
2722
|
+
for (let e = 0, n = r.length; e < n; e += 4096)
|
|
2723
|
+
t.push(F.apply(null, r.subarray(e, e + 4096)));
|
|
2724
|
+
return ae(t.join(""));
|
|
2725
|
+
}, Rt = (r, t = !1) => t ? ir(Jt(r)) : Jt(r), Mn = (r) => {
|
|
2726
|
+
if (r.length < 2) {
|
|
2727
|
+
var t = r.charCodeAt(0);
|
|
2728
|
+
return t < 128 ? r : t < 2048 ? F(192 | t >>> 6) + F(128 | t & 63) : F(224 | t >>> 12 & 15) + F(128 | t >>> 6 & 63) + F(128 | t & 63);
|
|
2729
|
+
} else {
|
|
2730
|
+
var t = 65536 + (r.charCodeAt(0) - 55296) * 1024 + (r.charCodeAt(1) - 56320);
|
|
2731
|
+
return F(240 | t >>> 18 & 7) + F(128 | t >>> 12 & 63) + F(128 | t >>> 6 & 63) + F(128 | t & 63);
|
|
2732
|
+
}
|
|
2733
|
+
}, Vn = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, ur = (r) => r.replace(Vn, Mn), ke = st ? (r) => Buffer.from(r, "utf8").toString("base64") : we ? (r) => Jt(we.encode(r)) : (r) => ae(ur(r)), ot = (r, t = !1) => t ? ir(ke(r)) : ke(r), Se = (r) => ot(r, !0), Kn = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, Gn = (r) => {
|
|
2734
|
+
switch (r.length) {
|
|
2735
|
+
case 4:
|
|
2736
|
+
var t = (7 & r.charCodeAt(0)) << 18 | (63 & r.charCodeAt(1)) << 12 | (63 & r.charCodeAt(2)) << 6 | 63 & r.charCodeAt(3), e = t - 65536;
|
|
2737
|
+
return F((e >>> 10) + 55296) + F((e & 1023) + 56320);
|
|
2738
|
+
case 3:
|
|
2739
|
+
return F((15 & r.charCodeAt(0)) << 12 | (63 & r.charCodeAt(1)) << 6 | 63 & r.charCodeAt(2));
|
|
2740
|
+
default:
|
|
2741
|
+
return F((31 & r.charCodeAt(0)) << 6 | 63 & r.charCodeAt(1));
|
|
2742
|
+
}
|
|
2743
|
+
}, cr = (r) => r.replace(Kn, Gn), lr = (r) => {
|
|
2744
|
+
if (r = r.replace(/\s+/g, ""), !zn.test(r))
|
|
2745
|
+
throw new TypeError("malformed base64.");
|
|
2746
|
+
r += "==".slice(2 - (r.length & 3));
|
|
2747
|
+
let t, e = "", n, o;
|
|
2748
|
+
for (let i = 0; i < r.length; )
|
|
2749
|
+
t = Et[r.charAt(i++)] << 18 | Et[r.charAt(i++)] << 12 | (n = Et[r.charAt(i++)]) << 6 | (o = Et[r.charAt(i++)]), e += n === 64 ? F(t >> 16 & 255) : o === 64 ? F(t >> 16 & 255, t >> 8 & 255) : F(t >> 16 & 255, t >> 8 & 255, t & 255);
|
|
2750
|
+
return e;
|
|
2751
|
+
}, ue = typeof atob == "function" ? (r) => atob(sr(r)) : st ? (r) => Buffer.from(r, "base64").toString("binary") : lr, hr = st ? (r) => Ee(Buffer.from(r, "base64")) : (r) => Ee(ue(r).split("").map((t) => t.charCodeAt(0))), pr = (r) => hr(fr(r)), Yn = st ? (r) => Buffer.from(r, "base64").toString("utf8") : _e ? (r) => _e.decode(hr(r)) : (r) => cr(ue(r)), fr = (r) => sr(r.replace(/[-_]/g, (t) => t == "-" ? "+" : "/")), Xt = (r) => Yn(fr(r)), Wn = (r) => {
|
|
2752
|
+
if (typeof r != "string")
|
|
2753
|
+
return !1;
|
|
2754
|
+
const t = r.replace(/\s+/g, "").replace(/={0,2}$/, "");
|
|
2755
|
+
return !/[^\s0-9a-zA-Z\+/]/.test(t) || !/[^\s0-9a-zA-Z\-_]/.test(t);
|
|
2756
|
+
}, dr = (r) => ({
|
|
2757
|
+
value: r,
|
|
2758
|
+
enumerable: !1,
|
|
2759
|
+
writable: !0,
|
|
2760
|
+
configurable: !0
|
|
2761
|
+
}), yr = function() {
|
|
2762
|
+
const r = (t, e) => Object.defineProperty(String.prototype, t, dr(e));
|
|
2763
|
+
r("fromBase64", function() {
|
|
2764
|
+
return Xt(this);
|
|
2765
|
+
}), r("toBase64", function(t) {
|
|
2766
|
+
return ot(this, t);
|
|
2767
|
+
}), r("toBase64URI", function() {
|
|
2768
|
+
return ot(this, !0);
|
|
2769
|
+
}), r("toBase64URL", function() {
|
|
2770
|
+
return ot(this, !0);
|
|
2771
|
+
}), r("toUint8Array", function() {
|
|
2772
|
+
return pr(this);
|
|
2773
|
+
});
|
|
2774
|
+
}, gr = function() {
|
|
2775
|
+
const r = (t, e) => Object.defineProperty(Uint8Array.prototype, t, dr(e));
|
|
2776
|
+
r("toBase64", function(t) {
|
|
2777
|
+
return Rt(this, t);
|
|
2778
|
+
}), r("toBase64URI", function() {
|
|
2779
|
+
return Rt(this, !0);
|
|
2780
|
+
}), r("toBase64URL", function() {
|
|
2781
|
+
return Rt(this, !0);
|
|
2782
|
+
});
|
|
2783
|
+
}, Jn = () => {
|
|
2784
|
+
yr(), gr();
|
|
2785
|
+
}, Xn = {
|
|
2786
|
+
version: or,
|
|
2787
|
+
VERSION: Fn,
|
|
2788
|
+
atob: ue,
|
|
2789
|
+
atobPolyfill: lr,
|
|
2790
|
+
btoa: ae,
|
|
2791
|
+
btoaPolyfill: ar,
|
|
2792
|
+
fromBase64: Xt,
|
|
2793
|
+
toBase64: ot,
|
|
2794
|
+
encode: ot,
|
|
2795
|
+
encodeURI: Se,
|
|
2796
|
+
encodeURL: Se,
|
|
2797
|
+
utob: ur,
|
|
2798
|
+
btou: cr,
|
|
2799
|
+
decode: Xt,
|
|
2800
|
+
isValid: Wn,
|
|
2801
|
+
fromUint8Array: Rt,
|
|
2802
|
+
toUint8Array: pr,
|
|
2803
|
+
extendString: yr,
|
|
2804
|
+
extendUint8Array: gr,
|
|
2805
|
+
extendBuiltins: Jn
|
|
2806
|
+
};
|
|
2807
|
+
var Oe, xe;
|
|
2808
|
+
function $n() {
|
|
2809
|
+
return xe || (xe = 1, Oe = function(r, t) {
|
|
2810
|
+
if (t = t.split(":")[0], r = +r, !r) return !1;
|
|
2811
|
+
switch (t) {
|
|
2812
|
+
case "http":
|
|
2813
|
+
case "ws":
|
|
2814
|
+
return r !== 80;
|
|
2815
|
+
case "https":
|
|
2816
|
+
case "wss":
|
|
2817
|
+
return r !== 443;
|
|
2818
|
+
case "ftp":
|
|
2819
|
+
return r !== 21;
|
|
2820
|
+
case "gopher":
|
|
2821
|
+
return r !== 70;
|
|
2822
|
+
case "file":
|
|
2823
|
+
return !1;
|
|
2824
|
+
}
|
|
2825
|
+
return r !== 0;
|
|
2826
|
+
}), Oe;
|
|
2827
|
+
}
|
|
2828
|
+
var kt = {}, Ue;
|
|
2829
|
+
function Qn() {
|
|
2830
|
+
if (Ue) return kt;
|
|
2831
|
+
Ue = 1;
|
|
2832
|
+
var r = Object.prototype.hasOwnProperty, t;
|
|
2833
|
+
function e(u) {
|
|
2834
|
+
try {
|
|
2835
|
+
return decodeURIComponent(u.replace(/\+/g, " "));
|
|
2836
|
+
} catch {
|
|
2837
|
+
return null;
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
function n(u) {
|
|
2841
|
+
try {
|
|
2842
|
+
return encodeURIComponent(u);
|
|
2843
|
+
} catch {
|
|
2844
|
+
return null;
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
function o(u) {
|
|
2848
|
+
for (var l = /([^=?#&]+)=?([^&]*)/g, f = {}, d; d = l.exec(u); ) {
|
|
2849
|
+
var _ = e(d[1]), L = e(d[2]);
|
|
2850
|
+
_ === null || L === null || _ in f || (f[_] = L);
|
|
2851
|
+
}
|
|
2852
|
+
return f;
|
|
2853
|
+
}
|
|
2854
|
+
function i(u, l) {
|
|
2855
|
+
l = l || "";
|
|
2856
|
+
var f = [], d, _;
|
|
2857
|
+
typeof l != "string" && (l = "?");
|
|
2858
|
+
for (_ in u)
|
|
2859
|
+
if (r.call(u, _)) {
|
|
2860
|
+
if (d = u[_], !d && (d === null || d === t || isNaN(d)) && (d = ""), _ = n(_), d = n(d), _ === null || d === null) continue;
|
|
2861
|
+
f.push(_ + "=" + d);
|
|
2862
|
+
}
|
|
2863
|
+
return f.length ? l + f.join("&") : "";
|
|
2864
|
+
}
|
|
2865
|
+
return kt.stringify = i, kt.parse = o, kt;
|
|
2866
|
+
}
|
|
2867
|
+
var It, Re;
|
|
2868
|
+
function Zn() {
|
|
2869
|
+
if (Re) return It;
|
|
2870
|
+
Re = 1;
|
|
2871
|
+
var r = $n(), t = Qn(), e = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, n = /[\n\r\t]/g, o = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, i = /:\d+$/, u = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, l = /^[a-zA-Z]:/;
|
|
2872
|
+
function f(y) {
|
|
2873
|
+
return (y || "").toString().replace(e, "");
|
|
2874
|
+
}
|
|
2875
|
+
var d = [
|
|
2876
|
+
["#", "hash"],
|
|
2877
|
+
// Extract from the back.
|
|
2878
|
+
["?", "query"],
|
|
2879
|
+
// Extract from the back.
|
|
2880
|
+
function(y, g) {
|
|
2881
|
+
return B(g.protocol) ? y.replace(/\\/g, "/") : y;
|
|
2882
|
+
},
|
|
2883
|
+
["/", "pathname"],
|
|
2884
|
+
// Extract from the back.
|
|
2885
|
+
["@", "auth", 1],
|
|
2886
|
+
// Extract from the front.
|
|
2887
|
+
[NaN, "host", void 0, 1, 1],
|
|
2888
|
+
// Set left over value.
|
|
2889
|
+
[/:(\d*)$/, "port", void 0, 1],
|
|
2890
|
+
// RegExp the back.
|
|
2891
|
+
[NaN, "hostname", void 0, 1, 1]
|
|
2892
|
+
// Set left over.
|
|
2893
|
+
], _ = { hash: 1, query: 1 };
|
|
2894
|
+
function L(y) {
|
|
2895
|
+
var g;
|
|
2896
|
+
typeof window < "u" ? g = window : typeof he < "u" ? g = he : typeof self < "u" ? g = self : g = {};
|
|
2897
|
+
var m = g.location || {};
|
|
2898
|
+
y = y || m;
|
|
2899
|
+
var p = {}, x = typeof y, k;
|
|
2900
|
+
if (y.protocol === "blob:")
|
|
2901
|
+
p = new E(unescape(y.pathname), {});
|
|
2902
|
+
else if (x === "string") {
|
|
2903
|
+
p = new E(y, {});
|
|
2904
|
+
for (k in _) delete p[k];
|
|
2905
|
+
} else if (x === "object") {
|
|
2906
|
+
for (k in y)
|
|
2907
|
+
k in _ || (p[k] = y[k]);
|
|
2908
|
+
p.slashes === void 0 && (p.slashes = o.test(y.href));
|
|
2909
|
+
}
|
|
2910
|
+
return p;
|
|
2911
|
+
}
|
|
2912
|
+
function B(y) {
|
|
2913
|
+
return y === "file:" || y === "ftp:" || y === "http:" || y === "https:" || y === "ws:" || y === "wss:";
|
|
2914
|
+
}
|
|
2915
|
+
function K(y, g) {
|
|
2916
|
+
y = f(y), y = y.replace(n, ""), g = g || {};
|
|
2917
|
+
var m = u.exec(y), p = m[1] ? m[1].toLowerCase() : "", x = !!m[2], k = !!m[3], C = 0, O;
|
|
2918
|
+
return x ? k ? (O = m[2] + m[3] + m[4], C = m[2].length + m[3].length) : (O = m[2] + m[4], C = m[2].length) : k ? (O = m[3] + m[4], C = m[3].length) : O = m[4], p === "file:" ? C >= 2 && (O = O.slice(2)) : B(p) ? O = m[4] : p ? x && (O = O.slice(2)) : C >= 2 && B(g.protocol) && (O = m[4]), {
|
|
2919
|
+
protocol: p,
|
|
2920
|
+
slashes: x || B(p),
|
|
2921
|
+
slashesCount: C,
|
|
2922
|
+
rest: O
|
|
2923
|
+
};
|
|
2924
|
+
}
|
|
2925
|
+
function G(y, g) {
|
|
2926
|
+
if (y === "") return g;
|
|
2927
|
+
for (var m = (g || "/").split("/").slice(0, -1).concat(y.split("/")), p = m.length, x = m[p - 1], k = !1, C = 0; p--; )
|
|
2928
|
+
m[p] === "." ? m.splice(p, 1) : m[p] === ".." ? (m.splice(p, 1), C++) : C && (p === 0 && (k = !0), m.splice(p, 1), C--);
|
|
2929
|
+
return k && m.unshift(""), (x === "." || x === "..") && m.push(""), m.join("/");
|
|
2930
|
+
}
|
|
2931
|
+
function E(y, g, m) {
|
|
2932
|
+
if (y = f(y), y = y.replace(n, ""), !(this instanceof E))
|
|
2933
|
+
return new E(y, g, m);
|
|
2934
|
+
var p, x, k, C, O, q, P = d.slice(), N = typeof g, b = this, z = 0;
|
|
2935
|
+
for (N !== "object" && N !== "string" && (m = g, g = null), m && typeof m != "function" && (m = t.parse), g = L(g), x = K(y || "", g), p = !x.protocol && !x.slashes, b.slashes = x.slashes || p && g.slashes, b.protocol = x.protocol || g.protocol || "", y = x.rest, (x.protocol === "file:" && (x.slashesCount !== 2 || l.test(y)) || !x.slashes && (x.protocol || x.slashesCount < 2 || !B(b.protocol))) && (P[3] = [/(.*)/, "pathname"]); z < P.length; z++) {
|
|
2936
|
+
if (C = P[z], typeof C == "function") {
|
|
2937
|
+
y = C(y, b);
|
|
2938
|
+
continue;
|
|
2939
|
+
}
|
|
2940
|
+
k = C[0], q = C[1], k !== k ? b[q] = y : typeof k == "string" ? (O = k === "@" ? y.lastIndexOf(k) : y.indexOf(k), ~O && (typeof C[2] == "number" ? (b[q] = y.slice(0, O), y = y.slice(O + C[2])) : (b[q] = y.slice(O), y = y.slice(0, O)))) : (O = k.exec(y)) && (b[q] = O[1], y = y.slice(0, O.index)), b[q] = b[q] || p && C[3] && g[q] || "", C[4] && (b[q] = b[q].toLowerCase());
|
|
2941
|
+
}
|
|
2942
|
+
m && (b.query = m(b.query)), p && g.slashes && b.pathname.charAt(0) !== "/" && (b.pathname !== "" || g.pathname !== "") && (b.pathname = G(b.pathname, g.pathname)), b.pathname.charAt(0) !== "/" && B(b.protocol) && (b.pathname = "/" + b.pathname), r(b.port, b.protocol) || (b.host = b.hostname, b.port = ""), b.username = b.password = "", b.auth && (O = b.auth.indexOf(":"), ~O ? (b.username = b.auth.slice(0, O), b.username = encodeURIComponent(decodeURIComponent(b.username)), b.password = b.auth.slice(O + 1), b.password = encodeURIComponent(decodeURIComponent(b.password))) : b.username = encodeURIComponent(decodeURIComponent(b.auth)), b.auth = b.password ? b.username + ":" + b.password : b.username), b.origin = b.protocol !== "file:" && B(b.protocol) && b.host ? b.protocol + "//" + b.host : "null", b.href = b.toString();
|
|
2943
|
+
}
|
|
2944
|
+
function U(y, g, m) {
|
|
2945
|
+
var p = this;
|
|
2946
|
+
switch (y) {
|
|
2947
|
+
case "query":
|
|
2948
|
+
typeof g == "string" && g.length && (g = (m || t.parse)(g)), p[y] = g;
|
|
2949
|
+
break;
|
|
2950
|
+
case "port":
|
|
2951
|
+
p[y] = g, r(g, p.protocol) ? g && (p.host = p.hostname + ":" + g) : (p.host = p.hostname, p[y] = "");
|
|
2952
|
+
break;
|
|
2953
|
+
case "hostname":
|
|
2954
|
+
p[y] = g, p.port && (g += ":" + p.port), p.host = g;
|
|
2955
|
+
break;
|
|
2956
|
+
case "host":
|
|
2957
|
+
p[y] = g, i.test(g) ? (g = g.split(":"), p.port = g.pop(), p.hostname = g.join(":")) : (p.hostname = g, p.port = "");
|
|
2958
|
+
break;
|
|
2959
|
+
case "protocol":
|
|
2960
|
+
p.protocol = g.toLowerCase(), p.slashes = !m;
|
|
2961
|
+
break;
|
|
2962
|
+
case "pathname":
|
|
2963
|
+
case "hash":
|
|
2964
|
+
if (g) {
|
|
2965
|
+
var x = y === "pathname" ? "/" : "#";
|
|
2966
|
+
p[y] = g.charAt(0) !== x ? x + g : g;
|
|
2967
|
+
} else
|
|
2968
|
+
p[y] = g;
|
|
2969
|
+
break;
|
|
2970
|
+
case "username":
|
|
2971
|
+
case "password":
|
|
2972
|
+
p[y] = encodeURIComponent(g);
|
|
2973
|
+
break;
|
|
2974
|
+
case "auth":
|
|
2975
|
+
var k = g.indexOf(":");
|
|
2976
|
+
~k ? (p.username = g.slice(0, k), p.username = encodeURIComponent(decodeURIComponent(p.username)), p.password = g.slice(k + 1), p.password = encodeURIComponent(decodeURIComponent(p.password))) : p.username = encodeURIComponent(decodeURIComponent(g));
|
|
2977
|
+
}
|
|
2978
|
+
for (var C = 0; C < d.length; C++) {
|
|
2979
|
+
var O = d[C];
|
|
2980
|
+
O[4] && (p[O[1]] = p[O[1]].toLowerCase());
|
|
2981
|
+
}
|
|
2982
|
+
return p.auth = p.password ? p.username + ":" + p.password : p.username, p.origin = p.protocol !== "file:" && B(p.protocol) && p.host ? p.protocol + "//" + p.host : "null", p.href = p.toString(), p;
|
|
2983
|
+
}
|
|
2984
|
+
function S(y) {
|
|
2985
|
+
(!y || typeof y != "function") && (y = t.stringify);
|
|
2986
|
+
var g, m = this, p = m.host, x = m.protocol;
|
|
2987
|
+
x && x.charAt(x.length - 1) !== ":" && (x += ":");
|
|
2988
|
+
var k = x + (m.protocol && m.slashes || B(m.protocol) ? "//" : "");
|
|
2989
|
+
return m.username ? (k += m.username, m.password && (k += ":" + m.password), k += "@") : m.password ? (k += ":" + m.password, k += "@") : m.protocol !== "file:" && B(m.protocol) && !p && m.pathname !== "/" && (k += "@"), (p[p.length - 1] === ":" || i.test(m.hostname) && !m.port) && (p += ":"), k += p + m.pathname, g = typeof m.query == "object" ? y(m.query) : m.query, g && (k += g.charAt(0) !== "?" ? "?" + g : g), m.hash && (k += m.hash), k;
|
|
2990
|
+
}
|
|
2991
|
+
return E.prototype = { set: U, toString: S }, E.extractProtocol = K, E.location = L, E.trimLeft = f, E.qs = t, It = E, It;
|
|
2992
|
+
}
|
|
2993
|
+
var to = Zn();
|
|
2994
|
+
const eo = /* @__PURE__ */ Ve(to);
|
|
2995
|
+
function ro() {
|
|
2996
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
|
|
2997
|
+
var t = Math.random() * 16 | 0, e = r === "x" ? t : t & 3 | 8;
|
|
2998
|
+
return e.toString(16);
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
function $t() {
|
|
3002
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3003
|
+
$t = function() {
|
|
3004
|
+
return t;
|
|
3005
|
+
};
|
|
3006
|
+
var r, t = {}, e = Object.prototype, n = e.hasOwnProperty, o = Object.defineProperty || function(a, s, c) {
|
|
3007
|
+
a[s] = c.value;
|
|
3008
|
+
}, i = typeof Symbol == "function" ? Symbol : {}, u = i.iterator || "@@iterator", l = i.asyncIterator || "@@asyncIterator", f = i.toStringTag || "@@toStringTag";
|
|
3009
|
+
function d(a, s, c) {
|
|
3010
|
+
return Object.defineProperty(a, s, { value: c, enumerable: !0, configurable: !0, writable: !0 }), a[s];
|
|
3011
|
+
}
|
|
3012
|
+
try {
|
|
3013
|
+
d({}, "");
|
|
3014
|
+
} catch {
|
|
3015
|
+
d = function(a, s, c) {
|
|
3016
|
+
return a[s] = c;
|
|
3017
|
+
};
|
|
3018
|
+
}
|
|
3019
|
+
function _(a, s, c, v) {
|
|
3020
|
+
var h = s && s.prototype instanceof S ? s : S, w = Object.create(h.prototype), R = new z(v || []);
|
|
3021
|
+
return o(w, "_invoke", { value: q(a, c, R) }), w;
|
|
3022
|
+
}
|
|
3023
|
+
function L(a, s, c) {
|
|
3024
|
+
try {
|
|
3025
|
+
return { type: "normal", arg: a.call(s, c) };
|
|
3026
|
+
} catch (v) {
|
|
3027
|
+
return { type: "throw", arg: v };
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
t.wrap = _;
|
|
3031
|
+
var B = "suspendedStart", K = "suspendedYield", G = "executing", E = "completed", U = {};
|
|
3032
|
+
function S() {
|
|
3033
|
+
}
|
|
3034
|
+
function y() {
|
|
3035
|
+
}
|
|
3036
|
+
function g() {
|
|
3037
|
+
}
|
|
3038
|
+
var m = {};
|
|
3039
|
+
d(m, u, function() {
|
|
3040
|
+
return this;
|
|
3041
|
+
});
|
|
3042
|
+
var p = Object.getPrototypeOf, x = p && p(p($([])));
|
|
3043
|
+
x && x !== e && n.call(x, u) && (m = x);
|
|
3044
|
+
var k = g.prototype = S.prototype = Object.create(m);
|
|
3045
|
+
function C(a) {
|
|
3046
|
+
["next", "throw", "return"].forEach(function(s) {
|
|
3047
|
+
d(a, s, function(c) {
|
|
3048
|
+
return this._invoke(s, c);
|
|
3049
|
+
});
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3052
|
+
function O(a, s) {
|
|
3053
|
+
function c(h, w, R, A) {
|
|
3054
|
+
var j = L(a[h], a, w);
|
|
3055
|
+
if (j.type !== "throw") {
|
|
3056
|
+
var M = j.arg, Y = M.value;
|
|
3057
|
+
return Y && Z(Y) == "object" && n.call(Y, "__await") ? s.resolve(Y.__await).then(function(H) {
|
|
3058
|
+
c("next", H, R, A);
|
|
3059
|
+
}, function(H) {
|
|
3060
|
+
c("throw", H, R, A);
|
|
3061
|
+
}) : s.resolve(Y).then(function(H) {
|
|
3062
|
+
M.value = H, R(M);
|
|
3063
|
+
}, function(H) {
|
|
3064
|
+
return c("throw", H, R, A);
|
|
3065
|
+
});
|
|
3066
|
+
}
|
|
3067
|
+
A(j.arg);
|
|
3068
|
+
}
|
|
3069
|
+
var v;
|
|
3070
|
+
o(this, "_invoke", { value: function(h, w) {
|
|
3071
|
+
function R() {
|
|
3072
|
+
return new s(function(A, j) {
|
|
3073
|
+
c(h, w, A, j);
|
|
3074
|
+
});
|
|
3075
|
+
}
|
|
3076
|
+
return v = v ? v.then(R, R) : R();
|
|
3077
|
+
} });
|
|
3078
|
+
}
|
|
3079
|
+
function q(a, s, c) {
|
|
3080
|
+
var v = B;
|
|
3081
|
+
return function(h, w) {
|
|
3082
|
+
if (v === G) throw Error("Generator is already running");
|
|
3083
|
+
if (v === E) {
|
|
3084
|
+
if (h === "throw") throw w;
|
|
3085
|
+
return { value: r, done: !0 };
|
|
3086
|
+
}
|
|
3087
|
+
for (c.method = h, c.arg = w; ; ) {
|
|
3088
|
+
var R = c.delegate;
|
|
3089
|
+
if (R) {
|
|
3090
|
+
var A = P(R, c);
|
|
3091
|
+
if (A) {
|
|
3092
|
+
if (A === U) continue;
|
|
3093
|
+
return A;
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
if (c.method === "next") c.sent = c._sent = c.arg;
|
|
3097
|
+
else if (c.method === "throw") {
|
|
3098
|
+
if (v === B) throw v = E, c.arg;
|
|
3099
|
+
c.dispatchException(c.arg);
|
|
3100
|
+
} else c.method === "return" && c.abrupt("return", c.arg);
|
|
3101
|
+
v = G;
|
|
3102
|
+
var j = L(a, s, c);
|
|
3103
|
+
if (j.type === "normal") {
|
|
3104
|
+
if (v = c.done ? E : K, j.arg === U) continue;
|
|
3105
|
+
return { value: j.arg, done: c.done };
|
|
3106
|
+
}
|
|
3107
|
+
j.type === "throw" && (v = E, c.method = "throw", c.arg = j.arg);
|
|
3108
|
+
}
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
function P(a, s) {
|
|
3112
|
+
var c = s.method, v = a.iterator[c];
|
|
3113
|
+
if (v === r) return s.delegate = null, c === "throw" && a.iterator.return && (s.method = "return", s.arg = r, P(a, s), s.method === "throw") || c !== "return" && (s.method = "throw", s.arg = new TypeError("The iterator does not provide a '" + c + "' method")), U;
|
|
3114
|
+
var h = L(v, a.iterator, s.arg);
|
|
3115
|
+
if (h.type === "throw") return s.method = "throw", s.arg = h.arg, s.delegate = null, U;
|
|
3116
|
+
var w = h.arg;
|
|
3117
|
+
return w ? w.done ? (s[a.resultName] = w.value, s.next = a.nextLoc, s.method !== "return" && (s.method = "next", s.arg = r), s.delegate = null, U) : w : (s.method = "throw", s.arg = new TypeError("iterator result is not an object"), s.delegate = null, U);
|
|
3118
|
+
}
|
|
3119
|
+
function N(a) {
|
|
3120
|
+
var s = { tryLoc: a[0] };
|
|
3121
|
+
1 in a && (s.catchLoc = a[1]), 2 in a && (s.finallyLoc = a[2], s.afterLoc = a[3]), this.tryEntries.push(s);
|
|
3122
|
+
}
|
|
3123
|
+
function b(a) {
|
|
3124
|
+
var s = a.completion || {};
|
|
3125
|
+
s.type = "normal", delete s.arg, a.completion = s;
|
|
3126
|
+
}
|
|
3127
|
+
function z(a) {
|
|
3128
|
+
this.tryEntries = [{ tryLoc: "root" }], a.forEach(N, this), this.reset(!0);
|
|
3129
|
+
}
|
|
3130
|
+
function $(a) {
|
|
3131
|
+
if (a || a === "") {
|
|
3132
|
+
var s = a[u];
|
|
3133
|
+
if (s) return s.call(a);
|
|
3134
|
+
if (typeof a.next == "function") return a;
|
|
3135
|
+
if (!isNaN(a.length)) {
|
|
3136
|
+
var c = -1, v = function h() {
|
|
3137
|
+
for (; ++c < a.length; ) if (n.call(a, c)) return h.value = a[c], h.done = !1, h;
|
|
3138
|
+
return h.value = r, h.done = !0, h;
|
|
3139
|
+
};
|
|
3140
|
+
return v.next = v;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
throw new TypeError(Z(a) + " is not iterable");
|
|
3144
|
+
}
|
|
3145
|
+
return y.prototype = g, o(k, "constructor", { value: g, configurable: !0 }), o(g, "constructor", { value: y, configurable: !0 }), y.displayName = d(g, f, "GeneratorFunction"), t.isGeneratorFunction = function(a) {
|
|
3146
|
+
var s = typeof a == "function" && a.constructor;
|
|
3147
|
+
return !!s && (s === y || (s.displayName || s.name) === "GeneratorFunction");
|
|
3148
|
+
}, t.mark = function(a) {
|
|
3149
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(a, g) : (a.__proto__ = g, d(a, f, "GeneratorFunction")), a.prototype = Object.create(k), a;
|
|
3150
|
+
}, t.awrap = function(a) {
|
|
3151
|
+
return { __await: a };
|
|
3152
|
+
}, C(O.prototype), d(O.prototype, l, function() {
|
|
3153
|
+
return this;
|
|
3154
|
+
}), t.AsyncIterator = O, t.async = function(a, s, c, v, h) {
|
|
3155
|
+
h === void 0 && (h = Promise);
|
|
3156
|
+
var w = new O(_(a, s, c, v), h);
|
|
3157
|
+
return t.isGeneratorFunction(s) ? w : w.next().then(function(R) {
|
|
3158
|
+
return R.done ? R.value : w.next();
|
|
3159
|
+
});
|
|
3160
|
+
}, C(k), d(k, f, "Generator"), d(k, u, function() {
|
|
3161
|
+
return this;
|
|
3162
|
+
}), d(k, "toString", function() {
|
|
3163
|
+
return "[object Generator]";
|
|
3164
|
+
}), t.keys = function(a) {
|
|
3165
|
+
var s = Object(a), c = [];
|
|
3166
|
+
for (var v in s) c.push(v);
|
|
3167
|
+
return c.reverse(), function h() {
|
|
3168
|
+
for (; c.length; ) {
|
|
3169
|
+
var w = c.pop();
|
|
3170
|
+
if (w in s) return h.value = w, h.done = !1, h;
|
|
3171
|
+
}
|
|
3172
|
+
return h.done = !0, h;
|
|
3173
|
+
};
|
|
3174
|
+
}, t.values = $, z.prototype = { constructor: z, reset: function(a) {
|
|
3175
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = r, this.done = !1, this.delegate = null, this.method = "next", this.arg = r, this.tryEntries.forEach(b), !a) for (var s in this) s.charAt(0) === "t" && n.call(this, s) && !isNaN(+s.slice(1)) && (this[s] = r);
|
|
3176
|
+
}, stop: function() {
|
|
3177
|
+
this.done = !0;
|
|
3178
|
+
var a = this.tryEntries[0].completion;
|
|
3179
|
+
if (a.type === "throw") throw a.arg;
|
|
3180
|
+
return this.rval;
|
|
3181
|
+
}, dispatchException: function(a) {
|
|
3182
|
+
if (this.done) throw a;
|
|
3183
|
+
var s = this;
|
|
3184
|
+
function c(j, M) {
|
|
3185
|
+
return w.type = "throw", w.arg = a, s.next = j, M && (s.method = "next", s.arg = r), !!M;
|
|
3186
|
+
}
|
|
3187
|
+
for (var v = this.tryEntries.length - 1; v >= 0; --v) {
|
|
3188
|
+
var h = this.tryEntries[v], w = h.completion;
|
|
3189
|
+
if (h.tryLoc === "root") return c("end");
|
|
3190
|
+
if (h.tryLoc <= this.prev) {
|
|
3191
|
+
var R = n.call(h, "catchLoc"), A = n.call(h, "finallyLoc");
|
|
3192
|
+
if (R && A) {
|
|
3193
|
+
if (this.prev < h.catchLoc) return c(h.catchLoc, !0);
|
|
3194
|
+
if (this.prev < h.finallyLoc) return c(h.finallyLoc);
|
|
3195
|
+
} else if (R) {
|
|
3196
|
+
if (this.prev < h.catchLoc) return c(h.catchLoc, !0);
|
|
3197
|
+
} else {
|
|
3198
|
+
if (!A) throw Error("try statement without catch or finally");
|
|
3199
|
+
if (this.prev < h.finallyLoc) return c(h.finallyLoc);
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
}, abrupt: function(a, s) {
|
|
3204
|
+
for (var c = this.tryEntries.length - 1; c >= 0; --c) {
|
|
3205
|
+
var v = this.tryEntries[c];
|
|
3206
|
+
if (v.tryLoc <= this.prev && n.call(v, "finallyLoc") && this.prev < v.finallyLoc) {
|
|
3207
|
+
var h = v;
|
|
3208
|
+
break;
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
h && (a === "break" || a === "continue") && h.tryLoc <= s && s <= h.finallyLoc && (h = null);
|
|
3212
|
+
var w = h ? h.completion : {};
|
|
3213
|
+
return w.type = a, w.arg = s, h ? (this.method = "next", this.next = h.finallyLoc, U) : this.complete(w);
|
|
3214
|
+
}, complete: function(a, s) {
|
|
3215
|
+
if (a.type === "throw") throw a.arg;
|
|
3216
|
+
return a.type === "break" || a.type === "continue" ? this.next = a.arg : a.type === "return" ? (this.rval = this.arg = a.arg, this.method = "return", this.next = "end") : a.type === "normal" && s && (this.next = s), U;
|
|
3217
|
+
}, finish: function(a) {
|
|
3218
|
+
for (var s = this.tryEntries.length - 1; s >= 0; --s) {
|
|
3219
|
+
var c = this.tryEntries[s];
|
|
3220
|
+
if (c.finallyLoc === a) return this.complete(c.completion, c.afterLoc), b(c), U;
|
|
3221
|
+
}
|
|
3222
|
+
}, catch: function(a) {
|
|
3223
|
+
for (var s = this.tryEntries.length - 1; s >= 0; --s) {
|
|
3224
|
+
var c = this.tryEntries[s];
|
|
3225
|
+
if (c.tryLoc === a) {
|
|
3226
|
+
var v = c.completion;
|
|
3227
|
+
if (v.type === "throw") {
|
|
3228
|
+
var h = v.arg;
|
|
3229
|
+
b(c);
|
|
3230
|
+
}
|
|
3231
|
+
return h;
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
throw Error("illegal catch attempt");
|
|
3235
|
+
}, delegateYield: function(a, s, c) {
|
|
3236
|
+
return this.delegate = { iterator: $(a), resultName: s, nextLoc: c }, this.method === "next" && (this.arg = r), U;
|
|
3237
|
+
} }, t;
|
|
3238
|
+
}
|
|
3239
|
+
function Te(r, t, e, n, o, i, u) {
|
|
3240
|
+
try {
|
|
3241
|
+
var l = r[i](u), f = l.value;
|
|
3242
|
+
} catch (d) {
|
|
3243
|
+
e(d);
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
l.done ? t(f) : Promise.resolve(f).then(n, o);
|
|
3247
|
+
}
|
|
3248
|
+
function no(r) {
|
|
3249
|
+
return function() {
|
|
3250
|
+
var t = this, e = arguments;
|
|
3251
|
+
return new Promise(function(n, o) {
|
|
3252
|
+
var i = r.apply(t, e);
|
|
3253
|
+
function u(f) {
|
|
3254
|
+
Te(i, n, o, u, l, "next", f);
|
|
3255
|
+
}
|
|
3256
|
+
function l(f) {
|
|
3257
|
+
Te(i, n, o, u, l, "throw", f);
|
|
3258
|
+
}
|
|
3259
|
+
u(void 0);
|
|
3260
|
+
});
|
|
3261
|
+
};
|
|
3262
|
+
}
|
|
3263
|
+
function mr(r, t) {
|
|
3264
|
+
return so(r) || io(r, t) || vr(r, t) || oo();
|
|
3265
|
+
}
|
|
3266
|
+
function oo() {
|
|
3267
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3268
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
3269
|
+
}
|
|
3270
|
+
function io(r, t) {
|
|
3271
|
+
var e = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
|
|
3272
|
+
if (e != null) {
|
|
3273
|
+
var n, o, i, u, l = [], f = !0, d = !1;
|
|
3274
|
+
try {
|
|
3275
|
+
if (i = (e = e.call(r)).next, t !== 0) for (; !(f = (n = i.call(e)).done) && (l.push(n.value), l.length !== t); f = !0) ;
|
|
3276
|
+
} catch (_) {
|
|
3277
|
+
d = !0, o = _;
|
|
3278
|
+
} finally {
|
|
3279
|
+
try {
|
|
3280
|
+
if (!f && e.return != null && (u = e.return(), Object(u) !== u)) return;
|
|
3281
|
+
} finally {
|
|
3282
|
+
if (d) throw o;
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
return l;
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
function so(r) {
|
|
3289
|
+
if (Array.isArray(r)) return r;
|
|
3290
|
+
}
|
|
3291
|
+
function Z(r) {
|
|
3292
|
+
"@babel/helpers - typeof";
|
|
3293
|
+
return Z = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
3294
|
+
return typeof t;
|
|
3295
|
+
} : function(t) {
|
|
3296
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
3297
|
+
}, Z(r);
|
|
3298
|
+
}
|
|
3299
|
+
function ao(r, t) {
|
|
3300
|
+
var e = typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
|
|
3301
|
+
if (!e) {
|
|
3302
|
+
if (Array.isArray(r) || (e = vr(r)) || t) {
|
|
3303
|
+
e && (r = e);
|
|
3304
|
+
var n = 0, o = function() {
|
|
3305
|
+
};
|
|
3306
|
+
return { s: o, n: function() {
|
|
3307
|
+
return n >= r.length ? { done: !0 } : { done: !1, value: r[n++] };
|
|
3308
|
+
}, e: function(f) {
|
|
3309
|
+
throw f;
|
|
3310
|
+
}, f: o };
|
|
3311
|
+
}
|
|
3312
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
3313
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
3314
|
+
}
|
|
3315
|
+
var i = !0, u = !1, l;
|
|
3316
|
+
return { s: function() {
|
|
3317
|
+
e = e.call(r);
|
|
3318
|
+
}, n: function() {
|
|
3319
|
+
var f = e.next();
|
|
3320
|
+
return i = f.done, f;
|
|
3321
|
+
}, e: function(f) {
|
|
3322
|
+
u = !0, l = f;
|
|
3323
|
+
}, f: function() {
|
|
3324
|
+
try {
|
|
3325
|
+
!i && e.return != null && e.return();
|
|
3326
|
+
} finally {
|
|
3327
|
+
if (u) throw l;
|
|
3328
|
+
}
|
|
3329
|
+
} };
|
|
3330
|
+
}
|
|
3331
|
+
function vr(r, t) {
|
|
3332
|
+
if (r) {
|
|
3333
|
+
if (typeof r == "string") return Ce(r, t);
|
|
3334
|
+
var e = Object.prototype.toString.call(r).slice(8, -1);
|
|
3335
|
+
if (e === "Object" && r.constructor && (e = r.constructor.name), e === "Map" || e === "Set") return Array.from(r);
|
|
3336
|
+
if (e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)) return Ce(r, t);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
function Ce(r, t) {
|
|
3340
|
+
(t == null || t > r.length) && (t = r.length);
|
|
3341
|
+
for (var e = 0, n = new Array(t); e < t; e++) n[e] = r[e];
|
|
3342
|
+
return n;
|
|
3343
|
+
}
|
|
3344
|
+
function Pe(r, t) {
|
|
3345
|
+
var e = Object.keys(r);
|
|
3346
|
+
if (Object.getOwnPropertySymbols) {
|
|
3347
|
+
var n = Object.getOwnPropertySymbols(r);
|
|
3348
|
+
t && (n = n.filter(function(o) {
|
|
3349
|
+
return Object.getOwnPropertyDescriptor(r, o).enumerable;
|
|
3350
|
+
})), e.push.apply(e, n);
|
|
3351
|
+
}
|
|
3352
|
+
return e;
|
|
3353
|
+
}
|
|
3354
|
+
function et(r) {
|
|
3355
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
3356
|
+
var e = arguments[t] != null ? arguments[t] : {};
|
|
3357
|
+
t % 2 ? Pe(Object(e), !0).forEach(function(n) {
|
|
3358
|
+
uo(r, n, e[n]);
|
|
3359
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : Pe(Object(e)).forEach(function(n) {
|
|
3360
|
+
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
|
|
3361
|
+
});
|
|
3362
|
+
}
|
|
3363
|
+
return r;
|
|
3364
|
+
}
|
|
3365
|
+
function uo(r, t, e) {
|
|
3366
|
+
return t = br(t), t in r ? Object.defineProperty(r, t, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = e, r;
|
|
3367
|
+
}
|
|
3368
|
+
function co(r, t) {
|
|
3369
|
+
if (!(r instanceof t))
|
|
3370
|
+
throw new TypeError("Cannot call a class as a function");
|
|
3371
|
+
}
|
|
3372
|
+
function Le(r, t) {
|
|
3373
|
+
for (var e = 0; e < t.length; e++) {
|
|
3374
|
+
var n = t[e];
|
|
3375
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, br(n.key), n);
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
function lo(r, t, e) {
|
|
3379
|
+
return t && Le(r.prototype, t), e && Le(r, e), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
3380
|
+
}
|
|
3381
|
+
function br(r) {
|
|
3382
|
+
var t = ho(r, "string");
|
|
3383
|
+
return Z(t) == "symbol" ? t : t + "";
|
|
3384
|
+
}
|
|
3385
|
+
function ho(r, t) {
|
|
3386
|
+
if (Z(r) != "object" || !r) return r;
|
|
3387
|
+
var e = r[Symbol.toPrimitive];
|
|
3388
|
+
if (e !== void 0) {
|
|
3389
|
+
var n = e.call(r, t);
|
|
3390
|
+
if (Z(n) != "object") return n;
|
|
3391
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3392
|
+
}
|
|
3393
|
+
return String(r);
|
|
3394
|
+
}
|
|
3395
|
+
var Tt = "tus-v1", Ct = "ietf-draft-03", lt = "ietf-draft-05", po = {
|
|
3396
|
+
endpoint: null,
|
|
3397
|
+
uploadUrl: null,
|
|
3398
|
+
metadata: {},
|
|
3399
|
+
metadataForPartialUploads: {},
|
|
3400
|
+
fingerprint: null,
|
|
3401
|
+
uploadSize: null,
|
|
3402
|
+
onProgress: null,
|
|
3403
|
+
onChunkComplete: null,
|
|
3404
|
+
onSuccess: null,
|
|
3405
|
+
onError: null,
|
|
3406
|
+
onUploadUrlAvailable: null,
|
|
3407
|
+
overridePatchMethod: !1,
|
|
3408
|
+
headers: {},
|
|
3409
|
+
addRequestId: !1,
|
|
3410
|
+
onBeforeRequest: null,
|
|
3411
|
+
onAfterResponse: null,
|
|
3412
|
+
onShouldRetry: wr,
|
|
3413
|
+
chunkSize: Number.POSITIVE_INFINITY,
|
|
3414
|
+
retryDelays: [0, 1e3, 3e3, 5e3],
|
|
3415
|
+
parallelUploads: 1,
|
|
3416
|
+
parallelUploadBoundaries: null,
|
|
3417
|
+
storeFingerprintForResuming: !0,
|
|
3418
|
+
removeFingerprintOnSuccess: !1,
|
|
3419
|
+
uploadLengthDeferred: !1,
|
|
3420
|
+
uploadDataDuringCreation: !1,
|
|
3421
|
+
urlStorage: null,
|
|
3422
|
+
fileReader: null,
|
|
3423
|
+
httpStack: null,
|
|
3424
|
+
protocol: Tt
|
|
3425
|
+
}, _r = /* @__PURE__ */ (function() {
|
|
3426
|
+
function r(t, e) {
|
|
3427
|
+
co(this, r), "resume" in e && console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."), this.options = e, this.options.chunkSize = Number(this.options.chunkSize), this._urlStorage = this.options.urlStorage, this.file = t, this.url = null, this._req = null, this._fingerprint = null, this._urlStorageKey = null, this._offset = null, this._aborted = !1, this._size = null, this._source = null, this._retryAttempt = 0, this._retryTimeout = null, this._offsetBeforeRetry = 0, this._parallelUploads = null, this._parallelUploadUrls = null;
|
|
3428
|
+
}
|
|
3429
|
+
return lo(r, [{
|
|
3430
|
+
key: "findPreviousUploads",
|
|
3431
|
+
value: function() {
|
|
3432
|
+
var t = this;
|
|
3433
|
+
return this.options.fingerprint(this.file, this.options).then(function(e) {
|
|
3434
|
+
return t._urlStorage.findUploadsByFingerprint(e);
|
|
3435
|
+
});
|
|
3436
|
+
}
|
|
3437
|
+
}, {
|
|
3438
|
+
key: "resumeFromPreviousUpload",
|
|
3439
|
+
value: function(t) {
|
|
3440
|
+
this.url = t.uploadUrl || null, this._parallelUploadUrls = t.parallelUploadUrls || null, this._urlStorageKey = t.urlStorageKey;
|
|
3441
|
+
}
|
|
3442
|
+
}, {
|
|
3443
|
+
key: "start",
|
|
3444
|
+
value: function() {
|
|
3445
|
+
var t = this, e = this.file;
|
|
3446
|
+
if (!e) {
|
|
3447
|
+
this._emitError(new Error("tus: no file or stream to upload provided"));
|
|
3448
|
+
return;
|
|
3449
|
+
}
|
|
3450
|
+
if (![Tt, Ct, lt].includes(this.options.protocol)) {
|
|
3451
|
+
this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));
|
|
3452
|
+
return;
|
|
3453
|
+
}
|
|
3454
|
+
if (!this.options.endpoint && !this.options.uploadUrl && !this.url) {
|
|
3455
|
+
this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));
|
|
3456
|
+
return;
|
|
3457
|
+
}
|
|
3458
|
+
var n = this.options.retryDelays;
|
|
3459
|
+
if (n != null && Object.prototype.toString.call(n) !== "[object Array]") {
|
|
3460
|
+
this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));
|
|
3461
|
+
return;
|
|
3462
|
+
}
|
|
3463
|
+
if (this.options.parallelUploads > 1)
|
|
3464
|
+
for (var o = 0, i = ["uploadUrl", "uploadSize", "uploadLengthDeferred"]; o < i.length; o++) {
|
|
3465
|
+
var u = i[o];
|
|
3466
|
+
if (this.options[u]) {
|
|
3467
|
+
this._emitError(new Error("tus: cannot use the ".concat(u, " option when parallelUploads is enabled")));
|
|
3468
|
+
return;
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
if (this.options.parallelUploadBoundaries) {
|
|
3472
|
+
if (this.options.parallelUploads <= 1) {
|
|
3473
|
+
this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));
|
|
3474
|
+
return;
|
|
3475
|
+
}
|
|
3476
|
+
if (this.options.parallelUploads !== this.options.parallelUploadBoundaries.length) {
|
|
3477
|
+
this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));
|
|
3478
|
+
return;
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
this.options.fingerprint(e, this.options).then(function(l) {
|
|
3482
|
+
return t._fingerprint = l, t._source ? t._source : t.options.fileReader.openFile(e, t.options.chunkSize);
|
|
3483
|
+
}).then(function(l) {
|
|
3484
|
+
if (t._source = l, t.options.uploadLengthDeferred)
|
|
3485
|
+
t._size = null;
|
|
3486
|
+
else if (t.options.uploadSize != null) {
|
|
3487
|
+
if (t._size = Number(t.options.uploadSize), Number.isNaN(t._size)) {
|
|
3488
|
+
t._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));
|
|
3489
|
+
return;
|
|
3490
|
+
}
|
|
3491
|
+
} else if (t._size = t._source.size, t._size == null) {
|
|
3492
|
+
t._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));
|
|
3493
|
+
return;
|
|
3494
|
+
}
|
|
3495
|
+
t.options.parallelUploads > 1 || t._parallelUploadUrls != null ? t._startParallelUpload() : t._startSingleUpload();
|
|
3496
|
+
}).catch(function(l) {
|
|
3497
|
+
t._emitError(l);
|
|
3498
|
+
});
|
|
3499
|
+
}
|
|
3500
|
+
/**
|
|
3501
|
+
* Initiate the uploading procedure for a parallelized upload, where one file is split into
|
|
3502
|
+
* multiple request which are run in parallel.
|
|
3503
|
+
*
|
|
3504
|
+
* @api private
|
|
3505
|
+
*/
|
|
3506
|
+
}, {
|
|
3507
|
+
key: "_startParallelUpload",
|
|
3508
|
+
value: function() {
|
|
3509
|
+
var t, e = this, n = this._size, o = 0;
|
|
3510
|
+
this._parallelUploads = [];
|
|
3511
|
+
var i = this._parallelUploadUrls != null ? this._parallelUploadUrls.length : this.options.parallelUploads, u = (t = this.options.parallelUploadBoundaries) !== null && t !== void 0 ? t : yo(this._source.size, i);
|
|
3512
|
+
this._parallelUploadUrls && u.forEach(function(d, _) {
|
|
3513
|
+
d.uploadUrl = e._parallelUploadUrls[_] || null;
|
|
3514
|
+
}), this._parallelUploadUrls = new Array(u.length);
|
|
3515
|
+
var l = u.map(function(d, _) {
|
|
3516
|
+
var L = 0;
|
|
3517
|
+
return e._source.slice(d.start, d.end).then(function(B) {
|
|
3518
|
+
var K = B.value;
|
|
3519
|
+
return new Promise(function(G, E) {
|
|
3520
|
+
var U = et(et({}, e.options), {}, {
|
|
3521
|
+
// If available, the partial upload should be resumed from a previous URL.
|
|
3522
|
+
uploadUrl: d.uploadUrl || null,
|
|
3523
|
+
// We take manually care of resuming for partial uploads, so they should
|
|
3524
|
+
// not be stored in the URL storage.
|
|
3525
|
+
storeFingerprintForResuming: !1,
|
|
3526
|
+
removeFingerprintOnSuccess: !1,
|
|
3527
|
+
// Reset the parallelUploads option to not cause recursion.
|
|
3528
|
+
parallelUploads: 1,
|
|
3529
|
+
// Reset this option as we are not doing a parallel upload.
|
|
3530
|
+
parallelUploadBoundaries: null,
|
|
3531
|
+
metadata: e.options.metadataForPartialUploads,
|
|
3532
|
+
// Add the header to indicate the this is a partial upload.
|
|
3533
|
+
headers: et(et({}, e.options.headers), {}, {
|
|
3534
|
+
"Upload-Concat": "partial"
|
|
3535
|
+
}),
|
|
3536
|
+
// Reject or resolve the promise if the upload errors or completes.
|
|
3537
|
+
onSuccess: G,
|
|
3538
|
+
onError: E,
|
|
3539
|
+
// Based in the progress for this partial upload, calculate the progress
|
|
3540
|
+
// for the entire final upload.
|
|
3541
|
+
onProgress: function(y) {
|
|
3542
|
+
o = o - L + y, L = y, e._emitProgress(o, n);
|
|
3543
|
+
},
|
|
3544
|
+
// Wait until every partial upload has an upload URL, so we can add
|
|
3545
|
+
// them to the URL storage.
|
|
3546
|
+
onUploadUrlAvailable: function() {
|
|
3547
|
+
e._parallelUploadUrls[_] = S.url, e._parallelUploadUrls.filter(function(y) {
|
|
3548
|
+
return !!y;
|
|
3549
|
+
}).length === u.length && e._saveUploadInUrlStorage();
|
|
3550
|
+
}
|
|
3551
|
+
}), S = new r(K, U);
|
|
3552
|
+
S.start(), e._parallelUploads.push(S);
|
|
3553
|
+
});
|
|
3554
|
+
});
|
|
3555
|
+
}), f;
|
|
3556
|
+
Promise.all(l).then(function() {
|
|
3557
|
+
f = e._openRequest("POST", e.options.endpoint), f.setHeader("Upload-Concat", "final;".concat(e._parallelUploadUrls.join(" ")));
|
|
3558
|
+
var d = Ae(e.options.metadata);
|
|
3559
|
+
return d !== "" && f.setHeader("Upload-Metadata", d), e._sendRequest(f, null);
|
|
3560
|
+
}).then(function(d) {
|
|
3561
|
+
if (!rt(d.getStatus(), 200)) {
|
|
3562
|
+
e._emitHttpError(f, d, "tus: unexpected response while creating upload");
|
|
3563
|
+
return;
|
|
3564
|
+
}
|
|
3565
|
+
var _ = d.getHeader("Location");
|
|
3566
|
+
if (_ == null) {
|
|
3567
|
+
e._emitHttpError(f, d, "tus: invalid or missing Location header");
|
|
3568
|
+
return;
|
|
3569
|
+
}
|
|
3570
|
+
e.url = Ie(e.options.endpoint, _), "Created upload at ".concat(e.url), e._emitSuccess(d);
|
|
3571
|
+
}).catch(function(d) {
|
|
3572
|
+
e._emitError(d);
|
|
3573
|
+
});
|
|
3574
|
+
}
|
|
3575
|
+
/**
|
|
3576
|
+
* Initiate the uploading procedure for a non-parallel upload. Here the entire file is
|
|
3577
|
+
* uploaded in a sequential matter.
|
|
3578
|
+
*
|
|
3579
|
+
* @api private
|
|
3580
|
+
*/
|
|
3581
|
+
}, {
|
|
3582
|
+
key: "_startSingleUpload",
|
|
3583
|
+
value: function() {
|
|
3584
|
+
if (this._aborted = !1, this.url != null) {
|
|
3585
|
+
"Resuming upload from previous URL: ".concat(this.url), this._resumeUpload();
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
if (this.options.uploadUrl != null) {
|
|
3589
|
+
"Resuming upload from provided URL: ".concat(this.options.uploadUrl), this.url = this.options.uploadUrl, this._resumeUpload();
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3592
|
+
this._createUpload();
|
|
3593
|
+
}
|
|
3594
|
+
/**
|
|
3595
|
+
* Abort any running request and stop the current upload. After abort is called, no event
|
|
3596
|
+
* handler will be invoked anymore. You can use the `start` method to resume the upload
|
|
3597
|
+
* again.
|
|
3598
|
+
* If `shouldTerminate` is true, the `terminate` function will be called to remove the
|
|
3599
|
+
* current upload from the server.
|
|
3600
|
+
*
|
|
3601
|
+
* @param {boolean} shouldTerminate True if the upload should be deleted from the server.
|
|
3602
|
+
* @return {Promise} The Promise will be resolved/rejected when the requests finish.
|
|
3603
|
+
*/
|
|
3604
|
+
}, {
|
|
3605
|
+
key: "abort",
|
|
3606
|
+
value: function(t) {
|
|
3607
|
+
var e = this;
|
|
3608
|
+
if (this._parallelUploads != null) {
|
|
3609
|
+
var n = ao(this._parallelUploads), o;
|
|
3610
|
+
try {
|
|
3611
|
+
for (n.s(); !(o = n.n()).done; ) {
|
|
3612
|
+
var i = o.value;
|
|
3613
|
+
i.abort(t);
|
|
3614
|
+
}
|
|
3615
|
+
} catch (u) {
|
|
3616
|
+
n.e(u);
|
|
3617
|
+
} finally {
|
|
3618
|
+
n.f();
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
return this._req !== null && this._req.abort(), this._aborted = !0, this._retryTimeout != null && (clearTimeout(this._retryTimeout), this._retryTimeout = null), !t || this.url == null ? Promise.resolve() : r.terminate(this.url, this.options).then(function() {
|
|
3622
|
+
return e._removeFromUrlStorage();
|
|
3623
|
+
});
|
|
3624
|
+
}
|
|
3625
|
+
}, {
|
|
3626
|
+
key: "_emitHttpError",
|
|
3627
|
+
value: function(t, e, n, o) {
|
|
3628
|
+
this._emitError(new wt(n, o, t, e));
|
|
3629
|
+
}
|
|
3630
|
+
}, {
|
|
3631
|
+
key: "_emitError",
|
|
3632
|
+
value: function(t) {
|
|
3633
|
+
var e = this;
|
|
3634
|
+
if (!this._aborted) {
|
|
3635
|
+
if (this.options.retryDelays != null) {
|
|
3636
|
+
var n = this._offset != null && this._offset > this._offsetBeforeRetry;
|
|
3637
|
+
if (n && (this._retryAttempt = 0), Ne(t, this._retryAttempt, this.options)) {
|
|
3638
|
+
var o = this.options.retryDelays[this._retryAttempt++];
|
|
3639
|
+
this._offsetBeforeRetry = this._offset, this._retryTimeout = setTimeout(function() {
|
|
3640
|
+
e.start();
|
|
3641
|
+
}, o);
|
|
3642
|
+
return;
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
if (typeof this.options.onError == "function")
|
|
3646
|
+
this.options.onError(t);
|
|
3647
|
+
else
|
|
3648
|
+
throw t;
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
/**
|
|
3652
|
+
* Publishes notification if the upload has been successfully completed.
|
|
3653
|
+
*
|
|
3654
|
+
* @param {object} lastResponse Last HTTP response.
|
|
3655
|
+
* @api private
|
|
3656
|
+
*/
|
|
3657
|
+
}, {
|
|
3658
|
+
key: "_emitSuccess",
|
|
3659
|
+
value: function(t) {
|
|
3660
|
+
this.options.removeFingerprintOnSuccess && this._removeFromUrlStorage(), typeof this.options.onSuccess == "function" && this.options.onSuccess({
|
|
3661
|
+
lastResponse: t
|
|
3662
|
+
});
|
|
3663
|
+
}
|
|
3664
|
+
/**
|
|
3665
|
+
* Publishes notification when data has been sent to the server. This
|
|
3666
|
+
* data may not have been accepted by the server yet.
|
|
3667
|
+
*
|
|
3668
|
+
* @param {number} bytesSent Number of bytes sent to the server.
|
|
3669
|
+
* @param {number} bytesTotal Total number of bytes to be sent to the server.
|
|
3670
|
+
* @api private
|
|
3671
|
+
*/
|
|
3672
|
+
}, {
|
|
3673
|
+
key: "_emitProgress",
|
|
3674
|
+
value: function(t, e) {
|
|
3675
|
+
typeof this.options.onProgress == "function" && this.options.onProgress(t, e);
|
|
3676
|
+
}
|
|
3677
|
+
/**
|
|
3678
|
+
* Publishes notification when a chunk of data has been sent to the server
|
|
3679
|
+
* and accepted by the server.
|
|
3680
|
+
* @param {number} chunkSize Size of the chunk that was accepted by the server.
|
|
3681
|
+
* @param {number} bytesAccepted Total number of bytes that have been
|
|
3682
|
+
* accepted by the server.
|
|
3683
|
+
* @param {number} bytesTotal Total number of bytes to be sent to the server.
|
|
3684
|
+
* @api private
|
|
3685
|
+
*/
|
|
3686
|
+
}, {
|
|
3687
|
+
key: "_emitChunkComplete",
|
|
3688
|
+
value: function(t, e, n) {
|
|
3689
|
+
typeof this.options.onChunkComplete == "function" && this.options.onChunkComplete(t, e, n);
|
|
3690
|
+
}
|
|
3691
|
+
/**
|
|
3692
|
+
* Create a new upload using the creation extension by sending a POST
|
|
3693
|
+
* request to the endpoint. After successful creation the file will be
|
|
3694
|
+
* uploaded
|
|
3695
|
+
*
|
|
3696
|
+
* @api private
|
|
3697
|
+
*/
|
|
3698
|
+
}, {
|
|
3699
|
+
key: "_createUpload",
|
|
3700
|
+
value: function() {
|
|
3701
|
+
var t = this;
|
|
3702
|
+
if (!this.options.endpoint) {
|
|
3703
|
+
this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));
|
|
3704
|
+
return;
|
|
3705
|
+
}
|
|
3706
|
+
var e = this._openRequest("POST", this.options.endpoint);
|
|
3707
|
+
this.options.uploadLengthDeferred ? e.setHeader("Upload-Defer-Length", "1") : e.setHeader("Upload-Length", "".concat(this._size));
|
|
3708
|
+
var n = Ae(this.options.metadata);
|
|
3709
|
+
n !== "" && e.setHeader("Upload-Metadata", n);
|
|
3710
|
+
var o;
|
|
3711
|
+
this.options.uploadDataDuringCreation && !this.options.uploadLengthDeferred ? (this._offset = 0, o = this._addChunkToRequest(e)) : ((this.options.protocol === Ct || this.options.protocol === lt) && e.setHeader("Upload-Complete", "?0"), o = this._sendRequest(e, null)), o.then(function(i) {
|
|
3712
|
+
if (!rt(i.getStatus(), 200)) {
|
|
3713
|
+
t._emitHttpError(e, i, "tus: unexpected response while creating upload");
|
|
3714
|
+
return;
|
|
3715
|
+
}
|
|
3716
|
+
var u = i.getHeader("Location");
|
|
3717
|
+
if (u == null) {
|
|
3718
|
+
t._emitHttpError(e, i, "tus: invalid or missing Location header");
|
|
3719
|
+
return;
|
|
3720
|
+
}
|
|
3721
|
+
if (t.url = Ie(t.options.endpoint, u), "Created upload at ".concat(t.url), typeof t.options.onUploadUrlAvailable == "function" && t.options.onUploadUrlAvailable(), t._size === 0) {
|
|
3722
|
+
t._emitSuccess(i), t._source.close();
|
|
3723
|
+
return;
|
|
3724
|
+
}
|
|
3725
|
+
t._saveUploadInUrlStorage().then(function() {
|
|
3726
|
+
t.options.uploadDataDuringCreation ? t._handleUploadResponse(e, i) : (t._offset = 0, t._performUpload());
|
|
3727
|
+
});
|
|
3728
|
+
}).catch(function(i) {
|
|
3729
|
+
t._emitHttpError(e, null, "tus: failed to create upload", i);
|
|
3730
|
+
});
|
|
3731
|
+
}
|
|
3732
|
+
/*
|
|
3733
|
+
* Try to resume an existing upload. First a HEAD request will be sent
|
|
3734
|
+
* to retrieve the offset. If the request fails a new upload will be
|
|
3735
|
+
* created. In the case of a successful response the file will be uploaded.
|
|
3736
|
+
*
|
|
3737
|
+
* @api private
|
|
3738
|
+
*/
|
|
3739
|
+
}, {
|
|
3740
|
+
key: "_resumeUpload",
|
|
3741
|
+
value: function() {
|
|
3742
|
+
var t = this, e = this._openRequest("HEAD", this.url), n = this._sendRequest(e, null);
|
|
3743
|
+
n.then(function(o) {
|
|
3744
|
+
var i = o.getStatus();
|
|
3745
|
+
if (!rt(i, 200)) {
|
|
3746
|
+
if (i === 423) {
|
|
3747
|
+
t._emitHttpError(e, o, "tus: upload is currently locked; retry later");
|
|
3748
|
+
return;
|
|
3749
|
+
}
|
|
3750
|
+
if (rt(i, 400) && t._removeFromUrlStorage(), !t.options.endpoint) {
|
|
3751
|
+
t._emitHttpError(e, o, "tus: unable to resume upload (new upload cannot be created without an endpoint)");
|
|
3752
|
+
return;
|
|
3753
|
+
}
|
|
3754
|
+
t.url = null, t._createUpload();
|
|
3755
|
+
return;
|
|
3756
|
+
}
|
|
3757
|
+
var u = Number.parseInt(o.getHeader("Upload-Offset"), 10);
|
|
3758
|
+
if (Number.isNaN(u)) {
|
|
3759
|
+
t._emitHttpError(e, o, "tus: invalid or missing offset value");
|
|
3760
|
+
return;
|
|
3761
|
+
}
|
|
3762
|
+
var l = Number.parseInt(o.getHeader("Upload-Length"), 10);
|
|
3763
|
+
if (Number.isNaN(l) && !t.options.uploadLengthDeferred && t.options.protocol === Tt) {
|
|
3764
|
+
t._emitHttpError(e, o, "tus: invalid or missing length value");
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3767
|
+
typeof t.options.onUploadUrlAvailable == "function" && t.options.onUploadUrlAvailable(), t._saveUploadInUrlStorage().then(function() {
|
|
3768
|
+
if (u === l) {
|
|
3769
|
+
t._emitProgress(l, l), t._emitSuccess(o);
|
|
3770
|
+
return;
|
|
3771
|
+
}
|
|
3772
|
+
t._offset = u, t._performUpload();
|
|
3773
|
+
});
|
|
3774
|
+
}).catch(function(o) {
|
|
3775
|
+
t._emitHttpError(e, null, "tus: failed to resume upload", o);
|
|
3776
|
+
});
|
|
3777
|
+
}
|
|
3778
|
+
/**
|
|
3779
|
+
* Start uploading the file using PATCH requests. The file will be divided
|
|
3780
|
+
* into chunks as specified in the chunkSize option. During the upload
|
|
3781
|
+
* the onProgress event handler may be invoked multiple times.
|
|
3782
|
+
*
|
|
3783
|
+
* @api private
|
|
3784
|
+
*/
|
|
3785
|
+
}, {
|
|
3786
|
+
key: "_performUpload",
|
|
3787
|
+
value: function() {
|
|
3788
|
+
var t = this;
|
|
3789
|
+
if (!this._aborted) {
|
|
3790
|
+
var e;
|
|
3791
|
+
this.options.overridePatchMethod ? (e = this._openRequest("POST", this.url), e.setHeader("X-HTTP-Method-Override", "PATCH")) : e = this._openRequest("PATCH", this.url), e.setHeader("Upload-Offset", "".concat(this._offset));
|
|
3792
|
+
var n = this._addChunkToRequest(e);
|
|
3793
|
+
n.then(function(o) {
|
|
3794
|
+
if (!rt(o.getStatus(), 200)) {
|
|
3795
|
+
t._emitHttpError(e, o, "tus: unexpected response while uploading chunk");
|
|
3796
|
+
return;
|
|
3797
|
+
}
|
|
3798
|
+
t._handleUploadResponse(e, o);
|
|
3799
|
+
}).catch(function(o) {
|
|
3800
|
+
t._aborted || t._emitHttpError(e, null, "tus: failed to upload chunk at offset ".concat(t._offset), o);
|
|
3801
|
+
});
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
/**
|
|
3805
|
+
* _addChunktoRequest reads a chunk from the source and sends it using the
|
|
3806
|
+
* supplied request object. It will not handle the response.
|
|
3807
|
+
*
|
|
3808
|
+
* @api private
|
|
3809
|
+
*/
|
|
3810
|
+
}, {
|
|
3811
|
+
key: "_addChunkToRequest",
|
|
3812
|
+
value: function(t) {
|
|
3813
|
+
var e = this, n = this._offset, o = this._offset + this.options.chunkSize;
|
|
3814
|
+
return t.setProgressHandler(function(i) {
|
|
3815
|
+
e._emitProgress(n + i, e._size);
|
|
3816
|
+
}), this.options.protocol === Tt ? t.setHeader("Content-Type", "application/offset+octet-stream") : this.options.protocol === lt && t.setHeader("Content-Type", "application/partial-upload"), (o === Number.POSITIVE_INFINITY || o > this._size) && !this.options.uploadLengthDeferred && (o = this._size), this._source.slice(n, o).then(function(i) {
|
|
3817
|
+
var u = i.value, l = i.done, f = u != null && u.size ? u.size : 0;
|
|
3818
|
+
e.options.uploadLengthDeferred && l && (e._size = e._offset + f, t.setHeader("Upload-Length", "".concat(e._size)));
|
|
3819
|
+
var d = e._offset + f;
|
|
3820
|
+
return !e.options.uploadLengthDeferred && l && d !== e._size ? Promise.reject(new Error("upload was configured with a size of ".concat(e._size, " bytes, but the source is done after ").concat(d, " bytes"))) : u === null ? e._sendRequest(t) : ((e.options.protocol === Ct || e.options.protocol === lt) && t.setHeader("Upload-Complete", l ? "?1" : "?0"), e._emitProgress(e._offset, e._size), e._sendRequest(t, u));
|
|
3821
|
+
});
|
|
3822
|
+
}
|
|
3823
|
+
/**
|
|
3824
|
+
* _handleUploadResponse is used by requests that haven been sent using _addChunkToRequest
|
|
3825
|
+
* and already have received a response.
|
|
3826
|
+
*
|
|
3827
|
+
* @api private
|
|
3828
|
+
*/
|
|
3829
|
+
}, {
|
|
3830
|
+
key: "_handleUploadResponse",
|
|
3831
|
+
value: function(t, e) {
|
|
3832
|
+
var n = Number.parseInt(e.getHeader("Upload-Offset"), 10);
|
|
3833
|
+
if (Number.isNaN(n)) {
|
|
3834
|
+
this._emitHttpError(t, e, "tus: invalid or missing offset value");
|
|
3835
|
+
return;
|
|
3836
|
+
}
|
|
3837
|
+
if (this._emitProgress(n, this._size), this._emitChunkComplete(n - this._offset, n, this._size), this._offset = n, n === this._size) {
|
|
3838
|
+
this._emitSuccess(e), this._source.close();
|
|
3839
|
+
return;
|
|
3840
|
+
}
|
|
3841
|
+
this._performUpload();
|
|
3842
|
+
}
|
|
3843
|
+
/**
|
|
3844
|
+
* Create a new HTTP request object with the given method and URL.
|
|
3845
|
+
*
|
|
3846
|
+
* @api private
|
|
3847
|
+
*/
|
|
3848
|
+
}, {
|
|
3849
|
+
key: "_openRequest",
|
|
3850
|
+
value: function(t, e) {
|
|
3851
|
+
var n = je(t, e, this.options);
|
|
3852
|
+
return this._req = n, n;
|
|
3853
|
+
}
|
|
3854
|
+
/**
|
|
3855
|
+
* Remove the entry in the URL storage, if it has been saved before.
|
|
3856
|
+
*
|
|
3857
|
+
* @api private
|
|
3858
|
+
*/
|
|
3859
|
+
}, {
|
|
3860
|
+
key: "_removeFromUrlStorage",
|
|
3861
|
+
value: function() {
|
|
3862
|
+
var t = this;
|
|
3863
|
+
this._urlStorageKey && (this._urlStorage.removeUpload(this._urlStorageKey).catch(function(e) {
|
|
3864
|
+
t._emitError(e);
|
|
3865
|
+
}), this._urlStorageKey = null);
|
|
3866
|
+
}
|
|
3867
|
+
/**
|
|
3868
|
+
* Add the upload URL to the URL storage, if possible.
|
|
3869
|
+
*
|
|
3870
|
+
* @api private
|
|
3871
|
+
*/
|
|
3872
|
+
}, {
|
|
3873
|
+
key: "_saveUploadInUrlStorage",
|
|
3874
|
+
value: function() {
|
|
3875
|
+
var t = this;
|
|
3876
|
+
if (!this.options.storeFingerprintForResuming || !this._fingerprint || this._urlStorageKey !== null)
|
|
3877
|
+
return Promise.resolve();
|
|
3878
|
+
var e = {
|
|
3879
|
+
size: this._size,
|
|
3880
|
+
metadata: this.options.metadata,
|
|
3881
|
+
creationTime: (/* @__PURE__ */ new Date()).toString()
|
|
3882
|
+
};
|
|
3883
|
+
return this._parallelUploads ? e.parallelUploadUrls = this._parallelUploadUrls : e.uploadUrl = this.url, this._urlStorage.addUpload(this._fingerprint, e).then(function(n) {
|
|
3884
|
+
t._urlStorageKey = n;
|
|
3885
|
+
});
|
|
3886
|
+
}
|
|
3887
|
+
/**
|
|
3888
|
+
* Send a request with the provided body.
|
|
3889
|
+
*
|
|
3890
|
+
* @api private
|
|
3891
|
+
*/
|
|
3892
|
+
}, {
|
|
3893
|
+
key: "_sendRequest",
|
|
3894
|
+
value: function(t) {
|
|
3895
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
3896
|
+
return Be(t, e, this.options);
|
|
3897
|
+
}
|
|
3898
|
+
}], [{
|
|
3899
|
+
key: "terminate",
|
|
3900
|
+
value: function(t) {
|
|
3901
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = je("DELETE", t, e);
|
|
3902
|
+
return Be(n, null, e).then(function(o) {
|
|
3903
|
+
if (o.getStatus() !== 204)
|
|
3904
|
+
throw new wt("tus: unexpected response while terminating upload", null, n, o);
|
|
3905
|
+
}).catch(function(o) {
|
|
3906
|
+
if (o instanceof wt || (o = new wt("tus: failed to terminate upload", o, n, null)), !Ne(o, 0, e))
|
|
3907
|
+
throw o;
|
|
3908
|
+
var i = e.retryDelays[0], u = e.retryDelays.slice(1), l = et(et({}, e), {}, {
|
|
3909
|
+
retryDelays: u
|
|
3910
|
+
});
|
|
3911
|
+
return new Promise(function(f) {
|
|
3912
|
+
return setTimeout(f, i);
|
|
3913
|
+
}).then(function() {
|
|
3914
|
+
return r.terminate(t, l);
|
|
3915
|
+
});
|
|
3916
|
+
});
|
|
3917
|
+
}
|
|
3918
|
+
}]);
|
|
3919
|
+
})();
|
|
3920
|
+
function Ae(r) {
|
|
3921
|
+
return Object.entries(r).map(function(t) {
|
|
3922
|
+
var e = mr(t, 2), n = e[0], o = e[1];
|
|
3923
|
+
return "".concat(n, " ").concat(Xn.encode(String(o)));
|
|
3924
|
+
}).join(",");
|
|
3925
|
+
}
|
|
3926
|
+
function rt(r, t) {
|
|
3927
|
+
return r >= t && r < t + 100;
|
|
3928
|
+
}
|
|
3929
|
+
function je(r, t, e) {
|
|
3930
|
+
var n = e.httpStack.createRequest(r, t);
|
|
3931
|
+
e.protocol === Ct ? n.setHeader("Upload-Draft-Interop-Version", "5") : e.protocol === lt ? n.setHeader("Upload-Draft-Interop-Version", "6") : n.setHeader("Tus-Resumable", "1.0.0");
|
|
3932
|
+
for (var o = e.headers || {}, i = 0, u = Object.entries(o); i < u.length; i++) {
|
|
3933
|
+
var l = mr(u[i], 2), f = l[0], d = l[1];
|
|
3934
|
+
n.setHeader(f, d);
|
|
3935
|
+
}
|
|
3936
|
+
if (e.addRequestId) {
|
|
3937
|
+
var _ = ro();
|
|
3938
|
+
n.setHeader("X-Request-ID", _);
|
|
3939
|
+
}
|
|
3940
|
+
return n;
|
|
3941
|
+
}
|
|
3942
|
+
function Be(r, t, e) {
|
|
3943
|
+
return Qt.apply(this, arguments);
|
|
3944
|
+
}
|
|
3945
|
+
function Qt() {
|
|
3946
|
+
return Qt = no(/* @__PURE__ */ $t().mark(function r(t, e, n) {
|
|
3947
|
+
var o;
|
|
3948
|
+
return $t().wrap(function(i) {
|
|
3949
|
+
for (; ; ) switch (i.prev = i.next) {
|
|
3950
|
+
case 0:
|
|
3951
|
+
if (typeof n.onBeforeRequest != "function") {
|
|
3952
|
+
i.next = 3;
|
|
3953
|
+
break;
|
|
3954
|
+
}
|
|
3955
|
+
return i.next = 3, n.onBeforeRequest(t);
|
|
3956
|
+
case 3:
|
|
3957
|
+
return i.next = 5, t.send(e);
|
|
3958
|
+
case 5:
|
|
3959
|
+
if (o = i.sent, typeof n.onAfterResponse != "function") {
|
|
3960
|
+
i.next = 9;
|
|
3961
|
+
break;
|
|
3962
|
+
}
|
|
3963
|
+
return i.next = 9, n.onAfterResponse(t, o);
|
|
3964
|
+
case 9:
|
|
3965
|
+
return i.abrupt("return", o);
|
|
3966
|
+
case 10:
|
|
3967
|
+
case "end":
|
|
3968
|
+
return i.stop();
|
|
3969
|
+
}
|
|
3970
|
+
}, r);
|
|
3971
|
+
})), Qt.apply(this, arguments);
|
|
3972
|
+
}
|
|
3973
|
+
function fo() {
|
|
3974
|
+
var r = !0;
|
|
3975
|
+
return typeof navigator < "u" && navigator.onLine === !1 && (r = !1), r;
|
|
3976
|
+
}
|
|
3977
|
+
function Ne(r, t, e) {
|
|
3978
|
+
return e.retryDelays == null || t >= e.retryDelays.length || r.originalRequest == null ? !1 : e && typeof e.onShouldRetry == "function" ? e.onShouldRetry(r, t, e) : wr(r);
|
|
3979
|
+
}
|
|
3980
|
+
function wr(r) {
|
|
3981
|
+
var t = r.originalResponse ? r.originalResponse.getStatus() : 0;
|
|
3982
|
+
return (!rt(t, 400) || t === 409 || t === 423) && fo();
|
|
3983
|
+
}
|
|
3984
|
+
function Ie(r, t) {
|
|
3985
|
+
return new eo(t, r).toString();
|
|
3986
|
+
}
|
|
3987
|
+
function yo(r, t) {
|
|
3988
|
+
for (var e = Math.floor(r / t), n = [], o = 0; o < t; o++)
|
|
3989
|
+
n.push({
|
|
3990
|
+
start: e * o,
|
|
3991
|
+
end: e * (o + 1)
|
|
3992
|
+
});
|
|
3993
|
+
return n[t - 1].end = r, n;
|
|
3994
|
+
}
|
|
3995
|
+
_r.defaultOptions = po;
|
|
3996
|
+
var Er = function() {
|
|
3997
|
+
return typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
3998
|
+
};
|
|
3999
|
+
function go(r) {
|
|
4000
|
+
return new Promise(function(t, e) {
|
|
4001
|
+
var n = new XMLHttpRequest();
|
|
4002
|
+
n.responseType = "blob", n.onload = function() {
|
|
4003
|
+
var o = n.response;
|
|
4004
|
+
t(o);
|
|
4005
|
+
}, n.onerror = function(o) {
|
|
4006
|
+
e(o);
|
|
4007
|
+
}, n.open("GET", r), n.send();
|
|
4008
|
+
});
|
|
4009
|
+
}
|
|
4010
|
+
var mo = function() {
|
|
4011
|
+
return typeof window < "u" && (typeof window.PhoneGap < "u" || typeof window.Cordova < "u" || typeof window.cordova < "u");
|
|
4012
|
+
};
|
|
4013
|
+
function vo(r) {
|
|
4014
|
+
return new Promise(function(t, e) {
|
|
4015
|
+
var n = new FileReader();
|
|
4016
|
+
n.onload = function() {
|
|
4017
|
+
var o = new Uint8Array(n.result);
|
|
4018
|
+
t({
|
|
4019
|
+
value: o
|
|
4020
|
+
});
|
|
4021
|
+
}, n.onerror = function(o) {
|
|
4022
|
+
e(o);
|
|
4023
|
+
}, n.readAsArrayBuffer(r);
|
|
4024
|
+
});
|
|
4025
|
+
}
|
|
4026
|
+
function dt(r) {
|
|
4027
|
+
"@babel/helpers - typeof";
|
|
4028
|
+
return dt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
4029
|
+
return typeof t;
|
|
4030
|
+
} : function(t) {
|
|
4031
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
4032
|
+
}, dt(r);
|
|
4033
|
+
}
|
|
4034
|
+
function bo(r, t) {
|
|
4035
|
+
if (!(r instanceof t))
|
|
4036
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4037
|
+
}
|
|
4038
|
+
function _o(r, t) {
|
|
4039
|
+
for (var e = 0; e < t.length; e++) {
|
|
4040
|
+
var n = t[e];
|
|
4041
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, Eo(n.key), n);
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
function wo(r, t, e) {
|
|
4045
|
+
return t && _o(r.prototype, t), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
4046
|
+
}
|
|
4047
|
+
function Eo(r) {
|
|
4048
|
+
var t = ko(r, "string");
|
|
4049
|
+
return dt(t) == "symbol" ? t : t + "";
|
|
4050
|
+
}
|
|
4051
|
+
function ko(r, t) {
|
|
4052
|
+
if (dt(r) != "object" || !r) return r;
|
|
4053
|
+
var e = r[Symbol.toPrimitive];
|
|
4054
|
+
if (e !== void 0) {
|
|
4055
|
+
var n = e.call(r, t);
|
|
4056
|
+
if (dt(n) != "object") return n;
|
|
4057
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4058
|
+
}
|
|
4059
|
+
return String(r);
|
|
4060
|
+
}
|
|
4061
|
+
var De = /* @__PURE__ */ (function() {
|
|
4062
|
+
function r(t) {
|
|
4063
|
+
bo(this, r), this._file = t, this.size = t.size;
|
|
4064
|
+
}
|
|
4065
|
+
return wo(r, [{
|
|
4066
|
+
key: "slice",
|
|
4067
|
+
value: function(t, e) {
|
|
4068
|
+
if (mo())
|
|
4069
|
+
return vo(this._file.slice(t, e));
|
|
4070
|
+
var n = this._file.slice(t, e), o = e >= this.size;
|
|
4071
|
+
return Promise.resolve({
|
|
4072
|
+
value: n,
|
|
4073
|
+
done: o
|
|
4074
|
+
});
|
|
4075
|
+
}
|
|
4076
|
+
}, {
|
|
4077
|
+
key: "close",
|
|
4078
|
+
value: function() {
|
|
4079
|
+
}
|
|
4080
|
+
}]);
|
|
4081
|
+
})();
|
|
4082
|
+
function yt(r) {
|
|
4083
|
+
"@babel/helpers - typeof";
|
|
4084
|
+
return yt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
4085
|
+
return typeof t;
|
|
4086
|
+
} : function(t) {
|
|
4087
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
4088
|
+
}, yt(r);
|
|
4089
|
+
}
|
|
4090
|
+
function So(r, t) {
|
|
4091
|
+
if (!(r instanceof t))
|
|
4092
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4093
|
+
}
|
|
4094
|
+
function Oo(r, t) {
|
|
4095
|
+
for (var e = 0; e < t.length; e++) {
|
|
4096
|
+
var n = t[e];
|
|
4097
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, Uo(n.key), n);
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4100
|
+
function xo(r, t, e) {
|
|
4101
|
+
return t && Oo(r.prototype, t), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
4102
|
+
}
|
|
4103
|
+
function Uo(r) {
|
|
4104
|
+
var t = Ro(r, "string");
|
|
4105
|
+
return yt(t) == "symbol" ? t : t + "";
|
|
4106
|
+
}
|
|
4107
|
+
function Ro(r, t) {
|
|
4108
|
+
if (yt(r) != "object" || !r) return r;
|
|
4109
|
+
var e = r[Symbol.toPrimitive];
|
|
4110
|
+
if (e !== void 0) {
|
|
4111
|
+
var n = e.call(r, t);
|
|
4112
|
+
if (yt(n) != "object") return n;
|
|
4113
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4114
|
+
}
|
|
4115
|
+
return String(r);
|
|
4116
|
+
}
|
|
4117
|
+
function qe(r) {
|
|
4118
|
+
return r === void 0 ? 0 : r.size !== void 0 ? r.size : r.length;
|
|
4119
|
+
}
|
|
4120
|
+
function To(r, t) {
|
|
4121
|
+
if (r.concat)
|
|
4122
|
+
return r.concat(t);
|
|
4123
|
+
if (r instanceof Blob)
|
|
4124
|
+
return new Blob([r, t], {
|
|
4125
|
+
type: r.type
|
|
4126
|
+
});
|
|
4127
|
+
if (r.set) {
|
|
4128
|
+
var e = new r.constructor(r.length + t.length);
|
|
4129
|
+
return e.set(r), e.set(t, r.length), e;
|
|
4130
|
+
}
|
|
4131
|
+
throw new Error("Unknown data type");
|
|
4132
|
+
}
|
|
4133
|
+
var Co = /* @__PURE__ */ (function() {
|
|
4134
|
+
function r(t) {
|
|
4135
|
+
So(this, r), this._buffer = void 0, this._bufferOffset = 0, this._reader = t, this._done = !1;
|
|
4136
|
+
}
|
|
4137
|
+
return xo(r, [{
|
|
4138
|
+
key: "slice",
|
|
4139
|
+
value: function(t, e) {
|
|
4140
|
+
return t < this._bufferOffset ? Promise.reject(new Error("Requested data is before the reader's current offset")) : this._readUntilEnoughDataOrDone(t, e);
|
|
4141
|
+
}
|
|
4142
|
+
}, {
|
|
4143
|
+
key: "_readUntilEnoughDataOrDone",
|
|
4144
|
+
value: function(t, e) {
|
|
4145
|
+
var n = this, o = e <= this._bufferOffset + qe(this._buffer);
|
|
4146
|
+
if (this._done || o) {
|
|
4147
|
+
var i = this._getDataFromBuffer(t, e), u = i == null ? this._done : !1;
|
|
4148
|
+
return Promise.resolve({
|
|
4149
|
+
value: i,
|
|
4150
|
+
done: u
|
|
4151
|
+
});
|
|
4152
|
+
}
|
|
4153
|
+
return this._reader.read().then(function(l) {
|
|
4154
|
+
var f = l.value, d = l.done;
|
|
4155
|
+
return d ? n._done = !0 : n._buffer === void 0 ? n._buffer = f : n._buffer = To(n._buffer, f), n._readUntilEnoughDataOrDone(t, e);
|
|
4156
|
+
});
|
|
4157
|
+
}
|
|
4158
|
+
}, {
|
|
4159
|
+
key: "_getDataFromBuffer",
|
|
4160
|
+
value: function(t, e) {
|
|
4161
|
+
t > this._bufferOffset && (this._buffer = this._buffer.slice(t - this._bufferOffset), this._bufferOffset = t);
|
|
4162
|
+
var n = qe(this._buffer) === 0;
|
|
4163
|
+
return this._done && n ? null : this._buffer.slice(0, e - t);
|
|
4164
|
+
}
|
|
4165
|
+
}, {
|
|
4166
|
+
key: "close",
|
|
4167
|
+
value: function() {
|
|
4168
|
+
this._reader.cancel && this._reader.cancel();
|
|
4169
|
+
}
|
|
4170
|
+
}]);
|
|
4171
|
+
})();
|
|
4172
|
+
function tt(r) {
|
|
4173
|
+
"@babel/helpers - typeof";
|
|
4174
|
+
return tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
4175
|
+
return typeof t;
|
|
4176
|
+
} : function(t) {
|
|
4177
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
4178
|
+
}, tt(r);
|
|
4179
|
+
}
|
|
4180
|
+
function Zt() {
|
|
4181
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
4182
|
+
Zt = function() {
|
|
4183
|
+
return t;
|
|
4184
|
+
};
|
|
4185
|
+
var r, t = {}, e = Object.prototype, n = e.hasOwnProperty, o = Object.defineProperty || function(a, s, c) {
|
|
4186
|
+
a[s] = c.value;
|
|
4187
|
+
}, i = typeof Symbol == "function" ? Symbol : {}, u = i.iterator || "@@iterator", l = i.asyncIterator || "@@asyncIterator", f = i.toStringTag || "@@toStringTag";
|
|
4188
|
+
function d(a, s, c) {
|
|
4189
|
+
return Object.defineProperty(a, s, { value: c, enumerable: !0, configurable: !0, writable: !0 }), a[s];
|
|
4190
|
+
}
|
|
4191
|
+
try {
|
|
4192
|
+
d({}, "");
|
|
4193
|
+
} catch {
|
|
4194
|
+
d = function(a, s, c) {
|
|
4195
|
+
return a[s] = c;
|
|
4196
|
+
};
|
|
4197
|
+
}
|
|
4198
|
+
function _(a, s, c, v) {
|
|
4199
|
+
var h = s && s.prototype instanceof S ? s : S, w = Object.create(h.prototype), R = new z(v || []);
|
|
4200
|
+
return o(w, "_invoke", { value: q(a, c, R) }), w;
|
|
4201
|
+
}
|
|
4202
|
+
function L(a, s, c) {
|
|
4203
|
+
try {
|
|
4204
|
+
return { type: "normal", arg: a.call(s, c) };
|
|
4205
|
+
} catch (v) {
|
|
4206
|
+
return { type: "throw", arg: v };
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
t.wrap = _;
|
|
4210
|
+
var B = "suspendedStart", K = "suspendedYield", G = "executing", E = "completed", U = {};
|
|
4211
|
+
function S() {
|
|
4212
|
+
}
|
|
4213
|
+
function y() {
|
|
4214
|
+
}
|
|
4215
|
+
function g() {
|
|
4216
|
+
}
|
|
4217
|
+
var m = {};
|
|
4218
|
+
d(m, u, function() {
|
|
4219
|
+
return this;
|
|
4220
|
+
});
|
|
4221
|
+
var p = Object.getPrototypeOf, x = p && p(p($([])));
|
|
4222
|
+
x && x !== e && n.call(x, u) && (m = x);
|
|
4223
|
+
var k = g.prototype = S.prototype = Object.create(m);
|
|
4224
|
+
function C(a) {
|
|
4225
|
+
["next", "throw", "return"].forEach(function(s) {
|
|
4226
|
+
d(a, s, function(c) {
|
|
4227
|
+
return this._invoke(s, c);
|
|
4228
|
+
});
|
|
4229
|
+
});
|
|
4230
|
+
}
|
|
4231
|
+
function O(a, s) {
|
|
4232
|
+
function c(h, w, R, A) {
|
|
4233
|
+
var j = L(a[h], a, w);
|
|
4234
|
+
if (j.type !== "throw") {
|
|
4235
|
+
var M = j.arg, Y = M.value;
|
|
4236
|
+
return Y && tt(Y) == "object" && n.call(Y, "__await") ? s.resolve(Y.__await).then(function(H) {
|
|
4237
|
+
c("next", H, R, A);
|
|
4238
|
+
}, function(H) {
|
|
4239
|
+
c("throw", H, R, A);
|
|
4240
|
+
}) : s.resolve(Y).then(function(H) {
|
|
4241
|
+
M.value = H, R(M);
|
|
4242
|
+
}, function(H) {
|
|
4243
|
+
return c("throw", H, R, A);
|
|
4244
|
+
});
|
|
4245
|
+
}
|
|
4246
|
+
A(j.arg);
|
|
4247
|
+
}
|
|
4248
|
+
var v;
|
|
4249
|
+
o(this, "_invoke", { value: function(h, w) {
|
|
4250
|
+
function R() {
|
|
4251
|
+
return new s(function(A, j) {
|
|
4252
|
+
c(h, w, A, j);
|
|
4253
|
+
});
|
|
4254
|
+
}
|
|
4255
|
+
return v = v ? v.then(R, R) : R();
|
|
4256
|
+
} });
|
|
4257
|
+
}
|
|
4258
|
+
function q(a, s, c) {
|
|
4259
|
+
var v = B;
|
|
4260
|
+
return function(h, w) {
|
|
4261
|
+
if (v === G) throw Error("Generator is already running");
|
|
4262
|
+
if (v === E) {
|
|
4263
|
+
if (h === "throw") throw w;
|
|
4264
|
+
return { value: r, done: !0 };
|
|
4265
|
+
}
|
|
4266
|
+
for (c.method = h, c.arg = w; ; ) {
|
|
4267
|
+
var R = c.delegate;
|
|
4268
|
+
if (R) {
|
|
4269
|
+
var A = P(R, c);
|
|
4270
|
+
if (A) {
|
|
4271
|
+
if (A === U) continue;
|
|
4272
|
+
return A;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
if (c.method === "next") c.sent = c._sent = c.arg;
|
|
4276
|
+
else if (c.method === "throw") {
|
|
4277
|
+
if (v === B) throw v = E, c.arg;
|
|
4278
|
+
c.dispatchException(c.arg);
|
|
4279
|
+
} else c.method === "return" && c.abrupt("return", c.arg);
|
|
4280
|
+
v = G;
|
|
4281
|
+
var j = L(a, s, c);
|
|
4282
|
+
if (j.type === "normal") {
|
|
4283
|
+
if (v = c.done ? E : K, j.arg === U) continue;
|
|
4284
|
+
return { value: j.arg, done: c.done };
|
|
4285
|
+
}
|
|
4286
|
+
j.type === "throw" && (v = E, c.method = "throw", c.arg = j.arg);
|
|
4287
|
+
}
|
|
4288
|
+
};
|
|
4289
|
+
}
|
|
4290
|
+
function P(a, s) {
|
|
4291
|
+
var c = s.method, v = a.iterator[c];
|
|
4292
|
+
if (v === r) return s.delegate = null, c === "throw" && a.iterator.return && (s.method = "return", s.arg = r, P(a, s), s.method === "throw") || c !== "return" && (s.method = "throw", s.arg = new TypeError("The iterator does not provide a '" + c + "' method")), U;
|
|
4293
|
+
var h = L(v, a.iterator, s.arg);
|
|
4294
|
+
if (h.type === "throw") return s.method = "throw", s.arg = h.arg, s.delegate = null, U;
|
|
4295
|
+
var w = h.arg;
|
|
4296
|
+
return w ? w.done ? (s[a.resultName] = w.value, s.next = a.nextLoc, s.method !== "return" && (s.method = "next", s.arg = r), s.delegate = null, U) : w : (s.method = "throw", s.arg = new TypeError("iterator result is not an object"), s.delegate = null, U);
|
|
4297
|
+
}
|
|
4298
|
+
function N(a) {
|
|
4299
|
+
var s = { tryLoc: a[0] };
|
|
4300
|
+
1 in a && (s.catchLoc = a[1]), 2 in a && (s.finallyLoc = a[2], s.afterLoc = a[3]), this.tryEntries.push(s);
|
|
4301
|
+
}
|
|
4302
|
+
function b(a) {
|
|
4303
|
+
var s = a.completion || {};
|
|
4304
|
+
s.type = "normal", delete s.arg, a.completion = s;
|
|
4305
|
+
}
|
|
4306
|
+
function z(a) {
|
|
4307
|
+
this.tryEntries = [{ tryLoc: "root" }], a.forEach(N, this), this.reset(!0);
|
|
4308
|
+
}
|
|
4309
|
+
function $(a) {
|
|
4310
|
+
if (a || a === "") {
|
|
4311
|
+
var s = a[u];
|
|
4312
|
+
if (s) return s.call(a);
|
|
4313
|
+
if (typeof a.next == "function") return a;
|
|
4314
|
+
if (!isNaN(a.length)) {
|
|
4315
|
+
var c = -1, v = function h() {
|
|
4316
|
+
for (; ++c < a.length; ) if (n.call(a, c)) return h.value = a[c], h.done = !1, h;
|
|
4317
|
+
return h.value = r, h.done = !0, h;
|
|
4318
|
+
};
|
|
4319
|
+
return v.next = v;
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
throw new TypeError(tt(a) + " is not iterable");
|
|
4323
|
+
}
|
|
4324
|
+
return y.prototype = g, o(k, "constructor", { value: g, configurable: !0 }), o(g, "constructor", { value: y, configurable: !0 }), y.displayName = d(g, f, "GeneratorFunction"), t.isGeneratorFunction = function(a) {
|
|
4325
|
+
var s = typeof a == "function" && a.constructor;
|
|
4326
|
+
return !!s && (s === y || (s.displayName || s.name) === "GeneratorFunction");
|
|
4327
|
+
}, t.mark = function(a) {
|
|
4328
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(a, g) : (a.__proto__ = g, d(a, f, "GeneratorFunction")), a.prototype = Object.create(k), a;
|
|
4329
|
+
}, t.awrap = function(a) {
|
|
4330
|
+
return { __await: a };
|
|
4331
|
+
}, C(O.prototype), d(O.prototype, l, function() {
|
|
4332
|
+
return this;
|
|
4333
|
+
}), t.AsyncIterator = O, t.async = function(a, s, c, v, h) {
|
|
4334
|
+
h === void 0 && (h = Promise);
|
|
4335
|
+
var w = new O(_(a, s, c, v), h);
|
|
4336
|
+
return t.isGeneratorFunction(s) ? w : w.next().then(function(R) {
|
|
4337
|
+
return R.done ? R.value : w.next();
|
|
4338
|
+
});
|
|
4339
|
+
}, C(k), d(k, f, "Generator"), d(k, u, function() {
|
|
4340
|
+
return this;
|
|
4341
|
+
}), d(k, "toString", function() {
|
|
4342
|
+
return "[object Generator]";
|
|
4343
|
+
}), t.keys = function(a) {
|
|
4344
|
+
var s = Object(a), c = [];
|
|
4345
|
+
for (var v in s) c.push(v);
|
|
4346
|
+
return c.reverse(), function h() {
|
|
4347
|
+
for (; c.length; ) {
|
|
4348
|
+
var w = c.pop();
|
|
4349
|
+
if (w in s) return h.value = w, h.done = !1, h;
|
|
4350
|
+
}
|
|
4351
|
+
return h.done = !0, h;
|
|
4352
|
+
};
|
|
4353
|
+
}, t.values = $, z.prototype = { constructor: z, reset: function(a) {
|
|
4354
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = r, this.done = !1, this.delegate = null, this.method = "next", this.arg = r, this.tryEntries.forEach(b), !a) for (var s in this) s.charAt(0) === "t" && n.call(this, s) && !isNaN(+s.slice(1)) && (this[s] = r);
|
|
4355
|
+
}, stop: function() {
|
|
4356
|
+
this.done = !0;
|
|
4357
|
+
var a = this.tryEntries[0].completion;
|
|
4358
|
+
if (a.type === "throw") throw a.arg;
|
|
4359
|
+
return this.rval;
|
|
4360
|
+
}, dispatchException: function(a) {
|
|
4361
|
+
if (this.done) throw a;
|
|
4362
|
+
var s = this;
|
|
4363
|
+
function c(j, M) {
|
|
4364
|
+
return w.type = "throw", w.arg = a, s.next = j, M && (s.method = "next", s.arg = r), !!M;
|
|
4365
|
+
}
|
|
4366
|
+
for (var v = this.tryEntries.length - 1; v >= 0; --v) {
|
|
4367
|
+
var h = this.tryEntries[v], w = h.completion;
|
|
4368
|
+
if (h.tryLoc === "root") return c("end");
|
|
4369
|
+
if (h.tryLoc <= this.prev) {
|
|
4370
|
+
var R = n.call(h, "catchLoc"), A = n.call(h, "finallyLoc");
|
|
4371
|
+
if (R && A) {
|
|
4372
|
+
if (this.prev < h.catchLoc) return c(h.catchLoc, !0);
|
|
4373
|
+
if (this.prev < h.finallyLoc) return c(h.finallyLoc);
|
|
4374
|
+
} else if (R) {
|
|
4375
|
+
if (this.prev < h.catchLoc) return c(h.catchLoc, !0);
|
|
4376
|
+
} else {
|
|
4377
|
+
if (!A) throw Error("try statement without catch or finally");
|
|
4378
|
+
if (this.prev < h.finallyLoc) return c(h.finallyLoc);
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
}, abrupt: function(a, s) {
|
|
4383
|
+
for (var c = this.tryEntries.length - 1; c >= 0; --c) {
|
|
4384
|
+
var v = this.tryEntries[c];
|
|
4385
|
+
if (v.tryLoc <= this.prev && n.call(v, "finallyLoc") && this.prev < v.finallyLoc) {
|
|
4386
|
+
var h = v;
|
|
4387
|
+
break;
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4390
|
+
h && (a === "break" || a === "continue") && h.tryLoc <= s && s <= h.finallyLoc && (h = null);
|
|
4391
|
+
var w = h ? h.completion : {};
|
|
4392
|
+
return w.type = a, w.arg = s, h ? (this.method = "next", this.next = h.finallyLoc, U) : this.complete(w);
|
|
4393
|
+
}, complete: function(a, s) {
|
|
4394
|
+
if (a.type === "throw") throw a.arg;
|
|
4395
|
+
return a.type === "break" || a.type === "continue" ? this.next = a.arg : a.type === "return" ? (this.rval = this.arg = a.arg, this.method = "return", this.next = "end") : a.type === "normal" && s && (this.next = s), U;
|
|
4396
|
+
}, finish: function(a) {
|
|
4397
|
+
for (var s = this.tryEntries.length - 1; s >= 0; --s) {
|
|
4398
|
+
var c = this.tryEntries[s];
|
|
4399
|
+
if (c.finallyLoc === a) return this.complete(c.completion, c.afterLoc), b(c), U;
|
|
4400
|
+
}
|
|
4401
|
+
}, catch: function(a) {
|
|
4402
|
+
for (var s = this.tryEntries.length - 1; s >= 0; --s) {
|
|
4403
|
+
var c = this.tryEntries[s];
|
|
4404
|
+
if (c.tryLoc === a) {
|
|
4405
|
+
var v = c.completion;
|
|
4406
|
+
if (v.type === "throw") {
|
|
4407
|
+
var h = v.arg;
|
|
4408
|
+
b(c);
|
|
4409
|
+
}
|
|
4410
|
+
return h;
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
throw Error("illegal catch attempt");
|
|
4414
|
+
}, delegateYield: function(a, s, c) {
|
|
4415
|
+
return this.delegate = { iterator: $(a), resultName: s, nextLoc: c }, this.method === "next" && (this.arg = r), U;
|
|
4416
|
+
} }, t;
|
|
4417
|
+
}
|
|
4418
|
+
function Fe(r, t, e, n, o, i, u) {
|
|
4419
|
+
try {
|
|
4420
|
+
var l = r[i](u), f = l.value;
|
|
4421
|
+
} catch (d) {
|
|
4422
|
+
e(d);
|
|
4423
|
+
return;
|
|
4424
|
+
}
|
|
4425
|
+
l.done ? t(f) : Promise.resolve(f).then(n, o);
|
|
4426
|
+
}
|
|
4427
|
+
function Po(r) {
|
|
4428
|
+
return function() {
|
|
4429
|
+
var t = this, e = arguments;
|
|
4430
|
+
return new Promise(function(n, o) {
|
|
4431
|
+
var i = r.apply(t, e);
|
|
4432
|
+
function u(f) {
|
|
4433
|
+
Fe(i, n, o, u, l, "next", f);
|
|
4434
|
+
}
|
|
4435
|
+
function l(f) {
|
|
4436
|
+
Fe(i, n, o, u, l, "throw", f);
|
|
4437
|
+
}
|
|
4438
|
+
u(void 0);
|
|
4439
|
+
});
|
|
4440
|
+
};
|
|
4441
|
+
}
|
|
4442
|
+
function Lo(r, t) {
|
|
4443
|
+
if (!(r instanceof t))
|
|
4444
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4445
|
+
}
|
|
4446
|
+
function Ao(r, t) {
|
|
4447
|
+
for (var e = 0; e < t.length; e++) {
|
|
4448
|
+
var n = t[e];
|
|
4449
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, Bo(n.key), n);
|
|
4450
|
+
}
|
|
4451
|
+
}
|
|
4452
|
+
function jo(r, t, e) {
|
|
4453
|
+
return t && Ao(r.prototype, t), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
4454
|
+
}
|
|
4455
|
+
function Bo(r) {
|
|
4456
|
+
var t = No(r, "string");
|
|
4457
|
+
return tt(t) == "symbol" ? t : t + "";
|
|
4458
|
+
}
|
|
4459
|
+
function No(r, t) {
|
|
4460
|
+
if (tt(r) != "object" || !r) return r;
|
|
4461
|
+
var e = r[Symbol.toPrimitive];
|
|
4462
|
+
if (e !== void 0) {
|
|
4463
|
+
var n = e.call(r, t);
|
|
4464
|
+
if (tt(n) != "object") return n;
|
|
4465
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4466
|
+
}
|
|
4467
|
+
return String(r);
|
|
4468
|
+
}
|
|
4469
|
+
var Io = /* @__PURE__ */ (function() {
|
|
4470
|
+
function r() {
|
|
4471
|
+
Lo(this, r);
|
|
4472
|
+
}
|
|
4473
|
+
return jo(r, [{
|
|
4474
|
+
key: "openFile",
|
|
4475
|
+
value: (function() {
|
|
4476
|
+
var t = Po(/* @__PURE__ */ Zt().mark(function n(o, i) {
|
|
4477
|
+
var u;
|
|
4478
|
+
return Zt().wrap(function(l) {
|
|
4479
|
+
for (; ; ) switch (l.prev = l.next) {
|
|
4480
|
+
case 0:
|
|
4481
|
+
if (!(Er() && o && typeof o.uri < "u")) {
|
|
4482
|
+
l.next = 11;
|
|
4483
|
+
break;
|
|
4484
|
+
}
|
|
4485
|
+
return l.prev = 1, l.next = 4, go(o.uri);
|
|
4486
|
+
case 4:
|
|
4487
|
+
return u = l.sent, l.abrupt("return", new De(u));
|
|
4488
|
+
case 8:
|
|
4489
|
+
throw l.prev = 8, l.t0 = l.catch(1), new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(l.t0));
|
|
4490
|
+
case 11:
|
|
4491
|
+
if (!(typeof o.slice == "function" && typeof o.size < "u")) {
|
|
4492
|
+
l.next = 13;
|
|
4493
|
+
break;
|
|
4494
|
+
}
|
|
4495
|
+
return l.abrupt("return", Promise.resolve(new De(o)));
|
|
4496
|
+
case 13:
|
|
4497
|
+
if (typeof o.read != "function") {
|
|
4498
|
+
l.next = 18;
|
|
4499
|
+
break;
|
|
4500
|
+
}
|
|
4501
|
+
if (i = Number(i), Number.isFinite(i)) {
|
|
4502
|
+
l.next = 17;
|
|
4503
|
+
break;
|
|
4504
|
+
}
|
|
4505
|
+
return l.abrupt("return", Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));
|
|
4506
|
+
case 17:
|
|
4507
|
+
return l.abrupt("return", Promise.resolve(new Co(o, i)));
|
|
4508
|
+
case 18:
|
|
4509
|
+
return l.abrupt("return", Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));
|
|
4510
|
+
case 19:
|
|
4511
|
+
case "end":
|
|
4512
|
+
return l.stop();
|
|
4513
|
+
}
|
|
4514
|
+
}, n, null, [[1, 8]]);
|
|
4515
|
+
}));
|
|
4516
|
+
function e(n, o) {
|
|
4517
|
+
return t.apply(this, arguments);
|
|
4518
|
+
}
|
|
4519
|
+
return e;
|
|
4520
|
+
})()
|
|
4521
|
+
}]);
|
|
4522
|
+
})();
|
|
4523
|
+
function Do(r, t) {
|
|
4524
|
+
return Er() ? Promise.resolve(qo(r, t)) : Promise.resolve(["tus-br", r.name, r.type, r.size, r.lastModified, t.endpoint].join("-"));
|
|
4525
|
+
}
|
|
4526
|
+
function qo(r, t) {
|
|
4527
|
+
var e = r.exif ? Fo(JSON.stringify(r.exif)) : "noexif";
|
|
4528
|
+
return ["tus-rn", r.name || "noname", r.size || "nosize", e, t.endpoint].join("/");
|
|
4529
|
+
}
|
|
4530
|
+
function Fo(r) {
|
|
4531
|
+
var t = 0;
|
|
4532
|
+
if (r.length === 0)
|
|
4533
|
+
return t;
|
|
4534
|
+
for (var e = 0; e < r.length; e++) {
|
|
4535
|
+
var n = r.charCodeAt(e);
|
|
4536
|
+
t = (t << 5) - t + n, t &= t;
|
|
4537
|
+
}
|
|
4538
|
+
return t;
|
|
4539
|
+
}
|
|
4540
|
+
function gt(r) {
|
|
4541
|
+
"@babel/helpers - typeof";
|
|
4542
|
+
return gt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
4543
|
+
return typeof t;
|
|
4544
|
+
} : function(t) {
|
|
4545
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
4546
|
+
}, gt(r);
|
|
4547
|
+
}
|
|
4548
|
+
function ce(r, t) {
|
|
4549
|
+
if (!(r instanceof t))
|
|
4550
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4551
|
+
}
|
|
4552
|
+
function Ho(r, t) {
|
|
4553
|
+
for (var e = 0; e < t.length; e++) {
|
|
4554
|
+
var n = t[e];
|
|
4555
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, zo(n.key), n);
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
function le(r, t, e) {
|
|
4559
|
+
return t && Ho(r.prototype, t), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
4560
|
+
}
|
|
4561
|
+
function zo(r) {
|
|
4562
|
+
var t = Mo(r, "string");
|
|
4563
|
+
return gt(t) == "symbol" ? t : t + "";
|
|
4564
|
+
}
|
|
4565
|
+
function Mo(r, t) {
|
|
4566
|
+
if (gt(r) != "object" || !r) return r;
|
|
4567
|
+
var e = r[Symbol.toPrimitive];
|
|
4568
|
+
if (e !== void 0) {
|
|
4569
|
+
var n = e.call(r, t);
|
|
4570
|
+
if (gt(n) != "object") return n;
|
|
4571
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4572
|
+
}
|
|
4573
|
+
return String(r);
|
|
4574
|
+
}
|
|
4575
|
+
var Vo = /* @__PURE__ */ (function() {
|
|
4576
|
+
function r() {
|
|
4577
|
+
ce(this, r);
|
|
4578
|
+
}
|
|
4579
|
+
return le(r, [{
|
|
4580
|
+
key: "createRequest",
|
|
4581
|
+
value: function(t, e) {
|
|
4582
|
+
return new Ko(t, e);
|
|
4583
|
+
}
|
|
4584
|
+
}, {
|
|
4585
|
+
key: "getName",
|
|
4586
|
+
value: function() {
|
|
4587
|
+
return "XHRHttpStack";
|
|
4588
|
+
}
|
|
4589
|
+
}]);
|
|
4590
|
+
})(), Ko = /* @__PURE__ */ (function() {
|
|
4591
|
+
function r(t, e) {
|
|
4592
|
+
ce(this, r), this._xhr = new XMLHttpRequest(), this._xhr.open(t, e, !0), this._method = t, this._url = e, this._headers = {};
|
|
4593
|
+
}
|
|
4594
|
+
return le(r, [{
|
|
4595
|
+
key: "getMethod",
|
|
4596
|
+
value: function() {
|
|
4597
|
+
return this._method;
|
|
4598
|
+
}
|
|
4599
|
+
}, {
|
|
4600
|
+
key: "getURL",
|
|
4601
|
+
value: function() {
|
|
4602
|
+
return this._url;
|
|
4603
|
+
}
|
|
4604
|
+
}, {
|
|
4605
|
+
key: "setHeader",
|
|
4606
|
+
value: function(t, e) {
|
|
4607
|
+
this._xhr.setRequestHeader(t, e), this._headers[t] = e;
|
|
4608
|
+
}
|
|
4609
|
+
}, {
|
|
4610
|
+
key: "getHeader",
|
|
4611
|
+
value: function(t) {
|
|
4612
|
+
return this._headers[t];
|
|
4613
|
+
}
|
|
4614
|
+
}, {
|
|
4615
|
+
key: "setProgressHandler",
|
|
4616
|
+
value: function(t) {
|
|
4617
|
+
"upload" in this._xhr && (this._xhr.upload.onprogress = function(e) {
|
|
4618
|
+
e.lengthComputable && t(e.loaded);
|
|
4619
|
+
});
|
|
4620
|
+
}
|
|
4621
|
+
}, {
|
|
4622
|
+
key: "send",
|
|
4623
|
+
value: function() {
|
|
4624
|
+
var t = this, e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
4625
|
+
return new Promise(function(n, o) {
|
|
4626
|
+
t._xhr.onload = function() {
|
|
4627
|
+
n(new Go(t._xhr));
|
|
4628
|
+
}, t._xhr.onerror = function(i) {
|
|
4629
|
+
o(i);
|
|
4630
|
+
}, t._xhr.send(e);
|
|
4631
|
+
});
|
|
4632
|
+
}
|
|
4633
|
+
}, {
|
|
4634
|
+
key: "abort",
|
|
4635
|
+
value: function() {
|
|
4636
|
+
return this._xhr.abort(), Promise.resolve();
|
|
4637
|
+
}
|
|
4638
|
+
}, {
|
|
4639
|
+
key: "getUnderlyingObject",
|
|
4640
|
+
value: function() {
|
|
4641
|
+
return this._xhr;
|
|
4642
|
+
}
|
|
4643
|
+
}]);
|
|
4644
|
+
})(), Go = /* @__PURE__ */ (function() {
|
|
4645
|
+
function r(t) {
|
|
4646
|
+
ce(this, r), this._xhr = t;
|
|
4647
|
+
}
|
|
4648
|
+
return le(r, [{
|
|
4649
|
+
key: "getStatus",
|
|
4650
|
+
value: function() {
|
|
4651
|
+
return this._xhr.status;
|
|
4652
|
+
}
|
|
4653
|
+
}, {
|
|
4654
|
+
key: "getHeader",
|
|
4655
|
+
value: function(t) {
|
|
4656
|
+
return this._xhr.getResponseHeader(t);
|
|
4657
|
+
}
|
|
4658
|
+
}, {
|
|
4659
|
+
key: "getBody",
|
|
4660
|
+
value: function() {
|
|
4661
|
+
return this._xhr.responseText;
|
|
4662
|
+
}
|
|
4663
|
+
}, {
|
|
4664
|
+
key: "getUnderlyingObject",
|
|
4665
|
+
value: function() {
|
|
4666
|
+
return this._xhr;
|
|
4667
|
+
}
|
|
4668
|
+
}]);
|
|
4669
|
+
})();
|
|
4670
|
+
function mt(r) {
|
|
4671
|
+
"@babel/helpers - typeof";
|
|
4672
|
+
return mt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
4673
|
+
return typeof t;
|
|
4674
|
+
} : function(t) {
|
|
4675
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
4676
|
+
}, mt(r);
|
|
4677
|
+
}
|
|
4678
|
+
function Yo(r, t) {
|
|
4679
|
+
if (!(r instanceof t))
|
|
4680
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4681
|
+
}
|
|
4682
|
+
function Wo(r, t) {
|
|
4683
|
+
for (var e = 0; e < t.length; e++) {
|
|
4684
|
+
var n = t[e];
|
|
4685
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, Xo(n.key), n);
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
function Jo(r, t, e) {
|
|
4689
|
+
return t && Wo(r.prototype, t), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
4690
|
+
}
|
|
4691
|
+
function Xo(r) {
|
|
4692
|
+
var t = $o(r, "string");
|
|
4693
|
+
return mt(t) == "symbol" ? t : t + "";
|
|
4694
|
+
}
|
|
4695
|
+
function $o(r, t) {
|
|
4696
|
+
if (mt(r) != "object" || !r) return r;
|
|
4697
|
+
var e = r[Symbol.toPrimitive];
|
|
4698
|
+
if (e !== void 0) {
|
|
4699
|
+
var n = e.call(r, t);
|
|
4700
|
+
if (mt(n) != "object") return n;
|
|
4701
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4702
|
+
}
|
|
4703
|
+
return String(r);
|
|
4704
|
+
}
|
|
4705
|
+
var te = !1;
|
|
4706
|
+
try {
|
|
4707
|
+
te = "localStorage" in window;
|
|
4708
|
+
var Dt = "tusSupport", He = localStorage.getItem(Dt);
|
|
4709
|
+
localStorage.setItem(Dt, He), He === null && localStorage.removeItem(Dt);
|
|
4710
|
+
} catch (r) {
|
|
4711
|
+
if (r.code === r.SECURITY_ERR || r.code === r.QUOTA_EXCEEDED_ERR)
|
|
4712
|
+
te = !1;
|
|
4713
|
+
else
|
|
4714
|
+
throw r;
|
|
4715
|
+
}
|
|
4716
|
+
var Qo = te, Zo = /* @__PURE__ */ (function() {
|
|
4717
|
+
function r() {
|
|
4718
|
+
Yo(this, r);
|
|
4719
|
+
}
|
|
4720
|
+
return Jo(r, [{
|
|
4721
|
+
key: "findAllUploads",
|
|
4722
|
+
value: function() {
|
|
4723
|
+
var t = this._findEntries("tus::");
|
|
4724
|
+
return Promise.resolve(t);
|
|
4725
|
+
}
|
|
4726
|
+
}, {
|
|
4727
|
+
key: "findUploadsByFingerprint",
|
|
4728
|
+
value: function(t) {
|
|
4729
|
+
var e = this._findEntries("tus::".concat(t, "::"));
|
|
4730
|
+
return Promise.resolve(e);
|
|
4731
|
+
}
|
|
4732
|
+
}, {
|
|
4733
|
+
key: "removeUpload",
|
|
4734
|
+
value: function(t) {
|
|
4735
|
+
return localStorage.removeItem(t), Promise.resolve();
|
|
4736
|
+
}
|
|
4737
|
+
}, {
|
|
4738
|
+
key: "addUpload",
|
|
4739
|
+
value: function(t, e) {
|
|
4740
|
+
var n = Math.round(Math.random() * 1e12), o = "tus::".concat(t, "::").concat(n);
|
|
4741
|
+
return localStorage.setItem(o, JSON.stringify(e)), Promise.resolve(o);
|
|
4742
|
+
}
|
|
4743
|
+
}, {
|
|
4744
|
+
key: "_findEntries",
|
|
4745
|
+
value: function(t) {
|
|
4746
|
+
for (var e = [], n = 0; n < localStorage.length; n++) {
|
|
4747
|
+
var o = localStorage.key(n);
|
|
4748
|
+
if (o.indexOf(t) === 0)
|
|
4749
|
+
try {
|
|
4750
|
+
var i = JSON.parse(localStorage.getItem(o));
|
|
4751
|
+
i.urlStorageKey = o, e.push(i);
|
|
4752
|
+
} catch {
|
|
4753
|
+
}
|
|
4754
|
+
}
|
|
4755
|
+
return e;
|
|
4756
|
+
}
|
|
4757
|
+
}]);
|
|
4758
|
+
})();
|
|
4759
|
+
function vt(r) {
|
|
4760
|
+
"@babel/helpers - typeof";
|
|
4761
|
+
return vt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
4762
|
+
return typeof t;
|
|
4763
|
+
} : function(t) {
|
|
4764
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
4765
|
+
}, vt(r);
|
|
4766
|
+
}
|
|
4767
|
+
function ze(r, t) {
|
|
4768
|
+
var e = Object.keys(r);
|
|
4769
|
+
if (Object.getOwnPropertySymbols) {
|
|
4770
|
+
var n = Object.getOwnPropertySymbols(r);
|
|
4771
|
+
t && (n = n.filter(function(o) {
|
|
4772
|
+
return Object.getOwnPropertyDescriptor(r, o).enumerable;
|
|
4773
|
+
})), e.push.apply(e, n);
|
|
4774
|
+
}
|
|
4775
|
+
return e;
|
|
4776
|
+
}
|
|
4777
|
+
function Me(r) {
|
|
4778
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
4779
|
+
var e = arguments[t] != null ? arguments[t] : {};
|
|
4780
|
+
t % 2 ? ze(Object(e), !0).forEach(function(n) {
|
|
4781
|
+
ti(r, n, e[n]);
|
|
4782
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : ze(Object(e)).forEach(function(n) {
|
|
4783
|
+
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
|
|
4784
|
+
});
|
|
4785
|
+
}
|
|
4786
|
+
return r;
|
|
4787
|
+
}
|
|
4788
|
+
function ti(r, t, e) {
|
|
4789
|
+
return t = ei(t), t in r ? Object.defineProperty(r, t, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = e, r;
|
|
4790
|
+
}
|
|
4791
|
+
function ei(r) {
|
|
4792
|
+
var t = ri(r, "string");
|
|
4793
|
+
return vt(t) == "symbol" ? t : t + "";
|
|
4794
|
+
}
|
|
4795
|
+
function ri(r, t) {
|
|
4796
|
+
if (vt(r) != "object" || !r) return r;
|
|
4797
|
+
var e = r[Symbol.toPrimitive];
|
|
4798
|
+
if (e !== void 0) {
|
|
4799
|
+
var n = e.call(r, t);
|
|
4800
|
+
if (vt(n) != "object") return n;
|
|
4801
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4802
|
+
}
|
|
4803
|
+
return (t === "string" ? String : Number)(r);
|
|
4804
|
+
}
|
|
4805
|
+
Me(Me({}, _r.defaultOptions), {}, {
|
|
4806
|
+
httpStack: new Vo(),
|
|
4807
|
+
fileReader: new Io(),
|
|
4808
|
+
urlStorage: Qo ? new Zo() : new qn(),
|
|
4809
|
+
fingerprint: Do
|
|
4810
|
+
});
|
|
4811
|
+
export {
|
|
4812
|
+
Ve as g
|
|
4813
|
+
};
|