@uploadcare/file-uploader 1.19.0-rc.0 → 1.19.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 (213) hide show
  1. package/abstract/Block.d.ts +2 -11
  2. package/abstract/Block.d.ts.map +1 -1
  3. package/abstract/Block.js +3 -29
  4. package/abstract/CTX.d.ts +2 -2
  5. package/abstract/CTX.d.ts.map +1 -1
  6. package/abstract/CTX.js +1 -1
  7. package/abstract/{managers/LocaleManager.d.ts → LocaleManager.d.ts} +8 -8
  8. package/abstract/{managers/LocaleManager.d.ts.map → LocaleManager.d.ts.map} +1 -1
  9. package/abstract/{managers/LocaleManager.js → LocaleManager.js} +8 -8
  10. package/abstract/{managers/ModalManager.d.ts → ModalManager.d.ts} +7 -7
  11. package/abstract/{managers/ModalManager.d.ts.map → ModalManager.d.ts.map} +1 -1
  12. package/abstract/{managers/ModalManager.js → ModalManager.js} +3 -3
  13. package/abstract/SecureUploadsManager.d.ts +22 -0
  14. package/abstract/{managers/SecureUploadsManager.d.ts.map → SecureUploadsManager.d.ts.map} +1 -1
  15. package/abstract/{managers/SecureUploadsManager.js → SecureUploadsManager.js} +5 -5
  16. package/abstract/SolutionBlock.d.ts +1 -1
  17. package/abstract/UploaderBlock.d.ts +3 -3
  18. package/abstract/UploaderBlock.d.ts.map +1 -1
  19. package/abstract/UploaderBlock.js +3 -2
  20. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  21. package/abstract/UploaderPublicApi.js +3 -0
  22. package/abstract/{managers/ValidationManager.d.ts → ValidationManager.d.ts} +7 -7
  23. package/abstract/{managers/ValidationManager.d.ts.map → ValidationManager.d.ts.map} +1 -1
  24. package/abstract/{managers/ValidationManager.js → ValidationManager.js} +14 -14
  25. package/abstract/{managers/a11y.d.ts → a11y.d.ts} +2 -2
  26. package/abstract/a11y.d.ts.map +1 -0
  27. package/abstract/{managers/a11y.js → a11y.js} +1 -1
  28. package/abstract/l10nProcessor.js +1 -1
  29. package/blocks/CameraSource/CameraSource.d.ts +1 -1
  30. package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +1 -1
  31. package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +1 -8
  32. package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
  33. package/blocks/CloudImageEditor/src/EditorFilterControl.js +1 -7
  34. package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +1 -1
  35. package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +1 -1
  36. package/blocks/CloudImageEditor/src/EditorOperationControl.js +3 -9
  37. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +4 -8
  38. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
  39. package/blocks/CloudImageEditor/src/EditorToolbar.js +4 -24
  40. package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +0 -1
  41. package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +1 -1
  42. package/blocks/CloudImageEditor/src/toolbar-constants.js +0 -2
  43. package/blocks/Config/Config.d.ts.map +1 -1
  44. package/blocks/Config/Config.js +6 -1
  45. package/blocks/Config/initialConfig.d.ts +1 -0
  46. package/blocks/Config/initialConfig.d.ts.map +1 -1
  47. package/blocks/Config/initialConfig.js +4 -2
  48. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  49. package/blocks/Config/normalizeConfigValue.js +3 -2
  50. package/blocks/Config/side-effects.d.ts +8 -4
  51. package/blocks/Config/side-effects.d.ts.map +1 -1
  52. package/blocks/Config/side-effects.js +113 -21
  53. package/blocks/DropArea/DropArea.d.ts +1 -1
  54. package/blocks/ExternalSource/ExternalSource.d.ts +7 -1
  55. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  56. package/blocks/ExternalSource/ExternalSource.js +24 -2
  57. package/blocks/ExternalSource/MessageBridge.d.ts.map +1 -1
  58. package/blocks/ExternalSource/MessageBridge.js +3 -1
  59. package/blocks/ExternalSource/types.d.ts +4 -0
  60. package/blocks/ExternalSource/types.d.ts.map +1 -1
  61. package/blocks/ExternalSource/types.js +4 -0
  62. package/blocks/FileItem/FileItem.d.ts +1 -1
  63. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  64. package/blocks/FileItem/FileItem.js +0 -16
  65. package/blocks/Modal/Modal.d.ts +6 -6
  66. package/blocks/Modal/Modal.d.ts.map +1 -1
  67. package/blocks/Modal/Modal.js +12 -10
  68. package/blocks/SimpleBtn/SimpleBtn.d.ts +1 -1
  69. package/blocks/SourceBtn/SourceBtn.d.ts +1 -1
  70. package/blocks/Thumb/Thumb.d.ts +1 -1
  71. package/blocks/UploadCtxProvider/EventEmitter.d.ts +4 -17
  72. package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
  73. package/blocks/UploadCtxProvider/EventEmitter.js +2 -14
  74. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -1
  75. package/blocks/UploadCtxProvider/UploadCtxProvider.js +1 -0
  76. package/blocks/UploadList/UploadList.d.ts +1 -1
  77. package/blocks/UrlSource/UrlSource.js +3 -1
  78. package/blocks/themes/uc-basic/common.css +4 -0
  79. package/blocks/themes/uc-basic/svg-sprite.d.ts +1 -1
  80. package/blocks/themes/uc-basic/svg-sprite.d.ts.map +1 -1
  81. package/blocks/themes/uc-basic/svg-sprite.js +1 -1
  82. package/env.d.ts +1 -1
  83. package/env.js +1 -1
  84. package/index.d.ts +1 -1
  85. package/index.js +1 -1
  86. package/index.ssr.d.ts +2 -4
  87. package/index.ssr.d.ts.map +1 -1
  88. package/index.ssr.js +12 -8
  89. package/locales/file-uploader/ar.d.ts +1 -0
  90. package/locales/file-uploader/ar.js +1 -0
  91. package/locales/file-uploader/az.d.ts +1 -0
  92. package/locales/file-uploader/az.js +1 -0
  93. package/locales/file-uploader/ca.d.ts +1 -0
  94. package/locales/file-uploader/ca.js +1 -0
  95. package/locales/file-uploader/cs.d.ts +1 -0
  96. package/locales/file-uploader/cs.js +1 -0
  97. package/locales/file-uploader/da.d.ts +1 -0
  98. package/locales/file-uploader/da.js +1 -0
  99. package/locales/file-uploader/de.d.ts +1 -0
  100. package/locales/file-uploader/de.js +1 -0
  101. package/locales/file-uploader/el.d.ts +1 -0
  102. package/locales/file-uploader/el.js +1 -0
  103. package/locales/file-uploader/en.d.ts +1 -0
  104. package/locales/file-uploader/en.js +1 -0
  105. package/locales/file-uploader/es.d.ts +1 -0
  106. package/locales/file-uploader/es.js +1 -0
  107. package/locales/file-uploader/et.d.ts +1 -0
  108. package/locales/file-uploader/et.js +1 -0
  109. package/locales/file-uploader/fi.d.ts +1 -0
  110. package/locales/file-uploader/fi.js +1 -0
  111. package/locales/file-uploader/fr.d.ts +1 -0
  112. package/locales/file-uploader/fr.js +1 -0
  113. package/locales/file-uploader/he.d.ts +1 -0
  114. package/locales/file-uploader/he.js +1 -0
  115. package/locales/file-uploader/hy.d.ts +1 -0
  116. package/locales/file-uploader/hy.js +1 -0
  117. package/locales/file-uploader/is.d.ts +1 -0
  118. package/locales/file-uploader/is.js +1 -0
  119. package/locales/file-uploader/it.d.ts +1 -0
  120. package/locales/file-uploader/it.js +1 -0
  121. package/locales/file-uploader/ja.d.ts +1 -0
  122. package/locales/file-uploader/ja.js +1 -0
  123. package/locales/file-uploader/ka.d.ts +1 -0
  124. package/locales/file-uploader/ka.js +1 -0
  125. package/locales/file-uploader/kk.d.ts +1 -0
  126. package/locales/file-uploader/kk.js +1 -0
  127. package/locales/file-uploader/ko.d.ts +1 -0
  128. package/locales/file-uploader/ko.js +1 -0
  129. package/locales/file-uploader/lv.d.ts +1 -0
  130. package/locales/file-uploader/lv.js +1 -0
  131. package/locales/file-uploader/nb.d.ts +1 -0
  132. package/locales/file-uploader/nb.js +1 -0
  133. package/locales/file-uploader/nl.d.ts +1 -0
  134. package/locales/file-uploader/nl.js +1 -0
  135. package/locales/file-uploader/pl.d.ts +1 -0
  136. package/locales/file-uploader/pl.js +1 -0
  137. package/locales/file-uploader/pt.d.ts +1 -0
  138. package/locales/file-uploader/pt.js +1 -0
  139. package/locales/file-uploader/ro.d.ts +1 -0
  140. package/locales/file-uploader/ro.js +1 -0
  141. package/locales/file-uploader/ru.d.ts +1 -0
  142. package/locales/file-uploader/ru.js +1 -0
  143. package/locales/file-uploader/sk.d.ts +1 -0
  144. package/locales/file-uploader/sk.js +1 -0
  145. package/locales/file-uploader/sr.d.ts +1 -0
  146. package/locales/file-uploader/sr.js +1 -0
  147. package/locales/file-uploader/sv.d.ts +1 -0
  148. package/locales/file-uploader/sv.js +1 -0
  149. package/locales/file-uploader/tr.d.ts +1 -0
  150. package/locales/file-uploader/tr.js +1 -0
  151. package/locales/file-uploader/uk.d.ts +1 -0
  152. package/locales/file-uploader/uk.js +1 -0
  153. package/locales/file-uploader/vi.d.ts +1 -0
  154. package/locales/file-uploader/vi.js +1 -0
  155. package/locales/file-uploader/zh-TW.d.ts +1 -0
  156. package/locales/file-uploader/zh-TW.js +1 -0
  157. package/locales/file-uploader/zh.d.ts +1 -0
  158. package/locales/file-uploader/zh.js +1 -0
  159. package/package.json +6 -8
  160. package/solutions/cloud-image-editor/CloudImageEditor.d.ts +0 -34
  161. package/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +1 -1
  162. package/solutions/cloud-image-editor/CloudImageEditor.js +0 -12
  163. package/solutions/file-uploader/inline/FileUploaderInline.d.ts +1 -2
  164. package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
  165. package/solutions/file-uploader/inline/FileUploaderInline.js +0 -4
  166. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +9 -10
  167. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  168. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +3 -7
  169. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +1 -2
  170. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  171. package/solutions/file-uploader/regular/FileUploaderRegular.js +0 -4
  172. package/types/events.d.ts +1 -1
  173. package/types/exported.d.ts +66 -54
  174. package/utils/get-top-level-origin.d.ts +2 -0
  175. package/utils/get-top-level-origin.d.ts.map +1 -0
  176. package/utils/get-top-level-origin.js +11 -0
  177. package/utils/validators/collection/validateCollectionUploadError.d.ts +2 -2
  178. package/utils/validators/collection/validateCollectionUploadError.d.ts.map +1 -1
  179. package/utils/validators/collection/validateCollectionUploadError.js +1 -1
  180. package/utils/validators/collection/validateMultiple.d.ts +2 -2
  181. package/utils/validators/collection/validateMultiple.d.ts.map +1 -1
  182. package/utils/validators/collection/validateMultiple.js +1 -1
  183. package/utils/validators/file/validateFileType.d.ts +2 -2
  184. package/utils/validators/file/validateFileType.d.ts.map +1 -1
  185. package/utils/validators/file/validateFileType.js +1 -1
  186. package/utils/validators/file/validateIsImage.d.ts +2 -2
  187. package/utils/validators/file/validateIsImage.d.ts.map +1 -1
  188. package/utils/validators/file/validateIsImage.js +1 -1
  189. package/utils/validators/file/validateMaxSizeLimit.d.ts +2 -2
  190. package/utils/validators/file/validateMaxSizeLimit.d.ts.map +1 -1
  191. package/utils/validators/file/validateMaxSizeLimit.js +1 -1
  192. package/utils/validators/file/validateUploadError.d.ts +2 -2
  193. package/utils/validators/file/validateUploadError.d.ts.map +1 -1
  194. package/utils/validators/file/validateUploadError.js +1 -1
  195. package/web/file-uploader.iife.min.js +4 -4
  196. package/web/file-uploader.min.js +4 -4
  197. package/web/uc-basic.min.css +1 -1
  198. package/web/uc-cloud-image-editor.min.js +4 -4
  199. package/web/uc-file-uploader-inline.min.css +1 -1
  200. package/web/uc-file-uploader-inline.min.js +4 -4
  201. package/web/uc-file-uploader-minimal.min.css +1 -1
  202. package/web/uc-file-uploader-minimal.min.js +4 -4
  203. package/web/uc-file-uploader-regular.min.css +1 -1
  204. package/web/uc-file-uploader-regular.min.js +4 -4
  205. package/web/uc-img.min.js +1 -1
  206. package/abstract/managers/SecureUploadsManager.d.ts +0 -22
  207. package/abstract/managers/TelemetryManager.d.ts +0 -65
  208. package/abstract/managers/TelemetryManager.d.ts.map +0 -1
  209. package/abstract/managers/TelemetryManager.js +0 -201
  210. package/abstract/managers/a11y.d.ts.map +0 -1
  211. package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +0 -11
  212. package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +0 -1
  213. package/blocks/CloudImageEditor/src/utils/parseFilterValue.js +0 -11
@@ -23,7 +23,7 @@
23
23
  * SOFTWARE.
24
24
  *
25
25
  */
26
- "use strict";var UC=(()=>{var Lt=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var Na=Object.getOwnPropertyNames;var Va=Object.getPrototypeOf,za=Object.prototype.hasOwnProperty;var Ba=Reflect.get;var Ha=(r,t,e)=>t in r?Lt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var n=(r,t)=>Lt(r,"name",{value:t,configurable:!0});var ja=(r,t)=>{for(var e in t)Lt(r,e,{get:t[e],enumerable:!0})},Ga=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Na(t))!za.call(r,s)&&s!==e&&Lt(r,s,{get:()=>t[s],enumerable:!(i=Fa(t,s))||i.enumerable});return r};var Wa=r=>Ga(Lt({},"__esModule",{value:!0}),r);var d=(r,t,e)=>Ha(r,typeof t!="symbol"?t+"":t,e);var X=(r,t,e)=>Ba(Va(r),e,t);var Ku={};ja(Ku,{ActivityBlock:()=>b,ActivityHeader:()=>bs,BaseComponent:()=>_e,Block:()=>y,BtnUi:()=>Tt,CameraSource:()=>ei,CloudImageEditor:()=>Cs,CloudImageEditorActivity:()=>fs,CloudImageEditorBlock:()=>fe,Config:()=>ta,Copyright:()=>_s,CropFrame:()=>si,Data:()=>S,DropArea:()=>gt,EditorCropButtonControl:()=>Ct,EditorFilterControl:()=>We,EditorImageCropper:()=>ai,EditorImageFader:()=>hs,EditorOperationControl:()=>At,EditorScroller:()=>li,EditorSlider:()=>oi,EditorToolbar:()=>ci,ExternalSource:()=>pi,ExternalUploadSource:()=>Ve,FileItem:()=>wt,FileUploaderInline:()=>bi,FileUploaderMinimal:()=>gi,FileUploaderRegular:()=>Ot,FormInput:()=>gs,Icon:()=>ut,Img:()=>os,LineLoaderUi:()=>ui,Modal:()=>Yt,ModalEvents:()=>D,PACKAGE_NAME:()=>xe,PACKAGE_VERSION:()=>Te,PresenceToggle:()=>di,ProgressBar:()=>ii,ProgressBarCommon:()=>ti,Select:()=>fi,SimpleBtn:()=>pt,SliderUi:()=>hi,SolutionBlock:()=>ce,SourceBtn:()=>bt,SourceList:()=>ns,Spinner:()=>mi,StartFrom:()=>Kt,Thumb:()=>St,UID:()=>De,UploadCtxProvider:()=>Aa,UploadList:()=>Jt,UploadSource:()=>L,UploaderBlock:()=>k,UrlSource:()=>Qt,defineComponents:()=>Es,defineLocale:()=>Js,loadFileUploaderFrom:()=>Ra,toKebabCase:()=>lt});var qa=Object.defineProperty,Xa=n((r,t,e)=>t in r?qa(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,"__defNormalProp"),Ts=n((r,t,e)=>(Xa(r,typeof t!="symbol"?t+"":t,e),e),"__publicField");function Ka(r){let t=n(e=>{var i;for(let s in e)((i=e[s])==null?void 0:i.constructor)===Object&&(e[s]=t(e[s]));return{...e}},"clone");return t(r)}n(Ka,"cloneObj");var Xe,S=(Xe=class{constructor(t){t.constructor===Object?this.store=Ka(t):(this._storeIsProxy=!0,this.store=t),this.callbackMap=Object.create(null)}static warn(t,e){console.warn(`Symbiote Data: cannot ${t}. Prop name: `+e)}read(t){return!this._storeIsProxy&&!this.store.hasOwnProperty(t)?(S.warn("read",t),null):this.store[t]}has(t){return this._storeIsProxy?this.store[t]!==void 0:this.store.hasOwnProperty(t)}add(t,e,i=!1){!i&&Object.keys(this.store).includes(t)||(this.store[t]=e,this.notify(t))}pub(t,e){if(!this._storeIsProxy&&!this.store.hasOwnProperty(t)){S.warn("publish",t);return}this.store[t]=e,this.notify(t)}multiPub(t){for(let e in t)this.pub(e,t[e])}notify(t){this.callbackMap[t]&&this.callbackMap[t].forEach(e=>{e(this.store[t])})}sub(t,e,i=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(t)?(S.warn("subscribe",t),null):(this.callbackMap[t]||(this.callbackMap[t]=new Set),this.callbackMap[t].add(e),i&&e(this.store[t]),{remove:n(()=>{this.callbackMap[t].delete(e),this.callbackMap[t].size||delete this.callbackMap[t]},"remove"),callback:e})}static registerCtx(t,e=Symbol()){let i=S.globalStore.get(e);return i?console.warn('State: context UID "'+e+'" already in use'):(i=new S(t),S.globalStore.set(e,i)),i}static deleteCtx(t){S.globalStore.delete(t)}static getCtx(t,e=!0){return S.globalStore.get(t)||(e&&console.warn('State: wrong context UID - "'+t+'"'),null)}},n(Xe,"Data"),Xe);S.globalStore=new Map;var T=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),$o="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Za=$o.length-1,Ke,De=(Ke=class{static generate(t="XXXXXXXXX-XXX"){let e="";for(let i=0;i<t.length;i++)e+=t[i]==="-"?t[i]:$o.charAt(Math.random()*Za);return e}},n(Ke,"UID"),Ke);function ko(r,t,e){let i=!0,s,o=t.split(".");return o.forEach((a,l)=>{l<o.length-1?r=r[a]:s=a}),r?r[s]=e:i=!1,i}n(ko,"setNestedProp");function Ya(r){return r.split("-").map((t,e)=>t&&e?t[0].toUpperCase()+t.slice(1):t).join("").split("_").map((t,e)=>t&&e?t.toUpperCase():t).join("")}n(Ya,"kebabToCamel");function Ja(r,t){[...r.querySelectorAll(`[${T.REPEAT_ATTR}]`)].forEach(e=>{var a;let i=e.getAttribute(T.REPEAT_ITEM_TAG_ATTR),s;if(i&&(s=window.customElements.get(i)),!s){s=(a=class extends t.BaseComponent{constructor(){super(),i||(this.style.display="contents")}},n(a,"itemClass"),a);let l=e.innerHTML;s.template=l,s.reg(i)}for(;e.firstChild;)e.firstChild.remove();let o=e.getAttribute(T.REPEAT_ATTR);t.sub(o,l=>{if(!l){for(;e.firstChild;)e.firstChild.remove();return}let c=[...e.children],u,p=n(h=>{h.forEach((m,g)=>{if(c[g])if(c[g].set$)setTimeout(()=>{c[g].set$(m)});else for(let _ in m)c[g][_]=m[_];else{u||(u=new DocumentFragment);let _=new s;Object.assign(_.init$,m),u.appendChild(_)}}),u&&e.appendChild(u);let f=c.slice(h.length,c.length);for(let m of f)m.remove()},"fillItems");if(l.constructor===Array)p(l);else if(l.constructor===Object){let h=[];for(let f in l){let m=l[f];Object.defineProperty(m,"_KEY_",{value:f,enumerable:!0}),h.push(m)}p(h)}else console.warn("Symbiote repeat data type error:"),console.log(l)}),e.removeAttribute(T.REPEAT_ATTR),e.removeAttribute(T.REPEAT_ITEM_TAG_ATTR)})}n(Ja,"repeatProcessor");var Io="__default__";function Qa(r,t){if(t.shadowRoot)return;let e=[...r.querySelectorAll("slot")];if(!e.length)return;let i={};e.forEach(s=>{let o=s.getAttribute("name")||Io;i[o]={slot:s,fr:document.createDocumentFragment()}}),t.initChildren.forEach(s=>{var o;let a=Io;s instanceof Element&&s.hasAttribute("slot")&&(a=s.getAttribute("slot"),s.removeAttribute("slot")),(o=i[a])==null||o.fr.appendChild(s)}),Object.values(i).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(o,s.slot)}else s.slot.remove()})}n(Qa,"slotProcessor");function el(r,t){[...r.querySelectorAll(`[${T.EL_REF_ATTR}]`)].forEach(e=>{let i=e.getAttribute(T.EL_REF_ATTR);t.ref[i]=e,e.removeAttribute(T.EL_REF_ATTR)})}n(el,"refProcessor");function tl(r,t){[...r.querySelectorAll(`[${T.BIND_ATTR}]`)].forEach(e=>{let s=e.getAttribute(T.BIND_ATTR).split(";");[...e.attributes].forEach(o=>{if(o.name.startsWith("-")&&o.value){let a=Ya(o.name.replace("-",""));s.push(a+":"+o.value),e.removeAttribute(o.name)}}),s.forEach(o=>{if(!o)return;let a=o.split(":").map(p=>p.trim()),l=a[0],c;l.indexOf(T.ATTR_BIND_PRFX)===0&&(c=!0,l=l.replace(T.ATTR_BIND_PRFX,""));let u=a[1].split(",").map(p=>p.trim());for(let p of u){let h;p.startsWith("!!")?(h="double",p=p.replace("!!","")):p.startsWith("!")&&(h="single",p=p.replace("!","")),t.sub(p,f=>{h==="double"?f=!!f:h==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?e.setAttribute(l,""):e.removeAttribute(l):e.setAttribute(l,f):ko(e,l,f)||(e[T.SET_LATER_KEY]||(e[T.SET_LATER_KEY]=Object.create(null)),e[T.SET_LATER_KEY][l]=f)})}}),e.removeAttribute(T.BIND_ATTR)})}n(tl,"domSetProcessor");var _i="{{",Pt="}}",il="skip-text";function sl(r){let t,e=[],i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:n(s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(il))&&s.textContent.includes(_i)&&s.textContent.includes(Pt)&&1},"acceptNode")});for(;t=i.nextNode();)e.push(t);return e}n(sl,"getTextNodesWithTokens");var rl=n(function(r,t){sl(r).forEach(i=>{let s=[],o;for(;i.textContent.includes(Pt);)i.textContent.startsWith(_i)?(o=i.textContent.indexOf(Pt)+Pt.length,i.splitText(o),s.push(i)):(o=i.textContent.indexOf(_i),i.splitText(o)),i=i.nextSibling;s.forEach(a=>{let l=a.textContent.replace(_i,"").replace(Pt,"");a.textContent="",t.sub(l,c=>{a.textContent=c})})})},"txtNodesProcessor"),ol=[Ja,Qa,el,tl,rl],vi="'",et='"',nl=/\\([0-9a-fA-F]{1,6} ?)/g;function al(r){return(r[0]===et||r[0]===vi)&&(r[r.length-1]===et||r[r.length-1]===vi)}n(al,"hasLeadingTrailingQuotes");function ll(r){return(r[0]===et||r[0]===vi)&&(r=r.slice(1)),(r[r.length-1]===et||r[r.length-1]===vi)&&(r=r.slice(0,-1)),r}n(ll,"trimQuotes");function cl(r){let t="",e="";for(var i=0;i<r.length;i++){let s=r[i+1];r[i]==="\\"&&s==='"'?(t+='\\"',i++):r[i]==='"'&&e!=="\\"?t+='\\"':t+=r[i],e=r[i]}return t}n(cl,"escapeQuotes");function ul(r){let t=r;al(r)&&(t=ll(t),t=t.replace(nl,(e,i)=>String.fromCodePoint(parseInt(i.trim(),16))),t=t.replaceAll(`\\
27
- `,"\\n"),t=cl(t),t=et+t+et);try{return JSON.parse(t)}catch{throw new Error(`Failed to parse CSS property value: ${t}. Original input: ${r}`)}}n(ul,"parseCssPropertyValue");var Oo=0,qe=null,be=null,Ze,Ie=(Ze=class extends HTMLElement{constructor(){super(),Ts(this,"updateCssData",()=>{var t;this.dropCssDataCache(),(t=this.__boundCssProps)==null||t.forEach(e=>{let i=this.getCssData(this.__extractCssName(e),!0);i!==null&&this.$[e]!==i&&(this.$[e]=i)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return Ie}initCallback(){}__initCallback(){var t;this.__initialized||(this.__initialized=!0,(t=this.initCallback)==null||t.call(this))}render(t,e=this.renderShadow){let i;if((e||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let o=this.getAttribute(T.USE_TPL);if(o){let a=this.getRootNode(),l=(a==null?void 0:a.querySelector(o))||document.querySelector(o);l?t=l.content.cloneNode(!0):console.warn(`Symbiote template "${o}" is not found...`)}}if(this.processInnerHtml)for(let o of this.tplProcessors)o(this,this);if(t||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(t==null?void 0:t.constructor)===DocumentFragment)i=t;else if((t==null?void 0:t.constructor)===String){let o=document.createElement("template");o.innerHTML=t,i=o.content.cloneNode(!0)}else this.constructor.__tpl&&(i=this.constructor.__tpl.content.cloneNode(!0));for(let o of this.tplProcessors)o(i,this)}let s=n(()=>{i&&(e&&this.shadowRoot.appendChild(i)||this.appendChild(i)),this.__initCallback()},"addFr");if(this.constructor.__shadowStylesUrl){e=!0;let o=document.createElement("link");o.rel="stylesheet",o.href=this.constructor.__shadowStylesUrl,o.onload=s,this.shadowRoot.prepend(o)}else s()}addTemplateProcessor(t){this.tplProcessors.add(t)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=De.generate(),this.style.setProperty(T.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(T.CSS_CTX_PROP,!0)}get ctxName(){var t;let e=((t=this.getAttribute(T.CTX_NAME_ATTR))==null?void 0:t.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=e,e}get localCtx(){return this.__localCtx||(this.__localCtx=S.registerCtx({},this)),this.__localCtx}get nodeCtx(){return S.getCtx(this.ctxName,!1)||S.registerCtx({},this.ctxName)}static __parseProp(t,e){let i,s;if(t.startsWith(T.EXT_DATA_CTX_PRFX))i=e.nodeCtx,s=t.replace(T.EXT_DATA_CTX_PRFX,"");else if(t.includes(T.NAMED_DATA_CTX_SPLTR)){let o=t.split(T.NAMED_DATA_CTX_SPLTR);i=S.getCtx(o[0]),s=o[1]}else i=e.localCtx,s=t;return{ctx:i,name:s}}sub(t,e,i=!0){let s=n(a=>{this.isConnected&&e(a)},"subCb"),o=Ie.__parseProp(t,this);o.ctx.has(o.name)?this.allSubs.add(o.ctx.sub(o.name,s,i)):window.setTimeout(()=>{this.allSubs.add(o.ctx.sub(o.name,s,i))})}notify(t){let e=Ie.__parseProp(t,this);e.ctx.notify(e.name)}has(t){let e=Ie.__parseProp(t,this);return e.ctx.has(e.name)}add(t,e,i=!1){let s=Ie.__parseProp(t,this);s.ctx.add(s.name,e,i)}add$(t,e=!1){for(let i in t)this.add(i,t[i],e)}get $(){if(!this.__stateProxy){let t=Object.create(null);this.__stateProxy=new Proxy(t,{set:n((e,i,s)=>{let o=Ie.__parseProp(i,this);return o.ctx.pub(o.name,s),!0},"set"),get:n((e,i)=>{let s=Ie.__parseProp(i,this);return s.ctx.read(s.name)},"get")})}return this.__stateProxy}set$(t,e=!1){for(let i in t){let s=t[i];e||![String,Number,Boolean].includes(s==null?void 0:s.constructor)?this.$[i]=s:this.$[i]!==s&&(this.$[i]=s)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(T.CTX_OWNER_ATTR)&&this.getAttribute(T.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let t=this.constructor.__attrDesc;if(t)for(let e of Object.values(t))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(T.EXT_DATA_CTX_PRFX))this.nodeCtx.add(e.replace(T.EXT_DATA_CTX_PRFX,""),this.init$[e],this.__ctxOwner);else if(e.includes(T.NAMED_DATA_CTX_SPLTR)){let i=e.split(T.NAMED_DATA_CTX_SPLTR),s=i[0].trim(),o=i[1].trim();if(s&&o){let a=S.getCtx(s,!1);a||(a=S.registerCtx({},s)),a.add(o,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);this.__dataCtxInitialized=!0}connectedCallback(){var t;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let e=(t=this.getAttribute(T.CTX_NAME_ATTR))==null?void 0:t.trim();if(e&&this.style.setProperty(T.CSS_CTX_PROP,`'${e}'`),this.__initDataCtx(),this[T.SET_LATER_KEY]){for(let i in this[T.SET_LATER_KEY])ko(this,i,this[T.SET_LATER_KEY][i]);delete this[T.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let i of ol)this.addTemplateProcessor(i);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let i=this.getRootNode();if(!i)return;if(i==null?void 0:i.querySelector(`link[${T.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let o=this.constructor.__rootStylesLink.cloneNode(!0);o.setAttribute(T.ROOT_STYLE_ATTR_NAME,this.constructor.is),o.onload=()=>{this.render()},i.nodeType===Node.DOCUMENT_NODE?i.head.appendChild(o):i.prepend(o)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let t of this.allSubs)t.remove(),this.allSubs.delete(t);for(let t of this.tplProcessors)this.tplProcessors.delete(t);be==null||be.delete(this.updateCssData),be!=null&&be.size||(qe==null||qe.disconnect(),qe=null,be=null)},100)))}static reg(t,e=!1){t||(Oo++,t=`${T.AUTO_TAG_PRFX}-${Oo}`),this.__tag=t;let i=window.customElements.get(t);if(i){!e&&i!==this&&console.warn([`Element with tag name "${t}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
28
- `));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=Object.keys(t),this.__attrDesc=t}attributeChangedCallback(t,e,i){var s;if(e===i)return;let o=(s=this.constructor.__attrDesc)==null?void 0:s[t];o?this.__dataCtxInitialized?this.$[o]=i:this.init$[o]=i:this[t]=i}getCssData(t,e=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(t)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let i=this.__computedStyle.getPropertyValue(t).trim();try{this.__cssDataCache[t]=ul(i)}catch{!e&&console.warn(`CSS Data error: ${t}`),this.__cssDataCache[t]=null}}return this.__cssDataCache[t]}__extractCssName(t){return t.split("--").map((e,i)=>i===0?"":e).join("--")}__initStyleAttrObserver(){be||(be=new Set),be.add(this.updateCssData),qe||(qe=new MutationObserver(t=>{t[0].type==="attributes"&&be.forEach(e=>{e()})}),qe.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(t,e=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(t);let i=this.getCssData(this.__extractCssName(t),!0);i===null&&(i=e),this.add(t,i),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(t,e,i){let s="__"+t;this[s]=this[t],Object.defineProperty(this,t,{set:n(o=>{this[s]=o,i?window.setTimeout(()=>{e==null||e(o)}):e==null||e(o)},"set"),get:n(()=>this[s],"get")}),this[t]=this[s]}static set shadowStyles(t){let e=new Blob([t],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(e)}static set rootStyles(t){if(!this.__rootStylesLink){let e=new Blob([t],{type:"text/css"}),i=URL.createObjectURL(e),s=document.createElement("link");s.href=i,s.rel="stylesheet",this.__rootStylesLink=s}}},n(Ze,"_BaseComponent"),Ze),_e=Ie;Ts(_e,"template");var Ye,xs=(Ye=class{static _print(t){console.warn(t)}static setDefaultTitle(t){this.defaultTitle=t}static setRoutingMap(t){Object.assign(this.appMap,t);for(let e in this.appMap)!this.defaultRoute&&this.appMap[e].default===!0?this.defaultRoute=e:!this.errorRoute&&this.appMap[e].error===!0&&(this.errorRoute=e)}static set routingEventName(t){this.__routingEventName=t}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let t={route:null,options:{}};return window.location.search.split(this.separator).forEach(i=>{if(i.includes("?"))t.route=i.replace("?","");else if(i.includes("=")){let s=i.split("=");t.options[s[0]]=decodeURI(s[1])}else t.options[i]=!0}),t}static notify(){let t=this.readAddressBar(),e=this.appMap[t.route];if(e&&e.title&&(document.title=e.title),t.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!e&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e){this._print(`Route "${t.route}" not found...`);return}let i=new CustomEvent(xs.routingEventName,{detail:{route:t.route,options:Object.assign(e||{},t.options)}});window.dispatchEvent(i)}static reflect(t,e={}){let i=this.appMap[t];if(!i){this._print("Wrong route: "+t);return}let s="?"+t;for(let a in e)e[a]===!0?s+=this.separator+a:s+=this.separator+a+`=${e[a]}`;let o=i.title||this.defaultTitle||"";window.history.pushState(null,o,s),document.title=o}static applyRoute(t,e={}){this.reflect(t,e),this.notify()}static setSeparator(t){this._separator=t}static get separator(){return this._separator||"&"}static createRouterData(t,e){this.setRoutingMap(e);let i=S.registerCtx({route:null,options:null,title:null},t);return window.addEventListener(this.routingEventName,s=>{var o;i.multiPub({route:s.detail.route,options:s.detail.options,title:((o=s.detail.options)==null?void 0:o.title)||this.defaultTitle||""})}),xs.notify(),this.initPopstateListener(),i}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}},n(Ye,"AppRouter"),Ye);xs.appMap=Object.create(null);function Ut(r,t){for(let e in t)e.includes("-")?r.style.setProperty(e,t[e]):r.style[e]=t[e]}n(Ut,"applyStyles");function dl(r,t){for(let e in t)t[e].constructor===Boolean?t[e]?r.setAttribute(e,""):r.removeAttribute(e):r.setAttribute(e,t[e])}n(dl,"applyAttributes");function Ss(r={tag:"div"}){let t=document.createElement(r.tag);if(r.attributes&&dl(t,r.attributes),r.styles&&Ut(t,r.styles),r.properties)for(let e in r.properties)t[e]=r.properties[e];return r.processors&&r.processors.forEach(e=>{e(t)}),r.children&&r.children.forEach(e=>{let i=Ss(e);t.appendChild(i)}),t}n(Ss,"create");var Mo="idb-store-ready",hl="symbiote-db",pl="symbiote-idb-update_",Je,fl=(Je=class{_notifyWhenReady(t=null){window.dispatchEvent(new CustomEvent(Mo,{detail:{dbName:this.name,storeName:this.storeName,event:t}}))}get _updEventName(){return pl+this.name}_getUpdateEvent(t){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:t}})}_notifySubscribers(t){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,t),window.dispatchEvent(this._getUpdateEvent(t))}constructor(t,e){this.name=t,this.storeName=e,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=i=>{this.db=i.target.result,this.objStore=this.db.createObjectStore(e,{keyPath:"_key"}),this.objStore.transaction.oncomplete=s=>{this._notifyWhenReady(s)}},this.request.onsuccess=i=>{this.db=i.target.result,this._notifyWhenReady(i)},this.request.onerror=i=>{console.error(i)},this._subscriptionsMap={},this._updateHandler=i=>{i.key===this.name&&this._subscriptionsMap[i.newValue]&&this._subscriptionsMap[i.newValue].forEach(async o=>{o(await this.read(i.newValue))})},this._localUpdateHandler=i=>{this._updateHandler(i.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(t){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(t);return new Promise((s,o)=>{i.onsuccess=a=>{var l;(l=a.target.result)!=null&&l._value?s(a.target.result._value):(s(null),console.warn(`IDB: cannot read "${t}"`))},i.onerror=a=>{o(a)}})}write(t,e,i=!1){let s={_key:t,_value:e},a=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(s);return new Promise((l,c)=>{a.onsuccess=u=>{i||this._notifySubscribers(t),l(u.target.result)},a.onerror=u=>{c(u)}})}delete(t,e=!1){let s=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);return new Promise((o,a)=>{s.onsuccess=l=>{e||this._notifySubscribers(t),o(l)},s.onerror=l=>{a(l)}})}getAll(){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((i,s)=>{e.onsuccess=o=>{let a=o.target.result;i(a.map(l=>l._value))},e.onerror=o=>{s(o)}})}subscribe(t,e){this._subscriptionsMap[t]||(this._subscriptionsMap[t]=new Set);let i=this._subscriptionsMap[t];return i.add(e),{remove:n(()=>{i.delete(e),i.size||delete this._subscriptionsMap[t]},"remove")}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,Lo.clear(this.name)}},n(Je,"DbInstance"),Je),Qe,Lo=(Qe=class{static get readyEventName(){return Mo}static open(t=hl,e="store"){let i=t+"/"+e;return this._reg[i]||(this._reg[i]=new fl(t,e)),this._reg[i]}static clear(t){window.indexedDB.deleteDatabase(t);for(let e in this._reg)e.split("/")[0]===t&&delete this._reg[e]}},n(Qe,"IDB"),Qe);Ts(Lo,"_reg",Object.create(null));var Po=n(r=>{if(typeof r!="string"||!r)return"";let t=r.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},"normalizeCdnOperation"),yi=n((...r)=>r.filter(t=>typeof t=="string"&&t).map(t=>Po(t)).join("/-/"),"joinCdnOperations"),B=n((...r)=>{let t=yi(...r);return t?`-/${t}/`:""},"createCdnUrlModifiers");function wi(r){let t=new URL(r),e=t.pathname+t.search+t.hash,i=e.lastIndexOf("http"),s=e.lastIndexOf("/"),o="";return i>=0?o=e.slice(i):s>=0&&(o=e.slice(s+1)),o}n(wi,"extractFilename");function Ci(r){let t=new URL(r),{pathname:e}=t,i=e.indexOf("/"),s=e.indexOf("/",i+1);return e.substring(i+1,s)}n(Ci,"extractUuid");function Is(r){let t=Ro(r),e=new URL(t),i=e.pathname.indexOf("/-/");return i===-1?"":e.pathname.substring(i).slice(1)}n(Is,"extractCdnUrlModifiers");function Uo(r){return Is(r).split("/-/").filter(Boolean).map(e=>Po(e))}n(Uo,"extractOperations");function Ro(r){let t=new URL(r),e=wi(r),i=Do(e)?Fo(e).pathname:e;return t.pathname=t.pathname.replace(i,""),t.search="",t.hash="",t.toString()}n(Ro,"trimFilename");function Do(r){return r.startsWith("http")}n(Do,"isFileUrl");function Fo(r){let t=new URL(r);return{pathname:t.origin+t.pathname||"",search:t.search||"",hash:t.hash||""}}n(Fo,"splitFileUrl");var F=n((r,t,e)=>{let i=new URL(Ro(r));if(e=e||wi(r),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),Do(e)){let s=Fo(e);i.pathname=i.pathname+(t||"")+(s.pathname||""),i.search=s.search,i.hash=s.hash}else i.pathname=i.pathname+(t||"")+(e||"");return i.toString()},"createCdnUrl"),Oe=n((r,t)=>{let e=new URL(r);return e.pathname=t+"/",e.toString()},"createOriginalUrl");var V=n((r,t=",")=>r.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0),"stringToArray");var Q=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),Vo=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function ml(r,t){if(typeof t=="number"){let e=t;return Q[r]!==e?`${r}/${e}`:""}if(typeof t=="boolean"){let e=t;return Q[r]!==e?`${r}`:""}if(r==="filter"&&t){let{name:e,amount:i}=t;return Q.filter===i?"":`${r}/${e}/${i}`}if(r==="crop"&&t){let{dimensions:e,coords:i}=t;return`${r}/${e.join("x")}/${i.join(",")}`}return""}n(ml,"transformationToStr");function $e(r){return yi(...Vo.filter(t=>typeof r[t]!="undefined"&&r[t]!==null).map(t=>{let e=r[t];return ml(t,e)}).filter(t=>!!t))}n($e,"transformationsToOperations");var Ei=yi("format/auto","progressive/yes"),ve=n(([r])=>typeof r!="undefined"?Number(r):void 0,"asNumber"),No=n(()=>!0,"asBoolean"),gl=n(([r,t])=>({name:r,amount:typeof t!="undefined"?Number(t):100}),"asFilter"),bl=n(([r,t])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(t))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:V(r,"x").map(Number),coords:V(t).map(Number)}},"asCrop"),_l=Object.freeze({enhance:ve,brightness:ve,exposure:ve,gamma:ve,contrast:ve,saturation:ve,vibrance:ve,warmth:ve,filter:gl,mirror:No,flip:No,rotate:ve,crop:bl});function zo(r){let t={};for(let e of r){let[i,...s]=e.split("/");if(!Vo.includes(i))continue;let o=i,a=_l[o];try{let l=a(s);t[o]=l}catch(l){console.warn([`Failed to parse URL operation "${e}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
29
- `))}}return t}n(zo,"operationsToTransformations");var P=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),K=[P.CROP,P.TUNING,P.FILTERS],Bo=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],Ho=["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"],jo=["rotate","mirror","flip"],le=Object.freeze({brightness:{zero:Q.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Q.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Q.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Q.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Q.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Q.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Q.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Q.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Q.filter,range:[0,100],keypointsNumber:1}});var Z=n(r=>r?r.split(",").map(t=>t.trim()).filter(Boolean):[],"deserializeCsv"),ye=n(r=>r?r.join(","):"","serializeCsv");var vl="https://ucarecdn.com",yl="https://upload.uploadcare.com",wl="https://social.uploadcare.com",Y={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:ye(K),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:vl,baseUrl:yl,socialBaseUrl:wl,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:10,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:!0,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:!1,cloudImageEditorAutoOpen:!1,cloudImageEditorMaskHref:null,testMode:!1,qualityInsights:!0};var we=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config"}),w=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created",...we}),Os=class Os{constructor(t){d(this,"_timeoutStore",new Map);d(this,"_targets",new Set);d(this,"_debugPrint",null);this._debugPrint=t}bindTarget(t){this._targets.add(t)}unbindTarget(t){this._targets.delete(t)}_dispatch(t,e){var i;for(let s of this._targets)s.dispatchEvent(new CustomEvent(t,{detail:e}));(i=this._debugPrint)==null||i.call(this,()=>{let s=e&&typeof e=="object"?{...e}:e;return[`event "${t}"`,s]})}emit(t,e,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(t,typeof e=="function"?e():e);return}this._timeoutStore.has(t)&&window.clearTimeout(this._timeoutStore.get(t));let s=typeof i=="number"?i:20,o=window.setTimeout(()=>{this._dispatch(t,typeof e=="function"?e():e),this._timeoutStore.delete(t)},s);this._timeoutStore.set(t,o)}};n(Os,"EventEmitter");var Ai=Os;function M(r,t){let e,i=n((...s)=>{clearTimeout(e),e=setTimeout(()=>r(...s),t)},"debounced");return i.cancel=()=>{clearTimeout(e)},i}n(M,"debounce");var Go="--uploadcare-blocks-window-height",Rt=class Rt{static registerClient(t){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(t)}static unregisterClient(t){this.clientsRegistry.delete(t),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(Go)}};n(Rt,"WindowHeightTracker"),d(Rt,"clientsRegistry",new Set),d(Rt,"flush",M(()=>{document.documentElement.style.setProperty(Go,`${window.innerHeight}px`)},100));var Dt=Rt;var Wo=n(r=>{var i;let t=new Intl.Locale(r),e="ltr";return typeof t.getTextInfo=="function"&&t.getTextInfo().direction?e=t.getTextInfo().direction:"textInfo"in t&&((i=t.textInfo)!=null&&i.direction)&&(e=t.textInfo.direction),e},"getLocaleDirection");var xi=n((r,t)=>new Intl.PluralRules(r).select(t),"getPluralForm");var Cl=n(r=>r,"DEFAULT_TRANSFORMER"),$s="{{",Xo="}}",qo="plural:";function Ft(r,t,e={}){var a;let{openToken:i=$s,closeToken:s=Xo,transform:o=Cl}=e;for(let l in t){let c=(a=t[l])==null?void 0:a.toString();r=r.replaceAll(i+l+s,typeof c=="string"?o(c):c)}return r}n(Ft,"applyTemplateData");function Ko(r){let t=[],e=r.indexOf($s);for(;e!==-1;){let i=r.indexOf(Xo,e),s=r.substring(e+2,i);if(s.startsWith(qo)){let o=r.substring(e+2,i).replace(qo,""),a=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));t.push({variable:s,pluralKey:a,countVariable:l})}e=r.indexOf($s,i)}return t}n(Ko,"getPluralObjects");var Zo=n(({element:r,attribute:t,onSuccess:e,onTimeout:i,timeout:s=300})=>{let o=r.getAttribute(t);if(o!==null){e(o);return}let a=new MutationObserver(u=>{let p=u[u.length-1];c(p)});a.observe(r,{attributes:!0,attributeFilter:[t]});let l=setTimeout(()=>{a.disconnect(),i()},s),c=n(u=>{let p=r.getAttribute(t);u.type==="attributes"&&u.attributeName===t&&p!==null&&(clearTimeout(l),a.disconnect(),e(p))},"handleMutation")},"waitForAttribute");function Yo(r){return Object.prototype.toString.call(r)==="[object Object]"}n(Yo,"isObject");var El=/\W|_/g;function Al(r){return r.split(El).map((t,e)=>t.charAt(0)[e>0?"toUpperCase":"toLowerCase"]()+t.slice(1)).join("")}n(Al,"camelizeString");function Jo(r,{ignoreKeys:t}={ignoreKeys:[]}){return Array.isArray(r)?r.map(e=>Ae(e,{ignoreKeys:t})):r}n(Jo,"camelizeArrayItems");function Ae(r,{ignoreKeys:t}={ignoreKeys:[]}){if(Array.isArray(r))return Jo(r,{ignoreKeys:t});if(!Yo(r))return r;let e={};for(let i of Object.keys(r)){let s=r[i];if(t.includes(i)){e[i]=s;continue}Yo(s)?s=Ae(s,{ignoreKeys:t}):Array.isArray(s)&&(s=Jo(s,{ignoreKeys:t})),e[Al(i)]=s}return e}n(Ae,"camelizeKeys");var xl=n(r=>new Promise(t=>setTimeout(t,r)),"delay");function Ds({libraryName:r,libraryVersion:t,userAgent:e,publicKey:i="",integration:s=""}){let o="JavaScript";if(typeof e=="string")return e;if(typeof e=="function")return e({publicKey:i,libraryName:r,libraryVersion:t,languageName:o,integration:s});let a=[r,t,i].filter(Boolean).join("/"),l=[o,s].filter(Boolean).join("; ");return`${a} (${l})`}n(Ds,"getUserAgent$1");var Tl={factor:2,time:100};function Sl(r,t=Tl){let e=0;function i(s){let o=Math.round(t.time*t.factor**e);return s({attempt:e,retry:n(l=>xl(l!=null?l:o).then(()=>(e+=1,i(s))),"retry")})}return n(i,"runAttempt"),i(r)}n(Sl,"retrier");var Hs=class Hs extends Error{};n(Hs,"UploadcareError");var Fe=Hs,Ti=class Ti extends Fe{constructor(e){super();d(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,Ti.prototype),this.originalProgressEvent=e}};n(Ti,"NetworkError");var tt=Ti,Oi=n((r,t)=>{r&&(r.aborted?Promise.resolve().then(t):r.addEventListener("abort",()=>t(),{once:!0}))},"onCancel"),Si=class Si extends Fe{constructor(e="Request canceled"){super(e);d(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,Si.prototype)}};n(Si,"CancelError");var ke=Si,Il=500,en=n(({check:r,interval:t=Il,timeout:e,signal:i})=>new Promise((s,o)=>{let a,l;Oi(i,()=>{a&&clearTimeout(a),o(new ke("Poll cancelled"))}),e&&(l=setTimeout(()=>{a&&clearTimeout(a),o(new ke("Timed out"))},e));let c=n(()=>{try{Promise.resolve(r(i)).then(u=>{u?(l&&clearTimeout(l),s(u)):a=setTimeout(c,t)}).catch(u=>{l&&clearTimeout(l),o(u)})}catch(u){l&&clearTimeout(l),o(u)}},"tick");a=setTimeout(c,0)}),"poll"),O={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},$i="application/octet-stream",tn="original",Me=n(({method:r,url:t,data:e,headers:i={},signal:s,onProgress:o})=>new Promise((a,l)=>{let c=new XMLHttpRequest,u=(r==null?void 0:r.toUpperCase())||"GET",p=!1;c.open(u,t,!0),i&&Object.entries(i).forEach(h=>{let[f,m]=h;typeof m!="undefined"&&!Array.isArray(m)&&c.setRequestHeader(f,m)}),c.responseType="text",Oi(s,()=>{p=!0,c.abort(),l(new ke)}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else{let h={method:u,url:t,data:e,headers:i||void 0,signal:s,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(E){let A=E.split(": "),v=A.shift(),C=A.join(": ");v&&typeof v!="undefined"&&(m[v]=C)});let g=c.response,_=c.status;a({request:h,data:g,headers:m,status:_})}},c.onerror=h=>{p||l(new tt(h))},o&&typeof o=="function"&&(c.upload.onprogress=h=>{h.lengthComputable?o({isComputable:!0,value:h.loaded/h.total}):o({isComputable:!1})}),e?c.send(e):c.send()}),"request");function Ol(r,...t){return r}n(Ol,"identity");var $l=n(({name:r})=>r?[r]:[],"getFileOptions"),kl=Ol,Ml=n(()=>new FormData,"getFormData"),sn=n(r=>!1,"isBuffer"),ki=n(r=>typeof Blob!="undefined"&&r instanceof Blob,"isBlob"),Mi=n(r=>typeof File!="undefined"&&r instanceof File,"isFile"),Li=n(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string","isReactNativeAsset"),st=n(r=>ki(r)||Mi(r)||sn()||Li(r),"isFileData"),Ll=n(r=>typeof r=="string"||typeof r=="number"||typeof r=="undefined","isSimpleValue"),Pl=n(r=>!!r&&typeof r=="object"&&!Array.isArray(r),"isObjectValue"),Ul=n(r=>!!r&&typeof r=="object"&&"data"in r&&st(r.data),"isFileValue");function rn(r,t,e){if(Array.isArray(e))for(let i of e)rn(r,`${t}[]`,i);else if(Ul(e)){let{name:i,contentType:s}=e,o=kl(e.data,i,s!=null?s:$i),a=$l({name:i,contentType:s});r.push([t,o,...a])}else if(Pl(e))for(let[i,s]of Object.entries(e))typeof s!="undefined"&&r.push([`${t}[${i}]`,String(s)]);else Ll(e)&&e&&r.push([t,e.toString()])}n(rn,"collectParams");function Rl(r){let t=[];for(let[e,i]of Object.entries(r))rn(t,e,i);return t}n(Rl,"getFormDataParams");function Pi(r){let t=Ml(),e=Rl(r);for(let i of e){let[s,o,...a]=i;t.append(s,o,...a)}return t}n(Pi,"buildFormData");var Ii=class Ii extends Fe{constructor(e,i,s,o,a){super();d(this,"code");d(this,"request");d(this,"response");d(this,"headers");this.name="UploadError",this.message=e,this.code=i,this.request=s,this.response=o,this.headers=a,Object.setPrototypeOf(this,Ii.prototype)}};n(Ii,"UploadError");var H=Ii,Dl=n(r=>{let t=new URLSearchParams;for(let[e,i]of Object.entries(r))i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).filter(s=>{var o;return(o=s[1])!=null?o:!1}).forEach(s=>t.set(`${e}[${s[0]}]`,String(s[1]))):Array.isArray(i)?i.forEach(s=>{t.append(`${e}[]`,s)}):typeof i=="string"&&i?t.set(e,i):typeof i=="number"&&t.set(e,i.toString());return t.toString()},"buildSearchParams"),Ce=n((r,t,e)=>{let i=new URL(r);return i.pathname=(i.pathname+t).replace("//","/"),e&&(i.search=Dl(e)),i.toString()},"getUrl"),Fl="6.14.3",Nl="UploadcareUploadClient",Vl=Fl;function Ne(r){return Ds({libraryName:Nl,libraryVersion:Vl,...r})}n(Ne,"getUserAgent");var zl="RequestThrottledError",Qo=15e3,Bl=1e3;function Hl(r){let{headers:t}=r||{};if(!t||typeof t["retry-after"]!="string")return Qo;let e=parseInt(t["retry-after"],10);return Number.isFinite(e)?e*1e3:Qo}n(Hl,"getTimeoutFromThrottledRequest");function Le(r,t){let{retryThrottledRequestMaxTimes:e,retryNetworkErrorMaxTimes:i}=t;return Sl(({attempt:s,retry:o})=>r().catch(a=>{if("response"in a&&(a==null?void 0:a.code)===zl&&s<e)return o(Hl(a));if(a instanceof tt&&s<i)return o((s+1)*Bl);throw a}))}n(Le,"retryIfFailed");var on=n(r=>{let t="";return(ki(r)||Mi(r)||Li(r))&&(t=r.type),t||$i},"getContentType"),nn=n(r=>{let t="";return Mi(r)&&r.name?t=r.name:ki(r)||sn()?t="":Li(r)&&r.name&&(t=r.name),t||tn},"getFileName");function Fs(r){return typeof r=="undefined"||r==="auto"?"auto":r?"1":"0"}n(Fs,"getStoreValue");function jl(r,{publicKey:t,fileName:e,contentType:i,baseURL:s=O.baseURL,secureSignature:o,secureExpire:a,store:l,signal:c,onProgress:u,source:p="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=O.retryNetworkErrorMaxTimes,metadata:_}){return Le(()=>Me({method:"POST",url:Ce(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ne({publicKey:t,integration:h,userAgent:f})},data:Pi({file:{data:r,name:e||nn(r),contentType:i||on(r)},UPLOADCARE_PUB_KEY:t,UPLOADCARE_STORE:Fs(l),signature:o,expire:a,source:p,metadata:_}),signal:c,onProgress:u}).then(({data:E,headers:A,request:v})=>{let C=Ae(JSON.parse(E));if("error"in C)throw new H(C.error.content,C.error.errorCode,v,C,A);return C}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}n(jl,"base");var Ls;(function(r){r.Token="token",r.FileInfo="file_info"})(Ls||(Ls={}));function Gl(r,{publicKey:t,baseURL:e=O.baseURL,store:i,fileName:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=O.retryNetworkErrorMaxTimes,metadata:_}){return Le(()=>Me({method:"POST",headers:{"X-UC-User-Agent":Ne({publicKey:t,integration:h,userAgent:f})},url:Ce(e,"/from_url/",{jsonerrors:1,pub_key:t,source_url:r,store:Fs(i),filename:s,check_URL_duplicates:o?1:void 0,save_URL_duplicates:a?1:void 0,signature:l,expire:c,source:u,metadata:_}),signal:p}).then(({data:E,headers:A,request:v})=>{let C=Ae(JSON.parse(E));if("error"in C)throw new H(C.error.content,C.error.errorCode,v,C,A);return C}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}n(Gl,"fromUrl");var J;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success"})(J||(J={}));var Wl=n(r=>"status"in r&&r.status===J.Error,"isErrorResponse");function ql(r,{publicKey:t,baseURL:e=O.baseURL,signal:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:a=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=O.retryNetworkErrorMaxTimes}={}){return Le(()=>Me({method:"GET",headers:t?{"X-UC-User-Agent":Ne({publicKey:t,integration:s,userAgent:o})}:void 0,url:Ce(e,"/from_url/status/",{jsonerrors:1,token:r}),signal:i}).then(({data:c,headers:u,request:p})=>{let h=Ae(JSON.parse(c));if("error"in h&&!Wl(h))throw new H(h.error.content,h.error.errorCode,p,h,u);return h}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a})}n(ql,"fromUrlStatus");function Xl(r,{publicKey:t,baseURL:e=O.baseURL,jsonpCallback:i,secureSignature:s,secureExpire:o,signal:a,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:h=O.retryNetworkErrorMaxTimes}){return Le(()=>Me({method:"POST",headers:{"X-UC-User-Agent":Ne({publicKey:t,integration:c,userAgent:u})},url:Ce(e,"/group/",{jsonerrors:1}),data:Pi({files:r,callback:i,pub_key:t,signature:s,expire:o,source:l}),signal:a}).then(({data:f,headers:m,request:g})=>{let _=Ae(JSON.parse(f));if("error"in _)throw new H(_.error.content,_.error.errorCode,g,_,m);return _}),{retryNetworkErrorMaxTimes:h,retryThrottledRequestMaxTimes:p})}n(Xl,"group");function an(r,{publicKey:t,baseURL:e=O.baseURL,signal:i,source:s,integration:o,userAgent:a,retryThrottledRequestMaxTimes:l=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=O.retryNetworkErrorMaxTimes}){return Le(()=>Me({method:"GET",headers:{"X-UC-User-Agent":Ne({publicKey:t,integration:o,userAgent:a})},url:Ce(e,"/info/",{jsonerrors:1,pub_key:t,file_id:r,source:s}),signal:i}).then(({data:u,headers:p,request:h})=>{let f=Ae(JSON.parse(u));if("error"in f)throw new H(f.error.content,f.error.errorCode,h,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(an,"info");function Kl(r,{publicKey:t,contentType:e,fileName:i,multipartChunkSize:s=O.multipartChunkSize,baseURL:o="",secureSignature:a,secureExpire:l,store:c,signal:u,source:p="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=O.retryNetworkErrorMaxTimes,metadata:_}){return Le(()=>Me({method:"POST",url:Ce(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ne({publicKey:t,integration:h,userAgent:f})},data:Pi({filename:i||tn,size:r,content_type:e||$i,part_size:s,UPLOADCARE_STORE:Fs(c),UPLOADCARE_PUB_KEY:t,signature:a,expire:l,source:p,metadata:_}),signal:u}).then(({data:E,headers:A,request:v})=>{let C=Ae(JSON.parse(E));if("error"in C)throw new H(C.error.content,C.error.errorCode,v,C,A);return C.parts=Object.keys(C.parts).map(R=>C.parts[Number(R)]),C}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}n(Kl,"multipartStart");function Zl(r,t,{contentType:e,signal:i,onProgress:s,retryThrottledRequestMaxTimes:o=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=O.retryNetworkErrorMaxTimes}){return Le(()=>Me({method:"PUT",url:t,data:r,onProgress:s,signal:i,headers:{"Content-Type":e||$i}}).then(l=>(s&&s({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a})}n(Zl,"multipartUpload");function Yl(r,{publicKey:t,baseURL:e=O.baseURL,source:i="local",signal:s,integration:o,userAgent:a,retryThrottledRequestMaxTimes:l=O.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=O.retryNetworkErrorMaxTimes}){return Le(()=>Me({method:"POST",url:Ce(e,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Ne({publicKey:t,integration:o,userAgent:a})},data:Pi({uuid:r,UPLOADCARE_PUB_KEY:t,source:i}),signal:s}).then(({data:u,headers:p,request:h})=>{let f=Ae(JSON.parse(u));if("error"in f)throw new H(f.error.content,f.error.errorCode,h,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(Yl,"multipartComplete");function Ns(r,{publicKey:t,baseURL:e,source:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return en({check:n(p=>an(r,{publicKey:t,baseURL:e,signal:p,source:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(h=>h.isReady?h:(u&&u({isComputable:!0,value:1}),!1)),"check"),signal:c})}n(Ns,"isReadyPoll");function Jl(r){return"defaultEffects"in r}n(Jl,"isGroupFileInfo");var js=class js{constructor(t,{baseCDN:e=O.baseCDN,fileName:i}={}){d(this,"uuid");d(this,"name");d(this,"size");d(this,"isStored");d(this,"isImage");d(this,"mimeType");d(this,"cdnUrl");d(this,"s3Url");d(this,"originalFilename");d(this,"imageInfo");d(this,"videoInfo");d(this,"contentInfo");d(this,"metadata");d(this,"s3Bucket");d(this,"defaultEffects",null);let{uuid:s,s3Bucket:o}=t,a=Ce(e,`${s}/`),l=o?Ce(`https://${o}.s3.amazonaws.com/`,`${s}/${t.filename}`):null;this.uuid=s,this.name=i||t.filename,this.size=t.size,this.isStored=t.isStored,this.isImage=t.isImage,this.mimeType=t.mimeType,this.cdnUrl=a,this.originalFilename=t.originalFilename,this.imageInfo=t.imageInfo,this.videoInfo=t.videoInfo,this.contentInfo=t.contentInfo,this.metadata=t.metadata||null,this.s3Bucket=o||null,this.s3Url=l,Jl(t)&&(this.defaultEffects=t.defaultEffects)}};n(js,"UploadcareFile");var Ee=js,Ql=n((r,{publicKey:t,fileName:e,baseURL:i,secureSignature:s,secureExpire:o,store:a,contentType:l,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:_,metadata:E})=>jl(r,{publicKey:t,fileName:e,contentType:l,baseURL:i,secureSignature:s,secureExpire:o,store:a,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:E}).then(({file:A})=>Ns(A,{publicKey:t,baseURL:i,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(A=>new Ee(A,{baseCDN:_})),"uploadDirect"),ec=n((r,{publicKey:t,fileName:e,baseURL:i,signal:s,onProgress:o,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:h})=>an(r,{publicKey:t,baseURL:i,signal:s,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new Ee(f,{baseCDN:h,fileName:e})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),tc=n((r,{signal:t}={})=>{let e=null,i=null,s=r.map(()=>new AbortController),o=n(a=>()=>{i=a,s.forEach((l,c)=>c!==a&&l.abort())},"createStopRaceCallback");return Oi(t,()=>{s.forEach(a=>a.abort())}),Promise.all(r.map((a,l)=>{let c=o(l);return Promise.resolve().then(()=>a({stopRace:c,signal:s[l].signal})).then(u=>(c(),u)).catch(u=>(e=u,null))})).then(a=>{if(i===null)throw e;return a[i]})},"race"),ic=window.WebSocket,Gs=class Gs{constructor(){d(this,"events",Object.create({}))}emit(t,e){var i;(i=this.events[t])==null||i.forEach(s=>s(e))}on(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)}off(t,e){e?this.events[t]=this.events[t].filter(i=>i!==e):this.events[t]=[]}};n(Gs,"Events");var Ps=Gs,sc=n((r,t)=>r==="success"?{status:J.Success,...t}:r==="progress"?{status:J.Progress,...t}:{status:J.Error,...t},"response"),Ws=class Ws{constructor(t,e=3e4){d(this,"key");d(this,"disconnectTime");d(this,"ws");d(this,"queue",[]);d(this,"isConnected",!1);d(this,"subscribers",0);d(this,"emmitter",new Ps);d(this,"disconnectTimeoutId",null);this.key=t,this.disconnectTime=e}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let t=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new ic(t),this.ws.addEventListener("error",e=>{this.emmitter.emit("error",new Error(e.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[]}),this.ws.addEventListener("message",e=>{let i=JSON.parse(e.data.toString());switch(i.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(i.channel,sc(i.event,JSON.parse(i.data)))}})}}disconnect(){let t=n(()=>{var e;(e=this.ws)==null||e.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{t()},this.disconnectTime):t()}send(t,e){var s;let i=JSON.stringify({event:t,data:e});(s=this.ws)==null||s.send(i)}subscribe(t,e){this.subscribers+=1,this.connect();let i=`task-status-${t}`,s={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,e),this.isConnected?this.send(s.event,s.data):this.queue.push(s)}unsubscribe(t){this.subscribers-=1;let e=`task-status-${t}`,i={event:"pusher:unsubscribe",data:{channel:e}};this.emmitter.off(e),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(s=>s.data.channel!==e),this.subscribers===0&&this.disconnect()}onError(t){return this.emmitter.on("error",t),()=>this.emmitter.off("error",t)}};n(Ws,"Pusher");var Us=Ws,ks=null,Vs=n(r=>{if(!ks){let t=typeof window=="undefined"?0:3e4;ks=new Us(r,t)}return ks},"getPusher"),rc=n(r=>{Vs(r).connect()},"preconnect");function oc({token:r,publicKey:t,baseURL:e,integration:i,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return en({check:n(u=>ql(r,{publicKey:t,baseURL:e,integration:i,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a,signal:u}).then(p=>{switch(p.status){case J.Error:return new H(p.error,p.errorCode);case J.Waiting:return!1;case J.Unknown:return new H(`Token "${r}" was not found.`);case J.Progress:return l&&(p.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:p.done/p.total})),!1;case J.Success:return l&&l({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}n(oc,"pollStrategy");var nc=n(({token:r,pusherKey:t,signal:e,onProgress:i})=>new Promise((s,o)=>{let a=Vs(t),l=a.onError(o),c=n(()=>{l(),a.unsubscribe(r)},"destroy");Oi(e,()=>{c(),o(new ke("pusher cancelled"))}),a.subscribe(r,u=>{switch(u.status){case J.Progress:{i&&(u.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:u.done/u.total}));break}case J.Success:{c(),i&&i({isComputable:!0,value:u.done/u.total}),s(u);break}case J.Error:c(),o(new H(u.msg,u.error_code))}})}),"pushStrategy"),ac=n((r,{publicKey:t,fileName:e,baseURL:i,baseCDN:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:h,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,pusherKey:E=O.pusherKey,metadata:A})=>Promise.resolve(rc(E)).then(()=>Gl(r,{publicKey:t,fileName:e,baseURL:i,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,metadata:A})).catch(v=>{let C=Vs(E);return C==null||C.disconnect(),Promise.reject(v)}).then(v=>v.type===Ls.FileInfo?v:tc([({signal:C})=>oc({token:v.token,publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,onProgress:h,signal:C}),({signal:C})=>nc({token:v.token,pusherKey:E,signal:C,onProgress:h})],{signal:p})).then(v=>{if(v instanceof H)throw v;return v}).then(v=>Ns(v.uuid,{publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,onProgress:h,signal:p})).then(v=>new Ee(v,{baseCDN:s})),"uploadFromUrl"),Ms=new WeakMap,lc=n(async r=>{if(Ms.has(r))return Ms.get(r);let t=await fetch(r.uri).then(e=>e.blob());return Ms.set(r,t),t},"getBlobFromReactNativeAsset"),ln=n(async r=>{if(Mi(r)||ki(r))return r.size;if(Li(r))return(await lc(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),cc=n((r,t=O.multipartMinFileSize)=>r>=t,"isMultipart"),cn=n(r=>{let t="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",e=new RegExp(t);return!st(r)&&e.test(r)},"isUuid"),zs=n(r=>{let t="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",e=new RegExp(t);return!st(r)&&e.test(r)},"isUrl"),uc=n((r,t)=>new Promise((e,i)=>{let s=[],o=!1,a=t.length,l=[...t],c=n(()=>{let u=t.length-l.length,p=l.shift();p&&p().then(h=>{o||(s[u]=h,a-=1,a?c():e(s))}).catch(h=>{o=!0,i(h)})},"run");for(let u=0;u<r;u++)c()}),"runWithConcurrency"),dc=n((r,t,e,i)=>{let s=i*t,o=Math.min(s+i,e);return r.slice(s,o)},"sliceChunk"),hc=n(async(r,t,e)=>i=>dc(r,i,t,e),"prepareChunks"),pc=n((r,t,{publicKey:e,contentType:i,onProgress:s,signal:o,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Zl(r,t,{publicKey:e,contentType:i,onProgress:s,signal:o,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),fc=n(async(r,{publicKey:t,fileName:e,fileSize:i,baseURL:s,secureSignature:o,secureExpire:a,store:l,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:_,multipartChunkSize:E=O.multipartChunkSize,maxConcurrentRequests:A=O.maxConcurrentRequests,baseCDN:v,metadata:C})=>{let R=i!=null?i:await ln(r),W,ne=n((N,q)=>{if(!u)return;W||(W=Array(N).fill(0));let re=n(ae=>ae.reduce((ge,As)=>ge+As,0),"sum");return ae=>{ae.isComputable&&(W[q]=ae.value,u({isComputable:!0,value:re(W)/N}))}},"createProgressHandler");return _||(_=on(r)),Kl(R,{publicKey:t,contentType:_,fileName:e||nn(r),baseURL:s,secureSignature:o,secureExpire:a,store:l,signal:c,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:C,multipartChunkSize:E}).then(async({uuid:N,parts:q})=>{let re=await hc(r,R,E);return Promise.all([N,uc(A,q.map((ae,ge)=>()=>pc(re(ge),ae,{publicKey:t,contentType:_,onProgress:ne(q.length,ge),signal:c,integration:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([N])=>Yl(N,{publicKey:t,baseURL:s,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(N=>N.isReady?N:Ns(N.uuid,{publicKey:t,baseURL:s,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(N=>new Ee(N,{baseCDN:v}))},"uploadMultipart");async function Bs(r,{publicKey:t,fileName:e,baseURL:i=O.baseURL,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:_,multipartChunkSize:E,maxConcurrentRequests:A,baseCDN:v=O.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:R,pusherKey:W,metadata:ne}){if(st(r)){let N=await ln(r);return cc(N,_)?fc(r,{publicKey:t,contentType:g,multipartChunkSize:E,fileSize:N,fileName:e,baseURL:i,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,maxConcurrentRequests:A,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:ne}):Ql(r,{publicKey:t,fileName:e,contentType:g,baseURL:i,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:ne})}if(zs(r))return ac(r,{publicKey:t,fileName:e,baseURL:i,baseCDN:v,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:R,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:W,metadata:ne});if(cn(r))return ec(r,{publicKey:t,fileName:e,baseURL:i,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v});throw new TypeError(`File uploading from "${r}" is not supported`)}n(Bs,"uploadFile");var qs=class qs{constructor(t,{baseCDN:e=O.baseCDN}={}){d(this,"uuid");d(this,"filesCount");d(this,"totalSize");d(this,"isStored");d(this,"isImage");d(this,"cdnUrl");d(this,"files");d(this,"createdAt");d(this,"storedAt",null);this.uuid=t.id,this.filesCount=t.filesCount;let i=t.files.filter(Boolean);this.totalSize=Object.values(i).reduce((s,o)=>s+o.size,0),this.isStored=!!t.datetimeStored,this.isImage=!!Object.values(i).filter(s=>s.isImage).length,this.cdnUrl=t.cdnUrl,this.files=i.map(s=>new Ee(s,{baseCDN:e})),this.createdAt=t.datetimeCreated,this.storedAt=t.datetimeStored}};n(qs,"UploadcareGroup");var Rs=qs,mc=n(r=>{for(let t of r)if(!st(t))return!1;return!0},"isFileDataArray"),gc=n(r=>{for(let t of r)if(!cn(t))return!1;return!0},"isUuidArray"),bc=n(r=>{for(let t of r)if(!zs(t))return!1;return!0},"isUrlArray");function un(r,{publicKey:t,fileName:e,baseURL:i=O.baseURL,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:_=O.multipartChunkSize,baseCDN:E=O.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:v,jsonpCallback:C}){if(!mc(r)&&!bc(r)&&!gc(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let R,W=!0,ne=r.length,N=n((q,re)=>{if(!c)return;R||(R=Array(q).fill(0));let ae=n(ge=>ge.reduce((As,Da)=>As+Da)/q,"normalize");return ge=>{if(!ge.isComputable||!W){W=!1,c({isComputable:!1});return}R[re]=ge.value,c({isComputable:!0,value:ae(R)})}},"createProgressHandler");return Promise.all(r.map((q,re)=>st(q)||zs(q)?Bs(q,{publicKey:t,fileName:e,baseURL:i,secureSignature:s,secureExpire:o,store:a,signal:l,onProgress:N(ne,re),source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:_,baseCDN:E,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:v}).then(ae=>ae.uuid):q)).then(q=>Xl(q,{publicKey:t,baseURL:i,jsonpCallback:C,secureSignature:s,secureExpire:o,signal:l,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(re=>new Rs(re,{baseCDN:E})).then(re=>(c&&c({isComputable:!0,value:1}),re)))}n(un,"uploadFileGroup");var Xs=class Xs{constructor(t){d(this,"_concurrency",1);d(this,"_pending",[]);d(this,"_running",0);d(this,"_resolvers",new Map);d(this,"_rejectors",new Map);this._concurrency=t}_run(){let t=this._concurrency-this._running;for(let e=0;e<t;e++){let i=this._pending.shift();if(!i)return;let s=this._resolvers.get(i),o=this._rejectors.get(i);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,i().finally(()=>{this._resolvers.delete(i),this._rejectors.delete(i),this._running-=1,this._run()}).then(a=>s(a)).catch(a=>o(a))}}add(t){return new Promise((e,i)=>{this._resolvers.set(t,e),this._rejectors.set(t,i),this._pending.push(t),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(t){this._concurrency=t,this._run()}get concurrency(){return this._concurrency}};n(Xs,"Queue");var it=Xs;var Ks=n(()=>({}),"blockCtx"),Zs=n(r=>({...Ks(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":n(()=>{r.modalManager.close(r.$["*currentActivity"]),r.set$({"*currentActivity":null})},"*closeModal")}),"activityBlockCtx"),Ui=n(r=>({...Zs(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new it(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var Nt={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"Onedrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}",queued:"Queued"};var Ri=new Map,Ys=new Map,dn=n((r,t)=>{Ri.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`),Ri.set(r,{...Nt,...t})},"defineLocaleSync"),_c=n((r,t)=>{Ys.set(r,t)},"defineLocaleAsync"),Js=n((r,t)=>{typeof t=="function"?_c(r,t):dn(r,t)},"defineLocale"),hn=n(async r=>{if(!Ri.has(r)){if(!Ys.has(r))throw new Error(`Locale ${r} is not defined`);let e=await Ys.get(r)();dn(r,e)}return Ri.get(r)},"resolveLocaleDefinition");Js("en",Nt);var oe=n(r=>`*l10n/${r}`,"localeStateKey"),vc="en",Qs=class Qs{constructor(t){d(this,"_blockInstance",null);d(this,"_localeName","");d(this,"_callbacks",new Set);d(this,"_boundBlocks",new Map);this._blockInstance=t;for(let[e,i]of Object.entries(Nt)){let s=this._blockInstance.has(oe(e))?!this._blockInstance.$[oe(e)]:!0;this._blockInstance.add(oe(e),i,s)}setTimeout(()=>{t.subConfigValue("localeName",async e=>{var o;if(!this._blockInstance||!e)return;this._localeName=e;let i=await hn(e);if(e!==vc&&this._localeName!==e)return;let s=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[e];for(let[a,l]of Object.entries(i)){let c=s==null?void 0:s[a];this._blockInstance.add(oe(a),c!=null?c:l,!0);for(let u of this._callbacks)u()}}),t.subConfigValue("localeDefinitionOverride",e=>{var s;if(!e)return;let i=e[this._localeName];if(i)for(let[o,a]of Object.entries(i)){(s=this._blockInstance)==null||s.add(oe(o),a,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(t){let e=M(t,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(t,e,i){var o,a,l;t.$[e]=i(),this._boundBlocks.has(t)||this._boundBlocks.set(t,new Map),(a=(o=this._boundBlocks.get(t))==null?void 0:o.get(e))==null||a();let s=this.onLocaleChange(()=>{t.$[e]=i()});(l=this._boundBlocks.get(t))==null||l.set(e,s)}destroyL10nBindings(t){let e=this._boundBlocks.get(t);if(e){for(let i of e.values())i();this._boundBlocks.delete(t)}}destroy(){this._callbacks.clear()}};n(Qs,"LocaleManager");var Di=Qs;function pn(r,t){[...r.querySelectorAll("[l10n]")].forEach(e=>{let i=e.getAttribute("l10n");if(!i)return;let s=i.split(";");for(let o of s)o&&yc(e,o,t)})}n(pn,"l10nProcessor");var yc=n((r,t,e)=>{let i="textContent",s=!1;if(t.includes(":")){let l=t.split(":");i=l[0],t=l[1],i.startsWith("@")&&(i=i.slice(1),s=!0)}let o=t;e.has(o)&&e.sub(o,l=>{if(!l)return;e.l10nProcessorSubs.has(o)||e.l10nProcessorSubs.set(o,new Set);let c=e.l10nProcessorSubs.get(o);c==null||c.forEach(h=>{h.remove(),c.delete(h),e.allSubs.delete(h)});let u=oe(l).replace("*","");e.nodeCtx.has(u)||e.nodeCtx.add(u,l);let p=e.nodeCtx.sub(u,()=>{r[i]=e.l10n(l)});c==null||c.add(p),e.allSubs.add(p),r.removeAttribute("l10n")});let a=oe(t);e.has(a)||e.add(a,""),e.sub(a,()=>{t=t,s?r.setAttribute(i,e.l10n(t)):r[i]=e.l10n(t)}),r.removeAttribute("l10n")},"locale");var j=n(r=>`*cfg/${r}`,"sharedConfigKey");function fn(r,t){let e=r.querySelectorAll("[data-testid]");if(e.length===0)return;let i=new WeakMap;for(let s of e){let o=s.getAttribute("data-testid");o&&i.set(s,o)}t.subConfigValue("testMode",s=>{if(!s){for(let a of e)a.removeAttribute("data-testid");return}let o=t.testId;for(let a of e){let l=i.get(a);l&&a.setAttribute("data-testid",`${o}--${l}`)}})}n(fn,"testModeProcessor");var wc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Vt(r,t){t.tabIndex=0,t.focus(),r.tabIndex=-1}n(Vt,"focus");function er(r){let t=r.role||r.type||r.tagName;if(!t)return null;let e=wc[t.toLowerCase()];if(!e)return null;for(let i of e){let s=r.closest(`[role=${i}]`);if(s)return s}}n(er,"findGroupNodeByEventTarget");function tr(r,t){return t.role==="toolbar"?Cc(t):t.querySelectorAll(`[role=${r.role}]`)}n(tr,"getItems");function Cc(r){return[...r.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}n(Cc,"getToolbarItems");function Ec(r){let t=r.getAttribute("aria-orientation");if(t==="vertical")return!1;if(t==="horizontal")return!0;let e=r.role;return e==="menubar"||e==="tablist"||e==="toolbar"}n(Ec,"isHorizontalOrientation");function mn(r){return t=>{let e=!1,i=(r==null?void 0:r.searchDelayMs)||300,s=0,o="";function a(h){let f=er(h.target);if(!f){l();return}let m=tr(h.target,f),g=Array.from(m).indexOf(h.target),_="ArrowDown",E="ArrowUp";if(Ec(f)&&(t.document.dir==="rtl"?(_="ArrowLeft",E="ArrowRight"):(_="ArrowRight",E="ArrowLeft")),h.key===_)h.preventDefault(),Vt(h.target,m[g+1]||m[0]);else if(h.key===E)h.preventDefault(),Vt(h.target,m[g-1]||m[m.length-1]);else if(h.key==="Home")h.preventDefault(),Vt(h.target,m[0]);else if(h.key==="End")h.preventDefault(),Vt(h.target,m[m.length-1]);else if(h.key.length===1&&f.role!=="tablist"){let A=Date.now();A-s<=i?o+=h.key.toLowerCase():o=h.key.toLowerCase(),s=A;let v=Array.from(m).find(C=>{var R,W,ne;return(ne=(W=(R=C.textContent)==null?void 0:R.trim())==null?void 0:W.toLowerCase())==null?void 0:ne.startsWith(o)});v&&(h.preventDefault(),Vt(h.target,v))}}n(a,"keyDown");function l(){e=!1,t.removeEventListener("keydown",a)}n(l,"stop");function c(h){let f=er(h.target);if(f){e||(e=!0,t.addEventListener("keydown",a));let m=tr(h.target,f);for(let g of m)g!==h.target&&g.setAttribute("tabindex",-1)}else e&&l()}n(c,"focusIn");function u(h){(!h.relatedTarget||h.relatedTarget===t.document)&&l()}n(u,"focusOut");function p(h){let f=er(h.target);if(f){let m=tr(h.target,f);for(let g of m)g!==h.target&&g.setAttribute("tabindex",-1);h.target.setAttribute("tabindex",0)}}return n(p,"click"),t.addEventListener("click",p),t.addEventListener("focusin",c),t.addEventListener("focusout",u),()=>{l(),t.removeEventListener("click",p),t.removeEventListener("focusin",c),t.removeEventListener("focusout",u)}}}n(mn,"focusGroupKeyUX");function gn(){return r=>{let t,e;function i(o){if(o.target.getAttribute("aria-hidden")==="true"){t=o.target,t.setAttribute("aria-hidden","false"),e=t.hidden,e&&(t.hidden=!1);let a=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');a&&(a.tabIndex=0)}}n(i,"jump");function s(o){t&&t.contains(o.target)&&(!o.relatedTarget||!t.contains(o.relatedTarget))&&(o.target.tabIndex=-1,t.setAttribute("aria-hidden","true"),e&&(t.hidden=!0),t=null)}return n(s,"focusOut"),r.addEventListener("keyuxJump",i),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",i),r.removeEventListener("focusout",s)}}}n(gn,"hiddenKeyUX");function bn(){return r=>{let t=[];function e(c){let u=r.document.activeElement;u&&u!==r.document.body&&t.push(new WeakRef(u)),c.focus({focusVisible:!0})}n(e,"focus");function i(){let c=t.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():i()}n(i,"back");let s=0,o;function a(c){clearInterval(o);let u=c.getAttribute("aria-controls");o=setInterval(()=>{if(s++>50){clearInterval(o);return}let p=r.document.getElementById(u);if(p){let h=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');h&&(clearInterval(o),p.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:!0})),e(h))}},50)}n(a,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&a(c.target),c.key==="Escape"&&i()}return n(l,"keyDown"),r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l)}}}n(bn,"jumpKeyUX");function _n(r){let t,e=r.split(" "),i;function s(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(o(),l.target.classList.add(...e),t=l.target,i=l.target)}n(s,"keyDown");function o(){t&&t.classList.remove(...e),i=null}n(o,"keyUp");function a(l){l.clientX===0&&l.clientY===0&&i!==l.target&&(o(),l.target.classList.add(...e),t=l.target)}return n(a,"click"),l=>(l.addEventListener("click",a),l.addEventListener("keydown",s),l.addEventListener("keyup",o),()=>{l.removeEventListener("click",a),l.removeEventListener("keydown",s),l.removeEventListener("keyup",o)})}n(_n,"pressKeyUX");function vn(r,t){let e=t.map(i=>i(r));return()=>{e.forEach(i=>i())}}n(vn,"startKeyUX");var sr=class sr{constructor(){d(this,"_listeners",new Map);d(this,"_scope",[])}addEventListener(t,e){let i=n(s=>{let o=s.target;o&&this._scope.some(a=>a===s.target||a.contains(o))&&e(s)},"wrappedListener");this._listeners.set(e,i),window.addEventListener(t,i)}removeEventListener(t,e){let i=this._listeners.get(e);i&&window.removeEventListener(t,i),this._listeners.delete(e)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(t){this._scope.push(t)}destroy(){this._scope=[],this._listeners.forEach((t,e)=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",t),this._listeners.delete(e)})}};n(sr,"ScopedMinimalWindow");var ir=sr,rr=class rr{constructor(){d(this,"_destroyKeyUX");d(this,"_scopedWindow");this._scopedWindow=new ir,this._destroyKeyUX=vn(this._scopedWindow,[mn(),_n("is-pressed"),bn(),gn()])}registerBlock(t){this._scopedWindow.registerScope(t)}destroy(){var t;(t=this._destroyKeyUX)==null||t.call(this),this._scopedWindow.destroy()}};n(rr,"A11y");var Fi=rr;var D=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),or=class or{constructor(t){d(this,"_modals",new Map);d(this,"_activeModals",new Set);d(this,"_subscribers",new Map);this._block=t}_debugPrint(...t){this._block.debugPrint("[modal-manager]",...t)}registerModal(t,e){this._modals.set(t,e),this._notify(D.ADD,{id:t,modal:e})}deleteModal(t){if(!this._modals.has(t))return!1;let e=this._modals.get(t);return this._modals.delete(t),this._activeModals.delete(t),this._notify(D.DELETE,{id:t,modal:e}),!0}open(t){if(!this._modals.has(t))return this._debugPrint(`Modal with ID "${t}" not found`),!1;let e=this._modals.get(t);return this._activeModals.add(t),this._notify(D.OPEN,{modal:e,id:t}),!0}close(t){if(!this._modals.has(t)||!this._activeModals.has(t))return this._debugPrint(`Modal with ID "${t}" not found or not active`),!1;let e=this._modals.get(t);return this._activeModals.delete(t),this._notify(D.CLOSE,{id:t,modal:e}),!0}toggle(t){return this._modals.has(t)?this._activeModals.has(t)?this.close(t):this.open(t):(this._debugPrint(`Modal with ID "${t}" not found`),!1)}get hasActiveModals(){return this._activeModals.size>0}back(){if(this._activeModals.size===0)return this._debugPrint("No active modals to go back from"),!1;let t=Array.from(this._activeModals).pop();return this.close(t)}closeAll(){let t=this._activeModals.size;return this._activeModals.clear(),this._notify(D.CLOSE_ALL,{}),t}subscribe(t,e){var i;return this._subscribers.has(t)||this._subscribers.set(t,new Set),(i=this._subscribers.get(t))==null||i.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){var i;this._subscribers.has(t)&&((i=this._subscribers.get(t))==null||i.delete(e))}_notify(t,e){var i;if(this._subscribers.has(t))for(let s of(i=this._subscribers.get(t))!=null?i:new Set)try{s(e)}catch(o){this._debugPrint("Error in modal subscriber:",o)}}destroy(){this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(D.DESTROY,{})}};n(or,"ModalManager");var Ni=or;function Ac(r){return r.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`).replace(/__/g,"_")}n(Ac,"i");function ar(r){return Array.isArray(r)?r.map(t=>typeof t=="object"&&t!==null?ar(t):t):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([t,e])=>{let i=Ac(t);return typeof e=="object"&&e!==null?[i,ar(e)]:[i,e]}))}n(ar,"c");function xc(r){return{ok:!0,value:r}}n(xc,"u");function nr(r){return{ok:!1,error:r}}n(nr,"a");var Tc="https://tlm.uploadcare.com/api/",cr=class cr{constructor(t=Tc){this.baseUrl=t}async base(t,e={}){let i=`${this.baseUrl}${t}`;try{let s=await fetch(i,e);if(!s.ok)return nr(new Error(`Got non-200 response from "${i}". Status: ${s.status.toString()}`));try{let o=await s.json();return xc(o)}catch(o){return nr(new Error(`Error parsing JSON from "${i}". Error: ${o}`))}}catch(s){return nr(new Error(`Error fetching data from "${i}". Error: ${s}`))}}async post(t,e,i={}){return await this.base(t,{...i,method:"POST",body:JSON.stringify(ar(e)),headers:{"Content-Type":"application/json",...i.headers||{}}})}async get(t,e={}){return await this.base(t,{method:"GET",...e})}};n(cr,"y");var lr=cr,Sc=n(async(r,t)=>({success:!0,data:t}),"f"),ur=class ur extends lr{constructor(){super()}async sendEvent(t,e){let i=await Sc(void 0,t);if(!i.success)throw console.error("TelemetryAPIService: events: body is invalid",i.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",t,e)}};n(ur,"p");var Vi=ur;var xe="blocks",Te="1.16.2";var dr=class dr{constructor(t){d(this,"_sessionId",crypto.randomUUID());d(this,"_telemetryInstance",null);d(this,"_block",null);d(this,"_config",Y);d(this,"_initialized",!1);d(this,"_lastPayload",null);d(this,"_queue",null);this._block=t,this._telemetryInstance=new Vi,this._queue=new it(10);for(let e of Object.keys(Y))t.subConfigValue(e,i=>{var s;this._initialized&&this._config[e]!==i&&((s=this._block)==null||s.emit(w.CHANGE_CONFIG,void 0)),this._setConfig(e,i)})}_init(t){t===w.INIT_SOLUTION&&!this._initialized&&(this._initialized=!0)}_setConfig(t,e){this._config[t]!==e&&(this._config[t]=e)}_formattingPayload(t){var s,o;let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let i={...t};return(t.eventType===w.INIT_SOLUTION||t.eventType===w.CHANGE_CONFIG)&&(i.config=this._config),{...i,appVersion:Te,appName:xe,sessionId:this._sessionId,component:this._solution,activity:this._activity,projectPubkey:(s=this._config)==null?void 0:s.pubkey,userAgent:navigator.userAgent,eventType:(o=i.eventType)!=null?o:"",eventTimestamp:this._timestamp,payload:{...e}}}_excludedEvents(t){return!!(t&&[w.CHANGE,w.COMMON_UPLOAD_PROGRESS,w.FILE_ADDED,w.FILE_REMOVED,w.FILE_UPLOAD_START,w.FILE_UPLOAD_PROGRESS,w.FILE_UPLOAD_SUCCESS,w.FILE_UPLOAD_FAILED,w.FILE_URL_CHANGED,w.GROUP_CREATED].includes(t))}sendEvent(t){var o;let e=this._formattingPayload(t);if(this._init(t.eventType),this._excludedEvents(t.eventType)||this._lastPayload&&this._checkObj(this._lastPayload,e))return null;(o=this._queue)==null||o.add(async()=>{var a;this._lastPayload=e,await((a=this._telemetryInstance)==null?void 0:a.sendEvent(e))})}sendEventCloudImageEditor(t,e,i={}){var s;this.sendEvent({payload:{metadata:{tabId:e,node:(s=t.currentTarget)==null?void 0:s.tagName,event:t.type,...i}}})}_checkObj(t,e){if(JSON.stringify(t)===JSON.stringify(e))return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;let i=Object.keys(t),s=Object.keys(e);if(i.length!==s.length)return!1;for(let o of i)if(!Object.prototype.hasOwnProperty.call(e,o)||!this._checkObj(t[o],e[o]))return!1;return!0}get _timestamp(){return Date.now()}get _solution(){var t,e;return(t=this._block)!=null&&t.has("*solution")?(e=this._block)==null?void 0:e.$["*solution"].toLowerCase():null}get _activity(){var t,e;return(t=this._block)!=null&&t.has("*currentActivity")?(e=this._block)==null?void 0:e.$["*currentActivity"]:null}};n(dr,"TelemetryManager");var zi=dr;var Ic="uc-",zt=class zt extends _e{constructor(){super();d(this,"requireCtxName",!1);d(this,"activityType",null);d(this,"init$",Ks());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(pn),this.addTemplateProcessor(fn)}l10n(e,i={}){if(!e)return"";let s=this.$[oe(e)]||e,o=Ko(s);for(let l of o)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return Ft(s,i)}pluralize(e,i){let s=this.l10n("locale-id")||"en",o=xi(s,i);return this.l10n(`${e}__${o}`)}bindL10n(e,i){var s;(s=this.localeManager)==null||s.bindL10n(this,e,i)}emit(e,i,s){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&(o.emit(e,i,s),this.telemetryManager.sendEvent({eventType:e,payload:typeof i=="function"?i():i}))}hasBlockInCtx(e){for(let i of this.blocksRegistry)if(e(i))return!0;return!1}setOrAddState(e,i){this.add$({[e]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Zo({element:this,attribute:"ctx-name",onSuccess:n(()=>{super.connectedCallback()},"onSuccess"),onTimeout:n(()=>{console.error("Attribute `ctx-name` is required and it is not set.")},"onTimeout")}):super.connectedCallback(),Dt.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Dt.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new Ai(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Di(this)),this.cfg.qualityInsights&&!this.has("*telemetryManager")&&this.add("*telemetryManager",new zi(this)),this.has("*a11y")||this.add("*a11y",new Fi),this.has("*modalManager")||this.add("*modalManager",new Ni(this)),this.sub(oe("locale-id"),i=>{let s=Wo(i);this.style.direction=s==="ltr"?"":s}),this.subConfigValue("testMode",i=>{if(!i||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId)})}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.has("*modalManager")&&this.$["*modalManager"]}get telemetryManager(){return this.cfg.qualityInsights?this.has("*telemetryManager")&&this.$["*telemetryManager"]:{sendEvent:n(()=>{},"sendEvent"),sendEventCloudImageEditor:n(()=>{},"sendEventCloudImageEditor")}}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var i;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,S.deleteCtx(this),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e,i;S.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy(),this.modalManager&&((i=this.modalManager)==null||i.destroy())}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:Ci(e),cdnUrlModifiers:Is(e),fileName:wi(e)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),e}return this.cfg.secureDeliveryProxy?Ft(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:n(i=>window.encodeURIComponent(i),"transform")}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:n((i,s,o)=>{if(typeof s!="string")return!1;let a=j(s);return this.has(a)||this.add(a,Y[s]),this.$[a]=o,!0},"set"),get:n((i,s)=>{let o=j(s);return this.has(o)||this.add(o,Y[s]),this.$[j(s)]},"get")})}return this.__cfgProxy}subConfigValue(e,i){let s=j(e);this.has(s)||this.add(s,Y[e]),this.sub(s,i)}debugPrint(...e){if(!this.cfg.debug)return;let i=e;if(typeof(e==null?void 0:e[0])=="function"){let s=e[0];i=s()}console.log(`[${this.ctxName}]`,...i)}static reg(e){if(!e){super.reg();return}e.startsWith(Ic)&&super.reg(e)}};n(zt,"Block"),d(zt,"StateConsumerScope",null),d(zt,"styleAttrs",[]);var y=zt;var yn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Bi=class Bi extends y{constructor(){super(...arguments);d(this,"requireCtxName",!0);d(this,"init$",Ui(this));d(this,"_template",null)}initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}static set template(e){this._template=yn+e+"<slot></slot>"}static get template(){return this._template}};n(Bi,"SolutionBlock"),d(Bi,"styleAttrs",["uc-wgt-common"]);var ce=Bi;var wn="active",Bt="___ACTIVITY_IS_ACTIVE___",ue=class ue extends y{constructor(){super(...arguments);d(this,"historyTracked",!1);d(this,"init$",Zs(this));d(this,"_debouncedHistoryFlush",M(this._historyFlush.bind(this),10))}_deactivate(){var i;let e=ue._activityCallbacks.get(this);this[Bt]=!1,this.removeAttribute(wn),(i=e==null?void 0:e.deactivateCallback)==null||i.call(e)}_activate(){var i;let e=ue._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Bt]=!0,this.setAttribute(wn,""),(i=e==null?void 0:e.activateCallback)==null||i.call(e),this._debouncedHistoryFlush(),this.emit(w.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{var i;try{this.activityType!==e&&this[Bt]?this._deactivate():this.activityType===e&&!this[Bt]&&this._activate()}catch(s){console.error(`Error in activity "${this.activityType}". `,s),this.$["*currentActivity"]=(i=this.$["*history"][this.$["*history"].length-1])!=null?i:null}e||(this.$["*history"]=[])}))}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e)}_isActivityRegistered(){return this.activityType&&ue._activityCallbacks.has(this)}get isActivityActive(){return this[Bt]}get couldOpenActivity(){return!0}registerActivity(e,i={}){let{onActivate:s,onDeactivate:o}=i;ue._activityCallbacks.set(this,{activateCallback:s,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),ue._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let e=this.$["*currentActivity"];!![...this.blocksRegistry].find(s=>s instanceof ue&&s.activityType===e)||(this.$["*currentActivity"]=null,this.modalManager.closeAll())}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var i;let e=this.$["*history"];if(e){let s=e.pop();for(;s===this.activityType;)s=e.pop();let o=!!s;if(s){let a=[...this.blocksRegistry].find(l=>l.activityType===s);o=(i=a==null?void 0:a.couldOpenActivity)!=null?i:!1}s=o?s:void 0,s&&this.modalManager.open(s),this.$["*currentActivity"]=s,this.$["*history"]=e,s||this.modalManager.closeAll()}}};n(ue,"ActivityBlock"),d(ue,"_activityCallbacks",new Map);var b=ue;b.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Ht=33.333333333333336,x=1,hr=24,Cn=6;function Pe(r,t){for(let e in t)r.setAttributeNS(null,e,t[e].toString())}n(Pe,"setSvgNodeAttrs");function ee(r,t={}){let e=document.createElementNS("http://www.w3.org/2000/svg",r);return Pe(e,t),e}n(ee,"createSvgNode");function En(r,t,e){let{x:i,y:s,width:o,height:a}=r,l=t.includes("w")?0:1,c=t.includes("n")?0:1,u=[-1,1][l],p=[-1,1][c],h=[i+l*o+1.5*u,s+c*a+1.5*p-24*e*p],f=[i+l*o+1.5*u,s+c*a+1.5*p],m=[i+l*o-24*e*u+1.5*u,s+c*a+1.5*p];return{d:`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,center:f}}n(En,"cornerPath");function An(r,t,e){let{x:i,y:s,width:o,height:a}=r,l=["n","s"].includes(t)?.5:{w:0,e:1}[t],c=["w","e"].includes(t)?.5:{n:0,s:1}[t],u=[-1,1][l],p=[-1,1][c],h,f;["n","s"].includes(t)?(h=[i+l*o-34*e/2,s+c*a+1.5*p],f=[i+l*o+34*e/2,s+c*a+1.5*p]):(h=[i+l*o+1.5*u,s+c*a-34*e/2],f=[i+l*o+1.5*u,s+c*a+34*e/2]);let m=`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,g=[f[0]-(f[0]-h[0])/2,f[1]-(f[1]-h[1])/2];return{d:m,center:g}}n(An,"sidePath");function xn(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}n(xn,"thumbCursor");function Tn({rect:r,delta:[t,e],imageBox:i}){return ot({...r,x:r.x+t,y:r.y+e},i)}n(Tn,"moveRect");function ot(r,t){let{x:e}=r,{y:i}=r;return r.x<t.x?e=t.x:r.x+r.width>t.x+t.width&&(e=t.x+t.width-r.width),r.y<t.y?i=t.y:r.y+r.height>t.y+t.height&&(i=t.y+t.height-r.height),{...r,x:e,y:i}}n(ot,"constraintRect");function Oc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[,s]=t,{y:o,width:a,height:l}=r;o+=s,l-=s,e&&(a=l*e);let c=r.x+r.width/2-a/2;return o<=i.y&&(o=i.y,l=r.y+r.height-o,e&&(a=l*e,c=r.x+r.width/2-a/2)),c<=i.x&&(c=i.x,o=r.y+r.height-l),c+a>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-a),a=i.x+i.width-c,e&&(l=a/e),o=r.y+r.height-l),l<x&&(l=x,e&&(a=l*e,c=r.x+r.width/2-a/2),o=r.y+r.height-l),a<x&&(a=x,e&&(l=a/e,c=r.x+r.width/2-a/2),o=r.y+r.height-l),{x:c,y:o,width:a,height:l}}n(Oc,"resizeNorth");function $c({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s]=t,{x:o,width:a,height:l}=r;o+=s,a-=s,e&&(l=a/e);let c=r.y+r.height/2-l/2;return o<=i.x&&(o=i.x,a=r.x+r.width-o,e&&(l=a/e,c=r.y+r.height/2-l/2)),c<=i.y&&(c=i.y,o=r.x+r.width-a),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(a=l*e),o=r.x+r.width-a),l<x&&(l=x,e&&(a=l*e),c=r.y+r.height/2-l/2,o=r.x+r.width-a),a<x&&(a=x,e&&(l=a/e),c=r.y+r.height/2-l/2,o=r.x+r.width-a),{x:o,y:c,width:a,height:l}}n($c,"resizeWest");function kc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[,s]=t,{y:o,width:a,height:l}=r;l+=s,e&&(a=l*e);let c=r.x+r.width/2-a/2;return o+l>=i.y+i.height&&(l=i.y+i.height-o,e&&(a=l*e),c=r.x+r.width/2-a/2),c<=i.x&&(c=i.x,o=r.y),c+a>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-a),a=i.x+i.width-c,e&&(l=a/e),o=r.y),l<x&&(l=x,e&&(a=l*e),c=r.x+r.width/2-a/2),a<x&&(a=x,e&&(l=a/e),c=r.x+r.width/2-a/2),{x:c,y:o,width:a,height:l}}n(kc,"resizeSouth");function Mc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s]=t,{x:o,width:a,height:l}=r;a+=s,e&&(l=a/e);let c=r.y+r.height/2-l/2;return o+a>=i.x+i.width&&(a=i.x+i.width-o,e&&(l=a/e),c=r.y+r.height/2-l/2),c<=i.y&&(c=i.y,o=r.x),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(a=l*e),o=r.x),l<x&&(l=x,e&&(a=l*e),c=r.y+r.height/2-l/2),a<x&&(a=x,e&&(l=a/e),c=r.y+r.height/2-l/2),{x:o,y:c,width:a,height:l}}n(Mc,"resizeEast");function Lc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s,o]=t,{x:a,y:l,width:c,height:u}=r;return a+s<i.x&&(s=i.x-a),l+o<i.y&&(o=i.y-l),a+=s,c-=s,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,a=r.x+r.width-c,l=i.y)):e&&(s=u*e-c,c=c+s,a-=s,a<=i.x&&(c=c-(i.x-a),u=c/e,a=i.x,l=r.y+r.height-u)),u<x&&(u=x,e&&(c=u*e),a=r.x+r.width-c,l=r.y+r.height-u),c<x&&(c=x,e&&(u=c/e),a=r.x+r.width-c,l=r.y+r.height-u),{x:a,y:l,width:c,height:u}}n(Lc,"resizeNorthWest");function Pc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s,o]=t,{x:a,y:l,width:c,height:u}=r;return a+c+s>i.x+i.width&&(s=i.x+i.width-a-c),l+o<i.y&&(o=i.y-l),c+=s,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,a=r.x,l=i.y)):e&&(s=u*e-c,c+=s,a+c>=i.x+i.width&&(c=i.x+i.width-a,u=c/e,a=i.x+i.width-c,l=r.y+r.height-u)),u<x&&(u=x,e&&(c=u*e),l=r.y+r.height-u),c<x&&(c=x,e&&(u=c/e),l=r.y+r.height-u),{x:a,y:l,width:c,height:u}}n(Pc,"resizeNorthEast");function Uc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s,o]=t,{x:a,y:l,width:c,height:u}=r;return a+s<i.x&&(s=i.x-a),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),a+=s,c-=s,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,a=r.x+r.width-c,l=i.y+i.height-u)):e&&(s=u*e-c,c+=s,a-=s,a<=i.x&&(c=c-(i.x-a),u=c/e,a=i.x,l=r.y)),u<x&&(u=x,e&&(c=u*e),a=r.x+r.width-c),c<x&&(c=x,e&&(u=c/e),a=r.x+r.width-c),{x:a,y:l,width:c,height:u}}n(Uc,"resizeSouthWest");function Rc({rect:r,delta:t,aspectRatio:e,imageBox:i}){let[s,o]=t,{x:a,y:l,width:c,height:u}=r;return a+c+s>i.x+i.width&&(s=i.x+i.width-a-c),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),c+=s,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,a=r.x,l=i.y+i.height-u)):e&&(s=u*e-c,c+=s,a+c>=i.x+i.width&&(c=i.x+i.width-a,u=c/e,a=i.x+i.width-c,l=r.y)),u<x&&(u=x,e&&(c=u*e)),c<x&&(c=x,e&&(u=c/e)),{x:a,y:l,width:c,height:u}}n(Rc,"resizeSouthEast");function Sn({direction:r,...t}){switch(r){case"n":return Oc(t);case"w":return $c(t);case"s":return kc(t);case"e":return Mc(t);case"nw":return Lc(t);case"ne":return Pc(t);case"sw":return Uc(t);case"se":return Rc(t);default:return t.rect}}n(Sn,"resizeRect");function In(r,[t,e]){return r.x<=t&&t<=r.x+r.width&&r.y<=e&&e<=r.y+r.height}n(In,"rectContainsPoint");function On(r,t){return r.x>=t.x&&r.y>=t.y&&r.x+r.width<=t.x+t.width&&r.y+r.height<=t.y+t.height}n(On,"isRectInsideRect");function $n(r,t){return Math.abs(r.width/r.height-t)<.1}n($n,"isRectMatchesAspectRatio");function nt({width:r,height:t},e){let i=e/90%2!==0;return{width:i?t:r,height:i?r:t}}n(nt,"rotateSize");function kn(r,t,e){let i=r/t,s,o;i>e?(s=Math.round(t*e),o=t):(s=r,o=Math.round(r/e));let a=Math.round((r-s)/2),l=Math.round((t-o)/2);return a+s>r&&(s=r-a),l+o>t&&(o=t-l),{x:a,y:l,width:s,height:o}}n(kn,"calculateMaxCenteredCropFrame");function at(r){return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}n(at,"roundRect");function Ue(r,t,e){return Math.min(Math.max(r,t),e)}n(Ue,"clamp");var ji=n(r=>{if(!r)return[];let[t,e]=r.split(":").map(Number);if(!Number.isFinite(t)||!Number.isFinite(e)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:t,height:e}]},"parseCropPreset");function Mn(r){return Ds({...r,libraryName:xe,libraryVersion:Te})}n(Mn,"customUserAgent");var Ln=n(r=>Math.floor(r/1e3),"msToUnixTimestamp"),Pn=n((r,{threshold:t})=>{let{secureExpire:e}=r,i=Ln(Date.now()),s=Number(e),o=Ln(t);return i+o>=s},"isSecureTokenExpired");var pr=class pr{constructor(t){d(this,"_block");d(this,"_secureToken",null);this._block=t}_debugPrint(...t){this._block.debugPrint("[secure-uploads]",...t)}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:i}=this._block.cfg;if((t||e)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||Pn(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let s=await i();s?!s.secureSignature||!s.secureExpire?console.error("Secure signature resolver returned an invalid result:",s):(this._debugPrint("Secure signature resolved:",s),this._debugPrint("Secure signature will expire in",new Date(Number(s.secureExpire)*1e3).toISOString()),this._secureToken=s):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(s){console.error("Secure signature resolving failed. Falling back to the previous one.",s)}}return this._secureToken}return t&&e?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}};n(pr,"SecureUploadsManager");var Gi=pr;var Un="[Typed State] Wrong property name: ",Dc="[Typed State] Wrong property type: ",fr=class fr{constructor(t,e){this.__typedSchema=t,this.__ctxId=e||De.generate(),this.__schema=Object.keys(t).reduce((i,s)=>(i[s]=t[s].value,i),{}),this.__data=S.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(t,e){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(Un+t);return}let i=this.__typedSchema[t],s=(e==null?void 0:e.constructor)===i.type,o=e instanceof i.type,a=i.nullable&&e===null;if(s||o||a){this.__data.pub(t,e);return}console.warn(Dc+t)}setMultipleValues(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}getValue(t){return this.__typedSchema.hasOwnProperty(t)||console.warn(Un+t),this.__data.read(t)}subscribe(t,e){return this.__data.sub(t,e)}remove(){S.deleteCtx(this.__ctxId)}};n(fr,"TypedData");var Wi=fr;var mr=class mr{constructor(t){this.__typedSchema=t.typedSchema,this.__ctxId=t.ctxName||De.generate(),this.__data=S.registerCtx({},this.__ctxId),this.__watchList=t.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let e=Object.create(null);this.__notifyObservers=(i,s)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),e[i]||(e[i]=new Set),e[i].add(s),this.__observeTimeout=window.setTimeout(()=>{Object.keys(e).length!==0&&(this.__propertyObservers.forEach(o=>{o({...e})}),e=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let t=new Set(this.__added),e=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],t,e)})}observeCollection(t){return this.__collectionObservers.add(t),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(t)}}unobserveCollection(t){var e;(e=this.__collectionObservers)==null||e.delete(t)}add(t){let e=new Wi(this.__typedSchema);for(let[i,s]of Object.entries(t))e.setValue(i,s);return this.__items.add(e.uid),this.notify(),this.__data.add(e.uid,e),this.__added.add(e),this.__watchList.forEach(i=>{this.__subsMap[e.uid]||(this.__subsMap[e.uid]=[]),this.__subsMap[e.uid].push(e.subscribe(i,()=>{this.__notifyObservers(i,e.uid)}))}),e.uid}read(t){return this.__data.read(t)}readProp(t,e){let i=this.read(t);return i?i.getValue(e):(console.warn(`Item with id ${t} not found`),null)}publishProp(t,e,i){let s=this.read(t);if(!s){console.warn(`Item with id ${t} not found`);return}s.setValue(e,i)}remove(t){let e=this.read(t);e&&this.__removed.add(e),this.__items.delete(t),this.notify(),this.__data.pub(t,null),delete this.__subsMap[t]}clearAll(){this.__items.forEach(t=>{this.remove(t)})}observeProperties(t){return this.__propertyObservers.add(t),()=>{this.unobserveProperties(t)}}unobserveProperties(t){var e;(e=this.__propertyObservers)==null||e.delete(t)}findItems(t){let e=[];return this.__items.forEach(i=>{let s=this.read(i);s&&t(s)&&e.push(i)}),e}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){S.deleteCtx(this.__ctxId),this.__propertyObservers=new Set,this.__collectionObservers=new Set;for(let t in this.__subsMap)this.__subsMap[t].forEach(e=>{e.remove()}),delete this.__subsMap[t]}};n(mr,"TypedCollection");var qi=mr;var I=Object.freeze({PHOTO:"photo",VIDEO:"video"}),se=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var gr=n(r=>({isVideoRecordingEnabled:Z(r.cameraModes).includes(I.VIDEO),isPhotoEnabled:Z(r.cameraModes).includes(I.PHOTO)}),"calcCameraModes");var Ve=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),br=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),L=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...br,...Ve});var Fc=n(()=>{let r=navigator.userAgent;return/Macintosh|Windows/.test(r)&&/Version\/[\d\.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},"calcIsDesktopSafari"),Nc=n(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),Vc=n(()=>({safariDesktop:Fc()}),"calcBrowserInfo"),zc=n(()=>({htmlMediaCapture:Nc()}),"calcBrowserFeatures"),Rn=Vc(),ze=zc();var jt="image/*",_r="video/*",Bc=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Hc=n(()=>Rn.safariDesktop?[jt]:[jt,...Bc],"calcImageAcceptList"),Gt=Hc(),Xi=n(r=>r?r.filter(t=>typeof t=="string").map(t=>V(t)).flat():[],"mergeFileTypes"),vr=n((r,t)=>t.some(e=>e.endsWith("*")?(e=e.replace("*",""),r.startsWith(e)):r===e),"matchMimeType"),Dn=n((r,t)=>t.some(e=>e.startsWith(".")?r.toLowerCase().endsWith(e.toLowerCase()):!1),"matchExtension"),Fn=n(r=>{let t=r==null?void 0:r.type;return t?vr(t,Gt):!1},"fileIsImage");var jc=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Gc=new RegExp(`^/?(${jc.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Nn=n(({url:r,cdnBase:t})=>{let e=new URL(t),i=new URL(r);if(e.host!==i.host)return null;let[,s,o,a]=Gc.exec(i.pathname);return{uuid:s,cdnUrlModifiers:o||"",filename:a||null}},"parseCdnUrl");var Vn=n(r=>{let t=new Map;return(...e)=>{let i=JSON.stringify(e);if(t.has(i))return t.get(i);let s=r(...e);return t.set(i,s),s}},"memoize");var zn=new Set;function Ki(r){zn.has(r)||(zn.add(r),console.warn(r))}n(Ki,"warnOnce");function Wc(r){let t=!1;return setTimeout(()=>{t=!0},0),n(i=>(...s)=>(t&&Ki(r),i(...s)),"withAssert")}n(Wc,"createAsyncAssertWrapper");function Bn(r){let t={progress:n(()=>r.$["*commonProgress"],"progress"),errors:n(()=>r.$["*collectionErrors"],"errors"),group:n(()=>r.$["*groupInfo"],"group"),totalCount:n(()=>r.uploadCollection.size,"totalCount"),failedCount:n(()=>e.failedEntries.length,"failedCount"),successCount:n(()=>e.successEntries.length,"successCount"),uploadingCount:n(()=>e.uploadingEntries.length,"uploadingCount"),status:n(()=>e.isFailed?"failed":e.isUploading?"uploading":e.isSuccess?"success":"idle","status"),isSuccess:n(()=>e.allEntries.length>0&&e.errors.length===0&&e.successEntries.length===e.allEntries.length,"isSuccess"),isUploading:n(()=>e.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:n(()=>e.errors.length>0||e.failedEntries.length>0,"isFailed"),allEntries:n(()=>r.getOutputData(),"allEntries"),successEntries:n(()=>e.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:n(()=>e.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:n(()=>e.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:n(()=>e.allEntries.filter(s=>s.status==="idle"),"idleEntries")},e={},i=Wc("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,o]of Object.entries(t)){let a=s,c=Vn(i(o));Object.defineProperty(e,a,{get:c,enumerable:!0})}return e}n(Bn,"buildOutputCollectionState");var yr=class yr{constructor(t){d(this,"_ctx");d(this,"addFileFromUrl",n((t,{silent:e,fileName:i,source:s}={})=>{let o=this._uploadCollection.add({externalUrl:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:s!=null?s:L.API});return this.getOutputItem(o)},"addFileFromUrl"));d(this,"addFileFromUuid",n((t,{silent:e,fileName:i,source:s}={})=>{let o=this._uploadCollection.add({uuid:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:s!=null?s:L.API});return this.getOutputItem(o)},"addFileFromUuid"));d(this,"addFileFromCdnUrl",n((t,{silent:e,fileName:i,source:s}={})=>{var l;let o=Nn({url:t,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let a=this._uploadCollection.add({uuid:o.uuid,cdnUrl:t,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(l=i!=null?i:o.filename)!=null?l:null,silent:e!=null?e:!1,source:s!=null?s:L.API});return this.getOutputItem(a)},"addFileFromCdnUrl"));d(this,"addFileFromObject",n((t,{silent:e,fileName:i,source:s,fullPath:o}={})=>{let a=this._uploadCollection.add({file:t,isImage:Fn(t),mimeType:t.type,fileName:i!=null?i:t.name,fileSize:t.size,silent:e!=null?e:!1,source:s!=null?s:L.API,fullPath:o!=null?o:null});return this.getOutputItem(a)},"addFileFromObject"));d(this,"removeFileByInternalId",n(t=>{if(!this._uploadCollection.read(t))throw new Error(`File with internalId ${t} not found`);this._uploadCollection.remove(t)},"removeFileByInternalId"));d(this,"uploadAll",n(()=>{let t=this._uploadCollection.items().filter(e=>{let i=this._uploadCollection.read(e);return i?!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo"):!1});t.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(t),this._ctx.emit(w.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));d(this,"openSystemDialog",n((t={})=>{var o;let e=ye(Xi([(o=this.cfg.accept)!=null?o:"",...this.cfg.imgOnly?Gt:[]])),i="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(i,""),Ut(s,{opacity:0,height:0,width:0,visibility:"hidden"}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:a,isVideoRecordingEnabled:l}=gr(this.cfg);t.modeCamera===I.PHOTO&&a?s.accept=jt:t.modeCamera===I.VIDEO&&l?s.accept=_r:s.accept=[jt,l&&_r].filter(Boolean).join(",")}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(a=>this.addFileFromObject(a,{source:t.captureCamera?L.CAMERA:L.LOCAL})),this._ctx.modalManager.open(b.activities.UPLOAD_LIST),this._ctx.$["*currentActivity"]=b.activities.UPLOAD_LIST,s.remove())},{once:!0}),document.querySelectorAll(`[${i}]`).forEach(a=>a.remove()),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"))},"openSystemDialog"));d(this,"getOutputItem",n(t=>{var a,l,c,u,p,h,f,m,g,_;let e=S.getCtx(t).store,i=e.fileInfo,s=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return{uuid:(l=(a=i==null?void 0:i.uuid)!=null?a:e.uuid)!=null?l:null,internalId:t,name:(c=i==null?void 0:i.originalFilename)!=null?c:e.fileName,size:(u=i==null?void 0:i.size)!=null?u:e.fileSize,isImage:(p=i==null?void 0:i.isImage)!=null?p:e.isImage,mimeType:(h=i==null?void 0:i.mimeType)!=null?h:e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:(m=(f=e.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i!=null?i:null,metadata:(_=(g=e.metadata)!=null?g:i==null?void 0:i.metadata)!=null?_:null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",errors:e.errors,status:s,source:e==null?void 0:e.source}},"getOutputItem"));d(this,"getOutputCollectionState",n(()=>Bn(this._ctx),"getOutputCollectionState"));d(this,"initFlow",n((t=!1)=>{var e,i,s,o;if(this._uploadCollection.size>0&&!t)(e=this._ctx.modalManager)==null||e.open(b.activities.UPLOAD_LIST),this._ctx.set$({"*currentActivity":b.activities.UPLOAD_LIST});else if(((i=this._sourceList)==null?void 0:i.length)===1){let a=this._sourceList[0];if(a==="local"){this._ctx.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.openSystemDialog();return}if(a==="camera"&&ze.htmlMediaCapture){let{isPhotoEnabled:p,isVideoRecordingEnabled:h}=gr(this.cfg);if(p&&h){this._ctx.set$({"*currentActivity":b.activities.START_FROM});return}else if(p||h){this.openSystemDialog({captureCamera:!0,modeCamera:p?I.PHOTO:I.VIDEO});return}else this.openSystemDialog({captureCamera:!0,modeCamera:I.PHOTO})}let l=this._ctx.$["*blocksRegistry"],c=n(p=>"type"in p&&p.type===a,"isSourceBtn"),u=[...l].find(c);u==null||u.activate(),this._ctx.$["*currentActivity"]&&((s=this._ctx.modalManager)==null||s.open(this._ctx.$["*currentActivity"]))}else(o=this._ctx.modalManager)==null||o.open(b.activities.START_FROM),this._ctx.set$({"*currentActivity":b.activities.START_FROM})},"initFlow"));d(this,"doneFlow",n(()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.modalManager.closeAll()},"doneFlow"));d(this,"setCurrentActivity",n((t,e=void 0)=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===t)){this._ctx.set$({"*currentActivityParams":e!=null?e:{},"*currentActivity":t});return}console.warn(`Activity type "${t}" not found in the context`)},"setCurrentActivity"));d(this,"getCurrentActivity",n(()=>this._ctx.$["*currentActivity"],"getCurrentActivity"));d(this,"setModalState",n(t=>{var e,i;if(t&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?(e=this._ctx.modalManager)==null||e.open(this._ctx.$["*currentActivity"]):((i=this._ctx.modalManager)==null||i.close(this._ctx.$["*currentActivity"]),this._ctx.$["*currentActivity"]=null)},"setModalState"));this._ctx=t}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}get _sourceList(){let t=[];return this.cfg.sourceList&&(t=V(this.cfg.sourceList)),t}};n(yr,"UploaderPublicApi");var Zi=yr;var wr=n((r,t)=>{let e=t.cfg.imgOnly,i=r.isImage;if(!(!e||i)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return{type:"NOT_AN_IMAGE",message:t.l10n("images-only-accepted"),payload:{entry:r}}},"validateIsImage");var Cr=n((r,t)=>{let e=t.cfg.imgOnly,i=t.cfg.accept,s=Xi([...e?Gt:[],i]);if(!s.length)return;let o=r.mimeType,a=r.name;if(!o||!a)return;let l=vr(o,s),c=Dn(a,s);if(!l&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:t.l10n("file-type-not-allowed"),payload:{entry:r}}},"validateFileType");var he=1e3,Be=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Wt=n(r=>Math.ceil(r*100)/100,"round"),Hn=n((r,t=Be.AUTO)=>{let e=t===Be.AUTO;if(t===Be.BYTE||e&&r<he**1){let i=xi("en-US",r),s={one:"byte",other:"bytes"}[i];return`${r} ${s}`}return t===Be.KB||e&&r<he**2?`${Wt(r/he**1)} KB`:t===Be.MB||e&&r<he**3?`${Wt(r/he**2)} MB`:t===Be.GB||e&&r<he**4?`${Wt(r/he**3)} GB`:t===Be.TB||e&&r<he**5?`${Wt(r/he**4)} TB`:`${Wt(r/he**5)} PB`},"prettyBytes");var Er=n((r,t)=>{let e=t.cfg.maxLocalFileSizeBytes,i=r.size;if(e&&i&&i>e)return{type:"FILE_SIZE_EXCEEDED",message:t.l10n("files-max-size-limit-error",{maxFileSize:Hn(e)}),payload:{entry:r}}},"validateMaxSizeLimit");var Ar=n((r,t)=>{let{internalId:e}=r,i=t._uploadCollection.read(e),s=i==null?void 0:i.getValue("uploadError");if(!s)return;if(s instanceof H)return{type:"UPLOAD_ERROR",message:s.message,payload:{entry:r,error:s}};if(s instanceof tt)return{type:"NETWORK_ERROR",message:s.message,payload:{entry:r,error:s}};let o=s instanceof Error?s:new Error("Unknown error",{cause:s});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:r,error:o}}},"validateUploadError");var xr=n((r,t)=>{if(r.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:t.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Tr=n((r,t)=>{let e=r.totalCount,i=t.cfg.multiple?t.cfg.multipleMin:0,s=t.cfg.multiple?t.cfg.multipleMax:1;if(i&&e<i)return{type:"TOO_FEW_FILES",message:t.l10n("files-count-limit-error-too-few",{min:i,max:s,total:e}),payload:{total:e,min:i,max:s}};if(s&&e>s)return{type:"TOO_MANY_FILES",message:t.l10n("files-count-limit-error-too-many",{min:i,max:s,total:e}),payload:{total:e,min:i,max:s}}},"validateMultiple");var Yi={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},Sr=class Sr{constructor(t){d(this,"_blockInstance");d(this,"_fileValidators",[wr,Cr,Er,Ar]);d(this,"_collectionValidators",[Tr,xr]);this._blockInstance=t,this._uploadCollection=this._blockInstance.uploadCollection;let e=n(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",e),this._blockInstance.subConfigValue("multipleMin",e),this._blockInstance.subConfigValue("multipleMax",e),this._blockInstance.subConfigValue("multiple",e),this._blockInstance.subConfigValue("imgOnly",e),this._blockInstance.subConfigValue("accept",e)}runFileValidators(t){let e=t!=null?t:this._uploadCollection.items();for(let i of e){let s=this._uploadCollection.read(i);s&&this._runFileValidatorsForEntry(s)}}runCollectionValidators(){let t=this._blockInstance.api.getOutputCollectionState(),e=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let s=i(t,this._blockInstance.api);if(!s)continue;s&&(e.push(s),s.message||console.warn(Yi.message))}catch(s){console.warn(Yi.collection,s)}this._blockInstance.$["*collectionErrors"]=e,e.length>0&&this._blockInstance.emit(w.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(t){let e=this._blockInstance.api.getOutputItem(t.uid),i=[];for(let s of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=s(e,this._blockInstance.api);if(!o)continue;o&&(i.push(o),o.message||console.warn(Yi.message))}catch(o){console.warn(Yi.file,o)}t.setValue("errors",i)}_addCustomTypeToValidators(t){return t.map(e=>(...i)=>{let s=e(...i);return s?{...s,type:"CUSTOM_ERROR"}:void 0})}};n(Sr,"ValidationManager");var Ji=Sr;var jn=Object.freeze({file:Object.freeze({type:File,value:null,nullable:!0}),externalUrl:Object.freeze({type:String,value:null,nullable:!0}),fileName:Object.freeze({type:String,value:null,nullable:!0}),fileSize:Object.freeze({type:Number,value:null,nullable:!0}),lastModified:Object.freeze({type:Number,value:Date.now()}),uploadProgress:Object.freeze({type:Number,value:0}),uuid:Object.freeze({type:String,value:null,nullable:!0}),isImage:Object.freeze({type:Boolean,value:!1}),mimeType:Object.freeze({type:String,value:null,nullable:!0}),ctxName:Object.freeze({type:String,value:null,nullable:!0}),cdnUrl:Object.freeze({type:String,value:null,nullable:!0}),cdnUrlModifiers:Object.freeze({type:String,value:null,nullable:!0}),fileInfo:Object.freeze({type:Ee,value:null,nullable:!0}),isUploading:Object.freeze({type:Boolean,value:!1}),abortController:Object.freeze({type:AbortController,value:null,nullable:!0}),thumbUrl:Object.freeze({type:String,value:null,nullable:!0}),silent:Object.freeze({type:Boolean,value:!1}),source:Object.freeze({type:String,value:null,nullable:!0}),fullPath:Object.freeze({type:String,value:null,nullable:!0}),metadata:Object.freeze({type:Object,value:null,nullable:!0}),errors:Object.freeze({type:Array,value:[]}),uploadError:Object.freeze({type:Error,value:null,nullable:!0}),isRemoved:Object.freeze({type:Boolean,value:!1}),isQueued:Object.freeze({type:Boolean,value:!1})});var Qi=class Qi extends b{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!1);d(this,"isCtxOwner",!1);d(this,"init$",Ui(this));d(this,"_flushOutputItems",M(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit(w.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));d(this,"_handleCollectionUpdate",n((e,i,s)=>{var o;(i.size||s.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let a of i)a.getValue("silent")||this.emit(w.FILE_ADDED,this.api.getOutputItem(a.uid));for(let a of s){this.$["*uploadTrigger"].delete(a.uid),(o=a.getValue("abortController"))==null||o.abort(),a.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0});let l=a==null?void 0:a.getValue("thumbUrl");l&&URL.revokeObjectURL(l),this.emit(w.FILE_REMOVED,this.api.getOutputItem(a.uid))}this.$["*uploadList"]=e.map(a=>({uid:a})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));d(this,"_handleCollectionPropertiesUpdate",n(e=>{this._flushOutputItems();let i=this.uploadCollection,s=[...new Set(Object.entries(e).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(s.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(s)}),e.uploadProgress){for(let o of e.uploadProgress){let{isUploading:a,silent:l}=S.getCtx(o).store;a&&!l&&this.emit(w.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(e.isUploading)for(let o of e.isUploading){let{isUploading:a,silent:l}=S.getCtx(o).store;a&&!l&&this.emit(w.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(e.fileInfo){for(let o of e.fileInfo){let{fileInfo:a,silent:l}=S.getCtx(o).store;a&&!l&&this.emit(w.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop(),this.cfg.cloudImageEditorAutoOpen&&this.openCloudImageEditor()}if(e.errors){for(let l of e.errors){let{errors:c}=S.getCtx(l).store;c.length>0&&(this.emit(w.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(w.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=i.findItems(l=>!!l.getValue("fileInfo")),a=i.findItems(l=>l.getValue("errors").length>0);i.size>0&&a.length===0&&i.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(w.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(a=>{var l;return!!((l=this.uploadCollection.read(a))!=null&&l.getValue("cdnUrl"))}).forEach(a=>{this.emit(w.FILE_URL_CHANGED,this.api.getOutputItem(a))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));d(this,"_flushCommonUploadProgress",n(()=>{let e=0,s=[...this.$["*uploadTrigger"]].filter(a=>!!this.uploadCollection.read(a));s.forEach(a=>{let l=this.uploadCollection.readProp(a,"uploadProgress");typeof l=="number"&&(e+=l)});let o=s.length?Math.round(e/s.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(w.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof Qi?e.isCtxOwner&&e.isConnected&&e!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new qi({typedSchema:jn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",e)}this.has("*publicApi")||this.add("*publicApi",new Zi(this)),this.has("*validationManager")||this.add("*validationManager",new Ji(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this.initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){var e,i;(e=this._unobserveCollectionProperties)==null||e.call(this),(i=this._unobserveCollection)==null||i.call(this),this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}destroyCallback(){super.destroyCallback(),this._flushOutputItems.cancel()}initCtxOwner(){this.isCtxOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new Gi(this))}async _createGroup(e){let i=await this.getUploadClientOptions(),s=e.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,a=await un(s,{...i,signal:o.signal});if(this.$["*collectionState"]!==e){o.abort();return}this.$["*groupInfo"]=a;let l=this.api.getOutputCollectionState();this.emit(w.GROUP_CREATED,l),this.emit(w.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}openCloudImageEditor(){let[e]=this.uploadCollection.findItems(i=>!!i.getValue("fileInfo")&&i.getValue("isImage")).map(i=>this.uploadCollection.read(i));e&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(i=>i.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:e.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager.open(b.activities.CLOUD_IMG_EDIT))}setInitialCrop(){let e=ji(this.cfg.cropPreset);if(e){let[i]=e,s=this.uploadCollection.findItems(o=>{var a;return!!o.getValue("fileInfo")&&o.getValue("isImage")&&!((a=o.getValue("cdnUrlModifiers"))!=null&&a.includes("/crop/"))}).map(o=>this.uploadCollection.read(o)).filter(Boolean);for(let o of s){let a=o.getValue("fileInfo");if(!a||!a.imageInfo){console.warn("Failed to get image info for entry",o.uid);continue}let{width:l,height:c}=a.imageInfo,u=i.width/i.height,p=kn(l,c,u),h=B(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),f=o.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",o.uid);continue}o.setMultipleValues({cdnUrlModifiers:h,cdnUrl:F(f,h)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(m=>m.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager.open(b.activities.CLOUD_IMG_EDIT))}}}async getMetadataFor(e){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let s=this.api.getOutputItem(e);return await i(s)}return i}async getUploadClientOptions(){let i=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Mn,integration:this.cfg.userAgentIntegration,secureSignature:i==null?void 0:i.secureSignature,secureExpire:i==null?void 0:i.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(s=>this.api.getOutputItem(s))}};n(Qi,"UploaderBlock");var k=Qi;k.extSrcList=Object.freeze({...Ve});k.sourceTypes=Object.freeze({...L});var lt=n(r=>{var t;return(t=r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:t.map(e=>e.toLowerCase()).join("-")},"toKebabCase");var U=n(r=>String(r),"asString"),te=n(r=>{let t=Number(r);if(Number.isNaN(t))throw new Error(`Invalid number: "${r}"`);return t},"asNumber"),$=n(r=>{if(typeof r=="undefined"||r===null)return!1;if(typeof r=="boolean")return r;if(r==="true"||r==="")return!0;if(r==="false")return!1;throw new Error(`Invalid boolean: "${r}"`)},"asBoolean"),Gn=n(r=>r==="auto"?r:$(r),"asStore"),Wn=n(r=>{let t=U(r);if(t!=="user"&&t!=="environment"&&t!=="")throw new Error(`Invalid value: "${t}"`);return t},"asCameraCapture"),qn=n(r=>{let t=U(r);if(!Object.values(I).includes(t))throw new Error(`Invalid value: "${t}"`);return t},"asCameraMode"),Xn=n(r=>{let t=U(r),e=Z(t);if(e.some(i=>!Object.values(I).includes(i)))throw new Error(`Invalid value: "${JSON.stringify(e)}"`);return t},"asCameraModes"),Kn=n(r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Ir=n(r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},"asObject"),es=n(r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},"asFunction"),Or=n(r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},"asArray"),Zn=n(r=>{let t=U(r);if(["grid","list"].includes(t))return t;throw new Error(`Invalid value: "${t}"`)},"asFilesViewMode");var qc={pubkey:U,multiple:$,multipleMin:te,multipleMax:te,confirmUpload:$,imgOnly:$,accept:U,externalSourcesPreferredTypes:U,externalSourcesEmbedCss:U,store:Gn,cameraMirror:$,cameraCapture:Wn,sourceList:U,maxLocalFileSizeBytes:te,thumbSize:te,showEmptyList:$,useLocalImageEditor:$,useCloudImageEditor:$,cloudImageEditorTabs:U,removeCopyright:$,cropPreset:U,imageShrink:U,modalScrollLock:$,modalBackdropStrokes:$,sourceListWrap:$,remoteTabSessionKey:U,cdnCname:U,baseUrl:U,socialBaseUrl:U,secureSignature:U,secureExpire:U,secureDeliveryProxy:U,retryThrottledRequestMaxTimes:te,multipartMinFileSize:te,multipartChunkSize:te,maxConcurrentRequests:te,multipartMaxConcurrentRequests:te,multipartMaxAttempts:te,checkForUrlDuplicates:$,saveUrlForRecurrentUploads:$,groupOutput:$,userAgentIntegration:U,debug:$,localeName:U,metadata:Kn,secureUploadsExpireThreshold:te,localeDefinitionOverride:Ir,secureUploadsSignatureResolver:es,secureDeliveryProxyUrlResolver:es,iconHrefResolver:es,fileValidators:Or,collectionValidators:Or,cameraModes:Xn,defaultCameraMode:qn,enableAudioRecording:$,enableVideoRecording:$,mediaRecorderOptions:Ir,maxVideoRecordingDuration:te,filesViewMode:Zn,gridShowFileNames:$,cloudImageEditorAutoOpen:$,cloudImageEditorMaskHref:U,testMode:$,qualityInsights:$},Yn=n((r,t)=>{if(!(typeof t=="undefined"||t===null))try{return qc[r](t)}catch(e){return console.error(`Invalid value for config key "${r}".`,e),Y[r]}},"normalizeConfigValue");var Xc=[{test:n(r=>r.accept&&!!r.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:n(r=>r.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:n(r=>r.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Jn=M(r=>{for(let{test:t,message:e}of Xc)t(r)&&Ki(e)},0);var Qn=n(({key:r,value:t,setValue:e,getValue:i})=>{if(r==="enableVideoRecording"&&t!==null){let s=Z(i("cameraModes"));t&&!s.includes("video")?s=s.concat("video"):t||(s=s.filter(o=>o!=="video")),e("cameraModes",ye(s))}if(r==="defaultCameraMode"&&t!==null){let s=Z(i("cameraModes"));s=s.sort((o,a)=>o===t?-1:a===t?1:0),e("cameraModes",ye(s))}},"runSideEffects");var $r=[...new Set(["debug",...Object.keys(Y)])],Kc=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Zc=n(r=>Kc.includes(r),"isComplexKey"),ct=$r.filter(r=>!Zc(r)),Yc={...Object.fromEntries(ct.map(r=>[lt(r),r])),...Object.fromEntries(ct.map(r=>[r.toLowerCase(),r]))},Jc={...Object.fromEntries(ct.map(r=>[lt(r),j(r)])),...Object.fromEntries(ct.map(r=>[r.toLowerCase(),j(r)]))},ea=n(r=>"__"+r,"getLocalPropName"),kr=class kr extends y{constructor(){super();d(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(Y).map(([e,i])=>[j(e),i]))}}_flushValueToAttribute(e,i){if(ct.includes(e)){let s=[...new Set([lt(e),e.toLowerCase()])];for(let o of s)typeof i=="undefined"||i===null?this.removeAttribute(o):this.getAttribute(o)!==i.toString()&&this.setAttribute(o,i.toString())}}_flushValueToState(e,i){this.$[j(e)]!==i&&(typeof i=="undefined"||i===null?this.$[j(e)]=Y[e]:this.$[j(e)]=i)}_setValue(e,i){let s=this,o=Yn(e,i),a=ea(e);s[a]!==o&&(this._assertSameValueDifferentReference(e,s[a],o),s[a]=o,this._flushValueToAttribute(e,o),this._flushValueToState(e,o),this.debugPrint(`[uc-config] "${e}"`,o),Jn(this.cfg),Qn({key:e,value:o!=null?o:null,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this)}))}_getValue(e){var o;let i=this,s=ea(e);return(o=i[s])!=null?o:this.$[j(e)]}_assertSameValueDifferentReference(e,i,s){this.cfg.debug&&s!==i&&typeof s=="object"&&typeof i=="object"&&JSON.stringify(s)===JSON.stringify(i)&&(console.warn(`[uc-config] Option "${e}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${e}" previous value:`,i),console.warn(`[uc-config] "${e}" new value:`,s))}initCallback(){var i;super.initCallback();let e=this;for(let s of ct)this.sub(j(s),o=>{this._setValue(s,o)},!1);for(let s of $r){let o=(i=e[s])!=null?i:this.$[j(s)];o!==Y[s]&&this._setValue(s,o),Object.defineProperty(this,s,{set:n(a=>{this._setValue(s,a)},"set"),get:n(()=>this._getValue(s),"get")})}}attributeChangedCallback(e,i,s){if(i===s)return;let o=this,a=Yc[e];o[a]=s}};n(kr,"ConfigClass");var qt=kr;qt.bindAttributes(Jc);for(let r of $r)qt.prototype[r]=void 0;var ta=qt;var Mr=class Mr extends y{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=`#uc-icon-${t}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let s=i(t);e=s!=null?s:e}this.$.href=e})}),this.setAttribute("aria-hidden","true")}};n(Mr,"Icon");var ut=Mr;ut.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;ut.bindAttributes({name:"name"});var ia=n(r=>[...new Set(r)],"uniqueArray");var sa=n(r=>Object.entries(r).filter(([t,e])=>e!==void 0&&e!=="").map(([t,e])=>t==="cdn-operations"||t==="analytics"?e:`${t}/${e}`),"parseObjectToString");var Qc="https://ucarecdn.com",Xt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Qc},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var dt="--uc-img-",Lr="unresolved";var Pr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Ur=3e3,Rr=5e3,Dr=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var oa=Object.create(null),ra;for(let r in Xt)oa[dt+r]=((ra=Xt[r])==null?void 0:ra.default)||"";var Fr=class Fr extends _e{constructor(){super(...arguments);d(this,"cssInit$",oa)}$$(e){return this.$[dt+e]}set$$(e){for(let i in e)this.$[dt+i]=e[i]}sub$$(e,i){this.sub(dt+e,s=>{s===null||s===""||i(s)})}analyticsParams(){return`-/@clib/${xe}/${Te}/uc-img/`}initAttributes(e){[...this.attributes].forEach(i=>{Xt[i.name]||e.setAttribute(i.name,i.value)})}initIntersection(e,i){let s={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(a=>{a.isIntersecting&&(i(),this._isnObserver.unobserve(e))})},s),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(e=>{this._isnObserver.unobserve(e)}),this._isnObserver=null),S.deleteCtx(this)}static get observedAttributes(){return Object.keys(Xt)}attributeChangedCallback(e,i,s){window.setTimeout(()=>{this.$[dt+e]=s})}};n(Fr,"ImgConfig");var ts=Fr;var Nr=class Nr extends ts{constructor(){super(...arguments);d(this,"_img",new Image);d(this,"_imgPreview",new Image)}_fmtAbs(e){return!e.includes("//")&&!Pr&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if((e==null?void 0:e.trim())!==""){let i=e.match(/\d+/)[0],s=e.match(/[a-zA-Z]+/)[0],o=parseInt(i,10);if(Number(o)>Rr&&this.hasFormatJPG)return Rr+s;if(Number(o)>Ur&&!this.hasFormatJPG)return Ur+s}return e}_getCdnModifiers(e,i){let s={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(e),blur:i,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return B(...sa(s))}_getUrlBase(e="",i=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(Pr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let s=this._getCdnModifiers(e,i);if(this.$$("src").startsWith(this.$$("cdn-cname")))return F(this.$$("src"),s);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(F(Oe(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("uuid"))return this._proxyUrl(F(Oe(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("proxy-cname"))return this._proxyUrl(F(this.$$("proxy-cname"),s,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(F(`https://${this.$$("pubkey")}.ucr.io/`,s,this._fmtAbs(this.$$("src"))))}_proxyUrl(e){return this.$$("secure-delivery-proxy")?Ft(this.$$("secure-delivery-proxy"),{previewUrl:e},{transform:n(s=>window.encodeURIComponent(s),"transform")}):e}_getElSize(e,i=1,s=!0){let o=e.getBoundingClientRect(),a=i*Math.round(o.width),l=s?"":i*Math.round(o.height);return a||l?`${a||""}x${l||""}`:null}_setupEventProxy(e){let i=n(o=>{o.stopPropagation();let a=new Event(o.type,o);this.dispatchEvent(a)},"proxifyEvent"),s=["load","error"];for(let o of s)e.addEventListener(o,i)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:Dr.PREVIEW,img:this._imgPreview}:{type:Dr.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let e=V(this.$$("breakpoints"));return ia(e.map(i=>parseInt(i,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(e){let i=new Set;i.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let s=`image-set(${[...i].join(", ")})`;e.style.setProperty("background-image",s),e.style.setProperty("background-image","-webkit-"+s)}getSrcset(){let e=new Set;return this.breakpoints?this.breakpoints.forEach(i=>{e.add(this._getUrlBase(i+"x")+` ${this._validateSize(i+"w")}`),this.$$("hi-res-support")&&e.add(this._getUrlBase(i*2+"x")+` ${this._validateSize(i*2+"w")}`),this.$$("ultra-res-support")&&e.add(this._getUrlBase(i*3+"x")+` ${this._validateSize(i*3+"w")}`)}):(e.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...e].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:e,src:i,srcset:s}){i&&(e.src=i),s&&(e.srcset=s)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}loaderImage({src:e,srcset:i,elNode:s}){return new Promise((o,a)=>{this._setupConfigForImage({elNode:s}),s.setAttribute(Lr,""),s.addEventListener("load",()=>{s.removeAttribute(Lr),o(s)}),s.addEventListener("error",()=>{a(!1)}),this._appendURL({elNode:s,src:e,srcset:i})})}async renderImage(){var e,i;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var s;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((s=this._imgPreview)==null?void 0:s.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((i=this._imgPreview)==null?void 0:i.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};n(Nr,"ImgBase");var rs=Nr;var Vr=class Vr extends rs{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",t=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=t?"lazy":"eager")})}};n(Vr,"Img");var os=Vr;var ht=class ht extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:n(()=>{this.api.initFlow()},"onClick"),"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",e=>{typeof e!="undefined"&&(this.$.withDropZone=$(e))}),this.subConfigValue("multiple",e=>{this.$["button-text"]=e?"upload-files":"upload-file"})}};n(ht,"SimpleBtn"),d(ht,"styleAttrs",[...X(ht,ht,"styleAttrs"),"uc-simple-btn"]);var pt=ht;pt.template=`<uc-drop-area set="@disabled: !withDropZone"><button type="button" set="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;pt.bindAttributes({dropzone:null});var zr=class zr extends b{constructor(){super(...arguments);d(this,"historyTracked",!0);d(this,"activityType",b.activities.START_FROM)}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};n(zr,"StartFrom");var Kt=zr;Kt.template='<div class="uc-content"><slot></slot></div>';function eu(r){return new Promise(t=>{typeof window.FileReader!="function"&&t(!1);try{let e=new FileReader;e.onerror=()=>{t(!0)};let i=n(s=>{s.type!=="loadend"&&e.abort(),t(!1)},"onLoad");e.onloadend=i,e.onprogress=i,e.readAsDataURL(r)}catch{t(!1)}})}n(eu,"checkIsDirectory");function tu(r,t){return new Promise(e=>{let i=0,s=[],o=n(l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),e(null)),l.isFile?(i++,l.file(c=>{i--;let u=new File([c],c.name,{type:c.type||t});s.push({type:"file",file:u,fullPath:l.fullPath}),i===0&&e(s)})):l.isDirectory&&a(l.createReader())},"readEntry"),a=n(l=>{i++,l.readEntries(c=>{i--;for(let u of c)o(u);i===0&&e(s)})},"readReaderContent");o(r)})}n(tu,"readEntryContentAsync");function na(r){let t=[],e=[];for(let i=0;i<r.items.length;i++){let s=r.items[i];if(s)if(s.kind==="file"){let o=s.type;if(typeof s.webkitGetAsEntry=="function"||typeof s.getAsEntry=="function"){let l=typeof s.webkitGetAsEntry=="function"?s.webkitGetAsEntry():s.getAsEntry();e.push(tu(l,o).then(c=>{c&&t.push(...c)}));continue}let a=s.getAsFile();a&&e.push(eu(a).then(l=>{l||t.push({type:"file",file:a})}))}else s.kind==="string"&&s.type.match("^text/uri-list")&&e.push(new Promise(o=>{s.getAsString(a=>{t.push({type:"url",url:a}),o(void 0)})}))}return Promise.all(e).then(()=>t)}n(na,"getDropItems");var G={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},aa=["focus"],iu=100,Br=new Map;function su(r,t){let e=Math.max(Math.min(r[0],t.x+t.width),t.x),i=Math.max(Math.min(r[1],t.y+t.height),t.y);return Math.sqrt((r[0]-e)*(r[0]-e)+(r[1]-i)*(r[1]-i))}n(su,"distance");function Hr(r){let t=0,e=document.body,i=new Set,s=n(g=>i.add(g),"handleSwitch"),o=G.INACTIVE,a=n(g=>{r.shouldIgnore()&&g!==G.INACTIVE||(o!==g&&i.forEach(_=>_(g)),o=g)},"setState"),l=n(()=>t>0,"isDragging");s(g=>r.onChange(g));let c=n(()=>{t=0,a(G.INACTIVE)},"onResetEvent"),u=n(()=>{t+=1,o===G.INACTIVE&&a(G.ACTIVE)},"onDragEnter"),p=n(()=>{t-=1,l()||a(G.INACTIVE)},"onDragLeave"),h=n(g=>{g.preventDefault(),t=0,a(G.INACTIVE)},"onDrop"),f=n(g=>{if(r.shouldIgnore())return;l()||(t+=1);let _=[g.x,g.y],E=r.element.getBoundingClientRect(),A=Math.floor(su(_,E)),v=A<iu,C=g.composedPath().includes(r.element);Br.set(r.element,A);let R=Math.min(...Br.values())===A;C&&R?(g.preventDefault(),a(G.OVER)):a(v&&R?G.NEAR:G.ACTIVE)},"onDragOver"),m=n(async g=>{if(r.shouldIgnore())return;g.preventDefault();let _=await na(g.dataTransfer);r.onItems(_),a(G.INACTIVE)},"onElementDrop");return e.addEventListener("drop",h),e.addEventListener("dragleave",p),e.addEventListener("dragenter",u),e.addEventListener("dragover",f),r.element.addEventListener("drop",m),aa.forEach(g=>{window.addEventListener(g,c)}),()=>{Br.delete(r.element),e.removeEventListener("drop",h),e.removeEventListener("dragleave",p),e.removeEventListener("dragenter",u),e.removeEventListener("dragover",f),r.element.removeEventListener("drop",m),aa.forEach(g=>{window.removeEventListener(g,c)})}}n(Hr,"addDropzone");var la="uc-drop-area",ft=`${la}/registry`,mt=class mt extends k{constructor(){super(),this.init$={...this.init$,state:G.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,isInitFlow:!1,text:"",[ft]:null}}isActive(){if(!this.$.isEnabled)return!1;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),o=s.visibility!=="hidden"&&s.display!=="none";return e&&o&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[ft]||(this.$[ft]=new Set),this.$[ft].add(this),this.defineAccessor("disabled",e=>{this.set$({isEnabled:!$(e)})}),this.defineAccessor("clickable",e=>{this.set$({isClickable:$(e)})}),this.defineAccessor("initflow",e=>{this.set$({isInitFlow:$(e)})}),this.defineAccessor("with-icon",e=>{this.set$({withIcon:$(e)})}),this.defineAccessor("fullscreen",e=>{this.set$({isFullscreen:$(e)})}),this.defineAccessor("text",e=>{typeof e=="string"?this.bindL10n("text",()=>this.l10n(e)||e):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=Hr({element:this,shouldIgnore:n(()=>this._shouldIgnore(),"shouldIgnore"),onChange:n(e=>{this.$.state=e},"onChange"),onItems:n(e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:L.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:L.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.modalManager.open(b.activities.UPLOAD_LIST),this.set$({"*currentActivity":b.activities.UPLOAD_LIST})))},"onItems")});let t=this.ref["content-wrapper"];t&&(this._destroyContentWrapperDropzone=Hr({element:t,onChange:n(e=>{var s;let i=(s=Object.entries(G).find(([,o])=>o===e))==null?void 0:s[0].toLowerCase();i&&t.setAttribute("drag-state",i)},"onChange"),onItems:n(()=>{},"onItems"),shouldIgnore:n(()=>this._shouldIgnore(),"shouldIgnore")})),this.sub("state",e=>{var s;let i=(s=Object.entries(G).find(([,o])=>o===e))==null?void 0:s[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",e=>{let i=V(e);this.$.isEnabled=i.includes(L.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",e=>{this.toggleAttribute("hidden",!e)}),this.sub("isClickable",e=>{this.toggleAttribute("clickable",e)}),this.$.isClickable&&(this._onAreaClicked=e=>{if(e.type==="keydown"){if(e.code==="Space"||e.code==="Enter"){if(this.$.isInitFlow){this.api.initFlow();return}this.api.openSystemDialog()}}else if(e.type==="click"){if(this.$.isInitFlow){this.api.initFlow();return}this.api.openSystemDialog()}},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[ft]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return!(t&&e&&i>=e||!t&&i>0)}destroyCallback(){var e,i;super.destroyCallback();let t=this.$[ft];t&&(t.delete(this),t.size===0&&S.deleteCtx(la)),(e=this._destroyDropzone)==null||e.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};n(mt,"DropArea"),d(mt,"styleAttrs",[...X(mt,mt,"styleAttrs"),"uc-drop-area"]);var gt=mt;gt.template=`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;gt.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null,initflow:null});var ru="src-type-",jr=class jr extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"type");d(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:L.LOCAL,activate:n(()=>(this.api.openSystemDialog(),!1),"activate")}),this.registerType({type:L.URL,activity:b.activities.URL,textKey:"from-url"}),this.registerType({type:L.CAMERA,activity:b.activities.CAMERA,activate:n(()=>{let e=ze.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:!0}),!e},"activate")}),this.registerType({type:"draw",activity:b.activities.DRAW,icon:"edit-draw"});for(let e of Object.values(br))this.registerType({type:e,activity:b.activities.CAMERA,activate:n(()=>{let i=ze.htmlMediaCapture;return i&&this.api.openSystemDialog({captureCamera:!0,modeCamera:e==="mobile-photo-camera"?I.PHOTO:I.VIDEO}),!i},"activate")});for(let e of Object.values(Ve))this.registerType({type:e,activity:b.activities.EXTERNAL,activityParams:{externalSourceType:e}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",e=>{e&&this.applyType(e)})}registerType(e){this._registeredTypes[e.type]=e}getType(e){return this._registeredTypes[e]}activate(){if(!this.type)return;let e=this._registeredTypes[this.type],{activity:i,activate:s,activityParams:o={}}=e;(s?s():!!i)&&(this.modalManager.open(i),this.set$({"*currentActivityParams":o,"*currentActivity":i}))}applyType(e){let i=this._registeredTypes[e];if(!i){console.warn("Unsupported source type: "+e);return}let{textKey:s=e,icon:o=e}=i;this.$["src-type"]=`${ru}${s}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};n(jr,"SourceBtn");var bt=jr;bt.template=`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;bt.bindAttributes({type:null});var Gr=class Gr extends y{initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{let e=V(t),i="";e.forEach(s=>{if(s==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here:https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");return}if(s==="camera"&&ze.htmlMediaCapture){this.subConfigValue("cameraModes",o=>{let a=Z(o);a.forEach(l=>{i+=`<uc-source-btn role="listitem" type="mobile-${l}-camera"></uc-source-btn>`}),a.length===0&&(i+='<uc-source-btn role="listitem" type="mobile-photo-camera"></uc-source-btn>')});return}i+=`<uc-source-btn role="listitem" type="${s}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=i:this.outerHTML=i})}};n(Gr,"SourceList");var ns=Gr;var ls=n(()=>{let r=[];return{stack:r,promiseReadJpegChunks:n(e=>new Promise((i,s)=>{let o=2,a=n((u,p)=>{let h=new FileReader;h.addEventListener("load",()=>{p(new DataView(h.result))}),h.addEventListener("error",f=>{s(`Reader error: ${f}`)}),h.readAsArrayBuffer(u)},"readToView"),l=n(()=>a(e.slice(o,o+128),u=>{let p,h,f;for(p=h=0,f=u.byteLength;f>=0?h<f:h>f;p=f>=0?++h:--h)if(u.getUint8(p)===255){o+=p;break}c()}),"readNext"),c=n(()=>{let u=o;return a(e.slice(o,o+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){s("Corrupted");return}let h=p.getUint8(1);if(h===218){i(!0);return}let f=p.getUint16(2)-2;return a(e.slice(o,o+=f),m=>{if(m.byteLength!==f){s("Corrupted");return}r.push({startPos:u,length:f,marker:h,view:m}),l()})})},"readNextChunk");FileReader&&DataView||s("Not Support"),a(e.slice(0,2),u=>{u.getUint16(0)!==65496&&s("Not jpeg"),l()})}),"promiseReadJpegChunks")}},"readJpegChunks"),ou=n(async r=>{let t=[],{promiseReadJpegChunks:e,stack:i}=ls();return await e(r),i.forEach(({marker:s,view:o})=>{s===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&t.push(o)}),t},"getIccProfile"),ua=n(async(r,t,e)=>{{let i=[],s=[],{promiseReadJpegChunks:o,stack:a}=ls();await o(r),a.forEach(u=>{if(u.marker===t)return i.push(u.startPos),s.push(u.length)});let l=[r.slice(0,2)];for(let u of e){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+t),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u)}let c=2;for(let u=0;u<i.length;u++)i[u]>c&&l.push(r.slice(c,i[u])),c=i[u]+s[u]+4;return l.push(r.slice(c,r.size)),new Blob(l,{type:r.type})}},"replaceJpegChunk"),nu=226,da=n((r,t)=>ua(r,nu,t.map(e=>e.buffer)),"replaceIccProfile"),au=n(async r=>{try{return await da(r,[])}catch(t){throw new Error(`Failed to strip ICC profile: ${t}`)}},"stripIccProfile"),lu=n((r,t,e)=>new Promise((i,s)=>{let o=n(a=>{if(!a){s("Failed to convert canvas to blob");return}i(a)},"callback");r.toBlob(o,t,e),r.width=r.height=1}),"canvasToBlob"),Zt=n(()=>{let r=document.createElement("canvas"),t=r.getContext("2d");return{canvas:r,ctx:t}},"createCanvas"),cu=n(r=>{let{ctx:e,canvas:i}=Zt();i.width=i.height=50,e.drawImage(r,0,0,50,50);let s=e.getImageData(0,0,50,50).data;i.width=i.height=1;for(let o=3;o<s.length;o+=4)if(s[o]<254)return!0;return!1},"hasTransparency"),uu=n(async r=>{let t=null,{promiseReadJpegChunks:e,stack:i}=ls();return await e(r),i.forEach(({marker:s,view:o})=>{if(!t&&s===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){t=o;return}}),t},"getExif"),du="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",as,hu=n(()=>new Promise(r=>{if(as!==void 0)r(as);else{let t=new Image;t.addEventListener("load",()=>{as=t.naturalWidth<t.naturalHeight,t.src="//:0",r(as)}),t.src=du}}),"isBrowserApplyExifOrientation"),pu=n((r,t)=>{let e,i,s,o;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)i=!0;else if(r.getUint16(6)===19789)i=!1;else return;if(r.getUint16(8,i)!==42)return;s=8+r.getUint32(10,i);let a=r.getUint16(s-2,i);for(e=0,o=a;o>=0?e<o:e>o;o>=0?++e:--e){if(r.byteLength<s+10)return;r.getUint16(s,i)===274&&t(s+8,i),s+=12}},"findExifOrientation"),fu=n((r,t)=>{pu(r,(e,i)=>r.setUint16(e,t,i))},"setExifOrientation"),mu=n(async(r,t,e)=>(e&&fu(t,1),ua(r,225,[t.buffer])),"replaceExif"),gu=n((r,t)=>new Promise((e,i)=>{t&&(r.src=t),r.complete?e(r):(r.addEventListener("load",()=>{e(r)}),r.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),bu=n(r=>gu(new Image,r),"imageLoader"),_u=[1,3],vu=[192,193,194,195,197,198,199,201,202,203,205,206,207],ca={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},yu=n(async r=>{let t=!1,{promiseReadJpegChunks:e,stack:i}=ls();return await e(r).then(()=>(i.forEach(({marker:s,view:o})=>{if(!t&&vu.indexOf(s)>=0){let a=o.getUint8(5);_u.indexOf(a)<0&&(t=!0)}}),t)).catch(()=>t)},"shouldSkipShrink"),ha=n((r,t)=>{let e={};return(...i)=>{let s=t(i,e);return s in e?e[s]:e[s]=r(...i)}},"memoize"),pa=n((r,t)=>{let[e]=r,i=Object.keys(t).map(s=>parseInt(s,10)).sort((s,o)=>s-o);for(let s=0;s<i.length;s++){let o=i[s],a=!!t[o];if(o>e&&a||o<e&&!a)return o}return e},"memoKeySerializer"),Re={R:55,G:110,B:165,A:255},wu=`rgba(${Re.R}, ${Re.G}, ${Re.B}, ${Re.A/255})`,fa=n((r,t)=>{try{let e=[r-1,t-1,1,1],{canvas:i,ctx:s}=Zt();i.width=1,i.height=1;let{canvas:o,ctx:a}=Zt();o.width=r,o.height=t,a&&(a.fillStyle=wu,a.fillRect(...e),s.drawImage(o,r-1,t-1,1,1,0,0,1,1));let l=s&&s.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===Re.R&&l[1]===Re.G&&l[2]===Re.B&&l[3]===Re.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${r}x${t}.`),!1}},"canvasTest");function ma(r){return(...t)=>new Promise(e=>{setTimeout(()=>{let i=r(...t);e(i)},0)})}n(ma,"wrapAsync");var Cu=ma(ha(fa,pa)),Eu=ma(ha(fa,pa)),ga=n(async(r,t)=>{let e=ca.squareSide.find(a=>a*a>=r*t),i=ca.dimension.find(a=>a>=r&&a>=t);if(!e||!i)throw new Error("Not supported");let[s,o]=await Promise.all([Cu(e,e),Eu(i,1)]);if(s&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),ba=n(async(r,t,e)=>{try{let{ctx:i,canvas:s}=Zt();return s.width=t,s.height=e,i.imageSmoothingQuality="high",i.drawImage(r,0,0,t,e),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),s}catch(i){throw new Error("Canvas resize error",{cause:i})}},"canvasResize"),Au=n(({img:r,targetW:t,targetH:e})=>ba(r,t,e),"native"),xu=n(function({sourceW:r,targetW:t,targetH:e,step:i}){let s=[],o=t,a=e;do s.push([o,a]),o=Math.round(o/i),a=Math.round(a/i);while(o<r*i);return s.reverse()},"calcShrinkSteps"),Tu=n(({img:r,sourceW:t,targetW:e,targetH:i,step:s})=>{let o=xu({sourceW:t,targetW:e,targetH:i,step:s});return o.reduce((a,[l,c],u)=>a.then(p=>ga(l,c).then(()=>ba(p,l,c)).catch(()=>{if(u===o.length-1)throw new Error("Not supported");return p})),Promise.resolve(r))},"fallback"),Su=n(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Iu=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Wr=.71,Ou=n((r,t)=>{if(r.width*Wr*r.height*Wr<t.size)throw new Error("Not required");let e=r.width,i=r.height,s=e/i,o=Math.floor(Math.sqrt(t.size*s)),a=Math.floor(t.size/Math.sqrt(t.size*s));return ga(o,a).then(()=>{let{ctx:l}=Zt();return"imageSmoothingQuality"in l&&!Su()&&!Iu?Au({img:r,targetW:o,targetH:a}):Tu({img:r,sourceW:e,targetW:o,targetH:a,step:Wr})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),_a=n(async(r,t)=>{try{if(await yu(r))throw new Error("Should skipped");let i=await Promise.allSettled([uu(r),hu(),ou(r)]),o=!i.some(_=>_.status==="rejected"),[a,l,c]=i,u=await au(r).catch(()=>r),p=await bu(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let h=await Ou(p,t),f="image/jpeg",m=(t==null?void 0:t.quality)||.8;!o&&cu(h)&&(f="image/png",m=void 0);let g=await lu(h,f,m);if(o&&a.status==="fulfilled"&&a.value){let _=a.value,E=l.status==="fulfilled"?l.value:!1;g=await mu(g,_,E)}return o&&c.status==="fulfilled"&&c.value.length>0&&(g=await da(g,c.value)),g}catch(e){let i;throw e instanceof Error&&(i=e.message),typeof e=="string"&&(i=e),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:e})}},"shrinkFile");var $u=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,va=n(r=>{let t=$u.exec(r==null?void 0:r.toLocaleLowerCase())||[];if(!t.length)return!1;let e=t[1]*t[2],i=16384*16384;return e>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${t[1]}x${t[2]} (${Math.ceil(e/1e3/100)/10}MP).`),!1):{quality:t[3]?t[3]/100:void 0,size:e}},"parseShrink");var _t=n((r,t)=>{let e,i,s,o=n((...a)=>{e?(clearTimeout(i),i=setTimeout(()=>{Date.now()-s>=t&&(r(...a),s=Date.now())},Math.max(t-(Date.now()-s),0))):(r(...a),s=Date.now(),e=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:n(()=>{clearTimeout(i)},"value")}),o},"throttle");var qr=class qr extends k{constructor(){super(...arguments);d(this,"_entrySubs",new Set);d(this,"_entry",null);d(this,"_subEntry",n((e,i)=>this._withEntry((s,o,a)=>{let l=s.subscribe(o,c=>{this.isConnected&&a(c)});this._entrySubs.add(l)})(e,i),"_subEntry"))}_withEntry(e){return n((...s)=>{let o=this._entry;if(!o){console.warn("No entry found");return}return e(o,...s)},"wrapperFn")}_reset(){for(let e of this._entrySubs)e.remove();this._entrySubs=new Set,this._entry=null}disconnectedCallback(){super.disconnectedCallback(),this._entrySubs=new Set}};n(qr,"FileItemConfig");var vt=qr;var ie=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),yt=class yt extends vt{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"pauseRender",!0);d(this,"_renderedOnce",!1);d(this,"_calculateState",this._withEntry(e=>{let i=ie.IDLE;e.getValue("errors").length>0?i=ie.FAILED:e.getValue("isUploading")?i=ie.UPLOADING:e.getValue("fileInfo")&&(i=ie.FINISHED),this.$.state=i}));d(this,"_debouncedCalculateState",M(this._calculateState.bind(this),100));d(this,"_updateHint",this._withEntry(_t(e=>{let i=e.getValue("source"),s=e.getValue("externalUrl"),o=e.getValue("errors").length===0,a=this.$.progressValue===0,l=this.$.state===ie.UPLOADING,c=e.getValue("isQueued");if(!o||!l||!a){this.$.hint="";return}if(c){let u=this.l10n("queued");this.$.hint=u;return}if(s&&i&&i!==L.URL){let u=this.l10n("waiting-for",{source:this.l10n(`src-type-${i}`)});this.$.hint=u;return}this.$.hint=""},100)));d(this,"_handleState",this._withEntry((e,i)=>{var o,a,l,c,u,p;i===ie.FAILED?this.$.badgeIcon="badge-error":i===ie.FINISHED&&(this.$.badgeIcon="badge-success"),i===ie.UPLOADING&&(this.$.isFocused=!1);let s=e.getValue("fileName");this.set$({isFailed:i===ie.FAILED,isUploading:i===ie.UPLOADING,isFinished:i===ie.FINISHED,progressVisible:i===ie.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((o=this._entry)==null?void 0:o.getValue("isImage"))&&((a=this._entry)==null?void 0:a.getValue("cdnUrl")),errorText:(c=(l=e.getValue("errors"))==null?void 0:l[0])==null?void 0:c.message,ariaLabelStatusFile:s&&this.l10n("a11y-file-item-status",{fileName:s,status:this.l10n((p=(u=i==null?void 0:i.description)==null?void 0:u.toLocaleLowerCase())!=null?p:"").toLocaleLowerCase()})}),this._updateHint()}));d(this,"upload",this._withEntry(async e=>{var s,o,a,l,c,u,p;if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),e.setMultipleValues({isUploading:!0,errors:[],isQueued:!0});try{let h=new AbortController;e.setValue("abortController",h);let f=n(async()=>{var v,C;e.setValue("isQueued",!1);let g=e.getValue("file");g&&this.cfg.imageShrink&&(g=await this._processShrink(g).catch(()=>g));let _=g||e.getValue("externalUrl")||e.getValue("uuid");if(!_)throw new Error("No file input");let A={...await this.getUploadClientOptions(),fileName:(v=e.getValue("fileName"))!=null?v:void 0,source:(C=e.getValue("source"))!=null?C:void 0,onProgress:n(R=>{if(R.isComputable){let W=R.value*100;e.setValue("uploadProgress",W)}},"onProgress"),signal:h.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",_,A),Bs(_,A)},"uploadTask"),m=await this.$["*uploadQueue"].add(f);e.setMultipleValues({fileInfo:m,isQueued:!1,isUploading:!1,fileName:m.originalFilename,fileSize:m.size,isImage:(s=m.isImage)!=null?s:!1,mimeType:(l=(a=(o=m.contentInfo)==null?void 0:o.mime)==null?void 0:a.mime)!=null?l:m.mimeType,uuid:m.uuid,cdnUrl:(c=e.getValue("cdnUrl"))!=null?c:m.cdnUrl,cdnUrlModifiers:(u=e.getValue("cdnUrlModifiers"))!=null?u:"",uploadProgress:100,source:(p=e.getValue("source"))!=null?p:null}),e===this._entry&&this._debouncedCalculateState()}catch(h){h instanceof ke&&h.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):h instanceof Fe?e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:h}):(console.error("Unknown upload error",h),e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:h})})),e===this._entry&&this._debouncedCalculateState()}}}));this.init$={...this.init$,uid:"",itemName:"",errorText:"",hint:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,showFileNames:!1,state:ie.IDLE,ariaLabelStatusFile:"",onEdit:this._withEntry(e=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:e.uid},this.modalManager.open(b.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT}),onRemove:n(()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uploadCollection.remove(this.$.uid)},"onRemove"),onUpload:n(()=>{this.upload()},"onUpload")}}_reset(){super._reset(),this._debouncedCalculateState.cancel()}_observerCallback(e){let[i]=e;this._isIntersecting=i.isIntersecting,this._thumbRect=i.boundingClientRect,i.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0)}_handleEntryId(e){var s;this._reset();let i=(s=this.uploadCollection)==null?void 0:s.read(e);this._entry=i,i&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o,this._updateHint()}),this._subEntry("isQueued",()=>{this._updateHint()}),this._subEntry("fileName",o=>{this.$.itemName=o||i.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=i.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",()=>{this._debouncedCalculateState()}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()))}_updateShowFileNames(e){if(this.cfg.filesViewMode==="list"){this.$.showFileNames=!0;return}this.$.showFileNames=e}initCallback(){super.initCallback(),this.sub("uid",e=>{this._handleEntryId(e)}),this.sub("state",e=>{this._handleState(e)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.subConfigValue("filesViewMode",e=>{this._updateShowFileNames(this.cfg.gridShowFileNames),this.setAttribute("mode",e)}),this.subConfigValue("gridShowFileNames",e=>{this._updateShowFileNames(e)}),this.onclick=()=>{yt.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused")})},this.sub("*uploadTrigger",e=>{this._entry&&!e.has(this._entry.uid)||setTimeout(()=>this.isConnected&&this.upload())}),yt.activeInstances.add(this)}destroyCallback(){super.destroyCallback(),yt.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._observer)==null||e.disconnect()}_settingsOfShrink(){return va(this.cfg.imageShrink)}_processShrink(e){return _a(e,this._settingsOfShrink())}};n(yt,"FileItem");var wt=yt;wt.template=`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><uc-thumb set="uid:uid;badgeIcon:badgeIcon"></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><span class="uc-file-name" set="@hidden: !showFileNames">{{itemName}}</span><span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span><span class="uc-file-hint" set="@hidden: !hint">{{hint}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button;@aria-label:file-item-edit-button" class="uc-edit-btn uc-mini-btn" set="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button;@aria-label:file-item-remove-button" class="uc-remove-btn uc-mini-btn" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible; @hasFileName: showFileNames;" ></uc-progress-bar></div>`;wt.activeInstances=new Set;var Xr=null,He=class He extends y{constructor(){super();d(this,"_handleBackdropClick",n(()=>{this._closeDialog()},"_handleBackdropClick"));d(this,"_closeDialog",n(()=>{var e;(e=this.modalManager)==null||e.close(this.id),this.modalManager.hasActiveModals||(document.body.style.overflow="")},"_closeDialog"));d(this,"_handleDialogClose",n(()=>{this._closeDialog()},"_handleDialogClose"));d(this,"_handleDialogMouseDown",n(e=>{this._mouseDownTarget=e.target},"_handleDialogMouseDown"));d(this,"_handleDialogMouseUp",n(e=>{e.target===this.ref.dialog&&e.target===this._mouseDownTarget&&this._closeDialog()},"_handleDialogMouseUp"));this.init$={...this.init$,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?(this.setAttribute("aria-modal","true"),this.ref.dialog.showModal()):this.ref.dialog.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden")}hide(){this.ref.dialog.close?(this.setAttribute("aria-modal","false"),this.ref.dialog.close()):this.ref.dialog.removeAttribute("open")}_handleModalOpen({id:e}){e===this.id?(Xr=e,this.show(),this.emit(w.MODAL_OPEN,{modalId:e},{debounce:!0})):this.hide()}_handleModalClose({id:e}){e===this.id&&(this.hide(),this.emit(w.MODAL_CLOSE,{modalId:e,hasActiveModals:this.modalManager.hasActiveModals},{debounce:!0}))}_handleModalCloseAll(){this.hide(),Xr===this.id&&this.emit(w.MODAL_CLOSE,{modalId:Xr,hasActiveModals:this.modalManager.hasActiveModals},{debounce:!0})}initCallback(){var e;super.initCallback(),(e=this.modalManager)==null||e.registerModal(this.id,this),this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp),this.subConfigValue("modalBackdropStrokes",i=>{i?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.handleModalOpen=this._handleModalOpen.bind(this),this.handleModalClose=this._handleModalClose.bind(this),this.handleModalCloseAll=this._handleModalCloseAll.bind(this),this.modalManager.subscribe(D.OPEN,this.handleModalOpen),this.modalManager.subscribe(D.CLOSE,this.handleModalClose),this.modalManager.subscribe(D.CLOSE_ALL,this.handleModalCloseAll)}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp),this.modalManager.unsubscribe(D.OPEN,this.handleModalOpen),this.modalManager.unsubscribe(D.CLOSE,this.handleModalClose),this.modalManager.unsubscribe(D.CLOSE_ALL,this.handleModalCloseAll)}};n(He,"Modal"),d(He,"styleAttrs",[...X(He,He,"styleAttrs"),"uc-modal"]),d(He,"StateConsumerScope","modal");var Yt=He;Yt.template=`<dialog ref="dialog"><slot></slot></dialog>`;var Kr=class Kr extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"historyTracked",!0);d(this,"activityType",b.activities.UPLOAD_LIST);d(this,"_throttledHandleCollectionUpdate",_t(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:n(()=>{this.api.initFlow(!0)},"onAdd"),onUpload:n(()=>{this.emit(w.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},"onUpload"),onDone:n(()=>{this.emit(w.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},"onDone"),onCancel:n(()=>{this.uploadCollection.clearAll()},"onCancel")}}_updateUploadsState(){let e=this.api.getOutputCollectionState(),i={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount},s=!e.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=e.errors.some(f=>f.type==="TOO_MANY_FILES"),a=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=i.failed===0&&e.errors.length===0,c=!1,u=!1,p=!1;if(i.total-i.succeed-i.uploading-i.failed>0&&s)c=!0;else{u=!0;let f=this.cfg.groupOutput?!!e.group:!0;p=i.total===i.succeed&&s&&l&&f}this.set$({doneBtnVisible:u,doneBtnEnabled:p,uploadBtnVisible:c,addMoreBtnEnabled:i.total===0||!o&&!a,addMoreBtnVisible:!a||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(i))}_getHeaderText(e){let i=n(s=>{let o=e[s];return this.l10n(`header-${s}`,{count:o})},"localizedText");return e.uploading>0?i("uploading"):e.failed>0?i("failed"):e.succeed>0?i("succeed"):i("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",e=>{e&&this._throttledHandleCollectionUpdate()}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e)}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",e=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:e.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",e=>{let i=e.filter(s=>s.type!=="SOME_FILES_HAS_ERRORS")[0];if(!i){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:i.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};n(Kr,"UploadList");var Jt=Kr;Jt.template=`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files"><div class="uc-files-wrapper" repeat="*uploadList" repeat-item-tag="uc-file-item"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var Zr=class Zr extends k{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.URL);d(this,"init$",{...this.init$,importDisabled:!0,onUpload:n(e=>{e.preventDefault();let i=this.ref.input.value;this.api.addFileFromUrl(i,{source:L.URL}),this.modalManager.open(b.activities.UPLOAD_LIST),this.$["*currentActivity"]=b.activities.UPLOAD_LIST},"onUpload"),onCancel:n(()=>{this.historyBack()},"onCancel"),onInput:n(e=>{let i=e.target.value;this.set$({importDisabled:!i})},"onInput")})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>{this.ref.input.value="",this.ref.input.focus()},"onActivate")})}};n(Zr,"UrlSource");var Qt=Zr;Qt.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back;@aria-label:back"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /><button type="submit" class="uc-url-upload-btn uc-primary-btn" set="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var ya=n(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var ku={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},wa=["camera","microphone"];function cs(r){let t=Math.floor(r/60).toString().padStart(2,"0"),e=Math.floor(r%60).toString().padStart(2,"0");return`${t}:${e}`}n(cs,"formatTime");var Ca="image/jpeg",Ea="video/webm",Yr=class Yr extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.CAMERA);d(this,"_unsubPermissions",null);d(this,"_chunks",[]);d(this,"_mediaRecorder",null);d(this,"_stream",null);d(this,"_selectedAudioId",null);d(this,"_selectedCameraId",null);d(this,"_chooseActionWithCamera",n(()=>{var e;if(this._activeTab===I.PHOTO&&this._shot(),this._activeTab===I.VIDEO){if(((e=this._mediaRecorder)==null?void 0:e.state)==="recording"){this._stopRecording();return}this._startRecording()}},"_chooseActionWithCamera"));d(this,"_updateTimer",n(()=>{let e=Math.floor((performance.now()-this.$._startTime+this.$._elapsedTime)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let i=this.cfg.maxVideoRecordingDuration-e;if(i<=0){this.ref.timer.textContent=cs(i),this._stopRecording();return}this.ref.timer.textContent=cs(i)}else this.ref.timer.textContent=cs(e);this._animationFrameId=requestAnimationFrame(this._updateTimer)},"_updateTimer"));d(this,"_startTimer",n(()=>{this.$._startTime=performance.now(),this.$._elapsedTime=0,this._updateTimer()},"_startTimer"));d(this,"_stopTimer",n(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimer"));d(this,"_startTimeline",n(()=>{let e=this.ref.video.currentTime,i=this.ref.video.duration;this.ref.line.style.transform=`scaleX(${e/i})`,this.ref.timer.textContent=cs(e),this._animationFrameId=requestAnimationFrame(this._startTimeline)},"_startTimeline"));d(this,"_stopTimeline",n(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimeline"));d(this,"_startRecording",n(()=>{try{this._chunks=[],this._options={...this.cfg.mediaRecorderOptions};let{mimeType:e}=this.cfg.mediaRecorderOptions||{};e&&MediaRecorder.isTypeSupported(e)?this._options.mimeType=e:MediaRecorder.isTypeSupported(Ea)?this._options.mimeType=Ea:this._options.mimeType="video/mp4",this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener("dataavailable",i=>{this._chunks.push(i.data)}),this._startTimer(),this.classList.add("uc-recording"),this._setCameraState(se.PLAY))}catch(e){console.error("Failed to start recording",e)}},"_startRecording"));d(this,"_stopRecording",n(()=>{var e,i;(e=this._mediaRecorder)==null||e.addEventListener("stop",()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(se.STOP)}),(i=this._mediaRecorder)==null||i.stop(),this.classList.remove("uc-recording")},"_stopRecording"));d(this,"_toggleRecording",n(()=>{var e;((e=this._mediaRecorder)==null?void 0:e.state)!=="recording"&&(!this.ref.video.paused&&!this.ref.video.ended&&this.ref.video.readyState>2?this.ref.video.pause():this.ref.video.paused&&this.ref.video.play())},"_toggleRecording"));d(this,"_toggleEnableAudio",n(()=>{var e;(e=this._stream)==null||e.getAudioTracks().forEach(i=>{i.enabled=!i.enabled,this.$.toggleMicrophoneIcon=i.enabled?"microphone":"microphone-mute",this.$.audioSelectDisabled=!i.enabled})},"_toggleEnableAudio"));d(this,"_previewVideo",n(()=>{var e;try{let i=new Blob(this._chunks,{type:(e=this._mediaRecorder)==null?void 0:e.mimeType}),s=URL.createObjectURL(i);this.ref.video.muted=!1,this.ref.video.volume=1,this.$.video=null,this.ref.video.src=s,this.ref.video.addEventListener("play",()=>{this._startTimeline(),this.set$({currentTimelineIcon:"pause"})}),this.ref.video.addEventListener("pause",()=>{this.set$({currentTimelineIcon:"play"}),this._stopTimeline()})}catch(i){console.error("Failed to preview video",i)}},"_previewVideo"));d(this,"_retake",n(()=>{this._setCameraState(se.RETAKE),this._activeTab===I.VIDEO&&(this.$.video=this._stream,this.ref.video.muted=!0),this.ref.video.play()},"_retake"));d(this,"_accept",n(()=>{var o,a,l;if(this._setCameraState(se.ACCEPT),this._activeTab===I.PHOTO){(o=this._canvas)==null||o.toBlob(c=>{let u=this._createFile("camera","jpeg",Ca,c);this._toSend(u)},Ca);return}let e=new Blob(this._chunks,{type:(a=this._mediaRecorder)==null?void 0:a.mimeType}),i=this._guessExtensionByMime((l=this._mediaRecorder)==null?void 0:l.mimeType),s=this._createFile("video",i,`video/${i}`,e);this._toSend(s),this._chunks=[]},"_accept"));d(this,"_handlePhoto",n(e=>{e===se.SHOT&&this.set$({tabVideoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,cameraActionsHidden:!1,cameraSelectHidden:!0}),(e===se.RETAKE||e===se.ACCEPT)&&this.set$({tabVideoHidden:!this._cameraModes.includes(I.VIDEO),tabCameraHidden:!this._cameraModes.includes(I.PHOTO),cameraHidden:!1,cameraActionsHidden:!0,cameraSelectHidden:this._cameraDevices.length<=1})},"_handlePhoto"));d(this,"_handleVideo",n(e=>{e===se.PLAY&&this.set$({timerHidden:!1,tabCameraHidden:!0,cameraSelectHidden:!0,audioSelectHidden:!0,currentTimelineIcon:"pause",currentIcon:"square",mutableClassButton:"uc-shot-btn uc-camera-action uc-stop-record"}),e===se.STOP&&this.set$({timerHidden:!1,cameraHidden:!0,audioToggleMicrophoneHidden:!0,cameraActionsHidden:!1}),(e===se.RETAKE||e===se.ACCEPT)&&this.set$({timerHidden:!0,tabVideoHidden:!this._cameraModes.includes(I.VIDEO),tabCameraHidden:!this._cameraModes.includes(I.PHOTO),cameraHidden:!1,cameraActionsHidden:!0,audioToggleMicrophoneHidden:!this.cfg.enableAudioRecording,currentIcon:"video-camera-full",mutableClassButton:"uc-shot-btn uc-camera-action",audioSelectHidden:!this.cfg.enableAudioRecording||this._audioDevices.length<=1,cameraSelectHidden:this._cameraDevices.length<=1})},"_handleVideo"));d(this,"_setCameraState",n(e=>{this._activeTab===I.PHOTO&&(e==="shot"||e==="retake"||e==="accept")&&this._handlePhoto(e),this._activeTab===I.VIDEO&&(e==="play"||e==="stop"||e==="retake"||e==="accept"||e==="pause"||e==="resume")&&this._handleVideo(e)},"_setCameraState"));d(this,"_handleActiveTab",n(e=>{this.ref.switcher.querySelectorAll("button").forEach(i=>{i.classList.toggle("uc-active",i.getAttribute("data-id")===e)}),e===I.PHOTO&&this.set$({currentIcon:"camera-full",audioSelectHidden:!0,audioToggleMicrophoneHidden:!0}),e===I.VIDEO&&this.set$({currentTimelineIcon:"play",currentIcon:"video-camera-full",audioSelectHidden:!this.cfg.enableAudioRecording||this._audioDevices.length<=1,audioToggleMicrophoneHidden:!this.cfg.enableAudioRecording}),this._activeTab=e},"_handleActiveTab"));d(this,"_createFile",n((e,i,s,o)=>{let a=Date.now(),l=`${e}-${a}.${i}`;return new File([o],l,{lastModified:a,type:s})},"_createFile"));d(this,"_toSend",n(e=>{this.api.addFileFromObject(e,{source:L.CAMERA}),this.set$({"*currentActivity":b.activities.UPLOAD_LIST}),this.modalManager.open(b.activities.UPLOAD_LIST)},"_toSend"));d(this,"_setPermissionsState",M(e=>{this.classList.toggle("uc-initialized",e==="granted");let i=this._activeTab===I.VIDEO&&this.cfg.enableAudioRecording,s=this._activeTab===I.PHOTO?"camera-full":"video-camera-full";e==="granted"?this.set$({videoHidden:!1,cameraHidden:!1,tabCameraHidden:!this._cameraModes.includes(I.PHOTO),tabVideoHidden:!this._cameraModes.includes(I.VIDEO),messageHidden:!0,timerHidden:!0,currentIcon:s,audioToggleMicrophoneHidden:!i,audioSelectHidden:!i}):e==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,messageHidden:!1,tabCameraHidden:!this._cameraModes.includes(I.PHOTO),tabVideoHidden:!this._cameraModes.includes(I.VIDEO),cameraActionsHidden:!0,mutableClassButton:"uc-shot-btn uc-camera-action"}),this._stopCapture())},300));d(this,"_makeStreamInactive",n(()=>{var s,o;if(!this._stream)return!1;let e=(s=this._stream)==null?void 0:s.getAudioTracks(),i=(o=this._stream)==null?void 0:o.getVideoTracks();e.forEach(a=>a.stop()),i.forEach(a=>a.stop())},"_makeStreamInactive"));d(this,"_stopCapture",n(()=>{var e;this._capturing&&(this.ref.video.volume=0,(e=this.$.video)==null||e.getTracks()[0].stop(),this.$.video=null,this._makeStreamInactive(),this._stopTimer(),this._capturing=!1)},"_stopCapture"));d(this,"_capture",n(async()=>{let e={video:ku,audio:this.cfg.enableAudioRecording?{}:!1};this._selectedCameraId&&(e.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(e.audio={deviceId:{exact:this._selectedAudioId}}),this.ref.video.volume=0;try{this._setPermissionsState("prompt"),this._stream=await navigator.mediaDevices.getUserMedia(e),this._stream.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=this._stream,this._capturing=!0,this._setPermissionsState("granted")}catch(i){this._setPermissionsState("denied"),console.log("Failed to capture camera",i)}},"_capture"));d(this,"_handlePermissionsChange",n(()=>{this._capture()},"_handlePermissionsChange"));d(this,"_permissionAccess",n(async()=>{try{for(let e of wa)this[`${e}Response`]=await navigator.permissions.query({name:e}),this[`${e}Response`].addEventListener("change",this._handlePermissionsChange)}catch(e){console.log("Failed to use permissions API. Fallback to manual request mode.",e),this._capture()}},"_permissionAccess"));d(this,"_getPermission",n(()=>{},"_getPermission"));d(this,"_requestDeviceAccess",n(async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener("devicechange",this._getDevices)}catch(e){console.log("Failed to get user media",e)}},"_requestDeviceAccess"));d(this,"_getDevices",n(async()=>{var e,i;try{let s=await navigator.mediaDevices.enumerateDevices();this._cameraDevices=s.filter(o=>o.kind==="videoinput").map((o,a)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${a+1}`,value:o.deviceId})),this._audioDevices=this.cfg.enableAudioRecording&&s.filter(o=>o.kind==="audioinput").map(o=>({text:o.label.trim(),value:o.deviceId})),this._cameraDevices.length>1&&this.set$({cameraSelectOptions:this._cameraDevices,cameraSelectHidden:!1}),this._selectedCameraId=(e=this._cameraDevices[0])==null?void 0:e.value,this._audioDevices.length>1&&this.set$({audioSelectOptions:this._audioDevices,audioSelectHidden:!1}),this._selectedAudioId=(i=this._audioDevices[0])==null?void 0:i.value}catch(s){console.log("Failed to get devices",s)}},"_getDevices"));d(this,"_onActivate",n(async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture(),this._handleCameraModes(this._cameraModes)},"_onActivate"));d(this,"_onDeactivate",n(async()=>{this._unsubPermissions&&this._unsubPermissions(),!!window.chrome||this._setPermissionsState("denied"),this._stopCapture()},"_onDeactivate"));d(this,"_handleCameraModes",n(e=>{this.$.tabVideoHidden=!e.includes(I.VIDEO),this.$.tabCameraHidden=!e.includes(I.PHOTO);let i=e[0];(!this._activeTab||!e.includes(this._activeTab))&&this._handleActiveTab(i)},"_handleCameraModes"));this.init$={...this.init$,video:null,videoTransformCss:null,videoHidden:!0,messageHidden:!0,requestBtnHidden:ya(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",switcher:null,panels:null,timer:null,timerHidden:!0,cameraHidden:!0,cameraActionsHidden:!0,audioSelectOptions:null,audioSelectHidden:!0,audioSelectDisabled:!0,audioToggleMicrophoneHidden:!0,tabCameraHidden:!0,tabVideoHidden:!0,currentIcon:"camera-full",currentTimelineIcon:"play",toggleMicrophoneIcon:"microphone",_startTime:0,_elapsedTime:0,_animationFrameId:null,mutableClassButton:"uc-shot-btn uc-camera-action",onCameraSelectChange:n(e=>{this._selectedCameraId=e.target.value,this._capture()},"onCameraSelectChange"),onAudioSelectChange:n(e=>{this._selectedAudioId=e.target.value,this._capture()},"onAudioSelectChange"),onCancel:n(()=>{this.historyBack()},"onCancel"),onShot:n(()=>this._shot(),"onShot"),onRequestPermissions:n(()=>this._capture(),"onRequestPermissions"),onStartCamera:n(()=>this._chooseActionWithCamera(),"onStartCamera"),onStartRecording:n(()=>this._startRecording(),"onStartRecording"),onStopRecording:n(()=>this._stopRecording(),"onStopRecording"),onToggleRecording:n(()=>this._toggleRecording(),"onToggleRecording"),onToggleAudio:n(()=>this._toggleEnableAudio(),"onToggleAudio"),onRetake:n(()=>this._retake(),"onRetake"),onAccept:n(()=>this._accept(),"onAccept"),onClickTab:n(e=>{let i=e.currentTarget.getAttribute("data-id");i&&this._handleActiveTab(i)},"onClickTab")}}_shot(){if(this._setCameraState("shot"),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),!this._ctx)throw new Error("Failed to get canvas context");this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(this.ref.video,0,0),this.ref.video.pause()}_guessExtensionByMime(e){let i={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(e==="")return"webm";if(e&&(e=e.split("/"),(e==null?void 0:e[0])==="video")){e=e.slice(1).join("/");let s=e==null?void 0:e.split(";")[0];if(i[s])return i[s]}return"avi"}get _cameraModes(){return V(this.cfg.cameraModes)}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null}),this.subConfigValue("enableAudioRecording",e=>{this.$.audioToggleMicrophoneHidden=!e,this.$.audioSelectDisabled=!e}),this.subConfigValue("cameraModes",e=>{if(!this.isActivityActive)return;let i=Z(e);this._handleCameraModes(i)})}_destroy(){var e,i;for(let s of wa)(e=this[`${s}Response`])==null||e.removeEventListener("change",this._handlePermissionsChange);(i=navigator.mediaDevices)==null||i.removeEventListener("devicechange",this._getDevices)}async destroyCallback(){super.destroyCallback(),this._destroy()}};n(Yr,"CameraSource");var ei=Yr;ei.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"><uc-icon name="back"></uc-icon></button><div set="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" set="$.options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" set="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" set="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div></div><div class="uc-controls"><div ref="switcher" class="uc-switcher" set="@hidden:!timerHidden"><button data-id="photo" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabCameraHidden" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabVideoHidden" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" set="@hidden:timerHidden; onclick: onToggleRecording"><uc-icon set="@name: currentTimelineIcon"></uc-icon><span ref="timer"> 00:00 </span><span ref="line" class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" set="@hidden: cameraActionsHidden"><button type="button" class="uc-secondary-btn" set="onclick: onRetake">Retake</button><button type="button" class="uc-primary-btn" set="onclick: onAccept" data-testid="accept">Accept</button></div><button type="button" class="uc-shot-btn uc-camera-action" data-testid="shot" set="onclick: onStartCamera; @class: mutableClassButton; @hidden: cameraHidden;" ><uc-icon set="@name: currentIcon"></uc-icon></button><div class="uc-select"><button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicrophoneHidden;"><uc-icon set="@name:toggleMicrophoneIcon"></uc-icon></button><uc-select class="uc-audio-select" set="$.options: audioSelectOptions; onchange: onAudioSelectChange; @hidden: audioSelectHidden; @disabled: audioSelectDisabled" ></uc-select></div></div>`;var Jr=class Jr extends k{constructor(){super(...arguments);d(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};n(Jr,"UploadCtxProviderClass");var us=Jr;us.EventType=w;var Aa=us;var Qr=class Qr extends k{constructor(){super(...arguments);d(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let e=this.uploadCollection.items().some(i=>this.uploadCollection.read(i).getValue("isUploading"));this.$.visible=e}),this.sub("visible",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",e=>{this.$.value=e})}destroyCallback(){var e;super.destroyCallback(),(e=this._unobserveCollection)==null||e.call(this)}};n(Qr,"ProgressBarCommon");var ti=Qr;ti.template='<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>';var eo=class eo extends y{constructor(){super();d(this,"_value",0);d(this,"_prevValue",0);d(this,"_visible",!0);this.init$={...this.init$,width:0,opacity:0}}initCallback(){super.initCallback();let e=n(()=>{let i=this.ref.fakeProgressLine;if(!this._visible){i.classList.add("uc-fake-progress--hidden");return}this._value>0&&i.classList.add("uc-fake-progress--hidden")},"handleFakeProgressAnimation");this.ref.fakeProgressLine.addEventListener("animationiteration",e),this.defineAccessor("value",i=>{i!=null&&(this._prevValue=this._value,this._value=i,this._visible&&this.style.setProperty("--l-progress-value",this._value.toString()))}),this.defineAccessor("visible",i=>{this._visible=i,this.classList.toggle("uc-progress-bar--hidden",!i)})}};n(eo,"ProgressBar");var ii=eo;ii.template=`<div ref="fakeProgressLine" class="uc-fake-progress"></div><div ref="realProgressLine" class="uc-progress"></div>`;var pe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function xa(...r){return r.reduce((t,e)=>{if(typeof e=="string")return t[e]=!0,t;for(let i of Object.keys(e))t[i]=e[i];return t},{})}n(xa,"normalize");function z(...r){let t=xa(...r);return Object.keys(t).reduce((e,i)=>(t[i]&&e.push(i),e),[]).join(" ")}n(z,"classNames");function Ta(r,...t){let e=xa(...t);for(let i of Object.keys(e))r.classList.toggle(i,e[i])}n(Ta,"applyClassNames");var Sa=n(r=>{if(!r)return K;let t=Z(r).filter(e=>K.includes(e));return t.length===0?K:t},"parseTabs");function Ia(r){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":K,"*tabId":P.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:pe,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:ye(K),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":n(()=>{let t=r.querySelectorAll("img");for(let e of t){let i=e.src;e.src=pe,e.src=i}r.$["*networkProblems"]=!1},"*on.retryNetwork"),"*on.apply":n(t=>{if(!t)return;let e=r.$["*originalUrl"],i=B($e(t),"preview"),s=F(e,i),o={originalUrl:e,cdnUrlModifiers:i,cdnUrl:s,transformations:t};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),r.remove()},"*on.apply"),"*on.cancel":n(()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},"*on.cancel")}}n(Ia,"initState");var Oa="<svg width='0' height='0' style='position:absolute'><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='puc-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(#puc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-icon-id__h)'/><defs><linearGradient id='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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='suc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var $a=`${Oa} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${pe}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var ds=class ds extends y{constructor(){super();d(this,"ctxOwner",!0);d(this,"_debouncedShowLoader",M(this._showLoader.bind(this),300));this.init$={...this.init$,...Ia(this)}}_showLoader(e){this.$.showLoader=e}_waitForSize(){return new Promise((i,s)=>{let o=setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),a=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(i(),clearTimeout(o),a.disconnect())});a.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let e=Ci(this.$.cdnUrl),i=Oe(this.$.cdnUrl,e);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let s=Uo(this.$.cdnUrl),o=zo(s);this.$["*editorTransformations"]=o}else if(this.$.uuid){let e=Oe(this.cfg.cdnCname,this.$.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===P.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let e=await this.proxyUrl(F(this.$["*originalUrl"],B("json"))),i=await fetch(e).then(a=>a.json()),{width:s,height:o}=i;this.$["*imageSize"]={width:s,height:o},this.$["*tabId"]===P.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(e){e&&console.error("Failed to load image info",e)}}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==pe&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",e=>{let i=this.ref["img-el"];i.src!==e&&(this._imgLoading=!0,i.src=e||pe)}),this.sub("cropPreset",e=>{this.$["*cropPresetList"]=ji(e)}),this.sub("tabs",e=>{this.$["*tabList"]=Sa(e)}),this.sub("*tabId",e=>{this.ref["img-el"].className=z("uc-image",{"uc-image_hidden_to_cropper":e===P.CROP,"uc-image_hidden_effects":e!==P.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{this.$["presence.networkProblems"]=e,this.$["presence.modalCaption"]=!e}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let i=this.$["*originalUrl"],s=B($e(e),"preview"),o=F(i,s),a={originalUrl:i,cdnUrlModifiers:s,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:a,bubbles:!0,composed:!0}))},!1),this.sub("uuid",e=>e&&this.updateImage()),this.sub("cdnUrl",e=>e&&this.updateImage())}};n(ds,"CloudImageEditorBlock"),d(ds,"styleAttrs",["uc-cloud-image-editor"]);var fe=ds;fe.template=$a;fe.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var to=class to extends y{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(t){let e=this.$["*imageBox"];if(!e)return;if(t===""&&e.height<=x&&e.width<=x)return!0;let i=e.height<=x&&(t.includes("n")||t.includes("s")),s=e.width<=x&&(t.includes("e")||t.includes("w"));return i||s}_createBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:s,height:o}=t,a=this.ref["svg-el"],l=ee("mask",{id:"backdrop-mask"}),c=ee("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=ee("rect",{x:e,y:i,width:s,height:o,fill:"black"});l.appendChild(c),l.appendChild(u);let p=ee("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});a.appendChild(p),a.appendChild(l),this._backdropMask=l,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:s,height:o}=t;this._backdropMaskInner&&Pe(this._backdropMaskInner,{x:e,y:i,width:s,height:o})}_updateFrame(){let t=this.$["*cropBox"];if(!(!t||!this._frameGuides||!this._frameThumbs)){for(let e of Object.values(this._frameThumbs)){let{direction:i,pathNode:s,interactionNode:o,groupNode:a}=e,l=i==="",c=i.length===2,{x:u,y:p,width:h,height:f}=t;if(l)Pe(o,{x:u,y:p,width:h,height:f});else{let g=Ue(Math.min(h,f)/(24*2+34)/2,0,1),{d:_,center:E}=c?En(t,i,g):An(t,i,g),A=Math.max(hr*Ue(Math.min(h,f)/hr/3,0,1),Cn);Pe(o,{x:E[0]-A,y:E[1]-A,width:A*2,height:A*2}),Pe(s,{d:_})}let m=this._shouldThumbBeDisabled(i);a.setAttribute("class",z("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}))}Pe(this._frameGuides,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1})}}_createThumb(t,e){let i=ee("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let s=ee("rect",{fill:"transparent"}),o=ee("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(o),i.appendChild(s),t[e]={direction:e,pathNode:o,interactionNode:s,groupNode:i},e===""&&(i.style.cursor="move"),s.addEventListener("pointerdown",this._handlePointerDown.bind(this,e))}_createThumbs(){let t={};for(let e=0;e<3;e++)for(let i=0;i<3;i++){let s=`${["n","","s"][e]}${["w","","e"][i]}`;s!==""&&this._createThumb(t,s)}return this._createThumb(t,""),t}_createGuides(){let t=ee("svg"),e=ee("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let i=1;i<=2;i++){let s=ee("line",{x1:`${Ht*i}%`,y1:"0%",x2:`${Ht*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s)}for(let i=1;i<=2;i++){let s=ee("line",{x1:"0%",y1:`${Ht*i}%`,x2:"100%",y2:`${Ht*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s)}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}_createFrame(){let t=this.ref["svg-el"],e=document.createDocumentFragment(),i=this._createGuides();e.appendChild(i);let s=this._createThumbs();for(let{groupNode:o}of Object.values(s))e.appendChild(o);t.appendChild(e),this._frameThumbs=s,this._frameGuides=i}_handlePointerDown(t,e){if(!this._frameThumbs)return;let i=this._frameThumbs[t];if(this._shouldThumbBeDisabled(t))return;let s=this.$["*cropBox"],{x:o,y:a}=this.ref["svg-el"].getBoundingClientRect(),l=e.x-o,c=e.y-a;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[l,c],this._dragStartCrop={...s}}_handlePointerUp_(t){this._updateCursor(),this.$.dragging&&(t.stopPropagation(),t.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(t){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;t.stopPropagation(),t.preventDefault();let e=this.ref["svg-el"],{x:i,y:s}=e.getBoundingClientRect(),o=t.x-i,a=t.y-s,l=o-this._dragStartPoint[0],c=a-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[l,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(t,e){var u,p;let[i,s]=e,o=this.$["*imageBox"],a=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],l=(p=this.$["*cropPresetList"])==null?void 0:p[0],c=l?l.width/l.height:void 0;if(t===""?a=Tn({rect:a,delta:[i,s],imageBox:o}):a=Sn({rect:a,delta:[i,s],direction:t,aspectRatio:c,imageBox:o}),!Object.values(a).every(h=>Number.isFinite(h)&&h>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return ot(at(a),this.$["*imageBox"])}_handleSvgPointerMove_(t){if(!this._frameThumbs)return;let e=Object.values(this._frameThumbs).find(i=>{if(this._shouldThumbBeDisabled(i.direction))return!1;let o=i.interactionNode.getBoundingClientRect(),a={x:o.x,y:o.y,width:o.width,height:o.height};return In(a,[t.x,t.y])});this._hoverThumb=e,this._updateCursor()}_updateCursor(){let t=this._hoverThumb;this.ref["svg-el"].style.cursor=t?xn(t.direction):"initial"}_createMask(t){if(this._frameImage){this._frameImage.setAttribute("href",t);return}let e=this.ref["svg-el"],i=document.createDocumentFragment(),s=ee("image",{href:t});s.setAttribute("class","uc-cloud-mask"),i.appendChild(s),e.appendChild(i),this._frameImage=s}_updateMask(){let t=this.$["*cropBox"];if(!t||!this._frameImage)return;let{x:e,y:i,width:s,height:o}=t;Pe(this._frameImage,{x:e,y:i,height:o,width:s})}_render(){this._updateBackdrop(),this._updateFrame(),this._updateMask()}toggleThumbs(t){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:e})=>e).forEach(e=>{e.setAttribute("class",z("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",t=>{t&&(this._guidesHidden=t.height<=x||t.width<=x,window.requestAnimationFrame(()=>{this._render()}))}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this._createMask(t)}),this.sub("dragging",t=>{this._frameGuides&&this._frameGuides.setAttribute("class",z({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&t,"uc-guides--semi-hidden":!this._guidesHidden&&!t}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};n(to,"CropFrame");var si=to;si.template='<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>';var io=class io extends y{constructor(){super(...arguments);d(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null,"title-prop":""})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",e=>{this._titleEl&&(this._titleEl.style.display=e?"block":"none")}),this.sub("active",e=>{this.className=z({"uc-active":e,"uc-not_active":!e})}),this.sub("on.click",e=>{this.onclick=e})}};n(io,"EditorButtonControl");var Se=io;Se.template=`<button role="option" type="button" set="@aria-label:title-prop;" l10n="@title:title-prop;"><uc-icon set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Lu(r){let t=r+90;return t=t>=360?0:t,t}n(Lu,"nextAngle");function Pu(r,t){return r==="rotate"?Lu(t):["mirror","flip"].includes(r)?!t:null}n(Pu,"nextValue");var so=class so extends Se{initCallback(){super.initCallback(),this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(t).toLowerCase()})))}),this.$["on.click"]=t=>{let e=this.$["*cropperEl"].getValue(this._operation),i=Pu(this._operation,e);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this._operation,next:i,prev:e}),this.$["*cropperEl"].setValue(this._operation,i)}}};n(so,"EditorCropButtonControl");var Ct=so;var ri={FILTER:"filter",COLOR_OPERATION:"color_operation"},me="original",ro=class ro extends y{constructor(){super(...arguments);d(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":n(e=>{this.$["*faderEl"].set(e),this.$.value=e},"on.input")})}setOperation(e,i){this._controlType=e==="filter"?ri.FILTER:ri.COLOR_OPERATION,this._operation=e,this._iconName=e,this._title=e.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===me?void 0:this.$.value,filter:this._filter===me?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:e,zero:i}=le[this._operation],[s,o]=e;this.$.min=s,this.$.max=o,this.$.zero=i;let a=this.$["*editorTransformations"][this._operation];if(this._controlType===ri.FILTER){let l=o;if(a){let{name:c,amount:u}=a;l=c===this._filter?u:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===ri.COLOR_OPERATION){let l=typeof a!="undefined"?a:i;this.$.value=l,this.$.defaultValue=l}}apply(){let e;this._controlType===ri.FILTER?this._filter===me?e=null:e={name:this._filter,amount:this.$.value}:e=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:e};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{this._originalUrl=e}),this.sub("value",e=>{let i=`${this._filter||this._operation} ${e}`;this.$["*operationTooltip"]=i})}};n(ro,"EditorSlider");var oi=ro;oi.template=`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function Ge(r){let t=new Image;return{promise:new Promise((s,o)=>{t.src=r,t.onload=s,t.onerror=o}),image:t,cancel:n(()=>{t.naturalWidth===0&&(t.src=pe)},"cancel")}}n(Ge,"preloadImage");function ni(r){let t=[];for(let o of r){let a=Ge(o);t.push(a)}let e=t.map(o=>o.image);return{promise:Promise.allSettled(t.map(o=>o.promise)),images:e,cancel:n(()=>{t.forEach(o=>{o.cancel()})},"cancel")}}n(ni,"batchPreloadImages");function Et(r){let t=r.match(/^(\w+)\s+(\d+)$/);return t?{filter:t[1],value:Number(t[2])}:null}n(Et,"parseFilterValue");var oo=class oo extends Se{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null}}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,i=Math.ceil(e*t),s=e>=2?"lightest":"normal",o=100,a={...this.$["*editorTransformations"]};return a[this._operation]=this._filter!==me?{name:this._filter,amount:o}:void 0,F(this._originalUrl,B(Ei,$e(a),`quality/${s}`,`scale_crop/${i}x${i}/center`))}async _observerCallback(t,e){var s;if(t[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),a=this.ref["preview-el"],{promise:l,cancel:c}=Ge(o);this._cancelPreload=c,l.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{a.style.backgroundImage=`url(${o})`,a.setAttribute("loaded",""),e.unobserve(this)})}else(s=this._cancelPreload)==null||s.call(this)}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:Et(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===me,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()}))}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let i=this.ref["icon-el"];i.style.opacity=e?"1":"0";let s=this.ref["preview-el"];e?s.style.opacity="0":s.style.backgroundImage&&(s.style.opacity="1")}),this.sub("*networkProblems",async e=>{if(!e){let i=await this.proxyUrl(this._previewSrc()),s=this.ref["preview-el"];s.style.backgroundImage&&(s.style.backgroundImage="none",s.style.backgroundImage=`url(${i})`)}})}destroyCallback(){var t,e;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),(e=this._cancelPreload)==null||e.call(this)}};n(oo,"EditorFilterControl");var We=oo;We.template=`<button type="button" role="option" l10n="@title:title-prop;@aria-label:title-prop"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var no=class no extends Se{constructor(){super(...arguments);d(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation,this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:Et(this.$["*operationTooltip"])})},this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()})),this.bindL10n("title",()=>this.l10n(e)))}),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:i}=le[this._operation],s=e[this._operation],o=typeof s!="undefined"?s!==i:!1;this.$.active=o})}};n(no,"EditorOperationControl");var At=no;function ka(r,t){let e={};for(let i of t){let s=r[i];(r.hasOwnProperty(i)||s!==void 0)&&(e[i]=s)}return e}n(ka,"pick");function xt(r,t,e){let s=window.devicePixelRatio,o=Math.min(Math.ceil(t*s),3e3),a=s>=2?"lightest":"normal";return F(r,B(Ei,$e(e),`quality/${a}`,`stretch/off/-/resize/${o}x`,`@clib/${xe}/${Te}/uc-cloud-image-editor/`))}n(xt,"viewerImageSrc");function Uu(r){return r?[({dimensions:e,coords:i})=>[...e,...i].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:e,coords:i})=>e.every(s=>s>0)&&i.every(s=>s>=0)].every(e=>e(r)):!0}n(Uu,"validateCrop");var ao=class ao extends y{constructor(){super();d(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=M(this._commit.bind(this),300),this._handleResizeThrottled=_t(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let e=this.$["*editorTransformations"],i=ka(e,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...i};this.$["*operations"]=s}_initCanvas(){let e=this.ref["canvas-el"],i=e.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,a=window.devicePixelRatio;e.style.width=`${s}px`,e.style.height=`${o}px`,e.width=s*a,e.height=o*a,i==null||i.scale(a,a),this._canvas=e,this._ctx=i}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,i=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,a={width:this.offsetWidth,height:this.offsetHeight},l=nt({width:e.naturalWidth,height:e.naturalHeight},o),c;if(l.width>a.width-i*2||l.height>a.height-i*2){let u=l.width/l.height,p=a.width/a.height;if(u>p){let h=a.width-i*2,f=h/u,m=0+i,g=i+(a.height-i*2)/2-f/2;c={x:m,y:g,width:h,height:f}}else{let h=a.height-i*2,f=h*u,m=i+(a.width-i*2)/2-f/2,g=0+i;c={x:m,y:g,width:f,height:h}}}else{let{width:u,height:p}=l,h=i+(a.width-i*2)/2-u/2,f=i+(a.height-i*2)/2-p/2;c={x:h,y:f,width:u,height:p}}this.$["*imageBox"]=at(c)}_alignCrop(){var f;let e=this.$["*cropBox"],i=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,a=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=this.$["*imageBox"];if(a){let{dimensions:[m,g],coords:[_,E]}=a,{width:A}=nt(this._imageSize,o),v=l/A;e=ot(at({x:c+_*v,y:u+E*v,width:m*v,height:g*v}),this.$["*imageBox"])}let p=(f=this.$["*cropPresetList"])==null?void 0:f[0],h=p?p.width/p.height:void 0;if(!On(e,i)||h&&!$n(e,h)){let m=i.width/i.height,g=i.width,_=i.height;h&&(m>h?g=Math.min(i.height*h,i.width):_=Math.min(i.width/h,i.height)),e={x:i.x+i.width/2-g/2,y:i.y+i.height/2-_/2,width:g,height:_}}this.$["*cropBox"]=ot(at(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let i=this.$.image,s=this.$["*imageBox"],o=this.$["*operations"],{mirror:a,flip:l,rotate:c}=o,u=nt({width:s.width,height:s.height},c);e.save(),e.translate(s.x+s.width/2,s.y+s.height/2),e.rotate(c*Math.PI*-1/180),e.scale(a?-1:1,l?-1:1),e.drawImage(i,-u.width/2,-u.height/2,u.width,u.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=z({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],i=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:a,height:l}=i,{width:c,height:u}=nt(this._imageSize,o),{width:p,height:h}=e,f=a/c,m=l/u;return[Ue(Math.round(p/f),1,c),Ue(Math.round(h/m),1,u)]}_getCropTransformation(){let e=this.$["*cropBox"],i=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:a,height:l,x:c,y:u}=i,{width:p,height:h}=nt(this._imageSize,o),{x:f,y:m}=e,g=a/p,_=l/h,E=this._getCropDimensions(),A={dimensions:E,coords:[Ue(Math.round((f-c)/g),0,p-E[0]),Ue(Math.round((m-u)/_),0,h-E[1])]};if(!Uu(A)){console.error("Cropper is trying to create invalid crop object",{payload:A});return}if(!(E[0]===p&&E[1]===h))return A}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:i,mirror:s,flip:o}=e,a=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:a,rotate:i,mirror:s,flip:o};this.$["*editorTransformations"]=c}setValue(e,i){this.$["*operations"]={...this.$["*operations"],[e]:i},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:i}={}){if(!this._isActive){this._isActive=!0,this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:i})}catch(s){console.error("Failed to activate cropper",{error:s})}this._observer=new ResizeObserver(([s])=>{s.contentRect.width>0&&s.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:e=!1}={}){var i;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=z({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(i=this._observer)==null||i.disconnect())}_transitionToCrop(){let e=this._getCropDimensions(),i=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,s=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,o=Math.min(i,s),a=this.$["*cropBox"].x+this.$["*cropBox"].width/2,l=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-a)/o}px, ${(this.offsetHeight/2-l)/o}px)`,this.style.transformOrigin=`${a}px ${l}px`}_transitionToImage(){let e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,i=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${i}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(e,i){var p;let s=this.offsetWidth;i={...i,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(xt(e,s,i)),{promise:a,cancel:l,image:c}=Ge(o),u=this._handleImageLoading(o);return c.addEventListener("load",u,{once:!0}),c.addEventListener("error",u,{once:!0}),(p=this._cancelPreload)==null||p.call(this),this._cancelPreload=l,a.then(()=>c).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(e){let i="crop",s=this.$["*loadingOperations"];return s.get(i)||s.set(i,new Map),s.get(i).get(e)||(s.set(i,s.get(i).set(e,!0)),this.$["*loadingOperations"]=s),()=>{var o;(o=s==null?void 0:s.get(i))!=null&&o.has(e)&&(s.get(i).delete(e),this.$["*loadingOperations"]=s)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};n(ao,"EditorImageCropper");var ai=ao;ai.template=`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function lo(r,t,e){let i=Array(e);e--;for(let s=e;s>=0;s--)i[s]=Math.ceil((s*t+(e-s)*r)/e);return i}n(lo,"linspace");function Ru(r){return r.reduce((t,e,i)=>i<r.length-1?[...t,[e,r[i+1]]]:t,[])}n(Ru,"splitBySections");function Du(r,t,e){let i=Ru(r).find(([s,o])=>s<=t&&t<=o);return r.map(s=>{let o=Math.abs(i[0]-i[1]),a=Math.abs(t-i[0])/o;return i[0]===s?t>e?1:1-a:i[1]===s?t>=e?a:1:0})}n(Du,"calculateOpacities");function Fu(r,t){return r.map((e,i)=>e<t?r.length-i:i)}n(Fu,"calculateZIndices");function Ma(r,t){let e=le[r].keypointsNumber,{range:i,zero:s}=le[r];return[...new Set([...lo(i[0],s,e+1),...lo(s,i[1],e+1),s,t])].sort((o,a)=>o-a)}n(Ma,"keypointsRange");var co=class co extends y{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=M(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(t){let e=this._operation,i=this.$["*loadingOperations"];return i.get(e)||i.set(e,new Map),i.get(e).get(t)||(i.set(e,i.get(e).set(t,!0)),this.$["*loadingOperations"]=i),()=>{var s;(s=i==null?void 0:i.get(e))!=null&&s.has(t)&&(i.get(e).delete(t),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let t of this._keypoints){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString())}})}async _imageSrc({url:t=this._url,filter:e=this._filter,operation:i,value:s}={}){let o={...this._transformations};i&&(o[i]=e?{name:e,amount:s}:s);let a=this.offsetWidth;return await this.proxyUrl(xt(t,a,o))}async _constructKeypoint(t,e){return{src:await this._imageSrc({operation:t,value:e}),image:null,opacity:0,zIndex:0,value:e}}_isSame(t,e){return this._operation===t&&this._filter===e}async _addKeypoint(t,e,i){let s=n(()=>!this._isSame(t,e)||this._value!==i||!!this._keypoints.find(c=>c.value===i),"shouldSkip");if(s())return;let o=await this._constructKeypoint(t,i),a=new Image;a.src=o.src;let l=this._handleImageLoading(o.src);a.addEventListener("load",l,{once:!0}),a.addEventListener("error",l,{once:!0}),o.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this._keypoints,u=c.findIndex(h=>h.value>i),p=u<c.length?c[u].image:null;!this._container||p&&!this._container.contains(p)||(c.splice(u,0,o),this._container.insertBefore(a,p),this._update(t,i))},{once:!0}),a.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(t){t=typeof t=="string"?parseInt(t,10):t,this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t)}_update(t,e){this._operation=t,this._value=e;let{zero:i}=le[t],s=this._keypoints.map(l=>l.value),o=Du(s,e,i),a=Fu(s,i);for(let[l,c]of Object.entries(this._keypoints))c.opacity=o[l],c.zIndex=a[l];this._flush()}_createPreviewImage(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async _initNodes(){let t=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&t.appendChild(this._previewImage);let e=document.createElement("div");t.appendChild(e);let i=this._keypoints.map(u=>u.src),{images:s,promise:o,cancel:a}=ni(i);s.forEach(u=>{let p=this._handleImageLoading(u.src);u.addEventListener("load",p),u.addEventListener("error",p)}),this._cancelLastImages=()=>{a(),this._cancelLastImages=void 0};let l=this._operation,c=this._filter;await o,this._isActive&&this._isSame(l,c)&&(this._container&&this._container.remove(),this._container=e,this._keypoints.forEach((u,p)=>{let h=s[p];h.classList.add("uc-fader-image"),u.image=h,this._container.appendChild(h)}),this.appendChild(t),this._flush())}async setTransformations(t){if(this._transformations=t,this._previewImage){let e=await this._imageSrc(),i=this._handleImageLoading(e);this._previewImage.src=e,this._previewImage.addEventListener("load",i,{once:!0}),this._previewImage.addEventListener("error",i,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:t,filter:e,operation:i,value:s}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Ma(i,s),a=await Promise.all(o.map(c=>this._imageSrc({url:t,filter:e,operation:i,value:c}))),{cancel:l}=ni(a);this._cancelBatchPreload=l}_setOriginalSrc(t){let e=this._previewImage||this._createPreviewImage();if(!this.contains(e)&&this.appendChild(e),this._previewImage=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=z({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}e.style.opacity="0";let i=this._handleImageLoading(t);e.addEventListener("error",i,{once:!0}),e.src=t,e.addEventListener("load",()=>{i(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=z({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),e.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:t,operation:e,value:i,filter:s,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=t,this._operation=e||"initial",this._value=i,this._filter=s,this._fromViewer=o,typeof i!="number"&&!s){let l=await this._imageSrc({operation:e,value:i});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Ma(e,i).map(l=>this._constructKeypoint(e,l))),this._update(e,i),this._initNodes()}deactivate({hide:t=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),t&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=z({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};n(co,"EditorImageFader");var hs=co;var Nu=1,uo=class uo extends y{initCallback(){super.initCallback(),this.addEventListener("wheel",t=>{t.preventDefault();let{deltaY:e,deltaX:i}=t;Math.abs(i)>Nu?this.scrollLeft+=i:this.scrollLeft+=e},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};n(uo,"EditorScroller");var li=uo;li.template=" <slot></slot> ";function Vu(r){return`<uc-presence-toggle class="uc-tab-toggle" set="visible: presence.tabToggle.${r}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${r}" data-id="${r}" icon="${r}" set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${r}; title-prop: a11y-editor-tab-${r}" ></uc-btn-ui></uc-presence-toggle>`}n(Vu,"renderTabToggle");function zu(r){return`<uc-presence-toggle id="tab_${r}" class="uc-tab-content" set="visible: presence.tabContent.${r}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${r}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}n(zu,"renderTabContent");var ho=class ho extends y{constructor(){super();d(this,"_updateInfoTooltip",M(()=>{var a,l;let e=this.$["*editorTransformations"],i=this.$["*currentOperation"],s="",o=!1;if(this.$["*tabId"]===P.FILTERS)if(o=!0,this.$["*currentFilter"]&&((a=e==null?void 0:e.filter)==null?void 0:a.name)===this.$["*currentFilter"]){let c=((l=e==null?void 0:e.filter)==null?void 0:l.amount)||100;s=this.$["*currentFilter"]+" "+c}else s=this.l10n(me);else if(this.$["*tabId"]===P.TUNING&&i){o=!0;let c=(e==null?void 0:e[i])||le[i].zero;s=this.l10n(i)+" "+c}o&&(this.$["*operationTooltip"]=s),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":me,"*currentOperation":null,showLoader:!1,filters:Ho,colorOperations:Bo,cropOperations:jo,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":n(e=>{var i;this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel"}),(i=this._cancelPreload)==null||i.call(this),this.$["*on.cancel"]()},"on.cancel"),"on.apply":n(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply"}),this.$["*on.apply"](this.$["*editorTransformations"])},"on.apply"),"on.applySlider":n(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply-slider",operation:Et(this.$["*operationTooltip"])}),this.ref["slider-el"].apply(),this._onSliderClose()},"on.applySlider"),"on.cancelSlider":n(e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel-slider"}),this.ref["slider-el"].cancel(),this._onSliderClose()},"on.cancelSlider"),"on.clickTab":n(e=>{let i=e.currentTarget.getAttribute("data-id");i&&(this.telemetryManager.sendEventCloudImageEditor(e,i),this._activateTab(i,{fromViewer:!1}))},"on.clickTab"),tab_role:"tab",[`tab_${P.TUNING}`]:`tab_${P.TUNING}`,[`tab_${P.CROP}`]:`tab_${P.CROP}`,[`tab_${P.FILTERS}`]:`tab_${P.FILTERS}`,cancel:"cancel",apply:"apply","a11y-editor-tab-filters":"a11y-editor-tab-filters","a11y-editor-tab-tuning":"a11y-editor-tab-tuning","a11y-editor-tab-crop":"a11y-editor-tab-crop"},this._debouncedShowLoader=M(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===P.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(e){let i=new At;return i.operation=e,i}_createFilterControl(e){let i=new We;return i.filter=e,i}_createToggleControl(e){let i=new Ct;return i.operation=e,i}_renderControlsList(e){let i=this.ref[`controls-list-${e}`],s=document.createDocumentFragment();e===P.CROP?this.$.cropOperations.forEach(o=>{let a=this._createToggleControl(o);s.appendChild(a)}):e===P.FILTERS?[me,...this.$.filters].forEach(o=>{let a=this._createFilterControl(o);s.appendChild(a)}):e===P.TUNING&&this.$.colorOperations.forEach(o=>{let a=this._createOperationControl(o);s.appendChild(a)}),[...s.children].forEach((o,a)=>{a===s.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),i.innerHTML="",i.appendChild(s)}_activateTab(e,{fromViewer:i}){this.$["*tabId"]=e,e===P.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:i})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:i}),this.$["*cropperEl"].deactivate());for(let s of K){let o=s===e,a=this.ref[`tab-toggle-${s}`];a.active=o,o?(this._renderControlsList(e),this._syncTabIndicator()):this._unmountTabControls(s),this.$[`presence.tabContent.${s}`]=o}}_unmountTabControls(e){let i=this.ref[`controls-list-${e}`];i&&(i.innerHTML="")}_syncTabIndicator(){let e=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${e.offsetLeft}px)`}async _preloadEditedImage(){var e;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let i=this.$["*imgContainerEl"].offsetWidth,s=await this.proxyUrl(xt(this.$["*originalUrl"],i,this.$["*editorTransformations"]));(e=this._cancelPreload)==null||e.call(this);let{cancel:o}=ni([s]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(e){this.$.showLoader=e}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",e=>{e&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",e=>{var s;let i=(s=e==null?void 0:e.filter)==null?void 0:s.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",e=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(e)}),this.sub("*loadingOperations",e=>{let i=!1;for(let[,s]of e.entries()){if(i)break;for(let[,o]of s.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e}),this.sub("*tabList",e=>{this.$["presence.tabToggles"]=e.length>1;for(let i of K){this.$[`presence.tabToggle.${i}`]=e.includes(i);let s=this.ref[`tab-toggle-${i}`];s.style.gridColumn=e.indexOf(i)+1}e.includes(this.$["*tabId"])||this._activateTab(e[0],{fromViewer:!1})}),this._updateInfoTooltip()}destroyCallback(){this.$["*showSlider"]=!1}};n(ho,"EditorToolbar");var ci=ho;ci.template=`<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${K.map(zu).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${K.map(Vu).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop:apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" set="onclick: on.cancelSlider" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" set="onclick: on.applySlider" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var po=class po extends y{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":"","title-prop":""},this.defineAccessor("active",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return z("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",t=>{this._iconSingle=!this.$.text,this._iconHidden=!t,this.$.iconCss=this._iconCss()}),this.sub("theme",t=>{t!=="custom"&&(this.className=`uc-${t}`)}),this.sub("text",t=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",t=>{this.$["aria-role"]=t||""}),this.defineAccessor("aria-controls",t=>{this.$["aria-controls"]=t||""}),this.defineAccessor("title-prop",t=>{this.$["title-prop"]=t||""})}set reverse(t){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};n(po,"BtnUi");var Tt=po;Tt.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Tt.template=`<button type="button" set="@role:aria-role; @aria-controls: aria-controls; @aria-label:title-prop" l10n="@title:title-prop;" ><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var fo=class fo extends y{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let t=this.ref["line-el"];t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",t=>{typeof t=="boolean"&&(t?this._start():this._stop())})}_start(){this._active=!0;let{width:t}=this.getBoundingClientRect(),e=this.ref["line-el"];e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};n(fo,"LineLoaderUi");var ui=fo;ui.template=`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var ps={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},mo=class mo extends y{constructor(){super(),this._visible=!1,this._visibleStyle=ps.visible,this._hiddenStyle=ps.hidden,this._externalTransitions=!1,this.defineAccessor("styles",t=>{t&&(this._externalTransitions=!0,this._visibleStyle=t.visible,this._hiddenStyle=t.hidden)}),this.defineAccessor("visible",t=>{typeof t=="boolean"&&(this._visible=t,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",Ta(this,{[ps.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(ps.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};n(mo,"PresenceToggle");var di=mo;di.template="<slot></slot> ";var go=class go extends y{constructor(){super();d(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":n(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e),this.$.onInput&&this.$.onInput(e)},"on.sliderInput"),"on.sliderChange":n(()=>{let e=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(e)},"on.sliderChange")});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",i=>{this.$.disabled=i}),this.defineAccessor("min",i=>{this.$.min=i}),this.defineAccessor("max",i=>{this.$.max=i}),this.defineAccessor("defaultValue",i=>{this.$.defaultValue=i,this.ref["input-el"].value=i,this._updateValue(i)}),this.defineAccessor("zero",i=>{this._zero=i}),this.defineAccessor("onInput",i=>{i&&(this.$.onInput=i)}),this.defineAccessor("onChange",i=>{i&&(this.$.onChange=i)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)},0),this.sub("disabled",i=>{let s=this.ref["input-el"];i?s.setAttribute("disabled","disabled"):s.removeAttribute("disabled")});let e=this.ref["input-el"];e.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),e.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(e){this._updateZeroDot(e);let{width:i}=this.getBoundingClientRect(),a=100/(this.$.max-this.$.min)*(e-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${a}px)`})}_updateZeroDot(e){if(!this._zeroDotEl)return;e===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="1";let{width:i}=this.getBoundingClientRect(),a=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${a}px)`})}_updateSteps(){let i=this.ref["steps-el"],{width:s}=i.getBoundingClientRect(),o=Math.ceil(s/2),a=Math.ceil(o/15)-2;if(this._stepsCount===a)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let h=0;h<a;h++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let h=0;h<a;h++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this._zeroDotEl=p,i.innerHTML="",i.appendChild(l),this._stepsCount=a}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};n(go,"SliderUi");var hi=go;hi.template=`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var bo=class bo extends k{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.CLOUD_IMG_EDIT);d(this,"_entry");d(this,"_instance")}get activityParams(){let e=super.activityParams;if("internalId"in e)return e;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>this.mountEditor(),"onActivate"),onDeactivate:n(()=>this.unmountEditor(),"onDeactivate")}),this.subConfigValue("cropPreset",e=>{this._instance&&this._instance.getAttribute("crop-preset")!==e&&this._instance.setAttribute("crop-preset",e)}),this.subConfigValue("cloudImageEditorTabs",e=>{this._instance&&this._instance.getAttribute("tabs")!==e&&this._instance.setAttribute("tabs",e)})}handleApply(e){if(!this._entry)return;let i=e.detail;this._entry.setMultipleValues({cdnUrl:i.cdnUrl,cdnUrlModifiers:i.cdnUrlModifiers}),this.modalManager.close(b.activities.CLOUD_IMG_EDIT),this.historyBack()}handleCancel(){this.modalManager.close(b.activities.CLOUD_IMG_EDIT),this.historyBack()}mountEditor(){let{internalId:e}=this.activityParams,i=this.uploadCollection.read(e);if(!i)throw new Error(`Entry with internalId "${e}" not found`);this._entry=i;let s=this._entry.getValue("cdnUrl");if(!s)throw new Error(`Entry with internalId "${e}" hasn't uploaded yet`);let o=new fe,a=this.cfg.cropPreset,l=this.cfg.cloudImageEditorTabs;o.setAttribute("ctx-name",this.ctxName),o.setAttribute("cdn-url",s),a&&o.setAttribute("crop-preset",a),l&&o.setAttribute("tabs",l),o.addEventListener("apply",c=>{let u=c;this.handleApply(u),this.debugPrint('editor event "apply"',u.detail)}),o.addEventListener("cancel",c=>{let u=c;this.handleCancel(),this.debugPrint('editor event "cancel"',u.detail)}),o.addEventListener("change",c=>{let u=c;this.debugPrint('editor event "change"',u.detail)}),this.innerHTML="",this.appendChild(o),this._instance=o}unmountEditor(){this._instance=void 0,this._entry=void 0,this.innerHTML=""}};n(bo,"CloudImageEditorActivity");var fs=bo;var Bu=n(function(r){return r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),La=n(function(r,t="i"){let e=r.split("*").map(Bu);return new RegExp("^"+e.join(".+")+"$",t)},"wildcardRegexp");function Hu(r,t){return window.getComputedStyle(r).getPropertyValue(t).trim()}n(Hu,"getCssValue");var ju=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"];function Pa(r){return ju.reduce((t,e)=>{let i=Hu(r,e);return i&&(t[e]=i),t},{})}n(Pa,"buildThemeDefinition");var Gu=["selected-files-change"],Wu=n(r=>!r||typeof r!="object"?!1:"type"in r&&Gu.includes(r.type),"isWhitelistedMessage"),_o=class _o{constructor(t){d(this,"_handlerMap",new Map);d(this,"_context");d(this,"_handleMessage",n(t=>{if(t.source!==this._context)return;let e=t.data;if(!Wu(e))return;let i=this._handlerMap.get(e.type);if(i)for(let s of i)s(e)},"_handleMessage"));this._context=t,window.addEventListener("message",this._handleMessage)}on(t,e){var s;let i=(s=this._handlerMap.get(t))!=null?s:new Set;this._handlerMap.has(t)||this._handlerMap.set(t,i),i.add(e)}send(t){this._context.postMessage(t,"*")}destroy(){window.removeEventListener("message",this._handleMessage)}};n(_o,"MessageBridge");var ms=_o;function Ua(r){let t=[];for(let[e,i]of Object.entries(r))i==null||typeof i=="string"&&i.length===0||t.push(`${e}=${encodeURIComponent(i)}`);return t.join("&")}n(Ua,"queryString");var vo=class vo extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.EXTERNAL);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],total:0,isSelectionReady:!1,isDoneBtnEnabled:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1,counterText:"",doneBtnTextClass:"uc-hidden",onDone:n(()=>{for(let e of this.$.selectedList){let i=this.extractUrlFromSelectedFile(e),{filename:s}=e,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(i,{fileName:s,source:o})}this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.modalManager.open(b.activities.UPLOAD_LIST)},"onDone"),onCancel:n(()=>{this.historyBack()},"onCancel"),onSelectAll:n(()=>{var e;(e=this._messageBridge)==null||e.send({type:"select-all"})},"onSelectAll"),onDeselectAll:n(()=>{var e;(e=this._messageBridge)==null||e.send({type:"deselect-all"})},"onDeselectAll")}}get activityParams(){let e=super.activityParams;if("externalSourceType"in e)return e;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>{let{externalSourceType:e}=this.activityParams;if(!e){this.modalManager.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${e==null?void 0:e[0].toUpperCase()}${e==null?void 0:e.slice(1)}`,activityIcon:e}),this.mountIframe()},"onActivate")}),this.sub("*currentActivityParams",e=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",e=>{e!==this.activityType&&this.unmountIframe()}),this.subConfigValue("multiple",e=>{this.$.showSelectionStatus=e}),this.subConfigValue("localeName",e=>{this.setupL10n()}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.applyEmbedCss(e)})}extractUrlFromSelectedFile(e){if(e.alternatives){let i=V(this.cfg.externalSourcesPreferredTypes);for(let s of i){let o=La(s);for(let[a,l]of Object.entries(e.alternatives))if(o.test(a))return l}}return e.url}async handleSelectedFilesChange(e){if(this.cfg.multiple!==e.isMultipleMode){console.error("Multiple mode mismatch");return}this.bindL10n("counterText",()=>this.l10n("selected-count",{count:e.selectedCount,total:e.total})),this.set$({doneBtnTextClass:e.isReady?"":"uc-hidden",isSelectionReady:e.isReady,isDoneBtnEnabled:e.isReady&&e.selectedFiles.length>0,showSelectionStatus:e.isMultipleMode&&e.total>0,couldSelectAll:e.selectedCount<e.total,couldDeselectAll:e.selectedCount===e.total,selectedList:e.selectedFiles})}handleIframeLoad(){this.applyEmbedCss(this.cfg.externalSourcesEmbedCss),this.applyTheme(),this.setupL10n()}applyTheme(){var e;(e=this._messageBridge)==null||e.send({type:"set-theme-definition",theme:Pa(this)})}applyEmbedCss(e){var i;(i=this._messageBridge)==null||i.send({type:"set-embed-css",css:e})}setupL10n(){var e;(e=this._messageBridge)==null||e.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName})}remoteUrl(){var p,h;let{pubkey:e,remoteTabSessionKey:i,socialBaseUrl:s,multiple:o}=this.cfg,{externalSourceType:a}=this.activityParams,c={lang:((h=(p=this.l10n("social-source-lang"))==null?void 0:p.split("-"))==null?void 0:h[0])||"en",public_key:e,images_only:"false",session_key:i,wait_for_theme:!0,multiple:o.toString()},u=new URL(`/window4/${a}`,s);return u.search=Ua(c),u.toString()}mountIframe(){var i;let e=Ss({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});e.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(e),e.contentWindow&&((i=this._messageBridge)==null||i.destroy(),this._messageBridge=new ms(e.contentWindow),this._messageBridge.on("selected-files-change",this.handleSelectedFilesChange.bind(this)),this.resetSelectionStatus())}unmountIframe(){var e;(e=this._messageBridge)==null||e.destroy(),this._messageBridge=void 0,this.ref.iframeWrapper.innerHTML="",this.resetSelectionStatus()}resetSelectionStatus(){this.set$({selectedList:[],total:0,isDoneBtnEnabled:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1})}};n(vo,"ExternalSource");var pi=vo;pi.template=`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button><div set="@hidden: !showSelectionStatus" class="uc-selection-status-box"><span>{{counterText}}</span><button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button><button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button></div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isDoneBtnEnabled;"><uc-spinner set="@hidden: isSelectionReady"></uc-spinner><span l10n="done" set="@class: doneBtnTextClass"></span></button></div></div>`;var yo=class yo extends k{constructor(){super(...arguments);d(this,"requireCtxName",!0)}_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this.ctxName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,Ut(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let l=(i=e.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let s=e.group?e.group:null;if(s){this._validationInputElement.value=s.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=e.allEntries.map(l=>l.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let a=new DocumentFragment;for(let l of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=l,a.appendChild(c)}this._dynamicInputsContainer.replaceChildren(a)}},!1)}};n(yo,"FormInput");var gs=yo;var wo=class wo extends b{};n(wo,"ActivityHeader");var bs=wo;var Co=class Co extends y{constructor(){super(...arguments);d(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:n(e=>{var i;e.preventDefault(),e.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((i=this.$.options.find(s=>s.value==this.value))==null?void 0:i.text)||"",this.dispatchEvent(new Event("change"))},"onSelect")})}initCallback(){super.initCallback(),this.sub("options",e=>{var s;this.$.currentText=((s=e==null?void 0:e[0])==null?void 0:s.text)||"";let i="";e==null||e.forEach(o=>{i+=`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=i})}};n(Co,"Select");var fi=Co;fi.template='<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>';var vs=class vs extends y{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",t=>{this.toggleAttribute("hidden",!!t)})}};n(vs,"Copyright"),d(vs,"template",`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var _s=vs;var Eo=class Eo extends _e{};n(Eo,"Spinner");var mi=Eo;mi.template='<div class="uc-spinner"></div>';function qu(r){let t=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(t)}n(qu,"createSvgBlobUrl");function ys(r="hsl(209, 21%, 65%)",t=32,e=32){return qu(`<svg width="${t}" height="${e}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}n(ys,"fileCssBg");function Ao(r,t=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let e=document.createElement("canvas"),i=e.getContext("2d"),s=new Image,o=new Promise((a,l)=>{s.onload=()=>{let c=s.height/s.width;c>1?(e.width=t,e.height=t*c):(e.height=t,e.width=t/c),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,e.width,e.height),i.drawImage(s,0,0,e.width,e.height),e.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);a(p)})},s.onerror=c=>{l(c)}});return s.src=URL.createObjectURL(r),o}n(Ao,"generateThumb");var Xu=3e3,xo=class xo extends vt{constructor(){super();d(this,"_renderedGridOnce",!1);d(this,"_thumbRect",null);d(this,"_isIntersecting",!1);d(this,"_firstViewMode",this.cfg.filesViewMode);d(this,"_generateThumbnail",this._withEntry(async(e,i=!1)=>{let s=e.getValue("fileInfo"),o=e.getValue("isImage"),a=e.getValue("uuid"),l=e.getValue("thumbUrl"),c=this._calculateThumbSize(i);if(s&&o&&a){let p=await this.proxyUrl(F(Oe(this.cfg.cdnCname,a),B(e.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:h}=Ge(p);h.then(()=>{e.setValue("thumbUrl",p),l!=null&&l.startsWith("blob:")&&URL.revokeObjectURL(l)}).catch(async()=>{if(!(l!=null&&l.startsWith("blob:")))try{let f=e.getValue("file");if(!f)return;let m=await Ao(f,c);e.setValue("thumbUrl",m)}catch{let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ys(m))}});return}if(e.getValue("thumbUrl"))return;let u=e.getValue("file");if(u!=null&&u.type.includes("image"))try{let p=await Ao(u,c);e.setValue("thumbUrl",p)}catch{let h=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ys(h))}else{let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",ys(p))}}));d(this,"_debouncedGenerateThumb",M(this._generateThumbnail.bind(this),100));this.init$={...this.init$,thumbUrl:"",badgeIcon:"",uid:""}}_calculateThumbSize(e=!1){var s,o;e&&(this._thumbRect=this.getBoundingClientRect());let i=Math.max(parseInt(String(((s=this==null?void 0:this._thumbRect)==null?void 0:s.height)||0)),parseInt(String(((o=this==null?void 0:this._thumbRect)==null?void 0:o.width)||0)),this.cfg.thumbSize);return window.devicePixelRatio>1&&(i*=window.devicePixelRatio),Math.min(i,Xu)}_observerCallback(e){var s;let[i]=e;this._isIntersecting=i.isIntersecting,i.isIntersecting&&(this._thumbRect=i.boundingClientRect,this._debouncedGenerateThumb(),(s=this._observer)==null||s.disconnect()),i.intersectionRatio===0&&this._debouncedGenerateThumb.cancel()}_reset(){super._reset(),this._debouncedGenerateThumb.cancel()}_handleEntryId(e){var s;this._reset();let i=(s=this.uploadCollection)==null?void 0:s.read(e);this._entry=i,i&&(this._subEntry("fileInfo",o=>{o!=null&&o.isImage&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.defineAccessor("badgeIcon",e=>this.$.badgeIcon=e),this.defineAccessor("uid",e=>{this.set$({uid:e})}),this.sub("uid",e=>{this._handleEntryId(e)}),this.subConfigValue("filesViewMode",e=>{e==="grid"&&!this._renderedGridOnce&&(this._firstViewMode==="list"&&this._debouncedGenerateThumb(!0),this._renderedGridOnce=!0)}),this.setAttribute("role","img")}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:.1}),this._observer.observe(this)}disconnectedCallback(){var e;super.disconnectedCallback(),this._entrySubs=new Set,this._debouncedGenerateThumb.cancel(),(e=this._observer)==null||e.disconnect()}};n(xo,"Thumb");var St=xo;St.template=`<div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div>`;St.bindAttributes({badgeIcon:null,uid:null});var It=class It extends ce{constructor(){super(),this.init$={...this.init$,isHidden:!1,"*solution":this.tagName}}initCallback(){super.initCallback(),this.emit(we.INIT_SOLUTION,void 0),this.defineAccessor("headless",t=>{this.set$({isHidden:$(t)})})}};n(It,"FileUploaderRegular"),d(It,"styleAttrs",[...X(It,It,"styleAttrs"),"uc-file-uploader-regular"]);var Ot=It;Ot.template=`<uc-simple-btn set="@hidden: isHidden"></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;Ot.bindAttributes({headless:null});var To="active",ws="",$t=class $t extends ce{constructor(){super(),this.init$={...this.init$,singleUpload:!1,isHiddenStartFrom:!1,classUploadList:ws,classStartFrom:ws,"*solution":this.tagName}}_handleModalOpen(t){var e;t.id===b.activities.CLOUD_IMG_EDIT&&this.set$({classUploadList:To}),this.$["*currentActivity"]===b.activities.UPLOAD_LIST&&this.set$({classUploadList:To,isHiddenStartFrom:!0}),((e=this.$["*uploadList"])==null?void 0:e.length)<=0&&this.set$({classStartFrom:To})}_handleModalClose(t){t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.set$({isHiddenStartFrom:!1})),t.id===b.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)}initCallback(){super.initCallback(),this.emit(we.INIT_SOLUTION,void 0);let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e===b.activities.UPLOAD_LIST&&this.modalManager.closeAll(),e||(this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.set$({classStartFrom:ws})):(this.set$({classUploadList:ws,isHiddenStartFrom:!1}),this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM)}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",i=>{e==="grid"?(i?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.$.singleUpload=!i):(this.style.removeProperty("--uc-grid-col"),this.$.singleUpload=!1)})}),this.handleModalOpen=this._handleModalOpen.bind(this),this.handleModalClose=this._handleModalClose.bind(this),this.modalManager.subscribe(D.OPEN,this.handleModalOpen),this.modalManager.subscribe(D.CLOSE,this.handleModalClose)}destroyCallback(){super.destroyCallback(),this.modalManager.unsubscribe(D.OPEN,this.handleModalOpen),this.modalManager.unsubscribe(D.CLOSE,this.handleModalClose)}};n($t,"FileUploaderMinimal"),d($t,"styleAttrs",[...X($t,$t,"styleAttrs"),"uc-file-uploader-minimal"]);var gi=$t;gi.template=`<uc-start-from set="@hidden: isHiddenStartFrom; @class:classStartFrom"><uc-drop-area set="@single:singleUpload;" initflow clickable tabindex="0" l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list set="@class:classUploadList" ref="uBlock"></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;var kt=class kt extends ce{constructor(){super(),this.init$={...this.init$,couldCancel:!1,"*solution":this.tagName,cancel:n(()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)},"cancel")}}get couldHistoryBack(){let t=this.$["*history"];return t.length>1&&t[t.length-1]!==b.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback(),this.emit(we.INIT_SOLUTION,void 0);let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0&&this.$["*currentActivity"]===(t.initActivity||b.activities.START_FROM)&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};n(kt,"FileUploaderInline"),d(kt,"styleAttrs",[...X(kt,kt,"styleAttrs"),"uc-file-uploader-inline"]);var bi=kt;bi.template=`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" set="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var Mt=class Mt extends fe{constructor(){super(),this.init$={...this.init$,"*solution":this.tagName}}initCallback(){var t;super.initCallback(),this.emit(we.INIT_SOLUTION,void 0),(t=this.a11y)==null||t.registerBlock(this)}};n(Mt,"CloudImageEditor"),d(Mt,"styleAttrs",[...X(Mt,Mt,"styleAttrs"),"uc-wgt-common"]);var Cs=Mt;function Es(r){for(let t in r){let e=[...t].reduce((i,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),i+=s),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),r[t].reg&&r[t].reg(e)}}n(Es,"defineComponents");var So="UC";async function Ra(r,t=!1){return new Promise((e,i)=>{if(typeof document!="object"){e(null);return}if(typeof window=="object"&&window[So]){e(window[So]);return}let s=document.createElement("script");s.async=!0,s.src=r,s.onerror=()=>{i()},s.onload=()=>{let o=window[So];t&&Es(o),e(o)},document.head.appendChild(s)})}n(Ra,"loadFileUploaderFrom");return Wa(Ku);})();
26
+ "use strict";var UC=(()=>{var kt=Object.defineProperty;var La=Object.getOwnPropertyDescriptor;var Pa=Object.getOwnPropertyNames;var Ua=Object.getPrototypeOf,Ra=Object.prototype.hasOwnProperty;var Da=Reflect.get;var Fa=(s,t,e)=>t in s?kt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var n=(s,t)=>kt(s,"name",{value:t,configurable:!0});var Na=(s,t)=>{for(var e in t)kt(s,e,{get:t[e],enumerable:!0})},Va=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Pa(t))!Ra.call(s,r)&&r!==e&&kt(s,r,{get:()=>t[r],enumerable:!(i=La(t,r))||i.enumerable});return s};var za=s=>Va(kt({},"__esModule",{value:!0}),s);var d=(s,t,e)=>Fa(s,typeof t!="symbol"?t+"":t,e);var q=(s,t,e)=>Da(Ua(s),e,t);var Wu={};Na(Wu,{ActivityBlock:()=>b,ActivityHeader:()=>fs,BaseComponent:()=>_e,Block:()=>y,BtnUi:()=>xt,CameraSource:()=>Yt,CloudImageEditor:()=>vs,CloudImageEditorActivity:()=>ds,CloudImageEditorBlock:()=>fe,Config:()=>Zn,Copyright:()=>ms,CropFrame:()=>ei,Data:()=>T,DropArea:()=>ft,EditorCropButtonControl:()=>yt,EditorFilterControl:()=>Ge,EditorImageCropper:()=>ri,EditorImageFader:()=>cs,EditorOperationControl:()=>wt,EditorScroller:()=>oi,EditorSlider:()=>ii,EditorToolbar:()=>ni,ExternalSource:()=>ui,ExternalUploadSource:()=>Ae,FileItem:()=>vt,FileUploaderInline:()=>fi,FileUploaderMinimal:()=>pi,FileUploaderRegular:()=>Tt,FormInput:()=>ps,Icon:()=>lt,Img:()=>ts,LineLoaderUi:()=>ai,Modal:()=>qt,ModalEvents:()=>D,PACKAGE_NAME:()=>Fe,PACKAGE_VERSION:()=>Ne,PresenceToggle:()=>li,ProgressBar:()=>Qt,ProgressBarCommon:()=>Jt,Select:()=>di,SimpleBtn:()=>dt,SliderUi:()=>ci,SolutionBlock:()=>ce,SourceBtn:()=>mt,SourceList:()=>is,Spinner:()=>hi,StartFrom:()=>Wt,Thumb:()=>At,UID:()=>Ue,UploadCtxProvider:()=>_a,UploadList:()=>Zt,UploadSource:()=>L,UploaderBlock:()=>k,UrlSource:()=>Kt,defineComponents:()=>ys,defineLocale:()=>Ks,loadFileUploaderFrom:()=>$a,toKebabCase:()=>nt});var Ba=Object.defineProperty,Ha=n((s,t,e)=>t in s?Ba(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,"__defNormalProp"),xs=n((s,t,e)=>(Ha(s,typeof t!="symbol"?t+"":t,e),e),"__publicField");function ja(s){let t=n(e=>{var i;for(let r in e)((i=e[r])==null?void 0:i.constructor)===Object&&(e[r]=t(e[r]));return{...e}},"clone");return t(s)}n(ja,"cloneObj");var Xe,T=(Xe=class{constructor(t){t.constructor===Object?this.store=ja(t):(this._storeIsProxy=!0,this.store=t),this.callbackMap=Object.create(null)}static warn(t,e){console.warn(`Symbiote Data: cannot ${t}. Prop name: `+e)}read(t){return!this._storeIsProxy&&!this.store.hasOwnProperty(t)?(T.warn("read",t),null):this.store[t]}has(t){return this._storeIsProxy?this.store[t]!==void 0:this.store.hasOwnProperty(t)}add(t,e,i=!1){!i&&Object.keys(this.store).includes(t)||(this.store[t]=e,this.notify(t))}pub(t,e){if(!this._storeIsProxy&&!this.store.hasOwnProperty(t)){T.warn("publish",t);return}this.store[t]=e,this.notify(t)}multiPub(t){for(let e in t)this.pub(e,t[e])}notify(t){this.callbackMap[t]&&this.callbackMap[t].forEach(e=>{e(this.store[t])})}sub(t,e,i=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(t)?(T.warn("subscribe",t),null):(this.callbackMap[t]||(this.callbackMap[t]=new Set),this.callbackMap[t].add(e),i&&e(this.store[t]),{remove:n(()=>{this.callbackMap[t].delete(e),this.callbackMap[t].size||delete this.callbackMap[t]},"remove"),callback:e})}static registerCtx(t,e=Symbol()){let i=T.globalStore.get(e);return i?console.warn('State: context UID "'+e+'" already in use'):(i=new T(t),T.globalStore.set(e,i)),i}static deleteCtx(t){T.globalStore.delete(t)}static getCtx(t,e=!0){return T.globalStore.get(t)||(e&&console.warn('State: wrong context UID - "'+t+'"'),null)}},n(Xe,"Data"),Xe);T.globalStore=new Map;var E=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),Co="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Ga=Co.length-1,qe,Ue=(qe=class{static generate(t="XXXXXXXXX-XXX"){let e="";for(let i=0;i<t.length;i++)e+=t[i]==="-"?t[i]:Co.charAt(Math.random()*Ga);return e}},n(qe,"UID"),qe);function xo(s,t,e){let i=!0,r,o=t.split(".");return o.forEach((a,l)=>{l<o.length-1?s=s[a]:r=a}),s?s[r]=e:i=!1,i}n(xo,"setNestedProp");function Wa(s){return s.split("-").map((t,e)=>t&&e?t[0].toUpperCase()+t.slice(1):t).join("").split("_").map((t,e)=>t&&e?t.toUpperCase():t).join("")}n(Wa,"kebabToCamel");function Xa(s,t){[...s.querySelectorAll(`[${E.REPEAT_ATTR}]`)].forEach(e=>{var a;let i=e.getAttribute(E.REPEAT_ITEM_TAG_ATTR),r;if(i&&(r=window.customElements.get(i)),!r){r=(a=class extends t.BaseComponent{constructor(){super(),i||(this.style.display="contents")}},n(a,"itemClass"),a);let l=e.innerHTML;r.template=l,r.reg(i)}for(;e.firstChild;)e.firstChild.remove();let o=e.getAttribute(E.REPEAT_ATTR);t.sub(o,l=>{if(!l){for(;e.firstChild;)e.firstChild.remove();return}let c=[...e.children],u,p=n(h=>{h.forEach((m,g)=>{if(c[g])if(c[g].set$)setTimeout(()=>{c[g].set$(m)});else for(let _ in m)c[g][_]=m[_];else{u||(u=new DocumentFragment);let _=new r;Object.assign(_.init$,m),u.appendChild(_)}}),u&&e.appendChild(u);let f=c.slice(h.length,c.length);for(let m of f)m.remove()},"fillItems");if(l.constructor===Array)p(l);else if(l.constructor===Object){let h=[];for(let f in l){let m=l[f];Object.defineProperty(m,"_KEY_",{value:f,enumerable:!0}),h.push(m)}p(h)}else console.warn("Symbiote repeat data type error:"),console.log(l)}),e.removeAttribute(E.REPEAT_ATTR),e.removeAttribute(E.REPEAT_ITEM_TAG_ATTR)})}n(Xa,"repeatProcessor");var yo="__default__";function qa(s,t){if(t.shadowRoot)return;let e=[...s.querySelectorAll("slot")];if(!e.length)return;let i={};e.forEach(r=>{let o=r.getAttribute("name")||yo;i[o]={slot:r,fr:document.createDocumentFragment()}}),t.initChildren.forEach(r=>{var o;let a=yo;r instanceof Element&&r.hasAttribute("slot")&&(a=r.getAttribute("slot"),r.removeAttribute("slot")),(o=i[a])==null||o.fr.appendChild(r)}),Object.values(i).forEach(r=>{if(r.fr.childNodes.length)r.slot.parentNode.replaceChild(r.fr,r.slot);else if(r.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...r.slot.childNodes),r.slot.parentNode.replaceChild(o,r.slot)}else r.slot.remove()})}n(qa,"slotProcessor");function Za(s,t){[...s.querySelectorAll(`[${E.EL_REF_ATTR}]`)].forEach(e=>{let i=e.getAttribute(E.EL_REF_ATTR);t.ref[i]=e,e.removeAttribute(E.EL_REF_ATTR)})}n(Za,"refProcessor");function Ka(s,t){[...s.querySelectorAll(`[${E.BIND_ATTR}]`)].forEach(e=>{let r=e.getAttribute(E.BIND_ATTR).split(";");[...e.attributes].forEach(o=>{if(o.name.startsWith("-")&&o.value){let a=Wa(o.name.replace("-",""));r.push(a+":"+o.value),e.removeAttribute(o.name)}}),r.forEach(o=>{if(!o)return;let a=o.split(":").map(p=>p.trim()),l=a[0],c;l.indexOf(E.ATTR_BIND_PRFX)===0&&(c=!0,l=l.replace(E.ATTR_BIND_PRFX,""));let u=a[1].split(",").map(p=>p.trim());for(let p of u){let h;p.startsWith("!!")?(h="double",p=p.replace("!!","")):p.startsWith("!")&&(h="single",p=p.replace("!","")),t.sub(p,f=>{h==="double"?f=!!f:h==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?e.setAttribute(l,""):e.removeAttribute(l):e.setAttribute(l,f):xo(e,l,f)||(e[E.SET_LATER_KEY]||(e[E.SET_LATER_KEY]=Object.create(null)),e[E.SET_LATER_KEY][l]=f)})}}),e.removeAttribute(E.BIND_ATTR)})}n(Ka,"domSetProcessor");var mi="{{",$t="}}",Ya="skip-text";function Ja(s){let t,e=[],i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:n(r=>{var o;return!((o=r.parentElement)!=null&&o.hasAttribute(Ya))&&r.textContent.includes(mi)&&r.textContent.includes($t)&&1},"acceptNode")});for(;t=i.nextNode();)e.push(t);return e}n(Ja,"getTextNodesWithTokens");var Qa=n(function(s,t){Ja(s).forEach(i=>{let r=[],o;for(;i.textContent.includes($t);)i.textContent.startsWith(mi)?(o=i.textContent.indexOf($t)+$t.length,i.splitText(o),r.push(i)):(o=i.textContent.indexOf(mi),i.splitText(o)),i=i.nextSibling;r.forEach(a=>{let l=a.textContent.replace(mi,"").replace($t,"");a.textContent="",t.sub(l,c=>{a.textContent=c})})})},"txtNodesProcessor"),el=[Xa,qa,Za,Ka,Qa],gi="'",Qe='"',tl=/\\([0-9a-fA-F]{1,6} ?)/g;function il(s){return(s[0]===Qe||s[0]===gi)&&(s[s.length-1]===Qe||s[s.length-1]===gi)}n(il,"hasLeadingTrailingQuotes");function sl(s){return(s[0]===Qe||s[0]===gi)&&(s=s.slice(1)),(s[s.length-1]===Qe||s[s.length-1]===gi)&&(s=s.slice(0,-1)),s}n(sl,"trimQuotes");function rl(s){let t="",e="";for(var i=0;i<s.length;i++){let r=s[i+1];s[i]==="\\"&&r==='"'?(t+='\\"',i++):s[i]==='"'&&e!=="\\"?t+='\\"':t+=s[i],e=s[i]}return t}n(rl,"escapeQuotes");function ol(s){let t=s;il(s)&&(t=sl(t),t=t.replace(tl,(e,i)=>String.fromCodePoint(parseInt(i.trim(),16))),t=t.replaceAll(`\\
27
+ `,"\\n"),t=rl(t),t=Qe+t+Qe);try{return JSON.parse(t)}catch{throw new Error(`Failed to parse CSS property value: ${t}. Original input: ${s}`)}}n(ol,"parseCssPropertyValue");var wo=0,We=null,be=null,Ze,Te=(Ze=class extends HTMLElement{constructor(){super(),xs(this,"updateCssData",()=>{var t;this.dropCssDataCache(),(t=this.__boundCssProps)==null||t.forEach(e=>{let i=this.getCssData(this.__extractCssName(e),!0);i!==null&&this.$[e]!==i&&(this.$[e]=i)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return Te}initCallback(){}__initCallback(){var t;this.__initialized||(this.__initialized=!0,(t=this.initCallback)==null||t.call(this))}render(t,e=this.renderShadow){let i;if((e||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let o=this.getAttribute(E.USE_TPL);if(o){let a=this.getRootNode(),l=(a==null?void 0:a.querySelector(o))||document.querySelector(o);l?t=l.content.cloneNode(!0):console.warn(`Symbiote template "${o}" is not found...`)}}if(this.processInnerHtml)for(let o of this.tplProcessors)o(this,this);if(t||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(t==null?void 0:t.constructor)===DocumentFragment)i=t;else if((t==null?void 0:t.constructor)===String){let o=document.createElement("template");o.innerHTML=t,i=o.content.cloneNode(!0)}else this.constructor.__tpl&&(i=this.constructor.__tpl.content.cloneNode(!0));for(let o of this.tplProcessors)o(i,this)}let r=n(()=>{i&&(e&&this.shadowRoot.appendChild(i)||this.appendChild(i)),this.__initCallback()},"addFr");if(this.constructor.__shadowStylesUrl){e=!0;let o=document.createElement("link");o.rel="stylesheet",o.href=this.constructor.__shadowStylesUrl,o.onload=r,this.shadowRoot.prepend(o)}else r()}addTemplateProcessor(t){this.tplProcessors.add(t)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=Ue.generate(),this.style.setProperty(E.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(E.CSS_CTX_PROP,!0)}get ctxName(){var t;let e=((t=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:t.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=e,e}get localCtx(){return this.__localCtx||(this.__localCtx=T.registerCtx({},this)),this.__localCtx}get nodeCtx(){return T.getCtx(this.ctxName,!1)||T.registerCtx({},this.ctxName)}static __parseProp(t,e){let i,r;if(t.startsWith(E.EXT_DATA_CTX_PRFX))i=e.nodeCtx,r=t.replace(E.EXT_DATA_CTX_PRFX,"");else if(t.includes(E.NAMED_DATA_CTX_SPLTR)){let o=t.split(E.NAMED_DATA_CTX_SPLTR);i=T.getCtx(o[0]),r=o[1]}else i=e.localCtx,r=t;return{ctx:i,name:r}}sub(t,e,i=!0){let r=n(a=>{this.isConnected&&e(a)},"subCb"),o=Te.__parseProp(t,this);o.ctx.has(o.name)?this.allSubs.add(o.ctx.sub(o.name,r,i)):window.setTimeout(()=>{this.allSubs.add(o.ctx.sub(o.name,r,i))})}notify(t){let e=Te.__parseProp(t,this);e.ctx.notify(e.name)}has(t){let e=Te.__parseProp(t,this);return e.ctx.has(e.name)}add(t,e,i=!1){let r=Te.__parseProp(t,this);r.ctx.add(r.name,e,i)}add$(t,e=!1){for(let i in t)this.add(i,t[i],e)}get $(){if(!this.__stateProxy){let t=Object.create(null);this.__stateProxy=new Proxy(t,{set:n((e,i,r)=>{let o=Te.__parseProp(i,this);return o.ctx.pub(o.name,r),!0},"set"),get:n((e,i)=>{let r=Te.__parseProp(i,this);return r.ctx.read(r.name)},"get")})}return this.__stateProxy}set$(t,e=!1){for(let i in t){let r=t[i];e||![String,Number,Boolean].includes(r==null?void 0:r.constructor)?this.$[i]=r:this.$[i]!==r&&(this.$[i]=r)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(E.CTX_OWNER_ATTR)&&this.getAttribute(E.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let t=this.constructor.__attrDesc;if(t)for(let e of Object.values(t))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(E.EXT_DATA_CTX_PRFX))this.nodeCtx.add(e.replace(E.EXT_DATA_CTX_PRFX,""),this.init$[e],this.__ctxOwner);else if(e.includes(E.NAMED_DATA_CTX_SPLTR)){let i=e.split(E.NAMED_DATA_CTX_SPLTR),r=i[0].trim(),o=i[1].trim();if(r&&o){let a=T.getCtx(r,!1);a||(a=T.registerCtx({},r)),a.add(o,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);this.__dataCtxInitialized=!0}connectedCallback(){var t;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let e=(t=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:t.trim();if(e&&this.style.setProperty(E.CSS_CTX_PROP,`'${e}'`),this.__initDataCtx(),this[E.SET_LATER_KEY]){for(let i in this[E.SET_LATER_KEY])xo(this,i,this[E.SET_LATER_KEY][i]);delete this[E.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let i of el)this.addTemplateProcessor(i);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let i=this.getRootNode();if(!i)return;if(i==null?void 0:i.querySelector(`link[${E.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let o=this.constructor.__rootStylesLink.cloneNode(!0);o.setAttribute(E.ROOT_STYLE_ATTR_NAME,this.constructor.is),o.onload=()=>{this.render()},i.nodeType===Node.DOCUMENT_NODE?i.head.appendChild(o):i.prepend(o)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let t of this.allSubs)t.remove(),this.allSubs.delete(t);for(let t of this.tplProcessors)this.tplProcessors.delete(t);be==null||be.delete(this.updateCssData),be!=null&&be.size||(We==null||We.disconnect(),We=null,be=null)},100)))}static reg(t,e=!1){t||(wo++,t=`${E.AUTO_TAG_PRFX}-${wo}`),this.__tag=t;let i=window.customElements.get(t);if(i){!e&&i!==this&&console.warn([`Element with tag name "${t}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
28
+ `));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=Object.keys(t),this.__attrDesc=t}attributeChangedCallback(t,e,i){var r;if(e===i)return;let o=(r=this.constructor.__attrDesc)==null?void 0:r[t];o?this.__dataCtxInitialized?this.$[o]=i:this.init$[o]=i:this[t]=i}getCssData(t,e=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(t)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let i=this.__computedStyle.getPropertyValue(t).trim();try{this.__cssDataCache[t]=ol(i)}catch{!e&&console.warn(`CSS Data error: ${t}`),this.__cssDataCache[t]=null}}return this.__cssDataCache[t]}__extractCssName(t){return t.split("--").map((e,i)=>i===0?"":e).join("--")}__initStyleAttrObserver(){be||(be=new Set),be.add(this.updateCssData),We||(We=new MutationObserver(t=>{t[0].type==="attributes"&&be.forEach(e=>{e()})}),We.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(t,e=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(t);let i=this.getCssData(this.__extractCssName(t),!0);i===null&&(i=e),this.add(t,i),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(t,e,i){let r="__"+t;this[r]=this[t],Object.defineProperty(this,t,{set:n(o=>{this[r]=o,i?window.setTimeout(()=>{e==null||e(o)}):e==null||e(o)},"set"),get:n(()=>this[r],"get")}),this[t]=this[r]}static set shadowStyles(t){let e=new Blob([t],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(e)}static set rootStyles(t){if(!this.__rootStylesLink){let e=new Blob([t],{type:"text/css"}),i=URL.createObjectURL(e),r=document.createElement("link");r.href=i,r.rel="stylesheet",this.__rootStylesLink=r}}},n(Ze,"_BaseComponent"),Ze),_e=Te;xs(_e,"template");var Ke,Cs=(Ke=class{static _print(t){console.warn(t)}static setDefaultTitle(t){this.defaultTitle=t}static setRoutingMap(t){Object.assign(this.appMap,t);for(let e in this.appMap)!this.defaultRoute&&this.appMap[e].default===!0?this.defaultRoute=e:!this.errorRoute&&this.appMap[e].error===!0&&(this.errorRoute=e)}static set routingEventName(t){this.__routingEventName=t}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let t={route:null,options:{}};return window.location.search.split(this.separator).forEach(i=>{if(i.includes("?"))t.route=i.replace("?","");else if(i.includes("=")){let r=i.split("=");t.options[r[0]]=decodeURI(r[1])}else t.options[i]=!0}),t}static notify(){let t=this.readAddressBar(),e=this.appMap[t.route];if(e&&e.title&&(document.title=e.title),t.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!e&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!e){this._print(`Route "${t.route}" not found...`);return}let i=new CustomEvent(Cs.routingEventName,{detail:{route:t.route,options:Object.assign(e||{},t.options)}});window.dispatchEvent(i)}static reflect(t,e={}){let i=this.appMap[t];if(!i){this._print("Wrong route: "+t);return}let r="?"+t;for(let a in e)e[a]===!0?r+=this.separator+a:r+=this.separator+a+`=${e[a]}`;let o=i.title||this.defaultTitle||"";window.history.pushState(null,o,r),document.title=o}static applyRoute(t,e={}){this.reflect(t,e),this.notify()}static setSeparator(t){this._separator=t}static get separator(){return this._separator||"&"}static createRouterData(t,e){this.setRoutingMap(e);let i=T.registerCtx({route:null,options:null,title:null},t);return window.addEventListener(this.routingEventName,r=>{var o;i.multiPub({route:r.detail.route,options:r.detail.options,title:((o=r.detail.options)==null?void 0:o.title)||this.defaultTitle||""})}),Cs.notify(),this.initPopstateListener(),i}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}},n(Ke,"AppRouter"),Ke);Cs.appMap=Object.create(null);function Mt(s,t){for(let e in t)e.includes("-")?s.style.setProperty(e,t[e]):s.style[e]=t[e]}n(Mt,"applyStyles");function nl(s,t){for(let e in t)t[e].constructor===Boolean?t[e]?s.setAttribute(e,""):s.removeAttribute(e):s.setAttribute(e,t[e])}n(nl,"applyAttributes");function As(s={tag:"div"}){let t=document.createElement(s.tag);if(s.attributes&&nl(t,s.attributes),s.styles&&Mt(t,s.styles),s.properties)for(let e in s.properties)t[e]=s.properties[e];return s.processors&&s.processors.forEach(e=>{e(t)}),s.children&&s.children.forEach(e=>{let i=As(e);t.appendChild(i)}),t}n(As,"create");var Ao="idb-store-ready",al="symbiote-db",ll="symbiote-idb-update_",Ye,cl=(Ye=class{_notifyWhenReady(t=null){window.dispatchEvent(new CustomEvent(Ao,{detail:{dbName:this.name,storeName:this.storeName,event:t}}))}get _updEventName(){return ll+this.name}_getUpdateEvent(t){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:t}})}_notifySubscribers(t){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,t),window.dispatchEvent(this._getUpdateEvent(t))}constructor(t,e){this.name=t,this.storeName=e,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=i=>{this.db=i.target.result,this.objStore=this.db.createObjectStore(e,{keyPath:"_key"}),this.objStore.transaction.oncomplete=r=>{this._notifyWhenReady(r)}},this.request.onsuccess=i=>{this.db=i.target.result,this._notifyWhenReady(i)},this.request.onerror=i=>{console.error(i)},this._subscriptionsMap={},this._updateHandler=i=>{i.key===this.name&&this._subscriptionsMap[i.newValue]&&this._subscriptionsMap[i.newValue].forEach(async o=>{o(await this.read(i.newValue))})},this._localUpdateHandler=i=>{this._updateHandler(i.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(t){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(t);return new Promise((r,o)=>{i.onsuccess=a=>{var l;(l=a.target.result)!=null&&l._value?r(a.target.result._value):(r(null),console.warn(`IDB: cannot read "${t}"`))},i.onerror=a=>{o(a)}})}write(t,e,i=!1){let r={_key:t,_value:e},a=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((l,c)=>{a.onsuccess=u=>{i||this._notifySubscribers(t),l(u.target.result)},a.onerror=u=>{c(u)}})}delete(t,e=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);return new Promise((o,a)=>{r.onsuccess=l=>{e||this._notifySubscribers(t),o(l)},r.onerror=l=>{a(l)}})}getAll(){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((i,r)=>{e.onsuccess=o=>{let a=o.target.result;i(a.map(l=>l._value))},e.onerror=o=>{r(o)}})}subscribe(t,e){this._subscriptionsMap[t]||(this._subscriptionsMap[t]=new Set);let i=this._subscriptionsMap[t];return i.add(e),{remove:n(()=>{i.delete(e),i.size||delete this._subscriptionsMap[t]},"remove")}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,Eo.clear(this.name)}},n(Ye,"DbInstance"),Ye),Je,Eo=(Je=class{static get readyEventName(){return Ao}static open(t=al,e="store"){let i=t+"/"+e;return this._reg[i]||(this._reg[i]=new cl(t,e)),this._reg[i]}static clear(t){window.indexedDB.deleteDatabase(t);for(let e in this._reg)e.split("/")[0]===t&&delete this._reg[e]}},n(Je,"IDB"),Je);xs(Eo,"_reg",Object.create(null));var To=n(s=>{if(typeof s!="string"||!s)return"";let t=s.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},"normalizeCdnOperation"),bi=n((...s)=>s.filter(t=>typeof t=="string"&&t).map(t=>To(t)).join("/-/"),"joinCdnOperations"),B=n((...s)=>{let t=bi(...s);return t?`-/${t}/`:""},"createCdnUrlModifiers");function _i(s){let t=new URL(s),e=t.pathname+t.search+t.hash,i=e.lastIndexOf("http"),r=e.lastIndexOf("/"),o="";return i>=0?o=e.slice(i):r>=0&&(o=e.slice(r+1)),o}n(_i,"extractFilename");function vi(s){let t=new URL(s),{pathname:e}=t,i=e.indexOf("/"),r=e.indexOf("/",i+1);return e.substring(i+1,r)}n(vi,"extractUuid");function Es(s){let t=Io(s),e=new URL(t),i=e.pathname.indexOf("/-/");return i===-1?"":e.pathname.substring(i).slice(1)}n(Es,"extractCdnUrlModifiers");function So(s){return Es(s).split("/-/").filter(Boolean).map(e=>To(e))}n(So,"extractOperations");function Io(s){let t=new URL(s),e=_i(s),i=Oo(e)?ko(e).pathname:e;return t.pathname=t.pathname.replace(i,""),t.search="",t.hash="",t.toString()}n(Io,"trimFilename");function Oo(s){return s.startsWith("http")}n(Oo,"isFileUrl");function ko(s){let t=new URL(s);return{pathname:t.origin+t.pathname||"",search:t.search||"",hash:t.hash||""}}n(ko,"splitFileUrl");var F=n((s,t,e)=>{let i=new URL(Io(s));if(e=e||_i(s),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),Oo(e)){let r=ko(e);i.pathname=i.pathname+(t||"")+(r.pathname||""),i.search=r.search,i.hash=r.hash}else i.pathname=i.pathname+(t||"")+(e||"");return i.toString()},"createCdnUrl"),Se=n((s,t)=>{let e=new URL(s);return e.pathname=t+"/",e.toString()},"createOriginalUrl");var V=n((s,t=",")=>s.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0),"stringToArray");var Q=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),Mo=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function ul(s,t){if(typeof t=="number"){let e=t;return Q[s]!==e?`${s}/${e}`:""}if(typeof t=="boolean"){let e=t;return Q[s]!==e?`${s}`:""}if(s==="filter"&&t){let{name:e,amount:i}=t;return Q.filter===i?"":`${s}/${e}/${i}`}if(s==="crop"&&t){let{dimensions:e,coords:i}=t;return`${s}/${e.join("x")}/${i.join(",")}`}return""}n(ul,"transformationToStr");function Ie(s){return bi(...Mo.filter(t=>typeof s[t]!="undefined"&&s[t]!==null).map(t=>{let e=s[t];return ul(t,e)}).filter(t=>!!t))}n(Ie,"transformationsToOperations");var yi=bi("format/auto","progressive/yes"),ve=n(([s])=>typeof s!="undefined"?Number(s):void 0,"asNumber"),$o=n(()=>!0,"asBoolean"),dl=n(([s,t])=>({name:s,amount:typeof t!="undefined"?Number(t):100}),"asFilter"),hl=n(([s,t])=>{if(!/\d+x\d+/.test(s)||!/\d+,\d+/.test(t))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:V(s,"x").map(Number),coords:V(t).map(Number)}},"asCrop"),pl=Object.freeze({enhance:ve,brightness:ve,exposure:ve,gamma:ve,contrast:ve,saturation:ve,vibrance:ve,warmth:ve,filter:dl,mirror:$o,flip:$o,rotate:ve,crop:hl});function Lo(s){let t={};for(let e of s){let[i,...r]=e.split("/");if(!Mo.includes(i))continue;let o=i,a=pl[o];try{let l=a(r);t[o]=l}catch(l){console.warn([`Failed to parse URL operation "${e}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
29
+ `))}}return t}n(Lo,"operationsToTransformations");var U=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),Z=[U.CROP,U.TUNING,U.FILTERS],Po=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],Uo=["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"],Ro=["rotate","mirror","flip"],le=Object.freeze({brightness:{zero:Q.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Q.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Q.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Q.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Q.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Q.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Q.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Q.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Q.filter,range:[0,100],keypointsNumber:1}});var K=n(s=>s?s.split(",").map(t=>t.trim()).filter(Boolean):[],"deserializeCsv"),ye=n(s=>s?s.join(","):"","serializeCsv");var Ts="https://ucarecdn.com",fl="https://upload.uploadcare.com",ml="https://social.uploadcare.com",gl="https://ucarecd.net",re={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:ye(Z),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Ts,cdnCnamePrefixed:gl,baseUrl:fl,socialBaseUrl:ml,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:10,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:!0,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:!1,cloudImageEditorAutoOpen:!1,cloudImageEditorMaskHref:null,testMode:!1};var $=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),Ss=class Ss{constructor(t){d(this,"_timeoutStore",new Map);d(this,"_targets",new Set);d(this,"_debugPrint",null);this._debugPrint=t}bindTarget(t){this._targets.add(t)}unbindTarget(t){this._targets.delete(t)}_dispatch(t,e){var i;for(let r of this._targets)r.dispatchEvent(new CustomEvent(t,{detail:e}));(i=this._debugPrint)==null||i.call(this,()=>{let r=e&&typeof e=="object"?{...e}:e;return[`event "${t}"`,r]})}emit(t,e,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(t,typeof e=="function"?e():e);return}this._timeoutStore.has(t)&&window.clearTimeout(this._timeoutStore.get(t));let r=typeof i=="number"?i:20,o=window.setTimeout(()=>{this._dispatch(t,typeof e=="function"?e():e),this._timeoutStore.delete(t)},r);this._timeoutStore.set(t,o)}};n(Ss,"EventEmitter");var wi=Ss;function M(s,t){let e,i=n((...r)=>{clearTimeout(e),e=setTimeout(()=>s(...r),t)},"debounced");return i.cancel=()=>{clearTimeout(e)},i}n(M,"debounce");var Do="--uploadcare-blocks-window-height",Lt=class Lt{static registerClient(t){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(t)}static unregisterClient(t){this.clientsRegistry.delete(t),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(Do)}};n(Lt,"WindowHeightTracker"),d(Lt,"clientsRegistry",new Set),d(Lt,"flush",M(()=>{document.documentElement.style.setProperty(Do,`${window.innerHeight}px`)},100));var Pt=Lt;var Fo=n(s=>{var i;let t=new Intl.Locale(s),e="ltr";return typeof t.getTextInfo=="function"&&t.getTextInfo().direction?e=t.getTextInfo().direction:"textInfo"in t&&((i=t.textInfo)!=null&&i.direction)&&(e=t.textInfo.direction),e},"getLocaleDirection");var Ci=n((s,t)=>new Intl.PluralRules(s).select(t),"getPluralForm");var bl=n(s=>s,"DEFAULT_TRANSFORMER"),Is="{{",Vo="}}",No="plural:";function Ut(s,t,e={}){var a;let{openToken:i=Is,closeToken:r=Vo,transform:o=bl}=e;for(let l in t){let c=(a=t[l])==null?void 0:a.toString();s=s.replaceAll(i+l+r,typeof c=="string"?o(c):c)}return s}n(Ut,"applyTemplateData");function zo(s){let t=[],e=s.indexOf(Is);for(;e!==-1;){let i=s.indexOf(Vo,e),r=s.substring(e+2,i);if(r.startsWith(No)){let o=s.substring(e+2,i).replace(No,""),a=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));t.push({variable:r,pluralKey:a,countVariable:l})}e=s.indexOf(Is,i)}return t}n(zo,"getPluralObjects");var Bo=n(({element:s,attribute:t,onSuccess:e,onTimeout:i,timeout:r=300})=>{let o=s.getAttribute(t);if(o!==null){e(o);return}let a=new MutationObserver(u=>{let p=u[u.length-1];c(p)});a.observe(s,{attributes:!0,attributeFilter:[t]});let l=setTimeout(()=>{a.disconnect(),i()},r),c=n(u=>{let p=s.getAttribute(t);u.type==="attributes"&&u.attributeName===t&&p!==null&&(clearTimeout(l),a.disconnect(),e(p))},"handleMutation")},"waitForAttribute");function Ho(s){return Object.prototype.toString.call(s)==="[object Object]"}n(Ho,"isObject");var _l=/\W|_/g;function vl(s){return s.split(_l).map((t,e)=>t.charAt(0)[e>0?"toUpperCase":"toLowerCase"]()+t.slice(1)).join("")}n(vl,"camelizeString");function jo(s,{ignoreKeys:t}={ignoreKeys:[]}){return Array.isArray(s)?s.map(e=>xe(e,{ignoreKeys:t})):s}n(jo,"camelizeArrayItems");function xe(s,{ignoreKeys:t}={ignoreKeys:[]}){if(Array.isArray(s))return jo(s,{ignoreKeys:t});if(!Ho(s))return s;let e={};for(let i of Object.keys(s)){let r=s[i];if(t.includes(i)){e[i]=r;continue}Ho(r)?r=xe(r,{ignoreKeys:t}):Array.isArray(r)&&(r=jo(r,{ignoreKeys:t})),e[vl(i)]=r}return e}n(xe,"camelizeKeys");var yl=n(s=>new Promise(t=>setTimeout(t,s)),"delay");function Us({libraryName:s,libraryVersion:t,userAgent:e,publicKey:i="",integration:r=""}){let o="JavaScript";if(typeof e=="string")return e;if(typeof e=="function")return e({publicKey:i,libraryName:s,libraryVersion:t,languageName:o,integration:r});let a=[s,t,i].filter(Boolean).join("/"),l=[o,r].filter(Boolean).join("; ");return`${a} (${l})`}n(Us,"getUserAgent$1");var wl={factor:2,time:100};function Cl(s,t=wl){let e=0;function i(r){let o=Math.round(t.time*t.factor**e);return r({attempt:e,retry:n(l=>yl(l!=null?l:o).then(()=>(e+=1,i(r))),"retry")})}return n(i,"runAttempt"),i(s)}n(Cl,"retrier");var zs=class zs extends Error{};n(zs,"UploadcareError");var Re=zs,Ai=class Ai extends Re{constructor(e){super();d(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,Ai.prototype),this.originalProgressEvent=e}};n(Ai,"NetworkError");var et=Ai,Si=n((s,t)=>{s&&(s.aborted?Promise.resolve().then(t):s.addEventListener("abort",()=>t(),{once:!0}))},"onCancel"),Ei=class Ei extends Re{constructor(e="Request canceled"){super(e);d(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,Ei.prototype)}};n(Ei,"CancelError");var Oe=Ei,xl=500,Wo=n(({check:s,interval:t=xl,timeout:e,signal:i})=>new Promise((r,o)=>{let a,l;Si(i,()=>{a&&clearTimeout(a),o(new Oe("Poll cancelled"))}),e&&(l=setTimeout(()=>{a&&clearTimeout(a),o(new Oe("Timed out"))},e));let c=n(()=>{try{Promise.resolve(s(i)).then(u=>{u?(l&&clearTimeout(l),r(u)):a=setTimeout(c,t)}).catch(u=>{l&&clearTimeout(l),o(u)})}catch(u){l&&clearTimeout(l),o(u)}},"tick");a=setTimeout(c,0)}),"poll"),I={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},Ii="application/octet-stream",Xo="original",ke=n(({method:s,url:t,data:e,headers:i={},signal:r,onProgress:o})=>new Promise((a,l)=>{let c=new XMLHttpRequest,u=(s==null?void 0:s.toUpperCase())||"GET",p=!1;c.open(u,t,!0),i&&Object.entries(i).forEach(h=>{let[f,m]=h;typeof m!="undefined"&&!Array.isArray(m)&&c.setRequestHeader(f,m)}),c.responseType="text",Si(r,()=>{p=!0,c.abort(),l(new Oe)}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else{let h={method:u,url:t,data:e,headers:i||void 0,signal:r,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(C){let x=C.split(": "),v=x.shift(),w=x.join(": ");v&&typeof v!="undefined"&&(m[v]=w)});let g=c.response,_=c.status;a({request:h,data:g,headers:m,status:_})}},c.onerror=h=>{p||l(new et(h))},o&&typeof o=="function"&&(c.upload.onprogress=h=>{h.lengthComputable?o({isComputable:!0,value:h.loaded/h.total}):o({isComputable:!1})}),e?c.send(e):c.send()}),"request");function Al(s,...t){return s}n(Al,"identity");var El=n(({name:s})=>s?[s]:[],"getFileOptions"),Tl=Al,Sl=n(()=>new FormData,"getFormData"),qo=n(s=>!1,"isBuffer"),Oi=n(s=>typeof Blob!="undefined"&&s instanceof Blob,"isBlob"),ki=n(s=>typeof File!="undefined"&&s instanceof File,"isFile"),$i=n(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&"uri"in s&&typeof s.uri=="string","isReactNativeAsset"),tt=n(s=>Oi(s)||ki(s)||qo()||$i(s),"isFileData"),Il=n(s=>typeof s=="string"||typeof s=="number"||typeof s=="undefined","isSimpleValue"),Ol=n(s=>!!s&&typeof s=="object"&&!Array.isArray(s),"isObjectValue"),kl=n(s=>!!s&&typeof s=="object"&&"data"in s&&tt(s.data),"isFileValue");function Zo(s,t,e){if(Array.isArray(e))for(let i of e)Zo(s,`${t}[]`,i);else if(kl(e)){let{name:i,contentType:r}=e,o=Tl(e.data,i,r!=null?r:Ii),a=El({name:i,contentType:r});s.push([t,o,...a])}else if(Ol(e))for(let[i,r]of Object.entries(e))typeof r!="undefined"&&s.push([`${t}[${i}]`,String(r)]);else Il(e)&&e&&s.push([t,e.toString()])}n(Zo,"collectParams");function $l(s){let t=[];for(let[e,i]of Object.entries(s))Zo(t,e,i);return t}n($l,"getFormDataParams");function Mi(s){let t=Sl(),e=$l(s);for(let i of e){let[r,o,...a]=i;t.append(r,o,...a)}return t}n(Mi,"buildFormData");var Ti=class Ti extends Re{constructor(e,i,r,o,a){super();d(this,"code");d(this,"request");d(this,"response");d(this,"headers");this.name="UploadError",this.message=e,this.code=i,this.request=r,this.response=o,this.headers=a,Object.setPrototypeOf(this,Ti.prototype)}};n(Ti,"UploadError");var H=Ti,Ml=n(s=>{let t=new URLSearchParams;for(let[e,i]of Object.entries(s))i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).filter(r=>{var o;return(o=r[1])!=null?o:!1}).forEach(r=>t.set(`${e}[${r[0]}]`,String(r[1]))):Array.isArray(i)?i.forEach(r=>{t.append(`${e}[]`,r)}):typeof i=="string"&&i?t.set(e,i):typeof i=="number"&&t.set(e,i.toString());return t.toString()},"buildSearchParams"),we=n((s,t,e)=>{let i=new URL(s);return i.pathname=(i.pathname+t).replace("//","/"),e&&(i.search=Ml(e)),i.toString()},"getUrl"),Ll="6.16.1",Pl="UploadcareUploadClient",Ul=Ll;function De(s){return Us({libraryName:Pl,libraryVersion:Ul,...s})}n(De,"getUserAgent");var Rl="RequestThrottledError",Go=15e3,Dl=1e3;function Fl(s){let{headers:t}=s||{};if(!t||typeof t["retry-after"]!="string")return Go;let e=parseInt(t["retry-after"],10);return Number.isFinite(e)?e*1e3:Go}n(Fl,"getTimeoutFromThrottledRequest");function $e(s,t){let{retryThrottledRequestMaxTimes:e,retryNetworkErrorMaxTimes:i}=t;return Cl(({attempt:r,retry:o})=>s().catch(a=>{if("response"in a&&(a==null?void 0:a.code)===Rl&&r<e)return o(Fl(a));if(a instanceof et&&r<i)return o((r+1)*Dl);throw a}))}n($e,"retryIfFailed");var Ko=n(s=>{let t="";return(Oi(s)||ki(s)||$i(s))&&(t=s.type),t||Ii},"getContentType"),Yo=n(s=>{let t="";return ki(s)&&s.name?t=s.name:Oi(s)||qo()?t="":$i(s)&&s.name&&(t=s.name),t||Xo},"getFileName");function Rs(s){return typeof s=="undefined"||s==="auto"?"auto":s?"1":"0"}n(Rs,"getStoreValue");function Nl(s,{publicKey:t,fileName:e,contentType:i,baseURL:r=I.baseURL,secureSignature:o,secureExpire:a,store:l,signal:c,onProgress:u,source:p="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=I.retryNetworkErrorMaxTimes,metadata:_}){return $e(()=>ke({method:"POST",url:we(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":De({publicKey:t,integration:h,userAgent:f})},data:Mi({file:{data:s,name:e||Yo(s),contentType:i||Ko(s)},UPLOADCARE_PUB_KEY:t,UPLOADCARE_STORE:Rs(l),signature:o,expire:a,source:p,metadata:_}),signal:c,onProgress:u}).then(({data:C,headers:x,request:v})=>{let w=xe(JSON.parse(C));if("error"in w)throw new H(w.error.content,w.error.errorCode,v,w,x);return w}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}n(Nl,"base");var $s;(function(s){s.Token="token",s.FileInfo="file_info"})($s||($s={}));function Vl(s,{publicKey:t,baseURL:e=I.baseURL,store:i,fileName:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=I.retryNetworkErrorMaxTimes,metadata:_}){return $e(()=>ke({method:"POST",headers:{"X-UC-User-Agent":De({publicKey:t,integration:h,userAgent:f})},url:we(e,"/from_url/",{jsonerrors:1,pub_key:t,source_url:s,store:Rs(i),filename:r,check_URL_duplicates:o?1:void 0,save_URL_duplicates:a?1:void 0,signature:l,expire:c,source:u,metadata:_}),signal:p}).then(({data:C,headers:x,request:v})=>{let w=xe(JSON.parse(C));if("error"in w)throw new H(w.error.content,w.error.errorCode,v,w,x);return w}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}n(Vl,"fromUrl");var Y;(function(s){s.Unknown="unknown",s.Waiting="waiting",s.Progress="progress",s.Error="error",s.Success="success"})(Y||(Y={}));var zl=n(s=>"status"in s&&s.status===Y.Error,"isErrorResponse");function Bl(s,{publicKey:t,baseURL:e=I.baseURL,signal:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:a=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=I.retryNetworkErrorMaxTimes}={}){return $e(()=>ke({method:"GET",headers:t?{"X-UC-User-Agent":De({publicKey:t,integration:r,userAgent:o})}:void 0,url:we(e,"/from_url/status/",{jsonerrors:1,token:s}),signal:i}).then(({data:c,headers:u,request:p})=>{let h=xe(JSON.parse(c));if("error"in h&&!zl(h))throw new H(h.error.content,h.error.errorCode,p,h,u);return h}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a})}n(Bl,"fromUrlStatus");function Hl(s,{publicKey:t,baseURL:e=I.baseURL,jsonpCallback:i,secureSignature:r,secureExpire:o,signal:a,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:h=I.retryNetworkErrorMaxTimes}){return $e(()=>ke({method:"POST",headers:{"X-UC-User-Agent":De({publicKey:t,integration:c,userAgent:u})},url:we(e,"/group/",{jsonerrors:1}),data:Mi({files:s,callback:i,pub_key:t,signature:r,expire:o,source:l}),signal:a}).then(({data:f,headers:m,request:g})=>{let _=xe(JSON.parse(f));if("error"in _)throw new H(_.error.content,_.error.errorCode,g,_,m);return _}),{retryNetworkErrorMaxTimes:h,retryThrottledRequestMaxTimes:p})}n(Hl,"group");function Jo(s,{publicKey:t,baseURL:e=I.baseURL,signal:i,source:r,integration:o,userAgent:a,retryThrottledRequestMaxTimes:l=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=I.retryNetworkErrorMaxTimes}){return $e(()=>ke({method:"GET",headers:{"X-UC-User-Agent":De({publicKey:t,integration:o,userAgent:a})},url:we(e,"/info/",{jsonerrors:1,pub_key:t,file_id:s,source:r}),signal:i}).then(({data:u,headers:p,request:h})=>{let f=xe(JSON.parse(u));if("error"in f)throw new H(f.error.content,f.error.errorCode,h,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(Jo,"info");function jl(s,{publicKey:t,contentType:e,fileName:i,multipartChunkSize:r=I.multipartChunkSize,baseURL:o="",secureSignature:a,secureExpire:l,store:c,signal:u,source:p="local",integration:h,userAgent:f,retryThrottledRequestMaxTimes:m=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=I.retryNetworkErrorMaxTimes,metadata:_}){return $e(()=>ke({method:"POST",url:we(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":De({publicKey:t,integration:h,userAgent:f})},data:Mi({filename:i||Xo,size:s,content_type:e||Ii,part_size:r,UPLOADCARE_STORE:Rs(c),UPLOADCARE_PUB_KEY:t,signature:a,expire:l,source:p,metadata:_}),signal:u}).then(({data:C,headers:x,request:v})=>{let w=xe(JSON.parse(C));if("error"in w)throw new H(w.error.content,w.error.errorCode,v,w,x);return w.parts=Object.keys(w.parts).map(R=>w.parts[Number(R)]),w}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}n(jl,"multipartStart");function Gl(s,t,{contentType:e,signal:i,onProgress:r,retryThrottledRequestMaxTimes:o=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=I.retryNetworkErrorMaxTimes}){return $e(()=>ke({method:"PUT",url:t,data:s,onProgress:r,signal:i,headers:{"Content-Type":e||Ii}}).then(l=>(r&&r({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a})}n(Gl,"multipartUpload");function Wl(s,{publicKey:t,baseURL:e=I.baseURL,source:i="local",signal:r,integration:o,userAgent:a,retryThrottledRequestMaxTimes:l=I.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=I.retryNetworkErrorMaxTimes}){return $e(()=>ke({method:"POST",url:we(e,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":De({publicKey:t,integration:o,userAgent:a})},data:Mi({uuid:s,UPLOADCARE_PUB_KEY:t,source:i}),signal:r}).then(({data:u,headers:p,request:h})=>{let f=xe(JSON.parse(u));if("error"in f)throw new H(f.error.content,f.error.errorCode,h,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(Wl,"multipartComplete");function Ds(s,{publicKey:t,baseURL:e,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return Wo({check:n(p=>Jo(s,{publicKey:t,baseURL:e,signal:p,source:i,integration:r,userAgent:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(h=>h.isReady?h:(u&&u({isComputable:!0,value:1}),!1)),"check"),signal:c})}n(Ds,"isReadyPoll");function Xl(s){return"defaultEffects"in s}n(Xl,"isGroupFileInfo");var Bs=class Bs{constructor(t,{baseCDN:e=I.baseCDN,fileName:i}={}){d(this,"uuid");d(this,"name");d(this,"size");d(this,"isStored");d(this,"isImage");d(this,"mimeType");d(this,"cdnUrl");d(this,"s3Url");d(this,"originalFilename");d(this,"imageInfo");d(this,"videoInfo");d(this,"contentInfo");d(this,"metadata");d(this,"s3Bucket");d(this,"defaultEffects",null);let{uuid:r,s3Bucket:o}=t,a=we(e,`${r}/`),l=o?we(`https://${o}.s3.amazonaws.com/`,`${r}/${t.filename}`):null;this.uuid=r,this.name=i||t.filename,this.size=t.size,this.isStored=t.isStored,this.isImage=t.isImage,this.mimeType=t.mimeType,this.cdnUrl=a,this.originalFilename=t.originalFilename,this.imageInfo=t.imageInfo,this.videoInfo=t.videoInfo,this.contentInfo=t.contentInfo,this.metadata=t.metadata||null,this.s3Bucket=o||null,this.s3Url=l,Xl(t)&&(this.defaultEffects=t.defaultEffects)}};n(Bs,"UploadcareFile");var Ce=Bs,ql=n((s,{publicKey:t,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:a,contentType:l,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:_,metadata:C})=>Nl(s,{publicKey:t,fileName:e,contentType:l,baseURL:i,secureSignature:r,secureExpire:o,store:a,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:C}).then(({file:x})=>Ds(x,{publicKey:t,baseURL:i,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(x=>new Ce(x,{baseCDN:_})),"uploadDirect"),Zl=n((s,{publicKey:t,fileName:e,baseURL:i,signal:r,onProgress:o,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:h})=>Jo(s,{publicKey:t,baseURL:i,signal:r,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new Ce(f,{baseCDN:h,fileName:e})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),Kl=n((s,{signal:t}={})=>{let e=null,i=null,r=s.map(()=>new AbortController),o=n(a=>()=>{i=a,r.forEach((l,c)=>c!==a&&l.abort())},"createStopRaceCallback");return Si(t,()=>{r.forEach(a=>a.abort())}),Promise.all(s.map((a,l)=>{let c=o(l);return Promise.resolve().then(()=>a({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(e=u,null))})).then(a=>{if(i===null)throw e;return a[i]})},"race"),Yl=window.WebSocket,Hs=class Hs{constructor(){d(this,"events",Object.create({}))}emit(t,e){var i;(i=this.events[t])==null||i.forEach(r=>r(e))}on(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)}off(t,e){e?this.events[t]=this.events[t].filter(i=>i!==e):this.events[t]=[]}};n(Hs,"Events");var Ms=Hs,Jl=n((s,t)=>s==="success"?{status:Y.Success,...t}:s==="progress"?{status:Y.Progress,...t}:{status:Y.Error,...t},"response"),js=class js{constructor(t,e=3e4){d(this,"key");d(this,"disconnectTime");d(this,"ws");d(this,"queue",[]);d(this,"isConnected",!1);d(this,"subscribers",0);d(this,"emmitter",new Ms);d(this,"disconnectTimeoutId",null);this.key=t,this.disconnectTime=e}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let t=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Yl(t),this.ws.addEventListener("error",e=>{this.emmitter.emit("error",new Error(e.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[]}),this.ws.addEventListener("message",e=>{let i=JSON.parse(e.data.toString());switch(i.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(i.channel,Jl(i.event,JSON.parse(i.data)))}})}}disconnect(){let t=n(()=>{var e;(e=this.ws)==null||e.close(),this.ws=void 0,this.isConnected=!1},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{t()},this.disconnectTime):t()}send(t,e){var r;let i=JSON.stringify({event:t,data:e});(r=this.ws)==null||r.send(i)}subscribe(t,e){this.subscribers+=1,this.connect();let i=`task-status-${t}`,r={event:"pusher:subscribe",data:{channel:i}};this.emmitter.on(i,e),this.isConnected?this.send(r.event,r.data):this.queue.push(r)}unsubscribe(t){this.subscribers-=1;let e=`task-status-${t}`,i={event:"pusher:unsubscribe",data:{channel:e}};this.emmitter.off(e),this.isConnected?this.send(i.event,i.data):this.queue=this.queue.filter(r=>r.data.channel!==e),this.subscribers===0&&this.disconnect()}onError(t){return this.emmitter.on("error",t),()=>this.emmitter.off("error",t)}};n(js,"Pusher");var Ls=js,Os=null,Fs=n(s=>{if(!Os){let t=typeof window=="undefined"?0:3e4;Os=new Ls(s,t)}return Os},"getPusher"),Ql=n(s=>{Fs(s).connect()},"preconnect");function ec({token:s,publicKey:t,baseURL:e,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return Wo({check:n(u=>Bl(s,{publicKey:t,baseURL:e,integration:i,userAgent:r,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:a,signal:u}).then(p=>{switch(p.status){case Y.Error:return new H(p.error,p.errorCode);case Y.Waiting:return!1;case Y.Unknown:return new H(`Token "${s}" was not found.`);case Y.Progress:return l&&(p.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:p.done/p.total})),!1;case Y.Success:return l&&l({isComputable:!0,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}n(ec,"pollStrategy");var tc=n(({token:s,pusherKey:t,signal:e,onProgress:i})=>new Promise((r,o)=>{let a=Fs(t),l=a.onError(o),c=n(()=>{l(),a.unsubscribe(s)},"destroy");Si(e,()=>{c(),o(new Oe("pusher cancelled"))}),a.subscribe(s,u=>{switch(u.status){case Y.Progress:{i&&(u.total==="unknown"?i({isComputable:!1}):i({isComputable:!0,value:u.done/u.total}));break}case Y.Success:{c(),i&&i({isComputable:!0,value:u.done/u.total}),r(u);break}case Y.Error:c(),o(new H(u.msg,u.error_code))}})}),"pushStrategy"),ic=n((s,{publicKey:t,fileName:e,baseURL:i,baseCDN:r,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:h,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,pusherKey:C=I.pusherKey,metadata:x})=>Promise.resolve(Ql(C)).then(()=>Vl(s,{publicKey:t,fileName:e,baseURL:i,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,metadata:x})).catch(v=>{let w=Fs(C);return w==null||w.disconnect(),Promise.reject(v)}).then(v=>v.type===$s.FileInfo?v:Kl([({signal:w})=>ec({token:v.token,publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,onProgress:h,signal:w}),({signal:w})=>tc({token:v.token,pusherKey:C,signal:w,onProgress:h})],{signal:p})).then(v=>{if(v instanceof H)throw v;return v}).then(v=>Ds(v.uuid,{publicKey:t,baseURL:i,integration:m,userAgent:g,retryThrottledRequestMaxTimes:_,onProgress:h,signal:p})).then(v=>new Ce(v,{baseCDN:r})),"uploadFromUrl"),ks=new WeakMap,sc=n(async s=>{if(ks.has(s))return ks.get(s);let t=await fetch(s.uri).then(e=>e.blob());return ks.set(s,t),t},"getBlobFromReactNativeAsset"),Qo=n(async s=>{if(ki(s)||Oi(s))return s.size;if($i(s))return(await sc(s)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),rc=n((s,t=I.multipartMinFileSize)=>s>=t,"isMultipart"),en=n(s=>{let t="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",e=new RegExp(t);return!tt(s)&&e.test(s)},"isUuid"),Ns=n(s=>{let t="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",e=new RegExp(t);return!tt(s)&&e.test(s)},"isUrl"),oc=n((s,t)=>new Promise((e,i)=>{let r=[],o=!1,a=t.length,l=[...t],c=n(()=>{let u=t.length-l.length,p=l.shift();p&&p().then(h=>{o||(r[u]=h,a-=1,a?c():e(r))}).catch(h=>{o=!0,i(h)})},"run");for(let u=0;u<s;u++)c()}),"runWithConcurrency"),nc=n((s,t,e,i)=>{let r=i*t,o=Math.min(r+i,e);return s.slice(r,o)},"sliceChunk"),ac=n(async(s,t,e)=>i=>nc(s,i,t,e),"prepareChunks"),lc=n((s,t,{publicKey:e,contentType:i,onProgress:r,signal:o,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Gl(s,t,{publicKey:e,contentType:i,onProgress:r,signal:o,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),cc=n(async(s,{publicKey:t,fileName:e,fileSize:i,baseURL:r,secureSignature:o,secureExpire:a,store:l,signal:c,onProgress:u,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:_,multipartChunkSize:C=I.multipartChunkSize,maxConcurrentRequests:x=I.maxConcurrentRequests,baseCDN:v,metadata:w})=>{let R=i!=null?i:await Qo(s),W,ne=n((N,X)=>{if(!u)return;W||(W=Array(N).fill(0));let se=n(ae=>ae.reduce((ge,ws)=>ge+ws,0),"sum");return ae=>{ae.isComputable&&(W[X]=ae.value,u({isComputable:!0,value:se(W)/N}))}},"createProgressHandler");return _||(_=Ko(s)),jl(R,{publicKey:t,contentType:_,fileName:e||Yo(s),baseURL:r,secureSignature:o,secureExpire:a,store:l,signal:c,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w,multipartChunkSize:C}).then(async({uuid:N,parts:X})=>{let se=await ac(s,R,C);return Promise.all([N,oc(x,X.map((ae,ge)=>()=>lc(se(ge),ae,{publicKey:t,contentType:_,onProgress:ne(X.length,ge),signal:c,integration:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([N])=>Wl(N,{publicKey:t,baseURL:r,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(N=>N.isReady?N:Ds(N.uuid,{publicKey:t,baseURL:r,source:p,integration:h,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(N=>new Ce(N,{baseCDN:v}))},"uploadMultipart");async function Vs(s,{publicKey:t,fileName:e,baseURL:i=I.baseURL,secureSignature:r,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:_,multipartChunkSize:C,maxConcurrentRequests:x,baseCDN:v=I.baseCDN,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:R,pusherKey:W,metadata:ne}){if(tt(s)){let N=await Qo(s);return rc(N,_)?cc(s,{publicKey:t,contentType:g,multipartChunkSize:C,fileSize:N,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,maxConcurrentRequests:x,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:ne}):ql(s,{publicKey:t,fileName:e,contentType:g,baseURL:i,secureSignature:r,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v,metadata:ne})}if(Ns(s))return ic(s,{publicKey:t,fileName:e,baseURL:i,baseCDN:v,checkForUrlDuplicates:w,saveUrlForRecurrentUploads:R,secureSignature:r,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:W,metadata:ne});if(en(s))return Zl(s,{publicKey:t,fileName:e,baseURL:i,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:v});throw new TypeError(`File uploading from "${s}" is not supported`)}n(Vs,"uploadFile");var Gs=class Gs{constructor(t,{baseCDN:e=I.baseCDN}={}){d(this,"uuid");d(this,"filesCount");d(this,"totalSize");d(this,"isStored");d(this,"isImage");d(this,"cdnUrl");d(this,"files");d(this,"createdAt");d(this,"storedAt",null);this.uuid=t.id,this.filesCount=t.filesCount;let i=t.files.filter(Boolean);this.totalSize=Object.values(i).reduce((r,o)=>r+o.size,0),this.isStored=!!t.datetimeStored,this.isImage=!!Object.values(i).filter(r=>r.isImage).length,this.cdnUrl=t.cdnUrl,this.files=i.map(r=>new Ce(r,{baseCDN:e})),this.createdAt=t.datetimeCreated,this.storedAt=t.datetimeStored}};n(Gs,"UploadcareGroup");var Ps=Gs,uc=n(s=>{for(let t of s)if(!tt(t))return!1;return!0},"isFileDataArray"),dc=n(s=>{for(let t of s)if(!en(t))return!1;return!0},"isUuidArray"),hc=n(s=>{for(let t of s)if(!Ns(t))return!1;return!0},"isUrlArray");function tn(s,{publicKey:t,fileName:e,baseURL:i=I.baseURL,secureSignature:r,secureExpire:o,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:_=I.multipartChunkSize,baseCDN:C=I.baseCDN,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:v,jsonpCallback:w}){if(!uc(s)&&!hc(s)&&!dc(s))throw new TypeError(`Group uploading from "${s}" is not supported`);let R,W=!0,ne=s.length,N=n((X,se)=>{if(!c)return;R||(R=Array(X).fill(0));let ae=n(ge=>ge.reduce((ws,Ma)=>ws+Ma)/X,"normalize");return ge=>{if(!ge.isComputable||!W){W=!1,c({isComputable:!1});return}R[se]=ge.value,c({isComputable:!0,value:ae(R)})}},"createProgressHandler");return Promise.all(s.map((X,se)=>tt(X)||Ns(X)?Vs(X,{publicKey:t,fileName:e,baseURL:i,secureSignature:r,secureExpire:o,store:a,signal:l,onProgress:N(ne,se),source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:_,baseCDN:C,checkForUrlDuplicates:x,saveUrlForRecurrentUploads:v}).then(ae=>ae.uuid):X)).then(X=>Hl(X,{publicKey:t,baseURL:i,jsonpCallback:w,secureSignature:r,secureExpire:o,signal:l,source:u,integration:p,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(se=>new Ps(se,{baseCDN:C})).then(se=>(c&&c({isComputable:!0,value:1}),se)))}n(tn,"uploadFileGroup");var Ws=class Ws{constructor(t){d(this,"_concurrency",1);d(this,"_pending",[]);d(this,"_running",0);d(this,"_resolvers",new Map);d(this,"_rejectors",new Map);this._concurrency=t}_run(){let t=this._concurrency-this._running;for(let e=0;e<t;e++){let i=this._pending.shift();if(!i)return;let r=this._resolvers.get(i),o=this._rejectors.get(i);if(!r||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,i().finally(()=>{this._resolvers.delete(i),this._rejectors.delete(i),this._running-=1,this._run()}).then(a=>r(a)).catch(a=>o(a))}}add(t){return new Promise((e,i)=>{this._resolvers.set(t,e),this._rejectors.set(t,i),this._pending.push(t),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(t){this._concurrency=t,this._run()}get concurrency(){return this._concurrency}};n(Ws,"Queue");var xi=Ws;var Xs=n(()=>({}),"blockCtx"),qs=n(s=>({...Xs(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":n(()=>{s.modalManager.close(s.$["*currentActivity"]),s.set$({"*currentActivity":null})},"*closeModal")}),"activityBlockCtx"),Li=n(s=>({...qs(s),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new xi(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null}),"uploaderBlockCtx");var Rt={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"Onedrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}",queued:"Queued"};var Pi=new Map,Zs=new Map,sn=n((s,t)=>{Pi.has(s)&&console.log(`Locale ${s} is already defined. Overwriting...`),Pi.set(s,{...Rt,...t})},"defineLocaleSync"),pc=n((s,t)=>{Zs.set(s,t)},"defineLocaleAsync"),Ks=n((s,t)=>{typeof t=="function"?pc(s,t):sn(s,t)},"defineLocale"),rn=n(async s=>{if(!Pi.has(s)){if(!Zs.has(s))throw new Error(`Locale ${s} is not defined`);let e=await Zs.get(s)();sn(s,e)}return Pi.get(s)},"resolveLocaleDefinition");Ks("en",Rt);var oe=n(s=>`*l10n/${s}`,"localeStateKey"),fc="en",Ys=class Ys{constructor(t){d(this,"_blockInstance",null);d(this,"_localeName","");d(this,"_callbacks",new Set);d(this,"_boundBlocks",new Map);this._blockInstance=t;for(let[e,i]of Object.entries(Rt)){let r=this._blockInstance.has(oe(e))?!this._blockInstance.$[oe(e)]:!0;this._blockInstance.add(oe(e),i,r)}setTimeout(()=>{t.subConfigValue("localeName",async e=>{var o;if(!this._blockInstance||!e)return;this._localeName=e;let i=await rn(e);if(e!==fc&&this._localeName!==e)return;let r=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[e];for(let[a,l]of Object.entries(i)){let c=r==null?void 0:r[a];this._blockInstance.add(oe(a),c!=null?c:l,!0);for(let u of this._callbacks)u()}}),t.subConfigValue("localeDefinitionOverride",e=>{var r;if(!e)return;let i=e[this._localeName];if(i)for(let[o,a]of Object.entries(i)){(r=this._blockInstance)==null||r.add(oe(o),a,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(t){let e=M(t,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(t,e,i){var o,a,l;t.$[e]=i(),this._boundBlocks.has(t)||this._boundBlocks.set(t,new Map),(a=(o=this._boundBlocks.get(t))==null?void 0:o.get(e))==null||a();let r=this.onLocaleChange(()=>{t.$[e]=i()});(l=this._boundBlocks.get(t))==null||l.set(e,r)}destroyL10nBindings(t){let e=this._boundBlocks.get(t);if(e){for(let i of e.values())i();this._boundBlocks.delete(t)}}destroy(){this._callbacks.clear()}};n(Ys,"LocaleManager");var Ui=Ys;function on(s,t){[...s.querySelectorAll("[l10n]")].forEach(e=>{let i=e.getAttribute("l10n");if(!i)return;let r=i.split(";");for(let o of r)o&&mc(e,o,t)})}n(on,"l10nProcessor");var mc=n((s,t,e)=>{let i="textContent",r=!1;if(t.includes(":")){let l=t.split(":");i=l[0],t=l[1],i.startsWith("@")&&(i=i.slice(1),r=!0)}let o=t;e.has(o)&&e.sub(o,l=>{if(!l)return;e.l10nProcessorSubs.has(o)||e.l10nProcessorSubs.set(o,new Set);let c=e.l10nProcessorSubs.get(o);c==null||c.forEach(h=>{h.remove(),c.delete(h),e.allSubs.delete(h)});let u=oe(l).replace("*","");e.nodeCtx.has(u)||e.nodeCtx.add(u,l);let p=e.nodeCtx.sub(u,()=>{s[i]=e.l10n(l)});c==null||c.add(p),e.allSubs.add(p),s.removeAttribute("l10n")});let a=oe(t);e.has(a)||e.add(a,""),e.sub(a,()=>{t=t,r?s.setAttribute(i,e.l10n(t)):s[i]=e.l10n(t)}),s.removeAttribute("l10n")},"locale");var j=n(s=>`*cfg/${s}`,"sharedConfigKey");var gc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Dt(s,t){t.tabIndex=0,t.focus(),s.tabIndex=-1}n(Dt,"focus");function Js(s){let t=s.role||s.type||s.tagName;if(!t)return null;let e=gc[t.toLowerCase()];if(!e)return null;for(let i of e){let r=s.closest(`[role=${i}]`);if(r)return r}}n(Js,"findGroupNodeByEventTarget");function Qs(s,t){return t.role==="toolbar"?bc(t):t.querySelectorAll(`[role=${s.role}]`)}n(Qs,"getItems");function bc(s){return[...s.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}n(bc,"getToolbarItems");function _c(s){let t=s.getAttribute("aria-orientation");if(t==="vertical")return!1;if(t==="horizontal")return!0;let e=s.role;return e==="menubar"||e==="tablist"||e==="toolbar"}n(_c,"isHorizontalOrientation");function nn(s){return t=>{let e=!1,i=(s==null?void 0:s.searchDelayMs)||300,r=0,o="";function a(h){let f=Js(h.target);if(!f){l();return}let m=Qs(h.target,f),g=Array.from(m).indexOf(h.target),_="ArrowDown",C="ArrowUp";if(_c(f)&&(t.document.dir==="rtl"?(_="ArrowLeft",C="ArrowRight"):(_="ArrowRight",C="ArrowLeft")),h.key===_)h.preventDefault(),Dt(h.target,m[g+1]||m[0]);else if(h.key===C)h.preventDefault(),Dt(h.target,m[g-1]||m[m.length-1]);else if(h.key==="Home")h.preventDefault(),Dt(h.target,m[0]);else if(h.key==="End")h.preventDefault(),Dt(h.target,m[m.length-1]);else if(h.key.length===1&&f.role!=="tablist"){let x=Date.now();x-r<=i?o+=h.key.toLowerCase():o=h.key.toLowerCase(),r=x;let v=Array.from(m).find(w=>{var R,W,ne;return(ne=(W=(R=w.textContent)==null?void 0:R.trim())==null?void 0:W.toLowerCase())==null?void 0:ne.startsWith(o)});v&&(h.preventDefault(),Dt(h.target,v))}}n(a,"keyDown");function l(){e=!1,t.removeEventListener("keydown",a)}n(l,"stop");function c(h){let f=Js(h.target);if(f){e||(e=!0,t.addEventListener("keydown",a));let m=Qs(h.target,f);for(let g of m)g!==h.target&&g.setAttribute("tabindex",-1)}else e&&l()}n(c,"focusIn");function u(h){(!h.relatedTarget||h.relatedTarget===t.document)&&l()}n(u,"focusOut");function p(h){let f=Js(h.target);if(f){let m=Qs(h.target,f);for(let g of m)g!==h.target&&g.setAttribute("tabindex",-1);h.target.setAttribute("tabindex",0)}}return n(p,"click"),t.addEventListener("click",p),t.addEventListener("focusin",c),t.addEventListener("focusout",u),()=>{l(),t.removeEventListener("click",p),t.removeEventListener("focusin",c),t.removeEventListener("focusout",u)}}}n(nn,"focusGroupKeyUX");function an(){return s=>{let t,e;function i(o){if(o.target.getAttribute("aria-hidden")==="true"){t=o.target,t.setAttribute("aria-hidden","false"),e=t.hidden,e&&(t.hidden=!1);let a=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');a&&(a.tabIndex=0)}}n(i,"jump");function r(o){t&&t.contains(o.target)&&(!o.relatedTarget||!t.contains(o.relatedTarget))&&(o.target.tabIndex=-1,t.setAttribute("aria-hidden","true"),e&&(t.hidden=!0),t=null)}return n(r,"focusOut"),s.addEventListener("keyuxJump",i),s.addEventListener("focusout",r),()=>{s.removeEventListener("keyuxJump",i),s.removeEventListener("focusout",r)}}}n(an,"hiddenKeyUX");function ln(){return s=>{let t=[];function e(c){let u=s.document.activeElement;u&&u!==s.document.body&&t.push(new WeakRef(u)),c.focus({focusVisible:!0})}n(e,"focus");function i(){let c=t.pop();if(!c){s.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():i()}n(i,"back");let r=0,o;function a(c){clearInterval(o);let u=c.getAttribute("aria-controls");o=setInterval(()=>{if(r++>50){clearInterval(o);return}let p=s.document.getElementById(u);if(p){let h=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');h&&(clearInterval(o),p.dispatchEvent(new s.CustomEvent("keyuxJump",{bubbles:!0})),e(h))}},50)}n(a,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&a(c.target),c.key==="Escape"&&i()}return n(l,"keyDown"),s.addEventListener("keydown",l),()=>{s.removeEventListener("keydown",l)}}}n(ln,"jumpKeyUX");function cn(s){let t,e=s.split(" "),i;function r(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(o(),l.target.classList.add(...e),t=l.target,i=l.target)}n(r,"keyDown");function o(){t&&t.classList.remove(...e),i=null}n(o,"keyUp");function a(l){l.clientX===0&&l.clientY===0&&i!==l.target&&(o(),l.target.classList.add(...e),t=l.target)}return n(a,"click"),l=>(l.addEventListener("click",a),l.addEventListener("keydown",r),l.addEventListener("keyup",o),()=>{l.removeEventListener("click",a),l.removeEventListener("keydown",r),l.removeEventListener("keyup",o)})}n(cn,"pressKeyUX");function un(s,t){let e=t.map(i=>i(s));return()=>{e.forEach(i=>i())}}n(un,"startKeyUX");var tr=class tr{constructor(){d(this,"_listeners",new Map);d(this,"_scope",[])}addEventListener(t,e){let i=n(r=>{let o=r.target;o&&this._scope.some(a=>a===r.target||a.contains(o))&&e(r)},"wrappedListener");this._listeners.set(e,i),window.addEventListener(t,i)}removeEventListener(t,e){let i=this._listeners.get(e);i&&window.removeEventListener(t,i),this._listeners.delete(e)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(t){this._scope.push(t)}destroy(){this._scope=[],this._listeners.forEach((t,e)=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",t),this._listeners.delete(e)})}};n(tr,"ScopedMinimalWindow");var er=tr,ir=class ir{constructor(){d(this,"_destroyKeyUX");d(this,"_scopedWindow");this._scopedWindow=new er,this._destroyKeyUX=un(this._scopedWindow,[nn(),cn("is-pressed"),ln(),an()])}registerBlock(t){this._scopedWindow.registerScope(t)}destroy(){var t;(t=this._destroyKeyUX)==null||t.call(this),this._scopedWindow.destroy()}};n(ir,"A11y");var Ri=ir;var D=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),sr=class sr{constructor(t){d(this,"_modals",new Map);d(this,"_activeModals",new Set);d(this,"_subscribers",new Map);this._block=t}_debugPrint(...t){this._block.debugPrint("[modal-manager]",...t)}registerModal(t,e){this._modals.set(t,e),this._notify(D.ADD,{id:t,modal:e})}deleteModal(t){if(!this._modals.has(t))return!1;let e=this._modals.get(t);return this._modals.delete(t),this._activeModals.delete(t),this._notify(D.DELETE,{id:t,modal:e}),!0}open(t){if(!this._modals.has(t))return this._debugPrint(`Modal with ID "${t}" not found`),!1;let e=this._modals.get(t);return this._activeModals.add(t),this._notify(D.OPEN,{modal:e,id:t}),!0}close(t){if(!this._modals.has(t)||!this._activeModals.has(t))return this._debugPrint(`Modal with ID "${t}" not found or not active`),!1;let e=this._modals.get(t);return this._activeModals.delete(t),this._notify(D.CLOSE,{id:t,modal:e}),!0}toggle(t){return this._modals.has(t)?this._activeModals.has(t)?this.close(t):this.open(t):(this._debugPrint(`Modal with ID "${t}" not found`),!1)}get hasActiveModals(){return this._activeModals.size>0}back(){if(this._activeModals.size===0)return this._debugPrint("No active modals to go back from"),!1;let t=Array.from(this._activeModals).pop();return this.close(t)}closeAll(){let t=this._activeModals.size;return this._activeModals.clear(),this._notify(D.CLOSE_ALL,{}),t}subscribe(t,e){var i;return this._subscribers.has(t)||this._subscribers.set(t,new Set),(i=this._subscribers.get(t))==null||i.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){var i;this._subscribers.has(t)&&((i=this._subscribers.get(t))==null||i.delete(e))}_notify(t,e){var i;if(this._subscribers.has(t))for(let r of(i=this._subscribers.get(t))!=null?i:new Set)try{r(e)}catch(o){this._debugPrint("Error in modal subscriber:",o)}}destroy(){this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(D.DESTROY,{})}};n(sr,"ModalManager");var Di=sr;function dn(s,t){let e=s.querySelectorAll("[data-testid]");if(e.length===0)return;let i=new WeakMap;for(let r of e){let o=r.getAttribute("data-testid");o&&i.set(r,o)}t.subConfigValue("testMode",r=>{if(!r){for(let a of e)a.removeAttribute("data-testid");return}let o=t.testId;for(let a of e){let l=i.get(a);l&&a.setAttribute("data-testid",`${o}--${l}`)}})}n(dn,"testModeProcessor");var vc="uc-",Ft=class Ft extends _e{constructor(){super();d(this,"requireCtxName",!1);d(this,"activityType",null);d(this,"init$",Xs());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(on),this.addTemplateProcessor(dn)}l10n(e,i={}){if(!e)return"";let r=this.$[oe(e)]||e,o=zo(r);for(let l of o)i[l.variable]=this.pluralize(l.pluralKey,Number(i[l.countVariable]));return Ut(r,i)}pluralize(e,i){let r=this.l10n("locale-id")||"en",o=Ci(r,i);return this.l10n(`${e}__${o}`)}bindL10n(e,i){var r;(r=this.localeManager)==null||r.bindL10n(this,e,i)}emit(e,i,r){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(e,i,r)}hasBlockInCtx(e){for(let i of this.blocksRegistry)if(e(i))return!0;return!1}setOrAddState(e,i){this.add$({[e]:i},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(i=>{this.setAttribute(i,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Bo({element:this,attribute:"ctx-name",onSuccess:n(()=>{super.connectedCallback()},"onSuccess"),onTimeout:n(()=>{console.error("Attribute `ctx-name` is required and it is not set.")},"onTimeout")}):super.connectedCallback(),Pt.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Pt.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new wi(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Ui(this)),this.has("*a11y")||this.add("*a11y",new Ri),this.has("*modalManager")||this.add("*modalManager",new Di(this)),this.sub(oe("locale-id"),i=>{let r=Fo(i);this.style.direction=r==="ltr"?"":r}),this.subConfigValue("testMode",i=>{if(!i||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId)})}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.has("*modalManager")&&this.$["*modalManager"]}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var i;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(i=this.localeManager)==null||i.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,T.deleteCtx(this),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e,i;T.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy(),this.modalManager&&((i=this.modalManager)==null||i.destroy())}async proxyUrl(e){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(e,{uuid:vi(e),cdnUrlModifiers:Es(e),fileName:_i(e)})}catch(i){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",i),e}return this.cfg.secureDeliveryProxy?Ut(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:n(i=>window.encodeURIComponent(i),"transform")}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:n((i,r,o)=>{if(typeof r!="string")return!1;let a=j(r);return this.has(a)||this.add(a,re[r]),this.$[a]=o,!0},"set"),get:n((i,r)=>{let o=j(r);return this.has(o)||this.add(o,re[r]),this.$[j(r)]},"get")})}return this.__cfgProxy}subConfigValue(e,i){let r=j(e);this.has(r)||this.add(r,re[e]),this.sub(r,i)}debugPrint(...e){if(!this.cfg.debug)return;let i=e;if(typeof(e==null?void 0:e[0])=="function"){let r=e[0];i=r()}console.log(`[${this.ctxName}]`,...i)}static reg(e){if(!e){super.reg();return}e.startsWith(vc)&&super.reg(e)}};n(Ft,"Block"),d(Ft,"StateConsumerScope",null),d(Ft,"styleAttrs",[]);var y=Ft;var hn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Fi=class Fi extends y{constructor(){super(...arguments);d(this,"requireCtxName",!0);d(this,"init$",Li(this));d(this,"_template",null)}initCallback(){var e;super.initCallback(),(e=this.a11y)==null||e.registerBlock(this)}static set template(e){this._template=hn+e+"<slot></slot>"}static get template(){return this._template}};n(Fi,"SolutionBlock"),d(Fi,"styleAttrs",["uc-wgt-common"]);var ce=Fi;var pn="active",Nt="___ACTIVITY_IS_ACTIVE___",ue=class ue extends y{constructor(){super(...arguments);d(this,"historyTracked",!1);d(this,"init$",qs(this));d(this,"_debouncedHistoryFlush",M(this._historyFlush.bind(this),10))}_deactivate(){var i;let e=ue._activityCallbacks.get(this);this[Nt]=!1,this.removeAttribute(pn),(i=e==null?void 0:e.deactivateCallback)==null||i.call(e)}_activate(){var i;let e=ue._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Nt]=!0,this.setAttribute(pn,""),(i=e==null?void 0:e.activateCallback)==null||i.call(e),this._debouncedHistoryFlush(),this.emit($.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",e=>{var i;try{this.activityType!==e&&this[Nt]?this._deactivate():this.activityType===e&&!this[Nt]&&this._activate()}catch(r){console.error(`Error in activity "${this.activityType}". `,r),this.$["*currentActivity"]=(i=this.$["*history"][this.$["*history"].length-1])!=null?i:null}e||(this.$["*history"]=[])}))}_historyFlush(){let e=this.$["*history"];e&&(e.length>10&&(e=e.slice(e.length-11,e.length-1)),this.historyTracked&&e[e.length-1]!==this.activityType&&e.push(this.activityType),this.$["*history"]=e)}_isActivityRegistered(){return this.activityType&&ue._activityCallbacks.has(this)}get isActivityActive(){return this[Nt]}get couldOpenActivity(){return!0}registerActivity(e,i={}){let{onActivate:r,onDeactivate:o}=i;ue._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),ue._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let e=this.$["*currentActivity"];!![...this.blocksRegistry].find(r=>r instanceof ue&&r.activityType===e)||(this.$["*currentActivity"]=null,this.modalManager.closeAll())}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var i;let e=this.$["*history"];if(e){let r=e.pop();for(;r===this.activityType;)r=e.pop();let o=!!r;if(r){let a=[...this.blocksRegistry].find(l=>l.activityType===r);o=(i=a==null?void 0:a.couldOpenActivity)!=null?i:!1}r=o?r:void 0,r&&this.modalManager.open(r),this.$["*currentActivity"]=r,this.$["*history"]=e,r||this.modalManager.closeAll()}}};n(ue,"ActivityBlock"),d(ue,"_activityCallbacks",new Map);var b=ue;b.activities=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Vt=33.333333333333336,A=1,rr=24,fn=6;function Me(s,t){for(let e in t)s.setAttributeNS(null,e,t[e].toString())}n(Me,"setSvgNodeAttrs");function ee(s,t={}){let e=document.createElementNS("http://www.w3.org/2000/svg",s);return Me(e,t),e}n(ee,"createSvgNode");function mn(s,t,e){let{x:i,y:r,width:o,height:a}=s,l=t.includes("w")?0:1,c=t.includes("n")?0:1,u=[-1,1][l],p=[-1,1][c],h=[i+l*o+1.5*u,r+c*a+1.5*p-24*e*p],f=[i+l*o+1.5*u,r+c*a+1.5*p],m=[i+l*o-24*e*u+1.5*u,r+c*a+1.5*p];return{d:`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,center:f}}n(mn,"cornerPath");function gn(s,t,e){let{x:i,y:r,width:o,height:a}=s,l=["n","s"].includes(t)?.5:{w:0,e:1}[t],c=["w","e"].includes(t)?.5:{n:0,s:1}[t],u=[-1,1][l],p=[-1,1][c],h,f;["n","s"].includes(t)?(h=[i+l*o-34*e/2,r+c*a+1.5*p],f=[i+l*o+34*e/2,r+c*a+1.5*p]):(h=[i+l*o+1.5*u,r+c*a-34*e/2],f=[i+l*o+1.5*u,r+c*a+34*e/2]);let m=`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,g=[f[0]-(f[0]-h[0])/2,f[1]-(f[1]-h[1])/2];return{d:m,center:g}}n(gn,"sidePath");function bn(s){return s===""?"move":["e","w"].includes(s)?"ew-resize":["n","s"].includes(s)?"ns-resize":["nw","se"].includes(s)?"nwse-resize":"nesw-resize"}n(bn,"thumbCursor");function _n({rect:s,delta:[t,e],imageBox:i}){return st({...s,x:s.x+t,y:s.y+e},i)}n(_n,"moveRect");function st(s,t){let{x:e}=s,{y:i}=s;return s.x<t.x?e=t.x:s.x+s.width>t.x+t.width&&(e=t.x+t.width-s.width),s.y<t.y?i=t.y:s.y+s.height>t.y+t.height&&(i=t.y+t.height-s.height),{...s,x:e,y:i}}n(st,"constraintRect");function yc({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[,r]=t,{y:o,width:a,height:l}=s;o+=r,l-=r,e&&(a=l*e);let c=s.x+s.width/2-a/2;return o<=i.y&&(o=i.y,l=s.y+s.height-o,e&&(a=l*e,c=s.x+s.width/2-a/2)),c<=i.x&&(c=i.x,o=s.y+s.height-l),c+a>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-a),a=i.x+i.width-c,e&&(l=a/e),o=s.y+s.height-l),l<A&&(l=A,e&&(a=l*e,c=s.x+s.width/2-a/2),o=s.y+s.height-l),a<A&&(a=A,e&&(l=a/e,c=s.x+s.width/2-a/2),o=s.y+s.height-l),{x:c,y:o,width:a,height:l}}n(yc,"resizeNorth");function wc({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r]=t,{x:o,width:a,height:l}=s;o+=r,a-=r,e&&(l=a/e);let c=s.y+s.height/2-l/2;return o<=i.x&&(o=i.x,a=s.x+s.width-o,e&&(l=a/e,c=s.y+s.height/2-l/2)),c<=i.y&&(c=i.y,o=s.x+s.width-a),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(a=l*e),o=s.x+s.width-a),l<A&&(l=A,e&&(a=l*e),c=s.y+s.height/2-l/2,o=s.x+s.width-a),a<A&&(a=A,e&&(l=a/e),c=s.y+s.height/2-l/2,o=s.x+s.width-a),{x:o,y:c,width:a,height:l}}n(wc,"resizeWest");function Cc({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[,r]=t,{y:o,width:a,height:l}=s;l+=r,e&&(a=l*e);let c=s.x+s.width/2-a/2;return o+l>=i.y+i.height&&(l=i.y+i.height-o,e&&(a=l*e),c=s.x+s.width/2-a/2),c<=i.x&&(c=i.x,o=s.y),c+a>=i.x+i.width&&(c=Math.max(i.x,i.x+i.width-a),a=i.x+i.width-c,e&&(l=a/e),o=s.y),l<A&&(l=A,e&&(a=l*e),c=s.x+s.width/2-a/2),a<A&&(a=A,e&&(l=a/e),c=s.x+s.width/2-a/2),{x:c,y:o,width:a,height:l}}n(Cc,"resizeSouth");function xc({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r]=t,{x:o,width:a,height:l}=s;a+=r,e&&(l=a/e);let c=s.y+s.height/2-l/2;return o+a>=i.x+i.width&&(a=i.x+i.width-o,e&&(l=a/e),c=s.y+s.height/2-l/2),c<=i.y&&(c=i.y,o=s.x),c+l>=i.y+i.height&&(c=Math.max(i.y,i.y+i.height-l),l=i.y+i.height-c,e&&(a=l*e),o=s.x),l<A&&(l=A,e&&(a=l*e),c=s.y+s.height/2-l/2),a<A&&(a=A,e&&(l=a/e),c=s.y+s.height/2-l/2),{x:o,y:c,width:a,height:l}}n(xc,"resizeEast");function Ac({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:a,y:l,width:c,height:u}=s;return a+r<i.x&&(r=i.x-a),l+o<i.y&&(o=i.y-l),a+=r,c-=r,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,a=s.x+s.width-c,l=i.y)):e&&(r=u*e-c,c=c+r,a-=r,a<=i.x&&(c=c-(i.x-a),u=c/e,a=i.x,l=s.y+s.height-u)),u<A&&(u=A,e&&(c=u*e),a=s.x+s.width-c,l=s.y+s.height-u),c<A&&(c=A,e&&(u=c/e),a=s.x+s.width-c,l=s.y+s.height-u),{x:a,y:l,width:c,height:u}}n(Ac,"resizeNorthWest");function Ec({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:a,y:l,width:c,height:u}=s;return a+c+r>i.x+i.width&&(r=i.x+i.width-a-c),l+o<i.y&&(o=i.y-l),c+=r,l+=o,u-=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l-=o,l<=i.y&&(u=u-(i.y-l),c=u*e,a=s.x,l=i.y)):e&&(r=u*e-c,c+=r,a+c>=i.x+i.width&&(c=i.x+i.width-a,u=c/e,a=i.x+i.width-c,l=s.y+s.height-u)),u<A&&(u=A,e&&(c=u*e),l=s.y+s.height-u),c<A&&(c=A,e&&(u=c/e),l=s.y+s.height-u),{x:a,y:l,width:c,height:u}}n(Ec,"resizeNorthEast");function Tc({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:a,y:l,width:c,height:u}=s;return a+r<i.x&&(r=i.x-a),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),a+=r,c-=r,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,a=s.x+s.width-c,l=i.y+i.height-u)):e&&(r=u*e-c,c+=r,a-=r,a<=i.x&&(c=c-(i.x-a),u=c/e,a=i.x,l=s.y)),u<A&&(u=A,e&&(c=u*e),a=s.x+s.width-c),c<A&&(c=A,e&&(u=c/e),a=s.x+s.width-c),{x:a,y:l,width:c,height:u}}n(Tc,"resizeSouthWest");function Sc({rect:s,delta:t,aspectRatio:e,imageBox:i}){let[r,o]=t,{x:a,y:l,width:c,height:u}=s;return a+c+r>i.x+i.width&&(r=i.x+i.width-a-c),l+u+o>i.y+i.height&&(o=i.y+i.height-l-u),c+=r,u+=o,e&&Math.abs(c/u)>e?(o=c/e-u,u+=o,l+u>=i.y+i.height&&(u=i.y+i.height-l,c=u*e,a=s.x,l=i.y+i.height-u)):e&&(r=u*e-c,c+=r,a+c>=i.x+i.width&&(c=i.x+i.width-a,u=c/e,a=i.x+i.width-c,l=s.y)),u<A&&(u=A,e&&(c=u*e)),c<A&&(c=A,e&&(u=c/e)),{x:a,y:l,width:c,height:u}}n(Sc,"resizeSouthEast");function vn({direction:s,...t}){switch(s){case"n":return yc(t);case"w":return wc(t);case"s":return Cc(t);case"e":return xc(t);case"nw":return Ac(t);case"ne":return Ec(t);case"sw":return Tc(t);case"se":return Sc(t);default:return t.rect}}n(vn,"resizeRect");function yn(s,[t,e]){return s.x<=t&&t<=s.x+s.width&&s.y<=e&&e<=s.y+s.height}n(yn,"rectContainsPoint");function wn(s,t){return s.x>=t.x&&s.y>=t.y&&s.x+s.width<=t.x+t.width&&s.y+s.height<=t.y+t.height}n(wn,"isRectInsideRect");function Cn(s,t){return Math.abs(s.width/s.height-t)<.1}n(Cn,"isRectMatchesAspectRatio");function rt({width:s,height:t},e){let i=e/90%2!==0;return{width:i?t:s,height:i?s:t}}n(rt,"rotateSize");function xn(s,t,e){let i=s/t,r,o;i>e?(r=Math.round(t*e),o=t):(r=s,o=Math.round(s/e));let a=Math.round((s-r)/2),l=Math.round((t-o)/2);return a+r>s&&(r=s-a),l+o>t&&(o=t-l),{x:a,y:l,width:r,height:o}}n(xn,"calculateMaxCenteredCropFrame");function ot(s){return{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}n(ot,"roundRect");function Le(s,t,e){return Math.min(Math.max(s,t),e)}n(Le,"clamp");var Vi=n(s=>{if(!s)return[];let[t,e]=s.split(":").map(Number);if(!Number.isFinite(t)||!Number.isFinite(e)){console.error(`Invalid crop preset: ${s}`);return}return[{type:"aspect-ratio",width:t,height:e}]},"parseCropPreset");var Fe="blocks",Ne="1.19.1";function An(s){return Us({...s,libraryName:Fe,libraryVersion:Ne})}n(An,"customUserAgent");var En=n(s=>Math.floor(s/1e3),"msToUnixTimestamp"),Tn=n((s,{threshold:t})=>{let{secureExpire:e}=s,i=En(Date.now()),r=Number(e),o=En(t);return i+o>=r},"isSecureTokenExpired");var or=class or{constructor(t){d(this,"_block");d(this,"_secureToken",null);this._block=t}_debugPrint(...t){this._block.debugPrint("[secure-uploads]",...t)}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:i}=this._block.cfg;if((t||e)&&i&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),i){if(!this._secureToken||Tn(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let r=await i();r?!r.secureSignature||!r.secureExpire?console.error("Secure signature resolver returned an invalid result:",r):(this._debugPrint("Secure signature resolved:",r),this._debugPrint("Secure signature will expire in",new Date(Number(r.secureExpire)*1e3).toISOString()),this._secureToken=r):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(r){console.error("Secure signature resolving failed. Falling back to the previous one.",r)}}return this._secureToken}return t&&e?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}};n(or,"SecureUploadsManager");var zi=or;var Sn="[Typed State] Wrong property name: ",Ic="[Typed State] Wrong property type: ",nr=class nr{constructor(t,e){this.__typedSchema=t,this.__ctxId=e||Ue.generate(),this.__schema=Object.keys(t).reduce((i,r)=>(i[r]=t[r].value,i),{}),this.__data=T.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(t,e){if(!this.__typedSchema.hasOwnProperty(t)){console.warn(Sn+t);return}let i=this.__typedSchema[t],r=(e==null?void 0:e.constructor)===i.type,o=e instanceof i.type,a=i.nullable&&e===null;if(r||o||a){this.__data.pub(t,e);return}console.warn(Ic+t)}setMultipleValues(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}getValue(t){return this.__typedSchema.hasOwnProperty(t)||console.warn(Sn+t),this.__data.read(t)}subscribe(t,e){return this.__data.sub(t,e)}remove(){T.deleteCtx(this.__ctxId)}};n(nr,"TypedData");var Bi=nr;var ar=class ar{constructor(t){this.__typedSchema=t.typedSchema,this.__ctxId=t.ctxName||Ue.generate(),this.__data=T.registerCtx({},this.__ctxId),this.__watchList=t.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let e=Object.create(null);this.__notifyObservers=(i,r)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),e[i]||(e[i]=new Set),e[i].add(r),this.__observeTimeout=window.setTimeout(()=>{Object.keys(e).length!==0&&(this.__propertyObservers.forEach(o=>{o({...e})}),e=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let t=new Set(this.__added),e=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let i of this.__collectionObservers)i==null||i([...this.__items],t,e)})}observeCollection(t){return this.__collectionObservers.add(t),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(t)}}unobserveCollection(t){var e;(e=this.__collectionObservers)==null||e.delete(t)}add(t){let e=new Bi(this.__typedSchema);for(let[i,r]of Object.entries(t))e.setValue(i,r);return this.__items.add(e.uid),this.notify(),this.__data.add(e.uid,e),this.__added.add(e),this.__watchList.forEach(i=>{this.__subsMap[e.uid]||(this.__subsMap[e.uid]=[]),this.__subsMap[e.uid].push(e.subscribe(i,()=>{this.__notifyObservers(i,e.uid)}))}),e.uid}read(t){return this.__data.read(t)}readProp(t,e){let i=this.read(t);return i?i.getValue(e):(console.warn(`Item with id ${t} not found`),null)}publishProp(t,e,i){let r=this.read(t);if(!r){console.warn(`Item with id ${t} not found`);return}r.setValue(e,i)}remove(t){let e=this.read(t);e&&this.__removed.add(e),this.__items.delete(t),this.notify(),this.__data.pub(t,null),delete this.__subsMap[t]}clearAll(){this.__items.forEach(t=>{this.remove(t)})}observeProperties(t){return this.__propertyObservers.add(t),()=>{this.unobserveProperties(t)}}unobserveProperties(t){var e;(e=this.__propertyObservers)==null||e.delete(t)}findItems(t){let e=[];return this.__items.forEach(i=>{let r=this.read(i);r&&t(r)&&e.push(i)}),e}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){T.deleteCtx(this.__ctxId),this.__propertyObservers=new Set,this.__collectionObservers=new Set;for(let t in this.__subsMap)this.__subsMap[t].forEach(e=>{e.remove()}),delete this.__subsMap[t]}};n(ar,"TypedCollection");var Hi=ar;var S=Object.freeze({PHOTO:"photo",VIDEO:"video"}),ie=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var lr=n(s=>({isVideoRecordingEnabled:K(s.cameraModes).includes(S.VIDEO),isPhotoEnabled:K(s.cameraModes).includes(S.PHOTO)}),"calcCameraModes");var Ae=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),cr=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),L=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...cr,...Ae});var Oc=n(()=>{let s=navigator.userAgent;return/Macintosh|Windows/.test(s)&&/Version\/[\d\.]+.*Safari/.test(s)&&!/Chrome|Chromium|Edg|OPR/.test(s)},"calcIsDesktopSafari"),kc=n(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),$c=n(()=>({safariDesktop:Oc()}),"calcBrowserInfo"),Mc=n(()=>({htmlMediaCapture:kc()}),"calcBrowserFeatures"),In=$c(),Ve=Mc();var zt="image/*",ur="video/*",Lc=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Pc=n(()=>In.safariDesktop?[zt]:[zt,...Lc],"calcImageAcceptList"),Bt=Pc(),ji=n(s=>s?s.filter(t=>typeof t=="string").map(t=>V(t)).flat():[],"mergeFileTypes"),dr=n((s,t)=>t.some(e=>e.endsWith("*")?(e=e.replace("*",""),s.startsWith(e)):s===e),"matchMimeType"),On=n((s,t)=>t.some(e=>e.startsWith(".")?s.toLowerCase().endsWith(e.toLowerCase()):!1),"matchExtension"),kn=n(s=>{let t=s==null?void 0:s.type;return t?dr(t,Bt):!1},"fileIsImage");var Uc=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Rc=new RegExp(`^/?(${Uc.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),$n=n(({url:s,cdnBase:t})=>{let e=new URL(t),i=new URL(s);if(e.host!==i.host)return null;let[,r,o,a]=Rc.exec(i.pathname);return{uuid:r,cdnUrlModifiers:o||"",filename:a||null}},"parseCdnUrl");var Mn=n(s=>{let t=new Map;return(...e)=>{let i=JSON.stringify(e);if(t.has(i))return t.get(i);let r=s(...e);return t.set(i,r),r}},"memoize");var Ln=new Set;function Gi(s){Ln.has(s)||(Ln.add(s),console.warn(s))}n(Gi,"warnOnce");function Dc(s){let t=!1;return setTimeout(()=>{t=!0},0),n(i=>(...r)=>(t&&Gi(s),i(...r)),"withAssert")}n(Dc,"createAsyncAssertWrapper");function Pn(s){let t={progress:n(()=>s.$["*commonProgress"],"progress"),errors:n(()=>s.$["*collectionErrors"],"errors"),group:n(()=>s.$["*groupInfo"],"group"),totalCount:n(()=>s.uploadCollection.size,"totalCount"),failedCount:n(()=>e.failedEntries.length,"failedCount"),successCount:n(()=>e.successEntries.length,"successCount"),uploadingCount:n(()=>e.uploadingEntries.length,"uploadingCount"),status:n(()=>e.isFailed?"failed":e.isUploading?"uploading":e.isSuccess?"success":"idle","status"),isSuccess:n(()=>e.allEntries.length>0&&e.errors.length===0&&e.successEntries.length===e.allEntries.length,"isSuccess"),isUploading:n(()=>e.allEntries.some(r=>r.status==="uploading"),"isUploading"),isFailed:n(()=>e.errors.length>0||e.failedEntries.length>0,"isFailed"),allEntries:n(()=>s.getOutputData(),"allEntries"),successEntries:n(()=>e.allEntries.filter(r=>r.status==="success"),"successEntries"),failedEntries:n(()=>e.allEntries.filter(r=>r.status==="failed"),"failedEntries"),uploadingEntries:n(()=>e.allEntries.filter(r=>r.status==="uploading"),"uploadingEntries"),idleEntries:n(()=>e.allEntries.filter(r=>r.status==="idle"),"idleEntries")},e={},i=Dc("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[r,o]of Object.entries(t)){let a=r,c=Mn(i(o));Object.defineProperty(e,a,{get:c,enumerable:!0})}return e}n(Pn,"buildOutputCollectionState");var hr=class hr{constructor(t){d(this,"_ctx");d(this,"addFileFromUrl",n((t,{silent:e,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({externalUrl:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:r!=null?r:L.API});return this.getOutputItem(o)},"addFileFromUrl"));d(this,"addFileFromUuid",n((t,{silent:e,fileName:i,source:r}={})=>{let o=this._uploadCollection.add({uuid:t,fileName:i!=null?i:null,silent:e!=null?e:!1,source:r!=null?r:L.API});return this.getOutputItem(o)},"addFileFromUuid"));d(this,"addFileFromCdnUrl",n((t,{silent:e,fileName:i,source:r}={})=>{var l;let o=$n({url:t,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let a=this._uploadCollection.add({uuid:o.uuid,cdnUrl:t,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(l=i!=null?i:o.filename)!=null?l:null,silent:e!=null?e:!1,source:r!=null?r:L.API});return this.getOutputItem(a)},"addFileFromCdnUrl"));d(this,"addFileFromObject",n((t,{silent:e,fileName:i,source:r,fullPath:o}={})=>{let a=this._uploadCollection.add({file:t,isImage:kn(t),mimeType:t.type,fileName:i!=null?i:t.name,fileSize:t.size,silent:e!=null?e:!1,source:r!=null?r:L.API,fullPath:o!=null?o:null});return this.getOutputItem(a)},"addFileFromObject"));d(this,"removeFileByInternalId",n(t=>{if(!this._uploadCollection.read(t))throw new Error(`File with internalId ${t} not found`);this._uploadCollection.remove(t)},"removeFileByInternalId"));d(this,"uploadAll",n(()=>{let t=this._uploadCollection.items().filter(e=>{let i=this._uploadCollection.read(e);return i?!i.getValue("isRemoved")&&!i.getValue("isUploading")&&!i.getValue("fileInfo"):!1});t.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(t),this._ctx.emit($.COMMON_UPLOAD_START,this.getOutputCollectionState()))},"uploadAll"));d(this,"openSystemDialog",n((t={})=>{var o;let e=ye(ji([(o=this.cfg.accept)!=null?o:"",...this.cfg.imgOnly?Bt:[]])),i="uploadcare-file-input",r=document.createElement("input");if(r.setAttribute(i,""),Mt(r,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),r.type="file",r.multiple=this.cfg.multiple,t.captureCamera){r.capture=this.cfg.cameraCapture;let{isPhotoEnabled:a,isVideoRecordingEnabled:l}=lr(this.cfg);t.modeCamera===S.PHOTO&&a?r.accept=zt:t.modeCamera===S.VIDEO&&l?r.accept=ur:r.accept=[zt,l&&ur].filter(Boolean).join(",")}else r.accept=e;r.addEventListener("change",()=>{r.files&&([...r.files].forEach(a=>this.addFileFromObject(a,{source:t.captureCamera?L.CAMERA:L.LOCAL})),this._ctx.modalManager.open(b.activities.UPLOAD_LIST),this._ctx.$["*currentActivity"]=b.activities.UPLOAD_LIST,r.remove())},{once:!0}),document.querySelectorAll(`[${i}]`).forEach(a=>a.remove()),document.body.appendChild(r),r.dispatchEvent(new MouseEvent("click"))},"openSystemDialog"));d(this,"getOutputItem",n(t=>{var a,l,c,u,p,h,f,m,g,_;let e=T.getCtx(t).store,i=e.fileInfo,r=e.isRemoved?"removed":e.errors.length>0?"failed":e.fileInfo?"success":e.isUploading?"uploading":"idle";return{uuid:(l=(a=i==null?void 0:i.uuid)!=null?a:e.uuid)!=null?l:null,internalId:t,name:(c=i==null?void 0:i.originalFilename)!=null?c:e.fileName,size:(u=i==null?void 0:i.size)!=null?u:e.fileSize,isImage:(p=i==null?void 0:i.isImage)!=null?p:e.isImage,mimeType:(h=i==null?void 0:i.mimeType)!=null?h:e.mimeType,file:e.file,externalUrl:e.externalUrl,cdnUrlModifiers:e.cdnUrlModifiers,cdnUrl:(m=(f=e.cdnUrl)!=null?f:i==null?void 0:i.cdnUrl)!=null?m:null,fullPath:e.fullPath,uploadProgress:e.uploadProgress,fileInfo:i!=null?i:null,metadata:(_=(g=e.metadata)!=null?g:i==null?void 0:i.metadata)!=null?_:null,isSuccess:r==="success",isUploading:r==="uploading",isFailed:r==="failed",isRemoved:r==="removed",errors:e.errors,status:r,source:e==null?void 0:e.source}},"getOutputItem"));d(this,"getOutputCollectionState",n(()=>Pn(this._ctx),"getOutputCollectionState"));d(this,"initFlow",n((t=!1)=>{var e,i,r,o;if(this._uploadCollection.size>0&&!t)(e=this._ctx.modalManager)==null||e.open(b.activities.UPLOAD_LIST),this._ctx.set$({"*currentActivity":b.activities.UPLOAD_LIST});else if(((i=this._sourceList)==null?void 0:i.length)===1){let a=this._sourceList[0];if(a==="local"){this._ctx.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.openSystemDialog();return}if(a==="camera"&&Ve.htmlMediaCapture){let{isPhotoEnabled:p,isVideoRecordingEnabled:h}=lr(this.cfg);if(p&&h){this._ctx.set$({"*currentActivity":b.activities.START_FROM});return}else if(p||h){this.openSystemDialog({captureCamera:!0,modeCamera:p?S.PHOTO:S.VIDEO});return}else this.openSystemDialog({captureCamera:!0,modeCamera:S.PHOTO})}let l=this._ctx.$["*blocksRegistry"],c=n(p=>"type"in p&&p.type===a,"isSourceBtn"),u=[...l].find(c);u==null||u.activate(),this._ctx.$["*currentActivity"]&&((r=this._ctx.modalManager)==null||r.open(this._ctx.$["*currentActivity"]))}else(o=this._ctx.modalManager)==null||o.open(b.activities.START_FROM),this._ctx.set$({"*currentActivity":b.activities.START_FROM})},"initFlow"));d(this,"doneFlow",n(()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.modalManager.closeAll()},"doneFlow"));d(this,"setCurrentActivity",n((t,e=void 0)=>{if(this._ctx.hasBlockInCtx(i=>i.activityType===t)){this._ctx.set$({"*currentActivityParams":e!=null?e:{},"*currentActivity":t});return}console.warn(`Activity type "${t}" not found in the context`)},"setCurrentActivity"));d(this,"getCurrentActivity",n(()=>this._ctx.$["*currentActivity"],"getCurrentActivity"));d(this,"setModalState",n(t=>{var e,i;if(t&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?(e=this._ctx.modalManager)==null||e.open(this._ctx.$["*currentActivity"]):((i=this._ctx.modalManager)==null||i.close(this._ctx.$["*currentActivity"]),this._ctx.$["*currentActivity"]=null)},"setModalState"));this._ctx=t}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}get _sourceList(){let t=[];return this.cfg.sourceList&&(t=V(this.cfg.sourceList)),t}};n(hr,"UploaderPublicApi");var Wi=hr;var pr=n((s,t)=>{let e=t.cfg.imgOnly,i=s.isImage;if(!(!e||i)&&!(!s.fileInfo&&s.externalUrl)&&!(!s.fileInfo&&!s.mimeType))return{type:"NOT_AN_IMAGE",message:t.l10n("images-only-accepted"),payload:{entry:s}}},"validateIsImage");var fr=n((s,t)=>{let e=t.cfg.imgOnly,i=t.cfg.accept,r=ji([...e?Bt:[],i]);if(!r.length)return;let o=s.mimeType,a=s.name;if(!o||!a)return;let l=dr(o,r),c=On(a,r);if(!l&&!c)return{type:"FORBIDDEN_FILE_TYPE",message:t.l10n("file-type-not-allowed"),payload:{entry:s}}},"validateFileType");var he=1e3,ze=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Ht=n(s=>Math.ceil(s*100)/100,"round"),Un=n((s,t=ze.AUTO)=>{let e=t===ze.AUTO;if(t===ze.BYTE||e&&s<he**1){let i=Ci("en-US",s),r={one:"byte",other:"bytes"}[i];return`${s} ${r}`}return t===ze.KB||e&&s<he**2?`${Ht(s/he**1)} KB`:t===ze.MB||e&&s<he**3?`${Ht(s/he**2)} MB`:t===ze.GB||e&&s<he**4?`${Ht(s/he**3)} GB`:t===ze.TB||e&&s<he**5?`${Ht(s/he**4)} TB`:`${Ht(s/he**5)} PB`},"prettyBytes");var mr=n((s,t)=>{let e=t.cfg.maxLocalFileSizeBytes,i=s.size;if(e&&i&&i>e)return{type:"FILE_SIZE_EXCEEDED",message:t.l10n("files-max-size-limit-error",{maxFileSize:Un(e)}),payload:{entry:s}}},"validateMaxSizeLimit");var gr=n((s,t)=>{let{internalId:e}=s,i=t._uploadCollection.read(e),r=i==null?void 0:i.getValue("uploadError");if(!r)return;if(r instanceof H)return{type:"UPLOAD_ERROR",message:r.message,payload:{entry:s,error:r}};if(r instanceof et)return{type:"NETWORK_ERROR",message:r.message,payload:{entry:s,error:r}};let o=r instanceof Error?r:new Error("Unknown error",{cause:r});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:s,error:o}}},"validateUploadError");var br=n((s,t)=>{if(s.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:t.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var _r=n((s,t)=>{let e=s.totalCount,i=t.cfg.multiple?t.cfg.multipleMin:0,r=t.cfg.multiple?t.cfg.multipleMax:1;if(i&&e<i)return{type:"TOO_FEW_FILES",message:t.l10n("files-count-limit-error-too-few",{min:i,max:r,total:e}),payload:{total:e,min:i,max:r}};if(r&&e>r)return{type:"TOO_MANY_FILES",message:t.l10n("files-count-limit-error-too-many",{min:i,max:r,total:e}),payload:{total:e,min:i,max:r}}},"validateMultiple");var Xi={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},vr=class vr{constructor(t){d(this,"_blockInstance");d(this,"_fileValidators",[pr,fr,mr,gr]);d(this,"_collectionValidators",[_r,br]);this._blockInstance=t,this._uploadCollection=this._blockInstance.uploadCollection;let e=n(()=>{this.runFileValidators(),this.runCollectionValidators()},"runAllValidators");this._blockInstance.subConfigValue("maxLocalFileSizeBytes",e),this._blockInstance.subConfigValue("multipleMin",e),this._blockInstance.subConfigValue("multipleMax",e),this._blockInstance.subConfigValue("multiple",e),this._blockInstance.subConfigValue("imgOnly",e),this._blockInstance.subConfigValue("accept",e)}runFileValidators(t){let e=t!=null?t:this._uploadCollection.items();for(let i of e){let r=this._uploadCollection.read(i);r&&this._runFileValidatorsForEntry(r)}}runCollectionValidators(){let t=this._blockInstance.api.getOutputCollectionState(),e=[];for(let i of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let r=i(t,this._blockInstance.api);if(!r)continue;r&&(e.push(r),r.message||console.warn(Xi.message))}catch(r){console.warn(Xi.collection,r)}this._blockInstance.$["*collectionErrors"]=e,e.length>0&&this._blockInstance.emit($.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(t){let e=this._blockInstance.api.getOutputItem(t.uid),i=[];for(let r of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=r(e,this._blockInstance.api);if(!o)continue;o&&(i.push(o),o.message||console.warn(Xi.message))}catch(o){console.warn(Xi.file,o)}t.setValue("errors",i)}_addCustomTypeToValidators(t){return t.map(e=>(...i)=>{let r=e(...i);return r?{...r,type:"CUSTOM_ERROR"}:void 0})}};n(vr,"ValidationManager");var qi=vr;var Rn=Object.freeze({file:Object.freeze({type:File,value:null,nullable:!0}),externalUrl:Object.freeze({type:String,value:null,nullable:!0}),fileName:Object.freeze({type:String,value:null,nullable:!0}),fileSize:Object.freeze({type:Number,value:null,nullable:!0}),lastModified:Object.freeze({type:Number,value:Date.now()}),uploadProgress:Object.freeze({type:Number,value:0}),uuid:Object.freeze({type:String,value:null,nullable:!0}),isImage:Object.freeze({type:Boolean,value:!1}),mimeType:Object.freeze({type:String,value:null,nullable:!0}),ctxName:Object.freeze({type:String,value:null,nullable:!0}),cdnUrl:Object.freeze({type:String,value:null,nullable:!0}),cdnUrlModifiers:Object.freeze({type:String,value:null,nullable:!0}),fileInfo:Object.freeze({type:Ce,value:null,nullable:!0}),isUploading:Object.freeze({type:Boolean,value:!1}),abortController:Object.freeze({type:AbortController,value:null,nullable:!0}),thumbUrl:Object.freeze({type:String,value:null,nullable:!0}),silent:Object.freeze({type:Boolean,value:!1}),source:Object.freeze({type:String,value:null,nullable:!0}),fullPath:Object.freeze({type:String,value:null,nullable:!0}),metadata:Object.freeze({type:Object,value:null,nullable:!0}),errors:Object.freeze({type:Array,value:[]}),uploadError:Object.freeze({type:Error,value:null,nullable:!0}),isRemoved:Object.freeze({type:Boolean,value:!1}),isQueued:Object.freeze({type:Boolean,value:!1})});var Zi=class Zi extends b{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!1);d(this,"isCtxOwner",!1);d(this,"init$",Li(this));d(this,"_flushOutputItems",M(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let i=this.api.getOutputCollectionState();this.$["*collectionState"]=i,this.emit($.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&i.totalCount>0&&i.status==="success"&&this._createGroup(i)},300));d(this,"_handleCollectionUpdate",n((e,i,r)=>{var o;(i.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let a of i)a.getValue("silent")||this.emit($.FILE_ADDED,this.api.getOutputItem(a.uid));for(let a of r){this.$["*uploadTrigger"].delete(a.uid),(o=a.getValue("abortController"))==null||o.abort(),a.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0});let l=a==null?void 0:a.getValue("thumbUrl");l&&URL.revokeObjectURL(l),this.emit($.FILE_REMOVED,this.api.getOutputItem(a.uid))}this.$["*uploadList"]=e.map(a=>({uid:a})),this._flushCommonUploadProgress(),this._flushOutputItems()},"_handleCollectionUpdate"));d(this,"_handleCollectionPropertiesUpdate",n(e=>{this._flushOutputItems();let i=this.uploadCollection,r=[...new Set(Object.entries(e).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(r.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(r)}),e.uploadProgress){for(let o of e.uploadProgress){let{isUploading:a,silent:l}=T.getCtx(o).store;a&&!l&&this.emit($.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(e.isUploading)for(let o of e.isUploading){let{isUploading:a,silent:l}=T.getCtx(o).store;a&&!l&&this.emit($.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(e.fileInfo){for(let o of e.fileInfo){let{fileInfo:a,silent:l}=T.getCtx(o).store;a&&!l&&this.emit($.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop(),this.cfg.cloudImageEditorAutoOpen&&this.openCloudImageEditor()}if(e.errors){for(let l of e.errors){let{errors:c}=T.getCtx(l).store;c.length>0&&(this.emit($.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit($.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=i.findItems(l=>!!l.getValue("fileInfo")),a=i.findItems(l=>l.getValue("errors").length>0);i.size>0&&a.length===0&&i.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit($.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}e.cdnUrl&&([...e.cdnUrl].filter(a=>{var l;return!!((l=this.uploadCollection.read(a))!=null&&l.getValue("cdnUrl"))}).forEach(a=>{this.emit($.FILE_URL_CHANGED,this.api.getOutputItem(a))}),this.$["*groupInfo"]=null)},"_handleCollectionPropertiesUpdate"));d(this,"_flushCommonUploadProgress",n(()=>{let e=0,r=[...this.$["*uploadTrigger"]].filter(a=>!!this.uploadCollection.read(a));r.forEach(a=>{let l=this.uploadCollection.readProp(a,"uploadProgress");typeof l=="number"&&(e+=l)});let o=r.length?Math.round(e/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit($.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))},"_flushCommonUploadProgress"))}get hasCtxOwner(){return this.hasBlockInCtx(e=>e instanceof Zi?e.isCtxOwner&&e.isConnected&&e!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let e=new Hi({typedSchema:Rn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",e)}this.has("*publicApi")||this.add("*publicApi",new Wi(this)),this.has("*validationManager")||this.add("*validationManager",new qi(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this.initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){var e,i;(e=this._unobserveCollectionProperties)==null||e.call(this),(i=this._unobserveCollection)==null||i.call(this),this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}destroyCallback(){super.destroyCallback(),this._flushOutputItems.cancel()}initCtxOwner(){this.isCtxOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxConcurrentRequests",e=>{this.$["*uploadQueue"].concurrency=Number(e)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new zi(this))}async _createGroup(e){let i=await this.getUploadClientOptions(),r=e.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),o=new AbortController,a=await tn(r,{...i,signal:o.signal});if(this.$["*collectionState"]!==e){o.abort();return}this.$["*groupInfo"]=a;let l=this.api.getOutputCollectionState();this.emit($.GROUP_CREATED,l),this.emit($.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}openCloudImageEditor(){let[e]=this.uploadCollection.findItems(i=>!!i.getValue("fileInfo")&&i.getValue("isImage")).map(i=>this.uploadCollection.read(i));e&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(i=>i.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:e.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager.open(b.activities.CLOUD_IMG_EDIT))}setInitialCrop(){let e=Vi(this.cfg.cropPreset);if(e){let[i]=e,r=this.uploadCollection.findItems(o=>{var a;return!!o.getValue("fileInfo")&&o.getValue("isImage")&&!((a=o.getValue("cdnUrlModifiers"))!=null&&a.includes("/crop/"))}).map(o=>this.uploadCollection.read(o)).filter(Boolean);for(let o of r){let a=o.getValue("fileInfo");if(!a||!a.imageInfo){console.warn("Failed to get image info for entry",o.uid);continue}let{width:l,height:c}=a.imageInfo,u=i.width/i.height,p=xn(l,c,u),h=B(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),f=o.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",o.uid);continue}o.setMultipleValues({cdnUrlModifiers:h,cdnUrl:F(f,h)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(m=>m.activityType===b.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT,this.modalManager.open(b.activities.CLOUD_IMG_EDIT))}}}async getMetadataFor(e){let i=this.cfg.metadata||void 0;if(typeof i=="function"){let r=this.api.getOutputItem(e);return await i(r)}return i}async getUploadClientOptions(){let i=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:An,integration:this.cfg.userAgentIntegration,secureSignature:i==null?void 0:i.secureSignature,secureExpire:i==null?void 0:i.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(r=>this.api.getOutputItem(r))}};n(Zi,"UploaderBlock");var k=Zi;k.extSrcList=Object.freeze({...Ae});k.sourceTypes=Object.freeze({...L});var nt=n(s=>{var t;return(t=s.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:t.map(e=>e.toLowerCase()).join("-")},"toKebabCase");var P=n(s=>String(s),"asString"),J=n(s=>{let t=Number(s);if(Number.isNaN(t))throw new Error(`Invalid number: "${s}"`);return t},"asNumber"),O=n(s=>{if(typeof s=="undefined"||s===null)return!1;if(typeof s=="boolean")return s;if(s==="true"||s==="")return!0;if(s==="false")return!1;throw new Error(`Invalid boolean: "${s}"`)},"asBoolean"),Dn=n(s=>s==="auto"?s:O(s),"asStore"),Fn=n(s=>{let t=P(s);if(t!=="user"&&t!=="environment"&&t!=="")throw new Error(`Invalid value: "${t}"`);return t},"asCameraCapture"),Nn=n(s=>{let t=P(s);if(!Object.values(S).includes(t))throw new Error(`Invalid value: "${t}"`);return t},"asCameraMode"),Vn=n(s=>{let t=P(s),e=K(t);if(e.some(i=>!Object.values(S).includes(i)))throw new Error(`Invalid value: "${JSON.stringify(e)}"`);return t},"asCameraModes"),zn=n(s=>{if(typeof s=="object"&&!Array.isArray(s)||typeof s=="function")return s;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),yr=n(s=>{if(typeof s=="object")return s;throw new Error("Invalid value. Must be an object.")},"asObject"),Ki=n(s=>{if(typeof s=="function")return s;throw new Error("Invalid value. Must be a function.")},"asFunction"),wr=n(s=>{if(Array.isArray(s))return s;throw new Error("Must be an array.")},"asArray"),Bn=n(s=>{let t=P(s);if(["grid","list"].includes(t))return t;throw new Error(`Invalid value: "${t}"`)},"asFilesViewMode");var Fc={pubkey:P,multiple:O,multipleMin:J,multipleMax:J,confirmUpload:O,imgOnly:O,accept:P,externalSourcesPreferredTypes:P,externalSourcesEmbedCss:P,store:Dn,cameraMirror:O,cameraCapture:Fn,sourceList:P,topLevelOrigin:P,maxLocalFileSizeBytes:J,thumbSize:J,showEmptyList:O,useLocalImageEditor:O,useCloudImageEditor:O,cloudImageEditorTabs:P,removeCopyright:O,cropPreset:P,imageShrink:P,modalScrollLock:O,modalBackdropStrokes:O,sourceListWrap:O,remoteTabSessionKey:P,cdnCname:P,cdnCnamePrefixed:P,baseUrl:P,socialBaseUrl:P,secureSignature:P,secureExpire:P,secureDeliveryProxy:P,retryThrottledRequestMaxTimes:J,retryNetworkErrorMaxTimes:J,multipartMinFileSize:J,multipartChunkSize:J,maxConcurrentRequests:J,multipartMaxConcurrentRequests:J,multipartMaxAttempts:J,checkForUrlDuplicates:O,saveUrlForRecurrentUploads:O,groupOutput:O,userAgentIntegration:P,debug:O,localeName:P,metadata:zn,secureUploadsExpireThreshold:J,localeDefinitionOverride:yr,secureUploadsSignatureResolver:Ki,secureDeliveryProxyUrlResolver:Ki,iconHrefResolver:Ki,fileValidators:wr,collectionValidators:wr,cameraModes:Vn,defaultCameraMode:Nn,enableAudioRecording:O,enableVideoRecording:O,mediaRecorderOptions:yr,maxVideoRecordingDuration:J,filesViewMode:Bn,gridShowFileNames:O,cloudImageEditorAutoOpen:O,cloudImageEditorMaskHref:P,testMode:O},Hn=n((s,t)=>{if(!(typeof t=="undefined"||t===null))try{return Fc[s](t)}catch(e){return console.error(`Invalid value for config key "${s}".`,e),re[s]}},"normalizeConfigValue");var Nc=[{test:n(s=>s.accept&&!!s.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:n(s=>s.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:n(s=>s.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],jn=M(s=>{for(let{test:t,message:e}of Nc)t(s)&&Gi(e)},0);var Gn=n((s,t)=>{let e=new URL(t);return e.hostname=`${s}.${e.hostname}`,e.toString().replace(/\/$/,"")},"o"),Vc="0123456789abcdefghijklmnopqrstuvwxyz",Wn=n(s=>{if(s<=BigInt(0))return"0";let t="";for(;s>BigInt(0);){let e=s%BigInt(36);t=Vc[Number(e)]+t,s=s/BigInt(36)}return t},"c");var zc=n(async s=>{let t=new TextEncoder().encode(s),e=await window.crypto.subtle.digest("SHA-256",t),i=Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${i}`)},"c"),Bc=10,Hc=n(async s=>{let t=await zc(s);return Wn(t).slice(0,Bc)},"h"),Xn=n(async(s,t)=>{let e=await Hc(s);return Gn(e,t)},"A");var jc=[{key:"cameraModes",deps:["enableVideoRecording"],fn:n(({cameraModes:s,enableVideoRecording:t})=>{if(t===null)return s;let e=K(s);return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(i=>i!=="video")),ye(e)},"fn")},{key:"cameraModes",deps:["defaultCameraMode"],fn:n(({cameraModes:s,defaultCameraMode:t})=>{if(t===null)return s;let e=K(s);return e=e.sort((i,r)=>i===t?-1:r===t?1:0),ye(e)},"fn")},{key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:n(({pubkey:s,cdnCname:t,cdnCnamePrefixed:e})=>t!==Ts?t:Xn(s,e),"fn")}],Cr=n(({key:s,setValue:t,getValue:e})=>{for(let i of jc)if(i.deps.includes(s)){let r={[i.key]:e(i.key),...i.deps.reduce((a,l)=>({...a,[l]:e(l)}),{})},o=i.fn(r);if(o instanceof Promise){let a=e(i.key);o.then(l=>{e(i.key)===a&&t(i.key,l)}).catch(l=>{console.error(`Failed to compute value for "${i.key}"`,l)})}else t(i.key,o)}},"runSideEffects");var xr=[...new Set(["debug",...Object.keys(re)])],Gc=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Wc=n(s=>Gc.includes(s),"isComplexKey"),at=xr.filter(s=>!Wc(s)),Xc={...Object.fromEntries(at.map(s=>[nt(s),s])),...Object.fromEntries(at.map(s=>[s.toLowerCase(),s]))},qc={...Object.fromEntries(at.map(s=>[nt(s),j(s)])),...Object.fromEntries(at.map(s=>[s.toLowerCase(),j(s)]))},qn=n(s=>"__"+s,"getLocalPropName"),Ar=class Ar extends y{constructor(){super();d(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(re).map(([e,i])=>[j(e),i]))}}_flushValueToAttribute(e,i){if(at.includes(e)){let r=[...new Set([nt(e),e.toLowerCase()])];for(let o of r)typeof i=="undefined"||i===null?this.removeAttribute(o):this.getAttribute(o)!==i.toString()&&this.setAttribute(o,i.toString())}}_flushValueToState(e,i){this.$[j(e)]!==i&&(typeof i=="undefined"||i===null?this.$[j(e)]=re[e]:this.$[j(e)]=i)}_setValue(e,i){let r=this,o=Hn(e,i),a=qn(e);r[a]!==o&&(this._assertSameValueDifferentReference(e,r[a],o),r[a]=o,this._flushValueToAttribute(e,o),this._flushValueToState(e,o),this.debugPrint(`[uc-config] "${e}"`,o),jn(this.cfg),Cr({key:e,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this)}))}_getValue(e){var o;let i=this,r=qn(e);return(o=i[r])!=null?o:this.$[j(e)]}_assertSameValueDifferentReference(e,i,r){this.cfg.debug&&r!==i&&typeof r=="object"&&typeof i=="object"&&JSON.stringify(r)===JSON.stringify(i)&&(console.warn(`[uc-config] Option "${e}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${e}" previous value:`,i),console.warn(`[uc-config] "${e}" new value:`,r))}initCallback(){var i;super.initCallback();let e=this;for(let r of at)this.sub(j(r),o=>{this._setValue(r,o)},!1);for(let r of xr){let o=(i=e[r])!=null?i:this.$[j(r)];o!==re[r]&&this._setValue(r,o),Object.defineProperty(this,r,{set:n(a=>{this._setValue(r,a)},"set"),get:n(()=>this._getValue(r),"get")}),Cr({key:r,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this)})}}attributeChangedCallback(e,i,r){if(i===r)return;let o=this,a=Xc[e];o[a]=r}};n(Ar,"ConfigClass");var jt=Ar;jt.bindAttributes(qc);for(let s of xr)jt.prototype[s]=void 0;var Zn=jt;var Er=class Er extends y{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",t=>{if(!t)return;let e=`#uc-icon-${t}`;this.subConfigValue("iconHrefResolver",i=>{if(i){let r=i(t);e=r!=null?r:e}this.$.href=e})}),this.setAttribute("aria-hidden","true")}};n(Er,"Icon");var lt=Er;lt.template=`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;lt.bindAttributes({name:"name"});var Kn=n(s=>[...new Set(s)],"uniqueArray");var Yn=n(s=>Object.entries(s).filter(([t,e])=>e!==void 0&&e!=="").map(([t,e])=>t==="cdn-operations"||t==="analytics"?e:`${t}/${e}`),"parseObjectToString");var Zc="https://ucarecdn.com",Gt=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Zc},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var ct="--uc-img-",Tr="unresolved";var Sr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Ir=3e3,Or=5e3,kr=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Qn=Object.create(null),Jn;for(let s in Gt)Qn[ct+s]=((Jn=Gt[s])==null?void 0:Jn.default)||"";var $r=class $r extends _e{constructor(){super(...arguments);d(this,"cssInit$",Qn)}$$(e){return this.$[ct+e]}set$$(e){for(let i in e)this.$[ct+i]=e[i]}sub$$(e,i){this.sub(ct+e,r=>{r===null||r===""||i(r)})}analyticsParams(){return`-/@clib/${Fe}/${Ne}/uc-img/`}initAttributes(e){[...this.attributes].forEach(i=>{Gt[i.name]||e.setAttribute(i.name,i.value)})}initIntersection(e,i){let r={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(a=>{a.isIntersecting&&(i(),this._isnObserver.unobserve(e))})},r),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(e=>{this._isnObserver.unobserve(e)}),this._isnObserver=null),T.deleteCtx(this)}static get observedAttributes(){return Object.keys(Gt)}attributeChangedCallback(e,i,r){window.setTimeout(()=>{this.$[ct+e]=r})}};n($r,"ImgConfig");var Yi=$r;var Mr=class Mr extends Yi{constructor(){super(...arguments);d(this,"_img",new Image);d(this,"_imgPreview",new Image)}_fmtAbs(e){return!e.includes("//")&&!Sr&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if((e==null?void 0:e.trim())!==""){let i=e.match(/\d+/)[0],r=e.match(/[a-zA-Z]+/)[0],o=parseInt(i,10);if(Number(o)>Or&&this.hasFormatJPG)return Or+r;if(Number(o)>Ir&&!this.hasFormatJPG)return Ir+r}return e}_getCdnModifiers(e,i){let r={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(e),blur:i,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return B(...Yn(r))}_getUrlBase(e="",i=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(Sr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let r=this._getCdnModifiers(e,i);if(this.$$("src").startsWith(this.$$("cdn-cname")))return F(this.$$("src"),r);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(F(Se(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("uuid"))return this._proxyUrl(F(Se(this.$$("cdn-cname"),this.$$("uuid")),r));if(this.$$("proxy-cname"))return this._proxyUrl(F(this.$$("proxy-cname"),r,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(F(`https://${this.$$("pubkey")}.ucr.io/`,r,this._fmtAbs(this.$$("src"))))}_proxyUrl(e){return this.$$("secure-delivery-proxy")?Ut(this.$$("secure-delivery-proxy"),{previewUrl:e},{transform:n(r=>window.encodeURIComponent(r),"transform")}):e}_getElSize(e,i=1,r=!0){let o=e.getBoundingClientRect(),a=i*Math.round(o.width),l=r?"":i*Math.round(o.height);return a||l?`${a||""}x${l||""}`:null}_setupEventProxy(e){let i=n(o=>{o.stopPropagation();let a=new Event(o.type,o);this.dispatchEvent(a)},"proxifyEvent"),r=["load","error"];for(let o of r)e.addEventListener(o,i)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:kr.PREVIEW,img:this._imgPreview}:{type:kr.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let e=V(this.$$("breakpoints"));return Kn(e.map(i=>parseInt(i,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(e){let i=new Set;i.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&i.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let r=`image-set(${[...i].join(", ")})`;e.style.setProperty("background-image",r),e.style.setProperty("background-image","-webkit-"+r)}getSrcset(){let e=new Set;return this.breakpoints?this.breakpoints.forEach(i=>{e.add(this._getUrlBase(i+"x")+` ${this._validateSize(i+"w")}`),this.$$("hi-res-support")&&e.add(this._getUrlBase(i*2+"x")+` ${this._validateSize(i*2+"w")}`),this.$$("ultra-res-support")&&e.add(this._getUrlBase(i*3+"x")+` ${this._validateSize(i*3+"w")}`)}):(e.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...e].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:e,src:i,srcset:r}){i&&(e.src=i),r&&(e.srcset=r)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}loaderImage({src:e,srcset:i,elNode:r}){return new Promise((o,a)=>{this._setupConfigForImage({elNode:r}),r.setAttribute(Tr,""),r.addEventListener("load",()=>{r.removeAttribute(Tr),o(r)}),r.addEventListener("error",()=>{a(!1)}),this._appendURL({elNode:r,src:e,srcset:i})})}async renderImage(){var e,i;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var r;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((r=this._imgPreview)==null?void 0:r.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((i=this._imgPreview)==null?void 0:i.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};n(Mr,"ImgBase");var es=Mr;var Lr=class Lr extends es{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",t=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=t?"lazy":"eager")})}};n(Lr,"Img");var ts=Lr;var ut=class ut extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:n(()=>{this.api.initFlow()},"onClick"),"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",e=>{typeof e!="undefined"&&(this.$.withDropZone=O(e))}),this.subConfigValue("multiple",e=>{this.$["button-text"]=e?"upload-files":"upload-file"})}};n(ut,"SimpleBtn"),d(ut,"styleAttrs",[...q(ut,ut,"styleAttrs"),"uc-simple-btn"]);var dt=ut;dt.template=`<uc-drop-area set="@disabled: !withDropZone"><button type="button" set="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;dt.bindAttributes({dropzone:null});var Pr=class Pr extends b{constructor(){super(...arguments);d(this,"historyTracked",!0);d(this,"activityType",b.activities.START_FROM)}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};n(Pr,"StartFrom");var Wt=Pr;Wt.template='<div class="uc-content"><slot></slot></div>';function Kc(s){return new Promise(t=>{typeof window.FileReader!="function"&&t(!1);try{let e=new FileReader;e.onerror=()=>{t(!0)};let i=n(r=>{r.type!=="loadend"&&e.abort(),t(!1)},"onLoad");e.onloadend=i,e.onprogress=i,e.readAsDataURL(s)}catch{t(!1)}})}n(Kc,"checkIsDirectory");function Yc(s,t){return new Promise(e=>{let i=0,r=[],o=n(l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),e(null)),l.isFile?(i++,l.file(c=>{i--;let u=new File([c],c.name,{type:c.type||t});r.push({type:"file",file:u,fullPath:l.fullPath}),i===0&&e(r)})):l.isDirectory&&a(l.createReader())},"readEntry"),a=n(l=>{i++,l.readEntries(c=>{i--;for(let u of c)o(u);i===0&&e(r)})},"readReaderContent");o(s)})}n(Yc,"readEntryContentAsync");function ea(s){let t=[],e=[];for(let i=0;i<s.items.length;i++){let r=s.items[i];if(r)if(r.kind==="file"){let o=r.type;if(typeof r.webkitGetAsEntry=="function"||typeof r.getAsEntry=="function"){let l=typeof r.webkitGetAsEntry=="function"?r.webkitGetAsEntry():r.getAsEntry();e.push(Yc(l,o).then(c=>{c&&t.push(...c)}));continue}let a=r.getAsFile();a&&e.push(Kc(a).then(l=>{l||t.push({type:"file",file:a})}))}else r.kind==="string"&&r.type.match("^text/uri-list")&&e.push(new Promise(o=>{r.getAsString(a=>{t.push({type:"url",url:a}),o(void 0)})}))}return Promise.all(e).then(()=>t)}n(ea,"getDropItems");var G={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},ta=["focus"],Jc=100,Ur=new Map;function Qc(s,t){let e=Math.max(Math.min(s[0],t.x+t.width),t.x),i=Math.max(Math.min(s[1],t.y+t.height),t.y);return Math.sqrt((s[0]-e)*(s[0]-e)+(s[1]-i)*(s[1]-i))}n(Qc,"distance");function Rr(s){let t=0,e=document.body,i=new Set,r=n(g=>i.add(g),"handleSwitch"),o=G.INACTIVE,a=n(g=>{s.shouldIgnore()&&g!==G.INACTIVE||(o!==g&&i.forEach(_=>_(g)),o=g)},"setState"),l=n(()=>t>0,"isDragging");r(g=>s.onChange(g));let c=n(()=>{t=0,a(G.INACTIVE)},"onResetEvent"),u=n(()=>{t+=1,o===G.INACTIVE&&a(G.ACTIVE)},"onDragEnter"),p=n(()=>{t-=1,l()||a(G.INACTIVE)},"onDragLeave"),h=n(g=>{g.preventDefault(),t=0,a(G.INACTIVE)},"onDrop"),f=n(g=>{if(s.shouldIgnore())return;l()||(t+=1);let _=[g.x,g.y],C=s.element.getBoundingClientRect(),x=Math.floor(Qc(_,C)),v=x<Jc,w=g.composedPath().includes(s.element);Ur.set(s.element,x);let R=Math.min(...Ur.values())===x;w&&R?(g.preventDefault(),a(G.OVER)):a(v&&R?G.NEAR:G.ACTIVE)},"onDragOver"),m=n(async g=>{if(s.shouldIgnore())return;g.preventDefault();let _=await ea(g.dataTransfer);s.onItems(_),a(G.INACTIVE)},"onElementDrop");return e.addEventListener("drop",h),e.addEventListener("dragleave",p),e.addEventListener("dragenter",u),e.addEventListener("dragover",f),s.element.addEventListener("drop",m),ta.forEach(g=>{window.addEventListener(g,c)}),()=>{Ur.delete(s.element),e.removeEventListener("drop",h),e.removeEventListener("dragleave",p),e.removeEventListener("dragenter",u),e.removeEventListener("dragover",f),s.element.removeEventListener("drop",m),ta.forEach(g=>{window.removeEventListener(g,c)})}}n(Rr,"addDropzone");var ia="uc-drop-area",ht=`${ia}/registry`,pt=class pt extends k{constructor(){super(),this.init$={...this.init$,state:G.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,isInitFlow:!1,text:"",[ht]:null}}isActive(){if(!this.$.isEnabled)return!1;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,i=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),r=window.getComputedStyle(this),o=r.visibility!=="hidden"&&r.display!=="none";return e&&o&&i}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[ht]||(this.$[ht]=new Set),this.$[ht].add(this),this.defineAccessor("disabled",e=>{this.set$({isEnabled:!O(e)})}),this.defineAccessor("clickable",e=>{this.set$({isClickable:O(e)})}),this.defineAccessor("initflow",e=>{this.set$({isInitFlow:O(e)})}),this.defineAccessor("with-icon",e=>{this.set$({withIcon:O(e)})}),this.defineAccessor("fullscreen",e=>{this.set$({isFullscreen:O(e)})}),this.defineAccessor("text",e=>{typeof e=="string"?this.bindL10n("text",()=>this.l10n(e)||e):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=Rr({element:this,shouldIgnore:n(()=>this._shouldIgnore(),"shouldIgnore"),onChange:n(e=>{this.$.state=e},"onChange"),onItems:n(e=>{e.length&&(e.forEach(i=>{i.type==="url"?this.api.addFileFromUrl(i.url,{source:L.DROP_AREA}):i.type==="file"&&this.api.addFileFromObject(i.file,{source:L.DROP_AREA,fullPath:i.fullPath})}),this.uploadCollection.size&&(this.modalManager.open(b.activities.UPLOAD_LIST),this.set$({"*currentActivity":b.activities.UPLOAD_LIST})))},"onItems")});let t=this.ref["content-wrapper"];t&&(this._destroyContentWrapperDropzone=Rr({element:t,onChange:n(e=>{var r;let i=(r=Object.entries(G).find(([,o])=>o===e))==null?void 0:r[0].toLowerCase();i&&t.setAttribute("drag-state",i)},"onChange"),onItems:n(()=>{},"onItems"),shouldIgnore:n(()=>this._shouldIgnore(),"shouldIgnore")})),this.sub("state",e=>{var r;let i=(r=Object.entries(G).find(([,o])=>o===e))==null?void 0:r[0].toLowerCase();i&&this.setAttribute("drag-state",i)}),this.subConfigValue("sourceList",e=>{let i=V(e);this.$.isEnabled=i.includes(L.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",e=>{this.toggleAttribute("hidden",!e)}),this.sub("isClickable",e=>{this.toggleAttribute("clickable",e)}),this.$.isClickable&&(this._onAreaClicked=e=>{if(e.type==="keydown"){if(e.code==="Space"||e.code==="Enter"){if(this.$.isInitFlow){this.api.initFlow();return}this.api.openSystemDialog()}}else if(e.type==="click"){if(this.$.isInitFlow){this.api.initFlow();return}this.api.openSystemDialog()}},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[ht]].filter(i=>i!==this).filter(i=>i.isActive()).length>0:!1}_couldHandleFiles(){let t=this.cfg.multiple,e=this.cfg.multipleMax,i=this.uploadCollection.size;return!(t&&e&&i>=e||!t&&i>0)}destroyCallback(){var e,i;super.destroyCallback();let t=this.$[ht];t&&(t.delete(this),t.size===0&&T.deleteCtx(ia)),(e=this._destroyDropzone)==null||e.call(this),(i=this._destroyContentWrapperDropzone)==null||i.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};n(pt,"DropArea"),d(pt,"styleAttrs",[...q(pt,pt,"styleAttrs"),"uc-drop-area"]);var ft=pt;ft.template=`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;ft.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null,initflow:null});var eu="src-type-",Dr=class Dr extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"type");d(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:L.LOCAL,activate:n(()=>(this.api.openSystemDialog(),!1),"activate")}),this.registerType({type:L.URL,activity:b.activities.URL,textKey:"from-url"}),this.registerType({type:L.CAMERA,activity:b.activities.CAMERA,activate:n(()=>{let e=Ve.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:!0}),!e},"activate")}),this.registerType({type:"draw",activity:b.activities.DRAW,icon:"edit-draw"});for(let e of Object.values(cr))this.registerType({type:e,activity:b.activities.CAMERA,activate:n(()=>{let i=Ve.htmlMediaCapture;return i&&this.api.openSystemDialog({captureCamera:!0,modeCamera:e==="mobile-photo-camera"?S.PHOTO:S.VIDEO}),!i},"activate")});for(let e of Object.values(Ae))this.registerType({type:e,activity:b.activities.EXTERNAL,activityParams:{externalSourceType:e}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",e=>{e&&this.applyType(e)})}registerType(e){this._registeredTypes[e.type]=e}getType(e){return this._registeredTypes[e]}activate(){if(!this.type)return;let e=this._registeredTypes[this.type],{activity:i,activate:r,activityParams:o={}}=e;(r?r():!!i)&&(this.modalManager.open(i),this.set$({"*currentActivityParams":o,"*currentActivity":i}))}applyType(e){let i=this._registeredTypes[e];if(!i){console.warn("Unsupported source type: "+e);return}let{textKey:r=e,icon:o=e}=i;this.$["src-type"]=`${eu}${r}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};n(Dr,"SourceBtn");var mt=Dr;mt.template=`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;mt.bindAttributes({type:null});var Fr=class Fr extends y{initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{let e=V(t),i="";e.forEach(r=>{if(r==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here:https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");return}if(r==="camera"&&Ve.htmlMediaCapture){this.subConfigValue("cameraModes",o=>{let a=K(o);a.forEach(l=>{i+=`<uc-source-btn role="listitem" type="mobile-${l}-camera"></uc-source-btn>`}),a.length===0&&(i+='<uc-source-btn role="listitem" type="mobile-photo-camera"></uc-source-btn>')});return}i+=`<uc-source-btn role="listitem" type="${r}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=i:this.outerHTML=i})}};n(Fr,"SourceList");var is=Fr;var rs=n(()=>{let s=[];return{stack:s,promiseReadJpegChunks:n(e=>new Promise((i,r)=>{let o=2,a=n((u,p)=>{let h=new FileReader;h.addEventListener("load",()=>{p(new DataView(h.result))}),h.addEventListener("error",f=>{r(`Reader error: ${f}`)}),h.readAsArrayBuffer(u)},"readToView"),l=n(()=>a(e.slice(o,o+128),u=>{let p,h,f;for(p=h=0,f=u.byteLength;f>=0?h<f:h>f;p=f>=0?++h:--h)if(u.getUint8(p)===255){o+=p;break}c()}),"readNext"),c=n(()=>{let u=o;return a(e.slice(o,o+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let h=p.getUint8(1);if(h===218){i(!0);return}let f=p.getUint16(2)-2;return a(e.slice(o,o+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}s.push({startPos:u,length:f,marker:h,view:m}),l()})})},"readNextChunk");FileReader&&DataView||r("Not Support"),a(e.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l()})}),"promiseReadJpegChunks")}},"readJpegChunks"),tu=n(async s=>{let t=[],{promiseReadJpegChunks:e,stack:i}=rs();return await e(s),i.forEach(({marker:r,view:o})=>{r===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&t.push(o)}),t},"getIccProfile"),ra=n(async(s,t,e)=>{{let i=[],r=[],{promiseReadJpegChunks:o,stack:a}=rs();await o(s),a.forEach(u=>{if(u.marker===t)return i.push(u.startPos),r.push(u.length)});let l=[s.slice(0,2)];for(let u of e){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+t),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u)}let c=2;for(let u=0;u<i.length;u++)i[u]>c&&l.push(s.slice(c,i[u])),c=i[u]+r[u]+4;return l.push(s.slice(c,s.size)),new Blob(l,{type:s.type})}},"replaceJpegChunk"),iu=226,oa=n((s,t)=>ra(s,iu,t.map(e=>e.buffer)),"replaceIccProfile"),su=n(async s=>{try{return await oa(s,[])}catch(t){throw new Error(`Failed to strip ICC profile: ${t}`)}},"stripIccProfile"),ru=n((s,t,e)=>new Promise((i,r)=>{let o=n(a=>{if(!a){r("Failed to convert canvas to blob");return}i(a)},"callback");s.toBlob(o,t,e),s.width=s.height=1}),"canvasToBlob"),Xt=n(()=>{let s=document.createElement("canvas"),t=s.getContext("2d");return{canvas:s,ctx:t}},"createCanvas"),ou=n(s=>{let{ctx:e,canvas:i}=Xt();i.width=i.height=50,e.drawImage(s,0,0,50,50);let r=e.getImageData(0,0,50,50).data;i.width=i.height=1;for(let o=3;o<r.length;o+=4)if(r[o]<254)return!0;return!1},"hasTransparency"),nu=n(async s=>{let t=null,{promiseReadJpegChunks:e,stack:i}=rs();return await e(s),i.forEach(({marker:r,view:o})=>{if(!t&&r===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){t=o;return}}),t},"getExif"),au="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",ss,lu=n(()=>new Promise(s=>{if(ss!==void 0)s(ss);else{let t=new Image;t.addEventListener("load",()=>{ss=t.naturalWidth<t.naturalHeight,t.src="//:0",s(ss)}),t.src=au}}),"isBrowserApplyExifOrientation"),cu=n((s,t)=>{let e,i,r,o;if(!s||s.byteLength<14||s.getUint32(0)!==1165519206||s.getUint16(4)!==0)return;if(s.getUint16(6)===18761)i=!0;else if(s.getUint16(6)===19789)i=!1;else return;if(s.getUint16(8,i)!==42)return;r=8+s.getUint32(10,i);let a=s.getUint16(r-2,i);for(e=0,o=a;o>=0?e<o:e>o;o>=0?++e:--e){if(s.byteLength<r+10)return;s.getUint16(r,i)===274&&t(r+8,i),r+=12}},"findExifOrientation"),uu=n((s,t)=>{cu(s,(e,i)=>s.setUint16(e,t,i))},"setExifOrientation"),du=n(async(s,t,e)=>(e&&uu(t,1),ra(s,225,[t.buffer])),"replaceExif"),hu=n((s,t)=>new Promise((e,i)=>{t&&(s.src=t),s.complete?e(s):(s.addEventListener("load",()=>{e(s)}),s.addEventListener("error",()=>{i(new Error("Failed to load image. Probably not an image."))}))}),"processImage"),pu=n(s=>hu(new Image,s),"imageLoader"),fu=[1,3],mu=[192,193,194,195,197,198,199,201,202,203,205,206,207],sa={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},gu=n(async s=>{let t=!1,{promiseReadJpegChunks:e,stack:i}=rs();return await e(s).then(()=>(i.forEach(({marker:r,view:o})=>{if(!t&&mu.indexOf(r)>=0){let a=o.getUint8(5);fu.indexOf(a)<0&&(t=!0)}}),t)).catch(()=>t)},"shouldSkipShrink"),na=n((s,t)=>{let e={};return(...i)=>{let r=t(i,e);return r in e?e[r]:e[r]=s(...i)}},"memoize"),aa=n((s,t)=>{let[e]=s,i=Object.keys(t).map(r=>parseInt(r,10)).sort((r,o)=>r-o);for(let r=0;r<i.length;r++){let o=i[r],a=!!t[o];if(o>e&&a||o<e&&!a)return o}return e},"memoKeySerializer"),Pe={R:55,G:110,B:165,A:255},bu=`rgba(${Pe.R}, ${Pe.G}, ${Pe.B}, ${Pe.A/255})`,la=n((s,t)=>{try{let e=[s-1,t-1,1,1],{canvas:i,ctx:r}=Xt();i.width=1,i.height=1;let{canvas:o,ctx:a}=Xt();o.width=s,o.height=t,a&&(a.fillStyle=bu,a.fillRect(...e),r.drawImage(o,s-1,t-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===Pe.R&&l[1]===Pe.G&&l[2]===Pe.B&&l[3]===Pe.A),o.width=o.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${s}x${t}.`),!1}},"canvasTest");function ca(s){return(...t)=>new Promise(e=>{setTimeout(()=>{let i=s(...t);e(i)},0)})}n(ca,"wrapAsync");var _u=ca(na(la,aa)),vu=ca(na(la,aa)),ua=n(async(s,t)=>{let e=sa.squareSide.find(a=>a*a>=s*t),i=sa.dimension.find(a=>a>=s&&a>=t);if(!e||!i)throw new Error("Not supported");let[r,o]=await Promise.all([_u(e,e),vu(i,1)]);if(r&&o)return!0;throw new Error("Not supported")},"testCanvasSize"),da=n(async(s,t,e)=>{try{let{ctx:i,canvas:r}=Xt();return r.width=t,r.height=e,i.imageSmoothingQuality="high",i.drawImage(s,0,0,t,e),s instanceof HTMLImageElement&&(s.src="//:0"),s instanceof HTMLCanvasElement&&(s.width=s.height=1),r}catch(i){throw new Error("Canvas resize error",{cause:i})}},"canvasResize"),yu=n(({img:s,targetW:t,targetH:e})=>da(s,t,e),"native"),wu=n(function({sourceW:s,targetW:t,targetH:e,step:i}){let r=[],o=t,a=e;do r.push([o,a]),o=Math.round(o/i),a=Math.round(a/i);while(o<s*i);return r.reverse()},"calcShrinkSteps"),Cu=n(({img:s,sourceW:t,targetW:e,targetH:i,step:r})=>{let o=wu({sourceW:t,targetW:e,targetH:i,step:r});return o.reduce((a,[l,c],u)=>a.then(p=>ua(l,c).then(()=>da(p,l,c)).catch(()=>{if(u===o.length-1)throw new Error("Not supported");return p})),Promise.resolve(s))},"fallback"),xu=n(()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),Au=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Nr=.71,Eu=n((s,t)=>{if(s.width*Nr*s.height*Nr<t.size)throw new Error("Not required");let e=s.width,i=s.height,r=e/i,o=Math.floor(Math.sqrt(t.size*r)),a=Math.floor(t.size/Math.sqrt(t.size*r));return ua(o,a).then(()=>{let{ctx:l}=Xt();return"imageSmoothingQuality"in l&&!xu()&&!Au?yu({img:s,targetW:o,targetH:a}):Cu({img:s,sourceW:e,targetW:o,targetH:a,step:Nr})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),ha=n(async(s,t)=>{try{if(await gu(s))throw new Error("Should skipped");let i=await Promise.allSettled([nu(s),lu(),tu(s)]),o=!i.some(_=>_.status==="rejected"),[a,l,c]=i,u=await su(s).catch(()=>s),p=await pu(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let h=await Eu(p,t),f="image/jpeg",m=(t==null?void 0:t.quality)||.8;!o&&ou(h)&&(f="image/png",m=void 0);let g=await ru(h,f,m);if(o&&a.status==="fulfilled"&&a.value){let _=a.value,C=l.status==="fulfilled"?l.value:!1;g=await du(g,_,C)}return o&&c.status==="fulfilled"&&c.value.length>0&&(g=await oa(g,c.value)),g}catch(e){let i;throw e instanceof Error&&(i=e.message),typeof e=="string"&&(i=e),new Error(`Failed to shrink image. ${i?`Message: "${i}".`:""}`,{cause:e})}},"shrinkFile");var Tu=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,pa=n(s=>{let t=Tu.exec(s==null?void 0:s.toLocaleLowerCase())||[];if(!t.length)return!1;let e=t[1]*t[2],i=16384*16384;return e>i?(console.warn(`Shrinked size can not be larger than ${Math.floor(i/1e3/1e3)}MP. You have set ${t[1]}x${t[2]} (${Math.ceil(e/1e3/100)/10}MP).`),!1):{quality:t[3]?t[3]/100:void 0,size:e}},"parseShrink");var gt=n((s,t)=>{let e,i,r,o=n((...a)=>{e?(clearTimeout(i),i=setTimeout(()=>{Date.now()-r>=t&&(s(...a),r=Date.now())},Math.max(t-(Date.now()-r),0))):(s(...a),r=Date.now(),e=!0)},"throttled");return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:n(()=>{clearTimeout(i)},"value")}),o},"throttle");var Vr=class Vr extends k{constructor(){super(...arguments);d(this,"_entrySubs",new Set);d(this,"_entry",null);d(this,"_subEntry",n((e,i)=>this._withEntry((r,o,a)=>{let l=r.subscribe(o,c=>{this.isConnected&&a(c)});this._entrySubs.add(l)})(e,i),"_subEntry"))}_withEntry(e){return n((...r)=>{let o=this._entry;if(!o){console.warn("No entry found");return}return e(o,...r)},"wrapperFn")}_reset(){for(let e of this._entrySubs)e.remove();this._entrySubs=new Set,this._entry=null}disconnectedCallback(){super.disconnectedCallback(),this._entrySubs=new Set}};n(Vr,"FileItemConfig");var bt=Vr;var te=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),_t=class _t extends bt{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"pauseRender",!0);d(this,"_renderedOnce",!1);d(this,"_calculateState",this._withEntry(e=>{let i=te.IDLE;e.getValue("errors").length>0?i=te.FAILED:e.getValue("isUploading")?i=te.UPLOADING:e.getValue("fileInfo")&&(i=te.FINISHED),this.$.state=i}));d(this,"_debouncedCalculateState",M(this._calculateState.bind(this),100));d(this,"_updateHint",this._withEntry(gt(e=>{let i=e.getValue("source"),r=e.getValue("externalUrl"),o=e.getValue("errors").length===0,a=this.$.progressValue===0,l=this.$.state===te.UPLOADING,c=e.getValue("isQueued");if(!o||!l||!a){this.$.hint="";return}if(c){let u=this.l10n("queued");this.$.hint=u;return}if(r&&i&&i!==L.URL){let u=this.l10n("waiting-for",{source:this.l10n(`src-type-${i}`)});this.$.hint=u;return}this.$.hint=""},100)));d(this,"_handleState",this._withEntry((e,i)=>{var o,a,l,c,u,p;i===te.FAILED?this.$.badgeIcon="badge-error":i===te.FINISHED&&(this.$.badgeIcon="badge-success"),i===te.UPLOADING&&(this.$.isFocused=!1);let r=e.getValue("fileName");this.set$({isFailed:i===te.FAILED,isUploading:i===te.UPLOADING,isFinished:i===te.FINISHED,progressVisible:i===te.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((o=this._entry)==null?void 0:o.getValue("isImage"))&&((a=this._entry)==null?void 0:a.getValue("cdnUrl")),errorText:(c=(l=e.getValue("errors"))==null?void 0:l[0])==null?void 0:c.message,ariaLabelStatusFile:r&&this.l10n("a11y-file-item-status",{fileName:r,status:this.l10n((p=(u=i==null?void 0:i.description)==null?void 0:u.toLocaleLowerCase())!=null?p:"").toLocaleLowerCase()})}),this._updateHint()}));d(this,"upload",this._withEntry(async e=>{var r,o,a,l,c,u,p;if(!this.uploadCollection.read(e.uid)||e.getValue("fileInfo")||e.getValue("isUploading")||e.getValue("errors").length>0)return;let i=this.cfg.multiple?this.cfg.multipleMax:1;if(!(i&&this.uploadCollection.size>i)){this._debouncedCalculateState(),e.setMultipleValues({isUploading:!0,errors:[],isQueued:!0});try{let h=new AbortController;e.setValue("abortController",h);let f=n(async()=>{var v,w;e.setValue("isQueued",!1);let g=e.getValue("file");g&&this.cfg.imageShrink&&(g=await this._processShrink(g).catch(()=>g));let _=g||e.getValue("externalUrl")||e.getValue("uuid");if(!_)throw new Error("No file input");let x={...await this.getUploadClientOptions(),fileName:(v=e.getValue("fileName"))!=null?v:void 0,source:(w=e.getValue("source"))!=null?w:void 0,onProgress:n(R=>{if(R.isComputable){let W=R.value*100;e.setValue("uploadProgress",W)}},"onProgress"),signal:h.signal,metadata:await this.getMetadataFor(e.uid)};return this.debugPrint("upload options",_,x),Vs(_,x)},"uploadTask"),m=await this.$["*uploadQueue"].add(f);e.setMultipleValues({fileInfo:m,isQueued:!1,isUploading:!1,fileName:m.originalFilename,fileSize:m.size,isImage:(r=m.isImage)!=null?r:!1,mimeType:(l=(a=(o=m.contentInfo)==null?void 0:o.mime)==null?void 0:a.mime)!=null?l:m.mimeType,uuid:m.uuid,cdnUrl:(c=e.getValue("cdnUrl"))!=null?c:m.cdnUrl,cdnUrlModifiers:(u=e.getValue("cdnUrlModifiers"))!=null?u:"",uploadProgress:100,source:(p=e.getValue("source"))!=null?p:null}),e===this._entry&&this._debouncedCalculateState()}catch(h){h instanceof Oe&&h.isCancel?e.setMultipleValues({isUploading:!1,uploadProgress:0}):h instanceof Re?e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:h}):(console.error("Unknown upload error",h),e.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:h})})),e===this._entry&&this._debouncedCalculateState()}}}));this.init$={...this.init$,uid:"",itemName:"",errorText:"",hint:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,showFileNames:!1,state:te.IDLE,ariaLabelStatusFile:"",onEdit:this._withEntry(e=>{this.$["*currentActivityParams"]={internalId:e.uid},this.modalManager.open(b.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=b.activities.CLOUD_IMG_EDIT}),onRemove:n(()=>{this.uploadCollection.remove(this.$.uid)},"onRemove"),onUpload:n(()=>{this.upload()},"onUpload")}}_reset(){super._reset(),this._debouncedCalculateState.cancel()}_observerCallback(e){let[i]=e;this._isIntersecting=i.isIntersecting,this._thumbRect=i.boundingClientRect,i.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0)}_handleEntryId(e){var r;this._reset();let i=(r=this.uploadCollection)==null?void 0:r.read(e);this._entry=i,i&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o,this._updateHint()}),this._subEntry("isQueued",()=>{this._updateHint()}),this._subEntry("fileName",o=>{this.$.itemName=o||i.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=i.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",()=>{this._debouncedCalculateState()}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()))}_updateShowFileNames(e){if(this.cfg.filesViewMode==="list"){this.$.showFileNames=!0;return}this.$.showFileNames=e}initCallback(){super.initCallback(),this.sub("uid",e=>{this._handleEntryId(e)}),this.sub("state",e=>{this._handleState(e)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.subConfigValue("filesViewMode",e=>{this._updateShowFileNames(this.cfg.gridShowFileNames),this.setAttribute("mode",e)}),this.subConfigValue("gridShowFileNames",e=>{this._updateShowFileNames(e)}),this.onclick=()=>{_t.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused")})},this.sub("*uploadTrigger",e=>{this._entry&&!e.has(this._entry.uid)||setTimeout(()=>this.isConnected&&this.upload())}),_t.activeInstances.add(this)}destroyCallback(){super.destroyCallback(),_t.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._observer)==null||e.disconnect()}_settingsOfShrink(){return pa(this.cfg.imageShrink)}_processShrink(e){return ha(e,this._settingsOfShrink())}};n(_t,"FileItem");var vt=_t;vt.template=`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><uc-thumb set="uid:uid;badgeIcon:badgeIcon"></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><span class="uc-file-name" set="@hidden: !showFileNames">{{itemName}}</span><span class="uc-file-error" set="@hidden: !errorText;">{{errorText}}</span><span class="uc-file-hint" set="@hidden: !hint">{{hint}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button;@aria-label:file-item-edit-button" class="uc-edit-btn uc-mini-btn" set="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button;@aria-label:file-item-remove-button" class="uc-remove-btn uc-mini-btn" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible; @hasFileName: showFileNames;" ></uc-progress-bar></div>`;vt.activeInstances=new Set;var zr=null,Be=class Be extends y{constructor(){super();d(this,"_handleBackdropClick",n(()=>{this._closeDialog()},"_handleBackdropClick"));d(this,"_closeDialog",n(()=>{var e;(e=this.modalManager)==null||e.close(this.id),this.modalManager.hasActiveModals||(document.body.style.overflow="")},"_closeDialog"));d(this,"_handleDialogClose",n(()=>{this._closeDialog()},"_handleDialogClose"));d(this,"_handleDialogMouseDown",n(e=>{this._mouseDownTarget=e.target},"_handleDialogMouseDown"));d(this,"_handleDialogMouseUp",n(e=>{e.target===this.ref.dialog&&e.target===this._mouseDownTarget&&this._closeDialog()},"_handleDialogMouseUp"));this.init$={...this.init$,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?(this.setAttribute("aria-modal","true"),this.ref.dialog.showModal()):this.ref.dialog.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden")}hide(){this.ref.dialog.close?(this.setAttribute("aria-modal","false"),this.ref.dialog.close()):this.ref.dialog.removeAttribute("open")}_handleModalOpen({id:e}){e===this.id?(zr=e,this.show()):this.hide(),this.emit($.MODAL_OPEN,{modalId:e},{debounce:!0})}_handleModalClose({id:e}){e===this.id&&this.hide(),this.emit($.MODAL_CLOSE,{modalId:e,hasActiveModals:this.modalManager.hasActiveModals},{debounce:!0})}_handleModalCloseAll(){this.hide(),zr===this.id&&this.emit($.MODAL_CLOSE,{modalId:zr,hasActiveModals:this.modalManager.hasActiveModals},{debounce:!0})}initCallback(){var e;super.initCallback(),(e=this.modalManager)==null||e.registerModal(this.id,this),this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp),this.subConfigValue("modalBackdropStrokes",i=>{i?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.handleModalOpen=this._handleModalOpen.bind(this),this.handleModalClose=this._handleModalClose.bind(this),this.handleModalCloseAll=this._handleModalCloseAll.bind(this),this.modalManager.subscribe(D.OPEN,this.handleModalOpen),this.modalManager.subscribe(D.CLOSE,this.handleModalClose),this.modalManager.subscribe(D.CLOSE_ALL,this.handleModalCloseAll)}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp),this.modalManager.unsubscribe(D.OPEN,this.handleModalOpen),this.modalManager.unsubscribe(D.CLOSE,this.handleModalClose),this.modalManager.unsubscribe(D.CLOSE_ALL,this.handleModalCloseAll)}};n(Be,"Modal"),d(Be,"styleAttrs",[...q(Be,Be,"styleAttrs"),"uc-modal"]),d(Be,"StateConsumerScope","modal");var qt=Be;qt.template=`<dialog ref="dialog"><slot></slot></dialog>`;var Br=class Br extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"historyTracked",!0);d(this,"activityType",b.activities.UPLOAD_LIST);d(this,"_throttledHandleCollectionUpdate",gt(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:n(()=>{this.api.initFlow(!0)},"onAdd"),onUpload:n(()=>{this.emit($.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},"onUpload"),onDone:n(()=>{this.emit($.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},"onDone"),onCancel:n(()=>{this.uploadCollection.clearAll()},"onCancel")}}_updateUploadsState(){let e=this.api.getOutputCollectionState(),i={total:e.totalCount,succeed:e.successCount,uploading:e.uploadingCount,failed:e.failedCount},r=!e.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),o=e.errors.some(f=>f.type==="TOO_MANY_FILES"),a=e.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=i.failed===0&&e.errors.length===0,c=!1,u=!1,p=!1;if(i.total-i.succeed-i.uploading-i.failed>0&&r)c=!0;else{u=!0;let f=this.cfg.groupOutput?!!e.group:!0;p=i.total===i.succeed&&r&&l&&f}this.set$({doneBtnVisible:u,doneBtnEnabled:p,uploadBtnVisible:c,addMoreBtnEnabled:i.total===0||!o&&!a,addMoreBtnVisible:!a||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(i))}_getHeaderText(e){let i=n(r=>{let o=e[r];return this.l10n(`header-${r}`,{count:o})},"localizedText");return e.uploading>0?i("uploading"):e.failed>0?i("failed"):e.succeed>0?i("succeed"):i("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",e=>{e&&this._throttledHandleCollectionUpdate()}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e)}),this.sub("*currentActivity",e=>{!this.couldOpenActivity&&e===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",e=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:e.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",e=>{let i=e.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!i){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:i.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};n(Br,"UploadList");var Zt=Br;Zt.template=`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files"><div class="uc-files-wrapper" repeat="*uploadList" repeat-item-tag="uc-file-item"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var Hr=class Hr extends k{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.URL);d(this,"init$",{...this.init$,importDisabled:!0,onUpload:n(e=>{e.preventDefault();let i=this.ref.input.value;this.api.addFileFromUrl(i,{source:L.URL}),this.modalManager.open(b.activities.UPLOAD_LIST),this.$["*currentActivity"]=b.activities.UPLOAD_LIST},"onUpload"),onCancel:n(()=>{this.historyBack()},"onCancel"),onInput:n(e=>{let i=e.target.value;this.set$({importDisabled:!i})},"onInput")})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>{this.ref.input.value="",this.ref.input.focus()},"onActivate")})}};n(Hr,"UrlSource");var Kt=Hr;Kt.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back;@aria-label:back"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><label><input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" set="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var fa=n(()=>typeof navigator.permissions!="undefined","canUsePermissionsApi");var Su={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},ma=["camera","microphone"];function os(s){let t=Math.floor(s/60).toString().padStart(2,"0"),e=Math.floor(s%60).toString().padStart(2,"0");return`${t}:${e}`}n(os,"formatTime");var ga="image/jpeg",ba="video/webm",jr=class jr extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.CAMERA);d(this,"_unsubPermissions",null);d(this,"_chunks",[]);d(this,"_mediaRecorder",null);d(this,"_stream",null);d(this,"_selectedAudioId",null);d(this,"_selectedCameraId",null);d(this,"_chooseActionWithCamera",n(()=>{var e;if(this._activeTab===S.PHOTO&&this._shot(),this._activeTab===S.VIDEO){if(((e=this._mediaRecorder)==null?void 0:e.state)==="recording"){this._stopRecording();return}this._startRecording()}},"_chooseActionWithCamera"));d(this,"_updateTimer",n(()=>{let e=Math.floor((performance.now()-this.$._startTime+this.$._elapsedTime)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let i=this.cfg.maxVideoRecordingDuration-e;if(i<=0){this.ref.timer.textContent=os(i),this._stopRecording();return}this.ref.timer.textContent=os(i)}else this.ref.timer.textContent=os(e);this._animationFrameId=requestAnimationFrame(this._updateTimer)},"_updateTimer"));d(this,"_startTimer",n(()=>{this.$._startTime=performance.now(),this.$._elapsedTime=0,this._updateTimer()},"_startTimer"));d(this,"_stopTimer",n(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimer"));d(this,"_startTimeline",n(()=>{let e=this.ref.video.currentTime,i=this.ref.video.duration;this.ref.line.style.transform=`scaleX(${e/i})`,this.ref.timer.textContent=os(e),this._animationFrameId=requestAnimationFrame(this._startTimeline)},"_startTimeline"));d(this,"_stopTimeline",n(()=>{this._animationFrameId&&cancelAnimationFrame(this._animationFrameId)},"_stopTimeline"));d(this,"_startRecording",n(()=>{try{this._chunks=[],this._options={...this.cfg.mediaRecorderOptions};let{mimeType:e}=this.cfg.mediaRecorderOptions||{};e&&MediaRecorder.isTypeSupported(e)?this._options.mimeType=e:MediaRecorder.isTypeSupported(ba)?this._options.mimeType=ba:this._options.mimeType="video/mp4",this._stream&&(this._mediaRecorder=new MediaRecorder(this._stream,this._options),this._mediaRecorder.start(),this._mediaRecorder.addEventListener("dataavailable",i=>{this._chunks.push(i.data)}),this._startTimer(),this.classList.add("uc-recording"),this._setCameraState(ie.PLAY))}catch(e){console.error("Failed to start recording",e)}},"_startRecording"));d(this,"_stopRecording",n(()=>{var e,i;(e=this._mediaRecorder)==null||e.addEventListener("stop",()=>{this._previewVideo(),this._stopTimer(),this._setCameraState(ie.STOP)}),(i=this._mediaRecorder)==null||i.stop(),this.classList.remove("uc-recording")},"_stopRecording"));d(this,"_toggleRecording",n(()=>{var e;((e=this._mediaRecorder)==null?void 0:e.state)!=="recording"&&(!this.ref.video.paused&&!this.ref.video.ended&&this.ref.video.readyState>2?this.ref.video.pause():this.ref.video.paused&&this.ref.video.play())},"_toggleRecording"));d(this,"_toggleEnableAudio",n(()=>{var e;(e=this._stream)==null||e.getAudioTracks().forEach(i=>{i.enabled=!i.enabled,this.$.toggleMicrophoneIcon=i.enabled?"microphone":"microphone-mute",this.$.audioSelectDisabled=!i.enabled})},"_toggleEnableAudio"));d(this,"_previewVideo",n(()=>{var e;try{let i=new Blob(this._chunks,{type:(e=this._mediaRecorder)==null?void 0:e.mimeType}),r=URL.createObjectURL(i);this.ref.video.muted=!1,this.ref.video.volume=1,this.$.video=null,this.ref.video.src=r,this.ref.video.addEventListener("play",()=>{this._startTimeline(),this.set$({currentTimelineIcon:"pause"})}),this.ref.video.addEventListener("pause",()=>{this.set$({currentTimelineIcon:"play"}),this._stopTimeline()})}catch(i){console.error("Failed to preview video",i)}},"_previewVideo"));d(this,"_retake",n(()=>{this._setCameraState(ie.RETAKE),this._activeTab===S.VIDEO&&(this.$.video=this._stream,this.ref.video.muted=!0),this.ref.video.play()},"_retake"));d(this,"_accept",n(()=>{var o,a,l;if(this._setCameraState(ie.ACCEPT),this._activeTab===S.PHOTO){(o=this._canvas)==null||o.toBlob(c=>{let u=this._createFile("camera","jpeg",ga,c);this._toSend(u)},ga);return}let e=new Blob(this._chunks,{type:(a=this._mediaRecorder)==null?void 0:a.mimeType}),i=this._guessExtensionByMime((l=this._mediaRecorder)==null?void 0:l.mimeType),r=this._createFile("video",i,`video/${i}`,e);this._toSend(r),this._chunks=[]},"_accept"));d(this,"_handlePhoto",n(e=>{e===ie.SHOT&&this.set$({tabVideoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,cameraActionsHidden:!1,cameraSelectHidden:!0}),(e===ie.RETAKE||e===ie.ACCEPT)&&this.set$({tabVideoHidden:!this._cameraModes.includes(S.VIDEO),tabCameraHidden:!this._cameraModes.includes(S.PHOTO),cameraHidden:!1,cameraActionsHidden:!0,cameraSelectHidden:this._cameraDevices.length<=1})},"_handlePhoto"));d(this,"_handleVideo",n(e=>{e===ie.PLAY&&this.set$({timerHidden:!1,tabCameraHidden:!0,cameraSelectHidden:!0,audioSelectHidden:!0,currentTimelineIcon:"pause",currentIcon:"square",mutableClassButton:"uc-shot-btn uc-camera-action uc-stop-record"}),e===ie.STOP&&this.set$({timerHidden:!1,cameraHidden:!0,audioToggleMicrophoneHidden:!0,cameraActionsHidden:!1}),(e===ie.RETAKE||e===ie.ACCEPT)&&this.set$({timerHidden:!0,tabVideoHidden:!this._cameraModes.includes(S.VIDEO),tabCameraHidden:!this._cameraModes.includes(S.PHOTO),cameraHidden:!1,cameraActionsHidden:!0,audioToggleMicrophoneHidden:!this.cfg.enableAudioRecording,currentIcon:"video-camera-full",mutableClassButton:"uc-shot-btn uc-camera-action",audioSelectHidden:!this.cfg.enableAudioRecording||this._audioDevices.length<=1,cameraSelectHidden:this._cameraDevices.length<=1})},"_handleVideo"));d(this,"_setCameraState",n(e=>{this._activeTab===S.PHOTO&&(e==="shot"||e==="retake"||e==="accept")&&this._handlePhoto(e),this._activeTab===S.VIDEO&&(e==="play"||e==="stop"||e==="retake"||e==="accept"||e==="pause"||e==="resume")&&this._handleVideo(e)},"_setCameraState"));d(this,"_handleActiveTab",n(e=>{this.ref.switcher.querySelectorAll("button").forEach(i=>{i.classList.toggle("uc-active",i.getAttribute("data-id")===e)}),e===S.PHOTO&&this.set$({currentIcon:"camera-full",audioSelectHidden:!0,audioToggleMicrophoneHidden:!0}),e===S.VIDEO&&this.set$({currentTimelineIcon:"play",currentIcon:"video-camera-full",audioSelectHidden:!this.cfg.enableAudioRecording||this._audioDevices.length<=1,audioToggleMicrophoneHidden:!this.cfg.enableAudioRecording}),this._activeTab=e},"_handleActiveTab"));d(this,"_createFile",n((e,i,r,o)=>{let a=Date.now(),l=`${e}-${a}.${i}`;return new File([o],l,{lastModified:a,type:r})},"_createFile"));d(this,"_toSend",n(e=>{this.api.addFileFromObject(e,{source:L.CAMERA}),this.set$({"*currentActivity":b.activities.UPLOAD_LIST}),this.modalManager.open(b.activities.UPLOAD_LIST)},"_toSend"));d(this,"_setPermissionsState",M(e=>{this.classList.toggle("uc-initialized",e==="granted");let i=this._activeTab===S.VIDEO&&this.cfg.enableAudioRecording,r=this._activeTab===S.PHOTO?"camera-full":"video-camera-full";e==="granted"?this.set$({videoHidden:!1,cameraHidden:!1,tabCameraHidden:!this._cameraModes.includes(S.PHOTO),tabVideoHidden:!this._cameraModes.includes(S.VIDEO),messageHidden:!0,timerHidden:!0,currentIcon:r,audioToggleMicrophoneHidden:!i,audioSelectHidden:!i}):e==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,cameraHidden:!0,tabCameraHidden:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,messageHidden:!1,tabCameraHidden:!this._cameraModes.includes(S.PHOTO),tabVideoHidden:!this._cameraModes.includes(S.VIDEO),cameraActionsHidden:!0,mutableClassButton:"uc-shot-btn uc-camera-action"}),this._stopCapture())},300));d(this,"_makeStreamInactive",n(()=>{var r,o;if(!this._stream)return!1;let e=(r=this._stream)==null?void 0:r.getAudioTracks(),i=(o=this._stream)==null?void 0:o.getVideoTracks();e.forEach(a=>a.stop()),i.forEach(a=>a.stop())},"_makeStreamInactive"));d(this,"_stopCapture",n(()=>{var e;this._capturing&&(this.ref.video.volume=0,(e=this.$.video)==null||e.getTracks()[0].stop(),this.$.video=null,this._makeStreamInactive(),this._stopTimer(),this._capturing=!1)},"_stopCapture"));d(this,"_capture",n(async()=>{let e={video:Su,audio:this.cfg.enableAudioRecording?{}:!1};this._selectedCameraId&&(e.video={deviceId:{exact:this._selectedCameraId}}),this._selectedAudioId&&this.cfg.enableAudioRecording&&(e.audio={deviceId:{exact:this._selectedAudioId}}),this.ref.video.volume=0;try{this._setPermissionsState("prompt"),this._stream=await navigator.mediaDevices.getUserMedia(e),this._stream.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=this._stream,this._capturing=!0,this._setPermissionsState("granted")}catch(i){this._setPermissionsState("denied"),console.log("Failed to capture camera",i)}},"_capture"));d(this,"_handlePermissionsChange",n(()=>{this._capture()},"_handlePermissionsChange"));d(this,"_permissionAccess",n(async()=>{try{for(let e of ma)this[`${e}Response`]=await navigator.permissions.query({name:e}),this[`${e}Response`].addEventListener("change",this._handlePermissionsChange)}catch(e){console.log("Failed to use permissions API. Fallback to manual request mode.",e),this._capture()}},"_permissionAccess"));d(this,"_getPermission",n(()=>{},"_getPermission"));d(this,"_requestDeviceAccess",n(async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this._getDevices(),navigator.mediaDevices.addEventListener("devicechange",this._getDevices)}catch(e){console.log("Failed to get user media",e)}},"_requestDeviceAccess"));d(this,"_getDevices",n(async()=>{var e,i;try{let r=await navigator.mediaDevices.enumerateDevices();this._cameraDevices=r.filter(o=>o.kind==="videoinput").map((o,a)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${a+1}`,value:o.deviceId})),this._audioDevices=this.cfg.enableAudioRecording&&r.filter(o=>o.kind==="audioinput").map(o=>({text:o.label.trim(),value:o.deviceId})),this._cameraDevices.length>1&&this.set$({cameraSelectOptions:this._cameraDevices,cameraSelectHidden:!1}),this._selectedCameraId=(e=this._cameraDevices[0])==null?void 0:e.value,this._audioDevices.length>1&&this.set$({audioSelectOptions:this._audioDevices,audioSelectHidden:!1}),this._selectedAudioId=(i=this._audioDevices[0])==null?void 0:i.value}catch(r){console.log("Failed to get devices",r)}},"_getDevices"));d(this,"_onActivate",n(async()=>{await this._permissionAccess(),await this._requestDeviceAccess(),await this._capture(),this._handleCameraModes(this._cameraModes)},"_onActivate"));d(this,"_onDeactivate",n(async()=>{this._unsubPermissions&&this._unsubPermissions(),!!window.chrome||this._setPermissionsState("denied"),this._stopCapture()},"_onDeactivate"));d(this,"_handleCameraModes",n(e=>{this.$.tabVideoHidden=!e.includes(S.VIDEO),this.$.tabCameraHidden=!e.includes(S.PHOTO);let i=e[0];(!this._activeTab||!e.includes(this._activeTab))&&this._handleActiveTab(i)},"_handleCameraModes"));this.init$={...this.init$,video:null,videoTransformCss:null,videoHidden:!0,messageHidden:!0,requestBtnHidden:fa(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",switcher:null,panels:null,timer:null,timerHidden:!0,cameraHidden:!0,cameraActionsHidden:!0,audioSelectOptions:null,audioSelectHidden:!0,audioSelectDisabled:!0,audioToggleMicrophoneHidden:!0,tabCameraHidden:!0,tabVideoHidden:!0,currentIcon:"camera-full",currentTimelineIcon:"play",toggleMicrophoneIcon:"microphone",_startTime:0,_elapsedTime:0,_animationFrameId:null,mutableClassButton:"uc-shot-btn uc-camera-action",onCameraSelectChange:n(e=>{this._selectedCameraId=e.target.value,this._capture()},"onCameraSelectChange"),onAudioSelectChange:n(e=>{this._selectedAudioId=e.target.value,this._capture()},"onAudioSelectChange"),onCancel:n(()=>{this.historyBack()},"onCancel"),onShot:n(()=>this._shot(),"onShot"),onRequestPermissions:n(()=>this._capture(),"onRequestPermissions"),onStartCamera:n(()=>this._chooseActionWithCamera(),"onStartCamera"),onStartRecording:n(()=>this._startRecording(),"onStartRecording"),onStopRecording:n(()=>this._stopRecording(),"onStopRecording"),onToggleRecording:n(()=>this._toggleRecording(),"onToggleRecording"),onToggleAudio:n(()=>this._toggleEnableAudio(),"onToggleAudio"),onRetake:n(()=>this._retake(),"onRetake"),onAccept:n(()=>this._accept(),"onAccept"),onClickTab:n(e=>{let i=e.currentTarget.getAttribute("data-id");i&&this._handleActiveTab(i)},"onClickTab")}}_shot(){if(this._setCameraState("shot"),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),!this._ctx)throw new Error("Failed to get canvas context");this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this.cfg.cameraMirror&&(this._ctx.translate(this._canvas.width,0),this._ctx.scale(-1,1)),this._ctx.drawImage(this.ref.video,0,0),this.ref.video.pause()}_guessExtensionByMime(e){let i={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(e==="")return"webm";if(e&&(e=e.split("/"),(e==null?void 0:e[0])==="video")){e=e.slice(1).join("/");let r=e==null?void 0:e.split(";")[0];if(i[r])return i[r]}return"avi"}get _cameraModes(){return V(this.cfg.cameraModes)}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null}),this.subConfigValue("enableAudioRecording",e=>{this.$.audioToggleMicrophoneHidden=!e,this.$.audioSelectDisabled=!e}),this.subConfigValue("cameraModes",e=>{if(!this.isActivityActive)return;let i=K(e);this._handleCameraModes(i)})}_destroy(){var e,i;for(let r of ma)(e=this[`${r}Response`])==null||e.removeEventListener("change",this._handlePermissionsChange);(i=navigator.mediaDevices)==null||i.removeEventListener("devicechange",this._getDevices)}async destroyCallback(){super.destroyCallback(),this._destroy()}};n(jr,"CameraSource");var Yt=jr;Yt.template=`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"><uc-icon name="back"></uc-icon></button><div set="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" set="$.options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" set="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" set="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div></div><div class="uc-controls"><div ref="switcher" class="uc-switcher" set="@hidden:!timerHidden"><button data-id="photo" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabCameraHidden" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" set="onclick: onClickTab; @hidden: tabVideoHidden" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" set="@hidden:timerHidden; onclick: onToggleRecording"><uc-icon set="@name: currentTimelineIcon"></uc-icon><span ref="timer"> 00:00 </span><span ref="line" class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" set="@hidden: cameraActionsHidden"><button type="button" class="uc-secondary-btn" set="onclick: onRetake">Retake</button><button type="button" class="uc-primary-btn" set="onclick: onAccept" data-testid="accept">Accept</button></div><button type="button" class="uc-shot-btn uc-camera-action" data-testid="shot" set="onclick: onStartCamera; @class: mutableClassButton; @hidden: cameraHidden;" ><uc-icon set="@name: currentIcon"></uc-icon></button><div class="uc-select"><button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicrophoneHidden;"><uc-icon set="@name:toggleMicrophoneIcon"></uc-icon></button><uc-select class="uc-audio-select" set="$.options: audioSelectOptions; onchange: onAudioSelectChange; @hidden: audioSelectHidden; @disabled: audioSelectDisabled" ></uc-select></div></div>`;var as=class as extends k{constructor(){super(...arguments);d(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};n(as,"UploadCtxProviderClass"),d(as,"styleAttrs",["uc-wgt-common"]);var ns=as;ns.EventType=$;var _a=ns;var Gr=class Gr extends k{constructor(){super(...arguments);d(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let e=this.uploadCollection.items().some(i=>this.uploadCollection.read(i).getValue("isUploading"));this.$.visible=e}),this.sub("visible",e=>{e?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",e=>{this.$.value=e})}destroyCallback(){var e;super.destroyCallback(),(e=this._unobserveCollection)==null||e.call(this)}};n(Gr,"ProgressBarCommon");var Jt=Gr;Jt.template='<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>';var Wr=class Wr extends y{constructor(){super();d(this,"_value",0);d(this,"_prevValue",0);d(this,"_visible",!0);this.init$={...this.init$,width:0,opacity:0}}initCallback(){super.initCallback();let e=n(()=>{let i=this.ref.fakeProgressLine;if(!this._visible){i.classList.add("uc-fake-progress--hidden");return}this._value>0&&i.classList.add("uc-fake-progress--hidden")},"handleFakeProgressAnimation");this.ref.fakeProgressLine.addEventListener("animationiteration",e),this.defineAccessor("value",i=>{i!=null&&(this._prevValue=this._value,this._value=i,this._visible&&this.style.setProperty("--l-progress-value",this._value.toString()))}),this.defineAccessor("visible",i=>{this._visible=i,this.classList.toggle("uc-progress-bar--hidden",!i)})}};n(Wr,"ProgressBar");var Qt=Wr;Qt.template=`<div ref="fakeProgressLine" class="uc-fake-progress"></div><div ref="realProgressLine" class="uc-progress"></div>`;var pe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function va(...s){return s.reduce((t,e)=>{if(typeof e=="string")return t[e]=!0,t;for(let i of Object.keys(e))t[i]=e[i];return t},{})}n(va,"normalize");function z(...s){let t=va(...s);return Object.keys(t).reduce((e,i)=>(t[i]&&e.push(i),e),[]).join(" ")}n(z,"classNames");function ya(s,...t){let e=va(...t);for(let i of Object.keys(e))s.classList.toggle(i,e[i])}n(ya,"applyClassNames");var wa=n(s=>{if(!s)return Z;let t=K(s).filter(e=>Z.includes(e));return t.length===0?Z:t},"parseTabs");function Ca(s){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":Z,"*tabId":U.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:pe,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:ye(Z),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":n(()=>{let t=s.querySelectorAll("img");for(let e of t){let i=e.src;e.src=pe,e.src=i}s.$["*networkProblems"]=!1},"*on.retryNetwork"),"*on.apply":n(t=>{if(!t)return;let e=s.$["*originalUrl"],i=B(Ie(t),"preview"),r=F(e,i),o={originalUrl:e,cdnUrlModifiers:i,cdnUrl:r,transformations:t};s.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),s.remove()},"*on.apply"),"*on.cancel":n(()=>{s.remove(),s.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},"*on.cancel")}}n(Ca,"initState");var xa="<svg width='0' height='0' style='position:absolute'><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='puc-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(#puc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-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(#suc-icon-id__h)'/><defs><linearGradient id='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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='suc-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='suc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Aa=`${xa} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${pe}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var ls=class ls extends y{constructor(){super();d(this,"ctxOwner",!0);d(this,"_debouncedShowLoader",M(this._showLoader.bind(this),300));this.init$={...this.init$,...Ca(this)}}_showLoader(e){this.$.showLoader=e}_waitForSize(){return new Promise((i,r)=>{let o=setTimeout(()=>{r(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),a=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(i(),clearTimeout(o),a.disconnect())});a.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let e=vi(this.$.cdnUrl),i=Se(this.$.cdnUrl,e);if(i===this.$["*originalUrl"])return;this.$["*originalUrl"]=i;let r=So(this.$.cdnUrl),o=Lo(r);this.$["*editorTransformations"]=o}else if(this.$.uuid){let e=Se(this.cfg.cdnCname,this.$.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===U.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let e=await this.proxyUrl(F(this.$["*originalUrl"],B("json"))),i=await fetch(e).then(a=>a.json()),{width:r,height:o}=i;this.$["*imageSize"]={width:r,height:o},this.$["*tabId"]===U.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(e){e&&console.error("Failed to load image info",e)}}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==pe&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",e=>{let i=this.ref["img-el"];i.src!==e&&(this._imgLoading=!0,i.src=e||pe)}),this.sub("cropPreset",e=>{this.$["*cropPresetList"]=Vi(e)}),this.sub("tabs",e=>{this.$["*tabList"]=wa(e)}),this.sub("*tabId",e=>{this.ref["img-el"].className=z("uc-image",{"uc-image_hidden_to_cropper":e===U.CROP,"uc-image_hidden_effects":e!==U.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{this.$["presence.networkProblems"]=e,this.$["presence.modalCaption"]=!e}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let i=this.$["*originalUrl"],r=B(Ie(e),"preview"),o=F(i,r),a={originalUrl:i,cdnUrlModifiers:r,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:a,bubbles:!0,composed:!0}))},!1),this.sub("uuid",e=>e&&this.updateImage()),this.sub("cdnUrl",e=>e&&this.updateImage())}};n(ls,"CloudImageEditorBlock"),d(ls,"styleAttrs",["uc-cloud-image-editor"]);var fe=ls;fe.template=Aa;fe.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Xr=class Xr extends y{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(t){let e=this.$["*imageBox"];if(!e)return;if(t===""&&e.height<=A&&e.width<=A)return!0;let i=e.height<=A&&(t.includes("n")||t.includes("s")),r=e.width<=A&&(t.includes("e")||t.includes("w"));return i||r}_createBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:r,height:o}=t,a=this.ref["svg-el"],l=ee("mask",{id:"backdrop-mask"}),c=ee("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=ee("rect",{x:e,y:i,width:r,height:o,fill:"black"});l.appendChild(c),l.appendChild(u);let p=ee("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});a.appendChild(p),a.appendChild(l),this._backdropMask=l,this._backdropMaskInner=u}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:i,width:r,height:o}=t;this._backdropMaskInner&&Me(this._backdropMaskInner,{x:e,y:i,width:r,height:o})}_updateFrame(){let t=this.$["*cropBox"];if(!(!t||!this._frameGuides||!this._frameThumbs)){for(let e of Object.values(this._frameThumbs)){let{direction:i,pathNode:r,interactionNode:o,groupNode:a}=e,l=i==="",c=i.length===2,{x:u,y:p,width:h,height:f}=t;if(l)Me(o,{x:u,y:p,width:h,height:f});else{let g=Le(Math.min(h,f)/(24*2+34)/2,0,1),{d:_,center:C}=c?mn(t,i,g):gn(t,i,g),x=Math.max(rr*Le(Math.min(h,f)/rr/3,0,1),fn);Me(o,{x:C[0]-x,y:C[1]-x,width:x*2,height:x*2}),Me(r,{d:_})}let m=this._shouldThumbBeDisabled(i);a.setAttribute("class",z("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}))}Me(this._frameGuides,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1})}}_createThumb(t,e){let i=ee("g");i.classList.add("uc-thumb"),i.setAttribute("with-effects","");let r=ee("rect",{fill:"transparent"}),o=ee("path",{stroke:"currentColor",fill:"none","stroke-width":3});i.appendChild(o),i.appendChild(r),t[e]={direction:e,pathNode:o,interactionNode:r,groupNode:i},e===""&&(i.style.cursor="move"),r.addEventListener("pointerdown",this._handlePointerDown.bind(this,e))}_createThumbs(){let t={};for(let e=0;e<3;e++)for(let i=0;i<3;i++){let r=`${["n","","s"][e]}${["w","","e"][i]}`;r!==""&&this._createThumb(t,r)}return this._createThumb(t,""),t}_createGuides(){let t=ee("svg"),e=ee("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let i=1;i<=2;i++){let r=ee("line",{x1:`${Vt*i}%`,y1:"0%",x2:`${Vt*i}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(r)}for(let i=1;i<=2;i++){let r=ee("line",{x1:"0%",y1:`${Vt*i}%`,x2:"100%",y2:`${Vt*i}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(r)}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}_createFrame(){let t=this.ref["svg-el"],e=document.createDocumentFragment(),i=this._createGuides();e.appendChild(i);let r=this._createThumbs();for(let{groupNode:o}of Object.values(r))e.appendChild(o);t.appendChild(e),this._frameThumbs=r,this._frameGuides=i}_handlePointerDown(t,e){if(!this._frameThumbs)return;let i=this._frameThumbs[t];if(this._shouldThumbBeDisabled(t))return;let r=this.$["*cropBox"],{x:o,y:a}=this.ref["svg-el"].getBoundingClientRect(),l=e.x-o,c=e.y-a;this.$.dragging=!0,this._draggingThumb=i,this._dragStartPoint=[l,c],this._dragStartCrop={...r}}_handlePointerUp_(t){this._updateCursor(),this.$.dragging&&(t.stopPropagation(),t.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(t){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;t.stopPropagation(),t.preventDefault();let e=this.ref["svg-el"],{x:i,y:r}=e.getBoundingClientRect(),o=t.x-i,a=t.y-r,l=o-this._dragStartPoint[0],c=a-this._dragStartPoint[1],{direction:u}=this._draggingThumb,p=this._calcCropBox(u,[l,c]);p&&(this.$["*cropBox"]=p)}_calcCropBox(t,e){var u,p;let[i,r]=e,o=this.$["*imageBox"],a=(u=this._dragStartCrop)!=null?u:this.$["*cropBox"],l=(p=this.$["*cropPresetList"])==null?void 0:p[0],c=l?l.width/l.height:void 0;if(t===""?a=_n({rect:a,delta:[i,r],imageBox:o}):a=vn({rect:a,delta:[i,r],direction:t,aspectRatio:c,imageBox:o}),!Object.values(a).every(h=>Number.isFinite(h)&&h>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return st(ot(a),this.$["*imageBox"])}_handleSvgPointerMove_(t){if(!this._frameThumbs)return;let e=Object.values(this._frameThumbs).find(i=>{if(this._shouldThumbBeDisabled(i.direction))return!1;let o=i.interactionNode.getBoundingClientRect(),a={x:o.x,y:o.y,width:o.width,height:o.height};return yn(a,[t.x,t.y])});this._hoverThumb=e,this._updateCursor()}_updateCursor(){let t=this._hoverThumb;this.ref["svg-el"].style.cursor=t?bn(t.direction):"initial"}_createMask(t){if(this._frameImage){this._frameImage.setAttribute("href",t);return}let e=this.ref["svg-el"],i=document.createDocumentFragment(),r=ee("image",{href:t});r.setAttribute("class","uc-cloud-mask"),i.appendChild(r),e.appendChild(i),this._frameImage=r}_updateMask(){let t=this.$["*cropBox"];if(!t||!this._frameImage)return;let{x:e,y:i,width:r,height:o}=t;Me(this._frameImage,{x:e,y:i,height:o,width:r})}_render(){this._updateBackdrop(),this._updateFrame(),this._updateMask()}toggleThumbs(t){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:e})=>e).forEach(e=>{e.setAttribute("class",z("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",t=>{t&&(this._guidesHidden=t.height<=A||t.width<=A,window.requestAnimationFrame(()=>{this._render()}))}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this._createMask(t)}),this.sub("dragging",t=>{this._frameGuides&&this._frameGuides.setAttribute("class",z({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&t,"uc-guides--semi-hidden":!this._guidesHidden&&!t}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};n(Xr,"CropFrame");var ei=Xr;ei.template='<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>';var qr=class qr extends y{constructor(){super(...arguments);d(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null,"title-prop":""})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",e=>{this._titleEl&&(this._titleEl.style.display=e?"block":"none")}),this.sub("active",e=>{this.className=z({"uc-active":e,"uc-not_active":!e})}),this.sub("on.click",e=>{this.onclick=e})}};n(qr,"EditorButtonControl");var Ee=qr;Ee.template=`<button role="option" type="button" set="@aria-label:title-prop;" l10n="@title:title-prop;"><uc-icon set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Ou(s){let t=s+90;return t=t>=360?0:t,t}n(Ou,"nextAngle");function ku(s,t){return s==="rotate"?Ou(t):["mirror","flip"].includes(s)?!t:null}n(ku,"nextValue");var Zr=class Zr extends Ee{initCallback(){super.initCallback(),this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(t).toLowerCase()})))}),this.$["on.click"]=()=>{let t=this.$["*cropperEl"].getValue(this._operation),e=ku(this._operation,t);this.$["*cropperEl"].setValue(this._operation,e)}}};n(Zr,"EditorCropButtonControl");var yt=Zr;var ti={FILTER:"filter",COLOR_OPERATION:"color_operation"},me="original",Kr=class Kr extends y{constructor(){super(...arguments);d(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":n(e=>{this.$["*faderEl"].set(e),this.$.value=e},"on.input")})}setOperation(e,i){this._controlType=e==="filter"?ti.FILTER:ti.COLOR_OPERATION,this._operation=e,this._iconName=e,this._title=e.toUpperCase(),this._filter=i,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===me?void 0:this.$.value,filter:this._filter===me?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:e,zero:i}=le[this._operation],[r,o]=e;this.$.min=r,this.$.max=o,this.$.zero=i;let a=this.$["*editorTransformations"][this._operation];if(this._controlType===ti.FILTER){let l=o;if(a){let{name:c,amount:u}=a;l=c===this._filter?u:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===ti.COLOR_OPERATION){let l=typeof a!="undefined"?a:i;this.$.value=l,this.$.defaultValue=l}}apply(){let e;this._controlType===ti.FILTER?this._filter===me?e=null:e={name:this._filter,amount:this.$.value}:e=this.$.value;let i={...this.$["*editorTransformations"],[this._operation]:e};this.$["*editorTransformations"]=i}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{this._originalUrl=e}),this.sub("value",e=>{let i=`${this._filter||this._operation} ${e}`;this.$["*operationTooltip"]=i})}};n(Kr,"EditorSlider");var ii=Kr;ii.template=`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function je(s){let t=new Image;return{promise:new Promise((r,o)=>{t.src=s,t.onload=r,t.onerror=o}),image:t,cancel:n(()=>{t.naturalWidth===0&&(t.src=pe)},"cancel")}}n(je,"preloadImage");function si(s){let t=[];for(let o of s){let a=je(o);t.push(a)}let e=t.map(o=>o.image);return{promise:Promise.allSettled(t.map(o=>o.promise)),images:e,cancel:n(()=>{t.forEach(o=>{o.cancel()})},"cancel")}}n(si,"batchPreloadImages");var Yr=class Yr extends Ee{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,iconSize:"20","on.click":null}}_previewSrc(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=window.devicePixelRatio,i=Math.ceil(e*t),r=e>=2?"lightest":"normal",o=100,a={...this.$["*editorTransformations"]};return a[this._operation]=this._filter!==me?{name:this._filter,amount:o}:void 0,F(this._originalUrl,B(yi,Ie(a),`quality/${r}`,`scale_crop/${i}x${i}/center`))}async _observerCallback(t,e){var r;if(t[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),a=this.ref["preview-el"],{promise:l,cancel:c}=je(o);this._cancelPreload=c,l.catch(u=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:u})}).finally(()=>{a.style.backgroundImage=`url(${o})`,a.setAttribute("loaded",""),e.unobserve(this)})}else(r=this._cancelPreload)==null||r.call(this)}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===me,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()}))}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this._originalUrl=t,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",e=>{this.$.active=e&&e===this._filter}),this.sub("isOriginal",e=>{this.$.iconSize=e?40:20}),this.sub("active",e=>{if(this.$.isOriginal)return;let i=this.ref["icon-el"];i.style.opacity=e?"1":"0";let r=this.ref["preview-el"];e?r.style.opacity="0":r.style.backgroundImage&&(r.style.opacity="1")}),this.sub("*networkProblems",async e=>{if(!e){let i=await this.proxyUrl(this._previewSrc()),r=this.ref["preview-el"];r.style.backgroundImage&&(r.style.backgroundImage="none",r.style.backgroundImage=`url(${i})`)}})}destroyCallback(){var t,e;super.destroyCallback(),(t=this._observer)==null||t.disconnect(),(e=this._cancelPreload)==null||e.call(this)}};n(Yr,"EditorFilterControl");var Ge=Yr;Ge.template=`<button type="button" role="option" l10n="@title:title-prop;@aria-label:title-prop"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var Jr=class Jr extends Ee{constructor(){super(...arguments);d(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=e=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()})),this.bindL10n("title",()=>this.l10n(e)))}),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:i}=le[this._operation],r=e[this._operation],o=typeof r!="undefined"?r!==i:!1;this.$.active=o})}};n(Jr,"EditorOperationControl");var wt=Jr;function Ea(s,t){let e={};for(let i of t){let r=s[i];(s.hasOwnProperty(i)||r!==void 0)&&(e[i]=r)}return e}n(Ea,"pick");function Ct(s,t,e){let r=window.devicePixelRatio,o=Math.min(Math.ceil(t*r),3e3),a=r>=2?"lightest":"normal";return F(s,B(yi,Ie(e),`quality/${a}`,`stretch/off/-/resize/${o}x`,`@clib/${Fe}/${Ne}/uc-cloud-image-editor/`))}n(Ct,"viewerImageSrc");function $u(s){return s?[({dimensions:e,coords:i})=>[...e,...i].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:e,coords:i})=>e.every(r=>r>0)&&i.every(r=>r>=0)].every(e=>e(s)):!0}n($u,"validateCrop");var Qr=class Qr extends y{constructor(){super();d(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=M(this._commit.bind(this),300),this._handleResizeThrottled=gt(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let e=this.$["*editorTransformations"],i=Ea(e,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...i};this.$["*operations"]=r}_initCanvas(){let e=this.ref["canvas-el"],i=e.getContext("2d"),r=this.offsetWidth,o=this.offsetHeight,a=window.devicePixelRatio;e.style.width=`${r}px`,e.style.height=`${o}px`,e.width=r*a,e.height=o*a,i==null||i.scale(a,a),this._canvas=e,this._ctx=i}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,i=this.$["*padding"],r=this.$["*operations"],{rotate:o}=r,a={width:this.offsetWidth,height:this.offsetHeight},l=rt({width:e.naturalWidth,height:e.naturalHeight},o),c;if(l.width>a.width-i*2||l.height>a.height-i*2){let u=l.width/l.height,p=a.width/a.height;if(u>p){let h=a.width-i*2,f=h/u,m=0+i,g=i+(a.height-i*2)/2-f/2;c={x:m,y:g,width:h,height:f}}else{let h=a.height-i*2,f=h*u,m=i+(a.width-i*2)/2-f/2,g=0+i;c={x:m,y:g,width:f,height:h}}}else{let{width:u,height:p}=l,h=i+(a.width-i*2)/2-u/2,f=i+(a.height-i*2)/2-p/2;c={x:h,y:f,width:u,height:p}}this.$["*imageBox"]=ot(c)}_alignCrop(){var f;let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,a=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=this.$["*imageBox"];if(a){let{dimensions:[m,g],coords:[_,C]}=a,{width:x}=rt(this._imageSize,o),v=l/x;e=st(ot({x:c+_*v,y:u+C*v,width:m*v,height:g*v}),this.$["*imageBox"])}let p=(f=this.$["*cropPresetList"])==null?void 0:f[0],h=p?p.width/p.height:void 0;if(!wn(e,i)||h&&!Cn(e,h)){let m=i.width/i.height,g=i.width,_=i.height;h&&(m>h?g=Math.min(i.height*h,i.width):_=Math.min(i.width/h,i.height)),e={x:i.x+i.width/2-g/2,y:i.y+i.height/2-_/2,width:g,height:_}}this.$["*cropBox"]=st(ot(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let i=this.$.image,r=this.$["*imageBox"],o=this.$["*operations"],{mirror:a,flip:l,rotate:c}=o,u=rt({width:r.width,height:r.height},c);e.save(),e.translate(r.x+r.width/2,r.y+r.height/2),e.rotate(c*Math.PI*-1/180),e.scale(a?-1:1,l?-1:1),e.drawImage(i,-u.width/2,-u.height/2,u.width,u.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=z({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:a,height:l}=i,{width:c,height:u}=rt(this._imageSize,o),{width:p,height:h}=e,f=a/c,m=l/u;return[Le(Math.round(p/f),1,c),Le(Math.round(h/m),1,u)]}_getCropTransformation(){let e=this.$["*cropBox"],i=this.$["*imageBox"],r=this.$["*operations"],{rotate:o}=r,{width:a,height:l,x:c,y:u}=i,{width:p,height:h}=rt(this._imageSize,o),{x:f,y:m}=e,g=a/p,_=l/h,C=this._getCropDimensions(),x={dimensions:C,coords:[Le(Math.round((f-c)/g),0,p-C[0]),Le(Math.round((m-u)/_),0,h-C[1])]};if(!$u(x)){console.error("Cropper is trying to create invalid crop object",{payload:x});return}if(!(C[0]===p&&C[1]===h))return x}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:i,mirror:r,flip:o}=e,a=this._getCropTransformation(),c={...this.$["*editorTransformations"],crop:a,rotate:i,mirror:r,flip:o};this.$["*editorTransformations"]=c}setValue(e,i){this.$["*operations"]={...this.$["*operations"],[e]:i},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:i}={}){if(!this._isActive){this._isActive=!0,this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:i})}catch(r){console.error("Failed to activate cropper",{error:r})}this._observer=new ResizeObserver(([r])=>{r.contentRect.width>0&&r.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:e=!1}={}){var i;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=z({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(i=this._observer)==null||i.disconnect())}_transitionToCrop(){let e=this._getCropDimensions(),i=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,r=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,o=Math.min(i,r),a=this.$["*cropBox"].x+this.$["*cropBox"].width/2,l=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-a)/o}px, ${(this.offsetHeight/2-l)/o}px)`,this.style.transformOrigin=`${a}px ${l}px`}_transitionToImage(){let e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,i=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${i}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(e,i){var p;let r=this.offsetWidth;i={...i,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(Ct(e,r,i)),{promise:a,cancel:l,image:c}=je(o),u=this._handleImageLoading(o);return c.addEventListener("load",u,{once:!0}),c.addEventListener("error",u,{once:!0}),(p=this._cancelPreload)==null||p.call(this),this._cancelPreload=l,a.then(()=>c).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(c)))}_handleImageLoading(e){let i="crop",r=this.$["*loadingOperations"];return r.get(i)||r.set(i,new Map),r.get(i).get(e)||(r.set(i,r.get(i).set(e,!0)),this.$["*loadingOperations"]=r),()=>{var o;(o=r==null?void 0:r.get(i))!=null&&o.has(e)&&(r.get(i).delete(e),this.$["*loadingOperations"]=r)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};n(Qr,"EditorImageCropper");var ri=Qr;ri.template=`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function eo(s,t,e){let i=Array(e);e--;for(let r=e;r>=0;r--)i[r]=Math.ceil((r*t+(e-r)*s)/e);return i}n(eo,"linspace");function Mu(s){return s.reduce((t,e,i)=>i<s.length-1?[...t,[e,s[i+1]]]:t,[])}n(Mu,"splitBySections");function Lu(s,t,e){let i=Mu(s).find(([r,o])=>r<=t&&t<=o);return s.map(r=>{let o=Math.abs(i[0]-i[1]),a=Math.abs(t-i[0])/o;return i[0]===r?t>e?1:1-a:i[1]===r?t>=e?a:1:0})}n(Lu,"calculateOpacities");function Pu(s,t){return s.map((e,i)=>e<t?s.length-i:i)}n(Pu,"calculateZIndices");function Ta(s,t){let e=le[s].keypointsNumber,{range:i,zero:r}=le[s];return[...new Set([...eo(i[0],r,e+1),...eo(r,i[1],e+1),r,t])].sort((o,a)=>o-a)}n(Ta,"keypointsRange");var to=class to extends y{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=M(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(t){let e=this._operation,i=this.$["*loadingOperations"];return i.get(e)||i.set(e,new Map),i.get(e).get(t)||(i.set(e,i.get(e).set(t,!0)),this.$["*loadingOperations"]=i),()=>{var r;(r=i==null?void 0:i.get(e))!=null&&r.has(t)&&(i.get(e).delete(t),this.$["*loadingOperations"]=i)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let t of this._keypoints){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString())}})}async _imageSrc({url:t=this._url,filter:e=this._filter,operation:i,value:r}={}){let o={...this._transformations};i&&(o[i]=e?{name:e,amount:r}:r);let a=this.offsetWidth;return await this.proxyUrl(Ct(t,a,o))}async _constructKeypoint(t,e){return{src:await this._imageSrc({operation:t,value:e}),image:null,opacity:0,zIndex:0,value:e}}_isSame(t,e){return this._operation===t&&this._filter===e}async _addKeypoint(t,e,i){let r=n(()=>!this._isSame(t,e)||this._value!==i||!!this._keypoints.find(c=>c.value===i),"shouldSkip");if(r())return;let o=await this._constructKeypoint(t,i),a=new Image;a.src=o.src;let l=this._handleImageLoading(o.src);a.addEventListener("load",l,{once:!0}),a.addEventListener("error",l,{once:!0}),o.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(r())return;let c=this._keypoints,u=c.findIndex(h=>h.value>i),p=u<c.length?c[u].image:null;!this._container||p&&!this._container.contains(p)||(c.splice(u,0,o),this._container.insertBefore(a,p),this._update(t,i))},{once:!0}),a.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(t){t=typeof t=="string"?parseInt(t,10):t,this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t)}_update(t,e){this._operation=t,this._value=e;let{zero:i}=le[t],r=this._keypoints.map(l=>l.value),o=Lu(r,e,i),a=Pu(r,i);for(let[l,c]of Object.entries(this._keypoints))c.opacity=o[l],c.zIndex=a[l];this._flush()}_createPreviewImage(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async _initNodes(){let t=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&t.appendChild(this._previewImage);let e=document.createElement("div");t.appendChild(e);let i=this._keypoints.map(u=>u.src),{images:r,promise:o,cancel:a}=si(i);r.forEach(u=>{let p=this._handleImageLoading(u.src);u.addEventListener("load",p),u.addEventListener("error",p)}),this._cancelLastImages=()=>{a(),this._cancelLastImages=void 0};let l=this._operation,c=this._filter;await o,this._isActive&&this._isSame(l,c)&&(this._container&&this._container.remove(),this._container=e,this._keypoints.forEach((u,p)=>{let h=r[p];h.classList.add("uc-fader-image"),u.image=h,this._container.appendChild(h)}),this.appendChild(t),this._flush())}async setTransformations(t){if(this._transformations=t,this._previewImage){let e=await this._imageSrc(),i=this._handleImageLoading(e);this._previewImage.src=e,this._previewImage.addEventListener("load",i,{once:!0}),this._previewImage.addEventListener("error",i,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:t,filter:e,operation:i,value:r}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Ta(i,r),a=await Promise.all(o.map(c=>this._imageSrc({url:t,filter:e,operation:i,value:c}))),{cancel:l}=si(a);this._cancelBatchPreload=l}_setOriginalSrc(t){let e=this._previewImage||this._createPreviewImage();if(!this.contains(e)&&this.appendChild(e),this._previewImage=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=z({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}e.style.opacity="0";let i=this._handleImageLoading(t);e.addEventListener("error",i,{once:!0}),e.src=t,e.addEventListener("load",()=>{i(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=z({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),e.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:t,operation:e,value:i,filter:r,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=t,this._operation=e||"initial",this._value=i,this._filter=r,this._fromViewer=o,typeof i!="number"&&!r){let l=await this._imageSrc({operation:e,value:i});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Ta(e,i).map(l=>this._constructKeypoint(e,l))),this._update(e,i),this._initNodes()}deactivate({hide:t=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),t&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=z({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};n(to,"EditorImageFader");var cs=to;var Uu=1,io=class io extends y{initCallback(){super.initCallback(),this.addEventListener("wheel",t=>{t.preventDefault();let{deltaY:e,deltaX:i}=t;Math.abs(i)>Uu?this.scrollLeft+=i:this.scrollLeft+=e},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};n(io,"EditorScroller");var oi=io;oi.template=" <slot></slot> ";function Ru(s){return`<uc-presence-toggle class="uc-tab-toggle" set="visible: presence.tabToggle.${s}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${s}" data-id="${s}" icon="${s}" set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${s}; title-prop: a11y-editor-tab-${s}" ></uc-btn-ui></uc-presence-toggle>`}n(Ru,"renderTabToggle");function Du(s){return`<uc-presence-toggle id="tab_${s}" class="uc-tab-content" set="visible: presence.tabContent.${s}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${s}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}n(Du,"renderTabContent");var so=class so extends y{constructor(){super();d(this,"_updateInfoTooltip",M(()=>{var a,l;let e=this.$["*editorTransformations"],i=this.$["*currentOperation"],r="",o=!1;if(this.$["*tabId"]===U.FILTERS)if(o=!0,this.$["*currentFilter"]&&((a=e==null?void 0:e.filter)==null?void 0:a.name)===this.$["*currentFilter"]){let c=((l=e==null?void 0:e.filter)==null?void 0:l.amount)||100;r=this.$["*currentFilter"]+" "+c}else r=this.l10n(me);else if(this.$["*tabId"]===U.TUNING&&i){o=!0;let c=(e==null?void 0:e[i])||le[i].zero;r=this.l10n(i)+" "+c}o&&(this.$["*operationTooltip"]=r),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":me,"*currentOperation":null,showLoader:!1,filters:Uo,colorOperations:Po,cropOperations:Ro,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":n(()=>{var e;(e=this._cancelPreload)==null||e.call(this),this.$["*on.cancel"]()},"on.cancel"),"on.apply":n(()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.apply"),"on.applySlider":n(()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.applySlider"),"on.cancelSlider":n(()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.cancelSlider"),"on.clickTab":n(e=>{let i=e.currentTarget.getAttribute("data-id");i&&this._activateTab(i,{fromViewer:!1})},"on.clickTab"),tab_role:"tab",[`tab_${U.TUNING}`]:`tab_${U.TUNING}`,[`tab_${U.CROP}`]:`tab_${U.CROP}`,[`tab_${U.FILTERS}`]:`tab_${U.FILTERS}`,cancel:"cancel",apply:"apply","a11y-editor-tab-filters":"a11y-editor-tab-filters","a11y-editor-tab-tuning":"a11y-editor-tab-tuning","a11y-editor-tab-crop":"a11y-editor-tab-crop"},this._debouncedShowLoader=M(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===U.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(e){let i=new wt;return i.operation=e,i}_createFilterControl(e){let i=new Ge;return i.filter=e,i}_createToggleControl(e){let i=new yt;return i.operation=e,i}_renderControlsList(e){let i=this.ref[`controls-list-${e}`],r=document.createDocumentFragment();e===U.CROP?this.$.cropOperations.forEach(o=>{let a=this._createToggleControl(o);r.appendChild(a)}):e===U.FILTERS?[me,...this.$.filters].forEach(o=>{let a=this._createFilterControl(o);r.appendChild(a)}):e===U.TUNING&&this.$.colorOperations.forEach(o=>{let a=this._createOperationControl(o);r.appendChild(a)}),[...r.children].forEach((o,a)=>{a===r.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),i.innerHTML="",i.appendChild(r)}_activateTab(e,{fromViewer:i}){this.$["*tabId"]=e,e===U.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:i})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:i}),this.$["*cropperEl"].deactivate());for(let r of Z){let o=r===e,a=this.ref[`tab-toggle-${r}`];a.active=o,o?(this._renderControlsList(e),this._syncTabIndicator()):this._unmountTabControls(r),this.$[`presence.tabContent.${r}`]=o}}_unmountTabControls(e){let i=this.ref[`controls-list-${e}`];i&&(i.innerHTML="")}_syncTabIndicator(){let e=this.ref[`tab-toggle-${this.$["*tabId"]}`],i=this.ref["tabs-indicator"];i.style.transform=`translateX(${e.offsetLeft}px)`}async _preloadEditedImage(){var e;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let i=this.$["*imgContainerEl"].offsetWidth,r=await this.proxyUrl(Ct(this.$["*originalUrl"],i,this.$["*editorTransformations"]));(e=this._cancelPreload)==null||e.call(this);let{cancel:o}=si([r]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(e){this.$.showLoader=e}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",e=>{e&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",e=>{var r;let i=(r=e==null?void 0:e.filter)==null?void 0:r.name;this.$["*currentFilter"]!==i&&(this.$["*currentFilter"]=i)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",e=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(e)}),this.sub("*loadingOperations",e=>{let i=!1;for(let[,r]of e.entries()){if(i)break;for(let[,o]of r.entries())if(o){i=!0;break}}this._debouncedShowLoader(i)}),this.sub("*showSlider",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e}),this.sub("*tabList",e=>{this.$["presence.tabToggles"]=e.length>1;for(let i of Z){this.$[`presence.tabToggle.${i}`]=e.includes(i);let r=this.ref[`tab-toggle-${i}`];r.style.gridColumn=e.indexOf(i)+1}e.includes(this.$["*tabId"])||this._activateTab(e[0],{fromViewer:!1})}),this._updateInfoTooltip()}destroyCallback(){this.$["*showSlider"]=!1}};n(so,"EditorToolbar");var ni=so;ni.template=`<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${Z.map(Du).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${Z.map(Ru).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop:apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" set="onclick: on.cancelSlider" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" set="onclick: on.applySlider" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var ro=class ro extends y{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":"","title-prop":""},this.defineAccessor("active",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return z("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",t=>{this._iconSingle=!this.$.text,this._iconHidden=!t,this.$.iconCss=this._iconCss()}),this.sub("theme",t=>{t!=="custom"&&(this.className=`uc-${t}`)}),this.sub("text",t=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",t=>{this.$["aria-role"]=t||""}),this.defineAccessor("aria-controls",t=>{this.$["aria-controls"]=t||""}),this.defineAccessor("title-prop",t=>{this.$["title-prop"]=t||""})}set reverse(t){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};n(ro,"BtnUi");var xt=ro;xt.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});xt.template=`<button type="button" set="@role:aria-role; @aria-controls: aria-controls; @aria-label:title-prop" l10n="@title:title-prop;" ><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var oo=class oo extends y{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let t=this.ref["line-el"];t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",t=>{typeof t=="boolean"&&(t?this._start():this._stop())})}_start(){this._active=!0;let{width:t}=this.getBoundingClientRect(),e=this.ref["line-el"];e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};n(oo,"LineLoaderUi");var ai=oo;ai.template=`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var us={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},no=class no extends y{constructor(){super(),this._visible=!1,this._visibleStyle=us.visible,this._hiddenStyle=us.hidden,this._externalTransitions=!1,this.defineAccessor("styles",t=>{t&&(this._externalTransitions=!0,this._visibleStyle=t.visible,this._hiddenStyle=t.hidden)}),this.defineAccessor("visible",t=>{typeof t=="boolean"&&(this._visible=t,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",ya(this,{[us.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(us.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};n(no,"PresenceToggle");var li=no;li.template="<slot></slot> ";var ao=class ao extends y{constructor(){super();d(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":n(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e),this.$.onInput&&this.$.onInput(e)},"on.sliderInput"),"on.sliderChange":n(()=>{let e=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(e)},"on.sliderChange")});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",i=>{this.$.disabled=i}),this.defineAccessor("min",i=>{this.$.min=i}),this.defineAccessor("max",i=>{this.$.max=i}),this.defineAccessor("defaultValue",i=>{this.$.defaultValue=i,this.ref["input-el"].value=i,this._updateValue(i)}),this.defineAccessor("zero",i=>{this._zero=i}),this.defineAccessor("onInput",i=>{i&&(this.$.onInput=i)}),this.defineAccessor("onChange",i=>{i&&(this.$.onChange=i)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let i=parseInt(this.ref["input-el"].value,10);this._updateValue(i)},0),this.sub("disabled",i=>{let r=this.ref["input-el"];i?r.setAttribute("disabled","disabled"):r.removeAttribute("disabled")});let e=this.ref["input-el"];e.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),e.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(e){this._updateZeroDot(e);let{width:i}=this.getBoundingClientRect(),a=100/(this.$.max-this.$.min)*(e-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${a}px)`})}_updateZeroDot(e){if(!this._zeroDotEl)return;e===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="1";let{width:i}=this.getBoundingClientRect(),a=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(i-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${a}px)`})}_updateSteps(){let i=this.ref["steps-el"],{width:r}=i.getBoundingClientRect(),o=Math.ceil(r/2),a=Math.ceil(o/15)-2;if(this._stepsCount===a)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let h=0;h<a;h++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let h=0;h<a;h++)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this._zeroDotEl=p,i.innerHTML="",i.appendChild(l),this._stepsCount=a}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};n(ao,"SliderUi");var ci=ao;ci.template=`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var lo=class lo extends k{constructor(){super(...arguments);d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.CLOUD_IMG_EDIT);d(this,"_entry");d(this,"_instance")}get activityParams(){let e=super.activityParams;if("internalId"in e)return e;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>this.mountEditor(),"onActivate"),onDeactivate:n(()=>this.unmountEditor(),"onDeactivate")}),this.subConfigValue("cropPreset",e=>{this._instance&&this._instance.getAttribute("crop-preset")!==e&&this._instance.setAttribute("crop-preset",e)}),this.subConfigValue("cloudImageEditorTabs",e=>{this._instance&&this._instance.getAttribute("tabs")!==e&&this._instance.setAttribute("tabs",e)})}handleApply(e){if(!this._entry)return;let i=e.detail;this._entry.setMultipleValues({cdnUrl:i.cdnUrl,cdnUrlModifiers:i.cdnUrlModifiers}),this.modalManager.close(b.activities.CLOUD_IMG_EDIT),this.historyBack()}handleCancel(){this.modalManager.close(b.activities.CLOUD_IMG_EDIT),this.historyBack()}mountEditor(){let{internalId:e}=this.activityParams,i=this.uploadCollection.read(e);if(!i)throw new Error(`Entry with internalId "${e}" not found`);this._entry=i;let r=this._entry.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${e}" hasn't uploaded yet`);let o=new fe,a=this.cfg.cropPreset,l=this.cfg.cloudImageEditorTabs;o.setAttribute("ctx-name",this.ctxName),o.setAttribute("cdn-url",r),a&&o.setAttribute("crop-preset",a),l&&o.setAttribute("tabs",l),o.addEventListener("apply",c=>{let u=c;this.handleApply(u),this.debugPrint('editor event "apply"',u.detail)}),o.addEventListener("cancel",c=>{let u=c;this.handleCancel(),this.debugPrint('editor event "cancel"',u.detail)}),o.addEventListener("change",c=>{let u=c;this.debugPrint('editor event "change"',u.detail)}),this.innerHTML="",this.appendChild(o),this._instance=o}unmountEditor(){this._instance=void 0,this._entry=void 0,this.innerHTML=""}};n(lo,"CloudImageEditorActivity");var ds=lo;var Fu=n(function(s){return s.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},"escapeRegExp"),Sa=n(function(s,t="i"){let e=s.split("*").map(Fu);return new RegExp("^"+e.join(".+")+"$",t)},"wildcardRegexp");function Nu(s,t){return window.getComputedStyle(s).getPropertyValue(t).trim()}n(Nu,"getCssValue");var Vu=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"];function Ia(s){return Vu.reduce((t,e)=>{let i=Nu(s,e);return i&&(t[e]=i),t},{})}n(Ia,"buildThemeDefinition");var zu=["selected-files-change","toolbar-state-change"],Bu=n(s=>!s||typeof s!="object"?!1:"type"in s&&zu.includes(s.type),"isWhitelistedMessage"),co=class co{constructor(t){d(this,"_handlerMap",new Map);d(this,"_context");d(this,"_handleMessage",n(t=>{if(t.source!==this._context)return;let e=t.data;if(!Bu(e))return;let i=this._handlerMap.get(e.type);if(i)for(let r of i)r(e)},"_handleMessage"));this._context=t,window.addEventListener("message",this._handleMessage)}on(t,e){var r;let i=(r=this._handlerMap.get(t))!=null?r:new Set;this._handlerMap.has(t)||this._handlerMap.set(t,i),i.add(e)}send(t){this._context.postMessage(t,"*")}destroy(){window.removeEventListener("message",this._handleMessage)}};n(co,"MessageBridge");var hs=co;function Oa(s){let t=[];for(let[e,i]of Object.entries(s))i==null||typeof i=="string"&&i.length===0||t.push(`${e}=${encodeURIComponent(i)}`);return t.join("&")}n(Oa,"queryString");var ka=n(()=>{var t,e;let s=(e=(t=globalThis.top)!=null?t:globalThis.parent)!=null?e:globalThis.self;try{return s.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var Hu={[Ae.GDRIVE]:"ngdrive"},uo=class uo extends k{constructor(){super();d(this,"couldBeCtxOwner",!0);d(this,"activityType",b.activities.EXTERNAL);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],total:0,isSelectionReady:!1,isDoneBtnEnabled:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1,counterText:"",doneBtnTextClass:"uc-hidden",toolbarVisible:!0,onDone:n(()=>{for(let e of this.$.selectedList){let i=this.extractUrlFromSelectedFile(e),{filename:r}=e,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(i,{fileName:r,source:o})}this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.modalManager.open(b.activities.UPLOAD_LIST)},"onDone"),onCancel:n(()=>{this.historyBack()},"onCancel"),onSelectAll:n(()=>{var e;(e=this._messageBridge)==null||e.send({type:"select-all"})},"onSelectAll"),onDeselectAll:n(()=>{var e;(e=this._messageBridge)==null||e.send({type:"deselect-all"})},"onDeselectAll")}}get activityParams(){let e=super.activityParams;if("externalSourceType"in e)return e;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:n(()=>{let{externalSourceType:e}=this.activityParams;if(!e){this.modalManager.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${e==null?void 0:e[0].toUpperCase()}${e==null?void 0:e.slice(1)}`,activityIcon:e}),this.mountIframe()},"onActivate")}),this.sub("*currentActivityParams",e=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",e=>{e!==this.activityType&&this.unmountIframe()}),this.subConfigValue("multiple",e=>{this.$.showSelectionStatus=e}),this.subConfigValue("localeName",e=>{this.setupL10n()}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.applyEmbedCss(e)})}extractUrlFromSelectedFile(e){if(e.alternatives){let i=V(this.cfg.externalSourcesPreferredTypes);for(let r of i){let o=Sa(r);for(let[a,l]of Object.entries(e.alternatives))if(o.test(a))return l}}return e.url}handleToolbarStateChange(e){this.set$({toolbarVisible:e.isVisible})}async handleSelectedFilesChange(e){if(this.cfg.multiple!==e.isMultipleMode){console.error("Multiple mode mismatch");return}this.bindL10n("counterText",()=>this.l10n("selected-count",{count:e.selectedCount,total:e.total})),this.set$({doneBtnTextClass:e.isReady?"":"uc-hidden",isSelectionReady:e.isReady,isDoneBtnEnabled:e.isReady&&e.selectedFiles.length>0,showSelectionStatus:e.isMultipleMode&&e.total>0,couldSelectAll:e.selectedCount<e.total,couldDeselectAll:e.selectedCount===e.total,selectedList:e.selectedFiles})}handleIframeLoad(){this.applyEmbedCss(this.cfg.externalSourcesEmbedCss),this.applyTheme(),this.setupL10n()}applyTheme(){var e;(e=this._messageBridge)==null||e.send({type:"set-theme-definition",theme:Ia(this)})}applyEmbedCss(e){var i;(i=this._messageBridge)==null||i.send({type:"set-embed-css",css:e})}setupL10n(){var e;(e=this._messageBridge)==null||e.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName})}remoteUrl(){var h,f,m;let{pubkey:e,remoteTabSessionKey:i,socialBaseUrl:r,multiple:o}=this.cfg,{externalSourceType:a}=this.activityParams,l=(h=Hu[a])!=null?h:a,u={lang:((m=(f=this.l10n("social-source-lang"))==null?void 0:f.split("-"))==null?void 0:m[0])||"en",public_key:e,images_only:"false",session_key:i,wait_for_theme:!0,multiple:o.toString(),origin:this.cfg.topLevelOrigin||ka(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,r);return p.search=Oa(u),p.toString()}mountIframe(){var i;let e=As({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});e.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(e),e.contentWindow&&((i=this._messageBridge)==null||i.destroy(),this._messageBridge=new hs(e.contentWindow),this._messageBridge.on("selected-files-change",this.handleSelectedFilesChange.bind(this)),this._messageBridge.on("toolbar-state-change",this.handleToolbarStateChange.bind(this)),this.resetSelectionStatus())}unmountIframe(){var e;(e=this._messageBridge)==null||e.destroy(),this._messageBridge=void 0,this.ref.iframeWrapper.innerHTML="",this.resetSelectionStatus()}resetSelectionStatus(){this.set$({selectedList:[],total:0,isDoneBtnEnabled:!1,couldSelectAll:!1,couldDeselectAll:!1,showSelectionStatus:!1})}};n(uo,"ExternalSource");var ui=uo;ui.template=`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack" l10n="@title:a11y-activity-header-button-close;@aria-label:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar" set="@hidden: !toolbarVisible"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button><div set="@hidden: !showSelectionStatus" class="uc-selection-status-box"><span>{{counterText}}</span><button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button><button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button></div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isDoneBtnEnabled;"><uc-spinner set="@hidden: isSelectionReady"></uc-spinner><span l10n="done" set="@class: doneBtnTextClass"></span></button></div></div>`;var ho=class ho extends k{constructor(){super(...arguments);d(this,"requireCtxName",!0)}_createValidationInput(){let e=document.createElement("input");return e.type="text",e.name=this.ctxName,e.required=this.cfg.multipleMin>0,e.tabIndex=-1,Mt(e,{opacity:0,height:0,width:0}),e}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",e=>{var i;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",e.status==="uploading"||e.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(e.status==="failed"){let l=(i=e.errors[0])==null?void 0:i.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let r=e.group?e.group:null;if(r){this._validationInputElement.value=r.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=e.allEntries.map(l=>l.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let a=new DocumentFragment;for(let l of o){let c=document.createElement("input");c.type="hidden",c.name=`${this.ctxName}[]`,c.value=l,a.appendChild(c)}this._dynamicInputsContainer.replaceChildren(a)}},!1)}};n(ho,"FormInput");var ps=ho;var po=class po extends b{};n(po,"ActivityHeader");var fs=po;var fo=class fo extends y{constructor(){super(...arguments);d(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:n(e=>{var i;e.preventDefault(),e.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((i=this.$.options.find(r=>r.value==this.value))==null?void 0:i.text)||"",this.dispatchEvent(new Event("change"))},"onSelect")})}initCallback(){super.initCallback(),this.sub("options",e=>{var r;this.$.currentText=((r=e==null?void 0:e[0])==null?void 0:r.text)||"";let i="";e==null||e.forEach(o=>{i+=`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=i})}};n(fo,"Select");var di=fo;di.template='<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>';var gs=class gs extends y{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",t=>{this.toggleAttribute("hidden",!!t)})}};n(gs,"Copyright"),d(gs,"template",`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var ms=gs;var mo=class mo extends _e{};n(mo,"Spinner");var hi=mo;hi.template='<div class="uc-spinner"></div>';function ju(s){let t=new Blob([s],{type:"image/svg+xml"});return URL.createObjectURL(t)}n(ju,"createSvgBlobUrl");function bs(s="hsl(209, 21%, 65%)",t=32,e=32){return ju(`<svg width="${t}" height="${e}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${s}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}n(bs,"fileCssBg");function go(s,t=40){if(s.type==="image/svg+xml")return URL.createObjectURL(s);let e=document.createElement("canvas"),i=e.getContext("2d"),r=new Image,o=new Promise((a,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(e.width=t,e.height=t*c):(e.height=t,e.width=t/c),i.fillStyle="rgb(240, 240, 240)",i.fillRect(0,0,e.width,e.height),i.drawImage(r,0,0,e.width,e.height),e.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);a(p)})},r.onerror=c=>{l(c)}});return r.src=URL.createObjectURL(s),o}n(go,"generateThumb");var Gu=3e3,bo=class bo extends bt{constructor(){super();d(this,"_renderedGridOnce",!1);d(this,"_thumbRect",null);d(this,"_isIntersecting",!1);d(this,"_firstViewMode",this.cfg.filesViewMode);d(this,"_generateThumbnail",this._withEntry(async(e,i=!1)=>{let r=e.getValue("fileInfo"),o=e.getValue("isImage"),a=e.getValue("uuid"),l=e.getValue("thumbUrl"),c=this._calculateThumbSize(i);if(r&&o&&a){let p=await this.proxyUrl(F(Se(this.cfg.cdnCname,a),B(e.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:h}=je(p);h.then(()=>{e.setValue("thumbUrl",p),l!=null&&l.startsWith("blob:")&&URL.revokeObjectURL(l)}).catch(async()=>{if(!(l!=null&&l.startsWith("blob:")))try{let f=e.getValue("file");if(!f)return;let m=await go(f,c);e.setValue("thumbUrl",m)}catch{let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",bs(m))}});return}if(e.getValue("thumbUrl"))return;let u=e.getValue("file");if(u!=null&&u.type.includes("image"))try{let p=await go(u,c);e.setValue("thumbUrl",p)}catch{let h=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",bs(h))}else{let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");e.setValue("thumbUrl",bs(p))}}));d(this,"_debouncedGenerateThumb",M(this._generateThumbnail.bind(this),100));this.init$={...this.init$,thumbUrl:"",badgeIcon:"",uid:""}}_calculateThumbSize(e=!1){var r,o;e&&(this._thumbRect=this.getBoundingClientRect());let i=Math.max(parseInt(String(((r=this==null?void 0:this._thumbRect)==null?void 0:r.height)||0)),parseInt(String(((o=this==null?void 0:this._thumbRect)==null?void 0:o.width)||0)),this.cfg.thumbSize);return window.devicePixelRatio>1&&(i*=window.devicePixelRatio),Math.min(i,Gu)}_observerCallback(e){var r;let[i]=e;this._isIntersecting=i.isIntersecting,i.isIntersecting&&(this._thumbRect=i.boundingClientRect,this._debouncedGenerateThumb(),(r=this._observer)==null||r.disconnect()),i.intersectionRatio===0&&this._debouncedGenerateThumb.cancel()}_reset(){super._reset(),this._debouncedGenerateThumb.cancel()}_handleEntryId(e){var r;this._reset();let i=(r=this.uploadCollection)==null?void 0:r.read(e);this._entry=i,i&&(this._subEntry("fileInfo",o=>{o!=null&&o.isImage&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.defineAccessor("badgeIcon",e=>this.$.badgeIcon=e),this.defineAccessor("uid",e=>{this.set$({uid:e})}),this.sub("uid",e=>{this._handleEntryId(e)}),this.subConfigValue("filesViewMode",e=>{e==="grid"&&!this._renderedGridOnce&&(this._firstViewMode==="list"&&this._debouncedGenerateThumb(!0),this._renderedGridOnce=!0)}),this.setAttribute("role","img")}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:.1}),this._observer.observe(this)}disconnectedCallback(){var e;super.disconnectedCallback(),this._entrySubs=new Set,this._debouncedGenerateThumb.cancel(),(e=this._observer)==null||e.disconnect()}};n(bo,"Thumb");var At=bo;At.template=`<div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div>`;At.bindAttributes({badgeIcon:null,uid:null});var Et=class Et extends ce{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",t=>{this.set$({isHidden:O(t)})})}};n(Et,"FileUploaderRegular"),d(Et,"styleAttrs",[...q(Et,Et,"styleAttrs"),"uc-file-uploader-regular"]);var Tt=Et;Tt.template=`<uc-simple-btn set="@hidden: isHidden"></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;Tt.bindAttributes({headless:null});var _o="active",_s="",St=class St extends ce{constructor(){super(),this.init$={...this.init$,singleUpload:!1,isHiddenStartFrom:!1,classUploadList:_s,classStartFrom:_s}}_handleModalOpen(t){var e;t.id===b.activities.CLOUD_IMG_EDIT&&this.set$({classUploadList:_o}),this.$["*currentActivity"]===b.activities.UPLOAD_LIST&&this.set$({classUploadList:_o,isHiddenStartFrom:!0}),((e=this.$["*uploadList"])==null?void 0:e.length)<=0&&this.set$({classStartFrom:_o})}_handleModalClose(t){t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.set$({isHiddenStartFrom:!1})),t.id===b.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)}initCallback(){super.initCallback();let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e===b.activities.UPLOAD_LIST&&this.modalManager.closeAll(),e||(this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0?(this.$["*currentActivity"]=b.activities.UPLOAD_LIST,this.set$({classStartFrom:_s})):(this.set$({classUploadList:_s,isHiddenStartFrom:!1}),this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM)}),this.subConfigValue("confirmUpload",e=>{e!==!1&&(this.cfg.confirmUpload=!1)}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",i=>{e==="grid"?(i?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.$.singleUpload=!i):(this.style.removeProperty("--uc-grid-col"),this.$.singleUpload=!1)})}),this.handleModalOpen=this._handleModalOpen.bind(this),this.handleModalClose=this._handleModalClose.bind(this),this.modalManager.subscribe(D.OPEN,this.handleModalOpen),this.modalManager.subscribe(D.CLOSE,this.handleModalClose)}destroyCallback(){super.destroyCallback(),this.modalManager.unsubscribe(D.OPEN,this.handleModalOpen),this.modalManager.unsubscribe(D.CLOSE,this.handleModalClose)}};n(St,"FileUploaderMinimal"),d(St,"styleAttrs",[...q(St,St,"styleAttrs"),"uc-file-uploader-minimal"]);var pi=St;pi.template=`<uc-start-from set="@hidden: isHiddenStartFrom; @class:classStartFrom"><uc-drop-area set="@single:singleUpload;" initflow clickable tabindex="0" l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list set="@class:classUploadList" ref="uBlock"></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;var It=class It extends ce{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:n(()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)},"cancel")}}get couldHistoryBack(){let t=this.$["*history"];return t.length>1&&t[t.length-1]!==b.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let t=this.ref.uBlock;this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t.initActivity||b.activities.START_FROM)}),this.sub("*uploadList",e=>{(e==null?void 0:e.length)>0&&this.$["*currentActivity"]===(t.initActivity||b.activities.START_FROM)&&(this.$["*currentActivity"]=b.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};n(It,"FileUploaderInline"),d(It,"styleAttrs",[...q(It,It,"styleAttrs"),"uc-file-uploader-inline"]);var fi=It;fi.template=`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" set="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var Ot=class Ot extends fe{initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}};n(Ot,"CloudImageEditor"),d(Ot,"styleAttrs",[...q(Ot,Ot,"styleAttrs"),"uc-wgt-common"]);var vs=Ot;function ys(s){for(let t in s){let e=[...t].reduce((i,r)=>(r.toUpperCase()===r&&(r="-"+r.toLowerCase()),i+=r),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),s[t].reg&&s[t].reg(e)}}n(ys,"defineComponents");var vo="UC";async function $a(s,t=!1){return new Promise((e,i)=>{if(typeof document!="object"){e(null);return}if(typeof window=="object"&&window[vo]){e(window[vo]);return}let r=document.createElement("script");r.async=!0,r.src=s,r.onerror=()=>{i()},r.onload=()=>{let o=window[vo];t&&ys(o),e(o)},document.head.appendChild(r)})}n($a,"loadFileUploaderFrom");return za(Wu);})();