@uploadcare/file-uploader 1.28.0-alpha.111 → 1.28.0-alpha.666
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/loadFileUploaderFrom.d.ts +4 -4
- package/dist/abstract/loadFileUploaderFrom.js +7 -1
- package/dist/env.d.ts +4 -3
- package/dist/env.js +7 -1
- package/dist/index.css +4 -2010
- package/dist/index.d.ts +3099 -45
- package/dist/index.js +8 -7
- package/dist/index.layered.css +3 -1956
- package/dist/index.ssr.js +320 -1
- package/dist/locales/file-uploader/ar.d.ts +2 -2
- package/dist/locales/file-uploader/ar.js +7 -1
- package/dist/locales/file-uploader/az.d.ts +2 -2
- package/dist/locales/file-uploader/az.js +7 -1
- package/dist/locales/file-uploader/ca.d.ts +2 -2
- package/dist/locales/file-uploader/ca.js +7 -1
- package/dist/locales/file-uploader/cs.d.ts +2 -2
- package/dist/locales/file-uploader/cs.js +7 -1
- package/dist/locales/file-uploader/da.d.ts +2 -2
- package/dist/locales/file-uploader/da.js +7 -1
- package/dist/locales/file-uploader/de.d.ts +2 -2
- package/dist/locales/file-uploader/de.js +7 -1
- package/dist/locales/file-uploader/el.d.ts +2 -2
- package/dist/locales/file-uploader/el.js +7 -1
- package/dist/locales/file-uploader/en.d.ts +2 -2
- package/dist/locales/file-uploader/en.js +7 -1
- package/dist/locales/file-uploader/es.d.ts +2 -2
- package/dist/locales/file-uploader/es.js +7 -1
- package/dist/locales/file-uploader/et.d.ts +2 -2
- package/dist/locales/file-uploader/et.js +7 -1
- package/dist/locales/file-uploader/fi.d.ts +2 -2
- package/dist/locales/file-uploader/fi.js +7 -1
- package/dist/locales/file-uploader/fr.d.ts +2 -2
- package/dist/locales/file-uploader/fr.js +7 -1
- package/dist/locales/file-uploader/he.d.ts +2 -2
- package/dist/locales/file-uploader/he.js +7 -1
- package/dist/locales/file-uploader/hy.d.ts +2 -2
- package/dist/locales/file-uploader/hy.js +7 -1
- package/dist/locales/file-uploader/is.d.ts +2 -2
- package/dist/locales/file-uploader/is.js +7 -1
- package/dist/locales/file-uploader/it.d.ts +2 -2
- package/dist/locales/file-uploader/it.js +7 -1
- package/dist/locales/file-uploader/ja.d.ts +2 -2
- package/dist/locales/file-uploader/ja.js +7 -1
- package/dist/locales/file-uploader/ka.d.ts +2 -2
- package/dist/locales/file-uploader/ka.js +7 -1
- package/dist/locales/file-uploader/kk.d.ts +2 -2
- package/dist/locales/file-uploader/kk.js +7 -1
- package/dist/locales/file-uploader/ko.d.ts +2 -2
- package/dist/locales/file-uploader/ko.js +7 -1
- package/dist/locales/file-uploader/lv.d.ts +2 -2
- package/dist/locales/file-uploader/lv.js +7 -1
- package/dist/locales/file-uploader/nb.d.ts +2 -2
- package/dist/locales/file-uploader/nb.js +7 -1
- package/dist/locales/file-uploader/nl.d.ts +2 -2
- package/dist/locales/file-uploader/nl.js +7 -1
- package/dist/locales/file-uploader/pl.d.ts +2 -2
- package/dist/locales/file-uploader/pl.js +7 -1
- package/dist/locales/file-uploader/pt.d.ts +2 -2
- package/dist/locales/file-uploader/pt.js +7 -1
- package/dist/locales/file-uploader/ro.d.ts +2 -2
- package/dist/locales/file-uploader/ro.js +7 -1
- package/dist/locales/file-uploader/ru.d.ts +2 -2
- package/dist/locales/file-uploader/ru.js +7 -1
- package/dist/locales/file-uploader/sk.d.ts +2 -2
- package/dist/locales/file-uploader/sk.js +7 -1
- package/dist/locales/file-uploader/sr.d.ts +2 -2
- package/dist/locales/file-uploader/sr.js +7 -1
- package/dist/locales/file-uploader/sv.d.ts +2 -2
- package/dist/locales/file-uploader/sv.js +7 -1
- package/dist/locales/file-uploader/tr.d.ts +2 -2
- package/dist/locales/file-uploader/tr.js +7 -1
- package/dist/locales/file-uploader/uk.d.ts +2 -2
- package/dist/locales/file-uploader/uk.js +7 -1
- package/dist/locales/file-uploader/vi.d.ts +2 -2
- package/dist/locales/file-uploader/vi.js +7 -1
- package/dist/locales/file-uploader/zh-TW.d.ts +2 -2
- package/dist/locales/file-uploader/zh-TW.js +7 -1
- package/dist/locales/file-uploader/zh.d.ts +2 -2
- package/dist/locales/file-uploader/zh.js +7 -1
- package/package.json +33 -37
- package/web/file-uploader.iife.min.d.ts +3241 -0
- package/web/file-uploader.iife.min.js +8 -8
- package/web/file-uploader.iife.min.js.LEGAL.txt +71 -0
- package/web/file-uploader.min.d.ts +3241 -0
- package/web/file-uploader.min.js +8 -8
- package/web/file-uploader.min.js.LEGAL.txt +71 -0
- package/web/uc-basic.layered.min.css +3 -3239
- package/web/uc-basic.min.css +4 -3559
- package/web/uc-cloud-image-editor.layered.min.css +3 -1905
- package/web/uc-cloud-image-editor.min.css +3 -1856
- package/web/uc-cloud-image-editor.min.d.ts +3198 -0
- package/web/uc-cloud-image-editor.min.js +8 -8
- package/web/uc-cloud-image-editor.min.js.LEGAL.txt +70 -0
- package/web/uc-file-uploader-inline.layered.min.css +3 -3239
- package/web/uc-file-uploader-inline.min.css +4 -3559
- package/web/uc-file-uploader-inline.min.d.ts +3241 -0
- package/web/uc-file-uploader-inline.min.js +8 -8
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +71 -0
- package/web/uc-file-uploader-minimal.layered.min.css +3 -3239
- package/web/uc-file-uploader-minimal.min.css +4 -3559
- package/web/uc-file-uploader-minimal.min.d.ts +3241 -0
- package/web/uc-file-uploader-minimal.min.js +8 -8
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +71 -0
- package/web/uc-file-uploader-regular.layered.min.css +3 -3239
- package/web/uc-file-uploader-regular.min.css +4 -3559
- package/web/uc-file-uploader-regular.min.d.ts +3241 -0
- package/web/uc-file-uploader-regular.min.js +8 -8
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +71 -0
- package/web/uc-img.min.d.ts +75 -0
- package/web/uc-img.min.js +8 -5
- package/web/uc-img.min.js.LEGAL.txt +24 -0
- package/dist/abstract/CTX.d.ts +0 -42
- package/dist/abstract/CTX.d.ts.map +0 -1
- package/dist/abstract/TypedCollection.d.ts +0 -48
- package/dist/abstract/TypedCollection.d.ts.map +0 -1
- package/dist/abstract/TypedData.d.ts +0 -13
- package/dist/abstract/TypedData.d.ts.map +0 -1
- package/dist/abstract/UploaderPublicApi.d.ts +0 -42
- package/dist/abstract/UploaderPublicApi.d.ts.map +0 -1
- package/dist/abstract/buildOutputCollectionState.d.ts +0 -4
- package/dist/abstract/buildOutputCollectionState.d.ts.map +0 -1
- package/dist/abstract/customConfigOptions.d.ts +0 -66
- package/dist/abstract/customConfigOptions.d.ts.map +0 -1
- package/dist/abstract/defineComponents.d.ts +0 -2
- package/dist/abstract/defineComponents.d.ts.map +0 -1
- package/dist/abstract/features/ClipboardLayer.d.ts +0 -13
- package/dist/abstract/features/ClipboardLayer.d.ts.map +0 -1
- package/dist/abstract/loadFileUploaderFrom.d.ts.map +0 -1
- package/dist/abstract/localeRegistry.d.ts +0 -6
- package/dist/abstract/localeRegistry.d.ts.map +0 -1
- package/dist/abstract/managers/LocaleManager.d.ts +0 -11
- package/dist/abstract/managers/LocaleManager.d.ts.map +0 -1
- package/dist/abstract/managers/ModalManager.d.ts +0 -54
- package/dist/abstract/managers/ModalManager.d.ts.map +0 -1
- package/dist/abstract/managers/SecureUploadsManager.d.ts +0 -8
- package/dist/abstract/managers/SecureUploadsManager.d.ts.map +0 -1
- package/dist/abstract/managers/TelemetryManager.d.ts +0 -42
- package/dist/abstract/managers/TelemetryManager.d.ts.map +0 -1
- package/dist/abstract/managers/ValidationManager.d.ts +0 -35
- package/dist/abstract/managers/ValidationManager.d.ts.map +0 -1
- package/dist/abstract/managers/a11y.d.ts +0 -10
- package/dist/abstract/managers/a11y.d.ts.map +0 -1
- package/dist/abstract/managers/plugin/PluginManager.d.ts +0 -26
- package/dist/abstract/managers/plugin/PluginManager.d.ts.map +0 -1
- package/dist/abstract/managers/plugin/PluginTypes.d.ts +0 -147
- package/dist/abstract/managers/plugin/PluginTypes.d.ts.map +0 -1
- package/dist/abstract/managers/plugin/index.d.ts +0 -3
- package/dist/abstract/managers/plugin/index.d.ts.map +0 -1
- package/dist/abstract/sharedConfigKey.d.ts +0 -3
- package/dist/abstract/sharedConfigKey.d.ts.map +0 -1
- package/dist/abstract/uploadEntrySchema.d.ts +0 -35
- package/dist/abstract/uploadEntrySchema.d.ts.map +0 -1
- package/dist/blocks/ActivityHeader/ActivityHeader.d.ts +0 -10
- package/dist/blocks/ActivityHeader/ActivityHeader.d.ts.map +0 -1
- package/dist/blocks/CameraSource/CameraSource.d.ts +0 -126
- package/dist/blocks/CameraSource/CameraSource.d.ts.map +0 -1
- package/dist/blocks/CameraSource/calcCameraModes.d.ts +0 -6
- package/dist/blocks/CameraSource/calcCameraModes.d.ts.map +0 -1
- package/dist/blocks/CameraSource/constants.d.ts +0 -16
- package/dist/blocks/CameraSource/constants.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/index.d.ts +0 -3
- package/dist/blocks/CloudImageEditor/index.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +0 -68
- package/dist/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/CropFrame.d.ts +0 -57
- package/dist/blocks/CloudImageEditor/src/CropFrame.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +0 -26
- package/dist/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +0 -16
- package/dist/blocks/CloudImageEditor/src/EditorButtonControl.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +0 -14
- package/dist/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +0 -37
- package/dist/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +0 -58
- package/dist/blocks/CloudImageEditor/src/EditorImageCropper.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorImageFader.d.ts +0 -64
- package/dist/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +0 -16
- package/dist/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorScroller.d.ts +0 -16
- package/dist/blocks/CloudImageEditor/src/EditorScroller.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorSlider.d.ts +0 -35
- package/dist/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/EditorToolbar.d.ts +0 -78
- package/dist/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/crop-utils.d.ts +0 -37
- package/dist/blocks/CloudImageEditor/src/crop-utils.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/cropper-constants.d.ts +0 -11
- package/dist/blocks/CloudImageEditor/src/cropper-constants.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +0 -33
- package/dist/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +0 -20
- package/dist/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +0 -28
- package/dist/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +0 -39
- package/dist/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/index.d.ts +0 -16
- package/dist/blocks/CloudImageEditor/src/index.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/classNames.d.ts +0 -6
- package/dist/blocks/CloudImageEditor/src/lib/classNames.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/linspace.d.ts +0 -2
- package/dist/blocks/CloudImageEditor/src/lib/linspace.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +0 -5
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +0 -3
- package/dist/blocks/CloudImageEditor/src/lib/parseTabs.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/pick.d.ts +0 -2
- package/dist/blocks/CloudImageEditor/src/lib/pick.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +0 -8
- package/dist/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/state.d.ts +0 -21
- package/dist/blocks/CloudImageEditor/src/state.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/svg-sprite.d.ts +0 -3
- package/dist/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/toolbar-constants.d.ts +0 -62
- package/dist/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/types.d.ts +0 -61
- package/dist/blocks/CloudImageEditor/src/types.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/util.d.ts +0 -3
- package/dist/blocks/CloudImageEditor/src/util.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +0 -8
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +0 -1
- package/dist/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +0 -28
- package/dist/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +0 -1
- package/dist/blocks/Config/Config.d.ts +0 -62
- package/dist/blocks/Config/Config.d.ts.map +0 -1
- package/dist/blocks/Config/assertions.d.ts +0 -6
- package/dist/blocks/Config/assertions.d.ts.map +0 -1
- package/dist/blocks/Config/computed-properties.d.ts +0 -25
- package/dist/blocks/Config/computed-properties.d.ts.map +0 -1
- package/dist/blocks/Config/initialConfig.d.ts +0 -7
- package/dist/blocks/Config/initialConfig.d.ts.map +0 -1
- package/dist/blocks/Config/normalizeConfigValue.d.ts +0 -3
- package/dist/blocks/Config/normalizeConfigValue.d.ts.map +0 -1
- package/dist/blocks/Config/validatorsType.d.ts +0 -19
- package/dist/blocks/Config/validatorsType.d.ts.map +0 -1
- package/dist/blocks/Copyright/Copyright.d.ts +0 -12
- package/dist/blocks/Copyright/Copyright.d.ts.map +0 -1
- package/dist/blocks/DropArea/DropArea.d.ts +0 -50
- package/dist/blocks/DropArea/DropArea.d.ts.map +0 -1
- package/dist/blocks/DropArea/addDropzone.d.ts +0 -18
- package/dist/blocks/DropArea/addDropzone.d.ts.map +0 -1
- package/dist/blocks/DropArea/getDropItems.d.ts +0 -13
- package/dist/blocks/DropArea/getDropItems.d.ts.map +0 -1
- package/dist/blocks/ExternalSource/ExternalSource.d.ts +0 -50
- package/dist/blocks/ExternalSource/ExternalSource.d.ts.map +0 -1
- package/dist/blocks/ExternalSource/MessageBridge.d.ts +0 -12
- package/dist/blocks/ExternalSource/MessageBridge.d.ts.map +0 -1
- package/dist/blocks/ExternalSource/buildThemeDefinition.d.ts +0 -5
- package/dist/blocks/ExternalSource/buildThemeDefinition.d.ts.map +0 -1
- package/dist/blocks/ExternalSource/query-string.d.ts +0 -2
- package/dist/blocks/ExternalSource/query-string.d.ts.map +0 -1
- package/dist/blocks/ExternalSource/types.d.ts +0 -106
- package/dist/blocks/ExternalSource/types.d.ts.map +0 -1
- package/dist/blocks/FileItem/FileItem.d.ts +0 -55
- package/dist/blocks/FileItem/FileItem.d.ts.map +0 -1
- package/dist/blocks/FileItem/FileItemConfig.d.ts +0 -11
- package/dist/blocks/FileItem/FileItemConfig.d.ts.map +0 -1
- package/dist/blocks/FormInput/FormInput.d.ts +0 -19
- package/dist/blocks/FormInput/FormInput.d.ts.map +0 -1
- package/dist/blocks/Icon/Icon.d.ts +0 -21
- package/dist/blocks/Icon/Icon.d.ts.map +0 -1
- package/dist/blocks/Img/Img.d.ts +0 -15
- package/dist/blocks/Img/Img.d.ts.map +0 -1
- package/dist/blocks/Img/ImgBase.d.ts +0 -30
- package/dist/blocks/Img/ImgBase.d.ts.map +0 -1
- package/dist/blocks/Img/ImgConfig.d.ts +0 -29
- package/dist/blocks/Img/ImgConfig.d.ts.map +0 -1
- package/dist/blocks/Img/configurations.d.ts +0 -12
- package/dist/blocks/Img/configurations.d.ts.map +0 -1
- package/dist/blocks/Img/props-map.d.ts +0 -29
- package/dist/blocks/Img/props-map.d.ts.map +0 -1
- package/dist/blocks/Img/utils/parseObjectToString.d.ts +0 -3
- package/dist/blocks/Img/utils/parseObjectToString.d.ts.map +0 -1
- package/dist/blocks/Modal/Modal.d.ts +0 -36
- package/dist/blocks/Modal/Modal.d.ts.map +0 -1
- package/dist/blocks/PluginActivityRenderer/PluginActivityRenderer.d.ts +0 -35
- package/dist/blocks/PluginActivityRenderer/PluginActivityRenderer.d.ts.map +0 -1
- package/dist/blocks/PluginActivityRenderer/index.d.ts +0 -2
- package/dist/blocks/PluginActivityRenderer/index.d.ts.map +0 -1
- package/dist/blocks/ProgressBar/ProgressBar.d.ts +0 -23
- package/dist/blocks/ProgressBar/ProgressBar.d.ts.map +0 -1
- package/dist/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +0 -20
- package/dist/blocks/ProgressBarCommon/ProgressBarCommon.d.ts.map +0 -1
- package/dist/blocks/Select/Select.d.ts +0 -20
- package/dist/blocks/Select/Select.d.ts.map +0 -1
- package/dist/blocks/SimpleBtn/SimpleBtn.d.ts +0 -19
- package/dist/blocks/SimpleBtn/SimpleBtn.d.ts.map +0 -1
- package/dist/blocks/SourceBtn/SourceBtn.d.ts +0 -26
- package/dist/blocks/SourceBtn/SourceBtn.d.ts.map +0 -1
- package/dist/blocks/SourceList/SourceList.d.ts +0 -26
- package/dist/blocks/SourceList/SourceList.d.ts.map +0 -1
- package/dist/blocks/Spinner/Spinner.d.ts +0 -11
- package/dist/blocks/Spinner/Spinner.d.ts.map +0 -1
- package/dist/blocks/StartFrom/StartFrom.d.ts +0 -14
- package/dist/blocks/StartFrom/StartFrom.d.ts.map +0 -1
- package/dist/blocks/Thumb/Thumb.d.ts +0 -38
- package/dist/blocks/Thumb/Thumb.d.ts.map +0 -1
- package/dist/blocks/UploadCtxProvider/EventEmitter.d.ts +0 -71
- package/dist/blocks/UploadCtxProvider/EventEmitter.d.ts.map +0 -1
- package/dist/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +0 -45
- package/dist/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +0 -1
- package/dist/blocks/UploadList/UploadList.d.ts +0 -45
- package/dist/blocks/UploadList/UploadList.d.ts.map +0 -1
- package/dist/blocks/UrlSource/UrlSource.d.ts +0 -18
- package/dist/blocks/UrlSource/UrlSource.d.ts.map +0 -1
- package/dist/blocks/svg-backgrounds/svg-backgrounds.d.ts +0 -4
- package/dist/blocks/svg-backgrounds/svg-backgrounds.d.ts.map +0 -1
- package/dist/blocks/themes/uc-basic/svg-sprite.d.ts +0 -3
- package/dist/blocks/themes/uc-basic/svg-sprite.d.ts.map +0 -1
- package/dist/cameraPlugin.js +0 -1
- package/dist/cloudImageEditorPlugin.css +0 -1282
- package/dist/cloudImageEditorPlugin.js +0 -1
- package/dist/cloudImageEditorPlugin.layered.css +0 -1289
- package/dist/core.d.ts +0 -45
- package/dist/core.d.ts.map +0 -1
- package/dist/env.d.ts.map +0 -1
- package/dist/externalSourcesPlugin.js +0 -1
- package/dist/imageShrinkPlugin.js +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/instagramPlugin.js +0 -1
- package/dist/lit/BaseComponent.d.ts +0 -13
- package/dist/lit/BaseComponent.d.ts.map +0 -1
- package/dist/lit/Constructor.d.ts +0 -2
- package/dist/lit/Constructor.d.ts.map +0 -1
- package/dist/lit/CssDataMixin.d.ts +0 -8
- package/dist/lit/CssDataMixin.d.ts.map +0 -1
- package/dist/lit/LightDomMixin.d.ts +0 -9
- package/dist/lit/LightDomMixin.d.ts.map +0 -1
- package/dist/lit/LitActivityBlock.d.ts +0 -54
- package/dist/lit/LitActivityBlock.d.ts.map +0 -1
- package/dist/lit/LitBlock.d.ts +0 -84
- package/dist/lit/LitBlock.d.ts.map +0 -1
- package/dist/lit/LitSolutionBlock.d.ts +0 -22
- package/dist/lit/LitSolutionBlock.d.ts.map +0 -1
- package/dist/lit/LitUploaderBlock.d.ts +0 -54
- package/dist/lit/LitUploaderBlock.d.ts.map +0 -1
- package/dist/lit/PubSubCompat.d.ts +0 -19
- package/dist/lit/PubSubCompat.d.ts.map +0 -1
- package/dist/lit/RegisterableElementMixin.d.ts +0 -8
- package/dist/lit/RegisterableElementMixin.d.ts.map +0 -1
- package/dist/lit/SharedState.d.ts +0 -120
- package/dist/lit/SharedState.d.ts.map +0 -1
- package/dist/lit/SymbioteCompatMixin.d.ts +0 -41
- package/dist/lit/SymbioteCompatMixin.d.ts.map +0 -1
- package/dist/lit/TestModeController.d.ts +0 -17
- package/dist/lit/TestModeController.d.ts.map +0 -1
- package/dist/lit/Uid.d.ts +0 -4
- package/dist/lit/Uid.d.ts.map +0 -1
- package/dist/lit/activity-constants.d.ts +0 -12
- package/dist/lit/activity-constants.d.ts.map +0 -1
- package/dist/lit/createDebugPrinter.d.ts +0 -4
- package/dist/lit/createDebugPrinter.d.ts.map +0 -1
- package/dist/lit/findBlockInCtx.d.ts +0 -4
- package/dist/lit/findBlockInCtx.d.ts.map +0 -1
- package/dist/lit/getOutputData.d.ts +0 -3
- package/dist/lit/getOutputData.d.ts.map +0 -1
- package/dist/lit/hasBlockInCtx.d.ts +0 -4
- package/dist/lit/hasBlockInCtx.d.ts.map +0 -1
- package/dist/lit/l10n.d.ts +0 -6
- package/dist/lit/l10n.d.ts.map +0 -1
- package/dist/lit/parseCssPropertyValue.d.ts +0 -2
- package/dist/lit/parseCssPropertyValue.d.ts.map +0 -1
- package/dist/lit/shared-instances.d.ts +0 -66
- package/dist/lit/shared-instances.d.ts.map +0 -1
- package/dist/locales/file-uploader/ar.d.ts.map +0 -1
- package/dist/locales/file-uploader/az.d.ts.map +0 -1
- package/dist/locales/file-uploader/ca.d.ts.map +0 -1
- package/dist/locales/file-uploader/cs.d.ts.map +0 -1
- package/dist/locales/file-uploader/da.d.ts.map +0 -1
- package/dist/locales/file-uploader/de.d.ts.map +0 -1
- package/dist/locales/file-uploader/el.d.ts.map +0 -1
- package/dist/locales/file-uploader/en.d.ts.map +0 -1
- package/dist/locales/file-uploader/es.d.ts.map +0 -1
- package/dist/locales/file-uploader/et.d.ts.map +0 -1
- package/dist/locales/file-uploader/fi.d.ts.map +0 -1
- package/dist/locales/file-uploader/fr.d.ts.map +0 -1
- package/dist/locales/file-uploader/he.d.ts.map +0 -1
- package/dist/locales/file-uploader/hy.d.ts.map +0 -1
- package/dist/locales/file-uploader/is.d.ts.map +0 -1
- package/dist/locales/file-uploader/it.d.ts.map +0 -1
- package/dist/locales/file-uploader/ja.d.ts.map +0 -1
- package/dist/locales/file-uploader/ka.d.ts.map +0 -1
- package/dist/locales/file-uploader/kk.d.ts.map +0 -1
- package/dist/locales/file-uploader/ko.d.ts.map +0 -1
- package/dist/locales/file-uploader/lv.d.ts.map +0 -1
- package/dist/locales/file-uploader/nb.d.ts.map +0 -1
- package/dist/locales/file-uploader/nl.d.ts.map +0 -1
- package/dist/locales/file-uploader/pl.d.ts.map +0 -1
- package/dist/locales/file-uploader/pt.d.ts.map +0 -1
- package/dist/locales/file-uploader/ro.d.ts.map +0 -1
- package/dist/locales/file-uploader/ru.d.ts.map +0 -1
- package/dist/locales/file-uploader/sk.d.ts.map +0 -1
- package/dist/locales/file-uploader/sr.d.ts.map +0 -1
- package/dist/locales/file-uploader/sv.d.ts.map +0 -1
- package/dist/locales/file-uploader/tr.d.ts.map +0 -1
- package/dist/locales/file-uploader/uk.d.ts.map +0 -1
- package/dist/locales/file-uploader/vi.d.ts.map +0 -1
- package/dist/locales/file-uploader/zh-TW.d.ts.map +0 -1
- package/dist/locales/file-uploader/zh.d.ts.map +0 -1
- package/dist/plugins/cameraPlugin.d.ts +0 -3
- package/dist/plugins/cameraPlugin.d.ts.map +0 -1
- package/dist/plugins/cloudImageEditorPlugin.d.ts +0 -3
- package/dist/plugins/cloudImageEditorPlugin.d.ts.map +0 -1
- package/dist/plugins/externalSourcesPlugin.d.ts +0 -3
- package/dist/plugins/externalSourcesPlugin.d.ts.map +0 -1
- package/dist/plugins/imageShrinkPlugin.d.ts +0 -3
- package/dist/plugins/imageShrinkPlugin.d.ts.map +0 -1
- package/dist/plugins/instagramPlugin.d.ts +0 -3
- package/dist/plugins/instagramPlugin.d.ts.map +0 -1
- package/dist/plugins/unsplashPlugin.d.ts +0 -17
- package/dist/plugins/unsplashPlugin.d.ts.map +0 -1
- package/dist/plugins/urlSourcePlugin.d.ts +0 -3
- package/dist/plugins/urlSourcePlugin.d.ts.map +0 -1
- package/dist/solutions/adaptive-image/index.d.ts +0 -3
- package/dist/solutions/adaptive-image/index.d.ts.map +0 -1
- package/dist/solutions/cloud-image-editor/CloudImageEditor.d.ts +0 -12
- package/dist/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +0 -1
- package/dist/solutions/cloud-image-editor/index.d.ts +0 -7
- package/dist/solutions/cloud-image-editor/index.d.ts.map +0 -1
- package/dist/solutions/file-uploader/inline/FileUploaderInline.d.ts +0 -29
- package/dist/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +0 -1
- package/dist/solutions/file-uploader/inline/index.d.ts +0 -2
- package/dist/solutions/file-uploader/inline/index.d.ts.map +0 -1
- package/dist/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +0 -33
- package/dist/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +0 -1
- package/dist/solutions/file-uploader/minimal/index.d.ts +0 -2
- package/dist/solutions/file-uploader/minimal/index.d.ts.map +0 -1
- package/dist/solutions/file-uploader/regular/FileUploaderRegular.d.ts +0 -28
- package/dist/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +0 -1
- package/dist/solutions/file-uploader/regular/index.d.ts +0 -2
- package/dist/solutions/file-uploader/regular/index.d.ts.map +0 -1
- package/dist/types/dom.d.ts +0 -2
- package/dist/types/dom.d.ts.map +0 -1
- package/dist/types/events.d.ts +0 -5
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/exported.d.ts +0 -493
- package/dist/types/exported.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +0 -1
- package/dist/urlSourcePlugin.js +0 -1
- package/dist/utils/UID.d.ts +0 -6
- package/dist/utils/UID.d.ts.map +0 -1
- package/dist/utils/UploadSource.d.ts +0 -38
- package/dist/utils/UploadSource.d.ts.map +0 -1
- package/dist/utils/WindowHeightTracker.d.ts +0 -10
- package/dist/utils/WindowHeightTracker.d.ts.map +0 -1
- package/dist/utils/abilities.d.ts +0 -2
- package/dist/utils/abilities.d.ts.map +0 -1
- package/dist/utils/applyStyles.d.ts +0 -2
- package/dist/utils/applyStyles.d.ts.map +0 -1
- package/dist/utils/browser-info.d.ts +0 -13
- package/dist/utils/browser-info.d.ts.map +0 -1
- package/dist/utils/cdn-utils.d.ts +0 -54
- package/dist/utils/cdn-utils.d.ts.map +0 -1
- package/dist/utils/comma-separated.d.ts +0 -3
- package/dist/utils/comma-separated.d.ts.map +0 -1
- package/dist/utils/debounce.d.ts +0 -4
- package/dist/utils/debounce.d.ts.map +0 -1
- package/dist/utils/delay.d.ts +0 -2
- package/dist/utils/delay.d.ts.map +0 -1
- package/dist/utils/fileTypes.d.ts +0 -12
- package/dist/utils/fileTypes.d.ts.map +0 -1
- package/dist/utils/get-top-level-origin.d.ts +0 -2
- package/dist/utils/get-top-level-origin.d.ts.map +0 -1
- package/dist/utils/getLocaleDirection.d.ts +0 -2
- package/dist/utils/getLocaleDirection.d.ts.map +0 -1
- package/dist/utils/getPluralForm.d.ts +0 -2
- package/dist/utils/getPluralForm.d.ts.map +0 -1
- package/dist/utils/isPromiseLike.d.ts +0 -2
- package/dist/utils/isPromiseLike.d.ts.map +0 -1
- package/dist/utils/isSecureTokenExpired.d.ts +0 -9
- package/dist/utils/isSecureTokenExpired.d.ts.map +0 -1
- package/dist/utils/memoize.d.ts +0 -2
- package/dist/utils/memoize.d.ts.map +0 -1
- package/dist/utils/mixinClass.d.ts +0 -9
- package/dist/utils/mixinClass.d.ts.map +0 -1
- package/dist/utils/parseCdnUrl.d.ts +0 -12
- package/dist/utils/parseCdnUrl.d.ts.map +0 -1
- package/dist/utils/parseShrink.d.ts +0 -8
- package/dist/utils/parseShrink.d.ts.map +0 -1
- package/dist/utils/preloadImage.d.ts +0 -11
- package/dist/utils/preloadImage.d.ts.map +0 -1
- package/dist/utils/prettyBytes.d.ts +0 -12
- package/dist/utils/prettyBytes.d.ts.map +0 -1
- package/dist/utils/resizeImage.d.ts +0 -2
- package/dist/utils/resizeImage.d.ts.map +0 -1
- package/dist/utils/stringToArray.d.ts +0 -2
- package/dist/utils/stringToArray.d.ts.map +0 -1
- package/dist/utils/template-utils.d.ts +0 -17
- package/dist/utils/template-utils.d.ts.map +0 -1
- package/dist/utils/throttle.d.ts +0 -4
- package/dist/utils/throttle.d.ts.map +0 -1
- package/dist/utils/toKebabCase.d.ts +0 -3
- package/dist/utils/toKebabCase.d.ts.map +0 -1
- package/dist/utils/transparentPixelSrc.d.ts +0 -2
- package/dist/utils/transparentPixelSrc.d.ts.map +0 -1
- package/dist/utils/uniqueArray.d.ts +0 -2
- package/dist/utils/uniqueArray.d.ts.map +0 -1
- package/dist/utils/userAgent.d.ts +0 -3
- package/dist/utils/userAgent.d.ts.map +0 -1
- package/dist/utils/validators/collection/index.d.ts +0 -3
- package/dist/utils/validators/collection/index.d.ts.map +0 -1
- package/dist/utils/validators/collection/validateCollectionUploadError.d.ts +0 -3
- package/dist/utils/validators/collection/validateCollectionUploadError.d.ts.map +0 -1
- package/dist/utils/validators/collection/validateMultiple.d.ts +0 -3
- package/dist/utils/validators/collection/validateMultiple.d.ts.map +0 -1
- package/dist/utils/validators/file/index.d.ts +0 -5
- package/dist/utils/validators/file/index.d.ts.map +0 -1
- package/dist/utils/validators/file/validateFileType.d.ts +0 -3
- package/dist/utils/validators/file/validateFileType.d.ts.map +0 -1
- package/dist/utils/validators/file/validateIsImage.d.ts +0 -3
- package/dist/utils/validators/file/validateIsImage.d.ts.map +0 -1
- package/dist/utils/validators/file/validateMaxSizeLimit.d.ts +0 -3
- package/dist/utils/validators/file/validateMaxSizeLimit.d.ts.map +0 -1
- package/dist/utils/validators/file/validateUploadError.d.ts +0 -3
- package/dist/utils/validators/file/validateUploadError.d.ts.map +0 -1
- package/dist/utils/warnOnce.d.ts +0 -2
- package/dist/utils/warnOnce.d.ts.map +0 -1
- package/dist/utils/wildcardRegexp.d.ts +0 -2
- package/dist/utils/wildcardRegexp.d.ts.map +0 -1
- package/dist/utils/withResolvers.d.ts +0 -6
- package/dist/utils/withResolvers.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import*as __rspack_external__uploadcare_upload_client_41a5a0bd from"@uploadcare/upload-client";import*as __rspack_external_lit from"lit";import*as __rspack_external_lit_decorators_js_aaefadbe from"lit/decorators.js";import*as __rspack_external_lit_directives_ref_js_a17221f9 from"lit/directives/ref.js";import*as __rspack_external_lit_directives_style_map_js_cb619b3b from"lit/directives/style-map.js";import*as __rspack_external_lit_directives_unsafe_svg_js_aeac3291 from"lit/directives/unsafe-svg.js";import*as __rspack_external_nanostores from"nanostores";import*as __rspack_external__lit_context_417c9377 from"@lit/context";import*as __rspack_external_keyux from"keyux";import*as __rspack_external__uploadcare_quality_insights_89d21ee8 from"@uploadcare/quality-insights";import*as __rspack_external_lit_directives_repeat_js_fd3099f6 from"lit/directives/repeat.js";import*as __rspack_external__uploadcare_cname_prefix_async_eddbdf1f from"@uploadcare/cname-prefix/async";var scriptUrl,installedChunks,loadCssChunkData,loadingAttribute,installedChunks1,installChunk,__webpack_modules__={7992(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{HU:()=>blockCtx,_H:()=>activityBlockCtx,lu:()=>uploaderBlockCtx,u8:()=>solutionBlockCtx});var _uploadcare_upload_client__rspack_import_0=__webpack_require__(5474);let blockCtx=()=>({}),activityBlockCtx=fnCtx=>({...blockCtx(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{fnCtx.modalManager?.close(fnCtx.$["*currentActivity"]),fnCtx.pub("*currentActivity",null)}}),uploaderBlockCtx=fnCtx=>({...activityBlockCtx(fnCtx),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new _uploadcare_upload_client__rspack_import_0.Queue(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),solutionBlockCtx=fnCtx=>({...uploaderBlockCtx(fnCtx),"*solution":null})},3962(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Y:()=>defineComponents});let EXCLUDE_COMPONENTS=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function defineComponents(blockExports){for(let blockName in blockExports){if(EXCLUDE_COMPONENTS.includes(blockName))continue;let tagName=[...blockName].reduce((name,char)=>(char.toUpperCase()===char&&(char=`-${char.toLowerCase()}`),name+=char),"");tagName.startsWith("-")&&(tagName=tagName.replace("-","")),tagName.startsWith("uc-")||(tagName=`uc-${tagName}`),blockExports[blockName].reg&&blockExports[blockName].reg(tagName)}}},225(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{D:()=>loadFileUploaderFrom});var _defineComponents__rspack_import_0=__webpack_require__(3962);function loadFileUploaderFrom(url,register=!1){return new Promise((resolve,reject)=>{if("object"!=typeof document)return void resolve(null);if("object"==typeof window&&window.UC)return void resolve(window.UC);let script=document.createElement("script");script.async=!0,script.src=url,script.onerror=()=>{reject()},script.onload=()=>{let blocks=window.UC;register&&(0,_defineComponents__rspack_import_0.Y)(blocks),resolve(blocks)},document.head.appendChild(script)})}},7444(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>defineLocale,s:()=>resolveLocaleDefinition});var _locales_file_uploader_en__rspack_import_0=__webpack_require__(1491);let localeRegistry=new Map,localeResolvers=new Map,defineLocaleSync=(localeName,definition)=>{localeRegistry.has(localeName)&&console.log(`Locale ${localeName} is already defined. Overwriting...`);let locale={..._locales_file_uploader_en__rspack_import_0.A,...definition};return localeRegistry.set(localeName,locale),locale},defineLocale=(localeName,definitionOrResolver)=>{if("function"==typeof definitionOrResolver)localeResolvers.set(localeName,definitionOrResolver);else defineLocaleSync(localeName,definitionOrResolver)},resolveLocaleDefinition=async localeName=>{let localeDefinition=localeRegistry.get(localeName);if(!localeDefinition){let definitionResolver=localeResolvers.get(localeName);if(!definitionResolver)throw Error(`Locale ${localeName} is not defined`);localeDefinition=defineLocaleSync(localeName,await definitionResolver())}return localeDefinition};defineLocale("en",_locales_file_uploader_en__rspack_import_0.A)},7959(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{OZ:()=>LocaleManager,PI:()=>localeStateKey});var _lit_shared_instances__rspack_import_0=__webpack_require__(5890),_locales_file_uploader_en__rspack_import_1=__webpack_require__(1491),_localeRegistry__rspack_import_3=__webpack_require__(7444),_sharedConfigKey__rspack_import_2=__webpack_require__(1971);let localeStateKey=key=>`*l10n/${key}`;class LocaleManager extends _lit_shared_instances__rspack_import_0.jM{constructor(sharedInstancesBag){for(let[key,value]of(super(sharedInstancesBag),this._localeName="",Object.entries(_locales_file_uploader_en__rspack_import_1.A))){let noTranslation=!this._ctx.has(localeStateKey(key))||!this._ctx.read(localeStateKey(key));this._ctx.add(localeStateKey(key),value,noTranslation)}let pluginManager=sharedInstancesBag.pluginManager;pluginManager?.onPluginsChange&&this.addSub(pluginManager.onPluginsChange(()=>{this._localeName&&this._applyPluginLocales(this._localeName)})),this.addSub(this._ctx.sub((0,_sharedConfigKey__rspack_import_2.T)("localeName"),async localeName=>{if(!localeName)return;this._localeName=localeName;let definition=await (0,_localeRegistry__rspack_import_3.s)(localeName);("en"===localeName||this._localeName===localeName)&&(this._applyPluginLocales(localeName),this._applyOverrides(localeName,definition))})),this.addSub(this._ctx.sub((0,_sharedConfigKey__rspack_import_2.T)("localeDefinitionOverride"),localeDefinitionOverride=>{if(!localeDefinitionOverride)return;let definition=localeDefinitionOverride[this._localeName];definition&&this._applyOverrides(this._localeName,definition)}))}_applyOverrides(localeName,definition){let overrides=this._cfg.localeDefinitionOverride?.[localeName];for(let[key,value]of Object.entries(definition)){let overriddenValue=overrides?.[key];this._ctx.add(localeStateKey(key),overriddenValue??value,!0)}}_applyPluginLocales(localeName){let pluginManager=this._sharedInstancesBag.pluginManager;if(pluginManager)for(let entry of pluginManager.snapshot().i18n){let{pluginId:_pluginId,...locales}=entry,pluginDefinition=locales[localeName];if(pluginDefinition)for(let[key,value]of Object.entries(pluginDefinition))void 0!==value&&this._ctx.add(localeStateKey(key),value,!0)}}}},3076(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{D:()=>ModalEvents,P:()=>ModalManager});var _lit_shared_instances__rspack_import_0=__webpack_require__(5890);let ModalEvents=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"});class ModalManager extends _lit_shared_instances__rspack_import_0.jM{registerModal(id,modal){this._modals.set(id,modal),this._notify(ModalEvents.ADD,{id,modal})}deleteModal(id){let modal=this._modals.get(id);return!!modal&&(this._modals.delete(id),this._activeModals.delete(id),this._notify(ModalEvents.DELETE,{id,modal}),!0)}open(id){let modal=this._modals.get(id);return modal?(this._activeModals.add(id),this._notify(ModalEvents.OPEN,{modal,id}),!0):(this._debugPrint(`Modal with ID "${id}" not found`),!1)}close(id){let modal=this._modals.get(id);return modal&&this._activeModals.has(id)?(this._activeModals.delete(id),this._notify(ModalEvents.CLOSE,{id,modal}),!0):(this._debugPrint(`Modal with ID "${id}" not found or not active`),!1)}toggle(id){return this._modals.has(id)?this._activeModals.has(id)?this.close(id):this.open(id):(this._debugPrint(`Modal with ID "${id}" not found`),!1)}get hasActiveModals(){return this._activeModals.size>0}back(){if(0===this._activeModals.size)return this._debugPrint("No active modals to go back from"),!1;let lastModalId=Array.from(this._activeModals).pop();return!!lastModalId&&this.close(lastModalId)}closeAll(){let count=this._activeModals.size;return this._activeModals.clear(),this._notify(ModalEvents.CLOSE_ALL,{}),count}subscribe(event,callback){return this._subscribers.has(event)||this._subscribers.set(event,new Set),this._subscribers.get(event)?.add(callback),()=>this.unsubscribe(event,callback)}unsubscribe(event,callback){this._subscribers.has(event)&&this._subscribers.get(event)?.delete(callback)}_notify(event,data){if(this._subscribers.has(event))for(let callback of this._subscribers.get(event)??new Set)try{callback(data)}catch(error){this._sharedInstancesBag.telemetryManager.sendEventError(error,"modal subscriber"),this._debugPrint("Error in modal subscriber:",error)}}destroy(){super.destroy(),this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(ModalEvents.DESTROY,{})}constructor(...args){super(...args),this._modals=new Map,this._activeModals=new Set,this._subscribers=new Map}}},1971(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{T:()=>sharedConfigKey});let sharedConfigKey=key=>`*cfg/${key}`},4252(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{r:()=>CameraSource});var external_lit_=__webpack_require__(2927),decorators_js_=__webpack_require__(8899),LitActivityBlock=__webpack_require__(5923),LitUploaderBlock=__webpack_require__(5544),comma_separated=__webpack_require__(9101),debounce=__webpack_require__(4441),stringToArray=__webpack_require__(2513),UploadSource=__webpack_require__(5730),EventEmitter=__webpack_require__(9963),ref_js_=__webpack_require__(5337),style_map_js_=__webpack_require__(1156),constants=__webpack_require__(5973);function _ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}let DEFAULT_VIDEO_CONFIG={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},DEFAULT_PERMISSIONS=["camera","microphone"];function formatTime(time){let minutes=Math.floor(time/60).toString().padStart(2,"0"),seconds=Math.floor(time%60).toString().padStart(2,"0");return`${minutes}:${seconds}`}let DEFAULT_PICTURE_FORMAT="image/jpeg",DEFAULT_VIDEO_FORMAT="video/webm";class CameraSource extends LitUploaderBlock.z{_attachPreviewListeners(videoElement){this._detachPreviewListeners(videoElement),videoElement.addEventListener("play",this._handlePreviewPlay),videoElement.addEventListener("pause",this._handlePreviewPause)}_detachPreviewListeners(videoElement){videoElement?.removeEventListener("play",this._handlePreviewPlay),videoElement?.removeEventListener("pause",this._handlePreviewPause)}_setVideoSource(stream){this._currentVideoSource!==stream&&(this._currentVideoSource=stream,this._applyVideoSource())}_applyVideoSource(){let videoElement=this._videoRef.value;if(!videoElement)return;let nextSource=this._currentVideoSource??null;videoElement.srcObject!==nextSource&&(videoElement.srcObject=nextSource)}_shot(){if(this._setCameraState("shot"),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),!this._ctx)throw Error("Failed to get canvas context");let videoEl=this._videoRef.value;if(!videoEl)throw Error("Video element not found");this._canvas.height=videoEl.videoHeight,this._canvas.width=videoEl.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(videoEl,0,0),videoEl.pause()}_guessExtensionByMime(mime){let knownContainers={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(""===mime)return"webm";if(mime){let parts=mime.split("/");if(parts?.[0]==="video"){let rest=parts.slice(1).join("/"),container=rest?.split(";")[0];if(container&&knownContainers[container])return knownContainers[container]}}return"avi"}get _cameraModes(){return(0,stringToArray.G)(this.cfg.cameraModes).filter(mode=>mode===constants.S.PHOTO||mode===constants.S.VIDEO)}_teardownPermissionListeners(){if(0!==this._permissionCleanupFns.length){for(let cleanup of this._permissionCleanupFns)cleanup();this._permissionCleanupFns=[],this._unsubPermissions=null}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",val=>{this._videoTransformCss=val?"scaleX(-1)":null}),this.subConfigValue("enableAudioRecording",val=>{this._audioToggleMicrophoneHidden=!val,this._audioSelectDisabled=!val}),this.subConfigValue("cameraModes",val=>{if(!this.isConnected)return;let cameraModes=(0,comma_separated.A)(val);this._handleCameraModes(cameraModes.filter(mode=>mode===constants.S.PHOTO||mode===constants.S.VIDEO))}),this._onActivate()}firstUpdated(changedProperties){super.firstUpdated(changedProperties),this._applyVideoSource()}updated(changedProperties){super.updated(changedProperties),this._applyVideoSource()}_destroy(){this._teardownPermissionListeners(),navigator.mediaDevices?.removeEventListener("devicechange",this._getDevices),this._detachPreviewListeners(this._videoRef.value),this._setVideoSource(null)}disconnectedCallback(){super.disconnectedCallback(),this._onDeactivate(),this._destroy()}render(){return(0,external_lit_.html)`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this._cameraSelectHidden}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this._cameraSelectOptions} ?hidden=${this._cameraSelectHidden} @change=${this._handleCameraSelectChange} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${(0,style_map_js_.styleMap)({transform:this._videoTransformCss})} ?hidden=${this._videoHidden} ${(0,ref_js_.ref)(this._videoRef)} ></video><div class="uc-message-box" ?hidden=${this._messageHidden}><span>${this.l10n(this._l10nMessage)}</span><button type="button" @click=${this._handleRequestPermissions} ?hidden=${this._requestBtnHidden} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${(0,ref_js_.ref)(this._switcherRef)} class="uc-switcher" ?hidden=${!this._timerHidden}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this._handleClickTab} ?hidden=${this._tabCameraHidden} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this._handleClickTab} ?hidden=${this._tabVideoHidden} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this._handleToggleRecording} ?hidden=${this._timerHidden} data-testid="recording-timer" ><uc-icon name=${this._currentTimelineIcon}></uc-icon><span ${(0,ref_js_.ref)(this._timerRef)}> 00:00 </span><span ${(0,ref_js_.ref)(this._lineRef)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this._cameraActionsHidden} ><button type="button" class="uc-secondary-btn" @click=${this._handleRetake}> Retake </button><button type="button" class="uc-primary-btn" @click=${this._handleAccept} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this._handleStartCamera} class=${this._mutableClassButton} ?hidden=${this._cameraHidden} ><uc-icon name=${this._currentIcon}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this._handleToggleAudio} ?hidden=${this._audioToggleMicrophoneHidden} data-testid="toggle-microphone" ><uc-icon name=${this._toggleMicrophoneIcon}></uc-icon></button><uc-select class="uc-audio-select" .options=${this._audioSelectOptions} ?hidden=${this._audioSelectHidden} ?disabled=${this._audioSelectDisabled} @change=${this._handleAudioSelectChange} data-testid="audio-select" ></uc-select></div></div>`}constructor(...args){super(...args),this.couldBeCtxOwner=!0,this._unsubPermissions=null,this._capturing=!1,this._chunks=[],this._mediaRecorder=null,this._stream=null,this._selectedAudioId=null,this._selectedCameraId=null,this._activeTab=null,this._options={},this._canvas=null,this._ctx=null,this._cameraDevices=[],this._audioDevices=[],this._permissionResponses={},this._permissionCleanupFns=[],this._currentVideoSource=null,this._handlePreviewPlay=()=>{this._startTimeline(),this._currentTimelineIcon="pause"},this._handlePreviewPause=()=>{this._currentTimelineIcon="play",this._stopTimeline()},this._timerRef=(0,ref_js_.createRef)(),this._lineRef=(0,ref_js_.createRef)(),this._videoRef=(0,ref_js_.createRef)(),this._switcherRef=(0,ref_js_.createRef)(),this._startTime=0,this._elapsedTime=0,this._videoTransformCss=null,this._videoHidden=!0,this._messageHidden=!0,this._requestBtnHidden=void 0!==navigator.permissions,this._cameraSelectOptions=[],this._cameraSelectHidden=!0,this._l10nMessage="",this._timerHidden=!0,this._cameraHidden=!0,this._cameraActionsHidden=!0,this._audioSelectOptions=[],this._audioSelectHidden=!0,this._audioSelectDisabled=!0,this._audioToggleMicrophoneHidden=!0,this._tabCameraHidden=!0,this._tabVideoHidden=!0,this._currentIcon="camera-full",this._currentTimelineIcon="play",this._toggleMicrophoneIcon="microphone",this._mutableClassButton="uc-shot-btn uc-camera-action",this._chooseActionWithCamera=()=>{if(this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this._activeTab}}}),this._activeTab===constants.S.PHOTO&&this._shot(),this._activeTab===constants.S.VIDEO){if(this._mediaRecorder?.state==="recording")return void this._stopRecording();this._startRecording()}},this._handleCameraSelectChange=event=>{let target=event.target;target&&(this._selectedCameraId=target.value,this._capture())},this._handleAudioSelectChange=event=>{let target=event.target;target&&(this._selectedAudioId=target.value,this._capture())},this._handleRequestPermissions=()=>{this._capture()},this._handleStartCamera=()=>{this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this._activeTab}}}),this._chooseActionWithCamera()},this._handleToggleRecording=()=>{this._toggleRecording()},this._handleToggleAudio=()=>{this._toggleEnableAudio()},this._handleRetake=()=>{this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this._activeTab}}}),this._retake()},this._handleAccept=()=>{this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this._activeTab}}}),this._accept()},this._handleClickTab=event=>{let target=event.currentTarget,id=target?.getAttribute("data-id");id&&this._handleActiveTab(id)},this._updateTimer=()=>{let currentTime=Math.floor((performance.now()-this._startTime+this._elapsedTime)/1e3);if("number"==typeof this.cfg.maxVideoRecordingDuration&&this.cfg.maxVideoRecordingDuration>0){let remainingTime=this.cfg.maxVideoRecordingDuration-currentTime;if(remainingTime<=0){let timer=this._timerRef.value;timer&&(timer.textContent=formatTime(remainingTime)),this._stopRecording();return}let timer=this._timerRef.value;timer&&(timer.textContent=formatTime(remainingTime))}else{let timer=this._timerRef.value;timer&&(timer.textContent=formatTime(currentTime))}this._animationFrameId=requestAnimationFrame(this._updateTimer)},this._startTimer=()=>{this._startTime=performance.now(),this._elapsedTime=0,this._updateTimer()},this._stopTimer=()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},this._startTimeline=()=>{let video=this._videoRef.value;if(!video)return;let currentTime=video.currentTime,duration=video.duration||1,line=this._lineRef.value;line&&(line.style.transform=`scaleX(${currentTime/duration})`);let timer=this._timerRef.value;timer&&(timer.textContent=formatTime(currentTime)),this._animationFrameId=requestAnimationFrame(this._startTimeline)},this._stopTimeline=()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},this._animationFrameId=null,this._startRecording=()=>{try{this._chunks=[],this._options={...this.cfg.mediaRecorderOptions};let{mimeType}=this.cfg.mediaRecorderOptions||{};mimeType&&MediaRecorder.isTypeSupported(mimeType)?this._options.mimeType=mimeType:MediaRecorder.isTypeSupported(DEFAULT_VIDEO_FORMAT)?this._options.mimeType=DEFAULT_VIDEO_FORMAT:this._options.mimeType="video/mp4",this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener("dataavailable",event=>{this._chunks.push(event.data)}),this._startTimer(),this.classList.add("uc-recording"),this._setCameraState(constants.q.PLAY))}catch(error){console.error("Failed to start recording",error),this.telemetryManager.sendEventError(error,"camera recording. Failed to start recording")}},this._stopRecording=()=>{this._mediaRecorder?.addEventListener("stop",()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(constants.q.STOP)}),this._mediaRecorder?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this._activeTab}}})},this._toggleRecording=()=>{if(this._mediaRecorder?.state==="recording")return;let videoEl=this._videoRef.value;videoEl&&(videoEl.paused||videoEl.ended||!(videoEl.readyState>2)?videoEl.paused&&videoEl.play():videoEl.pause())},this._toggleEnableAudio=()=>{this._stream?.getAudioTracks().forEach(track=>{track.enabled=!track.enabled,this._toggleMicrophoneIcon=track.enabled?"microphone":"microphone-mute",this._audioSelectDisabled=!track.enabled})},this._previewVideo=()=>{try{let blob=new Blob(this._chunks,{type:this._mediaRecorder?.mimeType}),videoURL=URL.createObjectURL(blob),videoElement=this._videoRef.value;if(!videoElement)return;videoElement.muted=!1,videoElement.volume=1,this._setVideoSource(null),videoElement.src=videoURL,this._attachPreviewListeners(videoElement)}catch(error){console.error("Failed to preview video",error),this.telemetryManager.sendEventError(error,"camera previewing. Failed to preview video")}},this._retake=()=>{if(this._setCameraState(constants.q.RETAKE),this._activeTab===constants.S.VIDEO){this._setVideoSource(this._stream);let videoElement=this._videoRef.value;videoElement&&(videoElement.muted=!0)}this._videoRef.value?.play?.()},this._accept=()=>{if(this._setCameraState(constants.q.ACCEPT),this._activeTab===constants.S.PHOTO)return void this._canvas?.toBlob(blob=>{if(!blob)return;let file=this._createFile("camera","jpeg",DEFAULT_PICTURE_FORMAT,blob);this._toSend(file)},DEFAULT_PICTURE_FORMAT);let blob=new Blob(this._chunks,{type:this._mediaRecorder?.mimeType}),ext=this._guessExtensionByMime(this._mediaRecorder?.mimeType),file=this._createFile("video",ext,`video/${ext}`,blob);this._toSend(file),this._chunks=[]},this._handlePhoto=status=>{status===constants.q.SHOT&&(this._tabVideoHidden=!0,this._cameraHidden=!0,this._tabCameraHidden=!0,this._cameraActionsHidden=!1,this._cameraSelectHidden=!0),(status===constants.q.RETAKE||status===constants.q.ACCEPT)&&(this._tabVideoHidden=!this._cameraModes.includes(constants.S.VIDEO),this._tabCameraHidden=!this._cameraModes.includes(constants.S.PHOTO),this._cameraHidden=!1,this._cameraActionsHidden=!0,this._cameraSelectHidden=this._cameraDevices.length<=1)},this._handleVideo=status=>{status===constants.q.PLAY&&(this._timerHidden=!1,this._tabCameraHidden=!0,this._cameraSelectHidden=!0,this._audioSelectHidden=!0,this._currentTimelineIcon="pause",this._currentIcon="square",this._mutableClassButton="uc-shot-btn uc-camera-action uc-stop-record"),status===constants.q.STOP&&(this._timerHidden=!1,this._cameraHidden=!0,this._audioToggleMicrophoneHidden=!0,this._cameraActionsHidden=!1),(status===constants.q.RETAKE||status===constants.q.ACCEPT)&&(this._timerHidden=!0,this._tabVideoHidden=!this._cameraModes.includes(constants.S.VIDEO),this._tabCameraHidden=!this._cameraModes.includes(constants.S.PHOTO),this._cameraHidden=!1,this._cameraActionsHidden=!0,this._audioToggleMicrophoneHidden=!this.cfg.enableAudioRecording,this._currentIcon="video-camera-full",this._mutableClassButton="uc-shot-btn uc-camera-action",this._audioSelectHidden=!this.cfg.enableAudioRecording||this._audioDevices.length<=1,this._cameraSelectHidden=this._cameraDevices.length<=1)},this._setCameraState=status=>{this._activeTab===constants.S.PHOTO&&("shot"===status||"retake"===status||"accept"===status)&&this._handlePhoto(status),this._activeTab===constants.S.VIDEO&&("play"===status||"stop"===status||"retake"===status||"accept"===status||"pause"===status||"resume"===status)&&this._handleVideo(status)},this._handleActiveTab=tabId=>{let switcher=this._switcherRef.value;switcher?.querySelectorAll("button").forEach(btn=>{btn.classList.toggle("uc-active",btn.getAttribute("data-id")===tabId)}),tabId===constants.S.PHOTO&&(this._currentIcon="camera-full",this._audioSelectHidden=!0,this._audioToggleMicrophoneHidden=!0),tabId===constants.S.VIDEO&&(this._currentTimelineIcon="play",this._currentIcon="video-camera-full",this._audioSelectHidden=!this.cfg.enableAudioRecording||this._audioDevices.length<=1,this._audioToggleMicrophoneHidden=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId}}}),this._activeTab=tabId},this._createFile=(type,ext,format,blob)=>{let date=Date.now();return new File([blob],`${type}-${date}.${ext}`,{lastModified:date,type:format})},this._toSend=file=>{this.api.addFileFromObject(file,{source:UploadSource.pc.CAMERA}),this.set$({"*currentActivity":LitActivityBlock.S.activities.UPLOAD_LIST}),this.modalManager?.open(LitActivityBlock.S.activities.UPLOAD_LIST)},this._setPermissionsState=(0,debounce.s)(state=>{this.classList.toggle("uc-initialized","granted"===state);let visibleAudio=this._activeTab===constants.S.VIDEO&&this.cfg.enableAudioRecording,currentIcon=this._activeTab===constants.S.PHOTO?"camera-full":"video-camera-full";"granted"===state?(this._videoHidden=!1,this._cameraHidden=!1,this._tabCameraHidden=!this._cameraModes.includes(constants.S.PHOTO),this._tabVideoHidden=!this._cameraModes.includes(constants.S.VIDEO),this._messageHidden=!0,this._timerHidden=!0,this._currentIcon=currentIcon,this._audioToggleMicrophoneHidden=!visibleAudio,this._audioSelectHidden=!visibleAudio):("prompt"===state?(this._l10nMessage="camera-permissions-prompt",this._videoHidden=!0,this._cameraHidden=!0,this._tabCameraHidden=!0,this._messageHidden=!1):(this._l10nMessage="camera-permissions-denied",this._videoHidden=!0,this._messageHidden=!1,this._tabCameraHidden=!this._cameraModes.includes(constants.S.PHOTO),this._tabVideoHidden=!this._cameraModes.includes(constants.S.VIDEO),this._cameraActionsHidden=!0,this._mutableClassButton="uc-shot-btn uc-camera-action"),this._stopCapture())},300),this._makeStreamInactive=()=>{if(!this._stream)return!1;let audioTracks=this._stream?.getAudioTracks(),videoTracks=this._stream?.getVideoTracks();return audioTracks.forEach(track=>{track.stop()}),videoTracks.forEach(track=>{track.stop()}),!0},this._stopCapture=()=>{if(this._capturing){this._videoRef.value&&(this._videoRef.value.volume=0);let tracks=this._currentVideoSource?.getTracks?.();tracks?.[0]?.stop(),this._detachPreviewListeners(this._videoRef.value),this._setVideoSource(null),this._makeStreamInactive(),this._stopTimer(),this._capturing=!1}},this._capture=async()=>{let constraints={video:{...DEFAULT_VIDEO_CONFIG},audio:!!this.cfg.enableAudioRecording&&{}};this._selectedCameraId&&(constraints.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(constraints.audio={deviceId:{exact:this._selectedAudioId}}),this._videoRef.value&&(this._videoRef.value.volume=0);try{this._setPermissionsState("prompt"),this._stream=await navigator.mediaDevices.getUserMedia(constraints),this._stream.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this._setVideoSource(this._stream),this._capturing=!0,this._setPermissionsState("granted")}catch(error){this._setPermissionsState("denied"),console.log("Failed to capture camera",error),this.telemetryManager.sendEventError(error,"camera capturing. Failed to capture camera")}},this._handlePermissionsChange=()=>{this._capture()},this._permissionAccess=async()=>{try{for(let permission of(this._teardownPermissionListeners(),DEFAULT_PERMISSIONS)){let response=await navigator.permissions.query({name:permission});this._permissionResponses[permission]=response,response.addEventListener("change",this._handlePermissionsChange),this._permissionCleanupFns.push(()=>{response.removeEventListener("change",this._handlePermissionsChange)})}this._unsubPermissions=()=>{this._teardownPermissionListeners()}}catch(error){this._teardownPermissionListeners(),console.log("Failed to use permissions API. Fallback to manual request mode.",error),this.telemetryManager.sendEventError(error,"camera permissions. Failed to use permissions API"),this._capture()}},this._requestDeviceAccess=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener("devicechange",this._getDevices)}catch(error){this.telemetryManager.sendEventError(error,"camera devices. Failed to get user media"),console.log("Failed to get user media",error)}},this._getDevices=async()=>{try{let devices=await navigator.mediaDevices.enumerateDevices();this._cameraDevices=devices.filter(device=>"videoinput"===device.kind).map((device,index)=>({text:device.label.trim()||`${this.l10n("caption-camera")} ${index+1}`,value:device.deviceId})),this._audioDevices=this.cfg.enableAudioRecording?devices.filter(device=>"audioinput"===device.kind).map(device=>({text:device.label.trim(),value:device.deviceId})):[],this._cameraSelectOptions=this._cameraDevices,this._cameraSelectHidden=this._cameraDevices.length<=1,this._selectedCameraId=this._cameraDevices[0]?.value??null,this._audioSelectOptions=this._audioDevices,this._audioSelectHidden=!this.cfg.enableAudioRecording||this._audioDevices.length<=1,this._selectedAudioId=this._audioDevices[0]?.value??null}catch(error){this.telemetryManager.sendEventError(error,"camera devices. Failed to get devices"),console.log("Failed to get devices",error)}},this._onActivate=async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture(),this._handleCameraModes(this._cameraModes)},this._onDeactivate=async()=>{this._unsubPermissions&&this._unsubPermissions(),window.chrome||this._setPermissionsState("denied"),this._stopCapture()},this._handleCameraModes=cameraModes=>{this._tabVideoHidden=!cameraModes.includes(constants.S.VIDEO),this._tabCameraHidden=!cameraModes.includes(constants.S.PHOTO);let defaultTab=cameraModes[0];!defaultTab||this._activeTab&&cameraModes.includes(this._activeTab)||this._handleActiveTab(defaultTab)}}}_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_videoTransformCss",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_videoHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_messageHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_requestBtnHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_cameraSelectOptions",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_cameraSelectHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_l10nMessage",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_timerHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_cameraHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_cameraActionsHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_audioSelectOptions",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_audioSelectHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_audioSelectDisabled",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_audioToggleMicrophoneHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_tabCameraHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_tabVideoHidden",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_currentIcon",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_currentTimelineIcon",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_toggleMicrophoneIcon",void 0),_ts_decorate([(0,decorators_js_.state)()],CameraSource.prototype,"_mutableClassButton",void 0)},5973(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{S:()=>CameraSourceTypes,q:()=>CameraSourceEvents});let CameraSourceTypes=Object.freeze({PHOTO:"photo",VIDEO:"video"}),CameraSourceEvents=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"})},8996(__unused_rspack_module,__webpack_exports__,__webpack_require__){function setSvgNodeAttrs(node,attrs){for(let[name,value]of Object.entries(attrs))node.setAttributeNS(null,name,value.toString())}function createSvgNode(name,attrs={}){let node=document.createElementNS("http://www.w3.org/2000/svg",name);return setSvgNodeAttrs(node,attrs),node}function cornerPath(rect,direction,sizeMultiplier){let{x,y,width,height}=rect,wMul=+!direction.includes("w"),hMul=+!direction.includes("n"),xSide=0===wMul?-1:1,ySide=0===hMul?-1:1,p1=[x+wMul*width+1.5*xSide,y+hMul*height+1.5*ySide-24*sizeMultiplier*ySide],p2=[x+wMul*width+1.5*xSide,y+hMul*height+1.5*ySide],p3=[x+wMul*width-24*sizeMultiplier*xSide+1.5*xSide,y+hMul*height+1.5*ySide];return{d:`M ${p1[0]} ${p1[1]} L ${p2[0]} ${p2[1]} L ${p3[0]} ${p3[1]}`,center:[p2[0],p2[1]]}}function sidePath(rect,direction,sizeMultiplier){let p1,p2,{x,y,width,height}=rect,isHorizontal="n"===direction||"s"===direction,wMul=isHorizontal?.5:+("w"!==direction),hMul="w"===direction||"e"===direction?.5:+("n"!==direction),xSide="w"===direction?-1:+("e"===direction),ySide="n"===direction?-1:+("s"===direction);return isHorizontal?(p1=[x+wMul*width-34*sizeMultiplier/2,y+hMul*height+1.5*ySide],p2=[x+wMul*width+34*sizeMultiplier/2,y+hMul*height+1.5*ySide]):(p1=[x+wMul*width+1.5*xSide,y+hMul*height-34*sizeMultiplier/2],p2=[x+wMul*width+1.5*xSide,y+hMul*height+34*sizeMultiplier/2]),{d:`M ${p1[0]} ${p1[1]} L ${p2[0]} ${p2[1]}`,center:[(p1[0]+p2[0])/2,(p1[1]+p2[1])/2]}}function thumbCursor(direction){return""===direction?"move":["e","w"].includes(direction)?"ew-resize":["n","s"].includes(direction)?"ns-resize":["nw","se"].includes(direction)?"nwse-resize":"nesw-resize"}function moveRect({rect,delta:[dx,dy],imageBox}){return constraintRect({...rect,x:rect.x+dx,y:rect.y+dy},imageBox)}function constraintRect(rect1,rect2){let{x}=rect1,{y}=rect1;return rect1.x<rect2.x?x=rect2.x:rect1.x+rect1.width>rect2.x+rect2.width&&(x=rect2.x+rect2.width-rect1.width),rect1.y<rect2.y?y=rect2.y:rect1.y+rect1.height>rect2.y+rect2.height&&(y=rect2.y+rect2.height-rect1.height),{...rect1,x,y}}function resizeRect({direction,...rest}){switch(direction){case"n":return function({rect,delta,aspectRatio,imageBox}){let[,dy]=delta,{y,width,height}=rect;y+=dy,height-=dy,aspectRatio&&(width=height*aspectRatio);let x=rect.x+rect.width/2-width/2;return y<=imageBox.y&&(y=imageBox.y,height=rect.y+rect.height-y,aspectRatio&&(width=height*aspectRatio,x=rect.x+rect.width/2-width/2)),x<=imageBox.x&&(x=imageBox.x,y=rect.y+rect.height-height),x+width>=imageBox.x+imageBox.width&&(x=Math.max(imageBox.x,imageBox.x+imageBox.width-width),width=imageBox.x+imageBox.width-x,aspectRatio&&(height=width/aspectRatio),y=rect.y+rect.height-height),height<1&&(height=1,aspectRatio&&(width=height*aspectRatio,x=rect.x+rect.width/2-width/2),y=rect.y+rect.height-height),width<1&&(width=1,aspectRatio&&(height=width/aspectRatio,x=rect.x+rect.width/2-width/2),y=rect.y+rect.height-height),{x,y,width,height}}(rest);case"w":return function({rect,delta,aspectRatio,imageBox}){let[dx]=delta,{x,width,height}=rect;x+=dx,width-=dx,aspectRatio&&(height=width/aspectRatio);let y=rect.y+rect.height/2-height/2;return x<=imageBox.x&&(x=imageBox.x,width=rect.x+rect.width-x,aspectRatio&&(height=width/aspectRatio,y=rect.y+rect.height/2-height/2)),y<=imageBox.y&&(y=imageBox.y,x=rect.x+rect.width-width),y+height>=imageBox.y+imageBox.height&&(y=Math.max(imageBox.y,imageBox.y+imageBox.height-height),height=imageBox.y+imageBox.height-y,aspectRatio&&(width=height*aspectRatio),x=rect.x+rect.width-width),height<1&&(height=1,aspectRatio&&(width=height*aspectRatio),y=rect.y+rect.height/2-height/2,x=rect.x+rect.width-width),width<1&&(width=1,aspectRatio&&(height=width/aspectRatio),y=rect.y+rect.height/2-height/2,x=rect.x+rect.width-width),{x,y,width,height}}(rest);case"s":return function({rect,delta,aspectRatio,imageBox}){let[,dy]=delta,{y,width,height}=rect;height+=dy,aspectRatio&&(width=height*aspectRatio);let x=rect.x+rect.width/2-width/2;return y+height>=imageBox.y+imageBox.height&&(height=imageBox.y+imageBox.height-y,aspectRatio&&(width=height*aspectRatio),x=rect.x+rect.width/2-width/2),x<=imageBox.x&&(x=imageBox.x,y=rect.y),x+width>=imageBox.x+imageBox.width&&(x=Math.max(imageBox.x,imageBox.x+imageBox.width-width),width=imageBox.x+imageBox.width-x,aspectRatio&&(height=width/aspectRatio),y=rect.y),height<1&&(height=1,aspectRatio&&(width=height*aspectRatio),x=rect.x+rect.width/2-width/2),width<1&&(width=1,aspectRatio&&(height=width/aspectRatio),x=rect.x+rect.width/2-width/2),{x,y,width,height}}(rest);case"e":return function({rect,delta,aspectRatio,imageBox}){let[dx]=delta,{x,width,height}=rect;width+=dx,aspectRatio&&(height=width/aspectRatio);let y=rect.y+rect.height/2-height/2;return x+width>=imageBox.x+imageBox.width&&(width=imageBox.x+imageBox.width-x,aspectRatio&&(height=width/aspectRatio),y=rect.y+rect.height/2-height/2),y<=imageBox.y&&(y=imageBox.y,x=rect.x),y+height>=imageBox.y+imageBox.height&&(y=Math.max(imageBox.y,imageBox.y+imageBox.height-height),height=imageBox.y+imageBox.height-y,aspectRatio&&(width=height*aspectRatio),x=rect.x),height<1&&(height=1,aspectRatio&&(width=height*aspectRatio),y=rect.y+rect.height/2-height/2),width<1&&(width=1,aspectRatio&&(height=width/aspectRatio),y=rect.y+rect.height/2-height/2),{x,y,width,height}}(rest);case"nw":return function({rect,delta,aspectRatio,imageBox}){let[dx,dy]=delta,{x,y,width,height}=rect;return x+dx<imageBox.x&&(dx=imageBox.x-x),y+dy<imageBox.y&&(dy=imageBox.y-y),x+=dx,width-=dx,y+=dy,height-=dy,aspectRatio&&Math.abs(width/height)>aspectRatio?(dy=width/aspectRatio-height,height+=dy,(y-=dy)<=imageBox.y&&(height-=imageBox.y-y,width=height*aspectRatio,x=rect.x+rect.width-width,y=imageBox.y)):aspectRatio&&(dx=height*aspectRatio-width,width+=dx,(x-=dx)<=imageBox.x&&(width-=imageBox.x-x,height=width/aspectRatio,x=imageBox.x,y=rect.y+rect.height-height)),height<1&&(height=1,aspectRatio&&(width=height*aspectRatio),x=rect.x+rect.width-width,y=rect.y+rect.height-height),width<1&&(width=1,aspectRatio&&(height=width/aspectRatio),x=rect.x+rect.width-width,y=rect.y+rect.height-height),{x,y,width,height}}(rest);case"ne":return function({rect,delta,aspectRatio,imageBox}){let[dx,dy]=delta,{x,y,width,height}=rect;return x+width+dx>imageBox.x+imageBox.width&&(dx=imageBox.x+imageBox.width-x-width),y+dy<imageBox.y&&(dy=imageBox.y-y),width+=dx,y+=dy,height-=dy,aspectRatio&&Math.abs(width/height)>aspectRatio?(dy=width/aspectRatio-height,height+=dy,(y-=dy)<=imageBox.y&&(height-=imageBox.y-y,width=height*aspectRatio,x=rect.x,y=imageBox.y)):aspectRatio&&(dx=height*aspectRatio-width,x+(width+=dx)>=imageBox.x+imageBox.width&&(height=(width=imageBox.x+imageBox.width-x)/aspectRatio,x=imageBox.x+imageBox.width-width,y=rect.y+rect.height-height)),height<1&&(height=1,aspectRatio&&(width=height*aspectRatio),y=rect.y+rect.height-height),width<1&&(width=1,aspectRatio&&(height=width/aspectRatio),y=rect.y+rect.height-height),{x,y,width,height}}(rest);case"sw":return function({rect,delta,aspectRatio,imageBox}){let[dx,dy]=delta,{x,y,width,height}=rect;return x+dx<imageBox.x&&(dx=imageBox.x-x),y+height+dy>imageBox.y+imageBox.height&&(dy=imageBox.y+imageBox.height-y-height),x+=dx,width-=dx,height+=dy,aspectRatio&&Math.abs(width/height)>aspectRatio?(dy=width/aspectRatio-height,y+(height+=dy)>=imageBox.y+imageBox.height&&(width=(height=imageBox.y+imageBox.height-y)*aspectRatio,x=rect.x+rect.width-width,y=imageBox.y+imageBox.height-height)):aspectRatio&&(dx=height*aspectRatio-width,width+=dx,(x-=dx)<=imageBox.x&&(width-=imageBox.x-x,height=width/aspectRatio,x=imageBox.x,y=rect.y)),height<1&&(height=1,aspectRatio&&(width=height*aspectRatio),x=rect.x+rect.width-width),width<1&&(width=1,aspectRatio&&(height=width/aspectRatio),x=rect.x+rect.width-width),{x,y,width,height}}(rest);case"se":return function({rect,delta,aspectRatio,imageBox}){let[dx,dy]=delta,{x,y,width,height}=rect;return x+width+dx>imageBox.x+imageBox.width&&(dx=imageBox.x+imageBox.width-x-width),y+height+dy>imageBox.y+imageBox.height&&(dy=imageBox.y+imageBox.height-y-height),width+=dx,height+=dy,aspectRatio&&Math.abs(width/height)>aspectRatio?(dy=width/aspectRatio-height,y+(height+=dy)>=imageBox.y+imageBox.height&&(width=(height=imageBox.y+imageBox.height-y)*aspectRatio,x=rect.x,y=imageBox.y+imageBox.height-height)):aspectRatio&&(dx=height*aspectRatio-width,x+(width+=dx)>=imageBox.x+imageBox.width&&(height=(width=imageBox.x+imageBox.width-x)/aspectRatio,x=imageBox.x+imageBox.width-width,y=rect.y)),height<1&&(height=1,aspectRatio&&(width=height*aspectRatio)),width<1&&(width=1,aspectRatio&&(height=width/aspectRatio)),{x,y,width,height}}(rest);default:return rest.rect}}function rectContainsPoint(rect,[x,y]){return rect.x<=x&&x<=rect.x+rect.width&&rect.y<=y&&y<=rect.y+rect.height}function isRectInsideRect(rect1,rect2){return rect1.x>=rect2.x&&rect1.y>=rect2.y&&rect1.x+rect1.width<=rect2.x+rect2.width&&rect1.y+rect1.height<=rect2.y+rect2.height}function isRectMatchesAspectRatio(rect,aspectRatio){return .1>Math.abs(rect.width/rect.height-aspectRatio)}function rotateSize({width,height},angle){let swap=angle/90%2!=0;return{width:swap?height:width,height:swap?width:height}}function calculateMaxCenteredCropFrame(width,height,aspectRatio){let cropWidth,cropHeight;width/height>aspectRatio?(cropWidth=Math.round(height*aspectRatio),cropHeight=height):(cropWidth=width,cropHeight=Math.round(width/aspectRatio));let cropX=Math.round((width-cropWidth)/2),cropY=Math.round((height-cropHeight)/2);return cropX+cropWidth>width&&(cropWidth=width-cropX),cropY+cropHeight>height&&(cropHeight=height-cropY),{x:cropX,y:cropY,width:cropWidth,height:cropHeight}}function roundRect(rect){return{x:Math.round(rect.x),y:Math.round(rect.y),width:Math.round(rect.width),height:Math.round(rect.height)}}function clamp(value,min,max){return Math.min(Math.max(value,min),max)}__webpack_require__.d(__webpack_exports__,{BT:()=>rotateSize,F2:()=>setSvgNodeAttrs,VH:()=>cornerPath,YH:()=>constraintRect,Ze:()=>isRectInsideRect,_J:()=>moveRect,_c:()=>rectContainsPoint,dz:()=>resizeRect,fN:()=>sidePath,l8:()=>createSvgNode,n:()=>isRectMatchesAspectRatio,qE:()=>clamp,rH:()=>roundRect,u3:()=>calculateMaxCenteredCropFrame,vv:()=>thumbCursor})},5342(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>parseCropPreset,t:()=>getClosestAspectRatio});var _utils_stringToArray__rspack_import_0=__webpack_require__(2513),_utils_UID__rspack_import_1=__webpack_require__(5446);let EXCLUDED_TYPES=["free"],parseCropPreset=cropPreset=>{let items=(0,_utils_stringToArray__rspack_import_0.G)(cropPreset);if(!items||0===items.length)return[];let result=[];for(let item of items){let raw=item.trim();if(!raw)continue;let sep=raw.indexOf(":");if(-1===sep&&!EXCLUDED_TYPES.includes(raw)){console.warn(`Invalid crop preset: ${raw}`);continue}let w=Number(raw.slice(0,sep)),h=Number(raw.slice(sep+1));if((!Number.isFinite(w)||!Number.isFinite(h)||w<=0||h<=0)&&!EXCLUDED_TYPES.includes(raw)){console.warn(`Invalid crop preset: ${raw}`);continue}result.push({id:_utils_UID__rspack_import_1.V.generateFastUid(),type:"aspect-ratio",width:EXCLUDED_TYPES.includes(raw)?0:w,height:EXCLUDED_TYPES.includes(raw)?0:h,hasFreeform:EXCLUDED_TYPES.includes(raw)})}return result},getClosestAspectRatio=(width,height,ratios,tolerance=.1)=>{let inputRatio=width/height,closest=null,minDiff=1/0;for(let r of ratios){let[w,h]=[r.width,r.height],diff=Math.abs(inputRatio-w/h);diff<minDiff&&(minDiff=diff,closest=r)}if(closest){let[cw,ch]=[closest.width,closest.height],closestRatio=cw/ch;if(Math.abs(inputRatio-closestRatio)/closestRatio>tolerance)return null}return closest}},8930(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{ON:()=>transformationsToOperations,jO:()=>COMMON_OPERATIONS,yj:()=>OPERATIONS_DEFAULTS,ym:()=>operationsToTransformations});var _utils_cdn_utils_js__rspack_import_0=__webpack_require__(6339),_utils_stringToArray_js__rspack_import_1=__webpack_require__(2513);let OPERATIONS_DEFAULTS=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),SUPPORTED_OPERATIONS_ORDERED=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function transformationsToOperations(transformations){return(0,_utils_cdn_utils_js__rspack_import_0.OB)(...SUPPORTED_OPERATIONS_ORDERED.filter(operation=>void 0!==transformations[operation]&&null!==transformations[operation]).map(operation=>{let options=transformations[operation];return function(operation,options){if("number"==typeof options)return OPERATIONS_DEFAULTS[operation]!==options?`${operation}/${options}`:"";if("boolean"==typeof options)return OPERATIONS_DEFAULTS[operation]!==options?`${operation}`:"";if("filter"===operation&&options){let{name,amount}=options;return OPERATIONS_DEFAULTS.filter===amount?"":`${operation}/${name}/${amount}`}if("crop"===operation&&options){let{dimensions,coords}=options;return`${operation}/${dimensions.join("x")}/${coords.join(",")}`}return""}(operation,options)}).filter(str=>!!str))}let COMMON_OPERATIONS=(0,_utils_cdn_utils_js__rspack_import_0.OB)("format/auto","progressive/yes"),asNumber=([value])=>void 0!==value?Number(value):void 0,asBoolean=()=>!0,OPERATION_PROCESSORS=Object.freeze({enhance:asNumber,brightness:asNumber,exposure:asNumber,gamma:asNumber,contrast:asNumber,saturation:asNumber,vibrance:asNumber,warmth:asNumber,filter:([name,amount])=>({name,amount:void 0!==amount?Number(amount):100}),mirror:asBoolean,flip:asBoolean,rotate:asNumber,crop:args=>{let[dimensions,alignment]=args,{dimensions:parsedDimensions,coords}=(([dimensions,alignment])=>{if(!/\d+x\d+/.test(dimensions)||!/\d+,\d+/.test(alignment))throw Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:(0,_utils_stringToArray_js__rspack_import_1.G)(dimensions,"x").map(Number),coords:(0,_utils_stringToArray_js__rspack_import_1.G)(alignment).map(Number)}})([dimensions,alignment]);return{dimensions:parsedDimensions,coords:coords}}});function operationsToTransformations(operations){let transformations={};for(let operation of operations){let[name,...args]=operation.split("/");if(!name||!SUPPORTED_OPERATIONS_ORDERED.includes(name))continue;let processor=OPERATION_PROCESSORS[name];try{let value=processor(args);transformations[name]=value}catch(err){console.warn([`Failed to parse URL operation "${operation}". It will be ignored.`,err instanceof Error?`Error message: "${err.message}"`:err,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join("\n"))}}return transformations}},1583(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{DY:()=>ALL_COLOR_OPERATIONS,UA:()=>COLOR_OPERATIONS_CONFIG,XB:()=>TabId,Y_:()=>ALL_CROP_OPERATIONS,_6:()=>ALL_FILTERS,nz:()=>ALL_TABS});var _lib_transformationUtils_js__rspack_import_0=__webpack_require__(8930);let TabId=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),ALL_TABS=Object.freeze([TabId.CROP,TabId.TUNING,TabId.FILTERS]),ALL_COLOR_OPERATIONS=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),ALL_FILTERS=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),ALL_CROP_OPERATIONS=Object.freeze(["rotate","mirror","flip"]),NUMERIC_OPERATION_DEFAULTS=_lib_transformationUtils_js__rspack_import_0.yj,COLOR_OPERATIONS_CONFIG=Object.freeze({brightness:{zero:NUMERIC_OPERATION_DEFAULTS.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:NUMERIC_OPERATION_DEFAULTS.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:NUMERIC_OPERATION_DEFAULTS.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:NUMERIC_OPERATION_DEFAULTS.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:NUMERIC_OPERATION_DEFAULTS.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:NUMERIC_OPERATION_DEFAULTS.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:NUMERIC_OPERATION_DEFAULTS.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:NUMERIC_OPERATION_DEFAULTS.enhance,range:[0,100],keypointsNumber:1},filter:{zero:NUMERIC_OPERATION_DEFAULTS.filter,range:[0,100],keypointsNumber:1}})},8183(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{T:()=>Config});var sharedConfigKey=__webpack_require__(1971),toKebabCase=__webpack_require__(2402),debounce=__webpack_require__(4441),warnOnce=__webpack_require__(6783);let ASSERTIONS=[{test:cfg=>!!cfg.accept&&!!cfg.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:cfg=>null!==cfg.enableVideoRecording,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:cfg=>null!==cfg.defaultCameraMode,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],runAssertions=(0,debounce.s)(cfg=>{for(let{test,message}of ASSERTIONS)test(cfg)&&(0,warnOnce.m)(message)},0);var LitBlock=__webpack_require__(204),comma_separated=__webpack_require__(9101);let isPromiseLike=value=>value instanceof Promise||!!(value&&"object"==typeof value&&"then"in value&&"function"==typeof value.then);var UploadSource=__webpack_require__(5730),initialConfig=__webpack_require__(318);let withLazyPlugins=async({plugins,entries,signal})=>{let current=plugins(),lazyIds=new Set(entries.map(e=>e.pluginId)),userPlugins=current.filter(p=>!lazyIds.has(p?.id)),loadResults=await Promise.all(entries.map(async entry=>{if(!entry.isEnabled())return null;let existing=current.find(p=>p?.id===entry.pluginId);if(existing)return existing;try{let plugin=await entry.load();if(signal.aborted||!entry.isEnabled())return null;return plugin??null}catch(error){return signal.aborted||console.warn(`[${entry.pluginId}] Failed to load plugin`,error),null}}));if(signal.aborted)return current;let next=[...userPlugins,...loadResults.filter(p=>null!==p)];return next.length===current.length&&next.every((p,i)=>p===current[i])?current:next},COMPUTED_PROPERTIES=[{key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes,enableVideoRecording})=>{let evr=enableVideoRecording();if(null===evr)return cameraModes();let cameraModesCsv=(0,comma_separated.A)(cameraModes());return evr&&!cameraModesCsv.includes("video")?cameraModesCsv=cameraModesCsv.concat("video"):evr||(cameraModesCsv=cameraModesCsv.filter(mode=>"video"!==mode)),(0,comma_separated.L)(cameraModesCsv)}},{key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes,defaultCameraMode})=>{let dcm=defaultCameraMode();if(null===dcm)return cameraModes();let cameraModesCsv=(0,comma_separated.A)(cameraModes());return cameraModesCsv=cameraModesCsv.sort((a,b)=>a===dcm?-1:+(b===dcm)),(0,comma_separated.L)(cameraModesCsv)}},{key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey,cdnCname,cdnCnamePrefixed})=>{let pk=pubkey(),cname=cdnCname(),prefixed=cdnCnamePrefixed();return pk&&(cname===initialConfig.Tw||(0,__rspack_external__uploadcare_cname_prefix_async_eddbdf1f.isPrefixedCdnBase)(cname,prefixed))?(0,__rspack_external__uploadcare_cname_prefix_async_eddbdf1f.getPrefixedCdnBaseAsync)(pk,prefixed):cname}},{key:"plugins",deps:["useCloudImageEditor","imageShrink","sourceList"],fn:({plugins,useCloudImageEditor,imageShrink,sourceList},{signal})=>withLazyPlugins({plugins,entries:[{pluginId:"cloud-image-editor",isEnabled:()=>!!useCloudImageEditor(),load:async()=>{let{cloudImageEditorPlugin}=await __webpack_require__.e("cloudImageEditorPlugin").then(__webpack_require__.bind(__webpack_require__,6027));return cloudImageEditorPlugin}},{pluginId:"image-shrink",isEnabled:()=>!!imageShrink(),load:async()=>{let{imageShrinkPlugin}=await __webpack_require__.e("imageShrinkPlugin").then(__webpack_require__.bind(__webpack_require__,6677));return imageShrinkPlugin}},{pluginId:"camera",isEnabled:()=>(0,comma_separated.A)(sourceList()).includes("camera"),load:async()=>{let{cameraPlugin}=await __webpack_require__.e("cameraPlugin").then(__webpack_require__.bind(__webpack_require__,7777));return cameraPlugin}},{pluginId:"instagram",isEnabled:()=>(0,comma_separated.A)(sourceList()).includes("instagram"),load:async()=>{let{instagramPlugin}=await __webpack_require__.e("instagramPlugin").then(__webpack_require__.bind(__webpack_require__,1746));return instagramPlugin}},{pluginId:"external-sources",isEnabled:()=>Object.values(UploadSource.y5).some(src=>(0,comma_separated.A)(sourceList()).includes(src)),load:async()=>{let{externalSourcesPlugin}=await __webpack_require__.e("externalSourcesPlugin").then(__webpack_require__.bind(__webpack_require__,2061));return externalSourcesPlugin}},{pluginId:"url-source",isEnabled:()=>(0,comma_separated.A)(sourceList()).includes("url"),load:async()=>{let{urlSourcePlugin}=await __webpack_require__.e("urlSourcePlugin").then(__webpack_require__.bind(__webpack_require__,1938));return urlSourcePlugin}}],signal})}],computeProperty=({key,setValue,getValue,computationControllers})=>{for(let computed of COMPUTED_PROPERTIES)if(computed.deps.includes(key)){let result,args={[computed.key]:()=>getValue(computed.key)};for(let dep of computed.deps)args[dep]=()=>getValue(dep);let abortController=new AbortController;computationControllers.get(computed.fn)?.abort(),computationControllers.set(computed.fn,abortController);try{result=computed.fn(args,{signal:abortController.signal})}catch(error){computationControllers.get(computed.fn)===abortController&&computationControllers.delete(computed.fn),console.error(`Failed to compute value for "${computed.key}"`,error);return}isPromiseLike(result)?result.then(resolvedValue=>{abortController.signal.aborted||setValue(computed.key,resolvedValue)}).catch(error=>{abortController.signal.aborted||console.error(`Failed to compute value for "${computed.key}"`,error)}).finally(()=>{computationControllers.get(computed.fn)===abortController&&computationControllers.delete(computed.fn)}):setValue(computed.key,result)}};var constants=__webpack_require__(5973);let asString=value=>String(value),asNumber=value=>{let number=Number(value);if(Number.isNaN(number))throw Error(`Invalid number: "${value}"`);return number},asBoolean=value=>{if(null==value)return!1;if("boolean"==typeof value)return value;if("true"===value||""===value)return!0;if("false"===value)return!1;throw Error(`Invalid boolean: "${value}"`)},asObject=value=>{if("object"==typeof value)return value;throw Error("Invalid value. Must be an object.")},asFunction=value=>{if("function"==typeof value)return value;throw Error("Invalid value. Must be a function.")},asArray=value=>{if(Array.isArray(value))return value;throw Error("Must be an array.")},mapping={pubkey:asString,multiple:asBoolean,multipleMin:asNumber,multipleMax:asNumber,confirmUpload:asBoolean,imgOnly:asBoolean,accept:asString,externalSourcesPreferredTypes:asString,externalSourcesEmbedCss:asString,store:value=>"auto"===value?value:asBoolean(value),cameraMirror:asBoolean,cameraCapture:value=>{let strValue=asString(value);if("user"!==strValue&&"environment"!==strValue&&""!==strValue)throw Error(`Invalid value: "${strValue}"`);return strValue},sourceList:asString,topLevelOrigin:asString,maxLocalFileSizeBytes:asNumber,thumbSize:asNumber,showEmptyList:asBoolean,useLocalImageEditor:asBoolean,useCloudImageEditor:asBoolean,cloudImageEditorTabs:asString,removeCopyright:asBoolean,cropPreset:asString,imageShrink:asString,modalScrollLock:asBoolean,modalBackdropStrokes:asBoolean,sourceListWrap:asBoolean,remoteTabSessionKey:asString,cdnCname:asString,cdnCnamePrefixed:asString,baseUrl:asString,socialBaseUrl:asString,secureSignature:asString,secureExpire:asString,secureDeliveryProxy:asString,retryThrottledRequestMaxTimes:asNumber,retryNetworkErrorMaxTimes:asNumber,multipartMinFileSize:asNumber,multipartChunkSize:asNumber,maxConcurrentRequests:asNumber,multipartMaxConcurrentRequests:asNumber,multipartMaxAttempts:asNumber,checkForUrlDuplicates:asBoolean,saveUrlForRecurrentUploads:asBoolean,groupOutput:asBoolean,userAgentIntegration:asString,debug:asBoolean,localeName:asString,metadata:value=>{if("object"==typeof value&&!Array.isArray(value)||"function"==typeof value)return value;throw Error("Invalid metadata value. Must be an object or function.")},secureUploadsExpireThreshold:asNumber,localeDefinitionOverride:value=>asObject(value),secureUploadsSignatureResolver:value=>asFunction(value),secureDeliveryProxyUrlResolver:value=>asFunction(value),iconHrefResolver:value=>asFunction(value),plugins:value=>asArray(value),fileValidators:asArray,collectionValidators:asArray,validationTimeout:asNumber,validationConcurrency:asNumber,cameraModes:value=>{let str=asString(value),array=(0,comma_separated.A)(str);if(array.some(item=>!Object.values(constants.S).includes(item)))throw Error(`Invalid value: "${JSON.stringify(array)}"`);return str},defaultCameraMode:value=>{let strValue=asString(value);if(!Object.values(constants.S).includes(strValue))throw Error(`Invalid value: "${strValue}"`);return strValue},enableAudioRecording:asBoolean,enableVideoRecording:asBoolean,mediaRecorderOptions:asObject,maxVideoRecordingDuration:asNumber,filesViewMode:value=>{let strValue=asString(value);if(["grid","list"].includes(strValue))return strValue;throw Error(`Invalid value: "${strValue}"`)},gridShowFileNames:asBoolean,cloudImageEditorAutoOpen:asBoolean,cloudImageEditorMaskHref:asString,testMode:asBoolean,qualityInsights:asBoolean,pasteScope:value=>{let strValue=asString(value);if("local"===strValue||"global"===strValue)return strValue;if(!1===asBoolean(value))return!1;throw Error(`Invalid value: "${strValue}"`)}},allConfigKeys=[...new Set(["debug",...Object.keys(initialConfig.Dz)])],complexConfigKeys=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],plainConfigKeys=allConfigKeys.filter(key=>!complexConfigKeys.includes(key)),builtinAttrKeyMapping={...Object.fromEntries(plainConfigKeys.map(key=>[(0,toKebabCase.f)(key),key])),...Object.fromEntries(plainConfigKeys.map(key=>[key.toLowerCase(),key]))},getLocalPropName=key=>`__${key}`;class Config extends LitBlock.x{_isCustomConfig(key){return this._customConfigKeys.has(key)}_getCustomConfigDefinition(key){let pluginManager=this._sharedInstancesBag.pluginManager;if(pluginManager)return pluginManager.configRegistry.get(key)}_getAttributeNames(key){return[...new Set([(0,toKebabCase.f)(key),key.toLowerCase()])]}_flushValueToAttribute(key,value){if(!complexConfigKeys.includes(key)){if(this._isCustomConfig(key)){let config=this._getCustomConfigDefinition(key);if(config?.attribute===!1)return}for(let attr of this._getAttributeNames(key))null==value?this.removeAttribute(attr):this.getAttribute(attr)!==value.toString()&&this.setAttribute(attr,value.toString())}}_flushValueToState(key,value){let stateKey=(0,sharedConfigKey.T)(key);if(this.$[stateKey]!==value)if(null==value){let defaultValue=initialConfig.Dz[key];this.$[stateKey]=void 0!==defaultValue?defaultValue:value}else this.$[stateKey]=value}_setValue(key,value){let normalizedValue;if(this._isCustomConfig(key)){let config=this._getCustomConfigDefinition(key);normalizedValue=config?.normalize?.(value)??value}else normalizedValue=((key,value)=>{if(null!=value)try{return mapping[key](value)}catch(reason){return console.error(`Invalid value for config key "${key}".`,reason),initialConfig.Dz[key]}})(key,value);let localPropName=getLocalPropName(key);this[localPropName]!==normalizedValue&&(this._assertSameValueDifferentReference(key,this[localPropName],normalizedValue),this[localPropName]=normalizedValue,this._flushValueToAttribute(key,normalizedValue),this._flushValueToState(key,normalizedValue),this.debugPrint(`"${key}"`,normalizedValue),this._isCustomConfig(key)||runAssertions(this.cfg))}_getValue(key){return this[getLocalPropName(key)]??this.$[(0,sharedConfigKey.T)(key)]}_assertSameValueDifferentReference(key,previousValue,nextValue){this.cfg.debug&&nextValue!==previousValue&&"object"==typeof nextValue&&"object"==typeof previousValue&&JSON.stringify(nextValue)===JSON.stringify(previousValue)&&(console.warn(`[uc-config] Option "${key}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${key}" previous value:`,previousValue),console.warn(`[uc-config] "${key}" new value:`,nextValue))}_processCustomConfigs(pluginManager){let customConfigs=pluginManager.configRegistry.getAll();for(let[name,unsub]of(this._customAttrKeyMapping={},this._customConfigKeys=new Set(customConfigs.keys()),this._customConfigSubscriptions))customConfigs.has(name)||(unsub(),this._customConfigSubscriptions.delete(name));for(let[name,definition]of customConfigs){let stateKey=(0,sharedConfigKey.T)(name);if(definition.attribute)for(let attrName of this._getAttributeNames(name))this._customAttrKeyMapping[attrName]=name;this.sharedCtx.has(stateKey)||this.sharedCtx.add(stateKey,definition.defaultValue);let descriptor=Object.getOwnPropertyDescriptor(this,name);if(descriptor&&descriptor.set&&descriptor.get||Object.defineProperty(this,name,{set:value=>{this._setValue(name,value)},get:()=>this._getValue(name),enumerable:!0,configurable:!0}),!this._customConfigSubscriptions.has(name)){let unsub=this.sub(stateKey,value=>{this._setValue(name,value)},!1);this._customConfigSubscriptions.set(name,unsub)}}}_setupCustomConfigs(){this._sharedInstancesBag.when("pluginManager",pluginManager=>{this._processCustomConfigs(pluginManager),this._pluginChangeUnsubscribe=pluginManager.onPluginsChange(()=>{this._processCustomConfigs(pluginManager)})})}_setupMutationObserver(){this._mutationObserver=new MutationObserver(mutations=>{for(let mutation of mutations)if("attributes"===mutation.type&&mutation.attributeName){let attrName=mutation.attributeName,oldValue=mutation.oldValue,newValue=this.getAttribute(attrName);if(oldValue===newValue||attrName in builtinAttrKeyMapping)continue;attrName in this._customAttrKeyMapping&&this.attributeChangedCallback(attrName,oldValue??"",newValue??"")}}),this._mutationObserver.observe(this,{attributes:!0,attributeOldValue:!0})}initCallback(){for(let key of(super.initCallback(),this._setupCustomConfigs(),this._setupMutationObserver(),plainConfigKeys))this.sub((0,sharedConfigKey.T)(key),value=>{this._setValue(key,value)},!1);for(let key of allConfigKeys){let initialValue=this[key]??this.$[(0,sharedConfigKey.T)(key)];initialValue!==initialConfig.Dz[key]&&this._setValue(key,initialValue);let descriptor=Object.getOwnPropertyDescriptor(this,key);descriptor&&descriptor.set&&descriptor.get||Object.defineProperty(this,key,{set:value=>{this._setValue(key,value)},get:()=>this._getValue(key)})}for(let key of allConfigKeys)this.sub((0,sharedConfigKey.T)(key),()=>{computeProperty({key,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this),computationControllers:this._computationControllers})})}attributeChangedCallback(name,oldVal,newVal){if(super.attributeChangedCallback(name,oldVal,newVal),oldVal===newVal)return;let builtInKey=builtinAttrKeyMapping[name];builtInKey?this[builtInKey]=newVal:this._sharedInstancesBag.when("pluginManager",pluginManager=>{if(this.getAttribute(name)!==newVal)return;let key=this._customAttrKeyMapping[name],config=key?pluginManager.configRegistry.get(key):void 0;if(key&&config){let val=config.fromAttribute?config.fromAttribute(newVal):newVal;if(this._getValue(key)===val)return;this._setValue(key,val)}})}disconnectedCallback(){for(let unsub of(super.disconnectedCallback(),this._pluginChangeUnsubscribe&&(this._pluginChangeUnsubscribe(),this._pluginChangeUnsubscribe=void 0),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=void 0),this._customConfigSubscriptions.values()))unsub();this._customConfigSubscriptions.clear()}static get observedAttributes(){return[...super.observedAttributes,...Object.keys(builtinAttrKeyMapping)]}constructor(...args){super(...args),this.init$={...this.init$,...Object.fromEntries(Object.entries(initialConfig.Dz).map(([key,value])=>[(0,sharedConfigKey.T)(key),value]))},this._computationControllers=new Map,this._customAttrKeyMapping={},this._customConfigKeys=new Set,this._customConfigSubscriptions=new Map}}for(let key of allConfigKeys)Config.prototype[key]=void 0},318(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Dz:()=>initialConfig,Tw:()=>DEFAULT_CDN_CNAME});var _utils_comma_separated__rspack_import_0=__webpack_require__(9101),_CloudImageEditor_src_toolbar_constants__rspack_import_1=__webpack_require__(1583);let DEFAULT_CDN_CNAME="https://ucarecdn.com",initialConfig=Object.freeze({pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:DEFAULT_CDN_CNAME,cdnCnamePrefixed:"https://ucarecd.net",baseUrl:"https://upload.uploadcare.com",socialBaseUrl:"https://social.uploadcare.com",secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:0x1900000,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:6e5,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:!0,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:!1,useCloudImageEditor:!0,cloudImageEditorAutoOpen:!1,cloudImageEditorTabs:(0,_utils_comma_separated__rspack_import_0.L)(_CloudImageEditor_src_toolbar_constants__rspack_import_1.nz),cloudImageEditorMaskHref:null,testMode:!1,qualityInsights:!0,pasteScope:"local",plugins:[]})},7860(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{B:()=>ExternalSource});var LitActivityBlock=__webpack_require__(5923),stringToArray=__webpack_require__(2513),UploadSource=__webpack_require__(5730);let escapeRegExp=str=>str.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),wildcardRegexp=(str,flags="i")=>{let parts=str.split("*").map(escapeRegExp);return RegExp(`^${parts.join(".+")}$`,flags)},ucCustomProperties=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],getCssValue=(element,propName)=>window.getComputedStyle(element).getPropertyValue(propName).trim();var external_lit_=__webpack_require__(2927),decorators_js_=__webpack_require__(8899),ref_js_=__webpack_require__(5337),LitUploaderBlock=__webpack_require__(5544);let MESSAGE_TYPE_WHITELIST=["selected-files-change","toolbar-state-change"];class MessageBridge{constructor(context,getTargetOrigin){this._handlerMap=new Map,this._handleMessage=e=>{if(e.source!==this._context)return;let message=e.data;if(!(message=>{if(!message||"object"!=typeof message||!("type"in message))return!1;let type=message.type;return"string"==typeof type&&!!MESSAGE_TYPE_WHITELIST.includes(type)})(message))return;let handlers=this._handlerMap.get(message.type);if(handlers)for(let handler of handlers)handler(message)},this._context=context,this._getTargetOrigin=getTargetOrigin,window.addEventListener("message",this._handleMessage)}on(type,handler){let handlers=this._handlerMap.get(type)??new Set;this._handlerMap.has(type)||this._handlerMap.set(type,handlers),handlers.add(handler)}send(message){let targetOrigin=this._getTargetOrigin();this._context.postMessage(message,targetOrigin)}destroy(){window.removeEventListener("message",this._handleMessage)}}function _ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}let SOCIAL_SOURCE_MAPPING={[UploadSource.y5.GDRIVE]:"ngdrive"};class ExternalSource extends LitUploaderBlock.z{get _counterText(){if(!this._latestSelectionSummary)return"";let{selectedCount,total}=this._latestSelectionSummary;return this.l10n("selected-count",{count:selectedCount,total})}get activityParams(){let params=super.activityParams;if("externalSourceType"in params)return params;throw Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType}=this.activityParams;externalSourceType?this._mountIframe():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this._unmountIframe(),this._mountIframe())})}),this.subConfigValue("multiple",multiple=>{this._showSelectionStatus=multiple}),this.subConfigValue("localeName",()=>{this._setupL10n()}),this.subConfigValue("externalSourcesEmbedCss",embedCss=>{this._applyEmbedCss(embedCss)})}_extractUrlFromSelectedFile(selectedFile){if(selectedFile.alternatives)for(let preferredType of(0,stringToArray.G)(this.cfg.externalSourcesPreferredTypes)){let regexp=wildcardRegexp(preferredType);for(let[type,typeUrl]of Object.entries(selectedFile.alternatives))if(regexp.test(type))return typeUrl}return selectedFile.url}_handleToolbarStateChange(message){this._toolbarVisible=message.isVisible}async _handleSelectedFilesChange(message){this.cfg.multiple!==message.isMultipleMode?console.error("Multiple mode mismatch"):(this._setSelectionSummary(message.selectedCount,message.total),this._doneBtnTextClass=message.isReady?"":"uc-hidden",this._isSelectionReady=message.isReady,this._isDoneBtnEnabled=message.isReady&&message.selectedFiles.length>0,this._showSelectionStatus=message.isMultipleMode&&message.total>0,this._couldSelectAll=message.selectedCount<message.total,this._couldDeselectAll=message.selectedCount===message.total,this._selectedList=message.selectedFiles??[],this._showDoneBtn=message.total>0)}_handleIframeLoad(){this._applyEmbedCss(this.cfg.externalSourcesEmbedCss),this._applyTheme(),this._setupL10n()}_applyTheme(){this._messageBridge?.send({type:"set-theme-definition",theme:(element=>{let theme={};for(let prop of ucCustomProperties){let value=getCssValue(element,prop);value&&(theme[prop]=value)}return theme})(this)})}_applyEmbedCss(css){this._messageBridge?.send({type:"set-embed-css",css})}_setupL10n(){this._messageBridge?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName})}_remoteUrl(){let{pubkey,remoteTabSessionKey,socialBaseUrl,multiple}=this.cfg,{externalSourceType}=this.activityParams,sourceName=SOCIAL_SOURCE_MAPPING[externalSourceType]??externalSourceType,params={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:pubkey,images_only:(!1).toString(),session_key:remoteTabSessionKey,wait_for_theme:!0,multiple:multiple.toString(),origin:this.cfg.topLevelOrigin||(()=>{let topLevelWindow=globalThis.top??globalThis.parent??globalThis.self;try{return topLevelWindow.location.origin}catch(e){return console.warn("Unable to access top-level window location:",e),globalThis.location.origin}})(),debug:this.cfg.debug},url=new URL(`/window4/${sourceName}`,socialBaseUrl);return url.search=function(params){let list=[];for(let[key,value]of Object.entries(params))null!=value&&("string"!=typeof value||0!==value.length)&&list.push(`${key}=${encodeURIComponent(value)}`);return list.join("&")}(params),url.toString()}_setSelectionSummary(selectedCount,total){this._latestSelectionSummary={selectedCount,total}}_mountIframe(){let iframe=document.createElement("iframe");iframe.src=this._remoteUrl(),iframe.marginHeight=0,iframe.marginWidth=0,iframe.frameBorder="0",iframe.allowTransparency=!0,iframe.addEventListener("load",this._handleIframeLoad.bind(this)),iframe.addEventListener("load",this._handleIframeLoad.bind(this)),this._iframeRef.value&&(this._iframeRef.value.innerHTML="",this._iframeRef.value.appendChild(iframe)),iframe.contentWindow&&(this._messageBridge?.destroy(),this._messageBridge=new MessageBridge(iframe.contentWindow,()=>this.cfg.socialBaseUrl),this._messageBridge.on("selected-files-change",this._handleSelectedFilesChange.bind(this)),this._messageBridge.on("toolbar-state-change",this._handleToolbarStateChange.bind(this)),this._resetSelectionStatus())}_unmountIframe(){this._messageBridge?.destroy(),this._messageBridge=void 0,this._iframeRef.value&&(this._iframeRef.value.innerHTML=""),this._resetSelectionStatus()}_resetSelectionStatus(){this._selectedList=[],this._isSelectionReady=!1,this._isDoneBtnEnabled=!1,this._couldSelectAll=!1,this._couldDeselectAll=!1,this._showSelectionStatus=!1,this._showDoneBtn=!1,this._doneBtnTextClass="uc-hidden",this._latestSelectionSummary=null}disconnectedCallback(){super.disconnectedCallback(),this._unmountIframe()}render(){return(0,external_lit_.html)`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${(0,ref_js_.ref)(this._iframeRef)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this._toolbarVisible}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this._handleCancel}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this._showSelectionStatus}><span>${this._counterText}</span><button type="button" @click=${this._handleSelectAll} ?hidden=${!this._couldSelectAll}>${this.l10n("select-all")}</button><button type="button" @click=${this._handleDeselectAll} ?hidden=${!this._couldDeselectAll}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this._handleDone} ?disabled=${!this._isDoneBtnEnabled} ?hidden=${!this._showDoneBtn} ><uc-spinner ?hidden=${this._isSelectionReady}></uc-spinner><span class=${this._doneBtnTextClass}>${this.l10n("done")}</span></button></div></div>`}constructor(...args){super(...args),this.couldBeCtxOwner=!0,this._iframeRef=(0,ref_js_.createRef)(),this._latestSelectionSummary=null,this._selectedList=[],this._isSelectionReady=!1,this._isDoneBtnEnabled=!1,this._couldSelectAll=!1,this._couldDeselectAll=!1,this._showSelectionStatus=!1,this._showDoneBtn=!1,this._doneBtnTextClass="uc-hidden",this._toolbarVisible=!0,this._handleDone=()=>{for(let message of this._selectedList){let url=this._extractUrlFromSelectedFile(message),{filename}=message,{externalSourceType}=this.activityParams;this.api.addFileFromUrl(url,{fileName:filename,source:externalSourceType})}this.$["*currentActivity"]=LitActivityBlock.S.activities.UPLOAD_LIST,this.modalManager?.open(LitActivityBlock.S.activities.UPLOAD_LIST)},this._handleCancel=()=>{this.historyBack()},this._handleSelectAll=()=>{this._messageBridge?.send({type:"select-all"})},this._handleDeselectAll=()=>{this._messageBridge?.send({type:"deselect-all"})}}}_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_selectedList",void 0),_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_isSelectionReady",void 0),_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_isDoneBtnEnabled",void 0),_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_couldSelectAll",void 0),_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_couldDeselectAll",void 0),_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_showSelectionStatus",void 0),_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_showDoneBtn",void 0),_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_doneBtnTextClass",void 0),_ts_decorate([(0,decorators_js_.state)()],ExternalSource.prototype,"_toolbarVisible",void 0)},8610(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{I:()=>Icon});var lit__rspack_import_0=__webpack_require__(2927),lit_decorators_js__rspack_import_1=__webpack_require__(8899),lit_directives_unsafe_svg_js__rspack_import_2=__webpack_require__(3943),_lit_LitBlock__rspack_import_3=__webpack_require__(204);function _ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}class Icon extends _lit_LitBlock__rspack_import_3.x{initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",resolver=>{this._iconHrefResolver=resolver,this._updateResolvedHref()});let pluginManager=this._sharedInstancesBag.pluginManager;pluginManager?.onPluginsChange&&(this._unsubscribePlugins=pluginManager.onPluginsChange(()=>this._updateResolvedHref()))}willUpdate(changedProperties){super.willUpdate(changedProperties),changedProperties.has("name")&&this._updateResolvedHref()}_updateResolvedHref(){if(!this.name){this._resolvedHref="",this._pluginSvg=null;return}let pluginManager=this._sharedInstancesBag.pluginManager,pluginIcon=pluginManager?.snapshot().icons.find(icon=>icon.name===this.name);if(pluginIcon){this._pluginSvg=pluginIcon.svg,this._resolvedHref="";return}this._pluginSvg=null;let defaultHref=`#uc-icon-${this.name}`,customHref=this._iconHrefResolver?.(this.name);this._resolvedHref=customHref??defaultHref}render(){return this._pluginSvg?(0,lit__rspack_import_0.html)`${this.yield("",(0,lit__rspack_import_0.html)`${(0,lit_directives_unsafe_svg_js__rspack_import_2.unsafeSVG)(this._pluginSvg)}`)}`:(0,lit__rspack_import_0.html)` ${this.yield("",(0,lit__rspack_import_0.html)`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this._resolvedHref}></use></svg>`)} `}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback()}constructor(...args){super(...args),this.name="",this._resolvedHref="",this._pluginSvg=null,this._iconHrefResolver=null}}_ts_decorate([(0,lit_decorators_js__rspack_import_1.property)({type:String})],Icon.prototype,"name",void 0),_ts_decorate([(0,lit_decorators_js__rspack_import_1.state)()],Icon.prototype,"_resolvedHref",void 0),_ts_decorate([(0,lit_decorators_js__rspack_import_1.state)()],Icon.prototype,"_pluginSvg",void 0)},9963(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Bx:()=>EventType,Kc:()=>InternalEventType,bk:()=>EventEmitter});var _lit_shared_instances__rspack_import_0=__webpack_require__(5890);let InternalEventType=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),EventType=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"});class EventEmitter extends _lit_shared_instances__rspack_import_0.jM{bindTarget(target){return this._targets.add(target),()=>{this._targets.delete(target)}}_dispatch(type,payload){for(let target of this._targets)target.dispatchEvent(new CustomEvent(type,{detail:payload}));this._debugPrint?.(()=>[`event "${type}"`,payload&&"object"==typeof payload?{...payload}:payload])}emit(type,payload,options={}){let{debounce}=options;if("number"!=typeof debounce&&!debounce)return void this._dispatch(type,"function"==typeof payload?payload():payload);this._timeoutStore.has(type)&&window.clearTimeout(this._timeoutStore.get(type));let timeoutId=window.setTimeout(()=>{try{let data="function"==typeof payload?payload():payload;this._dispatch(type,data),this._timeoutStore.delete(type)}catch(error){this._debugPrint?.(()=>`Error while getting payload for event "${type}"`,error)}},"number"==typeof debounce?debounce:20);this._timeoutStore.set(type,timeoutId)}destroy(){for(let timeoutId of this._timeoutStore.values())window.clearTimeout(timeoutId);this._targets.clear()}constructor(...args){super(...args),this._timeoutStore=new Map,this._targets=new Set}}},8130(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{T:()=>UrlSource});var lit__rspack_import_0=__webpack_require__(2927),lit_decorators_js__rspack_import_1=__webpack_require__(8899),lit_directives_ref_js__rspack_import_2=__webpack_require__(5337),_lit_LitActivityBlock__rspack_import_6=__webpack_require__(5923),_lit_LitUploaderBlock__rspack_import_3=__webpack_require__(5544),_utils_UploadSource__rspack_import_5=__webpack_require__(5730),_UploadCtxProvider_EventEmitter__rspack_import_4=__webpack_require__(9963);class UrlSource extends _lit_LitUploaderBlock__rspack_import_3.z{firstUpdated(){let input=this._inputRef.value;input&&(input.value="",input.focus())}render(){return(0,lit__rspack_import_0.html)`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this._handleUpload}><label><input ${(0,lit_directives_ref_js__rspack_import_2.ref)(this._inputRef)} placeholder="https://" class="uc-url-input" type="text" @input=${this._handleInput} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this._formState.importDisabled} >${this.l10n("upload-url")}</button></form>`}constructor(...args){super(...args),this._formState={importDisabled:!0},this._inputRef=(0,lit_directives_ref_js__rspack_import_2.createRef)(),this._handleInput=event=>{let value=event.target?.value??"";this._formState={importDisabled:!value}},this._handleUpload=event=>{event.preventDefault(),this.telemetryManager.sendEvent({eventType:_UploadCtxProvider_EventEmitter__rspack_import_4.Kc.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let input=this._inputRef.value,url=input?.value?.trim();url&&(this.api.addFileFromUrl(url,{source:_utils_UploadSource__rspack_import_5.pc.URL}),this.$["*currentActivity"]=_lit_LitActivityBlock__rspack_import_6.S.activities.UPLOAD_LIST,this.modalManager?.open(_lit_LitActivityBlock__rspack_import_6.S.activities.UPLOAD_LIST))}}}!function(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);c>3&&r&&Object.defineProperty(target,key,r)}([(0,lit_decorators_js__rspack_import_1.state)()],UrlSource.prototype,"_formState",void 0)},5704(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{r:()=>PACKAGE_NAME,i:()=>PACKAGE_VERSION});var package_namespaceObject=JSON.parse('{"rE":"1.28.0-alpha.111"}');let PACKAGE_NAME="blocks",PACKAGE_VERSION=package_namespaceObject.rE},3361(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{N:()=>CssDataMixin});let ESCAPED_PATTERN=/\\([0-9a-fA-F]{1,6} ?)/g;function CssDataMixin(ctor){return class extends ctor{getCssData(propName,silentCheck=!1){let cssDataCache=this._cssDataCache??Object.create(null);if(!Object.keys(cssDataCache).includes(propName)||!cssDataCache[propName]){this._computedStyle||(this._computedStyle=window.getComputedStyle(this));let val=this._computedStyle.getPropertyValue(propName).trim();try{cssDataCache[propName]=function(input){let output=input;if(!(input.length<2)&&('"'===input[0]||"'"===input[0])&&('"'===input[input.length-1]||"'"===input[input.length-1])){let result;('"'===(result=output)[0]||"'"===result[0])&&(result=result.slice(1)),('"'===result[result.length-1]||"'"===result[result.length-1])&&(result=result.slice(0,-1)),output='"'+(output=function(str){let result="",prev="";for(let i=0;i<str.length;i++){let next=str[i+1];"\\"===str[i]&&'"'===next?(result+='\\"',i++):'"'===str[i]&&"\\"!==prev?result+='\\"':result+=str[i],prev=str[i]??""}return result}(output=(output=(output=result).replace(ESCAPED_PATTERN,(_match,group)=>String.fromCodePoint(parseInt(group.trim(),16)))).replaceAll("\\\n","\\n")))+'"'}try{return JSON.parse(output)}catch(_error){return}}(val)}catch(error){silentCheck||console.warn(`CSS Data error: ${propName}`,error),cssDataCache[propName]=null}}return this._cssDataCache=cssDataCache,cssDataCache[propName]}constructor(...args){super(...args),this._cssDataCache=null,this._computedStyle=null}}}},7337(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Q:()=>LightDomMixin});var lit__rspack_import_0=__webpack_require__(2927);function LightDomMixin(ctor){return class extends ctor{createRenderRoot(){return this}connectedCallback(){this._initialLightDomChildren||(this._initialLightDomChildren=Array.from(this.childNodes)),super.connectedCallback()}_adoptChildren(){if(this._hasAdoptedChildren)return;this._hasAdoptedChildren=!0,this._slotsMap={};let directChildren=Array.from(this.childNodes);for(let child of directChildren.length?directChildren:this._initialLightDomChildren??[]){let slotName=this._getSlotNameForChild(child),slotContent=this._slotsMap[slotName]??[];child instanceof Element&&(child.removeAttribute("slot"),child.removeAttribute("content-for")),slotContent.push(child),this._slotsMap[slotName]=slotContent}this._initialLightDomChildren=null}_getSlotNameForChild(child){return child instanceof Comment&&child.nextSibling instanceof Element?this._getSlotNameForChild(child.nextSibling):"contentFor"in child?child.contentFor||"":child instanceof Element&&child.hasAttribute("content-for")&&child.getAttribute("content-for")||""}_isTextNodeEmpty(node){return!node.textContent||!node.textContent.trim()}_isSlotEmpty(slot){let content=this._slotsMap[slot];return!content||content.every(child=>child instanceof Comment||child instanceof Text&&this._isTextNodeEmpty(child))}update(changedProperties){!this.hasUpdated&&this.willYield&&this._adoptChildren(),super.update(changedProperties)}yield(slot,defaultContent){if(""===slot&&!this._slotsMap[slot]&&!this._hasAdoptedChildren&&this._initialLightDomChildren?.length){let slotContent=[];for(let child of this._initialLightDomChildren)child instanceof Element&&(child.removeAttribute("slot"),child.removeAttribute("content-for")),slotContent.push(child);this._slotsMap[slot]=slotContent,this._hasAdoptedChildren=!0,this._initialLightDomChildren=null}let slotContent=this._slotsMap[slot];return(0,lit__rspack_import_0.html)`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
`}constructor(...args){super(...args),this.willYield=!0,this._slotsMap={},this._initialLightDomChildren=null,this._hasAdoptedChildren=!1}}}},5923(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{S:()=>LitActivityBlock});var _abstract_CTX__rspack_import_2=__webpack_require__(7992),_blocks_UploadCtxProvider_EventEmitter__rspack_import_1=__webpack_require__(9963),_utils_debounce__rspack_import_3=__webpack_require__(4441),_activity_constants__rspack_import_4=__webpack_require__(7715),_LitBlock__rspack_import_0=__webpack_require__(204);let ACTIVE_ATTR="active",ACTIVE_PROP="___ACTIVITY_IS_ACTIVE___";class LitActivityBlock extends _LitBlock__rspack_import_0.x{_deactivate(){let actDesc=LitActivityBlock._activityCallbacks.get(this);this[ACTIVE_PROP]=!1,this.removeAttribute(ACTIVE_ATTR),actDesc?.deactivateCallback?.()}_activate(){let actDesc=LitActivityBlock._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[ACTIVE_PROP]=!0,this.setAttribute(ACTIVE_ATTR,""),actDesc?.activateCallback?.(),this._debouncedHistoryFlush(),this.emit(_blocks_UploadCtxProvider_EventEmitter__rspack_import_1.Bx.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",val=>{try{this.activityType!==val&&this[ACTIVE_PROP]?this._deactivate():this.activityType!==val||this[ACTIVE_PROP]||this._activate()}catch(err){this.telemetryManager.sendEventError(err,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,err);let nextActivity=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=nextActivity??null}val||(this.$["*history"]=[])}))}_historyFlush(){let history=this.$["*history"];history&&(history.length>10&&(history=history.slice(history.length-11,history.length-1)),this.historyTracked&&history[history.length-1]!==this.activityType&&history.push(this.activityType),this.$["*history"]=history)}_isActivityRegistered(){return!!this.activityType&&LitActivityBlock._activityCallbacks.has(this)}static{this._activityCallbacks=new Map}get isActivityActive(){return!!this[ACTIVE_PROP]}get couldOpenActivity(){return!0}registerActivity(_name,options={}){let{onActivate,onDeactivate}=options;LitActivityBlock._activityCallbacks.set(this,{activateCallback:onActivate,deactivateCallback:onDeactivate})}_unregisterActivity(){this.isActivityActive&&this._deactivate(),LitActivityBlock._activityCallbacks.delete(this)}disconnectedCallback(){super.disconnectedCallback(),this._isActivityRegistered()&&this._unregisterActivity();let currentActivity=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(block=>block instanceof LitActivityBlock&&block.activityType===currentActivity)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()))}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let history=this.$["*history"];if(history){let nextActivity=history.pop();for(;nextActivity===this.activityType;)nextActivity=history.pop();let couldOpenActivity=!!nextActivity;if(nextActivity){let nextLitActivityBlock=[...this.blocksRegistry].find(block=>block.activityType===nextActivity);couldOpenActivity=nextLitActivityBlock?.couldOpenActivity??!1}nextActivity=couldOpenActivity?nextActivity:null,this.$["*currentActivity"]=nextActivity??null,nextActivity&&this.modalManager?.open(nextActivity),this.$["*history"]=history,nextActivity||this.modalManager?.closeAll()}}constructor(...args){super(...args),this.historyTracked=!1,this.init$=(0,_abstract_CTX__rspack_import_2._H)(this),this._debouncedHistoryFlush=(0,_utils_debounce__rspack_import_3.s)(this._historyFlush.bind(this),10)}}LitActivityBlock.activities=_activity_constants__rspack_import_4.g},204(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{x:()=>LitBlock});var external_lit_=__webpack_require__(2927),CTX=__webpack_require__(7992),activity_constants=__webpack_require__(7715),shared_instances=__webpack_require__(5890);class ClipboardLayer extends shared_instances.jM{constructor(sharedInstancesBag){super(sharedInstancesBag),this.scopes=new Set,this.listener=this._listener.bind(this),window.addEventListener("paste",this.listener)}openUploadList(){this._sharedInstancesBag.api.setCurrentActivity(activity_constants.g.UPLOAD_LIST),this._sharedInstancesBag.api.setModalState(!0)}async _listener(event){if(event.clipboardData){for(let scope of this.scopes)if(scope.isConnected)switch(this._cfg.pasteScope){case"global":await this.handlePaste(event);break;case"local":if(!scope.contains(event.target))continue;await this.handlePaste(event);break;default:continue}}}async handlePaste(event){let items=Array.from(event.clipboardData.items),files=items.map(item=>item.getAsFile()).filter(file=>null!==file),urls=items.filter(item=>"string"===item.kind&&"text/plain"===item.type).map(item=>new Promise(resolve=>{item.getAsString(text=>{resolve(text)})}));files.length>0&&(files.forEach(file=>{this._sharedInstancesBag.api.addFileFromObject(file,{source:"clipboard"})}),this.openUploadList()),urls.length>0&&((await Promise.all(urls)).forEach(url=>{this._sharedInstancesBag.api.addFileFromUrl(url,{source:"clipboard"})}),this.openUploadList())}registerBlock(scope){return this.scopes.add(scope),()=>{this.scopes.delete(scope)}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear()}}class ScopedMinimalWindow{addEventListener(type,listener){let wrappedListener=event=>{let target=event.target;target instanceof Node&&this._scope.some(el=>el===target||el.contains(target))&&listener(event)};this._listeners.set(listener,wrappedListener),window.addEventListener(type,wrappedListener)}removeEventListener(type,listener){let wrappedListener=this._listeners.get(listener);wrappedListener&&window.removeEventListener(type,wrappedListener),this._listeners.delete(listener)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(scope){this._scope.push(scope)}destroy(){for(let wrappedListener of(this._scope=[],this._listeners.values()))window.removeEventListener("keydown",wrappedListener),window.removeEventListener("keyup",wrappedListener);this._listeners.clear()}constructor(){this._listeners=new Map,this._scope=[]}}class A11y{constructor(){this._scopedWindow=new ScopedMinimalWindow,this._destroyKeyUX=(0,__rspack_external_keyux.startKeyUX)(this._scopedWindow,[(0,__rspack_external_keyux.focusGroupKeyUX)(),(0,__rspack_external_keyux.pressKeyUX)("is-pressed"),(0,__rspack_external_keyux.jumpKeyUX)(),(0,__rspack_external_keyux.hiddenKeyUX)()])}registerBlock(scope){this._scopedWindow.registerScope(scope)}destroy(){this._destroyKeyUX?.(),this._scopedWindow.destroy()}}var LocaleManager=__webpack_require__(7959),ModalManager=__webpack_require__(3076);class CustomConfigRegistry{register(pluginId,definition){if(this._definitions.has(definition.name))return void console.warn(`[CustomConfig] Config option "${definition.name}" is already registered`);let ownedDefinition={attribute:!0,...definition,pluginId};this._definitions.set(definition.name,ownedDefinition)}unregister(name){this._definitions.delete(name)}unregisterByPlugin(pluginId){for(let[name,definition]of this._definitions)definition.pluginId===pluginId&&this._definitions.delete(name)}get(name){return this._definitions.get(name)}getAll(){return new Map(this._definitions)}constructor(){this._definitions=new Map}}var sharedConfigKey=__webpack_require__(1971);class PluginManager extends shared_instances.jM{constructor(sharedInstancesBag){super(sharedInstancesBag),this._plugins=new Map,this._sources=[],this._activities=[],this._fileActions=[],this._fileHooks=[],this._icons=[],this._i18n=[],this._subscribers=new Set,this._pluginsUpdate=Promise.resolve(),this.configRegistry=new CustomConfigRegistry,this.addSub(this._ctx.sub((0,sharedConfigKey.T)("plugins"),plugins=>{this._pluginsUpdate=this._pluginsUpdate.then(()=>this._syncPlugins(plugins))}))}onPluginsChange(callback){return this._subscribers.add(callback),()=>{this._subscribers.delete(callback)}}async _syncPlugins(plugins){let currentPluginIds=new Set(this._plugins.keys()),processedIds=new Set;for(let plugin of plugins){if(processedIds.has(plugin.id)){this._debugPrint(`Plugin "${plugin.id}" is already in the list, skipping duplicate`);continue}processedIds.add(plugin.id);let registered=this._plugins.get(plugin.id);if(!registered||registered.plugin!==plugin)try{await this._registerPlugin(plugin)}catch(error){this._purgeRegistrations(plugin.id),this._notifySubscribers(),this._debugPrint(`Plugin "${plugin.id}" setup failed`,error)}currentPluginIds.delete(plugin.id)}for(let pluginId of currentPluginIds)this._unregisterPlugin(pluginId)}async _registerPlugin(plugin){let pluginExports;this._plugins.has(plugin.id)&&this._unregisterPlugin(plugin.id);let registrations={sources:[],activities:[],fileActions:[],fileHooks:[],icons:[],i18n:[]},configSubscriptions=[],uploaderApi=this._sharedInstancesBag.api;try{pluginExports=await plugin.setup({pluginApi:{registry:{registerSource:source=>this._register(this._sources,registrations.sources,plugin.id,source),registerActivity:activity=>this._register(this._activities,registrations.activities,plugin.id,activity),registerFileAction:fileAction=>this._register(this._fileActions,registrations.fileActions,plugin.id,fileAction),registerFileHook:hook=>this._register(this._fileHooks,registrations.fileHooks,plugin.id,hook),registerIcon:icon=>this._register(this._icons,registrations.icons,plugin.id,icon),registerI18n:i18n=>this._register(this._i18n,registrations.i18n,plugin.id,i18n),registerConfig:definition=>{this.configRegistry.register(plugin.id,definition)}},config:{get:configName=>{let stateKey=(0,sharedConfigKey.T)(configName);return this._ctx.read(stateKey)},subscribe:(configName,callback)=>{let stateKey=(0,sharedConfigKey.T)(configName),unsub=this._ctx.sub(stateKey,value=>{callback(value)});return configSubscriptions.push(unsub),unsub}},activity:{getParams:()=>this._ctx.read("*currentActivityParams"),subscribeToParams:callback=>{let unsub=this._ctx.sub("*currentActivityParams",params=>{callback(params)});return configSubscriptions.push(unsub),unsub}},files:{update:(internalId,changes)=>{let entry=this._sharedInstancesBag.uploadCollection?.read(internalId);entry&&(void 0!==changes.file&&(entry.setValue("file",changes.file),entry.setValue("fileSize",changes.file.size)),void 0!==changes.cdnUrl&&entry.setValue("cdnUrl",changes.cdnUrl),void 0!==changes.cdnUrlModifiers&&entry.setValue("cdnUrlModifiers",changes.cdnUrlModifiers),void 0!==changes.mimeType&&entry.setValue("mimeType",changes.mimeType))}}},uploaderApi})??void 0}catch(error){for(let unsub of configSubscriptions)try{unsub()}catch(e){this._debugPrint("Failed to unsubscribe config listener",e)}throw error}this._plugins.set(plugin.id,{plugin,exports:pluginExports,registrations,configSubscriptions}),this._notifySubscribers()}_unregisterPlugin(pluginId){let registered=this._plugins.get(pluginId);if(registered){for(let unsub of(this._purgeRegistrations(pluginId),registered.configSubscriptions))try{unsub()}catch(error){this._debugPrint("Failed to unsubscribe config listener",error)}registered.exports?.dispose?.(),this._plugins.delete(pluginId),this._notifySubscribers()}}snapshot(){return{sources:[...this._sources],activities:[...this._activities],fileActions:[...this._fileActions],fileHooks:[...this._fileHooks],icons:[...this._icons],i18n:[...this._i18n]}}destroy(){for(let pluginId of Array.from(this._plugins.keys()))this._unregisterPlugin(pluginId);super.destroy()}_register(target,bucket,pluginId,registration){let owned={...registration,pluginId};return target.push(owned),bucket.push(owned),registration}_purgeRegistrations(pluginId){this._sources=this._sources.filter(item=>item.pluginId!==pluginId),this._activities=this._activities.filter(item=>item.pluginId!==pluginId),this._fileActions=this._fileActions.filter(item=>item.pluginId!==pluginId),this._fileHooks=this._fileHooks.filter(item=>item.pluginId!==pluginId),this._icons=this._icons.filter(item=>item.pluginId!==pluginId),this._i18n=this._i18n.filter(item=>item.pluginId!==pluginId),this.configRegistry.unregisterByPlugin(pluginId)}_notifySubscribers(){for(let callback of this._subscribers)try{callback()}catch{}}}var upload_client_=__webpack_require__(5474),initialConfig=__webpack_require__(318),EventEmitter=__webpack_require__(9963),env=__webpack_require__(5704),UID=__webpack_require__(5446);class TelemetryManager extends shared_instances.jM{constructor(sharedInstancesBag){for(let key of(super(sharedInstancesBag),this._sessionId=UID.V.generateRandomUUID(),this._config=structuredClone(initialConfig.Dz),this._initialized=!1,this._lastPayload=null,this._isEnabled=!1,this._telemetryInstance=new __rspack_external__uploadcare_quality_insights_89d21ee8.TelemetryAPIService,this._queue=new upload_client_.Queue(10),this.addSub(this._ctx.sub((0,sharedConfigKey.T)("qualityInsights"),value=>{this._isEnabled=!!value})),Object.keys(this._config)))this.addSub(this._ctx.sub((0,sharedConfigKey.T)(key),value=>{this._isEnabled&&(this._initialized&&this._config[key]!==value&&this.sendEvent({eventType:EventEmitter.Kc.CHANGE_CONFIG}),this._setConfig(key,value))}))}_init(type){type!==EventEmitter.Kc.INIT_SOLUTION||this._initialized||(this._initialized=!0)}_setConfig(key,value){this._config[key]!==value&&(this._config[key]=value)}_formattingPayload(body){let payload=body.payload?{...body.payload}:{};payload.activity&&(payload.activity=void 0);let result={...body};return(body.eventType===EventEmitter.Kc.INIT_SOLUTION||body.eventType===EventEmitter.Kc.CHANGE_CONFIG)&&(result.config=this._config),{...result,appVersion:env.i,appName:env.r,sessionId:this._sessionId,component:this._solution,activity:this._activity,projectPubkey:this._config.pubkey,userAgent:navigator.userAgent,eventType:result.eventType??"",eventTimestamp:this._timestamp,payload:{location:this._location,...payload}}}_excludedEvents(type){return!!(type&&[EventEmitter.Bx.CHANGE,EventEmitter.Bx.COMMON_UPLOAD_PROGRESS,EventEmitter.Bx.FILE_ADDED,EventEmitter.Bx.FILE_REMOVED,EventEmitter.Bx.FILE_UPLOAD_START,EventEmitter.Bx.FILE_UPLOAD_PROGRESS,EventEmitter.Bx.FILE_UPLOAD_SUCCESS,EventEmitter.Bx.FILE_UPLOAD_FAILED].includes(type))}sendEvent(body){if(!this._isEnabled)return;let payload=this._formattingPayload({eventType:body.eventType,payload:body.payload,config:body.config});this._init(body.eventType),this._excludedEvents(body.eventType)||this._lastPayload&&this._checkObj(this._lastPayload,payload)||this._queue.add(async()=>{this._lastPayload=payload,await this._telemetryInstance.sendEvent(payload)})}sendEventError(error,context="unknown"){this.sendEvent({eventType:EventEmitter.Kc.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${context}`,error:error.message}}})}sendEventCloudImageEditor(e,tabId,options={}){this.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{tabId,node:e.currentTarget?.tagName,event:e.type,...options}}})}_checkObj(last,current){if(JSON.stringify(last)===JSON.stringify(current))return!0;if("object"!=typeof last||"object"!=typeof current||null==last||null==current)return!1;let lastKeys=Object.keys(last),currentKeys=Object.keys(current);if(lastKeys.length!==currentKeys.length)return!1;for(let key of lastKeys)if(!Object.hasOwn(current,key)||!this._checkObj(last[key],current[key]))return!1;return!0}get _timestamp(){return Date.now()}get _solution(){if(!this._ctx.has("*solution"))return null;let solution=this._ctx.read("*solution");return solution?solution.toLowerCase():null}get _activity(){return this._ctx.has("*currentActivity")?this._ctx.read("*currentActivity"):null}get _location(){return location.origin}}var PubSubCompat=__webpack_require__(8594),cdn_utils=__webpack_require__(6339),template_utils=__webpack_require__(664),debounce=__webpack_require__(4441);let WINDOW_HEIGHT_TRACKER_PROPERTY="--uploadcare-blocks-window-height";class WindowHeightTracker{static{this.clientsRegistry=new Set}static{this.flush=(0,debounce.s)(()=>{document.documentElement.style.setProperty(WINDOW_HEIGHT_TRACKER_PROPERTY,`${window.innerHeight}px`)},100)}static registerClient(client){0===WindowHeightTracker.clientsRegistry.size&&WindowHeightTracker.attachTracker(),WindowHeightTracker.clientsRegistry.add(client)}static unregisterClient(client){WindowHeightTracker.clientsRegistry.delete(client),0===WindowHeightTracker.clientsRegistry.size&&WindowHeightTracker.detachTracker()}static attachTracker(){window.addEventListener("resize",WindowHeightTracker.flush,{passive:!0,capture:!0}),WindowHeightTracker.flush()}static detachTracker(){window.removeEventListener("resize",WindowHeightTracker.flush,{capture:!0}),document.documentElement.style.removeProperty(WINDOW_HEIGHT_TRACKER_PROPERTY)}}var CssDataMixin=__webpack_require__(3361),createDebugPrinter=__webpack_require__(255),LightDomMixin=__webpack_require__(7337),l10n=__webpack_require__(263),RegisterableElementMixin=__webpack_require__(3282),SymbioteCompatMixin=__webpack_require__(9280);class TestModeController{constructor(host){this._trackedElements=new Set,this._originalValues=new Map,this._enabled=!1,this._host=host,this._host.addController(this)}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0,this._trackedElements.clear(),this._originalValues.clear()}hostUpdated(){if(!this._unsubscribe&&this._host.has((0,sharedConfigKey.T)("testMode"))){let unsubscribe=this._host.subConfigValue("testMode",isEnabled=>{this._enabled=!!isEnabled,this._applyTestMode()});this._unsubscribe=unsubscribe}this._collectElements(),this._applyTestMode()}_collectElements(){let litHost=this._host,root=litHost.renderRoot??litHost;if(!root)return;let hostElement=this._host,hostTag=hostElement.tagName?.toLowerCase();for(let el of Array.from(root.querySelectorAll("[data-testid]")).filter(el=>!el.tagName?.includes("-")))if((!hostTag||el.closest(hostTag)===hostElement)&&!this._trackedElements.has(el)){let attrValue=el.getAttribute("data-testid");if(!attrValue)continue;this._trackedElements.add(el),this._originalValues.set(el,attrValue)}for(let el of Array.from(this._trackedElements))(!el.isConnected||hostTag&&el.closest(hostTag)!==hostElement)&&(this._trackedElements.delete(el),this._originalValues.delete(el))}_applyTestMode(){if(!this._trackedElements.size)return;let prefix=this._host.testId||"";for(let el of this._trackedElements){let baseValue=this._originalValues.get(el);baseValue&&(this._enabled?el.setAttribute("data-testid",`${prefix}--${baseValue}`):el.removeAttribute("data-testid"))}}}let LitBlockBase=(0,RegisterableElementMixin.d)((0,SymbioteCompatMixin.w)()((0,CssDataMixin.N)((0,LightDomMixin.Q)(external_lit_.LitElement))));class LitBlock extends LitBlockBase{static{this.styleAttrs=[]}constructor(){super(),this.activityType=null,this.init$=(0,CTX.HU)(),this.l10n=(0,l10n.k)(()=>this.sharedCtx),this.debugPrint=(0,createDebugPrinter.W)(()=>this.sharedCtx,this.constructor.name),this._sharedInstancesBag=(0,shared_instances.EC)(()=>this.sharedCtx),new TestModeController(this)}emit(type,payload,options){let eventEmitter=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!eventEmitter)return;eventEmitter.emit(type,payload,options);let resolvedPayload="function"==typeof payload?payload():payload;this.telemetryManager.sendEvent({eventType:type,payload:resolvedPayload??void 0})}hasBlockInCtx(callback){for(let block of this.blocksRegistry)if(callback(block))return!0;return!1}connectedCallback(){this.constructor.styleAttrs.forEach(attr=>{this.setAttribute(attr,"")}),super.connectedCallback(),WindowHeightTracker.registerClient(this)}initCallback(){this._addSharedContextInstance("*blocksRegistry",()=>new Set),this._addSharedContextInstance("*pluginManager",sharedInstancesBag=>new PluginManager(sharedInstancesBag)),this._addSharedContextInstance("*eventEmitter",sharedInstancesBag=>new EventEmitter.bk(sharedInstancesBag)),this._addSharedContextInstance("*localeManager",sharedInstancesBag=>new LocaleManager.OZ(sharedInstancesBag)),this._addSharedContextInstance("*modalManager",sharedInstancesBag=>new ModalManager.P(sharedInstancesBag)),this._addSharedContextInstance("*a11y",()=>new A11y),this._addSharedContextInstance("*clipboard",sharedInstancesBag=>new ClipboardLayer(sharedInstancesBag)),this._addSharedContextInstance("*telemetryManager",sharedInstancesBag=>new TelemetryManager(sharedInstancesBag)),this.sub((0,LocaleManager.PI)("locale-id"),localeId=>{let locale,direction,fromGetter,direction1=(locale=new Intl.Locale(localeId),direction="ltr",(fromGetter=locale.getTextInfo?.().direction)?direction=fromGetter:locale.textInfo?.direction&&(direction=locale.textInfo.direction),direction);this.style.direction="ltr"===direction1?"":direction1,this.requestUpdate()}),this.subConfigValue("testMode",testMode=>{testMode&&this.testId?this.setAttribute("data-testid",this.testId):this.removeAttribute("data-testid")}),this.blocksRegistry.add(this)}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this._getSharedContextInstance("*modalManager",!1)}get telemetryManager(){return this._getSharedContextInstance("*telemetryManager")}get localeManager(){return this._getSharedContextInstance("*localeManager")}get a11y(){return this._getSharedContextInstance("*a11y")}get clipboardLayer(){return this._getSharedContextInstance("*clipboard")}get blocksRegistry(){return this._getSharedContextInstance("*blocksRegistry")}get eventEmitter(){return this._getSharedContextInstance("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),WindowHeightTracker.unregisterClient(this);let blocksRegistry=this.blocksRegistry;blocksRegistry?.delete(this),blocksRegistry?.size===0&&setTimeout(()=>{this.isConnected||blocksRegistry?.size>0||this.destroyCtxCallback()},0)}destroyCtxCallback(){this._destroySharedContextInstances(),PubSubCompat.G.deleteCtx(this.ctxName)}_getSharedContextInstances(){let key="*sharedContextInstances";if(!this.has(key)||!this.$[key]){let map=new Map;this.add(key,map,!0)}return this.$[key]}_addSharedContextInstance(key,resolver){let instances=this._getSharedContextInstances();if(!instances.has(key)&&(!this.has(key)||!this.$[key])){let instance=resolver(this._sharedInstancesBag);this.add(key,instance,!0),instances.set(key,instance);return}}_destroySharedContextInstances(){let instances=this._getSharedContextInstances();for(let[key,instance]of instances.entries())instance?.destroy?.(),this.pub(key,null);instances.clear()}_getSharedContextInstance(key,isRequired=!0){if(this.has(key)&&this.$[key]||!isRequired)return this.$[key];throw Error(`Unexpected error: context manager for key "${String(key)}" is not available`)}async proxyUrl(url){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(url,{uuid:(0,cdn_utils.p_)(url),cdnUrlModifiers:(0,cdn_utils._A)(url),fileName:(0,cdn_utils.v6)(url)})}catch(err){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",err),this.telemetryManager.sendEventError(err,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),url}return this.cfg.secureDeliveryProxy?(0,template_utils.x)(this.cfg.secureDeliveryProxy,{previewUrl:url},{transform:value=>window.encodeURIComponent(value)}):url}get cfg(){return this._cfgProxy||(this._cfgProxy=new Proxy({},{set:(_obj,key,value)=>{if("string"!=typeof key||!(key in initialConfig.Dz))return!1;let sharedKey=(0,sharedConfigKey.T)(key);return this.has(sharedKey)||this.add(sharedKey,initialConfig.Dz[key]),this.$[sharedKey]=value,!0},get:(_obj,key)=>{let sharedKey=(0,sharedConfigKey.T)(key);return this.has(sharedKey)||this.add(sharedKey,initialConfig.Dz[key]),this.$[sharedKey]}})),this._cfgProxy}subConfigValue(key,callback){let sharedKey=(0,sharedConfigKey.T)(key);return this.has(sharedKey)||this.add(sharedKey,initialConfig.Dz[key]),this.sub(sharedKey,callback)}}},5544(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{z:()=>LitUploaderBlock});var upload_client_=__webpack_require__(5474),CTX=__webpack_require__(7992),shared_instances=__webpack_require__(5890);let msToUnixTimestamp=ms=>"number"!=typeof ms?0:Math.floor(ms/1e3);class SecureUploadsManager extends shared_instances.jM{async getSecureToken(){let{secureSignature,secureExpire,secureUploadsSignatureResolver,secureUploadsExpireThreshold}=this._cfg;if((secureSignature||secureExpire)&&secureUploadsSignatureResolver&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),secureUploadsSignatureResolver){if(!this._secureToken||((secureToken,{threshold})=>{let{secureExpire}=secureToken,nowUnix=msToUnixTimestamp(Date.now()),expireUnix=Number(secureExpire);return nowUnix+msToUnixTimestamp(threshold)>=expireUnix})(this._secureToken,{threshold:secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let result=await secureUploadsSignatureResolver();result?result.secureSignature&&result.secureExpire?(this._debugPrint("Secure signature resolved:",result),this._debugPrint("Secure signature will expire in",new Date(1e3*Number(result.secureExpire)).toISOString()),this._secureToken=result):console.error("Secure signature resolver returned an invalid result:",result):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(err){console.error("Secure signature resolving failed. Falling back to the previous one.",err),this._sharedInstancesBag.telemetryManager.sendEventError(err,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.")}}return this._secureToken}return secureSignature&&secureExpire?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature,secureExpire}),{secureSignature,secureExpire}):null}destroy(){super.destroy(),this._secureToken=null}constructor(...args){super(...args),this._secureToken=null}}var EventEmitter=__webpack_require__(9963),debounce=__webpack_require__(4441);let validateMultiple=(collection,api)=>{let total=collection.totalCount,multipleMin=api.cfg.multiple?api.cfg.multipleMin:0,multipleMax=api.cfg.multiple?api.cfg.multipleMax:1;return multipleMin&&total<multipleMin?{type:"TOO_FEW_FILES",message:api.l10n("files-count-limit-error-too-few",{min:multipleMin,max:multipleMax,total}),payload:{total,min:multipleMin,max:multipleMax}}:multipleMax&&total>multipleMax?{type:"TOO_MANY_FILES",message:api.l10n("files-count-limit-error-too-many",{min:multipleMin,max:multipleMax,total}),payload:{total,min:multipleMin,max:multipleMax}}:void 0},validateCollectionUploadError=(collection,api)=>{if(collection.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:api.l10n("some-files-were-not-uploaded")}},validateIsImage=(outputEntry,api)=>{let imagesOnly=api.cfg.imgOnly,isImage=outputEntry.isImage;if(imagesOnly&&!isImage&&(outputEntry.fileInfo||!outputEntry.externalUrl)&&(outputEntry.fileInfo||outputEntry.mimeType))return{type:"NOT_AN_IMAGE",message:api.l10n("images-only-accepted"),payload:{entry:outputEntry}}};var browser_info=__webpack_require__(1633),stringToArray=__webpack_require__(2513);let BASIC_IMAGE_WILDCARD="image/*",BASIC_VIDEO_WILDCARD="video/*",IMAGE_ACCEPT_LIST=browser_info.R5.safariDesktop?[BASIC_IMAGE_WILDCARD]:[BASIC_IMAGE_WILDCARD,"image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],mergeFileTypes=fileTypes=>fileTypes?fileTypes.filter(item=>"string"==typeof item).flatMap(str=>(0,stringToArray.G)(str)):[],matchMimeType=(mimeType,allowedFileTypes)=>allowedFileTypes.some(type=>{if(type.endsWith("*")){let normalizedType=type.replace("*","");return mimeType.startsWith(normalizedType)}return mimeType===type}),validateFileType=(outputEntry,api)=>{let allowedFileTypes=mergeFileTypes([...api.cfg.imgOnly?IMAGE_ACCEPT_LIST:[],api.cfg.accept]);if(!allowedFileTypes.length)return;let mimeType=outputEntry.mimeType,fileName=outputEntry.name;if(!mimeType||!fileName)return;let mimeOk=matchMimeType(mimeType,allowedFileTypes),extOk=allowedFileTypes.some(type=>!!type.startsWith(".")&&fileName.toLowerCase().endsWith(type.toLowerCase()));if(!mimeOk&&!extOk)return{type:"FORBIDDEN_FILE_TYPE",message:api.l10n("file-type-not-allowed"),payload:{entry:outputEntry}}};var getPluralForm=__webpack_require__(9364);let ByteUnitEnum=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),round=number=>Math.ceil(100*number)/100,validateMaxSizeLimit=(outputEntry,api)=>{let maxFileSize=api.cfg.maxLocalFileSizeBytes,fileSize=outputEntry.size;if(maxFileSize&&fileSize&&fileSize>maxFileSize)return{type:"FILE_SIZE_EXCEEDED",message:api.l10n("files-max-size-limit-error",{maxFileSize:((bytes,unit=ByteUnitEnum.AUTO)=>{let isAutoMode=unit===ByteUnitEnum.AUTO;if(unit===ByteUnitEnum.BYTE||isAutoMode&&bytes<1e3){let pluralForm=(0,getPluralForm.Z)("en-US",bytes);return`${bytes} ${"one"===pluralForm?"byte":"bytes"}`}return unit===ByteUnitEnum.KB||isAutoMode&&bytes<1e6?`${round(bytes/1e3)} KB`:unit===ByteUnitEnum.MB||isAutoMode&&bytes<1e9?`${round(bytes/1e6)} MB`:unit===ByteUnitEnum.GB||isAutoMode&&bytes<1e12?`${round(bytes/1e9)} GB`:unit===ByteUnitEnum.TB||isAutoMode&&bytes<1e15?`${round(bytes/1e12)} TB`:`${round(bytes/1e15)} PB`})(maxFileSize)}),payload:{entry:outputEntry}}},validateUploadError=(outputEntry,api)=>{let{internalId}=outputEntry;if(!api._uploadCollection.hasItem(internalId))return;let internalEntry=api._uploadCollection.read(internalId),cause=internalEntry?.getValue("uploadError");if(!cause)return;if(cause instanceof upload_client_.UploadError)return{type:"UPLOAD_ERROR",message:cause.message,payload:{entry:outputEntry,error:cause}};if(cause instanceof upload_client_.NetworkError)return{type:"NETWORK_ERROR",message:cause.message,payload:{entry:outputEntry,error:cause}};let error=cause instanceof Error?cause:Error("Unknown error",{cause});return{type:"UNKNOWN_ERROR",message:error.message,payload:{entry:outputEntry,error}}};var sharedConfigKey=__webpack_require__(1971);let LOG_TEXT_FILE_VALIDATION_FAILED="File validator execution has failed",LOG_TEXT_MISSING_ERROR_MESSAGE="Missing message. We recommend adding message: value.",getValidatorDescriptor=validator=>"function"==typeof validator?{runOn:"change",validator}:validator;class ValidationManager extends shared_instances.jM{get _uploadCollection(){return this._sharedInstancesBag.uploadCollection}constructor(sharedInstancesBag){super(sharedInstancesBag),this._commonFileValidators=[validateIsImage,validateFileType,validateMaxSizeLimit,validateUploadError],this._commonCollectionValidators=[validateMultiple,validateCollectionUploadError],this._queue=new upload_client_.Queue(20),this._runQueueDebounced=(0,debounce.s)(()=>{this._queue.run()},500),this._isDestroyed=!1,this._entryValidationState=new Map;let runAllValidators=(0,debounce.s)(()=>{this.runFileValidators("change"),this.runCollectionValidators()},0);this.addSub(this._ctx.sub((0,sharedConfigKey.T)("maxLocalFileSizeBytes"),runAllValidators)),this.addSub(this._ctx.sub((0,sharedConfigKey.T)("multipleMin"),runAllValidators)),this.addSub(this._ctx.sub((0,sharedConfigKey.T)("multipleMax"),runAllValidators)),this.addSub(this._ctx.sub((0,sharedConfigKey.T)("multiple"),runAllValidators)),this.addSub(this._ctx.sub((0,sharedConfigKey.T)("imgOnly"),runAllValidators)),this.addSub(this._ctx.sub((0,sharedConfigKey.T)("accept"),runAllValidators)),this.addSub(this._ctx.sub((0,sharedConfigKey.T)("validationConcurrency"),concurrency=>{this._queue.concurrency=concurrency}))}runFileValidators(runOn,entryIds){if(!this._isDestroyed)for(let id of entryIds??this._uploadCollection.items()){let entry=this._uploadCollection.read(id);entry&&this._runFileValidatorsForEntry(entry,runOn)}}runCollectionValidators(){if(this._isDestroyed)return;let api=this._sharedInstancesBag.api,collection=api.getOutputCollectionState(),errors=[],collectionValidators=this._cfg.collectionValidators;for(let validator of[...this._commonCollectionValidators,...collectionValidators])try{let error=validator(collection,api);if(!error)continue;error&&(errors.push(this._addCustomTypeToValidationError(error)),error.message||console.warn(LOG_TEXT_MISSING_ERROR_MESSAGE))}catch(error){console.warn("Collection validator execution has failed",error)}this._ctx.pub("*collectionErrors",errors),errors.length>0&&this._sharedInstancesBag.eventEmitter.emit(EventEmitter.Bx.COMMON_UPLOAD_FAILED,()=>api.getOutputCollectionState(),{debounce:!0})}cleanupValidationForEntry(entry){let state=this._entryValidationState.get(entry.uid);state&&(state.abortController?.abort(),this._entryValidationState.delete(entry.uid))}async _runFileValidatorsForEntry(entry,runOn){if(this._isDestroyed)return;let api=this._sharedInstancesBag.api,state=this._getEntryValidationState(entry),previousPromise=state.promise??Promise.resolve(),runPromise=(async()=>{if(this._isDestroyed||(await previousPromise,this._isDestroyed))return;let entryDescriptors=this._getValidatorDescriptorsForEntry(entry,runOn);if(0===entryDescriptors.length||!this._uploadCollection.hasItem(entry.uid))return;entry.setMultipleValues({isQueuedForValidation:!0,isValidationPending:!0});let outputEntry=api.getOutputItem(entry.uid),abortController=new AbortController;state.abortController=abortController;let timeoutMs=this._cfg.validationTimeout,allDescriptors=this._getValidatorDescriptors(),entryValidatorSet=new Set(entryDescriptors.map(d=>d.validator)),errors=[];for(let descriptor of allDescriptors)if(!entryValidatorSet.has(descriptor.validator)){let error=state.lastErrorThrownByValidator.get(descriptor.validator);error&&errors.push(error)}let tasks=entryDescriptors.map(validatorDescriptor=>async()=>{if(this._isDestroyed)return;let timeoutId=setTimeout(()=>{state.skippedValidators.add(validatorDescriptor.validator),abortController.abort(),console.warn("File validator execution has timed out")},timeoutMs);try{let error=await validatorDescriptor.validator(outputEntry,api,{signal:abortController.signal});if(!error||abortController.signal.aborted)return void state.lastErrorThrownByValidator.set(validatorDescriptor.validator,void 0);let normalizedError=this._addCustomTypeToValidationError(error);state.lastErrorThrownByValidator.set(validatorDescriptor.validator,normalizedError),errors.push(normalizedError),error.message||console.warn(LOG_TEXT_MISSING_ERROR_MESSAGE)}catch(error){abortController.signal.aborted||(state.skippedValidators.add(validatorDescriptor.validator),console.warn(LOG_TEXT_FILE_VALIDATION_FAILED,error),this._sharedInstancesBag.telemetryManager.sendEventError(error,`file validator. ${LOG_TEXT_FILE_VALIDATION_FAILED}`))}finally{clearTimeout(timeoutId),"change"!==validatorDescriptor.runOn&&state.skippedValidators.add(validatorDescriptor.validator)}});(this._runQueueDebounced(),await this._queue.add(async()=>{this._isDestroyed||(entry.setValue("isQueuedForValidation",!1),await Promise.all(tasks.map(task=>task())).catch(()=>{}))},{autoRun:!1}),abortController.signal.aborted)?entry.setMultipleValues({isQueuedForValidation:!1,isValidationPending:!1}):entry.setMultipleValues({isValidationPending:!1,isQueuedForValidation:!1,errors})})();state.promise=runPromise;try{await runPromise}finally{state.promise===runPromise&&(state.promise=void 0)}}_addCustomTypeToValidationError(error){return{...error,type:error.type??"CUSTOM_ERROR"}}_getEntryValidationState(entry){let currentState=this._entryValidationState.get(entry.uid);if(currentState)return currentState;let newState={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this._entryValidationState.set(entry.uid,newState),newState}_getValidatorDescriptors(){let fileValidators=this._cfg.fileValidators;return[...this._commonFileValidators,...fileValidators].map(getValidatorDescriptor)}_getValidatorDescriptorsForEntry(entry,runOn){let state=this._getEntryValidationState(entry);return this._getValidatorDescriptors().filter(descriptor=>!state.skippedValidators.has(descriptor.validator)).filter(descriptor=>descriptor.runOn===runOn)}destroy(){for(let state of(this._isDestroyed=!0,this._runQueueDebounced.cancel(),this._entryValidationState.values()))state.abortController?.abort(),state.promise=void 0;this._entryValidationState.clear()}}var PubSubCompat=__webpack_require__(8594),UID=__webpack_require__(5446);let MSG_NAME="[Typed State] Wrong property name: ";class TypedData{constructor(initialValue){this._ctxId=UID.V.generateFastUid(),this._data=PubSubCompat.G.registerCtx(initialValue,this._ctxId)}get uid(){return this._ctxId}setValue(prop,value){this._data.has(prop)?this._data.read(prop)!==value&&this._data.pub(prop,value):console.warn(`${MSG_NAME}${String(prop)}`)}setMultipleValues(updObj){for(let[prop,value]of Object.entries(updObj))this.setValue(prop,value)}getValue(prop){return this._data.has(prop)||console.warn(`${MSG_NAME}${String(prop)}`),this._data.read(prop)}subscribe(prop,handler){return this._data.sub(prop,handler)}destroy(){PubSubCompat.G.deleteCtx(this._ctxId)}}class TypedCollection{static{this._destroyDelayMs=1e4}constructor(options){this._subsMap=Object.create(null),this._propertyObservers=new Set,this._collectionObservers=new Set,this._items=new Set,this._removed=new Set,this._added=new Set,this._markedToDestroy=new Set,this._initialValue=options.initialValue,this._ctxId=UID.V.generateFastUid(),this._data=PubSubCompat.G.registerCtx({},this._ctxId),this._watchList=options.watchList||[];let changeMap=Object.create(null);this._notifyObservers=(propName,ctxId)=>{this._observeTimeout&&window.clearTimeout(this._observeTimeout),changeMap[propName]||(changeMap[propName]=new Set),changeMap[propName].add(ctxId),this._observeTimeout=window.setTimeout(()=>{0!==Object.keys(changeMap).length&&(this._propertyObservers.forEach(handler=>{handler({...changeMap})}),changeMap=Object.create(null))}),this._scheduleDestroyMarkedItems()},options.handler&&this.observeCollection(options.handler)}_notify(){this._notifyTimeout&&window.clearTimeout(this._notifyTimeout),this._notifyTimeout=window.setTimeout(()=>{let added=new Set(this._added),removed=new Set(this._removed);for(let handler of(this._added.clear(),this._removed.clear(),this._collectionObservers))handler?.([...this._items],added,removed);this._scheduleDestroyMarkedItems()})}_scheduleDestroyMarkedItems(){0!==this._markedToDestroy.size&&(this._destroyTimeout&&window.clearTimeout(this._destroyTimeout),this._destroyTimeout=window.setTimeout(()=>{let marked=[...this._markedToDestroy];for(let item of(this._markedToDestroy.clear(),marked))item.destroy()},TypedCollection._destroyDelayMs))}observeCollection(handler){return this._collectionObservers.add(handler),this._items.size>0&&this._notify(),()=>{this.unobserveCollection(handler)}}unobserveCollection(handler){this._collectionObservers.delete(handler)}add(init){let item=new TypedData(this._initialValue);for(let[prop,value]of Object.entries(init))item.setValue(prop,value);return this._items.add(item.uid),this._notify(),this._data.add(item.uid,item),this._added.add(item),this._watchList.forEach(propName=>{this._subsMap[item.uid]||(this._subsMap[item.uid]=[]),this._subsMap[item.uid]?.push(item.subscribe(propName,()=>{this._notifyObservers(propName,item.uid)}))}),item.uid}hasItem(id){return this._items.has(id)}read(id){return this._data.read(id)??null}readProp(id,propName){let item=this.read(id);if(!item)throw Error(`TypedCollection#readProp: Item with id ${id} not found`);return item.getValue(propName)}publishProp(id,propName,value){let item=this.read(id);if(!item)throw Error(`TypedCollection#publishProp: Item with id ${id} not found`);item.setValue(propName,value)}remove(id){let item=this.read(id);item&&(this._removed.add(item),this._markedToDestroy.add(item)),this._items.delete(id),this._notify(),this._data.pub(id,void 0),this._subsMap[id]?.forEach(sub=>{sub()}),delete this._subsMap[id]}clearAll(){this._items.forEach(id=>{this.remove(id)})}observeProperties(handler){return this._propertyObservers.add(handler),()=>{this.unobserveProperties(handler)}}unobserveProperties(handler){this._propertyObservers.delete(handler)}findItems(checkFn){let result=[];return this._items.forEach(id=>{let item=this.read(id);item&&checkFn(item)&&result.push(id)}),result}items(){return[...this._items]}get size(){return this._items.size}destroy(){for(let item of(this._observeTimeout&&window.clearTimeout(this._observeTimeout),this._notifyTimeout&&window.clearTimeout(this._notifyTimeout),this._destroyTimeout&&window.clearTimeout(this._destroyTimeout),this._markedToDestroy))item.destroy();for(let id of(this._markedToDestroy.clear(),PubSubCompat.G.deleteCtx(this._ctxId),this._propertyObservers=new Set,this._collectionObservers=new Set,Object.keys(this._subsMap)))this._subsMap[id]?.forEach(sub=>{sub()}),delete this._subsMap[id]}}var comma_separated=__webpack_require__(9101),constants=__webpack_require__(5973);let calcCameraModes=cfg=>({isVideoRecordingEnabled:(0,comma_separated.A)(cfg.cameraModes).includes(constants.S.VIDEO),isPhotoEnabled:(0,comma_separated.A)(cfg.cameraModes).includes(constants.S.PHOTO)});var activity_constants=__webpack_require__(7715);let findBlockInCtx=(blocksRegistry,callback)=>{for(let block of blocksRegistry)if(callback(block))return block};var l10n=__webpack_require__(263),applyStyles=__webpack_require__(3254),initialConfig=__webpack_require__(318);let cdnUrlRegex=RegExp(`^/?(${/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i");var UploadSource=__webpack_require__(5730);let getOutputData=bag=>bag.uploadCollection.items().map(itemId=>bag.api.getOutputItem(itemId));var warnOnce=__webpack_require__(6783);class UploaderPublicApi extends shared_instances.jM{get _uploadCollection(){return this._sharedInstancesBag.uploadCollection}get cfg(){return this._cfg}get l10n(){return this._l10n}removeAllFiles(){this._uploadCollection.clearAll()}getOutputItem(entryId){let ctx=PubSubCompat.G.getCtx(entryId);if(!ctx)throw Error(`UploaderPublicApi#getOutputItem: Entry with ID "${entryId}" not found in the upload collection`);let uploadEntryData=ctx.store,fileInfo=uploadEntryData.fileInfo,status=uploadEntryData.isRemoved?"removed":uploadEntryData.errors.length>0?"failed":uploadEntryData.fileInfo?"success":uploadEntryData.isUploading?"uploading":"idle";return{uuid:fileInfo?.uuid??uploadEntryData.uuid??null,internalId:entryId,name:fileInfo?.originalFilename??uploadEntryData.fileName,size:fileInfo?.size??uploadEntryData.fileSize,isImage:fileInfo?.isImage??uploadEntryData.isImage,mimeType:fileInfo?.mimeType??uploadEntryData.mimeType,file:uploadEntryData.file,externalUrl:uploadEntryData.externalUrl,cdnUrlModifiers:uploadEntryData.cdnUrlModifiers,cdnUrl:uploadEntryData.cdnUrl??fileInfo?.cdnUrl??null,fullPath:uploadEntryData.fullPath,uploadProgress:uploadEntryData.uploadProgress,fileInfo:fileInfo??null,metadata:uploadEntryData.metadata??fileInfo?.metadata??null,isSuccess:"success"===status,isUploading:"uploading"===status,isFailed:"failed"===status,isRemoved:"removed"===status,isValidationPending:uploadEntryData.isValidationPending,errors:uploadEntryData.errors,status,source:uploadEntryData?.source}}getOutputCollectionState(){return function(bag){let isAsync,state={},ctx=bag.ctx,withAssert=(isAsync=!1,setTimeout(()=>{isAsync=!0},0),fn=>(...args)=>(isAsync&&(0,warnOnce.m)("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`"),fn(...args)));for(let[key,value]of Object.entries({progress:()=>ctx.read("*commonProgress"),errors:()=>ctx.read("*collectionErrors"),group:()=>ctx.read("*groupInfo"),totalCount:()=>bag.uploadCollection.size,failedCount:()=>state.failedEntries.length,successCount:()=>state.successEntries.length,uploadingCount:()=>state.uploadingEntries.length,status:()=>state.isFailed?"failed":state.isUploading?"uploading":state.isSuccess?"success":"idle",isSuccess:()=>state.allEntries.length>0&&0===state.errors.length&&state.successEntries.length===state.allEntries.length,isUploading:()=>state.allEntries.some(entry=>"uploading"===entry.status),isFailed:()=>state.errors.length>0||state.failedEntries.length>0,allEntries:()=>getOutputData(bag),successEntries:()=>state.allEntries.filter(entry=>"success"===entry.status),failedEntries:()=>state.allEntries.filter(entry=>"failed"===entry.status),uploadingEntries:()=>state.allEntries.filter(entry=>"uploading"===entry.status),idleEntries:()=>state.allEntries.filter(entry=>"idle"===entry.status)}))Object.defineProperty(state,key,{get:function(fn){let cache=new Map;return(...args)=>{let key=JSON.stringify(args);if(cache.has(key))return cache.get(key);let result=fn(...args);return cache.set(key,result),result}}(withAssert(value)),enumerable:!0});return state}(this._sharedInstancesBag)}get _sourceList(){let list=[];return this.cfg.sourceList&&(list=(0,stringToArray.G)(this.cfg.sourceList)),list}constructor(...args){super(...args),this._l10n=(0,l10n.k)(()=>this._ctx),this.addFileFromUrl=(url,{silent,fileName,source}={})=>{let internalId=this._uploadCollection.add({externalUrl:url,fileName:fileName??null,silent:silent??!1,source:source??UploadSource.pc.API});return this.getOutputItem(internalId)},this.addFileFromUuid=(uuid,{silent,fileName,source}={})=>{let internalId=this._uploadCollection.add({uuid,fileName:fileName??null,silent:silent??!1,source:source??UploadSource.pc.API});return this.getOutputItem(internalId)},this.addFileFromCdnUrl=(cdnUrl,{silent,fileName,source}={})=>{let parsedCdnUrl=(({url,cdnBase})=>{let cdnBaseUrlObj=new URL(cdnBase),fallbackCdnBaseUrlObj=new URL(initialConfig.Tw),urlObj=new URL(url);if(cdnBaseUrlObj.host!==urlObj.host&&fallbackCdnBaseUrlObj.host!==urlObj.host)return null;let match=cdnUrlRegex.exec(urlObj.pathname);if(!match)return null;let[,uuid,cdnUrlModifiers,filename]=match;return uuid?{uuid,cdnUrlModifiers:cdnUrlModifiers||"",filename:filename||null}:null})({url:cdnUrl,cdnBase:this.cfg.cdnCname});if(!parsedCdnUrl)throw Error("Invalid CDN URL");let internalId=this._uploadCollection.add({uuid:parsedCdnUrl.uuid,cdnUrl,cdnUrlModifiers:parsedCdnUrl.cdnUrlModifiers,fileName:fileName??parsedCdnUrl.filename??null,silent:silent??!1,source:source??UploadSource.pc.API});return this.getOutputItem(internalId)},this.addFileFromObject=(file,{silent,fileName,source,fullPath}={})=>{let type,internalId=this._uploadCollection.add({file,isImage:!!(type=file?.type)&&matchMimeType(type,IMAGE_ACCEPT_LIST),mimeType:file.type,fileName:fileName??file.name,fileSize:file.size,silent:silent??!1,source:source??UploadSource.pc.API,fullPath:fullPath??null});return this.getOutputItem(internalId)},this.removeFileByInternalId=internalId=>{if(!this._uploadCollection.read(internalId))throw Error(`File with internalId ${internalId} not found`);this._uploadCollection.remove(internalId)},this.uploadAll=()=>{let itemsToUpload=this._uploadCollection.items().filter(id=>{let entry=this._uploadCollection.read(id);return!!entry&&!entry.getValue("isRemoved")&&!entry.getValue("isUploading")&&!entry.getValue("fileInfo")&&0===entry.getValue("errors").length&&!entry.getValue("isValidationPending")&&!entry.getValue("isQueuedForValidation")});0!==itemsToUpload.length&&(this._ctx.pub("*uploadTrigger",new Set(itemsToUpload)),this._sharedInstancesBag.eventEmitter.emit(EventEmitter.Bx.COMMON_UPLOAD_START,this.getOutputCollectionState()))},this.openSystemDialog=(options={})=>{let accept=(0,comma_separated.L)(mergeFileTypes([this.cfg.accept??"",...this.cfg.imgOnly?IMAGE_ACCEPT_LIST:[]])),INPUT_ATTR_NAME="uploadcare-file-input",fileInput=document.createElement("input");if(fileInput.setAttribute(INPUT_ATTR_NAME,""),(0,applyStyles.Z)(fileInput,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),fileInput.type="file",fileInput.multiple=this.cfg.multiple,options.captureCamera){fileInput.capture=this.cfg.cameraCapture;let{isPhotoEnabled,isVideoRecordingEnabled}=calcCameraModes(this.cfg);options.modeCamera===constants.S.PHOTO&&isPhotoEnabled?fileInput.accept=BASIC_IMAGE_WILDCARD:options.modeCamera===constants.S.VIDEO&&isVideoRecordingEnabled?fileInput.accept=BASIC_VIDEO_WILDCARD:fileInput.accept=[BASIC_IMAGE_WILDCARD,isVideoRecordingEnabled&&BASIC_VIDEO_WILDCARD].filter(Boolean).join(",")}else fileInput.accept=accept;fileInput.addEventListener("change",()=>{fileInput.files&&([...fileInput.files].forEach(file=>{this.addFileFromObject(file,{source:options.captureCamera?UploadSource.pc.CAMERA:UploadSource.pc.LOCAL})}),this._ctx.pub("*currentActivity",activity_constants.g.UPLOAD_LIST),this._sharedInstancesBag.modalManager?.open(activity_constants.g.UPLOAD_LIST),fileInput.remove())},{once:!0}),document.querySelectorAll(`[${INPUT_ATTR_NAME}]`).forEach(el=>{el.remove()}),document.body.appendChild(fileInput),fileInput.dispatchEvent(new MouseEvent("click"))},this.initFlow=(force=!1)=>{if(this._uploadCollection.size>0&&!force)this._ctx.pub("*currentActivity",activity_constants.g.UPLOAD_LIST),this._sharedInstancesBag.modalManager?.open(activity_constants.g.UPLOAD_LIST);else if(this._sourceList?.length===1){let srcKey=this._sourceList[0];if("local"===srcKey){this._ctx.pub("*currentActivity",activity_constants.g.UPLOAD_LIST),this.openSystemDialog();return}if("camera"===srcKey&&browser_info.wN.htmlMediaCapture){let{isPhotoEnabled,isVideoRecordingEnabled}=calcCameraModes(this.cfg);if(isPhotoEnabled&&isVideoRecordingEnabled)return void this._ctx.pub("*currentActivity",activity_constants.g.START_FROM);if(isPhotoEnabled||isVideoRecordingEnabled)return void this.openSystemDialog({captureCamera:!0,modeCamera:isPhotoEnabled?constants.S.PHOTO:constants.S.VIDEO});this.openSystemDialog({captureCamera:!0,modeCamera:constants.S.PHOTO})}setTimeout(()=>{if(srcKey!==this._sourceList[0])return;let sourceBtnBlock=findBlockInCtx(this._sharedInstancesBag.blocksRegistry,block=>"type"in block&&block.type===srcKey);sourceBtnBlock?.activate()},0),this._ctx.read("*currentActivity")&&this._sharedInstancesBag.modalManager?.open(this._ctx.read("*currentActivity"))}else this._ctx.pub("*currentActivity",activity_constants.g.START_FROM),this._sharedInstancesBag.modalManager?.open(activity_constants.g.START_FROM)},this.doneFlow=()=>{let activityBlock=findBlockInCtx(this._sharedInstancesBag.blocksRegistry,b=>"doneActivity"in b);activityBlock&&(this._ctx.pub("*currentActivity",activityBlock.doneActivity),this._ctx.pub("*history",activityBlock.doneActivity?[activityBlock.doneActivity]:[]),this._ctx.read("*currentActivity")||this._sharedInstancesBag.modalManager?.closeAll())},this.setCurrentActivity=(activityType,...params)=>{setTimeout(()=>{if(((blocksRegistry,callback)=>{for(let block of blocksRegistry)if(callback(block))return!0;return!1})(this._sharedInstancesBag.blocksRegistry,b=>b.activityType===activityType)){this._ctx.pub("*currentActivityParams",params[0]??{}),this._ctx.pub("*currentActivity",activityType);return}console.warn(`Activity type "${activityType}" not found in the context`)})},this.getCurrentActivity=()=>this._ctx.read("*currentActivity"),this.setModalState=opened=>{setTimeout(()=>{opened&&!this._ctx.read("*currentActivity")?console.warn('Can\'t open modal without current activity. Please use "setCurrentActivity" method first.'):opened?this._sharedInstancesBag.modalManager?.open(this._ctx.read("*currentActivity")):(this._sharedInstancesBag.modalManager?.close(this._ctx.read("*currentActivity")),this._ctx.pub("*currentActivity",null))})}}}let initialUploadEntryData={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:!1,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:!1,abortController:null,thumbUrl:null,silent:!1,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:!1,isQueuedForUploading:!1,isValidationPending:!1,isQueuedForValidation:!1};var crop_utils=__webpack_require__(8996),parseCropPreset=__webpack_require__(5342),cdn_utils=__webpack_require__(6339),env=__webpack_require__(5704);function customUserAgent(options){return(0,upload_client_.getUserAgent)({...options,libraryName:env.r,libraryVersion:env.i})}var LitActivityBlock=__webpack_require__(5923);class LitUploaderBlock extends LitActivityBlock.S{get _hasCtxOwner(){return this.hasBlockInCtx(block=>block instanceof LitUploaderBlock&&block._isCtxOwner&&block.isConnected&&block!==this)}initCallback(){super.initCallback(),this._addSharedContextInstance("*uploadCollection",()=>new TypedCollection({initialValue:initialUploadEntryData,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this._addSharedContextInstance("*secureUploadsManager",sharedInstancesBag=>new SecureUploadsManager(sharedInstancesBag)),this._addSharedContextInstance("*validationManager",sharedInstancesBag=>new ValidationManager(sharedInstancesBag)),this._addSharedContextInstance("*publicApi",sharedInstancesBag=>new UploaderPublicApi(sharedInstancesBag)),!this._hasCtxOwner&&this.couldBeCtxOwner&&this._initCtxOwner()}getAPI(){return this.api}get validationManager(){return this._getSharedContextInstance("*validationManager")}get api(){return this._getSharedContextInstance("*publicApi")}get uploadCollection(){return this._getSharedContextInstance("*uploadCollection")}get secureUploadsManager(){return this._getSharedContextInstance("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this._isCtxOwner&&this._unobserveUploadCollection(),this._flushOutputItems.cancel()}connectedCallback(){super.connectedCallback(),this._isCtxOwner&&this._observeUploadCollection()}_initCtxOwner(){this._isCtxOwner=!0,this._observeUploadCollection(),this.subConfigValue("maxConcurrentRequests",value=>{this.$["*uploadQueue"].concurrency=Number(value)||1})}_observeUploadCollection(){this._unobserveUploadCollection(),this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate)}_unobserveUploadCollection(){this._unobserveCollectionProperties?.(),this._unobserveCollection?.(),this._unobserveCollectionProperties=void 0,this._unobserveCollection=void 0}async _createGroup(collectionState){let uploadClientOptions=await this.getUploadClientOptions(),uuidList=collectionState.allEntries.map(entry=>entry.uuid+(entry.cdnUrlModifiers?`/${entry.cdnUrlModifiers}`:"")),abortController=new AbortController,resp=await (0,upload_client_.uploadFileGroup)(uuidList,{...uploadClientOptions,signal:abortController.signal});if(this.$["*collectionState"]!==collectionState)return void abortController.abort();this.$["*groupInfo"]=resp;let collectionStateWithGroup=this.api.getOutputCollectionState();this.emit(EventEmitter.Bx.GROUP_CREATED,collectionStateWithGroup),this.emit(EventEmitter.Bx.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=collectionStateWithGroup}_openCloudImageEditor(){let[entry]=this.uploadCollection.findItems(entry=>!!entry.getValue("fileInfo")&&entry.getValue("isImage")).map(id=>this.uploadCollection.read(id));entry&&1===this.uploadCollection.size&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(block=>block.activityType===LitActivityBlock.S.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:entry.uid},this.$["*currentActivity"]=LitActivityBlock.S.activities.CLOUD_IMG_EDIT,this.modalManager?.open(LitActivityBlock.S.activities.CLOUD_IMG_EDIT))}_setInitialCrop(){let cropPreset=(0,parseCropPreset.j)(this.cfg.cropPreset);if(cropPreset){let[aspectRatioPreset]=cropPreset;for(let entry of this.uploadCollection.findItems(entry=>!!entry.getValue("fileInfo")&&entry.getValue("isImage")&&!entry.getValue("cdnUrlModifiers")?.includes("/crop/")).map(id=>this.uploadCollection.read(id)).filter(Boolean)){let fileInfo=entry.getValue("fileInfo");if(!fileInfo||!fileInfo.imageInfo){console.warn("Failed to get image info for entry",entry.uid);continue}let{width,height}=fileInfo.imageInfo,expectedAspectRatio="number"==typeof aspectRatioPreset?.width&&"number"==typeof aspectRatioPreset?.height&&aspectRatioPreset.width>0&&aspectRatioPreset.height>0?aspectRatioPreset.width/aspectRatioPreset.height:1,crop=(0,crop_utils.u3)(width,height,expectedAspectRatio),cdnUrlModifiers=(0,cdn_utils.$z)(`crop/${crop.width}x${crop.height}/${crop.x},${crop.y}`,"preview"),cdnUrl=entry.getValue("cdnUrl");if(!cdnUrl){console.warn("Failed to get cdnUrl for entry",entry.uid);continue}entry.setMultipleValues({cdnUrlModifiers,cdnUrl:(0,cdn_utils.LN)(cdnUrl,cdnUrlModifiers)}),1===this.uploadCollection.size&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(block=>block.activityType===LitActivityBlock.S.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:entry.uid},this.$["*currentActivity"]=LitActivityBlock.S.activities.CLOUD_IMG_EDIT,this.modalManager?.open(LitActivityBlock.S.activities.CLOUD_IMG_EDIT))}}}async getMetadataFor(entryId){let configValue=this.cfg.metadata||void 0;if("function"==typeof configValue){let outputFileEntry=this.api.getOutputItem(entryId);return await configValue(outputFileEntry)}return configValue}async getUploadClientOptions(){let secureToken=await this.secureUploadsManager.getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:customUserAgent,integration:this.cfg.userAgentIntegration,secureSignature:secureToken?.secureSignature,secureExpire:secureToken?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return getOutputData(this._sharedInstancesBag)}constructor(...args){super(...args),this.couldBeCtxOwner=!1,this._isCtxOwner=!1,this.init$=(0,CTX.lu)(this),this._flushOutputItems=(0,debounce.s)(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let collectionState=this.api.getOutputCollectionState();this.$["*collectionState"]=collectionState,this.emit(EventEmitter.Bx.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&collectionState.totalCount>0&&"success"===collectionState.status&&this._createGroup(collectionState)},300),this._handleCollectionUpdate=(entries,added,removed)=>{if(this.isConnected){for(let entry of((added.size||removed.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...added].map(e=>e.uid)),added))entry.getValue("silent")||this.emit(EventEmitter.Bx.FILE_ADDED,this.api.getOutputItem(entry.uid));for(let entry of(this.validationManager.runCollectionValidators(),removed)){this.$["*uploadTrigger"].delete(entry.uid),this.validationManager.cleanupValidationForEntry(entry),entry.getValue("abortController")?.abort(),entry.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0});let thumbUrl=entry?.getValue("thumbUrl");thumbUrl&&URL.revokeObjectURL(thumbUrl),this.emit(EventEmitter.Bx.FILE_REMOVED,this.api.getOutputItem(entry.uid))}this.$["*uploadList"]=entries.map(uid=>({uid})),this._flushCommonUploadProgress(),this._flushOutputItems()}},this._handleCollectionPropertiesUpdate=changeMap=>{if(!this.isConnected)return;this._flushOutputItems();let uploadCollection=this.uploadCollection,entriesToRunValidation=[...new Set(Object.entries(changeMap).filter(([key])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(key)).flatMap(([,ids])=>[...ids]))];if(entriesToRunValidation.length>0&&setTimeout(()=>{if(!this.isConnected)return;let entriesToRunOnUpload=entriesToRunValidation.filter(entryId=>changeMap.fileInfo?.has(entryId)&&!!PubSubCompat.G.getCtx(entryId)?.store.fileInfo);entriesToRunOnUpload.length>0&&this.validationManager.runFileValidators("upload",entriesToRunOnUpload),this.validationManager.runFileValidators("change",entriesToRunValidation)}),changeMap.uploadProgress){for(let entryId of changeMap.uploadProgress){let ctx=PubSubCompat.G.getCtx(entryId);if(!ctx)continue;let{isUploading,silent}=ctx.store;isUploading&&!silent&&this.emit(EventEmitter.Bx.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(entryId))}this._flushCommonUploadProgress()}if(changeMap.isUploading)for(let entryId of changeMap.isUploading){let ctx=PubSubCompat.G.getCtx(entryId);if(!ctx)continue;let{isUploading,silent}=ctx.store;isUploading&&!silent&&this.emit(EventEmitter.Bx.FILE_UPLOAD_START,this.api.getOutputItem(entryId))}if(changeMap.fileInfo){for(let entryId of changeMap.fileInfo){let ctx=PubSubCompat.G.getCtx(entryId);if(!ctx)continue;let{fileInfo,silent}=ctx.store;fileInfo&&!silent&&this.emit(EventEmitter.Bx.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(entryId))}this.cfg.cropPreset&&this._setInitialCrop(),this.cfg.cloudImageEditorAutoOpen&&this._openCloudImageEditor()}if(changeMap.errors){for(let entryId of(this.validationManager.runCollectionValidators(),changeMap.errors)){let ctx=PubSubCompat.G.getCtx(entryId);if(!ctx)continue;let{errors}=ctx.store;errors.length>0&&(this.emit(EventEmitter.Bx.FILE_UPLOAD_FAILED,this.api.getOutputItem(entryId)),this.emit(EventEmitter.Bx.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let loadedItems=uploadCollection.findItems(entry=>!!entry.getValue("fileInfo")),errorItems=uploadCollection.findItems(entry=>entry.getValue("errors").length>0);uploadCollection.size>0&&0===errorItems.length&&uploadCollection.size===loadedItems.length&&0===this.$["*collectionErrors"].length&&this.emit(EventEmitter.Bx.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}changeMap.cdnUrl&&([...changeMap.cdnUrl].filter(uid=>!!this.uploadCollection.read(uid)?.getValue("cdnUrl")).forEach(uid=>{this.emit(EventEmitter.Bx.FILE_URL_CHANGED,this.api.getOutputItem(uid))}),this.$["*groupInfo"]=null)},this._flushCommonUploadProgress=()=>{let commonProgress=0,items=[...this.$["*uploadTrigger"]].filter(id=>!!this.uploadCollection.read(id));items.forEach(id=>{let uploadProgress=this.uploadCollection.readProp(id,"uploadProgress");"number"==typeof uploadProgress&&(commonProgress+=uploadProgress)});let progress=items.length?Math.round(commonProgress/items.length):0;this.$["*commonProgress"]!==progress&&(this.$["*commonProgress"]=progress,this.emit(EventEmitter.Bx.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))}}}LitUploaderBlock.extSrcList=Object.freeze({...UploadSource.y5}),LitUploaderBlock.sourceTypes=Object.freeze({...UploadSource.pc})},8594(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{G:()=>PubSub});class PubSub{static{this._contexts=new Map}constructor(_ctxId,store){this._ctxId=_ctxId,this._store=store}get id(){return this._ctxId}pub(key,value){key in this._store.get()||console.warn(`PubSub#pub: Key "${String(key)}" not found`),this._store.setKey(key,value)}sub(key,callback,init=!0){return(init?__rspack_external_nanostores.subscribeKeys:__rspack_external_nanostores.listenKeys)(this._store,[key],values=>{callback(values[key])})}read(key){return key in this._store.get()||console.warn(`PubSub#read: Key "${String(key)}" not found`),this._store.get()[key]}add(key,value,rewrite=!1){key in this._store.get()&&!rewrite||this._store.setKey(key,value)}has(key){return key in this._store.get()}get store(){return this._store.get()}static registerCtx(initialValue,ctxId){if(PubSub._contexts.has(ctxId))throw Error(`PubSub: Context with id "${ctxId}" already exists`);let store=(0,__rspack_external_nanostores.map)(initialValue);return PubSub._contexts.set(ctxId,store),new PubSub(ctxId,store)}static deleteCtx(ctxId){PubSub._contexts.delete(ctxId)}static getCtx(ctxId){let store=PubSub._contexts.get(ctxId);return store?new PubSub(ctxId,store):null}static hasCtx(ctxId){return PubSub._contexts.has(ctxId)}}},3282(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{d:()=>RegisterableElementMixin});function RegisterableElementMixin(ctor){return class extends ctor{static reg(tagName){let registeredClass=window.customElements.get(tagName);if(registeredClass){registeredClass!==this&&console.warn(`Element with tag name "${tagName}" already registered.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
New element will not be registered.`);return}window.customElements.define(tagName,this)}}}},9280(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{w:()=>SymbioteMixin});var decorators_js_=__webpack_require__(8899),debounce=__webpack_require__(4441),PubSubCompat=__webpack_require__(8594);function _ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}let ctxNameContext=(0,__rspack_external__lit_context_417c9377.createContext)("ctx-name-context");function SymbioteMixin(){return function(ctor){class SymbioteMixinClass extends ctor{static set template(_value){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.")}get _ctxNameAttr(){return this._ctxNameAttrValue}set _ctxNameAttr(value){let normalizedValue=value??void 0;this._ctxNameAttrValue!==normalizedValue&&(this._ctxNameAttrValue=normalizedValue,this._handleCtxNameSourceChange())}shouldUpdate(changedProperties){return!!this._isInitialized&&super.shouldUpdate(changedProperties)}constructor(...args){super(...args),this._symbioteSharedPubSub=null,this._symbioteFirstUpdated=!1,this._needsReconnectInit=!1,this._ctxNameProvider=void 0,this._pendingSharedAdds=new Map,this._symbioteSubscriptions=new Set,this.init$={},this.ctxOwner=!1,this._ctxNameAttrValue=void 0,this._pendingCtxInitOnConnect=!1,this.ctxName=this._effectiveCtxName,this._isInitialized=!1,this._ctxNameAttrValue=this.getAttribute("ctx-name")||void 0,this.ctxName=this._effectiveCtxName,this._ctxNameConsumer=new __rspack_external__lit_context_417c9377.ContextConsumer(this,{context:ctxNameContext,callback:value=>{value?(this._ctxNameFromContext=value,this._handleCtxNameSourceChange()):console.error("SymbioteMixin: Received invalid ctx-name from context")},subscribe:!0})}get _effectiveCtxName(){return this._ctxNameAttr||this._ctxNameFromContext||void 0}_handleCtxNameSourceChange(){if(this.ctxName=this._effectiveCtxName,this.ctxName&&!this._symbioteFirstUpdated){if(this.isConnected)return void this._performInitialization();this._pendingCtxInitOnConnect=!0}}willUpdate(changedProperties){super.willUpdate(changedProperties),this.ctxName=this._effectiveCtxName,this.ctxName&&(this._ctxNameProvider?this._ctxNameProvider.setValue(this.ctxName):this._ctxNameProvider=new __rspack_external__lit_context_417c9377.ContextProvider(this,{context:ctxNameContext,initialValue:this.ctxName}))}_applyPendingSharedAdds(){if(this._symbioteSharedPubSub&&0!==this._pendingSharedAdds.size){for(let[key,{value,rewrite}]of this._pendingSharedAdds)this._symbioteSharedPubSub.add(key,value,rewrite);this._pendingSharedAdds.clear()}}_getSharedPubSub(){return!this._symbioteSharedPubSub&&this._effectiveCtxName&&this._initSharedContext(),this._symbioteSharedPubSub&&this._applyPendingSharedAdds(),this._symbioteSharedPubSub}_requireSharedPubSub(){let pubsub=this._getSharedPubSub();if(!pubsub)throw Error("SymbioteMixin: Shared context is not initialized.");return pubsub}_initSharedContext(){let initialValue=this.init$,ctxName=this._effectiveCtxName;if(!ctxName)return void console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");if(!this._symbioteSharedPubSub){for(let[key,defaultValue]of(this._symbioteSharedPubSub=PubSubCompat.G.getCtx(ctxName)??PubSubCompat.G.registerCtx(initialValue,ctxName),Object.entries(this.init$)))this._symbioteSharedPubSub.add(key,defaultValue,this.ctxOwner);this._applyPendingSharedAdds()}}get $(){return this._effectiveCtxName&&this._initSharedContext(),new Proxy({},{get:(_target,key)=>{if("string"==typeof key)return this._symbioteSharedPubSub?.read(key)},set:(_target,key,value)=>"string"!=typeof key||(this._symbioteSharedPubSub?.pub(key,value),!0)})}sub(key,callback,init=!0){let subscription=this._requireSharedPubSub().sub(key,callback,init);if(!subscription||"function"!=typeof subscription)return()=>{};let removeFn=subscription.bind(subscription),removed=!1,trackedRemove=()=>{removed||(removed=!0,removeFn(),this._symbioteSubscriptions.delete(trackedRemove))};return this._symbioteSubscriptions.add(trackedRemove),trackedRemove}pub(key,value){this._requireSharedPubSub().pub(key,value)}set$(obj){for(let[prop,value]of Object.entries(obj))this.pub(prop,value)}get sharedCtx(){return this._requireSharedPubSub()}has(key){return this._symbioteSharedPubSub?.has(key)??!1}add(key,val,rewrite=!1){let pubsub=this._getSharedPubSub();if(!pubsub){if(!rewrite&&this._pendingSharedAdds.has(key))return;this._pendingSharedAdds.set(key,{value:val,rewrite});return}this._pendingSharedAdds.delete(key),pubsub.add(key,val,rewrite)}add$(obj,rewrite=!1){for(let[prop,value]of Object.entries(obj))this.add(prop,value,rewrite)}connectedCallback(){super.connectedCallback(),this._symbioteFirstUpdated?this._isInitialized&&this._needsReconnectInit&&(this._needsReconnectInit=!1,this.initCallback()):this.ctxName?(this._pendingCtxInitOnConnect=!1,this._performInitialization()):this._pendingCtxInitOnConnect&&this._effectiveCtxName&&(this._pendingCtxInitOnConnect=!1,this._performInitialization())}_performInitialization(){if(this._symbioteFirstUpdated)return;this._symbioteFirstUpdated=!0,this._initSharedContext();let sharedSchema=this.init$;if(Object.keys(sharedSchema).length>0){let pubsub=this._requireSharedPubSub();for(let[key,defaultValue]of Object.entries(sharedSchema))void 0===pubsub.read(key)&&pubsub.pub(key,defaultValue),this.sub(key,(0,debounce.s)(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate())},0),!1)}this.initCallback(),this._isInitialized=!0,this.requestUpdate()}firstUpdated(changedProperties){super.firstUpdated(changedProperties)}disconnectedCallback(){this._cleanupSymbioteSubscriptions(),super.disconnectedCallback(),this._symbioteFirstUpdated&&(this._needsReconnectInit=!0)}_cleanupSymbioteSubscriptions(){if(0!==this._symbioteSubscriptions.size){for(let unsubscribe of[...this._symbioteSubscriptions])unsubscribe();this._symbioteSubscriptions.clear()}}initCallback(){}}return _ts_decorate([(0,decorators_js_.property)({type:String,attribute:"ctx-name",noAccessor:!0})],SymbioteMixinClass.prototype,"_ctxNameAttr",null),_ts_decorate([(0,decorators_js_.state)()],SymbioteMixinClass.prototype,"_ctxNameFromContext",void 0),_ts_decorate([(0,decorators_js_.state)()],SymbioteMixinClass.prototype,"ctxName",void 0),_ts_decorate([(0,decorators_js_.state)()],SymbioteMixinClass.prototype,"_isInitialized",void 0),SymbioteMixinClass}}},7715(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{g:()=>ACTIVITY_TYPES});let ACTIVITY_TYPES=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"})},255(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{W:()=>createDebugPrinter});var _abstract_sharedConfigKey__rspack_import_0=__webpack_require__(1971);let createDebugPrinter=(getCtx,scope)=>(...args)=>{let ctx=getCtx();if(!ctx.read((0,_abstract_sharedConfigKey__rspack_import_0.T)("debug")))return;let consoleArgs=args;"function"==typeof args?.[0]&&(consoleArgs=(0,args[0])());let prefixes=[ctx.id,scope].filter(Boolean);console.log(`[${prefixes.join("][")}]`,...consoleArgs)}},263(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{k:()=>createL10n});var _abstract_managers_LocaleManager__rspack_import_1=__webpack_require__(7959),_utils_getPluralForm__rspack_import_0=__webpack_require__(9364),_utils_template_utils__rspack_import_2=__webpack_require__(664);let createL10n=getCtx=>{let getL10n,pluralizer=(getL10n=()=>l10n,(key,count)=>{let l10n=getL10n(),locale=l10n("locale-id")||"en",pluralForm=(0,_utils_getPluralForm__rspack_import_0.Z)(locale,count);return l10n(`${key}__${pluralForm}`)}),l10n=(str,variables={})=>{if(!str)return"";let template=getCtx().read((0,_abstract_managers_LocaleManager__rspack_import_1.PI)(str))||str;for(let pluralObject of(0,_utils_template_utils__rspack_import_2.Q)(template))variables[pluralObject.variable]=pluralizer(pluralObject.pluralKey,Number(variables[pluralObject.countVariable]));return(0,_utils_template_utils__rspack_import_2.x)(template,variables)};return l10n}},5890(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{EC:()=>createSharedInstancesBag,jM:()=>SharedInstance});var _abstract_sharedConfigKey__rspack_import_1=__webpack_require__(1971),_blocks_Config_initialConfig__rspack_import_2=__webpack_require__(318),_createDebugPrinter__rspack_import_0=__webpack_require__(255);class SharedInstance{constructor(sharedInstancesBag){this._subscriptions=new Set,this._cfgProxy=null,this._debugPrint=(0,_createDebugPrinter__rspack_import_0.W)(()=>this._sharedInstancesBag.ctx,this.constructor.name),this._sharedInstancesBag=sharedInstancesBag,this._ctx=sharedInstancesBag.ctx}addSub(unsub){this._subscriptions.add(unsub)}get _cfg(){return this._cfgProxy||(this._cfgProxy=new Proxy({},{set:()=>{throw Error("SharedInstance cfg proxy is read-only")},get:(_obj,key)=>{if("string"!=typeof key)return;let sharedKey=(0,_abstract_sharedConfigKey__rspack_import_1.T)(key);return this._sharedInstancesBag.ctx.has(sharedKey)?this._sharedInstancesBag.ctx.read(sharedKey):_blocks_Config_initialConfig__rspack_import_2.Dz[key]}})),this._cfgProxy}destroy(){for(let unsub of this._subscriptions)try{unsub()}catch{}this._subscriptions.clear()}}let instanceKeyMap={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},getSharedInstance=(ctx,key,isRequired=!0)=>{let hasKey=ctx.has(key),value=hasKey?ctx.read(key):null;if(hasKey&&value||!isRequired)return value;throw Error(`Unexpected error: shared instance for key "${String(key)}" is not available`)},createSharedInstancesBag=getCtx=>({get ctx(){return getCtx()},get modalManager(){return getSharedInstance(getCtx(),"*modalManager",!1)},get pluginManager(){return getSharedInstance(getCtx(),"*pluginManager")},get telemetryManager(){return getSharedInstance(getCtx(),"*telemetryManager")},get localeManager(){return getSharedInstance(getCtx(),"*localeManager")},get a11y(){return getSharedInstance(getCtx(),"*a11y")},get blocksRegistry(){return getSharedInstance(getCtx(),"*blocksRegistry")},get eventEmitter(){return getSharedInstance(getCtx(),"*eventEmitter")},get uploadCollection(){return getSharedInstance(getCtx(),"*uploadCollection")},get secureUploadsManager(){return getSharedInstance(getCtx(),"*secureUploadsManager",!1)},get api(){return getSharedInstance(getCtx(),"*publicApi")},get validationManager(){return getSharedInstance(getCtx(),"*validationManager")},when(name,callback){let stateKey=instanceKeyMap[name],ctx=getCtx(),existingInstance=ctx.has(stateKey)?ctx.read(stateKey):void 0;if(existingInstance)return callback(existingInstance),()=>{};let unsub=ctx.sub(stateKey,instance=>{instance&&(callback(instance),unsub())});return unsub}})},1491(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{A:()=>__rspack_default_export});let __rspack_default_export={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You’ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You’ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"}},5446(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{V:()=>UID});class UID{static generateFastUid(){return`uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let cryptoObj=globalThis.crypto;return cryptoObj&&"function"==typeof cryptoObj.randomUUID?cryptoObj.randomUUID():UID.generateFastUid()}}},5730(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{pc:()=>UploadSource,y5:()=>ExternalUploadSource});let ExternalUploadSource=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),UploadSource=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),...ExternalUploadSource})},3254(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Z:()=>applyStyles});function applyStyles(el,styleMap){for(let prop in styleMap)prop.includes("-")?el.style.setProperty(prop,String(styleMap[prop])):el.style[prop]=String(styleMap[prop])}},1633(__unused_rspack_module,__webpack_exports__,__webpack_require__){let ua;__webpack_require__.d(__webpack_exports__,{R5:()=>browserInfo,wN:()=>browserFeatures});let browserInfo={safariDesktop:(ua=navigator.userAgent,/Macintosh|Windows/.test(ua)&&/Version\/[\d.]+.*Safari/.test(ua)&&!/Chrome|Chromium|Edg|OPR/.test(ua))},browserFeatures={htmlMediaCapture:"capture"in document.createElement("input")}},6339(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$z:()=>createCdnUrlModifiers,I1:()=>extractOperations,LN:()=>createCdnUrl,OB:()=>joinCdnOperations,_A:()=>extractCdnUrlModifiers,p_:()=>extractUuid,v6:()=>extractFilename,vo:()=>createOriginalUrl});let normalizeCdnOperation=operation=>{if("string"!=typeof operation||!operation)return"";let str=operation.trim();return str.startsWith("-/")?str=str.slice(2):str.startsWith("/")&&(str=str.slice(1)),str.endsWith("/")&&(str=str.slice(0,str.length-1)),str},joinCdnOperations=(...operations)=>operations.filter(op=>"string"==typeof op&&!!op).map(op=>normalizeCdnOperation(op)).join("/-/"),createCdnUrlModifiers=(...cdnOperations)=>{let joined=joinCdnOperations(...cdnOperations);return joined?`-/${joined}/`:""};function extractFilename(cdnUrl){let url=new URL(cdnUrl),noOrigin=url.pathname+url.search+url.hash,urlFilenameIdx=noOrigin.lastIndexOf("http"),plainFilenameIdx=noOrigin.lastIndexOf("/"),filename="";return urlFilenameIdx>=0?filename=noOrigin.slice(urlFilenameIdx):plainFilenameIdx>=0&&(filename=noOrigin.slice(plainFilenameIdx+1)),filename}function extractUuid(cdnUrl){let{pathname}=new URL(cdnUrl),slashIndex=pathname.indexOf("/"),secondSlashIndex=pathname.indexOf("/",slashIndex+1);return pathname.substring(slashIndex+1,secondSlashIndex)}function extractCdnUrlModifiers(cdnUrl){let url=new URL(trimFilename(cdnUrl)),operationsMarker=url.pathname.indexOf("/-/");return -1===operationsMarker?"":url.pathname.substring(operationsMarker).slice(1)}function extractOperations(cdnUrl){return extractCdnUrlModifiers(cdnUrl).split("/-/").filter(Boolean).map(operation=>normalizeCdnOperation(operation))}function trimFilename(cdnUrl){let url=new URL(cdnUrl),filename=extractFilename(cdnUrl),filenamePathPart=isFileUrl(filename)?splitFileUrl(filename).pathname:filename;return url.pathname=url.pathname.replace(filenamePathPart,""),url.search="",url.hash="",url.toString()}function isFileUrl(filename){return filename.startsWith("http")}function splitFileUrl(fileUrl){let url=new URL(fileUrl);return{pathname:`${url.origin}${url.pathname??""}`,search:url.search??"",hash:url.hash??""}}let createCdnUrl=(baseCdnUrl,cdnModifiers,filename)=>{let url=new URL(trimFilename(baseCdnUrl)),resolvedFilename=filename??extractFilename(baseCdnUrl),resolvedModifiers=cdnModifiers??"";if(url.pathname.startsWith("//")&&(url.pathname=url.pathname.replace("//","/")),resolvedFilename&&isFileUrl(resolvedFilename)){let splitted=splitFileUrl(resolvedFilename);url.pathname=`${url.pathname}${resolvedModifiers}${splitted.pathname||""}`,url.search=splitted.search,url.hash=splitted.hash}else url.pathname=`${url.pathname}${resolvedModifiers}${resolvedFilename||""}`;return url.toString()},createOriginalUrl=(cdnUrl,uuid)=>{let url=new URL(cdnUrl);return url.pathname=`${uuid}/`,url.toString()}},9101(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{A:()=>deserializeCsv,L:()=>serializeCsv});let deserializeCsv=value=>value?value.split(",").map(item=>item.trim()).filter(Boolean):[],serializeCsv=value=>value.join(",")},4441(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{s:()=>debounce});function debounce(callback,wait){let timer,debounced=(...args)=>{timer&&clearTimeout(timer),timer=setTimeout(()=>callback(...args),wait)};return debounced.cancel=()=>{timer&&clearTimeout(timer)},debounced}},9364(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Z:()=>getPluralForm});let getPluralForm=(locale,count)=>new Intl.PluralRules(locale).select(count)},6756(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{N:()=>preloadImage,e:()=>batchPreloadImages});var _transparentPixelSrc__rspack_import_0=__webpack_require__(8608);function preloadImage(src){let image=new Image;return{promise:new Promise((resolve,reject)=>{image.src=src,image.onload=()=>resolve(),image.onerror=err=>reject(err)}),image,cancel:()=>{0===image.naturalWidth&&(image.src=_transparentPixelSrc__rspack_import_0.d)}}}function batchPreloadImages(list){let preloaders=[];for(let src of list){let preload=preloadImage(src);preloaders.push(preload)}let images=preloaders.map(preload=>preload.image);return{promise:Promise.allSettled(preloaders.map(preload=>preload.promise)),images,cancel:()=>{preloaders.forEach(preload=>{preload.cancel()})}}}},2513(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{G:()=>stringToArray});let stringToArray=(str,delimiter=",")=>str.trim().split(delimiter).map(part=>part.trim()).filter(part=>part.length>0)},664(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Q:()=>getPluralObjects,x:()=>applyTemplateData});let DEFAULT_TRANSFORMER=value=>value,PLURAL_PREFIX="plural:";function applyTemplateData(template,data={},options={}){let{openToken="{{",closeToken="}}",transform=DEFAULT_TRANSFORMER}=options;for(let key in data){let rawValue=data[key],value=null!=rawValue?rawValue.toString():void 0,replacement="string"==typeof value?transform(value):String(value);template=template.replaceAll(openToken+key+closeToken,replacement)}return template}function getPluralObjects(template){let pluralObjects=[],open=template.indexOf("{{");for(;-1!==open;){let close=template.indexOf("}}",open);if(-1===close)break;let variable=template.substring(open+2,close);if(variable.startsWith(PLURAL_PREFIX)){let keyValue=template.substring(open+2,close).replace(PLURAL_PREFIX,""),key=keyValue.substring(0,keyValue.indexOf("(")),count=keyValue.substring(keyValue.indexOf("(")+1,keyValue.indexOf(")"));pluralObjects.push({variable,pluralKey:key,countVariable:count})}open=template.indexOf("{{",close)}return pluralObjects}},3442(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{n:()=>throttle});let throttle=(fn,wait)=>{let lastFn,inThrottle=!1,lastTime=0,throttled=(...args)=>{inThrottle?(lastFn&&clearTimeout(lastFn),lastFn=setTimeout(()=>{Date.now()-lastTime>=wait&&(fn(...args),lastTime=Date.now())},Math.max(wait-(Date.now()-lastTime),0))):(fn(...args),lastTime=Date.now(),inThrottle=!0)};return Object.defineProperty(throttled,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{lastFn&&clearTimeout(lastFn)}}),throttled}},2402(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{f:()=>toKebabCase});let toKebabCase=str=>str.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(x=>x.toLowerCase()).join("-")},8608(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{d:()=>TRANSPARENT_PIXEL_SRC});let TRANSPARENT_PIXEL_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="},6783(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>warnOnce});let warnings=new Set;function warnOnce(message){warnings.has(message)||(warnings.add(message),console.warn(message))}},5474(module){module.exports=__rspack_external__uploadcare_upload_client_41a5a0bd},2927(module){module.exports=__rspack_external_lit},8899(module){module.exports=__rspack_external_lit_decorators_js_aaefadbe},5337(module){module.exports=__rspack_external_lit_directives_ref_js_a17221f9},1156(module){module.exports=__rspack_external_lit_directives_style_map_js_cb619b3b},3943(module){module.exports=__rspack_external_lit_directives_unsafe_svg_js_aeac3291}},__webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(void 0!==cachedModule)return cachedModule.exports;var module=__webpack_module_cache__[moduleId]={exports:{}};return __webpack_modules__[moduleId](module,module.exports,__webpack_require__),module.exports}if(__webpack_require__.m=__webpack_modules__,__webpack_require__.d=(exports,definition)=>{for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)&&Object.defineProperty(exports,key,{enumerable:!0,get:definition[key]})},__webpack_require__.f={},__webpack_require__.e=chunkId=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises,key)=>(__webpack_require__.f[key](chunkId,promises),promises),[])),__webpack_require__.k=chunkId=>""+chunkId+".css",__webpack_require__.u=chunkId=>""+chunkId+".js",__webpack_require__.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),__webpack_require__.o=(obj,prop)=>Object.prototype.hasOwnProperty.call(obj,prop),__webpack_require__.r=exports=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},"string"==typeof import.meta.url&&(scriptUrl=import.meta.url),!scriptUrl)throw Error("Automatic publicPath is not supported in this browser");__webpack_require__.p=scriptUrl=scriptUrl.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),installedChunks={index:0},loadingAttribute="data-rspack-loading",(loadCssChunkData=(target,chunkId)=>{installedChunks[chunkId]=0})(__webpack_require__.m,0,"index"),__webpack_require__.f.css=(chunkId,promises,fetchPriority)=>{var installedChunkData=__webpack_require__.o(installedChunks,chunkId)?installedChunks[chunkId]:void 0;if(0!==installedChunkData)if(installedChunkData)promises.push(installedChunkData[2]);else if(/^(cloudImageEditorPlugin|index)$/.test(chunkId)){var promise=new Promise(function(resolve,reject){installedChunkData=installedChunks[chunkId]=[resolve,reject]});promises.push(installedChunkData[2]=promise);var url=__webpack_require__.p+__webpack_require__.k(chunkId),error=Error(),loadingEnded=function(event){if(__webpack_require__.o(installedChunks,chunkId)&&(0!==(installedChunkData=installedChunks[chunkId])&&(installedChunks[chunkId]=void 0),installedChunkData))if("load"!==event.type){var errorType=event&&event.type,realSrc=event&&event.target&&event.target.src;error.message="Loading css chunk "+chunkId+" failed.\n("+errorType+": "+realSrc+")",error.name="ChunkLoadError",error.type=errorType,error.request=realSrc,installedChunkData[1](error)}else loadCssChunkData(__webpack_require__.m,chunkId),installedChunkData[0]()};"u">typeof document?((chunkId,url,done,hmr,fetchPriority)=>{var link,needAttach,key="chunk-"+chunkId;if(!hmr){for(var links=document.getElementsByTagName("link"),i=0;i<links.length;i++){var l=links[i],href=l.getAttribute("href")||l.href;if(href&&!href.startsWith(__webpack_require__.p)&&(href=__webpack_require__.p+(href.startsWith("/")?href.slice(1):href)),"stylesheet"==l.rel&&(href&&href.startsWith(url)||l.getAttribute("data-rspack")=="@uploadcare/file-uploader:"+key)){link=l;break}}if(!done)return}link||(needAttach=!0,link=document.createElement("link"),__webpack_require__.nc&&link.setAttribute("nonce",__webpack_require__.nc),link.setAttribute("data-rspack","@uploadcare/file-uploader:"+key),link.setAttribute(loadingAttribute,1),link.rel="stylesheet",link.href=url);var onLinkComplete=(prev,event)=>{if(link.onerror=link.onload=null,link.removeAttribute(loadingAttribute),clearTimeout(timeout),event&&"load"!=event.type&&link.parentNode.removeChild(link),done(event),prev)return prev(event)};if(link.getAttribute(loadingAttribute)){var timeout=setTimeout(onLinkComplete.bind(null,void 0,{type:"timeout",target:link}),12e4);link.onerror=onLinkComplete.bind(null,link.onerror),link.onload=onLinkComplete.bind(null,link.onload)}else onLinkComplete(void 0,{type:"load",target:link});return hmr&&hmr.getAttribute("fetchpriority")&&link.setAttribute("fetchpriority",hmr.getAttribute("fetchpriority")),hmr?document.head.insertBefore(link,hmr):needAttach&&document.head.appendChild(link)})(chunkId,url,loadingEnded,void 0,0):loadingEnded({type:"load"})}else installedChunks[chunkId]=0},installedChunks1={index:0},installChunk=data=>{var moduleId,chunkId,__rspack_esm_ids=data.__rspack_esm_ids,__webpack_modules__=data.__webpack_modules__,__rspack_esm_runtime=data.__rspack_esm_runtime,i=0;for(moduleId in __webpack_modules__)__webpack_require__.o(__webpack_modules__,moduleId)&&(__webpack_require__.m[moduleId]=__webpack_modules__[moduleId]);for(__rspack_esm_runtime&&__rspack_esm_runtime(__webpack_require__);i<__rspack_esm_ids.length;i++)chunkId=__rspack_esm_ids[i],__webpack_require__.o(installedChunks1,chunkId)&&installedChunks1[chunkId]&&installedChunks1[chunkId][0](),installedChunks1[__rspack_esm_ids[i]]=0},__webpack_require__.f.j=function(chunkId,promises){var installedChunkData=__webpack_require__.o(installedChunks1,chunkId)?installedChunks1[chunkId]:void 0;if(0!==installedChunkData)if(installedChunkData)promises.push(installedChunkData[1]);else{var promise=import("./"+__webpack_require__.u(chunkId)).then(installChunk,e=>{throw 0!==installedChunks1[chunkId]&&(installedChunks1[chunkId]=void 0),e}),promise=Promise.race([promise,new Promise(resolve=>{installedChunkData=installedChunks1[chunkId]=[resolve]})]);promises.push(installedChunkData[1]=promise)}};var __webpack_exports__={};(()=>{__webpack_require__.d(__webpack_exports__,{JU:()=>DropArea,vr:()=>ActivityHeader,eB:()=>LitBlock.x,z2:()=>ProgressBar,Vd:()=>LitSolutionBlock,y5:()=>UploadSource.y5,aF:()=>Modal,Bp:()=>ExternalSource.B,eK:()=>FileUploaderMinimal,ru:()=>CameraSource.r,$G:()=>BaseComponent,jj:()=>SimpleBtn,rM:()=>env.r,Y0:()=>Copyright,DJ:()=>loadFileUploaderFrom.D,rt:()=>PluginActivityHost,Ar:()=>SourceList,iE:()=>LitUploaderBlock.z,V0:()=>UID.V,cx:()=>UploadList,Ts:()=>UrlSource.T,Zz:()=>StartFrom,fX:()=>toKebabCase.f,Az:()=>FileUploaderInline,wB:()=>PluginActivityRenderer,TS:()=>Config.T,ZQ:()=>FormInput,vY:()=>FileUploaderRegular,Do:()=>ModalManager.D,zi:()=>Thumb,E9:()=>Img,i8:()=>env.i,Yi:()=>defineComponents.Y,qB:()=>ProgressBarCommon,l6:()=>Select,_Q:()=>UploadCtxProvider,I3:()=>FileItem,pc:()=>UploadSource.pc,In:()=>Icon.I,y$:()=>Spinner,mO:()=>localeRegistry.m,hC:()=>LitActivityBlock.S,B_:()=>PubSubCompat.G,s9:()=>SourceBtn});var PubSubCompat=__webpack_require__(8594),external_lit_=__webpack_require__(2927),CssDataMixin=__webpack_require__(3361),LightDomMixin=__webpack_require__(7337),RegisterableElementMixin=__webpack_require__(3282),SymbioteCompatMixin=__webpack_require__(9280);class BaseComponent extends(0,RegisterableElementMixin.d)((0,SymbioteCompatMixin.w)()((0,CssDataMixin.N)((0,LightDomMixin.Q)(external_lit_.LitElement)))){}var UID=__webpack_require__(5446),defineComponents=__webpack_require__(3962),loadFileUploaderFrom=__webpack_require__(225),localeRegistry=__webpack_require__(7444),ModalManager=__webpack_require__(3076),toKebabCase=__webpack_require__(2402),LitBlock=__webpack_require__(204),unsafe_svg_js_=__webpack_require__(3943),CTX=__webpack_require__(7992);class LitSolutionBlock extends LitBlock.x{static{this.styleAttrs=["uc-wgt-common"]}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName)}render(){return(0,external_lit_.html)`${(0,unsafe_svg_js_.unsafeSVG)("<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>")}`}constructor(...args){super(...args),this.init$=(0,CTX.u8)(this)}}var LitUploaderBlock=__webpack_require__(5544),LitActivityBlock=__webpack_require__(5923),Icon=__webpack_require__(8610),cdn_utils=__webpack_require__(6339),stringToArray=__webpack_require__(2513),template_utils=__webpack_require__(664);let CSS_PREF="--uc-img-",UNRESOLVED_ATTR="unresolved",DEV_MODE=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ImgTypeEnum=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var env=__webpack_require__(5704);let PROPS_MAP=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:"https://ucarecdn.com"},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});class ImgConfig extends(0,CssDataMixin.N)((0,RegisterableElementMixin.d)(external_lit_.LitElement)){createRenderRoot(){return this}constructor(){for(let prop in super(),this._state={},this._subscribers=new Map,this._isnObserver=null,this._observed=null,PROPS_MAP){let config=PROPS_MAP[prop];this._state[CSS_PREF+prop]=config?.default||""}}$$(key){return this._state[CSS_PREF+key]}set$$(kvObj){for(let key in kvObj){let fullKey=CSS_PREF+key,val=kvObj[key];this._state[fullKey]=val,this._notify(fullKey,val)}}sub$$(key,kbFn){let fullKey=CSS_PREF+key;this._subscribers.has(fullKey)||this._subscribers.set(fullKey,new Set),this._subscribers.get(fullKey)?.add(kbFn);let currentVal=this._state[fullKey];null!==currentVal&&""!==currentVal&&kbFn(currentVal)}_notify(key,val){this._subscribers.has(key)&&this._subscribers.get(key)?.forEach(cb=>{null!==val&&""!==val&&cb(val)})}analyticsParams(){return`-/@clib/${env.r}/${env.i}/uc-img/`}initAttributes(el){Array.from(this.attributes).forEach(attr=>{PROPS_MAP[attr.name]||el.setAttribute(attr.name,attr.value)})}initIntersection(el,cbkFn){this._isnObserver=new IntersectionObserver(entries=>{entries.forEach(ent=>{ent.isIntersecting&&(cbkFn(),this._isnObserver?.unobserve(el))})},{root:null,rootMargin:"0px"}),this._isnObserver.observe(el),this._observed||(this._observed=new Set),this._observed.add(el)}connectedCallback(){super.connectedCallback(),this._initCssProperties()}_initCssProperties(){for(let prop in PROPS_MAP){let fullKey=CSS_PREF+prop,val=this.getCssData(fullKey,!0);null!=val&&(this._state[fullKey]=val)}}disconnectedCallback(){super.disconnectedCallback(),this._isnObserver&&(this._observed?.forEach(el=>{this._isnObserver?.unobserve(el)}),this._isnObserver=null),this._subscribers.clear()}static get observedAttributes(){return Object.keys(PROPS_MAP)}attributeChangedCallback(name,_oldVal,newVal){window.setTimeout(()=>{let fullKey=CSS_PREF+name;this._state[fullKey]=newVal,this._notify(fullKey,newVal)})}}class ImgBase extends ImgConfig{_fmtAbs(src){return src.includes("//")||DEV_MODE||(src=new URL(src,document.baseURI).href),src}_validateSize(size){if(!size)return;let numericPart=size.match(/\d+/)?.[0],alphabeticPart=size.match(/[a-zA-Z]+/)?.[0];if(!numericPart||!alphabeticPart)return;let bp=parseInt(numericPart,10);return Number(bp)>5e3&&this._hasFormatJPG?5e3+alphabeticPart:Number(bp)>3e3&&!this._hasFormatJPG?3e3+alphabeticPart:size}_getCdnModifiers(size,blur){let params={format:this._getTypedCssValue("format"),quality:this._getTypedCssValue("quality"),resize:this._validateSize(size),blur,"cdn-operations":this._getTypedCssValue("cdn-operations")??void 0,analytics:this.analyticsParams()};return(0,cdn_utils.$z)(...Object.entries(params).filter(([_,value])=>void 0!==value&&""!==value).map(([key,value])=>"cdn-operations"===key||"analytics"===key?value:`${key}/${value}`))}_getTypedCssValue(key){let value=this.$$(key);if(null==value||"string"==typeof value||"number"==typeof value||"boolean"==typeof value)return value}_getUrlBase(size="",blur=""){let src=this.$$("src");if(src.startsWith("data:")||src.startsWith("blob:"))return src;if(DEV_MODE&&src&&!src.includes("//"))return this._proxyUrl(src);let cdnModifiers=this._getCdnModifiers(size,blur),cdnCnameRaw=this.$$("cdn-cname");if(src.startsWith(String(cdnCnameRaw)))return(0,cdn_utils.LN)(src,cdnModifiers);let uuid=this.$$("uuid");if(cdnCnameRaw&&uuid||uuid)return this._proxyUrl((0,cdn_utils.LN)((0,cdn_utils.vo)(cdnCnameRaw,uuid),cdnModifiers));let proxyCname=this.$$("proxy-cname");if(proxyCname)return this._proxyUrl((0,cdn_utils.LN)(proxyCname,cdnModifiers,this._fmtAbs(src)));let pubkey=this.$$("pubkey");if(pubkey)return this._proxyUrl((0,cdn_utils.LN)(`https://${pubkey}.ucr.io/`,cdnModifiers,this._fmtAbs(src)))}_proxyUrl(url){let previewProxy=this.$$("secure-delivery-proxy");return previewProxy?(0,template_utils.x)(previewProxy,{previewUrl:url},{transform:value=>window.encodeURIComponent(value)}):url}_getElSize(el,k=1,wOnly=!0){let rect=el.getBoundingClientRect(),w=k*Math.round(rect.width),h=wOnly?"":k*Math.round(rect.height);return w||h?`${w||""}x${h||""}`:null}_setupEventProxy(img){let proxifyEvent=e=>{e.stopPropagation();let event=new Event(e.type,e);this.dispatchEvent(event)};for(let event of["load","error"])img.addEventListener(event,proxifyEvent)}get img(){return this._hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get _currentImg(){return this._hasPreviewImage?{type:ImgTypeEnum.PREVIEW,img:this._imgPreview}:{type:ImgTypeEnum.MAIN,img:this.img}}get _hasPreviewImage(){return this.$$("is-preview-blur")}get _bgSelector(){return this.$$("is-background-for")}get _breakpoints(){let breakpointsValue=this.$$("breakpoints");return breakpointsValue?[...new Set((0,stringToArray.G)(breakpointsValue).map(bp=>parseInt(bp,10)))]:null}get _hasFormatJPG(){return"jpeg"===this.$$("format").toLowerCase()}_renderBg(el){let imgSet=new Set;imgSet.add(`url("${this._getUrlBase(this._getElSize(el))}") 1x`),this.$$("hi-res-support")&&imgSet.add(`url("${this._getUrlBase(this._getElSize(el,2))}") 2x`),this.$$("ultra-res-support")&&imgSet.add(`url("${this._getUrlBase(this._getElSize(el,3))}") 3x`);let iSet=`image-set(${[...imgSet].join(", ")})`;el.style.setProperty("background-image",iSet),el.style.setProperty("background-image",`-webkit-${iSet}`)}_getSrcset(){let srcset=new Set;return this._breakpoints?this._breakpoints.forEach(bp=>{srcset.add(`${this._getUrlBase(`${bp}x`)} ${this._validateSize(`${bp}w`)}`),this.$$("hi-res-support")&&srcset.add(`${this._getUrlBase(`${2*bp}x`)} ${this._validateSize(`${2*bp}w`)}`),this.$$("ultra-res-support")&&srcset.add(`${this._getUrlBase(`${3*bp}x`)} ${this._validateSize(`${3*bp}w`)}`)}):(srcset.add(`${this._getUrlBase(this._getElSize(this._currentImg.img))} 1x`),this.$$("hi-res-support")&&srcset.add(`${this._getUrlBase(this._getElSize(this._currentImg.img,2))} 2x`),this.$$("ultra-res-support")&&srcset.add(`${this._getUrlBase(this._getElSize(this._currentImg.img,3))} 3x`)),[...srcset].join()}_getSrc(){return this._getUrlBase()}get _srcUrlPreview(){return this._getUrlBase("100x","100")}_renderBackground(){let selector=this._bgSelector;[...document.querySelectorAll(selector)].forEach(el=>{this.$$("intersection")?this.initIntersection(el,()=>{this._renderBg(el)}):this._renderBg(el)})}_appendURL({elNode,src,srcset}){src&&(elNode.src=src),srcset&&(elNode.srcset=srcset)}_setupConfigForImage({elNode}){this._setupEventProxy(elNode),this.initAttributes(elNode)}_loaderImage({src,srcset,elNode}){return new Promise((resolve,reject)=>{this._setupConfigForImage({elNode}),elNode.setAttribute(UNRESOLVED_ATTR,""),elNode.addEventListener("load",()=>{elNode.removeAttribute(UNRESOLVED_ATTR),resolve(elNode)}),elNode.addEventListener("error",()=>{reject(!1)}),this._appendURL({elNode,src,srcset})})}async _renderImage(){if(this.$$("intersection")){this._hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this._currentImg.img,async()=>{this._hasPreviewImage&&(this._imgPreview.src=this._srcUrlPreview);try{await this._loaderImage({src:this._getSrc(),srcset:this._getSrcset(),elNode:this._img}),this._hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}});return}try{this._hasPreviewImage&&(await this._loaderImage({src:this._srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this._loaderImage({src:this._getSrc(),srcset:this._getSrcset(),elNode:this._img}),this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}catch{this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}}init(){this._bgSelector?this._renderBackground():this._renderImage()}constructor(...args){super(...args),this._img=new Image,this._imgPreview=new Image}}class Img extends ImgBase{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",val=>{this.$$("is-background-for")||this.$$("is-preview-blur")||(this.img.loading=val?"lazy":"eager")})}}var EventEmitter=__webpack_require__(9963),decorators_js_=__webpack_require__(8899),ref_js_=__webpack_require__(5337);function _ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}let LAST_ACTIVE_MODAL_ID=null;class Modal extends LitBlock.x{static{this.styleAttrs=[...super.styleAttrs,"uc-modal"]}show(){let dialog=this.dialogEl.value;"function"==typeof dialog.showModal?(this.setAttribute("aria-modal","true"),dialog.showModal()):dialog.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden")}hide(){let dialog=this.dialogEl.value;dialog&&("function"==typeof dialog.close?(this.setAttribute("aria-modal","false"),dialog.close()):dialog.removeAttribute("open"))}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",val=>{val?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.modalManager?.subscribe(ModalManager.D.OPEN,this._handleModalOpen),this.modalManager?.subscribe(ModalManager.D.CLOSE,this._handleModalClose),this.modalManager?.subscribe(ModalManager.D.CLOSE_ALL,this._handleModalCloseAll)}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.modalManager?.unsubscribe(ModalManager.D.OPEN,this._handleModalOpen),this.modalManager?.unsubscribe(ModalManager.D.CLOSE,this._handleModalClose),this.modalManager?.unsubscribe(ModalManager.D.CLOSE_ALL,this._handleModalCloseAll)}_handleDialogRef(dialog){this.dialogEl={value:dialog},this.dialogEl.value?.addEventListener("close",this._handleDialogClose),this.dialogEl.value?.addEventListener("mousedown",this._handleDialogMouseDown),this.dialogEl.value?.addEventListener("mouseup",this._handleDialogMouseUp)}render(){return(0,external_lit_.html)`<dialog ${(0,ref_js_.ref)(this._handleDialogRef)}> ${this.yield("")} </dialog>`}constructor(...args){super(...args),this.dialogEl=(0,ref_js_.createRef)(),this.strokes=!1,this.blockBodyScrolling=!1,this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null)},this._handleDialogClose=()=>{this.closeDialog()},this._handleDialogMouseDown=e=>{this._mouseDownTarget=e.target},this._handleDialogMouseUp=e=>{let target=e.target;target===this.dialogEl.value&&target===this._mouseDownTarget&&this.closeDialog()},this._handleModalOpen=({id})=>{id===this.id?(LAST_ACTIVE_MODAL_ID=id,this.show(),this.emit(EventEmitter.Bx.MODAL_OPEN,{modalId:id},{debounce:!0})):this.hide()},this._handleModalClose=({id})=>{id===this.id&&(this.hide(),this.emit(EventEmitter.Bx.MODAL_CLOSE,{modalId:id,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:!0}))},this._handleModalCloseAll=_data=>{this.hide(),LAST_ACTIVE_MODAL_ID===this.id&&this.emit(EventEmitter.Bx.MODAL_CLOSE,{modalId:LAST_ACTIVE_MODAL_ID,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:!0})}}}_ts_decorate([(0,decorators_js_.property)({type:Boolean,noAccessor:!0})],Modal.prototype,"strokes",void 0),_ts_decorate([(0,decorators_js_.property)({type:Boolean,attribute:"block-body-scrolling",noAccessor:!0})],Modal.prototype,"blockBodyScrolling",void 0);var applyStyles=__webpack_require__(3254);class FormInput extends LitUploaderBlock.z{get _inputName(){return this.nameAttrValue??this.ctxName}_createValidationInput(){let validationInput=document.createElement("input");return validationInput.type="text",validationInput.name=this._inputName,validationInput.required=this.cfg.multipleMin>0,validationInput.tabIndex=-1,(0,applyStyles.Z)(validationInput,{opacity:0,height:0,width:0}),validationInput}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",collectionState=>{if(!collectionState)return;if(!this._dynamicInputsContainer){let dynamicInputsContainer=document.createElement("div");this.appendChild(dynamicInputsContainer),this._dynamicInputsContainer=dynamicInputsContainer}if(!this._validationInputElement){let input=this._createValidationInput();this.appendChild(input),this._validationInputElement=input}if(this._dynamicInputsContainer.innerHTML="","uploading"===collectionState.status||"idle"===collectionState.status){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if("failed"===collectionState.status){let errorMsg=collectionState.errors[0]?.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(errorMsg??"");return}let group=collectionState.group?collectionState.group:null;if(group){this._validationInputElement.value=group.cdnUrl??"",this._validationInputElement.setCustomValidity("");return}let cdnUrls=collectionState.allEntries.map(entry=>entry.cdnUrl).filter(url=>"string"==typeof url);if(!this.cfg.multiple&&1===cdnUrls.length&&cdnUrls[0]){this._validationInputElement.value=cdnUrls[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let fr=new DocumentFragment;for(let value of cdnUrls){let input=document.createElement("input");input.type="hidden",input.name=`${this._inputName}[]`,input.value=value,fr.appendChild(input)}this._dynamicInputsContainer.replaceChildren(fr)},!1)}constructor(...args){super(...args),this._validationInputElement=null,this._dynamicInputsContainer=null}}!function(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);c>3&&r&&Object.defineProperty(target,key,r)}([(0,decorators_js_.property)({type:String,noAccessor:!0,attribute:"name"})],FormInput.prototype,"nameAttrValue",void 0);class Copyright extends LitBlock.x{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",value=>{this.toggleAttribute("hidden",!!value)})}render(){return(0,external_lit_.html)`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}}function ProgressBar_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}class ProgressBar extends LitBlock.x{firstUpdated(changedProperties){super.firstUpdated(changedProperties),this._progressValue=this._normalizeProgressValue(this.value),this._updateProgressValueStyle(),this._fakeProgressLineRef.value?.addEventListener("animationiteration",this._handleFakeProgressAnimation)}updated(changedProperties){if(super.updated(changedProperties),changedProperties.has("value")){let normalizedValue=this._normalizeProgressValue(this.value);if(this.visible){let nextValue=Math.max(this._progressValue,normalizedValue);nextValue!==this._progressValue&&(this._progressValue=nextValue,this._updateProgressValueStyle())}else this._progressValue=normalizedValue}changedProperties.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this._updateProgressValueStyle():this._progressValue=this._normalizeProgressValue(this.value))}disconnectedCallback(){super.disconnectedCallback(),this._fakeProgressLineRef.value?.removeEventListener("animationiteration",this._handleFakeProgressAnimation)}_normalizeProgressValue(value){return Number.isFinite(value)?Math.min(100,Math.max(0,value)):0}_updateProgressValueStyle(){this.visible&&this.style.setProperty("--l-progress-value",this._progressValue.toString())}render(){return(0,external_lit_.html)`<div ${(0,ref_js_.ref)(this._fakeProgressLineRef)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}constructor(...args){super(...args),this.hasFileName=!1,this.value=0,this.visible=!0,this._progressValue=0,this._fakeProgressLineRef=(0,ref_js_.createRef)(),this._handleFakeProgressAnimation=()=>{let fakeProgressLine=this._fakeProgressLineRef.value;if(fakeProgressLine){if(!this.visible)return void fakeProgressLine.classList.add("uc-fake-progress--hidden");this._progressValue>0&&fakeProgressLine.classList.add("uc-fake-progress--hidden")}}}}function ProgressBarCommon_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}ProgressBar_ts_decorate([(0,decorators_js_.property)({type:Boolean,noAccessor:!0})],ProgressBar.prototype,"hasFileName",void 0),ProgressBar_ts_decorate([(0,decorators_js_.property)({type:Number})],ProgressBar.prototype,"value",void 0),ProgressBar_ts_decorate([(0,decorators_js_.property)({type:Boolean,reflect:!0})],ProgressBar.prototype,"visible",void 0);class ProgressBarCommon extends LitUploaderBlock.z{constructor(){super(),this._visible=!1,this._value=0,this.init$={...this.init$,"*commonProgress":0}}initCallback(){super.initCallback(),this._unobserveCollectionCb=this.uploadCollection.observeProperties(()=>{let anyUploading=this.uploadCollection.items().some(id=>{let item=this.uploadCollection.read(id);return item?.getValue("isUploading")??!1});this._visible=anyUploading}),this.sub("*commonProgress",progress=>{this._value=progress})}updated(changedProperties){super.updated(changedProperties),changedProperties.has("visible")&&(this._visible?this.setAttribute("active",""):this.removeAttribute("active"))}disconnectedCallback(){super.disconnectedCallback(),this._unobserveCollectionCb?.(),this._unobserveCollectionCb=void 0}render(){return(0,external_lit_.html)`<uc-progress-bar .value=${this._value} .visible=${this._visible}></uc-progress-bar>`}}function Select_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}ProgressBarCommon_ts_decorate([(0,decorators_js_.state)()],ProgressBarCommon.prototype,"_visible",void 0),ProgressBarCommon_ts_decorate([(0,decorators_js_.state)()],ProgressBarCommon.prototype,"_value",void 0);class Select extends LitBlock.x{render(){return(0,external_lit_.html)` <select @change=${this._handleChange} .value=${this.value} ?disabled=${this.disabled}> ${this.options.map(option=>(0,external_lit_.html)`<option value=${option.value}>${option.text}</option>`)} </select>`}constructor(...args){super(...args),this.value="",this.disabled=!1,this.options=[],this._handleChange=event=>{if(this.disabled){event.preventDefault(),event.stopPropagation();return}event.preventDefault(),event.stopPropagation();let selectEl=event.currentTarget;selectEl&&(this.value=selectEl.value,this.dispatchEvent(new Event("change")))}}}function SourceBtn_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}Select_ts_decorate([(0,decorators_js_.property)({type:String,attribute:!1})],Select.prototype,"value",void 0),Select_ts_decorate([(0,decorators_js_.property)({type:Boolean,reflect:!0})],Select.prototype,"disabled",void 0),Select_ts_decorate([(0,decorators_js_.property)({type:Array,attribute:!1})],Select.prototype,"options",void 0);class SourceBtn extends LitUploaderBlock.z{willUpdate(changedProperties){super.willUpdate(changedProperties),changedProperties.has("source")&&this._applySource(this.source)}_applySource(source){if(!source){this._srcTypeKey="",this._iconName="default";return}let{label,icon,id}=source;this._srcTypeKey=label,this._iconName=icon??id??"default"}activate(){this.source&&this.source.onClick()}render(){return(0,external_lit_.html)`<button type="button" @click=${this.activate}><uc-icon name=${this._iconName}></uc-icon><div class="uc-txt">${this.l10n(this._srcTypeKey)}</div></button>`}constructor(...args){super(...args),this.couldBeCtxOwner=!0,this._iconName="default",this._srcTypeKey=""}}SourceBtn_ts_decorate([(0,decorators_js_.property)({attribute:!1})],SourceBtn.prototype,"source",void 0),SourceBtn_ts_decorate([(0,decorators_js_.state)()],SourceBtn.prototype,"_iconName",void 0),SourceBtn_ts_decorate([(0,decorators_js_.state)()],SourceBtn.prototype,"_srcTypeKey",void 0);var UploadSource=__webpack_require__(5730);function SourceList_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}class SourceList extends LitUploaderBlock.z{initCallback(){super.initCallback(),this.subConfigValue("sourceList",val=>{this._rawSourceList=(0,stringToArray.G)(val),this._updateSources()});let pluginManager=this._sharedInstancesBag.pluginManager;pluginManager?.onPluginsChange&&(this._unsubscribePlugins=pluginManager.onPluginsChange(()=>this._updateSources()))}updated(changedProperties){super.updated(changedProperties),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents"}_updateSources(){let pluginManager=this._sharedInstancesBag.pluginManager,pluginSourceById=new Map((pluginManager?.snapshot().sources??[]).map(source=>[source.id,source])),sources=[];this._rawSourceList.forEach(srcName=>{let expanded=this._expandSource(srcName,pluginSourceById);if(1!==expanded.length||expanded[0]!==srcName){for(let name of expanded){let config=this._makeBuiltInSourceConfig(name);if(config){sources.push(config);continue}let pluginSource=pluginSourceById.get(name);pluginSource&&sources.push(this._makePluginSourceConfig(pluginSource))}return}let builtInConfig=this._makeBuiltInSourceConfig(srcName);if(builtInConfig)return void sources.push(builtInConfig);let pluginSource=pluginSourceById.get(srcName);pluginSource&&sources.push(this._makePluginSourceConfig(pluginSource))}),this._sources=sources}_expandSource(srcName,pluginSourceById){let pluginSource=pluginSourceById.get(srcName);return pluginSource?.expand?pluginSource.expand():[srcName]}_makeBuiltInSourceConfig(type){return type===UploadSource.pc.LOCAL?{id:type,label:`src-type-${type}`,icon:type,onClick:()=>this.api.openSystemDialog()}:null}_makePluginSourceConfig(source){return{id:source.id,label:source.label,icon:source.icon,onClick:()=>source.onSelect()}}render(){return(0,external_lit_.html)`${this._sources.map(source=>(0,external_lit_.html)`<uc-source-btn role="listitem" .source=${source} data-source-id=${source.id}></uc-source-btn>`)}`}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback()}constructor(...args){super(...args),this._rawSourceList=[],this._sources=[],this.wrap=!1}}SourceList_ts_decorate([(0,decorators_js_.state)()],SourceList.prototype,"_sources",void 0),SourceList_ts_decorate([(0,decorators_js_.property)({type:Boolean,attribute:"wrap",noAccessor:!0})],SourceList.prototype,"wrap",void 0);class Spinner extends LitBlock.x{render(){return(0,external_lit_.html)`<div class="uc-spinner"></div>`}}var debounce=__webpack_require__(4441),preloadImage=__webpack_require__(6756);function generateThumb(imgFile,size=40){if("image/svg+xml"===imgFile.type)return URL.createObjectURL(imgFile);let canvas=document.createElement("canvas"),ctx=canvas.getContext("2d");if(!ctx)return Promise.reject(Error("Canvas context not supported"));let img=new Image,promise=new Promise((resolve,reject)=>{img.onload=()=>{let ratio=img.height/img.width;ratio>1?(canvas.width=size,canvas.height=size*ratio):(canvas.height=size,canvas.width=size/ratio),ctx.fillStyle="rgb(240, 240, 240)",ctx.fillRect(0,0,canvas.width,canvas.height),ctx.drawImage(img,0,0,canvas.width,canvas.height),canvas.toBlob(blob=>{blob?resolve(URL.createObjectURL(blob)):reject()})},img.onerror=err=>{reject(err)}});return img.src=URL.createObjectURL(imgFile),promise}class FileItemConfig extends LitUploaderBlock.z{withEntry(fn){return(...args)=>{let entry=this.entry;return entry?fn(entry,...args):void console.warn("No entry found")}}subEntry(prop,handler){this.withEntry((entry,propInner,handlerInner)=>{let sub=entry.subscribe(propInner,value=>{this.isConnected&&handlerInner(value)});this._entrySubs.add(sub)})(prop,handler)}reset(){for(let sub of this._entrySubs)sub();this._entrySubs=new Set,this.entry=null}disconnectedCallback(){super.disconnectedCallback(),this._entrySubs=new Set}constructor(...args){super(...args),this._entrySubs=new Set,this.entry=null}}function fileCssBg(color="hsl(209, 21%, 65%)",width=32,height=32){let blob;return blob=new Blob([`<svg width="${width}" height="${height}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${color}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`],{type:"image/svg+xml"}),URL.createObjectURL(blob)}var transparentPixelSrc=__webpack_require__(8608);function Thumb_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}class Thumb extends FileItemConfig{_calculateThumbSize(force=!1){force&&(this._thumbRect=this.getBoundingClientRect());let size=Math.max(parseInt(String(this?._thumbRect?.height||0),10),parseInt(String(this?._thumbRect?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(size*=window.devicePixelRatio),Math.min(size,3e3)}_decodeImage(src,signal){return new Promise((resolve,reject)=>{let image=new Image;image.decoding="async";let cleanup=()=>{image&&(image.onload=null,image.onerror=null,image.src=transparentPixelSrc.d,signal?.removeEventListener("abort",onAbort),image=null)},onAbort=()=>{cleanup(),reject(new DOMException("Aborted","AbortError"))};if(signal){if(signal.aborted)return void onAbort();signal.addEventListener("abort",onAbort,{once:!0})}let resolveSafe=()=>{cleanup(),resolve()},rejectSafe=error=>{cleanup(),reject(error)};if("function"==typeof image.decode){image.src=src,image.decode().then(resolveSafe).catch(rejectSafe);return}image.onload=resolveSafe,image.onerror=rejectSafe,image.src=src})}_cancelPendingThumbUpdate(){this._pendingThumbUpdate?.cancel(),this._pendingThumbUpdate=void 0}_scheduleThumbUpdate(nextThumbUrl){if(this._cancelPendingThumbUpdate(),!nextThumbUrl){this._thumbUrl&&(this._thumbUrl="");return}if(nextThumbUrl===this._thumbUrl)return;let abortController=new AbortController,pending={controller:abortController,cancel:()=>{abortController.abort(),void 0!==pending.rafId&&window.cancelAnimationFrame(pending.rafId)}};this._pendingThumbUpdate=pending,this._decodeImage(nextThumbUrl,abortController.signal).then(()=>{abortController.signal.aborted||(pending.rafId=window.requestAnimationFrame(()=>{abortController.signal.aborted||(this._thumbUrl=nextThumbUrl)}))}).catch(error=>{abortController.signal.aborted||error instanceof DOMException&&"AbortError"===error.name||console.warn("[Thumb] Failed to decode thumbnail image",error)})}_requestThumbGeneration(force=!1){!this.entry||(force?this._generateThumbnail(!0):this._isIntersecting&&this._debouncedGenerateThumb())}firstUpdated(changedProperties){super.firstUpdated(changedProperties),this._bindToEntry()}updated(changedProperties){super.updated(changedProperties),changedProperties.has("uid")&&this._bindToEntry()}_observerCallback(entries){let[entry]=entries;entry&&(this._isIntersecting=entry.isIntersecting,entry.isIntersecting&&(this._thumbRect=entry.boundingClientRect,this._requestThumbGeneration(),this._observer?.disconnect()),0===entry.intersectionRatio&&this._debouncedGenerateThumb.cancel())}reset(){super.reset(),this._debouncedGenerateThumb.cancel(),this._cancelPendingThumbUpdate(),this._thumbUrl&&(this._thumbUrl="")}_bindToEntry(){let id=this.uid?.trim();if(!id){this.entry&&this.reset();return}let entry=this.uploadCollection?.read(id);if(!entry||entry===this.entry)return;this.reset(),this.entry=entry;let requestThumb=()=>{this._requestThumbGeneration()};this.subEntry("fileInfo",fileInfo=>{fileInfo?.isImage&&requestThumb()}),this.subEntry("thumbUrl",thumbUrl=>{this._scheduleThumbUpdate(thumbUrl??void 0)}),this.subEntry("cdnUrlModifiers",requestThumb),this._requestThumbGeneration(!0)}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",viewMode=>{"grid"!==viewMode||this._renderedGridOnce||("list"===this._firstViewMode&&this._requestThumbGeneration(!0),this._renderedGridOnce=!0)})}connectedCallback(){super.connectedCallback(),this._observer?.disconnect(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:.1}),this._observer.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),this._cancelPendingThumbUpdate(),this._observer?.disconnect()}render(){return(0,external_lit_.html)`<div class="uc-thumb"><img class="uc-thumb__img" src=${this._thumbUrl||transparentPixelSrc.d} role="img" alt="Preview of uploaded image" ?hidden=${!this._thumbUrl} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}constructor(...args){super(...args),this.badgeIcon="",this.uid="",this._thumbUrl="",this._renderedGridOnce=!1,this._thumbRect=null,this._isIntersecting=!1,this._firstViewMode=this.cfg.filesViewMode,this._generateThumbnail=this.withEntry(async(entry,force=!1)=>{let fileInfo=entry.getValue("fileInfo"),isImage=entry.getValue("isImage"),uuid=entry.getValue("uuid"),currentThumbUrl=entry.getValue("thumbUrl"),size=this._calculateThumbSize(force);if(fileInfo&&isImage&&uuid){let thumbUrl=await this.proxyUrl((0,cdn_utils.LN)((0,cdn_utils.vo)(this.cfg.cdnCname,uuid),(0,cdn_utils.$z)(entry.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${size}x${size}/center`)));if(currentThumbUrl===thumbUrl)return;let{promise}=(0,preloadImage.N)(thumbUrl);promise.then(()=>{entry.setValue("thumbUrl",thumbUrl),currentThumbUrl?.startsWith("blob:")&&URL.revokeObjectURL(currentThumbUrl)}).catch(async()=>{if(!currentThumbUrl?.startsWith("blob:"))try{let file=entry.getValue("file");if(!file)return;let blobThumbUrl=await generateThumb(file,size);entry.setValue("thumbUrl",blobThumbUrl)}catch(err){this.telemetryManager.sendEventError(err,"thumbnail generation. Failed to generate thumb from file");let color=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");entry.setValue("thumbUrl",fileCssBg(color))}});return}if(entry.getValue("thumbUrl"))return;let file=entry.getValue("file");if(file?.type.includes("image"))try{let thumbUrl=await generateThumb(file,size);entry.setValue("thumbUrl",thumbUrl)}catch(err){this.telemetryManager.sendEventError(err,"thumbnail generation. Failed to generate thumb from file");let color=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");entry.setValue("thumbUrl",fileCssBg(color))}else{let color=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");entry.setValue("thumbUrl",fileCssBg(color))}}),this._debouncedGenerateThumb=(0,debounce.s)(this._generateThumbnail.bind(this),100)}}Thumb_ts_decorate([(0,decorators_js_.property)({type:String})],Thumb.prototype,"badgeIcon",void 0),Thumb_ts_decorate([(0,decorators_js_.property)({attribute:!1})],Thumb.prototype,"uid",void 0),Thumb_ts_decorate([(0,decorators_js_.state)()],Thumb.prototype,"_thumbUrl",void 0);class ActivityHeader extends LitActivityBlock.S{}class StartFrom extends LitActivityBlock.S{initCallback(){super.initCallback(),this.registerActivity(this.activityType??"")}render(){return(0,external_lit_.html)`<div class="uc-content">${this.yield("")}</div>`}constructor(...args){super(...args),this.historyTracked=!0,this.activityType=LitActivityBlock.S.activities.START_FROM}}class UploadCtxProvider extends LitUploaderBlock.z{static{this.styleAttrs=["uc-wgt-common"]}static{this.EventType=EventEmitter.Bx}initCallback(){super.initCallback(),this._unbindEventEmitter=this.eventEmitter.bindTarget(this)}disconnectedCallback(){super.disconnectedCallback(),this._unbindEventEmitter?.()}constructor(...args){super(...args),this._unbindEventEmitter=null}}var throttle=__webpack_require__(3442);function UploadList_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}class UploadList extends LitUploaderBlock.z{get _headerText(){return this._latestSummary?this._getHeaderText(this._latestSummary):""}_updateUploadsState(){let collectionState=this.api.getOutputCollectionState(),summary={total:collectionState.totalCount,succeed:collectionState.successCount,uploading:collectionState.uploadingCount,failed:collectionState.failedCount,validatingBeforeUploading:collectionState.idleEntries.filter(e=>e.isValidationPending).length},fitCountRestrictions=!collectionState.errors.some(err=>"TOO_MANY_FILES"===err.type||"TOO_FEW_FILES"===err.type),tooMany=collectionState.errors.some(err=>"TOO_MANY_FILES"===err.type),exact=collectionState.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),isValidationPending=collectionState.allEntries.some(entry=>entry.isValidationPending),validationOk=0===summary.failed&&0===collectionState.errors.length&&!isValidationPending,uploadBtnVisible=!1,allDone=!1,doneBtnEnabled=!1;if(summary.total-summary.succeed-summary.uploading-summary.failed>0&&fitCountRestrictions&&validationOk&&this.cfg.confirmUpload)uploadBtnVisible=!0;else{allDone=!0;let groupOk=!this.cfg.groupOutput||!!collectionState.group;doneBtnEnabled=summary.total===summary.succeed&&fitCountRestrictions&&validationOk&&groupOk}this._doneBtnVisible=allDone,this._doneBtnEnabled=doneBtnEnabled,this._uploadBtnVisible=uploadBtnVisible,this._addMoreBtnEnabled=0===summary.total||!tooMany&&!exact,this._addMoreBtnVisible=!exact||this.cfg.multiple,this._hasFiles=summary.total>0,this._latestSummary=summary}_getHeaderText(summary){let localizedText=status=>{let count=summary[status];return"uploading"===status&&(count+=summary.validatingBeforeUploading),this.l10n(`header-${status}`,{count:count})};return localizedText(summary.uploading>0||summary.validatingBeforeUploading>0?"uploading":summary.failed>0?"failed":summary.succeed>0?"succeed":"total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",groupInfo=>{groupInfo&&this._throttledHandleCollectionUpdate()}),this.subConfigValue("filesViewMode",mode=>{this.setAttribute("mode",mode)}),this.sub("*currentActivity",currentActivity=>{this.couldOpenActivity||currentActivity!==this.activityType||(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.uploadCollection.observeCollection(this._throttledHandleCollectionUpdate),this.sub("*collectionErrors",errors=>{let firstError=errors.filter(err=>"SOME_FILES_HAS_ERRORS"!==err.type)[0];if(!firstError){this._commonErrorMessage=null;return}this._commonErrorMessage=firstError.message})}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate),this.uploadCollection.unobserveCollection(this._throttledHandleCollectionUpdate))}render(){return(0,external_lit_.html)`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this._headerText}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this._hasFiles}> ${this.yield("empty",(0,external_lit_.html)`<span>${this.l10n("no-files")}</span>`)} </div><div class="uc-files"><div class="uc-files-wrapper"> ${(0,__rspack_external_lit_directives_repeat_js_fd3099f6.repeat)(this.$["*uploadList"]??[],({uid})=>uid,({uid})=>(0,external_lit_.html)`<uc-file-item .uid=${uid}></uc-file-item>`)} </div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this._handleAdd} ?disabled=${!this._addMoreBtnEnabled} ?hidden=${!this._addMoreBtnVisible} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this._commonErrorMessage} > ${this._commonErrorMessage??""} </div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this._handleCancel}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this._addMoreBtnVisible} ?disabled=${!this._addMoreBtnEnabled} @click=${this._handleAdd} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this._uploadBtnVisible} @click=${this._handleUpload} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this._doneBtnVisible} ?disabled=${!this._doneBtnEnabled} @click=${this._handleDone} > ${this.l10n("done")} </button></div><uc-drop-area ghost></uc-drop-area>`}constructor(...args){super(...args),this.couldBeCtxOwner=!0,this.historyTracked=!0,this.activityType=LitActivityBlock.S.activities.UPLOAD_LIST,this._doneBtnVisible=!1,this._doneBtnEnabled=!1,this._uploadBtnVisible=!1,this._addMoreBtnVisible=!1,this._addMoreBtnEnabled=!1,this._commonErrorMessage=null,this._hasFiles=!1,this._latestSummary=null,this._handleAdd=()=>{this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(!0)},this._handleUpload=()=>{this.emit(EventEmitter.Bx.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},this._handleDone=()=>{this.emit(EventEmitter.Bx.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},this._handleCancel=()=>{this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll()},this._throttledHandleCollectionUpdate=(0,throttle.n)(()=>{this.isConnected&&(this._updateUploadsState(),this.couldOpenActivity||this.$["*currentActivity"]!==this.activityType||this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll())},300)}}UploadList_ts_decorate([(0,decorators_js_.state)()],UploadList.prototype,"_doneBtnVisible",void 0),UploadList_ts_decorate([(0,decorators_js_.state)()],UploadList.prototype,"_doneBtnEnabled",void 0),UploadList_ts_decorate([(0,decorators_js_.state)()],UploadList.prototype,"_uploadBtnVisible",void 0),UploadList_ts_decorate([(0,decorators_js_.state)()],UploadList.prototype,"_addMoreBtnVisible",void 0),UploadList_ts_decorate([(0,decorators_js_.state)()],UploadList.prototype,"_addMoreBtnEnabled",void 0),UploadList_ts_decorate([(0,decorators_js_.state)()],UploadList.prototype,"_commonErrorMessage",void 0),UploadList_ts_decorate([(0,decorators_js_.state)()],UploadList.prototype,"_hasFiles",void 0),UploadList_ts_decorate([(0,decorators_js_.state)()],UploadList.prototype,"_latestSummary",void 0);var UrlSource=__webpack_require__(8130),CameraSource=__webpack_require__(4252),Config=__webpack_require__(8183);let DropzoneState=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),RESET_EVENTS=["focus"],nearnessRegistry=new Map;function addDropzone(desc){let eventCounter=0,body=document.body,switchHandlers=new Set,state=DropzoneState.INACTIVE,setState=newState=>{desc.shouldIgnore()&&newState!==DropzoneState.INACTIVE||(state!==newState&&switchHandlers.forEach(fn=>{fn(newState)}),state=newState)};switchHandlers.add(newState=>desc.onChange(newState));let onResetEvent=()=>{eventCounter=0,setState(DropzoneState.INACTIVE)},onDragEnter=()=>{eventCounter+=1,state===DropzoneState.INACTIVE&&setState(DropzoneState.ACTIVE)},onDragLeave=()=>{(eventCounter-=1)>0||setState(DropzoneState.INACTIVE)},onDrop=event=>{event.preventDefault(),eventCounter=0,setState(DropzoneState.INACTIVE)},onDragOver=event=>{let cx,cy;if(desc.shouldIgnore())return;eventCounter>0||(eventCounter+=1);let dragPoint=[event.x,event.y],targetRect=desc.element.getBoundingClientRect(),nearness=Math.floor((cx=Math.max(Math.min(dragPoint[0],targetRect.x+targetRect.width),targetRect.x),cy=Math.max(Math.min(dragPoint[1],targetRect.y+targetRect.height),targetRect.y),Math.sqrt((dragPoint[0]-cx)*(dragPoint[0]-cx)+(dragPoint[1]-cy)*(dragPoint[1]-cy)))),isNear=nearness<100,isOver=event.composedPath().includes(desc.element);nearnessRegistry.set(desc.element,nearness);let isNearest=Math.min(...nearnessRegistry.values())===nearness;isOver&&isNearest?(event.preventDefault(),setState(DropzoneState.OVER)):isNear&&isNearest?setState(DropzoneState.NEAR):setState(DropzoneState.ACTIVE)},onElementDrop=async event=>{if(desc.shouldIgnore())return;event.preventDefault();let{dataTransfer}=event;if(!dataTransfer)return;let items=await function(dataTransfer){let dropItems=[],promises=[];for(let i=0;i<dataTransfer.items.length;i++){let item=dataTransfer.items[i];if(item)if("file"===item.kind){let itemType=item.type;if("function"==typeof item.webkitGetAsEntry||"function"==typeof item.getAsEntry){let entry="function"==typeof item.webkitGetAsEntry?item.webkitGetAsEntry():item.getAsEntry?.();entry&&promises.push((function(webkitEntry,dataTransferItemType){return new Promise(resolve=>{let reading=0,dropItems=[],readEntry=entry=>{if(!entry){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),resolve(null);return}entry.isFile?(reading++,entry.file(file=>{reading--;let clonedFile=new File([file],file.name,{type:file.type||dataTransferItemType});dropItems.push({type:"file",file:clonedFile,fullPath:entry.fullPath}),0===reading&&resolve(dropItems)})):entry.isDirectory&&readReaderContent(entry.createReader())},readReaderContent=reader=>{reading++,reader.readEntries(entries=>{for(let entry of(reading--,entries))readEntry(entry);0===reading&&resolve(dropItems)})};readEntry(webkitEntry)})})(entry,itemType).then(items=>{items&&dropItems.push(...items)}));continue}let file=item.getAsFile();file&&promises.push((function(file){return new Promise(resolve=>{"function"!=typeof window.FileReader&&resolve(!1);try{let reader=new FileReader;reader.onerror=()=>{resolve(!0)};let onLoad=event=>{"loadend"!==event.type&&reader.abort(),resolve(!1)};reader.onloadend=onLoad,reader.onprogress=onLoad,reader.readAsDataURL(file)}catch{resolve(!1)}})})(file).then(isDirectory=>{isDirectory||dropItems.push({type:"file",file})}))}else"string"===item.kind&&/^text\/uri-list/.test(item.type)&&promises.push(new Promise(resolve=>{item.getAsString(value=>{dropItems.push({type:"url",url:value}),resolve()})}))}return Promise.all(promises).then(()=>dropItems)}(dataTransfer);desc.onItems(items),setState(DropzoneState.INACTIVE)};return body.addEventListener("drop",onDrop),body.addEventListener("dragleave",onDragLeave),body.addEventListener("dragenter",onDragEnter),body.addEventListener("dragover",onDragOver),desc.element.addEventListener("drop",onElementDrop),RESET_EVENTS.forEach(eventName=>{window.addEventListener(eventName,onResetEvent)}),()=>{nearnessRegistry.delete(desc.element),body.removeEventListener("drop",onDrop),body.removeEventListener("dragleave",onDragLeave),body.removeEventListener("dragenter",onDragEnter),body.removeEventListener("dragover",onDragOver),desc.element.removeEventListener("drop",onElementDrop),RESET_EVENTS.forEach(eventName=>{window.removeEventListener(eventName,onResetEvent)})}}function DropArea_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}let dropAreaRegistry=new Set;class DropArea extends LitUploaderBlock.z{static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"]}get _localizedText(){let customText=this.text;return"string"==typeof customText&&customText.length>0?this.l10n(customText)||customText:this.l10n("drop-files-here")}isActive(){if(!this._isEnabled)return!1;let bounds=this.getBoundingClientRect(),hasSize=bounds.width>0&&bounds.height>0,isInViewport=bounds.top>=0&&bounds.left>=0&&bounds.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&bounds.right<=(window.innerWidth||document.documentElement.clientWidth),style=window.getComputedStyle(this),visible="hidden"!==style.visibility&&"none"!==style.display;return hasSize&&visible&&isInViewport}initCallback(){super.initCallback(),dropAreaRegistry.add(this),this._updateIsEnabled(),this._updateVisibility(),this._updateClickableListeners(),this._updateDragStateAttribute(DropzoneState.INACTIVE),this._destroyDropzone=addDropzone({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:state=>{this._updateDragStateAttribute(state)},onItems:items=>{items.length&&(items.forEach(item=>{"url"===item.type?this.api.addFileFromUrl(item.url,{source:UploadSource.pc.DROP_AREA}):"file"===item.type&&this.api.addFileFromObject(item.file,{source:UploadSource.pc.DROP_AREA,fullPath:item.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":LitActivityBlock.S.activities.UPLOAD_LIST}),this.modalManager?.open(LitActivityBlock.S.activities.UPLOAD_LIST)))}}),this.updateComplete.then(()=>this._setupContentWrapperDropzone()),this.subConfigValue("sourceList",value=>{let list=(0,stringToArray.G)(value);this._sourceListAllowsLocal=list.includes(UploadSource.pc.LOCAL),this._updateIsEnabled(),this._updateVisibility()})}willUpdate(changedProperties){super.willUpdate(changedProperties),changedProperties.has("disabled")&&(this._updateIsEnabled(),this._updateVisibility())}updated(changedProperties){super.updated(changedProperties),changedProperties.has("clickable")&&this._updateClickableListeners()}_shouldIgnore(){return!(this._isEnabled&&this._couldHandleFiles())||!!this.fullscreen&&0!==dropAreaRegistry.size&&[...dropAreaRegistry].filter(el=>el!==this).filter(el=>el.isActive()).length>0}_couldHandleFiles(){let isMultiple=this.cfg.multiple,multipleMax=this.cfg.multipleMax,currentFilesCount=this.uploadCollection.size;return(!isMultiple||!multipleMax||!(currentFilesCount>=multipleMax))&&(!!isMultiple||!(currentFilesCount>0))}_updateIsEnabled(){let nextIsEnabled=this._sourceListAllowsLocal&&!this.disabled;this._isEnabled=nextIsEnabled}_updateVisibility(){let shouldBeVisible=this._isEnabled||!this.querySelector("[data-default-slot]");this._isVisible=shouldBeVisible,this.hidden=!shouldBeVisible}_updateDragStateAttribute(state){let stateText=Object.entries(DropzoneState).find(([,value])=>value===state)?.[0].toLowerCase();stateText&&this.setAttribute("drag-state",stateText)}_setupContentWrapperDropzone(){if(this._destroyContentWrapperDropzone)return;let contentWrapperEl=this._contentWrapperRef.value;contentWrapperEl&&(this._destroyContentWrapperDropzone=addDropzone({element:contentWrapperEl,onChange:state=>{let stateText=Object.entries(DropzoneState).find(([,value])=>value===state)?.[0].toLowerCase();stateText&&contentWrapperEl.setAttribute("drag-state",stateText)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()}))}_updateClickableListeners(){this.clickable&&!this._clickableListenersAttached?(this.addEventListener("keydown",this._handleAreaInteraction),this.addEventListener("click",this._handleAreaInteraction),this._clickableListenersAttached=!0):!this.clickable&&this._clickableListenersAttached&&(this.removeEventListener("keydown",this._handleAreaInteraction),this.removeEventListener("click",this._handleAreaInteraction),this._clickableListenersAttached=!1)}disconnectedCallback(){super.disconnectedCallback(),dropAreaRegistry.delete(this),this._destroyDropzone?.(),this._destroyContentWrapperDropzone?.(),this._clickableListenersAttached&&(this.removeEventListener("keydown",this._handleAreaInteraction),this.removeEventListener("click",this._handleAreaInteraction),this._clickableListenersAttached=!1)}render(){return(0,external_lit_.html)` ${this.yield("",(0,external_lit_.html)`<div data-default-slot hidden></div><div ${(0,ref_js_.ref)(this._contentWrapperRef)} class="uc-content-wrapper" ?hidden=${!this._isVisible}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this._localizedText}</span></div>`)} `}constructor(...args){super(...args),this.single=!1,this.ghost=!1,this.disabled=!1,this.clickable=!1,this.withIcon=!1,this.fullscreen=!1,this.initflow=!1,this._isEnabled=!0,this._isVisible=!0,this._destroyDropzone=null,this._destroyContentWrapperDropzone=null,this._contentWrapperRef=(0,ref_js_.createRef)(),this._handleAreaInteraction=event=>{if(event instanceof KeyboardEvent){if("Space"!==event.code&&"Enter"!==event.code)return}else if(!(event instanceof MouseEvent))return;this.initflow?this.api.initFlow():this.api.openSystemDialog()},this._sourceListAllowsLocal=!0,this._clickableListenersAttached=!1}}DropArea_ts_decorate([(0,decorators_js_.property)({type:Boolean,noAccessor:!0})],DropArea.prototype,"single",void 0),DropArea_ts_decorate([(0,decorators_js_.property)({type:Boolean,noAccessor:!0})],DropArea.prototype,"ghost",void 0),DropArea_ts_decorate([(0,decorators_js_.property)({type:Boolean,reflect:!0})],DropArea.prototype,"disabled",void 0),DropArea_ts_decorate([(0,decorators_js_.property)({type:Boolean,reflect:!0})],DropArea.prototype,"clickable",void 0),DropArea_ts_decorate([(0,decorators_js_.property)({type:Boolean,attribute:"with-icon",reflect:!0})],DropArea.prototype,"withIcon",void 0),DropArea_ts_decorate([(0,decorators_js_.property)({type:Boolean,reflect:!0})],DropArea.prototype,"fullscreen",void 0),DropArea_ts_decorate([(0,decorators_js_.property)({type:Boolean,reflect:!0})],DropArea.prototype,"initflow",void 0),DropArea_ts_decorate([(0,decorators_js_.property)({type:String})],DropArea.prototype,"text",void 0),DropArea_ts_decorate([(0,decorators_js_.state)()],DropArea.prototype,"_isEnabled",void 0),DropArea_ts_decorate([(0,decorators_js_.state)()],DropArea.prototype,"_isVisible",void 0);var ExternalSource=__webpack_require__(7860),upload_client_=__webpack_require__(5474);function FileItem_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}let FileItemState=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")});class FileItem extends FileItemConfig{_calculateState(){let entry=this.entry;if(!entry)return;let state=FileItemState.IDLE;entry.getValue("errors").length>0?state=FileItemState.FAILED:entry.getValue("isQueuedForUploading")?state=FileItemState.QUEUED_UPLOADING:entry.getValue("isQueuedForValidation")?state=FileItemState.QUEUED_VALIDATION:entry.getValue("isValidationPending")?state=FileItemState.VALIDATION:entry.getValue("isUploading")?state=FileItemState.UPLOADING:entry.getValue("fileInfo")&&(state=FileItemState.FINISHED),this._handleState(entry,state)}_handleState(entry,state){state===FileItemState.FAILED?this._badgeIcon="badge-error":state===FileItemState.FINISHED&&(this._badgeIcon="badge-success"),state===FileItemState.UPLOADING&&(this._isFocused=!1,this.removeAttribute("focused")),this._isFailed=state===FileItemState.FAILED,this._isUploading=state===FileItemState.UPLOADING,this._isFinished=state===FileItemState.FINISHED,this._updateHintAndProgress(state)}reset(){super.reset(),this._debouncedCalculateState.cancel()}_observerCallback(entries){let[entry]=entries;entry&&entry.isIntersecting&&!this._renderedOnce&&(this._pauseRender=!1,this._renderedOnce=!0)}_handleEntryId(id){this.reset();let entry=this.uploadCollection?.read(id);(this.entry=entry,entry)?(this.subEntry("isQueuedForValidation",()=>{this._debouncedCalculateState()}),this.subEntry("isValidationPending",()=>{this._debouncedCalculateState()}),this.subEntry("uploadProgress",()=>{this._debouncedCalculateState()}),this.subEntry("isQueuedForUploading",()=>{this._debouncedCalculateState()}),this.subEntry("fileName",name=>{this._itemName=name||entry.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this.subEntry("externalUrl",externalUrl=>{this._itemName=entry.getValue("fileName")||externalUrl||this.l10n("file-no-name")}),this.subEntry("fileInfo",()=>{this._debouncedCalculateState()}),this.subEntry("errors",()=>this._debouncedCalculateState()),this.subEntry("isUploading",()=>this._debouncedCalculateState()),this.subEntry("fileSize",()=>this._debouncedCalculateState()),this.subEntry("mimeType",()=>this._debouncedCalculateState()),this.subEntry("isImage",()=>this._debouncedCalculateState()),this.subEntry("fileInfo",()=>this._updatePluginFileActions()),this.subEntry("isUploading",()=>this._updatePluginFileActions()),this.subEntry("errors",()=>this._updatePluginFileActions()),this._calculateState(),this._updatePluginFileActions(),this._applyOnAddHooks(entry)):this._updatePluginFileActions()}async _applyOnAddHooks(entry){let initialFile=entry.getValue("file");if(!initialFile)return;let pluginManager=this._sharedInstancesBag.pluginManager,onAddHooks=(pluginManager?.snapshot().fileHooks??[]).filter(h=>"onAdd"===h.type),file=initialFile,mimeType=entry.getValue("mimeType");for(let hook of onAddHooks)try{({file,mimeType}=await hook.handler({file,mimeType}))}catch(error){this.debugPrint(`File hook "onAdd" from plugin "${hook.pluginId}" failed`,error)}file!==initialFile&&(entry.setValue("file",file),entry.setValue("fileSize",file.size)),mimeType!==entry.getValue("mimeType")&&entry.setValue("mimeType",mimeType)}_updateShowFileNames(value){if("list"===this.cfg.filesViewMode){this._showFileNames=!0;return}this._showFileNames=value}willUpdate(changedProperties){super.willUpdate(changedProperties),changedProperties.has("uid")&&this._handleEntryId(this.uid)}_updatePluginFileActions(){let pluginManager=this._sharedInstancesBag.pluginManager;if(!pluginManager||!this.uid){this._pluginFileActions=[];return}let allFileActions=pluginManager.snapshot().fileActions,outputFileEntry=this.api.getOutputItem(this.uid);if(!outputFileEntry){this._pluginFileActions=[];return}this._pluginFileActions=allFileActions.filter(action=>{try{return action.shouldRender(outputFileEntry)}catch(error){return console.error(`Error in plugin file action shouldRender (${action.id}):`,error),!1}})}_handlePluginFileAction(action){if(!this.uid)return;let outputFileEntry=this.api.getOutputItem(this.uid);if(outputFileEntry)try{action.onClick(outputFileEntry)}catch(error){console.error(`Error in plugin file action onClick (${action.id}):`,error)}}initCallback(){super.initCallback(),this._handleEntryId(this.uid),this.subConfigValue("filesViewMode",mode=>{this._updateShowFileNames(this.cfg.gridShowFileNames),this.setAttribute("mode",mode)}),this.subConfigValue("gridShowFileNames",value=>{this._updateShowFileNames(value)}),this.onclick=()=>{FileItem.activeInstances.forEach(inst=>{inst===this?inst.setAttribute("focused",""):inst.removeAttribute("focused")})},this.sub("*uploadTrigger",itemsToUpload=>{(!this.entry||itemsToUpload.has(this.entry.uid))&&setTimeout(()=>this.isConnected&&this._upload())});let pluginManager=this._sharedInstancesBag.pluginManager;pluginManager?.onPluginsChange&&(this._unsubscribePlugins=pluginManager.onPluginsChange(()=>this._updatePluginFileActions())),this._updatePluginFileActions(),FileItem.activeInstances.add(this)}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback(),this._observer?.disconnect(),FileItem.activeInstances.delete(this),this.reset()}static{this.activeInstances=new Set}shouldUpdate(changedProperties){return!this._pauseRender&&super.shouldUpdate(changedProperties)}render(){return(0,external_lit_.html)`<div class="uc-inner" ?data-finished=${this._isFinished} ?data-uploading=${this._isUploading} ?data-failed=${this._isFailed} ?data-focused=${this._isFocused} ><uc-thumb .uid=${this.uid} .badgeIcon=${this._badgeIcon}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this._ariaLabelStatusFile}><span class="uc-file-name" ?hidden=${!this._showFileNames}>${this._itemName}</span><span class="uc-file-error" ?hidden=${!this._errorText}>${this._errorText}</span><span class="uc-file-hint" ?hidden=${!this._hint}>${this._hint}</span></div><div class="uc-file-actions"> ${this._pluginFileActions.map(action=>(0,external_lit_.html)`<button type="button" @click=${()=>this._handlePluginFileAction(action)} title=${action.id} aria-label=${action.id} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${action.id} ><uc-icon name=${action.icon}></uc-icon></button>`)} <button type="button" @click=${this._handleRemove} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this._handleUploadClick}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this._progressValue} .visible=${this._progressVisible} ?hasFileName=${this._showFileNames}></uc-progress-bar></div>`}constructor(...args){super(...args),this.couldBeCtxOwner=!0,this._pauseRender=!0,this.uid="",this._itemName="",this._errorText="",this._hint="",this._progressValue=0,this._progressVisible=!1,this._badgeIcon="",this._isFinished=!1,this._isFailed=!1,this._isUploading=!1,this._isFocused=!1,this._showFileNames=!1,this._ariaLabelStatusFile="",this._pluginFileActions=[],this._renderedOnce=!1,this._handleRemove=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid)},this._handleUploadClick=()=>{this._upload()},this._debouncedCalculateState=(0,debounce.s)(()=>this._calculateState(),100),this._updateHintAndProgress=this.withEntry((0,throttle.n)((entry,state)=>{let errorText=entry.getValue("errors")?.[0]?.message??"",source=entry.getValue("source"),externalUrl=entry.getValue("externalUrl"),isFinished=state===FileItemState.FINISHED,isUploading=state===FileItemState.UPLOADING,isQueuedForUploading=state===FileItemState.QUEUED_UPLOADING,isQueuedForValidation=state===FileItemState.QUEUED_VALIDATION,isValidationPending=state===FileItemState.VALIDATION,fileName=entry.getValue("fileName"),hint="";errorText?hint="":!isFinished&&externalUrl&&source&&Object.values(UploadSource.y5).includes(source)&&(hint=this.l10n("waiting-for",{source:this.l10n(`src-type-${source}`)})),this._hint=hint,this._errorText=errorText,this._progressVisible=isUploading||isQueuedForUploading||isQueuedForValidation||isValidationPending,this._progressValue=isQueuedForValidation||isValidationPending?0:entry.getValue("uploadProgress"),this._ariaLabelStatusFile=fileName?this.l10n("a11y-file-item-status",{fileName,status:this.l10n(state?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):""},100)),this._upload=this.withEntry(async entry=>{if(!this.uploadCollection.read(entry.uid)||entry.getValue("fileInfo")||entry.getValue("isUploading")||entry.getValue("errors").length>0||entry.getValue("isValidationPending"))return;let multipleMax=this.cfg.multiple?this.cfg.multipleMax:1;if(!multipleMax||!(this.uploadCollection.size>multipleMax)){entry.setMultipleValues({isUploading:!0,errors:[],isQueuedForUploading:!0}),this._debouncedCalculateState();try{let abortController=new AbortController;entry.setValue("abortController",abortController);let uploadTask=async()=>{entry.setValue("isQueuedForUploading",!1);let file=entry.getValue("file");if(file instanceof File||file instanceof Blob){let pluginManager=this._sharedInstancesBag.pluginManager;for(let hook of(pluginManager?.snapshot().fileHooks??[]).filter(h=>"beforeUpload"===h.type))try{let{file:newFile,mimeType:newMimeType}=await hook.handler({file,mimeType:entry.getValue("mimeType")});file=newFile,newMimeType!==entry.getValue("mimeType")&&entry.setValue("mimeType",newMimeType)}catch(error){this.debugPrint(`File hook "beforeUpload" from plugin "${hook.pluginId}" failed`,error)}}let fileInput=file||entry.getValue("externalUrl")||entry.getValue("uuid");if(!fileInput)throw Error("No file input");let uploadClientOptions={...await this.getUploadClientOptions(),fileName:entry.getValue("fileName")??void 0,source:entry.getValue("source")??void 0,onProgress:progress=>{if(progress.isComputable){let percentage=100*progress.value;entry.setValue("uploadProgress",percentage)}},signal:abortController.signal,metadata:await this.getMetadataFor(entry.uid)};return this.debugPrint("upload options",fileInput,uploadClientOptions),(0,upload_client_.uploadFile)(fileInput,uploadClientOptions)},fileInfo=await this.$["*uploadQueue"].add(uploadTask);entry.setMultipleValues({fileInfo,isQueuedForUploading:!1,isUploading:!1,fileName:fileInfo.originalFilename,fileSize:fileInfo.size,isImage:fileInfo.isImage??!1,mimeType:fileInfo.contentInfo?.mime?.mime??fileInfo.mimeType,uuid:fileInfo.uuid,cdnUrl:entry.getValue("cdnUrl")??fileInfo.cdnUrl,cdnUrlModifiers:entry.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:entry.getValue("source")??null}),entry===this.entry&&this._debouncedCalculateState()}catch(cause){this.telemetryManager.sendEventError(cause,"file upload. Failed to upload file"),cause instanceof upload_client_.CancelError&&cause.isCancel?entry.setMultipleValues({isUploading:!1,uploadProgress:0}):cause instanceof upload_client_.UploadcareError?entry.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:cause}):(console.error("Unknown upload error",cause),entry.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:Error("Something went wrong",{cause})})),entry===this.entry&&this._debouncedCalculateState()}}})}}function SimpleBtn_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_pauseRender",void 0),FileItem_ts_decorate([(0,decorators_js_.property)({attribute:!1})],FileItem.prototype,"uid",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_itemName",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_errorText",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_hint",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_progressValue",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_progressVisible",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_badgeIcon",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_isFinished",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_isFailed",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_isUploading",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_isFocused",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_showFileNames",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_ariaLabelStatusFile",void 0),FileItem_ts_decorate([(0,decorators_js_.state)()],FileItem.prototype,"_pluginFileActions",void 0);class SimpleBtn extends LitUploaderBlock.z{static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"]}initCallback(){super.initCallback(),this.subConfigValue("multiple",val=>{this._buttonTextKey=val?"upload-files":"upload-file"})}render(){return(0,external_lit_.html)`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this._handleClick}><uc-icon name="upload"></uc-icon><span>${this.l10n(this._buttonTextKey)}</span> ${this.yield("")} <div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}constructor(...args){super(...args),this.couldBeCtxOwner=!0,this.dropzone=!0,this._buttonTextKey="upload-file",this._handleClick=()=>{this.api.initFlow()}}}function PluginActivityRenderer_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}SimpleBtn_ts_decorate([(0,decorators_js_.property)({attribute:"dropzone",type:Boolean})],SimpleBtn.prototype,"dropzone",void 0),SimpleBtn_ts_decorate([(0,decorators_js_.state)()],SimpleBtn.prototype,"_buttonTextKey",void 0);class PluginActivityHost extends LitActivityBlock.S{initCallback(){this.activityType=this.registration?.id??null,super.initCallback(),this._ensureRegistered()}willUpdate(changedProperties){super.willUpdate(changedProperties),changedProperties.has("registration")&&(this._ensureRegistered(),this.isActivityActive&&(this._disposeActivity(),this._renderActivity()))}_ensureRegistered(){!this.registration||this._isActivityRegistered()||this.registerActivity(this.activityType??"",{onActivate:()=>this._renderActivity(),onDeactivate:()=>this._disposeActivity()})}_renderActivity(){let container=this._containerRef.value;if(!container||!this.registration)return;this._disposeActivity();let activityParams=this.$["*currentActivityParams"];this._dispose=this.registration.render(container,activityParams)??void 0}_disposeActivity(){this._dispose?.(),this._dispose=void 0;let container=this._containerRef.value;container&&container.replaceChildren()}disconnectedCallback(){this._disposeActivity(),super.disconnectedCallback()}render(){return(0,external_lit_.html)`<div style="display: flex; flex-direction: column; width: 100%; min-height: 0;" ${(0,ref_js_.ref)(this._containerRef)} ></div>`}constructor(...args){super(...args),this.activityType=null,this._containerRef=(0,ref_js_.createRef)()}}PluginActivityRenderer_ts_decorate([(0,decorators_js_.property)({attribute:!1})],PluginActivityHost.prototype,"registration",void 0);class PluginActivityRenderer extends LitBlock.x{initCallback(){super.initCallback();let pluginManager=this._sharedInstancesBag.pluginManager;pluginManager?.onPluginsChange&&(this._unsubscribePlugins=pluginManager.onPluginsChange(()=>this._syncActivities())),this._syncActivities()}_syncActivities(){let pluginManager=this._sharedInstancesBag.pluginManager;if(!pluginManager){this._activities=[];return}this._activities=pluginManager.snapshot().activities}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback()}render(){return"inline"===this.mode?(0,external_lit_.html)`${(0,__rspack_external_lit_directives_repeat_js_fd3099f6.repeat)(this._activities,activity=>activity.id,activity=>(0,external_lit_.html)`<uc-plugin-activity-host .registration=${activity}></uc-plugin-activity-host>`)}`:(0,external_lit_.html)`${(0,__rspack_external_lit_directives_repeat_js_fd3099f6.repeat)(this._activities,activity=>activity.id,activity=>(0,external_lit_.html)`<uc-modal id=${activity.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${activity}></uc-plugin-activity-host></uc-modal>`)}`}constructor(...args){super(...args),this.mode="modal",this._activities=[]}}PluginActivityRenderer_ts_decorate([(0,decorators_js_.property)({type:String})],PluginActivityRenderer.prototype,"mode",void 0),PluginActivityRenderer_ts_decorate([(0,decorators_js_.state)()],PluginActivityRenderer.prototype,"_activities",void 0);class FileUploaderRegular extends LitSolutionBlock{static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"]}constructor(){super(),this.headless=!1,this.init$={...this.init$}}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.INIT_SOLUTION})}render(){return(0,external_lit_.html)`${super.render()} <uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}}!function(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);c>3&&r&&Object.defineProperty(target,key,r)}([(0,decorators_js_.property)({type:Boolean})],FileUploaderRegular.prototype,"headless",void 0);class FileUploaderInline extends LitSolutionBlock{static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"]}constructor(){super(),this._couldCancel=!1,this._handleCancel=()=>{if(this._couldHistoryBack){let historyBack=this.$["*historyBack"];historyBack?.();return}this._couldShowList&&(this.$["*currentActivity"]=LitActivityBlock.S.activities.UPLOAD_LIST)},this.init$={...this.init$}}get _couldHistoryBack(){let history=this.$["*history"];return!!history&&!(history.length<=1)&&history[history.length-1]!==LitActivityBlock.S.activities.START_FROM}get _couldShowList(){let uploadList=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(uploadList)&&uploadList.length>0}_getInitActivity(){return this.getCssData("--cfg-init-activity")||LitActivityBlock.S.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.INIT_SOLUTION});let initActivity=this._getInitActivity();this.sub("*currentActivity",val=>{val||(this.$["*currentActivity"]=initActivity)}),this.sub("*uploadList",list=>{Array.isArray(list)&&list.length>0&&this.$["*currentActivity"]===initActivity&&(this.$["*currentActivity"]=LitActivityBlock.S.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this._couldCancel=this._couldHistoryBack||this._couldShowList})}render(){return(0,external_lit_.html)`${super.render()} <uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this._handleCancel} ?hidden=${!this._couldCancel} > ${this.l10n("start-from-cancel")} </button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}}function FileUploaderMinimal_ts_decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}!function(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);c>3&&r&&Object.defineProperty(target,key,r)}([(0,decorators_js_.state)()],FileUploaderInline.prototype,"_couldCancel",void 0);let ACTIVE_CLASS="active";class FileUploaderMinimal extends LitSolutionBlock{static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"]}_getInitActivity(){return this.getCssData("--cfg-init-activity")||LitActivityBlock.S.activities.START_FROM}constructor(){super(),this._singleUpload=!1,this._isHiddenStartFrom=!1,this._classUploadList="",this._classStartFrom="",this._handleModalOpen=data=>{data.id===LitActivityBlock.S.activities.CLOUD_IMG_EDIT&&(this._classUploadList=ACTIVE_CLASS),this.$["*currentActivity"]===LitActivityBlock.S.activities.UPLOAD_LIST&&(this._classUploadList=ACTIVE_CLASS,this._isHiddenStartFrom=!0);let uploadList=this.$["*uploadList"];(!uploadList||uploadList.length<=0)&&(this._classStartFrom=ACTIVE_CLASS)},this._handleModalClose=data=>{data.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=LitActivityBlock.S.activities.UPLOAD_LIST,this._isHiddenStartFrom=!1),data.id===LitActivityBlock.S.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=LitActivityBlock.S.activities.UPLOAD_LIST)},this.init$={...this.init$}}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.INIT_SOLUTION});let initActivity=this._getInitActivity();this.sub("*currentActivity",val=>{val===LitActivityBlock.S.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),val||(this.$["*currentActivity"]=initActivity)}),this.sub("*uploadList",list=>{Array.isArray(list)&&list.length>0?(this.$["*currentActivity"]=LitActivityBlock.S.activities.UPLOAD_LIST,this._classStartFrom=""):(this._classUploadList="",this._isHiddenStartFrom=!1,this.$["*currentActivity"]=initActivity)}),this.subConfigValue("confirmUpload",confirmUpload=>{!1!==confirmUpload&&(this.cfg.confirmUpload=!1)}),this.subConfigValue("filesViewMode",mode=>{this.setAttribute("mode",mode),this.subConfigValue("multiple",multiple=>{"grid"===mode?(multiple?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this._singleUpload=!multiple):(this.style.removeProperty("--uc-grid-col"),this._singleUpload=!1)})}),this.modalManager?.subscribe(ModalManager.D.OPEN,this._handleModalOpen),this.modalManager?.subscribe(ModalManager.D.CLOSE,this._handleModalClose)}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(ModalManager.D.OPEN,this._handleModalOpen),this.modalManager?.unsubscribe(ModalManager.D.CLOSE,this._handleModalClose)}render(){return(0,external_lit_.html)`${super.render()} <uc-start-from ?hidden=${this._isHiddenStartFrom} class=${this._classStartFrom}><uc-drop-area ?single=${this._singleUpload} initflow clickable tabindex="0" ><span>${this.l10n("choose-file")}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this._classUploadList}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}}FileUploaderMinimal_ts_decorate([(0,decorators_js_.state)()],FileUploaderMinimal.prototype,"_singleUpload",void 0),FileUploaderMinimal_ts_decorate([(0,decorators_js_.state)()],FileUploaderMinimal.prototype,"_isHiddenStartFrom",void 0),FileUploaderMinimal_ts_decorate([(0,decorators_js_.state)()],FileUploaderMinimal.prototype,"_classUploadList",void 0),FileUploaderMinimal_ts_decorate([(0,decorators_js_.state)()],FileUploaderMinimal.prototype,"_classStartFrom",void 0)})();var __webpack_exports__ActivityBlock=__webpack_exports__.hC,__webpack_exports__ActivityHeader=__webpack_exports__.vr,__webpack_exports__BaseComponent=__webpack_exports__.$G,__webpack_exports__Block=__webpack_exports__.eB,__webpack_exports__CameraSource=__webpack_exports__.ru,__webpack_exports__Config=__webpack_exports__.TS,__webpack_exports__Copyright=__webpack_exports__.Y0,__webpack_exports__Data=__webpack_exports__.B_,__webpack_exports__DropArea=__webpack_exports__.JU,__webpack_exports__ExternalSource=__webpack_exports__.Bp,__webpack_exports__ExternalUploadSource=__webpack_exports__.y5,__webpack_exports__FileItem=__webpack_exports__.I3,__webpack_exports__FileUploaderInline=__webpack_exports__.Az,__webpack_exports__FileUploaderMinimal=__webpack_exports__.eK,__webpack_exports__FileUploaderRegular=__webpack_exports__.vY,__webpack_exports__FormInput=__webpack_exports__.ZQ,__webpack_exports__Icon=__webpack_exports__.In,__webpack_exports__Img=__webpack_exports__.E9,__webpack_exports__Modal=__webpack_exports__.aF,__webpack_exports__ModalEvents=__webpack_exports__.Do,__webpack_exports__PACKAGE_NAME=__webpack_exports__.rM,__webpack_exports__PACKAGE_VERSION=__webpack_exports__.i8,__webpack_exports__PluginActivityHost=__webpack_exports__.rt,__webpack_exports__PluginActivityRenderer=__webpack_exports__.wB,__webpack_exports__ProgressBar=__webpack_exports__.z2,__webpack_exports__ProgressBarCommon=__webpack_exports__.qB,__webpack_exports__Select=__webpack_exports__.l6,__webpack_exports__SimpleBtn=__webpack_exports__.jj,__webpack_exports__SolutionBlock=__webpack_exports__.Vd,__webpack_exports__SourceBtn=__webpack_exports__.s9,__webpack_exports__SourceList=__webpack_exports__.Ar,__webpack_exports__Spinner=__webpack_exports__.y$,__webpack_exports__StartFrom=__webpack_exports__.Zz,__webpack_exports__Thumb=__webpack_exports__.zi,__webpack_exports__UID=__webpack_exports__.V0,__webpack_exports__UploadCtxProvider=__webpack_exports__._Q,__webpack_exports__UploadList=__webpack_exports__.cx,__webpack_exports__UploadSource=__webpack_exports__.pc,__webpack_exports__UploaderBlock=__webpack_exports__.iE,__webpack_exports__UrlSource=__webpack_exports__.Ts,__webpack_exports__defineComponents=__webpack_exports__.Yi,__webpack_exports__defineLocale=__webpack_exports__.mO,__webpack_exports__loadFileUploaderFrom=__webpack_exports__.DJ,__webpack_exports__toKebabCase=__webpack_exports__.fX;export{__webpack_exports__ActivityBlock as ActivityBlock,__webpack_exports__ActivityHeader as ActivityHeader,__webpack_exports__BaseComponent as BaseComponent,__webpack_exports__Block as Block,__webpack_exports__CameraSource as CameraSource,__webpack_exports__Config as Config,__webpack_exports__Copyright as Copyright,__webpack_exports__Data as Data,__webpack_exports__DropArea as DropArea,__webpack_exports__ExternalSource as ExternalSource,__webpack_exports__ExternalUploadSource as ExternalUploadSource,__webpack_exports__FileItem as FileItem,__webpack_exports__FileUploaderInline as FileUploaderInline,__webpack_exports__FileUploaderMinimal as FileUploaderMinimal,__webpack_exports__FileUploaderRegular as FileUploaderRegular,__webpack_exports__FormInput as FormInput,__webpack_exports__Icon as Icon,__webpack_exports__Img as Img,__webpack_exports__Modal as Modal,__webpack_exports__ModalEvents as ModalEvents,__webpack_exports__PACKAGE_NAME as PACKAGE_NAME,__webpack_exports__PACKAGE_VERSION as PACKAGE_VERSION,__webpack_exports__PluginActivityHost as PluginActivityHost,__webpack_exports__PluginActivityRenderer as PluginActivityRenderer,__webpack_exports__ProgressBar as ProgressBar,__webpack_exports__ProgressBarCommon as ProgressBarCommon,__webpack_exports__Select as Select,__webpack_exports__SimpleBtn as SimpleBtn,__webpack_exports__SolutionBlock as SolutionBlock,__webpack_exports__SourceBtn as SourceBtn,__webpack_exports__SourceList as SourceList,__webpack_exports__Spinner as Spinner,__webpack_exports__StartFrom as StartFrom,__webpack_exports__Thumb as Thumb,__webpack_exports__UID as UID,__webpack_exports__UploadCtxProvider as UploadCtxProvider,__webpack_exports__UploadList as UploadList,__webpack_exports__UploadSource as UploadSource,__webpack_exports__UploaderBlock as UploaderBlock,__webpack_exports__UrlSource as UrlSource,__webpack_exports__defineComponents as defineComponents,__webpack_exports__defineLocale as defineLocale,__webpack_exports__loadFileUploaderFrom as loadFileUploaderFrom,__webpack_exports__toKebabCase as toKebabCase};
|
|
1
|
+
import {subscribeKeys,listenKeys,map}from'nanostores';import {html,LitElement,nothing}from'lit';import {createContext,ContextConsumer,ContextProvider}from'@lit/context';import {property,state}from'lit/decorators.js';import {Queue,uploadFile,CancelError,UploadcareError,uploadFileGroup,getUserAgent,UploadError,NetworkError}from'@uploadcare/upload-client';import {startKeyUX,focusGroupKeyUX,pressKeyUX,jumpKeyUX,hiddenKeyUX}from'keyux';import {TelemetryAPIService}from'@uploadcare/quality-insights';import {unsafeSVG}from'lit/directives/unsafe-svg.js';import {createRef,ref}from'lit/directives/ref.js';import {repeat}from'lit/directives/repeat.js';import {getPrefixedCdnBaseAsync,isPrefixedCdnBase}from'@uploadcare/cname-prefix/async';import {when}from'lit/directives/when.js';import {classMap}from'lit/directives/class-map.js';import {ifDefined}from'lit/directives/if-defined.js';import {styleMap}from'lit/directives/style-map.js';import {shrinkFile}from'@uploadcare/image-shrink';/**
|
|
2
|
+
* @license
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.28.0-alpha.666 (MIT)
|
|
4
|
+
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
+
* Built: 2026-03-12T12:25:56.546Z
|
|
6
|
+
*/
|
|
7
|
+
var Yr=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var Xr=(r,o)=>{for(var e in o)Yr(r,e,{get:o[e],enumerable:true});};var d=(r,o,e,t)=>{for(var i=t>1?void 0:t?cn(o,e):o,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(o,e,i):n(i))||i);return t&&i&&Yr(o,e,i),i};var O=class r{static{this._contexts=new Map;}constructor(o,e){this._ctxId=o,this._store=e;}get id(){return this._ctxId}pub(o,e){o in this._store.get()||console.warn(`PubSub#pub: Key "${String(o)}" not found`),this._store.setKey(o,e);}sub(o,e,t=true){return (t?subscribeKeys:listenKeys)(this._store,[o],s=>{e(s[o]);})}read(o){return o in this._store.get()||console.warn(`PubSub#read: Key "${String(o)}" not found`),this._store.get()[o]}add(o,e,t=false){(!(o in this._store.get())||t)&&this._store.setKey(o,e);}has(o){return o in this._store.get()}get store(){return this._store.get()}static registerCtx(o,e){if(r._contexts.has(e))throw new Error(`PubSub: Context with id "${e}" already exists`);let t=map(o);return r._contexts.set(e,t),new r(e,t)}static deleteCtx(o){r._contexts.delete(o);}static getCtx(o){let e=r._contexts.get(o);return e?new r(o,e):null}static hasCtx(o){return r._contexts.has(o)}};var hn=/\\([0-9a-fA-F]{1,6} ?)/g;function mn(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function fn(r){let o=r;return (o[0]==='"'||o[0]==="'")&&(o=o.slice(1)),(o[o.length-1]==='"'||o[o.length-1]==="'")&&(o=o.slice(0,-1)),o}function gn(r){let o="",e="";for(let t=0;t<r.length;t++){let i=r[t+1];r[t]==="\\"&&i==='"'?(o+='\\"',t++):r[t]==='"'&&e!=="\\"?o+='\\"':o+=r[t],e=r[t]??"";}return o}function Qr(r){let o=r;mn(r)&&(o=fn(o),o=o.replace(hn,(e,t)=>String.fromCodePoint(parseInt(t.trim(),16))),o=o.replaceAll(`\\ `,"\\n"),o=gn(o),o='"'+o+'"');try{return JSON.parse(o)}catch{return}}function Be(r){class o extends r{constructor(){super(...arguments);this._cssDataCache=null;this._computedStyle=null;}getCssData(i,s=false){let n=this._cssDataCache??Object.create(null);if(!Object.keys(n).includes(i)||!n[i]){this._computedStyle||(this._computedStyle=window.getComputedStyle(this));let a=this._computedStyle.getPropertyValue(i).trim();try{n[i]=Qr(a);}catch(l){s||console.warn(`CSS Data error: ${i}`,l),n[i]=null;}}return this._cssDataCache=n,n[i]}}return o}function Bt(r){class o extends r{constructor(){super(...arguments);this.willYield=true;this._slotsMap={};this._initialLightDomChildren=null;this._hasAdoptedChildren=false;}createRenderRoot(){return this}connectedCallback(){this._initialLightDomChildren||(this._initialLightDomChildren=Array.from(this.childNodes)),super.connectedCallback();}_adoptChildren(){if(this._hasAdoptedChildren)return;this._hasAdoptedChildren=true,this._slotsMap={};let i=Array.from(this.childNodes),s=i.length?i:this._initialLightDomChildren??[];for(let n of s){let a=this._getSlotNameForChild(n),l=this._slotsMap[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this._slotsMap[a]=l;}this._initialLightDomChildren=null;}_getSlotNameForChild(i){return i instanceof Comment&&i.nextSibling instanceof Element?this._getSlotNameForChild(i.nextSibling):"contentFor"in i?i.contentFor||"":i instanceof Element&&i.hasAttribute("content-for")&&i.getAttribute("content-for")||""}_isTextNodeEmpty(i){return !i.textContent||!i.textContent.trim()}_isSlotEmpty(i){let s=this._slotsMap[i];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this._isTextNodeEmpty(n))}update(i){!this.hasUpdated&&this.willYield&&this._adoptChildren(),super.update(i);}yield(i,s){if(i===""&&!this._slotsMap[i]&&!this._hasAdoptedChildren&&this._initialLightDomChildren?.length){let a=[];for(let l of this._initialLightDomChildren)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this._slotsMap[i]=a,this._hasAdoptedChildren=true,this._initialLightDomChildren=null;}let n=this._slotsMap[i];return html` ${n} ${this._isSlotEmpty(i)?s:void 0} `}}return o}function ze(r){class o extends r{static reg(t){let i=this,s=window.customElements.get(t);if(s){s!==i&&console.warn([`Element with tag name "${t}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(t,i);}}return o}function E(r,o){let e,t=((...i)=>{e&&clearTimeout(e),e=setTimeout(()=>r(...i),o);});return t.cancel=()=>{e&&clearTimeout(e);},t}var Jr=createContext("ctx-name-context");function zt(){return function(r){class o extends r{constructor(...i){super(...i);this._symbioteSharedPubSub=null;this._symbioteFirstUpdated=false;this._needsReconnectInit=false;this._ctxNameProvider=void 0;this._pendingSharedAdds=new Map;this._symbioteSubscriptions=new Set;this.init$={};this.ctxOwner=false;this._ctxNameAttrValue=void 0;this._pendingCtxInitOnConnect=false;this.ctxName=this._effectiveCtxName;this._isInitialized=false;this._ctxNameAttrValue=this.getAttribute("ctx-name")||void 0,this.ctxName=this._effectiveCtxName,this._ctxNameConsumer=new ContextConsumer(this,{context:Jr,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this._ctxNameFromContext=s,this._handleCtxNameSourceChange();},subscribe:true});}static set template(i){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get _ctxNameAttr(){return this._ctxNameAttrValue}set _ctxNameAttr(i){let s=i??void 0;this._ctxNameAttrValue!==s&&(this._ctxNameAttrValue=s,this._handleCtxNameSourceChange());}shouldUpdate(i){return this._isInitialized?super.shouldUpdate(i):false}get _effectiveCtxName(){return this._ctxNameAttr||this._ctxNameFromContext||void 0}_handleCtxNameSourceChange(){if(this.ctxName=this._effectiveCtxName,!(!this.ctxName||this._symbioteFirstUpdated)){if(this.isConnected){this._performInitialization();return}this._pendingCtxInitOnConnect=true;}}willUpdate(i){super.willUpdate(i),this.ctxName=this._effectiveCtxName,this.ctxName&&(this._ctxNameProvider?this._ctxNameProvider.setValue(this.ctxName):this._ctxNameProvider=new ContextProvider(this,{context:Jr,initialValue:this.ctxName}));}_applyPendingSharedAdds(){if(!(!this._symbioteSharedPubSub||this._pendingSharedAdds.size===0)){for(let[i,{value:s,rewrite:n}]of this._pendingSharedAdds)this._symbioteSharedPubSub.add(i,s,n);this._pendingSharedAdds.clear();}}_getSharedPubSub(){return !this._symbioteSharedPubSub&&this._effectiveCtxName&&this._initSharedContext(),this._symbioteSharedPubSub&&this._applyPendingSharedAdds(),this._symbioteSharedPubSub}_requireSharedPubSub(){let i=this._getSharedPubSub();if(!i)throw new Error("SymbioteMixin: Shared context is not initialized.");return i}_initSharedContext(){let i=this.init$,s=this._effectiveCtxName;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this._symbioteSharedPubSub){this._symbioteSharedPubSub=O.getCtx(s)??O.registerCtx(i,s);for(let[n,a]of Object.entries(this.init$))this._symbioteSharedPubSub.add(n,a,this.ctxOwner);this._applyPendingSharedAdds();}}get $(){return this._effectiveCtxName&&this._initSharedContext(),new Proxy({},{get:(i,s)=>{if(typeof s=="string")return this._symbioteSharedPubSub?.read(s)},set:(i,s,n)=>(typeof s!="string"||this._symbioteSharedPubSub?.pub(s,n),true)})}sub(i,s,n=true){let a=this._requireSharedPubSub().sub(i,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,u=()=>{c||(c=true,l(),this._symbioteSubscriptions.delete(u));};return this._symbioteSubscriptions.add(u),u}pub(i,s){this._requireSharedPubSub().pub(i,s);}set$(i){for(let[s,n]of Object.entries(i))this.pub(s,n);}get sharedCtx(){return this._requireSharedPubSub()}has(i){return this._symbioteSharedPubSub?.has(i)??false}add(i,s,n=false){let a=this._getSharedPubSub();if(!a){if(!n&&this._pendingSharedAdds.has(i))return;this._pendingSharedAdds.set(i,{value:s,rewrite:n});return}this._pendingSharedAdds.delete(i),a.add(i,s,n);}add$(i,s=false){for(let[n,a]of Object.entries(i))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this._symbioteFirstUpdated?this._isInitialized&&this._needsReconnectInit&&(this._needsReconnectInit=false,this.initCallback()):this.ctxName?(this._pendingCtxInitOnConnect=false,this._performInitialization()):this._pendingCtxInitOnConnect&&this._effectiveCtxName&&(this._pendingCtxInitOnConnect=false,this._performInitialization());}_performInitialization(){if(this._symbioteFirstUpdated)return;this._symbioteFirstUpdated=true,this._initSharedContext();let i=this.init$;if(Object.keys(i).length>0){let s=this._requireSharedPubSub();for(let[n,a]of Object.entries(i))s.read(n)===void 0&&s.pub(n,a),this.sub(n,E(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this._isInitialized=true,this.requestUpdate();}firstUpdated(i){super.firstUpdated(i);}disconnectedCallback(){this._cleanupSymbioteSubscriptions(),super.disconnectedCallback(),this._symbioteFirstUpdated&&(this._needsReconnectInit=true);}_cleanupSymbioteSubscriptions(){if(this._symbioteSubscriptions.size!==0){for(let i of [...this._symbioteSubscriptions])i();this._symbioteSubscriptions.clear();}}initCallback(){}}return d([property({type:String,attribute:"ctx-name",noAccessor:true})],o.prototype,"_ctxNameAttr",1),d([state()],o.prototype,"_ctxNameFromContext",2),d([state()],o.prototype,"ctxName",2),d([state()],o.prototype,"_isInitialized",2),o}}var Yi=class extends ze(zt()(Be(Bt(LitElement)))){};var ee=class r{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let o=globalThis.crypto;return o&&typeof o.randomUUID=="function"?o.randomUUID():r.generateFastUid()}};var Tn=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function te(r){for(let o in r){if(Tn.includes(o))continue;let e=[...o].reduce((t,i)=>(i.toUpperCase()===i&&(i=`-${i.toLowerCase()}`),t+=i,t),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e=`uc-${e}`),r[o].reg&&r[o].reg(e);}}var Xi="UC";function En(r,o=false){return new Promise((e,t)=>{if(typeof document!="object"){e(null);return}if(typeof window=="object"&&window[Xi]){e(window[Xi]);return}let i=document.createElement("script");i.async=true,i.src=r,i.onerror=()=>{t();},i.onload=()=>{let s=window[Xi];o&&te(s),e(s);},document.head.appendChild(i);})}var pt={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var Qi=new Map,eo=new Map,to=(r,o)=>{Qi.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let e={...pt,...o};return Qi.set(r,e),e},xn=(r,o)=>{eo.set(r,o);},io=(r,o)=>{typeof o=="function"?xn(r,o):to(r,o);},ro=async r=>{let o=Qi.get(r);if(!o){let e=eo.get(r);if(!e)throw new Error(`Locale ${r} is not defined`);let t=await e();o=to(r,t);}return o};io("en",pt);var _=r=>`*cfg/${r}`;var U=r=>r?r.split(",").map(o=>o.trim()).filter(Boolean):[],ye=r=>r.join(",");var oo=r=>{if(typeof r!="string"||!r)return "";let o=r.trim();return o.startsWith("-/")?o=o.slice(2):o.startsWith("/")&&(o=o.slice(1)),o.endsWith("/")&&(o=o.slice(0,o.length-1)),o},Ht=(...r)=>r.filter(o=>typeof o=="string"&&!!o).map(o=>oo(o)).join("/-/"),G=(...r)=>{let o=Ht(...r);return o?`-/${o}/`:""};function Kt(r){let o=new URL(r),e=o.pathname+o.search+o.hash,t=e.lastIndexOf("http"),i=e.lastIndexOf("/"),s="";return t>=0?s=e.slice(t):i>=0&&(s=e.slice(i+1)),s}function jt(r){let o=new URL(r),{pathname:e}=o,t=e.indexOf("/"),i=e.indexOf("/",t+1);return e.substring(t+1,i)}function Ji(r){let o=so(r),e=new URL(o),t=e.pathname.indexOf("/-/");return t===-1?"":e.pathname.substring(t).slice(1)}function er(r){return Ji(r).split("/-/").filter(Boolean).map(e=>oo(e))}function so(r){let o=new URL(r),e=Kt(r),t=no(e)?ao(e).pathname:e;return o.pathname=o.pathname.replace(t,""),o.search="",o.hash="",o.toString()}function no(r){return r.startsWith("http")}function ao(r){let o=new URL(r);return {pathname:`${o.origin}${o.pathname??""}`,search:o.search??"",hash:o.hash??""}}var F=(r,o,e)=>{let t=new URL(so(r)),i=e??Kt(r),s=o??"";if(t.pathname.startsWith("//")&&(t.pathname=t.pathname.replace("//","/")),i&&no(i)){let n=ao(i);t.pathname=`${t.pathname}${s}${n.pathname||""}`,t.search=n.search,t.hash=n.hash;}else t.pathname=`${t.pathname}${s}${i||""}`;return t.toString()},Ie=(r,o)=>{let e=new URL(r);return e.pathname=`${o}/`,e.toString()};var N=(r,o=",")=>r.trim().split(o).map(e=>e.trim()).filter(e=>e.length>0);var ht=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),co=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Sn(r,o){if(typeof o=="number"){let e=o;return ht[r]!==e?`${r}/${e}`:""}if(typeof o=="boolean"){let e=o;return ht[r]!==e?`${r}`:""}if(r==="filter"&&o){let{name:e,amount:t}=o;return ht.filter===t?"":`${r}/${e}/${t}`}if(r==="crop"&&o){let{dimensions:e,coords:t}=o;return `${r}/${e.join("x")}/${t.join(",")}`}return ""}function Ae(r){return Ht(...co.filter(o=>typeof r[o]<"u"&&r[o]!==null).map(o=>{let e=r[o];return Sn(o,e)}).filter(o=>!!o))}var Gt=Ht("format/auto","progressive/yes"),_e=([r])=>typeof r<"u"?Number(r):void 0,lo=()=>true,In=([r,o])=>({name:r,amount:typeof o<"u"?Number(o):100}),An=([r,o])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(o))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:N(r,"x").map(Number),coords:N(o).map(Number)}},kn=Object.freeze({enhance:_e,brightness:_e,exposure:_e,gamma:_e,contrast:_e,saturation:_e,vibrance:_e,warmth:_e,filter:In,mirror:lo,flip:lo,rotate:_e,crop:r=>{let[o,e]=r,{dimensions:t,coords:i}=An([o,e]);return {dimensions:t,coords:i}}});function tr(r){let o={};for(let e of r){let[t,...i]=e.split("/");if(!t||!co.includes(t))continue;let s=t,n=kn[s];try{let a=n(i);o[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${e}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return o}var P=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),W=Object.freeze([P.CROP,P.TUNING,P.FILTERS]),uo=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),po=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),ho=Object.freeze(["rotate","mirror","flip"]),Ce=ht,le=Object.freeze({brightness:{zero:Ce.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Ce.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Ce.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Ce.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Ce.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Ce.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Ce.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Ce.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Ce.filter,range:[0,100],keypointsNumber:1}});var mt="https://ucarecdn.com",Mn="https://upload.uploadcare.com",Pn="https://social.uploadcare.com",On="https://ucarecd.net",Ln={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:mt,cdnCnamePrefixed:On,baseUrl:Mn,socialBaseUrl:Pn,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:ye(W),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[]},H=Object.freeze(Ln);var Wt=(r,o)=>(...e)=>{let t=r();if(!t.read(_("debug")))return;let i=e;if(typeof e?.[0]=="function"){let n=e[0];i=n();}let s=[t.id,o].filter(Boolean);console.log(`[${s.join("][")}]`,...i);};var V=class{constructor(o){this._subscriptions=new Set;this._cfgProxy=null;this._debugPrint=Wt(()=>this._sharedInstancesBag.ctx,this.constructor.name);this._sharedInstancesBag=o,this._ctx=o.ctx;}addSub(o){this._subscriptions.add(o);}get _cfg(){if(!this._cfgProxy){let o={};this._cfgProxy=new Proxy(o,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(e,t)=>{if(typeof t!="string")return;let i=_(t);return this._sharedInstancesBag.ctx.has(i)?this._sharedInstancesBag.ctx.read(i):H[t]}});}return this._cfgProxy}destroy(){for(let o of this._subscriptions)try{o();}catch{}this._subscriptions.clear();}},Rn={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},ce=(r,o,e=true)=>{let t=r.has(o),i=t?r.read(o):null;if(t&&i||!e)return i;throw new Error(`Unexpected error: shared instance for key "${String(o)}" is not available`)},mo=r=>({get ctx(){return r()},get modalManager(){return ce(r(),"*modalManager",false)},get pluginManager(){return ce(r(),"*pluginManager")},get telemetryManager(){return ce(r(),"*telemetryManager")},get localeManager(){return ce(r(),"*localeManager")},get a11y(){return ce(r(),"*a11y")},get blocksRegistry(){return ce(r(),"*blocksRegistry")},get eventEmitter(){return ce(r(),"*eventEmitter")},get uploadCollection(){return ce(r(),"*uploadCollection")},get secureUploadsManager(){return ce(r(),"*secureUploadsManager",false)},get api(){return ce(r(),"*publicApi")},get validationManager(){return ce(r(),"*validationManager")},when(o,e){let t=Rn[o],i=r(),s=i.has(t)?i.read(t):void 0;if(s)return e(s),()=>{};let n=i.sub(t,a=>{a&&(e(a),n());});return n},wait(o){return new Promise(e=>{let t=this.when(o,i=>{e(i),t();});})}});var B=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),qt=class extends V{constructor(){super(...arguments);this._modals=new Map;this._activeModals=new Set;this._subscribers=new Map;}registerModal(e,t){this._modals.set(e,t),this._notify(B.ADD,{id:e,modal:t});}deleteModal(e){let t=this._modals.get(e);return t?(this._modals.delete(e),this._activeModals.delete(e),this._notify(B.DELETE,{id:e,modal:t}),true):false}open(e){let t=this._modals.get(e);return t?(this._activeModals.add(e),this._notify(B.OPEN,{modal:t,id:e}),true):(this._debugPrint(`Modal with ID "${e}" not found`),false)}close(e){let t=this._modals.get(e);return !t||!this._activeModals.has(e)?(this._debugPrint(`Modal with ID "${e}" not found or not active`),false):(this._activeModals.delete(e),this._notify(B.CLOSE,{id:e,modal:t}),true)}toggle(e){return this._modals.has(e)?this._activeModals.has(e)?this.close(e):this.open(e):(this._debugPrint(`Modal with ID "${e}" not found`),false)}get hasActiveModals(){return this._activeModals.size>0}back(){if(this._activeModals.size===0)return this._debugPrint("No active modals to go back from"),false;let e=Array.from(this._activeModals).pop();return e?this.close(e):false}closeAll(){let e=this._activeModals.size;return this._activeModals.clear(),this._notify(B.CLOSE_ALL,{}),e}subscribe(e,t){return this._subscribers.has(e)||this._subscribers.set(e,new Set),this._subscribers.get(e)?.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){this._subscribers.has(e)&&this._subscribers.get(e)?.delete(t);}_notify(e,t){if(this._subscribers.has(e))for(let i of this._subscribers.get(e)??new Set)try{i(t);}catch(s){this._sharedInstancesBag.telemetryManager.sendEventError(s,"modal subscriber"),this._debugPrint("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(B.DESTROY,{});}};var Zt=r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(o=>o.toLowerCase()).join("-");var ir=()=>({}),rr=r=>({...ir(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);}}),or=r=>({...rr(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Queue(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),fo=r=>({...or(r),"*solution":null,"*lazyPlugins":null});var S=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Yt=class extends V{constructor(e){super(e);this.scopes=new Set;this.listener=this._listener.bind(this),window.addEventListener("paste",this.listener);}openUploadList(){this._sharedInstancesBag.api.setCurrentActivity(S.UPLOAD_LIST),this._sharedInstancesBag.api.setModalState(true);}async _listener(e){if(e.clipboardData){for(let t of this.scopes)if(t.isConnected)switch(this._cfg.pasteScope){case "global":await this.handlePaste(e);break;case "local":if(!t.contains(e.target))continue;await this.handlePaste(e);break;default:continue}}}async handlePaste(e){if(!e.clipboardData)return;let t=Array.from(e.clipboardData.items),i=t.map(n=>n.getAsFile()).filter(n=>n!==null),s=t.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(a=>{n.getAsString(l=>{a(l);});}));i.length>0&&(i.forEach(n=>{this._sharedInstancesBag.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(a=>{this._sharedInstancesBag.api.addFileFromUrl(a,{source:"clipboard"});}),this.openUploadList());}registerBlock(e){return this.scopes.add(e),()=>{this.scopes.delete(e);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var sr=class{constructor(){this._listeners=new Map;this._scope=[];}addEventListener(o,e){let t=i=>{let s=i.target;s instanceof Node&&this._scope.some(n=>n===s||n.contains(s))&&e(i);};this._listeners.set(e,t),window.addEventListener(o,t);}removeEventListener(o,e){let t=this._listeners.get(e);t&&window.removeEventListener(o,t),this._listeners.delete(e);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(o){this._scope.push(o);}destroy(){this._scope=[];for(let o of this._listeners.values())window.removeEventListener("keydown",o),window.removeEventListener("keyup",o);this._listeners.clear();}},Xt=class{constructor(){this._scopedWindow=new sr,this._destroyKeyUX=startKeyUX(this._scopedWindow,[focusGroupKeyUX(),pressKeyUX("is-pressed"),jumpKeyUX(),hiddenKeyUX()]);}registerBlock(o){this._scopedWindow.registerScope(o);}destroy(){this._destroyKeyUX?.(),this._scopedWindow.destroy();}};var we=r=>`*l10n/${r}`,Bn="en",Qt=class extends V{constructor(e){super(e);this._localeName="";for(let[i,s]of Object.entries(pt)){let n=this._ctx.has(we(i))?!this._ctx.read(we(i)):true;this._ctx.add(we(i),s,n);}let t=e.pluginManager;t?.onPluginsChange&&this.addSub(t.onPluginsChange(()=>{this._localeName&&this._applyPluginLocales(this._localeName);})),this.addSub(this._ctx.sub(_("localeName"),async i=>{if(!i)return;this._localeName=i;let s=await ro(i);i!==Bn&&this._localeName!==i||(this._applyPluginLocales(i),this._applyOverrides(i,s));})),this.addSub(this._ctx.sub(_("localeDefinitionOverride"),i=>{if(!i)return;let s=i[this._localeName];s&&this._applyOverrides(this._localeName,s);}));}_applyOverrides(e,t){let i=this._cfg.localeDefinitionOverride?.[e];for(let[s,n]of Object.entries(t)){let a=i?.[s];this._ctx.add(we(s),a??n,true);}}_applyPluginLocales(e){let t=this._sharedInstancesBag.pluginManager;if(!t)return;let i=t.snapshot();for(let s of i.i18n){let{pluginId:n,...a}=s,l=a[e];if(l)for(let[c,u]of Object.entries(l))u!==void 0&&this._ctx.add(we(c),u,true);}}};var zn=()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},Hn=()=>"capture"in document.createElement("input"),Kn=()=>({safariDesktop:zn()}),jn=()=>({htmlMediaCapture:Hn()}),go=Kn(),vo=jn();var ft="image/*",nr="video/*",Gn=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Wn=()=>go.safariDesktop?[ft]:[ft,...Gn],gt=Wn(),Jt=r=>r?r.filter(o=>typeof o=="string").flatMap(o=>N(o)):[],ar=(r,o)=>o.some(e=>{if(e.endsWith("*")){let t=e.replace("*","");return r.startsWith(t)}return r===e}),bo=(r,o)=>o.some(e=>e.startsWith(".")?r.toLowerCase().endsWith(e.toLowerCase()):false),He=r=>{let o=r?.type;return o?ar(o,gt):false};function yo(r,o,e,t,i){return {registry:{registerSource:c=>r.addSource(t,c),registerActivity:c=>r.addActivity(t,c),registerFileAction:c=>r.addFileAction(t,c),registerFileHook:c=>r.addFileHook(t,c),registerIcon:c=>r.addIcon(t,c),registerI18n:c=>r.addI18n(t,c),registerConfig:c=>r.addConfig(t,c)},config:{get:c=>{let u=_(c);return o.read(u)},subscribe:(c,u)=>{let p=_(c),h=o.sub(p,m=>{u(m);});return i.push(h),h}},activity:{getParams:()=>o.read("*currentActivityParams"),subscribeToParams:c=>{let u=o.sub("*currentActivityParams",p=>{c(p);});return i.push(u),u}},files:{update:(c,u)=>{let p=e.uploadCollection?.read(c);p&&(u.file!==void 0&&(p.setValue("file",u.file),p.setValue("fileSize",u.file.size)),u.cdnUrl!==void 0&&p.setValue("cdnUrl",u.cdnUrl),u.cdnUrlModifiers!==void 0&&p.setValue("cdnUrlModifiers",u.cdnUrlModifiers),u.mimeType!==void 0&&p.setValue("mimeType",u.mimeType));}}}}var qn=async({entries:r,signal:o})=>(await Promise.all(r.map(async t=>{if(t.isEnabled())try{let i=await t.load();return o.aborted||!t.isEnabled()?void 0:i??void 0}catch(i){o.aborted||console.warn("Failed to load lazy plugin",i);return}}))).filter(t=>t!==void 0),ei=class{constructor(o,e){this._ctx=o;this._onCompute=e;this._subs=new Set;this._unsubLazyPlugins=this._ctx.sub("*lazyPlugins",t=>{this._setEntries(t??[]);});}_setEntries(o){for(let i of this._subs)i();if(this._subs.clear(),o.length===0)return;let e=new Set([_("plugins")]);for(let i of o)for(let s of i.configDeps)e.add(_(s));let t=()=>this._compute(o);for(let i of e)this._subs.add(this._ctx.sub(i,t,false));this._compute(o);}_compute(o){this._abortController?.abort();let e=new AbortController;this._abortController=e;let t=n=>this._ctx.read(_(n)),i=t("plugins"),s=qn({entries:o.map(n=>({isEnabled:()=>n.isEnabled(t),load:n.load})),signal:e.signal}).then(n=>{if(!e.signal.aborted)return [...i,...n]});this._onCompute(s);}destroy(){this._unsubLazyPlugins();for(let o of this._subs)o();this._subs.clear(),this._abortController?.abort();}};var ti=class{constructor(){this._definitions=new Map;}register(o,e){if(this._definitions.has(e.name)){console.warn(`[CustomConfig] Config option "${e.name}" is already registered`);return}let t={attribute:true,...e,pluginId:o};this._definitions.set(e.name,t);}unregister(o){this._definitions.delete(o);}unregisterByPlugin(o){for(let[e,t]of this._definitions)t.pluginId===o&&this._definitions.delete(e);}get(o){return this._definitions.get(o)}getAll(){return new Map(this._definitions)}};var ii=class{constructor(){this._sources=[];this._activities=[];this._fileActions=[];this._fileHooks=[];this._icons=[];this._i18n=[];this.config=new ti;}_own(o,e){return {...e,pluginId:o}}addSource(o,e){return this._sources.push(this._own(o,e)),e}addActivity(o,e){return this._activities.push(this._own(o,e)),e}addFileAction(o,e){return this._fileActions.push(this._own(o,e)),e}addFileHook(o,e){return this._fileHooks.push(this._own(o,e)),e}addIcon(o,e){return this._icons.push(this._own(o,e)),e}addI18n(o,e){return this._i18n.push(this._own(o,e)),e}addConfig(o,e){this.config.register(o,e);}purge(o){this._sources=this._sources.filter(e=>e.pluginId!==o),this._activities=this._activities.filter(e=>e.pluginId!==o),this._fileActions=this._fileActions.filter(e=>e.pluginId!==o),this._fileHooks=this._fileHooks.filter(e=>e.pluginId!==o),this._icons=this._icons.filter(e=>e.pluginId!==o),this._i18n=this._i18n.filter(e=>e.pluginId!==o),this.config.unregisterByPlugin(o);}snapshot(){return {sources:[...this._sources],activities:[...this._activities],fileActions:[...this._fileActions],fileHooks:[...this._fileHooks],icons:[...this._icons],i18n:[...this._i18n]}}};var ri=class extends V{constructor(e){super(e);this._plugins=new Map;this._subscribers=new Set;this._pluginsUpdate=Promise.resolve();this.registry=new ii;this._lazyPluginLoader=new ei(this._ctx,t=>{this._pluginsUpdate=this._pluginsUpdate.then(()=>t).then(i=>{if(i)return this._syncPlugins(i)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this._pluginsUpdate}onPluginsChange(e){return this._subscribers.add(e),()=>{this._subscribers.delete(e);}}async _syncPlugins(e){let t=new Set(this._plugins.keys()),i=new Set;for(let s of e){if(i.has(s.id)){this._debugPrint(`Plugin "${s.id}" is already in the list, skipping duplicate`);continue}if(i.add(s.id),!this._plugins.has(s.id))try{await this._registerPlugin(s);}catch(n){this.registry.purge(s.id),this._notifySubscribers(),this._debugPrint(`Plugin "${s.id}" setup failed`,n);}t.delete(s.id);}for(let s of t)this._unregisterPlugin(s);}async _registerPlugin(e){this._plugins.has(e.id)&&this._unregisterPlugin(e.id);let t=[],i=yo(this.registry,this._ctx,this._sharedInstancesBag,e.id,t),s=this._sharedInstancesBag.api,n;try{n=await e.setup({pluginApi:i,uploaderApi:s})??void 0;}catch(a){for(let l of t)try{l();}catch(c){this._debugPrint("Failed to unsubscribe config listener",c);}throw a}this._plugins.set(e.id,{plugin:e,dispose:n,configSubscriptions:t}),this._notifySubscribers();}_unregisterPlugin(e){let t=this._plugins.get(e);if(t){this.registry.purge(e);for(let i of t.configSubscriptions)try{i();}catch(s){this._debugPrint("Failed to unsubscribe config listener",s);}t.dispose?.(),this._plugins.delete(e),this._notifySubscribers();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(e){let t=e.getValue("file");if(!t)return;let i=this.registry.snapshot().fileHooks.filter(n=>n.type==="onAdd");if(i.length===0)return;let s=t;for(let n of i)try{({file:s}=await n.handler({file:s}));}catch(a){this._debugPrint(`File hook "onAdd" from plugin "${n.pluginId}" failed`,a);}s!==t&&(e.setValue("file",s),e.setValue("fileSize",s.size),e.setValue("mimeType",s.type||null),e.setValue("isImage",He(s)),s instanceof File&&e.setValue("fileName",s.name));}destroy(){for(let e of Array.from(this._plugins.keys()))this._unregisterPlugin(e);this._lazyPluginLoader.destroy(),super.destroy();}_notifySubscribers(){for(let e of this._subscribers)try{e();}catch{}}};var Zn=20,x=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),b=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),oi=class extends V{constructor(){super(...arguments);this._timeoutStore=new Map;this._targets=new Set;this._listeners=new Map;}bindTarget(e){return this._targets.add(e),()=>{this._targets.delete(e);}}on(e,t){let i=this._listeners.get(e);return i||(i=new Set,this._listeners.set(e,i)),i.add(t),()=>this._listeners.get(e)?.delete(t)}_dispatch(e,t){for(let s of this._targets)s.dispatchEvent(new CustomEvent(e,{detail:t}));let i=this._listeners.get(e);if(i)for(let s of i)s(t);this._debugPrint?.(()=>{let s=t&&typeof t=="object"?{...t}:t;return [`event "${e}"`,s]});}emit(e,t,i={}){let{debounce:s}=i;if(typeof s!="number"&&!s){this._dispatch(e,typeof t=="function"?t():t);return}this._timeoutStore.has(e)&&window.clearTimeout(this._timeoutStore.get(e));let n=typeof s=="number"?s:Zn,a=window.setTimeout(()=>{try{let l=typeof t=="function"?t():t;this._dispatch(e,l),this._timeoutStore.delete(e);}catch(l){this._debugPrint?.(()=>`Error while getting payload for event "${e}"`,l);}},n);this._timeoutStore.set(e,a);}destroy(){for(let e of this._timeoutStore.values())window.clearTimeout(e);this._targets.clear(),this._listeners.clear();}};var _o="1.28.0-alpha.666";var pe="blocks",he=_o;var si=class extends V{constructor(e){super(e);this._sessionId=ee.generateRandomUUID();this._config=structuredClone(H);this._initialized=false;this._lastPayload=null;this._isEnabled=false;this._telemetryInstance=new TelemetryAPIService,this._queue=new Queue(10),this.addSub(this._ctx.sub(_("qualityInsights"),t=>{this._isEnabled=!!t;}));for(let t of Object.keys(this._config))this.addSub(this._ctx.sub(_(t),i=>{this._isEnabled&&(this._initialized&&this._config[t]!==i&&this.sendEvent({eventType:x.CHANGE_CONFIG}),this._setConfig(t,i));}));}_init(e){e===x.INIT_SOLUTION&&!this._initialized&&(this._initialized=true);}_setConfig(e,t){this._config[e]!==t&&(this._config[e]=t);}_formattingPayload(e){let t=e.payload?{...e.payload}:{};t.activity&&(t.activity=void 0);let i={...e};return (e.eventType===x.INIT_SOLUTION||e.eventType===x.CHANGE_CONFIG)&&(i.config=this._config),{...i,appVersion:he,appName:pe,sessionId:this._sessionId,component:this._solution,activity:this._activity,projectPubkey:this._config.pubkey,userAgent:navigator.userAgent,eventType:i.eventType??"",eventTimestamp:this._timestamp,payload:{location:this._location,...t}}}_excludedEvents(e){return !!(e&&[b.CHANGE,b.COMMON_UPLOAD_PROGRESS,b.FILE_ADDED,b.FILE_REMOVED,b.FILE_UPLOAD_START,b.FILE_UPLOAD_PROGRESS,b.FILE_UPLOAD_SUCCESS,b.FILE_UPLOAD_FAILED].includes(e))}sendEvent(e){if(!this._isEnabled)return;let t=this._formattingPayload({eventType:e.eventType,payload:e.payload,config:e.config});this._init(e.eventType),!(this._excludedEvents(e.eventType)||this._lastPayload&&this._checkObj(this._lastPayload,t))&&this._queue.add(async()=>{this._lastPayload=t,await this._telemetryInstance.sendEvent(t);});}sendEventError(e,t="unknown"){this.sendEvent({eventType:x.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${t}`,error:e.message}}});}sendEventCloudImageEditor(e,t,i={}){this.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{tabId:t,node:e.currentTarget?.tagName,event:e.type,...i}}});}_checkObj(e,t){if(JSON.stringify(e)===JSON.stringify(t))return true;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return false;let i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return false;for(let n of i)if(!Object.hasOwn(t,n)||!this._checkObj(e[n],t[n]))return false;return true}get _timestamp(){return Date.now()}get _solution(){if(!this._ctx.has("*solution"))return null;let e=this._ctx.read("*solution");return e?e.toLowerCase():null}get _activity(){return this._ctx.has("*currentActivity")?this._ctx.read("*currentActivity"):null}get _location(){return location.origin}};var Co=r=>{let o=new Intl.Locale(r),e="ltr",t=o.getTextInfo?.().direction;return t?e=t:o.textInfo?.direction&&(e=o.textInfo.direction),e};var Jn=r=>r;var wo="plural:";function Ke(r,o={},e={}){let{openToken:t="{{",closeToken:i="}}",transform:s=Jn}=e;for(let n in o){let a=o[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);r=r.replaceAll(t+n+i,c);}return r}function To(r){let o=[],e=r.indexOf("{{");for(;e!==-1;){let t=r.indexOf("}}",e);if(t===-1)break;let i=r.substring(e+2,t);if(i.startsWith(wo)){let s=r.substring(e+2,t).replace(wo,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));o.push({variable:i,pluralKey:n,countVariable:a});}e=r.indexOf("{{",t);}return o}var Eo="--uploadcare-blocks-window-height",vt=class r{static{this.clientsRegistry=new Set;}static{this.flush=E(()=>{document.documentElement.style.setProperty(Eo,`${window.innerHeight}px`);},100);}static registerClient(o){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(o);}static unregisterClient(o){r.clientsRegistry.delete(o),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty(Eo);}};var ni=(r,o)=>new Intl.PluralRules(r).select(o);var ea=r=>(o,e)=>{let t=r(),i=t("locale-id")||"en",s=ni(i,e);return t(`${o}__${s}`)},ai=r=>{let o=ea(()=>e),e=(t,i={})=>{if(!t)return "";let n=r().read(we(t))||t,a=To(n);for(let c of a)i[c.variable]=o(c.pluralKey,Number(i[c.countVariable]));return Ke(n,i)};return e};var ta=r=>r.tagName?.includes("-")??false,li=class{constructor(o){this._trackedElements=new Set;this._originalValues=new Map;this._enabled=false;this._host=o,this._host.addController(this);}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0,this._trackedElements.clear(),this._originalValues.clear();}hostUpdated(){if(!this._unsubscribe&&this._host.has(_("testMode"))){let o=this._host.subConfigValue("testMode",e=>{this._enabled=!!e,this._applyTestMode();});this._unsubscribe=o;}this._collectElements(),this._applyTestMode();}_collectElements(){let o=this._host,e=o.renderRoot??o;if(!e)return;let t=this._host,i=t.tagName?.toLowerCase(),s=Array.from(e.querySelectorAll("[data-testid]")).filter(n=>!ta(n));for(let n of s)if(!(i&&n.closest(i)!==t)&&!this._trackedElements.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this._trackedElements.add(n),this._originalValues.set(n,a);}for(let n of Array.from(this._trackedElements))(!n.isConnected||i&&n.closest(i)!==t)&&(this._trackedElements.delete(n),this._originalValues.delete(n));}_applyTestMode(){if(!this._trackedElements.size)return;let o=this._host.testId||"";for(let e of this._trackedElements){let t=this._originalValues.get(e);t&&(this._enabled?e.setAttribute("data-testid",`${o}--${t}`):e.removeAttribute("data-testid"));}}};var ra=ze(zt()(Be(Bt(LitElement)))),g=class extends ra{constructor(){super();this.init$=ir();this.l10n=ai(()=>this.sharedCtx);this.debugPrint=Wt(()=>this.sharedCtx,this.constructor.name);this._sharedInstancesBag=mo(()=>this.sharedCtx);new li(this);}static{this.styleAttrs=[];}emit(e,t,i){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(e,t,i);let n=typeof t=="function"?t():t;this.telemetryManager.sendEvent({eventType:e,payload:n??void 0});}hasBlockInCtx(e){for(let t of this.blocksRegistry)if(e(t))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(t=>{this.setAttribute(t,"");}),super.connectedCallback(),vt.registerClient(this);}initCallback(){this._addSharedContextInstance("*blocksRegistry",()=>new Set),this._addSharedContextInstance("*pluginManager",e=>new ri(e)),this._addSharedContextInstance("*eventEmitter",e=>new oi(e)),this._addSharedContextInstance("*localeManager",e=>new Qt(e)),this._addSharedContextInstance("*modalManager",e=>new qt(e)),this._addSharedContextInstance("*a11y",()=>new Xt),this._addSharedContextInstance("*clipboard",e=>new Yt(e)),this._addSharedContextInstance("*telemetryManager",e=>new si(e)),this.sub(we("locale-id"),e=>{let t=Co(e);this.style.direction=t==="ltr"?"":t,this.requestUpdate();}),this.subConfigValue("testMode",e=>{if(!e||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this._getSharedContextInstance("*modalManager",false)}get telemetryManager(){return this._getSharedContextInstance("*telemetryManager")}get localeManager(){return this._getSharedContextInstance("*localeManager")}get a11y(){return this._getSharedContextInstance("*a11y")}get clipboardLayer(){return this._getSharedContextInstance("*clipboard")}get blocksRegistry(){return this._getSharedContextInstance("*blocksRegistry")}get eventEmitter(){return this._getSharedContextInstance("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),vt.unregisterClient(this);let e=this.blocksRegistry;e?.delete(this),e?.size===0&&setTimeout(()=>{this.isConnected||e?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this._destroySharedContextInstances(),O.deleteCtx(this.ctxName);}_getSharedContextInstances(){let e="*sharedContextInstances";if(!this.has(e)||!this.$[e]){let t=new Map;this.add(e,t,true);}return this.$[e]}_addSharedContextInstance(e,t){let i=this._getSharedContextInstances();if(!i.has(e)&&(!this.has(e)||!this.$[e])){let s=t(this._sharedInstancesBag);this.add(e,s,true),i.set(e,s);return}}_destroySharedContextInstances(){let e=this._getSharedContextInstances();for(let[t,i]of e.entries())i?.destroy?.(),this.pub(t,null);e.clear();}_getSharedContextInstance(e,t=true){if(this.has(e)&&this.$[e])return this.$[e];if(!t)return this.$[e];throw new Error(`Unexpected error: context manager for key "${String(e)}" is not available`)}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:jt(e),cdnUrlModifiers:Ji(e),fileName:Kt(e)})}catch(t){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",t),this.telemetryManager.sendEventError(t,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),e}return this.cfg.secureDeliveryProxy?Ke(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:t=>window.encodeURIComponent(t)}):e}get cfg(){if(!this._cfgProxy){let e={};this._cfgProxy=new Proxy(e,{set:(t,i,s)=>{if(typeof i!="string"||!(i in H))return false;let n=i,a=_(n);return this.has(a)||this.add(a,H[n]),this.$[a]=s,true},get:(t,i)=>{let s=_(i);return this.has(s)||this.add(s,H[i]),this.$[s]}});}return this._cfgProxy}subConfigValue(e,t){let i=_(e);return this.has(i)||this.add(i,H[e]),this.sub(i,t)}};var xo="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Te=class extends g{constructor(){super(...arguments);this.init$=fo(this);}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let e=this.constructor.lazyPlugins;e&&this.sharedCtx.pub("*lazyPlugins",e);}render(){return html`${unsafeSVG(xo)}`}};var So=r=>typeof r!="number"?0:Math.floor(r/1e3),Io=(r,{threshold:o})=>{let{secureExpire:e}=r,t=So(Date.now()),i=Number(e),s=So(o);return t+s>=i};var ci=class extends V{constructor(){super(...arguments);this._secureToken=null;}async getSecureToken(){let{secureSignature:e,secureExpire:t,secureUploadsSignatureResolver:i,secureUploadsExpireThreshold:s}=this._cfg;if((e||t)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||Io(this._secureToken,{threshold:s})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let n=await i();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this._debugPrint("Secure signature resolved:",n),this._debugPrint("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this._secureToken=n):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this._sharedInstancesBag.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this._secureToken}return e&&t?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:e,secureExpire:t}),{secureSignature:e,secureExpire:t}):null}destroy(){super.destroy(),this._secureToken=null;}};var lr=(r,o)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:o.l10n("some-files-were-not-uploaded")}};var cr=(r,o)=>{let e=r.totalCount,t=o.cfg.multiple?o.cfg.multipleMin:0,i=o.cfg.multiple?o.cfg.multipleMax:1;if(t&&e<t)return {type:"TOO_FEW_FILES",message:o.l10n("files-count-limit-error-too-few",{min:t,max:i,total:e}),payload:{total:e,min:t,max:i}};if(i&&e>i)return {type:"TOO_MANY_FILES",message:o.l10n("files-count-limit-error-too-many",{min:t,max:i,total:e}),payload:{total:e,min:t,max:i}}};var dr=(r,o)=>{let e=o.cfg.imgOnly,t=o.cfg.accept,i=Jt([...e?gt:[],t]);if(!i.length)return;let s=r.mimeType,n=r.name;if(!s||!n)return;let a=ar(s,i),l=bo(n,i);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:o.l10n("file-type-not-allowed"),payload:{entry:r}}};var ur=(r,o)=>{let e=o.cfg.imgOnly,t=r.isImage;if(!(!e||t)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return {type:"NOT_AN_IMAGE",message:o.l10n("images-only-accepted"),payload:{entry:r}}};var me=1e3,Ue=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),bt=r=>Math.ceil(r*100)/100,Ao=(r,o=Ue.AUTO)=>{let e=o===Ue.AUTO;if(o===Ue.BYTE||e&&r<me**1){let i=ni("en-US",r)==="one"?"byte":"bytes";return `${r} ${i}`}return o===Ue.KB||e&&r<me**2?`${bt(r/me**1)} KB`:o===Ue.MB||e&&r<me**3?`${bt(r/me**2)} MB`:o===Ue.GB||e&&r<me**4?`${bt(r/me**3)} GB`:o===Ue.TB||e&&r<me**5?`${bt(r/me**4)} TB`:`${bt(r/me**5)} PB`};var pr=(r,o)=>{let e=o.cfg.maxLocalFileSizeBytes,t=r.size;if(e&&t&&t>e)return {type:"FILE_SIZE_EXCEEDED",message:o.l10n("files-max-size-limit-error",{maxFileSize:Ao(e)}),payload:{entry:r}}};var hr=(r,o)=>{let{internalId:e}=r;if(!o._uploadCollection.hasItem(e))return;let i=o._uploadCollection.read(e)?.getValue("uploadError");if(!i)return;if(i instanceof UploadError)return {type:"UPLOAD_ERROR",message:i.message,payload:{entry:r,error:i}};if(i instanceof NetworkError)return {type:"NETWORK_ERROR",message:i.message,payload:{entry:r,error:i}};let s=i instanceof Error?i:new Error("Unknown error",{cause:i});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:r,error:s}}};var je={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},ca=r=>typeof r=="function"?{runOn:"change",validator:r}:r,di=class extends V{constructor(e){super(e);this._commonFileValidators=[ur,dr,pr,hr];this._commonCollectionValidators=[cr,lr];this._queue=new Queue(20);this._runQueueDebounced=E(()=>{this._queue.run();},500);this._isDestroyed=false;this._entryValidationState=new Map;let t=E(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this._ctx.sub(_("maxLocalFileSizeBytes"),t)),this.addSub(this._ctx.sub(_("multipleMin"),t)),this.addSub(this._ctx.sub(_("multipleMax"),t)),this.addSub(this._ctx.sub(_("multiple"),t)),this.addSub(this._ctx.sub(_("imgOnly"),t)),this.addSub(this._ctx.sub(_("accept"),t)),this.addSub(this._ctx.sub(_("validationConcurrency"),i=>{this._queue.concurrency=i;}));}get _uploadCollection(){return this._sharedInstancesBag.uploadCollection}runFileValidators(e,t){if(this._isDestroyed)return;let i=t??this._uploadCollection.items();for(let s of i){let n=this._uploadCollection.read(s);n&&this._runFileValidatorsForEntry(n,e);}}runCollectionValidators(){if(this._isDestroyed)return;let e=this._sharedInstancesBag.api,t=e.getOutputCollectionState(),i=[],s=this._cfg.collectionValidators;for(let n of [...this._commonCollectionValidators,...s])try{let a=n(t,e);if(!a)continue;a&&(i.push(this._addCustomTypeToValidationError(a)),a.message||console.warn(je.MISSING_ERROR_MESSAGE));}catch(a){console.warn(je.COLLECTION_VALIDATION_FAILED,a);}this._ctx.pub("*collectionErrors",i),i.length>0&&this._sharedInstancesBag.eventEmitter.emit(b.COMMON_UPLOAD_FAILED,()=>e.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(e){let t=this._entryValidationState.get(e.uid);t&&(t.abortController?.abort(),this._entryValidationState.delete(e.uid));}async _runFileValidatorsForEntry(e,t){if(this._isDestroyed)return;let i=this._sharedInstancesBag.api,s=this._getEntryValidationState(e),n=s.promise??Promise.resolve(),a=(async()=>{if(this._isDestroyed||(await n,this._isDestroyed))return;let l=this._getValidatorDescriptorsForEntry(e,t);if(l.length===0||!this._uploadCollection.hasItem(e.uid))return;e.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=i.getOutputItem(e.uid),u=new AbortController;s.abortController=u;let p=this._cfg.validationTimeout,h=this._getValidatorDescriptors(),m=new Set(l.map(w=>w.validator)),f=[];for(let w of h)if(!m.has(w.validator)){let L=s.lastErrorThrownByValidator.get(w.validator);L&&f.push(L);}let R=l.map(w=>async()=>{if(this._isDestroyed)return;let L=setTimeout(()=>{s.skippedValidators.add(w.validator),u.abort(),console.warn(je.FILE_VALIDATION_TIMEOUT);},p);try{let J=await w.validator(c,i,{signal:u.signal});if(!J||u.signal.aborted){s.lastErrorThrownByValidator.set(w.validator,void 0);return}let Nt=this._addCustomTypeToValidationError(J);s.lastErrorThrownByValidator.set(w.validator,Nt),f.push(Nt),J.message||console.warn(je.MISSING_ERROR_MESSAGE);}catch(J){u.signal.aborted||(s.skippedValidators.add(w.validator),console.warn(je.FILE_VALIDATION_FAILED,J),this._sharedInstancesBag.telemetryManager.sendEventError(J,`file validator. ${je.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(L),w.runOn!=="change"&&s.skippedValidators.add(w.validator);}});if(this._runQueueDebounced(),await this._queue.add(async()=>{this._isDestroyed||(e.setValue("isQueuedForValidation",false),await Promise.all(R.map(w=>w())).catch(()=>{}));},{autoRun:false}),u.signal.aborted){e.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}e.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:f});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}_addCustomTypeToValidationError(e){return {...e,type:e.type??"CUSTOM_ERROR"}}_getEntryValidationState(e){let t=this._entryValidationState.get(e.uid);if(t)return t;let i={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this._entryValidationState.set(e.uid,i),i}_getValidatorDescriptors(){let e=this._cfg.fileValidators;return [...this._commonFileValidators,...e].map(ca)}_getValidatorDescriptorsForEntry(e,t){let i=this._getEntryValidationState(e);return this._getValidatorDescriptors().filter(s=>!i.skippedValidators.has(s.validator)).filter(s=>s.runOn===t)}destroy(){this._isDestroyed=true,this._runQueueDebounced.cancel();for(let e of this._entryValidationState.values())e.abortController?.abort(),e.promise=void 0;this._entryValidationState.clear();}};var ko="[Typed State] Wrong property name: ",ui=class{constructor(o){this._ctxId=ee.generateFastUid(),this._data=O.registerCtx(o,this._ctxId);}get uid(){return this._ctxId}setValue(o,e){if(!this._data.has(o)){console.warn(`${ko}${String(o)}`);return}this._data.read(o)!==e&&this._data.pub(o,e);}setMultipleValues(o){for(let[e,t]of Object.entries(o))this.setValue(e,t);}getValue(o){return this._data.has(o)||console.warn(`${ko}${String(o)}`),this._data.read(o)}subscribe(o,e){return this._data.sub(o,e)}destroy(){O.deleteCtx(this._ctxId);}};var pi=class r{constructor(o){this._subsMap=Object.create(null);this._propertyObservers=new Set;this._collectionObservers=new Set;this._items=new Set;this._removed=new Set;this._added=new Set;this._markedToDestroy=new Set;this._initialValue=o.initialValue,this._ctxId=ee.generateFastUid(),this._data=O.registerCtx({},this._ctxId),this._watchList=o.watchList||[];let e=Object.create(null);this._notifyObservers=(t,i)=>{this._observeTimeout&&window.clearTimeout(this._observeTimeout),e[t]||(e[t]=new Set),e[t].add(i),this._observeTimeout=window.setTimeout(()=>{Object.keys(e).length!==0&&(this._propertyObservers.forEach(s=>{s({...e});}),e=Object.create(null));}),this._scheduleDestroyMarkedItems();},o.handler&&this.observeCollection(o.handler);}static{this._destroyDelayMs=1e4;}_notify(){this._notifyTimeout&&window.clearTimeout(this._notifyTimeout),this._notifyTimeout=window.setTimeout(()=>{let o=new Set(this._added),e=new Set(this._removed);this._added.clear(),this._removed.clear();for(let t of this._collectionObservers)t?.([...this._items],o,e);this._scheduleDestroyMarkedItems();});}_scheduleDestroyMarkedItems(){this._markedToDestroy.size!==0&&(this._destroyTimeout&&window.clearTimeout(this._destroyTimeout),this._destroyTimeout=window.setTimeout(()=>{let o=[...this._markedToDestroy];this._markedToDestroy.clear();for(let e of o)e.destroy();},r._destroyDelayMs));}observeCollection(o){return this._collectionObservers.add(o),this._items.size>0&&this._notify(),()=>{this.unobserveCollection(o);}}unobserveCollection(o){this._collectionObservers.delete(o);}add(o){let e=new ui(this._initialValue);for(let[t,i]of Object.entries(o))e.setValue(t,i);return this._items.add(e.uid),this._notify(),this._data.add(e.uid,e),this._added.add(e),this._watchList.forEach(t=>{this._subsMap[e.uid]||(this._subsMap[e.uid]=[]),this._subsMap[e.uid]?.push(e.subscribe(t,()=>{this._notifyObservers(t,e.uid);}));}),e.uid}hasItem(o){return this._items.has(o)}read(o){return this._data.read(o)??null}readProp(o,e){let t=this.read(o);if(!t)throw new Error(`TypedCollection#readProp: Item with id ${o} not found`);return t.getValue(e)}publishProp(o,e,t){let i=this.read(o);if(!i)throw new Error(`TypedCollection#publishProp: Item with id ${o} not found`);i.setValue(e,t);}remove(o){let e=this.read(o);e&&(this._removed.add(e),this._markedToDestroy.add(e)),this._items.delete(o),this._notify(),this._data.pub(o,void 0),this._subsMap[o]?.forEach(t=>{t();}),delete this._subsMap[o];}clearAll(){this._items.forEach(o=>{this.remove(o);});}observeProperties(o){return this._propertyObservers.add(o),()=>{this.unobserveProperties(o);}}unobserveProperties(o){this._propertyObservers.delete(o);}findItems(o){let e=[];return this._items.forEach(t=>{let i=this.read(t);i&&o(i)&&e.push(t);}),e}items(){return [...this._items]}get size(){return this._items.size}destroy(){this._observeTimeout&&window.clearTimeout(this._observeTimeout),this._notifyTimeout&&window.clearTimeout(this._notifyTimeout),this._destroyTimeout&&window.clearTimeout(this._destroyTimeout);for(let o of this._markedToDestroy)o.destroy();this._markedToDestroy.clear(),O.deleteCtx(this._ctxId),this._propertyObservers=new Set,this._collectionObservers=new Set;for(let o of Object.keys(this._subsMap))this._subsMap[o]?.forEach(e=>{e();}),delete this._subsMap[o];}};var C=Object.freeze({PHOTO:"photo",VIDEO:"video"}),se=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Mo=r=>({isVideoRecordingEnabled:U(r.cameraModes).includes(C.VIDEO),isPhotoEnabled:U(r.cameraModes).includes(C.PHOTO)});var Po=(r,o)=>{for(let e of r)if(o(e))return e};var mr=(r,o,{timeout:e=1e3,onTimeout:t}={})=>new Promise(i=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),t?.();},e),a=()=>{for(let l of r)if(o(l)){clearTimeout(n),i(l);return}s=requestAnimationFrame(a);};a();});function hi(r,o){for(let e in o)e.includes("-")?r.style.setProperty(e,String(o[e])):r.style[e]=String(o[e]);}var da=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,ua=new RegExp(`^/?(${da.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Oo=({url:r,cdnBase:o})=>{let e=new URL(o),t=new URL(mt),i=new URL(r);if(e.host!==i.host&&t.host!==i.host)return null;let s=ua.exec(i.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var ne=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),pa=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),A=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...pa,...ne});var mi=r=>r.uploadCollection.items().map(t=>r.api.getOutputItem(t));function Lo(r){let o=new Map;return (...t)=>{let i=JSON.stringify(t);if(o.has(i))return o.get(i);let s=r(...t);return o.set(i,s),s}}var Ro=new Set;function fi(r){Ro.has(r)||(Ro.add(r),console.warn(r));}function ha(r){let o=false;return setTimeout(()=>{o=true;},0),t=>((...i)=>(o&&fi(r),t(...i)))}function Uo(r){let o={},e=r.ctx,t={progress:()=>e.read("*commonProgress"),errors:()=>e.read("*collectionErrors"),group:()=>e.read("*groupInfo"),totalCount:()=>r.uploadCollection.size,failedCount:()=>o.failedEntries.length,successCount:()=>o.successEntries.length,uploadingCount:()=>o.uploadingEntries.length,status:()=>o.isFailed?"failed":o.isUploading?"uploading":o.isSuccess?"success":"idle",isSuccess:()=>o.allEntries.length>0&&o.errors.length===0&&o.successEntries.length===o.allEntries.length,isUploading:()=>o.allEntries.some(s=>s.status==="uploading"),isFailed:()=>o.errors.length>0||o.failedEntries.length>0,allEntries:()=>mi(r),successEntries:()=>o.allEntries.filter(s=>s.status==="success"),failedEntries:()=>o.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>o.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>o.allEntries.filter(s=>s.status==="idle")},i=ha("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(t)){let a=s,c=Lo(i(n));Object.defineProperty(o,a,{get:c,enumerable:true});}return o}var gi=class extends V{constructor(){super(...arguments);this._l10n=ai(()=>this._ctx);this.addFileFromUrl=(e,{silent:t,fileName:i,source:s}={})=>{let n=this._uploadCollection.add({externalUrl:e,fileName:i??null,silent:t??false,source:s??A.API});return this.getOutputItem(n)};this.addFileFromUuid=(e,{silent:t,fileName:i,source:s}={})=>{let n=this._uploadCollection.add({uuid:e,fileName:i??null,silent:t??false,source:s??A.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(e,{silent:t,fileName:i,source:s}={})=>{let n=Oo({url:e,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this._uploadCollection.add({uuid:n.uuid,cdnUrl:e,cdnUrlModifiers:n.cdnUrlModifiers,fileName:i??n.filename??null,silent:t??false,source:s??A.API});return this.getOutputItem(a)};this.addFileFromObject=(e,{silent:t,fileName:i,source:s,fullPath:n}={})=>{let a=this._uploadCollection.add({file:e,isImage:He(e),mimeType:e.type||null,fileName:i??e.name,fileSize:e.size,silent:t??false,source:s??A.API,fullPath:n??null});return this.getOutputItem(a)};this.removeFileByInternalId=e=>{if(!this._uploadCollection.read(e))throw new Error(`File with internalId ${e} not found`);this._uploadCollection.remove(e);};this.uploadAll=()=>{let e=this._uploadCollection.items().filter(t=>{let i=this._uploadCollection.read(t);return i?!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo")&&i.getValue("errors").length===0&&!i.getValue("isValidationPending")&&!i.getValue("isQueuedForValidation"):false});e.length!==0&&(this._ctx.pub("*uploadTrigger",new Set(e)),this._sharedInstancesBag.eventEmitter.emit(b.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(e={})=>{let t=ye(Jt([this.cfg.accept??"",...this.cfg.imgOnly?gt:[]])),i="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(i,""),hi(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,e.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=Mo(this.cfg);e.modeCamera===C.PHOTO&&n?s.accept=ft:e.modeCamera===C.VIDEO&&a?s.accept=nr:s.accept=[ft,a&&nr].filter(Boolean).join(",");}else s.accept=t;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:e.captureCamera?A.CAMERA:A.LOCAL});}),this._ctx.pub("*currentActivity",S.UPLOAD_LIST),this._sharedInstancesBag.modalManager?.open(S.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${i}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(e=false)=>{if(this._uploadCollection.size>0&&!e)this._ctx.pub("*currentActivity",S.UPLOAD_LIST),this._sharedInstancesBag.modalManager?.open(S.UPLOAD_LIST);else if(this._sourceList?.length===1){let t=this._sourceList[0];this._pluginsReady().then(()=>{let i=this._sharedInstancesBag.pluginManager.snapshot().sources,s=i.find(n=>n.id===t);if(s){let n=s.expand?.()??[t];n.length===1?(i.find(l=>l.id===n[0])??s).onSelect():(this._ctx.pub("*currentActivity",S.START_FROM),this._sharedInstancesBag.modalManager?.open(S.START_FROM));return}this._ctx.read("*currentActivity")&&this._sharedInstancesBag.modalManager?.open(this._ctx.read("*currentActivity"));});}else this._ctx.pub("*currentActivity",S.START_FROM),this._sharedInstancesBag.modalManager?.open(S.START_FROM);};this.doneFlow=()=>{let e=Po(this._sharedInstancesBag.blocksRegistry,t=>"doneActivity"in t);e&&(this._ctx.pub("*currentActivity",e.doneActivity),this._ctx.pub("*history",e.doneActivity?[e.doneActivity]:[]),this._ctx.read("*currentActivity")||this._sharedInstancesBag.modalManager?.closeAll());};this.setCurrentActivity=(e,...t)=>{this._pluginsReady().then(()=>{this._ctx.pub("*currentActivityParams",t[0]??{}),this._ctx.pub("*currentActivity",e),mr(this._sharedInstancesBag.blocksRegistry,i=>i.activityType===e,{onTimeout:()=>console.warn(`Activity type "${e}" not found in the context`),timeout:100});});};this.on=(e,t)=>this._sharedInstancesBag.eventEmitter.on(e,t);this.getCurrentActivity=()=>this._ctx.read("*currentActivity");this.historyBack=()=>{this._ctx.read("*historyBack")?.();};this.setModalState=e=>{this._pluginsReady().then(()=>{if(!e){this._sharedInstancesBag.modalManager?.close(this._ctx.read("*currentActivity")),this._ctx.pub("*currentActivity",null);return}let t=this._ctx.read("*currentActivity");if(!t){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return mr(this._sharedInstancesBag.blocksRegistry,i=>i.activityType===t,{onTimeout:()=>console.warn(`Activity block "${t}" not found in the context`)}).then(()=>{this._sharedInstancesBag.modalManager?.open(t);})});};}get _uploadCollection(){return this._sharedInstancesBag.uploadCollection}get cfg(){return this._cfg}get l10n(){return this._l10n}removeAllFiles(){this._uploadCollection.clearAll();}getOutputItem(e){let t=O.getCtx(e);if(!t)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${e}" not found in the upload collection`);let i=t.store,s=i.fileInfo,n=i.isRemoved?"removed":i.errors.length>0?"failed":i.fileInfo?"success":i.isUploading?"uploading":"idle";return {uuid:s?.uuid??i.uuid??null,internalId:e,name:s?.originalFilename??i.fileName,size:s?.size??i.fileSize,isImage:s?.isImage??i.isImage,mimeType:s?.mimeType??i.mimeType,file:i.file,externalUrl:i.externalUrl,cdnUrlModifiers:i.cdnUrlModifiers,cdnUrl:i.cdnUrl??s?.cdnUrl??null,fullPath:i.fullPath,uploadProgress:i.uploadProgress,fileInfo:s??null,metadata:i.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:i.isValidationPending,errors:i.errors,status:n,source:i?.source}}getOutputCollectionState(){return Uo(this._sharedInstancesBag)}async _pluginsReady(){return (await this._sharedInstancesBag.wait("pluginManager")).pluginsReady()}get _sourceList(){let e=[];return this.cfg.sourceList&&(e=N(this.cfg.sourceList)),e}};var Vo={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var yt=33.333333333333336,y=1,fr=24,Do=6;function ke(r,o){for(let[e,t]of Object.entries(o))r.setAttributeNS(null,e,t.toString());}function ie(r,o={}){let e=document.createElementNS("http://www.w3.org/2000/svg",r);return ke(e,o),e}function $o(r,o,e){let{x:t,y:i,width:s,height:n}=r,a=o.includes("w")?0:1,l=o.includes("n")?0:1,c=a===0?-1:1,u=l===0?-1:1,p=[t+a*s+1.5*c,i+l*n+1.5*u-24*e*u],h=[t+a*s+1.5*c,i+l*n+1.5*u],m=[t+a*s-24*e*c+1.5*c,i+l*n+1.5*u],f=`M ${p[0]} ${p[1]} L ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`,R=[h[0],h[1]];return {d:f,center:R}}function Fo(r,o,e){let{x:t,y:i,width:s,height:n}=r,a=o==="n"||o==="s",l=o==="w"||o==="e",c=a?.5:o==="w"?0:1,u=l?.5:o==="n"?0:1,p=o==="w"?-1:o==="e"?1:0,h=o==="n"?-1:o==="s"?1:0,m,f;a?(m=[t+c*s-34*e/2,i+u*n+1.5*h],f=[t+c*s+34*e/2,i+u*n+1.5*h]):(m=[t+c*s+1.5*p,i+u*n-34*e/2],f=[t+c*s+1.5*p,i+u*n+34*e/2]);let R=`M ${m[0]} ${m[1]} L ${f[0]} ${f[1]}`,w=[(m[0]+f[0])/2,(m[1]+f[1])/2];return {d:R,center:w}}function No(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}function Bo({rect:r,delta:[o,e],imageBox:t}){return We({...r,x:r.x+o,y:r.y+e},t)}function We(r,o){let{x:e}=r,{y:t}=r;return r.x<o.x?e=o.x:r.x+r.width>o.x+o.width&&(e=o.x+o.width-r.width),r.y<o.y?t=o.y:r.y+r.height>o.y+o.height&&(t=o.y+o.height-r.height),{...r,x:e,y:t}}function ma({rect:r,delta:o,aspectRatio:e,imageBox:t}){let[,i]=o,{y:s,width:n,height:a}=r;s+=i,a-=i,e&&(n=a*e);let l=r.x+r.width/2-n/2;return s<=t.y&&(s=t.y,a=r.y+r.height-s,e&&(n=a*e,l=r.x+r.width/2-n/2)),l<=t.x&&(l=t.x,s=r.y+r.height-a),l+n>=t.x+t.width&&(l=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-l,e&&(a=n/e),s=r.y+r.height-a),a<y&&(a=y,e&&(n=a*e,l=r.x+r.width/2-n/2),s=r.y+r.height-a),n<y&&(n=y,e&&(a=n/e,l=r.x+r.width/2-n/2),s=r.y+r.height-a),{x:l,y:s,width:n,height:a}}function fa({rect:r,delta:o,aspectRatio:e,imageBox:t}){let[i]=o,{x:s,width:n,height:a}=r;s+=i,n-=i,e&&(a=n/e);let l=r.y+r.height/2-a/2;return s<=t.x&&(s=t.x,n=r.x+r.width-s,e&&(a=n/e,l=r.y+r.height/2-a/2)),l<=t.y&&(l=t.y,s=r.x+r.width-n),l+a>=t.y+t.height&&(l=Math.max(t.y,t.y+t.height-a),a=t.y+t.height-l,e&&(n=a*e),s=r.x+r.width-n),a<y&&(a=y,e&&(n=a*e),l=r.y+r.height/2-a/2,s=r.x+r.width-n),n<y&&(n=y,e&&(a=n/e),l=r.y+r.height/2-a/2,s=r.x+r.width-n),{x:s,y:l,width:n,height:a}}function ga({rect:r,delta:o,aspectRatio:e,imageBox:t}){let[,i]=o,{y:s,width:n,height:a}=r;a+=i,e&&(n=a*e);let l=r.x+r.width/2-n/2;return s+a>=t.y+t.height&&(a=t.y+t.height-s,e&&(n=a*e),l=r.x+r.width/2-n/2),l<=t.x&&(l=t.x,s=r.y),l+n>=t.x+t.width&&(l=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-l,e&&(a=n/e),s=r.y),a<y&&(a=y,e&&(n=a*e),l=r.x+r.width/2-n/2),n<y&&(n=y,e&&(a=n/e),l=r.x+r.width/2-n/2),{x:l,y:s,width:n,height:a}}function va({rect:r,delta:o,aspectRatio:e,imageBox:t}){let[i]=o,{x:s,width:n,height:a}=r;n+=i,e&&(a=n/e);let l=r.y+r.height/2-a/2;return s+n>=t.x+t.width&&(n=t.x+t.width-s,e&&(a=n/e),l=r.y+r.height/2-a/2),l<=t.y&&(l=t.y,s=r.x),l+a>=t.y+t.height&&(l=Math.max(t.y,t.y+t.height-a),a=t.y+t.height-l,e&&(n=a*e),s=r.x),a<y&&(a=y,e&&(n=a*e),l=r.y+r.height/2-a/2),n<y&&(n=y,e&&(a=n/e),l=r.y+r.height/2-a/2),{x:s,y:l,width:n,height:a}}function ba({rect:r,delta:o,aspectRatio:e,imageBox:t}){let[i,s]=o,{x:n,y:a,width:l,height:c}=r;return n+i<t.x&&(i=t.x-n),a+s<t.y&&(s=t.y-a),n+=i,l-=i,a+=s,c-=s,e&&Math.abs(l/c)>e?(s=l/e-c,c+=s,a-=s,a<=t.y&&(c=c-(t.y-a),l=c*e,n=r.x+r.width-l,a=t.y)):e&&(i=c*e-l,l=l+i,n-=i,n<=t.x&&(l=l-(t.x-n),c=l/e,n=t.x,a=r.y+r.height-c)),c<y&&(c=y,e&&(l=c*e),n=r.x+r.width-l,a=r.y+r.height-c),l<y&&(l=y,e&&(c=l/e),n=r.x+r.width-l,a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function ya({rect:r,delta:o,aspectRatio:e,imageBox:t}){let[i,s]=o,{x:n,y:a,width:l,height:c}=r;return n+l+i>t.x+t.width&&(i=t.x+t.width-n-l),a+s<t.y&&(s=t.y-a),l+=i,a+=s,c-=s,e&&Math.abs(l/c)>e?(s=l/e-c,c+=s,a-=s,a<=t.y&&(c=c-(t.y-a),l=c*e,n=r.x,a=t.y)):e&&(i=c*e-l,l+=i,n+l>=t.x+t.width&&(l=t.x+t.width-n,c=l/e,n=t.x+t.width-l,a=r.y+r.height-c)),c<y&&(c=y,e&&(l=c*e),a=r.y+r.height-c),l<y&&(l=y,e&&(c=l/e),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function _a({rect:r,delta:o,aspectRatio:e,imageBox:t}){let[i,s]=o,{x:n,y:a,width:l,height:c}=r;return n+i<t.x&&(i=t.x-n),a+c+s>t.y+t.height&&(s=t.y+t.height-a-c),n+=i,l-=i,c+=s,e&&Math.abs(l/c)>e?(s=l/e-c,c+=s,a+c>=t.y+t.height&&(c=t.y+t.height-a,l=c*e,n=r.x+r.width-l,a=t.y+t.height-c)):e&&(i=c*e-l,l+=i,n-=i,n<=t.x&&(l=l-(t.x-n),c=l/e,n=t.x,a=r.y)),c<y&&(c=y,e&&(l=c*e),n=r.x+r.width-l),l<y&&(l=y,e&&(c=l/e),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function Ca({rect:r,delta:o,aspectRatio:e,imageBox:t}){let[i,s]=o,{x:n,y:a,width:l,height:c}=r;return n+l+i>t.x+t.width&&(i=t.x+t.width-n-l),a+c+s>t.y+t.height&&(s=t.y+t.height-a-c),l+=i,c+=s,e&&Math.abs(l/c)>e?(s=l/e-c,c+=s,a+c>=t.y+t.height&&(c=t.y+t.height-a,l=c*e,n=r.x,a=t.y+t.height-c)):e&&(i=c*e-l,l+=i,n+l>=t.x+t.width&&(l=t.x+t.width-n,c=l/e,n=t.x+t.width-l,a=r.y)),c<y&&(c=y,e&&(l=c*e)),l<y&&(l=y,e&&(c=l/e)),{x:n,y:a,width:l,height:c}}function zo({direction:r,...o}){switch(r){case "n":return ma(o);case "w":return fa(o);case "s":return ga(o);case "e":return va(o);case "nw":return ba(o);case "ne":return ya(o);case "sw":return _a(o);case "se":return Ca(o);default:return o.rect}}function Ho(r,[o,e]){return r.x<=o&&o<=r.x+r.width&&r.y<=e&&e<=r.y+r.height}function Ko(r,o){return r.x>=o.x&&r.y>=o.y&&r.x+r.width<=o.x+o.width&&r.y+r.height<=o.y+o.height}function jo(r,o){return Math.abs(r.width/r.height-o)<.1}function qe({width:r,height:o},e){let t=e/90%2!==0;return {width:t?o:r,height:t?r:o}}function Go(r,o,e){let t=r/o,i,s;t>e?(i=Math.round(o*e),s=o):(i=r,s=Math.round(r/e));let n=Math.round((r-i)/2),a=Math.round((o-s)/2);return n+i>r&&(i=r-n),a+s>o&&(s=o-a),{x:n,y:a,width:i,height:s}}function Ze(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function Me(r,o,e){return Math.min(Math.max(r,o),e)}var _t=["free"],bi=r=>{let o=N(r);if(!o||o.length===0)return [];let e=[];for(let t of o){let i=t.trim();if(!i)continue;let s=i.indexOf(":");if(s===-1&&!_t.includes(i)){console.warn(`Invalid crop preset: ${i}`);continue}let n=Number(i.slice(0,s)),a=Number(i.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!_t.includes(i)){console.warn(`Invalid crop preset: ${i}`);continue}e.push({id:ee.generateFastUid(),type:"aspect-ratio",width:_t.includes(i)?0:n,height:_t.includes(i)?0:a,hasFreeform:_t.includes(i)});}return e},Wo=(r,o,e,t=.1)=>{let i=r/o,s=null,n=1/0;for(let a of e){let[l,c]=[a.width,a.height],u=l/c,p=Math.abs(i-u);p<n&&(n=p,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(i-c)/c>t)return null}return s};function qo(r){return getUserAgent({...r,libraryName:pe,libraryVersion:he})}var Zo="active",Ye="___ACTIVITY_IS_ACTIVE___",Yo,v=class r extends(Yo=g,Yo){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=rr(this);this._debouncedHistoryFlush=E(this._historyFlush.bind(this),10);}_deactivate(){let e=r._activityCallbacks.get(this);this[Ye]=false,this.removeAttribute(Zo),e?.deactivateCallback?.();}_activate(){let e=r._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ye]=true,this.setAttribute(Zo,""),e?.activateCallback?.(),this._debouncedHistoryFlush(),this.emit(b.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{try{this.activityType!==e&&this[Ye]?this._deactivate():this.activityType===e&&!this[Ye]&&this._activate();}catch(t){this.telemetryManager.sendEventError(t,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,t);let i=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=i??null;}e||(this.$["*history"]=[]);}));}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e);}_isActivityRegistered(){return !!this.activityType&&r._activityCallbacks.has(this)}static{this._activityCallbacks=new Map;}get isActivityActive(){return !!this[Ye]}get couldOpenActivity(){return true}registerActivity(e,t={}){let{onActivate:i,onDeactivate:s}=t;r._activityCallbacks.set(this,{activateCallback:i,deactivateCallback:s});}_unregisterActivity(){this.isActivityActive&&this._deactivate(),r._activityCallbacks.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this._isActivityRegistered()&&this._unregisterActivity();}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let e=this.$["*history"];if(e){let t=e.pop();for(;t===this.activityType;)t=e.pop();let i=!!t;t&&(i=[...this.blocksRegistry].find(n=>n.activityType===t)?.couldOpenActivity??false),t=i?t:null,this.$["*currentActivity"]=t??null,t&&this.modalManager?.open(t),this.$["*history"]=e,t||this.modalManager?.closeAll();}}};v.activities=S;var T=class r extends v{constructor(){super(...arguments);this.couldBeCtxOwner=false;this._isCtxOwner=false;this.init$=or(this);this._flushOutputItems=E(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let t=this.api.getOutputCollectionState();this.$["*collectionState"]=t,this.emit(b.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&t.totalCount>0&&t.status==="success"&&this._createGroup(t);},300);this._handleCollectionUpdate=(e,t,i)=>{if(this.isConnected){(t.size||i.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...t].map(s=>s.uid));for(let s of t)s.getValue("silent")||this.emit(b.FILE_ADDED,this.api.getOutputItem(s.uid)),this._sharedInstancesBag.wait("pluginManager").then(n=>n.runOnAddHooks(s));this.validationManager.runCollectionValidators();for(let s of i){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(b.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=e.map(s=>({uid:s})),this._flushCommonUploadProgress(),this._flushOutputItems();}};this._handleCollectionPropertiesUpdate=e=>{if(!this.isConnected)return;this._flushOutputItems();let t=this.uploadCollection,i=[...new Set(Object.entries(e).filter(([s])=>["file","uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(i.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=i.filter(n=>e.fileInfo?.has(n)&&!!O.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",i);}),e.uploadProgress){for(let s of e.uploadProgress){let n=O.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(b.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this._flushCommonUploadProgress();}if(e.isUploading)for(let s of e.isUploading){let n=O.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(b.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(e.fileInfo){for(let s of e.fileInfo){let n=O.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(b.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this._setInitialCrop();}if(e.errors){this.validationManager.runCollectionValidators();for(let a of e.errors){let l=O.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(b.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(b.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=t.findItems(a=>!!a.getValue("fileInfo")),n=t.findItems(a=>a.getValue("errors").length>0);t.size>0&&n.length===0&&t.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(b.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}e.cdnUrl&&([...e.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(b.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this._flushCommonUploadProgress=()=>{let e=0,i=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));i.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(e+=a);});let s=i.length?Math.round(e/i.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(b.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get _hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof r?e._isCtxOwner&&e.isConnected&&e!==this:false)}initCallback(){super.initCallback(),this._addSharedContextInstance("*uploadCollection",()=>new pi({initialValue:Vo,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this._addSharedContextInstance("*secureUploadsManager",e=>new ci(e)),this._addSharedContextInstance("*validationManager",e=>new di(e)),this._addSharedContextInstance("*publicApi",e=>new gi(e)),!this._hasCtxOwner&&this.couldBeCtxOwner&&this._initCtxOwner();}getAPI(){return this.api}get validationManager(){return this._getSharedContextInstance("*validationManager")}get api(){return this._getSharedContextInstance("*publicApi")}get uploadCollection(){return this._getSharedContextInstance("*uploadCollection")}get secureUploadsManager(){return this._getSharedContextInstance("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this._isCtxOwner&&this._unobserveUploadCollection(),this._flushOutputItems.cancel();}connectedCallback(){super.connectedCallback(),this._isCtxOwner&&this._observeUploadCollection();}_initCtxOwner(){this._isCtxOwner=true,this._observeUploadCollection(),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1;});}_observeUploadCollection(){this._unobserveUploadCollection(),this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate);}_unobserveUploadCollection(){this._unobserveCollectionProperties?.(),this._unobserveCollection?.(),this._unobserveCollectionProperties=void 0,this._unobserveCollection=void 0;}async _createGroup(e){let t=await this.getUploadClientOptions(),i=e.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await uploadFileGroup(i,{...t,signal:s.signal});if(this.$["*collectionState"]!==e){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(b.GROUP_CREATED,a),this.emit(b.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}_setInitialCrop(){let e=bi(this.cfg.cropPreset);if(!e)return;let[t]=e,i=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of i){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof t?.width=="number"&&typeof t?.height=="number"&&t.width>0&&t.height>0?t.width/t.height:1,u=Go(a,l,c),p=G(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:p,cdnUrl:F(h,p)});}}async getMetadataFor(e){let t=this.cfg.metadata||void 0;if(typeof t=="function"){let i=this.api.getOutputItem(e);return await t(i)}return t}async getUploadClientOptions(){let e=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:qo,integration:this.cfg.userAgentIntegration,secureSignature:e?.secureSignature,secureExpire:e?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return mi(this._sharedInstancesBag)}};T.extSrcList=Object.freeze({...ne});T.sourceTypes=Object.freeze({...A});var Pe=class extends g{constructor(){super(...arguments);this.name="";this._resolvedHref="";this._pluginSvg=null;this._iconHrefResolver=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this._iconHrefResolver=t,this._updateResolvedHref();});let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._updateResolvedHref()));}willUpdate(e){super.willUpdate(e),e.has("name")&&this._updateResolvedHref();}_updateResolvedHref(){if(!this.name){this._resolvedHref="",this._pluginSvg=null;return}let t=this._sharedInstancesBag.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(t){this._pluginSvg=t.svg,this._resolvedHref="";return}this._pluginSvg=null;let i=`#uc-icon-${this.name}`,s=this._iconHrefResolver?.(this.name);this._resolvedHref=s??i;}render(){return this._pluginSvg?html`${this.yield("",html`${unsafeSVG(this._pluginSvg)}`)}`:html` ${this.yield("",html`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this._resolvedHref}></use></svg>`)} `}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback();}};d([property({type:String})],Pe.prototype,"name",2),d([state()],Pe.prototype,"_resolvedHref",2),d([state()],Pe.prototype,"_pluginSvg",2);var Qo=r=>[...new Set(r)];var Ve="--uc-img-",gr="unresolved";var vr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),br=3e3,yr=5e3,_r=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Sa="https://ucarecdn.com",Xe=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Sa},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var _i=class extends Be(ze(LitElement)){constructor(){super();this._state={};this._subscribers=new Map;this._isnObserver=null;this._observed=null;for(let e in Xe){let t=Xe[e];this._state[Ve+e]=t?.default||"";}}createRenderRoot(){return this}$$(e){return this._state[Ve+e]}set$$(e){for(let t in e){let i=Ve+t,s=e[t];this._state[i]=s,this._notify(i,s);}}sub$$(e,t){let i=Ve+e;this._subscribers.has(i)||this._subscribers.set(i,new Set),this._subscribers.get(i)?.add(t);let s=this._state[i];s!==null&&s!==""&&t(s);}_notify(e,t){this._subscribers.has(e)&&this._subscribers.get(e)?.forEach(i=>{t===null||t===""||i(t);});}analyticsParams(){return `-/@clib/${pe}/${he}/uc-img/`}initAttributes(e){Array.from(this.attributes).forEach(t=>{let i=t;Xe[i.name]||e.setAttribute(i.name,i.value);});}initIntersection(e,t){let i={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(t(),this._isnObserver?.unobserve(e));});},i),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e);}connectedCallback(){super.connectedCallback(),this._initCssProperties();}_initCssProperties(){for(let e in Xe){let t=Ve+e,i=this.getCssData(t,true);i!=null&&(this._state[t]=i);}}disconnectedCallback(){super.disconnectedCallback(),this._isnObserver&&(this._observed?.forEach(e=>{this._isnObserver?.unobserve(e);}),this._isnObserver=null),this._subscribers.clear();}static get observedAttributes(){return Object.keys(Xe)}attributeChangedCallback(e,t,i){window.setTimeout(()=>{let s=Ve+e;this._state[s]=i,this._notify(s,i);});}};var Jo=r=>Object.entries(r).filter(([o,e])=>e!==void 0&&e!=="").map(([o,e])=>o==="cdn-operations"||o==="analytics"?e:`${o}/${e}`);var Ti=class extends _i{constructor(){super(...arguments);this._img=new Image;this._imgPreview=new Image;}_fmtAbs(e){return !e.includes("//")&&!vr&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if(!e)return;let t=e,i=t.match(/\d+/)?.[0],s=t.match(/[a-zA-Z]+/)?.[0];if(!i||!s)return;let n=parseInt(i,10);return Number(n)>yr&&this._hasFormatJPG?yr+s:Number(n)>br&&!this._hasFormatJPG?br+s:e}_getCdnModifiers(e,t){let i={format:this._getTypedCssValue("format"),quality:this._getTypedCssValue("quality"),resize:this._validateSize(e),blur:t,"cdn-operations":this._getTypedCssValue("cdn-operations")??void 0,analytics:this.analyticsParams()};return G(...Jo(i))}_getTypedCssValue(e){let t=this.$$(e);if(t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t}_getUrlBase(e="",t=""){let i=this.$$("src");if(i.startsWith("data:")||i.startsWith("blob:"))return i;if(vr&&i&&!i.includes("//"))return this._proxyUrl(i);let s=this._getCdnModifiers(e,t),n=this.$$("cdn-cname"),a=n;if(i.startsWith(String(n)))return F(i,s);let l=this.$$("uuid");if(a&&l)return this._proxyUrl(F(Ie(a,l),s));if(l)return this._proxyUrl(F(Ie(a,l),s));let c=this.$$("proxy-cname");if(c)return this._proxyUrl(F(c,s,this._fmtAbs(i)));let u=this.$$("pubkey");if(u)return this._proxyUrl(F(`https://${u}.ucr.io/`,s,this._fmtAbs(i)))}_proxyUrl(e){let t=this.$$("secure-delivery-proxy");return t?Ke(t,{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}_getElSize(e,t=1,i=true){let s=e.getBoundingClientRect(),n=t*Math.round(s.width),a=i?"":t*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}_setupEventProxy(e){let t=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},i=["load","error"];for(let s of i)e.addEventListener(s,t);}get img(){return this._hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get _currentImg(){return this._hasPreviewImage?{type:_r.PREVIEW,img:this._imgPreview}:{type:_r.MAIN,img:this.img}}get _hasPreviewImage(){return this.$$("is-preview-blur")}get _bgSelector(){return this.$$("is-background-for")}get _breakpoints(){let e=this.$$("breakpoints");if(e){let t=N(e);return Qo(t.map(i=>parseInt(i,10)))}else return null}get _hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}_renderBg(e){let t=new Set;t.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&t.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&t.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let i=`image-set(${[...t].join(", ")})`;e.style.setProperty("background-image",i),e.style.setProperty("background-image",`-webkit-${i}`);}_getSrcset(){let e=new Set;return this._breakpoints?this._breakpoints.forEach(t=>{e.add(`${this._getUrlBase(`${t}x`)} ${this._validateSize(`${t}w`)}`),this.$$("hi-res-support")&&e.add(`${this._getUrlBase(`${t*2}x`)} ${this._validateSize(`${t*2}w`)}`),this.$$("ultra-res-support")&&e.add(`${this._getUrlBase(`${t*3}x`)} ${this._validateSize(`${t*3}w`)}`);}):(e.add(`${this._getUrlBase(this._getElSize(this._currentImg.img))} 1x`),this.$$("hi-res-support")&&e.add(`${this._getUrlBase(this._getElSize(this._currentImg.img,2))} 2x`),this.$$("ultra-res-support")&&e.add(`${this._getUrlBase(this._getElSize(this._currentImg.img,3))} 3x`)),[...e].join()}_getSrc(){return this._getUrlBase()}get _srcUrlPreview(){return this._getUrlBase("100x","100")}_renderBackground(){let e=this._bgSelector;[...document.querySelectorAll(e)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this._renderBg(t);}):this._renderBg(t);});}_appendURL({elNode:e,src:t,srcset:i}){t&&(e.src=t),i&&(e.srcset=i);}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e);}_loaderImage({src:e,srcset:t,elNode:i}){return new Promise((s,n)=>{this._setupConfigForImage({elNode:i}),i.setAttribute(gr,""),i.addEventListener("load",()=>{i.removeAttribute(gr),s(i);}),i.addEventListener("error",()=>{n(false);}),this._appendURL({elNode:i,src:e,srcset:t});})}async _renderImage(){if(this.$$("intersection")){this._hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this._currentImg.img,async()=>{this._hasPreviewImage&&(this._imgPreview.src=this._srcUrlPreview);try{await this._loaderImage({src:this._getSrc(),srcset:this._getSrcset(),elNode:this._img}),this._hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img);}catch{this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img);}});return}try{this._hasPreviewImage&&(await this._loaderImage({src:this._srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this._loaderImage({src:this._getSrc(),srcset:this._getSrcset(),elNode:this._img}),this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img);}catch{this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img);}}init(){this._bgSelector?this._renderBackground():this._renderImage();}};var Cr=class extends Ti{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",o=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=o?"lazy":"eager");});}};var wr=null,Ct=class extends g{constructor(){super(...arguments);this.dialogEl=createRef();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);};this._handleDialogClose=()=>{this.closeDialog();};this._handleDialogMouseDown=e=>{this._mouseDownTarget=e.target;};this._handleDialogMouseUp=e=>{let t=e.target;t===this.dialogEl.value&&t===this._mouseDownTarget&&this.closeDialog();};this._handleModalOpen=({id:e})=>{e===this.id?(wr=e,this.show(),this.emit(b.MODAL_OPEN,{modalId:e},{debounce:true})):this.hide();};this._handleModalClose=({id:e})=>{e===this.id&&(this.hide(),this.emit(b.MODAL_CLOSE,{modalId:e,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this._handleModalCloseAll=e=>{this.hide(),wr===this.id&&this.emit(b.MODAL_CLOSE,{modalId:wr,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let e=this.dialogEl.value;typeof e.showModal=="function"?(this.setAttribute("aria-modal","true"),e.showModal()):e.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let e=this.dialogEl.value;e&&(typeof e.close=="function"?(this.setAttribute("aria-modal","false"),e.close()):e.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",e=>{e?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(B.OPEN,this._handleModalOpen),this.modalManager?.subscribe(B.CLOSE,this._handleModalClose),this.modalManager?.subscribe(B.CLOSE_ALL,this._handleModalCloseAll);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.modalManager?.unsubscribe(B.OPEN,this._handleModalOpen),this.modalManager?.unsubscribe(B.CLOSE,this._handleModalClose),this.modalManager?.unsubscribe(B.CLOSE_ALL,this._handleModalCloseAll);}_handleDialogRef(e){this.dialogEl={value:e},this.dialogEl.value?.addEventListener("close",this._handleDialogClose),this.dialogEl.value?.addEventListener("mousedown",this._handleDialogMouseDown),this.dialogEl.value?.addEventListener("mouseup",this._handleDialogMouseUp);}render(){return html`<dialog ${ref(this._handleDialogRef)}>${this.yield("")}</dialog>`}};d([property({type:Boolean,noAccessor:true})],Ct.prototype,"strokes",2),d([property({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ct.prototype,"blockBodyScrolling",2);var Ei=class extends T{constructor(){super(...arguments);this._validationInputElement=null;this._dynamicInputsContainer=null;}get _inputName(){return this.nameAttrValue??this.ctxName}_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this._inputName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,hi(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{if(!e)return;if(!this._dynamicInputsContainer){let n=document.createElement("div");this.appendChild(n),this._dynamicInputsContainer=n;}if(!this._validationInputElement){let n=this._createValidationInput();this.appendChild(n),this._validationInputElement=n;}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let n=e.errors[0]?.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(n??"");return}let t=e.group?e.group:null;if(t){this._validationInputElement.value=t.cdnUrl??"",this._validationInputElement.setCustomValidity("");return}let i=e.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&i.length===1&&i[0]){this._validationInputElement.value=i[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let s=new DocumentFragment;for(let n of i){let a=document.createElement("input");a.type="hidden",a.name=`${this._inputName}[]`,a.value=n,s.appendChild(a);}this._dynamicInputsContainer.replaceChildren(s);},false);}};d([property({type:String,noAccessor:true,attribute:"name"})],Ei.prototype,"nameAttrValue",2);var Tr=class extends g{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",o=>{this.toggleAttribute("hidden",!!o);});}render(){return html`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Qe=class extends g{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this._progressValue=0;this._fakeProgressLineRef=createRef();this._handleFakeProgressAnimation=()=>{let e=this._fakeProgressLineRef.value;if(e){if(!this.visible){e.classList.add("uc-fake-progress--hidden");return}this._progressValue>0&&e.classList.add("uc-fake-progress--hidden");}};}firstUpdated(e){super.firstUpdated(e),this._progressValue=this._normalizeProgressValue(this.value),this._updateProgressValueStyle(),this._fakeProgressLineRef.value?.addEventListener("animationiteration",this._handleFakeProgressAnimation);}updated(e){if(super.updated(e),e.has("value")){let t=this._normalizeProgressValue(this.value);if(!this.visible)this._progressValue=t;else {let i=Math.max(this._progressValue,t);i!==this._progressValue&&(this._progressValue=i,this._updateProgressValueStyle());}}e.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this._updateProgressValueStyle():this._progressValue=this._normalizeProgressValue(this.value));}disconnectedCallback(){super.disconnectedCallback(),this._fakeProgressLineRef.value?.removeEventListener("animationiteration",this._handleFakeProgressAnimation);}_normalizeProgressValue(e){return Number.isFinite(e)?Math.min(100,Math.max(0,e)):0}_updateProgressValueStyle(){this.visible&&this.style.setProperty("--l-progress-value",this._progressValue.toString());}render(){return html`<div ${ref(this._fakeProgressLineRef)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};d([property({type:Boolean,noAccessor:true})],Qe.prototype,"hasFileName",2),d([property({type:Number})],Qe.prototype,"value",2),d([property({type:Boolean,reflect:true})],Qe.prototype,"visible",2);var wt=class extends T{constructor(){super();this._visible=false;this._value=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this._unobserveCollectionCb=this.uploadCollection.observeProperties(()=>{let e=this.uploadCollection.items().some(t=>this.uploadCollection.read(t)?.getValue("isUploading")??false);this._visible=e;}),this.sub("*commonProgress",e=>{this._value=e;});}updated(e){super.updated(e),e.has("visible")&&(this._visible?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this._unobserveCollectionCb?.(),this._unobserveCollectionCb=void 0;}render(){return html`<uc-progress-bar .value=${this._value} .visible=${this._visible}></uc-progress-bar>`}};d([state()],wt.prototype,"_visible",2),d([state()],wt.prototype,"_value",2);var Je=class extends g{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this._handleChange=e=>{if(this.disabled){e.preventDefault(),e.stopPropagation();return}e.preventDefault(),e.stopPropagation();let t=e.currentTarget;t&&(this.value=t.value,this.dispatchEvent(new Event("change")));};}render(){return html`<select @change=${this._handleChange} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(e=>html`<option value=${e.value}>${e.text}</option>`)}</select>`}};d([property({type:String,attribute:false})],Je.prototype,"value",2),d([property({type:Boolean,reflect:true})],Je.prototype,"disabled",2),d([property({type:Array,attribute:false})],Je.prototype,"options",2);var et=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this._iconName="default";this._srcTypeKey="";}willUpdate(e){super.willUpdate(e),e.has("source")&&this._applySource(this.source);}_applySource(e){if(!e){this._srcTypeKey="",this._iconName="default";return}let{label:t,icon:i,id:s}=e;this._srcTypeKey=t,this._iconName=i??s??"default";}activate(){this.source&&this.source.onClick();}render(){return html`<button type="button" @click=${this.activate}><uc-icon name=${this._iconName}></uc-icon><div class="uc-txt">${this.l10n(this._srcTypeKey)}</div></button>`}};d([property({attribute:false})],et.prototype,"source",2),d([state()],et.prototype,"_iconName",2),d([state()],et.prototype,"_srcTypeKey",2);var Tt=class extends T{constructor(){super(...arguments);this._rawSourceList=[];this._sources=[];this.wrap=false;}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this._rawSourceList=N(t),this._updateSources();});let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._updateSources()));}updated(e){super.updated(e),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}_updateSources(){let t=this._sharedInstancesBag.pluginManager?.snapshot().sources??[],i=new Map(t.map(n=>[n.id,n])),s=[];this._rawSourceList.forEach(n=>{let a=this._expandSource(n,i);if(a.length!==1||a[0]!==n){for(let u of a){let p=i.get(u);p&&s.push(this._makePluginSourceConfig(p));}return}let c=i.get(n);c&&s.push(this._makePluginSourceConfig(c));}),this._sources=s;}_expandSource(e,t){let i=t.get(e);return i?.expand?i.expand():[e]}_makePluginSourceConfig(e){return {id:e.id,label:e.label,icon:e.icon,onClick:()=>e.onSelect()}}render(){return html`${this._sources.map(e=>html`<uc-source-btn role="listitem" .source=${e} data-source-id=${e.id}></uc-source-btn>`)}`}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback();}};d([state()],Tt.prototype,"_sources",2),d([property({type:Boolean,attribute:"wrap",noAccessor:true})],Tt.prototype,"wrap",2);var Sr=class extends g{render(){return html`<div class="uc-spinner"></div>`}};var de="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function De(r){let o=new Image;return {promise:new Promise((i,s)=>{o.src=r,o.onload=()=>i(),o.onerror=n=>s(n);}),image:o,cancel:()=>{o.naturalWidth===0&&(o.src=de);}}}function Et(r){let o=[];for(let s of r){let n=De(s);o.push(n);}let e=o.map(s=>s.image);return {promise:Promise.allSettled(o.map(s=>s.promise)),images:e,cancel:()=>{o.forEach(s=>{s.cancel();});}}}function Ir(r,o=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return Promise.reject(new Error("Canvas context not supported"));let i=new Image,s=new Promise((n,a)=>{i.onload=()=>{let l=i.height/i.width;l>1?(e.width=o,e.height=o*l):(e.height=o,e.width=o/l),t.fillStyle="rgb(240, 240, 240)",t.fillRect(0,0,e.width,e.height),t.drawImage(i,0,0,e.width,e.height),e.toBlob(c=>{if(!c){a();return}let u=URL.createObjectURL(c);n(u);});},i.onerror=l=>{a(l);};});return i.src=URL.createObjectURL(r),s}var tt=class extends T{constructor(){super(...arguments);this._entrySubs=new Set;this.entry=null;}withEntry(e){return (...t)=>{let i=this.entry;if(!i){console.warn("No entry found");return}return e(i,...t)}}subEntry(e,t){this.withEntry((i,s,n)=>{let a=i.subscribe(s,l=>{this.isConnected&&n(l);});this._entrySubs.add(a);})(e,t);}reset(){for(let e of this._entrySubs)e();this._entrySubs=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this._entrySubs=new Set;}};function za(r){let o=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(o)}function xi(r="hsl(209, 21%, 65%)",o=32,e=32){return za(`<svg width="${o}" height="${e}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}var ja=3e3,it=class extends tt{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this._thumbUrl="";this._renderedGridOnce=false;this._thumbRect=null;this._isIntersecting=false;this._firstViewMode=this.cfg.filesViewMode;this._generateThumbnail=this.withEntry(async(e,t=false)=>{let i=e.getValue("fileInfo"),s=e.getValue("isImage"),n=e.getValue("uuid"),a=e.getValue("thumbUrl"),l=this._calculateThumbSize(t);if(i&&s&&n){let u=await this.proxyUrl(F(Ie(this.cfg.cdnCname,n),G(e.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===u)return;let{promise:p}=De(u);p.then(()=>{e.setValue("thumbUrl",u),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=e.getValue("file");if(!h)return;let m=await Ir(h,l);e.setValue("thumbUrl",m);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",xi(m));}});return}if(e.getValue("thumbUrl"))return;let c=e.getValue("file");if(c?.type.includes("image"))try{let u=await Ir(c,l);e.setValue("thumbUrl",u);}catch(u){this.telemetryManager.sendEventError(u,"thumbnail generation. Failed to generate thumb from file");let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",xi(p));}else {let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",xi(u));}});this._debouncedGenerateThumb=E(this._generateThumbnail.bind(this),100);}_calculateThumbSize(e=false){e&&(this._thumbRect=this.getBoundingClientRect());let t=Math.max(parseInt(String(this?._thumbRect?.height||0),10),parseInt(String(this?._thumbRect?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(t*=window.devicePixelRatio),Math.min(t,ja)}_decodeImage(e,t){return new Promise((i,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=de,t?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(t){if(t.aborted){l();return}t.addEventListener("abort",l,{once:true});}let c=()=>{a(),i();},u=p=>{a(),s(p);};if(typeof n.decode=="function"){n.src=e,n.decode().then(c).catch(u);return}n.onload=c,n.onerror=u,n.src=e;})}_cancelPendingThumbUpdate(){this._pendingThumbUpdate?.cancel(),this._pendingThumbUpdate=void 0;}_scheduleThumbUpdate(e){if(this._cancelPendingThumbUpdate(),!e){this._thumbUrl&&(this._thumbUrl="");return}if(e===this._thumbUrl)return;let t=new AbortController,i={controller:t,cancel:()=>{t.abort(),i.rafId!==void 0&&window.cancelAnimationFrame(i.rafId);}};this._pendingThumbUpdate=i,this._decodeImage(e,t.signal).then(()=>{t.signal.aborted||(i.rafId=window.requestAnimationFrame(()=>{t.signal.aborted||(this._thumbUrl=e);}));}).catch(s=>{t.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}_requestThumbGeneration(e=false){if(this.entry){if(e){this._generateThumbnail(true);return}this._isIntersecting&&this._debouncedGenerateThumb();}}firstUpdated(e){super.firstUpdated(e),this._bindToEntry();}updated(e){super.updated(e),e.has("uid")&&this._bindToEntry();}_observerCallback(e){let[t]=e;t&&(this._isIntersecting=t.isIntersecting,t.isIntersecting&&(this._thumbRect=t.boundingClientRect,this._requestThumbGeneration(),this._observer?.disconnect()),t.intersectionRatio===0&&this._debouncedGenerateThumb.cancel());}reset(){super.reset(),this._debouncedGenerateThumb.cancel(),this._cancelPendingThumbUpdate(),this._thumbUrl&&(this._thumbUrl="");}_bindToEntry(){let e=this.uid?.trim();if(!e){this.entry&&this.reset();return}let t=this.uploadCollection?.read(e);if(!t||t===this.entry)return;this.reset(),this.entry=t;let i=()=>{this._requestThumbGeneration();};this.subEntry("fileInfo",s=>{s?.isImage&&i();}),this.subEntry("thumbUrl",s=>{this._scheduleThumbUpdate(s??void 0);}),this.subEntry("cdnUrlModifiers",i),this._requestThumbGeneration(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",e=>{e==="grid"&&!this._renderedGridOnce&&(this._firstViewMode==="list"&&this._requestThumbGeneration(true),this._renderedGridOnce=true);});}connectedCallback(){super.connectedCallback(),this._observer?.disconnect(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:.1}),this._observer.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),this._cancelPendingThumbUpdate(),this._observer?.disconnect();}render(){return html`<div class="uc-thumb"><img class="uc-thumb__img" src=${this._thumbUrl||de} role="img" alt="Preview of uploaded image" ?hidden=${!this._thumbUrl} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};d([property({type:String})],it.prototype,"badgeIcon",2),d([property({attribute:false})],it.prototype,"uid",2),d([state()],it.prototype,"_thumbUrl",2);var Ar=class extends v{};var kr=class extends v{constructor(){super(...arguments);this.historyTracked=true;this.activityType=v.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return html`<div class="uc-content">${this.yield("")}</div>`}};var Mr=class extends T{constructor(){super(...arguments);this._unbindEventEmitter=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=b;}initCallback(){super.initCallback(),this._unbindEventEmitter=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this._unbindEventEmitter?.();}};var rt=(r,o)=>{let e=false,t,i=0,s=((...n)=>{e?(t&&clearTimeout(t),t=setTimeout(()=>{Date.now()-i>=o&&(r(...n),i=Date.now());},Math.max(o-(Date.now()-i),0))):(r(...n),i=Date.now(),e=true);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{t&&clearTimeout(t);}}),s};var z=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),D=class D extends tt{constructor(){super(...arguments);this.couldBeCtxOwner=true;this._pauseRender=true;this.uid="";this._itemName="";this._errorText="";this._hint="";this._progressValue=0;this._progressVisible=false;this._badgeIcon="";this._isFinished=false;this._isFailed=false;this._isUploading=false;this._isFocused=false;this._showFileNames=false;this._ariaLabelStatusFile="";this._pluginFileActions=[];this._renderedOnce=false;this._handleRemove=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this._handleUploadClick=()=>{this._upload();};this._debouncedCalculateState=E(()=>this._calculateState(),100);this._updateHintAndProgress=this.withEntry(rt((e,t)=>{let i=e.getValue("errors")?.[0]?.message??"",s=e.getValue("source"),n=e.getValue("externalUrl"),a=t===z.FINISHED,l=t===z.UPLOADING,c=t===z.QUEUED_UPLOADING,u=t===z.QUEUED_VALIDATION,p=t===z.VALIDATION,h=e.getValue("fileName"),m="";i?m="":!a&&n&&s&&Object.values(ne).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this._hint=m,this._errorText=i,this._progressVisible=l||c||u||p,this._progressValue=u||p?0:e.getValue("uploadProgress"),this._ariaLabelStatusFile=h?this.l10n("a11y-file-item-status",{fileName:h,status:this.l10n(t?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this._upload=this.withEntry(async e=>{if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0||e.getValue("isValidationPending"))return;let t=this.cfg.multiple?this.cfg.multipleMax:1;if(!(t&&this.uploadCollection.size>t)){e.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this._debouncedCalculateState();try{let i=new AbortController;e.setValue("abortController",i);let s=async()=>{e.setValue("isQueuedForUploading",!1);let a=e.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this._sharedInstancesBag.pluginManager?.snapshot().fileHooks??[]).filter(m=>m.type==="beforeUpload");for(let m of h)try{let{file:f}=await m.handler({file:a});f!==a&&(a=f,e.setValue("mimeType",a.type||null),e.setValue("isImage",He(a)),e.setValue("fileSize",a.size),a instanceof File&&e.setValue("fileName",a.name));}catch(f){this.debugPrint(`File hook "beforeUpload" from plugin "${m.pluginId}" failed`,f);}}let l=a||e.getValue("externalUrl")||e.getValue("uuid");if(!l)throw new Error("No file input");let u={...await this.getUploadClientOptions(),fileName:e.getValue("fileName")??void 0,source:e.getValue("source")??void 0,onProgress:p=>{if(p.isComputable){let h=p.value*100;e.setValue("uploadProgress",h);}},signal:i.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",l,u),uploadFile(l,u)},n=await this.$["*uploadQueue"].add(s);e.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:e.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:e.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:e.getValue("source")??null}),e===this.entry&&this._debouncedCalculateState();}catch(i){let s=i instanceof CancelError&&i.isCancel;s?e.setMultipleValues({isUploading:false,uploadProgress:0}):i instanceof UploadcareError?e.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:i}):(console.error("Unknown upload error",i),e.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:i})})),e===this.entry&&this._debouncedCalculateState(),this.isConnected&&!s&&this.telemetryManager.sendEventError(i,"file upload. Failed to upload file");}}});}_calculateState(){let e=this.entry;if(!e)return;let t=z.IDLE;e.getValue("errors").length>0?t=z.FAILED:e.getValue("isQueuedForUploading")?t=z.QUEUED_UPLOADING:e.getValue("isQueuedForValidation")?t=z.QUEUED_VALIDATION:e.getValue("isValidationPending")?t=z.VALIDATION:e.getValue("isUploading")?t=z.UPLOADING:e.getValue("fileInfo")&&(t=z.FINISHED),this._handleState(e,t);}_handleState(e,t){t===z.FAILED?this._badgeIcon="badge-error":t===z.FINISHED&&(this._badgeIcon="badge-success"),t===z.UPLOADING&&(this._isFocused=false,this.removeAttribute("focused")),this._isFailed=t===z.FAILED,this._isUploading=t===z.UPLOADING,this._isFinished=t===z.FINISHED,this._updateHintAndProgress(t);}reset(){super.reset(),this._debouncedCalculateState.cancel();}_observerCallback(e){let[t]=e;t&&t.isIntersecting&&!this._renderedOnce&&(this._pauseRender=false,this._renderedOnce=true);}_handleEntryId(e){this.reset();let t=this.uploadCollection?.read(e);if(this.entry=t,!t){this._updatePluginFileActions();return}this.subEntry("isQueuedForValidation",()=>{this._debouncedCalculateState();}),this.subEntry("isValidationPending",()=>{this._debouncedCalculateState();}),this.subEntry("uploadProgress",()=>{this._debouncedCalculateState();}),this.subEntry("isQueuedForUploading",()=>{this._debouncedCalculateState();}),this.subEntry("fileName",i=>{this._itemName=i||t.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState();}),this.subEntry("externalUrl",i=>{this._itemName=t.getValue("fileName")||i||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this._debouncedCalculateState();}),this.subEntry("errors",()=>this._debouncedCalculateState()),this.subEntry("isUploading",()=>this._debouncedCalculateState()),this.subEntry("fileSize",()=>this._debouncedCalculateState()),this.subEntry("mimeType",()=>this._debouncedCalculateState()),this.subEntry("isImage",()=>this._debouncedCalculateState()),this.subEntry("fileInfo",()=>this._updatePluginFileActions()),this.subEntry("isUploading",()=>this._updatePluginFileActions()),this.subEntry("errors",()=>this._updatePluginFileActions()),this._calculateState(),this._updatePluginFileActions();}_updateShowFileNames(e){if(this.cfg.filesViewMode==="list"){this._showFileNames=true;return}this._showFileNames=e;}willUpdate(e){super.willUpdate(e),e.has("uid")&&this._handleEntryId(this.uid);}_updatePluginFileActions(){let e=this._sharedInstancesBag.pluginManager;if(!e||!this.uid){this._pluginFileActions=[];return}let t=e.snapshot().fileActions,i=this.api.getOutputItem(this.uid);if(!i){this._pluginFileActions=[];return}this._pluginFileActions=t.filter(s=>{try{return s.shouldRender(i)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}_handlePluginFileAction(e){if(!this.uid)return;let t=this.api.getOutputItem(this.uid);if(t)try{e.onClick(t);}catch(i){console.error(`Error in plugin file action onClick (${e.id}):`,i);}}initCallback(){super.initCallback(),this._handleEntryId(this.uid),this.subConfigValue("filesViewMode",t=>{this._updateShowFileNames(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this._updateShowFileNames(t);}),this.onclick=()=>{D.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this._upload());});let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._updatePluginFileActions())),this._updatePluginFileActions(),D.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this);}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback(),this._observer?.disconnect(),D.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(e){return this._pauseRender?false:super.shouldUpdate(e)}render(){return html`<div class="uc-inner" ?data-finished=${this._isFinished} ?data-uploading=${this._isUploading} ?data-failed=${this._isFailed} ?data-focused=${this._isFocused} ><uc-thumb .uid=${this.uid} .badgeIcon=${this._badgeIcon}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this._ariaLabelStatusFile}><span class="uc-file-name" ?hidden=${!this._showFileNames}>${this._itemName}</span><span class="uc-file-error" ?hidden=${!this._errorText}>${this._errorText}</span><span class="uc-file-hint" ?hidden=${!this._hint}>${this._hint}</span></div><div class="uc-file-actions">${this._pluginFileActions.map(e=>html`<button type="button" @click=${()=>this._handlePluginFileAction(e)} title=${this.l10n(e.label)} aria-label=${this.l10n(e.label)} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${e.id} ><uc-icon name=${e.icon}></uc-icon></button>`)}<button type="button" @click=${this._handleRemove} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this._handleUploadClick}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this._progressValue} .visible=${this._progressVisible} ?hasFileName=${this._showFileNames}></uc-progress-bar></div>`}};d([state()],D.prototype,"_pauseRender",2),d([property({attribute:false})],D.prototype,"uid",2),d([state()],D.prototype,"_itemName",2),d([state()],D.prototype,"_errorText",2),d([state()],D.prototype,"_hint",2),d([state()],D.prototype,"_progressValue",2),d([state()],D.prototype,"_progressVisible",2),d([state()],D.prototype,"_badgeIcon",2),d([state()],D.prototype,"_isFinished",2),d([state()],D.prototype,"_isFailed",2),d([state()],D.prototype,"_isUploading",2),d([state()],D.prototype,"_isFocused",2),d([state()],D.prototype,"_showFileNames",2),d([state()],D.prototype,"_ariaLabelStatusFile",2),d([state()],D.prototype,"_pluginFileActions",2);var Pr=D;function Xa(r){return new Promise(o=>{typeof window.FileReader!="function"&&o(false);try{let e=new FileReader;e.onerror=()=>{o(!0);};let t=i=>{i.type!=="loadend"&&e.abort(),o(!1);};e.onloadend=t,e.onprogress=t,e.readAsDataURL(r);}catch{o(false);}})}function Qa(r,o){return new Promise(e=>{let t=0,i=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),e(null);return}a.isFile?(t++,a.file(l=>{t--;let c=new File([l],l.name,{type:l.type||o});i.push({type:"file",file:c,fullPath:a.fullPath}),t===0&&e(i);})):a.isDirectory&&n(a.createReader());},n=a=>{t++,a.readEntries(l=>{t--;for(let c of l)s(c);t===0&&e(i);});};s(r);})}function as(r){let o=[],e=[];for(let t=0;t<r.items.length;t++){let i=r.items[t];if(i)if(i.kind==="file"){let s=i.type,n=i;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&e.push(Qa(l,s).then(c=>{c&&o.push(...c);}));continue}let a=i.getAsFile();a&&e.push(Xa(a).then(l=>{l||o.push({type:"file",file:a});}));}else i.kind==="string"&&/^text\/uri-list/.test(i.type)&&e.push(new Promise(s=>{i.getAsString(n=>{o.push({type:"url",url:n}),s();});}));}return Promise.all(e).then(()=>o)}var q=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),ls=["focus"],Ja=100,Or=new Map;function el(r,o){let e=Math.max(Math.min(r[0],o.x+o.width),o.x),t=Math.max(Math.min(r[1],o.y+o.height),o.y);return Math.sqrt((r[0]-e)*(r[0]-e)+(r[1]-t)*(r[1]-t))}function Lr(r){let o=0,e=document.body,t=new Set,i=f=>{t.add(f);},s=q.INACTIVE,n=f=>{r.shouldIgnore()&&f!==q.INACTIVE||(s!==f&&t.forEach(R=>{R(f);}),s=f);},a=()=>o>0;i(f=>r.onChange(f));let l=()=>{o=0,n(q.INACTIVE);},c=()=>{o+=1,s===q.INACTIVE&&n(q.ACTIVE);},u=()=>{o-=1,a()||n(q.INACTIVE);},p=f=>{f.preventDefault(),o=0,n(q.INACTIVE);},h=f=>{if(r.shouldIgnore())return;a()||(o+=1);let R=[f.x,f.y],w=r.element.getBoundingClientRect(),L=Math.floor(el(R,w)),J=L<Ja,Nt=f.composedPath().includes(r.element);Or.set(r.element,L);let Zr=Math.min(...Or.values())===L;Nt&&Zr?(f.preventDefault(),n(q.OVER)):n(J&&Zr?q.NEAR:q.ACTIVE);},m=async f=>{if(r.shouldIgnore())return;f.preventDefault();let{dataTransfer:R}=f;if(!R)return;let w=await as(R);r.onItems(w),n(q.INACTIVE);};return e.addEventListener("drop",p),e.addEventListener("dragleave",u),e.addEventListener("dragenter",c),e.addEventListener("dragover",h),r.element.addEventListener("drop",m),ls.forEach(f=>{window.addEventListener(f,l);}),()=>{Or.delete(r.element),e.removeEventListener("drop",p),e.removeEventListener("dragleave",u),e.removeEventListener("dragenter",c),e.removeEventListener("dragover",h),r.element.removeEventListener("drop",m),ls.forEach(f=>{window.removeEventListener(f,l);});}}var Rr=new Set,re=class extends T{constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this._isEnabled=true;this._isVisible=true;this._destroyDropzone=null;this._destroyContentWrapperDropzone=null;this._contentWrapperRef=createRef();this._handleAreaInteraction=e=>{if(e instanceof KeyboardEvent){if(e.code!=="Space"&&e.code!=="Enter")return}else if(!(e instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this._sourceListAllowsLocal=true;this._clickableListenersAttached=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}get _localizedText(){let e=this.text;return typeof e=="string"&&e.length>0?this.l10n(e)||e:this.l10n("drop-files-here")}isActive(){if(!this._isEnabled)return false;let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,i=e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return t&&n&&i}initCallback(){super.initCallback(),Rr.add(this),this._updateIsEnabled(),this._updateVisibility(),this._updateClickableListeners(),this._updateDragStateAttribute(q.INACTIVE),this._destroyDropzone=Lr({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:e=>{this._updateDragStateAttribute(e);},onItems:e=>{e.length&&(e.forEach(t=>{t.type==="url"?this.api.addFileFromUrl(t.url,{source:A.DROP_AREA}):t.type==="file"&&this.api.addFileFromObject(t.file,{source:A.DROP_AREA,fullPath:t.fullPath});}),this.uploadCollection.size&&(this.set$({"*currentActivity":v.activities.UPLOAD_LIST}),this.modalManager?.open(v.activities.UPLOAD_LIST)));}}),this.updateComplete.then(()=>this._setupContentWrapperDropzone()),this.subConfigValue("sourceList",e=>{let t=N(e);this._sourceListAllowsLocal=t.includes(A.LOCAL),this._updateIsEnabled(),this._updateVisibility();});}willUpdate(e){super.willUpdate(e),e.has("disabled")&&(this._updateIsEnabled(),this._updateVisibility());}updated(e){super.updated(e),e.has("clickable")&&this._updateClickableListeners();}_shouldIgnore(){if(!this._isEnabled||!this._couldHandleFiles())return true;if(!this.fullscreen)return false;let e=Rr;return e.size===0?false:[...e].filter(s=>s!==this).filter(s=>s.isActive()).length>0}_couldHandleFiles(){let e=this.cfg.multiple,t=this.cfg.multipleMax,i=this.uploadCollection.size;return !(e&&t&&i>=t||!e&&i>0)}_updateIsEnabled(){let e=this._sourceListAllowsLocal&&!this.disabled;this._isEnabled=e;}_updateVisibility(){let e=this._isEnabled||!this.querySelector("[data-default-slot]");this._isVisible=e,this.hidden=!e;}_updateDragStateAttribute(e){let t=Object.entries(q).find(([,i])=>i===e)?.[0].toLowerCase();t&&this.setAttribute("drag-state",t);}_setupContentWrapperDropzone(){if(this._destroyContentWrapperDropzone)return;let e=this._contentWrapperRef.value;e&&(this._destroyContentWrapperDropzone=Lr({element:e,onChange:t=>{let i=Object.entries(q).find(([,s])=>s===t)?.[0].toLowerCase();i&&e.setAttribute("drag-state",i);},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()}));}_updateClickableListeners(){this.clickable&&!this._clickableListenersAttached?(this.addEventListener("keydown",this._handleAreaInteraction),this.addEventListener("click",this._handleAreaInteraction),this._clickableListenersAttached=true):!this.clickable&&this._clickableListenersAttached&&(this.removeEventListener("keydown",this._handleAreaInteraction),this.removeEventListener("click",this._handleAreaInteraction),this._clickableListenersAttached=false);}disconnectedCallback(){super.disconnectedCallback(),Rr.delete(this),this._destroyDropzone?.(),this._destroyContentWrapperDropzone?.(),this._clickableListenersAttached&&(this.removeEventListener("keydown",this._handleAreaInteraction),this.removeEventListener("click",this._handleAreaInteraction),this._clickableListenersAttached=false);}render(){return html` ${this.yield("",html`<div data-default-slot hidden></div><div ${ref(this._contentWrapperRef)} class="uc-content-wrapper" ?hidden=${!this._isVisible}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this._localizedText}</span></div>`)} `}};d([property({type:Boolean,noAccessor:true})],re.prototype,"single",2),d([property({type:Boolean,noAccessor:true})],re.prototype,"ghost",2),d([property({type:Boolean,reflect:true})],re.prototype,"disabled",2),d([property({type:Boolean,reflect:true})],re.prototype,"clickable",2),d([property({type:Boolean,attribute:"with-icon",reflect:true})],re.prototype,"withIcon",2),d([property({type:Boolean,reflect:true})],re.prototype,"fullscreen",2),d([property({type:Boolean,reflect:true})],re.prototype,"initflow",2),d([property({type:String})],re.prototype,"text",2),d([state()],re.prototype,"_isEnabled",2),d([state()],re.prototype,"_isVisible",2);var ue=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=v.activities.UPLOAD_LIST;this._doneBtnVisible=false;this._doneBtnEnabled=false;this._uploadBtnVisible=false;this._addMoreBtnVisible=false;this._addMoreBtnEnabled=false;this._commonErrorMessage=null;this._hasFiles=false;this._latestSummary=null;this._handleAdd=()=>{this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this._handleUpload=()=>{this.emit(b.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate();};this._handleDone=()=>{this.emit(b.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this._handleCancel=()=>{this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this._throttledHandleCollectionUpdate=rt(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get _headerText(){return this._latestSummary?this._getHeaderText(this._latestSummary):""}_updateUploadsState(){let e=this.api.getOutputCollectionState(),t={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount,validatingBeforeUploading:e.idleEntries.filter(m=>m.isValidationPending).length},i=!e.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=e.errors.some(m=>m.type==="TOO_MANY_FILES"),n=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=e.allEntries.some(m=>m.isValidationPending),l=t.failed===0&&e.errors.length===0&&!a,c=false,u=false,p=false;if(t.total-t.succeed-t.uploading-t.failed>0&&i&&l&&this.cfg.confirmUpload)c=true;else {u=true;let m=this.cfg.groupOutput?!!e.group:true;p=t.total===t.succeed&&i&&l&&m;}this._doneBtnVisible=u,this._doneBtnEnabled=p,this._uploadBtnVisible=c,this._addMoreBtnEnabled=t.total===0||!s&&!n,this._addMoreBtnVisible=!n||this.cfg.multiple,this._hasFiles=t.total>0,this._latestSummary=t;}_getHeaderText(e){let t=i=>{let s=e[i];return i==="uploading"&&(s+=e.validatingBeforeUploading),this.l10n(`header-${i}`,{count:s})};return e.uploading>0||e.validatingBeforeUploading>0?t("uploading"):e.failed>0?t("failed"):e.succeed>0?t("succeed"):t("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",e=>{e&&this._throttledHandleCollectionUpdate();}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e);}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.uploadCollection.observeCollection(this._throttledHandleCollectionUpdate),this.sub("*collectionErrors",e=>{let t=e.filter(i=>i.type!=="SOME_FILES_HAS_ERRORS")[0];if(!t){this._commonErrorMessage=null;return}this._commonErrorMessage=t.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate),this.uploadCollection.unobserveCollection(this._throttledHandleCollectionUpdate));}render(){return html`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this._headerText}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this._hasFiles}>${this.yield("empty",html`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${repeat(this.$["*uploadList"]??[],({uid:e})=>e,({uid:e})=>html`<uc-file-item .uid=${e}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this._handleAdd} ?disabled=${!this._addMoreBtnEnabled} ?hidden=${!this._addMoreBtnVisible} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this._commonErrorMessage} >${this._commonErrorMessage??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this._handleCancel}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this._addMoreBtnVisible} ?disabled=${!this._addMoreBtnEnabled} @click=${this._handleAdd} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this._uploadBtnVisible} @click=${this._handleUpload} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this._doneBtnVisible} ?disabled=${!this._doneBtnEnabled} @click=${this._handleDone} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};d([state()],ue.prototype,"_doneBtnVisible",2),d([state()],ue.prototype,"_doneBtnEnabled",2),d([state()],ue.prototype,"_uploadBtnVisible",2),d([state()],ue.prototype,"_addMoreBtnVisible",2),d([state()],ue.prototype,"_addMoreBtnEnabled",2),d([state()],ue.prototype,"_commonErrorMessage",2),d([state()],ue.prototype,"_hasFiles",2),d([state()],ue.prototype,"_latestSummary",2);var ol=[{test:r=>!!r.accept&&!!r.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:r=>r.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:r=>r.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],us=E(r=>{for(let{test:o,message:e}of ol)o(r)&&fi(e);},0);var ps=r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function");var Vr=r=>r,al=[Vr({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:r,enableVideoRecording:o})=>{let e=o();if(e===null)return r();let t=U(r());return e&&!t.includes("video")?t=t.concat("video"):e||(t=t.filter(i=>i!=="video")),ye(t)}}),Vr({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:r,defaultCameraMode:o})=>{let e=o();if(e===null)return r();let t=U(r());return t=t.sort((i,s)=>i===e?-1:s===e?1:0),ye(t)}}),Vr({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:r,cdnCname:o,cdnCnamePrefixed:e})=>{let t=r(),i=o(),s=e();return t&&(i===mt||isPrefixedCdnBase(i,s))?getPrefixedCdnBaseAsync(t,s):i}})],hs=({key:r,setValue:o,getValue:e,computationControllers:t})=>{for(let i of al){if(!i.deps.includes(r))continue;let s={[i.key]:()=>e(i.key)};for(let l of i.deps)s[l]=()=>e(l);let n=new AbortController;t.get(i.fn)?.abort(),t.set(i.fn,n);let a;try{a=i.fn(s,{signal:n.signal});}catch(l){t.get(i.fn)===n&&t.delete(i.fn),console.error(`Failed to compute value for "${i.key}"`,l);return}ps(a)?a.then(l=>{n.signal.aborted||o(i.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${i.key}"`,l);}).finally(()=>{t.get(i.fn)===n&&t.delete(i.fn);}):o(i.key,a);}};var I=r=>String(r),K=r=>{let o=Number(r);if(Number.isNaN(o))throw new Error(`Invalid number: "${r}"`);return o},M=r=>{if(typeof r>"u"||r===null)return false;if(typeof r=="boolean")return r;if(r==="true"||r==="")return true;if(r==="false")return false;throw new Error(`Invalid boolean: "${r}"`)},ms=r=>r==="auto"?r:M(r),fs=r=>{let o=I(r);if(o!=="user"&&o!=="environment"&&o!=="")throw new Error(`Invalid value: "${o}"`);return o},gs=r=>{let o=I(r);if(!Object.values(C).includes(o))throw new Error(`Invalid value: "${o}"`);return o},vs=r=>{let o=I(r),e=U(o);if(e.some(t=>!Object.values(C).includes(t)))throw new Error(`Invalid value: "${JSON.stringify(e)}"`);return o},bs=r=>{let o=I(r);if(o==="local"||o==="global")return o;if(M(r)===false)return false;throw new Error(`Invalid value: "${o}"`)},ys=r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},Dr=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Si=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},Ii=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},_s=r=>{let o=I(r);if(["grid","list"].includes(o))return o;throw new Error(`Invalid value: "${o}"`)};var ll={pubkey:I,multiple:M,multipleMin:K,multipleMax:K,confirmUpload:M,imgOnly:M,accept:I,externalSourcesPreferredTypes:I,externalSourcesEmbedCss:I,store:ms,cameraMirror:M,cameraCapture:fs,sourceList:I,topLevelOrigin:I,maxLocalFileSizeBytes:K,thumbSize:K,showEmptyList:M,useLocalImageEditor:M,useCloudImageEditor:M,cloudImageEditorTabs:I,removeCopyright:M,cropPreset:I,imageShrink:I,modalScrollLock:M,modalBackdropStrokes:M,sourceListWrap:M,remoteTabSessionKey:I,cdnCname:I,cdnCnamePrefixed:I,baseUrl:I,socialBaseUrl:I,secureSignature:I,secureExpire:I,secureDeliveryProxy:I,retryThrottledRequestMaxTimes:K,retryNetworkErrorMaxTimes:K,multipartMinFileSize:K,multipartChunkSize:K,maxConcurrentRequests:K,multipartMaxConcurrentRequests:K,multipartMaxAttempts:K,checkForUrlDuplicates:M,saveUrlForRecurrentUploads:M,groupOutput:M,userAgentIntegration:I,debug:M,localeName:I,metadata:ys,secureUploadsExpireThreshold:K,localeDefinitionOverride:r=>Dr(r),secureUploadsSignatureResolver:r=>Si(r),secureDeliveryProxyUrlResolver:r=>Si(r),iconHrefResolver:r=>Si(r),plugins:r=>Ii(r),fileValidators:Ii,collectionValidators:Ii,validationTimeout:K,validationConcurrency:K,cameraModes:vs,defaultCameraMode:gs,enableAudioRecording:M,enableVideoRecording:M,mediaRecorderOptions:Dr,maxVideoRecordingDuration:K,filesViewMode:_s,gridShowFileNames:M,cloudImageEditorAutoOpen:M,cloudImageEditorMaskHref:I,testMode:M,qualityInsights:M,pasteScope:bs},Cs=(r,o)=>{if(!(typeof o>"u"||o===null))try{return ll[r](o)}catch(e){return console.error(`Invalid value for config key "${r}".`,e),H[r]}};var Ai=[...new Set(["debug",...Object.keys(H)])],cl=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Ts=r=>cl.includes(r),Fr=Ai.filter(r=>!Ts(r)),$r={...Object.fromEntries(Fr.map(r=>[Zt(r),r])),...Object.fromEntries(Fr.map(r=>[r.toLowerCase(),r]))},ws=r=>`__${r}`,ot=class extends g{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(H).map(([e,t])=>[_(e),t]))};this._computationControllers=new Map;this._customAttrKeyMapping={};this._customConfigKeys=new Set;this._customConfigSubscriptions=new Map;}_isCustomConfig(e){return this._customConfigKeys.has(e)}_getCustomConfigDefinition(e){let t=this._sharedInstancesBag.pluginManager;if(t)return t.configRegistry.get(e)}_getAttributeNames(e){return [...new Set([Zt(e),e.toLowerCase()])]}_flushValueToAttribute(e,t){if(Ts(e)||this._isCustomConfig(e)&&this._getCustomConfigDefinition(e)?.attribute===false)return;let i=this._getAttributeNames(e);for(let s of i)typeof t>"u"||t===null?this.removeAttribute(s):this.getAttribute(s)!==t.toString()&&this.setAttribute(s,t.toString());}_flushValueToState(e,t){let i=_(e);if(this.$[i]!==t)if(typeof t>"u"||t===null){let s=H[e];this.$[i]=s!==void 0?s:t;}else this.$[i]=t;}_setValue(e,t){let i;this._isCustomConfig(e)?i=this._getCustomConfigDefinition(e)?.normalize?.(t)??t:i=Cs(e,t);let s=this,n=ws(e);s[n]!==i&&(this._assertSameValueDifferentReference(e,s[n],i),s[n]=i,this._flushValueToAttribute(e,i),this._flushValueToState(e,i),this.debugPrint(`"${e}"`,i),this._isCustomConfig(e)||us(this.cfg));}_getValue(e){let t=this,i=ws(e);return t[i]??this.$[_(e)]}_assertSameValueDifferentReference(e,t,i){this.cfg.debug&&i!==t&&typeof i=="object"&&typeof t=="object"&&JSON.stringify(i)===JSON.stringify(t)&&(console.warn(`[uc-config] Option "${e}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${e}" previous value:`,t),console.warn(`[uc-config] "${e}" new value:`,i));}_processCustomConfigs(e){let t=e.configRegistry.getAll();this._customAttrKeyMapping={},this._customConfigKeys=new Set(t.keys());for(let[i,s]of this._customConfigSubscriptions)t.has(i)||(s(),this._customConfigSubscriptions.delete(i));for(let[i,s]of t){let a=_(i);if(s.attribute){let c=this._getAttributeNames(i);for(let u of c)this._customAttrKeyMapping[u]=i;}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let l=Object.getOwnPropertyDescriptor(this,i);if((!l||!l.set||!l.get)&&Object.defineProperty(this,i,{set:c=>{this._setValue(i,c);},get:()=>this._getValue(i),enumerable:true,configurable:true}),!this._customConfigSubscriptions.has(i)){let c=this.sub(a,u=>{this._setValue(i,u);},false);this._customConfigSubscriptions.set(i,c);}}}_setupCustomConfigs(){this._sharedInstancesBag.when("pluginManager",e=>{this._processCustomConfigs(e),this._pluginChangeUnsubscribe=e.onPluginsChange(()=>{this._processCustomConfigs(e);});});}_setupMutationObserver(){this._mutationObserver=new MutationObserver(e=>{for(let t of e)if(t.type==="attributes"&&t.attributeName){let i=t.attributeName,s=t.oldValue,n=this.getAttribute(i);if(s===n||i in $r)continue;i in this._customAttrKeyMapping&&this.attributeChangedCallback(i,s??"",n??"");}}),this._mutationObserver.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let e=this;this._setupCustomConfigs(),this._setupMutationObserver();for(let i of Fr)this.sub(_(i),s=>{this._setValue(i,s);},false);for(let i of Ai){let s=e[i]??this.$[_(i)];s!==H[i]&&this._setValue(i,s);let n=Object.getOwnPropertyDescriptor(this,i);(!n||!n.set||!n.get)&&Object.defineProperty(this,i,{set:a=>{this._setValue(i,a);},get:()=>this._getValue(i)});}let t=i=>{hs({key:i,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this),computationControllers:this._computationControllers});};for(let i of Ai)this.sub(_(i),()=>t(i));}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),t===i)return;let s=this,n=$r[e];n?s[n]=i:this._sharedInstancesBag.when("pluginManager",a=>{if(this.getAttribute(e)!==i)return;let l=this._customAttrKeyMapping[e],c=l?a.configRegistry.get(l):void 0;if(l&&c){let u=c.fromAttribute?c.fromAttribute(i):i;if(this._getValue(l)===u)return;this._setValue(l,u);}});}disconnectedCallback(){super.disconnectedCallback(),this._pluginChangeUnsubscribe&&(this._pluginChangeUnsubscribe(),this._pluginChangeUnsubscribe=void 0),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=void 0);for(let e of this._customConfigSubscriptions.values())e();this._customConfigSubscriptions.clear();}static get observedAttributes(){let e=super.observedAttributes,t=Object.keys($r);return [...e,...t]}};for(let r of Ai)ot.prototype[r]=void 0;var xt=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this._buttonTextKey="upload-file";this._handleClick=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",e=>{this._buttonTextKey=e?"upload-files":"upload-file";});}render(){return html`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this._handleClick}><uc-icon name="upload"></uc-icon><span>${this.l10n(this._buttonTextKey)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};d([property({attribute:"dropzone",type:Boolean})],xt.prototype,"dropzone",2),d([state()],xt.prototype,"_buttonTextKey",2);var It=class extends v{constructor(){super(...arguments);this._containerRef=createRef();}initCallback(){this.activityType=this.registration?.id??null,this._ensureRegistered(),super.initCallback();}willUpdate(e){super.willUpdate(e),e.has("registration")&&(this._ensureRegistered(),this.isActivityActive&&(this._disposeActivity(),this._renderActivity()));}_ensureRegistered(){this.registration&&(this._isActivityRegistered()||this.registerActivity(this.activityType??"",{onActivate:()=>this._renderActivity(),onDeactivate:()=>this._disposeActivity()}));}async _renderActivity(){await this.updateComplete;let e=this._containerRef.value;if(!e||!this.registration)return;this._disposeActivity();let t=this.$["*currentActivityParams"];this._dispose=this.registration.render(e,t)??void 0;}_disposeActivity(){let e=this._containerRef.value;e&&(this._dispose?.(),this._dispose=void 0,e.replaceChildren());}disconnectedCallback(){this._disposeActivity(),super.disconnectedCallback();}render(){return html`<div style="display: flex; flex-direction: column; width: 100%; min-height: 0;" ${ref(this._containerRef)} ></div>`}};d([property({attribute:false})],It.prototype,"registration",2);var st=class extends g{constructor(){super(...arguments);this.mode="modal";this._activities=[];}initCallback(){super.initCallback();let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._syncActivities())),this._syncActivities();}_syncActivities(){let e=this._sharedInstancesBag.pluginManager;if(!e){this._activities=[];return}this._activities=e.snapshot().activities;}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?html`${repeat(this._activities,e=>e.id,e=>html`<uc-plugin-activity-host .registration=${e}></uc-plugin-activity-host>`)}`:html`${repeat(this._activities,e=>e.id,e=>html`<uc-modal id=${e.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${e}></uc-plugin-activity-host></uc-modal>`)}`}};d([property({type:String})],st.prototype,"mode",2),d([state()],st.prototype,"_activities",2);function Ss(...r){return r.reduce((o,e)=>{if(typeof e=="string")return o[e]=true,o;for(let t of Object.keys(e))o[t]=e[t];return o},{})}function oe(...r){let o=Ss(...r);return Object.keys(o).reduce((e,t)=>(o[t]&&e.push(t),e),[]).join(" ")}function Is(r,...o){let e=Ss(...o);for(let t of Object.keys(e))r.classList.toggle(t,!!e[t]);}var gl=r=>W.includes(r),As=r=>{if(!r)return W;let o=U(r).filter(gl);return o.length===0?W:o};function ks(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":W,"*tabId":P.CROP,"*on.retryNetwork":()=>{let o=r.querySelectorAll("img");for(let e of o){let t=e.src;e.src=de,e.src=t;}r.$["*networkProblems"]=false;},"*on.apply":o=>{if(!o)return;let e=r.$["*originalUrl"];if(!e){console.warn("Original URL is null, cannot apply transformations");return}let t=G(Ae(o),"preview"),i=F(e,t),s={originalUrl:e,cdnUrlModifiers:t,cdnUrl:i,transformations:o};r.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),r.remove();},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var Ms="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var $e={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},nt=class extends g{constructor(){super(...arguments);this._visible=false;this._styles=$e;this._visibleStyle=$e.visible;this._hiddenStyle=$e.hidden;this._externalTransitions=false;this._initialRenderComplete=false;}set visible(e){this._visible=e,this._handleVisible();}get visible(){return this._visible}set styles(e){this._styles=e,this._externalTransitions=true,this._visibleStyle=e.visible??$e.visible,this._hiddenStyle=e.hidden??$e.hidden;}get styles(){return this._styles}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Is(this,{[$e.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.toggleAttribute("inert",!this._visible);}_dispatchInitialRenderEvent(){this._initialRenderComplete||(this._initialRenderComplete=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this._externalTransitions||this.classList.add($e.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this._dispatchInitialRenderEvent();},0);}};d([property({type:Boolean})],nt.prototype,"visible",1),d([property({attribute:false})],nt.prototype,"styles",1);var At=class extends g{constructor(){super(...arguments);this.active=false;this._lineRef=createRef();this._isAnimating=false;this._handleTransitionEndRight=()=>{let e=this._lineRef.value;e&&(this._resetLine(e),this._isAnimating&&this.active&&this._start());};}firstUpdated(e){super.firstUpdated(e),this.active&&this._start();}updated(e){super.updated(e),e.has("active")&&(this.active?this._start():this._stop());}_start(){let e=this._lineRef.value;if(!e)return;this._isAnimating=true;let{width:t}=this.getBoundingClientRect();e.removeEventListener("transitionend",this._handleTransitionEndRight),e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:true});}_stop(){let e=this._lineRef.value;e&&(this._isAnimating=false,e.removeEventListener("transitionend",this._handleTransitionEndRight),this._resetLine(e));}_resetLine(e){e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)";}render(){return html`<div class="uc-inner"><div class="uc-line" ${ref(this._lineRef)}></div></div>`}};d([property({type:Boolean,reflect:true})],At.prototype,"active",2);var ae=class extends g{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(e){super.firstUpdated(e),this._applyReverse(),this._applyThemeClass();}updated(e){super.updated(e),e.has("reverse")&&this._applyReverse(),e.has("theme")&&this._applyThemeClass();}_applyReverse(){this.style.flexDirection=this.reverse?"row-reverse":"";}_applyThemeClass(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get _iconClassMap(){let e=this._computedIconHidden;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":e,"uc-icon_single":this._computedIconSingle}}get _computedIconHidden(){return !this.icon}get _computedIconSingle(){return !this.text&&!this._computedIconHidden}render(){return html`<button type="button" role=${ifDefined(this.ariaRole||void 0)} aria-controls=${ifDefined(this.ariaControls||void 0)} aria-label=${ifDefined(this.l10n(this.titleProp))} title=${ifDefined(this.l10n(this.titleProp))} ><uc-icon class=${classMap(this._iconClassMap)} name=${ifDefined(this.icon||void 0)} ?hidden=${this._computedIconHidden} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};d([property({type:String})],ae.prototype,"text",2),d([property({type:String})],ae.prototype,"icon",2),d([property({type:Boolean,reflect:true})],ae.prototype,"reverse",2),d([property({type:String,reflect:true})],ae.prototype,"theme",2),d([property({attribute:"aria-role"})],ae.prototype,"ariaRole",2),d([property({attribute:"aria-controls"})],ae.prototype,"ariaControls",2),d([property({attribute:"title-prop"})],ae.prototype,"titleProp",2),d([property({type:Boolean,noAccessor:true})],ae.prototype,"active",2);function Os(r,o){let e={};for(let t of o){let i=r[t];(Object.hasOwn(r,t)||i!==void 0)&&(e[t]=i);}return e}function at(r,o,e){let i=window.devicePixelRatio,s=Math.min(Math.ceil(o*i),3e3),n=i>=2?"lightest":"normal";return F(r,G(Gt,Ae(e),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${pe}/${he}/uc-cloud-image-editor/`))}var Mt=class extends g{constructor(){super(...arguments);this._backdropMaskId=`uc-backdrop-mask-${ee.generateFastUid()}`;this._guidesHidden=false;this._draggingValue=false;this._svgRef=createRef();this._svgReady=false;this._pendingMaskHref=null;this._handlePointerUp=e=>{this._updateCursor(),this._dragging&&(e.stopPropagation(),e.preventDefault(),this._dragging=false);};this._handlePointerMove=e=>{if(!this._dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let t=this._svgElement;if(!t)return;let{x:i,y:s}=t.getBoundingClientRect(),n=e.x-i,a=e.y-s,l=n-this._dragStartPoint[0],c=a-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[l,c]);p&&(this.$["*cropBox"]=p);};this._handleSvgPointerMove=e=>{if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(i=>{if(!i||this._shouldThumbBeDisabled(i.direction))return false;let n=i.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return Ho(a,[e.x,e.y])});this._hoverThumb=t,this._updateCursor();};}get _svgElement(){return this._svgRef.value??null}get _dragging(){return this._draggingValue}set _dragging(e){this._draggingValue!==e&&(this._draggingValue=e,this._applyGuidesDragState());}_applyGuidesDragState(){this._frameGuides&&this._frameGuides.setAttribute("class",oe({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&this._draggingValue,"uc-guides--semi-hidden":!this._guidesHidden&&!this._draggingValue}));}_shouldThumbBeDisabled(e){let t=this.$["*imageBox"];if(!t)return false;if(e===""&&t.height<=y&&t.width<=y)return true;let i=t.height<=y&&(e.includes("n")||e.includes("s")),s=t.width<=y&&(e.includes("e")||e.includes("w"));return i||s}_createBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:s,height:n}=e,a=this._svgElement;if(!a)return;let l=ie("mask",{id:this._backdropMaskId}),c=ie("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=ie("rect",{x:t,y:i,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(u);let p=ie("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this._backdropMaskId})`});a.appendChild(p),a.appendChild(l),this._backdropMask=l,this._backdropMaskInner=u;}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block");}));}_updateBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:i,width:s,height:n}=e;this._backdropMaskInner&&ke(this._backdropMaskInner,{x:t,y:i,width:s,height:n});}_updateFrame(){let e=this.$["*cropBox"];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{direction:i,pathNode:s,interactionNode:n,groupNode:a}=t,l=i==="",c=i.length===2,{x:u,y:p,width:h,height:m}=e;if(l)ke(n,{x:u,y:p,width:h,height:m});else {let R=Me(Math.min(h,m)/82/2,0,1),w=c?$o(e,i,R):Fo(e,i,R),L=w.center;if(!L)continue;let J=Math.max(fr*Me(Math.min(h,m)/fr/3,0,1),Do);ke(n,{x:L[0]-J,y:L[1]-J,width:J*2,height:J*2}),ke(s,{d:w.d});}let f=this._shouldThumbBeDisabled(i);a.setAttribute("class",oe("uc-thumb",{"uc-thumb--hidden":f,"uc-thumb--visible":!f}));}ke(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1});}}_createThumb(e,t){let i=ie("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let s=ie("rect",{fill:"transparent"}),n=ie("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(n),i.appendChild(s),e[t]={direction:t,pathNode:n,interactionNode:s,groupNode:i},t===""&&(i.style.cursor="move"),s.addEventListener("pointerdown",this._handlePointerDown.bind(this,t));}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let i=0;i<3;i++){let s=`${["n","","s"][t]}${["w","","e"][i]}`;s!==""&&this._createThumb(e,s);}return this._createThumb(e,""),e}_createGuides(){let e=ie("svg"),t=ie("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let i=1;i<=2;i++){let s=ie("line",{x1:`${yt*i}%`,y1:"0%",x2:`${yt*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(s);}for(let i=1;i<=2;i++){let s=ie("line",{x1:"0%",y1:`${yt*i}%`,x2:"100%",y2:`${yt*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(s);}return e.classList.add("uc-guides","uc-guides--semi-hidden"),e}_createFrame(){let e=this._svgElement;if(!e)return;let t=document.createDocumentFragment(),i=this._createGuides();t.appendChild(i);let s=this._createThumbs();for(let{groupNode:n}of Object.values(s))t.appendChild(n);e.appendChild(t),this._frameThumbs=s,this._frameGuides=i,this._applyGuidesDragState();}_handlePointerDown(e,t){if(!this._frameThumbs)return;let i=this._frameThumbs[e];if(!i||this._shouldThumbBeDisabled(e))return;let s=this.$["*cropBox"],n=this._svgElement;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=t.x-a,u=t.y-l;this._dragging=true,this._draggingThumb=i,this._dragStartPoint=[c,u],this._dragStartCrop={...s};}_calcCropBox(e,t){let[i,s]=t,n=this.$["*imageBox"],a=this._dragStartCrop??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(e===""?a=Bo({rect:a,delta:[i,s],imageBox:n}):a=zo({rect:a,delta:[i,s],direction:e,aspectRatio:c,imageBox:n}),!Object.values(a).every(u=>Number.isFinite(u)&&u>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return We(Ze(a),n)}_updateCursor(){let e=this._hoverThumb,t=this._svgElement;t&&(t.style.cursor=e?No(e.direction):"initial");}_createMask(e){if(this._frameImage){this._frameImage.setAttribute("href",e);return}let t=this._svgElement;if(!t){this._pendingMaskHref=e;return}this._pendingMaskHref=null;let i=document.createDocumentFragment(),s=ie("image",{href:e});s.setAttribute("class","uc-cloud-mask"),i.appendChild(s),t.appendChild(i),this._frameImage=s;}_updateMask(){let e=this.$["*cropBox"];if(!e||!this._frameImage)return;let{x:t,y:i,width:s,height:n}=e;ke(this._frameImage,{x:t,y:i,height:n,width:s});}_render(){this._svgReady&&(this._updateBackdrop(),this._updateFrame(),this._updateMask());}toggleThumbs(e){if(this._frameThumbs)for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{groupNode:i}=t;i.setAttribute("class",oe("uc-thumb",{"uc-thumb--hidden":!e,"uc-thumb--visible":e}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._resizeBackdrop(),this._svgReady&&window.requestAnimationFrame(()=>{this._render();});}),this.sub("*cropBox",e=>{e&&(this._guidesHidden=e.height<=y||e.width<=y,this._applyGuidesDragState(),this._svgReady&&window.requestAnimationFrame(()=>{this._render();}));}),this.subConfigValue("cloudImageEditorMaskHref",e=>{e&&this._createMask(e);}),document.addEventListener("pointermove",this._handlePointerMove,true),document.addEventListener("pointerup",this._handlePointerUp,true);}firstUpdated(e){super.firstUpdated(e),this._initializeSvg();}_initializeSvg(){let e=this._svgElement;if(!(!e||this._svgReady)){if(this._createBackdrop(),this._createFrame(),this._svgReady=true,e.addEventListener("pointermove",this._handleSvgPointerMove,true),this._pendingMaskHref){let t=this._pendingMaskHref;this._pendingMaskHref=null,this._createMask(t);}this._render();}}disconnectedCallback(){super.disconnectedCallback(),this._svgElement?.removeEventListener("pointermove",this._handleSvgPointerMove,true),document.removeEventListener("pointermove",this._handlePointerMove,true),document.removeEventListener("pointerup",this._handlePointerUp,true);}render(){return html`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${ref(this._svgRef)}></svg>`}};d([state()],Mt.prototype,"_draggingValue",2);function Ml(r){return r?[({dimensions:e,coords:t})=>[...e,...t].every(i=>Number.isInteger(i)&&Number.isFinite(i)),({dimensions:e,coords:t})=>e.every(i=>i>0)&&t.every(i=>i>=0)].every(e=>e(r)):true}var Pt=class extends g{constructor(){super();this.ctxOwner=true;this._imageSize={width:0,height:0};this._ctx=null;this._isActive=false;this._image=null;this._canvasRef=createRef();this._frameRef=createRef();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=E(this._commit.bind(this),300),this._handleResizeThrottled=rt(()=>{!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw());},100);}firstUpdated(e){super.firstUpdated(e),this._initCanvas();}_syncTransformations(){let e=this.$["*editorTransformations"],t=Os(e,Object.keys(this.$["*operations"])),i={...this.$["*operations"],...t};this.$["*operations"]=i;}_initCanvas(){let e=this._canvasRef.value;if(!e)return;let t=e.getContext("2d"),i=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${i}px`,e.style.height=`${s}px`,e.width=i*n,e.height=s*n,t?.scale(n,n),this._canvas=e,this._ctx=t;}_alignImage(){if(!this._isActive||!this._image)return;let e=this._image,t=this.$["*padding"],i=this.$["*operations"],{rotate:s}=i,n={width:this.offsetWidth,height:this.offsetHeight},a=qe({width:e.naturalWidth,height:e.naturalHeight},s),l;if(a.width>n.width-t*2||a.height>n.height-t*2){let c=a.width/a.height,u=n.width/n.height;if(c>u){let p=n.width-t*2,h=p/c,m=0+t,f=t+(n.height-t*2)/2-h/2;l={x:m,y:f,width:p,height:h};}else {let p=n.height-t*2,h=p*c,m=t+(n.width-t*2)/2-h/2,f=0+t;l={x:m,y:f,width:h,height:p};}}else {let{width:c,height:u}=a,p=t+(n.width-t*2)/2-c/2,h=t+(n.height-t*2)/2-u/2;l={x:p,y:h,width:c,height:u};}this.$["*imageBox"]=Ze(l);}_alignCrop(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=t;if(n){let{dimensions:[h,m],coords:[f,R]}=n,{width:w}=qe(this._imageSize,s),L=a/w;e=We(Ze({x:l+f*L,y:c+R*L,width:h*L,height:m*L}),t);}let u=this.$["*currentAspectRatio"],p=u?u.width/u.height:void 0;if(!Ko(e,t)||p&&!jo(e,p)){let h=t.width/t.height,m=t.width,f=t.height;p&&(h>p?m=Math.min(t.height*p,t.width):f=Math.min(t.width/p,t.height)),e={x:t.x+t.width/2-m/2,y:t.y+t.height/2-f/2,width:m,height:f};}this.$["*cropBox"]=We(Ze(e),t);}_drawImage(){let e=this._ctx;if(!e)return;let t=this._image;if(!t)return;let i=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=qe({width:i.width,height:i.height},l);e.save(),e.translate(i.x+i.width/2,i.y+i.height/2),e.rotate(l*Math.PI*-1/180),e.scale(n?-1:1,a?-1:1),e.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),e.restore();}_draw(){if(!this._isActive||!this._image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage();}_animateIn({fromViewer:e}){this._image&&(this._frameRef.value?.toggleThumbs(true),this._transitionToImage(),setTimeout(()=>{this.className=oe({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":false});}));}_getCropDimensions(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:n,height:a}=t,{width:l,height:c}=qe(this._imageSize,s),{width:u,height:p}=e,h=n/l,m=a/c;return [Me(Math.round(u/h),1,l),Me(Math.round(p/m),1,c)]}_getCropTransformation(){let e=this.$["*cropBox"],t=this.$["*imageBox"],i=this.$["*operations"],{rotate:s}=i,{width:n,height:a,x:l,y:c}=t,{width:u,height:p}=qe(this._imageSize,s),{x:h,y:m}=e,f=n/u,R=a/p,w=this._getCropDimensions(),L={dimensions:w,coords:[Me(Math.round((h-l)/f),0,u-w[0]),Me(Math.round((m-c)/R),0,p-w[1])]};if(!Ml(L)){console.error("Cropper is trying to create invalid crop object",{payload:L});return}if(!(w[0]===u&&w[1]===p))return L}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:t,mirror:i,flip:s}=e,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:i,flip:s};this.$["*editorTransformations"]=l;}setValue(e,t){this.$["*operations"]={...this.$["*operations"],[e]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw());}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:t}={}){if(!this._isActive){this._isActive=true,await this.updateComplete,this._initCanvas(),this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{let i=this.$["*originalUrl"],s=this.$["*editorTransformations"];this._image=await this._waitForImage(i,s),this._syncTransformations(),this._handleResizeThrottled(),this._animateIn({fromViewer:t});}catch(i){console.error("Failed to activate cropper",{error:i}),this.telemetryManager.sendEventError(i,"cloud editor image. Failed to activate cropper");}this._observer=new ResizeObserver(i=>{let[s]=i;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this._isActive&&this._image&&this._handleResizeThrottled();}),this._observer.observe(this);}}deactivate({reset:e=false}={}){this._isActive&&(!e&&this._commit(),this._isActive=false,this._transitionToCrop(),this.className=oe({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this._frameRef.value?.toggleThumbs(false),this.addEventListener("transitionend",this._reset,{once:true}),this._observer?.disconnect());}_transitionToCrop(){let e=this._getCropDimensions(),t=this.$["*cropBox"],i=Math.min(this.offsetWidth,e[0])/t.width,s=Math.min(this.offsetHeight,e[1])/t.height,n=Math.min(i,s),a=t.x+t.width/2,l=t.y+t.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}_transitionToImage(){let e=this.$["*cropBox"],t=e.x+e.width/2,i=e.y+e.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${i}px`;}_reset(){this._isActive||(this._image=null);}async _waitForImage(e,t){let i=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(at(e,i,t)),{promise:n,cancel:a,image:l}=De(s),c=this._handleImageLoading(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this._cancelPreload?.(),this._cancelPreload=a,n.then(()=>l).catch(u=>(console.error("Failed to load image",{error:u}),this.$["*networkProblems"]=true,l))}_handleImageLoading(e){let t="crop",i=this.$["*loadingOperations"],s=i.get(t);return s||(s=new Map,i.set(t,s)),s.get(e)||(s.set(e,true),this.$["*loadingOperations"]=i),()=>{let n=i.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=i);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw();}),this.sub("*cropBox",()=>{this._image&&this._commitDebounced();}),this.sub("*currentAspectRatio",()=>{this._alignCrop();}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this._imageSize&&this.activate(this._imageSize,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._image&&(this._image=null);}render(){return html`<canvas class="uc-canvas" ${ref(this._canvasRef)}></canvas><uc-crop-frame ${ref(this._frameRef)}></uc-crop-frame>`}};d([state()],Pt.prototype,"_image",2);function Nr(r,o,e){let t=e,i=e-1,s=new Array(t);for(let n=i;n>=0;n-=1)s[n]=Math.ceil((n*o+(i-n)*r)/i);return s}function Ol(r){return typeof r=="string"&&r in le}function Ll(r){let o=[];for(let e=0;e<r.length-1;e+=1){let t=r[e],i=r[e+1];typeof t=="number"&&typeof i=="number"&&o.push([t,i]);}return o}function Rl(r,o,e){let t=Ll(r).find(([n,a])=>n<=o&&o<=a);if(!t)return r.map(()=>0);let[i,s]=t;return r.map(n=>{let a=Math.abs(i-s)||1,l=Math.abs(o-i)/a;return i===n?o>e?1:1-l:s===n?o>=e?l:1:0})}function Ul(r,o){return r.map((e,t)=>e<o?r.length-t:t)}function Ds(r,o){let e=le[r].keypointsNumber,{range:t,zero:i}=le[r];return [...new Set([...Nr(t[0],i,e+1),...Nr(i,t[1],e+1),i,o])].sort((s,n)=>s-n)}var ki=class extends g{constructor(){super();this._isActive=false;this._hidden=true;this._operation="initial";this._transformations={};this._keypoints=[];this._raf=0;this._previewHostRef=createRef();this._layersHostRef=createRef();this.classList.add("uc-inactive_to_cropper"),this._addKeypointDebounced=E(async(e,t,i)=>{let s=()=>!this._isSame(e,t)||this._value!==i||!!this._keypoints.find(c=>c.value===i);if(s())return;let n=await this._constructKeypoint(e,i),a=new Image;a.src=n.src;let l=this._handleImageLoading(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this._keypoints,u=c.findIndex(f=>f.value>i);u===-1&&(u=c.length);let h=c[u]?.image,m=this._layersHostRef.value;!m||h&&!m.contains(h)||(c.splice(u,0,n),h?m.insertBefore(a,h):m.appendChild(a),this._update(e,i));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}_handleImageLoading(e){let t=this._operation,i=this.$["*loadingOperations"];i.has(t)||i.set(t,new Map);let s=i.get(t);return s&&!s.get(e)&&(s.set(e,true),this.$["*loadingOperations"]=i),()=>{let n=i.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=i);}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString());}});}_imageSrc({url:e=this._url,filter:t=this._filter??void 0,operation:i,value:s}={}){if(!e)throw new Error("URL is not defined");let n={...this._transformations};i&&(i==="filter"?t&&typeof s=="number"&&(n.filter={name:t,amount:s}):typeof s=="number"&&(n[i]=s));let a=this.offsetWidth;return this.proxyUrl(at(e,a,n))}async _constructKeypoint(e,t){return {src:await this._imageSrc({operation:e,value:t}),image:void 0,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}set(e){let t=typeof e=="string"?parseInt(e,10):e;!Ol(this._operation)||!Number.isFinite(t)||(this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t));}_update(e,t){this._operation=e,this._value=t;let{zero:i}=le[e],s=this._keypoints.map(l=>l.value),n=Rl(s,t,i),a=Ul(s,i);this._keypoints.forEach((l,c)=>{let u=n[c],p=a[c];typeof u=="number"&&(l.opacity=u),typeof p=="number"&&(l.zIndex=p);}),this._flush();}_createPreviewImage(){let e=new Image;return e.classList.add("uc-fader-image","uc-fader-image--preview"),e.style.opacity="0",e}async _initNodes(){this._previewImage=this._previewImage||this._createPreviewImage();let e=this._previewImage;e&&this._ensurePreviewAttached(e);let t=this._keypoints.map(c=>c.src),{images:i,promise:s,cancel:n}=Et(t);i.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u);}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0;};let a=this._operation,l=this._filter;if(await s,this._isActive&&this._isSame(a,l)){let c=this._layersHostRef.value;if(!c)return;c.replaceChildren(),this._keypoints.forEach((u,p)=>{let h=i[p];h&&(h.classList.add("uc-fader-image"),u.image=h,c.appendChild(h));}),this._flush();}}async setTransformations(e){if(this._transformations=e,this._previewImage){let t=await this._imageSrc(),i=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",i,{once:true}),this._previewImage.addEventListener("error",i,{once:true}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:e,filter:t,operation:i,value:s}){if(!i||typeof s!="number")return;this._cancelBatchPreload?.();let n=Ds(i,s),a=await Promise.all(n.map(c=>this._imageSrc({url:e,filter:t,operation:i,value:c}))),{cancel:l}=Et(a);this._cancelBatchPreload=l;}_setOriginalSrc(e){let t=this._previewImage||this._createPreviewImage();if(this._ensurePreviewAttached(t),this._previewImage=t,t.src===e){t.style.opacity="1",t.style.transform="scale(1)",this.className=oe({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":false});return}t.style.opacity="0";let i=this._handleImageLoading(e);t.addEventListener("error",i,{once:true}),t.src=e,t.addEventListener("load",()=>{i(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=oe({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":false}));},{once:true}),t.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:e,operation:t,value:i,filter:s,fromViewer:n}){if(this._isActive=true,this._hidden=false,await this.updateComplete,this._url=e,this._operation=t??"initial",this._value=i,this._filter=s,this._fromViewer=n,typeof i!="number"&&!s){let l=await this._imageSrc({operation:t,value:i});this._setOriginalSrc(l),this._clearLayersHost();return}!t||typeof i!="number"||(this._keypoints=await Promise.all(Ds(t,i).map(l=>this._constructKeypoint(t,l))),this._update(t,i),this._initNodes());}deactivate({hide:e=true}={}){this._isActive=false,this._cancelLastImages?.(),this._cancelBatchPreload?.(),e&&!this._hidden?(this._hidden=true,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=oe({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this._clearLayersHost();},{once:true})):this._clearLayersHost();}_ensurePreviewAttached(e){let t=this._previewHostRef.value;t&&(t.contains(e)||t.appendChild(e));}_clearLayersHost(){this._layersHostRef.value?.replaceChildren();}render(){return html`<div class="uc-fader-preview-host" ${ref(this._previewHostRef)}></div><div class="uc-fader-layers-host" ${ref(this._layersHostRef)}></div>`}};var ge=class extends g{constructor(){super();this._thumbSize=0;this._inputRef=createRef();this._thumbRef=createRef();this._stepsRef=createRef();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this._currentValue=0;this._handleSliderInput=e=>{e.stopPropagation();let t=this._extractEventValue(e);t!==null&&(this._setCurrentValue(t),this._emitSliderEvent("slider-input",t));};this._handleSliderChange=e=>{e.stopPropagation();let t=this._extractEventValue(e);t!==null&&this._setCurrentValue(t);};this._handleInputFocus=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this._handleInputBlur=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}_emitSliderEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:{value:t},bubbles:true,composed:true}));}firstUpdated(e){super.firstUpdated(e),this._thumbSize=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this._syncInputValue(this._currentValue),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps(),this._updateValue(this._currentValue);}),this._observer.observe(this);let t=this._inputRef.value;t?.addEventListener("focus",this._handleInputFocus),t?.addEventListener("blur",this._handleInputBlur),window.setTimeout(()=>{this._updateValue(this._currentValue);},0);}willUpdate(e){super.willUpdate(e),e.has("defaultValue")&&this.defaultValue!==this._currentValue&&this._setCurrentValue(this.defaultValue),(e.has("min")||e.has("max"))&&this.hasUpdated&&(this._updateSteps(),this._updateValue(this._currentValue)),e.has("zero")&&this.hasUpdated&&this._updateZeroDot(this._currentValue);}_updateValue(e){this._updateZeroDot(e);let t=this.max-this.min;if(t===0)return;let{width:i}=this.getBoundingClientRect(),a=100/t*(e-this.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{let l=this._thumbRef.value;l&&(l.style.transform=`translateX(${a}px)`);});}_updateZeroDot(e){if(!this._zeroDotEl)return;let t=this.max-this.min;if(t===0)return;this._zeroDotEl.style.opacity=e===this.zero?"0":"1";let{width:i}=this.getBoundingClientRect(),a=100/t*(this.zero-this.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl&&(this._zeroDotEl.style.transform=`translateX(${a}px)`);});}_updateSteps(){let t=this._stepsRef.value;if(!t)return;let{width:i}=t.getBoundingClientRect(),s=Math.ceil(i/2),n=Math.ceil(s/15)-2;if(this._stepsCount===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let p=0;p<n;p+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let p=0;p<n;p+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let u=document.createElement("div");u.className="uc-zero-dot",a.appendChild(u),this._zeroDotEl=u,t.innerHTML="",t.appendChild(a),this._stepsCount=n;}disconnectedCallback(){super.disconnectedCallback();let e=this._inputRef.value;e?.removeEventListener("focus",this._handleInputFocus),e?.removeEventListener("blur",this._handleInputBlur),this._observer?.disconnect(),this._observer=void 0;}_setCurrentValue(e){Number.isFinite(e)&&(this._currentValue=e,this.hasUpdated&&(this._syncInputValue(e),this._updateValue(e)));}_syncInputValue(e){let t=this._inputRef.value;t&&(t.value=String(e));}_extractEventValue(e){let t=e.currentTarget;if(!t)return null;let i=Number.parseInt(t.value,10);return Number.isFinite(i)?i:null}render(){return html`<div class="uc-steps" ${ref(this._stepsRef)}></div><div class="uc-thumb" ${ref(this._thumbRef)}></div><input class="uc-input" type="range" ${ref(this._inputRef)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this._currentValue)} ?disabled=${this.disabled} @input=${this._handleSliderInput} @change=${this._handleSliderChange} />`}};d([property({type:Boolean,reflect:true})],ge.prototype,"disabled",2),d([property({type:Number})],ge.prototype,"min",2),d([property({type:Number})],ge.prototype,"max",2),d([property({type:Number,attribute:false})],ge.prototype,"defaultValue",2),d([property({type:Number})],ge.prototype,"zero",2),d([state()],ge.prototype,"_currentValue",2);var ve="original",Lt=class extends g{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this._handleInput=e=>{let{value:t}=e.detail;this.$["*faderEl"]?.set(t),this.state={...this.state,value:t};};}setOperation(e,t){this.state={...this.state,operation:e,filter:t},this._initializeValues();let i=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];i&&s&&i.activate({url:s,operation:this.state.operation,value:this.state.filter===ve?void 0:this.state.value,filter:this.state.filter===ve?void 0:this.state.filter,fromViewer:false});}_initializeValues(){let e=this.state.operation,{range:t,zero:i}=le[e],[s,n]=t;this.state={...this.state,min:s,max:n,zero:i};let l=this.$["*editorTransformations"][e];if(e==="filter"){let u=Number(n),p=l;if(p){let{name:h,amount:m}=p;u=h===this.state.filter?m:n;}this.state={...this.state,value:u,defaultValue:u};return}let c=typeof l<"u"?l:i;this.state={...this.state,value:c,defaultValue:c};}apply(){let t={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===ve?delete t.filter:t.filter={name:this.state.filter,amount:this.state.value}:t[this.state.operation]=this.state.value,this.$["*editorTransformations"]=t;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{e&&(this.state={...this.state,originalUrl:e});});}updated(e){if(super.updated(e),e.has("state")){let t=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=t;}}render(){return html`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this._handleInput} ></uc-slider-ui>`}};d([state()],Lt.prototype,"state",2);function lt(r){if(!r)return null;let o=r.match(/^([A-Za-z]+)\s+(\d+)$/);if(!o)return null;let[,e,t]=o;return !e||typeof t>"u"?null:{filter:e,value:Number(t)}}var Z=class extends g{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let e=this.active;return {"uc-active":e,"uc-not_active":!e}}_updateHostStateClasses(){let e=this.buttonClasses;for(let[t,i]of Object.entries(e))this.classList.toggle(t,i);}onClick(e){}connectedCallback(){super.connectedCallback(),this._updateHostStateClasses();}updated(e){super.updated(e),e.has("active")&&this._updateHostStateClasses();}render(){let e=this.onClick,t=this.title;return html`<button role="option" type="button" aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${e} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!t}>${t}</div></button>`}};d([state()],Z.prototype,"active",2),d([state()],Z.prototype,"title",2),d([state()],Z.prototype,"icon",2),d([state()],Z.prototype,"titleProp",2);var Pi=12,Oi=16,zl=r=>{let o=12,e=12;return r.width/r.height>=1?(o=Pi,e=Math.round(Pi*r.height/r.width)):(e=Pi,o=Math.round(Pi*r.width/r.height)),{width:o,height:e}},Ui=class extends Z{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",o=>{let e=this._computeTitle(o);this.title=e,this.titleProp=e;});}onClick(){this.$["*showListAspectRatio"]=true;}_computeTitle(o){return o?o.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${o.width}:${o.height}`}):""}render(){let o=this.onClick,e=this.title;return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${o} ><div class="uc-title" ?hidden=${!e}>${e}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Rt=class extends Z{constructor(){super(...arguments);this._aspectRatio=null;}get aspectRatio(){return this._aspectRatio}set aspectRatio(e){if(this._aspectRatio===e)return;let t=this._aspectRatio;this._aspectRatio=e,this.requestUpdate("aspectRatio",t),e?this._updateAspectRatioPresentation(e):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this._aspectRatio&&this._updateAspectRatioPresentation(this._aspectRatio),this.sub("*currentAspectRatio",e=>{this.active=e&&e.id===this._aspectRatio?.id||e?.width===this._aspectRatio?.width&&e?.height===this._aspectRatio?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this._aspectRatio?.id&&(this.$["*currentAspectRatio"]=this._aspectRatio);}_updateAspectRatioPresentation(e){if(!this.isConnected)return;let t=!!e.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",t);let i=()=>{let n=t?this.l10n("custom"):`${e.width}:${e.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:t?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${e.width}:${e.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};i(),s(),t||this.requestUpdate();}_renderIcon(){let e=this._aspectRatio;if(!e||e.hasFreeform)return html`<uc-icon name=${this.icon}></uc-icon>`;let{width:t,height:i}=zl(e),s=(Oi-t)/2,n=(Oi-i)/2;return html`<uc-icon><svg viewBox="0 0 ${Oi} ${Oi}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${t} height=${i} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let e=this.onClick,t=this.title;return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${e} >${this._renderIcon()}<div class="uc-title" ?hidden=${!t}>${t}</div></button>`}};d([property({attribute:false})],Rt.prototype,"aspectRatio",1);function Kl(r){let o=r+90;return o=o>=360?0:o,o}function jl(r,o){if(r==="rotate")return Kl(typeof o=="number"?o:0);if(r==="mirror"||r==="flip")return !o;throw new Error(`Unsupported operation: ${r}`)}var Ut=class extends Z{constructor(){super(...arguments);this.operation=void 0;}willUpdate(e){super.willUpdate(e),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(e){if(!this.operation)return;let t=this.$["*cropperEl"],i=t.getValue(this.operation),s=jl(this.operation,i);this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:this.operation,next:s,prev:i}),t.setValue(this.operation,s);}};d([property({type:String})],Ut.prototype,"operation",2);var Ee=class extends Z{constructor(){super(...arguments);this._operation="";this._filter="";this._originalUrl="";this._lastPreviewRequestId=0;this._previewImage=null;this._previewLoaded=false;this.isOriginal=false;this._iconSize=20;}get filter(){return this._filter}set filter(e){let t=e??"";if(this._filter===t)return;let i=this._filter;this._filter=t,this._operation="filter",this.isOriginal=t===ve,this.icon=this.isOriginal?"original":"slider",this._iconSize=this.isOriginal?40:20,this.requestUpdate("filter",i),this.isConnected&&this._updateFilterLabels(t);}onClick(e){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=true);else {let t=this.$["*sliderEl"];t.setOperation(this._operation,this._filter),t.apply();}this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:lt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this._filter;}_previewSrc(){let e=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=Number.isFinite(e)&&e>0?e:this._iconSize||32,i=window.devicePixelRatio,s=Math.ceil(i*t),n=i>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==ve?{name:this._filter,amount:a}:void 0,F(this._originalUrl,G(Gt,Ae(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${pe}/${he}/uc-cloud-image-editor/`))}async _observerCallback(e,t){e[0]?.isIntersecting?await this._loadPreview(t):this._cancelPreload?.();}initCallback(){super.initCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let e=this.$["*originalUrl"];this._originalUrl=e??"",this.sub("*originalUrl",t=>{this._originalUrl=t??"",!this.isOriginal&&this._originalUrl&&this.isConnected&&!this._previewImage&&(this._observer?.observe(this),this._schedulePreviewVisibilityCheck());}),this.isOriginal||(this._observer?.observe(this),this._schedulePreviewVisibilityCheck()),this._filter&&this._updateFilterLabels(this._filter),this.sub("*currentFilter",t=>{this.active=!!(t&&t===this._filter);}),this.sub("*networkProblems",async t=>{t||(this._previewImage?await this._loadPreview():this._schedulePreviewVisibilityCheck());});}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._cancelPreload?.(),this._clearPreviewVisibilityChecks();}updated(e){super.updated(e),e.has("isOriginal")&&(this.isOriginal?this._observer?.unobserve(this):(this._observer?.observe(this),this._schedulePreviewVisibilityCheck()));}_updateFilterLabels(e){if(!e){this.titleProp="";return}let t=this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()});this.titleProp=t;}async _loadPreview(e){if(!this.isConnected){e?.unobserve(this),this._cancelPreload?.(),this._cancelPreload=void 0;return}if(!this._originalUrl){!this._previewVisibilityCheckTimeout&&!this._previewVisibilityCheckRaf&&this._schedulePreviewVisibilityCheck();return}let t=++this._lastPreviewRequestId,i="";try{i=await this.proxyUrl(this._previewSrc());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this._previewLoaded=false,this._cancelPreload?.();let{promise:s,cancel:n}=De(i);this._cancelPreload=()=>{n(),this._lastPreviewRequestId===t&&(this._cancelPreload=void 0);};try{if(await s,this._lastPreviewRequestId!==t||!this.isConnected)return;this._previewImage=i,this._previewLoaded=!0,this._clearPreviewVisibilityChecks(),(e??this._observer)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this._schedulePreviewVisibilityCheck();}finally{this._lastPreviewRequestId===t&&(this._cancelPreload=void 0);}}_schedulePreviewVisibilityCheck(){if(!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal||this.$["*networkProblems"]){this._clearPreviewVisibilityChecks();return}this._previewVisibilityCheckRaf&&cancelAnimationFrame(this._previewVisibilityCheckRaf),this._previewVisibilityCheckRaf=requestAnimationFrame(()=>{if(this._previewVisibilityCheckRaf=void 0,!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal){this._clearPreviewVisibilityChecks();return}let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(t&&e.bottom>0&&e.right>0&&e.top<s&&e.left<i){this._loadPreview();return}this._previewVisibilityCheckTimeout=window.setTimeout(()=>{this._previewVisibilityCheckTimeout=void 0,this._schedulePreviewVisibilityCheck();},500);});}_clearPreviewVisibilityChecks(){this._previewVisibilityCheckRaf&&(cancelAnimationFrame(this._previewVisibilityCheckRaf),this._previewVisibilityCheckRaf=void 0),this._previewVisibilityCheckTimeout&&(window.clearTimeout(this._previewVisibilityCheckTimeout),this._previewVisibilityCheckTimeout=void 0);}get _shouldShowPreview(){return !!(this._previewLoaded&&!this.active&&!this.isOriginal)}render(){let e=this.onClick,t={opacity:this._shouldShowPreview?"1":"0"};this._previewImage&&(t.backgroundImage=`url(${this._previewImage})`);let i={opacity:this.active||this.isOriginal?"1":"0"};return html`<button role="option" type="button" class=${classMap(this.buttonClasses)} aria-label=${ifDefined(this.titleProp)} title=${ifDefined(this.titleProp)} @click=${e} ><div class="uc-preview" ?data-loaded=${this._previewLoaded} style=${styleMap(t)}></div><uc-icon class=${classMap({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${styleMap(i)} ></uc-icon></button>`}};d([state()],Ee.prototype,"_previewImage",2),d([state()],Ee.prototype,"_previewLoaded",2),d([state()],Ee.prototype,"isOriginal",2),d([state()],Ee.prototype,"_iconSize",2),d([property({type:String})],Ee.prototype,"filter",1);var Vt=class extends Z{constructor(){super(...arguments);this._operation="";}get operation(){return this._operation}set operation(e){let t=e??"";if(this._operation===t)return;let i=this._operation;this._operation=t,this.requestUpdate("operation",i),this.isConnected&&t&&this._updateOperationMetadata(t);}_updateOperationMetadata(e){this.icon=e;let t=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()});return this.titleProp=s,s},i=()=>{let s=this.l10n(e);return this.title=s,s};t(),i();}initCallback(){super.initCallback(),this._operation&&this._updateOperationMetadata(this._operation),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:t}=le[this._operation],i=e[this._operation],s=typeof i<"u"?i!==t:false;this.active=s;});}onClick(e){this.$["*sliderEl"]?.setOperation(this._operation),this.$["*showSlider"]=true,this.$["*currentOperation"]=this._operation,this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:lt(this.$["*operationTooltip"])});}};d([property({type:String})],Vt.prototype,"operation",1);var Yl=1,Hs=()=>{},Dt=class extends g{constructor(){super(...arguments);this.hiddenScrollbar=false;this._handleWheel=e=>{e.preventDefault();let{deltaY:t,deltaX:i}=e;if(Math.abs(i)>Yl){this.scrollLeft+=i;return}this.scrollLeft+=t;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this._handleWheel,{passive:false}),this.addEventListener("scroll",Hs,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this._handleWheel),this.removeEventListener("scroll",Hs),super.disconnectedCallback();}};d([property({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Dt.prototype,"hiddenScrollbar",2);var X=class extends g{constructor(){super(...arguments);this._showLoader=false;this.showMainToolbar=true;this.showSubToolbar=false;this._showTabToggles=true;this.tabList=[...W];this.activeTab=P.CROP;this._useSliderPanel=true;this._tooltipVisible=false;this._operationTooltip=null;this._tabIndicatorOffset=0;this._tabIndicatorWidth=0;this._sliderRef=createRef();this._tabIndicatorRef=createRef();this.tabToggleRefs={[P.CROP]:createRef(),[P.TUNING]:createRef(),[P.FILTERS]:createRef()};this._handleWindowResize=()=>{this._syncTabIndicator();};this._cropPresets=[];this._debouncedShowLoader=E(e=>{this._showLoader=e;},500);this._updateInfoTooltip=E(()=>{let e=this.$["*editorTransformations"],t=this.$["*currentOperation"],i="",s=false;if(this.$["*tabId"]===P.FILTERS)if(s=true,this.$["*currentFilter"]&&e?.filter?.name===this.$["*currentFilter"]){let n=e?.filter?.amount||100;i=`${this.$["*currentFilter"]} ${n}`;}else i=this.l10n(ve);else if(this.showSubToolbar&&this.$["*tabId"]===P.TUNING&&t){s=true;let n=e?.[t]||le[t].zero;i=`${this.l10n(t)} ${n}`;}s&&(this.$["*operationTooltip"]=i),this._tooltipVisible=s;},0);this._subTopToolbarStyles={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this._subBottomToolbarStyles={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this._tabToggleStyles={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this._tabTogglesStyles={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":ve,"*currentOperation":null,"*operationTooltip":null};this._handleCancel=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel"}),this._cancelPreload?.();let t=this.$["*on.cancel"];t?.();};this._handleApply=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply"});let t=this.$["*on.apply"];t?.(this.$["*editorTransformations"]);};this._handleApplySlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply-slider",operation:lt(this.$["*operationTooltip"])}),this._sliderRef.value?.apply(),this._onSliderClose();};this._handleCancelSlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel-slider"}),this._sliderRef.value?.cancel(),this._onSliderClose();};this._handleTabClick=e=>{let i=e.currentTarget?.getAttribute("data-id");i&&(this.telemetryManager.sendEventCloudImageEditor(e,i),this._activateTab(i,{fromViewer:false}));};}_onSliderClose(){this.$["*showSlider"]=false,this.$["*tabId"]===P.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===P.TUNING&&(this._tooltipVisible=false);}_activateTab(e,{fromViewer:t=false,force:i=false}={}){this.$["*tabId"]!==e&&(this.$["*tabId"]=e),this._applyTabState(e,{fromViewer:t,force:i});}_applyTabState(e,{fromViewer:t,force:i=false}){if(!i&&this.activeTab===e){this._syncTabIndicator();return}this.activeTab=e;let s=this.$["*faderEl"],n=this.$["*cropperEl"];e===P.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:t})):(s?.activate({url:this.$["*originalUrl"],fromViewer:t}),n?.deactivate());for(let a of W){let l=a===e,u=this.tabToggleRefs[a]?.value;u&&(u.active=l),l&&this._syncTabIndicator();}}_syncTabIndicator(){let t=this.tabToggleRefs[this.activeTab]?.value,i=this._tabIndicatorRef.value;if(!t||!i)return;let s=t.offsetLeft,n=t.offsetWidth||Number(getComputedStyle(t).width.replace("px",""));(this._tabIndicatorOffset!==s||this._tabIndicatorWidth!==n)&&(this._tabIndicatorOffset=s,this._tabIndicatorWidth=n,i.style.transform=`translateX(${s}px)`,i.style.width=`${n}px`);}get _hasAspectRatioPicker(){return this._cropPresets.length>=3}_renderControlsByTab(e){switch(e){case P.CROP:return this._renderCropTabControls();case P.FILTERS:return this._renderFilterTabControls();case P.TUNING:return this._renderTuningTabControls();default:return []}}_renderCropTabControls(){let e=[];if(this._hasAspectRatioPicker)e.push(()=>this._renderFreeformControl());else for(let t of this._cropPresets)e.push(()=>this._renderAspectRatioControl(t));for(let t of ho)e.push(()=>this._renderCropOperationControl(t));return this._renderControlGroup(e)}_renderFilterTabControls(){let t=[ve,...po].map(i=>()=>this._renderFilterControl(i));return this._renderControlGroup(t)}_renderTuningTabControls(){let e=uo.map(t=>()=>this._renderOperationControl(t));return this._renderControlGroup(e)}_renderControlGroup(e){return e.length?e.map(i=>i()):[]}_renderFreeformControl(){return html`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}_renderAspectRatioControl(e){return html`<uc-editor-aspect-ratio-button-control .aspectRatio=${e}></uc-editor-aspect-ratio-button-control>`}_renderCropOperationControl(e){return html`<uc-editor-crop-button-control .operation=${e}></uc-editor-crop-button-control>`}_renderFilterControl(e){return html`<uc-editor-filter-control .filter=${e}></uc-editor-filter-control>`}_renderOperationControl(e){return html`<uc-editor-operation-control .operation=${e}></uc-editor-operation-control>`}_renderAspectRatioList(){return this._hasAspectRatioPicker?this._cropPresets.map(e=>this._renderAspectRatioControl(e)):[]}async _preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,t=await this.proxyUrl(at(this.$["*originalUrl"],e,this.$["*editorTransformations"]));this._cancelPreload?.();let{cancel:i}=Et([t]);this._cancelPreload=()=>{i(),this._cancelPreload=void 0;};}}initCallback(){super.initCallback();let e=this.$["*cropPresetList"]??[];this._cropPresets=[...e],this.sub("*cropPresetList",t=>{this._cropPresets=[...t??[]];}),this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",t=>{let i=t?.filter?.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i??"");}),this.sub("*currentFilter",()=>{this._updateInfoTooltip();}),this.sub("*currentOperation",()=>{this._updateInfoTooltip();}),this.sub("*tabId",t=>{this._applyTabState(t,{fromViewer:false,force:true}),this._updateInfoTooltip();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]?.setTransformations(t);}),this.sub("*loadingOperations",t=>{let i=false;for(let[,s]of t.entries()){if(i)break;for(let[,n]of s.entries())if(n){i=true;break}}this._debouncedShowLoader(i);}),this.sub("*showSlider",t=>{t?(this.showSubToolbar=true,this.showMainToolbar=false,this._useSliderPanel=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",t=>{t?(this.showSubToolbar=true,this.showMainToolbar=false,this._useSliderPanel=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",t=>{if(this.tabList=t,this._showTabToggles=t.length>1,!t.includes(this.$["*tabId"])&&t.length>0){let[i]=t;i&&this._activateTab(i,{fromViewer:false});return}this._syncTabIndicator();}),this.sub("*operationTooltip",t=>{this._operationTooltip=t;}),this._updateInfoTooltip();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._handleWindowResize);}firstUpdated(e){super.firstUpdated(e),this._assignSharedElements(),this._syncTabIndicator();}updated(e){super.updated(e),(e.has("activeTab")||e.has("tabList"))&&this.updateComplete.then(()=>this._syncTabIndicator()),(e.has("showSubToolbar")||e.has("showMainToolbar"))&&this._assignSharedElements();}disconnectedCallback(){window.removeEventListener("resize",this._handleWindowResize),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}_assignSharedElements(){let e=this._sliderRef.value;e&&(this.$["*sliderEl"]=e);}_renderTabToggle(e){let t=this.tabList.includes(e),i=this.activeTab===e,s=this.tabList.indexOf(e),n=s>=0?styleMap({gridColumn:`${s+1}`}):nothing;return html`<uc-presence-toggle class="uc-tab-toggle" .visible=${t} .styles=${this._tabToggleStyles}><uc-btn-ui theme="tab" data-id=${e} icon=${e} role="tab" aria-controls=${`tab_${e}`} aria-selected=${i?"true":"false"} title-prop=${`a11y-editor-tab-${e}`} .active=${i} style=${n} @click=${this._handleTabClick} ${ref(this.tabToggleRefs[e])} ></uc-btn-ui></uc-presence-toggle>`}_renderTabContent(e){let t=this._renderControlsByTab(e);return html`<div id=${`tab_${e}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${t.length?t:nothing}</div></div></uc-editor-scroller></div>`}render(){let e=["uc-info-tooltip",this._tooltipVisible?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),t=this._hasAspectRatioPicker;return html`<uc-line-loader-ui .active=${this._showLoader}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${e}>${this._operationTooltip??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this._subTopToolbarStyles} ><div class="uc-tab-content-row">${W.map(i=>when(this.activeTab===i,()=>this._renderTabContent(i)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this._showTabToggles} .styles=${this._tabTogglesStyles} @initial-render=${()=>this._syncTabIndicator()} ><div class="uc-tab-toggles_indicator" ${ref(this._tabIndicatorRef)} ></div>${W.map(i=>this._renderTabToggle(i))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this._handleCancel} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this._handleApply}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this._subBottomToolbarStyles}><div class="uc-slider" ?hidden=${!this._useSliderPanel}><uc-editor-slider ${ref(this._sliderRef)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this._useSliderPanel||!t}>${t?html`<div class="uc-list-aspect-ratio">${this._renderAspectRatioList()}</div>`:nothing}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this._handleCancelSlider} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this._handleApplySlider} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};d([state()],X.prototype,"_showLoader",2),d([state()],X.prototype,"showMainToolbar",2),d([state()],X.prototype,"showSubToolbar",2),d([state()],X.prototype,"_showTabToggles",2),d([state()],X.prototype,"tabList",2),d([state()],X.prototype,"activeTab",2),d([state()],X.prototype,"_useSliderPanel",2),d([state()],X.prototype,"_tooltipVisible",2),d([state()],X.prototype,"_operationTooltip",2),d([state()],X.prototype,"_cropPresets",2);var js=ye([...W]),j=class extends g{constructor(){super(...arguments);this.ctxOwner=true;this._statusMessage="";this._imageSrc=de;this._fileType="";this._showLoader=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=js;this._hasNetworkProblems=false;this._isInitialized=false;this._pendingInitUpdate=null;this._pendingSizeWait=null;this._debouncedShowLoader=E(e=>{this._showLoader=e;},300);this._imgRef=createRef();this._cropperRef=createRef();this._faderRef=createRef();this._imgContainerRef=createRef();this._handleImageLoad=()=>{this._debouncedShowLoader(false),this._imageSrc!==de&&(this.$["*networkProblems"]=false);};this._handleImageError=()=>{this._debouncedShowLoader(false),this.$["*networkProblems"]=true;};this._handleRetryNetwork=()=>{let e=this.$["*on.retryNetwork"];e?.();};this.init$={...this.init$,...ks(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}_scheduleInitialization(){this._isInitialized||this._pendingInitUpdate||(this._pendingInitUpdate=this.updateComplete.then(()=>{this._pendingInitUpdate=null,this._isInitialized=true;}));}initCallback(){super.initCallback(),this._syncTabListFromProp(),this._syncCropPresetState();}_assignSharedElements(){let e=this._faderRef.value;e&&(this.$["*faderEl"]=e);let t=this._cropperRef.value;t&&(this.$["*cropperEl"]=t);let i=this._imgContainerRef.value;i&&(this.$["*imgContainerEl"]=i);let s=this._imgRef.value;s&&(this.$["*imgEl"]=s);}_attachImageListeners(){let e=this._imgRef.value;e&&(e.addEventListener("load",this._handleImageLoad),e.addEventListener("error",this._handleImageError));}_detachImageListeners(){let e=this._imgRef.value;e&&(e.removeEventListener("load",this._handleImageLoad),e.removeEventListener("error",this._handleImageError));}get _imageClassName(){let e=this.$["*tabId"];return oe("uc-image",{"uc-image_hidden_to_cropper":e===P.CROP,"uc-image_hidden_effects":e!==P.CROP})}_waitForSize(){if(this._pendingSizeWait)return this._pendingSizeWait;let e=3e3;return this._pendingSizeWait=new Promise((t,i)=>{let s=()=>{window.clearTimeout(u),c.disconnect(),this._pendingSizeWait=null;},n=()=>{let{width:p,height:h}=this.getBoundingClientRect();return p>0&&h>0},a=()=>{s(),window.setTimeout(()=>t(),0);},l=()=>{let p=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(p.message),i(p);},c=new ResizeObserver(p=>{let[h]=p;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),u=window.setTimeout(()=>{l();},e);if(n()){a();return}c.observe(this);}),this._pendingSizeWait}firstUpdated(e){super.firstUpdated(e),this._assignSharedElements(),this._attachImageListeners(),this.initEditor();let t=!!(this.uuid||this.cdnUrl),i=e.has("uuid")||e.has("cdnUrl");t&&!i&&this.updateImage();}disconnectedCallback(){this._detachImageListeners(),super.disconnectedCallback();}render(){let e=this._fileType??"",t=this._statusMessage??"",i=this._imageSrc||de,s=this._showLoader,n=this._hasNetworkProblems;return html` ${unsafeSVG(Ms)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this._handleRetryNetwork}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${e}</div></div><div class="uc-image_container" ${ref(this._imgContainerRef)}><img src=${i} class=${this._imageClassName} ${ref(this._imgRef)} />${when(this._isInitialized,()=>html`<uc-editor-image-cropper ${ref(this._cropperRef)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${ref(this._faderRef)}></uc-editor-image-fader></div><div class="uc-info_pan">${t}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${when(this._isInitialized,()=>html`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(e){super.updated(e),e.has("uuid")&&this.uuid&&this.updateImage(),e.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),e.has("tabs")&&this._syncTabListFromProp(),(e.has("cropPreset")||e.has("cdnUrl"))&&this._syncCropPresetState();}_syncTabListFromProp(){let e=this.tabs||js;this.$["*tabList"]=As(e);}_syncCropPresetState(){let e=bi(this.cropPreset??""),t=null;if(this.cdnUrl){let i=er(this.cdnUrl),s=tr(i);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;t=Wo(n,a,e,.1);}}this.$["*cropPresetList"]=e,this.$["*currentAspectRatio"]=t??e?.[0]??null;}async updateImage(){if(this.isConnected){try{await this._waitForSize();}catch{return}if(this.isConnected){if(this.cdnUrl){let e=this.cdnUrl,t=jt(e),i=Ie(e,t);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let s=er(e),n=tr(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let e=Ie(this.cfg.cdnCname,this.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===P.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let e=this.$["*originalUrl"],t=await this.proxyUrl(F(e,G("json"))),i=await fetch(t).then(a=>a.json()),{width:s,height:n}=i;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===P.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:e});}catch(e){e&&(this.telemetryManager.sendEventError(e,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",e));}this._scheduleInitialization();}}}async initEditor(){try{await this._waitForSize();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{let t=!!e;this._hasNetworkProblems=t;}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let t=this.$["*originalUrl"],i=G(Ae(e),"preview"),s=F(t,i),n={originalUrl:t,cdnUrlModifiers:i,cdnUrl:s,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};d([state()],j.prototype,"_statusMessage",2),d([state()],j.prototype,"_imageSrc",2),d([state()],j.prototype,"_fileType",2),d([state()],j.prototype,"_showLoader",2),d([property({type:String,reflect:true})],j.prototype,"uuid",2),d([property({type:String,attribute:"cdn-url",reflect:true})],j.prototype,"cdnUrl",2),d([property({type:String,attribute:"crop-preset",reflect:true})],j.prototype,"cropPreset",2),d([property({type:String,reflect:true})],j.prototype,"tabs",2),d([state()],j.prototype,"_hasNetworkProblems",2),d([state()],j.prototype,"_isInitialized",2);var Gr={};Xr(Gr,{CloudImageEditorActivity:()=>Ft});var Ni=class extends j{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:x.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Ft=class extends T{constructor(){super(...arguments);this._editorConfig=null;}get activityParams(){let e=super.activityParams;if("internalId"in e)return e;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",e=>{this._editorConfig&&this._editorConfig.cropPreset!==e&&(this._editorConfig={...this._editorConfig,cropPreset:e});}),this.subConfigValue("cloudImageEditorTabs",e=>{this._editorConfig&&this._editorConfig.tabs!==e&&(this._editorConfig={...this._editorConfig,tabs:e});}),this._mountEditor();}disconnectedCallback(){super.disconnectedCallback(),this._unmountEditor();}_handleApply(e){if(!this._entry)return;this.debugPrint('editor event "apply"',e.detail);let t=e.detail;this._entry.setMultipleValues({cdnUrl:t.cdnUrl,cdnUrlModifiers:t.cdnUrlModifiers}),this.modalManager?.close(v.activities.CLOUD_IMG_EDIT),this.historyBack();}_handleCancel(e){let t=e instanceof CustomEvent?e.detail:void 0;this.debugPrint('editor event "cancel"',t),this.modalManager?.close(v.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(e){this.debugPrint('editor event "change"',e.detail);}_mountEditor(){let{internalId:e}=this.activityParams,t=this.uploadCollection.read(e);if(!t)throw new Error(`Entry with internalId "${e}" not found`);this._entry=t;let i=this._entry.getValue("cdnUrl");if(!i)throw new Error(`Entry with internalId "${e}" hasn't uploaded yet`);this._editorConfig=this._createEditorConfig(i);}_unmountEditor(){this._entry=void 0,this._editorConfig=null;}render(){if(!this._editorConfig)return nothing;let{cdnUrl:e,cropPreset:t,tabs:i}=this._editorConfig;return html`<uc-cloud-image-editor cdn-url=${e} crop-preset=${ifDefined(t)} tabs=${ifDefined(i)} @apply=${this._handleApply} @cancel=${this._handleCancel} @change=${this.handleChange} ></uc-cloud-image-editor>`}_createEditorConfig(e){return {cdnUrl:e,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};d([state()],Ft.prototype,"_editorConfig",2);var dt=class extends T{constructor(){super(...arguments);this._formState={importDisabled:true};this._inputRef=createRef();this._handleInput=e=>{let t=e.target?.value??"";this._formState={importDisabled:!t};};this._handleUpload=e=>{e.preventDefault(),this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let i=this._inputRef.value?.value?.trim();i&&(this.api.addFileFromUrl(i,{source:A.URL}),this.$["*currentActivity"]=v.activities.UPLOAD_LIST,this.modalManager?.open(v.activities.UPLOAD_LIST));};}firstUpdated(){let e=this._inputRef.value;e&&(e.value="",e.focus());}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this._handleUpload}><label><input ${ref(this._inputRef)} placeholder="https://" class="uc-url-input" type="text" @input=${this._handleInput} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this._formState.importDisabled} >${this.l10n("upload-url")}</button></form>`}};d([state()],dt.prototype,"_formState",2);var Ws=()=>{let r=globalThis.top??globalThis.parent??globalThis.self;try{return r.location.origin}catch(o){return console.warn("Unable to access top-level window location:",o),globalThis.location.origin}};var ac=r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),qs=(r,o="i")=>{let e=r.split("*").map(ac);return new RegExp(`^${e.join(".+")}$`,o)};var lc=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],cc=(r,o)=>window.getComputedStyle(r).getPropertyValue(o).trim(),Zs=r=>{let o={};for(let e of lc){let t=cc(r,e);t&&(o[e]=t);}return o};var dc=["selected-files-change","toolbar-state-change"],uc=r=>{if(!r||typeof r!="object"||!("type"in r))return false;let o=r.type;return !(typeof o!="string"||!dc.includes(o))},Bi=class{constructor(o,e){this._handlerMap=new Map;this._handleMessage=o=>{if(o.source!==this._context)return;let e=o.data;if(!uc(e))return;let t=this._handlerMap.get(e.type);if(t)for(let i of t)i(e);};this._context=o,this._getTargetOrigin=e,window.addEventListener("message",this._handleMessage);}on(o,e){let t=this._handlerMap.get(o)??new Set;this._handlerMap.has(o)||this._handlerMap.set(o,t),t.add(e);}send(o){let e=this._getTargetOrigin();this._context.postMessage(o,e);}destroy(){window.removeEventListener("message",this._handleMessage);}};function Ys(r){let o=[];for(let[e,t]of Object.entries(r))t==null||typeof t=="string"&&t.length===0||o.push(`${e}=${encodeURIComponent(t)}`);return o.join("&")}var fc={[ne.GDRIVE]:"ngdrive"},Q=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this._iframeRef=createRef();this._latestSelectionSummary=null;this._selectedList=[];this._isSelectionReady=false;this._isDoneBtnEnabled=false;this._couldSelectAll=false;this._couldDeselectAll=false;this._showSelectionStatus=false;this._showDoneBtn=false;this._doneBtnTextClass="uc-hidden";this._toolbarVisible=true;this._handleDone=()=>{for(let e of this._selectedList){let t=this._extractUrlFromSelectedFile(e),{filename:i}=e,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(t,{fileName:i,source:s});}this.$["*currentActivity"]=v.activities.UPLOAD_LIST,this.modalManager?.open(v.activities.UPLOAD_LIST);};this._handleCancel=()=>{this.historyBack();};this._handleSelectAll=()=>{this._messageBridge?.send({type:"select-all"});};this._handleDeselectAll=()=>{this._messageBridge?.send({type:"deselect-all"});};}get _counterText(){if(!this._latestSelectionSummary)return "";let{selectedCount:e,total:t}=this._latestSelectionSummary;return this.l10n("selected-count",{count:e,total:t})}get activityParams(){let e=super.activityParams;if("externalSourceType"in e)return e;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:e}=this.activityParams;e?this._mountIframe():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this._unmountIframe(),this._mountIframe());});}),this.subConfigValue("multiple",t=>{this._showSelectionStatus=t;}),this.subConfigValue("localeName",()=>{this._setupL10n();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this._applyEmbedCss(t);});}_extractUrlFromSelectedFile(e){if(e.alternatives){let t=N(this.cfg.externalSourcesPreferredTypes);for(let i of t){let s=qs(i);for(let[n,a]of Object.entries(e.alternatives))if(s.test(n))return a}}return e.url}_handleToolbarStateChange(e){this._toolbarVisible=e.isVisible;}async _handleSelectedFilesChange(e){if(this.cfg.multiple!==e.isMultipleMode){console.error("Multiple mode mismatch");return}this._setSelectionSummary(e.selectedCount,e.total),this._doneBtnTextClass=e.isReady?"":"uc-hidden",this._isSelectionReady=e.isReady,this._isDoneBtnEnabled=e.isReady&&e.selectedFiles.length>0,this._showSelectionStatus=e.isMultipleMode&&e.total>0,this._couldSelectAll=e.selectedCount<e.total,this._couldDeselectAll=e.selectedCount===e.total,this._selectedList=e.selectedFiles??[],this._showDoneBtn=e.total>0;}_handleIframeLoad(){this._applyEmbedCss(this.cfg.externalSourcesEmbedCss),this._applyTheme(),this._setupL10n();}_applyTheme(){this._messageBridge?.send({type:"set-theme-definition",theme:Zs(this)});}_applyEmbedCss(e){this._messageBridge?.send({type:"set-embed-css",css:e});}_setupL10n(){this._messageBridge?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}_remoteUrl(){let{pubkey:e,remoteTabSessionKey:t,socialBaseUrl:i,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=fc[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:e,images_only:"false",session_key:t,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||Ws(),debug:this.cfg.debug},u=new URL(`/window4/${a}`,i);return u.search=Ys(c),u.toString()}_setSelectionSummary(e,t){this._latestSelectionSummary={selectedCount:e,total:t};}_mountIframe(){let e=document.createElement("iframe");e.src=this._remoteUrl(),e.marginHeight=0,e.marginWidth=0,e.frameBorder="0",e.allowTransparency=true,e.addEventListener("load",this._handleIframeLoad.bind(this)),e.addEventListener("load",this._handleIframeLoad.bind(this)),this._iframeRef.value&&(this._iframeRef.value.innerHTML="",this._iframeRef.value.appendChild(e)),e.contentWindow&&(this._messageBridge?.destroy(),this._messageBridge=new Bi(e.contentWindow,()=>this.cfg.socialBaseUrl),this._messageBridge.on("selected-files-change",this._handleSelectedFilesChange.bind(this)),this._messageBridge.on("toolbar-state-change",this._handleToolbarStateChange.bind(this)),this._resetSelectionStatus());}_unmountIframe(){this._messageBridge?.destroy(),this._messageBridge=void 0,this._iframeRef.value&&(this._iframeRef.value.innerHTML=""),this._resetSelectionStatus();}_resetSelectionStatus(){this._selectedList=[],this._isSelectionReady=false,this._isDoneBtnEnabled=false,this._couldSelectAll=false,this._couldDeselectAll=false,this._showSelectionStatus=false,this._showDoneBtn=false,this._doneBtnTextClass="uc-hidden",this._latestSelectionSummary=null;}disconnectedCallback(){super.disconnectedCallback(),this._unmountIframe();}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${ref(this._iframeRef)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this._toolbarVisible}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this._handleCancel}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this._showSelectionStatus}><span>${this._counterText}</span><button type="button" @click=${this._handleSelectAll} ?hidden=${!this._couldSelectAll}>${this.l10n("select-all")}</button><button type="button" @click=${this._handleDeselectAll} ?hidden=${!this._couldDeselectAll}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this._handleDone} ?disabled=${!this._isDoneBtnEnabled} ?hidden=${!this._showDoneBtn} ><uc-spinner ?hidden=${this._isSelectionReady}></uc-spinner><span class=${this._doneBtnTextClass}>${this.l10n("done")}</span></button></div></div>`}};d([state()],Q.prototype,"_selectedList",2),d([state()],Q.prototype,"_isSelectionReady",2),d([state()],Q.prototype,"_isDoneBtnEnabled",2),d([state()],Q.prototype,"_couldSelectAll",2),d([state()],Q.prototype,"_couldDeselectAll",2),d([state()],Q.prototype,"_showSelectionStatus",2),d([state()],Q.prototype,"_showDoneBtn",2),d([state()],Q.prototype,"_doneBtnTextClass",2),d([state()],Q.prototype,"_toolbarVisible",2);var Xs=()=>typeof navigator.permissions<"u";var bc={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},yc=["camera","microphone"];function Ki(r){let o=Math.floor(r/60).toString().padStart(2,"0"),e=Math.floor(r%60).toString().padStart(2,"0");return `${o}:${e}`}var Qs="image/jpeg",Js="video/webm",k=class extends T{constructor(){super(...arguments);this.couldBeCtxOwner=true;this._unsubPermissions=null;this._capturing=false;this._chunks=[];this._mediaRecorder=null;this._stream=null;this._selectedAudioId=null;this._selectedCameraId=null;this._activeTab=null;this._options={};this._canvas=null;this._ctx=null;this._cameraDevices=[];this._audioDevices=[];this._permissionResponses={};this._permissionCleanupFns=[];this._currentVideoSource=null;this._handlePreviewPlay=()=>{this._startTimeline(),this._currentTimelineIcon="pause";};this._handlePreviewPause=()=>{this._currentTimelineIcon="play",this._stopTimeline();};this._timerRef=createRef();this._lineRef=createRef();this._videoRef=createRef();this._switcherRef=createRef();this._startTime=0;this._elapsedTime=0;this._videoTransformCss=null;this._videoHidden=true;this._messageHidden=true;this._requestBtnHidden=Xs();this._cameraSelectOptions=[];this._cameraSelectHidden=true;this._l10nMessage="";this._timerHidden=true;this._cameraHidden=true;this._cameraActionsHidden=true;this._audioSelectOptions=[];this._audioSelectHidden=true;this._audioSelectDisabled=true;this._audioToggleMicrophoneHidden=true;this._tabCameraHidden=true;this._tabVideoHidden=true;this._currentIcon="camera-full";this._currentTimelineIcon="play";this._toggleMicrophoneIcon="microphone";this._mutableClassButton="uc-shot-btn uc-camera-action";this._chooseActionWithCamera=()=>{if(this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this._activeTab}}}),this._activeTab===C.PHOTO&&this._shot(),this._activeTab===C.VIDEO){if(this._mediaRecorder?.state==="recording"){this._stopRecording();return}this._startRecording();}};this._handleCameraSelectChange=e=>{let t=e.target;t&&(this._selectedCameraId=t.value,this._capture());};this._handleAudioSelectChange=e=>{let t=e.target;t&&(this._selectedAudioId=t.value,this._capture());};this._handleRequestPermissions=()=>{this._capture();};this._handleStartCamera=()=>{this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this._activeTab}}}),this._chooseActionWithCamera();};this._handleToggleRecording=()=>{this._toggleRecording();};this._handleToggleAudio=()=>{this._toggleEnableAudio();};this._handleRetake=()=>{this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this._activeTab}}}),this._retake();};this._handleAccept=()=>{this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this._activeTab}}}),this._accept();};this._handleClickTab=e=>{let i=e.currentTarget?.getAttribute("data-id");i&&this._handleActiveTab(i);};this._updateTimer=()=>{let e=Math.floor((performance.now()-this._startTime+this._elapsedTime)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let t=this.cfg.maxVideoRecordingDuration-e;if(t<=0){let s=this._timerRef.value;s&&(s.textContent=Ki(t)),this._stopRecording();return}let i=this._timerRef.value;i&&(i.textContent=Ki(t));}else {let t=this._timerRef.value;t&&(t.textContent=Ki(e));}this._animationFrameId=requestAnimationFrame(this._updateTimer);};this._startTimer=()=>{this._startTime=performance.now(),this._elapsedTime=0,this._updateTimer();};this._stopTimer=()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId);};this._startTimeline=()=>{let e=this._videoRef.value;if(!e)return;let t=e.currentTime,i=e.duration||1,s=this._lineRef.value;s&&(s.style.transform=`scaleX(${t/i})`);let n=this._timerRef.value;n&&(n.textContent=Ki(t)),this._animationFrameId=requestAnimationFrame(this._startTimeline);};this._stopTimeline=()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId);};this._animationFrameId=null;this._startRecording=()=>{try{this._chunks=[],this._options={...this.cfg.mediaRecorderOptions};let{mimeType:e}=this.cfg.mediaRecorderOptions||{};e&&MediaRecorder.isTypeSupported(e)?this._options.mimeType=e:MediaRecorder.isTypeSupported(Js)?this._options.mimeType=Js:this._options.mimeType="video/mp4",this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener("dataavailable",t=>{this._chunks.push(t.data);}),this._startTimer(),this.classList.add("uc-recording"),this._setCameraState(se.PLAY));}catch(e){console.error("Failed to start recording",e),this.telemetryManager.sendEventError(e,"camera recording. Failed to start recording");}};this._stopRecording=()=>{this._mediaRecorder?.addEventListener("stop",()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(se.STOP);}),this._mediaRecorder?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this._activeTab}}});};this._toggleRecording=()=>{if(this._mediaRecorder?.state==="recording")return;let e=this._videoRef.value;e&&(!e.paused&&!e.ended&&e.readyState>2?e.pause():e.paused&&e.play());};this._toggleEnableAudio=()=>{this._stream?.getAudioTracks().forEach(e=>{e.enabled=!e.enabled,this._toggleMicrophoneIcon=e.enabled?"microphone":"microphone-mute",this._audioSelectDisabled=!e.enabled;});};this._previewVideo=()=>{try{let e=new Blob(this._chunks,{type:this._mediaRecorder?.mimeType}),t=URL.createObjectURL(e),i=this._videoRef.value;if(!i)return;i.muted=!1,i.volume=1,this._setVideoSource(null),i.src=t,this._attachPreviewListeners(i);}catch(e){console.error("Failed to preview video",e),this.telemetryManager.sendEventError(e,"camera previewing. Failed to preview video");}};this._retake=()=>{if(this._setCameraState(se.RETAKE),this._activeTab===C.VIDEO){this._setVideoSource(this._stream);let e=this._videoRef.value;e&&(e.muted=true);}this._videoRef.value?.play?.();};this._accept=()=>{if(this._setCameraState(se.ACCEPT),this._activeTab===C.PHOTO){this._canvas?.toBlob(s=>{if(!s)return;let n=this._createFile("camera","jpeg",Qs,s);this._toSend(n);},Qs);return}let e=new Blob(this._chunks,{type:this._mediaRecorder?.mimeType}),t=this._guessExtensionByMime(this._mediaRecorder?.mimeType),i=this._createFile("video",t,`video/${t}`,e);this._toSend(i),this._chunks=[];};this._handlePhoto=e=>{e===se.SHOT&&(this._tabVideoHidden=true,this._cameraHidden=true,this._tabCameraHidden=true,this._cameraActionsHidden=false,this._cameraSelectHidden=true),(e===se.RETAKE||e===se.ACCEPT)&&(this._tabVideoHidden=!this._cameraModes.includes(C.VIDEO),this._tabCameraHidden=!this._cameraModes.includes(C.PHOTO),this._cameraHidden=false,this._cameraActionsHidden=true,this._cameraSelectHidden=this._cameraDevices.length<=1);};this._handleVideo=e=>{e===se.PLAY&&(this._timerHidden=false,this._tabCameraHidden=true,this._cameraSelectHidden=true,this._audioSelectHidden=true,this._currentTimelineIcon="pause",this._currentIcon="square",this._mutableClassButton="uc-shot-btn uc-camera-action uc-stop-record"),e===se.STOP&&(this._timerHidden=false,this._cameraHidden=true,this._audioToggleMicrophoneHidden=true,this._cameraActionsHidden=false),(e===se.RETAKE||e===se.ACCEPT)&&(this._timerHidden=true,this._tabVideoHidden=!this._cameraModes.includes(C.VIDEO),this._tabCameraHidden=!this._cameraModes.includes(C.PHOTO),this._cameraHidden=false,this._cameraActionsHidden=true,this._audioToggleMicrophoneHidden=!this.cfg.enableAudioRecording,this._currentIcon="video-camera-full",this._mutableClassButton="uc-shot-btn uc-camera-action",this._audioSelectHidden=!this.cfg.enableAudioRecording||this._audioDevices.length<=1,this._cameraSelectHidden=this._cameraDevices.length<=1);};this._setCameraState=e=>{this._activeTab===C.PHOTO&&(e==="shot"||e==="retake"||e==="accept")&&this._handlePhoto(e),this._activeTab===C.VIDEO&&(e==="play"||e==="stop"||e==="retake"||e==="accept"||e==="pause"||e==="resume")&&this._handleVideo(e);};this._handleActiveTab=e=>{this._switcherRef.value?.querySelectorAll("button").forEach(i=>{i.classList.toggle("uc-active",i.getAttribute("data-id")===e);}),e===C.PHOTO&&(this._currentIcon="camera-full",this._audioSelectHidden=true,this._audioToggleMicrophoneHidden=true),e===C.VIDEO&&(this._currentTimelineIcon="play",this._currentIcon="video-camera-full",this._audioSelectHidden=!this.cfg.enableAudioRecording||this._audioDevices.length<=1,this._audioToggleMicrophoneHidden=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:x.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:e}}}),this._activeTab=e;};this._createFile=(e,t,i,s)=>{let n=Date.now(),a=`${e}-${n}.${t}`;return new File([s],a,{lastModified:n,type:i})};this._toSend=e=>{this.api.addFileFromObject(e,{source:A.CAMERA}),this.set$({"*currentActivity":v.activities.UPLOAD_LIST}),this.modalManager?.open(v.activities.UPLOAD_LIST);};this._setPermissionsState=E(e=>{this.classList.toggle("uc-initialized",e==="granted");let t=this._activeTab===C.VIDEO&&this.cfg.enableAudioRecording,i=this._activeTab===C.PHOTO?"camera-full":"video-camera-full";e==="granted"?(this._videoHidden=false,this._cameraHidden=false,this._tabCameraHidden=!this._cameraModes.includes(C.PHOTO),this._tabVideoHidden=!this._cameraModes.includes(C.VIDEO),this._messageHidden=true,this._timerHidden=true,this._currentIcon=i,this._audioToggleMicrophoneHidden=!t,this._audioSelectHidden=!t):e==="prompt"?(this._l10nMessage="camera-permissions-prompt",this._videoHidden=true,this._cameraHidden=true,this._tabCameraHidden=true,this._messageHidden=false,this._stopCapture()):(this._l10nMessage="camera-permissions-denied",this._videoHidden=true,this._messageHidden=false,this._tabCameraHidden=!this._cameraModes.includes(C.PHOTO),this._tabVideoHidden=!this._cameraModes.includes(C.VIDEO),this._cameraActionsHidden=true,this._mutableClassButton="uc-shot-btn uc-camera-action",this._stopCapture());},300);this._makeStreamInactive=()=>{if(!this._stream)return false;let e=this._stream?.getAudioTracks(),t=this._stream?.getVideoTracks();return e.forEach(i=>{i.stop();}),t.forEach(i=>{i.stop();}),true};this._stopCapture=()=>{this._capturing&&(this._videoRef.value&&(this._videoRef.value.volume=0),this._currentVideoSource?.getTracks?.()?.[0]?.stop(),this._detachPreviewListeners(this._videoRef.value),this._setVideoSource(null),this._makeStreamInactive(),this._stopTimer(),this._capturing=false);};this._capture=async()=>{let e={video:{...bc},audio:this.cfg.enableAudioRecording?{}:false};this._selectedCameraId&&(e.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(e.audio={deviceId:{exact:this._selectedAudioId}}),this._videoRef.value&&(this._videoRef.value.volume=0);try{this._setPermissionsState("prompt"),this._stream=await navigator.mediaDevices.getUserMedia(e),this._stream.addEventListener("inactive",()=>{this._setPermissionsState("denied");}),this._setVideoSource(this._stream),this._capturing=!0,this._setPermissionsState("granted");}catch(t){this._setPermissionsState("denied"),console.log("Failed to capture camera",t),this.telemetryManager.sendEventError(t,"camera capturing. Failed to capture camera");}};this._handlePermissionsChange=()=>{this._capture();};this._permissionAccess=async()=>{try{this._teardownPermissionListeners();for(let e of yc){let t=await navigator.permissions.query({name:e});this._permissionResponses[e]=t,t.addEventListener("change",this._handlePermissionsChange),this._permissionCleanupFns.push(()=>{t.removeEventListener("change",this._handlePermissionsChange);});}this._unsubPermissions=()=>{this._teardownPermissionListeners();};}catch(e){this._teardownPermissionListeners(),console.log("Failed to use permissions API. Fallback to manual request mode.",e),this.telemetryManager.sendEventError(e,"camera permissions. Failed to use permissions API"),this._capture();}};this._requestDeviceAccess=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener("devicechange",this._getDevices);}catch(e){this.telemetryManager.sendEventError(e,"camera devices. Failed to get user media"),console.log("Failed to get user media",e);}};this._getDevices=async()=>{try{let e=await navigator.mediaDevices.enumerateDevices();this._cameraDevices=e.filter(t=>t.kind==="videoinput").map((t,i)=>({text:t.label.trim()||`${this.l10n("caption-camera")} ${i+1}`,value:t.deviceId})),this._audioDevices=this.cfg.enableAudioRecording?e.filter(t=>t.kind==="audioinput").map(t=>({text:t.label.trim(),value:t.deviceId})):[],this._cameraSelectOptions=this._cameraDevices,this._cameraSelectHidden=this._cameraDevices.length<=1,this._selectedCameraId=this._cameraDevices[0]?.value??null,this._audioSelectOptions=this._audioDevices,this._audioSelectHidden=!this.cfg.enableAudioRecording||this._audioDevices.length<=1,this._selectedAudioId=this._audioDevices[0]?.value??null;}catch(e){this.telemetryManager.sendEventError(e,"camera devices. Failed to get devices"),console.log("Failed to get devices",e);}};this._onActivate=async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture(),this._handleCameraModes(this._cameraModes);};this._onDeactivate=async()=>{this._unsubPermissions&&this._unsubPermissions(),window.chrome||this._setPermissionsState("denied"),this._stopCapture();};this._handleCameraModes=e=>{this._tabVideoHidden=!e.includes(C.VIDEO),this._tabCameraHidden=!e.includes(C.PHOTO);let t=e[0];t&&(!this._activeTab||!e.includes(this._activeTab))&&this._handleActiveTab(t);};}_attachPreviewListeners(e){this._detachPreviewListeners(e),e.addEventListener("play",this._handlePreviewPlay),e.addEventListener("pause",this._handlePreviewPause);}_detachPreviewListeners(e){e?.removeEventListener("play",this._handlePreviewPlay),e?.removeEventListener("pause",this._handlePreviewPause);}_setVideoSource(e){this._currentVideoSource!==e&&(this._currentVideoSource=e,this._applyVideoSource());}_applyVideoSource(){let e=this._videoRef.value;if(!e)return;let t=this._currentVideoSource??null;e.srcObject!==t&&(e.srcObject=t);}_shot(){if(this._setCameraState("shot"),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),!this._ctx)throw new Error("Failed to get canvas context");let e=this._videoRef.value;if(!e)throw new Error("Video element not found");this._canvas.height=e.videoHeight,this._canvas.width=e.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(e,0,0),e.pause();}_guessExtensionByMime(e){let t={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(e==="")return "webm";if(e){let i=e.split("/");if(i?.[0]==="video"){let n=i.slice(1).join("/")?.split(";")[0];if(n&&t[n])return t[n]}}return "avi"}get _cameraModes(){return N(this.cfg.cameraModes).filter(e=>e===C.PHOTO||e===C.VIDEO)}_teardownPermissionListeners(){if(this._permissionCleanupFns.length!==0){for(let e of this._permissionCleanupFns)e();this._permissionCleanupFns=[],this._unsubPermissions=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",e=>{this._videoTransformCss=e?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",e=>{this._audioToggleMicrophoneHidden=!e,this._audioSelectDisabled=!e;}),this.subConfigValue("cameraModes",e=>{if(!this.isConnected)return;let t=U(e);this._handleCameraModes(t.filter(i=>i===C.PHOTO||i===C.VIDEO));}),this._onActivate();}firstUpdated(e){super.firstUpdated(e),this._applyVideoSource();}updated(e){super.updated(e),this._applyVideoSource();}_destroy(){this._teardownPermissionListeners(),navigator.mediaDevices?.removeEventListener("devicechange",this._getDevices),this._detachPreviewListeners(this._videoRef.value),this._setVideoSource(null);}disconnectedCallback(){super.disconnectedCallback(),this._onDeactivate(),this._destroy();}render(){return html`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this._cameraSelectHidden}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this._cameraSelectOptions} ?hidden=${this._cameraSelectHidden} @change=${this._handleCameraSelectChange} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${styleMap({transform:this._videoTransformCss})} ?hidden=${this._videoHidden} ${ref(this._videoRef)} ></video><div class="uc-message-box" ?hidden=${this._messageHidden}><span>${this.l10n(this._l10nMessage)}</span><button type="button" @click=${this._handleRequestPermissions} ?hidden=${this._requestBtnHidden} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${ref(this._switcherRef)} class="uc-switcher" ?hidden=${!this._timerHidden}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this._handleClickTab} ?hidden=${this._tabCameraHidden} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this._handleClickTab} ?hidden=${this._tabVideoHidden} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this._handleToggleRecording} ?hidden=${this._timerHidden} data-testid="recording-timer" ><uc-icon name=${this._currentTimelineIcon}></uc-icon><span ${ref(this._timerRef)}> 00:00 </span><span ${ref(this._lineRef)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this._cameraActionsHidden} ><button type="button" class="uc-secondary-btn" @click=${this._handleRetake}> Retake </button><button type="button" class="uc-primary-btn" @click=${this._handleAccept} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this._handleStartCamera} class=${this._mutableClassButton} ?hidden=${this._cameraHidden} ><uc-icon name=${this._currentIcon}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this._handleToggleAudio} ?hidden=${this._audioToggleMicrophoneHidden} data-testid="toggle-microphone" ><uc-icon name=${this._toggleMicrophoneIcon}></uc-icon></button><uc-select class="uc-audio-select" .options=${this._audioSelectOptions} ?hidden=${this._audioSelectHidden} ?disabled=${this._audioSelectDisabled} @change=${this._handleAudioSelectChange} data-testid="audio-select" ></uc-select></div></div>`}};d([state()],k.prototype,"_videoTransformCss",2),d([state()],k.prototype,"_videoHidden",2),d([state()],k.prototype,"_messageHidden",2),d([state()],k.prototype,"_requestBtnHidden",2),d([state()],k.prototype,"_cameraSelectOptions",2),d([state()],k.prototype,"_cameraSelectHidden",2),d([state()],k.prototype,"_l10nMessage",2),d([state()],k.prototype,"_timerHidden",2),d([state()],k.prototype,"_cameraHidden",2),d([state()],k.prototype,"_cameraActionsHidden",2),d([state()],k.prototype,"_audioSelectOptions",2),d([state()],k.prototype,"_audioSelectHidden",2),d([state()],k.prototype,"_audioSelectDisabled",2),d([state()],k.prototype,"_audioToggleMicrophoneHidden",2),d([state()],k.prototype,"_tabCameraHidden",2),d([state()],k.prototype,"_tabVideoHidden",2),d([state()],k.prototype,"_currentIcon",2),d([state()],k.prototype,"_currentTimelineIcon",2),d([state()],k.prototype,"_toggleMicrophoneIcon",2),d([state()],k.prototype,"_mutableClassButton",2);var en={id:"camera",setup:async({pluginApi:r,uploaderApi:o})=>{te({CameraSource:k}),r.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!vo.htmlMediaCapture)return ["camera"];let e=U(r.config.get("cameraModes"));return e.length?e.map(t=>`mobile-${t}-camera`):["mobile-photo-camera"]},onSelect:()=>{o.setCurrentActivity(S.CAMERA),o.setModalState(true);}}),r.registry.registerSource({id:"mobile-photo-camera",label:"src-type-camera",icon:"camera",onSelect:()=>{o.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),r.registry.registerSource({id:"mobile-video-camera",label:"src-type-camera",icon:"camera",onSelect:()=>{o.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),r.registry.registerActivity({id:S.CAMERA,render:e=>{let t=document.createElement("uc-camera-source");return e.append(t),()=>{e.replaceChildren();}}});}};var Wr={};Xr(Wr,{BtnUi:()=>ae,CloudImageEditor:()=>Ni,CloudImageEditorBlock:()=>j,Config:()=>ot,CropFrame:()=>Mt,EditorAspectRatioButtonControl:()=>Rt,EditorCropButtonControl:()=>Ut,EditorFilterControl:()=>Ee,EditorFreeformButtonControl:()=>Ui,EditorImageCropper:()=>Pt,EditorImageFader:()=>ki,EditorOperationControl:()=>Vt,EditorScroller:()=>Dt,EditorSlider:()=>Lt,EditorToolbar:()=>X,Icon:()=>Pe,LineLoaderUi:()=>At,PresenceToggle:()=>nt,SliderUi:()=>ge,defineComponents:()=>te});var _c="cloud-image-editor",Cc="<svg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></svg>",tn={id:_c,setup:async({pluginApi:r,uploaderApi:o})=>(te({...Wr,...Gr}),r.registry.registerIcon({name:"edit-file",svg:Cc}),r.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:t=>!!(t.isImage&&t.cdnUrl),onClick:t=>{o.setCurrentActivity?.(S.CLOUD_IMG_EDIT,{internalId:t.internalId}),o.setModalState?.(true);}}),r.registry.registerActivity({id:S.CLOUD_IMG_EDIT,render:t=>{let i=document.createElement("uc-cloud-image-editor-activity");return t.append(i),()=>{t.replaceChildren();}}}),o.on(b.FILE_UPLOAD_SUCCESS,t=>{if(!t.isImage)return;let i=r.config.get("cropPreset"),s=r.config.get("useCloudImageEditor"),n=r.config.get("cloudImageEditorAutoOpen"),a=o._uploadCollection.size;s&&a===1&&(i||n)&&(o.setCurrentActivity?.(S.CLOUD_IMG_EDIT,{internalId:t.internalId}),o.setModalState?.(true));}))};var rn={id:"external-sources",setup:async({pluginApi:r,uploaderApi:o})=>{te({ExternalSource:Q}),r.registry.registerActivity({id:S.EXTERNAL,render:e=>{let t=document.createElement("uc-external-source");return e.append(t),()=>{e.replaceChildren();}}});for(let e of Object.values(ne))r.registry.registerSource({id:e,label:`src-type-${e}`,icon:e,onSelect:()=>{o.setCurrentActivity(S.EXTERNAL,{externalSourceType:e}),o.setModalState(true);}});}};var wc=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,on=r=>{if(typeof r!="string")return false;let o=wc.exec(r.toLocaleLowerCase())??[];if(o.length===0)return false;let e=Number(o[1])*Number(o[2]),t=16384*16384;return e>t?(console.warn(`Shrinked size can not be larger than ${Math.floor(t/1e3/1e3)}MP. You have set ${o[1]}x${o[2]} (${Math.ceil(e/1e3/100)/10}MP).`),false):{quality:o[3]?Number(o[3])/100:void 0,size:e}};var sn={id:"image-shrink",setup({pluginApi:r}){r.registry.registerFileHook({type:"beforeUpload",handler:async({file:o})=>{let e=r.config.get("imageShrink");if(!e)return {file:o};let t=on(e);if(!t)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:o};try{return {file:await shrinkFile(o,t)}}catch{return {file:o}}}});}};var nn={id:"instagram",setup({pluginApi:r}){r.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),onSelect:()=>{}});}};var an={id:A.LOCAL,setup:({pluginApi:r,uploaderApi:o})=>{r.registry.registerSource({id:A.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{o.openSystemDialog();}});}};var ln={id:"url-source",setup:async({pluginApi:r,uploaderApi:o})=>{te({UrlSource:dt}),r.registry.registerActivity({id:S.URL,render:e=>{let t=document.createElement("uc-url-source");return e.append(t),()=>{e.replaceChildren();}}}),r.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{o.setCurrentActivity(S.URL),o.setModalState(true);}});}};var ut=[{configDeps:["useCloudImageEditor"],isEnabled:r=>!!r("useCloudImageEditor"),load:()=>tn},{configDeps:["imageShrink"],isEnabled:r=>!!r("imageShrink"),load:()=>sn},{configDeps:["sourceList"],isEnabled:r=>U(r("sourceList")).includes(A.LOCAL),load:()=>an},{configDeps:["sourceList"],isEnabled:r=>U(r("sourceList")).includes(A.CAMERA),load:()=>en},{configDeps:["sourceList"],isEnabled:r=>U(r("sourceList")).includes("instagram"),load:()=>nn},{configDeps:["sourceList"],isEnabled:r=>Object.values(ne).some(o=>U(r("sourceList")).includes(o)),load:()=>rn},{configDeps:["sourceList"],isEnabled:r=>U(r("sourceList")).includes(A.URL),load:()=>ln}];var ji=class extends Te{constructor(){super();this.headless=false;this.init$={...this.init$};}static{this.lazyPlugins=ut;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:x.INIT_SOLUTION});}render(){return html` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};d([property({type:Boolean})],ji.prototype,"headless",2);var Gi=class extends Te{constructor(){super();this._couldCancel=false;this._handleCancel=()=>{if(this._couldHistoryBack){let e=this.$["*historyBack"];e?.();return}this._couldShowList&&(this.$["*currentActivity"]=v.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=ut;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get _couldHistoryBack(){let e=this.$["*history"];return !e||e.length<=1?false:e[e.length-1]!==v.activities.START_FROM}get _couldShowList(){let e=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(e)&&e.length>0}_getInitActivity(){return this.getCssData("--cfg-init-activity")||v.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:x.INIT_SOLUTION});let e=this._getInitActivity();this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=e);}),this.sub("*uploadList",t=>{Array.isArray(t)&&t.length>0&&this.$["*currentActivity"]===e&&(this.$["*currentActivity"]=v.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this._couldCancel=this._couldHistoryBack||this._couldShowList;});}render(){return html` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this._handleCancel} ?hidden=${!this._couldCancel} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};d([state()],Gi.prototype,"_couldCancel",2);var qr="active",qi="",Ne=class extends Te{constructor(){super();this._singleUpload=false;this._isHiddenStartFrom=false;this._classUploadList=qi;this._classStartFrom=qi;this._handleModalOpen=e=>{e.id===v.activities.CLOUD_IMG_EDIT&&(this._classUploadList=qr),this.$["*currentActivity"]===v.activities.UPLOAD_LIST&&(this._classUploadList=qr,this._isHiddenStartFrom=true);let t=this.$["*uploadList"];(!t||t.length<=0)&&(this._classStartFrom=qr);};this._handleModalClose=e=>{e.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=v.activities.UPLOAD_LIST,this._isHiddenStartFrom=false),e.id===v.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=v.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=ut;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}_getInitActivity(){return this.getCssData("--cfg-init-activity")||v.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:x.INIT_SOLUTION});let e=this._getInitActivity();this.sub("*currentActivity",t=>{t===v.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),t||(this.$["*currentActivity"]=e);}),this.sub("*uploadList",t=>{Array.isArray(t)&&t.length>0?(this.$["*currentActivity"]=v.activities.UPLOAD_LIST,this._classStartFrom=qi):(this._classUploadList=qi,this._isHiddenStartFrom=false,this.$["*currentActivity"]=e);}),this.subConfigValue("confirmUpload",t=>{t!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t),this.subConfigValue("multiple",i=>{t==="grid"?(i?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this._singleUpload=!i):(this.style.removeProperty("--uc-grid-col"),this._singleUpload=false);});}),this.modalManager?.subscribe(B.OPEN,this._handleModalOpen),this.modalManager?.subscribe(B.CLOSE,this._handleModalClose);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(B.OPEN,this._handleModalOpen),this.modalManager?.unsubscribe(B.CLOSE,this._handleModalClose);}render(){return html` ${super.render()}<uc-start-from ?hidden=${this._isHiddenStartFrom} class=${this._classStartFrom}><uc-drop-area ?single=${this._singleUpload} initflow clickable tabindex="0" ><span>${this.l10n("choose-file")}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this._classUploadList}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};d([state()],Ne.prototype,"_singleUpload",2),d([state()],Ne.prototype,"_isHiddenStartFrom",2),d([state()],Ne.prototype,"_classUploadList",2),d([state()],Ne.prototype,"_classStartFrom",2);
|
|
8
|
+
export{v as ActivityBlock,Ar as ActivityHeader,Yi as BaseComponent,g as Block,ae as BtnUi,k as CameraSource,Ni as CloudImageEditor,Ft as CloudImageEditorActivity,j as CloudImageEditorBlock,ot as Config,Tr as Copyright,Mt as CropFrame,O as Data,re as DropArea,Rt as EditorAspectRatioButtonControl,Ut as EditorCropButtonControl,Ee as EditorFilterControl,Ui as EditorFreeformButtonControl,Pt as EditorImageCropper,ki as EditorImageFader,Vt as EditorOperationControl,Dt as EditorScroller,Lt as EditorSlider,X as EditorToolbar,Q as ExternalSource,ne as ExternalUploadSource,Pr as FileItem,Gi as FileUploaderInline,Ne as FileUploaderMinimal,ji as FileUploaderRegular,Ei as FormInput,Pe as Icon,Cr as Img,At as LineLoaderUi,Ct as Modal,B as ModalEvents,pe as PACKAGE_NAME,he as PACKAGE_VERSION,It as PluginActivityHost,st as PluginActivityRenderer,nt as PresenceToggle,Qe as ProgressBar,wt as ProgressBarCommon,Je as Select,xt as SimpleBtn,ge as SliderUi,Te as SolutionBlock,et as SourceBtn,Tt as SourceList,Sr as Spinner,kr as StartFrom,it as Thumb,ee as UID,Mr as UploadCtxProvider,ue as UploadList,A as UploadSource,T as UploaderBlock,dt as UrlSource,te as defineComponents,io as defineLocale,En as loadFileUploaderFrom,Zt as toKebabCase};
|