@uploadcare/file-uploader 1.28.0-alpha.1 → 1.28.0-alpha.666
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/loadFileUploaderFrom.d.ts +4 -3
- package/dist/abstract/loadFileUploaderFrom.js +6 -7
- package/dist/env.d.ts +4 -2
- package/dist/env.js +6 -7
- package/dist/index.css +6 -9
- package/dist/index.d.ts +3099 -42
- package/dist/index.js +8 -1796
- package/dist/index.layered.css +7 -9
- package/dist/index.ssr.js +1609 -0
- package/dist/locales/file-uploader/ar.d.ts +2 -1
- package/dist/locales/file-uploader/ar.js +6 -142
- package/dist/locales/file-uploader/az.d.ts +2 -1
- package/dist/locales/file-uploader/az.js +6 -134
- package/dist/locales/file-uploader/ca.d.ts +2 -1
- package/dist/locales/file-uploader/ca.js +6 -136
- package/dist/locales/file-uploader/cs.d.ts +2 -1
- package/dist/locales/file-uploader/cs.js +6 -138
- package/dist/locales/file-uploader/da.d.ts +2 -1
- package/dist/locales/file-uploader/da.js +6 -134
- package/dist/locales/file-uploader/de.d.ts +2 -1
- package/dist/locales/file-uploader/de.js +6 -134
- package/dist/locales/file-uploader/el.d.ts +2 -1
- package/dist/locales/file-uploader/el.js +6 -134
- package/dist/locales/file-uploader/en.d.ts +2 -1
- package/dist/locales/file-uploader/en.js +6 -7
- package/dist/locales/file-uploader/es.d.ts +2 -1
- package/dist/locales/file-uploader/es.js +6 -136
- package/dist/locales/file-uploader/et.d.ts +2 -1
- package/dist/locales/file-uploader/et.js +6 -134
- package/dist/locales/file-uploader/fi.d.ts +2 -1
- package/dist/locales/file-uploader/fi.js +6 -134
- package/dist/locales/file-uploader/fr.d.ts +2 -1
- package/dist/locales/file-uploader/fr.js +6 -136
- package/dist/locales/file-uploader/he.d.ts +2 -1
- package/dist/locales/file-uploader/he.js +6 -136
- package/dist/locales/file-uploader/hy.d.ts +2 -1
- package/dist/locales/file-uploader/hy.js +6 -134
- package/dist/locales/file-uploader/is.d.ts +2 -1
- package/dist/locales/file-uploader/is.js +6 -134
- package/dist/locales/file-uploader/it.d.ts +2 -1
- package/dist/locales/file-uploader/it.js +6 -136
- package/dist/locales/file-uploader/ja.d.ts +2 -1
- package/dist/locales/file-uploader/ja.js +6 -134
- package/dist/locales/file-uploader/ka.d.ts +2 -1
- package/dist/locales/file-uploader/ka.js +6 -134
- package/dist/locales/file-uploader/kk.d.ts +2 -1
- package/dist/locales/file-uploader/kk.js +6 -134
- package/dist/locales/file-uploader/ko.d.ts +2 -1
- package/dist/locales/file-uploader/ko.js +6 -134
- package/dist/locales/file-uploader/lv.d.ts +2 -1
- package/dist/locales/file-uploader/lv.js +6 -136
- package/dist/locales/file-uploader/nb.d.ts +2 -1
- package/dist/locales/file-uploader/nb.js +6 -134
- package/dist/locales/file-uploader/nl.d.ts +2 -1
- package/dist/locales/file-uploader/nl.js +6 -134
- package/dist/locales/file-uploader/pl.d.ts +2 -1
- package/dist/locales/file-uploader/pl.js +6 -138
- package/dist/locales/file-uploader/pt.d.ts +2 -1
- package/dist/locales/file-uploader/pt.js +6 -136
- package/dist/locales/file-uploader/ro.d.ts +2 -1
- package/dist/locales/file-uploader/ro.js +6 -136
- package/dist/locales/file-uploader/ru.d.ts +2 -1
- package/dist/locales/file-uploader/ru.js +6 -138
- package/dist/locales/file-uploader/sk.d.ts +2 -1
- package/dist/locales/file-uploader/sk.js +6 -138
- package/dist/locales/file-uploader/sr.d.ts +2 -1
- package/dist/locales/file-uploader/sr.js +6 -136
- package/dist/locales/file-uploader/sv.d.ts +2 -1
- package/dist/locales/file-uploader/sv.js +6 -134
- package/dist/locales/file-uploader/tr.d.ts +2 -1
- package/dist/locales/file-uploader/tr.js +6 -134
- package/dist/locales/file-uploader/uk.d.ts +2 -1
- package/dist/locales/file-uploader/uk.js +6 -138
- package/dist/locales/file-uploader/vi.d.ts +2 -1
- package/dist/locales/file-uploader/vi.js +6 -134
- package/dist/locales/file-uploader/zh-TW.d.ts +2 -1
- package/dist/locales/file-uploader/zh-TW.js +6 -134
- package/dist/locales/file-uploader/zh.d.ts +2 -1
- package/dist/locales/file-uploader/zh.js +6 -134
- package/package.json +34 -40
- package/web/file-uploader.iife.min.d.ts +3241 -0
- package/web/file-uploader.iife.min.js +8 -697
- package/web/file-uploader.iife.min.js.LEGAL.txt +71 -0
- package/web/file-uploader.min.d.ts +3241 -0
- package/web/file-uploader.min.js +7 -1858
- package/web/file-uploader.min.js.LEGAL.txt +71 -0
- package/web/uc-basic.layered.min.css +7 -6046
- package/web/uc-basic.min.css +6 -5487
- package/web/uc-cloud-image-editor.layered.min.css +7 -1884
- package/web/uc-cloud-image-editor.min.css +6 -1675
- package/web/uc-cloud-image-editor.min.d.ts +3198 -0
- package/web/uc-cloud-image-editor.min.js +7 -456
- package/web/uc-cloud-image-editor.min.js.LEGAL.txt +70 -0
- package/web/uc-file-uploader-inline.layered.min.css +7 -4352
- package/web/uc-file-uploader-inline.min.css +6 -3836
- package/web/uc-file-uploader-inline.min.d.ts +3241 -0
- package/web/uc-file-uploader-inline.min.js +7 -1858
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +71 -0
- package/web/uc-file-uploader-minimal.layered.min.css +7 -4352
- package/web/uc-file-uploader-minimal.min.css +6 -3836
- package/web/uc-file-uploader-minimal.min.d.ts +3241 -0
- package/web/uc-file-uploader-minimal.min.js +7 -1858
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +71 -0
- package/web/uc-file-uploader-regular.layered.min.css +7 -4352
- package/web/uc-file-uploader-regular.min.css +6 -3836
- package/web/uc-file-uploader-regular.min.d.ts +3241 -0
- package/web/uc-file-uploader-regular.min.js +7 -1858
- 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 +7 -894
- package/web/uc-img.min.js.LEGAL.txt +24 -0
- package/dist/ActivityHeader-R6Mlx-dA.js +0 -9
- package/dist/ActivityHeader.css +0 -23
- package/dist/ActivityHeader.layered.css +0 -24
- package/dist/CameraSource-DDwj1jCV.js +0 -511
- package/dist/CameraSource-n1tun2Df.js +0 -10
- package/dist/CameraSource.css +0 -180
- package/dist/CameraSource.layered.css +0 -209
- package/dist/CloudImageEditor-DcVoIRb3.js +0 -2163
- package/dist/CloudImageEditorActivity-Csij4nlC.js +0 -87
- package/dist/CloudImageEditorActivity-DD4NdU0P.js +0 -9
- package/dist/CloudImageEditorActivity.css +0 -14
- package/dist/CloudImageEditorActivity.layered.css +0 -15
- package/dist/Config-DKOromHY.js +0 -433
- package/dist/Config.css +0 -4
- package/dist/Config.layered.css +0 -5
- package/dist/ExternalSource-6MSUgxqy.js +0 -10
- package/dist/ExternalSource-DVEjSkPB.js +0 -253
- package/dist/ExternalSource.css +0 -98
- package/dist/ExternalSource.layered.css +0 -116
- package/dist/Icon-tXRTvEF2.js +0 -1810
- package/dist/Icon.css +0 -14
- package/dist/Icon.layered.css +0 -15
- package/dist/LitUploaderBlock-LxeOZ0ya.js +0 -998
- package/dist/UrlSource-BkyX00I2.js +0 -73
- package/dist/UrlSource-RI8TSD48.js +0 -10
- package/dist/UrlSource.css +0 -17
- package/dist/UrlSource.layered.css +0 -18
- package/dist/abstract/CTX.d.ts +0 -40
- package/dist/abstract/TypedCollection.d.ts +0 -47
- package/dist/abstract/TypedCollection.test.d.ts +0 -1
- package/dist/abstract/TypedData.d.ts +0 -12
- package/dist/abstract/TypedData.test.d.ts +0 -1
- package/dist/abstract/UploaderPublicApi.d.ts +0 -41
- package/dist/abstract/buildOutputCollectionState.d.ts +0 -3
- package/dist/abstract/customConfigOptions.d.ts +0 -65
- package/dist/abstract/defineComponents.d.ts +0 -1
- package/dist/abstract/features/ClipboardLayer.d.ts +0 -12
- package/dist/abstract/localeRegistry.d.ts +0 -5
- package/dist/abstract/managers/LocaleManager.d.ts +0 -10
- package/dist/abstract/managers/ModalManager.d.ts +0 -53
- package/dist/abstract/managers/SecureUploadsManager.d.ts +0 -7
- package/dist/abstract/managers/TelemetryManager.d.ts +0 -41
- package/dist/abstract/managers/ValidationManager.d.ts +0 -34
- package/dist/abstract/managers/__tests__/ModalManager.test.d.ts +0 -13
- package/dist/abstract/managers/__tests__/SecureUploadsManager.test.d.ts +0 -1
- package/dist/abstract/managers/a11y.d.ts +0 -9
- package/dist/abstract/managers/plugin/PluginManager.d.ts +0 -25
- package/dist/abstract/managers/plugin/PluginTypes.d.ts +0 -146
- package/dist/abstract/managers/plugin/index.d.ts +0 -2
- package/dist/abstract/sharedConfigKey.d.ts +0 -2
- package/dist/abstract/uploadEntrySchema.d.ts +0 -34
- package/dist/blocks/ActivityHeader/ActivityHeader.d.ts +0 -8
- package/dist/blocks/CameraSource/CameraSource.d.ts +0 -121
- package/dist/blocks/CameraSource/__tests__/calcCameraModes.test.d.ts +0 -1
- package/dist/blocks/CameraSource/calcCameraModes.d.ts +0 -5
- package/dist/blocks/CameraSource/constants.d.ts +0 -15
- package/dist/blocks/CloudImageEditor/index.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +0 -60
- package/dist/blocks/CloudImageEditor/src/CropFrame.d.ts +0 -56
- package/dist/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +0 -24
- package/dist/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +0 -14
- package/dist/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +0 -13
- package/dist/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +0 -35
- package/dist/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +0 -56
- package/dist/blocks/CloudImageEditor/src/EditorImageFader.d.ts +0 -63
- package/dist/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +0 -15
- package/dist/blocks/CloudImageEditor/src/EditorScroller.d.ts +0 -15
- package/dist/blocks/CloudImageEditor/src/EditorSlider.d.ts +0 -33
- package/dist/blocks/CloudImageEditor/src/EditorToolbar.d.ts +0 -68
- package/dist/blocks/CloudImageEditor/src/crop-utils.d.ts +0 -36
- package/dist/blocks/CloudImageEditor/src/crop-utils.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/cropper-constants.d.ts +0 -10
- package/dist/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +0 -31
- package/dist/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +0 -19
- package/dist/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +0 -27
- package/dist/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +0 -38
- package/dist/blocks/CloudImageEditor/src/index.d.ts +0 -15
- package/dist/blocks/CloudImageEditor/src/lib/classNames.d.ts +0 -5
- package/dist/blocks/CloudImageEditor/src/lib/classNames.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/linspace.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/linspace.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +0 -4
- package/dist/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +0 -2
- package/dist/blocks/CloudImageEditor/src/lib/pick.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/pick.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +0 -7
- package/dist/blocks/CloudImageEditor/src/state.d.ts +0 -20
- package/dist/blocks/CloudImageEditor/src/svg-sprite.d.ts +0 -2
- package/dist/blocks/CloudImageEditor/src/toolbar-constants.d.ts +0 -61
- package/dist/blocks/CloudImageEditor/src/types.d.ts +0 -60
- package/dist/blocks/CloudImageEditor/src/util.d.ts +0 -2
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +0 -7
- package/dist/blocks/CloudImageEditor/src/utils/parseFilterValue.test.d.ts +0 -1
- package/dist/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +0 -25
- package/dist/blocks/Config/Config.d.ts +0 -60
- package/dist/blocks/Config/assertions.d.ts +0 -5
- package/dist/blocks/Config/computed-properties.d.ts +0 -24
- package/dist/blocks/Config/computed-properties.test.d.ts +0 -1
- package/dist/blocks/Config/initialConfig.d.ts +0 -6
- package/dist/blocks/Config/normalizeConfigValue.d.ts +0 -2
- package/dist/blocks/Config/validatorsType.d.ts +0 -18
- package/dist/blocks/Copyright/Copyright.d.ts +0 -10
- package/dist/blocks/DropArea/DropArea.d.ts +0 -47
- package/dist/blocks/DropArea/addDropzone.d.ts +0 -17
- package/dist/blocks/DropArea/getDropItems.d.ts +0 -12
- package/dist/blocks/ExternalSource/ExternalSource.d.ts +0 -45
- package/dist/blocks/ExternalSource/MessageBridge.d.ts +0 -11
- package/dist/blocks/ExternalSource/buildThemeDefinition.d.ts +0 -4
- package/dist/blocks/ExternalSource/query-string.d.ts +0 -1
- package/dist/blocks/ExternalSource/types.d.ts +0 -105
- package/dist/blocks/FileItem/FileItem.d.ts +0 -50
- package/dist/blocks/FileItem/FileItemConfig.d.ts +0 -10
- package/dist/blocks/FormInput/FormInput.d.ts +0 -18
- package/dist/blocks/Icon/Icon.d.ts +0 -19
- package/dist/blocks/Img/Img.d.ts +0 -14
- package/dist/blocks/Img/ImgBase.d.ts +0 -29
- package/dist/blocks/Img/ImgConfig.d.ts +0 -28
- package/dist/blocks/Img/configurations.d.ts +0 -11
- package/dist/blocks/Img/props-map.d.ts +0 -28
- package/dist/blocks/Img/utils/parseObjectToString.d.ts +0 -2
- package/dist/blocks/Modal/Modal.d.ts +0 -34
- package/dist/blocks/PluginActivityRenderer/PluginActivityRenderer.d.ts +0 -32
- package/dist/blocks/PluginActivityRenderer/index.d.ts +0 -1
- package/dist/blocks/ProgressBar/ProgressBar.d.ts +0 -21
- package/dist/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +0 -17
- package/dist/blocks/Select/Select.d.ts +0 -18
- package/dist/blocks/SimpleBtn/SimpleBtn.d.ts +0 -15
- package/dist/blocks/SourceBtn/SourceBtn.d.ts +0 -23
- package/dist/blocks/SourceList/SourceList.d.ts +0 -24
- package/dist/blocks/Spinner/Spinner.d.ts +0 -9
- package/dist/blocks/StartFrom/StartFrom.d.ts +0 -12
- package/dist/blocks/Thumb/Thumb.d.ts +0 -35
- package/dist/blocks/UploadCtxProvider/EventEmitter.d.ts +0 -70
- package/dist/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +0 -44
- package/dist/blocks/UploadList/UploadList.d.ts +0 -39
- package/dist/blocks/UrlSource/UrlSource.d.ts +0 -14
- package/dist/blocks/svg-backgrounds/svg-backgrounds.d.ts +0 -3
- package/dist/blocks/themes/uc-basic/svg-sprite.d.ts +0 -2
- package/dist/cameraPlugin-weRKO7eG.js +0 -8
- package/dist/cloud-image-editor-hhbyNWLG.js +0 -11
- package/dist/cloud-image-editor.css +0 -1380
- package/dist/cloud-image-editor.layered.css +0 -1549
- package/dist/cloudImageEditorPlugin-FjUgbMK3.js +0 -8
- package/dist/core.d.ts +0 -42
- package/dist/en-8OWEmZim.js +0 -135
- package/dist/env-mM-ksNPq.js +0 -8
- package/dist/externalSourcesPlugin-CMBmLT8S.js +0 -8
- package/dist/imageShrinkPlugin-BN6loiP2.js +0 -8
- package/dist/index-base.css +0 -2497
- package/dist/index-base.layered.css +0 -2837
- package/dist/instagramPlugin-CXRm8MGL.js +0 -8
- package/dist/lit/BaseComponent.d.ts +0 -12
- package/dist/lit/Constructor.d.ts +0 -1
- package/dist/lit/CssDataMixin.d.ts +0 -7
- package/dist/lit/LightDomMixin.d.ts +0 -8
- package/dist/lit/LitActivityBlock.d.ts +0 -53
- package/dist/lit/LitBlock.d.ts +0 -83
- package/dist/lit/LitSolutionBlock.d.ts +0 -21
- package/dist/lit/LitUploaderBlock.d.ts +0 -53
- package/dist/lit/PubSubCompat.d.ts +0 -18
- package/dist/lit/RegisterableElementMixin.d.ts +0 -7
- package/dist/lit/SharedState.d.ts +0 -119
- package/dist/lit/SymbioteCompatMixin.d.ts +0 -40
- package/dist/lit/TestModeController.d.ts +0 -16
- package/dist/lit/Uid.d.ts +0 -3
- package/dist/lit/activity-constants.d.ts +0 -11
- package/dist/lit/createDebugPrinter.d.ts +0 -3
- package/dist/lit/findBlockInCtx.d.ts +0 -3
- package/dist/lit/getOutputData.d.ts +0 -2
- package/dist/lit/hasBlockInCtx.d.ts +0 -3
- package/dist/lit/l10n.d.ts +0 -5
- package/dist/lit/parseCssPropertyValue.d.ts +0 -1
- package/dist/lit/shared-instances.d.ts +0 -65
- package/dist/loadFileUploaderFrom-Bfz8L3VB.js +0 -28
- package/dist/plugins/cameraPlugin.d.ts +0 -2
- package/dist/plugins/cloudImageEditorPlugin.d.ts +0 -2
- package/dist/plugins/externalSourcesPlugin.d.ts +0 -2
- package/dist/plugins/imageShrinkPlugin.d.ts +0 -2
- package/dist/plugins/instagramPlugin.d.ts +0 -2
- package/dist/plugins/unsplashPlugin.d.ts +0 -16
- package/dist/plugins/urlSourcePlugin.d.ts +0 -2
- package/dist/plugins-CGUls7EV.js +0 -278
- package/dist/solutions/adaptive-image/index.d.ts +0 -2
- package/dist/solutions/cloud-image-editor/CloudImageEditor.d.ts +0 -11
- package/dist/solutions/cloud-image-editor/index.d.ts +0 -5
- package/dist/solutions/file-uploader/inline/FileUploaderInline.d.ts +0 -20
- package/dist/solutions/file-uploader/inline/index.d.ts +0 -1
- package/dist/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +0 -23
- package/dist/solutions/file-uploader/minimal/index.d.ts +0 -1
- package/dist/solutions/file-uploader/regular/FileUploaderRegular.d.ts +0 -17
- package/dist/solutions/file-uploader/regular/index.d.ts +0 -1
- package/dist/types/dom.d.ts +0 -1
- package/dist/types/events.d.ts +0 -4
- package/dist/types/exported.d.ts +0 -492
- package/dist/types/index.d.ts +0 -5
- package/dist/urlSourcePlugin-_WdbEhq2.js +0 -8
- package/dist/utils/UID.d.ts +0 -5
- package/dist/utils/UID.test.d.ts +0 -1
- package/dist/utils/UploadSource.d.ts +0 -37
- package/dist/utils/WindowHeightTracker.d.ts +0 -9
- package/dist/utils/abilities.d.ts +0 -1
- package/dist/utils/applyStyles.d.ts +0 -1
- package/dist/utils/browser-info.d.ts +0 -12
- package/dist/utils/browser-info.test.d.ts +0 -1
- package/dist/utils/cdn-utils.d.ts +0 -53
- package/dist/utils/cdn-utils.test.d.ts +0 -1
- package/dist/utils/comma-separated.d.ts +0 -2
- package/dist/utils/debounce.d.ts +0 -3
- package/dist/utils/delay.d.ts +0 -1
- package/dist/utils/fileTypes.d.ts +0 -11
- package/dist/utils/fileTypes.test.d.ts +0 -1
- package/dist/utils/get-top-level-origin.d.ts +0 -1
- package/dist/utils/get-top-level-origin.test.d.ts +0 -1
- package/dist/utils/getLocaleDirection.d.ts +0 -1
- package/dist/utils/getPluralForm.d.ts +0 -1
- package/dist/utils/getPluralForm.test.d.ts +0 -1
- package/dist/utils/isPromiseLike.d.ts +0 -1
- package/dist/utils/isPromiseLike.test.d.ts +0 -1
- package/dist/utils/isSecureTokenExpired.d.ts +0 -8
- package/dist/utils/isSecureTokenExpired.test.d.ts +0 -1
- package/dist/utils/memoize.d.ts +0 -1
- package/dist/utils/memoize.test.d.ts +0 -1
- package/dist/utils/mixinClass.d.ts +0 -8
- package/dist/utils/parseCdnUrl.d.ts +0 -11
- package/dist/utils/parseCdnUrl.test.d.ts +0 -1
- package/dist/utils/parseShrink.d.ts +0 -7
- package/dist/utils/parseShrink.test.d.ts +0 -1
- package/dist/utils/preloadImage.d.ts +0 -10
- package/dist/utils/prettyBytes.d.ts +0 -11
- package/dist/utils/prettyBytes.test.d.ts +0 -1
- package/dist/utils/resizeImage.d.ts +0 -1
- package/dist/utils/stringToArray.d.ts +0 -1
- package/dist/utils/stringToArray.test.d.ts +0 -1
- package/dist/utils/template-utils.d.ts +0 -16
- package/dist/utils/template-utils.test.d.ts +0 -1
- package/dist/utils/throttle.d.ts +0 -3
- package/dist/utils/toKebabCase.d.ts +0 -2
- package/dist/utils/toKebabCase.test.d.ts +0 -1
- package/dist/utils/transparentPixelSrc.d.ts +0 -1
- package/dist/utils/uniqueArray.d.ts +0 -1
- package/dist/utils/uniqueArray.test.d.ts +0 -1
- package/dist/utils/userAgent.d.ts +0 -2
- package/dist/utils/validators/collection/index.d.ts +0 -2
- package/dist/utils/validators/collection/validateCollectionUploadError.d.ts +0 -2
- package/dist/utils/validators/collection/validateMultiple.d.ts +0 -2
- package/dist/utils/validators/file/index.d.ts +0 -4
- package/dist/utils/validators/file/validateFileType.d.ts +0 -2
- package/dist/utils/validators/file/validateIsImage.d.ts +0 -2
- package/dist/utils/validators/file/validateMaxSizeLimit.d.ts +0 -2
- package/dist/utils/validators/file/validateUploadError.d.ts +0 -2
- package/dist/utils/warnOnce.d.ts +0 -1
- package/dist/utils/wildcardRegexp.d.ts +0 -1
- package/dist/utils/wildcardRegexp.test.d.ts +0 -1
- package/dist/utils/withResolvers.d.ts +0 -5
- package/dist/utils/withResolvers.test.d.ts +0 -1
- package/web/ActivityHeader-BFdTdVfD.js +0 -9
- package/web/ActivityHeader-DQy6rII1.js +0 -9
- package/web/ActivityHeader-DvzMl0uj.js +0 -9
- package/web/ActivityHeader-i4x6_Fne.js +0 -9
- package/web/CameraSource-BAWIA4Wm.js +0 -508
- package/web/CameraSource-BqZCQcij.js +0 -11
- package/web/CameraSource-Brxr4tz4.js +0 -508
- package/web/CameraSource-BvBJ5Uzy.js +0 -508
- package/web/CameraSource-CkHzIE-h.js +0 -11
- package/web/CameraSource-D964yPLu.js +0 -508
- package/web/CameraSource-DE48Az-f.js +0 -11
- package/web/CameraSource-DyPebtRF.js +0 -478
- package/web/CameraSource-pj7Xo81m.js +0 -11
- package/web/CloudImageEditor-CTgUWB07.js +0 -2192
- package/web/CloudImageEditor-CxqV9Lwm.js +0 -2192
- package/web/CloudImageEditor-DoLWHpqV.js +0 -2192
- package/web/CloudImageEditor-Drywn265.js +0 -2192
- package/web/CloudImageEditor-MXcaDtMx.js +0 -2187
- package/web/CloudImageEditorActivity-BPzmfaJV.js +0 -85
- package/web/CloudImageEditorActivity-Br8pU5gd.js +0 -11
- package/web/CloudImageEditorActivity-Cw8b2CEz.js +0 -11
- package/web/CloudImageEditorActivity-Df1ySGq0.js +0 -86
- package/web/CloudImageEditorActivity-DinG5r0y.js +0 -11
- package/web/CloudImageEditorActivity-DmnLLINR.js +0 -85
- package/web/CloudImageEditorActivity-U90BGCek.js +0 -85
- package/web/CloudImageEditorActivity-dNLQZRZI.js +0 -11
- package/web/CloudImageEditorActivity-ur-hQ-6p.js +0 -85
- package/web/Config-8hlBNhvs.js +0 -455
- package/web/Config-BDZhPIyz.js +0 -455
- package/web/Config-CJVNrrjj.js +0 -455
- package/web/Config-DvkVtlQ7.js +0 -455
- package/web/ExternalSource-B9ycBFiD.js +0 -10
- package/web/ExternalSource-BE7HX47E.js +0 -250
- package/web/ExternalSource-BL5GSlol.js +0 -250
- package/web/ExternalSource-BXQY6Dlc.js +0 -10
- package/web/ExternalSource-BXxH3JCD.js +0 -250
- package/web/ExternalSource-BYSS-PPV.js +0 -245
- package/web/ExternalSource-C57a61QN.js +0 -10
- package/web/ExternalSource-CKfMtOgU.js +0 -250
- package/web/ExternalSource-DP6q8ylB.js +0 -10
- package/web/LitUploaderBlock-AX6jOdAS.js +0 -996
- package/web/LitUploaderBlock-BjAaoLl2.js +0 -996
- package/web/LitUploaderBlock-D8E5HuwH.js +0 -996
- package/web/LitUploaderBlock-Dl3ce0Tc.js +0 -996
- package/web/LitUploaderBlock-Oi33U0uf.js +0 -996
- package/web/UrlSource-B9SX3K0L.js +0 -10
- package/web/UrlSource-C3zB1rCb.js +0 -70
- package/web/UrlSource-C7bEU6Xv.js +0 -10
- package/web/UrlSource-CE389CBz.js +0 -70
- package/web/UrlSource-CnvAJ58Y.js +0 -10
- package/web/UrlSource-CqF0h6B-.js +0 -10
- package/web/UrlSource-D-971Nut.js +0 -70
- package/web/UrlSource-DhI3YCt5.js +0 -70
- package/web/UrlSource-hWV7jtB2.js +0 -70
- package/web/abstract/CTX.d.ts +0 -40
- package/web/abstract/TypedCollection.d.ts +0 -47
- package/web/abstract/TypedCollection.test.d.ts +0 -1
- package/web/abstract/TypedData.d.ts +0 -12
- package/web/abstract/TypedData.test.d.ts +0 -1
- package/web/abstract/UploaderPublicApi.d.ts +0 -41
- package/web/abstract/buildOutputCollectionState.d.ts +0 -3
- package/web/abstract/customConfigOptions.d.ts +0 -65
- package/web/abstract/defineComponents.d.ts +0 -1
- package/web/abstract/features/ClipboardLayer.d.ts +0 -12
- package/web/abstract/loadFileUploaderFrom.d.ts +0 -13
- package/web/abstract/localeRegistry.d.ts +0 -5
- package/web/abstract/managers/LocaleManager.d.ts +0 -10
- package/web/abstract/managers/ModalManager.d.ts +0 -53
- package/web/abstract/managers/SecureUploadsManager.d.ts +0 -7
- package/web/abstract/managers/TelemetryManager.d.ts +0 -41
- package/web/abstract/managers/ValidationManager.d.ts +0 -34
- package/web/abstract/managers/__tests__/ModalManager.test.d.ts +0 -13
- package/web/abstract/managers/__tests__/SecureUploadsManager.test.d.ts +0 -1
- package/web/abstract/managers/a11y.d.ts +0 -9
- package/web/abstract/managers/plugin/PluginManager.d.ts +0 -25
- package/web/abstract/managers/plugin/PluginTypes.d.ts +0 -146
- package/web/abstract/managers/plugin/index.d.ts +0 -2
- package/web/abstract/sharedConfigKey.d.ts +0 -2
- package/web/abstract/uploadEntrySchema.d.ts +0 -34
- package/web/blocks/ActivityHeader/ActivityHeader.d.ts +0 -8
- package/web/blocks/CameraSource/CameraSource.d.ts +0 -121
- package/web/blocks/CameraSource/__tests__/calcCameraModes.test.d.ts +0 -1
- package/web/blocks/CameraSource/calcCameraModes.d.ts +0 -5
- package/web/blocks/CameraSource/constants.d.ts +0 -15
- package/web/blocks/CloudImageEditor/index.d.ts +0 -1
- package/web/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +0 -60
- package/web/blocks/CloudImageEditor/src/CropFrame.d.ts +0 -56
- package/web/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +0 -24
- package/web/blocks/CloudImageEditor/src/EditorButtonControl.d.ts +0 -14
- package/web/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts +0 -13
- package/web/blocks/CloudImageEditor/src/EditorFilterControl.d.ts +0 -35
- package/web/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +0 -56
- package/web/blocks/CloudImageEditor/src/EditorImageFader.d.ts +0 -63
- package/web/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +0 -15
- package/web/blocks/CloudImageEditor/src/EditorScroller.d.ts +0 -15
- package/web/blocks/CloudImageEditor/src/EditorSlider.d.ts +0 -33
- package/web/blocks/CloudImageEditor/src/EditorToolbar.d.ts +0 -68
- package/web/blocks/CloudImageEditor/src/crop-utils.d.ts +0 -36
- package/web/blocks/CloudImageEditor/src/crop-utils.test.d.ts +0 -1
- package/web/blocks/CloudImageEditor/src/cropper-constants.d.ts +0 -10
- package/web/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts +0 -31
- package/web/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts +0 -19
- package/web/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts +0 -27
- package/web/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts +0 -38
- package/web/blocks/CloudImageEditor/src/index.d.ts +0 -15
- package/web/blocks/CloudImageEditor/src/lib/classNames.d.ts +0 -5
- package/web/blocks/CloudImageEditor/src/lib/classNames.test.d.ts +0 -1
- package/web/blocks/CloudImageEditor/src/lib/linspace.d.ts +0 -1
- package/web/blocks/CloudImageEditor/src/lib/linspace.test.d.ts +0 -1
- package/web/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +0 -4
- package/web/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +0 -1
- package/web/blocks/CloudImageEditor/src/lib/parseTabs.d.ts +0 -2
- package/web/blocks/CloudImageEditor/src/lib/pick.d.ts +0 -1
- package/web/blocks/CloudImageEditor/src/lib/pick.test.d.ts +0 -1
- package/web/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +0 -7
- package/web/blocks/CloudImageEditor/src/state.d.ts +0 -20
- package/web/blocks/CloudImageEditor/src/svg-sprite.d.ts +0 -2
- package/web/blocks/CloudImageEditor/src/toolbar-constants.d.ts +0 -61
- package/web/blocks/CloudImageEditor/src/types.d.ts +0 -60
- package/web/blocks/CloudImageEditor/src/util.d.ts +0 -2
- package/web/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +0 -7
- package/web/blocks/CloudImageEditor/src/utils/parseFilterValue.test.d.ts +0 -1
- package/web/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +0 -25
- package/web/blocks/Config/Config.d.ts +0 -60
- package/web/blocks/Config/assertions.d.ts +0 -5
- package/web/blocks/Config/computed-properties.d.ts +0 -24
- package/web/blocks/Config/computed-properties.test.d.ts +0 -1
- package/web/blocks/Config/initialConfig.d.ts +0 -6
- package/web/blocks/Config/normalizeConfigValue.d.ts +0 -2
- package/web/blocks/Config/validatorsType.d.ts +0 -18
- package/web/blocks/Copyright/Copyright.d.ts +0 -10
- package/web/blocks/DropArea/DropArea.d.ts +0 -47
- package/web/blocks/DropArea/addDropzone.d.ts +0 -17
- package/web/blocks/DropArea/getDropItems.d.ts +0 -12
- package/web/blocks/ExternalSource/ExternalSource.d.ts +0 -45
- package/web/blocks/ExternalSource/MessageBridge.d.ts +0 -11
- package/web/blocks/ExternalSource/buildThemeDefinition.d.ts +0 -4
- package/web/blocks/ExternalSource/query-string.d.ts +0 -1
- package/web/blocks/ExternalSource/types.d.ts +0 -105
- package/web/blocks/FileItem/FileItem.d.ts +0 -50
- package/web/blocks/FileItem/FileItemConfig.d.ts +0 -10
- package/web/blocks/FormInput/FormInput.d.ts +0 -18
- package/web/blocks/Icon/Icon.d.ts +0 -19
- package/web/blocks/Img/Img.d.ts +0 -14
- package/web/blocks/Img/ImgBase.d.ts +0 -29
- package/web/blocks/Img/ImgConfig.d.ts +0 -28
- package/web/blocks/Img/configurations.d.ts +0 -11
- package/web/blocks/Img/props-map.d.ts +0 -28
- package/web/blocks/Img/utils/parseObjectToString.d.ts +0 -2
- package/web/blocks/Modal/Modal.d.ts +0 -34
- package/web/blocks/PluginActivityRenderer/PluginActivityRenderer.d.ts +0 -32
- package/web/blocks/PluginActivityRenderer/index.d.ts +0 -1
- package/web/blocks/ProgressBar/ProgressBar.d.ts +0 -21
- package/web/blocks/ProgressBarCommon/ProgressBarCommon.d.ts +0 -17
- package/web/blocks/Select/Select.d.ts +0 -18
- package/web/blocks/SimpleBtn/SimpleBtn.d.ts +0 -15
- package/web/blocks/SourceBtn/SourceBtn.d.ts +0 -23
- package/web/blocks/SourceList/SourceList.d.ts +0 -24
- package/web/blocks/Spinner/Spinner.d.ts +0 -9
- package/web/blocks/StartFrom/StartFrom.d.ts +0 -12
- package/web/blocks/Thumb/Thumb.d.ts +0 -35
- package/web/blocks/UploadCtxProvider/EventEmitter.d.ts +0 -70
- package/web/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +0 -44
- package/web/blocks/UploadList/UploadList.d.ts +0 -39
- package/web/blocks/UrlSource/UrlSource.d.ts +0 -14
- package/web/blocks/svg-backgrounds/svg-backgrounds.d.ts +0 -3
- package/web/blocks/themes/uc-basic/svg-sprite.d.ts +0 -2
- package/web/cameraPlugin-DeedXMWV.js +0 -8
- package/web/cameraPlugin-Duy1QwjB.js +0 -8
- package/web/cameraPlugin-QS9SUOtO.js +0 -8
- package/web/cameraPlugin-bq8ggY04.js +0 -8
- package/web/cameraPlugin-cel9YgP_.js +0 -8
- package/web/cloud-image-editor-8DrVRZ7E.js +0 -12
- package/web/cloud-image-editor-BX50EK1U.js +0 -12
- package/web/cloud-image-editor-DSW3oWq-.js +0 -12
- package/web/cloud-image-editor-DuI2Lx4M.js +0 -12
- package/web/cloudImageEditorPlugin-5my6aD36.js +0 -8
- package/web/cloudImageEditorPlugin-Bk19DmJv.js +0 -8
- package/web/cloudImageEditorPlugin-CcdnmtBW.js +0 -8
- package/web/cloudImageEditorPlugin-DQJmDl03.js +0 -8
- package/web/cloudImageEditorPlugin-kojghfqw.js +0 -8
- package/web/constants-BCfCF0cJ.js +0 -4025
- package/web/core.d.ts +0 -42
- package/web/env.d.ts +0 -2
- package/web/externalSourcesPlugin-BTeRm5C0.js +0 -8
- package/web/externalSourcesPlugin-BXgVeojg.js +0 -8
- package/web/externalSourcesPlugin-BgLpuIK9.js +0 -8
- package/web/externalSourcesPlugin-DMc9zs4T.js +0 -8
- package/web/externalSourcesPlugin-Dm9vnTBv.js +0 -8
- package/web/imageShrinkPlugin-BdHgEGZH.js +0 -8
- package/web/imageShrinkPlugin-BjkMGfvT.js +0 -8
- package/web/imageShrinkPlugin-CCkGHL2w.js +0 -8
- package/web/imageShrinkPlugin-D4WjaRGo.js +0 -8
- package/web/imageShrinkPlugin-DqYGutVx.js +0 -8
- package/web/index.d.ts +0 -42
- package/web/instagramPlugin-BTMz0K2a.js +0 -8
- package/web/instagramPlugin-BbIKgTH7.js +0 -8
- package/web/instagramPlugin-CQQhsEJa.js +0 -8
- package/web/instagramPlugin-Cm7lWKae.js +0 -8
- package/web/instagramPlugin-DcclxM_d.js +0 -8
- package/web/lit/BaseComponent.d.ts +0 -12
- package/web/lit/Constructor.d.ts +0 -1
- package/web/lit/CssDataMixin.d.ts +0 -7
- package/web/lit/LightDomMixin.d.ts +0 -8
- package/web/lit/LitActivityBlock.d.ts +0 -53
- package/web/lit/LitBlock.d.ts +0 -83
- package/web/lit/LitSolutionBlock.d.ts +0 -21
- package/web/lit/LitUploaderBlock.d.ts +0 -53
- package/web/lit/PubSubCompat.d.ts +0 -18
- package/web/lit/RegisterableElementMixin.d.ts +0 -7
- package/web/lit/SharedState.d.ts +0 -119
- package/web/lit/SymbioteCompatMixin.d.ts +0 -40
- package/web/lit/TestModeController.d.ts +0 -16
- package/web/lit/Uid.d.ts +0 -3
- package/web/lit/activity-constants.d.ts +0 -11
- package/web/lit/createDebugPrinter.d.ts +0 -3
- package/web/lit/findBlockInCtx.d.ts +0 -3
- package/web/lit/getOutputData.d.ts +0 -2
- package/web/lit/hasBlockInCtx.d.ts +0 -3
- package/web/lit/l10n.d.ts +0 -5
- package/web/lit/parseCssPropertyValue.d.ts +0 -1
- package/web/lit/shared-instances.d.ts +0 -65
- package/web/locales/file-uploader/ar.d.ts +0 -137
- package/web/locales/file-uploader/az.d.ts +0 -129
- package/web/locales/file-uploader/ca.d.ts +0 -131
- package/web/locales/file-uploader/cs.d.ts +0 -133
- package/web/locales/file-uploader/da.d.ts +0 -129
- package/web/locales/file-uploader/de.d.ts +0 -129
- package/web/locales/file-uploader/el.d.ts +0 -129
- package/web/locales/file-uploader/en.d.ts +0 -129
- package/web/locales/file-uploader/es.d.ts +0 -131
- package/web/locales/file-uploader/et.d.ts +0 -129
- package/web/locales/file-uploader/fi.d.ts +0 -129
- package/web/locales/file-uploader/fr.d.ts +0 -131
- package/web/locales/file-uploader/he.d.ts +0 -131
- package/web/locales/file-uploader/hy.d.ts +0 -129
- package/web/locales/file-uploader/is.d.ts +0 -129
- package/web/locales/file-uploader/it.d.ts +0 -131
- package/web/locales/file-uploader/ja.d.ts +0 -129
- package/web/locales/file-uploader/ka.d.ts +0 -129
- package/web/locales/file-uploader/kk.d.ts +0 -129
- package/web/locales/file-uploader/ko.d.ts +0 -129
- package/web/locales/file-uploader/lv.d.ts +0 -131
- package/web/locales/file-uploader/nb.d.ts +0 -129
- package/web/locales/file-uploader/nl.d.ts +0 -129
- package/web/locales/file-uploader/pl.d.ts +0 -133
- package/web/locales/file-uploader/pt.d.ts +0 -131
- package/web/locales/file-uploader/ro.d.ts +0 -131
- package/web/locales/file-uploader/ru.d.ts +0 -133
- package/web/locales/file-uploader/sk.d.ts +0 -133
- package/web/locales/file-uploader/sr.d.ts +0 -131
- package/web/locales/file-uploader/sv.d.ts +0 -129
- package/web/locales/file-uploader/tr.d.ts +0 -129
- package/web/locales/file-uploader/uk.d.ts +0 -133
- package/web/locales/file-uploader/vi.d.ts +0 -129
- package/web/locales/file-uploader/zh-TW.d.ts +0 -129
- package/web/locales/file-uploader/zh.d.ts +0 -129
- package/web/plugins/cameraPlugin.d.ts +0 -2
- package/web/plugins/cloudImageEditorPlugin.d.ts +0 -2
- package/web/plugins/externalSourcesPlugin.d.ts +0 -2
- package/web/plugins/imageShrinkPlugin.d.ts +0 -2
- package/web/plugins/instagramPlugin.d.ts +0 -2
- package/web/plugins/unsplashPlugin.d.ts +0 -16
- package/web/plugins/urlSourcePlugin.d.ts +0 -2
- package/web/plugins-Bt7FXHKx.js +0 -562
- package/web/plugins-CaaolyMk.js +0 -562
- package/web/plugins-Cjgw5oWg.js +0 -562
- package/web/plugins-CzNtrVQB.js +0 -562
- package/web/plugins-DS0hIs2V.js +0 -563
- package/web/ref-BOnG19ns.js +0 -4040
- package/web/ref-BejJFG7m.js +0 -4040
- package/web/ref-DcRg7zo9.js +0 -4040
- package/web/ref-ZWPcLQB9.js +0 -4040
- package/web/solutions/adaptive-image/index.d.ts +0 -2
- package/web/solutions/cloud-image-editor/CloudImageEditor.d.ts +0 -11
- package/web/solutions/cloud-image-editor/index.d.ts +0 -5
- package/web/solutions/file-uploader/inline/FileUploaderInline.d.ts +0 -20
- package/web/solutions/file-uploader/inline/index.d.ts +0 -1
- package/web/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +0 -23
- package/web/solutions/file-uploader/minimal/index.d.ts +0 -1
- package/web/solutions/file-uploader/regular/FileUploaderRegular.d.ts +0 -17
- package/web/solutions/file-uploader/regular/index.d.ts +0 -1
- package/web/style-map-BmZdux7T.js +0 -37
- package/web/style-map-CZ6fSV6e.js +0 -37
- package/web/style-map-Dk7mLCrB.js +0 -37
- package/web/style-map-HkHnu9oA.js +0 -37
- package/web/style-map-tw1yUEaj.js +0 -37
- package/web/types/dom.d.ts +0 -1
- package/web/types/events.d.ts +0 -4
- package/web/types/exported.d.ts +0 -492
- package/web/types/index.d.ts +0 -5
- package/web/urlSourcePlugin-9lhcr02f.js +0 -8
- package/web/urlSourcePlugin-C-sLGhGb.js +0 -8
- package/web/urlSourcePlugin-DNXDpnRD.js +0 -8
- package/web/urlSourcePlugin-JnD0cnxb.js +0 -8
- package/web/urlSourcePlugin-hcMU2K6T.js +0 -8
- package/web/utils/UID.d.ts +0 -5
- package/web/utils/UID.test.d.ts +0 -1
- package/web/utils/UploadSource.d.ts +0 -37
- package/web/utils/WindowHeightTracker.d.ts +0 -9
- package/web/utils/abilities.d.ts +0 -1
- package/web/utils/applyStyles.d.ts +0 -1
- package/web/utils/browser-info.d.ts +0 -12
- package/web/utils/browser-info.test.d.ts +0 -1
- package/web/utils/cdn-utils.d.ts +0 -53
- package/web/utils/cdn-utils.test.d.ts +0 -1
- package/web/utils/comma-separated.d.ts +0 -2
- package/web/utils/debounce.d.ts +0 -3
- package/web/utils/delay.d.ts +0 -1
- package/web/utils/fileTypes.d.ts +0 -11
- package/web/utils/fileTypes.test.d.ts +0 -1
- package/web/utils/get-top-level-origin.d.ts +0 -1
- package/web/utils/get-top-level-origin.test.d.ts +0 -1
- package/web/utils/getLocaleDirection.d.ts +0 -1
- package/web/utils/getPluralForm.d.ts +0 -1
- package/web/utils/getPluralForm.test.d.ts +0 -1
- package/web/utils/isPromiseLike.d.ts +0 -1
- package/web/utils/isPromiseLike.test.d.ts +0 -1
- package/web/utils/isSecureTokenExpired.d.ts +0 -8
- package/web/utils/isSecureTokenExpired.test.d.ts +0 -1
- package/web/utils/memoize.d.ts +0 -1
- package/web/utils/memoize.test.d.ts +0 -1
- package/web/utils/mixinClass.d.ts +0 -8
- package/web/utils/parseCdnUrl.d.ts +0 -11
- package/web/utils/parseCdnUrl.test.d.ts +0 -1
- package/web/utils/parseShrink.d.ts +0 -7
- package/web/utils/parseShrink.test.d.ts +0 -1
- package/web/utils/preloadImage.d.ts +0 -10
- package/web/utils/prettyBytes.d.ts +0 -11
- package/web/utils/prettyBytes.test.d.ts +0 -1
- package/web/utils/resizeImage.d.ts +0 -1
- package/web/utils/stringToArray.d.ts +0 -1
- package/web/utils/stringToArray.test.d.ts +0 -1
- package/web/utils/template-utils.d.ts +0 -16
- package/web/utils/template-utils.test.d.ts +0 -1
- package/web/utils/throttle.d.ts +0 -3
- package/web/utils/toKebabCase.d.ts +0 -2
- package/web/utils/toKebabCase.test.d.ts +0 -1
- package/web/utils/transparentPixelSrc.d.ts +0 -1
- package/web/utils/uniqueArray.d.ts +0 -1
- package/web/utils/uniqueArray.test.d.ts +0 -1
- package/web/utils/userAgent.d.ts +0 -2
- package/web/utils/validators/collection/index.d.ts +0 -2
- package/web/utils/validators/collection/validateCollectionUploadError.d.ts +0 -2
- package/web/utils/validators/collection/validateMultiple.d.ts +0 -2
- package/web/utils/validators/file/index.d.ts +0 -4
- package/web/utils/validators/file/validateFileType.d.ts +0 -2
- package/web/utils/validators/file/validateIsImage.d.ts +0 -2
- package/web/utils/validators/file/validateMaxSizeLimit.d.ts +0 -2
- package/web/utils/validators/file/validateUploadError.d.ts +0 -2
- package/web/utils/warnOnce.d.ts +0 -1
- package/web/utils/wildcardRegexp.d.ts +0 -1
- package/web/utils/wildcardRegexp.test.d.ts +0 -1
- package/web/utils/withResolvers.d.ts +0 -5
- package/web/utils/withResolvers.test.d.ts +0 -1
|
@@ -1,697 +1,8 @@
|
|
|
1
|
-
var UC=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n&&t(r,Symbol.toStringTag,{value:`Module`}),r},i,a=n((()=>{i=Symbol(`clean`)})),o,s,c,l,u,d=n((()=>{a(),o=[],s=0,c=4,l=0,u=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=s+c;t<o.length;)o[t]===e?o.splice(t,c):t+=c;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){l++;let i=!o.length;for(let i of t)o.push(i,n.value,e,r);if(i){for(s=0;s<o.length;s+=c)o[s](o[s+1],o[s+2],o[s+3]);o.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return process.env.NODE_ENV!==`production`&&(n[i]=()=>{t=[],n.lc=0,n.off()}),n}}));function f(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}function p(e,t,n){let r=f(e,t,n);return n(e.value),r}var m=n((()=>{})),h,ee=n((()=>{d(),h=(e={})=>{let t=u(e);return t.setKey=function(e,n){let r=t.value;n===void 0&&e in t.value?(t.value={...t.value},delete t.value[e],t.notify(r,e)):t.value[e]!==n&&(t.value={...t.value,[e]:n},t.notify(r,e))},t}})),te=n((()=>{m(),ee()})),g,ne=n((()=>{te(),g=class e{static{this._contexts=new Map}constructor(e,t){this._ctxId=e,this._store=t}get id(){return this._ctxId}pub(e,t){e in this._store.get()||console.warn(`PubSub#pub: Key "${String(e)}" not found`),this._store.setKey(e,t)}sub(e,t,n=!0){return(n?p:f)(this._store,[e],n=>{t(n[e])})}read(e){return e in this._store.get()||console.warn(`PubSub#read: Key "${String(e)}" not found`),this._store.get()[e]}add(e,t,n=!1){(!(e in this._store.get())||n)&&this._store.setKey(e,t)}has(e){return e in this._store.get()}get store(){return this._store.get()}static registerCtx(t,n){if(e._contexts.has(n))throw Error(`PubSub: Context with id "${n}" already exists`);let r=h(t);return e._contexts.set(n,r),new e(n,r)}static deleteCtx(t){e._contexts.delete(t)}static getCtx(t){let n=e._contexts.get(t);return n?new e(t,n):null}static hasCtx(t){return e._contexts.has(t)}}})),re,ie,ae,oe,se,ce,le,ue,de=n((()=>{re=globalThis,ie=re.ShadowRoot&&(re.ShadyCSS===void 0||re.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,ae=Symbol(),oe=new WeakMap,se=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ae)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ie&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=oe.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&oe.set(t,e))}return e}toString(){return this.cssText}},ce=e=>new se(typeof e==`string`?e:e+``,void 0,ae),le=(e,t)=>{if(ie)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=re.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},ue=ie?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ce(t)})(e):e})),fe,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De=n((()=>{de(),{is:fe,defineProperty:pe,getOwnPropertyDescriptor:me,getOwnPropertyNames:he,getOwnPropertySymbols:ge,getPrototypeOf:_e}=Object,ve=globalThis,ye=ve.trustedTypes,be=ye?ye.emptyScript:``,xe=ve.reactiveElementPolyfillSupport,Se=(e,t)=>e,Ce={toAttribute(e,t){switch(t){case Boolean:e=e?be:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},we=(e,t)=>!fe(e,t),Te={attribute:!0,type:String,converter:Ce,reflect:!1,useDefault:!1,hasChanged:we},Symbol.metadata??=Symbol(`metadata`),ve.litPropertyMetadata??=new WeakMap,Ee=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Te){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&pe(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=me(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Te}static _$Ei(){if(this.hasOwnProperty(Se(`elementProperties`)))return;let e=_e(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Se(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Se(`properties`))){let e=this.properties,t=[...he(e),...ge(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(ue(e))}else e!==void 0&&t.push(ue(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return le(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?Ce:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?Ce:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??we)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}},Ee.elementStyles=[],Ee.shadowRootOptions={mode:`open`},Ee[Se(`elementProperties`)]=new Map,Ee[Se(`finalized`)]=new Map,xe?.({ReactiveElement:Ee}),(ve.reactiveElementVersions??=[]).push(`2.1.2`)}));function Oe(e,t){if(!Ve(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return Ne===void 0?t:Ne.createHTML(t)}function ke(e,t,n=e,r){if(t===Qe)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=Be(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=ke(e,i._$AS(e,t.values),i,r)),t}var Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,_,Qe,v,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt=n((()=>{Ae=globalThis,je=e=>e,Me=Ae.trustedTypes,Ne=Me?Me.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,Pe=`$lit$`,Fe=`lit$${Math.random().toFixed(9).slice(2)}$`,Ie=`?`+Fe,Le=`<${Ie}>`,Re=document,ze=()=>Re.createComment(``),Be=e=>e===null||typeof e!=`object`&&typeof e!=`function`,Ve=Array.isArray,He=e=>Ve(e)||typeof e?.[Symbol.iterator]==`function`,Ue=`[
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`));return}window.customElements.define(e,t)}}return t}var Mt=n((()=>{})),Nt,Pt=n((()=>{Nt=class extends Event{constructor(e,t,n,r){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=r??!1}}}));function Ft(e){return e}var It=n((()=>{})),Lt,Rt=n((()=>{Pt(),Lt=class{constructor(e,t,n,r){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(e,t)=>{this.unsubscribe&&(this.unsubscribe!==t&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=e,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(e,t)),this.unsubscribe=t},this.host=e,t.context!==void 0){let e=t;this.context=e.context,this.callback=e.callback,this.subscribe=e.subscribe??!1}else this.context=t,this.callback=n,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&=(this.unsubscribe(),void 0)}dispatchRequest(){this.host.dispatchEvent(new Nt(this.context,this.host,this.t,this.subscribe))}}})),zt,Bt=n((()=>{zt=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:r}=this.subscriptions.get(e);e(this.value,r)}clearCallbacks(){this.subscriptions.clear()}}})),Vt,Ht,Ut=n((()=>{Pt(),Bt(),Vt=class extends Event{constructor(e,t){super(`context-provider`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},Ht=class extends zt{constructor(e,t,n){super(t.context===void 0?n:t.initialValue),this.onContextRequest=e=>{if(e.context!==this.context)return;let t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context||(e.contextTarget??e.composedPath()[0])===this.host)return;let t=new Set;for(let[e,{consumerHost:n}]of this.subscriptions)t.has(e)||(t.add(e),n.dispatchEvent(new Nt(this.context,n,e,!0)));e.stopPropagation()},this.host=e,t.context===void 0?this.context=t:this.context=t.context,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 Vt(this.context,this.host))}}})),Wt=n((()=>{It(),Rt(),Ut()})),Gt=n((()=>{}));function b(e){return(t,n)=>typeof n==`object`?qt(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}var Kt,qt,Jt=n((()=>{De(),Kt={attribute:!0,type:String,converter:Ce,reflect:!1,hasChanged:we},qt=(e=Kt,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)}}));function x(e){return b({...e,state:!0,attribute:!1})}var Yt=n((()=>{Jt()})),Xt=n((()=>{})),Zt=n((()=>{})),Qt=n((()=>{})),$t=n((()=>{})),en=n((()=>{})),tn=n((()=>{})),S=n((()=>{Gt(),Jt(),Yt(),Xt(),Zt(),Qt(),$t(),en(),tn()}));function C(e,t){let n,r=((...r)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...r),t)});return r.cancel=()=>{n&&clearTimeout(n)},r}var nn=n((()=>{}));function w(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var T=n((()=>{}));function rn(){return function(e){class t extends e{static set template(e){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(e){let t=e??void 0;this._ctxNameAttrValue!==t&&(this._ctxNameAttrValue=t,this._handleCtxNameSourceChange())}shouldUpdate(e){return this._isInitialized?super.shouldUpdate(e):!1}constructor(...e){super(...e),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 Lt(this,{context:an,callback:e=>{if(!e){console.error(`SymbioteMixin: Received invalid ctx-name from context`);return}this._ctxNameFromContext=e,this._handleCtxNameSourceChange()},subscribe:!0})}get _effectiveCtxName(){return this._ctxNameAttr||this._ctxNameFromContext||void 0}_handleCtxNameSourceChange(){if(this.ctxName=this._effectiveCtxName,!(!this.ctxName||this._symbioteFirstUpdated)){if(this.isConnected){this._performInitialization();return}this._pendingCtxInitOnConnect=!0}}willUpdate(e){super.willUpdate(e),this.ctxName=this._effectiveCtxName,this.ctxName&&(this._ctxNameProvider?this._ctxNameProvider.setValue(this.ctxName):this._ctxNameProvider=new Ht(this,{context:an,initialValue:this.ctxName}))}_applyPendingSharedAdds(){if(!(!this._symbioteSharedPubSub||this._pendingSharedAdds.size===0)){for(let[e,{value:t,rewrite:n}]of this._pendingSharedAdds)this._symbioteSharedPubSub.add(e,t,n);this._pendingSharedAdds.clear()}}_getSharedPubSub(){return!this._symbioteSharedPubSub&&this._effectiveCtxName&&this._initSharedContext(),this._symbioteSharedPubSub&&this._applyPendingSharedAdds(),this._symbioteSharedPubSub}_requireSharedPubSub(){let e=this._getSharedPubSub();if(!e)throw Error(`SymbioteMixin: Shared context is not initialized.`);return e}_initSharedContext(){let e=this.init$,t=this._effectiveCtxName;if(!t){console.error(`SymbioteMixin: ctx-name is required for components with shared properties (*)`);return}if(!this._symbioteSharedPubSub){this._symbioteSharedPubSub=g.getCtx(t)??g.registerCtx(e,t);for(let[e,t]of Object.entries(this.init$))this._symbioteSharedPubSub.add(e,t,this.ctxOwner);this._applyPendingSharedAdds()}}get $(){return this._effectiveCtxName&&this._initSharedContext(),new Proxy({},{get:(e,t)=>{if(typeof t==`string`)return this._symbioteSharedPubSub?.read(t)},set:(e,t,n)=>(typeof t==`string`&&this._symbioteSharedPubSub?.pub(t,n),!0)})}sub(e,t,n=!0){let r=this._requireSharedPubSub().sub(e,t,n);if(!r||typeof r!=`function`)return()=>{};let i=r.bind(r),a=!1,o=()=>{a||(a=!0,i(),this._symbioteSubscriptions.delete(o))};return this._symbioteSubscriptions.add(o),o}pub(e,t){this._requireSharedPubSub().pub(e,t)}set$(e){for(let[t,n]of Object.entries(e))this.pub(t,n)}get sharedCtx(){return this._requireSharedPubSub()}has(e){return this._symbioteSharedPubSub?.has(e)??!1}add(e,t,n=!1){let r=this._getSharedPubSub();if(!r){if(!n&&this._pendingSharedAdds.has(e))return;this._pendingSharedAdds.set(e,{value:t,rewrite:n});return}this._pendingSharedAdds.delete(e),r.add(e,t,n)}add$(e,t=!1){for(let[n,r]of Object.entries(e))this.add(n,r,t)}connectedCallback(){super.connectedCallback(),this._symbioteFirstUpdated?this._isInitialized&&this._needsReconnectInit&&(this._needsReconnectInit=!1,this.initCallback()):(this.ctxName||this._pendingCtxInitOnConnect&&this._effectiveCtxName)&&(this._pendingCtxInitOnConnect=!1,this._performInitialization())}_performInitialization(){if(this._symbioteFirstUpdated)return;this._symbioteFirstUpdated=!0,this._initSharedContext();let e=this.init$;if(Object.keys(e).length>0){let t=this._requireSharedPubSub();for(let[n,r]of Object.entries(e))t.read(n)===void 0&&t.pub(n,r),this.sub(n,C(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate())},0),!1)}this.initCallback(),this._isInitialized=!0,this.requestUpdate()}firstUpdated(e){super.firstUpdated(e)}disconnectedCallback(){this._cleanupSymbioteSubscriptions(),super.disconnectedCallback(),this._symbioteFirstUpdated&&(this._needsReconnectInit=!0)}_cleanupSymbioteSubscriptions(){if(this._symbioteSubscriptions.size!==0){for(let e of[...this._symbioteSubscriptions])e();this._symbioteSubscriptions.clear()}}initCallback(){}}return w([b({type:String,attribute:`ctx-name`,noAccessor:!0})],t.prototype,`_ctxNameAttr`,null),w([x()],t.prototype,`_ctxNameFromContext`,void 0),w([x()],t.prototype,`ctxName`,void 0),w([x()],t.prototype,`_isInitialized`,void 0),t}}var an,on=n((()=>{Wt(),S(),nn(),ne(),T(),an=Ft(`ctx-name-context`)}));y(),Ot(),At(),Mt(),on();var sn=class extends jt(rn()(Dt(kt(ht)))){},cn,ln=n((()=>{cn=class e{static generateFastUid(){return`uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let t=globalThis.crypto;return t&&typeof t.randomUUID==`function`?t.randomUUID():e.generateFastUid()}}}));function un(e){for(let t in e){if(dn.includes(t))continue;let n=[...t].reduce((e,t)=>(t.toUpperCase()===t&&(t=`-${t.toLowerCase()}`),e+=t,e),``);n.startsWith(`-`)&&(n=n.replace(`-`,``)),n.startsWith(`uc-`)||(n=`uc-${n}`),e[t].reg&&e[t].reg(n)}}var dn,fn=n((()=>{dn=[`UploaderBlock`,`ActivityBlock`,`Block`,`SolutionBlock`]}));ln(),fn();function pn(e,t=!1){return new Promise((n,r)=>{if(typeof document!=`object`){n(null);return}if(typeof window==`object`&&window.UC){n(window.UC);return}let i=document.createElement(`script`);i.async=!0,i.src=e,i.onerror=()=>{r()},i.onload=()=>{let e=window.UC;t&&un(e),n(e)},document.head.appendChild(i)})}var mn,hn=n((()=>{mn={"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`}})),gn,_n,vn,yn,bn,xn,Sn=n((()=>{hn(),gn=new Map,_n=new Map,vn=(e,t)=>{gn.has(e)&&console.log(`Locale ${e} is already defined. Overwriting...`);let n={...mn,...t};return gn.set(e,n),n},yn=(e,t)=>{_n.set(e,t)},bn=(e,t)=>{typeof t==`function`?yn(e,t):vn(e,t)},xn=async e=>{let t=gn.get(e);if(!t){let n=_n.get(e);if(!n)throw Error(`Locale ${e} is not defined`);t=vn(e,await n())}return t},bn(`en`,mn)})),E,Cn=n((()=>{E=e=>`*cfg/${e}`})),wn,Tn,En=n((()=>{wn=e=>e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[],Tn=e=>e.join(`,`)}));function Dn(e){let t=new URL(e),n=t.pathname+t.search+t.hash,r=n.lastIndexOf(`http`),i=n.lastIndexOf(`/`),a=``;return r>=0?a=n.slice(r):i>=0&&(a=n.slice(i+1)),a}function On(e){let{pathname:t}=new URL(e),n=t.indexOf(`/`),r=t.indexOf(`/`,n+1);return t.substring(n+1,r)}function kn(e){let t=jn(e),n=new URL(t),r=n.pathname.indexOf(`/-/`);return r===-1?``:n.pathname.substring(r).slice(1)}function An(e){return kn(e).split(`/-/`).filter(Boolean).map(e=>Pn(e))}function jn(e){let t=new URL(e),n=Dn(e),r=Mn(n)?Nn(n).pathname:n;return t.pathname=t.pathname.replace(r,``),t.search=``,t.hash=``,t.toString()}function Mn(e){return e.startsWith(`http`)}function Nn(e){let t=new URL(e);return{pathname:`${t.origin}${t.pathname??``}`,search:t.search??``,hash:t.hash??``}}var Pn,Fn,In,Ln,Rn,zn=n((()=>{Pn=e=>{if(typeof e!=`string`||!e)return``;let t=e.trim();return t.startsWith(`-/`)?t=t.slice(2):t.startsWith(`/`)&&(t=t.slice(1)),t.endsWith(`/`)&&(t=t.slice(0,t.length-1)),t},Fn=(...e)=>e.filter(e=>typeof e==`string`&&!!e).map(e=>Pn(e)).join(`/-/`),In=(...e)=>{let t=Fn(...e);return t?`-/${t}/`:``},Ln=(e,t,n)=>{let r=new URL(jn(e)),i=n??Dn(e),a=t??``;if(r.pathname.startsWith(`//`)&&(r.pathname=r.pathname.replace(`//`,`/`)),i&&Mn(i)){let e=Nn(i);r.pathname=`${r.pathname}${a}${e.pathname||``}`,r.search=e.search,r.hash=e.hash}else r.pathname=`${r.pathname}${a}${i||``}`;return r.toString()},Rn=(e,t)=>{let n=new URL(e);return n.pathname=`${t}/`,n.toString()}})),Bn,Vn=n((()=>{Bn=(e,t=`,`)=>e.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0)}));function Hn(e,t){if(typeof t==`number`){let n=t;return Gn[e]===n?``:`${e}/${n}`}if(typeof t==`boolean`){let n=t;return Gn[e]===n?``:`${e}`}if(e===`filter`&&t){let{name:n,amount:r}=t;return Gn.filter===r?``:`${e}/${n}/${r}`}if(e===`crop`&&t){let{dimensions:n,coords:r}=t;return`${e}/${n.join(`x`)}/${r.join(`,`)}`}return``}function Un(e){return Fn(...Kn.filter(t=>e[t]!==void 0&&e[t]!==null).map(t=>{let n=e[t];return Hn(t,n)}).filter(e=>!!e))}function Wn(e){let t={};for(let n of e){let[e,...r]=n.split(`/`);if(!e||!Kn.includes(e))continue;let i=e,a=Qn[i];try{t[i]=a(r)}catch(e){console.warn([`Failed to parse URL operation "${n}". It will be ignored.`,e instanceof Error?`Error message: "${e.message}"`:e,`If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new`].join(`
|
|
8
|
-
`))}}return t}var Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n=n((()=>{zn(),Vn(),Gn=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}),Kn=[`enhance`,`brightness`,`exposure`,`gamma`,`contrast`,`saturation`,`vibrance`,`warmth`,`filter`,`mirror`,`flip`,`rotate`,`crop`],qn=Fn(`format/auto`,`progressive/yes`),Jn=([e])=>e===void 0?void 0:Number(e),Yn=()=>!0,Xn=([e,t])=>({name:e,amount:t===void 0?100:Number(t)}),Zn=([e,t])=>{if(!/\d+x\d+/.test(e)||!/\d+,\d+/.test(t))throw Error(`Crop by aspect ratio, percentage or alignment shortcuts is not supported.`);return{dimensions:Bn(e,`x`).map(Number),coords:Bn(t).map(Number)}},Qn=Object.freeze({enhance:Jn,brightness:Jn,exposure:Jn,gamma:Jn,contrast:Jn,saturation:Jn,vibrance:Jn,warmth:Jn,filter:Xn,mirror:Yn,flip:Yn,rotate:Jn,crop:e=>{let[t,n]=e,{dimensions:r,coords:i}=Zn([t,n]);return{dimensions:r,coords:i}}})})),D,er,tr,nr,rr,ir,ar,or=n((()=>{$n(),D=Object.freeze({CROP:`crop`,TUNING:`tuning`,FILTERS:`filters`}),er=Object.freeze([D.CROP,D.TUNING,D.FILTERS]),tr=Object.freeze([`brightness`,`exposure`,`gamma`,`contrast`,`saturation`,`vibrance`,`warmth`,`enhance`]),nr=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`.split(`.`)),rr=Object.freeze([`rotate`,`mirror`,`flip`]),ir=Gn,ar=Object.freeze({brightness:{zero:ir.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:ir.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:ir.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:ir.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:ir.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:ir.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:ir.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:ir.enhance,range:[0,100],keypointsNumber:1},filter:{zero:ir.filter,range:[0,100],keypointsNumber:1}})})),sr,cr,lr,ur,dr,fr,pr=n((()=>{En(),or(),sr=`https://ucarecdn.com`,cr=`https://upload.uploadcare.com`,lr=`https://social.uploadcare.com`,ur=`https://ucarecd.net`,dr={pubkey:``,multiple:!0,multipleMin:0,multipleMax:2**53-1,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:sr,cdnCnamePrefixed:ur,baseUrl:cr,socialBaseUrl:lr,secureSignature:``,secureExpire:``,secureDeliveryProxy:``,retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:``,debug:!1,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:!0,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:`list`,gridShowFileNames:!1,useCloudImageEditor:!0,cloudImageEditorAutoOpen:!1,cloudImageEditorTabs:Tn(er),cloudImageEditorMaskHref:null,testMode:!1,qualityInsights:!0,pasteScope:`local`,plugins:[]},fr=Object.freeze(dr)})),mr,hr=n((()=>{Cn(),mr=(e,t)=>(...n)=>{let r=e();if(!r.read(E(`debug`)))return;let i=n;if(typeof n?.[0]==`function`){let e=n[0];i=e()}let a=[r.id,t].filter(Boolean);console.log(`[${a.join(`][`)}]`,...i)}})),gr,_r,vr,yr,br=n((()=>{Cn(),pr(),hr(),gr=class{constructor(e){this._subscriptions=new Set,this._cfgProxy=null,this._debugPrint=mr(()=>this._sharedInstancesBag.ctx,this.constructor.name),this._sharedInstancesBag=e,this._ctx=e.ctx}addSub(e){this._subscriptions.add(e)}get _cfg(){return this._cfgProxy||=new Proxy({},{set:()=>{throw Error(`SharedInstance cfg proxy is read-only`)},get:(e,t)=>{if(typeof t!=`string`)return;let n=E(t);return this._sharedInstancesBag.ctx.has(n)?this._sharedInstancesBag.ctx.read(n):fr[t]}}),this._cfgProxy}destroy(){for(let e of this._subscriptions)try{e()}catch{}this._subscriptions.clear()}},_r={modalManager:`*modalManager`,pluginManager:`*pluginManager`,telemetryManager:`*telemetryManager`,localeManager:`*localeManager`,a11y:`*a11y`,clipboard:`*clipboard`,blocksRegistry:`*blocksRegistry`,eventEmitter:`*eventEmitter`,uploadCollection:`*uploadCollection`,secureUploadsManager:`*secureUploadsManager`,api:`*publicApi`,validationManager:`*validationManager`},vr=(e,t,n=!0)=>{let r=e.has(t),i=r?e.read(t):null;if(r&&i||!n)return i;throw Error(`Unexpected error: shared instance for key "${String(t)}" is not available`)},yr=e=>({get ctx(){return e()},get modalManager(){return vr(e(),`*modalManager`,!1)},get pluginManager(){return vr(e(),`*pluginManager`)},get telemetryManager(){return vr(e(),`*telemetryManager`)},get localeManager(){return vr(e(),`*localeManager`)},get a11y(){return vr(e(),`*a11y`)},get blocksRegistry(){return vr(e(),`*blocksRegistry`)},get eventEmitter(){return vr(e(),`*eventEmitter`)},get uploadCollection(){return vr(e(),`*uploadCollection`)},get secureUploadsManager(){return vr(e(),`*secureUploadsManager`,!1)},get api(){return vr(e(),`*publicApi`)},get validationManager(){return vr(e(),`*validationManager`)},when(t,n){let r=_r[t],i=e(),a=i.has(r)?i.read(r):void 0;if(a)return n(a),()=>{};let o=i.sub(r,e=>{e&&(n(e),o())});return o}})})),O,xr,Sr=n((()=>{br(),O=Object.freeze({ADD:`modal:add`,DELETE:`modal:delete`,OPEN:`modal:open`,CLOSE:`modal:close`,CLOSE_ALL:`modal:closeAll`,DESTROY:`modal:destroy`}),xr=class extends gr{constructor(...e){super(...e),this._modals=new Map,this._activeModals=new Set,this._subscribers=new Map}registerModal(e,t){this._modals.set(e,t),this._notify(O.ADD,{id:e,modal:t})}deleteModal(e){let t=this._modals.get(e);return t?(this._modals.delete(e),this._activeModals.delete(e),this._notify(O.DELETE,{id:e,modal:t}),!0):!1}open(e){let t=this._modals.get(e);return t?(this._activeModals.add(e),this._notify(O.OPEN,{modal:t,id:e}),!0):(this._debugPrint(`Modal with ID "${e}" not found`),!1)}close(e){let t=this._modals.get(e);return!t||!this._activeModals.has(e)?(this._debugPrint(`Modal with ID "${e}" not found or not active`),!1):(this._activeModals.delete(e),this._notify(O.CLOSE,{id:e,modal:t}),!0)}toggle(e){return this._modals.has(e)?this._activeModals.has(e)?this.close(e):this.open(e):(this._debugPrint(`Modal with ID "${e}" not found`),!1)}get hasActiveModals(){return this._activeModals.size>0}back(){if(this._activeModals.size===0)return this._debugPrint(`No active modals to go back from`),!1;let e=Array.from(this._activeModals).pop();return e?this.close(e):!1}closeAll(){let e=this._activeModals.size;return this._activeModals.clear(),this._notify(O.CLOSE_ALL,{}),e}subscribe(e,t){return this._subscribers.has(e)||this._subscribers.set(e,new Set),this._subscribers.get(e)?.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){this._subscribers.has(e)&&this._subscribers.get(e)?.delete(t)}_notify(e,t){if(this._subscribers.has(e))for(let n of this._subscribers.get(e)??new Set)try{n(t)}catch(e){this._sharedInstancesBag.telemetryManager.sendEventError(e,`modal subscriber`),this._debugPrint(`Error in modal subscriber:`,e)}}destroy(){super.destroy(),this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(O.DESTROY,{})}}})),Cr,wr=n((()=>{Cr=e=>e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(e=>e.toLowerCase()).join(`-`)}));function Tr(e){return Object.prototype.toString.call(e)===`[object Object]`}function Er(e){return e.split(Qr).map((e,t)=>e.charAt(0)[t>0?`toUpperCase`:`toLowerCase`]()+e.slice(1)).join(``)}function Dr(e,{ignoreKeys:t}={ignoreKeys:[]}){return Array.isArray(e)?e.map(e=>Or(e,{ignoreKeys:t})):e}function Or(e,{ignoreKeys:t}={ignoreKeys:[]}){if(Array.isArray(e))return Dr(e,{ignoreKeys:t});if(!Tr(e))return e;let n={};for(let r of Object.keys(e)){let i=e[r];if(t.includes(r)){n[r]=i;continue}Tr(i)?i=Or(i,{ignoreKeys:t}):Array.isArray(i)&&(i=Dr(i,{ignoreKeys:t})),n[Er(r)]=i}return n}function kr({libraryName:e,libraryVersion:t,userAgent:n,publicKey:r=``,integration:i=``}){let a=`JavaScript`;return typeof n==`string`?n:typeof n==`function`?n({publicKey:r,libraryName:e,libraryVersion:t,languageName:a,integration:i}):`${[e,t,r].filter(Boolean).join(`/`)} (${[a,i].filter(Boolean).join(`; `)})`}function Ar(e,t=ei){let n=0;function r(e){let i=Math.round(t.time*t.factor**n);return e({attempt:n,retry:t=>$r(t??i).then(()=>(n+=1,r(e)))})}return r(e)}function jr(e,...t){return e}function Mr(e,t,n){if(Array.isArray(n))for(let r of n)Mr(e,`${t}[]`,r);else if(bi(n)){let{name:r,contentType:i}=n,a=di(n.data,r,i??si),o=ui({name:r,contentType:i});e.push([t,a,...o])}else if(yi(n))for(let[r,i]of Object.entries(n))i!==void 0&&e.push([`${t}[${r}]`,String(i)]);else vi(n)&&n&&e.push([t,n.toString()])}function Nr(e){let t=[];for(let[n,r]of Object.entries(e))Mr(t,n,r);return t}function Pr(e){let t=fi(),n=Nr(e);for(let e of n){let[n,r,...i]=e;t.append(n,r,...i)}return t}function Fr(e){return kr({libraryName:Ti,libraryVersion:Ei,...e})}function Ir(e){let{headers:t}=e||{};if(!t||typeof t[`retry-after`]!=`string`)return Oi;let n=parseInt(t[`retry-after`],10);return Number.isFinite(n)?n*1e3:Oi}function Lr(e,t){let{retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:r}=t;return Ar(({attempt:t,retry:i})=>e().catch(e=>{if(`response`in e&&e?.code===Di&&t<n)return i(Ir(e));if(e instanceof ni&&t<r)return i((t+1)*ki);throw e}))}function Rr(e){return e===void 0||e===`auto`?`auto`:e?`1`:`0`}function zr(e,{publicKey:t,fileName:n,contentType:r,baseURL:i=k.baseURL,secureSignature:a,secureExpire:o,store:s,signal:c,onProgress:l,source:u=`local`,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:h}){return Lr(()=>li({method:`POST`,url:Ci(i,`/base/`,{jsonerrors:1}),headers:{"X-UC-User-Agent":Fr({publicKey:t,integration:d,userAgent:f})},data:Pr({file:{data:e,name:n||ji(e),contentType:r||Ai(e)},UPLOADCARE_PUB_KEY:t,UPLOADCARE_STORE:Rr(s),signature:a,expire:o,source:u,metadata:h}),signal:c,onProgress:l}).then(({data:e,headers:t,request:n})=>{let r=Or(JSON.parse(e));if(`error`in r)throw new xi(r.error.content,r.error.errorCode,n,r,t);return r}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:p})}function Br(e,{publicKey:t,baseURL:n=k.baseURL,store:r,fileName:i,checkForUrlDuplicates:a,saveUrlForRecurrentUploads:o,secureSignature:s,secureExpire:c,source:l=`url`,signal:u,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:h}){return Lr(()=>li({method:`POST`,headers:{"X-UC-User-Agent":Fr({publicKey:t,integration:d,userAgent:f})},url:Ci(n,`/from_url/`,{jsonerrors:1,pub_key:t,source_url:e,store:Rr(r),filename:i,check_URL_duplicates:a?1:void 0,save_URL_duplicates:o?1:void 0,signature:s,expire:c,source:l,metadata:h}),signal:u}).then(({data:e,headers:t,request:n})=>{let r=Or(JSON.parse(e));if(`error`in r)throw new xi(r.error.content,r.error.errorCode,n,r,t);return r}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:p})}function Vr(e,{publicKey:t,baseURL:n=k.baseURL,signal:r,integration:i,userAgent:a,retryThrottledRequestMaxTimes:o=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:s=k.retryNetworkErrorMaxTimes}={}){return Lr(()=>li({method:`GET`,headers:t?{"X-UC-User-Agent":Fr({publicKey:t,integration:i,userAgent:a})}:void 0,url:Ci(n,`/from_url/status/`,{jsonerrors:1,token:e}),signal:r}).then(({data:e,headers:t,request:n})=>{let r=Or(JSON.parse(e));if(`error`in r&&!Ni(r))throw new xi(r.error.content,r.error.errorCode,n,r,t);return r}),{retryNetworkErrorMaxTimes:s,retryThrottledRequestMaxTimes:o})}function Hr(e,{publicKey:t,baseURL:n=k.baseURL,jsonpCallback:r,secureSignature:i,secureExpire:a,signal:o,source:s,integration:c,userAgent:l,retryThrottledRequestMaxTimes:u=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=k.retryNetworkErrorMaxTimes}){return Lr(()=>li({method:`POST`,headers:{"X-UC-User-Agent":Fr({publicKey:t,integration:c,userAgent:l})},url:Ci(n,`/group/`,{jsonerrors:1}),data:Pr({files:e,callback:r,pub_key:t,signature:i,expire:a,source:s}),signal:o}).then(({data:e,headers:t,request:n})=>{let r=Or(JSON.parse(e));if(`error`in r)throw new xi(r.error.content,r.error.errorCode,n,r,t);return r}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function Ur(e,{publicKey:t,baseURL:n=k.baseURL,signal:r,source:i,integration:a,userAgent:o,retryThrottledRequestMaxTimes:s=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=k.retryNetworkErrorMaxTimes}){return Lr(()=>li({method:`GET`,headers:{"X-UC-User-Agent":Fr({publicKey:t,integration:a,userAgent:o})},url:Ci(n,`/info/`,{jsonerrors:1,pub_key:t,file_id:e,source:i}),signal:r}).then(({data:e,headers:t,request:n})=>{let r=Or(JSON.parse(e));if(`error`in r)throw new xi(r.error.content,r.error.errorCode,n,r,t);return r}),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:c})}function Wr(e,{publicKey:t,contentType:n,fileName:r,multipartChunkSize:i=k.multipartChunkSize,baseURL:a=``,secureSignature:o,secureExpire:s,store:c,signal:l,source:u=`local`,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:h}){return Lr(()=>li({method:`POST`,url:Ci(a,`/multipart/start/`,{jsonerrors:1}),headers:{"X-UC-User-Agent":Fr({publicKey:t,integration:d,userAgent:f})},data:Pr({filename:r||ci,size:e,content_type:n||si,part_size:i,UPLOADCARE_STORE:Rr(c),UPLOADCARE_PUB_KEY:t,signature:o,expire:s,source:u,metadata:h}),signal:l}).then(({data:e,headers:t,request:n})=>{let r=Or(JSON.parse(e));if(`error`in r)throw new xi(r.error.content,r.error.errorCode,n,r,t);return r.parts=Object.keys(r.parts).map(e=>r.parts[Number(e)]),r}),{retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m})}function Gr(e,t,{contentType:n,signal:r,onProgress:i,retryThrottledRequestMaxTimes:a=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:o=k.retryNetworkErrorMaxTimes}){return Lr(()=>li({method:`PUT`,url:t,data:e,onProgress:i,signal:r,headers:{"Content-Type":n||si}}).then(e=>(i&&i({isComputable:!0,value:1}),e)).then(({status:e})=>({code:e})),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:o})}function Kr(e,{publicKey:t,baseURL:n=k.baseURL,source:r=`local`,signal:i,integration:a,userAgent:o,retryThrottledRequestMaxTimes:s=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=k.retryNetworkErrorMaxTimes}){return Lr(()=>li({method:`POST`,url:Ci(n,`/multipart/complete/`,{jsonerrors:1}),headers:{"X-UC-User-Agent":Fr({publicKey:t,integration:a,userAgent:o})},data:Pr({uuid:e,UPLOADCARE_PUB_KEY:t,source:r}),signal:i}).then(({data:e,headers:t,request:n})=>{let r=Or(JSON.parse(e));if(`error`in r)throw new xi(r.error.content,r.error.errorCode,n,r,t);return r}),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:c})}function qr(e,{publicKey:t,baseURL:n,source:r,integration:i,userAgent:a,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:s,signal:c,onProgress:l}){return oi({check:c=>Ur(e,{publicKey:t,baseURL:n,signal:c,source:r,integration:i,userAgent:a,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:s}).then(e=>e.isReady?e:(l&&l({isComputable:!0,value:1}),!1)),signal:c})}function Jr(e){return`defaultEffects`in e}function Yr({token:e,publicKey:t,baseURL:n,integration:r,userAgent:i,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:o,onProgress:s,signal:c}){return oi({check:c=>Vr(e,{publicKey:t,baseURL:n,integration:r,userAgent:i,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:o,signal:c}).then(t=>{switch(t.status){case A.Error:return new xi(t.error,t.errorCode);case A.Waiting:return!1;case A.Unknown:return new xi(`Token "${e}" was not found.`);case A.Progress:return s&&(t.total===`unknown`?s({isComputable:!1}):s({isComputable:!0,value:t.done/t.total})),!1;case A.Success:return s&&s({isComputable:!0,value:t.done/t.total}),t;default:throw Error(`Unknown status`)}}),signal:c})}async function Xr(e,{publicKey:t,fileName:n,baseURL:r=k.baseURL,secureSignature:i,secureExpire:a,store:o,signal:s,onProgress:c,source:l,integration:u,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:p,contentType:m,multipartMinFileSize:h,multipartChunkSize:ee,maxConcurrentRequests:te,baseCDN:g=k.baseCDN,checkForUrlDuplicates:ne,saveUrlForRecurrentUploads:re,pusherKey:ie,metadata:ae}){if(_i(e)){let ne=await Yi(e);return Xi(ne,h)?ra(e,{publicKey:t,contentType:m,multipartChunkSize:ee,fileSize:ne,fileName:n,baseURL:r,secureSignature:i,secureExpire:a,store:o,signal:s,onProgress:c,source:l,integration:u,userAgent:d,maxConcurrentRequests:te,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:p,baseCDN:g,metadata:ae}):Fi(e,{publicKey:t,fileName:n,contentType:m,baseURL:r,secureSignature:i,secureExpire:a,store:o,signal:s,onProgress:c,source:l,integration:u,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:p,baseCDN:g,metadata:ae})}if(Qi(e))return Ki(e,{publicKey:t,fileName:n,baseURL:r,baseCDN:g,checkForUrlDuplicates:ne,saveUrlForRecurrentUploads:re,secureSignature:i,secureExpire:a,store:o,signal:s,onProgress:c,source:l,integration:u,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:p,pusherKey:ie,metadata:ae});if(Zi(e))return Ii(e,{publicKey:t,fileName:n,baseURL:r,signal:s,onProgress:c,source:l,integration:u,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:p,baseCDN:g});throw TypeError(`File uploading from "${e}" is not supported`)}function Zr(e,{publicKey:t,fileName:n,baseURL:r=k.baseURL,secureSignature:i,secureExpire:a,store:o,signal:s,onProgress:c,source:l,integration:u,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:p,contentType:m,multipartChunkSize:h=k.multipartChunkSize,baseCDN:ee=k.baseCDN,checkForUrlDuplicates:te,saveUrlForRecurrentUploads:g,jsonpCallback:ne}){if(!oa(e)&&!ca(e)&&!sa(e))throw TypeError(`Group uploading from "${e}" is not supported`);let re,ie=!0,ae=e.length,oe=(e,t)=>{if(!c)return;re||=Array(e).fill(0);let n=t=>t.reduce((e,t)=>e+t)/e;return e=>{if(!e.isComputable||!ie){ie=!1,c({isComputable:!1});return}re[t]=e.value,c({isComputable:!0,value:n(re)})}};return Promise.all(e.map((e,c)=>_i(e)||Qi(e)?Xr(e,{publicKey:t,fileName:n,baseURL:r,secureSignature:i,secureExpire:a,store:o,signal:s,onProgress:oe(ae,c),source:l,integration:u,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:p,contentType:m,multipartChunkSize:h,baseCDN:ee,checkForUrlDuplicates:te,saveUrlForRecurrentUploads:g}).then(e=>e.uuid):e)).then(e=>Hr(e,{publicKey:t,baseURL:r,jsonpCallback:ne,secureSignature:i,secureExpire:a,signal:s,source:l,integration:u,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:p}).then(e=>new aa(e,{baseCDN:ee})).then(e=>(c&&c({isComputable:!0,value:1}),e)))}var Qr,$r,ei,ti,ni,ri,ii,ai,oi,k,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,A,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua=n((()=>{Qr=/\W|_/g,$r=e=>new Promise(t=>setTimeout(t,e)),ei={factor:2,time:100},ti=class extends Error{},ni=class e extends ti{originalProgressEvent;constructor(t){super(),this.name=`NetworkError`,this.message=`Network error`,Object.setPrototypeOf(this,e.prototype),this.originalProgressEvent=t}},ri=(e,t)=>{e&&(e.aborted?Promise.resolve().then(t):e.addEventListener(`abort`,()=>t(),{once:!0}))},ii=class e extends ti{isCancel=!0;constructor(t=`Request canceled`){super(t),this.name=`CancelError`,Object.setPrototypeOf(this,e.prototype)}},ai=500,oi=({check:e,interval:t=ai,timeout:n,signal:r})=>new Promise((i,a)=>{let o,s;ri(r,()=>{o&&clearTimeout(o),a(new ii(`Poll cancelled`))}),n&&(s=setTimeout(()=>{o&&clearTimeout(o),a(new ii(`Timed out`))},n));let c=()=>{try{Promise.resolve(e(r)).then(e=>{e?(s&&clearTimeout(s),i(e)):o=setTimeout(c,t)}).catch(e=>{s&&clearTimeout(s),a(e)})}catch(e){s&&clearTimeout(s),a(e)}};o=setTimeout(c,0)}),k={baseCDN:`https://ucarecdn.com`,baseURL:`https://upload.uploadcare.com`,maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:`79ae88bd931ea68464d9`},si=`application/octet-stream`,ci=`original`,li=({method:e,url:t,data:n,headers:r={},signal:i,onProgress:a})=>new Promise((o,s)=>{let c=new XMLHttpRequest,l=e?.toUpperCase()||`GET`,u=!1;c.open(l,t,!0),r&&Object.entries(r).forEach(e=>{let[t,n]=e;n!==void 0&&!Array.isArray(n)&&c.setRequestHeader(t,n)}),c.responseType=`text`,ri(i,()=>{u=!0,c.abort(),s(new ii)}),c.onload=()=>{if(c.status!=200)s(Error(`Error ${c.status}: ${c.statusText}`));else{let e={method:l,url:t,data:n,headers:r||void 0,signal:i,onProgress:a},s=c.getAllResponseHeaders().trim().split(/[\r\n]+/),u={};s.forEach(function(e){let t=e.split(`: `),n=t.shift(),r=t.join(`: `);n&&n!==void 0&&(u[n]=r)});let d=c.response,f=c.status;o({request:e,data:d,headers:u,status:f})}},c.onerror=e=>{u||s(new ni(e))},a&&typeof a==`function`&&(c.upload.onprogress=e=>{e.lengthComputable?a({isComputable:!0,value:e.loaded/e.total}):a({isComputable:!1})}),n?c.send(n):c.send()}),ui=({name:e})=>e?[e]:[],di=jr,fi=()=>new FormData,pi=e=>!1,mi=e=>typeof Blob<`u`&&e instanceof Blob,hi=e=>typeof File<`u`&&e instanceof File,gi=e=>!!e&&typeof e==`object`&&!Array.isArray(e)&&`uri`in e&&typeof e.uri==`string`,_i=e=>mi(e)||hi(e)||pi()||gi(e),vi=e=>typeof e==`string`||typeof e==`number`||e===void 0,yi=e=>!!e&&typeof e==`object`&&!Array.isArray(e),bi=e=>!!e&&typeof e==`object`&&`data`in e&&_i(e.data),xi=class e extends ti{code;request;response;headers;constructor(t,n,r,i,a){super(),this.name=`UploadError`,this.message=t,this.code=n,this.request=r,this.response=i,this.headers=a,Object.setPrototypeOf(this,e.prototype)}},Si=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).filter(e=>e[1]??!1).forEach(e=>t.set(`${n}[${e[0]}]`,String(e[1]))):Array.isArray(r)?r.forEach(e=>{t.append(`${n}[]`,e)}):typeof r==`string`&&r?t.set(n,r):typeof r==`number`&&t.set(n,r.toString());return t.toString()},Ci=(e,t,n)=>{let r=new URL(e);return r.pathname=(r.pathname+t).replace(`//`,`/`),n&&(r.search=Si(n)),r.toString()},wi=`6.18.4`,Ti=`UploadcareUploadClient`,Ei=wi,Di=`RequestThrottledError`,Oi=15e3,ki=1e3,Ai=e=>{let t=``;return(mi(e)||hi(e)||gi(e))&&(t=e.type),t||si},ji=e=>{let t=``;return hi(e)&&e.name?t=e.name:mi(e)||pi()?t=``:gi(e)&&e.name&&(t=e.name),t||ci},(function(e){e.Token=`token`,e.FileInfo=`file_info`})(Mi||={}),(function(e){e.Unknown=`unknown`,e.Waiting=`waiting`,e.Progress=`progress`,e.Error=`error`,e.Success=`success`})(A||={}),Ni=e=>`status`in e&&e.status===A.Error,Pi=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(e,{baseCDN:t=k.baseCDN,fileName:n}={}){let{uuid:r,s3Bucket:i}=e,a=Ci(t,`${r}/`),o=i?Ci(`https://${i}.s3.amazonaws.com/`,`${r}/${e.filename}`):null;this.uuid=r,this.name=n||e.filename,this.size=e.size,this.isStored=e.isStored,this.isImage=e.isImage,this.mimeType=e.mimeType,this.cdnUrl=a,this.originalFilename=e.originalFilename,this.imageInfo=e.imageInfo,this.videoInfo=e.videoInfo,this.contentInfo=e.contentInfo,this.metadata=e.metadata||null,this.s3Bucket=i||null,this.s3Url=o,Jr(e)&&(this.defaultEffects=e.defaultEffects)}},Fi=(e,{publicKey:t,fileName:n,baseURL:r,secureSignature:i,secureExpire:a,store:o,contentType:s,signal:c,onProgress:l,source:u,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,baseCDN:h,metadata:ee})=>zr(e,{publicKey:t,fileName:n,contentType:s,baseURL:r,secureSignature:i,secureExpire:a,store:o,signal:c,onProgress:l,source:u,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,metadata:ee}).then(({file:e})=>qr(e,{publicKey:t,baseURL:r,source:u,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,onProgress:l,signal:c})).then(e=>new Pi(e,{baseCDN:h})),Ii=(e,{publicKey:t,fileName:n,baseURL:r,signal:i,onProgress:a,source:o,integration:s,userAgent:c,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:u,baseCDN:d})=>Ur(e,{publicKey:t,baseURL:r,signal:i,source:o,integration:s,userAgent:c,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:u}).then(e=>new Pi(e,{baseCDN:d,fileName:n})).then(e=>(a&&a({isComputable:!0,value:1}),e)),Li=(e,{signal:t}={})=>{let n=null,r=null,i=e.map(()=>new AbortController),a=e=>()=>{r=e,i.forEach((t,n)=>n!==e&&t.abort())};return ri(t,()=>{i.forEach(e=>e.abort())}),Promise.all(e.map((e,t)=>{let r=a(t);return Promise.resolve().then(()=>e({stopRace:r,signal:i[t].signal})).then(e=>(r(),e)).catch(e=>(n=e,null))})).then(e=>{if(r===null)throw n;return e[r]})},Ri=window.WebSocket,zi=class{events=Object.create({});emit(e,t){this.events[e]?.forEach(e=>e(t))}on(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)}off(e,t){t?this.events[e]=this.events[e].filter(e=>e!==t):this.events[e]=[]}},Bi=(e,t)=>e===`success`?{status:A.Success,...t}:e===`progress`?{status:A.Progress,...t}:{status:A.Error,...t},Vi=class{key;disconnectTime;ws=void 0;queue=[];isConnected=!1;subscribers=0;emmitter=new zi;disconnectTimeoutId=null;constructor(e,t=3e4){this.key=e,this.disconnectTime=t}connect(){this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws&&(this.ws=new Ri(`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`),this.ws.addEventListener(`error`,e=>{this.emmitter.emit(`error`,Error(e.message))}),this.emmitter.on(`connected`,()=>{this.isConnected=!0,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[]}),this.ws.addEventListener(`message`,e=>{let t=JSON.parse(e.data.toString());switch(t.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(t.channel,Bi(t.event,JSON.parse(t.data)))}}))}disconnect(){let e=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{e()},this.disconnectTime):e()}send(e,t){let n=JSON.stringify({event:e,data:t});this.ws?.send(n)}subscribe(e,t){this.subscribers+=1,this.connect();let n=`task-status-${e}`,r={event:`pusher:subscribe`,data:{channel:n}};this.emmitter.on(n,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(e){--this.subscribers;let t=`task-status-${e}`,n={event:`pusher:unsubscribe`,data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(n.event,n.data):this.queue=this.queue.filter(e=>e.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(e){return this.emmitter.on(`error`,e),()=>this.emmitter.off(`error`,e)}},Hi=null,Ui=e=>(Hi||=new Vi(e,typeof window>`u`?0:3e4),Hi),Wi=e=>{Ui(e).connect()},Gi=({token:e,pusherKey:t,signal:n,onProgress:r})=>new Promise((i,a)=>{let o=Ui(t),s=o.onError(a),c=()=>{s(),o.unsubscribe(e)};ri(n,()=>{c(),a(new ii(`pusher cancelled`))}),o.subscribe(e,e=>{switch(e.status){case A.Progress:r&&(e.total===`unknown`?r({isComputable:!1}):r({isComputable:!0,value:e.done/e.total}));break;case A.Success:c(),r&&r({isComputable:!0,value:e.done/e.total}),i(e);break;case A.Error:c(),a(new xi(e.msg,e.error_code))}})}),Ki=(e,{publicKey:t,fileName:n,baseURL:r,baseCDN:i,checkForUrlDuplicates:a,saveUrlForRecurrentUploads:o,secureSignature:s,secureExpire:c,store:l,signal:u,onProgress:d,source:f,integration:p,userAgent:m,retryThrottledRequestMaxTimes:h,pusherKey:ee=k.pusherKey,metadata:te})=>Promise.resolve(Wi(ee)).then(()=>Br(e,{publicKey:t,fileName:n,baseURL:r,checkForUrlDuplicates:a,saveUrlForRecurrentUploads:o,secureSignature:s,secureExpire:c,store:l,signal:u,source:f,integration:p,userAgent:m,retryThrottledRequestMaxTimes:h,metadata:te})).catch(e=>(Ui(ee)?.disconnect(),Promise.reject(e))).then(e=>e.type===Mi.FileInfo?e:Li([({signal:n})=>Yr({token:e.token,publicKey:t,baseURL:r,integration:p,userAgent:m,retryThrottledRequestMaxTimes:h,onProgress:d,signal:n}),({signal:t})=>Gi({token:e.token,pusherKey:ee,signal:t,onProgress:d})],{signal:u})).then(e=>{if(e instanceof xi)throw e;return e}).then(e=>qr(e.uuid,{publicKey:t,baseURL:r,integration:p,userAgent:m,retryThrottledRequestMaxTimes:h,onProgress:d,signal:u})).then(e=>new Pi(e,{baseCDN:i})),qi=new WeakMap,Ji=async e=>{if(qi.has(e))return qi.get(e);let t=await fetch(e.uri).then(e=>e.blob());return qi.set(e,t),t},Yi=async e=>{if(hi(e)||mi(e))return e.size;if(gi(e))return(await Ji(e)).size;throw Error(`Unknown file type. Cannot determine file size.`)},Xi=(e,t=k.multipartMinFileSize)=>e>=t,Zi=e=>{let t=RegExp(`[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`);return!_i(e)&&t.test(e)},Qi=e=>{let t=RegExp(`^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$`);return!_i(e)&&t.test(e)},$i=(e,t)=>new Promise((n,r)=>{let i=[],a=!1,o=t.length,s=[...t],c=()=>{let e=t.length-s.length,l=s.shift();l&&l().then(t=>{a||(i[e]=t,--o,o?c():n(i))}).catch(e=>{a=!0,r(e)})};for(let t=0;t<e;t++)c()}),ea=(e,t,n,r)=>{let i=r*t,a=Math.min(i+r,n);return e.slice(i,a)},ta=async(e,t,n)=>r=>ea(e,r,t,n),na=(e,t,{publicKey:n,contentType:r,onProgress:i,signal:a,integration:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:c})=>Gr(e,t,{publicKey:n,contentType:r,onProgress:i,signal:a,integration:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:c}),ra=async(e,{publicKey:t,fileName:n,fileSize:r,baseURL:i,secureSignature:a,secureExpire:o,store:s,signal:c,onProgress:l,source:u,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,contentType:h,multipartChunkSize:ee=k.multipartChunkSize,maxConcurrentRequests:te=k.maxConcurrentRequests,baseCDN:g,metadata:ne})=>{let re=r??await Yi(e),ie,ae=(e,t)=>{if(!l)return;ie||=Array(e).fill(0);let n=e=>e.reduce((e,t)=>e+t,0);return r=>{r.isComputable&&(ie[t]=r.value,l({isComputable:!0,value:n(ie)/e}))}};return h||=Ai(e),Wr(re,{publicKey:t,contentType:h,fileName:n||ji(e),baseURL:i,secureSignature:a,secureExpire:o,store:s,signal:c,source:u,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,metadata:ne,multipartChunkSize:ee}).then(async({uuid:n,parts:r})=>{let i=await ta(e,re,ee);return Promise.all([n,$i(te,r.map((e,n)=>()=>na(i(n),e,{publicKey:t,contentType:h,onProgress:ae(r.length,n),signal:c,integration:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m})))])}).then(([e])=>Kr(e,{publicKey:t,baseURL:i,source:u,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m})).then(e=>e.isReady?e:qr(e.uuid,{publicKey:t,baseURL:i,source:u,integration:d,userAgent:f,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:m,onProgress:l,signal:c})).then(e=>new Pi(e,{baseCDN:g}))},ia=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.hostname=r.hostname,n.port=r.port,n.toString()}catch{return e}},aa=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(e,{baseCDN:t=k.baseCDN}={}){this.uuid=e.id,this.filesCount=e.filesCount;let n=e.files.filter(Boolean);this.totalSize=Object.values(n).reduce((e,t)=>e+t.size,0),this.isStored=!!e.datetimeStored,this.isImage=!!Object.values(n).filter(e=>e.isImage).length,this.cdnUrl=ia(e.cdnUrl,t),this.files=n.map(e=>new Pi(e,{baseCDN:t})),this.createdAt=e.datetimeCreated,this.storedAt=e.datetimeStored}},oa=e=>{for(let t of e)if(!_i(t))return!1;return!0},sa=e=>{for(let t of e)if(!Zi(t))return!1;return!0},ca=e=>{for(let t of e)if(!Qi(t))return!1;return!0},la=class{_concurrency=1;_pending=[];_running=0;_resolvers=new Map;_rejectors=new Map;constructor(e){this._concurrency=e}run(){let e=this._concurrency-this._running;for(let t=0;t<e;t++){let e=this._pending.shift();if(!e)return;let t=this._resolvers.get(e),n=this._rejectors.get(e);if(!t||!n)throw Error(`Unexpected behavior: resolver or rejector is undefined`);this._running+=1,e().finally(()=>{this._resolvers.delete(e),this._rejectors.delete(e),--this._running,this.run()}).then(e=>t(e)).catch(e=>n(e))}}add(e,{autoRun:t}={autoRun:!0}){return new Promise((n,r)=>{this._resolvers.set(e,n),this._rejectors.set(e,r),this._pending.push(e),t&&this.run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(e){this._concurrency=e,this.run()}get concurrency(){return this._concurrency}}})),da,fa,pa,ma,ha=n((()=>{ua(),da=()=>({}),fa=e=>({...da(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{e.modalManager?.close(e.$[`*currentActivity`]),e.pub(`*currentActivity`,null)}}),pa=e=>({...fa(e),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new la(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),ma=e=>({...pa(e),"*solution":null})})),j,ga=n((()=>{j=Object.freeze({START_FROM:`start-from`,CAMERA:`camera`,UPLOAD_LIST:`upload-list`,URL:`url`,CLOUD_IMG_EDIT:`cloud-image-edit`,EXTERNAL:`external`})})),_a,va=n((()=>{ga(),br(),_a=class extends gr{constructor(e){super(e),this.scopes=new Set,this.listener=this._listener.bind(this),window.addEventListener(`paste`,this.listener)}openUploadList(){this._sharedInstancesBag.api.setCurrentActivity(j.UPLOAD_LIST),this._sharedInstancesBag.api.setModalState(!0)}async _listener(e){if(e.clipboardData){for(let t of this.scopes)if(t.isConnected)switch(this._cfg.pasteScope){case`global`:await this.handlePaste(e);break;case`local`:if(!t.contains(e.target))continue;await this.handlePaste(e);break;default:continue}}}async handlePaste(e){let t=Array.from(e.clipboardData.items),n=t.map(e=>e.getAsFile()).filter(e=>e!==null),r=t.filter(e=>e.kind===`string`&&e.type===`text/plain`).map(e=>new Promise(t=>{e.getAsString(e=>{t(e)})}));n.length>0&&(n.forEach(e=>{this._sharedInstancesBag.api.addFileFromObject(e,{source:`clipboard`})}),this.openUploadList()),r.length>0&&((await Promise.all(r)).forEach(e=>{this._sharedInstancesBag.api.addFileFromUrl(e,{source:`clipboard`})}),this.openUploadList())}registerBlock(e){return this.scopes.add(e),()=>{this.scopes.delete(e)}}destroy(){super.destroy(),window.removeEventListener(`paste`,this.listener),this.scopes.clear()}}})),ya=n((()=>{}));function ba(e,t){t.tabIndex=0,t.focus(),e.tabIndex=-1}function xa(e){let t=e.role||e.type||e.tagName;if(!t)return null;let n=Ea[t.toLowerCase()];if(!n)return null;for(let t of n){let n=e.closest(`[role=${t}]`);if(n)return n}}function Sa(e,t){return t.role===`toolbar`?Ca(t):t.querySelectorAll(`[role=${e.role}]`)}function Ca(e){return[...e.querySelectorAll(`*`)].filter(e=>e.role===`button`||e.type===`button`||e.role===`checkbox`||e.type===`checkbox`)}function wa(e){let t=e.getAttribute(`aria-orientation`);if(t===`vertical`)return!1;if(t===`horizontal`)return!0;let n=e.role;return n===`menubar`||n===`tablist`||n===`toolbar`}function Ta(e){return t=>{let n=!1,r=e?.searchDelayMs||300,i=0,a=``;function o(e){let n=xa(e.target);if(!n){s();return}let o=Sa(e.target,n),c=Array.from(o).indexOf(e.target),l=`ArrowDown`,u=`ArrowUp`;if(wa(n)&&(t.document.dir===`rtl`?(l=`ArrowLeft`,u=`ArrowRight`):(l=`ArrowRight`,u=`ArrowLeft`)),e.key===l)e.preventDefault(),ba(e.target,o[c+1]||o[0]);else if(e.key===u)e.preventDefault(),ba(e.target,o[c-1]||o[o.length-1]);else if(e.key===`Home`)e.preventDefault(),ba(e.target,o[0]);else if(e.key===`End`)e.preventDefault(),ba(e.target,o[o.length-1]);else if(e.key.length===1&&n.role!==`tablist`){let t=Date.now();t-i<=r?a+=e.key.toLowerCase():a=e.key.toLowerCase(),i=t;let n=Array.from(o).find(e=>e.textContent?.trim()?.toLowerCase()?.startsWith(a));n&&(e.preventDefault(),ba(e.target,n))}}function s(){n=!1,t.removeEventListener(`keydown`,o)}function c(e){let r=xa(e.target);if(r){n||(n=!0,t.addEventListener(`keydown`,o));let i=Sa(e.target,r);for(let t of i)t!==e.target&&t.setAttribute(`tabindex`,-1)}else n&&s()}function l(e){(!e.relatedTarget||e.relatedTarget===t.document)&&s()}function u(e){let t=xa(e.target);if(t){let n=Sa(e.target,t);for(let t of n)t!==e.target&&t.setAttribute(`tabindex`,-1);e.target.setAttribute(`tabindex`,0)}}return t.addEventListener(`click`,u),t.addEventListener(`focusin`,c),t.addEventListener(`focusout`,l),()=>{s(),t.removeEventListener(`click`,u),t.removeEventListener(`focusin`,c),t.removeEventListener(`focusout`,l)}}}var Ea,Da=n((()=>{Ea={button:[`toolbar`],checkbox:[`toolbar`],menuitem:[`menu`,`menubar`],option:[`listbox`],tab:[`tablist`]}}));function Oa(){return e=>{let t,n;function r(e){if(e.target.getAttribute(`aria-hidden`)===`true`){t=e.target,t.setAttribute(`aria-hidden`,`false`),n=t.hidden,n&&(t.hidden=!1);let r=e.target.querySelector(`a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])`);r&&(r.tabIndex=0)}}function i(e){t&&t.contains(e.target)&&(!e.relatedTarget||!t.contains(e.relatedTarget))&&(e.target.tabIndex=-1,t.setAttribute(`aria-hidden`,`true`),n&&(t.hidden=!0),t=null)}return e.addEventListener(`keyuxJump`,r),e.addEventListener(`focusout`,i),()=>{e.removeEventListener(`keyuxJump`,r),e.removeEventListener(`focusout`,i)}}}var ka=n((()=>{})),Aa=n((()=>{}));function ja(){return e=>{let t=[];function n(n){let r=e.document.activeElement;r&&r!==e.document.body&&t.push(new WeakRef(r)),n.focus({focusVisible:!0})}function r(){let n=t.pop();if(!n){e.document.activeElement.blur();return}let i=n.deref();i&&i.isConnected?i.focus():r()}let i=0,a;function o(t){clearInterval(a);let r=t.getAttribute(`aria-controls`);a=setInterval(()=>{if(i++>50){clearInterval(a);return}let t=e.document.getElementById(r);if(t){let r=t.querySelector(`a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])`);r&&(clearInterval(a),t.dispatchEvent(new e.CustomEvent(`keyuxJump`,{bubbles:!0})),n(r))}},50)}function s(e){e.target.getAttribute(`aria-controls`)&&e.key===`Enter`&&o(e.target),e.key===`Escape`&&r()}return e.addEventListener(`keydown`,s),()=>{e.removeEventListener(`keydown`,s)}}}var Ma=n((()=>{})),Na=n((()=>{}));function Pa(e){let t,n=e.split(` `),r;function i(e){e.key===`Enter`&&(e.target.tagName===`BUTTON`||e.target.tagName===`A`)&&(a(),e.target.classList.add(...n),t=e.target,r=e.target)}function a(){t&&t.classList.remove(...n),r=null}function o(e){e.clientX===0&&e.clientY===0&&r!==e.target&&(a(),e.target.classList.add(...n),t=e.target)}return e=>(e.addEventListener(`click`,o),e.addEventListener(`keydown`,i),e.addEventListener(`keyup`,a),()=>{e.removeEventListener(`click`,o),e.removeEventListener(`keydown`,i),e.removeEventListener(`keyup`,a)})}var Fa=n((()=>{}));function Ia(e,t){let n=t.map(t=>t(e));return()=>{n.forEach(e=>e())}}var La=n((()=>{ya(),Da(),ka(),Aa(),Ma(),Na(),Fa()})),Ra,za,Ba=n((()=>{La(),Ra=class{constructor(){this._listeners=new Map,this._scope=[]}addEventListener(e,t){let n=e=>{let n=e.target;n instanceof Node&&this._scope.some(e=>e===n||e.contains(n))&&t(e)};this._listeners.set(t,n),window.addEventListener(e,n)}removeEventListener(e,t){let n=this._listeners.get(t);n&&window.removeEventListener(e,n),this._listeners.delete(t)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(e){this._scope.push(e)}destroy(){this._scope=[];for(let e of this._listeners.values())window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,e);this._listeners.clear()}},za=class{constructor(){this._scopedWindow=new Ra,this._destroyKeyUX=Ia(this._scopedWindow,[Ta(),Pa(`is-pressed`),ja(),Oa()])}registerBlock(e){this._scopedWindow.registerScope(e)}destroy(){this._destroyKeyUX?.(),this._scopedWindow.destroy()}}})),Va,Ha,Ua=n((()=>{br(),hn(),Sn(),Cn(),Va=e=>`*l10n/${e}`,Ha=class extends gr{constructor(e){super(e),this._localeName=``;for(let[e,t]of Object.entries(mn)){let n=this._ctx.has(Va(e))?!this._ctx.read(Va(e)):!0;this._ctx.add(Va(e),t,n)}let t=e.pluginManager;t?.onPluginsChange&&this.addSub(t.onPluginsChange(()=>{this._localeName&&this._applyPluginLocales(this._localeName)})),this.addSub(this._ctx.sub(E(`localeName`),async e=>{if(!e)return;this._localeName=e;let t=await xn(e);e!==`en`&&this._localeName!==e||(this._applyPluginLocales(e),this._applyOverrides(e,t))})),this.addSub(this._ctx.sub(E(`localeDefinitionOverride`),e=>{if(!e)return;let t=e[this._localeName];t&&this._applyOverrides(this._localeName,t)}))}_applyOverrides(e,t){let n=this._cfg.localeDefinitionOverride?.[e];for(let[e,r]of Object.entries(t)){let t=n?.[e];this._ctx.add(Va(e),t??r,!0)}}_applyPluginLocales(e){let t=this._sharedInstancesBag.pluginManager;if(!t)return;let n=t.snapshot();for(let t of n.i18n){let{pluginId:n,...r}=t,i=r[e];if(i)for(let[e,t]of Object.entries(i))t!==void 0&&this._ctx.add(Va(e),t,!0)}}}})),Wa,Ga=n((()=>{Wa=class{constructor(){this._definitions=new Map}register(e,t){if(this._definitions.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let n={attribute:!0,...t,pluginId:e};this._definitions.set(t.name,n)}unregister(e){this._definitions.delete(e)}unregisterByPlugin(e){for(let[t,n]of this._definitions)n.pluginId===e&&this._definitions.delete(t)}get(e){return this._definitions.get(e)}getAll(){return new Map(this._definitions)}}})),Ka,qa=n((()=>{br(),Ga(),Cn(),Ka=class extends gr{constructor(e){super(e),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 Wa,this.addSub(this._ctx.sub(E(`plugins`),e=>{this._pluginsUpdate=this._pluginsUpdate.then(()=>this._syncPlugins(e))}))}onPluginsChange(e){return this._subscribers.add(e),()=>{this._subscribers.delete(e)}}async _syncPlugins(e){let t=new Set(this._plugins.keys()),n=new Set;for(let r of e){if(n.has(r.id)){this._debugPrint(`Plugin "${r.id}" is already in the list, skipping duplicate`);continue}n.add(r.id);let e=this._plugins.get(r.id);if(!e||e.plugin!==r)try{await this._registerPlugin(r)}catch(e){this._purgeRegistrations(r.id),this._notifySubscribers(),this._debugPrint(`Plugin "${r.id}" setup failed`,e)}t.delete(r.id)}for(let e of t)this._unregisterPlugin(e)}async _registerPlugin(e){this._plugins.has(e.id)&&this._unregisterPlugin(e.id);let t={sources:[],activities:[],fileActions:[],fileHooks:[],icons:[],i18n:[]},n=[],r={registry:{registerSource:n=>this._register(this._sources,t.sources,e.id,n),registerActivity:n=>this._register(this._activities,t.activities,e.id,n),registerFileAction:n=>this._register(this._fileActions,t.fileActions,e.id,n),registerFileHook:n=>this._register(this._fileHooks,t.fileHooks,e.id,n),registerIcon:n=>this._register(this._icons,t.icons,e.id,n),registerI18n:n=>this._register(this._i18n,t.i18n,e.id,n),registerConfig:t=>{this.configRegistry.register(e.id,t)}},config:{get:e=>{let t=E(e);return this._ctx.read(t)},subscribe:(e,t)=>{let r=E(e),i=this._ctx.sub(r,e=>{t(e)});return n.push(i),i}},activity:{getParams:()=>this._ctx.read(`*currentActivityParams`),subscribeToParams:e=>{let t=this._ctx.sub(`*currentActivityParams`,t=>{e(t)});return n.push(t),t}},files:{update:(e,t)=>{let n=this._sharedInstancesBag.uploadCollection?.read(e);n&&(t.file!==void 0&&(n.setValue(`file`,t.file),n.setValue(`fileSize`,t.file.size)),t.cdnUrl!==void 0&&n.setValue(`cdnUrl`,t.cdnUrl),t.cdnUrlModifiers!==void 0&&n.setValue(`cdnUrlModifiers`,t.cdnUrlModifiers),t.mimeType!==void 0&&n.setValue(`mimeType`,t.mimeType))}}},i=this._sharedInstancesBag.api,a;try{a=await e.setup({pluginApi:r,uploaderApi:i})??void 0}catch(e){for(let e of n)try{e()}catch(e){this._debugPrint(`Failed to unsubscribe config listener`,e)}throw e}this._plugins.set(e.id,{plugin:e,exports:a,registrations:t,configSubscriptions:n}),this._notifySubscribers()}_unregisterPlugin(e){let t=this._plugins.get(e);if(t){this._purgeRegistrations(e);for(let e of t.configSubscriptions)try{e()}catch(e){this._debugPrint(`Failed to unsubscribe config listener`,e)}t.exports?.dispose?.(),this._plugins.delete(e),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 e of Array.from(this._plugins.keys()))this._unregisterPlugin(e);super.destroy()}_register(e,t,n,r){let i={...r,pluginId:n};return e.push(i),t.push(i),r}_purgeRegistrations(e){this._sources=this._sources.filter(t=>t.pluginId!==e),this._activities=this._activities.filter(t=>t.pluginId!==e),this._fileActions=this._fileActions.filter(t=>t.pluginId!==e),this._fileHooks=this._fileHooks.filter(t=>t.pluginId!==e),this._icons=this._icons.filter(t=>t.pluginId!==e),this._i18n=this._i18n.filter(t=>t.pluginId!==e),this.configRegistry.unregisterByPlugin(e)}_notifySubscribers(){for(let e of this._subscribers)try{e()}catch{}}}})),Ja=n((()=>{})),Ya=n((()=>{qa(),Ja()}));function Xa(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`).replace(/__/g,`_`)}function Za(e){return Array.isArray(e)?e.map(e=>typeof e==`object`&&e?Za(e):e):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=Xa(e);return typeof t==`object`&&t?[n,Za(t)]:[n,t]}))}function Qa(e){return{ok:!0,value:e}}function $a(e){return{ok:!1,error:e}}var eo,to,no,ro,io,ao=n((()=>{eo=`https://tlm.uploadcare.com/api/`,to=class{constructor(e=eo){this.baseUrl=e}async base(e,t={}){let n=`${this.baseUrl}${e}`;try{let e=await fetch(n,t);if(!e.ok)return $a(Error(`Got non-200 response from "${n}". Status: ${e.status.toString()}`));try{return Qa(await e.json())}catch(e){return $a(Error(`Error parsing JSON from "${n}". Error: ${e}`))}}catch(e){return $a(Error(`Error fetching data from "${n}". Error: ${e}`))}}async post(e,t,n={}){return await this.base(e,{...n,method:`POST`,body:JSON.stringify(Za(t)),headers:{"Content-Type":`application/json`,...n.headers||{}}})}async get(e,t={}){return await this.base(e,{method:`GET`,...t})}},no=async(e,t)=>({success:!0,data:t}),ro=async e=>no(void 0,e),io=class extends to{constructor(){super()}async sendEvent(e,t){let n=await ro(e);if(!n.success)throw console.error(`TelemetryAPIService: events: body is invalid`,n.error),Error(`TelemetryAPIService: events: body is invalid`);return this.post(`v1/events`,e,t)}}})),oo,M,N,so,P=n((()=>{br(),oo=20,M=Object.freeze({INIT_SOLUTION:`init-solution`,CHANGE_CONFIG:`change-config`,ACTION_EVENT:`action-event`,ERROR_EVENT:`error-event`}),N=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`}),so=class extends gr{constructor(...e){super(...e),this._timeoutStore=new Map,this._targets=new Set}bindTarget(e){return this._targets.add(e),()=>{this._targets.delete(e)}}_dispatch(e,t){for(let n of this._targets)n.dispatchEvent(new CustomEvent(e,{detail:t}));this._debugPrint?.(()=>{let n=t&&typeof t==`object`?{...t}:t;return[`event "${e}"`,n]})}emit(e,t,n={}){let{debounce:r}=n;if(typeof r!=`number`&&!r){this._dispatch(e,typeof t==`function`?t():t);return}this._timeoutStore.has(e)&&window.clearTimeout(this._timeoutStore.get(e));let i=typeof r==`number`?r:oo,a=window.setTimeout(()=>{try{let n=typeof t==`function`?t():t;this._dispatch(e,n),this._timeoutStore.delete(e)}catch(t){this._debugPrint?.(()=>`Error while getting payload for event "${e}"`,t)}},i);this._timeoutStore.set(e,a)}destroy(){for(let e of this._timeoutStore.values())window.clearTimeout(e);this._targets.clear()}}})),co,lo=n((()=>{co=`1.28.0-alpha.1`})),uo,fo,po=n((()=>{lo(),uo=`blocks`,fo=co})),mo,ho=n((()=>{ao(),ua(),pr(),P(),po(),br(),Cn(),mo=class extends gr{constructor(e){super(e),this._sessionId=cn.generateRandomUUID(),this._config=structuredClone(fr),this._initialized=!1,this._lastPayload=null,this._isEnabled=!1,this._telemetryInstance=new io,this._queue=new la(10),this.addSub(this._ctx.sub(E(`qualityInsights`),e=>{this._isEnabled=!!e}));for(let e of Object.keys(this._config))this.addSub(this._ctx.sub(E(e),t=>{this._isEnabled&&(this._initialized&&this._config[e]!==t&&this.sendEvent({eventType:M.CHANGE_CONFIG}),this._setConfig(e,t))}))}_init(e){e===M.INIT_SOLUTION&&!this._initialized&&(this._initialized=!0)}_setConfig(e,t){this._config[e]!==t&&(this._config[e]=t)}_formattingPayload(e){let t=e.payload?{...e.payload}:{};t.activity&&=void 0;let n={...e};return(e.eventType===M.INIT_SOLUTION||e.eventType===M.CHANGE_CONFIG)&&(n.config=this._config),{...n,appVersion:fo,appName:uo,sessionId:this._sessionId,component:this._solution,activity:this._activity,projectPubkey:this._config.pubkey,userAgent:navigator.userAgent,eventType:n.eventType??``,eventTimestamp:this._timestamp,payload:{location:this._location,...t}}}_excludedEvents(e){return!!(e&&[N.CHANGE,N.COMMON_UPLOAD_PROGRESS,N.FILE_ADDED,N.FILE_REMOVED,N.FILE_UPLOAD_START,N.FILE_UPLOAD_PROGRESS,N.FILE_UPLOAD_SUCCESS,N.FILE_UPLOAD_FAILED].includes(e))}sendEvent(e){if(!this._isEnabled)return;let t=this._formattingPayload({eventType:e.eventType,payload:e.payload,config:e.config});this._init(e.eventType),!this._excludedEvents(e.eventType)&&(this._lastPayload&&this._checkObj(this._lastPayload,t)||this._queue.add(async()=>{this._lastPayload=t,await this._telemetryInstance.sendEvent(t)}))}sendEventError(e,t=`unknown`){this.sendEvent({eventType:M.ERROR_EVENT,payload:{metadata:{event:`error`,text:`Error in ${t}`,error:e.message}}})}sendEventCloudImageEditor(e,t,n={}){this.sendEvent({eventType:M.ACTION_EVENT,payload:{metadata:{tabId:t,node:e.currentTarget?.tagName,event:e.type,...n}}})}_checkObj(e,t){if(JSON.stringify(e)===JSON.stringify(t))return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!this._checkObj(e[r],t[r]))return!1;return!0}get _timestamp(){return Date.now()}get _solution(){if(!this._ctx.has(`*solution`))return null;let e=this._ctx.read(`*solution`);return e?e.toLowerCase():null}get _activity(){return this._ctx.has(`*currentActivity`)?this._ctx.read(`*currentActivity`):null}get _location(){return location.origin}}})),go,_o=n((()=>{go=e=>{let t=new Intl.Locale(e),n=`ltr`,r=t.getTextInfo?.().direction;return r?n=r:t.textInfo?.direction&&(n=t.textInfo.direction),n}}));function vo(e,t={},n={}){let{openToken:r=xo,closeToken:i=So,transform:a=bo}=n;for(let n in t){let o=t[n]?.toString(),s=typeof o==`string`?a(o):String(o);e=e.replaceAll(r+n+i,s)}return e}function yo(e){let t=[],n=e.indexOf(xo);for(;n!==-1;){let r=e.indexOf(So,n);if(r===-1)break;let i=e.substring(n+2,r);if(i.startsWith(Co)){let a=e.substring(n+2,r).replace(Co,``),o=a.substring(0,a.indexOf(`(`)),s=a.substring(a.indexOf(`(`)+1,a.indexOf(`)`));t.push({variable:i,pluralKey:o,countVariable:s})}n=e.indexOf(xo,r)}return t}var bo,xo,So,Co,wo=n((()=>{bo=e=>e,xo=`{{`,So=`}}`,Co=`plural:`})),To,Eo,Do=n((()=>{nn(),To=`--uploadcare-blocks-window-height`,Eo=class e{static{this.clientsRegistry=new Set}static{this.flush=C(()=>{document.documentElement.style.setProperty(To,`${window.innerHeight}px`)},100)}static registerClient(t){e.clientsRegistry.size===0&&e.attachTracker(),e.clientsRegistry.add(t)}static unregisterClient(t){e.clientsRegistry.delete(t),e.clientsRegistry.size===0&&e.detachTracker()}static attachTracker(){window.addEventListener(`resize`,e.flush,{passive:!0,capture:!0}),e.flush()}static detachTracker(){window.removeEventListener(`resize`,e.flush,{capture:!0}),document.documentElement.style.removeProperty(To)}}})),Oo,ko=n((()=>{Oo=(e,t)=>new Intl.PluralRules(e).select(t)})),Ao,jo,Mo=n((()=>{Ua(),ko(),wo(),Ao=e=>(t,n)=>{let r=e();return r(`${t}__${Oo(r(`locale-id`)||`en`,n)}`)},jo=e=>{let t=Ao(()=>n),n=(n,r={})=>{if(!n)return``;let i=e().read(Va(n))||n,a=yo(i);for(let e of a)r[e.variable]=t(e.pluralKey,Number(r[e.countVariable]));return vo(i,r)};return n}})),No,Po,Fo=n((()=>{Cn(),No=e=>e.tagName?.includes(`-`)??!1,Po=class{constructor(e){this._trackedElements=new Set,this._originalValues=new Map,this._enabled=!1,this._host=e,this._host.addController(this)}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0,this._trackedElements.clear(),this._originalValues.clear()}hostUpdated(){!this._unsubscribe&&this._host.has(E(`testMode`))&&(this._unsubscribe=this._host.subConfigValue(`testMode`,e=>{this._enabled=!!e,this._applyTestMode()})),this._collectElements(),this._applyTestMode()}_collectElements(){let e=this._host,t=e.renderRoot??e;if(!t)return;let n=this._host,r=n.tagName?.toLowerCase(),i=Array.from(t.querySelectorAll(`[data-testid]`)).filter(e=>!No(e));for(let e of i)if(!(r&&e.closest(r)!==n)&&!this._trackedElements.has(e)){let t=e.getAttribute(`data-testid`);if(!t)continue;this._trackedElements.add(e),this._originalValues.set(e,t)}for(let e of Array.from(this._trackedElements))(!e.isConnected||r&&e.closest(r)!==n)&&(this._trackedElements.delete(e),this._originalValues.delete(e))}_applyTestMode(){if(!this._trackedElements.size)return;let e=this._host.testId||``;for(let t of this._trackedElements){let n=this._originalValues.get(t);n&&(this._enabled?t.setAttribute(`data-testid`,`${e}--${n}`):t.removeAttribute(`data-testid`))}}}})),Io,F,I=n((()=>{y(),ha(),va(),Ba(),Ua(),Sr(),Ya(),ho(),Cn(),pr(),P(),ne(),zn(),_o(),wo(),Do(),Ot(),hr(),At(),Mo(),Mt(),on(),br(),Fo(),Io=jt(rn()(Dt(kt(ht)))),F=class extends Io{static{this.styleAttrs=[]}constructor(){super(),this.activityType=null,this.init$=da(),this.l10n=jo(()=>this.sharedCtx),this.debugPrint=mr(()=>this.sharedCtx,this.constructor.name),this._sharedInstancesBag=yr(()=>this.sharedCtx),new Po(this)}emit(e,t,n){let r=this.has(`*eventEmitter`)?this.$[`*eventEmitter`]:void 0;if(!r)return;r.emit(e,t,n);let i=typeof t==`function`?t():t;this.telemetryManager.sendEvent({eventType:e,payload:i??void 0})}hasBlockInCtx(e){for(let t of this.blocksRegistry)if(e(t))return!0;return!1}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,``)}),super.connectedCallback(),Eo.registerClient(this)}initCallback(){this._addSharedContextInstance(`*blocksRegistry`,()=>new Set),this._addSharedContextInstance(`*pluginManager`,e=>new Ka(e)),this._addSharedContextInstance(`*eventEmitter`,e=>new so(e)),this._addSharedContextInstance(`*localeManager`,e=>new Ha(e)),this._addSharedContextInstance(`*modalManager`,e=>new xr(e)),this._addSharedContextInstance(`*a11y`,()=>new za),this._addSharedContextInstance(`*clipboard`,e=>new _a(e)),this._addSharedContextInstance(`*telemetryManager`,e=>new mo(e)),this.sub(Va(`locale-id`),e=>{let t=go(e);this.style.direction=t===`ltr`?``:t,this.requestUpdate()}),this.subConfigValue(`testMode`,e=>{if(!e||!this.testId){this.removeAttribute(`data-testid`);return}this.setAttribute(`data-testid`,this.testId)}),this.blocksRegistry.add(this)}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this._getSharedContextInstance(`*modalManager`,!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(),Eo.unregisterClient(this);let e=this.blocksRegistry;e?.delete(this),e?.size===0&&setTimeout(()=>{this.isConnected||e?.size>0||this.destroyCtxCallback()},0)}destroyCtxCallback(){this._destroySharedContextInstances(),g.deleteCtx(this.ctxName)}_getSharedContextInstances(){let e=`*sharedContextInstances`;if(!this.has(e)||!this.$[e]){let t=new Map;this.add(e,t,!0)}return this.$[e]}_addSharedContextInstance(e,t){let n=this._getSharedContextInstances();if(!n.has(e)&&(!this.has(e)||!this.$[e])){let r=t(this._sharedInstancesBag);this.add(e,r,!0),n.set(e,r);return}}_destroySharedContextInstances(){let e=this._getSharedContextInstances();for(let[t,n]of e.entries())n?.destroy?.(),this.pub(t,null);e.clear()}_getSharedContextInstance(e,t=!0){if(this.has(e)&&this.$[e]||!t)return this.$[e];throw Error(`Unexpected error: context manager for key "${String(e)}" is not available`)}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn(`Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used.`),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:On(e),cdnUrlModifiers:kn(e),fileName:Dn(e)})}catch(t){return console.error(`Failed to resolve secure delivery proxy URL. Falling back to the default URL.`,t),this.telemetryManager.sendEventError(t,`secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL.`),e}return this.cfg.secureDeliveryProxy?vo(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:e=>window.encodeURIComponent(e)}):e}get cfg(){return this._cfgProxy||=new Proxy({},{set:(e,t,n)=>{if(typeof t!=`string`||!(t in fr))return!1;let r=t,i=E(r);return this.has(i)||this.add(i,fr[r]),this.$[i]=n,!0},get:(e,t)=>{let n=E(t);return this.has(n)||this.add(n,fr[t]),this.$[n]}}),this._cfgProxy}subConfigValue(e,t){let n=E(e);return this.has(n)||this.add(n,fr[e]),this.sub(n,t)}}})),Lo,Ro,zo,Bo=n((()=>{Lo={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ro=e=>(...t)=>({_$litDirective$:e,values:t}),zo=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}})),Vo,Ho=n((()=>{pt(),Bo(),Vo=class extends zo{constructor(e){if(super(e),this.it=v,e.type!==Lo.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(e){if(e===v||e==null)return this._t=void 0,this.it=e;if(e===Qe)return e;if(typeof e!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}},Vo.directiveName=`unsafeHTML`,Vo.resultType=1,Ro(Vo)})),Uo,Wo,Go=n((()=>{Bo(),Ho(),Uo=class extends Vo{},Uo.directiveName=`unsafeSVG`,Uo.resultType=2,Wo=Ro(Uo)})),Ko=n((()=>{Go()}));Ko(),I(),wr();var qo=`<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>`;y(),ha();var Jo=class extends F{constructor(...e){super(...e),this.init$=ma(this)}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 _`${Wo(qo)}`}},Yo,Xo,Zo=n((()=>{Yo=e=>typeof e==`number`?Math.floor(e/1e3):0,Xo=(e,{threshold:t})=>{let{secureExpire:n}=e,r=Yo(Date.now()),i=Number(n);return r+Yo(t)>=i}})),Qo,$o=n((()=>{br(),Zo(),Qo=class extends gr{constructor(...e){super(...e),this._secureToken=null}async getSecureToken(){let{secureSignature:e,secureExpire:t,secureUploadsSignatureResolver:n,secureUploadsExpireThreshold:r}=this._cfg;if((e||t)&&n&&console.warn(`Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used.`),n){if(!this._secureToken||Xo(this._secureToken,{threshold:r})){this._secureToken?this._debugPrint(`Secure signature is expired. Resolving a new one...`):this._debugPrint(`Secure signature is not set yet.`);try{let e=await n();e?!e.secureSignature||!e.secureExpire?console.error(`Secure signature resolver returned an invalid result:`,e):(this._debugPrint(`Secure signature resolved:`,e),this._debugPrint(`Secure signature will expire in`,new Date(Number(e.secureExpire)*1e3).toISOString()),this._secureToken=e):(this._debugPrint(`Secure signature resolver returned nothing.`),this._secureToken=null)}catch(e){console.error(`Secure signature resolving failed. Falling back to the previous one.`,e),this._sharedInstancesBag.telemetryManager.sendEventError(e,`secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.`)}}return this._secureToken}return e&&t?(this._debugPrint(`Secure signature and expire are set. Using them...`,{secureSignature:e,secureExpire:t}),{secureSignature:e,secureExpire:t}):null}destroy(){super.destroy(),this._secureToken=null}}})),es,ts=n((()=>{es=(e,t)=>{if(e.failedCount>0)return{type:`SOME_FILES_HAS_ERRORS`,message:t.l10n(`some-files-were-not-uploaded`)}}})),ns,rs=n((()=>{ns=(e,t)=>{let n=e.totalCount,r=t.cfg.multiple?t.cfg.multipleMin:0,i=t.cfg.multiple?t.cfg.multipleMax:1;if(r&&n<r)return{type:`TOO_FEW_FILES`,message:t.l10n(`files-count-limit-error-too-few`,{min:r,max:i,total:n}),payload:{total:n,min:r,max:i}};if(i&&n>i)return{type:`TOO_MANY_FILES`,message:t.l10n(`files-count-limit-error-too-many`,{min:r,max:i,total:n}),payload:{total:n,min:r,max:i}}}})),is=n((()=>{ts(),rs()})),as,os,ss,cs,ls,us,ds=n((()=>{as=()=>{let e=navigator.userAgent;return/Macintosh|Windows/.test(e)&&/Version\/[\d.]+.*Safari/.test(e)&&!/Chrome|Chromium|Edg|OPR/.test(e)},os=()=>`capture`in document.createElement(`input`),ss=()=>({safariDesktop:as()}),cs=()=>({htmlMediaCapture:os()}),ls=ss(),us=cs()})),fs,ps,ms,hs,gs,_s,vs,ys,bs,xs=n((()=>{ds(),Vn(),fs=`image/*`,ps=`video/*`,ms=[`image/heif`,`image/heif-sequence`,`image/heic`,`image/heic-sequence`,`image/avif`,`image/avif-sequence`,`.heif`,`.heifs`,`.heic`,`.heics`,`.avif`,`.avifs`],hs=()=>ls.safariDesktop?[fs]:[fs,...ms],gs=hs(),_s=e=>e?e.filter(e=>typeof e==`string`).flatMap(e=>Bn(e)):[],vs=(e,t)=>t.some(t=>{if(t.endsWith(`*`)){let n=t.replace(`*`,``);return e.startsWith(n)}return e===t}),ys=(e,t)=>t.some(t=>t.startsWith(`.`)?e.toLowerCase().endsWith(t.toLowerCase()):!1),bs=e=>{let t=e?.type;return t?vs(t,gs):!1}})),Ss,Cs=n((()=>{xs(),Ss=(e,t)=>{let n=t.cfg.imgOnly,r=t.cfg.accept,i=_s([...n?gs:[],r]);if(!i.length)return;let a=e.mimeType,o=e.name;if(!a||!o)return;let s=vs(a,i),c=ys(o,i);if(!s&&!c)return{type:`FORBIDDEN_FILE_TYPE`,message:t.l10n(`file-type-not-allowed`),payload:{entry:e}}}})),ws,Ts=n((()=>{ws=(e,t)=>{let n=t.cfg.imgOnly,r=e.isImage;if(!(!n||r)&&!(!e.fileInfo&&e.externalUrl)&&!(!e.fileInfo&&!e.mimeType))return{type:`NOT_AN_IMAGE`,message:t.l10n(`images-only-accepted`),payload:{entry:e}}}})),Es,Ds,Os,ks,As=n((()=>{ko(),Es=1e3,Ds=Object.freeze({AUTO:`auto`,BYTE:`byte`,KB:`kb`,MB:`mb`,GB:`gb`,TB:`tb`,PB:`pb`}),Os=e=>Math.ceil(e*100)/100,ks=(e,t=Ds.AUTO)=>{let n=t===Ds.AUTO;return t===Ds.BYTE||n&&e<Es**1?`${e} ${Oo(`en-US`,e)===`one`?`byte`:`bytes`}`:t===Ds.KB||n&&e<Es**2?`${Os(e/Es**1)} KB`:t===Ds.MB||n&&e<Es**3?`${Os(e/Es**2)} MB`:t===Ds.GB||n&&e<Es**4?`${Os(e/Es**3)} GB`:t===Ds.TB||n&&e<Es**5?`${Os(e/Es**4)} TB`:`${Os(e/Es**5)} PB`}})),js,Ms=n((()=>{As(),js=(e,t)=>{let n=t.cfg.maxLocalFileSizeBytes,r=e.size;if(n&&r&&r>n)return{type:`FILE_SIZE_EXCEEDED`,message:t.l10n(`files-max-size-limit-error`,{maxFileSize:ks(n)}),payload:{entry:e}}}})),Ns,Ps=n((()=>{ua(),Ns=(e,t)=>{let{internalId:n}=e;if(!t._uploadCollection.hasItem(n))return;let r=t._uploadCollection.read(n)?.getValue(`uploadError`);if(!r)return;if(r instanceof xi)return{type:`UPLOAD_ERROR`,message:r.message,payload:{entry:e,error:r}};if(r instanceof ni)return{type:`NETWORK_ERROR`,message:r.message,payload:{entry:e,error:r}};let i=r instanceof Error?r:Error(`Unknown error`,{cause:r});return{type:`UNKNOWN_ERROR`,message:i.message,payload:{entry:e,error:i}}}})),Fs=n((()=>{Cs(),Ts(),Ms(),Ps()})),Is,Ls,Rs,zs=n((()=>{ua(),P(),br(),nn(),is(),Fs(),Cn(),Is={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.`},Ls=e=>typeof e==`function`?{runOn:`change`,validator:e}:e,Rs=class extends gr{get _uploadCollection(){return this._sharedInstancesBag.uploadCollection}constructor(e){super(e),this._commonFileValidators=[ws,Ss,js,Ns],this._commonCollectionValidators=[ns,es],this._queue=new la(20),this._runQueueDebounced=C(()=>{this._queue.run()},500),this._isDestroyed=!1,this._entryValidationState=new Map;let t=C(()=>{this.runFileValidators(`change`),this.runCollectionValidators()},0);this.addSub(this._ctx.sub(E(`maxLocalFileSizeBytes`),t)),this.addSub(this._ctx.sub(E(`multipleMin`),t)),this.addSub(this._ctx.sub(E(`multipleMax`),t)),this.addSub(this._ctx.sub(E(`multiple`),t)),this.addSub(this._ctx.sub(E(`imgOnly`),t)),this.addSub(this._ctx.sub(E(`accept`),t)),this.addSub(this._ctx.sub(E(`validationConcurrency`),e=>{this._queue.concurrency=e}))}runFileValidators(e,t){if(this._isDestroyed)return;let n=t??this._uploadCollection.items();for(let t of n){let n=this._uploadCollection.read(t);n&&this._runFileValidatorsForEntry(n,e)}}runCollectionValidators(){if(this._isDestroyed)return;let e=this._sharedInstancesBag.api,t=e.getOutputCollectionState(),n=[],r=this._cfg.collectionValidators;for(let i of[...this._commonCollectionValidators,...r])try{let r=i(t,e);if(!r)continue;r&&(n.push(this._addCustomTypeToValidationError(r)),r.message||console.warn(Is.MISSING_ERROR_MESSAGE))}catch(e){console.warn(Is.COLLECTION_VALIDATION_FAILED,e)}this._ctx.pub(`*collectionErrors`,n),n.length>0&&this._sharedInstancesBag.eventEmitter.emit(N.COMMON_UPLOAD_FAILED,()=>e.getOutputCollectionState(),{debounce:!0})}cleanupValidationForEntry(e){let t=this._entryValidationState.get(e.uid);t&&(t.abortController?.abort(),this._entryValidationState.delete(e.uid))}async _runFileValidatorsForEntry(e,t){if(this._isDestroyed)return;let n=this._sharedInstancesBag.api,r=this._getEntryValidationState(e),i=r.promise??Promise.resolve(),a=(async()=>{if(this._isDestroyed||(await i,this._isDestroyed))return;let a=this._getValidatorDescriptorsForEntry(e,t);if(a.length===0||!this._uploadCollection.hasItem(e.uid))return;e.setMultipleValues({isQueuedForValidation:!0,isValidationPending:!0});let o=n.getOutputItem(e.uid),s=new AbortController;r.abortController=s;let c=this._cfg.validationTimeout,l=this._getValidatorDescriptors(),u=new Set(a.map(e=>e.validator)),d=[];for(let e of l)if(!u.has(e.validator)){let t=r.lastErrorThrownByValidator.get(e.validator);t&&d.push(t)}let f=a.map(e=>async()=>{if(this._isDestroyed)return;let t=setTimeout(()=>{r.skippedValidators.add(e.validator),s.abort(),console.warn(Is.FILE_VALIDATION_TIMEOUT)},c);try{let t=await e.validator(o,n,{signal:s.signal});if(!t||s.signal.aborted){r.lastErrorThrownByValidator.set(e.validator,void 0);return}let i=this._addCustomTypeToValidationError(t);r.lastErrorThrownByValidator.set(e.validator,i),d.push(i),t.message||console.warn(Is.MISSING_ERROR_MESSAGE)}catch(t){s.signal.aborted||(r.skippedValidators.add(e.validator),console.warn(Is.FILE_VALIDATION_FAILED,t),this._sharedInstancesBag.telemetryManager.sendEventError(t,`file validator. ${Is.FILE_VALIDATION_FAILED}`))}finally{clearTimeout(t),e.runOn!==`change`&&r.skippedValidators.add(e.validator)}});if(this._runQueueDebounced(),await this._queue.add(async()=>{this._isDestroyed||(e.setValue(`isQueuedForValidation`,!1),await Promise.all(f.map(e=>e())).catch(()=>{}))},{autoRun:!1}),s.signal.aborted){e.setMultipleValues({isQueuedForValidation:!1,isValidationPending:!1});return}e.setMultipleValues({isValidationPending:!1,isQueuedForValidation:!1,errors:d})})();r.promise=a;try{await a}finally{r.promise===a&&(r.promise=void 0)}}_addCustomTypeToValidationError(e){return{...e,type:e.type??`CUSTOM_ERROR`}}_getEntryValidationState(e){let t=this._entryValidationState.get(e.uid);if(t)return t;let n={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this._entryValidationState.set(e.uid,n),n}_getValidatorDescriptors(){let e=this._cfg.fileValidators;return[...this._commonFileValidators,...e].map(Ls)}_getValidatorDescriptorsForEntry(e,t){let n=this._getEntryValidationState(e);return this._getValidatorDescriptors().filter(e=>!n.skippedValidators.has(e.validator)).filter(e=>e.runOn===t)}destroy(){this._isDestroyed=!0,this._runQueueDebounced.cancel();for(let e of this._entryValidationState.values())e.abortController?.abort(),e.promise=void 0;this._entryValidationState.clear()}}})),Bs,Vs,Hs=n((()=>{ne(),ln(),Bs=`[Typed State] Wrong property name: `,Vs=class{constructor(e){this._ctxId=cn.generateFastUid(),this._data=g.registerCtx(e,this._ctxId)}get uid(){return this._ctxId}setValue(e,t){if(!this._data.has(e)){console.warn(`${Bs}${String(e)}`);return}this._data.read(e)!==t&&this._data.pub(e,t)}setMultipleValues(e){for(let[t,n]of Object.entries(e))this.setValue(t,n)}getValue(e){return this._data.has(e)||console.warn(`${Bs}${String(e)}`),this._data.read(e)}subscribe(e,t){return this._data.sub(e,t)}destroy(){g.deleteCtx(this._ctxId)}}})),Us,Ws=n((()=>{ne(),ln(),Hs(),Us=class e{static{this._destroyDelayMs=1e4}constructor(e){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=e.initialValue,this._ctxId=cn.generateFastUid(),this._data=g.registerCtx({},this._ctxId),this._watchList=e.watchList||[];let t=Object.create(null);this._notifyObservers=(e,n)=>{this._observeTimeout&&window.clearTimeout(this._observeTimeout),t[e]||(t[e]=new Set),t[e].add(n),this._observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this._propertyObservers.forEach(e=>{e({...t})}),t=Object.create(null))}),this._scheduleDestroyMarkedItems()},e.handler&&this.observeCollection(e.handler)}_notify(){this._notifyTimeout&&window.clearTimeout(this._notifyTimeout),this._notifyTimeout=window.setTimeout(()=>{let e=new Set(this._added),t=new Set(this._removed);this._added.clear(),this._removed.clear();for(let n of this._collectionObservers)n?.([...this._items],e,t);this._scheduleDestroyMarkedItems()})}_scheduleDestroyMarkedItems(){this._markedToDestroy.size!==0&&(this._destroyTimeout&&window.clearTimeout(this._destroyTimeout),this._destroyTimeout=window.setTimeout(()=>{let e=[...this._markedToDestroy];this._markedToDestroy.clear();for(let t of e)t.destroy()},e._destroyDelayMs))}observeCollection(e){return this._collectionObservers.add(e),this._items.size>0&&this._notify(),()=>{this.unobserveCollection(e)}}unobserveCollection(e){this._collectionObservers.delete(e)}add(e){let t=new Vs(this._initialValue);for(let[n,r]of Object.entries(e))t.setValue(n,r);return this._items.add(t.uid),this._notify(),this._data.add(t.uid,t),this._added.add(t),this._watchList.forEach(e=>{this._subsMap[t.uid]||(this._subsMap[t.uid]=[]),this._subsMap[t.uid]?.push(t.subscribe(e,()=>{this._notifyObservers(e,t.uid)}))}),t.uid}hasItem(e){return this._items.has(e)}read(e){return this._data.read(e)??null}readProp(e,t){let n=this.read(e);if(!n)throw Error(`TypedCollection#readProp: Item with id ${e} not found`);return n.getValue(t)}publishProp(e,t,n){let r=this.read(e);if(!r)throw Error(`TypedCollection#publishProp: Item with id ${e} not found`);r.setValue(t,n)}remove(e){let t=this.read(e);t&&(this._removed.add(t),this._markedToDestroy.add(t)),this._items.delete(e),this._notify(),this._data.pub(e,void 0),this._subsMap[e]?.forEach(e=>{e()}),delete this._subsMap[e]}clearAll(){this._items.forEach(e=>{this.remove(e)})}observeProperties(e){return this._propertyObservers.add(e),()=>{this.unobserveProperties(e)}}unobserveProperties(e){this._propertyObservers.delete(e)}findItems(e){let t=[];return this._items.forEach(n=>{let r=this.read(n);r&&e(r)&&t.push(n)}),t}items(){return[...this._items]}get size(){return this._items.size}destroy(){this._observeTimeout&&window.clearTimeout(this._observeTimeout),this._notifyTimeout&&window.clearTimeout(this._notifyTimeout),this._destroyTimeout&&window.clearTimeout(this._destroyTimeout);for(let e of this._markedToDestroy)e.destroy();this._markedToDestroy.clear(),g.deleteCtx(this._ctxId),this._propertyObservers=new Set,this._collectionObservers=new Set;for(let e of Object.keys(this._subsMap))this._subsMap[e]?.forEach(e=>{e()}),delete this._subsMap[e]}}})),L,Gs,Ks=n((()=>{L=Object.freeze({PHOTO:`photo`,VIDEO:`video`}),Gs=Object.freeze({IDLE:`idle`,SHOT:`shot`,PLAY:`play`,PAUSE:`pause`,RESUME:`resume`,STOP:`stop`,RETAKE:`retake`,ACCEPT:`accept`})})),qs,Js=n((()=>{En(),Ks(),qs=e=>({isVideoRecordingEnabled:wn(e.cameraModes).includes(L.VIDEO),isPhotoEnabled:wn(e.cameraModes).includes(L.PHOTO)})})),Ys,Xs=n((()=>{Ys=(e,t)=>{for(let n of e)if(t(n))return n}})),Zs,Qs=n((()=>{Zs=(e,t)=>{for(let n of e)if(t(n))return!0;return!1}}));function $s(e,t){for(let n in t)n.includes(`-`)?e.style.setProperty(n,String(t[n])):e.style[n]=String(t[n])}var ec=n((()=>{})),tc,nc,rc=n((()=>{pr(),tc=RegExp(`^/?([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,`i`),nc=({url:e,cdnBase:t})=>{let n=new URL(t),r=new URL(sr),i=new URL(e);if(n.host!==i.host&&r.host!==i.host)return null;let a=tc.exec(i.pathname);if(!a)return null;let[,o,s,c]=a;return o?{uuid:o,cdnUrlModifiers:s||``,filename:c||null}:null}})),ic,ac,R,oc=n((()=>{ic=Object.freeze({FACEBOOK:`facebook`,DROPBOX:`dropbox`,GDRIVE:`gdrive`,GPHOTOS:`gphotos`,FLICKR:`flickr`,VK:`vk`,EVERNOTE:`evernote`,BOX:`box`,ONEDRIVE:`onedrive`,HUDDLE:`huddle`}),ac=Object.freeze({MOBILE_VIDEO_CAMERA:`mobile-video-camera`,MOBILE_PHOTO_CAMERA:`mobile-photo-camera`}),R=Object.freeze({LOCAL:`local`,DROP_AREA:`drop-area`,CAMERA:`camera`,EXTERNAL:`external`,API:`js-api`,URL:`url`,...ac,...ic})})),sc,cc=n((()=>{sc=e=>e.uploadCollection.items().map(t=>e.api.getOutputItem(t))}));function lc(e){let t=new Map;return(...n)=>{let r=JSON.stringify(n);if(t.has(r))return t.get(r);let i=e(...n);return t.set(r,i),i}}var uc=n((()=>{}));function dc(e){fc.has(e)||(fc.add(e),console.warn(e))}var fc,pc=n((()=>{fc=new Set}));function mc(e){let t=!1;return setTimeout(()=>{t=!0},0),n=>((...r)=>(t&&dc(e),n(...r)))}function hc(e){let t={},n=e.ctx,r={progress:()=>n.read(`*commonProgress`),errors:()=>n.read(`*collectionErrors`),group:()=>n.read(`*groupInfo`),totalCount:()=>e.uploadCollection.size,failedCount:()=>t.failedEntries.length,successCount:()=>t.successEntries.length,uploadingCount:()=>t.uploadingEntries.length,status:()=>t.isFailed?`failed`:t.isUploading?`uploading`:t.isSuccess?`success`:`idle`,isSuccess:()=>t.allEntries.length>0&&t.errors.length===0&&t.successEntries.length===t.allEntries.length,isUploading:()=>t.allEntries.some(e=>e.status===`uploading`),isFailed:()=>t.errors.length>0||t.failedEntries.length>0,allEntries:()=>sc(e),successEntries:()=>t.allEntries.filter(e=>e.status===`success`),failedEntries:()=>t.allEntries.filter(e=>e.status===`failed`),uploadingEntries:()=>t.allEntries.filter(e=>e.status===`uploading`),idleEntries:()=>t.allEntries.filter(e=>e.status===`idle`)},i=mc("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[e,n]of Object.entries(r)){let r=e,a=lc(i(n));Object.defineProperty(t,r,{get:a,enumerable:!0})}return t}var gc=n((()=>{cc(),uc(),pc()})),_c,vc=n((()=>{Js(),Ks(),P(),ga(),Xs(),Qs(),Mo(),ne(),br(),ec(),ds(),En(),xs(),rc(),Vn(),oc(),gc(),_c=class extends gr{constructor(...e){super(...e),this._l10n=jo(()=>this._ctx),this.addFileFromUrl=(e,{silent:t,fileName:n,source:r}={})=>{let i=this._uploadCollection.add({externalUrl:e,fileName:n??null,silent:t??!1,source:r??R.API});return this.getOutputItem(i)},this.addFileFromUuid=(e,{silent:t,fileName:n,source:r}={})=>{let i=this._uploadCollection.add({uuid:e,fileName:n??null,silent:t??!1,source:r??R.API});return this.getOutputItem(i)},this.addFileFromCdnUrl=(e,{silent:t,fileName:n,source:r}={})=>{let i=nc({url:e,cdnBase:this.cfg.cdnCname});if(!i)throw Error(`Invalid CDN URL`);let a=this._uploadCollection.add({uuid:i.uuid,cdnUrl:e,cdnUrlModifiers:i.cdnUrlModifiers,fileName:n??i.filename??null,silent:t??!1,source:r??R.API});return this.getOutputItem(a)},this.addFileFromObject=(e,{silent:t,fileName:n,source:r,fullPath:i}={})=>{let a=this._uploadCollection.add({file:e,isImage:bs(e),mimeType:e.type,fileName:n??e.name,fileSize:e.size,silent:t??!1,source:r??R.API,fullPath:i??null});return this.getOutputItem(a)},this.removeFileByInternalId=e=>{if(!this._uploadCollection.read(e))throw Error(`File with internalId ${e} not found`);this._uploadCollection.remove(e)},this.uploadAll=()=>{let e=this._uploadCollection.items().filter(e=>{let t=this._uploadCollection.read(e);return t?!t.getValue(`isRemoved`)&&!t.getValue(`isUploading`)&&!t.getValue(`fileInfo`)&&t.getValue(`errors`).length===0&&!t.getValue(`isValidationPending`)&&!t.getValue(`isQueuedForValidation`):!1});e.length!==0&&(this._ctx.pub(`*uploadTrigger`,new Set(e)),this._sharedInstancesBag.eventEmitter.emit(N.COMMON_UPLOAD_START,this.getOutputCollectionState()))},this.openSystemDialog=(e={})=>{let t=Tn(_s([this.cfg.accept??``,...this.cfg.imgOnly?gs:[]])),n=`uploadcare-file-input`,r=document.createElement(`input`);if(r.setAttribute(n,``),$s(r,{opacity:0,height:0,width:0,visibility:`hidden`,position:`absolute`,top:0,left:0}),r.type=`file`,r.multiple=this.cfg.multiple,e.captureCamera){r.capture=this.cfg.cameraCapture;let{isPhotoEnabled:t,isVideoRecordingEnabled:n}=qs(this.cfg);e.modeCamera===L.PHOTO&&t?r.accept=fs:e.modeCamera===L.VIDEO&&n?r.accept=ps:r.accept=[fs,n&&`video/*`].filter(Boolean).join(`,`)}else r.accept=t;r.addEventListener(`change`,()=>{r.files&&([...r.files].forEach(t=>{this.addFileFromObject(t,{source:e.captureCamera?R.CAMERA:R.LOCAL})}),this._ctx.pub(`*currentActivity`,j.UPLOAD_LIST),this._sharedInstancesBag.modalManager?.open(j.UPLOAD_LIST),r.remove())},{once:!0}),document.querySelectorAll(`[${n}]`).forEach(e=>{e.remove()}),document.body.appendChild(r),r.dispatchEvent(new MouseEvent(`click`))},this.initFlow=(e=!1)=>{if(this._uploadCollection.size>0&&!e)this._ctx.pub(`*currentActivity`,j.UPLOAD_LIST),this._sharedInstancesBag.modalManager?.open(j.UPLOAD_LIST);else if(this._sourceList?.length===1){let e=this._sourceList[0];if(e===`local`){this._ctx.pub(`*currentActivity`,j.UPLOAD_LIST),this.openSystemDialog();return}if(e===`camera`&&us.htmlMediaCapture){let{isPhotoEnabled:e,isVideoRecordingEnabled:t}=qs(this.cfg);if(e&&t){this._ctx.pub(`*currentActivity`,j.START_FROM);return}else if(e||t){this.openSystemDialog({captureCamera:!0,modeCamera:e?L.PHOTO:L.VIDEO});return}else this.openSystemDialog({captureCamera:!0,modeCamera:L.PHOTO})}setTimeout(()=>{if(e!==this._sourceList[0])return;let t=this._sharedInstancesBag.blocksRegistry;Ys(t,t=>`type`in t&&t.type===e)?.activate()},0),this._ctx.read(`*currentActivity`)&&this._sharedInstancesBag.modalManager?.open(this._ctx.read(`*currentActivity`))}else this._ctx.pub(`*currentActivity`,j.START_FROM),this._sharedInstancesBag.modalManager?.open(j.START_FROM)},this.doneFlow=()=>{let e=Ys(this._sharedInstancesBag.blocksRegistry,e=>`doneActivity`in e);e&&(this._ctx.pub(`*currentActivity`,e.doneActivity),this._ctx.pub(`*history`,e.doneActivity?[e.doneActivity]:[]),this._ctx.read(`*currentActivity`)||this._sharedInstancesBag.modalManager?.closeAll())},this.setCurrentActivity=(e,...t)=>{setTimeout(()=>{if(Zs(this._sharedInstancesBag.blocksRegistry,t=>t.activityType===e)){this._ctx.pub(`*currentActivityParams`,t[0]??{}),this._ctx.pub(`*currentActivity`,e);return}console.warn(`Activity type "${e}" not found in the context`)})},this.getCurrentActivity=()=>this._ctx.read(`*currentActivity`),this.setModalState=e=>{setTimeout(()=>{if(e&&!this._ctx.read(`*currentActivity`)){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}e?this._sharedInstancesBag.modalManager?.open(this._ctx.read(`*currentActivity`)):(this._sharedInstancesBag.modalManager?.close(this._ctx.read(`*currentActivity`)),this._ctx.pub(`*currentActivity`,null))})}}get _uploadCollection(){return this._sharedInstancesBag.uploadCollection}get cfg(){return this._cfg}get l10n(){return this._l10n}removeAllFiles(){this._uploadCollection.clearAll()}getOutputItem(e){let t=g.getCtx(e);if(!t)throw Error(`UploaderPublicApi#getOutputItem: Entry with ID "${e}" not found in the upload collection`);let n=t.store,r=n.fileInfo,i=n.isRemoved?`removed`:n.errors.length>0?`failed`:n.fileInfo?`success`:n.isUploading?`uploading`:`idle`;return{uuid:r?.uuid??n.uuid??null,internalId:e,name:r?.originalFilename??n.fileName,size:r?.size??n.fileSize,isImage:r?.isImage??n.isImage,mimeType:r?.mimeType??n.mimeType,file:n.file,externalUrl:n.externalUrl,cdnUrlModifiers:n.cdnUrlModifiers,cdnUrl:n.cdnUrl??r?.cdnUrl??null,fullPath:n.fullPath,uploadProgress:n.uploadProgress,fileInfo:r??null,metadata:n.metadata??r?.metadata??null,isSuccess:i===`success`,isUploading:i===`uploading`,isFailed:i===`failed`,isRemoved:i===`removed`,isValidationPending:n.isValidationPending,errors:n.errors,status:i,source:n?.source}}getOutputCollectionState(){return hc(this._sharedInstancesBag)}get _sourceList(){let e=[];return this.cfg.sourceList&&(e=Bn(this.cfg.sourceList)),e}}})),yc,bc=n((()=>{yc={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}})),xc,Sc,Cc=n((()=>{xc=3/2,Sc=100/3}));function wc(e,t){for(let[n,r]of Object.entries(t))e.setAttributeNS(null,n,r.toString())}function Tc(e,t={}){let n=document.createElementNS(`http://www.w3.org/2000/svg`,e);return wc(n,t),n}function Ec(e,t,n){let{x:r,y:i,width:a,height:o}=e,s=t.includes(`w`)?0:1,c=t.includes(`n`)?0:1,l=s===0?-1:1,u=c===0?-1:1,d=[r+s*a+xc*l,i+c*o+xc*u-24*n*u],f=[r+s*a+xc*l,i+c*o+xc*u],p=[r+s*a-24*n*l+xc*l,i+c*o+xc*u];return{d:`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${p[0]} ${p[1]}`,center:[f[0],f[1]]}}function Dc(e,t,n){let{x:r,y:i,width:a,height:o}=e,s=t===`n`||t===`s`,c=t===`w`||t===`e`,l=s?.5:t===`w`?0:1,u=c?.5:t===`n`?0:1,d=t===`w`?-1:t===`e`?1:0,f=t===`n`?-1:t===`s`?1:0,p,m;return s?(p=[r+l*a-34*n/2,i+u*o+xc*f],m=[r+l*a+34*n/2,i+u*o+xc*f]):(p=[r+l*a+xc*d,i+u*o-34*n/2],m=[r+l*a+xc*d,i+u*o+34*n/2]),{d:`M ${p[0]} ${p[1]} L ${m[0]} ${m[1]}`,center:[(p[0]+m[0])/2,(p[1]+m[1])/2]}}function Oc(e){return e===``?`move`:[`e`,`w`].includes(e)?`ew-resize`:[`n`,`s`].includes(e)?`ns-resize`:[`nw`,`se`].includes(e)?`nwse-resize`:`nesw-resize`}function kc({rect:e,delta:[t,n],imageBox:r}){return Ac({...e,x:e.x+t,y:e.y+n},r)}function Ac(e,t){let{x:n}=e,{y:r}=e;return e.x<t.x?n=t.x:e.x+e.width>t.x+t.width&&(n=t.x+t.width-e.width),e.y<t.y?r=t.y:e.y+e.height>t.y+t.height&&(r=t.y+t.height-e.height),{...e,x:n,y:r}}function jc({rect:e,delta:t,aspectRatio:n,imageBox:r}){let[,i]=t,{y:a,width:o,height:s}=e;a+=i,s-=i,n&&(o=s*n);let c=e.x+e.width/2-o/2;return a<=r.y&&(a=r.y,s=e.y+e.height-a,n&&(o=s*n,c=e.x+e.width/2-o/2)),c<=r.x&&(c=r.x,a=e.y+e.height-s),c+o>=r.x+r.width&&(c=Math.max(r.x,r.x+r.width-o),o=r.x+r.width-c,n&&(s=o/n),a=e.y+e.height-s),s<1&&(s=1,n&&(o=s*n,c=e.x+e.width/2-o/2),a=e.y+e.height-s),o<1&&(o=1,n&&(s=o/n,c=e.x+e.width/2-o/2),a=e.y+e.height-s),{x:c,y:a,width:o,height:s}}function Mc({rect:e,delta:t,aspectRatio:n,imageBox:r}){let[i]=t,{x:a,width:o,height:s}=e;a+=i,o-=i,n&&(s=o/n);let c=e.y+e.height/2-s/2;return a<=r.x&&(a=r.x,o=e.x+e.width-a,n&&(s=o/n,c=e.y+e.height/2-s/2)),c<=r.y&&(c=r.y,a=e.x+e.width-o),c+s>=r.y+r.height&&(c=Math.max(r.y,r.y+r.height-s),s=r.y+r.height-c,n&&(o=s*n),a=e.x+e.width-o),s<1&&(s=1,n&&(o=s*n),c=e.y+e.height/2-s/2,a=e.x+e.width-o),o<1&&(o=1,n&&(s=o/n),c=e.y+e.height/2-s/2,a=e.x+e.width-o),{x:a,y:c,width:o,height:s}}function Nc({rect:e,delta:t,aspectRatio:n,imageBox:r}){let[,i]=t,{y:a,width:o,height:s}=e;s+=i,n&&(o=s*n);let c=e.x+e.width/2-o/2;return a+s>=r.y+r.height&&(s=r.y+r.height-a,n&&(o=s*n),c=e.x+e.width/2-o/2),c<=r.x&&(c=r.x,a=e.y),c+o>=r.x+r.width&&(c=Math.max(r.x,r.x+r.width-o),o=r.x+r.width-c,n&&(s=o/n),a=e.y),s<1&&(s=1,n&&(o=s*n),c=e.x+e.width/2-o/2),o<1&&(o=1,n&&(s=o/n),c=e.x+e.width/2-o/2),{x:c,y:a,width:o,height:s}}function Pc({rect:e,delta:t,aspectRatio:n,imageBox:r}){let[i]=t,{x:a,width:o,height:s}=e;o+=i,n&&(s=o/n);let c=e.y+e.height/2-s/2;return a+o>=r.x+r.width&&(o=r.x+r.width-a,n&&(s=o/n),c=e.y+e.height/2-s/2),c<=r.y&&(c=r.y,a=e.x),c+s>=r.y+r.height&&(c=Math.max(r.y,r.y+r.height-s),s=r.y+r.height-c,n&&(o=s*n),a=e.x),s<1&&(s=1,n&&(o=s*n),c=e.y+e.height/2-s/2),o<1&&(o=1,n&&(s=o/n),c=e.y+e.height/2-s/2),{x:a,y:c,width:o,height:s}}function Fc({rect:e,delta:t,aspectRatio:n,imageBox:r}){let[i,a]=t,{x:o,y:s,width:c,height:l}=e;return o+i<r.x&&(i=r.x-o),s+a<r.y&&(a=r.y-s),o+=i,c-=i,s+=a,l-=a,n&&Math.abs(c/l)>n?(a=c/n-l,l+=a,s-=a,s<=r.y&&(l-=r.y-s,c=l*n,o=e.x+e.width-c,s=r.y)):n&&(i=l*n-c,c+=i,o-=i,o<=r.x&&(c-=r.x-o,l=c/n,o=r.x,s=e.y+e.height-l)),l<1&&(l=1,n&&(c=l*n),o=e.x+e.width-c,s=e.y+e.height-l),c<1&&(c=1,n&&(l=c/n),o=e.x+e.width-c,s=e.y+e.height-l),{x:o,y:s,width:c,height:l}}function Ic({rect:e,delta:t,aspectRatio:n,imageBox:r}){let[i,a]=t,{x:o,y:s,width:c,height:l}=e;return o+c+i>r.x+r.width&&(i=r.x+r.width-o-c),s+a<r.y&&(a=r.y-s),c+=i,s+=a,l-=a,n&&Math.abs(c/l)>n?(a=c/n-l,l+=a,s-=a,s<=r.y&&(l-=r.y-s,c=l*n,o=e.x,s=r.y)):n&&(i=l*n-c,c+=i,o+c>=r.x+r.width&&(c=r.x+r.width-o,l=c/n,o=r.x+r.width-c,s=e.y+e.height-l)),l<1&&(l=1,n&&(c=l*n),s=e.y+e.height-l),c<1&&(c=1,n&&(l=c/n),s=e.y+e.height-l),{x:o,y:s,width:c,height:l}}function Lc({rect:e,delta:t,aspectRatio:n,imageBox:r}){let[i,a]=t,{x:o,y:s,width:c,height:l}=e;return o+i<r.x&&(i=r.x-o),s+l+a>r.y+r.height&&(a=r.y+r.height-s-l),o+=i,c-=i,l+=a,n&&Math.abs(c/l)>n?(a=c/n-l,l+=a,s+l>=r.y+r.height&&(l=r.y+r.height-s,c=l*n,o=e.x+e.width-c,s=r.y+r.height-l)):n&&(i=l*n-c,c+=i,o-=i,o<=r.x&&(c-=r.x-o,l=c/n,o=r.x,s=e.y)),l<1&&(l=1,n&&(c=l*n),o=e.x+e.width-c),c<1&&(c=1,n&&(l=c/n),o=e.x+e.width-c),{x:o,y:s,width:c,height:l}}function Rc({rect:e,delta:t,aspectRatio:n,imageBox:r}){let[i,a]=t,{x:o,y:s,width:c,height:l}=e;return o+c+i>r.x+r.width&&(i=r.x+r.width-o-c),s+l+a>r.y+r.height&&(a=r.y+r.height-s-l),c+=i,l+=a,n&&Math.abs(c/l)>n?(a=c/n-l,l+=a,s+l>=r.y+r.height&&(l=r.y+r.height-s,c=l*n,o=e.x,s=r.y+r.height-l)):n&&(i=l*n-c,c+=i,o+c>=r.x+r.width&&(c=r.x+r.width-o,l=c/n,o=r.x+r.width-c,s=e.y)),l<1&&(l=1,n&&(c=l*n)),c<1&&(c=1,n&&(l=c/n)),{x:o,y:s,width:c,height:l}}function zc({direction:e,...t}){switch(e){case`n`:return jc(t);case`w`:return Mc(t);case`s`:return Nc(t);case`e`:return Pc(t);case`nw`:return Fc(t);case`ne`:return Ic(t);case`sw`:return Lc(t);case`se`:return Rc(t);default:return t.rect}}function Bc(e,[t,n]){return e.x<=t&&t<=e.x+e.width&&e.y<=n&&n<=e.y+e.height}function Vc(e,t){return e.x>=t.x&&e.y>=t.y&&e.x+e.width<=t.x+t.width&&e.y+e.height<=t.y+t.height}function Hc(e,t){return Math.abs(e.width/e.height-t)<.1}function Uc({width:e,height:t},n){let r=n/90%2!=0;return{width:r?t:e,height:r?e:t}}function Wc(e,t,n){let r=e/t,i,a;r>n?(i=Math.round(t*n),a=t):(i=e,a=Math.round(e/n));let o=Math.round((e-i)/2),s=Math.round((t-a)/2);return o+i>e&&(i=e-o),s+a>t&&(a=t-s),{x:o,y:s,width:i,height:a}}function Gc(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Kc(e,t,n){return Math.min(Math.max(e,t),n)}var qc=n((()=>{Cc()})),Jc,Yc,Xc,Zc=n((()=>{Vn(),ln(),Jc=[`free`],Yc=e=>{let t=Bn(e);if(!t||t.length===0)return[];let n=[];for(let e of t){let t=e.trim();if(!t)continue;let r=t.indexOf(`:`);if(r===-1&&!Jc.includes(t)){console.warn(`Invalid crop preset: ${t}`);continue}let i=Number(t.slice(0,r)),a=Number(t.slice(r+1));if((!Number.isFinite(i)||!Number.isFinite(a)||i<=0||a<=0)&&!Jc.includes(t)){console.warn(`Invalid crop preset: ${t}`);continue}n.push({id:cn.generateFastUid(),type:`aspect-ratio`,width:Jc.includes(t)?0:i,height:Jc.includes(t)?0:a,hasFreeform:Jc.includes(t)})}return n},Xc=(e,t,n,r=.1)=>{let i=e/t,a=null,o=1/0;for(let e of n){let[t,n]=[e.width,e.height],r=t/n,s=Math.abs(i-r);s<o&&(o=s,a=e)}if(a){let[e,t]=[a.width,a.height],n=e/t;if(Math.abs(i-n)/n>r)return null}return a}}));function Qc(e){return kr({...e,libraryName:uo,libraryVersion:fo})}var $c=n((()=>{ua(),po()})),el,tl,z,B=n((()=>{ha(),P(),nn(),ga(),I(),el=`active`,tl=`___ACTIVITY_IS_ACTIVE___`,z=class e extends F{constructor(...e){super(...e),this.historyTracked=!1,this.init$=fa(this),this._debouncedHistoryFlush=C(this._historyFlush.bind(this),10)}_deactivate(){let t=e._activityCallbacks.get(this);this[tl]=!1,this.removeAttribute(el),t?.deactivateCallback?.()}_activate(){let t=e._activityCallbacks.get(this);this.$[`*historyBack`]=this.historyBack.bind(this),this[tl]=!0,this.setAttribute(el,``),t?.activateCallback?.(),this._debouncedHistoryFlush(),this.emit(N.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute(`activity`)||this.setAttribute(`activity`,this.activityType),this.sub(`*currentActivity`,e=>{try{this.activityType!==e&&this[tl]?this._deactivate():this.activityType===e&&!this[tl]&&this._activate()}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let t=this.$[`*history`][this.$[`*history`].length-1];this.$[`*currentActivity`]=t??null}e||(this.$[`*history`]=[])}))}_historyFlush(){let e=this.$[`*history`];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$[`*history`]=e)}_isActivityRegistered(){return!!this.activityType&&e._activityCallbacks.has(this)}static{this._activityCallbacks=new Map}get isActivityActive(){return!!this[tl]}get couldOpenActivity(){return!0}registerActivity(t,n={}){let{onActivate:r,onDeactivate:i}=n;e._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:i})}_unregisterActivity(){this.isActivityActive&&this._deactivate(),e._activityCallbacks.delete(this)}disconnectedCallback(){super.disconnectedCallback(),this._isActivityRegistered()&&this._unregisterActivity();let t=this.$[`*currentActivity`];this.blocksRegistry&&([...this.blocksRegistry].find(n=>n instanceof e&&n.activityType===t)||(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 e=this.$[`*history`];if(e){let t=e.pop();for(;t===this.activityType;)t=e.pop();let n=!!t;t&&(n=[...this.blocksRegistry].find(e=>e.activityType===t)?.couldOpenActivity??!1),t=n?t:null,this.$[`*currentActivity`]=t??null,t&&this.modalManager?.open(t),this.$[`*history`]=e,t||this.modalManager?.closeAll()}}},z.activities=j})),V,H=n((()=>{ua(),ha(),$o(),zs(),Ws(),vc(),bc(),qc(),Zc(),P(),zn(),nn(),oc(),$c(),cc(),B(),ne(),V=class e extends z{constructor(...e){super(...e),this.couldBeCtxOwner=!1,this._isCtxOwner=!1,this.init$=pa(this),this._flushOutputItems=C(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$[`*collectionState`]=e,this.emit(N.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&e.totalCount>0&&e.status===`success`&&this._createGroup(e)},300),this._handleCollectionUpdate=(e,t,n)=>{if(this.isConnected){(t.size||n.size)&&(this.$[`*groupInfo`]=null),this.validationManager.runFileValidators(`add`,[...t].map(e=>e.uid));for(let e of t)e.getValue(`silent`)||this.emit(N.FILE_ADDED,this.api.getOutputItem(e.uid));this.validationManager.runCollectionValidators();for(let e of n){this.$[`*uploadTrigger`].delete(e.uid),this.validationManager.cleanupValidationForEntry(e),e.getValue(`abortController`)?.abort(),e.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0});let t=e?.getValue(`thumbUrl`);t&&URL.revokeObjectURL(t),this.emit(N.FILE_REMOVED,this.api.getOutputItem(e.uid))}this.$[`*uploadList`]=e.map(e=>({uid:e})),this._flushCommonUploadProgress(),this._flushOutputItems()}},this._handleCollectionPropertiesUpdate=e=>{if(!this.isConnected)return;this._flushOutputItems();let t=this.uploadCollection,n=[...new Set(Object.entries(e).filter(([e])=>[`uploadError`,`fileInfo`,`cdnUrl`,`cdnUrlModifiers`].includes(e)).flatMap(([,e])=>[...e]))];if(n.length>0&&setTimeout(()=>{if(!this.isConnected)return;let t=n.filter(t=>e.fileInfo?.has(t)&&!!g.getCtx(t)?.store.fileInfo);t.length>0&&this.validationManager.runFileValidators(`upload`,t),this.validationManager.runFileValidators(`change`,n)}),e.uploadProgress){for(let t of e.uploadProgress){let e=g.getCtx(t);if(!e)continue;let{isUploading:n,silent:r}=e.store;n&&!r&&this.emit(N.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(t))}this._flushCommonUploadProgress()}if(e.isUploading)for(let t of e.isUploading){let e=g.getCtx(t);if(!e)continue;let{isUploading:n,silent:r}=e.store;n&&!r&&this.emit(N.FILE_UPLOAD_START,this.api.getOutputItem(t))}if(e.fileInfo){for(let t of e.fileInfo){let e=g.getCtx(t);if(!e)continue;let{fileInfo:n,silent:r}=e.store;n&&!r&&this.emit(N.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(t))}this.cfg.cropPreset&&this._setInitialCrop(),this.cfg.cloudImageEditorAutoOpen&&this._openCloudImageEditor()}if(e.errors){this.validationManager.runCollectionValidators();for(let t of e.errors){let e=g.getCtx(t);if(!e)continue;let{errors:n}=e.store;n.length>0&&(this.emit(N.FILE_UPLOAD_FAILED,this.api.getOutputItem(t)),this.emit(N.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let n=t.findItems(e=>!!e.getValue(`fileInfo`)),r=t.findItems(e=>e.getValue(`errors`).length>0);t.size>0&&r.length===0&&t.size===n.length&&this.$[`*collectionErrors`].length===0&&this.emit(N.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(e=>!!this.uploadCollection.read(e)?.getValue(`cdnUrl`)).forEach(e=>{this.emit(N.FILE_URL_CHANGED,this.api.getOutputItem(e))}),this.$[`*groupInfo`]=null)},this._flushCommonUploadProgress=()=>{let e=0,t=[...this.$[`*uploadTrigger`]].filter(e=>!!this.uploadCollection.read(e));t.forEach(t=>{let n=this.uploadCollection.readProp(t,`uploadProgress`);typeof n==`number`&&(e+=n)});let n=t.length?Math.round(e/t.length):0;this.$[`*commonProgress`]!==n&&(this.$[`*commonProgress`]=n,this.emit(N.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))}}get _hasCtxOwner(){return this.hasBlockInCtx(t=>t instanceof e?t._isCtxOwner&&t.isConnected&&t!==this:!1)}initCallback(){super.initCallback(),this._addSharedContextInstance(`*uploadCollection`,()=>new Us({initialValue:yc,watchList:[`uploadProgress`,`uploadError`,`fileInfo`,`errors`,`cdnUrl`,`isUploading`,`isValidationPending`]})),this._addSharedContextInstance(`*secureUploadsManager`,e=>new Qo(e)),this._addSharedContextInstance(`*validationManager`,e=>new Rs(e)),this._addSharedContextInstance(`*publicApi`,e=>new _c(e)),!this._hasCtxOwner&&this.couldBeCtxOwner&&this._initCtxOwner()}getAPI(){return this.api}get validationManager(){return this._getSharedContextInstance(`*validationManager`)}get api(){return this._getSharedContextInstance(`*publicApi`)}get uploadCollection(){return this._getSharedContextInstance(`*uploadCollection`)}get secureUploadsManager(){return this._getSharedContextInstance(`*secureUploadsManager`)}disconnectedCallback(){super.disconnectedCallback(),this._isCtxOwner&&this._unobserveUploadCollection(),this._flushOutputItems.cancel()}connectedCallback(){super.connectedCallback(),this._isCtxOwner&&this._observeUploadCollection()}_initCtxOwner(){this._isCtxOwner=!0,this._observeUploadCollection(),this.subConfigValue(`maxConcurrentRequests`,e=>{this.$[`*uploadQueue`].concurrency=Number(e)||1})}_observeUploadCollection(){this._unobserveUploadCollection(),this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate)}_unobserveUploadCollection(){this._unobserveCollectionProperties?.(),this._unobserveCollection?.(),this._unobserveCollectionProperties=void 0,this._unobserveCollection=void 0}async _createGroup(e){let t=await this.getUploadClientOptions(),n=e.allEntries.map(e=>e.uuid+(e.cdnUrlModifiers?`/${e.cdnUrlModifiers}`:``)),r=new AbortController,i=await Zr(n,{...t,signal:r.signal});if(this.$[`*collectionState`]!==e){r.abort();return}this.$[`*groupInfo`]=i;let a=this.api.getOutputCollectionState();this.emit(N.GROUP_CREATED,a),this.emit(N.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$[`*collectionState`]=a}_openCloudImageEditor(){let[e]=this.uploadCollection.findItems(e=>!!e.getValue(`fileInfo`)&&e.getValue(`isImage`)).map(e=>this.uploadCollection.read(e));e&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===z.activities.CLOUD_IMG_EDIT)&&(this.$[`*currentActivityParams`]={internalId:e.uid},this.$[`*currentActivity`]=z.activities.CLOUD_IMG_EDIT,this.modalManager?.open(z.activities.CLOUD_IMG_EDIT))}_setInitialCrop(){let e=Yc(this.cfg.cropPreset);if(e){let[t]=e,n=this.uploadCollection.findItems(e=>!!e.getValue(`fileInfo`)&&e.getValue(`isImage`)&&!e.getValue(`cdnUrlModifiers`)?.includes(`/crop/`)).map(e=>this.uploadCollection.read(e)).filter(Boolean);for(let e of n){let n=e.getValue(`fileInfo`);if(!n||!n.imageInfo){console.warn(`Failed to get image info for entry`,e.uid);continue}let{width:r,height:i}=n.imageInfo,a=Wc(r,i,typeof t?.width==`number`&&typeof t?.height==`number`&&t.width>0&&t.height>0?t.width/t.height:1),o=In(`crop/${a.width}x${a.height}/${a.x},${a.y}`,`preview`),s=e.getValue(`cdnUrl`);if(!s){console.warn(`Failed to get cdnUrl for entry`,e.uid);continue}e.setMultipleValues({cdnUrlModifiers:o,cdnUrl:Ln(s,o)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===z.activities.CLOUD_IMG_EDIT)&&(this.$[`*currentActivityParams`]={internalId:e.uid},this.$[`*currentActivity`]=z.activities.CLOUD_IMG_EDIT,this.modalManager?.open(z.activities.CLOUD_IMG_EDIT))}}}async getMetadataFor(e){let t=this.cfg.metadata||void 0;return typeof t==`function`?await t(this.api.getOutputItem(e)):t}async getUploadClientOptions(){let e=await this.secureUploadsManager.getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Qc,integration:this.cfg.userAgentIntegration,secureSignature:e?.secureSignature,secureExpire:e?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return sc(this._sharedInstancesBag)}},V.extSrcList=Object.freeze({...ic}),V.sourceTypes=Object.freeze({...R})})),nl=n((()=>{})),rl,il=n((()=>{y(),S(),Ko(),I(),nl(),T(),rl=class extends F{constructor(...e){super(...e),this.name=``,this._resolvedHref=``,this._pluginSvg=null,this._iconHrefResolver=null}initCallback(){super.initCallback(),this.setAttribute(`aria-hidden`,`true`),this.subConfigValue(`iconHrefResolver`,e=>{this._iconHrefResolver=e,this._updateResolvedHref()});let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._updateResolvedHref()))}willUpdate(e){super.willUpdate(e),e.has(`name`)&&this._updateResolvedHref()}_updateResolvedHref(){if(!this.name){this._resolvedHref=``,this._pluginSvg=null;return}let e=this._sharedInstancesBag.pluginManager?.snapshot().icons.find(e=>e.name===this.name);if(e){this._pluginSvg=e.svg,this._resolvedHref=``;return}this._pluginSvg=null;let t=`#uc-icon-${this.name}`;this._resolvedHref=this._iconHrefResolver?.(this.name)??t}render(){return this._pluginSvg?_`${this.yield(``,_`${Wo(this._pluginSvg)}`)}`:_`
|
|
9
|
-
${this.yield(``,_`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
10
|
-
<use href=${this._resolvedHref}></use>
|
|
11
|
-
</svg>`)}
|
|
12
|
-
`}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback()}},w([b({type:String})],rl.prototype,`name`,void 0),w([x()],rl.prototype,`_resolvedHref`,void 0),w([x()],rl.prototype,`_pluginSvg`,void 0)}));H();let al=e=>[...new Set(e)],ol=`--uc-img-`,sl=`unresolved`,cl=!window.location.host.trim()||window.location.host.includes(`:`)||window.location.hostname.includes(`localhost`),ll=Object.freeze({PREVIEW:`PREVIEW`,MAIN:`MAIN`});var ul=`https://ucarecdn.com`;let dl=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:ul},"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}});y(),po(),Ot(),Mt();var fl=class extends Dt(jt(ht)){createRenderRoot(){return this}constructor(){for(let e in super(),this._state={},this._subscribers=new Map,this._isnObserver=null,this._observed=null,dl){let t=dl[e];this._state[ol+e]=t?.default||``}}$$(e){return this._state[ol+e]}set$$(e){for(let t in e){let n=ol+t,r=e[t];this._state[n]=r,this._notify(n,r)}}sub$$(e,t){let n=ol+e;this._subscribers.has(n)||this._subscribers.set(n,new Set),this._subscribers.get(n)?.add(t);let r=this._state[n];r!==null&&r!==``&&t(r)}_notify(e,t){this._subscribers.has(e)&&this._subscribers.get(e)?.forEach(e=>{t===null||t===``||e(t)})}analyticsParams(){return`-/@clib/${uo}/${fo}/uc-img/`}initAttributes(e){Array.from(this.attributes).forEach(t=>{let n=t;dl[n.name]||e.setAttribute(n.name,n.value)})}initIntersection(e,t){this._isnObserver=new IntersectionObserver(n=>{n.forEach(n=>{n.isIntersecting&&(t(),this._isnObserver?.unobserve(e))})},{root:null,rootMargin:`0px`}),this._isnObserver.observe(e),this._observed||=new Set,this._observed.add(e)}connectedCallback(){super.connectedCallback(),this._initCssProperties()}_initCssProperties(){for(let e in dl){let t=ol+e,n=this.getCssData(t,!0);n!=null&&(this._state[t]=n)}}disconnectedCallback(){super.disconnectedCallback(),this._isnObserver&&=(this._observed?.forEach(e=>{this._isnObserver?.unobserve(e)}),null),this._subscribers.clear()}static get observedAttributes(){return Object.keys(dl)}attributeChangedCallback(e,t,n){window.setTimeout(()=>{let t=ol+e;this._state[t]=n,this._notify(t,n)})}};let pl=e=>Object.entries(e).filter(([e,t])=>t!==void 0&&t!==``).map(([e,t])=>e===`cdn-operations`||e===`analytics`?t:`${e}/${t}`);zn(),Vn(),wo();var ml=class extends fl{constructor(...e){super(...e),this._img=new Image,this._imgPreview=new Image}_fmtAbs(e){return!e.includes(`//`)&&!cl&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if(!e)return;let t=e,n=t.match(/\d+/)?.[0],r=t.match(/[a-zA-Z]+/)?.[0];if(!n||!r)return;let i=parseInt(n,10);return Number(i)>5e3&&this._hasFormatJPG?5e3+r:Number(i)>3e3&&!this._hasFormatJPG?3e3+r:e}_getCdnModifiers(e,t){return In(...pl({format:this._getTypedCssValue(`format`),quality:this._getTypedCssValue(`quality`),resize:this._validateSize(e),blur:t,"cdn-operations":this._getTypedCssValue(`cdn-operations`)??void 0,analytics:this.analyticsParams()}))}_getTypedCssValue(e){let t=this.$$(e);if(t==null||typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return t}_getUrlBase(e=``,t=``){let n=this.$$(`src`);if(n.startsWith(`data:`)||n.startsWith(`blob:`))return n;if(cl&&n&&!n.includes(`//`))return this._proxyUrl(n);let r=this._getCdnModifiers(e,t),i=this.$$(`cdn-cname`),a=i;if(n.startsWith(String(i)))return Ln(n,r);let o=this.$$(`uuid`);if(a&&o||o)return this._proxyUrl(Ln(Rn(a,o),r));let s=this.$$(`proxy-cname`);if(s)return this._proxyUrl(Ln(s,r,this._fmtAbs(n)));let c=this.$$(`pubkey`);if(c)return this._proxyUrl(Ln(`https://${c}.ucr.io/`,r,this._fmtAbs(n)))}_proxyUrl(e){let t=this.$$(`secure-delivery-proxy`);return t?vo(t,{previewUrl:e},{transform:e=>window.encodeURIComponent(e)}):e}_getElSize(e,t=1,n=!0){let r=e.getBoundingClientRect(),i=t*Math.round(r.width),a=n?``:t*Math.round(r.height);return i||a?`${i||``}x${a||``}`:null}_setupEventProxy(e){let t=e=>{e.stopPropagation();let t=new Event(e.type,e);this.dispatchEvent(t)};for(let n of[`load`,`error`])e.addEventListener(n,t)}get img(){return this._hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get _currentImg(){return this._hasPreviewImage?{type:ll.PREVIEW,img:this._imgPreview}:{type:ll.MAIN,img:this.img}}get _hasPreviewImage(){return this.$$(`is-preview-blur`)}get _bgSelector(){return this.$$(`is-background-for`)}get _breakpoints(){let e=this.$$(`breakpoints`);return e?al(Bn(e).map(e=>parseInt(e,10))):null}get _hasFormatJPG(){return this.$$(`format`).toLowerCase()===`jpeg`}_renderBg(e){let t=new Set;t.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$(`hi-res-support`)&&t.add(`url("${this._getUrlBase(this._getElSize(e,2))}") 2x`),this.$$(`ultra-res-support`)&&t.add(`url("${this._getUrlBase(this._getElSize(e,3))}") 3x`);let n=`image-set(${[...t].join(`, `)})`;e.style.setProperty(`background-image`,n),e.style.setProperty(`background-image`,`-webkit-${n}`)}_getSrcset(){let e=new Set;return this._breakpoints?this._breakpoints.forEach(t=>{e.add(`${this._getUrlBase(`${t}x`)} ${this._validateSize(`${t}w`)}`),this.$$(`hi-res-support`)&&e.add(`${this._getUrlBase(`${t*2}x`)} ${this._validateSize(`${t*2}w`)}`),this.$$(`ultra-res-support`)&&e.add(`${this._getUrlBase(`${t*3}x`)} ${this._validateSize(`${t*3}w`)}`)}):(e.add(`${this._getUrlBase(this._getElSize(this._currentImg.img))} 1x`),this.$$(`hi-res-support`)&&e.add(`${this._getUrlBase(this._getElSize(this._currentImg.img,2))} 2x`),this.$$(`ultra-res-support`)&&e.add(`${this._getUrlBase(this._getElSize(this._currentImg.img,3))} 3x`)),[...e].join()}_getSrc(){return this._getUrlBase()}get _srcUrlPreview(){return this._getUrlBase(`100x`,`100`)}_renderBackground(){let e=this._bgSelector;[...document.querySelectorAll(e)].forEach(e=>{this.$$(`intersection`)?this.initIntersection(e,()=>{this._renderBg(e)}):this._renderBg(e)})}_appendURL({elNode:e,src:t,srcset:n}){t&&(e.src=t),n&&(e.srcset=n)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}_loaderImage({src:e,srcset:t,elNode:n}){return new Promise((r,i)=>{this._setupConfigForImage({elNode:n}),n.setAttribute(sl,``),n.addEventListener(`load`,()=>{n.removeAttribute(sl),r(n)}),n.addEventListener(`error`,()=>{i(!1)}),this._appendURL({elNode:n,src:e,srcset:t})})}async _renderImage(){if(this.$$(`intersection`)){this._hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this._currentImg.img,async()=>{this._hasPreviewImage&&(this._imgPreview.src=this._srcUrlPreview);try{await this._loaderImage({src:this._getSrc(),srcset:this._getSrcset(),elNode:this._img}),this._hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}});return}try{this._hasPreviewImage&&(await this._loaderImage({src:this._srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this._loaderImage({src:this._getSrc(),srcset:this._getSrcset(),elNode:this._img}),this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}catch{this._hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}}init(){this._bgSelector?this._renderBackground():this._renderImage()}},hl=class extends ml{connectedCallback(){super.connectedCallback(),this.sub$$(`src`,()=>{this.init()}),this.sub$$(`uuid`,()=>{this.init()}),this.sub$$(`lazy`,e=>{!this.$$(`is-background-for`)&&!this.$$(`is-preview-blur`)&&(this.img.loading=e?`lazy`:`eager`)})}},gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El=n((()=>{pt(),{I:gl}=ut,_l=e=>e,vl=e=>e.strings===void 0,yl=()=>document.createComment(``),bl=(e,t,n)=>{let r=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0)n=new gl(r.insertBefore(yl(),i),r.insertBefore(yl(),i),e,e.options);else{let t=n._$AB.nextSibling,a=n._$AM,o=a!==e;if(o){let t;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(t=e._$AU)!==a._$AU&&n._$AP(t)}if(t!==i||o){let e=n._$AA;for(;e!==t;){let t=_l(e).nextSibling;_l(r).insertBefore(e,i),e=t}}}return n},xl=(e,t,n=e)=>(e._$AI(t,n),e),Sl={},Cl=(e,t=Sl)=>e._$AH=t,wl=e=>e._$AH,Tl=e=>{e._$AR(),e._$AA.remove()}}));function Dl(e){this._$AN===void 0?this._$AM=e:(Al(this),this._$AM=e,jl(this))}function Ol(e,t=!1,n=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let e=n;e<r.length;e++)kl(r[e],!1),Al(r[e]);else r!=null&&(kl(r,!1),Al(r));else kl(this,e)}var kl,Al,jl,Ml,Nl,Pl=n((()=>{El(),Bo(),kl=(e,t)=>{let n=e._$AN;if(n===void 0)return!1;for(let e of n)e._$AO?.(t,!1),kl(e,t);return!0},Al=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},jl=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Ml(t)}},Ml=e=>{e.type==Lo.CHILD&&(e._$AP??=Ol,e._$AQ??=Dl)},Nl=class extends zo{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),jl(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(kl(this,e),Al(this))}setValue(e){if(vl(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}})),U,Fl,Il,W,Ll=n((()=>{pt(),Pl(),Bo(),U=()=>new Fl,Fl=class{},Il=new WeakMap,W=Ro(class extends Nl{render(e){return v}update(e,[t]){let n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G==`function`){let t=this.ht??globalThis,n=Il.get(t);n===void 0&&(n=new WeakMap,Il.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G==`function`?Il.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}})})),G=n((()=>{Ll()}));y(),Sr(),I(),P(),S(),G(),T();var Rl=null,zl=class extends F{constructor(...e){super(...e),this.dialogEl=U(),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 t=e.target;t===this.dialogEl.value&&t===this._mouseDownTarget&&this.closeDialog()},this._handleModalOpen=({id:e})=>{e===this.id?(Rl=e,this.show(),this.emit(N.MODAL_OPEN,{modalId:e},{debounce:!0})):this.hide()},this._handleModalClose=({id:e})=>{e===this.id&&(this.hide(),this.emit(N.MODAL_CLOSE,{modalId:e,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:!0}))},this._handleModalCloseAll=e=>{this.hide(),Rl===this.id&&this.emit(N.MODAL_CLOSE,{modalId:Rl,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:!0})}}static{this.styleAttrs=[...super.styleAttrs,`uc-modal`]}show(){let e=this.dialogEl.value;typeof e.showModal==`function`?(this.setAttribute(`aria-modal`,`true`),e.showModal()):e.setAttribute(`open`,``),this.cfg.modalScrollLock&&(document.body.style.overflow=`hidden`)}hide(){let e=this.dialogEl.value;e&&(typeof e.close==`function`?(this.setAttribute(`aria-modal`,`false`),e.close()):e.removeAttribute(`open`))}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue(`modalBackdropStrokes`,e=>{e?this.setAttribute(`strokes`,``):this.removeAttribute(`strokes`)}),this.modalManager?.subscribe(O.OPEN,this._handleModalOpen),this.modalManager?.subscribe(O.CLOSE,this._handleModalClose),this.modalManager?.subscribe(O.CLOSE_ALL,this._handleModalCloseAll)}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow=``,this._mouseDownTarget=void 0,this.modalManager?.unsubscribe(O.OPEN,this._handleModalOpen),this.modalManager?.unsubscribe(O.CLOSE,this._handleModalClose),this.modalManager?.unsubscribe(O.CLOSE_ALL,this._handleModalCloseAll)}_handleDialogRef(e){this.dialogEl={value:e},this.dialogEl.value?.addEventListener(`close`,this._handleDialogClose),this.dialogEl.value?.addEventListener(`mousedown`,this._handleDialogMouseDown),this.dialogEl.value?.addEventListener(`mouseup`,this._handleDialogMouseUp)}render(){return _`
|
|
13
|
-
<dialog ${W(this._handleDialogRef)}>
|
|
14
|
-
${this.yield(``)}
|
|
15
|
-
</dialog>
|
|
16
|
-
`}};w([b({type:Boolean,noAccessor:!0})],zl.prototype,`strokes`,void 0),w([b({type:Boolean,attribute:`block-body-scrolling`,noAccessor:!0})],zl.prototype,`blockBodyScrolling`,void 0),S(),ec(),T();var Bl=class extends V{constructor(...e){super(...e),this._validationInputElement=null,this._dynamicInputsContainer=null}get _inputName(){return this.nameAttrValue??this.ctxName}_createValidationInput(){let e=document.createElement(`input`);return e.type=`text`,e.name=this._inputName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,$s(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub(`*collectionState`,e=>{if(!e)return;if(!this._dynamicInputsContainer){let e=document.createElement(`div`);this.appendChild(e),this._dynamicInputsContainer=e}if(!this._validationInputElement){let e=this._createValidationInput();this.appendChild(e),this._validationInputElement=e}if(this._dynamicInputsContainer.innerHTML=``,e.status===`uploading`||e.status===`idle`){this._validationInputElement.value=``,this._validationInputElement.setCustomValidity(``);return}if(e.status===`failed`){let t=e.errors[0]?.message;this._validationInputElement.value=``,this._validationInputElement.setCustomValidity(t??``);return}let t=e.group?e.group:null;if(t){this._validationInputElement.value=t.cdnUrl??``,this._validationInputElement.setCustomValidity(``);return}let n=e.allEntries.map(e=>e.cdnUrl).filter(e=>typeof e==`string`);if(!this.cfg.multiple&&n.length===1&&n[0]){this._validationInputElement.value=n[0],this._validationInputElement.setCustomValidity(``);return}this._validationInputElement.remove(),this._validationInputElement=null;let r=new DocumentFragment;for(let e of n){let t=document.createElement(`input`);t.type=`hidden`,t.name=`${this._inputName}[]`,t.value=e,r.appendChild(t)}this._dynamicInputsContainer.replaceChildren(r)},!1)}};w([b({type:String,noAccessor:!0,attribute:`name`})],Bl.prototype,`nameAttrValue`,void 0),y(),I();var Vl=class extends F{initCallback(){super.initCallback(),this.subConfigValue(`removeCopyright`,e=>{this.toggleAttribute(`hidden`,!!e)})}render(){return _`
|
|
17
|
-
<a
|
|
18
|
-
href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4"
|
|
19
|
-
target="_blank noopener"
|
|
20
|
-
class="uc-credits"
|
|
21
|
-
>Powered by Uploadcare</a
|
|
22
|
-
>
|
|
23
|
-
`}};y(),S(),G(),I(),T();var Hl=class extends F{constructor(...e){super(...e),this.hasFileName=!1,this.value=0,this.visible=!0,this._progressValue=0,this._fakeProgressLineRef=U(),this._handleFakeProgressAnimation=()=>{let e=this._fakeProgressLineRef.value;if(e){if(!this.visible){e.classList.add(`uc-fake-progress--hidden`);return}this._progressValue>0&&e.classList.add(`uc-fake-progress--hidden`)}}}firstUpdated(e){super.firstUpdated(e),this._progressValue=this._normalizeProgressValue(this.value),this._updateProgressValueStyle(),this._fakeProgressLineRef.value?.addEventListener(`animationiteration`,this._handleFakeProgressAnimation)}updated(e){if(super.updated(e),e.has(`value`)){let e=this._normalizeProgressValue(this.value);if(!this.visible)this._progressValue=e;else{let t=Math.max(this._progressValue,e);t!==this._progressValue&&(this._progressValue=t,this._updateProgressValueStyle())}}e.has(`visible`)&&(this.classList.toggle(`uc-progress-bar--hidden`,!this.visible),this.visible?this._updateProgressValueStyle():this._progressValue=this._normalizeProgressValue(this.value))}disconnectedCallback(){super.disconnectedCallback(),this._fakeProgressLineRef.value?.removeEventListener(`animationiteration`,this._handleFakeProgressAnimation)}_normalizeProgressValue(e){return Number.isFinite(e)?Math.min(100,Math.max(0,e)):0}_updateProgressValueStyle(){this.visible&&this.style.setProperty(`--l-progress-value`,this._progressValue.toString())}render(){return _`
|
|
24
|
-
<div ${W(this._fakeProgressLineRef)} class="uc-fake-progress"></div>
|
|
25
|
-
<div class="uc-progress"></div>
|
|
26
|
-
`}};w([b({type:Boolean,noAccessor:!0})],Hl.prototype,`hasFileName`,void 0),w([b({type:Number})],Hl.prototype,`value`,void 0),w([b({type:Boolean,reflect:!0})],Hl.prototype,`visible`,void 0),y(),S(),H(),T();var Ul=class extends V{constructor(){super(),this._visible=!1,this._value=0,this.init$={...this.init$,"*commonProgress":0}}initCallback(){super.initCallback(),this._unobserveCollectionCb=this.uploadCollection.observeProperties(()=>{this._visible=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue(`isUploading`)??!1)}),this.sub(`*commonProgress`,e=>{this._value=e})}updated(e){super.updated(e),e.has(`visible`)&&(this._visible?this.setAttribute(`active`,``):this.removeAttribute(`active`))}disconnectedCallback(){super.disconnectedCallback(),this._unobserveCollectionCb?.(),this._unobserveCollectionCb=void 0}render(){return _` <uc-progress-bar .value=${this._value} .visible=${this._visible}></uc-progress-bar> `}};w([x()],Ul.prototype,`_visible`,void 0),w([x()],Ul.prototype,`_value`,void 0);var Wl=n((()=>{})),Gl,Kl=n((()=>{y(),S(),I(),Wl(),T(),Gl=class extends F{constructor(...e){super(...e),this.value=``,this.disabled=!1,this.options=[],this._handleChange=e=>{if(this.disabled){e.preventDefault(),e.stopPropagation();return}e.preventDefault(),e.stopPropagation();let t=e.currentTarget;t&&(this.value=t.value,this.dispatchEvent(new Event(`change`)))}}render(){return _`
|
|
27
|
-
<select @change=${this._handleChange} .value=${this.value} ?disabled=${this.disabled}>
|
|
28
|
-
${this.options.map(e=>_`<option value=${e.value}>${e.text}</option>`)}
|
|
29
|
-
</select>
|
|
30
|
-
`}},w([b({type:String,attribute:!1})],Gl.prototype,`value`,void 0),w([b({type:Boolean,reflect:!0})],Gl.prototype,`disabled`,void 0),w([b({type:Array,attribute:!1})],Gl.prototype,`options`,void 0)}));y(),S(),H(),T();var ql=class extends V{constructor(...e){super(...e),this.couldBeCtxOwner=!0,this._iconName=`default`,this._srcTypeKey=``}willUpdate(e){super.willUpdate(e),e.has(`source`)&&this._applySource(this.source)}_applySource(e){if(!e){this._srcTypeKey=``,this._iconName=`default`;return}let{label:t,icon:n,id:r}=e;this._srcTypeKey=t,this._iconName=n??r??`default`}activate(){this.source&&this.source.onClick()}render(){return _`
|
|
31
|
-
<button type="button" @click=${this.activate}>
|
|
32
|
-
<uc-icon name=${this._iconName}></uc-icon>
|
|
33
|
-
<div class="uc-txt">${this.l10n(this._srcTypeKey)}</div>
|
|
34
|
-
</button>
|
|
35
|
-
`}};w([b({attribute:!1})],ql.prototype,`source`,void 0),w([x()],ql.prototype,`_iconName`,void 0),w([x()],ql.prototype,`_srcTypeKey`,void 0),y(),S(),Vn(),oc(),H(),T();var Jl=class extends V{constructor(...e){super(...e),this._rawSourceList=[],this._sources=[],this.wrap=!1}initCallback(){super.initCallback(),this.subConfigValue(`sourceList`,e=>{this._rawSourceList=Bn(e),this._updateSources()});let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._updateSources()))}updated(e){super.updated(e),this.cfg.sourceListWrap?this.style.removeProperty(`display`):this.style.display=`contents`}_updateSources(){let e=this._sharedInstancesBag.pluginManager?.snapshot().sources??[],t=new Map(e.map(e=>[e.id,e])),n=[];this._rawSourceList.forEach(e=>{let r=this._expandSource(e,t);if(r.length!==1||r[0]!==e){for(let e of r){let r=this._makeBuiltInSourceConfig(e);if(r){n.push(r);continue}let i=t.get(e);i&&n.push(this._makePluginSourceConfig(i))}return}let i=this._makeBuiltInSourceConfig(e);if(i){n.push(i);return}let a=t.get(e);a&&n.push(this._makePluginSourceConfig(a))}),this._sources=n}_expandSource(e,t){let n=t.get(e);return n?.expand?n.expand():[e]}_makeBuiltInSourceConfig(e){switch(e){case R.LOCAL:return{id:e,label:`src-type-${e}`,icon:e,onClick:()=>this.api.openSystemDialog()};default:break}return null}_makePluginSourceConfig(e){return{id:e.id,label:e.label,icon:e.icon,onClick:()=>e.onSelect()}}render(){return _`${this._sources.map(e=>_`<uc-source-btn role="listitem" .source=${e} data-source-id=${e.id}></uc-source-btn>`)}`}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback()}};w([x()],Jl.prototype,`_sources`,void 0),w([b({type:Boolean,attribute:`wrap`,noAccessor:!0})],Jl.prototype,`wrap`,void 0);var Yl=n((()=>{})),Xl,Zl=n((()=>{y(),I(),Yl(),Xl=class extends F{render(){return _` <div class="uc-spinner"></div> `}}})),Ql,$l=n((()=>{Ql=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=`}));function eu(e){let t=new Image;return{promise:new Promise((n,r)=>{t.src=e,t.onload=()=>n(),t.onerror=e=>r(e)}),image:t,cancel:()=>{t.naturalWidth===0&&(t.src=Ql)}}}function tu(e){let t=[];for(let n of e){let e=eu(n);t.push(e)}let n=t.map(e=>e.image);return{promise:Promise.allSettled(t.map(e=>e.promise)),images:n,cancel:()=>{t.forEach(e=>{e.cancel()})}}}var nu=n((()=>{$l()}));nu();function ru(e,t=40){if(e.type===`image/svg+xml`)return URL.createObjectURL(e);let n=document.createElement(`canvas`),r=n.getContext(`2d`);if(!r)return Promise.reject(Error(`Canvas context not supported`));let i=new Image,a=new Promise((e,a)=>{i.onload=()=>{let o=i.height/i.width;o>1?(n.width=t,n.height=t*o):(n.height=t,n.width=t/o),r.fillStyle=`rgb(240, 240, 240)`,r.fillRect(0,0,n.width,n.height),r.drawImage(i,0,0,n.width,n.height),n.toBlob(t=>{if(!t){a();return}e(URL.createObjectURL(t))})},i.onerror=e=>{a(e)}});return i.src=URL.createObjectURL(e),a}H();var iu=class extends V{constructor(...e){super(...e),this._entrySubs=new Set,this.entry=null}withEntry(e){return(...t)=>{let n=this.entry;if(!n){console.warn(`No entry found`);return}return e(n,...t)}}subEntry(e,t){this.withEntry((e,t,n)=>{let r=e.subscribe(t,e=>{this.isConnected&&n(e)});this._entrySubs.add(r)})(e,t)}reset(){for(let e of this._entrySubs)e();this._entrySubs=new Set,this.entry=null}disconnectedCallback(){super.disconnectedCallback(),this._entrySubs=new Set}};function au(e){let t=new Blob([e],{type:`image/svg+xml`});return URL.createObjectURL(t)}function ou(e=`hsl(209, 21%, 65%)`,t=32,n=32){return au(`
|
|
36
|
-
<svg width="${t}" height="${n}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
37
|
-
<path fill-rule="evenodd" fill="${e}" 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"/>
|
|
38
|
-
</svg>
|
|
39
|
-
`)}y(),S(),zn(),nn(),$l(),T();var su=3e3,cu=class extends iu{constructor(...e){super(...e),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(e,t=!1)=>{let n=e.getValue(`fileInfo`),r=e.getValue(`isImage`),i=e.getValue(`uuid`),a=e.getValue(`thumbUrl`),o=this._calculateThumbSize(t);if(n&&r&&i){let t=await this.proxyUrl(Ln(Rn(this.cfg.cdnCname,i),In(e.getValue(`cdnUrlModifiers`),`stretch/off`,`scale_crop/${o}x${o}/center`)));if(a===t)return;let{promise:n}=eu(t);n.then(()=>{e.setValue(`thumbUrl`,t),a?.startsWith(`blob:`)&&URL.revokeObjectURL(a)}).catch(async()=>{if(!a?.startsWith(`blob:`))try{let t=e.getValue(`file`);if(!t)return;let n=await ru(t,o);e.setValue(`thumbUrl`,n)}catch(t){this.telemetryManager.sendEventError(t,`thumbnail generation. Failed to generate thumb from file`);let n=window.getComputedStyle(this).getPropertyValue(`--uc-muted-foreground`);e.setValue(`thumbUrl`,ou(n))}});return}if(e.getValue(`thumbUrl`))return;let s=e.getValue(`file`);if(s?.type.includes(`image`))try{let t=await ru(s,o);e.setValue(`thumbUrl`,t)}catch(t){this.telemetryManager.sendEventError(t,`thumbnail generation. Failed to generate thumb from file`);let n=window.getComputedStyle(this).getPropertyValue(`--uc-muted-foreground`);e.setValue(`thumbUrl`,ou(n))}else{let t=window.getComputedStyle(this).getPropertyValue(`--uc-muted-foreground`);e.setValue(`thumbUrl`,ou(t))}}),this._debouncedGenerateThumb=C(this._generateThumbnail.bind(this),100)}_calculateThumbSize(e=!1){e&&(this._thumbRect=this.getBoundingClientRect());let t=Math.max(parseInt(String(this?._thumbRect?.height||0),10),parseInt(String(this?._thumbRect?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(t*=window.devicePixelRatio),Math.min(t,su)}_decodeImage(e,t){return new Promise((n,r)=>{let i=new Image;i.decoding=`async`;let a=()=>{i&&=(i.onload=null,i.onerror=null,i.src=Ql,t?.removeEventListener(`abort`,o),null)},o=()=>{a(),r(new DOMException(`Aborted`,`AbortError`))};if(t){if(t.aborted){o();return}t.addEventListener(`abort`,o,{once:!0})}let s=()=>{a(),n()},c=e=>{a(),r(e)};if(typeof i.decode==`function`){i.src=e,i.decode().then(s).catch(c);return}i.onload=s,i.onerror=c,i.src=e})}_cancelPendingThumbUpdate(){this._pendingThumbUpdate?.cancel(),this._pendingThumbUpdate=void 0}_scheduleThumbUpdate(e){if(this._cancelPendingThumbUpdate(),!e){this._thumbUrl&&=``;return}if(e===this._thumbUrl)return;let t=new AbortController,n={controller:t,cancel:()=>{t.abort(),n.rafId!==void 0&&window.cancelAnimationFrame(n.rafId)}};this._pendingThumbUpdate=n,this._decodeImage(e,t.signal).then(()=>{t.signal.aborted||(n.rafId=window.requestAnimationFrame(()=>{t.signal.aborted||(this._thumbUrl=e)}))}).catch(e=>{t.signal.aborted||e instanceof DOMException&&e.name===`AbortError`||console.warn(`[Thumb] Failed to decode thumbnail image`,e)})}_requestThumbGeneration(e=!1){if(this.entry){if(e){this._generateThumbnail(!0);return}this._isIntersecting&&this._debouncedGenerateThumb()}}firstUpdated(e){super.firstUpdated(e),this._bindToEntry()}updated(e){super.updated(e),e.has(`uid`)&&this._bindToEntry()}_observerCallback(e){let[t]=e;t&&(this._isIntersecting=t.isIntersecting,t.isIntersecting&&(this._thumbRect=t.boundingClientRect,this._requestThumbGeneration(),this._observer?.disconnect()),t.intersectionRatio===0&&this._debouncedGenerateThumb.cancel())}reset(){super.reset(),this._debouncedGenerateThumb.cancel(),this._cancelPendingThumbUpdate(),this._thumbUrl&&=``}_bindToEntry(){let e=this.uid?.trim();if(!e){this.entry&&this.reset();return}let t=this.uploadCollection?.read(e);if(!t||t===this.entry)return;this.reset(),this.entry=t;let n=()=>{this._requestThumbGeneration()};this.subEntry(`fileInfo`,e=>{e?.isImage&&n()}),this.subEntry(`thumbUrl`,e=>{this._scheduleThumbUpdate(e??void 0)}),this.subEntry(`cdnUrlModifiers`,n),this._requestThumbGeneration(!0)}initCallback(){super.initCallback(),this.subConfigValue(`filesViewMode`,e=>{e===`grid`&&!this._renderedGridOnce&&(this._firstViewMode===`list`&&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 _`
|
|
40
|
-
<div class="uc-thumb">
|
|
41
|
-
<img
|
|
42
|
-
class="uc-thumb__img"
|
|
43
|
-
src=${this._thumbUrl||`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=`}
|
|
44
|
-
role="img"
|
|
45
|
-
alt="Preview of uploaded image"
|
|
46
|
-
?hidden=${!this._thumbUrl}
|
|
47
|
-
draggable="false"
|
|
48
|
-
/>
|
|
49
|
-
<div class="uc-badge">
|
|
50
|
-
<uc-icon name=${this.badgeIcon}></uc-icon>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
`}};w([b({type:String})],cu.prototype,`badgeIcon`,void 0),w([b({attribute:!1})],cu.prototype,`uid`,void 0),w([x()],cu.prototype,`_thumbUrl`,void 0);var lu=n((()=>{})),uu,du=n((()=>{B(),lu(),uu=class extends z{}}));y(),B();var fu=class extends z{constructor(...e){super(...e),this.historyTracked=!0,this.activityType=z.activities.START_FROM}initCallback(){super.initCallback(),this.registerActivity(this.activityType??``)}render(){return _` <div class="uc-content">${this.yield(``)}</div> `}};H(),P();var pu=class extends V{constructor(...e){super(...e),this._unbindEventEmitter=null}static{this.styleAttrs=[`uc-wgt-common`]}static{this.EventType=N}initCallback(){super.initCallback(),this._unbindEventEmitter=this.eventEmitter.bindTarget(this)}disconnectedCallback(){super.disconnectedCallback(),this._unbindEventEmitter?.()}},mu,hu=n((()=>{mu=(e,t)=>{let n=!1,r,i=0,a=((...a)=>{n?(r&&clearTimeout(r),r=setTimeout(()=>{Date.now()-i>=t&&(e(...a),i=Date.now())},Math.max(t-(Date.now()-i),0))):(e(...a),i=Date.now(),n=!0)});return Object.defineProperty(a,`cancel`,{configurable:!1,writable:!1,enumerable:!1,value:()=>{r&&clearTimeout(r)}}),a}}));hu(),pt(),Bo(),El();var gu=(e,t,n)=>{let r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},_u=Ro(class extends zo{constructor(e){if(super(e),e.type!==Lo.CHILD)throw Error(`repeat() can only be used in text expressions`)}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);let i=[],a=[],o=0;for(let t of e)i[o]=r?r(t,o):o,a[o]=n(t,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){let i=wl(e),{values:a,keys:o}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=o,a;let s=this.ut??=[],c=[],l,u,d=0,f=i.length-1,p=0,m=a.length-1;for(;d<=f&&p<=m;)if(i[d]===null)d++;else if(i[f]===null)f--;else if(s[d]===o[p])c[p]=xl(i[d],a[p]),d++,p++;else if(s[f]===o[m])c[m]=xl(i[f],a[m]),f--,m--;else if(s[d]===o[m])c[m]=xl(i[d],a[m]),bl(e,c[m+1],i[d]),d++,m--;else if(s[f]===o[p])c[p]=xl(i[f],a[p]),bl(e,i[d],i[f]),f--,p++;else if(l===void 0&&(l=gu(o,p,m),u=gu(s,d,f)),l.has(s[d]))if(l.has(s[f])){let t=u.get(o[p]),n=t===void 0?null:i[t];if(n===null){let t=bl(e,i[d]);xl(t,a[p]),c[p]=t}else c[p]=xl(n,a[p]),bl(e,i[d],n),i[t]=null;p++}else Tl(i[f]),f--;else Tl(i[d]),d++;for(;p<=m;){let t=bl(e,c[m+1]);xl(t,a[p]),c[p++]=t}for(;d<=f;){let e=i[d++];e!==null&&Tl(e)}return this.ut=o,Cl(e,c),Qe}});ua(),y(),S(),nn(),oc(),T();var K=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`)}),q=class e extends iu{constructor(...e){super(...e),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=C(()=>this._calculateState(),100),this._updateHintAndProgress=this.withEntry(mu((e,t)=>{let n=e.getValue(`errors`)?.[0]?.message??``,r=e.getValue(`source`),i=e.getValue(`externalUrl`),a=t===K.FINISHED,o=t===K.UPLOADING,s=t===K.QUEUED_UPLOADING,c=t===K.QUEUED_VALIDATION,l=t===K.VALIDATION,u=e.getValue(`fileName`),d=``;n?d=``:!a&&i&&r&&Object.values(ic).includes(r)&&(d=this.l10n(`waiting-for`,{source:this.l10n(`src-type-${r}`)})),this._hint=d,this._errorText=n,this._progressVisible=o||s||c||l,this._progressValue=c||l?0:e.getValue(`uploadProgress`),this._ariaLabelStatusFile=u?this.l10n(`a11y-file-item-status`,{fileName:u,status:this.l10n(t?.description?.toLocaleLowerCase()??``).toLocaleLowerCase()}):``},100)),this._upload=this.withEntry(async e=>{if(!this.uploadCollection.read(e.uid)||e.getValue(`fileInfo`)||e.getValue(`isUploading`)||e.getValue(`errors`).length>0||e.getValue(`isValidationPending`))return;let t=this.cfg.multiple?this.cfg.multipleMax:1;if(!(t&&this.uploadCollection.size>t)){e.setMultipleValues({isUploading:!0,errors:[],isQueuedForUploading:!0}),this._debouncedCalculateState();try{let t=new AbortController;e.setValue(`abortController`,t);let n=await this.$[`*uploadQueue`].add(async()=>{e.setValue(`isQueuedForUploading`,!1);let n=e.getValue(`file`);if(n instanceof File||n instanceof Blob){let t=(this._sharedInstancesBag.pluginManager?.snapshot().fileHooks??[]).filter(e=>e.type===`beforeUpload`);for(let r of t)try{let{file:t,mimeType:i}=await r.handler({file:n,mimeType:e.getValue(`mimeType`)});n=t,i!==e.getValue(`mimeType`)&&e.setValue(`mimeType`,i)}catch(e){this.debugPrint(`File hook "beforeUpload" from plugin "${r.pluginId}" failed`,e)}}let r=n||e.getValue(`externalUrl`)||e.getValue(`uuid`);if(!r)throw Error(`No file input`);let i={...await this.getUploadClientOptions(),fileName:e.getValue(`fileName`)??void 0,source:e.getValue(`source`)??void 0,onProgress:t=>{if(t.isComputable){let n=t.value*100;e.setValue(`uploadProgress`,n)}},signal:t.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint(`upload options`,r,i),Xr(r,i)});e.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:e.getValue(`cdnUrl`)??n.cdnUrl,cdnUrlModifiers:e.getValue(`cdnUrlModifiers`)??``,uploadProgress:100,source:e.getValue(`source`)??null}),e===this.entry&&this._debouncedCalculateState()}catch(t){this.telemetryManager.sendEventError(t,`file upload. Failed to upload file`),t instanceof ii&&t.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):t instanceof ti?e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:t}):(console.error(`Unknown upload error`,t),e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:Error(`Something went wrong`,{cause:t})})),e===this.entry&&this._debouncedCalculateState()}}})}_calculateState(){let e=this.entry;if(!e)return;let t=K.IDLE;e.getValue(`errors`).length>0?t=K.FAILED:e.getValue(`isQueuedForUploading`)?t=K.QUEUED_UPLOADING:e.getValue(`isQueuedForValidation`)?t=K.QUEUED_VALIDATION:e.getValue(`isValidationPending`)?t=K.VALIDATION:e.getValue(`isUploading`)?t=K.UPLOADING:e.getValue(`fileInfo`)&&(t=K.FINISHED),this._handleState(e,t)}_handleState(e,t){t===K.FAILED?this._badgeIcon=`badge-error`:t===K.FINISHED&&(this._badgeIcon=`badge-success`),t===K.UPLOADING&&(this._isFocused=!1,this.removeAttribute(`focused`)),this._isFailed=t===K.FAILED,this._isUploading=t===K.UPLOADING,this._isFinished=t===K.FINISHED,this._updateHintAndProgress(t)}reset(){super.reset(),this._debouncedCalculateState.cancel()}_observerCallback(e){let[t]=e;t&&t.isIntersecting&&!this._renderedOnce&&(this._pauseRender=!1,this._renderedOnce=!0)}_handleEntryId(e){this.reset();let t=this.uploadCollection?.read(e);if(this.entry=t,!t){this._updatePluginFileActions();return}this.subEntry(`isQueuedForValidation`,()=>{this._debouncedCalculateState()}),this.subEntry(`isValidationPending`,()=>{this._debouncedCalculateState()}),this.subEntry(`uploadProgress`,()=>{this._debouncedCalculateState()}),this.subEntry(`isQueuedForUploading`,()=>{this._debouncedCalculateState()}),this.subEntry(`fileName`,e=>{this._itemName=e||t.getValue(`externalUrl`)||this.l10n(`file-no-name`),this._debouncedCalculateState()}),this.subEntry(`externalUrl`,e=>{this._itemName=t.getValue(`fileName`)||e||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(t)}async _applyOnAddHooks(e){let t=e.getValue(`file`);if(!t)return;let n=(this._sharedInstancesBag.pluginManager?.snapshot().fileHooks??[]).filter(e=>e.type===`onAdd`),r=t,i=e.getValue(`mimeType`);for(let e of n)try{({file:r,mimeType:i}=await e.handler({file:r,mimeType:i}))}catch(t){this.debugPrint(`File hook "onAdd" from plugin "${e.pluginId}" failed`,t)}r!==t&&(e.setValue(`file`,r),e.setValue(`fileSize`,r.size)),i!==e.getValue(`mimeType`)&&e.setValue(`mimeType`,i)}_updateShowFileNames(e){if(this.cfg.filesViewMode===`list`){this._showFileNames=!0;return}this._showFileNames=e}willUpdate(e){super.willUpdate(e),e.has(`uid`)&&this._handleEntryId(this.uid)}_updatePluginFileActions(){let e=this._sharedInstancesBag.pluginManager;if(!e||!this.uid){this._pluginFileActions=[];return}let t=e.snapshot().fileActions,n=this.api.getOutputItem(this.uid);if(!n){this._pluginFileActions=[];return}this._pluginFileActions=t.filter(e=>{try{return e.shouldRender(n)}catch(t){return console.error(`Error in plugin file action shouldRender (${e.id}):`,t),!1}})}_handlePluginFileAction(e){if(!this.uid)return;let t=this.api.getOutputItem(this.uid);if(t)try{e.onClick(t)}catch(t){console.error(`Error in plugin file action onClick (${e.id}):`,t)}}initCallback(){super.initCallback(),this._handleEntryId(this.uid),this.subConfigValue(`filesViewMode`,e=>{this._updateShowFileNames(this.cfg.gridShowFileNames),this.setAttribute(`mode`,e)}),this.subConfigValue(`gridShowFileNames`,e=>{this._updateShowFileNames(e)}),this.onclick=()=>{e.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._upload())});let t=this._sharedInstancesBag.pluginManager;t?.onPluginsChange&&(this._unsubscribePlugins=t.onPluginsChange(()=>this._updatePluginFileActions())),this._updatePluginFileActions(),e.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(),e.activeInstances.delete(this),this.reset()}static{this.activeInstances=new Set}shouldUpdate(e){return this._pauseRender?!1:super.shouldUpdate(e)}render(){return _`
|
|
54
|
-
<div
|
|
55
|
-
class="uc-inner"
|
|
56
|
-
?data-finished=${this._isFinished}
|
|
57
|
-
?data-uploading=${this._isUploading}
|
|
58
|
-
?data-failed=${this._isFailed}
|
|
59
|
-
?data-focused=${this._isFocused}
|
|
60
|
-
>
|
|
61
|
-
<uc-thumb .uid=${this.uid} .badgeIcon=${this._badgeIcon}></uc-thumb>
|
|
62
|
-
|
|
63
|
-
<div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this._ariaLabelStatusFile}>
|
|
64
|
-
<span class="uc-file-name" ?hidden=${!this._showFileNames}>${this._itemName}</span>
|
|
65
|
-
<span class="uc-file-error" ?hidden=${!this._errorText}>${this._errorText}</span>
|
|
66
|
-
<span class="uc-file-hint" ?hidden=${!this._hint}>${this._hint}</span>
|
|
67
|
-
</div>
|
|
68
|
-
<div class="uc-file-actions">
|
|
69
|
-
${this._pluginFileActions.map(e=>_`
|
|
70
|
-
<button
|
|
71
|
-
type="button"
|
|
72
|
-
@click=${()=>this._handlePluginFileAction(e)}
|
|
73
|
-
title=${e.id}
|
|
74
|
-
aria-label=${e.id}
|
|
75
|
-
class="uc-plugin-action-btn uc-mini-btn"
|
|
76
|
-
data-plugin-action-id=${e.id}
|
|
77
|
-
>
|
|
78
|
-
<uc-icon name=${e.icon}></uc-icon>
|
|
79
|
-
</button>
|
|
80
|
-
`)}
|
|
81
|
-
<button
|
|
82
|
-
type="button"
|
|
83
|
-
@click=${this._handleRemove}
|
|
84
|
-
title=${this.l10n(`file-item-remove-button`)}
|
|
85
|
-
aria-label=${this.l10n(`file-item-remove-button`)}
|
|
86
|
-
class="uc-remove-btn uc-mini-btn"
|
|
87
|
-
>
|
|
88
|
-
<uc-icon name="remove-file"></uc-icon>
|
|
89
|
-
</button>
|
|
90
|
-
<button type="button" class="uc-upload-btn uc-mini-btn" @click=${this._handleUploadClick}>
|
|
91
|
-
<uc-icon name="upload"></uc-icon>
|
|
92
|
-
</button>
|
|
93
|
-
</div>
|
|
94
|
-
<uc-progress-bar class="uc-progress-bar" .value=${this._progressValue} .visible=${this._progressVisible} ?hasFileName=${this._showFileNames}>
|
|
95
|
-
</uc-progress-bar>
|
|
96
|
-
</div>
|
|
97
|
-
`}};w([x()],q.prototype,`_pauseRender`,void 0),w([b({attribute:!1})],q.prototype,`uid`,void 0),w([x()],q.prototype,`_itemName`,void 0),w([x()],q.prototype,`_errorText`,void 0),w([x()],q.prototype,`_hint`,void 0),w([x()],q.prototype,`_progressValue`,void 0),w([x()],q.prototype,`_progressVisible`,void 0),w([x()],q.prototype,`_badgeIcon`,void 0),w([x()],q.prototype,`_isFinished`,void 0),w([x()],q.prototype,`_isFailed`,void 0),w([x()],q.prototype,`_isUploading`,void 0),w([x()],q.prototype,`_isFocused`,void 0),w([x()],q.prototype,`_showFileNames`,void 0),w([x()],q.prototype,`_ariaLabelStatusFile`,void 0),w([x()],q.prototype,`_pluginFileActions`,void 0);function vu(e){return new Promise(t=>{typeof window.FileReader!=`function`&&t(!1);try{let n=new FileReader;n.onerror=()=>{t(!0)};let r=e=>{e.type!==`loadend`&&n.abort(),t(!1)};n.onloadend=r,n.onprogress=r,n.readAsDataURL(e)}catch{t(!1)}})}function yu(e,t){return new Promise(n=>{let r=0,i=[],a=e=>{if(!e){console.warn(`Unexpectedly received empty content entry`,{scope:`drag-and-drop`}),n(null);return}e.isFile?(r++,e.file(a=>{r--;let o=new File([a],a.name,{type:a.type||t});i.push({type:`file`,file:o,fullPath:e.fullPath}),r===0&&n(i)})):e.isDirectory&&o(e.createReader())},o=e=>{r++,e.readEntries(e=>{r--;for(let t of e)a(t);r===0&&n(i)})};a(e)})}function bu(e){let t=[],n=[];for(let r=0;r<e.items.length;r++){let i=e.items[r];if(i)if(i.kind===`file`){let e=i.type,r=i;if(typeof r.webkitGetAsEntry==`function`||typeof r.getAsEntry==`function`){let i=typeof r.webkitGetAsEntry==`function`?r.webkitGetAsEntry():r.getAsEntry?.();i&&n.push(yu(i,e).then(e=>{e&&t.push(...e)}));continue}let a=i.getAsFile();a&&n.push(vu(a).then(e=>{e||t.push({type:`file`,file:a})}))}else i.kind===`string`&&/^text\/uri-list/.test(i.type)&&n.push(new Promise(e=>{i.getAsString(n=>{t.push({type:`url`,url:n}),e()})}))}return Promise.all(n).then(()=>t)}let J=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3});var xu=[`focus`],Su=100,Cu=new Map;function wu(e,t){let n=Math.max(Math.min(e[0],t.x+t.width),t.x),r=Math.max(Math.min(e[1],t.y+t.height),t.y);return Math.sqrt((e[0]-n)*(e[0]-n)+(e[1]-r)*(e[1]-r))}function Tu(e){let t=0,n=document.body,r=new Set,i=e=>{r.add(e)},a=J.INACTIVE,o=t=>{e.shouldIgnore()&&t!==J.INACTIVE||(a!==t&&r.forEach(e=>{e(t)}),a=t)},s=()=>t>0;i(t=>e.onChange(t));let c=()=>{t=0,o(J.INACTIVE)},l=()=>{t+=1,a===J.INACTIVE&&o(J.ACTIVE)},u=()=>{--t,s()||o(J.INACTIVE)},d=e=>{e.preventDefault(),t=0,o(J.INACTIVE)},f=n=>{if(e.shouldIgnore())return;s()||(t+=1);let r=[n.x,n.y],i=e.element.getBoundingClientRect(),a=Math.floor(wu(r,i)),c=a<Su,l=n.composedPath().includes(e.element);Cu.set(e.element,a);let u=Math.min(...Cu.values())===a;l&&u?(n.preventDefault(),o(J.OVER)):o(c&&u?J.NEAR:J.ACTIVE)},p=async t=>{if(e.shouldIgnore())return;t.preventDefault();let{dataTransfer:n}=t;if(!n)return;let r=await bu(n);e.onItems(r),o(J.INACTIVE)};return n.addEventListener(`drop`,d),n.addEventListener(`dragleave`,u),n.addEventListener(`dragenter`,l),n.addEventListener(`dragover`,f),e.element.addEventListener(`drop`,p),xu.forEach(e=>{window.addEventListener(e,c)}),()=>{Cu.delete(e.element),n.removeEventListener(`drop`,d),n.removeEventListener(`dragleave`,u),n.removeEventListener(`dragenter`,l),n.removeEventListener(`dragover`,f),e.element.removeEventListener(`drop`,p),xu.forEach(e=>{window.removeEventListener(e,c)})}}y(),S(),G(),B(),H(),Vn(),oc(),T();var Eu=new Set,Du=class extends V{constructor(...e){super(...e),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=U(),this._handleAreaInteraction=e=>{if(e instanceof KeyboardEvent){if(e.code!==`Space`&&e.code!==`Enter`)return}else if(!(e instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog()},this._sourceListAllowsLocal=!0,this._clickableListenersAttached=!1}static{this.styleAttrs=[...super.styleAttrs,`uc-drop-area`]}get _localizedText(){let e=this.text;return typeof e==`string`&&e.length>0?this.l10n(e)||e:this.l10n(`drop-files-here`)}isActive(){if(!this._isEnabled)return!1;let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,n=e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),i=r.visibility!==`hidden`&&r.display!==`none`;return t&&i&&n}initCallback(){super.initCallback(),Eu.add(this),this._updateIsEnabled(),this._updateVisibility(),this._updateClickableListeners(),this._updateDragStateAttribute(J.INACTIVE),this._destroyDropzone=Tu({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:e=>{this._updateDragStateAttribute(e)},onItems:e=>{e.length&&(e.forEach(e=>{e.type===`url`?this.api.addFileFromUrl(e.url,{source:R.DROP_AREA}):e.type===`file`&&this.api.addFileFromObject(e.file,{source:R.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":z.activities.UPLOAD_LIST}),this.modalManager?.open(z.activities.UPLOAD_LIST)))}}),this.updateComplete.then(()=>this._setupContentWrapperDropzone()),this.subConfigValue(`sourceList`,e=>{this._sourceListAllowsLocal=Bn(e).includes(R.LOCAL),this._updateIsEnabled(),this._updateVisibility()})}willUpdate(e){super.willUpdate(e),e.has(`disabled`)&&(this._updateIsEnabled(),this._updateVisibility())}updated(e){super.updated(e),e.has(`clickable`)&&this._updateClickableListeners()}_shouldIgnore(){if(!this._isEnabled||!this._couldHandleFiles())return!0;if(!this.fullscreen)return!1;let e=Eu;return e.size===0?!1:[...e].filter(e=>e!==this).filter(e=>e.isActive()).length>0}_couldHandleFiles(){let e=this.cfg.multiple,t=this.cfg.multipleMax,n=this.uploadCollection.size;return!(e&&t&&n>=t||!e&&n>0)}_updateIsEnabled(){this._isEnabled=this._sourceListAllowsLocal&&!this.disabled}_updateVisibility(){let e=this._isEnabled||!this.querySelector(`[data-default-slot]`);this._isVisible=e,this.hidden=!e}_updateDragStateAttribute(e){let t=Object.entries(J).find(([,t])=>t===e)?.[0].toLowerCase();t&&this.setAttribute(`drag-state`,t)}_setupContentWrapperDropzone(){if(this._destroyContentWrapperDropzone)return;let e=this._contentWrapperRef.value;e&&(this._destroyContentWrapperDropzone=Tu({element:e,onChange:t=>{let n=Object.entries(J).find(([,e])=>e===t)?.[0].toLowerCase();n&&e.setAttribute(`drag-state`,n)},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(),Eu.delete(this),this._destroyDropzone?.(),this._destroyContentWrapperDropzone?.(),this._clickableListenersAttached&&=(this.removeEventListener(`keydown`,this._handleAreaInteraction),this.removeEventListener(`click`,this._handleAreaInteraction),!1)}render(){return _`
|
|
98
|
-
${this.yield(``,_`<div data-default-slot hidden></div>
|
|
99
|
-
<div ${W(this._contentWrapperRef)} class="uc-content-wrapper" ?hidden=${!this._isVisible}>
|
|
100
|
-
<div class="uc-icon-container" ?hidden=${!this.withIcon}>
|
|
101
|
-
<uc-icon name="default"></uc-icon>
|
|
102
|
-
<uc-icon name="arrow-down"></uc-icon>
|
|
103
|
-
</div>
|
|
104
|
-
<span class="uc-text">${this._localizedText}</span>
|
|
105
|
-
</div>`)}
|
|
106
|
-
`}};w([b({type:Boolean,noAccessor:!0})],Du.prototype,`single`,void 0),w([b({type:Boolean,noAccessor:!0})],Du.prototype,`ghost`,void 0),w([b({type:Boolean,reflect:!0})],Du.prototype,`disabled`,void 0),w([b({type:Boolean,reflect:!0})],Du.prototype,`clickable`,void 0),w([b({type:Boolean,attribute:`with-icon`,reflect:!0})],Du.prototype,`withIcon`,void 0),w([b({type:Boolean,reflect:!0})],Du.prototype,`fullscreen`,void 0),w([b({type:Boolean,reflect:!0})],Du.prototype,`initflow`,void 0),w([b({type:String})],Du.prototype,`text`,void 0),w([x()],Du.prototype,`_isEnabled`,void 0),w([x()],Du.prototype,`_isVisible`,void 0),y(),S(),B(),H(),hu(),P(),T();var Ou=class extends V{constructor(...e){super(...e),this.couldBeCtxOwner=!0,this.historyTracked=!0,this.activityType=z.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:M.ACTION_EVENT,payload:{metadata:{event:`add-more`,node:this.tagName}}}),this.api.initFlow(!0)},this._handleUpload=()=>{this.emit(N.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},this._handleDone=()=>{this.emit(N.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},this._handleCancel=()=>{this.telemetryManager.sendEvent({eventType:M.ACTION_EVENT,payload:{metadata:{event:`clear-all`,node:this.tagName}}}),this.uploadCollection.clearAll()},this._throttledHandleCollectionUpdate=mu(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$[`*currentActivity`]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll())},300)}get _headerText(){return this._latestSummary?this._getHeaderText(this._latestSummary):``}_updateUploadsState(){let e=this.api.getOutputCollectionState(),t={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount,validatingBeforeUploading:e.idleEntries.filter(e=>e.isValidationPending).length},n=!e.errors.some(e=>e.type===`TOO_MANY_FILES`||e.type===`TOO_FEW_FILES`),r=e.errors.some(e=>e.type===`TOO_MANY_FILES`),i=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=e.allEntries.some(e=>e.isValidationPending),o=t.failed===0&&e.errors.length===0&&!a,s=!1,c=!1,l=!1;if(t.total-t.succeed-t.uploading-t.failed>0&&n&&o&&this.cfg.confirmUpload)s=!0;else{c=!0;let r=this.cfg.groupOutput?!!e.group:!0;l=t.total===t.succeed&&n&&o&&r}this._doneBtnVisible=c,this._doneBtnEnabled=l,this._uploadBtnVisible=s,this._addMoreBtnEnabled=t.total===0||!r&&!i,this._addMoreBtnVisible=!i||this.cfg.multiple,this._hasFiles=t.total>0,this._latestSummary=t}_getHeaderText(e){let t=t=>{let n=e[t];return t===`uploading`&&(n+=e.validatingBeforeUploading),this.l10n(`header-${t}`,{count:n})};return e.uploading>0||e.validatingBeforeUploading>0?t(`uploading`):e.failed>0?t(`failed`):e.succeed>0?t(`succeed`):t(`total`)}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue(`multiple`,this._throttledHandleCollectionUpdate),this.subConfigValue(`multipleMin`,this._throttledHandleCollectionUpdate),this.subConfigValue(`multipleMax`,this._throttledHandleCollectionUpdate),this.sub(`*groupInfo`,e=>{e&&this._throttledHandleCollectionUpdate()}),this.subConfigValue(`filesViewMode`,e=>{this.setAttribute(`mode`,e)}),this.sub(`*currentActivity`,e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$[`*currentActivity`]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.uploadCollection.observeCollection(this._throttledHandleCollectionUpdate),this.sub(`*collectionErrors`,e=>{let t=e.filter(e=>e.type!==`SOME_FILES_HAS_ERRORS`)[0];if(!t){this._commonErrorMessage=null;return}this._commonErrorMessage=t.message})}disconnectedCallback(){super.disconnectedCallback(),this.has(`*uploadCollection`)&&(this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate),this.uploadCollection.unobserveCollection(this._throttledHandleCollectionUpdate))}render(){return _`
|
|
107
|
-
<uc-activity-header>
|
|
108
|
-
<span aria-live="polite" class="uc-header-text">${this._headerText}</span>
|
|
109
|
-
<button
|
|
110
|
-
type="button"
|
|
111
|
-
class="uc-mini-btn uc-close-btn"
|
|
112
|
-
@click=${this.$[`*closeModal`]}
|
|
113
|
-
title=${this.l10n(`a11y-activity-header-button-close`)}
|
|
114
|
-
aria-label=${this.l10n(`a11y-activity-header-button-close`)}
|
|
115
|
-
>
|
|
116
|
-
<uc-icon name="close"></uc-icon>
|
|
117
|
-
</button>
|
|
118
|
-
</uc-activity-header>
|
|
119
|
-
|
|
120
|
-
<div class="uc-no-files" ?hidden=${this._hasFiles}>
|
|
121
|
-
${this.yield(`empty`,_`<span>${this.l10n(`no-files`)}</span>`)}
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
<div class="uc-files">
|
|
125
|
-
<div class="uc-files-wrapper">
|
|
126
|
-
${_u(this.$[`*uploadList`]??[],({uid:e})=>e,({uid:e})=>_`<uc-file-item .uid=${e}></uc-file-item>`)}
|
|
127
|
-
</div>
|
|
128
|
-
<button
|
|
129
|
-
type="button"
|
|
130
|
-
class="uc-add-more-btn uc-secondary-btn"
|
|
131
|
-
@click=${this._handleAdd}
|
|
132
|
-
?disabled=${!this._addMoreBtnEnabled}
|
|
133
|
-
?hidden=${!this._addMoreBtnVisible}
|
|
134
|
-
>
|
|
135
|
-
<uc-icon name="add"></uc-icon><span>${this.l10n(`add-more`)}</span>
|
|
136
|
-
</button>
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
<div class="uc-common-error"
|
|
140
|
-
?hidden=${!this._commonErrorMessage}
|
|
141
|
-
>
|
|
142
|
-
${this._commonErrorMessage??``}
|
|
143
|
-
</div>
|
|
144
|
-
|
|
145
|
-
<div class="uc-toolbar">
|
|
146
|
-
<button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this._handleCancel}>${this.l10n(`clear`)}</button>
|
|
147
|
-
<div class="uc-toolbar-spacer"></div>
|
|
148
|
-
<button
|
|
149
|
-
type="button"
|
|
150
|
-
class="uc-add-more-btn uc-secondary-btn"
|
|
151
|
-
?hidden=${!this._addMoreBtnVisible}
|
|
152
|
-
?disabled=${!this._addMoreBtnEnabled}
|
|
153
|
-
@click=${this._handleAdd}
|
|
154
|
-
>
|
|
155
|
-
<uc-icon name="add"></uc-icon><span>${this.l10n(`add-more`)}</span>
|
|
156
|
-
</button>
|
|
157
|
-
<button
|
|
158
|
-
type="button"
|
|
159
|
-
class="uc-upload-btn uc-primary-btn"
|
|
160
|
-
?hidden=${!this._uploadBtnVisible}
|
|
161
|
-
@click=${this._handleUpload}
|
|
162
|
-
>${this.l10n(`upload`)}</button>
|
|
163
|
-
<button
|
|
164
|
-
type="button"
|
|
165
|
-
class="uc-done-btn uc-primary-btn"
|
|
166
|
-
?hidden=${!this._doneBtnVisible}
|
|
167
|
-
?disabled=${!this._doneBtnEnabled}
|
|
168
|
-
@click=${this._handleDone}
|
|
169
|
-
>
|
|
170
|
-
${this.l10n(`done`)}
|
|
171
|
-
</button>
|
|
172
|
-
</div>
|
|
173
|
-
|
|
174
|
-
<uc-drop-area ghost></uc-drop-area>
|
|
175
|
-
`}};w([x()],Ou.prototype,`_doneBtnVisible`,void 0),w([x()],Ou.prototype,`_doneBtnEnabled`,void 0),w([x()],Ou.prototype,`_uploadBtnVisible`,void 0),w([x()],Ou.prototype,`_addMoreBtnVisible`,void 0),w([x()],Ou.prototype,`_addMoreBtnEnabled`,void 0),w([x()],Ou.prototype,`_commonErrorMessage`,void 0),w([x()],Ou.prototype,`_hasFiles`,void 0),w([x()],Ou.prototype,`_latestSummary`,void 0);var ku=n((()=>{})),Au=r({UrlSource:()=>ju},1),ju,Mu=n((()=>{y(),S(),G(),B(),H(),oc(),P(),ku(),T(),ju=class extends V{constructor(...e){super(...e),this._formState={importDisabled:!0},this._inputRef=U(),this._handleInput=e=>{this._formState={importDisabled:!(e.target?.value??``)}},this._handleUpload=e=>{e.preventDefault(),this.telemetryManager.sendEvent({eventType:M.ACTION_EVENT,payload:{metadata:{event:`upload-from-url`,node:this.tagName}}});let t=this._inputRef.value?.value?.trim();t&&(this.api.addFileFromUrl(t,{source:R.URL}),this.$[`*currentActivity`]=z.activities.UPLOAD_LIST,this.modalManager?.open(z.activities.UPLOAD_LIST))}}firstUpdated(){let e=this._inputRef.value;e&&(e.value=``,e.focus())}render(){return _`
|
|
176
|
-
<uc-activity-header>
|
|
177
|
-
<button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n(`back`)} aria-label=${this.l10n(`back`)}>
|
|
178
|
-
<uc-icon name="back"></uc-icon>
|
|
179
|
-
</button>
|
|
180
|
-
<div>
|
|
181
|
-
<uc-icon name="url"></uc-icon>
|
|
182
|
-
<span>${this.l10n(`caption-from-url`)}</span>
|
|
183
|
-
</div>
|
|
184
|
-
<button
|
|
185
|
-
type="button"
|
|
186
|
-
class="uc-mini-btn uc-close-btn"
|
|
187
|
-
@click=${this.$[`*closeModal`]}
|
|
188
|
-
title=${this.l10n(`a11y-activity-header-button-close`)}
|
|
189
|
-
aria-label=${this.l10n(`a11y-activity-header-button-close`)}
|
|
190
|
-
>
|
|
191
|
-
<uc-icon name="close"></uc-icon>
|
|
192
|
-
</button>
|
|
193
|
-
</uc-activity-header>
|
|
194
|
-
<form class="uc-content" @submit=${this._handleUpload}>
|
|
195
|
-
<label>
|
|
196
|
-
<input
|
|
197
|
-
${W(this._inputRef)}
|
|
198
|
-
placeholder="https://"
|
|
199
|
-
class="uc-url-input"
|
|
200
|
-
type="text"
|
|
201
|
-
@input=${this._handleInput}
|
|
202
|
-
/>
|
|
203
|
-
</label>
|
|
204
|
-
<button
|
|
205
|
-
type="submit"
|
|
206
|
-
class="uc-url-upload-btn uc-primary-btn"
|
|
207
|
-
?disabled=${this._formState.importDisabled}
|
|
208
|
-
>${this.l10n(`upload-url`)}</button>
|
|
209
|
-
</form>
|
|
210
|
-
`}},w([x()],ju.prototype,`_formState`,void 0)})),Nu,Pu=n((()=>{Nu=()=>navigator.permissions!==void 0})),Fu=n((()=>{})),Iu,Lu,Ru,zu=n((()=>{pt(),Bo(),Iu=`important`,Lu=` !`+Iu,Ru=Ro(class extends zo{constructor(e){if(super(e),e.type!==Lo.ATTRIBUTE||e.name!==`style`||e.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(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n=n.includes(`-`)?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,`-$&`).toLowerCase()}:${r};`},``)}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let e of this.ft)t[e]??(this.ft.delete(e),e.includes(`-`)?n.removeProperty(e):n[e]=null);for(let e in t){let r=t[e];if(r!=null){this.ft.add(e);let t=typeof r==`string`&&r.endsWith(Lu);e.includes(`-`)||t?n.setProperty(e,t?r.slice(0,-11):r,t?Iu:``):n[e]=r}}return Qe}})})),Bu=n((()=>{zu()})),Vu=r({CameraSource:()=>Y},1);function Hu(e){return`${Math.floor(e/60).toString().padStart(2,`0`)}:${Math.floor(e%60).toString().padStart(2,`0`)}`}var Uu,Wu,Gu,Ku,Y,qu=n((()=>{y(),S(),B(),H(),Pu(),En(),nn(),Vn(),oc(),P(),Fu(),G(),Bu(),Ks(),T(),Uu={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Wu=[`camera`,`microphone`],Gu=`image/jpeg`,Ku=`video/webm`,Y=class extends V{constructor(...e){super(...e),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=U(),this._lineRef=U(),this._videoRef=U(),this._switcherRef=U(),this._startTime=0,this._elapsedTime=0,this._videoTransformCss=null,this._videoHidden=!0,this._messageHidden=!0,this._requestBtnHidden=Nu(),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:M.ACTION_EVENT,payload:{metadata:{event:`start-camera`,node:this.tagName,tabId:this._activeTab}}}),this._activeTab===L.PHOTO&&this._shot(),this._activeTab===L.VIDEO){if(this._mediaRecorder?.state===`recording`){this._stopRecording();return}this._startRecording()}},this._handleCameraSelectChange=e=>{let t=e.target;t&&(this._selectedCameraId=t.value,this._capture())},this._handleAudioSelectChange=e=>{let t=e.target;t&&(this._selectedAudioId=t.value,this._capture())},this._handleRequestPermissions=()=>{this._capture()},this._handleStartCamera=()=>{this.telemetryManager.sendEvent({eventType:M.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:M.ACTION_EVENT,payload:{metadata:{event:`retake-camera`,node:this.tagName,tabId:this._activeTab}}}),this._retake()},this._handleAccept=()=>{this.telemetryManager.sendEvent({eventType:M.ACTION_EVENT,payload:{metadata:{event:`accept-camera`,node:this.tagName,tabId:this._activeTab}}}),this._accept()},this._handleClickTab=e=>{let t=e.currentTarget?.getAttribute(`data-id`);t&&this._handleActiveTab(t)},this._updateTimer=()=>{let e=Math.floor((performance.now()-this._startTime+this._elapsedTime)/1e3);if(typeof this.cfg.maxVideoRecordingDuration==`number`&&this.cfg.maxVideoRecordingDuration>0){let t=this.cfg.maxVideoRecordingDuration-e;if(t<=0){let e=this._timerRef.value;e&&(e.textContent=Hu(t)),this._stopRecording();return}let n=this._timerRef.value;n&&(n.textContent=Hu(t))}else{let t=this._timerRef.value;t&&(t.textContent=Hu(e))}this._animationFrameId=requestAnimationFrame(this._updateTimer)},this._startTimer=()=>{this._startTime=performance.now(),this._elapsedTime=0,this._updateTimer()},this._stopTimer=()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},this._startTimeline=()=>{let e=this._videoRef.value;if(!e)return;let t=e.currentTime,n=e.duration||1,r=this._lineRef.value;r&&(r.style.transform=`scaleX(${t/n})`);let i=this._timerRef.value;i&&(i.textContent=Hu(t)),this._animationFrameId=requestAnimationFrame(this._startTimeline)},this._stopTimeline=()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},this._animationFrameId=null,this._startRecording=()=>{try{this._chunks=[],this._options={...this.cfg.mediaRecorderOptions};let{mimeType:e}=this.cfg.mediaRecorderOptions||{};e&&MediaRecorder.isTypeSupported(e)?this._options.mimeType=e:MediaRecorder.isTypeSupported(Ku)?this._options.mimeType=Ku:this._options.mimeType=`video/mp4`,this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener(`dataavailable`,e=>{this._chunks.push(e.data)}),this._startTimer(),this.classList.add(`uc-recording`),this._setCameraState(Gs.PLAY))}catch(e){console.error(`Failed to start recording`,e),this.telemetryManager.sendEventError(e,`camera recording. Failed to start recording`)}},this._stopRecording=()=>{this._mediaRecorder?.addEventListener(`stop`,()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(Gs.STOP)}),this._mediaRecorder?.stop(),this.classList.remove(`uc-recording`),this.telemetryManager.sendEvent({eventType:M.ACTION_EVENT,payload:{metadata:{event:`stop-camera`,node:this.tagName,tabId:this._activeTab}}})},this._toggleRecording=()=>{if(this._mediaRecorder?.state===`recording`)return;let e=this._videoRef.value;e&&(!e.paused&&!e.ended&&e.readyState>2?e.pause():e.paused&&e.play())},this._toggleEnableAudio=()=>{this._stream?.getAudioTracks().forEach(e=>{e.enabled=!e.enabled,this._toggleMicrophoneIcon=e.enabled?`microphone`:`microphone-mute`,this._audioSelectDisabled=!e.enabled})},this._previewVideo=()=>{try{let e=new Blob(this._chunks,{type:this._mediaRecorder?.mimeType}),t=URL.createObjectURL(e),n=this._videoRef.value;if(!n)return;n.muted=!1,n.volume=1,this._setVideoSource(null),n.src=t,this._attachPreviewListeners(n)}catch(e){console.error(`Failed to preview video`,e),this.telemetryManager.sendEventError(e,`camera previewing. Failed to preview video`)}},this._retake=()=>{if(this._setCameraState(Gs.RETAKE),this._activeTab===L.VIDEO){this._setVideoSource(this._stream);let e=this._videoRef.value;e&&(e.muted=!0)}this._videoRef.value?.play?.()},this._accept=()=>{if(this._setCameraState(Gs.ACCEPT),this._activeTab===L.PHOTO){this._canvas?.toBlob(e=>{if(!e)return;let t=this._createFile(`camera`,`jpeg`,Gu,e);this._toSend(t)},Gu);return}let e=new Blob(this._chunks,{type:this._mediaRecorder?.mimeType}),t=this._guessExtensionByMime(this._mediaRecorder?.mimeType),n=this._createFile(`video`,t,`video/${t}`,e);this._toSend(n),this._chunks=[]},this._handlePhoto=e=>{e===Gs.SHOT&&(this._tabVideoHidden=!0,this._cameraHidden=!0,this._tabCameraHidden=!0,this._cameraActionsHidden=!1,this._cameraSelectHidden=!0),(e===Gs.RETAKE||e===Gs.ACCEPT)&&(this._tabVideoHidden=!this._cameraModes.includes(L.VIDEO),this._tabCameraHidden=!this._cameraModes.includes(L.PHOTO),this._cameraHidden=!1,this._cameraActionsHidden=!0,this._cameraSelectHidden=this._cameraDevices.length<=1)},this._handleVideo=e=>{e===Gs.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`),e===Gs.STOP&&(this._timerHidden=!1,this._cameraHidden=!0,this._audioToggleMicrophoneHidden=!0,this._cameraActionsHidden=!1),(e===Gs.RETAKE||e===Gs.ACCEPT)&&(this._timerHidden=!0,this._tabVideoHidden=!this._cameraModes.includes(L.VIDEO),this._tabCameraHidden=!this._cameraModes.includes(L.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=e=>{this._activeTab===L.PHOTO&&(e===`shot`||e===`retake`||e===`accept`)&&this._handlePhoto(e),this._activeTab===L.VIDEO&&(e===`play`||e===`stop`||e===`retake`||e===`accept`||e===`pause`||e===`resume`)&&this._handleVideo(e)},this._handleActiveTab=e=>{this._switcherRef.value?.querySelectorAll(`button`).forEach(t=>{t.classList.toggle(`uc-active`,t.getAttribute(`data-id`)===e)}),e===L.PHOTO&&(this._currentIcon=`camera-full`,this._audioSelectHidden=!0,this._audioToggleMicrophoneHidden=!0),e===L.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:M.ACTION_EVENT,payload:{metadata:{event:`camera-tab-switch`,node:this.tagName,tabId:e}}}),this._activeTab=e},this._createFile=(e,t,n,r)=>{let i=Date.now(),a=`${e}-${i}.${t}`;return new File([r],a,{lastModified:i,type:n})},this._toSend=e=>{this.api.addFileFromObject(e,{source:R.CAMERA}),this.set$({"*currentActivity":z.activities.UPLOAD_LIST}),this.modalManager?.open(z.activities.UPLOAD_LIST)},this._setPermissionsState=C(e=>{this.classList.toggle(`uc-initialized`,e===`granted`);let t=this._activeTab===L.VIDEO&&this.cfg.enableAudioRecording,n=this._activeTab===L.PHOTO?`camera-full`:`video-camera-full`;e===`granted`?(this._videoHidden=!1,this._cameraHidden=!1,this._tabCameraHidden=!this._cameraModes.includes(L.PHOTO),this._tabVideoHidden=!this._cameraModes.includes(L.VIDEO),this._messageHidden=!0,this._timerHidden=!0,this._currentIcon=n,this._audioToggleMicrophoneHidden=!t,this._audioSelectHidden=!t):e===`prompt`?(this._l10nMessage=`camera-permissions-prompt`,this._videoHidden=!0,this._cameraHidden=!0,this._tabCameraHidden=!0,this._messageHidden=!1,this._stopCapture()):(this._l10nMessage=`camera-permissions-denied`,this._videoHidden=!0,this._messageHidden=!1,this._tabCameraHidden=!this._cameraModes.includes(L.PHOTO),this._tabVideoHidden=!this._cameraModes.includes(L.VIDEO),this._cameraActionsHidden=!0,this._mutableClassButton=`uc-shot-btn uc-camera-action`,this._stopCapture())},300),this._makeStreamInactive=()=>{if(!this._stream)return!1;let e=this._stream?.getAudioTracks(),t=this._stream?.getVideoTracks();return e.forEach(e=>{e.stop()}),t.forEach(e=>{e.stop()}),!0},this._stopCapture=()=>{this._capturing&&=(this._videoRef.value&&(this._videoRef.value.volume=0),(this._currentVideoSource?.getTracks?.())?.[0]?.stop(),this._detachPreviewListeners(this._videoRef.value),this._setVideoSource(null),this._makeStreamInactive(),this._stopTimer(),!1)},this._capture=async()=>{let e={video:{...Uu},audio:this.cfg.enableAudioRecording?{}:!1};this._selectedCameraId&&(e.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(e.audio={deviceId:{exact:this._selectedAudioId}}),this._videoRef.value&&(this._videoRef.value.volume=0);try{this._setPermissionsState(`prompt`),this._stream=await navigator.mediaDevices.getUserMedia(e),this._stream.addEventListener(`inactive`,()=>{this._setPermissionsState(`denied`)}),this._setVideoSource(this._stream),this._capturing=!0,this._setPermissionsState(`granted`)}catch(e){this._setPermissionsState(`denied`),console.log(`Failed to capture camera`,e),this.telemetryManager.sendEventError(e,`camera capturing. Failed to capture camera`)}},this._handlePermissionsChange=()=>{this._capture()},this._permissionAccess=async()=>{try{this._teardownPermissionListeners();for(let e of Wu){let t=await navigator.permissions.query({name:e});this._permissionResponses[e]=t,t.addEventListener(`change`,this._handlePermissionsChange),this._permissionCleanupFns.push(()=>{t.removeEventListener(`change`,this._handlePermissionsChange)})}this._unsubPermissions=()=>{this._teardownPermissionListeners()}}catch(e){this._teardownPermissionListeners(),console.log(`Failed to use permissions API. Fallback to manual request mode.`,e),this.telemetryManager.sendEventError(e,`camera permissions. Failed to use permissions API`),this._capture()}},this._requestDeviceAccess=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener(`devicechange`,this._getDevices)}catch(e){this.telemetryManager.sendEventError(e,`camera devices. Failed to get user media`),console.log(`Failed to get user media`,e)}},this._getDevices=async()=>{try{let e=await navigator.mediaDevices.enumerateDevices();this._cameraDevices=e.filter(e=>e.kind===`videoinput`).map((e,t)=>({text:e.label.trim()||`${this.l10n(`caption-camera`)} ${t+1}`,value:e.deviceId})),this._audioDevices=this.cfg.enableAudioRecording?e.filter(e=>e.kind===`audioinput`).map(e=>({text:e.label.trim(),value:e.deviceId})):[],this._cameraSelectOptions=this._cameraDevices,this._cameraSelectHidden=this._cameraDevices.length<=1,this._selectedCameraId=this._cameraDevices[0]?.value??null,this._audioSelectOptions=this._audioDevices,this._audioSelectHidden=!this.cfg.enableAudioRecording||this._audioDevices.length<=1,this._selectedAudioId=this._audioDevices[0]?.value??null}catch(e){this.telemetryManager.sendEventError(e,`camera devices. Failed to get devices`),console.log(`Failed to get devices`,e)}},this._onActivate=async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture(),this._handleCameraModes(this._cameraModes)},this._onDeactivate=async()=>{this._unsubPermissions&&this._unsubPermissions(),window.chrome||this._setPermissionsState(`denied`),this._stopCapture()},this._handleCameraModes=e=>{this._tabVideoHidden=!e.includes(L.VIDEO),this._tabCameraHidden=!e.includes(L.PHOTO);let t=e[0];t&&(!this._activeTab||!e.includes(this._activeTab))&&this._handleActiveTab(t)}}_attachPreviewListeners(e){this._detachPreviewListeners(e),e.addEventListener(`play`,this._handlePreviewPlay),e.addEventListener(`pause`,this._handlePreviewPause)}_detachPreviewListeners(e){e?.removeEventListener(`play`,this._handlePreviewPlay),e?.removeEventListener(`pause`,this._handlePreviewPause)}_setVideoSource(e){this._currentVideoSource!==e&&(this._currentVideoSource=e,this._applyVideoSource())}_applyVideoSource(){let e=this._videoRef.value;if(!e)return;let t=this._currentVideoSource??null;e.srcObject!==t&&(e.srcObject=t)}_shot(){if(this._setCameraState(`shot`),this._canvas=document.createElement(`canvas`),this._ctx=this._canvas.getContext(`2d`),!this._ctx)throw Error(`Failed to get canvas context`);let e=this._videoRef.value;if(!e)throw Error(`Video element not found`);this._canvas.height=e.videoHeight,this._canvas.width=e.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(e,0,0),e.pause()}_guessExtensionByMime(e){let t={mp4:`mp4`,ogg:`ogg`,webm:`webm`,quicktime:`mov`,"x-matroska":`mkv`};if(e===``)return`webm`;if(e){let n=e.split(`/`);if(n?.[0]===`video`){let e=n.slice(1).join(`/`)?.split(`;`)[0];if(e&&t[e])return t[e]}}return`avi`}get _cameraModes(){return Bn(this.cfg.cameraModes).filter(e=>e===L.PHOTO||e===L.VIDEO)}_teardownPermissionListeners(){if(this._permissionCleanupFns.length!==0){for(let e of this._permissionCleanupFns)e();this._permissionCleanupFns=[],this._unsubPermissions=null}}initCallback(){super.initCallback(),this.subConfigValue(`cameraMirror`,e=>{this._videoTransformCss=e?`scaleX(-1)`:null}),this.subConfigValue(`enableAudioRecording`,e=>{this._audioToggleMicrophoneHidden=!e,this._audioSelectDisabled=!e}),this.subConfigValue(`cameraModes`,e=>{if(!this.isConnected)return;let t=wn(e);this._handleCameraModes(t.filter(e=>e===L.PHOTO||e===L.VIDEO))}),this._onActivate()}firstUpdated(e){super.firstUpdated(e),this._applyVideoSource()}updated(e){super.updated(e),this._applyVideoSource()}_destroy(){this._teardownPermissionListeners(),navigator.mediaDevices?.removeEventListener(`devicechange`,this._getDevices),this._detachPreviewListeners(this._videoRef.value),this._setVideoSource(null)}disconnectedCallback(){super.disconnectedCallback(),this._onDeactivate(),this._destroy()}render(){return _`
|
|
211
|
-
<uc-activity-header>
|
|
212
|
-
<button
|
|
213
|
-
type="button"
|
|
214
|
-
class="uc-mini-btn"
|
|
215
|
-
@click=${this.$[`*historyBack`]}
|
|
216
|
-
title=${this.l10n(`back`)}
|
|
217
|
-
>
|
|
218
|
-
<uc-icon name="back"></uc-icon>
|
|
219
|
-
</button>
|
|
220
|
-
<div ?hidden=${!this._cameraSelectHidden}>
|
|
221
|
-
<uc-icon name="camera"></uc-icon>
|
|
222
|
-
<span>${this.l10n(`caption-camera`)}</span>
|
|
223
|
-
</div>
|
|
224
|
-
<uc-select
|
|
225
|
-
class="uc-camera-select"
|
|
226
|
-
.options=${this._cameraSelectOptions}
|
|
227
|
-
?hidden=${this._cameraSelectHidden}
|
|
228
|
-
@change=${this._handleCameraSelectChange}
|
|
229
|
-
>
|
|
230
|
-
</uc-select>
|
|
231
|
-
<button
|
|
232
|
-
type="button"
|
|
233
|
-
class="uc-mini-btn uc-close-btn"
|
|
234
|
-
@click=${this.$[`*closeModal`]}
|
|
235
|
-
title=${this.l10n(`a11y-activity-header-button-close`)}
|
|
236
|
-
aria-label=${this.l10n(`a11y-activity-header-button-close`)}
|
|
237
|
-
>
|
|
238
|
-
<uc-icon name="close"></uc-icon>
|
|
239
|
-
</button>
|
|
240
|
-
</uc-activity-header>
|
|
241
|
-
<div class="uc-content">
|
|
242
|
-
<video
|
|
243
|
-
muted
|
|
244
|
-
autoplay
|
|
245
|
-
playsinline
|
|
246
|
-
style=${Ru({transform:this._videoTransformCss})}
|
|
247
|
-
?hidden=${this._videoHidden}
|
|
248
|
-
${W(this._videoRef)}
|
|
249
|
-
></video>
|
|
250
|
-
<div class="uc-message-box" ?hidden=${this._messageHidden}>
|
|
251
|
-
<span>${this.l10n(this._l10nMessage)}</span>
|
|
252
|
-
<button
|
|
253
|
-
type="button"
|
|
254
|
-
@click=${this._handleRequestPermissions}
|
|
255
|
-
?hidden=${this._requestBtnHidden}
|
|
256
|
-
>${this.l10n(`camera-permissions-request`)}</button>
|
|
257
|
-
</div>
|
|
258
|
-
</div>
|
|
259
|
-
|
|
260
|
-
<div class="uc-controls">
|
|
261
|
-
<div ${W(this._switcherRef)} class="uc-switcher" ?hidden=${!this._timerHidden}>
|
|
262
|
-
<button
|
|
263
|
-
data-id="photo"
|
|
264
|
-
type="button"
|
|
265
|
-
class="uc-switch uc-mini-btn"
|
|
266
|
-
@click=${this._handleClickTab}
|
|
267
|
-
?hidden=${this._tabCameraHidden}
|
|
268
|
-
data-testid="tab-photo"
|
|
269
|
-
>
|
|
270
|
-
<uc-icon name="camera"></uc-icon>
|
|
271
|
-
</button>
|
|
272
|
-
<button
|
|
273
|
-
data-id="video"
|
|
274
|
-
type="button"
|
|
275
|
-
class="uc-switch uc-mini-btn"
|
|
276
|
-
@click=${this._handleClickTab}
|
|
277
|
-
?hidden=${this._tabVideoHidden}
|
|
278
|
-
data-testid="tab-video"
|
|
279
|
-
>
|
|
280
|
-
<uc-icon name="video-camera"></uc-icon>
|
|
281
|
-
</button>
|
|
282
|
-
</div>
|
|
283
|
-
|
|
284
|
-
<button
|
|
285
|
-
class="uc-secondary-btn uc-recording-timer"
|
|
286
|
-
@click=${this._handleToggleRecording}
|
|
287
|
-
?hidden=${this._timerHidden}
|
|
288
|
-
data-testid="recording-timer"
|
|
289
|
-
>
|
|
290
|
-
<uc-icon name=${this._currentTimelineIcon}></uc-icon>
|
|
291
|
-
<span ${W(this._timerRef)}> 00:00 </span>
|
|
292
|
-
<span ${W(this._lineRef)} class="uc-line"></span>
|
|
293
|
-
</button>
|
|
294
|
-
|
|
295
|
-
<div
|
|
296
|
-
class="uc-camera-actions uc-camera-action"
|
|
297
|
-
?hidden=${this._cameraActionsHidden}
|
|
298
|
-
>
|
|
299
|
-
<button type="button" class="uc-secondary-btn" @click=${this._handleRetake}>
|
|
300
|
-
Retake
|
|
301
|
-
</button>
|
|
302
|
-
<button
|
|
303
|
-
type="button"
|
|
304
|
-
class="uc-primary-btn"
|
|
305
|
-
@click=${this._handleAccept}
|
|
306
|
-
data-testid="accept"
|
|
307
|
-
>
|
|
308
|
-
Accept
|
|
309
|
-
</button>
|
|
310
|
-
</div>
|
|
311
|
-
|
|
312
|
-
<button
|
|
313
|
-
type="button"
|
|
314
|
-
data-testid="shot"
|
|
315
|
-
@click=${this._handleStartCamera}
|
|
316
|
-
class=${this._mutableClassButton}
|
|
317
|
-
?hidden=${this._cameraHidden}
|
|
318
|
-
>
|
|
319
|
-
<uc-icon name=${this._currentIcon}></uc-icon>
|
|
320
|
-
</button>
|
|
321
|
-
|
|
322
|
-
<div class="uc-select">
|
|
323
|
-
<button
|
|
324
|
-
type="button"
|
|
325
|
-
class="uc-mini-btn uc-btn-microphone"
|
|
326
|
-
@click=${this._handleToggleAudio}
|
|
327
|
-
?hidden=${this._audioToggleMicrophoneHidden}
|
|
328
|
-
data-testid="toggle-microphone"
|
|
329
|
-
>
|
|
330
|
-
<uc-icon name=${this._toggleMicrophoneIcon}></uc-icon>
|
|
331
|
-
</button>
|
|
332
|
-
|
|
333
|
-
<uc-select
|
|
334
|
-
class="uc-audio-select"
|
|
335
|
-
.options=${this._audioSelectOptions}
|
|
336
|
-
?hidden=${this._audioSelectHidden}
|
|
337
|
-
?disabled=${this._audioSelectDisabled}
|
|
338
|
-
@change=${this._handleAudioSelectChange}
|
|
339
|
-
data-testid="audio-select"
|
|
340
|
-
>
|
|
341
|
-
</uc-select>
|
|
342
|
-
</div>
|
|
343
|
-
</div>
|
|
344
|
-
`}},w([x()],Y.prototype,`_videoTransformCss`,void 0),w([x()],Y.prototype,`_videoHidden`,void 0),w([x()],Y.prototype,`_messageHidden`,void 0),w([x()],Y.prototype,`_requestBtnHidden`,void 0),w([x()],Y.prototype,`_cameraSelectOptions`,void 0),w([x()],Y.prototype,`_cameraSelectHidden`,void 0),w([x()],Y.prototype,`_l10nMessage`,void 0),w([x()],Y.prototype,`_timerHidden`,void 0),w([x()],Y.prototype,`_cameraHidden`,void 0),w([x()],Y.prototype,`_cameraActionsHidden`,void 0),w([x()],Y.prototype,`_audioSelectOptions`,void 0),w([x()],Y.prototype,`_audioSelectHidden`,void 0),w([x()],Y.prototype,`_audioSelectDisabled`,void 0),w([x()],Y.prototype,`_audioToggleMicrophoneHidden`,void 0),w([x()],Y.prototype,`_tabCameraHidden`,void 0),w([x()],Y.prototype,`_tabVideoHidden`,void 0),w([x()],Y.prototype,`_currentIcon`,void 0),w([x()],Y.prototype,`_currentTimelineIcon`,void 0),w([x()],Y.prototype,`_toggleMicrophoneIcon`,void 0),w([x()],Y.prototype,`_mutableClassButton`,void 0)})),Ju,Yu,Xu=n((()=>{nn(),pc(),Ju=[{test:e=>!!e.accept&&!!e.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:e=>e.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:e=>e.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Yu=C(e=>{for(let{test:t,message:n}of Ju)t(e)&&dc(n)},0)})),Zu=n((()=>{})),Qu,$u,ed,td,nd=n((()=>{Qu=(e,t)=>{let n=new URL(t);return n.hostname=`${e}.${n.hostname}`,n.toString().replace(/\/$/,``)},$u=`0123456789abcdefghijklmnopqrstuvwxyz`,ed=e=>{if(e<=0n)return`0`;let t=``;for(;e>0n;){let n=e%36n;t=$u[Number(n)]+t,e/=36n}return t},td=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.hostname.endsWith(r.hostname)}catch{return!1}}})),rd,id,ad,od,sd=n((()=>{nd(),rd=async e=>{let t=new TextEncoder().encode(e),n=await window.crypto.subtle.digest(`SHA-256`,t),r=Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``);return BigInt(`0x${r}`)},id=10,ad=async e=>ed(await rd(e)).slice(0,id),od=async(e,t)=>Qu(await ad(e),t)})),cd,ld=n((()=>{cd=e=>e instanceof Promise||!!(e&&typeof e==`object`&&`then`in e&&typeof e.then==`function`)})),ud=n((()=>{})),dd=n((()=>{}));function fd(e,t,n){return e?t(e):n?.(e)}var pd=n((()=>{})),md=n((()=>{pd()}));function hd(...e){return e.reduce((e,t)=>{if(typeof t==`string`)return e[t]=!0,e;for(let n of Object.keys(t))e[n]=t[n];return e},{})}function gd(...e){let t=hd(...e);return Object.keys(t).reduce((e,n)=>(t[n]&&e.push(n),e),[]).join(` `)}function _d(e,...t){let n=hd(...t);for(let t of Object.keys(n))e.classList.toggle(t,!!n[t])}var vd=n((()=>{})),yd,bd,xd=n((()=>{En(),or(),yd=e=>er.includes(e),bd=e=>{if(!e)return er;let t=wn(e).filter(yd);return t.length===0?er:t}}));function Sd(e){return{"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":er,"*tabId":D.CROP,"*on.retryNetwork":()=>{let t=e.querySelectorAll(`img`);for(let e of t){let t=e.src;e.src=Ql,e.src=t}e.$[`*networkProblems`]=!1},"*on.apply":t=>{if(!t)return;let n=e.$[`*originalUrl`];if(!n){console.warn(`Original URL is null, cannot apply transformations`);return}let r=In(Un(t),`preview`),i={originalUrl:n,cdnUrlModifiers:r,cdnUrl:Ln(n,r),transformations:t};e.dispatchEvent(new CustomEvent(`apply`,{detail:i,bubbles:!0,composed:!0})),e.remove()},"*on.cancel":()=>{e.remove(),e.dispatchEvent(new CustomEvent(`cancel`,{bubbles:!0,composed:!0}))}}}var Cd=n((()=>{zn(),$l(),$n(),or()})),wd,Td=n((()=>{wd=`<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>`})),Ed,Dd,Od=n((()=>{S(),I(),vd(),T(),Ed={transition:`uc-transition`,visible:`uc-visible`,hidden:`uc-hidden`},Dd=class extends F{constructor(...e){super(...e),this._visible=!1,this._styles=Ed,this._visibleStyle=Ed.visible,this._hiddenStyle=Ed.hidden,this._externalTransitions=!1,this._initialRenderComplete=!1}set visible(e){this._visible=e,this._handleVisible()}get visible(){return this._visible}set styles(e){this._styles=e,this._externalTransitions=!0,this._visibleStyle=e.visible??Ed.visible,this._hiddenStyle=e.hidden??Ed.hidden}get styles(){return this._styles}_handleVisible(){this.style.visibility=this._visible?`inherit`:`hidden`,_d(this,{[Ed.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(Ed.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle(`uc-initial`,!1),this._dispatchInitialRenderEvent()},0)}},w([b({type:Boolean})],Dd.prototype,`visible`,null),w([b({attribute:!1})],Dd.prototype,`styles`,null)})),kd,Ad=n((()=>{y(),S(),G(),I(),T(),kd=class extends F{constructor(...e){super(...e),this.active=!1,this._lineRef=U(),this._isAnimating=!1,this._handleTransitionEndRight=()=>{let e=this._lineRef.value;e&&(this._resetLine(e),this._isAnimating&&this.active&&this._start())}}firstUpdated(e){super.firstUpdated(e),this.active&&this._start()}updated(e){super.updated(e),e.has(`active`)&&(this.active?this._start():this._stop())}_start(){let e=this._lineRef.value;if(!e)return;this._isAnimating=!0;let{width:t}=this.getBoundingClientRect();e.removeEventListener(`transitionend`,this._handleTransitionEndRight),e.style.transition=`transform 1s`,e.style.opacity=`1`,e.style.transform=`translateX(${t}px)`,e.addEventListener(`transitionend`,this._handleTransitionEndRight,{once:!0})}_stop(){let e=this._lineRef.value;e&&(this._isAnimating=!1,e.removeEventListener(`transitionend`,this._handleTransitionEndRight),this._resetLine(e))}_resetLine(e){e.style.transition=`initial`,e.style.opacity=`0`,e.style.transform=`translateX(-101%)`}render(){return _`
|
|
345
|
-
<div class="uc-inner">
|
|
346
|
-
<div class="uc-line" ${W(this._lineRef)}></div>
|
|
347
|
-
</div>
|
|
348
|
-
`}},w([b({type:Boolean,reflect:!0})],kd.prototype,`active`,void 0)})),jd,Md=n((()=>{pt(),Bo(),jd=Ro(class extends zo{constructor(e){if(super(e),e.type!==Lo.ATTRIBUTE||e.name!==`class`||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return` `+Object.keys(e).filter(t=>e[t]).join(` `)+` `}update(e,[t]){if(this.st===void 0){for(let n in this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(` `).split(/\s/).filter(e=>e!==``))),t)t[n]&&!this.nt?.has(n)&&this.st.add(n);return this.render(t)}let n=e.element.classList;for(let e of this.st)e in t||(n.remove(e),this.st.delete(e));for(let e in t){let r=!!t[e];r===this.st.has(e)||this.nt?.has(e)||(r?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return Qe}})})),Nd=n((()=>{Md()})),X,Pd=n((()=>{pt(),X=e=>e??v})),Fd=n((()=>{Pd()})),Id,Ld=n((()=>{y(),S(),Nd(),Fd(),I(),T(),Id=class extends F{constructor(...e){super(...e),this.text=``,this.icon=``,this.reverse=!1,this.theme=`default`,this.ariaRole=void 0,this.ariaControls=``,this.titleProp=``,this.active=!1}firstUpdated(e){super.firstUpdated(e),this._applyReverse(),this._applyThemeClass()}updated(e){super.updated(e),e.has(`reverse`)&&this._applyReverse(),e.has(`theme`)&&this._applyThemeClass()}_applyReverse(){this.style.flexDirection=this.reverse?`row-reverse`:``}_applyThemeClass(){this.theme&&this.theme!==`custom`&&(this.className=`uc-${this.theme}`)}get _iconClassMap(){let e=this._computedIconHidden;return{"uc-icon":!0,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":e,"uc-icon_single":this._computedIconSingle}}get _computedIconHidden(){return!this.icon}get _computedIconSingle(){return!this.text&&!this._computedIconHidden}render(){return _`
|
|
349
|
-
<button
|
|
350
|
-
type="button"
|
|
351
|
-
role=${X(this.ariaRole||void 0)}
|
|
352
|
-
aria-controls=${X(this.ariaControls||void 0)}
|
|
353
|
-
aria-label=${X(this.l10n(this.titleProp))}
|
|
354
|
-
title=${X(this.l10n(this.titleProp))}
|
|
355
|
-
>
|
|
356
|
-
<uc-icon
|
|
357
|
-
class=${jd(this._iconClassMap)}
|
|
358
|
-
name=${X(this.icon||void 0)}
|
|
359
|
-
?hidden=${this._computedIconHidden}
|
|
360
|
-
></uc-icon>
|
|
361
|
-
<div class="uc-text">${this.text}</div>
|
|
362
|
-
</button>
|
|
363
|
-
`}},w([b({type:String})],Id.prototype,`text`,void 0),w([b({type:String})],Id.prototype,`icon`,void 0),w([b({type:Boolean,reflect:!0})],Id.prototype,`reverse`,void 0),w([b({type:String,reflect:!0})],Id.prototype,`theme`,void 0),w([b({attribute:`aria-role`})],Id.prototype,`ariaRole`,void 0),w([b({attribute:`aria-controls`})],Id.prototype,`ariaControls`,void 0),w([b({attribute:`title-prop`})],Id.prototype,`titleProp`,void 0),w([b({type:Boolean,noAccessor:!0})],Id.prototype,`active`,void 0)}));function Rd(e,t){let n={};for(let r of t){let t=e[r];(Object.hasOwn(e,r)||t!==void 0)&&(n[r]=t)}return n}var zd=n((()=>{}));function Bd(e,t,n){let r=window.devicePixelRatio,i=Math.min(Math.ceil(t*r),3e3),a=r>=2?`lightest`:`normal`;return Ln(e,In(qn,Un(n),`quality/${a}`,`stretch/off/-/resize/${i}x`,`@clib/${uo}/${fo}/uc-cloud-image-editor/`))}var Vd=n((()=>{po(),zn(),$n()})),Hd,Ud=n((()=>{y(),S(),G(),I(),ln(),qc(),Cc(),vd(),T(),Hd=class extends F{constructor(...e){super(...e),this._backdropMaskId=`uc-backdrop-mask-${cn.generateFastUid()}`,this._guidesHidden=!1,this._draggingValue=!1,this._svgRef=U(),this._svgReady=!1,this._pendingMaskHref=null,this._handlePointerUp=e=>{this._updateCursor(),this._dragging&&=(e.stopPropagation(),e.preventDefault(),!1)},this._handlePointerMove=e=>{if(!this._dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let t=this._svgElement;if(!t)return;let{x:n,y:r}=t.getBoundingClientRect(),i=e.x-n,a=e.y-r,o=i-this._dragStartPoint[0],s=a-this._dragStartPoint[1],{direction:c}=this._draggingThumb,l=this._calcCropBox(c,[o,s]);l&&(this.$[`*cropBox`]=l)},this._handleSvgPointerMove=e=>{this._frameThumbs&&(this._hoverThumb=Object.values(this._frameThumbs).find(t=>{if(!t||this._shouldThumbBeDisabled(t.direction))return!1;let n=t.interactionNode.getBoundingClientRect();return Bc({x:n.x,y:n.y,width:n.width,height:n.height},[e.x,e.y])}),this._updateCursor())}}get _svgElement(){return this._svgRef.value??null}get _dragging(){return this._draggingValue}set _dragging(e){this._draggingValue!==e&&(this._draggingValue=e,this._applyGuidesDragState())}_applyGuidesDragState(){this._frameGuides&&this._frameGuides.setAttribute(`class`,gd({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&this._draggingValue,"uc-guides--semi-hidden":!this._guidesHidden&&!this._draggingValue}))}_shouldThumbBeDisabled(e){let t=this.$[`*imageBox`];if(!t)return!1;if(e===``&&t.height<=1&&t.width<=1)return!0;let n=t.height<=1&&(e.includes(`n`)||e.includes(`s`)),r=t.width<=1&&(e.includes(`e`)||e.includes(`w`));return n||r}_createBackdrop(){let e=this.$[`*cropBox`];if(!e)return;let{x:t,y:n,width:r,height:i}=e,a=this._svgElement;if(!a)return;let o=Tc(`mask`,{id:this._backdropMaskId}),s=Tc(`rect`,{x:0,y:0,width:`100%`,height:`100%`,fill:`white`}),c=Tc(`rect`,{x:t,y:n,width:r,height:i,fill:`black`});o.appendChild(s),o.appendChild(c);let l=Tc(`rect`,{x:0,y:0,width:`100%`,height:`100%`,fill:`var(--color-image-background)`,"fill-opacity":.85,mask:`url(#${this._backdropMaskId})`});a.appendChild(l),a.appendChild(o),this._backdropMask=o,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display=`none`,window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display=`block`)}))}_updateBackdrop(){let e=this.$[`*cropBox`];if(!e)return;let{x:t,y:n,width:r,height:i}=e;this._backdropMaskInner&&wc(this._backdropMaskInner,{x:t,y:n,width:r,height:i})}_updateFrame(){let e=this.$[`*cropBox`];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{direction:n,pathNode:r,interactionNode:i,groupNode:a}=t,o=n===``,s=n.length===2,{x:c,y:l,width:u,height:d}=e;if(o)wc(i,{x:c,y:l,width:u,height:d});else{let t=Kc(Math.min(u,d)/82/2,0,1),a=s?Ec(e,n,t):Dc(e,n,t),o=a.center;if(!o)continue;let c=Math.max(24*Kc(Math.min(u,d)/24/3,0,1),6);wc(i,{x:o[0]-c,y:o[1]-c,width:c*2,height:c*2}),wc(r,{d:a.d})}let f=this._shouldThumbBeDisabled(n);a.setAttribute(`class`,gd(`uc-thumb`,{"uc-thumb--hidden":f,"uc-thumb--visible":!f}))}wc(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1})}}_createThumb(e,t){let n=Tc(`g`);n.classList.add(`uc-thumb`),n.setAttribute(`with-effects`,``);let r=Tc(`rect`,{fill:`transparent`}),i=Tc(`path`,{stroke:`currentColor`,fill:`none`,"stroke-width":3});n.appendChild(i),n.appendChild(r),e[t]={direction:t,pathNode:i,interactionNode:r,groupNode:n},t===``&&(n.style.cursor=`move`),r.addEventListener(`pointerdown`,this._handlePointerDown.bind(this,t))}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let n=0;n<3;n++){let r=`${[`n`,``,`s`][t]}${[`w`,``,`e`][n]}`;r!==``&&this._createThumb(e,r)}return this._createThumb(e,``),e}_createGuides(){let e=Tc(`svg`),t=Tc(`rect`,{x:0,y:0,width:`100%`,height:`100%`,fill:`none`,stroke:`currentColor`,"stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let t=1;t<=2;t++){let n=Tc(`line`,{x1:`${Sc*t}%`,y1:`0%`,x2:`${Sc*t}%`,y2:`100%`,stroke:`currentColor`,"stroke-width":1,"stroke-opacity":.3});e.appendChild(n)}for(let t=1;t<=2;t++){let n=Tc(`line`,{x1:`0%`,y1:`${Sc*t}%`,x2:`100%`,y2:`${Sc*t}%`,stroke:`currentColor`,"stroke-width":1,"stroke-opacity":.3});e.appendChild(n)}return e.classList.add(`uc-guides`,`uc-guides--semi-hidden`),e}_createFrame(){let e=this._svgElement;if(!e)return;let t=document.createDocumentFragment(),n=this._createGuides();t.appendChild(n);let r=this._createThumbs();for(let{groupNode:e}of Object.values(r))t.appendChild(e);e.appendChild(t),this._frameThumbs=r,this._frameGuides=n,this._applyGuidesDragState()}_handlePointerDown(e,t){if(!this._frameThumbs)return;let n=this._frameThumbs[e];if(!n||this._shouldThumbBeDisabled(e))return;let r=this.$[`*cropBox`],i=this._svgElement;if(!i)return;let{x:a,y:o}=i.getBoundingClientRect(),s=t.x-a,c=t.y-o;this._dragging=!0,this._draggingThumb=n,this._dragStartPoint=[s,c],this._dragStartCrop={...r}}_calcCropBox(e,t){let[n,r]=t,i=this.$[`*imageBox`],a=this._dragStartCrop??this.$[`*cropBox`],o=this.$[`*currentAspectRatio`],s=o?o.width/o.height:void 0;if(a=e===``?kc({rect:a,delta:[n,r],imageBox:i}):zc({rect:a,delta:[n,r],direction:e,aspectRatio:s,imageBox:i}),!Object.values(a).every(e=>Number.isFinite(e)&&e>=0)){console.error(`CropFrame is trying to create invalid rectangle`,{payload:a});return}return Ac(Gc(a),i)}_updateCursor(){let e=this._hoverThumb,t=this._svgElement;t&&(t.style.cursor=e?Oc(e.direction):`initial`)}_createMask(e){if(this._frameImage){this._frameImage.setAttribute(`href`,e);return}let t=this._svgElement;if(!t){this._pendingMaskHref=e;return}this._pendingMaskHref=null;let n=document.createDocumentFragment(),r=Tc(`image`,{href:e});r.setAttribute(`class`,`uc-cloud-mask`),n.appendChild(r),t.appendChild(n),this._frameImage=r}_updateMask(){let e=this.$[`*cropBox`];if(!e||!this._frameImage)return;let{x:t,y:n,width:r,height:i}=e;wc(this._frameImage,{x:t,y:n,height:i,width:r})}_render(){this._svgReady&&(this._updateBackdrop(),this._updateFrame(),this._updateMask())}toggleThumbs(e){if(this._frameThumbs)for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{groupNode:n}=t;n.setAttribute(`class`,gd(`uc-thumb`,{"uc-thumb--hidden":!e,"uc-thumb--visible":e}))}}initCallback(){super.initCallback(),this.sub(`*imageBox`,()=>{this._resizeBackdrop(),this._svgReady&&window.requestAnimationFrame(()=>{this._render()})}),this.sub(`*cropBox`,e=>{e&&(this._guidesHidden=e.height<=1||e.width<=1,this._applyGuidesDragState(),this._svgReady&&window.requestAnimationFrame(()=>{this._render()}))}),this.subConfigValue(`cloudImageEditorMaskHref`,e=>{e&&this._createMask(e)}),document.addEventListener(`pointermove`,this._handlePointerMove,!0),document.addEventListener(`pointerup`,this._handlePointerUp,!0)}firstUpdated(e){super.firstUpdated(e),this._initializeSvg()}_initializeSvg(){let e=this._svgElement;if(!(!e||this._svgReady)){if(this._createBackdrop(),this._createFrame(),this._svgReady=!0,e.addEventListener(`pointermove`,this._handleSvgPointerMove,!0),this._pendingMaskHref){let e=this._pendingMaskHref;this._pendingMaskHref=null,this._createMask(e)}this._render()}}disconnectedCallback(){super.disconnectedCallback(),this._svgElement?.removeEventListener(`pointermove`,this._handleSvgPointerMove,!0),document.removeEventListener(`pointermove`,this._handlePointerMove,!0),document.removeEventListener(`pointerup`,this._handlePointerUp,!0)}render(){return _`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${W(this._svgRef)}></svg>`}},w([x()],Hd.prototype,`_draggingValue`,void 0)}));function Wd(e){return e?[({dimensions:e,coords:t})=>[...e,...t].every(e=>Number.isInteger(e)&&Number.isFinite(e)),({dimensions:e,coords:t})=>e.every(e=>e>0)&&t.every(e=>e>=0)].every(t=>t(e)):!0}var Gd,Kd=n((()=>{y(),S(),G(),I(),nn(),nu(),hu(),qc(),Cc(),vd(),zd(),Vd(),T(),Gd=class extends F{constructor(){super(),this.ctxOwner=!0,this._imageSize={width:0,height:0},this._ctx=null,this._isActive=!1,this._image=null,this._canvasRef=U(),this._frameRef=U(),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=C(this._commit.bind(this),300),this._handleResizeThrottled=mu(()=>{!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())},100)}firstUpdated(e){super.firstUpdated(e),this._initCanvas()}_syncTransformations(){let e=this.$[`*editorTransformations`],t=Rd(e,Object.keys(this.$[`*operations`])),n={...this.$[`*operations`],...t};this.$[`*operations`]=n}_initCanvas(){let e=this._canvasRef.value;if(!e)return;let t=e.getContext(`2d`),n=this.offsetWidth,r=this.offsetHeight,i=window.devicePixelRatio;e.style.width=`${n}px`,e.style.height=`${r}px`,e.width=n*i,e.height=r*i,t?.scale(i,i),this._canvas=e,this._ctx=t}_alignImage(){if(!this._isActive||!this._image)return;let e=this._image,t=this.$[`*padding`],{rotate:n}=this.$[`*operations`],r={width:this.offsetWidth,height:this.offsetHeight},i=Uc({width:e.naturalWidth,height:e.naturalHeight},n),a;if(i.width>r.width-t*2||i.height>r.height-t*2){let e=i.width/i.height;if(e>r.width/r.height){let n=r.width-t*2,i=n/e;a={x:0+t,y:t+(r.height-t*2)/2-i/2,width:n,height:i}}else{let n=r.height-t*2,i=n*e;a={x:t+(r.width-t*2)/2-i/2,y:0+t,width:i,height:n}}}else{let{width:e,height:n}=i;a={x:t+(r.width-t*2)/2-e/2,y:t+(r.height-t*2)/2-n/2,width:e,height:n}}this.$[`*imageBox`]=Gc(a)}_alignCrop(){let e=this.$[`*cropBox`],t=this.$[`*imageBox`],{rotate:n}=this.$[`*operations`],r=this.$[`*editorTransformations`].crop,{width:i,x:a,y:o}=t;if(r){let{dimensions:[s,c],coords:[l,u]}=r,{width:d}=Uc(this._imageSize,n),f=i/d;e=Ac(Gc({x:a+l*f,y:o+u*f,width:s*f,height:c*f}),t)}let s=this.$[`*currentAspectRatio`],c=s?s.width/s.height:void 0;if(!Vc(e,t)||c&&!Hc(e,c)){let n=t.width/t.height,r=t.width,i=t.height;c&&(n>c?r=Math.min(t.height*c,t.width):i=Math.min(t.width/c,t.height)),e={x:t.x+t.width/2-r/2,y:t.y+t.height/2-i/2,width:r,height:i}}this.$[`*cropBox`]=Ac(Gc(e),t)}_drawImage(){let e=this._ctx;if(!e)return;let t=this._image;if(!t)return;let n=this.$[`*imageBox`],{mirror:r,flip:i,rotate:a}=this.$[`*operations`],o=Uc({width:n.width,height:n.height},a);e.save(),e.translate(n.x+n.width/2,n.y+n.height/2),e.rotate(a*Math.PI*-1/180),e.scale(r?-1:1,i?-1:1),e.drawImage(t,-o.width/2,-o.height/2,o.width,o.height),e.restore()}_draw(){if(!this._isActive||!this._image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this._image&&(this._frameRef.value?.toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=gd({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$[`*cropBox`],t=this.$[`*imageBox`],{rotate:n}=this.$[`*operations`],{width:r,height:i}=t,{width:a,height:o}=Uc(this._imageSize,n),{width:s,height:c}=e,l=r/a,u=i/o;return[Kc(Math.round(s/l),1,a),Kc(Math.round(c/u),1,o)]}_getCropTransformation(){let e=this.$[`*cropBox`],t=this.$[`*imageBox`],{rotate:n}=this.$[`*operations`],{width:r,height:i,x:a,y:o}=t,{width:s,height:c}=Uc(this._imageSize,n),{x:l,y:u}=e,d=r/s,f=i/c,p=this._getCropDimensions(),m={dimensions:p,coords:[Kc(Math.round((l-a)/d),0,s-p[0]),Kc(Math.round((u-o)/f),0,c-p[1])]};if(!Wd(m)){console.error(`Cropper is trying to create invalid crop object`,{payload:m});return}if(!(p[0]===s&&p[1]===c))return m}_commit(){if(!this.isConnected||!this._imageSize)return;let{rotate:e,mirror:t,flip:n}=this.$[`*operations`],r=this._getCropTransformation(),i={...this.$[`*editorTransformations`],crop:r,rotate:e,mirror:t,flip:n};this.$[`*editorTransformations`]=i}setValue(e,t){this.$[`*operations`]={...this.$[`*operations`],[e]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$[`*operations`][e]}async activate(e,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,await this.updateComplete,this._initCanvas(),this._imageSize=e,this.removeEventListener(`transitionend`,this._reset);try{let e=this.$[`*originalUrl`],n=this.$[`*editorTransformations`];this._image=await this._waitForImage(e,n),this._syncTransformations(),this._handleResizeThrottled(),this._animateIn({fromViewer:t})}catch(e){console.error(`Failed to activate cropper`,{error:e}),this.telemetryManager.sendEventError(e,`cloud editor image. Failed to activate cropper`)}this._observer=new ResizeObserver(e=>{let[t]=e;t&&t.contentRect.width>0&&t.contentRect.height>0&&this._isActive&&this._image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:e=!1}={}){this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=gd({"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 e=this._getCropDimensions(),t=this.$[`*cropBox`],n=Math.min(this.offsetWidth,e[0])/t.width,r=Math.min(this.offsetHeight,e[1])/t.height,i=Math.min(n,r),a=t.x+t.width/2,o=t.y+t.height/2;this.style.transform=`scale(${i}) translate(${(this.offsetWidth/2-a)/i}px, ${(this.offsetHeight/2-o)/i}px)`,this.style.transformOrigin=`${a}px ${o}px`}_transitionToImage(){let e=this.$[`*cropBox`],t=e.x+e.width/2,n=e.y+e.height/2;this.style.transform=`scale(1)`,this.style.transformOrigin=`${t}px ${n}px`}_reset(){this._isActive||(this._image=null)}async _waitForImage(e,t){let n=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let r=await this.proxyUrl(Bd(e,n,t)),{promise:i,cancel:a,image:o}=eu(r),s=this._handleImageLoading(r);return o.addEventListener(`load`,s,{once:!0}),o.addEventListener(`error`,s,{once:!0}),this._cancelPreload?.(),this._cancelPreload=a,i.then(()=>o).catch(e=>(console.error(`Failed to load image`,{error:e}),this.$[`*networkProblems`]=!0,o))}_handleImageLoading(e){let t=`crop`,n=this.$[`*loadingOperations`],r=n.get(t);return r||(r=new Map,n.set(t,r)),r.get(e)||(r.set(e,!0),this.$[`*loadingOperations`]=n),()=>{let r=n.get(t);r?.has(e)&&(r.delete(e),this.$[`*loadingOperations`]=n)}}initCallback(){super.initCallback(),this.sub(`*imageBox`,()=>{this._draw()}),this.sub(`*cropBox`,()=>{this._image&&this._commitDebounced()}),this.sub(`*currentAspectRatio`,()=>{this._alignCrop()}),setTimeout(()=>{this.sub(`*networkProblems`,e=>{e||this._isActive&&this._imageSize&&this.activate(this._imageSize,{fromViewer:!1})})},0)}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._image&&=null}render(){return _`
|
|
364
|
-
<canvas class="uc-canvas" ${W(this._canvasRef)}></canvas>
|
|
365
|
-
<uc-crop-frame ${W(this._frameRef)}></uc-crop-frame>
|
|
366
|
-
`}},w([x()],Gd.prototype,`_image`,void 0)}));function qd(e,t,n){let r=n,i=n-1,a=Array(r);for(let n=i;n>=0;--n)a[n]=Math.ceil((n*t+(i-n)*e)/i);return a}var Jd=n((()=>{}));function Yd(e){return typeof e==`string`&&e in ar}function Xd(e){let t=[];for(let n=0;n<e.length-1;n+=1){let r=e[n],i=e[n+1];typeof r==`number`&&typeof i==`number`&&t.push([r,i])}return t}function Zd(e,t,n){let r=Xd(e).find(([e,n])=>e<=t&&t<=n);if(!r)return e.map(()=>0);let[i,a]=r;return e.map(e=>{let r=Math.abs(i-a)||1,o=Math.abs(t-i)/r;return i===e?t>n?1:1-o:a===e?t>=n?o:1:0})}function Qd(e,t){return e.map((n,r)=>n<t?e.length-r:r)}function $d(e,t){let n=ar[e].keypointsNumber,{range:r,zero:i}=ar[e];return[...new Set([...qd(r[0],i,n+1),...qd(i,r[1],n+1),i,t])].sort((e,t)=>e-t)}var ef,tf=n((()=>{y(),G(),I(),nn(),nu(),vd(),Jd(),or(),Vd(),ef=class extends F{constructor(){super(),this._isActive=!1,this._hidden=!0,this._operation=`initial`,this._transformations={},this._keypoints=[],this._raf=0,this._previewHostRef=U(),this._layersHostRef=U(),this.classList.add(`uc-inactive_to_cropper`),this._addKeypointDebounced=C(async(e,t,n)=>{let r=()=>!this._isSame(e,t)||this._value!==n||!!this._keypoints.find(e=>e.value===n);if(r())return;let i=await this._constructKeypoint(e,n),a=new Image;a.src=i.src;let o=this._handleImageLoading(i.src);a.addEventListener(`load`,o,{once:!0}),a.addEventListener(`error`,o,{once:!0}),i.image=a,a.classList.add(`uc-fader-image`),a.addEventListener(`load`,()=>{if(r())return;let t=this._keypoints,o=t.findIndex(e=>e.value>n);o===-1&&(o=t.length);let s=t[o]?.image,c=this._layersHostRef.value;!c||s&&!c.contains(s)||(t.splice(o,0,i),s?c.insertBefore(a,s):c.appendChild(a),this._update(e,n))},{once:!0}),a.addEventListener(`error`,()=>{this.$[`*networkProblems`]=!0},{once:!0})},600)}_handleImageLoading(e){let t=this._operation,n=this.$[`*loadingOperations`];n.has(t)||n.set(t,new Map);let r=n.get(t);return r&&!r.get(e)&&(r.set(e,!0),this.$[`*loadingOperations`]=n),()=>{let r=n.get(t);r?.has(e)&&(r.delete(e),this.$[`*loadingOperations`]=n)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString())}})}_imageSrc({url:e=this._url,filter:t=this._filter??void 0,operation:n,value:r}={}){if(!e)throw Error(`URL is not defined`);let i={...this._transformations};n&&(n===`filter`?t&&typeof r==`number`&&(i.filter={name:t,amount:r}):typeof r==`number`&&(i[n]=r));let a=this.offsetWidth;return this.proxyUrl(Bd(e,a,i))}async _constructKeypoint(e,t){return{src:await this._imageSrc({operation:e,value:t}),image:void 0,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}set(e){let t=typeof e==`string`?parseInt(e,10):e;!Yd(this._operation)||!Number.isFinite(t)||(this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t))}_update(e,t){this._operation=e,this._value=t;let{zero:n}=ar[e],r=this._keypoints.map(e=>e.value),i=Zd(r,t,n),a=Qd(r,n);this._keypoints.forEach((e,t)=>{let n=i[t],r=a[t];typeof n==`number`&&(e.opacity=n),typeof r==`number`&&(e.zIndex=r)}),this._flush()}_createPreviewImage(){let e=new Image;return e.classList.add(`uc-fader-image`,`uc-fader-image--preview`),e.style.opacity=`0`,e}async _initNodes(){this._previewImage=this._previewImage||this._createPreviewImage();let e=this._previewImage;e&&this._ensurePreviewAttached(e);let{images:t,promise:n,cancel:r}=tu(this._keypoints.map(e=>e.src));t.forEach(e=>{let t=this._handleImageLoading(e.src);e.addEventListener(`load`,t),e.addEventListener(`error`,t)}),this._cancelLastImages=()=>{r(),this._cancelLastImages=void 0};let i=this._operation,a=this._filter;if(await n,this._isActive&&this._isSame(i,a)){let e=this._layersHostRef.value;if(!e)return;e.replaceChildren(),this._keypoints.forEach((n,r)=>{let i=t[r];i&&(i.classList.add(`uc-fader-image`),n.image=i,e.appendChild(i))}),this._flush()}}async setTransformations(e){if(this._transformations=e,this._previewImage){let e=await this._imageSrc(),t=this._handleImageLoading(e);this._previewImage.src=e,this._previewImage.addEventListener(`load`,t,{once:!0}),this._previewImage.addEventListener(`error`,t,{once:!0}),this._previewImage.style.opacity=`1`,this._previewImage.addEventListener(`error`,()=>{this.$[`*networkProblems`]=!0},{once:!0})}}async preload({url:e,filter:t,operation:n,value:r}){if(!n||typeof r!=`number`)return;this._cancelBatchPreload?.();let i=$d(n,r),{cancel:a}=tu(await Promise.all(i.map(r=>this._imageSrc({url:e,filter:t,operation:n,value:r}))));this._cancelBatchPreload=a}_setOriginalSrc(e){let t=this._previewImage||this._createPreviewImage();if(this._ensurePreviewAttached(t),this._previewImage=t,t.src===e){t.style.opacity=`1`,t.style.transform=`scale(1)`,this.className=gd({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}t.style.opacity=`0`;let n=this._handleImageLoading(e);t.addEventListener(`error`,n,{once:!0}),t.src=e,t.addEventListener(`load`,()=>{n(),t&&(t.style.opacity=`1`,t.style.transform=`scale(1)`,this.className=gd({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),t.addEventListener(`error`,()=>{this.$[`*networkProblems`]=!0},{once:!0})}async activate({url:e,operation:t,value:n,filter:r,fromViewer:i}){if(this._isActive=!0,this._hidden=!1,await this.updateComplete,this._url=e,this._operation=t??`initial`,this._value=n,this._filter=r,this._fromViewer=i,typeof n!=`number`&&!r){let e=await this._imageSrc({operation:t,value:n});this._setOriginalSrc(e),this._clearLayersHost();return}!t||typeof n!=`number`||(this._keypoints=await Promise.all($d(t,n).map(e=>this._constructKeypoint(t,e))),this._update(t,n),this._initNodes())}deactivate({hide:e=!0}={}){this._isActive=!1,this._cancelLastImages?.(),this._cancelBatchPreload?.(),e&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform=`scale(1)`),this.className=gd({"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(e){let t=this._previewHostRef.value;t&&(t.contains(e)||t.appendChild(e))}_clearLayersHost(){this._layersHostRef.value?.replaceChildren()}render(){return _`
|
|
367
|
-
<div class="uc-fader-preview-host" ${W(this._previewHostRef)}></div>
|
|
368
|
-
<div class="uc-fader-layers-host" ${W(this._layersHostRef)}></div>
|
|
369
|
-
`}}})),nf,rf=n((()=>{y(),S(),G(),I(),T(),nf=class extends F{constructor(){super(),this._thumbSize=0,this._inputRef=U(),this._thumbRef=U(),this._stepsRef=U(),this.disabled=!1,this.min=0,this.max=100,this.defaultValue=0,this.zero=0,this._currentValue=0,this._handleSliderInput=e=>{e.stopPropagation();let t=this._extractEventValue(e);t!==null&&(this._setCurrentValue(t),this._emitSliderEvent(`slider-input`,t))},this._handleSliderChange=e=>{e.stopPropagation();let t=this._extractEventValue(e);t!==null&&this._setCurrentValue(t)},this._handleInputFocus=()=>{this.style.setProperty(`--color-effect`,`var(--hover-color-rgb)`)},this._handleInputBlur=()=>{this.style.setProperty(`--color-effect`,`var(--idle-color-rgb)`)},this.setAttribute(`with-effects`,``)}_emitSliderEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:{value:t},bubbles:!0,composed:!0}))}firstUpdated(e){super.firstUpdated(e),this._thumbSize=Number.parseInt(window.getComputedStyle(this).getPropertyValue(`--l-thumb-size`),10)||0,this._syncInputValue(this._currentValue),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps(),this._updateValue(this._currentValue)}),this._observer.observe(this);let t=this._inputRef.value;t?.addEventListener(`focus`,this._handleInputFocus),t?.addEventListener(`blur`,this._handleInputBlur),window.setTimeout(()=>{this._updateValue(this._currentValue)},0)}willUpdate(e){super.willUpdate(e),e.has(`defaultValue`)&&this.defaultValue!==this._currentValue&&this._setCurrentValue(this.defaultValue),(e.has(`min`)||e.has(`max`))&&this.hasUpdated&&(this._updateSteps(),this._updateValue(this._currentValue)),e.has(`zero`)&&this.hasUpdated&&this._updateZeroDot(this._currentValue)}_updateValue(e){this._updateZeroDot(e);let t=this.max-this.min;if(t===0)return;let{width:n}=this.getBoundingClientRect(),r=100/t*(e-this.min)*(n-this._thumbSize)/100;window.requestAnimationFrame(()=>{let e=this._thumbRef.value;e&&(e.style.transform=`translateX(${r}px)`)})}_updateZeroDot(e){if(!this._zeroDotEl)return;let t=this.max-this.min;if(t===0)return;this._zeroDotEl.style.opacity=e===this.zero?`0`:`1`;let{width:n}=this.getBoundingClientRect(),r=100/t*(this.zero-this.min)*(n-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl&&(this._zeroDotEl.style.transform=`translateX(${r}px)`)})}_updateSteps(){let e=this._stepsRef.value;if(!e)return;let{width:t}=e.getBoundingClientRect(),n=Math.ceil(t/2),r=Math.ceil(n/15)-2;if(this._stepsCount===r)return;let i=document.createDocumentFragment(),a=document.createElement(`div`),o=document.createElement(`div`);a.className=`uc-minor-step`,o.className=`uc-border-step`,i.appendChild(o);for(let e=0;e<r;e+=1)i.appendChild(a.cloneNode());i.appendChild(o.cloneNode());for(let e=0;e<r;e+=1)i.appendChild(a.cloneNode());i.appendChild(o.cloneNode());let s=document.createElement(`div`);s.className=`uc-zero-dot`,i.appendChild(s),this._zeroDotEl=s,e.innerHTML=``,e.appendChild(i),this._stepsCount=r}disconnectedCallback(){super.disconnectedCallback();let e=this._inputRef.value;e?.removeEventListener(`focus`,this._handleInputFocus),e?.removeEventListener(`blur`,this._handleInputBlur),this._observer?.disconnect(),this._observer=void 0}_setCurrentValue(e){Number.isFinite(e)&&(this._currentValue=e,this.hasUpdated&&(this._syncInputValue(e),this._updateValue(e)))}_syncInputValue(e){let t=this._inputRef.value;t&&(t.value=String(e))}_extractEventValue(e){let t=e.currentTarget;if(!t)return null;let n=Number.parseInt(t.value,10);return Number.isFinite(n)?n:null}render(){return _`
|
|
370
|
-
<div class="uc-steps" ${W(this._stepsRef)}></div>
|
|
371
|
-
<div class="uc-thumb" ${W(this._thumbRef)}></div>
|
|
372
|
-
<input
|
|
373
|
-
class="uc-input"
|
|
374
|
-
type="range"
|
|
375
|
-
${W(this._inputRef)}
|
|
376
|
-
.min=${String(this.min)}
|
|
377
|
-
.max=${String(this.max)}
|
|
378
|
-
.value=${String(this._currentValue)}
|
|
379
|
-
?disabled=${this.disabled}
|
|
380
|
-
@input=${this._handleSliderInput}
|
|
381
|
-
@change=${this._handleSliderChange}
|
|
382
|
-
/>
|
|
383
|
-
`}},w([b({type:Boolean,reflect:!0})],nf.prototype,`disabled`,void 0),w([b({type:Number})],nf.prototype,`min`,void 0),w([b({type:Number})],nf.prototype,`max`,void 0),w([b({type:Number,attribute:!1})],nf.prototype,`defaultValue`,void 0),w([b({type:Number})],nf.prototype,`zero`,void 0),w([x()],nf.prototype,`_currentValue`,void 0)})),af,of,sf=n((()=>{y(),S(),I(),or(),T(),af=`original`,of=class extends F{constructor(...e){super(...e),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:t}=e.detail;this.$[`*faderEl`]?.set(t),this.state={...this.state,value:t}}}setOperation(e,t){this.state={...this.state,operation:e,filter:t},this._initializeValues();let n=this.$[`*faderEl`],r=this.state.originalUrl||this.$[`*originalUrl`];n&&r&&n.activate({url:r,operation:this.state.operation,value:this.state.filter===`original`?void 0:this.state.value,filter:this.state.filter===`original`?void 0:this.state.filter,fromViewer:!1})}_initializeValues(){let e=this.state.operation,{range:t,zero:n}=ar[e],[r,i]=t;this.state={...this.state,min:r,max:i,zero:n};let a=this.$[`*editorTransformations`][e];if(e===`filter`){let e=Number(i),t=a;if(t){let{name:n,amount:r}=t;e=n===this.state.filter?r:i}this.state={...this.state,value:e,defaultValue:e};return}let o=a===void 0?n:a;this.state={...this.state,value:o,defaultValue:o}}apply(){let e={...this.$[`*editorTransformations`]};this.state.operation===`filter`?!this.state.filter||this.state.filter===`original`?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:!1})}initCallback(){super.initCallback(),this.sub(`*originalUrl`,e=>{e&&(this.state={...this.state,originalUrl:e})})}updated(e){if(super.updated(e),e.has(`state`)){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$[`*operationTooltip`]=e}}render(){return _`
|
|
384
|
-
<uc-slider-ui
|
|
385
|
-
.disabled=${this.state.disabled}
|
|
386
|
-
.min=${this.state.min}
|
|
387
|
-
.max=${this.state.max}
|
|
388
|
-
.defaultValue=${this.state.defaultValue}
|
|
389
|
-
.zero=${this.state.zero}
|
|
390
|
-
@slider-input=${this._handleInput}
|
|
391
|
-
></uc-slider-ui>
|
|
392
|
-
`}},w([x()],of.prototype,`state`,void 0)}));function cf(e){if(!e)return null;let t=e.match(/^([A-Za-z]+)\s+(\d+)$/);if(!t)return null;let[,n,r]=t;return!n||r===void 0?null:{filter:n,value:Number(r)}}var lf=n((()=>{})),uf,df=n((()=>{y(),S(),Fd(),I(),T(),uf=class extends F{constructor(...e){super(...e),this.active=!1,this.title=``,this.icon=``,this.titleProp=``}get buttonClasses(){let e=this.active;return{"uc-active":e,"uc-not_active":!e}}_updateHostStateClasses(){let e=this.buttonClasses;for(let[t,n]of Object.entries(e))this.classList.toggle(t,n)}onClick(e){}connectedCallback(){super.connectedCallback(),this._updateHostStateClasses()}updated(e){super.updated(e),e.has(`active`)&&this._updateHostStateClasses()}render(){let e=this.onClick,t=this.title;return _`
|
|
393
|
-
<button
|
|
394
|
-
role="option"
|
|
395
|
-
type="button"
|
|
396
|
-
aria-label=${X(this.titleProp)}
|
|
397
|
-
title=${X(this.titleProp)}
|
|
398
|
-
@click=${e}
|
|
399
|
-
>
|
|
400
|
-
<uc-icon name=${this.icon}></uc-icon>
|
|
401
|
-
<div class="uc-title" ?hidden=${!t}>${t}</div>
|
|
402
|
-
</button>
|
|
403
|
-
`}},w([x()],uf.prototype,`active`,void 0),w([x()],uf.prototype,`title`,void 0),w([x()],uf.prototype,`icon`,void 0),w([x()],uf.prototype,`titleProp`,void 0)})),ff,pf,mf,hf,gf,_f=n((()=>{y(),S(),Nd(),Fd(),df(),T(),ff=12,pf=16,mf=e=>{let t=12,n=12;return e.width/e.height>=1?(t=ff,n=Math.round(ff*e.height/e.width)):(n=ff,t=Math.round(ff*e.width/e.height)),{width:t,height:n}},hf=class extends uf{initCallback(){super.initCallback(),this.icon=`arrow-dropdown`,this.sub(`*currentAspectRatio`,e=>{let t=this._computeTitle(e);this.title=t,this.titleProp=t})}onClick(){this.$[`*showListAspectRatio`]=!0}_computeTitle(e){return e?e.hasFreeform?this.l10n(`freeform-crop`):this.l10n(`crop-to-shape`,{value:`${e.width}:${e.height}`}):``}render(){let e=this.onClick,t=this.title;return _`
|
|
404
|
-
<button
|
|
405
|
-
role="option"
|
|
406
|
-
type="button"
|
|
407
|
-
class=${jd(this.buttonClasses)}
|
|
408
|
-
aria-label=${X(this.titleProp)}
|
|
409
|
-
title=${X(this.titleProp)}
|
|
410
|
-
@click=${e}
|
|
411
|
-
>
|
|
412
|
-
<div class="uc-title" ?hidden=${!t}>${t}</div>
|
|
413
|
-
<uc-icon name=${this.icon}></uc-icon>
|
|
414
|
-
</button>
|
|
415
|
-
`}},gf=class extends uf{constructor(...e){super(...e),this._aspectRatio=null}get aspectRatio(){return this._aspectRatio}set aspectRatio(e){if(this._aspectRatio===e)return;let t=this._aspectRatio;this._aspectRatio=e,this.requestUpdate(`aspectRatio`,t),e?this._updateAspectRatioPresentation(e):(this.removeAttribute(`uc-aspect-ratio-freeform`),this.title=``,this.titleProp=``)}initCallback(){super.initCallback(),this._aspectRatio&&this._updateAspectRatioPresentation(this._aspectRatio),this.sub(`*currentAspectRatio`,e=>{this.active=e&&e.id===this._aspectRatio?.id||e?.width===this._aspectRatio?.width&&e?.height===this._aspectRatio?.height})}onClick(){this.$[`*currentAspectRatio`]?.id!==this._aspectRatio?.id&&(this.$[`*currentAspectRatio`]=this._aspectRatio)}_updateAspectRatioPresentation(e){if(!this.isConnected)return;let t=!!e.hasFreeform;this.toggleAttribute(`uc-aspect-ratio-freeform`,t),(()=>{let n=t?this.l10n(`custom`):`${e.width}:${e.height}`;return this.title=n,n})(),(()=>{let n=this.l10n(`a11y-cloud-editor-apply-aspect-ratio`,{name:t?this.l10n(`custom`).toLowerCase():this.l10n(`crop-to-shape`,{value:`${e.width}:${e.height}`}).toLowerCase(),value:``});return this.titleProp=n,n})(),t||this.requestUpdate()}_renderIcon(){let e=this._aspectRatio;if(!e||e.hasFreeform)return _`<uc-icon name=${this.icon}></uc-icon>`;let{width:t,height:n}=mf(e);return _`
|
|
416
|
-
<uc-icon>
|
|
417
|
-
<svg
|
|
418
|
-
viewBox="0 0 ${pf} ${pf}"
|
|
419
|
-
aria-hidden="true"
|
|
420
|
-
focusable="false"
|
|
421
|
-
>
|
|
422
|
-
<rect
|
|
423
|
-
x=${(pf-t)/2}
|
|
424
|
-
y=${(pf-n)/2}
|
|
425
|
-
width=${t}
|
|
426
|
-
height=${n}
|
|
427
|
-
rx="2"
|
|
428
|
-
fill="none"
|
|
429
|
-
stroke="currentColor"
|
|
430
|
-
stroke-width="1.2"
|
|
431
|
-
stroke-linejoin="round"
|
|
432
|
-
></rect>
|
|
433
|
-
</svg>
|
|
434
|
-
</uc-icon>
|
|
435
|
-
`}render(){let e=this.onClick,t=this.title;return _`
|
|
436
|
-
<button
|
|
437
|
-
role="option"
|
|
438
|
-
type="button"
|
|
439
|
-
class=${jd(this.buttonClasses)}
|
|
440
|
-
aria-label=${X(this.titleProp)}
|
|
441
|
-
title=${X(this.titleProp)}
|
|
442
|
-
@click=${e}
|
|
443
|
-
>
|
|
444
|
-
${this._renderIcon()}
|
|
445
|
-
<div class="uc-title" ?hidden=${!t}>${t}</div>
|
|
446
|
-
</button>
|
|
447
|
-
`}},w([b({attribute:!1})],gf.prototype,`aspectRatio`,null)}));function vf(e){let t=e+90;return t=t>=360?0:t,t}function yf(e,t){if(e===`rotate`)return vf(typeof t==`number`?t:0);if(e===`mirror`||e===`flip`)return!t;throw Error(`Unsupported operation: ${e}`)}var bf,xf=n((()=>{S(),df(),T(),bf=class extends uf{constructor(...e){super(...e),this.operation=void 0}willUpdate(e){super.willUpdate(e),this.operation?(this.titleProp=this.l10n(`a11y-cloud-editor-apply-crop`,{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon=``,this.titleProp=``)}onClick(e){if(!this.operation)return;let t=this.$[`*cropperEl`],n=t.getValue(this.operation),r=yf(this.operation,n);this.telemetryManager.sendEventCloudImageEditor(e,this.$[`*tabId`],{operation:this.operation,next:r,prev:n}),t.setValue(this.operation,r)}},w([b({type:String})],bf.prototype,`operation`,void 0)})),Sf,Cf=n((()=>{y(),S(),Nd(),Fd(),Bu(),po(),zn(),nu(),df(),sf(),$n(),lf(),T(),Sf=class extends uf{constructor(...e){super(...e),this._operation=``,this._filter=``,this._originalUrl=``,this._lastPreviewRequestId=0,this._previewImage=null,this._previewLoaded=!1,this.isOriginal=!1,this._iconSize=20}get filter(){return this._filter}set filter(e){let t=e??``;if(this._filter===t)return;let n=this._filter;this._filter=t,this._operation=`filter`,this.isOriginal=t===af,this.icon=this.isOriginal?`original`:`slider`,this._iconSize=this.isOriginal?40:20,this.requestUpdate(`filter`,n),this.isConnected&&this._updateFilterLabels(t)}onClick(e){if(this.active)this.isOriginal||(this.$[`*sliderEl`].setOperation(this._operation,this._filter),this.$[`*showSlider`]=!0);else{let e=this.$[`*sliderEl`];e.setOperation(this._operation,this._filter),e.apply()}this.telemetryManager.sendEventCloudImageEditor(e,this.$[`*tabId`],{operation:cf(this.$[`*operationTooltip`])}),this.$[`*currentFilter`]=this._filter}_previewSrc(){let e=parseInt(window.getComputedStyle(this).getPropertyValue(`--l-base-min-width`),10),t=Number.isFinite(e)&&e>0?e:this._iconSize||32,n=window.devicePixelRatio,r=Math.ceil(n*t),i=n>=2?`lightest`:`normal`,a={...this.$[`*editorTransformations`]};return a[this._operation]=this._filter===`original`?void 0:{name:this._filter,amount:100},Ln(this._originalUrl,In(qn,Un(a),`quality/${i}`,`scale_crop/${r}x${r}/center`,`@clib/${uo}/${fo}/uc-cloud-image-editor/`))}async _observerCallback(e,t){e[0]?.isIntersecting?await this._loadPreview(t):this._cancelPreload?.()}initCallback(){super.initCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._originalUrl=this.$[`*originalUrl`]??``,this.sub(`*originalUrl`,e=>{this._originalUrl=e??``,!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`,e=>{this.active=!!(e&&e===this._filter)}),this.sub(`*networkProblems`,async e=>{e||(this._previewImage?await this._loadPreview():this._schedulePreviewVisibilityCheck())})}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._cancelPreload?.(),this._clearPreviewVisibilityChecks()}updated(e){super.updated(e),e.has(`isOriginal`)&&(this.isOriginal?this._observer?.unobserve(this):(this._observer?.observe(this),this._schedulePreviewVisibilityCheck()))}_updateFilterLabels(e){if(!e){this.titleProp=``;return}this.titleProp=this.l10n(`a11y-cloud-editor-apply-filter`,{name:e.toLowerCase()})}async _loadPreview(e){if(!this.isConnected){e?.unobserve(this),this._cancelPreload?.(),this._cancelPreload=void 0;return}if(!this._originalUrl){!this._previewVisibilityCheckTimeout&&!this._previewVisibilityCheckRaf&&this._schedulePreviewVisibilityCheck();return}let t=++this._lastPreviewRequestId,n=``;try{n=await this.proxyUrl(this._previewSrc())}catch(e){this.$[`*networkProblems`]=!0,console.error(`Failed to resolve preview URL`,{error:e});return}this._previewLoaded=!1,this._cancelPreload?.();let{promise:r,cancel:i}=eu(n);this._cancelPreload=()=>{i(),this._lastPreviewRequestId===t&&(this._cancelPreload=void 0)};try{if(await r,this._lastPreviewRequestId!==t||!this.isConnected)return;this._previewImage=n,this._previewLoaded=!0,this._clearPreviewVisibilityChecks(),(e??this._observer)?.unobserve(this)}catch(e){this.$[`*networkProblems`]=!0,console.error(`Failed to load image`,{error:e}),this._schedulePreviewVisibilityCheck()}finally{this._lastPreviewRequestId===t&&(this._cancelPreload=void 0)}}_schedulePreviewVisibilityCheck(){if(!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal||this.$[`*networkProblems`]){this._clearPreviewVisibilityChecks();return}this._previewVisibilityCheckRaf&&cancelAnimationFrame(this._previewVisibilityCheckRaf),this._previewVisibilityCheckRaf=requestAnimationFrame(()=>{if(this._previewVisibilityCheckRaf=void 0,!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal){this._clearPreviewVisibilityChecks();return}let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,n=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight;if(t&&e.bottom>0&&e.right>0&&e.top<r&&e.left<n){this._loadPreview();return}this._previewVisibilityCheckTimeout=window.setTimeout(()=>{this._previewVisibilityCheckTimeout=void 0,this._schedulePreviewVisibilityCheck()},500)})}_clearPreviewVisibilityChecks(){this._previewVisibilityCheckRaf&&=(cancelAnimationFrame(this._previewVisibilityCheckRaf),void 0),this._previewVisibilityCheckTimeout&&=(window.clearTimeout(this._previewVisibilityCheckTimeout),void 0)}get _shouldShowPreview(){return!!(this._previewLoaded&&!this.active&&!this.isOriginal)}render(){let e=this.onClick,t={opacity:this._shouldShowPreview?`1`:`0`};this._previewImage&&(t.backgroundImage=`url(${this._previewImage})`);let n={opacity:this.active||this.isOriginal?`1`:`0`};return _`
|
|
448
|
-
<button
|
|
449
|
-
role="option"
|
|
450
|
-
type="button"
|
|
451
|
-
class=${jd(this.buttonClasses)}
|
|
452
|
-
aria-label=${X(this.titleProp)}
|
|
453
|
-
title=${X(this.titleProp)}
|
|
454
|
-
@click=${e}
|
|
455
|
-
>
|
|
456
|
-
<div class="uc-preview" ?data-loaded=${this._previewLoaded} style=${Ru(t)}></div>
|
|
457
|
-
<uc-icon
|
|
458
|
-
class=${jd({"uc-original-icon":this.isOriginal})}
|
|
459
|
-
name=${this.icon}
|
|
460
|
-
style=${Ru(n)}
|
|
461
|
-
></uc-icon>
|
|
462
|
-
</button>
|
|
463
|
-
`}},w([x()],Sf.prototype,`_previewImage`,void 0),w([x()],Sf.prototype,`_previewLoaded`,void 0),w([x()],Sf.prototype,`isOriginal`,void 0),w([x()],Sf.prototype,`_iconSize`,void 0),w([b({type:String})],Sf.prototype,`filter`,null)})),wf,Tf=n((()=>{S(),df(),or(),lf(),T(),wf=class extends uf{constructor(...e){super(...e),this._operation=``}get operation(){return this._operation}set operation(e){let t=e??``;if(this._operation===t)return;let n=this._operation;this._operation=t,this.requestUpdate(`operation`,n),this.isConnected&&t&&this._updateOperationMetadata(t)}_updateOperationMetadata(e){this.icon=e,(()=>{let t=this.l10n(`a11y-cloud-editor-apply-tuning`,{name:this.l10n(e).toLowerCase()});return this.titleProp=t,t})(),(()=>{let t=this.l10n(e);return this.title=t,t})()}initCallback(){super.initCallback(),this._operation&&this._updateOperationMetadata(this._operation),this.sub(`*editorTransformations`,e=>{if(!this._operation)return;let{zero:t}=ar[this._operation],n=e[this._operation];this.active=n===void 0?!1:n!==t})}onClick(e){this.$[`*sliderEl`]?.setOperation(this._operation),this.$[`*showSlider`]=!0,this.$[`*currentOperation`]=this._operation,this.telemetryManager.sendEventCloudImageEditor(e,this.$[`*tabId`],{operation:cf(this.$[`*operationTooltip`])})}},w([b({type:String})],wf.prototype,`operation`,null)})),Ef,Df,Of,kf=n((()=>{S(),I(),T(),Ef=1,Df=()=>{},Of=class extends F{constructor(...e){super(...e),this.hiddenScrollbar=!1,this._handleWheel=e=>{e.preventDefault();let{deltaY:t,deltaX:n}=e;if(Math.abs(n)>Ef){this.scrollLeft+=n;return}this.scrollLeft+=t}}connectedCallback(){super.connectedCallback(),this.addEventListener(`wheel`,this._handleWheel,{passive:!1}),this.addEventListener(`scroll`,Df,{passive:!0})}disconnectedCallback(){this.removeEventListener(`wheel`,this._handleWheel),this.removeEventListener(`scroll`,Df),super.disconnectedCallback()}},w([b({type:Boolean,noAccessor:!0,attribute:`hidden-scrollbar`})],Of.prototype,`hiddenScrollbar`,void 0)})),Af,jf=n((()=>{y(),S(),G(),Bu(),md(),I(),nn(),nu(),sf(),or(),Vd(),lf(),T(),Af=class extends F{constructor(...e){super(...e),this._showLoader=!1,this.showMainToolbar=!0,this.showSubToolbar=!1,this._showTabToggles=!0,this.tabList=[...er],this.activeTab=D.CROP,this._useSliderPanel=!0,this._tooltipVisible=!1,this._operationTooltip=null,this._tabIndicatorOffset=0,this._tabIndicatorWidth=0,this._sliderRef=U(),this._tabIndicatorRef=U(),this.tabToggleRefs={[D.CROP]:U(),[D.TUNING]:U(),[D.FILTERS]:U()},this._handleWindowResize=()=>{this._syncTabIndicator()},this._cropPresets=[],this._debouncedShowLoader=C(e=>{this._showLoader=e},500),this._updateInfoTooltip=C(()=>{let e=this.$[`*editorTransformations`],t=this.$[`*currentOperation`],n=``,r=!1;if(this.$[`*tabId`]===D.FILTERS)if(r=!0,this.$[`*currentFilter`]&&e?.filter?.name===this.$[`*currentFilter`]){let t=e?.filter?.amount||100;n=`${this.$[`*currentFilter`]} ${t}`}else n=this.l10n(af);else if(this.showSubToolbar&&this.$[`*tabId`]===D.TUNING&&t){r=!0;let i=e?.[t]||ar[t].zero;n=`${this.l10n(t)} ${i}`}r&&(this.$[`*operationTooltip`]=n),this._tooltipVisible=r},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":af,"*currentOperation":null,"*operationTooltip":null},this._handleCancel=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$[`*tabId`],{action:`cancel`}),this._cancelPreload?.();let t=this.$[`*on.cancel`];t?.()},this._handleApply=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$[`*tabId`],{action:`apply`});let t=this.$[`*on.apply`];t?.(this.$[`*editorTransformations`])},this._handleApplySlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$[`*tabId`],{action:`apply-slider`,operation:cf(this.$[`*operationTooltip`])}),this._sliderRef.value?.apply(),this._onSliderClose()},this._handleCancelSlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$[`*tabId`],{action:`cancel-slider`}),this._sliderRef.value?.cancel(),this._onSliderClose()},this._handleTabClick=e=>{let t=e.currentTarget?.getAttribute(`data-id`);t&&(this.telemetryManager.sendEventCloudImageEditor(e,t),this._activateTab(t,{fromViewer:!1}))}}_onSliderClose(){this.$[`*showSlider`]=!1,this.$[`*tabId`]===D.CROP&&(this.$[`*showListAspectRatio`]=!1),this.$[`*tabId`]===D.TUNING&&(this._tooltipVisible=!1)}_activateTab(e,{fromViewer:t=!1,force:n=!1}={}){this.$[`*tabId`]!==e&&(this.$[`*tabId`]=e),this._applyTabState(e,{fromViewer:t,force:n})}_applyTabState(e,{fromViewer:t,force:n=!1}){if(!n&&this.activeTab===e){this._syncTabIndicator();return}this.activeTab=e;let r=this.$[`*faderEl`],i=this.$[`*cropperEl`];e===D.CROP?(r?.deactivate(),this.$[`*imageSize`]&&i?.activate(this.$[`*imageSize`],{fromViewer:t})):(r?.activate({url:this.$[`*originalUrl`],fromViewer:t}),i?.deactivate());for(let t of er){let n=t===e,r=this.tabToggleRefs[t]?.value;r&&(r.active=n),n&&this._syncTabIndicator()}}_syncTabIndicator(){let e=this.tabToggleRefs[this.activeTab]?.value,t=this._tabIndicatorRef.value;if(!e||!t)return;let n=e.offsetLeft,r=e.offsetWidth||Number(getComputedStyle(e).width.replace(`px`,``));(this._tabIndicatorOffset!==n||this._tabIndicatorWidth!==r)&&(this._tabIndicatorOffset=n,this._tabIndicatorWidth=r,t.style.transform=`translateX(${n}px)`,t.style.width=`${r}px`)}get _hasAspectRatioPicker(){return this._cropPresets.length>=3}_renderControlsByTab(e){switch(e){case D.CROP:return this._renderCropTabControls();case D.FILTERS:return this._renderFilterTabControls();case D.TUNING:return this._renderTuningTabControls();default:return[]}}_renderCropTabControls(){let e=[];if(this._hasAspectRatioPicker)e.push(()=>this._renderFreeformControl());else for(let t of this._cropPresets)e.push(()=>this._renderAspectRatioControl(t));for(let t of rr)e.push(()=>this._renderCropOperationControl(t));return this._renderControlGroup(e)}_renderFilterTabControls(){let e=[af,...nr].map(e=>()=>this._renderFilterControl(e));return this._renderControlGroup(e)}_renderTuningTabControls(){let e=tr.map(e=>()=>this._renderOperationControl(e));return this._renderControlGroup(e)}_renderControlGroup(e){return e.length?e.map(e=>e()):[]}_renderFreeformControl(){return _`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}_renderAspectRatioControl(e){return _`<uc-editor-aspect-ratio-button-control .aspectRatio=${e}></uc-editor-aspect-ratio-button-control>`}_renderCropOperationControl(e){return _`<uc-editor-crop-button-control .operation=${e}></uc-editor-crop-button-control>`}_renderFilterControl(e){return _`<uc-editor-filter-control .filter=${e}></uc-editor-filter-control>`}_renderOperationControl(e){return _`<uc-editor-operation-control .operation=${e}></uc-editor-operation-control>`}_renderAspectRatioList(){return this._hasAspectRatioPicker?this._cropPresets.map(e=>this._renderAspectRatioControl(e)):[]}async _preloadEditedImage(){if(this.$[`*imgContainerEl`]&&this.$[`*originalUrl`]){let e=this.$[`*imgContainerEl`].offsetWidth,t=await this.proxyUrl(Bd(this.$[`*originalUrl`],e,this.$[`*editorTransformations`]));this._cancelPreload?.();let{cancel:n}=tu([t]);this._cancelPreload=()=>{n(),this._cancelPreload=void 0}}}initCallback(){super.initCallback(),this._cropPresets=[...this.$[`*cropPresetList`]??[]],this.sub(`*cropPresetList`,e=>{this._cropPresets=[...e??[]]}),this.sub(`*imageSize`,e=>{e&&setTimeout(()=>{this._activateTab(this.$[`*tabId`],{fromViewer:!0})},0)}),this.sub(`*editorTransformations`,e=>{let t=e?.filter?.name;this.$[`*currentFilter`]!==t&&(this.$[`*currentFilter`]=t??``)}),this.sub(`*currentFilter`,()=>{this._updateInfoTooltip()}),this.sub(`*currentOperation`,()=>{this._updateInfoTooltip()}),this.sub(`*tabId`,e=>{this._applyTabState(e,{fromViewer:!1,force:!0}),this._updateInfoTooltip()}),this.sub(`*originalUrl`,()=>{this.$[`*faderEl`]?.deactivate()}),this.sub(`*editorTransformations`,e=>{this._preloadEditedImage(),this.$[`*faderEl`]?.setTransformations(e)}),this.sub(`*loadingOperations`,e=>{let t=!1;for(let[,n]of e.entries()){if(t)break;for(let[,e]of n.entries())if(e){t=!0;break}}this._debouncedShowLoader(t)}),this.sub(`*showSlider`,e=>{e?(this.showSubToolbar=!0,this.showMainToolbar=!1,this._useSliderPanel=!0):this.$[`*showListAspectRatio`]||(this.showSubToolbar=!1,this.showMainToolbar=!0)}),this.sub(`*showListAspectRatio`,e=>{e?(this.showSubToolbar=!0,this.showMainToolbar=!1,this._useSliderPanel=!1):this.$[`*showSlider`]||(this.showSubToolbar=!1,this.showMainToolbar=!0)}),this.sub(`*tabList`,e=>{if(this.tabList=e,this._showTabToggles=e.length>1,!e.includes(this.$[`*tabId`])&&e.length>0){let[t]=e;t&&this._activateTab(t,{fromViewer:!1});return}this._syncTabIndicator()}),this.sub(`*operationTooltip`,e=>{this._operationTooltip=e}),this._updateInfoTooltip()}connectedCallback(){super.connectedCallback(),window.addEventListener(`resize`,this._handleWindowResize)}firstUpdated(e){super.firstUpdated(e),this._assignSharedElements(),this._syncTabIndicator()}updated(e){super.updated(e),(e.has(`activeTab`)||e.has(`tabList`))&&this.updateComplete.then(()=>this._syncTabIndicator()),(e.has(`showSubToolbar`)||e.has(`showMainToolbar`))&&this._assignSharedElements()}disconnectedCallback(){window.removeEventListener(`resize`,this._handleWindowResize),super.disconnectedCallback(),this.$[`*showSlider`]=!1,this.$[`*showListAspectRatio`]=!1}_assignSharedElements(){let e=this._sliderRef.value;e&&(this.$[`*sliderEl`]=e)}_renderTabToggle(e){let t=this.tabList.includes(e),n=this.activeTab===e,r=this.tabList.indexOf(e),i=r>=0?Ru({gridColumn:`${r+1}`}):v;return _`
|
|
464
|
-
<uc-presence-toggle class="uc-tab-toggle" .visible=${t} .styles=${this._tabToggleStyles}>
|
|
465
|
-
<uc-btn-ui
|
|
466
|
-
theme="tab"
|
|
467
|
-
data-id=${e}
|
|
468
|
-
icon=${e}
|
|
469
|
-
role="tab"
|
|
470
|
-
aria-controls=${`tab_${e}`}
|
|
471
|
-
aria-selected=${n?`true`:`false`}
|
|
472
|
-
title-prop=${`a11y-editor-tab-${e}`}
|
|
473
|
-
.active=${n}
|
|
474
|
-
style=${i}
|
|
475
|
-
@click=${this._handleTabClick}
|
|
476
|
-
${W(this.tabToggleRefs[e])}
|
|
477
|
-
></uc-btn-ui>
|
|
478
|
-
</uc-presence-toggle>
|
|
479
|
-
`}_renderTabContent(e){let t=this._renderControlsByTab(e);return _`
|
|
480
|
-
<div
|
|
481
|
-
id=${`tab_${e}`}
|
|
482
|
-
class="uc-tab-content"
|
|
483
|
-
>
|
|
484
|
-
<uc-editor-scroller hidden-scrollbar>
|
|
485
|
-
<div class="uc-controls-list_align">
|
|
486
|
-
<div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">
|
|
487
|
-
${t.length?t:v}
|
|
488
|
-
</div>
|
|
489
|
-
</div>
|
|
490
|
-
</uc-editor-scroller>
|
|
491
|
-
</div>
|
|
492
|
-
`}render(){let e=[`uc-info-tooltip`,this._tooltipVisible?`uc-info-tooltip_visible`:`uc-info-tooltip_hidden`].join(` `),t=this._hasAspectRatioPicker;return _`
|
|
493
|
-
<uc-line-loader-ui .active=${this._showLoader}></uc-line-loader-ui>
|
|
494
|
-
<div class="uc-info-tooltip_container">
|
|
495
|
-
<div class="uc-info-tooltip_wrapper">
|
|
496
|
-
<div class=${e}>${this._operationTooltip??``}</div>
|
|
497
|
-
</div>
|
|
498
|
-
</div>
|
|
499
|
-
<div class="uc-toolbar-container">
|
|
500
|
-
<uc-presence-toggle
|
|
501
|
-
role="tablist"
|
|
502
|
-
class="uc-sub-toolbar"
|
|
503
|
-
.visible=${this.showMainToolbar}
|
|
504
|
-
.styles=${this._subTopToolbarStyles}
|
|
505
|
-
>
|
|
506
|
-
<div class="uc-tab-content-row">
|
|
507
|
-
${er.map(e=>fd(this.activeTab===e,()=>this._renderTabContent(e)))}
|
|
508
|
-
</div>
|
|
509
|
-
<div class="uc-controls-row">
|
|
510
|
-
<uc-presence-toggle
|
|
511
|
-
class="uc-tab-toggles"
|
|
512
|
-
.visible=${this._showTabToggles}
|
|
513
|
-
.styles=${this._tabTogglesStyles}
|
|
514
|
-
@initial-render=${()=>this._syncTabIndicator()}
|
|
515
|
-
>
|
|
516
|
-
<div
|
|
517
|
-
class="uc-tab-toggles_indicator"
|
|
518
|
-
${W(this._tabIndicatorRef)}
|
|
519
|
-
></div>
|
|
520
|
-
${er.map(e=>this._renderTabToggle(e))}
|
|
521
|
-
</uc-presence-toggle>
|
|
522
|
-
<uc-btn-ui
|
|
523
|
-
style="order: -1"
|
|
524
|
-
theme="secondary-icon"
|
|
525
|
-
icon="closeMax"
|
|
526
|
-
title-prop="cancel"
|
|
527
|
-
@click=${this._handleCancel}
|
|
528
|
-
></uc-btn-ui>
|
|
529
|
-
<uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this._handleApply}></uc-btn-ui>
|
|
530
|
-
</div>
|
|
531
|
-
</uc-presence-toggle>
|
|
532
|
-
<uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this._subBottomToolbarStyles}>
|
|
533
|
-
<div class="uc-slider" ?hidden=${!this._useSliderPanel}>
|
|
534
|
-
<uc-editor-slider ${W(this._sliderRef)}></uc-editor-slider>
|
|
535
|
-
</div>
|
|
536
|
-
|
|
537
|
-
<div class="uc-list-aspect-ratio-container" ?hidden=${this._useSliderPanel||!t}>
|
|
538
|
-
${t?_`<div class="uc-list-aspect-ratio">${this._renderAspectRatioList()}</div>`:v}
|
|
539
|
-
</div>
|
|
540
|
-
<div class="uc-controls-row">
|
|
541
|
-
<uc-btn-ui theme="secondary" @click=${this._handleCancelSlider} text=${this.l10n(`cancel`)}></uc-btn-ui>
|
|
542
|
-
<uc-btn-ui theme="primary" @click=${this._handleApplySlider} text=${this.l10n(`apply`)}></uc-btn-ui>
|
|
543
|
-
</div>
|
|
544
|
-
</uc-presence-toggle>
|
|
545
|
-
</div>
|
|
546
|
-
`}},w([x()],Af.prototype,`_showLoader`,void 0),w([x()],Af.prototype,`showMainToolbar`,void 0),w([x()],Af.prototype,`showSubToolbar`,void 0),w([x()],Af.prototype,`_showTabToggles`,void 0),w([x()],Af.prototype,`tabList`,void 0),w([x()],Af.prototype,`activeTab`,void 0),w([x()],Af.prototype,`_useSliderPanel`,void 0),w([x()],Af.prototype,`_tooltipVisible`,void 0),w([x()],Af.prototype,`_operationTooltip`,void 0),w([x()],Af.prototype,`_cropPresets`,void 0)})),Mf,Nf,Pf=n((()=>{y(),S(),G(),Ko(),md(),I(),zn(),En(),nn(),$l(),vd(),Zc(),xd(),$n(),Cd(),Td(),or(),T(),Mf=Tn([...er]),Nf=class extends F{constructor(...e){super(...e),this.ctxOwner=!0,this._statusMessage=``,this._imageSrc=Ql,this._fileType=``,this._showLoader=!1,this.uuid=null,this.cdnUrl=null,this.cropPreset=``,this.tabs=Mf,this._hasNetworkProblems=!1,this._isInitialized=!1,this._pendingInitUpdate=null,this._debouncedShowLoader=C(e=>{this._showLoader=e},300),this._imgRef=U(),this._cropperRef=U(),this._faderRef=U(),this._imgContainerRef=U(),this._handleImageLoad=()=>{this._debouncedShowLoader(!1),this._imageSrc!==`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=`&&(this.$[`*networkProblems`]=!1)},this._handleImageError=()=>{this._debouncedShowLoader(!1),this.$[`*networkProblems`]=!0},this._handleRetryNetwork=()=>{let e=this.$[`*on.retryNetwork`];e?.()},this.init$={...this.init$,...Sd(this)}}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 e=this._faderRef.value;e&&(this.$[`*faderEl`]=e);let t=this._cropperRef.value;t&&(this.$[`*cropperEl`]=t);let n=this._imgContainerRef.value;n&&(this.$[`*imgContainerEl`]=n);let r=this._imgRef.value;r&&(this.$[`*imgEl`]=r)}_attachImageListeners(){let e=this._imgRef.value;e&&(e.addEventListener(`load`,this._handleImageLoad),e.addEventListener(`error`,this._handleImageError))}_detachImageListeners(){let e=this._imgRef.value;e&&(e.removeEventListener(`load`,this._handleImageLoad),e.removeEventListener(`error`,this._handleImageError))}get _imageClassName(){let e=this.$[`*tabId`];return gd(`uc-image`,{"uc-image_hidden_to_cropper":e===D.CROP,"uc-image_hidden_effects":e!==D.CROP})}_waitForSize(){return new Promise((e,t)=>{let n=window.setTimeout(()=>{t(Error(`[cloud-image-editor] timeout waiting for non-zero container size`))},3e3),r=new ResizeObserver(t=>{let[i]=t;i&&i.contentRect.width>0&&i.contentRect.height>0&&(window.clearTimeout(n),r.disconnect(),window.setTimeout(()=>e(),0))});r.observe(this)})}firstUpdated(e){super.firstUpdated(e),this._assignSharedElements(),this._attachImageListeners(),this.initEditor();let t=!!(this.uuid||this.cdnUrl),n=e.has(`uuid`)||e.has(`cdnUrl`);t&&!n&&this.updateImage()}disconnectedCallback(){this._detachImageListeners(),super.disconnectedCallback()}render(){let e=this._fileType??``,t=this._statusMessage??``,n=this._imageSrc||`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=`,r=this._showLoader,i=this._hasNetworkProblems;return _`
|
|
547
|
-
${Wo(wd)}
|
|
548
|
-
<div class="uc-wrapper uc-wrapper_desktop">
|
|
549
|
-
<uc-presence-toggle class="uc-network_problems_splash" .visible=${i}>
|
|
550
|
-
<div class="uc-network_problems_content">
|
|
551
|
-
<div class="uc-network_problems_icon">
|
|
552
|
-
<uc-icon name="sad"></uc-icon>
|
|
553
|
-
</div>
|
|
554
|
-
<div class="uc-network_problems_text">Network error</div>
|
|
555
|
-
</div>
|
|
556
|
-
<div class="uc-network_problems_footer">
|
|
557
|
-
<uc-btn-ui theme="primary" text="Retry" @click=${this._handleRetryNetwork}></uc-btn-ui>
|
|
558
|
-
</div>
|
|
559
|
-
</uc-presence-toggle>
|
|
560
|
-
<div class="uc-viewport">
|
|
561
|
-
<div class="uc-file_type_outer">
|
|
562
|
-
<div class="uc-file_type">${e}</div>
|
|
563
|
-
</div>
|
|
564
|
-
<div class="uc-image_container" ${W(this._imgContainerRef)}>
|
|
565
|
-
<img src=${n} class=${this._imageClassName} ${W(this._imgRef)} />
|
|
566
|
-
${fd(this._isInitialized,()=>_`<uc-editor-image-cropper ${W(this._cropperRef)}></uc-editor-image-cropper>`)}
|
|
567
|
-
<uc-editor-image-fader ${W(this._faderRef)}></uc-editor-image-fader>
|
|
568
|
-
</div>
|
|
569
|
-
<div class="uc-info_pan">${t}</div>
|
|
570
|
-
</div>
|
|
571
|
-
<div class="uc-toolbar">
|
|
572
|
-
<uc-line-loader-ui .active=${r}></uc-line-loader-ui>
|
|
573
|
-
<div class="uc-toolbar_content uc-toolbar_content__editor">
|
|
574
|
-
${fd(this._isInitialized,()=>_`<uc-editor-toolbar></uc-editor-toolbar>`)}
|
|
575
|
-
</div>
|
|
576
|
-
</div>
|
|
577
|
-
</div>
|
|
578
|
-
`}updated(e){super.updated(e),e.has(`uuid`)&&this.uuid&&this.updateImage(),e.has(`cdnUrl`)&&this.cdnUrl&&this.updateImage(),e.has(`tabs`)&&this._syncTabListFromProp(),(e.has(`cropPreset`)||e.has(`cdnUrl`))&&this._syncCropPresetState()}_syncTabListFromProp(){let e=this.tabs||Mf;this.$[`*tabList`]=bd(e)}_syncCropPresetState(){let e=Yc(this.cropPreset??``),t=null;if(this.cdnUrl){let n=Wn(An(this.cdnUrl));if(Array.isArray(n?.crop?.dimensions)){let[r,i]=n.crop.dimensions;t=Xc(r,i,e,.1)}}this.$[`*cropPresetList`]=e,this.$[`*currentAspectRatio`]=t??e?.[0]??null}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.cdnUrl){let e=this.cdnUrl,t=Rn(e,On(e));if(t===this.$[`*originalUrl`])return;this.$[`*originalUrl`]=t;let n=Wn(An(e));this.$[`*editorTransformations`]=n}else if(this.uuid){let e=Rn(this.cfg.cdnCname,this.uuid);if(e===this.$[`*originalUrl`])return;this.$[`*originalUrl`]=e,Object.keys(this.$[`*editorTransformations`]).length>0&&(this.$[`*editorTransformations`]={})}else throw Error(`No UUID nor CDN URL provided`);this.$[`*tabId`]===D.CROP?this.$[`*cropperEl`]?.deactivate({reset:!0}):this.$[`*faderEl`]?.deactivate();try{let e=this.$[`*originalUrl`],t=await this.proxyUrl(Ln(e,In(`json`))),{width:n,height:r}=await fetch(t).then(e=>e.json());this.$[`*imageSize`]={width:n,height:r},this.$[`*tabId`]===D.CROP?this.$[`*cropperEl`]?.activate(this.$[`*imageSize`]):this.$[`*faderEl`]?.activate({url:e})}catch(e){e&&(this.telemetryManager.sendEventError(e,`cloud editor image. Failed to load image info`),console.error(`Failed to load image info`,e))}this._scheduleInitialization()}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.classList.add(`uc-editor_ON`),this.sub(`*networkProblems`,e=>{this._hasNetworkProblems=!!e}),this.sub(`*editorTransformations`,e=>{if(Object.keys(e).length===0)return;let t=this.$[`*originalUrl`],n=In(Un(e),`preview`),r={originalUrl:t,cdnUrlModifiers:n,cdnUrl:Ln(t,n),transformations:e};this.dispatchEvent(new CustomEvent(`change`,{detail:r,bubbles:!0,composed:!0}))},!1)}},w([x()],Nf.prototype,`_statusMessage`,void 0),w([x()],Nf.prototype,`_imageSrc`,void 0),w([x()],Nf.prototype,`_fileType`,void 0),w([x()],Nf.prototype,`_showLoader`,void 0),w([b({type:String,reflect:!0})],Nf.prototype,`uuid`,void 0),w([b({type:String,attribute:`cdn-url`,reflect:!0})],Nf.prototype,`cdnUrl`,void 0),w([b({type:String,attribute:`crop-preset`,reflect:!0})],Nf.prototype,`cropPreset`,void 0),w([b({type:String,reflect:!0})],Nf.prototype,`tabs`,void 0),w([x()],Nf.prototype,`_hasNetworkProblems`,void 0),w([x()],Nf.prototype,`_isInitialized`,void 0)})),Ff=n((()=>{Pf(),Ud(),_f(),xf(),Cf(),Kd(),tf(),Tf(),kf(),sf(),jf(),Ld(),Ad(),Od(),rf()})),If=n((()=>{dd(),Ff()})),Lf,Rf=n((()=>{Pf(),P(),Lf=class extends Nf{static{this.styleAttrs=[...super.styleAttrs,`uc-wgt-common`]}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName}}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:M.INIT_SOLUTION}),this.a11y?.registerBlock(this)}}})),zf=r({BtnUi:()=>Id,CloudImageEditor:()=>Lf,CloudImageEditorBlock:()=>Nf,Config:()=>Qm,CropFrame:()=>Hd,EditorAspectRatioButtonControl:()=>gf,EditorCropButtonControl:()=>bf,EditorFilterControl:()=>Sf,EditorFreeformButtonControl:()=>hf,EditorImageCropper:()=>Gd,EditorImageFader:()=>ef,EditorOperationControl:()=>wf,EditorScroller:()=>Of,EditorSlider:()=>of,EditorToolbar:()=>Af,Icon:()=>rl,LineLoaderUi:()=>kd,PresenceToggle:()=>Dd,SliderUi:()=>nf,defineComponents:()=>un},1),Bf=n((()=>{ud(),If(),Rf(),fn(),$m(),il()})),Vf=n((()=>{})),Hf=r({CloudImageEditorActivity:()=>Uf},1),Uf,Wf=n((()=>{y(),S(),Fd(),B(),H(),Vf(),T(),Uf=class extends V{constructor(...e){super(...e),this._editorConfig=null}get activityParams(){let e=super.activityParams;if(`internalId`in e)return e;throw Error(`Cloud Image Editor activity params not found`)}initCallback(){super.initCallback(),this.subConfigValue(`cropPreset`,e=>{this._editorConfig&&this._editorConfig.cropPreset!==e&&(this._editorConfig={...this._editorConfig,cropPreset:e})}),this.subConfigValue(`cloudImageEditorTabs`,e=>{this._editorConfig&&this._editorConfig.tabs!==e&&(this._editorConfig={...this._editorConfig,tabs:e})}),this._mountEditor()}disconnectedCallback(){super.disconnectedCallback(),this._unmountEditor()}_handleApply(e){if(!this._entry)return;this.debugPrint(`editor event "apply"`,e.detail);let t=e.detail;this._entry.setMultipleValues({cdnUrl:t.cdnUrl,cdnUrlModifiers:t.cdnUrlModifiers}),this.modalManager?.close(z.activities.CLOUD_IMG_EDIT),this.historyBack()}_handleCancel(e){let t=e instanceof CustomEvent?e.detail:void 0;this.debugPrint(`editor event "cancel"`,t),this.modalManager?.close(z.activities.CLOUD_IMG_EDIT),this.historyBack()}handleChange(e){this.debugPrint(`editor event "change"`,e.detail)}_mountEditor(){let{internalId:e}=this.activityParams,t=this.uploadCollection.read(e);if(!t)throw Error(`Entry with internalId "${e}" not found`);this._entry=t;let n=this._entry.getValue(`cdnUrl`);if(!n)throw Error(`Entry with internalId "${e}" hasn't uploaded yet`);this._editorConfig=this._createEditorConfig(n)}_unmountEditor(){this._entry=void 0,this._editorConfig=null}render(){if(!this._editorConfig)return v;let{cdnUrl:e,cropPreset:t,tabs:n}=this._editorConfig;return _`
|
|
579
|
-
<uc-cloud-image-editor
|
|
580
|
-
cdn-url=${e}
|
|
581
|
-
crop-preset=${X(t)}
|
|
582
|
-
tabs=${X(n)}
|
|
583
|
-
@apply=${this._handleApply}
|
|
584
|
-
@cancel=${this._handleCancel}
|
|
585
|
-
@change=${this.handleChange}
|
|
586
|
-
></uc-cloud-image-editor>
|
|
587
|
-
`}_createEditorConfig(e){return{cdnUrl:e,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}},w([x()],Uf.prototype,`_editorConfig`,void 0)})),Gf=r({cloudImageEditorPlugin:()=>Xf},1),Kf,qf,Jf,Yf,Xf,Zf=n((()=>{fn(),ga(),Kf=`cloud-image-editor`,qf=`<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>`,Jf={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`}},Yf=async()=>{let[e,t]=await Promise.all([Promise.resolve().then(()=>(Bf(),zf)),Promise.resolve().then(()=>(Wf(),Hf))]);un({...e,...t})},Xf={id:Kf,setup:async({pluginApi:e,uploaderApi:t})=>{await Yf(),e.registry.registerIcon({name:`edit-file`,svg:qf}),e.registry.registerI18n(Jf),e.registry.registerFileAction({id:`edit-file`,icon:`edit-file`,shouldRender:e=>!!(e.isSuccess&&e.isImage&&e.cdnUrl),onClick:e=>{t.setCurrentActivity?.(j.CLOUD_IMG_EDIT,{internalId:e.internalId}),t.setModalState?.(!0)}}),e.registry.registerActivity({id:j.CLOUD_IMG_EDIT,render:e=>{let t=document.createElement(`uc-cloud-image-editor-activity`);return e.append(t),()=>{e.replaceChildren()}}})}}}));function Qf(e){return(...t)=>new Promise(n=>{setTimeout(()=>{n(e(...t))},0)})}var $f,ep,tp,np,rp,ip,ap,op,sp,cp,lp,up,dp,fp,pp,mp,hp,gp,_p,vp,yp,bp,xp,Sp,Cp,wp,Tp,Ep,Dp,Op,kp,Ap,jp,Mp,Np,Pp,Fp,Ip,Lp,Rp=n((()=>{$f=()=>{let e=[];return{stack:e,promiseReadJpegChunks:t=>new Promise((n,r)=>{let i=2,a=(e,t)=>{let n=new FileReader;n.addEventListener(`load`,()=>{t(new DataView(n.result))}),n.addEventListener(`error`,e=>{r(`Reader error: ${e}`)}),n.readAsArrayBuffer(e)},o=()=>a(t.slice(i,i+128),e=>{let t,n,r;for(t=n=0,r=e.byteLength;r>=0?n<r:n>r;t=r>=0?++n:--n)if(e.getUint8(t)===255){i+=t;break}s()}),s=()=>{let s=i;return a(t.slice(i,i+=4),c=>{if(c.byteLength!==4||c.getUint8(0)!==255){r(`Corrupted`);return}let l=c.getUint8(1);if(l===218){n(!0);return}let u=c.getUint16(2)-2;return a(t.slice(i,i+=u),t=>{if(t.byteLength!==u){r(`Corrupted`);return}e.push({startPos:s,length:u,marker:l,view:t}),o()})})};FileReader&&DataView||r(`Not Support`),a(t.slice(0,2),e=>{e.getUint16(0)!==65496&&r(`Not jpeg`),o()})})}},ep=async e=>{let t=[],{promiseReadJpegChunks:n,stack:r}=$f();return await n(e),r.forEach(({marker:e,view:n})=>{e===226&&n.getUint32(0)===1229144927&&n.getUint32(4)===1347571526&&n.getUint32(8)===1229735168&&t.push(n)}),t},tp=async(e,t,n)=>{{let r=[],i=[],{promiseReadJpegChunks:a,stack:o}=$f();await a(e),o.forEach(e=>{if(e.marker===t)return r.push(e.startPos),i.push(e.length)});let s=[e.slice(0,2)];for(let e of n){let n=new DataView(new ArrayBuffer(4));n.setUint16(0,65280+t),n.setUint16(2,e.byteLength+2),s.push(n.buffer),s.push(e)}let c=2;for(let t=0;t<r.length;t++)r[t]>c&&s.push(e.slice(c,r[t])),c=r[t]+i[t]+4;return s.push(e.slice(c,e.size)),new Blob(s,{type:e.type})}},np=226,rp=(e,t)=>tp(e,np,t.map(e=>e.buffer)),ip=async e=>{try{return await rp(e,[])}catch(e){throw Error(`Failed to strip ICC profile: ${e}`)}},ap=(e,t,n)=>new Promise((r,i)=>{e.toBlob(e=>{if(!e){i(`Failed to convert canvas to blob`);return}r(e)},t,n),e.width=e.height=1}),op=()=>{let e=document.createElement(`canvas`);return{canvas:e,ctx:e.getContext(`2d`)}},sp=e=>{let{ctx:t,canvas:n}=op();n.width=n.height=50,t.drawImage(e,0,0,50,50);let r=t.getImageData(0,0,50,50).data;n.width=n.height=1;for(let e=3;e<r.length;e+=4)if(r[e]<254)return!0;return!1},cp=async e=>{let t=null,{promiseReadJpegChunks:n,stack:r}=$f();return await n(e),r.forEach(({marker:e,view:n})=>{if(!t&&e===225&&n.byteLength>=14&&n.getUint32(0)===1165519206&&n.getUint16(4)===0){t=n;return}}),t},lp=`data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=`,up=void 0,dp=()=>new Promise(e=>{if(up!==void 0)e(up);else{let t=new Image;t.addEventListener(`load`,()=>{up=t.naturalWidth<t.naturalHeight,t.src=`//:0`,e(up)}),t.src=lp}}),fp=(e,t)=>{let n,r,i,a;if(!e||e.byteLength<14||e.getUint32(0)!==1165519206||e.getUint16(4)!==0)return;if(e.getUint16(6)===18761)r=!0;else if(e.getUint16(6)===19789)r=!1;else return;if(e.getUint16(8,r)!==42)return;i=8+e.getUint32(10,r);let o=e.getUint16(i-2,r);for(n=0,a=o;a>=0?n<a:n>a;a>=0?++n:--n){if(e.byteLength<i+10)return;e.getUint16(i,r)===274&&t(i+8,r),i+=12}},pp=(e,t)=>{fp(e,(n,r)=>e.setUint16(n,t,r))},mp=async(e,t,n)=>(n&&pp(t,1),tp(e,225,[t.buffer])),hp=(e,t)=>new Promise((n,r)=>{t&&(e.src=t),e.complete?n(e):(e.addEventListener(`load`,()=>{n(e)}),e.addEventListener(`error`,()=>{r(Error(`Failed to load image. Probably not an image.`))}))}),gp=e=>hp(new Image,e),_p=[1,3],vp=[192,193,194,195,197,198,199,201,202,203,205,206,207],yp={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},bp=async e=>{let t=!1,{promiseReadJpegChunks:n,stack:r}=$f();return await n(e).then(()=>(r.forEach(({marker:e,view:n})=>{if(!t&&vp.indexOf(e)>=0){let e=n.getUint8(5);_p.indexOf(e)<0&&(t=!0)}}),t)).catch(()=>t)},xp=(e,t)=>{let n={};return(...r)=>{let i=t(r,n);return i in n?n[i]:n[i]=e(...r)}},Sp=(e,t)=>{let[n]=e,r=Object.keys(t).map(e=>parseInt(e,10)).sort((e,t)=>e-t);for(let e=0;e<r.length;e++){let i=r[e],a=!!t[i];if(i>n&&a||i<n&&!a)return i}return n},Cp={R:55,G:110,B:165,A:255},wp=`rgba(${Cp.R}, ${Cp.G}, ${Cp.B}, ${Cp.A/255})`,Tp=(e,t)=>{try{let n=[e-1,t-1,1,1],{canvas:r,ctx:i}=op();r.width=1,r.height=1;let{canvas:a,ctx:o}=op();a.width=e,a.height=t,o&&(o.fillStyle=wp,o.fillRect(...n),i.drawImage(a,e-1,t-1,1,1,0,0,1,1));let s=i&&i.getImageData(0,0,1,1).data,c=!1;return s&&(c=s[0]===Cp.R&&s[1]===Cp.G&&s[2]===Cp.B&&s[3]===Cp.A),a.width=a.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${e}x${t}.`),!1}},Ep=Qf(xp(Tp,Sp)),Dp=Qf(xp(Tp,Sp)),Op=async(e,t)=>{let n=yp.squareSide.find(n=>n*n>=e*t),r=yp.dimension.find(n=>n>=e&&n>=t);if(!n||!r)throw Error(`Not supported`);let[i,a]=await Promise.all([Ep(n,n),Dp(r,1)]);if(i&&a)return!0;throw Error(`Not supported`)},kp=async(e,t,n)=>{try{let{ctx:r,canvas:i}=op();return i.width=t,i.height=n,r.imageSmoothingQuality=`high`,r.drawImage(e,0,0,t,n),e instanceof HTMLImageElement&&(e.src=`//:0`),e instanceof HTMLCanvasElement&&(e.width=e.height=1),i}catch(e){throw Error(`Canvas resize error`,{cause:e})}},Ap=({img:e,targetW:t,targetH:n})=>kp(e,t,n),jp=function({sourceW:e,targetW:t,targetH:n,step:r}){let i=[],a=t,o=n;do i.push([a,o]),a=Math.round(a/r),o=Math.round(o/r);while(a<e*r);return i.reverse()},Mp=({img:e,sourceW:t,targetW:n,targetH:r,step:i})=>{let a=jp({sourceW:t,targetW:n,targetH:r,step:i});return a.reduce((e,[t,n],r)=>e.then(e=>Op(t,n).then(()=>kp(e,t,n)).catch(()=>{if(r===a.length-1)throw Error(`Not supported`);return e})),Promise.resolve(e))},Np=()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Pp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Fp=.71,Ip=(e,t)=>{if(e.width*Fp*e.height*Fp<t.size)throw Error(`Not required`);let n=e.width,r=n/e.height,i=Math.floor(Math.sqrt(t.size*r)),a=Math.floor(t.size/Math.sqrt(t.size*r));return Op(i,a).then(()=>{let{ctx:t}=op();return`imageSmoothingQuality`in t&&!Np()&&!Pp?Ap({img:e,targetW:i,targetH:a}):Mp({img:e,sourceW:n,targetW:i,targetH:a,step:Fp})}).catch(()=>Promise.reject(`Not supported`))},Lp=async(e,t)=>{try{if(await bp(e))throw Error(`Should skipped`);let n=await Promise.allSettled([cp(e),dp(),ep(e)]),r=!n.some(e=>e.status===`rejected`),[i,a,o]=n,s=await ip(e).catch(()=>e),c=await gp(URL.createObjectURL(s));URL.revokeObjectURL(c.src);let l=await Ip(c,t),u=`image/jpeg`,d=t?.quality||.8;!r&&sp(l)&&(u=`image/png`,d=void 0);let f=await ap(l,u,d);if(r&&i.status===`fulfilled`&&i.value){let e=i.value,t=a.status===`fulfilled`?a.value:!1;f=await mp(f,e,t)}return r&&o.status===`fulfilled`&&o.value.length>0&&(f=await rp(f,o.value)),f}catch(e){let t;throw e instanceof Error&&(t=e.message),typeof e==`string`&&(t=e),Error(`Failed to shrink image. ${t?`Message: "${t}".`:``}`,{cause:e})}}})),zp,Bp,Vp,Hp=n((()=>{zp=16384,Bp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Vp=e=>{if(typeof e!=`string`)return!1;let t=Bp.exec(e.toLocaleLowerCase())??[];if(t.length===0)return!1;let n=Number(t[1])*Number(t[2]),r=zp*zp;return n>r?(console.warn(`Shrinked size can not be larger than ${Math.floor(r/1e3/1e3)}MP. You have set ${t[1]}x${t[2]} (${Math.ceil(n/1e3/100)/10}MP).`),!1):{quality:t[3]?Number(t[3])/100:void 0,size:n}}})),Up=r({imageShrinkPlugin:()=>Wp},1),Wp,Gp=n((()=>{Rp(),Hp(),Wp={id:`image-shrink`,setup({pluginApi:e}){e.registry.registerFileHook({type:`beforeUpload`,handler:async({file:t,mimeType:n})=>{let r=e.config.get(`imageShrink`);if(!r)return{file:t,mimeType:n};let i=Vp(r);if(!i)return console.warn(`[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking`),{file:t,mimeType:n};try{let e=await Lp(t,i);return{file:e,mimeType:e.type||n}}catch{return{file:t,mimeType:n}}}})}}})),Kp=r({cameraPlugin:()=>Jp},1),qp,Jp,Yp=n((()=>{fn(),ga(),ds(),En(),qp=async()=>{let{CameraSource:e}=await Promise.resolve().then(()=>(qu(),Vu));un({CameraSource:e})},Jp={id:`camera`,setup:async({pluginApi:e,uploaderApi:t})=>{await qp(),e.registry.registerSource({id:`camera`,label:`src-type-camera`,icon:`camera`,expand:()=>{if(!us.htmlMediaCapture)return[`camera`];let t=wn(e.config.get(`cameraModes`));return t.length?t.map(e=>`mobile-${e}-camera`):[`mobile-photo-camera`]},onSelect:()=>{t.setCurrentActivity(j.CAMERA),t.setModalState(!0)}}),e.registry.registerSource({id:`mobile-photo-camera`,label:`src-type-camera`,icon:`camera`,onSelect:()=>{t.openSystemDialog({captureCamera:!0,modeCamera:`photo`})}}),e.registry.registerSource({id:`mobile-video-camera`,label:`src-type-camera`,icon:`camera`,onSelect:()=>{t.openSystemDialog({captureCamera:!0,modeCamera:`video`})}}),e.registry.registerActivity({id:j.CAMERA,render:e=>{let t=document.createElement(`uc-camera-source`);return e.append(t),()=>{e.replaceChildren()}}})}}})),Xp=r({instagramPlugin:()=>Zp},1),Zp,Qp=n((()=>{Zp={id:`instagram`,setup({pluginApi:e}){e.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:()=>{}})}}})),$p,em=n((()=>{$p=()=>{let e=globalThis.top??globalThis.parent??globalThis.self;try{return e.location.origin}catch(e){return console.warn(`Unable to access top-level window location:`,e),globalThis.location.origin}}})),tm,nm,rm=n((()=>{tm=e=>e.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),nm=(e,t=`i`)=>{let n=e.split(`*`).map(tm);return RegExp(`^${n.join(`.+`)}$`,t)}})),im,am,om,sm=n((()=>{im=[`--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`],am=(e,t)=>window.getComputedStyle(e).getPropertyValue(t).trim(),om=e=>{let t={};for(let n of im){let r=am(e,n);r&&(t[n]=r)}return t}})),cm=n((()=>{})),lm,um,dm,fm=n((()=>{lm=[`selected-files-change`,`toolbar-state-change`],um=e=>{if(!e||typeof e!=`object`||!(`type`in e))return!1;let t=e.type;return!(typeof t!=`string`||!lm.includes(t))},dm=class{constructor(e,t){this._handlerMap=new Map,this._handleMessage=e=>{if(e.source!==this._context)return;let t=e.data;if(!um(t))return;let n=this._handlerMap.get(t.type);if(n)for(let e of n)e(t)},this._context=e,this._getTargetOrigin=t,window.addEventListener(`message`,this._handleMessage)}on(e,t){let n=this._handlerMap.get(e)??new Set;this._handlerMap.has(e)||this._handlerMap.set(e,n),n.add(t)}send(e){let t=this._getTargetOrigin();this._context.postMessage(e,t)}destroy(){window.removeEventListener(`message`,this._handleMessage)}}}));function pm(e){let t=[];for(let[n,r]of Object.entries(e))r==null||typeof r==`string`&&r.length===0||t.push(`${n}=${encodeURIComponent(r)}`);return t.join(`&`)}var mm=n((()=>{})),hm=r({ExternalSource:()=>_m},1),gm,_m,vm=n((()=>{B(),em(),Vn(),oc(),rm(),sm(),cm(),y(),S(),G(),H(),fm(),mm(),T(),gm={[ic.GDRIVE]:`ngdrive`},_m=class extends V{constructor(...e){super(...e),this.couldBeCtxOwner=!0,this._iframeRef=U(),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 e of this._selectedList){let t=this._extractUrlFromSelectedFile(e),{filename:n}=e,{externalSourceType:r}=this.activityParams;this.api.addFileFromUrl(t,{fileName:n,source:r})}this.$[`*currentActivity`]=z.activities.UPLOAD_LIST,this.modalManager?.open(z.activities.UPLOAD_LIST)},this._handleCancel=()=>{this.historyBack()},this._handleSelectAll=()=>{this._messageBridge?.send({type:`select-all`})},this._handleDeselectAll=()=>{this._messageBridge?.send({type:`deselect-all`})}}get _counterText(){if(!this._latestSelectionSummary)return``;let{selectedCount:e,total:t}=this._latestSelectionSummary;return this.l10n(`selected-count`,{count:e,total:t})}get activityParams(){let e=super.activityParams;if(`externalSourceType`in e)return e;throw Error(`External Source activity params not found`)}initCallback(){super.initCallback();let{externalSourceType:e}=this.activityParams;e?this._mountIframe():console.error(`Param "externalSourceType" is required for external source activity`),this.sub(`*currentActivityParams`,()=>{setTimeout(()=>{this.isConnected&&(this._unmountIframe(),this._mountIframe())})}),this.subConfigValue(`multiple`,e=>{this._showSelectionStatus=e}),this.subConfigValue(`localeName`,()=>{this._setupL10n()}),this.subConfigValue(`externalSourcesEmbedCss`,e=>{this._applyEmbedCss(e)})}_extractUrlFromSelectedFile(e){if(e.alternatives){let t=Bn(this.cfg.externalSourcesPreferredTypes);for(let n of t){let t=nm(n);for(let[n,r]of Object.entries(e.alternatives))if(t.test(n))return r}}return e.url}_handleToolbarStateChange(e){this._toolbarVisible=e.isVisible}async _handleSelectedFilesChange(e){if(this.cfg.multiple!==e.isMultipleMode){console.error(`Multiple mode mismatch`);return}this._setSelectionSummary(e.selectedCount,e.total),this._doneBtnTextClass=e.isReady?``:`uc-hidden`,this._isSelectionReady=e.isReady,this._isDoneBtnEnabled=e.isReady&&e.selectedFiles.length>0,this._showSelectionStatus=e.isMultipleMode&&e.total>0,this._couldSelectAll=e.selectedCount<e.total,this._couldDeselectAll=e.selectedCount===e.total,this._selectedList=e.selectedFiles??[],this._showDoneBtn=e.total>0}_handleIframeLoad(){this._applyEmbedCss(this.cfg.externalSourcesEmbedCss),this._applyTheme(),this._setupL10n()}_applyTheme(){this._messageBridge?.send({type:`set-theme-definition`,theme:om(this)})}_applyEmbedCss(e){this._messageBridge?.send({type:`set-embed-css`,css:e})}_setupL10n(){this._messageBridge?.send({type:`set-locale-definition`,localeDefinition:this.cfg.localeName})}_remoteUrl(){let{pubkey:e,remoteTabSessionKey:t,socialBaseUrl:n,multiple:r}=this.cfg,{externalSourceType:i}=this.activityParams,a=gm[i]??i,o={lang:this.l10n(`social-source-lang`)?.split(`-`)?.[0]||`en`,public_key:e,images_only:`false`,session_key:t,wait_for_theme:!0,multiple:r.toString(),origin:this.cfg.topLevelOrigin||$p(),debug:this.cfg.debug},s=new URL(`/window4/${a}`,n);return s.search=pm(o),s.toString()}_setSelectionSummary(e,t){this._latestSelectionSummary={selectedCount:e,total:t}}_mountIframe(){let e=document.createElement(`iframe`);e.src=this._remoteUrl(),e.marginHeight=0,e.marginWidth=0,e.frameBorder=`0`,e.allowTransparency=!0,e.addEventListener(`load`,this._handleIframeLoad.bind(this)),e.addEventListener(`load`,this._handleIframeLoad.bind(this)),this._iframeRef.value&&(this._iframeRef.value.innerHTML=``,this._iframeRef.value.appendChild(e)),e.contentWindow&&(this._messageBridge?.destroy(),this._messageBridge=new dm(e.contentWindow,()=>this.cfg.socialBaseUrl),this._messageBridge.on(`selected-files-change`,this._handleSelectedFilesChange.bind(this)),this._messageBridge.on(`toolbar-state-change`,this._handleToolbarStateChange.bind(this)),this._resetSelectionStatus())}_unmountIframe(){this._messageBridge?.destroy(),this._messageBridge=void 0,this._iframeRef.value&&(this._iframeRef.value.innerHTML=``),this._resetSelectionStatus()}_resetSelectionStatus(){this._selectedList=[],this._isSelectionReady=!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 _`
|
|
588
|
-
<uc-activity-header>
|
|
589
|
-
<button
|
|
590
|
-
type="button"
|
|
591
|
-
class="uc-mini-btn uc-close-btn"
|
|
592
|
-
@click=${this.$[`*historyBack`]}
|
|
593
|
-
title=${this.l10n(`a11y-activity-header-button-close`)}
|
|
594
|
-
aria-label=${this.l10n(`a11y-activity-header-button-close`)}
|
|
595
|
-
>
|
|
596
|
-
<uc-icon name="close"></uc-icon>
|
|
597
|
-
</button>
|
|
598
|
-
</uc-activity-header>
|
|
599
|
-
<div class="uc-content">
|
|
600
|
-
<div ${W(this._iframeRef)} class="uc-iframe-wrapper"></div>
|
|
601
|
-
<div class="uc-toolbar" ?hidden=${!this._toolbarVisible}>
|
|
602
|
-
<button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this._handleCancel}>${this.l10n(`cancel`)}</button>
|
|
603
|
-
<div class="uc-selection-status-box" ?hidden=${!this._showSelectionStatus}>
|
|
604
|
-
<span>${this._counterText}</span>
|
|
605
|
-
<button type="button" @click=${this._handleSelectAll} ?hidden=${!this._couldSelectAll}>${this.l10n(`select-all`)}</button>
|
|
606
|
-
<button type="button" @click=${this._handleDeselectAll} ?hidden=${!this._couldDeselectAll}>${this.l10n(`deselect-all`)}</button>
|
|
607
|
-
</div>
|
|
608
|
-
<button
|
|
609
|
-
type="button"
|
|
610
|
-
class="uc-done-btn uc-primary-btn"
|
|
611
|
-
@click=${this._handleDone}
|
|
612
|
-
?disabled=${!this._isDoneBtnEnabled}
|
|
613
|
-
?hidden=${!this._showDoneBtn}
|
|
614
|
-
>
|
|
615
|
-
<uc-spinner ?hidden=${this._isSelectionReady}></uc-spinner>
|
|
616
|
-
<span class=${this._doneBtnTextClass}>${this.l10n(`done`)}</span>
|
|
617
|
-
</button>
|
|
618
|
-
</div>
|
|
619
|
-
</div>
|
|
620
|
-
`}},w([x()],_m.prototype,`_selectedList`,void 0),w([x()],_m.prototype,`_isSelectionReady`,void 0),w([x()],_m.prototype,`_isDoneBtnEnabled`,void 0),w([x()],_m.prototype,`_couldSelectAll`,void 0),w([x()],_m.prototype,`_couldDeselectAll`,void 0),w([x()],_m.prototype,`_showSelectionStatus`,void 0),w([x()],_m.prototype,`_showDoneBtn`,void 0),w([x()],_m.prototype,`_doneBtnTextClass`,void 0),w([x()],_m.prototype,`_toolbarVisible`,void 0)})),ym=r({externalSourcesPlugin:()=>xm},1),bm,xm,Sm=n((()=>{fn(),ga(),oc(),bm=async()=>{let{ExternalSource:e}=await Promise.resolve().then(()=>(vm(),hm));un({ExternalSource:e})},xm={id:`external-sources`,setup:async({pluginApi:e,uploaderApi:t})=>{await bm(),e.registry.registerActivity({id:j.EXTERNAL,render:e=>{let t=document.createElement(`uc-external-source`);return e.append(t),()=>{e.replaceChildren()}}});for(let n of Object.values(ic))e.registry.registerSource({id:n,label:`src-type-${n}`,icon:n,onSelect:()=>{t.setCurrentActivity(j.EXTERNAL,{externalSourceType:n}),t.setModalState(!0)}})}}})),Cm=r({urlSourcePlugin:()=>Tm},1),wm,Tm,Em=n((()=>{fn(),ga(),wm=async()=>{let{UrlSource:e}=await Promise.resolve().then(()=>(Mu(),Au));un({UrlSource:e})},Tm={id:`url-source`,setup:async({pluginApi:e,uploaderApi:t})=>{await wm(),e.registry.registerActivity({id:j.URL,render:e=>{let t=document.createElement(`uc-url-source`);return e.append(t),()=>{e.replaceChildren()}}}),e.registry.registerSource({id:`url`,label:`src-type-from-url`,icon:`url`,onSelect:()=>{t.setCurrentActivity(j.URL),t.setModalState(!0)}})}}})),Dm,Om,km,Am,jm=n((()=>{sd(),En(),ld(),oc(),pr(),Dm=e=>e,Om=async({plugins:e,entries:t,signal:n})=>{let r=e(),i=new Set(t.map(e=>e.pluginId)),a=r.filter(e=>!i.has(e?.id)),o=await Promise.all(t.map(async e=>{if(!e.isEnabled())return null;let t=r.find(t=>t?.id===e.pluginId);if(t)return t;try{let t=await e.load();return n.aborted||!e.isEnabled()?null:t??null}catch(t){return n.aborted||console.warn(`[${e.pluginId}] Failed to load plugin`,t),null}}));if(n.aborted)return r;let s=o.filter(e=>e!==null),c=[...a,...s];return c.length===r.length&&c.every((e,t)=>e===r[t])?r:c},km=[Dm({key:`cameraModes`,deps:[`enableVideoRecording`],fn:({cameraModes:e,enableVideoRecording:t})=>{let n=t();if(n===null)return e();let r=wn(e());return n&&!r.includes(`video`)?r=r.concat(`video`):n||(r=r.filter(e=>e!==`video`)),Tn(r)}}),Dm({key:`cameraModes`,deps:[`defaultCameraMode`],fn:({cameraModes:e,defaultCameraMode:t})=>{let n=t();if(n===null)return e();let r=wn(e());return r=r.sort((e,t)=>e===n?-1:t===n?1:0),Tn(r)}}),Dm({key:`cdnCname`,deps:[`pubkey`,`cdnCnamePrefixed`],fn:({pubkey:e,cdnCname:t,cdnCnamePrefixed:n})=>{let r=e(),i=t(),a=n();return r&&(i===`https://ucarecdn.com`||td(i,a))?od(r,a):i}}),Dm({key:`plugins`,deps:[`useCloudImageEditor`,`imageShrink`,`sourceList`],fn:({plugins:e,useCloudImageEditor:t,imageShrink:n,sourceList:r},{signal:i})=>Om({plugins:e,entries:[{pluginId:`cloud-image-editor`,isEnabled:()=>!!t(),load:async()=>{let{cloudImageEditorPlugin:e}=await Promise.resolve().then(()=>(Zf(),Gf));return e}},{pluginId:`image-shrink`,isEnabled:()=>!!n(),load:async()=>{let{imageShrinkPlugin:e}=await Promise.resolve().then(()=>(Gp(),Up));return e}},{pluginId:`camera`,isEnabled:()=>wn(r()).includes(`camera`),load:async()=>{let{cameraPlugin:e}=await Promise.resolve().then(()=>(Yp(),Kp));return e}},{pluginId:`instagram`,isEnabled:()=>wn(r()).includes(`instagram`),load:async()=>{let{instagramPlugin:e}=await Promise.resolve().then(()=>(Qp(),Xp));return e}},{pluginId:`external-sources`,isEnabled:()=>Object.values(ic).some(e=>wn(r()).includes(e)),load:async()=>{let{externalSourcesPlugin:e}=await Promise.resolve().then(()=>(Sm(),ym));return e}},{pluginId:`url-source`,isEnabled:()=>wn(r()).includes(`url`),load:async()=>{let{urlSourcePlugin:e}=await Promise.resolve().then(()=>(Em(),Cm));return e}}],signal:i})})],Am=({key:e,setValue:t,getValue:n,computationControllers:r})=>{for(let i of km)if(i.deps.includes(e)){let e={[i.key]:()=>n(i.key)};for(let t of i.deps)e[t]=()=>n(t);let a=new AbortController;r.get(i.fn)?.abort(),r.set(i.fn,a);let o;try{o=i.fn(e,{signal:a.signal})}catch(e){r.get(i.fn)===a&&r.delete(i.fn),console.error(`Failed to compute value for "${i.key}"`,e);return}cd(o)?o.then(e=>{a.signal.aborted||t(i.key,e)}).catch(e=>{a.signal.aborted||console.error(`Failed to compute value for "${i.key}"`,e)}).finally(()=>{r.get(i.fn)===a&&r.delete(i.fn)}):t(i.key,o)}}})),Z,Q,$,Mm,Nm,Pm,Fm,Im,Lm,Rm,zm,Bm,Vm,Hm=n((()=>{En(),Ks(),Z=e=>String(e),Q=e=>{let t=Number(e);if(Number.isNaN(t))throw Error(`Invalid number: "${e}"`);return t},$=e=>{if(e==null)return!1;if(typeof e==`boolean`)return e;if(e===`true`||e===``)return!0;if(e===`false`)return!1;throw Error(`Invalid boolean: "${e}"`)},Mm=e=>e===`auto`?e:$(e),Nm=e=>{let t=Z(e);if(t!==`user`&&t!==`environment`&&t!==``)throw Error(`Invalid value: "${t}"`);return t},Pm=e=>{let t=Z(e);if(!Object.values(L).includes(t))throw Error(`Invalid value: "${t}"`);return t},Fm=e=>{let t=Z(e),n=wn(t);if(n.some(e=>!Object.values(L).includes(e)))throw Error(`Invalid value: "${JSON.stringify(n)}"`);return t},Im=e=>{let t=Z(e);if(t===`local`||t===`global`)return t;if($(e)===!1)return!1;throw Error(`Invalid value: "${t}"`)},Lm=e=>{if(typeof e==`object`&&!Array.isArray(e)||typeof e==`function`)return e;throw Error(`Invalid metadata value. Must be an object or function.`)},Rm=e=>{if(typeof e==`object`)return e;throw Error(`Invalid value. Must be an object.`)},zm=e=>{if(typeof e==`function`)return e;throw Error(`Invalid value. Must be a function.`)},Bm=e=>{if(Array.isArray(e))return e;throw Error(`Must be an array.`)},Vm=e=>{let t=Z(e);if([`grid`,`list`].includes(t))return t;throw Error(`Invalid value: "${t}"`)}})),Um,Wm,Gm=n((()=>{pr(),Hm(),Um={pubkey:Z,multiple:$,multipleMin:Q,multipleMax:Q,confirmUpload:$,imgOnly:$,accept:Z,externalSourcesPreferredTypes:Z,externalSourcesEmbedCss:Z,store:Mm,cameraMirror:$,cameraCapture:Nm,sourceList:Z,topLevelOrigin:Z,maxLocalFileSizeBytes:Q,thumbSize:Q,showEmptyList:$,useLocalImageEditor:$,useCloudImageEditor:$,cloudImageEditorTabs:Z,removeCopyright:$,cropPreset:Z,imageShrink:Z,modalScrollLock:$,modalBackdropStrokes:$,sourceListWrap:$,remoteTabSessionKey:Z,cdnCname:Z,cdnCnamePrefixed:Z,baseUrl:Z,socialBaseUrl:Z,secureSignature:Z,secureExpire:Z,secureDeliveryProxy:Z,retryThrottledRequestMaxTimes:Q,retryNetworkErrorMaxTimes:Q,multipartMinFileSize:Q,multipartChunkSize:Q,maxConcurrentRequests:Q,multipartMaxConcurrentRequests:Q,multipartMaxAttempts:Q,checkForUrlDuplicates:$,saveUrlForRecurrentUploads:$,groupOutput:$,userAgentIntegration:Z,debug:$,localeName:Z,metadata:Lm,secureUploadsExpireThreshold:Q,localeDefinitionOverride:e=>Rm(e),secureUploadsSignatureResolver:e=>zm(e),secureDeliveryProxyUrlResolver:e=>zm(e),iconHrefResolver:e=>zm(e),plugins:e=>Bm(e),fileValidators:Bm,collectionValidators:Bm,validationTimeout:Q,validationConcurrency:Q,cameraModes:Fm,defaultCameraMode:Pm,enableAudioRecording:$,enableVideoRecording:$,mediaRecorderOptions:Rm,maxVideoRecordingDuration:Q,filesViewMode:Vm,gridShowFileNames:$,cloudImageEditorAutoOpen:$,cloudImageEditorMaskHref:Z,testMode:$,qualityInsights:$,pasteScope:Im},Wm=(e,t)=>{if(t!=null)try{return Um[e](t)}catch(t){return console.error(`Invalid value for config key "${e}".`,t),fr[e]}}})),Km,qm,Jm,Ym,Xm,Zm,Qm,$m=n((()=>{Cn(),Xu(),Zu(),I(),jm(),pr(),Gm(),Km=[...new Set([`debug`,...Object.keys(fr)])],qm=[`metadata`,`plugins`,`localeDefinitionOverride`,`secureUploadsSignatureResolver`,`secureDeliveryProxyUrlResolver`,`iconHrefResolver`,`fileValidators`,`collectionValidators`,`mediaRecorderOptions`],Jm=e=>qm.includes(e),Ym=Km.filter(e=>!Jm(e)),Xm={...Object.fromEntries(Ym.map(e=>[Cr(e),e])),...Object.fromEntries(Ym.map(e=>[e.toLowerCase(),e]))},Zm=e=>`__${e}`,Qm=class extends F{constructor(...e){super(...e),this.init$={...this.init$,...Object.fromEntries(Object.entries(fr).map(([e,t])=>[E(e),t]))},this._computationControllers=new Map,this._customAttrKeyMapping={},this._customConfigKeys=new Set,this._customConfigSubscriptions=new Map}_isCustomConfig(e){return this._customConfigKeys.has(e)}_getCustomConfigDefinition(e){let t=this._sharedInstancesBag.pluginManager;if(t)return t.configRegistry.get(e)}_getAttributeNames(e){return[...new Set([Cr(e),e.toLowerCase()])]}_flushValueToAttribute(e,t){if(Jm(e)||this._isCustomConfig(e)&&this._getCustomConfigDefinition(e)?.attribute===!1)return;let n=this._getAttributeNames(e);for(let e of n)t==null?this.removeAttribute(e):this.getAttribute(e)!==t.toString()&&this.setAttribute(e,t.toString())}_flushValueToState(e,t){let n=E(e);if(this.$[n]!==t)if(t==null){let r=fr[e];this.$[n]=r===void 0?t:r}else this.$[n]=t}_setValue(e,t){let n;n=this._isCustomConfig(e)?this._getCustomConfigDefinition(e)?.normalize?.(t)??t:Wm(e,t);let r=this,i=Zm(e);r[i]!==n&&(this._assertSameValueDifferentReference(e,r[i],n),r[i]=n,this._flushValueToAttribute(e,n),this._flushValueToState(e,n),this.debugPrint(`"${e}"`,n),this._isCustomConfig(e)||Yu(this.cfg))}_getValue(e){return this[Zm(e)]??this.$[E(e)]}_assertSameValueDifferentReference(e,t,n){this.cfg.debug&&n!==t&&typeof n==`object`&&typeof t==`object`&&JSON.stringify(n)===JSON.stringify(t)&&(console.warn(`[uc-config] Option "${e}" value is the same as the previous one but the reference is different`),console.warn(`[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations`),console.warn(`[uc-config] "${e}" previous value:`,t),console.warn(`[uc-config] "${e}" new value:`,n))}_processCustomConfigs(e){let t=e.configRegistry.getAll();this._customAttrKeyMapping={},this._customConfigKeys=new Set(t.keys());for(let[e,n]of this._customConfigSubscriptions)t.has(e)||(n(),this._customConfigSubscriptions.delete(e));for(let[e,n]of t){let t=E(e);if(n.attribute){let t=this._getAttributeNames(e);for(let n of t)this._customAttrKeyMapping[n]=e}this.sharedCtx.has(t)||this.sharedCtx.add(t,n.defaultValue);let r=Object.getOwnPropertyDescriptor(this,e);if((!r||!r.set||!r.get)&&Object.defineProperty(this,e,{set:t=>{this._setValue(e,t)},get:()=>this._getValue(e),enumerable:!0,configurable:!0}),!this._customConfigSubscriptions.has(e)){let n=this.sub(t,t=>{this._setValue(e,t)},!1);this._customConfigSubscriptions.set(e,n)}}}_setupCustomConfigs(){this._sharedInstancesBag.when(`pluginManager`,e=>{this._processCustomConfigs(e),this._pluginChangeUnsubscribe=e.onPluginsChange(()=>{this._processCustomConfigs(e)})})}_setupMutationObserver(){this._mutationObserver=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName){let e=t.attributeName,n=t.oldValue,r=this.getAttribute(e);if(n===r||e in Xm)continue;e in this._customAttrKeyMapping&&this.attributeChangedCallback(e,n??``,r??``)}}),this._mutationObserver.observe(this,{attributes:!0,attributeOldValue:!0})}initCallback(){super.initCallback();let e=this;this._setupCustomConfigs(),this._setupMutationObserver();for(let e of Ym)this.sub(E(e),t=>{this._setValue(e,t)},!1);for(let t of Km){let n=e[t]??this.$[E(t)];n!==fr[t]&&this._setValue(t,n);let r=Object.getOwnPropertyDescriptor(this,t);(!r||!r.set||!r.get)&&Object.defineProperty(this,t,{set:e=>{this._setValue(t,e)},get:()=>this._getValue(t)})}for(let e of Km)this.sub(E(e),()=>{Am({key:e,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this),computationControllers:this._computationControllers})})}attributeChangedCallback(e,t,n){if(super.attributeChangedCallback(e,t,n),t===n)return;let r=this,i=Xm[e];i?r[i]=n:this._sharedInstancesBag.when(`pluginManager`,t=>{if(this.getAttribute(e)!==n)return;let r=this._customAttrKeyMapping[e],i=r?t.configRegistry.get(r):void 0;if(r&&i){let e=i.fromAttribute?i.fromAttribute(n):n;if(this._getValue(r)===e)return;this._setValue(r,e)}})}disconnectedCallback(){super.disconnectedCallback(),this._pluginChangeUnsubscribe&&=(this._pluginChangeUnsubscribe(),void 0),this._mutationObserver&&=(this._mutationObserver.disconnect(),void 0);for(let e of this._customConfigSubscriptions.values())e();this._customConfigSubscriptions.clear()}static get observedAttributes(){let e=super.observedAttributes,t=Object.keys(Xm);return[...e,...t]}};for(let e of Km)Qm.prototype[e]=void 0}));vm(),qu(),Mu(),y(),S(),H(),T();var eh=class extends V{constructor(...e){super(...e),this.couldBeCtxOwner=!0,this.dropzone=!0,this._buttonTextKey=`upload-file`,this._handleClick=()=>{this.api.initFlow()}}static{this.styleAttrs=[...super.styleAttrs,`uc-simple-btn`]}initCallback(){super.initCallback(),this.subConfigValue(`multiple`,e=>{this._buttonTextKey=e?`upload-files`:`upload-file`})}render(){return _`
|
|
621
|
-
<uc-drop-area .disabled=${!this.dropzone}>
|
|
622
|
-
<button type="button" @click=${this._handleClick}>
|
|
623
|
-
<uc-icon name="upload"></uc-icon>
|
|
624
|
-
<span>${this.l10n(this._buttonTextKey)}</span>
|
|
625
|
-
${this.yield(``)}
|
|
626
|
-
<div class="uc-visual-drop-area">${this.l10n(`drop-files-here`)}</div>
|
|
627
|
-
</button>
|
|
628
|
-
</uc-drop-area>
|
|
629
|
-
`}};w([b({attribute:`dropzone`,type:Boolean})],eh.prototype,`dropzone`,void 0),w([x()],eh.prototype,`_buttonTextKey`,void 0),y(),S(),G(),B(),I(),T();var th=class extends z{constructor(...e){super(...e),this.activityType=null,this._containerRef=U()}initCallback(){this.activityType=this.registration?.id??null,super.initCallback(),this._ensureRegistered()}willUpdate(e){super.willUpdate(e),e.has(`registration`)&&(this._ensureRegistered(),this.isActivityActive&&(this._disposeActivity(),this._renderActivity()))}_ensureRegistered(){this.registration&&(this._isActivityRegistered()||this.registerActivity(this.activityType??``,{onActivate:()=>this._renderActivity(),onDeactivate:()=>this._disposeActivity()}))}_renderActivity(){let e=this._containerRef.value;if(!e||!this.registration)return;this._disposeActivity();let t=this.$[`*currentActivityParams`];this._dispose=this.registration.render(e,t)??void 0}_disposeActivity(){this._dispose?.(),this._dispose=void 0;let e=this._containerRef.value;e&&e.replaceChildren()}disconnectedCallback(){this._disposeActivity(),super.disconnectedCallback()}render(){return _`<div
|
|
630
|
-
style="display: flex; flex-direction: column; width: 100%; min-height: 0;"
|
|
631
|
-
${W(this._containerRef)}
|
|
632
|
-
></div>`}};w([b({attribute:!1})],th.prototype,`registration`,void 0);var nh=class extends F{constructor(...e){super(...e),this.mode=`modal`,this._activities=[]}initCallback(){super.initCallback();let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._syncActivities())),this._syncActivities()}_syncActivities(){let e=this._sharedInstancesBag.pluginManager;if(!e){this._activities=[];return}this._activities=e.snapshot().activities}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback()}render(){return this.mode===`inline`?_`${_u(this._activities,e=>e.id,e=>_`<uc-plugin-activity-host .registration=${e}></uc-plugin-activity-host>`)}`:_`${_u(this._activities,e=>e.id,e=>_`
|
|
633
|
-
<uc-modal id=${e.id} strokes block-body-scrolling>
|
|
634
|
-
<uc-plugin-activity-host .registration=${e}></uc-plugin-activity-host>
|
|
635
|
-
</uc-modal>
|
|
636
|
-
`)}`}};w([b({type:String})],nh.prototype,`mode`,void 0),w([x()],nh.prototype,`_activities`,void 0),y(),S(),P(),T();var rh=class extends Jo{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:M.INIT_SOLUTION})}render(){return _`
|
|
637
|
-
${super.render()}
|
|
638
|
-
<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn>
|
|
639
|
-
|
|
640
|
-
<uc-modal id="start-from" strokes block-body-scrolling>
|
|
641
|
-
<uc-start-from>
|
|
642
|
-
<uc-drop-area with-icon clickable></uc-drop-area>
|
|
643
|
-
<uc-source-list role="list" wrap></uc-source-list>
|
|
644
|
-
<button type="button" class="uc-secondary-btn" @click=${this.$[`*historyBack`]}>${this.l10n(`start-from-cancel`)}</button>
|
|
645
|
-
<uc-copyright></uc-copyright>
|
|
646
|
-
</uc-start-from>
|
|
647
|
-
</uc-modal>
|
|
648
|
-
|
|
649
|
-
<uc-modal id="upload-list" strokes block-body-scrolling>
|
|
650
|
-
<uc-upload-list></uc-upload-list>
|
|
651
|
-
</uc-modal>
|
|
652
|
-
|
|
653
|
-
<uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>
|
|
654
|
-
`}};w([b({type:Boolean})],rh.prototype,`headless`,void 0),y(),S(),P(),B(),T();var ih=class extends Jo{static{this.styleAttrs=[...super.styleAttrs,`uc-file-uploader-inline`]}constructor(){super(),this._couldCancel=!1,this._handleCancel=()=>{if(this._couldHistoryBack){let e=this.$[`*historyBack`];e?.();return}this._couldShowList&&(this.$[`*currentActivity`]=z.activities.UPLOAD_LIST)},this.init$={...this.init$}}get _couldHistoryBack(){let e=this.$[`*history`];return!e||e.length<=1?!1:e[e.length-1]!==z.activities.START_FROM}get _couldShowList(){let e=this.$[`*uploadList`];return this.cfg.showEmptyList||Array.isArray(e)&&e.length>0}_getInitActivity(){return this.getCssData(`--cfg-init-activity`)||z.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:M.INIT_SOLUTION});let e=this._getInitActivity();this.sub(`*currentActivity`,t=>{t||(this.$[`*currentActivity`]=e)}),this.sub(`*uploadList`,t=>{Array.isArray(t)&&t.length>0&&this.$[`*currentActivity`]===e&&(this.$[`*currentActivity`]=z.activities.UPLOAD_LIST)}),this.sub(`*history`,()=>{this._couldCancel=this._couldHistoryBack||this._couldShowList})}render(){return _`
|
|
655
|
-
${super.render()}
|
|
656
|
-
<uc-start-from>
|
|
657
|
-
<uc-drop-area with-icon clickable></uc-drop-area>
|
|
658
|
-
<uc-source-list role="list" wrap></uc-source-list>
|
|
659
|
-
<button
|
|
660
|
-
type="button"
|
|
661
|
-
class="uc-cancel-btn uc-secondary-btn"
|
|
662
|
-
@click=${this._handleCancel}
|
|
663
|
-
?hidden=${!this._couldCancel}
|
|
664
|
-
>
|
|
665
|
-
${this.l10n(`start-from-cancel`)}
|
|
666
|
-
</button>
|
|
667
|
-
<uc-copyright></uc-copyright>
|
|
668
|
-
</uc-start-from>
|
|
669
|
-
<uc-upload-list></uc-upload-list>
|
|
670
|
-
<uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>
|
|
671
|
-
`}};w([x()],ih.prototype,`_couldCancel`,void 0),y(),S(),Sr(),P(),B(),T();var ah=`active`,oh=``,sh=class extends Jo{static{this.styleAttrs=[...super.styleAttrs,`uc-file-uploader-minimal`]}_getInitActivity(){return this.getCssData(`--cfg-init-activity`)||z.activities.START_FROM}constructor(){super(),this._singleUpload=!1,this._isHiddenStartFrom=!1,this._classUploadList=oh,this._classStartFrom=oh,this._handleModalOpen=e=>{e.id===z.activities.CLOUD_IMG_EDIT&&(this._classUploadList=ah),this.$[`*currentActivity`]===z.activities.UPLOAD_LIST&&(this._classUploadList=ah,this._isHiddenStartFrom=!0);let t=this.$[`*uploadList`];(!t||t.length<=0)&&(this._classStartFrom=ah)},this._handleModalClose=e=>{e.id===this.$[`*currentActivity`]&&(this.$[`*currentActivity`]=z.activities.UPLOAD_LIST,this._isHiddenStartFrom=!1),e.id===z.activities.CLOUD_IMG_EDIT&&(this.$[`*currentActivity`]=z.activities.UPLOAD_LIST)},this.init$={...this.init$}}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:M.INIT_SOLUTION});let e=this._getInitActivity();this.sub(`*currentActivity`,t=>{t===z.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),t||(this.$[`*currentActivity`]=e)}),this.sub(`*uploadList`,t=>{Array.isArray(t)&&t.length>0?(this.$[`*currentActivity`]=z.activities.UPLOAD_LIST,this._classStartFrom=oh):(this._classUploadList=oh,this._isHiddenStartFrom=!1,this.$[`*currentActivity`]=e)}),this.subConfigValue(`confirmUpload`,e=>{e!==!1&&(this.cfg.confirmUpload=!1)}),this.subConfigValue(`filesViewMode`,e=>{this.setAttribute(`mode`,e),this.subConfigValue(`multiple`,t=>{e===`grid`?(t?this.style.removeProperty(`--uc-grid-col`):this.style.setProperty(`--uc-grid-col`,`1`),this._singleUpload=!t):(this.style.removeProperty(`--uc-grid-col`),this._singleUpload=!1)})}),this.modalManager?.subscribe(O.OPEN,this._handleModalOpen),this.modalManager?.subscribe(O.CLOSE,this._handleModalClose)}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(O.OPEN,this._handleModalOpen),this.modalManager?.unsubscribe(O.CLOSE,this._handleModalClose)}render(){return _`
|
|
672
|
-
${super.render()}
|
|
673
|
-
<uc-start-from ?hidden=${this._isHiddenStartFrom} class=${this._classStartFrom}>
|
|
674
|
-
<uc-drop-area
|
|
675
|
-
?single=${this._singleUpload}
|
|
676
|
-
initflow
|
|
677
|
-
clickable
|
|
678
|
-
tabindex="0"
|
|
679
|
-
><span>${this.l10n(`choose-file`)}</span></uc-drop-area>
|
|
680
|
-
<uc-copyright></uc-copyright>
|
|
681
|
-
</uc-start-from>
|
|
682
|
-
<uc-upload-list class=${this._classUploadList}></uc-upload-list>
|
|
683
|
-
|
|
684
|
-
<uc-modal id="start-from" strokes block-body-scrolling>
|
|
685
|
-
<uc-start-from>
|
|
686
|
-
<uc-drop-area with-icon clickable></uc-drop-area>
|
|
687
|
-
<uc-source-list role="list" wrap></uc-source-list>
|
|
688
|
-
<button
|
|
689
|
-
type="button"
|
|
690
|
-
class="uc-secondary-btn"
|
|
691
|
-
@click=${this.$[`*historyBack`]}
|
|
692
|
-
>${this.l10n(`start-from-cancel`)}</button>
|
|
693
|
-
</uc-start-from>
|
|
694
|
-
</uc-modal>
|
|
695
|
-
|
|
696
|
-
<uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>
|
|
697
|
-
`}};return w([x()],sh.prototype,`_singleUpload`,void 0),w([x()],sh.prototype,`_isHiddenStartFrom`,void 0),w([x()],sh.prototype,`_classUploadList`,void 0),w([x()],sh.prototype,`_classStartFrom`,void 0),ne(),ln(),fn(),Sn(),Sr(),wr(),I(),H(),B(),il(),Kl(),Zl(),du(),$m(),oc(),po(),e.ActivityBlock=z,e.ActivityHeader=uu,e.BaseComponent=sn,e.Block=F,e.CameraSource=Y,e.Config=Qm,e.Copyright=Vl,e.Data=g,e.DropArea=Du,e.ExternalSource=_m,e.ExternalUploadSource=ic,e.FileItem=q,e.FileUploaderInline=ih,e.FileUploaderMinimal=sh,e.FileUploaderRegular=rh,e.FormInput=Bl,e.Icon=rl,e.Img=hl,e.Modal=zl,e.ModalEvents=O,e.PACKAGE_NAME=uo,e.PACKAGE_VERSION=fo,e.PluginActivityHost=th,e.PluginActivityRenderer=nh,e.ProgressBar=Hl,e.ProgressBarCommon=Ul,e.Select=Gl,e.SimpleBtn=eh,e.SolutionBlock=Jo,e.SourceBtn=ql,e.SourceList=Jl,e.Spinner=Xl,e.StartFrom=fu,e.Thumb=cu,e.UID=cn,e.UploadCtxProvider=pu,e.UploadList=Ou,e.UploadSource=R,e.UploaderBlock=V,e.UrlSource=ju,e.defineComponents=un,e.defineLocale=bn,e.loadFileUploaderFrom=pn,e.toKebabCase=Cr,e})({});
|
|
1
|
+
var UC=(function(exports){'use strict';/**
|
|
2
|
+
* @license
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.28.0-alpha.666 (MIT)
|
|
4
|
+
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
+
* Built: 2026-03-12T12:26:02.162Z
|
|
6
|
+
*/
|
|
7
|
+
var ho=Object.defineProperty;var Pl=Object.getOwnPropertyDescriptor;var a=(o,i)=>ho(o,"name",{value:i,configurable:true});var Vs=(o,i)=>{for(var t in i)ho(o,t,{get:i[t],enumerable:true});};var h=(o,i,t,e)=>{for(var r=e>1?void 0:e?Pl(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&&ho(i,t,r),r};var kt=[],Xt=0,zi=4,Ns=a(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=Xt+zi;s<kt.length;)kt[s]===e?kt.splice(s,zi):s+=zi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!kt.length;for(let n of i)kt.push(n,t.value,e,r);if(s){for(Xt=0;Xt<kt.length;Xt+=zi)kt[Xt](kt[Xt+1],kt[Xt+2],kt[Xt+3]);kt.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},"atom");function Bi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}a(Bi,"listenKeys");function fo(o,i,t){let e=Bi(o,i,t);return t(o.value),e}a(fo,"subscribeKeys");var mo=a((o={})=>{let i=Ns(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},"map");var K=class o{static{a(this,"PubSub");}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?fo:Bi)(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=mo(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 Hi=globalThis,ji=Hi.ShadowRoot&&(Hi.ShadyCSS===void 0||Hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,zs=Symbol(),_s=new WeakMap,Ki=class{static{a(this,"n");}constructor(i,t,e){if(this.Ec=true,e!==zs)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(ji&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=_s.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&_s.set(t,i));}return i}toString(){return this.cssText}},Bs=a(o=>new Ki(typeof o=="string"?o:o+"",void 0,zs),"r");var Hs=a((o,i)=>{if(ji)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Hi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},"S"),go=ji?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Bs(t)})(o):o;var{is:Rl,defineProperty:$l,getOwnPropertyDescriptor:Dl,getOwnPropertyNames:Fl,getOwnPropertySymbols:Vl,getPrototypeOf:Nl}=Object,Gi=globalThis,Ks=Gi.trustedTypes,_l=Ks?Ks.emptyScript:"",zl=Gi.reactiveElementPolyfillSupport,si=a((o,i)=>o,"d"),ni={toAttribute(o,i){switch(i){case Boolean:o=o?_l: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}},qi=a((o,i)=>!Rl(o,i),"f"),js={attribute:true,type:String,converter:ni,reflect:false,useDefault:false,hasChanged:qi};Symbol.metadata??=Symbol("metadata"),Gi.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static{a(this,"y");}static addInitializer(i){this.Vr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ii&&[...this.Ii.keys()]}static createProperty(i,t=js){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&&$l(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Dl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let l=r?.call(this);s?.call(this,n),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??js}static Vr(){if(this.hasOwnProperty(si("elementProperties")))return;let i=Nl(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(si("finalized")))return;if(this.finalized=true,this.Vr(),this.hasOwnProperty(si("properties"))){let t=this.properties,e=[...Fl(t),...Vl(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.Ii=new Map;for(let[t,e]of this.elementProperties){let r=this._r(t,e);r!==void 0&&this.Ii.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(go(r));}else i!==void 0&&t.push(go(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.Oi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.yt=null,this.Cc();}Cc(){this.Br=new Promise(i=>this.enableUpdating=i),this.Fe=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.Oi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Hs(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:ni).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.Ii.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:ni;this.yt=r;let l=n.fromAttribute(t,s.type);this[r]=l??this.Hr?.get(r)??l,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??qi)(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.Fe.has(i)||(this.hasUpdated||e||(t=void 0),this.Fe.set(i,t)),r===true&&this.yt!==i&&(this.zs??=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.Oi){for(let[r,s]of this.Oi)this[r]=s;this.Oi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,l=this[r];n!==true||this.Fe.has(r)||l===void 0||this.C(r,void 0,s,l);}}let i=false,t=this.Fe;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.Fe=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Br}shouldUpdate(i){return true}update(i){this.zs&&=this.zs.forEach(t=>this.Ac(t,this[t])),this.Kr();}updated(i){}firstUpdated(i){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[si("elementProperties")]=new Map,zt[si("finalized")]=new Map,zl?.({ReactiveElement:zt}),(Gi.reactiveElementVersions??=[]).push("2.1.2");var yo=globalThis,Gs=a(o=>o,"i"),Wi=yo.trustedTypes,qs=Wi?Wi.createPolicy("lit-html",{createHTML:a(o=>o,"createHTML")}):void 0,bo="$lit$",Bt=`lit$${Math.random().toFixed(9).slice(2)}$`,wo="?"+Bt,Bl=`<${wo}>`,fe=document,li=a(()=>fe.createComment(""),"c"),ci=a(o=>o===null||typeof o!="object"&&typeof o!="function","a"),To=Array.isArray,Js=a(o=>To(o)||typeof o?.[Symbol.iterator]=="function","d"),vo=`[ \f\r]`,ai=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ws=/-->/g,Zs=/>/g,pe=RegExp(`>|${vo}(?:([^\\s"'>=/]+)(${vo}*=${vo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ys=/'/g,Xs=/"/g,tn=/^(?:script|style|textarea|title)$/i,Eo=a(o=>(i,...t)=>({Ne:o,strings:i,values:t}),"x"),y=Eo(1);Eo(2);Eo(3);var rt=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),Qs=new WeakMap,he=fe.createTreeWalker(fe,129);function en(o,i){if(!To(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return qs!==void 0?qs.createHTML(i):i}a(en,"V");var rn=a((o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=ai;for(let l=0;l<t;l++){let c=o[l],u,p,d=-1,f=0;for(;f<c.length&&(n.lastIndex=f,p=n.exec(c),p!==null);)f=n.lastIndex,n===ai?p[1]==="!--"?n=Ws:p[1]!==void 0?n=Zs:p[2]!==void 0?(tn.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=pe):p[3]!==void 0&&(n=pe):n===pe?p[0]===">"?(n=r??ai,d=-1):p[1]===void 0?d=-2:(d=n.lastIndex-p[2].length,u=p[1],n=p[3]===void 0?pe:p[3]==='"'?Xs:Ys):n===Xs||n===Ys?n=pe:n===Ws||n===Zs?n=ai:(n=pe,r=void 0);let m=n===pe&&o[l+1].startsWith("/>")?" ":"";s+=n===ai?c+Bl:d>=0?(e.push(u),c.slice(0,d)+bo+c.slice(d)+Bt+m):c+Bt+(d===-2?l:m);}return [en(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),ui=class o{static{a(this,"S");}constructor({strings:i,Ne:t},e){let r;this.parts=[];let s=0,n=0,l=i.length-1,c=this.parts,[u,p]=rn(i,t);if(this.el=o.createElement(u,e),he.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(r=he.nextNode())!==null&&c.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(bo)){let f=p[n++],m=r.getAttribute(d).split(Bt),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:v[2],strings:m,ctor:v[1]==="."?Yi:v[1]==="?"?Xi:v[1]==="@"?Qi:ge}),r.removeAttribute(d);}else d.startsWith(Bt)&&(c.push({type:6,index:s}),r.removeAttribute(d));if(tn.test(r.tagName)){let d=r.textContent.split(Bt),f=d.length-1;if(f>0){r.textContent=Wi?Wi.emptyScript:"";for(let m=0;m<f;m++)r.append(d[m],li()),he.nextNode(),c.push({type:2,index:++s});r.append(d[f],li());}}}else if(r.nodeType===8)if(r.data===wo)c.push({type:2,index:s});else {let d=-1;for(;(d=r.data.indexOf(Bt,d+1))!==-1;)c.push({type:7,index:s}),d+=Bt.length-1;}s++;}}static createElement(i,t){let e=fe.createElement("template");return e.innerHTML=i,e}};function me(o,i,t=o,e){if(i===rt)return i;let r=e!==void 0?t.Ic?.[e]:t.Oc,s=ci(i)?void 0:i.jr;return r?.constructor!==s&&(r?.Hs?.(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=me(o,r.Pc(o,i.values),r,e)),i}a(me,"M");var Zi=class{static{a(this,"R");}constructor(i,t){this.Ks=[],this.le=void 0,this.js=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.js,r=(i?.creationScope??fe).importNode(t,true);he.currentNode=r;let s=he.nextNode(),n=0,l=0,c=e[0];for(;c!==void 0;){if(n===c.index){let u;c.type===2?u=new Me(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new Ji(s,this,i)),this.Ks.push(u),c=e[++l];}n!==c?.index&&(s=he.nextNode(),n++);}return he.currentNode=fe,r}p(i){let t=0;for(let e of this.Ks)e!==void 0&&(e.strings!==void 0?(e.ce(i,e,t),t+=e.strings.length-2):e.ce(i[t])),t++;}},Me=class o{static{a(this,"k");}get W(){return this.f?.W??this.Gs}constructor(i,t,e,r){this.type=2,this.r=R,this.le=void 0,this.ge=i,this.bt=t,this.f=e,this.options=r,this.Gs=r?.isConnected??true;}get parentNode(){let i=this.ge.parentNode,t=this.f;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.ge}get endNode(){return this.bt}ce(i,t=this){i=me(this,i,t),ci(i)?i===R||i==null||i===""?(this.r!==R&&this.wt(),this.r=R):i!==this.r&&i!==rt&&this.qs(i):i.Ne!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Js(i)?this.k(i):this.qs(i);}O(i){return this.ge.parentNode.insertBefore(i,this.bt)}T(i){this.r!==i&&(this.wt(),this.r=this.O(i));}qs(i){this.r!==R&&ci(this.r)?this.ge.nextSibling.data=i:this.T(fe.createTextNode(i)),this.r=i;}$(i){let{values:t,Ne:e}=i,r=typeof e=="number"?this.Lc(i):(e.el===void 0&&(e.el=ui.createElement(en(e.h,e.h[0]),this.options)),e);if(this.r?.js===r)this.r.p(t);else {let s=new Zi(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Lc(i){let t=Qs.get(i.strings);return t===void 0&&Qs.set(i.strings,t=new ui(i)),t}k(i){To(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(li()),this.O(li()),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.ge.nextSibling,t){for(this.Pi?.(false,true,t);i!==this.bt;){let e=Gs(i).nextSibling;Gs(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.Gs=i,this.Pi?.(i));}},ge=class{static{a(this,"H");}get tagName(){return this.element.tagName}get W(){return this.f.W}constructor(i,t,e,r,s){this.type=1,this.r=R,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=R;}ce(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=me(this,i,t,0),n=!ci(i)||i!==this.r&&i!==rt,n&&(this.r=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=me(this,l[e+c],t,c),u===rt&&(u=this.r[c]),n||=!ci(u)||u!==this.r[c],u===R?i=R:i!==R&&(i+=(u??"")+s[c+1]),this.r[c]=u;}n&&!r&&this.j(i);}j(i){i===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Yi=class extends ge{static{a(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===R?void 0:i;}},Xi=class extends ge{static{a(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==R);}},Qi=class extends ge{static{a(this,"z");}constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}ce(i,t=this){if((i=me(this,i,t,0)??R)===rt)return;let e=this.r,r=i===R&&e!==R||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==R&&(e===R||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);}},Ji=class{static{a(this,"Z");}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){me(this,i);}},on={I:Me},Hl=yo.litHtmlPolyfillSupport;Hl?.(ui,Me),(yo.litHtmlVersions??=[]).push("3.3.2");var sn=a((o,i,t)=>{let e=t?.renderBefore??i,r=e.Rc;if(r===void 0){let s=t?.renderBefore??null;e.Rc=r=new Me(i.insertBefore(li(),s),s,void 0,t??{});}return r.ce(o),r},"D");var Co=globalThis,Tt=class extends zt{static{a(this,"i");}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=sn(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.qr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.qr?.setConnected(false);}render(){return rt}};Tt.Gp=true,Tt.finalized=true,Co.litElementHydrateSupport?.({LitElement:Tt});var Kl=Co.litElementPolyfillSupport;Kl?.({LitElement:Tt});(Co.litElementVersions??=[]).push("4.2.2");var jl=/\\([0-9a-fA-F]{1,6} ?)/g;function Gl(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}a(Gl,"hasLeadingTrailingQuotes");function ql(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}a(ql,"trimQuotes");function Wl(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}a(Wl,"escapeQuotes");function nn(o){let i=o;Gl(o)&&(i=ql(i),i=i.replace(jl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Wl(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}a(nn,"parseCssPropertyValue");function Ie(o){class i extends o{constructor(){super(...arguments);this.Ws=null;this.Wr=null;}static{a(this,"CssDataMixinClass");}getCssData(r,s=false){let n=this.Ws??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.Wr||(this.Wr=window.getComputedStyle(this));let l=this.Wr.getPropertyValue(r).trim();try{n[r]=nn(l);}catch(c){s||console.warn(`CSS Data error: ${r}`,c),n[r]=null;}}return this.Ws=n,n[r]}}return i}a(Ie,"CssDataMixin");function tr(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Ve={};this._e=null;this.Li=false;}static{a(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this._e||(this._e=Array.from(this.childNodes)),super.connectedCallback();}Uc(){if(this.Li)return;this.Li=true,this.Ve={};let r=Array.from(this.childNodes),s=r.length?r:this._e??[];for(let n of s){let l=this.Zs(n),c=this.Ve[l]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),c.push(n),this.Ve[l]=c;}this._e=null;}Zs(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.Zs(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.Ve[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.Ve[r]&&!this.Li&&this._e?.length){let l=[];for(let c of this._e)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Ve[r]=l,this.Li=true,this._e=null;}let n=this.Ve[r];return y` ${n} ${this.Dc(r)?s:void 0} `}}return i}a(tr,"LightDomMixin");function Oe(o){class i extends o{static{a(this,"RegisterableElementMixinClass");}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}a(Oe,"RegisterableElementMixin");var Qt=class extends Event{static{a(this,"s");}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 Le=class{static{a(this,"s");}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 Qt(this.context,this.host,this.t,this.subscribe));}};var er=class{static{a(this,"s");}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:a(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var xo=class extends Event{static{a(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Pe=class extends er{static{a(this,"i");}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:l}]of this.subscriptions)s.has(n)||(s.add(n),l.dispatchEvent(new Qt(this.context,l,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 xo(this.context,this.host));}};var Yl={attribute:true,type:String,converter:ni,reflect:false,hasChanged:qi},Xl=a((o=Yl,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(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(n,c,o,true,l);},init(l){return l!==void 0&&this.C(n,void 0,o,l),l}}}if(e==="setter"){let{name:n}=t;return function(l){let c=this[n];i.call(this,l),this.requestUpdate(n,c,o,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(o){return (i,t)=>typeof t=="object"?Xl(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)}a(b,"n");function g(o){return b({...o,state:true,attribute:false})}a(g,"r");function D(o,i){let t,e=a(((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}a(D,"debounce");var an="ctx-name-context";function rr(){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.Ri=void 0;this.Ui=false;this.ctxName=this.Ae;this.ke=false;this.Ri=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Ae,this.Fc=new Le(this,{context:an,callback:a(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Qs=s,this.Xs();},"callback"),subscribe:true});}static{a(this,"SymbioteMixinClass");}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 Ys(){return this.Ri}set Ys(r){let s=r??void 0;this.Ri!==s&&(this.Ri=s,this.Xs());}shouldUpdate(r){return this.ke?super.shouldUpdate(r):false}get Ae(){return this.Ys||this.Qs||void 0}Xs(){if(this.ctxName=this.Ae,!(!this.ctxName||this.Wt)){if(this.isConnected){this.Xr();return}this.Ui=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:an,initialValue:this.ctxName}));}Js(){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();}}en(){return !this.ee&&this.Ae&&this.Qr(),this.ee&&this.Js(),this.ee}$i(){let r=this.en();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=K.getCtx(s)??K.registerCtx(r,s);for(let[n,l]of Object.entries(this.init$))this.ee.add(n,l,this.ctxOwner);this.Js();}}get $(){return this.Ae&&this.Qr(),new Proxy({},{get:a((r,s)=>{if(typeof s=="string")return this.ee?.read(s)},"get"),set:a((r,s,n)=>(typeof s!="string"||this.ee?.pub(s,n),true),"set")})}sub(r,s,n=true){let l=this.$i().sub(r,s,n);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=a(()=>{u||(u=true,c(),this.Zt.delete(p));},"trackedRemove");return this.Zt.add(p),p}pub(r,s){this.$i().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.$i()}has(r){return this.ee?.has(r)??false}add(r,s,n=false){let l=this.en();if(!l){if(!n&&this.Tt.has(r))return;this.Tt.set(r,{value:s,rewrite:n});return}this.Tt.delete(r),l.add(r,s,n);}add$(r,s=false){for(let[n,l]of Object.entries(r))this.add(n,l,s);}connectedCallback(){super.connectedCallback(),this.Wt?this.ke&&this.Zr&&(this.Zr=false,this.initCallback()):this.ctxName?(this.Ui=false,this.Xr()):this.Ui&&this.Ae&&(this.Ui=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.$i();for(let[n,l]of Object.entries(r))s.read(n)===void 0&&s.pub(n,l),this.sub(n,D(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 h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Ys",1),h([g()],i.prototype,"Qs",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"ke",2),i}}a(rr,"SymbioteMixin");var So=class extends Oe(rr()(Ie(tr(Tt)))){static{a(this,"BaseComponent");}};var ht=class o{static{a(this,"UID");}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 Ql=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function ft(o){for(let i in o){if(Ql.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);}}a(ft,"defineComponents");var Ao="UC";function Jl(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Ao]){t(window[Ao]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[Ao];i&&ft(s),t(s);},document.head.appendChild(r);})}a(Jl,"loadFileUploaderFrom");var di={"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 ko=new Map,ln=new Map,cn=a((o,i)=>{ko.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...di,...i};return ko.set(o,t),t},"defineLocaleSync"),tc=a((o,i)=>{ln.set(o,i);},"defineLocaleAsync"),un=a((o,i)=>{typeof i=="function"?tc(o,i):cn(o,i);},"defineLocale"),dn=a(async o=>{let i=ko.get(o);if(!i){let t=ln.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=cn(o,e);}return i},"resolveLocaleDefinition");un("en",di);var L=a(o=>`*cfg/${o}`,"sharedConfigKey");var j=a(o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),Ht=a(o=>o.join(","),"serializeCsv");var pn=a(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},"normalizeCdnOperation"),or=a((...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>pn(i)).join("/-/"),"joinCdnOperations"),ot=a((...o)=>{let i=or(...o);return i?`-/${i}/`:""},"createCdnUrlModifiers");function sr(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}a(sr,"extractFilename");function nr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}a(nr,"extractUuid");function Mo(o){let i=hn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}a(Mo,"extractCdnUrlModifiers");function Io(o){return Mo(o).split("/-/").filter(Boolean).map(t=>pn(t))}a(Io,"extractOperations");function hn(o){let i=new URL(o),t=sr(o),e=fn(t)?mn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}a(hn,"trimFilename");function fn(o){return o.startsWith("http")}a(fn,"isFileUrl");function mn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}a(mn,"splitFileUrl");var Z=a((o,i,t)=>{let e=new URL(hn(o)),r=t??sr(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&fn(r)){let n=mn(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()},"createCdnUrl"),Jt=a((o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var Y=a((o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var pi=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}),vn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function ec(o,i){if(typeof i=="number"){let t=i;return pi[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return pi[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return pi.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}a(ec,"transformationToStr");function te(o){return or(...vn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return ec(i,t)}).filter(i=>!!i))}a(te,"transformationsToOperations");var ar=or("format/auto","progressive/yes"),Kt=a(([o])=>typeof o<"u"?Number(o):void 0,"asNumber"),gn=a(()=>true,"asBoolean"),ic=a(([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),"asFilter"),rc=a(([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:Y(o,"x").map(Number),coords:Y(i).map(Number)}},"asCrop"),oc=Object.freeze({enhance:Kt,brightness:Kt,exposure:Kt,gamma:Kt,contrast:Kt,saturation:Kt,vibrance:Kt,warmth:Kt,filter:ic,mirror:gn,flip:gn,rotate:Kt,crop:a(o=>{let[i,t]=o,{dimensions:e,coords:r}=rc([i,t]);return {dimensions:e,coords:r}},"crop")});function Oo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!vn.includes(e))continue;let s=e,n=oc[s];try{let l=n(r);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}a(Oo,"operationsToTransformations");var H=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),st=Object.freeze([H.CROP,H.TUNING,H.FILTERS]),yn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),bn=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"]),wn=Object.freeze(["rotate","mirror","flip"]),jt=pi,Mt=Object.freeze({brightness:{zero:jt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:jt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:jt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:jt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:jt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:jt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:jt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:jt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:jt.filter,range:[0,100],keypointsNumber:1}});var hi="https://ucarecdn.com",sc="https://upload.uploadcare.com",nc="https://social.uploadcare.com",ac="https://ucarecd.net",lc={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:hi,cdnCnamePrefixed:ac,baseUrl:sc,socialBaseUrl:nc,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:Ht(st),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[]},tt=Object.freeze(lc);var lr=a((o,i)=>(...t)=>{let e=o();if(!e.read(L("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);},"createDebugPrinter");var G=class{constructor(i){this.Jr=new Set;this.Be=null;this.m=lr(()=>this.i.ctx,this.constructor.name);this.i=i,this.e=i.ctx;}static{a(this,"SharedInstance");}addSub(i){this.Jr.add(i);}get ze(){if(!this.Be){let i={};this.Be=new Proxy(i,{set:a(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:a((t,e)=>{if(typeof e!="string")return;let r=L(e);return this.i.ctx.has(r)?this.i.ctx.read(r):tt[e]},"get")});}return this.Be}destroy(){for(let i of this.Jr)try{i();}catch{}this.Jr.clear();}},cc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},It=a((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`)},"getSharedInstance"),Tn=a(o=>({get ctx(){return o()},get modalManager(){return It(o(),"*modalManager",false)},get pluginManager(){return It(o(),"*pluginManager")},get telemetryManager(){return It(o(),"*telemetryManager")},get localeManager(){return It(o(),"*localeManager")},get a11y(){return It(o(),"*a11y")},get blocksRegistry(){return It(o(),"*blocksRegistry")},get eventEmitter(){return It(o(),"*eventEmitter")},get uploadCollection(){return It(o(),"*uploadCollection")},get secureUploadsManager(){return It(o(),"*secureUploadsManager",false)},get api(){return It(o(),"*publicApi")},get validationManager(){return It(o(),"*validationManager")},when(i,t){let e=cc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n=r.sub(e,l=>{l&&(t(l),n());});return n},wait(i){return new Promise(t=>{let e=this.when(i,r=>{t(r),e();});})}}),"createSharedInstancesBag");var X=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),cr=class extends G{constructor(){super(...arguments);this.He=new Map;this.ue=new Set;this.c=new Map;}static{a(this,"ModalManager");}registerModal(t,e){this.He.set(t,e),this.q(X.ADD,{id:t,modal:e});}deleteModal(t){let e=this.He.get(t);return e?(this.He.delete(t),this.ue.delete(t),this.q(X.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.He.get(t);return e?(this.ue.add(t),this.q(X.OPEN,{modal:e,id:t}),true):(this.m(`Modal with ID "${t}" not found`),false)}close(t){let e=this.He.get(t);return !e||!this.ue.has(t)?(this.m(`Modal with ID "${t}" not found or not active`),false):(this.ue.delete(t),this.q(X.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.He.has(t)?this.ue.has(t)?this.close(t):this.open(t):(this.m(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.ue.size>0}back(){if(this.ue.size===0)return this.m("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(X.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.m("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.He.clear(),this.c.clear(),this.q(X.DESTROY,{});}};var ur=a(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("-"),"toKebabCase");function En(o){return Object.prototype.toString.call(o)==="[object Object]"}a(En,"isObject");var uc=/\W|_/g;function dc(o){return o.split(uc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}a(dc,"camelizeString");function Cn(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>qt(t,{ignoreKeys:i})):o}a(Cn,"camelizeArrayItems");function qt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Cn(o,{ignoreKeys:i});if(!En(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}En(r)?r=qt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Cn(r,{ignoreKeys:i})),t[dc(e)]=r;}return t}a(qt,"camelizeKeys");var pc=a(o=>new Promise(i=>setTimeout(i,o)),"delay");function Fo({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("/"),l=[s,r].filter(Boolean).join("; ");return `${n} (${l})`}a(Fo,"getUserAgent$1");var hc={factor:2,time:100};function fc(o,i=hc){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a(l=>pc(l??s).then(()=>(t+=1,e(r))),"retry")})}return a(e,"runAttempt"),e(o)}a(fc,"retrier");var ve=class extends Error{static{a(this,"UploadcareError");}},Ue=class o extends ve{static{a(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},dr=a((o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),ee=class o extends ve{static{a(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},mc=500,Sn=a(({check:o,interval:i=mc,timeout:t,signal:e})=>new Promise((r,s)=>{let n,l;dr(e,()=>{n&&clearTimeout(n),s(new ee("Poll cancelled"));}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),s(new ee("Timed out"));},t));let c=a(()=>{try{Promise.resolve(o(e)).then(u=>{u?(l&&clearTimeout(l),r(u)):n=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");n=setTimeout(c,0);}),"poll"),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"},pr="application/octet-stream",An="original",re=a(({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=o?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[f,m]=d;typeof m<"u"&&!Array.isArray(m)&&c.setRequestHeader(f,m);}),c.responseType="text",dr(r,()=>{p=true,c.abort(),l(new ee);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(T){let C=T.split(": "),E=C.shift(),k=C.join(": ");E&&typeof E<"u"&&(m[E]=k);});let v=c.response,w=c.status;n({request:d,data:v,headers:m,status:w});}},c.onerror=d=>{p||l(new Ue(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function gc(o,...i){return o}a(gc,"identity");var vc=a(({name:o})=>o?[o]:[],"getFileOptions"),yc=gc,bc=a(()=>new FormData,"getFormData"),kn=a(o=>false,"isBuffer"),hr=a(o=>typeof Blob<"u"&&o instanceof Blob,"isBlob"),fr=a(o=>typeof File<"u"&&o instanceof File,"isFile"),mr=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string","isReactNativeAsset"),Re=a(o=>hr(o)||fr(o)||kn()||mr(o),"isFileData"),wc=a(o=>typeof o=="string"||typeof o=="number"||typeof o>"u","isSimpleValue"),Tc=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o),"isObjectValue"),Ec=a(o=>!!o&&typeof o=="object"&&"data"in o&&Re(o.data),"isFileValue");function Mn(o,i,t){if(Array.isArray(t))for(let e of t)Mn(o,`${i}[]`,e);else if(Ec(t)){let{name:e,contentType:r}=t,s=yc(t.data,e,r??pr),n=vc({name:e,contentType:r});o.push([i,s,...n]);}else if(Tc(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else wc(t)&&t&&o.push([i,t.toString()]);}a(Mn,"collectParams");function Cc(o){let i=[];for(let[t,e]of Object.entries(o))Mn(i,t,e);return i}a(Cc,"getFormDataParams");function gr(o){let i=bc(),t=Cc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}a(gr,"buildFormData");var nt=class o extends ve{static{a(this,"UploadError");}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);}},xc=a(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()},"buildSearchParams"),Gt=a((o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=xc(t)),e.toString()},"getUrl"),Sc="6.18.4",Ac="UploadcareUploadClient",kc=Sc;function be(o){return Fo({libraryName:Ac,libraryVersion:kc,...o})}a(be,"getUserAgent");var Mc="RequestThrottledError",xn=15e3,Ic=1e3;function Oc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return xn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:xn}a(Oc,"getTimeoutFromThrottledRequest");function oe(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return fc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Mc&&r<t)return s(Oc(n));if(n instanceof Ue&&r<e)return s((r+1)*Ic);throw n}))}a(oe,"retryIfFailed");var In=a(o=>{let i="";return (hr(o)||fr(o)||mr(o))&&(i=o.type),i||pr},"getContentType"),On=a(o=>{let i="";return fr(o)&&o.name?i=o.name:hr(o)||kn()?i="":mr(o)&&o.name&&(i=o.name),i||An},"getFileName");function Vo(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}a(Vo,"getStoreValue");function Lc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=P.baseURL,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return oe(()=>re({method:"POST",url:Gt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:d,userAgent:f})},data:gr({file:{data:o,name:t||On(o),contentType:e||In(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Vo(l),signature:s,expire:n,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:T,headers:C,request:E})=>{let k=qt(JSON.parse(T));if("error"in k)throw new nt(k.error.content,k.error.errorCode,E,k,C);return k}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Lc,"base");var Uo;(function(o){o.Token="token",o.FileInfo="file_info";})(Uo||(Uo={}));function Pc(o,{publicKey:i,baseURL:t=P.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return oe(()=>re({method:"POST",headers:{"X-UC-User-Agent":be({publicKey:i,integration:d,userAgent:f})},url:Gt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Vo(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:T,headers:C,request:E})=>{let k=qt(JSON.parse(T));if("error"in k)throw new nt(k.error.content,k.error.errorCode,E,k,C);return k}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Pc,"fromUrl");var ut;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(ut||(ut={}));var Uc=a(o=>"status"in o&&o.status===ut.Error,"isErrorResponse");function Rc(o,{publicKey:i,baseURL:t=P.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=P.retryNetworkErrorMaxTimes}={}){return oe(()=>re({method:"GET",headers:i?{"X-UC-User-Agent":be({publicKey:i,integration:r,userAgent:s})}:void 0,url:Gt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=qt(JSON.parse(c));if("error"in d&&!Uc(d))throw new nt(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a(Rc,"fromUrlStatus");function $c(o,{publicKey:i,baseURL:t=P.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=P.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"POST",headers:{"X-UC-User-Agent":be({publicKey:i,integration:c,userAgent:u})},url:Gt(t,"/group/",{jsonerrors:1}),data:gr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:l}),signal:n}).then(({data:f,headers:m,request:v})=>{let w=qt(JSON.parse(f));if("error"in w)throw new nt(w.error.content,w.error.errorCode,v,w,m);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}a($c,"group");function Ln(o,{publicKey:i,baseURL:t=P.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"GET",headers:{"X-UC-User-Agent":be({publicKey:i,integration:s,userAgent:n})},url:Gt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:u,headers:p,request:d})=>{let f=qt(JSON.parse(u));if("error"in f)throw new nt(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Ln,"info");function Dc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=P.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return oe(()=>re({method:"POST",url:Gt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:d,userAgent:f})},data:gr({filename:e||An,size:o,content_type:t||pr,part_size:r,UPLOADCARE_STORE:Vo(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:p,metadata:w}),signal:u}).then(({data:T,headers:C,request:E})=>{let k=qt(JSON.parse(T));if("error"in k)throw new nt(k.error.content,k.error.errorCode,E,k,C);return k.parts=Object.keys(k.parts).map(bt=>k.parts[Number(bt)]),k}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})}a(Dc,"multipartStart");function Fc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=P.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||pr}}).then(l=>(r&&r({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}a(Fc,"multipartUpload");function Vc(o,{publicKey:i,baseURL:t=P.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"POST",url:Gt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":be({publicKey:i,integration:s,userAgent:n})},data:gr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=qt(JSON.parse(u));if("error"in f)throw new nt(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Vc,"multipartComplete");function No(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return Sn({check:a(p=>Ln(o,{publicKey:i,baseURL:t,signal:p,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}a(No,"isReadyPoll");function Nc(o){return "defaultEffects"in o}a(Nc,"isGroupFileInfo");var ye=class{static{a(this,"UploadcareFile");}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=Gt(t,`${r}/`),l=s?Gt(`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=l,Nc(i)&&(this.defaultEffects=i.defaultEffects);}},_c=a((o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:T})=>Lc(o,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:T}).then(({file:C})=>No(C,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(C=>new ye(C,{baseCDN:w})),"uploadDirect"),zc=a((o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>Ln(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new ye(f,{baseCDN:d,fileName:t})).then(f=>(s&&s({isComputable:true,value:1}),f)),"uploadFromUploaded"),Bc=a((o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=a(n=>()=>{e=n,r.forEach((l,c)=>c!==n&&l.abort());},"createStopRaceCallback");return dr(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,l)=>{let c=s(l);return Promise.resolve().then(()=>n({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),Hc=window.WebSocket,Ro=class{static{a(this,"Events");}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]=[];}},Kc=a((o,i)=>o==="success"?{status:ut.Success,...i}:o==="progress"?{status:ut.Progress,...i}:{status:ut.Error,...i},"response"),$o=class{static{a(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Ro;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 Hc(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,Kc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=a(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");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)}},Lo=null,_o=a(o=>{if(!Lo){let i=typeof window>"u"?0:3e4;Lo=new $o(o,i);}return Lo},"getPusher"),jc=a(o=>{_o(o).connect();},"preconnect");function Gc({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return Sn({check:a(u=>Rc(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case ut.Error:return new nt(p.error,p.errorCode);case ut.Waiting:return false;case ut.Unknown:return new nt(`Token "${o}" was not found.`);case ut.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case ut.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}a(Gc,"pollStrategy");var qc=a(({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=_o(i),l=n.onError(s),c=a(()=>{l(),n.unsubscribe(o);},"destroy");dr(t,()=>{c(),s(new ee("pusher cancelled"));}),n.subscribe(o,u=>{switch(u.status){case ut.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case ut.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),r(u);break}case ut.Error:c(),s(new nt(u.msg,u.error_code));}});}),"pushStrategy"),Wc=a((o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:T=P.pusherKey,metadata:C})=>Promise.resolve(jc(T)).then(()=>Pc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:C})).catch(E=>(_o(T)?.disconnect(),Promise.reject(E))).then(E=>E.type===Uo.FileInfo?E:Bc([({signal:k})=>Gc({token:E.token,publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:k}),({signal:k})=>qc({token:E.token,pusherKey:T,signal:k,onProgress:d})],{signal:p})).then(E=>{if(E instanceof nt)throw E;return E}).then(E=>No(E.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(E=>new ye(E,{baseCDN:r})),"uploadFromUrl"),Po=new WeakMap,Zc=a(async o=>{if(Po.has(o))return Po.get(o);let i=await fetch(o.uri).then(t=>t.blob());return Po.set(o,i),i},"getBlobFromReactNativeAsset"),Pn=a(async o=>{if(fr(o)||hr(o))return o.size;if(mr(o))return (await Zc(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Yc=a((o,i=P.multipartMinFileSize)=>o>=i,"isMultipart"),Un=a(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 !Re(o)&&t.test(o)},"isUuid"),zo=a(o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Re(o)&&t.test(o)},"isUrl"),Xc=a((o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,l=[...i],c=a(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(r[u]=d,n-=1,n?c():t(r));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<o;u++)c();}),"runWithConcurrency"),Qc=a((o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},"sliceChunk"),Jc=a(async(o,i,t)=>e=>Qc(o,e,i,t),"prepareChunks"),tu=a((o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Fc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),eu=a(async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:T=P.multipartChunkSize,maxConcurrentRequests:C=P.maxConcurrentRequests,baseCDN:E,metadata:k})=>{let bt=e??await Pn(o),wt,de=a((J,ct)=>{if(!u)return;wt||(wt=Array(J).fill(0));let At=a(Pt=>Pt.reduce((_t,po)=>_t+po,0),"sum");return Pt=>{Pt.isComputable&&(wt[ct]=Pt.value,u({isComputable:true,value:At(wt)/J}));}},"createProgressHandler");return w||=In(o),Dc(bt,{publicKey:i,contentType:w,fileName:t||On(o),baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:k,multipartChunkSize:T}).then(async({uuid:J,parts:ct})=>{let At=await Jc(o,bt,T);return Promise.all([J,Xc(C,ct.map((Pt,_t)=>()=>tu(At(_t),Pt,{publicKey:i,contentType:w,onProgress:de(ct.length,_t),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})))])}).then(([J])=>Vc(J,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})).then(J=>J.isReady?J:No(J.uuid,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(J=>new ye(J,{baseCDN:E}))},"uploadMultipart");async function Bo(o,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartMinFileSize:w,multipartChunkSize:T,maxConcurrentRequests:C,baseCDN:E=P.baseCDN,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:bt,pusherKey:wt,metadata:de}){if(Re(o)){let J=await Pn(o);return Yc(J,w)?eu(o,{publicKey:i,contentType:v,multipartChunkSize:T,fileSize:J,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:de}):_c(o,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:de})}if(zo(o))return Wc(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:E,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:bt,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:wt,metadata:de});if(Un(o))return zc(o,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E});throw new TypeError(`File uploading from "${o}" is not supported`)}a(Bo,"uploadFile");var iu=a((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}},"replaceUrlBase"),Do=class{static{a(this,"UploadcareGroup");}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=iu(i.cdnUrl,t),this.files=e.map(r=>new ye(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},ru=a(o=>{for(let i of o)if(!Re(i))return false;return true},"isFileDataArray"),ou=a(o=>{for(let i of o)if(!Un(i))return false;return true},"isUuidArray"),su=a(o=>{for(let i of o)if(!zo(i))return false;return true},"isUrlArray");function Rn(o,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w=P.multipartChunkSize,baseCDN:T=P.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E,jsonpCallback:k}){if(!ru(o)&&!su(o)&&!ou(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let bt,wt=true,de=o.length,J=a((ct,At)=>{if(!c)return;bt||(bt=Array(ct).fill(0));let Pt=a(_t=>_t.reduce((po,Ll)=>po+Ll)/ct,"normalize");return _t=>{if(!_t.isComputable||!wt){wt=false,c({isComputable:false});return}bt[At]=_t.value,c({isComputable:true,value:Pt(bt)});}},"createProgressHandler");return Promise.all(o.map((ct,At)=>Re(ct)||zo(ct)?Bo(ct,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:J(de,At),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w,baseCDN:T,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E}).then(Pt=>Pt.uuid):ct)).then(ct=>$c(ct,{publicKey:i,baseURL:e,jsonpCallback:k,secureSignature:r,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(At=>new Do(At,{baseCDN:T})).then(At=>(c&&c({isComputable:true,value:1}),At)))}a(Rn,"uploadFileGroup");var ie=class{static{a(this,"Queue");}Di=1;eo=[];Fi=0;to=new Map;io=new Map;constructor(i){this.Di=i;}run(){let i=this.Di-this.Fi;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.Fi+=1,e().finally(()=>{this.to.delete(e),this.io.delete(e),this.Fi-=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.Fi}set concurrency(i){this.Di=i,this.run();}get concurrency(){return this.Di}};var Ho=a(()=>({}),"blockCtx"),Ko=a(o=>({...Ho(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":a(()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),jo=a(o=>({...Ko(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ie(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),$n=a(o=>({...jo(o),"*solution":null,"*lazyPlugins":null}),"solutionBlockCtx");var V=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var vr=class extends G{constructor(t){super(t);this.scopes=new Set;this.listener=this.Vc.bind(this),window.addEventListener("paste",this.listener);}static{a(this,"ClipboardLayer");}openUploadList(){this.i.api.setCurrentActivity(V.UPLOAD_LIST),this.i.api.setModalState(true);}async Vc(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this.ze.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(l=>{n.getAsString(c=>{l(c);});}));r.length>0&&(r.forEach(n=>{this.i.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(l=>{this.i.api.addFileFromUrl(l,{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 nu={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function fi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}a(fi,"focus");function Go(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=nu[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}a(Go,"findGroupNodeByEventTarget");function qo(o,i){return i.role==="toolbar"?au(i):i.querySelectorAll(`[role=${o.role}]`)}a(qo,"getItems");function au(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}a(au,"getToolbarItems");function lu(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"}a(lu,"isHorizontalOrientation");function Dn(o){return i=>{let t=false,e=o?.searchDelayMs||300,r=0,s="";function n(d){let f=Go(d.target);if(!f){l();return}let m=qo(d.target,f),v=Array.from(m).indexOf(d.target),w="ArrowDown",T="ArrowUp";if(lu(f)&&(i.document.dir==="rtl"?(w="ArrowLeft",T="ArrowRight"):(w="ArrowRight",T="ArrowLeft")),d.key===w)d.preventDefault(),fi(d.target,m[v+1]||m[0]);else if(d.key===T)d.preventDefault(),fi(d.target,m[v-1]||m[m.length-1]);else if(d.key==="Home")d.preventDefault(),fi(d.target,m[0]);else if(d.key==="End")d.preventDefault(),fi(d.target,m[m.length-1]);else if(d.key.length===1&&f.role!=="tablist"){let C=Date.now();C-r<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),r=C;let E=Array.from(m).find(k=>k.textContent?.trim()?.toLowerCase()?.startsWith(s));E&&(d.preventDefault(),fi(d.target,E));}}a(n,"keyDown");function l(){t=false,i.removeEventListener("keydown",n);}a(l,"stop");function c(d){let f=Go(d.target);if(f){t||(t=true,i.addEventListener("keydown",n));let m=qo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}a(u,"focusOut");function p(d){let f=Go(d.target);if(f){let m=qo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return a(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}a(Dn,"focusGroupKeyUX");function Fn(){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);}}a(e,"jump");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 a(r,"focusOut"),o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}a(Fn,"hiddenKeyUX");function Vn(){return o=>{let i=[];function t(c){let u=o.document.activeElement;u&&u!==o.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}a(t,"focus");function e(){let c=i.pop();if(!c){o.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}a(e,"back");let r=0,s;function n(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let p=o.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}a(n,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e();}return a(l,"keyDown"),o.addEventListener("keydown",l),()=>{o.removeEventListener("keydown",l);}}}a(Vn,"jumpKeyUX");function Nn(o){let i,t=o.split(" "),e;function r(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}a(r,"keyDown");function s(){i&&i.classList.remove(...t),e=null;}a(s,"keyUp");function n(l){l.clientX===0&&l.clientY===0&&e!==l.target&&(s(),l.target.classList.add(...t),i=l.target);}return a(n,"click"),l=>(l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",n),l.removeEventListener("keydown",r),l.removeEventListener("keyup",s);})}a(Nn,"pressKeyUX");function _n(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}a(_n,"startKeyUX");var Wo=class{constructor(){this.te=new Map;this.ro=[];}static{a(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=a(r=>{let s=r.target;s instanceof Node&&this.ro.some(n=>n===s||n.contains(s))&&t(r);},"wrappedListener");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();}},yr=class{static{a(this,"A11y");}constructor(){this.Ni=new Wo,this.tn=_n(this.Ni,[Dn(),Nn("is-pressed"),Vn(),Fn()]);}registerBlock(i){this.Ni.registerScope(i);}destroy(){this.tn?.(),this.Ni.destroy();}};var Wt=a(o=>`*l10n/${o}`,"localeStateKey"),cu="en",br=class extends G{constructor(t){super(t);this.xt="";for(let[r,s]of Object.entries(di)){let n=this.e.has(Wt(r))?!this.e.read(Wt(r)):true;this.e.add(Wt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.xt&&this.rn(this.xt);})),this.addSub(this.e.sub(L("localeName"),async r=>{if(!r)return;this.xt=r;let s=await dn(r);r!==cu&&this.xt!==r||(this.rn(r),this.sn(r,s));})),this.addSub(this.e.sub(L("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.xt];s&&this.sn(this.xt,s);}));}static{a(this,"LocaleManager");}sn(t,e){let r=this.ze.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let l=r?.[s];this.e.add(Wt(s),l??n,true);}}rn(t){let e=this.i.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.i18n){let{pluginId:n,...l}=s,c=l[t];if(c)for(let[u,p]of Object.entries(c))p!==void 0&&this.e.add(Wt(u),p,true);}}};var uu=a(()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},"calcIsDesktopSafari"),du=a(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),pu=a(()=>({safariDesktop:uu()}),"calcBrowserInfo"),hu=a(()=>({htmlMediaCapture:du()}),"calcBrowserFeatures"),zn=pu(),Bn=hu();var mi="image/*",Zo="video/*",fu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],mu=a(()=>zn.safariDesktop?[mi]:[mi,...fu],"calcImageAcceptList"),gi=mu(),wr=a(o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Y(i)):[],"mergeFileTypes"),Yo=a((o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),"matchMimeType"),Hn=a((o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),$e=a(o=>{let i=o?.type;return i?Yo(i,gi):false},"fileIsImage");function Kn(o,i,t,e,r){return {registry:{registerSource:a(u=>o.addSource(e,u),"registerSource"),registerActivity:a(u=>o.addActivity(e,u),"registerActivity"),registerFileAction:a(u=>o.addFileAction(e,u),"registerFileAction"),registerFileHook:a(u=>o.addFileHook(e,u),"registerFileHook"),registerIcon:a(u=>o.addIcon(e,u),"registerIcon"),registerI18n:a(u=>o.addI18n(e,u),"registerI18n"),registerConfig:a(u=>o.addConfig(e,u),"registerConfig")},config:{get:a(u=>{let p=L(u);return i.read(p)},"get"),subscribe:a((u,p)=>{let d=L(u),f=i.sub(d,m=>{p(m);});return r.push(f),f},"subscribe")},activity:{getParams:a(()=>i.read("*currentActivityParams"),"getParams"),subscribeToParams:a(u=>{let p=i.sub("*currentActivityParams",d=>{u(d);});return r.push(p),p},"subscribeToParams")},files:{update:a((u,p)=>{let d=t.uploadCollection?.read(u);d&&(p.file!==void 0&&(d.setValue("file",p.file),d.setValue("fileSize",p.file.size)),p.cdnUrl!==void 0&&d.setValue("cdnUrl",p.cdnUrl),p.cdnUrlModifiers!==void 0&&d.setValue("cdnUrlModifiers",p.cdnUrlModifiers),p.mimeType!==void 0&&d.setValue("mimeType",p.mimeType));},"update")}}}a(Kn,"buildPluginApi");var gu=a(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),"resolveLazyPlugins"),Tr=class{constructor(i,t){this.e=i;this.Bc=t;this.Yt=new Set;this.nn=this.e.sub("*lazyPlugins",e=>{this._c(e??[]);});}static{a(this,"LazyPluginLoader");}_c(i){for(let r of this.Yt)r();if(this.Yt.clear(),i.length===0)return;let t=new Set([L("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(L(s));let e=a(()=>this.an(i),"recompute");for(let r of t)this.Yt.add(this.e.sub(r,e,false));this.an(i);}an(i){this.oo?.abort();let t=new AbortController;this.oo=t;let e=a(n=>this.e.read(L(n)),"get"),r=e("plugins"),s=gu({entries:i.map(n=>({isEnabled:a(()=>n.isEnabled(e),"isEnabled"),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.Bc(s);}destroy(){this.nn();for(let i of this.Yt)i();this.Yt.clear(),this.oo?.abort();}};var Er=class{constructor(){this.Ke=new Map;}static{a(this,"CustomConfigRegistry");}register(i,t){if(this.Ke.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.Ke.set(t.name,e);}unregister(i){this.Ke.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.Ke)e.pluginId===i&&this.Ke.delete(t);}get(i){return this.Ke.get(i)}getAll(){return new Map(this.Ke)}};var Cr=class{constructor(){this.je=[];this.ve=[];this.Vi=[];this._i=[];this.Bi=[];this.zi=[];this.config=new Er;}static{a(this,"PluginRegistry");}Et(i,t){return {...t,pluginId:i}}addSource(i,t){return this.je.push(this.Et(i,t)),t}addActivity(i,t){return this.ve.push(this.Et(i,t)),t}addFileAction(i,t){return this.Vi.push(this.Et(i,t)),t}addFileHook(i,t){return this._i.push(this.Et(i,t)),t}addIcon(i,t){return this.Bi.push(this.Et(i,t)),t}addI18n(i,t){return this.zi.push(this.Et(i,t)),t}addConfig(i,t){this.config.register(i,t);}purge(i){this.je=this.je.filter(t=>t.pluginId!==i),this.ve=this.ve.filter(t=>t.pluginId!==i),this.Vi=this.Vi.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.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.je],activities:[...this.ve],fileActions:[...this.Vi],fileHooks:[...this._i],icons:[...this.Bi],i18n:[...this.zi]}}};var xr=class extends G{constructor(t){super(t);this.Ge=new Map;this.c=new Set;this.so=Promise.resolve();this.registry=new Cr;this.ln=new Tr(this.e,e=>{this.so=this.so.then(()=>e).then(r=>{if(r)return this.zc(r)});});}static{a(this,"PluginManager");}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(r.has(s.id)){this.m(`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(),this.m(`Plugin "${s.id}" setup failed`,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=Kn(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(l){for(let c of e)try{c();}catch(u){this.m("Failed to unsubscribe config listener",u);}throw l}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.m("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(n=>n.type==="onAdd");if(r.length===0)return;let s=e;for(let n of r)try{({file:s}=await n.handler({file:s}));}catch(l){this.m(`File hook "onAdd" from plugin "${n.pluginId}" failed`,l);}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",$e(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.Ge.keys()))this.lo(t);this.ln.destroy(),super.destroy();}ao(){for(let t of this.c)try{t();}catch{}}};function vu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}a(vu,"i");function Qo(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?Qo(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=vu(i);return typeof t=="object"&&t!==null?[e,Qo(t)]:[e,t]}))}a(Qo,"c");function yu(o){return {ok:true,value:o}}a(yu,"u");function Xo(o){return {ok:false,error:o}}a(Xo,"a");var bu="https://tlm.uploadcare.com/api/",Jo=class{static{a(this,"y");}constructor(i=bu){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return Xo(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return yu(s)}catch(s){return Xo(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return Xo(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(Qo(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},wu=a(async(o,i)=>({success:true,data:i}),"p"),Tu=a(async o=>wu(void 0,o),"f"),Sr=class extends Jo{static{a(this,"h");}constructor(){super();}async sendEvent(i,t){let e=await Tu(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 Eu=20,F=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"}),Ar=class extends G{constructor(){super(...arguments);this.Xt=new Map;this.Hi=new Set;this.te=new Map;}static{a(this,"EventEmitter");}bindTarget(t){return this.Hi.add(t),()=>{this.Hi.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)}cn(t,e){for(let s of this.Hi)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.te.get(t);if(r)for(let s of r)s(e);this.m?.(()=>{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.cn(t,typeof e=="function"?e():e);return}this.Xt.has(t)&&window.clearTimeout(this.Xt.get(t));let n=typeof s=="number"?s:Eu,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.cn(t,c),this.Xt.delete(t);}catch(c){this.m?.(()=>`Error while getting payload for event "${t}"`,c);}},n);this.Xt.set(t,l);}destroy(){for(let t of this.Xt.values())window.clearTimeout(t);this.Hi.clear(),this.te.clear();}};var jn="1.28.0-alpha.666";var Ut="blocks",Rt=jn;var kr=class extends G{constructor(t){super(t);this.Kc=ht.generateRandomUUID();this.Ct=structuredClone(tt);this.co=false;this.uo=null;this.Me=false;this.un=new Sr,this.St=new ie(10),this.addSub(this.e.sub(L("qualityInsights"),e=>{this.Me=!!e;}));for(let e of Object.keys(this.Ct))this.addSub(this.e.sub(L(e),r=>{this.Me&&(this.co&&this.Ct[e]!==r&&this.sendEvent({eventType:F.CHANGE_CONFIG}),this.jc(e,r));}));}static{a(this,"TelemetryManager");}Gc(t){t===F.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===F.INIT_SOLUTION||t.eventType===F.CHANGE_CONFIG)&&(r.config=this.Ct),{...r,appVersion:Rt,appName:Ut,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.Me)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.dn(this.uo,e))&&this.St.add(async()=>{this.uo=e,await this.un.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:F.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}dn(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.dn(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 Gn=a(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},"getLocaleDirection");var xu=a(o=>o,"DEFAULT_TRANSFORMER"),ts="{{",Wn="}}",qn="plural:";function De(o,i={},t={}){let{openToken:e=ts,closeToken:r=Wn,transform:s=xu}=t;for(let n in i){let l=i[n],c=l?.toString(),u=typeof c=="string"?s(c):String(c);o=o.replaceAll(e+n+r,u);}return o}a(De,"applyTemplateData");function Zn(o){let i=[],t=o.indexOf(ts);for(;t!==-1;){let e=o.indexOf(Wn,t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(qn)){let s=o.substring(t+2,e).replace(qn,""),n=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:l});}t=o.indexOf(ts,e);}return i}a(Zn,"getPluralObjects");var Yn="--uploadcare-blocks-window-height",vi=class o{static{a(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=D(()=>{document.documentElement.style.setProperty(Yn,`${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(Yn);}};var Mr=a((o,i)=>new Intl.PluralRules(o).select(i),"getPluralForm");var Su=a(o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=Mr(r,t);return e(`${i}__${s}`)},"createPluralizer"),Ir=a(o=>{let i=Su(()=>t),t=a((e,r={})=>{if(!e)return "";let n=o().read(Wt(e))||e,l=Zn(n);for(let u of l)r[u.variable]=i(u.pluralKey,Number(r[u.countVariable]));return De(n,r)},"l10n");return t},"createL10n");var Au=a(o=>o.tagName?.includes("-")??false,"isCustomElement"),Or=class{constructor(i){this.qe=new Set;this.Ki=new Map;this.pn=false;this.We=i,this.We.addController(this);}static{a(this,"TestModeController");}hostDisconnected(){this.ji?.(),this.ji=void 0,this.qe.clear(),this.Ki.clear();}hostUpdated(){if(!this.ji&&this.We.has(L("testMode"))){let i=this.We.subConfigValue("testMode",t=>{this.pn=!!t,this.hn();});this.ji=i;}this.Jc(),this.hn();}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=>!Au(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.qe.has(n)){let l=n.getAttribute("data-testid");if(!l)continue;this.qe.add(n),this.Ki.set(n,l);}for(let n of Array.from(this.qe))(!n.isConnected||r&&n.closest(r)!==e)&&(this.qe.delete(n),this.Ki.delete(n));}hn(){if(!this.qe.size)return;let i=this.We.testId||"";for(let t of this.qe){let e=this.Ki.get(t);e&&(this.pn?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var ku=Oe(rr()(Ie(tr(Tt)))),x=class extends ku{constructor(){super();this.init$=Ho();this.l10n=Ir(()=>this.sharedCtx);this.debugPrint=lr(()=>this.sharedCtx,this.constructor.name);this.i=Tn(()=>this.sharedCtx);new Or(this);}static{a(this,"LitBlock");}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(),vi.registerClient(this);}initCallback(){this.Z("*blocksRegistry",()=>new Set),this.Z("*pluginManager",t=>new xr(t)),this.Z("*eventEmitter",t=>new Ar(t)),this.Z("*localeManager",t=>new br(t)),this.Z("*modalManager",t=>new cr(t)),this.Z("*a11y",()=>new yr),this.Z("*clipboard",t=>new vr(t)),this.Z("*telemetryManager",t=>new kr(t)),this.sub(Wt("locale-id"),t=>{let e=Gn(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(),vi.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.eu(),K.deleteCtx(this.ctxName);}mn(){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.mn();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.mn();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:nr(t),cdnUrlModifiers:Mo(t),fileName:sr(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?De(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:a(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.Be){let t={};this.Be=new Proxy(t,{set:a((e,r,s)=>{if(typeof r!="string"||!(r in tt))return false;let n=r,l=L(n);return this.has(l)||this.add(l,tt[n]),this.$[l]=s,true},"set"),get:a((e,r)=>{let s=L(r);return this.has(s)||this.add(s,tt[r]),this.$[s]},"get")});}return this.Be}subConfigValue(t,e){let r=L(t);return this.has(r)||this.add(r,tt[t]),this.sub(r,e)}};var $t={ATTRIBUTE:1,CHILD:2},mt=a(o=>(...i)=>({jr:o,values:i}),"e"),Et=class{static{a(this,"i");}constructor(i){}get W(){return this.f.W}Gr(i,t,e){this.Gi=i,this.f=t,this.tu=e;}Pc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var we=class extends Et{static{a(this,"e");}constructor(i){if(super(i),this.it=R,i.type!==$t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===R||i==null)return this.gn=void 0,this.it=i;if(i===rt)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.gn;this.it=i;let t=[i];return t.raw=t,this.gn={Ne:this.constructor.resultType,strings:t,values:[]}}};we.directiveName="unsafeHTML",we.resultType=1;mt(we);var yi=class extends we{static{a(this,"t");}};yi.directiveName="unsafeSVG",yi.resultType=2;var Fe=mt(yi);var Xn="<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 Zt=class extends x{constructor(){super(...arguments);this.init$=$n(this);}static{a(this,"LitSolutionBlock");}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 y`${Fe(Xn)}`}};var Qn=a(o=>typeof o!="number"?0:Math.floor(o/1e3),"msToUnixTimestamp"),Jn=a((o,{threshold:i})=>{let{secureExpire:t}=o,e=Qn(Date.now()),r=Number(t),s=Qn(i);return e+s>=r},"isSecureTokenExpired");var Lr=class extends G{constructor(){super(...arguments);this.Ze=null;}static{a(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.ze;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.Ze||Jn(this.Ze,{threshold:s})){this.Ze?this.m("Secure signature is expired. Resolving a new one..."):this.m("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.m("Secure signature resolved:",n),this.m("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.Ze=n):(this.m("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.m("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.Ze=null;}};var es=a((o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var is=a((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}}},"validateMultiple");var rs=a((o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=wr([...t?gi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let l=Yo(s,r),c=Hn(n,r);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}},"validateFileType");var os=a((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}}},"validateIsImage");var Dt=1e3,Te=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),bi=a(o=>Math.ceil(o*100)/100,"round"),ta=a((o,i=Te.AUTO)=>{let t=i===Te.AUTO;if(i===Te.BYTE||t&&o<Dt**1){let r=Mr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===Te.KB||t&&o<Dt**2?`${bi(o/Dt**1)} KB`:i===Te.MB||t&&o<Dt**3?`${bi(o/Dt**2)} MB`:i===Te.GB||t&&o<Dt**4?`${bi(o/Dt**3)} GB`:i===Te.TB||t&&o<Dt**5?`${bi(o/Dt**4)} TB`:`${bi(o/Dt**5)} PB`},"prettyBytes");var ss=a((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:ta(t)}),payload:{entry:o}}},"validateMaxSizeLimit");var ns=a((o,i)=>{let{internalId:t}=o;if(!i.v.hasItem(t))return;let r=i.v.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof nt)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:o,error:r}};if(r instanceof Ue)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}}},"validateUploadError");var Ve={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."},Mu=a(o=>typeof o=="function"?{runOn:"change",validator:o}:o,"getValidatorDescriptor"),Pr=class extends G{constructor(t){super(t);this.iu=[os,rs,ss,ns];this.ru=[is,es];this.St=new ie(20);this.vn=D(()=>{this.St.run();},500);this.Ie=false;this.At=new Map;let e=D(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(L("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(L("multipleMin"),e)),this.addSub(this.e.sub(L("multipleMax"),e)),this.addSub(this.e.sub(L("multiple"),e)),this.addSub(this.e.sub(L("imgOnly"),e)),this.addSub(this.e.sub(L("accept"),e)),this.addSub(this.e.sub(L("validationConcurrency"),r=>{this.St.concurrency=r;}));}static{a(this,"ValidationManager");}get v(){return this.i.uploadCollection}runFileValidators(t,e){if(this.Ie)return;let r=e??this.v.items();for(let s of r){let n=this.v.read(s);n&&this.ou(n,t);}}runCollectionValidators(){if(this.Ie)return;let t=this.i.api,e=t.getOutputCollectionState(),r=[],s=this.ze.collectionValidators;for(let n of [...this.ru,...s])try{let l=n(e,t);if(!l)continue;l&&(r.push(this.yn(l)),l.message||console.warn(Ve.MISSING_ERROR_MESSAGE));}catch(l){console.warn(Ve.COLLECTION_VALIDATION_FAILED,l);}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.Ie)return;let r=this.i.api,s=this.bn(t),n=s.promise??Promise.resolve(),l=(async()=>{if(this.Ie||(await n,this.Ie))return;let c=this.su(t,e);if(c.length===0||!this.v.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=r.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.ze.validationTimeout,f=this.wn(),m=new Set(c.map(T=>T.validator)),v=[];for(let T of f)if(!m.has(T.validator)){let C=s.lastErrorThrownByValidator.get(T.validator);C&&v.push(C);}let w=c.map(T=>async()=>{if(this.Ie)return;let C=setTimeout(()=>{s.skippedValidators.add(T.validator),p.abort(),console.warn(Ve.FILE_VALIDATION_TIMEOUT);},d);try{let E=await T.validator(u,r,{signal:p.signal});if(!E||p.signal.aborted){s.lastErrorThrownByValidator.set(T.validator,void 0);return}let k=this.yn(E);s.lastErrorThrownByValidator.set(T.validator,k),v.push(k),E.message||console.warn(Ve.MISSING_ERROR_MESSAGE);}catch(E){p.signal.aborted||(s.skippedValidators.add(T.validator),console.warn(Ve.FILE_VALIDATION_FAILED,E),this.i.telemetryManager.sendEventError(E,`file validator. ${Ve.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),T.runOn!=="change"&&s.skippedValidators.add(T.validator);}});if(this.vn(),await this.St.add(async()=>{this.Ie||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(T=>T())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}yn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}bn(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}wn(){let t=this.ze.fileValidators;return [...this.iu,...t].map(Mu)}su(t,e){let r=this.bn(t);return this.wn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Ie=true,this.vn.cancel();for(let t of this.At.values())t.abortController?.abort(),t.promise=void 0;this.At.clear();}};var ea="[Typed State] Wrong property name: ",Ur=class{static{a(this,"TypedData");}constructor(i){this.J=ht.generateFastUid(),this.Y=K.registerCtx(i,this.J);}get uid(){return this.J}setValue(i,t){if(!this.Y.has(i)){console.warn(`${ea}${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(`${ea}${String(i)}`),this.Y.read(i)}subscribe(i,t){return this.Y.sub(i,t)}destroy(){K.deleteCtx(this.J);}};var Rr=class o{constructor(i){this.Oe=Object.create(null);this.qi=new Set;this.Wi=new Set;this.ye=new Set;this.po=new Set;this.ho=new Set;this.kt=new Set;this.En=i.initialValue,this.J=ht.generateFastUid(),this.Y=K.registerCtx({},this.J),this.Tn=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.qi.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Cn();},i.handler&&this.observeCollection(i.handler);}static{a(this,"TypedCollection");}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.Wi)e?.([...this.ye],i,t);this.Cn();});}Cn(){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.Wi.add(i),this.ye.size>0&&this.q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Wi.delete(i);}add(i){let t=new Ur(this.En);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.Tn.forEach(e=>{this.Oe[t.uid]||(this.Oe[t.uid]=[]),this.Oe[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.Oe[i]?.forEach(e=>{e();}),delete this.Oe[i];}clearAll(){this.ye.forEach(i=>{this.remove(i);});}observeProperties(i){return this.qi.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.qi.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(),K.deleteCtx(this.J),this.qi=new Set,this.Wi=new Set;for(let i of Object.keys(this.Oe))this.Oe[i]?.forEach(t=>{t();}),delete this.Oe[i];}};var U=Object.freeze({PHOTO:"photo",VIDEO:"video"}),Ct=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var ia=a(o=>({isVideoRecordingEnabled:j(o.cameraModes).includes(U.VIDEO),isPhotoEnabled:j(o.cameraModes).includes(U.PHOTO)}),"calcCameraModes");var ra=a((o,i)=>{for(let t of o)if(i(t))return t},"findBlockInCtx");var as=a((o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),l=a(()=>{for(let c of o)if(i(c)){clearTimeout(n),r(c);return}s=requestAnimationFrame(l);},"check");l();}),"waitForBlockInCtx");function $r(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}a($r,"applyStyles");var Iu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Ou=new RegExp(`^/?(${Iu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),oa=a(({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(hi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Ou.exec(r.pathname);if(!s)return null;let[,n,l,c]=s;return n?{uuid:n,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var xt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Lu=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),_=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Lu,...xt});var Dr=a(o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e)),"getOutputData");function sa(o){let i=new Map;return a((...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s},"memoized")}a(sa,"memoize");var na=new Set;function Fr(o){na.has(o)||(na.add(o),console.warn(o));}a(Fr,"warnOnce");function Pu(o){let i=false;return setTimeout(()=>{i=true;},0),a(e=>((...r)=>(i&&Fr(o),e(...r))),"withAssert")}a(Pu,"createAsyncAssertWrapper");function aa(o){let i={},t=o.ctx,e={progress:a(()=>t.read("*commonProgress"),"progress"),errors:a(()=>t.read("*collectionErrors"),"errors"),group:a(()=>t.read("*groupInfo"),"group"),totalCount:a(()=>o.uploadCollection.size,"totalCount"),failedCount:a(()=>i.failedEntries.length,"failedCount"),successCount:a(()=>i.successEntries.length,"successCount"),uploadingCount:a(()=>i.uploadingEntries.length,"uploadingCount"),status:a(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:a(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:a(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:a(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:a(()=>Dr(o),"allEntries"),successEntries:a(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:a(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:a(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:a(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},r=Pu("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 l=s,u=sa(r(n));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}a(aa,"buildOutputCollectionState");var Vr=class extends G{constructor(){super(...arguments);this.au=Ir(()=>this.e);this.addFileFromUrl=a((t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??_.API});return this.getOutputItem(n)},"addFileFromUrl");this.addFileFromUuid=a((t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({uuid:t,fileName:r??null,silent:e??false,source:s??_.API});return this.getOutputItem(n)},"addFileFromUuid");this.addFileFromCdnUrl=a((t,{silent:e,fileName:r,source:s}={})=>{let n=oa({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let l=this.v.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??_.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=a((t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let l=this.v.add({file:t,isImage:$e(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??_.API,fullPath:n??null});return this.getOutputItem(l)},"addFileFromObject");this.removeFileByInternalId=a(t=>{if(!this.v.read(t))throw new Error(`File with internalId ${t} not found`);this.v.remove(t);},"removeFileByInternalId");this.uploadAll=a(()=>{let t=this.v.items().filter(e=>{let r=this.v.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()));},"uploadAll");this.openSystemDialog=a((t={})=>{let e=Ht(wr([this.cfg.accept??"",...this.cfg.imgOnly?gi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),$r(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:l}=ia(this.cfg);t.modeCamera===U.PHOTO&&n?s.accept=mi:t.modeCamera===U.VIDEO&&l?s.accept=Zo:s.accept=[mi,l&&Zo].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?_.CAMERA:_.LOCAL});}),this.e.pub("*currentActivity",V.UPLOAD_LIST),this.i.modalManager?.open(V.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=a((t=false)=>{if(this.v.size>0&&!t)this.e.pub("*currentActivity",V.UPLOAD_LIST),this.i.modalManager?.open(V.UPLOAD_LIST);else if(this.Sn?.length===1){let e=this.Sn[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(c=>c.id===n[0])??s).onSelect():(this.e.pub("*currentActivity",V.START_FROM),this.i.modalManager?.open(V.START_FROM));return}this.e.read("*currentActivity")&&this.i.modalManager?.open(this.e.read("*currentActivity"));});}else this.e.pub("*currentActivity",V.START_FROM),this.i.modalManager?.open(V.START_FROM);},"initFlow");this.doneFlow=a(()=>{let t=ra(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());},"doneFlow");this.setCurrentActivity=a((t,...e)=>{this.fo().then(()=>{this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t),as(this.i.blocksRegistry,r=>r.activityType===t,{onTimeout:a(()=>console.warn(`Activity type "${t}" not found in the context`),"onTimeout"),timeout:100});});},"setCurrentActivity");this.on=a((t,e)=>this.i.eventEmitter.on(t,e),"on");this.getCurrentActivity=a(()=>this.e.read("*currentActivity"),"getCurrentActivity");this.historyBack=a(()=>{this.e.read("*historyBack")?.();},"historyBack");this.setModalState=a(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 as(this.i.blocksRegistry,r=>r.activityType===e,{onTimeout:a(()=>console.warn(`Activity block "${e}" not found in the context`),"onTimeout")}).then(()=>{this.i.modalManager?.open(e);})});},"setModalState");}static{a(this,"UploaderPublicApi");}get v(){return this.i.uploadCollection}get cfg(){return this.ze}get l10n(){return this.au}removeAllFiles(){this.v.clearAll();}getOutputItem(t){let e=K.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 aa(this.i)}async fo(){return (await this.i.wait("pluginManager")).pluginsReady()}get Sn(){let t=[];return this.cfg.sourceList&&(t=Y(this.cfg.sourceList)),t}};var la={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 wi=33.333333333333336,I=1,ls=24,ca=6;function se(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}a(se,"setSvgNodeAttrs");function gt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return se(t,i),t}a(gt,"createSvgNode");function ua(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,r+c*n+1.5*p-24*t*p],f=[e+l*s+1.5*u,r+c*n+1.5*p],m=[e+l*s-24*t*u+1.5*u,r+c*n+1.5*p],v=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,w=[f[0],f[1]];return {d:v,center:w}}a(ua,"cornerPath");function da(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,f=i==="n"?-1:i==="s"?1:0,m,v;l?(m=[e+u*s-34*t/2,r+p*n+1.5*f],v=[e+u*s+34*t/2,r+p*n+1.5*f]):(m=[e+u*s+1.5*d,r+p*n-34*t/2],v=[e+u*s+1.5*d,r+p*n+34*t/2]);let w=`M ${m[0]} ${m[1]} L ${v[0]} ${v[1]}`,T=[(m[0]+v[0])/2,(m[1]+v[1])/2];return {d:w,center:T}}a(da,"sidePath");function pa(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}a(pa,"thumbCursor");function ha({rect:o,delta:[i,t],imageBox:e}){return _e({...o,x:o.x+i,y:o.y+t},e)}a(ha,"moveRect");function _e(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}}a(_e,"constraintRect");function Uu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;s+=r,l-=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,l=o.y+o.height-s,t&&(n=l*t,c=o.x+o.width/2-n/2)),c<=e.x&&(c=e.x,s=o.y+o.height-l),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y+o.height-l),l<I&&(l=I,t&&(n=l*t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),n<I&&(n=I,t&&(l=n/t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),{x:c,y:s,width:n,height:l}}a(Uu,"resizeNorth");function Ru({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;s+=r,n-=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(l=n/t,c=o.y+o.height/2-l/2)),c<=e.y&&(c=e.y,s=o.x+o.width-n),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x+o.width-n),l<I&&(l=I,t&&(n=l*t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),n<I&&(n=I,t&&(l=n/t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),{x:s,y:c,width:n,height:l}}a(Ru,"resizeWest");function $u({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;l+=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(n=l*t),c=o.x+o.width/2-n/2),c<=e.x&&(c=e.x,s=o.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y),l<I&&(l=I,t&&(n=l*t),c=o.x+o.width/2-n/2),n<I&&(n=I,t&&(l=n/t),c=o.x+o.width/2-n/2),{x:c,y:s,width:n,height:l}}a($u,"resizeSouth");function Du({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;n+=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(l=n/t),c=o.y+o.height/2-l/2),c<=e.y&&(c=e.y,s=o.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x),l<I&&(l=I,t&&(n=l*t),c=o.y+o.height/2-l/2),n<I&&(n=I,t&&(l=n/t),c=o.y+o.height/2-l/2),{x:s,y:c,width:n,height:l}}a(Du,"resizeEast");function Fu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+s<e.y&&(s=e.y-l),n+=r,c-=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x+o.width-c,l=e.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y+o.height-u)),u<I&&(u=I,t&&(c=u*t),n=o.x+o.width-c,l=o.y+o.height-u),c<I&&(c=I,t&&(u=c/t),n=o.x+o.width-c,l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(Fu,"resizeNorthWest");function Vu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+s<e.y&&(s=e.y-l),c+=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x,l=e.y)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y+o.height-u)),u<I&&(u=I,t&&(c=u*t),l=o.y+o.height-u),c<I&&(c=I,t&&(u=c/t),l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(Vu,"resizeNorthEast");function Nu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),n+=r,c-=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x+o.width-c,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y)),u<I&&(u=I,t&&(c=u*t),n=o.x+o.width-c),c<I&&(c=I,t&&(u=c/t),n=o.x+o.width-c),{x:n,y:l,width:c,height:u}}a(Nu,"resizeSouthWest");function _u({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y)),u<I&&(u=I,t&&(c=u*t)),c<I&&(c=I,t&&(u=c/t)),{x:n,y:l,width:c,height:u}}a(_u,"resizeSouthEast");function fa({direction:o,...i}){switch(o){case "n":return Uu(i);case "w":return Ru(i);case "s":return $u(i);case "e":return Du(i);case "nw":return Fu(i);case "ne":return Vu(i);case "sw":return Nu(i);case "se":return _u(i);default:return i.rect}}a(fa,"resizeRect");function ma(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}a(ma,"rectContainsPoint");function ga(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}a(ga,"isRectInsideRect");function va(o,i){return Math.abs(o.width/o.height-i)<.1}a(va,"isRectMatchesAspectRatio");function ze({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}a(ze,"rotateSize");function ya(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),l=Math.round((i-s)/2);return n+r>o&&(r=o-n),l+s>i&&(s=i-l),{x:n,y:l,width:r,height:s}}a(ya,"calculateMaxCenteredCropFrame");function Be(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}a(Be,"roundRect");function ne(o,i,t){return Math.min(Math.max(o,i),t)}a(ne,"clamp");var Ti=["free"],_r=a(o=>{let i=Y(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&&!Ti.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),l=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(l)||n<=0||l<=0)&&!Ti.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:ht.generateFastUid(),type:"aspect-ratio",width:Ti.includes(r)?0:n,height:Ti.includes(r)?0:l,hasFreeform:Ti.includes(r)});}return t},"parseCropPreset"),ba=a((o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(r-p);d<n&&(n=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(r-u)/u>e)return null}return s},"getClosestAspectRatio");function wa(o){return Fo({...o,libraryName:Ut,libraryVersion:Rt})}a(wa,"customUserAgent");var Ta="active",He="___ACTIVITY_IS_ACTIVE___",Ea,S=class o extends(Ea=x,Ea){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Ko(this);this.lu=D(this.cu.bind(this),10);}static{a(this,"LitActivityBlock");}An(){let t=o.ti.get(this);this[He]=false,this.removeAttribute(Ta),t?.deactivateCallback?.();}uu(){let t=o.ti.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[He]=true,this.setAttribute(Ta,""),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[He]?this.An():this.activityType===t&&!this[He]&&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);}kn(){return !!this.activityType&&o.ti.has(this)}static{this.ti=new Map;}get isActivityActive(){return !!this[He]}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.An(),o.ti.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.kn()&&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();}}};S.activities=V;var $=class o extends S{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Zi=false;this.init$=jo(this);this.vo=D(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.On(),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)&&!!K.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=K.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(M.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.On();}if(t.isUploading)for(let s of t.isUploading){let n=K.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(M.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=K.getCtx(s);if(!n)continue;let{fileInfo:l,silent:c}=n.store;l&&!c&&this.emit(M.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.vu();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=K.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(M.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(M.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.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.On=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");typeof l=="number"&&(t+=l);});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()));};}static{a(this,"LitUploaderBlock");}get pu(){return this.hasBlockInCtx(t=>t instanceof o?t.Zi&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Z("*uploadCollection",()=>new Rr({initialValue:la,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Z("*secureUploadsManager",t=>new Lr(t)),this.Z("*validationManager",t=>new Pr(t)),this.Z("*publicApi",t=>new Vr(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.Zi&&this.Mn(),this.vo.cancel();}connectedCallback(){super.connectedCallback(),this.Zi&&this.In();}hu(){this.Zi=true,this.In(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}In(){this.Mn(),this.mo=this.uploadCollection.observeCollection(this.fu),this.go=this.uploadCollection.observeProperties(this.mu);}Mn(){this.go?.(),this.mo?.(),this.go=void 0,this.mo=void 0;}async gu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,n=await Rn(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(M.GROUP_CREATED,l),this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}vu(){let t=_r(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:l,height:c}=n.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=ya(l,c,u),d=ot(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),f=s.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:Z(f,d)});}}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:wa,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 Dr(this.i)}};$.extSrcList=Object.freeze({...xt});$.sourceTypes=Object.freeze({..._});var ae=class extends x{constructor(){super(...arguments);this.name="";this.Yi="";this.ii=null;this.Pn=null;}static{a(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Pn=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.Yi="",this.ii=null;return}let e=this.i.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.ii=e.svg,this.Yi="";return}this.ii=null;let r=`#uc-icon-${this.name}`,s=this.Pn?.(this.name);this.Yi=s??r;}render(){return this.ii?y`${this.yield("",y`${Fe(this.ii)}`)}`:y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Yi}></use></svg>`)} `}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};h([b({type:String})],ae.prototype,"name",2),h([g()],ae.prototype,"Yi",2),h([g()],ae.prototype,"ii",2);var Ca=a(o=>[...new Set(o)],"uniqueArray");var Ee="--uc-img-",cs="unresolved";var us=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ds=3e3,ps=5e3,hs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var zu="https://ucarecdn.com",Ke=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:zu},"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 zr=class extends Ie(Oe(Tt)){constructor(){super();this.Mt={};this.c=new Map;this.It=null;this.Xi=null;for(let t in Ke){let e=Ke[t];this.Mt[Ee+t]=e?.default||"";}}static{a(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.Mt[Ee+t]}set$$(t){for(let e in t){let r=Ee+e,s=t[e];this.Mt[r]=s,this.q(r,s);}}sub$$(t,e){let r=Ee+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/${Ut}/${Rt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;Ke[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.Xi||(this.Xi=new Set),this.Xi.add(t);}connectedCallback(){super.connectedCallback(),this.yu();}yu(){for(let t in Ke){let e=Ee+t,r=this.getCssData(e,true);r!=null&&(this.Mt[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.It&&(this.Xi?.forEach(t=>{this.It?.unobserve(t);}),this.It=null),this.c.clear();}static get observedAttributes(){return Object.keys(Ke)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Ee+t;this.Mt[s]=r,this.q(s,r);});}};var xa=a(o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var Kr=class extends zr{constructor(){super(...arguments);this.be=new Image;this.de=new Image;}static{a(this,"ImgBase");}Ln(t){return !t.includes("//")&&!us&&(t=new URL(t,document.baseURI).href),t}Qi(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)>ps&&this.Rn?ps+s:Number(n)>ds&&!this.Rn?ds+s:t}bu(t,e){let r={format:this.bo("format"),quality:this.bo("quality"),resize:this.Qi(t),blur:e,"cdn-operations":this.bo("cdn-operations")??void 0,analytics:this.analyticsParams()};return ot(...xa(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(us&&r&&!r.includes("//"))return this.ri(r);let s=this.bu(t,e),n=this.$$("cdn-cname"),l=n;if(r.startsWith(String(n)))return Z(r,s);let c=this.$$("uuid");if(l&&c)return this.ri(Z(Jt(l,c),s));if(c)return this.ri(Z(Jt(l,c),s));let u=this.$$("proxy-cname");if(u)return this.ri(Z(u,s,this.Ln(r)));let p=this.$$("pubkey");if(p)return this.ri(Z(`https://${p}.ucr.io/`,s,this.Ln(r)))}ri(t){let e=this.$$("secure-delivery-proxy");return e?De(e,{previewUrl:t},{transform:a(r=>window.encodeURIComponent(r),"transform")}):t}Ot(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),l=r?"":e*Math.round(s.height);return n||l?`${n||""}x${l||""}`:null}wu(t){let e=a(s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},"proxifyEvent"),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 Ji(){return this.we?{type:hs.PREVIEW,img:this.de}:{type:hs.MAIN,img:this.img}}get we(){return this.$$("is-preview-blur")}get Un(){return this.$$("is-background-for")}get $n(){let t=this.$$("breakpoints");if(t){let e=Y(t);return Ca(e.map(r=>parseInt(r,10)))}else return null}get Rn(){return this.$$("format").toLowerCase()==="jpeg"}Dn(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}`);}Fn(){let t=new Set;return this.$n?this.$n.forEach(e=>{t.add(`${this.re(`${e}x`)} ${this.Qi(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.re(`${e*2}x`)} ${this.Qi(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.re(`${e*3}x`)} ${this.Qi(`${e*3}w`)}`);}):(t.add(`${this.re(this.Ot(this.Ji.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.re(this.Ot(this.Ji.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.re(this.Ot(this.Ji.img,3))} 3x`)),[...t].join()}Nn(){return this.re()}get Vn(){return this.re("100x","100")}Tu(){let t=this.Un;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.Dn(e);}):this.Dn(e);});}xu({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(cs,""),r.addEventListener("load",()=>{r.removeAttribute(cs),s(r);}),r.addEventListener("error",()=>{n(false);}),this.xu({elNode:r,src:t,srcset:e});})}async Eu(){if(this.$$("intersection")){this.we&&(this.wo({elNode:this.de}),this.appendChild(this.de)),this.initIntersection(this.Ji.img,async()=>{this.we&&(this.de.src=this.Vn);try{await this.To({src:this.Nn(),srcset:this.Fn(),elNode:this.be}),this.we&&await this.de.remove(),this.appendChild(this.be);}catch{this.we&&await this.de?.remove(),this.appendChild(this.be);}});return}try{this.we&&(await this.To({src:this.Vn,elNode:this.de}),this.appendChild(this.de)),await this.To({src:this.Nn(),srcset:this.Fn(),elNode:this.be}),this.we&&await this.de?.remove(),this.appendChild(this.be);}catch{this.we&&await this.de?.remove(),this.appendChild(this.be);}}init(){this.Un?this.Tu():this.Eu();}};var fs=class extends Kr{static{a(this,"Img");}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:Bu}=on,Sa=a(o=>o,"i");var ka=a(o=>o.strings===void 0,"r"),Aa=a(()=>document.createComment(""),"s"),je=a((o,i,t)=>{let e=o.ge.parentNode,r=i===void 0?o.bt:i.ge;if(t===void 0){let s=e.insertBefore(Aa(),r),n=e.insertBefore(Aa(),r);t=new Bu(s,n,o,o.options);}else {let s=t.bt.nextSibling,n=t.f,l=n!==o;if(l){let c;t.Cu?.(o),t.f=o,t.Pi!==void 0&&(c=o.W)!==n.W&&t.Pi(c);}if(s!==r||l){let c=t.ge;for(;c!==s;){let u=Sa(c).nextSibling;Sa(e).insertBefore(c,r),c=u;}}}return t},"v"),le=a((o,i,t=o)=>(o.ce(i,t),o),"u"),Hu={},Ma=a((o,i=Hu)=>o.r=i,"p"),Ia=a(o=>o.r,"M"),jr=a(o=>{o.wt(),o.ge.remove();},"h");var Ei=a((o,i)=>{let t=o.le;if(t===void 0)return false;for(let e of t)e.Hs?.(i,false),Ei(e,i);return true},"s"),Gr=a(o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.le,t.delete(o),o=i;}while(t?.size===0)},"o"),Oa=a(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),Gu(i);}},"r");function Ku(o){this.le!==void 0?(Gr(this),this.f=o,Oa(this)):this.f=o;}a(Ku,"h");function ju(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++)Ei(e[s],false),Gr(e[s]);else e!=null&&(Ei(e,false),Gr(e));else Ei(this,o);}a(ju,"n");var Gu=a(o=>{o.type==$t.CHILD&&(o.Pi??=ju,o.Cu??=Ku);},"c"),qr=class extends Et{static{a(this,"f");}constructor(){super(...arguments),this.le=void 0;}Gr(i,t,e){super.Gr(i,t,e),Oa(this),this.isConnected=i.W;}Hs(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Ei(this,i),Gr(this));}setValue(i){if(ka(this.Gi))this.Gi.ce(i,this);else {let t=[...this.Gi.r];t[this.tu]=i,this.Gi.ce(t,this,0);}}disconnected(){}reconnected(){}};var A=a(()=>new gs,"e"),gs=class{static{a(this,"h");}},ms=new WeakMap,O=mt(class extends qr{render(o){return R}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)),R}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=ms.get(i);t===void 0&&(t=new WeakMap,ms.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"?ms.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 vs=null,Ci=class extends x{constructor(){super(...arguments);this.dialogEl=A();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=a(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);},"closeDialog");this.Su=()=>{this.closeDialog();};this.Au=t=>{this.xo=t.target;};this.ku=t=>{let e=t.target;e===this.dialogEl.value&&e===this.xo&&this.closeDialog();};this.oi=({id:t})=>{t===this.id?(vs=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._n=t=>{this.hide(),vs===this.id&&this.emit(M.MODAL_CLOSE,{modalId:vs,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{a(this,"Modal");}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(X.OPEN,this.oi),this.modalManager?.subscribe(X.CLOSE,this.si),this.modalManager?.subscribe(X.CLOSE_ALL,this._n);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.xo=void 0,this.modalManager?.unsubscribe(X.OPEN,this.oi),this.modalManager?.unsubscribe(X.CLOSE,this.si),this.modalManager?.unsubscribe(X.CLOSE_ALL,this._n);}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 y`<dialog ${O(this.Mu)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],Ci.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ci.prototype,"blockBodyScrolling",2);var Wr=class extends ${constructor(){super(...arguments);this.z=null;this.er=null;}static{a(this,"FormInput");}get Bn(){return this.nameAttrValue??this.ctxName}zn(){let t=document.createElement("input");return t.type="text",t.name=this.Bn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,$r(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.z=this.zn(),this.appendChild(this.z),this.sub("*collectionState",t=>{if(!t)return;if(!this.er){let n=document.createElement("div");this.appendChild(n),this.er=n;}if(!this.z){let n=this.zn();this.appendChild(n),this.z=n;}if(this.er.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 l=document.createElement("input");l.type="hidden",l.name=`${this.Bn}[]`,l.value=n,s.appendChild(l);}this.er.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],Wr.prototype,"nameAttrValue",2);var ys=class extends x{static{a(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<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 Ge=class extends x{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.oe=0;this.tr=A();this.Hn=()=>{let t=this.tr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.oe>0&&t.classList.add("uc-fake-progress--hidden");}};}static{a(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.oe=this.Eo(this.value),this.Co(),this.tr.value?.addEventListener("animationiteration",this.Hn);}updated(t){if(super.updated(t),t.has("value")){let e=this.Eo(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.Eo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.tr.value?.removeEventListener("animationiteration",this.Hn);}Eo(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 y`<div ${O(this.tr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],Ge.prototype,"hasFileName",2),h([b({type:Number})],Ge.prototype,"value",2),h([b({type:Boolean,reflect:true})],Ge.prototype,"visible",2);var xi=class extends ${constructor(){super();this.pe=false;this.Pt=0;this.init$={...this.init$,"*commonProgress":0};}static{a(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.So=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.pe=t;}),this.sub("*commonProgress",t=>{this.Pt=t;});}updated(t){super.updated(t),t.has("visible")&&(this.pe?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.So?.(),this.So=void 0;}render(){return y`<uc-progress-bar .value=${this.Pt} .visible=${this.pe}></uc-progress-bar>`}};h([g()],xi.prototype,"pe",2),h([g()],xi.prototype,"Pt",2);var qe=class extends x{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")));};}static{a(this,"Select");}render(){return y`<select @change=${this.Iu} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],qe.prototype,"value",2),h([b({type:Boolean,reflect:true})],qe.prototype,"disabled",2),h([b({type:Array,attribute:false})],qe.prototype,"options",2);var We=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ao="default";this.ko="";}static{a(this,"SourceBtn");}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 y`<button type="button" @click=${this.activate}><uc-icon name=${this.Ao}></uc-icon><div class="uc-txt">${this.l10n(this.ko)}</div></button>`}};h([b({attribute:false})],We.prototype,"source",2),h([g()],We.prototype,"Ao",2),h([g()],We.prototype,"ko",2);var Si=class extends ${constructor(){super(...arguments);this.Kn=[];this.je=[];this.wrap=false;}static{a(this,"SourceList");}initCallback(){super.initCallback(),this.subConfigValue("sourceList",e=>{this.Kn=Y(e),this.jn();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.jn()));}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}jn(){let e=this.i.pluginManager?.snapshot().sources??[],r=new Map(e.map(n=>[n.id,n])),s=[];this.Kn.forEach(n=>{let l=this.Pu(n,r);if(l.length!==1||l[0]!==n){for(let p of l){let d=r.get(p);d&&s.push(this.Gn(d));}return}let u=r.get(n);u&&s.push(this.Gn(u));}),this.je=s;}Pu(t,e){let r=e.get(t);return r?.expand?r.expand():[t]}Gn(t){return {id:t.id,label:t.label,icon:t.icon,onClick:a(()=>t.onSelect(),"onClick")}}render(){return y`${this.je.map(t=>y`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};h([g()],Si.prototype,"je",2),h([b({type:Boolean,attribute:"wrap",noAccessor:true})],Si.prototype,"wrap",2);var bs=class extends x{static{a(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var Ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ce(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:a(()=>{i.naturalWidth===0&&(i.src=Ot);},"cancel")}}a(Ce,"preloadImage");function Ai(o){let i=[];for(let s of o){let n=Ce(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:a(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}a(Ai,"batchPreloadImages");function ws(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,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),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(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p);});},r.onerror=c=>{l(c);};});return r.src=URL.createObjectURL(o),s}a(ws,"generateThumb");var Ze=class extends ${constructor(){super(...arguments);this.ir=new Set;this.entry=null;}static{a(this,"FileItemConfig");}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 l=r.subscribe(s,c=>{this.isConnected&&n(c);});this.ir.add(l);})(t,e);}reset(){for(let t of this.ir)t();this.ir=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.ir=new Set;}};function qu(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}a(qu,"createSvgBlobUrl");function Zr(o="hsl(209, 21%, 65%)",i=32,t=32){return qu(`<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>`)}a(Zr,"fileCssBg");var Wu=3e3,Ye=class extends Ze{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Pe="";this.qn=false;this.rr=null;this.Wn=false;this.Lu=this.cfg.filesViewMode;this.Zn=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.Ru(e);if(r&&s&&n){let p=await this.proxyUrl(Z(Jt(this.cfg.cdnCname,n),ot(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=Ce(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let f=t.getValue("file");if(!f)return;let m=await ws(f,c);t.setValue("thumbUrl",m);}catch(f){this.telemetryManager.sendEventError(f,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(m));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await ws(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(p));}});this.or=D(this.Zn.bind(this),100);}static{a(this,"Thumb");}Ru(t=false){t&&(this.rr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.rr?.height||0),10),parseInt(String(this?.rr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,Wu)}Uu(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let l=a(()=>{n&&(n.onload=null,n.onerror=null,n.src=Ot,e?.removeEventListener("abort",c),n=null);},"cleanup"),c=a(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=a(()=>{l(),r();},"resolveSafe"),p=a(d=>{l(),s(d);},"rejectSafe");if(typeof n.decode=="function"){n.src=t,n.decode().then(u).catch(p);return}n.onload=u,n.onerror=p,n.src=t;})}Io(){this.Mo?.cancel(),this.Mo=void 0;}$u(t){if(this.Io(),!t){this.Pe&&(this.Pe="");return}if(t===this.Pe)return;let e=new AbortController,r={controller:e,cancel:a(()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);},"cancel")};this.Mo=r,this.Uu(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Pe=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}sr(t=false){if(this.entry){if(t){this.Zn(true);return}this.Wn&&this.or();}}firstUpdated(t){super.firstUpdated(t),this.Yn();}updated(t){super.updated(t),t.has("uid")&&this.Yn();}ni(t){let[e]=t;e&&(this.Wn=e.isIntersecting,e.isIntersecting&&(this.rr=e.boundingClientRect,this.sr(),this.s?.disconnect()),e.intersectionRatio===0&&this.or.cancel());}reset(){super.reset(),this.or.cancel(),this.Io(),this.Pe&&(this.Pe="");}Yn(){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=a(()=>{this.sr();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.$u(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.sr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.qn&&(this.Lu==="list"&&this.sr(true),this.qn=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.or.cancel(),this.Io(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Pe||Ot} role="img" alt="Preview of uploaded image" ?hidden=${!this.Pe} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],Ye.prototype,"badgeIcon",2),h([b({attribute:false})],Ye.prototype,"uid",2),h([g()],Ye.prototype,"Pe",2);var Ts=class extends S{static{a(this,"ActivityHeader");}};var Es=class extends S{constructor(){super(...arguments);this.historyTracked=true;this.activityType=S.activities.START_FROM;}static{a(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var Cs=class extends ${constructor(){super(...arguments);this.Xn=null;}static{a(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=M;}initCallback(){super.initCallback(),this.Xn=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.Xn?.();}};var Xe=a((o,i)=>{let t=false,e,r=0,s=a(((...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);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:a(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var La=a((o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},"u"),ki=mt(class extends Et{constructor(o){if(super(o),o.type!==$t.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 l of o)r[n]=e?e(l,n):n,s[n]=t(l,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=Ia(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let l=this.ut??=[],c=[],u,p,d=0,f=r.length-1,m=0,v=s.length-1;for(;d<=f&&m<=v;)if(r[d]===null)d++;else if(r[f]===null)f--;else if(l[d]===n[m])c[m]=le(r[d],s[m]),d++,m++;else if(l[f]===n[v])c[v]=le(r[f],s[v]),f--,v--;else if(l[d]===n[v])c[v]=le(r[d],s[v]),je(o,c[v+1],r[d]),d++,v--;else if(l[f]===n[m])c[m]=le(r[f],s[m]),je(o,r[d],r[f]),f--,m++;else if(u===void 0&&(u=La(n,m,v),p=La(l,d,f)),u.has(l[d]))if(u.has(l[f])){let w=p.get(n[m]),T=w!==void 0?r[w]:null;if(T===null){let C=je(o,r[d]);le(C,s[m]),c[m]=C;}else c[m]=le(T,s[m]),je(o,r[d],T),r[w]=null;m++;}else jr(r[f]),f--;else jr(r[d]),d++;for(;m<=v;){let w=je(o,c[v+1]);le(w,s[m]),c[m++]=w;}for(;d<=f;){let w=r[d++];w!==null&&jr(w);}return this.ut=n,Ma(o,c),rt}});var Q=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")}),q=class q extends Ze{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Qn=true;this.uid="";this.Oo="";this.Po="";this.Lo="";this.oe=0;this.Jn=false;this.Ro="";this.ea=false;this.ta=false;this.ia=false;this.ra=false;this.nr=false;this.oa="";this.ar=[];this.sa=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.na();};this.S=D(()=>this.aa(),100);this.Vu=this.withEntry(Xe((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),l=e===Q.FINISHED,c=e===Q.UPLOADING,u=e===Q.QUEUED_UPLOADING,p=e===Q.QUEUED_VALIDATION,d=e===Q.VALIDATION,f=t.getValue("fileName"),m="";r?m="":!l&&n&&s&&Object.values(xt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.Lo=m,this.Po=r,this.Jn=c||u||p||d,this.oe=p||d?0:t.getValue("uploadProgress"),this.oa=f?this.l10n("a11y-file-item-status",{fileName:f,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.na=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=a(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File||l instanceof Blob){let f=(this.i.pluginManager?.snapshot().fileHooks??[]).filter(m=>m.type==="beforeUpload");for(let m of f)try{let{file:v}=await m.handler({file:l});v!==l&&(l=v,t.setValue("mimeType",l.type||null),t.setValue("isImage",$e(l)),t.setValue("fileSize",l.size),l instanceof File&&t.setValue("fileName",l.name));}catch(v){this.debugPrint(`File hook "beforeUpload" from plugin "${m.pluginId}" failed`,v);}}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:a(d=>{if(d.isComputable){let f=d.value*100;t.setValue("uploadProgress",f);}},"onProgress"),signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),Bo(c,p)},"uploadTask"),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 ee&&r.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof ve?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");}}});}static{a(this,"FileItem");}aa(){let t=this.entry;if(!t)return;let e=Q.IDLE;t.getValue("errors").length>0?e=Q.FAILED:t.getValue("isQueuedForUploading")?e=Q.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=Q.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=Q.VALIDATION:t.getValue("isUploading")?e=Q.UPLOADING:t.getValue("fileInfo")&&(e=Q.FINISHED),this.Nu(t,e);}Nu(t,e){e===Q.FAILED?this.Ro="badge-error":e===Q.FINISHED&&(this.Ro="badge-success"),e===Q.UPLOADING&&(this.ra=false,this.removeAttribute("focused")),this.ta=e===Q.FAILED,this.ia=e===Q.UPLOADING,this.ea=e===Q.FINISHED,this.Vu(e);}reset(){super.reset(),this.S.cancel();}ni(t){let[e]=t;e&&e.isIntersecting&&!this.sa&&(this.Qn=false,this.sa=true);}la(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.aa(),this.Ye();}ca(t){if(this.cfg.filesViewMode==="list"){this.nr=true;return}this.nr=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.la(this.uid);}Ye(){let t=this.i.pluginManager;if(!t||!this.uid){this.ar=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.ar=[];return}this.ar=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.la(this.uid),this.subConfigValue("filesViewMode",e=>{this.ca(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.ca(e);}),this.onclick=()=>{q.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.na());});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Ye())),this.Ye(),q.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(),q.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.Qn?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.ea} ?data-uploading=${this.ia} ?data-failed=${this.ta} ?data-focused=${this.ra} ><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.oa}><span class="uc-file-name" ?hidden=${!this.nr}>${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.ar.map(t=>y`<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.Jn} ?hasFileName=${this.nr}></uc-progress-bar></div>`}};h([g()],q.prototype,"Qn",2),h([b({attribute:false})],q.prototype,"uid",2),h([g()],q.prototype,"Oo",2),h([g()],q.prototype,"Po",2),h([g()],q.prototype,"Lo",2),h([g()],q.prototype,"oe",2),h([g()],q.prototype,"Jn",2),h([g()],q.prototype,"Ro",2),h([g()],q.prototype,"ea",2),h([g()],q.prototype,"ta",2),h([g()],q.prototype,"ia",2),h([g()],q.prototype,"ra",2),h([g()],q.prototype,"nr",2),h([g()],q.prototype,"oa",2),h([g()],q.prototype,"ar",2);var xs=q;function Zu(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=a(r=>{r.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}a(Zu,"checkIsDirectory");function Yu(o,i){return new Promise(t=>{let e=0,r=[],s=a(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(r);})):l.isDirectory&&n(l.createReader());},"readEntry"),n=a(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(r);});},"readReaderContent");s(o);})}a(Yu,"readEntryContentAsync");function Pa(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 c=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();c&&t.push(Yu(c,s).then(u=>{u&&i.push(...u);}));continue}let l=r.getAsFile();l&&t.push(Zu(l).then(c=>{c||i.push({type:"file",file:l});}));}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)}a(Pa,"getDropItems");var at=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Ua=["focus"],Xu=100,Ss=new Map;function Qu(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))}a(Qu,"distance");function As(o){let i=0,t=document.body,e=new Set,r=a(v=>{e.add(v);},"handleSwitch"),s=at.INACTIVE,n=a(v=>{o.shouldIgnore()&&v!==at.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=a(()=>i>0,"isDragging");r(v=>o.onChange(v));let c=a(()=>{i=0,n(at.INACTIVE);},"onResetEvent"),u=a(()=>{i+=1,s===at.INACTIVE&&n(at.ACTIVE);},"onDragEnter"),p=a(()=>{i-=1,l()||n(at.INACTIVE);},"onDragLeave"),d=a(v=>{v.preventDefault(),i=0,n(at.INACTIVE);},"onDrop"),f=a(v=>{if(o.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],T=o.element.getBoundingClientRect(),C=Math.floor(Qu(w,T)),E=C<Xu,k=v.composedPath().includes(o.element);Ss.set(o.element,C);let wt=Math.min(...Ss.values())===C;k&&wt?(v.preventDefault(),n(at.OVER)):n(E&&wt?at.NEAR:at.ACTIVE);},"onDragOver"),m=a(async v=>{if(o.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let T=await Pa(w);o.onItems(T),n(at.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),o.element.addEventListener("drop",m),Ua.forEach(v=>{window.addEventListener(v,c);}),()=>{Ss.delete(o.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),o.element.removeEventListener("drop",m),Ua.forEach(v=>{window.removeEventListener(v,c);});}}a(As,"addDropzone");var ks=new Set,vt=class extends ${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.Me=true;this.ua=true;this.da=null;this.Uo=null;this.pa=A();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.ha=true;this.Rt=false;}static{a(this,"DropArea");}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.Me)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(),ks.add(this),this.$o(),this.Do(),this.fa(),this.ma(at.INACTIVE),this.da=As({element:this,shouldIgnore:a(()=>this.ga(),"shouldIgnore"),onChange:a(t=>{this.ma(t);},"onChange"),onItems:a(t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:_.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:_.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.set$({"*currentActivity":S.activities.UPLOAD_LIST}),this.modalManager?.open(S.activities.UPLOAD_LIST)));},"onItems")}),this.updateComplete.then(()=>this.zu()),this.subConfigValue("sourceList",t=>{let e=Y(t);this.ha=e.includes(_.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.fa();}ga(){if(!this.Me||!this.Hu())return true;if(!this.fullscreen)return false;let t=ks;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.ha&&!this.disabled;this.Me=t;}Do(){let t=this.Me||!this.querySelector("[data-default-slot]");this.ua=t,this.hidden=!t;}ma(t){let e=Object.entries(at).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}zu(){if(this.Uo)return;let t=this.pa.value;t&&(this.Uo=As({element:t,onChange:a(e=>{let r=Object.entries(at).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},"onChange"),onItems:a(()=>{},"onItems"),shouldIgnore:a(()=>this.ga(),"shouldIgnore")}));}fa(){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(),ks.delete(this),this.da?.(),this.Uo?.(),this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${O(this.pa)} class="uc-content-wrapper" ?hidden=${!this.ua}><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>`)} `}};h([b({type:Boolean,noAccessor:true})],vt.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],vt.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],vt.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],vt.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],vt.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],vt.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],vt.prototype,"initflow",2),h([b({type:String})],vt.prototype,"text",2),h([g()],vt.prototype,"Me",2),h([g()],vt.prototype,"ua",2);var Lt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=S.activities.UPLOAD_LIST;this.va=false;this.ya=false;this.ba=false;this.Fo=false;this.No=false;this.lr=null;this.wa=false;this.Vo=null;this.Ta=()=>{this.telemetryManager.sendEvent({eventType:F.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.xe=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Te=Xe(()=>{this.isConnected&&(this.Gu(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{a(this,"UploadList");}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(m=>m.isValidationPending).length},r=!t.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=t.errors.some(m=>m.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(m=>m.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&c&&this.cfg.confirmUpload)u=true;else {p=true;let m=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&r&&c&&m;}this.va=p,this.ya=d,this.ba=u,this.No=e.total===0||!s&&!n,this.Fo=!n||this.cfg.multiple,this.wa=e.total>0,this.Vo=e;}ju(t){let e=a(r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})},"localizedText");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.lr=null;return}this.lr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Te),this.uploadCollection.unobserveCollection(this.Te));}render(){return y`<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.wa}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${ki(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Ta} ?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.lr} >${this.lr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.xe}>${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.Ta} ><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.ba} @click=${this._o} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.va} ?disabled=${!this.ya} @click=${this.Bo} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Lt.prototype,"va",2),h([g()],Lt.prototype,"ya",2),h([g()],Lt.prototype,"ba",2),h([g()],Lt.prototype,"Fo",2),h([g()],Lt.prototype,"No",2),h([g()],Lt.prototype,"lr",2),h([g()],Lt.prototype,"wa",2),h([g()],Lt.prototype,"Vo",2);var Ju=[{test:a(o=>!!o.accept&&!!o.imgOnly,"test"),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:a(o=>o.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:a(o=>o.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Ra=D(o=>{for(let{test:i,message:t}of Ju)i(o)&&Fr(t);},0);var $a=a((o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),td="0123456789abcdefghijklmnopqrstuvwxyz",Da=a(o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=td[Number(t)]+i,o=o/36n;}return i},"a"),Ms=a((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var ed=a(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}`)},"c"),id=10,rd=a(async o=>{let i=await ed(o);return Da(i).slice(0,id)},"d"),Fa=a(async(o,i)=>{let t=await rd(o);return $a(t,i)},"f");var Va=a(o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function"),"isPromiseLike");var Is=a(o=>o,"defineComputedProperty"),od=[Is({key:"cameraModes",deps:["enableVideoRecording"],fn:a(({cameraModes:o,enableVideoRecording:i})=>{let t=i();if(t===null)return o();let e=j(o());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(r=>r!=="video")),Ht(e)},"fn")}),Is({key:"cameraModes",deps:["defaultCameraMode"],fn:a(({cameraModes:o,defaultCameraMode:i})=>{let t=i();if(t===null)return o();let e=j(o());return e=e.sort((r,s)=>r===t?-1:s===t?1:0),Ht(e)},"fn")}),Is({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:a(({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===hi||Ms(r,s))?Fa(e,s):r},"fn")})],Na=a(({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of od){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let c of r.deps)s[c]=()=>t(c);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let l;try{l=r.fn(s,{signal:n.signal});}catch(c){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,c);return}Va(l)?l.then(c=>{n.signal.aborted||i(r.key,c);}).catch(c=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,c);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,l);}},"computeProperty");var N=a(o=>String(o),"asString"),et=a(o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},"asNumber"),B=a(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}"`)},"asBoolean"),_a=a(o=>o==="auto"?o:B(o),"asStore"),za=a(o=>{let i=N(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),Ba=a(o=>{let i=N(o);if(!Object.values(U).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),Ha=a(o=>{let i=N(o),t=j(i);if(t.some(e=>!Object.values(U).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),Ka=a(o=>{let i=N(o);if(i==="local"||i==="global")return i;if(B(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},"asPasteScope"),ja=a(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.")},"asMetadata"),Os=a(o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},"asObject"),Yr=a(o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},"asFunction"),Xr=a(o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},"asArray"),Ga=a(o=>{let i=N(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode");var sd={pubkey:N,multiple:B,multipleMin:et,multipleMax:et,confirmUpload:B,imgOnly:B,accept:N,externalSourcesPreferredTypes:N,externalSourcesEmbedCss:N,store:_a,cameraMirror:B,cameraCapture:za,sourceList:N,topLevelOrigin:N,maxLocalFileSizeBytes:et,thumbSize:et,showEmptyList:B,useLocalImageEditor:B,useCloudImageEditor:B,cloudImageEditorTabs:N,removeCopyright:B,cropPreset:N,imageShrink:N,modalScrollLock:B,modalBackdropStrokes:B,sourceListWrap:B,remoteTabSessionKey:N,cdnCname:N,cdnCnamePrefixed:N,baseUrl:N,socialBaseUrl:N,secureSignature:N,secureExpire:N,secureDeliveryProxy:N,retryThrottledRequestMaxTimes:et,retryNetworkErrorMaxTimes:et,multipartMinFileSize:et,multipartChunkSize:et,maxConcurrentRequests:et,multipartMaxConcurrentRequests:et,multipartMaxAttempts:et,checkForUrlDuplicates:B,saveUrlForRecurrentUploads:B,groupOutput:B,userAgentIntegration:N,debug:B,localeName:N,metadata:ja,secureUploadsExpireThreshold:et,localeDefinitionOverride:a(o=>Os(o),"localeDefinitionOverride"),secureUploadsSignatureResolver:a(o=>Yr(o),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:a(o=>Yr(o),"secureDeliveryProxyUrlResolver"),iconHrefResolver:a(o=>Yr(o),"iconHrefResolver"),plugins:a(o=>Xr(o),"plugins"),fileValidators:Xr,collectionValidators:Xr,validationTimeout:et,validationConcurrency:et,cameraModes:Ha,defaultCameraMode:Ba,enableAudioRecording:B,enableVideoRecording:B,mediaRecorderOptions:Os,maxVideoRecordingDuration:et,filesViewMode:Ga,gridShowFileNames:B,cloudImageEditorAutoOpen:B,cloudImageEditorMaskHref:N,testMode:B,qualityInsights:B,pasteScope:Ka},qa=a((o,i)=>{if(!(typeof i>"u"||i===null))try{return sd[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),tt[o]}},"normalizeConfigValue");var Qr=[...new Set(["debug",...Object.keys(tt)])],nd=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Za=a(o=>nd.includes(o),"isComplexKey"),Ps=Qr.filter(o=>!Za(o)),Ls={...Object.fromEntries(Ps.map(o=>[ur(o),o])),...Object.fromEntries(Ps.map(o=>[o.toLowerCase(),o]))},Wa=a(o=>`__${o}`,"getLocalPropName"),Qe=class extends x{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(tt).map(([t,e])=>[L(t),e]))};this.qu=new Map;this.ur={};this.xa=new Set;this.Ut=new Map;}static{a(this,"Config");}zo(t){return this.xa.has(t)}Ea(t){let e=this.i.pluginManager;if(e)return e.configRegistry.get(t)}Ca(t){return [...new Set([ur(t),t.toLowerCase()])]}Wu(t,e){if(Za(t)||this.zo(t)&&this.Ea(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=L(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=tt[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}Xe(t,e){let r;this.zo(t)?r=this.Ea(t)?.normalize?.(e)??e:r=qa(t,e);let s=this,n=Wa(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)||Ra(this.cfg));}dr(t){let e=this,r=Wa(t);return e[r]??this.$[L(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.ur={},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 l=L(r);if(s.attribute){let u=this.Ca(r);for(let p of u)this.ur[p]=r;}this.sharedCtx.has(l)||this.sharedCtx.add(l,s.defaultValue);let c=Object.getOwnPropertyDescriptor(this,r);if((!c||!c.set||!c.get)&&Object.defineProperty(this,r,{set:a(u=>{this.Xe(r,u);},"set"),get:a(()=>this.dr(r),"get"),enumerable:true,configurable:true}),!this.Ut.has(r)){let u=this.sub(l,p=>{this.Xe(r,p);},false);this.Ut.set(r,u);}}}Xu(){this.i.when("pluginManager",t=>{this.Sa(t),this.cr=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 Ls)continue;r in this.ur&&this.attributeChangedCallback(r,s??"",n??"");}}),this.ai.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Xu(),this.Qu();for(let r of Ps)this.sub(L(r),s=>{this.Xe(r,s);},false);for(let r of Qr){let s=t[r]??this.$[L(r)];s!==tt[r]&&this.Xe(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a(l=>{this.Xe(r,l);},"set"),get:a(()=>this.dr(r),"get")});}let e=a(r=>{Na({key:r,setValue:this.Xe.bind(this),getValue:this.dr.bind(this),computationControllers:this.qu});},"runComputeProperty");for(let r of Qr)this.sub(L(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ls[t];n?s[n]=r:this.i.when("pluginManager",l=>{if(this.getAttribute(t)!==r)return;let c=this.ur[t],u=c?l.configRegistry.get(c):void 0;if(c&&u){let p=u.fromAttribute?u.fromAttribute(r):r;if(this.dr(c)===p)return;this.Xe(c,p);}});}disconnectedCallback(){super.disconnectedCallback(),this.cr&&(this.cr(),this.cr=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(Ls);return [...t,...e]}};for(let o of Qr)Qe.prototype[o]=void 0;var Mi=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.Aa="upload-file";this.Ju=()=>{this.api.initFlow();};}static{a(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.Aa=t?"upload-files":"upload-file";});}render(){return y`<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>`}};h([b({attribute:"dropzone",type:Boolean})],Mi.prototype,"dropzone",2),h([g()],Mi.prototype,"Aa",2);var Ii=class extends S{constructor(){super(...arguments);this.Ko=A();}static{a(this,"PluginActivityHost");}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.kn()||this.registerActivity(this.activityType??"",{onActivate:a(()=>this.Ma(),"onActivate"),onDeactivate:a(()=>this.pr(),"onDeactivate")}));}async Ma(){await this.updateComplete;let t=this.Ko.value;if(!t||!this.registration)return;this.pr();let e=this.$["*currentActivityParams"];this.Ho=this.registration.render(t,e)??void 0;}pr(){let t=this.Ko.value;t&&(this.Ho?.(),this.Ho=void 0,t.replaceChildren());}disconnectedCallback(){this.pr(),super.disconnectedCallback();}render(){return y`<div style="display: flex; flex-direction: column; width: 100%; min-height: 0;" ${O(this.Ko)} ></div>`}};h([b({attribute:false})],Ii.prototype,"registration",2);var Je=class extends x{constructor(){super(...arguments);this.mode="modal";this.ve=[];}static{a(this,"PluginActivityRenderer");}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.ve=[];return}this.ve=t.snapshot().activities;}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?y`${ki(this.ve,t=>t.id,t=>y`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:y`${ki(this.ve,t=>t.id,t=>y`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};h([b({type:String})],Je.prototype,"mode",2),h([g()],Je.prototype,"ve",2);function Oi(o,i,t){return o?i(o):t?.(o)}a(Oi,"n");function Ya(...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},{})}a(Ya,"normalize");function yt(...o){let i=Ya(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}a(yt,"classNames");function Xa(o,...i){let t=Ya(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}a(Xa,"applyClassNames");var ad=a(o=>st.includes(o),"isTabIdValue"),Qa=a(o=>{if(!o)return st;let i=j(o).filter(ad);return i.length===0?st:i},"parseTabs");function Ja(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":st,"*tabId":H.CROP,"*on.retryNetwork":a(()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ot,t.src=e;}o.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":a(i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=ot(te(i),"preview"),r=Z(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.apply"),"*on.cancel":a(()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}a(Ja,"initState");var tl="<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 xe={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ti=class extends x{constructor(){super(...arguments);this.pe=false;this.Oa=xe;this.Pa=xe.visible;this.La=xe.hidden;this.jo=false;this.Ra=false;}static{a(this,"PresenceToggle");}set visible(t){this.pe=t,this.Ua();}get visible(){return this.pe}set styles(t){this.Oa=t,this.jo=true,this.Pa=t.visible??xe.visible,this.La=t.hidden??xe.hidden;}get styles(){return this.Oa}Ua(){this.style.visibility=this.pe?"inherit":"hidden",Xa(this,{[xe.transition]:!this.jo,[this.Pa]:this.pe,[this.La]:!this.pe}),this.toggleAttribute("inert",!this.pe);}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.jo||this.classList.add(xe.transition),this.Ua(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.ed();},0);}};h([b({type:Boolean})],ti.prototype,"visible",1),h([b({attribute:false})],ti.prototype,"styles",1);var Li=class extends x{constructor(){super(...arguments);this.active=false;this.Qe=A();this.Go=false;this.qo=()=>{let t=this.Qe.value;t&&(this.$a(t),this.Go&&this.active&&this.Wo());};}static{a(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.Wo();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Wo():this.td());}Wo(){let t=this.Qe.value;if(!t)return;this.Go=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.qo),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.qo,{once:true});}td(){let t=this.Qe.value;t&&(this.Go=false,t.removeEventListener("transitionend",this.qo),this.$a(t));}$a(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${O(this.Qe)}></div></div>`}};h([b({type:Boolean,reflect:true})],Li.prototype,"active",2);var ce=mt(class extends Et{constructor(o){if(super(o),o.type!==$t.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 rt}});var W=a(o=>o??R,"o");var St=class extends x{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{a(this,"BtnUi");}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.Zo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.od}}get Zo(){return !this.icon}get od(){return !this.text&&!this.Zo}render(){return y`<button type="button" role=${W(this.ariaRole||void 0)} aria-controls=${W(this.ariaControls||void 0)} aria-label=${W(this.l10n(this.titleProp))} title=${W(this.l10n(this.titleProp))} ><uc-icon class=${ce(this.rd)} name=${W(this.icon||void 0)} ?hidden=${this.Zo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],St.prototype,"text",2),h([b({type:String})],St.prototype,"icon",2),h([b({type:Boolean,reflect:true})],St.prototype,"reverse",2),h([b({type:String,reflect:true})],St.prototype,"theme",2),h([b({attribute:"aria-role"})],St.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],St.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],St.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],St.prototype,"active",2);function el(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}a(el,"pick");function ei(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return Z(o,ot(ar,te(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Ut}/${Rt}/uc-cloud-image-editor/`))}a(ei,"viewerImageSrc");var Pi=class extends x{constructor(){super(...arguments);this.Na=`uc-backdrop-mask-${ht.generateFastUid()}`;this.fr=false;this.di=false;this.Ba=A();this.pi=false;this.hi=null;this.Ha=t=>{this.Ka(),this.fi&&(t.stopPropagation(),t.preventDefault(),this.fi=false);};this.ja=t=>{if(!this.fi||!this.hr||!this.Xo)return;t.stopPropagation(),t.preventDefault();let e=this.Le;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,l=t.y-s,c=n-this.hr[0],u=l-this.hr[1],{direction:p}=this.Xo,d=this.hd(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.Ga=t=>{if(!this.Ee)return;let e=Object.values(this.Ee).find(r=>{if(!r||this.Jo(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),l={x:n.x,y:n.y,width:n.width,height:n.height};return ma(l,[t.x,t.y])});this.Va=e,this.Ka();};}static{a(this,"CropFrame");}get Le(){return this.Ba.value??null}get fi(){return this.di}set fi(t){this.di!==t&&(this.di=t,this.Qo());}Qo(){this.ci&&this.ci.setAttribute("class",yt({"uc-guides--hidden":this.fr,"uc-guides--visible":!this.fr&&this.di,"uc-guides--semi-hidden":!this.fr&&!this.di}));}Jo(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,l=this.Le;if(!l)return;let c=gt("mask",{id:this.Na}),u=gt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=gt("rect",{x:e,y:r,width:s,height:n,fill:"black"});c.appendChild(u),c.appendChild(p);let d=gt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.Na})`});l.appendChild(d),l.appendChild(c),this.li=c,this.Yo=p;}nd(){this.li&&(this.li.style.display="none",window.requestAnimationFrame(()=>{this.li&&(this.li.style.display="block");}));}ad(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.Yo&&se(this.Yo,{x:e,y:r,width:s,height:n});}ld(){let t=this.$["*cropBox"];if(!(!t||!this.ci||!this.Ee)){for(let e of Object.values(this.Ee)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:l}=e,c=r==="",u=r.length===2,{x:p,y:d,width:f,height:m}=t;if(c)se(n,{x:p,y:d,width:f,height:m});else {let w=ne(Math.min(f,m)/82/2,0,1),T=u?ua(t,r,w):da(t,r,w),C=T.center;if(!C)continue;let E=Math.max(ls*ne(Math.min(f,m)/ls/3,0,1),ca);se(n,{x:C[0]-E,y:C[1]-E,width:E*2,height:E*2}),se(s,{d:T.d});}let v=this.Jo(r);l.setAttribute("class",yt("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}se(this.ci,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}za(t,e){let r=gt("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=gt("rect",{fill:"transparent"}),n=gt("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=gt("svg"),e=gt("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=gt("line",{x1:`${wi*r}%`,y1:"0%",x2:`${wi*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=gt("line",{x1:"0%",y1:`${wi*r}%`,x2:"100%",y2:`${wi*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.Le;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.Ee=s,this.ci=r,this.Qo();}cd(t,e){if(!this.Ee)return;let r=this.Ee[t];if(!r||this.Jo(t))return;let s=this.$["*cropBox"],n=this.Le;if(!n)return;let{x:l,y:c}=n.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.fi=true,this.Xo=r,this.hr=[u,p],this._a={...s};}hd(t,e){let[r,s]=e,n=this.$["*imageBox"],l=this._a??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=ha({rect:l,delta:[r,s],imageBox:n}):l=fa({rect:l,delta:[r,s],direction:t,aspectRatio:u,imageBox:n}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return _e(Be(l),n)}Ka(){let t=this.Va,e=this.Le;e&&(e.style.cursor=t?pa(t.direction):"initial");}qa(t){if(this.ui){this.ui.setAttribute("href",t);return}let e=this.Le;if(!e){this.hi=t;return}this.hi=null;let r=document.createDocumentFragment(),s=gt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.ui=s;}fd(){let t=this.$["*cropBox"];if(!t||!this.ui)return;let{x:e,y:r,width:s,height:n}=t;se(this.ui,{x:e,y:r,height:n,width:s});}es(){this.pi&&(this.ad(),this.ld(),this.fd());}toggleThumbs(t){if(this.Ee)for(let e of Object.values(this.Ee)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",yt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.nd(),this.pi&&window.requestAnimationFrame(()=>{this.es();});}),this.sub("*cropBox",t=>{t&&(this.fr=t.height<=I||t.width<=I,this.Qo(),this.pi&&window.requestAnimationFrame(()=>{this.es();}));}),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.Le;if(!(!t||this.pi)){if(this.sd(),this.pd(),this.pi=true,t.addEventListener("pointermove",this.Ga,true),this.hi){let e=this.hi;this.hi=null,this.qa(e);}this.es();}}disconnectedCallback(){super.disconnectedCallback(),this.Le?.removeEventListener("pointermove",this.Ga,true),document.removeEventListener("pointermove",this.ja,true),document.removeEventListener("pointerup",this.Ha,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${O(this.Ba)}></svg>`}};h([g()],Pi.prototype,"di",2);function cd(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}a(cd,"validateCrop");var Ui=class extends x{constructor(){super();this.ctxOwner=true;this.Je={width:0,height:0};this.e=null;this._=false;this.se=null;this.Za=A();this.rs=A();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=D(this.Ya.bind(this),300),this.ts=Xe(()=>{!this.isConnected||!this._||(this.os(),this.Xa(),this.Qa(),this.ss(),this.ns());},100);}static{a(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.os();}Xa(){let t=this.$["*editorTransformations"],e=el(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}os(){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.he=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},l=ze({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>n.width-e*2||l.height>n.height-e*2){let u=l.width/l.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,f=d/u,m=0+e,v=e+(n.height-e*2)/2-f/2;c={x:m,y:v,width:d,height:f};}else {let d=n.height-e*2,f=d*u,m=e+(n.width-e*2)/2-f/2,v=0+e;c={x:m,y:v,width:f,height:d};}}else {let{width:u,height:p}=l,d=e+(n.width-e*2)/2-u/2,f=e+(n.height-e*2)/2-p/2;c={x:d,y:f,width:u,height:p};}this.$["*imageBox"]=Be(c);}ss(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(n){let{dimensions:[f,m],coords:[v,w]}=n,{width:T}=ze(this.Je,s),C=l/T;t=_e(Be({x:c+v*C,y:u+w*C,width:f*C,height:m*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!ga(t,e)||d&&!va(t,d)){let f=e.width/e.height,m=e.width,v=e.height;d&&(f>d?m=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-v/2,width:m,height:v};}this.$["*cropBox"]=_e(Be(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:l,rotate:c}=s,u=ze({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}ns(){if(!this._||!this.se||!this.he||!this.e)return;let t=this.he;this.e.clearRect(0,0,t.width,t.height),this.gd();}vd({fromViewer:t}){this.se&&(this.rs.value?.toggleThumbs(true),this.yd(),setTimeout(()=>{this.className=yt({"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:l}=e,{width:c,height:u}=ze(this.Je,s),{width:p,height:d}=t,f=n/c,m=l/u;return [ne(Math.round(p/f),1,c),ne(Math.round(d/m),1,u)]}bd(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l,x:c,y:u}=e,{width:p,height:d}=ze(this.Je,s),{x:f,y:m}=t,v=n/p,w=l/d,T=this.Ja(),C={dimensions:T,coords:[ne(Math.round((f-c)/v),0,p-T[0]),ne(Math.round((m-u)/w),0,d-T[1])]};if(!cd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(T[0]===p&&T[1]===d))return C}Ya(){if(!this.isConnected||!this.Je)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.bd(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.Qa(),this.ss(),this.ns());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.os(),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.ts(),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.ts();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.Ya(),this._=false,this.Td(),this.className=yt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.rs.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),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-l)/n}px, ${(this.offsetHeight/2-c)/n}px)`,this.style.transformOrigin=`${l}px ${c}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(ei(t,r,e)),{promise:n,cancel:l,image:c}=Ce(s),u=this.$t(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,n.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}$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.ns();}),this.sub("*cropBox",()=>{this.se&&this.Wa();}),this.sub("*currentAspectRatio",()=>{this.ss();}),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 y`<canvas class="uc-canvas" ${O(this.Za)}></canvas><uc-crop-frame ${O(this.rs)}></uc-crop-frame>`}};h([g()],Ui.prototype,"se",2);function Us(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}a(Us,"linspace");function ud(o){return typeof o=="string"&&o in Mt}a(ud,"isOperationKey");function dd(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}a(dd,"splitBySections");function pd(o,i,t){let e=dd(o).find(([n,l])=>n<=i&&i<=l);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let l=Math.abs(r-s)||1,c=Math.abs(i-r)/l;return r===n?i>t?1:1-c:s===n?i>=t?c:1:0})}a(pd,"calculateOpacities");function hd(o,i){return o.map((t,e)=>t<i?o.length-e:e)}a(hd,"calculateZIndices");function il(o,i){let t=Mt[o].keypointsNumber,{range:e,zero:r}=Mt[o];return [...new Set([...Us(e[0],r,t+1),...Us(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}a(il,"keypointsRange");var Jr=class extends x{constructor(){super();this._=false;this.as=true;this.n="initial";this.il={};this.Re=[];this.ol=0;this.nl=A();this.mr=A();this.classList.add("uc-inactive_to_cropper"),this.sl=D(async(t,e,r)=>{let s=a(()=>!this.al(t,e)||this.Pt!==r||!!this.Re.find(u=>u.value===r),"shouldSkip");if(s())return;let n=await this.ll(t,r),l=new Image;l.src=n.src;let c=this.$t(n.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),n.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.Re,p=u.findIndex(v=>v.value>r);p===-1&&(p=u.length);let f=u[p]?.image,m=this.mr.value;!m||f&&!m.contains(f)||(u.splice(p,0,n),f?m.insertBefore(l,f):m.appendChild(l),this.us(t,r));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{a(this,"EditorImageFader");}$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.Re){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.g??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 l=this.offsetWidth;return this.proxyUrl(ei(t,l,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.g===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!ud(this.n)||!Number.isFinite(e)||(this.us(this.n,e),this.sl(this.n,this.g,e));}us(t,e){this.n=t,this.Pt=e;let{zero:r}=Mt[t],s=this.Re.map(c=>c.value),n=pd(s,e,r),l=hd(s,r);this.Re.forEach((c,u)=>{let p=n[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.cl();}ul(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async xd(){this.a=this.a||this.ul();let t=this.a;t&&this.dl(t);let e=this.Re.map(u=>u.src),{images:r,promise:s,cancel:n}=Ai(e);r.forEach(u=>{let p=this.$t(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.ls=()=>{n(),this.ls=void 0;};let l=this.n,c=this.g;if(await s,this._&&this.al(l,c)){let u=this.mr.value;if(!u)return;u.replaceChildren(),this.Re.forEach((p,d)=>{let f=r[d];f&&(f.classList.add("uc-fader-image"),p.image=f,u.appendChild(f));}),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.cs?.();let n=il(r,s),l=await Promise.all(n.map(u=>this.et({url:t,filter:e,operation:r,value:u}))),{cancel:c}=Ai(l);this.cs=c;}Ed(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=yt({"uc-active_from_viewer":this.mi,"uc-active_from_cropper":!this.mi,"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=yt({"uc-active_from_viewer":this.mi,"uc-active_from_cropper":!this.mi,"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.as=false,await this.updateComplete,this.rl=t,this.n=e??"initial",this.Pt=r,this.g=s,this.mi=n,typeof r!="number"&&!s){let c=await this.et({operation:e,value:r});this.Ed(c),this.ds();return}!e||typeof r!="number"||(this.Re=await Promise.all(il(e,r).map(c=>this.ll(e,c))),this.us(e,r),this.xd());}deactivate({hide:t=true}={}){this._=false,this.ls?.(),this.cs?.(),t&&!this.as?(this.as=true,this.a&&(this.a.style.transform="scale(1)"),this.className=yt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.ds();},{once:true})):this.ds();}dl(t){let e=this.nl.value;e&&(e.contains(t)||e.appendChild(t));}ds(){this.mr.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${O(this.nl)}></div><div class="uc-fader-layers-host" ${O(this.mr)}></div>`}};var rl="important",fd=" !"+rl,Ae=mt(class extends Et{constructor(o){if(super(o),o.type!==$t.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(fd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?rl:""):t[e]=r;}}return rt}});var Vt=class extends x{constructor(){super();this.ps=0;this.Ue=A();this.hl=A();this.fl=A();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.$e=0;this.Sd=t=>{t.stopPropagation();let e=this.ml(t);e!==null&&(this.hs(e),this.Cd("slider-input",e));};this.Ad=t=>{t.stopPropagation();let e=this.ml(t);e!==null&&this.hs(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","");}static{a(this,"SliderUi");}Cd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.ps=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.yl(this.$e),this.fs(),this.s=new ResizeObserver(()=>{this.fs(),this.gr(this.$e);}),this.s.observe(this);let e=this.Ue.value;e?.addEventListener("focus",this.gl),e?.addEventListener("blur",this.vl),window.setTimeout(()=>{this.gr(this.$e);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.$e&&this.hs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.fs(),this.gr(this.$e)),t.has("zero")&&this.hasUpdated&&this.bl(this.$e);}gr(t){this.bl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(r-this.ps)/100;window.requestAnimationFrame(()=>{let c=this.hl.value;c&&(c.style.transform=`translateX(${l}px)`);});}bl(t){if(!this.gi)return;let e=this.max-this.min;if(e===0)return;this.gi.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(r-this.ps)/100;window.requestAnimationFrame(()=>{this.gi&&(this.gi.style.transform=`translateX(${l}px)`);});}fs(){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 l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.gi=p,e.innerHTML="",e.appendChild(l),this.pl=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Ue.value;t?.removeEventListener("focus",this.gl),t?.removeEventListener("blur",this.vl),this.s?.disconnect(),this.s=void 0;}hs(t){Number.isFinite(t)&&(this.$e=t,this.hasUpdated&&(this.yl(t),this.gr(t)));}yl(t){let e=this.Ue.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 y`<div class="uc-steps" ${O(this.fl)}></div><div class="uc-thumb" ${O(this.hl)}></div><input class="uc-input" type="range" ${O(this.Ue)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.$e)} ?disabled=${this.disabled} @input=${this.Sd} @change=${this.Ad} />`}};h([b({type:Boolean,reflect:true})],Vt.prototype,"disabled",2),h([b({type:Number})],Vt.prototype,"min",2),h([b({type:Number})],Vt.prototype,"max",2),h([b({type:Number,attribute:false})],Vt.prototype,"defaultValue",2),h([b({type:Number})],Vt.prototype,"zero",2),h([g()],Vt.prototype,"$e",2);var Nt="original",Ri=class extends x{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.ms=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{a(this,"EditorSlider");}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===Nt?void 0:this.state.value,filter:this.state.filter===Nt?void 0:this.state.filter,fromViewer:false});}kd(){let t=this.state.operation,{range:e,zero:r}=Mt[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),d=c;if(d){let{name:f,amount:m}=d;p=f===this.state.filter?m:n;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:r;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Nt?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 y`<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.ms} ></uc-slider-ui>`}};h([g()],Ri.prototype,"state",2);function ii(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)}}a(ii,"parseFilterValue");var lt=class extends x{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{a(this,"EditorButtonControl");}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 y`<button role="option" type="button" aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],lt.prototype,"active",2),h([g()],lt.prototype,"title",2),h([g()],lt.prototype,"icon",2),h([g()],lt.prototype,"titleProp",2);var to=12,eo=16,md=a(o=>{let i=12,t=12;return o.width/o.height>=1?(i=to,t=Math.round(to*o.height/o.width)):(t=to,i=Math.round(to*o.width/o.height)),{width:i,height:t}},"getAdjustResolutions"),io=class extends lt{static{a(this,"EditorFreeformButtonControl");}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 y`<button role="option" type="button" class=${ce(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},$i=class extends lt{constructor(){super(...arguments);this.X=null;}static{a(this,"EditorAspectRatioButtonControl");}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=a(()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},"resolveTitle"),s=a(()=>{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},"resolveTitleProp");r(),s(),e||this.requestUpdate();}Id(){let t=this.X;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=md(t),s=(eo-e)/2,n=(eo-r)/2;return y`<uc-icon><svg viewBox="0 0 ${eo} ${eo}" 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 y`<button role="option" type="button" class=${ce(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} >${this.Id()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],$i.prototype,"aspectRatio",1);function gd(o){let i=o+90;return i=i>=360?0:i,i}a(gd,"nextAngle");function vd(o,i){if(o==="rotate")return gd(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}a(vd,"nextValue");var Di=class extends lt{constructor(){super(...arguments);this.operation=void 0;}static{a(this,"EditorCropButtonControl");}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=vd(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};h([b({type:String})],Di.prototype,"operation",2);var Yt=class extends lt{constructor(){super(...arguments);this.n="";this.g="";this.vi="";this.vr=0;this.a=null;this.Ft=false;this.isOriginal=false;this.xl=20;}static{a(this,"EditorFilterControl");}get filter(){return this.g}set filter(t){let e=t??"";if(this.g===e)return;let r=this.g;this.g=e,this.n="filter",this.isOriginal=e===Nt,this.icon=this.isOriginal?"original":"slider",this.xl=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.El(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.g),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.g),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ii(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.g;}Od(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.xl||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.g!==Nt?{name:this.g,amount:l}:void 0,Z(this.vi,ot(ar,te(c),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Ut}/${Rt}/uc-cloud-image-editor/`))}async ni(t,e){t[0]?.isIntersecting?await this.gs(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.vi=t??"",this.sub("*originalUrl",e=>{this.vi=e??"",!this.isOriginal&&this.vi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.tt());}),this.isOriginal||(this.s?.observe(this),this.tt()),this.g&&this.El(this.g),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.g);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.gs():this.tt());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.yr();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.tt()));}El(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async gs(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.vi){!this.Dt&&!this.De&&this.tt();return}let e=++this.vr,r="";try{r=await this.proxyUrl(this.Od());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.Ft=false,this.b?.();let{promise:s,cancel:n}=Ce(r);this.b=()=>{n(),this.vr===e&&(this.b=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(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.tt();}finally{this.vr===e&&(this.b=void 0);}}tt(){if(!this.isConnected||this.a||this.Ft||this.isOriginal||this.$["*networkProblems"]){this.yr();return}this.De&&cancelAnimationFrame(this.De),this.De=requestAnimationFrame(()=>{if(this.De=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.gs();return}this.Dt=window.setTimeout(()=>{this.Dt=void 0,this.tt();},500);});}yr(){this.De&&(cancelAnimationFrame(this.De),this.De=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 y`<button role="option" type="button" class=${ce(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Ft} style=${Ae(e)}></div><uc-icon class=${ce({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Ae(r)} ></uc-icon></button>`}};h([g()],Yt.prototype,"a",2),h([g()],Yt.prototype,"Ft",2),h([g()],Yt.prototype,"isOriginal",2),h([g()],Yt.prototype,"xl",2),h([b({type:String})],Yt.prototype,"filter",1);var Fi=class extends lt{constructor(){super(...arguments);this.n="";}static{a(this,"EditorOperationControl");}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=a(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),r=a(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),r();}initCallback(){super.initCallback(),this.n&&this.Cl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=Mt[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:ii(this.$["*operationTooltip"])});}};h([b({type:String})],Fi.prototype,"operation",1);var yd=1,ol=a(()=>{},"noopScrollListener"),Vi=class extends x{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Sl=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>yd){this.scrollLeft+=r;return}this.scrollLeft+=e;};}static{a(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Sl,{passive:false}),this.addEventListener("scroll",ol,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Sl),this.removeEventListener("scroll",ol),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Vi.prototype,"hiddenScrollbar",2);var dt=class extends x{constructor(){super(...arguments);this.yi=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Al=true;this.tabList=[...st];this.activeTab=H.CROP;this.br=true;this.vs=false;this.kl=null;this.Ml=0;this.Il=0;this.wr=A();this.Ol=A();this.tabToggleRefs={[H.CROP]:A(),[H.TUNING]:A(),[H.FILTERS]:A()};this.Pl=()=>{this.ot();};this.bi=[];this.Tr=D(t=>{this.yi=t;},500);this.xr=D(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===H.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(Nt);else if(this.showSubToolbar&&this.$["*tabId"]===H.TUNING&&e){s=true;let n=t?.[e]||Mt[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.vs=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":Nt,"*currentOperation":null,"*operationTooltip":null};this.xe=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();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:ii(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.ys(r,{fromViewer:false}));};}static{a(this,"EditorToolbar");}Ll(){this.$["*showSlider"]=false,this.$["*tabId"]===H.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===H.TUNING&&(this.vs=false);}ys(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===H.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let l of st){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&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 bs(){return this.bi.length>=3}Dd(t){switch(t){case H.CROP:return this.Fd();case H.FILTERS:return this.Nd();case H.TUNING:return this.Vd();default:return []}}Fd(){let t=[];if(this.bs)t.push(()=>this._d());else for(let e of this.bi)t.push(()=>this.Ul(e));for(let e of wn)t.push(()=>this.Bd(e));return this.Ts(t)}Nd(){let e=[Nt,...bn].map(r=>()=>this.zd(r));return this.Ts(e)}Vd(){let t=yn.map(e=>()=>this.Hd(e));return this.Ts(t)}Ts(t){return t.length?t.map(r=>r()):[]}_d(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Ul(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Bd(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}zd(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Hd(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Kd(){return this.bs?this.bi.map(t=>this.Ul(t)):[]}async jd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ei(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=Ai([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.bi=[...t],this.sub("*cropPresetList",e=>{this.bi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.ys(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.xr();}),this.sub("*currentOperation",()=>{this.xr();}),this.sub("*tabId",e=>{this.Rl(e,{fromViewer:false,force:true}),this.xr();}),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.ys(r,{fromViewer:false});return}this.ot();}),this.sub("*operationTooltip",e=>{this.kl=e;}),this.xr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Pl);}firstUpdated(t){super.firstUpdated(t),this.Er(),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.Er();}disconnectedCallback(){window.removeEventListener("resize",this.Pl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Er(){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?Ae({gridColumn:`${s+1}`}):R;return y`<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 y`<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:R}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.vs?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.bs;return y`<uc-line-loader-ui .active=${this.yi}></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">${st.map(r=>Oi(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>${st.map(r=>this.Zd(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.xe} ></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?y`<div class="uc-list-aspect-ratio">${this.Kd()}</div>`:R}</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>`}};h([g()],dt.prototype,"yi",2),h([g()],dt.prototype,"showMainToolbar",2),h([g()],dt.prototype,"showSubToolbar",2),h([g()],dt.prototype,"Al",2),h([g()],dt.prototype,"tabList",2),h([g()],dt.prototype,"activeTab",2),h([g()],dt.prototype,"br",2),h([g()],dt.prototype,"vs",2),h([g()],dt.prototype,"kl",2),h([g()],dt.prototype,"bi",2);var sl=Ht([...st]),it=class extends x{constructor(){super(...arguments);this.ctxOwner=true;this.Xd="";this.et=Ot;this.Qd="";this.yi=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=sl;this.$l=false;this.ke=false;this.Es=null;this.wi=null;this.Tr=D(t=>{this.yi=t;},300);this.Cr=A();this.Dl=A();this.Fl=A();this.Nl=A();this.Vl=()=>{this.Tr(false),this.et!==Ot&&(this.$["*networkProblems"]=false);};this._l=()=>{this.Tr(false),this.$["*networkProblems"]=true;};this.Jd=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Ja(this)};}static{a(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}ep(){this.ke||this.Es||(this.Es=this.updateComplete.then(()=>{this.Es=null,this.ke=true;}));}initCallback(){super.initCallback(),this.Bl(),this.zl();}Er(){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 yt("uc-image",{"uc-image_hidden_to_cropper":t===H.CROP,"uc-image_hidden_effects":t!==H.CROP})}Hl(){if(this.wi)return this.wi;let t=3e3;return this.wi=new Promise((e,r)=>{let s=a(()=>{window.clearTimeout(p),u.disconnect(),this.wi=null;},"cleanup"),n=a(()=>{let{width:d,height:f}=this.getBoundingClientRect();return d>0&&f>0},"hasNonZeroSize"),l=a(()=>{s(),window.setTimeout(()=>e(),0);},"resolveWait"),c=a(()=>{let d=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(d.message),r(d);},"rejectWait"),u=new ResizeObserver(d=>{let[f]=d;f&&f.contentRect.width>0&&f.contentRect.height>0&&l();}),p=window.setTimeout(()=>{c();},t);if(n()){l();return}u.observe(this);}),this.wi}firstUpdated(t){super.firstUpdated(t),this.Er(),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||Ot,s=this.yi,n=this.$l;return y` ${Fe(tl)}<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)} />${Oi(this.ke,()=>y`<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">${Oi(this.ke,()=>y`<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||sl;this.$["*tabList"]=Qa(t);}zl(){let t=_r(this.cropPreset??""),e=null;if(this.cdnUrl){let r=Io(this.cdnUrl),s=Oo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,l]=s.crop.dimensions;e=ba(n,l,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=nr(t),r=Jt(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=Io(t),n=Oo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Jt(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"]===H.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(Z(t,ot("json"))),r=await fetch(e).then(l=>l.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===H.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=ot(te(t),"preview"),s=Z(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};h([g()],it.prototype,"Xd",2),h([g()],it.prototype,"et",2),h([g()],it.prototype,"Qd",2),h([g()],it.prototype,"yi",2),h([b({type:String,reflect:true})],it.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],it.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],it.prototype,"cropPreset",2),h([b({type:String,reflect:true})],it.prototype,"tabs",2),h([g()],it.prototype,"$l",2),h([g()],it.prototype,"ke",2);var Rs={};Vs(Rs,{CloudImageEditorActivity:()=>Ni});var ro=class extends it{static{a(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Ni=class extends ${constructor(){super(...arguments);this.Q=null;}static{a(this,"CloudImageEditorActivity");}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.Ti)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ti.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(S.activities.CLOUD_IMG_EDIT),this.historyBack();}xe(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(S.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.Ti=e;let r=this.Ti.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.Q=this.np(r);}sp(){this.Ti=void 0,this.Q=null;}render(){if(!this.Q)return R;let{cdnUrl:t,cropPreset:e,tabs:r}=this.Q;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${W(e)} tabs=${W(r)} @apply=${this.xs} @cancel=${this.xe} @change=${this.handleChange} ></uc-cloud-image-editor>`}np(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],Ni.prototype,"Q",2);var ri=class extends ${constructor(){super(...arguments);this.Kl={importDisabled:true};this.Ue=A();this.ms=t=>{let e=t.target?.value??"";this.Kl={importDisabled:!e};};this._o=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let r=this.Ue.value?.value?.trim();r&&(this.api.addFileFromUrl(r,{source:_.URL}),this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.modalManager?.open(S.activities.UPLOAD_LIST));};}static{a(this,"UrlSource");}firstUpdated(){let t=this.Ue.value;t&&(t.value="",t.focus());}render(){return y`<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.Ue)} placeholder="https://" class="uc-url-input" type="text" @input=${this.ms} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.Kl.importDisabled} >${this.l10n("upload-url")}</button></form>`}};h([g()],ri.prototype,"Kl",2);var nl=a(()=>{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}},"getTopLevelOrigin");var bd=a(o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),al=a((o,i="i")=>{let t=o.split("*").map(bd);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var wd=["--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"],Td=a((o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),"getCssValue"),ll=a(o=>{let i={};for(let t of wd){let e=Td(o,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Ed=["selected-files-change","toolbar-state-change"],Cd=a(o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!Ed.includes(i))},"isWhitelistedMessage"),oo=class{constructor(i,t){this.Sr=new Map;this.Gl=i=>{if(i.source!==this.Cs)return;let t=i.data;if(!Cd(t))return;let e=this.Sr.get(t.type);if(e)for(let r of e)r(t);};this.Cs=i,this.jl=t,window.addEventListener("message",this.Gl);}static{a(this,"MessageBridge");}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.Cs.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Gl);}};function cl(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("&")}a(cl,"queryString");var xd={[xt.GDRIVE]:"ngdrive"},pt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Nt=A();this.Ar=null;this.Ss=[];this.As=false;this.ks=false;this.Ms=false;this.Is=false;this.kr=false;this.Os=false;this.Ps="uc-hidden";this.ql=true;this.Bo=()=>{for(let t of this.Ss){let e=this.lp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.modalManager?.open(S.activities.UPLOAD_LIST);};this.xe=()=>{this.historyBack();};this.fp=()=>{this.ne?.send({type:"select-all"});};this.mp=()=>{this.ne?.send({type:"deselect-all"});};}static{a(this,"ExternalSource");}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=Y(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=al(r);for(let[n,l]of Object.entries(t.alternatives))if(s.test(n))return l}}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.Ps=t.isReady?"":"uc-hidden",this.As=t.isReady,this.ks=t.isReady&&t.selectedFiles.length>0,this.kr=t.isMultipleMode&&t.total>0,this.Ms=t.selectedCount<t.total,this.Is=t.selectedCount===t.total,this.Ss=t.selectedFiles??[],this.Os=t.total>0;}Ql(){this.Xl(this.cfg.externalSourcesEmbedCss),this.pp(),this.Yl();}pp(){this.ne?.send({type:"set-theme-definition",theme:ll(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,l=xd[n]??n,u={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||nl(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,r);return p.search=cl(u),p.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 oo(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.Ss=[],this.As=false,this.ks=false,this.Ms=false,this.Is=false,this.kr=false,this.Os=false,this.Ps="uc-hidden",this.Ar=null;}disconnectedCallback(){super.disconnectedCallback(),this.Zl();}render(){return y`<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.xe}>${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.Ms}>${this.l10n("select-all")}</button><button type="button" @click=${this.mp} ?hidden=${!this.Is}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.Bo} ?disabled=${!this.ks} ?hidden=${!this.Os} ><uc-spinner ?hidden=${this.As}></uc-spinner><span class=${this.Ps}>${this.l10n("done")}</span></button></div></div>`}};h([g()],pt.prototype,"Ss",2),h([g()],pt.prototype,"As",2),h([g()],pt.prototype,"ks",2),h([g()],pt.prototype,"Ms",2),h([g()],pt.prototype,"Is",2),h([g()],pt.prototype,"kr",2),h([g()],pt.prototype,"Os",2),h([g()],pt.prototype,"Ps",2),h([g()],pt.prototype,"ql",2);var ul=a(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var Sd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Ad=["camera","microphone"];function so(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}a(so,"formatTime");var dl="image/jpeg",pl="video/webm",z=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Mr=null;this.Ls=false;this.xi=[];this.fe=null;this.me=null;this.Ir=null;this.Or=null;this.w=null;this.Ei={};this.he=null;this.e=null;this.Vt=[];this._t=[];this.gp={};this.Pr=[];this.Lr=null;this.ec=()=>{this.tc(),this.Ci="pause";};this.ic=()=>{this.Ci="play",this.vp();};this.Si=A();this.Qe=A();this.K=A();this.rc=A();this.oc=0;this.sc=0;this.nc=null;this.Rr=true;this.Ur=true;this.yp=ul();this.ac=[];this.at=true;this.Rs="";this.Bt=true;this.pt=true;this.zt=true;this.cc=[];this.mt=true;this.Us=true;this.gt=true;this.Ce=true;this.vt=true;this.Ht="camera-full";this.Ci="play";this.uc="microphone";this.$r="uc-shot-btn uc-camera-action";this.bp=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.w}}}),this.w===U.PHOTO&&this.wp(),this.w===U.VIDEO){if(this.fe?.state==="recording"){this.dc();return}this.Tp();}};this.xp=t=>{let e=t.target;e&&(this.Or=e.value,this.Kt());};this.Ep=t=>{let e=t.target;e&&(this.Ir=e.value,this.Kt());};this.Cp=()=>{this.Kt();};this.Sp=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.w}}}),this.bp();};this.Ap=()=>{this.kp();};this.Mp=()=>{this.Ip();};this.Op=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.w}}}),this.Pp();};this.Lp=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.w}}}),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.Si.value;s&&(s.textContent=so(e)),this.dc();return}let r=this.Si.value;r&&(r.textContent=so(e));}else {let e=this.Si.value;e&&(e.textContent=so(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.Si.value;n&&(n.textContent=so(e)),this.jt=requestAnimationFrame(this.tc);};this.vp=()=>{this.jt&&cancelAnimationFrame(this.jt);};this.jt=null;this.Tp=()=>{try{this.xi=[],this.Ei={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Ei.mimeType=t:MediaRecorder.isTypeSupported(pl)?this.Ei.mimeType=pl:this.Ei.mimeType="video/mp4",this.me&&(this.fe=new MediaRecorder(this.me,this.Ei),this.fe.start(),this.fe.addEventListener("dataavailable",e=>{this.xi.push(e.data);}),this.Up(),this.classList.add("uc-recording"),this.Ai(Ct.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.dc=()=>{this.fe?.addEventListener("stop",()=>{this.$p(),this.mc(),this.Ai(Ct.STOP);}),this.fe?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.w}}});};this.kp=()=>{if(this.fe?.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.me?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.uc=t.enabled?"microphone":"microphone-mute",this.Us=!t.enabled;});};this.$p=()=>{try{let t=new Blob(this.xi,{type:this.fe?.mimeType}),e=URL.createObjectURL(t),r=this.K.value;if(!r)return;r.muted=!1,r.volume=1,this.ki(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.Ai(Ct.RETAKE),this.w===U.VIDEO){this.ki(this.me);let t=this.K.value;t&&(t.muted=true);}this.K.value?.play?.();};this.Rp=()=>{if(this.Ai(Ct.ACCEPT),this.w===U.PHOTO){this.he?.toBlob(s=>{if(!s)return;let n=this.gc("camera","jpeg",dl,s);this.vc(n);},dl);return}let t=new Blob(this.xi,{type:this.fe?.mimeType}),e=this.Fp(this.fe?.mimeType),r=this.gc("video",e,`video/${e}`,t);this.vc(r),this.xi=[];};this.Np=t=>{t===Ct.SHOT&&(this.vt=true,this.pt=true,this.Ce=true,this.zt=false,this.at=true),(t===Ct.RETAKE||t===Ct.ACCEPT)&&(this.vt=!this.Se.includes(U.VIDEO),this.Ce=!this.Se.includes(U.PHOTO),this.pt=false,this.zt=true,this.at=this.Vt.length<=1);};this.Vp=t=>{t===Ct.PLAY&&(this.Bt=false,this.Ce=true,this.at=true,this.mt=true,this.Ci="pause",this.Ht="square",this.$r="uc-shot-btn uc-camera-action uc-stop-record"),t===Ct.STOP&&(this.Bt=false,this.pt=true,this.gt=true,this.zt=false),(t===Ct.RETAKE||t===Ct.ACCEPT)&&(this.Bt=true,this.vt=!this.Se.includes(U.VIDEO),this.Ce=!this.Se.includes(U.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.Ai=t=>{this.w===U.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Np(t),this.w===U.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===U.PHOTO&&(this.Ht="camera-full",this.mt=true,this.gt=true),t===U.VIDEO&&(this.Ci="play",this.Ht="video-camera-full",this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.gt=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.w=t;};this.gc=(t,e,r,s)=>{let n=Date.now(),l=`${t}-${n}.${e}`;return new File([s],l,{lastModified:n,type:r})};this.vc=t=>{this.api.addFileFromObject(t,{source:_.CAMERA}),this.set$({"*currentActivity":S.activities.UPLOAD_LIST}),this.modalManager?.open(S.activities.UPLOAD_LIST);};this.Mi=D(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.w===U.VIDEO&&this.cfg.enableAudioRecording,r=this.w===U.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Rr=false,this.pt=false,this.Ce=!this.Se.includes(U.PHOTO),this.vt=!this.Se.includes(U.VIDEO),this.Ur=true,this.Bt=true,this.Ht=r,this.gt=!e,this.mt=!e):t==="prompt"?(this.Rs="camera-permissions-prompt",this.Rr=true,this.pt=true,this.Ce=true,this.Ur=false,this.Fs()):(this.Rs="camera-permissions-denied",this.Rr=true,this.Ur=false,this.Ce=!this.Se.includes(U.PHOTO),this.vt=!this.Se.includes(U.VIDEO),this.zt=true,this.$r="uc-shot-btn uc-camera-action",this.Fs());},300);this._p=()=>{if(!this.me)return false;let t=this.me?.getAudioTracks(),e=this.me?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.Fs=()=>{this.Ls&&(this.K.value&&(this.K.value.volume=0),this.Lr?.getTracks?.()?.[0]?.stop(),this.$s(this.K.value),this.ki(null),this._p(),this.mc(),this.Ls=false);};this.Kt=async()=>{let t={video:{...Sd},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.Mi("prompt"),this.me=await navigator.mediaDevices.getUserMedia(t),this.me.addEventListener("inactive",()=>{this.Mi("denied");}),this.ki(this.me),this.Ls=!0,this.Mi("granted");}catch(e){this.Mi("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 Ad){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.Ns(),navigator.mediaDevices.addEventListener("devicechange",this.Ns);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.Ns=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.Mi("denied"),this.Fs();};this.bc=t=>{this.vt=!t.includes(U.VIDEO),this.Ce=!t.includes(U.PHOTO);let e=t[0];e&&(!this.w||!t.includes(this.w))&&this.hc(e);};}static{a(this,"CameraSource");}Dp(t){this.$s(t),t.addEventListener("play",this.ec),t.addEventListener("pause",this.ic);}$s(t){t?.removeEventListener("play",this.ec),t?.removeEventListener("pause",this.ic);}ki(t){this.Lr!==t&&(this.Lr=t,this.Ds());}Ds(){let t=this.K.value;if(!t)return;let e=this.Lr??null;t.srcObject!==e&&(t.srcObject=e);}wp(){if(this.Ai("shot"),this.he=document.createElement("canvas"),this.e=this.he.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.he.height=t.videoHeight,this.he.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.he.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 Y(this.cfg.cameraModes).filter(t=>t===U.PHOTO||t===U.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.Us=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=j(t);this.bc(e.filter(r=>r===U.PHOTO||r===U.VIDEO));}),this.Hp();}firstUpdated(t){super.firstUpdated(t),this.Ds();}updated(t){super.updated(t),this.Ds();}jp(){this.Dr(),navigator.mediaDevices?.removeEventListener("devicechange",this.Ns),this.$s(this.K.value),this.ki(null);}disconnectedCallback(){super.disconnectedCallback(),this.Kp(),this.jp();}render(){return y`<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.xp} ></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=${Ae({transform:this.nc})} ?hidden=${this.Rr} ${O(this.K)} ></video><div class="uc-message-box" ?hidden=${this.Ur}><span>${this.l10n(this.Rs)}</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.Ci}></uc-icon><span ${O(this.Si)}> 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.Us} @change=${this.Ep} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],z.prototype,"nc",2),h([g()],z.prototype,"Rr",2),h([g()],z.prototype,"Ur",2),h([g()],z.prototype,"yp",2),h([g()],z.prototype,"ac",2),h([g()],z.prototype,"at",2),h([g()],z.prototype,"Rs",2),h([g()],z.prototype,"Bt",2),h([g()],z.prototype,"pt",2),h([g()],z.prototype,"zt",2),h([g()],z.prototype,"cc",2),h([g()],z.prototype,"mt",2),h([g()],z.prototype,"Us",2),h([g()],z.prototype,"gt",2),h([g()],z.prototype,"Ce",2),h([g()],z.prototype,"vt",2),h([g()],z.prototype,"Ht",2),h([g()],z.prototype,"Ci",2),h([g()],z.prototype,"uc",2),h([g()],z.prototype,"$r",2);var hl={id:"camera",setup:a(async({pluginApi:o,uploaderApi:i})=>{ft({CameraSource:z}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:a(()=>{if(!Bn.htmlMediaCapture)return ["camera"];let t=j(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},"expand"),onSelect:a(()=>{i.setCurrentActivity(V.CAMERA),i.setModalState(true);},"onSelect")}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-camera",icon:"camera",onSelect:a(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});},"onSelect")}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-camera",icon:"camera",onSelect:a(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});},"onSelect")}),o.registry.registerActivity({id:V.CAMERA,render:a(t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}},"render")});},"setup")};var $s={};Vs($s,{BtnUi:()=>St,CloudImageEditor:()=>ro,CloudImageEditorBlock:()=>it,Config:()=>Qe,CropFrame:()=>Pi,EditorAspectRatioButtonControl:()=>$i,EditorCropButtonControl:()=>Di,EditorFilterControl:()=>Yt,EditorFreeformButtonControl:()=>io,EditorImageCropper:()=>Ui,EditorImageFader:()=>Jr,EditorOperationControl:()=>Fi,EditorScroller:()=>Vi,EditorSlider:()=>Ri,EditorToolbar:()=>dt,Icon:()=>ae,LineLoaderUi:()=>Li,PresenceToggle:()=>ti,SliderUi:()=>Vt,defineComponents:()=>ft});var kd="cloud-image-editor",Md="<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>",fl={id:kd,setup:a(async({pluginApi:o,uploaderApi:i})=>(ft({...$s,...Rs}),o.registry.registerIcon({name:"edit-file",svg:Md}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:a(e=>!!(e.isImage&&e.cdnUrl),"shouldRender"),onClick:a(e=>{i.setCurrentActivity?.(V.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);},"onClick")}),o.registry.registerActivity({id:V.CLOUD_IMG_EDIT,render:a(e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}},"render")}),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"),l=i.v.size;s&&l===1&&(r||n)&&(i.setCurrentActivity?.(V.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));})),"setup")};var ml={id:"external-sources",setup:a(async({pluginApi:o,uploaderApi:i})=>{ft({ExternalSource:pt}),o.registry.registerActivity({id:V.EXTERNAL,render:a(t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}},"render")});for(let t of Object.values(xt))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:a(()=>{i.setCurrentActivity(V.EXTERNAL,{externalSourceType:t}),i.setModalState(true);},"onSelect")});},"setup")};var ao=a(()=>{let o=[];return {stack:o,promiseReadJpegChunks:a(t=>new Promise((e,r)=>{let s=2,n=a((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",f=>{r(`Reader error: ${f}`);}),d.readAsArrayBuffer(u);},"readToView"),l=a(()=>n(t.slice(s,s+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=a(()=>{let u=s;return n(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let f=p.getUint16(2)-2;return n(t.slice(s,s+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}o.push({startPos:u,length:f,marker:d,view:m}),l();})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Id=a(async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=ao();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},"getIccProfile"),vl=a(async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=ao();await s(o),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),r.push(u.length)});let l=[o.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(o.slice(c,e[u])),c=e[u]+r[u]+4;return l.push(o.slice(c,o.size)),new Blob(l,{type:o.type})}},"replaceJpegChunk"),Od=226,yl=a((o,i)=>vl(o,Od,i.map(t=>t.buffer)),"replaceIccProfile"),Ld=a(async o=>{try{return await yl(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),Pd=a((o,i,t)=>new Promise((e,r)=>{let s=a(n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);},"callback");o.toBlob(s,i,t),o.width=o.height=1;}),"canvasToBlob"),_i=a(()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},"createCanvas"),Ud=a(o=>{let{ctx:t,canvas:e}=_i();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},"hasTransparency"),Rd=a(async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=ao();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},"getExif"),$d="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",no,Dd=a(()=>new Promise(o=>{if(no!==void 0)o(no);else {let i=new Image;i.addEventListener("load",()=>{no=i.naturalWidth<i.naturalHeight,i.src="//:0",o(no);}),i.src=$d;}}),"isBrowserApplyExifOrientation"),Fd=a((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;}},"findExifOrientation"),Vd=a((o,i)=>{Fd(o,(t,e)=>o.setUint16(t,i,e));},"setExifOrientation"),Nd=a(async(o,i,t)=>(t&&Vd(i,1),vl(o,225,[i.buffer])),"replaceExif"),_d=a((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."));}));}),"processImage"),zd=a(o=>_d(new Image,o),"imageLoader"),Bd=[1,3],Hd=[192,193,194,195,197,198,199,201,202,203,205,206,207],gl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Kd=a(async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=ao();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&Hd.indexOf(r)>=0){let n=s.getUint8(5);Bd.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),bl=a((o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},"memoize"),wl=a((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},"memoKeySerializer"),ue={R:55,G:110,B:165,A:255},jd=`rgba(${ue.R}, ${ue.G}, ${ue.B}, ${ue.A/255})`,Tl=a((o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=_i();e.width=1,e.height=1;let{canvas:s,ctx:n}=_i();s.width=o,s.height=i,n&&(n.fillStyle=jd,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===ue.R&&l[1]===ue.G&&l[2]===ue.B&&l[3]===ue.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}},"canvasTest");function El(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}a(El,"wrapAsync");var Gd=El(bl(Tl,wl)),qd=El(bl(Tl,wl)),Cl=a(async(o,i)=>{let t=gl.squareSide.find(n=>n*n>=o*i),e=gl.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([Gd(t,t),qd(e,1)]);if(r&&s)return true;throw new Error("Not supported")},"testCanvasSize"),xl=a(async(o,i,t)=>{try{let{ctx:e,canvas:r}=_i();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})}},"canvasResize"),Wd=a(({img:o,targetW:i,targetH:t})=>xl(o,i,t),"native"),Zd=a(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()},"calcShrinkSteps"),Yd=a(({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=Zd({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[l,c],u)=>n.then(p=>Cl(l,c).then(()=>xl(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(o))},"fallback"),Xd=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Qd=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Ds=.71,Jd=a((o,i)=>{if(o.width*Ds*o.height*Ds<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 Cl(s,n).then(()=>{let{ctx:l}=_i();return "imageSmoothingQuality"in l&&!Xd()&&!Qd?Wd({img:o,targetW:s,targetH:n}):Yd({img:o,sourceW:t,targetW:s,targetH:n,step:Ds})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Sl=a(async(o,i)=>{try{if(await Kd(o))throw new Error("Should skipped");let e=await Promise.allSettled([Rd(o),Dd(),Id(o)]),s=!e.some(w=>w.status==="rejected"),[n,l,c]=e,u=await Ld(o).catch(()=>o),p=await zd(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await Jd(p,i),f="image/jpeg",m=i?.quality||.8;!s&&Ud(d)&&(f="image/png",m=void 0);let v=await Pd(d,f,m);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,T=l.status==="fulfilled"?l.value:!1;v=await Nd(v,w,T);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await yl(v,c.value)),v}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})}},"shrinkFile");var tp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Al=a(o=>{if(typeof o!="string")return false;let i=tp.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}},"parseShrink");var kl={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:a(async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=Al(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Sl(i,e)}}catch{return {file:i}}},"handler")});}};var Ml={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:a(()=>(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"),[]),"expand"),onSelect:a(()=>{},"onSelect")});}};var Il={id:_.LOCAL,setup:a(({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:_.LOCAL,label:"src-type-local",icon:"local",onSelect:a(()=>{i.openSystemDialog();},"onSelect")});},"setup")};var Ol={id:"url-source",setup:a(async({pluginApi:o,uploaderApi:i})=>{ft({UrlSource:ri}),o.registry.registerActivity({id:V.URL,render:a(t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}},"render")}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:a(()=>{i.setCurrentActivity(V.URL),i.setModalState(true);},"onSelect")});},"setup")};var oi=[{configDeps:["useCloudImageEditor"],isEnabled:a(o=>!!o("useCloudImageEditor"),"isEnabled"),load:a(()=>fl,"load")},{configDeps:["imageShrink"],isEnabled:a(o=>!!o("imageShrink"),"isEnabled"),load:a(()=>kl,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.LOCAL),"isEnabled"),load:a(()=>Il,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.CAMERA),"isEnabled"),load:a(()=>hl,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes("instagram"),"isEnabled"),load:a(()=>Ml,"load")},{configDeps:["sourceList"],isEnabled:a(o=>Object.values(xt).some(i=>j(o("sourceList")).includes(i)),"isEnabled"),load:a(()=>ml,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.URL),"isEnabled"),load:a(()=>Ol,"load")}];var lo=class extends Zt{constructor(){super();this.headless=false;this.init$={...this.init$};}static{a(this,"FileUploaderRegular");}static{this.lazyPlugins=oi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});}render(){return y` ${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>`}};h([b({type:Boolean})],lo.prototype,"headless",2);var co=class extends Zt{constructor(){super();this.wc=false;this.xe=()=>{if(this.Tc){let t=this.$["*historyBack"];t?.();return}this.xc&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderInline");}static{this.lazyPlugins=oi;}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]!==S.activities.START_FROM}get xc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}Vs(){return this.getCssData("--cfg-init-activity")||S.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.Vs();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.wc=this.Tc||this.xc;});}render(){return y` ${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.xe} ?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>`}};h([g()],co.prototype,"wc",2);var Fs="active",uo="",ke=class extends Zt{constructor(){super();this._s=false;this.Fr=false;this.Nr=uo;this.Bs=uo;this.oi=t=>{t.id===S.activities.CLOUD_IMG_EDIT&&(this.Nr=Fs),this.$["*currentActivity"]===S.activities.UPLOAD_LIST&&(this.Nr=Fs,this.Fr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.Bs=Fs);};this.si=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.Fr=false),t.id===S.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderMinimal");}static{this.lazyPlugins=oi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}Vs(){return this.getCssData("--cfg-init-activity")||S.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.Vs();this.sub("*currentActivity",e=>{e===S.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.Bs=uo):(this.Nr=uo,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._s=!r):(this.style.removeProperty("--uc-grid-col"),this._s=false);});}),this.modalManager?.subscribe(X.OPEN,this.oi),this.modalManager?.subscribe(X.CLOSE,this.si);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(X.OPEN,this.oi),this.modalManager?.unsubscribe(X.CLOSE,this.si);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.Fr} class=${this.Bs}><uc-drop-area ?single=${this._s} 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>`}};h([g()],ke.prototype,"_s",2),h([g()],ke.prototype,"Fr",2),h([g()],ke.prototype,"Nr",2),h([g()],ke.prototype,"Bs",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
|
|
8
|
+
exports.ActivityBlock=S;exports.ActivityHeader=Ts;exports.BaseComponent=So;exports.Block=x;exports.BtnUi=St;exports.CameraSource=z;exports.CloudImageEditor=ro;exports.CloudImageEditorActivity=Ni;exports.CloudImageEditorBlock=it;exports.Config=Qe;exports.Copyright=ys;exports.CropFrame=Pi;exports.Data=K;exports.DropArea=vt;exports.EditorAspectRatioButtonControl=$i;exports.EditorCropButtonControl=Di;exports.EditorFilterControl=Yt;exports.EditorFreeformButtonControl=io;exports.EditorImageCropper=Ui;exports.EditorImageFader=Jr;exports.EditorOperationControl=Fi;exports.EditorScroller=Vi;exports.EditorSlider=Ri;exports.EditorToolbar=dt;exports.ExternalSource=pt;exports.ExternalUploadSource=xt;exports.FileItem=xs;exports.FileUploaderInline=co;exports.FileUploaderMinimal=ke;exports.FileUploaderRegular=lo;exports.FormInput=Wr;exports.Icon=ae;exports.Img=fs;exports.LineLoaderUi=Li;exports.Modal=Ci;exports.ModalEvents=X;exports.PACKAGE_NAME=Ut;exports.PACKAGE_VERSION=Rt;exports.PluginActivityHost=Ii;exports.PluginActivityRenderer=Je;exports.PresenceToggle=ti;exports.ProgressBar=Ge;exports.ProgressBarCommon=xi;exports.Select=qe;exports.SimpleBtn=Mi;exports.SliderUi=Vt;exports.SolutionBlock=Zt;exports.SourceBtn=We;exports.SourceList=Si;exports.Spinner=bs;exports.StartFrom=Es;exports.Thumb=Ye;exports.UID=ht;exports.UploadCtxProvider=Cs;exports.UploadList=Lt;exports.UploadSource=_;exports.UploaderBlock=$;exports.UrlSource=ri;exports.defineComponents=ft;exports.defineLocale=un;exports.loadFileUploaderFrom=Jl;exports.toKebabCase=ur;return exports;})({});
|