@uploadcare/file-uploader 1.30.0-alpha.7 → 1.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +3 -3
- package/dist/index.d.ts +13 -21
- package/dist/index.js +4 -4
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +54 -214
- package/dist/locales/file-uploader/ar.js +2 -2
- package/dist/locales/file-uploader/az.js +2 -2
- package/dist/locales/file-uploader/ca.js +2 -2
- package/dist/locales/file-uploader/cs.js +2 -2
- package/dist/locales/file-uploader/da.js +2 -2
- package/dist/locales/file-uploader/de.js +2 -2
- package/dist/locales/file-uploader/el.js +2 -2
- package/dist/locales/file-uploader/en.js +2 -2
- package/dist/locales/file-uploader/es.js +2 -2
- package/dist/locales/file-uploader/et.js +2 -2
- package/dist/locales/file-uploader/fi.js +2 -2
- package/dist/locales/file-uploader/fr.js +2 -2
- package/dist/locales/file-uploader/he.js +2 -2
- package/dist/locales/file-uploader/hy.js +2 -2
- package/dist/locales/file-uploader/is.js +2 -2
- package/dist/locales/file-uploader/it.js +2 -2
- package/dist/locales/file-uploader/ja.js +2 -2
- package/dist/locales/file-uploader/ka.js +2 -2
- package/dist/locales/file-uploader/kk.js +2 -2
- package/dist/locales/file-uploader/ko.js +2 -2
- package/dist/locales/file-uploader/lv.js +2 -2
- package/dist/locales/file-uploader/nb.js +2 -2
- package/dist/locales/file-uploader/nl.js +2 -2
- package/dist/locales/file-uploader/pl.js +2 -2
- package/dist/locales/file-uploader/pt.js +2 -2
- package/dist/locales/file-uploader/ro.js +2 -2
- package/dist/locales/file-uploader/ru.js +2 -2
- package/dist/locales/file-uploader/sk.js +2 -2
- package/dist/locales/file-uploader/sr.js +2 -2
- package/dist/locales/file-uploader/sv.js +2 -2
- package/dist/locales/file-uploader/tr.js +2 -2
- package/dist/locales/file-uploader/uk.js +2 -2
- package/dist/locales/file-uploader/vi.js +2 -2
- package/dist/locales/file-uploader/zh-TW.js +2 -2
- package/dist/locales/file-uploader/zh.js +2 -2
- package/package.json +1 -1
- package/web/file-uploader.iife.min.d.ts +13 -21
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.d.ts +13 -21
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.layered.min.css +3 -3
- package/web/uc-basic.min.css +3 -3
- package/web/uc-cloud-image-editor.layered.min.css +2 -2
- package/web/uc-cloud-image-editor.min.css +2 -2
- package/web/uc-cloud-image-editor.min.d.ts +12 -20
- package/web/uc-cloud-image-editor.min.js +3 -3
- package/web/uc-file-uploader-inline.layered.min.css +3 -3
- package/web/uc-file-uploader-inline.min.css +3 -3
- package/web/uc-file-uploader-inline.min.d.ts +13 -21
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.layered.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.d.ts +13 -21
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.layered.min.css +3 -3
- package/web/uc-file-uploader-regular.min.css +3 -3
- package/web/uc-file-uploader-regular.min.d.ts +13 -21
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Package: @uploadcare/file-uploader@1.30.
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.30.1 (MIT)
|
|
4
4
|
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
-
* Built: 2026-05-
|
|
5
|
+
* Built: 2026-05-27T13:37:21.808Z
|
|
6
6
|
*/
|
|
7
|
-
var Ws=Object.defineProperty;var jl=Object.getOwnPropertyDescriptor;var Zs=(o,i)=>{for(var t in i)Ws(o,t,{get:i[t],enumerable:true});};var p=(o,i,t,e)=>{for(var r=e>1?void 0:e?jl(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&&Ws(i,t,r),r};var Mt=[],Jt=0,Wi=4,Ys=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=Jt+Wi;s<Mt.length;)Mt[s]===e?Mt.splice(s,Wi):s+=Wi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!Mt.length;for(let n of i)Mt.push(n,t.value,e,r);if(s){for(Jt=0;Jt<Mt.length;Jt+=Wi)Mt[Jt](Mt[Jt+1],Mt[Jt+2],Mt[Jt+3]);Mt.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};function Zi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}function Co(o,i,t){let e=Zi(o,i,t);return t(o.value),e}var To=(o={})=>{let i=Ys(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};var H=class o{static{this.Xe=new Map;}constructor(i,t){this.at=i,this.bt=t;}get id(){return this.at}pub(i,t){i in this.bt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.bt.setKey(i,t);}sub(i,t,e=true){return (e?Co:Zi)(this.bt,[i],s=>{t(s[i]);})}read(i){return i in this.bt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.bt.get()[i]}add(i,t,e=false){(!(i in this.bt.get())||e)&&this.bt.setKey(i,t);}has(i){return i in this.bt.get()}get store(){return this.bt.get()}static registerCtx(i,t){if(o.Xe.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=To(i);return o.Xe.set(t,e),new o(t,e)}static deleteCtx(i){o.Xe.delete(i);}static getCtx(i){let t=o.Xe.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Xe.has(i)}};var Yi=globalThis,Qi=Yi.ShadowRoot&&(Yi.ShadyCSS===void 0||Yi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Qs=Symbol(),Xs=new WeakMap,Xi=class{constructor(i,t,e){if(this.Vc=true,e!==Qs)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(Qi&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Xs.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Xs.set(t,i));}return i}toString(){return this.cssText}},Js=o=>new Xi(typeof o=="string"?o:o+"",void 0,Qs);var tn=(o,i)=>{if(Qi)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Yi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},xo=Qi?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Js(t)})(o):o;var{is:ql,defineProperty:Wl,getOwnPropertyDescriptor:Zl,getOwnPropertyNames:Yl,getOwnPropertySymbols:Xl,getPrototypeOf:Ql}=Object,Ji=globalThis,en=Ji.trustedTypes,Jl=en?en.emptyScript:"",tc=Ji.reactiveElementPolyfillSupport,ci=(o,i)=>o,ui={toAttribute(o,i){switch(i){case Boolean:o=o?Jl: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}},tr=(o,i)=>!ql(o,i),rn={attribute:true,type:String,converter:ui,reflect:false,useDefault:false,hasChanged:tr};Symbol.metadata??=Symbol("metadata"),Ji.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static addInitializer(i){this.Yr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ni&&[...this.Ni.keys()]}static createProperty(i,t=rn){if(t.state&&(t.attribute=false),this.Yr(),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&&Wl(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Zl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let a=r?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??rn}static Yr(){if(this.hasOwnProperty(ci("elementProperties")))return;let i=Ql(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(ci("finalized")))return;if(this.finalized=true,this.Yr(),this.hasOwnProperty(ci("properties"))){let t=this.properties,e=[...Yl(t),...Xl(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.Ni=new Map;for(let[t,e]of this.elementProperties){let r=this.Xr(t,e);r!==void 0&&this.Ni.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(xo(r));}else i!==void 0&&t.push(xo(i));return t}static Xr(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.Vi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.be=null,this._c();}_c(){this.Qr=new Promise(i=>this.enableUpdating=i),this.Yt=new Map,this.Bc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Qe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Qe?.delete(i);}Bc(){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.Vi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return tn(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Qe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Qe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Jr(i,e);}zc(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.Xr(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:ui).toAttribute(t,e.type);this.be=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.be=null;}}Jr(i,t){let e=this.constructor,r=e.Ni.get(i);if(r!==void 0&&this.be!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ui;this.be=r;let a=n.fromAttribute(t,s.type);this[r]=a??this.to?.get(r)??a,this.be=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??tr)(s,t)||e.useDefault&&e.reflect&&s===this.to?.get(i)&&!this.hasAttribute(n.Xr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Qr=this.Hc());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.to??=new Map).has(i)&&(this.to.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.Yt.has(i)||(this.hasUpdated||e||(t=void 0),this.Yt.set(i,t)),r===true&&this.be!==i&&(this.cn??=new Set).add(i));}async Hc(){this.isUpdatePending=true;try{await this.Qr;}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.Vi){for(let[r,s]of this.Vi)this[r]=s;this.Vi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,a=this[r];n!==true||this.Yt.has(r)||a===void 0||this.C(r,void 0,s,a);}}let i=false,t=this.Yt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Qe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.eo();}catch(e){throw i=false,this.eo(),e}i&&this.Kc(t);}willUpdate(i){}Kc(i){this.Qe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}eo(){this.Yt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Qr}shouldUpdate(i){return true}update(i){this.cn&&=this.cn.forEach(t=>this.zc(t,this[t])),this.eo();}updated(i){}firstUpdated(i){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[ci("elementProperties")]=new Map,zt[ci("finalized")]=new Map,tc?.({ReactiveElement:zt}),(Ji.reactiveElementVersions??=[]).push("2.1.2");var Ao=globalThis,on=o=>o,er=Ao.trustedTypes,sn=er?er.createPolicy("lit-html",{createHTML:o=>o}):void 0,ko="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Mo="?"+Ht,ec=`<${Mo}>`,ye=document,pi=()=>ye.createComment(""),hi=o=>o===null||typeof o!="object"&&typeof o!="function",Io=Array.isArray,dn=o=>Io(o)||typeof o?.[Symbol.iterator]=="function",So=`[ \f\r]`,di=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nn=/-->/g,an=/>/g,ge=RegExp(`>|${So}(?:([^\\s"'>=/]+)(${So}*=${So}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),ln=/'/g,cn=/"/g,pn=/^(?:script|style|textarea|title)$/i,Oo=o=>(i,...t)=>({Nt:o,strings:i,values:t}),v=Oo(1),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),un=new WeakMap,ve=ye.createTreeWalker(ye,129);function hn(o,i){if(!Io(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return sn!==void 0?sn.createHTML(i):i}var mn=(o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=di;for(let a=0;a<t;a++){let l=o[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===di?d[1]==="!--"?n=nn:d[1]!==void 0?n=an:d[2]!==void 0?(pn.test(d[2])&&(r=RegExp("</"+d[2],"g")),n=ge):d[3]!==void 0&&(n=ge):n===ge?d[0]===">"?(n=r??di,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?ge:d[3]==='"'?cn:ln):n===cn||n===ln?n=ge:n===nn||n===an?n=di:(n=ge,r=void 0);let m=n===ge&&o[a+1].startsWith("/>")?" ":"";s+=n===di?l+ec:u>=0?(e.push(c),l.slice(0,u)+ko+l.slice(u)+Ht+m):l+Ht+(u===-2?a:m);}return [hn(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},mi=class o{constructor({strings:i,Nt:t},e){let r;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=mn(i,t);if(this.el=o.createElement(c,e),ve.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(r=ve.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(ko)){let h=d[n++],m=r.getAttribute(u).split(Ht),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:m,ctor:g[1]==="."?rr:g[1]==="?"?or:g[1]==="@"?sr:we}),r.removeAttribute(u);}else u.startsWith(Ht)&&(l.push({type:6,index:s}),r.removeAttribute(u));if(pn.test(r.tagName)){let u=r.textContent.split(Ht),h=u.length-1;if(h>0){r.textContent=er?er.emptyScript:"";for(let m=0;m<h;m++)r.append(u[m],pi()),ve.nextNode(),l.push({type:2,index:++s});r.append(u[h],pi());}}}else if(r.nodeType===8)if(r.data===Mo)l.push({type:2,index:s});else {let u=-1;for(;(u=r.data.indexOf(Ht,u+1))!==-1;)l.push({type:7,index:s}),u+=Ht.length-1;}s++;}}static createElement(i,t){let e=ye.createElement("template");return e.innerHTML=i,e}};function be(o,i,t=o,e){if(i===it)return i;let r=e!==void 0?t.jc?.[e]:t.Gc,s=hi(i)?void 0:i.io;return r?.constructor!==s&&(r?.un?.(false),s===void 0?r=void 0:(r=new s(o),r.ro(o,t,e)),e!==void 0?(t.jc??=[])[e]=r:t.Gc=r),r!==void 0&&(i=be(o,r.qc(o,i.values),r,e)),i}var ir=class{constructor(i,t){this.dn=[],this.wt=void 0,this.pn=i,this.f=t;}get parentNode(){return this.f.parentNode}get X(){return this.f.X}u(i){let{el:{content:t},parts:e}=this.pn,r=(i?.creationScope??ye).importNode(t,true);ve.currentNode=r;let s=ve.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Re(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new nr(s,this,i)),this.dn.push(c),l=e[++a];}n!==l?.index&&(s=ve.nextNode(),n++);}return ve.currentNode=ye,r}p(i){let t=0;for(let e of this.dn)e!==void 0&&(e.strings!==void 0?(e.Et(i,e,t),t+=e.strings.length-2):e.Et(i[t])),t++;}},Re=class o{get X(){return this.f?.X??this.hn}constructor(i,t,e,r){this.type=2,this.r=P,this.wt=void 0,this.Pt=i,this.we=t,this.f=e,this.options=r,this.hn=r?.isConnected??true;}get parentNode(){let i=this.Pt.parentNode,t=this.f;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Pt}get endNode(){return this.we}Et(i,t=this){i=be(this,i,t),hi(i)?i===P||i==null||i===""?(this.r!==P&&this.Ee(),this.r=P):i!==this.r&&i!==it&&this.mn(i):i.Nt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):dn(i)?this.k(i):this.mn(i);}O(i){return this.Pt.parentNode.insertBefore(i,this.we)}T(i){this.r!==i&&(this.Ee(),this.r=this.O(i));}mn(i){this.r!==P&&hi(this.r)?this.Pt.nextSibling.data=i:this.T(ye.createTextNode(i)),this.r=i;}$(i){let{values:t,Nt:e}=i,r=typeof e=="number"?this.Wc(i):(e.el===void 0&&(e.el=mi.createElement(hn(e.h,e.h[0]),this.options)),e);if(this.r?.pn===r)this.r.p(t);else {let s=new ir(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Wc(i){let t=un.get(i.strings);return t===void 0&&un.set(i.strings,t=new mi(i)),t}k(i){Io(this.r)||(this.r=[],this.Ee());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(pi()),this.O(pi()),this,this.options)):e=t[r],e.Et(s),r++;r<t.length&&(this.Ee(e&&e.we.nextSibling,r),t.length=r);}Ee(i=this.Pt.nextSibling,t){for(this._i?.(false,true,t);i!==this.we;){let e=on(i).nextSibling;on(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.hn=i,this._i?.(i));}},we=class{get tagName(){return this.element.tagName}get X(){return this.f.X}constructor(i,t,e,r,s){this.type=1,this.r=P,this.wt=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=P;}Et(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=be(this,i,t,0),n=!hi(i)||i!==this.r&&i!==it,n&&(this.r=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=be(this,a[e+l],t,l),c===it&&(c=this.r[l]),n||=!hi(c)||c!==this.r[l],c===P?i=P:i!==P&&(i+=(c??"")+s[l+1]),this.r[l]=c;}n&&!r&&this.j(i);}j(i){i===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},rr=class extends we{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===P?void 0:i;}},or=class extends we{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==P);}},sr=class extends we{constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}Et(i,t=this){if((i=be(this,i,t,0)??P)===it)return;let e=this.r,r=i===P&&e!==P||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==P&&(e===P||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);}},nr=class{constructor(i,t,e){this.element=i,this.type=6,this.wt=void 0,this.f=t,this.options=e;}get X(){return this.f.X}Et(i){be(this,i);}},fn={I:Re},ic=Ao.litHtmlPolyfillSupport;ic?.(mi,Re),(Ao.litHtmlVersions??=[]).push("3.3.2");var ar=(o,i,t)=>{let e=t?.renderBefore??i,r=e.Zc;if(r===void 0){let s=t?.renderBefore??null;e.Zc=r=new Re(i.insertBefore(pi(),s),s,void 0,t??{});}return r.Et(o),r};var Lo=globalThis,Tt=class extends zt{constructor(){super(...arguments),this.renderOptions={host:this},this.oo=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.oo=ar(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.oo?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.oo?.setConnected(false);}render(){return it}};Tt.Th=true,Tt.finalized=true,Lo.litElementHydrateSupport?.({LitElement:Tt});var rc=Lo.litElementPolyfillSupport;rc?.({LitElement:Tt});(Lo.litElementVersions??=[]).push("4.2.2");var oc=/\\([0-9a-fA-F]{1,6} ?)/g;function sc(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}function nc(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}function ac(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}function gn(o){let i=o;sc(o)&&(i=nc(i),i=i.replace(oc,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=ac(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Ue(o){class i extends o{constructor(){super(...arguments);this.gn=null;this.so=null;}getCssData(r,s=false){let n=this.gn??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.so||(this.so=window.getComputedStyle(this));let a=this.so.getPropertyValue(r).trim();try{n[r]=gn(a);}catch(l){s||console.warn(`CSS Data error: ${r}`,l),n[r]=null;}}return this.gn=n,n[r]}}return i}function lr(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Xt={};this.Qt=null;this.Bi=false;}createRenderRoot(){return this}connectedCallback(){this.Qt||(this.Qt=Array.from(this.childNodes)),super.connectedCallback();}Yc(){if(this.Bi)return;this.Bi=true,this.Xt={};let r=Array.from(this.childNodes),s=r.length?r:this.Qt??[];for(let n of s){let a=this.vn(n),l=this.Xt[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.Xt[a]=l;}this.Qt=null;}vn(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.vn(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Xc(r){return !r.textContent||!r.textContent.trim()}Qc(r){let s=this.Xt[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Xc(n))}update(r){!this.hasUpdated&&this.willYield&&this.Yc(),super.update(r);}yield(r,s){if(r===""&&!this.Xt[r]&&!this.Bi&&this.Qt?.length){let a=[];for(let l of this.Qt)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.Xt[r]=a,this.Bi=true,this.Qt=null;}let n=this.Xt[r];return v` ${n} ${this.Qc(r)?s:void 0} `}}return i}function $e(o){class i extends o{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}var te=class extends Event{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 De=class{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 te(this.context,this.host,this.t,this.subscribe));}};var cr=class{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:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Po=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Fe=class extends cr{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:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new te(this.context,a,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 Po(this.context,this.host));}};var cc={attribute:true,type:String,converter:ui,reflect:false,hasChanged:tr},uc=(o=cc,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(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,o,true,a);},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,o,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(o){return (i,t)=>typeof t=="object"?uc(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)}function f(o){return y({...o,state:true,attribute:false})}function F(o,i){let t,e=((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var vn="ctx-name-context";function dr(){return function(o){class i extends o{constructor(...r){super(...r);this.pt=null;this.Je=false;this.ao=false;this.lo=void 0;this.xe=new Map;this.ti=new Set;this.init$={};this.ctxOwner=false;this.zi=void 0;this.Hi=false;this.ctxName=this.Vt;this._t=false;this.zi=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Vt,this.Jc=new De(this,{context:vn,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.wn=s,this.bn();},subscribe:true});}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 yn(){return this.zi}set yn(r){let s=r??void 0;this.zi!==s&&(this.zi=s,this.bn());}shouldUpdate(r){return this._t?super.shouldUpdate(r):false}get Vt(){return this.yn||this.wn||void 0}bn(){if(this.ctxName=this.Vt,!(!this.ctxName||this.Je)){if(this.isConnected){this.co();return}this.Hi=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Vt,this.ctxName&&(this.lo?this.lo.setValue(this.ctxName):this.lo=new Fe(this,{context:vn,initialValue:this.ctxName}));}En(){if(!(!this.pt||this.xe.size===0)){for(let[r,{value:s,rewrite:n}]of this.xe)this.pt.add(r,s,n);this.xe.clear();}}xn(){return !this.pt&&this.Vt&&this.uo(),this.pt&&this.En(),this.pt}Ki(){let r=this.xn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}uo(){let r=this.init$,s=this.Vt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.pt){this.pt=H.getCtx(s)??H.registerCtx(r,s);for(let[n,a]of Object.entries(this.init$))this.pt.add(n,a,this.ctxOwner);this.En();}}get $(){return this.Vt&&this.uo(),new Proxy({},{get:(r,s)=>{if(typeof s=="string")return this.pt?.read(s)},set:(r,s,n)=>(typeof s!="string"||this.pt?.pub(s,n),true)})}sub(r,s,n=true){let a=this.Ki().sub(r,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.ti.delete(d));};return this.ti.add(d),d}pub(r,s){this.Ki().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.Ki()}has(r){return this.pt?.has(r)??false}add(r,s,n=false){let a=this.xn();if(!a){if(!n&&this.xe.has(r))return;this.xe.set(r,{value:s,rewrite:n});return}this.xe.delete(r),a.add(r,s,n);}add$(r,s=false){for(let[n,a]of Object.entries(r))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.Je?this._t&&this.ao&&(this.ao=false,this.initCallback()):this.ctxName?(this.Hi=false,this.co()):this.Hi&&this.Vt&&(this.Hi=false,this.co());}co(){if(this.Je)return;this.Je=true,this.uo();let r=this.init$;if(Object.keys(r).length>0){let s=this.Ki();for(let[n,a]of Object.entries(r))s.read(n)===void 0&&s.pub(n,a),this.sub(n,F(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this._t=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.tu(),super.disconnectedCallback(),this.Je&&(this.ao=true);}tu(){if(this.ti.size!==0){for(let r of [...this.ti])r();this.ti.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"yn",1),p([f()],i.prototype,"wn",2),p([f()],i.prototype,"ctxName",2),p([f()],i.prototype,"_t",2),i}}var Ro=class extends $e(dr()(Ue(lr(Tt)))){};var rt=class o{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 dc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function vt(o){for(let i in o){if(dc.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);}}var Uo="UC";function pc(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Uo]){t(window[Uo]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[Uo];i&&vt(s),t(s);},document.head.appendChild(r);})}var fi={"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","upload-from":"Upload {{source}}","get-from":"Get from {{source}}","capture-with":"Capture with {{source}}",take:"Take {{source}}",record:"Record {{source}}",retake:"Retake",accept:"Accept"};var $o=new Map,yn=new Map,bn=(o,i)=>{$o.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...fi,...i};return $o.set(o,t),t},hc=(o,i)=>{yn.set(o,i);},wn=(o,i)=>{typeof i=="function"?hc(o,i):bn(o,i);},En=async o=>{let i=$o.get(o);if(!i){let t=yn.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=bn(o,e);}return i};wn("en",fi);var x=o=>`*cfg/${o}`;var j=o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],Kt=o=>o.join(",");var Cn=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},pr=(...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>Cn(i)).join("/-/"),ot=(...o)=>{let i=pr(...o);return i?`-/${i}/`:""};function hr(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}function mr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Do(o){let i=Tn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Fo(o){return Do(o).split("/-/").filter(Boolean).map(t=>Cn(t))}function Tn(o){let i=new URL(o),t=hr(o),e=xn(t)?Sn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function xn(o){return o.startsWith("http")}function Sn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var W=(o,i,t)=>{let e=new URL(Tn(o)),r=t??hr(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&xn(r)){let n=Sn(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()},ee=(o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()};var Z=(o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var gi=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}),kn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function mc(o,i){if(typeof i=="number"){let t=i;return gi[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return gi[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return gi.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}function ie(o){return pr(...kn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return mc(i,t)}).filter(i=>!!i))}var fr=pr("format/auto","progressive/yes"),jt=([o])=>typeof o<"u"?Number(o):void 0,An=()=>true,fc=([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),gc=([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:Z(o,"x").map(Number),coords:Z(i).map(Number)}},vc=Object.freeze({enhance:jt,brightness:jt,exposure:jt,gamma:jt,contrast:jt,saturation:jt,vibrance:jt,warmth:jt,filter:fc,mirror:An,flip:An,rotate:jt,crop:o=>{let[i,t]=o,{dimensions:e,coords:r}=gc([i,t]);return {dimensions:e,coords:r}}});function Vo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!kn.includes(e))continue;let s=e,n=vc[s];try{let a=n(r);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var z=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),st=Object.freeze([z.CROP,z.TUNING,z.FILTERS]),Mn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),In=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"]),On=Object.freeze(["rotate","mirror","flip"]),Gt=gi,It=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 vi="https://ucarecdn.com",yc="https://upload.uploadcare.com",bc="https://social.uploadcare.com",wc="https://ucarecd.net",Ec={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:vi,cdnCnamePrefixed:wc,baseUrl:yc,socialBaseUrl:bc,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:[],smartButtonViewMode:"auto",smartButtonShowFirstIcon:true},J=Object.freeze(Ec);var gr=(o,i)=>(...t)=>{let e=o();if(!e.read(x("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);};var K=class{constructor(i){this.po=new Set;this.Jt=null;this.w=gr(()=>this.e.ctx,this.constructor.name);this.e=i,this.i=i.ctx;}addSub(i){this.po.add(i);}get te(){if(!this.Jt){let i={};this.Jt=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let r=x(e);return this.e.ctx.has(r)?this.e.ctx.read(r):J[e]}});}return this.Jt}destroy(){for(let i of this.po)try{i();}catch{}this.po.clear();}},Cc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},xt=(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`)},Ln=o=>({get ctx(){return o()},get modalManager(){return xt(o(),"*modalManager",false)},get pluginManager(){return xt(o(),"*pluginManager")},get telemetryManager(){return xt(o(),"*telemetryManager")},get localeManager(){return xt(o(),"*localeManager")},get a11y(){return xt(o(),"*a11y")},get routerLayer(){return xt(o(),"*routerLayer")},get blocksRegistry(){return xt(o(),"*blocksRegistry")},get eventEmitter(){return xt(o(),"*eventEmitter")},get uploadCollection(){return xt(o(),"*uploadCollection")},get secureUploadsManager(){return xt(o(),"*secureUploadsManager",false)},get api(){return xt(o(),"*publicApi")},get validationManager(){return xt(o(),"*validationManager")},when(i,t){let e=Cc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n;return n=r.sub(e,a=>{a&&(t(a),n?.());}),n},wait(i){return new Promise(t=>{let e;e=this.when(i,r=>{t(r),e?.();});})}});var Y=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),vr=class extends K{constructor(){super(...arguments);this.ee=new Map;this.xt=new Set;this.c=new Map;}registerModal(t,e){this.ee.set(t,e),this.Z(Y.ADD,{id:t,modal:e});}deleteModal(t){let e=this.ee.get(t);return e?(this.ee.delete(t),this.xt.delete(t),this.Z(Y.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.ee.get(t);return e?(this.xt.add(t),this.Z(Y.OPEN,{modal:e,id:t}),true):(this.w(`Modal with ID "${t}" not found`),false)}close(t){let e=this.ee.get(t);return !e||!this.xt.has(t)?(this.w(`Modal with ID "${t}" not found or not active`),false):(this.xt.delete(t),this.Z(Y.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.ee.has(t)?this.xt.has(t)?this.close(t):this.open(t):(this.w(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.xt.size>0}back(){if(this.xt.size===0)return this.w("No active modals to go back from"),false;let t=Array.from(this.xt).pop();return t?this.close(t):false}closeAll(){let t=this.xt.size;return this.xt.clear(),this.Z(Y.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);}Z(t,e){if(this.c.has(t))for(let r of this.c.get(t)??new Set)try{r(e);}catch(s){this.e.telemetryManager.sendEventError(s,"modal subscriber"),this.w("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.ee.clear(),this.c.clear(),this.Z(Y.DESTROY,{});}};var yr=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("-");function Pn(o){return Object.prototype.toString.call(o)==="[object Object]"}var Tc=/\W|_/g;function xc(o){return o.split(Tc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Rn(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>Wt(t,{ignoreKeys:i})):o}function Wt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Rn(o,{ignoreKeys:i});if(!Pn(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}Pn(r)?r=Wt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Rn(r,{ignoreKeys:i})),t[xc(e)]=r;}return t}var Sc=o=>new Promise(i=>setTimeout(i,o));function jo({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("/"),a=[s,r].filter(Boolean).join("; ");return `${n} (${a})`}var Ac={factor:2,time:100};function kc(o,i=Ac){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a=>Sc(a??s).then(()=>(t+=1,e(r)))})}return e(o)}var Ee=class extends Error{},Ve=class o extends Ee{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},br=(o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},re=class o extends Ee{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},Mc=500,$n=({check:o,interval:i=Mc,timeout:t,signal:e})=>new Promise((r,s)=>{let n,a;br(e,()=>{n&&clearTimeout(n),s(new re("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),s(new re("Timed out"));},t));let l=()=>{try{Promise.resolve(o(e)).then(c=>{c?(a&&clearTimeout(a),r(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),s(c);});}catch(c){a&&clearTimeout(a),s(c);}};n=setTimeout(l,0);}),R={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"},wr="application/octet-stream",Dn="original",se=({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=o?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,m]=u;typeof m<"u"&&!Array.isArray(m)&&l.setRequestHeader(h,m);}),l.responseType="text",br(r,()=>{d=true,l.abort(),a(new re);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};h.forEach(function(w){let C=w.split(": "),E=C.shift(),S=C.join(": ");E&&typeof E<"u"&&(m[E]=S);});let g=l.response,b=l.status;n({request:u,data:g,headers:m,status:b});}},l.onerror=u=>{d||a(new Ve(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function Ic(o,...i){return o}var Oc=({name:o})=>o?[o]:[],Lc=Ic,Pc=()=>new FormData,Fn=o=>false,Er=o=>typeof Blob<"u"&&o instanceof Blob,Cr=o=>typeof File<"u"&&o instanceof File,Tr=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string",Ne=o=>Er(o)||Cr(o)||Fn()||Tr(o),Rc=o=>typeof o=="string"||typeof o=="number"||typeof o>"u",Uc=o=>!!o&&typeof o=="object"&&!Array.isArray(o),$c=o=>!!o&&typeof o=="object"&&"data"in o&&Ne(o.data);function Vn(o,i,t){if(Array.isArray(t))for(let e of t)Vn(o,`${i}[]`,e);else if($c(t)){let{name:e,contentType:r}=t,s=Lc(t.data,e,r??wr),n=Oc({name:e});o.push([i,s,...n]);}else if(Uc(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Rc(t)&&t&&o.push([i,t.toString()]);}function Dc(o){let i=[];for(let[t,e]of Object.entries(o))Vn(i,t,e);return i}function xr(o){let i=Pc(),t=Dc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}var nt=class o extends Ee{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);}},Fc=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()},qt=(o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Fc(t)),e.toString()},Vc="6.18.4",Nc="UploadcareUploadClient",_c=Vc;function Te(o){return jo({libraryName:Nc,libraryVersion:_c,...o})}var Bc="RequestThrottledError",Un=15e3,zc=1e3;function Hc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return Un;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Un}function ne(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return kc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Bc&&r<t)return s(Hc(n));if(n instanceof Ve&&r<e)return s((r+1)*zc);throw n}))}var Nn=o=>{let i="";return (Er(o)||Cr(o)||Tr(o))&&(i=o.type),i||wr},_n=o=>{let i="";return Cr(o)&&o.name?i=o.name:Er(o)||Fn()?i="":Tr(o)&&o.name&&(i=o.name),i||Dn};function Go(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}function Kc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=R.baseURL,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return ne(()=>se({method:"POST",url:qt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Te({publicKey:i,integration:u,userAgent:h})},data:xr({file:{data:o,name:t||_n(o),contentType:e||Nn(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Go(a),signature:s,expire:n,source:d,metadata:b}),signal:l,onProgress:c}).then(({data:w,headers:C,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,C);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var Bo;(function(o){o.Token="token",o.FileInfo="file_info";})(Bo||(Bo={}));function jc(o,{publicKey:i,baseURL:t=R.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return ne(()=>se({method:"POST",headers:{"X-UC-User-Agent":Te({publicKey:i,integration:u,userAgent:h})},url:qt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Go(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:d}).then(({data:w,headers:C,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,C);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var pt;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(pt||(pt={}));var Gc=o=>"status"in o&&o.status===pt.Error;function qc(o,{publicKey:i,baseURL:t=R.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=R.retryNetworkErrorMaxTimes}={}){return ne(()=>se({method:"GET",headers:i?{"X-UC-User-Agent":Te({publicKey:i,integration:r,userAgent:s})}:void 0,url:qt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:l,headers:c,request:d})=>{let u=Wt(JSON.parse(l));if("error"in u&&!Gc(u))throw new nt(u.error.content,u.error.errorCode,d,u,c);return u}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function Wc(o,{publicKey:i,baseURL:t=R.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:u=R.retryNetworkErrorMaxTimes}){return ne(()=>se({method:"POST",headers:{"X-UC-User-Agent":Te({publicKey:i,integration:l,userAgent:c})},url:qt(t,"/group/",{jsonerrors:1}),data:xr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:a}),signal:n}).then(({data:h,headers:m,request:g})=>{let b=Wt(JSON.parse(h));if("error"in b)throw new nt(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:u,retryThrottledRequestMaxTimes:d})}function Bn(o,{publicKey:i,baseURL:t=R.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=R.retryNetworkErrorMaxTimes}){return ne(()=>se({method:"GET",headers:{"X-UC-User-Agent":Te({publicKey:i,integration:s,userAgent:n})},url:qt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:c,headers:d,request:u})=>{let h=Wt(JSON.parse(c));if("error"in h)throw new nt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Zc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=R.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,store:l,signal:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return ne(()=>se({method:"POST",url:qt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Te({publicKey:i,integration:u,userAgent:h})},data:xr({filename:e,size:o,content_type:t||wr,part_size:r,UPLOADCARE_STORE:Go(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:d,metadata:b}),signal:c}).then(({data:w,headers:C,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,C);return S.parts=Object.keys(S.parts).map(Et=>S.parts[Number(Et)]),S}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}function Yc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=R.retryNetworkErrorMaxTimes}){return ne(()=>se({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||wr}}).then(a=>(r&&r({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function Xc(o,{publicKey:i,baseURL:t=R.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=R.retryNetworkErrorMaxTimes}){return ne(()=>se({method:"POST",url:qt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Te({publicKey:i,integration:s,userAgent:n})},data:xr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:d,request:u})=>{let h=Wt(JSON.parse(c));if("error"in h)throw new nt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function qo(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return $n({check:d=>Bn(o,{publicKey:i,baseURL:t,signal:d,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(u=>u.isReady?u:(c&&c({isComputable:true,value:1}),false)),signal:l})}function Qc(o){return "defaultEffects"in o}var Ce=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=R.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=qt(t,`${r}/`),a=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=a,Qc(i)&&(this.defaultEffects=i.defaultEffects);}},Jc=(o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>Kc(o,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:C})=>qo(C,{publicKey:i,baseURL:e,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(C=>new Ce(C,{baseCDN:b})),tu=(o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d,baseCDN:u})=>Bn(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d}).then(h=>new Ce(h,{baseCDN:u,fileName:t})).then(h=>(s&&s({isComputable:true,value:1}),h)),eu=(o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=n=>()=>{e=n,r.forEach((a,l)=>l!==n&&a.abort());};return br(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:r[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},iu=window.WebSocket,zo=class{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]=[];}},ru=(o,i)=>o==="success"?{status:pt.Success,...i}:o==="progress"?{status:pt.Progress,...i}:{status:pt.Error,...i},Ho=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new zo;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 iu(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,ru(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};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)}},No=null,Wo=o=>{if(!No){let i=typeof window>"u"?0:3e4;No=new Ho(o,i);}return No},ou=o=>{Wo(o).connect();};function su({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return $n({check:c=>qc(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:c}).then(d=>{switch(d.status){case pt.Error:return new nt(d.error,d.errorCode);case pt.Waiting:return false;case pt.Unknown:return new nt(`Token "${o}" was not found.`);case pt.Progress:return a&&(d.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:d.done/d.total})),false;case pt.Success:return a&&a({isComputable:true,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:l})}var nu=({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=Wo(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(o);};br(t,()=>{l(),s(new re("pusher cancelled"));}),n.subscribe(o,c=>{switch(c.status){case pt.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case pt.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),r(c);break}case pt.Error:l(),s(new nt(c.msg,c.error_code));}});}),au=(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,onProgress:u,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=R.pusherKey,metadata:C})=>Promise.resolve(ou(w)).then(()=>jc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:C})).catch(E=>(Wo(w)?.disconnect(),Promise.reject(E))).then(E=>E.type===Bo.FileInfo?E:eu([({signal:S})=>su({token:E.token,publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:S}),({signal:S})=>nu({token:E.token,pusherKey:w,signal:S,onProgress:u})],{signal:d})).then(E=>{if(E instanceof nt)throw E;return E}).then(E=>qo(E.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:d})).then(E=>new Ce(E,{baseCDN:r})),_o=new WeakMap,lu=async o=>{if(_o.has(o))return _o.get(o);let i=await fetch(o.uri).then(t=>t.blob());return _o.set(o,i),i},zn=async o=>{if(Cr(o)||Er(o))return o.size;if(Tr(o))return (await lu(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},cu=(o,i=R.multipartMinFileSize)=>o>=i,Hn=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 !Ne(o)&&t.test(o)},Zo=o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Ne(o)&&t.test(o)},uu=(o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,d=a.shift();d&&d().then(u=>{s||(r[c]=u,n-=1,n?l():t(r));}).catch(u=>{s=true,e(u);});};for(let c=0;c<o;c++)l();}),du=(o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},pu=async(o,i,t)=>e=>du(o,e,i,t),hu=(o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Yc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),mu=async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=R.multipartChunkSize,maxConcurrentRequests:C=R.maxConcurrentRequests,baseCDN:E,metadata:S})=>{let Et=e??await zn(o),Ct,fe=(Q,dt)=>{if(!c)return;Ct||(Ct=Array(Q).fill(0));let kt=Pt=>Pt.reduce((Bt,Eo)=>Bt+Eo,0);return Pt=>{Pt.isComputable&&(Ct[dt]=Pt.value,c({isComputable:true,value:kt(Ct)/Q}));}};return b||=Nn(o),Zc(Et,{publicKey:i,contentType:b,fileName:t||_n(o),baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:S,multipartChunkSize:w}).then(async({uuid:Q,parts:dt})=>{let kt=await pu(o,Et,w);return Promise.all([Q,uu(C,dt.map((Pt,Bt)=>()=>hu(kt(Bt),Pt,{publicKey:i,contentType:b,onProgress:fe(dt.length,Bt),signal:l,integration:u,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([Q])=>Xc(Q,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(Q=>Q.isReady?Q:qo(Q.uuid,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(Q=>new Ce(Q,{baseCDN:E}))};async function Yo(o,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:C,baseCDN:E=R.baseCDN,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:Et,pusherKey:Ct,metadata:fe}){if(Ne(o)){let Q=await zn(o);return cu(Q,b)?mu(o,{publicKey:i,contentType:g,multipartChunkSize:w,fileSize:Q,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:fe}):Jc(o,{publicKey:i,fileName:t,contentType:g,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:fe})}if(Zo(o))return au(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:E,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:Et,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,pusherKey:Ct,metadata:fe});if(Hn(o))return tu(o,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E});throw new TypeError(`File uploading from "${o}" is not supported`)}var fu=(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}},Ko=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=R.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=fu(i.cdnUrl,t),this.files=e.map(r=>new Ce(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},gu=o=>{for(let i of o)if(!Ne(i))return false;return true},vu=o=>{for(let i of o)if(!Hn(i))return false;return true},yu=o=>{for(let i of o)if(!Zo(i))return false;return true};function Kn(o,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=R.multipartChunkSize,baseCDN:w=R.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E,jsonpCallback:S}){if(!gu(o)&&!yu(o)&&!vu(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let Et,Ct=true,fe=o.length,Q=(dt,kt)=>{if(!l)return;Et||(Et=Array(dt).fill(0));let Pt=Bt=>Bt.reduce((Eo,Kl)=>Eo+Kl)/dt;return Bt=>{if(!Bt.isComputable||!Ct){Ct=false,l({isComputable:false});return}Et[kt]=Bt.value,l({isComputable:true,value:Pt(Et)});}};return Promise.all(o.map((dt,kt)=>Ne(dt)||Zo(dt)?Yo(dt,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:Q(fe,kt),source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E}).then(Pt=>Pt.uuid):dt)).then(dt=>Wc(dt,{publicKey:i,baseURL:e,jsonpCallback:S,secureSignature:r,secureExpire:s,signal:a,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m}).then(kt=>new Ko(kt,{baseCDN:w})).then(kt=>(l&&l({isComputable:true,value:1}),kt)))}var oe=class{ji=1;ho=[];Gi=0;fo=new Map;mo=new Map;constructor(i){this.ji=i;}run(){let i=this.ji-this.Gi;for(let t=0;t<i;t++){let e=this.ho.shift();if(!e)return;let r=this.fo.get(e),s=this.mo.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Gi+=1,e().finally(()=>{this.fo.delete(e),this.mo.delete(e),this.Gi-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.fo.set(i,e),this.mo.set(i,r),this.ho.push(i),t&&this.run();})}get pending(){return this.ho.length}get running(){return this.Gi}set concurrency(i){this.ji=i,this.run();}get concurrency(){return this.ji}};var Xo=()=>({}),Qo=o=>({...Xo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);}}),Jo=o=>({...Qo(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new oe(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),jn=o=>({...Jo(o),"*solution":null,"*lazyPlugins":null});var Sr=class extends K{constructor(t){super(t);this.scopes=new Set;this.listener=this.eu.bind(this),window.addEventListener("paste",this.listener);}iu(t){return !!t.closest("uc-url-source")}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async eu(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected){if(this.iu(t.target))return;switch(this.te.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(a=>{n.getAsString(l=>{a(l);});}));r.length>0&&(r.forEach(n=>{this.e.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(a=>{this.e.api.addFileFromUrl(a,{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 N=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Ar=class extends K{constructor(){super(...arguments);this.qi=[];}registerAfterFileAddHook(t){return this.qi.push(t),()=>{this.qi=this.qi.filter(e=>e!==t);}}navigateAfterFileAdd(){let e={historyLength:this.e.ctx.read("*history").length};this.qi.some(s=>s(e))||(this.e.ctx.pub("*currentActivity",N.UPLOAD_LIST),this.e.modalManager?.open(N.UPLOAD_LIST));}};var bu={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function yi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}function ts(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=bu[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}function es(o,i){return i.role==="toolbar"?Eu(i):i.querySelectorAll(`[role=${o.role}]`)}function wu(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})}function Eu(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function Cu(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"}function Gn(o){return i=>{let t=false,e=300,r=0,s="";function n(u){let h=ts(u.target);if(!h){a();return}let m=es(u.target,h),g=wu(m,h),b=Array.from(g).indexOf(u.target),w="ArrowDown",C="ArrowUp";if(Cu(h)&&(i.document.dir==="rtl"?(w="ArrowLeft",C="ArrowRight"):(w="ArrowRight",C="ArrowLeft")),u.key===w)u.preventDefault(),yi(u.target,g[b+1]||g[0]);else if(u.key===C)u.preventDefault(),yi(u.target,g[b-1]||g[g.length-1]);else if(u.key==="Home")u.preventDefault(),yi(u.target,g[0]);else if(u.key==="End")u.preventDefault(),yi(u.target,g[g.length-1]);else if(u.key.length===1&&h.role!=="tablist"){u.timeStamp-r<=e?s+=u.key.toLowerCase():s=u.key.toLowerCase(),r=u.timeStamp;let E=Array.from(m).find(S=>S.textContent?.trim()?.toLowerCase()?.startsWith(s));E&&(u.preventDefault(),yi(u.target,E));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=ts(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let m=es(u.target,h);for(let g of m)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=ts(u.target);if(h){let m=es(u.target,h);for(let g of m)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function qn(){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);}}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 o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}function Wn(){return o=>{let i=[];function t(l){let c=o.document.activeElement;c&&c!==o.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){o.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let r=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let d=o.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(s),d.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return o.addEventListener("keydown",a),()=>{o.removeEventListener("keydown",a);}}}function Zn(o){let i,t=o.split(" "),e;function r(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(s(),e!==a.target&&(a.target.classList.add(...t),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",r),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",r),a.removeEventListener("keyup",s);})}function Yn(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}var is=class{constructor(){this.mt=new Map;this.go=[];}addEventListener(i,t){let e=r=>{let s=r.target;s instanceof Node&&this.go.some(n=>n===s||n.contains(s))&&t(r);};this.mt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.mt.get(t);e&&window.removeEventListener(i,e),this.mt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.go.push(i);}destroy(){this.go=[];for(let i of this.mt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.mt.clear();}},kr=class{constructor(){this.Wi=new is,this.Tn=Yn(this.Wi,[Gn(),Zn("is-pressed"),Wn(),qn()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.Tn?.(),this.Wi.destroy();}};var Zt=o=>`*l10n/${o}`,Tu="en",Mr=class extends K{constructor(t){super(t);this.Te="";for(let[r,s]of Object.entries(fi)){let n=this.i.has(Zt(r))?!this.i.read(Zt(r)):true;this.i.add(Zt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Te&&this.Cn(this.Te);})),this.addSub(this.i.sub(x("localeName"),async r=>{if(!r)return;this.Te=r;let s=await En(r);r!==Tu&&this.Te!==r||(this.Cn(r),this.Sn(r,s));})),this.addSub(this.i.sub(x("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Te];s&&this.Sn(this.Te,s);}));}Sn(t,e){let r=this.te.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=r?.[s];this.i.add(Zt(s),a??n,true);}}Cn(t){let e=this.e.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.l10n){let{pluginId:n,...a}=s,l=a[t];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.i.add(Zt(c),d,true);}}};var xu=()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},Su=()=>"capture"in document.createElement("input"),Au=()=>({safariDesktop:xu()}),ku=()=>({htmlMediaCapture:Su()}),Xn=Au(),Qn=ku();var bi="image/*",rs="video/*",Mu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Iu=()=>Xn.safariDesktop?[bi]:[bi,...Mu],wi=Iu(),Ir=o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Z(i)):[],os=(o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),Jn=(o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),_e=o=>{let i=o?.type;return i?os(i,wi):false};function ta(o,i,t,e,r){return {registry:{registerSource:c=>o.addSource(e,c),registerActivity:c=>o.addActivity(e,c),registerFileAction:c=>o.addFileAction(e,c),registerFileHook:c=>o.addFileHook(e,c),registerIcon:c=>o.addIcon(e,c),registerL10n:c=>o.addL10n(e,c),registerConfig:c=>{o.addConfig(e,c);let d=x(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=x(c);return i.read(d)},subscribe:(c,d)=>{let u=x(c),h=i.sub(u,m=>{d(m);});return r.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let d=i.sub("*currentActivityParams",u=>{c(u);});return r.push(d),d}},files:{update:(c,d)=>{let u=t.uploadCollection?.read(c);u&&(d.file!==void 0&&(u.setValue("file",d.file),u.setValue("fileSize",d.file.size)),d.cdnUrl!==void 0&&u.setValue("cdnUrl",d.cdnUrl),d.cdnUrlModifiers!==void 0&&u.setValue("cdnUrlModifiers",d.cdnUrlModifiers),d.mimeType!==void 0&&u.setValue("mimeType",d.mimeType));}}}}var Ou=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),Or=class{constructor(i,t){this.i=i;this.ou=t;this.ei=new Set;this.An=this.i.sub("*lazyPlugins",e=>{this.ru(e??[]);});}ru(i){for(let r of this.ei)r();if(this.ei.clear(),i.length===0)return;let t=new Set([x("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(x(s));let e=()=>this.kn(i);for(let r of t)this.ei.add(this.i.sub(r,e,false));this.kn(i);}kn(i){this.vo?.abort();let t=new AbortController;this.vo=t;let e=n=>this.i.read(x(n)),r=e("plugins"),s=Ou({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.ou(s);}destroy(){this.An();for(let i of this.ei)i();this.ei.clear(),this.vo?.abort();}};var Lr=class{constructor(){this.ie=new Map;}register(i,t){if(this.ie.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.ie.set(t.name,e);}unregister(i){this.ie.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.ie)e.pluginId===i&&this.ie.delete(t);}get(i){return this.ie.get(i)}getAll(){return new Map(this.ie)}};var Pr=class{constructor(){this.z=[];this.Tt=[];this.Zi=[];this.Yi=[];this.Xi=[];this.Ce=[];this.config=new Lr;}Se(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.z.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.z.push(this.Se(i,t));}addActivity(i,t){let e=this.Tt.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.Tt.push(this.Se(i,t));}addFileAction(i,t){this.Zi.push(this.Se(i,t));}addFileHook(i,t){this.Yi.push(this.Se(i,{timeout:3e4,...t}));}addIcon(i,t){this.Xi.push(this.Se(i,t));}addL10n(i,t){this.Ce.push(this.Se(i,t));}addConfig(i,t){this.config.register(i,t);}purge(i){this.z=this.z.filter(t=>t.pluginId!==i),this.Tt=this.Tt.filter(t=>t.pluginId!==i),this.Zi=this.Zi.filter(t=>t.pluginId!==i),this.Yi=this.Yi.filter(t=>t.pluginId!==i),this.Xi=this.Xi.filter(t=>t.pluginId!==i),this.Ce=this.Ce.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.z],activities:[...this.Tt],fileActions:[...this.Zi],fileHooks:[...this.Yi],icons:[...this.Xi],l10n:[...this.Ce]}}};var Rr=class extends K{constructor(t){super(t);this.re=new Map;this.c=new Set;this.yo=Promise.resolve();this.registry=new Pr;this.Mn=new Or(this.i,e=>{this.yo=this.yo.then(()=>e).then(r=>{if(r)return this.su(r)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.yo}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async su(t){let e=new Set(this.re.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.re.has(s.id))try{await this.nu(s);}catch(n){this.registry.purge(s.id),this.bo(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.wo(s);}async nu(t){this.re.has(t.id)&&this.wo(t.id);let e=[],r=ta(this.registry,this.i,this.e,t.id,e),s=this.e.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.w("Failed to unsubscribe config listener",c);}throw a}this.re.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.bo();}wo(t){let e=this.re.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.re.delete(t),this.bo();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(r.length===0)return;let s=e,n=new AbortController;for(let a of r){if(n.signal.aborted)break;try{let l=a.handler({file:s,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:s}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",_e(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.re.keys()))this.wo(t);this.Mn.destroy(),super.destroy();}bo(){for(let t of this.c)try{t();}catch{}}};function Lu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function ns(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?ns(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=Lu(i);return typeof t=="object"&&t!==null?[e,ns(t)]:[e,t]}))}function Pu(o){return {ok:true,value:o}}function ss(o){return {ok:false,error:o}}var Ru="https://tlm.uploadcare.com/api/",as=class{constructor(i=Ru){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return ss(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return Pu(s)}catch(s){return ss(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return ss(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(ns(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Uu=async(o,i)=>({success:true,data:i}),$u=async o=>Uu(void 0,o),Ur=class extends as{constructor(){super();}async sendEvent(i,t){let e=await $u(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 Du=20,D=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),A=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"}),$r=class extends K{constructor(){super(...arguments);this.ii=new Map;this.Qi=new Set;this.mt=new Map;}bindTarget(t){return this.Qi.add(t),()=>{this.Qi.delete(t);}}on(t,e){let r=this.mt.get(t);return r||(r=new Set,this.mt.set(t,r)),r.add(e),()=>this.mt.get(t)?.delete(e)}On(t,e){for(let s of this.Qi)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.mt.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.On(t,typeof e=="function"?e():e);return}this.ii.has(t)&&window.clearTimeout(this.ii.get(t));let n=typeof s=="number"?s:Du,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.On(t,l),this.ii.delete(t);}catch(l){this.w?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.ii.set(t,a);}destroy(){for(let t of this.ii.values())window.clearTimeout(t);this.Qi.clear(),this.mt.clear();}};var ea="1.30.0-alpha.7";var Rt="blocks",Ut=ea;var Dr=class extends K{constructor(t){super(t);this.au=rt.generateRandomUUID();this.Ae=structuredClone(J);this.Eo=false;this.xo=null;this.Bt=false;this.In=new Ur,this.ke=new oe(10),this.addSub(this.i.sub(x("qualityInsights"),e=>{this.Bt=!!e;}));for(let e of Object.keys(this.Ae))this.addSub(this.i.sub(x(e),r=>{this.Bt&&(this.Eo&&this.Ae[e]!==r&&this.sendEvent({eventType:D.CHANGE_CONFIG}),this.lu(e,r));}));}cu(t){t===D.INIT_SOLUTION&&!this.Eo&&(this.Eo=true);}lu(t,e){this.Ae[t]!==e&&(this.Ae[t]=e);}uu(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===D.INIT_SOLUTION||t.eventType===D.CHANGE_CONFIG)&&(r.config=this.Ae),{...r,appVersion:Ut,appName:Rt,sessionId:this.au,component:this.du,activity:this.pu,projectPubkey:this.Ae.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.hu,payload:{location:this.fu,...e}}}mu(t){return !!(t&&[A.CHANGE,A.COMMON_UPLOAD_PROGRESS,A.FILE_ADDED,A.FILE_REMOVED,A.FILE_UPLOAD_START,A.FILE_UPLOAD_PROGRESS,A.FILE_UPLOAD_SUCCESS,A.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Bt)return;let e=this.uu({eventType:t.eventType,payload:t.payload,config:t.config});this.cu(t.eventType),!(this.mu(t.eventType)||this.xo&&this.Pn(this.xo,e))&&this.ke.add(async()=>{this.xo=e,await this.In.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:D.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}Pn(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.Pn(t[n],e[n]))return false;return true}get hu(){return Date.now()}get du(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get pu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get fu(){return location.origin}};var ia=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};var Vu=o=>o;var ra="plural:";function Be(o,i={},t={}){let{openToken:e="{{",closeToken:r="}}",transform:s=Vu}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);o=o.replaceAll(e+n+r,c);}return o}function oa(o){let i=[],t=o.indexOf("{{");for(;t!==-1;){let e=o.indexOf("}}",t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(ra)){let s=o.substring(t+2,e).replace(ra,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a});}t=o.indexOf("{{",e);}return i}var sa="--uploadcare-blocks-window-height",Ei=class o{static{this.clientsRegistry=new Set;}static{this.flush=F(()=>{document.documentElement.style.setProperty(sa,`${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(sa);}};var Fr=(o,i)=>new Intl.PluralRules(o).select(i);var Nu=o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=Fr(r,t);return e(`${i}__${s}`)},Vr=o=>{let i=Nu(()=>t),t=(e,r={})=>{if(!e)return "";let n=o().read(Zt(e))||e,a=oa(n);for(let c of a)r[c.variable]=i(c.pluralKey,Number(r[c.countVariable]));return Be(n,r)};return t};var _u=o=>o.tagName?.includes("-")??false,Nr=class{constructor(i){this.oe=new Set;this.Ji=new Map;this.Ln=false;this.se=i,this.se.addController(this);}hostDisconnected(){this.tr?.(),this.tr=void 0,this.oe.clear(),this.Ji.clear();}hostUpdated(){if(!this.tr&&this.se.has(x("testMode"))){let i=this.se.subConfigValue("testMode",t=>{this.Ln=!!t,this.Rn();});this.tr=i;}this.gu(),this.Rn();}gu(){let i=this.se,t=i.renderRoot??i;if(!t)return;let e=this.se,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!_u(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.oe.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.oe.add(n),this.Ji.set(n,a);}for(let n of Array.from(this.oe))(!n.isConnected||r&&n.closest(r)!==e)&&(this.oe.delete(n),this.Ji.delete(n));}Rn(){if(!this.oe.size)return;let i=this.se.testId||"";for(let t of this.oe){let e=this.Ji.get(t);e&&(this.Ln?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Bu=$e(dr()(Ue(lr(Tt)))),T=class extends Bu{constructor(){super();this.init$=Xo();this.l10n=Vr(()=>this.sharedCtx);this.debugPrint=gr(()=>this.sharedCtx,this.constructor.name);this.e=Ln(()=>this.sharedCtx);new Nr(this);}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(),Ei.registerClient(this);}initCallback(){this.Y("*blocksRegistry",()=>new Set),this.Y("*pluginManager",t=>new Rr(t)),this.Y("*eventEmitter",t=>new $r(t)),this.Y("*localeManager",t=>new Mr(t)),this.Y("*modalManager",t=>new vr(t)),this.Y("*a11y",()=>new kr),this.Y("*routerLayer",t=>new Ar(t)),this.Y("*clipboard",t=>new Sr(t)),this.Y("*telemetryManager",t=>new Dr(t)),this.sub(Zt("locale-id"),t=>{let e=ia(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.Q("*modalManager",false)}get telemetryManager(){return this.Q("*telemetryManager")}get localeManager(){return this.Q("*localeManager")}get a11y(){return this.Q("*a11y")}get clipboardLayer(){return this.Q("*clipboard")}get routerLayer(){return this.Q("*routerLayer")}get blocksRegistry(){return this.Q("*blocksRegistry")}get eventEmitter(){return this.Q("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),Ei.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.vu(),H.deleteCtx(this.ctxName);}Un(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Y(t,e){let r=this.Un();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),r.set(t,s);return}}vu(){let t=this.Un();for(let[e,r]of t.entries())r?.destroy?.(),this.pub(e,null);t.clear();}Q(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:mr(t),cdnUrlModifiers:Do(t),fileName:hr(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?Be(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.Jt){let t={};this.Jt=new Proxy(t,{set:(e,r,s)=>{if(typeof r!="string"||!(r in J))return false;let n=r,a=x(n);return this.has(a)||this.add(a,J[n]),this.$[a]=s,true},get:(e,r)=>{let s=x(r);return this.has(s)||this.add(s,J[r]),this.$[s]}});}return this.Jt}subConfigValue(t,e){let r=x(t);return this.has(r)||this.add(r,J[t]),this.sub(r,e)}};var $t={ATTRIBUTE:1,CHILD:2},at=o=>(...i)=>({io:o,values:i}),ht=class{constructor(i){}get X(){return this.f.X}ro(i,t,e){this.er=i,this.f=t,this.yu=e;}qc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var xe=class extends ht{constructor(i){if(super(i),this.it=P,i.type!==$t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===P||i==null)return this.$n=void 0,this.it=i;if(i===it)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.$n;this.it=i;let t=[i];return t.raw=t,this.$n={Nt:this.constructor.resultType,strings:t,values:[]}}};xe.directiveName="unsafeHTML",xe.resultType=1;var Ci=class extends xe{};Ci.directiveName="unsafeSVG",Ci.resultType=2;var ze=at(Ci);var na="<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 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></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 16 16' id='uc-icon-paperclip' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M13.264 9.743 9.03 13.977a4.217 4.217 0 0 1-5.96-.005 4.217 4.217 0 0 1-.004-5.96l6.416-6.416a2.743 2.743 0 0 1 3.88 3.88L7.637 11.2a1.232 1.232 0 1 1-1.743-1.743L9.42 5.932'/></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 T{constructor(){super(...arguments);this.init$=jn(this);}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 v`${ze(na)}`}};var aa=o=>typeof o!="number"?0:Math.floor(o/1e3),la=(o,{threshold:i})=>{let{secureExpire:t}=o,e=aa(Date.now()),r=Number(t),s=aa(i);return e+s>=r};var _r=class extends K{constructor(){super(...arguments);this.ne=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.te;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.ne||la(this.ne,{threshold:s})){this.ne?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.ne=n):(this.w("Secure signature resolver returned nothing."),this.ne=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.e.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.ne}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.ne=null;}};var ls=(o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var cs=(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}}};var us=(o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=Ir([...t?wi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let a=os(s,r),l=Jn(n,r);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}};var ds=(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}}};var Dt=1e3,Se=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Ti=o=>Math.ceil(o*100)/100,ca=(o,i=Se.AUTO)=>{let t=i===Se.AUTO;if(i===Se.BYTE||t&&o<Dt**1){let r=Fr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===Se.KB||t&&o<Dt**2?`${Ti(o/Dt**1)} KB`:i===Se.MB||t&&o<Dt**3?`${Ti(o/Dt**2)} MB`:i===Se.GB||t&&o<Dt**4?`${Ti(o/Dt**3)} GB`:i===Se.TB||t&&o<Dt**5?`${Ti(o/Dt**4)} TB`:`${Ti(o/Dt**5)} PB`};var ps=(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:ca(t)}),payload:{entry:o}}};var hs=(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 Ve)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}}};var He={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."},zu=o=>typeof o=="function"?{runOn:"change",validator:o}:o,Br=class extends K{constructor(t){super(t);this.bu=[ds,us,ps,hs];this.wu=[cs,ls];this.ke=new oe(20);this.Dn=F(()=>{this.ke.run();},500);this.zt=false;this.Me=new Map;let e=F(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.i.sub(x("maxLocalFileSizeBytes"),e)),this.addSub(this.i.sub(x("multipleMin"),e)),this.addSub(this.i.sub(x("multipleMax"),e)),this.addSub(this.i.sub(x("multiple"),e)),this.addSub(this.i.sub(x("imgOnly"),e)),this.addSub(this.i.sub(x("accept"),e)),this.addSub(this.i.sub(x("validationConcurrency"),r=>{this.ke.concurrency=r;}));}get v(){return this.e.uploadCollection}runFileValidators(t,e){if(this.zt)return;let r=e??this.v.items();for(let s of r){let n=this.v.read(s);n&&this.Eu(n,t);}}runCollectionValidators(){if(this.zt)return;let t=this.e.api,e=t.getOutputCollectionState(),r=[],s=this.te.collectionValidators;for(let n of [...this.wu,...s])try{let a=n(e,t);if(!a)continue;a&&(r.push(this.Fn(a)),a.message||console.warn(He.MISSING_ERROR_MESSAGE));}catch(a){console.warn(He.COLLECTION_VALIDATION_FAILED,a);}this.i.pub("*collectionErrors",r),r.length>0&&this.e.eventEmitter.emit(A.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Me.get(t.uid);e&&(e.abortController?.abort(),this.Me.delete(t.uid));}async Eu(t,e){if(this.zt)return;let r=this.e.api,s=this.Nn(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.zt||(await n,this.zt))return;let l=this.xu(t,e);if(l.length===0||!this.v.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=r.getOutputItem(t.uid),d=new AbortController;s.abortController=d;let u=this.te.validationTimeout,h=this.Vn(),m=new Set(l.map(w=>w.validator)),g=[];for(let w of h)if(!m.has(w.validator)){let C=s.lastErrorThrownByValidator.get(w.validator);C&&g.push(C);}let b=l.map(w=>async()=>{if(this.zt)return;let C=setTimeout(()=>{s.skippedValidators.add(w.validator),d.abort(),console.warn(He.FILE_VALIDATION_TIMEOUT);},u);try{let E=await w.validator(c,r,{signal:d.signal});if(!E||d.signal.aborted){s.lastErrorThrownByValidator.set(w.validator,void 0);return}let S=this.Fn(E);s.lastErrorThrownByValidator.set(w.validator,S),g.push(S),E.message||console.warn(He.MISSING_ERROR_MESSAGE);}catch(E){d.signal.aborted||(s.skippedValidators.add(w.validator),console.warn(He.FILE_VALIDATION_FAILED,E),this.e.telemetryManager.sendEventError(E,`file validator. ${He.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),w.runOn!=="change"&&s.skippedValidators.add(w.validator);}});if(this.Dn(),await this.ke.add(async()=>{this.zt||(t.setValue("isQueuedForValidation",false),await Promise.all(b.map(w=>w())).catch(()=>{}));},{autoRun:false}),d.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}Fn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Nn(t){let e=this.Me.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Me.set(t.uid,r),r}Vn(){let t=this.te.fileValidators;return [...this.bu,...t].map(zu)}xu(t,e){let r=this.Nn(t);return this.Vn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.zt=true,this.Dn.cancel();for(let t of this.Me.values())t.abortController?.abort(),t.promise=void 0;this.Me.clear();}};var ua="[Typed State] Wrong property name: ",zr=class{constructor(i){this.at=rt.generateFastUid(),this.J=H.registerCtx(i,this.at);}get uid(){return this.at}setValue(i,t){if(!this.J.has(i)){console.warn(`${ua}${String(i)}`);return}this.J.read(i)!==t&&this.J.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.J.has(i)||console.warn(`${ua}${String(i)}`),this.J.read(i)}subscribe(i,t){return this.J.sub(i,t)}destroy(){H.deleteCtx(this.at);}};var Hr=class o{constructor(i){this.Ht=Object.create(null);this.ir=new Set;this.rr=new Set;this.Ct=new Set;this.To=new Set;this.Co=new Set;this.Oe=new Set;this.zn=i.initialValue,this.at=rt.generateFastUid(),this.J=H.registerCtx({},this.at),this._n=i.watchList||[];let t=Object.create(null);this.Bn=(e,r)=>{this.ri&&window.clearTimeout(this.ri),t[e]||(t[e]=new Set),t[e].add(r),this.ri=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.ir.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Hn();},i.handler&&this.observeCollection(i.handler);}static{this.Tu=1e4;}Z(){this.oi&&window.clearTimeout(this.oi),this.oi=window.setTimeout(()=>{let i=new Set(this.Co),t=new Set(this.To);this.Co.clear(),this.To.clear();for(let e of this.rr)e?.([...this.Ct],i,t);this.Hn();});}Hn(){this.Oe.size!==0&&(this.si&&window.clearTimeout(this.si),this.si=window.setTimeout(()=>{let i=[...this.Oe];this.Oe.clear();for(let t of i)t.destroy();},o.Tu));}observeCollection(i){return this.rr.add(i),this.Ct.size>0&&this.Z(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.rr.delete(i);}add(i){let t=new zr(this.zn);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.Ct.add(t.uid),this.Z(),this.J.add(t.uid,t),this.Co.add(t),this._n.forEach(e=>{this.Ht[t.uid]||(this.Ht[t.uid]=[]),this.Ht[t.uid]?.push(t.subscribe(e,()=>{this.Bn(e,t.uid);}));}),t.uid}hasItem(i){return this.Ct.has(i)}read(i){return this.J.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.To.add(t),this.Oe.add(t)),this.Ct.delete(i),this.Z(),this.J.pub(i,void 0),this.Ht[i]?.forEach(e=>{e();}),delete this.Ht[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.Ct.forEach(i=>{this.abort(i);});}clearAll(){this.Ct.forEach(i=>{this.remove(i);});}observeProperties(i){return this.ir.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.ir.delete(i);}findItems(i){let t=[];return this.Ct.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.Ct]}get size(){return this.Ct.size}destroy(){this.ri&&window.clearTimeout(this.ri),this.oi&&window.clearTimeout(this.oi),this.si&&window.clearTimeout(this.si);for(let i of this.Oe)i.destroy();this.Oe.clear(),H.deleteCtx(this.at),this.ir=new Set,this.rr=new Set;for(let i of Object.keys(this.Ht))this.Ht[i]?.forEach(t=>{t();}),delete this.Ht[i];}};var L=Object.freeze({PHOTO:"photo",VIDEO:"video"}),St=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var da=o=>({isVideoRecordingEnabled:j(o.cameraModes).includes(L.VIDEO),isPhotoEnabled:j(o.cameraModes).includes(L.PHOTO)});var pa=(o,i)=>{for(let t of o)if(i(t))return t};var ms=(o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),a=()=>{for(let l of o)if(i(l)){clearTimeout(n),r(l);return}s=requestAnimationFrame(a);};a();});function Kr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}var Hu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Ku=new RegExp(`^/?(${Hu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),ha=({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(vi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Ku.exec(r.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var mt=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"}),ju=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),U=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...ju,...mt}),Gu={[mt.DROPBOX_CHOOSER]:mt.DROPBOX},ma=o=>Gu[o]??o;var jr=o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e));function fa(o){let i=new Map;return (...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s}}var ga=new Set;function Gr(o){ga.has(o)||(ga.add(o),console.warn(o));}function qu(o){let i=false;return setTimeout(()=>{i=true;},0),e=>((...r)=>(i&&Gr(o),e(...r)))}function va(o){let i={},t=o.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>o.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>jr(o),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},r=qu("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 a=s,c=fa(r(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var qr=class extends K{constructor(){super(...arguments);this.Ce=Vr(()=>this.i);this.addFileFromUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??U.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({uuid:t,fileName:r??null,silent:e??false,source:s??U.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=ha({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.v.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??U.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let a=this.v.add({file:t,isImage:_e(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??U.API,fullPath:n??null});return this.getOutputItem(a)};this.removeFileByInternalId=t=>{if(!this.v.read(t))throw new Error(`File with internalId ${t} not found`);this.v.remove(t);};this.uploadAll=()=>{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.i.pub("*uploadTrigger",new Set(t)),this.e.eventEmitter.emit(A.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=Kt(Ir([this.cfg.accept??"",...this.cfg.imgOnly?wi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),Kr(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:a}=da(this.cfg);t.modeCamera===L.PHOTO&&n?s.accept=bi:t.modeCamera===L.VIDEO&&a?s.accept=rs:s.accept=[bi,a&&rs].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?U.CAMERA:U.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.v.size>0&&!t)this.i.pub("*currentActivity",N.UPLOAD_LIST),this.e.modalManager?.open(N.UPLOAD_LIST);else if(this.Kn?.length===1){let e=this.Kn[0];this.So().then(()=>{let r=this.e.pluginManager.snapshot().sources,s=r.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(r.find(l=>l.id===n[0])??s).onSelect():(this.i.pub("*currentActivity",N.START_FROM),this.e.modalManager?.open(N.START_FROM));return}this.i.read("*currentActivity")&&this.e.modalManager?.open(this.i.read("*currentActivity"));});}else this.i.pub("*currentActivity",N.START_FROM),this.e.modalManager?.open(N.START_FROM);};this.doneFlow=()=>{let t=pa(this.e.blocksRegistry,e=>"doneActivity"in e);t&&(this.i.pub("*currentActivity",t.doneActivity),this.i.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.i.read("*currentActivity")||this.e.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{this.So().then(()=>{this.i.pub("*currentActivityParams",e[0]??{}),this.i.pub("*currentActivity",t),ms(this.e.blocksRegistry,r=>r.activityType===t,{onTimeout:()=>console.warn(`Activity type "${t}" not found in the context`),timeout:100});});};this.on=(t,e)=>this.e.eventEmitter.on(t,e);this.getCurrentActivity=()=>this.i.read("*currentActivity");this.historyBack=()=>{this.i.read("*historyBack")?.();};this.setModalState=t=>{this.So().then(()=>{if(!t){this.e.modalManager?.close(this.i.read("*currentActivity")),this.i.pub("*currentActivity",null);return}let e=this.i.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return ms(this.e.blocksRegistry,r=>r.activityType===e,{onTimeout:()=>console.warn(`Activity block "${e}" not found in the context`)}).then(()=>{this.e.modalManager?.open(e);})});};}get v(){return this.e.uploadCollection}get cfg(){return this.te}get l10n(){return this.Ce}removeAllFiles(){this.v.clearAll();}getOutputItem(t){let e=H.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 va(this.e)}async So(){return (await this.e.wait("pluginManager")).pluginsReady()}get Kn(){let t=[];return this.cfg.sourceList&&(t=Z(this.cfg.sourceList)),t}};var ya={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 xi=33.333333333333336,k=1,fs=24,ba=6;function ae(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}function yt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return ae(t,i),t}function wa(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*s+1.5*c,r+l*n+1.5*d-24*t*d],h=[e+a*s+1.5*c,r+l*n+1.5*d],m=[e+a*s-24*t*c+1.5*c,r+l*n+1.5*d],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`,b=[h[0],h[1]];return {d:g,center:b}}function Ea(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,m,g;a?(m=[e+c*s-34*t/2,r+d*n+1.5*h],g=[e+c*s+34*t/2,r+d*n+1.5*h]):(m=[e+c*s+1.5*u,r+d*n-34*t/2],g=[e+c*s+1.5*u,r+d*n+34*t/2]);let b=`M ${m[0]} ${m[1]} L ${g[0]} ${g[1]}`,w=[(m[0]+g[0])/2,(m[1]+g[1])/2];return {d:b,center:w}}function Ca(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}function Ta({rect:o,delta:[i,t],imageBox:e}){return je({...o,x:o.x+i,y:o.y+t},e)}function je(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}}function Wu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;s+=r,a-=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,a=o.y+o.height-s,t&&(n=a*t,l=o.x+o.width/2-n/2)),l<=e.x&&(l=e.x,s=o.y+o.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y+o.height-a),a<k&&(a=k,t&&(n=a*t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),n<k&&(n=k,t&&(a=n/t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),{x:l,y:s,width:n,height:a}}function Zu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;s+=r,n-=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(a=n/t,l=o.y+o.height/2-a/2)),l<=e.y&&(l=e.y,s=o.x+o.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x+o.width-n),a<k&&(a=k,t&&(n=a*t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),n<k&&(n=k,t&&(a=n/t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),{x:s,y:l,width:n,height:a}}function Yu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;a+=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=o.x+o.width/2-n/2),l<=e.x&&(l=e.x,s=o.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y),a<k&&(a=k,t&&(n=a*t),l=o.x+o.width/2-n/2),n<k&&(n=k,t&&(a=n/t),l=o.x+o.width/2-n/2),{x:l,y:s,width:n,height:a}}function Xu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;n+=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=o.y+o.height/2-a/2),l<=e.y&&(l=e.y,s=o.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x),a<k&&(a=k,t&&(n=a*t),l=o.y+o.height/2-a/2),n<k&&(n=k,t&&(a=n/t),l=o.y+o.height/2-a/2),{x:s,y:l,width:n,height:a}}function Qu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+s<e.y&&(s=e.y-a),n+=r,l-=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x+o.width-l,a=e.y)):t&&(r=c*t-l,l=l+r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y+o.height-c)),c<k&&(c=k,t&&(l=c*t),n=o.x+o.width-l,a=o.y+o.height-c),l<k&&(l=k,t&&(c=l/t),n=o.x+o.width-l,a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function Ju({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x,a=e.y)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y+o.height-c)),c<k&&(c=k,t&&(l=c*t),a=o.y+o.height-c),l<k&&(l=k,t&&(c=l/t),a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function td({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=r,l-=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x+o.width-l,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y)),c<k&&(c=k,t&&(l=c*t),n=o.x+o.width-l),l<k&&(l=k,t&&(c=l/t),n=o.x+o.width-l),{x:n,y:a,width:l,height:c}}function ed({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y)),c<k&&(c=k,t&&(l=c*t)),l<k&&(l=k,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function xa({direction:o,...i}){switch(o){case "n":return Wu(i);case "w":return Zu(i);case "s":return Yu(i);case "e":return Xu(i);case "nw":return Qu(i);case "ne":return Ju(i);case "sw":return td(i);case "se":return ed(i);default:return i.rect}}function Sa(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}function Aa(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}function ka(o,i){return Math.abs(o.width/o.height-i)<.1}function Ge({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}function Ma(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),a=Math.round((i-s)/2);return n+r>o&&(r=o-n),a+s>i&&(s=i-a),{x:n,y:a,width:r,height:s}}function qe(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}function le(o,i,t){return Math.min(Math.max(o,i),t)}var Si=["free"],Zr=o=>{let i=Z(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&&!Si.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),a=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!Si.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:rt.generateFastUid(),type:"aspect-ratio",width:Si.includes(r)?0:n,height:Si.includes(r)?0:a,hasFreeform:Si.includes(r)});}return t},Ia=(o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(r-d);u<n&&(n=u,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(r-c)/c>e)return null}return s};function Oa(o){return jo({...o,libraryName:Rt,libraryVersion:Ut})}var La="active",We="___ACTIVITY_IS_ACTIVE___",Pa,$=class o extends(Pa=T,Pa){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Qo(this);this.Cu=F(this.Su.bind(this),10);}jn(){let t=o.ni.get(this);this[We]=false,this.removeAttribute(La),t?.deactivateCallback?.();}Au(){let t=o.ni.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[We]=true,this.setAttribute(La,""),t?.activateCallback?.(),this.Cu(),this.emit(A.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[We]?this.jn():this.activityType===t&&!this[We]&&this.Au();}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"]=[]);}));}Su(){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);}Gn(){return !!this.activityType&&o.ni.has(this)}static{this.ni=new Map;}get isActivityActive(){return !!this[We]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ni.set(this,{activateCallback:r,deactivateCallback:s});}ku(){this.isActivityActive&&this.jn(),o.ni.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Gn()&&this.ku();}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();}}};$.activities=N;var M=class o extends ${constructor(){super(...arguments);this.couldBeCtxOwner=false;this.or=false;this.init$=Jo(this);this.Mo=F(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Lu(e);},300);this.Iu=(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(A.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.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(A.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Zn(),this.Mo();}};this.Pu=t=>{if(!this.isConnected)return;this.Mo();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)&&!!H.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=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Zn();}if(t.isUploading)for(let s of t.isUploading){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=H.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Ru();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=H.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(A.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(A.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(A.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(A.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Zn=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(A.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get Mu(){return this.hasBlockInCtx(t=>t instanceof o?t.or&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Y("*uploadCollection",()=>new Hr({initialValue:ya,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Y("*secureUploadsManager",t=>new _r(t)),this.Y("*validationManager",t=>new Br(t)),this.Y("*publicApi",t=>new qr(t)),!this.Mu&&this.couldBeCtxOwner&&this.Ou();}getAPI(){return this.api}get validationManager(){return this.Q("*validationManager")}get api(){return this.Q("*publicApi")}get uploadCollection(){return this.Q("*uploadCollection")}get secureUploadsManager(){return this.Q("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.or&&this.qn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.or&&this.Wn();}Ou(){this.or=true,this.Wn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Wn(){this.qn(),this.Ao=this.uploadCollection.observeCollection(this.Iu),this.ko=this.uploadCollection.observeProperties(this.Pu);}qn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async Lu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await Kn(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(A.GROUP_CREATED,a),this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}Ru(){let t=Zr(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:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=Ma(a,l,c),u=ot(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:u,cdnUrl:W(h,u)});}}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:Oa,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 jr(this.e)}};M.extSrcList=Object.freeze({...mt});M.sourceTypes=Object.freeze({...U});var ce=class extends T{constructor(){super(...arguments);this.name="";this.sr="";this.ai=null;this.Yn=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Yn=e,this.Oo();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Oo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Oo();}Oo(){if(!this.name){this.sr="",this.ai=null;return}let e=this.e.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.ai=e.svg,this.sr="";return}this.ai=null;let r=`#uc-icon-${this.name}`,s=this.Yn?.(this.name);this.sr=s??r;}render(){return this.ai?v`${this.yield("",v`${ze(this.ai)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.sr}></use></svg>`)} `}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};p([y({type:String})],ce.prototype,"name",2),p([f()],ce.prototype,"sr",2),p([f()],ce.prototype,"ai",2);var Ra=o=>[...new Set(o)];var Ae="--uc-img-",gs="unresolved";var vs=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ys=3e3,bs=5e3,ws=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var id="https://ucarecdn.com",Ze=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:id},"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 Yr=class extends Ue($e(Tt)){constructor(){super();this.Ie={};this.c=new Map;this.Pe=null;this.nr=null;for(let t in Ze){let e=Ze[t];this.Ie[Ae+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.Ie[Ae+t]}set$$(t){for(let e in t){let r=Ae+e,s=t[e];this.Ie[r]=s,this.Z(r,s);}}sub$$(t,e){let r=Ae+t;this.c.has(r)||this.c.set(r,new Set),this.c.get(r)?.add(e);let s=this.Ie[r];s!==null&&s!==""&&e(s);}Z(t,e){this.c.has(t)&&this.c.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${Rt}/${Ut}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;Ze[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.Pe=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.Pe?.unobserve(t));});},r),this.Pe.observe(t),this.nr||(this.nr=new Set),this.nr.add(t);}connectedCallback(){super.connectedCallback(),this.Uu();}Uu(){for(let t in Ze){let e=Ae+t,r=this.getCssData(e,true);r!=null&&(this.Ie[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.Pe&&(this.nr?.forEach(t=>{this.Pe?.unobserve(t);}),this.Pe=null),this.c.clear();}static get observedAttributes(){return Object.keys(Ze)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Ae+t;this.Ie[s]=r,this.Z(s,r);});}};var Ua=o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var Jr=class extends Yr{constructor(){super(...arguments);this.Lt=new Image;this.St=new Image;}Xn(t){return !t.includes("//")&&!vs&&(t=new URL(t,document.baseURI).href),t}ar(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)>bs&&this.Qn?bs+s:Number(n)>ys&&!this.Qn?ys+s:t}$u(t,e){let r={format:this.Io("format"),quality:this.Io("quality"),resize:this.ar(t),blur:e,"cdn-operations":this.Io("cdn-operations")??void 0,analytics:this.analyticsParams()};return ot(...Ua(r))}Io(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}gt(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(vs&&r&&!r.includes("//"))return this.li(r);let s=this.$u(t,e),n=this.$$("cdn-cname"),a=n;if(r.startsWith(String(n)))return W(r,s);let l=this.$$("uuid");if(a&&l)return this.li(W(ee(a,l),s));if(l)return this.li(W(ee(a,l),s));let c=this.$$("proxy-cname");if(c)return this.li(W(c,s,this.Xn(r)));let d=this.$$("pubkey");if(d)return this.li(W(`https://${d}.ucr.io/`,s,this.Xn(r)))}li(t){let e=this.$$("secure-delivery-proxy");return e?Be(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}Le(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=r?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Du(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.Rt||(this.Po({elNode:this.Lt}),this.appendChild(this.Lt)),this.Lt}get lr(){return this.Rt?{type:ws.PREVIEW,img:this.St}:{type:ws.MAIN,img:this.img}}get Rt(){return this.$$("is-preview-blur")}get Jn(){return this.$$("is-background-for")}get ta(){let t=this.$$("breakpoints");if(t){let e=Z(t);return Ra(e.map(r=>parseInt(r,10)))}else return null}get Qn(){return this.$$("format").toLowerCase()==="jpeg"}ea(t){let e=new Set;e.add(`url("${this.gt(this.Le(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.gt(this.Le(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.gt(this.Le(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}ia(){let t=new Set;return this.ta?this.ta.forEach(e=>{t.add(`${this.gt(`${e}x`)} ${this.ar(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.gt(`${e*2}x`)} ${this.ar(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.gt(`${e*3}x`)} ${this.ar(`${e*3}w`)}`);}):(t.add(`${this.gt(this.Le(this.lr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.gt(this.Le(this.lr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.gt(this.Le(this.lr.img,3))} 3x`)),[...t].join()}ra(){return this.gt()}get oa(){return this.gt("100x","100")}Fu(){let t=this.Jn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.ea(e);}):this.ea(e);});}Nu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Po({elNode:t}){this.Du(t),this.initAttributes(t);}Lo({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.Po({elNode:r}),r.setAttribute(gs,""),r.addEventListener("load",()=>{r.removeAttribute(gs),s(r);}),r.addEventListener("error",()=>{n(false);}),this.Nu({elNode:r,src:t,srcset:e});})}async Vu(){if(this.$$("intersection")){this.Rt&&(this.Po({elNode:this.St}),this.appendChild(this.St)),this.initIntersection(this.lr.img,async()=>{this.Rt&&(this.St.src=this.oa);try{await this.Lo({src:this.ra(),srcset:this.ia(),elNode:this.Lt}),this.Rt&&await this.St.remove(),this.appendChild(this.Lt);}catch{this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}});return}try{this.Rt&&(await this.Lo({src:this.oa,elNode:this.St}),this.appendChild(this.St)),await this.Lo({src:this.ra(),srcset:this.ia(),elNode:this.Lt}),this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}catch{this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}}init(){this.Jn?this.Fu():this.Vu();}};var Es=class extends Jr{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:rd}=fn,$a=o=>o;var Cs=(o,i)=>o?.Nt!==void 0,Fa=o=>o?.Nt?.h!=null;var Va=o=>o.strings===void 0,Da=()=>document.createComment(""),Xt=(o,i,t)=>{let e=o.Pt.parentNode,r=i===void 0?o.we:i.Pt;if(t===void 0){let s=e.insertBefore(Da(),r),n=e.insertBefore(Da(),r);t=new rd(s,n,o,o.options);}else {let s=t.we.nextSibling,n=t.f,a=n!==o;if(a){let l;t._u?.(o),t.f=o,t._i!==void 0&&(l=o.X)!==n.X&&t._i(l);}if(s!==r||a){let l=t.Pt;for(;l!==s;){let c=$a(l).nextSibling;$a(e).insertBefore(l,r),l=c;}}}return t},ue=(o,i,t=o)=>(o.Et(i,t),o),od={},Ai=(o,i=od)=>o.r=i,ki=o=>o.r,to=o=>{o.Ee(),o.Pt.remove();},Na=o=>{o.Ee();};var Mi=(o,i)=>{let t=o.wt;if(t===void 0)return false;for(let e of t)e.un?.(i,false),Mi(e,i);return true},eo=o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.wt,t.delete(o),o=i;}while(t?.size===0)},_a=o=>{for(let i;i=o.f;o=i){let t=i.wt;if(t===void 0)i.wt=t=new Set;else if(t.has(o))break;t.add(o),ad(i);}};function sd(o){this.wt!==void 0?(eo(this),this.f=o,_a(this)):this.f=o;}function nd(o,i=false,t=0){let e=this.r,r=this.wt;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Mi(e[s],false),eo(e[s]);else e!=null&&(Mi(e,false),eo(e));else Mi(this,o);}var ad=o=>{o.type==$t.CHILD&&(o._i??=nd,o._u??=sd);},io=class extends ht{constructor(){super(...arguments),this.wt=void 0;}ro(i,t,e){super.ro(i,t,e),_a(this),this.isConnected=i.X;}un(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Mi(this,i),eo(this));}setValue(i){if(Va(this.er))this.er.Et(i,this);else {let t=[...this.er.r];t[this.yu]=i,this.er.Et(t,this,0);}}disconnected(){}reconnected(){}};var I=()=>new xs,xs=class{},Ts=new WeakMap,O=at(class extends io{render(o){return P}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)),P}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=Ts.get(i);t===void 0&&(t=new WeakMap,Ts.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"?Ts.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 Ss=null,Ii=class extends T{constructor(){super(...arguments);this.dialogEl=I();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);};this.Bu=()=>{this.closeDialog();};this.zu=t=>{this.Ro=t.target;};this.Hu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Ro&&this.closeDialog();};this.ci=({id:t})=>{t===this.id?(Ss=t,this.show(),this.emit(A.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.ui=({id:t})=>{t===this.id&&(this.hide(),this.emit(A.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.sa=t=>{this.hide(),Ss===this.id&&this.emit(A.MODAL_CLOSE,{modalId:Ss,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}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(Y.OPEN,this.ci),this.modalManager?.subscribe(Y.CLOSE,this.ui),this.modalManager?.subscribe(Y.CLOSE_ALL,this.sa);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Ro=void 0,this.modalManager?.unsubscribe(Y.OPEN,this.ci),this.modalManager?.unsubscribe(Y.CLOSE,this.ui),this.modalManager?.unsubscribe(Y.CLOSE_ALL,this.sa);}Ku(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Bu),this.dialogEl.value?.addEventListener("mousedown",this.zu),this.dialogEl.value?.addEventListener("mouseup",this.Hu);}render(){return v`<dialog ${O(this.Ku)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],Ii.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ii.prototype,"blockBodyScrolling",2);var ro=class extends M{constructor(){super(...arguments);this.K=null;this.cr=null;}get na(){return this.nameAttrValue??this.ctxName}aa(){let t=document.createElement("input");return t.type="text",t.name=this.na,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Kr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.aa(),this.appendChild(this.K),this.sub("*collectionState",t=>{if(!t)return;if(!this.cr){let n=document.createElement("div");this.appendChild(n),this.cr=n;}if(!this.K){let n=this.aa();this.appendChild(n),this.K=n;}if(this.cr.innerHTML="",t.status==="uploading"||t.status==="idle"){this.K.value="",this.K.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.K.value="",this.K.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.K.value=e.cdnUrl??"",this.K.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.K.value=r[0],this.K.setCustomValidity("");return}this.K.remove(),this.K=null;let s=new DocumentFragment;for(let n of r){let a=document.createElement("input");a.type="hidden",a.name=`${this.na}[]`,a.value=n,s.appendChild(a);}this.cr.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],ro.prototype,"nameAttrValue",2);var As=class extends T{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Ye=class extends T{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.At=0;this.ur=I();this.la=()=>{let t=this.ur.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.At>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.At=this.Uo(this.value),this.$o(),this.ur.value?.addEventListener("animationiteration",this.la);}updated(t){if(super.updated(t),t.has("value")){let e=this.Uo(this.value);if(!this.visible)this.At=e;else {let r=Math.max(this.At,e);r!==this.At&&(this.At=r,this.$o());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.$o():this.At=this.Uo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.ur.value?.removeEventListener("animationiteration",this.la);}Uo(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}$o(){this.visible&&this.style.setProperty("--l-progress-value",this.At.toString());}render(){return v`<div ${O(this.ur)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],Ye.prototype,"hasFileName",2),p([y({type:Number})],Ye.prototype,"value",2),p([y({type:Boolean,reflect:true})],Ye.prototype,"visible",2);var Oi=class extends M{constructor(){super();this.kt=false;this.Re=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this.Do=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.kt=t;}),this.sub("*commonProgress",t=>{this.Re=t;});}updated(t){super.updated(t),t.has("visible")&&(this.kt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Do?.(),this.Do=void 0;}render(){return v`<uc-progress-bar .value=${this.Re} .visible=${this.kt}></uc-progress-bar>`}};p([f()],Oi.prototype,"kt",2),p([f()],Oi.prototype,"Re",2);var Xe=class extends T{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.ju=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")));};}render(){return v`<select @change=${this.ju} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],Xe.prototype,"value",2),p([y({type:Boolean,reflect:true})],Xe.prototype,"disabled",2),p([y({type:Array,attribute:false})],Xe.prototype,"options",2);var de=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Fo="default";this.dr="";}willUpdate(t){super.willUpdate(t),t.has("source")&&this.Gu(this.source);}Gu(t){if(!t){this.dr="",this.Fo="default";return}let{label:e,icon:r,id:s}=t;this.dr=e,this.Fo=r??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return v`<button aria-label=${this.l10n(this.dr)} type="button" @click=${this.activate}>${this.textOnly?"":v`<uc-icon name=${this.Fo}></uc-icon>`} ${this.iconOnly?"":v`<div class="uc-txt">${this.l10n(this.dr)}</div>`}</button>`}};p([y({attribute:false})],de.prototype,"source",2),p([y({type:Boolean})],de.prototype,"textOnly",2),p([y({type:Boolean})],de.prototype,"iconOnly",2),p([f()],de.prototype,"Fo",2),p([f()],de.prototype,"dr",2);var Qe=class{constructor(i,t){this.ca=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.ua=t.onSourcesChange,i.addController(this);}hostConnected(){this.No=this.i.sub(x("sourceList"),t=>{this.ca=Z(t),this.Vo();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.E=i.onPluginsChange(()=>this.Vo())),this.Vo();}hostDisconnected(){this.E?.(),this.E=void 0,this.No?.(),this.No=void 0;}Vo(){let t=this.e.pluginManager?.snapshot().sources??[],e=new Map(t.map(s=>[s.id,s])),r=[];this.ca.forEach(s=>{let n=this.qu(s,e);if(n.length!==1||n[0]!==s){for(let c of n){let d=e.get(c);d&&r.push(this.da(d));}return}let l=e.get(s);l&&r.push(this.da(l));}),this.ua(r);}qu(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}da(i){return {id:i.id,label:i.label,icon:i.icon,onClick:()=>i.onSelect()}}};var Li=class extends M{constructor(){super(...arguments);this.z=[];this.wrap=false;}initCallback(){super.initCallback(),new Qe(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.z=t;}});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return v`${this.z.map(t=>v`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};p([f()],Li.prototype,"z",2),p([y({type:Boolean,attribute:"wrap",noAccessor:true})],Li.prototype,"wrap",2);var ks=class extends T{render(){return v`<div class="uc-spinner"></div>`}};var Ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function ke(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:()=>{i.naturalWidth===0&&(i.src=Ot);}}}function Pi(o){let i=[];for(let s of o){let n=ke(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function Ms(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,a)=>{r.onload=()=>{let l=r.height/r.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),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(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},r.onerror=l=>{a(l);};});return r.src=URL.createObjectURL(o),s}var Je=class extends M{constructor(){super(...arguments);this.pr=new Set;this.entry=null;}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 a=r.subscribe(s,l=>{this.isConnected&&n(l);});this.pr.add(a);})(t,e);}reset(){for(let t of this.pr)t();this.pr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.pr=new Set;}};function ld(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}function oo(o="hsl(209, 21%, 65%)",i=32,t=32){return ld(`<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>`)}var cd=3e3,ti=class extends Je{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Kt="";this.pa=false;this.hr=null;this.ha=false;this.Wu=this.cfg.filesViewMode;this.fa=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.Zu(e);if(r&&s&&n){let d=await this.proxyUrl(W(ee(this.cfg.cdnCname,n),ot(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:u}=ke(d);u.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let m=await Ms(h,l);t.setValue("thumbUrl",m);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(m));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await Ms(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(u));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(d));}});this.fr=F(this.fa.bind(this),100);}Zu(t=false){t&&(this.hr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.hr?.height||0),10),parseInt(String(this?.hr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,cd)}Yu(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=Ot,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),r();},d=u=>{a(),s(u);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}Bo(){this._o?.cancel(),this._o=void 0;}Xu(t){if(this.Bo(),!t){this.Kt&&(this.Kt="");return}if(t===this.Kt)return;let e=new AbortController,r={controller:e,cancel:()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);}};this._o=r,this.Yu(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Kt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}mr(t=false){if(this.entry){if(t){this.fa(true);return}this.ha&&this.fr();}}firstUpdated(t){super.firstUpdated(t),this.ma();}updated(t){super.updated(t),t.has("uid")&&this.ma();}di(t){let[e]=t;e&&(this.ha=e.isIntersecting,e.isIntersecting&&(this.hr=e.boundingClientRect,this.mr(),this.s?.disconnect()),e.intersectionRatio===0&&this.fr.cancel());}reset(){super.reset(),this.fr.cancel(),this.Bo(),this.Kt&&(this.Kt="");}ma(){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=()=>{this.mr();};this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.Xu(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.mr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.pa&&(this.Wu==="list"&&this.mr(true),this.pa=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.fr.cancel(),this.Bo(),this.s?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Kt||Ot} role="img" alt="Preview of uploaded image" ?hidden=${!this.Kt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],ti.prototype,"badgeIcon",2),p([y({attribute:false})],ti.prototype,"uid",2),p([f()],ti.prototype,"Kt",2);var Is=class extends ${};var Os=class extends ${constructor(){super(...arguments);this.historyTracked=true;this.activityType=$.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var Ls=class extends M{constructor(){super(...arguments);this.ga=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=A;}initCallback(){super.initCallback(),this.ga=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ga?.();}};var pe=(o,i)=>{let t=false,e,r=0,s=((...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);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var Ba=(o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},Ri=at(class extends ht{constructor(o){if(super(o),o.type!==$t.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],n=0;for(let a of o)r[n]=e?e(a,n):n,s[n]=t(a,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=ki(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let a=this.ut??=[],l=[],c,d,u=0,h=r.length-1,m=0,g=s.length-1;for(;u<=h&&m<=g;)if(r[u]===null)u++;else if(r[h]===null)h--;else if(a[u]===n[m])l[m]=ue(r[u],s[m]),u++,m++;else if(a[h]===n[g])l[g]=ue(r[h],s[g]),h--,g--;else if(a[u]===n[g])l[g]=ue(r[u],s[g]),Xt(o,l[g+1],r[u]),u++,g--;else if(a[h]===n[m])l[m]=ue(r[h],s[m]),Xt(o,r[u],r[h]),h--,m++;else if(c===void 0&&(c=Ba(n,m,g),d=Ba(a,u,h)),c.has(a[u]))if(c.has(a[h])){let b=d.get(n[m]),w=b!==void 0?r[b]:null;if(w===null){let C=Xt(o,r[u]);ue(C,s[m]),l[m]=C;}else l[m]=ue(w,s[m]),Xt(o,r[u],w),r[b]=null;m++;}else to(r[h]),h--;else to(r[u]),u++;for(;m<=g;){let b=Xt(o,l[g+1]);ue(b,s[m]),l[m++]=b;}for(;u<=h;){let b=r[u++];b!==null&&to(b);}return this.ut=n,Ai(o,l),it}});var lt=at(class extends ht{constructor(o){if(super(o),o.type!==$t.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter(i=>o[i]).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return it}});var za="file-item-remove-button",Me=class extends M{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}pi(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=lt({"uc-remove-btn":true,"uc-mini-btn":true,"uc-idle":this.idle,"uc-uploading":this.uploading,"uc-failed":this.failed,"uc-success":this.success});return v`<button type="button" @click=${this.pi} title=${this.l10n(za)} aria-label=${this.l10n(za)} class=${t} ><uc-icon name="remove-file"></uc-icon><uc-icon name="close"></uc-icon></button>`}};p([y({type:Boolean})],Me.prototype,"uploading",2),p([y({type:Boolean})],Me.prototype,"failed",2),p([y({type:Boolean})],Me.prototype,"success",2),p([y({type:Boolean})],Me.prototype,"idle",2);var X=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")}),G=class G extends Je{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.va=true;this.uid="";this.zo="";this.Ho="";this.Ko="";this.At=0;this.ya=false;this.jo="";this.Go=false;this.qo=false;this.ba=false;this.wa=false;this.Wo=false;this.Ea="";this.gr=[];this.xa=false;this.pi=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Qu=()=>{this.Ta();};this.S=F(()=>this.Ca(),100);this.td=this.withEntry(pe((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===X.FINISHED,l=e===X.UPLOADING,c=e===X.QUEUED_UPLOADING,d=e===X.QUEUED_VALIDATION,u=e===X.VALIDATION,h=t.getValue("fileName"),m="";r?m="":!a&&n&&s&&Object.values(mt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${ma(s)}`)})),this.Ko=m,this.Ho=r,this.ya=l||c||d||u,this.At=d||u?0:t.getValue("uploadProgress"),this.Ea=h?this.l10n("a11y-file-item-status",{fileName:h,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Ta=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=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(m=>m.type==="beforeUpload");for(let m of h)try{let g=m.handler({file:a,signal:r.signal}),b=new Promise((C,E)=>setTimeout(()=>E(new Error("beforeUpload hook timed out")),m.timeout)),{file:w}=await Promise.race([g,b]);w!==a&&(a=w,t.setValue("mimeType",a.type||null),t.setValue("isImage",_e(a)),t.setValue("fileSize",a.size),a instanceof File&&t.setValue("fileName",a.name));}catch(g){console.warn(`File hook "beforeUpload" from plugin "${m.pluginId}" failed`,g);}}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:u=>{if(u.isComputable){let h=u.value*100;t.setValue("uploadProgress",h);}},signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,d),Yo(l,d)},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 re&&r.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof Ee?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");}}});}Ca(){let t=this.entry;if(!t)return;let e=X.IDLE;t.getValue("errors").length>0?e=X.FAILED:t.getValue("isQueuedForUploading")?e=X.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=X.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=X.VALIDATION:t.getValue("isUploading")?e=X.UPLOADING:t.getValue("fileInfo")&&(e=X.FINISHED),this.Ju(t,e);}Ju(t,e){e===X.FAILED?this.jo="badge-error":e===X.FINISHED&&(this.jo="badge-success"),e===X.UPLOADING&&(this.wa=false,this.removeAttribute("focused")),this.qo=e===X.FAILED,this.ba=e===X.UPLOADING,this.Go=e===X.FINISHED,this.td(e);}reset(){super.reset(),this.S.cancel();}di(t){let[e]=t;e&&e.isIntersecting&&!this.xa&&(this.va=false,this.xa=true);}Sa(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.ae();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.zo=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.zo=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.ae()),this.subEntry("isUploading",()=>this.ae()),this.subEntry("errors",()=>this.ae()),this.Ca(),this.ae();}Aa(t){if(this.cfg.filesViewMode==="list"){this.Wo=true;return}this.Wo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Sa(this.uid);}ae(){let t=this.e.pluginManager;if(!t||!this.uid){this.gr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.gr=[];return}this.gr=e.filter(s=>{try{return s.shouldRender(r)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}ed(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.Sa(this.uid),this.subConfigValue("filesViewMode",e=>{this.Aa(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.Aa(e);}),this.onclick=()=>{G.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.Ta());});let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.ae())),this.ae(),G.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback(),this.s?.disconnect(),G.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.va?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.Go} ?data-uploading=${this.ba} ?data-failed=${this.qo} ?data-focused=${this.wa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.jo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.Ea}><span class="uc-file-name" ?hidden=${!this.Wo}>${this.zo}</span><span class="uc-file-error" ?hidden=${!this.Ho}>${this.Ho}</span><span class="uc-file-hint" ?hidden=${!this.Ko}>${this.Ko}</span></div><div class="uc-file-actions">${this.gr.map(t=>v`<button type="button" @click=${()=>this.ed(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>`)}<uc-file-action-button @uc:remove=${this.pi} .uploading=${this.ya} .failed=${this.qo} .success=${this.Go}></uc-file-action-button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Qu}><uc-icon name="upload"></uc-icon></button></div></div>`}};p([f()],G.prototype,"va",2),p([y({attribute:false})],G.prototype,"uid",2),p([f()],G.prototype,"zo",2),p([f()],G.prototype,"Ho",2),p([f()],G.prototype,"Ko",2),p([f()],G.prototype,"At",2),p([f()],G.prototype,"ya",2),p([f()],G.prototype,"jo",2),p([f()],G.prototype,"Go",2),p([f()],G.prototype,"qo",2),p([f()],G.prototype,"ba",2),p([f()],G.prototype,"wa",2),p([f()],G.prototype,"Wo",2),p([f()],G.prototype,"Ea",2),p([f()],G.prototype,"gr",2);var Ps=G;function ud(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}function dd(o,i){return new Promise(t=>{let e=0,r=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});r.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(r);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(r);});};s(o);})}function Ha(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 l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(dd(l,s).then(c=>{c&&i.push(...c);}));continue}let a=r.getAsFile();a&&t.push(ud(a).then(l=>{l||i.push({type:"file",file:a});}));}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)}var ct=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Ka=["focus"],pd=100,Rs=new Map;function hd(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))}function Us(o){let i=0,t=document.body,e=new Set,r=g=>{e.add(g);},s=ct.INACTIVE,n=g=>{o.shouldIgnore()&&g!==ct.INACTIVE||(s!==g&&e.forEach(b=>{b(g);}),s=g);},a=()=>i>0;r(g=>o.onChange(g));let l=()=>{i=0,n(ct.INACTIVE);},c=()=>{i+=1,s===ct.INACTIVE&&n(ct.ACTIVE);},d=()=>{i-=1,a()||n(ct.INACTIVE);},u=g=>{g.preventDefault(),i=0,n(ct.INACTIVE);},h=g=>{if(o.shouldIgnore())return;a()||(i+=1);let b=[g.x,g.y],w=o.element.getBoundingClientRect(),C=Math.floor(hd(b,w)),E=C<pd,S=g.composedPath().includes(o.element);Rs.set(o.element,C);let Ct=Math.min(...Rs.values())===C;S&&Ct?(g.preventDefault(),n(ct.OVER)):n(E&&Ct?ct.NEAR:ct.ACTIVE);},m=async g=>{if(o.shouldIgnore())return;g.preventDefault();let{dataTransfer:b}=g;if(!b)return;let w=await Ha(b);o.onItems(w),n(ct.INACTIVE);};return t.addEventListener("drop",u),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),o.element.addEventListener("drop",m),Ka.forEach(g=>{window.addEventListener(g,l);}),()=>{Rs.delete(o.element),t.removeEventListener("drop",u),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),o.element.removeEventListener("drop",m),Ka.forEach(g=>{window.removeEventListener(g,l);});}}var $s=new Set,bt=class extends M{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.Bt=true;this.ka=true;this.Zo="drop-files-here";this.Ue=false;this.Oa=null;this.Yo=null;this.Ia=I();this.$e=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.Pa=true;this.De=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Ma(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Zo=t;return}this.Zo=this.Ue?"drop-files-here":"drop-file-here";}isActive(){if(!this.Bt)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(),$s.add(this),this.Xo(),this.Qo(),this.La(),this.Ra(ct.INACTIVE),this.Oa=Us({element:this,shouldIgnore:()=>this.Ua(),onChange:t=>{this.Ra(t);},onItems:t=>{if(!t.length)return;let e=this.uploadCollection.size;t.forEach(r=>{r.type==="url"?this.api.addFileFromUrl(r.url,{source:U.DROP_AREA}):r.type==="file"&&this.api.addFileFromObject(r.file,{source:U.DROP_AREA,fullPath:r.fullPath});}),this.uploadCollection.size>e&&this.routerLayer.navigateAfterFileAdd();}}),this.updateComplete.then(()=>this.rd()),this.subConfigValue("sourceList",t=>{let e=Z(t);this.Pa=e.includes(U.LOCAL),this.Xo(),this.Qo();}),this.subConfigValue("multiple",t=>{this.Ue=!!t,this.Ma();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Xo(),this.Qo()),(t.has("text")||t.has("localeId"))&&this.Ma();}updated(t){super.updated(t),t.has("clickable")&&this.La();}Ua(){if(!this.Bt||!this.od())return true;if(!this.fullscreen)return false;let t=$s;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}od(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Xo(){let t=this.Pa&&!this.disabled;this.Bt=t;}Qo(){let t=this.Bt||!this.querySelector("[data-default-slot]");this.ka=t,this.hidden=!t;}Ra(t){let e=Object.entries(ct).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}rd(){if(this.Yo)return;let t=this.Ia.value;t&&(this.Yo=Us({element:t,onChange:e=>{let r=Object.entries(ct).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},onItems:()=>{},shouldIgnore:()=>this.Ua()}));}La(){this.clickable&&!this.De?(this.addEventListener("keydown",this.$e),this.addEventListener("click",this.$e),this.De=true):!this.clickable&&this.De&&(this.removeEventListener("keydown",this.$e),this.removeEventListener("click",this.$e),this.De=false);}disconnectedCallback(){super.disconnectedCallback(),$s.delete(this),this.Oa?.(),this.Yo?.(),this.De&&(this.removeEventListener("keydown",this.$e),this.removeEventListener("click",this.$e),this.De=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${O(this.Ia)} class="uc-content-wrapper" ?hidden=${!this.ka} ><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.l10n(this.Zo)}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],bt.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],bt.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],bt.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],bt.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],bt.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],bt.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],bt.prototype,"initflow",2),p([y({type:String})],bt.prototype,"text",2),p([f()],bt.prototype,"Bt",2),p([f()],bt.prototype,"ka",2);var Lt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=$.activities.UPLOAD_LIST;this.$a=false;this.Da=false;this.Fa=false;this.Jo=false;this.ts=false;this.vr=null;this.Na=false;this.es=null;this.Va=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.rs=()=>{this.emit(A.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.os=()=>{this.emit(A.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ut=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.q=pe(()=>{this.isConnected&&(this.ad(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get sd(){return this.es?this.nd(this.es):""}ad(){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),a=t.allEntries.some(m=>m.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,u=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&l&&this.cfg.confirmUpload)c=true;else {d=true;let m=this.cfg.groupOutput?!!t.group:true;u=e.total===e.succeed&&r&&l&&m;}this.$a=d,this.Da=u,this.Fa=c,this.ts=e.total===0||!s&&!n,this.Jo=!n||this.cfg.multiple,this.Na=e.total>0,this.es=e;}nd(t){let e=r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})};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.q),this.subConfigValue("multipleMin",this.q),this.subConfigValue("multipleMax",this.q),this.sub("*groupInfo",t=>{t&&this.q();}),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.q),this.uploadCollection.observeCollection(this.q),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.vr=null;return}this.vr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.q),this.uploadCollection.unobserveCollection(this.q));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.sd}</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.Na}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Ri(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Va} ?disabled=${!this.ts} ?hidden=${!this.Jo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.vr} >${this.vr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.Jo} ?disabled=${!this.ts} @click=${this.Va} ><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.Fa} @click=${this.rs} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.$a} ?disabled=${!this.Da} @click=${this.os} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([f()],Lt.prototype,"$a",2),p([f()],Lt.prototype,"Da",2),p([f()],Lt.prototype,"Fa",2),p([f()],Lt.prototype,"Jo",2),p([f()],Lt.prototype,"ts",2),p([f()],Lt.prototype,"vr",2),p([f()],Lt.prototype,"Na",2),p([f()],Lt.prototype,"es",2);var md=[{test:o=>!!o.accept&&!!o.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:o=>o.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:o=>o.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],ja=F(o=>{for(let{test:i,message:t}of md)i(o)&&Gr(t);},0);var Ga=(o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},fd="0123456789abcdefghijklmnopqrstuvwxyz",qa=o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=fd[Number(t)]+i,o=o/36n;}return i},Ds=(o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var gd=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}`)},vd=10,yd=async o=>{let i=await gd(o);return qa(i).slice(0,vd)},Wa=async(o,i)=>{let t=await yd(o);return Ga(t,i)};var Za=o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function");var Fs=o=>o,bd=[Fs({key:"cameraModes",deps:["enableVideoRecording"],fn:({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)}}),Fs({key:"cameraModes",deps:["defaultCameraMode"],fn:({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)}}),Fs({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===vi||Ds(r,s))?Wa(e,s):r}})],Ya=({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of bd){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let l of r.deps)s[l]=()=>t(l);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let a;try{a=r.fn(s,{signal:n.signal});}catch(l){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,l);return}Za(a)?a.then(l=>{n.signal.aborted||i(r.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,l);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,a);}};var V=o=>String(o),tt=o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},_=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}"`)},Xa=o=>o==="auto"?o:_(o),Qa=o=>{let i=V(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Ja=o=>{let i=V(o);if(!Object.values(L).includes(i))throw new Error(`Invalid value: "${i}"`);return i},tl=o=>{let i=V(o),t=j(i);if(t.some(e=>!Object.values(L).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},el=o=>{let i=V(o);if(i==="local"||i==="global")return i;if(_(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},il=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.")},Vs=o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},so=o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},no=o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},rl=o=>{let i=V(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},ol=o=>{let i=V(o);if(["auto","menu","toolbar","compact"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var wd={pubkey:V,multiple:_,multipleMin:tt,multipleMax:tt,confirmUpload:_,imgOnly:_,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:Xa,cameraMirror:_,cameraCapture:Qa,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:tt,thumbSize:tt,showEmptyList:_,useLocalImageEditor:_,useCloudImageEditor:_,cloudImageEditorTabs:V,removeCopyright:_,cropPreset:V,imageShrink:V,modalScrollLock:_,modalBackdropStrokes:_,sourceListWrap:_,remoteTabSessionKey:V,cdnCname:V,cdnCnamePrefixed:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:tt,retryNetworkErrorMaxTimes:tt,multipartMinFileSize:tt,multipartChunkSize:tt,maxConcurrentRequests:tt,multipartMaxConcurrentRequests:tt,multipartMaxAttempts:tt,checkForUrlDuplicates:_,saveUrlForRecurrentUploads:_,groupOutput:_,userAgentIntegration:V,debug:_,localeName:V,metadata:il,secureUploadsExpireThreshold:tt,localeDefinitionOverride:o=>Vs(o),secureUploadsSignatureResolver:o=>so(o),secureDeliveryProxyUrlResolver:o=>so(o),iconHrefResolver:o=>so(o),plugins:o=>no(o),fileValidators:no,collectionValidators:no,validationTimeout:tt,validationConcurrency:tt,cameraModes:tl,defaultCameraMode:Ja,enableAudioRecording:_,enableVideoRecording:_,mediaRecorderOptions:Vs,maxVideoRecordingDuration:tt,filesViewMode:rl,gridShowFileNames:_,cloudImageEditorAutoOpen:_,cloudImageEditorMaskHref:V,testMode:_,qualityInsights:_,pasteScope:el,smartButtonShowFirstIcon:_,smartButtonViewMode:ol},sl=(o,i)=>{if(!(typeof i>"u"||i===null))try{return wd[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),J[o]}};var ao=[...new Set(["debug",...Object.keys(J)])],Ed=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],al=o=>Ed.includes(o),_s=ao.filter(o=>!al(o)),Ns={...Object.fromEntries(_s.map(o=>[yr(o),o])),...Object.fromEntries(_s.map(o=>[o.toLowerCase(),o]))},nl=o=>`__${o}`,ei=class extends T{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(J).map(([t,e])=>[x(t),e]))};this.ld=new Map;this.fi={};this._a=new Set;this.Fe=new Map;}ss(t){return this._a.has(t)}ns(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}as(t){return [...new Set([yr(t),t.toLowerCase()])]}cd(t,e){if(al(t)||this.ss(t)&&this.ns(t)?.attribute===false)return;let r=this.as(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}ud(t,e){let r=x(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=J[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}jt(t,e){let r;if(this.ss(t)){let a=this.ns(t);try{r=a?.normalize?.(e)??e;}catch(l){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,l);return}}else r=sl(t,e);let s=this,n=nl(t);s[n]!==r&&(this.dd(t,s[n],r),s[n]=r,this.cd(t,r),this.ud(t,r),this.debugPrint(`"${t}"`,r),this.ss(t)||ja(this.cfg));}br(t){let e=this,r=nl(t);return e[r]??this.$[x(t)]}dd(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));}Ba(t){let e=t.configRegistry.getAll();this.fi={},this._a=new Set(e.keys());for(let[r,s]of this.Fe)e.has(r)||(s(),this.Fe.delete(r));for(let[r,s]of e){let a=x(r);if(s.attribute){let m=this.as(r);for(let g of m)this.fi[g]=r;}let l,c=false,d=Object.getOwnPropertyDescriptor(this,r);if(d&&!d.get&&!d.set&&d.value!==void 0&&(l=d.value,c=true),!c&&s.attribute)for(let m of this.as(r)){let g=this.getAttribute(m);if(g!=null){try{l=s.fromAttribute?s.fromAttribute(g):g;}catch(b){console.warn(`[uc-config] fromAttribute() for "${r}" threw an error, using raw attribute value`,b),l=g;}c=true;break}}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let h=Object.getOwnPropertyDescriptor(this,r);if((!h||!h.set||!h.get)&&Object.defineProperty(this,r,{set:m=>{this.jt(r,m);},get:()=>this.br(r),enumerable:true,configurable:true}),!this.Fe.has(r)){let m=this.sub(a,g=>{this.jt(r,g);},false);this.Fe.set(r,m);}c&&this.jt(r,l);}}pd(){this.e.when("pluginManager",t=>{this.Ba(t),this.yr=t.onPluginsChange(()=>{this.Ba(t);});});}hd(){this.hi=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 Ns)continue;if(r in this.fi){let l=this.fi[r],c=this.ns(l);this.attributeChangedCallback(r,s??"",n??c?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.pd(),this.hd();for(let r of _s)this.sub(x(r),s=>{this.jt(r,s);},false);for(let r of ao){let s=t[r]??this.$[x(r)];s!==J[r]&&this.jt(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this.jt(r,a);},get:()=>this.br(r)});}let e=r=>{Ya({key:r,setValue:this.jt.bind(this),getValue:this.br.bind(this),computationControllers:this.ld});};for(let r of ao)this.sub(x(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ns[t];n?s[n]=r:this.e.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==r)return;let c=this.fi[t],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(r):r;if(this.br(c)===u)return;this.jt(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.yr&&(this.yr(),this.yr=void 0),this.hi&&(this.hi.disconnect(),this.hi=void 0);for(let t of this.Fe.values())t();this.Fe.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(Ns);return [...t,...e]}};for(let o of ao)ei.prototype[o]=void 0;var Ui=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.mi="upload-file";this.ls=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.mi=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.ls}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.mi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Ui.prototype,"dropzone",2),p([f()],Ui.prototype,"mi",2);var ll=o=>Fa(o)?o.Nt.h:o.strings,ii=at(class extends ht{constructor(o){super(o),this.et=new WeakMap;}render(o){return [o]}update(o,[i]){let t=Cs(this.it)?ll(this.it):null,e=Cs(i)?ll(i):null;if(t!==null&&(e===null||t!==e)){let r=ki(o).pop(),s=this.et.get(t);if(s===void 0){let n=document.createDocumentFragment();s=ar(P,n),s.setConnected(false),this.et.set(t,s);}Ai(s,[r]),Xt(s,void 0,r);}if(e!==null){if(t===null||t!==e){let r=this.et.get(e);if(r!==void 0){let s=ki(r).pop();Na(o),Xt(o,void 0,s),Ai(o,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var Ie=class Ie extends M{constructor(){super(...arguments);this.showIcon=false;this.Ue=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-primary-action"];}static{this.SOURCE_TEXT_CONFIG={[U.LOCAL]:{action:"upload-from"},[U.URL]:{action:"upload-from"},[U.CAMERA]:{action:"capture-with"},[U.MOBILE_PHOTO_CAMERA]:{action:"take"},[U.MOBILE_VIDEO_CAMERA]:{action:"record"}};}initCallback(){super.initCallback(),this.subConfigValue("smartButtonShowFirstIcon",t=>{this.showIcon=t;}),this.subConfigValue("multiple",t=>{this.Ue=t;});}get hasEntries(){return (this.entries?.allEntries?.length??0)>0}get hasSingleSuccessImage(){return this.entries?.allEntries?.length===1&&this.entries.isSuccess&&(this.entries.allEntries[0]?.isImage??false)}get hasMultipleEntries(){return (this.entries?.allEntries?.length??0)>=1}get localizedSourceLabel(){return this.source?.label?["local","url","camera"].includes(this.source?.id)?this.l10n(this.source.label).toLowerCase():this.l10n(this.source.label):""}gi(t,e){return this.l10n(t,e)}get textBasedOnLocale(){let t=this.fd();return t||this.md()}fd(){if(this.entries?.status==="uploading")return this.gi("header-uploading",{count:this.entries.uploadingCount});if(this.entries?.status==="failed")return this.gi("header-failed",{count:this.entries.failedCount});if(this.entries?.status==="success")return this.gi("header-succeed",{count:this.entries.successCount});if(this.entries?.totalCount>0)return this.gi("header-total",{count:this.entries?.totalCount??0})}md(){if(!this.source?.id)return "";let e=Ie.SOURCE_TEXT_CONFIG[this.source.id]?.action??"get-from",r;return this.source.id===U.MOBILE_PHOTO_CAMERA?r=this.l10n("photo").toLowerCase():this.source.id===U.MOBILE_VIDEO_CAMERA?r=this.l10n("video").toLowerCase():r=this.localizedSourceLabel,this.gi(e,{source:r})}ls(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}this.source?.onClick();}gd(){if(!this.Ue&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?v`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.Ue&&this.hasMultipleEntries)return null;let t=this.source?.icon;return this.showIcon&&t?v`<uc-icon .name=${t}></uc-icon>`:null}render(){return v`<button @click=${this.ls} aria-label=${this.textBasedOnLocale}>${this.gd()}<span>${this.textBasedOnLocale}</span></button>`}};p([y({type:Object})],Ie.prototype,"source",2),p([y({type:Object})],Ie.prototype,"entries",2),p([f()],Ie.prototype,"showIcon",2),p([f()],Ie.prototype,"Ue",2);var Bs=Ie;var lo=class extends T{constructor(){super(...arguments);this.za=rt.generateFastUid();this.vd=t=>{t.currentTarget.hidePopover();};}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return v`<button class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.za} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.za} class="uc-dropdown-content" popover="auto" @click=${this.vd}>${this.yield("dd-content")}</div>`}};p([f()],lo.prototype,"za",2);var zs=class extends M{static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-smart-btn"];}};var Cd=(o,i)=>i==="compact"||o.length===0?{main:null,remain:o}:{main:o[0]??null,remain:o.slice(1)},Td={compact:"paperclip",menu:"arrow-dropdown",auto:"arrow-dropdown"},xd=3,Vt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.le="auto";this.z=[];this.Ne="idle";this.Ka=0;this.q=pe(()=>{this.isConnected&&this.yd();},300);}static{this.styleAttrs=[...super.styleAttrs,"uc-smart-btn","uc-wgt-common"];}get isIdle(){return this.Ne==="idle"}get isSuccess(){return this.Ne==="success"}get isFailed(){return this.Ne==="failed"}get isUploading(){return this.Ne==="uploading"}get isCollapsedMode(){return this.le==="compact"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.z.length>1&&(this.le==="toolbar"||this.le==="auto"&&this.z.length<=xd)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.hasCollectionEntries&&(this.z.length>1||this.isCollapsedMode)}get hasCollectionEntries(){return (this.Er?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}yd(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.Er=t,this.Ne=t.status;}ja(){this.wr=Cd(this.z,this.le);}initCallback(){super.initCallback(),this.subConfigValue("smartButtonViewMode",t=>{this.le!==t&&(this.le=t,this.ja());}),this.sub("*commonProgress",t=>{this.Ka=t;}),new Qe(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.z=t,this.ja();}}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.Ha=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(t>0)return false;let e=this.e.ctx.read("*currentActivity");return e?this.modalManager?.close(e):this.modalManager?.closeAll(),this.e.ctx.pub("*currentActivity",null),true});}disconnectedCallback(){typeof this.q.cancel=="function"&&this.q.cancel(),this.Ha?.(),super.disconnectedCallback();}bd(){return v`<uc-no-wrap-mode-smart-btn>${this.wr?.remain?.map(t=>v`<uc-source-btn .iconOnly=${ true} role="menuitem" .source=${t} ></uc-source-btn>`)}</uc-no-wrap-mode-smart-btn>`}wd(){return Td[this.le]??"arrow-dropdown"}Ed(){this.uploadCollection.clearAll();}xd(){this.Er.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Td(){this.uploadCollection.abortAll();}pi(){switch(this.Ne){case "failed":this.xd();break;case "uploading":this.Td();break;default:this.Ed();}}Cd(){return v`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.wd()} ></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.wr?.remain?.map(t=>v`<uc-source-btn role="menuitem" .source=${t} ></uc-source-btn>`)}</div></uc-drop-down>`}Sd(){return v`<uc-primary-action .entries=${this.Er} .source=${this.wr?.main} ></uc-primary-action>`}Ad(){return v`<uc-file-action-button @uc:remove=${this.pi} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.Ka} ></uc-file-action-button>`}kd(){return lt({"uc-smart-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Md(){return v`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.kd()}>${ii(this.shouldShowPrimaryAction?this.Sd():null)} ${ii(this.shouldShowInline?this.bd():null)} ${ii(this.shouldShowDropdown?this.Cd():null)} ${ii(this.shouldShowAbortAction||this.hasCollectionEntries?this.Ad():null)} ${ii(this.Md())}</div></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Vt.prototype,"dropzone",2),p([f()],Vt.prototype,"le",2),p([f()],Vt.prototype,"z",2),p([f()],Vt.prototype,"Ne",2),p([f()],Vt.prototype,"wr",2),p([f()],Vt.prototype,"Er",2),p([f()],Vt.prototype,"Ka",2);var $i=class extends ${constructor(){super(...arguments);this.us=I();}initCallback(){this.activityType=this.registration?.id??null,this.Ga(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Ga(),this.isActivityActive&&(this.xr(),this.qa()));}Ga(){this.registration&&(this.Gn()||this.registerActivity(this.activityType??"",{onActivate:()=>this.qa(),onDeactivate:()=>this.xr()}));}async qa(){await this.updateComplete;let t=this.us.value;if(!t||!this.registration)return;this.xr();let e=this.$["*currentActivityParams"];try{this.cs=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}xr(){let t=this.us.value;if(t){try{this.cs?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.cs=void 0,t.replaceChildren();}}disconnectedCallback(){this.xr(),super.disconnectedCallback();}render(){return v`<div style="display: contents;" ${O(this.us)}></div>`}};p([y({attribute:false})],$i.prototype,"registration",2);var ri=class extends T{constructor(){super(...arguments);this.mode="modal";this.Tt=[];}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Wa())),this.Wa();}Wa(){let t=this.e.pluginManager;if(!t){this.Tt=[];return}this.Tt=t.snapshot().activities;}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?v`${Ri(this.Tt,t=>t.id,t=>v`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:v`${Ri(this.Tt,t=>t.id,t=>v`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};p([y({type:String})],ri.prototype,"mode",2),p([f()],ri.prototype,"Tt",2);function Di(o,i,t){return o?i(o):t?.(o)}function cl(...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},{})}function wt(...o){let i=cl(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function ul(o,...i){let t=cl(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}var Sd=o=>st.includes(o),dl=o=>{if(!o)return st;let i=j(o).filter(Sd);return i.length===0?st:i};function pl(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":z.CROP,"*on.retryNetwork":()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ot,t.src=e;}o.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=ot(ie(i),"preview"),r=W(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.cancel":()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var hl="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></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 Oe={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},oi=class extends T{constructor(){super(...arguments);this.kt=false;this.Za=Oe;this.Ya=Oe.visible;this.Xa=Oe.hidden;this.ds=false;this.Qa=false;}set visible(t){this.kt=t,this.Ja();}get visible(){return this.kt}set styles(t){this.Za=t,this.ds=true,this.Ya=t.visible??Oe.visible,this.Xa=t.hidden??Oe.hidden;}get styles(){return this.Za}Ja(){this.style.visibility=this.kt?"inherit":"hidden",ul(this,{[Oe.transition]:!this.ds,[this.Ya]:this.kt,[this.Xa]:!this.kt}),this.toggleAttribute("inert",!this.kt);}Od(){this.Qa||(this.Qa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.ds||this.classList.add(Oe.transition),this.Ja(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Od();},0);}};p([y({type:Boolean})],oi.prototype,"visible",1),p([y({attribute:false})],oi.prototype,"styles",1);var Fi=class extends T{constructor(){super(...arguments);this.active=false;this.ce=I();this.ps=false;this.hs=()=>{let t=this.ce.value;t&&(this.tl(t),this.ps&&this.active&&this.fs());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.fs();}updated(t){super.updated(t),t.has("active")&&(this.active?this.fs():this.Id());}fs(){let t=this.ce.value;if(!t)return;this.ps=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.hs),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.hs,{once:true});}Id(){let t=this.ce.value;t&&(this.ps=false,t.removeEventListener("transitionend",this.hs),this.tl(t));}tl(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${O(this.ce)}></div></div>`}};p([y({type:Boolean,reflect:true})],Fi.prototype,"active",2);var q=o=>o??P;var At=class extends T{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.il(),this.rl();}updated(t){super.updated(t),t.has("reverse")&&this.il(),t.has("theme")&&this.rl();}il(){this.style.flexDirection=this.reverse?"row-reverse":"";}rl(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Pd(){let t=this.ms;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Ld}}get ms(){return !this.icon}get Ld(){return !this.text&&!this.ms}render(){return v`<button type="button" role=${q(this.ariaRole||void 0)} aria-controls=${q(this.ariaControls||void 0)} aria-label=${q(this.l10n(this.titleProp))} title=${q(this.l10n(this.titleProp))} ><uc-icon class=${lt(this.Pd)} name=${q(this.icon||void 0)} ?hidden=${this.ms} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],At.prototype,"text",2),p([y({type:String})],At.prototype,"icon",2),p([y({type:Boolean,reflect:true})],At.prototype,"reverse",2),p([y({type:String,reflect:true})],At.prototype,"theme",2),p([y({attribute:"aria-role"})],At.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],At.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],At.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],At.prototype,"active",2);function ml(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}function si(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return W(o,ot(fr,ie(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Rt}/${Ut}/uc-cloud-image-editor/`))}var Vi=class extends T{constructor(){super(...arguments);this.ol=`uc-backdrop-mask-${rt.generateFastUid()}`;this.Cr=false;this.wi=false;this.al=I();this.Ei=false;this.xi=null;this.cl=t=>{this.ul(),this.Ti&&(t.stopPropagation(),t.preventDefault(),this.Ti=false);};this.dl=t=>{if(!this.Ti||!this.Tr||!this.vs)return;t.stopPropagation(),t.preventDefault();let e=this.Gt;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,a=t.y-s,l=n-this.Tr[0],c=a-this.Tr[1],{direction:d}=this.vs,u=this.Bd(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.pl=t=>{if(!this.$t)return;let e=Object.values(this.$t).find(r=>{if(!r||this.bs(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return Sa(a,[t.x,t.y])});this.sl=e,this.ul();};}get Gt(){return this.al.value??null}get Ti(){return this.wi}set Ti(t){this.wi!==t&&(this.wi=t,this.ys());}ys(){this.yi&&this.yi.setAttribute("class",wt({"uc-guides--hidden":this.Cr,"uc-guides--visible":!this.Cr&&this.wi,"uc-guides--semi-hidden":!this.Cr&&!this.wi}));}bs(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=k&&e.width<=k)return true;let r=e.height<=k&&(t.includes("n")||t.includes("s")),s=e.width<=k&&(t.includes("e")||t.includes("w"));return r||s}Rd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,a=this.Gt;if(!a)return;let l=yt("mask",{id:this.ol}),c=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=yt("rect",{x:e,y:r,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.ol})`});a.appendChild(u),a.appendChild(l),this.vi=l,this.gs=d;}Ud(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}$d(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.gs&&ae(this.gs,{x:e,y:r,width:s,height:n});}Dd(){let t=this.$["*cropBox"];if(!(!t||!this.yi||!this.$t)){for(let e of Object.values(this.$t)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:a}=e,l=r==="",c=r.length===2,{x:d,y:u,width:h,height:m}=t;if(l)ae(n,{x:d,y:u,width:h,height:m});else {let b=le(Math.min(h,m)/82/2,0,1),w=c?wa(t,r,b):Ea(t,r,b),C=w.center;if(!C)continue;let E=Math.max(fs*le(Math.min(h,m)/fs/3,0,1),ba);ae(n,{x:C[0]-E,y:C[1]-E,width:E*2,height:E*2}),ae(s,{d:w.d});}let g=this.bs(r);a.setAttribute("class",wt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}ae(this.yi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}ll(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.Fd.bind(this,e));}Nd(){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.ll(t,s);}return this.ll(t,""),t}Vd(){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:`${xi*r}%`,y1:"0%",x2:`${xi*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:`${xi*r}%`,x2:"100%",y2:`${xi*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}_d(){let t=this.Gt;if(!t)return;let e=document.createDocumentFragment(),r=this.Vd();e.appendChild(r);let s=this.Nd();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.$t=s,this.yi=r,this.ys();}Fd(t,e){if(!this.$t)return;let r=this.$t[t];if(!r||this.bs(t))return;let s=this.$["*cropBox"],n=this.Gt;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.Ti=true,this.vs=r,this.Tr=[c,d],this.nl={...s};}Bd(t,e){let[r,s]=e,n=this.$["*imageBox"],a=this.nl??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Ta({rect:a,delta:[r,s],imageBox:n}):a=xa({rect:a,delta:[r,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return je(qe(a),n)}ul(){let t=this.sl,e=this.Gt;e&&(e.style.cursor=t?Ca(t.direction):"initial");}hl(t){if(this.bi){this.bi.setAttribute("href",t);return}let e=this.Gt;if(!e){this.xi=t;return}this.xi=null;let r=document.createDocumentFragment(),s=yt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.bi=s;}zd(){let t=this.$["*cropBox"];if(!t||!this.bi)return;let{x:e,y:r,width:s,height:n}=t;ae(this.bi,{x:e,y:r,height:n,width:s});}Es(){this.Ei&&(this.$d(),this.Dd(),this.zd());}toggleThumbs(t){if(this.$t)for(let e of Object.values(this.$t)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",wt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Ud(),this.Ei&&window.requestAnimationFrame(()=>{this.Es();});}),this.sub("*cropBox",t=>{t&&(this.Cr=t.height<=k||t.width<=k,this.ys(),this.Ei&&window.requestAnimationFrame(()=>{this.Es();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.hl(t);}),document.addEventListener("pointermove",this.dl,true),document.addEventListener("pointerup",this.cl,true);}firstUpdated(t){super.firstUpdated(t),this.Hd();}Hd(){let t=this.Gt;if(!(!t||this.Ei)){if(this.Rd(),this._d(),this.Ei=true,t.addEventListener("pointermove",this.pl,true),this.xi){let e=this.xi;this.xi=null,this.hl(e);}this.Es();}}disconnectedCallback(){super.disconnectedCallback(),this.Gt?.removeEventListener("pointermove",this.pl,true),document.removeEventListener("pointermove",this.dl,true),document.removeEventListener("pointerup",this.cl,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${O(this.al)}></svg>`}};p([f()],Vi.prototype,"wi",2);function kd(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}var Ni=class extends T{constructor(){super();this.ctxOwner=true;this.ue={width:0,height:0};this.i=null;this._=false;this.vt=null;this.ml=I();this.Ts=I();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.fl=F(this.gl.bind(this),300),this.xs=pe(()=>{!this.isConnected||!this._||(this.Cs(),this.vl(),this.yl(),this.Ss(),this.As());},100);}firstUpdated(t){super.firstUpdated(t),this.Cs();}vl(){let t=this.$["*editorTransformations"],e=ml(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}Cs(){let t=this.ml.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.Mt=t,this.i=e;}yl(){if(!this._||!this.vt)return;let t=this.vt,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=Ge({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,m=0+e,g=e+(n.height-e*2)/2-h/2;l={x:m,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,m=e+(n.width-e*2)/2-h/2,g=0+e;l={x:m,y:g,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=qe(l);}Ss(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,m],coords:[g,b]}=n,{width:w}=Ge(this.ue,s),C=a/w;t=je(qe({x:l+g*C,y:c+b*C,width:h*C,height:m*C}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!Aa(t,e)||u&&!ka(t,u)){let h=e.width/e.height,m=e.width,g=e.height;u&&(h>u?m=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-g/2,width:m,height:g};}this.$["*cropBox"]=je(qe(t),e);}Kd(){let t=this.i;if(!t)return;let e=this.vt;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=Ge({width:r.width,height:r.height},l);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}As(){if(!this._||!this.vt||!this.Mt||!this.i)return;let t=this.Mt;this.i.clearRect(0,0,t.width,t.height),this.Kd();}jd({fromViewer:t}){this.vt&&(this.Ts.value?.toggleThumbs(true),this.Gd(),setTimeout(()=>{this.className=wt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}bl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a}=e,{width:l,height:c}=Ge(this.ue,s),{width:d,height:u}=t,h=n/l,m=a/c;return [le(Math.round(d/h),1,l),le(Math.round(u/m),1,c)]}qd(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=Ge(this.ue,s),{x:h,y:m}=t,g=n/d,b=a/u,w=this.bl(),C={dimensions:w,coords:[le(Math.round((h-l)/g),0,d-w[0]),le(Math.round((m-c)/b),0,u-w[1])]};if(!kd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(w[0]===d&&w[1]===u))return C}gl(){if(!this.isConnected||!this.ue)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.qd(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.yl(),this.Ss(),this.As());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.Cs(),this.ue=t,this.removeEventListener("transitionend",this.wl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.vt=await this.Wd(r,s),this.vl(),this.xs(),this.jd({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.vt&&this.xs();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.gl(),this._=false,this.Zd(),this.className=wt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Ts.value?.toggleThumbs(false),this.addEventListener("transitionend",this.wl,{once:true}),this.s?.disconnect());}Zd(){let t=this.bl(),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),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}Gd(){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`;}wl(){this._||(this.vt=null);}async Wd(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(si(t,r,e)),{promise:n,cancel:a,image:l}=ke(s),c=this.Ve(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.b?.(),this.b=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}Ve(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.As();}),this.sub("*cropBox",()=>{this.vt&&this.fl();}),this.sub("*currentAspectRatio",()=>{this.Ss();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.ue&&this.activate(this.ue,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.vt&&(this.vt=null);}render(){return v`<canvas class="uc-canvas" ${O(this.ml)}></canvas><uc-crop-frame ${O(this.Ts)}></uc-crop-frame>`}};p([f()],Ni.prototype,"vt",2);function Hs(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}function Md(o){return typeof o=="string"&&o in It}function Id(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}function Od(o,i,t){let e=Id(o).find(([n,a])=>n<=i&&i<=a);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let a=Math.abs(r-s)||1,l=Math.abs(i-r)/a;return r===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function Ld(o,i){return o.map((t,e)=>t<i?o.length-e:e)}function fl(o,i){let t=It[o].keypointsNumber,{range:e,zero:r}=It[o];return [...new Set([...Hs(e[0],r,t+1),...Hs(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}var co=class extends T{constructor(){super();this._=false;this.ks=true;this.n="initial";this.El={};this.qt=[];this.xl=0;this.Cl=I();this.Sr=I();this.classList.add("uc-inactive_to_cropper"),this.Tl=F(async(t,e,r)=>{let s=()=>!this.Sl(t,e)||this.Re!==r||!!this.qt.find(c=>c.value===r);if(s())return;let n=await this.Al(t,r),a=new Image;a.src=n.src;let l=this.Ve(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.qt,d=c.findIndex(g=>g.value>r);d===-1&&(d=c.length);let h=c[d]?.image,m=this.Sr.value;!m||h&&!m.contains(h)||(c.splice(d,0,n),h?m.insertBefore(a,h):m.appendChild(a),this.Is(t,r));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Ve(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);}}kl(){window.cancelAnimationFrame(this.xl),this.xl=window.requestAnimationFrame(()=>{for(let t of this.qt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}de({url:t=this._e,filter:e=this.m??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.El};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let a=this.offsetWidth;return this.proxyUrl(si(t,a,n))}async Al(t,e){return {src:await this.de({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Sl(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Md(this.n)||!Number.isFinite(e)||(this.Is(this.n,e),this.Tl(this.n,this.m,e));}Is(t,e){this.n=t,this.Re=e;let{zero:r}=It[t],s=this.qt.map(l=>l.value),n=Od(s,e,r),a=Ld(s,r);this.qt.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.kl();}Ml(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Yd(){this.a=this.a||this.Ml();let t=this.a;t&&this.Ol(t);let e=this.qt.map(c=>c.src),{images:r,promise:s,cancel:n}=Pi(e);r.forEach(c=>{let d=this.Ve(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.Ms=()=>{n(),this.Ms=void 0;};let a=this.n,l=this.m;if(await s,this._&&this.Sl(a,l)){let c=this.Sr.value;if(!c)return;c.replaceChildren(),this.qt.forEach((d,u)=>{let h=r[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.kl();}}async setTransformations(t){if(this.El=t,this.a){let e=await this.de(),r=this.Ve(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.Os?.();let n=fl(r,s),a=await Promise.all(n.map(c=>this.de({url:t,filter:e,operation:r,value:c}))),{cancel:l}=Pi(a);this.Os=l;}Xd(t){let e=this.a||this.Ml();if(this.Ol(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=wt({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.Ve(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=wt({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"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.ks=false,await this.updateComplete,this._e=t,this.n=e??"initial",this.Re=r,this.m=s,this.Ci=n,typeof r!="number"&&!s){let l=await this.de({operation:e,value:r});this.Xd(l),this.Ps();return}!e||typeof r!="number"||(this.qt=await Promise.all(fl(e,r).map(l=>this.Al(e,l))),this.Is(e,r),this.Yd());}deactivate({hide:t=true}={}){this._=false,this.Ms?.(),this.Os?.(),t&&!this.ks?(this.ks=true,this.a&&(this.a.style.transform="scale(1)"),this.className=wt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Ps();},{once:true})):this.Ps();}Ol(t){let e=this.Cl.value;e&&(e.contains(t)||e.appendChild(t));}Ps(){this.Sr.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${O(this.Cl)}></div><div class="uc-fader-layers-host" ${O(this.Sr)}></div>`}};var gl="important",Pd=" !"+gl,Pe=at(class extends ht{constructor(o){if(super(o),o.type!==$t.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(o,[i]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith(Pd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?gl:""):t[e]=r;}}return it}});var Nt=class extends T{constructor(){super();this.Ls=0;this.Ar=I();this.Pl=I();this.Ll=I();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Wt=0;this.Jd=t=>{t.stopPropagation();let e=this.Rl(t);e!==null&&(this.Rs(e),this.Qd("slider-input",e));};this.tp=t=>{t.stopPropagation();let e=this.Rl(t);e!==null&&this.Rs(e);};this.Ul=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.$l=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}Qd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Ls=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Dl(this.Wt),this.Us(),this.s=new ResizeObserver(()=>{this.Us(),this.kr(this.Wt);}),this.s.observe(this);let e=this.Ar.value;e?.addEventListener("focus",this.Ul),e?.addEventListener("blur",this.$l),window.setTimeout(()=>{this.kr(this.Wt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Wt&&this.Rs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Us(),this.kr(this.Wt)),t.has("zero")&&this.hasUpdated&&this.Fl(this.Wt);}kr(t){this.Fl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(r-this.Ls)/100;window.requestAnimationFrame(()=>{let l=this.Pl.value;l&&(l.style.transform=`translateX(${a}px)`);});}Fl(t){if(!this.Si)return;let e=this.max-this.min;if(e===0)return;this.Si.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(r-this.Ls)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${a}px)`);});}Us(){let e=this.Ll.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.Il===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.Si=d,e.innerHTML="",e.appendChild(a),this.Il=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Ar.value;t?.removeEventListener("focus",this.Ul),t?.removeEventListener("blur",this.$l),this.s?.disconnect(),this.s=void 0;}Rs(t){Number.isFinite(t)&&(this.Wt=t,this.hasUpdated&&(this.Dl(t),this.kr(t)));}Dl(t){let e=this.Ar.value;e&&(e.value=String(t));}Rl(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return v`<div class="uc-steps" ${O(this.Ll)}></div><div class="uc-thumb" ${O(this.Pl)}></div><input class="uc-input" type="range" ${O(this.Ar)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Wt)} ?disabled=${this.disabled} @input=${this.Jd} @change=${this.tp} />`}};p([y({type:Boolean,reflect:true})],Nt.prototype,"disabled",2),p([y({type:Number})],Nt.prototype,"min",2),p([y({type:Number})],Nt.prototype,"max",2),p([y({type:Number,attribute:false})],Nt.prototype,"defaultValue",2),p([y({type:Number})],Nt.prototype,"zero",2),p([f()],Nt.prototype,"Wt",2);var _t="original",_i=class extends T{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.$s=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.ep();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});}ep(){let t=this.state.operation,{range:e,zero:r}=It[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:m}=u;d=h===this.state.filter?m:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:r;this.state={...this.state,value:c,defaultValue:c};}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 v`<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.$s} ></uc-slider-ui>`}};p([f()],_i.prototype,"state",2);function ni(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)}}var ut=class extends T{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Nl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Nl();}updated(t){super.updated(t),t.has("active")&&this.Nl();}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([f()],ut.prototype,"active",2),p([f()],ut.prototype,"title",2),p([f()],ut.prototype,"icon",2),p([f()],ut.prototype,"titleProp",2);var uo=12,po=16,Rd=o=>{let i=12,t=12;return o.width/o.height>=1?(i=uo,t=Math.round(uo*o.height/o.width)):(t=uo,i=Math.round(uo*o.width/o.height)),{width:i,height:t}},ho=class extends ut{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.ip(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}ip(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 v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Bi=class extends ut{constructor(){super(...arguments);this.tt=null;}get aspectRatio(){return this.tt}set aspectRatio(t){if(this.tt===t)return;let e=this.tt;this.tt=t,this.requestUpdate("aspectRatio",e),t?this.Vl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.tt&&this.Vl(this.tt),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.tt?.id||t?.width===this.tt?.width&&t?.height===this.tt?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.tt?.id&&(this.$["*currentAspectRatio"]=this.tt);}Vl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{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};r(),s(),e||this.requestUpdate();}rp(){let t=this.tt;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=Rd(t),s=(po-e)/2,n=(po-r)/2;return v`<uc-icon><svg viewBox="0 0 ${po} ${po}" 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 v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} >${this.rp()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],Bi.prototype,"aspectRatio",1);function Ud(o){let i=o+90;return i=i>=360?0:i,i}function $d(o,i){if(o==="rotate")return Ud(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}var zi=class extends ut{constructor(){super(...arguments);this.operation=void 0;}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=$d(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};p([y({type:String})],zi.prototype,"operation",2);var Qt=class extends ut{constructor(){super(...arguments);this.n="";this.m="";this.Ai="";this.Mr=0;this.a=null;this.ze=false;this.isOriginal=false;this._l=20;}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._l=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.Bl(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:ni(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}op(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this._l||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.n]=this.m!==_t?{name:this.m,amount:a}:void 0,W(this.Ai,ot(fr,ie(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Rt}/${Ut}/uc-cloud-image-editor/`))}async di(t,e){t[0]?.isIntersecting?await this.Ds(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.Ai=t??"",this.sub("*originalUrl",e=>{this.Ai=e??"",!this.isOriginal&&this.Ai&&this.isConnected&&!this.a&&(this.s?.observe(this),this.pe());}),this.isOriginal||(this.s?.observe(this),this.pe()),this.m&&this.Bl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Ds():this.pe());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.Or();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.pe()));}Bl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ds(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.Ai){!this.Be&&!this.Zt&&this.pe();return}let e=++this.Mr,r="";try{r=await this.proxyUrl(this.op());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.ze=false,this.b?.();let{promise:s,cancel:n}=ke(r);this.b=()=>{n(),this.Mr===e&&(this.b=void 0);};try{if(await s,this.Mr!==e||!this.isConnected)return;this.a=r,this.ze=!0,this.Or(),(t??this.s)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.pe();}finally{this.Mr===e&&(this.b=void 0);}}pe(){if(!this.isConnected||this.a||this.ze||this.isOriginal||this.$["*networkProblems"]){this.Or();return}this.Zt&&cancelAnimationFrame(this.Zt),this.Zt=requestAnimationFrame(()=>{if(this.Zt=void 0,!this.isConnected||this.a||this.ze||this.isOriginal){this.Or();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.Ds();return}this.Be=window.setTimeout(()=>{this.Be=void 0,this.pe();},500);});}Or(){this.Zt&&(cancelAnimationFrame(this.Zt),this.Zt=void 0),this.Be&&(window.clearTimeout(this.Be),this.Be=void 0);}get sp(){return !!(this.ze&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.sp?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.ze} style=${Pe(e)}></div><uc-icon class=${lt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Pe(r)} ></uc-icon></button>`}};p([f()],Qt.prototype,"a",2),p([f()],Qt.prototype,"ze",2),p([f()],Qt.prototype,"isOriginal",2),p([f()],Qt.prototype,"_l",2),p([y({type:String})],Qt.prototype,"filter",1);var Hi=class extends ut{constructor(){super(...arguments);this.n="";}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.zl(e);}zl(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},r=()=>{let s=this.l10n(t);return this.title=s,s};e(),r();}initCallback(){super.initCallback(),this.n&&this.zl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=It[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:ni(this.$["*operationTooltip"])});}};p([y({type:String})],Hi.prototype,"operation",1);var Dd=1,vl=()=>{},Ki=class extends T{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Hl=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Dd){this.scrollLeft+=r;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Hl,{passive:false}),this.addEventListener("scroll",vl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Hl),this.removeEventListener("scroll",vl),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Ki.prototype,"hiddenScrollbar",2);var ft=class extends T{constructor(){super(...arguments);this.ki=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Kl=true;this.tabList=[...st];this.activeTab=z.CROP;this.Ir=true;this.Fs=false;this.jl=null;this.Gl=0;this.ql=0;this.Pr=I();this.Wl=I();this.tabToggleRefs={[z.CROP]:I(),[z.TUNING]:I(),[z.FILTERS]:I()};this.Zl=()=>{this.he();};this.Mi=[];this.Lr=F(t=>{this.ki=t;},500);this.Rr=F(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===z.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"]===z.TUNING&&e){s=true;let n=t?.[e]||It[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Fs=s;},0);this.np={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.ap={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.lp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.cp={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.Ut=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.Bs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.wp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ni(this.$["*operationTooltip"])}),this.Pr.value?.apply(),this.Yl();};this.Ep=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Pr.value?.cancel(),this.Yl();};this.xp=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Ns(r,{fromViewer:false}));};}Yl(){this.$["*showSlider"]=false,this.$["*tabId"]===z.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===z.TUNING&&(this.Fs=false);}Ns(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Xl(t,{fromViewer:e,force:r});}Xl(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.he();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===z.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of st){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.he();}}he(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Wl.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Gl!==s||this.ql!==n)&&(this.Gl=s,this.ql=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get Vs(){return this.Mi.length>=3}up(t){switch(t){case z.CROP:return this.dp();case z.FILTERS:return this.pp();case z.TUNING:return this.hp();default:return []}}dp(){let t=[];if(this.Vs)t.push(()=>this.fp());else for(let e of this.Mi)t.push(()=>this.Ql(e));for(let e of On)t.push(()=>this.mp(e));return this._s(t)}pp(){let e=[_t,...In].map(r=>()=>this.gp(r));return this._s(e)}hp(){let t=Mn.map(e=>()=>this.vp(e));return this._s(t)}_s(t){return t.length?t.map(r=>r()):[]}fp(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Ql(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}mp(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}gp(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}vp(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}yp(){return this.Vs?this.Mi.map(t=>this.Ql(t)):[]}async bp(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(si(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=Pi([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Mi=[...t],this.sub("*cropPresetList",e=>{this.Mi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Ns(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Rr();}),this.sub("*currentOperation",()=>{this.Rr();}),this.sub("*tabId",e=>{this.Xl(e,{fromViewer:false,force:true}),this.Rr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.bp(),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.Lr(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ir=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ir=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Kl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Ns(r,{fromViewer:false});return}this.he();}),this.sub("*operationTooltip",e=>{this.jl=e;}),this.Rr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Zl);}firstUpdated(t){super.firstUpdated(t),this.Ur(),this.he();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.he()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Ur();}disconnectedCallback(){window.removeEventListener("resize",this.Zl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Ur(){let t=this.Pr.value;t&&(this.$["*sliderEl"]=t);}Tp(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?Pe({gridColumn:`${s+1}`}):P;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.lp}><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.xp} ${O(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Cp(t){let e=this.up(t);return v`<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:P}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Fs?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Vs;return v`<uc-line-loader-ui .active=${this.ki}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.jl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.np} ><div class="uc-tab-content-row">${st.map(r=>Di(this.activeTab===r,()=>this.Cp(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Kl} .styles=${this.cp} @initial-render=${()=>this.he()} ><div class="uc-tab-toggles_indicator" ${O(this.Wl)} ></div>${st.map(r=>this.Tp(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ut} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Bs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.ap}><div class="uc-slider" ?hidden=${!this.Ir}><uc-editor-slider ${O(this.Pr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Ir||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.yp()}</div>`:P}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Ep} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.wp} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([f()],ft.prototype,"ki",2),p([f()],ft.prototype,"showMainToolbar",2),p([f()],ft.prototype,"showSubToolbar",2),p([f()],ft.prototype,"Kl",2),p([f()],ft.prototype,"tabList",2),p([f()],ft.prototype,"activeTab",2),p([f()],ft.prototype,"Ir",2),p([f()],ft.prototype,"Fs",2),p([f()],ft.prototype,"jl",2),p([f()],ft.prototype,"Mi",2);var yl=Kt([...st]),et=class extends T{constructor(){super(...arguments);this.ctxOwner=true;this.Sp="";this.de=Ot;this.Ap="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=yl;this.Jl=false;this._t=false;this.zs=null;this.Oi=null;this.Lr=F(t=>{this.ki=t;},300);this.$r=I();this.tc=I();this.ec=I();this.ic=I();this.rc=()=>{this.Lr(false),this.de!==Ot&&(this.$["*networkProblems"]=false);};this.oc=()=>{this.Lr(false),this.$["*networkProblems"]=true;};this.kp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...pl(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Mp(){this._t||this.zs||(this.zs=this.updateComplete.then(()=>{this.zs=null,this._t=true;}));}initCallback(){super.initCallback(),this.sc(),this.nc();}Ur(){let t=this.ec.value;t&&(this.$["*faderEl"]=t);let e=this.tc.value;e&&(this.$["*cropperEl"]=e);let r=this.ic.value;r&&(this.$["*imgContainerEl"]=r);let s=this.$r.value;s&&(this.$["*imgEl"]=s);}Op(){let t=this.$r.value;t&&(t.addEventListener("load",this.rc),t.addEventListener("error",this.oc));}Ip(){let t=this.$r.value;t&&(t.removeEventListener("load",this.rc),t.removeEventListener("error",this.oc));}get Pp(){let t=this.$["*tabId"];return wt("uc-image",{"uc-image_hidden_to_cropper":t===z.CROP,"uc-image_hidden_effects":t!==z.CROP})}ac(){if(this.Oi)return this.Oi;let t=3e3;return this.Oi=new Promise((e,r)=>{let s=()=>{window.clearTimeout(d),c.disconnect(),this.Oi=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{s(),window.setTimeout(()=>e(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(u.message),r(u);},c=new ResizeObserver(u=>{let[h]=u;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),d=window.setTimeout(()=>{l();},t);if(n()){a();return}c.observe(this);}),this.Oi}firstUpdated(t){super.firstUpdated(t),this.Ur(),this.Op(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.Ip(),super.disconnectedCallback();}render(){let t=this.Ap??"",e=this.Sp??"",r=this.de||Ot,s=this.ki,n=this.Jl;return v` ${ze(hl)}<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.kp}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${O(this.ic)}><img src=${r} class=${this.Pp} ${O(this.$r)} />${Di(this._t,()=>v`<uc-editor-image-cropper ${O(this.tc)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${O(this.ec)}></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">${Di(this._t,()=>v`<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.sc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.nc();}sc(){let t=this.tabs||yl;this.$["*tabList"]=dl(t);}nc(){let t=Zr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=Fo(this.cdnUrl),s=Vo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=Ia(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.ac();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=mr(t),r=ee(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=Fo(t),n=Vo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=ee(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"]===z.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(W(t,ot("json"))),r=await fetch(e).then(a=>a.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===z.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.Mp();}}}async initEditor(){try{await this.ac();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Jl=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=ot(ie(t),"preview"),s=W(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([f()],et.prototype,"Sp",2),p([f()],et.prototype,"de",2),p([f()],et.prototype,"Ap",2),p([f()],et.prototype,"ki",2),p([y({type:String,reflect:true})],et.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],et.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],et.prototype,"cropPreset",2),p([y({type:String,reflect:true})],et.prototype,"tabs",2),p([f()],et.prototype,"Jl",2),p([f()],et.prototype,"_t",2);var Ks={};Zs(Ks,{CloudImageEditorActivity:()=>ji});var mo=class extends et{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var ji=class extends M{constructor(){super(...arguments);this.ot=null;}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.ot&&this.ot.cropPreset!==t&&(this.ot={...this.ot,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.ot&&this.ot.tabs!==t&&(this.ot={...this.ot,tabs:t});}),this.Lp();}disconnectedCallback(){super.disconnectedCallback(),this.Rp();}Bs(t){if(!this.Ii)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ii.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}Ut(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Lp(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Ii=e;let r=this.Ii.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.ot=this.Up(r);}Rp(){this.Ii=void 0,this.ot=null;}render(){if(!this.ot)return P;let{cdnUrl:t,cropPreset:e,tabs:r}=this.ot;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${q(e)} tabs=${q(r)} @apply=${this.Bs} @cancel=${this.Ut} @change=${this.handleChange} ></uc-cloud-image-editor>`}Up(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([f()],ji.prototype,"ot",2);var ai=class extends M{constructor(){super(...arguments);this._e="";this.$s=t=>{this._e=t.target?.value??"";};this.rs=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this._e.trim();e&&(this.api.addFileFromUrl(e,{source:U.URL}),this.routerLayer.navigateAfterFileAdd());};}render(){return v`<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.rs}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.$s} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this._e} >${this.l10n("upload-url")}</button></form>`}};p([f()],ai.prototype,"_e",2);var bl=()=>{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}};var Fd=o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),wl=(o,i="i")=>{let t=o.split("*").map(Fd);return new RegExp(`^${t.join(".+")}$`,i)};var Vd=["--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"],Nd=(o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),El=o=>{let i={};for(let t of Vd){let e=Nd(o,t);e&&(i[t]=e);}return i};var _d=["selected-files-change","toolbar-state-change"],Bd=o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!_d.includes(i))},fo=class{constructor(i,t){this.Dr=new Map;this.uc=i=>{if(i.source!==this.Hs)return;let t=i.data;if(!Bd(t))return;let e=this.Dr.get(t.type);if(e)for(let r of e)r(t);};this.Hs=i,this.cc=t,window.addEventListener("message",this.uc);}on(i,t){let e=this.Dr.get(i)??new Set;this.Dr.has(i)||this.Dr.set(i,e),e.add(t);}send(i){let t=this.cc();this.Hs.postMessage(i,t);}destroy(){window.removeEventListener("message",this.uc);}};function Cl(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var zd={[mt.GDRIVE]:"ngdrive"},gt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.He=I();this.Fr=null;this.Ks=[];this.js=false;this.Gs=false;this.qs=false;this.Ws=false;this.Nr=false;this.Zs=false;this.Ys="uc-hidden";this.dc=true;this.os=()=>{for(let t of this.Ks){let e=this.Dp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.routerLayer.navigateAfterFileAdd();};this.Ut=()=>{this.historyBack();};this.zp=()=>{this.yt?.send({type:"select-all"});};this.Hp=()=>{this.yt?.send({type:"deselect-all"});};}get $p(){if(!this.Fr)return "";let{selectedCount:t,total:e}=this.Fr;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.pc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.hc(),this.pc());});}),this.subConfigValue("multiple",e=>{this.Nr=e;}),this.subConfigValue("localeName",()=>{this.fc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.mc(e);});}Dp(t){if(t.alternatives){let e=Z(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=wl(r);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}Fp(t){this.dc=t.isVisible;}async Np(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Vp(t.selectedCount,t.total),this.Ys=t.isReady?"":"uc-hidden",this.js=t.isReady,this.Gs=t.isReady&&t.selectedFiles.length>0,this.Nr=t.isMultipleMode&&t.total>0,this.qs=t.selectedCount<t.total,this.Ws=t.selectedCount===t.total,this.Ks=t.selectedFiles??[],this.Zs=t.total>0;}gc(){this.mc(this.cfg.externalSourcesEmbedCss),this._p(),this.fc();}_p(){this.yt?.send({type:"set-theme-definition",theme:El(this)});}mc(t){this.yt?.send({type:"set-embed-css",css:t});}fc(){this.yt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Bp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=zd[n]??n,c={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||bl(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,r);return d.search=Cl(c),d.toString()}Vp(t,e){this.Fr={selectedCount:t,total:e};}pc(){let t=document.createElement("iframe");t.src=this.Bp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.gc.bind(this)),t.addEventListener("load",this.gc.bind(this)),this.He.value&&(this.He.value.innerHTML="",this.He.value.appendChild(t)),t.contentWindow&&(this.yt?.destroy(),this.yt=new fo(t.contentWindow,()=>this.cfg.socialBaseUrl),this.yt.on("selected-files-change",this.Np.bind(this)),this.yt.on("toolbar-state-change",this.Fp.bind(this)),this.vc());}hc(){this.yt?.destroy(),this.yt=void 0,this.He.value&&(this.He.value.innerHTML=""),this.vc();}vc(){this.Ks=[],this.js=false,this.Gs=false,this.qs=false,this.Ws=false,this.Nr=false,this.Zs=false,this.Ys="uc-hidden",this.Fr=null;}disconnectedCallback(){super.disconnectedCallback(),this.hc();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${O(this.He)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.dc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Nr} ><span>${this.$p}</span><button type="button" @click=${this.zp} ?hidden=${!this.qs} >${this.l10n("select-all")}</button><button type="button" @click=${this.Hp} ?hidden=${!this.Ws} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.os} ?disabled=${!this.Gs} ?hidden=${!this.Zs} ><uc-spinner ?hidden=${this.js}></uc-spinner><span class=${this.Ys}>${this.l10n("done")}</span></button></div></div>`}};p([f()],gt.prototype,"Ks",2),p([f()],gt.prototype,"js",2),p([f()],gt.prototype,"Gs",2),p([f()],gt.prototype,"qs",2),p([f()],gt.prototype,"Ws",2),p([f()],gt.prototype,"Nr",2),p([f()],gt.prototype,"Zs",2),p([f()],gt.prototype,"Ys",2),p([f()],gt.prototype,"dc",2);var Tl=()=>typeof navigator.permissions<"u";var Hd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Kd=["camera","microphone"];function go(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}var xl="image/jpeg",Sl="video/webm",B=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Vr=null;this.Xs=false;this.Pi=[];this.Ot=null;this.It=null;this._r=null;this.Br=null;this.g=null;this.Li={};this.Mt=null;this.i=null;this.Ke=[];this.je=[];this.Kp={};this.zr=[];this.Hr=null;this.yc=()=>{this.bc(),this.Ri="pause";};this.wc=()=>{this.Ri="play",this.jp();};this.Ui=I();this.ce=I();this.W=I();this.Ec=0;this.xc=0;this.Tc=null;this.Kr=true;this.jr=true;this.Gp=Tl();this.Cc=[];this.fe=true;this.Qs="";this.Ge=true;this.me=true;this.qe=true;this.Sc=[];this.ge=true;this.Js=true;this.ve=true;this.Dt=true;this.ye=true;this.We="camera-full";this.Ri="play";this.Ac="microphone";this.Gr="uc-shot-btn uc-camera-action";this.qp=()=>{if(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===L.PHOTO&&this.Wp(),this.g===L.VIDEO){if(this.Ot?.state==="recording"){this.kc();return}this.Zp();}};this.Yp=t=>{let e=t.target;e&&(this.Br=e.value,this.Ze());};this.Xp=t=>{let e=t.target;e&&(this._r=e.value,this.Ze());};this.Qp=()=>{this.Ze();};this.Jp=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.qp();};this.th=()=>{this.eh();};this.ih=()=>{this.rh();};this.oh=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.sh();};this.nh=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.ah();};this.Mc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Oc(r);};this.Ic=()=>{let t=Math.floor((performance.now()-this.Ec+this.xc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Ui.value;s&&(s.textContent=go(e)),this.kc();return}let r=this.Ui.value;r&&(r.textContent=go(e));}else {let e=this.Ui.value;e&&(e.textContent=go(t));}this.Ye=requestAnimationFrame(this.Ic);};this.lh=()=>{this.Ec=performance.now(),this.xc=0,this.Ic();};this.Pc=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.bc=()=>{let t=this.W.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.ce.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.Ui.value;n&&(n.textContent=go(e)),this.Ye=requestAnimationFrame(this.bc);};this.jp=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.Ye=null;this.Zp=()=>{try{this.Pi=[],this.Li={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Li.mimeType=t:MediaRecorder.isTypeSupported(Sl)?this.Li.mimeType=Sl:this.Li.mimeType="video/mp4",this.It&&(this.Ot=new MediaRecorder(this.It,this.Li),this.Ot.start(),this.Ot.addEventListener("dataavailable",e=>{this.Pi.push(e.data);}),this.lh(),this.classList.add("uc-recording"),this.$i(St.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.kc=()=>{this.Ot?.addEventListener("stop",()=>{this.ch(),this.Pc(),this.$i(St.STOP);}),this.Ot?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.g}}});};this.eh=()=>{if(this.Ot?.state==="recording")return;let t=this.W.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.rh=()=>{this.It?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.Ac=t.enabled?"microphone":"microphone-mute",this.Js=!t.enabled;});};this.ch=()=>{try{let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=URL.createObjectURL(t),r=this.W.value;if(!r)return;r.muted=!1,r.volume=1,this.Di(null),r.src=e,this.uh(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.sh=()=>{if(this.$i(St.RETAKE),this.g===L.VIDEO){this.Di(this.It);let t=this.W.value;t&&(t.muted=true);}this.W.value?.play?.();};this.ah=()=>{if(this.$i(St.ACCEPT),this.g===L.PHOTO){this.Mt?.toBlob(s=>{if(!s)return;let n=this.Lc("camera","jpeg",xl,s);this.Rc(n);},xl);return}let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=this.dh(this.Ot?.mimeType),r=this.Lc("video",e,`video/${e}`,t);this.Rc(r),this.Pi=[];};this.ph=t=>{t===St.SHOT&&(this.ye=true,this.me=true,this.Dt=true,this.qe=false,this.fe=true),(t===St.RETAKE||t===St.ACCEPT)&&(this.ye=!this.Ft.includes(L.VIDEO),this.Dt=!this.Ft.includes(L.PHOTO),this.me=false,this.qe=true,this.fe=this.Ke.length<=1);};this.hh=t=>{t===St.PLAY&&(this.Ge=false,this.Dt=true,this.fe=true,this.ge=true,this.Ri="pause",this.We="square",this.Gr="uc-shot-btn uc-camera-action uc-stop-record"),t===St.STOP&&(this.Ge=false,this.me=true,this.ve=true,this.qe=false),(t===St.RETAKE||t===St.ACCEPT)&&(this.Ge=true,this.ye=!this.Ft.includes(L.VIDEO),this.Dt=!this.Ft.includes(L.PHOTO),this.me=false,this.qe=true,this.ve=!this.cfg.enableAudioRecording,this.We="video-camera-full",this.Gr="uc-shot-btn uc-camera-action",this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this.fe=this.Ke.length<=1);};this.$i=t=>{this.g===L.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.ph(t),this.g===L.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.hh(t);};this.Oc=t=>{t===L.PHOTO&&(this.We="camera-full",this.ge=true,this.ve=true),t===L.VIDEO&&(this.Ri="play",this.We="video-camera-full",this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this.ve=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.g=t;};this.Lc=(t,e,r,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:r})};this.Rc=t=>{this.api.addFileFromObject(t,{source:U.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this.Fi=F(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.Kr=false,this.me=false,this.Dt=!this.Ft.includes(L.PHOTO),this.ye=!this.Ft.includes(L.VIDEO),this.jr=true,this.Ge=true,this.We=r,this.ve=!e,this.ge=!e):t==="prompt"?(this.Qs="camera-permissions-prompt",this.Kr=true,this.me=true,this.Dt=true,this.jr=false,this.rn()):(this.Qs="camera-permissions-denied",this.Kr=true,this.jr=false,this.Dt=!this.Ft.includes(L.PHOTO),this.ye=!this.Ft.includes(L.VIDEO),this.qe=true,this.Gr="uc-shot-btn uc-camera-action",this.rn());},300);this.fh=()=>{if(!this.It)return false;let t=this.It?.getAudioTracks(),e=this.It?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.rn=()=>{this.Xs&&(this.W.value&&(this.W.value.volume=0),this.Hr?.getTracks?.()?.[0]?.stop(),this.tn(this.W.value),this.Di(null),this.fh(),this.Pc(),this.Xs=false);};this.Ze=async()=>{let t={video:{...Hd},audio:this.cfg.enableAudioRecording?{}:false};this.Br&&(t.video={deviceId:{exact:this.Br}}),this._r&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this._r}}),this.W.value&&(this.W.value.volume=0);try{this.Fi("prompt"),this.It=await navigator.mediaDevices.getUserMedia(t),this.It.addEventListener("inactive",()=>{this.Fi("denied");}),this.Di(this.It),this.Xs=!0,this.Fi("granted");}catch(e){this.Fi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.Uc=()=>{this.Ze();};this.mh=async()=>{try{this.qr();for(let t of Kd){let e=await navigator.permissions.query({name:t});this.Kp[t]=e,e.addEventListener("change",this.Uc),this.zr.push(()=>{e.removeEventListener("change",this.Uc);});}this.Vr=()=>{this.qr();};}catch(t){this.qr(),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.Ze();}};this.gh=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.sn(),navigator.mediaDevices.addEventListener("devicechange",this.sn);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.sn=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Ke=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this.je=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Cc=this.Ke,this.fe=this.Ke.length<=1,this.Br=this.Ke[0]?.value??null,this.Sc=this.je,this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this._r=this.je[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.vh=async()=>{await this.mh(),await this.gh(),await this.Ze(),this.$c(this.Ft);};this.yh=async()=>{this.Vr&&this.Vr(),window.chrome||this.Fi("denied"),this.rn();};this.$c=t=>{this.ye=!t.includes(L.VIDEO),this.Dt=!t.includes(L.PHOTO);let e=t[0];e&&(!this.g||!t.includes(this.g))&&this.Oc(e);};}uh(t){this.tn(t),t.addEventListener("play",this.yc),t.addEventListener("pause",this.wc);}tn(t){t?.removeEventListener("play",this.yc),t?.removeEventListener("pause",this.wc);}Di(t){this.Hr!==t&&(this.Hr=t,this.en());}en(){let t=this.W.value;if(!t)return;let e=this.Hr??null;t.srcObject!==e&&(t.srcObject=e);}Wp(){if(this.$i("shot"),this.Mt=document.createElement("canvas"),this.i=this.Mt.getContext("2d"),!this.i)throw new Error("Failed to get canvas context");let t=this.W.value;if(!t)throw new Error("Video element not found");this.Mt.height=t.videoHeight,this.Mt.width=t.videoWidth,this.cfg.cameraMirror&&(this.i.translate(this.Mt.width,0),this.i.scale(-1,1)),this.i.drawImage(t,0,0),t.pause();}dh(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 Ft(){return Z(this.cfg.cameraModes).filter(t=>t===L.PHOTO||t===L.VIDEO)}qr(){if(this.zr.length!==0){for(let t of this.zr)t();this.zr=[],this.Vr=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Tc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ve=!t,this.Js=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=j(t);this.$c(e.filter(r=>r===L.PHOTO||r===L.VIDEO));}),this.vh();}firstUpdated(t){super.firstUpdated(t),this.en();}updated(t){super.updated(t),this.en();}bh(){this.qr(),navigator.mediaDevices?.removeEventListener("devicechange",this.sn),this.tn(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.yh(),this.bh();}render(){return v`<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.fe}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Cc} ?hidden=${this.fe} @change=${this.Yp} ></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=${Pe({transform:this.Tc})} ?hidden=${this.Kr} ${O(this.W)} ></video><div class="uc-message-box" ?hidden=${this.jr}><span>${this.l10n(this.Qs)}</span><button type="button" @click=${this.Qp} ?hidden=${this.Gp} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.Ge}><button data-id="photo" type="button" class=${lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===L.PHOTO})} @click=${this.Mc} ?hidden=${this.Dt} 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.Mc} ?hidden=${this.ye} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.th} ?hidden=${this.Ge} data-testid="recording-timer" ><uc-icon name=${this.Ri}></uc-icon><span ${O(this.Ui)}> 00:00 </span><span ${O(this.ce)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.qe} ><button type="button" class="uc-secondary-btn" @click=${this.oh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.nh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.Jp} class=${this.Gr} ?hidden=${this.me} ><uc-icon name=${this.We}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ih} ?hidden=${this.ve} data-testid="toggle-microphone" ><uc-icon name=${this.Ac}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Sc} ?hidden=${this.ge} ?disabled=${this.Js} @change=${this.Xp} data-testid="audio-select" ></uc-select></div></div>`}};p([f()],B.prototype,"Tc",2),p([f()],B.prototype,"Kr",2),p([f()],B.prototype,"jr",2),p([f()],B.prototype,"Gp",2),p([f()],B.prototype,"Cc",2),p([f()],B.prototype,"fe",2),p([f()],B.prototype,"Qs",2),p([f()],B.prototype,"Ge",2),p([f()],B.prototype,"me",2),p([f()],B.prototype,"qe",2),p([f()],B.prototype,"Sc",2),p([f()],B.prototype,"ge",2),p([f()],B.prototype,"Js",2),p([f()],B.prototype,"ve",2),p([f()],B.prototype,"Dt",2),p([f()],B.prototype,"ye",2),p([f()],B.prototype,"We",2),p([f()],B.prototype,"Ri",2),p([f()],B.prototype,"Ac",2),p([f()],B.prototype,"Gr",2);var Al={id:"camera",setup:async({pluginApi:o,uploaderApi:i})=>{vt({CameraSource:B}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!Qn.htmlMediaCapture)return ["camera"];let t=j(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},onSelect:()=>{i.setCurrentActivity(N.CAMERA),i.setModalState(true);}}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),o.registry.registerActivity({id:N.CAMERA,render:t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}}});}};var js={};Zs(js,{BtnUi:()=>At,CloudImageEditor:()=>mo,CloudImageEditorBlock:()=>et,Config:()=>ei,CropFrame:()=>Vi,EditorAspectRatioButtonControl:()=>Bi,EditorCropButtonControl:()=>zi,EditorFilterControl:()=>Qt,EditorFreeformButtonControl:()=>ho,EditorImageCropper:()=>Ni,EditorImageFader:()=>co,EditorOperationControl:()=>Hi,EditorScroller:()=>Ki,EditorSlider:()=>_i,EditorToolbar:()=>ft,Icon:()=>ce,LineLoaderUi:()=>Fi,PresenceToggle:()=>oi,SliderUi:()=>Nt,defineComponents:()=>vt});var jd="cloud-image-editor",Gd="<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>",kl={id:jd,setup:async({pluginApi:o,uploaderApi:i})=>(vt({...js,...Ks}),o.registry.registerIcon({name:"edit-file",svg:Gd}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:e=>!!(e.isImage&&e.cdnUrl),onClick:e=>{i.setCurrentActivity?.(N.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);}}),o.registry.registerActivity({id:N.CLOUD_IMG_EDIT,render:e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}}}),i.on(A.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),n=o.config.get("cloudImageEditorAutoOpen"),a=i.v.size;s&&a===1&&(r||n)&&(i.setCurrentActivity?.(N.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));}))};var Ml={id:"external-sources",setup:async({pluginApi:o,uploaderApi:i})=>{vt({ExternalSource:gt}),o.registry.registerActivity({id:N.EXTERNAL,render:t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}}});for(let t of Object.values(mt))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:()=>{i.setCurrentActivity(N.EXTERNAL,{externalSourceType:t}),i.setModalState(true);}});}};var yo=()=>{let o=[];return {stack:o,promiseReadJpegChunks:t=>new Promise((e,r)=>{let s=2,n=(c,d)=>{let u=new FileReader;u.addEventListener("load",()=>{d(new DataView(u.result));}),u.addEventListener("error",h=>{r(`Reader error: ${h}`);}),u.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let d,u,h;for(d=u=0,h=c.byteLength;h>=0?u<h:u>h;d=h>=0?++u:--u)if(c.getUint8(d)===255){s+=d;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){r("Corrupted");return}let u=d.getUint8(1);if(u===218){e(true);return}let h=d.getUint16(2)-2;return n(t.slice(s,s+=h),m=>{if(m.byteLength!==h){r("Corrupted");return}o.push({startPos:c,length:h,marker:u,view:m}),a();})})};FileReader&&DataView||r("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&r("Not jpeg"),a();});})}},qd=async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=yo();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},Ol=async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=yo();await s(o),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),r.push(c.length)});let a=[o.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),a.push(d.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(o.slice(l,e[c])),l=e[c]+r[c]+4;return a.push(o.slice(l,o.size)),new Blob(a,{type:o.type})}};var Ll=(o,i)=>Ol(o,226,i.map(t=>t.buffer)),Wd=async o=>{try{return await Ll(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Zd=(o,i,t)=>new Promise((e,r)=>{let s=n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);};o.toBlob(s,i,t),o.width=o.height=1;}),Gi=()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},Yd=o=>{let{ctx:t,canvas:e}=Gi();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},Xd=async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=yo();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},Qd="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",vo,Jd=()=>new Promise(o=>{if(vo!==void 0)o(vo);else {let i=new Image;i.addEventListener("load",()=>{vo=i.naturalWidth<i.naturalHeight,i.src="//:0",o(vo);}),i.src=Qd;}}),tp=(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;}},ep=(o,i)=>{tp(o,(t,e)=>o.setUint16(t,i,e));},ip=async(o,i,t)=>(t&&ep(i,1),Ol(o,225,[i.buffer])),rp=(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."));}));}),op=o=>rp(new Image,o),sp=[1,3],np=[192,193,194,195,197,198,199,201,202,203,205,206,207],Il={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},ap=async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=yo();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&np.indexOf(r)>=0){let n=s.getUint8(5);sp.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},Pl=(o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},Rl=(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},he={R:55,G:110,B:165,A:255},lp=`rgba(${he.R}, ${he.G}, ${he.B}, ${he.A/255})`,Ul=(o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=Gi();e.width=1,e.height=1;let{canvas:s,ctx:n}=Gi();s.width=o,s.height=i,n&&(n.fillStyle=lp,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===he.R&&a[1]===he.G&&a[2]===he.B&&a[3]===he.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}};function $l(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}var cp=$l(Pl(Ul,Rl)),up=$l(Pl(Ul,Rl)),Dl=async(o,i)=>{let t=Il.squareSide.find(n=>n*n>=o*i),e=Il.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([cp(t,t),up(e,1)]);if(r&&s)return true;throw new Error("Not supported")},Fl=async(o,i,t)=>{try{let{ctx:e,canvas:r}=Gi();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})}},dp=({img:o,targetW:i,targetH:t})=>Fl(o,i,t),pp=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()},hp=({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=pp({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[a,l],c)=>n.then(d=>Dl(a,l).then(()=>Fl(d,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return d})),Promise.resolve(o))},mp=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),fp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Gs=.71,gp=(o,i)=>{if(o.width*Gs*o.height*Gs<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 Dl(s,n).then(()=>{let{ctx:a}=Gi();return "imageSmoothingQuality"in a&&!mp()&&!fp?dp({img:o,targetW:s,targetH:n}):hp({img:o,sourceW:t,targetW:s,targetH:n,step:Gs})}).catch(()=>Promise.reject("Not supported"))},Vl=async(o,i)=>{try{if(await ap(o))throw new Error("Should skipped");let e=await Promise.allSettled([Xd(o),Jd(),qd(o)]),s=!e.some(b=>b.status==="rejected"),[n,a,l]=e,c=await Wd(o).catch(()=>o),d=await op(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let u=await gp(d,i),h="image/jpeg",m=i?.quality||.8;!s&&Yd(u)&&(h="image/png",m=void 0);let g=await Zd(u,h,m);if(s&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await ip(g,b,w);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await Ll(g,l.value)),g}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})}};var vp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Nl=o=>{if(typeof o!="string")return false;let i=vp.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}};var _l={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=Nl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Vl(i,e)}}catch{return {file:i}}}});}};var Bl={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),onSelect:()=>{}});}};var zl={id:U.LOCAL,setup:({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:U.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{i.openSystemDialog();}});}};var Hl={id:"url-source",setup:async({pluginApi:o,uploaderApi:i})=>{vt({UrlSource:ai}),o.registry.registerActivity({id:N.URL,render:t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}}}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{i.setCurrentActivity(N.URL),i.setModalState(true);}});}};var li=[{configDeps:["useCloudImageEditor"],isEnabled:o=>!!o("useCloudImageEditor"),load:()=>kl},{configDeps:["imageShrink"],isEnabled:o=>!!o("imageShrink"),load:()=>_l},{configDeps:["sourceList"],isEnabled:o=>j(o("sourceList")).includes(U.LOCAL),load:()=>zl},{configDeps:["sourceList"],isEnabled:o=>j(o("sourceList")).includes(U.CAMERA),load:()=>Al},{configDeps:["sourceList"],isEnabled:o=>j(o("sourceList")).includes("instagram"),load:()=>Bl},{configDeps:["sourceList"],isEnabled:o=>Object.values(mt).some(i=>j(o("sourceList")).includes(i)),load:()=>Ml},{configDeps:["sourceList"],isEnabled:o=>j(o("sourceList")).includes(U.URL),load:()=>Hl}];var qi=class extends Yt{constructor(){super();this.headless=false;this.smartButton=false;this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});}get isSmartBtnActive(){return this.smartButton}wh(){return v`<uc-smart-btn></uc-smart-btn>`}Eh(){return v`<uc-simple-btn></uc-simple-btn>`}xh(){return this.headless?null:this.smartButton?this.wh():this.Eh()}render(){return v` ${super.render()} ${this.xh()}<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>`}};p([y({type:Boolean})],qi.prototype,"headless",2),p([y({attribute:"smart-button",type:Boolean})],qi.prototype,"smartButton",2);var bo=class extends Yt{constructor(){super();this.Dc=false;this.Ut=()=>{if(this.Fc){let t=this.$["*historyBack"];t?.();return}this.Nc&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Fc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==$.activities.START_FROM}get Nc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}nn(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.nn();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Dc=this.Fc||this.Nc;});}render(){return v` ${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.Ut} ?hidden=${!this.Dc} >${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>`}};p([f()],bo.prototype,"Dc",2);var qs="active",wo="",me=class extends Yt{constructor(){super();this.an=false;this.Wr=false;this.Zr=wo;this.ln=wo;this.mi="choose-file";this.ci=t=>{t.id===$.activities.CLOUD_IMG_EDIT&&(this.Zr=qs),this.$["*currentActivity"]===$.activities.UPLOAD_LIST&&(this.Zr=qs,this.Wr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.ln=qs);};this.ui=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.Wr=false),t.id===$.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}nn(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.nn();this.sub("*currentActivity",e=>{e===$.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.ln=wo):(this.Zr=wo,this.Wr=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.an=!r):(this.style.removeProperty("--uc-grid-col"),this.an=false);});}),this.subConfigValue("multiple",e=>{this.mi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(Y.OPEN,this.ci),this.modalManager?.subscribe(Y.CLOSE,this.ui);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(Y.OPEN,this.ci),this.modalManager?.unsubscribe(Y.CLOSE,this.ui);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.Wr} class=${this.ln}><uc-drop-area ?single=${this.an} initflow clickable tabindex="0" ><span>${this.l10n(this.mi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Zr}></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>`}};p([f()],me.prototype,"an",2),p([f()],me.prototype,"Wr",2),p([f()],me.prototype,"Zr",2),p([f()],me.prototype,"ln",2),p([f()],me.prototype,"mi",2);/*! For license information please see uc-file-uploader-minimal.min.js.LEGAL.txt */
|
|
8
|
-
export{$ as ActivityBlock,Is as ActivityHeader,Ro as BaseComponent,T as Block,At as BtnUi,B as CameraSource,mo as CloudImageEditor,ji as CloudImageEditorActivity,et as CloudImageEditorBlock,ei as Config,As as Copyright,Vi as CropFrame,H as Data,bt as DropArea,lo as DropDown,Bi as EditorAspectRatioButtonControl,zi as EditorCropButtonControl,Qt as EditorFilterControl,ho as EditorFreeformButtonControl,Ni as EditorImageCropper,co as EditorImageFader,Hi as EditorOperationControl,Ki as EditorScroller,_i as EditorSlider,ft as EditorToolbar,gt as ExternalSource,mt as ExternalUploadSource,Me as FileActionButton,Ps as FileItem,bo as FileUploaderInline,me as FileUploaderMinimal,qi as FileUploaderRegular,ro as FormInput,ce as Icon,Es as Img,Fi as LineLoaderUi,Ii as Modal,Y as ModalEvents,zs as
|
|
7
|
+
var Ws=Object.defineProperty;var jl=Object.getOwnPropertyDescriptor;var Zs=(o,i)=>{for(var t in i)Ws(o,t,{get:i[t],enumerable:true});};var p=(o,i,t,e)=>{for(var r=e>1?void 0:e?jl(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&&Ws(i,t,r),r};var Mt=[],Jt=0,Wi=4,Ys=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=Jt+Wi;s<Mt.length;)Mt[s]===e?Mt.splice(s,Wi):s+=Wi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!Mt.length;for(let n of i)Mt.push(n,t.value,e,r);if(s){for(Jt=0;Jt<Mt.length;Jt+=Wi)Mt[Jt](Mt[Jt+1],Mt[Jt+2],Mt[Jt+3]);Mt.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};function Zi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}function Co(o,i,t){let e=Zi(o,i,t);return t(o.value),e}var To=(o={})=>{let i=Ys(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};var H=class o{static{this.Xe=new Map;}constructor(i,t){this.at=i,this.bt=t;}get id(){return this.at}pub(i,t){i in this.bt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.bt.setKey(i,t);}sub(i,t,e=true){return (e?Co:Zi)(this.bt,[i],s=>{t(s[i]);})}read(i){return i in this.bt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.bt.get()[i]}add(i,t,e=false){(!(i in this.bt.get())||e)&&this.bt.setKey(i,t);}has(i){return i in this.bt.get()}get store(){return this.bt.get()}static registerCtx(i,t){if(o.Xe.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=To(i);return o.Xe.set(t,e),new o(t,e)}static deleteCtx(i){o.Xe.delete(i);}static getCtx(i){let t=o.Xe.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Xe.has(i)}};var Yi=globalThis,Qi=Yi.ShadowRoot&&(Yi.ShadyCSS===void 0||Yi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Qs=Symbol(),Xs=new WeakMap,Xi=class{constructor(i,t,e){if(this.Vc=true,e!==Qs)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(Qi&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Xs.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Xs.set(t,i));}return i}toString(){return this.cssText}},Js=o=>new Xi(typeof o=="string"?o:o+"",void 0,Qs);var tn=(o,i)=>{if(Qi)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Yi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},xo=Qi?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Js(t)})(o):o;var{is:ql,defineProperty:Wl,getOwnPropertyDescriptor:Zl,getOwnPropertyNames:Yl,getOwnPropertySymbols:Xl,getPrototypeOf:Ql}=Object,Ji=globalThis,en=Ji.trustedTypes,Jl=en?en.emptyScript:"",tc=Ji.reactiveElementPolyfillSupport,ci=(o,i)=>o,ui={toAttribute(o,i){switch(i){case Boolean:o=o?Jl: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}},tr=(o,i)=>!ql(o,i),rn={attribute:true,type:String,converter:ui,reflect:false,useDefault:false,hasChanged:tr};Symbol.metadata??=Symbol("metadata"),Ji.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static addInitializer(i){this.Yr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ni&&[...this.Ni.keys()]}static createProperty(i,t=rn){if(t.state&&(t.attribute=false),this.Yr(),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&&Wl(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Zl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let a=r?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??rn}static Yr(){if(this.hasOwnProperty(ci("elementProperties")))return;let i=Ql(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(ci("finalized")))return;if(this.finalized=true,this.Yr(),this.hasOwnProperty(ci("properties"))){let t=this.properties,e=[...Yl(t),...Xl(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.Ni=new Map;for(let[t,e]of this.elementProperties){let r=this.Xr(t,e);r!==void 0&&this.Ni.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(xo(r));}else i!==void 0&&t.push(xo(i));return t}static Xr(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.Vi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.be=null,this._c();}_c(){this.Qr=new Promise(i=>this.enableUpdating=i),this.Yt=new Map,this.Bc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Qe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Qe?.delete(i);}Bc(){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.Vi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return tn(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Qe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Qe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Jr(i,e);}zc(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.Xr(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:ui).toAttribute(t,e.type);this.be=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.be=null;}}Jr(i,t){let e=this.constructor,r=e.Ni.get(i);if(r!==void 0&&this.be!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ui;this.be=r;let a=n.fromAttribute(t,s.type);this[r]=a??this.to?.get(r)??a,this.be=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??tr)(s,t)||e.useDefault&&e.reflect&&s===this.to?.get(i)&&!this.hasAttribute(n.Xr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Qr=this.Hc());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.to??=new Map).has(i)&&(this.to.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.Yt.has(i)||(this.hasUpdated||e||(t=void 0),this.Yt.set(i,t)),r===true&&this.be!==i&&(this.cn??=new Set).add(i));}async Hc(){this.isUpdatePending=true;try{await this.Qr;}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.Vi){for(let[r,s]of this.Vi)this[r]=s;this.Vi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:n}=s,a=this[r];n!==true||this.Yt.has(r)||a===void 0||this.C(r,void 0,s,a);}}let i=false,t=this.Yt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Qe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.eo();}catch(e){throw i=false,this.eo(),e}i&&this.Kc(t);}willUpdate(i){}Kc(i){this.Qe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}eo(){this.Yt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Qr}shouldUpdate(i){return true}update(i){this.cn&&=this.cn.forEach(t=>this.zc(t,this[t])),this.eo();}updated(i){}firstUpdated(i){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[ci("elementProperties")]=new Map,zt[ci("finalized")]=new Map,tc?.({ReactiveElement:zt}),(Ji.reactiveElementVersions??=[]).push("2.1.2");var Ao=globalThis,on=o=>o,er=Ao.trustedTypes,sn=er?er.createPolicy("lit-html",{createHTML:o=>o}):void 0,ko="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Mo="?"+Ht,ec=`<${Mo}>`,ye=document,pi=()=>ye.createComment(""),hi=o=>o===null||typeof o!="object"&&typeof o!="function",Io=Array.isArray,dn=o=>Io(o)||typeof o?.[Symbol.iterator]=="function",So=`[ \f\r]`,di=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nn=/-->/g,an=/>/g,ge=RegExp(`>|${So}(?:([^\\s"'>=/]+)(${So}*=${So}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),ln=/'/g,cn=/"/g,pn=/^(?:script|style|textarea|title)$/i,Oo=o=>(i,...t)=>({Nt:o,strings:i,values:t}),v=Oo(1),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),un=new WeakMap,ve=ye.createTreeWalker(ye,129);function hn(o,i){if(!Io(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return sn!==void 0?sn.createHTML(i):i}var mn=(o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=di;for(let a=0;a<t;a++){let l=o[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===di?d[1]==="!--"?n=nn:d[1]!==void 0?n=an:d[2]!==void 0?(pn.test(d[2])&&(r=RegExp("</"+d[2],"g")),n=ge):d[3]!==void 0&&(n=ge):n===ge?d[0]===">"?(n=r??di,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?ge:d[3]==='"'?cn:ln):n===cn||n===ln?n=ge:n===nn||n===an?n=di:(n=ge,r=void 0);let m=n===ge&&o[a+1].startsWith("/>")?" ":"";s+=n===di?l+ec:u>=0?(e.push(c),l.slice(0,u)+ko+l.slice(u)+Ht+m):l+Ht+(u===-2?a:m);}return [hn(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},mi=class o{constructor({strings:i,Nt:t},e){let r;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=mn(i,t);if(this.el=o.createElement(c,e),ve.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(r=ve.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(ko)){let h=d[n++],m=r.getAttribute(u).split(Ht),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:m,ctor:g[1]==="."?rr:g[1]==="?"?or:g[1]==="@"?sr:we}),r.removeAttribute(u);}else u.startsWith(Ht)&&(l.push({type:6,index:s}),r.removeAttribute(u));if(pn.test(r.tagName)){let u=r.textContent.split(Ht),h=u.length-1;if(h>0){r.textContent=er?er.emptyScript:"";for(let m=0;m<h;m++)r.append(u[m],pi()),ve.nextNode(),l.push({type:2,index:++s});r.append(u[h],pi());}}}else if(r.nodeType===8)if(r.data===Mo)l.push({type:2,index:s});else {let u=-1;for(;(u=r.data.indexOf(Ht,u+1))!==-1;)l.push({type:7,index:s}),u+=Ht.length-1;}s++;}}static createElement(i,t){let e=ye.createElement("template");return e.innerHTML=i,e}};function be(o,i,t=o,e){if(i===it)return i;let r=e!==void 0?t.jc?.[e]:t.Gc,s=hi(i)?void 0:i.io;return r?.constructor!==s&&(r?.un?.(false),s===void 0?r=void 0:(r=new s(o),r.ro(o,t,e)),e!==void 0?(t.jc??=[])[e]=r:t.Gc=r),r!==void 0&&(i=be(o,r.qc(o,i.values),r,e)),i}var ir=class{constructor(i,t){this.dn=[],this.wt=void 0,this.pn=i,this.f=t;}get parentNode(){return this.f.parentNode}get X(){return this.f.X}u(i){let{el:{content:t},parts:e}=this.pn,r=(i?.creationScope??ye).importNode(t,true);ve.currentNode=r;let s=ve.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Re(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new nr(s,this,i)),this.dn.push(c),l=e[++a];}n!==l?.index&&(s=ve.nextNode(),n++);}return ve.currentNode=ye,r}p(i){let t=0;for(let e of this.dn)e!==void 0&&(e.strings!==void 0?(e.Et(i,e,t),t+=e.strings.length-2):e.Et(i[t])),t++;}},Re=class o{get X(){return this.f?.X??this.hn}constructor(i,t,e,r){this.type=2,this.r=P,this.wt=void 0,this.Pt=i,this.we=t,this.f=e,this.options=r,this.hn=r?.isConnected??true;}get parentNode(){let i=this.Pt.parentNode,t=this.f;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Pt}get endNode(){return this.we}Et(i,t=this){i=be(this,i,t),hi(i)?i===P||i==null||i===""?(this.r!==P&&this.Ee(),this.r=P):i!==this.r&&i!==it&&this.mn(i):i.Nt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):dn(i)?this.k(i):this.mn(i);}O(i){return this.Pt.parentNode.insertBefore(i,this.we)}T(i){this.r!==i&&(this.Ee(),this.r=this.O(i));}mn(i){this.r!==P&&hi(this.r)?this.Pt.nextSibling.data=i:this.T(ye.createTextNode(i)),this.r=i;}$(i){let{values:t,Nt:e}=i,r=typeof e=="number"?this.Wc(i):(e.el===void 0&&(e.el=mi.createElement(hn(e.h,e.h[0]),this.options)),e);if(this.r?.pn===r)this.r.p(t);else {let s=new ir(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Wc(i){let t=un.get(i.strings);return t===void 0&&un.set(i.strings,t=new mi(i)),t}k(i){Io(this.r)||(this.r=[],this.Ee());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(pi()),this.O(pi()),this,this.options)):e=t[r],e.Et(s),r++;r<t.length&&(this.Ee(e&&e.we.nextSibling,r),t.length=r);}Ee(i=this.Pt.nextSibling,t){for(this._i?.(false,true,t);i!==this.we;){let e=on(i).nextSibling;on(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.hn=i,this._i?.(i));}},we=class{get tagName(){return this.element.tagName}get X(){return this.f.X}constructor(i,t,e,r,s){this.type=1,this.r=P,this.wt=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=P;}Et(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=be(this,i,t,0),n=!hi(i)||i!==this.r&&i!==it,n&&(this.r=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=be(this,a[e+l],t,l),c===it&&(c=this.r[l]),n||=!hi(c)||c!==this.r[l],c===P?i=P:i!==P&&(i+=(c??"")+s[l+1]),this.r[l]=c;}n&&!r&&this.j(i);}j(i){i===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},rr=class extends we{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===P?void 0:i;}},or=class extends we{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==P);}},sr=class extends we{constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}Et(i,t=this){if((i=be(this,i,t,0)??P)===it)return;let e=this.r,r=i===P&&e!==P||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==P&&(e===P||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);}},nr=class{constructor(i,t,e){this.element=i,this.type=6,this.wt=void 0,this.f=t,this.options=e;}get X(){return this.f.X}Et(i){be(this,i);}},fn={I:Re},ic=Ao.litHtmlPolyfillSupport;ic?.(mi,Re),(Ao.litHtmlVersions??=[]).push("3.3.2");var ar=(o,i,t)=>{let e=t?.renderBefore??i,r=e.Zc;if(r===void 0){let s=t?.renderBefore??null;e.Zc=r=new Re(i.insertBefore(pi(),s),s,void 0,t??{});}return r.Et(o),r};var Lo=globalThis,Tt=class extends zt{constructor(){super(...arguments),this.renderOptions={host:this},this.oo=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.oo=ar(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.oo?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.oo?.setConnected(false);}render(){return it}};Tt.Th=true,Tt.finalized=true,Lo.litElementHydrateSupport?.({LitElement:Tt});var rc=Lo.litElementPolyfillSupport;rc?.({LitElement:Tt});(Lo.litElementVersions??=[]).push("4.2.2");var oc=/\\([0-9a-fA-F]{1,6} ?)/g;function sc(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}function nc(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}function ac(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}function gn(o){let i=o;sc(o)&&(i=nc(i),i=i.replace(oc,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=ac(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Ue(o){class i extends o{constructor(){super(...arguments);this.gn=null;this.so=null;}getCssData(r,s=false){let n=this.gn??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.so||(this.so=window.getComputedStyle(this));let a=this.so.getPropertyValue(r).trim();try{n[r]=gn(a);}catch(l){s||console.warn(`CSS Data error: ${r}`,l),n[r]=null;}}return this.gn=n,n[r]}}return i}function lr(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Xt={};this.Qt=null;this.Bi=false;}createRenderRoot(){return this}connectedCallback(){this.Qt||(this.Qt=Array.from(this.childNodes)),super.connectedCallback();}Yc(){if(this.Bi)return;this.Bi=true,this.Xt={};let r=Array.from(this.childNodes),s=r.length?r:this.Qt??[];for(let n of s){let a=this.vn(n),l=this.Xt[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.Xt[a]=l;}this.Qt=null;}vn(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.vn(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Xc(r){return !r.textContent||!r.textContent.trim()}Qc(r){let s=this.Xt[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Xc(n))}update(r){!this.hasUpdated&&this.willYield&&this.Yc(),super.update(r);}yield(r,s){if(r===""&&!this.Xt[r]&&!this.Bi&&this.Qt?.length){let a=[];for(let l of this.Qt)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.Xt[r]=a,this.Bi=true,this.Qt=null;}let n=this.Xt[r];return v` ${n} ${this.Qc(r)?s:void 0} `}}return i}function $e(o){class i extends o{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}var te=class extends Event{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 De=class{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 te(this.context,this.host,this.t,this.subscribe));}};var cr=class{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:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Po=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Fe=class extends cr{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:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new te(this.context,a,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 Po(this.context,this.host));}};var cc={attribute:true,type:String,converter:ui,reflect:false,hasChanged:tr},uc=(o=cc,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(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,o,true,a);},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,o,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(o){return (i,t)=>typeof t=="object"?uc(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)}function f(o){return y({...o,state:true,attribute:false})}function F(o,i){let t,e=((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var vn="ctx-name-context";function dr(){return function(o){class i extends o{constructor(...r){super(...r);this.pt=null;this.Je=false;this.ao=false;this.lo=void 0;this.xe=new Map;this.ti=new Set;this.init$={};this.ctxOwner=false;this.zi=void 0;this.Hi=false;this.ctxName=this.Vt;this._t=false;this.zi=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Vt,this.Jc=new De(this,{context:vn,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.wn=s,this.bn();},subscribe:true});}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 yn(){return this.zi}set yn(r){let s=r??void 0;this.zi!==s&&(this.zi=s,this.bn());}shouldUpdate(r){return this._t?super.shouldUpdate(r):false}get Vt(){return this.yn||this.wn||void 0}bn(){if(this.ctxName=this.Vt,!(!this.ctxName||this.Je)){if(this.isConnected){this.co();return}this.Hi=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Vt,this.ctxName&&(this.lo?this.lo.setValue(this.ctxName):this.lo=new Fe(this,{context:vn,initialValue:this.ctxName}));}En(){if(!(!this.pt||this.xe.size===0)){for(let[r,{value:s,rewrite:n}]of this.xe)this.pt.add(r,s,n);this.xe.clear();}}xn(){return !this.pt&&this.Vt&&this.uo(),this.pt&&this.En(),this.pt}Ki(){let r=this.xn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}uo(){let r=this.init$,s=this.Vt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.pt){this.pt=H.getCtx(s)??H.registerCtx(r,s);for(let[n,a]of Object.entries(this.init$))this.pt.add(n,a,this.ctxOwner);this.En();}}get $(){return this.Vt&&this.uo(),new Proxy({},{get:(r,s)=>{if(typeof s=="string")return this.pt?.read(s)},set:(r,s,n)=>(typeof s!="string"||this.pt?.pub(s,n),true)})}sub(r,s,n=true){let a=this.Ki().sub(r,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.ti.delete(d));};return this.ti.add(d),d}pub(r,s){this.Ki().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.Ki()}has(r){return this.pt?.has(r)??false}add(r,s,n=false){let a=this.xn();if(!a){if(!n&&this.xe.has(r))return;this.xe.set(r,{value:s,rewrite:n});return}this.xe.delete(r),a.add(r,s,n);}add$(r,s=false){for(let[n,a]of Object.entries(r))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.Je?this._t&&this.ao&&(this.ao=false,this.initCallback()):this.ctxName?(this.Hi=false,this.co()):this.Hi&&this.Vt&&(this.Hi=false,this.co());}co(){if(this.Je)return;this.Je=true,this.uo();let r=this.init$;if(Object.keys(r).length>0){let s=this.Ki();for(let[n,a]of Object.entries(r))s.read(n)===void 0&&s.pub(n,a),this.sub(n,F(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this._t=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.tu(),super.disconnectedCallback(),this.Je&&(this.ao=true);}tu(){if(this.ti.size!==0){for(let r of [...this.ti])r();this.ti.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"yn",1),p([f()],i.prototype,"wn",2),p([f()],i.prototype,"ctxName",2),p([f()],i.prototype,"_t",2),i}}var Ro=class extends $e(dr()(Ue(lr(Tt)))){};var rt=class o{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 dc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function vt(o){for(let i in o){if(dc.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);}}var Uo="UC";function pc(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Uo]){t(window[Uo]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[Uo];i&&vt(s),t(s);},document.head.appendChild(r);})}var fi={"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","upload-from":"Upload {{source}}","get-from":"Get from {{source}}","capture-with":"Capture with {{source}}",take:"Take {{source}}",record:"Record {{source}}",retake:"Retake",accept:"Accept"};var $o=new Map,yn=new Map,bn=(o,i)=>{$o.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...fi,...i};return $o.set(o,t),t},hc=(o,i)=>{yn.set(o,i);},wn=(o,i)=>{typeof i=="function"?hc(o,i):bn(o,i);},En=async o=>{let i=$o.get(o);if(!i){let t=yn.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=bn(o,e);}return i};wn("en",fi);var x=o=>`*cfg/${o}`;var j=o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],Kt=o=>o.join(",");var Cn=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},pr=(...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>Cn(i)).join("/-/"),ot=(...o)=>{let i=pr(...o);return i?`-/${i}/`:""};function hr(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}function mr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Do(o){let i=Tn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Fo(o){return Do(o).split("/-/").filter(Boolean).map(t=>Cn(t))}function Tn(o){let i=new URL(o),t=hr(o),e=xn(t)?Sn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function xn(o){return o.startsWith("http")}function Sn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var W=(o,i,t)=>{let e=new URL(Tn(o)),r=t??hr(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&xn(r)){let n=Sn(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()},ee=(o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()};var Z=(o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var gi=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}),kn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function mc(o,i){if(typeof i=="number"){let t=i;return gi[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return gi[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return gi.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}function ie(o){return pr(...kn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return mc(i,t)}).filter(i=>!!i))}var fr=pr("format/auto","progressive/yes"),jt=([o])=>typeof o<"u"?Number(o):void 0,An=()=>true,fc=([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),gc=([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:Z(o,"x").map(Number),coords:Z(i).map(Number)}},vc=Object.freeze({enhance:jt,brightness:jt,exposure:jt,gamma:jt,contrast:jt,saturation:jt,vibrance:jt,warmth:jt,filter:fc,mirror:An,flip:An,rotate:jt,crop:o=>{let[i,t]=o,{dimensions:e,coords:r}=gc([i,t]);return {dimensions:e,coords:r}}});function Vo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!kn.includes(e))continue;let s=e,n=vc[s];try{let a=n(r);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var z=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),st=Object.freeze([z.CROP,z.TUNING,z.FILTERS]),Mn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),In=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"]),On=Object.freeze(["rotate","mirror","flip"]),Gt=gi,It=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 vi="https://ucarecdn.com",yc="https://upload.uploadcare.com",bc="https://social.uploadcare.com",wc="https://ucarecd.net",Ec={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:vi,cdnCnamePrefixed:wc,baseUrl:yc,socialBaseUrl:bc,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:[],dynamicButtonViewMode:"auto",dynamicButtonShowFirstIcon:true},J=Object.freeze(Ec);var gr=(o,i)=>(...t)=>{let e=o();if(!e.read(x("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);};var K=class{constructor(i){this.po=new Set;this.Jt=null;this.w=gr(()=>this.e.ctx,this.constructor.name);this.e=i,this.i=i.ctx;}addSub(i){this.po.add(i);}get te(){if(!this.Jt){let i={};this.Jt=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let r=x(e);return this.e.ctx.has(r)?this.e.ctx.read(r):J[e]}});}return this.Jt}destroy(){for(let i of this.po)try{i();}catch{}this.po.clear();}},Cc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},xt=(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`)},Ln=o=>({get ctx(){return o()},get modalManager(){return xt(o(),"*modalManager",false)},get pluginManager(){return xt(o(),"*pluginManager")},get telemetryManager(){return xt(o(),"*telemetryManager")},get localeManager(){return xt(o(),"*localeManager")},get a11y(){return xt(o(),"*a11y")},get routerLayer(){return xt(o(),"*routerLayer")},get blocksRegistry(){return xt(o(),"*blocksRegistry")},get eventEmitter(){return xt(o(),"*eventEmitter")},get uploadCollection(){return xt(o(),"*uploadCollection")},get secureUploadsManager(){return xt(o(),"*secureUploadsManager",false)},get api(){return xt(o(),"*publicApi")},get validationManager(){return xt(o(),"*validationManager")},when(i,t){let e=Cc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n;return n=r.sub(e,a=>{a&&(t(a),n?.());}),n},wait(i){return new Promise(t=>{let e;e=this.when(i,r=>{t(r),e?.();});})}});var Y=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),vr=class extends K{constructor(){super(...arguments);this.ee=new Map;this.xt=new Set;this.c=new Map;}registerModal(t,e){this.ee.set(t,e),this.Z(Y.ADD,{id:t,modal:e});}deleteModal(t){let e=this.ee.get(t);return e?(this.ee.delete(t),this.xt.delete(t),this.Z(Y.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.ee.get(t);return e?(this.xt.add(t),this.Z(Y.OPEN,{modal:e,id:t}),true):(this.w(`Modal with ID "${t}" not found`),false)}close(t){let e=this.ee.get(t);return !e||!this.xt.has(t)?(this.w(`Modal with ID "${t}" not found or not active`),false):(this.xt.delete(t),this.Z(Y.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.ee.has(t)?this.xt.has(t)?this.close(t):this.open(t):(this.w(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.xt.size>0}back(){if(this.xt.size===0)return this.w("No active modals to go back from"),false;let t=Array.from(this.xt).pop();return t?this.close(t):false}closeAll(){let t=this.xt.size;return this.xt.clear(),this.Z(Y.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);}Z(t,e){if(this.c.has(t))for(let r of this.c.get(t)??new Set)try{r(e);}catch(s){this.e.telemetryManager.sendEventError(s,"modal subscriber"),this.w("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.ee.clear(),this.c.clear(),this.Z(Y.DESTROY,{});}};var yr=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("-");function Pn(o){return Object.prototype.toString.call(o)==="[object Object]"}var Tc=/\W|_/g;function xc(o){return o.split(Tc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Rn(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>Wt(t,{ignoreKeys:i})):o}function Wt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Rn(o,{ignoreKeys:i});if(!Pn(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}Pn(r)?r=Wt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Rn(r,{ignoreKeys:i})),t[xc(e)]=r;}return t}var Sc=o=>new Promise(i=>setTimeout(i,o));function jo({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("/"),a=[s,r].filter(Boolean).join("; ");return `${n} (${a})`}var Ac={factor:2,time:100};function kc(o,i=Ac){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a=>Sc(a??s).then(()=>(t+=1,e(r)))})}return e(o)}var Ee=class extends Error{},Ve=class o extends Ee{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},br=(o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},re=class o extends Ee{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},Mc=500,$n=({check:o,interval:i=Mc,timeout:t,signal:e})=>new Promise((r,s)=>{let n,a;br(e,()=>{n&&clearTimeout(n),s(new re("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),s(new re("Timed out"));},t));let l=()=>{try{Promise.resolve(o(e)).then(c=>{c?(a&&clearTimeout(a),r(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),s(c);});}catch(c){a&&clearTimeout(a),s(c);}};n=setTimeout(l,0);}),R={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"},wr="application/octet-stream",Dn="original",se=({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=o?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,m]=u;typeof m<"u"&&!Array.isArray(m)&&l.setRequestHeader(h,m);}),l.responseType="text",br(r,()=>{d=true,l.abort(),a(new re);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};h.forEach(function(w){let C=w.split(": "),E=C.shift(),S=C.join(": ");E&&typeof E<"u"&&(m[E]=S);});let g=l.response,b=l.status;n({request:u,data:g,headers:m,status:b});}},l.onerror=u=>{d||a(new Ve(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function Ic(o,...i){return o}var Oc=({name:o})=>o?[o]:[],Lc=Ic,Pc=()=>new FormData,Fn=o=>false,Er=o=>typeof Blob<"u"&&o instanceof Blob,Cr=o=>typeof File<"u"&&o instanceof File,Tr=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string",Ne=o=>Er(o)||Cr(o)||Fn()||Tr(o),Rc=o=>typeof o=="string"||typeof o=="number"||typeof o>"u",Uc=o=>!!o&&typeof o=="object"&&!Array.isArray(o),$c=o=>!!o&&typeof o=="object"&&"data"in o&&Ne(o.data);function Vn(o,i,t){if(Array.isArray(t))for(let e of t)Vn(o,`${i}[]`,e);else if($c(t)){let{name:e,contentType:r}=t,s=Lc(t.data,e,r??wr),n=Oc({name:e});o.push([i,s,...n]);}else if(Uc(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Rc(t)&&t&&o.push([i,t.toString()]);}function Dc(o){let i=[];for(let[t,e]of Object.entries(o))Vn(i,t,e);return i}function xr(o){let i=Pc(),t=Dc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}var nt=class o extends Ee{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);}},Fc=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()},qt=(o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Fc(t)),e.toString()},Vc="6.18.4",Nc="UploadcareUploadClient",_c=Vc;function Te(o){return jo({libraryName:Nc,libraryVersion:_c,...o})}var Bc="RequestThrottledError",Un=15e3,zc=1e3;function Hc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return Un;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Un}function ne(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return kc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Bc&&r<t)return s(Hc(n));if(n instanceof Ve&&r<e)return s((r+1)*zc);throw n}))}var Nn=o=>{let i="";return (Er(o)||Cr(o)||Tr(o))&&(i=o.type),i||wr},_n=o=>{let i="";return Cr(o)&&o.name?i=o.name:Er(o)||Fn()?i="":Tr(o)&&o.name&&(i=o.name),i||Dn};function Go(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}function Kc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=R.baseURL,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return ne(()=>se({method:"POST",url:qt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Te({publicKey:i,integration:u,userAgent:h})},data:xr({file:{data:o,name:t||_n(o),contentType:e||Nn(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Go(a),signature:s,expire:n,source:d,metadata:b}),signal:l,onProgress:c}).then(({data:w,headers:C,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,C);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var Bo;(function(o){o.Token="token",o.FileInfo="file_info";})(Bo||(Bo={}));function jc(o,{publicKey:i,baseURL:t=R.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return ne(()=>se({method:"POST",headers:{"X-UC-User-Agent":Te({publicKey:i,integration:u,userAgent:h})},url:qt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Go(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:d}).then(({data:w,headers:C,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,C);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var pt;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(pt||(pt={}));var Gc=o=>"status"in o&&o.status===pt.Error;function qc(o,{publicKey:i,baseURL:t=R.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=R.retryNetworkErrorMaxTimes}={}){return ne(()=>se({method:"GET",headers:i?{"X-UC-User-Agent":Te({publicKey:i,integration:r,userAgent:s})}:void 0,url:qt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:l,headers:c,request:d})=>{let u=Wt(JSON.parse(l));if("error"in u&&!Gc(u))throw new nt(u.error.content,u.error.errorCode,d,u,c);return u}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function Wc(o,{publicKey:i,baseURL:t=R.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:u=R.retryNetworkErrorMaxTimes}){return ne(()=>se({method:"POST",headers:{"X-UC-User-Agent":Te({publicKey:i,integration:l,userAgent:c})},url:qt(t,"/group/",{jsonerrors:1}),data:xr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:a}),signal:n}).then(({data:h,headers:m,request:g})=>{let b=Wt(JSON.parse(h));if("error"in b)throw new nt(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:u,retryThrottledRequestMaxTimes:d})}function Bn(o,{publicKey:i,baseURL:t=R.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=R.retryNetworkErrorMaxTimes}){return ne(()=>se({method:"GET",headers:{"X-UC-User-Agent":Te({publicKey:i,integration:s,userAgent:n})},url:qt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:c,headers:d,request:u})=>{let h=Wt(JSON.parse(c));if("error"in h)throw new nt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Zc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=R.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,store:l,signal:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return ne(()=>se({method:"POST",url:qt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Te({publicKey:i,integration:u,userAgent:h})},data:xr({filename:e,size:o,content_type:t||wr,part_size:r,UPLOADCARE_STORE:Go(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:d,metadata:b}),signal:c}).then(({data:w,headers:C,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,C);return S.parts=Object.keys(S.parts).map(Et=>S.parts[Number(Et)]),S}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}function Yc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=R.retryNetworkErrorMaxTimes}){return ne(()=>se({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||wr}}).then(a=>(r&&r({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function Xc(o,{publicKey:i,baseURL:t=R.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=R.retryNetworkErrorMaxTimes}){return ne(()=>se({method:"POST",url:qt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Te({publicKey:i,integration:s,userAgent:n})},data:xr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:d,request:u})=>{let h=Wt(JSON.parse(c));if("error"in h)throw new nt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function qo(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return $n({check:d=>Bn(o,{publicKey:i,baseURL:t,signal:d,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(u=>u.isReady?u:(c&&c({isComputable:true,value:1}),false)),signal:l})}function Qc(o){return "defaultEffects"in o}var Ce=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=R.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=qt(t,`${r}/`),a=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=a,Qc(i)&&(this.defaultEffects=i.defaultEffects);}},Jc=(o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>Kc(o,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:C})=>qo(C,{publicKey:i,baseURL:e,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(C=>new Ce(C,{baseCDN:b})),tu=(o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d,baseCDN:u})=>Bn(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d}).then(h=>new Ce(h,{baseCDN:u,fileName:t})).then(h=>(s&&s({isComputable:true,value:1}),h)),eu=(o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=n=>()=>{e=n,r.forEach((a,l)=>l!==n&&a.abort());};return br(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:r[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},iu=window.WebSocket,zo=class{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]=[];}},ru=(o,i)=>o==="success"?{status:pt.Success,...i}:o==="progress"?{status:pt.Progress,...i}:{status:pt.Error,...i},Ho=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new zo;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 iu(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,ru(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};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)}},No=null,Wo=o=>{if(!No){let i=typeof window>"u"?0:3e4;No=new Ho(o,i);}return No},ou=o=>{Wo(o).connect();};function su({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return $n({check:c=>qc(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:c}).then(d=>{switch(d.status){case pt.Error:return new nt(d.error,d.errorCode);case pt.Waiting:return false;case pt.Unknown:return new nt(`Token "${o}" was not found.`);case pt.Progress:return a&&(d.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:d.done/d.total})),false;case pt.Success:return a&&a({isComputable:true,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:l})}var nu=({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=Wo(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(o);};br(t,()=>{l(),s(new re("pusher cancelled"));}),n.subscribe(o,c=>{switch(c.status){case pt.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case pt.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),r(c);break}case pt.Error:l(),s(new nt(c.msg,c.error_code));}});}),au=(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,onProgress:u,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=R.pusherKey,metadata:C})=>Promise.resolve(ou(w)).then(()=>jc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:C})).catch(E=>(Wo(w)?.disconnect(),Promise.reject(E))).then(E=>E.type===Bo.FileInfo?E:eu([({signal:S})=>su({token:E.token,publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:S}),({signal:S})=>nu({token:E.token,pusherKey:w,signal:S,onProgress:u})],{signal:d})).then(E=>{if(E instanceof nt)throw E;return E}).then(E=>qo(E.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:d})).then(E=>new Ce(E,{baseCDN:r})),_o=new WeakMap,lu=async o=>{if(_o.has(o))return _o.get(o);let i=await fetch(o.uri).then(t=>t.blob());return _o.set(o,i),i},zn=async o=>{if(Cr(o)||Er(o))return o.size;if(Tr(o))return (await lu(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},cu=(o,i=R.multipartMinFileSize)=>o>=i,Hn=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 !Ne(o)&&t.test(o)},Zo=o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Ne(o)&&t.test(o)},uu=(o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,d=a.shift();d&&d().then(u=>{s||(r[c]=u,n-=1,n?l():t(r));}).catch(u=>{s=true,e(u);});};for(let c=0;c<o;c++)l();}),du=(o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},pu=async(o,i,t)=>e=>du(o,e,i,t),hu=(o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Yc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),mu=async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=R.multipartChunkSize,maxConcurrentRequests:C=R.maxConcurrentRequests,baseCDN:E,metadata:S})=>{let Et=e??await zn(o),Ct,fe=(Q,dt)=>{if(!c)return;Ct||(Ct=Array(Q).fill(0));let kt=Pt=>Pt.reduce((Bt,Eo)=>Bt+Eo,0);return Pt=>{Pt.isComputable&&(Ct[dt]=Pt.value,c({isComputable:true,value:kt(Ct)/Q}));}};return b||=Nn(o),Zc(Et,{publicKey:i,contentType:b,fileName:t||_n(o),baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:S,multipartChunkSize:w}).then(async({uuid:Q,parts:dt})=>{let kt=await pu(o,Et,w);return Promise.all([Q,uu(C,dt.map((Pt,Bt)=>()=>hu(kt(Bt),Pt,{publicKey:i,contentType:b,onProgress:fe(dt.length,Bt),signal:l,integration:u,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([Q])=>Xc(Q,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(Q=>Q.isReady?Q:qo(Q.uuid,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(Q=>new Ce(Q,{baseCDN:E}))};async function Yo(o,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:C,baseCDN:E=R.baseCDN,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:Et,pusherKey:Ct,metadata:fe}){if(Ne(o)){let Q=await zn(o);return cu(Q,b)?mu(o,{publicKey:i,contentType:g,multipartChunkSize:w,fileSize:Q,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:fe}):Jc(o,{publicKey:i,fileName:t,contentType:g,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:fe})}if(Zo(o))return au(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:E,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:Et,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,pusherKey:Ct,metadata:fe});if(Hn(o))return tu(o,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E});throw new TypeError(`File uploading from "${o}" is not supported`)}var fu=(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}},Ko=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=R.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=fu(i.cdnUrl,t),this.files=e.map(r=>new Ce(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},gu=o=>{for(let i of o)if(!Ne(i))return false;return true},vu=o=>{for(let i of o)if(!Hn(i))return false;return true},yu=o=>{for(let i of o)if(!Zo(i))return false;return true};function Kn(o,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=R.multipartChunkSize,baseCDN:w=R.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E,jsonpCallback:S}){if(!gu(o)&&!yu(o)&&!vu(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let Et,Ct=true,fe=o.length,Q=(dt,kt)=>{if(!l)return;Et||(Et=Array(dt).fill(0));let Pt=Bt=>Bt.reduce((Eo,Kl)=>Eo+Kl)/dt;return Bt=>{if(!Bt.isComputable||!Ct){Ct=false,l({isComputable:false});return}Et[kt]=Bt.value,l({isComputable:true,value:Pt(Et)});}};return Promise.all(o.map((dt,kt)=>Ne(dt)||Zo(dt)?Yo(dt,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:Q(fe,kt),source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:E}).then(Pt=>Pt.uuid):dt)).then(dt=>Wc(dt,{publicKey:i,baseURL:e,jsonpCallback:S,secureSignature:r,secureExpire:s,signal:a,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m}).then(kt=>new Ko(kt,{baseCDN:w})).then(kt=>(l&&l({isComputable:true,value:1}),kt)))}var oe=class{ji=1;ho=[];Gi=0;fo=new Map;mo=new Map;constructor(i){this.ji=i;}run(){let i=this.ji-this.Gi;for(let t=0;t<i;t++){let e=this.ho.shift();if(!e)return;let r=this.fo.get(e),s=this.mo.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Gi+=1,e().finally(()=>{this.fo.delete(e),this.mo.delete(e),this.Gi-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.fo.set(i,e),this.mo.set(i,r),this.ho.push(i),t&&this.run();})}get pending(){return this.ho.length}get running(){return this.Gi}set concurrency(i){this.ji=i,this.run();}get concurrency(){return this.ji}};var Xo=()=>({}),Qo=o=>({...Xo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);}}),Jo=o=>({...Qo(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new oe(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),jn=o=>({...Jo(o),"*solution":null,"*lazyPlugins":null});var Sr=class extends K{constructor(t){super(t);this.scopes=new Set;this.listener=this.eu.bind(this),window.addEventListener("paste",this.listener);}iu(t){return !!t.closest("uc-url-source")}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async eu(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected){if(this.iu(t.target))return;switch(this.te.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(a=>{n.getAsString(l=>{a(l);});}));r.length>0&&(r.forEach(n=>{this.e.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(a=>{this.e.api.addFileFromUrl(a,{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 N=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var Ar=class extends K{constructor(){super(...arguments);this.qi=[];}registerAfterFileAddHook(t){return this.qi.push(t),()=>{this.qi=this.qi.filter(e=>e!==t);}}navigateAfterFileAdd(){let e={historyLength:this.e.ctx.read("*history").length};this.qi.some(s=>s(e))||(this.e.ctx.pub("*currentActivity",N.UPLOAD_LIST),this.e.modalManager?.open(N.UPLOAD_LIST));}};var bu={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function yi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}function ts(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=bu[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}function es(o,i){return i.role==="toolbar"?Eu(i):i.querySelectorAll(`[role=${o.role}]`)}function wu(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})}function Eu(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function Cu(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"}function Gn(o){return i=>{let t=false,e=300,r=0,s="";function n(u){let h=ts(u.target);if(!h){a();return}let m=es(u.target,h),g=wu(m,h),b=Array.from(g).indexOf(u.target),w="ArrowDown",C="ArrowUp";if(Cu(h)&&(i.document.dir==="rtl"?(w="ArrowLeft",C="ArrowRight"):(w="ArrowRight",C="ArrowLeft")),u.key===w)u.preventDefault(),yi(u.target,g[b+1]||g[0]);else if(u.key===C)u.preventDefault(),yi(u.target,g[b-1]||g[g.length-1]);else if(u.key==="Home")u.preventDefault(),yi(u.target,g[0]);else if(u.key==="End")u.preventDefault(),yi(u.target,g[g.length-1]);else if(u.key.length===1&&h.role!=="tablist"){u.timeStamp-r<=e?s+=u.key.toLowerCase():s=u.key.toLowerCase(),r=u.timeStamp;let E=Array.from(m).find(S=>S.textContent?.trim()?.toLowerCase()?.startsWith(s));E&&(u.preventDefault(),yi(u.target,E));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=ts(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let m=es(u.target,h);for(let g of m)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=ts(u.target);if(h){let m=es(u.target,h);for(let g of m)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function qn(){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);}}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 o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}function Wn(){return o=>{let i=[];function t(l){let c=o.document.activeElement;c&&c!==o.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){o.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let r=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let d=o.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(s),d.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return o.addEventListener("keydown",a),()=>{o.removeEventListener("keydown",a);}}}function Zn(o){let i,t=o.split(" "),e;function r(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(s(),e!==a.target&&(a.target.classList.add(...t),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",r),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",r),a.removeEventListener("keyup",s);})}function Yn(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}var is=class{constructor(){this.mt=new Map;this.go=[];}addEventListener(i,t){let e=r=>{let s=r.target;s instanceof Node&&this.go.some(n=>n===s||n.contains(s))&&t(r);};this.mt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.mt.get(t);e&&window.removeEventListener(i,e),this.mt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.go.push(i);}destroy(){this.go=[];for(let i of this.mt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.mt.clear();}},kr=class{constructor(){this.Wi=new is,this.Tn=Yn(this.Wi,[Gn(),Zn("is-pressed"),Wn(),qn()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.Tn?.(),this.Wi.destroy();}};var Zt=o=>`*l10n/${o}`,Tu="en",Mr=class extends K{constructor(t){super(t);this.Te="";for(let[r,s]of Object.entries(fi)){let n=this.i.has(Zt(r))?!this.i.read(Zt(r)):true;this.i.add(Zt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Te&&this.Cn(this.Te);})),this.addSub(this.i.sub(x("localeName"),async r=>{if(!r)return;this.Te=r;let s=await En(r);r!==Tu&&this.Te!==r||(this.Cn(r),this.Sn(r,s));})),this.addSub(this.i.sub(x("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Te];s&&this.Sn(this.Te,s);}));}Sn(t,e){let r=this.te.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=r?.[s];this.i.add(Zt(s),a??n,true);}}Cn(t){let e=this.e.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.l10n){let{pluginId:n,...a}=s,l=a[t];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.i.add(Zt(c),d,true);}}};var xu=()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},Su=()=>"capture"in document.createElement("input"),Au=()=>({safariDesktop:xu()}),ku=()=>({htmlMediaCapture:Su()}),Xn=Au(),Qn=ku();var bi="image/*",rs="video/*",Mu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Iu=()=>Xn.safariDesktop?[bi]:[bi,...Mu],wi=Iu(),Ir=o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Z(i)):[],os=(o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),Jn=(o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),_e=o=>{let i=o?.type;return i?os(i,wi):false};function ta(o,i,t,e,r){return {registry:{registerSource:c=>o.addSource(e,c),registerActivity:c=>o.addActivity(e,c),registerFileAction:c=>o.addFileAction(e,c),registerFileHook:c=>o.addFileHook(e,c),registerIcon:c=>o.addIcon(e,c),registerL10n:c=>o.addL10n(e,c),registerConfig:c=>{o.addConfig(e,c);let d=x(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=x(c);return i.read(d)},subscribe:(c,d)=>{let u=x(c),h=i.sub(u,m=>{d(m);});return r.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let d=i.sub("*currentActivityParams",u=>{c(u);});return r.push(d),d}},files:{update:(c,d)=>{let u=t.uploadCollection?.read(c);u&&(d.file!==void 0&&(u.setValue("file",d.file),u.setValue("fileSize",d.file.size)),d.cdnUrl!==void 0&&u.setValue("cdnUrl",d.cdnUrl),d.cdnUrlModifiers!==void 0&&u.setValue("cdnUrlModifiers",d.cdnUrlModifiers),d.mimeType!==void 0&&u.setValue("mimeType",d.mimeType));}}}}var Ou=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),Or=class{constructor(i,t){this.i=i;this.ou=t;this.ei=new Set;this.An=this.i.sub("*lazyPlugins",e=>{this.ru(e??[]);});}ru(i){for(let r of this.ei)r();if(this.ei.clear(),i.length===0)return;let t=new Set([x("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(x(s));let e=()=>this.kn(i);for(let r of t)this.ei.add(this.i.sub(r,e,false));this.kn(i);}kn(i){this.vo?.abort();let t=new AbortController;this.vo=t;let e=n=>this.i.read(x(n)),r=e("plugins"),s=Ou({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.ou(s);}destroy(){this.An();for(let i of this.ei)i();this.ei.clear(),this.vo?.abort();}};var Lr=class{constructor(){this.ie=new Map;}register(i,t){if(this.ie.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.ie.set(t.name,e);}unregister(i){this.ie.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.ie)e.pluginId===i&&this.ie.delete(t);}get(i){return this.ie.get(i)}getAll(){return new Map(this.ie)}};var Pr=class{constructor(){this.z=[];this.Tt=[];this.Zi=[];this.Yi=[];this.Xi=[];this.Ce=[];this.config=new Lr;}Se(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.z.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.z.push(this.Se(i,t));}addActivity(i,t){let e=this.Tt.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.Tt.push(this.Se(i,t));}addFileAction(i,t){this.Zi.push(this.Se(i,t));}addFileHook(i,t){this.Yi.push(this.Se(i,{timeout:3e4,...t}));}addIcon(i,t){this.Xi.push(this.Se(i,t));}addL10n(i,t){this.Ce.push(this.Se(i,t));}addConfig(i,t){this.config.register(i,t);}purge(i){this.z=this.z.filter(t=>t.pluginId!==i),this.Tt=this.Tt.filter(t=>t.pluginId!==i),this.Zi=this.Zi.filter(t=>t.pluginId!==i),this.Yi=this.Yi.filter(t=>t.pluginId!==i),this.Xi=this.Xi.filter(t=>t.pluginId!==i),this.Ce=this.Ce.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.z],activities:[...this.Tt],fileActions:[...this.Zi],fileHooks:[...this.Yi],icons:[...this.Xi],l10n:[...this.Ce]}}};var Rr=class extends K{constructor(t){super(t);this.re=new Map;this.c=new Set;this.yo=Promise.resolve();this.registry=new Pr;this.Mn=new Or(this.i,e=>{this.yo=this.yo.then(()=>e).then(r=>{if(r)return this.su(r)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.yo}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async su(t){let e=new Set(this.re.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.re.has(s.id))try{await this.nu(s);}catch(n){this.registry.purge(s.id),this.bo(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.wo(s);}async nu(t){this.re.has(t.id)&&this.wo(t.id);let e=[],r=ta(this.registry,this.i,this.e,t.id,e),s=this.e.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.w("Failed to unsubscribe config listener",c);}throw a}this.re.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.bo();}wo(t){let e=this.re.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.re.delete(t),this.bo();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(r.length===0)return;let s=e,n=new AbortController;for(let a of r){if(n.signal.aborted)break;try{let l=a.handler({file:s,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:s}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",_e(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.re.keys()))this.wo(t);this.Mn.destroy(),super.destroy();}bo(){for(let t of this.c)try{t();}catch{}}};function Lu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function ns(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?ns(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=Lu(i);return typeof t=="object"&&t!==null?[e,ns(t)]:[e,t]}))}function Pu(o){return {ok:true,value:o}}function ss(o){return {ok:false,error:o}}var Ru="https://tlm.uploadcare.com/api/",as=class{constructor(i=Ru){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return ss(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return Pu(s)}catch(s){return ss(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return ss(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(ns(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Uu=async(o,i)=>({success:true,data:i}),$u=async o=>Uu(void 0,o),Ur=class extends as{constructor(){super();}async sendEvent(i,t){let e=await $u(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 Du=20,D=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),A=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"}),$r=class extends K{constructor(){super(...arguments);this.ii=new Map;this.Qi=new Set;this.mt=new Map;}bindTarget(t){return this.Qi.add(t),()=>{this.Qi.delete(t);}}on(t,e){let r=this.mt.get(t);return r||(r=new Set,this.mt.set(t,r)),r.add(e),()=>this.mt.get(t)?.delete(e)}On(t,e){for(let s of this.Qi)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.mt.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.On(t,typeof e=="function"?e():e);return}this.ii.has(t)&&window.clearTimeout(this.ii.get(t));let n=typeof s=="number"?s:Du,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.On(t,l),this.ii.delete(t);}catch(l){this.w?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.ii.set(t,a);}destroy(){for(let t of this.ii.values())window.clearTimeout(t);this.Qi.clear(),this.mt.clear();}};var ea="1.30.1";var Rt="blocks",Ut=ea;var Dr=class extends K{constructor(t){super(t);this.au=rt.generateRandomUUID();this.Ae=structuredClone(J);this.Eo=false;this.xo=null;this.Bt=false;this.In=new Ur,this.ke=new oe(10),this.addSub(this.i.sub(x("qualityInsights"),e=>{this.Bt=!!e;}));for(let e of Object.keys(this.Ae))this.addSub(this.i.sub(x(e),r=>{this.Bt&&(this.Eo&&this.Ae[e]!==r&&this.sendEvent({eventType:D.CHANGE_CONFIG}),this.lu(e,r));}));}cu(t){t===D.INIT_SOLUTION&&!this.Eo&&(this.Eo=true);}lu(t,e){this.Ae[t]!==e&&(this.Ae[t]=e);}uu(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===D.INIT_SOLUTION||t.eventType===D.CHANGE_CONFIG)&&(r.config=this.Ae),{...r,appVersion:Ut,appName:Rt,sessionId:this.au,component:this.du,activity:this.pu,projectPubkey:this.Ae.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.hu,payload:{location:this.fu,...e}}}mu(t){return !!(t&&[A.CHANGE,A.COMMON_UPLOAD_PROGRESS,A.FILE_ADDED,A.FILE_REMOVED,A.FILE_UPLOAD_START,A.FILE_UPLOAD_PROGRESS,A.FILE_UPLOAD_SUCCESS,A.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Bt)return;let e=this.uu({eventType:t.eventType,payload:t.payload,config:t.config});this.cu(t.eventType),!(this.mu(t.eventType)||this.xo&&this.Pn(this.xo,e))&&this.ke.add(async()=>{this.xo=e,await this.In.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:D.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}Pn(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.Pn(t[n],e[n]))return false;return true}get hu(){return Date.now()}get du(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get pu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get fu(){return location.origin}};var ia=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};var Vu=o=>o;var ra="plural:";function Be(o,i={},t={}){let{openToken:e="{{",closeToken:r="}}",transform:s=Vu}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);o=o.replaceAll(e+n+r,c);}return o}function oa(o){let i=[],t=o.indexOf("{{");for(;t!==-1;){let e=o.indexOf("}}",t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(ra)){let s=o.substring(t+2,e).replace(ra,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a});}t=o.indexOf("{{",e);}return i}var sa="--uploadcare-blocks-window-height",Ei=class o{static{this.clientsRegistry=new Set;}static{this.flush=F(()=>{document.documentElement.style.setProperty(sa,`${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(sa);}};var Fr=(o,i)=>new Intl.PluralRules(o).select(i);var Nu=o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=Fr(r,t);return e(`${i}__${s}`)},Vr=o=>{let i=Nu(()=>t),t=(e,r={})=>{if(!e)return "";let n=o().read(Zt(e))||e,a=oa(n);for(let c of a)r[c.variable]=i(c.pluralKey,Number(r[c.countVariable]));return Be(n,r)};return t};var _u=o=>o.tagName?.includes("-")??false,Nr=class{constructor(i){this.oe=new Set;this.Ji=new Map;this.Ln=false;this.se=i,this.se.addController(this);}hostDisconnected(){this.tr?.(),this.tr=void 0,this.oe.clear(),this.Ji.clear();}hostUpdated(){if(!this.tr&&this.se.has(x("testMode"))){let i=this.se.subConfigValue("testMode",t=>{this.Ln=!!t,this.Rn();});this.tr=i;}this.gu(),this.Rn();}gu(){let i=this.se,t=i.renderRoot??i;if(!t)return;let e=this.se,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!_u(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.oe.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.oe.add(n),this.Ji.set(n,a);}for(let n of Array.from(this.oe))(!n.isConnected||r&&n.closest(r)!==e)&&(this.oe.delete(n),this.Ji.delete(n));}Rn(){if(!this.oe.size)return;let i=this.se.testId||"";for(let t of this.oe){let e=this.Ji.get(t);e&&(this.Ln?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Bu=$e(dr()(Ue(lr(Tt)))),T=class extends Bu{constructor(){super();this.init$=Xo();this.l10n=Vr(()=>this.sharedCtx);this.debugPrint=gr(()=>this.sharedCtx,this.constructor.name);this.e=Ln(()=>this.sharedCtx);new Nr(this);}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(),Ei.registerClient(this);}initCallback(){this.Y("*blocksRegistry",()=>new Set),this.Y("*pluginManager",t=>new Rr(t)),this.Y("*eventEmitter",t=>new $r(t)),this.Y("*localeManager",t=>new Mr(t)),this.Y("*modalManager",t=>new vr(t)),this.Y("*a11y",()=>new kr),this.Y("*routerLayer",t=>new Ar(t)),this.Y("*clipboard",t=>new Sr(t)),this.Y("*telemetryManager",t=>new Dr(t)),this.sub(Zt("locale-id"),t=>{let e=ia(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.Q("*modalManager",false)}get telemetryManager(){return this.Q("*telemetryManager")}get localeManager(){return this.Q("*localeManager")}get a11y(){return this.Q("*a11y")}get clipboardLayer(){return this.Q("*clipboard")}get routerLayer(){return this.Q("*routerLayer")}get blocksRegistry(){return this.Q("*blocksRegistry")}get eventEmitter(){return this.Q("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),Ei.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.vu(),H.deleteCtx(this.ctxName);}Un(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Y(t,e){let r=this.Un();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),r.set(t,s);return}}vu(){let t=this.Un();for(let[e,r]of t.entries())r?.destroy?.(),this.pub(e,null);t.clear();}Q(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:mr(t),cdnUrlModifiers:Do(t),fileName:hr(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?Be(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.Jt){let t={};this.Jt=new Proxy(t,{set:(e,r,s)=>{if(typeof r!="string"||!(r in J))return false;let n=r,a=x(n);return this.has(a)||this.add(a,J[n]),this.$[a]=s,true},get:(e,r)=>{let s=x(r);return this.has(s)||this.add(s,J[r]),this.$[s]}});}return this.Jt}subConfigValue(t,e){let r=x(t);return this.has(r)||this.add(r,J[t]),this.sub(r,e)}};var $t={ATTRIBUTE:1,CHILD:2},at=o=>(...i)=>({io:o,values:i}),ht=class{constructor(i){}get X(){return this.f.X}ro(i,t,e){this.er=i,this.f=t,this.yu=e;}qc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var xe=class extends ht{constructor(i){if(super(i),this.it=P,i.type!==$t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===P||i==null)return this.$n=void 0,this.it=i;if(i===it)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.$n;this.it=i;let t=[i];return t.raw=t,this.$n={Nt:this.constructor.resultType,strings:t,values:[]}}};xe.directiveName="unsafeHTML",xe.resultType=1;var Ci=class extends xe{};Ci.directiveName="unsafeSVG",Ci.resultType=2;var ze=at(Ci);var na="<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 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></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 16 16' id='uc-icon-paperclip' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M13.264 9.743 9.03 13.977a4.217 4.217 0 0 1-5.96-.005 4.217 4.217 0 0 1-.004-5.96l6.416-6.416a2.743 2.743 0 0 1 3.88 3.88L7.637 11.2a1.232 1.232 0 1 1-1.743-1.743L9.42 5.932'/></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 T{constructor(){super(...arguments);this.init$=jn(this);}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 v`${ze(na)}`}};var aa=o=>typeof o!="number"?0:Math.floor(o/1e3),la=(o,{threshold:i})=>{let{secureExpire:t}=o,e=aa(Date.now()),r=Number(t),s=aa(i);return e+s>=r};var _r=class extends K{constructor(){super(...arguments);this.ne=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.te;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.ne||la(this.ne,{threshold:s})){this.ne?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.ne=n):(this.w("Secure signature resolver returned nothing."),this.ne=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.e.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.ne}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.ne=null;}};var ls=(o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var cs=(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}}};var us=(o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=Ir([...t?wi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let a=os(s,r),l=Jn(n,r);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}};var ds=(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}}};var Dt=1e3,Se=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Ti=o=>Math.ceil(o*100)/100,ca=(o,i=Se.AUTO)=>{let t=i===Se.AUTO;if(i===Se.BYTE||t&&o<Dt**1){let r=Fr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===Se.KB||t&&o<Dt**2?`${Ti(o/Dt**1)} KB`:i===Se.MB||t&&o<Dt**3?`${Ti(o/Dt**2)} MB`:i===Se.GB||t&&o<Dt**4?`${Ti(o/Dt**3)} GB`:i===Se.TB||t&&o<Dt**5?`${Ti(o/Dt**4)} TB`:`${Ti(o/Dt**5)} PB`};var ps=(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:ca(t)}),payload:{entry:o}}};var hs=(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 Ve)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}}};var He={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."},zu=o=>typeof o=="function"?{runOn:"change",validator:o}:o,Br=class extends K{constructor(t){super(t);this.bu=[ds,us,ps,hs];this.wu=[cs,ls];this.ke=new oe(20);this.Dn=F(()=>{this.ke.run();},500);this.zt=false;this.Me=new Map;let e=F(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.i.sub(x("maxLocalFileSizeBytes"),e)),this.addSub(this.i.sub(x("multipleMin"),e)),this.addSub(this.i.sub(x("multipleMax"),e)),this.addSub(this.i.sub(x("multiple"),e)),this.addSub(this.i.sub(x("imgOnly"),e)),this.addSub(this.i.sub(x("accept"),e)),this.addSub(this.i.sub(x("validationConcurrency"),r=>{this.ke.concurrency=r;}));}get v(){return this.e.uploadCollection}runFileValidators(t,e){if(this.zt)return;let r=e??this.v.items();for(let s of r){let n=this.v.read(s);n&&this.Eu(n,t);}}runCollectionValidators(){if(this.zt)return;let t=this.e.api,e=t.getOutputCollectionState(),r=[],s=this.te.collectionValidators;for(let n of [...this.wu,...s])try{let a=n(e,t);if(!a)continue;a&&(r.push(this.Fn(a)),a.message||console.warn(He.MISSING_ERROR_MESSAGE));}catch(a){console.warn(He.COLLECTION_VALIDATION_FAILED,a);}this.i.pub("*collectionErrors",r),r.length>0&&this.e.eventEmitter.emit(A.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Me.get(t.uid);e&&(e.abortController?.abort(),this.Me.delete(t.uid));}async Eu(t,e){if(this.zt)return;let r=this.e.api,s=this.Nn(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.zt||(await n,this.zt))return;let l=this.xu(t,e);if(l.length===0||!this.v.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=r.getOutputItem(t.uid),d=new AbortController;s.abortController=d;let u=this.te.validationTimeout,h=this.Vn(),m=new Set(l.map(w=>w.validator)),g=[];for(let w of h)if(!m.has(w.validator)){let C=s.lastErrorThrownByValidator.get(w.validator);C&&g.push(C);}let b=l.map(w=>async()=>{if(this.zt)return;let C=setTimeout(()=>{s.skippedValidators.add(w.validator),d.abort(),console.warn(He.FILE_VALIDATION_TIMEOUT);},u);try{let E=await w.validator(c,r,{signal:d.signal});if(!E||d.signal.aborted){s.lastErrorThrownByValidator.set(w.validator,void 0);return}let S=this.Fn(E);s.lastErrorThrownByValidator.set(w.validator,S),g.push(S),E.message||console.warn(He.MISSING_ERROR_MESSAGE);}catch(E){d.signal.aborted||(s.skippedValidators.add(w.validator),console.warn(He.FILE_VALIDATION_FAILED,E),this.e.telemetryManager.sendEventError(E,`file validator. ${He.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(C),w.runOn!=="change"&&s.skippedValidators.add(w.validator);}});if(this.Dn(),await this.ke.add(async()=>{this.zt||(t.setValue("isQueuedForValidation",false),await Promise.all(b.map(w=>w())).catch(()=>{}));},{autoRun:false}),d.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}Fn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Nn(t){let e=this.Me.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Me.set(t.uid,r),r}Vn(){let t=this.te.fileValidators;return [...this.bu,...t].map(zu)}xu(t,e){let r=this.Nn(t);return this.Vn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.zt=true,this.Dn.cancel();for(let t of this.Me.values())t.abortController?.abort(),t.promise=void 0;this.Me.clear();}};var ua="[Typed State] Wrong property name: ",zr=class{constructor(i){this.at=rt.generateFastUid(),this.J=H.registerCtx(i,this.at);}get uid(){return this.at}setValue(i,t){if(!this.J.has(i)){console.warn(`${ua}${String(i)}`);return}this.J.read(i)!==t&&this.J.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.J.has(i)||console.warn(`${ua}${String(i)}`),this.J.read(i)}subscribe(i,t){return this.J.sub(i,t)}destroy(){H.deleteCtx(this.at);}};var Hr=class o{constructor(i){this.Ht=Object.create(null);this.ir=new Set;this.rr=new Set;this.Ct=new Set;this.To=new Set;this.Co=new Set;this.Oe=new Set;this.zn=i.initialValue,this.at=rt.generateFastUid(),this.J=H.registerCtx({},this.at),this._n=i.watchList||[];let t=Object.create(null);this.Bn=(e,r)=>{this.ri&&window.clearTimeout(this.ri),t[e]||(t[e]=new Set),t[e].add(r),this.ri=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.ir.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Hn();},i.handler&&this.observeCollection(i.handler);}static{this.Tu=1e4;}Z(){this.oi&&window.clearTimeout(this.oi),this.oi=window.setTimeout(()=>{let i=new Set(this.Co),t=new Set(this.To);this.Co.clear(),this.To.clear();for(let e of this.rr)e?.([...this.Ct],i,t);this.Hn();});}Hn(){this.Oe.size!==0&&(this.si&&window.clearTimeout(this.si),this.si=window.setTimeout(()=>{let i=[...this.Oe];this.Oe.clear();for(let t of i)t.destroy();},o.Tu));}observeCollection(i){return this.rr.add(i),this.Ct.size>0&&this.Z(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.rr.delete(i);}add(i){let t=new zr(this.zn);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.Ct.add(t.uid),this.Z(),this.J.add(t.uid,t),this.Co.add(t),this._n.forEach(e=>{this.Ht[t.uid]||(this.Ht[t.uid]=[]),this.Ht[t.uid]?.push(t.subscribe(e,()=>{this.Bn(e,t.uid);}));}),t.uid}hasItem(i){return this.Ct.has(i)}read(i){return this.J.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.To.add(t),this.Oe.add(t)),this.Ct.delete(i),this.Z(),this.J.pub(i,void 0),this.Ht[i]?.forEach(e=>{e();}),delete this.Ht[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.Ct.forEach(i=>{this.abort(i);});}clearAll(){this.Ct.forEach(i=>{this.remove(i);});}observeProperties(i){return this.ir.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.ir.delete(i);}findItems(i){let t=[];return this.Ct.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.Ct]}get size(){return this.Ct.size}destroy(){this.ri&&window.clearTimeout(this.ri),this.oi&&window.clearTimeout(this.oi),this.si&&window.clearTimeout(this.si);for(let i of this.Oe)i.destroy();this.Oe.clear(),H.deleteCtx(this.at),this.ir=new Set,this.rr=new Set;for(let i of Object.keys(this.Ht))this.Ht[i]?.forEach(t=>{t();}),delete this.Ht[i];}};var L=Object.freeze({PHOTO:"photo",VIDEO:"video"}),St=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var da=o=>({isVideoRecordingEnabled:j(o.cameraModes).includes(L.VIDEO),isPhotoEnabled:j(o.cameraModes).includes(L.PHOTO)});var pa=(o,i)=>{for(let t of o)if(i(t))return t};var ms=(o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),a=()=>{for(let l of o)if(i(l)){clearTimeout(n),r(l);return}s=requestAnimationFrame(a);};a();});function Kr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}var Hu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Ku=new RegExp(`^/?(${Hu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),ha=({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(vi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Ku.exec(r.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var mt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",BOX:"box",ONEDRIVE:"onedrive"}),ju=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),U=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...ju,...mt}),Gu={[mt.DROPBOX_CHOOSER]:mt.DROPBOX},ma=o=>Gu[o]??o;var jr=o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e));function fa(o){let i=new Map;return (...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s}}var ga=new Set;function Gr(o){ga.has(o)||(ga.add(o),console.warn(o));}function qu(o){let i=false;return setTimeout(()=>{i=true;},0),e=>((...r)=>(i&&Gr(o),e(...r)))}function va(o){let i={},t=o.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>o.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>jr(o),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},r=qu("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 a=s,c=fa(r(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var qr=class extends K{constructor(){super(...arguments);this.Ce=Vr(()=>this.i);this.addFileFromUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??U.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.v.add({uuid:t,fileName:r??null,silent:e??false,source:s??U.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=ha({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.v.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??U.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let a=this.v.add({file:t,isImage:_e(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??U.API,fullPath:n??null});return this.getOutputItem(a)};this.removeFileByInternalId=t=>{if(!this.v.read(t))throw new Error(`File with internalId ${t} not found`);this.v.remove(t);};this.uploadAll=()=>{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.i.pub("*uploadTrigger",new Set(t)),this.e.eventEmitter.emit(A.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=Kt(Ir([this.cfg.accept??"",...this.cfg.imgOnly?wi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),Kr(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:a}=da(this.cfg);t.modeCamera===L.PHOTO&&n?s.accept=bi:t.modeCamera===L.VIDEO&&a?s.accept=rs:s.accept=[bi,a&&rs].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?U.CAMERA:U.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.v.size>0&&!t)this.i.pub("*currentActivity",N.UPLOAD_LIST),this.e.modalManager?.open(N.UPLOAD_LIST);else if(this.Kn?.length===1){let e=this.Kn[0];this.So().then(()=>{let r=this.e.pluginManager.snapshot().sources,s=r.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(r.find(l=>l.id===n[0])??s).onSelect():(this.i.pub("*currentActivity",N.START_FROM),this.e.modalManager?.open(N.START_FROM));return}this.i.read("*currentActivity")&&this.e.modalManager?.open(this.i.read("*currentActivity"));});}else this.i.pub("*currentActivity",N.START_FROM),this.e.modalManager?.open(N.START_FROM);};this.doneFlow=()=>{let t=pa(this.e.blocksRegistry,e=>"doneActivity"in e);t&&(this.i.pub("*currentActivity",t.doneActivity),this.i.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.i.read("*currentActivity")||this.e.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{this.So().then(()=>{this.i.pub("*currentActivityParams",e[0]??{}),this.i.pub("*currentActivity",t),ms(this.e.blocksRegistry,r=>r.activityType===t,{onTimeout:()=>console.warn(`Activity type "${t}" not found in the context`),timeout:100});});};this.on=(t,e)=>this.e.eventEmitter.on(t,e);this.getCurrentActivity=()=>this.i.read("*currentActivity");this.historyBack=()=>{this.i.read("*historyBack")?.();};this.setModalState=t=>{this.So().then(()=>{if(!t){this.e.modalManager?.close(this.i.read("*currentActivity")),this.i.pub("*currentActivity",null);return}let e=this.i.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return ms(this.e.blocksRegistry,r=>r.activityType===e,{onTimeout:()=>console.warn(`Activity block "${e}" not found in the context`)}).then(()=>{this.e.modalManager?.open(e);})});};}get v(){return this.e.uploadCollection}get cfg(){return this.te}get l10n(){return this.Ce}removeAllFiles(){this.v.clearAll();}getOutputItem(t){let e=H.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 va(this.e)}async So(){return (await this.e.wait("pluginManager")).pluginsReady()}get Kn(){let t=[];return this.cfg.sourceList&&(t=Z(this.cfg.sourceList)),t}};var ya={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 xi=33.333333333333336,k=1,fs=24,ba=6;function ae(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}function yt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return ae(t,i),t}function wa(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*s+1.5*c,r+l*n+1.5*d-24*t*d],h=[e+a*s+1.5*c,r+l*n+1.5*d],m=[e+a*s-24*t*c+1.5*c,r+l*n+1.5*d],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`,b=[h[0],h[1]];return {d:g,center:b}}function Ea(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,m,g;a?(m=[e+c*s-34*t/2,r+d*n+1.5*h],g=[e+c*s+34*t/2,r+d*n+1.5*h]):(m=[e+c*s+1.5*u,r+d*n-34*t/2],g=[e+c*s+1.5*u,r+d*n+34*t/2]);let b=`M ${m[0]} ${m[1]} L ${g[0]} ${g[1]}`,w=[(m[0]+g[0])/2,(m[1]+g[1])/2];return {d:b,center:w}}function Ca(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}function Ta({rect:o,delta:[i,t],imageBox:e}){return je({...o,x:o.x+i,y:o.y+t},e)}function je(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}}function Wu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;s+=r,a-=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,a=o.y+o.height-s,t&&(n=a*t,l=o.x+o.width/2-n/2)),l<=e.x&&(l=e.x,s=o.y+o.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y+o.height-a),a<k&&(a=k,t&&(n=a*t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),n<k&&(n=k,t&&(a=n/t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),{x:l,y:s,width:n,height:a}}function Zu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;s+=r,n-=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(a=n/t,l=o.y+o.height/2-a/2)),l<=e.y&&(l=e.y,s=o.x+o.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x+o.width-n),a<k&&(a=k,t&&(n=a*t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),n<k&&(n=k,t&&(a=n/t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),{x:s,y:l,width:n,height:a}}function Yu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;a+=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=o.x+o.width/2-n/2),l<=e.x&&(l=e.x,s=o.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y),a<k&&(a=k,t&&(n=a*t),l=o.x+o.width/2-n/2),n<k&&(n=k,t&&(a=n/t),l=o.x+o.width/2-n/2),{x:l,y:s,width:n,height:a}}function Xu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;n+=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=o.y+o.height/2-a/2),l<=e.y&&(l=e.y,s=o.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x),a<k&&(a=k,t&&(n=a*t),l=o.y+o.height/2-a/2),n<k&&(n=k,t&&(a=n/t),l=o.y+o.height/2-a/2),{x:s,y:l,width:n,height:a}}function Qu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+s<e.y&&(s=e.y-a),n+=r,l-=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x+o.width-l,a=e.y)):t&&(r=c*t-l,l=l+r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y+o.height-c)),c<k&&(c=k,t&&(l=c*t),n=o.x+o.width-l,a=o.y+o.height-c),l<k&&(l=k,t&&(c=l/t),n=o.x+o.width-l,a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function Ju({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x,a=e.y)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y+o.height-c)),c<k&&(c=k,t&&(l=c*t),a=o.y+o.height-c),l<k&&(l=k,t&&(c=l/t),a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function td({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=r,l-=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x+o.width-l,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y)),c<k&&(c=k,t&&(l=c*t),n=o.x+o.width-l),l<k&&(l=k,t&&(c=l/t),n=o.x+o.width-l),{x:n,y:a,width:l,height:c}}function ed({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y)),c<k&&(c=k,t&&(l=c*t)),l<k&&(l=k,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function xa({direction:o,...i}){switch(o){case "n":return Wu(i);case "w":return Zu(i);case "s":return Yu(i);case "e":return Xu(i);case "nw":return Qu(i);case "ne":return Ju(i);case "sw":return td(i);case "se":return ed(i);default:return i.rect}}function Sa(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}function Aa(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}function ka(o,i){return Math.abs(o.width/o.height-i)<.1}function Ge({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}function Ma(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),a=Math.round((i-s)/2);return n+r>o&&(r=o-n),a+s>i&&(s=i-a),{x:n,y:a,width:r,height:s}}function qe(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}function le(o,i,t){return Math.min(Math.max(o,i),t)}var Si=["free"],Zr=o=>{let i=Z(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&&!Si.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),a=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!Si.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:rt.generateFastUid(),type:"aspect-ratio",width:Si.includes(r)?0:n,height:Si.includes(r)?0:a,hasFreeform:Si.includes(r)});}return t},Ia=(o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(r-d);u<n&&(n=u,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(r-c)/c>e)return null}return s};function Oa(o){return jo({...o,libraryName:Rt,libraryVersion:Ut})}var La="active",We="___ACTIVITY_IS_ACTIVE___",Pa,$=class o extends(Pa=T,Pa){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Qo(this);this.Cu=F(this.Su.bind(this),10);}jn(){let t=o.ni.get(this);this[We]=false,this.removeAttribute(La),t?.deactivateCallback?.();}Au(){let t=o.ni.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[We]=true,this.setAttribute(La,""),t?.activateCallback?.(),this.Cu(),this.emit(A.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[We]?this.jn():this.activityType===t&&!this[We]&&this.Au();}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"]=[]);}));}Su(){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);}Gn(){return !!this.activityType&&o.ni.has(this)}static{this.ni=new Map;}get isActivityActive(){return !!this[We]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ni.set(this,{activateCallback:r,deactivateCallback:s});}ku(){this.isActivityActive&&this.jn(),o.ni.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Gn()&&this.ku();}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();}}};$.activities=N;var M=class o extends ${constructor(){super(...arguments);this.couldBeCtxOwner=false;this.or=false;this.init$=Jo(this);this.Mo=F(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Lu(e);},300);this.Iu=(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(A.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.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(A.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Zn(),this.Mo();}};this.Pu=t=>{if(!this.isConnected)return;this.Mo();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)&&!!H.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=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Zn();}if(t.isUploading)for(let s of t.isUploading){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=H.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Ru();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=H.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(A.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(A.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(A.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(A.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Zn=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(A.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get Mu(){return this.hasBlockInCtx(t=>t instanceof o?t.or&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Y("*uploadCollection",()=>new Hr({initialValue:ya,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Y("*secureUploadsManager",t=>new _r(t)),this.Y("*validationManager",t=>new Br(t)),this.Y("*publicApi",t=>new qr(t)),!this.Mu&&this.couldBeCtxOwner&&this.Ou();}getAPI(){return this.api}get validationManager(){return this.Q("*validationManager")}get api(){return this.Q("*publicApi")}get uploadCollection(){return this.Q("*uploadCollection")}get secureUploadsManager(){return this.Q("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.or&&this.qn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.or&&this.Wn();}Ou(){this.or=true,this.Wn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Wn(){this.qn(),this.Ao=this.uploadCollection.observeCollection(this.Iu),this.ko=this.uploadCollection.observeProperties(this.Pu);}qn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async Lu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await Kn(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(A.GROUP_CREATED,a),this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}Ru(){let t=Zr(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:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=Ma(a,l,c),u=ot(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:u,cdnUrl:W(h,u)});}}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:Oa,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 jr(this.e)}};M.extSrcList=Object.freeze({...mt});M.sourceTypes=Object.freeze({...U});var ce=class extends T{constructor(){super(...arguments);this.name="";this.sr="";this.ai=null;this.Yn=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Yn=e,this.Oo();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Oo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Oo();}Oo(){if(!this.name){this.sr="",this.ai=null;return}let e=this.e.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.ai=e.svg,this.sr="";return}this.ai=null;let r=`#uc-icon-${this.name}`,s=this.Yn?.(this.name);this.sr=s??r;}render(){return this.ai?v`${this.yield("",v`${ze(this.ai)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.sr}></use></svg>`)} `}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};p([y({type:String})],ce.prototype,"name",2),p([f()],ce.prototype,"sr",2),p([f()],ce.prototype,"ai",2);var Ra=o=>[...new Set(o)];var Ae="--uc-img-",gs="unresolved";var vs=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ys=3e3,bs=5e3,ws=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var id="https://ucarecdn.com",Ze=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:id},"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 Yr=class extends Ue($e(Tt)){constructor(){super();this.Ie={};this.c=new Map;this.Pe=null;this.nr=null;for(let t in Ze){let e=Ze[t];this.Ie[Ae+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.Ie[Ae+t]}set$$(t){for(let e in t){let r=Ae+e,s=t[e];this.Ie[r]=s,this.Z(r,s);}}sub$$(t,e){let r=Ae+t;this.c.has(r)||this.c.set(r,new Set),this.c.get(r)?.add(e);let s=this.Ie[r];s!==null&&s!==""&&e(s);}Z(t,e){this.c.has(t)&&this.c.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${Rt}/${Ut}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;Ze[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.Pe=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.Pe?.unobserve(t));});},r),this.Pe.observe(t),this.nr||(this.nr=new Set),this.nr.add(t);}connectedCallback(){super.connectedCallback(),this.Uu();}Uu(){for(let t in Ze){let e=Ae+t,r=this.getCssData(e,true);r!=null&&(this.Ie[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.Pe&&(this.nr?.forEach(t=>{this.Pe?.unobserve(t);}),this.Pe=null),this.c.clear();}static get observedAttributes(){return Object.keys(Ze)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Ae+t;this.Ie[s]=r,this.Z(s,r);});}};var Ua=o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var Jr=class extends Yr{constructor(){super(...arguments);this.Lt=new Image;this.St=new Image;}Xn(t){return !t.includes("//")&&!vs&&(t=new URL(t,document.baseURI).href),t}ar(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)>bs&&this.Qn?bs+s:Number(n)>ys&&!this.Qn?ys+s:t}$u(t,e){let r={format:this.Io("format"),quality:this.Io("quality"),resize:this.ar(t),blur:e,"cdn-operations":this.Io("cdn-operations")??void 0,analytics:this.analyticsParams()};return ot(...Ua(r))}Io(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}gt(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(vs&&r&&!r.includes("//"))return this.li(r);let s=this.$u(t,e),n=this.$$("cdn-cname"),a=n;if(r.startsWith(String(n)))return W(r,s);let l=this.$$("uuid");if(a&&l)return this.li(W(ee(a,l),s));if(l)return this.li(W(ee(a,l),s));let c=this.$$("proxy-cname");if(c)return this.li(W(c,s,this.Xn(r)));let d=this.$$("pubkey");if(d)return this.li(W(`https://${d}.ucr.io/`,s,this.Xn(r)))}li(t){let e=this.$$("secure-delivery-proxy");return e?Be(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}Le(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=r?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Du(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.Rt||(this.Po({elNode:this.Lt}),this.appendChild(this.Lt)),this.Lt}get lr(){return this.Rt?{type:ws.PREVIEW,img:this.St}:{type:ws.MAIN,img:this.img}}get Rt(){return this.$$("is-preview-blur")}get Jn(){return this.$$("is-background-for")}get ta(){let t=this.$$("breakpoints");if(t){let e=Z(t);return Ra(e.map(r=>parseInt(r,10)))}else return null}get Qn(){return this.$$("format").toLowerCase()==="jpeg"}ea(t){let e=new Set;e.add(`url("${this.gt(this.Le(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.gt(this.Le(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.gt(this.Le(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}ia(){let t=new Set;return this.ta?this.ta.forEach(e=>{t.add(`${this.gt(`${e}x`)} ${this.ar(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.gt(`${e*2}x`)} ${this.ar(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.gt(`${e*3}x`)} ${this.ar(`${e*3}w`)}`);}):(t.add(`${this.gt(this.Le(this.lr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.gt(this.Le(this.lr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.gt(this.Le(this.lr.img,3))} 3x`)),[...t].join()}ra(){return this.gt()}get oa(){return this.gt("100x","100")}Fu(){let t=this.Jn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.ea(e);}):this.ea(e);});}Nu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Po({elNode:t}){this.Du(t),this.initAttributes(t);}Lo({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.Po({elNode:r}),r.setAttribute(gs,""),r.addEventListener("load",()=>{r.removeAttribute(gs),s(r);}),r.addEventListener("error",()=>{n(false);}),this.Nu({elNode:r,src:t,srcset:e});})}async Vu(){if(this.$$("intersection")){this.Rt&&(this.Po({elNode:this.St}),this.appendChild(this.St)),this.initIntersection(this.lr.img,async()=>{this.Rt&&(this.St.src=this.oa);try{await this.Lo({src:this.ra(),srcset:this.ia(),elNode:this.Lt}),this.Rt&&await this.St.remove(),this.appendChild(this.Lt);}catch{this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}});return}try{this.Rt&&(await this.Lo({src:this.oa,elNode:this.St}),this.appendChild(this.St)),await this.Lo({src:this.ra(),srcset:this.ia(),elNode:this.Lt}),this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}catch{this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}}init(){this.Jn?this.Fu():this.Vu();}};var Es=class extends Jr{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:rd}=fn,$a=o=>o;var Cs=(o,i)=>o?.Nt!==void 0,Fa=o=>o?.Nt?.h!=null;var Va=o=>o.strings===void 0,Da=()=>document.createComment(""),Xt=(o,i,t)=>{let e=o.Pt.parentNode,r=i===void 0?o.we:i.Pt;if(t===void 0){let s=e.insertBefore(Da(),r),n=e.insertBefore(Da(),r);t=new rd(s,n,o,o.options);}else {let s=t.we.nextSibling,n=t.f,a=n!==o;if(a){let l;t._u?.(o),t.f=o,t._i!==void 0&&(l=o.X)!==n.X&&t._i(l);}if(s!==r||a){let l=t.Pt;for(;l!==s;){let c=$a(l).nextSibling;$a(e).insertBefore(l,r),l=c;}}}return t},ue=(o,i,t=o)=>(o.Et(i,t),o),od={},Ai=(o,i=od)=>o.r=i,ki=o=>o.r,to=o=>{o.Ee(),o.Pt.remove();},Na=o=>{o.Ee();};var Mi=(o,i)=>{let t=o.wt;if(t===void 0)return false;for(let e of t)e.un?.(i,false),Mi(e,i);return true},eo=o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.wt,t.delete(o),o=i;}while(t?.size===0)},_a=o=>{for(let i;i=o.f;o=i){let t=i.wt;if(t===void 0)i.wt=t=new Set;else if(t.has(o))break;t.add(o),ad(i);}};function sd(o){this.wt!==void 0?(eo(this),this.f=o,_a(this)):this.f=o;}function nd(o,i=false,t=0){let e=this.r,r=this.wt;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Mi(e[s],false),eo(e[s]);else e!=null&&(Mi(e,false),eo(e));else Mi(this,o);}var ad=o=>{o.type==$t.CHILD&&(o._i??=nd,o._u??=sd);},io=class extends ht{constructor(){super(...arguments),this.wt=void 0;}ro(i,t,e){super.ro(i,t,e),_a(this),this.isConnected=i.X;}un(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Mi(this,i),eo(this));}setValue(i){if(Va(this.er))this.er.Et(i,this);else {let t=[...this.er.r];t[this.yu]=i,this.er.Et(t,this,0);}}disconnected(){}reconnected(){}};var I=()=>new xs,xs=class{},Ts=new WeakMap,O=at(class extends io{render(o){return P}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)),P}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=Ts.get(i);t===void 0&&(t=new WeakMap,Ts.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"?Ts.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 Ss=null,Ii=class extends T{constructor(){super(...arguments);this.dialogEl=I();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);};this.Bu=()=>{this.closeDialog();};this.zu=t=>{this.Ro=t.target;};this.Hu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Ro&&this.closeDialog();};this.ci=({id:t})=>{t===this.id?(Ss=t,this.show(),this.emit(A.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.ui=({id:t})=>{t===this.id&&(this.hide(),this.emit(A.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.sa=t=>{this.hide(),Ss===this.id&&this.emit(A.MODAL_CLOSE,{modalId:Ss,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}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(Y.OPEN,this.ci),this.modalManager?.subscribe(Y.CLOSE,this.ui),this.modalManager?.subscribe(Y.CLOSE_ALL,this.sa);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Ro=void 0,this.modalManager?.unsubscribe(Y.OPEN,this.ci),this.modalManager?.unsubscribe(Y.CLOSE,this.ui),this.modalManager?.unsubscribe(Y.CLOSE_ALL,this.sa);}Ku(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Bu),this.dialogEl.value?.addEventListener("mousedown",this.zu),this.dialogEl.value?.addEventListener("mouseup",this.Hu);}render(){return v`<dialog ${O(this.Ku)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],Ii.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ii.prototype,"blockBodyScrolling",2);var ro=class extends M{constructor(){super(...arguments);this.K=null;this.cr=null;}get na(){return this.nameAttrValue??this.ctxName}aa(){let t=document.createElement("input");return t.type="text",t.name=this.na,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Kr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.aa(),this.appendChild(this.K),this.sub("*collectionState",t=>{if(!t)return;if(!this.cr){let n=document.createElement("div");this.appendChild(n),this.cr=n;}if(!this.K){let n=this.aa();this.appendChild(n),this.K=n;}if(this.cr.innerHTML="",t.status==="uploading"||t.status==="idle"){this.K.value="",this.K.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.K.value="",this.K.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.K.value=e.cdnUrl??"",this.K.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.K.value=r[0],this.K.setCustomValidity("");return}this.K.remove(),this.K=null;let s=new DocumentFragment;for(let n of r){let a=document.createElement("input");a.type="hidden",a.name=`${this.na}[]`,a.value=n,s.appendChild(a);}this.cr.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],ro.prototype,"nameAttrValue",2);var As=class extends T{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Ye=class extends T{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.At=0;this.ur=I();this.la=()=>{let t=this.ur.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.At>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.At=this.Uo(this.value),this.$o(),this.ur.value?.addEventListener("animationiteration",this.la);}updated(t){if(super.updated(t),t.has("value")){let e=this.Uo(this.value);if(!this.visible)this.At=e;else {let r=Math.max(this.At,e);r!==this.At&&(this.At=r,this.$o());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.$o():this.At=this.Uo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.ur.value?.removeEventListener("animationiteration",this.la);}Uo(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}$o(){this.visible&&this.style.setProperty("--l-progress-value",this.At.toString());}render(){return v`<div ${O(this.ur)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],Ye.prototype,"hasFileName",2),p([y({type:Number})],Ye.prototype,"value",2),p([y({type:Boolean,reflect:true})],Ye.prototype,"visible",2);var Oi=class extends M{constructor(){super();this.kt=false;this.Re=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this.Do=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.kt=t;}),this.sub("*commonProgress",t=>{this.Re=t;});}updated(t){super.updated(t),t.has("visible")&&(this.kt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Do?.(),this.Do=void 0;}render(){return v`<uc-progress-bar .value=${this.Re} .visible=${this.kt}></uc-progress-bar>`}};p([f()],Oi.prototype,"kt",2),p([f()],Oi.prototype,"Re",2);var Xe=class extends T{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.ju=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")));};}render(){return v`<select @change=${this.ju} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],Xe.prototype,"value",2),p([y({type:Boolean,reflect:true})],Xe.prototype,"disabled",2),p([y({type:Array,attribute:false})],Xe.prototype,"options",2);var de=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Fo="default";this.dr="";}willUpdate(t){super.willUpdate(t),t.has("source")&&this.Gu(this.source);}Gu(t){if(!t){this.dr="",this.Fo="default";return}let{label:e,icon:r,id:s}=t;this.dr=e,this.Fo=r??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return v`<button aria-label=${this.l10n(this.dr)} type="button" @click=${this.activate}>${this.textOnly?"":v`<uc-icon name=${this.Fo}></uc-icon>`} ${this.iconOnly?"":v`<div class="uc-txt">${this.l10n(this.dr)}</div>`}</button>`}};p([y({attribute:false})],de.prototype,"source",2),p([y({type:Boolean})],de.prototype,"textOnly",2),p([y({type:Boolean})],de.prototype,"iconOnly",2),p([f()],de.prototype,"Fo",2),p([f()],de.prototype,"dr",2);var Qe=class{constructor(i,t){this.ca=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.ua=t.onSourcesChange,i.addController(this);}hostConnected(){this.No=this.i.sub(x("sourceList"),t=>{this.ca=Z(t),this.Vo();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.E=i.onPluginsChange(()=>this.Vo())),this.Vo();}hostDisconnected(){this.E?.(),this.E=void 0,this.No?.(),this.No=void 0;}Vo(){let t=this.e.pluginManager?.snapshot().sources??[],e=new Map(t.map(s=>[s.id,s])),r=[];this.ca.forEach(s=>{let n=this.qu(s,e);if(n.length!==1||n[0]!==s){for(let c of n){let d=e.get(c);d&&r.push(this.da(d));}return}let l=e.get(s);l&&r.push(this.da(l));}),this.ua(r);}qu(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}da(i){return {id:i.id,label:i.label,icon:i.icon,onClick:()=>i.onSelect()}}};var Li=class extends M{constructor(){super(...arguments);this.z=[];this.wrap=false;}initCallback(){super.initCallback(),new Qe(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.z=t;}});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return v`${this.z.map(t=>v`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};p([f()],Li.prototype,"z",2),p([y({type:Boolean,attribute:"wrap",noAccessor:true})],Li.prototype,"wrap",2);var ks=class extends T{render(){return v`<div class="uc-spinner"></div>`}};var Ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function ke(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:()=>{i.naturalWidth===0&&(i.src=Ot);}}}function Pi(o){let i=[];for(let s of o){let n=ke(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function Ms(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,a)=>{r.onload=()=>{let l=r.height/r.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),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(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},r.onerror=l=>{a(l);};});return r.src=URL.createObjectURL(o),s}var Je=class extends M{constructor(){super(...arguments);this.pr=new Set;this.entry=null;}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 a=r.subscribe(s,l=>{this.isConnected&&n(l);});this.pr.add(a);})(t,e);}reset(){for(let t of this.pr)t();this.pr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.pr=new Set;}};function ld(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}function oo(o="hsl(209, 21%, 65%)",i=32,t=32){return ld(`<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>`)}var cd=3e3,ti=class extends Je{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Kt="";this.pa=false;this.hr=null;this.ha=false;this.Wu=this.cfg.filesViewMode;this.fa=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.Zu(e);if(r&&s&&n){let d=await this.proxyUrl(W(ee(this.cfg.cdnCname,n),ot(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:u}=ke(d);u.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let m=await Ms(h,l);t.setValue("thumbUrl",m);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(m));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await Ms(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(u));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(d));}});this.fr=F(this.fa.bind(this),100);}Zu(t=false){t&&(this.hr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.hr?.height||0),10),parseInt(String(this?.hr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,cd)}Yu(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=Ot,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),r();},d=u=>{a(),s(u);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}Bo(){this._o?.cancel(),this._o=void 0;}Xu(t){if(this.Bo(),!t){this.Kt&&(this.Kt="");return}if(t===this.Kt)return;let e=new AbortController,r={controller:e,cancel:()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);}};this._o=r,this.Yu(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Kt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}mr(t=false){if(this.entry){if(t){this.fa(true);return}this.ha&&this.fr();}}firstUpdated(t){super.firstUpdated(t),this.ma();}updated(t){super.updated(t),t.has("uid")&&this.ma();}di(t){let[e]=t;e&&(this.ha=e.isIntersecting,e.isIntersecting&&(this.hr=e.boundingClientRect,this.mr(),this.s?.disconnect()),e.intersectionRatio===0&&this.fr.cancel());}reset(){super.reset(),this.fr.cancel(),this.Bo(),this.Kt&&(this.Kt="");}ma(){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=()=>{this.mr();};this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.Xu(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.mr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.pa&&(this.Wu==="list"&&this.mr(true),this.pa=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.fr.cancel(),this.Bo(),this.s?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Kt||Ot} role="img" alt="Preview of uploaded image" ?hidden=${!this.Kt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],ti.prototype,"badgeIcon",2),p([y({attribute:false})],ti.prototype,"uid",2),p([f()],ti.prototype,"Kt",2);var Is=class extends ${};var Os=class extends ${constructor(){super(...arguments);this.historyTracked=true;this.activityType=$.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var Ls=class extends M{constructor(){super(...arguments);this.ga=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=A;}initCallback(){super.initCallback(),this.ga=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ga?.();}};var pe=(o,i)=>{let t=false,e,r=0,s=((...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);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var Ba=(o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},Ri=at(class extends ht{constructor(o){if(super(o),o.type!==$t.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],n=0;for(let a of o)r[n]=e?e(a,n):n,s[n]=t(a,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=ki(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let a=this.ut??=[],l=[],c,d,u=0,h=r.length-1,m=0,g=s.length-1;for(;u<=h&&m<=g;)if(r[u]===null)u++;else if(r[h]===null)h--;else if(a[u]===n[m])l[m]=ue(r[u],s[m]),u++,m++;else if(a[h]===n[g])l[g]=ue(r[h],s[g]),h--,g--;else if(a[u]===n[g])l[g]=ue(r[u],s[g]),Xt(o,l[g+1],r[u]),u++,g--;else if(a[h]===n[m])l[m]=ue(r[h],s[m]),Xt(o,r[u],r[h]),h--,m++;else if(c===void 0&&(c=Ba(n,m,g),d=Ba(a,u,h)),c.has(a[u]))if(c.has(a[h])){let b=d.get(n[m]),w=b!==void 0?r[b]:null;if(w===null){let C=Xt(o,r[u]);ue(C,s[m]),l[m]=C;}else l[m]=ue(w,s[m]),Xt(o,r[u],w),r[b]=null;m++;}else to(r[h]),h--;else to(r[u]),u++;for(;m<=g;){let b=Xt(o,l[g+1]);ue(b,s[m]),l[m++]=b;}for(;u<=h;){let b=r[u++];b!==null&&to(b);}return this.ut=n,Ai(o,l),it}});var lt=at(class extends ht{constructor(o){if(super(o),o.type!==$t.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter(i=>o[i]).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return it}});var za="file-item-remove-button",Me=class extends M{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}pi(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=lt({"uc-remove-btn":true,"uc-mini-btn":true,"uc-idle":this.idle,"uc-uploading":this.uploading,"uc-failed":this.failed,"uc-success":this.success});return v`<button type="button" @click=${this.pi} title=${this.l10n(za)} aria-label=${this.l10n(za)} class=${t} ><uc-icon name="remove-file"></uc-icon><uc-icon name="close"></uc-icon></button>`}};p([y({type:Boolean})],Me.prototype,"uploading",2),p([y({type:Boolean})],Me.prototype,"failed",2),p([y({type:Boolean})],Me.prototype,"success",2),p([y({type:Boolean})],Me.prototype,"idle",2);var X=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")}),G=class G extends Je{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.va=true;this.uid="";this.zo="";this.Ho="";this.Ko="";this.At=0;this.ya=false;this.jo="";this.Go=false;this.qo=false;this.ba=false;this.wa=false;this.Wo=false;this.Ea="";this.gr=[];this.xa=false;this.pi=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Qu=()=>{this.Ta();};this.S=F(()=>this.Ca(),100);this.td=this.withEntry(pe((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===X.FINISHED,l=e===X.UPLOADING,c=e===X.QUEUED_UPLOADING,d=e===X.QUEUED_VALIDATION,u=e===X.VALIDATION,h=t.getValue("fileName"),m="";r?m="":!a&&n&&s&&Object.values(mt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${ma(s)}`)})),this.Ko=m,this.Ho=r,this.ya=l||c||d||u,this.At=d||u?0:t.getValue("uploadProgress"),this.Ea=h?this.l10n("a11y-file-item-status",{fileName:h,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Ta=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=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(m=>m.type==="beforeUpload");for(let m of h)try{let g=m.handler({file:a,signal:r.signal}),b=new Promise((C,E)=>setTimeout(()=>E(new Error("beforeUpload hook timed out")),m.timeout)),{file:w}=await Promise.race([g,b]);w!==a&&(a=w,t.setValue("mimeType",a.type||null),t.setValue("isImage",_e(a)),t.setValue("fileSize",a.size),a instanceof File&&t.setValue("fileName",a.name));}catch(g){console.warn(`File hook "beforeUpload" from plugin "${m.pluginId}" failed`,g);}}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:u=>{if(u.isComputable){let h=u.value*100;t.setValue("uploadProgress",h);}},signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,d),Yo(l,d)},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 re&&r.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof Ee?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");}}});}Ca(){let t=this.entry;if(!t)return;let e=X.IDLE;t.getValue("errors").length>0?e=X.FAILED:t.getValue("isQueuedForUploading")?e=X.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=X.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=X.VALIDATION:t.getValue("isUploading")?e=X.UPLOADING:t.getValue("fileInfo")&&(e=X.FINISHED),this.Ju(t,e);}Ju(t,e){e===X.FAILED?this.jo="badge-error":e===X.FINISHED&&(this.jo="badge-success"),e===X.UPLOADING&&(this.wa=false,this.removeAttribute("focused")),this.qo=e===X.FAILED,this.ba=e===X.UPLOADING,this.Go=e===X.FINISHED,this.td(e);}reset(){super.reset(),this.S.cancel();}di(t){let[e]=t;e&&e.isIntersecting&&!this.xa&&(this.va=false,this.xa=true);}Sa(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.ae();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.zo=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.zo=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.ae()),this.subEntry("isUploading",()=>this.ae()),this.subEntry("errors",()=>this.ae()),this.Ca(),this.ae();}Aa(t){if(this.cfg.filesViewMode==="list"){this.Wo=true;return}this.Wo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Sa(this.uid);}ae(){let t=this.e.pluginManager;if(!t||!this.uid){this.gr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.gr=[];return}this.gr=e.filter(s=>{try{return s.shouldRender(r)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}ed(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.Sa(this.uid),this.subConfigValue("filesViewMode",e=>{this.Aa(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.Aa(e);}),this.onclick=()=>{G.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.Ta());});let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.ae())),this.ae(),G.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback(),this.s?.disconnect(),G.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.va?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.Go} ?data-uploading=${this.ba} ?data-failed=${this.qo} ?data-focused=${this.wa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.jo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.Ea}><span class="uc-file-name" ?hidden=${!this.Wo}>${this.zo}</span><span class="uc-file-error" ?hidden=${!this.Ho}>${this.Ho}</span><span class="uc-file-hint" ?hidden=${!this.Ko}>${this.Ko}</span></div><div class="uc-file-actions">${this.gr.map(t=>v`<button type="button" @click=${()=>this.ed(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>`)}<uc-file-action-button @uc:remove=${this.pi} .uploading=${this.ya} .failed=${this.qo} .success=${this.Go}></uc-file-action-button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Qu}><uc-icon name="upload"></uc-icon></button></div></div>`}};p([f()],G.prototype,"va",2),p([y({attribute:false})],G.prototype,"uid",2),p([f()],G.prototype,"zo",2),p([f()],G.prototype,"Ho",2),p([f()],G.prototype,"Ko",2),p([f()],G.prototype,"At",2),p([f()],G.prototype,"ya",2),p([f()],G.prototype,"jo",2),p([f()],G.prototype,"Go",2),p([f()],G.prototype,"qo",2),p([f()],G.prototype,"ba",2),p([f()],G.prototype,"wa",2),p([f()],G.prototype,"Wo",2),p([f()],G.prototype,"Ea",2),p([f()],G.prototype,"gr",2);var Ps=G;function ud(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}function dd(o,i){return new Promise(t=>{let e=0,r=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});r.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(r);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(r);});};s(o);})}function Ha(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 l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(dd(l,s).then(c=>{c&&i.push(...c);}));continue}let a=r.getAsFile();a&&t.push(ud(a).then(l=>{l||i.push({type:"file",file:a});}));}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)}var ct=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Ka=["focus"],pd=100,Rs=new Map;function hd(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))}function Us(o){let i=0,t=document.body,e=new Set,r=g=>{e.add(g);},s=ct.INACTIVE,n=g=>{o.shouldIgnore()&&g!==ct.INACTIVE||(s!==g&&e.forEach(b=>{b(g);}),s=g);},a=()=>i>0;r(g=>o.onChange(g));let l=()=>{i=0,n(ct.INACTIVE);},c=()=>{i+=1,s===ct.INACTIVE&&n(ct.ACTIVE);},d=()=>{i-=1,a()||n(ct.INACTIVE);},u=g=>{g.preventDefault(),i=0,n(ct.INACTIVE);},h=g=>{if(o.shouldIgnore())return;a()||(i+=1);let b=[g.x,g.y],w=o.element.getBoundingClientRect(),C=Math.floor(hd(b,w)),E=C<pd,S=g.composedPath().includes(o.element);Rs.set(o.element,C);let Ct=Math.min(...Rs.values())===C;S&&Ct?(g.preventDefault(),n(ct.OVER)):n(E&&Ct?ct.NEAR:ct.ACTIVE);},m=async g=>{if(o.shouldIgnore())return;g.preventDefault();let{dataTransfer:b}=g;if(!b)return;let w=await Ha(b);o.onItems(w),n(ct.INACTIVE);};return t.addEventListener("drop",u),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),o.element.addEventListener("drop",m),Ka.forEach(g=>{window.addEventListener(g,l);}),()=>{Rs.delete(o.element),t.removeEventListener("drop",u),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),o.element.removeEventListener("drop",m),Ka.forEach(g=>{window.removeEventListener(g,l);});}}var $s=new Set,bt=class extends M{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.Bt=true;this.ka=true;this.Zo="drop-files-here";this.Ue=false;this.Oa=null;this.Yo=null;this.Ia=I();this.$e=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.Pa=true;this.De=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Ma(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Zo=t;return}this.Zo=this.Ue?"drop-files-here":"drop-file-here";}isActive(){if(!this.Bt)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(),$s.add(this),this.Xo(),this.Qo(),this.La(),this.Ra(ct.INACTIVE),this.Oa=Us({element:this,shouldIgnore:()=>this.Ua(),onChange:t=>{this.Ra(t);},onItems:t=>{if(!t.length)return;let e=this.uploadCollection.size;t.forEach(r=>{r.type==="url"?this.api.addFileFromUrl(r.url,{source:U.DROP_AREA}):r.type==="file"&&this.api.addFileFromObject(r.file,{source:U.DROP_AREA,fullPath:r.fullPath});}),this.uploadCollection.size>e&&this.routerLayer.navigateAfterFileAdd();}}),this.updateComplete.then(()=>this.rd()),this.subConfigValue("sourceList",t=>{let e=Z(t);this.Pa=e.includes(U.LOCAL),this.Xo(),this.Qo();}),this.subConfigValue("multiple",t=>{this.Ue=!!t,this.Ma();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Xo(),this.Qo()),(t.has("text")||t.has("localeId"))&&this.Ma();}updated(t){super.updated(t),t.has("clickable")&&this.La();}Ua(){if(!this.Bt||!this.od())return true;if(!this.fullscreen)return false;let t=$s;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}od(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Xo(){let t=this.Pa&&!this.disabled;this.Bt=t;}Qo(){let t=this.Bt||!this.querySelector("[data-default-slot]");this.ka=t,this.hidden=!t;}Ra(t){let e=Object.entries(ct).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}rd(){if(this.Yo)return;let t=this.Ia.value;t&&(this.Yo=Us({element:t,onChange:e=>{let r=Object.entries(ct).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},onItems:()=>{},shouldIgnore:()=>this.Ua()}));}La(){this.clickable&&!this.De?(this.addEventListener("keydown",this.$e),this.addEventListener("click",this.$e),this.De=true):!this.clickable&&this.De&&(this.removeEventListener("keydown",this.$e),this.removeEventListener("click",this.$e),this.De=false);}disconnectedCallback(){super.disconnectedCallback(),$s.delete(this),this.Oa?.(),this.Yo?.(),this.De&&(this.removeEventListener("keydown",this.$e),this.removeEventListener("click",this.$e),this.De=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${O(this.Ia)} class="uc-content-wrapper" ?hidden=${!this.ka} ><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.l10n(this.Zo)}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],bt.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],bt.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],bt.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],bt.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],bt.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],bt.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],bt.prototype,"initflow",2),p([y({type:String})],bt.prototype,"text",2),p([f()],bt.prototype,"Bt",2),p([f()],bt.prototype,"ka",2);var Lt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=$.activities.UPLOAD_LIST;this.$a=false;this.Da=false;this.Fa=false;this.Jo=false;this.ts=false;this.vr=null;this.Na=false;this.es=null;this.Va=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.rs=()=>{this.emit(A.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.os=()=>{this.emit(A.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ut=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.q=pe(()=>{this.isConnected&&(this.ad(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get sd(){return this.es?this.nd(this.es):""}ad(){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),a=t.allEntries.some(m=>m.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,u=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&l&&this.cfg.confirmUpload)c=true;else {d=true;let m=this.cfg.groupOutput?!!t.group:true;u=e.total===e.succeed&&r&&l&&m;}this.$a=d,this.Da=u,this.Fa=c,this.ts=e.total===0||!s&&!n,this.Jo=!n||this.cfg.multiple,this.Na=e.total>0,this.es=e;}nd(t){let e=r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})};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.q),this.subConfigValue("multipleMin",this.q),this.subConfigValue("multipleMax",this.q),this.sub("*groupInfo",t=>{t&&this.q();}),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.q),this.uploadCollection.observeCollection(this.q),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.vr=null;return}this.vr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.q),this.uploadCollection.unobserveCollection(this.q));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.sd}</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.Na}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Ri(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.Va} ?disabled=${!this.ts} ?hidden=${!this.Jo} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.vr} >${this.vr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.Jo} ?disabled=${!this.ts} @click=${this.Va} ><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.Fa} @click=${this.rs} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.$a} ?disabled=${!this.Da} @click=${this.os} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([f()],Lt.prototype,"$a",2),p([f()],Lt.prototype,"Da",2),p([f()],Lt.prototype,"Fa",2),p([f()],Lt.prototype,"Jo",2),p([f()],Lt.prototype,"ts",2),p([f()],Lt.prototype,"vr",2),p([f()],Lt.prototype,"Na",2),p([f()],Lt.prototype,"es",2);var md=[{test:o=>!!o.accept&&!!o.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:o=>o.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:o=>o.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],ja=F(o=>{for(let{test:i,message:t}of md)i(o)&&Gr(t);},0);var Ga=(o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},fd="0123456789abcdefghijklmnopqrstuvwxyz",qa=o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=fd[Number(t)]+i,o=o/36n;}return i},Ds=(o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var gd=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}`)},vd=10,yd=async o=>{let i=await gd(o);return qa(i).slice(0,vd)},Wa=async(o,i)=>{let t=await yd(o);return Ga(t,i)};var Za=o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function");var Fs=o=>o,bd=[Fs({key:"cameraModes",deps:["enableVideoRecording"],fn:({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)}}),Fs({key:"cameraModes",deps:["defaultCameraMode"],fn:({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)}}),Fs({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===vi||Ds(r,s))?Wa(e,s):r}})],Ya=({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of bd){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let l of r.deps)s[l]=()=>t(l);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let a;try{a=r.fn(s,{signal:n.signal});}catch(l){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,l);return}Za(a)?a.then(l=>{n.signal.aborted||i(r.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,l);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,a);}};var V=o=>String(o),tt=o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},_=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}"`)},Xa=o=>o==="auto"?o:_(o),Qa=o=>{let i=V(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Ja=o=>{let i=V(o);if(!Object.values(L).includes(i))throw new Error(`Invalid value: "${i}"`);return i},tl=o=>{let i=V(o),t=j(i);if(t.some(e=>!Object.values(L).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},el=o=>{let i=V(o);if(i==="local"||i==="global")return i;if(_(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},il=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.")},Vs=o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},so=o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},no=o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},rl=o=>{let i=V(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},ol=o=>{let i=V(o);if(["auto","menu","toolbar","compact"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var wd={pubkey:V,multiple:_,multipleMin:tt,multipleMax:tt,confirmUpload:_,imgOnly:_,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:Xa,cameraMirror:_,cameraCapture:Qa,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:tt,thumbSize:tt,showEmptyList:_,useLocalImageEditor:_,useCloudImageEditor:_,cloudImageEditorTabs:V,removeCopyright:_,cropPreset:V,imageShrink:V,modalScrollLock:_,modalBackdropStrokes:_,sourceListWrap:_,remoteTabSessionKey:V,cdnCname:V,cdnCnamePrefixed:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:tt,retryNetworkErrorMaxTimes:tt,multipartMinFileSize:tt,multipartChunkSize:tt,maxConcurrentRequests:tt,multipartMaxConcurrentRequests:tt,multipartMaxAttempts:tt,checkForUrlDuplicates:_,saveUrlForRecurrentUploads:_,groupOutput:_,userAgentIntegration:V,debug:_,localeName:V,metadata:il,secureUploadsExpireThreshold:tt,localeDefinitionOverride:o=>Vs(o),secureUploadsSignatureResolver:o=>so(o),secureDeliveryProxyUrlResolver:o=>so(o),iconHrefResolver:o=>so(o),plugins:o=>no(o),fileValidators:no,collectionValidators:no,validationTimeout:tt,validationConcurrency:tt,cameraModes:tl,defaultCameraMode:Ja,enableAudioRecording:_,enableVideoRecording:_,mediaRecorderOptions:Vs,maxVideoRecordingDuration:tt,filesViewMode:rl,gridShowFileNames:_,cloudImageEditorAutoOpen:_,cloudImageEditorMaskHref:V,testMode:_,qualityInsights:_,pasteScope:el,dynamicButtonShowFirstIcon:_,dynamicButtonViewMode:ol},sl=(o,i)=>{if(!(typeof i>"u"||i===null))try{return wd[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),J[o]}};var ao=[...new Set(["debug",...Object.keys(J)])],Ed=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],al=o=>Ed.includes(o),_s=ao.filter(o=>!al(o)),Ns={...Object.fromEntries(_s.map(o=>[yr(o),o])),...Object.fromEntries(_s.map(o=>[o.toLowerCase(),o]))},nl=o=>`__${o}`,ei=class extends T{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(J).map(([t,e])=>[x(t),e]))};this.ld=new Map;this.fi={};this._a=new Set;this.Fe=new Map;}ss(t){return this._a.has(t)}ns(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}as(t){return [...new Set([yr(t),t.toLowerCase()])]}cd(t,e){if(al(t)||this.ss(t)&&this.ns(t)?.attribute===false)return;let r=this.as(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}ud(t,e){let r=x(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=J[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}jt(t,e){let r;if(this.ss(t)){let a=this.ns(t);try{r=a?.normalize?.(e)??e;}catch(l){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,l);return}}else r=sl(t,e);let s=this,n=nl(t);s[n]!==r&&(this.dd(t,s[n],r),s[n]=r,this.cd(t,r),this.ud(t,r),this.debugPrint(`"${t}"`,r),this.ss(t)||ja(this.cfg));}br(t){let e=this,r=nl(t);return e[r]??this.$[x(t)]}dd(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));}Ba(t){let e=t.configRegistry.getAll();this.fi={},this._a=new Set(e.keys());for(let[r,s]of this.Fe)e.has(r)||(s(),this.Fe.delete(r));for(let[r,s]of e){let a=x(r);if(s.attribute){let m=this.as(r);for(let g of m)this.fi[g]=r;}let l,c=false,d=Object.getOwnPropertyDescriptor(this,r);if(d&&!d.get&&!d.set&&d.value!==void 0&&(l=d.value,c=true),!c&&s.attribute)for(let m of this.as(r)){let g=this.getAttribute(m);if(g!=null){try{l=s.fromAttribute?s.fromAttribute(g):g;}catch(b){console.warn(`[uc-config] fromAttribute() for "${r}" threw an error, using raw attribute value`,b),l=g;}c=true;break}}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let h=Object.getOwnPropertyDescriptor(this,r);if((!h||!h.set||!h.get)&&Object.defineProperty(this,r,{set:m=>{this.jt(r,m);},get:()=>this.br(r),enumerable:true,configurable:true}),!this.Fe.has(r)){let m=this.sub(a,g=>{this.jt(r,g);},false);this.Fe.set(r,m);}c&&this.jt(r,l);}}pd(){this.e.when("pluginManager",t=>{this.Ba(t),this.yr=t.onPluginsChange(()=>{this.Ba(t);});});}hd(){this.hi=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 Ns)continue;if(r in this.fi){let l=this.fi[r],c=this.ns(l);this.attributeChangedCallback(r,s??"",n??c?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.pd(),this.hd();for(let r of _s)this.sub(x(r),s=>{this.jt(r,s);},false);for(let r of ao){let s=t[r]??this.$[x(r)];s!==J[r]&&this.jt(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this.jt(r,a);},get:()=>this.br(r)});}let e=r=>{Ya({key:r,setValue:this.jt.bind(this),getValue:this.br.bind(this),computationControllers:this.ld});};for(let r of ao)this.sub(x(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ns[t];n?s[n]=r:this.e.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==r)return;let c=this.fi[t],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(r):r;if(this.br(c)===u)return;this.jt(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.yr&&(this.yr(),this.yr=void 0),this.hi&&(this.hi.disconnect(),this.hi=void 0);for(let t of this.Fe.values())t();this.Fe.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(Ns);return [...t,...e]}};for(let o of ao)ei.prototype[o]=void 0;var Ui=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.mi="upload-file";this.ls=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.mi=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.ls}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.mi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Ui.prototype,"dropzone",2),p([f()],Ui.prototype,"mi",2);var ll=o=>Fa(o)?o.Nt.h:o.strings,ii=at(class extends ht{constructor(o){super(o),this.et=new WeakMap;}render(o){return [o]}update(o,[i]){let t=Cs(this.it)?ll(this.it):null,e=Cs(i)?ll(i):null;if(t!==null&&(e===null||t!==e)){let r=ki(o).pop(),s=this.et.get(t);if(s===void 0){let n=document.createDocumentFragment();s=ar(P,n),s.setConnected(false),this.et.set(t,s);}Ai(s,[r]),Xt(s,void 0,r);}if(e!==null){if(t===null||t!==e){let r=this.et.get(e);if(r!==void 0){let s=ki(r).pop();Na(o),Xt(o,void 0,s),Ai(o,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var Ie=class Ie extends M{constructor(){super(...arguments);this.showIcon=false;this.Ue=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-primary-action"];}static{this.SOURCE_TEXT_CONFIG={[U.LOCAL]:{action:"upload-from"},[U.URL]:{action:"upload-from"},[U.CAMERA]:{action:"capture-with"},[U.MOBILE_PHOTO_CAMERA]:{action:"take"},[U.MOBILE_VIDEO_CAMERA]:{action:"record"}};}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonShowFirstIcon",t=>{this.showIcon=t;}),this.subConfigValue("multiple",t=>{this.Ue=t;});}get hasEntries(){return (this.entries?.allEntries?.length??0)>0}get hasSingleSuccessImage(){return this.entries?.allEntries?.length===1&&this.entries.isSuccess&&(this.entries.allEntries[0]?.isImage??false)}get hasMultipleEntries(){return (this.entries?.allEntries?.length??0)>=1}get localizedSourceLabel(){return this.source?.label?["local","url","camera"].includes(this.source?.id)?this.l10n(this.source.label).toLowerCase():this.l10n(this.source.label):""}gi(t,e){return this.l10n(t,e)}get textBasedOnLocale(){let t=this.fd();return t||this.md()}fd(){if(this.entries?.status==="uploading")return this.gi("header-uploading",{count:this.entries.uploadingCount});if(this.entries?.status==="failed")return this.gi("header-failed",{count:this.entries.failedCount});if(this.entries?.status==="success")return this.gi("header-succeed",{count:this.entries.successCount});if(this.entries?.totalCount>0)return this.gi("header-total",{count:this.entries?.totalCount??0})}md(){if(!this.source?.id)return "";let e=Ie.SOURCE_TEXT_CONFIG[this.source.id]?.action??"get-from",r;return this.source.id===U.MOBILE_PHOTO_CAMERA?r=this.l10n("photo").toLowerCase():this.source.id===U.MOBILE_VIDEO_CAMERA?r=this.l10n("video").toLowerCase():r=this.localizedSourceLabel,this.gi(e,{source:r})}ls(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}this.source?.onClick();}gd(){if(!this.Ue&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?v`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.Ue&&this.hasMultipleEntries)return null;let t=this.source?.icon;return this.showIcon&&t?v`<uc-icon .name=${t}></uc-icon>`:null}render(){return v`<button @click=${this.ls} aria-label=${this.textBasedOnLocale}>${this.gd()}<span>${this.textBasedOnLocale}</span></button>`}};p([y({type:Object})],Ie.prototype,"source",2),p([y({type:Object})],Ie.prototype,"entries",2),p([f()],Ie.prototype,"showIcon",2),p([f()],Ie.prototype,"Ue",2);var Bs=Ie;var lo=class extends T{constructor(){super(...arguments);this.za=rt.generateFastUid();this.vd=t=>{t.currentTarget.hidePopover();};}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return v`<button class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.za} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.za} class="uc-dropdown-content" popover="auto" @click=${this.vd}>${this.yield("dd-content")}</div>`}};p([f()],lo.prototype,"za",2);var zs=class extends M{static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-dynamic-btn"];}};var Cd=(o,i)=>i==="compact"||o.length===0?{main:null,remain:o}:{main:o[0]??null,remain:o.slice(1)},Td={compact:"paperclip",menu:"arrow-dropdown",auto:"arrow-dropdown"},xd=3,Vt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.le="auto";this.z=[];this.Ne="idle";this.Ka=0;this.q=pe(()=>{this.isConnected&&this.yd();},300);}static{this.styleAttrs=[...super.styleAttrs,"uc-dynamic-btn","uc-wgt-common"];}get isIdle(){return this.Ne==="idle"}get isSuccess(){return this.Ne==="success"}get isFailed(){return this.Ne==="failed"}get isUploading(){return this.Ne==="uploading"}get isCollapsedMode(){return this.le==="compact"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.z.length>1&&(this.le==="toolbar"||this.le==="auto"&&this.z.length<=xd)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.hasCollectionEntries&&(this.z.length>1||this.isCollapsedMode)}get hasCollectionEntries(){return (this.Er?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}yd(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.Er=t,this.Ne=t.status;}ja(){this.wr=Cd(this.z,this.le);}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonViewMode",t=>{this.le!==t&&(this.le=t,this.ja());}),this.sub("*commonProgress",t=>{this.Ka=t;}),new Qe(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.z=t,this.ja();}}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.Ha=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(t>0)return false;let e=this.e.ctx.read("*currentActivity");return e?this.modalManager?.close(e):this.modalManager?.closeAll(),this.e.ctx.pub("*currentActivity",null),true});}disconnectedCallback(){typeof this.q.cancel=="function"&&this.q.cancel(),this.Ha?.(),super.disconnectedCallback();}bd(){return v`<uc-no-wrap-mode-dynamic-btn>${this.wr?.remain?.map(t=>v`<uc-source-btn .iconOnly=${ true} role="menuitem" .source=${t} ></uc-source-btn>`)}</uc-no-wrap-mode-dynamic-btn>`}wd(){return Td[this.le]??"arrow-dropdown"}Ed(){this.uploadCollection.clearAll();}xd(){this.Er.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Td(){this.uploadCollection.abortAll();}pi(){switch(this.Ne){case "failed":this.xd();break;case "uploading":this.Td();break;default:this.Ed();}}Cd(){return v`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.wd()} ></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.wr?.remain?.map(t=>v`<uc-source-btn role="menuitem" .source=${t} ></uc-source-btn>`)}</div></uc-drop-down>`}Sd(){return v`<uc-primary-action .entries=${this.Er} .source=${this.wr?.main} ></uc-primary-action>`}Ad(){return v`<uc-file-action-button @uc:remove=${this.pi} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.Ka} ></uc-file-action-button>`}kd(){return lt({"uc-dynamic-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Md(){return v`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.kd()}>${ii(this.shouldShowPrimaryAction?this.Sd():null)} ${ii(this.shouldShowInline?this.bd():null)} ${ii(this.shouldShowDropdown?this.Cd():null)} ${ii(this.shouldShowAbortAction||this.hasCollectionEntries?this.Ad():null)} ${ii(this.Md())}</div></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Vt.prototype,"dropzone",2),p([f()],Vt.prototype,"le",2),p([f()],Vt.prototype,"z",2),p([f()],Vt.prototype,"Ne",2),p([f()],Vt.prototype,"wr",2),p([f()],Vt.prototype,"Er",2),p([f()],Vt.prototype,"Ka",2);var $i=class extends ${constructor(){super(...arguments);this.us=I();}initCallback(){this.activityType=this.registration?.id??null,this.Ga(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Ga(),this.isActivityActive&&(this.xr(),this.qa()));}Ga(){this.registration&&(this.Gn()||this.registerActivity(this.activityType??"",{onActivate:()=>this.qa(),onDeactivate:()=>this.xr()}));}async qa(){await this.updateComplete;let t=this.us.value;if(!t||!this.registration)return;this.xr();let e=this.$["*currentActivityParams"];try{this.cs=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}xr(){let t=this.us.value;if(t){try{this.cs?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.cs=void 0,t.replaceChildren();}}disconnectedCallback(){this.xr(),super.disconnectedCallback();}render(){return v`<div style="display: contents;" ${O(this.us)}></div>`}};p([y({attribute:false})],$i.prototype,"registration",2);var ri=class extends T{constructor(){super(...arguments);this.mode="modal";this.Tt=[];}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Wa())),this.Wa();}Wa(){let t=this.e.pluginManager;if(!t){this.Tt=[];return}this.Tt=t.snapshot().activities;}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?v`${Ri(this.Tt,t=>t.id,t=>v`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:v`${Ri(this.Tt,t=>t.id,t=>v`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};p([y({type:String})],ri.prototype,"mode",2),p([f()],ri.prototype,"Tt",2);function Di(o,i,t){return o?i(o):t?.(o)}function cl(...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},{})}function wt(...o){let i=cl(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function ul(o,...i){let t=cl(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}var Sd=o=>st.includes(o),dl=o=>{if(!o)return st;let i=j(o).filter(Sd);return i.length===0?st:i};function pl(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":z.CROP,"*on.retryNetwork":()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ot,t.src=e;}o.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=ot(ie(i),"preview"),r=W(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.cancel":()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var hl="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></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 Oe={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},oi=class extends T{constructor(){super(...arguments);this.kt=false;this.Za=Oe;this.Ya=Oe.visible;this.Xa=Oe.hidden;this.ds=false;this.Qa=false;}set visible(t){this.kt=t,this.Ja();}get visible(){return this.kt}set styles(t){this.Za=t,this.ds=true,this.Ya=t.visible??Oe.visible,this.Xa=t.hidden??Oe.hidden;}get styles(){return this.Za}Ja(){this.style.visibility=this.kt?"inherit":"hidden",ul(this,{[Oe.transition]:!this.ds,[this.Ya]:this.kt,[this.Xa]:!this.kt}),this.toggleAttribute("inert",!this.kt);}Od(){this.Qa||(this.Qa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.ds||this.classList.add(Oe.transition),this.Ja(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Od();},0);}};p([y({type:Boolean})],oi.prototype,"visible",1),p([y({attribute:false})],oi.prototype,"styles",1);var Fi=class extends T{constructor(){super(...arguments);this.active=false;this.ce=I();this.ps=false;this.hs=()=>{let t=this.ce.value;t&&(this.tl(t),this.ps&&this.active&&this.fs());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.fs();}updated(t){super.updated(t),t.has("active")&&(this.active?this.fs():this.Id());}fs(){let t=this.ce.value;if(!t)return;this.ps=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.hs),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.hs,{once:true});}Id(){let t=this.ce.value;t&&(this.ps=false,t.removeEventListener("transitionend",this.hs),this.tl(t));}tl(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${O(this.ce)}></div></div>`}};p([y({type:Boolean,reflect:true})],Fi.prototype,"active",2);var q=o=>o??P;var At=class extends T{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.il(),this.rl();}updated(t){super.updated(t),t.has("reverse")&&this.il(),t.has("theme")&&this.rl();}il(){this.style.flexDirection=this.reverse?"row-reverse":"";}rl(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Pd(){let t=this.ms;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Ld}}get ms(){return !this.icon}get Ld(){return !this.text&&!this.ms}render(){return v`<button type="button" role=${q(this.ariaRole||void 0)} aria-controls=${q(this.ariaControls||void 0)} aria-label=${q(this.l10n(this.titleProp))} title=${q(this.l10n(this.titleProp))} ><uc-icon class=${lt(this.Pd)} name=${q(this.icon||void 0)} ?hidden=${this.ms} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],At.prototype,"text",2),p([y({type:String})],At.prototype,"icon",2),p([y({type:Boolean,reflect:true})],At.prototype,"reverse",2),p([y({type:String,reflect:true})],At.prototype,"theme",2),p([y({attribute:"aria-role"})],At.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],At.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],At.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],At.prototype,"active",2);function ml(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}function si(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return W(o,ot(fr,ie(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Rt}/${Ut}/uc-cloud-image-editor/`))}var Vi=class extends T{constructor(){super(...arguments);this.ol=`uc-backdrop-mask-${rt.generateFastUid()}`;this.Cr=false;this.wi=false;this.al=I();this.Ei=false;this.xi=null;this.cl=t=>{this.ul(),this.Ti&&(t.stopPropagation(),t.preventDefault(),this.Ti=false);};this.dl=t=>{if(!this.Ti||!this.Tr||!this.vs)return;t.stopPropagation(),t.preventDefault();let e=this.Gt;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,a=t.y-s,l=n-this.Tr[0],c=a-this.Tr[1],{direction:d}=this.vs,u=this.Bd(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.pl=t=>{if(!this.$t)return;let e=Object.values(this.$t).find(r=>{if(!r||this.bs(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return Sa(a,[t.x,t.y])});this.sl=e,this.ul();};}get Gt(){return this.al.value??null}get Ti(){return this.wi}set Ti(t){this.wi!==t&&(this.wi=t,this.ys());}ys(){this.yi&&this.yi.setAttribute("class",wt({"uc-guides--hidden":this.Cr,"uc-guides--visible":!this.Cr&&this.wi,"uc-guides--semi-hidden":!this.Cr&&!this.wi}));}bs(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=k&&e.width<=k)return true;let r=e.height<=k&&(t.includes("n")||t.includes("s")),s=e.width<=k&&(t.includes("e")||t.includes("w"));return r||s}Rd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,a=this.Gt;if(!a)return;let l=yt("mask",{id:this.ol}),c=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=yt("rect",{x:e,y:r,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.ol})`});a.appendChild(u),a.appendChild(l),this.vi=l,this.gs=d;}Ud(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}$d(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.gs&&ae(this.gs,{x:e,y:r,width:s,height:n});}Dd(){let t=this.$["*cropBox"];if(!(!t||!this.yi||!this.$t)){for(let e of Object.values(this.$t)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:a}=e,l=r==="",c=r.length===2,{x:d,y:u,width:h,height:m}=t;if(l)ae(n,{x:d,y:u,width:h,height:m});else {let b=le(Math.min(h,m)/82/2,0,1),w=c?wa(t,r,b):Ea(t,r,b),C=w.center;if(!C)continue;let E=Math.max(fs*le(Math.min(h,m)/fs/3,0,1),ba);ae(n,{x:C[0]-E,y:C[1]-E,width:E*2,height:E*2}),ae(s,{d:w.d});}let g=this.bs(r);a.setAttribute("class",wt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}ae(this.yi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}ll(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.Fd.bind(this,e));}Nd(){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.ll(t,s);}return this.ll(t,""),t}Vd(){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:`${xi*r}%`,y1:"0%",x2:`${xi*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:`${xi*r}%`,x2:"100%",y2:`${xi*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}_d(){let t=this.Gt;if(!t)return;let e=document.createDocumentFragment(),r=this.Vd();e.appendChild(r);let s=this.Nd();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.$t=s,this.yi=r,this.ys();}Fd(t,e){if(!this.$t)return;let r=this.$t[t];if(!r||this.bs(t))return;let s=this.$["*cropBox"],n=this.Gt;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.Ti=true,this.vs=r,this.Tr=[c,d],this.nl={...s};}Bd(t,e){let[r,s]=e,n=this.$["*imageBox"],a=this.nl??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Ta({rect:a,delta:[r,s],imageBox:n}):a=xa({rect:a,delta:[r,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return je(qe(a),n)}ul(){let t=this.sl,e=this.Gt;e&&(e.style.cursor=t?Ca(t.direction):"initial");}hl(t){if(this.bi){this.bi.setAttribute("href",t);return}let e=this.Gt;if(!e){this.xi=t;return}this.xi=null;let r=document.createDocumentFragment(),s=yt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.bi=s;}zd(){let t=this.$["*cropBox"];if(!t||!this.bi)return;let{x:e,y:r,width:s,height:n}=t;ae(this.bi,{x:e,y:r,height:n,width:s});}Es(){this.Ei&&(this.$d(),this.Dd(),this.zd());}toggleThumbs(t){if(this.$t)for(let e of Object.values(this.$t)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",wt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Ud(),this.Ei&&window.requestAnimationFrame(()=>{this.Es();});}),this.sub("*cropBox",t=>{t&&(this.Cr=t.height<=k||t.width<=k,this.ys(),this.Ei&&window.requestAnimationFrame(()=>{this.Es();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.hl(t);}),document.addEventListener("pointermove",this.dl,true),document.addEventListener("pointerup",this.cl,true);}firstUpdated(t){super.firstUpdated(t),this.Hd();}Hd(){let t=this.Gt;if(!(!t||this.Ei)){if(this.Rd(),this._d(),this.Ei=true,t.addEventListener("pointermove",this.pl,true),this.xi){let e=this.xi;this.xi=null,this.hl(e);}this.Es();}}disconnectedCallback(){super.disconnectedCallback(),this.Gt?.removeEventListener("pointermove",this.pl,true),document.removeEventListener("pointermove",this.dl,true),document.removeEventListener("pointerup",this.cl,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${O(this.al)}></svg>`}};p([f()],Vi.prototype,"wi",2);function kd(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}var Ni=class extends T{constructor(){super();this.ctxOwner=true;this.ue={width:0,height:0};this.i=null;this._=false;this.vt=null;this.ml=I();this.Ts=I();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.fl=F(this.gl.bind(this),300),this.xs=pe(()=>{!this.isConnected||!this._||(this.Cs(),this.vl(),this.yl(),this.Ss(),this.As());},100);}firstUpdated(t){super.firstUpdated(t),this.Cs();}vl(){let t=this.$["*editorTransformations"],e=ml(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}Cs(){let t=this.ml.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.Mt=t,this.i=e;}yl(){if(!this._||!this.vt)return;let t=this.vt,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=Ge({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,m=0+e,g=e+(n.height-e*2)/2-h/2;l={x:m,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,m=e+(n.width-e*2)/2-h/2,g=0+e;l={x:m,y:g,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=qe(l);}Ss(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,m],coords:[g,b]}=n,{width:w}=Ge(this.ue,s),C=a/w;t=je(qe({x:l+g*C,y:c+b*C,width:h*C,height:m*C}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!Aa(t,e)||u&&!ka(t,u)){let h=e.width/e.height,m=e.width,g=e.height;u&&(h>u?m=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-g/2,width:m,height:g};}this.$["*cropBox"]=je(qe(t),e);}Kd(){let t=this.i;if(!t)return;let e=this.vt;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=Ge({width:r.width,height:r.height},l);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}As(){if(!this._||!this.vt||!this.Mt||!this.i)return;let t=this.Mt;this.i.clearRect(0,0,t.width,t.height),this.Kd();}jd({fromViewer:t}){this.vt&&(this.Ts.value?.toggleThumbs(true),this.Gd(),setTimeout(()=>{this.className=wt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}bl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a}=e,{width:l,height:c}=Ge(this.ue,s),{width:d,height:u}=t,h=n/l,m=a/c;return [le(Math.round(d/h),1,l),le(Math.round(u/m),1,c)]}qd(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=Ge(this.ue,s),{x:h,y:m}=t,g=n/d,b=a/u,w=this.bl(),C={dimensions:w,coords:[le(Math.round((h-l)/g),0,d-w[0]),le(Math.round((m-c)/b),0,u-w[1])]};if(!kd(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(w[0]===d&&w[1]===u))return C}gl(){if(!this.isConnected||!this.ue)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.qd(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.yl(),this.Ss(),this.As());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.Cs(),this.ue=t,this.removeEventListener("transitionend",this.wl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.vt=await this.Wd(r,s),this.vl(),this.xs(),this.jd({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.vt&&this.xs();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.gl(),this._=false,this.Zd(),this.className=wt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Ts.value?.toggleThumbs(false),this.addEventListener("transitionend",this.wl,{once:true}),this.s?.disconnect());}Zd(){let t=this.bl(),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),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}Gd(){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`;}wl(){this._||(this.vt=null);}async Wd(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(si(t,r,e)),{promise:n,cancel:a,image:l}=ke(s),c=this.Ve(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.b?.(),this.b=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}Ve(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.As();}),this.sub("*cropBox",()=>{this.vt&&this.fl();}),this.sub("*currentAspectRatio",()=>{this.Ss();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.ue&&this.activate(this.ue,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.vt&&(this.vt=null);}render(){return v`<canvas class="uc-canvas" ${O(this.ml)}></canvas><uc-crop-frame ${O(this.Ts)}></uc-crop-frame>`}};p([f()],Ni.prototype,"vt",2);function Hs(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}function Md(o){return typeof o=="string"&&o in It}function Id(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}function Od(o,i,t){let e=Id(o).find(([n,a])=>n<=i&&i<=a);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let a=Math.abs(r-s)||1,l=Math.abs(i-r)/a;return r===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function Ld(o,i){return o.map((t,e)=>t<i?o.length-e:e)}function fl(o,i){let t=It[o].keypointsNumber,{range:e,zero:r}=It[o];return [...new Set([...Hs(e[0],r,t+1),...Hs(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}var co=class extends T{constructor(){super();this._=false;this.ks=true;this.n="initial";this.El={};this.qt=[];this.xl=0;this.Cl=I();this.Sr=I();this.classList.add("uc-inactive_to_cropper"),this.Tl=F(async(t,e,r)=>{let s=()=>!this.Sl(t,e)||this.Re!==r||!!this.qt.find(c=>c.value===r);if(s())return;let n=await this.Al(t,r),a=new Image;a.src=n.src;let l=this.Ve(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.qt,d=c.findIndex(g=>g.value>r);d===-1&&(d=c.length);let h=c[d]?.image,m=this.Sr.value;!m||h&&!m.contains(h)||(c.splice(d,0,n),h?m.insertBefore(a,h):m.appendChild(a),this.Is(t,r));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Ve(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);}}kl(){window.cancelAnimationFrame(this.xl),this.xl=window.requestAnimationFrame(()=>{for(let t of this.qt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}de({url:t=this._e,filter:e=this.m??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.El};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let a=this.offsetWidth;return this.proxyUrl(si(t,a,n))}async Al(t,e){return {src:await this.de({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Sl(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Md(this.n)||!Number.isFinite(e)||(this.Is(this.n,e),this.Tl(this.n,this.m,e));}Is(t,e){this.n=t,this.Re=e;let{zero:r}=It[t],s=this.qt.map(l=>l.value),n=Od(s,e,r),a=Ld(s,r);this.qt.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.kl();}Ml(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Yd(){this.a=this.a||this.Ml();let t=this.a;t&&this.Ol(t);let e=this.qt.map(c=>c.src),{images:r,promise:s,cancel:n}=Pi(e);r.forEach(c=>{let d=this.Ve(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.Ms=()=>{n(),this.Ms=void 0;};let a=this.n,l=this.m;if(await s,this._&&this.Sl(a,l)){let c=this.Sr.value;if(!c)return;c.replaceChildren(),this.qt.forEach((d,u)=>{let h=r[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.kl();}}async setTransformations(t){if(this.El=t,this.a){let e=await this.de(),r=this.Ve(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.Os?.();let n=fl(r,s),a=await Promise.all(n.map(c=>this.de({url:t,filter:e,operation:r,value:c}))),{cancel:l}=Pi(a);this.Os=l;}Xd(t){let e=this.a||this.Ml();if(this.Ol(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=wt({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.Ve(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=wt({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"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.ks=false,await this.updateComplete,this._e=t,this.n=e??"initial",this.Re=r,this.m=s,this.Ci=n,typeof r!="number"&&!s){let l=await this.de({operation:e,value:r});this.Xd(l),this.Ps();return}!e||typeof r!="number"||(this.qt=await Promise.all(fl(e,r).map(l=>this.Al(e,l))),this.Is(e,r),this.Yd());}deactivate({hide:t=true}={}){this._=false,this.Ms?.(),this.Os?.(),t&&!this.ks?(this.ks=true,this.a&&(this.a.style.transform="scale(1)"),this.className=wt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Ps();},{once:true})):this.Ps();}Ol(t){let e=this.Cl.value;e&&(e.contains(t)||e.appendChild(t));}Ps(){this.Sr.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${O(this.Cl)}></div><div class="uc-fader-layers-host" ${O(this.Sr)}></div>`}};var gl="important",Pd=" !"+gl,Pe=at(class extends ht{constructor(o){if(super(o),o.type!==$t.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(o,[i]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith(Pd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?gl:""):t[e]=r;}}return it}});var Nt=class extends T{constructor(){super();this.Ls=0;this.Ar=I();this.Pl=I();this.Ll=I();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Wt=0;this.Jd=t=>{t.stopPropagation();let e=this.Rl(t);e!==null&&(this.Rs(e),this.Qd("slider-input",e));};this.tp=t=>{t.stopPropagation();let e=this.Rl(t);e!==null&&this.Rs(e);};this.Ul=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.$l=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}Qd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Ls=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Dl(this.Wt),this.Us(),this.s=new ResizeObserver(()=>{this.Us(),this.kr(this.Wt);}),this.s.observe(this);let e=this.Ar.value;e?.addEventListener("focus",this.Ul),e?.addEventListener("blur",this.$l),window.setTimeout(()=>{this.kr(this.Wt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Wt&&this.Rs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Us(),this.kr(this.Wt)),t.has("zero")&&this.hasUpdated&&this.Fl(this.Wt);}kr(t){this.Fl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(r-this.Ls)/100;window.requestAnimationFrame(()=>{let l=this.Pl.value;l&&(l.style.transform=`translateX(${a}px)`);});}Fl(t){if(!this.Si)return;let e=this.max-this.min;if(e===0)return;this.Si.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(r-this.Ls)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${a}px)`);});}Us(){let e=this.Ll.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.Il===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.Si=d,e.innerHTML="",e.appendChild(a),this.Il=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.Ar.value;t?.removeEventListener("focus",this.Ul),t?.removeEventListener("blur",this.$l),this.s?.disconnect(),this.s=void 0;}Rs(t){Number.isFinite(t)&&(this.Wt=t,this.hasUpdated&&(this.Dl(t),this.kr(t)));}Dl(t){let e=this.Ar.value;e&&(e.value=String(t));}Rl(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return v`<div class="uc-steps" ${O(this.Ll)}></div><div class="uc-thumb" ${O(this.Pl)}></div><input class="uc-input" type="range" ${O(this.Ar)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Wt)} ?disabled=${this.disabled} @input=${this.Jd} @change=${this.tp} />`}};p([y({type:Boolean,reflect:true})],Nt.prototype,"disabled",2),p([y({type:Number})],Nt.prototype,"min",2),p([y({type:Number})],Nt.prototype,"max",2),p([y({type:Number,attribute:false})],Nt.prototype,"defaultValue",2),p([y({type:Number})],Nt.prototype,"zero",2),p([f()],Nt.prototype,"Wt",2);var _t="original",_i=class extends T{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.$s=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.ep();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});}ep(){let t=this.state.operation,{range:e,zero:r}=It[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:m}=u;d=h===this.state.filter?m:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:r;this.state={...this.state,value:c,defaultValue:c};}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 v`<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.$s} ></uc-slider-ui>`}};p([f()],_i.prototype,"state",2);function ni(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)}}var ut=class extends T{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Nl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Nl();}updated(t){super.updated(t),t.has("active")&&this.Nl();}render(){let t=this.onClick,e=this.title;return v`<button role="option" type="button" aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([f()],ut.prototype,"active",2),p([f()],ut.prototype,"title",2),p([f()],ut.prototype,"icon",2),p([f()],ut.prototype,"titleProp",2);var uo=12,po=16,Rd=o=>{let i=12,t=12;return o.width/o.height>=1?(i=uo,t=Math.round(uo*o.height/o.width)):(t=uo,i=Math.round(uo*o.width/o.height)),{width:i,height:t}},ho=class extends ut{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.ip(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}ip(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 v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Bi=class extends ut{constructor(){super(...arguments);this.tt=null;}get aspectRatio(){return this.tt}set aspectRatio(t){if(this.tt===t)return;let e=this.tt;this.tt=t,this.requestUpdate("aspectRatio",e),t?this.Vl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.tt&&this.Vl(this.tt),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.tt?.id||t?.width===this.tt?.width&&t?.height===this.tt?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.tt?.id&&(this.$["*currentAspectRatio"]=this.tt);}Vl(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{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};r(),s(),e||this.requestUpdate();}rp(){let t=this.tt;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=Rd(t),s=(po-e)/2,n=(po-r)/2;return v`<uc-icon><svg viewBox="0 0 ${po} ${po}" 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 v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} >${this.rp()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],Bi.prototype,"aspectRatio",1);function Ud(o){let i=o+90;return i=i>=360?0:i,i}function $d(o,i){if(o==="rotate")return Ud(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}var zi=class extends ut{constructor(){super(...arguments);this.operation=void 0;}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=$d(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};p([y({type:String})],zi.prototype,"operation",2);var Qt=class extends ut{constructor(){super(...arguments);this.n="";this.m="";this.Ai="";this.Mr=0;this.a=null;this.ze=false;this.isOriginal=false;this._l=20;}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._l=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.Bl(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:ni(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}op(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this._l||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.n]=this.m!==_t?{name:this.m,amount:a}:void 0,W(this.Ai,ot(fr,ie(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Rt}/${Ut}/uc-cloud-image-editor/`))}async di(t,e){t[0]?.isIntersecting?await this.Ds(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.Ai=t??"",this.sub("*originalUrl",e=>{this.Ai=e??"",!this.isOriginal&&this.Ai&&this.isConnected&&!this.a&&(this.s?.observe(this),this.pe());}),this.isOriginal||(this.s?.observe(this),this.pe()),this.m&&this.Bl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Ds():this.pe());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.Or();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.pe()));}Bl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ds(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.Ai){!this.Be&&!this.Zt&&this.pe();return}let e=++this.Mr,r="";try{r=await this.proxyUrl(this.op());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.ze=false,this.b?.();let{promise:s,cancel:n}=ke(r);this.b=()=>{n(),this.Mr===e&&(this.b=void 0);};try{if(await s,this.Mr!==e||!this.isConnected)return;this.a=r,this.ze=!0,this.Or(),(t??this.s)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.pe();}finally{this.Mr===e&&(this.b=void 0);}}pe(){if(!this.isConnected||this.a||this.ze||this.isOriginal||this.$["*networkProblems"]){this.Or();return}this.Zt&&cancelAnimationFrame(this.Zt),this.Zt=requestAnimationFrame(()=>{if(this.Zt=void 0,!this.isConnected||this.a||this.ze||this.isOriginal){this.Or();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.Ds();return}this.Be=window.setTimeout(()=>{this.Be=void 0,this.pe();},500);});}Or(){this.Zt&&(cancelAnimationFrame(this.Zt),this.Zt=void 0),this.Be&&(window.clearTimeout(this.Be),this.Be=void 0);}get sp(){return !!(this.ze&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.sp?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${q(this.titleProp)} title=${q(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.ze} style=${Pe(e)}></div><uc-icon class=${lt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Pe(r)} ></uc-icon></button>`}};p([f()],Qt.prototype,"a",2),p([f()],Qt.prototype,"ze",2),p([f()],Qt.prototype,"isOriginal",2),p([f()],Qt.prototype,"_l",2),p([y({type:String})],Qt.prototype,"filter",1);var Hi=class extends ut{constructor(){super(...arguments);this.n="";}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.zl(e);}zl(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},r=()=>{let s=this.l10n(t);return this.title=s,s};e(),r();}initCallback(){super.initCallback(),this.n&&this.zl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=It[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:ni(this.$["*operationTooltip"])});}};p([y({type:String})],Hi.prototype,"operation",1);var Dd=1,vl=()=>{},Ki=class extends T{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Hl=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Dd){this.scrollLeft+=r;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Hl,{passive:false}),this.addEventListener("scroll",vl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Hl),this.removeEventListener("scroll",vl),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Ki.prototype,"hiddenScrollbar",2);var ft=class extends T{constructor(){super(...arguments);this.ki=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Kl=true;this.tabList=[...st];this.activeTab=z.CROP;this.Ir=true;this.Fs=false;this.jl=null;this.Gl=0;this.ql=0;this.Pr=I();this.Wl=I();this.tabToggleRefs={[z.CROP]:I(),[z.TUNING]:I(),[z.FILTERS]:I()};this.Zl=()=>{this.he();};this.Mi=[];this.Lr=F(t=>{this.ki=t;},500);this.Rr=F(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===z.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"]===z.TUNING&&e){s=true;let n=t?.[e]||It[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Fs=s;},0);this.np={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.ap={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.lp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.cp={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.Ut=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.Bs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.wp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ni(this.$["*operationTooltip"])}),this.Pr.value?.apply(),this.Yl();};this.Ep=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Pr.value?.cancel(),this.Yl();};this.xp=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Ns(r,{fromViewer:false}));};}Yl(){this.$["*showSlider"]=false,this.$["*tabId"]===z.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===z.TUNING&&(this.Fs=false);}Ns(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Xl(t,{fromViewer:e,force:r});}Xl(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.he();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===z.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of st){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.he();}}he(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Wl.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Gl!==s||this.ql!==n)&&(this.Gl=s,this.ql=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get Vs(){return this.Mi.length>=3}up(t){switch(t){case z.CROP:return this.dp();case z.FILTERS:return this.pp();case z.TUNING:return this.hp();default:return []}}dp(){let t=[];if(this.Vs)t.push(()=>this.fp());else for(let e of this.Mi)t.push(()=>this.Ql(e));for(let e of On)t.push(()=>this.mp(e));return this._s(t)}pp(){let e=[_t,...In].map(r=>()=>this.gp(r));return this._s(e)}hp(){let t=Mn.map(e=>()=>this.vp(e));return this._s(t)}_s(t){return t.length?t.map(r=>r()):[]}fp(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Ql(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}mp(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}gp(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}vp(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}yp(){return this.Vs?this.Mi.map(t=>this.Ql(t)):[]}async bp(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(si(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=Pi([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Mi=[...t],this.sub("*cropPresetList",e=>{this.Mi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Ns(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Rr();}),this.sub("*currentOperation",()=>{this.Rr();}),this.sub("*tabId",e=>{this.Xl(e,{fromViewer:false,force:true}),this.Rr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.bp(),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.Lr(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ir=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ir=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Kl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Ns(r,{fromViewer:false});return}this.he();}),this.sub("*operationTooltip",e=>{this.jl=e;}),this.Rr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Zl);}firstUpdated(t){super.firstUpdated(t),this.Ur(),this.he();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.he()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Ur();}disconnectedCallback(){window.removeEventListener("resize",this.Zl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Ur(){let t=this.Pr.value;t&&(this.$["*sliderEl"]=t);}Tp(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?Pe({gridColumn:`${s+1}`}):P;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.lp}><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.xp} ${O(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Cp(t){let e=this.up(t);return v`<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:P}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Fs?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Vs;return v`<uc-line-loader-ui .active=${this.ki}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.jl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.np} ><div class="uc-tab-content-row">${st.map(r=>Di(this.activeTab===r,()=>this.Cp(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Kl} .styles=${this.cp} @initial-render=${()=>this.he()} ><div class="uc-tab-toggles_indicator" ${O(this.Wl)} ></div>${st.map(r=>this.Tp(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ut} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Bs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.ap}><div class="uc-slider" ?hidden=${!this.Ir}><uc-editor-slider ${O(this.Pr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Ir||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.yp()}</div>`:P}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Ep} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.wp} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([f()],ft.prototype,"ki",2),p([f()],ft.prototype,"showMainToolbar",2),p([f()],ft.prototype,"showSubToolbar",2),p([f()],ft.prototype,"Kl",2),p([f()],ft.prototype,"tabList",2),p([f()],ft.prototype,"activeTab",2),p([f()],ft.prototype,"Ir",2),p([f()],ft.prototype,"Fs",2),p([f()],ft.prototype,"jl",2),p([f()],ft.prototype,"Mi",2);var yl=Kt([...st]),et=class extends T{constructor(){super(...arguments);this.ctxOwner=true;this.Sp="";this.de=Ot;this.Ap="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=yl;this.Jl=false;this._t=false;this.zs=null;this.Oi=null;this.Lr=F(t=>{this.ki=t;},300);this.$r=I();this.tc=I();this.ec=I();this.ic=I();this.rc=()=>{this.Lr(false),this.de!==Ot&&(this.$["*networkProblems"]=false);};this.oc=()=>{this.Lr(false),this.$["*networkProblems"]=true;};this.kp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...pl(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Mp(){this._t||this.zs||(this.zs=this.updateComplete.then(()=>{this.zs=null,this._t=true;}));}initCallback(){super.initCallback(),this.sc(),this.nc();}Ur(){let t=this.ec.value;t&&(this.$["*faderEl"]=t);let e=this.tc.value;e&&(this.$["*cropperEl"]=e);let r=this.ic.value;r&&(this.$["*imgContainerEl"]=r);let s=this.$r.value;s&&(this.$["*imgEl"]=s);}Op(){let t=this.$r.value;t&&(t.addEventListener("load",this.rc),t.addEventListener("error",this.oc));}Ip(){let t=this.$r.value;t&&(t.removeEventListener("load",this.rc),t.removeEventListener("error",this.oc));}get Pp(){let t=this.$["*tabId"];return wt("uc-image",{"uc-image_hidden_to_cropper":t===z.CROP,"uc-image_hidden_effects":t!==z.CROP})}ac(){if(this.Oi)return this.Oi;let t=3e3;return this.Oi=new Promise((e,r)=>{let s=()=>{window.clearTimeout(d),c.disconnect(),this.Oi=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{s(),window.setTimeout(()=>e(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(u.message),r(u);},c=new ResizeObserver(u=>{let[h]=u;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),d=window.setTimeout(()=>{l();},t);if(n()){a();return}c.observe(this);}),this.Oi}firstUpdated(t){super.firstUpdated(t),this.Ur(),this.Op(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.Ip(),super.disconnectedCallback();}render(){let t=this.Ap??"",e=this.Sp??"",r=this.de||Ot,s=this.ki,n=this.Jl;return v` ${ze(hl)}<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.kp}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${O(this.ic)}><img src=${r} class=${this.Pp} ${O(this.$r)} />${Di(this._t,()=>v`<uc-editor-image-cropper ${O(this.tc)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${O(this.ec)}></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">${Di(this._t,()=>v`<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.sc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.nc();}sc(){let t=this.tabs||yl;this.$["*tabList"]=dl(t);}nc(){let t=Zr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=Fo(this.cdnUrl),s=Vo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=Ia(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.ac();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=mr(t),r=ee(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=Fo(t),n=Vo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=ee(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"]===z.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(W(t,ot("json"))),r=await fetch(e).then(a=>a.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===z.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.Mp();}}}async initEditor(){try{await this.ac();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Jl=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=ot(ie(t),"preview"),s=W(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([f()],et.prototype,"Sp",2),p([f()],et.prototype,"de",2),p([f()],et.prototype,"Ap",2),p([f()],et.prototype,"ki",2),p([y({type:String,reflect:true})],et.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],et.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],et.prototype,"cropPreset",2),p([y({type:String,reflect:true})],et.prototype,"tabs",2),p([f()],et.prototype,"Jl",2),p([f()],et.prototype,"_t",2);var Ks={};Zs(Ks,{CloudImageEditorActivity:()=>ji});var mo=class extends et{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var ji=class extends M{constructor(){super(...arguments);this.ot=null;}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.ot&&this.ot.cropPreset!==t&&(this.ot={...this.ot,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.ot&&this.ot.tabs!==t&&(this.ot={...this.ot,tabs:t});}),this.Lp();}disconnectedCallback(){super.disconnectedCallback(),this.Rp();}Bs(t){if(!this.Ii)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ii.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}Ut(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Lp(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Ii=e;let r=this.Ii.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.ot=this.Up(r);}Rp(){this.Ii=void 0,this.ot=null;}render(){if(!this.ot)return P;let{cdnUrl:t,cropPreset:e,tabs:r}=this.ot;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${q(e)} tabs=${q(r)} @apply=${this.Bs} @cancel=${this.Ut} @change=${this.handleChange} ></uc-cloud-image-editor>`}Up(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([f()],ji.prototype,"ot",2);var ai=class extends M{constructor(){super(...arguments);this._e="";this.$s=t=>{this._e=t.target?.value??"";};this.rs=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this._e.trim();e&&(this.api.addFileFromUrl(e,{source:U.URL}),this.routerLayer.navigateAfterFileAdd());};}render(){return v`<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.rs}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.$s} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this._e} >${this.l10n("upload-url")}</button></form>`}};p([f()],ai.prototype,"_e",2);var bl=()=>{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}};var Fd=o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),wl=(o,i="i")=>{let t=o.split("*").map(Fd);return new RegExp(`^${t.join(".+")}$`,i)};var Vd=["--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"],Nd=(o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),El=o=>{let i={};for(let t of Vd){let e=Nd(o,t);e&&(i[t]=e);}return i};var _d=["selected-files-change","toolbar-state-change"],Bd=o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!_d.includes(i))},fo=class{constructor(i,t){this.Dr=new Map;this.uc=i=>{if(i.source!==this.Hs)return;let t=i.data;if(!Bd(t))return;let e=this.Dr.get(t.type);if(e)for(let r of e)r(t);};this.Hs=i,this.cc=t,window.addEventListener("message",this.uc);}on(i,t){let e=this.Dr.get(i)??new Set;this.Dr.has(i)||this.Dr.set(i,e),e.add(t);}send(i){let t=this.cc();this.Hs.postMessage(i,t);}destroy(){window.removeEventListener("message",this.uc);}};function Cl(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var zd={[mt.GDRIVE]:"ngdrive"},gt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.He=I();this.Fr=null;this.Ks=[];this.js=false;this.Gs=false;this.qs=false;this.Ws=false;this.Nr=false;this.Zs=false;this.Ys="uc-hidden";this.dc=true;this.os=()=>{for(let t of this.Ks){let e=this.Dp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.routerLayer.navigateAfterFileAdd();};this.Ut=()=>{this.historyBack();};this.zp=()=>{this.yt?.send({type:"select-all"});};this.Hp=()=>{this.yt?.send({type:"deselect-all"});};}get $p(){if(!this.Fr)return "";let{selectedCount:t,total:e}=this.Fr;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.pc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.hc(),this.pc());});}),this.subConfigValue("multiple",e=>{this.Nr=e;}),this.subConfigValue("localeName",()=>{this.fc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.mc(e);});}Dp(t){if(t.alternatives){let e=Z(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=wl(r);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}Fp(t){this.dc=t.isVisible;}async Np(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Vp(t.selectedCount,t.total),this.Ys=t.isReady?"":"uc-hidden",this.js=t.isReady,this.Gs=t.isReady&&t.selectedFiles.length>0,this.Nr=t.isMultipleMode&&t.total>0,this.qs=t.selectedCount<t.total,this.Ws=t.selectedCount===t.total,this.Ks=t.selectedFiles??[],this.Zs=t.total>0;}gc(){this.mc(this.cfg.externalSourcesEmbedCss),this._p(),this.fc();}_p(){this.yt?.send({type:"set-theme-definition",theme:El(this)});}mc(t){this.yt?.send({type:"set-embed-css",css:t});}fc(){this.yt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Bp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=zd[n]??n,c={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||bl(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,r);return d.search=Cl(c),d.toString()}Vp(t,e){this.Fr={selectedCount:t,total:e};}pc(){let t=document.createElement("iframe");t.src=this.Bp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.gc.bind(this)),t.addEventListener("load",this.gc.bind(this)),this.He.value&&(this.He.value.innerHTML="",this.He.value.appendChild(t)),t.contentWindow&&(this.yt?.destroy(),this.yt=new fo(t.contentWindow,()=>this.cfg.socialBaseUrl),this.yt.on("selected-files-change",this.Np.bind(this)),this.yt.on("toolbar-state-change",this.Fp.bind(this)),this.vc());}hc(){this.yt?.destroy(),this.yt=void 0,this.He.value&&(this.He.value.innerHTML=""),this.vc();}vc(){this.Ks=[],this.js=false,this.Gs=false,this.qs=false,this.Ws=false,this.Nr=false,this.Zs=false,this.Ys="uc-hidden",this.Fr=null;}disconnectedCallback(){super.disconnectedCallback(),this.hc();}render(){return v`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${O(this.He)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.dc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Nr} ><span>${this.$p}</span><button type="button" @click=${this.zp} ?hidden=${!this.qs} >${this.l10n("select-all")}</button><button type="button" @click=${this.Hp} ?hidden=${!this.Ws} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.os} ?disabled=${!this.Gs} ?hidden=${!this.Zs} ><uc-spinner ?hidden=${this.js}></uc-spinner><span class=${this.Ys}>${this.l10n("done")}</span></button></div></div>`}};p([f()],gt.prototype,"Ks",2),p([f()],gt.prototype,"js",2),p([f()],gt.prototype,"Gs",2),p([f()],gt.prototype,"qs",2),p([f()],gt.prototype,"Ws",2),p([f()],gt.prototype,"Nr",2),p([f()],gt.prototype,"Zs",2),p([f()],gt.prototype,"Ys",2),p([f()],gt.prototype,"dc",2);var Tl=()=>typeof navigator.permissions<"u";var Hd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Kd=["camera","microphone"];function go(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}var xl="image/jpeg",Sl="video/webm",B=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Vr=null;this.Xs=false;this.Pi=[];this.Ot=null;this.It=null;this._r=null;this.Br=null;this.g=null;this.Li={};this.Mt=null;this.i=null;this.Ke=[];this.je=[];this.Kp={};this.zr=[];this.Hr=null;this.yc=()=>{this.bc(),this.Ri="pause";};this.wc=()=>{this.Ri="play",this.jp();};this.Ui=I();this.ce=I();this.W=I();this.Ec=0;this.xc=0;this.Tc=null;this.Kr=true;this.jr=true;this.Gp=Tl();this.Cc=[];this.fe=true;this.Qs="";this.Ge=true;this.me=true;this.qe=true;this.Sc=[];this.ge=true;this.Js=true;this.ve=true;this.Dt=true;this.ye=true;this.We="camera-full";this.Ri="play";this.Ac="microphone";this.Gr="uc-shot-btn uc-camera-action";this.qp=()=>{if(this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===L.PHOTO&&this.Wp(),this.g===L.VIDEO){if(this.Ot?.state==="recording"){this.kc();return}this.Zp();}};this.Yp=t=>{let e=t.target;e&&(this.Br=e.value,this.Ze());};this.Xp=t=>{let e=t.target;e&&(this._r=e.value,this.Ze());};this.Qp=()=>{this.Ze();};this.Jp=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.qp();};this.th=()=>{this.eh();};this.ih=()=>{this.rh();};this.oh=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.sh();};this.nh=()=>{this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.ah();};this.Mc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Oc(r);};this.Ic=()=>{let t=Math.floor((performance.now()-this.Ec+this.xc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Ui.value;s&&(s.textContent=go(e)),this.kc();return}let r=this.Ui.value;r&&(r.textContent=go(e));}else {let e=this.Ui.value;e&&(e.textContent=go(t));}this.Ye=requestAnimationFrame(this.Ic);};this.lh=()=>{this.Ec=performance.now(),this.xc=0,this.Ic();};this.Pc=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.bc=()=>{let t=this.W.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.ce.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.Ui.value;n&&(n.textContent=go(e)),this.Ye=requestAnimationFrame(this.bc);};this.jp=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.Ye=null;this.Zp=()=>{try{this.Pi=[],this.Li={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Li.mimeType=t:MediaRecorder.isTypeSupported(Sl)?this.Li.mimeType=Sl:this.Li.mimeType="video/mp4",this.It&&(this.Ot=new MediaRecorder(this.It,this.Li),this.Ot.start(),this.Ot.addEventListener("dataavailable",e=>{this.Pi.push(e.data);}),this.lh(),this.classList.add("uc-recording"),this.$i(St.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.kc=()=>{this.Ot?.addEventListener("stop",()=>{this.ch(),this.Pc(),this.$i(St.STOP);}),this.Ot?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.g}}});};this.eh=()=>{if(this.Ot?.state==="recording")return;let t=this.W.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.rh=()=>{this.It?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.Ac=t.enabled?"microphone":"microphone-mute",this.Js=!t.enabled;});};this.ch=()=>{try{let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=URL.createObjectURL(t),r=this.W.value;if(!r)return;r.muted=!1,r.volume=1,this.Di(null),r.src=e,this.uh(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.sh=()=>{if(this.$i(St.RETAKE),this.g===L.VIDEO){this.Di(this.It);let t=this.W.value;t&&(t.muted=true);}this.W.value?.play?.();};this.ah=()=>{if(this.$i(St.ACCEPT),this.g===L.PHOTO){this.Mt?.toBlob(s=>{if(!s)return;let n=this.Lc("camera","jpeg",xl,s);this.Rc(n);},xl);return}let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=this.dh(this.Ot?.mimeType),r=this.Lc("video",e,`video/${e}`,t);this.Rc(r),this.Pi=[];};this.ph=t=>{t===St.SHOT&&(this.ye=true,this.me=true,this.Dt=true,this.qe=false,this.fe=true),(t===St.RETAKE||t===St.ACCEPT)&&(this.ye=!this.Ft.includes(L.VIDEO),this.Dt=!this.Ft.includes(L.PHOTO),this.me=false,this.qe=true,this.fe=this.Ke.length<=1);};this.hh=t=>{t===St.PLAY&&(this.Ge=false,this.Dt=true,this.fe=true,this.ge=true,this.Ri="pause",this.We="square",this.Gr="uc-shot-btn uc-camera-action uc-stop-record"),t===St.STOP&&(this.Ge=false,this.me=true,this.ve=true,this.qe=false),(t===St.RETAKE||t===St.ACCEPT)&&(this.Ge=true,this.ye=!this.Ft.includes(L.VIDEO),this.Dt=!this.Ft.includes(L.PHOTO),this.me=false,this.qe=true,this.ve=!this.cfg.enableAudioRecording,this.We="video-camera-full",this.Gr="uc-shot-btn uc-camera-action",this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this.fe=this.Ke.length<=1);};this.$i=t=>{this.g===L.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.ph(t),this.g===L.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.hh(t);};this.Oc=t=>{t===L.PHOTO&&(this.We="camera-full",this.ge=true,this.ve=true),t===L.VIDEO&&(this.Ri="play",this.We="video-camera-full",this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this.ve=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:D.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.g=t;};this.Lc=(t,e,r,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:r})};this.Rc=t=>{this.api.addFileFromObject(t,{source:U.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this.Fi=F(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.Kr=false,this.me=false,this.Dt=!this.Ft.includes(L.PHOTO),this.ye=!this.Ft.includes(L.VIDEO),this.jr=true,this.Ge=true,this.We=r,this.ve=!e,this.ge=!e):t==="prompt"?(this.Qs="camera-permissions-prompt",this.Kr=true,this.me=true,this.Dt=true,this.jr=false,this.rn()):(this.Qs="camera-permissions-denied",this.Kr=true,this.jr=false,this.Dt=!this.Ft.includes(L.PHOTO),this.ye=!this.Ft.includes(L.VIDEO),this.qe=true,this.Gr="uc-shot-btn uc-camera-action",this.rn());},300);this.fh=()=>{if(!this.It)return false;let t=this.It?.getAudioTracks(),e=this.It?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.rn=()=>{this.Xs&&(this.W.value&&(this.W.value.volume=0),this.Hr?.getTracks?.()?.[0]?.stop(),this.tn(this.W.value),this.Di(null),this.fh(),this.Pc(),this.Xs=false);};this.Ze=async()=>{let t={video:{...Hd},audio:this.cfg.enableAudioRecording?{}:false};this.Br&&(t.video={deviceId:{exact:this.Br}}),this._r&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this._r}}),this.W.value&&(this.W.value.volume=0);try{this.Fi("prompt"),this.It=await navigator.mediaDevices.getUserMedia(t),this.It.addEventListener("inactive",()=>{this.Fi("denied");}),this.Di(this.It),this.Xs=!0,this.Fi("granted");}catch(e){this.Fi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.Uc=()=>{this.Ze();};this.mh=async()=>{try{this.qr();for(let t of Kd){let e=await navigator.permissions.query({name:t});this.Kp[t]=e,e.addEventListener("change",this.Uc),this.zr.push(()=>{e.removeEventListener("change",this.Uc);});}this.Vr=()=>{this.qr();};}catch(t){this.qr(),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.Ze();}};this.gh=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.sn(),navigator.mediaDevices.addEventListener("devicechange",this.sn);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.sn=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Ke=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this.je=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Cc=this.Ke,this.fe=this.Ke.length<=1,this.Br=this.Ke[0]?.value??null,this.Sc=this.je,this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this._r=this.je[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.vh=async()=>{await this.mh(),await this.gh(),await this.Ze(),this.$c(this.Ft);};this.yh=async()=>{this.Vr&&this.Vr(),window.chrome||this.Fi("denied"),this.rn();};this.$c=t=>{this.ye=!t.includes(L.VIDEO),this.Dt=!t.includes(L.PHOTO);let e=t[0];e&&(!this.g||!t.includes(this.g))&&this.Oc(e);};}uh(t){this.tn(t),t.addEventListener("play",this.yc),t.addEventListener("pause",this.wc);}tn(t){t?.removeEventListener("play",this.yc),t?.removeEventListener("pause",this.wc);}Di(t){this.Hr!==t&&(this.Hr=t,this.en());}en(){let t=this.W.value;if(!t)return;let e=this.Hr??null;t.srcObject!==e&&(t.srcObject=e);}Wp(){if(this.$i("shot"),this.Mt=document.createElement("canvas"),this.i=this.Mt.getContext("2d"),!this.i)throw new Error("Failed to get canvas context");let t=this.W.value;if(!t)throw new Error("Video element not found");this.Mt.height=t.videoHeight,this.Mt.width=t.videoWidth,this.cfg.cameraMirror&&(this.i.translate(this.Mt.width,0),this.i.scale(-1,1)),this.i.drawImage(t,0,0),t.pause();}dh(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 Ft(){return Z(this.cfg.cameraModes).filter(t=>t===L.PHOTO||t===L.VIDEO)}qr(){if(this.zr.length!==0){for(let t of this.zr)t();this.zr=[],this.Vr=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Tc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ve=!t,this.Js=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=j(t);this.$c(e.filter(r=>r===L.PHOTO||r===L.VIDEO));}),this.vh();}firstUpdated(t){super.firstUpdated(t),this.en();}updated(t){super.updated(t),this.en();}bh(){this.qr(),navigator.mediaDevices?.removeEventListener("devicechange",this.sn),this.tn(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.yh(),this.bh();}render(){return v`<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.fe}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Cc} ?hidden=${this.fe} @change=${this.Yp} ></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=${Pe({transform:this.Tc})} ?hidden=${this.Kr} ${O(this.W)} ></video><div class="uc-message-box" ?hidden=${this.jr}><span>${this.l10n(this.Qs)}</span><button type="button" @click=${this.Qp} ?hidden=${this.Gp} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.Ge}><button data-id="photo" type="button" class=${lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===L.PHOTO})} @click=${this.Mc} ?hidden=${this.Dt} 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.Mc} ?hidden=${this.ye} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.th} ?hidden=${this.Ge} data-testid="recording-timer" ><uc-icon name=${this.Ri}></uc-icon><span ${O(this.Ui)}> 00:00 </span><span ${O(this.ce)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.qe} ><button type="button" class="uc-secondary-btn" @click=${this.oh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.nh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.Jp} class=${this.Gr} ?hidden=${this.me} ><uc-icon name=${this.We}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ih} ?hidden=${this.ve} data-testid="toggle-microphone" ><uc-icon name=${this.Ac}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Sc} ?hidden=${this.ge} ?disabled=${this.Js} @change=${this.Xp} data-testid="audio-select" ></uc-select></div></div>`}};p([f()],B.prototype,"Tc",2),p([f()],B.prototype,"Kr",2),p([f()],B.prototype,"jr",2),p([f()],B.prototype,"Gp",2),p([f()],B.prototype,"Cc",2),p([f()],B.prototype,"fe",2),p([f()],B.prototype,"Qs",2),p([f()],B.prototype,"Ge",2),p([f()],B.prototype,"me",2),p([f()],B.prototype,"qe",2),p([f()],B.prototype,"Sc",2),p([f()],B.prototype,"ge",2),p([f()],B.prototype,"Js",2),p([f()],B.prototype,"ve",2),p([f()],B.prototype,"Dt",2),p([f()],B.prototype,"ye",2),p([f()],B.prototype,"We",2),p([f()],B.prototype,"Ri",2),p([f()],B.prototype,"Ac",2),p([f()],B.prototype,"Gr",2);var Al={id:"camera",setup:async({pluginApi:o,uploaderApi:i})=>{vt({CameraSource:B}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!Qn.htmlMediaCapture)return ["camera"];let t=j(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},onSelect:()=>{i.setCurrentActivity(N.CAMERA),i.setModalState(true);}}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),o.registry.registerActivity({id:N.CAMERA,render:t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}}});}};var js={};Zs(js,{BtnUi:()=>At,CloudImageEditor:()=>mo,CloudImageEditorBlock:()=>et,Config:()=>ei,CropFrame:()=>Vi,EditorAspectRatioButtonControl:()=>Bi,EditorCropButtonControl:()=>zi,EditorFilterControl:()=>Qt,EditorFreeformButtonControl:()=>ho,EditorImageCropper:()=>Ni,EditorImageFader:()=>co,EditorOperationControl:()=>Hi,EditorScroller:()=>Ki,EditorSlider:()=>_i,EditorToolbar:()=>ft,Icon:()=>ce,LineLoaderUi:()=>Fi,PresenceToggle:()=>oi,SliderUi:()=>Nt,defineComponents:()=>vt});var jd="cloud-image-editor",Gd="<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>",kl={id:jd,setup:async({pluginApi:o,uploaderApi:i})=>(vt({...js,...Ks}),o.registry.registerIcon({name:"edit-file",svg:Gd}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:e=>!!(e.isImage&&e.cdnUrl),onClick:e=>{i.setCurrentActivity?.(N.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);}}),o.registry.registerActivity({id:N.CLOUD_IMG_EDIT,render:e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}}}),i.on(A.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),n=o.config.get("cloudImageEditorAutoOpen"),a=i.v.size;s&&a===1&&(r||n)&&(i.setCurrentActivity?.(N.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));}))};var Ml={id:"external-sources",setup:async({pluginApi:o,uploaderApi:i})=>{vt({ExternalSource:gt}),o.registry.registerActivity({id:N.EXTERNAL,render:t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}}});for(let t of Object.values(mt))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:()=>{i.setCurrentActivity(N.EXTERNAL,{externalSourceType:t}),i.setModalState(true);}});}};var yo=()=>{let o=[];return {stack:o,promiseReadJpegChunks:t=>new Promise((e,r)=>{let s=2,n=(c,d)=>{let u=new FileReader;u.addEventListener("load",()=>{d(new DataView(u.result));}),u.addEventListener("error",h=>{r(`Reader error: ${h}`);}),u.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let d,u,h;for(d=u=0,h=c.byteLength;h>=0?u<h:u>h;d=h>=0?++u:--u)if(c.getUint8(d)===255){s+=d;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){r("Corrupted");return}let u=d.getUint8(1);if(u===218){e(true);return}let h=d.getUint16(2)-2;return n(t.slice(s,s+=h),m=>{if(m.byteLength!==h){r("Corrupted");return}o.push({startPos:c,length:h,marker:u,view:m}),a();})})};FileReader&&DataView||r("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&r("Not jpeg"),a();});})}},qd=async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=yo();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},Ol=async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=yo();await s(o),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),r.push(c.length)});let a=[o.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),a.push(d.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(o.slice(l,e[c])),l=e[c]+r[c]+4;return a.push(o.slice(l,o.size)),new Blob(a,{type:o.type})}};var Ll=(o,i)=>Ol(o,226,i.map(t=>t.buffer)),Wd=async o=>{try{return await Ll(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Zd=(o,i,t)=>new Promise((e,r)=>{let s=n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);};o.toBlob(s,i,t),o.width=o.height=1;}),Gi=()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},Yd=o=>{let{ctx:t,canvas:e}=Gi();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},Xd=async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=yo();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},Qd="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",vo,Jd=()=>new Promise(o=>{if(vo!==void 0)o(vo);else {let i=new Image;i.addEventListener("load",()=>{vo=i.naturalWidth<i.naturalHeight,i.src="//:0",o(vo);}),i.src=Qd;}}),tp=(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;}},ep=(o,i)=>{tp(o,(t,e)=>o.setUint16(t,i,e));},ip=async(o,i,t)=>(t&&ep(i,1),Ol(o,225,[i.buffer])),rp=(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."));}));}),op=o=>rp(new Image,o),sp=[1,3],np=[192,193,194,195,197,198,199,201,202,203,205,206,207],Il={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},ap=async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=yo();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&np.indexOf(r)>=0){let n=s.getUint8(5);sp.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},Pl=(o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},Rl=(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},he={R:55,G:110,B:165,A:255},lp=`rgba(${he.R}, ${he.G}, ${he.B}, ${he.A/255})`,Ul=(o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=Gi();e.width=1,e.height=1;let{canvas:s,ctx:n}=Gi();s.width=o,s.height=i,n&&(n.fillStyle=lp,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===he.R&&a[1]===he.G&&a[2]===he.B&&a[3]===he.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}};function $l(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}var cp=$l(Pl(Ul,Rl)),up=$l(Pl(Ul,Rl)),Dl=async(o,i)=>{let t=Il.squareSide.find(n=>n*n>=o*i),e=Il.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([cp(t,t),up(e,1)]);if(r&&s)return true;throw new Error("Not supported")},Fl=async(o,i,t)=>{try{let{ctx:e,canvas:r}=Gi();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})}},dp=({img:o,targetW:i,targetH:t})=>Fl(o,i,t),pp=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()},hp=({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=pp({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[a,l],c)=>n.then(d=>Dl(a,l).then(()=>Fl(d,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return d})),Promise.resolve(o))},mp=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),fp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Gs=.71,gp=(o,i)=>{if(o.width*Gs*o.height*Gs<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 Dl(s,n).then(()=>{let{ctx:a}=Gi();return "imageSmoothingQuality"in a&&!mp()&&!fp?dp({img:o,targetW:s,targetH:n}):hp({img:o,sourceW:t,targetW:s,targetH:n,step:Gs})}).catch(()=>Promise.reject("Not supported"))},Vl=async(o,i)=>{try{if(await ap(o))throw new Error("Should skipped");let e=await Promise.allSettled([Xd(o),Jd(),qd(o)]),s=!e.some(b=>b.status==="rejected"),[n,a,l]=e,c=await Wd(o).catch(()=>o),d=await op(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let u=await gp(d,i),h="image/jpeg",m=i?.quality||.8;!s&&Yd(u)&&(h="image/png",m=void 0);let g=await Zd(u,h,m);if(s&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await ip(g,b,w);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await Ll(g,l.value)),g}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})}};var vp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Nl=o=>{if(typeof o!="string")return false;let i=vp.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}};var _l={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=Nl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Vl(i,e)}}catch{return {file:i}}}});}};var Bl={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),onSelect:()=>{}});}};var zl={id:U.LOCAL,setup:({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:U.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{i.openSystemDialog();}});}};var Hl={id:"url-source",setup:async({pluginApi:o,uploaderApi:i})=>{vt({UrlSource:ai}),o.registry.registerActivity({id:N.URL,render:t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}}}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{i.setCurrentActivity(N.URL),i.setModalState(true);}});}};var li=[{configDeps:["useCloudImageEditor"],isEnabled:o=>!!o("useCloudImageEditor"),load:()=>kl},{configDeps:["imageShrink"],isEnabled:o=>!!o("imageShrink"),load:()=>_l},{configDeps:["sourceList"],isEnabled:o=>j(o("sourceList")).includes(U.LOCAL),load:()=>zl},{configDeps:["sourceList"],isEnabled:o=>j(o("sourceList")).includes(U.CAMERA),load:()=>Al},{configDeps:["sourceList"],isEnabled:o=>j(o("sourceList")).includes("instagram"),load:()=>Bl},{configDeps:["sourceList"],isEnabled:o=>Object.values(mt).some(i=>j(o("sourceList")).includes(i)),load:()=>Ml},{configDeps:["sourceList"],isEnabled:o=>j(o("sourceList")).includes(U.URL),load:()=>Hl}];var qi=class extends Yt{constructor(){super();this.headless=false;this.dynamicButton=false;this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});}get isDynamicButtonActive(){return this.dynamicButton}wh(){return v`<uc-dynamic-btn></uc-dynamic-btn>`}Eh(){return v`<uc-simple-btn></uc-simple-btn>`}xh(){return this.headless?null:this.dynamicButton?this.wh():this.Eh()}render(){return v` ${super.render()} ${this.xh()}<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>`}};p([y({type:Boolean})],qi.prototype,"headless",2),p([y({attribute:"dynamic-button",type:Boolean})],qi.prototype,"dynamicButton",2);var bo=class extends Yt{constructor(){super();this.Dc=false;this.Ut=()=>{if(this.Fc){let t=this.$["*historyBack"];t?.();return}this.Nc&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Fc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==$.activities.START_FROM}get Nc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}nn(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.nn();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Dc=this.Fc||this.Nc;});}render(){return v` ${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.Ut} ?hidden=${!this.Dc} >${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>`}};p([f()],bo.prototype,"Dc",2);var qs="active",wo="",me=class extends Yt{constructor(){super();this.an=false;this.Wr=false;this.Zr=wo;this.ln=wo;this.mi="choose-file";this.ci=t=>{t.id===$.activities.CLOUD_IMG_EDIT&&(this.Zr=qs),this.$["*currentActivity"]===$.activities.UPLOAD_LIST&&(this.Zr=qs,this.Wr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.ln=qs);};this.ui=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.Wr=false),t.id===$.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}nn(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:D.INIT_SOLUTION});let t=this.nn();this.sub("*currentActivity",e=>{e===$.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.ln=wo):(this.Zr=wo,this.Wr=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.an=!r):(this.style.removeProperty("--uc-grid-col"),this.an=false);});}),this.subConfigValue("multiple",e=>{this.mi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(Y.OPEN,this.ci),this.modalManager?.subscribe(Y.CLOSE,this.ui);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(Y.OPEN,this.ci),this.modalManager?.unsubscribe(Y.CLOSE,this.ui);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.Wr} class=${this.ln}><uc-drop-area ?single=${this.an} initflow clickable tabindex="0" ><span>${this.l10n(this.mi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Zr}></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>`}};p([f()],me.prototype,"an",2),p([f()],me.prototype,"Wr",2),p([f()],me.prototype,"Zr",2),p([f()],me.prototype,"ln",2),p([f()],me.prototype,"mi",2);/*! For license information please see uc-file-uploader-minimal.min.js.LEGAL.txt */
|
|
8
|
+
export{$ as ActivityBlock,Is as ActivityHeader,Ro as BaseComponent,T as Block,At as BtnUi,B as CameraSource,mo as CloudImageEditor,ji as CloudImageEditorActivity,et as CloudImageEditorBlock,ei as Config,As as Copyright,Vi as CropFrame,H as Data,bt as DropArea,lo as DropDown,Vt as DynamicBtn,Bi as EditorAspectRatioButtonControl,zi as EditorCropButtonControl,Qt as EditorFilterControl,ho as EditorFreeformButtonControl,Ni as EditorImageCropper,co as EditorImageFader,Hi as EditorOperationControl,Ki as EditorScroller,_i as EditorSlider,ft as EditorToolbar,gt as ExternalSource,mt as ExternalUploadSource,Me as FileActionButton,Ps as FileItem,bo as FileUploaderInline,me as FileUploaderMinimal,qi as FileUploaderRegular,ro as FormInput,ce as Icon,Es as Img,Fi as LineLoaderUi,Ii as Modal,Y as ModalEvents,zs as NoWrapModeDynamicBtn,Rt as PACKAGE_NAME,Ut as PACKAGE_VERSION,$i as PluginActivityHost,ri as PluginActivityRenderer,oi as PresenceToggle,Bs as PrimaryAction,Ye as ProgressBar,Oi as ProgressBarCommon,Xe as Select,Ui as SimpleBtn,Nt as SliderUi,Yt as SolutionBlock,de as SourceBtn,Li as SourceList,ks as Spinner,Os as StartFrom,ti as Thumb,rt as UID,Ls as UploadCtxProvider,Lt as UploadList,U as UploadSource,M as UploaderBlock,ai as UrlSource,vt as defineComponents,wn as defineLocale,pc as loadFileUploaderFrom,yr as toKebabCase};
|