@uploadcare/file-uploader 1.29.0-alpha.2 → 1.29.0-alpha.3

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 (66) hide show
  1. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  2. package/dist/env.js +3 -3
  3. package/dist/index.css +3 -3
  4. package/dist/index.d.ts +8 -10
  5. package/dist/index.js +3 -3
  6. package/dist/index.layered.css +3 -3
  7. package/dist/index.ssr.js +1 -1
  8. package/dist/locales/file-uploader/ar.js +2 -2
  9. package/dist/locales/file-uploader/az.js +2 -2
  10. package/dist/locales/file-uploader/ca.js +2 -2
  11. package/dist/locales/file-uploader/cs.js +2 -2
  12. package/dist/locales/file-uploader/da.js +2 -2
  13. package/dist/locales/file-uploader/de.js +2 -2
  14. package/dist/locales/file-uploader/el.js +2 -2
  15. package/dist/locales/file-uploader/en.js +2 -2
  16. package/dist/locales/file-uploader/es.js +2 -2
  17. package/dist/locales/file-uploader/et.js +2 -2
  18. package/dist/locales/file-uploader/fi.js +2 -2
  19. package/dist/locales/file-uploader/fr.js +2 -2
  20. package/dist/locales/file-uploader/he.js +2 -2
  21. package/dist/locales/file-uploader/hy.js +2 -2
  22. package/dist/locales/file-uploader/is.js +2 -2
  23. package/dist/locales/file-uploader/it.js +2 -2
  24. package/dist/locales/file-uploader/ja.js +2 -2
  25. package/dist/locales/file-uploader/ka.js +2 -2
  26. package/dist/locales/file-uploader/kk.js +2 -2
  27. package/dist/locales/file-uploader/ko.js +2 -2
  28. package/dist/locales/file-uploader/lv.js +2 -2
  29. package/dist/locales/file-uploader/nb.js +2 -2
  30. package/dist/locales/file-uploader/nl.js +2 -2
  31. package/dist/locales/file-uploader/pl.js +2 -2
  32. package/dist/locales/file-uploader/pt.js +2 -2
  33. package/dist/locales/file-uploader/ro.js +2 -2
  34. package/dist/locales/file-uploader/ru.js +2 -2
  35. package/dist/locales/file-uploader/sk.js +2 -2
  36. package/dist/locales/file-uploader/sr.js +2 -2
  37. package/dist/locales/file-uploader/sv.js +2 -2
  38. package/dist/locales/file-uploader/tr.js +2 -2
  39. package/dist/locales/file-uploader/uk.js +2 -2
  40. package/dist/locales/file-uploader/vi.js +2 -2
  41. package/dist/locales/file-uploader/zh-TW.js +2 -2
  42. package/dist/locales/file-uploader/zh.js +2 -2
  43. package/package.json +1 -1
  44. package/web/file-uploader.iife.min.d.ts +8 -10
  45. package/web/file-uploader.iife.min.js +3 -3
  46. package/web/file-uploader.min.d.ts +8 -10
  47. package/web/file-uploader.min.js +3 -3
  48. package/web/uc-basic.layered.min.css +3 -3
  49. package/web/uc-basic.min.css +3 -3
  50. package/web/uc-cloud-image-editor.layered.min.css +2 -2
  51. package/web/uc-cloud-image-editor.min.css +2 -2
  52. package/web/uc-cloud-image-editor.min.d.ts +7 -9
  53. package/web/uc-cloud-image-editor.min.js +3 -3
  54. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  55. package/web/uc-file-uploader-inline.min.css +3 -3
  56. package/web/uc-file-uploader-inline.min.d.ts +8 -10
  57. package/web/uc-file-uploader-inline.min.js +3 -3
  58. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  59. package/web/uc-file-uploader-minimal.min.css +3 -3
  60. package/web/uc-file-uploader-minimal.min.d.ts +8 -10
  61. package/web/uc-file-uploader-minimal.min.js +3 -3
  62. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  63. package/web/uc-file-uploader-regular.min.css +3 -3
  64. package/web/uc-file-uploader-regular.min.d.ts +8 -10
  65. package/web/uc-file-uploader-regular.min.js +3 -3
  66. package/web/uc-img.min.js +3 -3
@@ -1,8 +1,8 @@
1
1
  var UC=(function(exports){'use strict';/**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.29.0-alpha.2 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.29.0-alpha.3 (MIT)
4
4
  * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-04-07T10:27:38.643Z
5
+ * Built: 2026-04-21T07:15:50.147Z
6
6
  */
7
- var ho=Object.defineProperty;var Ul=Object.getOwnPropertyDescriptor;var a=(o,i)=>ho(o,"name",{value:i,configurable:true});var Vs=(o,i)=>{for(var t in i)ho(o,t,{get:i[t],enumerable:true});};var h=(o,i,t,e)=>{for(var r=e>1?void 0:e?Ul(i,t):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&ho(i,t,r),r};var kt=[],Qt=0,zi=4,Ns=a(o=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Qt+zi;s<kt.length;)kt[s]===e?kt.splice(s,zi):s+=zi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!kt.length;for(let n of i)kt.push(n,t.value,e,r);if(s){for(Qt=0;Qt<kt.length;Qt+=zi)kt[Qt](kt[Qt+1],kt[Qt+2],kt[Qt+3]);kt.length=0;}},off(){},set(e){let r=t.value;r!==e&&(t.value=e,t.notify(r));},subscribe(e){let r=t.listen(e);return e(t.value),r},value:o};return t},"atom");function Bi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}a(Bi,"listenKeys");function fo(o,i,t){let e=Bi(o,i,t);return t(o.value),e}a(fo,"subscribeKeys");var mo=a((o={})=>{let i=Ns(o);return i.setKey=function(t,e){let r=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(r,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(r,t));},i},"map");var K=class o{static{a(this,"PubSub");}static{this.Gt=new Map;}constructor(i,t){this.J=i,this.ae=t;}get id(){return this.J}pub(i,t){i in this.ae.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.ae.setKey(i,t);}sub(i,t,e=true){return (e?fo:Bi)(this.ae,[i],s=>{t(s[i]);})}read(i){return i in this.ae.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.ae.get()[i]}add(i,t,e=false){(!(i in this.ae.get())||e)&&this.ae.setKey(i,t);}has(i){return i in this.ae.get()}get store(){return this.ae.get()}static registerCtx(i,t){if(o.Gt.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=mo(i);return o.Gt.set(t,e),new o(t,e)}static deleteCtx(i){o.Gt.delete(i);}static getCtx(i){let t=o.Gt.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Gt.has(i)}};var Hi=globalThis,ji=Hi.ShadowRoot&&(Hi.ShadyCSS===void 0||Hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,zs=Symbol(),_s=new WeakMap,Ki=class{static{a(this,"n");}constructor(i,t,e){if(this.Sc=true,e!==zs)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t;}get styleSheet(){let i=this.o,t=this.t;if(ji&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=_s.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&_s.set(t,i));}return i}toString(){return this.cssText}},Bs=a(o=>new Ki(typeof o=="string"?o:o+"",void 0,zs),"r");var Hs=a((o,i)=>{if(ji)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Hi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},"S"),go=ji?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Bs(t)})(o):o;var{is:$l,defineProperty:Dl,getOwnPropertyDescriptor:Fl,getOwnPropertyNames:Vl,getOwnPropertySymbols:Nl,getPrototypeOf:_l}=Object,Gi=globalThis,Ks=Gi.trustedTypes,zl=Ks?Ks.emptyScript:"",Bl=Gi.reactiveElementPolyfillSupport,si=a((o,i)=>o,"d"),ni={toAttribute(o,i){switch(i){case Boolean:o=o?zl:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o);}return o},fromAttribute(o,i){let t=o;switch(i){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o);}catch{t=null;}}return t}},qi=a((o,i)=>!$l(o,i),"f"),js={attribute:true,type:String,converter:ni,reflect:false,useDefault:false,hasChanged:qi};Symbol.metadata??=Symbol("metadata"),Gi.litPropertyMetadata??=new WeakMap;var Bt=class extends HTMLElement{static{a(this,"y");}static addInitializer(i){this._r(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Pi&&[...this.Pi.keys()]}static createProperty(i,t=js){if(t.state&&(t.attribute=false),this._r(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(i,e,t);r!==void 0&&Dl(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Fl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let l=r?.call(this);s?.call(this,n),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??js}static _r(){if(this.hasOwnProperty(si("elementProperties")))return;let i=_l(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(si("finalized")))return;if(this.finalized=true,this._r(),this.hasOwnProperty(si("properties"))){let t=this.properties,e=[...Vl(t),...Nl(t)];for(let r of e)this.createProperty(r,t[r]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,r]of t)this.elementProperties.set(e,r);}this.Pi=new Map;for(let[t,e]of this.elementProperties){let r=this.Br(t,e);r!==void 0&&this.Pi.set(r,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let r of e)t.unshift(go(r));}else i!==void 0&&t.push(go(i));return t}static Br(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.Li=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.yt=null,this.Ac();}Ac(){this.zr=new Promise(i=>this.enableUpdating=i),this.Ne=new Map,this.kc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.qt??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.qt?.delete(i);}kc(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Li=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Hs(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.qt?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.qt?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Hr(i,e);}Mc(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.Br(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:ni).toAttribute(t,e.type);this.yt=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.yt=null;}}Hr(i,t){let e=this.constructor,r=e.Pi.get(i);if(r!==void 0&&this.yt!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ni;this.yt=r;let l=n.fromAttribute(t,s.type);this[r]=l??this.Kr?.get(r)??l,this.yt=null;}}requestUpdate(i,t,e,r=false,s){if(i!==void 0){let n=this.constructor;if(r===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??qi)(s,t)||e.useDefault&&e.reflect&&s===this.Kr?.get(i)&&!this.hasAttribute(n.Br(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.zr=this.Ic());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.Kr??=new Map).has(i)&&(this.Kr.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.Ne.has(i)||(this.hasUpdated||e||(t=void 0),this.Ne.set(i,t)),r===true&&this.yt!==i&&(this.js??=new Set).add(i));}async Ic(){this.isUpdatePending=true;try{await this.zr;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.Li){for(let[r,s]of this.Li)this[r]=s;this.Li=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,l=this[r];n!==true||this.Ne.has(r)||l===void 0||this.C(r,void 0,s,l);}}let i=false,t=this.Ne;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.qt?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.jr();}catch(e){throw i=false,this.jr(),e}i&&this.Oc(t);}willUpdate(i){}Oc(i){this.qt?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}jr(){this.Ne=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.zr}shouldUpdate(i){return true}update(i){this.js&&=this.js.forEach(t=>this.Mc(t,this[t])),this.jr();}updated(i){}firstUpdated(i){}};Bt.elementStyles=[],Bt.shadowRootOptions={mode:"open"},Bt[si("elementProperties")]=new Map,Bt[si("finalized")]=new Map,Bl?.({ReactiveElement:Bt}),(Gi.reactiveElementVersions??=[]).push("2.1.2");var yo=globalThis,Gs=a(o=>o,"i"),Wi=yo.trustedTypes,qs=Wi?Wi.createPolicy("lit-html",{createHTML:a(o=>o,"createHTML")}):void 0,bo="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,wo="?"+Ht,Hl=`<${wo}>`,me=document,li=a(()=>me.createComment(""),"c"),ci=a(o=>o===null||typeof o!="object"&&typeof o!="function","a"),To=Array.isArray,Js=a(o=>To(o)||typeof o?.[Symbol.iterator]=="function","d"),vo=`[ \f\r]`,ai=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ws=/-->/g,Zs=/>/g,he=RegExp(`>|${vo}(?:([^\\s"'>=/]+)(${vo}*=${vo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ys=/'/g,Xs=/"/g,tn=/^(?:script|style|textarea|title)$/i,Eo=a(o=>(i,...t)=>({Ve:o,strings:i,values:t}),"x"),y=Eo(1);Eo(2);Eo(3);var rt=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),Qs=new WeakMap,fe=me.createTreeWalker(me,129);function en(o,i){if(!To(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return qs!==void 0?qs.createHTML(i):i}a(en,"V");var rn=a((o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=ai;for(let l=0;l<t;l++){let c=o[l],u,p,d=-1,f=0;for(;f<c.length&&(n.lastIndex=f,p=n.exec(c),p!==null);)f=n.lastIndex,n===ai?p[1]==="!--"?n=Ws:p[1]!==void 0?n=Zs:p[2]!==void 0?(tn.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=he):p[3]!==void 0&&(n=he):n===he?p[0]===">"?(n=r??ai,d=-1):p[1]===void 0?d=-2:(d=n.lastIndex-p[2].length,u=p[1],n=p[3]===void 0?he:p[3]==='"'?Xs:Ys):n===Xs||n===Ys?n=he:n===Ws||n===Zs?n=ai:(n=he,r=void 0);let m=n===he&&o[l+1].startsWith("/>")?" ":"";s+=n===ai?c+Hl:d>=0?(e.push(u),c.slice(0,d)+bo+c.slice(d)+Ht+m):c+Ht+(d===-2?l:m);}return [en(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),ui=class o{static{a(this,"S");}constructor({strings:i,Ve:t},e){let r;this.parts=[];let s=0,n=0,l=i.length-1,c=this.parts,[u,p]=rn(i,t);if(this.el=o.createElement(u,e),fe.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(r=fe.nextNode())!==null&&c.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(bo)){let f=p[n++],m=r.getAttribute(d).split(Ht),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:v[2],strings:m,ctor:v[1]==="."?Yi:v[1]==="?"?Xi:v[1]==="@"?Qi:ve}),r.removeAttribute(d);}else d.startsWith(Ht)&&(c.push({type:6,index:s}),r.removeAttribute(d));if(tn.test(r.tagName)){let d=r.textContent.split(Ht),f=d.length-1;if(f>0){r.textContent=Wi?Wi.emptyScript:"";for(let m=0;m<f;m++)r.append(d[m],li()),fe.nextNode(),c.push({type:2,index:++s});r.append(d[f],li());}}}else if(r.nodeType===8)if(r.data===wo)c.push({type:2,index:s});else {let d=-1;for(;(d=r.data.indexOf(Ht,d+1))!==-1;)c.push({type:7,index:s}),d+=Ht.length-1;}s++;}}static createElement(i,t){let e=me.createElement("template");return e.innerHTML=i,e}};function ge(o,i,t=o,e){if(i===rt)return i;let r=e!==void 0?t.Pc?.[e]:t.Lc,s=ci(i)?void 0:i.Gr;return r?.constructor!==s&&(r?.Gs?.(false),s===void 0?r=void 0:(r=new s(o),r.qr(o,t,e)),e!==void 0?(t.Pc??=[])[e]=r:t.Lc=r),r!==void 0&&(i=ge(o,r.Rc(o,i.values),r,e)),i}a(ge,"M");var Zi=class{static{a(this,"R");}constructor(i,t){this.qs=[],this.le=void 0,this.Ws=i,this.f=t;}get parentNode(){return this.f.parentNode}get W(){return this.f.W}u(i){let{el:{content:t},parts:e}=this.Ws,r=(i?.creationScope??me).importNode(t,true);fe.currentNode=r;let s=fe.nextNode(),n=0,l=0,c=e[0];for(;c!==void 0;){if(n===c.index){let u;c.type===2?u=new Me(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new Ji(s,this,i)),this.qs.push(u),c=e[++l];}n!==c?.index&&(s=fe.nextNode(),n++);}return fe.currentNode=me,r}p(i){let t=0;for(let e of this.qs)e!==void 0&&(e.strings!==void 0?(e.ce(i,e,t),t+=e.strings.length-2):e.ce(i[t])),t++;}},Me=class o{static{a(this,"k");}get W(){return this.f?.W??this.Zs}constructor(i,t,e,r){this.type=2,this.r=R,this.le=void 0,this.ve=i,this.bt=t,this.f=e,this.options=r,this.Zs=r?.isConnected??true;}get parentNode(){let i=this.ve.parentNode,t=this.f;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.ve}get endNode(){return this.bt}ce(i,t=this){i=ge(this,i,t),ci(i)?i===R||i==null||i===""?(this.r!==R&&this.wt(),this.r=R):i!==this.r&&i!==rt&&this.Ys(i):i.Ve!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Js(i)?this.k(i):this.Ys(i);}O(i){return this.ve.parentNode.insertBefore(i,this.bt)}T(i){this.r!==i&&(this.wt(),this.r=this.O(i));}Ys(i){this.r!==R&&ci(this.r)?this.ve.nextSibling.data=i:this.T(me.createTextNode(i)),this.r=i;}$(i){let{values:t,Ve:e}=i,r=typeof e=="number"?this.Uc(i):(e.el===void 0&&(e.el=ui.createElement(en(e.h,e.h[0]),this.options)),e);if(this.r?.Ws===r)this.r.p(t);else {let s=new Zi(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Uc(i){let t=Qs.get(i.strings);return t===void 0&&Qs.set(i.strings,t=new ui(i)),t}k(i){To(this.r)||(this.r=[],this.wt());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(li()),this.O(li()),this,this.options)):e=t[r],e.ce(s),r++;r<t.length&&(this.wt(e&&e.bt.nextSibling,r),t.length=r);}wt(i=this.ve.nextSibling,t){for(this.Ri?.(false,true,t);i!==this.bt;){let e=Gs(i).nextSibling;Gs(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.Zs=i,this.Ri?.(i));}},ve=class{static{a(this,"H");}get tagName(){return this.element.tagName}get W(){return this.f.W}constructor(i,t,e,r,s){this.type=1,this.r=R,this.le=void 0,this.element=i,this.name=t,this.f=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=R;}ce(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=ge(this,i,t,0),n=!ci(i)||i!==this.r&&i!==rt,n&&(this.r=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=ge(this,l[e+c],t,c),u===rt&&(u=this.r[c]),n||=!ci(u)||u!==this.r[c],u===R?i=R:i!==R&&(i+=(u??"")+s[c+1]),this.r[c]=u;}n&&!r&&this.j(i);}j(i){i===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Yi=class extends ve{static{a(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===R?void 0:i;}},Xi=class extends ve{static{a(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==R);}},Qi=class extends ve{static{a(this,"z");}constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}ce(i,t=this){if((i=ge(this,i,t,0)??R)===rt)return;let e=this.r,r=i===R&&e!==R||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==R&&(e===R||r);r&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},Ji=class{static{a(this,"Z");}constructor(i,t,e){this.element=i,this.type=6,this.le=void 0,this.f=t,this.options=e;}get W(){return this.f.W}ce(i){ge(this,i);}},on={I:Me},Kl=yo.litHtmlPolyfillSupport;Kl?.(ui,Me),(yo.litHtmlVersions??=[]).push("3.3.2");var sn=a((o,i,t)=>{let e=t?.renderBefore??i,r=e.$c;if(r===void 0){let s=t?.renderBefore??null;e.$c=r=new Me(i.insertBefore(li(),s),s,void 0,t??{});}return r.ce(o),r},"D");var Co=globalThis,Et=class extends Bt{static{a(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.Wr=void 0;}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this.Wr=sn(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.Wr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.Wr?.setConnected(false);}render(){return rt}};Et.qp=true,Et.finalized=true,Co.litElementHydrateSupport?.({LitElement:Et});var jl=Co.litElementPolyfillSupport;jl?.({LitElement:Et});(Co.litElementVersions??=[]).push("4.2.2");var Gl=/\\([0-9a-fA-F]{1,6} ?)/g;function ql(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}a(ql,"hasLeadingTrailingQuotes");function Wl(o){let i=o;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}a(Wl,"trimQuotes");function Zl(o){let i="",t="";for(let e=0;e<o.length;e++){let r=o[e+1];o[e]==="\\"&&r==='"'?(i+='\\"',e++):o[e]==='"'&&t!=="\\"?i+='\\"':i+=o[e],t=o[e]??"";}return i}a(Zl,"escapeQuotes");function nn(o){let i=o;ql(o)&&(i=Wl(i),i=i.replace(Gl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Zl(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}a(nn,"parseCssPropertyValue");function Ie(o){class i extends o{constructor(){super(...arguments);this.Xs=null;this.Zr=null;}static{a(this,"CssDataMixinClass");}getCssData(r,s=false){let n=this.Xs??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.Zr||(this.Zr=window.getComputedStyle(this));let l=this.Zr.getPropertyValue(r).trim();try{n[r]=nn(l);}catch(c){s||console.warn(`CSS Data error: ${r}`,c),n[r]=null;}}return this.Xs=n,n[r]}}return i}a(Ie,"CssDataMixin");function tr(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this._e={};this.Be=null;this.Ui=false;}static{a(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.Be||(this.Be=Array.from(this.childNodes)),super.connectedCallback();}Dc(){if(this.Ui)return;this.Ui=true,this._e={};let r=Array.from(this.childNodes),s=r.length?r:this.Be??[];for(let n of s){let l=this.Qs(n),c=this._e[l]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),c.push(n),this._e[l]=c;}this.Be=null;}Qs(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.Qs(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Fc(r){return !r.textContent||!r.textContent.trim()}Nc(r){let s=this._e[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Fc(n))}update(r){!this.hasUpdated&&this.willYield&&this.Dc(),super.update(r);}yield(r,s){if(r===""&&!this._e[r]&&!this.Ui&&this.Be?.length){let l=[];for(let c of this.Be)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this._e[r]=l,this.Ui=true,this.Be=null;}let n=this._e[r];return y` ${n} ${this.Nc(r)?s:void 0} `}}return i}a(tr,"LightDomMixin");function Oe(o){class i extends o{static{a(this,"RegisterableElementMixinClass");}static reg(e){let r=this,s=window.customElements.get(e);if(s){s!==r&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,r);}}return i}a(Oe,"RegisterableElementMixin");var Jt=class extends Event{static{a(this,"s");}constructor(i,t,e,r){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=r??false;}};var Pe=class{static{a(this,"s");}constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Jt(this.context,this.host,this.t,this.subscribe));}};var er=class{static{a(this,"s");}get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:a(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var xo=class extends Event{static{a(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Le=class extends er{static{a(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=r=>{if(r.context!==this.context)return;let s=r.contextTarget??r.composedPath()[0];s!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,s,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:l}]of this.subscriptions)s.has(n)||(s.add(n),l.dispatchEvent(new Jt(this.context,l,n,true)));r.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new xo(this.context,this.host));}};var Xl={attribute:true,type:String,converter:ni,reflect:false,hasChanged:qi},Ql=a((o=Xl,i,t)=>{let{kind:e,metadata:r}=t,s=globalThis.litPropertyMetadata.get(r);if(s===void 0&&globalThis.litPropertyMetadata.set(r,s=new Map),e==="setter"&&((o=Object.create(o)).wrapped=true),s.set(t.name,o),e==="accessor"){let{name:n}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(n,c,o,true,l);},init(l){return l!==void 0&&this.C(n,void 0,o,l),l}}}if(e==="setter"){let{name:n}=t;return function(l){let c=this[n];i.call(this,l),this.requestUpdate(n,c,o,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(o){return (i,t)=>typeof t=="object"?Ql(o,i,t):((e,r,s)=>{let n=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}a(b,"n");function g(o){return b({...o,state:true,attribute:false})}a(g,"r");function D(o,i){let t,e=a(((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}a(D,"debounce");var an="ctx-name-context";function rr(){return function(o){class i extends o{constructor(...r){super(...r);this.ee=null;this.Wt=false;this.Yr=false;this.Xr=void 0;this.Tt=new Map;this.Zt=new Set;this.init$={};this.ctxOwner=false;this.$i=void 0;this.Di=false;this.ctxName=this.Ae;this.ke=false;this.$i=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Ae,this.Vc=new Pe(this,{context:an,callback:a(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.tn=s,this.en();},"callback"),subscribe:true});}static{a(this,"SymbioteMixinClass");}static set template(r){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get Js(){return this.$i}set Js(r){let s=r??void 0;this.$i!==s&&(this.$i=s,this.en());}shouldUpdate(r){return this.ke?super.shouldUpdate(r):false}get Ae(){return this.Js||this.tn||void 0}en(){if(this.ctxName=this.Ae,!(!this.ctxName||this.Wt)){if(this.isConnected){this.Qr();return}this.Di=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Ae,this.ctxName&&(this.Xr?this.Xr.setValue(this.ctxName):this.Xr=new Le(this,{context:an,initialValue:this.ctxName}));}rn(){if(!(!this.ee||this.Tt.size===0)){for(let[r,{value:s,rewrite:n}]of this.Tt)this.ee.add(r,s,n);this.Tt.clear();}}sn(){return !this.ee&&this.Ae&&this.Jr(),this.ee&&this.rn(),this.ee}Fi(){let r=this.sn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}Jr(){let r=this.init$,s=this.Ae;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.ee){this.ee=K.getCtx(s)??K.registerCtx(r,s);for(let[n,l]of Object.entries(this.init$))this.ee.add(n,l,this.ctxOwner);this.rn();}}get $(){return this.Ae&&this.Jr(),new Proxy({},{get:a((r,s)=>{if(typeof s=="string")return this.ee?.read(s)},"get"),set:a((r,s,n)=>(typeof s!="string"||this.ee?.pub(s,n),true),"set")})}sub(r,s,n=true){let l=this.Fi().sub(r,s,n);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=a(()=>{u||(u=true,c(),this.Zt.delete(p));},"trackedRemove");return this.Zt.add(p),p}pub(r,s){this.Fi().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.Fi()}has(r){return this.ee?.has(r)??false}add(r,s,n=false){let l=this.sn();if(!l){if(!n&&this.Tt.has(r))return;this.Tt.set(r,{value:s,rewrite:n});return}this.Tt.delete(r),l.add(r,s,n);}add$(r,s=false){for(let[n,l]of Object.entries(r))this.add(n,l,s);}connectedCallback(){super.connectedCallback(),this.Wt?this.ke&&this.Yr&&(this.Yr=false,this.initCallback()):this.ctxName?(this.Di=false,this.Qr()):this.Di&&this.Ae&&(this.Di=false,this.Qr());}Qr(){if(this.Wt)return;this.Wt=true,this.Jr();let r=this.init$;if(Object.keys(r).length>0){let s=this.Fi();for(let[n,l]of Object.entries(r))s.read(n)===void 0&&s.pub(n,l),this.sub(n,D(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.ke=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this._c(),super.disconnectedCallback(),this.Wt&&(this.Yr=true);}_c(){if(this.Zt.size!==0){for(let r of [...this.Zt])r();this.Zt.clear();}}initCallback(){}}return h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Js",1),h([g()],i.prototype,"tn",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"ke",2),i}}a(rr,"SymbioteMixin");var So=class extends Oe(rr()(Ie(tr(Et)))){static{a(this,"BaseComponent");}};var mt=class o{static{a(this,"UID");}static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():o.generateFastUid()}};var Jl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function gt(o){for(let i in o){if(Jl.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r=`-${r.toLowerCase()}`),e+=r,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[i].reg&&o[i].reg(t);}}a(gt,"defineComponents");var Ao="UC";function tc(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Ao]){t(window[Ao]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[Ao];i&&gt(s),t(s);},document.head.appendChild(r);})}a(tc,"loadFileUploaderFrom");var di={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var ko=new Map,ln=new Map,cn=a((o,i)=>{ko.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...di,...i};return ko.set(o,t),t},"defineLocaleSync"),ec=a((o,i)=>{ln.set(o,i);},"defineLocaleAsync"),un=a((o,i)=>{typeof i=="function"?ec(o,i):cn(o,i);},"defineLocale"),dn=a(async o=>{let i=ko.get(o);if(!i){let t=ln.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=cn(o,e);}return i},"resolveLocaleDefinition");un("en",di);var M=a(o=>`*cfg/${o}`,"sharedConfigKey");var j=a(o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),Kt=a(o=>o.join(","),"serializeCsv");var pn=a(o=>{if(typeof o!="string"||!o)return "";let i=o.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),or=a((...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>pn(i)).join("/-/"),"joinCdnOperations"),ot=a((...o)=>{let i=or(...o);return i?`-/${i}/`:""},"createCdnUrlModifiers");function sr(o){let i=new URL(o),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):r>=0&&(s=t.slice(r+1)),s}a(sr,"extractFilename");function nr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}a(nr,"extractUuid");function Mo(o){let i=hn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}a(Mo,"extractCdnUrlModifiers");function Io(o){return Mo(o).split("/-/").filter(Boolean).map(t=>pn(t))}a(Io,"extractOperations");function hn(o){let i=new URL(o),t=sr(o),e=fn(t)?mn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}a(hn,"trimFilename");function fn(o){return o.startsWith("http")}a(fn,"isFileUrl");function mn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}a(mn,"splitFileUrl");var Z=a((o,i,t)=>{let e=new URL(hn(o)),r=t??sr(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&fn(r)){let n=mn(r);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},"createCdnUrl"),te=a((o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var Y=a((o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var pi=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),vn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function ic(o,i){if(typeof i=="number"){let t=i;return pi[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return pi[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return pi.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}a(ic,"transformationToStr");function ee(o){return or(...vn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return ic(i,t)}).filter(i=>!!i))}a(ee,"transformationsToOperations");var ar=or("format/auto","progressive/yes"),jt=a(([o])=>typeof o<"u"?Number(o):void 0,"asNumber"),gn=a(()=>true,"asBoolean"),rc=a(([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),"asFilter"),oc=a(([o,i])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Y(o,"x").map(Number),coords:Y(i).map(Number)}},"asCrop"),sc=Object.freeze({enhance:jt,brightness:jt,exposure:jt,gamma:jt,contrast:jt,saturation:jt,vibrance:jt,warmth:jt,filter:rc,mirror:gn,flip:gn,rotate:jt,crop:a(o=>{let[i,t]=o,{dimensions:e,coords:r}=oc([i,t]);return {dimensions:e,coords:r}},"crop")});function Oo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!vn.includes(e))continue;let s=e,n=sc[s];try{let l=n(r);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}a(Oo,"operationsToTransformations");var H=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),st=Object.freeze([H.CROP,H.TUNING,H.FILTERS]),yn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),bn=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),wn=Object.freeze(["rotate","mirror","flip"]),Gt=pi,Mt=Object.freeze({brightness:{zero:Gt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Gt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Gt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Gt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Gt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Gt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Gt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Gt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Gt.filter,range:[0,100],keypointsNumber:1}});var hi="https://ucarecdn.com",nc="https://upload.uploadcare.com",ac="https://social.uploadcare.com",lc="https://ucarecd.net",cc={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:hi,cdnCnamePrefixed:lc,baseUrl:nc,socialBaseUrl:ac,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:Kt(st),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[]},tt=Object.freeze(cc);var lr=a((o,i)=>(...t)=>{let e=o();if(!e.read(M("debug")))return;let r=t;if(typeof t?.[0]=="function"){let n=t[0];r=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...r);},"createDebugPrinter");var G=class{constructor(i){this.eo=new Set;this.ze=null;this.w=lr(()=>this.i.ctx,this.constructor.name);this.i=i,this.e=i.ctx;}static{a(this,"SharedInstance");}addSub(i){this.eo.add(i);}get He(){if(!this.ze){let i={};this.ze=new Proxy(i,{set:a(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:a((t,e)=>{if(typeof e!="string")return;let r=M(e);return this.i.ctx.has(r)?this.i.ctx.read(r):tt[e]},"get")});}return this.ze}destroy(){for(let i of this.eo)try{i();}catch{}this.eo.clear();}},uc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},It=a((o,i,t=true)=>{let e=o.has(i),r=e?o.read(i):null;if(e&&r||!t)return r;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},"getSharedInstance"),Tn=a(o=>({get ctx(){return o()},get modalManager(){return It(o(),"*modalManager",false)},get pluginManager(){return It(o(),"*pluginManager")},get telemetryManager(){return It(o(),"*telemetryManager")},get localeManager(){return It(o(),"*localeManager")},get a11y(){return It(o(),"*a11y")},get blocksRegistry(){return It(o(),"*blocksRegistry")},get eventEmitter(){return It(o(),"*eventEmitter")},get uploadCollection(){return It(o(),"*uploadCollection")},get secureUploadsManager(){return It(o(),"*secureUploadsManager",false)},get api(){return It(o(),"*publicApi")},get validationManager(){return It(o(),"*validationManager")},when(i,t){let e=uc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n=r.sub(e,l=>{l&&(t(l),n());});return n},wait(i){return new Promise(t=>{let e=this.when(i,r=>{t(r),e();});})}}),"createSharedInstancesBag");var X=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),cr=class extends G{constructor(){super(...arguments);this.Ke=new Map;this.ue=new Set;this.c=new Map;}static{a(this,"ModalManager");}registerModal(t,e){this.Ke.set(t,e),this.q(X.ADD,{id:t,modal:e});}deleteModal(t){let e=this.Ke.get(t);return e?(this.Ke.delete(t),this.ue.delete(t),this.q(X.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.Ke.get(t);return e?(this.ue.add(t),this.q(X.OPEN,{modal:e,id:t}),true):(this.w(`Modal with ID "${t}" not found`),false)}close(t){let e=this.Ke.get(t);return !e||!this.ue.has(t)?(this.w(`Modal with ID "${t}" not found or not active`),false):(this.ue.delete(t),this.q(X.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.Ke.has(t)?this.ue.has(t)?this.close(t):this.open(t):(this.w(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.ue.size>0}back(){if(this.ue.size===0)return this.w("No active modals to go back from"),false;let t=Array.from(this.ue).pop();return t?this.close(t):false}closeAll(){let t=this.ue.size;return this.ue.clear(),this.q(X.CLOSE_ALL,{}),t}subscribe(t,e){return this.c.has(t)||this.c.set(t,new Set),this.c.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.c.has(t)&&this.c.get(t)?.delete(e);}q(t,e){if(this.c.has(t))for(let r of this.c.get(t)??new Set)try{r(e);}catch(s){this.i.telemetryManager.sendEventError(s,"modal subscriber"),this.w("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.Ke.clear(),this.c.clear(),this.q(X.DESTROY,{});}};var ur=a(o=>o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-"),"toKebabCase");function En(o){return Object.prototype.toString.call(o)==="[object Object]"}a(En,"isObject");var dc=/\W|_/g;function pc(o){return o.split(dc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}a(pc,"camelizeString");function Cn(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>Wt(t,{ignoreKeys:i})):o}a(Cn,"camelizeArrayItems");function Wt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Cn(o,{ignoreKeys:i});if(!En(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}En(r)?r=Wt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Cn(r,{ignoreKeys:i})),t[pc(e)]=r;}return t}a(Wt,"camelizeKeys");var hc=a(o=>new Promise(i=>setTimeout(i,o)),"delay");function Fo({libraryName:o,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:o,libraryVersion:i,languageName:s,integration:r});let n=[o,i,e].filter(Boolean).join("/"),l=[s,r].filter(Boolean).join("; ");return `${n} (${l})`}a(Fo,"getUserAgent$1");var fc={factor:2,time:100};function mc(o,i=fc){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a(l=>hc(l??s).then(()=>(t+=1,e(r))),"retry")})}return a(e,"runAttempt"),e(o)}a(mc,"retrier");var ye=class extends Error{static{a(this,"UploadcareError");}},Ue=class o extends ye{static{a(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},dr=a((o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),ie=class o extends ye{static{a(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},gc=500,Sn=a(({check:o,interval:i=gc,timeout:t,signal:e})=>new Promise((r,s)=>{let n,l;dr(e,()=>{n&&clearTimeout(n),s(new ie("Poll cancelled"));}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),s(new ie("Timed out"));},t));let c=a(()=>{try{Promise.resolve(o(e)).then(u=>{u?(l&&clearTimeout(l),r(u)):n=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");n=setTimeout(c,0);}),"poll"),U={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},pr="application/octet-stream",An="original",oe=a(({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=o?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[f,m]=d;typeof m<"u"&&!Array.isArray(m)&&c.setRequestHeader(f,m);}),c.responseType="text",dr(r,()=>{p=true,c.abort(),l(new ie);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(T){let C=T.split(": "),E=C.shift(),k=C.join(": ");E&&typeof E<"u"&&(m[E]=k);});let v=c.response,w=c.status;n({request:d,data:v,headers:m,status:w});}},c.onerror=d=>{p||l(new Ue(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function vc(o,...i){return o}a(vc,"identity");var yc=a(({name:o})=>o?[o]:[],"getFileOptions"),bc=vc,wc=a(()=>new FormData,"getFormData"),kn=a(o=>false,"isBuffer"),hr=a(o=>typeof Blob<"u"&&o instanceof Blob,"isBlob"),fr=a(o=>typeof File<"u"&&o instanceof File,"isFile"),mr=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string","isReactNativeAsset"),Re=a(o=>hr(o)||fr(o)||kn()||mr(o),"isFileData"),Tc=a(o=>typeof o=="string"||typeof o=="number"||typeof o>"u","isSimpleValue"),Ec=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o),"isObjectValue"),Cc=a(o=>!!o&&typeof o=="object"&&"data"in o&&Re(o.data),"isFileValue");function Mn(o,i,t){if(Array.isArray(t))for(let e of t)Mn(o,`${i}[]`,e);else if(Cc(t)){let{name:e,contentType:r}=t,s=bc(t.data,e,r??pr),n=yc({name:e,contentType:r});o.push([i,s,...n]);}else if(Ec(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Tc(t)&&t&&o.push([i,t.toString()]);}a(Mn,"collectParams");function xc(o){let i=[];for(let[t,e]of Object.entries(o))Mn(i,t,e);return i}a(xc,"getFormDataParams");function gr(o){let i=wc(),t=xc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}a(gr,"buildFormData");var nt=class o extends ye{static{a(this,"UploadError");}code;request;response;headers;constructor(i,t,e,r,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=r,this.headers=s,Object.setPrototypeOf(this,o.prototype);}},Sc=a(o=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(o))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>r[1]??false).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),qt=a((o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Sc(t)),e.toString()},"getUrl"),Ac="6.18.4",kc="UploadcareUploadClient",Mc=Ac;function we(o){return Fo({libraryName:kc,libraryVersion:Mc,...o})}a(we,"getUserAgent");var Ic="RequestThrottledError",xn=15e3,Oc=1e3;function Pc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return xn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:xn}a(Pc,"getTimeoutFromThrottledRequest");function se(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return mc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Ic&&r<t)return s(Pc(n));if(n instanceof Ue&&r<e)return s((r+1)*Oc);throw n}))}a(se,"retryIfFailed");var In=a(o=>{let i="";return (hr(o)||fr(o)||mr(o))&&(i=o.type),i||pr},"getContentType"),On=a(o=>{let i="";return fr(o)&&o.name?i=o.name:hr(o)||kn()?i="":mr(o)&&o.name&&(i=o.name),i||An},"getFileName");function Vo(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}a(Vo,"getStoreValue");function Lc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=U.baseURL,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return se(()=>oe({method:"POST",url:qt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:f})},data:gr({file:{data:o,name:t||On(o),contentType:e||In(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Vo(l),signature:s,expire:n,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:T,headers:C,request:E})=>{let k=Wt(JSON.parse(T));if("error"in k)throw new nt(k.error.content,k.error.errorCode,E,k,C);return k}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Lc,"base");var Uo;(function(o){o.Token="token",o.FileInfo="file_info";})(Uo||(Uo={}));function Uc(o,{publicKey:i,baseURL:t=U.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return se(()=>oe({method:"POST",headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:f})},url:qt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Vo(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:T,headers:C,request:E})=>{let k=Wt(JSON.parse(T));if("error"in k)throw new nt(k.error.content,k.error.errorCode,E,k,C);return k}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Uc,"fromUrl");var ut;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(ut||(ut={}));var Rc=a(o=>"status"in o&&o.status===ut.Error,"isErrorResponse");function $c(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=U.retryNetworkErrorMaxTimes}={}){return se(()=>oe({method:"GET",headers:i?{"X-UC-User-Agent":we({publicKey:i,integration:r,userAgent:s})}:void 0,url:qt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=Wt(JSON.parse(c));if("error"in d&&!Rc(d))throw new nt(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a($c,"fromUrlStatus");function Dc(o,{publicKey:i,baseURL:t=U.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=U.retryNetworkErrorMaxTimes}){return se(()=>oe({method:"POST",headers:{"X-UC-User-Agent":we({publicKey:i,integration:c,userAgent:u})},url:qt(t,"/group/",{jsonerrors:1}),data:gr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:l}),signal:n}).then(({data:f,headers:m,request:v})=>{let w=Wt(JSON.parse(f));if("error"in w)throw new nt(w.error.content,w.error.errorCode,v,w,m);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}a(Dc,"group");function Pn(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=U.retryNetworkErrorMaxTimes}){return se(()=>oe({method:"GET",headers:{"X-UC-User-Agent":we({publicKey:i,integration:s,userAgent:n})},url:qt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:u,headers:p,request:d})=>{let f=Wt(JSON.parse(u));if("error"in f)throw new nt(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Pn,"info");function Fc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=U.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return se(()=>oe({method:"POST",url:qt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:f})},data:gr({filename:e||An,size:o,content_type:t||pr,part_size:r,UPLOADCARE_STORE:Vo(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:p,metadata:w}),signal:u}).then(({data:T,headers:C,request:E})=>{let k=Wt(JSON.parse(T));if("error"in k)throw new nt(k.error.content,k.error.errorCode,E,k,C);return k.parts=Object.keys(k.parts).map(wt=>k.parts[Number(wt)]),k}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})}a(Fc,"multipartStart");function Vc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=U.retryNetworkErrorMaxTimes}){return se(()=>oe({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||pr}}).then(l=>(r&&r({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}a(Vc,"multipartUpload");function Nc(o,{publicKey:i,baseURL:t=U.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=U.retryNetworkErrorMaxTimes}){return se(()=>oe({method:"POST",url:qt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:s,userAgent:n})},data:gr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=Wt(JSON.parse(u));if("error"in f)throw new nt(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Nc,"multipartComplete");function No(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return Sn({check:a(p=>Pn(o,{publicKey:i,baseURL:t,signal:p,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}a(No,"isReadyPoll");function _c(o){return "defaultEffects"in o}a(_c,"isGroupFileInfo");var be=class{static{a(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=U.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=qt(t,`${r}/`),l=s?qt(`https://${s}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=l,_c(i)&&(this.defaultEffects=i.defaultEffects);}},zc=a((o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:T})=>Lc(o,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:T}).then(({file:C})=>No(C,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(C=>new be(C,{baseCDN:w})),"uploadDirect"),Bc=a((o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>Pn(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new be(f,{baseCDN:d,fileName:t})).then(f=>(s&&s({isComputable:true,value:1}),f)),"uploadFromUploaded"),Hc=a((o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=a(n=>()=>{e=n,r.forEach((l,c)=>c!==n&&l.abort());},"createStopRaceCallback");return dr(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,l)=>{let c=s(l);return Promise.resolve().then(()=>n({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),Kc=window.WebSocket,Ro=class{static{a(this,"Events");}events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},jc=a((o,i)=>o==="success"?{status:ut.Success,...i}:o==="progress"?{status:ut.Progress,...i}:{status:ut.Error,...i},"response"),$o=class{static{a(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Ro;disconnectTimeoutId=null;constructor(i,t=3e4){this.key=i,this.disconnectTime=t;}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Kc(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message));}),this.emmitter.on("connected",()=>{this.isConnected=true,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[];}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case "pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case "pusher:ping":{this.send("pusher:pong",{});break}case "progress":case "success":case "fail":this.emmitter.emit(e.channel,jc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=a(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Po=null,_o=a(o=>{if(!Po){let i=typeof window>"u"?0:3e4;Po=new $o(o,i);}return Po},"getPusher"),Gc=a(o=>{_o(o).connect();},"preconnect");function qc({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return Sn({check:a(u=>$c(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case ut.Error:return new nt(p.error,p.errorCode);case ut.Waiting:return false;case ut.Unknown:return new nt(`Token "${o}" was not found.`);case ut.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case ut.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}a(qc,"pollStrategy");var Wc=a(({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=_o(i),l=n.onError(s),c=a(()=>{l(),n.unsubscribe(o);},"destroy");dr(t,()=>{c(),s(new ie("pusher cancelled"));}),n.subscribe(o,u=>{switch(u.status){case ut.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case ut.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),r(u);break}case ut.Error:c(),s(new nt(u.msg,u.error_code));}});}),"pushStrategy"),Zc=a((o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:T=U.pusherKey,metadata:C})=>Promise.resolve(Gc(T)).then(()=>Uc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:C})).catch(E=>(_o(T)?.disconnect(),Promise.reject(E))).then(E=>E.type===Uo.FileInfo?E:Hc([({signal:k})=>qc({token:E.token,publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:k}),({signal:k})=>Wc({token:E.token,pusherKey:T,signal:k,onProgress:d})],{signal:p})).then(E=>{if(E instanceof nt)throw E;return E}).then(E=>No(E.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(E=>new be(E,{baseCDN:r})),"uploadFromUrl"),Lo=new WeakMap,Yc=a(async o=>{if(Lo.has(o))return Lo.get(o);let i=await fetch(o.uri).then(t=>t.blob());return Lo.set(o,i),i},"getBlobFromReactNativeAsset"),Ln=a(async o=>{if(fr(o)||hr(o))return o.size;if(mr(o))return (await Yc(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Xc=a((o,i=U.multipartMinFileSize)=>o>=i,"isMultipart"),Un=a(o=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !Re(o)&&t.test(o)},"isUuid"),zo=a(o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Re(o)&&t.test(o)},"isUrl"),Qc=a((o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,l=[...i],c=a(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(r[u]=d,n-=1,n?c():t(r));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<o;u++)c();}),"runWithConcurrency"),Jc=a((o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},"sliceChunk"),tu=a(async(o,i,t)=>e=>Jc(o,e,i,t),"prepareChunks"),eu=a((o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Vc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),iu=a(async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:T=U.multipartChunkSize,maxConcurrentRequests:C=U.maxConcurrentRequests,baseCDN:E,metadata:k})=>{let wt=e??await Ln(o),Tt,pe=a((J,ct)=>{if(!u)return;Tt||(Tt=Array(J).fill(0));let At=a(Ut=>Ut.reduce((zt,po)=>zt+po,0),"sum");return Ut=>{Ut.isComputable&&(Tt[ct]=Ut.value,u({isComputable:true,value:At(Tt)/J}));}},"createProgressHandler");return w||=In(o),Fc(wt,{publicKey:i,contentType:w,fileName:t||On(o),baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:k,multipartChunkSize:T}).then(async({uuid:J,parts:ct})=>{let At=await tu(o,wt,T);return Promise.all([J,Qc(C,ct.map((Ut,zt)=>()=>eu(At(zt),Ut,{publicKey:i,contentType:w,onProgress:pe(ct.length,zt),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})))])}).then(([J])=>Nc(J,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})).then(J=>J.isReady?J:No(J.uuid,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(J=>new be(J,{baseCDN:E}))},"uploadMultipart");async function Bo(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartMinFileSize:w,multipartChunkSize:T,maxConcurrentRequests:C,baseCDN:E=U.baseCDN,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:wt,pusherKey:Tt,metadata:pe}){if(Re(o)){let J=await Ln(o);return Xc(J,w)?iu(o,{publicKey:i,contentType:v,multipartChunkSize:T,fileSize:J,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:pe}):zc(o,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:pe})}if(zo(o))return Zc(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:E,checkForUrlDuplicates:k,saveUrlForRecurrentUploads:wt,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:Tt,metadata:pe});if(Un(o))return Bc(o,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E});throw new TypeError(`File uploading from "${o}" is not supported`)}a(Bo,"uploadFile");var ru=a((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return o}},"replaceUrlBase"),Do=class{static{a(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=U.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,s)=>r+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=ru(i.cdnUrl,t),this.files=e.map(r=>new be(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},ou=a(o=>{for(let i of o)if(!Re(i))return false;return true},"isFileDataArray"),su=a(o=>{for(let i of o)if(!Un(i))return false;return true},"isUuidArray"),nu=a(o=>{for(let i of o)if(!zo(i))return false;return true},"isUrlArray");function Rn(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w=U.multipartChunkSize,baseCDN:T=U.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E,jsonpCallback:k}){if(!ou(o)&&!nu(o)&&!su(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let wt,Tt=true,pe=o.length,J=a((ct,At)=>{if(!c)return;wt||(wt=Array(ct).fill(0));let Ut=a(zt=>zt.reduce((po,Ll)=>po+Ll)/ct,"normalize");return zt=>{if(!zt.isComputable||!Tt){Tt=false,c({isComputable:false});return}wt[At]=zt.value,c({isComputable:true,value:Ut(wt)});}},"createProgressHandler");return Promise.all(o.map((ct,At)=>Re(ct)||zo(ct)?Bo(ct,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:J(pe,At),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w,baseCDN:T,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E}).then(Ut=>Ut.uuid):ct)).then(ct=>Dc(ct,{publicKey:i,baseURL:e,jsonpCallback:k,secureSignature:r,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(At=>new Do(At,{baseCDN:T})).then(At=>(c&&c({isComputable:true,value:1}),At)))}a(Rn,"uploadFileGroup");var re=class{static{a(this,"Queue");}Ni=1;to=[];Vi=0;io=new Map;ro=new Map;constructor(i){this.Ni=i;}run(){let i=this.Ni-this.Vi;for(let t=0;t<i;t++){let e=this.to.shift();if(!e)return;let r=this.io.get(e),s=this.ro.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Vi+=1,e().finally(()=>{this.io.delete(e),this.ro.delete(e),this.Vi-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.io.set(i,e),this.ro.set(i,r),this.to.push(i),t&&this.run();})}get pending(){return this.to.length}get running(){return this.Vi}set concurrency(i){this.Ni=i,this.run();}get concurrency(){return this.Ni}};var Ho=a(()=>({}),"blockCtx"),Ko=a(o=>({...Ho(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":a(()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),jo=a(o=>({...Ko(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new re(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),$n=a(o=>({...jo(o),"*solution":null,"*lazyPlugins":null}),"solutionBlockCtx");var V=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var vr=class extends G{constructor(t){super(t);this.scopes=new Set;this.listener=this.Bc.bind(this),window.addEventListener("paste",this.listener);}static{a(this,"ClipboardLayer");}openUploadList(){this.i.api.setCurrentActivity(V.UPLOAD_LIST),this.i.api.setModalState(true);}async Bc(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this.He.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),r=e.map(n=>n.getAsFile()).filter(n=>n!==null),s=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(l=>{n.getAsString(c=>{l(c);});}));r.length>0&&(r.forEach(n=>{this.i.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(l=>{this.i.api.addFileFromUrl(l,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var au={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function fi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}a(fi,"focus");function Go(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=au[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}a(Go,"findGroupNodeByEventTarget");function qo(o,i){return i.role==="toolbar"?cu(i):i.querySelectorAll(`[role=${o.role}]`)}a(qo,"getItems");function lu(o,i){return Array.from(o).filter(t=>{let e=t.parentElement;for(;e&&e!==i;){if(e.getAttribute("aria-hidden")==="true")return false;e=e.parentElement;}return true})}a(lu,"filterNested");function cu(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}a(cu,"getToolbarItems");function uu(o){let i=o.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=o.role;return t==="menubar"||t==="tablist"||t==="toolbar"}a(uu,"isHorizontalOrientation");function Dn(o){return i=>{let t=false,e=o?.searchDelayMs||300,r=0,s="";function n(d){let f=Go(d.target);if(!f){l();return}let m=qo(d.target,f),v=lu(m,f),w=Array.from(v).indexOf(d.target),T="ArrowDown",C="ArrowUp";if(uu(f)&&(i.document.dir==="rtl"?(T="ArrowLeft",C="ArrowRight"):(T="ArrowRight",C="ArrowLeft")),d.key===T)d.preventDefault(),fi(d.target,v[w+1]||v[0]);else if(d.key===C)d.preventDefault(),fi(d.target,v[w-1]||v[v.length-1]);else if(d.key==="Home")d.preventDefault(),fi(d.target,v[0]);else if(d.key==="End")d.preventDefault(),fi(d.target,v[v.length-1]);else if(d.key.length===1&&f.role!=="tablist"){d.timeStamp-r<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),r=d.timeStamp;let E=Array.from(m).find(k=>k.textContent?.trim()?.toLowerCase()?.startsWith(s));E&&(d.preventDefault(),fi(d.target,E));}}a(n,"keyDown");function l(){t=false,i.removeEventListener("keydown",n);}a(l,"stop");function c(d){let f=Go(d.target);if(f){t||(t=true,i.addEventListener("keydown",n));let m=qo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}a(u,"focusOut");function p(d){let f=Go(d.target);if(f){let m=qo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return a(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}a(Dn,"focusGroupKeyUX");function Fn(){return o=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}a(e,"jump");function r(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return a(r,"focusOut"),o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}a(Fn,"hiddenKeyUX");function Vn(){return o=>{let i=[];function t(c){let u=o.document.activeElement;u&&u!==o.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}a(t,"focus");function e(){let c=i.pop();if(!c){o.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}a(e,"back");let r=0,s;function n(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let p=o.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}a(n,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e();}return a(l,"keyDown"),o.addEventListener("keydown",l),()=>{o.removeEventListener("keydown",l);}}}a(Vn,"jumpKeyUX");function Nn(o){let i,t=o.split(" "),e;function r(l){(l.key==="Enter"||l.key===" ")&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}a(r,"keyDown");function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}a(s,"keyUp");function n(l){l.clientX===0&&l.clientY===0&&i!==l.target&&(s(),e!==l.target&&(l.target.classList.add(...t),i=l.target));}return a(n,"click"),l=>(l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",n),l.removeEventListener("keydown",r),l.removeEventListener("keyup",s);})}a(Nn,"pressKeyUX");function _n(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}a(_n,"startKeyUX");var Wo=class{constructor(){this.te=new Map;this.oo=[];}static{a(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=a(r=>{let s=r.target;s instanceof Node&&this.oo.some(n=>n===s||n.contains(s))&&t(r);},"wrappedListener");this.te.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.te.get(t);e&&window.removeEventListener(i,e),this.te.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.oo.push(i);}destroy(){this.oo=[];for(let i of this.te.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.te.clear();}},yr=class{static{a(this,"A11y");}constructor(){this._i=new Wo,this.nn=_n(this._i,[Dn(),Nn("is-pressed"),Vn(),Fn()]);}registerBlock(i){this._i.registerScope(i);}destroy(){this.nn?.(),this._i.destroy();}};var Zt=a(o=>`*l10n/${o}`,"localeStateKey"),du="en",br=class extends G{constructor(t){super(t);this.Et="";for(let[r,s]of Object.entries(di)){let n=this.e.has(Zt(r))?!this.e.read(Zt(r)):true;this.e.add(Zt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Et&&this.an(this.Et);})),this.addSub(this.e.sub(M("localeName"),async r=>{if(!r)return;this.Et=r;let s=await dn(r);r!==du&&this.Et!==r||(this.an(r),this.ln(r,s));})),this.addSub(this.e.sub(M("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Et];s&&this.ln(this.Et,s);}));}static{a(this,"LocaleManager");}ln(t,e){let r=this.He.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let l=r?.[s];this.e.add(Zt(s),l??n,true);}}an(t){let e=this.i.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.i18n){let{pluginId:n,...l}=s,c=l[t];if(c)for(let[u,p]of Object.entries(c))p!==void 0&&this.e.add(Zt(u),p,true);}}};var pu=a(()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},"calcIsDesktopSafari"),hu=a(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),fu=a(()=>({safariDesktop:pu()}),"calcBrowserInfo"),mu=a(()=>({htmlMediaCapture:hu()}),"calcBrowserFeatures"),zn=fu(),Bn=mu();var mi="image/*",Zo="video/*",gu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],vu=a(()=>zn.safariDesktop?[mi]:[mi,...gu],"calcImageAcceptList"),gi=vu(),wr=a(o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Y(i)):[],"mergeFileTypes"),Yo=a((o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),"matchMimeType"),Hn=a((o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),$e=a(o=>{let i=o?.type;return i?Yo(i,gi):false},"fileIsImage");function Kn(o,i,t,e,r){return {registry:{registerSource:a(u=>o.addSource(e,u),"registerSource"),registerActivity:a(u=>o.addActivity(e,u),"registerActivity"),registerFileAction:a(u=>o.addFileAction(e,u),"registerFileAction"),registerFileHook:a(u=>o.addFileHook(e,u),"registerFileHook"),registerIcon:a(u=>o.addIcon(e,u),"registerIcon"),registerI18n:a(u=>o.addI18n(e,u),"registerI18n"),registerConfig:a(u=>{o.addConfig(e,u);let p=M(u.name);i.has(p)||i.add(p,u.defaultValue);},"registerConfig")},config:{get:a(u=>{let p=M(u);return i.read(p)},"get"),subscribe:a((u,p)=>{let d=M(u),f=i.sub(d,m=>{p(m);});return r.push(f),f},"subscribe")},activity:{getParams:a(()=>i.read("*currentActivityParams"),"getParams"),subscribeToParams:a(u=>{let p=i.sub("*currentActivityParams",d=>{u(d);});return r.push(p),p},"subscribeToParams")},files:{update:a((u,p)=>{let d=t.uploadCollection?.read(u);d&&(p.file!==void 0&&(d.setValue("file",p.file),d.setValue("fileSize",p.file.size)),p.cdnUrl!==void 0&&d.setValue("cdnUrl",p.cdnUrl),p.cdnUrlModifiers!==void 0&&d.setValue("cdnUrlModifiers",p.cdnUrlModifiers),p.mimeType!==void 0&&d.setValue("mimeType",p.mimeType));},"update")}}}a(Kn,"buildPluginApi");var yu=a(async({entries:o,signal:i})=>(await Promise.all(o.map(async e=>{if(e.isEnabled())try{let r=await e.load();return i.aborted||!e.isEnabled()?void 0:r??void 0}catch(r){i.aborted||console.warn("Failed to load lazy plugin",r);return}}))).filter(e=>e!==void 0),"resolveLazyPlugins"),Tr=class{constructor(i,t){this.e=i;this.Hc=t;this.Yt=new Set;this.cn=this.e.sub("*lazyPlugins",e=>{this.zc(e??[]);});}static{a(this,"LazyPluginLoader");}zc(i){for(let r of this.Yt)r();if(this.Yt.clear(),i.length===0)return;let t=new Set([M("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(M(s));let e=a(()=>this.un(i),"recompute");for(let r of t)this.Yt.add(this.e.sub(r,e,false));this.un(i);}un(i){this.so?.abort();let t=new AbortController;this.so=t;let e=a(n=>this.e.read(M(n)),"get"),r=e("plugins"),s=yu({entries:i.map(n=>({isEnabled:a(()=>n.isEnabled(e),"isEnabled"),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.Hc(s);}destroy(){this.cn();for(let i of this.Yt)i();this.Yt.clear(),this.so?.abort();}};var Er=class{constructor(){this.je=new Map;}static{a(this,"CustomConfigRegistry");}register(i,t){if(this.je.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.je.set(t.name,e);}unregister(i){this.je.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.je)e.pluginId===i&&this.je.delete(t);}get(i){return this.je.get(i)}getAll(){return new Map(this.je)}};var Cr=class{constructor(){this.Me=[];this.de=[];this.Bi=[];this.zi=[];this.Hi=[];this.Ki=[];this.config=new Er;}static{a(this,"PluginRegistry");}xt(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.Me.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Source with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.Me.push(this.xt(i,t));}addActivity(i,t){let e=this.de.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Activity with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.de.push(this.xt(i,t));}addFileAction(i,t){this.Bi.push(this.xt(i,t));}addFileHook(i,t){this.zi.push(this.xt(i,{timeout:3e4,...t}));}addIcon(i,t){this.Hi.push(this.xt(i,t));}addI18n(i,t){this.Ki.push(this.xt(i,t));}addConfig(i,t){this.config.register(i,t);}purge(i){this.Me=this.Me.filter(t=>t.pluginId!==i),this.de=this.de.filter(t=>t.pluginId!==i),this.Bi=this.Bi.filter(t=>t.pluginId!==i),this.zi=this.zi.filter(t=>t.pluginId!==i),this.Hi=this.Hi.filter(t=>t.pluginId!==i),this.Ki=this.Ki.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.Me],activities:[...this.de],fileActions:[...this.Bi],fileHooks:[...this.zi],icons:[...this.Hi],i18n:[...this.Ki]}}};var xr=class extends G{constructor(t){super(t);this.Ge=new Map;this.c=new Set;this.ao=Promise.resolve();this.registry=new Cr;this.dn=new Tr(this.e,e=>{this.ao=this.ao.then(()=>e).then(r=>{if(r)return this.Kc(r)});});}static{a(this,"PluginManager");}get configRegistry(){return this.registry.config}pluginsReady(){return this.ao}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async Kc(t){let e=new Set(this.Ge.keys()),r=new Set;for(let s of t){if(!s.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(r.has(s.id)){console.warn(`[PluginManager] Plugin "${s.id}" is already in the list, skipping duplicate`);continue}if(r.add(s.id),!this.Ge.has(s.id))try{await this.jc(s);}catch(n){this.registry.purge(s.id),this.lo(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.co(s);}async jc(t){this.Ge.has(t.id)&&this.co(t.id);let e=[],r=Kn(this.registry,this.e,this.i,t.id,e),s=this.i.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(l){for(let c of e)try{c();}catch(u){this.w("Failed to unsubscribe config listener",u);}throw l}this.Ge.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.lo();}co(t){let e=this.Ge.get(t);if(e){this.registry.purge(t);for(let r of e.configSubscriptions)try{r();}catch(s){this.w("Failed to unsubscribe config listener",s);}e.dispose?.(),this.Ge.delete(t),this.lo();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(l=>l.type==="onAdd");if(r.length===0)return;let s=e,n=new AbortController;for(let l of r){if(n.signal.aborted)break;try{let c=l.handler({file:s,signal:n.signal}),u=new Promise((p,d)=>setTimeout(()=>d(new Error("onAdd hook timed out")),l.timeout));({file:s}=await Promise.race([c,u]));}catch(c){console.warn(`File hook "onAdd" from plugin "${l.pluginId}" failed`,c);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",$e(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.Ge.keys()))this.co(t);this.dn.destroy(),super.destroy();}lo(){for(let t of this.c)try{t();}catch{}}};function bu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}a(bu,"i");function Qo(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?Qo(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=bu(i);return typeof t=="object"&&t!==null?[e,Qo(t)]:[e,t]}))}a(Qo,"c");function wu(o){return {ok:true,value:o}}a(wu,"u");function Xo(o){return {ok:false,error:o}}a(Xo,"a");var Tu="https://tlm.uploadcare.com/api/",Jo=class{static{a(this,"y");}constructor(i=Tu){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return Xo(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return wu(s)}catch(s){return Xo(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return Xo(new Error(`Error fetching data from "${e}". Error: ${r}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Qo(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Eu=a(async(o,i)=>({success:true,data:i}),"p"),Cu=a(async o=>Eu(void 0,o),"f"),Sr=class extends Jo{static{a(this,"h");}constructor(){super();}async sendEvent(i,t){let e=await Cu(i);if(!e.success)throw console.error("TelemetryAPIService: events: body is invalid",e.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",i,t)}};var xu=20,F=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),I=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),Ar=class extends G{constructor(){super(...arguments);this.Xt=new Map;this.ji=new Set;this.te=new Map;}static{a(this,"EventEmitter");}bindTarget(t){return this.ji.add(t),()=>{this.ji.delete(t);}}on(t,e){let r=this.te.get(t);return r||(r=new Set,this.te.set(t,r)),r.add(e),()=>this.te.get(t)?.delete(e)}pn(t,e){for(let s of this.ji)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.te.get(t);if(r)for(let s of r)s(e);this.w?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,r={}){let{debounce:s}=r;if(typeof s!="number"&&!s){this.pn(t,typeof e=="function"?e():e);return}this.Xt.has(t)&&window.clearTimeout(this.Xt.get(t));let n=typeof s=="number"?s:xu,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.pn(t,c),this.Xt.delete(t);}catch(c){this.w?.(()=>`Error while getting payload for event "${t}"`,c);}},n);this.Xt.set(t,l);}destroy(){for(let t of this.Xt.values())window.clearTimeout(t);this.ji.clear(),this.te.clear();}};var jn="1.29.0-alpha.2";var Rt="blocks",$t=jn;var kr=class extends G{constructor(t){super(t);this.Gc=mt.generateRandomUUID();this.Ct=structuredClone(tt);this.uo=false;this.po=null;this.Ie=false;this.hn=new Sr,this.St=new re(10),this.addSub(this.e.sub(M("qualityInsights"),e=>{this.Ie=!!e;}));for(let e of Object.keys(this.Ct))this.addSub(this.e.sub(M(e),r=>{this.Ie&&(this.uo&&this.Ct[e]!==r&&this.sendEvent({eventType:F.CHANGE_CONFIG}),this.qc(e,r));}));}static{a(this,"TelemetryManager");}Wc(t){t===F.INIT_SOLUTION&&!this.uo&&(this.uo=true);}qc(t,e){this.Ct[t]!==e&&(this.Ct[t]=e);}Zc(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===F.INIT_SOLUTION||t.eventType===F.CHANGE_CONFIG)&&(r.config=this.Ct),{...r,appVersion:$t,appName:Rt,sessionId:this.Gc,component:this.Yc,activity:this.Xc,projectPubkey:this.Ct.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.Qc,payload:{location:this.Jc,...e}}}eu(t){return !!(t&&[I.CHANGE,I.COMMON_UPLOAD_PROGRESS,I.FILE_ADDED,I.FILE_REMOVED,I.FILE_UPLOAD_START,I.FILE_UPLOAD_PROGRESS,I.FILE_UPLOAD_SUCCESS,I.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Ie)return;let e=this.Zc({eventType:t.eventType,payload:t.payload,config:t.config});this.Wc(t.eventType),!(this.eu(t.eventType)||this.po&&this.mn(this.po,e))&&this.St.add(async()=>{this.po=e,await this.hn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:F.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}mn(t,e){if(JSON.stringify(t)===JSON.stringify(e))return true;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return false;let r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return false;for(let n of r)if(!Object.hasOwn(e,n)||!this.mn(t[n],e[n]))return false;return true}get Qc(){return Date.now()}get Yc(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get Xc(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get Jc(){return location.origin}};var Gn=a(o=>{let i=new Intl.Locale(o),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var Au=a(o=>o,"DEFAULT_TRANSFORMER"),ts="{{",Wn="}}",qn="plural:";function De(o,i={},t={}){let{openToken:e=ts,closeToken:r=Wn,transform:s=Au}=t;for(let n in i){let l=i[n],c=l?.toString(),u=typeof c=="string"?s(c):String(c);o=o.replaceAll(e+n+r,u);}return o}a(De,"applyTemplateData");function Zn(o){let i=[],t=o.indexOf(ts);for(;t!==-1;){let e=o.indexOf(Wn,t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(qn)){let s=o.substring(t+2,e).replace(qn,""),n=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:l});}t=o.indexOf(ts,e);}return i}a(Zn,"getPluralObjects");var Yn="--uploadcare-blocks-window-height",vi=class o{static{a(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=D(()=>{document.documentElement.style.setProperty(Yn,`${window.innerHeight}px`);},100);}static registerClient(i){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(i);}static unregisterClient(i){o.clientsRegistry.delete(i),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(Yn);}};var Mr=a((o,i)=>new Intl.PluralRules(o).select(i),"getPluralForm");var ku=a(o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=Mr(r,t);return e(`${i}__${s}`)},"createPluralizer"),Ir=a(o=>{let i=ku(()=>t),t=a((e,r={})=>{if(!e)return "";let n=o().read(Zt(e))||e,l=Zn(n);for(let u of l)r[u.variable]=i(u.pluralKey,Number(r[u.countVariable]));return De(n,r)},"l10n");return t},"createL10n");var Mu=a(o=>o.tagName?.includes("-")??false,"isCustomElement"),Or=class{constructor(i){this.qe=new Set;this.Gi=new Map;this.gn=false;this.We=i,this.We.addController(this);}static{a(this,"TestModeController");}hostDisconnected(){this.qi?.(),this.qi=void 0,this.qe.clear(),this.Gi.clear();}hostUpdated(){if(!this.qi&&this.We.has(M("testMode"))){let i=this.We.subConfigValue("testMode",t=>{this.gn=!!t,this.vn();});this.qi=i;}this.tu(),this.vn();}tu(){let i=this.We,t=i.renderRoot??i;if(!t)return;let e=this.We,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Mu(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.qe.has(n)){let l=n.getAttribute("data-testid");if(!l)continue;this.qe.add(n),this.Gi.set(n,l);}for(let n of Array.from(this.qe))(!n.isConnected||r&&n.closest(r)!==e)&&(this.qe.delete(n),this.Gi.delete(n));}vn(){if(!this.qe.size)return;let i=this.We.testId||"";for(let t of this.qe){let e=this.Gi.get(t);e&&(this.gn?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Iu=Oe(rr()(Ie(tr(Et)))),x=class extends Iu{constructor(){super();this.init$=Ho();this.l10n=Ir(()=>this.sharedCtx);this.debugPrint=lr(()=>this.sharedCtx,this.constructor.name);this.i=Tn(()=>this.sharedCtx);new Or(this);}static{a(this,"LitBlock");}static{this.styleAttrs=[];}emit(t,e,r){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,r);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),vi.registerClient(this);}initCallback(){this.Z("*blocksRegistry",()=>new Set),this.Z("*pluginManager",t=>new xr(t)),this.Z("*eventEmitter",t=>new Ar(t)),this.Z("*localeManager",t=>new br(t)),this.Z("*modalManager",t=>new cr(t)),this.Z("*a11y",()=>new yr),this.Z("*clipboard",t=>new vr(t)),this.Z("*telemetryManager",t=>new kr(t)),this.sub(Zt("locale-id"),t=>{let e=Gn(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.ie("*modalManager",false)}get telemetryManager(){return this.ie("*telemetryManager")}get localeManager(){return this.ie("*localeManager")}get a11y(){return this.ie("*a11y")}get clipboardLayer(){return this.ie("*clipboard")}get blocksRegistry(){return this.ie("*blocksRegistry")}get eventEmitter(){return this.ie("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),vi.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.iu(),K.deleteCtx(this.ctxName);}yn(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Z(t,e){let r=this.yn();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.i);this.add(t,s,true),r.set(t,s);return}}iu(){let t=this.yn();for(let[e,r]of t.entries())r?.destroy?.(),this.pub(e,null);t.clear();}ie(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:nr(t),cdnUrlModifiers:Mo(t),fileName:sr(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?De(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:a(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.ze){let t={};this.ze=new Proxy(t,{set:a((e,r,s)=>{if(typeof r!="string"||!(r in tt))return false;let n=r,l=M(n);return this.has(l)||this.add(l,tt[n]),this.$[l]=s,true},"set"),get:a((e,r)=>{let s=M(r);return this.has(s)||this.add(s,tt[r]),this.$[s]},"get")});}return this.ze}subConfigValue(t,e){let r=M(t);return this.has(r)||this.add(r,tt[t]),this.sub(r,e)}};var Dt={ATTRIBUTE:1,CHILD:2},vt=a(o=>(...i)=>({Gr:o,values:i}),"e"),Ct=class{static{a(this,"i");}constructor(i){}get W(){return this.f.W}qr(i,t,e){this.Wi=i,this.f=t,this.ru=e;}Rc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Te=class extends Ct{static{a(this,"e");}constructor(i){if(super(i),this.it=R,i.type!==Dt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===R||i==null)return this.bn=void 0,this.it=i;if(i===rt)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.bn;this.it=i;let t=[i];return t.raw=t,this.bn={Ve:this.constructor.resultType,strings:t,values:[]}}};Te.directiveName="unsafeHTML",Te.resultType=1;vt(Te);var yi=class extends Te{static{a(this,"t");}};yi.directiveName="unsafeSVG",yi.resultType=2;var Fe=vt(yi);var Xn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Yt=class extends x{constructor(){super(...arguments);this.init$=$n(this);}static{a(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return y`${Fe(Xn)}`}};var Qn=a(o=>typeof o!="number"?0:Math.floor(o/1e3),"msToUnixTimestamp"),Jn=a((o,{threshold:i})=>{let{secureExpire:t}=o,e=Qn(Date.now()),r=Number(t),s=Qn(i);return e+s>=r},"isSecureTokenExpired");var Pr=class extends G{constructor(){super(...arguments);this.Ze=null;}static{a(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.He;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.Ze||Jn(this.Ze,{threshold:s})){this.Ze?this.w("Secure signature is expired. Resolving a new one..."):this.w("Secure signature is not set yet.");try{let n=await r();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.w("Secure signature resolved:",n),this.w("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.Ze=n):(this.w("Secure signature resolver returned nothing."),this.Ze=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.i.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Ze}return t&&e?(this.w("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.Ze=null;}};var es=a((o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var is=a((o,i)=>{let t=o.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}},"validateMultiple");var rs=a((o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=wr([...t?gi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let l=Yo(s,r),c=Hn(n,r);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}},"validateFileType");var os=a((o,i)=>{let t=i.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:o}}},"validateIsImage");var Ft=1e3,Ee=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),bi=a(o=>Math.ceil(o*100)/100,"round"),ta=a((o,i=Ee.AUTO)=>{let t=i===Ee.AUTO;if(i===Ee.BYTE||t&&o<Ft**1){let r=Mr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===Ee.KB||t&&o<Ft**2?`${bi(o/Ft**1)} KB`:i===Ee.MB||t&&o<Ft**3?`${bi(o/Ft**2)} MB`:i===Ee.GB||t&&o<Ft**4?`${bi(o/Ft**3)} GB`:i===Ee.TB||t&&o<Ft**5?`${bi(o/Ft**4)} TB`:`${bi(o/Ft**5)} PB`},"prettyBytes");var ss=a((o,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:ta(t)}),payload:{entry:o}}},"validateMaxSizeLimit");var ns=a((o,i)=>{let{internalId:t}=o;if(!i.v.hasItem(t))return;let r=i.v.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof nt)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:o,error:r}};if(r instanceof Ue)return {type:"NETWORK_ERROR",message:r.message,payload:{entry:o,error:r}};let s=r instanceof Error?r:new Error("Unknown error",{cause:r});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}},"validateUploadError");var Ve={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},Ou=a(o=>typeof o=="function"?{runOn:"change",validator:o}:o,"getValidatorDescriptor"),Lr=class extends G{constructor(t){super(t);this.ou=[os,rs,ss,ns];this.su=[is,es];this.St=new re(20);this.wn=D(()=>{this.St.run();},500);this.Oe=false;this.At=new Map;let e=D(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(M("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(M("multipleMin"),e)),this.addSub(this.e.sub(M("multipleMax"),e)),this.addSub(this.e.sub(M("multiple"),e)),this.addSub(this.e.sub(M("imgOnly"),e)),this.addSub(this.e.sub(M("accept"),e)),this.addSub(this.e.sub(M("validationConcurrency"),r=>{this.St.concurrency=r;}));}static{a(this,"ValidationManager");}get v(){return this.i.uploadCollection}runFileValidators(t,e){if(this.Oe)return;let r=e??this.v.items();for(let s of r){let n=this.v.read(s);n&&this.nu(n,t);}}runCollectionValidators(){if(this.Oe)return;let t=this.i.api,e=t.getOutputCollectionState(),r=[],s=this.He.collectionValidators;for(let n of [...this.su,...s])try{let l=n(e,t);if(!l)continue;l&&(r.push(this.Tn(l)),l.message||console.warn(Ve.MISSING_ERROR_MESSAGE));}catch(l){console.warn(Ve.COLLECTION_VALIDATION_FAILED,l);}this.e.pub("*collectionErrors",r),r.length>0&&this.i.eventEmitter.emit(I.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.At.get(t.uid);e&&(e.abortController?.abort(),this.At.delete(t.uid));}async nu(t,e){if(this.Oe)return;let r=this.i.api,s=this.En(t),n=s.promise??Promise.resolve(),l=(async()=>{if(this.Oe||(await n,this.Oe))return;let c=this.au(t,e);if(c.length===0||!this.v.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=r.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.He.validationTimeout,f=this.xn(),m=new Set(c.map(T=>T.validator)),v=[];for(let T of f)if(!m.has(T.validator)){let C=s.lastErrorThrownByValidator.get(T.validator);C&&v.push(C);}let w=c.map(T=>async()=>{if(this.Oe)return;let C=setTimeout(()=>{s.skippedValidators.add(T.validator),p.abort(),console.warn(Ve.FILE_VALIDATION_TIMEOUT);},d);try{let E=await T.validator(u,r,{signal:p.signal});if(!E||p.signal.aborted){s.lastErrorThrownByValidator.set(T.validator,void 0);return}let k=this.Tn(E);s.lastErrorThrownByValidator.set(T.validator,k),v.push(k),E.message||console.warn(Ve.MISSING_ERROR_MESSAGE);}catch(E){p.signal.aborted||(s.skippedValidators.add(T.validator),console.warn(Ve.FILE_VALIDATION_FAILED,E),this.i.telemetryManager.sendEventError(E,`file validator. ${Ve.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),T.runOn!=="change"&&s.skippedValidators.add(T.validator);}});if(this.wn(),await this.St.add(async()=>{this.Oe||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(T=>T())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}Tn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}En(t){let e=this.At.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.At.set(t.uid,r),r}xn(){let t=this.He.fileValidators;return [...this.ou,...t].map(Ou)}au(t,e){let r=this.En(t);return this.xn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Oe=true,this.wn.cancel();for(let t of this.At.values())t.abortController?.abort(),t.promise=void 0;this.At.clear();}};var ea="[Typed State] Wrong property name: ",Ur=class{static{a(this,"TypedData");}constructor(i){this.J=mt.generateFastUid(),this.Y=K.registerCtx(i,this.J);}get uid(){return this.J}setValue(i,t){if(!this.Y.has(i)){console.warn(`${ea}${String(i)}`);return}this.Y.read(i)!==t&&this.Y.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Y.has(i)||console.warn(`${ea}${String(i)}`),this.Y.read(i)}subscribe(i,t){return this.Y.sub(i,t)}destroy(){K.deleteCtx(this.J);}};var Rr=class o{constructor(i){this.Pe=Object.create(null);this.Zi=new Set;this.Yi=new Set;this.ye=new Set;this.ho=new Set;this.fo=new Set;this.kt=new Set;this.An=i.initialValue,this.J=mt.generateFastUid(),this.Y=K.registerCtx({},this.J),this.Cn=i.watchList||[];let t=Object.create(null);this.Sn=(e,r)=>{this.Qt&&window.clearTimeout(this.Qt),t[e]||(t[e]=new Set),t[e].add(r),this.Qt=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Zi.forEach(s=>{s({...t});}),t=Object.create(null));}),this.kn();},i.handler&&this.observeCollection(i.handler);}static{a(this,"TypedCollection");}static{this.lu=1e4;}q(){this.Jt&&window.clearTimeout(this.Jt),this.Jt=window.setTimeout(()=>{let i=new Set(this.fo),t=new Set(this.ho);this.fo.clear(),this.ho.clear();for(let e of this.Yi)e?.([...this.ye],i,t);this.kn();});}kn(){this.kt.size!==0&&(this.ei&&window.clearTimeout(this.ei),this.ei=window.setTimeout(()=>{let i=[...this.kt];this.kt.clear();for(let t of i)t.destroy();},o.lu));}observeCollection(i){return this.Yi.add(i),this.ye.size>0&&this.q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Yi.delete(i);}add(i){let t=new Ur(this.An);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.ye.add(t.uid),this.q(),this.Y.add(t.uid,t),this.fo.add(t),this.Cn.forEach(e=>{this.Pe[t.uid]||(this.Pe[t.uid]=[]),this.Pe[t.uid]?.push(t.subscribe(e,()=>{this.Sn(e,t.uid);}));}),t.uid}hasItem(i){return this.ye.has(i)}read(i){return this.Y.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let r=this.read(i);if(!r)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);r.setValue(t,e);}remove(i){let t=this.read(i);t&&(this.ho.add(t),this.kt.add(t)),this.ye.delete(i),this.q(),this.Y.pub(i,void 0),this.Pe[i]?.forEach(e=>{e();}),delete this.Pe[i];}clearAll(){this.ye.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Zi.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Zi.delete(i);}findItems(i){let t=[];return this.ye.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.ye]}get size(){return this.ye.size}destroy(){this.Qt&&window.clearTimeout(this.Qt),this.Jt&&window.clearTimeout(this.Jt),this.ei&&window.clearTimeout(this.ei);for(let i of this.kt)i.destroy();this.kt.clear(),K.deleteCtx(this.J),this.Zi=new Set,this.Yi=new Set;for(let i of Object.keys(this.Pe))this.Pe[i]?.forEach(t=>{t();}),delete this.Pe[i];}};var L=Object.freeze({PHOTO:"photo",VIDEO:"video"}),xt=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var ia=a(o=>({isVideoRecordingEnabled:j(o.cameraModes).includes(L.VIDEO),isPhotoEnabled:j(o.cameraModes).includes(L.PHOTO)}),"calcCameraModes");var ra=a((o,i)=>{for(let t of o)if(i(t))return t},"findBlockInCtx");var as=a((o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),l=a(()=>{for(let c of o)if(i(c)){clearTimeout(n),r(c);return}s=requestAnimationFrame(l);},"check");l();}),"waitForBlockInCtx");function $r(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}a($r,"applyStyles");var Pu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Lu=new RegExp(`^/?(${Pu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),oa=a(({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(hi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Lu.exec(r.pathname);if(!s)return null;let[,n,l,c]=s;return n?{uuid:n,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var dt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Uu=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),_=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Uu,...dt}),Ru={[dt.DROPBOX_CHOOSER]:dt.DROPBOX},sa=a(o=>Ru[o]??o,"canonicalSourceName");var Dr=a(o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e)),"getOutputData");function na(o){let i=new Map;return a((...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s},"memoized")}a(na,"memoize");var aa=new Set;function Fr(o){aa.has(o)||(aa.add(o),console.warn(o));}a(Fr,"warnOnce");function $u(o){let i=false;return setTimeout(()=>{i=true;},0),a(e=>((...r)=>(i&&Fr(o),e(...r))),"withAssert")}a($u,"createAsyncAssertWrapper");function la(o){let i={},t=o.ctx,e={progress:a(()=>t.read("*commonProgress"),"progress"),errors:a(()=>t.read("*collectionErrors"),"errors"),group:a(()=>t.read("*groupInfo"),"group"),totalCount:a(()=>o.uploadCollection.size,"totalCount"),failedCount:a(()=>i.failedEntries.length,"failedCount"),successCount:a(()=>i.successEntries.length,"successCount"),uploadingCount:a(()=>i.uploadingEntries.length,"uploadingCount"),status:a(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:a(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:a(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:a(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:a(()=>Dr(o),"allEntries"),successEntries:a(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:a(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:a(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:a(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},r=$u("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let l=s,u=na(r(n));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}a(la,"buildOutputCollectionState");var Vr=class extends G{constructor(){super(...arguments);this.cu=Ir(()=>this.e);this.addFileFromUrl=a((t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??_.API});return this.getOutputItem(n)},"addFileFromUrl");this.addFileFromUuid=a((t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({uuid:t,fileName:r??null,silent:e??false,source:s??_.API});return this.getOutputItem(n)},"addFileFromUuid");this.addFileFromCdnUrl=a((t,{silent:e,fileName:r,source:s}={})=>{let n=oa({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let l=this.v.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??_.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=a((t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let l=this.v.add({file:t,isImage:$e(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??_.API,fullPath:n??null});return this.getOutputItem(l)},"addFileFromObject");this.removeFileByInternalId=a(t=>{if(!this.v.read(t))throw new Error(`File with internalId ${t} not found`);this.v.remove(t);},"removeFileByInternalId");this.uploadAll=a(()=>{let t=this.v.items().filter(e=>{let r=this.v.read(e);return r?!r.getValue("isRemoved")&&!r.getValue("isUploading")&&!r.getValue("fileInfo")&&r.getValue("errors").length===0&&!r.getValue("isValidationPending")&&!r.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.i.eventEmitter.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=a((t={})=>{let e=Kt(wr([this.cfg.accept??"",...this.cfg.imgOnly?gi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),$r(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:l}=ia(this.cfg);t.modeCamera===L.PHOTO&&n?s.accept=mi:t.modeCamera===L.VIDEO&&l?s.accept=Zo:s.accept=[mi,l&&Zo].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?_.CAMERA:_.LOCAL});}),this.e.pub("*currentActivity",V.UPLOAD_LIST),this.i.modalManager?.open(V.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=a((t=false)=>{if(this.v.size>0&&!t)this.e.pub("*currentActivity",V.UPLOAD_LIST),this.i.modalManager?.open(V.UPLOAD_LIST);else if(this.Mn?.length===1){let e=this.Mn[0];this.mo().then(()=>{let r=this.i.pluginManager.snapshot().sources,s=r.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(r.find(c=>c.id===n[0])??s).onSelect():(this.e.pub("*currentActivity",V.START_FROM),this.i.modalManager?.open(V.START_FROM));return}this.e.read("*currentActivity")&&this.i.modalManager?.open(this.e.read("*currentActivity"));});}else this.e.pub("*currentActivity",V.START_FROM),this.i.modalManager?.open(V.START_FROM);},"initFlow");this.doneFlow=a(()=>{let t=ra(this.i.blocksRegistry,e=>"doneActivity"in e);t&&(this.e.pub("*currentActivity",t.doneActivity),this.e.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.e.read("*currentActivity")||this.i.modalManager?.closeAll());},"doneFlow");this.setCurrentActivity=a((t,...e)=>{this.mo().then(()=>{this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t),as(this.i.blocksRegistry,r=>r.activityType===t,{onTimeout:a(()=>console.warn(`Activity type "${t}" not found in the context`),"onTimeout"),timeout:100});});},"setCurrentActivity");this.on=a((t,e)=>this.i.eventEmitter.on(t,e),"on");this.getCurrentActivity=a(()=>this.e.read("*currentActivity"),"getCurrentActivity");this.historyBack=a(()=>{this.e.read("*historyBack")?.();},"historyBack");this.setModalState=a(t=>{this.mo().then(()=>{if(!t){this.i.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null);return}let e=this.e.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return as(this.i.blocksRegistry,r=>r.activityType===e,{onTimeout:a(()=>console.warn(`Activity block "${e}" not found in the context`),"onTimeout")}).then(()=>{this.i.modalManager?.open(e);})});},"setModalState");}static{a(this,"UploaderPublicApi");}get v(){return this.i.uploadCollection}get cfg(){return this.He}get l10n(){return this.cu}removeAllFiles(){this.v.clearAll();}getOutputItem(t){let e=K.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let r=e.store,s=r.fileInfo,n=r.isRemoved?"removed":r.errors.length>0?"failed":r.fileInfo?"success":r.isUploading?"uploading":"idle";return {uuid:s?.uuid??r.uuid??null,internalId:t,name:s?.originalFilename??r.fileName,size:s?.size??r.fileSize,isImage:s?.isImage??r.isImage,mimeType:s?.mimeType??r.mimeType,file:r.file,externalUrl:r.externalUrl,cdnUrlModifiers:r.cdnUrlModifiers,cdnUrl:r.cdnUrl??s?.cdnUrl??null,fullPath:r.fullPath,uploadProgress:r.uploadProgress,fileInfo:s??null,metadata:r.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:r.isValidationPending,errors:r.errors,status:n,source:r?.source}}getOutputCollectionState(){return la(this.i)}async mo(){return (await this.i.wait("pluginManager")).pluginsReady()}get Mn(){let t=[];return this.cfg.sourceList&&(t=Y(this.cfg.sourceList)),t}};var ca={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var wi=33.333333333333336,O=1,ls=24,ua=6;function ne(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}a(ne,"setSvgNodeAttrs");function yt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return ne(t,i),t}a(yt,"createSvgNode");function da(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,r+c*n+1.5*p-24*t*p],f=[e+l*s+1.5*u,r+c*n+1.5*p],m=[e+l*s-24*t*u+1.5*u,r+c*n+1.5*p],v=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,w=[f[0],f[1]];return {d:v,center:w}}a(da,"cornerPath");function pa(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,f=i==="n"?-1:i==="s"?1:0,m,v;l?(m=[e+u*s-34*t/2,r+p*n+1.5*f],v=[e+u*s+34*t/2,r+p*n+1.5*f]):(m=[e+u*s+1.5*d,r+p*n-34*t/2],v=[e+u*s+1.5*d,r+p*n+34*t/2]);let w=`M ${m[0]} ${m[1]} L ${v[0]} ${v[1]}`,T=[(m[0]+v[0])/2,(m[1]+v[1])/2];return {d:w,center:T}}a(pa,"sidePath");function ha(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}a(ha,"thumbCursor");function fa({rect:o,delta:[i,t],imageBox:e}){return _e({...o,x:o.x+i,y:o.y+t},e)}a(fa,"moveRect");function _e(o,i){let{x:t}=o,{y:e}=o;return o.x<i.x?t=i.x:o.x+o.width>i.x+i.width&&(t=i.x+i.width-o.width),o.y<i.y?e=i.y:o.y+o.height>i.y+i.height&&(e=i.y+i.height-o.height),{...o,x:t,y:e}}a(_e,"constraintRect");function Du({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;s+=r,l-=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,l=o.y+o.height-s,t&&(n=l*t,c=o.x+o.width/2-n/2)),c<=e.x&&(c=e.x,s=o.y+o.height-l),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y+o.height-l),l<O&&(l=O,t&&(n=l*t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),n<O&&(n=O,t&&(l=n/t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),{x:c,y:s,width:n,height:l}}a(Du,"resizeNorth");function Fu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;s+=r,n-=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(l=n/t,c=o.y+o.height/2-l/2)),c<=e.y&&(c=e.y,s=o.x+o.width-n),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x+o.width-n),l<O&&(l=O,t&&(n=l*t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),n<O&&(n=O,t&&(l=n/t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),{x:s,y:c,width:n,height:l}}a(Fu,"resizeWest");function Vu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;l+=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(n=l*t),c=o.x+o.width/2-n/2),c<=e.x&&(c=e.x,s=o.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y),l<O&&(l=O,t&&(n=l*t),c=o.x+o.width/2-n/2),n<O&&(n=O,t&&(l=n/t),c=o.x+o.width/2-n/2),{x:c,y:s,width:n,height:l}}a(Vu,"resizeSouth");function Nu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;n+=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(l=n/t),c=o.y+o.height/2-l/2),c<=e.y&&(c=e.y,s=o.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x),l<O&&(l=O,t&&(n=l*t),c=o.y+o.height/2-l/2),n<O&&(n=O,t&&(l=n/t),c=o.y+o.height/2-l/2),{x:s,y:c,width:n,height:l}}a(Nu,"resizeEast");function _u({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+s<e.y&&(s=e.y-l),n+=r,c-=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x+o.width-c,l=e.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y+o.height-u)),u<O&&(u=O,t&&(c=u*t),n=o.x+o.width-c,l=o.y+o.height-u),c<O&&(c=O,t&&(u=c/t),n=o.x+o.width-c,l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(_u,"resizeNorthWest");function zu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+s<e.y&&(s=e.y-l),c+=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x,l=e.y)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y+o.height-u)),u<O&&(u=O,t&&(c=u*t),l=o.y+o.height-u),c<O&&(c=O,t&&(u=c/t),l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(zu,"resizeNorthEast");function Bu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),n+=r,c-=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x+o.width-c,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y)),u<O&&(u=O,t&&(c=u*t),n=o.x+o.width-c),c<O&&(c=O,t&&(u=c/t),n=o.x+o.width-c),{x:n,y:l,width:c,height:u}}a(Bu,"resizeSouthWest");function Hu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y)),u<O&&(u=O,t&&(c=u*t)),c<O&&(c=O,t&&(u=c/t)),{x:n,y:l,width:c,height:u}}a(Hu,"resizeSouthEast");function ma({direction:o,...i}){switch(o){case "n":return Du(i);case "w":return Fu(i);case "s":return Vu(i);case "e":return Nu(i);case "nw":return _u(i);case "ne":return zu(i);case "sw":return Bu(i);case "se":return Hu(i);default:return i.rect}}a(ma,"resizeRect");function ga(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}a(ga,"rectContainsPoint");function va(o,i){return o.x>=i.x&&o.y>=i.y&&o.x+o.width<=i.x+i.width&&o.y+o.height<=i.y+i.height}a(va,"isRectInsideRect");function ya(o,i){return Math.abs(o.width/o.height-i)<.1}a(ya,"isRectMatchesAspectRatio");function ze({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}a(ze,"rotateSize");function ba(o,i,t){let e=o/i,r,s;e>t?(r=Math.round(i*t),s=i):(r=o,s=Math.round(o/t));let n=Math.round((o-r)/2),l=Math.round((i-s)/2);return n+r>o&&(r=o-n),l+s>i&&(s=i-l),{x:n,y:l,width:r,height:s}}a(ba,"calculateMaxCenteredCropFrame");function Be(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}a(Be,"roundRect");function ae(o,i,t){return Math.min(Math.max(o,i),t)}a(ae,"clamp");var Ti=["free"],_r=a(o=>{let i=Y(o);if(!i||i.length===0)return [];let t=[];for(let e of i){let r=e.trim();if(!r)continue;let s=r.indexOf(":");if(s===-1&&!Ti.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),l=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(l)||n<=0||l<=0)&&!Ti.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:mt.generateFastUid(),type:"aspect-ratio",width:Ti.includes(r)?0:n,height:Ti.includes(r)?0:l,hasFreeform:Ti.includes(r)});}return t},"parseCropPreset"),wa=a((o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(r-p);d<n&&(n=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(r-u)/u>e)return null}return s},"getClosestAspectRatio");function Ta(o){return Fo({...o,libraryName:Rt,libraryVersion:$t})}a(Ta,"customUserAgent");var Ea="active",He="___ACTIVITY_IS_ACTIVE___",Ca,S=class o extends(Ca=x,Ca){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Ko(this);this.uu=D(this.du.bind(this),10);}static{a(this,"LitActivityBlock");}In(){let t=o.ti.get(this);this[He]=false,this.removeAttribute(Ea),t?.deactivateCallback?.();}pu(){let t=o.ti.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[He]=true,this.setAttribute(Ea,""),t?.activateCallback?.(),this.uu(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[He]?this.In():this.activityType===t&&!this[He]&&this.pu();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let r=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=r??null;}t||(this.$["*history"]=[]);}));}du(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}On(){return !!this.activityType&&o.ti.has(this)}static{this.ti=new Map;}get isActivityActive(){return !!this[He]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ti.set(this,{activateCallback:r,deactivateCallback:s});}hu(){this.isActivityActive&&this.In(),o.ti.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.On()&&this.hu();}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let r=!!e;e&&(r=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=r?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};S.activities=V;var $=class o extends S{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Xi=false;this.init$=jo(this);this.yo=D(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.yu(e);},300);this.gu=(t,e,r)=>{if(this.isConnected){(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(I.FILE_ADDED,this.api.getOutputItem(s.uid)),this.i.wait("pluginManager").then(n=>n.runOnAddHooks(s));this.validationManager.runCollectionValidators();for(let s of r){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(I.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Rn(),this.yo();}};this.vu=t=>{if(!this.isConnected)return;this.yo();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([s])=>["file","uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(r.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=r.filter(n=>t.fileInfo?.has(n)&&!!K.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let n=K.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Rn();}if(t.isUploading)for(let s of t.isUploading){let n=K.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=K.getCtx(s);if(!n)continue;let{fileInfo:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.bu();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=K.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Rn=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");typeof l=="number"&&(t+=l);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{a(this,"LitUploaderBlock");}get fu(){return this.hasBlockInCtx(t=>t instanceof o?t.Xi&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Z("*uploadCollection",()=>new Rr({initialValue:ca,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Z("*secureUploadsManager",t=>new Pr(t)),this.Z("*validationManager",t=>new Lr(t)),this.Z("*publicApi",t=>new Vr(t)),!this.fu&&this.couldBeCtxOwner&&this.mu();}getAPI(){return this.api}get validationManager(){return this.ie("*validationManager")}get api(){return this.ie("*publicApi")}get uploadCollection(){return this.ie("*uploadCollection")}get secureUploadsManager(){return this.ie("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Xi&&this.Pn(),this.yo.cancel();}connectedCallback(){super.connectedCallback(),this.Xi&&this.Ln();}mu(){this.Xi=true,this.Ln(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Ln(){this.Pn(),this.go=this.uploadCollection.observeCollection(this.gu),this.vo=this.uploadCollection.observeProperties(this.vu);}Pn(){this.vo?.(),this.go?.(),this.vo=void 0,this.go=void 0;}async yu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,n=await Rn(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}bu(){let t=_r(this.cfg.cropPreset);if(!t)return;let[e]=t,r=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of r){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=n.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=ba(l,c,u),d=ot(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),f=s.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:Z(f,d)});}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ta,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return Dr(this.i)}};$.extSrcList=Object.freeze({...dt});$.sourceTypes=Object.freeze({..._});var le=class extends x{constructor(){super(...arguments);this.name="";this.Qi="";this.ii=null;this.Un=null;}static{a(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Un=e,this.bo();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.bo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.bo();}bo(){if(!this.name){this.Qi="",this.ii=null;return}let e=this.i.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.ii=e.svg,this.Qi="";return}this.ii=null;let r=`#uc-icon-${this.name}`,s=this.Un?.(this.name);this.Qi=s??r;}render(){return this.ii?y`${this.yield("",y`${Fe(this.ii)}`)}`:y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Qi}></use></svg>`)} `}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};h([b({type:String})],le.prototype,"name",2),h([g()],le.prototype,"Qi",2),h([g()],le.prototype,"ii",2);var xa=a(o=>[...new Set(o)],"uniqueArray");var Ce="--uc-img-",cs="unresolved";var us=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ds=3e3,ps=5e3,hs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Ku="https://ucarecdn.com",Ke=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Ku},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var zr=class extends Ie(Oe(Et)){constructor(){super();this.Mt={};this.c=new Map;this.It=null;this.Ji=null;for(let t in Ke){let e=Ke[t];this.Mt[Ce+t]=e?.default||"";}}static{a(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.Mt[Ce+t]}set$$(t){for(let e in t){let r=Ce+e,s=t[e];this.Mt[r]=s,this.q(r,s);}}sub$$(t,e){let r=Ce+t;this.c.has(r)||this.c.set(r,new Set),this.c.get(r)?.add(e);let s=this.Mt[r];s!==null&&s!==""&&e(s);}q(t,e){this.c.has(t)&&this.c.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${Rt}/${$t}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;Ke[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.It=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.It?.unobserve(t));});},r),this.It.observe(t),this.Ji||(this.Ji=new Set),this.Ji.add(t);}connectedCallback(){super.connectedCallback(),this.wu();}wu(){for(let t in Ke){let e=Ce+t,r=this.getCssData(e,true);r!=null&&(this.Mt[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.It&&(this.Ji?.forEach(t=>{this.It?.unobserve(t);}),this.It=null),this.c.clear();}static get observedAttributes(){return Object.keys(Ke)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Ce+t;this.Mt[s]=r,this.q(s,r);});}};var Sa=a(o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var Kr=class extends zr{constructor(){super(...arguments);this.be=new Image;this.pe=new Image;}static{a(this,"ImgBase");}$n(t){return !t.includes("//")&&!us&&(t=new URL(t,document.baseURI).href),t}er(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let n=parseInt(r,10);return Number(n)>ps&&this.Dn?ps+s:Number(n)>ds&&!this.Dn?ds+s:t}Tu(t,e){let r={format:this.wo("format"),quality:this.wo("quality"),resize:this.er(t),blur:e,"cdn-operations":this.wo("cdn-operations")??void 0,analytics:this.analyticsParams()};return ot(...Sa(r))}wo(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}re(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(us&&r&&!r.includes("//"))return this.ri(r);let s=this.Tu(t,e),n=this.$$("cdn-cname"),l=n;if(r.startsWith(String(n)))return Z(r,s);let c=this.$$("uuid");if(l&&c)return this.ri(Z(te(l,c),s));if(c)return this.ri(Z(te(l,c),s));let u=this.$$("proxy-cname");if(u)return this.ri(Z(u,s,this.$n(r)));let p=this.$$("pubkey");if(p)return this.ri(Z(`https://${p}.ucr.io/`,s,this.$n(r)))}ri(t){let e=this.$$("secure-delivery-proxy");return e?De(e,{previewUrl:t},{transform:a(r=>window.encodeURIComponent(r),"transform")}):t}Ot(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),l=r?"":e*Math.round(s.height);return n||l?`${n||""}x${l||""}`:null}Eu(t){let e=a(s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},"proxifyEvent"),r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.we||(this.To({elNode:this.be}),this.appendChild(this.be)),this.be}get tr(){return this.we?{type:hs.PREVIEW,img:this.pe}:{type:hs.MAIN,img:this.img}}get we(){return this.$$("is-preview-blur")}get Fn(){return this.$$("is-background-for")}get Nn(){let t=this.$$("breakpoints");if(t){let e=Y(t);return xa(e.map(r=>parseInt(r,10)))}else return null}get Dn(){return this.$$("format").toLowerCase()==="jpeg"}Vn(t){let e=new Set;e.add(`url("${this.re(this.Ot(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.re(this.Ot(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.re(this.Ot(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}_n(){let t=new Set;return this.Nn?this.Nn.forEach(e=>{t.add(`${this.re(`${e}x`)} ${this.er(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.re(`${e*2}x`)} ${this.er(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.re(`${e*3}x`)} ${this.er(`${e*3}w`)}`);}):(t.add(`${this.re(this.Ot(this.tr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.re(this.Ot(this.tr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.re(this.Ot(this.tr.img,3))} 3x`)),[...t].join()}Bn(){return this.re()}get zn(){return this.re("100x","100")}xu(){let t=this.Fn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.Vn(e);}):this.Vn(e);});}Cu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}To({elNode:t}){this.Eu(t),this.initAttributes(t);}Eo({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.To({elNode:r}),r.setAttribute(cs,""),r.addEventListener("load",()=>{r.removeAttribute(cs),s(r);}),r.addEventListener("error",()=>{n(false);}),this.Cu({elNode:r,src:t,srcset:e});})}async Su(){if(this.$$("intersection")){this.we&&(this.To({elNode:this.pe}),this.appendChild(this.pe)),this.initIntersection(this.tr.img,async()=>{this.we&&(this.pe.src=this.zn);try{await this.Eo({src:this.Bn(),srcset:this._n(),elNode:this.be}),this.we&&await this.pe.remove(),this.appendChild(this.be);}catch{this.we&&await this.pe?.remove(),this.appendChild(this.be);}});return}try{this.we&&(await this.Eo({src:this.zn,elNode:this.pe}),this.appendChild(this.pe)),await this.Eo({src:this.Bn(),srcset:this._n(),elNode:this.be}),this.we&&await this.pe?.remove(),this.appendChild(this.be);}catch{this.we&&await this.pe?.remove(),this.appendChild(this.be);}}init(){this.Fn?this.xu():this.Su();}};var fs=class extends Kr{static{a(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:ju}=on,Aa=a(o=>o,"i");var Ma=a(o=>o.strings===void 0,"r"),ka=a(()=>document.createComment(""),"s"),je=a((o,i,t)=>{let e=o.ve.parentNode,r=i===void 0?o.bt:i.ve;if(t===void 0){let s=e.insertBefore(ka(),r),n=e.insertBefore(ka(),r);t=new ju(s,n,o,o.options);}else {let s=t.bt.nextSibling,n=t.f,l=n!==o;if(l){let c;t.Au?.(o),t.f=o,t.Ri!==void 0&&(c=o.W)!==n.W&&t.Ri(c);}if(s!==r||l){let c=t.ve;for(;c!==s;){let u=Aa(c).nextSibling;Aa(e).insertBefore(c,r),c=u;}}}return t},"v"),ce=a((o,i,t=o)=>(o.ce(i,t),o),"u"),Gu={},Ia=a((o,i=Gu)=>o.r=i,"p"),Oa=a(o=>o.r,"M"),jr=a(o=>{o.wt(),o.ve.remove();},"h");var Ei=a((o,i)=>{let t=o.le;if(t===void 0)return false;for(let e of t)e.Gs?.(i,false),Ei(e,i);return true},"s"),Gr=a(o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.le,t.delete(o),o=i;}while(t?.size===0)},"o"),Pa=a(o=>{for(let i;i=o.f;o=i){let t=i.le;if(t===void 0)i.le=t=new Set;else if(t.has(o))break;t.add(o),Zu(i);}},"r");function qu(o){this.le!==void 0?(Gr(this),this.f=o,Pa(this)):this.f=o;}a(qu,"h");function Wu(o,i=false,t=0){let e=this.r,r=this.le;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Ei(e[s],false),Gr(e[s]);else e!=null&&(Ei(e,false),Gr(e));else Ei(this,o);}a(Wu,"n");var Zu=a(o=>{o.type==Dt.CHILD&&(o.Ri??=Wu,o.Au??=qu);},"c"),qr=class extends Ct{static{a(this,"f");}constructor(){super(...arguments),this.le=void 0;}qr(i,t,e){super.qr(i,t,e),Pa(this),this.isConnected=i.W;}Gs(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Ei(this,i),Gr(this));}setValue(i){if(Ma(this.Wi))this.Wi.ce(i,this);else {let t=[...this.Wi.r];t[this.ru]=i,this.Wi.ce(t,this,0);}}disconnected(){}reconnected(){}};var A=a(()=>new gs,"e"),gs=class{static{a(this,"h");}},ms=new WeakMap,P=vt(class extends qr{render(o){return R}update(o,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=o.options?.host,this.rt(this.ct=o.element)),R}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=ms.get(i);t===void 0&&(t=new WeakMap,ms.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,o),o!==void 0&&this.G.call(this.ht,o);}else this.G.value=o;}get lt(){return typeof this.G=="function"?ms.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});var vs=null,Ci=class extends x{constructor(){super(...arguments);this.dialogEl=A();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=a(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);},"closeDialog");this.ku=()=>{this.closeDialog();};this.Mu=t=>{this.xo=t.target;};this.Iu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.xo&&this.closeDialog();};this.oi=({id:t})=>{t===this.id?(vs=t,this.show(),this.emit(I.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.si=({id:t})=>{t===this.id&&(this.hide(),this.emit(I.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.Hn=t=>{this.hide(),vs===this.id&&this.emit(I.MODAL_CLOSE,{modalId:vs,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{a(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(X.OPEN,this.oi),this.modalManager?.subscribe(X.CLOSE,this.si),this.modalManager?.subscribe(X.CLOSE_ALL,this.Hn);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.xo=void 0,this.modalManager?.unsubscribe(X.OPEN,this.oi),this.modalManager?.unsubscribe(X.CLOSE,this.si),this.modalManager?.unsubscribe(X.CLOSE_ALL,this.Hn);}Ou(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.ku),this.dialogEl.value?.addEventListener("mousedown",this.Mu),this.dialogEl.value?.addEventListener("mouseup",this.Iu);}render(){return y`<dialog ${P(this.Ou)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],Ci.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ci.prototype,"blockBodyScrolling",2);var Wr=class extends ${constructor(){super(...arguments);this.z=null;this.ir=null;}static{a(this,"FormInput");}get Kn(){return this.nameAttrValue??this.ctxName}jn(){let t=document.createElement("input");return t.type="text",t.name=this.Kn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,$r(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.z=this.jn(),this.appendChild(this.z),this.sub("*collectionState",t=>{if(!t)return;if(!this.ir){let n=document.createElement("div");this.appendChild(n),this.ir=n;}if(!this.z){let n=this.jn();this.appendChild(n),this.z=n;}if(this.ir.innerHTML="",t.status==="uploading"||t.status==="idle"){this.z.value="",this.z.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.z.value="",this.z.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.z.value=e.cdnUrl??"",this.z.setCustomValidity("");return}let r=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&r.length===1&&r[0]){this.z.value=r[0],this.z.setCustomValidity("");return}this.z.remove(),this.z=null;let s=new DocumentFragment;for(let n of r){let l=document.createElement("input");l.type="hidden",l.name=`${this.Kn}[]`,l.value=n,s.appendChild(l);}this.ir.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],Wr.prototype,"nameAttrValue",2);var ys=class extends x{static{a(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Ge=class extends x{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.oe=0;this.rr=A();this.Gn=()=>{let t=this.rr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.oe>0&&t.classList.add("uc-fake-progress--hidden");}};}static{a(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.oe=this.Co(this.value),this.So(),this.rr.value?.addEventListener("animationiteration",this.Gn);}updated(t){if(super.updated(t),t.has("value")){let e=this.Co(this.value);if(!this.visible)this.oe=e;else {let r=Math.max(this.oe,e);r!==this.oe&&(this.oe=r,this.So());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.So():this.oe=this.Co(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.rr.value?.removeEventListener("animationiteration",this.Gn);}Co(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}So(){this.visible&&this.style.setProperty("--l-progress-value",this.oe.toString());}render(){return y`<div ${P(this.rr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],Ge.prototype,"hasFileName",2),h([b({type:Number})],Ge.prototype,"value",2),h([b({type:Boolean,reflect:true})],Ge.prototype,"visible",2);var xi=class extends ${constructor(){super();this.he=false;this.Pt=0;this.init$={...this.init$,"*commonProgress":0};}static{a(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.Ao=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.he=t;}),this.sub("*commonProgress",t=>{this.Pt=t;});}updated(t){super.updated(t),t.has("visible")&&(this.he?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Ao?.(),this.Ao=void 0;}render(){return y`<uc-progress-bar .value=${this.Pt} .visible=${this.he}></uc-progress-bar>`}};h([g()],xi.prototype,"he",2),h([g()],xi.prototype,"Pt",2);var qe=class extends x{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Pu=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{a(this,"Select");}render(){return y`<select @change=${this.Pu} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],qe.prototype,"value",2),h([b({type:Boolean,reflect:true})],qe.prototype,"disabled",2),h([b({type:Array,attribute:false})],qe.prototype,"options",2);var We=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ko="default";this.Mo="";}static{a(this,"SourceBtn");}willUpdate(t){super.willUpdate(t),t.has("source")&&this.Lu(this.source);}Lu(t){if(!t){this.Mo="",this.ko="default";return}let{label:e,icon:r,id:s}=t;this.Mo=e,this.ko=r??s??"default";}activate(){this.source&&this.source.onClick();}render(){return y`<button type="button" @click=${this.activate}><uc-icon name=${this.ko}></uc-icon><div class="uc-txt">${this.l10n(this.Mo)}</div></button>`}};h([b({attribute:false})],We.prototype,"source",2),h([g()],We.prototype,"ko",2),h([g()],We.prototype,"Mo",2);var Si=class extends ${constructor(){super(...arguments);this.qn=[];this.Me=[];this.wrap=false;}static{a(this,"SourceList");}initCallback(){super.initCallback(),this.subConfigValue("sourceList",e=>{this.qn=Y(e),this.Wn();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Wn()));}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}Wn(){let e=this.i.pluginManager?.snapshot().sources??[],r=new Map(e.map(n=>[n.id,n])),s=[];this.qn.forEach(n=>{let l=this.Ru(n,r);if(l.length!==1||l[0]!==n){for(let p of l){let d=r.get(p);d&&s.push(this.Zn(d));}return}let u=r.get(n);u&&s.push(this.Zn(u));}),this.Me=s;}Ru(t,e){let r=e.get(t);return r?.expand?r.expand():[t]}Zn(t){return {id:t.id,label:t.label,icon:t.icon,onClick:a(()=>t.onSelect(),"onClick")}}render(){return y`${this.Me.map(t=>y`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};h([g()],Si.prototype,"Me",2),h([b({type:Boolean,attribute:"wrap",noAccessor:true})],Si.prototype,"wrap",2);var bs=class extends x{static{a(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var Ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function xe(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=n=>s(n);}),image:i,cancel:a(()=>{i.naturalWidth===0&&(i.src=Ot);},"cancel")}}a(xe,"preloadImage");function Ai(o){let i=[];for(let s of o){let n=xe(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:a(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}a(Ai,"batchPreloadImages");function ws(o,i=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let r=new Image,s=new Promise((n,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p);});},r.onerror=c=>{l(c);};});return r.src=URL.createObjectURL(o),s}a(ws,"generateThumb");var Ze=class extends ${constructor(){super(...arguments);this.or=new Set;this.entry=null;}static{a(this,"FileItemConfig");}withEntry(t){return (...e)=>{let r=this.entry;if(!r){console.warn("No entry found");return}return t(r,...e)}}subEntry(t,e){this.withEntry((r,s,n)=>{let l=r.subscribe(s,c=>{this.isConnected&&n(c);});this.or.add(l);})(t,e);}reset(){for(let t of this.or)t();this.or=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.or=new Set;}};function Yu(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}a(Yu,"createSvgBlobUrl");function Zr(o="hsl(209, 21%, 65%)",i=32,t=32){return Yu(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}a(Zr,"fileCssBg");var Xu=3e3,Ye=class extends Ze{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Le="";this.Yn=false;this.sr=null;this.Xn=false;this.Uu=this.cfg.filesViewMode;this.Qn=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.$u(e);if(r&&s&&n){let p=await this.proxyUrl(Z(te(this.cfg.cdnCname,n),ot(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=xe(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let f=t.getValue("file");if(!f)return;let m=await ws(f,c);t.setValue("thumbUrl",m);}catch(f){this.telemetryManager.sendEventError(f,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(m));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await ws(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(p));}});this.nr=D(this.Qn.bind(this),100);}static{a(this,"Thumb");}$u(t=false){t&&(this.sr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.sr?.height||0),10),parseInt(String(this?.sr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,Xu)}Du(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let l=a(()=>{n&&(n.onload=null,n.onerror=null,n.src=Ot,e?.removeEventListener("abort",c),n=null);},"cleanup"),c=a(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=a(()=>{l(),r();},"resolveSafe"),p=a(d=>{l(),s(d);},"rejectSafe");if(typeof n.decode=="function"){n.src=t,n.decode().then(u).catch(p);return}n.onload=u,n.onerror=p,n.src=t;})}Oo(){this.Io?.cancel(),this.Io=void 0;}Fu(t){if(this.Oo(),!t){this.Le&&(this.Le="");return}if(t===this.Le)return;let e=new AbortController,r={controller:e,cancel:a(()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);},"cancel")};this.Io=r,this.Du(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Le=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}ar(t=false){if(this.entry){if(t){this.Qn(true);return}this.Xn&&this.nr();}}firstUpdated(t){super.firstUpdated(t),this.Jn();}updated(t){super.updated(t),t.has("uid")&&this.Jn();}ni(t){let[e]=t;e&&(this.Xn=e.isIntersecting,e.isIntersecting&&(this.sr=e.boundingClientRect,this.ar(),this.s?.disconnect()),e.intersectionRatio===0&&this.nr.cancel());}reset(){super.reset(),this.nr.cancel(),this.Oo(),this.Le&&(this.Le="");}Jn(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let r=a(()=>{this.ar();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.Fu(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.ar(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.Yn&&(this.Uu==="list"&&this.ar(true),this.Yn=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.nr.cancel(),this.Oo(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Le||Ot} role="img" alt="Preview of uploaded image" ?hidden=${!this.Le} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],Ye.prototype,"badgeIcon",2),h([b({attribute:false})],Ye.prototype,"uid",2),h([g()],Ye.prototype,"Le",2);var Ts=class extends S{static{a(this,"ActivityHeader");}};var Es=class extends S{constructor(){super(...arguments);this.historyTracked=true;this.activityType=S.activities.START_FROM;}static{a(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var Cs=class extends ${constructor(){super(...arguments);this.ea=null;}static{a(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=I;}initCallback(){super.initCallback(),this.ea=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ea?.();}};var Xe=a((o,i)=>{let t=false,e,r=0,s=a(((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...n),r=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:a(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var La=a((o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},"u"),ki=vt(class extends Ct{constructor(o){if(super(o),o.type!==Dt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],n=0;for(let l of o)r[n]=e?e(l,n):n,s[n]=t(l,n),n++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=Oa(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let l=this.ut??=[],c=[],u,p,d=0,f=r.length-1,m=0,v=s.length-1;for(;d<=f&&m<=v;)if(r[d]===null)d++;else if(r[f]===null)f--;else if(l[d]===n[m])c[m]=ce(r[d],s[m]),d++,m++;else if(l[f]===n[v])c[v]=ce(r[f],s[v]),f--,v--;else if(l[d]===n[v])c[v]=ce(r[d],s[v]),je(o,c[v+1],r[d]),d++,v--;else if(l[f]===n[m])c[m]=ce(r[f],s[m]),je(o,r[d],r[f]),f--,m++;else if(u===void 0&&(u=La(n,m,v),p=La(l,d,f)),u.has(l[d]))if(u.has(l[f])){let w=p.get(n[m]),T=w!==void 0?r[w]:null;if(T===null){let C=je(o,r[d]);ce(C,s[m]),c[m]=C;}else c[m]=ce(T,s[m]),je(o,r[d],T),r[w]=null;m++;}else jr(r[f]),f--;else jr(r[d]),d++;for(;m<=v;){let w=je(o,c[v+1]);ce(w,s[m]),c[m++]=w;}for(;d<=f;){let w=r[d++];w!==null&&jr(w);}return this.ut=n,Ia(o,c),rt}});var Q=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),q=class q extends Ze{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ta=true;this.uid="";this.Po="";this.Lo="";this.Ro="";this.oe=0;this.ia=false;this.Uo="";this.ra=false;this.oa=false;this.sa=false;this.na=false;this.lr=false;this.aa="";this.cr=[];this.la=false;this.Nu=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Vu=()=>{this.ca();};this.S=D(()=>this.ua(),100);this.Bu=this.withEntry(Xe((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),l=e===Q.FINISHED,c=e===Q.UPLOADING,u=e===Q.QUEUED_UPLOADING,p=e===Q.QUEUED_VALIDATION,d=e===Q.VALIDATION,f=t.getValue("fileName"),m="";r?m="":!l&&n&&s&&Object.values(dt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${sa(s)}`)})),this.Ro=m,this.Lo=r,this.ia=c||u||p||d,this.oe=p||d?0:t.getValue("uploadProgress"),this.aa=f?this.l10n("a11y-file-item-status",{fileName:f,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.ca=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.S();try{let r=new AbortController;t.setValue("abortController",r);let s=a(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File||l instanceof Blob){let f=(this.i.pluginManager?.snapshot().fileHooks??[]).filter(m=>m.type==="beforeUpload");for(let m of f)try{let v=m.handler({file:l,signal:r.signal}),w=new Promise((C,E)=>setTimeout(()=>E(new Error("beforeUpload hook timed out")),m.timeout)),{file:T}=await Promise.race([v,w]);T!==l&&(l=T,t.setValue("mimeType",l.type||null),t.setValue("isImage",$e(l)),t.setValue("fileSize",l.size),l instanceof File&&t.setValue("fileName",l.name));}catch(v){console.warn(`File hook "beforeUpload" from plugin "${m.pluginId}" failed`,v);}}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:a(d=>{if(d.isComputable){let f=d.value*100;t.setValue("uploadProgress",f);}},"onProgress"),signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),Bo(c,p)},"uploadTask"),n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.S();}catch(r){let s=r instanceof ie&&r.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof ye?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:r}):(console.error("Unknown upload error",r),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:r})})),t===this.entry&&this.S(),this.isConnected&&!s&&this.telemetryManager.sendEventError(r,"file upload. Failed to upload file");}}});}static{a(this,"FileItem");}ua(){let t=this.entry;if(!t)return;let e=Q.IDLE;t.getValue("errors").length>0?e=Q.FAILED:t.getValue("isQueuedForUploading")?e=Q.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=Q.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=Q.VALIDATION:t.getValue("isUploading")?e=Q.UPLOADING:t.getValue("fileInfo")&&(e=Q.FINISHED),this._u(t,e);}_u(t,e){e===Q.FAILED?this.Uo="badge-error":e===Q.FINISHED&&(this.Uo="badge-success"),e===Q.UPLOADING&&(this.na=false,this.removeAttribute("focused")),this.oa=e===Q.FAILED,this.sa=e===Q.UPLOADING,this.ra=e===Q.FINISHED,this.Bu(e);}reset(){super.reset(),this.S.cancel();}ni(t){let[e]=t;e&&e.isIntersecting&&!this.la&&(this.ta=false,this.la=true);}da(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.Ye();return}this.subEntry("isQueuedForValidation",()=>{this.S();}),this.subEntry("isValidationPending",()=>{this.S();}),this.subEntry("uploadProgress",()=>{this.S();}),this.subEntry("isQueuedForUploading",()=>{this.S();}),this.subEntry("fileName",r=>{this.Po=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.Po=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.S();}),this.subEntry("errors",()=>this.S()),this.subEntry("isUploading",()=>this.S()),this.subEntry("fileSize",()=>this.S()),this.subEntry("mimeType",()=>this.S()),this.subEntry("isImage",()=>this.S()),this.subEntry("fileInfo",()=>this.Ye()),this.subEntry("isUploading",()=>this.Ye()),this.subEntry("errors",()=>this.Ye()),this.ua(),this.Ye();}pa(t){if(this.cfg.filesViewMode==="list"){this.lr=true;return}this.lr=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.da(this.uid);}Ye(){let t=this.i.pluginManager;if(!t||!this.uid){this.cr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.cr=[];return}this.cr=e.filter(s=>{try{return s.shouldRender(r)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}zu(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e)try{t.onClick(e);}catch(r){console.error(`Error in plugin file action onClick (${t.id}):`,r);}}initCallback(){super.initCallback(),this.da(this.uid),this.subConfigValue("filesViewMode",e=>{this.pa(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.pa(e);}),this.onclick=()=>{q.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused");});},this.sub("*uploadTrigger",e=>{this.entry&&!e.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.ca());});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Ye())),this.Ye(),q.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback(),this.s?.disconnect(),q.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.ta?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.ra} ?data-uploading=${this.sa} ?data-failed=${this.oa} ?data-focused=${this.na} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.Uo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.aa}><span class="uc-file-name" ?hidden=${!this.lr}>${this.Po}</span><span class="uc-file-error" ?hidden=${!this.Lo}>${this.Lo}</span><span class="uc-file-hint" ?hidden=${!this.Ro}>${this.Ro}</span></div><div class="uc-file-actions">${this.cr.map(t=>y`<button type="button" @click=${()=>this.zu(t)} title=${this.l10n(t.label)} aria-label=${this.l10n(t.label)} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${t.id} ><uc-icon name=${t.icon}></uc-icon></button>`)}<button type="button" @click=${this.Nu} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Vu}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.oe} .visible=${this.ia} ?hasFileName=${this.lr}></uc-progress-bar></div>`}};h([g()],q.prototype,"ta",2),h([b({attribute:false})],q.prototype,"uid",2),h([g()],q.prototype,"Po",2),h([g()],q.prototype,"Lo",2),h([g()],q.prototype,"Ro",2),h([g()],q.prototype,"oe",2),h([g()],q.prototype,"ia",2),h([g()],q.prototype,"Uo",2),h([g()],q.prototype,"ra",2),h([g()],q.prototype,"oa",2),h([g()],q.prototype,"sa",2),h([g()],q.prototype,"na",2),h([g()],q.prototype,"lr",2),h([g()],q.prototype,"aa",2),h([g()],q.prototype,"cr",2);var xs=q;function Qu(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=a(r=>{r.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}a(Qu,"checkIsDirectory");function Ju(o,i){return new Promise(t=>{let e=0,r=[],s=a(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(r);})):l.isDirectory&&n(l.createReader());},"readEntry"),n=a(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(r);});},"readReaderContent");s(o);})}a(Ju,"readEntryContentAsync");function Ua(o){let i=[],t=[];for(let e=0;e<o.items.length;e++){let r=o.items[e];if(r)if(r.kind==="file"){let s=r.type,n=r;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let c=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();c&&t.push(Ju(c,s).then(u=>{u&&i.push(...u);}));continue}let l=r.getAsFile();l&&t.push(Qu(l).then(c=>{c||i.push({type:"file",file:l});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}a(Ua,"getDropItems");var at=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Ra=["focus"],td=100,Ss=new Map;function ed(o,i){let t=Math.max(Math.min(o[0],i.x+i.width),i.x),e=Math.max(Math.min(o[1],i.y+i.height),i.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}a(ed,"distance");function As(o){let i=0,t=document.body,e=new Set,r=a(v=>{e.add(v);},"handleSwitch"),s=at.INACTIVE,n=a(v=>{o.shouldIgnore()&&v!==at.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=a(()=>i>0,"isDragging");r(v=>o.onChange(v));let c=a(()=>{i=0,n(at.INACTIVE);},"onResetEvent"),u=a(()=>{i+=1,s===at.INACTIVE&&n(at.ACTIVE);},"onDragEnter"),p=a(()=>{i-=1,l()||n(at.INACTIVE);},"onDragLeave"),d=a(v=>{v.preventDefault(),i=0,n(at.INACTIVE);},"onDrop"),f=a(v=>{if(o.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],T=o.element.getBoundingClientRect(),C=Math.floor(ed(w,T)),E=C<td,k=v.composedPath().includes(o.element);Ss.set(o.element,C);let Tt=Math.min(...Ss.values())===C;k&&Tt?(v.preventDefault(),n(at.OVER)):n(E&&Tt?at.NEAR:at.ACTIVE);},"onDragOver"),m=a(async v=>{if(o.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let T=await Ua(w);o.onItems(T),n(at.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),o.element.addEventListener("drop",m),Ra.forEach(v=>{window.addEventListener(v,c);}),()=>{Ss.delete(o.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),o.element.removeEventListener("drop",m),Ra.forEach(v=>{window.removeEventListener(v,c);});}}a(As,"addDropzone");var ks=new Set,pt=class extends ${constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.Ie=true;this.ha=true;this.$o="drop-files-here";this.fa=false;this.ga=null;this.Do=null;this.va=A();this.Lt=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.ya=true;this.Rt=false;}static{a(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}ma(){let t=this.text;if(typeof t=="string"&&t.length>0){this.$o=this.l10n(t)||t;return}this.$o=this.fa?this.l10n("drop-files-here"):this.l10n("drop-file-here");}isActive(){if(!this.Ie)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&r}initCallback(){super.initCallback(),ks.add(this),this.Fo(),this.No(),this.ba(),this.wa(at.INACTIVE),this.ga=As({element:this,shouldIgnore:a(()=>this.Ta(),"shouldIgnore"),onChange:a(t=>{this.wa(t);},"onChange"),onItems:a(t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:_.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:_.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.set$({"*currentActivity":S.activities.UPLOAD_LIST}),this.modalManager?.open(S.activities.UPLOAD_LIST)));},"onItems")}),this.updateComplete.then(()=>this.Hu()),this.subConfigValue("sourceList",t=>{let e=Y(t);this.ya=e.includes(_.LOCAL),this.Fo(),this.No();}),this.subConfigValue("multiple",t=>{this.fa=!!t,this.ma();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Fo(),this.No()),(t.has("text")||t.has("localeId"))&&this.ma();}updated(t){super.updated(t),t.has("clickable")&&this.ba();}Ta(){if(!this.Ie||!this.Ku())return true;if(!this.fullscreen)return false;let t=ks;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}Ku(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Fo(){let t=this.ya&&!this.disabled;this.Ie=t;}No(){let t=this.Ie||!this.querySelector("[data-default-slot]");this.ha=t,this.hidden=!t;}wa(t){let e=Object.entries(at).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}Hu(){if(this.Do)return;let t=this.va.value;t&&(this.Do=As({element:t,onChange:a(e=>{let r=Object.entries(at).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},"onChange"),onItems:a(()=>{},"onItems"),shouldIgnore:a(()=>this.Ta(),"shouldIgnore")}));}ba(){this.clickable&&!this.Rt?(this.addEventListener("keydown",this.Lt),this.addEventListener("click",this.Lt),this.Rt=true):!this.clickable&&this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}disconnectedCallback(){super.disconnectedCallback(),ks.delete(this),this.ga?.(),this.Do?.(),this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${P(this.va)} class="uc-content-wrapper" ?hidden=${!this.ha}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.$o}</span></div>`)} `}};h([b({type:Boolean,noAccessor:true})],pt.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],pt.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],pt.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],pt.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],pt.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],pt.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],pt.prototype,"initflow",2),h([b({type:String})],pt.prototype,"text",2),h([g()],pt.prototype,"Ie",2),h([g()],pt.prototype,"ha",2),h([g()],pt.prototype,"$o",2);var Pt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=S.activities.UPLOAD_LIST;this.Ea=false;this.xa=false;this.Ca=false;this.Vo=false;this._o=false;this.ur=null;this.Sa=false;this.Bo=null;this.Aa=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.zo=()=>{this.emit(I.UPLOAD_CLICK),this.api.uploadAll(),this.Te();};this.Ho=()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ee=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Te=Xe(()=>{this.isConnected&&(this.qu(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{a(this,"UploadList");}get ju(){return this.Bo?this.Gu(this.Bo):""}qu(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(m=>m.isValidationPending).length},r=!t.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=t.errors.some(m=>m.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(m=>m.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&c&&this.cfg.confirmUpload)u=true;else {p=true;let m=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&r&&c&&m;}this.Ea=p,this.xa=d,this.Ca=u,this._o=e.total===0||!s&&!n,this.Vo=!n||this.cfg.multiple,this.Sa=e.total>0,this.Bo=e;}Gu(t){let e=a(r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Te),this.subConfigValue("multipleMin",this.Te),this.subConfigValue("multipleMax",this.Te),this.sub("*groupInfo",t=>{t&&this.Te();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.Te),this.uploadCollection.observeCollection(this.Te),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.ur=null;return}this.ur=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Te),this.uploadCollection.unobserveCollection(this.Te));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.ju}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Sa}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${ki(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Aa} ?disabled=${!this._o} ?hidden=${!this.Vo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.ur} >${this.ur??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.Vo} ?disabled=${!this._o} @click=${this.Aa} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.Ca} @click=${this.zo} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Ea} ?disabled=${!this.xa} @click=${this.Ho} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Pt.prototype,"Ea",2),h([g()],Pt.prototype,"xa",2),h([g()],Pt.prototype,"Ca",2),h([g()],Pt.prototype,"Vo",2),h([g()],Pt.prototype,"_o",2),h([g()],Pt.prototype,"ur",2),h([g()],Pt.prototype,"Sa",2),h([g()],Pt.prototype,"Bo",2);var id=[{test:a(o=>!!o.accept&&!!o.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:a(o=>o.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:a(o=>o.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],$a=D(o=>{for(let{test:i,message:t}of id)i(o)&&Fr(t);},0);var Da=a((o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),rd="0123456789abcdefghijklmnopqrstuvwxyz",Fa=a(o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=rd[Number(t)]+i,o=o/36n;}return i},"a"),Ms=a((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var od=a(async o=>{let i=new TextEncoder().encode(o),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),sd=10,nd=a(async o=>{let i=await od(o);return Fa(i).slice(0,sd)},"d"),Va=a(async(o,i)=>{let t=await nd(o);return Da(t,i)},"f");var Na=a(o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function"),"isPromiseLike");var Is=a(o=>o,"defineComputedProperty"),ad=[Is({key:"cameraModes",deps:["enableVideoRecording"],fn:a(({cameraModes:o,enableVideoRecording:i})=>{let t=i();if(t===null)return o();let e=j(o());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(r=>r!=="video")),Kt(e)},"fn")}),Is({key:"cameraModes",deps:["defaultCameraMode"],fn:a(({cameraModes:o,defaultCameraMode:i})=>{let t=i();if(t===null)return o();let e=j(o());return e=e.sort((r,s)=>r===t?-1:s===t?1:0),Kt(e)},"fn")}),Is({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:a(({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===hi||Ms(r,s))?Va(e,s):r},"fn")})],_a=a(({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of ad){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let c of r.deps)s[c]=()=>t(c);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let l;try{l=r.fn(s,{signal:n.signal});}catch(c){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,c);return}Na(l)?l.then(c=>{n.signal.aborted||i(r.key,c);}).catch(c=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,c);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,l);}},"computeProperty");var N=a(o=>String(o),"asString"),et=a(o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},"asNumber"),B=a(o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},"asBoolean"),za=a(o=>o==="auto"?o:B(o),"asStore"),Ba=a(o=>{let i=N(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),Ha=a(o=>{let i=N(o);if(!Object.values(L).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),Ka=a(o=>{let i=N(o),t=j(i);if(t.some(e=>!Object.values(L).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),ja=a(o=>{let i=N(o);if(i==="local"||i==="global")return i;if(B(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},"asPasteScope"),Ga=a(o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Os=a(o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},"asObject"),Yr=a(o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},"asFunction"),Xr=a(o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},"asArray"),qa=a(o=>{let i=N(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode");var ld={pubkey:N,multiple:B,multipleMin:et,multipleMax:et,confirmUpload:B,imgOnly:B,accept:N,externalSourcesPreferredTypes:N,externalSourcesEmbedCss:N,store:za,cameraMirror:B,cameraCapture:Ba,sourceList:N,topLevelOrigin:N,maxLocalFileSizeBytes:et,thumbSize:et,showEmptyList:B,useLocalImageEditor:B,useCloudImageEditor:B,cloudImageEditorTabs:N,removeCopyright:B,cropPreset:N,imageShrink:N,modalScrollLock:B,modalBackdropStrokes:B,sourceListWrap:B,remoteTabSessionKey:N,cdnCname:N,cdnCnamePrefixed:N,baseUrl:N,socialBaseUrl:N,secureSignature:N,secureExpire:N,secureDeliveryProxy:N,retryThrottledRequestMaxTimes:et,retryNetworkErrorMaxTimes:et,multipartMinFileSize:et,multipartChunkSize:et,maxConcurrentRequests:et,multipartMaxConcurrentRequests:et,multipartMaxAttempts:et,checkForUrlDuplicates:B,saveUrlForRecurrentUploads:B,groupOutput:B,userAgentIntegration:N,debug:B,localeName:N,metadata:Ga,secureUploadsExpireThreshold:et,localeDefinitionOverride:a(o=>Os(o),"localeDefinitionOverride"),secureUploadsSignatureResolver:a(o=>Yr(o),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:a(o=>Yr(o),"secureDeliveryProxyUrlResolver"),iconHrefResolver:a(o=>Yr(o),"iconHrefResolver"),plugins:a(o=>Xr(o),"plugins"),fileValidators:Xr,collectionValidators:Xr,validationTimeout:et,validationConcurrency:et,cameraModes:Ka,defaultCameraMode:Ha,enableAudioRecording:B,enableVideoRecording:B,mediaRecorderOptions:Os,maxVideoRecordingDuration:et,filesViewMode:qa,gridShowFileNames:B,cloudImageEditorAutoOpen:B,cloudImageEditorMaskHref:N,testMode:B,qualityInsights:B,pasteScope:ja},Wa=a((o,i)=>{if(!(typeof i>"u"||i===null))try{return ld[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),tt[o]}},"normalizeConfigValue");var Qr=[...new Set(["debug",...Object.keys(tt)])],cd=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Ya=a(o=>cd.includes(o),"isComplexKey"),Ls=Qr.filter(o=>!Ya(o)),Ps={...Object.fromEntries(Ls.map(o=>[ur(o),o])),...Object.fromEntries(Ls.map(o=>[o.toLowerCase(),o]))},Za=a(o=>`__${o}`,"getLocalPropName"),Qe=class extends x{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(tt).map(([t,e])=>[M(t),e]))};this.Wu=new Map;this.li={};this.ka=new Set;this.Ut=new Map;}static{a(this,"Config");}Ko(t){return this.ka.has(t)}jo(t){let e=this.i.pluginManager;if(e)return e.configRegistry.get(t)}Ma(t){return [...new Set([ur(t),t.toLowerCase()])]}Zu(t,e){if(Ya(t)||this.Ko(t)&&this.jo(t)?.attribute===false)return;let r=this.Ma(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}Yu(t,e){let r=M(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=tt[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}Xe(t,e){let r;if(this.Ko(t)){let l=this.jo(t);try{r=l?.normalize?.(e)??e;}catch(c){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,c);return}}else r=Wa(t,e);let s=this,n=Za(t);s[n]!==r&&(this.Xu(t,s[n],r),s[n]=r,this.Zu(t,r),this.Yu(t,r),this.debugPrint(`"${t}"`,r),this.Ko(t)||$a(this.cfg));}pr(t){let e=this,r=Za(t);return e[r]??this.$[M(t)]}Xu(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r));}Ia(t){let e=t.configRegistry.getAll();this.li={},this.ka=new Set(e.keys());for(let[r,s]of this.Ut)e.has(r)||(s(),this.Ut.delete(r));for(let[r,s]of e){let l=M(r);if(s.attribute){let u=this.Ma(r);for(let p of u)this.li[p]=r;}this.sharedCtx.has(l)||this.sharedCtx.add(l,s.defaultValue);let c=Object.getOwnPropertyDescriptor(this,r);if((!c||!c.set||!c.get)&&Object.defineProperty(this,r,{set:a(u=>{this.Xe(r,u);},"set"),get:a(()=>this.pr(r),"get"),enumerable:true,configurable:true}),!this.Ut.has(r)){let u=this.sub(l,p=>{this.Xe(r,p);},false);this.Ut.set(r,u);}}}Qu(){this.i.when("pluginManager",t=>{this.Ia(t),this.dr=t.onPluginsChange(()=>{this.Ia(t);});});}Ju(){this.ai=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let r=e.attributeName,s=e.oldValue,n=this.getAttribute(r);if(s===n||r in Ps)continue;if(r in this.li){let c=this.li[r],u=this.jo(c);this.attributeChangedCallback(r,s??"",n??u?.defaultValue??"");}}}),this.ai.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Qu(),this.Ju();for(let r of Ls)this.sub(M(r),s=>{this.Xe(r,s);},false);for(let r of Qr){let s=t[r]??this.$[M(r)];s!==tt[r]&&this.Xe(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a(l=>{this.Xe(r,l);},"set"),get:a(()=>this.pr(r),"get")});}let e=a(r=>{_a({key:r,setValue:this.Xe.bind(this),getValue:this.pr.bind(this),computationControllers:this.Wu});},"runComputeProperty");for(let r of Qr)this.sub(M(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ps[t];n?s[n]=r:this.i.when("pluginManager",l=>{let c=this.getAttribute(t);if(c&&c!==r)return;let u=this.li[t],p=u?l.configRegistry.get(u):void 0;if(u&&p){let d=p.fromAttribute?p.fromAttribute(r):r;if(this.pr(u)===d)return;this.Xe(u,d);}});}disconnectedCallback(){super.disconnectedCallback(),this.dr&&(this.dr(),this.dr=void 0),this.ai&&(this.ai.disconnect(),this.ai=void 0);for(let t of this.Ut.values())t();this.Ut.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(Ps);return [...t,...e]}};for(let o of Qr)Qe.prototype[o]=void 0;var Mi=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.ci="upload-file";this.ed=()=>{this.api.initFlow();};}static{a(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.ci=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.ed}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.ci)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Mi.prototype,"dropzone",2),h([g()],Mi.prototype,"ci",2);var Ii=class extends S{constructor(){super(...arguments);this.qo=A();}static{a(this,"PluginActivityHost");}initCallback(){this.activityType=this.registration?.id??null,this.Oa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Oa(),this.isActivityActive&&(this.hr(),this.Pa()));}Oa(){this.registration&&(this.On()||this.registerActivity(this.activityType??"",{onActivate:a(()=>this.Pa(),"onActivate"),onDeactivate:a(()=>this.hr(),"onDeactivate")}));}async Pa(){await this.updateComplete;let t=this.qo.value;if(!t||!this.registration)return;this.hr();let e=this.$["*currentActivityParams"];try{this.Go=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}hr(){let t=this.qo.value;if(t){try{this.Go?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.Go=void 0,t.replaceChildren();}}disconnectedCallback(){this.hr(),super.disconnectedCallback();}render(){return y`<div style="display: flex; flex-direction: column; width: 100%; min-height: 0;" ${P(this.qo)} ></div>`}};h([b({attribute:false})],Ii.prototype,"registration",2);var Je=class extends x{constructor(){super(...arguments);this.mode="modal";this.de=[];}static{a(this,"PluginActivityRenderer");}initCallback(){super.initCallback();let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.La())),this.La();}La(){let t=this.i.pluginManager;if(!t){this.de=[];return}this.de=t.snapshot().activities;}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?y`${ki(this.de,t=>t.id,t=>y`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:y`${ki(this.de,t=>t.id,t=>y`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};h([b({type:String})],Je.prototype,"mode",2),h([g()],Je.prototype,"de",2);function Oi(o,i,t){return o?i(o):t?.(o)}a(Oi,"n");function Xa(...o){return o.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}a(Xa,"normalize");function bt(...o){let i=Xa(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}a(bt,"classNames");function Qa(o,...i){let t=Xa(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}a(Qa,"applyClassNames");var ud=a(o=>st.includes(o),"isTabIdValue"),Ja=a(o=>{if(!o)return st;let i=j(o).filter(ud);return i.length===0?st:i},"parseTabs");function tl(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":st,"*tabId":H.CROP,"*on.retryNetwork":a(()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ot,t.src=e;}o.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":a(i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=ot(ee(i),"preview"),r=Z(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.apply"),"*on.cancel":a(()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}a(tl,"initState");var el="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Se={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ti=class extends x{constructor(){super(...arguments);this.he=false;this.Ra=Se;this.Ua=Se.visible;this.$a=Se.hidden;this.Wo=false;this.Da=false;}static{a(this,"PresenceToggle");}set visible(t){this.he=t,this.Fa();}get visible(){return this.he}set styles(t){this.Ra=t,this.Wo=true,this.Ua=t.visible??Se.visible,this.$a=t.hidden??Se.hidden;}get styles(){return this.Ra}Fa(){this.style.visibility=this.he?"inherit":"hidden",Qa(this,{[Se.transition]:!this.Wo,[this.Ua]:this.he,[this.$a]:!this.he}),this.toggleAttribute("inert",!this.he);}td(){this.Da||(this.Da=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Wo||this.classList.add(Se.transition),this.Fa(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.td();},0);}};h([b({type:Boolean})],ti.prototype,"visible",1),h([b({attribute:false})],ti.prototype,"styles",1);var Pi=class extends x{constructor(){super(...arguments);this.active=false;this.Qe=A();this.Zo=false;this.Yo=()=>{let t=this.Qe.value;t&&(this.Na(t),this.Zo&&this.active&&this.Xo());};}static{a(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.Xo();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Xo():this.rd());}Xo(){let t=this.Qe.value;if(!t)return;this.Zo=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Yo),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Yo,{once:true});}rd(){let t=this.Qe.value;t&&(this.Zo=false,t.removeEventListener("transitionend",this.Yo),this.Na(t));}Na(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${P(this.Qe)}></div></div>`}};h([b({type:Boolean,reflect:true})],Pi.prototype,"active",2);var Lt=vt(class extends Ct{constructor(o){if(super(o),o.type!==Dt.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter(i=>o[i]).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return rt}});var W=a(o=>o??R,"o");var St=class extends x{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{a(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.Va(),this._a();}updated(t){super.updated(t),t.has("reverse")&&this.Va(),t.has("theme")&&this._a();}Va(){this.style.flexDirection=this.reverse?"row-reverse":"";}_a(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get od(){let t=this.Qo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.sd}}get Qo(){return !this.icon}get sd(){return !this.text&&!this.Qo}render(){return y`<button type="button" role=${W(this.ariaRole||void 0)} aria-controls=${W(this.ariaControls||void 0)} aria-label=${W(this.l10n(this.titleProp))} title=${W(this.l10n(this.titleProp))} ><uc-icon class=${Lt(this.od)} name=${W(this.icon||void 0)} ?hidden=${this.Qo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],St.prototype,"text",2),h([b({type:String})],St.prototype,"icon",2),h([b({type:Boolean,reflect:true})],St.prototype,"reverse",2),h([b({type:String,reflect:true})],St.prototype,"theme",2),h([b({attribute:"aria-role"})],St.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],St.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],St.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],St.prototype,"active",2);function il(o,i){let t={};for(let e of i){let r=o[e];(Object.hasOwn(o,e)||r!==void 0)&&(t[e]=r);}return t}a(il,"pick");function ei(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return Z(o,ot(ar,ee(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Rt}/${$t}/uc-cloud-image-editor/`))}a(ei,"viewerImageSrc");var Li=class extends x{constructor(){super(...arguments);this.Ba=`uc-backdrop-mask-${mt.generateFastUid()}`;this.mr=false;this.hi=false;this.Ka=A();this.fi=false;this.mi=null;this.Ga=t=>{this.qa(),this.gi&&(t.stopPropagation(),t.preventDefault(),this.gi=false);};this.Wa=t=>{if(!this.gi||!this.fr||!this.es)return;t.stopPropagation(),t.preventDefault();let e=this.Re;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,l=t.y-s,c=n-this.fr[0],u=l-this.fr[1],{direction:p}=this.es,d=this.fd(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.Za=t=>{if(!this.xe)return;let e=Object.values(this.xe).find(r=>{if(!r||this.rs(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),l={x:n.x,y:n.y,width:n.width,height:n.height};return ga(l,[t.x,t.y])});this.za=e,this.qa();};}static{a(this,"CropFrame");}get Re(){return this.Ka.value??null}get gi(){return this.hi}set gi(t){this.hi!==t&&(this.hi=t,this.ts());}ts(){this.di&&this.di.setAttribute("class",bt({"uc-guides--hidden":this.mr,"uc-guides--visible":!this.mr&&this.hi,"uc-guides--semi-hidden":!this.mr&&!this.hi}));}rs(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=O&&e.width<=O)return true;let r=e.height<=O&&(t.includes("n")||t.includes("s")),s=e.width<=O&&(t.includes("e")||t.includes("w"));return r||s}nd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,l=this.Re;if(!l)return;let c=yt("mask",{id:this.Ba}),u=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=yt("rect",{x:e,y:r,width:s,height:n,fill:"black"});c.appendChild(u),c.appendChild(p);let d=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.Ba})`});l.appendChild(d),l.appendChild(c),this.ui=c,this.Jo=p;}ad(){this.ui&&(this.ui.style.display="none",window.requestAnimationFrame(()=>{this.ui&&(this.ui.style.display="block");}));}ld(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.Jo&&ne(this.Jo,{x:e,y:r,width:s,height:n});}cd(){let t=this.$["*cropBox"];if(!(!t||!this.di||!this.xe)){for(let e of Object.values(this.xe)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:l}=e,c=r==="",u=r.length===2,{x:p,y:d,width:f,height:m}=t;if(c)ne(n,{x:p,y:d,width:f,height:m});else {let w=ae(Math.min(f,m)/82/2,0,1),T=u?da(t,r,w):pa(t,r,w),C=T.center;if(!C)continue;let E=Math.max(ls*ae(Math.min(f,m)/ls/3,0,1),ua);ne(n,{x:C[0]-E,y:C[1]-E,width:E*2,height:E*2}),ne(s,{d:T.d});}let v=this.rs(r);l.setAttribute("class",bt("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}ne(this.di,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}ja(t,e){let r=yt("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=yt("rect",{fill:"transparent"}),n=yt("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.ud.bind(this,e));}dd(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.ja(t,s);}return this.ja(t,""),t}pd(){let t=yt("svg"),e=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let r=1;r<=2;r++){let s=yt("line",{x1:`${wi*r}%`,y1:"0%",x2:`${wi*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=yt("line",{x1:"0%",y1:`${wi*r}%`,x2:"100%",y2:`${wi*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}hd(){let t=this.Re;if(!t)return;let e=document.createDocumentFragment(),r=this.pd();e.appendChild(r);let s=this.dd();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.xe=s,this.di=r,this.ts();}ud(t,e){if(!this.xe)return;let r=this.xe[t];if(!r||this.rs(t))return;let s=this.$["*cropBox"],n=this.Re;if(!n)return;let{x:l,y:c}=n.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.gi=true,this.es=r,this.fr=[u,p],this.Ha={...s};}fd(t,e){let[r,s]=e,n=this.$["*imageBox"],l=this.Ha??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=fa({rect:l,delta:[r,s],imageBox:n}):l=ma({rect:l,delta:[r,s],direction:t,aspectRatio:u,imageBox:n}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return _e(Be(l),n)}qa(){let t=this.za,e=this.Re;e&&(e.style.cursor=t?ha(t.direction):"initial");}Ya(t){if(this.pi){this.pi.setAttribute("href",t);return}let e=this.Re;if(!e){this.mi=t;return}this.mi=null;let r=document.createDocumentFragment(),s=yt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.pi=s;}md(){let t=this.$["*cropBox"];if(!t||!this.pi)return;let{x:e,y:r,width:s,height:n}=t;ne(this.pi,{x:e,y:r,height:n,width:s});}os(){this.fi&&(this.ld(),this.cd(),this.md());}toggleThumbs(t){if(this.xe)for(let e of Object.values(this.xe)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",bt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.ad(),this.fi&&window.requestAnimationFrame(()=>{this.os();});}),this.sub("*cropBox",t=>{t&&(this.mr=t.height<=O||t.width<=O,this.ts(),this.fi&&window.requestAnimationFrame(()=>{this.os();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Ya(t);}),document.addEventListener("pointermove",this.Wa,true),document.addEventListener("pointerup",this.Ga,true);}firstUpdated(t){super.firstUpdated(t),this.gd();}gd(){let t=this.Re;if(!(!t||this.fi)){if(this.nd(),this.hd(),this.fi=true,t.addEventListener("pointermove",this.Za,true),this.mi){let e=this.mi;this.mi=null,this.Ya(e);}this.os();}}disconnectedCallback(){super.disconnectedCallback(),this.Re?.removeEventListener("pointermove",this.Za,true),document.removeEventListener("pointermove",this.Wa,true),document.removeEventListener("pointerup",this.Ga,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${P(this.Ka)}></svg>`}};h([g()],Li.prototype,"hi",2);function pd(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(o)):true}a(pd,"validateCrop");var Ui=class extends x{constructor(){super();this.ctxOwner=true;this.Je={width:0,height:0};this.e=null;this._=false;this.se=null;this.Qa=A();this.ns=A();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.Xa=D(this.Ja.bind(this),300),this.ss=Xe(()=>{!this.isConnected||!this._||(this.as(),this.tl(),this.il(),this.ls(),this.cs());},100);}static{a(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.as();}tl(){let t=this.$["*editorTransformations"],e=il(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}as(){let t=this.Qa.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*n,t.height=s*n,e?.scale(n,n),this.fe=t,this.e=e;}il(){if(!this._||!this.se)return;let t=this.se,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},l=ze({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>n.width-e*2||l.height>n.height-e*2){let u=l.width/l.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,f=d/u,m=0+e,v=e+(n.height-e*2)/2-f/2;c={x:m,y:v,width:d,height:f};}else {let d=n.height-e*2,f=d*u,m=e+(n.width-e*2)/2-f/2,v=0+e;c={x:m,y:v,width:f,height:d};}}else {let{width:u,height:p}=l,d=e+(n.width-e*2)/2-u/2,f=e+(n.height-e*2)/2-p/2;c={x:d,y:f,width:u,height:p};}this.$["*imageBox"]=Be(c);}ls(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(n){let{dimensions:[f,m],coords:[v,w]}=n,{width:T}=ze(this.Je,s),C=l/T;t=_e(Be({x:c+v*C,y:u+w*C,width:f*C,height:m*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!va(t,e)||d&&!ya(t,d)){let f=e.width/e.height,m=e.width,v=e.height;d&&(f>d?m=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-v/2,width:m,height:v};}this.$["*cropBox"]=_e(Be(t),e);}vd(){let t=this.e;if(!t)return;let e=this.se;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:l,rotate:c}=s,u=ze({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}cs(){if(!this._||!this.se||!this.fe||!this.e)return;let t=this.fe;this.e.clearRect(0,0,t.width,t.height),this.vd();}yd({fromViewer:t}){this.se&&(this.ns.value?.toggleThumbs(true),this.bd(),setTimeout(()=>{this.className=bt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}rl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l}=e,{width:c,height:u}=ze(this.Je,s),{width:p,height:d}=t,f=n/c,m=l/u;return [ae(Math.round(p/f),1,c),ae(Math.round(d/m),1,u)]}wd(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l,x:c,y:u}=e,{width:p,height:d}=ze(this.Je,s),{x:f,y:m}=t,v=n/p,w=l/d,T=this.rl(),C={dimensions:T,coords:[ae(Math.round((f-c)/v),0,p-T[0]),ae(Math.round((m-u)/w),0,d-T[1])]};if(!pd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(T[0]===p&&T[1]===d))return C}Ja(){if(!this.isConnected||!this.Je)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.wd(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.il(),this.ls(),this.cs());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.as(),this.Je=t,this.removeEventListener("transitionend",this.ol);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.se=await this.Td(r,s),this.tl(),this.ss(),this.yd({fromViewer:e});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(r=>{let[s]=r;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this._&&this.se&&this.ss();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.Ja(),this._=false,this.Ed(),this.className=bt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.ns.value?.toggleThumbs(false),this.addEventListener("transitionend",this.ol,{once:true}),this.s?.disconnect());}Ed(){let t=this.rl(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-l)/n}px, ${(this.offsetHeight/2-c)/n}px)`,this.style.transformOrigin=`${l}px ${c}px`;}bd(){let t=this.$["*cropBox"],e=t.x+t.width/2,r=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${r}px`;}ol(){this._||(this.se=null);}async Td(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(ei(t,r,e)),{promise:n,cancel:l,image:c}=xe(s),u=this.$t(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,n.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}$t(t){let e="crop",r=this.$["*loadingOperations"],s=r.get(e);return s||(s=new Map,r.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.cs();}),this.sub("*cropBox",()=>{this.se&&this.Xa();}),this.sub("*currentAspectRatio",()=>{this.ls();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.Je&&this.activate(this.Je,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.se&&(this.se=null);}render(){return y`<canvas class="uc-canvas" ${P(this.Qa)}></canvas><uc-crop-frame ${P(this.ns)}></uc-crop-frame>`}};h([g()],Ui.prototype,"se",2);function Us(o,i,t){let e=t,r=t-1,s=new Array(e);for(let n=r;n>=0;n-=1)s[n]=Math.ceil((n*i+(r-n)*o)/r);return s}a(Us,"linspace");function hd(o){return typeof o=="string"&&o in Mt}a(hd,"isOperationKey");function fd(o){let i=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],r=o[t+1];typeof e=="number"&&typeof r=="number"&&i.push([e,r]);}return i}a(fd,"splitBySections");function md(o,i,t){let e=fd(o).find(([n,l])=>n<=i&&i<=l);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let l=Math.abs(r-s)||1,c=Math.abs(i-r)/l;return r===n?i>t?1:1-c:s===n?i>=t?c:1:0})}a(md,"calculateOpacities");function gd(o,i){return o.map((t,e)=>t<i?o.length-e:e)}a(gd,"calculateZIndices");function rl(o,i){let t=Mt[o].keypointsNumber,{range:e,zero:r}=Mt[o];return [...new Set([...Us(e[0],r,t+1),...Us(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}a(rl,"keypointsRange");var Jr=class extends x{constructor(){super();this._=false;this.us=true;this.n="initial";this.sl={};this.Ue=[];this.al=0;this.cl=A();this.gr=A();this.classList.add("uc-inactive_to_cropper"),this.ll=D(async(t,e,r)=>{let s=a(()=>!this.ul(t,e)||this.Pt!==r||!!this.Ue.find(u=>u.value===r),"shouldSkip");if(s())return;let n=await this.dl(t,r),l=new Image;l.src=n.src;let c=this.$t(n.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),n.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.Ue,p=u.findIndex(v=>v.value>r);p===-1&&(p=u.length);let f=u[p]?.image,m=this.gr.value;!m||f&&!m.contains(f)||(u.splice(p,0,n),f?m.insertBefore(l,f):m.appendChild(l),this.hs(t,r));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{a(this,"EditorImageFader");}$t(t){let e=this.n,r=this.$["*loadingOperations"];r.has(e)||r.set(e,new Map);let s=r.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}pl(){window.cancelAnimationFrame(this.al),this.al=window.requestAnimationFrame(()=>{for(let t of this.Ue){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}et({url:t=this.nl,filter:e=this.m??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.sl};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let l=this.offsetWidth;return this.proxyUrl(ei(t,l,n))}async dl(t,e){return {src:await this.et({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}ul(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!hd(this.n)||!Number.isFinite(e)||(this.hs(this.n,e),this.ll(this.n,this.m,e));}hs(t,e){this.n=t,this.Pt=e;let{zero:r}=Mt[t],s=this.Ue.map(c=>c.value),n=md(s,e,r),l=gd(s,r);this.Ue.forEach((c,u)=>{let p=n[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.pl();}hl(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async xd(){this.a=this.a||this.hl();let t=this.a;t&&this.fl(t);let e=this.Ue.map(u=>u.src),{images:r,promise:s,cancel:n}=Ai(e);r.forEach(u=>{let p=this.$t(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.ds=()=>{n(),this.ds=void 0;};let l=this.n,c=this.m;if(await s,this._&&this.ul(l,c)){let u=this.gr.value;if(!u)return;u.replaceChildren(),this.Ue.forEach((p,d)=>{let f=r[d];f&&(f.classList.add("uc-fader-image"),p.image=f,u.appendChild(f));}),this.pl();}}async setTransformations(t){if(this.sl=t,this.a){let e=await this.et(),r=this.$t(e);this.a.src=e,this.a.addEventListener("load",r,{once:true}),this.a.addEventListener("error",r,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:s}){if(!r||typeof s!="number")return;this.ps?.();let n=rl(r,s),l=await Promise.all(n.map(u=>this.et({url:t,filter:e,operation:r,value:u}))),{cancel:c}=Ai(l);this.ps=c;}Cd(t){let e=this.a||this.hl();if(this.fl(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=bt({"uc-active_from_viewer":this.vi,"uc-active_from_cropper":!this.vi,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.$t(t);e.addEventListener("error",r,{once:true}),e.src=t,e.addEventListener("load",()=>{r(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=bt({"uc-active_from_viewer":this.vi,"uc-active_from_cropper":!this.vi,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:r,filter:s,fromViewer:n}){if(this._=true,this.us=false,await this.updateComplete,this.nl=t,this.n=e??"initial",this.Pt=r,this.m=s,this.vi=n,typeof r!="number"&&!s){let c=await this.et({operation:e,value:r});this.Cd(c),this.fs();return}!e||typeof r!="number"||(this.Ue=await Promise.all(rl(e,r).map(c=>this.dl(e,c))),this.hs(e,r),this.xd());}deactivate({hide:t=true}={}){this._=false,this.ds?.(),this.ps?.(),t&&!this.us?(this.us=true,this.a&&(this.a.style.transform="scale(1)"),this.className=bt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.fs();},{once:true})):this.fs();}fl(t){let e=this.cl.value;e&&(e.contains(t)||e.appendChild(t));}fs(){this.gr.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${P(this.cl)}></div><div class="uc-fader-layers-host" ${P(this.gr)}></div>`}};var ol="important",vd=" !"+ol,ke=vt(class extends Ct{constructor(o){if(super(o),o.type!==Dt.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(o,[i]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith(vd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?ol:""):t[e]=r;}}return rt}});var Nt=class extends x{constructor(){super();this.ms=0;this.$e=A();this.gl=A();this.vl=A();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.De=0;this.Ad=t=>{t.stopPropagation();let e=this.yl(t);e!==null&&(this.gs(e),this.Sd("slider-input",e));};this.kd=t=>{t.stopPropagation();let e=this.yl(t);e!==null&&this.gs(e);};this.bl=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.wl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{a(this,"SliderUi");}Sd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.ms=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Tl(this.De),this.vs(),this.s=new ResizeObserver(()=>{this.vs(),this.vr(this.De);}),this.s.observe(this);let e=this.$e.value;e?.addEventListener("focus",this.bl),e?.addEventListener("blur",this.wl),window.setTimeout(()=>{this.vr(this.De);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.De&&this.gs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.vs(),this.vr(this.De)),t.has("zero")&&this.hasUpdated&&this.El(this.De);}vr(t){this.El(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(r-this.ms)/100;window.requestAnimationFrame(()=>{let c=this.gl.value;c&&(c.style.transform=`translateX(${l}px)`);});}El(t){if(!this.yi)return;let e=this.max-this.min;if(e===0)return;this.yi.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(r-this.ms)/100;window.requestAnimationFrame(()=>{this.yi&&(this.yi.style.transform=`translateX(${l}px)`);});}vs(){let e=this.vl.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.ml===n)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.yi=p,e.innerHTML="",e.appendChild(l),this.ml=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.$e.value;t?.removeEventListener("focus",this.bl),t?.removeEventListener("blur",this.wl),this.s?.disconnect(),this.s=void 0;}gs(t){Number.isFinite(t)&&(this.De=t,this.hasUpdated&&(this.Tl(t),this.vr(t)));}Tl(t){let e=this.$e.value;e&&(e.value=String(t));}yl(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return y`<div class="uc-steps" ${P(this.vl)}></div><div class="uc-thumb" ${P(this.gl)}></div><input class="uc-input" type="range" ${P(this.$e)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.De)} ?disabled=${this.disabled} @input=${this.Ad} @change=${this.kd} />`}};h([b({type:Boolean,reflect:true})],Nt.prototype,"disabled",2),h([b({type:Number})],Nt.prototype,"min",2),h([b({type:Number})],Nt.prototype,"max",2),h([b({type:Number,attribute:false})],Nt.prototype,"defaultValue",2),h([b({type:Number})],Nt.prototype,"zero",2),h([g()],Nt.prototype,"De",2);var _t="original",Ri=class extends x{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.ys=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{a(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.Md();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===_t?void 0:this.state.value,filter:this.state.filter===_t?void 0:this.state.filter,fromViewer:false});}Md(){let t=this.state.operation,{range:e,zero:r}=Mt[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),d=c;if(d){let{name:f,amount:m}=d;p=f===this.state.filter?m:n;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:r;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===_t?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return y`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.ys} ></uc-slider-ui>`}};h([g()],Ri.prototype,"state",2);function ii(o){if(!o)return null;let i=o.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}a(ii,"parseFilterValue");var lt=class extends x{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{a(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}xl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.xl();}updated(t){super.updated(t),t.has("active")&&this.xl();}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],lt.prototype,"active",2),h([g()],lt.prototype,"title",2),h([g()],lt.prototype,"icon",2),h([g()],lt.prototype,"titleProp",2);var to=12,eo=16,yd=a(o=>{let i=12,t=12;return o.width/o.height>=1?(i=to,t=Math.round(to*o.height/o.width)):(t=to,i=Math.round(to*o.width/o.height)),{width:i,height:t}},"getAdjustResolutions"),io=class extends lt{static{a(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.Id(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}Id(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return y`<button role="option" type="button" class=${Lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},$i=class extends lt{constructor(){super(...arguments);this.X=null;}static{a(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.X}set aspectRatio(t){if(this.X===t)return;let e=this.X;this.X=t,this.requestUpdate("aspectRatio",e),t?this.Cl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.X&&this.Cl(this.X),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.X?.id||t?.width===this.X?.width&&t?.height===this.X?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.X?.id&&(this.$["*currentAspectRatio"]=this.X);}Cl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=a(()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},"resolveTitle"),s=a(()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n},"resolveTitleProp");r(),s(),e||this.requestUpdate();}Od(){let t=this.X;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=yd(t),s=(eo-e)/2,n=(eo-r)/2;return y`<uc-icon><svg viewBox="0 0 ${eo} ${eo}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${r} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" class=${Lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} >${this.Od()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],$i.prototype,"aspectRatio",1);function bd(o){let i=o+90;return i=i>=360?0:i,i}a(bd,"nextAngle");function wd(o,i){if(o==="rotate")return bd(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}a(wd,"nextValue");var Di=class extends lt{constructor(){super(...arguments);this.operation=void 0;}static{a(this,"EditorCropButtonControl");}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],r=e.getValue(this.operation),s=wd(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};h([b({type:String})],Di.prototype,"operation",2);var Xt=class extends lt{constructor(){super(...arguments);this.n="";this.m="";this.bi="";this.yr=0;this.a=null;this.Ft=false;this.isOriginal=false;this.Sl=20;}static{a(this,"EditorFilterControl");}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let r=this.m;this.m=e,this.n="filter",this.isOriginal=e===_t,this.icon=this.isOriginal?"original":"slider",this.Sl=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.Al(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.m),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.m),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ii(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}Pd(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Sl||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.m!==_t?{name:this.m,amount:l}:void 0,Z(this.bi,ot(ar,ee(c),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Rt}/${$t}/uc-cloud-image-editor/`))}async ni(t,e){t[0]?.isIntersecting?await this.bs(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.ni.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.bi=t??"",this.sub("*originalUrl",e=>{this.bi=e??"",!this.isOriginal&&this.bi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.tt());}),this.isOriginal||(this.s?.observe(this),this.tt()),this.m&&this.Al(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.bs():this.tt());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.br();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.tt()));}Al(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async bs(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.bi){!this.Dt&&!this.Fe&&this.tt();return}let e=++this.yr,r="";try{r=await this.proxyUrl(this.Pd());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.Ft=false,this.b?.();let{promise:s,cancel:n}=xe(r);this.b=()=>{n(),this.yr===e&&(this.b=void 0);};try{if(await s,this.yr!==e||!this.isConnected)return;this.a=r,this.Ft=!0,this.br(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.tt();}finally{this.yr===e&&(this.b=void 0);}}tt(){if(!this.isConnected||this.a||this.Ft||this.isOriginal||this.$["*networkProblems"]){this.br();return}this.Fe&&cancelAnimationFrame(this.Fe),this.Fe=requestAnimationFrame(()=>{if(this.Fe=void 0,!this.isConnected||this.a||this.Ft||this.isOriginal){this.br();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<r){this.bs();return}this.Dt=window.setTimeout(()=>{this.Dt=void 0,this.tt();},500);});}br(){this.Fe&&(cancelAnimationFrame(this.Fe),this.Fe=void 0),this.Dt&&(window.clearTimeout(this.Dt),this.Dt=void 0);}get Ld(){return !!(this.Ft&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Ld?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return y`<button role="option" type="button" class=${Lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Ft} style=${ke(e)}></div><uc-icon class=${Lt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${ke(r)} ></uc-icon></button>`}};h([g()],Xt.prototype,"a",2),h([g()],Xt.prototype,"Ft",2),h([g()],Xt.prototype,"isOriginal",2),h([g()],Xt.prototype,"Sl",2),h([b({type:String})],Xt.prototype,"filter",1);var Fi=class extends lt{constructor(){super(...arguments);this.n="";}static{a(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),this.isConnected&&e&&this.kl(e);}kl(t){this.icon=t;let e=a(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),r=a(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),r();}initCallback(){super.initCallback(),this.n&&this.kl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=Mt[this.n],r=t[this.n],s=typeof r<"u"?r!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ii(this.$["*operationTooltip"])});}};h([b({type:String})],Fi.prototype,"operation",1);var Td=1,sl=a(()=>{},"noopScrollListener"),Vi=class extends x{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Ml=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Td){this.scrollLeft+=r;return}this.scrollLeft+=e;};}static{a(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Ml,{passive:false}),this.addEventListener("scroll",sl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Ml),this.removeEventListener("scroll",sl),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Vi.prototype,"hiddenScrollbar",2);var ht=class extends x{constructor(){super(...arguments);this.wi=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Il=true;this.tabList=[...st];this.activeTab=H.CROP;this.wr=true;this.Ts=false;this.Ol=null;this.Pl=0;this.Ll=0;this.Tr=A();this.Rl=A();this.tabToggleRefs={[H.CROP]:A(),[H.TUNING]:A(),[H.FILTERS]:A()};this.Ul=()=>{this.ot();};this.Ti=[];this.Er=D(t=>{this.wi=t;},500);this.xr=D(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===H.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(_t);else if(this.showSubToolbar&&this.$["*tabId"]===H.TUNING&&e){s=true;let n=t?.[e]||Mt[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Ts=s;},0);this.Rd={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Ud={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.$d={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Dd={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":_t,"*currentOperation":null,"*operationTooltip":null};this.Ee=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.Ss=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.qd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ii(this.$["*operationTooltip"])}),this.Tr.value?.apply(),this.$l();};this.Wd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Tr.value?.cancel(),this.$l();};this.Zd=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Es(r,{fromViewer:false}));};}static{a(this,"EditorToolbar");}$l(){this.$["*showSlider"]=false,this.$["*tabId"]===H.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===H.TUNING&&(this.Ts=false);}Es(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Dl(t,{fromViewer:e,force:r});}Dl(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.ot();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===H.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let l of st){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.ot();}}ot(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Rl.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Pl!==s||this.Ll!==n)&&(this.Pl=s,this.Ll=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get xs(){return this.Ti.length>=3}Fd(t){switch(t){case H.CROP:return this.Nd();case H.FILTERS:return this.Vd();case H.TUNING:return this._d();default:return []}}Nd(){let t=[];if(this.xs)t.push(()=>this.Bd());else for(let e of this.Ti)t.push(()=>this.Fl(e));for(let e of wn)t.push(()=>this.zd(e));return this.Cs(t)}Vd(){let e=[_t,...bn].map(r=>()=>this.Hd(r));return this.Cs(e)}_d(){let t=yn.map(e=>()=>this.Kd(e));return this.Cs(t)}Cs(t){return t.length?t.map(r=>r()):[]}Bd(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Fl(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}zd(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Hd(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Kd(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}jd(){return this.xs?this.Ti.map(t=>this.Fl(t)):[]}async Gd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ei(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=Ai([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Ti=[...t],this.sub("*cropPresetList",e=>{this.Ti=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Es(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.xr();}),this.sub("*currentOperation",()=>{this.xr();}),this.sub("*tabId",e=>{this.Dl(e,{fromViewer:false,force:true}),this.xr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Gd(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,n]of s.entries())if(n){r=true;break}}this.Er(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.wr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.wr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Il=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Es(r,{fromViewer:false});return}this.ot();}),this.sub("*operationTooltip",e=>{this.Ol=e;}),this.xr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Ul);}firstUpdated(t){super.firstUpdated(t),this.Cr(),this.ot();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ot()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Cr();}disconnectedCallback(){window.removeEventListener("resize",this.Ul),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Cr(){let t=this.Tr.value;t&&(this.$["*sliderEl"]=t);}Yd(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?ke({gridColumn:`${s+1}`}):R;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.$d}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${r?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${r} style=${n} @click=${this.Zd} ${P(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Xd(t){let e=this.Fd(t);return y`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:R}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Ts?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.xs;return y`<uc-line-loader-ui .active=${this.wi}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Ol??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Rd} ><div class="uc-tab-content-row">${st.map(r=>Oi(this.activeTab===r,()=>this.Xd(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Il} .styles=${this.Dd} @initial-render=${()=>this.ot()} ><div class="uc-tab-toggles_indicator" ${P(this.Rl)} ></div>${st.map(r=>this.Yd(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ee} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Ss}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Ud}><div class="uc-slider" ?hidden=${!this.wr}><uc-editor-slider ${P(this.Tr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.wr||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.jd()}</div>`:R}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Wd} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.qd} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],ht.prototype,"wi",2),h([g()],ht.prototype,"showMainToolbar",2),h([g()],ht.prototype,"showSubToolbar",2),h([g()],ht.prototype,"Il",2),h([g()],ht.prototype,"tabList",2),h([g()],ht.prototype,"activeTab",2),h([g()],ht.prototype,"wr",2),h([g()],ht.prototype,"Ts",2),h([g()],ht.prototype,"Ol",2),h([g()],ht.prototype,"Ti",2);var nl=Kt([...st]),it=class extends x{constructor(){super(...arguments);this.ctxOwner=true;this.Qd="";this.et=Ot;this.Jd="";this.wi=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=nl;this.Nl=false;this.ke=false;this.As=null;this.Ei=null;this.Er=D(t=>{this.wi=t;},300);this.Sr=A();this.Vl=A();this._l=A();this.Bl=A();this.zl=()=>{this.Er(false),this.et!==Ot&&(this.$["*networkProblems"]=false);};this.Hl=()=>{this.Er(false),this.$["*networkProblems"]=true;};this.ep=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...tl(this)};}static{a(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}tp(){this.ke||this.As||(this.As=this.updateComplete.then(()=>{this.As=null,this.ke=true;}));}initCallback(){super.initCallback(),this.Kl(),this.jl();}Cr(){let t=this._l.value;t&&(this.$["*faderEl"]=t);let e=this.Vl.value;e&&(this.$["*cropperEl"]=e);let r=this.Bl.value;r&&(this.$["*imgContainerEl"]=r);let s=this.Sr.value;s&&(this.$["*imgEl"]=s);}ip(){let t=this.Sr.value;t&&(t.addEventListener("load",this.zl),t.addEventListener("error",this.Hl));}rp(){let t=this.Sr.value;t&&(t.removeEventListener("load",this.zl),t.removeEventListener("error",this.Hl));}get op(){let t=this.$["*tabId"];return bt("uc-image",{"uc-image_hidden_to_cropper":t===H.CROP,"uc-image_hidden_effects":t!==H.CROP})}Gl(){if(this.Ei)return this.Ei;let t=3e3;return this.Ei=new Promise((e,r)=>{let s=a(()=>{window.clearTimeout(p),u.disconnect(),this.Ei=null;},"cleanup"),n=a(()=>{let{width:d,height:f}=this.getBoundingClientRect();return d>0&&f>0},"hasNonZeroSize"),l=a(()=>{s(),window.setTimeout(()=>e(),0);},"resolveWait"),c=a(()=>{let d=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(d.message),r(d);},"rejectWait"),u=new ResizeObserver(d=>{let[f]=d;f&&f.contentRect.width>0&&f.contentRect.height>0&&l();}),p=window.setTimeout(()=>{c();},t);if(n()){l();return}u.observe(this);}),this.Ei}firstUpdated(t){super.firstUpdated(t),this.Cr(),this.ip(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.rp(),super.disconnectedCallback();}render(){let t=this.Jd??"",e=this.Qd??"",r=this.et||Ot,s=this.wi,n=this.Nl;return y` ${Fe(el)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.ep}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${P(this.Bl)}><img src=${r} class=${this.op} ${P(this.Sr)} />${Oi(this.ke,()=>y`<uc-editor-image-cropper ${P(this.Vl)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${P(this._l)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Oi(this.ke,()=>y`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.Kl(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.jl();}Kl(){let t=this.tabs||nl;this.$["*tabList"]=Ja(t);}jl(){let t=_r(this.cropPreset??""),e=null;if(this.cdnUrl){let r=Io(this.cdnUrl),s=Oo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,l]=s.crop.dimensions;e=wa(n,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.Gl();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=nr(t),r=te(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=Io(t),n=Oo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=te(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===H.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(Z(t,ot("json"))),r=await fetch(e).then(l=>l.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===H.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:t});}catch(t){t&&(this.telemetryManager.sendEventError(t,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",t));}this.tp();}}}async initEditor(){try{await this.Gl();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Nl=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=ot(ee(t),"preview"),s=Z(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};h([g()],it.prototype,"Qd",2),h([g()],it.prototype,"et",2),h([g()],it.prototype,"Jd",2),h([g()],it.prototype,"wi",2),h([b({type:String,reflect:true})],it.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],it.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],it.prototype,"cropPreset",2),h([b({type:String,reflect:true})],it.prototype,"tabs",2),h([g()],it.prototype,"Nl",2),h([g()],it.prototype,"ke",2);var Rs={};Vs(Rs,{CloudImageEditorActivity:()=>Ni});var ro=class extends it{static{a(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Ni=class extends ${constructor(){super(...arguments);this.Q=null;}static{a(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.Q&&this.Q.cropPreset!==t&&(this.Q={...this.Q,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.Q&&this.Q.tabs!==t&&(this.Q={...this.Q,tabs:t});}),this.sp();}disconnectedCallback(){super.disconnectedCallback(),this.np();}Ss(t){if(!this.xi)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.xi.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(S.activities.CLOUD_IMG_EDIT),this.historyBack();}Ee(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(S.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}sp(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.xi=e;let r=this.xi.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.Q=this.ap(r);}np(){this.xi=void 0,this.Q=null;}render(){if(!this.Q)return R;let{cdnUrl:t,cropPreset:e,tabs:r}=this.Q;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${W(e)} tabs=${W(r)} @apply=${this.Ss} @cancel=${this.Ee} @change=${this.handleChange} ></uc-cloud-image-editor>`}ap(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],Ni.prototype,"Q",2);var ri=class extends ${constructor(){super(...arguments);this.ql={importDisabled:true};this.$e=A();this.ys=t=>{let e=t.target?.value??"";this.ql={importDisabled:!e};};this.zo=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let r=this.$e.value?.value?.trim();r&&(this.api.addFileFromUrl(r,{source:_.URL}),this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.modalManager?.open(S.activities.UPLOAD_LIST));};}static{a(this,"UrlSource");}firstUpdated(){let t=this.$e.value;t&&(t.value="",t.focus());}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.zo}><label><input ${P(this.$e)} placeholder="https://" class="uc-url-input" type="text" @input=${this.ys} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.ql.importDisabled} >${this.l10n("upload-url")}</button></form>`}};h([g()],ri.prototype,"ql",2);var al=a(()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var Ed=a(o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),ll=a((o,i="i")=>{let t=o.split("*").map(Ed);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var Cd=["--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"],xd=a((o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),"getCssValue"),cl=a(o=>{let i={};for(let t of Cd){let e=xd(o,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Sd=["selected-files-change","toolbar-state-change"],Ad=a(o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!Sd.includes(i))},"isWhitelistedMessage"),oo=class{constructor(i,t){this.Ar=new Map;this.Zl=i=>{if(i.source!==this.ks)return;let t=i.data;if(!Ad(t))return;let e=this.Ar.get(t.type);if(e)for(let r of e)r(t);};this.ks=i,this.Wl=t,window.addEventListener("message",this.Zl);}static{a(this,"MessageBridge");}on(i,t){let e=this.Ar.get(i)??new Set;this.Ar.has(i)||this.Ar.set(i,e),e.add(t);}send(i){let t=this.Wl();this.ks.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Zl);}};function ul(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}a(ul,"queryString");var kd={[dt.GDRIVE]:"ngdrive"},ft=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Nt=A();this.kr=null;this.Ms=[];this.Is=false;this.Os=false;this.Ps=false;this.Ls=false;this.Mr=false;this.Rs=false;this.Us="uc-hidden";this.Yl=true;this.Ho=()=>{for(let t of this.Ms){let e=this.cp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.modalManager?.open(S.activities.UPLOAD_LIST);};this.Ee=()=>{this.historyBack();};this.mp=()=>{this.ne?.send({type:"select-all"});};this.gp=()=>{this.ne?.send({type:"deselect-all"});};}static{a(this,"ExternalSource");}get lp(){if(!this.kr)return "";let{selectedCount:t,total:e}=this.kr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.Xl():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.Ql(),this.Xl());});}),this.subConfigValue("multiple",e=>{this.Mr=e;}),this.subConfigValue("localeName",()=>{this.Jl();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.ec(e);});}cp(t){if(t.alternatives){let e=Y(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=ll(r);for(let[n,l]of Object.entries(t.alternatives))if(s.test(n))return l}}return t.url}up(t){this.Yl=t.isVisible;}async dp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.pp(t.selectedCount,t.total),this.Us=t.isReady?"":"uc-hidden",this.Is=t.isReady,this.Os=t.isReady&&t.selectedFiles.length>0,this.Mr=t.isMultipleMode&&t.total>0,this.Ps=t.selectedCount<t.total,this.Ls=t.selectedCount===t.total,this.Ms=t.selectedFiles??[],this.Rs=t.total>0;}tc(){this.ec(this.cfg.externalSourcesEmbedCss),this.hp(),this.Jl();}hp(){this.ne?.send({type:"set-theme-definition",theme:cl(this)});}ec(t){this.ne?.send({type:"set-embed-css",css:t});}Jl(){this.ne?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}fp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,l=kd[n]??n,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||al(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,r);return p.search=ul(u),p.toString()}pp(t,e){this.kr={selectedCount:t,total:e};}Xl(){let t=document.createElement("iframe");t.src=this.fp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.tc.bind(this)),t.addEventListener("load",this.tc.bind(this)),this.Nt.value&&(this.Nt.value.innerHTML="",this.Nt.value.appendChild(t)),t.contentWindow&&(this.ne?.destroy(),this.ne=new oo(t.contentWindow,()=>this.cfg.socialBaseUrl),this.ne.on("selected-files-change",this.dp.bind(this)),this.ne.on("toolbar-state-change",this.up.bind(this)),this.ic());}Ql(){this.ne?.destroy(),this.ne=void 0,this.Nt.value&&(this.Nt.value.innerHTML=""),this.ic();}ic(){this.Ms=[],this.Is=false,this.Os=false,this.Ps=false,this.Ls=false,this.Mr=false,this.Rs=false,this.Us="uc-hidden",this.kr=null;}disconnectedCallback(){super.disconnectedCallback(),this.Ql();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${P(this.Nt)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.Yl}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Mr}><span>${this.lp}</span><button type="button" @click=${this.mp} ?hidden=${!this.Ps}>${this.l10n("select-all")}</button><button type="button" @click=${this.gp} ?hidden=${!this.Ls}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.Ho} ?disabled=${!this.Os} ?hidden=${!this.Rs} ><uc-spinner ?hidden=${this.Is}></uc-spinner><span class=${this.Us}>${this.l10n("done")}</span></button></div></div>`}};h([g()],ft.prototype,"Ms",2),h([g()],ft.prototype,"Is",2),h([g()],ft.prototype,"Os",2),h([g()],ft.prototype,"Ps",2),h([g()],ft.prototype,"Ls",2),h([g()],ft.prototype,"Mr",2),h([g()],ft.prototype,"Rs",2),h([g()],ft.prototype,"Us",2),h([g()],ft.prototype,"Yl",2);var dl=a(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var Md={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Id=["camera","microphone"];function so(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}a(so,"formatTime");var pl="image/jpeg",hl="video/webm",z=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ir=null;this.$s=false;this.Ci=[];this.me=null;this.ge=null;this.Or=null;this.Pr=null;this.g=null;this.Si={};this.fe=null;this.e=null;this.Vt=[];this._t=[];this.vp={};this.Lr=[];this.Rr=null;this.rc=()=>{this.oc(),this.Ai="pause";};this.sc=()=>{this.Ai="play",this.yp();};this.ki=A();this.Qe=A();this.K=A();this.nc=0;this.ac=0;this.cc=null;this.Ur=true;this.$r=true;this.bp=dl();this.uc=[];this.at=true;this.Ds="";this.Bt=true;this.pt=true;this.zt=true;this.dc=[];this.mt=true;this.Fs=true;this.gt=true;this.Ce=true;this.vt=true;this.Ht="camera-full";this.Ai="play";this.pc="microphone";this.Dr="uc-shot-btn uc-camera-action";this.wp=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===L.PHOTO&&this.Tp(),this.g===L.VIDEO){if(this.me?.state==="recording"){this.hc();return}this.Ep();}};this.xp=t=>{let e=t.target;e&&(this.Pr=e.value,this.Kt());};this.Cp=t=>{let e=t.target;e&&(this.Or=e.value,this.Kt());};this.Sp=()=>{this.Kt();};this.Ap=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.wp();};this.kp=()=>{this.Mp();};this.Ip=()=>{this.Op();};this.Pp=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.Lp();};this.Rp=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.Up();};this.fc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.mc(r);};this.gc=()=>{let t=Math.floor((performance.now()-this.nc+this.ac)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.ki.value;s&&(s.textContent=so(e)),this.hc();return}let r=this.ki.value;r&&(r.textContent=so(e));}else {let e=this.ki.value;e&&(e.textContent=so(t));}this.jt=requestAnimationFrame(this.gc);};this.$p=()=>{this.nc=performance.now(),this.ac=0,this.gc();};this.vc=()=>{this.jt&&cancelAnimationFrame(this.jt);};this.oc=()=>{let t=this.K.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.Qe.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.ki.value;n&&(n.textContent=so(e)),this.jt=requestAnimationFrame(this.oc);};this.yp=()=>{this.jt&&cancelAnimationFrame(this.jt);};this.jt=null;this.Ep=()=>{try{this.Ci=[],this.Si={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Si.mimeType=t:MediaRecorder.isTypeSupported(hl)?this.Si.mimeType=hl:this.Si.mimeType="video/mp4",this.ge&&(this.me=new MediaRecorder(this.ge,this.Si),this.me.start(),this.me.addEventListener("dataavailable",e=>{this.Ci.push(e.data);}),this.$p(),this.classList.add("uc-recording"),this.Mi(xt.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.hc=()=>{this.me?.addEventListener("stop",()=>{this.Dp(),this.vc(),this.Mi(xt.STOP);}),this.me?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.g}}});};this.Mp=()=>{if(this.me?.state==="recording")return;let t=this.K.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.Op=()=>{this.ge?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.pc=t.enabled?"microphone":"microphone-mute",this.Fs=!t.enabled;});};this.Dp=()=>{try{let t=new Blob(this.Ci,{type:this.me?.mimeType}),e=URL.createObjectURL(t),r=this.K.value;if(!r)return;r.muted=!1,r.volume=1,this.Ii(null),r.src=e,this.Fp(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Lp=()=>{if(this.Mi(xt.RETAKE),this.g===L.VIDEO){this.Ii(this.ge);let t=this.K.value;t&&(t.muted=true);}this.K.value?.play?.();};this.Up=()=>{if(this.Mi(xt.ACCEPT),this.g===L.PHOTO){this.fe?.toBlob(s=>{if(!s)return;let n=this.yc("camera","jpeg",pl,s);this.bc(n);},pl);return}let t=new Blob(this.Ci,{type:this.me?.mimeType}),e=this.Np(this.me?.mimeType),r=this.yc("video",e,`video/${e}`,t);this.bc(r),this.Ci=[];};this.Vp=t=>{t===xt.SHOT&&(this.vt=true,this.pt=true,this.Ce=true,this.zt=false,this.at=true),(t===xt.RETAKE||t===xt.ACCEPT)&&(this.vt=!this.Se.includes(L.VIDEO),this.Ce=!this.Se.includes(L.PHOTO),this.pt=false,this.zt=true,this.at=this.Vt.length<=1);};this._p=t=>{t===xt.PLAY&&(this.Bt=false,this.Ce=true,this.at=true,this.mt=true,this.Ai="pause",this.Ht="square",this.Dr="uc-shot-btn uc-camera-action uc-stop-record"),t===xt.STOP&&(this.Bt=false,this.pt=true,this.gt=true,this.zt=false),(t===xt.RETAKE||t===xt.ACCEPT)&&(this.Bt=true,this.vt=!this.Se.includes(L.VIDEO),this.Ce=!this.Se.includes(L.PHOTO),this.pt=false,this.zt=true,this.gt=!this.cfg.enableAudioRecording,this.Ht="video-camera-full",this.Dr="uc-shot-btn uc-camera-action",this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.at=this.Vt.length<=1);};this.Mi=t=>{this.g===L.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Vp(t),this.g===L.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this._p(t);};this.mc=t=>{t===L.PHOTO&&(this.Ht="camera-full",this.mt=true,this.gt=true),t===L.VIDEO&&(this.Ai="play",this.Ht="video-camera-full",this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.gt=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.g=t;};this.yc=(t,e,r,s)=>{let n=Date.now(),l=`${t}-${n}.${e}`;return new File([s],l,{lastModified:n,type:r})};this.bc=t=>{this.api.addFileFromObject(t,{source:_.CAMERA}),this.set$({"*currentActivity":S.activities.UPLOAD_LIST}),this.modalManager?.open(S.activities.UPLOAD_LIST);};this.Oi=D(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.g===L.VIDEO&&this.cfg.enableAudioRecording,r=this.g===L.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Ur=false,this.pt=false,this.Ce=!this.Se.includes(L.PHOTO),this.vt=!this.Se.includes(L.VIDEO),this.$r=true,this.Bt=true,this.Ht=r,this.gt=!e,this.mt=!e):t==="prompt"?(this.Ds="camera-permissions-prompt",this.Ur=true,this.pt=true,this.Ce=true,this.$r=false,this._s()):(this.Ds="camera-permissions-denied",this.Ur=true,this.$r=false,this.Ce=!this.Se.includes(L.PHOTO),this.vt=!this.Se.includes(L.VIDEO),this.zt=true,this.Dr="uc-shot-btn uc-camera-action",this._s());},300);this.Bp=()=>{if(!this.ge)return false;let t=this.ge?.getAudioTracks(),e=this.ge?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this._s=()=>{this.$s&&(this.K.value&&(this.K.value.volume=0),this.Rr?.getTracks?.()?.[0]?.stop(),this.Ns(this.K.value),this.Ii(null),this.Bp(),this.vc(),this.$s=false);};this.Kt=async()=>{let t={video:{...Md},audio:this.cfg.enableAudioRecording?{}:false};this.Pr&&(t.video={deviceId:{exact:this.Pr}}),this.Or&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Or}}),this.K.value&&(this.K.value.volume=0);try{this.Oi("prompt"),this.ge=await navigator.mediaDevices.getUserMedia(t),this.ge.addEventListener("inactive",()=>{this.Oi("denied");}),this.Ii(this.ge),this.$s=!0,this.Oi("granted");}catch(e){this.Oi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.wc=()=>{this.Kt();};this.zp=async()=>{try{this.Fr();for(let t of Id){let e=await navigator.permissions.query({name:t});this.vp[t]=e,e.addEventListener("change",this.wc),this.Lr.push(()=>{e.removeEventListener("change",this.wc);});}this.Ir=()=>{this.Fr();};}catch(t){this.Fr(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.Kt();}};this.Hp=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.Bs(),navigator.mediaDevices.addEventListener("devicechange",this.Bs);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.Bs=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Vt=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this._t=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.uc=this.Vt,this.at=this.Vt.length<=1,this.Pr=this.Vt[0]?.value??null,this.dc=this._t,this.mt=!this.cfg.enableAudioRecording||this._t.length<=1,this.Or=this._t[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Kp=async()=>{await this.zp(),await this.Hp(),await this.Kt(),this.Tc(this.Se);};this.jp=async()=>{this.Ir&&this.Ir(),window.chrome||this.Oi("denied"),this._s();};this.Tc=t=>{this.vt=!t.includes(L.VIDEO),this.Ce=!t.includes(L.PHOTO);let e=t[0];e&&(!this.g||!t.includes(this.g))&&this.mc(e);};}static{a(this,"CameraSource");}Fp(t){this.Ns(t),t.addEventListener("play",this.rc),t.addEventListener("pause",this.sc);}Ns(t){t?.removeEventListener("play",this.rc),t?.removeEventListener("pause",this.sc);}Ii(t){this.Rr!==t&&(this.Rr=t,this.Vs());}Vs(){let t=this.K.value;if(!t)return;let e=this.Rr??null;t.srcObject!==e&&(t.srcObject=e);}Tp(){if(this.Mi("shot"),this.fe=document.createElement("canvas"),this.e=this.fe.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this.K.value;if(!t)throw new Error("Video element not found");this.fe.height=t.videoHeight,this.fe.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.fe.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}Np(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let r=t.split("/");if(r?.[0]==="video"){let n=r.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get Se(){return Y(this.cfg.cameraModes).filter(t=>t===L.PHOTO||t===L.VIDEO)}Fr(){if(this.Lr.length!==0){for(let t of this.Lr)t();this.Lr=[],this.Ir=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.cc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.gt=!t,this.Fs=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=j(t);this.Tc(e.filter(r=>r===L.PHOTO||r===L.VIDEO));}),this.Kp();}firstUpdated(t){super.firstUpdated(t),this.Vs();}updated(t){super.updated(t),this.Vs();}Gp(){this.Fr(),navigator.mediaDevices?.removeEventListener("devicechange",this.Bs),this.Ns(this.K.value),this.Ii(null);}disconnectedCallback(){super.disconnectedCallback(),this.jp(),this.Gp();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.at}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.uc} ?hidden=${this.at} @change=${this.xp} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${ke({transform:this.cc})} ?hidden=${this.Ur} ${P(this.K)} ></video><div class="uc-message-box" ?hidden=${this.$r}><span>${this.l10n(this.Ds)}</span><button type="button" @click=${this.Sp} ?hidden=${this.bp} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.Bt}><button data-id="photo" type="button" class=${Lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===L.PHOTO})} @click=${this.fc} ?hidden=${this.Ce} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${Lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===L.VIDEO})} @click=${this.fc} ?hidden=${this.vt} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.kp} ?hidden=${this.Bt} data-testid="recording-timer" ><uc-icon name=${this.Ai}></uc-icon><span ${P(this.ki)}> 00:00 </span><span ${P(this.Qe)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.zt} ><button type="button" class="uc-secondary-btn" @click=${this.Pp}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.Rp} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this.Ap} class=${this.Dr} ?hidden=${this.pt} ><uc-icon name=${this.Ht}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.Ip} ?hidden=${this.gt} data-testid="toggle-microphone" ><uc-icon name=${this.pc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.dc} ?hidden=${this.mt} ?disabled=${this.Fs} @change=${this.Cp} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],z.prototype,"cc",2),h([g()],z.prototype,"Ur",2),h([g()],z.prototype,"$r",2),h([g()],z.prototype,"bp",2),h([g()],z.prototype,"uc",2),h([g()],z.prototype,"at",2),h([g()],z.prototype,"Ds",2),h([g()],z.prototype,"Bt",2),h([g()],z.prototype,"pt",2),h([g()],z.prototype,"zt",2),h([g()],z.prototype,"dc",2),h([g()],z.prototype,"mt",2),h([g()],z.prototype,"Fs",2),h([g()],z.prototype,"gt",2),h([g()],z.prototype,"Ce",2),h([g()],z.prototype,"vt",2),h([g()],z.prototype,"Ht",2),h([g()],z.prototype,"Ai",2),h([g()],z.prototype,"pc",2),h([g()],z.prototype,"Dr",2);var fl={id:"camera",setup:a(async({pluginApi:o,uploaderApi:i})=>{gt({CameraSource:z}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:a(()=>{if(!Bn.htmlMediaCapture)return ["camera"];let t=j(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},"expand"),onSelect:a(()=>{i.setCurrentActivity(V.CAMERA),i.setModalState(true);},"onSelect")}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:a(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});},"onSelect")}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:a(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});},"onSelect")}),o.registry.registerActivity({id:V.CAMERA,render:a(t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}},"render")});},"setup")};var $s={};Vs($s,{BtnUi:()=>St,CloudImageEditor:()=>ro,CloudImageEditorBlock:()=>it,Config:()=>Qe,CropFrame:()=>Li,EditorAspectRatioButtonControl:()=>$i,EditorCropButtonControl:()=>Di,EditorFilterControl:()=>Xt,EditorFreeformButtonControl:()=>io,EditorImageCropper:()=>Ui,EditorImageFader:()=>Jr,EditorOperationControl:()=>Fi,EditorScroller:()=>Vi,EditorSlider:()=>Ri,EditorToolbar:()=>ht,Icon:()=>le,LineLoaderUi:()=>Pi,PresenceToggle:()=>ti,SliderUi:()=>Nt,defineComponents:()=>gt});var Od="cloud-image-editor",Pd="<svg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></svg>",ml={id:Od,setup:a(async({pluginApi:o,uploaderApi:i})=>(gt({...$s,...Rs}),o.registry.registerIcon({name:"edit-file",svg:Pd}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:a(e=>!!(e.isImage&&e.cdnUrl),"shouldRender"),onClick:a(e=>{i.setCurrentActivity?.(V.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);},"onClick")}),o.registry.registerActivity({id:V.CLOUD_IMG_EDIT,render:a(e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}},"render")}),i.on(I.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),n=o.config.get("cloudImageEditorAutoOpen"),l=i.v.size;s&&l===1&&(r||n)&&(i.setCurrentActivity?.(V.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));})),"setup")};var gl={id:"external-sources",setup:a(async({pluginApi:o,uploaderApi:i})=>{gt({ExternalSource:ft}),o.registry.registerActivity({id:V.EXTERNAL,render:a(t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}},"render")});for(let t of Object.values(dt))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:a(()=>{i.setCurrentActivity(V.EXTERNAL,{externalSourceType:t}),i.setModalState(true);},"onSelect")});},"setup")};var ao=a(()=>{let o=[];return {stack:o,promiseReadJpegChunks:a(t=>new Promise((e,r)=>{let s=2,n=a((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",f=>{r(`Reader error: ${f}`);}),d.readAsArrayBuffer(u);},"readToView"),l=a(()=>n(t.slice(s,s+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=a(()=>{let u=s;return n(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let f=p.getUint16(2)-2;return n(t.slice(s,s+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}o.push({startPos:u,length:f,marker:d,view:m}),l();})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Ld=a(async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=ao();return await t(o),e.forEach(({marker:r,view:s})=>{r===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),yl=a(async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=ao();await s(o),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),r.push(u.length)});let l=[o.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(o.slice(c,e[u])),c=e[u]+r[u]+4;return l.push(o.slice(c,o.size)),new Blob(l,{type:o.type})}},"replaceJpegChunk"),Ud=226,bl=a((o,i)=>yl(o,Ud,i.map(t=>t.buffer)),"replaceIccProfile"),Rd=a(async o=>{try{return await bl(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),$d=a((o,i,t)=>new Promise((e,r)=>{let s=a(n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);},"callback");o.toBlob(s,i,t),o.width=o.height=1;}),"canvasToBlob"),_i=a(()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},"createCanvas"),Dd=a(o=>{let{ctx:t,canvas:e}=_i();e.width=e.height=50,t.drawImage(o,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<r.length;s+=4)if(r[s]<254)return true;return false},"hasTransparency"),Fd=a(async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=ao();return await t(o),e.forEach(({marker:r,view:s})=>{if(!i&&r===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),Vd="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",no,Nd=a(()=>new Promise(o=>{if(no!==void 0)o(no);else {let i=new Image;i.addEventListener("load",()=>{no=i.naturalWidth<i.naturalHeight,i.src="//:0",o(no);}),i.src=Vd;}}),"isBrowserApplyExifOrientation"),_d=a((o,i)=>{let t,e,r,s;if(!o||o.byteLength<14||o.getUint32(0)!==1165519206||o.getUint16(4)!==0)return;if(o.getUint16(6)===18761)e=true;else if(o.getUint16(6)===19789)e=false;else return;if(o.getUint16(8,e)!==42)return;r=8+o.getUint32(10,e);let n=o.getUint16(r-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(o.byteLength<r+10)return;o.getUint16(r,e)===274&&i(r+8,e),r+=12;}},"findExifOrientation"),zd=a((o,i)=>{_d(o,(t,e)=>o.setUint16(t,i,e));},"setExifOrientation"),Bd=a(async(o,i,t)=>(t&&zd(i,1),yl(o,225,[i.buffer])),"replaceExif"),Hd=a((o,i)=>new Promise((t,e)=>{i&&(o.src=i),o.complete?t(o):(o.addEventListener("load",()=>{t(o);}),o.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),Kd=a(o=>Hd(new Image,o),"imageLoader"),jd=[1,3],Gd=[192,193,194,195,197,198,199,201,202,203,205,206,207],vl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},qd=a(async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=ao();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&Gd.indexOf(r)>=0){let n=s.getUint8(5);jd.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),wl=a((o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},"memoize"),Tl=a((o,i)=>{let[t]=o,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,s)=>r-s);for(let r=0;r<e.length;r++){let s=e[r],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},"memoKeySerializer"),ue={R:55,G:110,B:165,A:255},Wd=`rgba(${ue.R}, ${ue.G}, ${ue.B}, ${ue.A/255})`,El=a((o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=_i();e.width=1,e.height=1;let{canvas:s,ctx:n}=_i();s.width=o,s.height=i,n&&(n.fillStyle=Wd,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===ue.R&&l[1]===ue.G&&l[2]===ue.B&&l[3]===ue.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}},"canvasTest");function Cl(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}a(Cl,"wrapAsync");var Zd=Cl(wl(El,Tl)),Yd=Cl(wl(El,Tl)),xl=a(async(o,i)=>{let t=vl.squareSide.find(n=>n*n>=o*i),e=vl.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([Zd(t,t),Yd(e,1)]);if(r&&s)return true;throw new Error("Not supported")},"testCanvasSize"),Sl=a(async(o,i,t)=>{try{let{ctx:e,canvas:r}=_i();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(o,0,0,i,t),o instanceof HTMLImageElement&&(o.src="//:0"),o instanceof HTMLCanvasElement&&(o.width=o.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),Xd=a(({img:o,targetW:i,targetH:t})=>Sl(o,i,t),"native"),Qd=a(function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,n=t;do r.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<o*e);return r.reverse()},"calcShrinkSteps"),Jd=a(({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=Qd({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[l,c],u)=>n.then(p=>xl(l,c).then(()=>Sl(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(o))},"fallback"),tp=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),ep=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Ds=.71,ip=a((o,i)=>{if(o.width*Ds*o.height*Ds<i.size)throw new Error("Not required");let t=o.width,e=o.height,r=t/e,s=Math.floor(Math.sqrt(i.size*r)),n=Math.floor(i.size/Math.sqrt(i.size*r));return xl(s,n).then(()=>{let{ctx:l}=_i();return "imageSmoothingQuality"in l&&!tp()&&!ep?Xd({img:o,targetW:s,targetH:n}):Jd({img:o,sourceW:t,targetW:s,targetH:n,step:Ds})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Al=a(async(o,i)=>{try{if(await qd(o))throw new Error("Should skipped");let e=await Promise.allSettled([Fd(o),Nd(),Ld(o)]),s=!e.some(w=>w.status==="rejected"),[n,l,c]=e,u=await Rd(o).catch(()=>o),p=await Kd(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await ip(p,i),f="image/jpeg",m=i?.quality||.8;!s&&Dd(d)&&(f="image/png",m=void 0);let v=await $d(d,f,m);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,T=l.status==="fulfilled"?l.value:!1;v=await Bd(v,w,T);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await bl(v,c.value)),v}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");var rp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,kl=a(o=>{if(typeof o!="string")return false;let i=rp.exec(o.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var Ml={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:a(async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=kl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Al(i,e)}}catch{return {file:i}}},"handler")});}};var Il={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:a(()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),"expand"),onSelect:a(()=>{},"onSelect")});}};var Ol={id:_.LOCAL,setup:a(({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:_.LOCAL,label:"src-type-local",icon:"local",onSelect:a(()=>{i.openSystemDialog();},"onSelect")});},"setup")};var Pl={id:"url-source",setup:a(async({pluginApi:o,uploaderApi:i})=>{gt({UrlSource:ri}),o.registry.registerActivity({id:V.URL,render:a(t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}},"render")}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:a(()=>{i.setCurrentActivity(V.URL),i.setModalState(true);},"onSelect")});},"setup")};var oi=[{configDeps:["useCloudImageEditor"],isEnabled:a(o=>!!o("useCloudImageEditor"),"isEnabled"),load:a(()=>ml,"load")},{configDeps:["imageShrink"],isEnabled:a(o=>!!o("imageShrink"),"isEnabled"),load:a(()=>Ml,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.LOCAL),"isEnabled"),load:a(()=>Ol,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.CAMERA),"isEnabled"),load:a(()=>fl,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes("instagram"),"isEnabled"),load:a(()=>Il,"load")},{configDeps:["sourceList"],isEnabled:a(o=>Object.values(dt).some(i=>j(o("sourceList")).includes(i)),"isEnabled"),load:a(()=>gl,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.URL),"isEnabled"),load:a(()=>Pl,"load")}];var lo=class extends Yt{constructor(){super();this.headless=false;this.init$={...this.init$};}static{a(this,"FileUploaderRegular");}static{this.lazyPlugins=oi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});}render(){return y` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([b({type:Boolean})],lo.prototype,"headless",2);var co=class extends Yt{constructor(){super();this.Ec=false;this.Ee=()=>{if(this.xc){let t=this.$["*historyBack"];t?.();return}this.Cc&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderInline");}static{this.lazyPlugins=oi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get xc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==S.activities.START_FROM}get Cc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}zs(){return this.getCssData("--cfg-init-activity")||S.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.zs();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Ec=this.xc||this.Cc;});}render(){return y` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee} ?hidden=${!this.Ec} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};h([g()],co.prototype,"Ec",2);var Fs="active",uo="",de=class extends Yt{constructor(){super();this.Hs=false;this.Nr=false;this.Vr=uo;this.Ks=uo;this.ci="choose-file";this.oi=t=>{t.id===S.activities.CLOUD_IMG_EDIT&&(this.Vr=Fs),this.$["*currentActivity"]===S.activities.UPLOAD_LIST&&(this.Vr=Fs,this.Nr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.Ks=Fs);};this.si=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.Nr=false),t.id===S.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderMinimal");}static{this.lazyPlugins=oi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}zs(){return this.getCssData("--cfg-init-activity")||S.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.zs();this.sub("*currentActivity",e=>{e===S.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.Ks=uo):(this.Vr=uo,this.Nr=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",r=>{e==="grid"?(r?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.Hs=!r):(this.style.removeProperty("--uc-grid-col"),this.Hs=false);});}),this.subConfigValue("multiple",e=>{this.ci=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(X.OPEN,this.oi),this.modalManager?.subscribe(X.CLOSE,this.si);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(X.OPEN,this.oi),this.modalManager?.unsubscribe(X.CLOSE,this.si);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.Nr} class=${this.Ks}><uc-drop-area ?single=${this.Hs} initflow clickable tabindex="0" ><span>${this.l10n(this.ci)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Vr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([g()],de.prototype,"Hs",2),h([g()],de.prototype,"Nr",2),h([g()],de.prototype,"Vr",2),h([g()],de.prototype,"Ks",2),h([g()],de.prototype,"ci",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
7
+ var ho=Object.defineProperty;var Ul=Object.getOwnPropertyDescriptor;var a=(o,i)=>ho(o,"name",{value:i,configurable:true});var Vs=(o,i)=>{for(var t in i)ho(o,t,{get:i[t],enumerable:true});};var h=(o,i,t,e)=>{for(var r=e>1?void 0:e?Ul(i,t):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&ho(i,t,r),r};var kt=[],Qt=0,zi=4,Ns=a(o=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Qt+zi;s<kt.length;)kt[s]===e?kt.splice(s,zi):s+=zi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!kt.length;for(let n of i)kt.push(n,t.value,e,r);if(s){for(Qt=0;Qt<kt.length;Qt+=zi)kt[Qt](kt[Qt+1],kt[Qt+2],kt[Qt+3]);kt.length=0;}},off(){},set(e){let r=t.value;r!==e&&(t.value=e,t.notify(r));},subscribe(e){let r=t.listen(e);return e(t.value),r},value:o};return t},"atom");function Bi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}a(Bi,"listenKeys");function fo(o,i,t){let e=Bi(o,i,t);return t(o.value),e}a(fo,"subscribeKeys");var mo=a((o={})=>{let i=Ns(o);return i.setKey=function(t,e){let r=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(r,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(r,t));},i},"map");var K=class o{static{a(this,"PubSub");}static{this.qt=new Map;}constructor(i,t){this.J=i,this.ae=t;}get id(){return this.J}pub(i,t){i in this.ae.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.ae.setKey(i,t);}sub(i,t,e=true){return (e?fo:Bi)(this.ae,[i],s=>{t(s[i]);})}read(i){return i in this.ae.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.ae.get()[i]}add(i,t,e=false){(!(i in this.ae.get())||e)&&this.ae.setKey(i,t);}has(i){return i in this.ae.get()}get store(){return this.ae.get()}static registerCtx(i,t){if(o.qt.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=mo(i);return o.qt.set(t,e),new o(t,e)}static deleteCtx(i){o.qt.delete(i);}static getCtx(i){let t=o.qt.get(i);return t?new o(i,t):null}static hasCtx(i){return o.qt.has(i)}};var Hi=globalThis,ji=Hi.ShadowRoot&&(Hi.ShadyCSS===void 0||Hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,zs=Symbol(),_s=new WeakMap,Ki=class{static{a(this,"n");}constructor(i,t,e){if(this.Cc=true,e!==zs)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t;}get styleSheet(){let i=this.o,t=this.t;if(ji&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=_s.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&_s.set(t,i));}return i}toString(){return this.cssText}},Bs=a(o=>new Ki(typeof o=="string"?o:o+"",void 0,zs),"r");var Hs=a((o,i)=>{if(ji)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Hi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},"S"),go=ji?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Bs(t)})(o):o;var{is:$l,defineProperty:Dl,getOwnPropertyDescriptor:Fl,getOwnPropertyNames:Vl,getOwnPropertySymbols:Nl,getPrototypeOf:_l}=Object,Gi=globalThis,Ks=Gi.trustedTypes,zl=Ks?Ks.emptyScript:"",Bl=Gi.reactiveElementPolyfillSupport,si=a((o,i)=>o,"d"),ni={toAttribute(o,i){switch(i){case Boolean:o=o?zl:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o);}return o},fromAttribute(o,i){let t=o;switch(i){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o);}catch{t=null;}}return t}},qi=a((o,i)=>!$l(o,i),"f"),js={attribute:true,type:String,converter:ni,reflect:false,useDefault:false,hasChanged:qi};Symbol.metadata??=Symbol("metadata"),Gi.litPropertyMetadata??=new WeakMap;var Bt=class extends HTMLElement{static{a(this,"y");}static addInitializer(i){this.Br(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Li&&[...this.Li.keys()]}static createProperty(i,t=js){if(t.state&&(t.attribute=false),this.Br(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(i,e,t);r!==void 0&&Dl(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Fl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let l=r?.call(this);s?.call(this,n),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??js}static Br(){if(this.hasOwnProperty(si("elementProperties")))return;let i=_l(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(si("finalized")))return;if(this.finalized=true,this.Br(),this.hasOwnProperty(si("properties"))){let t=this.properties,e=[...Vl(t),...Nl(t)];for(let r of e)this.createProperty(r,t[r]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,r]of t)this.elementProperties.set(e,r);}this.Li=new Map;for(let[t,e]of this.elementProperties){let r=this.zr(t,e);r!==void 0&&this.Li.set(r,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let r of e)t.unshift(go(r));}else i!==void 0&&t.push(go(i));return t}static zr(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.Ri=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.vt=null,this.Sc();}Sc(){this.Hr=new Promise(i=>this.enableUpdating=i),this.Fe=new Map,this.Ac(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Wt??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Wt?.delete(i);}Ac(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Ri=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Hs(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Wt?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Wt?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Kr(i,e);}kc(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.zr(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:ni).toAttribute(t,e.type);this.vt=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.vt=null;}}Kr(i,t){let e=this.constructor,r=e.Li.get(i);if(r!==void 0&&this.vt!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ni;this.vt=r;let l=n.fromAttribute(t,s.type);this[r]=l??this.jr?.get(r)??l,this.vt=null;}}requestUpdate(i,t,e,r=false,s){if(i!==void 0){let n=this.constructor;if(r===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??qi)(s,t)||e.useDefault&&e.reflect&&s===this.jr?.get(i)&&!this.hasAttribute(n.zr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Hr=this.Mc());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.jr??=new Map).has(i)&&(this.jr.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.Fe.has(i)||(this.hasUpdated||e||(t=void 0),this.Fe.set(i,t)),r===true&&this.vt!==i&&(this.Gs??=new Set).add(i));}async Mc(){this.isUpdatePending=true;try{await this.Hr;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.Ri){for(let[r,s]of this.Ri)this[r]=s;this.Ri=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,l=this[r];n!==true||this.Fe.has(r)||l===void 0||this.C(r,void 0,s,l);}}let i=false,t=this.Fe;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Wt?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.Gr();}catch(e){throw i=false,this.Gr(),e}i&&this.Ic(t);}willUpdate(i){}Ic(i){this.Wt?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}Gr(){this.Fe=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Hr}shouldUpdate(i){return true}update(i){this.Gs&&=this.Gs.forEach(t=>this.kc(t,this[t])),this.Gr();}updated(i){}firstUpdated(i){}};Bt.elementStyles=[],Bt.shadowRootOptions={mode:"open"},Bt[si("elementProperties")]=new Map,Bt[si("finalized")]=new Map,Bl?.({ReactiveElement:Bt}),(Gi.reactiveElementVersions??=[]).push("2.1.2");var yo=globalThis,Gs=a(o=>o,"i"),Wi=yo.trustedTypes,qs=Wi?Wi.createPolicy("lit-html",{createHTML:a(o=>o,"createHTML")}):void 0,bo="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,wo="?"+Ht,Hl=`<${wo}>`,me=document,li=a(()=>me.createComment(""),"c"),ci=a(o=>o===null||typeof o!="object"&&typeof o!="function","a"),To=Array.isArray,Js=a(o=>To(o)||typeof o?.[Symbol.iterator]=="function","d"),vo=`[ \f\r]`,ai=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ws=/-->/g,Zs=/>/g,he=RegExp(`>|${vo}(?:([^\\s"'>=/]+)(${vo}*=${vo}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ys=/'/g,Xs=/"/g,tn=/^(?:script|style|textarea|title)$/i,Eo=a(o=>(i,...t)=>({Ne:o,strings:i,values:t}),"x"),y=Eo(1);Eo(2);Eo(3);var rt=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),Qs=new WeakMap,fe=me.createTreeWalker(me,129);function en(o,i){if(!To(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return qs!==void 0?qs.createHTML(i):i}a(en,"V");var rn=a((o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=ai;for(let l=0;l<t;l++){let c=o[l],u,p,d=-1,f=0;for(;f<c.length&&(n.lastIndex=f,p=n.exec(c),p!==null);)f=n.lastIndex,n===ai?p[1]==="!--"?n=Ws:p[1]!==void 0?n=Zs:p[2]!==void 0?(tn.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=he):p[3]!==void 0&&(n=he):n===he?p[0]===">"?(n=r??ai,d=-1):p[1]===void 0?d=-2:(d=n.lastIndex-p[2].length,u=p[1],n=p[3]===void 0?he:p[3]==='"'?Xs:Ys):n===Xs||n===Ys?n=he:n===Ws||n===Zs?n=ai:(n=he,r=void 0);let m=n===he&&o[l+1].startsWith("/>")?" ":"";s+=n===ai?c+Hl:d>=0?(e.push(u),c.slice(0,d)+bo+c.slice(d)+Ht+m):c+Ht+(d===-2?l:m);}return [en(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),ui=class o{static{a(this,"S");}constructor({strings:i,Ne:t},e){let r;this.parts=[];let s=0,n=0,l=i.length-1,c=this.parts,[u,p]=rn(i,t);if(this.el=o.createElement(u,e),fe.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(r=fe.nextNode())!==null&&c.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(bo)){let f=p[n++],m=r.getAttribute(d).split(Ht),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:v[2],strings:m,ctor:v[1]==="."?Yi:v[1]==="?"?Xi:v[1]==="@"?Qi:ve}),r.removeAttribute(d);}else d.startsWith(Ht)&&(c.push({type:6,index:s}),r.removeAttribute(d));if(tn.test(r.tagName)){let d=r.textContent.split(Ht),f=d.length-1;if(f>0){r.textContent=Wi?Wi.emptyScript:"";for(let m=0;m<f;m++)r.append(d[m],li()),fe.nextNode(),c.push({type:2,index:++s});r.append(d[f],li());}}}else if(r.nodeType===8)if(r.data===wo)c.push({type:2,index:s});else {let d=-1;for(;(d=r.data.indexOf(Ht,d+1))!==-1;)c.push({type:7,index:s}),d+=Ht.length-1;}s++;}}static createElement(i,t){let e=me.createElement("template");return e.innerHTML=i,e}};function ge(o,i,t=o,e){if(i===rt)return i;let r=e!==void 0?t.Oc?.[e]:t.Pc,s=ci(i)?void 0:i.qr;return r?.constructor!==s&&(r?.qs?.(false),s===void 0?r=void 0:(r=new s(o),r.Wr(o,t,e)),e!==void 0?(t.Oc??=[])[e]=r:t.Pc=r),r!==void 0&&(i=ge(o,r.Lc(o,i.values),r,e)),i}a(ge,"M");var Zi=class{static{a(this,"R");}constructor(i,t){this.Ws=[],this.le=void 0,this.Zs=i,this.f=t;}get parentNode(){return this.f.parentNode}get W(){return this.f.W}u(i){let{el:{content:t},parts:e}=this.Zs,r=(i?.creationScope??me).importNode(t,true);fe.currentNode=r;let s=fe.nextNode(),n=0,l=0,c=e[0];for(;c!==void 0;){if(n===c.index){let u;c.type===2?u=new Me(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new Ji(s,this,i)),this.Ws.push(u),c=e[++l];}n!==c?.index&&(s=fe.nextNode(),n++);}return fe.currentNode=me,r}p(i){let t=0;for(let e of this.Ws)e!==void 0&&(e.strings!==void 0?(e.ce(i,e,t),t+=e.strings.length-2):e.ce(i[t])),t++;}},Me=class o{static{a(this,"k");}get W(){return this.f?.W??this.Ys}constructor(i,t,e,r){this.type=2,this.r=R,this.le=void 0,this.ve=i,this.yt=t,this.f=e,this.options=r,this.Ys=r?.isConnected??true;}get parentNode(){let i=this.ve.parentNode,t=this.f;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.ve}get endNode(){return this.yt}ce(i,t=this){i=ge(this,i,t),ci(i)?i===R||i==null||i===""?(this.r!==R&&this.bt(),this.r=R):i!==this.r&&i!==rt&&this.Xs(i):i.Ne!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Js(i)?this.k(i):this.Xs(i);}O(i){return this.ve.parentNode.insertBefore(i,this.yt)}T(i){this.r!==i&&(this.bt(),this.r=this.O(i));}Xs(i){this.r!==R&&ci(this.r)?this.ve.nextSibling.data=i:this.T(me.createTextNode(i)),this.r=i;}$(i){let{values:t,Ne:e}=i,r=typeof e=="number"?this.Rc(i):(e.el===void 0&&(e.el=ui.createElement(en(e.h,e.h[0]),this.options)),e);if(this.r?.Zs===r)this.r.p(t);else {let s=new Zi(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Rc(i){let t=Qs.get(i.strings);return t===void 0&&Qs.set(i.strings,t=new ui(i)),t}k(i){To(this.r)||(this.r=[],this.bt());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(li()),this.O(li()),this,this.options)):e=t[r],e.ce(s),r++;r<t.length&&(this.bt(e&&e.yt.nextSibling,r),t.length=r);}bt(i=this.ve.nextSibling,t){for(this.Ui?.(false,true,t);i!==this.yt;){let e=Gs(i).nextSibling;Gs(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.Ys=i,this.Ui?.(i));}},ve=class{static{a(this,"H");}get tagName(){return this.element.tagName}get W(){return this.f.W}constructor(i,t,e,r,s){this.type=1,this.r=R,this.le=void 0,this.element=i,this.name=t,this.f=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=R;}ce(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=ge(this,i,t,0),n=!ci(i)||i!==this.r&&i!==rt,n&&(this.r=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=ge(this,l[e+c],t,c),u===rt&&(u=this.r[c]),n||=!ci(u)||u!==this.r[c],u===R?i=R:i!==R&&(i+=(u??"")+s[c+1]),this.r[c]=u;}n&&!r&&this.j(i);}j(i){i===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Yi=class extends ve{static{a(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===R?void 0:i;}},Xi=class extends ve{static{a(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==R);}},Qi=class extends ve{static{a(this,"z");}constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}ce(i,t=this){if((i=ge(this,i,t,0)??R)===rt)return;let e=this.r,r=i===R&&e!==R||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==R&&(e===R||r);r&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},Ji=class{static{a(this,"Z");}constructor(i,t,e){this.element=i,this.type=6,this.le=void 0,this.f=t,this.options=e;}get W(){return this.f.W}ce(i){ge(this,i);}},on={I:Me},Kl=yo.litHtmlPolyfillSupport;Kl?.(ui,Me),(yo.litHtmlVersions??=[]).push("3.3.2");var sn=a((o,i,t)=>{let e=t?.renderBefore??i,r=e.Uc;if(r===void 0){let s=t?.renderBefore??null;e.Uc=r=new Me(i.insertBefore(li(),s),s,void 0,t??{});}return r.ce(o),r},"D");var Co=globalThis,Et=class extends Bt{static{a(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.Zr=void 0;}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this.Zr=sn(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.Zr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.Zr?.setConnected(false);}render(){return rt}};Et.jp=true,Et.finalized=true,Co.litElementHydrateSupport?.({LitElement:Et});var jl=Co.litElementPolyfillSupport;jl?.({LitElement:Et});(Co.litElementVersions??=[]).push("4.2.2");var Gl=/\\([0-9a-fA-F]{1,6} ?)/g;function ql(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}a(ql,"hasLeadingTrailingQuotes");function Wl(o){let i=o;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}a(Wl,"trimQuotes");function Zl(o){let i="",t="";for(let e=0;e<o.length;e++){let r=o[e+1];o[e]==="\\"&&r==='"'?(i+='\\"',e++):o[e]==='"'&&t!=="\\"?i+='\\"':i+=o[e],t=o[e]??"";}return i}a(Zl,"escapeQuotes");function nn(o){let i=o;ql(o)&&(i=Wl(i),i=i.replace(Gl,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Zl(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}a(nn,"parseCssPropertyValue");function Ie(o){class i extends o{constructor(){super(...arguments);this.Qs=null;this.Yr=null;}static{a(this,"CssDataMixinClass");}getCssData(r,s=false){let n=this.Qs??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.Yr||(this.Yr=window.getComputedStyle(this));let l=this.Yr.getPropertyValue(r).trim();try{n[r]=nn(l);}catch(c){s||console.warn(`CSS Data error: ${r}`,c),n[r]=null;}}return this.Qs=n,n[r]}}return i}a(Ie,"CssDataMixin");function tr(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Ve={};this._e=null;this.$i=false;}static{a(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this._e||(this._e=Array.from(this.childNodes)),super.connectedCallback();}$c(){if(this.$i)return;this.$i=true,this.Ve={};let r=Array.from(this.childNodes),s=r.length?r:this._e??[];for(let n of s){let l=this.Js(n),c=this.Ve[l]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),c.push(n),this.Ve[l]=c;}this._e=null;}Js(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.Js(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Dc(r){return !r.textContent||!r.textContent.trim()}Fc(r){let s=this.Ve[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Dc(n))}update(r){!this.hasUpdated&&this.willYield&&this.$c(),super.update(r);}yield(r,s){if(r===""&&!this.Ve[r]&&!this.$i&&this._e?.length){let l=[];for(let c of this._e)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Ve[r]=l,this.$i=true,this._e=null;}let n=this.Ve[r];return y` ${n} ${this.Fc(r)?s:void 0} `}}return i}a(tr,"LightDomMixin");function Oe(o){class i extends o{static{a(this,"RegisterableElementMixinClass");}static reg(e){let r=this,s=window.customElements.get(e);if(s){s!==r&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,r);}}return i}a(Oe,"RegisterableElementMixin");var Jt=class extends Event{static{a(this,"s");}constructor(i,t,e,r){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=r??false;}};var Pe=class{static{a(this,"s");}constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Jt(this.context,this.host,this.t,this.subscribe));}};var er=class{static{a(this,"s");}get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:a(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var xo=class extends Event{static{a(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Le=class extends er{static{a(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=r=>{if(r.context!==this.context)return;let s=r.contextTarget??r.composedPath()[0];s!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,s,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:l}]of this.subscriptions)s.has(n)||(s.add(n),l.dispatchEvent(new Jt(this.context,l,n,true)));r.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new xo(this.context,this.host));}};var Xl={attribute:true,type:String,converter:ni,reflect:false,hasChanged:qi},Ql=a((o=Xl,i,t)=>{let{kind:e,metadata:r}=t,s=globalThis.litPropertyMetadata.get(r);if(s===void 0&&globalThis.litPropertyMetadata.set(r,s=new Map),e==="setter"&&((o=Object.create(o)).wrapped=true),s.set(t.name,o),e==="accessor"){let{name:n}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(n,c,o,true,l);},init(l){return l!==void 0&&this.C(n,void 0,o,l),l}}}if(e==="setter"){let{name:n}=t;return function(l){let c=this[n];i.call(this,l),this.requestUpdate(n,c,o,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(o){return (i,t)=>typeof t=="object"?Ql(o,i,t):((e,r,s)=>{let n=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}a(b,"n");function g(o){return b({...o,state:true,attribute:false})}a(g,"r");function D(o,i){let t,e=a(((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}a(D,"debounce");var an="ctx-name-context";function rr(){return function(o){class i extends o{constructor(...r){super(...r);this.ee=null;this.Zt=false;this.Xr=false;this.Qr=void 0;this.wt=new Map;this.Yt=new Set;this.init$={};this.ctxOwner=false;this.Di=void 0;this.Fi=false;this.ctxName=this.Ae;this.ke=false;this.Di=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Ae,this.Nc=new Pe(this,{context:an,callback:a(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.rn=s,this.tn();},"callback"),subscribe:true});}static{a(this,"SymbioteMixinClass");}static set template(r){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get en(){return this.Di}set en(r){let s=r??void 0;this.Di!==s&&(this.Di=s,this.tn());}shouldUpdate(r){return this.ke?super.shouldUpdate(r):false}get Ae(){return this.en||this.rn||void 0}tn(){if(this.ctxName=this.Ae,!(!this.ctxName||this.Zt)){if(this.isConnected){this.Jr();return}this.Fi=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Ae,this.ctxName&&(this.Qr?this.Qr.setValue(this.ctxName):this.Qr=new Le(this,{context:an,initialValue:this.ctxName}));}sn(){if(!(!this.ee||this.wt.size===0)){for(let[r,{value:s,rewrite:n}]of this.wt)this.ee.add(r,s,n);this.wt.clear();}}nn(){return !this.ee&&this.Ae&&this.eo(),this.ee&&this.sn(),this.ee}Ni(){let r=this.nn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}eo(){let r=this.init$,s=this.Ae;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.ee){this.ee=K.getCtx(s)??K.registerCtx(r,s);for(let[n,l]of Object.entries(this.init$))this.ee.add(n,l,this.ctxOwner);this.sn();}}get $(){return this.Ae&&this.eo(),new Proxy({},{get:a((r,s)=>{if(typeof s=="string")return this.ee?.read(s)},"get"),set:a((r,s,n)=>(typeof s!="string"||this.ee?.pub(s,n),true),"set")})}sub(r,s,n=true){let l=this.Ni().sub(r,s,n);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=a(()=>{u||(u=true,c(),this.Yt.delete(p));},"trackedRemove");return this.Yt.add(p),p}pub(r,s){this.Ni().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.Ni()}has(r){return this.ee?.has(r)??false}add(r,s,n=false){let l=this.nn();if(!l){if(!n&&this.wt.has(r))return;this.wt.set(r,{value:s,rewrite:n});return}this.wt.delete(r),l.add(r,s,n);}add$(r,s=false){for(let[n,l]of Object.entries(r))this.add(n,l,s);}connectedCallback(){super.connectedCallback(),this.Zt?this.ke&&this.Xr&&(this.Xr=false,this.initCallback()):this.ctxName?(this.Fi=false,this.Jr()):this.Fi&&this.Ae&&(this.Fi=false,this.Jr());}Jr(){if(this.Zt)return;this.Zt=true,this.eo();let r=this.init$;if(Object.keys(r).length>0){let s=this.Ni();for(let[n,l]of Object.entries(r))s.read(n)===void 0&&s.pub(n,l),this.sub(n,D(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.ke=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.Vc(),super.disconnectedCallback(),this.Zt&&(this.Xr=true);}Vc(){if(this.Yt.size!==0){for(let r of [...this.Yt])r();this.Yt.clear();}}initCallback(){}}return h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"en",1),h([g()],i.prototype,"rn",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"ke",2),i}}a(rr,"SymbioteMixin");var So=class extends Oe(rr()(Ie(tr(Et)))){static{a(this,"BaseComponent");}};var mt=class o{static{a(this,"UID");}static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():o.generateFastUid()}};var Jl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function gt(o){for(let i in o){if(Jl.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r=`-${r.toLowerCase()}`),e+=r,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[i].reg&&o[i].reg(t);}}a(gt,"defineComponents");var Ao="UC";function tc(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Ao]){t(window[Ao]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[Ao];i&&gt(s),t(s);},document.head.appendChild(r);})}a(tc,"loadFileUploaderFrom");var di={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var ko=new Map,ln=new Map,cn=a((o,i)=>{ko.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...di,...i};return ko.set(o,t),t},"defineLocaleSync"),ec=a((o,i)=>{ln.set(o,i);},"defineLocaleAsync"),un=a((o,i)=>{typeof i=="function"?ec(o,i):cn(o,i);},"defineLocale"),dn=a(async o=>{let i=ko.get(o);if(!i){let t=ln.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=cn(o,e);}return i},"resolveLocaleDefinition");un("en",di);var k=a(o=>`*cfg/${o}`,"sharedConfigKey");var j=a(o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),Kt=a(o=>o.join(","),"serializeCsv");var pn=a(o=>{if(typeof o!="string"||!o)return "";let i=o.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),or=a((...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>pn(i)).join("/-/"),"joinCdnOperations"),ot=a((...o)=>{let i=or(...o);return i?`-/${i}/`:""},"createCdnUrlModifiers");function sr(o){let i=new URL(o),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):r>=0&&(s=t.slice(r+1)),s}a(sr,"extractFilename");function nr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}a(nr,"extractUuid");function Mo(o){let i=hn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}a(Mo,"extractCdnUrlModifiers");function Io(o){return Mo(o).split("/-/").filter(Boolean).map(t=>pn(t))}a(Io,"extractOperations");function hn(o){let i=new URL(o),t=sr(o),e=fn(t)?mn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}a(hn,"trimFilename");function fn(o){return o.startsWith("http")}a(fn,"isFileUrl");function mn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}a(mn,"splitFileUrl");var Z=a((o,i,t)=>{let e=new URL(hn(o)),r=t??sr(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&fn(r)){let n=mn(r);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},"createCdnUrl"),te=a((o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var Y=a((o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var pi=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),vn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function ic(o,i){if(typeof i=="number"){let t=i;return pi[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return pi[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return pi.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}a(ic,"transformationToStr");function ee(o){return or(...vn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return ic(i,t)}).filter(i=>!!i))}a(ee,"transformationsToOperations");var ar=or("format/auto","progressive/yes"),jt=a(([o])=>typeof o<"u"?Number(o):void 0,"asNumber"),gn=a(()=>true,"asBoolean"),rc=a(([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),"asFilter"),oc=a(([o,i])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Y(o,"x").map(Number),coords:Y(i).map(Number)}},"asCrop"),sc=Object.freeze({enhance:jt,brightness:jt,exposure:jt,gamma:jt,contrast:jt,saturation:jt,vibrance:jt,warmth:jt,filter:rc,mirror:gn,flip:gn,rotate:jt,crop:a(o=>{let[i,t]=o,{dimensions:e,coords:r}=oc([i,t]);return {dimensions:e,coords:r}},"crop")});function Oo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!vn.includes(e))continue;let s=e,n=sc[s];try{let l=n(r);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}a(Oo,"operationsToTransformations");var H=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),st=Object.freeze([H.CROP,H.TUNING,H.FILTERS]),yn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),bn=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),wn=Object.freeze(["rotate","mirror","flip"]),Gt=pi,Mt=Object.freeze({brightness:{zero:Gt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Gt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Gt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Gt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Gt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Gt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Gt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Gt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Gt.filter,range:[0,100],keypointsNumber:1}});var hi="https://ucarecdn.com",nc="https://upload.uploadcare.com",ac="https://social.uploadcare.com",lc="https://ucarecd.net",cc={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:hi,cdnCnamePrefixed:lc,baseUrl:nc,socialBaseUrl:ac,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:Kt(st),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[]},tt=Object.freeze(cc);var lr=a((o,i)=>(...t)=>{let e=o();if(!e.read(k("debug")))return;let r=t;if(typeof t?.[0]=="function"){let n=t[0];r=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...r);},"createDebugPrinter");var G=class{constructor(i){this.to=new Set;this.Be=null;this.w=lr(()=>this.i.ctx,this.constructor.name);this.i=i,this.e=i.ctx;}static{a(this,"SharedInstance");}addSub(i){this.to.add(i);}get ze(){if(!this.Be){let i={};this.Be=new Proxy(i,{set:a(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:a((t,e)=>{if(typeof e!="string")return;let r=k(e);return this.i.ctx.has(r)?this.i.ctx.read(r):tt[e]},"get")});}return this.Be}destroy(){for(let i of this.to)try{i();}catch{}this.to.clear();}},uc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},It=a((o,i,t=true)=>{let e=o.has(i),r=e?o.read(i):null;if(e&&r||!t)return r;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},"getSharedInstance"),Tn=a(o=>({get ctx(){return o()},get modalManager(){return It(o(),"*modalManager",false)},get pluginManager(){return It(o(),"*pluginManager")},get telemetryManager(){return It(o(),"*telemetryManager")},get localeManager(){return It(o(),"*localeManager")},get a11y(){return It(o(),"*a11y")},get blocksRegistry(){return It(o(),"*blocksRegistry")},get eventEmitter(){return It(o(),"*eventEmitter")},get uploadCollection(){return It(o(),"*uploadCollection")},get secureUploadsManager(){return It(o(),"*secureUploadsManager",false)},get api(){return It(o(),"*publicApi")},get validationManager(){return It(o(),"*validationManager")},when(i,t){let e=uc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n;return n=r.sub(e,l=>{l&&(t(l),n?.());}),n},wait(i){return new Promise(t=>{let e;e=this.when(i,r=>{t(r),e?.();});})}}),"createSharedInstancesBag");var X=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),cr=class extends G{constructor(){super(...arguments);this.He=new Map;this.ue=new Set;this.c=new Map;}static{a(this,"ModalManager");}registerModal(t,e){this.He.set(t,e),this.q(X.ADD,{id:t,modal:e});}deleteModal(t){let e=this.He.get(t);return e?(this.He.delete(t),this.ue.delete(t),this.q(X.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.He.get(t);return e?(this.ue.add(t),this.q(X.OPEN,{modal:e,id:t}),true):(this.w(`Modal with ID "${t}" not found`),false)}close(t){let e=this.He.get(t);return !e||!this.ue.has(t)?(this.w(`Modal with ID "${t}" not found or not active`),false):(this.ue.delete(t),this.q(X.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.He.has(t)?this.ue.has(t)?this.close(t):this.open(t):(this.w(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.ue.size>0}back(){if(this.ue.size===0)return this.w("No active modals to go back from"),false;let t=Array.from(this.ue).pop();return t?this.close(t):false}closeAll(){let t=this.ue.size;return this.ue.clear(),this.q(X.CLOSE_ALL,{}),t}subscribe(t,e){return this.c.has(t)||this.c.set(t,new Set),this.c.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.c.has(t)&&this.c.get(t)?.delete(e);}q(t,e){if(this.c.has(t))for(let r of this.c.get(t)??new Set)try{r(e);}catch(s){this.i.telemetryManager.sendEventError(s,"modal subscriber"),this.w("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.He.clear(),this.c.clear(),this.q(X.DESTROY,{});}};var ur=a(o=>o.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-"),"toKebabCase");function En(o){return Object.prototype.toString.call(o)==="[object Object]"}a(En,"isObject");var dc=/\W|_/g;function pc(o){return o.split(dc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}a(pc,"camelizeString");function Cn(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>Wt(t,{ignoreKeys:i})):o}a(Cn,"camelizeArrayItems");function Wt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Cn(o,{ignoreKeys:i});if(!En(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}En(r)?r=Wt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Cn(r,{ignoreKeys:i})),t[pc(e)]=r;}return t}a(Wt,"camelizeKeys");var hc=a(o=>new Promise(i=>setTimeout(i,o)),"delay");function Fo({libraryName:o,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:o,libraryVersion:i,languageName:s,integration:r});let n=[o,i,e].filter(Boolean).join("/"),l=[s,r].filter(Boolean).join("; ");return `${n} (${l})`}a(Fo,"getUserAgent$1");var fc={factor:2,time:100};function mc(o,i=fc){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a(l=>hc(l??s).then(()=>(t+=1,e(r))),"retry")})}return a(e,"runAttempt"),e(o)}a(mc,"retrier");var ye=class extends Error{static{a(this,"UploadcareError");}},Ue=class o extends ye{static{a(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},dr=a((o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),ie=class o extends ye{static{a(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},gc=500,Sn=a(({check:o,interval:i=gc,timeout:t,signal:e})=>new Promise((r,s)=>{let n,l;dr(e,()=>{n&&clearTimeout(n),s(new ie("Poll cancelled"));}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),s(new ie("Timed out"));},t));let c=a(()=>{try{Promise.resolve(o(e)).then(u=>{u?(l&&clearTimeout(l),r(u)):n=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");n=setTimeout(c,0);}),"poll"),U={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},pr="application/octet-stream",An="original",oe=a(({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=o?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[f,m]=d;typeof m<"u"&&!Array.isArray(m)&&c.setRequestHeader(f,m);}),c.responseType="text",dr(r,()=>{p=true,c.abort(),l(new ie);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(T){let C=T.split(": "),E=C.shift(),A=C.join(": ");E&&typeof E<"u"&&(m[E]=A);});let v=c.response,w=c.status;n({request:d,data:v,headers:m,status:w});}},c.onerror=d=>{p||l(new Ue(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function vc(o,...i){return o}a(vc,"identity");var yc=a(({name:o})=>o?[o]:[],"getFileOptions"),bc=vc,wc=a(()=>new FormData,"getFormData"),kn=a(o=>false,"isBuffer"),hr=a(o=>typeof Blob<"u"&&o instanceof Blob,"isBlob"),fr=a(o=>typeof File<"u"&&o instanceof File,"isFile"),mr=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string","isReactNativeAsset"),Re=a(o=>hr(o)||fr(o)||kn()||mr(o),"isFileData"),Tc=a(o=>typeof o=="string"||typeof o=="number"||typeof o>"u","isSimpleValue"),Ec=a(o=>!!o&&typeof o=="object"&&!Array.isArray(o),"isObjectValue"),Cc=a(o=>!!o&&typeof o=="object"&&"data"in o&&Re(o.data),"isFileValue");function Mn(o,i,t){if(Array.isArray(t))for(let e of t)Mn(o,`${i}[]`,e);else if(Cc(t)){let{name:e,contentType:r}=t,s=bc(t.data,e,r??pr),n=yc({name:e,contentType:r});o.push([i,s,...n]);}else if(Ec(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Tc(t)&&t&&o.push([i,t.toString()]);}a(Mn,"collectParams");function xc(o){let i=[];for(let[t,e]of Object.entries(o))Mn(i,t,e);return i}a(xc,"getFormDataParams");function gr(o){let i=wc(),t=xc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}a(gr,"buildFormData");var nt=class o extends ye{static{a(this,"UploadError");}code;request;response;headers;constructor(i,t,e,r,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=r,this.headers=s,Object.setPrototypeOf(this,o.prototype);}},Sc=a(o=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(o))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>r[1]??false).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),qt=a((o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Sc(t)),e.toString()},"getUrl"),Ac="6.18.4",kc="UploadcareUploadClient",Mc=Ac;function we(o){return Fo({libraryName:kc,libraryVersion:Mc,...o})}a(we,"getUserAgent");var Ic="RequestThrottledError",xn=15e3,Oc=1e3;function Pc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return xn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:xn}a(Pc,"getTimeoutFromThrottledRequest");function se(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return mc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Ic&&r<t)return s(Pc(n));if(n instanceof Ue&&r<e)return s((r+1)*Oc);throw n}))}a(se,"retryIfFailed");var In=a(o=>{let i="";return (hr(o)||fr(o)||mr(o))&&(i=o.type),i||pr},"getContentType"),On=a(o=>{let i="";return fr(o)&&o.name?i=o.name:hr(o)||kn()?i="":mr(o)&&o.name&&(i=o.name),i||An},"getFileName");function Vo(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}a(Vo,"getStoreValue");function Lc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=U.baseURL,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return se(()=>oe({method:"POST",url:qt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:f})},data:gr({file:{data:o,name:t||On(o),contentType:e||In(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Vo(l),signature:s,expire:n,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:T,headers:C,request:E})=>{let A=Wt(JSON.parse(T));if("error"in A)throw new nt(A.error.content,A.error.errorCode,E,A,C);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Lc,"base");var Uo;(function(o){o.Token="token",o.FileInfo="file_info";})(Uo||(Uo={}));function Uc(o,{publicKey:i,baseURL:t=U.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return se(()=>oe({method:"POST",headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:f})},url:qt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Vo(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:T,headers:C,request:E})=>{let A=Wt(JSON.parse(T));if("error"in A)throw new nt(A.error.content,A.error.errorCode,E,A,C);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:m})}a(Uc,"fromUrl");var ut;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(ut||(ut={}));var Rc=a(o=>"status"in o&&o.status===ut.Error,"isErrorResponse");function $c(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=U.retryNetworkErrorMaxTimes}={}){return se(()=>oe({method:"GET",headers:i?{"X-UC-User-Agent":we({publicKey:i,integration:r,userAgent:s})}:void 0,url:qt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=Wt(JSON.parse(c));if("error"in d&&!Rc(d))throw new nt(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a($c,"fromUrlStatus");function Dc(o,{publicKey:i,baseURL:t=U.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=U.retryNetworkErrorMaxTimes}){return se(()=>oe({method:"POST",headers:{"X-UC-User-Agent":we({publicKey:i,integration:c,userAgent:u})},url:qt(t,"/group/",{jsonerrors:1}),data:gr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:l}),signal:n}).then(({data:f,headers:m,request:v})=>{let w=Wt(JSON.parse(f));if("error"in w)throw new nt(w.error.content,w.error.errorCode,v,w,m);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}a(Dc,"group");function Pn(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=U.retryNetworkErrorMaxTimes}){return se(()=>oe({method:"GET",headers:{"X-UC-User-Agent":we({publicKey:i,integration:s,userAgent:n})},url:qt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:u,headers:p,request:d})=>{let f=Wt(JSON.parse(u));if("error"in f)throw new nt(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Pn,"info");function Fc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=U.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=U.retryNetworkErrorMaxTimes,metadata:w}){return se(()=>oe({method:"POST",url:qt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:f})},data:gr({filename:e||An,size:o,content_type:t||pr,part_size:r,UPLOADCARE_STORE:Vo(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:p,metadata:w}),signal:u}).then(({data:T,headers:C,request:E})=>{let A=Wt(JSON.parse(T));if("error"in A)throw new nt(A.error.content,A.error.errorCode,E,A,C);return A.parts=Object.keys(A.parts).map(wt=>A.parts[Number(wt)]),A}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})}a(Fc,"multipartStart");function Vc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=U.retryNetworkErrorMaxTimes}){return se(()=>oe({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||pr}}).then(l=>(r&&r({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}a(Vc,"multipartUpload");function Nc(o,{publicKey:i,baseURL:t=U.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=U.retryNetworkErrorMaxTimes}){return se(()=>oe({method:"POST",url:qt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:s,userAgent:n})},data:gr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:u,headers:p,request:d})=>{let f=Wt(JSON.parse(u));if("error"in f)throw new nt(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Nc,"multipartComplete");function No(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return Sn({check:a(p=>Pn(o,{publicKey:i,baseURL:t,signal:p,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}a(No,"isReadyPoll");function _c(o){return "defaultEffects"in o}a(_c,"isGroupFileInfo");var be=class{static{a(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=U.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=qt(t,`${r}/`),l=s?qt(`https://${s}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=l,_c(i)&&(this.defaultEffects=i.defaultEffects);}},zc=a((o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:T})=>Lc(o,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:T}).then(({file:C})=>No(C,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(C=>new be(C,{baseCDN:w})),"uploadDirect"),Bc=a((o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>Pn(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new be(f,{baseCDN:d,fileName:t})).then(f=>(s&&s({isComputable:true,value:1}),f)),"uploadFromUploaded"),Hc=a((o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=a(n=>()=>{e=n,r.forEach((l,c)=>c!==n&&l.abort());},"createStopRaceCallback");return dr(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,l)=>{let c=s(l);return Promise.resolve().then(()=>n({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),Kc=window.WebSocket,Ro=class{static{a(this,"Events");}events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},jc=a((o,i)=>o==="success"?{status:ut.Success,...i}:o==="progress"?{status:ut.Progress,...i}:{status:ut.Error,...i},"response"),$o=class{static{a(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Ro;disconnectTimeoutId=null;constructor(i,t=3e4){this.key=i,this.disconnectTime=t;}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Kc(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message));}),this.emmitter.on("connected",()=>{this.isConnected=true,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[];}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case "pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case "pusher:ping":{this.send("pusher:pong",{});break}case "progress":case "success":case "fail":this.emmitter.emit(e.channel,jc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=a(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Po=null,_o=a(o=>{if(!Po){let i=typeof window>"u"?0:3e4;Po=new $o(o,i);}return Po},"getPusher"),Gc=a(o=>{_o(o).connect();},"preconnect");function qc({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return Sn({check:a(u=>$c(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case ut.Error:return new nt(p.error,p.errorCode);case ut.Waiting:return false;case ut.Unknown:return new nt(`Token "${o}" was not found.`);case ut.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case ut.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}a(qc,"pollStrategy");var Wc=a(({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=_o(i),l=n.onError(s),c=a(()=>{l(),n.unsubscribe(o);},"destroy");dr(t,()=>{c(),s(new ie("pusher cancelled"));}),n.subscribe(o,u=>{switch(u.status){case ut.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case ut.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),r(u);break}case ut.Error:c(),s(new nt(u.msg,u.error_code));}});}),"pushStrategy"),Zc=a((o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:T=U.pusherKey,metadata:C})=>Promise.resolve(Gc(T)).then(()=>Uc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:f,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:C})).catch(E=>(_o(T)?.disconnect(),Promise.reject(E))).then(E=>E.type===Uo.FileInfo?E:Hc([({signal:A})=>qc({token:E.token,publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:A}),({signal:A})=>Wc({token:E.token,pusherKey:T,signal:A,onProgress:d})],{signal:p})).then(E=>{if(E instanceof nt)throw E;return E}).then(E=>No(E.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(E=>new be(E,{baseCDN:r})),"uploadFromUrl"),Lo=new WeakMap,Yc=a(async o=>{if(Lo.has(o))return Lo.get(o);let i=await fetch(o.uri).then(t=>t.blob());return Lo.set(o,i),i},"getBlobFromReactNativeAsset"),Ln=a(async o=>{if(fr(o)||hr(o))return o.size;if(mr(o))return (await Yc(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Xc=a((o,i=U.multipartMinFileSize)=>o>=i,"isMultipart"),Un=a(o=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !Re(o)&&t.test(o)},"isUuid"),zo=a(o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Re(o)&&t.test(o)},"isUrl"),Qc=a((o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,l=[...i],c=a(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(r[u]=d,n-=1,n?c():t(r));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<o;u++)c();}),"runWithConcurrency"),Jc=a((o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},"sliceChunk"),tu=a(async(o,i,t)=>e=>Jc(o,e,i,t),"prepareChunks"),eu=a((o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Vc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),iu=a(async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:T=U.multipartChunkSize,maxConcurrentRequests:C=U.maxConcurrentRequests,baseCDN:E,metadata:A})=>{let wt=e??await Ln(o),Tt,pe=a((J,ct)=>{if(!u)return;Tt||(Tt=Array(J).fill(0));let At=a(Ut=>Ut.reduce((zt,po)=>zt+po,0),"sum");return Ut=>{Ut.isComputable&&(Tt[ct]=Ut.value,u({isComputable:true,value:At(Tt)/J}));}},"createProgressHandler");return w||=In(o),Fc(wt,{publicKey:i,contentType:w,fileName:t||On(o),baseURL:r,secureSignature:s,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,metadata:A,multipartChunkSize:T}).then(async({uuid:J,parts:ct})=>{let At=await tu(o,wt,T);return Promise.all([J,Qc(C,ct.map((Ut,zt)=>()=>eu(At(zt),Ut,{publicKey:i,contentType:w,onProgress:pe(ct.length,zt),signal:c,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})))])}).then(([J])=>Nc(J,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v})).then(J=>J.isReady?J:No(J.uuid,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(J=>new be(J,{baseCDN:E}))},"uploadMultipart");async function Bo(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartMinFileSize:w,multipartChunkSize:T,maxConcurrentRequests:C,baseCDN:E=U.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:wt,pusherKey:Tt,metadata:pe}){if(Re(o)){let J=await Ln(o);return Xc(J,w)?iu(o,{publicKey:i,contentType:v,multipartChunkSize:T,fileSize:J,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:pe}):zc(o,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:pe})}if(zo(o))return Zc(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:E,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:wt,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,pusherKey:Tt,metadata:pe});if(Un(o))return Bc(o,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:E});throw new TypeError(`File uploading from "${o}" is not supported`)}a(Bo,"uploadFile");var ru=a((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return o}},"replaceUrlBase"),Do=class{static{a(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=U.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,s)=>r+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=ru(i.cdnUrl,t),this.files=e.map(r=>new be(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},ou=a(o=>{for(let i of o)if(!Re(i))return false;return true},"isFileDataArray"),su=a(o=>{for(let i of o)if(!Un(i))return false;return true},"isUuidArray"),nu=a(o=>{for(let i of o)if(!zo(i))return false;return true},"isUrlArray");function Rn(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w=U.multipartChunkSize,baseCDN:T=U.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E,jsonpCallback:A}){if(!ou(o)&&!nu(o)&&!su(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let wt,Tt=true,pe=o.length,J=a((ct,At)=>{if(!c)return;wt||(wt=Array(ct).fill(0));let Ut=a(zt=>zt.reduce((po,Ll)=>po+Ll)/ct,"normalize");return zt=>{if(!zt.isComputable||!Tt){Tt=false,c({isComputable:false});return}wt[At]=zt.value,c({isComputable:true,value:Ut(wt)});}},"createProgressHandler");return Promise.all(o.map((ct,At)=>Re(ct)||zo(ct)?Bo(ct,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:J(pe,At),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:v,multipartChunkSize:w,baseCDN:T,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E}).then(Ut=>Ut.uuid):ct)).then(ct=>Dc(ct,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:r,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m}).then(At=>new Do(At,{baseCDN:T})).then(At=>(c&&c({isComputable:true,value:1}),At)))}a(Rn,"uploadFileGroup");var re=class{static{a(this,"Queue");}Vi=1;io=[];_i=0;ro=new Map;oo=new Map;constructor(i){this.Vi=i;}run(){let i=this.Vi-this._i;for(let t=0;t<i;t++){let e=this.io.shift();if(!e)return;let r=this.ro.get(e),s=this.oo.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._i+=1,e().finally(()=>{this.ro.delete(e),this.oo.delete(e),this._i-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.ro.set(i,e),this.oo.set(i,r),this.io.push(i),t&&this.run();})}get pending(){return this.io.length}get running(){return this._i}set concurrency(i){this.Vi=i,this.run();}get concurrency(){return this.Vi}};var Ho=a(()=>({}),"blockCtx"),Ko=a(o=>({...Ho(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":a(()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),jo=a(o=>({...Ko(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new re(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),$n=a(o=>({...jo(o),"*solution":null,"*lazyPlugins":null}),"solutionBlockCtx");var V=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var vr=class extends G{constructor(t){super(t);this.scopes=new Set;this.listener=this._c.bind(this),window.addEventListener("paste",this.listener);}static{a(this,"ClipboardLayer");}openUploadList(){this.i.api.setCurrentActivity(V.UPLOAD_LIST),this.i.api.setModalState(true);}async _c(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this.ze.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),r=e.map(n=>n.getAsFile()).filter(n=>n!==null),s=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(l=>{n.getAsString(c=>{l(c);});}));r.length>0&&(r.forEach(n=>{this.i.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(l=>{this.i.api.addFileFromUrl(l,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var au={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function fi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}a(fi,"focus");function Go(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=au[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}a(Go,"findGroupNodeByEventTarget");function qo(o,i){return i.role==="toolbar"?cu(i):i.querySelectorAll(`[role=${o.role}]`)}a(qo,"getItems");function lu(o,i){return Array.from(o).filter(t=>{let e=t.parentElement;for(;e&&e!==i;){if(e.getAttribute("aria-hidden")==="true")return false;e=e.parentElement;}return true})}a(lu,"filterNested");function cu(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}a(cu,"getToolbarItems");function uu(o){let i=o.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=o.role;return t==="menubar"||t==="tablist"||t==="toolbar"}a(uu,"isHorizontalOrientation");function Dn(o){return i=>{let t=false,e=o?.searchDelayMs||300,r=0,s="";function n(d){let f=Go(d.target);if(!f){l();return}let m=qo(d.target,f),v=lu(m,f),w=Array.from(v).indexOf(d.target),T="ArrowDown",C="ArrowUp";if(uu(f)&&(i.document.dir==="rtl"?(T="ArrowLeft",C="ArrowRight"):(T="ArrowRight",C="ArrowLeft")),d.key===T)d.preventDefault(),fi(d.target,v[w+1]||v[0]);else if(d.key===C)d.preventDefault(),fi(d.target,v[w-1]||v[v.length-1]);else if(d.key==="Home")d.preventDefault(),fi(d.target,v[0]);else if(d.key==="End")d.preventDefault(),fi(d.target,v[v.length-1]);else if(d.key.length===1&&f.role!=="tablist"){d.timeStamp-r<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),r=d.timeStamp;let E=Array.from(m).find(A=>A.textContent?.trim()?.toLowerCase()?.startsWith(s));E&&(d.preventDefault(),fi(d.target,E));}}a(n,"keyDown");function l(){t=false,i.removeEventListener("keydown",n);}a(l,"stop");function c(d){let f=Go(d.target);if(f){t||(t=true,i.addEventListener("keydown",n));let m=qo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}a(u,"focusOut");function p(d){let f=Go(d.target);if(f){let m=qo(d.target,f);for(let v of m)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return a(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}a(Dn,"focusGroupKeyUX");function Fn(){return o=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}a(e,"jump");function r(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return a(r,"focusOut"),o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}a(Fn,"hiddenKeyUX");function Vn(){return o=>{let i=[];function t(c){let u=o.document.activeElement;u&&u!==o.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}a(t,"focus");function e(){let c=i.pop();if(!c){o.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}a(e,"back");let r=0,s;function n(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let p=o.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}a(n,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e();}return a(l,"keyDown"),o.addEventListener("keydown",l),()=>{o.removeEventListener("keydown",l);}}}a(Vn,"jumpKeyUX");function Nn(o){let i,t=o.split(" "),e;function r(l){(l.key==="Enter"||l.key===" ")&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}a(r,"keyDown");function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}a(s,"keyUp");function n(l){l.clientX===0&&l.clientY===0&&i!==l.target&&(s(),e!==l.target&&(l.target.classList.add(...t),i=l.target));}return a(n,"click"),l=>(l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",n),l.removeEventListener("keydown",r),l.removeEventListener("keyup",s);})}a(Nn,"pressKeyUX");function _n(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}a(_n,"startKeyUX");var Wo=class{constructor(){this.te=new Map;this.so=[];}static{a(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=a(r=>{let s=r.target;s instanceof Node&&this.so.some(n=>n===s||n.contains(s))&&t(r);},"wrappedListener");this.te.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.te.get(t);e&&window.removeEventListener(i,e),this.te.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.so.push(i);}destroy(){this.so=[];for(let i of this.te.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.te.clear();}},yr=class{static{a(this,"A11y");}constructor(){this.Bi=new Wo,this.an=_n(this.Bi,[Dn(),Nn("is-pressed"),Vn(),Fn()]);}registerBlock(i){this.Bi.registerScope(i);}destroy(){this.an?.(),this.Bi.destroy();}};var Zt=a(o=>`*l10n/${o}`,"localeStateKey"),du="en",br=class extends G{constructor(t){super(t);this.Tt="";for(let[r,s]of Object.entries(di)){let n=this.e.has(Zt(r))?!this.e.read(Zt(r)):true;this.e.add(Zt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Tt&&this.ln(this.Tt);})),this.addSub(this.e.sub(k("localeName"),async r=>{if(!r)return;this.Tt=r;let s=await dn(r);r!==du&&this.Tt!==r||(this.ln(r),this.cn(r,s));})),this.addSub(this.e.sub(k("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Tt];s&&this.cn(this.Tt,s);}));}static{a(this,"LocaleManager");}cn(t,e){let r=this.ze.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let l=r?.[s];this.e.add(Zt(s),l??n,true);}}ln(t){let e=this.i.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.l10n){let{pluginId:n,...l}=s,c=l[t];if(c)for(let[u,p]of Object.entries(c))p!==void 0&&this.e.add(Zt(u),p,true);}}};var pu=a(()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},"calcIsDesktopSafari"),hu=a(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),fu=a(()=>({safariDesktop:pu()}),"calcBrowserInfo"),mu=a(()=>({htmlMediaCapture:hu()}),"calcBrowserFeatures"),zn=fu(),Bn=mu();var mi="image/*",Zo="video/*",gu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],vu=a(()=>zn.safariDesktop?[mi]:[mi,...gu],"calcImageAcceptList"),gi=vu(),wr=a(o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Y(i)):[],"mergeFileTypes"),Yo=a((o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),"matchMimeType"),Hn=a((o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),$e=a(o=>{let i=o?.type;return i?Yo(i,gi):false},"fileIsImage");function Kn(o,i,t,e,r){return {registry:{registerSource:a(u=>o.addSource(e,u),"registerSource"),registerActivity:a(u=>o.addActivity(e,u),"registerActivity"),registerFileAction:a(u=>o.addFileAction(e,u),"registerFileAction"),registerFileHook:a(u=>o.addFileHook(e,u),"registerFileHook"),registerIcon:a(u=>o.addIcon(e,u),"registerIcon"),registerL10n:a(u=>o.addL10n(e,u),"registerL10n"),registerConfig:a(u=>{o.addConfig(e,u);let p=k(u.name);i.has(p)||i.add(p,u.defaultValue);},"registerConfig")},config:{get:a(u=>{let p=k(u);return i.read(p)},"get"),subscribe:a((u,p)=>{let d=k(u),f=i.sub(d,m=>{p(m);});return r.push(f),f},"subscribe")},activity:{getParams:a(()=>i.read("*currentActivityParams"),"getParams"),subscribeToParams:a(u=>{let p=i.sub("*currentActivityParams",d=>{u(d);});return r.push(p),p},"subscribeToParams")},files:{update:a((u,p)=>{let d=t.uploadCollection?.read(u);d&&(p.file!==void 0&&(d.setValue("file",p.file),d.setValue("fileSize",p.file.size)),p.cdnUrl!==void 0&&d.setValue("cdnUrl",p.cdnUrl),p.cdnUrlModifiers!==void 0&&d.setValue("cdnUrlModifiers",p.cdnUrlModifiers),p.mimeType!==void 0&&d.setValue("mimeType",p.mimeType));},"update")}}}a(Kn,"buildPluginApi");var yu=a(async({entries:o,signal:i})=>(await Promise.all(o.map(async e=>{if(e.isEnabled())try{let r=await e.load();return i.aborted||!e.isEnabled()?void 0:r??void 0}catch(r){i.aborted||console.warn("Failed to load lazy plugin",r);return}}))).filter(e=>e!==void 0),"resolveLazyPlugins"),Tr=class{constructor(i,t){this.e=i;this.zc=t;this.Xt=new Set;this.un=this.e.sub("*lazyPlugins",e=>{this.Bc(e??[]);});}static{a(this,"LazyPluginLoader");}Bc(i){for(let r of this.Xt)r();if(this.Xt.clear(),i.length===0)return;let t=new Set([k("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(k(s));let e=a(()=>this.dn(i),"recompute");for(let r of t)this.Xt.add(this.e.sub(r,e,false));this.dn(i);}dn(i){this.ao?.abort();let t=new AbortController;this.ao=t;let e=a(n=>this.e.read(k(n)),"get"),r=e("plugins"),s=yu({entries:i.map(n=>({isEnabled:a(()=>n.isEnabled(e),"isEnabled"),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.zc(s);}destroy(){this.un();for(let i of this.Xt)i();this.Xt.clear(),this.ao?.abort();}};var Er=class{constructor(){this.Ke=new Map;}static{a(this,"CustomConfigRegistry");}register(i,t){if(this.Ke.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.Ke.set(t.name,e);}unregister(i){this.Ke.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.Ke)e.pluginId===i&&this.Ke.delete(t);}get(i){return this.Ke.get(i)}getAll(){return new Map(this.Ke)}};var Cr=class{constructor(){this.Me=[];this.de=[];this.zi=[];this.Hi=[];this.Ki=[];this.Et=[];this.config=new Er;}static{a(this,"PluginRegistry");}xt(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.Me.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Source with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.Me.push(this.xt(i,t));}addActivity(i,t){let e=this.de.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Activity with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.de.push(this.xt(i,t));}addFileAction(i,t){this.zi.push(this.xt(i,t));}addFileHook(i,t){this.Hi.push(this.xt(i,{timeout:3e4,...t}));}addIcon(i,t){this.Ki.push(this.xt(i,t));}addL10n(i,t){this.Et.push(this.xt(i,t));}addConfig(i,t){this.config.register(i,t);}purge(i){this.Me=this.Me.filter(t=>t.pluginId!==i),this.de=this.de.filter(t=>t.pluginId!==i),this.zi=this.zi.filter(t=>t.pluginId!==i),this.Hi=this.Hi.filter(t=>t.pluginId!==i),this.Ki=this.Ki.filter(t=>t.pluginId!==i),this.Et=this.Et.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.Me],activities:[...this.de],fileActions:[...this.zi],fileHooks:[...this.Hi],icons:[...this.Ki],l10n:[...this.Et]}}};var xr=class extends G{constructor(t){super(t);this.je=new Map;this.c=new Set;this.lo=Promise.resolve();this.registry=new Cr;this.pn=new Tr(this.e,e=>{this.lo=this.lo.then(()=>e).then(r=>{if(r)return this.Hc(r)});});}static{a(this,"PluginManager");}get configRegistry(){return this.registry.config}pluginsReady(){return this.lo}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async Hc(t){let e=new Set(this.je.keys()),r=new Set;for(let s of t){if(!s.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(r.has(s.id)){console.warn(`[PluginManager] Plugin "${s.id}" is already in the list, skipping duplicate`);continue}if(r.add(s.id),!this.je.has(s.id))try{await this.Kc(s);}catch(n){this.registry.purge(s.id),this.co(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.uo(s);}async Kc(t){this.je.has(t.id)&&this.uo(t.id);let e=[],r=Kn(this.registry,this.e,this.i,t.id,e),s=this.i.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(l){for(let c of e)try{c();}catch(u){this.w("Failed to unsubscribe config listener",u);}throw l}this.je.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.co();}uo(t){let e=this.je.get(t);if(e){this.registry.purge(t);for(let r of e.configSubscriptions)try{r();}catch(s){this.w("Failed to unsubscribe config listener",s);}e.dispose?.(),this.je.delete(t),this.co();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(l=>l.type==="onAdd");if(r.length===0)return;let s=e,n=new AbortController;for(let l of r){if(n.signal.aborted)break;try{let c=l.handler({file:s,signal:n.signal}),u=new Promise((p,d)=>setTimeout(()=>d(new Error("onAdd hook timed out")),l.timeout));({file:s}=await Promise.race([c,u]));}catch(c){console.warn(`File hook "onAdd" from plugin "${l.pluginId}" failed`,c);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",$e(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.je.keys()))this.uo(t);this.pn.destroy(),super.destroy();}co(){for(let t of this.c)try{t();}catch{}}};function bu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}a(bu,"i");function Qo(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?Qo(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=bu(i);return typeof t=="object"&&t!==null?[e,Qo(t)]:[e,t]}))}a(Qo,"c");function wu(o){return {ok:true,value:o}}a(wu,"u");function Xo(o){return {ok:false,error:o}}a(Xo,"a");var Tu="https://tlm.uploadcare.com/api/",Jo=class{static{a(this,"y");}constructor(i=Tu){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return Xo(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return wu(s)}catch(s){return Xo(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return Xo(new Error(`Error fetching data from "${e}". Error: ${r}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Qo(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Eu=a(async(o,i)=>({success:true,data:i}),"p"),Cu=a(async o=>Eu(void 0,o),"f"),Sr=class extends Jo{static{a(this,"h");}constructor(){super();}async sendEvent(i,t){let e=await Cu(i);if(!e.success)throw console.error("TelemetryAPIService: events: body is invalid",e.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",i,t)}};var xu=20,F=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),M=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),Ar=class extends G{constructor(){super(...arguments);this.Qt=new Map;this.ji=new Set;this.te=new Map;}static{a(this,"EventEmitter");}bindTarget(t){return this.ji.add(t),()=>{this.ji.delete(t);}}on(t,e){let r=this.te.get(t);return r||(r=new Set,this.te.set(t,r)),r.add(e),()=>this.te.get(t)?.delete(e)}hn(t,e){for(let s of this.ji)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.te.get(t);if(r)for(let s of r)s(e);this.w?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,r={}){let{debounce:s}=r;if(typeof s!="number"&&!s){this.hn(t,typeof e=="function"?e():e);return}this.Qt.has(t)&&window.clearTimeout(this.Qt.get(t));let n=typeof s=="number"?s:xu,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.hn(t,c),this.Qt.delete(t);}catch(c){this.w?.(()=>`Error while getting payload for event "${t}"`,c);}},n);this.Qt.set(t,l);}destroy(){for(let t of this.Qt.values())window.clearTimeout(t);this.ji.clear(),this.te.clear();}};var jn="1.29.0-alpha.3";var Rt="blocks",$t=jn;var kr=class extends G{constructor(t){super(t);this.jc=mt.generateRandomUUID();this.Ct=structuredClone(tt);this.po=false;this.ho=null;this.Ie=false;this.mn=new Sr,this.St=new re(10),this.addSub(this.e.sub(k("qualityInsights"),e=>{this.Ie=!!e;}));for(let e of Object.keys(this.Ct))this.addSub(this.e.sub(k(e),r=>{this.Ie&&(this.po&&this.Ct[e]!==r&&this.sendEvent({eventType:F.CHANGE_CONFIG}),this.Gc(e,r));}));}static{a(this,"TelemetryManager");}qc(t){t===F.INIT_SOLUTION&&!this.po&&(this.po=true);}Gc(t,e){this.Ct[t]!==e&&(this.Ct[t]=e);}Wc(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===F.INIT_SOLUTION||t.eventType===F.CHANGE_CONFIG)&&(r.config=this.Ct),{...r,appVersion:$t,appName:Rt,sessionId:this.jc,component:this.Zc,activity:this.Yc,projectPubkey:this.Ct.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.Xc,payload:{location:this.Qc,...e}}}Jc(t){return !!(t&&[M.CHANGE,M.COMMON_UPLOAD_PROGRESS,M.FILE_ADDED,M.FILE_REMOVED,M.FILE_UPLOAD_START,M.FILE_UPLOAD_PROGRESS,M.FILE_UPLOAD_SUCCESS,M.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Ie)return;let e=this.Wc({eventType:t.eventType,payload:t.payload,config:t.config});this.qc(t.eventType),!(this.Jc(t.eventType)||this.ho&&this.gn(this.ho,e))&&this.St.add(async()=>{this.ho=e,await this.mn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:F.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}gn(t,e){if(JSON.stringify(t)===JSON.stringify(e))return true;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return false;let r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return false;for(let n of r)if(!Object.hasOwn(e,n)||!this.gn(t[n],e[n]))return false;return true}get Xc(){return Date.now()}get Zc(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get Yc(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get Qc(){return location.origin}};var Gn=a(o=>{let i=new Intl.Locale(o),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var Au=a(o=>o,"DEFAULT_TRANSFORMER"),ts="{{",Wn="}}",qn="plural:";function De(o,i={},t={}){let{openToken:e=ts,closeToken:r=Wn,transform:s=Au}=t;for(let n in i){let l=i[n],c=l?.toString(),u=typeof c=="string"?s(c):String(c);o=o.replaceAll(e+n+r,u);}return o}a(De,"applyTemplateData");function Zn(o){let i=[],t=o.indexOf(ts);for(;t!==-1;){let e=o.indexOf(Wn,t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(qn)){let s=o.substring(t+2,e).replace(qn,""),n=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:l});}t=o.indexOf(ts,e);}return i}a(Zn,"getPluralObjects");var Yn="--uploadcare-blocks-window-height",vi=class o{static{a(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=D(()=>{document.documentElement.style.setProperty(Yn,`${window.innerHeight}px`);},100);}static registerClient(i){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(i);}static unregisterClient(i){o.clientsRegistry.delete(i),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(Yn);}};var Mr=a((o,i)=>new Intl.PluralRules(o).select(i),"getPluralForm");var ku=a(o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=Mr(r,t);return e(`${i}__${s}`)},"createPluralizer"),Ir=a(o=>{let i=ku(()=>t),t=a((e,r={})=>{if(!e)return "";let n=o().read(Zt(e))||e,l=Zn(n);for(let u of l)r[u.variable]=i(u.pluralKey,Number(r[u.countVariable]));return De(n,r)},"l10n");return t},"createL10n");var Mu=a(o=>o.tagName?.includes("-")??false,"isCustomElement"),Or=class{constructor(i){this.Ge=new Set;this.Gi=new Map;this.vn=false;this.qe=i,this.qe.addController(this);}static{a(this,"TestModeController");}hostDisconnected(){this.qi?.(),this.qi=void 0,this.Ge.clear(),this.Gi.clear();}hostUpdated(){if(!this.qi&&this.qe.has(k("testMode"))){let i=this.qe.subConfigValue("testMode",t=>{this.vn=!!t,this.yn();});this.qi=i;}this.eu(),this.yn();}eu(){let i=this.qe,t=i.renderRoot??i;if(!t)return;let e=this.qe,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Mu(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.Ge.has(n)){let l=n.getAttribute("data-testid");if(!l)continue;this.Ge.add(n),this.Gi.set(n,l);}for(let n of Array.from(this.Ge))(!n.isConnected||r&&n.closest(r)!==e)&&(this.Ge.delete(n),this.Gi.delete(n));}yn(){if(!this.Ge.size)return;let i=this.qe.testId||"";for(let t of this.Ge){let e=this.Gi.get(t);e&&(this.vn?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Iu=Oe(rr()(Ie(tr(Et)))),x=class extends Iu{constructor(){super();this.init$=Ho();this.l10n=Ir(()=>this.sharedCtx);this.debugPrint=lr(()=>this.sharedCtx,this.constructor.name);this.i=Tn(()=>this.sharedCtx);new Or(this);}static{a(this,"LitBlock");}static{this.styleAttrs=[];}emit(t,e,r){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,r);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),vi.registerClient(this);}initCallback(){this.Z("*blocksRegistry",()=>new Set),this.Z("*pluginManager",t=>new xr(t)),this.Z("*eventEmitter",t=>new Ar(t)),this.Z("*localeManager",t=>new br(t)),this.Z("*modalManager",t=>new cr(t)),this.Z("*a11y",()=>new yr),this.Z("*clipboard",t=>new vr(t)),this.Z("*telemetryManager",t=>new kr(t)),this.sub(Zt("locale-id"),t=>{let e=Gn(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.ie("*modalManager",false)}get telemetryManager(){return this.ie("*telemetryManager")}get localeManager(){return this.ie("*localeManager")}get a11y(){return this.ie("*a11y")}get clipboardLayer(){return this.ie("*clipboard")}get blocksRegistry(){return this.ie("*blocksRegistry")}get eventEmitter(){return this.ie("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),vi.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.tu(),K.deleteCtx(this.ctxName);}bn(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Z(t,e){let r=this.bn();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.i);this.add(t,s,true),r.set(t,s);return}}tu(){let t=this.bn();for(let[e,r]of t.entries())r?.destroy?.(),this.pub(e,null);t.clear();}ie(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:nr(t),cdnUrlModifiers:Mo(t),fileName:sr(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?De(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:a(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.Be){let t={};this.Be=new Proxy(t,{set:a((e,r,s)=>{if(typeof r!="string"||!(r in tt))return false;let n=r,l=k(n);return this.has(l)||this.add(l,tt[n]),this.$[l]=s,true},"set"),get:a((e,r)=>{let s=k(r);return this.has(s)||this.add(s,tt[r]),this.$[s]},"get")});}return this.Be}subConfigValue(t,e){let r=k(t);return this.has(r)||this.add(r,tt[t]),this.sub(r,e)}};var Dt={ATTRIBUTE:1,CHILD:2},vt=a(o=>(...i)=>({qr:o,values:i}),"e"),Ct=class{static{a(this,"i");}constructor(i){}get W(){return this.f.W}Wr(i,t,e){this.Wi=i,this.f=t,this.iu=e;}Lc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Te=class extends Ct{static{a(this,"e");}constructor(i){if(super(i),this.it=R,i.type!==Dt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===R||i==null)return this.wn=void 0,this.it=i;if(i===rt)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.wn;this.it=i;let t=[i];return t.raw=t,this.wn={Ne:this.constructor.resultType,strings:t,values:[]}}};Te.directiveName="unsafeHTML",Te.resultType=1;vt(Te);var yi=class extends Te{static{a(this,"t");}};yi.directiveName="unsafeSVG",yi.resultType=2;var Fe=vt(yi);var Xn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Yt=class extends x{constructor(){super(...arguments);this.init$=$n(this);}static{a(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return y`${Fe(Xn)}`}};var Qn=a(o=>typeof o!="number"?0:Math.floor(o/1e3),"msToUnixTimestamp"),Jn=a((o,{threshold:i})=>{let{secureExpire:t}=o,e=Qn(Date.now()),r=Number(t),s=Qn(i);return e+s>=r},"isSecureTokenExpired");var Pr=class extends G{constructor(){super(...arguments);this.We=null;}static{a(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.ze;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.We||Jn(this.We,{threshold:s})){this.We?this.w("Secure signature is expired. Resolving a new one..."):this.w("Secure signature is not set yet.");try{let n=await r();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.w("Secure signature resolved:",n),this.w("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.We=n):(this.w("Secure signature resolver returned nothing."),this.We=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.i.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.We}return t&&e?(this.w("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.We=null;}};var es=a((o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var is=a((o,i)=>{let t=o.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}},"validateMultiple");var rs=a((o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=wr([...t?gi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let l=Yo(s,r),c=Hn(n,r);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}},"validateFileType");var os=a((o,i)=>{let t=i.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:o}}},"validateIsImage");var Ft=1e3,Ee=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),bi=a(o=>Math.ceil(o*100)/100,"round"),ta=a((o,i=Ee.AUTO)=>{let t=i===Ee.AUTO;if(i===Ee.BYTE||t&&o<Ft**1){let r=Mr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===Ee.KB||t&&o<Ft**2?`${bi(o/Ft**1)} KB`:i===Ee.MB||t&&o<Ft**3?`${bi(o/Ft**2)} MB`:i===Ee.GB||t&&o<Ft**4?`${bi(o/Ft**3)} GB`:i===Ee.TB||t&&o<Ft**5?`${bi(o/Ft**4)} TB`:`${bi(o/Ft**5)} PB`},"prettyBytes");var ss=a((o,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:ta(t)}),payload:{entry:o}}},"validateMaxSizeLimit");var ns=a((o,i)=>{let{internalId:t}=o;if(!i.v.hasItem(t))return;let r=i.v.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof nt)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:o,error:r}};if(r instanceof Ue)return {type:"NETWORK_ERROR",message:r.message,payload:{entry:o,error:r}};let s=r instanceof Error?r:new Error("Unknown error",{cause:r});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}},"validateUploadError");var Ve={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},Ou=a(o=>typeof o=="function"?{runOn:"change",validator:o}:o,"getValidatorDescriptor"),Lr=class extends G{constructor(t){super(t);this.ru=[os,rs,ss,ns];this.ou=[is,es];this.St=new re(20);this.Tn=D(()=>{this.St.run();},500);this.Oe=false;this.At=new Map;let e=D(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(k("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(k("multipleMin"),e)),this.addSub(this.e.sub(k("multipleMax"),e)),this.addSub(this.e.sub(k("multiple"),e)),this.addSub(this.e.sub(k("imgOnly"),e)),this.addSub(this.e.sub(k("accept"),e)),this.addSub(this.e.sub(k("validationConcurrency"),r=>{this.St.concurrency=r;}));}static{a(this,"ValidationManager");}get v(){return this.i.uploadCollection}runFileValidators(t,e){if(this.Oe)return;let r=e??this.v.items();for(let s of r){let n=this.v.read(s);n&&this.su(n,t);}}runCollectionValidators(){if(this.Oe)return;let t=this.i.api,e=t.getOutputCollectionState(),r=[],s=this.ze.collectionValidators;for(let n of [...this.ou,...s])try{let l=n(e,t);if(!l)continue;l&&(r.push(this.En(l)),l.message||console.warn(Ve.MISSING_ERROR_MESSAGE));}catch(l){console.warn(Ve.COLLECTION_VALIDATION_FAILED,l);}this.e.pub("*collectionErrors",r),r.length>0&&this.i.eventEmitter.emit(M.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.At.get(t.uid);e&&(e.abortController?.abort(),this.At.delete(t.uid));}async su(t,e){if(this.Oe)return;let r=this.i.api,s=this.xn(t),n=s.promise??Promise.resolve(),l=(async()=>{if(this.Oe||(await n,this.Oe))return;let c=this.nu(t,e);if(c.length===0||!this.v.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=r.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.ze.validationTimeout,f=this.Cn(),m=new Set(c.map(T=>T.validator)),v=[];for(let T of f)if(!m.has(T.validator)){let C=s.lastErrorThrownByValidator.get(T.validator);C&&v.push(C);}let w=c.map(T=>async()=>{if(this.Oe)return;let C=setTimeout(()=>{s.skippedValidators.add(T.validator),p.abort(),console.warn(Ve.FILE_VALIDATION_TIMEOUT);},d);try{let E=await T.validator(u,r,{signal:p.signal});if(!E||p.signal.aborted){s.lastErrorThrownByValidator.set(T.validator,void 0);return}let A=this.En(E);s.lastErrorThrownByValidator.set(T.validator,A),v.push(A),E.message||console.warn(Ve.MISSING_ERROR_MESSAGE);}catch(E){p.signal.aborted||(s.skippedValidators.add(T.validator),console.warn(Ve.FILE_VALIDATION_FAILED,E),this.i.telemetryManager.sendEventError(E,`file validator. ${Ve.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),T.runOn!=="change"&&s.skippedValidators.add(T.validator);}});if(this.Tn(),await this.St.add(async()=>{this.Oe||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(T=>T())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}En(t){return {...t,type:t.type??"CUSTOM_ERROR"}}xn(t){let e=this.At.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.At.set(t.uid,r),r}Cn(){let t=this.ze.fileValidators;return [...this.ru,...t].map(Ou)}nu(t,e){let r=this.xn(t);return this.Cn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Oe=true,this.Tn.cancel();for(let t of this.At.values())t.abortController?.abort(),t.promise=void 0;this.At.clear();}};var ea="[Typed State] Wrong property name: ",Ur=class{static{a(this,"TypedData");}constructor(i){this.J=mt.generateFastUid(),this.Y=K.registerCtx(i,this.J);}get uid(){return this.J}setValue(i,t){if(!this.Y.has(i)){console.warn(`${ea}${String(i)}`);return}this.Y.read(i)!==t&&this.Y.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.Y.has(i)||console.warn(`${ea}${String(i)}`),this.Y.read(i)}subscribe(i,t){return this.Y.sub(i,t)}destroy(){K.deleteCtx(this.J);}};var Rr=class o{constructor(i){this.Pe=Object.create(null);this.Zi=new Set;this.Yi=new Set;this.ye=new Set;this.fo=new Set;this.mo=new Set;this.kt=new Set;this.kn=i.initialValue,this.J=mt.generateFastUid(),this.Y=K.registerCtx({},this.J),this.Sn=i.watchList||[];let t=Object.create(null);this.An=(e,r)=>{this.Jt&&window.clearTimeout(this.Jt),t[e]||(t[e]=new Set),t[e].add(r),this.Jt=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Zi.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Mn();},i.handler&&this.observeCollection(i.handler);}static{a(this,"TypedCollection");}static{this.au=1e4;}q(){this.ei&&window.clearTimeout(this.ei),this.ei=window.setTimeout(()=>{let i=new Set(this.mo),t=new Set(this.fo);this.mo.clear(),this.fo.clear();for(let e of this.Yi)e?.([...this.ye],i,t);this.Mn();});}Mn(){this.kt.size!==0&&(this.ti&&window.clearTimeout(this.ti),this.ti=window.setTimeout(()=>{let i=[...this.kt];this.kt.clear();for(let t of i)t.destroy();},o.au));}observeCollection(i){return this.Yi.add(i),this.ye.size>0&&this.q(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Yi.delete(i);}add(i){let t=new Ur(this.kn);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.ye.add(t.uid),this.q(),this.Y.add(t.uid,t),this.mo.add(t),this.Sn.forEach(e=>{this.Pe[t.uid]||(this.Pe[t.uid]=[]),this.Pe[t.uid]?.push(t.subscribe(e,()=>{this.An(e,t.uid);}));}),t.uid}hasItem(i){return this.ye.has(i)}read(i){return this.Y.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let r=this.read(i);if(!r)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);r.setValue(t,e);}remove(i){let t=this.read(i);t&&(this.fo.add(t),this.kt.add(t)),this.ye.delete(i),this.q(),this.Y.pub(i,void 0),this.Pe[i]?.forEach(e=>{e();}),delete this.Pe[i];}clearAll(){this.ye.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Zi.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Zi.delete(i);}findItems(i){let t=[];return this.ye.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.ye]}get size(){return this.ye.size}destroy(){this.Jt&&window.clearTimeout(this.Jt),this.ei&&window.clearTimeout(this.ei),this.ti&&window.clearTimeout(this.ti);for(let i of this.kt)i.destroy();this.kt.clear(),K.deleteCtx(this.J),this.Zi=new Set,this.Yi=new Set;for(let i of Object.keys(this.Pe))this.Pe[i]?.forEach(t=>{t();}),delete this.Pe[i];}};var L=Object.freeze({PHOTO:"photo",VIDEO:"video"}),xt=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var ia=a(o=>({isVideoRecordingEnabled:j(o.cameraModes).includes(L.VIDEO),isPhotoEnabled:j(o.cameraModes).includes(L.PHOTO)}),"calcCameraModes");var ra=a((o,i)=>{for(let t of o)if(i(t))return t},"findBlockInCtx");var as=a((o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),l=a(()=>{for(let c of o)if(i(c)){clearTimeout(n),r(c);return}s=requestAnimationFrame(l);},"check");l();}),"waitForBlockInCtx");function $r(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}a($r,"applyStyles");var Pu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Lu=new RegExp(`^/?(${Pu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),oa=a(({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(hi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Lu.exec(r.pathname);if(!s)return null;let[,n,l,c]=s;return n?{uuid:n,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var dt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Uu=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),_=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Uu,...dt}),Ru={[dt.DROPBOX_CHOOSER]:dt.DROPBOX},sa=a(o=>Ru[o]??o,"canonicalSourceName");var Dr=a(o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e)),"getOutputData");function na(o){let i=new Map;return a((...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s},"memoized")}a(na,"memoize");var aa=new Set;function Fr(o){aa.has(o)||(aa.add(o),console.warn(o));}a(Fr,"warnOnce");function $u(o){let i=false;return setTimeout(()=>{i=true;},0),a(e=>((...r)=>(i&&Fr(o),e(...r))),"withAssert")}a($u,"createAsyncAssertWrapper");function la(o){let i={},t=o.ctx,e={progress:a(()=>t.read("*commonProgress"),"progress"),errors:a(()=>t.read("*collectionErrors"),"errors"),group:a(()=>t.read("*groupInfo"),"group"),totalCount:a(()=>o.uploadCollection.size,"totalCount"),failedCount:a(()=>i.failedEntries.length,"failedCount"),successCount:a(()=>i.successEntries.length,"successCount"),uploadingCount:a(()=>i.uploadingEntries.length,"uploadingCount"),status:a(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:a(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:a(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:a(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:a(()=>Dr(o),"allEntries"),successEntries:a(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:a(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:a(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:a(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},r=$u("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let l=s,u=na(r(n));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}a(la,"buildOutputCollectionState");var Vr=class extends G{constructor(){super(...arguments);this.Et=Ir(()=>this.e);this.addFileFromUrl=a((t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??_.API});return this.getOutputItem(n)},"addFileFromUrl");this.addFileFromUuid=a((t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({uuid:t,fileName:r??null,silent:e??false,source:s??_.API});return this.getOutputItem(n)},"addFileFromUuid");this.addFileFromCdnUrl=a((t,{silent:e,fileName:r,source:s}={})=>{let n=oa({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let l=this.v.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??_.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=a((t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let l=this.v.add({file:t,isImage:$e(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??_.API,fullPath:n??null});return this.getOutputItem(l)},"addFileFromObject");this.removeFileByInternalId=a(t=>{if(!this.v.read(t))throw new Error(`File with internalId ${t} not found`);this.v.remove(t);},"removeFileByInternalId");this.uploadAll=a(()=>{let t=this.v.items().filter(e=>{let r=this.v.read(e);return r?!r.getValue("isRemoved")&&!r.getValue("isUploading")&&!r.getValue("fileInfo")&&r.getValue("errors").length===0&&!r.getValue("isValidationPending")&&!r.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.i.eventEmitter.emit(M.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=a((t={})=>{let e=Kt(wr([this.cfg.accept??"",...this.cfg.imgOnly?gi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),$r(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:l}=ia(this.cfg);t.modeCamera===L.PHOTO&&n?s.accept=mi:t.modeCamera===L.VIDEO&&l?s.accept=Zo:s.accept=[mi,l&&Zo].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?_.CAMERA:_.LOCAL});}),this.e.pub("*currentActivity",V.UPLOAD_LIST),this.i.modalManager?.open(V.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=a((t=false)=>{if(this.v.size>0&&!t)this.e.pub("*currentActivity",V.UPLOAD_LIST),this.i.modalManager?.open(V.UPLOAD_LIST);else if(this.In?.length===1){let e=this.In[0];this.go().then(()=>{let r=this.i.pluginManager.snapshot().sources,s=r.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(r.find(c=>c.id===n[0])??s).onSelect():(this.e.pub("*currentActivity",V.START_FROM),this.i.modalManager?.open(V.START_FROM));return}this.e.read("*currentActivity")&&this.i.modalManager?.open(this.e.read("*currentActivity"));});}else this.e.pub("*currentActivity",V.START_FROM),this.i.modalManager?.open(V.START_FROM);},"initFlow");this.doneFlow=a(()=>{let t=ra(this.i.blocksRegistry,e=>"doneActivity"in e);t&&(this.e.pub("*currentActivity",t.doneActivity),this.e.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.e.read("*currentActivity")||this.i.modalManager?.closeAll());},"doneFlow");this.setCurrentActivity=a((t,...e)=>{this.go().then(()=>{this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t),as(this.i.blocksRegistry,r=>r.activityType===t,{onTimeout:a(()=>console.warn(`Activity type "${t}" not found in the context`),"onTimeout"),timeout:100});});},"setCurrentActivity");this.on=a((t,e)=>this.i.eventEmitter.on(t,e),"on");this.getCurrentActivity=a(()=>this.e.read("*currentActivity"),"getCurrentActivity");this.historyBack=a(()=>{this.e.read("*historyBack")?.();},"historyBack");this.setModalState=a(t=>{this.go().then(()=>{if(!t){this.i.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null);return}let e=this.e.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return as(this.i.blocksRegistry,r=>r.activityType===e,{onTimeout:a(()=>console.warn(`Activity block "${e}" not found in the context`),"onTimeout")}).then(()=>{this.i.modalManager?.open(e);})});},"setModalState");}static{a(this,"UploaderPublicApi");}get v(){return this.i.uploadCollection}get cfg(){return this.ze}get l10n(){return this.Et}removeAllFiles(){this.v.clearAll();}getOutputItem(t){let e=K.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let r=e.store,s=r.fileInfo,n=r.isRemoved?"removed":r.errors.length>0?"failed":r.fileInfo?"success":r.isUploading?"uploading":"idle";return {uuid:s?.uuid??r.uuid??null,internalId:t,name:s?.originalFilename??r.fileName,size:s?.size??r.fileSize,isImage:s?.isImage??r.isImage,mimeType:s?.mimeType??r.mimeType,file:r.file,externalUrl:r.externalUrl,cdnUrlModifiers:r.cdnUrlModifiers,cdnUrl:r.cdnUrl??s?.cdnUrl??null,fullPath:r.fullPath,uploadProgress:r.uploadProgress,fileInfo:s??null,metadata:r.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:r.isValidationPending,errors:r.errors,status:n,source:r?.source}}getOutputCollectionState(){return la(this.i)}async go(){return (await this.i.wait("pluginManager")).pluginsReady()}get In(){let t=[];return this.cfg.sourceList&&(t=Y(this.cfg.sourceList)),t}};var ca={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};var wi=33.333333333333336,I=1,ls=24,ua=6;function ne(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}a(ne,"setSvgNodeAttrs");function yt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return ne(t,i),t}a(yt,"createSvgNode");function da(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,r+c*n+1.5*p-24*t*p],f=[e+l*s+1.5*u,r+c*n+1.5*p],m=[e+l*s-24*t*u+1.5*u,r+c*n+1.5*p],v=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${m[0]} ${m[1]}`,w=[f[0],f[1]];return {d:v,center:w}}a(da,"cornerPath");function pa(o,i,t){let{x:e,y:r,width:s,height:n}=o,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,f=i==="n"?-1:i==="s"?1:0,m,v;l?(m=[e+u*s-34*t/2,r+p*n+1.5*f],v=[e+u*s+34*t/2,r+p*n+1.5*f]):(m=[e+u*s+1.5*d,r+p*n-34*t/2],v=[e+u*s+1.5*d,r+p*n+34*t/2]);let w=`M ${m[0]} ${m[1]} L ${v[0]} ${v[1]}`,T=[(m[0]+v[0])/2,(m[1]+v[1])/2];return {d:w,center:T}}a(pa,"sidePath");function ha(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}a(ha,"thumbCursor");function fa({rect:o,delta:[i,t],imageBox:e}){return _e({...o,x:o.x+i,y:o.y+t},e)}a(fa,"moveRect");function _e(o,i){let{x:t}=o,{y:e}=o;return o.x<i.x?t=i.x:o.x+o.width>i.x+i.width&&(t=i.x+i.width-o.width),o.y<i.y?e=i.y:o.y+o.height>i.y+i.height&&(e=i.y+i.height-o.height),{...o,x:t,y:e}}a(_e,"constraintRect");function Du({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;s+=r,l-=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,l=o.y+o.height-s,t&&(n=l*t,c=o.x+o.width/2-n/2)),c<=e.x&&(c=e.x,s=o.y+o.height-l),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y+o.height-l),l<I&&(l=I,t&&(n=l*t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),n<I&&(n=I,t&&(l=n/t,c=o.x+o.width/2-n/2),s=o.y+o.height-l),{x:c,y:s,width:n,height:l}}a(Du,"resizeNorth");function Fu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;s+=r,n-=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(l=n/t,c=o.y+o.height/2-l/2)),c<=e.y&&(c=e.y,s=o.x+o.width-n),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x+o.width-n),l<I&&(l=I,t&&(n=l*t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),n<I&&(n=I,t&&(l=n/t),c=o.y+o.height/2-l/2,s=o.x+o.width-n),{x:s,y:c,width:n,height:l}}a(Fu,"resizeWest");function Vu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:l}=o;l+=r,t&&(n=l*t);let c=o.x+o.width/2-n/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(n=l*t),c=o.x+o.width/2-n/2),c<=e.x&&(c=e.x,s=o.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=o.y),l<I&&(l=I,t&&(n=l*t),c=o.x+o.width/2-n/2),n<I&&(n=I,t&&(l=n/t),c=o.x+o.width/2-n/2),{x:c,y:s,width:n,height:l}}a(Vu,"resizeSouth");function Nu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:l}=o;n+=r,t&&(l=n/t);let c=o.y+o.height/2-l/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(l=n/t),c=o.y+o.height/2-l/2),c<=e.y&&(c=e.y,s=o.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=o.x),l<I&&(l=I,t&&(n=l*t),c=o.y+o.height/2-l/2),n<I&&(n=I,t&&(l=n/t),c=o.y+o.height/2-l/2),{x:s,y:c,width:n,height:l}}a(Nu,"resizeEast");function _u({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+s<e.y&&(s=e.y-l),n+=r,c-=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x+o.width-c,l=e.y)):t&&(r=u*t-c,c=c+r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y+o.height-u)),u<I&&(u=I,t&&(c=u*t),n=o.x+o.width-c,l=o.y+o.height-u),c<I&&(c=I,t&&(u=c/t),n=o.x+o.width-c,l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(_u,"resizeNorthWest");function zu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+s<e.y&&(s=e.y-l),c+=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=o.x,l=e.y)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y+o.height-u)),u<I&&(u=I,t&&(c=u*t),l=o.y+o.height-u),c<I&&(c=I,t&&(u=c/t),l=o.y+o.height-u),{x:n,y:l,width:c,height:u}}a(zu,"resizeNorthEast");function Bu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+r<e.x&&(r=e.x-n),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),n+=r,c-=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x+o.width-c,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n-=r,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=o.y)),u<I&&(u=I,t&&(c=u*t),n=o.x+o.width-c),c<I&&(c=I,t&&(u=c/t),n=o.x+o.width-c),{x:n,y:l,width:c,height:u}}a(Bu,"resizeSouthWest");function Hu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:l,width:c,height:u}=o;return n+c+r>e.x+e.width&&(r=e.x+e.width-n-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=o.x,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=o.y)),u<I&&(u=I,t&&(c=u*t)),c<I&&(c=I,t&&(u=c/t)),{x:n,y:l,width:c,height:u}}a(Hu,"resizeSouthEast");function ma({direction:o,...i}){switch(o){case "n":return Du(i);case "w":return Fu(i);case "s":return Vu(i);case "e":return Nu(i);case "nw":return _u(i);case "ne":return zu(i);case "sw":return Bu(i);case "se":return Hu(i);default:return i.rect}}a(ma,"resizeRect");function ga(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}a(ga,"rectContainsPoint");function va(o,i){return o.x>=i.x&&o.y>=i.y&&o.x+o.width<=i.x+i.width&&o.y+o.height<=i.y+i.height}a(va,"isRectInsideRect");function ya(o,i){return Math.abs(o.width/o.height-i)<.1}a(ya,"isRectMatchesAspectRatio");function ze({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}a(ze,"rotateSize");function ba(o,i,t){let e=o/i,r,s;e>t?(r=Math.round(i*t),s=i):(r=o,s=Math.round(o/t));let n=Math.round((o-r)/2),l=Math.round((i-s)/2);return n+r>o&&(r=o-n),l+s>i&&(s=i-l),{x:n,y:l,width:r,height:s}}a(ba,"calculateMaxCenteredCropFrame");function Be(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}a(Be,"roundRect");function ae(o,i,t){return Math.min(Math.max(o,i),t)}a(ae,"clamp");var Ti=["free"],_r=a(o=>{let i=Y(o);if(!i||i.length===0)return [];let t=[];for(let e of i){let r=e.trim();if(!r)continue;let s=r.indexOf(":");if(s===-1&&!Ti.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),l=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(l)||n<=0||l<=0)&&!Ti.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:mt.generateFastUid(),type:"aspect-ratio",width:Ti.includes(r)?0:n,height:Ti.includes(r)?0:l,hasFreeform:Ti.includes(r)});}return t},"parseCropPreset"),wa=a((o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(r-p);d<n&&(n=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(r-u)/u>e)return null}return s},"getClosestAspectRatio");function Ta(o){return Fo({...o,libraryName:Rt,libraryVersion:$t})}a(Ta,"customUserAgent");var Ea="active",He="___ACTIVITY_IS_ACTIVE___",Ca,S=class o extends(Ca=x,Ca){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Ko(this);this.lu=D(this.cu.bind(this),10);}static{a(this,"LitActivityBlock");}On(){let t=o.ii.get(this);this[He]=false,this.removeAttribute(Ea),t?.deactivateCallback?.();}uu(){let t=o.ii.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[He]=true,this.setAttribute(Ea,""),t?.activateCallback?.(),this.lu(),this.emit(M.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[He]?this.On():this.activityType===t&&!this[He]&&this.uu();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let r=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=r??null;}t||(this.$["*history"]=[]);}));}cu(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}Pn(){return !!this.activityType&&o.ii.has(this)}static{this.ii=new Map;}get isActivityActive(){return !!this[He]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ii.set(this,{activateCallback:r,deactivateCallback:s});}du(){this.isActivityActive&&this.On(),o.ii.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Pn()&&this.du();}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let r=!!e;e&&(r=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=r?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};S.activities=V;var $=class o extends S{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Xi=false;this.init$=jo(this);this.bo=D(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.gu(e);},300);this.fu=(t,e,r)=>{if(this.isConnected){(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(M.FILE_ADDED,this.api.getOutputItem(s.uid)),this.i.wait("pluginManager").then(n=>n.runOnAddHooks(s));this.validationManager.runCollectionValidators();for(let s of r){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(M.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Un(),this.bo();}};this.mu=t=>{if(!this.isConnected)return;this.bo();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([s])=>["file","uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(r.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=r.filter(n=>t.fileInfo?.has(n)&&!!K.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let n=K.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(M.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Un();}if(t.isUploading)for(let s of t.isUploading){let n=K.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(M.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=K.getCtx(s);if(!n)continue;let{fileInfo:l,silent:c}=n.store;l&&!c&&this.emit(M.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.vu();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=K.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(M.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(M.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(M.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(M.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Un=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");typeof l=="number"&&(t+=l);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(M.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{a(this,"LitUploaderBlock");}get pu(){return this.hasBlockInCtx(t=>t instanceof o?t.Xi&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Z("*uploadCollection",()=>new Rr({initialValue:ca,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Z("*secureUploadsManager",t=>new Pr(t)),this.Z("*validationManager",t=>new Lr(t)),this.Z("*publicApi",t=>new Vr(t)),!this.pu&&this.couldBeCtxOwner&&this.hu();}getAPI(){return this.api}get validationManager(){return this.ie("*validationManager")}get api(){return this.ie("*publicApi")}get uploadCollection(){return this.ie("*uploadCollection")}get secureUploadsManager(){return this.ie("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Xi&&this.Ln(),this.bo.cancel();}connectedCallback(){super.connectedCallback(),this.Xi&&this.Rn();}hu(){this.Xi=true,this.Rn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Rn(){this.Ln(),this.vo=this.uploadCollection.observeCollection(this.fu),this.yo=this.uploadCollection.observeProperties(this.mu);}Ln(){this.yo?.(),this.vo?.(),this.yo=void 0,this.vo=void 0;}async gu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,n=await Rn(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(M.GROUP_CREATED,l),this.emit(M.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}vu(){let t=_r(this.cfg.cropPreset);if(!t)return;let[e]=t,r=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of r){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=n.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=ba(l,c,u),d=ot(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),f=s.getValue("cdnUrl");if(!f){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:Z(f,d)});}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ta,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return Dr(this.i)}};$.extSrcList=Object.freeze({...dt});$.sourceTypes=Object.freeze({..._});var le=class extends x{constructor(){super(...arguments);this.name="";this.Qi="";this.ri=null;this.$n=null;}static{a(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.$n=e,this.wo();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.wo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.wo();}wo(){if(!this.name){this.Qi="",this.ri=null;return}let e=this.i.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.ri=e.svg,this.Qi="";return}this.ri=null;let r=`#uc-icon-${this.name}`,s=this.$n?.(this.name);this.Qi=s??r;}render(){return this.ri?y`${this.yield("",y`${Fe(this.ri)}`)}`:y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Qi}></use></svg>`)} `}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};h([b({type:String})],le.prototype,"name",2),h([g()],le.prototype,"Qi",2),h([g()],le.prototype,"ri",2);var xa=a(o=>[...new Set(o)],"uniqueArray");var Ce="--uc-img-",cs="unresolved";var us=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ds=3e3,ps=5e3,hs=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Ku="https://ucarecdn.com",Ke=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Ku},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var zr=class extends Ie(Oe(Et)){constructor(){super();this.Mt={};this.c=new Map;this.It=null;this.Ji=null;for(let t in Ke){let e=Ke[t];this.Mt[Ce+t]=e?.default||"";}}static{a(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.Mt[Ce+t]}set$$(t){for(let e in t){let r=Ce+e,s=t[e];this.Mt[r]=s,this.q(r,s);}}sub$$(t,e){let r=Ce+t;this.c.has(r)||this.c.set(r,new Set),this.c.get(r)?.add(e);let s=this.Mt[r];s!==null&&s!==""&&e(s);}q(t,e){this.c.has(t)&&this.c.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${Rt}/${$t}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;Ke[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.It=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.It?.unobserve(t));});},r),this.It.observe(t),this.Ji||(this.Ji=new Set),this.Ji.add(t);}connectedCallback(){super.connectedCallback(),this.yu();}yu(){for(let t in Ke){let e=Ce+t,r=this.getCssData(e,true);r!=null&&(this.Mt[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.It&&(this.Ji?.forEach(t=>{this.It?.unobserve(t);}),this.It=null),this.c.clear();}static get observedAttributes(){return Object.keys(Ke)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Ce+t;this.Mt[s]=r,this.q(s,r);});}};var Sa=a(o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var Kr=class extends zr{constructor(){super(...arguments);this.be=new Image;this.pe=new Image;}static{a(this,"ImgBase");}Dn(t){return !t.includes("//")&&!us&&(t=new URL(t,document.baseURI).href),t}er(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let n=parseInt(r,10);return Number(n)>ps&&this.Fn?ps+s:Number(n)>ds&&!this.Fn?ds+s:t}bu(t,e){let r={format:this.To("format"),quality:this.To("quality"),resize:this.er(t),blur:e,"cdn-operations":this.To("cdn-operations")??void 0,analytics:this.analyticsParams()};return ot(...Sa(r))}To(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}re(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(us&&r&&!r.includes("//"))return this.oi(r);let s=this.bu(t,e),n=this.$$("cdn-cname"),l=n;if(r.startsWith(String(n)))return Z(r,s);let c=this.$$("uuid");if(l&&c)return this.oi(Z(te(l,c),s));if(c)return this.oi(Z(te(l,c),s));let u=this.$$("proxy-cname");if(u)return this.oi(Z(u,s,this.Dn(r)));let p=this.$$("pubkey");if(p)return this.oi(Z(`https://${p}.ucr.io/`,s,this.Dn(r)))}oi(t){let e=this.$$("secure-delivery-proxy");return e?De(e,{previewUrl:t},{transform:a(r=>window.encodeURIComponent(r),"transform")}):t}Ot(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),l=r?"":e*Math.round(s.height);return n||l?`${n||""}x${l||""}`:null}wu(t){let e=a(s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},"proxifyEvent"),r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.we||(this.Eo({elNode:this.be}),this.appendChild(this.be)),this.be}get tr(){return this.we?{type:hs.PREVIEW,img:this.pe}:{type:hs.MAIN,img:this.img}}get we(){return this.$$("is-preview-blur")}get Nn(){return this.$$("is-background-for")}get Vn(){let t=this.$$("breakpoints");if(t){let e=Y(t);return xa(e.map(r=>parseInt(r,10)))}else return null}get Fn(){return this.$$("format").toLowerCase()==="jpeg"}_n(t){let e=new Set;e.add(`url("${this.re(this.Ot(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.re(this.Ot(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.re(this.Ot(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}Bn(){let t=new Set;return this.Vn?this.Vn.forEach(e=>{t.add(`${this.re(`${e}x`)} ${this.er(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.re(`${e*2}x`)} ${this.er(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.re(`${e*3}x`)} ${this.er(`${e*3}w`)}`);}):(t.add(`${this.re(this.Ot(this.tr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.re(this.Ot(this.tr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.re(this.Ot(this.tr.img,3))} 3x`)),[...t].join()}zn(){return this.re()}get Hn(){return this.re("100x","100")}Tu(){let t=this.Nn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this._n(e);}):this._n(e);});}Eu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Eo({elNode:t}){this.wu(t),this.initAttributes(t);}xo({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.Eo({elNode:r}),r.setAttribute(cs,""),r.addEventListener("load",()=>{r.removeAttribute(cs),s(r);}),r.addEventListener("error",()=>{n(false);}),this.Eu({elNode:r,src:t,srcset:e});})}async xu(){if(this.$$("intersection")){this.we&&(this.Eo({elNode:this.pe}),this.appendChild(this.pe)),this.initIntersection(this.tr.img,async()=>{this.we&&(this.pe.src=this.Hn);try{await this.xo({src:this.zn(),srcset:this.Bn(),elNode:this.be}),this.we&&await this.pe.remove(),this.appendChild(this.be);}catch{this.we&&await this.pe?.remove(),this.appendChild(this.be);}});return}try{this.we&&(await this.xo({src:this.Hn,elNode:this.pe}),this.appendChild(this.pe)),await this.xo({src:this.zn(),srcset:this.Bn(),elNode:this.be}),this.we&&await this.pe?.remove(),this.appendChild(this.be);}catch{this.we&&await this.pe?.remove(),this.appendChild(this.be);}}init(){this.Nn?this.Tu():this.xu();}};var fs=class extends Kr{static{a(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:ju}=on,Aa=a(o=>o,"i");var Ma=a(o=>o.strings===void 0,"r"),ka=a(()=>document.createComment(""),"s"),je=a((o,i,t)=>{let e=o.ve.parentNode,r=i===void 0?o.yt:i.ve;if(t===void 0){let s=e.insertBefore(ka(),r),n=e.insertBefore(ka(),r);t=new ju(s,n,o,o.options);}else {let s=t.yt.nextSibling,n=t.f,l=n!==o;if(l){let c;t.Cu?.(o),t.f=o,t.Ui!==void 0&&(c=o.W)!==n.W&&t.Ui(c);}if(s!==r||l){let c=t.ve;for(;c!==s;){let u=Aa(c).nextSibling;Aa(e).insertBefore(c,r),c=u;}}}return t},"v"),ce=a((o,i,t=o)=>(o.ce(i,t),o),"u"),Gu={},Ia=a((o,i=Gu)=>o.r=i,"p"),Oa=a(o=>o.r,"M"),jr=a(o=>{o.bt(),o.ve.remove();},"h");var Ei=a((o,i)=>{let t=o.le;if(t===void 0)return false;for(let e of t)e.qs?.(i,false),Ei(e,i);return true},"s"),Gr=a(o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.le,t.delete(o),o=i;}while(t?.size===0)},"o"),Pa=a(o=>{for(let i;i=o.f;o=i){let t=i.le;if(t===void 0)i.le=t=new Set;else if(t.has(o))break;t.add(o),Zu(i);}},"r");function qu(o){this.le!==void 0?(Gr(this),this.f=o,Pa(this)):this.f=o;}a(qu,"h");function Wu(o,i=false,t=0){let e=this.r,r=this.le;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Ei(e[s],false),Gr(e[s]);else e!=null&&(Ei(e,false),Gr(e));else Ei(this,o);}a(Wu,"n");var Zu=a(o=>{o.type==Dt.CHILD&&(o.Ui??=Wu,o.Cu??=qu);},"c"),qr=class extends Ct{static{a(this,"f");}constructor(){super(...arguments),this.le=void 0;}Wr(i,t,e){super.Wr(i,t,e),Pa(this),this.isConnected=i.W;}qs(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Ei(this,i),Gr(this));}setValue(i){if(Ma(this.Wi))this.Wi.ce(i,this);else {let t=[...this.Wi.r];t[this.iu]=i,this.Wi.ce(t,this,0);}}disconnected(){}reconnected(){}};var O=a(()=>new gs,"e"),gs=class{static{a(this,"h");}},ms=new WeakMap,P=vt(class extends qr{render(o){return R}update(o,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=o.options?.host,this.rt(this.ct=o.element)),R}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=ms.get(i);t===void 0&&(t=new WeakMap,ms.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,o),o!==void 0&&this.G.call(this.ht,o);}else this.G.value=o;}get lt(){return typeof this.G=="function"?ms.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});var vs=null,Ci=class extends x{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=a(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);},"closeDialog");this.Su=()=>{this.closeDialog();};this.Au=t=>{this.Co=t.target;};this.ku=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Co&&this.closeDialog();};this.si=({id:t})=>{t===this.id?(vs=t,this.show(),this.emit(M.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.ni=({id:t})=>{t===this.id&&(this.hide(),this.emit(M.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.Kn=t=>{this.hide(),vs===this.id&&this.emit(M.MODAL_CLOSE,{modalId:vs,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{a(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(X.OPEN,this.si),this.modalManager?.subscribe(X.CLOSE,this.ni),this.modalManager?.subscribe(X.CLOSE_ALL,this.Kn);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Co=void 0,this.modalManager?.unsubscribe(X.OPEN,this.si),this.modalManager?.unsubscribe(X.CLOSE,this.ni),this.modalManager?.unsubscribe(X.CLOSE_ALL,this.Kn);}Mu(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Su),this.dialogEl.value?.addEventListener("mousedown",this.Au),this.dialogEl.value?.addEventListener("mouseup",this.ku);}render(){return y`<dialog ${P(this.Mu)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],Ci.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ci.prototype,"blockBodyScrolling",2);var Wr=class extends ${constructor(){super(...arguments);this.z=null;this.ir=null;}static{a(this,"FormInput");}get jn(){return this.nameAttrValue??this.ctxName}Gn(){let t=document.createElement("input");return t.type="text",t.name=this.jn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,$r(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.z=this.Gn(),this.appendChild(this.z),this.sub("*collectionState",t=>{if(!t)return;if(!this.ir){let n=document.createElement("div");this.appendChild(n),this.ir=n;}if(!this.z){let n=this.Gn();this.appendChild(n),this.z=n;}if(this.ir.innerHTML="",t.status==="uploading"||t.status==="idle"){this.z.value="",this.z.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.z.value="",this.z.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.z.value=e.cdnUrl??"",this.z.setCustomValidity("");return}let r=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&r.length===1&&r[0]){this.z.value=r[0],this.z.setCustomValidity("");return}this.z.remove(),this.z=null;let s=new DocumentFragment;for(let n of r){let l=document.createElement("input");l.type="hidden",l.name=`${this.jn}[]`,l.value=n,s.appendChild(l);}this.ir.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],Wr.prototype,"nameAttrValue",2);var ys=class extends x{static{a(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Ge=class extends x{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.oe=0;this.rr=O();this.qn=()=>{let t=this.rr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.oe>0&&t.classList.add("uc-fake-progress--hidden");}};}static{a(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.oe=this.So(this.value),this.Ao(),this.rr.value?.addEventListener("animationiteration",this.qn);}updated(t){if(super.updated(t),t.has("value")){let e=this.So(this.value);if(!this.visible)this.oe=e;else {let r=Math.max(this.oe,e);r!==this.oe&&(this.oe=r,this.Ao());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.Ao():this.oe=this.So(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.rr.value?.removeEventListener("animationiteration",this.qn);}So(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}Ao(){this.visible&&this.style.setProperty("--l-progress-value",this.oe.toString());}render(){return y`<div ${P(this.rr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],Ge.prototype,"hasFileName",2),h([b({type:Number})],Ge.prototype,"value",2),h([b({type:Boolean,reflect:true})],Ge.prototype,"visible",2);var xi=class extends ${constructor(){super();this.he=false;this.Pt=0;this.init$={...this.init$,"*commonProgress":0};}static{a(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.ko=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.he=t;}),this.sub("*commonProgress",t=>{this.Pt=t;});}updated(t){super.updated(t),t.has("visible")&&(this.he?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.ko?.(),this.ko=void 0;}render(){return y`<uc-progress-bar .value=${this.Pt} .visible=${this.he}></uc-progress-bar>`}};h([g()],xi.prototype,"he",2),h([g()],xi.prototype,"Pt",2);var qe=class extends x{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Iu=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{a(this,"Select");}render(){return y`<select @change=${this.Iu} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],qe.prototype,"value",2),h([b({type:Boolean,reflect:true})],qe.prototype,"disabled",2),h([b({type:Array,attribute:false})],qe.prototype,"options",2);var We=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Mo="default";this.Io="";}static{a(this,"SourceBtn");}willUpdate(t){super.willUpdate(t),t.has("source")&&this.Ou(this.source);}Ou(t){if(!t){this.Io="",this.Mo="default";return}let{label:e,icon:r,id:s}=t;this.Io=e,this.Mo=r??s??"default";}activate(){this.source&&this.source.onClick();}render(){return y`<button type="button" @click=${this.activate}><uc-icon name=${this.Mo}></uc-icon><div class="uc-txt">${this.l10n(this.Io)}</div></button>`}};h([b({attribute:false})],We.prototype,"source",2),h([g()],We.prototype,"Mo",2),h([g()],We.prototype,"Io",2);var Si=class extends ${constructor(){super(...arguments);this.Wn=[];this.Me=[];this.wrap=false;}static{a(this,"SourceList");}initCallback(){super.initCallback(),this.subConfigValue("sourceList",e=>{this.Wn=Y(e),this.Zn();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Zn()));}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}Zn(){let e=this.i.pluginManager?.snapshot().sources??[],r=new Map(e.map(n=>[n.id,n])),s=[];this.Wn.forEach(n=>{let l=this.Pu(n,r);if(l.length!==1||l[0]!==n){for(let p of l){let d=r.get(p);d&&s.push(this.Yn(d));}return}let u=r.get(n);u&&s.push(this.Yn(u));}),this.Me=s;}Pu(t,e){let r=e.get(t);return r?.expand?r.expand():[t]}Yn(t){return {id:t.id,label:t.label,icon:t.icon,onClick:a(()=>t.onSelect(),"onClick")}}render(){return y`${this.Me.map(t=>y`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};h([g()],Si.prototype,"Me",2),h([b({type:Boolean,attribute:"wrap",noAccessor:true})],Si.prototype,"wrap",2);var bs=class extends x{static{a(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var Ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function xe(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=n=>s(n);}),image:i,cancel:a(()=>{i.naturalWidth===0&&(i.src=Ot);},"cancel")}}a(xe,"preloadImage");function Ai(o){let i=[];for(let s of o){let n=xe(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:a(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}a(Ai,"batchPreloadImages");function ws(o,i=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let r=new Image,s=new Promise((n,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p);});},r.onerror=c=>{l(c);};});return r.src=URL.createObjectURL(o),s}a(ws,"generateThumb");var Ze=class extends ${constructor(){super(...arguments);this.or=new Set;this.entry=null;}static{a(this,"FileItemConfig");}withEntry(t){return (...e)=>{let r=this.entry;if(!r){console.warn("No entry found");return}return t(r,...e)}}subEntry(t,e){this.withEntry((r,s,n)=>{let l=r.subscribe(s,c=>{this.isConnected&&n(c);});this.or.add(l);})(t,e);}reset(){for(let t of this.or)t();this.or=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.or=new Set;}};function Yu(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}a(Yu,"createSvgBlobUrl");function Zr(o="hsl(209, 21%, 65%)",i=32,t=32){return Yu(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}a(Zr,"fileCssBg");var Xu=3e3,Ye=class extends Ze{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Le="";this.Xn=false;this.sr=null;this.Qn=false;this.Lu=this.cfg.filesViewMode;this.Jn=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.Ru(e);if(r&&s&&n){let p=await this.proxyUrl(Z(te(this.cfg.cdnCname,n),ot(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=xe(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let f=t.getValue("file");if(!f)return;let m=await ws(f,c);t.setValue("thumbUrl",m);}catch(f){this.telemetryManager.sendEventError(f,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(m));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await ws(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Zr(p));}});this.nr=D(this.Jn.bind(this),100);}static{a(this,"Thumb");}Ru(t=false){t&&(this.sr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.sr?.height||0),10),parseInt(String(this?.sr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,Xu)}Uu(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let l=a(()=>{n&&(n.onload=null,n.onerror=null,n.src=Ot,e?.removeEventListener("abort",c),n=null);},"cleanup"),c=a(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=a(()=>{l(),r();},"resolveSafe"),p=a(d=>{l(),s(d);},"rejectSafe");if(typeof n.decode=="function"){n.src=t,n.decode().then(u).catch(p);return}n.onload=u,n.onerror=p,n.src=t;})}Po(){this.Oo?.cancel(),this.Oo=void 0;}$u(t){if(this.Po(),!t){this.Le&&(this.Le="");return}if(t===this.Le)return;let e=new AbortController,r={controller:e,cancel:a(()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);},"cancel")};this.Oo=r,this.Uu(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Le=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}ar(t=false){if(this.entry){if(t){this.Jn(true);return}this.Qn&&this.nr();}}firstUpdated(t){super.firstUpdated(t),this.ea();}updated(t){super.updated(t),t.has("uid")&&this.ea();}ai(t){let[e]=t;e&&(this.Qn=e.isIntersecting,e.isIntersecting&&(this.sr=e.boundingClientRect,this.ar(),this.s?.disconnect()),e.intersectionRatio===0&&this.nr.cancel());}reset(){super.reset(),this.nr.cancel(),this.Po(),this.Le&&(this.Le="");}ea(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let r=a(()=>{this.ar();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.$u(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.ar(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.Xn&&(this.Lu==="list"&&this.ar(true),this.Xn=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.ai.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.nr.cancel(),this.Po(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Le||Ot} role="img" alt="Preview of uploaded image" ?hidden=${!this.Le} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],Ye.prototype,"badgeIcon",2),h([b({attribute:false})],Ye.prototype,"uid",2),h([g()],Ye.prototype,"Le",2);var Ts=class extends S{static{a(this,"ActivityHeader");}};var Es=class extends S{constructor(){super(...arguments);this.historyTracked=true;this.activityType=S.activities.START_FROM;}static{a(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var Cs=class extends ${constructor(){super(...arguments);this.ta=null;}static{a(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=M;}initCallback(){super.initCallback(),this.ta=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ta?.();}};var Xe=a((o,i)=>{let t=false,e,r=0,s=a(((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...n),r=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:a(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var La=a((o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},"u"),ki=vt(class extends Ct{constructor(o){if(super(o),o.type!==Dt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],n=0;for(let l of o)r[n]=e?e(l,n):n,s[n]=t(l,n),n++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=Oa(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let l=this.ut??=[],c=[],u,p,d=0,f=r.length-1,m=0,v=s.length-1;for(;d<=f&&m<=v;)if(r[d]===null)d++;else if(r[f]===null)f--;else if(l[d]===n[m])c[m]=ce(r[d],s[m]),d++,m++;else if(l[f]===n[v])c[v]=ce(r[f],s[v]),f--,v--;else if(l[d]===n[v])c[v]=ce(r[d],s[v]),je(o,c[v+1],r[d]),d++,v--;else if(l[f]===n[m])c[m]=ce(r[f],s[m]),je(o,r[d],r[f]),f--,m++;else if(u===void 0&&(u=La(n,m,v),p=La(l,d,f)),u.has(l[d]))if(u.has(l[f])){let w=p.get(n[m]),T=w!==void 0?r[w]:null;if(T===null){let C=je(o,r[d]);ce(C,s[m]),c[m]=C;}else c[m]=ce(T,s[m]),je(o,r[d],T),r[w]=null;m++;}else jr(r[f]),f--;else jr(r[d]),d++;for(;m<=v;){let w=je(o,c[v+1]);ce(w,s[m]),c[m++]=w;}for(;d<=f;){let w=r[d++];w!==null&&jr(w);}return this.ut=n,Ia(o,c),rt}});var Q=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),q=class q extends Ze{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ia=true;this.uid="";this.Lo="";this.Ro="";this.Uo="";this.oe=0;this.ra=false;this.$o="";this.oa=false;this.sa=false;this.na=false;this.aa=false;this.lr=false;this.la="";this.cr=[];this.ca=false;this.Du=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Fu=()=>{this.ua();};this.S=D(()=>this.da(),100);this.Vu=this.withEntry(Xe((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),l=e===Q.FINISHED,c=e===Q.UPLOADING,u=e===Q.QUEUED_UPLOADING,p=e===Q.QUEUED_VALIDATION,d=e===Q.VALIDATION,f=t.getValue("fileName"),m="";r?m="":!l&&n&&s&&Object.values(dt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${sa(s)}`)})),this.Uo=m,this.Ro=r,this.ra=c||u||p||d,this.oe=p||d?0:t.getValue("uploadProgress"),this.la=f?this.l10n("a11y-file-item-status",{fileName:f,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.ua=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.S();try{let r=new AbortController;t.setValue("abortController",r);let s=a(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File||l instanceof Blob){let f=(this.i.pluginManager?.snapshot().fileHooks??[]).filter(m=>m.type==="beforeUpload");for(let m of f)try{let v=m.handler({file:l,signal:r.signal}),w=new Promise((C,E)=>setTimeout(()=>E(new Error("beforeUpload hook timed out")),m.timeout)),{file:T}=await Promise.race([v,w]);T!==l&&(l=T,t.setValue("mimeType",l.type||null),t.setValue("isImage",$e(l)),t.setValue("fileSize",l.size),l instanceof File&&t.setValue("fileName",l.name));}catch(v){console.warn(`File hook "beforeUpload" from plugin "${m.pluginId}" failed`,v);}}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:a(d=>{if(d.isComputable){let f=d.value*100;t.setValue("uploadProgress",f);}},"onProgress"),signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),Bo(c,p)},"uploadTask"),n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.S();}catch(r){let s=r instanceof ie&&r.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof ye?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:r}):(console.error("Unknown upload error",r),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:r})})),t===this.entry&&this.S(),this.isConnected&&!s&&this.telemetryManager.sendEventError(r,"file upload. Failed to upload file");}}});}static{a(this,"FileItem");}da(){let t=this.entry;if(!t)return;let e=Q.IDLE;t.getValue("errors").length>0?e=Q.FAILED:t.getValue("isQueuedForUploading")?e=Q.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=Q.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=Q.VALIDATION:t.getValue("isUploading")?e=Q.UPLOADING:t.getValue("fileInfo")&&(e=Q.FINISHED),this.Nu(t,e);}Nu(t,e){e===Q.FAILED?this.$o="badge-error":e===Q.FINISHED&&(this.$o="badge-success"),e===Q.UPLOADING&&(this.aa=false,this.removeAttribute("focused")),this.sa=e===Q.FAILED,this.na=e===Q.UPLOADING,this.oa=e===Q.FINISHED,this.Vu(e);}reset(){super.reset(),this.S.cancel();}ai(t){let[e]=t;e&&e.isIntersecting&&!this.ca&&(this.ia=false,this.ca=true);}pa(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.Ze();return}this.subEntry("isQueuedForValidation",()=>{this.S();}),this.subEntry("isValidationPending",()=>{this.S();}),this.subEntry("uploadProgress",()=>{this.S();}),this.subEntry("isQueuedForUploading",()=>{this.S();}),this.subEntry("fileName",r=>{this.Lo=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.Lo=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.S();}),this.subEntry("errors",()=>this.S()),this.subEntry("isUploading",()=>this.S()),this.subEntry("fileSize",()=>this.S()),this.subEntry("mimeType",()=>this.S()),this.subEntry("isImage",()=>this.S()),this.subEntry("fileInfo",()=>this.Ze()),this.subEntry("isUploading",()=>this.Ze()),this.subEntry("errors",()=>this.Ze()),this.da(),this.Ze();}ha(t){if(this.cfg.filesViewMode==="list"){this.lr=true;return}this.lr=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.pa(this.uid);}Ze(){let t=this.i.pluginManager;if(!t||!this.uid){this.cr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.cr=[];return}this.cr=e.filter(s=>{try{return s.shouldRender(r)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}_u(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e){this.telemetryManager.sendEvent({payload:{metadata:{event:t.id,node:this.tagName,pluginId:t.pluginId}}});try{t.onClick(e);}catch(r){console.error(`Error in plugin file action onClick (${t.id}):`,r);}}}initCallback(){super.initCallback(),this.pa(this.uid),this.subConfigValue("filesViewMode",e=>{this.ha(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.ha(e);}),this.onclick=()=>{q.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused");});},this.sub("*uploadTrigger",e=>{this.entry&&!e.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.ua());});let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Ze())),this.Ze(),q.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.ai.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback(),this.s?.disconnect(),q.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.ia?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.oa} ?data-uploading=${this.na} ?data-failed=${this.sa} ?data-focused=${this.aa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.$o}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.la}><span class="uc-file-name" ?hidden=${!this.lr}>${this.Lo}</span><span class="uc-file-error" ?hidden=${!this.Ro}>${this.Ro}</span><span class="uc-file-hint" ?hidden=${!this.Uo}>${this.Uo}</span></div><div class="uc-file-actions">${this.cr.map(t=>y`<button type="button" @click=${()=>this._u(t)} title=${this.l10n(t.label)} aria-label=${this.l10n(t.label)} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${t.id} ><uc-icon name=${t.icon}></uc-icon></button>`)}<button type="button" @click=${this.Du} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Fu}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.oe} .visible=${this.ra} ?hasFileName=${this.lr}></uc-progress-bar></div>`}};h([g()],q.prototype,"ia",2),h([b({attribute:false})],q.prototype,"uid",2),h([g()],q.prototype,"Lo",2),h([g()],q.prototype,"Ro",2),h([g()],q.prototype,"Uo",2),h([g()],q.prototype,"oe",2),h([g()],q.prototype,"ra",2),h([g()],q.prototype,"$o",2),h([g()],q.prototype,"oa",2),h([g()],q.prototype,"sa",2),h([g()],q.prototype,"na",2),h([g()],q.prototype,"aa",2),h([g()],q.prototype,"lr",2),h([g()],q.prototype,"la",2),h([g()],q.prototype,"cr",2);var xs=q;function Qu(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=a(r=>{r.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}a(Qu,"checkIsDirectory");function Ju(o,i){return new Promise(t=>{let e=0,r=[],s=a(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(r);})):l.isDirectory&&n(l.createReader());},"readEntry"),n=a(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(r);});},"readReaderContent");s(o);})}a(Ju,"readEntryContentAsync");function Ua(o){let i=[],t=[];for(let e=0;e<o.items.length;e++){let r=o.items[e];if(r)if(r.kind==="file"){let s=r.type,n=r;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let c=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();c&&t.push(Ju(c,s).then(u=>{u&&i.push(...u);}));continue}let l=r.getAsFile();l&&t.push(Qu(l).then(c=>{c||i.push({type:"file",file:l});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}a(Ua,"getDropItems");var at=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Ra=["focus"],td=100,Ss=new Map;function ed(o,i){let t=Math.max(Math.min(o[0],i.x+i.width),i.x),e=Math.max(Math.min(o[1],i.y+i.height),i.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}a(ed,"distance");function As(o){let i=0,t=document.body,e=new Set,r=a(v=>{e.add(v);},"handleSwitch"),s=at.INACTIVE,n=a(v=>{o.shouldIgnore()&&v!==at.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=a(()=>i>0,"isDragging");r(v=>o.onChange(v));let c=a(()=>{i=0,n(at.INACTIVE);},"onResetEvent"),u=a(()=>{i+=1,s===at.INACTIVE&&n(at.ACTIVE);},"onDragEnter"),p=a(()=>{i-=1,l()||n(at.INACTIVE);},"onDragLeave"),d=a(v=>{v.preventDefault(),i=0,n(at.INACTIVE);},"onDrop"),f=a(v=>{if(o.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],T=o.element.getBoundingClientRect(),C=Math.floor(ed(w,T)),E=C<td,A=v.composedPath().includes(o.element);Ss.set(o.element,C);let Tt=Math.min(...Ss.values())===C;A&&Tt?(v.preventDefault(),n(at.OVER)):n(E&&Tt?at.NEAR:at.ACTIVE);},"onDragOver"),m=a(async v=>{if(o.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let T=await Ua(w);o.onItems(T),n(at.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",f),o.element.addEventListener("drop",m),Ra.forEach(v=>{window.addEventListener(v,c);}),()=>{Ss.delete(o.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",f),o.element.removeEventListener("drop",m),Ra.forEach(v=>{window.removeEventListener(v,c);});}}a(As,"addDropzone");var ks=new Set,pt=class extends ${constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.Ie=true;this.fa=true;this.Do="drop-files-here";this.ma=false;this.va=null;this.Fo=null;this.ya=O();this.Lt=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.ba=true;this.Rt=false;}static{a(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}ga(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Do=this.l10n(t)||t;return}this.Do=this.ma?this.l10n("drop-files-here"):this.l10n("drop-file-here");}isActive(){if(!this.Ie)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&r}initCallback(){super.initCallback(),ks.add(this),this.No(),this.Vo(),this.wa(),this.Ta(at.INACTIVE),this.va=As({element:this,shouldIgnore:a(()=>this.Ea(),"shouldIgnore"),onChange:a(t=>{this.Ta(t);},"onChange"),onItems:a(t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:_.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:_.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.set$({"*currentActivity":S.activities.UPLOAD_LIST}),this.modalManager?.open(S.activities.UPLOAD_LIST)));},"onItems")}),this.updateComplete.then(()=>this.Bu()),this.subConfigValue("sourceList",t=>{let e=Y(t);this.ba=e.includes(_.LOCAL),this.No(),this.Vo();}),this.subConfigValue("multiple",t=>{this.ma=!!t,this.ga();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.No(),this.Vo()),(t.has("text")||t.has("localeId"))&&this.ga();}updated(t){super.updated(t),t.has("clickable")&&this.wa();}Ea(){if(!this.Ie||!this.zu())return true;if(!this.fullscreen)return false;let t=ks;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}zu(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}No(){let t=this.ba&&!this.disabled;this.Ie=t;}Vo(){let t=this.Ie||!this.querySelector("[data-default-slot]");this.fa=t,this.hidden=!t;}Ta(t){let e=Object.entries(at).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}Bu(){if(this.Fo)return;let t=this.ya.value;t&&(this.Fo=As({element:t,onChange:a(e=>{let r=Object.entries(at).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},"onChange"),onItems:a(()=>{},"onItems"),shouldIgnore:a(()=>this.Ea(),"shouldIgnore")}));}wa(){this.clickable&&!this.Rt?(this.addEventListener("keydown",this.Lt),this.addEventListener("click",this.Lt),this.Rt=true):!this.clickable&&this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}disconnectedCallback(){super.disconnectedCallback(),ks.delete(this),this.va?.(),this.Fo?.(),this.Rt&&(this.removeEventListener("keydown",this.Lt),this.removeEventListener("click",this.Lt),this.Rt=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${P(this.ya)} class="uc-content-wrapper" ?hidden=${!this.fa}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.Do}</span></div>`)} `}};h([b({type:Boolean,noAccessor:true})],pt.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],pt.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],pt.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],pt.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],pt.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],pt.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],pt.prototype,"initflow",2),h([b({type:String})],pt.prototype,"text",2),h([g()],pt.prototype,"Ie",2),h([g()],pt.prototype,"fa",2),h([g()],pt.prototype,"Do",2);var Pt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=S.activities.UPLOAD_LIST;this.xa=false;this.Ca=false;this.Sa=false;this._o=false;this.Bo=false;this.ur=null;this.Aa=false;this.zo=null;this.ka=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.Ho=()=>{this.emit(M.UPLOAD_CLICK),this.api.uploadAll(),this.Te();};this.Ko=()=>{this.emit(M.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ee=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Te=Xe(()=>{this.isConnected&&(this.ju(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{a(this,"UploadList");}get Hu(){return this.zo?this.Ku(this.zo):""}ju(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(m=>m.isValidationPending).length},r=!t.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=t.errors.some(m=>m.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(m=>m.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&c&&this.cfg.confirmUpload)u=true;else {p=true;let m=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&r&&c&&m;}this.xa=p,this.Ca=d,this.Sa=u,this.Bo=e.total===0||!s&&!n,this._o=!n||this.cfg.multiple,this.Aa=e.total>0,this.zo=e;}Ku(t){let e=a(r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Te),this.subConfigValue("multipleMin",this.Te),this.subConfigValue("multipleMax",this.Te),this.sub("*groupInfo",t=>{t&&this.Te();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.Te),this.uploadCollection.observeCollection(this.Te),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.ur=null;return}this.ur=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Te),this.uploadCollection.unobserveCollection(this.Te));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.Hu}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Aa}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${ki(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.ka} ?disabled=${!this.Bo} ?hidden=${!this._o} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.ur} >${this.ur??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this._o} ?disabled=${!this.Bo} @click=${this.ka} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.Sa} @click=${this.Ho} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.xa} ?disabled=${!this.Ca} @click=${this.Ko} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Pt.prototype,"xa",2),h([g()],Pt.prototype,"Ca",2),h([g()],Pt.prototype,"Sa",2),h([g()],Pt.prototype,"_o",2),h([g()],Pt.prototype,"Bo",2),h([g()],Pt.prototype,"ur",2),h([g()],Pt.prototype,"Aa",2),h([g()],Pt.prototype,"zo",2);var id=[{test:a(o=>!!o.accept&&!!o.imgOnly,"test"),message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:a(o=>o.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:a(o=>o.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],$a=D(o=>{for(let{test:i,message:t}of id)i(o)&&Fr(t);},0);var Da=a((o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),rd="0123456789abcdefghijklmnopqrstuvwxyz",Fa=a(o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=rd[Number(t)]+i,o=o/36n;}return i},"a"),Ms=a((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var od=a(async o=>{let i=new TextEncoder().encode(o),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),sd=10,nd=a(async o=>{let i=await od(o);return Fa(i).slice(0,sd)},"d"),Va=a(async(o,i)=>{let t=await nd(o);return Da(t,i)},"f");var Na=a(o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function"),"isPromiseLike");var Is=a(o=>o,"defineComputedProperty"),ad=[Is({key:"cameraModes",deps:["enableVideoRecording"],fn:a(({cameraModes:o,enableVideoRecording:i})=>{let t=i();if(t===null)return o();let e=j(o());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(r=>r!=="video")),Kt(e)},"fn")}),Is({key:"cameraModes",deps:["defaultCameraMode"],fn:a(({cameraModes:o,defaultCameraMode:i})=>{let t=i();if(t===null)return o();let e=j(o());return e=e.sort((r,s)=>r===t?-1:s===t?1:0),Kt(e)},"fn")}),Is({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:a(({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===hi||Ms(r,s))?Va(e,s):r},"fn")})],_a=a(({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of ad){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let c of r.deps)s[c]=()=>t(c);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let l;try{l=r.fn(s,{signal:n.signal});}catch(c){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,c);return}Na(l)?l.then(c=>{n.signal.aborted||i(r.key,c);}).catch(c=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,c);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,l);}},"computeProperty");var N=a(o=>String(o),"asString"),et=a(o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},"asNumber"),B=a(o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},"asBoolean"),za=a(o=>o==="auto"?o:B(o),"asStore"),Ba=a(o=>{let i=N(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),Ha=a(o=>{let i=N(o);if(!Object.values(L).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),Ka=a(o=>{let i=N(o),t=j(i);if(t.some(e=>!Object.values(L).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),ja=a(o=>{let i=N(o);if(i==="local"||i==="global")return i;if(B(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},"asPasteScope"),Ga=a(o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Os=a(o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},"asObject"),Yr=a(o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},"asFunction"),Xr=a(o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},"asArray"),qa=a(o=>{let i=N(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode");var ld={pubkey:N,multiple:B,multipleMin:et,multipleMax:et,confirmUpload:B,imgOnly:B,accept:N,externalSourcesPreferredTypes:N,externalSourcesEmbedCss:N,store:za,cameraMirror:B,cameraCapture:Ba,sourceList:N,topLevelOrigin:N,maxLocalFileSizeBytes:et,thumbSize:et,showEmptyList:B,useLocalImageEditor:B,useCloudImageEditor:B,cloudImageEditorTabs:N,removeCopyright:B,cropPreset:N,imageShrink:N,modalScrollLock:B,modalBackdropStrokes:B,sourceListWrap:B,remoteTabSessionKey:N,cdnCname:N,cdnCnamePrefixed:N,baseUrl:N,socialBaseUrl:N,secureSignature:N,secureExpire:N,secureDeliveryProxy:N,retryThrottledRequestMaxTimes:et,retryNetworkErrorMaxTimes:et,multipartMinFileSize:et,multipartChunkSize:et,maxConcurrentRequests:et,multipartMaxConcurrentRequests:et,multipartMaxAttempts:et,checkForUrlDuplicates:B,saveUrlForRecurrentUploads:B,groupOutput:B,userAgentIntegration:N,debug:B,localeName:N,metadata:Ga,secureUploadsExpireThreshold:et,localeDefinitionOverride:a(o=>Os(o),"localeDefinitionOverride"),secureUploadsSignatureResolver:a(o=>Yr(o),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:a(o=>Yr(o),"secureDeliveryProxyUrlResolver"),iconHrefResolver:a(o=>Yr(o),"iconHrefResolver"),plugins:a(o=>Xr(o),"plugins"),fileValidators:Xr,collectionValidators:Xr,validationTimeout:et,validationConcurrency:et,cameraModes:Ka,defaultCameraMode:Ha,enableAudioRecording:B,enableVideoRecording:B,mediaRecorderOptions:Os,maxVideoRecordingDuration:et,filesViewMode:qa,gridShowFileNames:B,cloudImageEditorAutoOpen:B,cloudImageEditorMaskHref:N,testMode:B,qualityInsights:B,pasteScope:ja},Wa=a((o,i)=>{if(!(typeof i>"u"||i===null))try{return ld[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),tt[o]}},"normalizeConfigValue");var Qr=[...new Set(["debug",...Object.keys(tt)])],cd=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Ya=a(o=>cd.includes(o),"isComplexKey"),Ls=Qr.filter(o=>!Ya(o)),Ps={...Object.fromEntries(Ls.map(o=>[ur(o),o])),...Object.fromEntries(Ls.map(o=>[o.toLowerCase(),o]))},Za=a(o=>`__${o}`,"getLocalPropName"),Qe=class extends x{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(tt).map(([t,e])=>[k(t),e]))};this.Gu=new Map;this.ci={};this.Ma=new Set;this.Ut=new Map;}static{a(this,"Config");}jo(t){return this.Ma.has(t)}Go(t){let e=this.i.pluginManager;if(e)return e.configRegistry.get(t)}Ia(t){return [...new Set([ur(t),t.toLowerCase()])]}qu(t,e){if(Ya(t)||this.jo(t)&&this.Go(t)?.attribute===false)return;let r=this.Ia(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}Wu(t,e){let r=k(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=tt[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}Ye(t,e){let r;if(this.jo(t)){let l=this.Go(t);try{r=l?.normalize?.(e)??e;}catch(c){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,c);return}}else r=Wa(t,e);let s=this,n=Za(t);s[n]!==r&&(this.Zu(t,s[n],r),s[n]=r,this.qu(t,r),this.Wu(t,r),this.debugPrint(`"${t}"`,r),this.jo(t)||$a(this.cfg));}pr(t){let e=this,r=Za(t);return e[r]??this.$[k(t)]}Zu(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r));}Oa(t){let e=t.configRegistry.getAll();this.ci={},this.Ma=new Set(e.keys());for(let[r,s]of this.Ut)e.has(r)||(s(),this.Ut.delete(r));for(let[r,s]of e){let l=k(r);if(s.attribute){let u=this.Ia(r);for(let p of u)this.ci[p]=r;}this.sharedCtx.has(l)||this.sharedCtx.add(l,s.defaultValue);let c=Object.getOwnPropertyDescriptor(this,r);if((!c||!c.set||!c.get)&&Object.defineProperty(this,r,{set:a(u=>{this.Ye(r,u);},"set"),get:a(()=>this.pr(r),"get"),enumerable:true,configurable:true}),!this.Ut.has(r)){let u=this.sub(l,p=>{this.Ye(r,p);},false);this.Ut.set(r,u);}}}Yu(){this.i.when("pluginManager",t=>{this.Oa(t),this.dr=t.onPluginsChange(()=>{this.Oa(t);});});}Xu(){this.li=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let r=e.attributeName,s=e.oldValue,n=this.getAttribute(r);if(s===n||r in Ps)continue;if(r in this.ci){let c=this.ci[r],u=this.Go(c);this.attributeChangedCallback(r,s??"",n??u?.defaultValue??"");}}}),this.li.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.Yu(),this.Xu();for(let r of Ls)this.sub(k(r),s=>{this.Ye(r,s);},false);for(let r of Qr){let s=t[r]??this.$[k(r)];s!==tt[r]&&this.Ye(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a(l=>{this.Ye(r,l);},"set"),get:a(()=>this.pr(r),"get")});}let e=a(r=>{_a({key:r,setValue:this.Ye.bind(this),getValue:this.pr.bind(this),computationControllers:this.Gu});},"runComputeProperty");for(let r of Qr)this.sub(k(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ps[t];n?s[n]=r:this.i.when("pluginManager",l=>{let c=this.getAttribute(t);if(c&&c!==r)return;let u=this.ci[t],p=u?l.configRegistry.get(u):void 0;if(u&&p){let d=p.fromAttribute?p.fromAttribute(r):r;if(this.pr(u)===d)return;this.Ye(u,d);}});}disconnectedCallback(){super.disconnectedCallback(),this.dr&&(this.dr(),this.dr=void 0),this.li&&(this.li.disconnect(),this.li=void 0);for(let t of this.Ut.values())t();this.Ut.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(Ps);return [...t,...e]}};for(let o of Qr)Qe.prototype[o]=void 0;var Mi=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.ui="upload-file";this.Qu=()=>{this.api.initFlow();};}static{a(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.ui=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.Qu}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.ui)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Mi.prototype,"dropzone",2),h([g()],Mi.prototype,"ui",2);var Ii=class extends S{constructor(){super(...arguments);this.Wo=O();}static{a(this,"PluginActivityHost");}initCallback(){this.activityType=this.registration?.id??null,this.Pa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Pa(),this.isActivityActive&&(this.hr(),this.La()));}Pa(){this.registration&&(this.Pn()||this.registerActivity(this.activityType??"",{onActivate:a(()=>this.La(),"onActivate"),onDeactivate:a(()=>this.hr(),"onDeactivate")}));}async La(){await this.updateComplete;let t=this.Wo.value;if(!t||!this.registration)return;this.hr();let e=this.$["*currentActivityParams"];try{this.qo=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}hr(){let t=this.Wo.value;if(t){try{this.qo?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.qo=void 0,t.replaceChildren();}}disconnectedCallback(){this.hr(),super.disconnectedCallback();}render(){return y`<div style="display: contents;" ${P(this.Wo)}></div>`}};h([b({attribute:false})],Ii.prototype,"registration",2);var Je=class extends x{constructor(){super(...arguments);this.mode="modal";this.de=[];}static{a(this,"PluginActivityRenderer");}initCallback(){super.initCallback();let t=this.i.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Ra())),this.Ra();}Ra(){let t=this.i.pluginManager;if(!t){this.de=[];return}this.de=t.snapshot().activities;}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?y`${ki(this.de,t=>t.id,t=>y`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:y`${ki(this.de,t=>t.id,t=>y`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};h([b({type:String})],Je.prototype,"mode",2),h([g()],Je.prototype,"de",2);function Oi(o,i,t){return o?i(o):t?.(o)}a(Oi,"n");function Xa(...o){return o.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}a(Xa,"normalize");function bt(...o){let i=Xa(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}a(bt,"classNames");function Qa(o,...i){let t=Xa(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}a(Qa,"applyClassNames");var ud=a(o=>st.includes(o),"isTabIdValue"),Ja=a(o=>{if(!o)return st;let i=j(o).filter(ud);return i.length===0?st:i},"parseTabs");function tl(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":st,"*tabId":H.CROP,"*on.retryNetwork":a(()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ot,t.src=e;}o.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":a(i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=ot(ee(i),"preview"),r=Z(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.apply"),"*on.cancel":a(()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}a(tl,"initState");var el="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Se={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ti=class extends x{constructor(){super(...arguments);this.he=false;this.Ua=Se;this.$a=Se.visible;this.Da=Se.hidden;this.Zo=false;this.Fa=false;}static{a(this,"PresenceToggle");}set visible(t){this.he=t,this.Na();}get visible(){return this.he}set styles(t){this.Ua=t,this.Zo=true,this.$a=t.visible??Se.visible,this.Da=t.hidden??Se.hidden;}get styles(){return this.Ua}Na(){this.style.visibility=this.he?"inherit":"hidden",Qa(this,{[Se.transition]:!this.Zo,[this.$a]:this.he,[this.Da]:!this.he}),this.toggleAttribute("inert",!this.he);}Ju(){this.Fa||(this.Fa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Zo||this.classList.add(Se.transition),this.Na(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Ju();},0);}};h([b({type:Boolean})],ti.prototype,"visible",1),h([b({attribute:false})],ti.prototype,"styles",1);var Pi=class extends x{constructor(){super(...arguments);this.active=false;this.Xe=O();this.Yo=false;this.Xo=()=>{let t=this.Xe.value;t&&(this.Va(t),this.Yo&&this.active&&this.Qo());};}static{a(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.Qo();}updated(t){super.updated(t),t.has("active")&&(this.active?this.Qo():this.ed());}Qo(){let t=this.Xe.value;if(!t)return;this.Yo=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Xo),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Xo,{once:true});}ed(){let t=this.Xe.value;t&&(this.Yo=false,t.removeEventListener("transitionend",this.Xo),this.Va(t));}Va(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${P(this.Xe)}></div></div>`}};h([b({type:Boolean,reflect:true})],Pi.prototype,"active",2);var Lt=vt(class extends Ct{constructor(o){if(super(o),o.type!==Dt.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter(i=>o[i]).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return rt}});var W=a(o=>o??R,"o");var St=class extends x{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{a(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this._a(),this.Ba();}updated(t){super.updated(t),t.has("reverse")&&this._a(),t.has("theme")&&this.Ba();}_a(){this.style.flexDirection=this.reverse?"row-reverse":"";}Ba(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get td(){let t=this.Jo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.rd}}get Jo(){return !this.icon}get rd(){return !this.text&&!this.Jo}render(){return y`<button type="button" role=${W(this.ariaRole||void 0)} aria-controls=${W(this.ariaControls||void 0)} aria-label=${W(this.l10n(this.titleProp))} title=${W(this.l10n(this.titleProp))} ><uc-icon class=${Lt(this.td)} name=${W(this.icon||void 0)} ?hidden=${this.Jo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],St.prototype,"text",2),h([b({type:String})],St.prototype,"icon",2),h([b({type:Boolean,reflect:true})],St.prototype,"reverse",2),h([b({type:String,reflect:true})],St.prototype,"theme",2),h([b({attribute:"aria-role"})],St.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],St.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],St.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],St.prototype,"active",2);function il(o,i){let t={};for(let e of i){let r=o[e];(Object.hasOwn(o,e)||r!==void 0)&&(t[e]=r);}return t}a(il,"pick");function ei(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return Z(o,ot(ar,ee(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Rt}/${$t}/uc-cloud-image-editor/`))}a(ei,"viewerImageSrc");var Li=class extends x{constructor(){super(...arguments);this.za=`uc-backdrop-mask-${mt.generateFastUid()}`;this.mr=false;this.fi=false;this.ja=O();this.mi=false;this.gi=null;this.qa=t=>{this.Wa(),this.vi&&(t.stopPropagation(),t.preventDefault(),this.vi=false);};this.Za=t=>{if(!this.vi||!this.fr||!this.ts)return;t.stopPropagation(),t.preventDefault();let e=this.Re;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,l=t.y-s,c=n-this.fr[0],u=l-this.fr[1],{direction:p}=this.ts,d=this.pd(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.Ya=t=>{if(!this.xe)return;let e=Object.values(this.xe).find(r=>{if(!r||this.os(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),l={x:n.x,y:n.y,width:n.width,height:n.height};return ga(l,[t.x,t.y])});this.Ha=e,this.Wa();};}static{a(this,"CropFrame");}get Re(){return this.ja.value??null}get vi(){return this.fi}set vi(t){this.fi!==t&&(this.fi=t,this.rs());}rs(){this.pi&&this.pi.setAttribute("class",bt({"uc-guides--hidden":this.mr,"uc-guides--visible":!this.mr&&this.fi,"uc-guides--semi-hidden":!this.mr&&!this.fi}));}os(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=I&&e.width<=I)return true;let r=e.height<=I&&(t.includes("n")||t.includes("s")),s=e.width<=I&&(t.includes("e")||t.includes("w"));return r||s}od(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,l=this.Re;if(!l)return;let c=yt("mask",{id:this.za}),u=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=yt("rect",{x:e,y:r,width:s,height:n,fill:"black"});c.appendChild(u),c.appendChild(p);let d=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.za})`});l.appendChild(d),l.appendChild(c),this.di=c,this.es=p;}sd(){this.di&&(this.di.style.display="none",window.requestAnimationFrame(()=>{this.di&&(this.di.style.display="block");}));}nd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.es&&ne(this.es,{x:e,y:r,width:s,height:n});}ad(){let t=this.$["*cropBox"];if(!(!t||!this.pi||!this.xe)){for(let e of Object.values(this.xe)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:l}=e,c=r==="",u=r.length===2,{x:p,y:d,width:f,height:m}=t;if(c)ne(n,{x:p,y:d,width:f,height:m});else {let w=ae(Math.min(f,m)/82/2,0,1),T=u?da(t,r,w):pa(t,r,w),C=T.center;if(!C)continue;let E=Math.max(ls*ae(Math.min(f,m)/ls/3,0,1),ua);ne(n,{x:C[0]-E,y:C[1]-E,width:E*2,height:E*2}),ne(s,{d:T.d});}let v=this.os(r);l.setAttribute("class",bt("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}ne(this.pi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}Ga(t,e){let r=yt("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=yt("rect",{fill:"transparent"}),n=yt("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.ld.bind(this,e));}cd(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.Ga(t,s);}return this.Ga(t,""),t}ud(){let t=yt("svg"),e=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let r=1;r<=2;r++){let s=yt("line",{x1:`${wi*r}%`,y1:"0%",x2:`${wi*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=yt("line",{x1:"0%",y1:`${wi*r}%`,x2:"100%",y2:`${wi*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}dd(){let t=this.Re;if(!t)return;let e=document.createDocumentFragment(),r=this.ud();e.appendChild(r);let s=this.cd();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.xe=s,this.pi=r,this.rs();}ld(t,e){if(!this.xe)return;let r=this.xe[t];if(!r||this.os(t))return;let s=this.$["*cropBox"],n=this.Re;if(!n)return;let{x:l,y:c}=n.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.vi=true,this.ts=r,this.fr=[u,p],this.Ka={...s};}pd(t,e){let[r,s]=e,n=this.$["*imageBox"],l=this.Ka??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=fa({rect:l,delta:[r,s],imageBox:n}):l=ma({rect:l,delta:[r,s],direction:t,aspectRatio:u,imageBox:n}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return _e(Be(l),n)}Wa(){let t=this.Ha,e=this.Re;e&&(e.style.cursor=t?ha(t.direction):"initial");}Xa(t){if(this.hi){this.hi.setAttribute("href",t);return}let e=this.Re;if(!e){this.gi=t;return}this.gi=null;let r=document.createDocumentFragment(),s=yt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.hi=s;}hd(){let t=this.$["*cropBox"];if(!t||!this.hi)return;let{x:e,y:r,width:s,height:n}=t;ne(this.hi,{x:e,y:r,height:n,width:s});}ss(){this.mi&&(this.nd(),this.ad(),this.hd());}toggleThumbs(t){if(this.xe)for(let e of Object.values(this.xe)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",bt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.sd(),this.mi&&window.requestAnimationFrame(()=>{this.ss();});}),this.sub("*cropBox",t=>{t&&(this.mr=t.height<=I||t.width<=I,this.rs(),this.mi&&window.requestAnimationFrame(()=>{this.ss();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.Xa(t);}),document.addEventListener("pointermove",this.Za,true),document.addEventListener("pointerup",this.qa,true);}firstUpdated(t){super.firstUpdated(t),this.fd();}fd(){let t=this.Re;if(!(!t||this.mi)){if(this.od(),this.dd(),this.mi=true,t.addEventListener("pointermove",this.Ya,true),this.gi){let e=this.gi;this.gi=null,this.Xa(e);}this.ss();}}disconnectedCallback(){super.disconnectedCallback(),this.Re?.removeEventListener("pointermove",this.Ya,true),document.removeEventListener("pointermove",this.Za,true),document.removeEventListener("pointerup",this.qa,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${P(this.ja)}></svg>`}};h([g()],Li.prototype,"fi",2);function pd(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(o)):true}a(pd,"validateCrop");var Ui=class extends x{constructor(){super();this.ctxOwner=true;this.Qe={width:0,height:0};this.e=null;this._=false;this.se=null;this.Ja=O();this.as=O();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.Qa=D(this.tl.bind(this),300),this.ns=Xe(()=>{!this.isConnected||!this._||(this.ls(),this.il(),this.rl(),this.cs(),this.us());},100);}static{a(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.ls();}il(){let t=this.$["*editorTransformations"],e=il(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}ls(){let t=this.Ja.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*n,t.height=s*n,e?.scale(n,n),this.fe=t,this.e=e;}rl(){if(!this._||!this.se)return;let t=this.se,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},l=ze({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>n.width-e*2||l.height>n.height-e*2){let u=l.width/l.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,f=d/u,m=0+e,v=e+(n.height-e*2)/2-f/2;c={x:m,y:v,width:d,height:f};}else {let d=n.height-e*2,f=d*u,m=e+(n.width-e*2)/2-f/2,v=0+e;c={x:m,y:v,width:f,height:d};}}else {let{width:u,height:p}=l,d=e+(n.width-e*2)/2-u/2,f=e+(n.height-e*2)/2-p/2;c={x:d,y:f,width:u,height:p};}this.$["*imageBox"]=Be(c);}cs(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(n){let{dimensions:[f,m],coords:[v,w]}=n,{width:T}=ze(this.Qe,s),C=l/T;t=_e(Be({x:c+v*C,y:u+w*C,width:f*C,height:m*C}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!va(t,e)||d&&!ya(t,d)){let f=e.width/e.height,m=e.width,v=e.height;d&&(f>d?m=Math.min(e.height*d,e.width):v=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-v/2,width:m,height:v};}this.$["*cropBox"]=_e(Be(t),e);}md(){let t=this.e;if(!t)return;let e=this.se;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:l,rotate:c}=s,u=ze({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}us(){if(!this._||!this.se||!this.fe||!this.e)return;let t=this.fe;this.e.clearRect(0,0,t.width,t.height),this.md();}gd({fromViewer:t}){this.se&&(this.as.value?.toggleThumbs(true),this.vd(),setTimeout(()=>{this.className=bt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}ol(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l}=e,{width:c,height:u}=ze(this.Qe,s),{width:p,height:d}=t,f=n/c,m=l/u;return [ae(Math.round(p/f),1,c),ae(Math.round(d/m),1,u)]}yd(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:l,x:c,y:u}=e,{width:p,height:d}=ze(this.Qe,s),{x:f,y:m}=t,v=n/p,w=l/d,T=this.ol(),C={dimensions:T,coords:[ae(Math.round((f-c)/v),0,p-T[0]),ae(Math.round((m-u)/w),0,d-T[1])]};if(!pd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(T[0]===p&&T[1]===d))return C}tl(){if(!this.isConnected||!this.Qe)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.yd(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.rl(),this.cs(),this.us());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.ls(),this.Qe=t,this.removeEventListener("transitionend",this.sl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.se=await this.bd(r,s),this.il(),this.ns(),this.gd({fromViewer:e});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(r=>{let[s]=r;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this._&&this.se&&this.ns();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.tl(),this._=false,this.wd(),this.className=bt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.as.value?.toggleThumbs(false),this.addEventListener("transitionend",this.sl,{once:true}),this.s?.disconnect());}wd(){let t=this.ol(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-l)/n}px, ${(this.offsetHeight/2-c)/n}px)`,this.style.transformOrigin=`${l}px ${c}px`;}vd(){let t=this.$["*cropBox"],e=t.x+t.width/2,r=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${r}px`;}sl(){this._||(this.se=null);}async bd(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(ei(t,r,e)),{promise:n,cancel:l,image:c}=xe(s),u=this.$t(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,n.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}$t(t){let e="crop",r=this.$["*loadingOperations"],s=r.get(e);return s||(s=new Map,r.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.us();}),this.sub("*cropBox",()=>{this.se&&this.Qa();}),this.sub("*currentAspectRatio",()=>{this.cs();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.Qe&&this.activate(this.Qe,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.se&&(this.se=null);}render(){return y`<canvas class="uc-canvas" ${P(this.Ja)}></canvas><uc-crop-frame ${P(this.as)}></uc-crop-frame>`}};h([g()],Ui.prototype,"se",2);function Us(o,i,t){let e=t,r=t-1,s=new Array(e);for(let n=r;n>=0;n-=1)s[n]=Math.ceil((n*i+(r-n)*o)/r);return s}a(Us,"linspace");function hd(o){return typeof o=="string"&&o in Mt}a(hd,"isOperationKey");function fd(o){let i=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],r=o[t+1];typeof e=="number"&&typeof r=="number"&&i.push([e,r]);}return i}a(fd,"splitBySections");function md(o,i,t){let e=fd(o).find(([n,l])=>n<=i&&i<=l);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let l=Math.abs(r-s)||1,c=Math.abs(i-r)/l;return r===n?i>t?1:1-c:s===n?i>=t?c:1:0})}a(md,"calculateOpacities");function gd(o,i){return o.map((t,e)=>t<i?o.length-e:e)}a(gd,"calculateZIndices");function rl(o,i){let t=Mt[o].keypointsNumber,{range:e,zero:r}=Mt[o];return [...new Set([...Us(e[0],r,t+1),...Us(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}a(rl,"keypointsRange");var Jr=class extends x{constructor(){super();this._=false;this.ds=true;this.n="initial";this.nl={};this.Ue=[];this.al=0;this.cl=O();this.gr=O();this.classList.add("uc-inactive_to_cropper"),this.ll=D(async(t,e,r)=>{let s=a(()=>!this.ul(t,e)||this.Pt!==r||!!this.Ue.find(u=>u.value===r),"shouldSkip");if(s())return;let n=await this.dl(t,r),l=new Image;l.src=n.src;let c=this.$t(n.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),n.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.Ue,p=u.findIndex(v=>v.value>r);p===-1&&(p=u.length);let f=u[p]?.image,m=this.gr.value;!m||f&&!m.contains(f)||(u.splice(p,0,n),f?m.insertBefore(l,f):m.appendChild(l),this.fs(t,r));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{a(this,"EditorImageFader");}$t(t){let e=this.n,r=this.$["*loadingOperations"];r.has(e)||r.set(e,new Map);let s=r.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}pl(){window.cancelAnimationFrame(this.al),this.al=window.requestAnimationFrame(()=>{for(let t of this.Ue){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}Je({url:t=this.Dt,filter:e=this.m??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.nl};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let l=this.offsetWidth;return this.proxyUrl(ei(t,l,n))}async dl(t,e){return {src:await this.Je({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}ul(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!hd(this.n)||!Number.isFinite(e)||(this.fs(this.n,e),this.ll(this.n,this.m,e));}fs(t,e){this.n=t,this.Pt=e;let{zero:r}=Mt[t],s=this.Ue.map(c=>c.value),n=md(s,e,r),l=gd(s,r);this.Ue.forEach((c,u)=>{let p=n[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.pl();}hl(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Td(){this.a=this.a||this.hl();let t=this.a;t&&this.fl(t);let e=this.Ue.map(u=>u.src),{images:r,promise:s,cancel:n}=Ai(e);r.forEach(u=>{let p=this.$t(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.ps=()=>{n(),this.ps=void 0;};let l=this.n,c=this.m;if(await s,this._&&this.ul(l,c)){let u=this.gr.value;if(!u)return;u.replaceChildren(),this.Ue.forEach((p,d)=>{let f=r[d];f&&(f.classList.add("uc-fader-image"),p.image=f,u.appendChild(f));}),this.pl();}}async setTransformations(t){if(this.nl=t,this.a){let e=await this.Je(),r=this.$t(e);this.a.src=e,this.a.addEventListener("load",r,{once:true}),this.a.addEventListener("error",r,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:s}){if(!r||typeof s!="number")return;this.hs?.();let n=rl(r,s),l=await Promise.all(n.map(u=>this.Je({url:t,filter:e,operation:r,value:u}))),{cancel:c}=Ai(l);this.hs=c;}Ed(t){let e=this.a||this.hl();if(this.fl(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=bt({"uc-active_from_viewer":this.yi,"uc-active_from_cropper":!this.yi,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.$t(t);e.addEventListener("error",r,{once:true}),e.src=t,e.addEventListener("load",()=>{r(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=bt({"uc-active_from_viewer":this.yi,"uc-active_from_cropper":!this.yi,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:r,filter:s,fromViewer:n}){if(this._=true,this.ds=false,await this.updateComplete,this.Dt=t,this.n=e??"initial",this.Pt=r,this.m=s,this.yi=n,typeof r!="number"&&!s){let c=await this.Je({operation:e,value:r});this.Ed(c),this.ms();return}!e||typeof r!="number"||(this.Ue=await Promise.all(rl(e,r).map(c=>this.dl(e,c))),this.fs(e,r),this.Td());}deactivate({hide:t=true}={}){this._=false,this.ps?.(),this.hs?.(),t&&!this.ds?(this.ds=true,this.a&&(this.a.style.transform="scale(1)"),this.className=bt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.ms();},{once:true})):this.ms();}fl(t){let e=this.cl.value;e&&(e.contains(t)||e.appendChild(t));}ms(){this.gr.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${P(this.cl)}></div><div class="uc-fader-layers-host" ${P(this.gr)}></div>`}};var ol="important",vd=" !"+ol,ke=vt(class extends Ct{constructor(o){if(super(o),o.type!==Dt.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(o,[i]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith(vd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?ol:""):t[e]=r;}}return rt}});var Nt=class extends x{constructor(){super();this.gs=0;this.vr=O();this.gl=O();this.vl=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.$e=0;this.Cd=t=>{t.stopPropagation();let e=this.yl(t);e!==null&&(this.vs(e),this.xd("slider-input",e));};this.Sd=t=>{t.stopPropagation();let e=this.yl(t);e!==null&&this.vs(e);};this.bl=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.wl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{a(this,"SliderUi");}xd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.gs=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Tl(this.$e),this.ys(),this.s=new ResizeObserver(()=>{this.ys(),this.yr(this.$e);}),this.s.observe(this);let e=this.vr.value;e?.addEventListener("focus",this.bl),e?.addEventListener("blur",this.wl),window.setTimeout(()=>{this.yr(this.$e);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.$e&&this.vs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.ys(),this.yr(this.$e)),t.has("zero")&&this.hasUpdated&&this.El(this.$e);}yr(t){this.El(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(r-this.gs)/100;window.requestAnimationFrame(()=>{let c=this.gl.value;c&&(c.style.transform=`translateX(${l}px)`);});}El(t){if(!this.bi)return;let e=this.max-this.min;if(e===0)return;this.bi.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(r-this.gs)/100;window.requestAnimationFrame(()=>{this.bi&&(this.bi.style.transform=`translateX(${l}px)`);});}ys(){let e=this.vl.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.ml===n)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.bi=p,e.innerHTML="",e.appendChild(l),this.ml=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.vr.value;t?.removeEventListener("focus",this.bl),t?.removeEventListener("blur",this.wl),this.s?.disconnect(),this.s=void 0;}vs(t){Number.isFinite(t)&&(this.$e=t,this.hasUpdated&&(this.Tl(t),this.yr(t)));}Tl(t){let e=this.vr.value;e&&(e.value=String(t));}yl(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return y`<div class="uc-steps" ${P(this.vl)}></div><div class="uc-thumb" ${P(this.gl)}></div><input class="uc-input" type="range" ${P(this.vr)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.$e)} ?disabled=${this.disabled} @input=${this.Cd} @change=${this.Sd} />`}};h([b({type:Boolean,reflect:true})],Nt.prototype,"disabled",2),h([b({type:Number})],Nt.prototype,"min",2),h([b({type:Number})],Nt.prototype,"max",2),h([b({type:Number,attribute:false})],Nt.prototype,"defaultValue",2),h([b({type:Number})],Nt.prototype,"zero",2),h([g()],Nt.prototype,"$e",2);var _t="original",Ri=class extends x{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.bs=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{a(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.Ad();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===_t?void 0:this.state.value,filter:this.state.filter===_t?void 0:this.state.filter,fromViewer:false});}Ad(){let t=this.state.operation,{range:e,zero:r}=Mt[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),d=c;if(d){let{name:f,amount:m}=d;p=f===this.state.filter?m:n;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:r;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===_t?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return y`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.bs} ></uc-slider-ui>`}};h([g()],Ri.prototype,"state",2);function ii(o){if(!o)return null;let i=o.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}a(ii,"parseFilterValue");var lt=class extends x{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{a(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}xl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.xl();}updated(t){super.updated(t),t.has("active")&&this.xl();}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],lt.prototype,"active",2),h([g()],lt.prototype,"title",2),h([g()],lt.prototype,"icon",2),h([g()],lt.prototype,"titleProp",2);var to=12,eo=16,yd=a(o=>{let i=12,t=12;return o.width/o.height>=1?(i=to,t=Math.round(to*o.height/o.width)):(t=to,i=Math.round(to*o.width/o.height)),{width:i,height:t}},"getAdjustResolutions"),io=class extends lt{static{a(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.kd(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}kd(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return y`<button role="option" type="button" class=${Lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},$i=class extends lt{constructor(){super(...arguments);this.X=null;}static{a(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.X}set aspectRatio(t){if(this.X===t)return;let e=this.X;this.X=t,this.requestUpdate("aspectRatio",e),t?this.Cl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.X&&this.Cl(this.X),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.X?.id||t?.width===this.X?.width&&t?.height===this.X?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.X?.id&&(this.$["*currentAspectRatio"]=this.X);}Cl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=a(()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},"resolveTitle"),s=a(()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n},"resolveTitleProp");r(),s(),e||this.requestUpdate();}Md(){let t=this.X;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=yd(t),s=(eo-e)/2,n=(eo-r)/2;return y`<uc-icon><svg viewBox="0 0 ${eo} ${eo}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${r} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" class=${Lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} >${this.Md()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],$i.prototype,"aspectRatio",1);function bd(o){let i=o+90;return i=i>=360?0:i,i}a(bd,"nextAngle");function wd(o,i){if(o==="rotate")return bd(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}a(wd,"nextValue");var Di=class extends lt{constructor(){super(...arguments);this.operation=void 0;}static{a(this,"EditorCropButtonControl");}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],r=e.getValue(this.operation),s=wd(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};h([b({type:String})],Di.prototype,"operation",2);var Xt=class extends lt{constructor(){super(...arguments);this.n="";this.m="";this.wi="";this.br=0;this.a=null;this.Nt=false;this.isOriginal=false;this.Sl=20;}static{a(this,"EditorFilterControl");}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let r=this.m;this.m=e,this.n="filter",this.isOriginal=e===_t,this.icon=this.isOriginal?"original":"slider",this.Sl=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.Al(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.m),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.m),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ii(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}Id(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Sl||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.m!==_t?{name:this.m,amount:l}:void 0,Z(this.wi,ot(ar,ee(c),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Rt}/${$t}/uc-cloud-image-editor/`))}async ai(t,e){t[0]?.isIntersecting?await this.Ts(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.ai.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.wi=t??"",this.sub("*originalUrl",e=>{this.wi=e??"",!this.isOriginal&&this.wi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.et());}),this.isOriginal||(this.s?.observe(this),this.et()),this.m&&this.Al(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Ts():this.et());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.wr();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.et()));}Al(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ts(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.wi){!this.Ft&&!this.De&&this.et();return}let e=++this.br,r="";try{r=await this.proxyUrl(this.Id());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.Nt=false,this.b?.();let{promise:s,cancel:n}=xe(r);this.b=()=>{n(),this.br===e&&(this.b=void 0);};try{if(await s,this.br!==e||!this.isConnected)return;this.a=r,this.Nt=!0,this.wr(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.et();}finally{this.br===e&&(this.b=void 0);}}et(){if(!this.isConnected||this.a||this.Nt||this.isOriginal||this.$["*networkProblems"]){this.wr();return}this.De&&cancelAnimationFrame(this.De),this.De=requestAnimationFrame(()=>{if(this.De=void 0,!this.isConnected||this.a||this.Nt||this.isOriginal){this.wr();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<r){this.Ts();return}this.Ft=window.setTimeout(()=>{this.Ft=void 0,this.et();},500);});}wr(){this.De&&(cancelAnimationFrame(this.De),this.De=void 0),this.Ft&&(window.clearTimeout(this.Ft),this.Ft=void 0);}get Od(){return !!(this.Nt&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Od?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return y`<button role="option" type="button" class=${Lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Nt} style=${ke(e)}></div><uc-icon class=${Lt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${ke(r)} ></uc-icon></button>`}};h([g()],Xt.prototype,"a",2),h([g()],Xt.prototype,"Nt",2),h([g()],Xt.prototype,"isOriginal",2),h([g()],Xt.prototype,"Sl",2),h([b({type:String})],Xt.prototype,"filter",1);var Fi=class extends lt{constructor(){super(...arguments);this.n="";}static{a(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),this.isConnected&&e&&this.kl(e);}kl(t){this.icon=t;let e=a(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),r=a(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),r();}initCallback(){super.initCallback(),this.n&&this.kl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=Mt[this.n],r=t[this.n],s=typeof r<"u"?r!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ii(this.$["*operationTooltip"])});}};h([b({type:String})],Fi.prototype,"operation",1);var Td=1,sl=a(()=>{},"noopScrollListener"),Vi=class extends x{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Ml=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Td){this.scrollLeft+=r;return}this.scrollLeft+=e;};}static{a(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Ml,{passive:false}),this.addEventListener("scroll",sl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Ml),this.removeEventListener("scroll",sl),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Vi.prototype,"hiddenScrollbar",2);var ht=class extends x{constructor(){super(...arguments);this.Ti=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Il=true;this.tabList=[...st];this.activeTab=H.CROP;this.Tr=true;this.Es=false;this.Ol=null;this.Pl=0;this.Ll=0;this.Er=O();this.Rl=O();this.tabToggleRefs={[H.CROP]:O(),[H.TUNING]:O(),[H.FILTERS]:O()};this.Ul=()=>{this.tt();};this.Ei=[];this.xr=D(t=>{this.Ti=t;},500);this.Cr=D(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===H.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(_t);else if(this.showSubToolbar&&this.$["*tabId"]===H.TUNING&&e){s=true;let n=t?.[e]||Mt[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Es=s;},0);this.Pd={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Ld={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Rd={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Ud={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":_t,"*currentOperation":null,"*operationTooltip":null};this.Ee=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.As=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.jd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ii(this.$["*operationTooltip"])}),this.Er.value?.apply(),this.$l();};this.Gd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Er.value?.cancel(),this.$l();};this.qd=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.xs(r,{fromViewer:false}));};}static{a(this,"EditorToolbar");}$l(){this.$["*showSlider"]=false,this.$["*tabId"]===H.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===H.TUNING&&(this.Es=false);}xs(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Dl(t,{fromViewer:e,force:r});}Dl(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.tt();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===H.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let l of st){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.tt();}}tt(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Rl.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Pl!==s||this.Ll!==n)&&(this.Pl=s,this.Ll=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get Cs(){return this.Ei.length>=3}$d(t){switch(t){case H.CROP:return this.Dd();case H.FILTERS:return this.Fd();case H.TUNING:return this.Nd();default:return []}}Dd(){let t=[];if(this.Cs)t.push(()=>this.Vd());else for(let e of this.Ei)t.push(()=>this.Fl(e));for(let e of wn)t.push(()=>this._d(e));return this.Ss(t)}Fd(){let e=[_t,...bn].map(r=>()=>this.Bd(r));return this.Ss(e)}Nd(){let t=yn.map(e=>()=>this.zd(e));return this.Ss(t)}Ss(t){return t.length?t.map(r=>r()):[]}Vd(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Fl(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}_d(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Bd(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}zd(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Hd(){return this.Cs?this.Ei.map(t=>this.Fl(t)):[]}async Kd(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ei(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=Ai([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Ei=[...t],this.sub("*cropPresetList",e=>{this.Ei=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.xs(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Cr();}),this.sub("*currentOperation",()=>{this.Cr();}),this.sub("*tabId",e=>{this.Dl(e,{fromViewer:false,force:true}),this.Cr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Kd(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,n]of s.entries())if(n){r=true;break}}this.xr(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Tr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Tr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Il=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.xs(r,{fromViewer:false});return}this.tt();}),this.sub("*operationTooltip",e=>{this.Ol=e;}),this.Cr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Ul);}firstUpdated(t){super.firstUpdated(t),this.Sr(),this.tt();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.tt()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Sr();}disconnectedCallback(){window.removeEventListener("resize",this.Ul),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Sr(){let t=this.Er.value;t&&(this.$["*sliderEl"]=t);}Wd(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?ke({gridColumn:`${s+1}`}):R;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Rd}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${r?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${r} style=${n} @click=${this.qd} ${P(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Zd(t){let e=this.$d(t);return y`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:R}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Es?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Cs;return y`<uc-line-loader-ui .active=${this.Ti}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Ol??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Pd} ><div class="uc-tab-content-row">${st.map(r=>Oi(this.activeTab===r,()=>this.Zd(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Il} .styles=${this.Ud} @initial-render=${()=>this.tt()} ><div class="uc-tab-toggles_indicator" ${P(this.Rl)} ></div>${st.map(r=>this.Wd(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ee} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.As}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Ld}><div class="uc-slider" ?hidden=${!this.Tr}><uc-editor-slider ${P(this.Er)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Tr||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.Hd()}</div>`:R}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Gd} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.jd} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],ht.prototype,"Ti",2),h([g()],ht.prototype,"showMainToolbar",2),h([g()],ht.prototype,"showSubToolbar",2),h([g()],ht.prototype,"Il",2),h([g()],ht.prototype,"tabList",2),h([g()],ht.prototype,"activeTab",2),h([g()],ht.prototype,"Tr",2),h([g()],ht.prototype,"Es",2),h([g()],ht.prototype,"Ol",2),h([g()],ht.prototype,"Ei",2);var nl=Kt([...st]),it=class extends x{constructor(){super(...arguments);this.ctxOwner=true;this.Yd="";this.Je=Ot;this.Xd="";this.Ti=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=nl;this.Nl=false;this.ke=false;this.ks=null;this.xi=null;this.xr=D(t=>{this.Ti=t;},300);this.Ar=O();this.Vl=O();this._l=O();this.Bl=O();this.zl=()=>{this.xr(false),this.Je!==Ot&&(this.$["*networkProblems"]=false);};this.Hl=()=>{this.xr(false),this.$["*networkProblems"]=true;};this.Qd=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...tl(this)};}static{a(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Jd(){this.ke||this.ks||(this.ks=this.updateComplete.then(()=>{this.ks=null,this.ke=true;}));}initCallback(){super.initCallback(),this.Kl(),this.jl();}Sr(){let t=this._l.value;t&&(this.$["*faderEl"]=t);let e=this.Vl.value;e&&(this.$["*cropperEl"]=e);let r=this.Bl.value;r&&(this.$["*imgContainerEl"]=r);let s=this.Ar.value;s&&(this.$["*imgEl"]=s);}ep(){let t=this.Ar.value;t&&(t.addEventListener("load",this.zl),t.addEventListener("error",this.Hl));}tp(){let t=this.Ar.value;t&&(t.removeEventListener("load",this.zl),t.removeEventListener("error",this.Hl));}get ip(){let t=this.$["*tabId"];return bt("uc-image",{"uc-image_hidden_to_cropper":t===H.CROP,"uc-image_hidden_effects":t!==H.CROP})}Gl(){if(this.xi)return this.xi;let t=3e3;return this.xi=new Promise((e,r)=>{let s=a(()=>{window.clearTimeout(p),u.disconnect(),this.xi=null;},"cleanup"),n=a(()=>{let{width:d,height:f}=this.getBoundingClientRect();return d>0&&f>0},"hasNonZeroSize"),l=a(()=>{s(),window.setTimeout(()=>e(),0);},"resolveWait"),c=a(()=>{let d=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(d.message),r(d);},"rejectWait"),u=new ResizeObserver(d=>{let[f]=d;f&&f.contentRect.width>0&&f.contentRect.height>0&&l();}),p=window.setTimeout(()=>{c();},t);if(n()){l();return}u.observe(this);}),this.xi}firstUpdated(t){super.firstUpdated(t),this.Sr(),this.ep(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.tp(),super.disconnectedCallback();}render(){let t=this.Xd??"",e=this.Yd??"",r=this.Je||Ot,s=this.Ti,n=this.Nl;return y` ${Fe(el)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.Qd}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${P(this.Bl)}><img src=${r} class=${this.ip} ${P(this.Ar)} />${Oi(this.ke,()=>y`<uc-editor-image-cropper ${P(this.Vl)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${P(this._l)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Oi(this.ke,()=>y`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.Kl(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.jl();}Kl(){let t=this.tabs||nl;this.$["*tabList"]=Ja(t);}jl(){let t=_r(this.cropPreset??""),e=null;if(this.cdnUrl){let r=Io(this.cdnUrl),s=Oo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,l]=s.crop.dimensions;e=wa(n,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.Gl();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=nr(t),r=te(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=Io(t),n=Oo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=te(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===H.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(Z(t,ot("json"))),r=await fetch(e).then(l=>l.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===H.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:t});}catch(t){t&&(this.telemetryManager.sendEventError(t,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",t));}this.Jd();}}}async initEditor(){try{await this.Gl();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Nl=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=ot(ee(t),"preview"),s=Z(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};h([g()],it.prototype,"Yd",2),h([g()],it.prototype,"Je",2),h([g()],it.prototype,"Xd",2),h([g()],it.prototype,"Ti",2),h([b({type:String,reflect:true})],it.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],it.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],it.prototype,"cropPreset",2),h([b({type:String,reflect:true})],it.prototype,"tabs",2),h([g()],it.prototype,"Nl",2),h([g()],it.prototype,"ke",2);var Rs={};Vs(Rs,{CloudImageEditorActivity:()=>Ni});var ro=class extends it{static{a(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Ni=class extends ${constructor(){super(...arguments);this.Q=null;}static{a(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.Q&&this.Q.cropPreset!==t&&(this.Q={...this.Q,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.Q&&this.Q.tabs!==t&&(this.Q={...this.Q,tabs:t});}),this.rp();}disconnectedCallback(){super.disconnectedCallback(),this.op();}As(t){if(!this.Ci)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ci.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(S.activities.CLOUD_IMG_EDIT),this.historyBack();}Ee(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(S.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}rp(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Ci=e;let r=this.Ci.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.Q=this.sp(r);}op(){this.Ci=void 0,this.Q=null;}render(){if(!this.Q)return R;let{cdnUrl:t,cropPreset:e,tabs:r}=this.Q;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${W(e)} tabs=${W(r)} @apply=${this.As} @cancel=${this.Ee} @change=${this.handleChange} ></uc-cloud-image-editor>`}sp(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],Ni.prototype,"Q",2);var ri=class extends ${constructor(){super(...arguments);this.Dt="";this.bs=t=>{this.Dt=t.target?.value??"";};this.Ho=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this.Dt.trim();e&&(this.api.addFileFromUrl(e,{source:_.URL}),this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.modalManager?.open(S.activities.UPLOAD_LIST));};}static{a(this,"UrlSource");}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.Ho}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.bs} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this.Dt} >${this.l10n("upload-url")}</button></form>`}};h([g()],ri.prototype,"Dt",2);var al=a(()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var Ed=a(o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),ll=a((o,i="i")=>{let t=o.split("*").map(Ed);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var Cd=["--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"],xd=a((o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),"getCssValue"),cl=a(o=>{let i={};for(let t of Cd){let e=xd(o,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Sd=["selected-files-change","toolbar-state-change"],Ad=a(o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!Sd.includes(i))},"isWhitelistedMessage"),oo=class{constructor(i,t){this.kr=new Map;this.Wl=i=>{if(i.source!==this.Ms)return;let t=i.data;if(!Ad(t))return;let e=this.kr.get(t.type);if(e)for(let r of e)r(t);};this.Ms=i,this.ql=t,window.addEventListener("message",this.Wl);}static{a(this,"MessageBridge");}on(i,t){let e=this.kr.get(i)??new Set;this.kr.has(i)||this.kr.set(i,e),e.add(t);}send(i){let t=this.ql();this.Ms.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Wl);}};function ul(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}a(ul,"queryString");var kd={[dt.GDRIVE]:"ngdrive"},ft=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Vt=O();this.Mr=null;this.Is=[];this.Os=false;this.Ps=false;this.Ls=false;this.Rs=false;this.Ir=false;this.Us=false;this.$s="uc-hidden";this.Zl=true;this.Ko=()=>{for(let t of this.Is){let e=this.ap(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.modalManager?.open(S.activities.UPLOAD_LIST);};this.Ee=()=>{this.historyBack();};this.hp=()=>{this.ne?.send({type:"select-all"});};this.fp=()=>{this.ne?.send({type:"deselect-all"});};}static{a(this,"ExternalSource");}get np(){if(!this.Mr)return "";let{selectedCount:t,total:e}=this.Mr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.Yl():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.Xl(),this.Yl());});}),this.subConfigValue("multiple",e=>{this.Ir=e;}),this.subConfigValue("localeName",()=>{this.Ql();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.Jl(e);});}ap(t){if(t.alternatives){let e=Y(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=ll(r);for(let[n,l]of Object.entries(t.alternatives))if(s.test(n))return l}}return t.url}lp(t){this.Zl=t.isVisible;}async cp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.up(t.selectedCount,t.total),this.$s=t.isReady?"":"uc-hidden",this.Os=t.isReady,this.Ps=t.isReady&&t.selectedFiles.length>0,this.Ir=t.isMultipleMode&&t.total>0,this.Ls=t.selectedCount<t.total,this.Rs=t.selectedCount===t.total,this.Is=t.selectedFiles??[],this.Us=t.total>0;}ec(){this.Jl(this.cfg.externalSourcesEmbedCss),this.dp(),this.Ql();}dp(){this.ne?.send({type:"set-theme-definition",theme:cl(this)});}Jl(t){this.ne?.send({type:"set-embed-css",css:t});}Ql(){this.ne?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}pp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,l=kd[n]??n,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||al(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,r);return p.search=ul(u),p.toString()}up(t,e){this.Mr={selectedCount:t,total:e};}Yl(){let t=document.createElement("iframe");t.src=this.pp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.ec.bind(this)),t.addEventListener("load",this.ec.bind(this)),this.Vt.value&&(this.Vt.value.innerHTML="",this.Vt.value.appendChild(t)),t.contentWindow&&(this.ne?.destroy(),this.ne=new oo(t.contentWindow,()=>this.cfg.socialBaseUrl),this.ne.on("selected-files-change",this.cp.bind(this)),this.ne.on("toolbar-state-change",this.lp.bind(this)),this.tc());}Xl(){this.ne?.destroy(),this.ne=void 0,this.Vt.value&&(this.Vt.value.innerHTML=""),this.tc();}tc(){this.Is=[],this.Os=false,this.Ps=false,this.Ls=false,this.Rs=false,this.Ir=false,this.Us=false,this.$s="uc-hidden",this.Mr=null;}disconnectedCallback(){super.disconnectedCallback(),this.Xl();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${P(this.Vt)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.Zl}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Ir}><span>${this.np}</span><button type="button" @click=${this.hp} ?hidden=${!this.Ls}>${this.l10n("select-all")}</button><button type="button" @click=${this.fp} ?hidden=${!this.Rs}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.Ko} ?disabled=${!this.Ps} ?hidden=${!this.Us} ><uc-spinner ?hidden=${this.Os}></uc-spinner><span class=${this.$s}>${this.l10n("done")}</span></button></div></div>`}};h([g()],ft.prototype,"Is",2),h([g()],ft.prototype,"Os",2),h([g()],ft.prototype,"Ps",2),h([g()],ft.prototype,"Ls",2),h([g()],ft.prototype,"Rs",2),h([g()],ft.prototype,"Ir",2),h([g()],ft.prototype,"Us",2),h([g()],ft.prototype,"$s",2),h([g()],ft.prototype,"Zl",2);var dl=a(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var Md={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Id=["camera","microphone"];function so(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}a(so,"formatTime");var pl="image/jpeg",hl="video/webm",z=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Or=null;this.Ds=false;this.Si=[];this.me=null;this.ge=null;this.Pr=null;this.Lr=null;this.g=null;this.Ai={};this.fe=null;this.e=null;this._t=[];this.Bt=[];this.mp={};this.Rr=[];this.Ur=null;this.ic=()=>{this.rc(),this.ki="pause";};this.oc=()=>{this.ki="play",this.gp();};this.Mi=O();this.Xe=O();this.K=O();this.sc=0;this.nc=0;this.ac=null;this.$r=true;this.Dr=true;this.vp=dl();this.cc=[];this.ot=true;this.Fs="";this.zt=true;this.at=true;this.Ht=true;this.uc=[];this.pt=true;this.Ns=true;this.mt=true;this.Ce=true;this.gt=true;this.Kt="camera-full";this.ki="play";this.dc="microphone";this.Fr="uc-shot-btn uc-camera-action";this.yp=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===L.PHOTO&&this.bp(),this.g===L.VIDEO){if(this.me?.state==="recording"){this.pc();return}this.wp();}};this.Tp=t=>{let e=t.target;e&&(this.Lr=e.value,this.jt());};this.Ep=t=>{let e=t.target;e&&(this.Pr=e.value,this.jt());};this.xp=()=>{this.jt();};this.Cp=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.yp();};this.Sp=()=>{this.Ap();};this.kp=()=>{this.Mp();};this.Ip=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.Op();};this.Pp=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.Lp();};this.hc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.fc(r);};this.mc=()=>{let t=Math.floor((performance.now()-this.sc+this.nc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Mi.value;s&&(s.textContent=so(e)),this.pc();return}let r=this.Mi.value;r&&(r.textContent=so(e));}else {let e=this.Mi.value;e&&(e.textContent=so(t));}this.Gt=requestAnimationFrame(this.mc);};this.Rp=()=>{this.sc=performance.now(),this.nc=0,this.mc();};this.gc=()=>{this.Gt&&cancelAnimationFrame(this.Gt);};this.rc=()=>{let t=this.K.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.Xe.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.Mi.value;n&&(n.textContent=so(e)),this.Gt=requestAnimationFrame(this.rc);};this.gp=()=>{this.Gt&&cancelAnimationFrame(this.Gt);};this.Gt=null;this.wp=()=>{try{this.Si=[],this.Ai={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Ai.mimeType=t:MediaRecorder.isTypeSupported(hl)?this.Ai.mimeType=hl:this.Ai.mimeType="video/mp4",this.ge&&(this.me=new MediaRecorder(this.ge,this.Ai),this.me.start(),this.me.addEventListener("dataavailable",e=>{this.Si.push(e.data);}),this.Rp(),this.classList.add("uc-recording"),this.Ii(xt.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.pc=()=>{this.me?.addEventListener("stop",()=>{this.Up(),this.gc(),this.Ii(xt.STOP);}),this.me?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.g}}});};this.Ap=()=>{if(this.me?.state==="recording")return;let t=this.K.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.Mp=()=>{this.ge?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.dc=t.enabled?"microphone":"microphone-mute",this.Ns=!t.enabled;});};this.Up=()=>{try{let t=new Blob(this.Si,{type:this.me?.mimeType}),e=URL.createObjectURL(t),r=this.K.value;if(!r)return;r.muted=!1,r.volume=1,this.Oi(null),r.src=e,this.$p(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Op=()=>{if(this.Ii(xt.RETAKE),this.g===L.VIDEO){this.Oi(this.ge);let t=this.K.value;t&&(t.muted=true);}this.K.value?.play?.();};this.Lp=()=>{if(this.Ii(xt.ACCEPT),this.g===L.PHOTO){this.fe?.toBlob(s=>{if(!s)return;let n=this.vc("camera","jpeg",pl,s);this.yc(n);},pl);return}let t=new Blob(this.Si,{type:this.me?.mimeType}),e=this.Dp(this.me?.mimeType),r=this.vc("video",e,`video/${e}`,t);this.yc(r),this.Si=[];};this.Fp=t=>{t===xt.SHOT&&(this.gt=true,this.at=true,this.Ce=true,this.Ht=false,this.ot=true),(t===xt.RETAKE||t===xt.ACCEPT)&&(this.gt=!this.Se.includes(L.VIDEO),this.Ce=!this.Se.includes(L.PHOTO),this.at=false,this.Ht=true,this.ot=this._t.length<=1);};this.Np=t=>{t===xt.PLAY&&(this.zt=false,this.Ce=true,this.ot=true,this.pt=true,this.ki="pause",this.Kt="square",this.Fr="uc-shot-btn uc-camera-action uc-stop-record"),t===xt.STOP&&(this.zt=false,this.at=true,this.mt=true,this.Ht=false),(t===xt.RETAKE||t===xt.ACCEPT)&&(this.zt=true,this.gt=!this.Se.includes(L.VIDEO),this.Ce=!this.Se.includes(L.PHOTO),this.at=false,this.Ht=true,this.mt=!this.cfg.enableAudioRecording,this.Kt="video-camera-full",this.Fr="uc-shot-btn uc-camera-action",this.pt=!this.cfg.enableAudioRecording||this.Bt.length<=1,this.ot=this._t.length<=1);};this.Ii=t=>{this.g===L.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Fp(t),this.g===L.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Np(t);};this.fc=t=>{t===L.PHOTO&&(this.Kt="camera-full",this.pt=true,this.mt=true),t===L.VIDEO&&(this.ki="play",this.Kt="video-camera-full",this.pt=!this.cfg.enableAudioRecording||this.Bt.length<=1,this.mt=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.g=t;};this.vc=(t,e,r,s)=>{let n=Date.now(),l=`${t}-${n}.${e}`;return new File([s],l,{lastModified:n,type:r})};this.yc=t=>{this.api.addFileFromObject(t,{source:_.CAMERA}),this.set$({"*currentActivity":S.activities.UPLOAD_LIST}),this.modalManager?.open(S.activities.UPLOAD_LIST);};this.Pi=D(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.g===L.VIDEO&&this.cfg.enableAudioRecording,r=this.g===L.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.$r=false,this.at=false,this.Ce=!this.Se.includes(L.PHOTO),this.gt=!this.Se.includes(L.VIDEO),this.Dr=true,this.zt=true,this.Kt=r,this.mt=!e,this.pt=!e):t==="prompt"?(this.Fs="camera-permissions-prompt",this.$r=true,this.at=true,this.Ce=true,this.Dr=false,this.Bs()):(this.Fs="camera-permissions-denied",this.$r=true,this.Dr=false,this.Ce=!this.Se.includes(L.PHOTO),this.gt=!this.Se.includes(L.VIDEO),this.Ht=true,this.Fr="uc-shot-btn uc-camera-action",this.Bs());},300);this.Vp=()=>{if(!this.ge)return false;let t=this.ge?.getAudioTracks(),e=this.ge?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.Bs=()=>{this.Ds&&(this.K.value&&(this.K.value.volume=0),this.Ur?.getTracks?.()?.[0]?.stop(),this.Vs(this.K.value),this.Oi(null),this.Vp(),this.gc(),this.Ds=false);};this.jt=async()=>{let t={video:{...Md},audio:this.cfg.enableAudioRecording?{}:false};this.Lr&&(t.video={deviceId:{exact:this.Lr}}),this.Pr&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Pr}}),this.K.value&&(this.K.value.volume=0);try{this.Pi("prompt"),this.ge=await navigator.mediaDevices.getUserMedia(t),this.ge.addEventListener("inactive",()=>{this.Pi("denied");}),this.Oi(this.ge),this.Ds=!0,this.Pi("granted");}catch(e){this.Pi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.bc=()=>{this.jt();};this._p=async()=>{try{this.Nr();for(let t of Id){let e=await navigator.permissions.query({name:t});this.mp[t]=e,e.addEventListener("change",this.bc),this.Rr.push(()=>{e.removeEventListener("change",this.bc);});}this.Or=()=>{this.Nr();};}catch(t){this.Nr(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.jt();}};this.Bp=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.zs(),navigator.mediaDevices.addEventListener("devicechange",this.zs);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.zs=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this._t=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this.Bt=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.cc=this._t,this.ot=this._t.length<=1,this.Lr=this._t[0]?.value??null,this.uc=this.Bt,this.pt=!this.cfg.enableAudioRecording||this.Bt.length<=1,this.Pr=this.Bt[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.zp=async()=>{await this._p(),await this.Bp(),await this.jt(),this.wc(this.Se);};this.Hp=async()=>{this.Or&&this.Or(),window.chrome||this.Pi("denied"),this.Bs();};this.wc=t=>{this.gt=!t.includes(L.VIDEO),this.Ce=!t.includes(L.PHOTO);let e=t[0];e&&(!this.g||!t.includes(this.g))&&this.fc(e);};}static{a(this,"CameraSource");}$p(t){this.Vs(t),t.addEventListener("play",this.ic),t.addEventListener("pause",this.oc);}Vs(t){t?.removeEventListener("play",this.ic),t?.removeEventListener("pause",this.oc);}Oi(t){this.Ur!==t&&(this.Ur=t,this._s());}_s(){let t=this.K.value;if(!t)return;let e=this.Ur??null;t.srcObject!==e&&(t.srcObject=e);}bp(){if(this.Ii("shot"),this.fe=document.createElement("canvas"),this.e=this.fe.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this.K.value;if(!t)throw new Error("Video element not found");this.fe.height=t.videoHeight,this.fe.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.fe.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}Dp(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let r=t.split("/");if(r?.[0]==="video"){let n=r.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get Se(){return Y(this.cfg.cameraModes).filter(t=>t===L.PHOTO||t===L.VIDEO)}Nr(){if(this.Rr.length!==0){for(let t of this.Rr)t();this.Rr=[],this.Or=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.ac=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.mt=!t,this.Ns=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=j(t);this.wc(e.filter(r=>r===L.PHOTO||r===L.VIDEO));}),this.zp();}firstUpdated(t){super.firstUpdated(t),this._s();}updated(t){super.updated(t),this._s();}Kp(){this.Nr(),navigator.mediaDevices?.removeEventListener("devicechange",this.zs),this.Vs(this.K.value),this.Oi(null);}disconnectedCallback(){super.disconnectedCallback(),this.Hp(),this.Kp();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.ot}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.cc} ?hidden=${this.ot} @change=${this.Tp} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${ke({transform:this.ac})} ?hidden=${this.$r} ${P(this.K)} ></video><div class="uc-message-box" ?hidden=${this.Dr}><span>${this.l10n(this.Fs)}</span><button type="button" @click=${this.xp} ?hidden=${this.vp} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.zt}><button data-id="photo" type="button" class=${Lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===L.PHOTO})} @click=${this.hc} ?hidden=${this.Ce} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${Lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===L.VIDEO})} @click=${this.hc} ?hidden=${this.gt} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.Sp} ?hidden=${this.zt} data-testid="recording-timer" ><uc-icon name=${this.ki}></uc-icon><span ${P(this.Mi)}> 00:00 </span><span ${P(this.Xe)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.Ht} ><button type="button" class="uc-secondary-btn" @click=${this.Ip}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.Pp} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this.Cp} class=${this.Fr} ?hidden=${this.at} ><uc-icon name=${this.Kt}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.kp} ?hidden=${this.mt} data-testid="toggle-microphone" ><uc-icon name=${this.dc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.uc} ?hidden=${this.pt} ?disabled=${this.Ns} @change=${this.Ep} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],z.prototype,"ac",2),h([g()],z.prototype,"$r",2),h([g()],z.prototype,"Dr",2),h([g()],z.prototype,"vp",2),h([g()],z.prototype,"cc",2),h([g()],z.prototype,"ot",2),h([g()],z.prototype,"Fs",2),h([g()],z.prototype,"zt",2),h([g()],z.prototype,"at",2),h([g()],z.prototype,"Ht",2),h([g()],z.prototype,"uc",2),h([g()],z.prototype,"pt",2),h([g()],z.prototype,"Ns",2),h([g()],z.prototype,"mt",2),h([g()],z.prototype,"Ce",2),h([g()],z.prototype,"gt",2),h([g()],z.prototype,"Kt",2),h([g()],z.prototype,"ki",2),h([g()],z.prototype,"dc",2),h([g()],z.prototype,"Fr",2);var fl={id:"camera",setup:a(async({pluginApi:o,uploaderApi:i})=>{gt({CameraSource:z}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:a(()=>{if(!Bn.htmlMediaCapture)return ["camera"];let t=j(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},"expand"),onSelect:a(()=>{i.setCurrentActivity(V.CAMERA),i.setModalState(true);},"onSelect")}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:a(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});},"onSelect")}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:a(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});},"onSelect")}),o.registry.registerActivity({id:V.CAMERA,render:a(t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}},"render")});},"setup")};var $s={};Vs($s,{BtnUi:()=>St,CloudImageEditor:()=>ro,CloudImageEditorBlock:()=>it,Config:()=>Qe,CropFrame:()=>Li,EditorAspectRatioButtonControl:()=>$i,EditorCropButtonControl:()=>Di,EditorFilterControl:()=>Xt,EditorFreeformButtonControl:()=>io,EditorImageCropper:()=>Ui,EditorImageFader:()=>Jr,EditorOperationControl:()=>Fi,EditorScroller:()=>Vi,EditorSlider:()=>Ri,EditorToolbar:()=>ht,Icon:()=>le,LineLoaderUi:()=>Pi,PresenceToggle:()=>ti,SliderUi:()=>Nt,defineComponents:()=>gt});var Od="cloud-image-editor",Pd="<svg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></svg>",ml={id:Od,setup:a(async({pluginApi:o,uploaderApi:i})=>(gt({...$s,...Rs}),o.registry.registerIcon({name:"edit-file",svg:Pd}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:a(e=>!!(e.isImage&&e.cdnUrl),"shouldRender"),onClick:a(e=>{i.setCurrentActivity?.(V.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);},"onClick")}),o.registry.registerActivity({id:V.CLOUD_IMG_EDIT,render:a(e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}},"render")}),i.on(M.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),n=o.config.get("cloudImageEditorAutoOpen"),l=i.v.size;s&&l===1&&(r||n)&&(i.setCurrentActivity?.(V.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));})),"setup")};var gl={id:"external-sources",setup:a(async({pluginApi:o,uploaderApi:i})=>{gt({ExternalSource:ft}),o.registry.registerActivity({id:V.EXTERNAL,render:a(t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}},"render")});for(let t of Object.values(dt))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:a(()=>{i.setCurrentActivity(V.EXTERNAL,{externalSourceType:t}),i.setModalState(true);},"onSelect")});},"setup")};var ao=a(()=>{let o=[];return {stack:o,promiseReadJpegChunks:a(t=>new Promise((e,r)=>{let s=2,n=a((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",f=>{r(`Reader error: ${f}`);}),d.readAsArrayBuffer(u);},"readToView"),l=a(()=>n(t.slice(s,s+128),u=>{let p,d,f;for(p=d=0,f=u.byteLength;f>=0?d<f:d>f;p=f>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=a(()=>{let u=s;return n(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let f=p.getUint16(2)-2;return n(t.slice(s,s+=f),m=>{if(m.byteLength!==f){r("Corrupted");return}o.push({startPos:u,length:f,marker:d,view:m}),l();})})},"readNextChunk");FileReader&&DataView||r("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Ld=a(async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=ao();return await t(o),e.forEach(({marker:r,view:s})=>{r===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),yl=a(async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=ao();await s(o),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),r.push(u.length)});let l=[o.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(o.slice(c,e[u])),c=e[u]+r[u]+4;return l.push(o.slice(c,o.size)),new Blob(l,{type:o.type})}},"replaceJpegChunk"),Ud=226,bl=a((o,i)=>yl(o,Ud,i.map(t=>t.buffer)),"replaceIccProfile"),Rd=a(async o=>{try{return await bl(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),$d=a((o,i,t)=>new Promise((e,r)=>{let s=a(n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);},"callback");o.toBlob(s,i,t),o.width=o.height=1;}),"canvasToBlob"),_i=a(()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},"createCanvas"),Dd=a(o=>{let{ctx:t,canvas:e}=_i();e.width=e.height=50,t.drawImage(o,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<r.length;s+=4)if(r[s]<254)return true;return false},"hasTransparency"),Fd=a(async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=ao();return await t(o),e.forEach(({marker:r,view:s})=>{if(!i&&r===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),Vd="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",no,Nd=a(()=>new Promise(o=>{if(no!==void 0)o(no);else {let i=new Image;i.addEventListener("load",()=>{no=i.naturalWidth<i.naturalHeight,i.src="//:0",o(no);}),i.src=Vd;}}),"isBrowserApplyExifOrientation"),_d=a((o,i)=>{let t,e,r,s;if(!o||o.byteLength<14||o.getUint32(0)!==1165519206||o.getUint16(4)!==0)return;if(o.getUint16(6)===18761)e=true;else if(o.getUint16(6)===19789)e=false;else return;if(o.getUint16(8,e)!==42)return;r=8+o.getUint32(10,e);let n=o.getUint16(r-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(o.byteLength<r+10)return;o.getUint16(r,e)===274&&i(r+8,e),r+=12;}},"findExifOrientation"),zd=a((o,i)=>{_d(o,(t,e)=>o.setUint16(t,i,e));},"setExifOrientation"),Bd=a(async(o,i,t)=>(t&&zd(i,1),yl(o,225,[i.buffer])),"replaceExif"),Hd=a((o,i)=>new Promise((t,e)=>{i&&(o.src=i),o.complete?t(o):(o.addEventListener("load",()=>{t(o);}),o.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),Kd=a(o=>Hd(new Image,o),"imageLoader"),jd=[1,3],Gd=[192,193,194,195,197,198,199,201,202,203,205,206,207],vl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},qd=a(async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=ao();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&Gd.indexOf(r)>=0){let n=s.getUint8(5);jd.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),wl=a((o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},"memoize"),Tl=a((o,i)=>{let[t]=o,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,s)=>r-s);for(let r=0;r<e.length;r++){let s=e[r],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},"memoKeySerializer"),ue={R:55,G:110,B:165,A:255},Wd=`rgba(${ue.R}, ${ue.G}, ${ue.B}, ${ue.A/255})`,El=a((o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=_i();e.width=1,e.height=1;let{canvas:s,ctx:n}=_i();s.width=o,s.height=i,n&&(n.fillStyle=Wd,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===ue.R&&l[1]===ue.G&&l[2]===ue.B&&l[3]===ue.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}},"canvasTest");function Cl(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}a(Cl,"wrapAsync");var Zd=Cl(wl(El,Tl)),Yd=Cl(wl(El,Tl)),xl=a(async(o,i)=>{let t=vl.squareSide.find(n=>n*n>=o*i),e=vl.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([Zd(t,t),Yd(e,1)]);if(r&&s)return true;throw new Error("Not supported")},"testCanvasSize"),Sl=a(async(o,i,t)=>{try{let{ctx:e,canvas:r}=_i();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(o,0,0,i,t),o instanceof HTMLImageElement&&(o.src="//:0"),o instanceof HTMLCanvasElement&&(o.width=o.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),Xd=a(({img:o,targetW:i,targetH:t})=>Sl(o,i,t),"native"),Qd=a(function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,n=t;do r.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<o*e);return r.reverse()},"calcShrinkSteps"),Jd=a(({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=Qd({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[l,c],u)=>n.then(p=>xl(l,c).then(()=>Sl(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(o))},"fallback"),tp=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),ep=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Ds=.71,ip=a((o,i)=>{if(o.width*Ds*o.height*Ds<i.size)throw new Error("Not required");let t=o.width,e=o.height,r=t/e,s=Math.floor(Math.sqrt(i.size*r)),n=Math.floor(i.size/Math.sqrt(i.size*r));return xl(s,n).then(()=>{let{ctx:l}=_i();return "imageSmoothingQuality"in l&&!tp()&&!ep?Xd({img:o,targetW:s,targetH:n}):Jd({img:o,sourceW:t,targetW:s,targetH:n,step:Ds})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Al=a(async(o,i)=>{try{if(await qd(o))throw new Error("Should skipped");let e=await Promise.allSettled([Fd(o),Nd(),Ld(o)]),s=!e.some(w=>w.status==="rejected"),[n,l,c]=e,u=await Rd(o).catch(()=>o),p=await Kd(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await ip(p,i),f="image/jpeg",m=i?.quality||.8;!s&&Dd(d)&&(f="image/png",m=void 0);let v=await $d(d,f,m);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,T=l.status==="fulfilled"?l.value:!1;v=await Bd(v,w,T);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await bl(v,c.value)),v}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");var rp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,kl=a(o=>{if(typeof o!="string")return false;let i=rp.exec(o.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var Ml={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:a(async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=kl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Al(i,e)}}catch{return {file:i}}},"handler")});}};var Il={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:a(()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),"expand"),onSelect:a(()=>{},"onSelect")});}};var Ol={id:_.LOCAL,setup:a(({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:_.LOCAL,label:"src-type-local",icon:"local",onSelect:a(()=>{i.openSystemDialog();},"onSelect")});},"setup")};var Pl={id:"url-source",setup:a(async({pluginApi:o,uploaderApi:i})=>{gt({UrlSource:ri}),o.registry.registerActivity({id:V.URL,render:a(t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}},"render")}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:a(()=>{i.setCurrentActivity(V.URL),i.setModalState(true);},"onSelect")});},"setup")};var oi=[{configDeps:["useCloudImageEditor"],isEnabled:a(o=>!!o("useCloudImageEditor"),"isEnabled"),load:a(()=>ml,"load")},{configDeps:["imageShrink"],isEnabled:a(o=>!!o("imageShrink"),"isEnabled"),load:a(()=>Ml,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.LOCAL),"isEnabled"),load:a(()=>Ol,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.CAMERA),"isEnabled"),load:a(()=>fl,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes("instagram"),"isEnabled"),load:a(()=>Il,"load")},{configDeps:["sourceList"],isEnabled:a(o=>Object.values(dt).some(i=>j(o("sourceList")).includes(i)),"isEnabled"),load:a(()=>gl,"load")},{configDeps:["sourceList"],isEnabled:a(o=>j(o("sourceList")).includes(_.URL),"isEnabled"),load:a(()=>Pl,"load")}];var lo=class extends Yt{constructor(){super();this.headless=false;this.init$={...this.init$};}static{a(this,"FileUploaderRegular");}static{this.lazyPlugins=oi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});}render(){return y` ${super.render()}<uc-simple-btn ?hidden=${this.headless}></uc-simple-btn><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([b({type:Boolean})],lo.prototype,"headless",2);var co=class extends Yt{constructor(){super();this.Tc=false;this.Ee=()=>{if(this.Ec){let t=this.$["*historyBack"];t?.();return}this.xc&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderInline");}static{this.lazyPlugins=oi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Ec(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==S.activities.START_FROM}get xc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}Hs(){return this.getCssData("--cfg-init-activity")||S.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.Hs();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Tc=this.Ec||this.xc;});}render(){return y` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ee} ?hidden=${!this.Tc} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};h([g()],co.prototype,"Tc",2);var Fs="active",uo="",de=class extends Yt{constructor(){super();this.Ks=false;this.Vr=false;this._r=uo;this.js=uo;this.ui="choose-file";this.si=t=>{t.id===S.activities.CLOUD_IMG_EDIT&&(this._r=Fs),this.$["*currentActivity"]===S.activities.UPLOAD_LIST&&(this._r=Fs,this.Vr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.js=Fs);};this.ni=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.Vr=false),t.id===S.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=S.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderMinimal");}static{this.lazyPlugins=oi;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}Hs(){return this.getCssData("--cfg-init-activity")||S.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.Hs();this.sub("*currentActivity",e=>{e===S.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=S.activities.UPLOAD_LIST,this.js=uo):(this._r=uo,this.Vr=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",r=>{e==="grid"?(r?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.Ks=!r):(this.style.removeProperty("--uc-grid-col"),this.Ks=false);});}),this.subConfigValue("multiple",e=>{this.ui=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(X.OPEN,this.si),this.modalManager?.subscribe(X.CLOSE,this.ni);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(X.OPEN,this.si),this.modalManager?.unsubscribe(X.CLOSE,this.ni);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.Vr} class=${this.js}><uc-drop-area ?single=${this.Ks} initflow clickable tabindex="0" ><span>${this.l10n(this.ui)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this._r}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([g()],de.prototype,"Ks",2),h([g()],de.prototype,"Vr",2),h([g()],de.prototype,"_r",2),h([g()],de.prototype,"js",2),h([g()],de.prototype,"ui",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
8
8
  exports.ActivityBlock=S;exports.ActivityHeader=Ts;exports.BaseComponent=So;exports.Block=x;exports.BtnUi=St;exports.CameraSource=z;exports.CloudImageEditor=ro;exports.CloudImageEditorActivity=Ni;exports.CloudImageEditorBlock=it;exports.Config=Qe;exports.Copyright=ys;exports.CropFrame=Li;exports.Data=K;exports.DropArea=pt;exports.EditorAspectRatioButtonControl=$i;exports.EditorCropButtonControl=Di;exports.EditorFilterControl=Xt;exports.EditorFreeformButtonControl=io;exports.EditorImageCropper=Ui;exports.EditorImageFader=Jr;exports.EditorOperationControl=Fi;exports.EditorScroller=Vi;exports.EditorSlider=Ri;exports.EditorToolbar=ht;exports.ExternalSource=ft;exports.ExternalUploadSource=dt;exports.FileItem=xs;exports.FileUploaderInline=co;exports.FileUploaderMinimal=de;exports.FileUploaderRegular=lo;exports.FormInput=Wr;exports.Icon=le;exports.Img=fs;exports.LineLoaderUi=Pi;exports.Modal=Ci;exports.ModalEvents=X;exports.PACKAGE_NAME=Rt;exports.PACKAGE_VERSION=$t;exports.PluginActivityHost=Ii;exports.PluginActivityRenderer=Je;exports.PresenceToggle=ti;exports.ProgressBar=Ge;exports.ProgressBarCommon=xi;exports.Select=qe;exports.SimpleBtn=Mi;exports.SliderUi=Nt;exports.SolutionBlock=Yt;exports.SourceBtn=We;exports.SourceList=Si;exports.Spinner=bs;exports.StartFrom=Es;exports.Thumb=Ye;exports.UID=mt;exports.UploadCtxProvider=Cs;exports.UploadList=Pt;exports.UploadSource=_;exports.UploaderBlock=$;exports.UrlSource=ri;exports.defineComponents=gt;exports.defineLocale=un;exports.loadFileUploaderFrom=tc;exports.toKebabCase=ur;return exports;})({});