@uploadcare/file-uploader 1.28.0-alpha.111 → 1.28.0-alpha.667
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 +3111 -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 +3253 -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 +3253 -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 +3210 -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 +3253 -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 +3253 -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 +3253 -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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var __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__(3074);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.op(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)}}},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 lit=__webpack_require__(7825),lit_decorators=__webpack_require__(7093),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=__webpack_require__(2258),style_map=__webpack_require__(5350),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,lit.qy)`<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.W)({transform:this._videoTransformCss})} ?hidden=${this._videoHidden} ${(0,ref.K)(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.K)(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.K)(this._timerRef)}> 00:00 </span><span ${(0,ref.K)(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._)(),this._lineRef=(0,ref._)(),this._videoRef=(0,ref._)(),this._switcherRef=(0,ref._)(),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,lit_decorators.wk)()],CameraSource.prototype,"_videoTransformCss",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_videoHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_messageHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_requestBtnHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_cameraSelectOptions",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_cameraSelectHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_l10nMessage",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_timerHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_cameraHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_cameraActionsHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_audioSelectOptions",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_audioSelectHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_audioSelectDisabled",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_audioToggleMicrophoneHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_tabCameraHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_tabVideoHidden",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_currentIcon",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_currentTimelineIcon",void 0),_ts_decorate([(0,lit_decorators.wk)()],CameraSource.prototype,"_toggleMicrophoneIcon",void 0),_ts_decorate([(0,lit_decorators.wk)()],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}})},5642(__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__(8288);let async_c=async n=>{let s=new TextEncoder().encode(n),e=Array.from(new Uint8Array(await window.crypto.subtle.digest("SHA-256",s))).map(a=>a.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},d=async n=>(e=>{if(e<=0n)return"0";let r="";for(;e>0n;)r="0123456789abcdefghijklmnopqrstuvwxyz"[Number(e%36n)]+r,e/=36n;return r})(await async_c(n)).slice(0,10),f=async(n,s)=>{var e;let n1;return e=await d(n),(n1=new URL(s)).hostname=`${e}.${n1.hostname}`,n1.toString().replace(/\/$/,"")};var 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||((e,r)=>{try{let n=new URL(e),t=new URL(r);return n.hostname.endsWith(t.hostname)}catch{return!1}})(cname,prefixed))?f(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 Promise.resolve().then(__webpack_require__.bind(__webpack_require__,2997));return cloudImageEditorPlugin}},{pluginId:"image-shrink",isEnabled:()=>!!imageShrink(),load:async()=>{let{imageShrinkPlugin}=await Promise.resolve().then(__webpack_require__.bind(__webpack_require__,5271));return imageShrinkPlugin}},{pluginId:"camera",isEnabled:()=>(0,comma_separated.A)(sourceList()).includes("camera"),load:async()=>{let{cameraPlugin}=await Promise.resolve().then(__webpack_require__.bind(__webpack_require__,7777));return cameraPlugin}},{pluginId:"instagram",isEnabled:()=>(0,comma_separated.A)(sourceList()).includes("instagram"),load:async()=>{let{instagramPlugin}=await Promise.resolve().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 Promise.resolve().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 Promise.resolve().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 lit=__webpack_require__(7825),lit_decorators=__webpack_require__(7093),ref=__webpack_require__(2258),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,lit.qy)`<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.K)(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._)(),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,lit_decorators.wk)()],ExternalSource.prototype,"_selectedList",void 0),_ts_decorate([(0,lit_decorators.wk)()],ExternalSource.prototype,"_isSelectionReady",void 0),_ts_decorate([(0,lit_decorators.wk)()],ExternalSource.prototype,"_isDoneBtnEnabled",void 0),_ts_decorate([(0,lit_decorators.wk)()],ExternalSource.prototype,"_couldSelectAll",void 0),_ts_decorate([(0,lit_decorators.wk)()],ExternalSource.prototype,"_couldDeselectAll",void 0),_ts_decorate([(0,lit_decorators.wk)()],ExternalSource.prototype,"_showSelectionStatus",void 0),_ts_decorate([(0,lit_decorators.wk)()],ExternalSource.prototype,"_showDoneBtn",void 0),_ts_decorate([(0,lit_decorators.wk)()],ExternalSource.prototype,"_doneBtnTextClass",void 0),_ts_decorate([(0,lit_decorators.wk)()],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__(7825),lit_decorators_js__rspack_import_1=__webpack_require__(7093),lit_directives_unsafe_svg_js__rspack_import_2=__webpack_require__(640),_lit_LitBlock__rspack_import_3=__webpack_require__(8288);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.qy)`${this.yield("",(0,lit__rspack_import_0.qy)`${(0,lit_directives_unsafe_svg_js__rspack_import_2.T)(this._pluginSvg)}`)}`:(0,lit__rspack_import_0.qy)` ${this.yield("",(0,lit__rspack_import_0.qy)`<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.MZ)({type:String})],Icon.prototype,"name",void 0),_ts_decorate([(0,lit_decorators_js__rspack_import_1.wk)()],Icon.prototype,"_resolvedHref",void 0),_ts_decorate([(0,lit_decorators_js__rspack_import_1.wk)()],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__(7825),lit_decorators_js__rspack_import_1=__webpack_require__(7093),lit_directives_ref_js__rspack_import_2=__webpack_require__(2258),_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.qy)`<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.K)(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._)(),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.wk)()],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__(7825);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.qy)`
|
|
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__(8288);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},8288(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{x:()=>LitBlock});var lit=__webpack_require__(7825),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()}}let ROLES={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function focus_group_focus(current,next){next.tabIndex=0,next.focus(),current.tabIndex=-1}function findGroupNodeByEventTarget(target){let itemRole=target.role||target.type||target.tagName;if(!itemRole)return null;let groupRoles=ROLES[itemRole.toLowerCase()];if(!groupRoles)return null;for(let role of groupRoles){let node=target.closest(`[role=${role}]`);if(node)return node}}function getItems(target,group){return"toolbar"===group.role?[...group.querySelectorAll("*")].filter(item=>"button"===item.role||"button"===item.type||"checkbox"===item.role||"checkbox"===item.type):group.querySelectorAll(`[role=${target.role}]`)}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(){var window1;let unbinds;this._scopedWindow=new ScopedMinimalWindow,this._destroyKeyUX=(window1=this._scopedWindow,unbinds=[window1=>{let inGroup=!1,lastTyped=0,searchPrefix="";function keyDown(event){let group=findGroupNodeByEventTarget(event.target);if(!group)return void stop();let items=getItems(event.target,group),index=Array.from(items).indexOf(event.target),nextKey="ArrowDown",prevKey="ArrowUp";if(function(group){let ariaOrientation=group.getAttribute("aria-orientation");if("vertical"===ariaOrientation)return!1;if("horizontal"===ariaOrientation)return!0;let role=group.role;return"menubar"===role||"tablist"===role||"toolbar"===role}(group)&&("rtl"===window1.document.dir?(nextKey="ArrowLeft",prevKey="ArrowRight"):(nextKey="ArrowRight",prevKey="ArrowLeft")),event.key===nextKey)event.preventDefault(),focus_group_focus(event.target,items[index+1]||items[0]);else if(event.key===prevKey)event.preventDefault(),focus_group_focus(event.target,items[index-1]||items[items.length-1]);else if("Home"===event.key)event.preventDefault(),focus_group_focus(event.target,items[0]);else if("End"===event.key)event.preventDefault(),focus_group_focus(event.target,items[items.length-1]);else if(1===event.key.length&&"tablist"!==group.role){let now=Date.now();now-lastTyped<=300?searchPrefix+=event.key.toLowerCase():searchPrefix=event.key.toLowerCase(),lastTyped=now;let found=Array.from(items).find(item=>item.textContent?.trim()?.toLowerCase()?.startsWith(searchPrefix));found&&(event.preventDefault(),focus_group_focus(event.target,found))}}function stop(){inGroup=!1,window1.removeEventListener("keydown",keyDown)}function focusIn(event){let group=findGroupNodeByEventTarget(event.target);if(group)for(let item of(inGroup||(inGroup=!0,window1.addEventListener("keydown",keyDown)),getItems(event.target,group)))item!==event.target&&item.setAttribute("tabindex",-1);else inGroup&&stop()}function focusOut(event){event.relatedTarget&&event.relatedTarget!==window1.document||stop()}function click(event){let group=findGroupNodeByEventTarget(event.target);if(group){for(let item of getItems(event.target,group))item!==event.target&&item.setAttribute("tabindex",-1);event.target.setAttribute("tabindex",0)}}return window1.addEventListener("click",click),window1.addEventListener("focusin",focusIn),window1.addEventListener("focusout",focusOut),()=>{stop(),window1.removeEventListener("click",click),window1.removeEventListener("focusin",focusIn),window1.removeEventListener("focusout",focusOut)}},function(pressedClass){let pressedElement,down,classes=pressedClass.split(" ");function keyDown(event){"Enter"===event.key&&("BUTTON"===event.target.tagName||"A"===event.target.tagName)&&(keyUp(),event.target.classList.add(...classes),pressedElement=event.target,down=event.target)}function keyUp(){pressedElement&&pressedElement.classList.remove(...classes),down=null}function click(event){0===event.clientX&&0===event.clientY&&down!==event.target&&(keyUp(),event.target.classList.add(...classes),pressedElement=event.target)}return window1=>(window1.addEventListener("click",click),window1.addEventListener("keydown",keyDown),window1.addEventListener("keyup",keyUp),()=>{window1.removeEventListener("click",click),window1.removeEventListener("keydown",keyDown),window1.removeEventListener("keyup",keyUp)})}("is-pressed"),window1=>{let finding,jumps=[],tries=0;function keyDown(event){var from;let ariaControls;event.target.getAttribute("aria-controls")&&"Enter"===event.key&&(from=event.target,clearInterval(finding),ariaControls=from.getAttribute("aria-controls"),finding=setInterval(()=>{if(tries++>50)return void clearInterval(finding);let area=window1.document.getElementById(ariaControls);if(area){let next=area.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');if(next){let current;clearInterval(finding),area.dispatchEvent(new window1.CustomEvent("keyuxJump",{bubbles:!0})),(current=window1.document.activeElement)&¤t!==window1.document.body&&jumps.push(new WeakRef(current)),next.focus({focusVisible:!0})}}},50)),"Escape"===event.key&&function back(){let ref=jumps.pop();if(!ref)return void window1.document.activeElement.blur();let el=ref.deref();el&&el.isConnected?el.focus():back()}()}return window1.addEventListener("keydown",keyDown),()=>{window1.removeEventListener("keydown",keyDown)}},window1=>{let allowed,wasHidden;function jump(e){if("true"===e.target.getAttribute("aria-hidden")){(allowed=e.target).setAttribute("aria-hidden","false"),(wasHidden=allowed.hidden)&&(allowed.hidden=!1);let first=e.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');first&&(first.tabIndex=0)}}function focusOut(e){allowed&&allowed.contains(e.target)&&(!e.relatedTarget||!allowed.contains(e.relatedTarget))&&(e.target.tabIndex=-1,allowed.setAttribute("aria-hidden","true"),wasHidden&&(allowed.hidden=!0),allowed=null)}return window1.addEventListener("keyuxJump",jump),window1.addEventListener("focusout",focusOut),()=>{window1.removeEventListener("keyuxJump",jump),window1.removeEventListener("focusout",focusOut)}}].map(plugin=>plugin(window1)),()=>{unbinds.forEach(unbind=>unbind())})}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{}}}function a(e){return{ok:!1,error:e}}class y{constructor(r="https://tlm.uploadcare.com/api/"){this.baseUrl=r}async base(r,s={}){let t=`${this.baseUrl}${r}`;try{let n=await fetch(t,s);if(!n.ok)return a(Error(`Got non-200 response from "${t}". Status: ${n.status.toString()}`));try{var e;return e=await n.json(),{ok:!0,value:e}}catch(o){return a(Error(`Error parsing JSON from "${t}". Error: ${o}`))}}catch(n){return a(Error(`Error fetching data from "${t}". Error: ${n}`))}}async post(r,s,t={}){return await this.base(r,{...t,method:"POST",body:JSON.stringify(function c(e){return Array.isArray(e)?e.map(r=>"object"==typeof r&&null!==r?c(r):r):"object"!=typeof e||null===e?e:Object.fromEntries(Object.entries(e).map(([r,s])=>{let t=r.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`).replace(/__/g,"_");return"object"==typeof s&&null!==s?[t,c(s)]:[t,s]}))}(s)),headers:{"Content-Type":"application/json",...t.headers||{}}})}async get(r,s={}){return await this.base(r,{method:"GET",...s})}}let p=async(e,r)=>({success:!0,data:r}),f=async e=>p(void 0,e);class h extends y{constructor(){super()}async sendEvent(r,s){let t=await f(r);if(!t.success)throw console.error("TelemetryAPIService: events: body is invalid",t.error),Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",r,s)}}var index_browser=__webpack_require__(3074),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 h,this._queue=new index_browser.op(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__(7560),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__(9962);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)(lit.WF))));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 index_browser=__webpack_require__(3074),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 index_browser.oW)return{type:"UPLOAD_ERROR",message:cause.message,payload:{entry:outputEntry,error:cause}};if(cause instanceof index_browser.Dr)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 index_browser.op(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__(7560),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,index_browser.$t)({...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,index_browser.fB)(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})},7560(__unused_rspack_module,__webpack_exports__,__webpack_require__){function listenKeys($store,keys,listener){let keysSet=new Set(keys).add(void 0);return $store.listen((value,oldValue,changed)=>{keysSet.has(changed)&&listener(value,oldValue,changed)})}__webpack_require__.d(__webpack_exports__,{G:()=>PubSub});let listenerQueue=[],lqIndex=0,epoch=0;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?function($store,keys,listener){let unbind=listenKeys($store,keys,listener);return listener($store.value),unbind}: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=((initial={})=>{let listeners,$atom,$map=(listeners=[],$atom={get:()=>($atom.lc||$atom.listen(()=>{})(),$atom.value),lc:0,listen:listener=>($atom.lc=listeners.push(listener),()=>{for(let i=lqIndex+4;i<listenerQueue.length;)listenerQueue[i]===listener?listenerQueue.splice(i,4):i+=4;let index=listeners.indexOf(listener);~index&&(listeners.splice(index,1),--$atom.lc||$atom.off())}),notify(oldValue,changedKey){epoch++;let runListenerQueue=!listenerQueue.length;for(let listener of listeners)listenerQueue.push(listener,$atom.value,oldValue,changedKey);if(runListenerQueue){for(lqIndex=0;lqIndex<listenerQueue.length;lqIndex+=4)listenerQueue[lqIndex](listenerQueue[lqIndex+1],listenerQueue[lqIndex+2],listenerQueue[lqIndex+3]);listenerQueue.length=0}},off(){},set(newValue){let oldValue=$atom.value;oldValue!==newValue&&($atom.value=newValue,$atom.notify(oldValue))},subscribe(listener){let unbind=$atom.listen(listener);return listener($atom.value),unbind},value:initial});return $map.setKey=function(key,value){let oldMap=$map.value;void 0===value&&key in $map.value?($map.value={...$map.value},delete $map.value[key],$map.notify(oldMap,key)):$map.value[key]!==value&&($map.value={...$map.value,[key]:value},$map.notify(oldMap,key))},$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)}}}},9962(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{w:()=>SymbioteMixin});class context_request_event_s extends Event{constructor(s,t,e,o){super("context-request",{bubbles:!0,composed:!0}),this.context=s,this.contextTarget=t,this.callback=e,this.subscribe=o??!1}}class context_consumer_s{constructor(t,s,i,h){(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(t,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=t,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(t,s)),this.unsubscribe=s},this.host=t,void 0!==s.context)?(this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1):(this.context=s,this.callback=i,this.subscribe=h??!1),this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new context_request_event_s(this.context,this.host,this.t,this.subscribe))}}class value_notifier_s{get value(){return this.o}set value(s){this.setValue(s)}setValue(s,t=!1){let i=t||!Object.is(s,this.o);this.o=s,i&&this.updateObservers()}constructor(s){this.subscriptions=new Map,this.updateObservers=()=>{for(let[s,{disposer:t}]of this.subscriptions)s(this.o,t)},void 0!==s&&(this.value=s)}addCallback(s,t,i){if(!i)return void s(this.value);this.subscriptions.has(s)||this.subscriptions.set(s,{disposer:()=>{this.subscriptions.delete(s)},consumerHost:t});let{disposer:h}=this.subscriptions.get(s);s(this.value,h)}clearCallbacks(){this.subscriptions.clear()}}class context_provider_e extends Event{constructor(t,s){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=s}}class context_provider_i extends value_notifier_s{constructor(s,e,i){super(void 0!==e.context?e.initialValue:i),this.onContextRequest=t=>{if(t.context!==this.context)return;let s=t.contextTarget??t.composedPath()[0];s!==this.host&&(t.stopPropagation(),this.addCallback(t.callback,s,t.subscribe))},this.onProviderRequest=s=>{if(s.context!==this.context||(s.contextTarget??s.composedPath()[0])===this.host)return;let e=new Set;for(let[s,{consumerHost:i}]of this.subscriptions)e.has(s)||(e.add(s),i.dispatchEvent(new context_request_event_s(this.context,i,s,!0)));s.stopPropagation()},this.host=s,void 0!==e.context?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new context_provider_e(this.context,this.host))}}var lit_decorators=__webpack_require__(7093),debounce=__webpack_require__(4441),PubSubCompat=__webpack_require__(7560);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}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 context_consumer_s(this,{context:"ctx-name-context",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 context_provider_i(this,{context:"ctx-name-context",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,lit_decorators.MZ)({type:String,attribute:"ctx-name",noAccessor:!0})],SymbioteMixinClass.prototype,"_ctxNameAttr",null),_ts_decorate([(0,lit_decorators.wk)()],SymbioteMixinClass.prototype,"_ctxNameFromContext",void 0),_ts_decorate([(0,lit_decorators.wk)()],SymbioteMixinClass.prototype,"ctxName",void 0),_ts_decorate([(0,lit_decorators.wk)()],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"}},7777(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{cameraPlugin:()=>cameraPlugin});var _abstract_defineComponents__rspack_import_0=__webpack_require__(3962),_blocks_CameraSource_CameraSource__rspack_import_1=__webpack_require__(4252),_lit_activity_constants__rspack_import_4=__webpack_require__(7715),_utils_browser_info__rspack_import_2=__webpack_require__(1633),_utils_comma_separated__rspack_import_3=__webpack_require__(9101);let cameraPlugin={id:"camera",setup:async({pluginApi,uploaderApi})=>{(0,_abstract_defineComponents__rspack_import_0.Y)({CameraSource:_blocks_CameraSource_CameraSource__rspack_import_1.r}),pluginApi.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!_utils_browser_info__rspack_import_2.wN.htmlMediaCapture)return["camera"];let modes=(0,_utils_comma_separated__rspack_import_3.A)(pluginApi.config.get("cameraModes"));return modes.length?modes.map(mode=>`mobile-${mode}-camera`):["mobile-photo-camera"]},onSelect:()=>{uploaderApi.setCurrentActivity(_lit_activity_constants__rspack_import_4.g.CAMERA),uploaderApi.setModalState(!0)}}),pluginApi.registry.registerSource({id:"mobile-photo-camera",label:"src-type-camera",icon:"camera",onSelect:()=>{uploaderApi.openSystemDialog({captureCamera:!0,modeCamera:"photo"})}}),pluginApi.registry.registerSource({id:"mobile-video-camera",label:"src-type-camera",icon:"camera",onSelect:()=>{uploaderApi.openSystemDialog({captureCamera:!0,modeCamera:"video"})}}),pluginApi.registry.registerActivity({id:_lit_activity_constants__rspack_import_4.g.CAMERA,render:host=>{let cameraEl=document.createElement("uc-camera-source");return host.append(cameraEl),()=>{host.replaceChildren()}}})}}},2997(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{cloudImageEditorPlugin:()=>cloudImageEditorPlugin});var CloudImageEditorActivity_namespaceObject={};__webpack_require__.r(CloudImageEditorActivity_namespaceObject),__webpack_require__.d(CloudImageEditorActivity_namespaceObject,{CloudImageEditorActivity:()=>CloudImageEditorActivity});var cloud_image_editor_namespaceObject={};__webpack_require__.r(cloud_image_editor_namespaceObject),__webpack_require__.d(cloud_image_editor_namespaceObject,{BtnUi:()=>BtnUi,CloudImageEditor:()=>CloudImageEditor,CloudImageEditorBlock:()=>CloudImageEditorBlock,Config:()=>Config.T,CropFrame:()=>CropFrame,EditorAspectRatioButtonControl:()=>EditorAspectRatioButtonControl,EditorCropButtonControl:()=>EditorCropButtonControl,EditorFilterControl:()=>EditorFilterControl,EditorFreeformButtonControl:()=>EditorFreeformButtonControl,EditorImageCropper:()=>EditorImageCropper,EditorImageFader:()=>EditorImageFader,EditorOperationControl:()=>EditorOperationControl,EditorScroller:()=>EditorScroller,EditorSlider:()=>EditorSlider,EditorToolbar:()=>EditorToolbar,Icon:()=>Icon.I,LineLoaderUi:()=>LineLoaderUi,PresenceToggle:()=>PresenceToggle,SliderUi:()=>SliderUi,defineComponents:()=>defineComponents.Y});var defineComponents=__webpack_require__(3962),lit=__webpack_require__(7825),lit_decorators=__webpack_require__(7093),lit_html=__webpack_require__(6752),LitActivityBlock=__webpack_require__(5923),LitUploaderBlock=__webpack_require__(5544);class CloudImageEditorActivity extends LitUploaderBlock.z{get activityParams(){let params=super.activityParams;if("internalId"in params)return params;throw Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",cropPreset=>{this._editorConfig&&this._editorConfig.cropPreset!==cropPreset&&(this._editorConfig={...this._editorConfig,cropPreset})}),this.subConfigValue("cloudImageEditorTabs",tabs=>{this._editorConfig&&this._editorConfig.tabs!==tabs&&(this._editorConfig={...this._editorConfig,tabs})}),this._mountEditor()}disconnectedCallback(){super.disconnectedCallback(),this._unmountEditor()}_handleApply(e){if(!this._entry)return;this.debugPrint('editor event "apply"',e.detail);let result=e.detail;this._entry.setMultipleValues({cdnUrl:result.cdnUrl,cdnUrlModifiers:result.cdnUrlModifiers}),this.modalManager?.close(LitActivityBlock.S.activities.CLOUD_IMG_EDIT),this.historyBack()}_handleCancel(event){let detail=event instanceof CustomEvent?event.detail:void 0;this.debugPrint('editor event "cancel"',detail),this.modalManager?.close(LitActivityBlock.S.activities.CLOUD_IMG_EDIT),this.historyBack()}handleChange(event){this.debugPrint('editor event "change"',event.detail)}_mountEditor(){let{internalId}=this.activityParams,entry=this.uploadCollection.read(internalId);if(!entry)throw Error(`Entry with internalId "${internalId}" not found`);this._entry=entry;let cdnUrl=this._entry.getValue("cdnUrl");if(!cdnUrl)throw Error(`Entry with internalId "${internalId}" hasn't uploaded yet`);this._editorConfig=this._createEditorConfig(cdnUrl)}_unmountEditor(){this._entry=void 0,this._editorConfig=null}render(){if(!this._editorConfig)return lit.s6;let{cdnUrl,cropPreset,tabs}=this._editorConfig;return(0,lit.qy)`<uc-cloud-image-editor cdn-url=${cdnUrl} crop-preset=${cropPreset??lit_html.s6} tabs=${tabs??lit_html.s6} @apply=${this._handleApply} @cancel=${this._handleCancel} @change=${this.handleChange} ></uc-cloud-image-editor>`}_createEditorConfig(cdnUrl){return{cdnUrl,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}constructor(...args){super(...args),this._editorConfig=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,lit_decorators.wk)()],CloudImageEditorActivity.prototype,"_editorConfig",void 0);var activity_constants=__webpack_require__(7715),ref=__webpack_require__(2258),unsafe_svg=__webpack_require__(640),LitBlock=__webpack_require__(8288),cdn_utils=__webpack_require__(6339),comma_separated=__webpack_require__(9101),debounce=__webpack_require__(4441),transparentPixelSrc=__webpack_require__(8608);function normalize(...args){return args.reduce((result,arg)=>{if("string"==typeof arg)return result[arg]=!0,result;for(let token of Object.keys(arg))result[token]=arg[token];return result},{})}function classNames(...args){let mapping=normalize(...args);return Object.keys(mapping).reduce((result,token)=>(mapping[token]&&result.push(token),result),[]).join(" ")}var parseCropPreset=__webpack_require__(5342),toolbar_constants=__webpack_require__(1583);let isTabIdValue=value=>toolbar_constants.nz.includes(value);var transformationUtils=__webpack_require__(8930);function CloudImageEditorBlock_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_TABS=(0,comma_separated.L)([...toolbar_constants.nz]);class CloudImageEditorBlock extends LitBlock.x{static{this.styleAttrs=["uc-cloud-image-editor"]}_scheduleInitialization(){this._isInitialized||this._pendingInitUpdate||(this._pendingInitUpdate=this.updateComplete.then(()=>{this._pendingInitUpdate=null,this._isInitialized=!0}))}initCallback(){super.initCallback(),this._syncTabListFromProp(),this._syncCropPresetState()}_assignSharedElements(){let faderEl=this._faderRef.value;faderEl&&(this.$["*faderEl"]=faderEl);let cropperEl=this._cropperRef.value;cropperEl&&(this.$["*cropperEl"]=cropperEl);let imgContainerEl=this._imgContainerRef.value;imgContainerEl&&(this.$["*imgContainerEl"]=imgContainerEl);let imgEl=this._imgRef.value;imgEl&&(this.$["*imgEl"]=imgEl)}_attachImageListeners(){let imgEl=this._imgRef.value;imgEl&&(imgEl.addEventListener("load",this._handleImageLoad),imgEl.addEventListener("error",this._handleImageError))}_detachImageListeners(){let imgEl=this._imgRef.value;imgEl&&(imgEl.removeEventListener("load",this._handleImageLoad),imgEl.removeEventListener("error",this._handleImageError))}get _imageClassName(){let tabId=this.$["*tabId"];return classNames("uc-image",{"uc-image_hidden_to_cropper":tabId===toolbar_constants.XB.CROP,"uc-image_hidden_effects":tabId!==toolbar_constants.XB.CROP})}_waitForSize(){return new Promise((resolve,reject)=>{let timeoutId=window.setTimeout(()=>{reject(Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),resizeObserver=new ResizeObserver(entries=>{let[element]=entries;element&&element.contentRect.width>0&&element.contentRect.height>0&&(window.clearTimeout(timeoutId),resizeObserver.disconnect(),window.setTimeout(()=>resolve(),0))});resizeObserver.observe(this)})}firstUpdated(changedProperties){super.firstUpdated(changedProperties),this._assignSharedElements(),this._attachImageListeners(),this.initEditor();let hasInitialSource=!!(this.uuid||this.cdnUrl),alreadyRequested=changedProperties.has("uuid")||changedProperties.has("cdnUrl");hasInitialSource&&!alreadyRequested&&this.updateImage()}disconnectedCallback(){this._detachImageListeners(),super.disconnectedCallback()}render(){var n,r,n1,r1;let fileType=this._fileType??"",message=this._statusMessage??"",src=this._imageSrc||transparentPixelSrc.d,showLoader=this._showLoader,showNetworkProblems=this._hasNetworkProblems;return(0,lit.qy)`${(0,unsafe_svg.T)("<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>")} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${showNetworkProblems}><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">${fileType}</div></div><div class="uc-image_container" ${(0,ref.K)(this._imgContainerRef)}><img src=${src} class=${this._imageClassName} ${(0,ref.K)(this._imgRef)} /> ${n=this._isInitialized,r=()=>(0,lit.qy)`<uc-editor-image-cropper ${(0,ref.K)(this._cropperRef)}></uc-editor-image-cropper>`,n?r(n):void 0} <uc-editor-image-fader ${(0,ref.K)(this._faderRef)}></uc-editor-image-fader></div><div class="uc-info_pan">${message}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${showLoader}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"> ${n1=this._isInitialized,r1=()=>(0,lit.qy)`<uc-editor-toolbar></uc-editor-toolbar>`,n1?r1(n1):void 0} </div></div></div>`}updated(changedProperties){super.updated(changedProperties),changedProperties.has("uuid")&&this.uuid&&this.updateImage(),changedProperties.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),changedProperties.has("tabs")&&this._syncTabListFromProp(),(changedProperties.has("cropPreset")||changedProperties.has("cdnUrl"))&&this._syncCropPresetState()}_syncTabListFromProp(){let tabsValue=this.tabs||DEFAULT_TABS;this.$["*tabList"]=(tabs=>{if(!tabs)return toolbar_constants.nz;let tabList=(0,comma_separated.A)(tabs).filter(isTabIdValue);return 0===tabList.length?toolbar_constants.nz:tabList})(tabsValue)}_syncCropPresetState(){let list=(0,parseCropPreset.j)(this.cropPreset??""),closest=null;if(this.cdnUrl){let operations=(0,cdn_utils.I1)(this.cdnUrl),transformations=(0,transformationUtils.ym)(operations);if(Array.isArray(transformations?.crop?.dimensions)){let[w,h]=transformations.crop.dimensions;closest=(0,parseCropPreset.t)(w,h,list,.1)}}this.$["*cropPresetList"]=list,this.$["*currentAspectRatio"]=closest??list?.[0]??null}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.cdnUrl){let cdnUrlValue=this.cdnUrl,uuid=(0,cdn_utils.p_)(cdnUrlValue),originalUrl=(0,cdn_utils.vo)(cdnUrlValue,uuid);if(originalUrl===this.$["*originalUrl"])return;this.$["*originalUrl"]=originalUrl;let operations=(0,cdn_utils.I1)(cdnUrlValue),transformations=(0,transformationUtils.ym)(operations);this.$["*editorTransformations"]=transformations}else if(this.uuid){let originalUrl=(0,cdn_utils.vo)(this.cfg.cdnCname,this.uuid);if(originalUrl===this.$["*originalUrl"])return;this.$["*originalUrl"]=originalUrl,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={})}else throw Error("No UUID nor CDN URL provided");this.$["*tabId"]===toolbar_constants.XB.CROP?this.$["*cropperEl"]?.deactivate({reset:!0}):this.$["*faderEl"]?.deactivate();try{let originalUrlValue=this.$["*originalUrl"],cdnUrl=await this.proxyUrl((0,cdn_utils.LN)(originalUrlValue,(0,cdn_utils.$z)("json"))),{width,height}=await fetch(cdnUrl).then(response=>response.json());this.$["*imageSize"]={width,height},this.$["*tabId"]===toolbar_constants.XB.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:originalUrlValue})}catch(err){err&&(this.telemetryManager.sendEventError(err,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",err))}this._scheduleInitialization()}}async initEditor(){try{await this._waitForSize()}catch(err){this.isConnected&&console.error(err.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",networkProblems=>{this._hasNetworkProblems=!!networkProblems}),this.sub("*editorTransformations",transformations=>{if(0===Object.keys(transformations).length)return;let originalUrl=this.$["*originalUrl"],cdnUrlModifiers=(0,cdn_utils.$z)((0,transformationUtils.ON)(transformations),"preview"),cdnUrl=(0,cdn_utils.LN)(originalUrl,cdnUrlModifiers);this.dispatchEvent(new CustomEvent("change",{detail:{originalUrl,cdnUrlModifiers,cdnUrl,transformations},bubbles:!0,composed:!0}))},!1)}constructor(...args){var fnCtx;super(...args),this.ctxOwner=!0,this._statusMessage="",this._imageSrc=transparentPixelSrc.d,this._fileType="",this._showLoader=!1,this.uuid=null,this.cdnUrl=null,this.cropPreset="",this.tabs=DEFAULT_TABS,this._hasNetworkProblems=!1,this._isInitialized=!1,this._pendingInitUpdate=null,this._debouncedShowLoader=(0,debounce.s)(show=>{this._showLoader=show},300),this._imgRef=(0,ref._)(),this._cropperRef=(0,ref._)(),this._faderRef=(0,ref._)(),this._imgContainerRef=(0,ref._)(),this._handleImageLoad=()=>{this._debouncedShowLoader(!1),this._imageSrc!==transparentPixelSrc.d&&(this.$["*networkProblems"]=!1)},this._handleImageError=()=>{this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0},this._handleRetryNetwork=()=>{let retry=this.$["*on.retryNetwork"];retry?.()},this.init$={...this.init$,...(fnCtx=this,{"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":toolbar_constants.nz,"*tabId":toolbar_constants.XB.CROP,"*on.retryNetwork":()=>{for(let img of fnCtx.querySelectorAll("img")){let originalSrc=img.src;img.src=transparentPixelSrc.d,img.src=originalSrc}fnCtx.$["*networkProblems"]=!1},"*on.apply":transformations=>{if(!transformations)return;let originalUrl=fnCtx.$["*originalUrl"];if(!originalUrl)return void console.warn("Original URL is null, cannot apply transformations");let cdnUrlModifiers=(0,cdn_utils.$z)((0,transformationUtils.ON)(transformations),"preview"),cdnUrl=(0,cdn_utils.LN)(originalUrl,cdnUrlModifiers);fnCtx.dispatchEvent(new CustomEvent("apply",{detail:{originalUrl,cdnUrlModifiers,cdnUrl,transformations},bubbles:!0,composed:!0})),fnCtx.remove()},"*on.cancel":()=>{fnCtx.remove(),fnCtx.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}})}}}CloudImageEditorBlock_ts_decorate([(0,lit_decorators.wk)()],CloudImageEditorBlock.prototype,"_statusMessage",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.wk)()],CloudImageEditorBlock.prototype,"_imageSrc",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.wk)()],CloudImageEditorBlock.prototype,"_fileType",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.wk)()],CloudImageEditorBlock.prototype,"_showLoader",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.MZ)({type:String,reflect:!0})],CloudImageEditorBlock.prototype,"uuid",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.MZ)({type:String,attribute:"cdn-url",reflect:!0})],CloudImageEditorBlock.prototype,"cdnUrl",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.MZ)({type:String,attribute:"crop-preset",reflect:!0})],CloudImageEditorBlock.prototype,"cropPreset",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.MZ)({type:String,reflect:!0})],CloudImageEditorBlock.prototype,"tabs",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.wk)()],CloudImageEditorBlock.prototype,"_hasNetworkProblems",void 0),CloudImageEditorBlock_ts_decorate([(0,lit_decorators.wk)()],CloudImageEditorBlock.prototype,"_isInitialized",void 0);var UID=__webpack_require__(5446),crop_utils=__webpack_require__(8996);let GUIDE_THIRD=100/3;class CropFrame extends LitBlock.x{get _svgElement(){return this._svgRef.value??null}get _dragging(){return this._draggingValue}set _dragging(value){this._draggingValue!==value&&(this._draggingValue=value,this._applyGuidesDragState())}_applyGuidesDragState(){this._frameGuides&&this._frameGuides.setAttribute("class",classNames({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&this._draggingValue,"uc-guides--semi-hidden":!this._guidesHidden&&!this._draggingValue}))}_shouldThumbBeDisabled(direction){let imageBox=this.$["*imageBox"];if(!imageBox)return!1;if(""===direction&&imageBox.height<=1&&imageBox.width<=1)return!0;let tooHigh=imageBox.height<=1&&(direction.includes("n")||direction.includes("s")),tooWide=imageBox.width<=1&&(direction.includes("e")||direction.includes("w"));return tooHigh||tooWide}_createBackdrop(){let cropBox=this.$["*cropBox"];if(!cropBox)return;let{x,y,width,height}=cropBox,svg=this._svgElement;if(!svg)return;let mask=(0,crop_utils.l8)("mask",{id:this._backdropMaskId}),maskRectOuter=(0,crop_utils.l8)("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),maskRectInner=(0,crop_utils.l8)("rect",{x,y,width,height,fill:"black"});mask.appendChild(maskRectOuter),mask.appendChild(maskRectInner);let backdropRect=(0,crop_utils.l8)("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this._backdropMaskId})`});svg.appendChild(backdropRect),svg.appendChild(mask),this._backdropMask=mask,this._backdropMaskInner=maskRectInner}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let cropBox=this.$["*cropBox"];if(!cropBox)return;let{x,y,width,height}=cropBox;this._backdropMaskInner&&(0,crop_utils.F2)(this._backdropMaskInner,{x,y,width,height})}_updateFrame(){let cropBox=this.$["*cropBox"];if(cropBox&&this._frameGuides&&this._frameThumbs){for(let thumb of Object.values(this._frameThumbs)){if(!thumb)continue;let{direction,pathNode,interactionNode,groupNode}=thumb,isCenter=""===direction,isCorner=2===direction.length,{x,y,width,height}=cropBox;if(isCenter){let moveThumbRect={x,y,width,height};(0,crop_utils.F2)(interactionNode,moveThumbRect)}else{let thumbSizeMultiplier=(0,crop_utils.qE)(Math.min(width,height)/82/2,0,1),pathInfo=isCorner?(0,crop_utils.VH)(cropBox,direction,thumbSizeMultiplier):(0,crop_utils.fN)(cropBox,direction,thumbSizeMultiplier),center=pathInfo.center;if(!center)continue;let size=Math.max(24*(0,crop_utils.qE)(Math.min(width,height)/24/3,0,1),6);(0,crop_utils.F2)(interactionNode,{x:center[0]-size,y:center[1]-size,width:2*size,height:2*size}),(0,crop_utils.F2)(pathNode,{d:pathInfo.d})}let disableThumb=this._shouldThumbBeDisabled(direction);groupNode.setAttribute("class",classNames("uc-thumb",{"uc-thumb--hidden":disableThumb,"uc-thumb--visible":!disableThumb}))}(0,crop_utils.F2)(this._frameGuides,{x:cropBox.x-.5,y:cropBox.y-.5,width:cropBox.width+1,height:cropBox.height+1})}}_createThumb(frameThumbs,direction){let groupNode=(0,crop_utils.l8)("g");groupNode.classList.add("uc-thumb"),groupNode.setAttribute("with-effects","");let interactionNode=(0,crop_utils.l8)("rect",{fill:"transparent"}),pathNode=(0,crop_utils.l8)("path",{stroke:"currentColor",fill:"none","stroke-width":3});groupNode.appendChild(pathNode),groupNode.appendChild(interactionNode),frameThumbs[direction]={direction,pathNode,interactionNode,groupNode},""===direction&&(groupNode.style.cursor="move"),interactionNode.addEventListener("pointerdown",this._handlePointerDown.bind(this,direction))}_createThumbs(){let frameThumbs={};for(let i=0;i<3;i++)for(let j=0;j<3;j++){let direction=`${["n","","s"][i]}${["w","","e"][j]}`;""!==direction&&this._createThumb(frameThumbs,direction)}return this._createThumb(frameThumbs,""),frameThumbs}_createGuides(){let svg=(0,crop_utils.l8)("svg"),rect=(0,crop_utils.l8)("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});svg.appendChild(rect);for(let i=1;i<=2;i++){let line=(0,crop_utils.l8)("line",{x1:`${GUIDE_THIRD*i}%`,y1:"0%",x2:`${GUIDE_THIRD*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});svg.appendChild(line)}for(let i=1;i<=2;i++){let line=(0,crop_utils.l8)("line",{x1:"0%",y1:`${GUIDE_THIRD*i}%`,x2:"100%",y2:`${GUIDE_THIRD*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});svg.appendChild(line)}return svg.classList.add("uc-guides","uc-guides--semi-hidden"),svg}_createFrame(){let svg=this._svgElement;if(!svg)return;let fr=document.createDocumentFragment(),frameGuides=this._createGuides();fr.appendChild(frameGuides);let frameThumbs=this._createThumbs();for(let{groupNode}of Object.values(frameThumbs))fr.appendChild(groupNode);svg.appendChild(fr),this._frameThumbs=frameThumbs,this._frameGuides=frameGuides,this._applyGuidesDragState()}_handlePointerDown(direction,e){if(!this._frameThumbs)return;let thumb=this._frameThumbs[direction];if(!thumb||this._shouldThumbBeDisabled(direction))return;let cropBox=this.$["*cropBox"],svgElement=this._svgElement;if(!svgElement)return;let{x:svgX,y:svgY}=svgElement.getBoundingClientRect(),x=e.x-svgX,y=e.y-svgY;this._dragging=!0,this._draggingThumb=thumb,this._dragStartPoint=[x,y],this._dragStartCrop={...cropBox}}_calcCropBox(direction,delta){let[dx,dy]=delta,imageBox=this.$["*imageBox"],rect=this._dragStartCrop??this.$["*cropBox"],cropPreset=this.$["*currentAspectRatio"],aspectRatio=cropPreset?cropPreset.width/cropPreset.height:void 0;return Object.values(rect=""===direction?(0,crop_utils._J)({rect,delta:[dx,dy],imageBox}):(0,crop_utils.dz)({rect,delta:[dx,dy],direction,aspectRatio,imageBox})).every(number=>Number.isFinite(number)&&number>=0)?(0,crop_utils.YH)((0,crop_utils.rH)(rect),imageBox):void console.error("CropFrame is trying to create invalid rectangle",{payload:rect})}_updateCursor(){let hoverThumb=this._hoverThumb,svg=this._svgElement;svg&&(svg.style.cursor=hoverThumb?(0,crop_utils.vv)(hoverThumb.direction):"initial")}_createMask(href){if(this._frameImage)return void this._frameImage.setAttribute("href",href);let svg=this._svgElement;if(!svg){this._pendingMaskHref=href;return}this._pendingMaskHref=null;let fr=document.createDocumentFragment(),imageNode=(0,crop_utils.l8)("image",{href});imageNode.setAttribute("class","uc-cloud-mask"),fr.appendChild(imageNode),svg.appendChild(fr),this._frameImage=imageNode}_updateMask(){let cropBox=this.$["*cropBox"];if(!cropBox||!this._frameImage)return;let{x,y,width,height}=cropBox;(0,crop_utils.F2)(this._frameImage,{x,y,height,width})}_render(){this._svgReady&&(this._updateBackdrop(),this._updateFrame(),this._updateMask())}toggleThumbs(visible){if(this._frameThumbs)for(let thumb of Object.values(this._frameThumbs)){if(!thumb)continue;let{groupNode}=thumb;groupNode.setAttribute("class",classNames("uc-thumb",{"uc-thumb--hidden":!visible,"uc-thumb--visible":visible}))}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._resizeBackdrop(),this._svgReady&&window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",cropBox=>{!cropBox||(this._guidesHidden=cropBox.height<=1||cropBox.width<=1,this._applyGuidesDragState(),this._svgReady&&window.requestAnimationFrame(()=>{this._render()}))}),this.subConfigValue("cloudImageEditorMaskHref",maskHref=>{maskHref&&this._createMask(maskHref)}),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}firstUpdated(changedProperties){super.firstUpdated(changedProperties),this._initializeSvg()}_initializeSvg(){let svg=this._svgElement;if(svg&&!this._svgReady){if(this._createBackdrop(),this._createFrame(),this._svgReady=!0,svg.addEventListener("pointermove",this._handleSvgPointerMove,!0),this._pendingMaskHref){let pendingMask=this._pendingMaskHref;this._pendingMaskHref=null,this._createMask(pendingMask)}this._render()}}disconnectedCallback(){super.disconnectedCallback();let svg=this._svgElement;svg?.removeEventListener("pointermove",this._handleSvgPointerMove,!0),document.removeEventListener("pointermove",this._handlePointerMove,!0),document.removeEventListener("pointerup",this._handlePointerUp,!0)}render(){return(0,lit.qy)`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${(0,ref.K)(this._svgRef)}></svg>`}constructor(...args){super(...args),this._backdropMaskId=`uc-backdrop-mask-${UID.V.generateFastUid()}`,this._guidesHidden=!1,this._draggingValue=!1,this._svgRef=(0,ref._)(),this._svgReady=!1,this._pendingMaskHref=null,this._handlePointerUp=e=>{this._updateCursor(),this._dragging&&(e.stopPropagation(),e.preventDefault(),this._dragging=!1)},this._handlePointerMove=e=>{if(!this._dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let svg=this._svgElement;if(!svg)return;let{x:svgX,y:svgY}=svg.getBoundingClientRect(),x=e.x-svgX,y=e.y-svgY,dx=x-this._dragStartPoint[0],dy=y-this._dragStartPoint[1],{direction}=this._draggingThumb,movedCropBox=this._calcCropBox(direction,[dx,dy]);movedCropBox&&(this.$["*cropBox"]=movedCropBox)},this._handleSvgPointerMove=e=>{if(!this._frameThumbs)return;let hoverThumb=Object.values(this._frameThumbs).find(thumb=>{if(!thumb||this._shouldThumbBeDisabled(thumb.direction))return!1;let bounds=thumb.interactionNode.getBoundingClientRect(),rect={x:bounds.x,y:bounds.y,width:bounds.width,height:bounds.height};return(0,crop_utils._c)(rect,[e.x,e.y])});this._hoverThumb=hoverThumb,this._updateCursor()}}}!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.wk)()],CropFrame.prototype,"_draggingValue",void 0);var directive=__webpack_require__(7804);let class_map_e=(0,directive.u$)(class extends directive.WL{constructor(t){if(super(t),t.type!==directive.OA.ATTRIBUTE||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){for(let t in this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t))),i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}let r=s.element.classList;for(let t of this.st)t in i||(r.remove(t),this.st.delete(t));for(let t in i){let s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)))}return lit_html.c0}});function EditorButtonControl_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 EditorButtonControl extends LitBlock.x{get buttonClasses(){let isActive=this.active;return{"uc-active":isActive,"uc-not_active":!isActive}}_updateHostStateClasses(){for(let[className,enabled]of Object.entries(this.buttonClasses))this.classList.toggle(className,enabled)}onClick(_event){}connectedCallback(){super.connectedCallback(),this._updateHostStateClasses()}updated(changedProperties){super.updated(changedProperties),changedProperties.has("active")&&this._updateHostStateClasses()}render(){let clickHandler=this.onClick,title=this.title;return(0,lit.qy)`<button role="option" type="button" aria-label=${this.titleProp??lit_html.s6} title=${this.titleProp??lit_html.s6} @click=${clickHandler} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!title}>${title}</div></button>`}constructor(...args){super(...args),this.active=!1,this.title="",this.icon="",this.titleProp=""}}EditorButtonControl_ts_decorate([(0,lit_decorators.wk)()],EditorButtonControl.prototype,"active",void 0),EditorButtonControl_ts_decorate([(0,lit_decorators.wk)()],EditorButtonControl.prototype,"title",void 0),EditorButtonControl_ts_decorate([(0,lit_decorators.wk)()],EditorButtonControl.prototype,"icon",void 0),EditorButtonControl_ts_decorate([(0,lit_decorators.wk)()],EditorButtonControl.prototype,"titleProp",void 0);class EditorFreeformButtonControl extends EditorButtonControl{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",opt=>{let title=this._computeTitle(opt);this.title=title,this.titleProp=title})}onClick(){this.$["*showListAspectRatio"]=!0}_computeTitle(aspectRatio){return aspectRatio?aspectRatio.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${aspectRatio.width}:${aspectRatio.height}`}):""}render(){let clickHandler=this.onClick,title=this.title;return(0,lit.qy)`<button role="option" type="button" class=${class_map_e(this.buttonClasses)} aria-label=${this.titleProp??lit_html.s6} title=${this.titleProp??lit_html.s6} @click=${clickHandler} ><div class="uc-title" ?hidden=${!title}>${title}</div><uc-icon name=${this.icon}></uc-icon></button>`}}class EditorAspectRatioButtonControl extends EditorButtonControl{get aspectRatio(){return this._aspectRatio}set aspectRatio(value){if(this._aspectRatio===value)return;let previous=this._aspectRatio;this._aspectRatio=value,this.requestUpdate("aspectRatio",previous),value?this._updateAspectRatioPresentation(value):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="")}initCallback(){super.initCallback(),this._aspectRatio&&this._updateAspectRatioPresentation(this._aspectRatio),this.sub("*currentAspectRatio",opt=>{this.active=opt&&opt.id===this._aspectRatio?.id||opt?.width===this._aspectRatio?.width&&opt?.height===this._aspectRatio?.height})}onClick(){let currentAspectRatio=this.$["*currentAspectRatio"];currentAspectRatio?.id!==this._aspectRatio?.id&&(this.$["*currentAspectRatio"]=this._aspectRatio)}_updateAspectRatioPresentation(value){let titleText;if(!this.isConnected)return;let isFreeform=!!value.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",isFreeform);let resolveTitleProp=()=>{let label=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:isFreeform?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${value.width}:${value.height}`}).toLowerCase(),value:""});return this.titleProp=label,label};titleText=isFreeform?this.l10n("custom"):`${value.width}:${value.height}`,this.title=titleText,resolveTitleProp(),isFreeform||this.requestUpdate()}_renderIcon(){let width,height,ratio=this._aspectRatio;if(!ratio||ratio.hasFreeform)return(0,lit.qy)`<uc-icon name=${this.icon}></uc-icon>`;let{width:width1,height:height1}=(width=12,height=12,ratio.width/ratio.height>=1?(width=12,height=Math.round(12*ratio.height/ratio.width)):(height=12,width=Math.round(12*ratio.width/ratio.height)),{width,height});return(0,lit.qy)`<uc-icon><svg viewBox="0 0 ${16} ${16}" aria-hidden="true" focusable="false" ><rect x=${(16-width1)/2} y=${(16-height1)/2} width=${width1} height=${height1} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let clickHandler=this.onClick,title=this.title;return(0,lit.qy)`<button role="option" type="button" class=${class_map_e(this.buttonClasses)} aria-label=${this.titleProp??lit_html.s6} title=${this.titleProp??lit_html.s6} @click=${clickHandler} > ${this._renderIcon()} <div class="uc-title" ?hidden=${!title}>${title}</div></button>`}constructor(...args){super(...args),this._aspectRatio=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,lit_decorators.MZ)({attribute:!1})],EditorAspectRatioButtonControl.prototype,"aspectRatio",null);class EditorCropButtonControl extends EditorButtonControl{willUpdate(changedProperties){super.willUpdate(changedProperties),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 cropper=this.$["*cropperEl"],prev=cropper.getValue(this.operation),next=function(operation,prev){if("rotate"===operation){let angle;return(angle=("number"==typeof prev?prev:0)+90)>=360?0:angle}if("mirror"===operation||"flip"===operation)return!prev;throw Error(`Unsupported operation: ${operation}`)}(this.operation,prev);this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:this.operation,next,prev}),cropper.setValue(this.operation,next)}constructor(...args){super(...args),this.operation=void 0}}!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.MZ)({type:String})],EditorCropButtonControl.prototype,"operation",void 0);var style_map=__webpack_require__(5350),env=__webpack_require__(5704),preloadImage=__webpack_require__(6756);let FAKE_ORIGINAL_FILTER="original";class EditorSlider extends LitBlock.x{setOperation(operation,filter){this.state={...this.state,operation,filter},this._initializeValues();let fader=this.$["*faderEl"],originalUrl=this.state.originalUrl||this.$["*originalUrl"];fader&&originalUrl&&fader.activate({url:originalUrl,operation:this.state.operation,value:this.state.filter===FAKE_ORIGINAL_FILTER?void 0:this.state.value,filter:this.state.filter===FAKE_ORIGINAL_FILTER?void 0:this.state.filter,fromViewer:!1})}_initializeValues(){let operation=this.state.operation,{range,zero}=toolbar_constants.UA[operation],[min,max]=range;this.state={...this.state,min,max,zero};let transformation=this.$["*editorTransformations"][operation];if("filter"===operation){let value=Number(max);if(transformation){let{name,amount}=transformation;value=name===this.state.filter?amount:max}this.state={...this.state,value,defaultValue:value};return}let value=void 0!==transformation?transformation:zero;this.state={...this.state,value,defaultValue:value}}apply(){let transformations={...this.$["*editorTransformations"]};"filter"===this.state.operation?this.state.filter&&this.state.filter!==FAKE_ORIGINAL_FILTER?transformations.filter={name:this.state.filter,amount:this.state.value}:delete transformations.filter:transformations[this.state.operation]=this.state.value,this.$["*editorTransformations"]=transformations}cancel(){let fader=this.$["*faderEl"];fader?.deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",originalUrl=>{originalUrl&&(this.state={...this.state,originalUrl})})}updated(changedProperties){if(super.updated(changedProperties),changedProperties.has("state")){let tooltip=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=tooltip}}render(){return(0,lit.qy)`<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>`}constructor(...args){super(...args),this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0},this._handleInput=e=>{let{value}=e.detail,fader=this.$["*faderEl"];fader?.set(value),this.state={...this.state,value}}}}function parseFilterValue(str){if(!str)return null;let match=str.match(/^([A-Za-z]+)\s+(\d+)$/);if(!match)return null;let[,filter,amount]=match;return filter&&void 0!==amount?{filter,value:Number(amount)}:null}function EditorFilterControl_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,lit_decorators.wk)()],EditorSlider.prototype,"state",void 0);class EditorFilterControl extends EditorButtonControl{get filter(){return this._filter}set filter(value){let nextFilter=value??"";if(this._filter===nextFilter)return;let previousValue=this._filter;this._filter=nextFilter,this._operation="filter",this.isOriginal=nextFilter===FAKE_ORIGINAL_FILTER,this.icon=this.isOriginal?"original":"slider",this._iconSize=this.isOriginal?40:20,this.requestUpdate("filter",previousValue),this.isConnected&&this._updateFilterLabels(nextFilter)}onClick(e){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0);else{let slider=this.$["*sliderEl"];slider.setOperation(this._operation,this._filter),slider.apply()}this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:parseFilterValue(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this._filter}_previewSrc(){let cssSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),previewSize=Number.isFinite(cssSize)&&cssSize>0?cssSize:this._iconSize||32,dpr=window.devicePixelRatio,size=Math.ceil(dpr*previewSize),transformations={...this.$["*editorTransformations"]};return transformations[this._operation]=this._filter!==FAKE_ORIGINAL_FILTER?{name:this._filter,amount:100}:void 0,(0,cdn_utils.LN)(this._originalUrl,(0,cdn_utils.$z)(transformationUtils.jO,(0,transformationUtils.ON)(transformations),`quality/${dpr>=2?"lightest":"normal"}`,`scale_crop/${size}x${size}/center`,`@clib/${env.r}/${env.i}/uc-cloud-image-editor/`))}async _observerCallback(entries,observer){let intersectionEntry=entries[0];intersectionEntry?.isIntersecting?await this._loadPreview(observer):this._cancelPreload?.()}initCallback(){super.initCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let originalUrl=this.$["*originalUrl"];this._originalUrl=originalUrl??"",this.sub("*originalUrl",nextUrl=>{this._originalUrl=nextUrl??"",!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",currentFilter=>{this.active=!!(currentFilter&¤tFilter===this._filter)}),this.sub("*networkProblems",async networkProblems=>{networkProblems||(this._previewImage?await this._loadPreview():this._schedulePreviewVisibilityCheck())})}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._cancelPreload?.(),this._clearPreviewVisibilityChecks()}updated(changedProperties){super.updated(changedProperties),changedProperties.has("isOriginal")&&(this.isOriginal?this._observer?.unobserve(this):(this._observer?.observe(this),this._schedulePreviewVisibilityCheck()))}_updateFilterLabels(filterName){if(!filterName){this.titleProp="";return}let label=this.l10n("a11y-cloud-editor-apply-filter",{name:filterName.toLowerCase()});this.titleProp=label}async _loadPreview(observer){if(!this.isConnected){observer?.unobserve(this),this._cancelPreload?.(),this._cancelPreload=void 0;return}if(!this._originalUrl){this._previewVisibilityCheckTimeout||this._previewVisibilityCheckRaf||this._schedulePreviewVisibilityCheck();return}let requestId=++this._lastPreviewRequestId,src="";try{src=await this.proxyUrl(this._previewSrc())}catch(err){this.$["*networkProblems"]=!0,console.error("Failed to resolve preview URL",{error:err});return}this._previewLoaded=!1,this._cancelPreload?.();let{promise,cancel}=(0,preloadImage.N)(src);this._cancelPreload=()=>{cancel(),this._lastPreviewRequestId===requestId&&(this._cancelPreload=void 0)};try{if(await promise,this._lastPreviewRequestId!==requestId||!this.isConnected)return;this._previewImage=src,this._previewLoaded=!0,this._clearPreviewVisibilityChecks(),(observer??this._observer)?.unobserve(this)}catch(err){this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:err}),this._schedulePreviewVisibilityCheck()}finally{this._lastPreviewRequestId===requestId&&(this._cancelPreload=void 0)}}_schedulePreviewVisibilityCheck(){!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal||this.$["*networkProblems"]?this._clearPreviewVisibilityChecks():(this._previewVisibilityCheckRaf&&cancelAnimationFrame(this._previewVisibilityCheckRaf),this._previewVisibilityCheckRaf=requestAnimationFrame(()=>{if(this._previewVisibilityCheckRaf=void 0,!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal)return void this._clearPreviewVisibilityChecks();let rect=this.getBoundingClientRect(),hasSize=rect.width>0&&rect.height>0,viewportWidth=window.innerWidth||document.documentElement.clientWidth,viewportHeight=window.innerHeight||document.documentElement.clientHeight;hasSize&&rect.bottom>0&&rect.right>0&&rect.top<viewportHeight&&rect.left<viewportWidth?this._loadPreview():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 clickHandler=this.onClick,previewStyles={opacity:this._shouldShowPreview?"1":"0"};this._previewImage&&(previewStyles.backgroundImage=`url(${this._previewImage})`);let iconStyles={opacity:this.active||this.isOriginal?"1":"0"};return(0,lit.qy)`<button role="option" type="button" class=${class_map_e(this.buttonClasses)} aria-label=${this.titleProp??lit_html.s6} title=${this.titleProp??lit_html.s6} @click=${clickHandler} ><div class="uc-preview" ?data-loaded=${this._previewLoaded} style=${(0,style_map.W)(previewStyles)}></div><uc-icon class=${class_map_e({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${(0,style_map.W)(iconStyles)} ></uc-icon></button>`}constructor(...args){super(...args),this._operation="",this._filter="",this._originalUrl="",this._lastPreviewRequestId=0,this._previewImage=null,this._previewLoaded=!1,this.isOriginal=!1,this._iconSize=20}}EditorFilterControl_ts_decorate([(0,lit_decorators.wk)()],EditorFilterControl.prototype,"_previewImage",void 0),EditorFilterControl_ts_decorate([(0,lit_decorators.wk)()],EditorFilterControl.prototype,"_previewLoaded",void 0),EditorFilterControl_ts_decorate([(0,lit_decorators.wk)()],EditorFilterControl.prototype,"isOriginal",void 0),EditorFilterControl_ts_decorate([(0,lit_decorators.wk)()],EditorFilterControl.prototype,"_iconSize",void 0),EditorFilterControl_ts_decorate([(0,lit_decorators.MZ)({type:String})],EditorFilterControl.prototype,"filter",null);var throttle=__webpack_require__(3442);function viewerImageSrc(originalUrl,width,transformations){let dpr=window.devicePixelRatio,size=Math.min(Math.ceil(width*dpr),3e3);return(0,cdn_utils.LN)(originalUrl,(0,cdn_utils.$z)(transformationUtils.jO,(0,transformationUtils.ON)(transformations),`quality/${dpr>=2?"lightest":"normal"}`,`stretch/off/-/resize/${size}x`,`@clib/${env.r}/${env.i}/uc-cloud-image-editor/`))}class EditorImageCropper extends LitBlock.x{constructor(){super(),this.ctxOwner=!0,this._imageSize={width:0,height:0},this._ctx=null,this._isActive=!1,this._image=null,this._canvasRef=(0,ref._)(),this._frameRef=(0,ref._)(),this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=(0,debounce.s)(this._commit.bind(this),300),this._handleResizeThrottled=(0,throttle.n)(()=>{this.isConnected&&this._isActive&&(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())},100)}firstUpdated(changedProperties){super.firstUpdated(changedProperties),this._initCanvas()}_syncTransformations(){let pickedTransformations=function(obj,keys){let result={};for(let key of keys){let value=obj[key];(Object.hasOwn(obj,key)||void 0!==value)&&(result[key]=value)}return result}(this.$["*editorTransformations"],Object.keys(this.$["*operations"])),operations={...this.$["*operations"],...pickedTransformations};this.$["*operations"]=operations}_initCanvas(){let canvas=this._canvasRef.value;if(!canvas)return;let ctx=canvas.getContext("2d"),width=this.offsetWidth,height=this.offsetHeight,dpr=window.devicePixelRatio;canvas.style.width=`${width}px`,canvas.style.height=`${height}px`,canvas.width=width*dpr,canvas.height=height*dpr,ctx?.scale(dpr,dpr),this._canvas=canvas,this._ctx=ctx}_alignImage(){let imageBox;if(!this._isActive||!this._image)return;let image=this._image,padding=this.$["*padding"],{rotate}=this.$["*operations"],bounds={width:this.offsetWidth,height:this.offsetHeight},naturalSize=(0,crop_utils.BT)({width:image.naturalWidth,height:image.naturalHeight},rotate);if(naturalSize.width>bounds.width-2*padding||naturalSize.height>bounds.height-2*padding){let imageAspectRatio=naturalSize.width/naturalSize.height;if(imageAspectRatio>bounds.width/bounds.height){let width=bounds.width-2*padding,height=width/imageAspectRatio;imageBox={x:0+padding,y:padding+(bounds.height-2*padding)/2-height/2,width,height}}else{let height=bounds.height-2*padding,width=height*imageAspectRatio;imageBox={x:padding+(bounds.width-2*padding)/2-width/2,y:0+padding,width,height}}}else{let{width,height}=naturalSize;imageBox={x:padding+(bounds.width-2*padding)/2-width/2,y:padding+(bounds.height-2*padding)/2-height/2,width,height}}this.$["*imageBox"]=(0,crop_utils.rH)(imageBox)}_alignCrop(){let cropBox=this.$["*cropBox"],imageBox=this.$["*imageBox"],{rotate}=this.$["*operations"],cropTransformation=this.$["*editorTransformations"].crop,{width:previewWidth,x:previewX,y:previewY}=imageBox;if(cropTransformation){let{dimensions:[width,height],coords:[x,y]}=cropTransformation,{width:sourceWidth}=(0,crop_utils.BT)(this._imageSize,rotate),ratio=previewWidth/sourceWidth;cropBox=(0,crop_utils.YH)((0,crop_utils.rH)({x:previewX+x*ratio,y:previewY+y*ratio,width:width*ratio,height:height*ratio}),imageBox)}let cropPreset=this.$["*currentAspectRatio"],cropAspectRatio=cropPreset?cropPreset.width/cropPreset.height:void 0;if(!(0,crop_utils.Ze)(cropBox,imageBox)||cropAspectRatio&&!(0,crop_utils.n)(cropBox,cropAspectRatio)){let imageAspectRatio=imageBox.width/imageBox.height,width=imageBox.width,height=imageBox.height;cropAspectRatio&&(imageAspectRatio>cropAspectRatio?width=Math.min(imageBox.height*cropAspectRatio,imageBox.width):height=Math.min(imageBox.width/cropAspectRatio,imageBox.height)),cropBox={x:imageBox.x+imageBox.width/2-width/2,y:imageBox.y+imageBox.height/2-height/2,width,height}}this.$["*cropBox"]=(0,crop_utils.YH)((0,crop_utils.rH)(cropBox),imageBox)}_drawImage(){let ctx=this._ctx;if(!ctx)return;let image=this._image;if(!image)return;let imageBox=this.$["*imageBox"],{mirror,flip,rotate}=this.$["*operations"],rotated=(0,crop_utils.BT)({width:imageBox.width,height:imageBox.height},rotate);ctx.save(),ctx.translate(imageBox.x+imageBox.width/2,imageBox.y+imageBox.height/2),ctx.rotate(-(rotate*Math.PI*1)/180),ctx.scale(mirror?-1:1,flip?-1:1),ctx.drawImage(image,-rotated.width/2,-rotated.height/2,rotated.width,rotated.height),ctx.restore()}_draw(){if(!this._isActive||!this._image||!this._canvas||!this._ctx)return;let canvas=this._canvas;this._ctx.clearRect(0,0,canvas.width,canvas.height),this._drawImage()}_animateIn({fromViewer}){this._image&&(this._frameRef.value?.toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=classNames({"uc-active_from_viewer":fromViewer,"uc-active_from_editor":!fromViewer,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let cropBox=this.$["*cropBox"],imageBox=this.$["*imageBox"],{rotate}=this.$["*operations"],{width:previewWidth,height:previewHeight}=imageBox,{width:sourceWidth,height:sourceHeight}=(0,crop_utils.BT)(this._imageSize,rotate),{width:cropWidth,height:cropHeight}=cropBox,ratioW=previewWidth/sourceWidth,ratioH=previewHeight/sourceHeight;return[(0,crop_utils.qE)(Math.round(cropWidth/ratioW),1,sourceWidth),(0,crop_utils.qE)(Math.round(cropHeight/ratioH),1,sourceHeight)]}_getCropTransformation(){let cropBox=this.$["*cropBox"],imageBox=this.$["*imageBox"],{rotate}=this.$["*operations"],{width:previewWidth,height:previewHeight,x:previewX,y:previewY}=imageBox,{width:sourceWidth,height:sourceHeight}=(0,crop_utils.BT)(this._imageSize,rotate),{x:cropX,y:cropY}=cropBox,dimensions=this._getCropDimensions(),crop={dimensions,coords:[(0,crop_utils.qE)(Math.round((cropX-previewX)/(previewWidth/sourceWidth)),0,sourceWidth-dimensions[0]),(0,crop_utils.qE)(Math.round((cropY-previewY)/(previewHeight/sourceHeight)),0,sourceHeight-dimensions[1])]};return!crop||[({dimensions,coords})=>[...dimensions,...coords].every(number=>Number.isInteger(number)&&Number.isFinite(number)),({dimensions,coords})=>dimensions.every(d=>d>0)&&coords.every(c=>c>=0)].every(matcher=>matcher(crop))?dimensions[0]!==sourceWidth||dimensions[1]!==sourceHeight?crop:void 0:void console.error("Cropper is trying to create invalid crop object",{payload:crop})}_commit(){if(!this.isConnected||!this._imageSize)return;let{rotate,mirror,flip}=this.$["*operations"],crop=this._getCropTransformation(),transformations={...this.$["*editorTransformations"],crop,rotate,mirror,flip};this.$["*editorTransformations"]=transformations}setValue(operation,value){this.$["*operations"]={...this.$["*operations"],[operation]:value},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(operation){return this.$["*operations"][operation]}async activate(imageSize,{fromViewer}={}){if(!this._isActive){this._isActive=!0,await this.updateComplete,this._initCanvas(),this._imageSize=imageSize,this.removeEventListener("transitionend",this._reset);try{let originalUrl=this.$["*originalUrl"],transformations=this.$["*editorTransformations"];this._image=await this._waitForImage(originalUrl,transformations),this._syncTransformations(),this._handleResizeThrottled(),this._animateIn({fromViewer})}catch(err){console.error("Failed to activate cropper",{error:err}),this.telemetryManager.sendEventError(err,"cloud editor image. Failed to activate cropper")}this._observer=new ResizeObserver(entries=>{let[entry]=entries;!entry||entry.contentRect.width>0&&entry.contentRect.height>0&&this._isActive&&this._image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset=!1}={}){this._isActive&&(reset||this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=classNames({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this._frameRef.value?.toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),this._observer?.disconnect())}_transitionToCrop(){let dimensions=this._getCropDimensions(),cropBox=this.$["*cropBox"],scale=Math.min(Math.min(this.offsetWidth,dimensions[0])/cropBox.width,Math.min(this.offsetHeight,dimensions[1])/cropBox.height),cropCenterX=cropBox.x+cropBox.width/2,cropCenterY=cropBox.y+cropBox.height/2;this.style.transform=`scale(${scale}) translate(${(this.offsetWidth/2-cropCenterX)/scale}px, ${(this.offsetHeight/2-cropCenterY)/scale}px)`,this.style.transformOrigin=`${cropCenterX}px ${cropCenterY}px`}_transitionToImage(){let cropBox=this.$["*cropBox"],cropCenterX=cropBox.x+cropBox.width/2,cropCenterY=cropBox.y+cropBox.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${cropCenterX}px ${cropCenterY}px`}_reset(){this._isActive||(this._image=null)}async _waitForImage(originalUrl,transformations){let width=this.offsetWidth;transformations={...transformations,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let src=await this.proxyUrl(viewerImageSrc(originalUrl,width,transformations)),{promise,cancel,image}=(0,preloadImage.N)(src),stop=this._handleImageLoading(src);return image.addEventListener("load",stop,{once:!0}),image.addEventListener("error",stop,{once:!0}),this._cancelPreload?.(),this._cancelPreload=cancel,promise.then(()=>image).catch(err=>(console.error("Failed to load image",{error:err}),this.$["*networkProblems"]=!0,image))}_handleImageLoading(src){let operation="crop",loadingOperations=this.$["*loadingOperations"],operationMap=loadingOperations.get(operation);return operationMap||(operationMap=new Map,loadingOperations.set(operation,operationMap)),operationMap.get(src)||(operationMap.set(src,!0),this.$["*loadingOperations"]=loadingOperations),()=>{let map=loadingOperations.get(operation);map?.has(src)&&(map.delete(src),this.$["*loadingOperations"]=loadingOperations)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this._image&&this._commitDebounced()}),this.sub("*currentAspectRatio",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",networkProblems=>{!networkProblems&&this._isActive&&this._imageSize&&this.activate(this._imageSize,{fromViewer:!1})})},0)}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._image&&(this._image=null)}render(){return(0,lit.qy)`<canvas class="uc-canvas" ${(0,ref.K)(this._canvasRef)}></canvas><uc-crop-frame ${(0,ref.K)(this._frameRef)}></uc-crop-frame>`}}function linspace(a,b,n){let lastIndex=n-1,ret=Array(n);for(let i=lastIndex;i>=0;i-=1)ret[i]=Math.ceil((i*b+(lastIndex-i)*a)/lastIndex);return ret}function keypointsRange(operation,value){let n=toolbar_constants.UA[operation].keypointsNumber,{range,zero}=toolbar_constants.UA[operation];return[...new Set([...linspace(range[0],zero,n+1),...linspace(zero,range[1],n+1),zero,value])].sort((a,b)=>a-b)}!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.wk)()],EditorImageCropper.prototype,"_image",void 0);class EditorImageFader extends LitBlock.x{constructor(){super(),this._isActive=!1,this._hidden=!0,this._operation="initial",this._transformations={},this._keypoints=[],this._raf=0,this._previewHostRef=(0,ref._)(),this._layersHostRef=(0,ref._)(),this.classList.add("uc-inactive_to_cropper"),this._addKeypointDebounced=(0,debounce.s)(async(operation,filter,value)=>{let shouldSkip=()=>!this._isSame(operation,filter)||this._value!==value||!!this._keypoints.find(kp=>kp.value===value);if(shouldSkip())return;let keypoint=await this._constructKeypoint(operation,value),image=new Image;image.src=keypoint.src;let stop=this._handleImageLoading(keypoint.src);image.addEventListener("load",stop,{once:!0}),image.addEventListener("error",stop,{once:!0}),keypoint.image=image,image.classList.add("uc-fader-image"),image.addEventListener("load",()=>{if(shouldSkip())return;let keypoints=this._keypoints,insertIndex=keypoints.findIndex(kp=>kp.value>value);-1===insertIndex&&(insertIndex=keypoints.length);let nextKeypoint=keypoints[insertIndex],insertBeforeNode=nextKeypoint?.image,container=this._layersHostRef.value;container&&(!insertBeforeNode||container.contains(insertBeforeNode))&&(keypoints.splice(insertIndex,0,keypoint),insertBeforeNode?container.insertBefore(image,insertBeforeNode):container.appendChild(image),this._update(operation,value))},{once:!0}),image.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})},600)}_handleImageLoading(src){let operation=this._operation,loadingOperations=this.$["*loadingOperations"];loadingOperations.has(operation)||loadingOperations.set(operation,new Map);let operationMap=loadingOperations.get(operation);return operationMap&&!operationMap.get(src)&&(operationMap.set(src,!0),this.$["*loadingOperations"]=loadingOperations),()=>{let currentOperationMap=loadingOperations.get(operation);currentOperationMap?.has(src)&&(currentOperationMap.delete(src),this.$["*loadingOperations"]=loadingOperations)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let kp of this._keypoints){let{image}=kp;image&&(image.style.opacity=kp.opacity.toString(),image.style.zIndex=kp.zIndex.toString())}})}_imageSrc({url=this._url,filter=this._filter??void 0,operation,value}={}){if(!url)throw Error("URL is not defined");let transformations={...this._transformations};operation&&("filter"===operation?filter&&"number"==typeof value&&(transformations.filter={name:filter,amount:value}):"number"==typeof value&&(transformations[operation]=value));let width=this.offsetWidth;return this.proxyUrl(viewerImageSrc(url,width,transformations))}async _constructKeypoint(operation,value){return{src:await this._imageSrc({operation,value}),image:void 0,opacity:0,zIndex:0,value}}_isSame(operation,filter){return this._operation===operation&&this._filter===filter}set(value){var value1;let numericValue="string"==typeof value?parseInt(value,10):value;"string"==typeof(value1=this._operation)&&value1 in toolbar_constants.UA&&Number.isFinite(numericValue)&&(this._update(this._operation,numericValue),this._addKeypointDebounced(this._operation,this._filter,numericValue))}_update(operation,value){this._operation=operation,this._value=value;let{zero}=toolbar_constants.UA[operation],keypointValues=this._keypoints.map(kp=>kp.value),opacities=function(keypoints,value,zero){let section=(function(numbers){let sections=[];for(let idx=0;idx<numbers.length-1;idx+=1){let current=numbers[idx],next=numbers[idx+1];"number"==typeof current&&"number"==typeof next&§ions.push([current,next])}return sections})(keypoints).find(([left,right])=>left<=value&&value<=right);if(!section)return keypoints.map(()=>0);let[left,right]=section;return keypoints.map(point=>{let distance=Math.abs(left-right)||1,relation=Math.abs(value-left)/distance;return left===point?value>zero?1:1-relation:right===point?value>=zero?relation:1:0})}(keypointValues,value,zero),zIndices=keypointValues.map((point,idx)=>point<zero?keypointValues.length-idx:idx);this._keypoints.forEach((kp,idx)=>{let opacity=opacities[idx],zIndex=zIndices[idx];"number"==typeof opacity&&(kp.opacity=opacity),"number"==typeof zIndex&&(kp.zIndex=zIndex)}),this._flush()}_createPreviewImage(){let image=new Image;return image.classList.add("uc-fader-image","uc-fader-image--preview"),image.style.opacity="0",image}async _initNodes(){this._previewImage=this._previewImage||this._createPreviewImage();let previewImage=this._previewImage;previewImage&&this._ensurePreviewAttached(previewImage);let srcList=this._keypoints.map(kp=>kp.src),{images,promise,cancel}=(0,preloadImage.e)(srcList);images.forEach(node=>{let stop=this._handleImageLoading(node.src);node.addEventListener("load",stop),node.addEventListener("error",stop)}),this._cancelLastImages=()=>{cancel(),this._cancelLastImages=void 0};let operation=this._operation,filter=this._filter;if(await promise,this._isActive&&this._isSame(operation,filter)){let host=this._layersHostRef.value;if(!host)return;host.replaceChildren(),this._keypoints.forEach((kp,idx)=>{let kpImage=images[idx];kpImage&&(kpImage.classList.add("uc-fader-image"),kp.image=kpImage,host.appendChild(kpImage))}),this._flush()}}async setTransformations(transformations){if(this._transformations=transformations,this._previewImage){let src=await this._imageSrc(),stop=this._handleImageLoading(src);this._previewImage.src=src,this._previewImage.addEventListener("load",stop,{once:!0}),this._previewImage.addEventListener("error",stop,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url,filter,operation,value}){if(!operation||"number"!=typeof value)return;this._cancelBatchPreload?.();let keypoints=keypointsRange(operation,value),srcList=await Promise.all(keypoints.map(kp=>this._imageSrc({url,filter,operation,value:kp}))),{cancel}=(0,preloadImage.e)(srcList);this._cancelBatchPreload=cancel}_setOriginalSrc(src){let image=this._previewImage||this._createPreviewImage();if(this._ensurePreviewAttached(image),this._previewImage=image,image.src===src){image.style.opacity="1",image.style.transform="scale(1)",this.className=classNames({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}image.style.opacity="0";let stop=this._handleImageLoading(src);image.addEventListener("error",stop,{once:!0}),image.src=src,image.addEventListener("load",()=>{stop(),image&&(image.style.opacity="1",image.style.transform="scale(1)",this.className=classNames({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),image.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url,operation,value,filter,fromViewer}){if(this._isActive=!0,this._hidden=!1,await this.updateComplete,this._url=url,this._operation=operation??"initial",this._value=value,this._filter=filter,this._fromViewer=fromViewer,"number"!=typeof value&&!filter){let src=await this._imageSrc({operation,value});this._setOriginalSrc(src),this._clearLayersHost();return}operation&&"number"==typeof value&&(this._keypoints=await Promise.all(keypointsRange(operation,value).map(keyValue=>this._constructKeypoint(operation,keyValue))),this._update(operation,value),this._initNodes())}deactivate({hide=!0}={}){this._isActive=!1,this._cancelLastImages?.(),this._cancelBatchPreload?.(),hide&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=classNames({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._clearLayersHost()},{once:!0})):this._clearLayersHost()}_ensurePreviewAttached(image){let host=this._previewHostRef.value;host&&(host.contains(image)||host.appendChild(image))}_clearLayersHost(){this._layersHostRef.value?.replaceChildren()}render(){return(0,lit.qy)`<div class="uc-fader-preview-host" ${(0,ref.K)(this._previewHostRef)}></div><div class="uc-fader-layers-host" ${(0,ref.K)(this._layersHostRef)}></div>`}}class EditorOperationControl extends EditorButtonControl{get operation(){return this._operation}set operation(value){let normalizedValue=value??"";if(this._operation===normalizedValue)return;let previousValue=this._operation;this._operation=normalizedValue,this.requestUpdate("operation",previousValue),this.isConnected&&normalizedValue&&this._updateOperationMetadata(normalizedValue)}_updateOperationMetadata(operation){let label;this.icon=operation;let resolveTitle=()=>{let titleText=this.l10n(operation);return this.title=titleText,titleText};label=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(operation).toLowerCase()}),this.titleProp=label,resolveTitle()}initCallback(){super.initCallback(),this._operation&&this._updateOperationMetadata(this._operation),this.sub("*editorTransformations",editorTransformations=>{if(!this._operation)return;let{zero}=toolbar_constants.UA[this._operation],value=editorTransformations[this._operation];this.active=void 0!==value&&value!==zero})}onClick(e){let slider=this.$["*sliderEl"];slider?.setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation,this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:parseFilterValue(this.$["*operationTooltip"])})}constructor(...args){super(...args),this._operation=""}}!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.MZ)({type:String})],EditorOperationControl.prototype,"operation",null);let noopScrollListener=()=>{};class EditorScroller extends LitBlock.x{connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this._handleWheel,{passive:!1}),this.addEventListener("scroll",noopScrollListener,{passive:!0})}disconnectedCallback(){this.removeEventListener("wheel",this._handleWheel),this.removeEventListener("scroll",noopScrollListener),super.disconnectedCallback()}constructor(...args){super(...args),this.hiddenScrollbar=!1,this._handleWheel=event=>{event.preventDefault();let{deltaY,deltaX}=event;if(Math.abs(deltaX)>1){this.scrollLeft+=deltaX;return}this.scrollLeft+=deltaY}}}function EditorToolbar_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,lit_decorators.MZ)({type:Boolean,noAccessor:!0,attribute:"hidden-scrollbar"})],EditorScroller.prototype,"hiddenScrollbar",void 0);class EditorToolbar extends LitBlock.x{_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===toolbar_constants.XB.CROP&&(this.$["*showListAspectRatio"]=!1),this.$["*tabId"]===toolbar_constants.XB.TUNING&&(this._tooltipVisible=!1)}_activateTab(id,{fromViewer=!1,force=!1}={}){this.$["*tabId"]!==id&&(this.$["*tabId"]=id),this._applyTabState(id,{fromViewer,force})}_applyTabState(id,{fromViewer,force=!1}){if(!force&&this.activeTab===id)return void this._syncTabIndicator();this.activeTab=id;let faderEl=this.$["*faderEl"],cropperEl=this.$["*cropperEl"];for(let tabId of(id===toolbar_constants.XB.CROP?(faderEl?.deactivate(),this.$["*imageSize"]&&cropperEl?.activate(this.$["*imageSize"],{fromViewer})):(faderEl?.activate({url:this.$["*originalUrl"],fromViewer}),cropperEl?.deactivate()),toolbar_constants.nz)){let isCurrentTab=tabId===id,toggleRef=this.tabToggleRefs[tabId],toggleEl=toggleRef?.value;toggleEl&&(toggleEl.active=isCurrentTab),isCurrentTab&&this._syncTabIndicator()}}_syncTabIndicator(){let toggleRef=this.tabToggleRefs[this.activeTab],toggleEl=toggleRef?.value,indicatorEl=this._tabIndicatorRef.value;if(!toggleEl||!indicatorEl)return;let offset=toggleEl.offsetLeft,width=toggleEl.offsetWidth||Number(getComputedStyle(toggleEl).width.replace("px",""));(this._tabIndicatorOffset!==offset||this._tabIndicatorWidth!==width)&&(this._tabIndicatorOffset=offset,this._tabIndicatorWidth=width,indicatorEl.style.transform=`translateX(${offset}px)`,indicatorEl.style.width=`${width}px`)}get _hasAspectRatioPicker(){return this._cropPresets.length>=3}_renderControlsByTab(tabId){switch(tabId){case toolbar_constants.XB.CROP:return this._renderCropTabControls();case toolbar_constants.XB.FILTERS:return this._renderFilterTabControls();case toolbar_constants.XB.TUNING:return this._renderTuningTabControls();default:return[]}}_renderCropTabControls(){let renderers=[];if(this._hasAspectRatioPicker)renderers.push(()=>this._renderFreeformControl());else for(let preset of this._cropPresets)renderers.push(()=>this._renderAspectRatioControl(preset));for(let operation of toolbar_constants.Y_)renderers.push(()=>this._renderCropOperationControl(operation));return this._renderControlGroup(renderers)}_renderFilterTabControls(){let renderers=[FAKE_ORIGINAL_FILTER,...toolbar_constants._6].map(filterId=>()=>this._renderFilterControl(filterId));return this._renderControlGroup(renderers)}_renderTuningTabControls(){let renderers=toolbar_constants.DY.map(operation=>()=>this._renderOperationControl(operation));return this._renderControlGroup(renderers)}_renderControlGroup(renderers){return renderers.length?renderers.map(renderControl=>renderControl()):[]}_renderFreeformControl(){return(0,lit.qy)`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}_renderAspectRatioControl(preset){return(0,lit.qy)`<uc-editor-aspect-ratio-button-control .aspectRatio=${preset}></uc-editor-aspect-ratio-button-control>`}_renderCropOperationControl(operation){return(0,lit.qy)`<uc-editor-crop-button-control .operation=${operation}></uc-editor-crop-button-control>`}_renderFilterControl(filterId){return(0,lit.qy)`<uc-editor-filter-control .filter=${filterId}></uc-editor-filter-control>`}_renderOperationControl(operation){return(0,lit.qy)`<uc-editor-operation-control .operation=${operation}></uc-editor-operation-control>`}_renderAspectRatioList(){return this._hasAspectRatioPicker?this._cropPresets.map(preset=>this._renderAspectRatioControl(preset)):[]}async _preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let width=this.$["*imgContainerEl"].offsetWidth,src=await this.proxyUrl(viewerImageSrc(this.$["*originalUrl"],width,this.$["*editorTransformations"]));this._cancelPreload?.();let{cancel}=(0,preloadImage.e)([src]);this._cancelPreload=()=>{cancel(),this._cancelPreload=void 0}}}initCallback(){super.initCallback();let initialCropPresets=this.$["*cropPresetList"]??[];this._cropPresets=[...initialCropPresets],this.sub("*cropPresetList",cropPresetList=>{this._cropPresets=[...cropPresetList??[]]}),this.sub("*imageSize",imageSize=>{imageSize&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",editorTransformations=>{let appliedFilter=editorTransformations?.filter?.name;this.$["*currentFilter"]!==appliedFilter&&(this.$["*currentFilter"]=appliedFilter??"")}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",tabId=>{this._applyTabState(tabId,{fromViewer:!1,force:!0}),this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate()}),this.sub("*editorTransformations",transformations=>{this._preloadEditedImage(),this.$["*faderEl"]?.setTransformations(transformations)}),this.sub("*loadingOperations",loadingOperations=>{let anyLoading=!1;for(let[,mapping]of loadingOperations.entries()){if(anyLoading)break;for(let[,loading]of mapping.entries())if(loading){anyLoading=!0;break}}this._debouncedShowLoader(anyLoading)}),this.sub("*showSlider",showSlider=>{showSlider?(this.showSubToolbar=!0,this.showMainToolbar=!1,this._useSliderPanel=!0):this.$["*showListAspectRatio"]||(this.showSubToolbar=!1,this.showMainToolbar=!0)}),this.sub("*showListAspectRatio",show=>{show?(this.showSubToolbar=!0,this.showMainToolbar=!1,this._useSliderPanel=!1):this.$["*showSlider"]||(this.showSubToolbar=!1,this.showMainToolbar=!0)}),this.sub("*tabList",tabList=>{if(this.tabList=tabList,this._showTabToggles=tabList.length>1,!tabList.includes(this.$["*tabId"])&&tabList.length>0){let[firstTab]=tabList;firstTab&&this._activateTab(firstTab,{fromViewer:!1});return}this._syncTabIndicator()}),this.sub("*operationTooltip",tooltip=>{this._operationTooltip=tooltip}),this._updateInfoTooltip()}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._handleWindowResize)}firstUpdated(changedProperties){super.firstUpdated(changedProperties),this._assignSharedElements(),this._syncTabIndicator()}updated(changedProperties){super.updated(changedProperties),(changedProperties.has("activeTab")||changedProperties.has("tabList"))&&this.updateComplete.then(()=>this._syncTabIndicator()),(changedProperties.has("showSubToolbar")||changedProperties.has("showMainToolbar"))&&this._assignSharedElements()}disconnectedCallback(){window.removeEventListener("resize",this._handleWindowResize),super.disconnectedCallback(),this.$["*showSlider"]=!1,this.$["*showListAspectRatio"]=!1}_assignSharedElements(){let slider=this._sliderRef.value;slider&&(this.$["*sliderEl"]=slider)}_renderTabToggle(id){let isVisible=this.tabList.includes(id),isActive=this.activeTab===id,columnIndex=this.tabList.indexOf(id),style=columnIndex>=0?(0,style_map.W)({gridColumn:`${columnIndex+1}`}):lit.s6;return(0,lit.qy)` <uc-presence-toggle class="uc-tab-toggle" .visible=${isVisible} .styles=${this._tabToggleStyles}><uc-btn-ui theme="tab" data-id=${id} icon=${id} role="tab" aria-controls=${`tab_${id}`} aria-selected=${isActive?"true":"false"} title-prop=${`a11y-editor-tab-${id}`} .active=${isActive} style=${style} @click=${this._handleTabClick} ${(0,ref.K)(this.tabToggleRefs[id])} ></uc-btn-ui></uc-presence-toggle>`}_renderTabContent(id){let controls=this._renderControlsByTab(id);return(0,lit.qy)` <div id=${`tab_${id}`} 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"> ${controls.length?controls:lit.s6} </div></div></uc-editor-scroller></div>`}render(){let tooltipClasses=["uc-info-tooltip",this._tooltipVisible?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),showAspectRatioList=this._hasAspectRatioPicker;return(0,lit.qy)`<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=${tooltipClasses}>${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"> ${toolbar_constants.nz.map(tabId=>{var n,r;return n=this.activeTab===tabId,r=()=>this._renderTabContent(tabId),n?r(n):void 0})} </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" ${(0,ref.K)(this._tabIndicatorRef)} ></div> ${toolbar_constants.nz.map(tabId=>this._renderTabToggle(tabId))} </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 ${(0,ref.K)(this._sliderRef)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this._useSliderPanel||!showAspectRatioList}> ${showAspectRatioList?(0,lit.qy)`<div class="uc-list-aspect-ratio">${this._renderAspectRatioList()}</div>`:lit.s6} </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>`}constructor(...args){super(...args),this._showLoader=!1,this.showMainToolbar=!0,this.showSubToolbar=!1,this._showTabToggles=!0,this.tabList=[...toolbar_constants.nz],this.activeTab=toolbar_constants.XB.CROP,this._useSliderPanel=!0,this._tooltipVisible=!1,this._operationTooltip=null,this._tabIndicatorOffset=0,this._tabIndicatorWidth=0,this._sliderRef=(0,ref._)(),this._tabIndicatorRef=(0,ref._)(),this.tabToggleRefs={[toolbar_constants.XB.CROP]:(0,ref._)(),[toolbar_constants.XB.TUNING]:(0,ref._)(),[toolbar_constants.XB.FILTERS]:(0,ref._)()},this._handleWindowResize=()=>{this._syncTabIndicator()},this._cropPresets=[],this._debouncedShowLoader=(0,debounce.s)(show=>{this._showLoader=show},500),this._updateInfoTooltip=(0,debounce.s)(()=>{let transformations=this.$["*editorTransformations"],currentOperation=this.$["*currentOperation"],text="",visible=!1;if(this.$["*tabId"]===toolbar_constants.XB.FILTERS)if(visible=!0,this.$["*currentFilter"]&&transformations?.filter?.name===this.$["*currentFilter"]){let value=transformations?.filter?.amount||100;text=`${this.$["*currentFilter"]} ${value}`}else text=this.l10n(FAKE_ORIGINAL_FILTER);else if(this.showSubToolbar&&this.$["*tabId"]===toolbar_constants.XB.TUNING&¤tOperation){visible=!0;let value=transformations?.[currentOperation]||toolbar_constants.UA[currentOperation].zero;text=`${this.l10n(currentOperation)} ${value}`}visible&&(this.$["*operationTooltip"]=text),this._tooltipVisible=visible},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":!1,"*showListAspectRatio":!1,"*currentFilter":FAKE_ORIGINAL_FILTER,"*currentOperation":null,"*operationTooltip":null},this._handleCancel=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel"}),this._cancelPreload?.();let onCancel=this.$["*on.cancel"];onCancel?.()},this._handleApply=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply"});let onApply=this.$["*on.apply"];onApply?.(this.$["*editorTransformations"])},this._handleApplySlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply-slider",operation:parseFilterValue(this.$["*operationTooltip"])});let slider=this._sliderRef.value;slider?.apply(),this._onSliderClose()},this._handleCancelSlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel-slider"});let slider=this._sliderRef.value;slider?.cancel(),this._onSliderClose()},this._handleTabClick=e=>{let target=e.currentTarget,id=target?.getAttribute("data-id");id&&(this.telemetryManager.sendEventCloudImageEditor(e,id),this._activateTab(id,{fromViewer:!1}))}}}function BtnUi_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}EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"_showLoader",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"showMainToolbar",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"showSubToolbar",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"_showTabToggles",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"tabList",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"activeTab",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"_useSliderPanel",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"_tooltipVisible",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"_operationTooltip",void 0),EditorToolbar_ts_decorate([(0,lit_decorators.wk)()],EditorToolbar.prototype,"_cropPresets",void 0);class BtnUi extends LitBlock.x{firstUpdated(changed){super.firstUpdated(changed),this._applyReverse(),this._applyThemeClass()}updated(changed){super.updated(changed),changed.has("reverse")&&this._applyReverse(),changed.has("theme")&&this._applyThemeClass()}_applyReverse(){this.style.flexDirection=this.reverse?"row-reverse":""}_applyThemeClass(){this.theme&&"custom"!==this.theme&&(this.className=`uc-${this.theme}`)}get _iconClassMap(){let iconHidden=this._computedIconHidden;return{"uc-icon":!0,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":iconHidden,"uc-icon_single":this._computedIconSingle}}get _computedIconHidden(){return!this.icon}get _computedIconSingle(){return!this.text&&!this._computedIconHidden}render(){return(0,lit.qy)`<button type="button" role=${(this.ariaRole||void 0)??lit_html.s6} aria-controls=${(this.ariaControls||void 0)??lit_html.s6} aria-label=${this.l10n(this.titleProp)??lit_html.s6} title=${this.l10n(this.titleProp)??lit_html.s6} ><uc-icon class=${class_map_e(this._iconClassMap)} name=${(this.icon||void 0)??lit_html.s6} ?hidden=${this._computedIconHidden} ></uc-icon><div class="uc-text">${this.text}</div></button>`}constructor(...args){super(...args),this.text="",this.icon="",this.reverse=!1,this.theme="default",this.ariaRole=void 0,this.ariaControls="",this.titleProp="",this.active=!1}}BtnUi_ts_decorate([(0,lit_decorators.MZ)({type:String})],BtnUi.prototype,"text",void 0),BtnUi_ts_decorate([(0,lit_decorators.MZ)({type:String})],BtnUi.prototype,"icon",void 0),BtnUi_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,reflect:!0})],BtnUi.prototype,"reverse",void 0),BtnUi_ts_decorate([(0,lit_decorators.MZ)({type:String,reflect:!0})],BtnUi.prototype,"theme",void 0),BtnUi_ts_decorate([(0,lit_decorators.MZ)({attribute:"aria-role"})],BtnUi.prototype,"ariaRole",void 0),BtnUi_ts_decorate([(0,lit_decorators.MZ)({attribute:"aria-controls"})],BtnUi.prototype,"ariaControls",void 0),BtnUi_ts_decorate([(0,lit_decorators.MZ)({attribute:"title-prop"})],BtnUi.prototype,"titleProp",void 0),BtnUi_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,noAccessor:!0})],BtnUi.prototype,"active",void 0);class LineLoaderUi extends LitBlock.x{firstUpdated(changedProperties){super.firstUpdated(changedProperties),this.active&&this._start()}updated(changedProperties){super.updated(changedProperties),changedProperties.has("active")&&(this.active?this._start():this._stop())}_start(){let lineEl=this._lineRef.value;if(!lineEl)return;this._isAnimating=!0;let{width}=this.getBoundingClientRect();lineEl.removeEventListener("transitionend",this._handleTransitionEndRight),lineEl.style.transition="transform 1s",lineEl.style.opacity="1",lineEl.style.transform=`translateX(${width}px)`,lineEl.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){let lineEl=this._lineRef.value;lineEl&&(this._isAnimating=!1,lineEl.removeEventListener("transitionend",this._handleTransitionEndRight),this._resetLine(lineEl))}_resetLine(lineEl){lineEl.style.transition="initial",lineEl.style.opacity="0",lineEl.style.transform="translateX(-101%)"}render(){return(0,lit.qy)`<div class="uc-inner"><div class="uc-line" ${(0,ref.K)(this._lineRef)}></div></div>`}constructor(...args){super(...args),this.active=!1,this._lineRef=(0,ref._)(),this._isAnimating=!1,this._handleTransitionEndRight=()=>{let lineEl=this._lineRef.value;lineEl&&(this._resetLine(lineEl),this._isAnimating&&this.active&&this._start())}}}function PresenceToggle_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,lit_decorators.MZ)({type:Boolean,reflect:!0})],LineLoaderUi.prototype,"active",void 0);let DEFAULT_STYLE={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"};class PresenceToggle extends LitBlock.x{set visible(value){this._visible=value,this._handleVisible()}get visible(){return this._visible}set styles(styles){this._styles=styles,this._externalTransitions=!0,this._visibleStyle=styles.visible??DEFAULT_STYLE.visible,this._hiddenStyle=styles.hidden??DEFAULT_STYLE.hidden}get styles(){return this._styles}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",function(element,...args){let mapping=normalize(...args);for(let token of Object.keys(mapping))element.classList.toggle(token,!!mapping[token])}(this,{[DEFAULT_STYLE.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.toggleAttribute("inert",!this._visible)}_dispatchInitialRenderEvent(){this._initialRenderComplete||(this._initialRenderComplete=!0,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:!0,composed:!0})))}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(DEFAULT_STYLE.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1),this._dispatchInitialRenderEvent()},0)}constructor(...args){super(...args),this._visible=!1,this._styles=DEFAULT_STYLE,this._visibleStyle=DEFAULT_STYLE.visible,this._hiddenStyle=DEFAULT_STYLE.hidden,this._externalTransitions=!1,this._initialRenderComplete=!1}}function SliderUi_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}PresenceToggle_ts_decorate([(0,lit_decorators.MZ)({type:Boolean})],PresenceToggle.prototype,"visible",null),PresenceToggle_ts_decorate([(0,lit_decorators.MZ)({attribute:!1})],PresenceToggle.prototype,"styles",null);class SliderUi extends LitBlock.x{constructor(){super(),this._thumbSize=0,this._inputRef=(0,ref._)(),this._thumbRef=(0,ref._)(),this._stepsRef=(0,ref._)(),this.disabled=!1,this.min=0,this.max=100,this.defaultValue=0,this.zero=0,this._currentValue=0,this._handleSliderInput=event=>{event.stopPropagation();let value=this._extractEventValue(event);null!==value&&(this._setCurrentValue(value),this._emitSliderEvent("slider-input",value))},this._handleSliderChange=event=>{event.stopPropagation();let value=this._extractEventValue(event);null!==value&&this._setCurrentValue(value)},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(type,value){this.dispatchEvent(new CustomEvent(type,{detail:{value},bubbles:!0,composed:!0}))}firstUpdated(changedProperties){super.firstUpdated(changedProperties),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 inputEl=this._inputRef.value;inputEl?.addEventListener("focus",this._handleInputFocus),inputEl?.addEventListener("blur",this._handleInputBlur),window.setTimeout(()=>{this._updateValue(this._currentValue)},0)}willUpdate(changedProperties){super.willUpdate(changedProperties),changedProperties.has("defaultValue")&&this.defaultValue!==this._currentValue&&this._setCurrentValue(this.defaultValue),(changedProperties.has("min")||changedProperties.has("max"))&&this.hasUpdated&&(this._updateSteps(),this._updateValue(this._currentValue)),changedProperties.has("zero")&&this.hasUpdated&&this._updateZeroDot(this._currentValue)}_updateValue(value){this._updateZeroDot(value);let range=this.max-this.min;if(0===range)return;let{width}=this.getBoundingClientRect(),offset=100/range*(value-this.min)*(width-this._thumbSize)/100;window.requestAnimationFrame(()=>{let thumbEl=this._thumbRef.value;thumbEl&&(thumbEl.style.transform=`translateX(${offset}px)`)})}_updateZeroDot(value){if(!this._zeroDotEl)return;let range=this.max-this.min;if(0===range)return;this._zeroDotEl.style.opacity=value===this.zero?"0":"1";let{width}=this.getBoundingClientRect(),offset=100/range*(this.zero-this.min)*(width-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl&&(this._zeroDotEl.style.transform=`translateX(${offset}px)`)})}_updateSteps(){let stepsEl=this._stepsRef.value;if(!stepsEl)return;let{width}=stepsEl.getBoundingClientRect(),count=Math.ceil(Math.ceil(width/2)/15)-2;if(this._stepsCount===count)return;let fragment=document.createDocumentFragment(),minorStepEl=document.createElement("div"),borderStepEl=document.createElement("div");minorStepEl.className="uc-minor-step",borderStepEl.className="uc-border-step",fragment.appendChild(borderStepEl);for(let i=0;i<count;i+=1)fragment.appendChild(minorStepEl.cloneNode());fragment.appendChild(borderStepEl.cloneNode());for(let i=0;i<count;i+=1)fragment.appendChild(minorStepEl.cloneNode());fragment.appendChild(borderStepEl.cloneNode());let zeroDotEl=document.createElement("div");zeroDotEl.className="uc-zero-dot",fragment.appendChild(zeroDotEl),this._zeroDotEl=zeroDotEl,stepsEl.innerHTML="",stepsEl.appendChild(fragment),this._stepsCount=count}disconnectedCallback(){super.disconnectedCallback();let inputEl=this._inputRef.value;inputEl?.removeEventListener("focus",this._handleInputFocus),inputEl?.removeEventListener("blur",this._handleInputBlur),this._observer?.disconnect(),this._observer=void 0}_setCurrentValue(value){Number.isFinite(value)&&(this._currentValue=value,this.hasUpdated&&(this._syncInputValue(value),this._updateValue(value)))}_syncInputValue(value){let inputEl=this._inputRef.value;inputEl&&(inputEl.value=String(value))}_extractEventValue(event){let target=event.currentTarget;if(!target)return null;let parsedValue=Number.parseInt(target.value,10);return Number.isFinite(parsedValue)?parsedValue:null}render(){return(0,lit.qy)`<div class="uc-steps" ${(0,ref.K)(this._stepsRef)}></div><div class="uc-thumb" ${(0,ref.K)(this._thumbRef)}></div><input class="uc-input" type="range" ${(0,ref.K)(this._inputRef)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this._currentValue)} ?disabled=${this.disabled} @input=${this._handleSliderInput} @change=${this._handleSliderChange} />`}}SliderUi_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,reflect:!0})],SliderUi.prototype,"disabled",void 0),SliderUi_ts_decorate([(0,lit_decorators.MZ)({type:Number})],SliderUi.prototype,"min",void 0),SliderUi_ts_decorate([(0,lit_decorators.MZ)({type:Number})],SliderUi.prototype,"max",void 0),SliderUi_ts_decorate([(0,lit_decorators.MZ)({type:Number,attribute:!1})],SliderUi.prototype,"defaultValue",void 0),SliderUi_ts_decorate([(0,lit_decorators.MZ)({type:Number})],SliderUi.prototype,"zero",void 0),SliderUi_ts_decorate([(0,lit_decorators.wk)()],SliderUi.prototype,"_currentValue",void 0);var EventEmitter=__webpack_require__(9963);class CloudImageEditor extends CloudImageEditorBlock{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"]}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName}}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:EventEmitter.Kc.INIT_SOLUTION}),this.a11y?.registerBlock(this)}}var Config=__webpack_require__(5642),Icon=__webpack_require__(8610);let editorI18n={en:{"edit-image":"Edit image","edit-detail":"Details","file-item-edit-button":"Edit","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","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}}","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop","cancel-edit":"Cancel edit",back:"Back",apply:"Apply",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",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","tab-view":"Preview","tab-details":"Details"}},cloudImageEditorPlugin={id:"cloud-image-editor",setup:async({pluginApi,uploaderApi})=>{(0,defineComponents.Y)({...cloud_image_editor_namespaceObject,...CloudImageEditorActivity_namespaceObject}),pluginApi.registry.registerIcon({name:"edit-file",svg:"<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>"}),pluginApi.registry.registerI18n(editorI18n),pluginApi.registry.registerFileAction({id:"edit-file",icon:"edit-file",shouldRender:fileEntry=>!!(fileEntry.isSuccess&&fileEntry.isImage&&fileEntry.cdnUrl),onClick:fileEntry=>{uploaderApi.setCurrentActivity?.(activity_constants.g.CLOUD_IMG_EDIT,{internalId:fileEntry.internalId}),uploaderApi.setModalState?.(!0)}}),pluginApi.registry.registerActivity({id:activity_constants.g.CLOUD_IMG_EDIT,render:host=>{let activityEl=document.createElement("uc-cloud-image-editor-activity");return host.append(activityEl),()=>{host.replaceChildren()}}})}}},2061(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{externalSourcesPlugin:()=>externalSourcesPlugin});var _abstract_defineComponents__rspack_import_0=__webpack_require__(3962),_blocks_ExternalSource_ExternalSource__rspack_import_1=__webpack_require__(7860),_lit_activity_constants__rspack_import_2=__webpack_require__(7715),_utils_UploadSource__rspack_import_3=__webpack_require__(5730);let externalSourcesPlugin={id:"external-sources",setup:async({pluginApi,uploaderApi})=>{for(let sourceId of((0,_abstract_defineComponents__rspack_import_0.Y)({ExternalSource:_blocks_ExternalSource_ExternalSource__rspack_import_1.B}),pluginApi.registry.registerActivity({id:_lit_activity_constants__rspack_import_2.g.EXTERNAL,render:host=>{let el=document.createElement("uc-external-source");return host.append(el),()=>{host.replaceChildren()}}}),Object.values(_utils_UploadSource__rspack_import_3.y5)))pluginApi.registry.registerSource({id:sourceId,label:`src-type-${sourceId}`,icon:sourceId,onSelect:()=>{uploaderApi.setCurrentActivity(_lit_activity_constants__rspack_import_2.g.EXTERNAL,{externalSourceType:sourceId}),uploaderApi.setModalState(!0)}})}}},5271(__unused_rspack_module,__webpack_exports__,__webpack_require__){let isApplied;__webpack_require__.d(__webpack_exports__,{imageShrinkPlugin:()=>imageShrinkPlugin});let readJpegChunks=()=>{let stack=[];return{stack,promiseReadJpegChunks:blob=>new Promise((resolve,reject)=>{let pos=2,readToView=(blob,cb)=>{let reader=new FileReader;reader.addEventListener("load",()=>{cb(new DataView(reader.result))}),reader.addEventListener("error",e=>{reject(`Reader error: ${e}`)}),reader.readAsArrayBuffer(blob)},readNext=()=>readToView(blob.slice(pos,pos+128),view=>{let i,j,ref;for(i=j=0,ref=view.byteLength;ref>=0?j<ref:j>ref;i=ref>=0?++j:--j)if(255===view.getUint8(i)){pos+=i;break}readNextChunk()}),readNextChunk=()=>{let startPos=pos;return readToView(blob.slice(pos,pos+=4),view=>{if(4!==view.byteLength||255!==view.getUint8(0))return void reject("Corrupted");let marker=view.getUint8(1);if(218===marker)return void resolve(!0);let length=view.getUint16(2)-2;return readToView(blob.slice(pos,pos+=length),view=>{view.byteLength!==length?reject("Corrupted"):(stack.push({startPos,length,marker,view}),readNext())})})};FileReader&&DataView||reject("Not Support"),readToView(blob.slice(0,2),view=>{65496!==view.getUint16(0)&&reject("Not jpeg"),readNext()})})}},getIccProfile=async blob=>{let iccProfile=[],{promiseReadJpegChunks,stack}=readJpegChunks();return await promiseReadJpegChunks(blob),stack.forEach(({marker,view})=>{226===marker&&0x4943435f===view.getUint32(0)&&0x50524f46===view.getUint32(4)&&0x494c4500===view.getUint32(8)&&iccProfile.push(view)}),iccProfile},replaceJpegChunk=async(blob,marker,chunks)=>{{let oldChunkPos=[],oldChunkLength=[],{promiseReadJpegChunks,stack}=readJpegChunks();await promiseReadJpegChunks(blob),stack.forEach(chunk=>{if(chunk.marker===marker)return oldChunkPos.push(chunk.startPos),oldChunkLength.push(chunk.length)});let newChunks=[blob.slice(0,2)];for(let chunk of chunks){let intro=new DataView(new ArrayBuffer(4));intro.setUint16(0,65280+marker),intro.setUint16(2,chunk.byteLength+2),newChunks.push(intro.buffer),newChunks.push(chunk)}let pos=2;for(let i=0;i<oldChunkPos.length;i++)oldChunkPos[i]>pos&&newChunks.push(blob.slice(pos,oldChunkPos[i])),pos=oldChunkPos[i]+oldChunkLength[i]+4;return newChunks.push(blob.slice(pos,blob.size)),new Blob(newChunks,{type:blob.type})}},replaceIccProfile=(blob,iccProfiles)=>replaceJpegChunk(blob,226,iccProfiles.map(chunk=>chunk.buffer)),stripIccProfile=async blob=>{try{return await replaceIccProfile(blob,[])}catch(e){throw Error(`Failed to strip ICC profile: ${e}`)}},createCanvas=()=>{let canvas=document.createElement("canvas"),ctx=canvas.getContext("2d");return{canvas,ctx}},getExif=async blob=>{let exif=null,{promiseReadJpegChunks,stack}=readJpegChunks();return await promiseReadJpegChunks(blob),stack.forEach(({marker,view})=>{if(!exif&&225===marker&&view.byteLength>=14&&0x45786966===view.getUint32(0)&&0===view.getUint16(4)){exif=view;return}}),exif},replaceExif=async(blob,exif,isExifApplied)=>(isExifApplied&&((exif,exifCallback)=>{let j,little,offset;if(!exif||exif.byteLength<14||0x45786966!==exif.getUint32(0)||0!==exif.getUint16(4))return;if(18761===exif.getUint16(6))little=!0;else{if(19789!==exif.getUint16(6))return;little=!1}if(42!==exif.getUint16(8,little))return;offset=8+exif.getUint32(10,little);let count=exif.getUint16(offset-2,little);for(j=0;count>=0?j<count:j>count;count>=0?++j:--j){if(exif.byteLength<offset+10)return;274===exif.getUint16(offset,little)&&exifCallback(offset+8,little),offset+=12}})(exif,(offset,littleEndian)=>exif.setUint16(offset,1,littleEndian)),replaceJpegChunk(blob,225,[exif.buffer])),allowLayers=[1,3],markers=[192,193,194,195,197,198,199,201,202,203,205,206,207],sizes={squareSide:[Math.floor(Math.sqrt(5e6)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},shouldSkipShrink=async blob=>{let skip=!1,{promiseReadJpegChunks,stack}=readJpegChunks();return await promiseReadJpegChunks(blob).then(()=>(stack.forEach(({marker,view})=>{if(!skip&&markers.indexOf(marker)>=0){let layer=view.getUint8(5);0>allowLayers.indexOf(layer)&&(skip=!0)}}),skip)).catch(()=>skip)},memoize=(fn,serializer)=>{let cache={};return(...args)=>{let key=serializer(args,cache);return key in cache?cache[key]:cache[key]=fn(...args)}},memoKeySerializer=(args,cache)=>{let[w]=args,cachedWidths=Object.keys(cache).map(val=>parseInt(val,10)).sort((a,b)=>a-b);for(let i=0;i<cachedWidths.length;i++){let cachedWidth=cachedWidths[i],isSupported=!!cache[cachedWidth];if(cachedWidth>w&&isSupported||cachedWidth<w&&!isSupported)return cachedWidth}return w},FILL_STYLE=`rgba(55, 110, 165, ${1})`,canvasTest=(width,height)=>{try{let fill=[width-1,height-1,1,1],{canvas:cropCvs,ctx:cropCtx}=createCanvas();cropCvs.width=1,cropCvs.height=1;let{canvas:testCvs,ctx:testCtx}=createCanvas();testCvs.width=width,testCvs.height=height,testCtx&&(testCtx.fillStyle=FILL_STYLE,testCtx.fillRect(...fill),cropCtx.drawImage(testCvs,width-1,height-1,1,1,0,0,1,1));let imageData=cropCtx&&cropCtx.getImageData(0,0,1,1).data,isTestPass=!1;return imageData&&(isTestPass=55===imageData[0]&&110===imageData[1]&&165===imageData[2]&&255===imageData[3]),testCvs.width=testCvs.height=1,isTestPass}catch(e){return console.error(`Failed to test for max canvas size of ${width}x${height}.`),!1}};function wrapAsync(fn){return(...args)=>new Promise(resolve=>{setTimeout(()=>{resolve(fn(...args))},0)})}let squareTest=wrapAsync(memoize(canvasTest,memoKeySerializer)),dimensionTest=wrapAsync(memoize(canvasTest,memoKeySerializer)),testCanvasSize=async(w,h)=>{let testSquareSide=sizes.squareSide.find(side=>side*side>=w*h),testDimension=sizes.dimension.find(side=>side>=w&&side>=h);if(!testSquareSide||!testDimension)throw Error("Not supported");let[squareSupported,dimensionSupported]=await Promise.all([squareTest(testSquareSide,testSquareSide),dimensionTest(testDimension,1)]);if(squareSupported&&dimensionSupported)return!0;throw Error("Not supported")},canvasResize=async(img,w,h)=>{try{let{ctx,canvas}=createCanvas();return canvas.width=w,canvas.height=h,ctx.imageSmoothingQuality="high",ctx.drawImage(img,0,0,w,h),img instanceof HTMLImageElement&&(img.src="//:0"),img instanceof HTMLCanvasElement&&(img.width=img.height=1),canvas}catch(e){throw Error("Canvas resize error",{cause:e})}},calcShrinkSteps=function({sourceW,targetW,targetH,step}){let steps=[],sW=targetW,sH=targetH;do steps.push([sW,sH]),sW=Math.round(sW/step),sH=Math.round(sH/step);while(sW<sourceW*step);return steps.reverse()},isIpadOS=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),shrinkFile=async(inputBlob,settings)=>{try{var image;let image1,type,quality;if(await shouldSkipShrink(inputBlob))throw Error("Should skipped");let exifResults=await Promise.allSettled([getExif(inputBlob),new Promise(resolve=>{if(void 0!==isApplied)resolve(isApplied);else{let image=new Image;image.addEventListener("load",()=>{isApplied=image.naturalWidth<image.naturalHeight,image.src="//:0",resolve(isApplied)}),image.src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k="}}),getIccProfile(inputBlob)]),isJPEG=!exifResults.some(result=>"rejected"===result.status),[exifResult,isExifOrientationAppliedResult,iccProfileResult]=exifResults,inputBlobWithoutIcc=await stripIccProfile(inputBlob).catch(()=>inputBlob),image2=await (image=URL.createObjectURL(inputBlobWithoutIcc),image1=new Image,new Promise((resolve,reject)=>{image&&(image1.src=image),image1.complete?resolve(image1):(image1.addEventListener("load",()=>{resolve(image1)}),image1.addEventListener("error",()=>{reject(Error("Failed to load image. Probably not an image."))}))}));URL.revokeObjectURL(image2.src);let canvas=await ((img,settings)=>{if(.71*img.width*img.height*.71<settings.size)throw Error("Not required");let sourceW=img.width,ratio=sourceW/img.height,targetW=Math.floor(Math.sqrt(settings.size*ratio)),targetH=Math.floor(settings.size/Math.sqrt(settings.size*ratio));return testCanvasSize(targetW,targetH).then(()=>{let{ctx}=createCanvas();return"imageSmoothingQuality"in ctx&&!(/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform))&&!isIpadOS?(({img,targetW,targetH})=>canvasResize(img,targetW,targetH))({img,targetW,targetH}):(({img,sourceW,targetW,targetH,step})=>{let steps=calcShrinkSteps({sourceW,targetW,targetH,step});return steps.reduce((chain,[w,h],idx)=>chain.then(canvas=>testCanvasSize(w,h).then(()=>canvasResize(canvas,w,h)).catch(()=>{if(idx===steps.length-1)throw Error("Not supported");return canvas})),Promise.resolve(img))})({img,sourceW,targetW,targetH,step:.71})}).catch(()=>Promise.reject("Not supported"))})(image2,settings),format="image/jpeg",quality1=settings?.quality||.8;!isJPEG&&(img=>{let{ctx,canvas}=createCanvas();canvas.width=canvas.height=50,ctx.drawImage(img,0,0,50,50);let imageData=ctx.getImageData(0,0,50,50).data;canvas.width=canvas.height=1;for(let i=3;i<imageData.length;i+=4)if(imageData[i]<254)return!0;return!1})(canvas)&&(format="image/png",quality1=void 0);let newBlob=await (type=format,quality=quality1,new Promise((resolve,reject)=>{canvas.toBlob(blob=>{blob?resolve(blob):reject("Failed to convert canvas to blob")},type,quality),canvas.width=canvas.height=1}));if(isJPEG&&"fulfilled"===exifResult.status&&exifResult.value){let exif=exifResult.value,isExifOrientationApplied="fulfilled"===isExifOrientationAppliedResult.status&&isExifOrientationAppliedResult.value;newBlob=await replaceExif(newBlob,exif,isExifOrientationApplied)}return isJPEG&&"fulfilled"===iccProfileResult.status&&iccProfileResult.value.length>0&&(newBlob=await replaceIccProfile(newBlob,iccProfileResult.value)),newBlob}catch(e){let message;throw e instanceof Error&&(message=e.message),"string"==typeof e&&(message=e),Error(`Failed to shrink image. ${message?`Message: "${message}".`:""}`,{cause:e})}},regExpShrink=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,imageShrinkPlugin={id:"image-shrink",setup({pluginApi}){pluginApi.registry.registerFileHook({type:"beforeUpload",handler:async({file,mimeType})=>{let imageShrink=pluginApi.config.get("imageShrink");if(!imageShrink)return{file,mimeType};let settings=(value=>{if("string"!=typeof value)return!1;let terms=regExpShrink.exec(value.toLocaleLowerCase())??[];if(0===terms.length)return!1;let sizeShrink=Number(terms[1])*Number(terms[2]);return sizeShrink>0x10000000?(console.warn(`Shrinked size can not be larger than ${Math.floor(268.435456)}MP. You have set ${terms[1]}x${terms[2]} (${Math.ceil(sizeShrink/1e3/100)/10}MP).`),!1):{quality:terms[3]?Number(terms[3])/100:void 0,size:sizeShrink}})(imageShrink);if(!settings)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file,mimeType};try{let shrunk=await shrinkFile(file,settings);return{file:shrunk,mimeType:shrunk.type||mimeType}}catch{return{file,mimeType}}}})}}},1746(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{instagramPlugin:()=>instagramPlugin});let instagramPlugin={id:"instagram",setup({pluginApi}){pluginApi.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:()=>{}})}}},1938(__unused_rspack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{urlSourcePlugin:()=>urlSourcePlugin});var _abstract_defineComponents__rspack_import_0=__webpack_require__(3962),_blocks_UrlSource_UrlSource__rspack_import_1=__webpack_require__(8130),_lit_activity_constants__rspack_import_2=__webpack_require__(7715);let urlSourcePlugin={id:"url-source",setup:async({pluginApi,uploaderApi})=>{(0,_abstract_defineComponents__rspack_import_0.Y)({UrlSource:_blocks_UrlSource_UrlSource__rspack_import_1.T}),pluginApi.registry.registerActivity({id:_lit_activity_constants__rspack_import_2.g.URL,render:host=>{let el=document.createElement("uc-url-source");return host.append(el),()=>{host.replaceChildren()}}}),pluginApi.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{uploaderApi.setCurrentActivity(_lit_activity_constants__rspack_import_2.g.URL),uploaderApi.setModalState(!0)}})}}},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))}},4434(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Ec:()=>f,W3:()=>u,mN:()=>y});let css_tag_t=globalThis,css_tag_e=css_tag_t.ShadowRoot&&(void 0===css_tag_t.ShadyCSS||css_tag_t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,css_tag_s=Symbol(),css_tag_o=new WeakMap;class css_tag_n{constructor(t,e,o){if(this._$cssResult$=!0,o!==css_tag_s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,s=this.t;if(css_tag_e&&void 0===t){let e=void 0!==s&&1===s.length;e&&(t=css_tag_o.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&css_tag_o.set(s,t))}return t}toString(){return this.cssText}}let c=css_tag_e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let t1,e="";for(let s of t.cssRules)e+=s.cssText;return new css_tag_n("string"==typeof(t1=e)?t1:t1+"",void 0,css_tag_s)})(t):t,{is:reactive_element_i,defineProperty:reactive_element_e,getOwnPropertyDescriptor:reactive_element_h,getOwnPropertyNames:reactive_element_r,getOwnPropertySymbols:reactive_element_o,getPrototypeOf:reactive_element_n}=Object,a=globalThis,reactive_element_c=a.trustedTypes,l=reactive_element_c?reactive_element_c.emptyScript:"",p=a.reactiveElementPolyfillSupport,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},f=(t,s)=>!reactive_element_i(t,s),b={attribute:!0,type:String,converter:u,reflect:!1,useDefault:!1,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){let i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&reactive_element_e(this.prototype,t,h)}}static getPropertyDescriptor(t,s,i){let{get:e,set:r}=reactive_element_h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get:e,set(s){let h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty("elementProperties"))return;let t=reactive_element_n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty("finalized"))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty("properties")){let t=this.properties;for(let i of[...reactive_element_r(t),...reactive_element_o(t)])this.createProperty(i,t[i])}let t=this[Symbol.metadata];if(null!==t){let s=litPropertyMetadata.get(t);if(void 0!==s)for(let[t,i]of s)this.elementProperties.set(t,i)}for(let[t,s]of(this._$Eh=new Map,this.elementProperties)){let i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){let i=[];if(Array.isArray(s))for(let s1 of new Set(s.flat(1/0).reverse()))i.unshift(c(s1));else void 0!==s&&i.push(c(s));return i}static _$Eu(t,s){let i=s.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map;for(let i of this.constructor.elementProperties.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((s,o)=>{if(css_tag_e)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let e of o){let o=document.createElement("style"),n=css_tag_t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){let i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){let h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null}}_$AK(t,s){let i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){let t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;let r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null}}requestUpdate(t,s,i,e=!1,h){if(void 0!==t){let r=this.constructor;if(!1===e&&(h=this[t]),!(((i??=r.getPropertyOptions(t)).hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[s,i]of t){let{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e)}}let t=!1,s=this._$AL;try{(t=this.shouldUpdate(s))?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y.elementProperties=new Map,y.finalized=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push("2.1.2")},3074(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){function isObject(o){return"[object Object]"===Object.prototype.toString.call(o)}__webpack_require__.d(__webpack_exports__,{$t:()=>getUserAgent$1,Be:()=>UploadcareError,Dr:()=>NetworkError,QM:()=>uploadFile,fB:()=>uploadFileGroup,oW:()=>UploadError,op:()=>Queue,p3:()=>CancelError});let SEPARATOR=/\W|_/g;function camelizeArrayItems(array,{ignoreKeys}={ignoreKeys:[]}){return Array.isArray(array)?array.map(item=>camelizeKeys(item,{ignoreKeys})):array}function camelizeKeys(source,{ignoreKeys}={ignoreKeys:[]}){if(Array.isArray(source))return camelizeArrayItems(source,{ignoreKeys});if(!isObject(source))return source;let result={};for(let key of Object.keys(source)){let value=source[key];if(ignoreKeys.includes(key)){result[key]=value;continue}isObject(value)?value=camelizeKeys(value,{ignoreKeys}):Array.isArray(value)&&(value=camelizeArrayItems(value,{ignoreKeys})),result[key.split(SEPARATOR).map((word,index)=>word.charAt(0)[index>0?"toUpperCase":"toLowerCase"]()+word.slice(1)).join("")]=value}return result}function getUserAgent$1({libraryName,libraryVersion,userAgent,publicKey="",integration=""}){let languageName="JavaScript";if("string"==typeof userAgent)return userAgent;if("function"==typeof userAgent)return userAgent({publicKey,libraryName,libraryVersion,languageName,integration});let mainInfo=[libraryName,libraryVersion,publicKey].filter(Boolean).join("/"),additionInfo=[languageName,integration].filter(Boolean).join("; ");return`${mainInfo} (${additionInfo})`}let defaultOptions={factor:2,time:100};class UploadcareError extends Error{}class NetworkError extends UploadcareError{originalProgressEvent;constructor(progressEvent){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,NetworkError.prototype),this.originalProgressEvent=progressEvent}}let onCancel=(signal,callback)=>{signal&&(signal.aborted?Promise.resolve().then(callback):signal.addEventListener("abort",()=>callback(),{once:!0}))};class CancelError extends UploadcareError{isCancel=!0;constructor(message="Request canceled"){super(message),this.name="CancelError",Object.setPrototypeOf(this,CancelError.prototype)}}let DEFAULT_INTERVAL=500,poll=({check,interval=DEFAULT_INTERVAL,timeout,signal})=>new Promise((resolve,reject)=>{let tickTimeoutId,timeoutId;onCancel(signal,()=>{tickTimeoutId&&clearTimeout(tickTimeoutId),reject(new CancelError("Poll cancelled"))}),timeout&&(timeoutId=setTimeout(()=>{tickTimeoutId&&clearTimeout(tickTimeoutId),reject(new CancelError("Timed out"))},timeout));let tick=()=>{try{Promise.resolve(check(signal)).then(result=>{result?(timeoutId&&clearTimeout(timeoutId),resolve(result)):tickTimeoutId=setTimeout(tick,interval)}).catch(error=>{timeoutId&&clearTimeout(timeoutId),reject(error)})}catch(error){timeoutId&&clearTimeout(timeoutId),reject(error)}};tickTimeoutId=setTimeout(tick,0)}),defaultSettings_baseCDN="https://ucarecdn.com",defaultSettings_baseURL="https://upload.uploadcare.com",defaultSettings_multipartMinFileSize=0x1900000,defaultSettings_multipartChunkSize=5242880,defaultSettings_maxConcurrentRequests=4,defaultSettings_pusherKey="79ae88bd931ea68464d9",defaultContentType="application/octet-stream",defaultFilename="original",request=({method,url,data,headers={},signal,onProgress})=>new Promise((resolve,reject)=>{let xhr=new XMLHttpRequest,requestMethod=method?.toUpperCase()||"GET",aborted=!1;xhr.open(requestMethod,url,!0),headers&&Object.entries(headers).forEach(entry=>{let[key,value]=entry;void 0===value||Array.isArray(value)||xhr.setRequestHeader(key,value)}),xhr.responseType="text",onCancel(signal,()=>{aborted=!0,xhr.abort(),reject(new CancelError)}),xhr.onload=()=>{if(200!=xhr.status)reject(Error(`Error ${xhr.status}: ${xhr.statusText}`));else{let headersArray=xhr.getAllResponseHeaders().trim().split(/[\r\n]+/),responseHeaders={};headersArray.forEach(function(line){let parts=line.split(": "),header=parts.shift(),value=parts.join(": ");header&&void 0!==header&&(responseHeaders[header]=value)}),resolve({request:{method:requestMethod,url,data,headers:headers||void 0,signal,onProgress},data:xhr.response,headers:responseHeaders,status:xhr.status})}},xhr.onerror=progressEvent=>{aborted||reject(new NetworkError(progressEvent))},onProgress&&"function"==typeof onProgress&&(xhr.upload.onprogress=event=>{event.lengthComputable?onProgress({isComputable:!0,value:event.loaded/event.total}):onProgress({isComputable:!1})}),data?xhr.send(data):xhr.send()}),isBlob=data=>"u">typeof Blob&&data instanceof Blob,isFile=data=>"u">typeof File&&data instanceof File,isReactNativeAsset=data=>!!data&&"object"==typeof data&&!Array.isArray(data)&&"uri"in data&&"string"==typeof data.uri,isFileData=data=>isBlob(data)||isFile(data)||isReactNativeAsset(data);function buildFormData(options){let formData=new FormData;for(let params of function(options){let params=[];for(let[key,value]of Object.entries(options))!function collectParams(params,inputKey,inputValue){if(Array.isArray(inputValue))for(let value of inputValue)collectParams(params,`${inputKey}[]`,value);else if(inputValue&&"object"==typeof inputValue&&"data"in inputValue&&isFileData(inputValue.data)){let{name,contentType}=inputValue,file=inputValue.data,options=(({name})=>name?[name]:[])({name,contentType});params.push([inputKey,file,...options])}else if(!inputValue||"object"!=typeof inputValue||Array.isArray(inputValue))("string"==typeof inputValue||"number"==typeof inputValue||void 0===inputValue)&&inputValue&¶ms.push([inputKey,inputValue.toString()]);else for(let[key,value]of Object.entries(inputValue))void 0!==value&¶ms.push([`${inputKey}[${key}]`,String(value)])}(params,key,value);return params}(options)){let[key,value,...rest]=params;formData.append(key,value,...rest)}return formData}class UploadError extends UploadcareError{code;request;response;headers;constructor(message,code,request,response,headers){super(),this.name="UploadError",this.message=message,this.code=code,this.request=request,this.response=response,this.headers=headers,Object.setPrototypeOf(this,UploadError.prototype)}}let getUrl=(base,path,query)=>{let url=new URL(base);return url.pathname=(url.pathname+path).replace("//","/"),query&&(url.search=(query=>{let searchParams=new URLSearchParams;for(let[key,value]of Object.entries(query))value&&"object"==typeof value&&!Array.isArray(value)?Object.entries(value).filter(entry=>entry[1]??!1).forEach(entry=>searchParams.set(`${key}[${entry[0]}]`,String(entry[1]))):Array.isArray(value)?value.forEach(val=>{searchParams.append(`${key}[]`,val)}):"string"==typeof value&&value?searchParams.set(key,value):"number"==typeof value&&searchParams.set(key,value.toString());return searchParams.toString()})(query)),url.toString()};function getUserAgent(options){return getUserAgent$1({libraryName:"UploadcareUploadClient",libraryVersion:"6.18.4",...options})}function retryIfFailed(fn,options){let{retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes}=options;return function(fn,options=defaultOptions){let attempts=0;return function runAttempt(fn){let defaultDelayTime=Math.round(options.time*options.factor**attempts);return fn({attempt:attempts,retry:ms=>{let ms1;return(ms1=ms??defaultDelayTime,new Promise(resolve=>setTimeout(resolve,ms1))).then(()=>(attempts+=1,runAttempt(fn)))}})}(fn)}(({attempt,retry})=>fn().catch(error=>{if("response"in error&&error?.code==="RequestThrottledError"&&attempt<retryThrottledRequestMaxTimes)return retry(function(error){let{headers}=error||{};if(!headers||"string"!=typeof headers["retry-after"])return 15e3;let seconds=parseInt(headers["retry-after"],10);return Number.isFinite(seconds)?1e3*seconds:15e3}(error));if(error instanceof NetworkError&&attempt<retryNetworkErrorMaxTimes)return retry((attempt+1)*1e3);throw error}))}let getContentType=file=>{let contentType="";return(isBlob(file)||isFile(file)||isReactNativeAsset(file))&&(contentType=file.type),contentType||defaultContentType},getFileName=file=>{let filename="";return isFile(file)&&file.name?filename=file.name:isBlob(file)?filename="":isReactNativeAsset(file)&&file.name&&(filename=file.name),filename||defaultFilename};function getStoreValue(store){return void 0===store||"auto"===store?"auto":store?"1":"0"}function info(uuid,{publicKey,baseURL=defaultSettings_baseURL,signal,source,integration,userAgent,retryThrottledRequestMaxTimes=1,retryNetworkErrorMaxTimes=3}){return retryIfFailed(()=>request({method:"GET",headers:{"X-UC-User-Agent":getUserAgent({publicKey,integration,userAgent})},url:getUrl(baseURL,"/info/",{jsonerrors:1,pub_key:publicKey,file_id:uuid,source}),signal}).then(({data,headers,request})=>{let response=camelizeKeys(JSON.parse(data));if(!("error"in response))return response;throw new UploadError(response.error.content,response.error.errorCode,request,response,headers)}),{retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes})}function isReadyPoll(uuid,{publicKey,baseURL,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,signal,onProgress}){return poll({check:signal=>info(uuid,{publicKey,baseURL,signal,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes}).then(response=>response.isReady?response:(onProgress&&onProgress({isComputable:!0,value:1}),!1)),signal})}(TypeEnum1=TypeEnum||(TypeEnum={})).Token="token",TypeEnum1.FileInfo="file_info",(Status1=Status||(Status={})).Unknown="unknown",Status1.Waiting="waiting",Status1.Progress="progress",Status1.Error="error",Status1.Success="success";class UploadcareFile{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(fileInfo,{baseCDN=defaultSettings_baseCDN,fileName}={}){let{uuid,s3Bucket}=fileInfo,cdnUrl=getUrl(baseCDN,`${uuid}/`),s3Url=s3Bucket?getUrl(`https://${s3Bucket}.s3.amazonaws.com/`,`${uuid}/${fileInfo.filename}`):null;this.uuid=uuid,this.name=fileName||fileInfo.filename,this.size=fileInfo.size,this.isStored=fileInfo.isStored,this.isImage=fileInfo.isImage,this.mimeType=fileInfo.mimeType,this.cdnUrl=cdnUrl,this.originalFilename=fileInfo.originalFilename,this.imageInfo=fileInfo.imageInfo,this.videoInfo=fileInfo.videoInfo,this.contentInfo=fileInfo.contentInfo,this.metadata=fileInfo.metadata||null,this.s3Bucket=s3Bucket||null,this.s3Url=s3Url,"defaultEffects"in fileInfo&&(this.defaultEffects=fileInfo.defaultEffects)}}var TypeEnum,Status,TypeEnum1,Status1,WebSocket=window.WebSocket;class Events{events=Object.create({});emit(event,data){this.events[event]?.forEach(fn=>fn(data))}on(event,callback){this.events[event]=this.events[event]||[],this.events[event].push(callback)}off(event,callback){callback?this.events[event]=this.events[event].filter(fn=>fn!==callback):this.events[event]=[]}}class Pusher{key;disconnectTime;ws=void 0;queue=[];isConnected=!1;subscribers=0;emmitter=new Events;disconnectTimeoutId=null;constructor(pusherKey,disconnectTime=3e4){this.key=pusherKey,this.disconnectTime=disconnectTime}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let pusherUrl=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new WebSocket(pusherUrl),this.ws.addEventListener("error",error=>{this.emmitter.emit("error",Error(error.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(message=>this.send(message.event,message.data)),this.queue=[]}),this.ws.addEventListener("message",e=>{let data=JSON.parse(e.data.toString());switch(data.event){case"pusher:connection_established":this.emmitter.emit("connected",void 0);break;case"pusher:ping":this.send("pusher:pong",{});break;case"progress":case"success":case"fail":var type,data1;this.emmitter.emit(data.channel,(type=data.event,data1=JSON.parse(data.data),"success"===type?{status:Status.Success,...data1}:"progress"===type?{status:Status.Progress,...data1}:{status:Status.Error,...data1}))}})}}disconnect(){let actualDisconect=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{actualDisconect()},this.disconnectTime):actualDisconect()}send(event,data){let str=JSON.stringify({event,data});this.ws?.send(str)}subscribe(token,handler){this.subscribers+=1,this.connect();let channel=`task-status-${token}`,message={event:"pusher:subscribe",data:{channel}};this.emmitter.on(channel,handler),this.isConnected?this.send(message.event,message.data):this.queue.push(message)}unsubscribe(token){this.subscribers-=1;let channel=`task-status-${token}`;this.emmitter.off(channel),this.isConnected?this.send("pusher:unsubscribe",{channel}):this.queue=this.queue.filter(msg=>msg.data.channel!==channel),0===this.subscribers&&this.disconnect()}onError(callback){return this.emmitter.on("error",callback),()=>this.emmitter.off("error",callback)}}let pusher=null,getPusher=key=>(pusher||(pusher=new Pusher(key,3e4*("u">typeof window))),pusher),memo=new WeakMap,getBlobFromReactNativeAsset=async asset=>{if(memo.has(asset))return memo.get(asset);let blob=await fetch(asset.uri).then(res=>res.blob());return memo.set(asset,blob),blob},getFileSize=async file=>{if(isFile(file)||isBlob(file))return file.size;if(isReactNativeAsset(file))return(await getBlobFromReactNativeAsset(file)).size;throw Error("Unknown file type. Cannot determine file size.")},isUuid=data=>!isFileData(data)&&/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/.test(data),isUrl=data=>{let regExp=RegExp("^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$");return!isFileData(data)&®Exp.test(data)},prepareChunks=async(file,fileSize,chunkSize)=>index=>{let start,end;return end=Math.min((start=chunkSize*index)+chunkSize,fileSize),file.slice(start,end)},uploadMultipart=async(file,{publicKey,fileName,fileSize,baseURL,secureSignature,secureExpire,store,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,contentType,multipartChunkSize=defaultSettings_multipartChunkSize,maxConcurrentRequests=defaultSettings_maxConcurrentRequests,baseCDN,metadata})=>{let progressValues,size=fileSize??await getFileSize(file);return(function(size,{publicKey,contentType,fileName,multipartChunkSize=defaultSettings_multipartChunkSize,baseURL="",secureSignature,secureExpire,store,signal,source="local",integration,userAgent,retryThrottledRequestMaxTimes=1,retryNetworkErrorMaxTimes=3,metadata}){return retryIfFailed(()=>request({method:"POST",url:getUrl(baseURL,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":getUserAgent({publicKey,integration,userAgent})},data:buildFormData({filename:fileName||defaultFilename,size:size,content_type:contentType||defaultContentType,part_size:multipartChunkSize,UPLOADCARE_STORE:getStoreValue(store),UPLOADCARE_PUB_KEY:publicKey,signature:secureSignature,expire:secureExpire,source:source,metadata}),signal}).then(({data,headers,request})=>{let response=camelizeKeys(JSON.parse(data));if(!("error"in response))return response.parts=Object.keys(response.parts).map(key=>response.parts[Number(key)]),response;throw new UploadError(response.error.content,response.error.errorCode,request,response,headers)}),{retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes})})(size,{publicKey,contentType:contentType||=getContentType(file),fileName:fileName||getFileName(file),baseURL,secureSignature,secureExpire,store,signal,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,metadata,multipartChunkSize}).then(async({uuid,parts})=>{let tasks,getChunk=await prepareChunks(file,size,multipartChunkSize);return Promise.all([uuid,(tasks=parts.map((url,index)=>()=>{var totalChunks;return((chunk,url,{publicKey,contentType,onProgress,signal,integration,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes})=>(function(part,url,{contentType,signal,onProgress,retryThrottledRequestMaxTimes=1,retryNetworkErrorMaxTimes=3}){return retryIfFailed(()=>request({method:"PUT",url,data:part,onProgress:onProgress,signal,headers:{"Content-Type":contentType||defaultContentType}}).then(result=>(onProgress&&onProgress({isComputable:!0,value:1}),result)).then(({status})=>({code:status})),{retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes})})(chunk,url,{publicKey,contentType,onProgress,signal,integration,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes}))(getChunk(index),url,{publicKey,contentType,onProgress:(totalChunks=parts.length,onProgress?(progressValues||(progressValues=Array(totalChunks).fill(0)),info=>{info.isComputable&&(progressValues[index]=info.value,onProgress({isComputable:!0,value:progressValues.reduce((sum,next)=>sum+next,0)/totalChunks}))}):void 0),signal,integration,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes})}),new Promise((resolve,reject)=>{let results=[],rejected=!1,settled=tasks.length,forRun=[...tasks],run=()=>{let index=tasks.length-forRun.length,next=forRun.shift();next&&next().then(result=>{rejected||(results[index]=result,(settled-=1)?run():resolve(results))}).catch(error=>{rejected=!0,reject(error)})};for(let i=0;i<maxConcurrentRequests;i++)run()}))])}).then(([uuid])=>(function(uuid,{publicKey,baseURL=defaultSettings_baseURL,source="local",signal,integration,userAgent,retryThrottledRequestMaxTimes=1,retryNetworkErrorMaxTimes=3}){return retryIfFailed(()=>request({method:"POST",url:getUrl(baseURL,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":getUserAgent({publicKey,integration,userAgent})},data:buildFormData({uuid:uuid,UPLOADCARE_PUB_KEY:publicKey,source:source}),signal}).then(({data,headers,request})=>{let response=camelizeKeys(JSON.parse(data));if(!("error"in response))return response;throw new UploadError(response.error.content,response.error.errorCode,request,response,headers)}),{retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes})})(uuid,{publicKey,baseURL,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes})).then(fileInfo=>fileInfo.isReady?fileInfo:isReadyPoll(fileInfo.uuid,{publicKey,baseURL,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,onProgress,signal})).then(fileInfo=>new UploadcareFile(fileInfo,{baseCDN}))};async function uploadFile(data,{publicKey,fileName,baseURL=defaultSettings_baseURL,secureSignature,secureExpire,store,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,contentType,multipartMinFileSize,multipartChunkSize,maxConcurrentRequests,baseCDN=defaultSettings_baseCDN,checkForUrlDuplicates,saveUrlForRecurrentUploads,pusherKey,metadata}){if(isFileData(data)){let fileSize=await getFileSize(data);return((fileSize,multipartMinFileSize=defaultSettings_multipartMinFileSize)=>fileSize>=multipartMinFileSize)(fileSize,multipartMinFileSize)?uploadMultipart(data,{publicKey,contentType,multipartChunkSize,fileSize,fileName,baseURL,secureSignature,secureExpire,store,signal,onProgress,source,integration,userAgent,maxConcurrentRequests,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,baseCDN,metadata}):((file,{publicKey,fileName,baseURL,secureSignature,secureExpire,store,contentType,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,baseCDN,metadata})=>(function(file,{publicKey,fileName,contentType,baseURL=defaultSettings_baseURL,secureSignature,secureExpire,store,signal,onProgress,source="local",integration,userAgent,retryThrottledRequestMaxTimes=1,retryNetworkErrorMaxTimes=3,metadata}){return retryIfFailed(()=>request({method:"POST",url:getUrl(baseURL,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":getUserAgent({publicKey,integration,userAgent})},data:buildFormData({file:{data:file,name:fileName||getFileName(file),contentType:contentType||getContentType(file)},UPLOADCARE_PUB_KEY:publicKey,UPLOADCARE_STORE:getStoreValue(store),signature:secureSignature,expire:secureExpire,source:source,metadata}),signal,onProgress}).then(({data,headers,request})=>{let response=camelizeKeys(JSON.parse(data));if(!("error"in response))return response;throw new UploadError(response.error.content,response.error.errorCode,request,response,headers)}),{retryNetworkErrorMaxTimes,retryThrottledRequestMaxTimes})})(file,{publicKey,fileName,contentType,baseURL,secureSignature,secureExpire,store,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,metadata}).then(({file})=>isReadyPoll(file,{publicKey,baseURL,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,onProgress,signal})).then(fileInfo=>new UploadcareFile(fileInfo,{baseCDN})))(data,{publicKey,fileName,contentType,baseURL,secureSignature,secureExpire,store,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,baseCDN,metadata})}if(isUrl(data))return((sourceUrl,{publicKey,fileName,baseURL,baseCDN,checkForUrlDuplicates,saveUrlForRecurrentUploads,secureSignature,secureExpire,store,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,pusherKey=defaultSettings_pusherKey,metadata})=>Promise.resolve(void getPusher(pusherKey).connect()).then(()=>(function(sourceUrl,{publicKey,baseURL=defaultSettings_baseURL,store,fileName,checkForUrlDuplicates,saveUrlForRecurrentUploads,secureSignature,secureExpire,source="url",signal,integration,userAgent,retryThrottledRequestMaxTimes=1,retryNetworkErrorMaxTimes=3,metadata}){return retryIfFailed(()=>request({method:"POST",headers:{"X-UC-User-Agent":getUserAgent({publicKey,integration,userAgent})},url:getUrl(baseURL,"/from_url/",{jsonerrors:1,pub_key:publicKey,source_url:sourceUrl,store:getStoreValue(store),filename:fileName,check_URL_duplicates:checkForUrlDuplicates?1:void 0,save_URL_duplicates:saveUrlForRecurrentUploads?1:void 0,signature:secureSignature,expire:secureExpire,source:source,metadata}),signal}).then(({data,headers,request})=>{let response=camelizeKeys(JSON.parse(data));if(!("error"in response))return response;throw new UploadError(response.error.content,response.error.errorCode,request,response,headers)}),{retryNetworkErrorMaxTimes,retryThrottledRequestMaxTimes})})(sourceUrl,{publicKey,fileName,baseURL,checkForUrlDuplicates,saveUrlForRecurrentUploads,secureSignature,secureExpire,store,signal,source,integration,userAgent,retryThrottledRequestMaxTimes,metadata})).catch(error=>{let pusher=getPusher(pusherKey);return pusher?.disconnect(),Promise.reject(error)}).then(urlResponse=>urlResponse.type===TypeEnum.FileInfo?urlResponse:((fns,{signal}={})=>{let lastError=null,winnerIndex=null,controllers=fns.map(()=>new AbortController);return onCancel(signal,()=>{controllers.forEach(controller=>controller.abort())}),Promise.all(fns.map((fn,i)=>{let stopRace=()=>{winnerIndex=i,controllers.forEach((controller,index)=>index!==i&&controller.abort())};return Promise.resolve().then(()=>fn({stopRace,signal:controllers[i].signal})).then(result=>(stopRace(),result)).catch(error=>(lastError=error,null))})).then(results=>{if(null!==winnerIndex)return results[winnerIndex];throw lastError})})([({signal})=>(function({token,publicKey,baseURL,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,onProgress,signal}){return poll({check:signal=>(function(token,{publicKey,baseURL=defaultSettings_baseURL,signal,integration,userAgent,retryThrottledRequestMaxTimes=1,retryNetworkErrorMaxTimes=3}={}){return retryIfFailed(()=>request({method:"GET",headers:publicKey?{"X-UC-User-Agent":getUserAgent({publicKey,integration,userAgent})}:void 0,url:getUrl(baseURL,"/from_url/status/",{jsonerrors:1,token}),signal}).then(({data,headers,request})=>{let response=camelizeKeys(JSON.parse(data));if(!("error"in response)||"status"in response&&response.status===Status.Error)return response;throw new UploadError(response.error.content,response.error.errorCode,request,response,headers)}),{retryNetworkErrorMaxTimes,retryThrottledRequestMaxTimes})})(token,{publicKey,baseURL,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,signal}).then(response=>{switch(response.status){case Status.Error:return new UploadError(response.error,response.errorCode);case Status.Waiting:return!1;case Status.Unknown:return new UploadError(`Token "${token}" was not found.`);case Status.Progress:return onProgress&&("unknown"===response.total?onProgress({isComputable:!1}):onProgress({isComputable:!0,value:response.done/response.total})),!1;case Status.Success:return onProgress&&onProgress({isComputable:!0,value:response.done/response.total}),response;default:throw Error("Unknown status")}}),signal})})({token:urlResponse.token,publicKey,baseURL,integration,userAgent,retryThrottledRequestMaxTimes,onProgress,signal}),({signal})=>(({token,pusherKey,signal,onProgress})=>new Promise((resolve,reject)=>{let pusher=getPusher(pusherKey),unsubErrorHandler=pusher.onError(reject),destroy=()=>{unsubErrorHandler(),pusher.unsubscribe(token)};onCancel(signal,()=>{destroy(),reject(new CancelError("pusher cancelled"))}),pusher.subscribe(token,result=>{switch(result.status){case Status.Progress:onProgress&&("unknown"===result.total?onProgress({isComputable:!1}):onProgress({isComputable:!0,value:result.done/result.total}));break;case Status.Success:destroy(),onProgress&&onProgress({isComputable:!0,value:result.done/result.total}),resolve(result);break;case Status.Error:destroy(),reject(new UploadError(result.msg,result.error_code))}})}))({token:urlResponse.token,pusherKey,signal,onProgress})],{signal})).then(result=>{if(result instanceof UploadError)throw result;return result}).then(result=>isReadyPoll(result.uuid,{publicKey,baseURL,integration,userAgent,retryThrottledRequestMaxTimes,onProgress,signal})).then(fileInfo=>new UploadcareFile(fileInfo,{baseCDN})))(data,{publicKey,fileName,baseURL,baseCDN,checkForUrlDuplicates,saveUrlForRecurrentUploads,secureSignature,secureExpire,store,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,pusherKey,metadata});if(isUuid(data))return((uuid,{publicKey,fileName,baseURL,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,baseCDN})=>info(uuid,{publicKey,baseURL,signal,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes}).then(fileInfo=>new UploadcareFile(fileInfo,{baseCDN,fileName})).then(result=>(onProgress&&onProgress({isComputable:!0,value:1}),result)))(data,{publicKey,fileName,baseURL,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,baseCDN});throw TypeError(`File uploading from "${data}" is not supported`)}class UploadcareGroup{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(groupInfo,{baseCDN=defaultSettings_baseCDN}={}){this.uuid=groupInfo.id,this.filesCount=groupInfo.filesCount;let groupFiles=groupInfo.files.filter(Boolean);this.totalSize=Object.values(groupFiles).reduce((acc,file)=>acc+file.size,0),this.isStored=!!groupInfo.datetimeStored,this.isImage=!!Object.values(groupFiles).filter(file=>file.isImage).length,this.cdnUrl=((url,newBase)=>{try{let originalUrl=new URL(url),baseUrl=new URL(newBase);return originalUrl.protocol=baseUrl.protocol,originalUrl.hostname=baseUrl.hostname,originalUrl.port=baseUrl.port,originalUrl.toString()}catch{return url}})(groupInfo.cdnUrl,baseCDN),this.files=groupFiles.map(fileInfo=>new UploadcareFile(fileInfo,{baseCDN})),this.createdAt=groupInfo.datetimeCreated,this.storedAt=groupInfo.datetimeStored}}function uploadFileGroup(data,{publicKey,fileName,baseURL=defaultSettings_baseURL,secureSignature,secureExpire,store,signal,onProgress,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,contentType,multipartChunkSize=defaultSettings_multipartChunkSize,baseCDN=defaultSettings_baseCDN,checkForUrlDuplicates,saveUrlForRecurrentUploads,jsonpCallback}){let progressValues;if(!(data=>{for(let item of data)if(!isFileData(item))return!1;return!0})(data)&&!(data=>{for(let item of data)if(!isUrl(item))return!1;return!0})(data)&&!(data=>{for(let item of data)if(!isUuid(item))return!1;return!0})(data))throw TypeError(`Group uploading from "${data}" is not supported`);let isStillComputable=!0,filesCount=data.length;return Promise.all(data.map((file,index)=>isFileData(file)||isUrl(file)?uploadFile(file,{publicKey,fileName,baseURL,secureSignature,secureExpire,store,signal,onProgress:onProgress?(progressValues||(progressValues=Array(filesCount).fill(0)),info=>{if(!info.isComputable||!isStillComputable){isStillComputable=!1,onProgress({isComputable:!1});return}progressValues[index]=info.value,onProgress({isComputable:!0,value:progressValues.reduce((sum,next)=>sum+next)/filesCount})}):void 0,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes,contentType,multipartChunkSize,baseCDN,checkForUrlDuplicates,saveUrlForRecurrentUploads}).then(fileInfo=>fileInfo.uuid):file)).then(uuids=>(function(uuids,{publicKey,baseURL=defaultSettings_baseURL,jsonpCallback,secureSignature,secureExpire,signal,source,integration,userAgent,retryThrottledRequestMaxTimes=1,retryNetworkErrorMaxTimes=3}){return retryIfFailed(()=>request({method:"POST",headers:{"X-UC-User-Agent":getUserAgent({publicKey,integration,userAgent})},url:getUrl(baseURL,"/group/",{jsonerrors:1}),data:buildFormData({files:uuids,callback:jsonpCallback,pub_key:publicKey,signature:secureSignature,expire:secureExpire,source}),signal}).then(({data,headers,request})=>{let response=camelizeKeys(JSON.parse(data));if(!("error"in response))return response;throw new UploadError(response.error.content,response.error.errorCode,request,response,headers)}),{retryNetworkErrorMaxTimes,retryThrottledRequestMaxTimes})})(uuids,{publicKey,baseURL,jsonpCallback,secureSignature,secureExpire,signal,source,integration,userAgent,retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes}).then(groupInfo=>new UploadcareGroup(groupInfo,{baseCDN})).then(group=>(onProgress&&onProgress({isComputable:!0,value:1}),group)))}class Queue{_concurrency=1;_pending=[];_running=0;_resolvers=new Map;_rejectors=new Map;constructor(concurrency){this._concurrency=concurrency}run(){let tasksLeft=this._concurrency-this._running;for(let i=0;i<tasksLeft;i++){let task=this._pending.shift();if(!task)return;let resolver=this._resolvers.get(task),rejector=this._rejectors.get(task);if(!resolver||!rejector)throw Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,task().finally(()=>{this._resolvers.delete(task),this._rejectors.delete(task),this._running-=1,this.run()}).then(value=>resolver(value)).catch(error=>rejector(error))}}add(task,{autoRun}={autoRun:!0}){return new Promise((resolve,reject)=>{this._resolvers.set(task,resolve),this._rejectors.set(task,reject),this._pending.push(task),autoRun&&this.run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(value){this._concurrency=value,this.run()}get concurrency(){return this._concurrency}}},8504(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Dx:()=>v,KO:()=>h,Rt:()=>r,cN:()=>M,lx:()=>u,mY:()=>p});let{I:t}=__webpack_require__(6752).ge,i=o=>o,r=o=>void 0===o.strings,v=(o,n,e)=>{let l=o._$AA.parentNode,d=void 0===n?o._$AB:n._$AA;if(void 0===e)e=new t(l.insertBefore(document.createComment(""),d),l.insertBefore(document.createComment(""),d),o,o.options);else{let t=e._$AB.nextSibling,n=e._$AM,c=n!==o;if(c){let t;e._$AQ?.(o),e._$AM=o,void 0!==e._$AP&&(t=o._$AU)!==n._$AU&&e._$AP(t)}if(t!==d||c){let o=e._$AA;for(;o!==t;){let t=i(o).nextSibling;i(l).insertBefore(o,d),o=t}}}return e},u=(o,t,i=o)=>(o._$AI(t,i),o),m={},p=(o,t=m)=>o._$AH=t,M=o=>o._$AH,h=o=>{o._$AR(),o._$AA.remove()}},7804(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{OA:()=>t,WL:()=>i,u$:()=>e});let t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},6752(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{XX:()=>D,c0:()=>E,ge:()=>j,qy:()=>b,s6:()=>A});let t=globalThis,i=t=>t,s=t.trustedTypes,e=s?s.createPolicy("lit-html",{createHTML:t=>t}):void 0,h="$lit$",o=`lit$${Math.random().toFixed(9).slice(2)}$`,n="?"+o,r=`<${n}>`,l=document,c=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,d=t=>u(t)||"function"==typeof t?.[Symbol.iterator],f="[ \n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^
|
|
8
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=(x(2),x(3),Symbol.for("lit-noChange")),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e?e.createHTML(i):i}let N=(t,i)=>{let s=t.length-1,e=[],n,l=2===i?"<svg>":3===i?"<math>":"",c=v;for(let i=0;i<s;i++){let s=t[i],a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,null!==(u=c.exec(s)));)f=c.lastIndex,c===v?"!--"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p):void 0!==u[3]&&(c=p):c===p?">"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);let x=c===p&&t[i+1].startsWith("/>")?" ":"";l+=c===v?s+r:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o+x):s+o+(-2===d?i:x)}return[V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0,u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){let t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(let t of r.getAttributeNames())if(t.endsWith(h)){let i=v[a++],s=r.getAttribute(t).split(o),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t)}else t.startsWith(o)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){let t=r.textContent.split(o),i=t.length-1;if(i>0){r.textContent=s?s.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c())}}}else if(8===r.nodeType)if(r.data===n)d.push({type:2,index:l});else{let t=-1;for(;-1!==(t=r.data.indexOf(o,t+1));)d.push({type:7,index:l}),t+=o.length-1}l++}}static createElement(t,i){let s=l.createElement("template");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl,o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t))._$AT(t,s,e),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,!0);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n]}o!==r?.index&&(h=P.nextNode(),o++)}return P.currentNode=l,e}p(t){let i=0;for(let s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){a(t=M(this,t,i))?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t}$(t){let{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else{let t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,s,e=0;for(let h of t)e===i.length?i.push(s=new k(this.O(c()),this.O(c()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){let s=i(t).nextSibling;i(t).remove(),t=s}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A}_$AI(t,i=this,s,e){let h=this.strings,o=!1;if(void 0===h)(o=!a(t=M(this,t,i,0))||t!==this._$AH&&t!==E)&&(this._$AH=t);else{let n,r,e=t;for(t=h[0],n=0;n<h.length-1;n++)(r=M(this,e[s+n],i,n))===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r}o&&!e&&this.j(t)}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class I extends H{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===A?void 0:t}}class L extends H{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A)}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;let s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}let j={M:h,P:o,A:n,C:1,L:N,R,D:d,V:M,I:k,H,N:L,U:z,B:I,F:Z},B=t.litHtmlPolyfillSupport;B?.(S,k),(t.litHtmlVersions??=[]).push("3.3.2");let D=(t,i,s)=>{let e=s?.renderBefore??i,h=e._$litPart$;if(void 0===h){let t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c(),t),t,void 0,s??{})}return h._$AI(t),h}},7093(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{wk:()=>state_r,MZ:()=>property_n});var reactive_element=__webpack_require__(4434);let property_o={attribute:!0,type:String,converter:reactive_element.W3,reflect:!1,hasChanged:reactive_element.Ec};function property_n(t){return(e,o)=>{let r;return"object"==typeof o?((t=property_o,e,r)=>{let{kind:n,metadata:i}=r,s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=!0),s.set(r.name,t),"accessor"===n){let{name:o}=r;return{set(r){let n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,!0,r)},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){let{name:o}=r;return function(r){let n=this[o];e.call(this,r),this.requestUpdate(o,n,t,!0,r)}}throw Error("Unsupported decorator location: "+n)})(t,e,o):(r=e.hasOwnProperty(o),e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0)}}function state_r(r){return property_n({...r,state:!0,attribute:!1})}},2258(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{K:()=>ref_n,_:()=>ref_e});var lit_html=__webpack_require__(6752),directive_helpers=__webpack_require__(8504),directive=__webpack_require__(7804);let async_directive_s=(i,t)=>{let e=i._$AN;if(void 0===e)return!1;for(let i of e)i._$AO?.(t,!1),async_directive_s(i,t);return!0},o=i=>{let t,e;do{if(void 0===(t=i._$AM))break;(e=t._$AN).delete(i),i=t}while(0===e?.size)},async_directive_r=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(void 0===e)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),c(t)}};function async_directive_h(i){void 0!==this._$AN?(o(this),this._$AM=i,async_directive_r(this)):this._$AM=i}function n(i,t=!1,e=0){let r=this._$AH,h=this._$AN;if(void 0!==h&&0!==h.size)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)async_directive_s(r[i],!1),o(r[i]);else null!=r&&(async_directive_s(r,!1),o(r));else async_directive_s(this,i)}let c=i=>{i.type==directive.OA.CHILD&&(i._$AP??=n,i._$AQ??=async_directive_h)};class f extends directive.WL{constructor(){super(...arguments),this._$AN=void 0}_$AT(i,t,e){super._$AT(i,t,e),async_directive_r(this),this.isConnected=i._$AU}_$AO(i,t=!0){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(async_directive_s(this,i),o(this))}setValue(t){if((0,directive_helpers.Rt)(this._$Ct))this._$Ct._$AI(t,this);else{let i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}}let ref_e=()=>new ref_h;class ref_h{}let ref_o=new WeakMap,ref_n=(0,directive.u$)(class extends f{render(i){return lit_html.s6}update(i,[s]){let e=s!==this.G;return e&&void 0!==this.G&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=s,this.ht=i.options?.host,this.rt(this.ct=i.element)),lit_html.s6}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){let i=this.ht??globalThis,s=ref_o.get(i);void 0===s&&(s=new WeakMap,ref_o.set(i,s)),void 0!==s.get(this.G)&&this.G.call(this.ht,void 0),s.set(this.G,t),void 0!==t&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){return"function"==typeof this.G?ref_o.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}})},5350(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{W:()=>o});var lit_html=__webpack_require__(6752),directive=__webpack_require__(7804);let n="important",i=" !"+n,o=(0,directive.u$)(class extends directive.WL{constructor(t){if(super(t),t.type!==directive.OA.ATTRIBUTE||"style"!==t.name||t.strings?.length>2)throw Error("The`styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,r)=>{let s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[r]){let{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(let t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(let t in r){let e=r[t];if(null!=e){this.ft.add(t);let r="string"==typeof e&&e.endsWith(i);t.includes("-")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:""):s[t]=e}}return lit_html.c0}})},640(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{T:()=>unsafe_svg_o});var directive=__webpack_require__(7804),lit_html=__webpack_require__(6752);class e extends directive.WL{constructor(i){if(super(i),this.it=lit_html.s6,i.type!==directive.OA.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===lit_html.s6||null==r)return this._t=void 0,this.it=r;if(r===lit_html.c0)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;let s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1,(0,directive.u$)(e);class t extends e{}t.directiveName="unsafeSVG",t.resultType=2;let unsafe_svg_o=(0,directive.u$)(t)},7825(__unused_rspack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{s6:()=>lit_html.s6,qy:()=>lit_html.qy,WF:()=>i});var reactive_element=__webpack_require__(4434),lit_html=__webpack_require__(6752);let s=globalThis;class i extends reactive_element.mN{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,lit_html.XX)(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return lit_html.c0}}i._$litElement$=!0,i.finalized=!0,s.litElementHydrateSupport?.({LitElement:i});let o=s.litElementPolyfillSupport;o?.({LitElement:i}),(s.litElementVersions??=[]).push("4.2.2")}},__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}__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__.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})};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,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__(7560),lit=__webpack_require__(7825),CssDataMixin=__webpack_require__(3361),LightDomMixin=__webpack_require__(7337),RegisterableElementMixin=__webpack_require__(3282),SymbioteCompatMixin=__webpack_require__(9962);class BaseComponent extends(0,RegisterableElementMixin.d)((0,SymbioteCompatMixin.w)()((0,CssDataMixin.N)((0,LightDomMixin.Q)(lit.WF)))){}var UID=__webpack_require__(5446),defineComponents=__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.Y)(blocks),resolve(blocks)},document.head.appendChild(script)})}var localeRegistry=__webpack_require__(7444),ModalManager=__webpack_require__(3076),toKebabCase=__webpack_require__(2402),LitBlock=__webpack_require__(8288),unsafe_svg=__webpack_require__(640),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,lit.qy)`${(0,unsafe_svg.T)("<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)(lit.WF)){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),lit_decorators=__webpack_require__(7093),ref=__webpack_require__(2258);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,lit.qy)`<dialog ${(0,ref.K)(this._handleDialogRef)}> ${this.yield("")} </dialog>`}constructor(...args){super(...args),this.dialogEl=(0,ref._)(),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,lit_decorators.MZ)({type:Boolean,noAccessor:!0})],Modal.prototype,"strokes",void 0),_ts_decorate([(0,lit_decorators.MZ)({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,lit_decorators.MZ)({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,lit.qy)`<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,lit.qy)`<div ${(0,ref.K)(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._)(),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,lit_decorators.MZ)({type:Boolean,noAccessor:!0})],ProgressBar.prototype,"hasFileName",void 0),ProgressBar_ts_decorate([(0,lit_decorators.MZ)({type:Number})],ProgressBar.prototype,"value",void 0),ProgressBar_ts_decorate([(0,lit_decorators.MZ)({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,lit.qy)`<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,lit_decorators.wk)()],ProgressBarCommon.prototype,"_visible",void 0),ProgressBarCommon_ts_decorate([(0,lit_decorators.wk)()],ProgressBarCommon.prototype,"_value",void 0);class Select extends LitBlock.x{render(){return(0,lit.qy)` <select @change=${this._handleChange} .value=${this.value} ?disabled=${this.disabled}> ${this.options.map(option=>(0,lit.qy)`<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,lit_decorators.MZ)({type:String,attribute:!1})],Select.prototype,"value",void 0),Select_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,reflect:!0})],Select.prototype,"disabled",void 0),Select_ts_decorate([(0,lit_decorators.MZ)({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,lit.qy)`<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,lit_decorators.MZ)({attribute:!1})],SourceBtn.prototype,"source",void 0),SourceBtn_ts_decorate([(0,lit_decorators.wk)()],SourceBtn.prototype,"_iconName",void 0),SourceBtn_ts_decorate([(0,lit_decorators.wk)()],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,lit.qy)`${this._sources.map(source=>(0,lit.qy)`<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,lit_decorators.wk)()],SourceList.prototype,"_sources",void 0),SourceList_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,attribute:"wrap",noAccessor:!0})],SourceList.prototype,"wrap",void 0);class Spinner extends LitBlock.x{render(){return(0,lit.qy)`<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,lit.qy)`<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,lit_decorators.MZ)({type:String})],Thumb.prototype,"badgeIcon",void 0),Thumb_ts_decorate([(0,lit_decorators.MZ)({attribute:!1})],Thumb.prototype,"uid",void 0),Thumb_ts_decorate([(0,lit_decorators.wk)()],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,lit.qy)`<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),lit_html=__webpack_require__(6752),directive=__webpack_require__(7804),directive_helpers=__webpack_require__(8504);let u=(e,s,t)=>{let r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},repeat_c=(0,directive.u$)(class extends directive.WL{constructor(e){if(super(e),e.type!==directive.OA.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);let l=[],o=[],i=0;for(let s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return{values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){let d=(0,directive_helpers.cN)(s),{values:p,keys:a}=this.dt(t,r,c);if(!Array.isArray(d))return this.ut=a,p;let h=this.ut??=[],v=[],m,y,x=0,j=d.length-1,k=0,w=p.length-1;for(;x<=j&&k<=w;)if(null===d[x])x++;else if(null===d[j])j--;else if(h[x]===a[k])v[k]=(0,directive_helpers.lx)(d[x],p[k]),x++,k++;else if(h[j]===a[w])v[w]=(0,directive_helpers.lx)(d[j],p[w]),j--,w--;else if(h[x]===a[w])v[w]=(0,directive_helpers.lx)(d[x],p[w]),(0,directive_helpers.Dx)(s,v[w+1],d[x]),x++,w--;else if(h[j]===a[k])v[k]=(0,directive_helpers.lx)(d[j],p[k]),(0,directive_helpers.Dx)(s,d[x],d[j]),j--,k++;else if(void 0===m&&(m=u(a,k,w),y=u(h,x,j)),m.has(h[x]))if(m.has(h[j])){let e=y.get(a[k]),t=void 0!==e?d[e]:null;if(null===t){let e=(0,directive_helpers.Dx)(s,d[x]);(0,directive_helpers.lx)(e,p[k]),v[k]=e}else v[k]=(0,directive_helpers.lx)(t,p[k]),(0,directive_helpers.Dx)(s,d[x],t),d[e]=null;k++}else(0,directive_helpers.KO)(d[j]),j--;else(0,directive_helpers.KO)(d[x]),x++;for(;k<=w;){let e=(0,directive_helpers.Dx)(s,v[w+1]);(0,directive_helpers.lx)(e,p[k]),v[k++]=e}for(;x<=j;){let e=d[x++];null!==e&&(0,directive_helpers.KO)(e)}return this.ut=a,(0,directive_helpers.mY)(s,v),lit_html.c0}});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,lit.qy)`<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,lit.qy)`<span>${this.l10n("no-files")}</span>`)} </div><div class="uc-files"><div class="uc-files-wrapper"> ${repeat_c(this.$["*uploadList"]??[],({uid})=>uid,({uid})=>(0,lit.qy)`<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,lit_decorators.wk)()],UploadList.prototype,"_doneBtnVisible",void 0),UploadList_ts_decorate([(0,lit_decorators.wk)()],UploadList.prototype,"_doneBtnEnabled",void 0),UploadList_ts_decorate([(0,lit_decorators.wk)()],UploadList.prototype,"_uploadBtnVisible",void 0),UploadList_ts_decorate([(0,lit_decorators.wk)()],UploadList.prototype,"_addMoreBtnVisible",void 0),UploadList_ts_decorate([(0,lit_decorators.wk)()],UploadList.prototype,"_addMoreBtnEnabled",void 0),UploadList_ts_decorate([(0,lit_decorators.wk)()],UploadList.prototype,"_commonErrorMessage",void 0),UploadList_ts_decorate([(0,lit_decorators.wk)()],UploadList.prototype,"_hasFiles",void 0),UploadList_ts_decorate([(0,lit_decorators.wk)()],UploadList.prototype,"_latestSummary",void 0);var UrlSource=__webpack_require__(8130),CameraSource=__webpack_require__(4252),Config=__webpack_require__(5642);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,lit.qy)` ${this.yield("",(0,lit.qy)`<div data-default-slot hidden></div><div ${(0,ref.K)(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._)(),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,lit_decorators.MZ)({type:Boolean,noAccessor:!0})],DropArea.prototype,"single",void 0),DropArea_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,noAccessor:!0})],DropArea.prototype,"ghost",void 0),DropArea_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,reflect:!0})],DropArea.prototype,"disabled",void 0),DropArea_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,reflect:!0})],DropArea.prototype,"clickable",void 0),DropArea_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,attribute:"with-icon",reflect:!0})],DropArea.prototype,"withIcon",void 0),DropArea_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,reflect:!0})],DropArea.prototype,"fullscreen",void 0),DropArea_ts_decorate([(0,lit_decorators.MZ)({type:Boolean,reflect:!0})],DropArea.prototype,"initflow",void 0),DropArea_ts_decorate([(0,lit_decorators.MZ)({type:String})],DropArea.prototype,"text",void 0),DropArea_ts_decorate([(0,lit_decorators.wk)()],DropArea.prototype,"_isEnabled",void 0),DropArea_ts_decorate([(0,lit_decorators.wk)()],DropArea.prototype,"_isVisible",void 0);var ExternalSource=__webpack_require__(7860),index_browser=__webpack_require__(3074);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,lit.qy)`<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,lit.qy)`<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,index_browser.QM)(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 index_browser.p3&&cause.isCancel?entry.setMultipleValues({isUploading:!1,uploadProgress:0}):cause instanceof index_browser.Be?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,lit_decorators.wk)()],FileItem.prototype,"_pauseRender",void 0),FileItem_ts_decorate([(0,lit_decorators.MZ)({attribute:!1})],FileItem.prototype,"uid",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_itemName",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_errorText",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_hint",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_progressValue",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_progressVisible",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_badgeIcon",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_isFinished",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_isFailed",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_isUploading",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_isFocused",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_showFileNames",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],FileItem.prototype,"_ariaLabelStatusFile",void 0),FileItem_ts_decorate([(0,lit_decorators.wk)()],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,lit.qy)`<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,lit_decorators.MZ)({attribute:"dropzone",type:Boolean})],SimpleBtn.prototype,"dropzone",void 0),SimpleBtn_ts_decorate([(0,lit_decorators.wk)()],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,lit.qy)`<div style="display: flex; flex-direction: column; width: 100%; min-height: 0;" ${(0,ref.K)(this._containerRef)} ></div>`}constructor(...args){super(...args),this.activityType=null,this._containerRef=(0,ref._)()}}PluginActivityRenderer_ts_decorate([(0,lit_decorators.MZ)({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,lit.qy)`${repeat_c(this._activities,activity=>activity.id,activity=>(0,lit.qy)`<uc-plugin-activity-host .registration=${activity}></uc-plugin-activity-host>`)}`:(0,lit.qy)`${repeat_c(this._activities,activity=>activity.id,activity=>(0,lit.qy)`<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,lit_decorators.MZ)({type:String})],PluginActivityRenderer.prototype,"mode",void 0),PluginActivityRenderer_ts_decorate([(0,lit_decorators.wk)()],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,lit.qy)`${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,lit_decorators.MZ)({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,lit.qy)`${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,lit_decorators.wk)()],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,lit.qy)`${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,lit_decorators.wk)()],FileUploaderMinimal.prototype,"_singleUpload",void 0),FileUploaderMinimal_ts_decorate([(0,lit_decorators.wk)()],FileUploaderMinimal.prototype,"_isHiddenStartFrom",void 0),FileUploaderMinimal_ts_decorate([(0,lit_decorators.wk)()],FileUploaderMinimal.prototype,"_classUploadList",void 0),FileUploaderMinimal_ts_decorate([(0,lit_decorators.wk)()],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
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.28.0-alpha.667 (MIT)
|
|
4
|
+
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
+
* Built: 2026-03-26T10:53:53.997Z
|
|
6
|
+
*/
|
|
7
|
+
var $s=Object.defineProperty;var Il=Object.getOwnPropertyDescriptor;var Ds=(o,i)=>{for(var t in i)$s(o,t,{get:i[t],enumerable:true});};var p=(o,i,t,e)=>{for(var r=e>1?void 0:e?Il(i,t):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&$s(i,t,r),r};var At=[],Yt=0,_i=4,Fs=o=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Yt+_i;s<At.length;)At[s]===e?At.splice(s,_i):s+=_i;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!At.length;for(let n of i)At.push(n,t.value,e,r);if(s){for(Yt=0;Yt<At.length;Yt+=_i)At[Yt](At[Yt+1],At[Yt+2],At[Yt+3]);At.length=0;}},off(){},set(e){let r=t.value;r!==e&&(t.value=e,t.notify(r));},subscribe(e){let r=t.listen(e);return e(t.value),r},value:o};return t};function zi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}function po(o,i,t){let e=zi(o,i,t);return t(o.value),e}var ho=(o={})=>{let i=Fs(o);return i.setKey=function(t,e){let r=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(r,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(r,t));},i};var H=class o{static{this.Gt=new Map;}constructor(i,t){this.J=i,this.ae=t;}get id(){return this.J}pub(i,t){i in this.ae.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.ae.setKey(i,t);}sub(i,t,e=true){return (e?po:zi)(this.ae,[i],s=>{t(s[i]);})}read(i){return i in this.ae.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.ae.get()[i]}add(i,t,e=false){(!(i in this.ae.get())||e)&&this.ae.setKey(i,t);}has(i){return i in this.ae.get()}get store(){return this.ae.get()}static registerCtx(i,t){if(o.Gt.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=ho(i);return o.Gt.set(t,e),new o(t,e)}static deleteCtx(i){o.Gt.delete(i);}static getCtx(i){let t=o.Gt.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Gt.has(i)}};var Bi=globalThis,Ki=Bi.ShadowRoot&&(Bi.ShadyCSS===void 0||Bi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ns=Symbol(),Vs=new WeakMap,Hi=class{constructor(i,t,e){if(this.xc=true,e!==Ns)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t;}get styleSheet(){let i=this.o,t=this.t;if(Ki&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Vs.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Vs.set(t,i));}return i}toString(){return this.cssText}},_s=o=>new Hi(typeof o=="string"?o:o+"",void 0,Ns);var zs=(o,i)=>{if(Ki)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Bi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},fo=Ki?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return _s(t)})(o):o;var{is:Pl,defineProperty:Ll,getOwnPropertyDescriptor:Ul,getOwnPropertyNames:Rl,getOwnPropertySymbols:$l,getPrototypeOf:Dl}=Object,ji=globalThis,Bs=ji.trustedTypes,Fl=Bs?Bs.emptyScript:"",Vl=ji.reactiveElementPolyfillSupport,oi=(o,i)=>o,si={toAttribute(o,i){switch(i){case Boolean:o=o?Fl:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o);}return o},fromAttribute(o,i){let t=o;switch(i){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o);}catch{t=null;}}return t}},Gi=(o,i)=>!Pl(o,i),Hs={attribute:true,type:String,converter:si,reflect:false,useDefault:false,hasChanged:Gi};Symbol.metadata??=Symbol("metadata"),ji.litPropertyMetadata??=new WeakMap;var _t=class extends HTMLElement{static addInitializer(i){this.Vr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Oi&&[...this.Oi.keys()]}static createProperty(i,t=Hs){if(t.state&&(t.attribute=false),this.Vr(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(i,e,t);r!==void 0&&Ll(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Ul(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let a=r?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Hs}static Vr(){if(this.hasOwnProperty(oi("elementProperties")))return;let i=Dl(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(oi("finalized")))return;if(this.finalized=true,this.Vr(),this.hasOwnProperty(oi("properties"))){let t=this.properties,e=[...Rl(t),...$l(t)];for(let r of e)this.createProperty(r,t[r]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,r]of t)this.elementProperties.set(e,r);}this.Oi=new Map;for(let[t,e]of this.elementProperties){let r=this._r(t,e);r!==void 0&&this.Oi.set(r,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let r of e)t.unshift(fo(r));}else i!==void 0&&t.push(fo(i));return t}static _r(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.Pi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.yt=null,this.Cc();}Cc(){this.Br=new Promise(i=>this.enableUpdating=i),this.Ne=new Map,this.Sc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.qt??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.qt?.delete(i);}Sc(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Pi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return zs(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.qt?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.qt?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.zr(i,e);}Ac(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor._r(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:si).toAttribute(t,e.type);this.yt=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.yt=null;}}zr(i,t){let e=this.constructor,r=e.Oi.get(i);if(r!==void 0&&this.yt!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:si;this.yt=r;let a=n.fromAttribute(t,s.type);this[r]=a??this.Hr?.get(r)??a,this.yt=null;}}requestUpdate(i,t,e,r=false,s){if(i!==void 0){let n=this.constructor;if(r===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??Gi)(s,t)||e.useDefault&&e.reflect&&s===this.Hr?.get(i)&&!this.hasAttribute(n._r(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Br=this.kc());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.Hr??=new Map).has(i)&&(this.Hr.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.Ne.has(i)||(this.hasUpdated||e||(t=void 0),this.Ne.set(i,t)),r===true&&this.yt!==i&&(this.Hs??=new Set).add(i));}async kc(){this.isUpdatePending=true;try{await this.Br;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.Pi){for(let[r,s]of this.Pi)this[r]=s;this.Pi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,a=this[r];n!==true||this.Ne.has(r)||a===void 0||this.C(r,void 0,s,a);}}let i=false,t=this.Ne;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.qt?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.Kr();}catch(e){throw i=false,this.Kr(),e}i&&this.Mc(t);}willUpdate(i){}Mc(i){this.qt?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}Kr(){this.Ne=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Br}shouldUpdate(i){return true}update(i){this.Hs&&=this.Hs.forEach(t=>this.Ac(t,this[t])),this.Kr();}updated(i){}firstUpdated(i){}};_t.elementStyles=[],_t.shadowRootOptions={mode:"open"},_t[oi("elementProperties")]=new Map,_t[oi("finalized")]=new Map,Vl?.({ReactiveElement:_t}),(ji.reactiveElementVersions??=[]).push("2.1.2");var go=globalThis,Ks=o=>o,qi=go.trustedTypes,js=qi?qi.createPolicy("lit-html",{createHTML:o=>o}):void 0,vo="$lit$",zt=`lit$${Math.random().toFixed(9).slice(2)}$`,yo="?"+zt,Nl=`<${yo}>`,he=document,ai=()=>he.createComment(""),li=o=>o===null||typeof o!="object"&&typeof o!="function",bo=Array.isArray,Xs=o=>bo(o)||typeof o?.[Symbol.iterator]=="function",mo=`[ \f\r]`,ni=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gs=/-->/g,qs=/>/g,de=RegExp(`>|${mo}(?:([^\\s"'>=/]+)(${mo}*=${mo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ws=/'/g,Zs=/"/g,Qs=/^(?:script|style|textarea|title)$/i,wo=o=>(i,...t)=>({Ve:o,strings:i,values:t}),v=wo(1),it=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),Ys=new WeakMap,pe=he.createTreeWalker(he,129);function Js(o,i){if(!bo(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return js!==void 0?js.createHTML(i):i}var tn=(o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=ni;for(let a=0;a<t;a++){let l=o[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===ni?d[1]==="!--"?n=Gs:d[1]!==void 0?n=qs:d[2]!==void 0?(Qs.test(d[2])&&(r=RegExp("</"+d[2],"g")),n=de):d[3]!==void 0&&(n=de):n===de?d[0]===">"?(n=r??ni,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?de:d[3]==='"'?Zs:Ws):n===Zs||n===Ws?n=de:n===Gs||n===qs?n=ni:(n=de,r=void 0);let f=n===de&&o[a+1].startsWith("/>")?" ":"";s+=n===ni?l+Nl:u>=0?(e.push(c),l.slice(0,u)+vo+l.slice(u)+zt+f):l+zt+(u===-2?a:f);}return [Js(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},ci=class o{constructor({strings:i,Ve:t},e){let r;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=tn(i,t);if(this.el=o.createElement(c,e),pe.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(r=pe.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(vo)){let h=d[n++],f=r.getAttribute(u).split(zt),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?Zi:g[1]==="?"?Yi:g[1]==="@"?Xi:me}),r.removeAttribute(u);}else u.startsWith(zt)&&(l.push({type:6,index:s}),r.removeAttribute(u));if(Qs.test(r.tagName)){let u=r.textContent.split(zt),h=u.length-1;if(h>0){r.textContent=qi?qi.emptyScript:"";for(let f=0;f<h;f++)r.append(u[f],ai()),pe.nextNode(),l.push({type:2,index:++s});r.append(u[h],ai());}}}else if(r.nodeType===8)if(r.data===yo)l.push({type:2,index:s});else {let u=-1;for(;(u=r.data.indexOf(zt,u+1))!==-1;)l.push({type:7,index:s}),u+=zt.length-1;}s++;}}static createElement(i,t){let e=he.createElement("template");return e.innerHTML=i,e}};function fe(o,i,t=o,e){if(i===it)return i;let r=e!==void 0?t.Ic?.[e]:t.Oc,s=li(i)?void 0:i.jr;return r?.constructor!==s&&(r?.Ks?.(false),s===void 0?r=void 0:(r=new s(o),r.Gr(o,t,e)),e!==void 0?(t.Ic??=[])[e]=r:t.Oc=r),r!==void 0&&(i=fe(o,r.Pc(o,i.values),r,e)),i}var Wi=class{constructor(i,t){this.js=[],this.le=void 0,this.Gs=i,this.f=t;}get parentNode(){return this.f.parentNode}get W(){return this.f.W}u(i){let{el:{content:t},parts:e}=this.Gs,r=(i?.creationScope??he).importNode(t,true);pe.currentNode=r;let s=pe.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new ke(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new Qi(s,this,i)),this.js.push(c),l=e[++a];}n!==l?.index&&(s=pe.nextNode(),n++);}return pe.currentNode=he,r}p(i){let t=0;for(let e of this.js)e!==void 0&&(e.strings!==void 0?(e.ce(i,e,t),t+=e.strings.length-2):e.ce(i[t])),t++;}},ke=class o{get W(){return this.f?.W??this.qs}constructor(i,t,e,r){this.type=2,this.r=U,this.le=void 0,this.ve=i,this.bt=t,this.f=e,this.options=r,this.qs=r?.isConnected??true;}get parentNode(){let i=this.ve.parentNode,t=this.f;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.ve}get endNode(){return this.bt}ce(i,t=this){i=fe(this,i,t),li(i)?i===U||i==null||i===""?(this.r!==U&&this.wt(),this.r=U):i!==this.r&&i!==it&&this.Ws(i):i.Ve!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Xs(i)?this.k(i):this.Ws(i);}O(i){return this.ve.parentNode.insertBefore(i,this.bt)}T(i){this.r!==i&&(this.wt(),this.r=this.O(i));}Ws(i){this.r!==U&&li(this.r)?this.ve.nextSibling.data=i:this.T(he.createTextNode(i)),this.r=i;}$(i){let{values:t,Ve:e}=i,r=typeof e=="number"?this.Lc(i):(e.el===void 0&&(e.el=ci.createElement(Js(e.h,e.h[0]),this.options)),e);if(this.r?.Gs===r)this.r.p(t);else {let s=new Wi(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Lc(i){let t=Ys.get(i.strings);return t===void 0&&Ys.set(i.strings,t=new ci(i)),t}k(i){bo(this.r)||(this.r=[],this.wt());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(ai()),this.O(ai()),this,this.options)):e=t[r],e.ce(s),r++;r<t.length&&(this.wt(e&&e.bt.nextSibling,r),t.length=r);}wt(i=this.ve.nextSibling,t){for(this.Li?.(false,true,t);i!==this.bt;){let e=Ks(i).nextSibling;Ks(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.qs=i,this.Li?.(i));}},me=class{get tagName(){return this.element.tagName}get W(){return this.f.W}constructor(i,t,e,r,s){this.type=1,this.r=U,this.le=void 0,this.element=i,this.name=t,this.f=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=U;}ce(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=fe(this,i,t,0),n=!li(i)||i!==this.r&&i!==it,n&&(this.r=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=fe(this,a[e+l],t,l),c===it&&(c=this.r[l]),n||=!li(c)||c!==this.r[l],c===U?i=U:i!==U&&(i+=(c??"")+s[l+1]),this.r[l]=c;}n&&!r&&this.j(i);}j(i){i===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Zi=class extends me{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===U?void 0:i;}},Yi=class extends me{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==U);}},Xi=class extends me{constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}ce(i,t=this){if((i=fe(this,i,t,0)??U)===it)return;let e=this.r,r=i===U&&e!==U||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==U&&(e===U||r);r&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},Qi=class{constructor(i,t,e){this.element=i,this.type=6,this.le=void 0,this.f=t,this.options=e;}get W(){return this.f.W}ce(i){fe(this,i);}},en={I:ke},_l=go.litHtmlPolyfillSupport;_l?.(ci,ke),(go.litHtmlVersions??=[]).push("3.3.2");var rn=(o,i,t)=>{let e=t?.renderBefore??i,r=e.Rc;if(r===void 0){let s=t?.renderBefore??null;e.Rc=r=new ke(i.insertBefore(ai(),s),s,void 0,t??{});}return r.ce(o),r};var To=globalThis,wt=class extends _t{constructor(){super(...arguments),this.renderOptions={host:this},this.qr=void 0;}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this.qr=rn(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.qr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.qr?.setConnected(false);}render(){return it}};wt.Gp=true,wt.finalized=true,To.litElementHydrateSupport?.({LitElement:wt});var zl=To.litElementPolyfillSupport;zl?.({LitElement:wt});(To.litElementVersions??=[]).push("4.2.2");var Bl=/\\([0-9a-fA-F]{1,6} ?)/g;function Hl(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}function Kl(o){let i=o;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function jl(o){let i="",t="";for(let e=0;e<o.length;e++){let r=o[e+1];o[e]==="\\"&&r==='"'?(i+='\\"',e++):o[e]==='"'&&t!=="\\"?i+='\\"':i+=o[e],t=o[e]??"";}return i}function on(o){let i=o;Hl(o)&&(i=Kl(i),i=i.replace(Bl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=jl(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Me(o){class i extends o{constructor(){super(...arguments);this.Zs=null;this.Wr=null;}getCssData(r,s=false){let n=this.Zs??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.Wr||(this.Wr=window.getComputedStyle(this));let a=this.Wr.getPropertyValue(r).trim();try{n[r]=on(a);}catch(l){s||console.warn(`CSS Data error: ${r}`,l),n[r]=null;}}return this.Zs=n,n[r]}}return i}function Ji(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this._e={};this.Be=null;this.Ri=false;}createRenderRoot(){return this}connectedCallback(){this.Be||(this.Be=Array.from(this.childNodes)),super.connectedCallback();}Uc(){if(this.Ri)return;this.Ri=true,this._e={};let r=Array.from(this.childNodes),s=r.length?r:this.Be??[];for(let n of s){let a=this.Ys(n),l=this._e[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this._e[a]=l;}this.Be=null;}Ys(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.Ys(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}$c(r){return !r.textContent||!r.textContent.trim()}Dc(r){let s=this._e[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.$c(n))}update(r){!this.hasUpdated&&this.willYield&&this.Uc(),super.update(r);}yield(r,s){if(r===""&&!this._e[r]&&!this.Ri&&this.Be?.length){let a=[];for(let l of this.Be)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this._e[r]=a,this.Ri=true,this.Be=null;}let n=this._e[r];return v` ${n} ${this.Dc(r)?s:void 0} `}}return i}function Ie(o){class i extends o{static reg(e){let r=this,s=window.customElements.get(e);if(s){s!==r&&console.warn([`Element with tag name "${e}" 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(e,r);}}return i}var Xt=class extends Event{constructor(i,t,e,r){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=r??false;}};var Oe=class{constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Xt(this.context,this.host,this.t,this.subscribe));}};var tr=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Eo=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Pe=class extends tr{constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=r=>{if(r.context!==this.context)return;let s=r.contextTarget??r.composedPath()[0];s!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,s,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new Xt(this.context,a,n,true)));r.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new Eo(this.context,this.host));}};var ql={attribute:true,type:String,converter:si,reflect:false,hasChanged:Gi},Wl=(o=ql,i,t)=>{let{kind:e,metadata:r}=t,s=globalThis.litPropertyMetadata.get(r);if(s===void 0&&globalThis.litPropertyMetadata.set(r,s=new Map),e==="setter"&&((o=Object.create(o)).wrapped=true),s.set(t.name,o),e==="accessor"){let{name:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,o,true,a);},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,o,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(o){return (i,t)=>typeof t=="object"?Wl(o,i,t):((e,r,s)=>{let n=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}function m(o){return y({...o,state:true,attribute:false})}function $(o,i){let t,e=((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var sn="ctx-name-context";function ir(){return function(o){class i extends o{constructor(...r){super(...r);this.ee=null;this.Wt=false;this.Zr=false;this.Yr=void 0;this.Tt=new Map;this.Zt=new Set;this.init$={};this.ctxOwner=false;this.Ui=void 0;this.$i=false;this.ctxName=this.Ae;this.ke=false;this.Ui=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Ae,this.Fc=new Oe(this,{context:sn,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Js=s,this.Qs();},subscribe:true});}static set template(r){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 Xs(){return this.Ui}set Xs(r){let s=r??void 0;this.Ui!==s&&(this.Ui=s,this.Qs());}shouldUpdate(r){return this.ke?super.shouldUpdate(r):false}get Ae(){return this.Xs||this.Js||void 0}Qs(){if(this.ctxName=this.Ae,!(!this.ctxName||this.Wt)){if(this.isConnected){this.Xr();return}this.$i=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Ae,this.ctxName&&(this.Yr?this.Yr.setValue(this.ctxName):this.Yr=new Pe(this,{context:sn,initialValue:this.ctxName}));}en(){if(!(!this.ee||this.Tt.size===0)){for(let[r,{value:s,rewrite:n}]of this.Tt)this.ee.add(r,s,n);this.Tt.clear();}}tn(){return !this.ee&&this.Ae&&this.Qr(),this.ee&&this.en(),this.ee}Di(){let r=this.tn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}Qr(){let r=this.init$,s=this.Ae;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.ee){this.ee=H.getCtx(s)??H.registerCtx(r,s);for(let[n,a]of Object.entries(this.init$))this.ee.add(n,a,this.ctxOwner);this.en();}}get $(){return this.Ae&&this.Qr(),new Proxy({},{get:(r,s)=>{if(typeof s=="string")return this.ee?.read(s)},set:(r,s,n)=>(typeof s!="string"||this.ee?.pub(s,n),true)})}sub(r,s,n=true){let a=this.Di().sub(r,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.Zt.delete(d));};return this.Zt.add(d),d}pub(r,s){this.Di().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.Di()}has(r){return this.ee?.has(r)??false}add(r,s,n=false){let a=this.tn();if(!a){if(!n&&this.Tt.has(r))return;this.Tt.set(r,{value:s,rewrite:n});return}this.Tt.delete(r),a.add(r,s,n);}add$(r,s=false){for(let[n,a]of Object.entries(r))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.Wt?this.ke&&this.Zr&&(this.Zr=false,this.initCallback()):this.ctxName?(this.$i=false,this.Xr()):this.$i&&this.Ae&&(this.$i=false,this.Xr());}Xr(){if(this.Wt)return;this.Wt=true,this.Qr();let r=this.init$;if(Object.keys(r).length>0){let s=this.Di();for(let[n,a]of Object.entries(r))s.read(n)===void 0&&s.pub(n,a),this.sub(n,$(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.ke=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.Nc(),super.disconnectedCallback(),this.Wt&&(this.Zr=true);}Nc(){if(this.Zt.size!==0){for(let r of [...this.Zt])r();this.Zt.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Xs",1),p([m()],i.prototype,"Js",2),p([m()],i.prototype,"ctxName",2),p([m()],i.prototype,"ke",2),i}}var Co=class extends Ie(ir()(Me(Ji(wt)))){};var pt=class o{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():o.generateFastUid()}};var Zl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function ht(o){for(let i in o){if(Zl.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r=`-${r.toLowerCase()}`),e+=r,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[i].reg&&o[i].reg(t);}}var xo="UC";function Yl(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[xo]){t(window[xo]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[xo];i&&ht(s),t(s);},document.head.appendChild(r);})}var ui={"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 So=new Map,nn=new Map,an=(o,i)=>{So.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...ui,...i};return So.set(o,t),t},Xl=(o,i)=>{nn.set(o,i);},ln=(o,i)=>{typeof i=="function"?Xl(o,i):an(o,i);},cn=async o=>{let i=So.get(o);if(!i){let t=nn.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=an(o,e);}return i};ln("en",ui);var k=o=>`*cfg/${o}`;var K=o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],Bt=o=>o.join(",");var un=o=>{if(typeof o!="string"||!o)return "";let i=o.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},rr=(...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>un(i)).join("/-/"),rt=(...o)=>{let i=rr(...o);return i?`-/${i}/`:""};function or(o){let i=new URL(o),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):r>=0&&(s=t.slice(r+1)),s}function sr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Ao(o){let i=dn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function ko(o){return Ao(o).split("/-/").filter(Boolean).map(t=>un(t))}function dn(o){let i=new URL(o),t=or(o),e=pn(t)?hn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function pn(o){return o.startsWith("http")}function hn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var W=(o,i,t)=>{let e=new URL(dn(o)),r=t??or(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&pn(r)){let n=hn(r);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},Qt=(o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()};var Z=(o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var di=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}),mn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Ql(o,i){if(typeof i=="number"){let t=i;return di[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return di[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return di.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}function Jt(o){return rr(...mn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return Ql(i,t)}).filter(i=>!!i))}var nr=rr("format/auto","progressive/yes"),Ht=([o])=>typeof o<"u"?Number(o):void 0,fn=()=>true,Jl=([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),tc=([o,i])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Z(o,"x").map(Number),coords:Z(i).map(Number)}},ec=Object.freeze({enhance:Ht,brightness:Ht,exposure:Ht,gamma:Ht,contrast:Ht,saturation:Ht,vibrance:Ht,warmth:Ht,filter:Jl,mirror:fn,flip:fn,rotate:Ht,crop:o=>{let[i,t]=o,{dimensions:e,coords:r}=tc([i,t]);return {dimensions:e,coords:r}}});function Mo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!mn.includes(e))continue;let s=e,n=ec[s];try{let a=n(r);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". 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 i}var B=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),ot=Object.freeze([B.CROP,B.TUNING,B.FILTERS]),gn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),vn=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"]),yn=Object.freeze(["rotate","mirror","flip"]),Kt=di,kt=Object.freeze({brightness:{zero:Kt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Kt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Kt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Kt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Kt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Kt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Kt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Kt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Kt.filter,range:[0,100],keypointsNumber:1}});var pi="https://ucarecdn.com",ic="https://upload.uploadcare.com",rc="https://social.uploadcare.com",oc="https://ucarecd.net",sc={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:pi,cdnCnamePrefixed:oc,baseUrl:ic,socialBaseUrl:rc,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:Bt(ot),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[]},J=Object.freeze(sc);var ar=(o,i)=>(...t)=>{let e=o();if(!e.read(k("debug")))return;let r=t;if(typeof t?.[0]=="function"){let n=t[0];r=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...r);};var j=class{constructor(i){this.Jr=new Set;this.ze=null;this.w=ar(()=>this.i.ctx,this.constructor.name);this.i=i,this.e=i.ctx;}addSub(i){this.Jr.add(i);}get He(){if(!this.ze){let i={};this.ze=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let r=k(e);return this.i.ctx.has(r)?this.i.ctx.read(r):J[e]}});}return this.ze}destroy(){for(let i of this.Jr)try{i();}catch{}this.Jr.clear();}},nc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},Mt=(o,i,t=true)=>{let e=o.has(i),r=e?o.read(i):null;if(e&&r||!t)return r;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},bn=o=>({get ctx(){return o()},get modalManager(){return Mt(o(),"*modalManager",false)},get pluginManager(){return Mt(o(),"*pluginManager")},get telemetryManager(){return Mt(o(),"*telemetryManager")},get localeManager(){return Mt(o(),"*localeManager")},get a11y(){return Mt(o(),"*a11y")},get blocksRegistry(){return Mt(o(),"*blocksRegistry")},get eventEmitter(){return Mt(o(),"*eventEmitter")},get uploadCollection(){return Mt(o(),"*uploadCollection")},get secureUploadsManager(){return Mt(o(),"*secureUploadsManager",false)},get api(){return Mt(o(),"*publicApi")},get validationManager(){return Mt(o(),"*validationManager")},when(i,t){let e=nc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n=r.sub(e,a=>{a&&(t(a),n());});return n},wait(i){return new Promise(t=>{let e=this.when(i,r=>{t(r),e();});})}});var Y=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),lr=class extends j{constructor(){super(...arguments);this.Ke=new Map;this.ue=new Set;this.c=new Map;}registerModal(t,e){this.Ke.set(t,e),this.q(Y.ADD,{id:t,modal:e});}deleteModal(t){let e=this.Ke.get(t);return e?(this.Ke.delete(t),this.ue.delete(t),this.q(Y.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.Ke.get(t);return e?(this.ue.add(t),this.q(Y.OPEN,{modal:e,id:t}),true):(this.w(`Modal with ID "${t}" not found`),false)}close(t){let e=this.Ke.get(t);return !e||!this.ue.has(t)?(this.w(`Modal with ID "${t}" not found or not active`),false):(this.ue.delete(t),this.q(Y.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.Ke.has(t)?this.ue.has(t)?this.close(t):this.open(t):(this.w(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.ue.size>0}back(){if(this.ue.size===0)return this.w("No active modals to go back from"),false;let t=Array.from(this.ue).pop();return t?this.close(t):false}closeAll(){let t=this.ue.size;return this.ue.clear(),this.q(Y.CLOSE_ALL,{}),t}subscribe(t,e){return this.c.has(t)||this.c.set(t,new Set),this.c.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.c.has(t)&&this.c.get(t)?.delete(e);}q(t,e){if(this.c.has(t))for(let r of this.c.get(t)??new Set)try{r(e);}catch(s){this.i.telemetryManager.sendEventError(s,"modal subscriber"),this.w("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.Ke.clear(),this.c.clear(),this.q(Y.DESTROY,{});}};var cr=o=>o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");function wn(o){return Object.prototype.toString.call(o)==="[object Object]"}var ac=/\W|_/g;function lc(o){return o.split(ac).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Tn(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>Gt(t,{ignoreKeys:i})):o}function Gt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Tn(o,{ignoreKeys:i});if(!wn(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}wn(r)?r=Gt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Tn(r,{ignoreKeys:i})),t[lc(e)]=r;}return t}var cc=o=>new Promise(i=>setTimeout(i,o));function $o({libraryName:o,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:o,libraryVersion:i,languageName:s,integration:r});let n=[o,i,e].filter(Boolean).join("/"),a=[s,r].filter(Boolean).join("; ");return `${n} (${a})`}var uc={factor:2,time:100};function dc(o,i=uc){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a=>cc(a??s).then(()=>(t+=1,e(r)))})}return e(o)}var ge=class extends Error{},Le=class o extends ge{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},ur=(o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},te=class o extends ge{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},pc=500,Cn=({check:o,interval:i=pc,timeout:t,signal:e})=>new Promise((r,s)=>{let n,a;ur(e,()=>{n&&clearTimeout(n),s(new te("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),s(new te("Timed out"));},t));let l=()=>{try{Promise.resolve(o(e)).then(c=>{c?(a&&clearTimeout(a),r(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),s(c);});}catch(c){a&&clearTimeout(a),s(c);}};n=setTimeout(l,0);}),P={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},dr="application/octet-stream",xn="original",ie=({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=o?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,f]=u;typeof f<"u"&&!Array.isArray(f)&&l.setRequestHeader(h,f);}),l.responseType="text",ur(r,()=>{d=true,l.abort(),a(new te);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};h.forEach(function(w){let E=w.split(": "),T=E.shift(),A=E.join(": ");T&&typeof T<"u"&&(f[T]=A);});let g=l.response,b=l.status;n({request:u,data:g,headers:f,status:b});}},l.onerror=u=>{d||a(new Le(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function hc(o,...i){return o}var fc=({name:o})=>o?[o]:[],mc=hc,gc=()=>new FormData,Sn=o=>false,pr=o=>typeof Blob<"u"&&o instanceof Blob,hr=o=>typeof File<"u"&&o instanceof File,fr=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string",Ue=o=>pr(o)||hr(o)||Sn()||fr(o),vc=o=>typeof o=="string"||typeof o=="number"||typeof o>"u",yc=o=>!!o&&typeof o=="object"&&!Array.isArray(o),bc=o=>!!o&&typeof o=="object"&&"data"in o&&Ue(o.data);function An(o,i,t){if(Array.isArray(t))for(let e of t)An(o,`${i}[]`,e);else if(bc(t)){let{name:e,contentType:r}=t,s=mc(t.data,e,r??dr),n=fc({name:e});o.push([i,s,...n]);}else if(yc(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else vc(t)&&t&&o.push([i,t.toString()]);}function wc(o){let i=[];for(let[t,e]of Object.entries(o))An(i,t,e);return i}function mr(o){let i=gc(),t=wc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}var st=class o extends ge{code;request;response;headers;constructor(i,t,e,r,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=r,this.headers=s,Object.setPrototypeOf(this,o.prototype);}},Tc=o=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(o))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>r[1]??false).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},jt=(o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Tc(t)),e.toString()},Ec="6.18.4",Cc="UploadcareUploadClient",xc=Ec;function ye(o){return $o({libraryName:Cc,libraryVersion:xc,...o})}var Sc="RequestThrottledError",En=15e3,Ac=1e3;function kc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return En;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:En}function re(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return dc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Sc&&r<t)return s(kc(n));if(n instanceof Le&&r<e)return s((r+1)*Ac);throw n}))}var kn=o=>{let i="";return (pr(o)||hr(o)||fr(o))&&(i=o.type),i||dr},Mn=o=>{let i="";return hr(o)&&o.name?i=o.name:pr(o)||Sn()?i="":fr(o)&&o.name&&(i=o.name),i||xn};function Do(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}function Mc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=P.baseURL,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=P.retryNetworkErrorMaxTimes,metadata:b}){return re(()=>ie({method:"POST",url:jt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ye({publicKey:i,integration:u,userAgent:h})},data:mr({file:{data:o,name:t||Mn(o),contentType:e||kn(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Do(a),signature:s,expire:n,source:d,metadata:b}),signal:l,onProgress:c}).then(({data:w,headers:E,request:T})=>{let A=Gt(JSON.parse(w));if("error"in A)throw new st(A.error.content,A.error.errorCode,T,A,E);return A}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:f})}var Po;(function(o){o.Token="token",o.FileInfo="file_info";})(Po||(Po={}));function Ic(o,{publicKey:i,baseURL:t=P.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=P.retryNetworkErrorMaxTimes,metadata:b}){return re(()=>ie({method:"POST",headers:{"X-UC-User-Agent":ye({publicKey:i,integration:u,userAgent:h})},url:jt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Do(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:d}).then(({data:w,headers:E,request:T})=>{let A=Gt(JSON.parse(w));if("error"in A)throw new st(A.error.content,A.error.errorCode,T,A,E);return A}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:f})}var ct;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(ct||(ct={}));var Oc=o=>"status"in o&&o.status===ct.Error;function Pc(o,{publicKey:i,baseURL:t=P.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=P.retryNetworkErrorMaxTimes}={}){return re(()=>ie({method:"GET",headers:i?{"X-UC-User-Agent":ye({publicKey:i,integration:r,userAgent:s})}:void 0,url:jt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:l,headers:c,request:d})=>{let u=Gt(JSON.parse(l));if("error"in u&&!Oc(u))throw new st(u.error.content,u.error.errorCode,d,u,c);return u}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function Lc(o,{publicKey:i,baseURL:t=P.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:u=P.retryNetworkErrorMaxTimes}){return re(()=>ie({method:"POST",headers:{"X-UC-User-Agent":ye({publicKey:i,integration:l,userAgent:c})},url:jt(t,"/group/",{jsonerrors:1}),data:mr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:a}),signal:n}).then(({data:h,headers:f,request:g})=>{let b=Gt(JSON.parse(h));if("error"in b)throw new st(b.error.content,b.error.errorCode,g,b,f);return b}),{retryNetworkErrorMaxTimes:u,retryThrottledRequestMaxTimes:d})}function In(o,{publicKey:i,baseURL:t=P.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=P.retryNetworkErrorMaxTimes}){return re(()=>ie({method:"GET",headers:{"X-UC-User-Agent":ye({publicKey:i,integration:s,userAgent:n})},url:jt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:c,headers:d,request:u})=>{let h=Gt(JSON.parse(c));if("error"in h)throw new st(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Uc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=P.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,store:l,signal:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=P.retryNetworkErrorMaxTimes,metadata:b}){return re(()=>ie({method:"POST",url:jt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ye({publicKey:i,integration:u,userAgent:h})},data:mr({filename:e,size:o,content_type:t||dr,part_size:r,UPLOADCARE_STORE:Do(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:d,metadata:b}),signal:c}).then(({data:w,headers:E,request:T})=>{let A=Gt(JSON.parse(w));if("error"in A)throw new st(A.error.content,A.error.errorCode,T,A,E);return A.parts=Object.keys(A.parts).map(yt=>A.parts[Number(yt)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})}function Rc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=P.retryNetworkErrorMaxTimes}){return re(()=>ie({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||dr}}).then(a=>(r&&r({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function $c(o,{publicKey:i,baseURL:t=P.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=P.retryNetworkErrorMaxTimes}){return re(()=>ie({method:"POST",url:jt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ye({publicKey:i,integration:s,userAgent:n})},data:mr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:d,request:u})=>{let h=Gt(JSON.parse(c));if("error"in h)throw new st(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Fo(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return Cn({check:d=>In(o,{publicKey:i,baseURL:t,signal:d,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(u=>u.isReady?u:(c&&c({isComputable:true,value:1}),false)),signal:l})}function Dc(o){return "defaultEffects"in o}var ve=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=P.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=jt(t,`${r}/`),a=s?jt(`https://${s}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=a,Dc(i)&&(this.defaultEffects=i.defaultEffects);}},Fc=(o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>Mc(o,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:E})=>Fo(E,{publicKey:i,baseURL:e,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(E=>new ve(E,{baseCDN:b})),Vc=(o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d,baseCDN:u})=>In(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d}).then(h=>new ve(h,{baseCDN:u,fileName:t})).then(h=>(s&&s({isComputable:true,value:1}),h)),Nc=(o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=n=>()=>{e=n,r.forEach((a,l)=>l!==n&&a.abort());};return ur(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:r[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},_c=window.WebSocket,Lo=class{events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},zc=(o,i)=>o==="success"?{status:ct.Success,...i}:o==="progress"?{status:ct.Progress,...i}:{status:ct.Error,...i},Uo=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Lo;disconnectTimeoutId=null;constructor(i,t=3e4){this.key=i,this.disconnectTime=t;}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new _c(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message));}),this.emmitter.on("connected",()=>{this.isConnected=true,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[];}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case "pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case "pusher:ping":{this.send("pusher:pong",{});break}case "progress":case "success":case "fail":this.emmitter.emit(e.channel,zc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Io=null,Vo=o=>{if(!Io){let i=typeof window>"u"?0:3e4;Io=new Uo(o,i);}return Io},Bc=o=>{Vo(o).connect();};function Hc({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return Cn({check:c=>Pc(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:c}).then(d=>{switch(d.status){case ct.Error:return new st(d.error,d.errorCode);case ct.Waiting:return false;case ct.Unknown:return new st(`Token "${o}" was not found.`);case ct.Progress:return a&&(d.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:d.done/d.total})),false;case ct.Success:return a&&a({isComputable:true,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:l})}var Kc=({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=Vo(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(o);};ur(t,()=>{l(),s(new te("pusher cancelled"));}),n.subscribe(o,c=>{switch(c.status){case ct.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case ct.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),r(c);break}case ct.Error:l(),s(new st(c.msg,c.error_code));}});}),jc=(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,onProgress:u,source:h,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=P.pusherKey,metadata:E})=>Promise.resolve(Bc(w)).then(()=>Ic(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,source:h,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:E})).catch(T=>(Vo(w)?.disconnect(),Promise.reject(T))).then(T=>T.type===Po.FileInfo?T:Nc([({signal:A})=>Hc({token:T.token,publicKey:i,baseURL:e,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:A}),({signal:A})=>Kc({token:T.token,pusherKey:w,signal:A,onProgress:u})],{signal:d})).then(T=>{if(T instanceof st)throw T;return T}).then(T=>Fo(T.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:d})).then(T=>new ve(T,{baseCDN:r})),Oo=new WeakMap,Gc=async o=>{if(Oo.has(o))return Oo.get(o);let i=await fetch(o.uri).then(t=>t.blob());return Oo.set(o,i),i},On=async o=>{if(hr(o)||pr(o))return o.size;if(fr(o))return (await Gc(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},qc=(o,i=P.multipartMinFileSize)=>o>=i,Pn=o=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !Ue(o)&&t.test(o)},No=o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Ue(o)&&t.test(o)},Wc=(o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,d=a.shift();d&&d().then(u=>{s||(r[c]=u,n-=1,n?l():t(r));}).catch(u=>{s=true,e(u);});};for(let c=0;c<o;c++)l();}),Zc=(o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},Yc=async(o,i,t)=>e=>Zc(o,e,i,t),Xc=(o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Rc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),Qc=async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=P.multipartChunkSize,maxConcurrentRequests:E=P.maxConcurrentRequests,baseCDN:T,metadata:A})=>{let yt=e??await On(o),bt,ue=(Q,lt)=>{if(!c)return;bt||(bt=Array(Q).fill(0));let St=Pt=>Pt.reduce((Nt,uo)=>Nt+uo,0);return Pt=>{Pt.isComputable&&(bt[lt]=Pt.value,c({isComputable:true,value:St(bt)/Q}));}};return b||=kn(o),Uc(yt,{publicKey:i,contentType:b,fileName:t||Mn(o),baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,metadata:A,multipartChunkSize:w}).then(async({uuid:Q,parts:lt})=>{let St=await Yc(o,yt,w);return Promise.all([Q,Wc(E,lt.map((Pt,Nt)=>()=>Xc(St(Nt),Pt,{publicKey:i,contentType:b,onProgress:ue(lt.length,Nt),signal:l,integration:u,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})))])}).then(([Q])=>$c(Q,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})).then(Q=>Q.isReady?Q:Fo(Q.uuid,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(Q=>new ve(Q,{baseCDN:T}))};async function _o(o,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:E,baseCDN:T=P.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:yt,pusherKey:bt,metadata:ue}){if(Ue(o)){let Q=await On(o);return qc(Q,b)?Qc(o,{publicKey:i,contentType:g,multipartChunkSize:w,fileSize:Q,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:T,metadata:ue}):Fc(o,{publicKey:i,fileName:t,contentType:g,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:T,metadata:ue})}if(No(o))return jc(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:T,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:yt,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,pusherKey:bt,metadata:ue});if(Pn(o))return Vc(o,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:T});throw new TypeError(`File uploading from "${o}" is not supported`)}var Jc=(o,i)=>{try{let t=new URL(o),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return o}},Ro=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=P.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,s)=>r+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=Jc(i.cdnUrl,t),this.files=e.map(r=>new ve(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},tu=o=>{for(let i of o)if(!Ue(i))return false;return true},eu=o=>{for(let i of o)if(!Pn(i))return false;return true},iu=o=>{for(let i of o)if(!No(i))return false;return true};function Ln(o,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartChunkSize:b=P.multipartChunkSize,baseCDN:w=P.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:T,jsonpCallback:A}){if(!tu(o)&&!iu(o)&&!eu(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let yt,bt=true,ue=o.length,Q=(lt,St)=>{if(!l)return;yt||(yt=Array(lt).fill(0));let Pt=Nt=>Nt.reduce((uo,Ml)=>uo+Ml)/lt;return Nt=>{if(!Nt.isComputable||!bt){bt=false,l({isComputable:false});return}yt[St]=Nt.value,l({isComputable:true,value:Pt(yt)});}};return Promise.all(o.map((lt,St)=>Ue(lt)||No(lt)?_o(lt,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:Q(ue,St),source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:T}).then(Pt=>Pt.uuid):lt)).then(lt=>Lc(lt,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:r,secureExpire:s,signal:a,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f}).then(St=>new Ro(St,{baseCDN:w})).then(St=>(l&&l({isComputable:true,value:1}),St)))}var ee=class{Fi=1;eo=[];Ni=0;to=new Map;io=new Map;constructor(i){this.Fi=i;}run(){let i=this.Fi-this.Ni;for(let t=0;t<i;t++){let e=this.eo.shift();if(!e)return;let r=this.to.get(e),s=this.io.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Ni+=1,e().finally(()=>{this.to.delete(e),this.io.delete(e),this.Ni-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.to.set(i,e),this.io.set(i,r),this.eo.push(i),t&&this.run();})}get pending(){return this.eo.length}get running(){return this.Ni}set concurrency(i){this.Fi=i,this.run();}get concurrency(){return this.Fi}};var zo=()=>({}),Bo=o=>({...zo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);}}),Ho=o=>({...Bo(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ee(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),Un=o=>({...Ho(o),"*solution":null,"*lazyPlugins":null});var F=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var gr=class extends j{constructor(t){super(t);this.scopes=new Set;this.listener=this.Vc.bind(this),window.addEventListener("paste",this.listener);}openUploadList(){this.i.api.setCurrentActivity(F.UPLOAD_LIST),this.i.api.setModalState(true);}async Vc(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this.He.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),r=e.map(n=>n.getAsFile()).filter(n=>n!==null),s=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(a=>{n.getAsString(l=>{a(l);});}));r.length>0&&(r.forEach(n=>{this.i.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(a=>{this.i.api.addFileFromUrl(a,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var ru={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function hi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}function Ko(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=ru[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}function jo(o,i){return i.role==="toolbar"?ou(i):i.querySelectorAll(`[role=${o.role}]`)}function ou(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function su(o){let i=o.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=o.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function Rn(o){return i=>{let t=false,e=300,r=0,s="";function n(u){let h=Ko(u.target);if(!h){a();return}let f=jo(u.target,h),g=Array.from(f).indexOf(u.target),b="ArrowDown",w="ArrowUp";if(su(h)&&(i.document.dir==="rtl"?(b="ArrowLeft",w="ArrowRight"):(b="ArrowRight",w="ArrowLeft")),u.key===b)u.preventDefault(),hi(u.target,f[g+1]||f[0]);else if(u.key===w)u.preventDefault(),hi(u.target,f[g-1]||f[f.length-1]);else if(u.key==="Home")u.preventDefault(),hi(u.target,f[0]);else if(u.key==="End")u.preventDefault(),hi(u.target,f[f.length-1]);else if(u.key.length===1&&h.role!=="tablist"){let E=Date.now();E-r<=e?s+=u.key.toLowerCase():s=u.key.toLowerCase(),r=E;let T=Array.from(f).find(A=>A.textContent?.trim()?.toLowerCase()?.startsWith(s));T&&(u.preventDefault(),hi(u.target,T));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=Ko(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=jo(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=Ko(u.target);if(h){let f=jo(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function $n(){return o=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function r(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}function Dn(){return o=>{let i=[];function t(l){let c=o.document.activeElement;c&&c!==o.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){o.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let r=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let d=o.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(s),d.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return o.addEventListener("keydown",a),()=>{o.removeEventListener("keydown",a);}}}function Fn(o){let i,t=o.split(" "),e;function r(a){a.key==="Enter"&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&i.classList.remove(...t),e=null;}function n(a){a.clientX===0&&a.clientY===0&&e!==a.target&&(s(),a.target.classList.add(...t),i=a.target);}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",r),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",r),a.removeEventListener("keyup",s);})}function Vn(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}var Go=class{constructor(){this.te=new Map;this.ro=[];}addEventListener(i,t){let e=r=>{let s=r.target;s instanceof Node&&this.ro.some(n=>n===s||n.contains(s))&&t(r);};this.te.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.te.get(t);e&&window.removeEventListener(i,e),this.te.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.ro.push(i);}destroy(){this.ro=[];for(let i of this.te.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.te.clear();}},vr=class{constructor(){this.Vi=new Go,this.rn=Vn(this.Vi,[Rn(),Fn("is-pressed"),Dn(),$n()]);}registerBlock(i){this.Vi.registerScope(i);}destroy(){this.rn?.(),this.Vi.destroy();}};var qt=o=>`*l10n/${o}`,nu="en",yr=class extends j{constructor(t){super(t);this.Et="";for(let[r,s]of Object.entries(ui)){let n=this.e.has(qt(r))?!this.e.read(qt(r)):true;this.e.add(qt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Et&&this.sn(this.Et);})),this.addSub(this.e.sub(k("localeName"),async r=>{if(!r)return;this.Et=r;let s=await cn(r);r!==nu&&this.Et!==r||(this.sn(r),this.nn(r,s));})),this.addSub(this.e.sub(k("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Et];s&&this.nn(this.Et,s);}));}nn(t,e){let r=this.He.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=r?.[s];this.e.add(qt(s),a??n,true);}}sn(t){let e=this.i.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.i18n){let{pluginId:n,...a}=s,l=a[t];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.e.add(qt(c),d,true);}}};var au=()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},lu=()=>"capture"in document.createElement("input"),cu=()=>({safariDesktop:au()}),uu=()=>({htmlMediaCapture:lu()}),Nn=cu(),_n=uu();var fi="image/*",qo="video/*",du=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],pu=()=>Nn.safariDesktop?[fi]:[fi,...du],mi=pu(),br=o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Z(i)):[],Wo=(o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),zn=(o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),Re=o=>{let i=o?.type;return i?Wo(i,mi):false};function Bn(o,i,t,e,r){return {registry:{registerSource:c=>o.addSource(e,c),registerActivity:c=>o.addActivity(e,c),registerFileAction:c=>o.addFileAction(e,c),registerFileHook:c=>o.addFileHook(e,c),registerIcon:c=>o.addIcon(e,c),registerI18n:c=>o.addI18n(e,c),registerConfig:c=>{o.addConfig(e,c);let d=k(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=k(c);return i.read(d)},subscribe:(c,d)=>{let u=k(c),h=i.sub(u,f=>{d(f);});return r.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let d=i.sub("*currentActivityParams",u=>{c(u);});return r.push(d),d}},files:{update:(c,d)=>{let u=t.uploadCollection?.read(c);u&&(d.file!==void 0&&(u.setValue("file",d.file),u.setValue("fileSize",d.file.size)),d.cdnUrl!==void 0&&u.setValue("cdnUrl",d.cdnUrl),d.cdnUrlModifiers!==void 0&&u.setValue("cdnUrlModifiers",d.cdnUrlModifiers),d.mimeType!==void 0&&u.setValue("mimeType",d.mimeType));}}}}var hu=async({entries:o,signal:i})=>(await Promise.all(o.map(async e=>{if(e.isEnabled())try{let r=await e.load();return i.aborted||!e.isEnabled()?void 0:r??void 0}catch(r){i.aborted||console.warn("Failed to load lazy plugin",r);return}}))).filter(e=>e!==void 0),wr=class{constructor(i,t){this.e=i;this.Bc=t;this.Yt=new Set;this.an=this.e.sub("*lazyPlugins",e=>{this._c(e??[]);});}_c(i){for(let r of this.Yt)r();if(this.Yt.clear(),i.length===0)return;let t=new Set([k("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(k(s));let e=()=>this.ln(i);for(let r of t)this.Yt.add(this.e.sub(r,e,false));this.ln(i);}ln(i){this.oo?.abort();let t=new AbortController;this.oo=t;let e=n=>this.e.read(k(n)),r=e("plugins"),s=hu({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.Bc(s);}destroy(){this.an();for(let i of this.Yt)i();this.Yt.clear(),this.oo?.abort();}};var Tr=class{constructor(){this.je=new Map;}register(i,t){if(this.je.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.je.set(t.name,e);}unregister(i){this.je.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.je)e.pluginId===i&&this.je.delete(t);}get(i){return this.je.get(i)}getAll(){return new Map(this.je)}};var Er=class{constructor(){this.Me=[];this.de=[];this._i=[];this.Bi=[];this.zi=[];this.Hi=[];this.config=new Tr;}xt(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.Me.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Source with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.Me.push(this.xt(i,t));}addActivity(i,t){let e=this.de.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Activity with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.de.push(this.xt(i,t));}addFileAction(i,t){this._i.push(this.xt(i,t));}addFileHook(i,t){this.Bi.push(this.xt(i,{timeout:3e4,...t}));}addIcon(i,t){this.zi.push(this.xt(i,t));}addI18n(i,t){this.Hi.push(this.xt(i,t));}addConfig(i,t){this.config.register(i,t);}purge(i){this.Me=this.Me.filter(t=>t.pluginId!==i),this.de=this.de.filter(t=>t.pluginId!==i),this._i=this._i.filter(t=>t.pluginId!==i),this.Bi=this.Bi.filter(t=>t.pluginId!==i),this.zi=this.zi.filter(t=>t.pluginId!==i),this.Hi=this.Hi.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.Me],activities:[...this.de],fileActions:[...this._i],fileHooks:[...this.Bi],icons:[...this.zi],i18n:[...this.Hi]}}};var Cr=class extends j{constructor(t){super(t);this.Ge=new Map;this.c=new Set;this.so=Promise.resolve();this.registry=new Er;this.cn=new wr(this.e,e=>{this.so=this.so.then(()=>e).then(r=>{if(r)return this.zc(r)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.so}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async zc(t){let e=new Set(this.Ge.keys()),r=new Set;for(let s of t){if(!s.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(r.has(s.id)){console.warn(`[PluginManager] Plugin "${s.id}" is already in the list, skipping duplicate`);continue}if(r.add(s.id),!this.Ge.has(s.id))try{await this.Hc(s);}catch(n){this.registry.purge(s.id),this.ao(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.lo(s);}async Hc(t){this.Ge.has(t.id)&&this.lo(t.id);let e=[],r=Bn(this.registry,this.e,this.i,t.id,e),s=this.i.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.w("Failed to unsubscribe config listener",c);}throw a}this.Ge.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.ao();}lo(t){let e=this.Ge.get(t);if(e){this.registry.purge(t);for(let r of e.configSubscriptions)try{r();}catch(s){this.w("Failed to unsubscribe config listener",s);}e.dispose?.(),this.Ge.delete(t),this.ao();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(r.length===0)return;let s=e,n=new AbortController;for(let a of r)try{let l=a.handler({file:s,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:s}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",Re(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.Ge.keys()))this.lo(t);this.cn.destroy(),super.destroy();}ao(){for(let t of this.c)try{t();}catch{}}};function fu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Yo(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?Yo(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=fu(i);return typeof t=="object"&&t!==null?[e,Yo(t)]:[e,t]}))}function mu(o){return {ok:true,value:o}}function Zo(o){return {ok:false,error:o}}var gu="https://tlm.uploadcare.com/api/",Xo=class{constructor(i=gu){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return Zo(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return mu(s)}catch(s){return Zo(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return Zo(new Error(`Error fetching data from "${e}". Error: ${r}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Yo(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},vu=async(o,i)=>({success:true,data:i}),yu=async o=>vu(void 0,o),xr=class extends Xo{constructor(){super();}async sendEvent(i,t){let e=await yu(i);if(!e.success)throw console.error("TelemetryAPIService: events: body is invalid",e.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",i,t)}};var bu=20,D=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),M=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"}),Sr=class extends j{constructor(){super(...arguments);this.Xt=new Map;this.Ki=new Set;this.te=new Map;}bindTarget(t){return this.Ki.add(t),()=>{this.Ki.delete(t);}}on(t,e){let r=this.te.get(t);return r||(r=new Set,this.te.set(t,r)),r.add(e),()=>this.te.get(t)?.delete(e)}un(t,e){for(let s of this.Ki)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.te.get(t);if(r)for(let s of r)s(e);this.w?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,r={}){let{debounce:s}=r;if(typeof s!="number"&&!s){this.un(t,typeof e=="function"?e():e);return}this.Xt.has(t)&&window.clearTimeout(this.Xt.get(t));let n=typeof s=="number"?s:bu,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.un(t,l),this.Xt.delete(t);}catch(l){this.w?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.Xt.set(t,a);}destroy(){for(let t of this.Xt.values())window.clearTimeout(t);this.Ki.clear(),this.te.clear();}};var Hn="1.28.0-alpha.667";var Lt="blocks",Ut=Hn;var Ar=class extends j{constructor(t){super(t);this.Kc=pt.generateRandomUUID();this.Ct=structuredClone(J);this.co=false;this.uo=null;this.Ie=false;this.dn=new xr,this.St=new ee(10),this.addSub(this.e.sub(k("qualityInsights"),e=>{this.Ie=!!e;}));for(let e of Object.keys(this.Ct))this.addSub(this.e.sub(k(e),r=>{this.Ie&&(this.co&&this.Ct[e]!==r&&this.sendEvent({eventType:D.CHANGE_CONFIG}),this.jc(e,r));}));}Gc(t){t===D.INIT_SOLUTION&&!this.co&&(this.co=true);}jc(t,e){this.Ct[t]!==e&&(this.Ct[t]=e);}qc(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===D.INIT_SOLUTION||t.eventType===D.CHANGE_CONFIG)&&(r.config=this.Ct),{...r,appVersion:Ut,appName:Lt,sessionId:this.Kc,component:this.Wc,activity:this.Zc,projectPubkey:this.Ct.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.Yc,payload:{location:this.Xc,...e}}}Qc(t){return !!(t&&[M.CHANGE,M.COMMON_UPLOAD_PROGRESS,M.FILE_ADDED,M.FILE_REMOVED,M.FILE_UPLOAD_START,M.FILE_UPLOAD_PROGRESS,M.FILE_UPLOAD_SUCCESS,M.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Ie)return;let e=this.qc({eventType:t.eventType,payload:t.payload,config:t.config});this.Gc(t.eventType),!(this.Qc(t.eventType)||this.uo&&this.pn(this.uo,e))&&this.St.add(async()=>{this.uo=e,await this.dn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:D.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}pn(t,e){if(JSON.stringify(t)===JSON.stringify(e))return true;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return false;let r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return false;for(let n of r)if(!Object.hasOwn(e,n)||!this.pn(t[n],e[n]))return false;return true}get Yc(){return Date.now()}get Wc(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get Zc(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get Xc(){return location.origin}};var Kn=o=>{let i=new Intl.Locale(o),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t};var Tu=o=>o;var jn="plural:";function $e(o,i={},t={}){let{openToken:e="{{",closeToken:r="}}",transform:s=Tu}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);o=o.replaceAll(e+n+r,c);}return o}function Gn(o){let i=[],t=o.indexOf("{{");for(;t!==-1;){let e=o.indexOf("}}",t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(jn)){let s=o.substring(t+2,e).replace(jn,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a});}t=o.indexOf("{{",e);}return i}var qn="--uploadcare-blocks-window-height",gi=class o{static{this.clientsRegistry=new Set;}static{this.flush=$(()=>{document.documentElement.style.setProperty(qn,`${window.innerHeight}px`);},100);}static registerClient(i){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(i);}static unregisterClient(i){o.clientsRegistry.delete(i),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(qn);}};var kr=(o,i)=>new Intl.PluralRules(o).select(i);var Eu=o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=kr(r,t);return e(`${i}__${s}`)},Mr=o=>{let i=Eu(()=>t),t=(e,r={})=>{if(!e)return "";let n=o().read(qt(e))||e,a=Gn(n);for(let c of a)r[c.variable]=i(c.pluralKey,Number(r[c.countVariable]));return $e(n,r)};return t};var Cu=o=>o.tagName?.includes("-")??false,Ir=class{constructor(i){this.qe=new Set;this.ji=new Map;this.hn=false;this.We=i,this.We.addController(this);}hostDisconnected(){this.Gi?.(),this.Gi=void 0,this.qe.clear(),this.ji.clear();}hostUpdated(){if(!this.Gi&&this.We.has(k("testMode"))){let i=this.We.subConfigValue("testMode",t=>{this.hn=!!t,this.mn();});this.Gi=i;}this.Jc(),this.mn();}Jc(){let i=this.We,t=i.renderRoot??i;if(!t)return;let e=this.We,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Cu(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.qe.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.qe.add(n),this.ji.set(n,a);}for(let n of Array.from(this.qe))(!n.isConnected||r&&n.closest(r)!==e)&&(this.qe.delete(n),this.ji.delete(n));}mn(){if(!this.qe.size)return;let i=this.We.testId||"";for(let t of this.qe){let e=this.ji.get(t);e&&(this.hn?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var xu=Ie(ir()(Me(Ji(wt)))),C=class extends xu{constructor(){super();this.init$=zo();this.l10n=Mr(()=>this.sharedCtx);this.debugPrint=ar(()=>this.sharedCtx,this.constructor.name);this.i=bn(()=>this.sharedCtx);new Ir(this);}static{this.styleAttrs=[];}emit(t,e,r){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,r);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),gi.registerClient(this);}initCallback(){this.Z("*blocksRegistry",()=>new Set),this.Z("*pluginManager",t=>new Cr(t)),this.Z("*eventEmitter",t=>new Sr(t)),this.Z("*localeManager",t=>new yr(t)),this.Z("*modalManager",t=>new lr(t)),this.Z("*a11y",()=>new vr),this.Z("*clipboard",t=>new gr(t)),this.Z("*telemetryManager",t=>new Ar(t)),this.sub(qt("locale-id"),t=>{let e=Kn(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!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.ie("*modalManager",false)}get telemetryManager(){return this.ie("*telemetryManager")}get localeManager(){return this.ie("*localeManager")}get a11y(){return this.ie("*a11y")}get clipboardLayer(){return this.ie("*clipboard")}get blocksRegistry(){return this.ie("*blocksRegistry")}get eventEmitter(){return this.ie("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),gi.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.eu(),H.deleteCtx(this.ctxName);}gn(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Z(t,e){let r=this.gn();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.i);this.add(t,s,true),r.set(t,s);return}}eu(){let t=this.gn();for(let[e,r]of t.entries())r?.destroy?.(),this.pub(e,null);t.clear();}ie(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){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(t,{uuid:sr(t),cdnUrlModifiers:Ao(t),fileName:or(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?$e(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.ze){let t={};this.ze=new Proxy(t,{set:(e,r,s)=>{if(typeof r!="string"||!(r in J))return false;let n=r,a=k(n);return this.has(a)||this.add(a,J[n]),this.$[a]=s,true},get:(e,r)=>{let s=k(r);return this.has(s)||this.add(s,J[r]),this.$[s]}});}return this.ze}subConfigValue(t,e){let r=k(t);return this.has(r)||this.add(r,J[t]),this.sub(r,e)}};var Rt={ATTRIBUTE:1,CHILD:2},ft=o=>(...i)=>({jr:o,values:i}),Tt=class{constructor(i){}get W(){return this.f.W}Gr(i,t,e){this.qi=i,this.f=t,this.tu=e;}Pc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var be=class extends Tt{constructor(i){if(super(i),this.it=U,i.type!==Rt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===U||i==null)return this.vn=void 0,this.it=i;if(i===it)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.vn;this.it=i;let t=[i];return t.raw=t,this.vn={Ve:this.constructor.resultType,strings:t,values:[]}}};be.directiveName="unsafeHTML",be.resultType=1;var vi=class extends be{};vi.directiveName="unsafeSVG",vi.resultType=2;var De=ft(vi);var Wn="<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 Wt=class extends C{constructor(){super(...arguments);this.init$=Un(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 t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return v`${De(Wn)}`}};var Zn=o=>typeof o!="number"?0:Math.floor(o/1e3),Yn=(o,{threshold:i})=>{let{secureExpire:t}=o,e=Zn(Date.now()),r=Number(t),s=Zn(i);return e+s>=r};var Or=class extends j{constructor(){super(...arguments);this.Ze=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.He;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.Ze||Yn(this.Ze,{threshold:s})){this.Ze?this.w("Secure signature is expired. Resolving a new one..."):this.w("Secure signature is not set yet.");try{let n=await r();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.w("Secure signature resolved:",n),this.w("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.Ze=n):(this.w("Secure signature resolver returned nothing."),this.Ze=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.i.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Ze}return t&&e?(this.w("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.Ze=null;}};var Qo=(o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var Jo=(o,i)=>{let t=o.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}};var ts=(o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=br([...t?mi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let a=Wo(s,r),l=zn(n,r);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}};var es=(o,i)=>{let t=i.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:o}}};var $t=1e3,we=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),yi=o=>Math.ceil(o*100)/100,Xn=(o,i=we.AUTO)=>{let t=i===we.AUTO;if(i===we.BYTE||t&&o<$t**1){let r=kr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===we.KB||t&&o<$t**2?`${yi(o/$t**1)} KB`:i===we.MB||t&&o<$t**3?`${yi(o/$t**2)} MB`:i===we.GB||t&&o<$t**4?`${yi(o/$t**3)} GB`:i===we.TB||t&&o<$t**5?`${yi(o/$t**4)} TB`:`${yi(o/$t**5)} PB`};var is=(o,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Xn(t)}),payload:{entry:o}}};var rs=(o,i)=>{let{internalId:t}=o;if(!i.g.hasItem(t))return;let r=i.g.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof st)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:o,error:r}};if(r instanceof Le)return {type:"NETWORK_ERROR",message:r.message,payload:{entry:o,error:r}};let s=r instanceof Error?r:new Error("Unknown error",{cause:r});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}};var Fe={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."},Su=o=>typeof o=="function"?{runOn:"change",validator:o}:o,Pr=class extends j{constructor(t){super(t);this.iu=[es,ts,is,rs];this.ru=[Jo,Qo];this.St=new ee(20);this.yn=$(()=>{this.St.run();},500);this.Oe=false;this.At=new Map;let e=$(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(k("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(k("multipleMin"),e)),this.addSub(this.e.sub(k("multipleMax"),e)),this.addSub(this.e.sub(k("multiple"),e)),this.addSub(this.e.sub(k("imgOnly"),e)),this.addSub(this.e.sub(k("accept"),e)),this.addSub(this.e.sub(k("validationConcurrency"),r=>{this.St.concurrency=r;}));}get g(){return this.i.uploadCollection}runFileValidators(t,e){if(this.Oe)return;let r=e??this.g.items();for(let s of r){let n=this.g.read(s);n&&this.ou(n,t);}}runCollectionValidators(){if(this.Oe)return;let t=this.i.api,e=t.getOutputCollectionState(),r=[],s=this.He.collectionValidators;for(let n of [...this.ru,...s])try{let a=n(e,t);if(!a)continue;a&&(r.push(this.bn(a)),a.message||console.warn(Fe.MISSING_ERROR_MESSAGE));}catch(a){console.warn(Fe.COLLECTION_VALIDATION_FAILED,a);}this.e.pub("*collectionErrors",r),r.length>0&&this.i.eventEmitter.emit(M.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.At.get(t.uid);e&&(e.abortController?.abort(),this.At.delete(t.uid));}async ou(t,e){if(this.Oe)return;let r=this.i.api,s=this.wn(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.Oe||(await n,this.Oe))return;let l=this.su(t,e);if(l.length===0||!this.g.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=r.getOutputItem(t.uid),d=new AbortController;s.abortController=d;let u=this.He.validationTimeout,h=this.Tn(),f=new Set(l.map(w=>w.validator)),g=[];for(let w of h)if(!f.has(w.validator)){let E=s.lastErrorThrownByValidator.get(w.validator);E&&g.push(E);}let b=l.map(w=>async()=>{if(this.Oe)return;let E=setTimeout(()=>{s.skippedValidators.add(w.validator),d.abort(),console.warn(Fe.FILE_VALIDATION_TIMEOUT);},u);try{let T=await w.validator(c,r,{signal:d.signal});if(!T||d.signal.aborted){s.lastErrorThrownByValidator.set(w.validator,void 0);return}let A=this.bn(T);s.lastErrorThrownByValidator.set(w.validator,A),g.push(A),T.message||console.warn(Fe.MISSING_ERROR_MESSAGE);}catch(T){d.signal.aborted||(s.skippedValidators.add(w.validator),console.warn(Fe.FILE_VALIDATION_FAILED,T),this.i.telemetryManager.sendEventError(T,`file validator. ${Fe.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(E),w.runOn!=="change"&&s.skippedValidators.add(w.validator);}});if(this.yn(),await this.St.add(async()=>{this.Oe||(t.setValue("isQueuedForValidation",false),await Promise.all(b.map(w=>w())).catch(()=>{}));},{autoRun:false}),d.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}bn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}wn(t){let e=this.At.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.At.set(t.uid,r),r}Tn(){let t=this.He.fileValidators;return [...this.iu,...t].map(Su)}su(t,e){let r=this.wn(t);return this.Tn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Oe=true,this.yn.cancel();for(let t of this.At.values())t.abortController?.abort(),t.promise=void 0;this.At.clear();}};var Qn="[Typed State] Wrong property name: ",Lr=class{constructor(i){this.J=pt.generateFastUid(),this.Y=H.registerCtx(i,this.J);}get uid(){return this.J}setValue(i,t){if(!this.Y.has(i)){console.warn(`${Qn}${String(i)}`);return}this.Y.read(i)!==t&&this.Y.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Y.has(i)||console.warn(`${Qn}${String(i)}`),this.Y.read(i)}subscribe(i,t){return this.Y.sub(i,t)}destroy(){H.deleteCtx(this.J);}};var Ur=class o{constructor(i){this.Pe=Object.create(null);this.Wi=new Set;this.Zi=new Set;this.ye=new Set;this.po=new Set;this.ho=new Set;this.kt=new Set;this.Cn=i.initialValue,this.J=pt.generateFastUid(),this.Y=H.registerCtx({},this.J),this.En=i.watchList||[];let t=Object.create(null);this.xn=(e,r)=>{this.Qt&&window.clearTimeout(this.Qt),t[e]||(t[e]=new Set),t[e].add(r),this.Qt=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Wi.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Sn();},i.handler&&this.observeCollection(i.handler);}static{this.nu=1e4;}q(){this.Jt&&window.clearTimeout(this.Jt),this.Jt=window.setTimeout(()=>{let i=new Set(this.ho),t=new Set(this.po);this.ho.clear(),this.po.clear();for(let e of this.Zi)e?.([...this.ye],i,t);this.Sn();});}Sn(){this.kt.size!==0&&(this.ei&&window.clearTimeout(this.ei),this.ei=window.setTimeout(()=>{let i=[...this.kt];this.kt.clear();for(let t of i)t.destroy();},o.nu));}observeCollection(i){return this.Zi.add(i),this.ye.size>0&&this.q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Zi.delete(i);}add(i){let t=new Lr(this.Cn);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.ye.add(t.uid),this.q(),this.Y.add(t.uid,t),this.ho.add(t),this.En.forEach(e=>{this.Pe[t.uid]||(this.Pe[t.uid]=[]),this.Pe[t.uid]?.push(t.subscribe(e,()=>{this.xn(e,t.uid);}));}),t.uid}hasItem(i){return this.ye.has(i)}read(i){return this.Y.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let r=this.read(i);if(!r)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);r.setValue(t,e);}remove(i){let t=this.read(i);t&&(this.po.add(t),this.kt.add(t)),this.ye.delete(i),this.q(),this.Y.pub(i,void 0),this.Pe[i]?.forEach(e=>{e();}),delete this.Pe[i];}clearAll(){this.ye.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Wi.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Wi.delete(i);}findItems(i){let t=[];return this.ye.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.ye]}get size(){return this.ye.size}destroy(){this.Qt&&window.clearTimeout(this.Qt),this.Jt&&window.clearTimeout(this.Jt),this.ei&&window.clearTimeout(this.ei);for(let i of this.kt)i.destroy();this.kt.clear(),H.deleteCtx(this.J),this.Wi=new Set,this.Zi=new Set;for(let i of Object.keys(this.Pe))this.Pe[i]?.forEach(t=>{t();}),delete this.Pe[i];}};var L=Object.freeze({PHOTO:"photo",VIDEO:"video"}),Et=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Jn=o=>({isVideoRecordingEnabled:K(o.cameraModes).includes(L.VIDEO),isPhotoEnabled:K(o.cameraModes).includes(L.PHOTO)});var ta=(o,i)=>{for(let t of o)if(i(t))return t};var os=(o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),a=()=>{for(let l of o)if(i(l)){clearTimeout(n),r(l);return}s=requestAnimationFrame(a);};a();});function Rr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}var Au=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,ku=new RegExp(`^/?(${Au.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),ea=({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(pi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=ku.exec(r.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var Ct=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Mu=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),N=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Mu,...Ct});var $r=o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e));function ia(o){let i=new Map;return (...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s}}var ra=new Set;function Dr(o){ra.has(o)||(ra.add(o),console.warn(o));}function Iu(o){let i=false;return setTimeout(()=>{i=true;},0),e=>((...r)=>(i&&Dr(o),e(...r)))}function oa(o){let i={},t=o.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>o.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>$r(o),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},r=Iu("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(e)){let a=s,c=ia(r(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var Fr=class extends j{constructor(){super(...arguments);this.au=Mr(()=>this.e);this.addFileFromUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.g.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??N.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.g.add({uuid:t,fileName:r??null,silent:e??false,source:s??N.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=ea({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.g.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??N.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let a=this.g.add({file:t,isImage:Re(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??N.API,fullPath:n??null});return this.getOutputItem(a)};this.removeFileByInternalId=t=>{if(!this.g.read(t))throw new Error(`File with internalId ${t} not found`);this.g.remove(t);};this.uploadAll=()=>{let t=this.g.items().filter(e=>{let r=this.g.read(e);return r?!r.getValue("isRemoved")&&!r.getValue("isUploading")&&!r.getValue("fileInfo")&&r.getValue("errors").length===0&&!r.getValue("isValidationPending")&&!r.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.i.eventEmitter.emit(M.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=Bt(br([this.cfg.accept??"",...this.cfg.imgOnly?mi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),Rr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=Jn(this.cfg);t.modeCamera===L.PHOTO&&n?s.accept=fi:t.modeCamera===L.VIDEO&&a?s.accept=qo:s.accept=[fi,a&&qo].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?N.CAMERA:N.LOCAL});}),this.e.pub("*currentActivity",F.UPLOAD_LIST),this.i.modalManager?.open(F.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.g.size>0&&!t)this.e.pub("*currentActivity",F.UPLOAD_LIST),this.i.modalManager?.open(F.UPLOAD_LIST);else if(this.An?.length===1){let e=this.An[0];this.fo().then(()=>{let r=this.i.pluginManager.snapshot().sources,s=r.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(r.find(l=>l.id===n[0])??s).onSelect():(this.e.pub("*currentActivity",F.START_FROM),this.i.modalManager?.open(F.START_FROM));return}this.e.read("*currentActivity")&&this.i.modalManager?.open(this.e.read("*currentActivity"));});}else this.e.pub("*currentActivity",F.START_FROM),this.i.modalManager?.open(F.START_FROM);};this.doneFlow=()=>{let t=ta(this.i.blocksRegistry,e=>"doneActivity"in e);t&&(this.e.pub("*currentActivity",t.doneActivity),this.e.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.e.read("*currentActivity")||this.i.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{this.fo().then(()=>{this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t),os(this.i.blocksRegistry,r=>r.activityType===t,{onTimeout:()=>console.warn(`Activity type "${t}" not found in the context`),timeout:100});});};this.on=(t,e)=>this.i.eventEmitter.on(t,e);this.getCurrentActivity=()=>this.e.read("*currentActivity");this.historyBack=()=>{this.e.read("*historyBack")?.();};this.setModalState=t=>{this.fo().then(()=>{if(!t){this.i.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null);return}let e=this.e.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return os(this.i.blocksRegistry,r=>r.activityType===e,{onTimeout:()=>console.warn(`Activity block "${e}" not found in the context`)}).then(()=>{this.i.modalManager?.open(e);})});};}get g(){return this.i.uploadCollection}get cfg(){return this.He}get l10n(){return this.au}removeAllFiles(){this.g.clearAll();}getOutputItem(t){let e=H.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let r=e.store,s=r.fileInfo,n=r.isRemoved?"removed":r.errors.length>0?"failed":r.fileInfo?"success":r.isUploading?"uploading":"idle";return {uuid:s?.uuid??r.uuid??null,internalId:t,name:s?.originalFilename??r.fileName,size:s?.size??r.fileSize,isImage:s?.isImage??r.isImage,mimeType:s?.mimeType??r.mimeType,file:r.file,externalUrl:r.externalUrl,cdnUrlModifiers:r.cdnUrlModifiers,cdnUrl:r.cdnUrl??s?.cdnUrl??null,fullPath:r.fullPath,uploadProgress:r.uploadProgress,fileInfo:s??null,metadata:r.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:r.isValidationPending,errors:r.errors,status:n,source:r?.source}}getOutputCollectionState(){return oa(this.i)}async fo(){return (await this.i.wait("pluginManager")).pluginsReady()}get An(){let t=[];return this.cfg.sourceList&&(t=Z(this.cfg.sourceList)),t}};var sa={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 bi=33.333333333333336,I=1,ss=24,na=6;function oe(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}function mt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return oe(t,i),t}function aa(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*s+1.5*c,r+l*n+1.5*d-24*t*d],h=[e+a*s+1.5*c,r+l*n+1.5*d],f=[e+a*s-24*t*c+1.5*c,r+l*n+1.5*d],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,b=[h[0],h[1]];return {d:g,center:b}}function la(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,g;a?(f=[e+c*s-34*t/2,r+d*n+1.5*h],g=[e+c*s+34*t/2,r+d*n+1.5*h]):(f=[e+c*s+1.5*u,r+d*n-34*t/2],g=[e+c*s+1.5*u,r+d*n+34*t/2]);let b=`M ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,w=[(f[0]+g[0])/2,(f[1]+g[1])/2];return {d:b,center:w}}function ca(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}function ua({rect:o,delta:[i,t],imageBox:e}){return Ne({...o,x:o.x+i,y:o.y+t},e)}function Ne(o,i){let{x:t}=o,{y:e}=o;return o.x<i.x?t=i.x:o.x+o.width>i.x+i.width&&(t=i.x+i.width-o.width),o.y<i.y?e=i.y:o.y+o.height>i.y+i.height&&(e=i.y+i.height-o.height),{...o,x:t,y:e}}function Ou({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;s+=r,a-=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,a=o.y+o.height-s,t&&(n=a*t,l=o.x+o.width/2-n/2)),l<=e.x&&(l=e.x,s=o.y+o.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y+o.height-a),a<I&&(a=I,t&&(n=a*t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),n<I&&(n=I,t&&(a=n/t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),{x:l,y:s,width:n,height:a}}function Pu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;s+=r,n-=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(a=n/t,l=o.y+o.height/2-a/2)),l<=e.y&&(l=e.y,s=o.x+o.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x+o.width-n),a<I&&(a=I,t&&(n=a*t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),n<I&&(n=I,t&&(a=n/t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),{x:s,y:l,width:n,height:a}}function Lu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;a+=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=o.x+o.width/2-n/2),l<=e.x&&(l=e.x,s=o.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y),a<I&&(a=I,t&&(n=a*t),l=o.x+o.width/2-n/2),n<I&&(n=I,t&&(a=n/t),l=o.x+o.width/2-n/2),{x:l,y:s,width:n,height:a}}function Uu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;n+=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=o.y+o.height/2-a/2),l<=e.y&&(l=e.y,s=o.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x),a<I&&(a=I,t&&(n=a*t),l=o.y+o.height/2-a/2),n<I&&(n=I,t&&(a=n/t),l=o.y+o.height/2-a/2),{x:s,y:l,width:n,height:a}}function Ru({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+s<e.y&&(s=e.y-a),n+=r,l-=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x+o.width-l,a=e.y)):t&&(r=c*t-l,l=l+r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y+o.height-c)),c<I&&(c=I,t&&(l=c*t),n=o.x+o.width-l,a=o.y+o.height-c),l<I&&(l=I,t&&(c=l/t),n=o.x+o.width-l,a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function $u({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x,a=e.y)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y+o.height-c)),c<I&&(c=I,t&&(l=c*t),a=o.y+o.height-c),l<I&&(l=I,t&&(c=l/t),a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function Du({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=r,l-=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x+o.width-l,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y)),c<I&&(c=I,t&&(l=c*t),n=o.x+o.width-l),l<I&&(l=I,t&&(c=l/t),n=o.x+o.width-l),{x:n,y:a,width:l,height:c}}function Fu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y)),c<I&&(c=I,t&&(l=c*t)),l<I&&(l=I,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function da({direction:o,...i}){switch(o){case "n":return Ou(i);case "w":return Pu(i);case "s":return Lu(i);case "e":return Uu(i);case "nw":return Ru(i);case "ne":return $u(i);case "sw":return Du(i);case "se":return Fu(i);default:return i.rect}}function pa(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}function ha(o,i){return o.x>=i.x&&o.y>=i.y&&o.x+o.width<=i.x+i.width&&o.y+o.height<=i.y+i.height}function fa(o,i){return Math.abs(o.width/o.height-i)<.1}function _e({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}function ma(o,i,t){let e=o/i,r,s;e>t?(r=Math.round(i*t),s=i):(r=o,s=Math.round(o/t));let n=Math.round((o-r)/2),a=Math.round((i-s)/2);return n+r>o&&(r=o-n),a+s>i&&(s=i-a),{x:n,y:a,width:r,height:s}}function ze(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}function se(o,i,t){return Math.min(Math.max(o,i),t)}var wi=["free"],Nr=o=>{let i=Z(o);if(!i||i.length===0)return [];let t=[];for(let e of i){let r=e.trim();if(!r)continue;let s=r.indexOf(":");if(s===-1&&!wi.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),a=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!wi.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:pt.generateFastUid(),type:"aspect-ratio",width:wi.includes(r)?0:n,height:wi.includes(r)?0:a,hasFreeform:wi.includes(r)});}return t},ga=(o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(r-d);u<n&&(n=u,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(r-c)/c>e)return null}return s};function va(o){return $o({...o,libraryName:Lt,libraryVersion:Ut})}var ya="active",Be="___ACTIVITY_IS_ACTIVE___",ba,x=class o extends(ba=C,ba){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Bo(this);this.lu=$(this.cu.bind(this),10);}kn(){let t=o.ti.get(this);this[Be]=false,this.removeAttribute(ya),t?.deactivateCallback?.();}uu(){let t=o.ti.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Be]=true,this.setAttribute(ya,""),t?.activateCallback?.(),this.lu(),this.emit(M.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Be]?this.kn():this.activityType===t&&!this[Be]&&this.uu();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let r=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=r??null;}t||(this.$["*history"]=[]);}));}cu(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}Mn(){return !!this.activityType&&o.ti.has(this)}static{this.ti=new Map;}get isActivityActive(){return !!this[Be]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ti.set(this,{activateCallback:r,deactivateCallback:s});}du(){this.isActivityActive&&this.kn(),o.ti.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Mn()&&this.du();}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 t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let r=!!e;e&&(r=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=r?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};x.activities=F;var R=class o extends x{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Yi=false;this.init$=Ho(this);this.vo=$(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.gu(e);},300);this.fu=(t,e,r)=>{if(this.isConnected){(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(M.FILE_ADDED,this.api.getOutputItem(s.uid)),this.i.wait("pluginManager").then(n=>n.runOnAddHooks(s));this.validationManager.runCollectionValidators();for(let s of r){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(M.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Pn(),this.vo();}};this.mu=t=>{if(!this.isConnected)return;this.vo();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([s])=>["file","uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(r.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=r.filter(n=>t.fileInfo?.has(n)&&!!H.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Pn();}if(t.isUploading)for(let s of t.isUploading){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=H.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(M.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.vu();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=H.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(M.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(M.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(M.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(M.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Pn=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(M.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get pu(){return this.hasBlockInCtx(t=>t instanceof o?t.Yi&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Z("*uploadCollection",()=>new Ur({initialValue:sa,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Z("*secureUploadsManager",t=>new Or(t)),this.Z("*validationManager",t=>new Pr(t)),this.Z("*publicApi",t=>new Fr(t)),!this.pu&&this.couldBeCtxOwner&&this.hu();}getAPI(){return this.api}get validationManager(){return this.ie("*validationManager")}get api(){return this.ie("*publicApi")}get uploadCollection(){return this.ie("*uploadCollection")}get secureUploadsManager(){return this.ie("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Yi&&this.In(),this.vo.cancel();}connectedCallback(){super.connectedCallback(),this.Yi&&this.On();}hu(){this.Yi=true,this.On(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}On(){this.In(),this.mo=this.uploadCollection.observeCollection(this.fu),this.go=this.uploadCollection.observeProperties(this.mu);}In(){this.go?.(),this.mo?.(),this.go=void 0,this.mo=void 0;}async gu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await Ln(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(M.GROUP_CREATED,a),this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}vu(){let t=Nr(this.cfg.cropPreset);if(!t)return;let[e]=t,r=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 r){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 e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=ma(a,l,c),u=rt(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:u,cdnUrl:W(h,u)});}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:va,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.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 $r(this.i)}};R.extSrcList=Object.freeze({...Ct});R.sourceTypes=Object.freeze({...N});var ne=class extends C{constructor(){super(...arguments);this.name="";this.Xi="";this.ii=null;this.Ln=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Ln=e,this.yo();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.yo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.yo();}yo(){if(!this.name){this.Xi="",this.ii=null;return}let e=this.i.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.ii=e.svg,this.Xi="";return}this.ii=null;let r=`#uc-icon-${this.name}`,s=this.Ln?.(this.name);this.Xi=s??r;}render(){return this.ii?v`${this.yield("",v`${De(this.ii)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Xi}></use></svg>`)} `}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};p([y({type:String})],ne.prototype,"name",2),p([m()],ne.prototype,"Xi",2),p([m()],ne.prototype,"ii",2);var wa=o=>[...new Set(o)];var Te="--uc-img-",ns="unresolved";var as=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ls=3e3,cs=5e3,us=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Vu="https://ucarecdn.com",He=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Vu},"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 _r=class extends Me(Ie(wt)){constructor(){super();this.Mt={};this.c=new Map;this.It=null;this.Qi=null;for(let t in He){let e=He[t];this.Mt[Te+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.Mt[Te+t]}set$$(t){for(let e in t){let r=Te+e,s=t[e];this.Mt[r]=s,this.q(r,s);}}sub$$(t,e){let r=Te+t;this.c.has(r)||this.c.set(r,new Set),this.c.get(r)?.add(e);let s=this.Mt[r];s!==null&&s!==""&&e(s);}q(t,e){this.c.has(t)&&this.c.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${Lt}/${Ut}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;He[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.It=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.It?.unobserve(t));});},r),this.It.observe(t),this.Qi||(this.Qi=new Set),this.Qi.add(t);}connectedCallback(){super.connectedCallback(),this.yu();}yu(){for(let t in He){let e=Te+t,r=this.getCssData(e,true);r!=null&&(this.Mt[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.It&&(this.Qi?.forEach(t=>{this.It?.unobserve(t);}),this.It=null),this.c.clear();}static get observedAttributes(){return Object.keys(He)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Te+t;this.Mt[s]=r,this.q(s,r);});}};var Ta=o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var Hr=class extends _r{constructor(){super(...arguments);this.be=new Image;this.pe=new Image;}Rn(t){return !t.includes("//")&&!as&&(t=new URL(t,document.baseURI).href),t}Ji(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let n=parseInt(r,10);return Number(n)>cs&&this.Un?cs+s:Number(n)>ls&&!this.Un?ls+s:t}bu(t,e){let r={format:this.bo("format"),quality:this.bo("quality"),resize:this.Ji(t),blur:e,"cdn-operations":this.bo("cdn-operations")??void 0,analytics:this.analyticsParams()};return rt(...Ta(r))}bo(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}re(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(as&&r&&!r.includes("//"))return this.ri(r);let s=this.bu(t,e),n=this.$$("cdn-cname"),a=n;if(r.startsWith(String(n)))return W(r,s);let l=this.$$("uuid");if(a&&l)return this.ri(W(Qt(a,l),s));if(l)return this.ri(W(Qt(a,l),s));let c=this.$$("proxy-cname");if(c)return this.ri(W(c,s,this.Rn(r)));let d=this.$$("pubkey");if(d)return this.ri(W(`https://${d}.ucr.io/`,s,this.Rn(r)))}ri(t){let e=this.$$("secure-delivery-proxy");return e?$e(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}Ot(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=r?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}wu(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.we||(this.wo({elNode:this.be}),this.appendChild(this.be)),this.be}get er(){return this.we?{type:us.PREVIEW,img:this.pe}:{type:us.MAIN,img:this.img}}get we(){return this.$$("is-preview-blur")}get $n(){return this.$$("is-background-for")}get Dn(){let t=this.$$("breakpoints");if(t){let e=Z(t);return wa(e.map(r=>parseInt(r,10)))}else return null}get Un(){return this.$$("format").toLowerCase()==="jpeg"}Fn(t){let e=new Set;e.add(`url("${this.re(this.Ot(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.re(this.Ot(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.re(this.Ot(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}Nn(){let t=new Set;return this.Dn?this.Dn.forEach(e=>{t.add(`${this.re(`${e}x`)} ${this.Ji(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.re(`${e*2}x`)} ${this.Ji(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.re(`${e*3}x`)} ${this.Ji(`${e*3}w`)}`);}):(t.add(`${this.re(this.Ot(this.er.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.re(this.Ot(this.er.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.re(this.Ot(this.er.img,3))} 3x`)),[...t].join()}Vn(){return this.re()}get _n(){return this.re("100x","100")}Tu(){let t=this.$n;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.Fn(e);}):this.Fn(e);});}Eu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}wo({elNode:t}){this.wu(t),this.initAttributes(t);}To({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.wo({elNode:r}),r.setAttribute(ns,""),r.addEventListener("load",()=>{r.removeAttribute(ns),s(r);}),r.addEventListener("error",()=>{n(false);}),this.Eu({elNode:r,src:t,srcset:e});})}async xu(){if(this.$$("intersection")){this.we&&(this.wo({elNode:this.pe}),this.appendChild(this.pe)),this.initIntersection(this.er.img,async()=>{this.we&&(this.pe.src=this._n);try{await this.To({src:this.Vn(),srcset:this.Nn(),elNode:this.be}),this.we&&await this.pe.remove(),this.appendChild(this.be);}catch{this.we&&await this.pe?.remove(),this.appendChild(this.be);}});return}try{this.we&&(await this.To({src:this._n,elNode:this.pe}),this.appendChild(this.pe)),await this.To({src:this.Vn(),srcset:this.Nn(),elNode:this.be}),this.we&&await this.pe?.remove(),this.appendChild(this.be);}catch{this.we&&await this.pe?.remove(),this.appendChild(this.be);}}init(){this.$n?this.Tu():this.xu();}};var ds=class extends Hr{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Nu}=en,Ea=o=>o;var xa=o=>o.strings===void 0,Ca=()=>document.createComment(""),Ke=(o,i,t)=>{let e=o.ve.parentNode,r=i===void 0?o.bt:i.ve;if(t===void 0){let s=e.insertBefore(Ca(),r),n=e.insertBefore(Ca(),r);t=new Nu(s,n,o,o.options);}else {let s=t.bt.nextSibling,n=t.f,a=n!==o;if(a){let l;t.Cu?.(o),t.f=o,t.Li!==void 0&&(l=o.W)!==n.W&&t.Li(l);}if(s!==r||a){let l=t.ve;for(;l!==s;){let c=Ea(l).nextSibling;Ea(e).insertBefore(l,r),l=c;}}}return t},ae=(o,i,t=o)=>(o.ce(i,t),o),_u={},Sa=(o,i=_u)=>o.r=i,Aa=o=>o.r,Kr=o=>{o.wt(),o.ve.remove();};var Ti=(o,i)=>{let t=o.le;if(t===void 0)return false;for(let e of t)e.Ks?.(i,false),Ti(e,i);return true},jr=o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.le,t.delete(o),o=i;}while(t?.size===0)},ka=o=>{for(let i;i=o.f;o=i){let t=i.le;if(t===void 0)i.le=t=new Set;else if(t.has(o))break;t.add(o),Hu(i);}};function zu(o){this.le!==void 0?(jr(this),this.f=o,ka(this)):this.f=o;}function Bu(o,i=false,t=0){let e=this.r,r=this.le;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Ti(e[s],false),jr(e[s]);else e!=null&&(Ti(e,false),jr(e));else Ti(this,o);}var Hu=o=>{o.type==Rt.CHILD&&(o.Li??=Bu,o.Cu??=zu);},Gr=class extends Tt{constructor(){super(...arguments),this.le=void 0;}Gr(i,t,e){super.Gr(i,t,e),ka(this),this.isConnected=i.W;}Ks(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Ti(this,i),jr(this));}setValue(i){if(xa(this.qi))this.qi.ce(i,this);else {let t=[...this.qi.r];t[this.tu]=i,this.qi.ce(t,this,0);}}disconnected(){}reconnected(){}};var S=()=>new hs,hs=class{},ps=new WeakMap,O=ft(class extends Gr{render(o){return U}update(o,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=o.options?.host,this.rt(this.ct=o.element)),U}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=ps.get(i);t===void 0&&(t=new WeakMap,ps.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,o),o!==void 0&&this.G.call(this.ht,o);}else this.G.value=o;}get lt(){return typeof this.G=="function"?ps.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});var fs=null,Ei=class extends C{constructor(){super(...arguments);this.dialogEl=S();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);};this.Su=()=>{this.closeDialog();};this.Au=t=>{this.Eo=t.target;};this.ku=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Eo&&this.closeDialog();};this.oi=({id:t})=>{t===this.id?(fs=t,this.show(),this.emit(M.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.si=({id:t})=>{t===this.id&&(this.hide(),this.emit(M.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.Bn=t=>{this.hide(),fs===this.id&&this.emit(M.MODAL_CLOSE,{modalId:fs,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(Y.OPEN,this.oi),this.modalManager?.subscribe(Y.CLOSE,this.si),this.modalManager?.subscribe(Y.CLOSE_ALL,this.Bn);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Eo=void 0,this.modalManager?.unsubscribe(Y.OPEN,this.oi),this.modalManager?.unsubscribe(Y.CLOSE,this.si),this.modalManager?.unsubscribe(Y.CLOSE_ALL,this.Bn);}Mu(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Su),this.dialogEl.value?.addEventListener("mousedown",this.Au),this.dialogEl.value?.addEventListener("mouseup",this.ku);}render(){return v`<dialog ${O(this.Mu)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],Ei.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ei.prototype,"blockBodyScrolling",2);var qr=class extends R{constructor(){super(...arguments);this.z=null;this.tr=null;}get zn(){return this.nameAttrValue??this.ctxName}Hn(){let t=document.createElement("input");return t.type="text",t.name=this.zn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Rr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.z=this.Hn(),this.appendChild(this.z),this.sub("*collectionState",t=>{if(!t)return;if(!this.tr){let n=document.createElement("div");this.appendChild(n),this.tr=n;}if(!this.z){let n=this.Hn();this.appendChild(n),this.z=n;}if(this.tr.innerHTML="",t.status==="uploading"||t.status==="idle"){this.z.value="",this.z.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.z.value="",this.z.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.z.value=e.cdnUrl??"",this.z.setCustomValidity("");return}let r=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&r.length===1&&r[0]){this.z.value=r[0],this.z.setCustomValidity("");return}this.z.remove(),this.z=null;let s=new DocumentFragment;for(let n of r){let a=document.createElement("input");a.type="hidden",a.name=`${this.zn}[]`,a.value=n,s.appendChild(a);}this.tr.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],qr.prototype,"nameAttrValue",2);var ms=class extends C{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<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 je=class extends C{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.oe=0;this.ir=S();this.Kn=()=>{let t=this.ir.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.oe>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.oe=this.xo(this.value),this.Co(),this.ir.value?.addEventListener("animationiteration",this.Kn);}updated(t){if(super.updated(t),t.has("value")){let e=this.xo(this.value);if(!this.visible)this.oe=e;else {let r=Math.max(this.oe,e);r!==this.oe&&(this.oe=r,this.Co());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Co():this.oe=this.xo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.ir.value?.removeEventListener("animationiteration",this.Kn);}xo(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Co(){this.visible&&this.style.setProperty("--l-progress-value",this.oe.toString());}render(){return v`<div ${O(this.ir)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],je.prototype,"hasFileName",2),p([y({type:Number})],je.prototype,"value",2),p([y({type:Boolean,reflect:true})],je.prototype,"visible",2);var Ci=class extends R{constructor(){super();this.he=false;this.Pt=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this.So=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.he=t;}),this.sub("*commonProgress",t=>{this.Pt=t;});}updated(t){super.updated(t),t.has("visible")&&(this.he?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.So?.(),this.So=void 0;}render(){return v`<uc-progress-bar .value=${this.Pt} .visible=${this.he}></uc-progress-bar>`}};p([m()],Ci.prototype,"he",2),p([m()],Ci.prototype,"Pt",2);var Ge=class extends C{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Iu=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}render(){return v`<select @change=${this.Iu} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],Ge.prototype,"value",2),p([y({type:Boolean,reflect:true})],Ge.prototype,"disabled",2),p([y({type:Array,attribute:false})],Ge.prototype,"options",2);var qe=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ao="default";this.ko="";}willUpdate(t){super.willUpdate(t),t.has("source")&&this.Ou(this.source);}Ou(t){if(!t){this.ko="",this.Ao="default";return}let{label:e,icon:r,id:s}=t;this.ko=e,this.Ao=r??s??"default";}activate(){this.source&&this.source.onClick();}render(){return v`<button type="button" @click=${this.activate}><uc-icon name=${this.Ao}></uc-icon><div class="uc-txt">${this.l10n(this.ko)}</div></button>`}};p([y({attribute:false})],qe.prototype,"source",2),p([m()],qe.prototype,"Ao",2),p([m()],qe.prototype,"ko",2);var xi=class extends R{constructor(){super(...arguments);this.jn=[];this.Me=[];this.wrap=false;}initCallback(){super.initCallback(),this.subConfigValue("sourceList",e=>{this.jn=Z(e),this.Gn();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Gn()));}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}Gn(){let e=this.i.pluginManager?.snapshot().sources??[],r=new Map(e.map(n=>[n.id,n])),s=[];this.jn.forEach(n=>{let a=this.Pu(n,r);if(a.length!==1||a[0]!==n){for(let d of a){let u=r.get(d);u&&s.push(this.qn(u));}return}let c=r.get(n);c&&s.push(this.qn(c));}),this.Me=s;}Pu(t,e){let r=e.get(t);return r?.expand?r.expand():[t]}qn(t){return {id:t.id,label:t.label,icon:t.icon,onClick:()=>t.onSelect()}}render(){return v`${this.Me.map(t=>v`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};p([m()],xi.prototype,"Me",2),p([y({type:Boolean,attribute:"wrap",noAccessor:true})],xi.prototype,"wrap",2);var gs=class extends C{render(){return v`<div class="uc-spinner"></div>`}};var It="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ee(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=n=>s(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=It);}}}function Si(o){let i=[];for(let s of o){let n=Ee(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function vs(o,i=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let r=new Image,s=new Promise((n,a)=>{r.onload=()=>{let l=r.height/r.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},r.onerror=l=>{a(l);};});return r.src=URL.createObjectURL(o),s}var We=class extends R{constructor(){super(...arguments);this.rr=new Set;this.entry=null;}withEntry(t){return (...e)=>{let r=this.entry;if(!r){console.warn("No entry found");return}return t(r,...e)}}subEntry(t,e){this.withEntry((r,s,n)=>{let a=r.subscribe(s,l=>{this.isConnected&&n(l);});this.rr.add(a);})(t,e);}reset(){for(let t of this.rr)t();this.rr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.rr=new Set;}};function Ku(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}function Wr(o="hsl(209, 21%, 65%)",i=32,t=32){return Ku(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" 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 ju=3e3,Ze=class extends We{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Le="";this.Wn=false;this.or=null;this.Zn=false;this.Lu=this.cfg.filesViewMode;this.Yn=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.Ru(e);if(r&&s&&n){let d=await this.proxyUrl(W(Qt(this.cfg.cdnCname,n),rt(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:u}=Ee(d);u.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let f=await vs(h,l);t.setValue("thumbUrl",f);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Wr(f));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await vs(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Wr(u));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Wr(d));}});this.sr=$(this.Yn.bind(this),100);}Ru(t=false){t&&(this.or=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.or?.height||0),10),parseInt(String(this?.or?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,ju)}Uu(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=It,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),r();},d=u=>{a(),s(u);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}Io(){this.Mo?.cancel(),this.Mo=void 0;}$u(t){if(this.Io(),!t){this.Le&&(this.Le="");return}if(t===this.Le)return;let e=new AbortController,r={controller:e,cancel:()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);}};this.Mo=r,this.Uu(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Le=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}nr(t=false){if(this.entry){if(t){this.Yn(true);return}this.Zn&&this.sr();}}firstUpdated(t){super.firstUpdated(t),this.Xn();}updated(t){super.updated(t),t.has("uid")&&this.Xn();}ni(t){let[e]=t;e&&(this.Zn=e.isIntersecting,e.isIntersecting&&(this.or=e.boundingClientRect,this.nr(),this.s?.disconnect()),e.intersectionRatio===0&&this.sr.cancel());}reset(){super.reset(),this.sr.cancel(),this.Io(),this.Le&&(this.Le="");}Xn(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let r=()=>{this.nr();};this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.$u(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.nr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.Wn&&(this.Lu==="list"&&this.nr(true),this.Wn=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.sr.cancel(),this.Io(),this.s?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Le||It} role="img" alt="Preview of uploaded image" ?hidden=${!this.Le} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],Ze.prototype,"badgeIcon",2),p([y({attribute:false})],Ze.prototype,"uid",2),p([m()],Ze.prototype,"Le",2);var ys=class extends x{};var bs=class extends x{constructor(){super(...arguments);this.historyTracked=true;this.activityType=x.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var ws=class extends R{constructor(){super(...arguments);this.Qn=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=M;}initCallback(){super.initCallback(),this.Qn=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.Qn?.();}};var Ye=(o,i)=>{let t=false,e,r=0,s=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...n),r=Date.now(),t=true);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var Ma=(o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},Ai=ft(class extends Tt{constructor(o){if(super(o),o.type!==Rt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],n=0;for(let a of o)r[n]=e?e(a,n):n,s[n]=t(a,n),n++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=Aa(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let a=this.ut??=[],l=[],c,d,u=0,h=r.length-1,f=0,g=s.length-1;for(;u<=h&&f<=g;)if(r[u]===null)u++;else if(r[h]===null)h--;else if(a[u]===n[f])l[f]=ae(r[u],s[f]),u++,f++;else if(a[h]===n[g])l[g]=ae(r[h],s[g]),h--,g--;else if(a[u]===n[g])l[g]=ae(r[u],s[g]),Ke(o,l[g+1],r[u]),u++,g--;else if(a[h]===n[f])l[f]=ae(r[h],s[f]),Ke(o,r[u],r[h]),h--,f++;else if(c===void 0&&(c=Ma(n,f,g),d=Ma(a,u,h)),c.has(a[u]))if(c.has(a[h])){let b=d.get(n[f]),w=b!==void 0?r[b]:null;if(w===null){let E=Ke(o,r[u]);ae(E,s[f]),l[f]=E;}else l[f]=ae(w,s[f]),Ke(o,r[u],w),r[b]=null;f++;}else Kr(r[h]),h--;else Kr(r[u]),u++;for(;f<=g;){let b=Ke(o,l[g+1]);ae(b,s[f]),l[f++]=b;}for(;u<=h;){let b=r[u++];b!==null&&Kr(b);}return this.ut=n,Sa(o,l),it}});var X=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")}),G=class G extends We{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Jn=true;this.uid="";this.Oo="";this.Po="";this.Lo="";this.oe=0;this.ea=false;this.Ro="";this.ta=false;this.ia=false;this.ra=false;this.oa=false;this.ar=false;this.sa="";this.lr=[];this.na=false;this.Du=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Fu=()=>{this.aa();};this.S=$(()=>this.la(),100);this.Vu=this.withEntry(Ye((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===X.FINISHED,l=e===X.UPLOADING,c=e===X.QUEUED_UPLOADING,d=e===X.QUEUED_VALIDATION,u=e===X.VALIDATION,h=t.getValue("fileName"),f="";r?f="":!a&&n&&s&&Object.values(Ct).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.Lo=f,this.Po=r,this.ea=l||c||d||u,this.oe=d||u?0:t.getValue("uploadProgress"),this.sa=h?this.l10n("a11y-file-item-status",{fileName:h,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.aa=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.S();try{let r=new AbortController;t.setValue("abortController",r);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this.i.pluginManager?.snapshot().fileHooks??[]).filter(f=>f.type==="beforeUpload");for(let f of h)try{let g=f.handler({file:a,signal:r.signal}),b=new Promise((E,T)=>setTimeout(()=>T(new Error("beforeUpload hook timed out")),f.timeout)),{file:w}=await Promise.race([g,b]);w!==a&&(a=w,t.setValue("mimeType",a.type||null),t.setValue("isImage",Re(a)),t.setValue("fileSize",a.size),a instanceof File&&t.setValue("fileName",a.name));}catch(g){console.warn(`File hook "beforeUpload" from plugin "${f.pluginId}" failed`,g);}}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:u=>{if(u.isComputable){let h=u.value*100;t.setValue("uploadProgress",h);}},signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,d),_o(l,d)},n=await this.$["*uploadQueue"].add(s);t.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:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.S();}catch(r){let s=r instanceof te&&r.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof ge?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:r}):(console.error("Unknown upload error",r),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:r})})),t===this.entry&&this.S(),this.isConnected&&!s&&this.telemetryManager.sendEventError(r,"file upload. Failed to upload file");}}});}la(){let t=this.entry;if(!t)return;let e=X.IDLE;t.getValue("errors").length>0?e=X.FAILED:t.getValue("isQueuedForUploading")?e=X.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=X.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=X.VALIDATION:t.getValue("isUploading")?e=X.UPLOADING:t.getValue("fileInfo")&&(e=X.FINISHED),this.Nu(t,e);}Nu(t,e){e===X.FAILED?this.Ro="badge-error":e===X.FINISHED&&(this.Ro="badge-success"),e===X.UPLOADING&&(this.oa=false,this.removeAttribute("focused")),this.ia=e===X.FAILED,this.ra=e===X.UPLOADING,this.ta=e===X.FINISHED,this.Vu(e);}reset(){super.reset(),this.S.cancel();}ni(t){let[e]=t;e&&e.isIntersecting&&!this.na&&(this.Jn=false,this.na=true);}ca(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.Ye();return}this.subEntry("isQueuedForValidation",()=>{this.S();}),this.subEntry("isValidationPending",()=>{this.S();}),this.subEntry("uploadProgress",()=>{this.S();}),this.subEntry("isQueuedForUploading",()=>{this.S();}),this.subEntry("fileName",r=>{this.Oo=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.Oo=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.S();}),this.subEntry("errors",()=>this.S()),this.subEntry("isUploading",()=>this.S()),this.subEntry("fileSize",()=>this.S()),this.subEntry("mimeType",()=>this.S()),this.subEntry("isImage",()=>this.S()),this.subEntry("fileInfo",()=>this.Ye()),this.subEntry("isUploading",()=>this.Ye()),this.subEntry("errors",()=>this.Ye()),this.la(),this.Ye();}ua(t){if(this.cfg.filesViewMode==="list"){this.ar=true;return}this.ar=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.ca(this.uid);}Ye(){let t=this.i.pluginManager;if(!t||!this.uid){this.lr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.lr=[];return}this.lr=e.filter(s=>{try{return s.shouldRender(r)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}_u(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e)try{t.onClick(e);}catch(r){console.error(`Error in plugin file action onClick (${t.id}):`,r);}}initCallback(){super.initCallback(),this.ca(this.uid),this.subConfigValue("filesViewMode",e=>{this.ua(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.ua(e);}),this.onclick=()=>{G.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused");});},this.sub("*uploadTrigger",e=>{this.entry&&!e.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.aa());});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Ye())),this.Ye(),G.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback(),this.s?.disconnect(),G.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.Jn?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.ta} ?data-uploading=${this.ra} ?data-failed=${this.ia} ?data-focused=${this.oa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.Ro}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.sa}><span class="uc-file-name" ?hidden=${!this.ar}>${this.Oo}</span><span class="uc-file-error" ?hidden=${!this.Po}>${this.Po}</span><span class="uc-file-hint" ?hidden=${!this.Lo}>${this.Lo}</span></div><div class="uc-file-actions">${this.lr.map(t=>v`<button type="button" @click=${()=>this._u(t)} title=${this.l10n(t.label)} aria-label=${this.l10n(t.label)} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${t.id} ><uc-icon name=${t.icon}></uc-icon></button>`)}<button type="button" @click=${this.Du} 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.Fu}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.oe} .visible=${this.ea} ?hasFileName=${this.ar}></uc-progress-bar></div>`}};p([m()],G.prototype,"Jn",2),p([y({attribute:false})],G.prototype,"uid",2),p([m()],G.prototype,"Oo",2),p([m()],G.prototype,"Po",2),p([m()],G.prototype,"Lo",2),p([m()],G.prototype,"oe",2),p([m()],G.prototype,"ea",2),p([m()],G.prototype,"Ro",2),p([m()],G.prototype,"ta",2),p([m()],G.prototype,"ia",2),p([m()],G.prototype,"ra",2),p([m()],G.prototype,"oa",2),p([m()],G.prototype,"ar",2),p([m()],G.prototype,"sa",2),p([m()],G.prototype,"lr",2);var Ts=G;function Gu(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}function qu(o,i){return new Promise(t=>{let e=0,r=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});r.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(r);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(r);});};s(o);})}function Ia(o){let i=[],t=[];for(let e=0;e<o.items.length;e++){let r=o.items[e];if(r)if(r.kind==="file"){let s=r.type,n=r;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(qu(l,s).then(c=>{c&&i.push(...c);}));continue}let a=r.getAsFile();a&&t.push(Gu(a).then(l=>{l||i.push({type:"file",file:a});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}var nt=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Oa=["focus"],Wu=100,Es=new Map;function Zu(o,i){let t=Math.max(Math.min(o[0],i.x+i.width),i.x),e=Math.max(Math.min(o[1],i.y+i.height),i.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}function Cs(o){let i=0,t=document.body,e=new Set,r=g=>{e.add(g);},s=nt.INACTIVE,n=g=>{o.shouldIgnore()&&g!==nt.INACTIVE||(s!==g&&e.forEach(b=>{b(g);}),s=g);},a=()=>i>0;r(g=>o.onChange(g));let l=()=>{i=0,n(nt.INACTIVE);},c=()=>{i+=1,s===nt.INACTIVE&&n(nt.ACTIVE);},d=()=>{i-=1,a()||n(nt.INACTIVE);},u=g=>{g.preventDefault(),i=0,n(nt.INACTIVE);},h=g=>{if(o.shouldIgnore())return;a()||(i+=1);let b=[g.x,g.y],w=o.element.getBoundingClientRect(),E=Math.floor(Zu(b,w)),T=E<Wu,A=g.composedPath().includes(o.element);Es.set(o.element,E);let bt=Math.min(...Es.values())===E;A&&bt?(g.preventDefault(),n(nt.OVER)):n(T&&bt?nt.NEAR:nt.ACTIVE);},f=async g=>{if(o.shouldIgnore())return;g.preventDefault();let{dataTransfer:b}=g;if(!b)return;let w=await Ia(b);o.onItems(w),n(nt.INACTIVE);};return t.addEventListener("drop",u),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),o.element.addEventListener("drop",f),Oa.forEach(g=>{window.addEventListener(g,l);}),()=>{Es.delete(o.element),t.removeEventListener("drop",u),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),o.element.removeEventListener("drop",f),Oa.forEach(g=>{window.removeEventListener(g,l);});}}var xs=new Set,gt=class extends R{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.Ie=true;this.da=true;this.pa=null;this.Uo=null;this.ha=S();this.Lt=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.fa=true;this.Rt=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}get Bu(){let t=this.text;return typeof t=="string"&&t.length>0?this.l10n(t)||t:this.l10n("drop-files-here")}isActive(){if(!this.Ie)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&r}initCallback(){super.initCallback(),xs.add(this),this.$o(),this.Do(),this.ma(),this.ga(nt.INACTIVE),this.pa=Cs({element:this,shouldIgnore:()=>this.va(),onChange:t=>{this.ga(t);},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:N.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:N.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.set$({"*currentActivity":x.activities.UPLOAD_LIST}),this.modalManager?.open(x.activities.UPLOAD_LIST)));}}),this.updateComplete.then(()=>this.zu()),this.subConfigValue("sourceList",t=>{let e=Z(t);this.fa=e.includes(N.LOCAL),this.$o(),this.Do();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.$o(),this.Do());}updated(t){super.updated(t),t.has("clickable")&&this.ma();}va(){if(!this.Ie||!this.Hu())return true;if(!this.fullscreen)return false;let t=xs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}Hu(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}$o(){let t=this.fa&&!this.disabled;this.Ie=t;}Do(){let t=this.Ie||!this.querySelector("[data-default-slot]");this.da=t,this.hidden=!t;}ga(t){let e=Object.entries(nt).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}zu(){if(this.Uo)return;let t=this.ha.value;t&&(this.Uo=Cs({element:t,onChange:e=>{let r=Object.entries(nt).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},onItems:()=>{},shouldIgnore:()=>this.va()}));}ma(){this.clickable&&!this.Rt?(this.addEventListener("keydown",this.Lt),this.addEventListener("click",this.Lt),this.Rt=true):!this.clickable&&this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}disconnectedCallback(){super.disconnectedCallback(),xs.delete(this),this.pa?.(),this.Uo?.(),this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${O(this.ha)} class="uc-content-wrapper" ?hidden=${!this.da}><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.Bu}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],gt.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],gt.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],gt.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],gt.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],gt.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],gt.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],gt.prototype,"initflow",2),p([y({type:String})],gt.prototype,"text",2),p([m()],gt.prototype,"Ie",2),p([m()],gt.prototype,"da",2);var Ot=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=x.activities.UPLOAD_LIST;this.ya=false;this.ba=false;this.wa=false;this.Fo=false;this.No=false;this.cr=null;this.Ta=false;this.Vo=null;this.Ea=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this._o=()=>{this.emit(M.UPLOAD_CLICK),this.api.uploadAll(),this.Te();};this.Bo=()=>{this.emit(M.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ee=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Te=Ye(()=>{this.isConnected&&(this.Gu(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get Ku(){return this.Vo?this.ju(this.Vo):""}Gu(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(f=>f.isValidationPending).length},r=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),s=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=t.allEntries.some(f=>f.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,u=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&l&&this.cfg.confirmUpload)c=true;else {d=true;let f=this.cfg.groupOutput?!!t.group:true;u=e.total===e.succeed&&r&&l&&f;}this.ya=d,this.ba=u,this.wa=c,this.No=e.total===0||!s&&!n,this.Fo=!n||this.cfg.multiple,this.Ta=e.total>0,this.Vo=e;}ju(t){let e=r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})};return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Te),this.subConfigValue("multipleMin",this.Te),this.subConfigValue("multipleMax",this.Te),this.sub("*groupInfo",t=>{t&&this.Te();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.Te),this.uploadCollection.observeCollection(this.Te),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.cr=null;return}this.cr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Te),this.uploadCollection.unobserveCollection(this.Te));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.Ku}</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.Ta}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Ai(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Ea} ?disabled=${!this.No} ?hidden=${!this.Fo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.cr} >${this.cr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.Fo} ?disabled=${!this.No} @click=${this.Ea} ><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.wa} @click=${this._o} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.ya} ?disabled=${!this.ba} @click=${this.Bo} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([m()],Ot.prototype,"ya",2),p([m()],Ot.prototype,"ba",2),p([m()],Ot.prototype,"wa",2),p([m()],Ot.prototype,"Fo",2),p([m()],Ot.prototype,"No",2),p([m()],Ot.prototype,"cr",2),p([m()],Ot.prototype,"Ta",2),p([m()],Ot.prototype,"Vo",2);var Yu=[{test:o=>!!o.accept&&!!o.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:o=>o.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:o=>o.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Pa=$(o=>{for(let{test:i,message:t}of Yu)i(o)&&Dr(t);},0);var La=(o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},Xu="0123456789abcdefghijklmnopqrstuvwxyz",Ua=o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=Xu[Number(t)]+i,o=o/36n;}return i},Ss=(o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var Qu=async o=>{let i=new TextEncoder().encode(o),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},Ju=10,td=async o=>{let i=await Qu(o);return Ua(i).slice(0,Ju)},Ra=async(o,i)=>{let t=await td(o);return La(t,i)};var $a=o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function");var As=o=>o,ed=[As({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:o,enableVideoRecording:i})=>{let t=i();if(t===null)return o();let e=K(o());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(r=>r!=="video")),Bt(e)}}),As({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:o,defaultCameraMode:i})=>{let t=i();if(t===null)return o();let e=K(o());return e=e.sort((r,s)=>r===t?-1:s===t?1:0),Bt(e)}}),As({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===pi||Ss(r,s))?Ra(e,s):r}})],Da=({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of ed){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let l of r.deps)s[l]=()=>t(l);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let a;try{a=r.fn(s,{signal:n.signal});}catch(l){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,l);return}$a(a)?a.then(l=>{n.signal.aborted||i(r.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,l);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,a);}};var V=o=>String(o),tt=o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},z=o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},Fa=o=>o==="auto"?o:z(o),Va=o=>{let i=V(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Na=o=>{let i=V(o);if(!Object.values(L).includes(i))throw new Error(`Invalid value: "${i}"`);return i},_a=o=>{let i=V(o),t=K(i);if(t.some(e=>!Object.values(L).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},za=o=>{let i=V(o);if(i==="local"||i==="global")return i;if(z(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},Ba=o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},ks=o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},Zr=o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},Yr=o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},Ha=o=>{let i=V(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var id={pubkey:V,multiple:z,multipleMin:tt,multipleMax:tt,confirmUpload:z,imgOnly:z,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:Fa,cameraMirror:z,cameraCapture:Va,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:tt,thumbSize:tt,showEmptyList:z,useLocalImageEditor:z,useCloudImageEditor:z,cloudImageEditorTabs:V,removeCopyright:z,cropPreset:V,imageShrink:V,modalScrollLock:z,modalBackdropStrokes:z,sourceListWrap:z,remoteTabSessionKey:V,cdnCname:V,cdnCnamePrefixed:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:tt,retryNetworkErrorMaxTimes:tt,multipartMinFileSize:tt,multipartChunkSize:tt,maxConcurrentRequests:tt,multipartMaxConcurrentRequests:tt,multipartMaxAttempts:tt,checkForUrlDuplicates:z,saveUrlForRecurrentUploads:z,groupOutput:z,userAgentIntegration:V,debug:z,localeName:V,metadata:Ba,secureUploadsExpireThreshold:tt,localeDefinitionOverride:o=>ks(o),secureUploadsSignatureResolver:o=>Zr(o),secureDeliveryProxyUrlResolver:o=>Zr(o),iconHrefResolver:o=>Zr(o),plugins:o=>Yr(o),fileValidators:Yr,collectionValidators:Yr,validationTimeout:tt,validationConcurrency:tt,cameraModes:_a,defaultCameraMode:Na,enableAudioRecording:z,enableVideoRecording:z,mediaRecorderOptions:ks,maxVideoRecordingDuration:tt,filesViewMode:Ha,gridShowFileNames:z,cloudImageEditorAutoOpen:z,cloudImageEditorMaskHref:V,testMode:z,qualityInsights:z,pasteScope:za},Ka=(o,i)=>{if(!(typeof i>"u"||i===null))try{return id[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),J[o]}};var Xr=[...new Set(["debug",...Object.keys(J)])],rd=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Ga=o=>rd.includes(o),Is=Xr.filter(o=>!Ga(o)),Ms={...Object.fromEntries(Is.map(o=>[cr(o),o])),...Object.fromEntries(Is.map(o=>[o.toLowerCase(),o]))},ja=o=>`__${o}`,Xe=class extends C{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(J).map(([t,e])=>[k(t),e]))};this.qu=new Map;this.li={};this.xa=new Set;this.Ut=new Map;}zo(t){return this.xa.has(t)}Ho(t){let e=this.i.pluginManager;if(e)return e.configRegistry.get(t)}Ca(t){return [...new Set([cr(t),t.toLowerCase()])]}Wu(t,e){if(Ga(t)||this.zo(t)&&this.Ho(t)?.attribute===false)return;let r=this.Ca(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}Zu(t,e){let r=k(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=J[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}Xe(t,e){let r;if(this.zo(t)){let a=this.Ho(t);try{r=a?.normalize?.(e)??e;}catch(l){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,l);return}}else r=Ka(t,e);let s=this,n=ja(t);s[n]!==r&&(this.Yu(t,s[n],r),s[n]=r,this.Wu(t,r),this.Zu(t,r),this.debugPrint(`"${t}"`,r),this.zo(t)||Pa(this.cfg));}dr(t){let e=this,r=ja(t);return e[r]??this.$[k(t)]}Yu(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" 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] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r));}Sa(t){let e=t.configRegistry.getAll();this.li={},this.xa=new Set(e.keys());for(let[r,s]of this.Ut)e.has(r)||(s(),this.Ut.delete(r));for(let[r,s]of e){let a=k(r);if(s.attribute){let c=this.Ca(r);for(let d of c)this.li[d]=r;}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let l=Object.getOwnPropertyDescriptor(this,r);if((!l||!l.set||!l.get)&&Object.defineProperty(this,r,{set:c=>{this.Xe(r,c);},get:()=>this.dr(r),enumerable:true,configurable:true}),!this.Ut.has(r)){let c=this.sub(a,d=>{this.Xe(r,d);},false);this.Ut.set(r,c);}}}Xu(){this.i.when("pluginManager",t=>{this.Sa(t),this.ur=t.onPluginsChange(()=>{this.Sa(t);});});}Qu(){this.ai=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let r=e.attributeName,s=e.oldValue,n=this.getAttribute(r);if(s===n||r in Ms)continue;if(r in this.li){let l=this.li[r],c=this.Ho(l);this.attributeChangedCallback(r,s??"",n??c?.defaultValue??"");}}}),this.ai.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Xu(),this.Qu();for(let r of Is)this.sub(k(r),s=>{this.Xe(r,s);},false);for(let r of Xr){let s=t[r]??this.$[k(r)];s!==J[r]&&this.Xe(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this.Xe(r,a);},get:()=>this.dr(r)});}let e=r=>{Da({key:r,setValue:this.Xe.bind(this),getValue:this.dr.bind(this),computationControllers:this.qu});};for(let r of Xr)this.sub(k(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ms[t];n?s[n]=r:this.i.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==r)return;let c=this.li[t],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(r):r;if(this.dr(c)===u)return;this.Xe(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.ur&&(this.ur(),this.ur=void 0),this.ai&&(this.ai.disconnect(),this.ai=void 0);for(let t of this.Ut.values())t();this.Ut.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(Ms);return [...t,...e]}};for(let o of Xr)Xe.prototype[o]=void 0;var ki=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.Aa="upload-file";this.Ju=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.Aa=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.Ju}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.Aa)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],ki.prototype,"dropzone",2),p([m()],ki.prototype,"Aa",2);var Mi=class extends x{constructor(){super(...arguments);this.jo=S();}initCallback(){this.activityType=this.registration?.id??null,this.ka(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.ka(),this.isActivityActive&&(this.pr(),this.Ma()));}ka(){this.registration&&(this.Mn()||this.registerActivity(this.activityType??"",{onActivate:()=>this.Ma(),onDeactivate:()=>this.pr()}));}async Ma(){await this.updateComplete;let t=this.jo.value;if(!t||!this.registration)return;this.pr();let e=this.$["*currentActivityParams"];try{this.Ko=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}pr(){let t=this.jo.value;if(t){try{this.Ko?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.Ko=void 0,t.replaceChildren();}}disconnectedCallback(){this.pr(),super.disconnectedCallback();}render(){return v`<div style="display: flex; flex-direction: column; width: 100%; min-height: 0;" ${O(this.jo)} ></div>`}};p([y({attribute:false})],Mi.prototype,"registration",2);var Qe=class extends C{constructor(){super(...arguments);this.mode="modal";this.de=[];}initCallback(){super.initCallback();let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Ia())),this.Ia();}Ia(){let t=this.i.pluginManager;if(!t){this.de=[];return}this.de=t.snapshot().activities;}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?v`${Ai(this.de,t=>t.id,t=>v`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:v`${Ai(this.de,t=>t.id,t=>v`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};p([y({type:String})],Qe.prototype,"mode",2),p([m()],Qe.prototype,"de",2);function Ii(o,i,t){return o?i(o):t?.(o)}function qa(...o){return o.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function vt(...o){let i=qa(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Wa(o,...i){let t=qa(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}var od=o=>ot.includes(o),Za=o=>{if(!o)return ot;let i=K(o).filter(od);return i.length===0?ot:i};function Ya(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":ot,"*tabId":B.CROP,"*on.retryNetwork":()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=It,t.src=e;}o.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=rt(Jt(i),"preview"),r=W(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.cancel":()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var Xa="<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 Ce={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Je=class extends C{constructor(){super(...arguments);this.he=false;this.Oa=Ce;this.Pa=Ce.visible;this.La=Ce.hidden;this.Go=false;this.Ra=false;}set visible(t){this.he=t,this.Ua();}get visible(){return this.he}set styles(t){this.Oa=t,this.Go=true,this.Pa=t.visible??Ce.visible,this.La=t.hidden??Ce.hidden;}get styles(){return this.Oa}Ua(){this.style.visibility=this.he?"inherit":"hidden",Wa(this,{[Ce.transition]:!this.Go,[this.Pa]:this.he,[this.La]:!this.he}),this.toggleAttribute("inert",!this.he);}ed(){this.Ra||(this.Ra=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Go||this.classList.add(Ce.transition),this.Ua(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.ed();},0);}};p([y({type:Boolean})],Je.prototype,"visible",1),p([y({attribute:false})],Je.prototype,"styles",1);var Oi=class extends C{constructor(){super(...arguments);this.active=false;this.Qe=S();this.qo=false;this.Wo=()=>{let t=this.Qe.value;t&&(this.$a(t),this.qo&&this.active&&this.Zo());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.Zo();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Zo():this.td());}Zo(){let t=this.Qe.value;if(!t)return;this.qo=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Wo),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Wo,{once:true});}td(){let t=this.Qe.value;t&&(this.qo=false,t.removeEventListener("transitionend",this.Wo),this.$a(t));}$a(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${O(this.Qe)}></div></div>`}};p([y({type:Boolean,reflect:true})],Oi.prototype,"active",2);var le=ft(class extends Tt{constructor(o){if(super(o),o.type!==Rt.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter(i=>o[i]).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return it}});var q=o=>o??U;var xt=class extends C{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(t){super.firstUpdated(t),this.Da(),this.Fa();}updated(t){super.updated(t),t.has("reverse")&&this.Da(),t.has("theme")&&this.Fa();}Da(){this.style.flexDirection=this.reverse?"row-reverse":"";}Fa(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get rd(){let t=this.Yo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.od}}get Yo(){return !this.icon}get od(){return !this.text&&!this.Yo}render(){return v`<button type="button" role=${q(this.ariaRole||void 0)} aria-controls=${q(this.ariaControls||void 0)} aria-label=${q(this.l10n(this.titleProp))} title=${q(this.l10n(this.titleProp))} ><uc-icon class=${le(this.rd)} name=${q(this.icon||void 0)} ?hidden=${this.Yo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],xt.prototype,"text",2),p([y({type:String})],xt.prototype,"icon",2),p([y({type:Boolean,reflect:true})],xt.prototype,"reverse",2),p([y({type:String,reflect:true})],xt.prototype,"theme",2),p([y({attribute:"aria-role"})],xt.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],xt.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],xt.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],xt.prototype,"active",2);function Qa(o,i){let t={};for(let e of i){let r=o[e];(Object.hasOwn(o,e)||r!==void 0)&&(t[e]=r);}return t}function ti(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return W(o,rt(nr,Jt(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Lt}/${Ut}/uc-cloud-image-editor/`))}var Pi=class extends C{constructor(){super(...arguments);this.Na=`uc-backdrop-mask-${pt.generateFastUid()}`;this.fr=false;this.pi=false;this.Ba=S();this.hi=false;this.fi=null;this.Ha=t=>{this.Ka(),this.mi&&(t.stopPropagation(),t.preventDefault(),this.mi=false);};this.ja=t=>{if(!this.mi||!this.hr||!this.Qo)return;t.stopPropagation(),t.preventDefault();let e=this.Re;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,a=t.y-s,l=n-this.hr[0],c=a-this.hr[1],{direction:d}=this.Qo,u=this.hd(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.Ga=t=>{if(!this.xe)return;let e=Object.values(this.xe).find(r=>{if(!r||this.es(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return pa(a,[t.x,t.y])});this.Va=e,this.Ka();};}get Re(){return this.Ba.value??null}get mi(){return this.pi}set mi(t){this.pi!==t&&(this.pi=t,this.Jo());}Jo(){this.ui&&this.ui.setAttribute("class",vt({"uc-guides--hidden":this.fr,"uc-guides--visible":!this.fr&&this.pi,"uc-guides--semi-hidden":!this.fr&&!this.pi}));}es(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=I&&e.width<=I)return true;let r=e.height<=I&&(t.includes("n")||t.includes("s")),s=e.width<=I&&(t.includes("e")||t.includes("w"));return r||s}sd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,a=this.Re;if(!a)return;let l=mt("mask",{id:this.Na}),c=mt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=mt("rect",{x:e,y:r,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=mt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.Na})`});a.appendChild(u),a.appendChild(l),this.ci=l,this.Xo=d;}nd(){this.ci&&(this.ci.style.display="none",window.requestAnimationFrame(()=>{this.ci&&(this.ci.style.display="block");}));}ad(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.Xo&&oe(this.Xo,{x:e,y:r,width:s,height:n});}ld(){let t=this.$["*cropBox"];if(!(!t||!this.ui||!this.xe)){for(let e of Object.values(this.xe)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:a}=e,l=r==="",c=r.length===2,{x:d,y:u,width:h,height:f}=t;if(l)oe(n,{x:d,y:u,width:h,height:f});else {let b=se(Math.min(h,f)/82/2,0,1),w=c?aa(t,r,b):la(t,r,b),E=w.center;if(!E)continue;let T=Math.max(ss*se(Math.min(h,f)/ss/3,0,1),na);oe(n,{x:E[0]-T,y:E[1]-T,width:T*2,height:T*2}),oe(s,{d:w.d});}let g=this.es(r);a.setAttribute("class",vt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}oe(this.ui,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}za(t,e){let r=mt("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=mt("rect",{fill:"transparent"}),n=mt("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.cd.bind(this,e));}ud(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.za(t,s);}return this.za(t,""),t}dd(){let t=mt("svg"),e=mt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let r=1;r<=2;r++){let s=mt("line",{x1:`${bi*r}%`,y1:"0%",x2:`${bi*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=mt("line",{x1:"0%",y1:`${bi*r}%`,x2:"100%",y2:`${bi*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}pd(){let t=this.Re;if(!t)return;let e=document.createDocumentFragment(),r=this.dd();e.appendChild(r);let s=this.ud();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.xe=s,this.ui=r,this.Jo();}cd(t,e){if(!this.xe)return;let r=this.xe[t];if(!r||this.es(t))return;let s=this.$["*cropBox"],n=this.Re;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.mi=true,this.Qo=r,this.hr=[c,d],this._a={...s};}hd(t,e){let[r,s]=e,n=this.$["*imageBox"],a=this._a??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=ua({rect:a,delta:[r,s],imageBox:n}):a=da({rect:a,delta:[r,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Ne(ze(a),n)}Ka(){let t=this.Va,e=this.Re;e&&(e.style.cursor=t?ca(t.direction):"initial");}qa(t){if(this.di){this.di.setAttribute("href",t);return}let e=this.Re;if(!e){this.fi=t;return}this.fi=null;let r=document.createDocumentFragment(),s=mt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.di=s;}fd(){let t=this.$["*cropBox"];if(!t||!this.di)return;let{x:e,y:r,width:s,height:n}=t;oe(this.di,{x:e,y:r,height:n,width:s});}ts(){this.hi&&(this.ad(),this.ld(),this.fd());}toggleThumbs(t){if(this.xe)for(let e of Object.values(this.xe)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",vt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.nd(),this.hi&&window.requestAnimationFrame(()=>{this.ts();});}),this.sub("*cropBox",t=>{t&&(this.fr=t.height<=I||t.width<=I,this.Jo(),this.hi&&window.requestAnimationFrame(()=>{this.ts();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.qa(t);}),document.addEventListener("pointermove",this.ja,true),document.addEventListener("pointerup",this.Ha,true);}firstUpdated(t){super.firstUpdated(t),this.md();}md(){let t=this.Re;if(!(!t||this.hi)){if(this.sd(),this.pd(),this.hi=true,t.addEventListener("pointermove",this.Ga,true),this.fi){let e=this.fi;this.fi=null,this.qa(e);}this.ts();}}disconnectedCallback(){super.disconnectedCallback(),this.Re?.removeEventListener("pointermove",this.Ga,true),document.removeEventListener("pointermove",this.ja,true),document.removeEventListener("pointerup",this.Ha,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${O(this.Ba)}></svg>`}};p([m()],Pi.prototype,"pi",2);function nd(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(o)):true}var Li=class extends C{constructor(){super();this.ctxOwner=true;this.Je={width:0,height:0};this.e=null;this._=false;this.se=null;this.Za=S();this.os=S();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.Wa=$(this.Ya.bind(this),300),this.rs=Ye(()=>{!this.isConnected||!this._||(this.ss(),this.Xa(),this.Qa(),this.ns(),this.as());},100);}firstUpdated(t){super.firstUpdated(t),this.ss();}Xa(){let t=this.$["*editorTransformations"],e=Qa(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}ss(){let t=this.Za.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*n,t.height=s*n,e?.scale(n,n),this.fe=t,this.e=e;}Qa(){if(!this._||!this.se)return;let t=this.se,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=_e({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,f=0+e,g=e+(n.height-e*2)/2-h/2;l={x:f,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,f=e+(n.width-e*2)/2-h/2,g=0+e;l={x:f,y:g,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=ze(l);}ns(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,f],coords:[g,b]}=n,{width:w}=_e(this.Je,s),E=a/w;t=Ne(ze({x:l+g*E,y:c+b*E,width:h*E,height:f*E}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!ha(t,e)||u&&!fa(t,u)){let h=e.width/e.height,f=e.width,g=e.height;u&&(h>u?f=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-g/2,width:f,height:g};}this.$["*cropBox"]=Ne(ze(t),e);}gd(){let t=this.e;if(!t)return;let e=this.se;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=_e({width:r.width,height:r.height},l);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}as(){if(!this._||!this.se||!this.fe||!this.e)return;let t=this.fe;this.e.clearRect(0,0,t.width,t.height),this.gd();}vd({fromViewer:t}){this.se&&(this.os.value?.toggleThumbs(true),this.yd(),setTimeout(()=>{this.className=vt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Ja(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a}=e,{width:l,height:c}=_e(this.Je,s),{width:d,height:u}=t,h=n/l,f=a/c;return [se(Math.round(d/h),1,l),se(Math.round(u/f),1,c)]}bd(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=_e(this.Je,s),{x:h,y:f}=t,g=n/d,b=a/u,w=this.Ja(),E={dimensions:w,coords:[se(Math.round((h-l)/g),0,d-w[0]),se(Math.round((f-c)/b),0,u-w[1])]};if(!nd(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(w[0]===d&&w[1]===u))return E}Ya(){if(!this.isConnected||!this.Je)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.bd(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.Qa(),this.ns(),this.as());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.ss(),this.Je=t,this.removeEventListener("transitionend",this.tl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.se=await this.wd(r,s),this.Xa(),this.rs(),this.vd({fromViewer:e});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(r=>{let[s]=r;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this._&&this.se&&this.rs();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.Ya(),this._=false,this.Td(),this.className=vt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.os.value?.toggleThumbs(false),this.addEventListener("transitionend",this.tl,{once:true}),this.s?.disconnect());}Td(){let t=this.Ja(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,s),a=e.x+e.width/2,l=e.y+e.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`;}yd(){let t=this.$["*cropBox"],e=t.x+t.width/2,r=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${r}px`;}tl(){this._||(this.se=null);}async wd(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(ti(t,r,e)),{promise:n,cancel:a,image:l}=Ee(s),c=this.$t(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.v?.(),this.v=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}$t(t){let e="crop",r=this.$["*loadingOperations"],s=r.get(e);return s||(s=new Map,r.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.as();}),this.sub("*cropBox",()=>{this.se&&this.Wa();}),this.sub("*currentAspectRatio",()=>{this.ns();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.Je&&this.activate(this.Je,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.se&&(this.se=null);}render(){return v`<canvas class="uc-canvas" ${O(this.Za)}></canvas><uc-crop-frame ${O(this.os)}></uc-crop-frame>`}};p([m()],Li.prototype,"se",2);function Os(o,i,t){let e=t,r=t-1,s=new Array(e);for(let n=r;n>=0;n-=1)s[n]=Math.ceil((n*i+(r-n)*o)/r);return s}function ad(o){return typeof o=="string"&&o in kt}function ld(o){let i=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],r=o[t+1];typeof e=="number"&&typeof r=="number"&&i.push([e,r]);}return i}function cd(o,i,t){let e=ld(o).find(([n,a])=>n<=i&&i<=a);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let a=Math.abs(r-s)||1,l=Math.abs(i-r)/a;return r===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function ud(o,i){return o.map((t,e)=>t<i?o.length-e:e)}function Ja(o,i){let t=kt[o].keypointsNumber,{range:e,zero:r}=kt[o];return [...new Set([...Os(e[0],r,t+1),...Os(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}var Qr=class extends C{constructor(){super();this._=false;this.ls=true;this.n="initial";this.il={};this.Ue=[];this.ol=0;this.nl=S();this.mr=S();this.classList.add("uc-inactive_to_cropper"),this.sl=$(async(t,e,r)=>{let s=()=>!this.al(t,e)||this.Pt!==r||!!this.Ue.find(c=>c.value===r);if(s())return;let n=await this.ll(t,r),a=new Image;a.src=n.src;let l=this.$t(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.Ue,d=c.findIndex(g=>g.value>r);d===-1&&(d=c.length);let h=c[d]?.image,f=this.mr.value;!f||h&&!f.contains(h)||(c.splice(d,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.ds(t,r));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}$t(t){let e=this.n,r=this.$["*loadingOperations"];r.has(e)||r.set(e,new Map);let s=r.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}cl(){window.cancelAnimationFrame(this.ol),this.ol=window.requestAnimationFrame(()=>{for(let t of this.Ue){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}et({url:t=this.rl,filter:e=this.m??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.il};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let a=this.offsetWidth;return this.proxyUrl(ti(t,a,n))}async ll(t,e){return {src:await this.et({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}al(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!ad(this.n)||!Number.isFinite(e)||(this.ds(this.n,e),this.sl(this.n,this.m,e));}ds(t,e){this.n=t,this.Pt=e;let{zero:r}=kt[t],s=this.Ue.map(l=>l.value),n=cd(s,e,r),a=ud(s,r);this.Ue.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.cl();}ul(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Ed(){this.a=this.a||this.ul();let t=this.a;t&&this.dl(t);let e=this.Ue.map(c=>c.src),{images:r,promise:s,cancel:n}=Si(e);r.forEach(c=>{let d=this.$t(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.cs=()=>{n(),this.cs=void 0;};let a=this.n,l=this.m;if(await s,this._&&this.al(a,l)){let c=this.mr.value;if(!c)return;c.replaceChildren(),this.Ue.forEach((d,u)=>{let h=r[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.cl();}}async setTransformations(t){if(this.il=t,this.a){let e=await this.et(),r=this.$t(e);this.a.src=e,this.a.addEventListener("load",r,{once:true}),this.a.addEventListener("error",r,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:s}){if(!r||typeof s!="number")return;this.us?.();let n=Ja(r,s),a=await Promise.all(n.map(c=>this.et({url:t,filter:e,operation:r,value:c}))),{cancel:l}=Si(a);this.us=l;}xd(t){let e=this.a||this.ul();if(this.dl(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=vt({"uc-active_from_viewer":this.gi,"uc-active_from_cropper":!this.gi,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.$t(t);e.addEventListener("error",r,{once:true}),e.src=t,e.addEventListener("load",()=>{r(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=vt({"uc-active_from_viewer":this.gi,"uc-active_from_cropper":!this.gi,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:r,filter:s,fromViewer:n}){if(this._=true,this.ls=false,await this.updateComplete,this.rl=t,this.n=e??"initial",this.Pt=r,this.m=s,this.gi=n,typeof r!="number"&&!s){let l=await this.et({operation:e,value:r});this.xd(l),this.ps();return}!e||typeof r!="number"||(this.Ue=await Promise.all(Ja(e,r).map(l=>this.ll(e,l))),this.ds(e,r),this.Ed());}deactivate({hide:t=true}={}){this._=false,this.cs?.(),this.us?.(),t&&!this.ls?(this.ls=true,this.a&&(this.a.style.transform="scale(1)"),this.className=vt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.ps();},{once:true})):this.ps();}dl(t){let e=this.nl.value;e&&(e.contains(t)||e.appendChild(t));}ps(){this.mr.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${O(this.nl)}></div><div class="uc-fader-layers-host" ${O(this.mr)}></div>`}};var tl="important",dd=" !"+tl,Se=ft(class extends Tt{constructor(o){if(super(o),o.type!==Rt.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(o,[i]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith(dd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?tl:""):t[e]=r;}}return it}});var Ft=class extends C{constructor(){super();this.hs=0;this.$e=S();this.hl=S();this.fl=S();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.De=0;this.Sd=t=>{t.stopPropagation();let e=this.ml(t);e!==null&&(this.fs(e),this.Cd("slider-input",e));};this.Ad=t=>{t.stopPropagation();let e=this.ml(t);e!==null&&this.fs(e);};this.gl=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.vl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}Cd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.hs=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.yl(this.De),this.ms(),this.s=new ResizeObserver(()=>{this.ms(),this.gr(this.De);}),this.s.observe(this);let e=this.$e.value;e?.addEventListener("focus",this.gl),e?.addEventListener("blur",this.vl),window.setTimeout(()=>{this.gr(this.De);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.De&&this.fs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.ms(),this.gr(this.De)),t.has("zero")&&this.hasUpdated&&this.bl(this.De);}gr(t){this.bl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(r-this.hs)/100;window.requestAnimationFrame(()=>{let l=this.hl.value;l&&(l.style.transform=`translateX(${a}px)`);});}bl(t){if(!this.vi)return;let e=this.max-this.min;if(e===0)return;this.vi.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(r-this.hs)/100;window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.transform=`translateX(${a}px)`);});}ms(){let e=this.fl.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.pl===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 u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.vi=d,e.innerHTML="",e.appendChild(a),this.pl=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.$e.value;t?.removeEventListener("focus",this.gl),t?.removeEventListener("blur",this.vl),this.s?.disconnect(),this.s=void 0;}fs(t){Number.isFinite(t)&&(this.De=t,this.hasUpdated&&(this.yl(t),this.gr(t)));}yl(t){let e=this.$e.value;e&&(e.value=String(t));}ml(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return v`<div class="uc-steps" ${O(this.fl)}></div><div class="uc-thumb" ${O(this.hl)}></div><input class="uc-input" type="range" ${O(this.$e)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.De)} ?disabled=${this.disabled} @input=${this.Sd} @change=${this.Ad} />`}};p([y({type:Boolean,reflect:true})],Ft.prototype,"disabled",2),p([y({type:Number})],Ft.prototype,"min",2),p([y({type:Number})],Ft.prototype,"max",2),p([y({type:Number,attribute:false})],Ft.prototype,"defaultValue",2),p([y({type:Number})],Ft.prototype,"zero",2),p([m()],Ft.prototype,"De",2);var Vt="original",Ui=class extends C{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.gs=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.kd();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===Vt?void 0:this.state.value,filter:this.state.filter===Vt?void 0:this.state.filter,fromViewer:false});}kd(){let t=this.state.operation,{range:e,zero:r}=kt[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:f}=u;d=h===this.state.filter?f:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:r;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Vt?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return v`<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.gs} ></uc-slider-ui>`}};p([m()],Ui.prototype,"state",2);function ei(o){if(!o)return null;let i=o.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}var at=class extends C{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}wl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.wl();}updated(t){super.updated(t),t.has("active")&&this.wl();}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([m()],at.prototype,"active",2),p([m()],at.prototype,"title",2),p([m()],at.prototype,"icon",2),p([m()],at.prototype,"titleProp",2);var Jr=12,to=16,pd=o=>{let i=12,t=12;return o.width/o.height>=1?(i=Jr,t=Math.round(Jr*o.height/o.width)):(t=Jr,i=Math.round(Jr*o.width/o.height)),{width:i,height:t}},eo=class extends at{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.Md(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}Md(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return v`<button role="option" type="button" class=${le(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Ri=class extends at{constructor(){super(...arguments);this.X=null;}get aspectRatio(){return this.X}set aspectRatio(t){if(this.X===t)return;let e=this.X;this.X=t,this.requestUpdate("aspectRatio",e),t?this.Tl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.X&&this.Tl(this.X),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.X?.id||t?.width===this.X?.width&&t?.height===this.X?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.X?.id&&(this.$["*currentAspectRatio"]=this.X);}Tl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};r(),s(),e||this.requestUpdate();}Id(){let t=this.X;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=pd(t),s=(to-e)/2,n=(to-r)/2;return v`<uc-icon><svg viewBox="0 0 ${to} ${to}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${r} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" class=${le(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} >${this.Id()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],Ri.prototype,"aspectRatio",1);function hd(o){let i=o+90;return i=i>=360?0:i,i}function fd(o,i){if(o==="rotate")return hd(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}var $i=class extends at{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),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(t){if(!this.operation)return;let e=this.$["*cropperEl"],r=e.getValue(this.operation),s=fd(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};p([y({type:String})],$i.prototype,"operation",2);var Zt=class extends at{constructor(){super(...arguments);this.n="";this.m="";this.yi="";this.vr=0;this.a=null;this.Ft=false;this.isOriginal=false;this.El=20;}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let r=this.m;this.m=e,this.n="filter",this.isOriginal=e===Vt,this.icon=this.isOriginal?"original":"slider",this.El=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.xl(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.m),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.m),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ei(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}Od(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.El||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.n]=this.m!==Vt?{name:this.m,amount:a}:void 0,W(this.yi,rt(nr,Jt(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Lt}/${Ut}/uc-cloud-image-editor/`))}async ni(t,e){t[0]?.isIntersecting?await this.vs(e):this.v?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.yi=t??"",this.sub("*originalUrl",e=>{this.yi=e??"",!this.isOriginal&&this.yi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.tt());}),this.isOriginal||(this.s?.observe(this),this.tt()),this.m&&this.xl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.vs():this.tt());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.v?.(),this.yr();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.tt()));}xl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async vs(t){if(!this.isConnected){t?.unobserve(this),this.v?.(),this.v=void 0;return}if(!this.yi){!this.Dt&&!this.Fe&&this.tt();return}let e=++this.vr,r="";try{r=await this.proxyUrl(this.Od());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Ft=false,this.v?.();let{promise:s,cancel:n}=Ee(r);this.v=()=>{n(),this.vr===e&&(this.v=void 0);};try{if(await s,this.vr!==e||!this.isConnected)return;this.a=r,this.Ft=!0,this.yr(),(t??this.s)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.tt();}finally{this.vr===e&&(this.v=void 0);}}tt(){if(!this.isConnected||this.a||this.Ft||this.isOriginal||this.$["*networkProblems"]){this.yr();return}this.Fe&&cancelAnimationFrame(this.Fe),this.Fe=requestAnimationFrame(()=>{if(this.Fe=void 0,!this.isConnected||this.a||this.Ft||this.isOriginal){this.yr();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<r){this.vs();return}this.Dt=window.setTimeout(()=>{this.Dt=void 0,this.tt();},500);});}yr(){this.Fe&&(cancelAnimationFrame(this.Fe),this.Fe=void 0),this.Dt&&(window.clearTimeout(this.Dt),this.Dt=void 0);}get Pd(){return !!(this.Ft&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Pd?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${le(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Ft} style=${Se(e)}></div><uc-icon class=${le({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Se(r)} ></uc-icon></button>`}};p([m()],Zt.prototype,"a",2),p([m()],Zt.prototype,"Ft",2),p([m()],Zt.prototype,"isOriginal",2),p([m()],Zt.prototype,"El",2),p([y({type:String})],Zt.prototype,"filter",1);var Di=class extends at{constructor(){super(...arguments);this.n="";}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),this.isConnected&&e&&this.Cl(e);}Cl(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},r=()=>{let s=this.l10n(t);return this.title=s,s};e(),r();}initCallback(){super.initCallback(),this.n&&this.Cl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=kt[this.n],r=t[this.n],s=typeof r<"u"?r!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ei(this.$["*operationTooltip"])});}};p([y({type:String})],Di.prototype,"operation",1);var md=1,el=()=>{},Fi=class extends C{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Sl=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>md){this.scrollLeft+=r;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Sl,{passive:false}),this.addEventListener("scroll",el,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Sl),this.removeEventListener("scroll",el),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Fi.prototype,"hiddenScrollbar",2);var ut=class extends C{constructor(){super(...arguments);this.bi=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Al=true;this.tabList=[...ot];this.activeTab=B.CROP;this.br=true;this.ys=false;this.kl=null;this.Ml=0;this.Il=0;this.wr=S();this.Ol=S();this.tabToggleRefs={[B.CROP]:S(),[B.TUNING]:S(),[B.FILTERS]:S()};this.Pl=()=>{this.ot();};this.wi=[];this.Tr=$(t=>{this.bi=t;},500);this.Er=$(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===B.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(Vt);else if(this.showSubToolbar&&this.$["*tabId"]===B.TUNING&&e){s=true;let n=t?.[e]||kt[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.ys=s;},0);this.Ld={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Rd={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Ud={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.$d={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Vt,"*currentOperation":null,"*operationTooltip":null};this.Ee=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.v?.();let e=this.$["*on.cancel"];e?.();};this.xs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Gd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ei(this.$["*operationTooltip"])}),this.wr.value?.apply(),this.Ll();};this.qd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.wr.value?.cancel(),this.Ll();};this.Wd=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.bs(r,{fromViewer:false}));};}Ll(){this.$["*showSlider"]=false,this.$["*tabId"]===B.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===B.TUNING&&(this.ys=false);}bs(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Rl(t,{fromViewer:e,force:r});}Rl(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.ot();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===B.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of ot){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.ot();}}ot(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Ol.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Ml!==s||this.Il!==n)&&(this.Ml=s,this.Il=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get Ts(){return this.wi.length>=3}Dd(t){switch(t){case B.CROP:return this.Fd();case B.FILTERS:return this.Nd();case B.TUNING:return this.Vd();default:return []}}Fd(){let t=[];if(this.Ts)t.push(()=>this._d());else for(let e of this.wi)t.push(()=>this.Ul(e));for(let e of yn)t.push(()=>this.Bd(e));return this.Es(t)}Nd(){let e=[Vt,...vn].map(r=>()=>this.zd(r));return this.Es(e)}Vd(){let t=gn.map(e=>()=>this.Hd(e));return this.Es(t)}Es(t){return t.length?t.map(r=>r()):[]}_d(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Ul(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Bd(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}zd(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Hd(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Kd(){return this.Ts?this.wi.map(t=>this.Ul(t)):[]}async jd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ti(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.v?.();let{cancel:r}=Si([e]);this.v=()=>{r(),this.v=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.wi=[...t],this.sub("*cropPresetList",e=>{this.wi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.bs(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Er();}),this.sub("*currentOperation",()=>{this.Er();}),this.sub("*tabId",e=>{this.Rl(e,{fromViewer:false,force:true}),this.Er();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.jd(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,n]of s.entries())if(n){r=true;break}}this.Tr(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.br=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.br=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Al=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.bs(r,{fromViewer:false});return}this.ot();}),this.sub("*operationTooltip",e=>{this.kl=e;}),this.Er();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Pl);}firstUpdated(t){super.firstUpdated(t),this.xr(),this.ot();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ot()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.xr();}disconnectedCallback(){window.removeEventListener("resize",this.Pl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}xr(){let t=this.wr.value;t&&(this.$["*sliderEl"]=t);}Zd(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?Se({gridColumn:`${s+1}`}):U;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Ud}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${r?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${r} style=${n} @click=${this.Wd} ${O(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Yd(t){let e=this.Dd(t);return v`<div id=${`tab_${t}`} 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">${e.length?e:U}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.ys?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Ts;return v`<uc-line-loader-ui .active=${this.bi}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.kl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Ld} ><div class="uc-tab-content-row">${ot.map(r=>Ii(this.activeTab===r,()=>this.Yd(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Al} .styles=${this.$d} @initial-render=${()=>this.ot()} ><div class="uc-tab-toggles_indicator" ${O(this.Ol)} ></div>${ot.map(r=>this.Zd(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ee} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.xs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Rd}><div class="uc-slider" ?hidden=${!this.br}><uc-editor-slider ${O(this.wr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.br||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.Kd()}</div>`:U}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.qd} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Gd} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([m()],ut.prototype,"bi",2),p([m()],ut.prototype,"showMainToolbar",2),p([m()],ut.prototype,"showSubToolbar",2),p([m()],ut.prototype,"Al",2),p([m()],ut.prototype,"tabList",2),p([m()],ut.prototype,"activeTab",2),p([m()],ut.prototype,"br",2),p([m()],ut.prototype,"ys",2),p([m()],ut.prototype,"kl",2),p([m()],ut.prototype,"wi",2);var il=Bt([...ot]),et=class extends C{constructor(){super(...arguments);this.ctxOwner=true;this.Xd="";this.et=It;this.Qd="";this.bi=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=il;this.$l=false;this.ke=false;this.Cs=null;this.Ti=null;this.Tr=$(t=>{this.bi=t;},300);this.Cr=S();this.Dl=S();this.Fl=S();this.Nl=S();this.Vl=()=>{this.Tr(false),this.et!==It&&(this.$["*networkProblems"]=false);};this._l=()=>{this.Tr(false),this.$["*networkProblems"]=true;};this.Jd=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Ya(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}ep(){this.ke||this.Cs||(this.Cs=this.updateComplete.then(()=>{this.Cs=null,this.ke=true;}));}initCallback(){super.initCallback(),this.Bl(),this.zl();}xr(){let t=this.Fl.value;t&&(this.$["*faderEl"]=t);let e=this.Dl.value;e&&(this.$["*cropperEl"]=e);let r=this.Nl.value;r&&(this.$["*imgContainerEl"]=r);let s=this.Cr.value;s&&(this.$["*imgEl"]=s);}tp(){let t=this.Cr.value;t&&(t.addEventListener("load",this.Vl),t.addEventListener("error",this._l));}ip(){let t=this.Cr.value;t&&(t.removeEventListener("load",this.Vl),t.removeEventListener("error",this._l));}get rp(){let t=this.$["*tabId"];return vt("uc-image",{"uc-image_hidden_to_cropper":t===B.CROP,"uc-image_hidden_effects":t!==B.CROP})}Hl(){if(this.Ti)return this.Ti;let t=3e3;return this.Ti=new Promise((e,r)=>{let s=()=>{window.clearTimeout(d),c.disconnect(),this.Ti=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{s(),window.setTimeout(()=>e(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(u.message),r(u);},c=new ResizeObserver(u=>{let[h]=u;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),d=window.setTimeout(()=>{l();},t);if(n()){a();return}c.observe(this);}),this.Ti}firstUpdated(t){super.firstUpdated(t),this.xr(),this.tp(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.ip(),super.disconnectedCallback();}render(){let t=this.Qd??"",e=this.Xd??"",r=this.et||It,s=this.bi,n=this.$l;return v` ${De(Xa)}<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.Jd}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${O(this.Nl)}><img src=${r} class=${this.rp} ${O(this.Cr)} />${Ii(this.ke,()=>v`<uc-editor-image-cropper ${O(this.Dl)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${O(this.Fl)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</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">${Ii(this.ke,()=>v`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.Bl(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.zl();}Bl(){let t=this.tabs||il;this.$["*tabList"]=Za(t);}zl(){let t=Nr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=ko(this.cdnUrl),s=Mo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=ga(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.Hl();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=sr(t),r=Qt(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=ko(t),n=Mo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Qt(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===B.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(W(t,rt("json"))),r=await fetch(e).then(a=>a.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===B.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:t});}catch(t){t&&(this.telemetryManager.sendEventError(t,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",t));}this.ep();}}}async initEditor(){try{await this.Hl();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.$l=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=rt(Jt(t),"preview"),s=W(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([m()],et.prototype,"Xd",2),p([m()],et.prototype,"et",2),p([m()],et.prototype,"Qd",2),p([m()],et.prototype,"bi",2),p([y({type:String,reflect:true})],et.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],et.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],et.prototype,"cropPreset",2),p([y({type:String,reflect:true})],et.prototype,"tabs",2),p([m()],et.prototype,"$l",2),p([m()],et.prototype,"ke",2);var Ps={};Ds(Ps,{CloudImageEditorActivity:()=>Vi});var io=class extends et{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Vi=class extends R{constructor(){super(...arguments);this.Q=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.Q&&this.Q.cropPreset!==t&&(this.Q={...this.Q,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.Q&&this.Q.tabs!==t&&(this.Q={...this.Q,tabs:t});}),this.op();}disconnectedCallback(){super.disconnectedCallback(),this.sp();}xs(t){if(!this.Ei)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ei.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(x.activities.CLOUD_IMG_EDIT),this.historyBack();}Ee(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(x.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}op(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Ei=e;let r=this.Ei.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.Q=this.np(r);}sp(){this.Ei=void 0,this.Q=null;}render(){if(!this.Q)return U;let{cdnUrl:t,cropPreset:e,tabs:r}=this.Q;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${q(e)} tabs=${q(r)} @apply=${this.xs} @cancel=${this.Ee} @change=${this.handleChange} ></uc-cloud-image-editor>`}np(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([m()],Vi.prototype,"Q",2);var ii=class extends R{constructor(){super(...arguments);this.Kl={importDisabled:true};this.$e=S();this.gs=t=>{let e=t.target?.value??"";this.Kl={importDisabled:!e};};this._o=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let r=this.$e.value?.value?.trim();r&&(this.api.addFileFromUrl(r,{source:N.URL}),this.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.modalManager?.open(x.activities.UPLOAD_LIST));};}firstUpdated(){let t=this.$e.value;t&&(t.value="",t.focus());}render(){return v`<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._o}><label><input ${O(this.$e)} placeholder="https://" class="uc-url-input" type="text" @input=${this.gs} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.Kl.importDisabled} >${this.l10n("upload-url")}</button></form>`}};p([m()],ii.prototype,"Kl",2);var rl=()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}};var gd=o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),ol=(o,i="i")=>{let t=o.split("*").map(gd);return new RegExp(`^${t.join(".+")}$`,i)};var vd=["--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"],yd=(o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),sl=o=>{let i={};for(let t of vd){let e=yd(o,t);e&&(i[t]=e);}return i};var bd=["selected-files-change","toolbar-state-change"],wd=o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!bd.includes(i))},ro=class{constructor(i,t){this.Sr=new Map;this.Gl=i=>{if(i.source!==this.Ss)return;let t=i.data;if(!wd(t))return;let e=this.Sr.get(t.type);if(e)for(let r of e)r(t);};this.Ss=i,this.jl=t,window.addEventListener("message",this.Gl);}on(i,t){let e=this.Sr.get(i)??new Set;this.Sr.has(i)||this.Sr.set(i,e),e.add(t);}send(i){let t=this.jl();this.Ss.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Gl);}};function nl(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var Td={[Ct.GDRIVE]:"ngdrive"},dt=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Nt=S();this.Ar=null;this.As=[];this.ks=false;this.Ms=false;this.Is=false;this.Os=false;this.kr=false;this.Ps=false;this.Ls="uc-hidden";this.ql=true;this.Bo=()=>{for(let t of this.As){let e=this.lp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.modalManager?.open(x.activities.UPLOAD_LIST);};this.Ee=()=>{this.historyBack();};this.fp=()=>{this.ne?.send({type:"select-all"});};this.mp=()=>{this.ne?.send({type:"deselect-all"});};}get ap(){if(!this.Ar)return "";let{selectedCount:t,total:e}=this.Ar;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.Wl():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.Zl(),this.Wl());});}),this.subConfigValue("multiple",e=>{this.kr=e;}),this.subConfigValue("localeName",()=>{this.Yl();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.Xl(e);});}lp(t){if(t.alternatives){let e=Z(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=ol(r);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}cp(t){this.ql=t.isVisible;}async up(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.dp(t.selectedCount,t.total),this.Ls=t.isReady?"":"uc-hidden",this.ks=t.isReady,this.Ms=t.isReady&&t.selectedFiles.length>0,this.kr=t.isMultipleMode&&t.total>0,this.Is=t.selectedCount<t.total,this.Os=t.selectedCount===t.total,this.As=t.selectedFiles??[],this.Ps=t.total>0;}Ql(){this.Xl(this.cfg.externalSourcesEmbedCss),this.pp(),this.Yl();}pp(){this.ne?.send({type:"set-theme-definition",theme:sl(this)});}Xl(t){this.ne?.send({type:"set-embed-css",css:t});}Yl(){this.ne?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}hp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=Td[n]??n,c={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||rl(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,r);return d.search=nl(c),d.toString()}dp(t,e){this.Ar={selectedCount:t,total:e};}Wl(){let t=document.createElement("iframe");t.src=this.hp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.Ql.bind(this)),t.addEventListener("load",this.Ql.bind(this)),this.Nt.value&&(this.Nt.value.innerHTML="",this.Nt.value.appendChild(t)),t.contentWindow&&(this.ne?.destroy(),this.ne=new ro(t.contentWindow,()=>this.cfg.socialBaseUrl),this.ne.on("selected-files-change",this.up.bind(this)),this.ne.on("toolbar-state-change",this.cp.bind(this)),this.Jl());}Zl(){this.ne?.destroy(),this.ne=void 0,this.Nt.value&&(this.Nt.value.innerHTML=""),this.Jl();}Jl(){this.As=[],this.ks=false,this.Ms=false,this.Is=false,this.Os=false,this.kr=false,this.Ps=false,this.Ls="uc-hidden",this.Ar=null;}disconnectedCallback(){super.disconnectedCallback(),this.Zl();}render(){return v`<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 ${O(this.Nt)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.ql}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.kr}><span>${this.ap}</span><button type="button" @click=${this.fp} ?hidden=${!this.Is}>${this.l10n("select-all")}</button><button type="button" @click=${this.mp} ?hidden=${!this.Os}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.Bo} ?disabled=${!this.Ms} ?hidden=${!this.Ps} ><uc-spinner ?hidden=${this.ks}></uc-spinner><span class=${this.Ls}>${this.l10n("done")}</span></button></div></div>`}};p([m()],dt.prototype,"As",2),p([m()],dt.prototype,"ks",2),p([m()],dt.prototype,"Ms",2),p([m()],dt.prototype,"Is",2),p([m()],dt.prototype,"Os",2),p([m()],dt.prototype,"kr",2),p([m()],dt.prototype,"Ps",2),p([m()],dt.prototype,"Ls",2),p([m()],dt.prototype,"ql",2);var al=()=>typeof navigator.permissions<"u";var Ed={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Cd=["camera","microphone"];function oo(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}var ll="image/jpeg",cl="video/webm",_=class extends R{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Mr=null;this.Rs=false;this.xi=[];this.me=null;this.ge=null;this.Ir=null;this.Or=null;this.b=null;this.Ci={};this.fe=null;this.e=null;this.Vt=[];this._t=[];this.gp={};this.Pr=[];this.Lr=null;this.ec=()=>{this.tc(),this.Si="pause";};this.ic=()=>{this.Si="play",this.vp();};this.Ai=S();this.Qe=S();this.K=S();this.rc=S();this.oc=0;this.sc=0;this.nc=null;this.Rr=true;this.Ur=true;this.yp=al();this.ac=[];this.at=true;this.Us="";this.Bt=true;this.pt=true;this.zt=true;this.cc=[];this.mt=true;this.$s=true;this.gt=true;this.Ce=true;this.vt=true;this.Ht="camera-full";this.Si="play";this.uc="microphone";this.$r="uc-shot-btn uc-camera-action";this.bp=()=>{if(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.b}}}),this.b===L.PHOTO&&this.wp(),this.b===L.VIDEO){if(this.me?.state==="recording"){this.dc();return}this.Tp();}};this.Ep=t=>{let e=t.target;e&&(this.Or=e.value,this.Kt());};this.xp=t=>{let e=t.target;e&&(this.Ir=e.value,this.Kt());};this.Cp=()=>{this.Kt();};this.Sp=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.b}}}),this.bp();};this.Ap=()=>{this.kp();};this.Mp=()=>{this.Ip();};this.Op=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.b}}}),this.Pp();};this.Lp=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.b}}}),this.Rp();};this.pc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.hc(r);};this.fc=()=>{let t=Math.floor((performance.now()-this.oc+this.sc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Ai.value;s&&(s.textContent=oo(e)),this.dc();return}let r=this.Ai.value;r&&(r.textContent=oo(e));}else {let e=this.Ai.value;e&&(e.textContent=oo(t));}this.jt=requestAnimationFrame(this.fc);};this.Up=()=>{this.oc=performance.now(),this.sc=0,this.fc();};this.mc=()=>{this.jt&&cancelAnimationFrame(this.jt);};this.tc=()=>{let t=this.K.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.Qe.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.Ai.value;n&&(n.textContent=oo(e)),this.jt=requestAnimationFrame(this.tc);};this.vp=()=>{this.jt&&cancelAnimationFrame(this.jt);};this.jt=null;this.Tp=()=>{try{this.xi=[],this.Ci={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Ci.mimeType=t:MediaRecorder.isTypeSupported(cl)?this.Ci.mimeType=cl:this.Ci.mimeType="video/mp4",this.ge&&(this.me=new MediaRecorder(this.ge,this.Ci),this.me.start(),this.me.addEventListener("dataavailable",e=>{this.xi.push(e.data);}),this.Up(),this.classList.add("uc-recording"),this.ki(Et.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.dc=()=>{this.me?.addEventListener("stop",()=>{this.$p(),this.mc(),this.ki(Et.STOP);}),this.me?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.b}}});};this.kp=()=>{if(this.me?.state==="recording")return;let t=this.K.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.Ip=()=>{this.ge?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.uc=t.enabled?"microphone":"microphone-mute",this.$s=!t.enabled;});};this.$p=()=>{try{let t=new Blob(this.xi,{type:this.me?.mimeType}),e=URL.createObjectURL(t),r=this.K.value;if(!r)return;r.muted=!1,r.volume=1,this.Mi(null),r.src=e,this.Dp(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Pp=()=>{if(this.ki(Et.RETAKE),this.b===L.VIDEO){this.Mi(this.ge);let t=this.K.value;t&&(t.muted=true);}this.K.value?.play?.();};this.Rp=()=>{if(this.ki(Et.ACCEPT),this.b===L.PHOTO){this.fe?.toBlob(s=>{if(!s)return;let n=this.gc("camera","jpeg",ll,s);this.vc(n);},ll);return}let t=new Blob(this.xi,{type:this.me?.mimeType}),e=this.Fp(this.me?.mimeType),r=this.gc("video",e,`video/${e}`,t);this.vc(r),this.xi=[];};this.Np=t=>{t===Et.SHOT&&(this.vt=true,this.pt=true,this.Ce=true,this.zt=false,this.at=true),(t===Et.RETAKE||t===Et.ACCEPT)&&(this.vt=!this.Se.includes(L.VIDEO),this.Ce=!this.Se.includes(L.PHOTO),this.pt=false,this.zt=true,this.at=this.Vt.length<=1);};this.Vp=t=>{t===Et.PLAY&&(this.Bt=false,this.Ce=true,this.at=true,this.mt=true,this.Si="pause",this.Ht="square",this.$r="uc-shot-btn uc-camera-action uc-stop-record"),t===Et.STOP&&(this.Bt=false,this.pt=true,this.gt=true,this.zt=false),(t===Et.RETAKE||t===Et.ACCEPT)&&(this.Bt=true,this.vt=!this.Se.includes(L.VIDEO),this.Ce=!this.Se.includes(L.PHOTO),this.pt=false,this.zt=true,this.gt=!this.cfg.enableAudioRecording,this.Ht="video-camera-full",this.$r="uc-shot-btn uc-camera-action",this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.at=this.Vt.length<=1);};this.ki=t=>{this.b===L.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Np(t),this.b===L.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Vp(t);};this.hc=t=>{this.rc.value?.querySelectorAll("button").forEach(r=>{r.classList.toggle("uc-active",r.getAttribute("data-id")===t);}),t===L.PHOTO&&(this.Ht="camera-full",this.mt=true,this.gt=true),t===L.VIDEO&&(this.Si="play",this.Ht="video-camera-full",this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.gt=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.b=t;};this.gc=(t,e,r,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:r})};this.vc=t=>{this.api.addFileFromObject(t,{source:N.CAMERA}),this.set$({"*currentActivity":x.activities.UPLOAD_LIST}),this.modalManager?.open(x.activities.UPLOAD_LIST);};this.Ii=$(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.b===L.VIDEO&&this.cfg.enableAudioRecording,r=this.b===L.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Rr=false,this.pt=false,this.Ce=!this.Se.includes(L.PHOTO),this.vt=!this.Se.includes(L.VIDEO),this.Ur=true,this.Bt=true,this.Ht=r,this.gt=!e,this.mt=!e):t==="prompt"?(this.Us="camera-permissions-prompt",this.Rr=true,this.pt=true,this.Ce=true,this.Ur=false,this.Ns()):(this.Us="camera-permissions-denied",this.Rr=true,this.Ur=false,this.Ce=!this.Se.includes(L.PHOTO),this.vt=!this.Se.includes(L.VIDEO),this.zt=true,this.$r="uc-shot-btn uc-camera-action",this.Ns());},300);this._p=()=>{if(!this.ge)return false;let t=this.ge?.getAudioTracks(),e=this.ge?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.Ns=()=>{this.Rs&&(this.K.value&&(this.K.value.volume=0),this.Lr?.getTracks?.()?.[0]?.stop(),this.Ds(this.K.value),this.Mi(null),this._p(),this.mc(),this.Rs=false);};this.Kt=async()=>{let t={video:{...Ed},audio:this.cfg.enableAudioRecording?{}:false};this.Or&&(t.video={deviceId:{exact:this.Or}}),this.Ir&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Ir}}),this.K.value&&(this.K.value.volume=0);try{this.Ii("prompt"),this.ge=await navigator.mediaDevices.getUserMedia(t),this.ge.addEventListener("inactive",()=>{this.Ii("denied");}),this.Mi(this.ge),this.Rs=!0,this.Ii("granted");}catch(e){this.Ii("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.yc=()=>{this.Kt();};this.Bp=async()=>{try{this.Dr();for(let t of Cd){let e=await navigator.permissions.query({name:t});this.gp[t]=e,e.addEventListener("change",this.yc),this.Pr.push(()=>{e.removeEventListener("change",this.yc);});}this.Mr=()=>{this.Dr();};}catch(t){this.Dr(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.Kt();}};this.zp=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.Vs(),navigator.mediaDevices.addEventListener("devicechange",this.Vs);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.Vs=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Vt=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this._t=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.ac=this.Vt,this.at=this.Vt.length<=1,this.Or=this.Vt[0]?.value??null,this.cc=this._t,this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.Ir=this._t[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Hp=async()=>{await this.Bp(),await this.zp(),await this.Kt(),this.bc(this.Se);};this.Kp=async()=>{this.Mr&&this.Mr(),window.chrome||this.Ii("denied"),this.Ns();};this.bc=t=>{this.vt=!t.includes(L.VIDEO),this.Ce=!t.includes(L.PHOTO);let e=t[0];e&&(!this.b||!t.includes(this.b))&&this.hc(e);};}Dp(t){this.Ds(t),t.addEventListener("play",this.ec),t.addEventListener("pause",this.ic);}Ds(t){t?.removeEventListener("play",this.ec),t?.removeEventListener("pause",this.ic);}Mi(t){this.Lr!==t&&(this.Lr=t,this.Fs());}Fs(){let t=this.K.value;if(!t)return;let e=this.Lr??null;t.srcObject!==e&&(t.srcObject=e);}wp(){if(this.ki("shot"),this.fe=document.createElement("canvas"),this.e=this.fe.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this.K.value;if(!t)throw new Error("Video element not found");this.fe.height=t.videoHeight,this.fe.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.fe.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}Fp(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let r=t.split("/");if(r?.[0]==="video"){let n=r.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get Se(){return Z(this.cfg.cameraModes).filter(t=>t===L.PHOTO||t===L.VIDEO)}Dr(){if(this.Pr.length!==0){for(let t of this.Pr)t();this.Pr=[],this.Mr=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.nc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.gt=!t,this.$s=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=K(t);this.bc(e.filter(r=>r===L.PHOTO||r===L.VIDEO));}),this.Hp();}firstUpdated(t){super.firstUpdated(t),this.Fs();}updated(t){super.updated(t),this.Fs();}jp(){this.Dr(),navigator.mediaDevices?.removeEventListener("devicechange",this.Vs),this.Ds(this.K.value),this.Mi(null);}disconnectedCallback(){super.disconnectedCallback(),this.Kp(),this.jp();}render(){return v`<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.at}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.ac} ?hidden=${this.at} @change=${this.Ep} ></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=${Se({transform:this.nc})} ?hidden=${this.Rr} ${O(this.K)} ></video><div class="uc-message-box" ?hidden=${this.Ur}><span>${this.l10n(this.Us)}</span><button type="button" @click=${this.Cp} ?hidden=${this.yp} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${O(this.rc)} class="uc-switcher" ?hidden=${!this.Bt}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.pc} ?hidden=${this.Ce} 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.pc} ?hidden=${this.vt} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.Ap} ?hidden=${this.Bt} data-testid="recording-timer" ><uc-icon name=${this.Si}></uc-icon><span ${O(this.Ai)}> 00:00 </span><span ${O(this.Qe)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.zt} ><button type="button" class="uc-secondary-btn" @click=${this.Op}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.Lp} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this.Sp} class=${this.$r} ?hidden=${this.pt} ><uc-icon name=${this.Ht}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.Mp} ?hidden=${this.gt} data-testid="toggle-microphone" ><uc-icon name=${this.uc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.cc} ?hidden=${this.mt} ?disabled=${this.$s} @change=${this.xp} data-testid="audio-select" ></uc-select></div></div>`}};p([m()],_.prototype,"nc",2),p([m()],_.prototype,"Rr",2),p([m()],_.prototype,"Ur",2),p([m()],_.prototype,"yp",2),p([m()],_.prototype,"ac",2),p([m()],_.prototype,"at",2),p([m()],_.prototype,"Us",2),p([m()],_.prototype,"Bt",2),p([m()],_.prototype,"pt",2),p([m()],_.prototype,"zt",2),p([m()],_.prototype,"cc",2),p([m()],_.prototype,"mt",2),p([m()],_.prototype,"$s",2),p([m()],_.prototype,"gt",2),p([m()],_.prototype,"Ce",2),p([m()],_.prototype,"vt",2),p([m()],_.prototype,"Ht",2),p([m()],_.prototype,"Si",2),p([m()],_.prototype,"uc",2),p([m()],_.prototype,"$r",2);var ul={id:"camera",setup:async({pluginApi:o,uploaderApi:i})=>{ht({CameraSource:_}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!_n.htmlMediaCapture)return ["camera"];let t=K(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},onSelect:()=>{i.setCurrentActivity(F.CAMERA),i.setModalState(true);}}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),o.registry.registerActivity({id:F.CAMERA,render:t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}}});}};var Ls={};Ds(Ls,{BtnUi:()=>xt,CloudImageEditor:()=>io,CloudImageEditorBlock:()=>et,Config:()=>Xe,CropFrame:()=>Pi,EditorAspectRatioButtonControl:()=>Ri,EditorCropButtonControl:()=>$i,EditorFilterControl:()=>Zt,EditorFreeformButtonControl:()=>eo,EditorImageCropper:()=>Li,EditorImageFader:()=>Qr,EditorOperationControl:()=>Di,EditorScroller:()=>Fi,EditorSlider:()=>Ui,EditorToolbar:()=>ut,Icon:()=>ne,LineLoaderUi:()=>Oi,PresenceToggle:()=>Je,SliderUi:()=>Ft,defineComponents:()=>ht});var xd="cloud-image-editor",Sd="<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>",dl={id:xd,setup:async({pluginApi:o,uploaderApi:i})=>(ht({...Ls,...Ps}),o.registry.registerIcon({name:"edit-file",svg:Sd}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:e=>!!(e.isImage&&e.cdnUrl),onClick:e=>{i.setCurrentActivity?.(F.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);}}),o.registry.registerActivity({id:F.CLOUD_IMG_EDIT,render:e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}}}),i.on(M.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),n=o.config.get("cloudImageEditorAutoOpen"),a=i.g.size;s&&a===1&&(r||n)&&(i.setCurrentActivity?.(F.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));}))};var pl={id:"external-sources",setup:async({pluginApi:o,uploaderApi:i})=>{ht({ExternalSource:dt}),o.registry.registerActivity({id:F.EXTERNAL,render:t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}}});for(let t of Object.values(Ct))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:()=>{i.setCurrentActivity(F.EXTERNAL,{externalSourceType:t}),i.setModalState(true);}});}};var no=()=>{let o=[];return {stack:o,promiseReadJpegChunks:t=>new Promise((e,r)=>{let s=2,n=(c,d)=>{let u=new FileReader;u.addEventListener("load",()=>{d(new DataView(u.result));}),u.addEventListener("error",h=>{r(`Reader error: ${h}`);}),u.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let d,u,h;for(d=u=0,h=c.byteLength;h>=0?u<h:u>h;d=h>=0?++u:--u)if(c.getUint8(d)===255){s+=d;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){r("Corrupted");return}let u=d.getUint8(1);if(u===218){e(true);return}let h=d.getUint16(2)-2;return n(t.slice(s,s+=h),f=>{if(f.byteLength!==h){r("Corrupted");return}o.push({startPos:c,length:h,marker:u,view:f}),a();})})};FileReader&&DataView||r("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&r("Not jpeg"),a();});})}},Ad=async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=no();return await t(o),e.forEach(({marker:r,view:s})=>{r===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},fl=async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=no();await s(o),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),r.push(c.length)});let a=[o.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),a.push(d.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(o.slice(l,e[c])),l=e[c]+r[c]+4;return a.push(o.slice(l,o.size)),new Blob(a,{type:o.type})}};var ml=(o,i)=>fl(o,226,i.map(t=>t.buffer)),kd=async o=>{try{return await ml(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Md=(o,i,t)=>new Promise((e,r)=>{let s=n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);};o.toBlob(s,i,t),o.width=o.height=1;}),Ni=()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},Id=o=>{let{ctx:t,canvas:e}=Ni();e.width=e.height=50,t.drawImage(o,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<r.length;s+=4)if(r[s]<254)return true;return false},Od=async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=no();return await t(o),e.forEach(({marker:r,view:s})=>{if(!i&&r===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},Pd="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",so,Ld=()=>new Promise(o=>{if(so!==void 0)o(so);else {let i=new Image;i.addEventListener("load",()=>{so=i.naturalWidth<i.naturalHeight,i.src="//:0",o(so);}),i.src=Pd;}}),Ud=(o,i)=>{let t,e,r,s;if(!o||o.byteLength<14||o.getUint32(0)!==1165519206||o.getUint16(4)!==0)return;if(o.getUint16(6)===18761)e=true;else if(o.getUint16(6)===19789)e=false;else return;if(o.getUint16(8,e)!==42)return;r=8+o.getUint32(10,e);let n=o.getUint16(r-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(o.byteLength<r+10)return;o.getUint16(r,e)===274&&i(r+8,e),r+=12;}},Rd=(o,i)=>{Ud(o,(t,e)=>o.setUint16(t,i,e));},$d=async(o,i,t)=>(t&&Rd(i,1),fl(o,225,[i.buffer])),Dd=(o,i)=>new Promise((t,e)=>{i&&(o.src=i),o.complete?t(o):(o.addEventListener("load",()=>{t(o);}),o.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),Fd=o=>Dd(new Image,o),Vd=[1,3],Nd=[192,193,194,195,197,198,199,201,202,203,205,206,207],hl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},_d=async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=no();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&Nd.indexOf(r)>=0){let n=s.getUint8(5);Vd.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},gl=(o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},vl=(o,i)=>{let[t]=o,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,s)=>r-s);for(let r=0;r<e.length;r++){let s=e[r],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},ce={R:55,G:110,B:165,A:255},zd=`rgba(${ce.R}, ${ce.G}, ${ce.B}, ${ce.A/255})`,yl=(o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=Ni();e.width=1,e.height=1;let{canvas:s,ctx:n}=Ni();s.width=o,s.height=i,n&&(n.fillStyle=zd,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===ce.R&&a[1]===ce.G&&a[2]===ce.B&&a[3]===ce.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}};function bl(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}var Bd=bl(gl(yl,vl)),Hd=bl(gl(yl,vl)),wl=async(o,i)=>{let t=hl.squareSide.find(n=>n*n>=o*i),e=hl.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([Bd(t,t),Hd(e,1)]);if(r&&s)return true;throw new Error("Not supported")},Tl=async(o,i,t)=>{try{let{ctx:e,canvas:r}=Ni();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(o,0,0,i,t),o instanceof HTMLImageElement&&(o.src="//:0"),o instanceof HTMLCanvasElement&&(o.width=o.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},Kd=({img:o,targetW:i,targetH:t})=>Tl(o,i,t),jd=function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,n=t;do r.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<o*e);return r.reverse()},Gd=({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=jd({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[a,l],c)=>n.then(d=>wl(a,l).then(()=>Tl(d,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return d})),Promise.resolve(o))},qd=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Wd=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Us=.71,Zd=(o,i)=>{if(o.width*Us*o.height*Us<i.size)throw new Error("Not required");let t=o.width,e=o.height,r=t/e,s=Math.floor(Math.sqrt(i.size*r)),n=Math.floor(i.size/Math.sqrt(i.size*r));return wl(s,n).then(()=>{let{ctx:a}=Ni();return "imageSmoothingQuality"in a&&!qd()&&!Wd?Kd({img:o,targetW:s,targetH:n}):Gd({img:o,sourceW:t,targetW:s,targetH:n,step:Us})}).catch(()=>Promise.reject("Not supported"))},El=async(o,i)=>{try{if(await _d(o))throw new Error("Should skipped");let e=await Promise.allSettled([Od(o),Ld(),Ad(o)]),s=!e.some(b=>b.status==="rejected"),[n,a,l]=e,c=await kd(o).catch(()=>o),d=await Fd(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let u=await Zd(d,i),h="image/jpeg",f=i?.quality||.8;!s&&Id(u)&&(h="image/png",f=void 0);let g=await Md(u,h,f);if(s&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await $d(g,b,w);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await ml(g,l.value)),g}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}};var Yd=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Cl=o=>{if(typeof o!="string")return false;let i=Yd.exec(o.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}};var xl={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=Cl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await El(i,e)}}catch{return {file:i}}}});}};var Sl={id:"instagram",setup({pluginApi:o}){o.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 Al={id:N.LOCAL,setup:({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:N.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{i.openSystemDialog();}});}};var kl={id:"url-source",setup:async({pluginApi:o,uploaderApi:i})=>{ht({UrlSource:ii}),o.registry.registerActivity({id:F.URL,render:t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}}}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{i.setCurrentActivity(F.URL),i.setModalState(true);}});}};var ri=[{configDeps:["useCloudImageEditor"],isEnabled:o=>!!o("useCloudImageEditor"),load:()=>dl},{configDeps:["imageShrink"],isEnabled:o=>!!o("imageShrink"),load:()=>xl},{configDeps:["sourceList"],isEnabled:o=>K(o("sourceList")).includes(N.LOCAL),load:()=>Al},{configDeps:["sourceList"],isEnabled:o=>K(o("sourceList")).includes(N.CAMERA),load:()=>ul},{configDeps:["sourceList"],isEnabled:o=>K(o("sourceList")).includes("instagram"),load:()=>Sl},{configDeps:["sourceList"],isEnabled:o=>Object.values(Ct).some(i=>K(o("sourceList")).includes(i)),load:()=>pl},{configDeps:["sourceList"],isEnabled:o=>K(o("sourceList")).includes(N.URL),load:()=>kl}];var ao=class extends Wt{constructor(){super();this.headless=false;this.init$={...this.init$};}static{this.lazyPlugins=ri;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});}render(){return v` ${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>`}};p([y({type:Boolean})],ao.prototype,"headless",2);var lo=class extends Wt{constructor(){super();this.wc=false;this.Ee=()=>{if(this.Tc){let t=this.$["*historyBack"];t?.();return}this.Ec&&(this.$["*currentActivity"]=x.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=ri;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Tc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==x.activities.START_FROM}get Ec(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}_s(){return this.getCssData("--cfg-init-activity")||x.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this._s();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=x.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.wc=this.Tc||this.Ec;});}render(){return v` ${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.Ee} ?hidden=${!this.wc} >${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>`}};p([m()],lo.prototype,"wc",2);var Rs="active",co="",Ae=class extends Wt{constructor(){super();this.Bs=false;this.Fr=false;this.Nr=co;this.zs=co;this.oi=t=>{t.id===x.activities.CLOUD_IMG_EDIT&&(this.Nr=Rs),this.$["*currentActivity"]===x.activities.UPLOAD_LIST&&(this.Nr=Rs,this.Fr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.zs=Rs);};this.si=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.Fr=false),t.id===x.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=x.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=ri;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}_s(){return this.getCssData("--cfg-init-activity")||x.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this._s();this.sub("*currentActivity",e=>{e===x.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=x.activities.UPLOAD_LIST,this.zs=co):(this.Nr=co,this.Fr=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",r=>{e==="grid"?(r?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.Bs=!r):(this.style.removeProperty("--uc-grid-col"),this.Bs=false);});}),this.modalManager?.subscribe(Y.OPEN,this.oi),this.modalManager?.subscribe(Y.CLOSE,this.si);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(Y.OPEN,this.oi),this.modalManager?.unsubscribe(Y.CLOSE,this.si);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.Fr} class=${this.zs}><uc-drop-area ?single=${this.Bs} 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.Nr}></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>`}};p([m()],Ae.prototype,"Bs",2),p([m()],Ae.prototype,"Fr",2),p([m()],Ae.prototype,"Nr",2),p([m()],Ae.prototype,"zs",2);/*! For license information please see uc-file-uploader-minimal.min.js.LEGAL.txt */
|
|
8
|
+
export{x as ActivityBlock,ys as ActivityHeader,Co as BaseComponent,C as Block,xt as BtnUi,_ as CameraSource,io as CloudImageEditor,Vi as CloudImageEditorActivity,et as CloudImageEditorBlock,Xe as Config,ms as Copyright,Pi as CropFrame,H as Data,gt as DropArea,Ri as EditorAspectRatioButtonControl,$i as EditorCropButtonControl,Zt as EditorFilterControl,eo as EditorFreeformButtonControl,Li as EditorImageCropper,Qr as EditorImageFader,Di as EditorOperationControl,Fi as EditorScroller,Ui as EditorSlider,ut as EditorToolbar,dt as ExternalSource,Ct as ExternalUploadSource,Ts as FileItem,lo as FileUploaderInline,Ae as FileUploaderMinimal,ao as FileUploaderRegular,qr as FormInput,ne as Icon,ds as Img,Oi as LineLoaderUi,Ei as Modal,Y as ModalEvents,Lt as PACKAGE_NAME,Ut as PACKAGE_VERSION,Mi as PluginActivityHost,Qe as PluginActivityRenderer,Je as PresenceToggle,je as ProgressBar,Ci as ProgressBarCommon,Ge as Select,ki as SimpleBtn,Ft as SliderUi,Wt as SolutionBlock,qe as SourceBtn,xi as SourceList,gs as Spinner,bs as StartFrom,Ze as Thumb,pt as UID,ws as UploadCtxProvider,Ot as UploadList,N as UploadSource,R as UploaderBlock,ii as UrlSource,ht as defineComponents,ln as defineLocale,Yl as loadFileUploaderFrom,cr as toKebabCase};
|