@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,2192 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Package: @uploadcare/file-uploader@1.28.0-alpha.1 (MIT)
|
|
4
|
-
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
-
* Built: 2026-03-02T20:26:09.550Z
|
|
6
|
-
*/
|
|
7
|
-
import { A as MIN_CROP_SIZE, At as __decorate, B as i, Bt as b, C as setSvgNodeAttrs, Ct as createOriginalUrl, D as GUIDE_STROKE_WIDTH, E as CROP_PADDING, H as LitBlock, K as PACKAGE_NAME, M as THUMB_CORNER_SIZE, Mt as r, N as THUMB_SIDE_SIZE, Nt as n, O as GUIDE_THIRD, Ot as UID, P as THUMB_STROKE_WIDTH, R as o, Rt as A, S as roundRect, St as createCdnUrlModifiers, T as thumbCursor, Tt as extractUuid, V as t, Y as InternalEventType, _ as isRectMatchesAspectRatio, _t as COMMON_OPERATIONS, b as resizeRect, dt as ALL_COLOR_OPERATIONS, f as clamp, ft as ALL_CROP_OPERATIONS, g as isRectInsideRect, gt as TabId, h as createSvgNode, ht as COLOR_OPERATIONS_CONFIG, j as MIN_INTERACTION_SIZE, jt as debounce, k as MAX_INTERACTION_SIZE, l as getClosestAspectRatio, m as cornerPath, mt as ALL_TABS, n as n$1, p as constraintRect, pt as ALL_FILTERS, q as PACKAGE_VERSION, t as e, u as parseCropPreset, v as moveRect, vt as operationsToTransformations, w as sidePath, wt as extractOperations, x as rotateSize, xt as createCdnUrl, y as rectContainsPoint, yt as transformationsToOperations, z as e$2, zt as E } from "./ref-ZWPcLQB9.js";
|
|
8
|
-
import { f as deserializeCsv, p as serializeCsv } from "./plugins-CzNtrVQB.js";
|
|
9
|
-
import { t as o$1 } from "./style-map-Dk7mLCrB.js";
|
|
10
|
-
const TRANSPARENT_PIXEL_SRC = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
|
|
11
|
-
function preloadImage(p) {
|
|
12
|
-
let B = new Image();
|
|
13
|
-
return {
|
|
14
|
-
promise: new Promise((V, H) => {
|
|
15
|
-
B.src = p, B.onload = () => V(), B.onerror = (p) => H(p);
|
|
16
|
-
}),
|
|
17
|
-
image: B,
|
|
18
|
-
cancel: () => {
|
|
19
|
-
B.naturalWidth === 0 && (B.src = TRANSPARENT_PIXEL_SRC);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function batchPreloadImages(p) {
|
|
24
|
-
let B = [];
|
|
25
|
-
for (let V of p) {
|
|
26
|
-
let p = preloadImage(V);
|
|
27
|
-
B.push(p);
|
|
28
|
-
}
|
|
29
|
-
let V = B.map((p) => p.image);
|
|
30
|
-
return {
|
|
31
|
-
promise: Promise.allSettled(B.map((p) => p.promise)),
|
|
32
|
-
images: V,
|
|
33
|
-
cancel: () => {
|
|
34
|
-
B.forEach((p) => {
|
|
35
|
-
p.cancel();
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const throttle = (p, B) => {
|
|
41
|
-
let V = !1, H, U = 0, W = ((...W) => {
|
|
42
|
-
V ? (H && clearTimeout(H), H = setTimeout(() => {
|
|
43
|
-
Date.now() - U >= B && (p(...W), U = Date.now());
|
|
44
|
-
}, Math.max(B - (Date.now() - U), 0))) : (p(...W), U = Date.now(), V = !0);
|
|
45
|
-
});
|
|
46
|
-
return Object.defineProperty(W, "cancel", {
|
|
47
|
-
configurable: !1,
|
|
48
|
-
writable: !1,
|
|
49
|
-
enumerable: !1,
|
|
50
|
-
value: () => {
|
|
51
|
-
H && clearTimeout(H);
|
|
52
|
-
}
|
|
53
|
-
}), W;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* @license
|
|
57
|
-
* Copyright 2018 Google LLC
|
|
58
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
-
*/ var o$2 = (p) => p ?? A;
|
|
60
|
-
/**
|
|
61
|
-
* @license
|
|
62
|
-
* Copyright 2021 Google LLC
|
|
63
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
|
-
*/
|
|
65
|
-
function n$2(p, B, V) {
|
|
66
|
-
return p ? B(p) : V?.(p);
|
|
67
|
-
}
|
|
68
|
-
function normalize(...p) {
|
|
69
|
-
return p.reduce((p, B) => {
|
|
70
|
-
if (typeof B == "string") return p[B] = !0, p;
|
|
71
|
-
for (let V of Object.keys(B)) p[V] = B[V];
|
|
72
|
-
return p;
|
|
73
|
-
}, {});
|
|
74
|
-
}
|
|
75
|
-
function classNames(...p) {
|
|
76
|
-
let B = normalize(...p);
|
|
77
|
-
return Object.keys(B).reduce((p, V) => (B[V] && p.push(V), p), []).join(" ");
|
|
78
|
-
}
|
|
79
|
-
function applyClassNames(p, ...B) {
|
|
80
|
-
let V = normalize(...B);
|
|
81
|
-
for (let B of Object.keys(V)) p.classList.toggle(B, !!V[B]);
|
|
82
|
-
}
|
|
83
|
-
var isTabIdValue = (p) => ALL_TABS.includes(p);
|
|
84
|
-
const parseTabs = (p) => {
|
|
85
|
-
if (!p) return ALL_TABS;
|
|
86
|
-
let B = deserializeCsv(p).filter(isTabIdValue);
|
|
87
|
-
return B.length === 0 ? ALL_TABS : B;
|
|
88
|
-
};
|
|
89
|
-
function initState(p) {
|
|
90
|
-
return {
|
|
91
|
-
"*originalUrl": null,
|
|
92
|
-
"*loadingOperations": /* @__PURE__ */ new Map(),
|
|
93
|
-
"*faderEl": null,
|
|
94
|
-
"*cropperEl": null,
|
|
95
|
-
"*imgEl": null,
|
|
96
|
-
"*imgContainerEl": null,
|
|
97
|
-
"*networkProblems": !1,
|
|
98
|
-
"*imageSize": null,
|
|
99
|
-
"*editorTransformations": {},
|
|
100
|
-
"*cropPresetList": [],
|
|
101
|
-
"*currentAspectRatio": null,
|
|
102
|
-
"*tabList": ALL_TABS,
|
|
103
|
-
"*tabId": TabId.CROP,
|
|
104
|
-
"*on.retryNetwork": () => {
|
|
105
|
-
let B = p.querySelectorAll("img");
|
|
106
|
-
for (let p of B) {
|
|
107
|
-
let B = p.src;
|
|
108
|
-
p.src = TRANSPARENT_PIXEL_SRC, p.src = B;
|
|
109
|
-
}
|
|
110
|
-
p.$["*networkProblems"] = !1;
|
|
111
|
-
},
|
|
112
|
-
"*on.apply": (B) => {
|
|
113
|
-
if (!B) return;
|
|
114
|
-
let V = p.$["*originalUrl"];
|
|
115
|
-
if (!V) {
|
|
116
|
-
console.warn("Original URL is null, cannot apply transformations");
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
let H = createCdnUrlModifiers(transformationsToOperations(B), "preview"), U = {
|
|
120
|
-
originalUrl: V,
|
|
121
|
-
cdnUrlModifiers: H,
|
|
122
|
-
cdnUrl: createCdnUrl(V, H),
|
|
123
|
-
transformations: B
|
|
124
|
-
};
|
|
125
|
-
p.dispatchEvent(new CustomEvent("apply", {
|
|
126
|
-
detail: U,
|
|
127
|
-
bubbles: !0,
|
|
128
|
-
composed: !0
|
|
129
|
-
})), p.remove();
|
|
130
|
-
},
|
|
131
|
-
"*on.cancel": () => {
|
|
132
|
-
p.remove(), p.dispatchEvent(new CustomEvent("cancel", {
|
|
133
|
-
bubbles: !0,
|
|
134
|
-
composed: !0
|
|
135
|
-
}));
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
var svg_sprite_default = "<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>", DEFAULT_STYLE = {
|
|
140
|
-
transition: "uc-transition",
|
|
141
|
-
visible: "uc-visible",
|
|
142
|
-
hidden: "uc-hidden"
|
|
143
|
-
}, PresenceToggle = class extends LitBlock {
|
|
144
|
-
constructor(...p) {
|
|
145
|
-
super(...p), this._visible = !1, this._styles = DEFAULT_STYLE, this._visibleStyle = DEFAULT_STYLE.visible, this._hiddenStyle = DEFAULT_STYLE.hidden, this._externalTransitions = !1, this._initialRenderComplete = !1;
|
|
146
|
-
}
|
|
147
|
-
set visible(p) {
|
|
148
|
-
this._visible = p, this._handleVisible();
|
|
149
|
-
}
|
|
150
|
-
get visible() {
|
|
151
|
-
return this._visible;
|
|
152
|
-
}
|
|
153
|
-
set styles(p) {
|
|
154
|
-
this._styles = p, this._externalTransitions = !0, this._visibleStyle = p.visible ?? DEFAULT_STYLE.visible, this._hiddenStyle = p.hidden ?? DEFAULT_STYLE.hidden;
|
|
155
|
-
}
|
|
156
|
-
get styles() {
|
|
157
|
-
return this._styles;
|
|
158
|
-
}
|
|
159
|
-
_handleVisible() {
|
|
160
|
-
this.style.visibility = this._visible ? "inherit" : "hidden", applyClassNames(this, {
|
|
161
|
-
[DEFAULT_STYLE.transition]: !this._externalTransitions,
|
|
162
|
-
[this._visibleStyle]: this._visible,
|
|
163
|
-
[this._hiddenStyle]: !this._visible
|
|
164
|
-
}), this.toggleAttribute("inert", !this._visible);
|
|
165
|
-
}
|
|
166
|
-
_dispatchInitialRenderEvent() {
|
|
167
|
-
this._initialRenderComplete || (this._initialRenderComplete = !0, this.dispatchEvent(new CustomEvent("initial-render", {
|
|
168
|
-
bubbles: !0,
|
|
169
|
-
composed: !0
|
|
170
|
-
})));
|
|
171
|
-
}
|
|
172
|
-
initCallback() {
|
|
173
|
-
super.initCallback(), this.classList.toggle("uc-initial", !0), this._externalTransitions || this.classList.add(DEFAULT_STYLE.transition), this._handleVisible(), setTimeout(() => {
|
|
174
|
-
this.classList.toggle("uc-initial", !1), this._dispatchInitialRenderEvent();
|
|
175
|
-
}, 0);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
__decorate([n({ type: Boolean })], PresenceToggle.prototype, "visible", null), __decorate([n({ attribute: !1 })], PresenceToggle.prototype, "styles", null);
|
|
179
|
-
var LineLoaderUi = class extends LitBlock {
|
|
180
|
-
constructor(...p) {
|
|
181
|
-
super(...p), this.active = !1, this._lineRef = e(), this._isAnimating = !1, this._handleTransitionEndRight = () => {
|
|
182
|
-
let p = this._lineRef.value;
|
|
183
|
-
p && (this._resetLine(p), this._isAnimating && this.active && this._start());
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
firstUpdated(p) {
|
|
187
|
-
super.firstUpdated(p), this.active && this._start();
|
|
188
|
-
}
|
|
189
|
-
updated(p) {
|
|
190
|
-
super.updated(p), p.has("active") && (this.active ? this._start() : this._stop());
|
|
191
|
-
}
|
|
192
|
-
_start() {
|
|
193
|
-
let p = this._lineRef.value;
|
|
194
|
-
if (!p) return;
|
|
195
|
-
this._isAnimating = !0;
|
|
196
|
-
let { width: B } = this.getBoundingClientRect();
|
|
197
|
-
p.removeEventListener("transitionend", this._handleTransitionEndRight), p.style.transition = "transform 1s", p.style.opacity = "1", p.style.transform = `translateX(${B}px)`, p.addEventListener("transitionend", this._handleTransitionEndRight, { once: !0 });
|
|
198
|
-
}
|
|
199
|
-
_stop() {
|
|
200
|
-
let p = this._lineRef.value;
|
|
201
|
-
p && (this._isAnimating = !1, p.removeEventListener("transitionend", this._handleTransitionEndRight), this._resetLine(p));
|
|
202
|
-
}
|
|
203
|
-
_resetLine(p) {
|
|
204
|
-
p.style.transition = "initial", p.style.opacity = "0", p.style.transform = "translateX(-101%)";
|
|
205
|
-
}
|
|
206
|
-
render() {
|
|
207
|
-
return b`
|
|
208
|
-
<div class="uc-inner">
|
|
209
|
-
<div class="uc-line" ${n$1(this._lineRef)}></div>
|
|
210
|
-
</div>
|
|
211
|
-
`;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
__decorate([n({
|
|
215
|
-
type: Boolean,
|
|
216
|
-
reflect: !0
|
|
217
|
-
})], LineLoaderUi.prototype, "active", void 0);
|
|
218
|
-
/**
|
|
219
|
-
* @license
|
|
220
|
-
* Copyright 2018 Google LLC
|
|
221
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
222
|
-
*/ var e$1 = e$2(class extends i {
|
|
223
|
-
constructor(p) {
|
|
224
|
-
if (super(p), p.type !== t.ATTRIBUTE || p.name !== "class" || p.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
225
|
-
}
|
|
226
|
-
render(p) {
|
|
227
|
-
return " " + Object.keys(p).filter((B) => p[B]).join(" ") + " ";
|
|
228
|
-
}
|
|
229
|
-
update(p, [B]) {
|
|
230
|
-
if (this.st === void 0) {
|
|
231
|
-
for (let V in this.st = /* @__PURE__ */ new Set(), p.strings !== void 0 && (this.nt = new Set(p.strings.join(" ").split(/\s/).filter((p) => p !== ""))), B) B[V] && !this.nt?.has(V) && this.st.add(V);
|
|
232
|
-
return this.render(B);
|
|
233
|
-
}
|
|
234
|
-
let V = p.element.classList;
|
|
235
|
-
for (let p of this.st) p in B || (V.remove(p), this.st.delete(p));
|
|
236
|
-
for (let p in B) {
|
|
237
|
-
let H = !!B[p];
|
|
238
|
-
H === this.st.has(p) || this.nt?.has(p) || (H ? (V.add(p), this.st.add(p)) : (V.remove(p), this.st.delete(p)));
|
|
239
|
-
}
|
|
240
|
-
return E;
|
|
241
|
-
}
|
|
242
|
-
}), BtnUi = class extends LitBlock {
|
|
243
|
-
constructor(...p) {
|
|
244
|
-
super(...p), this.text = "", this.icon = "", this.reverse = !1, this.theme = "default", this.ariaRole = void 0, this.ariaControls = "", this.titleProp = "", this.active = !1;
|
|
245
|
-
}
|
|
246
|
-
firstUpdated(p) {
|
|
247
|
-
super.firstUpdated(p), this._applyReverse(), this._applyThemeClass();
|
|
248
|
-
}
|
|
249
|
-
updated(p) {
|
|
250
|
-
super.updated(p), p.has("reverse") && this._applyReverse(), p.has("theme") && this._applyThemeClass();
|
|
251
|
-
}
|
|
252
|
-
_applyReverse() {
|
|
253
|
-
this.style.flexDirection = this.reverse ? "row-reverse" : "";
|
|
254
|
-
}
|
|
255
|
-
_applyThemeClass() {
|
|
256
|
-
this.theme && this.theme !== "custom" && (this.className = `uc-${this.theme}`);
|
|
257
|
-
}
|
|
258
|
-
get _iconClassMap() {
|
|
259
|
-
let p = this._computedIconHidden;
|
|
260
|
-
return {
|
|
261
|
-
"uc-icon": !0,
|
|
262
|
-
"uc-icon_left": !this.reverse,
|
|
263
|
-
"uc-icon_right": this.reverse,
|
|
264
|
-
"uc-icon_hidden": p,
|
|
265
|
-
"uc-icon_single": this._computedIconSingle
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
get _computedIconHidden() {
|
|
269
|
-
return !this.icon;
|
|
270
|
-
}
|
|
271
|
-
get _computedIconSingle() {
|
|
272
|
-
return !this.text && !this._computedIconHidden;
|
|
273
|
-
}
|
|
274
|
-
render() {
|
|
275
|
-
return b`
|
|
276
|
-
<button
|
|
277
|
-
type="button"
|
|
278
|
-
role=${o$2(this.ariaRole || void 0)}
|
|
279
|
-
aria-controls=${o$2(this.ariaControls || void 0)}
|
|
280
|
-
aria-label=${o$2(this.l10n(this.titleProp))}
|
|
281
|
-
title=${o$2(this.l10n(this.titleProp))}
|
|
282
|
-
>
|
|
283
|
-
<uc-icon
|
|
284
|
-
class=${e$1(this._iconClassMap)}
|
|
285
|
-
name=${o$2(this.icon || void 0)}
|
|
286
|
-
?hidden=${this._computedIconHidden}
|
|
287
|
-
></uc-icon>
|
|
288
|
-
<div class="uc-text">${this.text}</div>
|
|
289
|
-
</button>
|
|
290
|
-
`;
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
__decorate([n({ type: String })], BtnUi.prototype, "text", void 0), __decorate([n({ type: String })], BtnUi.prototype, "icon", void 0), __decorate([n({
|
|
294
|
-
type: Boolean,
|
|
295
|
-
reflect: !0
|
|
296
|
-
})], BtnUi.prototype, "reverse", void 0), __decorate([n({
|
|
297
|
-
type: String,
|
|
298
|
-
reflect: !0
|
|
299
|
-
})], BtnUi.prototype, "theme", void 0), __decorate([n({ attribute: "aria-role" })], BtnUi.prototype, "ariaRole", void 0), __decorate([n({ attribute: "aria-controls" })], BtnUi.prototype, "ariaControls", void 0), __decorate([n({ attribute: "title-prop" })], BtnUi.prototype, "titleProp", void 0), __decorate([n({
|
|
300
|
-
type: Boolean,
|
|
301
|
-
noAccessor: !0
|
|
302
|
-
})], BtnUi.prototype, "active", void 0);
|
|
303
|
-
function pick(p, B) {
|
|
304
|
-
let V = {};
|
|
305
|
-
for (let H of B) {
|
|
306
|
-
let B = p[H];
|
|
307
|
-
(Object.hasOwn(p, H) || B !== void 0) && (V[H] = B);
|
|
308
|
-
}
|
|
309
|
-
return V;
|
|
310
|
-
}
|
|
311
|
-
function viewerImageSrc(p, B, V) {
|
|
312
|
-
let H = window.devicePixelRatio, U = Math.min(Math.ceil(B * H), 3e3), W = H >= 2 ? "lightest" : "normal";
|
|
313
|
-
return createCdnUrl(p, createCdnUrlModifiers(COMMON_OPERATIONS, transformationsToOperations(V), `quality/${W}`, `stretch/off/-/resize/${U}x`, `@clib/${PACKAGE_NAME}/${PACKAGE_VERSION}/uc-cloud-image-editor/`));
|
|
314
|
-
}
|
|
315
|
-
var CropFrame = class extends LitBlock {
|
|
316
|
-
constructor(...p) {
|
|
317
|
-
super(...p), this._backdropMaskId = `uc-backdrop-mask-${UID.generateFastUid()}`, this._guidesHidden = !1, this._draggingValue = !1, this._svgRef = e(), this._svgReady = !1, this._pendingMaskHref = null, this._handlePointerUp = (p) => {
|
|
318
|
-
this._updateCursor(), this._dragging &&= (p.stopPropagation(), p.preventDefault(), !1);
|
|
319
|
-
}, this._handlePointerMove = (p) => {
|
|
320
|
-
if (!this._dragging || !this._dragStartPoint || !this._draggingThumb) return;
|
|
321
|
-
p.stopPropagation(), p.preventDefault();
|
|
322
|
-
let B = this._svgElement;
|
|
323
|
-
if (!B) return;
|
|
324
|
-
let { x: V, y: H } = B.getBoundingClientRect(), U = p.x - V, W = p.y - H, G = U - this._dragStartPoint[0], K = W - this._dragStartPoint[1], { direction: q } = this._draggingThumb, J = this._calcCropBox(q, [G, K]);
|
|
325
|
-
J && (this.$["*cropBox"] = J);
|
|
326
|
-
}, this._handleSvgPointerMove = (p) => {
|
|
327
|
-
this._frameThumbs && (this._hoverThumb = Object.values(this._frameThumbs).find((B) => {
|
|
328
|
-
if (!B || this._shouldThumbBeDisabled(B.direction)) return !1;
|
|
329
|
-
let V = B.interactionNode.getBoundingClientRect();
|
|
330
|
-
return rectContainsPoint({
|
|
331
|
-
x: V.x,
|
|
332
|
-
y: V.y,
|
|
333
|
-
width: V.width,
|
|
334
|
-
height: V.height
|
|
335
|
-
}, [p.x, p.y]);
|
|
336
|
-
}), this._updateCursor());
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
get _svgElement() {
|
|
340
|
-
return this._svgRef.value ?? null;
|
|
341
|
-
}
|
|
342
|
-
get _dragging() {
|
|
343
|
-
return this._draggingValue;
|
|
344
|
-
}
|
|
345
|
-
set _dragging(p) {
|
|
346
|
-
this._draggingValue !== p && (this._draggingValue = p, this._applyGuidesDragState());
|
|
347
|
-
}
|
|
348
|
-
_applyGuidesDragState() {
|
|
349
|
-
this._frameGuides && this._frameGuides.setAttribute("class", classNames({
|
|
350
|
-
"uc-guides--hidden": this._guidesHidden,
|
|
351
|
-
"uc-guides--visible": !this._guidesHidden && this._draggingValue,
|
|
352
|
-
"uc-guides--semi-hidden": !this._guidesHidden && !this._draggingValue
|
|
353
|
-
}));
|
|
354
|
-
}
|
|
355
|
-
_shouldThumbBeDisabled(p) {
|
|
356
|
-
let B = this.$["*imageBox"];
|
|
357
|
-
if (!B) return !1;
|
|
358
|
-
if (p === "" && B.height <= 1 && B.width <= 1) return !0;
|
|
359
|
-
let V = B.height <= 1 && (p.includes("n") || p.includes("s")), H = B.width <= 1 && (p.includes("e") || p.includes("w"));
|
|
360
|
-
return V || H;
|
|
361
|
-
}
|
|
362
|
-
_createBackdrop() {
|
|
363
|
-
let p = this.$["*cropBox"];
|
|
364
|
-
if (!p) return;
|
|
365
|
-
let { x: B, y: V, width: H, height: U } = p, W = this._svgElement;
|
|
366
|
-
if (!W) return;
|
|
367
|
-
let G = createSvgNode("mask", { id: this._backdropMaskId }), K = createSvgNode("rect", {
|
|
368
|
-
x: 0,
|
|
369
|
-
y: 0,
|
|
370
|
-
width: "100%",
|
|
371
|
-
height: "100%",
|
|
372
|
-
fill: "white"
|
|
373
|
-
}), q = createSvgNode("rect", {
|
|
374
|
-
x: B,
|
|
375
|
-
y: V,
|
|
376
|
-
width: H,
|
|
377
|
-
height: U,
|
|
378
|
-
fill: "black"
|
|
379
|
-
});
|
|
380
|
-
G.appendChild(K), G.appendChild(q);
|
|
381
|
-
let J = createSvgNode("rect", {
|
|
382
|
-
x: 0,
|
|
383
|
-
y: 0,
|
|
384
|
-
width: "100%",
|
|
385
|
-
height: "100%",
|
|
386
|
-
fill: "var(--color-image-background)",
|
|
387
|
-
"fill-opacity": .85,
|
|
388
|
-
mask: `url(#${this._backdropMaskId})`
|
|
389
|
-
});
|
|
390
|
-
W.appendChild(J), W.appendChild(G), this._backdropMask = G, this._backdropMaskInner = q;
|
|
391
|
-
}
|
|
392
|
-
_resizeBackdrop() {
|
|
393
|
-
this._backdropMask && (this._backdropMask.style.display = "none", window.requestAnimationFrame(() => {
|
|
394
|
-
this._backdropMask && (this._backdropMask.style.display = "block");
|
|
395
|
-
}));
|
|
396
|
-
}
|
|
397
|
-
_updateBackdrop() {
|
|
398
|
-
let p = this.$["*cropBox"];
|
|
399
|
-
if (!p) return;
|
|
400
|
-
let { x: B, y: V, width: H, height: W } = p;
|
|
401
|
-
this._backdropMaskInner && setSvgNodeAttrs(this._backdropMaskInner, {
|
|
402
|
-
x: B,
|
|
403
|
-
y: V,
|
|
404
|
-
width: H,
|
|
405
|
-
height: W
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
_updateFrame() {
|
|
409
|
-
let p = this.$["*cropBox"];
|
|
410
|
-
if (!(!p || !this._frameGuides || !this._frameThumbs)) {
|
|
411
|
-
for (let B of Object.values(this._frameThumbs)) {
|
|
412
|
-
if (!B) continue;
|
|
413
|
-
let { direction: V, pathNode: H, interactionNode: W, groupNode: G } = B, K = V === "", q = V.length === 2, { x: J, y: Y, width: X, height: Z } = p;
|
|
414
|
-
if (K) setSvgNodeAttrs(W, {
|
|
415
|
-
x: J,
|
|
416
|
-
y: Y,
|
|
417
|
-
width: X,
|
|
418
|
-
height: Z
|
|
419
|
-
});
|
|
420
|
-
else {
|
|
421
|
-
let B = clamp(Math.min(X, Z) / 82 / 2, 0, 1), G = q ? cornerPath(p, V, B) : sidePath(p, V, B), K = G.center;
|
|
422
|
-
if (!K) continue;
|
|
423
|
-
let J = Math.max(24 * clamp(Math.min(X, Z) / 24 / 3, 0, 1), 6);
|
|
424
|
-
setSvgNodeAttrs(W, {
|
|
425
|
-
x: K[0] - J,
|
|
426
|
-
y: K[1] - J,
|
|
427
|
-
width: J * 2,
|
|
428
|
-
height: J * 2
|
|
429
|
-
}), setSvgNodeAttrs(H, { d: G.d });
|
|
430
|
-
}
|
|
431
|
-
let Q = this._shouldThumbBeDisabled(V);
|
|
432
|
-
G.setAttribute("class", classNames("uc-thumb", {
|
|
433
|
-
"uc-thumb--hidden": Q,
|
|
434
|
-
"uc-thumb--visible": !Q
|
|
435
|
-
}));
|
|
436
|
-
}
|
|
437
|
-
setSvgNodeAttrs(this._frameGuides, {
|
|
438
|
-
x: p.x - 1 * .5,
|
|
439
|
-
y: p.y - 1 * .5,
|
|
440
|
-
width: p.width + 1,
|
|
441
|
-
height: p.height + 1
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
_createThumb(p, B) {
|
|
446
|
-
let V = createSvgNode("g");
|
|
447
|
-
V.classList.add("uc-thumb"), V.setAttribute("with-effects", "");
|
|
448
|
-
let H = createSvgNode("rect", { fill: "transparent" }), U = createSvgNode("path", {
|
|
449
|
-
stroke: "currentColor",
|
|
450
|
-
fill: "none",
|
|
451
|
-
"stroke-width": 3
|
|
452
|
-
});
|
|
453
|
-
V.appendChild(U), V.appendChild(H), p[B] = {
|
|
454
|
-
direction: B,
|
|
455
|
-
pathNode: U,
|
|
456
|
-
interactionNode: H,
|
|
457
|
-
groupNode: V
|
|
458
|
-
}, B === "" && (V.style.cursor = "move"), H.addEventListener("pointerdown", this._handlePointerDown.bind(this, B));
|
|
459
|
-
}
|
|
460
|
-
_createThumbs() {
|
|
461
|
-
let p = {};
|
|
462
|
-
for (let B = 0; B < 3; B++) for (let V = 0; V < 3; V++) {
|
|
463
|
-
let H = `${[
|
|
464
|
-
"n",
|
|
465
|
-
"",
|
|
466
|
-
"s"
|
|
467
|
-
][B]}${[
|
|
468
|
-
"w",
|
|
469
|
-
"",
|
|
470
|
-
"e"
|
|
471
|
-
][V]}`;
|
|
472
|
-
H !== "" && this._createThumb(p, H);
|
|
473
|
-
}
|
|
474
|
-
return this._createThumb(p, ""), p;
|
|
475
|
-
}
|
|
476
|
-
_createGuides() {
|
|
477
|
-
let p = createSvgNode("svg"), B = createSvgNode("rect", {
|
|
478
|
-
x: 0,
|
|
479
|
-
y: 0,
|
|
480
|
-
width: "100%",
|
|
481
|
-
height: "100%",
|
|
482
|
-
fill: "none",
|
|
483
|
-
stroke: "currentColor",
|
|
484
|
-
"stroke-width": 1,
|
|
485
|
-
"stroke-opacity": .5
|
|
486
|
-
});
|
|
487
|
-
p.appendChild(B);
|
|
488
|
-
for (let B = 1; B <= 2; B++) {
|
|
489
|
-
let V = createSvgNode("line", {
|
|
490
|
-
x1: `${GUIDE_THIRD * B}%`,
|
|
491
|
-
y1: "0%",
|
|
492
|
-
x2: `${GUIDE_THIRD * B}%`,
|
|
493
|
-
y2: "100%",
|
|
494
|
-
stroke: "currentColor",
|
|
495
|
-
"stroke-width": 1,
|
|
496
|
-
"stroke-opacity": .3
|
|
497
|
-
});
|
|
498
|
-
p.appendChild(V);
|
|
499
|
-
}
|
|
500
|
-
for (let B = 1; B <= 2; B++) {
|
|
501
|
-
let V = createSvgNode("line", {
|
|
502
|
-
x1: "0%",
|
|
503
|
-
y1: `${GUIDE_THIRD * B}%`,
|
|
504
|
-
x2: "100%",
|
|
505
|
-
y2: `${GUIDE_THIRD * B}%`,
|
|
506
|
-
stroke: "currentColor",
|
|
507
|
-
"stroke-width": 1,
|
|
508
|
-
"stroke-opacity": .3
|
|
509
|
-
});
|
|
510
|
-
p.appendChild(V);
|
|
511
|
-
}
|
|
512
|
-
return p.classList.add("uc-guides", "uc-guides--semi-hidden"), p;
|
|
513
|
-
}
|
|
514
|
-
_createFrame() {
|
|
515
|
-
let p = this._svgElement;
|
|
516
|
-
if (!p) return;
|
|
517
|
-
let B = document.createDocumentFragment(), V = this._createGuides();
|
|
518
|
-
B.appendChild(V);
|
|
519
|
-
let H = this._createThumbs();
|
|
520
|
-
for (let { groupNode: p } of Object.values(H)) B.appendChild(p);
|
|
521
|
-
p.appendChild(B), this._frameThumbs = H, this._frameGuides = V, this._applyGuidesDragState();
|
|
522
|
-
}
|
|
523
|
-
_handlePointerDown(p, B) {
|
|
524
|
-
if (!this._frameThumbs) return;
|
|
525
|
-
let V = this._frameThumbs[p];
|
|
526
|
-
if (!V || this._shouldThumbBeDisabled(p)) return;
|
|
527
|
-
let H = this.$["*cropBox"], U = this._svgElement;
|
|
528
|
-
if (!U) return;
|
|
529
|
-
let { x: W, y: G } = U.getBoundingClientRect(), K = B.x - W, q = B.y - G;
|
|
530
|
-
this._dragging = !0, this._draggingThumb = V, this._dragStartPoint = [K, q], this._dragStartCrop = { ...H };
|
|
531
|
-
}
|
|
532
|
-
_calcCropBox(p, B) {
|
|
533
|
-
let [V, H] = B, U = this.$["*imageBox"], W = this._dragStartCrop ?? this.$["*cropBox"], G = this.$["*currentAspectRatio"], K = G ? G.width / G.height : void 0;
|
|
534
|
-
if (W = p === "" ? moveRect({
|
|
535
|
-
rect: W,
|
|
536
|
-
delta: [V, H],
|
|
537
|
-
imageBox: U
|
|
538
|
-
}) : resizeRect({
|
|
539
|
-
rect: W,
|
|
540
|
-
delta: [V, H],
|
|
541
|
-
direction: p,
|
|
542
|
-
aspectRatio: K,
|
|
543
|
-
imageBox: U
|
|
544
|
-
}), !Object.values(W).every((p) => Number.isFinite(p) && p >= 0)) {
|
|
545
|
-
console.error("CropFrame is trying to create invalid rectangle", { payload: W });
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
return constraintRect(roundRect(W), U);
|
|
549
|
-
}
|
|
550
|
-
_updateCursor() {
|
|
551
|
-
let p = this._hoverThumb, B = this._svgElement;
|
|
552
|
-
B && (B.style.cursor = p ? thumbCursor(p.direction) : "initial");
|
|
553
|
-
}
|
|
554
|
-
_createMask(p) {
|
|
555
|
-
if (this._frameImage) {
|
|
556
|
-
this._frameImage.setAttribute("href", p);
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
let B = this._svgElement;
|
|
560
|
-
if (!B) {
|
|
561
|
-
this._pendingMaskHref = p;
|
|
562
|
-
return;
|
|
563
|
-
}
|
|
564
|
-
this._pendingMaskHref = null;
|
|
565
|
-
let V = document.createDocumentFragment(), H = createSvgNode("image", { href: p });
|
|
566
|
-
H.setAttribute("class", "uc-cloud-mask"), V.appendChild(H), B.appendChild(V), this._frameImage = H;
|
|
567
|
-
}
|
|
568
|
-
_updateMask() {
|
|
569
|
-
let p = this.$["*cropBox"];
|
|
570
|
-
if (!p || !this._frameImage) return;
|
|
571
|
-
let { x: B, y: V, width: H, height: W } = p;
|
|
572
|
-
setSvgNodeAttrs(this._frameImage, {
|
|
573
|
-
x: B,
|
|
574
|
-
y: V,
|
|
575
|
-
height: W,
|
|
576
|
-
width: H
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
_render() {
|
|
580
|
-
this._svgReady && (this._updateBackdrop(), this._updateFrame(), this._updateMask());
|
|
581
|
-
}
|
|
582
|
-
toggleThumbs(p) {
|
|
583
|
-
if (this._frameThumbs) for (let B of Object.values(this._frameThumbs)) {
|
|
584
|
-
if (!B) continue;
|
|
585
|
-
let { groupNode: V } = B;
|
|
586
|
-
V.setAttribute("class", classNames("uc-thumb", {
|
|
587
|
-
"uc-thumb--hidden": !p,
|
|
588
|
-
"uc-thumb--visible": p
|
|
589
|
-
}));
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
initCallback() {
|
|
593
|
-
super.initCallback(), this.sub("*imageBox", () => {
|
|
594
|
-
this._resizeBackdrop(), this._svgReady && window.requestAnimationFrame(() => {
|
|
595
|
-
this._render();
|
|
596
|
-
});
|
|
597
|
-
}), this.sub("*cropBox", (p) => {
|
|
598
|
-
p && (this._guidesHidden = p.height <= 1 || p.width <= 1, this._applyGuidesDragState(), this._svgReady && window.requestAnimationFrame(() => {
|
|
599
|
-
this._render();
|
|
600
|
-
}));
|
|
601
|
-
}), this.subConfigValue("cloudImageEditorMaskHref", (p) => {
|
|
602
|
-
p && this._createMask(p);
|
|
603
|
-
}), document.addEventListener("pointermove", this._handlePointerMove, !0), document.addEventListener("pointerup", this._handlePointerUp, !0);
|
|
604
|
-
}
|
|
605
|
-
firstUpdated(p) {
|
|
606
|
-
super.firstUpdated(p), this._initializeSvg();
|
|
607
|
-
}
|
|
608
|
-
_initializeSvg() {
|
|
609
|
-
let p = this._svgElement;
|
|
610
|
-
if (!(!p || this._svgReady)) {
|
|
611
|
-
if (this._createBackdrop(), this._createFrame(), this._svgReady = !0, p.addEventListener("pointermove", this._handleSvgPointerMove, !0), this._pendingMaskHref) {
|
|
612
|
-
let p = this._pendingMaskHref;
|
|
613
|
-
this._pendingMaskHref = null, this._createMask(p);
|
|
614
|
-
}
|
|
615
|
-
this._render();
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
disconnectedCallback() {
|
|
619
|
-
super.disconnectedCallback(), this._svgElement?.removeEventListener("pointermove", this._handleSvgPointerMove, !0), document.removeEventListener("pointermove", this._handlePointerMove, !0), document.removeEventListener("pointerup", this._handlePointerUp, !0);
|
|
620
|
-
}
|
|
621
|
-
render() {
|
|
622
|
-
return b`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${n$1(this._svgRef)}></svg>`;
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
__decorate([r()], CropFrame.prototype, "_draggingValue", void 0);
|
|
626
|
-
function validateCrop(p) {
|
|
627
|
-
return p ? [({ dimensions: p, coords: B }) => [...p, ...B].every((p) => Number.isInteger(p) && Number.isFinite(p)), ({ dimensions: p, coords: B }) => p.every((p) => p > 0) && B.every((p) => p >= 0)].every((B) => B(p)) : !0;
|
|
628
|
-
}
|
|
629
|
-
var EditorImageCropper = class extends LitBlock {
|
|
630
|
-
constructor() {
|
|
631
|
-
super(), this.ctxOwner = !0, this._imageSize = {
|
|
632
|
-
width: 0,
|
|
633
|
-
height: 0
|
|
634
|
-
}, this._ctx = null, this._isActive = !1, this._image = null, this._canvasRef = e(), this._frameRef = e(), this.init$ = {
|
|
635
|
-
...this.init$,
|
|
636
|
-
"*padding": 20,
|
|
637
|
-
"*operations": {
|
|
638
|
-
rotate: 0,
|
|
639
|
-
mirror: !1,
|
|
640
|
-
flip: !1
|
|
641
|
-
},
|
|
642
|
-
"*imageBox": {
|
|
643
|
-
x: 0,
|
|
644
|
-
y: 0,
|
|
645
|
-
width: 0,
|
|
646
|
-
height: 0
|
|
647
|
-
},
|
|
648
|
-
"*cropBox": {
|
|
649
|
-
x: 0,
|
|
650
|
-
y: 0,
|
|
651
|
-
width: 0,
|
|
652
|
-
height: 0
|
|
653
|
-
}
|
|
654
|
-
}, this._commitDebounced = debounce(this._commit.bind(this), 300), this._handleResizeThrottled = throttle(() => {
|
|
655
|
-
!this.isConnected || !this._isActive || (this._initCanvas(), this._syncTransformations(), this._alignImage(), this._alignCrop(), this._draw());
|
|
656
|
-
}, 100);
|
|
657
|
-
}
|
|
658
|
-
firstUpdated(p) {
|
|
659
|
-
super.firstUpdated(p), this._initCanvas();
|
|
660
|
-
}
|
|
661
|
-
_syncTransformations() {
|
|
662
|
-
let p = this.$["*editorTransformations"], B = pick(p, Object.keys(this.$["*operations"])), V = {
|
|
663
|
-
...this.$["*operations"],
|
|
664
|
-
...B
|
|
665
|
-
};
|
|
666
|
-
this.$["*operations"] = V;
|
|
667
|
-
}
|
|
668
|
-
_initCanvas() {
|
|
669
|
-
let p = this._canvasRef.value;
|
|
670
|
-
if (!p) return;
|
|
671
|
-
let B = p.getContext("2d"), V = this.offsetWidth, H = this.offsetHeight, U = window.devicePixelRatio;
|
|
672
|
-
p.style.width = `${V}px`, p.style.height = `${H}px`, p.width = V * U, p.height = H * U, B?.scale(U, U), this._canvas = p, this._ctx = B;
|
|
673
|
-
}
|
|
674
|
-
_alignImage() {
|
|
675
|
-
if (!this._isActive || !this._image) return;
|
|
676
|
-
let p = this._image, B = this.$["*padding"], { rotate: V } = this.$["*operations"], H = {
|
|
677
|
-
width: this.offsetWidth,
|
|
678
|
-
height: this.offsetHeight
|
|
679
|
-
}, U = rotateSize({
|
|
680
|
-
width: p.naturalWidth,
|
|
681
|
-
height: p.naturalHeight
|
|
682
|
-
}, V), W;
|
|
683
|
-
if (U.width > H.width - B * 2 || U.height > H.height - B * 2) {
|
|
684
|
-
let p = U.width / U.height;
|
|
685
|
-
if (p > H.width / H.height) {
|
|
686
|
-
let V = H.width - B * 2, U = V / p;
|
|
687
|
-
W = {
|
|
688
|
-
x: 0 + B,
|
|
689
|
-
y: B + (H.height - B * 2) / 2 - U / 2,
|
|
690
|
-
width: V,
|
|
691
|
-
height: U
|
|
692
|
-
};
|
|
693
|
-
} else {
|
|
694
|
-
let V = H.height - B * 2, U = V * p;
|
|
695
|
-
W = {
|
|
696
|
-
x: B + (H.width - B * 2) / 2 - U / 2,
|
|
697
|
-
y: 0 + B,
|
|
698
|
-
width: U,
|
|
699
|
-
height: V
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
} else {
|
|
703
|
-
let { width: p, height: V } = U;
|
|
704
|
-
W = {
|
|
705
|
-
x: B + (H.width - B * 2) / 2 - p / 2,
|
|
706
|
-
y: B + (H.height - B * 2) / 2 - V / 2,
|
|
707
|
-
width: p,
|
|
708
|
-
height: V
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
this.$["*imageBox"] = roundRect(W);
|
|
712
|
-
}
|
|
713
|
-
_alignCrop() {
|
|
714
|
-
let p = this.$["*cropBox"], B = this.$["*imageBox"], { rotate: V } = this.$["*operations"], H = this.$["*editorTransformations"].crop, { width: U, x: W, y: G } = B;
|
|
715
|
-
if (H) {
|
|
716
|
-
let { dimensions: [K, q], coords: [J, Y] } = H, { width: X } = rotateSize(this._imageSize, V), Z = U / X;
|
|
717
|
-
p = constraintRect(roundRect({
|
|
718
|
-
x: W + J * Z,
|
|
719
|
-
y: G + Y * Z,
|
|
720
|
-
width: K * Z,
|
|
721
|
-
height: q * Z
|
|
722
|
-
}), B);
|
|
723
|
-
}
|
|
724
|
-
let K = this.$["*currentAspectRatio"], q = K ? K.width / K.height : void 0;
|
|
725
|
-
if (!isRectInsideRect(p, B) || q && !isRectMatchesAspectRatio(p, q)) {
|
|
726
|
-
let V = B.width / B.height, H = B.width, U = B.height;
|
|
727
|
-
q && (V > q ? H = Math.min(B.height * q, B.width) : U = Math.min(B.width / q, B.height)), p = {
|
|
728
|
-
x: B.x + B.width / 2 - H / 2,
|
|
729
|
-
y: B.y + B.height / 2 - U / 2,
|
|
730
|
-
width: H,
|
|
731
|
-
height: U
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
this.$["*cropBox"] = constraintRect(roundRect(p), B);
|
|
735
|
-
}
|
|
736
|
-
_drawImage() {
|
|
737
|
-
let p = this._ctx;
|
|
738
|
-
if (!p) return;
|
|
739
|
-
let B = this._image;
|
|
740
|
-
if (!B) return;
|
|
741
|
-
let V = this.$["*imageBox"], { mirror: H, flip: U, rotate: W } = this.$["*operations"], G = rotateSize({
|
|
742
|
-
width: V.width,
|
|
743
|
-
height: V.height
|
|
744
|
-
}, W);
|
|
745
|
-
p.save(), p.translate(V.x + V.width / 2, V.y + V.height / 2), p.rotate(W * Math.PI * -1 / 180), p.scale(H ? -1 : 1, U ? -1 : 1), p.drawImage(B, -G.width / 2, -G.height / 2, G.width, G.height), p.restore();
|
|
746
|
-
}
|
|
747
|
-
_draw() {
|
|
748
|
-
if (!this._isActive || !this._image || !this._canvas || !this._ctx) return;
|
|
749
|
-
let p = this._canvas;
|
|
750
|
-
this._ctx.clearRect(0, 0, p.width, p.height), this._drawImage();
|
|
751
|
-
}
|
|
752
|
-
_animateIn({ fromViewer: p }) {
|
|
753
|
-
this._image && (this._frameRef.value?.toggleThumbs(!0), this._transitionToImage(), setTimeout(() => {
|
|
754
|
-
this.className = classNames({
|
|
755
|
-
"uc-active_from_viewer": p,
|
|
756
|
-
"uc-active_from_editor": !p,
|
|
757
|
-
"uc-inactive_to_editor": !1
|
|
758
|
-
});
|
|
759
|
-
}));
|
|
760
|
-
}
|
|
761
|
-
_getCropDimensions() {
|
|
762
|
-
let p = this.$["*cropBox"], B = this.$["*imageBox"], { rotate: V } = this.$["*operations"], { width: H, height: U } = B, { width: W, height: G } = rotateSize(this._imageSize, V), { width: K, height: q } = p, J = H / W, Y = U / G;
|
|
763
|
-
return [clamp(Math.round(K / J), 1, W), clamp(Math.round(q / Y), 1, G)];
|
|
764
|
-
}
|
|
765
|
-
_getCropTransformation() {
|
|
766
|
-
let p = this.$["*cropBox"], B = this.$["*imageBox"], { rotate: V } = this.$["*operations"], { width: H, height: U, x: W, y: G } = B, { width: K, height: q } = rotateSize(this._imageSize, V), { x: J, y: Y } = p, X = H / K, Z = U / q, Q = this._getCropDimensions(), $ = {
|
|
767
|
-
dimensions: Q,
|
|
768
|
-
coords: [clamp(Math.round((J - W) / X), 0, K - Q[0]), clamp(Math.round((Y - G) / Z), 0, q - Q[1])]
|
|
769
|
-
};
|
|
770
|
-
if (!validateCrop($)) {
|
|
771
|
-
console.error("Cropper is trying to create invalid crop object", { payload: $ });
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
if (!(Q[0] === K && Q[1] === q)) return $;
|
|
775
|
-
}
|
|
776
|
-
_commit() {
|
|
777
|
-
if (!this.isConnected || !this._imageSize) return;
|
|
778
|
-
let { rotate: p, mirror: B, flip: V } = this.$["*operations"], H = this._getCropTransformation(), U = {
|
|
779
|
-
...this.$["*editorTransformations"],
|
|
780
|
-
crop: H,
|
|
781
|
-
rotate: p,
|
|
782
|
-
mirror: B,
|
|
783
|
-
flip: V
|
|
784
|
-
};
|
|
785
|
-
this.$["*editorTransformations"] = U;
|
|
786
|
-
}
|
|
787
|
-
setValue(p, B) {
|
|
788
|
-
this.$["*operations"] = {
|
|
789
|
-
...this.$["*operations"],
|
|
790
|
-
[p]: B
|
|
791
|
-
}, this._isActive && (this._alignImage(), this._alignCrop(), this._draw());
|
|
792
|
-
}
|
|
793
|
-
getValue(p) {
|
|
794
|
-
return this.$["*operations"][p];
|
|
795
|
-
}
|
|
796
|
-
async activate(p, { fromViewer: B } = {}) {
|
|
797
|
-
if (!this._isActive) {
|
|
798
|
-
this._isActive = !0, await this.updateComplete, this._initCanvas(), this._imageSize = p, this.removeEventListener("transitionend", this._reset);
|
|
799
|
-
try {
|
|
800
|
-
let p = this.$["*originalUrl"], V = this.$["*editorTransformations"];
|
|
801
|
-
this._image = await this._waitForImage(p, V), this._syncTransformations(), this._handleResizeThrottled(), this._animateIn({ fromViewer: B });
|
|
802
|
-
} catch (p) {
|
|
803
|
-
console.error("Failed to activate cropper", { error: p }), this.telemetryManager.sendEventError(p, "cloud editor image. Failed to activate cropper");
|
|
804
|
-
}
|
|
805
|
-
this._observer = new ResizeObserver((p) => {
|
|
806
|
-
let [B] = p;
|
|
807
|
-
B && B.contentRect.width > 0 && B.contentRect.height > 0 && this._isActive && this._image && this._handleResizeThrottled();
|
|
808
|
-
}), this._observer.observe(this);
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
deactivate({ reset: p = !1 } = {}) {
|
|
812
|
-
this._isActive && (!p && this._commit(), this._isActive = !1, this._transitionToCrop(), this.className = classNames({
|
|
813
|
-
"uc-active_from_viewer": !1,
|
|
814
|
-
"uc-active_from_editor": !1,
|
|
815
|
-
"uc-inactive_to_editor": !0
|
|
816
|
-
}), this._frameRef.value?.toggleThumbs(!1), this.addEventListener("transitionend", this._reset, { once: !0 }), this._observer?.disconnect());
|
|
817
|
-
}
|
|
818
|
-
_transitionToCrop() {
|
|
819
|
-
let p = this._getCropDimensions(), B = this.$["*cropBox"], V = Math.min(this.offsetWidth, p[0]) / B.width, H = Math.min(this.offsetHeight, p[1]) / B.height, U = Math.min(V, H), W = B.x + B.width / 2, G = B.y + B.height / 2;
|
|
820
|
-
this.style.transform = `scale(${U}) translate(${(this.offsetWidth / 2 - W) / U}px, ${(this.offsetHeight / 2 - G) / U}px)`, this.style.transformOrigin = `${W}px ${G}px`;
|
|
821
|
-
}
|
|
822
|
-
_transitionToImage() {
|
|
823
|
-
let p = this.$["*cropBox"], B = p.x + p.width / 2, V = p.y + p.height / 2;
|
|
824
|
-
this.style.transform = "scale(1)", this.style.transformOrigin = `${B}px ${V}px`;
|
|
825
|
-
}
|
|
826
|
-
_reset() {
|
|
827
|
-
this._isActive || (this._image = null);
|
|
828
|
-
}
|
|
829
|
-
async _waitForImage(p, B) {
|
|
830
|
-
let V = this.offsetWidth;
|
|
831
|
-
B = {
|
|
832
|
-
...B,
|
|
833
|
-
crop: void 0,
|
|
834
|
-
rotate: void 0,
|
|
835
|
-
flip: void 0,
|
|
836
|
-
mirror: void 0
|
|
837
|
-
};
|
|
838
|
-
let H = await this.proxyUrl(viewerImageSrc(p, V, B)), { promise: U, cancel: W, image: G } = preloadImage(H), K = this._handleImageLoading(H);
|
|
839
|
-
return G.addEventListener("load", K, { once: !0 }), G.addEventListener("error", K, { once: !0 }), this._cancelPreload?.(), this._cancelPreload = W, U.then(() => G).catch((p) => (console.error("Failed to load image", { error: p }), this.$["*networkProblems"] = !0, G));
|
|
840
|
-
}
|
|
841
|
-
_handleImageLoading(p) {
|
|
842
|
-
let B = "crop", V = this.$["*loadingOperations"], H = V.get(B);
|
|
843
|
-
return H || (H = /* @__PURE__ */ new Map(), V.set(B, H)), H.get(p) || (H.set(p, !0), this.$["*loadingOperations"] = V), () => {
|
|
844
|
-
let H = V.get(B);
|
|
845
|
-
H?.has(p) && (H.delete(p), this.$["*loadingOperations"] = V);
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
initCallback() {
|
|
849
|
-
super.initCallback(), this.sub("*imageBox", () => {
|
|
850
|
-
this._draw();
|
|
851
|
-
}), this.sub("*cropBox", () => {
|
|
852
|
-
this._image && this._commitDebounced();
|
|
853
|
-
}), this.sub("*currentAspectRatio", () => {
|
|
854
|
-
this._alignCrop();
|
|
855
|
-
}), setTimeout(() => {
|
|
856
|
-
this.sub("*networkProblems", (p) => {
|
|
857
|
-
p || this._isActive && this._imageSize && this.activate(this._imageSize, { fromViewer: !1 });
|
|
858
|
-
});
|
|
859
|
-
}, 0);
|
|
860
|
-
}
|
|
861
|
-
disconnectedCallback() {
|
|
862
|
-
super.disconnectedCallback(), this._observer?.disconnect(), this._image &&= null;
|
|
863
|
-
}
|
|
864
|
-
render() {
|
|
865
|
-
return b`
|
|
866
|
-
<canvas class="uc-canvas" ${n$1(this._canvasRef)}></canvas>
|
|
867
|
-
<uc-crop-frame ${n$1(this._frameRef)}></uc-crop-frame>
|
|
868
|
-
`;
|
|
869
|
-
}
|
|
870
|
-
};
|
|
871
|
-
__decorate([r()], EditorImageCropper.prototype, "_image", void 0);
|
|
872
|
-
function linspace(p, B, V) {
|
|
873
|
-
let H = V, U = V - 1, W = Array(H);
|
|
874
|
-
for (let V = U; V >= 0; --V) W[V] = Math.ceil((V * B + (U - V) * p) / U);
|
|
875
|
-
return W;
|
|
876
|
-
}
|
|
877
|
-
function isOperationKey(p) {
|
|
878
|
-
return typeof p == "string" && p in COLOR_OPERATIONS_CONFIG;
|
|
879
|
-
}
|
|
880
|
-
function splitBySections(p) {
|
|
881
|
-
let B = [];
|
|
882
|
-
for (let V = 0; V < p.length - 1; V += 1) {
|
|
883
|
-
let H = p[V], U = p[V + 1];
|
|
884
|
-
typeof H == "number" && typeof U == "number" && B.push([H, U]);
|
|
885
|
-
}
|
|
886
|
-
return B;
|
|
887
|
-
}
|
|
888
|
-
function calculateOpacities(p, B, V) {
|
|
889
|
-
let H = splitBySections(p).find(([p, V]) => p <= B && B <= V);
|
|
890
|
-
if (!H) return p.map(() => 0);
|
|
891
|
-
let [U, W] = H;
|
|
892
|
-
return p.map((p) => {
|
|
893
|
-
let H = Math.abs(U - W) || 1, G = Math.abs(B - U) / H;
|
|
894
|
-
return U === p ? B > V ? 1 : 1 - G : W === p ? B >= V ? G : 1 : 0;
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
function calculateZIndices(p, B) {
|
|
898
|
-
return p.map((V, H) => V < B ? p.length - H : H);
|
|
899
|
-
}
|
|
900
|
-
function keypointsRange(p, B) {
|
|
901
|
-
let V = COLOR_OPERATIONS_CONFIG[p].keypointsNumber, { range: H, zero: U } = COLOR_OPERATIONS_CONFIG[p];
|
|
902
|
-
return [...new Set([
|
|
903
|
-
...linspace(H[0], U, V + 1),
|
|
904
|
-
...linspace(U, H[1], V + 1),
|
|
905
|
-
U,
|
|
906
|
-
B
|
|
907
|
-
])].sort((p, B) => p - B);
|
|
908
|
-
}
|
|
909
|
-
var EditorImageFader = class extends LitBlock {
|
|
910
|
-
constructor() {
|
|
911
|
-
super(), this._isActive = !1, this._hidden = !0, this._operation = "initial", this._transformations = {}, this._keypoints = [], this._raf = 0, this._previewHostRef = e(), this._layersHostRef = e(), this.classList.add("uc-inactive_to_cropper"), this._addKeypointDebounced = debounce(async (p, B, V) => {
|
|
912
|
-
let H = () => !this._isSame(p, B) || this._value !== V || !!this._keypoints.find((p) => p.value === V);
|
|
913
|
-
if (H()) return;
|
|
914
|
-
let U = await this._constructKeypoint(p, V), W = new Image();
|
|
915
|
-
W.src = U.src;
|
|
916
|
-
let G = this._handleImageLoading(U.src);
|
|
917
|
-
W.addEventListener("load", G, { once: !0 }), W.addEventListener("error", G, { once: !0 }), U.image = W, W.classList.add("uc-fader-image"), W.addEventListener("load", () => {
|
|
918
|
-
if (H()) return;
|
|
919
|
-
let B = this._keypoints, G = B.findIndex((p) => p.value > V);
|
|
920
|
-
G === -1 && (G = B.length);
|
|
921
|
-
let K = B[G]?.image, q = this._layersHostRef.value;
|
|
922
|
-
!q || K && !q.contains(K) || (B.splice(G, 0, U), K ? q.insertBefore(W, K) : q.appendChild(W), this._update(p, V));
|
|
923
|
-
}, { once: !0 }), W.addEventListener("error", () => {
|
|
924
|
-
this.$["*networkProblems"] = !0;
|
|
925
|
-
}, { once: !0 });
|
|
926
|
-
}, 600);
|
|
927
|
-
}
|
|
928
|
-
_handleImageLoading(p) {
|
|
929
|
-
let B = this._operation, V = this.$["*loadingOperations"];
|
|
930
|
-
V.has(B) || V.set(B, /* @__PURE__ */ new Map());
|
|
931
|
-
let H = V.get(B);
|
|
932
|
-
return H && !H.get(p) && (H.set(p, !0), this.$["*loadingOperations"] = V), () => {
|
|
933
|
-
let H = V.get(B);
|
|
934
|
-
H?.has(p) && (H.delete(p), this.$["*loadingOperations"] = V);
|
|
935
|
-
};
|
|
936
|
-
}
|
|
937
|
-
_flush() {
|
|
938
|
-
window.cancelAnimationFrame(this._raf), this._raf = window.requestAnimationFrame(() => {
|
|
939
|
-
for (let p of this._keypoints) {
|
|
940
|
-
let { image: B } = p;
|
|
941
|
-
B && (B.style.opacity = p.opacity.toString(), B.style.zIndex = p.zIndex.toString());
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
_imageSrc({ url: p = this._url, filter: B = this._filter ?? void 0, operation: V, value: H } = {}) {
|
|
946
|
-
if (!p) throw Error("URL is not defined");
|
|
947
|
-
let U = { ...this._transformations };
|
|
948
|
-
V && (V === "filter" ? B && typeof H == "number" && (U.filter = {
|
|
949
|
-
name: B,
|
|
950
|
-
amount: H
|
|
951
|
-
}) : typeof H == "number" && (U[V] = H));
|
|
952
|
-
let W = this.offsetWidth;
|
|
953
|
-
return this.proxyUrl(viewerImageSrc(p, W, U));
|
|
954
|
-
}
|
|
955
|
-
async _constructKeypoint(p, B) {
|
|
956
|
-
return {
|
|
957
|
-
src: await this._imageSrc({
|
|
958
|
-
operation: p,
|
|
959
|
-
value: B
|
|
960
|
-
}),
|
|
961
|
-
image: void 0,
|
|
962
|
-
opacity: 0,
|
|
963
|
-
zIndex: 0,
|
|
964
|
-
value: B
|
|
965
|
-
};
|
|
966
|
-
}
|
|
967
|
-
_isSame(p, B) {
|
|
968
|
-
return this._operation === p && this._filter === B;
|
|
969
|
-
}
|
|
970
|
-
set(p) {
|
|
971
|
-
let B = typeof p == "string" ? parseInt(p, 10) : p;
|
|
972
|
-
!isOperationKey(this._operation) || !Number.isFinite(B) || (this._update(this._operation, B), this._addKeypointDebounced(this._operation, this._filter, B));
|
|
973
|
-
}
|
|
974
|
-
_update(p, B) {
|
|
975
|
-
this._operation = p, this._value = B;
|
|
976
|
-
let { zero: V } = COLOR_OPERATIONS_CONFIG[p], H = this._keypoints.map((p) => p.value), U = calculateOpacities(H, B, V), W = calculateZIndices(H, V);
|
|
977
|
-
this._keypoints.forEach((p, B) => {
|
|
978
|
-
let V = U[B], H = W[B];
|
|
979
|
-
typeof V == "number" && (p.opacity = V), typeof H == "number" && (p.zIndex = H);
|
|
980
|
-
}), this._flush();
|
|
981
|
-
}
|
|
982
|
-
_createPreviewImage() {
|
|
983
|
-
let p = new Image();
|
|
984
|
-
return p.classList.add("uc-fader-image", "uc-fader-image--preview"), p.style.opacity = "0", p;
|
|
985
|
-
}
|
|
986
|
-
async _initNodes() {
|
|
987
|
-
this._previewImage = this._previewImage || this._createPreviewImage();
|
|
988
|
-
let p = this._previewImage;
|
|
989
|
-
p && this._ensurePreviewAttached(p);
|
|
990
|
-
let { images: B, promise: V, cancel: H } = batchPreloadImages(this._keypoints.map((p) => p.src));
|
|
991
|
-
B.forEach((p) => {
|
|
992
|
-
let B = this._handleImageLoading(p.src);
|
|
993
|
-
p.addEventListener("load", B), p.addEventListener("error", B);
|
|
994
|
-
}), this._cancelLastImages = () => {
|
|
995
|
-
H(), this._cancelLastImages = void 0;
|
|
996
|
-
};
|
|
997
|
-
let U = this._operation, W = this._filter;
|
|
998
|
-
if (await V, this._isActive && this._isSame(U, W)) {
|
|
999
|
-
let p = this._layersHostRef.value;
|
|
1000
|
-
if (!p) return;
|
|
1001
|
-
p.replaceChildren(), this._keypoints.forEach((V, H) => {
|
|
1002
|
-
let U = B[H];
|
|
1003
|
-
U && (U.classList.add("uc-fader-image"), V.image = U, p.appendChild(U));
|
|
1004
|
-
}), this._flush();
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
async setTransformations(p) {
|
|
1008
|
-
if (this._transformations = p, this._previewImage) {
|
|
1009
|
-
let p = await this._imageSrc(), B = this._handleImageLoading(p);
|
|
1010
|
-
this._previewImage.src = p, this._previewImage.addEventListener("load", B, { once: !0 }), this._previewImage.addEventListener("error", B, { once: !0 }), this._previewImage.style.opacity = "1", this._previewImage.addEventListener("error", () => {
|
|
1011
|
-
this.$["*networkProblems"] = !0;
|
|
1012
|
-
}, { once: !0 });
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
async preload({ url: p, filter: B, operation: V, value: H }) {
|
|
1016
|
-
if (!V || typeof H != "number") return;
|
|
1017
|
-
this._cancelBatchPreload?.();
|
|
1018
|
-
let U = keypointsRange(V, H), { cancel: W } = batchPreloadImages(await Promise.all(U.map((H) => this._imageSrc({
|
|
1019
|
-
url: p,
|
|
1020
|
-
filter: B,
|
|
1021
|
-
operation: V,
|
|
1022
|
-
value: H
|
|
1023
|
-
}))));
|
|
1024
|
-
this._cancelBatchPreload = W;
|
|
1025
|
-
}
|
|
1026
|
-
_setOriginalSrc(p) {
|
|
1027
|
-
let B = this._previewImage || this._createPreviewImage();
|
|
1028
|
-
if (this._ensurePreviewAttached(B), this._previewImage = B, B.src === p) {
|
|
1029
|
-
B.style.opacity = "1", B.style.transform = "scale(1)", this.className = classNames({
|
|
1030
|
-
"uc-active_from_viewer": this._fromViewer,
|
|
1031
|
-
"uc-active_from_cropper": !this._fromViewer,
|
|
1032
|
-
"uc-inactive_to_cropper": !1
|
|
1033
|
-
});
|
|
1034
|
-
return;
|
|
1035
|
-
}
|
|
1036
|
-
B.style.opacity = "0";
|
|
1037
|
-
let V = this._handleImageLoading(p);
|
|
1038
|
-
B.addEventListener("error", V, { once: !0 }), B.src = p, B.addEventListener("load", () => {
|
|
1039
|
-
V(), B && (B.style.opacity = "1", B.style.transform = "scale(1)", this.className = classNames({
|
|
1040
|
-
"uc-active_from_viewer": this._fromViewer,
|
|
1041
|
-
"uc-active_from_cropper": !this._fromViewer,
|
|
1042
|
-
"uc-inactive_to_cropper": !1
|
|
1043
|
-
}));
|
|
1044
|
-
}, { once: !0 }), B.addEventListener("error", () => {
|
|
1045
|
-
this.$["*networkProblems"] = !0;
|
|
1046
|
-
}, { once: !0 });
|
|
1047
|
-
}
|
|
1048
|
-
async activate({ url: p, operation: B, value: V, filter: H, fromViewer: U }) {
|
|
1049
|
-
if (this._isActive = !0, this._hidden = !1, await this.updateComplete, this._url = p, this._operation = B ?? "initial", this._value = V, this._filter = H, this._fromViewer = U, typeof V != "number" && !H) {
|
|
1050
|
-
let p = await this._imageSrc({
|
|
1051
|
-
operation: B,
|
|
1052
|
-
value: V
|
|
1053
|
-
});
|
|
1054
|
-
this._setOriginalSrc(p), this._clearLayersHost();
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
!B || typeof V != "number" || (this._keypoints = await Promise.all(keypointsRange(B, V).map((p) => this._constructKeypoint(B, p))), this._update(B, V), this._initNodes());
|
|
1058
|
-
}
|
|
1059
|
-
deactivate({ hide: p = !0 } = {}) {
|
|
1060
|
-
this._isActive = !1, this._cancelLastImages?.(), this._cancelBatchPreload?.(), p && !this._hidden ? (this._hidden = !0, this._previewImage && (this._previewImage.style.transform = "scale(1)"), this.className = classNames({
|
|
1061
|
-
"uc-active_from_viewer": !1,
|
|
1062
|
-
"uc-active_from_cropper": !1,
|
|
1063
|
-
"uc-inactive_to_cropper": !0
|
|
1064
|
-
}), this.addEventListener("transitionend", () => {
|
|
1065
|
-
this._clearLayersHost();
|
|
1066
|
-
}, { once: !0 })) : this._clearLayersHost();
|
|
1067
|
-
}
|
|
1068
|
-
_ensurePreviewAttached(p) {
|
|
1069
|
-
let B = this._previewHostRef.value;
|
|
1070
|
-
B && (B.contains(p) || B.appendChild(p));
|
|
1071
|
-
}
|
|
1072
|
-
_clearLayersHost() {
|
|
1073
|
-
this._layersHostRef.value?.replaceChildren();
|
|
1074
|
-
}
|
|
1075
|
-
render() {
|
|
1076
|
-
return b`
|
|
1077
|
-
<div class="uc-fader-preview-host" ${n$1(this._previewHostRef)}></div>
|
|
1078
|
-
<div class="uc-fader-layers-host" ${n$1(this._layersHostRef)}></div>
|
|
1079
|
-
`;
|
|
1080
|
-
}
|
|
1081
|
-
}, SliderUi = class extends LitBlock {
|
|
1082
|
-
constructor() {
|
|
1083
|
-
super(), this._thumbSize = 0, this._inputRef = e(), this._thumbRef = e(), this._stepsRef = e(), this.disabled = !1, this.min = 0, this.max = 100, this.defaultValue = 0, this.zero = 0, this._currentValue = 0, this._handleSliderInput = (p) => {
|
|
1084
|
-
p.stopPropagation();
|
|
1085
|
-
let B = this._extractEventValue(p);
|
|
1086
|
-
B !== null && (this._setCurrentValue(B), this._emitSliderEvent("slider-input", B));
|
|
1087
|
-
}, this._handleSliderChange = (p) => {
|
|
1088
|
-
p.stopPropagation();
|
|
1089
|
-
let B = this._extractEventValue(p);
|
|
1090
|
-
B !== null && this._setCurrentValue(B);
|
|
1091
|
-
}, this._handleInputFocus = () => {
|
|
1092
|
-
this.style.setProperty("--color-effect", "var(--hover-color-rgb)");
|
|
1093
|
-
}, this._handleInputBlur = () => {
|
|
1094
|
-
this.style.setProperty("--color-effect", "var(--idle-color-rgb)");
|
|
1095
|
-
}, this.setAttribute("with-effects", "");
|
|
1096
|
-
}
|
|
1097
|
-
_emitSliderEvent(p, B) {
|
|
1098
|
-
this.dispatchEvent(new CustomEvent(p, {
|
|
1099
|
-
detail: { value: B },
|
|
1100
|
-
bubbles: !0,
|
|
1101
|
-
composed: !0
|
|
1102
|
-
}));
|
|
1103
|
-
}
|
|
1104
|
-
firstUpdated(p) {
|
|
1105
|
-
super.firstUpdated(p), this._thumbSize = Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"), 10) || 0, this._syncInputValue(this._currentValue), this._updateSteps(), this._observer = new ResizeObserver(() => {
|
|
1106
|
-
this._updateSteps(), this._updateValue(this._currentValue);
|
|
1107
|
-
}), this._observer.observe(this);
|
|
1108
|
-
let B = this._inputRef.value;
|
|
1109
|
-
B?.addEventListener("focus", this._handleInputFocus), B?.addEventListener("blur", this._handleInputBlur), window.setTimeout(() => {
|
|
1110
|
-
this._updateValue(this._currentValue);
|
|
1111
|
-
}, 0);
|
|
1112
|
-
}
|
|
1113
|
-
willUpdate(p) {
|
|
1114
|
-
super.willUpdate(p), p.has("defaultValue") && this.defaultValue !== this._currentValue && this._setCurrentValue(this.defaultValue), (p.has("min") || p.has("max")) && this.hasUpdated && (this._updateSteps(), this._updateValue(this._currentValue)), p.has("zero") && this.hasUpdated && this._updateZeroDot(this._currentValue);
|
|
1115
|
-
}
|
|
1116
|
-
_updateValue(p) {
|
|
1117
|
-
this._updateZeroDot(p);
|
|
1118
|
-
let B = this.max - this.min;
|
|
1119
|
-
if (B === 0) return;
|
|
1120
|
-
let { width: V } = this.getBoundingClientRect(), H = 100 / B * (p - this.min) * (V - this._thumbSize) / 100;
|
|
1121
|
-
window.requestAnimationFrame(() => {
|
|
1122
|
-
let p = this._thumbRef.value;
|
|
1123
|
-
p && (p.style.transform = `translateX(${H}px)`);
|
|
1124
|
-
});
|
|
1125
|
-
}
|
|
1126
|
-
_updateZeroDot(p) {
|
|
1127
|
-
if (!this._zeroDotEl) return;
|
|
1128
|
-
let B = this.max - this.min;
|
|
1129
|
-
if (B === 0) return;
|
|
1130
|
-
this._zeroDotEl.style.opacity = p === this.zero ? "0" : "1";
|
|
1131
|
-
let { width: V } = this.getBoundingClientRect(), H = 100 / B * (this.zero - this.min) * (V - this._thumbSize) / 100;
|
|
1132
|
-
window.requestAnimationFrame(() => {
|
|
1133
|
-
this._zeroDotEl && (this._zeroDotEl.style.transform = `translateX(${H}px)`);
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
_updateSteps() {
|
|
1137
|
-
let p = this._stepsRef.value;
|
|
1138
|
-
if (!p) return;
|
|
1139
|
-
let { width: B } = p.getBoundingClientRect(), V = Math.ceil(B / 2), H = Math.ceil(V / 15) - 2;
|
|
1140
|
-
if (this._stepsCount === H) return;
|
|
1141
|
-
let U = document.createDocumentFragment(), W = document.createElement("div"), G = document.createElement("div");
|
|
1142
|
-
W.className = "uc-minor-step", G.className = "uc-border-step", U.appendChild(G);
|
|
1143
|
-
for (let p = 0; p < H; p += 1) U.appendChild(W.cloneNode());
|
|
1144
|
-
U.appendChild(G.cloneNode());
|
|
1145
|
-
for (let p = 0; p < H; p += 1) U.appendChild(W.cloneNode());
|
|
1146
|
-
U.appendChild(G.cloneNode());
|
|
1147
|
-
let K = document.createElement("div");
|
|
1148
|
-
K.className = "uc-zero-dot", U.appendChild(K), this._zeroDotEl = K, p.innerHTML = "", p.appendChild(U), this._stepsCount = H;
|
|
1149
|
-
}
|
|
1150
|
-
disconnectedCallback() {
|
|
1151
|
-
super.disconnectedCallback();
|
|
1152
|
-
let p = this._inputRef.value;
|
|
1153
|
-
p?.removeEventListener("focus", this._handleInputFocus), p?.removeEventListener("blur", this._handleInputBlur), this._observer?.disconnect(), this._observer = void 0;
|
|
1154
|
-
}
|
|
1155
|
-
_setCurrentValue(p) {
|
|
1156
|
-
Number.isFinite(p) && (this._currentValue = p, this.hasUpdated && (this._syncInputValue(p), this._updateValue(p)));
|
|
1157
|
-
}
|
|
1158
|
-
_syncInputValue(p) {
|
|
1159
|
-
let B = this._inputRef.value;
|
|
1160
|
-
B && (B.value = String(p));
|
|
1161
|
-
}
|
|
1162
|
-
_extractEventValue(p) {
|
|
1163
|
-
let B = p.currentTarget;
|
|
1164
|
-
if (!B) return null;
|
|
1165
|
-
let V = Number.parseInt(B.value, 10);
|
|
1166
|
-
return Number.isFinite(V) ? V : null;
|
|
1167
|
-
}
|
|
1168
|
-
render() {
|
|
1169
|
-
return b`
|
|
1170
|
-
<div class="uc-steps" ${n$1(this._stepsRef)}></div>
|
|
1171
|
-
<div class="uc-thumb" ${n$1(this._thumbRef)}></div>
|
|
1172
|
-
<input
|
|
1173
|
-
class="uc-input"
|
|
1174
|
-
type="range"
|
|
1175
|
-
${n$1(this._inputRef)}
|
|
1176
|
-
.min=${String(this.min)}
|
|
1177
|
-
.max=${String(this.max)}
|
|
1178
|
-
.value=${String(this._currentValue)}
|
|
1179
|
-
?disabled=${this.disabled}
|
|
1180
|
-
@input=${this._handleSliderInput}
|
|
1181
|
-
@change=${this._handleSliderChange}
|
|
1182
|
-
/>
|
|
1183
|
-
`;
|
|
1184
|
-
}
|
|
1185
|
-
};
|
|
1186
|
-
__decorate([n({
|
|
1187
|
-
type: Boolean,
|
|
1188
|
-
reflect: !0
|
|
1189
|
-
})], SliderUi.prototype, "disabled", void 0), __decorate([n({ type: Number })], SliderUi.prototype, "min", void 0), __decorate([n({ type: Number })], SliderUi.prototype, "max", void 0), __decorate([n({
|
|
1190
|
-
type: Number,
|
|
1191
|
-
attribute: !1
|
|
1192
|
-
})], SliderUi.prototype, "defaultValue", void 0), __decorate([n({ type: Number })], SliderUi.prototype, "zero", void 0), __decorate([r()], SliderUi.prototype, "_currentValue", void 0);
|
|
1193
|
-
const FAKE_ORIGINAL_FILTER = "original";
|
|
1194
|
-
var EditorSlider = class extends LitBlock {
|
|
1195
|
-
constructor(...p) {
|
|
1196
|
-
super(...p), this.state = {
|
|
1197
|
-
operation: "filter",
|
|
1198
|
-
filter: void 0,
|
|
1199
|
-
originalUrl: "",
|
|
1200
|
-
disabled: !1,
|
|
1201
|
-
min: 0,
|
|
1202
|
-
max: 100,
|
|
1203
|
-
value: 0,
|
|
1204
|
-
defaultValue: 0,
|
|
1205
|
-
zero: 0
|
|
1206
|
-
}, this._handleInput = (p) => {
|
|
1207
|
-
let { value: B } = p.detail;
|
|
1208
|
-
this.$["*faderEl"]?.set(B), this.state = {
|
|
1209
|
-
...this.state,
|
|
1210
|
-
value: B
|
|
1211
|
-
};
|
|
1212
|
-
};
|
|
1213
|
-
}
|
|
1214
|
-
setOperation(p, B) {
|
|
1215
|
-
this.state = {
|
|
1216
|
-
...this.state,
|
|
1217
|
-
operation: p,
|
|
1218
|
-
filter: B
|
|
1219
|
-
}, this._initializeValues();
|
|
1220
|
-
let V = this.$["*faderEl"], H = this.state.originalUrl || this.$["*originalUrl"];
|
|
1221
|
-
V && H && V.activate({
|
|
1222
|
-
url: H,
|
|
1223
|
-
operation: this.state.operation,
|
|
1224
|
-
value: this.state.filter === "original" ? void 0 : this.state.value,
|
|
1225
|
-
filter: this.state.filter === "original" ? void 0 : this.state.filter,
|
|
1226
|
-
fromViewer: !1
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1229
|
-
_initializeValues() {
|
|
1230
|
-
let p = this.state.operation, { range: B, zero: V } = COLOR_OPERATIONS_CONFIG[p], [H, U] = B;
|
|
1231
|
-
this.state = {
|
|
1232
|
-
...this.state,
|
|
1233
|
-
min: H,
|
|
1234
|
-
max: U,
|
|
1235
|
-
zero: V
|
|
1236
|
-
};
|
|
1237
|
-
let W = this.$["*editorTransformations"][p];
|
|
1238
|
-
if (p === "filter") {
|
|
1239
|
-
let p = Number(U), B = W;
|
|
1240
|
-
if (B) {
|
|
1241
|
-
let { name: V, amount: H } = B;
|
|
1242
|
-
p = V === this.state.filter ? H : U;
|
|
1243
|
-
}
|
|
1244
|
-
this.state = {
|
|
1245
|
-
...this.state,
|
|
1246
|
-
value: p,
|
|
1247
|
-
defaultValue: p
|
|
1248
|
-
};
|
|
1249
|
-
return;
|
|
1250
|
-
}
|
|
1251
|
-
let G = W === void 0 ? V : W;
|
|
1252
|
-
this.state = {
|
|
1253
|
-
...this.state,
|
|
1254
|
-
value: G,
|
|
1255
|
-
defaultValue: G
|
|
1256
|
-
};
|
|
1257
|
-
}
|
|
1258
|
-
apply() {
|
|
1259
|
-
let p = { ...this.$["*editorTransformations"] };
|
|
1260
|
-
this.state.operation === "filter" ? !this.state.filter || this.state.filter === "original" ? delete p.filter : p.filter = {
|
|
1261
|
-
name: this.state.filter,
|
|
1262
|
-
amount: this.state.value
|
|
1263
|
-
} : p[this.state.operation] = this.state.value, this.$["*editorTransformations"] = p;
|
|
1264
|
-
}
|
|
1265
|
-
cancel() {
|
|
1266
|
-
this.$["*faderEl"]?.deactivate({ hide: !1 });
|
|
1267
|
-
}
|
|
1268
|
-
initCallback() {
|
|
1269
|
-
super.initCallback(), this.sub("*originalUrl", (p) => {
|
|
1270
|
-
p && (this.state = {
|
|
1271
|
-
...this.state,
|
|
1272
|
-
originalUrl: p
|
|
1273
|
-
});
|
|
1274
|
-
});
|
|
1275
|
-
}
|
|
1276
|
-
updated(p) {
|
|
1277
|
-
if (super.updated(p), p.has("state")) {
|
|
1278
|
-
let p = `${this.state.filter ?? this.state.operation} ${this.state.value}`;
|
|
1279
|
-
this.$["*operationTooltip"] = p;
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
render() {
|
|
1283
|
-
return b`
|
|
1284
|
-
<uc-slider-ui
|
|
1285
|
-
.disabled=${this.state.disabled}
|
|
1286
|
-
.min=${this.state.min}
|
|
1287
|
-
.max=${this.state.max}
|
|
1288
|
-
.defaultValue=${this.state.defaultValue}
|
|
1289
|
-
.zero=${this.state.zero}
|
|
1290
|
-
@slider-input=${this._handleInput}
|
|
1291
|
-
></uc-slider-ui>
|
|
1292
|
-
`;
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
__decorate([r()], EditorSlider.prototype, "state", void 0);
|
|
1296
|
-
function parseFilterValue(p) {
|
|
1297
|
-
if (!p) return null;
|
|
1298
|
-
let B = p.match(/^([A-Za-z]+)\s+(\d+)$/);
|
|
1299
|
-
if (!B) return null;
|
|
1300
|
-
let [, V, H] = B;
|
|
1301
|
-
return !V || H === void 0 ? null : {
|
|
1302
|
-
filter: V,
|
|
1303
|
-
value: Number(H)
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
var EditorButtonControl = class extends LitBlock {
|
|
1307
|
-
constructor(...p) {
|
|
1308
|
-
super(...p), this.active = !1, this.title = "", this.icon = "", this.titleProp = "";
|
|
1309
|
-
}
|
|
1310
|
-
get buttonClasses() {
|
|
1311
|
-
let p = this.active;
|
|
1312
|
-
return {
|
|
1313
|
-
"uc-active": p,
|
|
1314
|
-
"uc-not_active": !p
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
_updateHostStateClasses() {
|
|
1318
|
-
let p = this.buttonClasses;
|
|
1319
|
-
for (let [B, V] of Object.entries(p)) this.classList.toggle(B, V);
|
|
1320
|
-
}
|
|
1321
|
-
onClick(p) {}
|
|
1322
|
-
connectedCallback() {
|
|
1323
|
-
super.connectedCallback(), this._updateHostStateClasses();
|
|
1324
|
-
}
|
|
1325
|
-
updated(p) {
|
|
1326
|
-
super.updated(p), p.has("active") && this._updateHostStateClasses();
|
|
1327
|
-
}
|
|
1328
|
-
render() {
|
|
1329
|
-
let p = this.onClick, B = this.title;
|
|
1330
|
-
return b`
|
|
1331
|
-
<button
|
|
1332
|
-
role="option"
|
|
1333
|
-
type="button"
|
|
1334
|
-
aria-label=${o$2(this.titleProp)}
|
|
1335
|
-
title=${o$2(this.titleProp)}
|
|
1336
|
-
@click=${p}
|
|
1337
|
-
>
|
|
1338
|
-
<uc-icon name=${this.icon}></uc-icon>
|
|
1339
|
-
<div class="uc-title" ?hidden=${!B}>${B}</div>
|
|
1340
|
-
</button>
|
|
1341
|
-
`;
|
|
1342
|
-
}
|
|
1343
|
-
};
|
|
1344
|
-
__decorate([r()], EditorButtonControl.prototype, "active", void 0), __decorate([r()], EditorButtonControl.prototype, "title", void 0), __decorate([r()], EditorButtonControl.prototype, "icon", void 0), __decorate([r()], EditorButtonControl.prototype, "titleProp", void 0);
|
|
1345
|
-
var SIZE_RECT_FIXED = 12, SIZE_SVG_WRAPPER = 16, getAdjustResolutions = (p) => {
|
|
1346
|
-
let B = 12, V = 12;
|
|
1347
|
-
return p.width / p.height >= 1 ? (B = SIZE_RECT_FIXED, V = Math.round(SIZE_RECT_FIXED * p.height / p.width)) : (V = SIZE_RECT_FIXED, B = Math.round(SIZE_RECT_FIXED * p.width / p.height)), {
|
|
1348
|
-
width: B,
|
|
1349
|
-
height: V
|
|
1350
|
-
};
|
|
1351
|
-
}, EditorFreeformButtonControl = class extends EditorButtonControl {
|
|
1352
|
-
initCallback() {
|
|
1353
|
-
super.initCallback(), this.icon = "arrow-dropdown", this.sub("*currentAspectRatio", (p) => {
|
|
1354
|
-
let B = this._computeTitle(p);
|
|
1355
|
-
this.title = B, this.titleProp = B;
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
|
-
onClick() {
|
|
1359
|
-
this.$["*showListAspectRatio"] = !0;
|
|
1360
|
-
}
|
|
1361
|
-
_computeTitle(p) {
|
|
1362
|
-
return p ? p.hasFreeform ? this.l10n("freeform-crop") : this.l10n("crop-to-shape", { value: `${p.width}:${p.height}` }) : "";
|
|
1363
|
-
}
|
|
1364
|
-
render() {
|
|
1365
|
-
let p = this.onClick, B = this.title;
|
|
1366
|
-
return b`
|
|
1367
|
-
<button
|
|
1368
|
-
role="option"
|
|
1369
|
-
type="button"
|
|
1370
|
-
class=${e$1(this.buttonClasses)}
|
|
1371
|
-
aria-label=${o$2(this.titleProp)}
|
|
1372
|
-
title=${o$2(this.titleProp)}
|
|
1373
|
-
@click=${p}
|
|
1374
|
-
>
|
|
1375
|
-
<div class="uc-title" ?hidden=${!B}>${B}</div>
|
|
1376
|
-
<uc-icon name=${this.icon}></uc-icon>
|
|
1377
|
-
</button>
|
|
1378
|
-
`;
|
|
1379
|
-
}
|
|
1380
|
-
}, EditorAspectRatioButtonControl = class extends EditorButtonControl {
|
|
1381
|
-
constructor(...p) {
|
|
1382
|
-
super(...p), this._aspectRatio = null;
|
|
1383
|
-
}
|
|
1384
|
-
get aspectRatio() {
|
|
1385
|
-
return this._aspectRatio;
|
|
1386
|
-
}
|
|
1387
|
-
set aspectRatio(p) {
|
|
1388
|
-
if (this._aspectRatio === p) return;
|
|
1389
|
-
let B = this._aspectRatio;
|
|
1390
|
-
this._aspectRatio = p, this.requestUpdate("aspectRatio", B), p ? this._updateAspectRatioPresentation(p) : (this.removeAttribute("uc-aspect-ratio-freeform"), this.title = "", this.titleProp = "");
|
|
1391
|
-
}
|
|
1392
|
-
initCallback() {
|
|
1393
|
-
super.initCallback(), this._aspectRatio && this._updateAspectRatioPresentation(this._aspectRatio), this.sub("*currentAspectRatio", (p) => {
|
|
1394
|
-
this.active = p && p.id === this._aspectRatio?.id || p?.width === this._aspectRatio?.width && p?.height === this._aspectRatio?.height;
|
|
1395
|
-
});
|
|
1396
|
-
}
|
|
1397
|
-
onClick() {
|
|
1398
|
-
this.$["*currentAspectRatio"]?.id !== this._aspectRatio?.id && (this.$["*currentAspectRatio"] = this._aspectRatio);
|
|
1399
|
-
}
|
|
1400
|
-
_updateAspectRatioPresentation(p) {
|
|
1401
|
-
if (!this.isConnected) return;
|
|
1402
|
-
let B = !!p.hasFreeform;
|
|
1403
|
-
this.toggleAttribute("uc-aspect-ratio-freeform", B), (() => {
|
|
1404
|
-
let V = B ? this.l10n("custom") : `${p.width}:${p.height}`;
|
|
1405
|
-
return this.title = V, V;
|
|
1406
|
-
})(), (() => {
|
|
1407
|
-
let V = this.l10n("a11y-cloud-editor-apply-aspect-ratio", {
|
|
1408
|
-
name: B ? this.l10n("custom").toLowerCase() : this.l10n("crop-to-shape", { value: `${p.width}:${p.height}` }).toLowerCase(),
|
|
1409
|
-
value: ""
|
|
1410
|
-
});
|
|
1411
|
-
return this.titleProp = V, V;
|
|
1412
|
-
})(), B || this.requestUpdate();
|
|
1413
|
-
}
|
|
1414
|
-
_renderIcon() {
|
|
1415
|
-
let p = this._aspectRatio;
|
|
1416
|
-
if (!p || p.hasFreeform) return b`<uc-icon name=${this.icon}></uc-icon>`;
|
|
1417
|
-
let { width: B, height: V } = getAdjustResolutions(p);
|
|
1418
|
-
return b`
|
|
1419
|
-
<uc-icon>
|
|
1420
|
-
<svg
|
|
1421
|
-
viewBox="0 0 ${SIZE_SVG_WRAPPER} ${SIZE_SVG_WRAPPER}"
|
|
1422
|
-
aria-hidden="true"
|
|
1423
|
-
focusable="false"
|
|
1424
|
-
>
|
|
1425
|
-
<rect
|
|
1426
|
-
x=${(SIZE_SVG_WRAPPER - B) / 2}
|
|
1427
|
-
y=${(SIZE_SVG_WRAPPER - V) / 2}
|
|
1428
|
-
width=${B}
|
|
1429
|
-
height=${V}
|
|
1430
|
-
rx="2"
|
|
1431
|
-
fill="none"
|
|
1432
|
-
stroke="currentColor"
|
|
1433
|
-
stroke-width="1.2"
|
|
1434
|
-
stroke-linejoin="round"
|
|
1435
|
-
></rect>
|
|
1436
|
-
</svg>
|
|
1437
|
-
</uc-icon>
|
|
1438
|
-
`;
|
|
1439
|
-
}
|
|
1440
|
-
render() {
|
|
1441
|
-
let p = this.onClick, B = this.title;
|
|
1442
|
-
return b`
|
|
1443
|
-
<button
|
|
1444
|
-
role="option"
|
|
1445
|
-
type="button"
|
|
1446
|
-
class=${e$1(this.buttonClasses)}
|
|
1447
|
-
aria-label=${o$2(this.titleProp)}
|
|
1448
|
-
title=${o$2(this.titleProp)}
|
|
1449
|
-
@click=${p}
|
|
1450
|
-
>
|
|
1451
|
-
${this._renderIcon()}
|
|
1452
|
-
<div class="uc-title" ?hidden=${!B}>${B}</div>
|
|
1453
|
-
</button>
|
|
1454
|
-
`;
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
__decorate([n({ attribute: !1 })], EditorAspectRatioButtonControl.prototype, "aspectRatio", null);
|
|
1458
|
-
function nextAngle(p) {
|
|
1459
|
-
let B = p + 90;
|
|
1460
|
-
return B = B >= 360 ? 0 : B, B;
|
|
1461
|
-
}
|
|
1462
|
-
function nextValue(p, B) {
|
|
1463
|
-
if (p === "rotate") return nextAngle(typeof B == "number" ? B : 0);
|
|
1464
|
-
if (p === "mirror" || p === "flip") return !B;
|
|
1465
|
-
throw Error(`Unsupported operation: ${p}`);
|
|
1466
|
-
}
|
|
1467
|
-
var EditorCropButtonControl = class extends EditorButtonControl {
|
|
1468
|
-
constructor(...p) {
|
|
1469
|
-
super(...p), this.operation = void 0;
|
|
1470
|
-
}
|
|
1471
|
-
willUpdate(p) {
|
|
1472
|
-
super.willUpdate(p), 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 = "");
|
|
1473
|
-
}
|
|
1474
|
-
onClick(p) {
|
|
1475
|
-
if (!this.operation) return;
|
|
1476
|
-
let B = this.$["*cropperEl"], V = B.getValue(this.operation), H = nextValue(this.operation, V);
|
|
1477
|
-
this.telemetryManager.sendEventCloudImageEditor(p, this.$["*tabId"], {
|
|
1478
|
-
operation: this.operation,
|
|
1479
|
-
next: H,
|
|
1480
|
-
prev: V
|
|
1481
|
-
}), B.setValue(this.operation, H);
|
|
1482
|
-
}
|
|
1483
|
-
};
|
|
1484
|
-
__decorate([n({ type: String })], EditorCropButtonControl.prototype, "operation", void 0);
|
|
1485
|
-
var EditorFilterControl = class extends EditorButtonControl {
|
|
1486
|
-
constructor(...p) {
|
|
1487
|
-
super(...p), this._operation = "", this._filter = "", this._originalUrl = "", this._lastPreviewRequestId = 0, this._previewImage = null, this._previewLoaded = !1, this.isOriginal = !1, this._iconSize = 20;
|
|
1488
|
-
}
|
|
1489
|
-
get filter() {
|
|
1490
|
-
return this._filter;
|
|
1491
|
-
}
|
|
1492
|
-
set filter(p) {
|
|
1493
|
-
let B = p ?? "";
|
|
1494
|
-
if (this._filter === B) return;
|
|
1495
|
-
let V = this._filter;
|
|
1496
|
-
this._filter = B, this._operation = "filter", this.isOriginal = B === FAKE_ORIGINAL_FILTER, this.icon = this.isOriginal ? "original" : "slider", this._iconSize = this.isOriginal ? 40 : 20, this.requestUpdate("filter", V), this.isConnected && this._updateFilterLabels(B);
|
|
1497
|
-
}
|
|
1498
|
-
onClick(p) {
|
|
1499
|
-
if (this.active) this.isOriginal || (this.$["*sliderEl"].setOperation(this._operation, this._filter), this.$["*showSlider"] = !0);
|
|
1500
|
-
else {
|
|
1501
|
-
let p = this.$["*sliderEl"];
|
|
1502
|
-
p.setOperation(this._operation, this._filter), p.apply();
|
|
1503
|
-
}
|
|
1504
|
-
this.telemetryManager.sendEventCloudImageEditor(p, this.$["*tabId"], { operation: parseFilterValue(this.$["*operationTooltip"]) }), this.$["*currentFilter"] = this._filter;
|
|
1505
|
-
}
|
|
1506
|
-
_previewSrc() {
|
|
1507
|
-
let p = parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"), 10), B = Number.isFinite(p) && p > 0 ? p : this._iconSize || 32, V = window.devicePixelRatio, H = Math.ceil(V * B), U = V >= 2 ? "lightest" : "normal", W = { ...this.$["*editorTransformations"] };
|
|
1508
|
-
return W[this._operation] = this._filter === "original" ? void 0 : {
|
|
1509
|
-
name: this._filter,
|
|
1510
|
-
amount: 100
|
|
1511
|
-
}, createCdnUrl(this._originalUrl, createCdnUrlModifiers(COMMON_OPERATIONS, transformationsToOperations(W), `quality/${U}`, `scale_crop/${H}x${H}/center`, `@clib/${PACKAGE_NAME}/${PACKAGE_VERSION}/uc-cloud-image-editor/`));
|
|
1512
|
-
}
|
|
1513
|
-
async _observerCallback(p, B) {
|
|
1514
|
-
p[0]?.isIntersecting ? await this._loadPreview(B) : this._cancelPreload?.();
|
|
1515
|
-
}
|
|
1516
|
-
initCallback() {
|
|
1517
|
-
super.initCallback(), this._observer = new window.IntersectionObserver(this._observerCallback.bind(this), { threshold: [0, 1] }), this._originalUrl = this.$["*originalUrl"] ?? "", this.sub("*originalUrl", (p) => {
|
|
1518
|
-
this._originalUrl = p ?? "", !this.isOriginal && this._originalUrl && this.isConnected && !this._previewImage && (this._observer?.observe(this), this._schedulePreviewVisibilityCheck());
|
|
1519
|
-
}), this.isOriginal || (this._observer?.observe(this), this._schedulePreviewVisibilityCheck()), this._filter && this._updateFilterLabels(this._filter), this.sub("*currentFilter", (p) => {
|
|
1520
|
-
this.active = !!(p && p === this._filter);
|
|
1521
|
-
}), this.sub("*networkProblems", async (p) => {
|
|
1522
|
-
p || (this._previewImage ? await this._loadPreview() : this._schedulePreviewVisibilityCheck());
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1525
|
-
disconnectedCallback() {
|
|
1526
|
-
super.disconnectedCallback(), this._observer?.disconnect(), this._cancelPreload?.(), this._clearPreviewVisibilityChecks();
|
|
1527
|
-
}
|
|
1528
|
-
updated(p) {
|
|
1529
|
-
super.updated(p), p.has("isOriginal") && (this.isOriginal ? this._observer?.unobserve(this) : (this._observer?.observe(this), this._schedulePreviewVisibilityCheck()));
|
|
1530
|
-
}
|
|
1531
|
-
_updateFilterLabels(p) {
|
|
1532
|
-
if (!p) {
|
|
1533
|
-
this.titleProp = "";
|
|
1534
|
-
return;
|
|
1535
|
-
}
|
|
1536
|
-
this.titleProp = this.l10n("a11y-cloud-editor-apply-filter", { name: p.toLowerCase() });
|
|
1537
|
-
}
|
|
1538
|
-
async _loadPreview(p) {
|
|
1539
|
-
if (!this.isConnected) {
|
|
1540
|
-
p?.unobserve(this), this._cancelPreload?.(), this._cancelPreload = void 0;
|
|
1541
|
-
return;
|
|
1542
|
-
}
|
|
1543
|
-
if (!this._originalUrl) {
|
|
1544
|
-
!this._previewVisibilityCheckTimeout && !this._previewVisibilityCheckRaf && this._schedulePreviewVisibilityCheck();
|
|
1545
|
-
return;
|
|
1546
|
-
}
|
|
1547
|
-
let B = ++this._lastPreviewRequestId, V = "";
|
|
1548
|
-
try {
|
|
1549
|
-
V = await this.proxyUrl(this._previewSrc());
|
|
1550
|
-
} catch (p) {
|
|
1551
|
-
this.$["*networkProblems"] = !0, console.error("Failed to resolve preview URL", { error: p });
|
|
1552
|
-
return;
|
|
1553
|
-
}
|
|
1554
|
-
this._previewLoaded = !1, this._cancelPreload?.();
|
|
1555
|
-
let { promise: H, cancel: U } = preloadImage(V);
|
|
1556
|
-
this._cancelPreload = () => {
|
|
1557
|
-
U(), this._lastPreviewRequestId === B && (this._cancelPreload = void 0);
|
|
1558
|
-
};
|
|
1559
|
-
try {
|
|
1560
|
-
if (await H, this._lastPreviewRequestId !== B || !this.isConnected) return;
|
|
1561
|
-
this._previewImage = V, this._previewLoaded = !0, this._clearPreviewVisibilityChecks(), (p ?? this._observer)?.unobserve(this);
|
|
1562
|
-
} catch (p) {
|
|
1563
|
-
this.$["*networkProblems"] = !0, console.error("Failed to load image", { error: p }), this._schedulePreviewVisibilityCheck();
|
|
1564
|
-
} finally {
|
|
1565
|
-
this._lastPreviewRequestId === B && (this._cancelPreload = void 0);
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
_schedulePreviewVisibilityCheck() {
|
|
1569
|
-
if (!this.isConnected || this._previewImage || this._previewLoaded || this.isOriginal || this.$["*networkProblems"]) {
|
|
1570
|
-
this._clearPreviewVisibilityChecks();
|
|
1571
|
-
return;
|
|
1572
|
-
}
|
|
1573
|
-
this._previewVisibilityCheckRaf && cancelAnimationFrame(this._previewVisibilityCheckRaf), this._previewVisibilityCheckRaf = requestAnimationFrame(() => {
|
|
1574
|
-
if (this._previewVisibilityCheckRaf = void 0, !this.isConnected || this._previewImage || this._previewLoaded || this.isOriginal) {
|
|
1575
|
-
this._clearPreviewVisibilityChecks();
|
|
1576
|
-
return;
|
|
1577
|
-
}
|
|
1578
|
-
let p = this.getBoundingClientRect(), B = p.width > 0 && p.height > 0, V = window.innerWidth || document.documentElement.clientWidth, H = window.innerHeight || document.documentElement.clientHeight;
|
|
1579
|
-
if (B && p.bottom > 0 && p.right > 0 && p.top < H && p.left < V) {
|
|
1580
|
-
this._loadPreview();
|
|
1581
|
-
return;
|
|
1582
|
-
}
|
|
1583
|
-
this._previewVisibilityCheckTimeout = window.setTimeout(() => {
|
|
1584
|
-
this._previewVisibilityCheckTimeout = void 0, this._schedulePreviewVisibilityCheck();
|
|
1585
|
-
}, 500);
|
|
1586
|
-
});
|
|
1587
|
-
}
|
|
1588
|
-
_clearPreviewVisibilityChecks() {
|
|
1589
|
-
this._previewVisibilityCheckRaf &&= (cancelAnimationFrame(this._previewVisibilityCheckRaf), void 0), this._previewVisibilityCheckTimeout &&= (window.clearTimeout(this._previewVisibilityCheckTimeout), void 0);
|
|
1590
|
-
}
|
|
1591
|
-
get _shouldShowPreview() {
|
|
1592
|
-
return !!(this._previewLoaded && !this.active && !this.isOriginal);
|
|
1593
|
-
}
|
|
1594
|
-
render() {
|
|
1595
|
-
let p = this.onClick, B = { opacity: this._shouldShowPreview ? "1" : "0" };
|
|
1596
|
-
this._previewImage && (B.backgroundImage = `url(${this._previewImage})`);
|
|
1597
|
-
let V = { opacity: this.active || this.isOriginal ? "1" : "0" };
|
|
1598
|
-
return b`
|
|
1599
|
-
<button
|
|
1600
|
-
role="option"
|
|
1601
|
-
type="button"
|
|
1602
|
-
class=${e$1(this.buttonClasses)}
|
|
1603
|
-
aria-label=${o$2(this.titleProp)}
|
|
1604
|
-
title=${o$2(this.titleProp)}
|
|
1605
|
-
@click=${p}
|
|
1606
|
-
>
|
|
1607
|
-
<div class="uc-preview" ?data-loaded=${this._previewLoaded} style=${o$1(B)}></div>
|
|
1608
|
-
<uc-icon
|
|
1609
|
-
class=${e$1({ "uc-original-icon": this.isOriginal })}
|
|
1610
|
-
name=${this.icon}
|
|
1611
|
-
style=${o$1(V)}
|
|
1612
|
-
></uc-icon>
|
|
1613
|
-
</button>
|
|
1614
|
-
`;
|
|
1615
|
-
}
|
|
1616
|
-
};
|
|
1617
|
-
__decorate([r()], EditorFilterControl.prototype, "_previewImage", void 0), __decorate([r()], EditorFilterControl.prototype, "_previewLoaded", void 0), __decorate([r()], EditorFilterControl.prototype, "isOriginal", void 0), __decorate([r()], EditorFilterControl.prototype, "_iconSize", void 0), __decorate([n({ type: String })], EditorFilterControl.prototype, "filter", null);
|
|
1618
|
-
var EditorOperationControl = class extends EditorButtonControl {
|
|
1619
|
-
constructor(...p) {
|
|
1620
|
-
super(...p), this._operation = "";
|
|
1621
|
-
}
|
|
1622
|
-
get operation() {
|
|
1623
|
-
return this._operation;
|
|
1624
|
-
}
|
|
1625
|
-
set operation(p) {
|
|
1626
|
-
let B = p ?? "";
|
|
1627
|
-
if (this._operation === B) return;
|
|
1628
|
-
let V = this._operation;
|
|
1629
|
-
this._operation = B, this.requestUpdate("operation", V), this.isConnected && B && this._updateOperationMetadata(B);
|
|
1630
|
-
}
|
|
1631
|
-
_updateOperationMetadata(p) {
|
|
1632
|
-
this.icon = p, (() => {
|
|
1633
|
-
let B = this.l10n("a11y-cloud-editor-apply-tuning", { name: this.l10n(p).toLowerCase() });
|
|
1634
|
-
return this.titleProp = B, B;
|
|
1635
|
-
})(), (() => {
|
|
1636
|
-
let B = this.l10n(p);
|
|
1637
|
-
return this.title = B, B;
|
|
1638
|
-
})();
|
|
1639
|
-
}
|
|
1640
|
-
initCallback() {
|
|
1641
|
-
super.initCallback(), this._operation && this._updateOperationMetadata(this._operation), this.sub("*editorTransformations", (p) => {
|
|
1642
|
-
if (!this._operation) return;
|
|
1643
|
-
let { zero: B } = COLOR_OPERATIONS_CONFIG[this._operation], V = p[this._operation];
|
|
1644
|
-
this.active = V === void 0 ? !1 : V !== B;
|
|
1645
|
-
});
|
|
1646
|
-
}
|
|
1647
|
-
onClick(p) {
|
|
1648
|
-
this.$["*sliderEl"]?.setOperation(this._operation), this.$["*showSlider"] = !0, this.$["*currentOperation"] = this._operation, this.telemetryManager.sendEventCloudImageEditor(p, this.$["*tabId"], { operation: parseFilterValue(this.$["*operationTooltip"]) });
|
|
1649
|
-
}
|
|
1650
|
-
};
|
|
1651
|
-
__decorate([n({ type: String })], EditorOperationControl.prototype, "operation", null);
|
|
1652
|
-
var X_THRESHOLD = 1, noopScrollListener = () => {}, EditorScroller = class extends LitBlock {
|
|
1653
|
-
constructor(...p) {
|
|
1654
|
-
super(...p), this.hiddenScrollbar = !1, this._handleWheel = (p) => {
|
|
1655
|
-
p.preventDefault();
|
|
1656
|
-
let { deltaY: B, deltaX: V } = p;
|
|
1657
|
-
if (Math.abs(V) > X_THRESHOLD) {
|
|
1658
|
-
this.scrollLeft += V;
|
|
1659
|
-
return;
|
|
1660
|
-
}
|
|
1661
|
-
this.scrollLeft += B;
|
|
1662
|
-
};
|
|
1663
|
-
}
|
|
1664
|
-
connectedCallback() {
|
|
1665
|
-
super.connectedCallback(), this.addEventListener("wheel", this._handleWheel, { passive: !1 }), this.addEventListener("scroll", noopScrollListener, { passive: !0 });
|
|
1666
|
-
}
|
|
1667
|
-
disconnectedCallback() {
|
|
1668
|
-
this.removeEventListener("wheel", this._handleWheel), this.removeEventListener("scroll", noopScrollListener), super.disconnectedCallback();
|
|
1669
|
-
}
|
|
1670
|
-
};
|
|
1671
|
-
__decorate([n({
|
|
1672
|
-
type: Boolean,
|
|
1673
|
-
noAccessor: !0,
|
|
1674
|
-
attribute: "hidden-scrollbar"
|
|
1675
|
-
})], EditorScroller.prototype, "hiddenScrollbar", void 0);
|
|
1676
|
-
var EditorToolbar = class extends LitBlock {
|
|
1677
|
-
constructor(...p) {
|
|
1678
|
-
super(...p), this._showLoader = !1, this.showMainToolbar = !0, this.showSubToolbar = !1, this._showTabToggles = !0, this.tabList = [...ALL_TABS], this.activeTab = TabId.CROP, this._useSliderPanel = !0, this._tooltipVisible = !1, this._operationTooltip = null, this._tabIndicatorOffset = 0, this._tabIndicatorWidth = 0, this._sliderRef = e(), this._tabIndicatorRef = e(), this.tabToggleRefs = {
|
|
1679
|
-
[TabId.CROP]: e(),
|
|
1680
|
-
[TabId.TUNING]: e(),
|
|
1681
|
-
[TabId.FILTERS]: e()
|
|
1682
|
-
}, this._handleWindowResize = () => {
|
|
1683
|
-
this._syncTabIndicator();
|
|
1684
|
-
}, this._cropPresets = [], this._debouncedShowLoader = debounce((p) => {
|
|
1685
|
-
this._showLoader = p;
|
|
1686
|
-
}, 500), this._updateInfoTooltip = debounce(() => {
|
|
1687
|
-
let p = this.$["*editorTransformations"], B = this.$["*currentOperation"], V = "", H = !1;
|
|
1688
|
-
if (this.$["*tabId"] === TabId.FILTERS) if (H = !0, this.$["*currentFilter"] && p?.filter?.name === this.$["*currentFilter"]) {
|
|
1689
|
-
let B = p?.filter?.amount || 100;
|
|
1690
|
-
V = `${this.$["*currentFilter"]} ${B}`;
|
|
1691
|
-
} else V = this.l10n(FAKE_ORIGINAL_FILTER);
|
|
1692
|
-
else if (this.showSubToolbar && this.$["*tabId"] === TabId.TUNING && B) {
|
|
1693
|
-
H = !0;
|
|
1694
|
-
let U = p?.[B] || COLOR_OPERATIONS_CONFIG[B].zero;
|
|
1695
|
-
V = `${this.l10n(B)} ${U}`;
|
|
1696
|
-
}
|
|
1697
|
-
H && (this.$["*operationTooltip"] = V), this._tooltipVisible = H;
|
|
1698
|
-
}, 0), this._subTopToolbarStyles = {
|
|
1699
|
-
hidden: "uc-sub-toolbar--top-hidden",
|
|
1700
|
-
visible: "uc-sub-toolbar--visible"
|
|
1701
|
-
}, this._subBottomToolbarStyles = {
|
|
1702
|
-
hidden: "uc-sub-toolbar--bottom-hidden",
|
|
1703
|
-
visible: "uc-sub-toolbar--visible"
|
|
1704
|
-
}, this._tabToggleStyles = {
|
|
1705
|
-
hidden: "uc-tab-toggle--hidden",
|
|
1706
|
-
visible: "uc-tab-toggle--visible"
|
|
1707
|
-
}, this._tabTogglesStyles = {
|
|
1708
|
-
hidden: "uc-tab-toggles--hidden",
|
|
1709
|
-
visible: "uc-tab-toggles--visible"
|
|
1710
|
-
}, this.init$ = {
|
|
1711
|
-
...this.init$,
|
|
1712
|
-
"*sliderEl": null,
|
|
1713
|
-
"*showSlider": !1,
|
|
1714
|
-
"*showListAspectRatio": !1,
|
|
1715
|
-
"*currentFilter": FAKE_ORIGINAL_FILTER,
|
|
1716
|
-
"*currentOperation": null,
|
|
1717
|
-
"*operationTooltip": null
|
|
1718
|
-
}, this._handleCancel = (p) => {
|
|
1719
|
-
this.telemetryManager.sendEventCloudImageEditor(p, this.$["*tabId"], { action: "cancel" }), this._cancelPreload?.();
|
|
1720
|
-
let B = this.$["*on.cancel"];
|
|
1721
|
-
B?.();
|
|
1722
|
-
}, this._handleApply = (p) => {
|
|
1723
|
-
this.telemetryManager.sendEventCloudImageEditor(p, this.$["*tabId"], { action: "apply" });
|
|
1724
|
-
let B = this.$["*on.apply"];
|
|
1725
|
-
B?.(this.$["*editorTransformations"]);
|
|
1726
|
-
}, this._handleApplySlider = (p) => {
|
|
1727
|
-
this.telemetryManager.sendEventCloudImageEditor(p, this.$["*tabId"], {
|
|
1728
|
-
action: "apply-slider",
|
|
1729
|
-
operation: parseFilterValue(this.$["*operationTooltip"])
|
|
1730
|
-
}), this._sliderRef.value?.apply(), this._onSliderClose();
|
|
1731
|
-
}, this._handleCancelSlider = (p) => {
|
|
1732
|
-
this.telemetryManager.sendEventCloudImageEditor(p, this.$["*tabId"], { action: "cancel-slider" }), this._sliderRef.value?.cancel(), this._onSliderClose();
|
|
1733
|
-
}, this._handleTabClick = (p) => {
|
|
1734
|
-
let B = p.currentTarget?.getAttribute("data-id");
|
|
1735
|
-
B && (this.telemetryManager.sendEventCloudImageEditor(p, B), this._activateTab(B, { fromViewer: !1 }));
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
_onSliderClose() {
|
|
1739
|
-
this.$["*showSlider"] = !1, this.$["*tabId"] === TabId.CROP && (this.$["*showListAspectRatio"] = !1), this.$["*tabId"] === TabId.TUNING && (this._tooltipVisible = !1);
|
|
1740
|
-
}
|
|
1741
|
-
_activateTab(p, { fromViewer: B = !1, force: V = !1 } = {}) {
|
|
1742
|
-
this.$["*tabId"] !== p && (this.$["*tabId"] = p), this._applyTabState(p, {
|
|
1743
|
-
fromViewer: B,
|
|
1744
|
-
force: V
|
|
1745
|
-
});
|
|
1746
|
-
}
|
|
1747
|
-
_applyTabState(p, { fromViewer: B, force: V = !1 }) {
|
|
1748
|
-
if (!V && this.activeTab === p) {
|
|
1749
|
-
this._syncTabIndicator();
|
|
1750
|
-
return;
|
|
1751
|
-
}
|
|
1752
|
-
this.activeTab = p;
|
|
1753
|
-
let H = this.$["*faderEl"], U = this.$["*cropperEl"];
|
|
1754
|
-
p === TabId.CROP ? (H?.deactivate(), this.$["*imageSize"] && U?.activate(this.$["*imageSize"], { fromViewer: B })) : (H?.activate({
|
|
1755
|
-
url: this.$["*originalUrl"],
|
|
1756
|
-
fromViewer: B
|
|
1757
|
-
}), U?.deactivate());
|
|
1758
|
-
for (let B of ALL_TABS) {
|
|
1759
|
-
let V = B === p, H = this.tabToggleRefs[B]?.value;
|
|
1760
|
-
H && (H.active = V), V && this._syncTabIndicator();
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
_syncTabIndicator() {
|
|
1764
|
-
let p = this.tabToggleRefs[this.activeTab]?.value, B = this._tabIndicatorRef.value;
|
|
1765
|
-
if (!p || !B) return;
|
|
1766
|
-
let V = p.offsetLeft, H = p.offsetWidth || Number(getComputedStyle(p).width.replace("px", ""));
|
|
1767
|
-
(this._tabIndicatorOffset !== V || this._tabIndicatorWidth !== H) && (this._tabIndicatorOffset = V, this._tabIndicatorWidth = H, B.style.transform = `translateX(${V}px)`, B.style.width = `${H}px`);
|
|
1768
|
-
}
|
|
1769
|
-
get _hasAspectRatioPicker() {
|
|
1770
|
-
return this._cropPresets.length >= 3;
|
|
1771
|
-
}
|
|
1772
|
-
_renderControlsByTab(p) {
|
|
1773
|
-
switch (p) {
|
|
1774
|
-
case TabId.CROP: return this._renderCropTabControls();
|
|
1775
|
-
case TabId.FILTERS: return this._renderFilterTabControls();
|
|
1776
|
-
case TabId.TUNING: return this._renderTuningTabControls();
|
|
1777
|
-
default: return [];
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
_renderCropTabControls() {
|
|
1781
|
-
let p = [];
|
|
1782
|
-
if (this._hasAspectRatioPicker) p.push(() => this._renderFreeformControl());
|
|
1783
|
-
else for (let B of this._cropPresets) p.push(() => this._renderAspectRatioControl(B));
|
|
1784
|
-
for (let B of ALL_CROP_OPERATIONS) p.push(() => this._renderCropOperationControl(B));
|
|
1785
|
-
return this._renderControlGroup(p);
|
|
1786
|
-
}
|
|
1787
|
-
_renderFilterTabControls() {
|
|
1788
|
-
let p = [FAKE_ORIGINAL_FILTER, ...ALL_FILTERS].map((p) => () => this._renderFilterControl(p));
|
|
1789
|
-
return this._renderControlGroup(p);
|
|
1790
|
-
}
|
|
1791
|
-
_renderTuningTabControls() {
|
|
1792
|
-
let p = ALL_COLOR_OPERATIONS.map((p) => () => this._renderOperationControl(p));
|
|
1793
|
-
return this._renderControlGroup(p);
|
|
1794
|
-
}
|
|
1795
|
-
_renderControlGroup(p) {
|
|
1796
|
-
return p.length ? p.map((p) => p()) : [];
|
|
1797
|
-
}
|
|
1798
|
-
_renderFreeformControl() {
|
|
1799
|
-
return b`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`;
|
|
1800
|
-
}
|
|
1801
|
-
_renderAspectRatioControl(p) {
|
|
1802
|
-
return b`<uc-editor-aspect-ratio-button-control .aspectRatio=${p}></uc-editor-aspect-ratio-button-control>`;
|
|
1803
|
-
}
|
|
1804
|
-
_renderCropOperationControl(p) {
|
|
1805
|
-
return b`<uc-editor-crop-button-control .operation=${p}></uc-editor-crop-button-control>`;
|
|
1806
|
-
}
|
|
1807
|
-
_renderFilterControl(p) {
|
|
1808
|
-
return b`<uc-editor-filter-control .filter=${p}></uc-editor-filter-control>`;
|
|
1809
|
-
}
|
|
1810
|
-
_renderOperationControl(p) {
|
|
1811
|
-
return b`<uc-editor-operation-control .operation=${p}></uc-editor-operation-control>`;
|
|
1812
|
-
}
|
|
1813
|
-
_renderAspectRatioList() {
|
|
1814
|
-
return this._hasAspectRatioPicker ? this._cropPresets.map((p) => this._renderAspectRatioControl(p)) : [];
|
|
1815
|
-
}
|
|
1816
|
-
async _preloadEditedImage() {
|
|
1817
|
-
if (this.$["*imgContainerEl"] && this.$["*originalUrl"]) {
|
|
1818
|
-
let p = this.$["*imgContainerEl"].offsetWidth, B = await this.proxyUrl(viewerImageSrc(this.$["*originalUrl"], p, this.$["*editorTransformations"]));
|
|
1819
|
-
this._cancelPreload?.();
|
|
1820
|
-
let { cancel: V } = batchPreloadImages([B]);
|
|
1821
|
-
this._cancelPreload = () => {
|
|
1822
|
-
V(), this._cancelPreload = void 0;
|
|
1823
|
-
};
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
initCallback() {
|
|
1827
|
-
super.initCallback(), this._cropPresets = [...this.$["*cropPresetList"] ?? []], this.sub("*cropPresetList", (p) => {
|
|
1828
|
-
this._cropPresets = [...p ?? []];
|
|
1829
|
-
}), this.sub("*imageSize", (p) => {
|
|
1830
|
-
p && setTimeout(() => {
|
|
1831
|
-
this._activateTab(this.$["*tabId"], { fromViewer: !0 });
|
|
1832
|
-
}, 0);
|
|
1833
|
-
}), this.sub("*editorTransformations", (p) => {
|
|
1834
|
-
let B = p?.filter?.name;
|
|
1835
|
-
this.$["*currentFilter"] !== B && (this.$["*currentFilter"] = B ?? "");
|
|
1836
|
-
}), this.sub("*currentFilter", () => {
|
|
1837
|
-
this._updateInfoTooltip();
|
|
1838
|
-
}), this.sub("*currentOperation", () => {
|
|
1839
|
-
this._updateInfoTooltip();
|
|
1840
|
-
}), this.sub("*tabId", (p) => {
|
|
1841
|
-
this._applyTabState(p, {
|
|
1842
|
-
fromViewer: !1,
|
|
1843
|
-
force: !0
|
|
1844
|
-
}), this._updateInfoTooltip();
|
|
1845
|
-
}), this.sub("*originalUrl", () => {
|
|
1846
|
-
this.$["*faderEl"]?.deactivate();
|
|
1847
|
-
}), this.sub("*editorTransformations", (p) => {
|
|
1848
|
-
this._preloadEditedImage(), this.$["*faderEl"]?.setTransformations(p);
|
|
1849
|
-
}), this.sub("*loadingOperations", (p) => {
|
|
1850
|
-
let B = !1;
|
|
1851
|
-
for (let [, V] of p.entries()) {
|
|
1852
|
-
if (B) break;
|
|
1853
|
-
for (let [, p] of V.entries()) if (p) {
|
|
1854
|
-
B = !0;
|
|
1855
|
-
break;
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
this._debouncedShowLoader(B);
|
|
1859
|
-
}), this.sub("*showSlider", (p) => {
|
|
1860
|
-
p ? (this.showSubToolbar = !0, this.showMainToolbar = !1, this._useSliderPanel = !0) : this.$["*showListAspectRatio"] || (this.showSubToolbar = !1, this.showMainToolbar = !0);
|
|
1861
|
-
}), this.sub("*showListAspectRatio", (p) => {
|
|
1862
|
-
p ? (this.showSubToolbar = !0, this.showMainToolbar = !1, this._useSliderPanel = !1) : this.$["*showSlider"] || (this.showSubToolbar = !1, this.showMainToolbar = !0);
|
|
1863
|
-
}), this.sub("*tabList", (p) => {
|
|
1864
|
-
if (this.tabList = p, this._showTabToggles = p.length > 1, !p.includes(this.$["*tabId"]) && p.length > 0) {
|
|
1865
|
-
let [B] = p;
|
|
1866
|
-
B && this._activateTab(B, { fromViewer: !1 });
|
|
1867
|
-
return;
|
|
1868
|
-
}
|
|
1869
|
-
this._syncTabIndicator();
|
|
1870
|
-
}), this.sub("*operationTooltip", (p) => {
|
|
1871
|
-
this._operationTooltip = p;
|
|
1872
|
-
}), this._updateInfoTooltip();
|
|
1873
|
-
}
|
|
1874
|
-
connectedCallback() {
|
|
1875
|
-
super.connectedCallback(), window.addEventListener("resize", this._handleWindowResize);
|
|
1876
|
-
}
|
|
1877
|
-
firstUpdated(p) {
|
|
1878
|
-
super.firstUpdated(p), this._assignSharedElements(), this._syncTabIndicator();
|
|
1879
|
-
}
|
|
1880
|
-
updated(p) {
|
|
1881
|
-
super.updated(p), (p.has("activeTab") || p.has("tabList")) && this.updateComplete.then(() => this._syncTabIndicator()), (p.has("showSubToolbar") || p.has("showMainToolbar")) && this._assignSharedElements();
|
|
1882
|
-
}
|
|
1883
|
-
disconnectedCallback() {
|
|
1884
|
-
window.removeEventListener("resize", this._handleWindowResize), super.disconnectedCallback(), this.$["*showSlider"] = !1, this.$["*showListAspectRatio"] = !1;
|
|
1885
|
-
}
|
|
1886
|
-
_assignSharedElements() {
|
|
1887
|
-
let p = this._sliderRef.value;
|
|
1888
|
-
p && (this.$["*sliderEl"] = p);
|
|
1889
|
-
}
|
|
1890
|
-
_renderTabToggle(p) {
|
|
1891
|
-
let B = this.tabList.includes(p), V = this.activeTab === p, U = this.tabList.indexOf(p), W = U >= 0 ? o$1({ gridColumn: `${U + 1}` }) : A;
|
|
1892
|
-
return b`
|
|
1893
|
-
<uc-presence-toggle class="uc-tab-toggle" .visible=${B} .styles=${this._tabToggleStyles}>
|
|
1894
|
-
<uc-btn-ui
|
|
1895
|
-
theme="tab"
|
|
1896
|
-
data-id=${p}
|
|
1897
|
-
icon=${p}
|
|
1898
|
-
role="tab"
|
|
1899
|
-
aria-controls=${`tab_${p}`}
|
|
1900
|
-
aria-selected=${V ? "true" : "false"}
|
|
1901
|
-
title-prop=${`a11y-editor-tab-${p}`}
|
|
1902
|
-
.active=${V}
|
|
1903
|
-
style=${W}
|
|
1904
|
-
@click=${this._handleTabClick}
|
|
1905
|
-
${n$1(this.tabToggleRefs[p])}
|
|
1906
|
-
></uc-btn-ui>
|
|
1907
|
-
</uc-presence-toggle>
|
|
1908
|
-
`;
|
|
1909
|
-
}
|
|
1910
|
-
_renderTabContent(p) {
|
|
1911
|
-
let B = this._renderControlsByTab(p);
|
|
1912
|
-
return b`
|
|
1913
|
-
<div
|
|
1914
|
-
id=${`tab_${p}`}
|
|
1915
|
-
class="uc-tab-content"
|
|
1916
|
-
>
|
|
1917
|
-
<uc-editor-scroller hidden-scrollbar>
|
|
1918
|
-
<div class="uc-controls-list_align">
|
|
1919
|
-
<div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">
|
|
1920
|
-
${B.length ? B : A}
|
|
1921
|
-
</div>
|
|
1922
|
-
</div>
|
|
1923
|
-
</uc-editor-scroller>
|
|
1924
|
-
</div>
|
|
1925
|
-
`;
|
|
1926
|
-
}
|
|
1927
|
-
render() {
|
|
1928
|
-
let p = ["uc-info-tooltip", this._tooltipVisible ? "uc-info-tooltip_visible" : "uc-info-tooltip_hidden"].join(" "), B = this._hasAspectRatioPicker;
|
|
1929
|
-
return b`
|
|
1930
|
-
<uc-line-loader-ui .active=${this._showLoader}></uc-line-loader-ui>
|
|
1931
|
-
<div class="uc-info-tooltip_container">
|
|
1932
|
-
<div class="uc-info-tooltip_wrapper">
|
|
1933
|
-
<div class=${p}>${this._operationTooltip ?? ""}</div>
|
|
1934
|
-
</div>
|
|
1935
|
-
</div>
|
|
1936
|
-
<div class="uc-toolbar-container">
|
|
1937
|
-
<uc-presence-toggle
|
|
1938
|
-
role="tablist"
|
|
1939
|
-
class="uc-sub-toolbar"
|
|
1940
|
-
.visible=${this.showMainToolbar}
|
|
1941
|
-
.styles=${this._subTopToolbarStyles}
|
|
1942
|
-
>
|
|
1943
|
-
<div class="uc-tab-content-row">
|
|
1944
|
-
${ALL_TABS.map((p) => n$2(this.activeTab === p, () => this._renderTabContent(p)))}
|
|
1945
|
-
</div>
|
|
1946
|
-
<div class="uc-controls-row">
|
|
1947
|
-
<uc-presence-toggle
|
|
1948
|
-
class="uc-tab-toggles"
|
|
1949
|
-
.visible=${this._showTabToggles}
|
|
1950
|
-
.styles=${this._tabTogglesStyles}
|
|
1951
|
-
@initial-render=${() => this._syncTabIndicator()}
|
|
1952
|
-
>
|
|
1953
|
-
<div
|
|
1954
|
-
class="uc-tab-toggles_indicator"
|
|
1955
|
-
${n$1(this._tabIndicatorRef)}
|
|
1956
|
-
></div>
|
|
1957
|
-
${ALL_TABS.map((p) => this._renderTabToggle(p))}
|
|
1958
|
-
</uc-presence-toggle>
|
|
1959
|
-
<uc-btn-ui
|
|
1960
|
-
style="order: -1"
|
|
1961
|
-
theme="secondary-icon"
|
|
1962
|
-
icon="closeMax"
|
|
1963
|
-
title-prop="cancel"
|
|
1964
|
-
@click=${this._handleCancel}
|
|
1965
|
-
></uc-btn-ui>
|
|
1966
|
-
<uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this._handleApply}></uc-btn-ui>
|
|
1967
|
-
</div>
|
|
1968
|
-
</uc-presence-toggle>
|
|
1969
|
-
<uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this._subBottomToolbarStyles}>
|
|
1970
|
-
<div class="uc-slider" ?hidden=${!this._useSliderPanel}>
|
|
1971
|
-
<uc-editor-slider ${n$1(this._sliderRef)}></uc-editor-slider>
|
|
1972
|
-
</div>
|
|
1973
|
-
|
|
1974
|
-
<div class="uc-list-aspect-ratio-container" ?hidden=${this._useSliderPanel || !B}>
|
|
1975
|
-
${B ? b`<div class="uc-list-aspect-ratio">${this._renderAspectRatioList()}</div>` : A}
|
|
1976
|
-
</div>
|
|
1977
|
-
<div class="uc-controls-row">
|
|
1978
|
-
<uc-btn-ui theme="secondary" @click=${this._handleCancelSlider} text=${this.l10n("cancel")}></uc-btn-ui>
|
|
1979
|
-
<uc-btn-ui theme="primary" @click=${this._handleApplySlider} text=${this.l10n("apply")}></uc-btn-ui>
|
|
1980
|
-
</div>
|
|
1981
|
-
</uc-presence-toggle>
|
|
1982
|
-
</div>
|
|
1983
|
-
`;
|
|
1984
|
-
}
|
|
1985
|
-
};
|
|
1986
|
-
__decorate([r()], EditorToolbar.prototype, "_showLoader", void 0), __decorate([r()], EditorToolbar.prototype, "showMainToolbar", void 0), __decorate([r()], EditorToolbar.prototype, "showSubToolbar", void 0), __decorate([r()], EditorToolbar.prototype, "_showTabToggles", void 0), __decorate([r()], EditorToolbar.prototype, "tabList", void 0), __decorate([r()], EditorToolbar.prototype, "activeTab", void 0), __decorate([r()], EditorToolbar.prototype, "_useSliderPanel", void 0), __decorate([r()], EditorToolbar.prototype, "_tooltipVisible", void 0), __decorate([r()], EditorToolbar.prototype, "_operationTooltip", void 0), __decorate([r()], EditorToolbar.prototype, "_cropPresets", void 0);
|
|
1987
|
-
var DEFAULT_TABS = serializeCsv([...ALL_TABS]), CloudImageEditorBlock = class extends LitBlock {
|
|
1988
|
-
constructor(...p) {
|
|
1989
|
-
super(...p), this.ctxOwner = !0, this._statusMessage = "", this._imageSrc = TRANSPARENT_PIXEL_SRC, this._fileType = "", this._showLoader = !1, this.uuid = null, this.cdnUrl = null, this.cropPreset = "", this.tabs = DEFAULT_TABS, this._hasNetworkProblems = !1, this._isInitialized = !1, this._pendingInitUpdate = null, this._debouncedShowLoader = debounce((p) => {
|
|
1990
|
-
this._showLoader = p;
|
|
1991
|
-
}, 300), this._imgRef = e(), this._cropperRef = e(), this._faderRef = e(), this._imgContainerRef = e(), this._handleImageLoad = () => {
|
|
1992
|
-
this._debouncedShowLoader(!1), this._imageSrc !== "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" && (this.$["*networkProblems"] = !1);
|
|
1993
|
-
}, this._handleImageError = () => {
|
|
1994
|
-
this._debouncedShowLoader(!1), this.$["*networkProblems"] = !0;
|
|
1995
|
-
}, this._handleRetryNetwork = () => {
|
|
1996
|
-
let p = this.$["*on.retryNetwork"];
|
|
1997
|
-
p?.();
|
|
1998
|
-
}, this.init$ = {
|
|
1999
|
-
...this.init$,
|
|
2000
|
-
...initState(this)
|
|
2001
|
-
};
|
|
2002
|
-
}
|
|
2003
|
-
static {
|
|
2004
|
-
this.styleAttrs = ["uc-cloud-image-editor"];
|
|
2005
|
-
}
|
|
2006
|
-
_scheduleInitialization() {
|
|
2007
|
-
this._isInitialized || this._pendingInitUpdate || (this._pendingInitUpdate = this.updateComplete.then(() => {
|
|
2008
|
-
this._pendingInitUpdate = null, this._isInitialized = !0;
|
|
2009
|
-
}));
|
|
2010
|
-
}
|
|
2011
|
-
initCallback() {
|
|
2012
|
-
super.initCallback(), this._syncTabListFromProp(), this._syncCropPresetState();
|
|
2013
|
-
}
|
|
2014
|
-
_assignSharedElements() {
|
|
2015
|
-
let p = this._faderRef.value;
|
|
2016
|
-
p && (this.$["*faderEl"] = p);
|
|
2017
|
-
let B = this._cropperRef.value;
|
|
2018
|
-
B && (this.$["*cropperEl"] = B);
|
|
2019
|
-
let V = this._imgContainerRef.value;
|
|
2020
|
-
V && (this.$["*imgContainerEl"] = V);
|
|
2021
|
-
let H = this._imgRef.value;
|
|
2022
|
-
H && (this.$["*imgEl"] = H);
|
|
2023
|
-
}
|
|
2024
|
-
_attachImageListeners() {
|
|
2025
|
-
let p = this._imgRef.value;
|
|
2026
|
-
p && (p.addEventListener("load", this._handleImageLoad), p.addEventListener("error", this._handleImageError));
|
|
2027
|
-
}
|
|
2028
|
-
_detachImageListeners() {
|
|
2029
|
-
let p = this._imgRef.value;
|
|
2030
|
-
p && (p.removeEventListener("load", this._handleImageLoad), p.removeEventListener("error", this._handleImageError));
|
|
2031
|
-
}
|
|
2032
|
-
get _imageClassName() {
|
|
2033
|
-
let p = this.$["*tabId"];
|
|
2034
|
-
return classNames("uc-image", {
|
|
2035
|
-
"uc-image_hidden_to_cropper": p === TabId.CROP,
|
|
2036
|
-
"uc-image_hidden_effects": p !== TabId.CROP
|
|
2037
|
-
});
|
|
2038
|
-
}
|
|
2039
|
-
_waitForSize() {
|
|
2040
|
-
return new Promise((p, B) => {
|
|
2041
|
-
let V = window.setTimeout(() => {
|
|
2042
|
-
B(/* @__PURE__ */ Error("[cloud-image-editor] timeout waiting for non-zero container size"));
|
|
2043
|
-
}, 3e3), H = new ResizeObserver((B) => {
|
|
2044
|
-
let [U] = B;
|
|
2045
|
-
U && U.contentRect.width > 0 && U.contentRect.height > 0 && (window.clearTimeout(V), H.disconnect(), window.setTimeout(() => p(), 0));
|
|
2046
|
-
});
|
|
2047
|
-
H.observe(this);
|
|
2048
|
-
});
|
|
2049
|
-
}
|
|
2050
|
-
firstUpdated(p) {
|
|
2051
|
-
super.firstUpdated(p), this._assignSharedElements(), this._attachImageListeners(), this.initEditor();
|
|
2052
|
-
let B = !!(this.uuid || this.cdnUrl), V = p.has("uuid") || p.has("cdnUrl");
|
|
2053
|
-
B && !V && this.updateImage();
|
|
2054
|
-
}
|
|
2055
|
-
disconnectedCallback() {
|
|
2056
|
-
this._detachImageListeners(), super.disconnectedCallback();
|
|
2057
|
-
}
|
|
2058
|
-
render() {
|
|
2059
|
-
let p = this._fileType ?? "", B = this._statusMessage ?? "", V = this._imageSrc || "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", U = this._showLoader, W = this._hasNetworkProblems;
|
|
2060
|
-
return b`
|
|
2061
|
-
${o(svg_sprite_default)}
|
|
2062
|
-
<div class="uc-wrapper uc-wrapper_desktop">
|
|
2063
|
-
<uc-presence-toggle class="uc-network_problems_splash" .visible=${W}>
|
|
2064
|
-
<div class="uc-network_problems_content">
|
|
2065
|
-
<div class="uc-network_problems_icon">
|
|
2066
|
-
<uc-icon name="sad"></uc-icon>
|
|
2067
|
-
</div>
|
|
2068
|
-
<div class="uc-network_problems_text">Network error</div>
|
|
2069
|
-
</div>
|
|
2070
|
-
<div class="uc-network_problems_footer">
|
|
2071
|
-
<uc-btn-ui theme="primary" text="Retry" @click=${this._handleRetryNetwork}></uc-btn-ui>
|
|
2072
|
-
</div>
|
|
2073
|
-
</uc-presence-toggle>
|
|
2074
|
-
<div class="uc-viewport">
|
|
2075
|
-
<div class="uc-file_type_outer">
|
|
2076
|
-
<div class="uc-file_type">${p}</div>
|
|
2077
|
-
</div>
|
|
2078
|
-
<div class="uc-image_container" ${n$1(this._imgContainerRef)}>
|
|
2079
|
-
<img src=${V} class=${this._imageClassName} ${n$1(this._imgRef)} />
|
|
2080
|
-
${n$2(this._isInitialized, () => b`<uc-editor-image-cropper ${n$1(this._cropperRef)}></uc-editor-image-cropper>`)}
|
|
2081
|
-
<uc-editor-image-fader ${n$1(this._faderRef)}></uc-editor-image-fader>
|
|
2082
|
-
</div>
|
|
2083
|
-
<div class="uc-info_pan">${B}</div>
|
|
2084
|
-
</div>
|
|
2085
|
-
<div class="uc-toolbar">
|
|
2086
|
-
<uc-line-loader-ui .active=${U}></uc-line-loader-ui>
|
|
2087
|
-
<div class="uc-toolbar_content uc-toolbar_content__editor">
|
|
2088
|
-
${n$2(this._isInitialized, () => b`<uc-editor-toolbar></uc-editor-toolbar>`)}
|
|
2089
|
-
</div>
|
|
2090
|
-
</div>
|
|
2091
|
-
</div>
|
|
2092
|
-
`;
|
|
2093
|
-
}
|
|
2094
|
-
updated(p) {
|
|
2095
|
-
super.updated(p), p.has("uuid") && this.uuid && this.updateImage(), p.has("cdnUrl") && this.cdnUrl && this.updateImage(), p.has("tabs") && this._syncTabListFromProp(), (p.has("cropPreset") || p.has("cdnUrl")) && this._syncCropPresetState();
|
|
2096
|
-
}
|
|
2097
|
-
_syncTabListFromProp() {
|
|
2098
|
-
let p = this.tabs || DEFAULT_TABS;
|
|
2099
|
-
this.$["*tabList"] = parseTabs(p);
|
|
2100
|
-
}
|
|
2101
|
-
_syncCropPresetState() {
|
|
2102
|
-
let p = parseCropPreset(this.cropPreset ?? ""), B = null;
|
|
2103
|
-
if (this.cdnUrl) {
|
|
2104
|
-
let V = operationsToTransformations(extractOperations(this.cdnUrl));
|
|
2105
|
-
if (Array.isArray(V?.crop?.dimensions)) {
|
|
2106
|
-
let [H, U] = V.crop.dimensions;
|
|
2107
|
-
B = getClosestAspectRatio(H, U, p, .1);
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
this.$["*cropPresetList"] = p, this.$["*currentAspectRatio"] = B ?? p?.[0] ?? null;
|
|
2111
|
-
}
|
|
2112
|
-
async updateImage() {
|
|
2113
|
-
if (this.isConnected) {
|
|
2114
|
-
if (await this._waitForSize(), this.cdnUrl) {
|
|
2115
|
-
let p = this.cdnUrl, B = createOriginalUrl(p, extractUuid(p));
|
|
2116
|
-
if (B === this.$["*originalUrl"]) return;
|
|
2117
|
-
this.$["*originalUrl"] = B;
|
|
2118
|
-
let V = operationsToTransformations(extractOperations(p));
|
|
2119
|
-
this.$["*editorTransformations"] = V;
|
|
2120
|
-
} else if (this.uuid) {
|
|
2121
|
-
let p = createOriginalUrl(this.cfg.cdnCname, this.uuid);
|
|
2122
|
-
if (p === this.$["*originalUrl"]) return;
|
|
2123
|
-
this.$["*originalUrl"] = p, Object.keys(this.$["*editorTransformations"]).length > 0 && (this.$["*editorTransformations"] = {});
|
|
2124
|
-
} else throw Error("No UUID nor CDN URL provided");
|
|
2125
|
-
this.$["*tabId"] === TabId.CROP ? this.$["*cropperEl"]?.deactivate({ reset: !0 }) : this.$["*faderEl"]?.deactivate();
|
|
2126
|
-
try {
|
|
2127
|
-
let p = this.$["*originalUrl"], B = await this.proxyUrl(createCdnUrl(p, createCdnUrlModifiers("json"))), { width: V, height: H } = await fetch(B).then((p) => p.json());
|
|
2128
|
-
this.$["*imageSize"] = {
|
|
2129
|
-
width: V,
|
|
2130
|
-
height: H
|
|
2131
|
-
}, this.$["*tabId"] === TabId.CROP ? this.$["*cropperEl"]?.activate(this.$["*imageSize"]) : this.$["*faderEl"]?.activate({ url: p });
|
|
2132
|
-
} catch (p) {
|
|
2133
|
-
p && (this.telemetryManager.sendEventError(p, "cloud editor image. Failed to load image info"), console.error("Failed to load image info", p));
|
|
2134
|
-
}
|
|
2135
|
-
this._scheduleInitialization();
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
async initEditor() {
|
|
2139
|
-
try {
|
|
2140
|
-
await this._waitForSize();
|
|
2141
|
-
} catch (p) {
|
|
2142
|
-
this.isConnected && console.error(p.message);
|
|
2143
|
-
return;
|
|
2144
|
-
}
|
|
2145
|
-
this.classList.add("uc-editor_ON"), this.sub("*networkProblems", (p) => {
|
|
2146
|
-
this._hasNetworkProblems = !!p;
|
|
2147
|
-
}), this.sub("*editorTransformations", (p) => {
|
|
2148
|
-
if (Object.keys(p).length === 0) return;
|
|
2149
|
-
let B = this.$["*originalUrl"], V = createCdnUrlModifiers(transformationsToOperations(p), "preview"), H = {
|
|
2150
|
-
originalUrl: B,
|
|
2151
|
-
cdnUrlModifiers: V,
|
|
2152
|
-
cdnUrl: createCdnUrl(B, V),
|
|
2153
|
-
transformations: p
|
|
2154
|
-
};
|
|
2155
|
-
this.dispatchEvent(new CustomEvent("change", {
|
|
2156
|
-
detail: H,
|
|
2157
|
-
bubbles: !0,
|
|
2158
|
-
composed: !0
|
|
2159
|
-
}));
|
|
2160
|
-
}, !1);
|
|
2161
|
-
}
|
|
2162
|
-
};
|
|
2163
|
-
__decorate([r()], CloudImageEditorBlock.prototype, "_statusMessage", void 0), __decorate([r()], CloudImageEditorBlock.prototype, "_imageSrc", void 0), __decorate([r()], CloudImageEditorBlock.prototype, "_fileType", void 0), __decorate([r()], CloudImageEditorBlock.prototype, "_showLoader", void 0), __decorate([n({
|
|
2164
|
-
type: String,
|
|
2165
|
-
reflect: !0
|
|
2166
|
-
})], CloudImageEditorBlock.prototype, "uuid", void 0), __decorate([n({
|
|
2167
|
-
type: String,
|
|
2168
|
-
attribute: "cdn-url",
|
|
2169
|
-
reflect: !0
|
|
2170
|
-
})], CloudImageEditorBlock.prototype, "cdnUrl", void 0), __decorate([n({
|
|
2171
|
-
type: String,
|
|
2172
|
-
attribute: "crop-preset",
|
|
2173
|
-
reflect: !0
|
|
2174
|
-
})], CloudImageEditorBlock.prototype, "cropPreset", void 0), __decorate([n({
|
|
2175
|
-
type: String,
|
|
2176
|
-
reflect: !0
|
|
2177
|
-
})], CloudImageEditorBlock.prototype, "tabs", void 0), __decorate([r()], CloudImageEditorBlock.prototype, "_hasNetworkProblems", void 0), __decorate([r()], CloudImageEditorBlock.prototype, "_isInitialized", void 0);
|
|
2178
|
-
var CloudImageEditor = class extends CloudImageEditorBlock {
|
|
2179
|
-
static {
|
|
2180
|
-
this.styleAttrs = [...super.styleAttrs, "uc-wgt-common"];
|
|
2181
|
-
}
|
|
2182
|
-
constructor() {
|
|
2183
|
-
super(), this.init$ = {
|
|
2184
|
-
...this.init$,
|
|
2185
|
-
"*solution": this.tagName
|
|
2186
|
-
};
|
|
2187
|
-
}
|
|
2188
|
-
initCallback() {
|
|
2189
|
-
super.initCallback(), this.telemetryManager.sendEvent({ eventType: InternalEventType.INIT_SOLUTION }), this.a11y?.registerBlock(this);
|
|
2190
|
-
}
|
|
2191
|
-
};
|
|
2192
|
-
export { PresenceToggle as _, EditorOperationControl as a, preloadImage as b, EditorAspectRatioButtonControl as c, SliderUi as d, EditorImageFader as f, LineLoaderUi as g, BtnUi as h, EditorScroller as i, EditorFreeformButtonControl as l, CropFrame as m, CloudImageEditorBlock as n, EditorFilterControl as o, EditorImageCropper as p, EditorToolbar as r, EditorCropButtonControl as s, CloudImageEditor as t, EditorSlider as u, o$2 as v, TRANSPARENT_PIXEL_SRC as x, throttle as y };
|