@uploadcare/file-uploader 1.27.1 → 1.28.0-alpha.1

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